//
// 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;
}
|
|
0
|
|
|
|
Reply
|
olcott1 (1189)
|
11/14/2003 12:14:26 AM |
|
Peter Olcott wrote in
news:C7Vsb.58181$Ec1.3546900@bgtnsc05-news.ops.worldnet.att.net:
> //
> // 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 //
> //
> //
> Type2* find(Type2& T1);
> inline Type2* MapAny2Any<Type1, Type2>::find(Type1& T1)
Note the different argument types.
HTH.
Rob.
--
http://www.victim-prime.dsl.pipex.com/
|
|
0
|
|
|
|
Reply
|
rtw (385)
|
11/14/2003 12:33:50 AM
|
|
> > Type2* find(Type2& T1);
>
> > inline Type2* MapAny2Any<Type1, Type2>::find(Type1& T1)
>
> Note the different argument types.
>
> HTH.
>
> Rob.
That did it, thanks.
|
|
0
|
|
|
|
Reply
|
olcott1 (1189)
|
11/14/2003 3:54:26 AM
|
|