I'm writing a template class that uses a std::multimap as a member, and getting compile errors.
LocTree.h:
#pragma once
#include <map>
template <class Loc, class T>
class LocTree
{
public :
typedef std::multimap<typename Loc, typename T> TreeType;
LocTree( void );
~LocTree( void ) { };
private :
TreeType db;
};
LocTree.cpp:
#include "StdAfx.h"
#include "LocTree.h"
LocTree< class Loc, class T>::LocTree()
{
}
The compile error (from VC2005) :
Error 1 error C2079: 'std::pair<_Ty1,_Ty2>::first' uses undefined class 'Loc' c:\program files (x86)\microsoft visual studio 8\vc\include\utility 53
Error 2 error C2079: 'std::pair<_Ty1,_Ty2>::second' uses undefined class 'T' c:\program files (x86)\microsoft visual studio 8\vc\include\utility 54
I know I could put the function definitions in the .h but I'm hoping to keep them separate, if it's legal to do so. How do I fix this (probably newbie) problem?