$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [format] Any interest in decoupling it from std::basic_string?
From: Jeff Flinn (Jeffrey.Flinn_at_[hidden])
Date: 2012-07-06 08:34:54
On 7/2/2012 7:59 AM, news.gmane.org wrote:
> I.e. such that alternative string implementations could be used (GCC's
> vstring, boost's...).
>
> I've attempted two methods, both pretty simple. First is to simply
> template basic_format on the string type and propagate that change
> throughout the library (including similar for the altstream/stringbuf
> classes).
>
> Second was to add a template template parameter for the string, e.g.:
>
> template <class Ch, class Tr, class Alloc, template <typename, typename,
> typename> class StringT = std::basic_string>
> class basic_format;
>
> and propagate that.
Have you considered using boost.iostreams lib to directly write to your
alternate string type?
The tutorial 2.1.3 in the docs:
http://www.boost.org/doc/libs/1_47_0/libs/iostreams/doc/tutorial/container_sink.html
Describes a generic container_sink, but also describes using
iostreams::back_inserter. This could be wrapped in a generic function
that returns your desired string type. Assuming of course that the type
is back insertable.
Jeff