type_traits.h File Reference
#include <cassert>
#include <complex>
#include <functional>
#include <iterator>
#include <utility>
#include <boost/tuple/tuple.hpp>
Include dependency graph for type_traits.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  std::make_void< Ts >
 
struct  TiledArray::detail::is_type< typename >
 helper to implement other metafunctions is_type<T>::value is true if T is a valid type More...
 
struct  TiledArray::detail::is_complete_type< T, typename >
 helper to implement other metafunctions is_complete_type<T>::value is true if T is a complete type More...
 
struct  TiledArray::detail::is_complete_type< void >
 
struct  TiledArray::detail::is_complete_type< T, decltype(void(sizeof(T)))>
 
struct  TiledArray::detail::has_conversion_operator< From, To, Enabler >
 
struct  TiledArray::detail::has_conversion_operator< From, To, typename std::enable_if< is_type< decltype(std::declval< From >().operator To())>::value >::type >
 
struct  TiledArray::detail::has_conversion_operator< From, To, typename std::enable_if< is_type< decltype(std::declval< From >().operator To &())>::value >::type >
 
struct  TiledArray::detail::is_explicitly_convertible< From, To >
 
struct  TiledArray::detail::is_implicitly_convertible< From, To >
 
struct  TiledArray::detail::is_convertible< From, To >
 
struct  TiledArray::detail::eval_trait_base< T, Enabler >
 
struct  TiledArray::detail::eval_trait_base< T, typename std::enable_if< has_member_type_eval_type< T >::value &&(detail::is_explicitly_convertible< T, typename T::eval_type >::value||detail::is_explicitly_convertible< T, madness::Future< typename T::eval_type >>::value||detail::is_implicitly_convertible< T, typename T::eval_type >::value||detail::is_implicitly_convertible< T, madness::Future< typename T::eval_type >>::value)>::type >
 
struct  TiledArray::eval_trait< T >
 Determine the object type used in the evaluation of tensor expressions. More...
 
struct  TiledArray::is_lazy_tile< T >
 Detect lazy evaluation tiles. More...
 
struct  TiledArray::is_lazy_tile< DistArray< Tile, Policy > >
 
struct  TiledArray::is_consumable_tile< T >
 Consumable tile type trait. More...
 
struct  TiledArray::is_consumable_tile< ZeroTensor >
 
struct  TiledArray::detail::is_complex< T >
 
struct  TiledArray::detail::is_complex< std::complex< T > >
 
struct  TiledArray::detail::is_numeric< T >
 
struct  TiledArray::detail::is_numeric< std::complex< T > >
 
struct  TiledArray::detail::is_numeric< bool >
 
struct  TiledArray::detail::is_scalar< T >
 
struct  TiledArray::detail::is_scalar< std::complex< T > >
 
struct  TiledArray::detail::is_array_tile< T >
 Detect tiles used by ArrayEvalImpl. More...
 
struct  TiledArray::detail::is_array_tile< TiledArray::detail::LazyArrayTile< T, Op > >
 
struct  TiledArray::detail::is_non_array_lazy_tile< T >
 Detect a lazy evaluation tile that are not a LazyArrayTile. More...
 
struct  TiledArray::detail::numeric_type< T, typename std::enable_if< is_numeric_v< T > >::type >
 
struct  TiledArray::detail::numeric_type< T, typename std::enable_if< has_member_type_value_type< T >::value &&(!is_lazy_tile< T >::value) &&(!is_numeric_v< T >)>::type >
 
struct  TiledArray::detail::numeric_type< T, typename std::enable_if< is_lazy_tile< T >::value &&!is_numeric_v< T > >::type >
 
struct  TiledArray::detail::scalar_type< T, typename std::enable_if< is_scalar_v< T > >::type >
 
struct  TiledArray::detail::scalar_type< std::complex< T >, void >
 
struct  TiledArray::detail::scalar_type< T, typename std::enable_if<!is_numeric_v< T > >::type >
 
struct  TiledArray::detail::is_strictly_ordered_helper< T >
 
struct  TiledArray::detail::is_strictly_ordered< T >
 
struct  TiledArray::detail::is_integral_list_helper< T, Ts... >
 
struct  TiledArray::detail::is_integral_list_helper<>
 
struct  TiledArray::detail::is_integral_list< Ts >
 
struct  TiledArray::detail::is_tuple< T >
 
struct  TiledArray::detail::is_tuple< std::tuple< Ts... > >
 
struct  TiledArray::detail::is_std_gettable< I, T, typename >
 
struct  TiledArray::detail::is_std_gettable< I, T, std::void_t< decltype(::std::get< I >(std::declval< const T & >()))> >
 
struct  TiledArray::detail::is_boost_gettable< I, T, typename >
 
struct  TiledArray::detail::is_boost_gettable< I, T, std::void_t< decltype(::boost::get< I >(std::declval< const T & >()))> >
 
struct  TiledArray::detail::is_gettable_pair< T, Enabler >
 
struct  TiledArray::detail::is_gettable_pair< T, std::enable_if_t< is_gettable_v< 0, T > &&is_gettable_v< 1, T > > >
 
struct  TiledArray::detail::is_integral_pair_< T, class >
 
struct  TiledArray::detail::is_integral_pair_< std::pair< T1, T2 >, typename std::enable_if< std::is_integral< T1 >::value &&std::is_integral< T2 >::value >::type >
 
struct  TiledArray::detail::is_integral_pair< T >
 
struct  TiledArray::detail::is_integral_pair_list_helper< T, Ts... >
 
struct  TiledArray::detail::is_integral_pair_list_helper<>
 
struct  TiledArray::detail::is_integral_pair_list< Ts >
 
struct  TiledArray::detail::is_integral_tuple< T >
 
struct  TiledArray::detail::is_integral_tuple< std::tuple< Ts... > >
 
struct  TiledArray::detail::remove_cvr< T >
 Remove const, volatile, and reference qualifiers. More...
 
struct  TiledArray::detail::param< T, Enabler >
 
struct  TiledArray::detail::param< T, typename std::enable_if< is_numeric_v< T > >::type >
 
struct  TiledArray::detail::param< T, typename std::enable_if< std::is_reference< T >::value >::type >
 
struct  TiledArray::detail::param< T, typename std::enable_if< std::is_pointer< T >::value >::type >
 
struct  TiledArray::detail::non_iterator_tag
 
struct  TiledArray::detail::is_iterator< T, Enabler >
 
struct  TiledArray::detail::is_iterator< T, typename std::enable_if< has_member_type_iterator_category< T >::value >::type >
 
struct  TiledArray::detail::is_iterator< T *, void >
 
struct  TiledArray::detail::is_iterator< const T *, void >
 
struct  TiledArray::detail::is_iterator< T *const, void >
 
struct  TiledArray::detail::is_iterator< const T *const, void >
 
struct  TiledArray::detail::is_input_iterator< T >
 
struct  TiledArray::detail::is_output_iterator< T >
 
struct  TiledArray::detail::is_forward_iterator< T >
 
struct  TiledArray::detail::is_bidirectional_iterator< T >
 
struct  TiledArray::detail::is_random_iterator< T >
 
struct  TiledArray::detail::is_range< T, Enabler >
 
struct  TiledArray::detail::is_range< T, std::void_t< decltype(std::begin(std::declval< T & >()), std::end(std::declval< T & >()))> >
 
struct  TiledArray::detail::is_sized_range< T, Enabler >
 
struct  TiledArray::detail::is_sized_range< T, std::void_t< decltype(std::size(std::declval< T & >()))> >
 
struct  TiledArray::detail::is_contiguous_range< T, Enabler >
 
struct  TiledArray::detail::is_contiguous_range< T, std::void_t< decltype(std::data(std::declval< T & >()))> >
 
struct  TiledArray::detail::is_integral_range< T, Enabler >
 
struct  TiledArray::detail::is_integral_range< T, std::enable_if_t< std::is_integral_v< value_t< T > > &&is_range_v< T > > >
 
struct  TiledArray::detail::is_integral_sized_range< T, Enabler >
 
struct  TiledArray::detail::is_integral_sized_range< T, std::enable_if_t< std::is_integral_v< value_t< T > > &&is_sized_range_v< T > > >
 
struct  TiledArray::detail::is_array< T >
 
struct  TiledArray::detail::is_array< DistArray< T, P > >
 
struct  TiledArray::detail::is_same_or_derived< Base, Derived >
 
struct  TiledArray::detail::is_pair< T >
 
struct  TiledArray::detail::is_pair< std::pair< T1, T2 > >
 
struct  TiledArray::detail::is_initializer_list< T >
 Primary template for detecting if T is an std::initializer_list. More...
 
struct  TiledArray::detail::is_initializer_list< std::initializer_list< T > >
 Specialization of is_initializer_list for an std::initializer_list. More...
 
struct  TiledArray::detail::is_gpair_range< T, Enabler >
 
struct  TiledArray::detail::is_gpair_range< T, std::enable_if_t< is_gpair_v< value_t< T > > &&is_range_v< T > > >
 
