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
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>
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
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>
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>
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>
347 #else // defined(DOXYGEN) or HAVE_IS_INDEXABLE_SUPPORT
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");
428 #endif // defined(DOXYGEN) or HAVE_IS_INDEXABLE_SUPPORT
444 template<
typename T,
typename =
void>
446 :
public std::false_type
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>
471 template <
class Type>
484 struct IsTuple<std::tuple<T...>> :
public std::true_type
504 template<
class... T,
class Dummy>
508 template<
class Dummy>
521 public decltype(Imp::isTupleOrDerived(std::declval<T*>(), true))
533 template<
class T, T t>
563 template<
typename... T>
565 :
public std::integral_constant<std::size_t,sizeof...(T)>
T field_type
export the type representing the field
Definition: ftraits.hh:26
template which always yields a false value
Definition: typetraits.hh:277
Definition: typetraits.hh:180
Determines whether a type is const or volatile and provides the unqualified types.
Definition: typetraits.hh:57
Definition: typetraits.hh:306
Compute size of variadic type list.
Definition: typetraits.hh:564
std::remove_cv< T >::type UnqualifiedType
The unqualified type.
Definition: typetraits.hh:67
void type
Definition: typetraits.hh:29
Check if T is an std::integral_constant<I, i>
Definition: typetraits.hh:545
Enable typedef if two types are interoperable.
Definition: typetraits.hh:174
Tests whether a type is volatile.
Definition: typetraits.hh:76
Definition: typetraits.hh:207
#define DUNE_DEPRECATED_MSG(text)
Mark some entity as deprecated.
Definition: deprecated.hh:169
Definition: typetraits.hh:296
Definition: typetraits.hh:445
Check if T is a std::tuple<...>
Definition: typetraits.hh:495
Definition: typetraits.hh:194
void ignore(T &&...t)
Definition: typetraits.hh:436
Just an empty class.
Definition: typetraits.hh:50
Definition: typetraits.hh:101
Definition: typetraits.hh:530
std::true_type isTupleOrDerived(const std::tuple< T...> *, Dummy)
Definition: typetraits.hh:505
std::add_cv< UnqualifiedType >::type ConstVolatileType
The const volatile type.
Definition: typetraits.hh:71
Tests whether a type is constant.
Definition: typetraits.hh:86
Checks whether a type is convertible to another.
Definition: typetraits.hh:113
std::remove_const< T >::type type
Definition: typetraits.hh:97
std::add_const< UnqualifiedType >::type ConstType
The const type.
Definition: typetraits.hh:69
Checks whether two types are interoperable.
Definition: typetraits.hh:147
typename FieldTraits< Type >::real_type real_t
Convenient access to FieldTraits<Type>::real_type.
Definition: typetraits.hh:472
Definition: typetraits.hh:215
Definition of the DUNE_DEPRECATED macro for the case that config.h is not available.
Definition: typetraits.hh:342
template which always yields a true value
Definition: typetraits.hh:290
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
Checks whether a type is derived from another.
Definition: typetraits.hh:132
typename FieldTraits< Type >::field_type field_t
Convenient access to FieldTraits<Type>::field_type.
Definition: typetraits.hh:468
Definition: typetraits.hh:231
Definition: typetraits.hh:188
Definition: typetraits.hh:27
Definition: typetraits.hh:159
T real_type
export the type representing the real type of the field
Definition: ftraits.hh:28
Definition: typetraits.hh:223
Definition: typetraits.hh:95
Check if T derived from a std::tuple<...>
Definition: typetraits.hh:520
Definition: typetraits.hh:480
Definition: typetraits.hh:200