[ace-users] ACEXML/std::map interaction

Green, Cliff cliff.green at boeing.com
Mon Jun 25 10:23:44 CDT 2007


The default template argument for the comparison functor on std::map
should be fine - you don't need to define one yourself (unless you want
to override the std::less default comparison for std::string).

I noticed below that you didn't include <string> - could that be your
problem? I've noticed that compiler vendors are "slimming" down their
standard headers to reduce unnecessary dependencies and executable
sizes. This means that a lot of incorrect application code happened to
compile, taking advantage of "accidental" includes from the compiler
headers.

The reason it may or may not compile when including ACE would depend on
which standard headers were included by the ACE code - again, it's
incorrect application code, where the compile problem shows up (or not)
depending on what was pulled in by the ACE headers.

Cliff

-----Original Message-----
From: Scott Smith [mailto:ssmith at mainstreamdata.com] 
Sent: Friday, June 22, 2007 8:28 PM
To: Scott Smith; ace-users at cse.wustl.edu
Subject: Re: [ace-users] ACEXML/std::map interaction

OK, I guess it's been too long since I've done a map with a std::string.
I didn't think you needed a comparator functor for a std::string.  Turns
out I was wrong (at least on VS2005).  Wasn't an ACEXML problem at all.

________________________________

From: ace-users-bounces at cse.wustl.edu on behalf of Scott Smith
Sent: Fri 6/22/2007 12:34 PM
To: ace-users at cse.wustl.edu
Subject: [ace-users] ACEXML/std::map interaction



ACE VERSION: 5.5.0

 

    HOST MACHINE and OPERATING SYSTEM:

        P4 2.54GHz, 1GB, Windows XP sp 2

 

    TARGET MACHINE and OPERATING SYSTEM, 

        same

 

    THE $ACE_ROOT/ace/config.h FILE         

       #define    ACE_HAS_XML_SVC_CONF

 #include "ace/config-win32.h"

 

    AREA/CLASS/EXAMPLE AFFECTED:

        ACEXML 

 

    DOES THE PROBLEM AFFECT:

        COMPILATION? Yes (VS2005 sp1)

        LINKING?     na

        EXECUTION?   na

        [Please indicate whether ACE, your application, or both are
affected.]

            na

    SYNOPSIS:

       I am trying to use ACEXML to parse a file and part of the code in
the same module uses a map defined as:

 

            typedef std::map<std::string, someobject> propertyMap;

 

      I am getting the following error on the compile:

 

c:\program files\microsoft visual studio 8\vc\include\functional(143) :
error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const
std::_Tree<_Traits> &)' : could not deduce template argument for 'const
std::_Tree<_Traits> &' from 'const std::string'

        c:\program files\microsoft visual studio
8\vc\include\xtree(1372) : see declaration of 'std::operator <'

        c:\program files\microsoft visual studio
8\vc\include\functional(142) : while compiling class template member
function 'bool std::less<_Ty>::operator ()(const _Ty &,const _Ty &)
const'

        with

        [

            _Ty=std::string

        ]

        c:\program files\microsoft visual studio 8\vc\include\map(72) :
see reference to class template instantiation 'std::less<_Ty>' being
compiled

        with

        [

            _Ty=std::string

        ]

        c:\program files\microsoft visual studio 8\vc\include\xtree(26)
: see reference to class template instantiation
'std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,_Mfl>' being compiled

        with

        [

            _Kty=std::string,

            _Ty=CDigester::PropertySetter ,

            _Pr=std::less<std::string>,

            _Alloc=std::allocator<std::pair<const
std::string,CDigester::PropertySetter >>,

            _Mfl=false

        ]

        c:\program files\microsoft visual studio 8\vc\include\xtree(68)
: see reference to class template instantiation
'std::_Tree_nod<_Traits>' being compiled

        with

        [

 
_Traits=std::_Tmap_traits<std::string,CDigester::PropertySetter
,std::less<std::string>,std::allocator<std::pair<const
std::string,CDigester::PropertySetter >>,false>

        ]

        c:\program files\microsoft visual studio 8\vc\include\xtree(94)
