Hello everyone,
For the following code from Bjarne's book, it is stated that template parameter T for function g will be instantised as int other than double. My question is why there are not two instantiations for both int and double version of template function g?
Here is the related statement from Bjarne,Code:// section C.13.8.3 Point of Instantiatant Binding template <class T> void f (T a) { g(a); } void g(int); void h() { extern g (double); f (2); }
--------------------
Each use of a template for a given set of template arguments defines a point of instantiation.
That point is the nearest global or namespace scope enclosing its use,
just before the declaration that contains that use.
--------------------
Does it before g (double) is not global function or namespace scope enclosing its use? If yes, I do not know why g (double) is not a global function, since it is declared as extern and some other compile unit should expose it?
thanks in advance,
George



LinkBack URL
About LinkBacks



CornedBee