Boost logo

Boost :

Subject: Re: [boost] [Review] Boost.Convert library, last day
From: Vladimir Batov (vbatov_at_[hidden])
Date: 2011-05-03 17:51:46


> Christopher Jefferson <chris <at> bubblescope.net> writes:
> ...
> Out of interest, what would:
>
> auto str = boost::convert<std::string>::from(123);
>
> Do? If boost::convert stores by pointer/reference, it would be quite dangerous.
>
> I think making libraries 'auto safe' is a good idea, I expect to see auto usage
> shoot up very quickly, and
> libraries should do their best to work well with auto.

boost::convert<std::string>::from(123) return a converter object. Some might
consider that design decision wacky/bad/etc. but it there for a reason to
satisfy other use-cases.

For 'auto' to work one will need to explicitly call value() as follows:

auto str = boost::convert<std::string>::from(123).value();

V.


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