| containers/member-types/ambiguities-1.cpp - Illustration of a couple of ambiguities. | Lecture 6 - slide 14 : 40 Program 1 |
// Example of an ambiguity:
#include <vector>
int x = 5;
template<typename T>double f(){ // The name iterator depends on T (it is a dependent name, page 746 (4ed)).
T::iterator *x; // Ambiguity 1:
// T::iterator multiplied by x OR
// x declared as a pointer to the type named T::iterator
// ...
}
int main(){
f<std::vector<double>>(); // Ambiguity 2:
// >> shift right OR
// end of nested template argument list
}