I'm trying to make a wrapper class for Eigen::Matrix. It should take in a pointer to a static size eigen vector (matrix with 1 row), and should return a copy when the getValue() function is called. This is what I currently have
template<std::size_t N>
class InputV
{
public:
InputV(const Eigen::Matrix<double, N, 1>* in) : in_(in)
{
}
Eigen::Matrix<double, N, 1>
getValue() const
{
return *in_;
}
private:
const Eigen::Matrix<double, N, 1>* in_;
};
TEST_CASE("dummy")
{
Eigen::Matrix<double, 10, 1> a;
InputV<10> in(&a);
}
However, I need to explicitly tell it the size twice, once during the initialization of the source pointer, a second time when creating the InputV wrapper class. Is there a way to have the InputV infer the size N, so I don't have to specify it twice?
Thanks!