3#ifndef DUNE_TYPETRAITS_HH
4#define DUNE_TYPETRAITS_HH
34 template <
class... Types>
61 isVolatile=std::is_volatile<T>::value,
63 isConst=std::is_const<T>::value
67 typedef DUNE_DEPRECATED_MSG(
"Use std::remove_const instead!") typename
std::remove_cv<T>::type UnqualifiedType;
80 value=std::is_volatile<T>::value
90 value=std::is_const<T>::value
103 typedef DUNE_DEPRECATED_MSG(
"Use std::remove_reference instead!") typename
std::remove_reference<T>::type type;
112 template<class From, class To>
117 exists = std::is_convertible<From,To>::value,
119 isTwoWay = std::is_convertible<From,To>::value && std::is_convertible<To,From>::value,
121 sameType = std::is_same<From,To>::value
131 template <
class Base,
class Derived>
136 value = std::is_base_of<Base, Derived>::value
146 template<
class T1,
class T2>
154 value = std::is_convertible<T1,T2>::value || std::is_convertible<T2,T1>::value
158 template<
bool B,
class T =
void>
163 struct enable_if<true,T>
173 template<class T1, class T2, class Type>
179 template<
typename T,
typename U>
183 value = std::is_same<T,U>::value
187 template<
bool B,
typename T,
typename F>
193 template<typename T, T v>
197 static constexpr T value = v;
218 value = std::is_pointer<T>::value
226 value = std::is_lvalue_reference<T>::value
233 typedef DUNE_DEPRECATED_MSG(
"Use std::remove_pointer instead!") typename
std::remove_pointer<T>::type type;
279 static const bool value =
false;
292 static const bool value =
true;
295 template <
typename T>
297 :
public std::integral_constant<bool, std::is_arithmetic<T>::value> {
300 template <
typename T>
301 struct IsNumber<
std::complex<T>>
302 :
public std::integral_constant<bool, IsNumber<T>::value> {
305 template <
typename T>
307 :
public std::integral_constant<bool, std::is_floating_point<T>::value> {
310 template <
typename T>
311 struct has_nan<
std::complex<T>>
312 :
public std::integral_constant<bool, std::is_floating_point<T>::value> {
315#if defined(DOXYGEN) or HAVE_IS_INDEXABLE_SUPPORT
321 template<
typename T,
typename I,
typename =
int>
323 :
public std::false_type
326 template<
typename T,
typename I>
327 struct _is_indexable<T,I,typename
std::enable_if<(sizeof(std::declval<T>()[std::declval<I>()]) > 0),int>::type>
328 :
public std::true_type
341 template<
typename T,
typename I = std::
size_t>
343 :
public detail::_is_indexable<T,I>
376 template<
typename T,
typename =
int>
378 :
public std::false_type
383 struct _is_indexable<T,decltype(
std::declval<T>()[0],0)>
384 :
public std::true_type
390 struct _check_for_index_operator
395 :
public _is_indexable<T>
412 template<
typename T,
typename I = std::
size_t>
414 :
public std::conditional<
415 std::is_array<T>::value,
416 detail::_lazy<std::true_type>,
417 typename std::conditional<
418 std::is_class<T>::value,
419 detail::_check_for_index_operator,
420 detail::_lazy<std::false_type>
422 >::type::template evaluate<T>::type
424 static_assert(std::is_same<I,std::size_t>::value,
"Your compiler is broken and does not support checking for arbitrary index types");
436 void ignore(T&&... t)
444 template<
typename T,
typename =
void>
446 :
public std::false_type
452 struct is_range<T, decltype(Impl::ignore(
453 std::declval<T>().begin(),
454 std::declval<T>().end(),
455 std::declval<T>().begin() != std::declval<T>().end(),
456 decltype(std::declval<T>().begin()){std::declval<T>().end()},
457 ++(std::declval<std::add_lvalue_reference_t<decltype(std::declval<T>().begin())>>()),
458 *(std::declval<T>().begin())
460 :
public std::true_type
464 template <
class>
struct FieldTraits;
467 template <
class Type>
468 using field_t =
typename FieldTraits<Type>::field_type;
471 template <
class Type>
472 using real_t =
typename FieldTraits<Type>::real_type;
480 struct IsTuple :
public std::false_type
484 struct IsTuple<
std::tuple<T...>> :
public std::true_type
496 public Imp::IsTuple<T>
504 template<
class... T,
class Dummy>
505 std::true_type isTupleOrDerived(
const std::tuple<T...>*, Dummy)
508 template<
class Dummy>
509 std::false_type isTupleOrDerived(
const void*, Dummy)
521 public decltype(Imp::isTupleOrDerived(std::declval<T*>(), true))
533 template<
class T, T t>
534 struct IsIntegralConstant<
std::integral_constant<T, t>> :
public std::true_type
563 template<
typename... T>
565 :
public std::integral_constant<std::size_t,sizeof...(T)>
Definition of the DUNE_DEPRECATED macro for the case that config.h is not available.
typename FieldTraits< Type >::real_type real_t
Convenient access to FieldTraits<Type>::real_type.
Definition: typetraits.hh:472
typename FieldTraits< Type >::field_type field_t
Convenient access to FieldTraits<Type>::field_type.
Definition: typetraits.hh:468
struct DUNE_DEPRECATED_MSG("Use <type_traits> instead!") ConstantVolatileTraits
Determines whether a type is const or volatile and provides the unqualified types.
Definition: typetraits.hh:57
Dune namespace.
Definition: alignment.hh:11
typename detail::voider< Types... >::type void_t
Is void for all valid input types (see N3911). The workhorse for C++11 SFINAE-techniques.
Definition: typetraits.hh:35
template which always yields a false value
Definition: typetraits.hh:277
template which always yields a true value
Definition: typetraits.hh:290
Just an empty class.
Definition: typetraits.hh:50
Enable typedef if two types are interoperable.
Definition: typetraits.hh:176
Check if T is an std::integral_constant<I, i>
Definition: typetraits.hh:546
Checks whether two types are interoperable.
Definition: typetraits.hh:148
Check if T derived from a std::tuple<...>
Definition: typetraits.hh:522
Check if T is a std::tuple<...>
Definition: typetraits.hh:497
Compute size of variadic type list.
Definition: typetraits.hh:566
Helper to make void_t work with gcc versions prior to gcc 5.0.
Definition: typetraits.hh:28
Definition: typetraits.hh:344
Definition: typetraits.hh:447