Initializing a template class with a struct.

Status
Not open for further replies.
Let's say I have a struct defined as such:
<hr>
typedef struct _TOKEN
{
struct _TOKEN *pNext; //Points to the next node in this list
struct _TOKEN *pPrev; //Points to the previous node in this list
int type;
int value;
} TOKEN;

<hr>

...and a template class called "list." (different from an STL list). Why can I do "list<int> list_of_ints;" but not "list<TOKEN> list_of_tokens;"?

edit: The message that g++ gives me is: "main.cpp:25: template-argument `main()::TOKEN' uses local type `main()::TOKEN'".

[This message was edited by ctkrohn on March 15, 2002 at 14:23.]
 
I'm not sure that having "typedef" in there is right. typedefs are a little different from declarations aren't they? You usually use them to create a synonym to another type. Like when you don't want to have to type out the code for "a reference to an array of pointers to a function returning a pointer to an stl list of ints and taking as parameters four ints and a unicode string" every time.

---------------------------------
[EDIT] Too late huh... was I right?
 
Status
Not open for further replies.