16#if defined(__clang_analyzer__) && __clang_major__ >= 18
17#define NURI_CLANG_ANALYZER_NOLINT [[clang::suppress]]
18#define NURI_CLANG_ANALYZER_NOLINT_BEGIN [[clang::suppress]] {
19#define NURI_CLANG_ANALYZER_NOLINT_END }
21#define NURI_CLANG_ANALYZER_NOLINT
22#define NURI_CLANG_ANALYZER_NOLINT_BEGIN
23#define NURI_CLANG_ANALYZER_NOLINT_END
29#if __cplusplus >= 202002L
30 using std::underlying_type;
31 using std::underlying_type_t;
33 using std::remove_cvref;
34 using std::remove_cvref_t;
36 template <
class E,
bool = std::is_enum_v<E>>
37 struct underlying_type { };
40 struct underlying_type<E, false> { };
43 struct underlying_type<E, true> {
44 using type = std::underlying_type_t<E>;
48 using underlying_type_t =
typename underlying_type<T>::type;
52 using type = std::remove_cv_t<std::remove_reference_t<T>>;
56 using remove_cvref_t =
typename remove_cvref<T>::type;
59 template <
class To,
class From>
61 constexpr inline bool is_implicitly_constructible_v =
62 std::is_constructible_v<To, From> && std::is_convertible_v<From, To>;
64 template <
class To,
class From>
66 constexpr inline bool is_explicitly_constructible_v =
67 std::is_constructible_v<To, From> && !std::is_convertible_v<From, To>;
69 template <
bool is_const,
class T>
71 using type = std::conditional_t<is_const, const T, T>;
74 template <
bool is_const,
class T>
75 using const_if_t =
typename const_if<is_const, T>::type;
77 template <
class Iterator,
class T,
class IfTrue =
int>
78 using enable_if_compatible_iter_t =
79 std::enable_if_t<is_implicitly_constructible_v<
80 T,
typename std::iterator_traits<Iterator>::reference>,
83 template <
class Iter,
class IteratorTag,
class IfTrue =
int>
84 using enable_if_iter_category_t = std::enable_if_t<
85 std::is_same_v<typename std::iterator_traits<Iter>::iterator_category,
89 template <
class T,
bool = std::is_enum_v<T>>
90 struct extract_if_enum { };
93 struct extract_if_enum<T, true> {
94 using type = std::underlying_type_t<T>;
98 struct extract_if_enum<T, false> {
103 using extract_if_enum_t =
typename extract_if_enum<T>::type;
105 template <
class T, std::enable_if_t<
106 std::is_enum_v<T> || std::is_arithmetic_v<T>,
int> = 0>
107 constexpr auto extract_if_enum_v(T val) {
108 return static_cast<extract_if_enum_t<T>
>(val);
150 template <
class... Args>
151 struct overload_cast_impl {
152 template <
class Return>
153 constexpr decltype(
auto)
154 operator()(Return (*func)(Args...))
const noexcept {
158 template <
typename Return,
typename Class>
159 constexpr decltype(
auto)
160 operator()(Return (Class::*pmf)(Args...),
161 std::false_type = {})
const noexcept {
165 template <
typename Return,
typename Class>
166 constexpr decltype(
auto)
167 operator()(Return (Class::*pmf)(Args...)
const,
168 std::true_type )
const noexcept {
174template <
class... Args>
176constexpr inline static internal::overload_cast_impl<Args...> overload_cast;