Skip to content
Snippets Groups Projects
Commit 14796027 authored by Max Kahnt's avatar Max Kahnt
Browse files

Add todos for convenient resize compiler errors.

parent 301d1375
Branches
No related tags found
No related merge requests found
......@@ -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>());
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment