Boost logo

Boost :

Subject: Re: [boost] Is there BOOST_ENABLE_IF macro now?
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2013-08-19 10:42:20


On 19/08/13 01:54, Matt Calabrese wrote:
> On Sun, Aug 18, 2013 at 4:16 PM, paul Fultz <pfultz2_at_[hidden]> wrote:

>> So functions can be defined like this:
>>
>> template<class T, class U>
>> ZEN_FUNCTION_REQUIRES(is_arithmetic<T>, is_arithmetic<U>)
>> (T) max(T x, U y)
>> {
>> return x > y : x ? y;
>> }
>>
>>
> How is this different from:
>
> template< class T, class U
> , BOOST_ENABLE_IF( and_< is_arithmetic< T >, is_arithmetic< U > > )
> >
> T max( T x, U y ) { /**/ }

(T) here is passed to a macro name returned by ZEN_FUNCTION_REQUIRES.
This allows to generate normal enable_if code.


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