Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > std::map<> error message only in in release mode

Reply
Thread Tools

std::map<> error message only in in release mode

 
 
Rune Allnor
Guest
Posts: n/a
 
      10-17-2009
Hi all.

I have an application that compiles silently in debug mode. When
switching
to release mode, the following error message appears:

C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xtree(126 :
error C3848: expression having type 'const
mynamespace:ointListLess<T>' would lose some const-volatile
qualifiers in order to call 'bool
mynamespace:ointListLess<T>:perator ()(const size_t &,const size_t
&)'

I have never seen this error before, and What should I look for to
find the cause?
Except for one message that points out the class where the map is
declared, the
remaining error messages refer to the map and xtree headers.

Rune
 
Reply With Quote
 
 
 
 
Maxim Yegorushkin
Guest
Posts: n/a
 
      10-17-2009
On 17/10/09 23:36, Rune Allnor wrote:
> Hi all.
>
> I have an application that compiles silently in debug mode. When
> switching
> to release mode, the following error message appears:
>
> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xtree(126 :
> error C3848: expression having type 'const
> mynamespace:ointListLess<T>' would lose some const-volatile
> qualifiers in order to call 'bool
> mynamespace:ointListLess<T>:perator ()(const size_t&,const size_t
> &)'


It probably says that there is a const object of type
mynamespace:ointListLess<T> whose operator() is being called. Make
that operator a const functions, e.g.:

bool operator()(...) const

> I have never seen this error before, and What should I look for to
> find the cause?
> Except for one message that points out the class where the map is
> declared, the
> remaining error messages refer to the map and xtree headers.


Normally, standard containers like set<> and map<> store the comparison
functor as a member (or a base class of a member to take advantage of
empty base class optimization). Some member functions of the container
are const and in those functions the comparison functor is const. Thus
there need to be a const version of functor:perator().

--
Max
 
Reply With Quote
 
 
 
 
Rune Allnor
Guest
Posts: n/a
 
      10-18-2009
On 18 Okt, 01:47, Maxim Yegorushkin <(E-Mail Removed)>
wrote:
> On 17/10/09 23:36, Rune Allnor wrote:
>
> > Hi all.

>
> > I have an application that compiles silently in debug mode. When
> > switching
> > to release mode, the following error message appears:

>
> > C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xtree(126 :
> > error C3848: expression having type 'const
> > mynamespace:ointListLess<T>' would lose some const-volatile
> > qualifiers in order to call 'bool
> > mynamespace:ointListLess<T>:perator ()(const size_t&,const size_t
> > &)'

>
> It probably says that there is a const object of type
> mynamespace:ointListLess<T> whose operator() is being called. Make
> that operator a const functions, e.g.:
>
> * * *bool operator()(...) const


Brilliant! Thanks, that solved the problem.

Rune
 
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
Request timed out error only when running release mode not debug TimG ASP .Net Web Services 6 09-03-2007 03:52 AM
User Control access fails in debug mode, works in release mode rbg ASP .Net 0 01-17-2007 10:51 PM
Response.Redirect is slooow in debug mode, ok in release mode =?Utf-8?B?TWF4?= ASP .Net 0 02-11-2006 12:37 AM
Debug mode dll's vs release mode dll's? Dave ASP .Net 0 02-20-2004 03:49 AM



Advertisments