|
Boost : |
Subject: Re: [boost] [conversion] try_lexical_cast and 200$
From: Eric Niebler (eniebler_at_[hidden])
Date: 2013-12-12 20:06:30
On 12/12/2013 4:31 PM, Matt Calabrese wrote:
> On Thu, Dec 12, 2013 at 4:12 PM, Eric Niebler <eniebler_at_[hidden]> wrote:
>
>> On 12/12/2013 9:35 AM, Matt Calabrese wrote:
>>> A little hackish, but:
>>>
>>> http://codepaste.net/py5ot3
>>
>> template< class T, int = 0, class S >
>> boost::optional<T> lexical_cast( S const&, std::nothrow_t );
>>
>> Is that even legal?! A non-defaulted template parameter after a
>> defaulted one? <boggle> How will this fare on older compilers, I wonder.
>
> Yeah. I think it's worked on GCC and Clang ever since they've supported
> defaults for function template parameters, but I could be mistaken. I don't
> know about other compilers.
Then well done. This would be my preferred interface for C++11. But what
to do about older compilers? It's certainly a problem.
-- Eric Niebler Boost.org http://www.boost.org
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk