template <class T> struct Derived : public T { Derived () {} Derived ( const T & t ) : T(t) {} T & base () { return *this; } const T & base () const { return *this; } }; template <class T> struct DerivedA : public Set1<T> { DerivedA () {} DerivedA ( const T & t ) : Set1<T>(t) {} T & base () { return a; } const T & base () const { return a; } }; template <> struct Derived <int> : public DerivedA<int> { Derived () {} Derived ( int t ) : DerivedA<int>(t) {} }; template <> struct Derived <nat> : public DerivedA<nat> { Derived () {} Derived ( nat t ) : DerivedA<nat>(t) {} }; template <> struct Derived <bool> : public DerivedA<bool> { Derived () {} Derived ( bool t ) : DerivedA<bool>(t) {} }; template <> struct Derived <double> : public DerivedA<double> { Derived () {} Derived ( double t ) : DerivedA<double>(t) {} }; template <> struct Derived <void *> : public DerivedA<void *> { Derived () {} Derived ( void * t ) : DerivedA<void *>(t) {} }; Описание шаблона Set1 находится здесь. Исходники находятся в файле Template.h. Наверх |