array

//E is an array expression - eg array<double> or array<double>+array<int>
//S is a scalar data type - eg int
//T must be a C plain old data type, usually numerical

template <class T>
class array
{
 public:
  typedef T value_type;

  size_t size();   //return size of array
  T* data();       //return pointer to array's contents

  explicit array(size_t s=0); //construct array of size s
  array(size_t s, T val);     //construct and initialise array of size s
  void resize(size_t s);      //resize array, data undefined

  array& array(const E& x);   //copy constructor
  array& operator=(const E& x); //assignment or broadcast
  T& operator[](size_t i);    //reference an element
  T& operator[](const E& i);    //vector indexing

  operator+() etc.    //see below
};



Subsections