10#include "../macros.hpp"
19hi_export_module(hikogui.utility.type_traits);
21hi_export
namespace hi {
221 using type = std::u8string;
245 using type = std::string_view;
249 using type = std::wstring_view;
253 using type = std::u8string_view;
257 using type = std::u16string_view;
261 using type = std::u32string_view;
269template<
typename T,
typename U>
271 using type =
decltype(
static_cast<T
>(0) +
static_cast<U
>(0));
274template<
typename T,
typename U>
277template<
typename T,
typename Ei =
void>
279 using type = uintmax_t;
282template<std::
unsigned_
integral T>
284 using type = uintmax_t;
287template<std::
signed_
integral T>
289 using type = intmax_t;
293using make_intmax_t =
typename make_intmax<T>::type;
298template<std::
size_t N>
304template<std::
size_t N>
310template<std::
size_t N>
316template<std::
size_t N>
322template<std::
size_t N>
328template<std::
size_t N>
334template<std::
size_t N>
340template<std::
size_t N>
346template<std::
size_t N>
379 using type = int128_t;
382struct make_uintxx<128> {
383 using type = uint128_t;
388 using type = int64_t;
392 using type = uint64_t;
400 using type = int32_t;
404 using type = uint32_t;
412 using type = int16_t;
416 using type = uint16_t;
424 using type = uint8_t;
427template<std::
size_t N>
429template<std::
size_t N>
431template<std::
size_t N>
433template<std::
size_t N>
435template<std::
size_t N>
437template<std::
size_t N>
439template<std::
size_t N>
441template<std::
size_t N>
443template<std::
size_t N>
448 using type = std::remove_cv_t<std::remove_pointer_t<T>>;
456template<
typename To,
typename From,
typename Ei =
void>
459template<
typename To,
typename From>
460requires(not std::is_const_v<From> and not std::is_volatile_v<From>)
462 using type = std::remove_cv_t<To>;
465template<
typename To,
typename From>
466requires(not std::is_const_v<From> and std::is_volatile_v<From>)
468 using type = std::remove_cv_t<To>
volatile;
471template<
typename To,
typename From>
472requires(std::is_const_v<From> and not std::is_volatile_v<From>)
473struct copy_cv<To, From> {
474 using type = std::remove_cv_t<To>
const;
477template<
typename To,
typename From>
478requires(std::is_const_v<From> and std::is_volatile_v<From>)
479struct copy_cv<To, From> {
480 using type = std::remove_cv_t<To>
const volatile;
485template<
typename To,
typename From>
495 static const bool value = std::is_same_v<decltype(test<T>(
nullptr)),
std::true_type>;
508 static const bool value = std::is_same_v<decltype(test<T>(
nullptr)),
std::true_type>;
514template<
typename BaseType,
typename DerivedType>
517template<
typename BaseType,
typename DerivedType>
520template<
typename DerivedType,
typename BaseType>
523template<
typename DerivedType,
typename BaseType>
526template<
typename DerivedType,
typename BaseType>
529template<
typename DerivedType,
typename BaseType>
541template<
typename First,
typename Second>
546template<
typename First,
typename Second>
551template<
typename Out,
typename In>
592template<
typename Context,
typename Expected,
typename... OtherExpected>
595template<
typename Context,
typename Expected,
typename FirstOtherExpected,
typename... OtherExpected>
596struct is_forward_of<Context, Expected, FirstOtherExpected, OtherExpected...> :
598 is_forward_of<Context, Expected>::value or
599 (is_forward_of<Context, FirstOtherExpected>::value or ... or is_forward_of<Context, OtherExpected>::value),
603template<
typename Context,
typename Expected>
606 std::is_same_v<std::decay_t<Context>, Expected> or std::is_base_of_v<Expected, std::decay_t<Context>>,
609 static_assert(not std::is_reference_v<Expected>,
"Template argument Expected must be a non-reference type.");
612template<
typename Context,
typename Expected>
614 std::conditional_t<std::is_convertible_v<Context, std::shared_ptr<Expected>>, std::true_type, std::false_type> {};
616template<
typename Context,
typename Expected>
618 std::conditional_t<std::is_convertible_v<Context, std::weak_ptr<Expected>>, std::true_type, std::false_type> {};
620template<
typename Context,
typename Expected>
622 std::conditional_t<std::is_convertible_v<Context, std::unique_ptr<Expected>>, std::true_type, std::false_type> {};
624template<
typename Context,
typename Expected>
628template<
typename Context,
typename Result,
typename... Args>
630 std::conditional_t<std::is_invocable_r_v<Result, Context, Args...>, std::true_type, std::false_type> {};
632template<
typename Context,
typename Expected,
typename... OtherExpected>
633constexpr bool is_forward_of_v =
is_forward_of<Context, Expected, OtherExpected...>::value;
635template<
typename Context>
637 using type = std::conditional_t<std::is_rvalue_reference_v<Context>, std::decay_t<Context>, std::decay_t<Context>
const&>;
640template<
typename Context>
649 using type = std::decay_t<T>;
654 using type = std::monostate;
719 using Ts::operator()...;
731template<std::
integral T>
733 constexpr static T off = T{};
734 constexpr static T
on = T{1};
738requires(std::is_enum_v<T>)
740 constexpr static T off = static_cast<T>(0);
741 constexpr static T
on =
static_cast<T
>(1);
745constexpr bool default_values_v = default_values<T>::value;
The HikoGUI namespace.
Definition array_generic.hpp:20
constexpr bool is_numeric_v
Definition type_traits.hpp:150
constexpr bool is_character_v
Definition type_traits.hpp:179
constexpr bool is_numeric_signed_integral_v
Definition type_traits.hpp:46
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:486
constexpr bool is_byte_like_v
An array of this type will implicitly create objects within that array.
Definition type_traits.hpp:205
@ on
The border is drawn on the edge of a quad.
variant_decay< T >::type variant_decay_t
Definition type_traits.hpp:660
constexpr bool is_numeric_integral_v
Definition type_traits.hpp:107
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:267
constexpr bool is_numeric_unsigned_integral_v
Definition type_traits.hpp:71
constexpr bool type_in_range_v
All values of numeric type In can be represented without loss of range by numeric type Out.
Definition type_traits.hpp:552
typename make_string< T >::type make_string_t
type-trait to convert a character to a string type.
Definition type_traits.hpp:235
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
Is a numeric signed integer.
Definition type_traits.hpp:31
Is a numeric unsigned integer.
Definition type_traits.hpp:56
Is a numeric integer.
Definition type_traits.hpp:82
Is a numeric.
Definition type_traits.hpp:119
Definition type_traits.hpp:153
An array of this type will implicitly create objects within that array.
Definition type_traits.hpp:186
type-trait to convert a character to a string type.
Definition type_traits.hpp:210
type-trait to convert a character to a string_view type.
Definition type_traits.hpp:240
Definition type_traits.hpp:270
Definition type_traits.hpp:278
Has an signed integer of a specific size, natively supported by the compiler.
Definition type_traits.hpp:299
Has an unsigned integer of a specific size, natively supported by the compiler.
Definition type_traits.hpp:305
Has an float of a specific size, natively supported by the compiler.
Definition type_traits.hpp:311
Has an signed integer of a specific size.
Definition type_traits.hpp:317
Has an unsigned integer of a specific size.
Definition type_traits.hpp:323
Has an float of a specific size.
Definition type_traits.hpp:329
Make an signed integer.
Definition type_traits.hpp:335
Make an unsigned integer.
Definition type_traits.hpp:341
Make an floating point.
Definition type_traits.hpp:347
Definition type_traits.hpp:447
Type-trait to copy const volatile qualifiers from one type to another.
Definition type_traits.hpp:457
Definition type_traits.hpp:489
Definition type_traits.hpp:502
Definition type_traits.hpp:515
Definition type_traits.hpp:521
Definition type_traits.hpp:527
Definition type_traits.hpp:533
Definition type_traits.hpp:542
Is context a form of the expected type.
Definition type_traits.hpp:593
Definition type_traits.hpp:636
Decays types for use as elements in std::variant.
Definition type_traits.hpp:648
This selector allows access to member variable by name.
Definition type_traits.hpp:691
Documentation of a type.
Definition type_traits.hpp:710
Helper type to turn a set of lambdas into a single overloaded type to pass to std::visit().
Definition type_traits.hpp:717
A type traits for generating default values of a type.
Definition type_traits.hpp:729