diff --git a/dune/solvers/common/copyorreference.hh b/dune/solvers/common/copyorreference.hh index c130c567a4ece184bc2335efedf3ea7e0ac6147f..b03ea8152b73f384ab4f0da3d6b9c5eccb5a1c56 100644 --- a/dune/solvers/common/copyorreference.hh +++ b/dune/solvers/common/copyorreference.hh @@ -17,7 +17,7 @@ namespace Solvers { /** * \brief A wrapper storing either a copy or reference * - * \tparam T Type to be refered to + * \tparam T Type to be stored * * If T is of reference type, the wrapper stores a reference * to the passed object. Otherwise it stores a copy. @@ -114,6 +114,27 @@ private: +/** + * \brief A wrapper storing either a const copy or const reference + * + * \tparam T Type to be stored + * + * This is an alias for CopyOrReference<TT> where TT + * is either 'const T' if T is a raw type or 'const S&' + * if T is a 'S&'. Notice that in the latter case this + * is different from 'const T' which would be the same + * as T. + */ +template<class T> +using ConstCopyOrReference = + CopyOrReference< + std::conditional_t< + std::is_reference<T>::value, + const std::remove_reference_t<T>&, + const T>>; + + + } // end namespace Solvers } // end namespace Dune