#ifndef ARRAYS_H
#define ARRAYS_H

#include <cassert>
#include <vector>
using namespace std;

#include <typedefs.h>

/** Supply the vector, array and number of new elements. 
    The constructor does the work converting the type.
    F - final type 
    I - input type
*/
template< typename F, typename I >
void arraysreadelements2(vector<F> &v, I const * arr, uintc vnum)
{
  assert(arr!=0);

  // Assume arr has size vnum*2.
  for (uint i=0; i<vnum; ++i)
    v.push_back( F(arr[i*2],arr[i*2+1]) );
}


// TODO test
template< typename F, typename I >
void arraysreadelements3(vector<F> &v, I const * arr, uintc vnum)
{
  assert(arr!=0);

  // Assume arr has size vnum*3.
  for (uint i=0; i<vnum; ++i)
    v.push_back( F(arr[i*3],arr[i*3+1],arr[i*3+2]) );
}


#endif


