M
Matthias =?ISO-8859-1?Q?K=E4ppler?=
Hi,
in Nicolai Josuttis book about the C++ standard library, class templates are
defined like this:
template<class T>
class MyClass<T>
{
T value;
};
That doesn't work for me (g++ 3.3.4):
templates.cpp:4: error: `MyClass' is not a template
templates.cpp:6: confused by earlier errors, bailing out
I have always used this syntax:
template<class T> // or preferrably 'typename T'
class MyClass // no <T> here
{
T value;
};
Which has always worked for me. I am just curious why the syntax presented
in one of the (if not *the*) most popular books about the C++ standard
library doesn't compile with g++ (which is probably as popular as the book
*g*).
Thanks,
Matthias
in Nicolai Josuttis book about the C++ standard library, class templates are
defined like this:
template<class T>
class MyClass<T>
{
T value;
};
That doesn't work for me (g++ 3.3.4):
templates.cpp:4: error: `MyClass' is not a template
templates.cpp:6: confused by earlier errors, bailing out
I have always used this syntax:
template<class T> // or preferrably 'typename T'
class MyClass // no <T> here
{
T value;
};
Which has always worked for me. I am just curious why the syntax presented
in one of the (if not *the*) most popular books about the C++ standard
library doesn't compile with g++ (which is probably as popular as the book
*g*).
Thanks,
Matthias