multiple template classes in a single file
na
Fallik@Assurtech.com
Fri May 16 15:44:00 GMT 2003
I'm trying to port code from Visual C++ (6)to gcc (gcc version 2.95.4
20010319) and the following code snippet fails to compile with gcc. I'm
declaring two template classes in a single .cpp file and it produces the
following error:
test.cpp:40: parse error before `&'
test.cpp:40: missing ';' before right brace
test.cpp:41: parse error at null character
Compiling the file test.cpp:
namespace NS
{
template <class X> class Object_ptr
{
public:
typedef X element_type;
explicit Object_ptr(void) throw() : m_itsPtr(0)
{
}
~Object_ptr()
{
}
private:
X * m_itsPtr;
Object_ptr(const Object_ptr&) {}
};
template <class X> class Object
{
public:
typedef X element_type;
explicit Object(char * name) throw() : m_itsPtr(0)
{
}
~Object() {delete m_itsPtr;}
private:
X * m_itsPtr;
Object(const Object_ptr&) {}
};
}
What am I missing? Pleace CC me on replies since I'm not subscribed to this
list.
Thanks,
brian
More information about the Gcc-help
mailing list