Boost C++ Libraries: Ticket #6066: Getting back std::string from a utree string node throws std::bad_cast https://svn.boost.org/trac10/ticket/6066 <p> When using: </p> <p> std::string s1("test"); boost::spirit::utree u = s1; </p> <p> Either of: </p> <blockquote> <p> std::string s2 = u.get&lt;std::string&gt;(); </p> </blockquote> <p> or </p> <blockquote> <p> std::string s2 = u.get&lt;boost::spirit::utf8_string_type&gt;(); </p> </blockquote> <p> fail with a "std::bad_cast" thrown. </p> <p> Proceeding with: </p> <blockquote> <p> boost::spirit::utf8_string_range_type rt = u.get&lt;spirit::utf8_string_range_type&gt;(); std::string s2(rt.begin(), rt.end()); </p> </blockquote> <p> works fine... </p> <p> Please see attached file for a complete example. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6066 Trac 1.4.3 Rémy Chibois <rchibois@…> Thu, 27 Oct 2011 13:50:50 GMT attachment set https://svn.boost.org/trac10/ticket/6066 https://svn.boost.org/trac10/ticket/6066 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-spirit-utree_get-string.cpp</span> </li> </ul> Ticket