> -----Original Message-----
> From: David B. Held [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, December 05, 2002 10:56 AM
> To: [EMAIL PROTECTED]
> Subject: [boost] Re: [MPL] Making Generators
> 
> 
> "David Abrahams" <[EMAIL PROTECTED]> wrote in message 
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > [...]
> > I don't know... well, it could detect whether there was a ::type 
> > member, [...]
> 
> Really???  Is it possible to detect the presence of a typedef 
> without generating an error?  How do you do this?  I think 
> this is a very useful feature!
> 
> Dave

Vandevoorde and Josuttis call it SFINAE, "substitution failute is not an
error."

In "C++ Templates: The Complete Guide" (Recommended), they give this
example on pages 106-107:

 typedef char RT1;
 typedef struct {char a[2];} RT2;
 template<typename T> RT1 test(typename T::X const*);
 template<typename T> RT2 test(...);

 #define type_has_member_type_X(T) \
         (sizeof(test<T>(0) == 1)
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to