| containers/member-types/ambiguities-3.cpp - An alternative resolution of the ambiguity . | Lecture 6 - slide 14 : 40 Program 4 |
// An alternative approach: using a 'using type alias'. C++11
#include <vector>
int x = 5;
template<typename T>double f(){
using it = typename T::iterator; // a 'using type alias'
it *x; // A simpel and plain declaration: x is of type it*
// ...
}
int main(){
f<std::vector<double>>(); // >> is OK in C++11
}