Using Eigen's unsupported Tensor module, if I do:
size_t dim0 = 3;
size_t dim1 = 2;
size_t dim2 = 4;
Eigen::Tensor<double, 3> var(dim0, dim1, dim2);
I get the following error:
/usr/local/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h:287:167: error: non-constant-expression cannot be narrowed from type 'unsigned long' to 'std::__1::array<long, 3>::value_type' (aka 'long') in initializer list [-Wc++11-narrowing]
But the code compiles OK if I explicitly cast the dimensions to long int:
long int dim0 = 3;
long int dim1 = 2;
long int dim2 = 4;
Eigen::Tensor<double, 3> var(dim0, dim1, dim2);
Questions:
- For what size variable will this become unsafe? If at all?
- Surely Eigen should be generally accepting a
(size_t)
type as a dimension argument? Should I file a bug report for this or is it intended behaviour here?
I'm using C++11, clang on Mac OSX (haven't tested other platforms).