[Boost-bugs] [Boost C++ Libraries] #6066: Getting back std::string from a utree string node throws std::bad_cast

Subject: [Boost-bugs] [Boost C++ Libraries] #6066: Getting back std::string from a utree string node throws std::bad_cast
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-10-27 13:50:21


#6066: Getting back std::string from a utree string node throws std::bad_cast
-----------------------------------------------+----------------------------
 Reporter: Rémy Chibois <rchibois@…> | Owner: djowel
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: spirit
  Version: Boost 1.47.0 | Severity: Problem
 Keywords: spirit utree string bad_cast |
-----------------------------------------------+----------------------------
 When using:

 std::string s1("test");
 boost::spirit::utree u = s1;

 Either of:
    std::string s2 = u.get<std::string>();
 or
    std::string s2 = u.get<boost::spirit::utf8_string_type>();

 fail with a "std::bad_cast" thrown.

 Proceeding with:
     boost::spirit::utf8_string_range_type rt =
 u.get<spirit::utf8_string_range_type>();
     std::string s2(rt.begin(), rt.end());

 works fine...

 Please see attached file for a complete example.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6066>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC