25#ifndef JOIN_CORE_TRAITS_HPP
26#define JOIN_CORE_TRAITS_HPP
31#include <bits/enable_special_members.h>
55 template <std::
size_t I>
79 template <
typename... Ts>
88 void operator() ()
const;
94 template <
typename First,
typename... Ts>
105 template <
typename... Ts>
116 template <
typename T,
typename... Ts>
122 template <
typename T,
typename... Ts>
130 template <
typename T,
typename First,
typename... Ts>
132 : std::integral_constant<std::size_t, std::is_same<T, First>::value ? 0 : find_index<T, Ts...>::value + 1>
139 template <std::size_t I,
typename T,
typename... Ts>
148 template <
typename T,
typename... Ts>
157 template <std::size_t I,
typename... Ts>
163 template <std::
size_t I,
typename T>
166 using type = std::add_const_t<find_element_t<I, T>>;
172 template <std::
size_t I,
typename T>
175 using type = std::add_volatile_t<find_element_t<I, T>>;
181 template <std::
size_t I,
typename T>
184 using type = std::add_cv_t<find_element_t<I, T>>;
190 template <
typename T,
typename... Ts>
198 template <
typename T,
typename First,
typename... Ts>
200 : std::integral_constant<bool, std::is_same<T, First>::value || is_alternative<T, Ts...>::value>
207 template <std::size_t I,
typename... Ts>
208 struct is_index : std::integral_constant < bool,
216 template <typename T, typename... Ts>
217 struct count : std::integral_constant<std::size_t, 0>
224 template <typename T, typename First, typename... Ts>
225 struct count<T, First, Ts...>
226 : std::integral_constant<std::size_t, count<T, Ts...>::value + std::is_same<T, First>::value>
233 template <typename T, typename... Ts>
234 struct is_unique : std::integral_constant<bool, count<T, Ts...>::value == 1>
241 template <bool... Ts>
242 using all = std::is_same<std::integer_sequence<bool, true, Ts...>, std::integer_sequence<bool, Ts..., true>>;
247 template <typename... Ts>
248 struct are_copy_constructible : std::integral_constant<bool, all<std::is_copy_constructible<Ts>::value...>::value>
255 template <typename... Ts>
256 struct are_move_constructible : std::integral_constant<bool, all<std::is_move_constructible<Ts>::value...>::value>
263 template <typename... Ts>
264 struct are_copy_assignable
265 : std::integral_constant<bool, are_copy_constructible<Ts...>::value && are_move_constructible<Ts...>::value &&
266 all<std::is_copy_assignable<Ts>::value...>::value>
273 template <typename... Ts>
274 struct are_move_assignable : std::integral_constant<bool, are_move_constructible<Ts...>::value &&
275 all<std::is_move_assignable<Ts>::value...>::value>
282 struct EnableDefaultTag
284 explicit constexpr EnableDefaultTag () = default;
290 template <bool _Switch, typename _Tag = void>
293 constexpr EnableDefault () noexcept = default;
294 constexpr EnableDefault (EnableDefault const&) noexcept = default;
295 constexpr EnableDefault (EnableDefault&&) noexcept = default;
297 constexpr explicit EnableDefault (EnableDefaultTag)
301 EnableDefault& operator= (EnableDefault const&) noexcept = default;
302 EnableDefault& operator= (EnableDefault&&) noexcept = default;
308 template <typename _Tag>
309 struct EnableDefault<false, _Tag>
311 constexpr EnableDefault () noexcept = delete;
312 constexpr EnableDefault (EnableDefault const&) noexcept = default;
313 constexpr EnableDefault (EnableDefault&&) noexcept = default;
315 constexpr explicit EnableDefault (EnableDefaultTag)
319 EnableDefault& operator= (EnableDefault const&) noexcept = default;
320 EnableDefault& operator= (EnableDefault&&) noexcept = default;
Definition acceptor.hpp:32
typename find_element< I, Ts... >::type find_element_t
get element type in a parameter pack according its position.
Definition traits.hpp:158
typename identity< T >::type identity_t
return type unchanged.
Definition traits.hpp:74
typename std::result_of_t< overload< Ts... >(T)>::type match_t
find a type that match one of the alternatives of a parameter pack.
Definition traits.hpp:117
T type
Definition traits.hpp:151
std::add_const_t< find_element_t< I, T > > type
Definition traits.hpp:166
std::add_cv_t< find_element_t< I, T > > type
Definition traits.hpp:184
std::add_volatile_t< find_element_t< I, T > > type
Definition traits.hpp:175
get element type in a parameter pack according its position.
Definition traits.hpp:141
typename find_element< I - 1, Ts... >::type type
Definition traits.hpp:142
get element position in a parameter pack according its type.
Definition traits.hpp:124
return type unchanged.
Definition traits.hpp:66
T type
Definition traits.hpp:67
disambiguation tag to indicate that the contained object should be constructed in-place.
Definition traits.hpp:57
in_place_index_t()=default
disambiguation tag to indicate that the contained object should be constructed in-place.
Definition traits.hpp:39
disambiguation tag to indicate that the contained object should be constructed in-place.
Definition traits.hpp:48
in_place_type_t()=default
check if a type exists in a parameter pack.
Definition traits.hpp:192
overload resolution.
Definition traits.hpp:80