Skip to content
Snippets Groups Projects
Commit 9702bdbf authored by Carsten Gräser's avatar Carsten Gräser
Browse files

[bugfix]Implement tuple protocol for custom type in resizetest.cc

This fixes some fallout of the removal of `MultiTypeBlockMatrix::size()`:
By not providing a generic container interface you can no longer use generic
algorithms like indexed for-loops for matrices. One way to work around
this is to implement the `tuple` protocol to make `Hybrid::size()` work again.

For an alternative solution cf. core/dune-common!1209
parent 420dd1d4
No related branches found
No related tags found
1 merge request!13[bugfix]Implement tuple protocol for custom type in resizetest.cc
Pipeline #59440 passed
......@@ -41,6 +41,26 @@ namespace Dune { namespace MatrixVector { namespace Traits {
};
}}}
// Implement tuple protocol for custom matrix
namespace std
{
template <size_t i, typename... Args>
struct tuple_element<i,CustomMultiTypeBlockMatrix<Args...> >
{
using type = typename std::tuple_element<i, std::tuple<Args...> >::type;
};
/** \brief Make std::tuple_size work for MultiTypeBlockMatrix
*
* It derives from std::tuple after all.
*/
template <typename... Args>
struct tuple_size<CustomMultiTypeBlockMatrix<Args...> >
: std::integral_constant<std::size_t, sizeof...(Args)>
{};
}
class ResizeTestSuite {
/// typedefs
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment