#include <iostream> #include <cstdlib> #include <iterator> //for class iterator_traits #include <vector> //includes <iterator>, so previous line not needed here using namespace std; int main() { const int a[] = {10, 20, 30, 40, 50}; size_t n = sizeof a / sizeof a[0]; cout << fixed; const int *it1 = a; iterator_traits<const int *>::value_type x1 = *it1; cout << x1 << "\n"; //x1 is an int (not a const int) vector<double> v(a, a + n); vector<double>::iterator it2 = v.begin(); iterator_traits<vector<double>::iterator>::value_type x2 = *it2; cout << x2 << "\n"; //x2 is a double. #define ITERATOR vector<double>::iterator ITERATOR it3 = v.begin(); iterator_traits<ITERATOR>::value_type x3 = *it3; cout << x3 << "\n"; //x3 is a double. return EXIT_SUCCESS; }