Skip to content

SFINAE'ing away non-const overloads if selfAdjoint/triangular view is not referring to an lvalue

Reference issue

None, I noticed this while working on !731 (closed)

What does this implement/fix?

Currently, the non-const transpose methods in selfadjoint and triangular views static_assert that the view represents an lvalue. With this change, this overload is automatically disabled for non-lvalues and the const version is considered.

Additional information

Currently clang-tidy produces some "return type is const-qualified at the top level which may reduce readability without improving const correctness" warnings. The const-qualification there is in fact necessary, because otherwise the wrong .transpose overload would be selected. I have only removed that overload from consideration, but left the return types const for now.

There is a second method which has the same static_assert (coeffRef). In this case, though, I have not changed anything, because there is no valid alternative overload, and I think the static assert provides a more informative error message than just getting the compiler error about a missing method, for which you manually have to decipher the SFINAE that disabled it.

Merge request reports

Loading