I have written a function
template <int N>
bool checkColinear(const std::array<Eigen::Vector<double, N>, 3>& points) noexcept;
which takes three N-D points and returns true if they are collinear within a certain tolerance. Everything works if I call the function and explicitly specify N:
std::array<Eigen::Vector3d, 3> points = {Eigen::Vector3d{0.0, 1.0, 0.0},
Eigen::Vector3d{0.0, 3.0, 0.0},
Eigen::Vector3d{0.0, 2.0, 0.0}};
auto result = checkCollinear<3>(points);
But if I try to call the function without specifying N explicitly the compiler reports an error:
auto result = checkCollinear(points);
The error I get is "error C2672: 'checkCollinear': no matching overloaded function found". Is it possible for the compiler to deduce the template argument in this case? I am using MSVC143 (VS2022) and using C++20.
I have already tried to explicitly change the Eigen::Vector3d
to Eigen::Vector<double, 3>
and Eigen::Matrix<double, 3, 1>
, but that neither of those fix it. I have also tried making the type of N a std::size_t too, but that doesn't help either.