#include #include #include #include #include using namespace std; inline void print(input_iterator_tag) {cout << "input\n";} inline void print(output_iterator_tag) {cout << "output\n";} inline void print(forward_iterator_tag) {cout << "forward\n";} inline void print(bidirectional_iterator_tag) {cout << "bidirectional\n";} inline void print(random_access_iterator_tag) {cout << "random access\n";} template void f(ITERATOR it) { typename iterator_traits::iterator_category category; print(category); } int main() { int a[] = {10, 20, 30, 40, 50}; size_t n = sizeof a / sizeof a[0]; int *it1 = a; f(it1); vector v(a, a + n); vector::iterator it2 = v.begin(); f(it2); list li(a, a + n); list::iterator it3 = li.begin(); f(it3); return EXIT_SUCCESS; }