Go forward to Template debugging.
Go backward to Function templates.
Go up to Templates.
Limitations for class templates
===============================
Unfortunately, individual initializations of this sort are likely
to be considered errors eventually; since they're needed now, you
might want to flag places where you use them with comments to mark
the need for a future transition.
* Member functions in template classes may not have results of nested
type; GNU C++ signals a syntax error on the attempt. The following
example illustrates this problem with an `enum' type `alph':
template <class T> class list {
...
enum alph {a,b,c};
alph bar();
...
};
template <class T>
list<int>::alph list<int>::bar() // Syntax error here
{
...
}
* A parsing bug makes it difficult to use preprocessor conditionals
within templates. For example, in this code:
template <class T>
class list {
...
#ifdef SYSWRONG
T x;
#endif
...
}
The preprocessor output leaves sourcefile line number information
(lines like `# 6 "foo.cc"' when it expands the `#ifdef' block.
These lines confuse the compiler while parsing templates, giving a
syntax error.
If you cannot avoid preprocessor conditionals in templates, you can
suppress the line number information using the `-P' preprocessor
option (but this will make debugging more difficult), by compiling
the affected modules like this:
g++ -P foo.cc -o foo
* Parsing errors are reported when templates are first
*instantiated*--not on the template definition itself. In
particular, if you do not instantiate a template definition at
all, the compiler never reports any parsing errors that may be in
the template definition.