473,386 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Template syntax...

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 ***/
Jul 23 '05 #1
1 1427
Davide Pippa wrote:
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<class P> template<> struct Thing<P>::SubThing::Func<1U> {

enum { value = 2 };

};

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

}

/*** end code ***/


V
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Thomas Matthews | last post by:
Hi, I am converting my table and record classes into templates. My issue is the syntax of declaring a friend class within the template. I have searched the C++ FAQ Lite (web), the C++...
5
by: Steve | last post by:
Hi, Does C++ allow the programmer to declare a template with in a template so that a generic function can instantiate the embedded template? For example, could code such as this exist: ...
4
by: Howard Gardner | last post by:
// I think that there is no way to write the template "cant_write_me" in // this example. Would love to be wrong. // one of many approaches that won't work template< template< typename class...
5
by: chrisstankevitz | last post by:
Hi, Q1: Is there a way to make a template function that works only for specific types which produces a compiler error if used with an invalid type? Q2: If not, how do people deal with this...
2
by: Nick | last post by:
I'm learning C++ and ran into a compile error using Visual C++ 2005 Express on the following example program (located at http://www.cplusplus.com/doc/tutorial/templates.html): // template...
1
by: toton | last post by:
Hi, I am doing some template specialization for a template class, where specialization is done on a member function. I am not able to get exact syntax for it. The code is give as below, enum...
2
by: adrian.hawryluk | last post by:
Hi everyone, I've been using templates for a while, but I'm not at full power yet (knowledge=power) ;). Does anyone know where I can get information on this 'new' template usage? template<a...
9
by: Adam Nielsen | last post by:
Hi all, I'm a bit confused about the syntax used to access a nested template class. Essentially I have a bunch of class types to represent different types of records in a database, and I want...
7
by: QiongZ | last post by:
Hi, I just recently started studying C++ and basically copied an example in the textbook into VS2008, but it doesn't compile. I tried to modify the code by eliminating all the templates then it...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.