: see reference to class template instantiation
'std::_Tree_ptr<_Traits>' being compiled

        with

        [

 
_Traits=std::_Tmap_traits<std::string,CDigester::PropertySetter
,std::less<std::string>,std::allocator<std::pair<const
std::string,CDigester::PropertySetter >>,false>

        ]

        c:\program files\microsoft visual studio 8\vc\include\xtree(112)
: see reference to class template instantiation
'std::_Tree_val<_Traits>' being compiled

        with

        [

 
_Traits=std::_Tmap_traits<std::string,CDigester::PropertySetter
,std::less<std::string>,std::allocator<std::pair<const
std::string,CDigester::PropertySetter >>,false>

        ]

        c:\program files\microsoft visual studio 8\vc\include\map(82) :
see reference to class template instantiation 'std::_Tree<_Traits>'
being compiled

        with

        [

 
_Traits=std::_Tmap_traits<std::string,CDigester::PropertySetter
,std::less<std::string>,std::allocator<std::pair<const
std::string,CDigester::PropertySetter >>,false>

        ]

        c:\mainstream\development\visual studio
projects\niffileprocessor\digester.h(122) : see reference to class
template instantiation 'std::map<_Kty,_Ty>' being compiled

        with

        [

            _Kty=std::string,

            _Ty=CDigester::PropertySetter

        ]

c:\program files\microsoft visual studio 8\vc\include\functional(143) :
error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const
std::_Tree<_Traits> &)' : could not deduce template argument for 'const
std::_Tree<_Traits> &' from 'const std::string'

        c:\program files\microsoft visual studio
8\vc\include\xtree(1372) : see declaration of 'std::operator <'

c:\program files\microsoft visual studio 8\vc\include\functional(143) :
error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const
std::_Tree<_Traits> &)' : could not deduce template argument for 'const
std::_Tree<_Traits> &' from 'const std::string'

        c:\program files\microsoft visual studio
8\vc\include\xtree(1372) : see declaration of 'std::operator <'

c:\program files\microsoft visual studio 8\vc\include\functional(143) :
error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const
std::_Tree<_Traits> &)' : could not deduce template argument for 'const
std::_Tree<_Traits> &' from 'const std::string'

        c:\program files\microsoft visual studio
8\vc\include\xtree(1372) : see declaration of 'std::operator <'

c:\program files\microsoft visual studio 8\vc\include\functional(143) :
error C2784: 'bool std::operator <(const std::vector<_Ty,_Alloc> &,const
std::vector<_Ty,_Alloc> &)' : could not deduce template argument for
'const std::vector<_Ty,_Alloc> &' from 'const std::string'

        c:\program files\microsoft visual studio
8\vc\include\vector(1276) : see declaration of 'std::operator <'

 

Similar messages repeat numerous times.

 

      If I change the std::string key in the map to "const char *", I
don't get the compile errors.  If I remove the include of "#include
<ACEXML/common/DefaultHandler.h>" (still using std::string as the key
into the map), the only compile errors I get are undefines for the
ACEXML stuff.  

 

 

The includes I am using look like:

 

#include <ace/OS.h>

#include <ACEXML/common/DefaultHandler.h>

#include "ACEXML/common/FileCharStream.h"

#include "ACEXML/common/StrCharStream.h"

#include "ACEXML/parser/parser/Parser.h"

 

#include <vector>

#include <map>

#include <fstream>

 

 

I've tried changing the order (doing the ace block last).  It doesn't
make any difference.  It appears to be some interaction between the
ACEXML class and std::string/std::map.  Any thoughts about how I might
fix this?

 

Scott 

 

 

_______________________________________________
ace-users mailing list
ace-users at mail.cse.wustl.edu
http://mail.cse.wustl.edu/mailman/listinfo/ace-users



More information about the Ace-users mailing list