I am trying to do some L_p norm calculations within a template function something of the sort
template<typename Number>
Number foo(const Eigen::MatrixBase<Number>& matrix)
{
return matrix.lpNorm<1>();
}
However, CLang throws an error "expected expression" at the end of the line if I try to call foo(matrix)
. If I work with concretely defined (double) matrices, lpNorm
works just fine. How do I go about with this case?
Classical C++ mistake. The solution is to use the template
keyword as follow:
return matrix.template lpNorm<1>();
See the details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With