piranha  0.10
Classes | Namespaces | Macros | Typedefs
type_traits.hpp File Reference

Type traits. More...

#include <cstdarg>
#include <cstddef>
#include <functional>
#include <initializer_list>
#include <iterator>
#include <limits>
#include <ostream>
#include <tuple>
#include <type_traits>
#include <utility>
#include <piranha/config.hpp>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  piranha::is_addable< T, U >
 Addable type trait. More...
 
class  piranha::is_addable_in_place< T, U >
 In-place addable type trait. More...
 
class  piranha::is_subtractable< T, U >
 Subtractable type trait. More...
 
class  piranha::is_subtractable_in_place< T, U >
 In-place subtractable type trait. More...
 
class  piranha::is_multipliable< T, U >
 Multipliable type trait. More...
 
class  piranha::is_multipliable_in_place< T, U >
 In-place multipliable type trait. More...
 
class  piranha::is_divisible< T, U >
 Divisible type trait. More...
 
class  piranha::is_divisible_in_place< T, U >
 In-place divisible type trait. More...
 
class  piranha::has_left_shift< T, U >
 Left-shift type trait. More...
 
class  piranha::has_right_shift< T, U >
 Right-shift type trait. More...
 
class  piranha::has_left_shift_in_place< T, U >
 In-place left-shift type trait. More...
 
class  piranha::has_right_shift_in_place< T, U >
 In-place right-shift type trait. More...
 
class  piranha::is_equality_comparable< T, U >
 Equality-comparable type trait. More...
 
class  piranha::is_less_than_comparable< T, U >
 Less-than-comparable type trait. More...
 
class  piranha::is_greater_than_comparable< T, U >
 Greater-than-comparable type trait. More...
 
struct  piranha::enable_noexcept_checks< T, typename >
 Enable noexcept checks. More...
 
struct  piranha::is_container_element< T >
 Type trait for well-behaved container elements. More...
 
class  piranha::is_ostreamable< T >
 Type trait for classes that can be output-streamed. More...
 
class  piranha::is_function_object< T, ReturnType, Args >
 Function object type trait. More...
 
class  piranha::is_hash_function_object< T, U >
 Type trait to detect hash function objects. More...
 
class  piranha::is_equality_function_object< T, U >
 Type trait to detect equality function objects. More...
 
class  piranha::is_hashable< T >
 Hashable type trait. More...
 
class  piranha::is_iterator< T >
 Iterator type trait. More...
 
class  piranha::is_input_iterator< T >
 Input iterator type trait. More...
 
class  piranha::is_forward_iterator< T >
 Forward iterator type trait. More...
 
class  piranha::has_input_begin_end< T >
 Detect the availability of std::begin() and std::end(). More...
 
class  piranha::is_returnable< T >
 Detect if type can be returned from a function. More...
 
class  piranha::zero_is_absorbing< T, typename >
 Detect if zero is a multiplicative absorber. More...
 
class  piranha::zero_is_absorbing< T, fp_zero_is_absorbing_enabler< T > >
 Specialisation of piranha::zero_is_absorbing for floating-point types. More...
 

Namespaces

 piranha
 Root piranha namespace.
 

Macros

#define PIRANHA_DECLARE_HAS_TYPEDEF(type_name)
 Macro to test if class has type definition. More...
 
#define PIRANHA_TT_CHECK(tt, ...)   static_assert(tt<__VA_ARGS__>::value, "type trait check failure -> " #tt "<" #__VA_ARGS__ ">")
 Macro for static type trait checks. More...
 

Typedefs

template<typename T , typename... Args>
using piranha::min_int = typename detail::min_int_impl< T, Args... >::type
 Detect narrowest integer type. More...
 
template<typename T , typename... Args>
using piranha::max_int = typename detail::max_int_impl< T, Args... >::type
 Detect widest integer type. More...
 

Detailed Description

Type traits.

This header contains general-purpose type traits classes.

Definition in file type_traits.hpp.

Macro Definition Documentation

◆ PIRANHA_DECLARE_HAS_TYPEDEF

#define PIRANHA_DECLARE_HAS_TYPEDEF (   type_name)
Value:
template <typename PIRANHA_DECLARE_HAS_TYPEDEF_ARGUMENT> \
class has_typedef_##type_name \
{ \
using Td_ = piranha::uncvref_t<PIRANHA_DECLARE_HAS_TYPEDEF_ARGUMENT>; \
template <typename U> \
using type_t = typename U::type_name; \
\
public: \
static const bool value = piranha::is_detected<type_t, Td_>::value; \
}

Macro to test if class has type definition.

This macro will declare a struct template parametrized over one type T and called has_typedef_type_name, whose static const bool member value will be true if T contains a typedef called type_name, false otherwise.

For instance:

struct foo
{
typedef int foo_type;
};
struct bar {};

has_typedef_foo_type<foo>::value will be true and has_typedef_foo_type<bar>::value will be false.

Definition at line 769 of file type_traits.hpp.

◆ PIRANHA_TT_CHECK

#define PIRANHA_TT_CHECK (   tt,
  ... 
)    static_assert(tt<__VA_ARGS__>::value, "type trait check failure -> " #tt "<" #__VA_ARGS__ ">")

Macro for static type trait checks.

This macro will check via a static_assert that the template type trait tt provides a true value. The variadic arguments are interpreted as the template arguments of tt.

Definition at line 786 of file type_traits.hpp.