473,406 Members | 2,619 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,406 software developers and data experts.

Multiple template arguments

In a recent thread "Why is overloading operator. (member operator)
forbidden", someone wrote a code like the following:

template <typename R, typename... Argtypes>
class gen_send {
private:
string funcname;
public:
R &operator()(Argtypes... arguments) {
// serialize and send
// wait for return value, return value
}
};

Is that legal? I mean, is it legal to do the following:

template<typename T, typename... ARGS>
void foo();

Does that mean that there could be many template parameters? If so,
how could I know how many template parameters were added? By template
specialization?

Thanks in advance,
KK.

May 14 '07 #1
5 3353
Kith Kanan schrieb:
In a recent thread "Why is overloading operator. (member operator)
forbidden", someone wrote a code like the following:

template <typename R, typename... Argtypes>
class gen_send {
private:
string funcname;
public:
R &operator()(Argtypes... arguments) {
// serialize and send
// wait for return value, return value
}
};

Is that legal? I mean, is it legal to do the following:

template<typename T, typename... ARGS>
void foo();
No, it was just an incomplete example.

--
Thomas
http://www.netmeister.org/news/learn2quote.html
May 14 '07 #2
On May 15, 12:39 am, Kith Kanan <fernando.a.gome...@gmail.comwrote:
In a recent thread "Why is overloading operator. (member operator)
forbidden", someone wrote a code like the following:

template <typename R, typename... Argtypes>
class gen_send {
private:
string funcname;
public:
R &operator()(Argtypes... arguments) {
// serialize and send
// wait for return value, return value
}

};

Is that legal?
Not in the current standard C++, but variadic template arguments are
most certainly included in the next C++ revision (it's already in the C
++09 draft)

Read the latest revision of the proposal itself:
http://www.open-std.org/jtc1/sc22/wg...2006/n2080.pdf
And the latest proposed wording: http://www.open-std.org/jtc1/sc22/wg...2007/n2242.pdf
The latest full C++09 draft: http://www.open-std.org/jtc1/sc22/wg...2006/n2134.pdf

- Sylvester

May 14 '07 #3
On May 14, 5:53 pm, "Thomas J. Gritzan" <Phygon_ANTIS...@gmx.de>
wrote:
Kith Kanan schrieb:
In a recent thread "Why is overloading operator. (member operator)
forbidden", someone wrote a code like the following:
template <typename R, typename... Argtypes>
class gen_send {
private:
string funcname;
public:
R &operator()(Argtypes... arguments) {
// serialize and send
// wait for return value, return value
}
};
Is that legal? I mean, is it legal to do the following:
template<typename T, typename... ARGS>
void foo();

No, it was just an incomplete example.

--
Thomashttp://www.netmeister.org/news/learn2quote.html
Now I feel ashamed... :P

Regards,
KK.

May 14 '07 #4
On May 14, 6:01 pm, sylvesterh...@gmail.com wrote:
On May 15, 12:39 am, Kith Kanan <fernando.a.gome...@gmail.comwrote:
In a recent thread "Why is overloading operator. (member operator)
forbidden", someone wrote a code like the following:
template <typename R, typename... Argtypes>
class gen_send {
private:
string funcname;
public:
R &operator()(Argtypes... arguments) {
// serialize and send
// wait for return value, return value
}
};
Is that legal?

Not in the current standard C++, but variadic template arguments are
most certainly included in the next C++ revision (it's already in the C
++09 draft)

Read the latest revision of the proposal itself:http://www.open-std.org/jtc1/sc22/wg...2006/n2080.pdf
And the latest proposed wording:http://www.open-std.org/jtc1/sc22/wg...2007/n2242.pdf
The latest full C++09 draft:http://www.open-std.org/jtc1/sc22/wg...2006/n2134.pdf

- Sylvester
Thanks for the information!

Regards,
KK

May 14 '07 #5
sy***********@gmail.com wrote:
::
:: Not in the current standard C++, but variadic template arguments
:: are
:: most certainly included in the next C++ revision (it's already in
:: the C ++09 draft)
::
:: Read the latest revision of the proposal itself:
:: http://www.open-std.org/jtc1/sc22/wg...2006/n2080.pdf
:: And the latest proposed wording:
:: http://www.open-std.org/jtc1/sc22/wg...2007/n2242.pdf
:: The latest full C++09 draft:
:: http://www.open-std.org/jtc1/sc22/wg...2006/n2134.pdf
::

And the *very* lastest draft (as of last week :-)

http://www.open-std.org/jtc1/sc22/wg...2007/n2284.pdf
Bo Persson
May 15 '07 #6

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

Similar topics

1
by: bjam | last post by:
Hi, today I was able to abstract out into a separate xsl file a template that I specifically perform a call templates for, this worked with import no problem. However, when trying to do the same...
8
by: vpadial | last post by:
Hello, I want to build a library to help exporting c++ functions to a scripting languagge. The scripting language provides a function to register functions like: ANY f0() ANY f1(ANY) ANY...
14
by: Bart Samwel | last post by:
Hi everybody, I would really like some help explaining this apparent discrepancy, because I really don't get it. Here is the snippet: void foo(int&); void foo(int const&); ...
2
by: Michael Stembera | last post by:
Here is a very simple piece of code to repro this bug. template<typename T, int N> inline bool foo( void ) { return true; } template<typename T> inline bool foo<T, 1>( void ) { return...
9
by: jc | last post by:
Hi all, I have a data type to use that I can't modify its codes. E.g. This template data type is data_type. When I declare a variable of this data_type, I write as following: data_type(8,...
4
by: Adam Nielsen | last post by:
Hi everyone, I've having some trouble trying to specialise a template. My original code, with one typename, worked: template <typename T> class MyClass { private: T data;
3
by: Thomas Pajor | last post by:
Hey everybody, I got into serious trouble with template programming. I have a class which uses three template arguments, say template<typename Atype, typename Btype, typename Ctype> class...
8
by: flopbucket | last post by:
Hi, I want to provide a specialization of a class for any type T that is a std::map. template<typename T> class Foo { // ... };
3
by: nooneinparticular314159 | last post by:
I'm trying to do a template with specialization. I declare two templates, one of which looks like: template<int a, int b> struct MOO { enum{ VALUE = b == 0 ? a: MOO<some stuff>::VALUE };
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.