473,394 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Error with template syntax, please help

//
// 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;
}


Jul 19 '05 #1
2 1920
Peter Olcott wrote in
news:C7*********************@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/
Jul 19 '05 #2
> > Type2* find(Type2& T1);
inline Type2* MapAny2Any<Type1, Type2>::find(Type1& T1)


Note the different argument types.

HTH.

Rob.


That did it, thanks.
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
19
by: Alf P. Steinbach | last post by:
// As usual the error message directs one to the report the bug. // // And as usual there is absolutely no way to do so without paying for // the privilege... // // Or using three or four hours...
6
by: Yan | last post by:
Here is the code: class A {}; void (A::*A) (); // Line 3 int main() { A a; // Line 6 return 0; }
5
by: chrisstankevitz | last post by:
Hi, Q1: Is there a way to make a template function that works only for specific types which produces a compiler error if used with an invalid type? Q2: If not, how do people deal with this...
4
by: sreenubkaimal | last post by:
Please help me with this.. I have a DLL created in Visual C++ 6.0 ( VS 6.0 ). I am trying to use this DLL in a new wrapper application written using Visual Studio .net 2003 (C++ - MFC). My...
2
by: Nick | last post by:
I'm learning C++ and ran into a compile error using Visual C++ 2005 Express on the following example program (located at http://www.cplusplus.com/doc/tutorial/templates.html): // template...
9
by: Adam Nielsen | last post by:
Hi all, I'm a bit confused about the syntax used to access a nested template class. Essentially I have a bunch of class types to represent different types of records in a database, and I want...
1
by: mokkaimohan | last post by:
Hi friends, I have a problem on Template . This part of code works fine while running in Visual Studio 6.0 but throws error in VS2005.Error is {error C2143: syntax error : missing ';' before '*'}...
2
by: Jolie Chen | last post by:
I am learning template programming now, and I wrote the following code #include <iostream> #include "Queue.h" using namespace std; template <typename Tclass QueueItem { public: QueueItem(T...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.