Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3234: XML Serialization error when loading class that inherits from wstring
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-10-11 22:37:55
#3234: XML Serialization error when loading class that inherits from wstring
--------------------------------------+-------------------------------------
Reporter: nitram.cero@⦠| Owner: ramey
Type: Bugs | Status: closed
Milestone: Boost 1.40.0 | Component: serialization
Version: Boost Development Trunk | Severity: Problem
Resolution: wontfix | Keywords: serialization wstring derived class
--------------------------------------+-------------------------------------
Changes (by ramey):
* status: new => closed
* resolution: => wontfix
Comment:
OK - I looked into this.
I'm not sure what you're trying to do, but here is what I've found.
The "official" std::wstring works fine. It is marked as primitive and has
special code inside of basic_text_iprimitive to handle it.
Your "object:" version also works as expected. When using xml_archives
tags are required for elements. There might be a way to suppress/override
this but if there is I don't remember what it is.
your "primitive:" version fails with the string "This is..". Since the
type is marked primitive, when it comes time to load the string the
following is called:
is >> t where t is of type primitive::wstring
since primitive::wstring is derived from std::string and t is passed by
reference, t get's "promoted" to std::wstring for the is >> t operation.
This operation is implemented by the standard library so that it stops
when it gets a space. So you don't get the whole string back. Now things
are out of whack when the end tag is searched for and the program bombs.
Robert Ramey
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/3234#comment:8> 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:01 UTC