|
Boost : |
Subject: Re: [boost] Boost.Conversion: functors namming
From: Vicente Botet (vicente.botet_at_[hidden])
Date: 2011-05-25 04:44:57
Stewart, Robert wrote:
>
> Vicente Botet wrote:
>> Stewart, Robert wrote:
>>
>> > auto f(factory<short>(_1));
>> > short const s(f(static_cast<long>(3)));
>> >
>> > Your suggestions for the "factory" call are:
>> >
>> > A. boost::make_converter_to<short>(_1)
>> > B. boost::conversion::fp::convert_to<short>(_1)
>> > C. boost::convert_to<short>(_1)
>> >
>> > I definitely dislike B. A isn't bad, but it should be in the
>> > boost::conversion namespace. C is very nice, but it should
>> > be in the boost::conversion namespace. The introduction of
>> > the placeholder is enough to signal that the result is a
>> > Phoenix lambda.
>>
>> Even if C is the more elegant, to my taste, it introduce a
>> dependency on Boost.Phonix even if functors are not used, and
>> this is one thing I would like to avoid. So it seems that A is
>> a best compromise.
>
> That overload can be put into a separate header so it, and its dependency
> on Phoenix, is only visible when desired.
> <boost/conversion/functor.hpp>?
>
>
Hi,
this independent overloading could be done if there was a class placeholder,
but in Phoenix a placeholder is a concept, isn't it. So the overloading can
be done only using SFINAE, which implies that one overload works for T that
are placeholders and the otherfor T that are no placeholders.
Let me know if I'm missing something.
Best,
Vicente
-- View this message in context: http://boost.2283326.n4.nabble.com/Boost-Conversion-functors-namming-tp3524078p3549186.html Sent from the Boost - Dev mailing list archive at Nabble.com.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk