keine passenden member-Funktion für Aufruf von "löschen"

Hier ist der code, der den Fehler verursacht:

Fabrik.h:

#include <string>
#include <map>

namespace BaseSubsystems
{
    template <class T>
    class CFactory
    {
    protected:
        typedef T (*FunctionPointer)();
        typedef std::pair<std::string,FunctionPointer> TStringFunctionPointerPair;
        typedef std::map<std::string,FunctionPointer> TFunctionPointerMap;
        TFunctionPointerMap _table;
    public:
        CFactory () {}
        virtual ~CFactory();
    }; //class CFactory

    template <class T> 
    inline CFactory<T>::~CFactory()
    {
        TFunctionPointerMap::const_iterator it = _table.begin();
        TFunctionPointerMap::const_iterator it2;

        while( it != _table.end() )
        {
            it2 = it;
            it++;
            _table.erase(it2);
        }

    } //~CFactory
}

Und den Fehler bekomme ich:

error: no matching member function for call to 'erase' [3]
                         _table.erase(it2);
                         ~~~~~~~^~~~~

Irgendwelche Tipps?
Danke.

Was ist die Notwendigkeit der it2 ? Wie wäre _table.erase(it++) ?

InformationsquelleAutor frarees | 2012-02-06

Schreibe einen Kommentar