How to define the constructor of an internal model class of another model class?

advertisements

I have an inner template class of another template class:

// hpp file
template< class T1 > class C1
{
   // ...
public:
   // ...
   C1();
   template< class T2 > C2
   {
      // ...
      C2();
   };
};

When I declare the inner class constructor I get some errors:

//cpp file
template<> C1< MyType >::C1()
{
   // ...
}

template<> template< class T2 > C1< MyType >::C2::C2() // error: invalid use of template-name ‘class C1<MyType>::C2’ without an argument list
{
   // ...
}

I have also tried :

template<> template< class T2 > C1< MyType >::C2<T2>::C2() // error: invalid use of incomplete type ‘class C1<MyType>::C2<T2>’
{
   // ...
}

Incomplete type, but constructor has no type...

I am a little stuck here. How to declare it?


Perform the following:

template<typename T1>
template<typename T2>
C1<T1>::C2<T2>::C2()
{
}