Deducing Function Template Arguments

Joined
Feb 12, 2008
Messages
108
Reaction score
0
Hello everyone,


Here is my understanding of what Bjarne said in his The C++ Programming Language book. I am not sure whether my understanding is correct? I am somewhat confused about the following statements.

My understanding is,

means if a function call like this,

Code:
void func(const A a) // A is a specific type

then compiler can deduce argument type of template function below to A?

Code:
template <class T> func (T a)

Bjarne's original statements are,

--------------------
C.13.4 Deducing Function Template Arguments

A compiler can deduce a type template argument, T or TT , and a nontype
template argument, I, from a template function argument with a type composed of the following constructs:

Code:
T const T volatile T
T*  T& T[constant_expression]
type[I]  class_template_name<T> class_template_name<I>
T T<T > T<I > T<>
--------------------


thanks in advance,
George
 

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

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top