Topic: template function inside a template class


Author: lardinois <ylardinois@cirb.irisnet.be>
Date: 1999/06/24
Raw View
Using the MIPS pro compiler, the follwing code compiles and executes
correctly
but when I tried it with the g++ compiler, I received compiler
errors(using the G++ distributed with the REDHAT distribution 5.0)
It seems to have problems with template functions included inside
template classes

Does anyone know why it does not work? Is this supported with new gcc
compiler versions?

Thanks for any answer
Ylard

template<class T> class string {
          public:
                  template<class T2> string(const string<T2>&
s){/*...*/};
                  template<class T2> int compare(const T2&);
                  template<class T2> string(const string<T2>& s) { /*
... */ }
                  // ...
          };
          template<class T> template<class T2> int
string<T>::compare(const T2& s)
          {
                  // ...
          }
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]