for (auto p = il.begin(); p !=il.end(); p++)
decltype
The decltype keyword creates a variable of the type indicated by an expression. The following statement means “make y the same type as x,” where x is an expression:
decltype(x) y;
Here are a couple of examples:
double x;
int n;
decltype(x*n) q; // q same type as x*n, i.e., double
decltype(&x) pd; // pd same as &x, i.e., double *
This is particularly useful in template definitions, when the type may not be determined until a specific instantiation is made: