std::map insert segmentation fault

Posted by Jakub Czaplicki on Stack Overflow See other posts from Stack Overflow or by Jakub Czaplicki
Published on 2010-05-30T20:59:16Z Indexed on 2010/05/30 21:12 UTC
Read the original article Hit count: 245

Filed under:
|

Why does this code stop with segmentation fault :

class MapFile
{
 public:
   /* ... */
   std::map <unsigned int, unsigned int> inToOut;
};

bool MapFile::LoadMapFile( const wxString& fileName )
{
    /* ... */
   inToOut.insert( std::make_pair(input,output) );
}

but this one works fine :

class MapFile
{
 public:
   /* ... */
};

bool MapFile::LoadMapFile( const wxString& fileName )
{
    /* ... */
   std::map <unsigned int, unsigned int> inToOut;
   inToOut.insert( std::make_pair(input,output) );
}

?

© Stack Overflow or respective owner

Related posts about c++

Related posts about stl