I'm getting a little confused about std::array and passing it around to different classes. I would like to define a class that accepts a std::array in its constructor, and uses that to set a member variable. However, since the arrays could be of variable size, I'm not sure how that translates into the class and member variable declarations. For example:
// array_param.h
#include <array>
class ArrayParam
{
public:
//constructor?
ArrayParam(std::array<long, ?>& entries);
// member variable?
std::array<long, ?> param_entries;
};
...and...
// array_param.cpp
#include "array_param.h"
ArrayParam::ArrayParam(std::array<long, ?>& entries)
{
param_entries = entries;
}
The motivation for this is that in my main program I have, for example, two or more very well defined arrays with known fixed sizes. I would like to perform the same operations on these differently sized arrays, and so such a class to handle these shared operations for arrays of any size is desirable.
Any help is greatly appreciated, thank you very much!