diff --git a/CHANGELOG.md b/CHANGELOG.md index b51284fef3cdeb1516e22e0a254a3e4b8e81f1f1..a5a86d95765fa610e4e886ffe2b15ce7d32f93a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ - The `RigidBodyMotion` class has been removed. Please use `ProductManifold<RealTuple,Rotation>` from now on. +- You can use `std::tuple_element` and `std::tuple_size` with + `ProductManifold`s now. + - Building the module requires CMake version 3.16 now, to be in line with the current core modules. diff --git a/dune/gfe/spaces/productmanifold.hh b/dune/gfe/spaces/productmanifold.hh index 78a7ffe0ec5932c83bfb4bbdec0a0a6cf4acfb7b..5bb4ef910ae6ac88bccd2b551b79e133a5784022 100644 --- a/dune/gfe/spaces/productmanifold.hh +++ b/dune/gfe/spaces/productmanifold.hh @@ -485,4 +485,27 @@ namespace Dune::GFE std::tuple<TargetSpaces ...> data_; }; } + +namespace std +{ + /** \brief Make std::tuple_element work for ProductManifold + * + * As a container it is essentially a std::tuple after all. + */ + template <size_t i, typename ... Args> + struct tuple_element<i,Dune::GFE::ProductManifold<Args...> > + { + using type = typename std::tuple_element<i, std::tuple<Args...> >::type; + }; + + /** \brief Make std::tuple_size work for ProductManifold + * + * As a container it is essentially a std::tuple after all. + */ + template <typename ... Args> + struct tuple_size<Dune::GFE::ProductManifold<Args...> > + : std::integral_constant<std::size_t, sizeof...(Args)> + {}; +} + #endif