I am creating a gridcell class which is basically a multi array of cells. I want this gridcell to have any number of dimensions. This means that in the declaration of the boost::multiarray variable I cannot specify the second argument of the template. Concretely, my code looks as follows:
#include "cell.h"
#include <iostream>
#include <vector>
#include <boost/multi_array.hpp>
class GridCell {
public:
GridCell(); // Default constructor not used.
GridCell(const std::vector<int> dims, const float leafsize);
virtual ~GridCell();
friend std::ostream& operator << (std::ostream & os, const GridCell & c);
private:
std::vector<int> dims_; // Vector containing the size of each dimension.
float leafsize_; // It is assumed that the cells in the grid are cubic.
boost::multi_array<Cell,ndims> * grid;
};
Concretely, boost::multi_array<Cell,ndims> * grid; The number of dimensions I want it to be specified in the Gridcell class constructor.
Any advice or alternative?