Boost logo

Boost :

Subject: Re: [boost] [Review] Boost.Convert library, last day
From: Matthew Chambers (matt.chambers42_at_[hidden])
Date: 2011-05-03 12:06:53


On 5/3/2011 10:36 AM, Stewart, Robert wrote:
> Christopher Jefferson wrote:
>> 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.
>
> str would be a boost::convert<std::string>::converter, not a std::string as one would probably expect.
>
>> 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.
>
> This may be one of the most compelling arguments against the current interface.

Agreed. I know I'll be jumping on the bandwagon as soon as auto becomes mainstream in my two main
compilers, MSVC and GCC. So this is a compelling argument. But would it even be possible to keep the
"smart result" (either convert<>::result or optional<>) and auto compatibility? If (as I suspect)
not, this would seem to necessitate different syntax for value/throw and functor.

-Matt


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