Skip to content
Snippets Groups Projects
Commit 93f0b2bd authored by Kilian Weishaupt's avatar Kilian Weishaupt
Browse files

[common][partial] Add MTBV containing const references

parent cef12744
No related branches found
No related tags found
1 merge request!2215[common][partial] Add MTBV containing const references
......@@ -42,6 +42,17 @@ auto partial(Dune::MultiTypeBlockVector<Args...>& v, Dune::index_constant<i>...
return Dune::MultiTypeBlockVector<std::add_lvalue_reference_t<std::decay_t<std::tuple_element_t<indices, std::tuple<Args...>>>>...>(v[indices]...);
}
/*!
* \brief a function to get a MultiTypeBlockVector with const references to some entries of another MultiTypeBlockVector
* \param v a MultiTypeBlockVector
* \param indices the indices of the entries that should be referenced
*/
template<class ...Args, std::size_t ...i>
auto partial(const Dune::MultiTypeBlockVector<Args...>& v, Dune::index_constant<i>... indices)
{
return Dune::MultiTypeBlockVector<std::add_lvalue_reference_t<const std::decay_t<std::tuple_element_t<indices, std::tuple<Args...>>>>...>(v[indices]...);
}
/*!
* \brief a function to get a tuple with references to some entries of another tuple
* \param v a tuple
......@@ -53,6 +64,17 @@ auto partial(std::tuple<Args...>& v, Dune::index_constant<i>... indices)
return std::tuple<std::add_lvalue_reference_t<std::decay_t<std::tuple_element_t<indices, std::tuple<Args...>>>>...>(std::get<indices>(v)...);
}
/*!
* \brief a function to get a tuple with const references to some entries of another tuple
* \param v a tuple
* \param indices a tuple of indices of the entries that should be referenced
*/
template<class ...Args, std::size_t ...i>
auto partial(const std::tuple<Args...>& v, Dune::index_constant<i>... indices)
{
return std::tuple<std::add_lvalue_reference_t<const std::decay_t<std::tuple_element_t<indices, std::tuple<Args...>>>>...>(std::get<indices>(v)...);
}
/*!
* \brief a function to get a MultiTypeBlockVector with references to some entries of another MultiTypeBlockVector
* \param t an std::tuple or Dune::MultiTypeBlockVector
......
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