CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: STL and MFC

  1. #1
    Join Date
    Apr 1999
    Posts
    3

    STL and MFC

    Anyone out thier have any examples of using any of the STL container class inside of the MFC Document View enviroment? any help would be greatly APP.



  2. #2
    Join Date
    May 1999
    Location
    Antwerp, Belgium
    Posts
    136

    Re: STL and MFC

    Hi,

    I'm using stl in my document class. My application has project files. In each projectfile I can have multiple source files. The pointers to these source files are stored in a map like this :


    #include <string>
    #include <map>

    typedef std::string cstring;
    typedef std::map<cstring, CSourceFile *> SourceFileMap;




    In my document class I declare a member like this :

    SourceFileMap m_SourceFiles;



    Adding a sourcefile to this map is like this :

    m_SourceFiles.insert(std::make_pair(sFileName, pSourceFile));;



    I use the insert-method instead of the operator[] because the operator[] does a lot of extra object creations and destructions.

    A good resource for learning stl is the Thinking in C++ pages on codeguru : http://www.codeguru.com/cpp/tic/index.shtml


  3. #3
    Join Date
    Apr 1999
    Posts
    3

    Re: STL and MFC

    Thanks Frank,
    I did get a map to store information? ( thanks to your info)
    I'm having a little trouble displaying back in the view ?
    Thank again for your help




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured