У меня этот класс:
template < unsigned N, typename T >
class MY_EXPORT my_point : protected Eigen::Matrix< T, N, 1 >
{
public:
using vector_type = Eigen::Matrix< T, N, 1 >;
my_point() : vector_type{ vector_type::Zero() } {}
using vector_type::vector_type;
};
Моя сборка Linux (GCC) в порядке. Тем не менее, в Windows (MSVC 15.9.16) я получаю действительно странные ошибки :
c:\include\eigen3\eigen\src\core\densebase.h(482): error C2338: THIS_METHOD_IS_ONLY_FOR_1x1_EXPRESSIONS (compiling source file c:\code\my_point.cxx) [C:\workspace\KwiverWindows\build\vital\vital.vcxproj]
c:\include\eigen3\eigen\src\core\densebase.h(481): note: while compiling class template member function 'const float &Eigen::DenseBase<Derived>::value(void) const'
with
[
Derived=Eigen::Matrix<float,4,1,0,4,1>
] (compiling source file c:\code\my_point.cxx)
c:\include\eigen3\eigen\src\core\matrixbase.h(50): note: see reference to class template instantiation 'Eigen::DenseBase<Derived>' being compiled
with
[
Derived=Eigen::Matrix<float,4,1,0,4,1>
] (compiling source file c:\code\my_point.cxx)
c:\include\eigen3\eigen\src\core\plainobjectbase.h(100): note: see reference to class template instantiation 'Eigen::MatrixBase<Derived>' being compiled
with
[
Derived=Eigen::Matrix<float,4,1,0,4,1>
] (compiling source file c:\code\my_point.cxx)
c:\include\eigen3\eigen\src\core\matrix.h(180): note: see reference to class template instantiation 'Eigen::PlainObjectBase<Eigen::Matrix<float,4,1,0,4,1>>' being compiled (compiling source file c:\code\my_point.cxx)
Похоже, что компилятор пытается создать неуместные методы (например, пытается позже ошибкадля создания w()
для 3-вектора). Что я делаю неправильно? (Почему это не проблема при использовании Eigen::Matrix
напрямую?)
Здесь - это живая демонстрация.