// ---------------------------------------------------------------------- // // tmpltmpl.cc - Do we support templates as template arguments? // // History: // 17-Aug-1999 WEB Initial draft, adapted from Blitz++ // 09-Sep-1999 WEB Get rid of "unused variable" warning // 25-Apr-2001 WEB s//"ISOcxx\/ISOcxxSyntax.hh"/ // // ---------------------------------------------------------------------- #include "ISOcxx/ISOcxxSyntax.hh" // ---------------------------------------------------------------------- // arbitrary template class: // ---------------------------------------------------------------------- template< class T > class A { public: A() : myT( T(0) ) { ; } int f() const { return 0; } private: T myT; }; // A // ---------------------------------------------------------------------- // template with a template as a parameter: // ---------------------------------------------------------------------- #if ! defined DEFECT_NO_TEMPLATES_AS_TEMPLATE_PARAMETERS template< class T1 , template< class T > class T2 > class C { public: C() { ; } int f() const { return myT.f(); } private: T2 myT; }; // C< T1, A > #endif // DEFECT_NO_TEMPLATES_AS_TEMPLATE_PARAMETERS // ---------------------------------------------------------------------- // driver: // ---------------------------------------------------------------------- int main() { #if defined DEFECT_NO_TEMPLATES_AS_TEMPLATE_PARAMETERS A< int > x; // defective #else C< int, A > x; // not defective #endif return x.f(); } // main()