Multiple template arguments

K

Kith Kanan

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.
 
T

Thomas J. Gritzan

Kith said:
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.
 
S

sylvesterhesp

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/wg21/docs/papers/2006/n2080.pdf
And the latest proposed wording: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2242.pdf
The latest full C++09 draft: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2134.pdf

- Sylvester
 
K

Kith Kanan

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/wg21/docs/papers/2006/n2080.pdf
And the latest proposed wording:http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2242.pdf
The latest full C++09 draft:http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2134.pdf

- Sylvester

Thanks for the information!

Regards,
KK
 
B

Bo Persson

(e-mail address removed) 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/wg21/docs/papers/2006/n2080.pdf
:: And the latest proposed wording:
:: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2242.pdf
:: The latest full C++09 draft:
:: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2134.pdf
::

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

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2284.pdf


Bo Persson
 

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,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top