This is the statement from ISO C++ Standard 14.6/8:
When looking for the declaration of a name used in a template definition, the usual lookup rules are used for nondependent names. The lookup of names dependent on the template parameters is postponed until the actual template argument is known (14.6.2).
Example:
#include <iostream>
using namespace std;
template<class T> class Set {
T* p;
int cnt;
public:
Set();
Set<T>(const Set<T>&);
void printall()
{
for (int i = 0; i<cnt; i++)
cout << p[i] << ’\n’;
}
// ...
};
in the example, i is the local variable i declared in printall, cnt is the member cnt declared in Set,and cout is the standard output stream declared in iostream. However, not every declaration can be found this way; the resolution of some names must be postponed until the actual template-arguments are known. For example, even though the name operator<< is known within the definition of printall() and a declaration of it can be found in , the actual declaration of operator<< needed to print p[i] cannot be known until it is known what type T is (14.6.2).
Iam unable to understand this point...and the example too?
can any one tell an other example for this statement...please