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

Workaround for enable_if not providing a type...

... when it does not depend on the function template parameter
(experienced with clang).
parent 49eabc3a
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -183,18 +183,20 @@ protected: ...@@ -183,18 +183,20 @@ protected:
/// Note: We use PriorityTags to enforce trial order w.r.t. failure fallback. /// Note: We use PriorityTags to enforce trial order w.r.t. failure fallback.
/// Additionally we use it to circumvent ambiguous overloading. /// Additionally we use it to circumvent ambiguous overloading.
/// Call subSizeProvider without PriorityTag via the priority tag forward helper for standard behaviour. /// Call subSizeProvider without PriorityTag via the priority tag forward helper for standard behaviour.
/// We use AlwaysTrue to silence errors about enable_if not providing a type when it does not depend
/// on the function template parameter.
// ... from a sparse/dynamic matrix // ... from a sparse/dynamic matrix
template <class SizeProviderRow, typename = std::enable_if_t<isMatrix<Vector>() and not isTupleOrDerived<Vector>()>> template <class SizeProviderRow, typename = std::enable_if_t<isMatrix<Vector>() and not isTupleOrDerived<Vector>() and AlwaysTrue<SizeProviderRow>::value>>
static decltype(auto) subSizeProvider(SizeProviderRow&& row, PriorityTag<21>) { static decltype(auto) subSizeProvider(SizeProviderRow&& row, PriorityTag<21>) {
return *row.begin(); return *row.begin();
} }
// .. from a tuple like/static matrix // .. from a tuple like/static matrix
template <class SizeProviderRow, typename = std::enable_if_t<isMatrix<Vector>() and isTupleOrDerived<Vector>()>> template <class SizeProviderRow, typename = std::enable_if_t<isMatrix<Vector>() and isTupleOrDerived<Vector>() and AlwaysTrue<SizeProviderRow>::value>>
static decltype(auto) subSizeProvider(SizeProviderRow&& row, PriorityTag<20>) { static decltype(auto) subSizeProvider(SizeProviderRow&& row, PriorityTag<20>) {
return row[Indices::_0]; return row[Indices::_0];
} }
// ... from a vector // ... from a vector
template <class SizeProviderRow, typename = std::enable_if_t<isVector<Vector>()>> template <class SizeProviderRow, typename = std::enable_if_t<isVector<Vector>() and AlwaysTrue<SizeProviderRow>::value>>
static decltype(auto) subSizeProvider(SizeProviderRow&& row, PriorityTag<10>) { static decltype(auto) subSizeProvider(SizeProviderRow&& row, PriorityTag<10>) {
return row; return row;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment