[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

template member function template variable decl error



The following code fails to compile with the error:

g++ (GCC) 3.4.4 20050314 (prerelease) (Debian 3.4.3-13)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


g++ -I`pwd` -g   -x c++ -c main.cpp -o objects/main.o
In file included from main.cpp:3:
map.h: In member function `void Map<T>::insert(RWCString&, const T*)':
map.h:50: error: expected `;' before "itr"
map.h:52: error: `itr' undeclared (first use this function)
map.h:52: error: (Each undeclared identifier is reported only once for each function it appears in.)
make: *** [objects/main.o] Error 1


template<class T>
void Map<T>::insert(RWCString& name, const T*item) throw()
{
    T* field = Map<T>::empty;
    map<RWCString,T*>::iterator itr;
    if ( itr < map_.end() )
        throw Exception( "Map::insert() : <<" + name + ">> already in container." );
    throw Exception("map iterator definition issue?");
    map_[name] = item;
}

This appears to be similar to the bug:


     http://lists.debian.org/debian-gcc/2003/02/msg00029.html

Thanks



Reply to: