Well, at first I am not a C ++ developer by nature; I managed to put something together and everything works fine, but I'm sure that in the eyes of an expert it looks like garbage =)
So, I have a free application that I created that uses the property tree in Boost libraries. I developed the whole application (in VS2010) with the setting Use Multi-Byte Character Set . I decided it was time to go through and update the Unicode-enabled application, as there are people with complex character sets that I would like to better support.
I went through the tedious process of changing all links and calls to use wide lines, all the necessary conversions. Nevertheless, at some point I completely stopped, only two compiler errors remained with me.
Both come from stream_translator.hpp (/ boost / property_tree /), lines 33 and 36 (as indicated below):
template <typename Ch, typename Traits, typename E, typename Enabler = void> struct customize_stream { static void insert(std::basic_ostream<Ch, Traits>& s, const E& e) { s << e;
Error on line 33:
Error 347 error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'const std::wstring' (or there is no acceptable conversion) {...}\boost_1_49_0\boost\property_tree\stream_translator.hpp 33 1
.. and error on line 36:
Error 233 error C2678: binary '>>' : no operator found which takes a left-hand operand of type 'std::basic_istream<_Elem,_Traits>' (or there is no acceptable conversion) {...}\boost_1_49_0\boost\property_tree\stream_translator.hpp 36 1
From the fact that I was able to go back, it comes from stream_translator.hpp , ultimately starting with a call to get the value [for example. ptree.get ("some.path", "default value here")]
I really donβt know how to solve this problem and cannot find anything on the Internet to help me understand what the problem is. Any advice or information would be appreciated.
EDIT
So, I commented on everything related to ptree until it was compiled and then added them back. It turns out that I can call .get fine, this is get_child, where the error message @ line 36 appears (have not done another project yet, where is the wstring problem).
To simplify things, here is an effective call sequence that is good until get_child is called:
boost::property_tree::ptree pt; boost::property_tree::read_xml("Config.xml", pt); int iAppSetting = pt.get("config.settings.AppSetting",1);