file2Grid.h

Go to the documentation of this file.
00001 #ifndef FILE_2_GRID_H
00002 #define FILE_2_GRID_H
00003 
00013 #include "typeUtils.h"
00014 #include <fstream>
00015 #include <iterator>
00016 
00017 
00018 namespace VXV {
00025   template<class T> void File2Grid(std::vector<T>& v, const char* fname) {
00026     std::ifstream from(fname);
00027 
00028     for (std::istream_iterator<int> it(from);
00029          it != std::istream_iterator<int>();) {
00030       int x = *it++;
00031       if (it == std::istream_iterator<int>()) {
00032         break;
00033       }
00034       int y = *it++;
00035       v.push_back(T(x, y));
00036     }
00037   }
00038 }
00039 
00040 #endif /* !FILE_2_GRID_H */
00041 

Generated on Mon Apr 13 22:52:05 2009 by  doxygen 1.5.7.1