> -----Original Message-----
> From: Martin Sebor [mailto:[EMAIL PROTECTED] On Behalf Of Martin Sebor
> Sent: Thursday, June 26, 2008 11:31 AM
> To: [email protected]
> Subject: Re: __rw_and (Was RE: Some internal aliases for 
> __rw_integral_constant?)
> 
...
> 
> Maybe I misunderstood the purpose of the __rw_and template. I wasn't
> asking to see a solution w/o variadic templates, but one without
> __rw_and. If I understand your response correctly, you're proposing
> to add __rw_and to hide the dual implementation of ANDing variable
> numbers of constraints, one with variadic templates and the other
> without. I.e., __rw_and would be more than just syntactic sugar.
> Correct?

Yes, simplifying compile-time expressions by using it in either context
would be one reason, e.g.:

        template <class T, int I>
        struct S :
            __rw_and<std::is_class<T>, 0 != I> {}; // explicit/finite
arguments

        template <class... T> struct O {
            template <class... U> struct I
                : __rw_and<std::is_convertible<T, U>::value...> {}; //
variable arguments
        };

The other reason is portability.  Case in point.  Travis recently ran
into a problem where the compiler rejected a simple constant expression
like `sizeof (T) < sizeof (U)' but worked with the metafunction
equivalent of `__rw_less_than<sizeof (T), sizeof (U)>::value'.

Brad.

Reply via email to