This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
multiple template classes in a single file
- From: "na" <Fallik at Assurtech dot com>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Fri, 16 May 2003 11:40:57 -0400
- Subject: multiple template classes in a single file
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