Test for self referential templated Class
Michel Fortin
michel.fortin at michelf.com
Mon Jun 30 08:02:42 PDT 2008
On 2008-06-30 03:56:54 -0400, "Manfred_Nowak" <svv1999 at hotmail.com> said:
> One seem's to need something like
>
> class C(T){
> //...
> !is( T == C!( ... ))
>
> But this casts one into infinite recursion.
You could add a dummy member in C!(T) and check for its presence.
Something like:
struct IsCTemplate {}
class C(T) {
static const IsCTemplate isCTemplate;
//...
}
Then you can use this go check if you have a C!(...) or not:
is(T.isCTemplate == IsCTemplate)
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list