diff --git a/dune/matrix-vector/genericvectortools.hh b/dune/matrix-vector/genericvectortools.hh index ed8ac89dc1ad3a52f2859f866dae02637aa08506..aee7664e9c72e34ffe27301f9c65305844322f78 100644 --- a/dune/matrix-vector/genericvectortools.hh +++ b/dune/matrix-vector/genericvectortools.hh @@ -48,6 +48,7 @@ void truncate(Vector& v, const BitVector& tr) { } //! Resize vector recursively to size of given vector/matrix +// EXPERIMENTAL: Its implementation is still subject to change. // Note: We need the rvalue reference here, because we might obtain a // temporary recursively, e.g. in std::bitset the operator[] yields a // std::bitset::reference temporary due to its specific implementation. @@ -114,11 +115,13 @@ auto getSize(const SizeProvider& sizeProvider) { } /// compile-time helper traits +// TODO these are not satifsying, because e.g. for custom matrices that +// do not specialiaze the MatrixTraits properly, the error messages are +// not very helpful. In particular they may trigger a misleading static_assert. template <class M> constexpr auto isMatrix() { return Std::bool_constant<MatrixTraits<M>::isMatrix>(); } - template <class V> constexpr auto isVector() { // Note: At the time this comment is written, the only use of @@ -156,6 +159,8 @@ struct ScalarSwitch<Vector, // vector to be resized. template <class Resizeable> static void resize(Resizeable& v, const Vector& sizeProvider) { + // TODO this assert may also be triggered when isMatrix/isVector do not + // work properly, e.g. due to a missing MatrixTraits specialization. static_assert(not IsNumber<Resizeable>::value, "SizeProvider seems to have nesting depth that is not applicable to given vector type."); using namespace Hybrid; @@ -208,6 +213,7 @@ protected: // priority tag forward helper template <class SizeProviderRow> static decltype(auto) subSizeProvider(SizeProviderRow&& row) { + // TODO add static assert that fails or warns if subSizeProvider is not a matrix for a matrix or a vector for a vector return This::subSizeProvider(std::forward<SizeProviderRow>(row), PriorityTag<42>()); } };