|
Boost Users : |
Subject: Re: [Boost-users] [PTree] Failed to compile simple code
From: Klaim (mjklaim_at_[hidden])
Date: 2010-06-20 15:33:24
I just tried to compile this code :
http://www.boost.org/doc/libs/1_43_0/libs/property_tree/examples/debug_settings.cpp
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_at_[hidden]> 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
>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net