Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > C2064: term does not evaluate to a function ( While using STL map)

Reply
Thread Tools

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

 
 
kushalsoftpro
Guest
Posts: n/a
 
      11-03-2004
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.

 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      11-03-2004
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
 
Reply With Quote
 
 
 
 
John Harrison
Guest
Posts: n/a
 
      11-03-2004

"Victor Bazarov" <(E-Mail Removed)> wrote in message
news:vj6id.7916$(E-Mail Removed)09.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


 
Reply With Quote
 
Victor Bazarov
Guest
Posts: n/a
 
      11-03-2004
John Harrison wrote:
> "Victor Bazarov" <(E-Mail Removed)> wrote in message
> news:vj6id.7916$(E-Mail Removed)09.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
 
Reply With Quote
 
kushalsoftpro
Guest
Posts: n/a
 
      11-04-2004
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..



 
Reply With Quote
 
kushalsoftpro
Guest
Posts: n/a
 
      11-04-2004
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..



 
Reply With Quote
 
John Harrison
Guest
Posts: n/a
 
      11-04-2004

"kushalsoftpro" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
term does not evaluate to a function taking 1 arguments KevinSimonson C++ 6 10-23-2010 08:45 AM
What is the function to evaluate code object returned byPyParser _SimpleParseString function? Borse, Ganesh Python 0 11-15-2007 09:15 AM
Error C2064 : term does not evaluate to a function using 1 arguments Abhi C++ 7 10-06-2005 12:46 AM
RE: if does not evaluate Robert Brewer Python 33 06-17-2004 06:48 AM
if does not evaluate Jim Newton Python 8 06-08-2004 04:57 PM



Advertisments