Support Class Library
A set of tools providing classes and utility
type_query.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <type_traits>
4 
5 #define SCL_TYPEQUERY_V(ret, fn) \
6 template <class T>\
7 inline constexpr ret fn(){\
8  return std::fn<T>::value;\
9 }
10 
11 #define SCL_TYPEQUERY(alias) \
12 template <class... T>\
13 using alias##_t = typename std::alias<T...>::type;
14 
15 namespace scl{
16  namespace tools{
17  namespace meta{
20 
21  template <class T, unsigned N = 0>
22  inline constexpr std::size_t extent(){
23  return std::extent<T, N>::value;
24  }
25 
26  template <std::size_t Len, std::size_t Align = /*Len **/ sizeof(char)>
27  using aligned_storage_t = typename std::aligned_storage<Len, Align>::type;
28 
29  template <std::size_t Len, class... Types>
30  using aligned_union_t = typename std::aligned_union<Len, Types...>::type;
31 
32  SCL_TYPEQUERY(common_type)
33 
34  template <class T>
35  using underlying_type_t = typename std::underlying_type<T>::type;
36 
37  template <size_t I, class Tuple>
38  using tuple_element_t = typename std::tuple_element<I, Tuple>::type;
39 
40 #ifdef SCL_CPP17
41  template <class F, class... Args>
42  using invoke_result_t = typename std::invoke_result<F, Args...>::type;
43 #else
44  template <class Signature>
45  using result_of_t = typename std::result_of<Signature>::type;
46 #endif
47  }
48  }
49 }
50 
51 #undef SCL_TYPEQUERY_V
52 #undef SCL_TYPEQUERY
constexpr std::size_t alignment_of()
Definition: type_query.h:18
typename std::tuple_element< I, Tuple >::type tuple_element_t
Definition: type_query.h:38
constexpr std::size_t rank()
Definition: type_query.h:19
Global namespace of the SCL.
Definition: alias.hpp:3
typename std::result_of< Signature >::type result_of_t
Definition: type_query.h:45
STL namespace.
#define SCL_TYPEQUERY_V(ret, fn)
Definition: type_query.h:5
typename std::aligned_union< Len, Types... >::type aligned_union_t
Definition: type_query.h:30
typename std::aligned_storage< Len, Align >::type aligned_storage_t
Definition: type_query.h:27
constexpr std::size_t extent()
Definition: type_query.h:22
typename std::underlying_type< T >::type underlying_type_t
Definition: type_query.h:35
#define SCL_TYPEQUERY(alias)
Definition: type_query.h:11
decltype(invoke(std::declval< F >(), std::declval< Args >()...)) invoke_result_t
Definition: invoke.h:109