// Illustrates that the return type of f may depend on the 'element type' of the container, more precisely by the type of c[i]. // For some container types, such as vector, the element type may be non-obvious. // Compiles with g++ -c dt3.cc -std=c++11 // The example is adapted from item 3 of Effective Modern C++. template auto f(Container& c, Index i) -> decltype(c[i]){ //... }