#include #include #include #include //for class ostream_iterator #include //for the copy function #include "pointer.h" using namespace std; int main() { #if 0 const int a[] = {10, 20, 30, 40, 50}; const size_t n = sizeof a / sizeof a[0]; const int *p = a; const int *end = a + n; #else ifstream ifstr("infile"); pointer p(ifstr); pointer end; #endif for (; p != end; ++p) { cout << *p << "\n"; } #if 0 const int *first = a; const int *last = a + n; #else ifstr.seekg(0); //Rewind the input file back to the beginning. pointer first(ifstr); pointer last; #endif ostream_iterator destination(cout, "\n"); copy(first, last, destination); return EXIT_SUCCESS; }