incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Lemings" <Eric.Lemi...@roguewave.com>
Subject RE: __rw_and (Was RE: Some internal aliases for __rw_integral_constant?)
Date Thu, 26 Jun 2008 18:09:22 GMT
 

> -----Original Message-----
> From: Martin Sebor [mailto:msebor@gmail.com] On Behalf Of Martin Sebor
> Sent: Thursday, June 26, 2008 11:31 AM
> To: dev@stdcxx.apache.org
> 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.

Mime
View raw message