Boost logo

Boost :

Subject: Re: [boost] [Fit] formal review starts today
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2016-03-05 17:45:02


Le 05/03/2016 17:36, Paul Fultz II a écrit :
>
> On Saturday, March 5, 2016 at 10:15:59 AM UTC-6, Steven Watanabe wrote:
>> AMDG
>>
>> On 03/05/2016 01:36 AM, Vicente J. Botet Escriba wrote:
>>> Le 05/03/2016 01:11, Paul Fultz II a écrit :
>>>> On Friday, March 4, 2016 at 5:19:52 PM UTC-6, Steven Watanabe wrote:
>>>>> On 03/04/2016 11:55 AM, Vicente J. Botet Escriba wrote:
>>>>> #include <boost/fit/conditional.hpp>
>>>>>
>>>>> struct identity {
>>>>> template<class T>
>>>>> T operator()(T t) { return t; }
>>>>> };
>>>>>
>>>>> int main() {
>>>>> boost::fit::conditional(identity(), identity())(0);
>>>>> }
>>>>>
>>>>> 1> boost\fit\conditional.hpp(84): error C2500:
>>>>> 'boost::fit::detail::conditional_kernel<F1,F2>': 'identity' is already
>> a
>>>>> direct base class
>>>>> 1> with
>>>>> 1> [
>>>>> 1> F1=identity,
>>>>> 1> F2=identity
>>>>> 1> ]
>>>>> 1>
>>>>>
>>>> This is by design. I should document this. It makes absolutely no
>>>> sense to
>>>> pass the same function to conditional, and is most likely a mistake in
>>>> the
>>>> users code.
>>>>
>> I disagree that this makes no sense. It
>> would be true if we were talking about match,
>> but for conditional, this degenerate case has
>> a clear meaning, since conditional chooses
>> the first possible function. Forbidding it
>> creates a special case, and special cases
>> are bad for generic code. Of course, my
>> example is a bit silly, because I was
>> trying to create a minimal reproduction,
>> but it's quite possible to have a situation
>> where you don't know and don't care whether
>> the arguments are the same type.
>>
> I see, so in generic code this could be a problem. I'll open an issue to
> update
> this.
>
>
https://github.com/pfultz2/Fit/issues/123


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