struct  TiledArray::detail::is_invocable< F, Args >
 
struct  TiledArray::detail::is_invocable_r< R, F, Args >
 
struct  TiledArray::detail::is_invocable_void_helper< Enabler, F, Args >
 
struct  TiledArray::detail::is_invocable_void_helper< std::enable_if_t< std::is_void< std::result_of_t< F(Args...)> >::value, void >, F, Args... >
 
struct  TiledArray::detail::is_invocable_void< F, Args >
 

Namespaces

 madness
 
 TiledArray
 
 TiledArray::detail
 

Macros

#define GENERATE_HAS_MEMBER(Member)
 
#define GENERATE_HAS_MEMBER_TYPE(Type)
 
#define GENERATE_HAS_MEMBER_FUNCTION(Member)
 
#define GENERATE_HAS_MEMBER_FUNCTION_ANYRETURN(Member)
 
#define GENERATE_IS_FREE_FUNCTION_ANYRETURN(Function)
 
#define GENERATE_IS_FREE_FUNCTION_STD_ANYRETURN(Function)
 

Typedefs

template<typename... Ts>
using std::void_t = typename make_void< Ts... >::type
 
template<typename T , typename U = void>
using TiledArray::detail::enable_if_numeric_t = std::enable_if_t< is_numeric_v< T >, U >
 SFINAE type for enabling code when T is a numeric type. More...
 
template<typename T >
using TiledArray::detail::numeric_t = typename TiledArray::detail::numeric_type< T >::type
 numeric_t<T> is an alias for numeric_type<T>::type More...
 
template<typename T >
using TiledArray::detail::scalar_t = typename TiledArray::detail::scalar_type< T >::type
 scalar_t<T> is an alias for scalar_type<T>::type More...
 
template<typename T >
using TiledArray::detail::remove_cvr_t = typename remove_cvr< T >::type
 
template<bool B, typename T >
using TiledArray::detail::const_if_t = typename std::conditional< B, const T, T >::type
 prepends const to T if B is true More...
 
template<typename U >
using TiledArray::detail::param_type = typename param< U >::type
 
template<class T >
using TiledArray::detail::iterator_t = decltype(std::begin(std::declval< T & >()))
 
template<class T >
using TiledArray::detail::value_t = remove_cvr_t< decltype(*std::begin(std::declval< T & >()))>
 
template<typename Scalar1 , typename Scalar2 >
using TiledArray::detail::add_t = decltype(std::declval< Scalar1 >()+std::declval< Scalar2 >())
 
template<typename Scalar1 , typename Scalar2 >
using TiledArray::detail::subt_t = decltype(std::declval< Scalar1 >() - std::declval< Scalar2 >())
 
template<typename Scalar1 , typename Scalar2 >
using TiledArray::detail::mult_t = decltype(std::declval< Scalar1 >() *std::declval< Scalar2 >())
 
template<typename T >
using TiledArray::detail::trange_t = typename T::trange_type
 
template<typename T >
using TiledArray::detail::shape_t = typename T::shape_type
 
template<typename T >
using TiledArray::detail::pmap_t = typename T::pmap_interface
 
template<typename T >
using TiledArray::detail::policy_t = typename T::policy_type
 

Functions

template<std::size_t I, typename T >
auto TiledArray::detail::get (T &&t)
 
template<typename GeneralizedPair , typename = std::enable_if_t<is_gpair_v<GeneralizedPair>>>
decltype(auto) TiledArray::detail::at (GeneralizedPair &&v, std::size_t idx)
 at(pair, i) extracts i-th element from gpair More...
 

Variables

template<class T >
constexpr bool std::is_integral_v = is_integral<T>::value
 
template<typename T >
constexpr const bool TiledArray::detail::is_type_v = is_type<T>::value
 
template<typename T >
constexpr const bool TiledArray::detail::is_complete_type_v = is_complete_type<T>::value
 
template<class From , class To >
constexpr const bool TiledArray::detail::has_conversion_operator_v
 
template<class From , class To >
constexpr const bool TiledArray::detail::is_explicitly_convertible_v
 
template<class From , class To >
constexpr const bool TiledArray::detail::is_implicitly_convertible_v
 
template<class From , class To >
constexpr const bool TiledArray::detail::is_convertible_v = is_convertible<From, To>::value
 
template<typename T >
constexpr const bool TiledArray::is_lazy_tile_v = is_lazy_tile<T>::value
 is_lazy_tile_v<T> is an alias for is_lazy_tile<T>::value More...
 
template<typename T >
constexpr const bool TiledArray::is_consumable_tile_v = is_consumable_tile<T>::value
 is_consumable_tile_v<T> is an alias for is_consumable_tile<T>::value More...
 
template<typename T >
constexpr const bool TiledArray::detail::is_complex_v = is_complex<T>::value
 is_complex_v<T> is an alias for is_complex<T>::value More...
 
template<typename T >
constexpr const bool TiledArray::detail::is_numeric_v = is_numeric<T>::value
 is_numeric_v<T> is an alias for is_numeric<T>::value More...
 
template<typename T >
constexpr const bool TiledArray::detail::is_scalar_v = is_scalar<T>::value
 is_scalar_v<T> is an alias for is_scalar_v<T> More...
 
template<typename T >
constexpr const bool TiledArray::detail::is_array_tile_v = is_array_tile<T>::value
 is_array_tile_v<T> is an alias for is_array_tile<T>::value More...
 
template<typename T >
constexpr const bool TiledArray::detail::is_non_array_lazy_tile_v
 
template<typename T >
constexpr const bool TiledArray::detail::is_strictly_ordered_v = is_strictly_ordered<T>::value
 is_strictly_ordered_v<T> is an alias for is_strictly_ordered<T>::value More...
 
template<typename... Ts>
constexpr const bool TiledArray::detail::is_integral_list_v = is_integral_list<Ts...>::value
 is_integral_list_v<T> is an alias for is_integral_list<T>::value More...
 
template<typename T >
constexpr const bool TiledArray::detail::is_tuple_v = is_tuple<T>::value
 is_tuple_v<T> is an alias for is_tuple<T>::value More...
 
template<std::size_t I, typename T >
constexpr const bool TiledArray::detail::is_std_gettable_v = is_std_gettable<I, T>::value
 
template<std::size_t I, typename T >
constexpr const bool TiledArray::detail::is_boost_gettable_v = is_boost_gettable<I, T>::value
 
template<std::size_t I, typename T >
constexpr const bool TiledArray::detail::is_gettable_v
 
template<typename T >
constexpr const bool TiledArray::detail::is_gettable_pair_v = is_gettable_pair<T>::value
 is_gettable_pair_v<T> is an alias for is_gettable_pair<T>::value More...
 
template<typename T >
constexpr const bool TiledArray::detail::is_integral_pair_v = is_integral_pair<T>::value
 is_integral_pair_v<T> is an alias for is_integral_pair<T>::value More...
 
template<typename... Ts>
constexpr const bool TiledArray::detail::is_integral_pair_list_v
 
template<typename T >
constexpr const bool TiledArray::detail::is_integral_tuple_v = is_integral_tuple<T>::value
 is_integral_tuple_v<T> is an alias for is_integral_tuple<T>::value More...
 
template<typename T >
constexpr const bool TiledArray::detail::is_pair_v = is_pair<T>::value
 is_pair_v<T> is an alias for is_pair<T>::value More...
 

Macro Definition Documentation

◆ GENERATE_HAS_MEMBER

#define GENERATE_HAS_MEMBER (   Member)
Value:
template <typename T, typename Enabler = void> \
class __has_member_##Member : public std::false_type {}; \
template <typename T> \
class __has_member_##Member< \
T, typename std::enable_if<std::is_class<T>::value || \
std::is_union<T>::value>::type> { \
using Yes = char[2]; \
using No = char[1]; \
\
struct Fallback { \
int Member; \
}; \
struct Derived : T, Fallback {}; \
\
template <class U> \
static No& test(decltype(U::Member)*); \
template <typename U> \
static Yes& test(U*); \
\
public: \
static constexpr bool value = \
sizeof(test<Derived>(nullptr)) == sizeof(Yes); \
}; \
\
template <class T> \
struct has_member_##Member \
: public std::integral_constant<bool, __has_member_##Member<T>::value> { \
};

this generates struct has_member_##Type<T> whose public constexpr member variable value is true if T::Member is a member variable or function.

Definition at line 94 of file type_traits.h.

◆ GENERATE_HAS_MEMBER_FUNCTION

#define GENERATE_HAS_MEMBER_FUNCTION (   Member)

this generates struct has_member_function_Member<T,R,Args...> whose public constexpr member variable value is true if T::Member is a member function that takes Args and returns R .

Note
if T is a const type, only const member functions will be detected, hence has_member_function_Member_anyreturn<const T,R,Args...>::value && !has_member_function_Member_anyreturn<T,R,Args...>::value evaluates to true if there is only a const T::Member

Definition at line 169 of file type_traits.h.

◆ GENERATE_HAS_MEMBER_FUNCTION_ANYRETURN

#define GENERATE_HAS_MEMBER_FUNCTION_ANYRETURN (   Member)
Value:
template <typename T, typename... Args> \
class __has_member_function_##Member##_anyreturn { \
using Yes = char; \
using No = int; \
template <typename U, typename... Args_> \
static auto func(void*) \
-> decltype(std::add_pointer_t<decltype(std::declval<U>().Member( \
std::declval<Args_>()...))>{}, \
Yes{}); \
template <typename U, typename... Args_> \
static No func(...); \
\
public: \
static constexpr const bool value = \
sizeof(func<T, Args...>(0)) == sizeof(Yes); \
}; \
template <class T, typename... Args> \
struct has_member_function_##Member##_anyreturn \
: public std::integral_constant< \
bool, \
__has_member_function_##Member##_anyreturn<T, Args...>::value> {}; \
\
template <class T, typename... Args> \
constexpr const bool has_member_function_##Member##_anyreturn_v = \
has_member_function_##Member##_anyreturn<T, Args...>::value;

this generates struct has_member_function_Member_anyreturn<T,Args...> whose public constexpr member variable value is true if T::Member is a member function that takes Args and returns any type.

Note
if T is a const type, only const member functions will be detected, hence has_member_function_Member_anyreturn<const T,Args...>::value && !has_member_function_Member_anyreturn<T,Args...>::value evaluates to true if there is only a const T::Member

Definition at line 211 of file type_traits.h.

◆ GENERATE_HAS_MEMBER_TYPE

#define GENERATE_HAS_MEMBER_TYPE (   Type)

this generates struct has_member_type_##Type<T> whose public constexpr member variable value is true if T::Member is a valid type.

Definition at line 127 of file type_traits.h.

◆ GENERATE_IS_FREE_FUNCTION_ANYRETURN

#define GENERATE_IS_FREE_FUNCTION_ANYRETURN (   Function)
Value:
template <typename... Args> \
class __is_free_function_##Function##_anyreturn { \
using Yes = char; \
using No = int; \
template <typename... Args_> \
static auto func(void*) -> decltype( \
std::add_pointer_t<decltype(Function(std::declval<Args_>()...))>{}, \
Yes{}); \
template <typename...> \
static No func(...); \
\
public: \
static constexpr const bool value = \
sizeof(func<Args...>(0)) == sizeof(Yes); \
}; \
template <typename... Args> \
struct is_free_function_##Function##_anyreturn \
: public std::integral_constant< \
bool, __is_free_function_##Function##_anyreturn<Args...>::value> { \
}; \
\
template <typename... Args> \
constexpr const bool is_free_function_##Function##_anyreturn_v = \
is_free_function_##Function##_anyreturn<Args...>::value;

this generates struct is_free_function_Function_anyreturn<Args...> whose public constexpr member variable value is true if Function is a free function that takes Args and returns any value.

Note
to ensure that Function can be looked up if it can't be found via ADL, it may be necessary to add "using namespace::Function" BEFORE using this macro.

Definition at line 244 of file type_traits.h.

◆ GENERATE_IS_FREE_FUNCTION_STD_ANYRETURN

#define GENERATE_IS_FREE_FUNCTION_STD_ANYRETURN (   Function)
Value:
template <typename... Args> \
class __is_free_function_std_##Function##_anyreturn { \
using Yes = char; \
using No = int; \
template <typename... Args_> \
static auto func(void*) \
-> decltype(std::add_pointer_t<decltype( \
::std::Function(std::declval<Args_>()...))>{}, \
Yes{}); \
template <typename...> \
static No func(...); \
\
public: \
static constexpr const bool value = \
sizeof(func<Args...>(0)) == sizeof(Yes); \
}; \
template <typename... Args> \
struct is_free_function_std_##Function##_anyreturn \
: public std::integral_constant< \
bool, \
__is_free_function_std_##Function##_anyreturn<Args...>::value> {}; \
\
template <typename... Args> \
constexpr const bool is_free_function_std_##Function##_anyreturn_v = \
is_free_function_std_##Function##_anyreturn<Args...>::value;

this generates struct is_free_function_std_Function_anyreturn<Args...> whose public constexpr member variable value is true if ::std::Function is a free function that takes Args and returns any value.

Definition at line 273 of file type_traits.h.

Typedef Documentation

◆ void_t

template<typename... Ts>
using std::void_t = typedef typename make_void<Ts...>::type

Definition at line 55 of file type_traits.h.

Variable Documentation

◆ is_integral_v

template<class T >
constexpr bool std::is_integral_v = is_integral<T>::value
inlineconstexpr

Definition at line 61 of file type_traits.h.