[PTree] Failed to compile simple code

Hi! I'm trying to use boost::property_tree but can't compile this simple code on VC10 : #include <string> #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/info_parser.hpp> const std::string CONFIG_FILE = "game.cfg"; int main() { using namespace boost::property_tree; ptree properties; // compilation error here //read_info( CONFIG_FILE, properties ); return 0; } The compilation log : Main.cpp d:\sdk\boost\boost_1_43_0\include\boost-1_43\boost\property_tree\detail\ptree_implementation.hpp(30): error C2440: 'specialization' : cannot convert from 'const std::string std::_Pair_base<_Ty1,_Ty2>::* ' to 'const std::basic_string<_Elem,_Traits,_Ax> std::pair<_Ty1,_Ty2>::* ' with [ _Ty1=const std::string, _Ty2=boost::property_tree::basic_ptree<std::string,std::string> ] and [ _Elem=char, _Traits=std::char_traits<char>, _Ax=std::allocator<char>, _Ty1=const std::string, _Ty2=boost::property_tree::basic_ptree<std::string,std::string> ] Standard conversion from pointer-to-member of base to pointer-to-member of derived is not applied for template arguments d:\sdk\boost\boost_1_43_0\include\boost-1_43\boost\property_tree\detail\ptree_implementation.hpp(159) : see reference to class template instantiation 'boost::property_tree::basic_ptree<Key,Data>::subs' being compiled with [ Key=std::string, Data=std::string ] d:\sdk\boost\boost_1_43_0\include\boost-1_43\boost\property_tree\detail\ptree_implementation.hpp(159) : while compiling class template member function 'boost::property_tree::basic_ptree<Key,Data>::basic_ptree(void)' with [ Key=std::string, Data=std::string ] d:\tests\test_ptree\test_ptree\main.cpp(11) : see reference to class template instantiation 'boost::property_tree::basic_ptree<Key,Data>' being compiled with [ Key=std::string, Data=std::string ] As I'm using a default ptree typedef that is already used in the tutorial, I think I might be doing something stupid but I can't find what. I tried that with boost 1.42 and 1.43, both failed. Any idea? Thanks Joël Lamotte

I just tried to compile this code : http://www.boost.org/doc/libs/1_43_0/libs/property_tree/examples/debug_setti... It fails too. Is it a compiler bug? Main.cpp d:\sdk\boost\boost_1_43_0\include\boost-1_43\boost\property_tree\detail\ptree_implementation.hpp(30): error C2440: 'specialization' : cannot convert from 'const std::string std::_Pair_base<_Ty1,_Ty2>::* ' to 'const std::basic_string<_Elem,_Traits,_Ax> std::pair<_Ty1,_Ty2>::* ' with [ _Ty1=const std::string, _Ty2=boost::property_tree::basic_ptree<std::string,std::string> ] and [ _Elem=char, _Traits=std::char_traits<char>, _Ax=std::allocator<char>, _Ty1=const std::string, _Ty2=boost::property_tree::basic_ptree<std::string,std::string> ] Standard conversion from pointer-to-member of base to pointer-to-member of derived is not applied for template arguments d:\sdk\boost\boost_1_43_0\include\boost-1_43\boost\property_tree\detail\ptree_implementation.hpp(159) : see reference to class template instantiation 'boost::property_tree::basic_ptree<Key,Data>::subs' being compiled with [ Key=std::string, Data=std::string ] d:\sdk\boost\boost_1_43_0\include\boost-1_43\boost\property_tree\detail\ptree_implementation.hpp(159) : while compiling class template member function 'boost::property_tree::basic_ptree<Key,Data>::basic_ptree(void)' with [ Key=std::string, Data=std::string ] d:\tests\test_ptree_tutorial\test_ptree_tutorial\main.cpp(33) : see reference to class template instantiation 'boost::property_tree::basic_ptree<Key,Data>' being compiled with [ Key=std::string, Data=std::string ] On Sun, Jun 20, 2010 at 21:21, Klaim <mjklaim@gmail.com> wrote:
Hi! I'm trying to use boost::property_tree but can't compile this simple code on VC10 :
#include <string> #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/info_parser.hpp>
const std::string CONFIG_FILE = "game.cfg";
int main() { using namespace boost::property_tree; ptree properties; // compilation error here
//read_info( CONFIG_FILE, properties );
return 0; }
The compilation log :
Main.cpp d:\sdk\boost\boost_1_43_0\include\boost-1_43\boost\property_tree\detail\ptree_implementation.hpp(30): error C2440: 'specialization' : cannot convert from 'const std::string std::_Pair_base<_Ty1,_Ty2>::* ' to 'const std::basic_string<_Elem,_Traits,_Ax> std::pair<_Ty1,_Ty2>::* ' with [ _Ty1=const std::string, _Ty2=boost::property_tree::basic_ptree<std::string,std::string> ] and [ _Elem=char, _Traits=std::char_traits<char>, _Ax=std::allocator<char>, _Ty1=const std::string, _Ty2=boost::property_tree::basic_ptree<std::string,std::string> ] Standard conversion from pointer-to-member of base to pointer-to-member of derived is not applied for template arguments d:\sdk\boost\boost_1_43_0\include\boost-1_43\boost\property_tree\detail\ptree_implementation.hpp(159) : see reference to class template instantiation 'boost::property_tree::basic_ptree<Key,Data>::subs' being compiled with [ Key=std::string, Data=std::string ] d:\sdk\boost\boost_1_43_0\include\boost-1_43\boost\property_tree\detail\ptree_implementation.hpp(159) : while compiling class template member function 'boost::property_tree::basic_ptree<Key,Data>::basic_ptree(void)' with [ Key=std::string, Data=std::string ] d:\tests\test_ptree\test_ptree\main.cpp(11) : see reference to class template instantiation 'boost::property_tree::basic_ptree<Key,Data>' being compiled with [ Key=std::string, Data=std::string ]
As I'm using a default ptree typedef that is already used in the tutorial, I think I might be doing something stupid but I can't find what. I tried that with boost 1.42 and 1.43, both failed. Any idea?
Thanks
Joël Lamotte

This has been fixed in the Trunk version of property tree - see https://svn.boost.org/trac/boost/ticket/4092

Thanks! On Sun, Jun 20, 2010 at 22:16, Richard Webb <richard.webb@boldonjames.com> wrote:
This has been fixed in the Trunk version of property tree - see https://svn.boost.org/trac/boost/ticket/4092
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Klaim
-
Richard Webb