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

Scott Smith ssmith at mainstreamdata.com
Fri Jun 22 22:28:01 CDT 2007


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 

 

 



More information about the Ace-users mailing list