32#ifndef KBLIB_FAKESTD_H
33#define KBLIB_FAKESTD_H
43#if __has_include("gsl/pointers")
44# include "gsl/pointers"
48# define KBLIB_FAKESTD (__cplusplus < 201703L)
53#if __has_include("gsl/pointers")
56template <class T, class = std::enable_if_t<std::is_pointer<T>::value>>
60template <
bool B,
typename T =
void>
64using decay_t =
typename std::decay<T>::type;
68 typename std::remove_reference<typename std::remove_cv<T>::type>::type;
73#if __cpp_lib_constexpr_functional
79template <
typename F,
typename... Args>
81 std::forward<F>(f), std::forward_as_tuple(std::forward<Args>(args)...))))
84 std::forward_as_tuple(std::forward<Args>(args)...));
91 template <
typename F,
typename... Args,
92 enable_if_t<not std::is_member_pointer<remove_cvref_t<F>>::value,
94 constexpr auto do_invoke(F&& f, Args&&... args)
noexcept(
noexcept(
95 std::forward<F>(f)(std::forward<Args>(args)...))) ->
decltype(
auto) {
96 return std::forward<F>(f)(std::forward<Args>(args)...);
99 template <
typename F,
typename Object,
typename... Args,
101 and std::is_member_function_pointer<F>::value,
103 constexpr auto do_invoke(F f, Object&& obj, Args&&... args)
noexcept(
104 noexcept((std::forward<Object>(obj).*f)(std::forward<Args>(args)...)))
106 return (obj.*f)(std::forward<Args>(args)...);
109 template <
typename F,
typename Pointer,
typename... Args,
111 and std::is_member_function_pointer<F>::value,
113 constexpr auto do_invoke(F f, Pointer ptr, Args&&... args)
noexcept(
114 noexcept((ptr->*f)(std::forward<Args>(args)...))) ->
decltype(
auto) {
115 return (ptr->*f)(std::forward<Args>(args)...);
118 template <
typename Member,
typename Object,
120 and std::is_member_object_pointer<Member>::value,
122 constexpr auto do_invoke(Member mem, Object&& obj)
noexcept
124 return std::forward<Object>(obj).*mem;
127 template <
typename Member,
typename Pointer,
129 and std::is_member_object_pointer<Member>::value,
131 constexpr auto do_invoke(Member mem, Pointer ptr)
noexcept
137template <
typename F,
typename... Args>
138constexpr auto invoke(F&& f, Args&&... args)
noexcept(
noexcept(
165 template <
typename AlwaysVoid,
typename,
typename...>
167 template <
typename F,
typename... Args>
169 std::declval<Args>()...))),
172 =
decltype(
invoke(std::declval<F>(), std::declval<Args>()...));
175 template <
class F,
class... ArgTypes>
178 template <
typename F,
typename... ArgTypes>
181 template <
typename... Ts>
185 template <
typename... Ts>
212 : std::integral_constant<
214 not std::is_same<decltype(is_referenceable_impl::test<Tp>(0)),
217 template <
class Tp,
class Up = Tp,
219 = not std::is_void<Tp>::value and not std::is_void<Up>::value>
221 template <
class LHS,
class RHS>
222 static decltype(
swap(std::declval<LHS>(), std::declval<RHS>()))
224 template <
class,
class>
228 using swap1 =
decltype((test_swap<Tp, Up>(0)));
229 using swap2 =
decltype((test_swap<Up, Tp>(0)));
231 static const bool value = not std::is_same<swap1, nat>::value
232 and not std::is_same<swap2, nat>::value;
235 template <
class Tp,
class Up>
238 template <
class Tp,
class Up = Tp,
241 static const bool value =
noexcept(
242 swap(std::declval<Tp>(),
243 std::declval<Up>()))and
noexcept(
swap(std::declval<Up>(),
244 std::declval<Tp>()));
247 template <
class Tp,
class Up>
254 :
public std::integral_constant<bool,
255 detail::swappable_with<Tp&>::value> {};
259 :
public std::integral_constant<
260 bool, detail::nothrow_swappable_with<Tp&>::value> {};
264 template <
class Tp,
class Up>
266 :
public std::integral_constant<bool,
267 detail::swappable_with<Tp, Up>::value> {
272 :
public std::conditional<
273 detail::is_referenceable<Tp>::value,
274 is_swappable_with<typename std::add_lvalue_reference<Tp>::type,
275 typename std::add_lvalue_reference<Tp>::type>,
276 std::false_type>::type {};
278 template <
class Tp,
class Up>
280 :
public integral_constant<
281 bool, detail::nothrow_swappable_with<Tp, Up>::value> {};
285 :
public conditional<
286 detail::is_referenceable<Tp>::value,
287 is_nothrow_swappable_with<typename add_lvalue_reference<Tp>::type,
288 typename add_lvalue_reference<Tp>::type>,
289 false_type>::type {};
291 template <
class Tp,
class Up>
297 template <
class Tp,
class Up>
307 template <
typename F>
310 : fd(
std::forward<F>(f)) {}
314 template <
class... Args>
316 not std::declval<invoke_result_t<std::decay_t<F>&, Args...>>()) {
317 return not
invoke(fd, std::forward<Args>(args)...);
320 template <
class... Args>
321 constexpr auto operator()(Args&&... args)
const& ->
decltype(
324 return not
invoke(std::move(fd), std::forward<Args>(args)...);
331 template <
typename F>
341 template <
class ForwardIt>
342 constexpr auto max_element(ForwardIt first, ForwardIt last) -> ForwardIt {
346 ForwardIt largest = first;
348 for (; first != last; ++first) {
349 if (*largest < *first) {
356 template <
class ForwardIt,
class Compare>
357 constexpr auto max_element(ForwardIt first, ForwardIt last, Compare comp)
362 ForwardIt largest = first;
364 for (; first != last; ++first) {
365 if (comp(*largest, *first)) {
373 constexpr auto size(
const C& c) ->
decltype(c.size()) {
377 template <
class T, std::
size_t N>
378 constexpr auto size(
const T (&)[N])
noexcept -> std::size_t {
386 template <
class Ret,
class Fp,
class... Args>
388 template <
class XFp,
class... XArgs>
391 std::declval<XArgs>()...));
392 template <
class XFp,
class... XArgs>
395 using Result =
decltype(try_call<Fp, Args...>(0));
397 using type =
typename std::conditional<
398 not std::is_same<Result, detail::nat>::value,
399 typename std::conditional<std::is_void<Ret>::value, std::true_type,
400 std::is_convertible<Result, Ret>>::type,
401 std::false_type>::type;
402 static const bool value = type::value;
404 template <
class Fp,
class... Args>
407 template <
bool IsInvokable,
bool IsCVVoid,
class Ret,
class Fp,
410 static const bool value =
false;
413 template <
class Ret,
class Fp,
class... Args>
420 static const bool value =
noexcept(ThisT::test_noexcept<Ret>(
421 kblib::invoke(std::declval<Fp>(), std::declval<Args>()...)));
424 template <
class Ret,
class Fp,
class... Args>
426 static const bool value =
noexcept(
430 template <
class Ret,
class Fp,
class... Args>
433 std::is_void<Ret>::value, Ret, Fp, Args...>;
435 template <
class Fp,
class... Args>
440 template <
class Fp,
class... Args>
442 :
public std::enable_if<
443 invokable<Fp, Args...>::value,
444 typename invokable_r<void, Fp, Args...>::Result> {};
449 template <
class Fn,
class... Args>
451 : std::integral_constant<bool, detail::invokable<Fn, Args...>::value> {};
453 template <
class Ret,
class Fn,
class... Args>
455 : std::integral_constant<bool,
456 detail::invokable_r<Ret, Fn, Args...>::value> {
459 template <
class Fn,
class... Args>
462 template <
class Ret,
class Fn,
class... Args>
467 template <
class Fn,
class... Args>
469 : std::integral_constant<bool,
470 detail::nothrow_invokable<Fn, Args...>::value> {
473 template <
class Ret,
class Fn,
class... Args>
475 : std::integral_constant<
476 bool, detail::nothrow_invokable_r<Ret, Fn, Args...>::value> {};
478 template <
class Fn,
class... Args>
482 template <
class Ret,
class Fn,
class... Args>
488namespace fakestd =
std;
503template <
typename... Ts>
511template <
typename... Ts>
526template <
typename T,
typename =
void>
532template <
typename... T>
537 = std::integral_constant<
decltype(T::value), T::value>;
543template <
bool V,
typename T>
549template <
bool V,
typename T>
554 template <
typename F,
typename Arg,
typename =
void>
556 template <std::size_t... Is>
557 constexpr static auto do_apply(F&& f, Arg&& arg)
noexcept(
559 std::get<Is>(std::forward<Arg>(arg))...)))
562 std::get<Is>(std::forward<Arg>(arg))...);
568template <
typename F,
typename Arg>
569constexpr auto apply(F&& f, Arg&& arg)
noexcept(
571 std::forward<F>(f), std::forward<Arg>(arg),
572 std::index_sequence<std::tuple_size<Arg>::value>{})))
574 return detail::apply_impl<F, Arg>::do_apply(
575 std::forward<F>(f), std::forward<Arg>(arg),
576 std::index_sequence<std::tuple_size<Arg>::value>{});
581 return std::unique_ptr<T>(p);
583template <
typename T,
typename D>
585 return std::unique_ptr<T, D>(p, d);
593 return static_cast<std::make_unsigned_t<I>
>(x);
600 return static_cast<std::make_signed_t<I>
>(x);
607template <
typename A,
typename F>
610 and std::is_signed<A>::value,
611 std::make_signed_t<F>> {
619template <
typename A,
typename F>
621 -> enable_if_t<std::is_integral<A>::value and std::is_integral<F>::value
622 and std::is_unsigned<A>::value,
623 std::make_unsigned_t<F>> {
630 using yes = char (&)[1];
631 using no = char (&)[2];
633 template <
typename C>
634 static auto check(
decltype(&
C::swap)) -> yes;
636 static auto check(...) -> no;
639 constexpr static bool value =
sizeof(check<T>(
nullptr)) ==
sizeof(yes);
642template <
typename T,
typename =
void>
651 template <
typename... Ts>
652 constexpr auto ignore(Ts&&... ) noexcept ->
void {}
654 template <
typename T, std::size_t... Is>
657 noexcept(
ignore(((
void)
swap(std::get<Is>(
a), std::get<Is>(b)), 0)...)))
659 ignore(((
void)
swap(std::get<Is>(
a), std::get<Is>(b)), 0)...);
670 template <typename T, enable_if_t<not has_member_swap<T>::value
671 and not is_tuple_like<T>::value,
674 noexcept(std::is_nothrow_move_constructible<T>::value and
675 std::is_nothrow_move_assignable<T>::value) ->
void {
676 auto tmp = std::move(
a);
687 template <typename T, enable_if_t<has_member_swap<T>::value,
int> = 0>
689 noexcept(
noexcept(
a.swap(b))) ->
void {
699 template <
typename T, std::
size_t N>
700 KBLIB_UNUSED constexpr auto operator()(T (&
a)[N], T (&b)[N])
const
701 noexcept(std::is_nothrow_move_constructible<T>::value and
702 std::is_nothrow_move_assignable<T>::value) ->
void {
703 for (std::size_t i = 0; i < N; ++i) {
713 template <typename T, enable_if_t<is_tuple_like<T>::value
714 and not has_member_swap<T>::value,
717 = std::tuple_size<T>::value>
718 KBLIB_UNUSED constexpr auto operator()(T&
a, T& b)
const noexcept(
noexcept(
724template <
typename T,
typename U = T>
726 T old_value = std::move(obj);
727 obj = std::forward<U>(new_value);
735 template <
typename T>
745 return (x & ~(x >> 1u));
748 template <
typename Num>
750 return static_cast<Num
>(
typename std::make_unsigned<Num>::type{1}
751 << (std::numeric_limits<Num>::digits - 1u));
754 template <
class... Args>
756 template <std::
size_t N>
757 using type =
typename std::tuple_element<N, std::tuple<Args...>>::type;
760 template <auto K,
typename V>
762 constexpr static auto key = K;
766 template <
typename Key,
typename Comp,
typename... Vals>
769 template <std::
size_t I>
770 using element =
typename types::template type<I>;
772 template <Key key, std::
size_t I = 0>
774 static_assert(I <
sizeof...(Vals),
"key not found");
778 return get<key, I + 1>();
782 template <Key key,
typename Default =
void, std::
size_t I = 0>
784 if constexpr (I ==
sizeof...(Vals)) {
789 return get<key, I + 1>();
794 template <
typename N>
798 template <
typename T>
800 static_assert(max_val<T> < max_val<std::intmax_t>,
801 "Cannot safely promote intmax_t.");
803 template <
typename U>
814 using type =
typename decltype(
815 ints_map::template get_default<max_val<T> + 1>())::type;
818 template <typename N, bool = std::is_signed<N>::value>
821 template <
typename N>
826 template <
typename N>
829 template <typename N, bool = std::is_unsigned<N>::value>
832 template <
typename N>
837 template <
typename N>
842template <
typename N,
typename =
void>
847 using type = std::conditional_t<
848 std::is_signed<N>::value, N,
863template <
typename C,
typename T,
864 bool = std::is_const<typename std::remove_reference<C>::type>::value>
867template <
typename C,
typename T>
870template <
typename C,
typename T>
873template <
typename C,
typename T>
876template <
typename C,
typename V>
879template <
typename T,
typename =
void>
884 using type =
typename T::value_type;
892template <
typename T,
typename =
void>
897 using type =
typename T::key_type;
905template <
typename T,
typename =
void>
910 using type =
typename T::mapped_type;
918template <
typename T,
typename =
void>
923 using type =
typename T::hasher;
931template <
typename Container,
bool = key_detected_v<Container>,
932 typename T =
typename Container::value_type>
935template <
typename Container>
937 :
meta_type<typename Container::value_type> {};
939template <
typename Container>
942template <
typename Container>
943constexpr static bool is_linear_container_v
944 = value_detected_v<Container> and not key_detected_v<Container>;
946template <
typename Container>
949template <
typename Container,
bool = key_detected_v<Container>,
950 bool = mapped_detected_v<Container>>
953template <
typename Container>
955 :
meta_type<typename Container::key_type> {};
957template <
typename Container>
960template <
typename Container>
961constexpr static bool is_setlike_v
963 Container> and value_detected_v<Container> and not mapped_detected_v<Container> and std::is_same<key_detected_t<Container>,
value_detected_t<Container>>::value);
965template <
class InputIt1,
class InputIt2>
967 InputIt2 first2) ->
bool {
968 for (; first1 != last1; ++first1, ++first2) {
969 if (not (*first1 == *first2)) {
976template <
typename InputIt1,
typename InputIt2,
typename BinaryPredicate,
978 not std::is_same<InputIt2, BinaryPredicate>::value,
int> = 0>
980 InputIt2 first2, BinaryPredicate p)
982 for (; first1 != last1; ++first1, ++first2) {
983 if (not p(*first1, *first2)) {
989template <
class RandomIt1,
class RandomIt2,
991 std::is_base_of<std::random_access_iterator_tag,
992 typename std::iterator_traits<
993 RandomIt1>::iterator_category>::value
994 and std::is_base_of<std::random_access_iterator_tag,
995 typename std::iterator_traits<
996 RandomIt2>::iterator_category>::value,
999 RandomIt2 first2, RandomIt2 last2)
1001 if (std::distance(first1, last1) == std::distance(first2, last2)) {
1004 for (; first1 != last1; ++first1, ++first2) {
1005 if (not (*first1 == *first2)) {
1012template <
class RandomIt1,
class RandomIt2,
typename BinaryPredicate,
1014 std::is_base_of<std::random_access_iterator_tag,
1015 typename std::iterator_traits<
1016 RandomIt1>::iterator_category>::value
1017 and std::is_base_of<std::random_access_iterator_tag,
1018 typename std::iterator_traits<
1019 RandomIt2>::iterator_category>::value,
1022 RandomIt2 first2, RandomIt2 last2,
1023 BinaryPredicate p) ->
bool {
1024 if (std::distance(first1, last1) == std::distance(first2, last2)) {
1027 for (; first1 != last1; ++first1, ++first2) {
1028 if (not p(*first1, *first2)) {
1035 class InputIt1,
class InputIt2,
1037 not std::is_base_of<
1038 std::random_access_iterator_tag,
1039 typename std::iterator_traits<InputIt1>::iterator_category>::value
1040 or not std::is_base_of<std::random_access_iterator_tag,
1041 typename std::iterator_traits<
1042 InputIt2>::iterator_category>::value,
1045 InputIt2 first2, InputIt2 last2) ->
bool {
1046 for (; first1 != last1 and first2 != last2; ++first1, ++first2) {
1047 if (not (*first1 == *first2)) {
1051 return (first1 == last1 and first2 == last2);
1055 typename InputIt1,
typename InputIt2,
typename BinaryPredicate,
1057 not std::is_base_of<
1058 std::random_access_iterator_tag,
1059 typename std::iterator_traits<InputIt1>::iterator_category>::value
1060 or not std::is_base_of<std::random_access_iterator_tag,
1061 typename std::iterator_traits<
1062 InputIt2>::iterator_category>::value,
1065 InputIt2 first2, InputIt2 last2,
1066 BinaryPredicate p) ->
bool {
1067 for (; first1 != last1 and first2 != last2; ++first1, ++first2) {
1068 if (not p(*first1, *first2)) {
1072 return (first1 == last1 and first2 == last2);
1075template <
typename C>
1080template <
typename T, std::
size_t N>
1085template <
class InputIt1,
class InputIt2>
1089 InputIt2 last2) ->
bool {
1090 for (; (first1 != last1) and (first2 != last2); ++first1, (void)++first2) {
1091 if (*first1 < *first2)
1093 if (*first2 < *first1)
1096 return (first1 == last1) and (first2 != last2);
1100 template <
typename D,
typename T,
typename =
void>
1105 template <
typename D,
typename T>
1115template <
typename T>
1129 template <
typename... Args,
1130 enable_if_t<std::is_constructible<T, Args...>::value> = 0>
1132 : p{new T(args...)} {}
1133 template <
typename... Args>
1135 : p{new T{args...}} {}
1138 : p{(u.p ? (new T(*u.p)) : nullptr)} {}
1150 p.reset(
new T(*u.p));
1167 p.
reset(
new T(val));
1173 p.
reset(
new T(std::move(val)));
1176 auto assign() & ->
void { p.reset(
new T()); }
1177 auto assign(
const T& val) & ->
void { p.reset(
new T(val)); }
1178 auto assign(T&& val) & ->
void { p.reset(
new T(std::move(val))); }
1179 template <
typename... Args,
1180 enable_if_t<std::is_constructible<T, Args...>::value> = 0>
1182 p.reset(
new T(std::forward<Args>(args)...));
1184 template <
typename... Args>
1186 p.reset(
new T{std::forward<Args>(args)...});
1195 return p !=
nullptr;
1229 std::unique_ptr<element_type> p;
1232template <
typename T,
typename D>
1234 using Base = std::unique_ptr<T, D>;
1237 using typename Base::deleter_type;
1238 using typename Base::element_type;
1239 using typename Base::pointer;
1244 using Base::operator=;
1248 using Base::release;
1253 using Base::get_deleter;
1254 using Base::operator bool;
1256 using Base::operator*;
1257 using Base::operator->;
1271template <
typename T,
typename D>
1273 using Base = std::unique_ptr<T[], D>;
1276 using typename Base::deleter_type;
1277 using typename Base::element_type;
1278 using typename Base::pointer;
1283 using Base::operator=;
1287 using Base::release;
1292 using Base::get_deleter;
1293 using Base::operator bool;
1295 using Base::operator[];
auto value() const &noexcept -> const_reference
auto value() &&noexcept -> element_type &&
auto value() &noexcept -> reference
heap_value2 & operator=(const heap_value2 &other)
auto value() const &&noexcept -> const element_type &&
heap_value2(const heap_value2 &other)
const element_type & const_reference
auto value() &&noexcept -> element_type &&
heap_value2 & operator=(const heap_value2 &other)
heap_value2(const heap_value2 &other)
auto value() &noexcept -> reference
auto value() const &noexcept -> const_reference
auto value() const &&noexcept -> const element_type &&
decltype(*std::declval< pointer >()) reference
const element_type & const_reference
heap_value(heap_value &&u) noexcept
auto value() const &noexcept -> const_reference
auto assign(in_place_agg_t, Args &&... args) -> void
auto reset() noexcept -> void
auto operator=(const T &val) &-> heap_value &
auto get() const &noexcept -> const_pointer
constexpr heap_value() noexcept
auto assign(fakestd::in_place_t, Args &&... args) -> void
auto value() &noexcept -> reference
auto operator=(T &&val) &-> heap_value &
auto assign(T &&val) &-> void
constexpr auto swap(heap_value &other) noexcept -> void
auto operator=(heap_value &&u) &noexcept -> heap_value &
auto value() &&noexcept -> T &&
auto operator*() &noexcept -> reference
auto operator*() const &noexcept -> const_reference
auto operator*() const &&noexcept -> const T &&
constexpr heap_value(std::nullptr_t) noexcept
auto operator->() const &noexcept -> const_pointer
auto assign(const T &val) &-> void
auto operator->() &noexcept -> pointer
auto value() const &&noexcept -> const T &&
const T & const_reference
heap_value(in_place_agg_t, Args &&... args)
heap_value(const heap_value &u)
auto get() &noexcept -> pointer
auto operator*() &&noexcept -> T &&
heap_value(fakestd::in_place_t, Args &&... args)
auto operator=(const heap_value &u) &-> heap_value &
typename filter_unsigned< N >::type filter_unsigned_t
constexpr auto ignore(Ts &&...) noexcept -> void
constexpr auto msb_possible() -> Num
typename filter_signed< N >::type filter_signed_t
constexpr auto do_invoke(Member mem, Pointer ptr) noexcept -> decltype(auto)
constexpr std::intmax_t max_val
constexpr auto swap_tuple_impl(T &a, T &b, std::index_sequence< Is... >) noexcept(noexcept(ignore(((void) swap(std::get< Is >(a), std::get< Is >(b)), 0)...))) -> void
constexpr auto msb(std::uintmax_t x) -> std::uintmax_t
constexpr bool is_swappable_v
auto not_fn(F &&f) -> detail::not_fn_t< F >
constexpr bool is_nothrow_swappable_with_v
typename invoke_result< F, ArgTypes... >::type invoke_result_t
typename make_void< Ts... >::type void_t
constexpr bool is_invocable_v
constexpr bool is_swappable_with_v
constexpr bool is_nothrow_swappable_v
constexpr bool is_nothrow_invocable_v
constexpr auto max_element(ForwardIt first, ForwardIt last, Compare comp) -> ForwardIt
constexpr bool is_invocable_r_v
constexpr bool is_nothrow_invocable_r_v
constexpr struct kblib::nums::max_t max
typename key_type_setlike< Container >::type key_type_setlike_t
constexpr auto size(const T(&)[N]) noexcept -> std::size_t
constexpr auto exchange(T &obj, U &&new_value) -> T
constexpr bool mapped_detected_v
constexpr auto to_signed(I x) -> std::make_signed_t< I >
Cast integral argument to corresponding signed type.
constexpr auto a(const std::initializer_list< T > &a) -> auto
Index an array literal without naming its type.
typename std::enable_if< B, T >::type enable_if_t
constexpr auto apply(F &&f, Arg &&arg) noexcept(noexcept(detail::apply_impl< F, Arg >::do_apply(std::forward< F >(f), std::forward< Arg >(arg), std::index_sequence< std::tuple_size< Arg >::value >{}))) -> decltype(auto)
std::integral_constant< decltype(T::value), T::value > metafunction_value_t
typename hash_detected< T >::type hash_detected_t
constexpr bool value_detected_v
auto get(punner< Types... > &p) noexcept -> decltype(auto)
constexpr auto invoke(F &&f, Args &&... args) noexcept(noexcept(detail::do_invoke(std::forward< F >(f), std::forward< Args >(args)...))) -> decltype(auto)
typename std::decay< T >::type decay_t
typename value_detected< T >::type value_detected_t
std::integral_constant< bool, v > bool_constant
constexpr bool key_detected_v
typename void_if< b >::type void_if_t
typename value_type_linear< Container >::type value_type_linear_t
typename key_detected< T >::type key_detected_t
constexpr auto signed_cast(F x) -> enable_if_t< std::is_integral< A >::value and std::is_integral< F >::value and std::is_signed< A >::value, std::make_signed_t< F > >
Cast argument to equivalently-sized type with the same signednessas the template parameter.
typename return_assert< V, T >::type return_assert_t
typename safe_signed< N >::type safe_signed_t
typename std::remove_reference< typename std::remove_cv< T >::type >::type remove_cvref_t
constexpr bool hash_detected_v
constexpr auto equal(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, BinaryPredicate p) -> bool
auto to_unique(owner< T * > p, D &&d) -> std::unique_ptr< T, D >
constexpr auto signed_promote(N x) noexcept -> safe_signed_t< N >
typename mapped_detected< T >::type mapped_detected_t
constexpr auto lexicographical_compare(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2) -> bool
constexpr struct kblib::in_place_agg_t in_place_agg
typename copy_const< C, V >::type copy_const_t
typename meta_type< Ts... >::type meta_type_t
constexpr auto to_unsigned(I x) -> std::make_unsigned_t< I >
Cast integral argument to corresponding unsigned type.
static constexpr auto do_apply(F &&f, Arg &&arg) noexcept(noexcept(kblib::invoke(std::forward< F >(f), std::get< Is >(std::forward< Arg >(arg))...))) -> decltype(auto)
constexpr auto operator()(U, U) noexcept -> bool
typename decltype(ints_map::template get_default< max_val< T >+1 >())::type type
typename std::tuple_element< N, std::tuple< Args... > >::type type
static constexpr auto get_default() noexcept -> auto
static constexpr auto get() noexcept -> auto
typename types::template type< I > element
typename std::conditional< not std::is_same< Result, detail::nat >::value, typename std::conditional< std::is_void< Ret >::value, std::true_type, std::is_convertible< Result, Ret > >::type, std::false_type >::type type
static auto try_call(int) -> decltype(kblib::invoke(std::declval< XFp >(), std::declval< XArgs >()...))
static auto try_call(...) -> detail::nat
decltype(try_call< Fp, Args... >(0)) Result
decltype(invoke(std::declval< F >(), std::declval< Args >()...)) type
nat & operator=(const nat &)=delete
constexpr auto operator()(Args &&... args) const &-> decltype(not std::declval< invoke_result_t< std::decay_t< F > const &, Args... > >())
constexpr not_fn_t(F &&f)
constexpr not_fn_t(not_fn_t &&)=default
constexpr auto operator()(Args &&... args) &-> decltype(not std::declval< invoke_result_t< std::decay_t< F > &, Args... > >())
constexpr not_fn_t(const not_fn_t &)=default
static void test_noexcept(Tp) noexcept
decltype((test_swap< Up, Tp >(0))) swap2
static decltype(swap(std::declval< LHS >(), std::declval< RHS >())) test_swap(int)
decltype((test_swap< Tp, Up >(0))) swap1
static nat test_swap(long)
typename T::key_type type
typename T::mapped_type type
Essentially just like std::enable_if, but with a different name that makes it clearer what it does in...
std::conditional_t< std::is_signed< N >::value, N, typename detail::next_larger_signed< std::make_signed_t< N > >::type > type
typename T::value_type type
Provides macros and basic templates used by the rest of kblib.
#define KBLIB_UNUSED
This internal macro is used to provide a fallback for [[maybe_unused]] in C++14.
#define KBLIB_NODISCARD
This internal macro is used to provide a fallback for [[nodiscard]] in C++14.