Skip to content
Snippets Groups Projects
Commit 4420871a authored by Christian Engwer's avatar Christian Engwer
Browse files

Merge branch 'feature/void_t' into 'master'

void_t, real_t, field_t in dune/common/typetraits.hh

Contains:
 - void_t (+voider)

 - template <class T>
   using field_t = typename FieldTraits<T>::field_type;

 - template &lt;class T&gt;
   using real_t = typename FieldTraits<T>::real_type;

Requires C++11.

See merge request !20
parents 003dc37f 72cdaf37
No related branches found
No related tags found
No related merge requests found
......@@ -28,7 +28,7 @@ dune-common depends on the following software packages
icc (C/C++) >= 13.0
Clang >= 3.2
The following software is recommend but optional:
The following software is recommended but optional:
- MPI (either OpenMPI, lam, or mpich suffice)
......
......@@ -531,6 +531,38 @@ namespace Dune
#endif // defined(DOXYGEN) or HAVE_IS_INDEXABLE_SUPPORT
namespace detail
{
///
/**
* @internal
* @brief Helper to make void_t work with gcc versions prior to gcc 5.0.
*
* This was not a compiler bug, but an accidental omission in the C++11 standard (see N3911, CWG issue 1558).
* It is not clearly specified what happens
* with unused template arguments in template aliases. The developers of GCC decided to ignore them, thus making void_t equivalent to void.
* With gcc 5.0 this was changed and the voider-hack is no longer needed.
*/
template <class...>
struct voider
{
using type = void;
};
}
template <class> struct FieldTraits;
//! Is void for all valid input types (see N3911). The workhorse for C++11 SFINAE-techniques.
template <class... Types>
using void_t = typename detail::voider<Types...>::type;
//! Convenient access to FieldTraits<Type>::field_type.
template <class Type>
using field_t = typename FieldTraits<Type>::field_type;
//! Convenient access to FieldTraits<Type>::real_type.
template <class Type>
using real_t = typename FieldTraits<Type>::real_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