> -----Original Message-----
> From: Eric Lemings [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 25, 2008 11:41 AM
> To: [email protected]
> Subject: __rw_and (Was RE: Some internal aliases for
> __rw_integral_constant?)
>
>
>
> > -----Original Message-----
> > From: Eric Lemings [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, June 24, 2008 6:01 PM
> > To: [email protected]
> > Subject: RE: Some internal aliases for __rw_integral_constant?
> >
> >
> >
> > > -----Original Message-----
> > > From: Martin Sebor [mailto:[EMAIL PROTECTED] On Behalf Of
> > Martin Sebor
> > > Sent: Tuesday, June 24, 2008 5:11 PM
> > > To: [email protected]
> > > Subject: Re: Some internal aliases for __rw_integral_constant?
> > >
> > > Eric Lemings wrote:
> > > >
> > > > Propose adding the following defs (or something similar) to
> > > > <rw/_meta_help.h> primarily for our own convenience:
> > > >
> > > > template <bool _Bool>
> > > > class __rw_bool_const: public __rw_integral_constant<bool,
> > > _Bool> {};
> > >
> > > I was going to suggest the same thing this morning when I noticed
> > > how pervasive __rw_integral_constant<bool, _Bool> seems to be in
> > > traits definitions (I count 41 occurrences) and thinking that it
> > > would make them less verbose. (With a different spelling of _Bool
> > > to avoid potential clashes with the C99 name.)
> >
> > Good point.
> >
> > >
> > > I didn't because the only beneficiaries of the change would be us
> > > (a fairly small notational convenience) and I wasn't sure the cost
> > > in terms of the added complexity and compilation time was
> worth it.
> > > I contemplated suggesting a macro for the same purpose instead but
> > > decided against it on the assumption that it probably wouldn't be
> > > very popular ;-) But now that the cat's out of the bag and you're
> > > asking about alternatives let me throw it out there:
> > >
> > > #define _RWSTD_BOOL_CONST(B) _RW::__rw_integral_constant<bool, B>
> > >
> > > Usage:
> > >
> > > _RW::__rw_bool_const<bool, false>
> > > vs
> > > _RWSTD_BOOL_CONST (false)
> > >
> >
> > Looks good to me. I'll just add _RWSTD_BOOL_CONST for now.
>
> Okay, another proposal for inclusion though this particular utility
> may be a stretch unless you understand variadic templates very well.
>
> template <bool...>
> struct __rw_and;
>
> template <>
> struct __rw_and<>: std::true_type {};
>
> template <bool _Bool0, bool... _BoolN>
> struct __rw_and<_Bool0, _BoolN...>
> : _RWSTD_BOOL_CONST (_Bool0 && __rw_and<_BoolN...>::value)
> {};
Actually that should probably be something like:
: std::conditional<_Bool0, __rw_and<_BoolN...>,
std::false_type>
Assuming the compiler isn't smart enough to short-circuit such
instantiations already.
Brad.