Subject: Re: [boost] Formal Review Request: Boost.String.Convert
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2009-02-18 12:47:44
On Wed, Feb 18, 2009 at 11:40, Christian Holmquist
> Isn't it so that
> string to_string(T const&, Format) is about string generation, such as
> boost::optional<T> from_string<T>(String) is about parsing, such as
> StringT convert_string<StringT>(String)
> about character conversion.
> boost::to_string/boost::from_string would be very useful if made right, but
> seems this discussion is mostly about nifty expressions such as
> convert("5").to<int>(), which is close to unusable to me.
> How would the following trivial case be written?
> vector<int> v;
> std::vector<std::string> s;
> std::transform(v.begin(), v.end(), boost::bind(convert, _1, ????),
I was worried it was too cute, and that's a great example why.
That said, for specialization reasons it may well just be a wrapper
around a converter<From, To> class that'd make a great functor.
I'm glad to see a use case that actually has context, though. All the
rest have just been syntax examples, as you mention.
> I've not seen much discussions on how to provide formatters, or how to
> extend with user-defined types. Isn't that important for such a library?
I think it should be. I'd say the base specification is essential for
integral <-> string conversions.
The main thrust of this particular library has been getting rid of the
default-constructability requirement and providing an interface that
allows failure without throwing, though.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk