18namespace hi::inline
v1 {
129template<>
struct make_string<char8_t> {
using type = std::u8string; };
151template<
typename T,
typename U>
153 using type =
decltype(
static_cast<T
>(0) +
static_cast<U
>(0));
156template<
typename T,
typename U>
157using make_promote_t =
typename make_promote<T,U>::type;
159template<
typename T,
typename Ei=
void>
161 using type = uintmax_t;
164template<std::
unsigned_
integral T>
166 using type = uintmax_t;
169template<std::
signed_
integral T>
171 using type = intmax_t;
175using make_intmax_t =
typename make_intmax<T>::type;
207#if (HI_COMPILER == HI_CC_CLANG || HI_COMPILER == HI_CC_GCC) && (HI_PROCESSOR == HI_CPU_X64)
211template<>
struct make_uintxx<128> {
using type =
unsigned __int128; };
253template<
typename L,
typename... R>
256template<std::
integral T>
261template<std::
unsigned_
integral L, std::
unsigned_
integral R>
263 using type = std::conditional_t<(
sizeof(L) >
sizeof(R)), L, R>;
266template<std::
signed_
integral L, std::
signed_
integral R>
268 using type = std::conditional_t<(
sizeof(L) >
sizeof(R)), L, R>;
271template<std::
unsigned_
integral L, std::
signed_
integral R>
272struct common_integer<L,R> {
274 std::conditional_t<(
sizeof(L) <
sizeof(
short)),
short,
275 std::conditional_t<(
sizeof(L) <
sizeof(int)), int,
276 std::conditional_t<(
sizeof(L) <
sizeof(
long)),
long,
long long>>>;
278 using type = common_integer<_left_type, R>::type;
281template<std::
signed_
integral L, std::
unsigned_
integral R>
282struct common_integer<L,R> {
283 using type = common_integer<R, L>::type;
286template<std::integral L, std::integral M, std::integral... R>
303template<std::integral L, std::integral... R>
309template<
typename To,
typename From,
typename Ei=
void>
312template<
typename To,
typename From>
requires(not std::is_const_v<From> and not std::is_volatile_v<From>)
314 using type = std::remove_cv_t<To>;
317template<
typename To,
typename From>
requires(not std::is_const_v<From> and std::is_volatile_v<From>)
319 using type = std::remove_cv_t<To>
volatile;
322template<
typename To,
typename From>
requires(std::is_const_v<From> and not std::is_volatile_v<From>)
323struct copy_cv<To,From> {
324 using type = std::remove_cv_t<To>
const;
327template<
typename To,
typename From>
requires(std::is_const_v<From> and std::is_volatile_v<From>)
328struct copy_cv<To,From> {
329 using type = std::remove_cv_t<To>
const volatile;
334template<
typename To,
typename From>
339 template <
typename C>
static std::true_type test(
typename C::value_type *);
342 static const bool value = std::is_same_v<decltype(test<T>(
nullptr)),
std::true_type>;
350 template <
typename C>
static std::true_type test(
decltype(&C::add_callback) func_ptr);
353 static const bool value = std::is_same_v<decltype(test<T>(
nullptr)),
std::true_type>;
359template<
typename BaseType,
typename DerivedType>
362template<
typename BaseType,
typename DerivedType>
365template<
typename DerivedType,
typename BaseType>
368template<
typename DerivedType,
typename BaseType>
371template<
typename DerivedType,
typename BaseType>
374template<
typename DerivedType,
typename BaseType>
380template<
typename Context,
typename Expected>
381constexpr bool is_different_v = not std::is_same_v<std::decay_t<Context>,std::decay_t<Expected>>;
392template<
typename First,
typename Second>
397template<
typename First,
typename Second>
409 constexpr static bool value =
false;
428#define hi_call_method(object, method, ...) \
430 if constexpr (smart_pointer_traits<std::decay_t<decltype(object)>>::value) { \
431 return object->method(__VA_ARGS__); \
433 return object.method(__VA_ARGS__); \
439template<
typename Out,
typename In>
480template<
typename Context,
typename Expected,
typename... OtherExpected>
483template<
typename Context,
typename Expected,
typename FirstOtherExpected,
typename... OtherExpected>
484struct is_forward_of<Context, Expected, FirstOtherExpected, OtherExpected...> : std::conditional_t<
485 is_forward_of<Context, Expected>::value or
486 (is_forward_of<Context, FirstOtherExpected>::value or ... or is_forward_of<Context, OtherExpected>::value),
490template<
typename Context,
typename Expected>
493 std::is_same_v<std::decay_t<Context>, Expected> or std::is_base_of_v<Expected, std::decay_t<Context>>,
496 static_assert(not std::is_reference_v<Expected>,
"Template argument Expected must be a non-reference type.");
499template<
typename Context,
typename Expected>
502 std::is_convertible_v<Context, std::shared_ptr<Expected>>,
506template<
typename Context,
typename Expected>
509 std::is_convertible_v<Context, std::weak_ptr<Expected>>,
513template<
typename Context,
typename Expected>
516 std::is_convertible_v<Context, std::unique_ptr<Expected>>,
520template<
typename Context,
typename Expected>
523 std::is_convertible_v<Context, Expected *>,
527template<
typename Context,
typename Result,
typename... Args>
529 std::conditional_t<std::is_invocable_r_v<Result, Context, Args...>, std::true_type, std::false_type> {
532template<
typename Context,
typename Expected,
typename... OtherExpected>
533constexpr bool is_forward_of_v =
is_forward_of<Context, Expected, OtherExpected...>::value;
535template<
typename Context>
537 using type = std::conditional_t<std::is_rvalue_reference_v<Context>, std::decay_t<Context>, std::decay_t<Context>
const &>;
540template<
typename Context>
541using forward_copy_or_ref_t = forward_copy_or_ref<Context>::type;
550 using type = std::decay_t<T>;
555 using type = std::monostate;
628 using Ts::operator()...;
Functions and macros for handling architectural difference between compilers, CPUs and operating syst...
DOXYGEN BUG.
Definition algorithm.hpp:15
common_integer< L, R... >::type common_integer_t
Get an integer type that will fit all values from all template parameters.
Definition type_traits.hpp:304
constexpr bool is_numeric_v
Definition type_traits.hpp:110
constexpr bool is_different_v
If the types are different.
Definition type_traits.hpp:381
typename make_string< T >::type make_string_t
type-trait to convert a character to a string type.
Definition type_traits.hpp:135
typename make_string_view< T >::type make_string_view_t
type-trait to convert a character to a string_view type.
Definition type_traits.hpp:149
constexpr bool is_numeric_unsigned_integral_v
Definition type_traits.hpp:58
variant_decay< T >::type variant_decay_t
Definition type_traits.hpp:561
typename copy_cv< To, From >::type copy_cv_t
Type-trait to copy const volatile qualifiers from one type to another.
Definition type_traits.hpp:335
constexpr bool is_numeric_integral_v
Definition type_traits.hpp:82
constexpr bool type_in_range_v
All values of numeric type In can be represented without loss of precision by numeric type Out.
Definition type_traits.hpp:440
constexpr bool is_character_v
Definition type_traits.hpp:122
constexpr bool is_numeric_signed_integral_v
Definition type_traits.hpp:39
Is a numeric signed integer.
Definition type_traits.hpp:29
Is a numeric unsigned integer.
Definition type_traits.hpp:48
Is a numeric integer.
Definition type_traits.hpp:68
Is a numeric.
Definition type_traits.hpp:93
Definition type_traits.hpp:112
type-trait to convert a character to a string type.
Definition type_traits.hpp:126
type-trait to convert a character to a string_view type.
Definition type_traits.hpp:139
Definition type_traits.hpp:152
Definition type_traits.hpp:160
Has an signed integer of a specific size.
Definition type_traits.hpp:180
Has an unsigned integer of a specific size.
Definition type_traits.hpp:185
Has an float of a specific size.
Definition type_traits.hpp:190
Make an signed integer.
Definition type_traits.hpp:195
Make an unsigned integer.
Definition type_traits.hpp:200
Make an floating point.
Definition type_traits.hpp:205
Get an integer type that will fit all values from all template parameters.
Definition type_traits.hpp:254
Type-trait to copy const volitile qualifiers from one type to another.
Definition type_traits.hpp:310
Definition type_traits.hpp:338
Definition type_traits.hpp:349
Definition type_traits.hpp:360
Definition type_traits.hpp:366
Definition type_traits.hpp:372
Definition type_traits.hpp:384
Definition type_traits.hpp:393
Smart pointer traits.
Definition type_traits.hpp:406
void type
The type the pointer points to.
Definition type_traits.hpp:413
Is context a form of the expected type.
Definition type_traits.hpp:481
Definition type_traits.hpp:536
Decays types for use as elements in std::variant.
Definition type_traits.hpp:549
This selector allows access to member variable by name.
Definition type_traits.hpp:592
Documentation of a type.
Definition type_traits.hpp:617
Helper type to turn a set of lambdas into a single overloaded type to pass to std::visit().
Definition type_traits.hpp:626