Skip to content
Snippets Groups Projects
Commit 2292fe12 authored by Lars Lubkoll's avatar Lars Lubkoll
Browse files

added void_t (incl. voider-hack for gcc), and template aliases real_t and...

added void_t (incl. voider-hack for gcc), and template aliases real_t and field_t for convenient access of T::real_type, T::field_type
parent 0e7809eb
No related branches found
No related tags found
1 merge request!20void_t, real_t, field_t in dune/common/typetraits.hh
......@@ -531,6 +531,52 @@ namespace Dune
#endif // defined(DOXYGEN) or HAVE_IS_INDEXABLE_SUPPORT
namespace detail
{
/// @internal
/// helper to make void_t work with gcc
template <class...>
struct voider
{
using type = void;
};
template <class,class = void> class Real_t;
}
template <class> struct FieldTraits;
/**
* @brief Is void for all valid input types.
*
* The workhorse for C++11 SFINAE-techniques.
*/
template <class... Types>
using void_t = typename detail::voider<Types...>::type;
//! Convenient access to Type::field_type.
template <class Type>
using field_t = typename Type::field_type;
//! Convenient access to Type::real_type, resp. FieldTraits<Type::field_type>::real_type.
template <class Type>
using real_t = typename detail::Real_t<Type>::type;
namespace detail
{
template <class Type,class>
struct Real_t
{
using type = typename FieldTraits<Type>::real_type;
};
template <class Type>
struct Real_t< Type , void_t< field_t<Type> > >
{
using type = typename Real_t< field_t<Type> >::type;
};
}
/** @} */
}
......
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