Boost logo

Boost :

Subject: [boost] [format] Any interest in decoupling it from std::basic_string?
From: news.gmane.org (lukester_null_at_[hidden])
Date: 2012-07-02 07:59:05


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)!

Best regards

Luke Elliott.


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