Files Classes Functions Hierarchy
00001 #ifndef ARRAYS_H 00002 #define ARRAYS_H 00003 00004 #include <cassert> 00005 #include <vector> 00006 using namespace std; 00007 00008 #include <typedefs.h> 00009 00015 template< typename F, typename I > 00016 void arraysreadelements2(vector<F> &v, I const * arr, uintc vnum) 00017 { 00018 assert(arr!=0); 00019 00020 // Assume arr has size vnum*2. 00021 for (uint i=0; i<vnum; ++i) 00022 v.push_back( F(arr[i*2],arr[i*2+1]) ); 00023 } 00024 00025 00026 // TODO test 00027 template< typename F, typename I > 00028 void arraysreadelements3(vector<F> &v, I const * arr, uintc vnum) 00029 { 00030 assert(arr!=0); 00031 00032 // Assume arr has size vnum*3. 00033 for (uint i=0; i<vnum; ++i) 00034 v.push_back( F(arr[i*3],arr[i*3+1],arr[i*3+2]) ); 00035 } 00036 00037 00038 #endif 00039
1.5.8