I have template class in which I am using typedef to declare a map as follows:
#include <map>
template <typename T> class LocalStub {
typedef std::map<T, T> QueryMap;
typedef std::pair<T, T> QueryPair;
typedef QueryMap::iterator QueryMapIterator;
public:
LocalStub();
~LocalStub();
void AddQuery(const T &, const T &);
const T &Answer(const T &) const;
private:
QueryMap _queryMap;
};
Compilation errors
../src/LocalStub/include/localstub.hpp:12: error: declaration of 'class T'
../src/LocalStub/include/localstub.hpp:11: error: shadows template parm 'class T'
../src/LocalStub/include/localstub.hpp:13: error: template declaration of 'typedef'
../src/LocalStub/include/localstub.hpp:14: error: declaration of 'class T'
../src/LocalStub/include/localstub.hpp:11: error: shadows template parm 'class T'
../src/LocalStub/include/localstub.hpp:15: error: template declaration of 'typedef'
../src/LocalStub/include/localstub.hpp:16: error: declaration of 'class T'
../src/LocalStub/include/localstub.hpp:11: error: shadows template parm 'class T'
../src/LocalStub/include/localstub.hpp:17: error: template declaration of 'typedef'
../src/LocalStub/include/localstub.hpp:26: error: 'QueryMap' does not name a type
What am I doing wrong? I don't understand why I am getting that error.