Thread: stl map erase

  1. #1
    Registered User
    Join Date
    Jul 2009

    stl map erase

    I have this function which works fine in visual studio:

    btw this is code for a c++ stl map, where map is Life and the iterator is di.

    void structure::deletion_process()
    	for (di = Life.begin(); di != Life.end(); /* nothing here */)
    		if (di->second.getDelete())
    		  di =Life.erase(di);
    but when i run it in linux i get this error:
    error: no match for operator=

  2. #2
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    United States
    map::erase() does not return an iterator. It returns nothing unless you call the version that erases all occurrences of a specific value, which returns a count. You've been using an implementation of erase() specific to visual studio, apparently.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 47
    Last Post: 07-13-2010, 07:22 PM
  2. Polynomials and ADT's
    By Emeighty in forum C++ Programming
    Replies: 20
    Last Post: 08-19-2008, 08:32 AM
  3. STL List Erase
    By shamgar00 in forum C++ Programming
    Replies: 7
    Last Post: 10-22-2007, 02:58 PM
  4. STL Map Object
    By nomes in forum C++ Programming
    Replies: 6
    Last Post: 09-11-2003, 01:51 PM
  5. Searching STL Map Inside STL Map Object :: C++
    By kuphryn in forum C++ Programming
    Replies: 2
    Last Post: 11-14-2002, 09:11 AM