Template syntax...

D

Davide Pippa

Hi!

I'm trying to compile the code above code (actually a similar one...),
and I get this error (with gcc 3.2.2) :

trick_1.cpp:16: template parameters not used in partial
specialization:
trick_1.cpp:16: `P_args'

Does anybody spot the error ? I know probably this code is invalid,
but I cannot see the right syntax... could also someone point me any
pointer on the web to learn template syntax in a quite deep manner ? I
encountered quite frequently blocking points like that for me...
Thanks anybody !

Bye!

Pyper.

/*** begin code ***/

template <class P_args> struct Thing {

struct SubThing {

template <unsigned int x> struct Func {

enum { value = 0 };

};

};

};

template <class P_args> struct Thing<P_args>::SubThing::Func<1> {

enum { value = 2 };

};

int main(int argc,char **argv) {

}

/*** end code ***/
 
V

Victor Bazarov

Davide said:
I'm trying to compile the code above code (actually a similar one...),
and I get this error (with gcc 3.2.2) :

trick_1.cpp:16: template parameters not used in partial
specialization:
trick_1.cpp:16: `P_args'

Does anybody spot the error ?

See below.
I know probably this code is invalid,
but I cannot see the right syntax... could also someone point me any
pointer on the web to learn template syntax in a quite deep manner ?

Sorry, I use books.
I
encountered quite frequently blocking points like that for me...

Perhaps you should put more effort into systematic learning of templates.
Get yourself a copy of "C++ Templates" by Vandevoorde and Josuttis.
Thanks anybody !

Bye!

Pyper.

/*** begin code ***/

template <class P_args> struct Thing {

struct SubThing {

template <unsigned int x> struct Func {

enum { value = 0 };

};

};

};

template <class P_args> struct Thing<P_args>::SubThing::Func<1> {

I believe the syntax should be

template said:
enum { value = 2 };

};

int main(int argc,char **argv) {

}

/*** end code ***/

V
 

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
474,285
Messages
2,571,416
Members
48,107
Latest member
AmeliaAmad

Latest Threads

Top