P
Peter Olcott
//
// The code below produces the following compiler error message.
// I don't know enough about the correct syntax to fix this problem.
// What am I doing wrong? Thanks.
//
// test.cpp(29) : error C2244: 'MapAny2Any<Type1,Type2>::find' : unable to resolve function overload
//
//
//
#include <map>
template <class Type1, class Type2>
class MapAny2Any {
private:
std::map<Type1, Type2> AnyMap;
public:
void insert(Type1& T1, Type2& T2);
Type2* find(Type2& T1);
};
template <class Type1, class Type2>
inline void MapAny2Any<Type1, Type2>::insert(Type1& T1, Type2& T2)
{
insert(std::make_pair(T1, T2));
}
template <class Type1, class Type2>
inline Type2* MapAny2Any<Type1, Type2>::find(Type1& T1)
{
std::map<Type1, Type2>::iterator Pos;
Pos = AnyMap.find(T1);
if (Pos != AnyMap.end())
return &Pos->second;
return NULL;
}
int main()
{
return 0;
}
// The code below produces the following compiler error message.
// I don't know enough about the correct syntax to fix this problem.
// What am I doing wrong? Thanks.
//
// test.cpp(29) : error C2244: 'MapAny2Any<Type1,Type2>::find' : unable to resolve function overload
//
//
//
#include <map>
template <class Type1, class Type2>
class MapAny2Any {
private:
std::map<Type1, Type2> AnyMap;
public:
void insert(Type1& T1, Type2& T2);
Type2* find(Type2& T1);
};
template <class Type1, class Type2>
inline void MapAny2Any<Type1, Type2>::insert(Type1& T1, Type2& T2)
{
insert(std::make_pair(T1, T2));
}
template <class Type1, class Type2>
inline Type2* MapAny2Any<Type1, Type2>::find(Type1& T1)
{
std::map<Type1, Type2>::iterator Pos;
Pos = AnyMap.find(T1);
if (Pos != AnyMap.end())
return &Pos->second;
return NULL;
}
int main()
{
return 0;
}