B
baumann@pan
hi all,
Local classes and enumerations (in other words, types declared in a
function definition) cannot be involved in template type arguments.
Types that involve unnamed class types or unnamed enumeration types
cannot be template type arguments (unnamed classes or enumerations that
are given a name through a typedef declaration are OK).
An example illustrates these two exceptions:
template <typename T> class List {
...
};
typedef struct {
double x, y, z;
} Point;
typedef enum { red, green, blue } *ColorPtr;
int main()
{
struct Association
{
int* p;
int* q;
};
List<Assocation*> error1; // ERROR: local type in template
argument
List<ColorPtr> error2; // ERROR: unnamed type in template
// argument
List<Point> ok; // OK: unnamed class type named through
// a typedef
}
i think ColorPrt is the name for the unamed type enum { red, green,
blue} * through typedef declaration.
Local classes and enumerations (in other words, types declared in a
function definition) cannot be involved in template type arguments.
Types that involve unnamed class types or unnamed enumeration types
cannot be template type arguments (unnamed classes or enumerations that
are given a name through a typedef declaration are OK).
An example illustrates these two exceptions:
template <typename T> class List {
...
};
typedef struct {
double x, y, z;
} Point;
typedef enum { red, green, blue } *ColorPtr;
int main()
{
struct Association
{
int* p;
int* q;
};
List<Assocation*> error1; // ERROR: local type in template
argument
List<ColorPtr> error2; // ERROR: unnamed type in template
// argument
List<Point> ok; // OK: unnamed class type named through
// a typedef
}
i think ColorPrt is the name for the unamed type enum { red, green,
blue} * through typedef declaration.