nested templating

M

Matt Davis

Hello,

I am attempting to create a vector of trees that contain user defined
objects.
For example, the follwing code will not compile.

vector <tree <userObject> > vectorTree;

Is this kind of nested templating allowed in C++? I recoginze that
there must be a space between the angle bracets (to avoid being
mistaken for a stream operator).

Any help would be appreciated.

Matt Davis
 
V

Victor Bazarov

Matt said:
I am attempting to create a vector of trees that contain user defined
objects.
For example, the follwing code will not compile.

vector <tree <userObject> > vectorTree;

Is this kind of nested templating allowed in C++? I recoginze that
there must be a space between the angle bracets (to avoid being
mistaken for a stream operator).

What's "tree"?

V
 
J

John Harrison

Matt Davis said:
Hello,

I am attempting to create a vector of trees that contain user defined
objects.
For example, the follwing code will not compile.

vector <tree <userObject> > vectorTree;

Is this kind of nested templating allowed in C++?

Yes it is allowed.
I recoginze that
there must be a space between the angle bracets (to avoid being
mistaken for a stream operator).

Any help would be appreciated.

Post the code that doesn't compile, in this case that would include the
definitons of tree and userObject. Post the compiler error message.

If you want help you have to supply the information needed to help you. Why
does this stuff have to said time after time?

john
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top