Re: [Boost-bugs] [Boost C++ Libraries] #3700: boost::archive should support basic_strings with different allocators

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3700: boost::archive should support basic_strings with different allocators
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-05-30 16:22:08


#3700: boost::archive should support basic_strings with different allocators
-------------------------------+--------------------------------------------
  Reporter: anonymous | Owner: ramey
      Type: Feature Requests | Status: closed
 Milestone: | Component: serialization
   Version: Boost 1.41.0 | Severity: Optimization
Resolution: wontfix | Keywords: serialization archive allocator
-------------------------------+--------------------------------------------
Changes (by ramey):

  * status: reopened => closed
  * resolution: => wontfix

Comment:

 "boost::serialization should be able to serialize this object the same way
 it does a std::string. Instead it serializes it as a char array which
 causes very large and ugly xml."

 OK you're halfway home. Now that you've got your own string type you can
 define the serialization anyway you want. This is not hard, but it will
 take a little bit of effort. You can see how it's done by checking out
 how it's done for std::string.

 the std:string is "special" because I use it in the archive header.
 Making this "special" HAS created a pain in the neck. I tried to avoid
 it, but at the time it seemed like it was the least worse alternatives.

 Good news is, you can define your own - as you have done - and implement
 any kind of scheme you wish. Carefully consider the implementation level
 - I would guess you want to use "object_serializable" for this. And you
 will have to decide how you want to represent the string in the file. Not
 that this last part is not trivial as you can't really know what a string
 is going to contain. (E.G. it can contain '\0' which so if you want some
 non-ugly representation, you'll have to have an escape mechanism. Good
 news is that the library already has tools for dealing with this - Bad
 news is that you have to invest effort to figure out how they have been
 used (data flow iterators).

 I'm sure with a little effort you can use the facilities of the library to
 get exactly what you want. Good Luck.

 Robert Ramey

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3700#comment:3>
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:03 UTC