B
Bertwim
Hi,
I can't understand the compiler's error message in the following
template definition:
In a header file (.h), I have declared
==================================
template <class T>
class symtblpp
{
private:
typedef std::map< std::string, T > maptype;
maptype _map;
public:
T* lookup( const std::string& );
};
===================================
In the implementation file (.cpp), the member 'lookup' is defined:
=================================
template <class T>
T* symtblpp<T>::lookup( const std::string& key )
{
maptype::iterator it = _map.find( key );
return &(*it);
}
================================
The error message is (++, 4.3.1)
symtblpp.cpp:42: error: expected `;' before ‘it’
symtblpp.cpp:45: error: ‘it’ was not declared in this scope
where 'line 42' refers to the line with the iterator declaration.
Can somebody explain to me what I do wrong?
Tanks in advance.
Bertwim
I can't understand the compiler's error message in the following
template definition:
In a header file (.h), I have declared
==================================
template <class T>
class symtblpp
{
private:
typedef std::map< std::string, T > maptype;
maptype _map;
public:
T* lookup( const std::string& );
};
===================================
In the implementation file (.cpp), the member 'lookup' is defined:
=================================
template <class T>
T* symtblpp<T>::lookup( const std::string& key )
{
maptype::iterator it = _map.find( key );
return &(*it);
}
================================
The error message is (++, 4.3.1)
symtblpp.cpp:42: error: expected `;' before ‘it’
symtblpp.cpp:45: error: ‘it’ was not declared in this scope
where 'line 42' refers to the line with the iterator declaration.
Can somebody explain to me what I do wrong?
Tanks in advance.
Bertwim