Boost logo

Boost :

Subject: Re: [boost] [format] Any interest in decoupling it from std::basic_string?
From: Cory Nelson (phrosty_at_[hidden])
Date: 2012-07-02 10:42:55


On Mon, Jul 2, 2012 at 6:59 AM, news.gmane.org <lukester_null_at_[hidden]>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.
>
> I would assume the first method is definitely out due to breaking the
> interface (especially the altstream classes which I would guess are
> supposed to look like the std ones).
>
> I've not looked at whether something such as templatizing the str()
> method on the string implementation is possible, as either of the above
> is sufficient for my own purposes and trivial which I suspect a
> templatized str() wouldn't be...
>
> Anyway, if there's any interest I can post a patch for either or both
> and if not continue using the first method (simpler diff from the
> original)!
>

I've always thought format could be decoupled to output via iterator, which
would be a lot more flexible to use than depending on a full string type. I
suppose that'd be quite a large change.

-- 
Cory Nelson
http://int64.org

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk