Subject: Re: [boost] Formal Review Request: Boost.String.Convert
From: Vladimir Batov (batov_at_[hidden])
Date: 2009-02-16 23:30:28
> Why not allow to convert between different string types?
Yes, I believe that is a very sensible question. In fact, I've tightened up
the type checks for the implemented boost::string::convert() to minimize
possible signature clashes with/of further extensions (via
In the current form boost::string::convert() is essentially a replacement
for lexical_cast with added forrmatting, locale, etc. support. To add, say,
u8string<->wstring conversion support we'll need overloads
> Possible applications:
> - std::string <--> std::wstring or similar (based on a future
> Boost.Unicode library)
I am not sure we can do std::string <-> std::wstring unless we know what
std::string represents (currently it can be UTF8 or MBCS). If, with the
introduction of std::u8string, std::string is guaranteed to be MBCS, then I
guess we can have std::string <-> std::wstring as well.
> - conversion between different symbol (character) sets
Currently convert() heavily relies on supplied types. Are we going to have
distinct types for different symbol (character) sets? If not, then we might
move forward as I've done for the throwing behavior (i.e. run-time
configuration vs. compile-time configuration):
int i = boost::string::convert(str, -1) >> boost::throw_t();
to pass a clue/directive what to do. Similarly we might do
string new_set_str = boost::string::convert(old_set_str) >>
Just thinking out loud. Does it look anywhere close to what you had in mind?
P.S. Thank you for your Spirit conversion snippet another day. Appreciated.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk