19 using type = std::remove_cv_t<std::remove_reference_t<T>>;
24 using remove_cvref_t =
typename remove_cvref<T>::type;
35 struct UnderlyingType<T&>
37 using type =
typename UnderlyingType<T>::type;
41 struct UnderlyingType<T*>
43 using type =
typename UnderlyingType<T>::type;
47 struct UnderlyingType<T*
const>
49 using type =
typename UnderlyingType<T>::type;
53 struct UnderlyingType<std::reference_wrapper<T>>
55 using type =
typename UnderlyingType<T>::type;
59 struct UnderlyingType<std::shared_ptr<T>>
61 using type =
typename UnderlyingType<T>::type;
65 struct UnderlyingType<std::shared_ptr<T> const>
67 using type =
typename UnderlyingType<T>::type;
71 struct UnderlyingType<std::unique_ptr<T>>
73 using type =
typename UnderlyingType<T>::type;
77 struct UnderlyingType<std::unique_ptr<T> const>
79 using type =
typename UnderlyingType<T>::type;
85 using Underlying_t =
typename Impl::UnderlyingType<T>::type;
90 T& underlying(T& value)
97 T& underlying(T* value)
104 T underlying(T&& value) =
delete;
108 T& underlying(std::reference_wrapper<T>
const& value)
115 T& underlying(std::shared_ptr<T>
const& value)
122 T& underlying(std::unique_ptr<T>
const& value)
129 #define FWD(...) static_cast<decltype(__VA_ARGS__)>(__VA_ARGS__)
133 #define TYPEOF(...) __typeof__(__VA_ARGS__)
135 #define TYPEOF(...) AMDiS::remove_cvref_t<decltype(__VA_ARGS__)>
140 #define VALUE(...) TYPEOF(__VA_ARGS__)::value
145 template <
class... Ts>
148 template <
class... Ts>
159 template <
class... T>
160 constexpr void operator()(T&&...)
const { }
165 auto makeUniquePtr(Obj&& obj)
167 return std::make_unique<TYPEOF(obj)>(FWD(obj));
171 auto makeSharedPtr(Obj&& obj)
173 return std::make_shared<TYPEOF(obj)>(FWD(obj));
177 using enable_if_all_t = std::enable_if_t<(b &&...)>;
A functor with no operation.
Definition: TypeTraits.hpp:158
A variadic type list.
Definition: TypeTraits.hpp:146
Remove cv and ref qualifiers of type T.
Definition: TypeTraits.hpp:18