3#ifndef DUNE_TYPETRAITS_HH
4#define DUNE_TYPETRAITS_HH
39 isVolatile=std::is_volatile<T>::value,
41 isConst=std::is_const<T>::value
58 value=std::is_volatile<T>::value
68 value=std::is_const<T>::value
90 template<class From, class To>
95 exists = std::is_convertible<From,To>::value,
97 isTwoWay = std::is_convertible<From,To>::value && std::is_convertible<To,From>::value,
99 sameType = std::is_same<From,To>::value
109 template <
class Base,
class Derived>
114 value = std::is_base_of<Base, Derived>::value
124 template<
class T1,
class T2>
132 value = std::is_convertible<T1,T2>::value || std::is_convertible<T2,T1>::value
136 template<
bool B,
class T =
void>
151 template<class T1, class T2, class Type>
157 template<
typename T,
typename U>
161 value = std::is_same<T,U>::value
165 template<
bool B,
typename T,
typename F>
171 template<typename T, T v>
175 static constexpr T value = v;
196 value = std::is_pointer<T>::value
204 value = std::is_lvalue_reference<T>::value
257 static const bool value =
false;
270 static const bool value =
true;
273 template <
typename T>
275 :
public std::integral_constant<bool, std::is_arithmetic<T>::value> {
278 template <
typename T>
280 :
public std::integral_constant<bool, IsNumber<T>::value> {
283 template <
typename T>
285 :
public std::integral_constant<bool, std::is_floating_point<T>::value> {
288 template <
typename T>
290 :
public std::integral_constant<bool, std::is_floating_point<T>::value> {
293#if defined(DOXYGEN) or HAVE_IS_INDEXABLE_SUPPORT
299 template<
typename T,
typename I,
typename =
int>
301 :
public std::false_type
304 template<
typename T,
typename I>
305 struct _is_indexable<T,I,typename
std::enable_if<(sizeof(std::declval<T>()[std::declval<I>()]) > 0),int>::type>
306 :
public std::true_type
319 template<
typename T,
typename I = std::
size_t>
321 :
public detail::_is_indexable<T,I>
354 template<
typename T,
typename =
int>
356 :
public std::false_type
361 struct _is_indexable<T,decltype(
std::declval<T>()[0],0)>
362 :
public std::true_type
368 struct _check_for_index_operator
373 :
public _is_indexable<T>
390 template<
typename T,
typename I = std::
size_t>
392 :
public std::conditional<
393 std::is_array<T>::value,
394 detail::_lazy<std::true_type>,
395 typename std::conditional<
396 std::is_class<T>::value,
397 detail::_check_for_index_operator,
398 detail::_lazy<std::false_type>
400 >::type::template evaluate<T>::type
402 static_assert(std::is_same<I,std::size_t>::value,
"Your compiler is broken and does not support checking for arbitrary index types");
412 template<
typename T,
typename =
void,
typename =
void>
414 :
public std::false_type
421 decltype(
std::declval<T>().begin()),
422 decltype(std::declval<T>().end())>
423 :
public std::true_type
449 template <
class... Types>
453 template <
class Type>
457 template <
class Type>
490 template<
class... T,
class Dummy>
494 template<
class Dummy>
507 public decltype(Imp::isTupleOrDerived(std::declval<T*>(), true))
519 template<
class T, T 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:458
#define DUNE_DEPRECATED_MSG(text)
Mark some entity as deprecated.
Definition deprecated.hh:169
typename FieldTraits< Type >::field_type field_t
Convenient access to FieldTraits<Type>::field_type.
Definition typetraits.hh:454
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:450
Dune namespace.
Definition alignment.hh:11
std::true_type isTupleOrDerived(const std::tuple< T... > *, Dummy)
Definition typetraits.hh:491
T field_type
export the type representing the field
Definition ftraits.hh:26
T real_type
export the type representing the real type of the field
Definition ftraits.hh:28
Just an empty class.
Definition typetraits.hh:28
Determines whether a type is const or volatile and provides the unqualified types.
Definition typetraits.hh:36
std::add_cv< UnqualifiedType >::type ConstVolatileType
The const volatile type.
Definition typetraits.hh:49
std::remove_cv< T >::type UnqualifiedType
The unqualified type.
Definition typetraits.hh:45
std::add_const< UnqualifiedType >::type ConstType
The const type.
Definition typetraits.hh:47
Tests whether a type is volatile.
Definition typetraits.hh:55
Tests whether a type is constant.
Definition typetraits.hh:65
Definition typetraits.hh:74
std::remove_const< T >::type type
Definition typetraits.hh:75
Definition typetraits.hh:80
std::remove_reference< T >::type type
Definition typetraits.hh:81
Checks whether a type is convertible to another.
Definition typetraits.hh:92
Checks whether a type is derived from another.
Definition typetraits.hh:111
Checks whether two types are interoperable.
Definition typetraits.hh:126
Definition typetraits.hh:138
T type
Definition typetraits.hh:143
Enable typedef if two types are interoperable.
Definition typetraits.hh:154
Definition typetraits.hh:159
Definition typetraits.hh:167
std::conditional< B, T, F >::type type
Definition typetraits.hh:168
Definition typetraits.hh:173
Definition typetraits.hh:179
Definition typetraits.hh:186
Definition typetraits.hh:194
Definition typetraits.hh:202
Definition typetraits.hh:210
std::remove_pointer< T >::type type
Definition typetraits.hh:211
template which always yields a false value
Definition typetraits.hh:255
template which always yields a true value
Definition typetraits.hh:268
Definition typetraits.hh:275
Definition typetraits.hh:285
Definition typetraits.hh:322
Definition typetraits.hh:415
Definition typetraits.hh:441
void type
Definition typetraits.hh:442
Definition typetraits.hh:467
Check if T is a std::tuple<...>
Definition typetraits.hh:483
Check if T derived from a std::tuple<...>
Definition typetraits.hh:508
Definition typetraits.hh:517
Check if T is an std::integral_constant<I, i>
Definition typetraits.hh:532