I am trying to compile the following code on Linux using gcc 4.2:
#include <map>
#include <list>
template<typename T>
class A
{
...
private:
std::map<const T, std::list<std::pair<T, long int> >::iterator> lookup_map_;
std::list<std::pair<T, long int> > order_list_;
};
When I compile this class I receive the following message from gcc:
error: type/value mismatch at argument 2 in template parameter list for ‘template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map’
error: expected a type, got ‘std::list<std::pair<const T, long int>,std::allocator<std::pair<const T, long int> > >::iterator’
error: template argument 4 is invalid
I have removed file names and line numbers , but they all refer to the line declaring the map.
When I replace the pair in these expressions with an int or some concrete type, it compiles fine. Can someone please explain to me what I am doing wrong.