473,385 Members | 1,908 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,385 software developers and data experts.

C2064: term does not evaluate to a function ( While using STL map)

Hi I am using STL map in VC++6.0 application.
type of project is MFC DLL.

My code looks like:--

typedef std::map <unsigned long,LPVOID, BOOL> MyMap;

In class definition file i am using this map as:--

MyMap m_mapPHLRecorder ;
MyMap::iterator m_Iterator;

In one function of implementation file the code is :--

m_Iterator = m_mapPHLRecorder.find(nRecorderID);
if (m_Iterator != m_mapPHLRecorder.end())
{
return (*m_Iterator).second ;
}
else
{
// Error Reporting
// Message Line 1: Unable to find Protocol Handler Library.
// Message Line 2: Invalid Recorder Serial Number.
return NULL;
}
If I am not calling the STL map's functions then no errors are coming.

Can anybody please help.

Jul 22 '05 #1
6 2153
kushalsoftpro wrote:
Hi I am using STL map in VC++6.0 application.
type of project is MFC DLL.

My code looks like:--

typedef std::map <unsigned long,LPVOID, BOOL> MyMap;
What's the BOOL for? The third argument of 'std::map' template is
supposed to be a _functor_.

In class definition file i am using this map as:--

MyMap m_mapPHLRecorder ;
MyMap::iterator m_Iterator;

In one function of implementation file the code is :--

m_Iterator = m_mapPHLRecorder.find(nRecorderID);
if (m_Iterator != m_mapPHLRecorder.end())
{
return (*m_Iterator).second ;
}
else
{
// Error Reporting
// Message Line 1: Unable to find Protocol Handler Library.
// Message Line 2: Invalid Recorder Serial Number.
return NULL;
}
If I am not calling the STL map's functions then no errors are coming.

Can anybody please help.


You can help yourself if you read the reference for the Standard library,
the section about the 'map' template.

V
Jul 22 '05 #2

"Victor Bazarov" <v.********@comAcast.net> wrote in message
news:vj****************@newsread1.dllstx09.us.to.v erio.net...
kushalsoftpro wrote:
Hi I am using STL map in VC++6.0 application.
type of project is MFC DLL.

My code looks like:--

typedef std::map <unsigned long,LPVOID, BOOL> MyMap;


What's the BOOL for? The third argument of 'std::map' template is
supposed to be a _functor_.


There no reason apparent from the posted code why the OP couldn't simply
remove BOOL.

typedef std::map <unsigned long,LPVOID> MyMap;

john
Jul 22 '05 #3
John Harrison wrote:
"Victor Bazarov" <v.********@comAcast.net> wrote in message
news:vj****************@newsread1.dllstx09.us.to.v erio.net...
kushalsoftpro wrote:
Hi I am using STL map in VC++6.0 application.
type of project is MFC DLL.

My code looks like:--

typedef std::map <unsigned long,LPVOID, BOOL> MyMap;


What's the BOOL for? The third argument of 'std::map' template is
supposed to be a _functor_.

There no reason apparent from the posted code why the OP couldn't simply
remove BOOL.

typedef std::map <unsigned long,LPVOID> MyMap;


Right. But it is also possible that the OP thought it ought to be the
return value type of the comparator. Perhaps a special kind of the
sorting functor is needed... Anyway, our guesses are only as good as
the information available to us. Let's hope "softpro" gets that.

V
Jul 22 '05 #4
Thanx John, Victor,

It worked.

Actually I havn't used STL much in past.

My intension was to put a third element in the map. For that only I put
BOOL as third parameter. Anyways, I have some other ways for managing this
third parameter.
Thanx again..

Jul 22 '05 #5
Thanx John, Victor,

It worked.

Actually I havn't used STL much in past.

My intension was to put a third element in the map. For that only I put
BOOL as third parameter. Anyways, I have some other ways for managing this
third parameter.
Thanx again..

Jul 22 '05 #6

"kushalsoftpro" <ku***************@gmail.com> wrote in message
news:2f******************************@localhost.ta lkaboutprogramming.com...
Thanx John, Victor,

It worked.

Actually I havn't used STL much in past.

My intension was to put a third element in the map. For that only I put
BOOL as third parameter. Anyways, I have some other ways for managing this
third parameter.


The first parameter to a map is the key that you use to look up the value.
The second parameter to a map is the value.
The third (optional) parameter to a map is the key comparison object.
The fourth (optional) parameter to a map is the allocator object.

If you want to put an LPVOID and a BOOL into a map you do it like this

struct MyData
{
LPVOID v;
BOOL b;
};
typedef std::map <unsigned long,MyData> MyMap;

Of course this means that every entry in the map has an LPVOID and a BOOL,
not that some have an LPVOID and some have a BOOL. If that was your
intention, well there are ways of doing that too.

john
Jul 22 '05 #7

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

Similar topics

4
by: Medi Montaseri | last post by:
Hope this is a right forum, else route me... I'm using map STL in Microsoft Visual C++ 6.0 and am getting warning C4786 which seems to have to do with truncating symbols as VC++ is building a...
2
by: Bryan Pietrzak | last post by:
I'm new to using the STL and templates and while I've had no problem at all using vector, I'm having a problem using map. I just want to do something like: class CMyData { // class stuff...
1
by: Charlie | last post by:
I have the first part of the project done but I'm having difficulty deciding how to add an evaluate function to this program. The program asks the user to enter a function in infix notation and...
7
by: Abhi | last post by:
Hi all, I am using .net for C++ and I would like to write some variable values to some files. I will be using that file in many member functions of the class. So I declared the file variable...
2
by: Rick427 | last post by:
I am new to .NET and was wondering if there is a function like the evaluate function in Cold Fusion that lets you use the value of something as a variable name instead of using a select case...
1
by: sck10 | last post by:
Hello, I am calling a function using vb and want to convert it to c#. When moving from vb 1.1 to vb 2.0, I can use the following: text='<%# AddBlankRowMenu(Eval("strMenuType")) %>' to call the...
1
by: patilanjana | last post by:
Hi, I am getting above mentioned errors. Checked msdn, read the comments but I fail to implement it. Please help. Error is regarding using the new and delete operators. Although I do write...
2
by: =?Utf-8?B?VmljdG9yIExhaQ==?= | last post by:
Hi, I wrote an simple application using VS2005 C#. I am trying to call some functions in my other dll file. This dll is written in EVC for running on Windows CE 5.0. This dll file has the...
5
by: teenIce | last post by:
Hi guys, How do I access flash function using javascript?Does anyone have any reference or code? Thanks...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.