Boost logo

Boost :

Subject: Re: [boost] Convert library -- Andrzej's review
From: Rob Stewart (robertstewart_at_[hidden])
Date: 2014-05-22 21:33:11

On May 21, 2014 7:22:23 PM EDT, Vladimir Batov <Vladimir.Batov_at_[hidden]> wrote:
>On 05/20/2014 09:58 PM, Andrzej Krzemienski wrote:
>> 2014-05-20 6:34 GMT+02:00 Vladimir Batov
>>> On 05/18/2014 11:45 PM, Vladimir Batov wrote:
>>>> Vladimir Batov <vb.mail.247 <at>> writes:
>>>> Andrzej Krzemienski <akrzemi1 <at>> writes:
>> It is an equivalent of a "monomorphic" lambda. I guess you could
>> another syntax, that does not require to specify this InType:
>> convert<int>(cnv).value_or(-1);
>> which would render a converter object with parametrized signature:
>> template <typename InType>
>> int operator()(const InType&);
>I admit I have no slightest idea what "monomorphic lamda" is :-)

A single argument your lambda.


>So far I only found
> boost::convert<std::string>(cnv));
>has one limitation over
> boost::convert<std::string, int>(cnv));
>Namely, the latter can do implicit conversions when the former does
>That is, for the former to work correctly I have to have a container of
>elements the *correct* type. With the latter I can feed to an algorithm
>a container of elements *convertible* to the explicitly specified

That's where a polymorphic lambda comes into play:

template<class T>

That function call operator can accept various types, yet produce the expected result.


(Sent from my portable computation engine)

Boost list run by bdawes at, gregod at, cpdaniel at, john at