data.hpp

Go to the documentation of this file.
00001 
00003 #ifndef DATA_HPP_
00004 #define DATA_HPP_
00005 
00006 #include <algorithm>
00007 #include <iostream>
00008 #include <iterator>
00009 #include <ostream>
00010 #include <vector>
00011 
00013 typedef std::vector<int> intvector;
00014 
00016 typedef intvector::iterator intvec_iterator;
00017 
00021 template<class Container>
00022 void read_data(Container& data)
00023 {
00024   data.clear();
00025   data.insert(data.begin(), std::istream_iterator<typename Container::value_type>(std::cin),
00026               std::istream_iterator<typename Container::value_type>());
00027 }
00028 
00033 template<class Container>
00034 void write_data(Container const& data)
00035 {
00036   std::cout << "{ ";
00037   std::copy(data.begin(), data.end(),
00038             std::ostream_iterator<typename Container::value_type>(std::cout, " "));
00039   std::cout << "}\n";
00040 }
00041 #endif

Generated on Sun Nov 30 09:53:22 2008 for Exploring C++ - Final Forms of Key Examples by  doxygen 1.5.3