From 4937843f70c802020f024f11a96685b11a5de8f4 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Mon, 3 Jun 2024 09:09:33 -0700 Subject: [PATCH] Introduce Cosmopolitan Templates Library (CTL) --- Makefile | 5 + ctl/.clang-format | 12 + ctl/BUILD.mk | 48 + ctl/README.md | 4967 ++++++++++++++++++++++++++++++++++ ctl/optional.h | 125 + ctl/string.cc | 439 +++ ctl/string.h | 320 +++ ctl/vector.h | 242 ++ test/BUILD.mk | 3 +- test/ctl/.clang-format | 12 + test/ctl/BUILD.mk | 38 + test/ctl/optional_test.cc | 114 + test/ctl/string_test.cc | 371 +++ test/ctl/vector_test.cc | 320 +++ tool/emacs/cosmo-stuff.el | 16 +- tool/scripts/explain-deps.py | 34 +- 16 files changed, 7054 insertions(+), 12 deletions(-) create mode 100644 ctl/.clang-format create mode 100644 ctl/BUILD.mk create mode 100644 ctl/README.md create mode 100644 ctl/optional.h create mode 100644 ctl/string.cc create mode 100644 ctl/string.h create mode 100644 ctl/vector.h create mode 100644 test/ctl/.clang-format create mode 100644 test/ctl/BUILD.mk create mode 100644 test/ctl/optional_test.cc create mode 100644 test/ctl/string_test.cc create mode 100644 test/ctl/vector_test.cc diff --git a/Makefile b/Makefile index c81df7bac..692df3a00 100644 --- a/Makefile +++ b/Makefile @@ -174,6 +174,7 @@ all: o o: o/$(MODE) o/$(MODE): \ o/$(MODE)/ape \ + o/$(MODE)/ctl \ o/$(MODE)/dsp \ o/$(MODE)/net \ o/$(MODE)/libc \ @@ -255,6 +256,7 @@ include third_party/nsync/mem/BUILD.mk # │ You can now use stdio include libc/proc/BUILD.mk # │ You can now use threads include libc/dlopen/BUILD.mk # │ You can now use processes include libc/thread/BUILD.mk # │ You can finally call malloc() +include ctl/BUILD.mk # │ include third_party/zlib/BUILD.mk # │ include libc/stdio/BUILD.mk # │ include tool/hello/BUILD.mk # │ @@ -299,6 +301,7 @@ include tool/viz/lib/BUILD.mk include tool/args/BUILD.mk include test/math/BUILD.mk include test/posix/BUILD.mk +include test/ctl/BUILD.mk include test/libcxx/BUILD.mk include test/tool/args/BUILD.mk include third_party/linenoise/BUILD.mk @@ -451,6 +454,7 @@ COSMOPOLITAN_OBJECTS = \ LIBC_THREAD \ LIBC_PROC \ THIRD_PARTY_NSYNC_MEM \ + CTL \ LIBC_MEM \ THIRD_PARTY_DLMALLOC \ LIBC_DLOPEN \ @@ -519,6 +523,7 @@ COSMOPOLITAN_H_PKGS = \ COSMOCC_PKGS = \ $(COSMOPOLITAN_H_PKGS) \ + CTL \ THIRD_PARTY_AARCH64 \ THIRD_PARTY_LIBCXX \ THIRD_PARTY_LIBCXXABI \ diff --git a/ctl/.clang-format b/ctl/.clang-format new file mode 100644 index 000000000..9daf0a9e9 --- /dev/null +++ b/ctl/.clang-format @@ -0,0 +1,12 @@ +--- +BasedOnStyle: Mozilla +IndentWidth: 4 +ColumnLimit: 80 +--- +Language: Cpp +AllowShortFunctionsOnASingleLine: false +AlignTrailingComments: false +AlignEscapedNewlines: DontAlign +AlwaysBreakTemplateDeclarations: true +ConstructorInitializerAllOnOneLineOrOnePerLine: true +--- diff --git a/ctl/BUILD.mk b/ctl/BUILD.mk new file mode 100644 index 000000000..ac613db1e --- /dev/null +++ b/ctl/BUILD.mk @@ -0,0 +1,48 @@ +#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐ +#── vi: set noet ft=make ts=8 sw=8 fenc=utf-8 :vi ────────────────────┘ + +PKGS += CTL + +CTL_ARTIFACTS += CTL_A +CTL = $(CTL_A_DEPS) $(CTL_A) +CTL_A = o/$(MODE)/ctl/ctl.a +CTL_A_FILES := $(wildcard ctl/*) +CTL_A_HDRS = $(filter %.h,$(CTL_A_FILES)) +CTL_A_SRCS = $(filter %.cc,$(CTL_A_FILES)) +CTL_A_OBJS = $(CTL_A_SRCS:%.cc=o/$(MODE)/%.o) + +CTL_A_CHECKS = \ + $(CTL_A).pkg \ + $(CTL_A_HDRS:%=o/$(MODE)/%.okk) \ + +CTL_A_DIRECTDEPS = \ + LIBC_INTRIN \ + LIBC_MEM \ + LIBC_STR \ + +CTL_A_DEPS := $(call uniq,$(foreach x,$(CTL_A_DIRECTDEPS),$($(x)))) + +$(CTL_A): ctl/ \ + $(CTL_A).pkg \ + $(CTL_A_OBJS) + +$(CTL_A).pkg: \ + $(CTL_A_OBJS) \ + $(foreach x,$(CTL_A_DIRECTDEPS),$($(x)_A).pkg) + +$(CTL_A_OBJS): private \ + OVERRIDE_CXXFLAGS += \ + -Wframe-larger-than=4096 \ + -Walloca-larger-than=4096 \ + -ffunction-sections \ + -fdata-sections \ + +CTL_LIBS = $(foreach x,$(CTL_ARTIFACTS),$($(x))) +CTL_SRCS = $(foreach x,$(CTL_ARTIFACTS),$($(x)_SRCS)) +CTL_HDRS = $(foreach x,$(CTL_ARTIFACTS),$($(x)_HDRS)) +CTL_CHECKS = $(foreach x,$(CTL_ARTIFACTS),$($(x)_CHECKS)) +CTL_OBJS = $(foreach x,$(CTL_ARTIFACTS),$($(x)_OBJS)) +$(CTL_OBJS): $(BUILD_FILES) ctl/BUILD.mk + +.PHONY: o/$(MODE)/ctl +o/$(MODE)/ctl: $(CTL_CHECKS) diff --git a/ctl/README.md b/ctl/README.md new file mode 100644 index 000000000..27cb9d932 --- /dev/null +++ b/ctl/README.md @@ -0,0 +1,4967 @@ +# Cosmopolitan Template Library + +This package provides an STL alternative that's designed to: + +1. Compile 10x faster +2. Solve the GDB debugger pain +3. Symbol names should be simple +4. Method names should be the same as STL +5. Code belongs in .cpp files not in headers +6. Depend on STL headers that aren't slow, e.g. `std::move` +7. Use `stdckdint.h` and `__builtin_trap()` for better safety + +This code is experimental and mostly for Justine to save herself from +the STL trainwreck. That doesn't mean cosmocc users aren't welcome to +use tihs too. You shouldn't expect the design to not change later on. + +## Rationale + +The latency of the Standard Template Library (STL) has gotten out of +control. Below you'll find a table documenting the last ten years of +progress in the C++ language, measured on AMD Ryzen Threadripper PRO +7995WX, the most expensive CPU there is. + +``` +header gcc4.8 gcc4.9 gcc7.2 gcc11 gcc13 clang-19 +------ ------ ------ ------ ----- ----- -------- +chrono 22 23 30 43 519 516 +fstream 72 77 115 167 201 515 +syncstream - - - 7 199 484 +iostream 69 73 104 150 189 461 +strstream 69 72 102 153 190 459 +ostream 64 66 94 138 181 450 +random 100 194 115 211 264 416 +future 157 169 200 241 323 406 +thread 84 88 116 93 253 384 +print - - - - - 370 +functional 58 61 83 126 158 356 +filesystem - - - 279 315 350 +regex 231 299 235 359 320 347 +complex 79 83 117 209 271 342 +complex.h 80 83 121 214 278 341 +ctgmath 12 14 117 207 279 340 +tgmath.h 12 14 119 212 276 339 +format - - - - 364 339 +ccomplex 80 83 118 210 276 338 +queue 38 43 52 72 114 310 +sstream 70 74 104 151 193 298 +iomanip 71 75 133 188 218 297 +istream 68 70 101 146 187 296 +vector 32 34 40 54 102 294 +locale 69 75 113 164 198 276 +condition_variable 73 94 118 178 279 251 +streambuf 51 54 78 120 164 245 +ios 61 64 91 136 178 240 +memory_resource - - - 177 134 223 +mutex 73 77 98 148 94 220 +codecvt - - 76 112 158 208 +algorithm 124 202 42 128 104 200 +shared_mutex - - 122 141 54 198 +bitset 49 52 70 109 147 180 +system_error 48 52 71 113 152 171 +ranges - - - 8 230 170 +string 45 48 66 104 144 168 +unordered_map 62 68 97 89 109 148 +unordered_set 64 68 96 84 107 145 +numeric 11 13 15 28 39 138 +stack 28 31 37 50 93 123 +valarray 147 224 71 211 194 120 +deque 27 30 35 48 93 120 +map 59 62 86 70 93 119 +set 27 32 40 57 92 113 +string_view - - - 48 73 112 +memory 71 75 94 94 228 111 +iterator 68 71 101 121 164 94 +list 22 25 32 45 80 87 +barrier - - - 7 207 86 +mdspan - - - - - 85 +forward_list 73 29 34 45 82 84 +stop_token - - - 7 251 80 +array 47 50 68 35 48 73 +stdatomic.h - - - - 52 69 +atomic 16 17 24 33 51 69 +charconv - - - 34 32 68 +variant - - - 39 43 66 +semaphore - - - 7 76 61 +scoped_allocator 55 56 79 48 68 59 +any - - - 27 24 59 +optional - - - 33 40 58 +latch - - - 7 41 58 +span - - - 7 64 53 +coroutine - - - - 25 51 +tuple 50 53 76 44 63 47 +cmath 13 14 15 79 111 46 +math.h 8 9 14 80 112 44 +utility 12 13 16 21 29 43 +typeindex 8 9 8 10 24 35 +expected - - - - 32 33 +compare - - - 7 24 33 +type_traits 11 12 13 17 18 27 +exception 8 9 17 22 21 24 +concepts - - - 7 19 24 +bit - - - 21 21 21 +new 8 9 16 9 9 18 +cwchar 7 8 7 9 11 18 +typeinfo 8 9 8 9 10 17 +signal.h 7 8 8 9 13 17 +limits 11 12 12 18 15 17 +csignal 8 9 8 10 13 17 +stdlib.h 7 8 8 10 13 16 +ratio 13 14 16 20 20 16 +cstdlib 7 8 7 10 13 16 +threads.h 7 8 8 8 10 15 +stdexcept 47 49 66 108 147 15 +numbers - - - 7 19 15 +initializer_list 7 8 7 9 9 15 +cstdio 7 8 8 9 11 15 +cstddef 7 8 7 9 9 15 +wchar.h 7 8 7 8 10 14 +time.h 7 8 7 8 10 14 +string.h 7 8 7 8 9 14 +stdio.h 7 8 7 8 10 14 +source_location - - - 7 9 14 +iosfwd 8 9 9 10 11 14 +cwctype 7 8 7 9 10 14 +ctype.h 7 8 7 7 9 14 +ctime 8 8 8 9 10 14 +cstring 7 8 7 9 10 14 +cctype 7 8 7 9 10 14 +wctype.h 7 8 7 7 9 13 +uchar.h 6 8 7 7 9 13 +stdint.h 7 7 7 8 9 13 +stddef.h 6 7 7 7 7 13 +locale.h 7 8 7 8 9 13 +inttypes.h 7 8 7 8 9 13 +fenv.h 7 8 7 9 9 13 +execution - - - 282 377 13 +errno.h 7 7 7 7 8 13 +cuchar - - 8 10 11 13 +csetjmp 7 8 7 9 9 13 +climits 6 7 7 9 9 13 +ciso646 6 7 7 8 9 13 +cfenv 7 8 7 9 9 13 +cerrno 7 8 7 9 9 13 +cassert 7 8 7 8 9 13 +assert.h 7 7 7 7 8 13 +version - - - 9 8 12 +stdbool.h 7 7 7 7 7 12 +stdarg.h 6 7 7 7 7 12 +stdalign.h 7 7 7 7 8 12 +limits.h 6 8 7 7 9 12 +float.h 6 7 7 7 7 12 +cstdint 7 8 7 9 9 12 +cstdbool 7 8 7 8 8 12 +clocale 7 7 7 9 9 12 +cinttypes 7 8 7 9 10 12 +cfloat 6 7 7 8 9 12 +stdnoreturn.h 6 7 6 7 7 11 +setjmp.h 7 8 7 7 9 11 +iso646.h 6 7 7 7 7 11 +cstdarg 7 8 7 9 8 11 +text_encoding - - - - - - +stdfloat - - - - 9 - +stacktrace - - - - 217 - +spanstream - - - - 193 - +rcu - - - - - - +linalg - - - - - - +hazard_pointer - - - - - - +generator - - - - - - +flat_set - - - - - - +flat_map - - - - - - +debugging - - - - - - +cstdatomic - - - - - - +cstdalign 7 8 7 8 9 - +``` + +But wait, it gets better! Let's look at the transitive includes of +`#include ` with modern LLVM libcxx in the cosmo repo, by +running the following command: + +``` +tool/scripts/explain-deps.py string +``` + +There's four thousand of them which the compiler needs to consider. It's +totally bonkers. Most Cosmopolitan headers are designed to not include a +single other header, e.g. calls.h, thread.h, runtime.h, etc. So the goal +here is to bring that tradition to the C++ language too. For example our +`#include ` header, literally does not have a single `#include`. +Please note to include our one you should use `#include `. + +``` +string + compare + __assert + __config + __config_site + features.h + features.h + sys/endian.h + osreldate.h + sys/endian.h + endian.h + libc/intrin/newbie.h + libc/intrin/bswap.h + libc/sysv/consts/endian.h + __verbose_abort + __availability + __config + __config + __compare/common_comparison_category.h + __compare/ordering.h + __config + __type_traits/enable_if.h + __config + __type_traits/is_same.h + __config + __type_traits/integral_constant.h + __config + __config + __type_traits/is_same.h + cstddef + __assert + __config + __type_traits/enable_if.h + __type_traits/integral_constant.h + __type_traits/is_integral.h + __config + __type_traits/integral_constant.h + __type_traits/remove_cv.h + __config + __type_traits/remove_const.h + __config + __type_traits/remove_volatile.h + __config + version + __assert + __config + stddef.h + __config + stddef.h + stddef.h + __compare/compare_partial_order_fallback.h + __compare/ordering.h + __compare/partial_order.h + __compare/compare_three_way.h + __compare/three_way_comparable.h + __compare/common_comparison_category.h + __compare/ordering.h + __concepts/common_reference_with.h + __concepts/convertible_to.h + __config + __type_traits/is_convertible.h + __config + __type_traits/integral_constant.h + __type_traits/is_array.h + __config + __type_traits/integral_constant.h + cstddef + __type_traits/is_function.h + __config + __type_traits/integral_constant.h + __type_traits/is_const.h + __config + __type_traits/integral_constant.h + __type_traits/is_reference.h + __config + __type_traits/integral_constant.h + __type_traits/is_void.h + __config + __type_traits/integral_constant.h + __type_traits/is_same.h + __type_traits/remove_cv.h + __type_traits/remove_reference.h + __config + cstddef + __utility/declval.h + __config + cstddef + __utility/declval.h + __concepts/same_as.h + __config + __type_traits/is_same.h + __config + __type_traits/common_reference.h + __config + __type_traits/common_type.h + __config + __type_traits/conditional.h + __config + __type_traits/decay.h + __config + __type_traits/add_pointer.h + __config + __type_traits/is_referenceable.h + __config + __type_traits/integral_constant.h + __type_traits/is_same.h + __type_traits/is_same.h + __type_traits/is_void.h + __type_traits/remove_cv.h + __type_traits/remove_reference.h + __type_traits/conditional.h + __type_traits/is_array.h + __type_traits/is_function.h + __type_traits/is_referenceable.h + __type_traits/remove_cv.h + __type_traits/remove_extent.h + __config + cstddef + __type_traits/remove_reference.h + __type_traits/is_same.h + __type_traits/remove_cvref.h + __config + __type_traits/is_same.h + __type_traits/remove_cv.h + __type_traits/remove_reference.h + __type_traits/void_t.h + __config + __utility/declval.h + __type_traits/copy_cv.h + __config + __type_traits/add_const.h + __config + __type_traits/add_cv.h + __config + __type_traits/add_volatile.h + __config + __type_traits/copy_cvref.h + __config + __type_traits/add_lvalue_reference.h + __config + __type_traits/is_referenceable.h + __type_traits/add_rvalue_reference.h + __config + __type_traits/is_referenceable.h + __type_traits/copy_cv.h + __type_traits/is_convertible.h + __type_traits/is_reference.h + __type_traits/remove_cv.h + __type_traits/remove_cvref.h + __type_traits/remove_reference.h + __utility/declval.h + __concepts/equality_comparable.h + __concepts/boolean_testable.h + __concepts/convertible_to.h + __config + __utility/forward.h + __config + __type_traits/is_reference.h + __type_traits/remove_reference.h + __concepts/common_reference_with.h + __config + __type_traits/common_reference.h + __type_traits/make_const_lvalue_ref.h + __config + __type_traits/remove_reference.h + __concepts/same_as.h + __concepts/totally_ordered.h + __concepts/boolean_testable.h + __concepts/equality_comparable.h + __config + __type_traits/common_reference.h + __type_traits/make_const_lvalue_ref.h + __config + __type_traits/common_reference.h + __type_traits/make_const_lvalue_ref.h + __config + __utility/forward.h + __compare/ordering.h + __compare/weak_order.h + __compare/compare_three_way.h + __compare/ordering.h + __compare/strong_order.h + __bit/bit_cast.h + __config + __type_traits/is_trivially_copyable.h + __config + __type_traits/integral_constant.h + cstdint + __assert + __config + stdint.h + __config + stdint.h + __compare/compare_three_way.h + __compare/ordering.h + __config + __type_traits/conditional.h + __type_traits/decay.h + __utility/forward.h + __utility/priority_tag.h + __config + cstddef + cmath + __assert + __config + __type_traits/enable_if.h + __type_traits/is_arithmetic.h + __config + __type_traits/integral_constant.h + __type_traits/is_floating_point.h + __config + __type_traits/integral_constant.h + __type_traits/remove_cv.h + __type_traits/is_integral.h + __type_traits/is_constant_evaluated.h + __config + __type_traits/is_floating_point.h + __type_traits/is_same.h + __type_traits/promote.h + __config + __type_traits/integral_constant.h + __type_traits/is_same.h + __utility/declval.h + __type_traits/remove_cv.h + version + math.h + __config + __type_traits/enable_if.h + __type_traits/is_floating_point.h + __type_traits/is_integral.h + __type_traits/is_same.h + __type_traits/promote.h + limits + __assert + __config + __type_traits/is_arithmetic.h + __type_traits/is_signed.h + __config + __type_traits/integral_constant.h + __type_traits/is_arithmetic.h + __type_traits/is_integral.h + __type_traits/remove_cv.h + __undef_macros + version + type_traits + __assert + __config + __fwd/hash.h + __config + __type_traits/add_const.h + __type_traits/add_cv.h + __type_traits/add_lvalue_reference.h + __type_traits/add_pointer.h + __type_traits/add_rvalue_reference.h + __type_traits/add_volatile.h + __type_traits/aligned_storage.h + __config + __type_traits/conditional.h + __type_traits/integral_constant.h + __type_traits/nat.h + __config + __type_traits/type_list.h + __config + cstddef + cstddef + __type_traits/aligned_union.h + __config + __type_traits/aligned_storage.h + __type_traits/integral_constant.h + cstddef + __type_traits/alignment_of.h + __config + __type_traits/integral_constant.h + cstddef + __type_traits/apply_cv.h + __config + __type_traits/is_const.h + __type_traits/is_volatile.h + __config + __type_traits/integral_constant.h + __type_traits/remove_reference.h + __type_traits/can_extract_key.h + __config + __fwd/pair.h + __config + __type_traits/conditional.h + __type_traits/integral_constant.h + __type_traits/is_same.h + __type_traits/remove_const.h + __type_traits/remove_const_ref.h + __config + __type_traits/remove_const.h + __type_traits/remove_reference.h + __type_traits/common_reference.h + __type_traits/common_type.h + __type_traits/conditional.h + __type_traits/conjunction.h + __config + __type_traits/conditional.h + __type_traits/enable_if.h + __type_traits/integral_constant.h + __type_traits/decay.h + __type_traits/dependent_type.h + __config + __type_traits/disjunction.h + __config + __type_traits/integral_constant.h + __type_traits/enable_if.h + __type_traits/extent.h + __config + __type_traits/integral_constant.h + cstddef + __type_traits/has_unique_object_representation.h + __config + __type_traits/integral_constant.h + __type_traits/remove_all_extents.h + __config + cstddef + __type_traits/remove_cv.h + __type_traits/has_virtual_destructor.h + __config + __type_traits/integral_constant.h + __type_traits/integral_constant.h + __type_traits/invoke.h + __config + __type_traits/add_lvalue_reference.h + __type_traits/apply_cv.h + __type_traits/conditional.h + __type_traits/decay.h + __type_traits/enable_if.h + __type_traits/integral_constant.h + __type_traits/is_base_of.h + __config + __type_traits/integral_constant.h + __type_traits/is_core_convertible.h + __config + __type_traits/integral_constant.h + __type_traits/is_member_function_pointer.h + __config + __type_traits/integral_constant.h + __type_traits/is_function.h + __type_traits/remove_cv.h + cstddef + __type_traits/is_member_object_pointer.h + __config + __type_traits/remove_cv.h + __type_traits/is_member_function_pointer.h + __type_traits/integral_constant.h + __type_traits/is_reference_wrapper.h + __config + __type_traits/integral_constant.h + __type_traits/remove_cv.h + __type_traits/is_same.h + __type_traits/is_void.h + __type_traits/nat.h + __type_traits/remove_cv.h + __utility/declval.h + __utility/forward.h + __type_traits/is_abstract.h + __config + __type_traits/integral_constant.h + __type_traits/is_aggregate.h + __config + __type_traits/integral_constant.h + __type_traits/is_arithmetic.h + __type_traits/is_array.h + __type_traits/is_assignable.h + __config + __type_traits/integral_constant.h + __type_traits/is_base_of.h + __type_traits/is_bounded_array.h + __config + __type_traits/integral_constant.h + cstddef + __type_traits/is_callable.h + __config + __type_traits/integral_constant.h + __utility/declval.h + __type_traits/is_char_like_type.h + __config + __type_traits/conjunction.h + __type_traits/is_standard_layout.h + __config + __type_traits/integral_constant.h + __type_traits/is_trivial.h + __config + __type_traits/integral_constant.h + __type_traits/is_class.h + __config + __type_traits/integral_constant.h + __type_traits/is_compound.h + __config + __type_traits/integral_constant.h + __type_traits/is_fundamental.h + __config + __type_traits/integral_constant.h + __type_traits/is_null_pointer.h + __config + __type_traits/integral_constant.h + __type_traits/remove_cv.h + cstddef + __type_traits/is_void.h + __type_traits/is_arithmetic.h + __type_traits/is_const.h + __type_traits/is_constant_evaluated.h + __type_traits/is_constructible.h + __config + __type_traits/integral_constant.h + __type_traits/is_convertible.h + __type_traits/is_copy_assignable.h + __config + __type_traits/add_const.h + __type_traits/add_lvalue_reference.h + __type_traits/integral_constant.h + __type_traits/is_copy_constructible.h + __config + __type_traits/add_const.h + __type_traits/add_lvalue_reference.h + __type_traits/integral_constant.h + __type_traits/is_default_constructible.h + __config + __type_traits/integral_constant.h + __type_traits/is_destructible.h + __config + __type_traits/integral_constant.h + __type_traits/is_function.h + __type_traits/is_reference.h + __type_traits/remove_all_extents.h + __utility/declval.h + __type_traits/is_empty.h + __config + __type_traits/integral_constant.h + __type_traits/is_enum.h + __config + __type_traits/integral_constant.h + __type_traits/is_final.h + __config + __type_traits/integral_constant.h + __type_traits/is_floating_point.h + __type_traits/is_function.h + __type_traits/is_fundamental.h + __type_traits/is_implicitly_default_constructible.h + __config + __type_traits/integral_constant.h + __type_traits/is_default_constructible.h + __type_traits/is_integral.h + __type_traits/is_literal_type.h + __config + __type_traits/integral_constant.h + __type_traits/is_member_function_pointer.h + __type_traits/is_member_object_pointer.h + __type_traits/is_member_pointer.h + __config + __type_traits/integral_constant.h + __type_traits/is_member_function_pointer.h + __type_traits/is_move_assignable.h + __config + __type_traits/add_lvalue_reference.h + __type_traits/add_rvalue_reference.h + __type_traits/integral_constant.h + __type_traits/is_move_constructible.h + __config + __type_traits/add_rvalue_reference.h + __type_traits/integral_constant.h + __type_traits/is_nothrow_assignable.h + __config + __type_traits/integral_constant.h + __type_traits/is_nothrow_constructible.h + __config + __type_traits/integral_constant.h + __type_traits/is_constructible.h + __type_traits/is_reference.h + __utility/declval.h + cstddef + __type_traits/is_nothrow_convertible.h + __config + __type_traits/conjunction.h + __type_traits/disjunction.h + __type_traits/integral_constant.h + __type_traits/is_convertible.h + __type_traits/is_void.h + __type_traits/lazy.h + __config + __utility/declval.h + __type_traits/is_nothrow_copy_assignable.h + __config + __type_traits/add_const.h + __type_traits/add_lvalue_reference.h + __type_traits/integral_constant.h + __type_traits/is_nothrow_copy_constructible.h + __config + __type_traits/add_const.h + __type_traits/add_lvalue_reference.h + __type_traits/integral_constant.h + __type_traits/is_nothrow_constructible.h + __type_traits/is_nothrow_default_constructible.h + __config + __type_traits/integral_constant.h + __type_traits/is_nothrow_destructible.h + __config + __type_traits/integral_constant.h + __type_traits/is_destructible.h + __type_traits/is_reference.h + __type_traits/is_scalar.h + __config + __type_traits/integral_constant.h + __type_traits/is_arithmetic.h + __type_traits/is_enum.h + __type_traits/is_member_pointer.h + __type_traits/is_null_pointer.h + __type_traits/is_pointer.h + __config + __type_traits/integral_constant.h + __type_traits/remove_cv.h + __type_traits/remove_all_extents.h + __utility/declval.h + cstddef + __type_traits/is_nothrow_move_assignable.h + __config + __type_traits/add_lvalue_reference.h + __type_traits/add_rvalue_reference.h + __type_traits/integral_constant.h + __type_traits/is_nothrow_move_constructible.h + __config + __type_traits/add_rvalue_reference.h + __type_traits/integral_constant.h + __type_traits/is_nothrow_constructible.h + __type_traits/is_null_pointer.h + __type_traits/is_object.h + __config + __type_traits/integral_constant.h + __type_traits/is_array.h + __type_traits/is_class.h + __type_traits/is_scalar.h + __type_traits/is_union.h + __config + __type_traits/integral_constant.h + __type_traits/is_pod.h + __config + __type_traits/integral_constant.h + __type_traits/is_pointer.h + __type_traits/is_polymorphic.h + __config + __type_traits/integral_constant.h + __type_traits/is_reference.h + __type_traits/is_reference_wrapper.h + __type_traits/is_referenceable.h + __type_traits/is_same.h + __type_traits/is_scalar.h + __type_traits/is_scoped_enum.h + __config + __type_traits/integral_constant.h + __type_traits/is_convertible.h + __type_traits/is_enum.h + __type_traits/underlying_type.h + __config + __type_traits/is_enum.h + __type_traits/is_signed.h + __type_traits/is_specialization.h + __config + __type_traits/is_standard_layout.h + __type_traits/is_swappable.h + __config + __type_traits/add_lvalue_reference.h + __type_traits/conditional.h + __type_traits/enable_if.h + __type_traits/is_move_assignable.h + __type_traits/is_move_constructible.h + __type_traits/is_nothrow_move_assignable.h + __type_traits/is_nothrow_move_constructible.h + __type_traits/is_referenceable.h + __type_traits/is_same.h + __type_traits/is_void.h + __type_traits/nat.h + __utility/declval.h + cstddef + __type_traits/is_trivial.h + __type_traits/is_trivially_assignable.h + __config + __type_traits/integral_constant.h + __type_traits/is_trivially_constructible.h + __config + __type_traits/integral_constant.h + __type_traits/is_trivially_copy_assignable.h + __config + __type_traits/add_const.h + __type_traits/add_lvalue_reference.h + __type_traits/integral_constant.h + __type_traits/is_trivially_copy_constructible.h + __config + __type_traits/add_lvalue_reference.h + __type_traits/integral_constant.h + __type_traits/is_trivially_copyable.h + __type_traits/is_trivially_default_constructible.h + __config + __type_traits/integral_constant.h + __type_traits/is_trivially_destructible.h + __config + __type_traits/integral_constant.h + __type_traits/is_destructible.h + __type_traits/is_trivially_move_assignable.h + __config + __type_traits/add_lvalue_reference.h + __type_traits/add_rvalue_reference.h + __type_traits/integral_constant.h + __type_traits/is_trivially_move_constructible.h + __config + __type_traits/add_rvalue_reference.h + __type_traits/integral_constant.h + __type_traits/is_unbounded_array.h + __config + __type_traits/integral_constant.h + __type_traits/is_union.h + __type_traits/is_unsigned.h + __config + __type_traits/integral_constant.h + __type_traits/is_arithmetic.h + __type_traits/is_integral.h + __type_traits/is_void.h + __type_traits/is_volatile.h + __type_traits/make_const_lvalue_ref.h + __type_traits/make_signed.h + __config + __type_traits/apply_cv.h + __type_traits/is_enum.h + __type_traits/is_integral.h + __type_traits/nat.h + __type_traits/remove_cv.h + __type_traits/type_list.h + __type_traits/make_unsigned.h + __config + __type_traits/apply_cv.h + __type_traits/conditional.h + __type_traits/is_enum.h + __type_traits/is_integral.h + __type_traits/is_unsigned.h + __type_traits/nat.h + __type_traits/remove_cv.h + __type_traits/type_list.h + __type_traits/maybe_const.h + __config + __type_traits/conditional.h + __type_traits/negation.h + __config + __type_traits/integral_constant.h + __type_traits/rank.h + __config + __type_traits/integral_constant.h + cstddef + __type_traits/remove_all_extents.h + __type_traits/remove_const.h + __type_traits/remove_const_ref.h + __type_traits/remove_cv.h + __type_traits/remove_extent.h + __type_traits/remove_pointer.h + __config + __type_traits/remove_reference.h + __type_traits/remove_volatile.h + __type_traits/result_of.h + __config + __functional/invoke.h + __config + __type_traits/invoke.h + __utility/forward.h + __type_traits/type_identity.h + __config + __type_traits/underlying_type.h + __type_traits/unwrap_ref.h + __config + __type_traits/decay.h + __type_traits/void_t.h + __utility/declval.h + cstddef + cstdint + version + stdlib.h + __config + stdlib.h + stdlib.h + math.h + math.h + math.h + __undef_macros + type_traits + cstdint + limits + __undef_macros + __config + __type_traits/decay.h + __utility/forward.h + __utility/priority_tag.h + cmath + __config + __type_traits/decay.h + __type_traits/is_same.h + __utility/forward.h + __utility/priority_tag.h + __config + __type_traits/decay.h + __type_traits/is_same.h + __utility/forward.h + __utility/priority_tag.h + __compare/compare_strong_order_fallback.h + __compare/ordering.h + __compare/strong_order.h + __config + __type_traits/decay.h + __type_traits/is_same.h + __utility/forward.h + __utility/priority_tag.h + __compare/compare_three_way.h + __compare/compare_three_way_result.h + __config + __type_traits/make_const_lvalue_ref.h + __utility/declval.h + __compare/compare_weak_order_fallback.h + __compare/ordering.h + __compare/weak_order.h + __config + __type_traits/decay.h + __type_traits/is_same.h + __utility/forward.h + __utility/priority_tag.h + __compare/is_eq.h + __compare/ordering.h + __config + __compare/ordering.h + __compare/partial_order.h + __compare/strong_order.h + __compare/synth_three_way.h + __compare/ordering.h + __compare/three_way_comparable.h + __concepts/boolean_testable.h + __config + __utility/declval.h + __compare/three_way_comparable.h + __compare/weak_order.h + __config + version + type_traits + initializer_list + __assert + __config + cstddef + __algorithm/max.h + __algorithm/comp.h + __config + __type_traits/integral_constant.h + __type_traits/predicate_traits.h + __config + __type_traits/integral_constant.h + __algorithm/comp_ref_type.h + __config + __debug + __assert + __config + __type_traits/is_constant_evaluated.h + cstddef + __utility/declval.h + __algorithm/max_element.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __config + __iterator/iterator_traits.h + __concepts/arithmetic.h + __config + __type_traits/is_floating_point.h + __type_traits/is_integral.h + __type_traits/is_signed.h + __type_traits/is_signed_integer.h + __config + __type_traits/integral_constant.h + __type_traits/is_unsigned_integer.h + __config + __type_traits/integral_constant.h + __concepts/constructible.h + __concepts/convertible_to.h + __concepts/destructible.h + __config + __type_traits/is_nothrow_destructible.h + __config + __type_traits/is_constructible.h + __concepts/convertible_to.h + __concepts/copyable.h + __concepts/assignable.h + __concepts/common_reference_with.h + __concepts/same_as.h + __config + __type_traits/is_reference.h + __type_traits/make_const_lvalue_ref.h + __utility/forward.h + __concepts/constructible.h + __concepts/movable.h + __concepts/assignable.h + __concepts/constructible.h + __concepts/swappable.h + __concepts/assignable.h + __concepts/class_or_enum.h + __config + __type_traits/is_class.h + __type_traits/is_enum.h + __type_traits/is_union.h + __type_traits/remove_cvref.h + __concepts/common_reference_with.h + __concepts/constructible.h + __config + __type_traits/extent.h + __type_traits/is_nothrow_move_assignable.h + __type_traits/is_nothrow_move_constructible.h + __type_traits/remove_cvref.h + __utility/exchange.h + __config + __type_traits/is_nothrow_assignable.h + __type_traits/is_nothrow_move_constructible.h + __utility/forward.h + __utility/move.h + __config + __type_traits/conditional.h + __type_traits/is_copy_constructible.h + __type_traits/is_nothrow_move_constructible.h + __type_traits/remove_reference.h + __utility/forward.h + __utility/move.h + __utility/swap.h + __config + __type_traits/is_move_assignable.h + __type_traits/is_move_constructible.h + __type_traits/is_nothrow_move_assignable.h + __type_traits/is_nothrow_move_constructible.h + __type_traits/is_swappable.h + __utility/declval.h + __utility/move.h + cstddef + cstddef + __config + __type_traits/is_object.h + __config + __concepts/equality_comparable.h + __concepts/same_as.h + __concepts/totally_ordered.h + __config + __fwd/pair.h + __iterator/incrementable_traits.h + __concepts/arithmetic.h + __config + __type_traits/conditional.h + __type_traits/is_object.h + __type_traits/is_primary_template.h + __config + __type_traits/enable_if.h + __type_traits/is_same.h + __type_traits/is_valid_expansion.h + __config + __type_traits/integral_constant.h + __type_traits/make_signed.h + __type_traits/remove_cvref.h + __utility/declval.h + cstddef + __iterator/readable_traits.h + __concepts/same_as.h + __config + __type_traits/conditional.h + __type_traits/is_array.h + __type_traits/is_object.h + __type_traits/is_primary_template.h + __type_traits/remove_cv.h + __type_traits/remove_cvref.h + __type_traits/remove_extent.h + __type_traits/add_const.h + __type_traits/common_reference.h + __type_traits/conditional.h + __type_traits/disjunction.h + __type_traits/is_convertible.h + __type_traits/is_object.h + __type_traits/is_primary_template.h + __type_traits/is_reference.h + __type_traits/is_valid_expansion.h + __type_traits/remove_const.h + __type_traits/remove_cv.h + __type_traits/remove_cvref.h + __type_traits/void_t.h + __utility/declval.h + cstddef + __config + initializer_list + __undef_macros + __algorithm/min.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __algorithm/min_element.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __config + __functional/identity.h + __config + __type_traits/integral_constant.h + __utility/forward.h + __functional/invoke.h + __iterator/iterator_traits.h + __type_traits/is_callable.h + __utility/move.h + __config + initializer_list + __undef_macros + __algorithm/remove.h + __algorithm/find.h + __algorithm/unwrap_iter.h + __config + __iterator/iterator_traits.h + __memory/pointer_traits.h + __config + __memory/addressof.h + __config + __type_traits/conditional.h + __type_traits/conjunction.h + __type_traits/decay.h + __type_traits/is_class.h + __type_traits/is_function.h + __type_traits/is_void.h + __type_traits/void_t.h + __utility/declval.h + cstddef + __type_traits/enable_if.h + __type_traits/is_copy_constructible.h + __utility/declval.h + __utility/move.h + __config + __functional/identity.h + __functional/invoke.h + __string/constexpr_c_functions.h + __config + __type_traits/is_constant_evaluated.h + __type_traits/is_equality_comparable.h + __config + __type_traits/integral_constant.h + __type_traits/is_integral.h + __type_traits/is_same.h + __type_traits/is_void.h + __type_traits/remove_cv.h + __type_traits/remove_cvref.h + __type_traits/void_t.h + __utility/declval.h + __type_traits/is_same.h + __type_traits/is_trivially_lexicographically_comparable.h + __config + __type_traits/integral_constant.h + __type_traits/is_same.h + __type_traits/is_unsigned.h + __type_traits/remove_cv.h + __type_traits/void_t.h + __utility/declval.h + __type_traits/remove_cv.h + cstddef + __type_traits/is_same.h + cwchar + __assert + __config + __type_traits/apply_cv.h + __type_traits/is_constant_evaluated.h + __type_traits/is_equality_comparable.h + __type_traits/is_same.h + __type_traits/remove_cv.h + cwctype + __assert + __config + cctype + __assert + __config + ctype.h + __config + ctype.h + wctype.h + __config + wctype.h + wchar.h + __config + stddef.h + __mbstate_t.h + __config + bits/alltypes.h + bits/types/mbstate_t.h + sys/_types/_mbstate_t.h + wchar.h + uchar.h + __config + __mbstate_t.h + stddef.h + uchar.h + wchar.h + wchar.h + __algorithm/find_if.h + __config + __config + __utility/move.h + __algorithm/remove_if.h + __algorithm/find_if.h + __config + __utility/move.h + __assert + __config + __debug + __format/enable_insertable.h + __config + __functional/hash.h + __config + __functional/invoke.h + __functional/unary_function.h + __config + __fwd/hash.h + __tuple/sfinae_helpers.h + __config + __fwd/tuple.h + __config + __tuple/make_tuple_types.h + __config + __fwd/array.h + __config + cstddef + __fwd/tuple.h + __tuple/tuple_element.h + __config + __tuple/tuple_indices.h + __config + __utility/integer_sequence.h + __config + __type_traits/is_integral.h + cstddef + cstddef + __tuple/tuple_types.h + __config + __type_traits/add_const.h + __type_traits/add_cv.h + __type_traits/add_volatile.h + cstddef + __tuple/tuple_indices.h + __tuple/tuple_size.h + __config + __fwd/tuple.h + __tuple/tuple_types.h + __type_traits/is_const.h + __type_traits/is_volatile.h + cstddef + __tuple/tuple_types.h + __type_traits/apply_cv.h + __type_traits/remove_cv.h + __type_traits/remove_reference.h + cstddef + __tuple/tuple_element.h + __tuple/tuple_like_ext.h + __config + __fwd/array.h + __fwd/pair.h + __fwd/tuple.h + __tuple/tuple_types.h + __type_traits/integral_constant.h + cstddef + __tuple/tuple_size.h + __tuple/tuple_types.h + __type_traits/enable_if.h + __type_traits/integral_constant.h + __type_traits/is_assignable.h + __type_traits/is_constructible.h + __type_traits/is_convertible.h + __type_traits/is_same.h + __type_traits/remove_cvref.h + __type_traits/remove_reference.h + cstddef + __type_traits/is_copy_constructible.h + __type_traits/is_default_constructible.h + __type_traits/is_enum.h + __type_traits/is_move_constructible.h + __type_traits/underlying_type.h + __utility/forward.h + __utility/move.h + __utility/pair.h + __compare/common_comparison_category.h + __compare/synth_three_way.h + __concepts/different_from.h + __concepts/same_as.h + __config + __type_traits/remove_cvref.h + __config + __fwd/array.h + __fwd/get.h + __concepts/copyable.h + __config + __fwd/array.h + __fwd/pair.h + __fwd/subrange.h + __config + __iterator/concepts.h + __concepts/arithmetic.h + __concepts/assignable.h + __concepts/common_reference_with.h + __concepts/constructible.h + __concepts/copyable.h + __concepts/derived_from.h + __config + __type_traits/is_base_of.h + __type_traits/is_convertible.h + __concepts/equality_comparable.h + __concepts/invocable.h + __config + __functional/invoke.h + __utility/forward.h + __concepts/movable.h + __concepts/predicate.h + __concepts/boolean_testable.h + __concepts/invocable.h + __config + __functional/invoke.h + __concepts/regular.h + __concepts/equality_comparable.h + __concepts/semiregular.h + __concepts/constructible.h + __concepts/copyable.h + __config + __config + __concepts/relation.h + __concepts/predicate.h + __config + __concepts/same_as.h + __concepts/semiregular.h + __concepts/totally_ordered.h + __config + __functional/invoke.h + __iterator/incrementable_traits.h + __iterator/iter_move.h + __concepts/class_or_enum.h + __config + __iterator/iterator_traits.h + __type_traits/is_reference.h + __type_traits/remove_cvref.h + __utility/declval.h + __utility/forward.h + __utility/move.h + __iterator/iterator_traits.h + __iterator/readable_traits.h + __memory/pointer_traits.h + __type_traits/add_pointer.h + __type_traits/common_reference.h + __type_traits/is_pointer.h + __type_traits/is_reference.h + __type_traits/remove_cv.h + __type_traits/remove_cvref.h + __utility/forward.h + __fwd/tuple.h + __tuple/tuple_element.h + cstddef + __fwd/subrange.h + __fwd/tuple.h + __tuple/pair_like.h + __config + __tuple/tuple_like.h + __config + __fwd/array.h + __fwd/pair.h + __fwd/subrange.h + __fwd/tuple.h + __type_traits/integral_constant.h + __type_traits/remove_cvref.h + cstddef + __tuple/tuple_size.h + __type_traits/remove_cvref.h + __tuple/sfinae_helpers.h + __tuple/tuple_element.h + __tuple/tuple_indices.h + __tuple/tuple_size.h + __type_traits/common_reference.h + __type_traits/common_type.h + __type_traits/conditional.h + __type_traits/decay.h + __type_traits/integral_constant.h + __type_traits/is_assignable.h + __type_traits/is_constructible.h + __type_traits/is_convertible.h + __type_traits/is_copy_assignable.h + __type_traits/is_default_constructible.h + __type_traits/is_implicitly_default_constructible.h + __type_traits/is_move_assignable.h + __type_traits/is_nothrow_assignable.h + __type_traits/is_nothrow_constructible.h + __type_traits/is_nothrow_copy_assignable.h + __type_traits/is_nothrow_copy_constructible.h + __type_traits/is_nothrow_default_constructible.h + __type_traits/is_nothrow_move_assignable.h + __type_traits/is_same.h + __type_traits/is_swappable.h + __type_traits/nat.h + __type_traits/remove_cvref.h + __type_traits/unwrap_ref.h + __utility/declval.h + __utility/forward.h + __utility/move.h + __utility/piecewise_construct.h + __config + cstddef + __utility/swap.h + cstddef + cstdint + cstring + __assert + __config + __type_traits/is_constant_evaluated.h + string.h + __config + string.h + limits + __functional/unary_function.h + __fwd/string.h + __config + __fwd/memory_resource.h + __config + __ios/fpos.h + __config + iosfwd + __assert + __config + __fwd/fstream.h + __config + __fwd/string.h + __fwd/ios.h + __config + __fwd/string.h + __fwd/istream.h + __config + __fwd/string.h + __fwd/ostream.h + __config + __fwd/string.h + __fwd/sstream.h + __config + __fwd/string.h + __fwd/streambuf.h + __config + __fwd/string.h + __fwd/string.h + __std_mbstate_t.h + __config + __mbstate_t.h + version + __iterator/distance.h + __config + __iterator/concepts.h + __iterator/incrementable_traits.h + __iterator/iterator_traits.h + __ranges/access.h + __concepts/class_or_enum.h + __config + __iterator/concepts.h + __iterator/readable_traits.h + __ranges/enable_borrowed_range.h + __config + __type_traits/decay.h + __type_traits/is_reference.h + __type_traits/remove_cvref.h + __type_traits/remove_reference.h + __utility/auto_cast.h + __config + __type_traits/decay.h + __utility/declval.h + cstddef + __ranges/concepts.h + __concepts/constructible.h + __concepts/movable.h + __concepts/same_as.h + __config + __iterator/concepts.h + __iterator/incrementable_traits.h + __iterator/iter_move.h + __iterator/iterator_traits.h + __iterator/readable_traits.h + __ranges/access.h + __ranges/data.h + __concepts/class_or_enum.h + __config + __iterator/concepts.h + __iterator/iterator_traits.h + __memory/pointer_traits.h + __ranges/access.h + __type_traits/decay.h + __type_traits/is_object.h + __type_traits/is_pointer.h + __type_traits/is_reference.h + __type_traits/remove_pointer.h + __type_traits/remove_reference.h + __utility/auto_cast.h + __ranges/enable_borrowed_range.h + __ranges/enable_view.h + __concepts/derived_from.h + __concepts/same_as.h + __config + __type_traits/is_class.h + __type_traits/is_convertible.h + __type_traits/remove_cv.h + __ranges/size.h + __concepts/arithmetic.h + __concepts/class_or_enum.h + __config + __iterator/concepts.h + __iterator/iterator_traits.h + __ranges/access.h + __type_traits/decay.h + __type_traits/make_signed.h + __type_traits/make_unsigned.h + __type_traits/remove_cvref.h + __utility/auto_cast.h + __utility/declval.h + cstddef + __type_traits/add_pointer.h + __type_traits/is_reference.h + __type_traits/remove_cvref.h + __type_traits/remove_reference.h + __utility/declval.h + initializer_list + __ranges/size.h + __type_traits/decay.h + __type_traits/remove_cvref.h + __iterator/iterator_traits.h + __iterator/reverse_iterator.h + __algorithm/unwrap_iter.h + __compare/compare_three_way_result.h + __compare/three_way_comparable.h + __concepts/convertible_to.h + __config + __iterator/advance.h + __assert + __concepts/assignable.h + __concepts/same_as.h + __config + __iterator/concepts.h + __iterator/incrementable_traits.h + __iterator/iterator_traits.h + __type_traits/enable_if.h + __type_traits/is_integral.h + __utility/convert_to_integral.h + __config + __type_traits/enable_if.h + __type_traits/is_enum.h + __type_traits/is_floating_point.h + __type_traits/underlying_type.h + __utility/declval.h + __utility/move.h + __utility/unreachable.h + __assert + __config + limits + __iterator/concepts.h + __iterator/incrementable_traits.h + __iterator/iter_move.h + __iterator/iter_swap.h + __concepts/class_or_enum.h + __concepts/swappable.h + __config + __iterator/concepts.h + __iterator/iter_move.h + __iterator/iterator_traits.h + __iterator/readable_traits.h + __type_traits/remove_cvref.h + __utility/declval.h + __utility/forward.h + __utility/move.h + __iterator/iterator.h + __config + cstddef + __iterator/iterator_traits.h + __iterator/next.h + __assert + __config + __iterator/advance.h + __iterator/concepts.h + __iterator/incrementable_traits.h + __iterator/iterator_traits.h + __type_traits/enable_if.h + __iterator/prev.h + __assert + __config + __iterator/advance.h + __iterator/concepts.h + __iterator/incrementable_traits.h + __iterator/iterator_traits.h + __type_traits/enable_if.h + __iterator/readable_traits.h + __iterator/segmented_iterator.h + __config + __type_traits/integral_constant.h + cstddef + __memory/addressof.h + __ranges/access.h + __ranges/concepts.h + __ranges/subrange.h + __assert + __concepts/constructible.h + __concepts/convertible_to.h + __concepts/copyable.h + __concepts/derived_from.h + __concepts/different_from.h + __config + __fwd/get.h + __fwd/subrange.h + __iterator/advance.h + __iterator/concepts.h + __iterator/incrementable_traits.h + __iterator/iterator_traits.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __config + __ranges/access.h + __ranges/concepts.h + __type_traits/conditional.h + __ranges/enable_borrowed_range.h + __ranges/size.h + __ranges/view_interface.h + __assert + __concepts/derived_from.h + __concepts/same_as.h + __config + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/prev.h + __memory/pointer_traits.h + __ranges/access.h + __ranges/concepts.h + __ranges/empty.h + __concepts/class_or_enum.h + __config + __iterator/concepts.h + __ranges/access.h + __ranges/size.h + __type_traits/is_class.h + __type_traits/make_unsigned.h + __type_traits/remove_cv.h + __tuple/pair_like.h + __tuple/tuple_element.h + __tuple/tuple_size.h + __type_traits/conditional.h + __type_traits/decay.h + __type_traits/is_pointer.h + __type_traits/is_reference.h + __type_traits/make_unsigned.h + __type_traits/remove_const.h + __type_traits/remove_pointer.h + __utility/move.h + cstddef + __type_traits/conditional.h + __type_traits/enable_if.h + __type_traits/is_assignable.h + __type_traits/is_convertible.h + __type_traits/is_nothrow_copy_constructible.h + __type_traits/is_pointer.h + __type_traits/is_same.h + __utility/declval.h + __utility/move.h + __iterator/wrap_iter.h + __config + __debug + __iterator/iterator_traits.h + __memory/addressof.h + __memory/pointer_traits.h + __type_traits/enable_if.h + __type_traits/is_convertible.h + __memory/addressof.h + __memory/allocate_at_least.h + __config + __memory/allocator_traits.h + __config + __memory/construct_at.h + __assert + __config + __iterator/access.h + __config + cstddef + __memory/addressof.h + __memory/voidify.h + __config + __memory/addressof.h + __type_traits/enable_if.h + __type_traits/is_array.h + __utility/declval.h + __utility/forward.h + __utility/move.h + new + __assert + __availability + __config + __exception/exception.h + __config + vcruntime_exception.h + __type_traits/alignment_of.h + __type_traits/is_function.h + __type_traits/is_same.h + __type_traits/remove_cv.h + __verbose_abort + cstddef + cstdlib + __assert + __config + stdlib.h + version + new.h + exception + __assert + __config + __exception/exception.h + __exception/exception_ptr.h + __config + __exception/operations.h + __availability + __config + cstddef + __memory/addressof.h + cstddef + cstdlib + __exception/nested_exception.h + __config + __exception/exception_ptr.h + __memory/addressof.h + __type_traits/decay.h + __type_traits/is_base_of.h + __type_traits/is_class.h + __type_traits/is_convertible.h + __type_traits/is_copy_constructible.h + __type_traits/is_final.h + __type_traits/is_polymorphic.h + __utility/forward.h + cstddef + __exception/operations.h + __exception/terminate.h + __config + version + cstdlib + type_traits + type_traits + __memory/pointer_traits.h + __type_traits/enable_if.h + __type_traits/is_copy_constructible.h + __type_traits/is_empty.h + __type_traits/is_move_constructible.h + __type_traits/make_unsigned.h + __type_traits/remove_reference.h + __type_traits/void_t.h + __utility/declval.h + __utility/forward.h + limits + __undef_macros + cstddef + __memory/allocator.h + __config + __memory/addressof.h + __memory/allocate_at_least.h + __memory/allocator_traits.h + __type_traits/is_constant_evaluated.h + __type_traits/is_same.h + __type_traits/is_void.h + __type_traits/is_volatile.h + __utility/forward.h + cstddef + new + __memory/allocator_traits.h + __memory/compressed_pair.h + __config + __fwd/get.h + __fwd/tuple.h + __tuple/tuple_indices.h + __type_traits/decay.h + __type_traits/dependent_type.h + __type_traits/enable_if.h + __type_traits/is_default_constructible.h + __type_traits/is_empty.h + __type_traits/is_final.h + __type_traits/is_same.h + __type_traits/is_swappable.h + __utility/forward.h + __utility/move.h + __utility/piecewise_construct.h + cstddef + __memory/construct_at.h + __memory/pointer_traits.h + __memory/swap_allocator.h + __config + __memory/allocator_traits.h + __type_traits/integral_constant.h + __type_traits/is_swappable.h + __utility/swap.h + __memory_resource/polymorphic_allocator.h + __assert + __config + __memory_resource/memory_resource.h + __config + cstddef + __utility/exception_guard.h + __assert + __config + __type_traits/is_nothrow_move_constructible.h + __utility/exchange.h + __utility/move.h + cstddef + limits + new + stdexcept + __assert + __config + __exception/exception.h + __verbose_abort + iosfwd + cstdlib + exception + tuple + __assert + __compare/common_comparison_category.h + __compare/synth_three_way.h + __config + __functional/invoke.h + __fwd/array.h + __fwd/tuple.h + __memory/allocator_arg_t.h + __config + __memory/uses_allocator.h + __config + __type_traits/is_convertible.h + cstddef + __type_traits/integral_constant.h + __type_traits/is_constructible.h + __type_traits/remove_cvref.h + __utility/forward.h + __memory/uses_allocator.h + __tuple/make_tuple_types.h + __tuple/sfinae_helpers.h + __tuple/tuple_element.h + __tuple/tuple_indices.h + __tuple/tuple_like_ext.h + __tuple/tuple_size.h + __tuple/tuple_types.h + __type_traits/apply_cv.h + __type_traits/common_reference.h + __type_traits/common_type.h + __type_traits/conditional.h + __type_traits/conjunction.h + __type_traits/copy_cvref.h + __type_traits/disjunction.h + __type_traits/is_arithmetic.h + __type_traits/is_assignable.h + __type_traits/is_constructible.h + __type_traits/is_convertible.h + __type_traits/is_copy_assignable.h + __type_traits/is_copy_constructible.h + __type_traits/is_default_constructible.h + __type_traits/is_empty.h + __type_traits/is_final.h + __type_traits/is_implicitly_default_constructible.h + __type_traits/is_move_assignable.h + __type_traits/is_move_constructible.h + __type_traits/is_nothrow_assignable.h + __type_traits/is_nothrow_constructible.h + __type_traits/is_nothrow_copy_assignable.h + __type_traits/is_nothrow_copy_constructible.h + __type_traits/is_nothrow_default_constructible.h + __type_traits/is_nothrow_move_assignable.h + __type_traits/is_reference.h + __type_traits/is_same.h + __type_traits/is_swappable.h + __type_traits/lazy.h + __type_traits/maybe_const.h + __type_traits/nat.h + __type_traits/negation.h + __type_traits/remove_cvref.h + __type_traits/remove_reference.h + __type_traits/unwrap_ref.h + __utility/forward.h + __utility/integer_sequence.h + __utility/move.h + __utility/pair.h + __utility/piecewise_construct.h + __utility/swap.h + cstddef + version + compare + exception + iosfwd + new + type_traits + typeinfo + __assert + __availability + __config + __exception/exception.h + __type_traits/is_constant_evaluated.h + __verbose_abort + cstddef + cstdint + vcruntime_typeinfo.h + cstdlib + exception + type_traits + utility + initializer_list + __assert + __config + __utility/as_const.h + __config + __type_traits/add_const.h + __utility/forward.h + __utility/move.h + __utility/auto_cast.h + __utility/cmp.h + __config + __type_traits/disjunction.h + __type_traits/is_integral.h + __type_traits/is_same.h + __type_traits/is_signed.h + __type_traits/make_unsigned.h + __utility/forward.h + __utility/move.h + limits + __undef_macros + __utility/declval.h + __utility/exception_guard.h + __utility/exchange.h + __utility/forward.h + __utility/forward_like.h + __config + __type_traits/conditional.h + __type_traits/is_const.h + __type_traits/is_reference.h + __type_traits/remove_reference.h + __utility/in_place.h + __config + __type_traits/remove_cvref.h + cstddef + __utility/integer_sequence.h + __utility/move.h + __utility/pair.h + __utility/piecewise_construct.h + __utility/priority_tag.h + __utility/rel_ops.h + __config + __utility/swap.h + __utility/to_underlying.h + __config + __type_traits/underlying_type.h + __utility/unreachable.h + version + compare + initializer_list + __tuple/tuple_element.h + __tuple/tuple_size.h + cstdlib + iosfwd + type_traits + __undef_macros + __string/char_traits.h + __algorithm/copy_n.h + __algorithm/copy.h + __algorithm/copy_move_common.h + __algorithm/iterator_operations.h + __algorithm/iter_swap.h + __config + __utility/declval.h + __utility/swap.h + __algorithm/ranges_iterator_concept.h + __config + __iterator/concepts.h + __iterator/iterator_traits.h + __type_traits/remove_cvref.h + __config + __iterator/advance.h + __iterator/distance.h + __iterator/incrementable_traits.h + __iterator/iter_move.h + __iterator/iter_swap.h + __iterator/iterator_traits.h + __iterator/next.h + __iterator/prev.h + __iterator/readable_traits.h + __type_traits/enable_if.h + __type_traits/is_reference.h + __type_traits/is_same.h + __type_traits/remove_cvref.h + __utility/declval.h + __utility/forward.h + __utility/move.h + __algorithm/unwrap_iter.h + __algorithm/unwrap_range.h + __algorithm/unwrap_iter.h + __concepts/constructible.h + __config + __iterator/concepts.h + __iterator/next.h + __utility/declval.h + __utility/move.h + __utility/pair.h + __config + __iterator/iterator_traits.h + __memory/pointer_traits.h + __type_traits/enable_if.h + __type_traits/is_always_bitcastable.h + __config + __type_traits/integral_constant.h + __type_traits/is_integral.h + __type_traits/is_object.h + __type_traits/is_same.h + __type_traits/is_trivially_copyable.h + __type_traits/remove_cv.h + __type_traits/is_constant_evaluated.h + __type_traits/is_copy_constructible.h + __type_traits/is_trivially_assignable.h + __type_traits/is_trivially_copyable.h + __type_traits/is_volatile.h + __utility/move.h + __utility/pair.h + cstddef + __algorithm/for_each_segment.h + __config + __iterator/segmented_iterator.h + __algorithm/iterator_operations.h + __algorithm/min.h + __config + __iterator/segmented_iterator.h + __type_traits/common_type.h + __utility/move.h + __utility/pair.h + __undef_macros + __config + __iterator/iterator_traits.h + __type_traits/enable_if.h + __utility/convert_to_integral.h + __algorithm/fill_n.h + __config + __iterator/iterator_traits.h + __utility/convert_to_integral.h + __algorithm/find_end.h + __algorithm/comp.h + __algorithm/iterator_operations.h + __algorithm/search.h + __algorithm/comp.h + __algorithm/iterator_operations.h + __config + __functional/identity.h + __functional/invoke.h + __iterator/advance.h + __iterator/concepts.h + __iterator/iterator_traits.h + __type_traits/enable_if.h + __type_traits/is_callable.h + __utility/pair.h + __config + __functional/identity.h + __functional/invoke.h + __iterator/advance.h + __iterator/iterator_traits.h + __iterator/next.h + __iterator/reverse_iterator.h + __utility/pair.h + __algorithm/find_first_of.h + __algorithm/comp.h + __config + __iterator/iterator_traits.h + __algorithm/min.h + __compare/ordering.h + __config + __functional/hash.h + __iterator/iterator_traits.h + __string/constexpr_c_functions.h + __type_traits/is_constant_evaluated.h + cstddef + cstdint + cstdio + __assert + __config + stdio.h + __config + stdio.h + stdio.h + iosfwd + cwchar + __undef_macros + __string/extern_template_lists.h + __config + __type_traits/is_allocator.h + __config + __type_traits/integral_constant.h + __type_traits/void_t.h + __utility/declval.h + cstddef + __type_traits/is_array.h + __type_traits/is_convertible.h + __type_traits/is_nothrow_default_constructible.h + __type_traits/is_nothrow_move_assignable.h + __type_traits/is_same.h + __type_traits/is_standard_layout.h + __type_traits/is_trivial.h + __type_traits/noexcept_move_assign_container.h + __config + __memory/allocator_traits.h + __type_traits/integral_constant.h + __type_traits/is_nothrow_move_assignable.h + __type_traits/remove_cvref.h + __utility/auto_cast.h + __utility/move.h + __utility/swap.h + __utility/unreachable.h + climits + __assert + __config + limits.h + __config + limits.h + limits.h + limits.h + cstdint + cstdio + cstring + limits + stdexcept + string_view + compare + __algorithm/min.h + __assert + __config + __functional/hash.h + __functional/unary_function.h + __fwd/string_view.h + __config + iosfwd + __iterator/bounded_iter.h + __assert + __config + __iterator/iterator_traits.h + __memory/pointer_traits.h + __type_traits/enable_if.h + __type_traits/integral_constant.h + __type_traits/is_convertible.h + __utility/move.h + __iterator/concepts.h + __iterator/readable_traits.h + __iterator/reverse_iterator.h + __memory/pointer_traits.h + __ranges/concepts.h + __ranges/data.h + __ranges/enable_borrowed_range.h + __ranges/enable_view.h + __ranges/size.h + __string/char_traits.h + __type_traits/is_array.h + __type_traits/is_convertible.h + __type_traits/is_same.h + __type_traits/is_standard_layout.h + __type_traits/is_trivial.h + __type_traits/remove_cvref.h + __type_traits/remove_reference.h + __type_traits/type_identity.h + cstddef + iosfwd + limits + stdexcept + version + __iterator/access.h + __iterator/data.h + __config + cstddef + initializer_list + __iterator/empty.h + __config + cstddef + initializer_list + __iterator/reverse_access.h + __config + __iterator/reverse_iterator.h + cstddef + initializer_list + __iterator/size.h + __config + __type_traits/common_type.h + __type_traits/make_signed.h + cstddef + compare + __undef_macros + algorithm + initializer_list + __assert + __config + __debug + cstddef + version + __algorithm/adjacent_find.h + __algorithm/comp.h + __algorithm/iterator_operations.h + __config + __iterator/iterator_traits.h + __utility/move.h + __algorithm/all_of.h + __config + __algorithm/any_of.h + __config + __algorithm/binary_search.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __algorithm/lower_bound.h + __algorithm/comp.h + __algorithm/half_positive.h + __config + __type_traits/enable_if.h + __type_traits/is_integral.h + __type_traits/make_unsigned.h + __algorithm/iterator_operations.h + __config + __functional/identity.h + __functional/invoke.h + __iterator/advance.h + __iterator/distance.h + __iterator/iterator_traits.h + __type_traits/is_callable.h + __type_traits/remove_reference.h + __config + __iterator/iterator_traits.h + __algorithm/clamp.h + __algorithm/comp.h + __assert + __config + __algorithm/comp.h + __algorithm/comp_ref_type.h + __algorithm/copy.h + __algorithm/copy_backward.h + __algorithm/copy_move_common.h + __algorithm/iterator_operations.h + __algorithm/min.h + __config + __iterator/segmented_iterator.h + __type_traits/common_type.h + __type_traits/is_copy_constructible.h + __utility/move.h + __utility/pair.h + __undef_macros + __algorithm/copy_if.h + __config + __algorithm/copy_n.h + __algorithm/count.h + __config + __iterator/iterator_traits.h + __algorithm/count_if.h + __config + __iterator/iterator_traits.h + __algorithm/equal.h + __algorithm/comp.h + __algorithm/unwrap_iter.h + __config + __functional/identity.h + __functional/invoke.h + __iterator/distance.h + __iterator/iterator_traits.h + __string/constexpr_c_functions.h + __type_traits/enable_if.h + __type_traits/integral_constant.h + __type_traits/is_constant_evaluated.h + __type_traits/is_equality_comparable.h + __type_traits/is_volatile.h + __type_traits/predicate_traits.h + __utility/move.h + __algorithm/equal_range.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __algorithm/half_positive.h + __algorithm/iterator_operations.h + __algorithm/lower_bound.h + __algorithm/upper_bound.h + __algorithm/comp.h + __algorithm/half_positive.h + __algorithm/iterator_operations.h + __config + __functional/identity.h + __functional/invoke.h + __iterator/advance.h + __iterator/distance.h + __iterator/iterator_traits.h + __type_traits/is_copy_constructible.h + __utility/move.h + __config + __functional/identity.h + __functional/invoke.h + __iterator/advance.h + __iterator/distance.h + __iterator/iterator_traits.h + __iterator/next.h + __type_traits/is_callable.h + __type_traits/is_copy_constructible.h + __utility/move.h + __utility/pair.h + __algorithm/fill.h + __algorithm/fill_n.h + __config + __iterator/iterator_traits.h + __algorithm/fill_n.h + __algorithm/find.h + __algorithm/find_end.h + __algorithm/find_first_of.h + __algorithm/find_if.h + __algorithm/find_if_not.h + __config + __algorithm/for_each.h + __algorithm/for_each_segment.h + __config + __iterator/segmented_iterator.h + __type_traits/enable_if.h + __utility/move.h + __algorithm/for_each_n.h + __config + __utility/convert_to_integral.h + __algorithm/generate.h + __config + __algorithm/generate_n.h + __config + __utility/convert_to_integral.h + __algorithm/half_positive.h + __algorithm/in_found_result.h + __concepts/convertible_to.h + __config + __utility/move.h + __algorithm/in_fun_result.h + __concepts/convertible_to.h + __config + __utility/move.h + __algorithm/in_in_out_result.h + __concepts/convertible_to.h + __config + __utility/move.h + __algorithm/in_in_result.h + __concepts/convertible_to.h + __config + __utility/move.h + __algorithm/in_out_out_result.h + __concepts/convertible_to.h + __config + __utility/move.h + __algorithm/in_out_result.h + __concepts/convertible_to.h + __config + __utility/move.h + __algorithm/includes.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __config + __functional/identity.h + __functional/invoke.h + __iterator/iterator_traits.h + __type_traits/is_callable.h + __utility/move.h + __algorithm/inplace_merge.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __algorithm/iterator_operations.h + __algorithm/lower_bound.h + __algorithm/min.h + __algorithm/move.h + __algorithm/copy_move_common.h + __algorithm/for_each_segment.h + __algorithm/iterator_operations.h + __algorithm/min.h + __config + __iterator/segmented_iterator.h + __type_traits/common_type.h + __type_traits/is_copy_constructible.h + __utility/move.h + __utility/pair.h + __undef_macros + __algorithm/rotate.h + __algorithm/iterator_operations.h + __algorithm/move.h + __algorithm/move_backward.h + __algorithm/copy_move_common.h + __algorithm/iterator_operations.h + __algorithm/min.h + __config + __iterator/segmented_iterator.h + __type_traits/common_type.h + __type_traits/is_copy_constructible.h + __utility/move.h + __utility/pair.h + __undef_macros + __algorithm/swap_ranges.h + __algorithm/iterator_operations.h + __config + __utility/move.h + __utility/pair.h + __config + __iterator/iterator_traits.h + __type_traits/is_trivially_move_assignable.h + __utility/move.h + __utility/pair.h + __algorithm/upper_bound.h + __config + __functional/identity.h + __iterator/advance.h + __iterator/distance.h + __iterator/iterator_traits.h + __iterator/reverse_iterator.h + __memory/destruct_n.h + __config + __type_traits/integral_constant.h + __type_traits/is_trivially_destructible.h + cstddef + __memory/temporary_buffer.h + __config + __type_traits/alignment_of.h + __utility/pair.h + cstddef + new + __memory/unique_ptr.h + __compare/compare_three_way.h + __compare/compare_three_way_result.h + __compare/three_way_comparable.h + __config + __functional/hash.h + __functional/operations.h + __config + __functional/binary_function.h + __config + __functional/unary_function.h + __type_traits/integral_constant.h + __type_traits/predicate_traits.h + __utility/forward.h + __memory/allocator_traits.h + __memory/auto_ptr.h + __config + __memory/compressed_pair.h + __type_traits/add_lvalue_reference.h + __type_traits/common_type.h + __type_traits/dependent_type.h + __type_traits/integral_constant.h + __type_traits/is_array.h + __type_traits/is_assignable.h + __type_traits/is_constructible.h + __type_traits/is_convertible.h + __type_traits/is_default_constructible.h + __type_traits/is_function.h + __type_traits/is_pointer.h + __type_traits/is_reference.h + __type_traits/is_same.h + __type_traits/is_swappable.h + __type_traits/is_void.h + __type_traits/remove_extent.h + __type_traits/type_identity.h + __utility/forward.h + __utility/move.h + cstddef + __utility/pair.h + new + __undef_macros + __algorithm/is_heap.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __algorithm/is_heap_until.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __config + __iterator/iterator_traits.h + __config + __iterator/iterator_traits.h + __algorithm/is_heap_until.h + __algorithm/is_partitioned.h + __config + __algorithm/is_permutation.h + __algorithm/comp.h + __algorithm/iterator_operations.h + __config + __functional/identity.h + __functional/invoke.h + __iterator/concepts.h + __iterator/distance.h + __iterator/iterator_traits.h + __iterator/next.h + __type_traits/is_callable.h + __utility/move.h + __algorithm/is_sorted.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __algorithm/is_sorted_until.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __config + __iterator/iterator_traits.h + __config + __iterator/iterator_traits.h + __algorithm/is_sorted_until.h + __algorithm/iter_swap.h + __algorithm/lexicographical_compare.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __config + __iterator/iterator_traits.h + __algorithm/lexicographical_compare_three_way.h + __algorithm/min.h + __algorithm/three_way_comp_ref_type.h + __compare/ordering.h + __config + __debug + __utility/declval.h + __compare/compare_three_way.h + __compare/ordering.h + __concepts/arithmetic.h + __config + __iterator/iterator_traits.h + __type_traits/common_type.h + __type_traits/is_copy_constructible.h + __utility/move.h + __undef_macros + __algorithm/lower_bound.h + __algorithm/make_heap.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __algorithm/iterator_operations.h + __algorithm/sift_down.h + __algorithm/iterator_operations.h + __assert + __config + __iterator/iterator_traits.h + __utility/move.h + __config + __iterator/iterator_traits.h + __utility/move.h + __algorithm/max.h + __algorithm/max_element.h + __algorithm/merge.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __algorithm/copy.h + __config + __iterator/iterator_traits.h + __algorithm/min.h + __algorithm/min_element.h + __algorithm/min_max_result.h + __concepts/convertible_to.h + __config + __utility/move.h + __undef_macros + __algorithm/minmax.h + __algorithm/comp.h + __algorithm/minmax_element.h + __algorithm/comp.h + __config + __functional/identity.h + __functional/invoke.h + __iterator/iterator_traits.h + __type_traits/is_callable.h + __utility/pair.h + __config + __functional/identity.h + __type_traits/is_callable.h + __utility/pair.h + initializer_list + __algorithm/minmax_element.h + __algorithm/mismatch.h + __algorithm/comp.h + __config + __iterator/iterator_traits.h + __utility/pair.h + __algorithm/move.h + __algorithm/move_backward.h + __algorithm/next_permutation.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __algorithm/iterator_operations.h + __algorithm/reverse.h + __algorithm/iter_swap.h + __algorithm/iterator_operations.h + __config + __iterator/iterator_traits.h + __utility/move.h + __config + __iterator/iterator_traits.h + __utility/move.h + __utility/pair.h + __algorithm/none_of.h + __config + __algorithm/nth_element.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __algorithm/iterator_operations.h + __algorithm/sort.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __algorithm/iter_swap.h + __algorithm/iterator_operations.h + __algorithm/min_element.h + __algorithm/partial_sort.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __algorithm/iterator_operations.h + __algorithm/make_heap.h + __algorithm/sift_down.h + __algorithm/sort_heap.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __algorithm/iterator_operations.h + __algorithm/pop_heap.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __algorithm/iterator_operations.h + __algorithm/push_heap.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __algorithm/iterator_operations.h + __config + __iterator/iterator_traits.h + __type_traits/is_copy_assignable.h + __type_traits/is_copy_constructible.h + __utility/move.h + __algorithm/sift_down.h + __assert + __config + __iterator/iterator_traits.h + __type_traits/is_copy_assignable.h + __type_traits/is_copy_constructible.h + __utility/move.h + __config + __iterator/iterator_traits.h + __type_traits/is_copy_assignable.h + __type_traits/is_copy_constructible.h + __utility/move.h + __config + __debug + __debug_utils/randomize_range.h + __config + __algorithm/shuffle.h + __algorithm/iterator_operations.h + __config + __debug + __iterator/iterator_traits.h + __random/uniform_int_distribution.h + __bit/countl.h + __bit/rotate.h + __concepts/arithmetic.h + __config + __type_traits/is_unsigned_integer.h + limits + __concepts/arithmetic.h + __config + __type_traits/is_unsigned_integer.h + limits + __undef_macros + __config + __random/is_valid.h + __config + __type_traits/enable_if.h + __type_traits/integral_constant.h + __type_traits/is_same.h + __type_traits/is_unsigned.h + __utility/declval.h + cstdint + __random/log2.h + __config + __type_traits/conditional.h + cstddef + __type_traits/conditional.h + __type_traits/make_unsigned.h + cstddef + cstdint + iosfwd + limits + __undef_macros + __utility/forward.h + __utility/move.h + __utility/swap.h + cstddef + cstdint + __undef_macros + __type_traits/is_constant_evaluated.h + __iterator/iterator_traits.h + __type_traits/is_copy_assignable.h + __type_traits/is_copy_constructible.h + __utility/move.h + __algorithm/unwrap_iter.h + __assert + __bit/blsr.h + __config + __bit/countl.h + __bit/countr.h + __bit/rotate.h + __concepts/arithmetic.h + __config + limits + __undef_macros + __config + __debug + __debug_utils/randomize_range.h + __functional/operations.h + __functional/ranges_operations.h + __concepts/equality_comparable.h + __concepts/totally_ordered.h + __config + __type_traits/integral_constant.h + __type_traits/predicate_traits.h + __utility/forward.h + __iterator/iterator_traits.h + __type_traits/conditional.h + __type_traits/disjunction.h + __type_traits/is_arithmetic.h + __utility/move.h + __utility/pair.h + climits + cstdint + __config + __debug + __debug_utils/randomize_range.h + __iterator/iterator_traits.h + __utility/move.h + __algorithm/partial_sort.h + __algorithm/partial_sort_copy.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __algorithm/iterator_operations.h + __algorithm/make_heap.h + __algorithm/make_projected.h + __concepts/same_as.h + __config + __functional/identity.h + __functional/invoke.h + __type_traits/decay.h + __type_traits/enable_if.h + __type_traits/integral_constant.h + __type_traits/is_member_pointer.h + __type_traits/is_same.h + __utility/declval.h + __utility/forward.h + __algorithm/sift_down.h + __algorithm/sort_heap.h + __config + __functional/identity.h + __functional/invoke.h + __iterator/iterator_traits.h + __type_traits/is_callable.h + __utility/move.h + __utility/pair.h + __algorithm/partition.h + __algorithm/iterator_operations.h + __config + __iterator/iterator_traits.h + __utility/move.h + __utility/pair.h + __algorithm/partition_copy.h + __config + __iterator/iterator_traits.h + __utility/pair.h + __algorithm/partition_point.h + __algorithm/half_positive.h + __config + __iterator/advance.h + __iterator/distance.h + __iterator/iterator_traits.h + __algorithm/pop_heap.h + __algorithm/prev_permutation.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __algorithm/iterator_operations.h + __algorithm/reverse.h + __config + __iterator/iterator_traits.h + __utility/move.h + __utility/pair.h + __algorithm/pstl_any_all_none_of.h + __algorithm/pstl_find.h + __algorithm/comp.h + __algorithm/find.h + __algorithm/pstl_backend.h + __algorithm/pstl_backends/cpu_backend.h + __config + __algorithm/pstl_backends/cpu_backends/any_of.h + __algorithm/any_of.h + __algorithm/find_if.h + __algorithm/pstl_backends/cpu_backends/backend.h + __config + __algorithm/pstl_backends/cpu_backends/serial.h + __config + __algorithm/pstl_backends/cpu_backends/thread.h + __assert + __config + __atomic/atomic.h + __atomic/atomic_base.h + __atomic/atomic_sync.h + __atomic/contention_t.h + __atomic/cxx_atomic_impl.h + __atomic/is_always_lock_free.h + __config + __atomic/memory_order.h + __config + __type_traits/is_same.h + __type_traits/underlying_type.h + __config + __memory/addressof.h + __type_traits/conditional.h + __type_traits/is_assignable.h + __type_traits/is_trivially_copyable.h + __type_traits/remove_const.h + cstddef + cstring + __config + cstdint + __atomic/cxx_atomic_impl.h + __atomic/memory_order.h + __availability + __chrono/duration.h + __compare/ordering.h + __compare/three_way_comparable.h + __config + __type_traits/common_type.h + __type_traits/enable_if.h + __type_traits/is_convertible.h + __type_traits/is_floating_point.h + limits + ratio + __assert + __config + __type_traits/integral_constant.h + climits + cstdint + version + __undef_macros + type_traits + __undef_macros + type_traits + __config + __memory/addressof.h + __thread/poll_with_backoff.h + __availability + __chrono/duration.h + __chrono/high_resolution_clock.h + __chrono/steady_clock.h + __chrono/duration.h + __chrono/time_point.h + __chrono/duration.h + __compare/ordering.h + __compare/three_way_comparable.h + __config + __type_traits/common_type.h + __type_traits/enable_if.h + __type_traits/is_convertible.h + limits + __undef_macros + __config + __chrono/system_clock.h + __chrono/duration.h + __chrono/time_point.h + __config + ctime + __assert + __config + time.h + libc/calls/calls.h + libc/calls/struct/timespec.h + libc/calls/struct/timeval.h + libc/calls/struct/timespec.h + libc/time.h + libc/calls/weirdtypes.h + libc/sysv/consts/clock.h + libc/sysv/consts/sched.h + libc/sysv/consts/timer.h + libc/time.h + __config + __config + __threading_support + __availability + __chrono/convert_to_timespec.h + __chrono/duration.h + __config + limits + __undef_macros + __chrono/duration.h + __compare/ordering.h + __config + __fwd/hash.h + __thread/poll_with_backoff.h + errno.h + __config + errno.h + iosfwd + limits + __support/ibm/nanosleep.h + unistd.h + libc/calls/calls.h + libc/calls/weirdtypes.h + libc/runtime/pathconf.h + libc/runtime/runtime.h + libc/runtime/sysconf.h + libc/sysv/consts/f.h + libc/sysv/consts/fileno.h + libc/sysv/consts/o.h + libc/sysv/consts/ok.h + libc/time.h + libc/unistd.h + third_party/getopt/long1.h + third_party/musl/crypt.h + third_party/musl/lockf.h + __external_threading + pthread.h + libc/calls/weirdtypes.h + libc/sysv/consts/clock.h + libc/thread/thread.h + libc/thread/thread2.h + libc/calls/struct/cpuset.h + libc/calls/struct/sched_param.h + libc/calls/struct/timespec.h + libc/calls/struct/sigset.h + libc/calls/struct/timespec.h + libc/runtime/stack.h + libc/thread/thread.h + sched.h + libc/calls/calls.h + libc/calls/struct/cpuset.h + libc/calls/struct/sched_param.h + libc/calls/weirdtypes.h + libc/sysv/consts/sched.h + threads.h + libc/thread/threads.h + __type_traits/decay.h + cstring + __atomic/check_memory_order.h + __config + __atomic/cxx_atomic_impl.h + __atomic/is_always_lock_free.h + __atomic/memory_order.h + __availability + __config + __memory/addressof.h + __type_traits/is_integral.h + __type_traits/is_nothrow_default_constructible.h + __type_traits/is_same.h + version + __atomic/check_memory_order.h + __atomic/cxx_atomic_impl.h + __atomic/memory_order.h + __config + __memory/addressof.h + __type_traits/is_function.h + __type_traits/is_same.h + __type_traits/remove_pointer.h + cstddef + __atomic/memory_order.h + __config + __functional/operations.h + __iterator/iterator_traits.h + __type_traits/is_execution_policy.h + __config + __type_traits/remove_cvref.h + __utility/pair.h + __utility/terminate_on_exception.h + __config + __exception/terminate.h + cstdint + __algorithm/pstl_backends/cpu_backends/fill.h + __algorithm/fill.h + __algorithm/pstl_backends/cpu_backends/backend.h + __config + __iterator/iterator_traits.h + __type_traits/is_execution_policy.h + __utility/terminate_on_exception.h + __algorithm/pstl_backends/cpu_backends/find_if.h + __algorithm/find_if.h + __algorithm/pstl_backends/cpu_backends/backend.h + __atomic/atomic.h + __config + __functional/operations.h + __iterator/iterator_traits.h + __type_traits/is_execution_policy.h + __utility/pair.h + __utility/terminate_on_exception.h + cstddef + __algorithm/pstl_backends/cpu_backends/for_each.h + __algorithm/for_each.h + __algorithm/pstl_backends/cpu_backends/backend.h + __config + __iterator/iterator_traits.h + __type_traits/is_execution_policy.h + __utility/terminate_on_exception.h + __algorithm/pstl_backends/cpu_backends/merge.h + __algorithm/merge.h + __algorithm/pstl_backends/cpu_backends/backend.h + __config + __iterator/iterator_traits.h + __type_traits/is_execution_policy.h + __utility/move.h + __utility/terminate_on_exception.h + __algorithm/pstl_backends/cpu_backends/transform.h + __algorithm/pstl_backends/cpu_backends/backend.h + __algorithm/transform.h + __config + __config + __iterator/iterator_traits.h + __type_traits/enable_if.h + __type_traits/is_execution_policy.h + __type_traits/remove_cvref.h + __utility/terminate_on_exception.h + __config + execution + __assert + __config + __type_traits/is_execution_policy.h + __type_traits/is_same.h + __type_traits/remove_cvref.h + version + __algorithm/pstl_frontend_dispatch.h + __config + __type_traits/is_callable.h + __utility/forward.h + __config + __iterator/iterator_traits.h + __type_traits/is_execution_policy.h + __type_traits/remove_cvref.h + __utility/terminate_on_exception.h + __algorithm/pstl_frontend_dispatch.h + __config + __iterator/iterator_traits.h + __type_traits/enable_if.h + __type_traits/is_execution_policy.h + __type_traits/remove_cvref.h + __utility/terminate_on_exception.h + __algorithm/pstl_copy.h + __algorithm/copy_n.h + __algorithm/pstl_transform.h + __algorithm/pstl_backend.h + __config + __iterator/iterator_traits.h + __type_traits/is_execution_policy.h + __utility/terminate_on_exception.h + __config + __functional/identity.h + __iterator/iterator_traits.h + __type_traits/is_constant_evaluated.h + __type_traits/is_execution_policy.h + __type_traits/is_trivially_copyable.h + __algorithm/pstl_fill.h + __algorithm/fill_n.h + __algorithm/pstl_for_each.h + __algorithm/for_each.h + __algorithm/for_each_n.h + __algorithm/pstl_backend.h + __algorithm/pstl_frontend_dispatch.h + __config + __iterator/iterator_traits.h + __type_traits/is_execution_policy.h + __type_traits/remove_cvref.h + __type_traits/void_t.h + __utility/terminate_on_exception.h + __algorithm/pstl_frontend_dispatch.h + __config + __iterator/iterator_traits.h + __type_traits/is_execution_policy.h + __type_traits/remove_cvref.h + __utility/terminate_on_exception.h + __algorithm/pstl_find.h + __algorithm/pstl_for_each.h + __algorithm/pstl_merge.h + __algorithm/pstl_backend.h + __config + __functional/operations.h + __type_traits/is_execution_policy.h + __type_traits/remove_cvref.h + __algorithm/pstl_transform.h + __algorithm/push_heap.h + __algorithm/ranges_adjacent_find.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/projected.h + __config + __iterator/concepts.h + __iterator/incrementable_traits.h + __type_traits/remove_cvref.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __algorithm/ranges_all_of.h + __config + __functional/identity.h + __functional/invoke.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __utility/move.h + __algorithm/ranges_any_of.h + __config + __functional/identity.h + __functional/invoke.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __utility/move.h + __algorithm/ranges_binary_search.h + __algorithm/iterator_operations.h + __algorithm/lower_bound.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __algorithm/ranges_clamp.h + __assert + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/projected.h + __utility/forward.h + __algorithm/ranges_copy.h + __algorithm/copy.h + __algorithm/in_out_result.h + __algorithm/iterator_operations.h + __config + __functional/identity.h + __iterator/concepts.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __utility/pair.h + __algorithm/ranges_copy_backward.h + __algorithm/copy_backward.h + __algorithm/in_out_result.h + __algorithm/iterator_operations.h + __config + __iterator/concepts.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __algorithm/ranges_copy_if.h + __algorithm/in_out_result.h + __config + __functional/identity.h + __functional/invoke.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __algorithm/ranges_copy_n.h + __algorithm/copy.h + __algorithm/in_out_result.h + __algorithm/iterator_operations.h + __algorithm/ranges_copy.h + __config + __functional/identity.h + __iterator/concepts.h + __iterator/incrementable_traits.h + __iterator/unreachable_sentinel.h + __config + __iterator/concepts.h + __iterator/wrap_iter.h + __utility/move.h + __algorithm/ranges_count.h + __algorithm/ranges_count_if.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/incrementable_traits.h + __iterator/iterator_traits.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __utility/move.h + __config + __functional/identity.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/incrementable_traits.h + __iterator/iterator_traits.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __utility/move.h + __algorithm/ranges_count_if.h + __algorithm/ranges_equal.h + __algorithm/equal.h + __algorithm/unwrap_range.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/distance.h + __iterator/indirectly_comparable.h + __config + __functional/identity.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __utility/move.h + __algorithm/ranges_equal_range.h + __algorithm/equal_range.h + __algorithm/iterator_operations.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __ranges/subrange.h + __utility/forward.h + __utility/move.h + __utility/pair.h + __algorithm/ranges_fill.h + __algorithm/ranges_fill_n.h + __config + __iterator/concepts.h + __iterator/incrementable_traits.h + __config + __iterator/concepts.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __algorithm/ranges_fill_n.h + __algorithm/ranges_find.h + __algorithm/find.h + __algorithm/ranges_find_if.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __algorithm/unwrap_range.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/forward.h + __utility/move.h + __algorithm/ranges_find_end.h + __algorithm/find_end.h + __algorithm/iterator_operations.h + __algorithm/ranges_iterator_concept.h + __config + __functional/identity.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/indirectly_comparable.h + __iterator/iterator_traits.h + __ranges/access.h + __ranges/concepts.h + __ranges/subrange.h + __utility/pair.h + __algorithm/ranges_find_first_of.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/indirectly_comparable.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __algorithm/ranges_find_if.h + __algorithm/ranges_find_if_not.h + __algorithm/ranges_find_if.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/forward.h + __utility/move.h + __algorithm/ranges_for_each.h + __algorithm/in_fun_result.h + __config + __functional/identity.h + __functional/invoke.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __algorithm/ranges_for_each_n.h + __algorithm/in_fun_result.h + __config + __functional/identity.h + __functional/invoke.h + __iterator/concepts.h + __iterator/incrementable_traits.h + __iterator/iterator_traits.h + __iterator/projected.h + __ranges/concepts.h + __utility/move.h + __algorithm/ranges_generate.h + __concepts/constructible.h + __concepts/invocable.h + __config + __functional/invoke.h + __iterator/concepts.h + __iterator/iterator_traits.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __algorithm/ranges_generate_n.h + __concepts/constructible.h + __concepts/invocable.h + __config + __functional/identity.h + __functional/invoke.h + __iterator/concepts.h + __iterator/incrementable_traits.h + __iterator/iterator_traits.h + __ranges/access.h + __ranges/concepts.h + __utility/move.h + __algorithm/ranges_includes.h + __algorithm/includes.h + __algorithm/make_projected.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __utility/forward.h + __utility/move.h + __algorithm/ranges_inplace_merge.h + __algorithm/inplace_merge.h + __algorithm/iterator_operations.h + __algorithm/make_projected.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/next.h + __iterator/projected.h + __iterator/sortable.h + __config + __functional/identity.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/permutable.h + __config + __iterator/concepts.h + __iterator/iter_swap.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/forward.h + __utility/move.h + __algorithm/ranges_is_heap.h + __algorithm/is_heap_until.h + __algorithm/make_projected.h + __config + __functional/identity.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/next.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __utility/move.h + __algorithm/ranges_is_heap_until.h + __algorithm/is_heap_until.h + __algorithm/make_projected.h + __config + __functional/identity.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/next.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __algorithm/ranges_is_partitioned.h + __config + __functional/identity.h + __functional/invoke.h + __iterator/concepts.h + __iterator/indirectly_comparable.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __utility/move.h + __algorithm/ranges_is_permutation.h + __algorithm/is_permutation.h + __algorithm/iterator_operations.h + __config + __functional/identity.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/distance.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __utility/move.h + __algorithm/ranges_is_sorted.h + __algorithm/ranges_is_sorted_until.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __config + __functional/identity.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __utility/move.h + __algorithm/ranges_is_sorted_until.h + __algorithm/ranges_lexicographical_compare.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __utility/move.h + __algorithm/ranges_lower_bound.h + __algorithm/iterator_operations.h + __algorithm/lower_bound.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/advance.h + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __algorithm/ranges_make_heap.h + __algorithm/iterator_operations.h + __algorithm/make_heap.h + __algorithm/make_projected.h + __concepts/same_as.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/next.h + __iterator/projected.h + __iterator/sortable.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/forward.h + __utility/move.h + __algorithm/ranges_max.h + __algorithm/ranges_min_element.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/forward.h + __assert + __concepts/copyable.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __type_traits/is_trivially_copyable.h + __utility/move.h + initializer_list + __undef_macros + __algorithm/ranges_max_element.h + __algorithm/ranges_min_element.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __algorithm/ranges_merge.h + __algorithm/in_in_out_result.h + __algorithm/ranges_copy.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/mergeable.h + __config + __functional/identity.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __type_traits/remove_cvref.h + __utility/move.h + __algorithm/ranges_min.h + __algorithm/ranges_min_element.h + __assert + __concepts/copyable.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __type_traits/is_trivially_copyable.h + initializer_list + __undef_macros + __algorithm/ranges_min_element.h + __algorithm/ranges_minmax.h + __algorithm/min_max_result.h + __algorithm/minmax_element.h + __assert + __concepts/copyable.h + __concepts/same_as.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/next.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __type_traits/is_reference.h + __type_traits/remove_cvref.h + __utility/forward.h + __utility/move.h + __utility/pair.h + initializer_list + __undef_macros + __algorithm/ranges_minmax_element.h + __algorithm/min_max_result.h + __algorithm/minmax_element.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/forward.h + __utility/move.h + __utility/pair.h + __algorithm/ranges_mismatch.h + __algorithm/in_in_result.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/indirectly_comparable.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __algorithm/ranges_move.h + __algorithm/in_out_result.h + __algorithm/iterator_operations.h + __algorithm/move.h + __config + __iterator/concepts.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __algorithm/ranges_move_backward.h + __algorithm/in_out_result.h + __algorithm/iterator_operations.h + __algorithm/move_backward.h + __config + __iterator/concepts.h + __iterator/iter_move.h + __iterator/next.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __algorithm/ranges_next_permutation.h + __algorithm/in_found_result.h + __algorithm/iterator_operations.h + __algorithm/make_projected.h + __algorithm/next_permutation.h + __config + __functional/identity.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/sortable.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __utility/pair.h + __algorithm/ranges_none_of.h + __config + __functional/identity.h + __functional/invoke.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __utility/move.h + __algorithm/ranges_nth_element.h + __algorithm/iterator_operations.h + __algorithm/make_projected.h + __algorithm/nth_element.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/next.h + __iterator/projected.h + __iterator/sortable.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/forward.h + __utility/move.h + __algorithm/ranges_partial_sort.h + __algorithm/iterator_operations.h + __algorithm/make_projected.h + __algorithm/partial_sort.h + __concepts/same_as.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/next.h + __iterator/projected.h + __iterator/sortable.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/forward.h + __utility/move.h + __utility/pair.h + __algorithm/ranges_partial_sort_copy.h + __algorithm/in_out_result.h + __algorithm/iterator_operations.h + __algorithm/make_projected.h + __algorithm/partial_sort_copy.h + __config + __functional/identity.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/projected.h + __iterator/sortable.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __utility/pair.h + __algorithm/ranges_partition.h + __algorithm/iterator_operations.h + __algorithm/make_projected.h + __algorithm/partition.h + __algorithm/ranges_iterator_concept.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/permutable.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/subrange.h + __utility/forward.h + __utility/move.h + __utility/pair.h + __algorithm/ranges_partition_copy.h + __algorithm/in_out_out_result.h + __config + __functional/identity.h + __functional/invoke.h + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __type_traits/remove_cvref.h + __utility/move.h + __algorithm/ranges_partition_point.h + __algorithm/half_positive.h + __config + __functional/identity.h + __functional/invoke.h + __iterator/concepts.h + __iterator/distance.h + __iterator/iterator_traits.h + __iterator/next.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __algorithm/ranges_pop_heap.h + __algorithm/iterator_operations.h + __algorithm/make_projected.h + __algorithm/pop_heap.h + __concepts/same_as.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/next.h + __iterator/projected.h + __iterator/sortable.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/forward.h + __utility/move.h + __algorithm/ranges_prev_permutation.h + __algorithm/in_found_result.h + __algorithm/iterator_operations.h + __algorithm/make_projected.h + __algorithm/prev_permutation.h + __config + __functional/identity.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/sortable.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __utility/pair.h + __algorithm/ranges_push_heap.h + __algorithm/iterator_operations.h + __algorithm/make_projected.h + __algorithm/push_heap.h + __concepts/same_as.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/next.h + __iterator/projected.h + __iterator/sortable.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/forward.h + __utility/move.h + __algorithm/ranges_remove.h + __config + __algorithm/ranges_remove_if.h + __config + __algorithm/ranges_find_if.h + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/iter_move.h + __iterator/permutable.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/subrange.h + __utility/move.h + __functional/identity.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/permutable.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/subrange.h + __utility/move.h + __algorithm/ranges_remove_copy.h + __algorithm/in_out_result.h + __algorithm/ranges_remove_copy_if.h + __algorithm/in_out_result.h + __algorithm/make_projected.h + __algorithm/remove_copy_if.h + __config + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/forward.h + __utility/move.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __algorithm/ranges_remove_copy_if.h + __algorithm/ranges_remove_if.h + __algorithm/ranges_replace.h + __algorithm/ranges_replace_if.h + __config + __functional/identity.h + __functional/invoke.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __config + __functional/identity.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __algorithm/ranges_replace_copy.h + __algorithm/in_out_result.h + __algorithm/ranges_replace_copy_if.h + __algorithm/in_out_result.h + __config + __functional/identity.h + __functional/invoke.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __algorithm/ranges_replace_copy_if.h + __algorithm/ranges_replace_if.h + __algorithm/ranges_reverse.h + __config + __iterator/concepts.h + __iterator/iter_swap.h + __iterator/next.h + __iterator/permutable.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __algorithm/ranges_reverse_copy.h + __algorithm/in_out_result.h + __algorithm/ranges_copy.h + __config + __iterator/concepts.h + __iterator/next.h + __iterator/reverse_iterator.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __ranges/subrange.h + __utility/move.h + __algorithm/ranges_rotate.h + __algorithm/iterator_operations.h + __algorithm/ranges_iterator_concept.h + __algorithm/rotate.h + __config + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/permutable.h + __ranges/access.h + __ranges/concepts.h + __ranges/subrange.h + __utility/move.h + __algorithm/ranges_rotate_copy.h + __algorithm/in_out_result.h + __algorithm/ranges_copy.h + __config + __iterator/concepts.h + __iterator/reverse_iterator.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __algorithm/ranges_sample.h + __algorithm/iterator_operations.h + __algorithm/sample.h + __algorithm/iterator_operations.h + __algorithm/min.h + __assert + __config + __iterator/distance.h + __iterator/iterator_traits.h + __random/uniform_int_distribution.h + __type_traits/common_type.h + __utility/move.h + __undef_macros + __algorithm/uniform_random_bit_generator_adaptor.h + __config + __functional/invoke.h + __type_traits/remove_cvref.h + __undef_macros + __config + __iterator/concepts.h + __iterator/incrementable_traits.h + __iterator/iterator_traits.h + __random/uniform_random_bit_generator.h + __concepts/arithmetic.h + __concepts/invocable.h + __concepts/same_as.h + __config + __functional/invoke.h + __type_traits/integral_constant.h + __undef_macros + __ranges/access.h + __ranges/concepts.h + __type_traits/remove_reference.h + __utility/forward.h + __utility/move.h + __algorithm/ranges_search.h + __algorithm/iterator_operations.h + __algorithm/search.h + __config + __functional/identity.h + __functional/ranges_operations.h + __iterator/advance.h + __iterator/concepts.h + __iterator/distance.h + __iterator/indirectly_comparable.h + __ranges/access.h + __ranges/concepts.h + __ranges/size.h + __ranges/subrange.h + __utility/pair.h + __algorithm/ranges_search_n.h + __algorithm/iterator_operations.h + __algorithm/search_n.h + __algorithm/comp.h + __algorithm/iterator_operations.h + __config + __functional/identity.h + __functional/invoke.h + __iterator/advance.h + __iterator/concepts.h + __iterator/distance.h + __iterator/iterator_traits.h + __ranges/concepts.h + __type_traits/is_callable.h + __utility/convert_to_integral.h + __utility/pair.h + __config + __functional/identity.h + __functional/ranges_operations.h + __iterator/advance.h + __iterator/concepts.h + __iterator/distance.h + __iterator/incrementable_traits.h + __iterator/indirectly_comparable.h + __iterator/iterator_traits.h + __ranges/access.h + __ranges/concepts.h + __ranges/size.h + __ranges/subrange.h + __utility/move.h + __utility/pair.h + __algorithm/ranges_set_difference.h + __algorithm/in_out_result.h + __algorithm/iterator_operations.h + __algorithm/make_projected.h + __algorithm/set_difference.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __algorithm/copy.h + __algorithm/iterator_operations.h + __config + __functional/identity.h + __functional/invoke.h + __iterator/iterator_traits.h + __type_traits/remove_cvref.h + __utility/move.h + __utility/pair.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/mergeable.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __type_traits/decay.h + __utility/move.h + __utility/pair.h + __algorithm/ranges_set_intersection.h + __algorithm/in_in_out_result.h + __algorithm/iterator_operations.h + __algorithm/make_projected.h + __algorithm/set_intersection.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __algorithm/iterator_operations.h + __config + __iterator/iterator_traits.h + __iterator/next.h + __utility/move.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/mergeable.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __algorithm/ranges_set_symmetric_difference.h + __algorithm/in_in_out_result.h + __algorithm/iterator_operations.h + __algorithm/make_projected.h + __algorithm/set_symmetric_difference.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __algorithm/copy.h + __algorithm/iterator_operations.h + __config + __iterator/iterator_traits.h + __utility/move.h + __utility/pair.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/mergeable.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __algorithm/ranges_set_union.h + __algorithm/in_in_out_result.h + __algorithm/iterator_operations.h + __algorithm/make_projected.h + __algorithm/set_union.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __algorithm/copy.h + __algorithm/iterator_operations.h + __config + __iterator/iterator_traits.h + __utility/move.h + __utility/pair.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/mergeable.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/forward.h + __utility/move.h + __algorithm/ranges_shuffle.h + __algorithm/iterator_operations.h + __algorithm/shuffle.h + __algorithm/uniform_random_bit_generator_adaptor.h + __config + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/next.h + __iterator/permutable.h + __random/uniform_random_bit_generator.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __type_traits/remove_reference.h + __utility/forward.h + __utility/move.h + __algorithm/ranges_sort.h + __algorithm/iterator_operations.h + __algorithm/make_projected.h + __algorithm/sort.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/next.h + __iterator/projected.h + __iterator/sortable.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/forward.h + __utility/move.h + __algorithm/ranges_sort_heap.h + __algorithm/iterator_operations.h + __algorithm/make_projected.h + __algorithm/sort_heap.h + __concepts/same_as.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/next.h + __iterator/projected.h + __iterator/sortable.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/forward.h + __utility/move.h + __algorithm/ranges_stable_partition.h + __algorithm/iterator_operations.h + __algorithm/make_projected.h + __algorithm/ranges_iterator_concept.h + __algorithm/stable_partition.h + __algorithm/iterator_operations.h + __algorithm/rotate.h + __config + __iterator/advance.h + __iterator/distance.h + __iterator/iterator_traits.h + __memory/destruct_n.h + __memory/temporary_buffer.h + __memory/unique_ptr.h + __utility/move.h + __utility/pair.h + new + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/next.h + __iterator/permutable.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __ranges/subrange.h + __type_traits/remove_cvref.h + __utility/forward.h + __utility/move.h + __algorithm/ranges_stable_sort.h + __algorithm/iterator_operations.h + __algorithm/make_projected.h + __algorithm/stable_sort.h + __algorithm/comp.h + __algorithm/comp_ref_type.h + __algorithm/inplace_merge.h + __algorithm/iterator_operations.h + __algorithm/sort.h + __config + __iterator/iterator_traits.h + __memory/destruct_n.h + __memory/temporary_buffer.h + __memory/unique_ptr.h + __type_traits/is_trivially_copy_assignable.h + __utility/move.h + __utility/pair.h + new + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/next.h + __iterator/projected.h + __iterator/sortable.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/forward.h + __utility/move.h + __algorithm/ranges_starts_with.h + __algorithm/in_in_result.h + __algorithm/ranges_mismatch.h + __config + __functional/identity.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/indirectly_comparable.h + __ranges/access.h + __ranges/concepts.h + __utility/move.h + __algorithm/ranges_swap_ranges.h + __algorithm/in_in_result.h + __algorithm/iterator_operations.h + __algorithm/swap_ranges.h + __config + __iterator/concepts.h + __iterator/iter_swap.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __algorithm/ranges_transform.h + __algorithm/in_in_out_result.h + __algorithm/in_out_result.h + __concepts/constructible.h + __config + __functional/identity.h + __functional/invoke.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/move.h + __algorithm/ranges_unique.h + __algorithm/iterator_operations.h + __algorithm/make_projected.h + __algorithm/unique.h + __algorithm/adjacent_find.h + __algorithm/comp.h + __algorithm/iterator_operations.h + __config + __iterator/iterator_traits.h + __utility/move.h + __utility/pair.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/permutable.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __ranges/subrange.h + __utility/forward.h + __utility/move.h + __utility/pair.h + __algorithm/ranges_unique_copy.h + __algorithm/in_out_result.h + __algorithm/iterator_operations.h + __algorithm/make_projected.h + __algorithm/unique_copy.h + __algorithm/comp.h + __algorithm/iterator_operations.h + __config + __iterator/iterator_traits.h + __type_traits/conditional.h + __type_traits/is_base_of.h + __type_traits/is_same.h + __utility/move.h + __utility/pair.h + __concepts/same_as.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/projected.h + __iterator/readable_traits.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/forward.h + __utility/move.h + __utility/pair.h + __algorithm/ranges_upper_bound.h + __algorithm/iterator_operations.h + __algorithm/lower_bound.h + __config + __functional/identity.h + __functional/invoke.h + __functional/ranges_operations.h + __iterator/concepts.h + __iterator/projected.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __algorithm/remove.h + __algorithm/remove_copy.h + __config + __algorithm/remove_copy_if.h + __algorithm/remove_if.h + __algorithm/replace.h + __config + __algorithm/replace_copy.h + __config + __algorithm/replace_copy_if.h + __config + __algorithm/replace_if.h + __config + __algorithm/reverse.h + __algorithm/reverse_copy.h + __config + __algorithm/rotate.h + __algorithm/rotate_copy.h + __algorithm/copy.h + __config + __algorithm/sample.h + __algorithm/search.h + __algorithm/search_n.h + __algorithm/set_difference.h + __algorithm/set_intersection.h + __algorithm/set_symmetric_difference.h + __algorithm/set_union.h + __algorithm/shift_left.h + __algorithm/move.h + __config + __iterator/iterator_traits.h + __algorithm/shift_right.h + __algorithm/move.h + __algorithm/move_backward.h + __algorithm/swap_ranges.h + __config + __iterator/iterator_traits.h + __utility/swap.h + __algorithm/shuffle.h + __algorithm/sift_down.h + __algorithm/sort.h + __algorithm/sort_heap.h + __algorithm/stable_partition.h + __algorithm/stable_sort.h + __algorithm/swap_ranges.h + __algorithm/transform.h + __algorithm/unique.h + __algorithm/unique_copy.h + __algorithm/unwrap_iter.h + __algorithm/upper_bound.h + initializer_list + atomic + __assert + __atomic/aliases.h + __atomic/atomic.h + __atomic/atomic_lock_free.h + __config + __atomic/contention_t.h + __atomic/is_always_lock_free.h + __config + __type_traits/conditional.h + cstddef + cstdint + cstdlib + __atomic/atomic.h + __atomic/atomic_base.h + __atomic/atomic_flag.h + __atomic/atomic_sync.h + __atomic/contention_t.h + __atomic/cxx_atomic_impl.h + __atomic/memory_order.h + __chrono/duration.h + __config + __threading_support + cstdint + __atomic/atomic_init.h + __config + __atomic/atomic_lock_free.h + __atomic/atomic_sync.h + __atomic/check_memory_order.h + __atomic/contention_t.h + __atomic/cxx_atomic_impl.h + __atomic/fence.h + __atomic/cxx_atomic_impl.h + __atomic/memory_order.h + __config + __atomic/is_always_lock_free.h + __atomic/kill_dependency.h + __config + __atomic/memory_order.h + __config + version + cmath + compare + cstring + type_traits + bit + __assert + __bit/bit_cast.h + __bit/bit_ceil.h + __assert + __bit/countl.h + __concepts/arithmetic.h + __config + limits + __bit/bit_floor.h + __bit/bit_log2.h + __bit/countl.h + __concepts/arithmetic.h + __config + limits + __concepts/arithmetic.h + __config + limits + __bit/bit_log2.h + __bit/bit_width.h + __bit/bit_log2.h + __concepts/arithmetic.h + __config + __bit/blsr.h + __bit/byteswap.h + __concepts/arithmetic.h + __config + cstdint + __bit/countl.h + __bit/countr.h + __bit/endian.h + __config + __bit/has_single_bit.h + __concepts/arithmetic.h + __config + __undef_macros + __bit/popcount.h + __bit/rotate.h + __concepts/arithmetic.h + __config + limits + __undef_macros + __bit/rotate.h + __config + version + cstdlib + iosfwd + limits + type_traits + concepts + __assert + __concepts/arithmetic.h + __concepts/assignable.h + __concepts/boolean_testable.h + __concepts/class_or_enum.h + __concepts/common_reference_with.h + __concepts/common_with.h + __concepts/common_reference_with.h + __concepts/same_as.h + __config + __type_traits/add_lvalue_reference.h + __type_traits/common_reference.h + __type_traits/common_type.h + __utility/declval.h + __concepts/constructible.h + __concepts/convertible_to.h + __concepts/copyable.h + __concepts/derived_from.h + __concepts/destructible.h + __concepts/different_from.h + __concepts/equality_comparable.h + __concepts/invocable.h + __concepts/movable.h + __concepts/predicate.h + __concepts/regular.h + __concepts/relation.h + __concepts/same_as.h + __concepts/semiregular.h + __concepts/swappable.h + __concepts/totally_ordered.h + __config + version + type_traits + cstdlib + cstring + iterator + concepts + __assert + __config + __debug + __iterator/access.h + __iterator/advance.h + __iterator/back_insert_iterator.h + __config + __iterator/iterator.h + __iterator/iterator_traits.h + __memory/addressof.h + __utility/move.h + cstddef + __iterator/bounded_iter.h + __iterator/common_iterator.h + __assert + __concepts/assignable.h + __concepts/constructible.h + __concepts/convertible_to.h + __concepts/copyable.h + __concepts/derived_from.h + __concepts/equality_comparable.h + __concepts/same_as.h + __config + __iterator/concepts.h + __iterator/incrementable_traits.h + __iterator/iter_move.h + __iterator/iter_swap.h + __iterator/iterator_traits.h + __iterator/readable_traits.h + __memory/addressof.h + __type_traits/is_pointer.h + __utility/declval.h + variant + __assert + __availability + __compare/common_comparison_category.h + __compare/compare_three_way_result.h + __compare/three_way_comparable.h + __config + __exception/exception.h + __functional/hash.h + __functional/invoke.h + __functional/operations.h + __functional/unary_function.h + __memory/addressof.h + __type_traits/add_const.h + __type_traits/add_cv.h + __type_traits/add_pointer.h + __type_traits/add_volatile.h + __type_traits/dependent_type.h + __type_traits/is_array.h + __type_traits/is_destructible.h + __type_traits/is_nothrow_move_constructible.h + __type_traits/is_trivially_copy_assignable.h + __type_traits/is_trivially_copy_constructible.h + __type_traits/is_trivially_destructible.h + __type_traits/is_trivially_move_assignable.h + __type_traits/is_trivially_move_constructible.h + __type_traits/is_void.h + __type_traits/remove_const.h + __type_traits/type_identity.h + __type_traits/void_t.h + __utility/declval.h + __utility/forward.h + __utility/in_place.h + __utility/move.h + __utility/swap.h + __variant/monostate.h + __compare/ordering.h + __config + __functional/hash.h + cstddef + __verbose_abort + initializer_list + limits + new + tuple + version + compare + __undef_macros + exception + type_traits + typeinfo + utility + __iterator/concepts.h + __iterator/counted_iterator.h + __assert + __concepts/assignable.h + __concepts/common_with.h + __concepts/constructible.h + __concepts/convertible_to.h + __concepts/same_as.h + __config + __iterator/concepts.h + __iterator/default_sentinel.h + __config + __iterator/incrementable_traits.h + __iterator/iter_move.h + __iterator/iter_swap.h + __iterator/iterator_traits.h + __iterator/readable_traits.h + __memory/pointer_traits.h + __type_traits/add_pointer.h + __type_traits/conditional.h + __utility/move.h + compare + __iterator/data.h + __iterator/default_sentinel.h + __iterator/distance.h + __iterator/empty.h + __iterator/erase_if_container.h + __config + __iterator/front_insert_iterator.h + __config + __iterator/iterator.h + __iterator/iterator_traits.h + __memory/addressof.h + __utility/move.h + cstddef + __iterator/incrementable_traits.h + __iterator/indirectly_comparable.h + __iterator/insert_iterator.h + __config + __iterator/iterator.h + __iterator/iterator_traits.h + __memory/addressof.h + __ranges/access.h + __utility/move.h + cstddef + __iterator/istream_iterator.h + __config + __iterator/default_sentinel.h + __iterator/iterator.h + __iterator/iterator_traits.h + __memory/addressof.h + cstddef + iosfwd + __iterator/istreambuf_iterator.h + __config + __iterator/default_sentinel.h + __iterator/iterator.h + __iterator/iterator_traits.h + iosfwd + __iterator/iter_move.h + __iterator/iter_swap.h + __iterator/iterator.h + __iterator/iterator_traits.h + __iterator/mergeable.h + __iterator/move_iterator.h + __compare/compare_three_way_result.h + __compare/three_way_comparable.h + __concepts/assignable.h + __concepts/convertible_to.h + __concepts/derived_from.h + __concepts/same_as.h + __config + __iterator/concepts.h + __iterator/incrementable_traits.h + __iterator/iter_move.h + __iterator/iter_swap.h + __iterator/iterator_traits.h + __iterator/move_sentinel.h + __concepts/assignable.h + __concepts/convertible_to.h + __concepts/semiregular.h + __config + __utility/move.h + __iterator/readable_traits.h + __type_traits/conditional.h + __type_traits/enable_if.h + __type_traits/is_assignable.h + __type_traits/is_constructible.h + __type_traits/is_convertible.h + __type_traits/is_reference.h + __type_traits/is_same.h + __type_traits/remove_reference.h + __utility/declval.h + __utility/move.h + __iterator/move_sentinel.h + __iterator/next.h + __iterator/ostream_iterator.h + __config + __iterator/iterator.h + __iterator/iterator_traits.h + __memory/addressof.h + cstddef + iosfwd + __iterator/ostreambuf_iterator.h + __config + __iterator/iterator.h + __iterator/iterator_traits.h + cstddef + iosfwd + __iterator/permutable.h + __iterator/prev.h + __iterator/projected.h + __iterator/readable_traits.h + __iterator/reverse_access.h + __iterator/reverse_iterator.h + __iterator/size.h + __iterator/sortable.h + __iterator/unreachable_sentinel.h + __iterator/wrap_iter.h + __memory/addressof.h + __memory/pointer_traits.h + cstddef + initializer_list + version + compare + concepts + cstdlib + exception + new + type_traits + typeinfo + utility + memory + __assert + __config + __memory/addressof.h + __memory/align.h + __config + cstddef + __memory/allocate_at_least.h + __memory/allocation_guard.h + __config + __memory/allocator_traits.h + __utility/move.h + cstddef + __memory/allocator.h + __memory/allocator_arg_t.h + __memory/allocator_traits.h + __memory/assume_aligned.h + __assert + __config + __type_traits/is_constant_evaluated.h + cstddef + cstdint + __memory/auto_ptr.h + __memory/compressed_pair.h + __memory/concepts.h + __concepts/same_as.h + __config + __iterator/concepts.h + __iterator/iterator_traits.h + __iterator/readable_traits.h + __ranges/access.h + __ranges/concepts.h + __type_traits/is_reference.h + __type_traits/remove_cvref.h + __memory/construct_at.h + __memory/pointer_traits.h + __memory/ranges_construct_at.h + __concepts/destructible.h + __config + __iterator/incrementable_traits.h + __iterator/readable_traits.h + __memory/concepts.h + __memory/construct_at.h + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __utility/declval.h + __utility/forward.h + __utility/move.h + new + __memory/ranges_uninitialized_algorithms.h + __algorithm/in_out_result.h + __concepts/constructible.h + __config + __iterator/concepts.h + __iterator/incrementable_traits.h + __iterator/iter_move.h + __iterator/iterator_traits.h + __iterator/readable_traits.h + __memory/concepts.h + __memory/uninitialized_algorithms.h + __algorithm/copy.h + __algorithm/move.h + __algorithm/unwrap_iter.h + __algorithm/unwrap_range.h + __config + __iterator/iterator_traits.h + __iterator/reverse_iterator.h + __memory/addressof.h + __memory/allocator_traits.h + __memory/construct_at.h + __memory/pointer_traits.h + __memory/voidify.h + __type_traits/extent.h + __type_traits/is_array.h + __type_traits/is_constant_evaluated.h + __type_traits/is_trivially_copy_assignable.h + __type_traits/is_trivially_copy_constructible.h + __type_traits/is_trivially_move_assignable.h + __type_traits/is_trivially_move_constructible.h + __type_traits/is_unbounded_array.h + __type_traits/negation.h + __type_traits/remove_const.h + __type_traits/remove_extent.h + __utility/exception_guard.h + __utility/move.h + __utility/pair.h + new + __ranges/access.h + __ranges/concepts.h + __ranges/dangling.h + __type_traits/remove_reference.h + __utility/move.h + new + __memory/raw_storage_iterator.h + __config + __iterator/iterator.h + __iterator/iterator_traits.h + __memory/addressof.h + __utility/move.h + cstddef + new + __memory/shared_ptr.h + __availability + __compare/compare_three_way.h + __compare/ordering.h + __config + __functional/binary_function.h + __functional/operations.h + __functional/reference_wrapper.h + __config + __functional/invoke.h + __functional/weak_result_type.h + __config + __functional/binary_function.h + __functional/invoke.h + __functional/unary_function.h + __type_traits/integral_constant.h + __type_traits/is_same.h + __utility/declval.h + __memory/addressof.h + __type_traits/enable_if.h + __type_traits/remove_cvref.h + __utility/declval.h + __utility/forward.h + __iterator/access.h + __memory/addressof.h + __memory/allocation_guard.h + __memory/allocator.h + __memory/allocator_destructor.h + __config + __memory/allocator_traits.h + __memory/allocator_traits.h + __memory/auto_ptr.h + __memory/compressed_pair.h + __memory/construct_at.h + __memory/pointer_traits.h + __memory/uninitialized_algorithms.h + __memory/unique_ptr.h + __type_traits/add_lvalue_reference.h + __type_traits/conditional.h + __type_traits/conjunction.h + __type_traits/disjunction.h + __type_traits/is_array.h + __type_traits/is_bounded_array.h + __type_traits/is_convertible.h + __type_traits/is_move_constructible.h + __type_traits/is_reference.h + __type_traits/is_unbounded_array.h + __type_traits/nat.h + __type_traits/negation.h + __type_traits/remove_extent.h + __type_traits/remove_reference.h + __utility/declval.h + __utility/forward.h + __utility/move.h + __utility/swap.h + __verbose_abort + cstddef + iosfwd + new + stdexcept + typeinfo + __atomic/memory_order.h + __memory/temporary_buffer.h + __memory/uninitialized_algorithms.h + __memory/unique_ptr.h + __memory/uses_allocator.h + __memory/uses_allocator_construction.h + __config + __memory/construct_at.h + __memory/uses_allocator.h + __type_traits/enable_if.h + __type_traits/is_same.h + __type_traits/remove_cv.h + __utility/declval.h + __utility/pair.h + tuple + version + compare + atomic + concepts + cstddef + cstdint + cstdlib + cstring + iosfwd + iterator + new + stdexcept + tuple + type_traits + typeinfo + utility + stdexcept + type_traits + utility + concepts + cstdlib + iterator + type_traits + version + cwchar + __iterator/access.h + __iterator/data.h + __iterator/empty.h + __iterator/reverse_access.h + __iterator/size.h + compare + initializer_list + __undef_macros + algorithm + concepts + cstdlib + iterator + new + type_traits + typeinfo + utility +``` diff --git a/ctl/optional.h b/ctl/optional.h new file mode 100644 index 000000000..fb30ae0e9 --- /dev/null +++ b/ctl/optional.h @@ -0,0 +1,125 @@ +// -*-mode:c++;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8-*- +// vi: set et ft=c++ ts=4 sts=4 sw=4 fenc=utf-8 :vi +#ifndef COSMOPOLITAN_CTL_OPTIONAL_H_ +#define COSMOPOLITAN_CTL_OPTIONAL_H_ +#include <__utility/forward.h> +#include <__utility/move.h> +#include <__utility/swap.h> + +template +class Optional +{ + public: + using value_type = T; + + ~Optional() = default; + + Optional() noexcept : present_(false) + { + } + + Optional(const T& value) : present_(true), value_(value) + { + } + + Optional(T&& value) : present_(true), value_(std::move(value)) + { + } + + Optional(const Optional& other) : present_(other.present_) + { + if (present_) + new (&value_) T(other.value_); + } + + Optional(Optional&& other) noexcept : present_(other.present_) + { + if (present_) + value_ = std::move(other.value_); + } + + Optional& operator=(const Optional& other) + { + if (this != &other) { + present_ = other.present_; + if (present_) + value_ = other.value_; + } + return *this; + } + + Optional& operator=(Optional&& other) noexcept + { + if (this != &other) { + present_ = other.present_; + if (present_) + value_ = std::move(other.value_); + } + return *this; + } + + T& value() & + { + if (!present_) + __builtin_trap(); + return value_; + } + + const T& value() const& + { + if (!present_) + __builtin_trap(); + return value_; + } + + T&& value() && + { + if (!present_) + __builtin_trap(); + return std::move(value_); + } + + explicit operator bool() const noexcept + { + return present_; + } + + bool has_value() const noexcept + { + return present_; + } + + void reset() noexcept + { + if (present_) { + value_.~T(); + present_ = false; + } + } + + template + void emplace(Args&&... args) + { + present_ = true; + value_ = T(std::forward(args)...); + } + + void swap(Optional& other) noexcept + { + if (present_ && other.present_) { + std::swap(value_, other.value_); + } else if (present_) { + other.emplace(std::move(value_)); + reset(); + } else if (other.present_) { + emplace(std::move(other.value_)); + other.reset(); + } + } + + private: + bool present_; + T value_; +}; + +#endif // COSMOPOLITAN_CTL_OPTIONAL_H_ diff --git a/ctl/string.cc b/ctl/string.cc new file mode 100644 index 000000000..6cc8d3509 --- /dev/null +++ b/ctl/string.cc @@ -0,0 +1,439 @@ +// -*- mode:c++; indent-tabs-mode:nil; c-basic-offset:4; coding:utf-8 -*- +// vi: set et ft=c++ ts=4 sts=4 sw=4 fenc=utf-8 +// +// Copyright 2024 Justine Alexandra Roberts Tunney +// +// Permission to use, copy, modify, and/or distribute this software for +// any purpose with or without fee is hereby granted, provided that the +// above copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL +// WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +// AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL +// DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR +// PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +// PERFORMANCE OF THIS SOFTWARE. + +#include "string.h" + +#include <__atomic/fence.h> +#include + +String::~String() noexcept +{ + if (n) { + if (n >= c) + __builtin_trap(); + if (p[n]) + __builtin_trap(); + } + if (c && !p) + __builtin_trap(); + free(p); +} + +String::String(const char* s) noexcept +{ + append(s, strlen(s)); +} + +String::String(const String& s) noexcept +{ + append(s.p, s.n); +} + +String::String(const StringView s) noexcept +{ + append(s.p, s.n); +} + +String::String(size_t size, char ch) noexcept +{ + resize(size, ch); +} + +String::String(const char* s, size_t size) noexcept +{ + append(s, size); +} + +const char* +String::c_str() const noexcept +{ + if (!n) + return ""; + if (n >= c) + __builtin_trap(); + if (p[n]) + __builtin_trap(); + return p; +} + +void +String::reserve(size_t c2) noexcept +{ + char* p2; + if (c2 < n) + c2 = n; + if (ckd_add(&c2, c2, 15)) + __builtin_trap(); + c2 &= -16; + if (!(p2 = (char*)realloc(p, c2))) + __builtin_trap(); + std::atomic_signal_fence(std::memory_order_seq_cst); + c = c2; + p = p2; +} + +void +String::resize(size_t n2, char ch) noexcept +{ + size_t c2; + if (ckd_add(&c2, n2, 1)) + __builtin_trap(); + reserve(c2); + if (n2 > n) + memset(p + n, ch, n2 - n); + p[n = n2] = 0; +} + +void +String::append(char ch) noexcept +{ + if (n + 2 > c) { + size_t c2 = c + 2; + c2 += c2 >> 1; + reserve(c2); + } + p[n++] = ch; + p[n] = 0; +} + +void +String::grow(size_t size) noexcept +{ + size_t need; + if (ckd_add(&need, n, size)) + __builtin_trap(); + if (ckd_add(&need, need, 1)) + __builtin_trap(); + if (need <= c) + return; + size_t c2 = c; + if (!c2) { + c2 = need; + } else { + while (c2 < need) + if (ckd_add(&c2, c2, c2 >> 1)) + __builtin_trap(); + } + reserve(c2); +} + +void +String::append(char ch, size_t size) noexcept +{ + grow(size); + if (size) + memset(p + n, ch, size); + p[n += size] = 0; +} + +void +String::append(const void* data, size_t size) noexcept +{ + grow(size); + if (size) + memcpy(p + n, data, size); + p[n += size] = 0; +} + +void +String::pop_back() noexcept +{ + if (!n) + __builtin_trap(); + p[--n] = 0; +} + +String& +String::operator=(String&& s) noexcept +{ + if (p != s.p) { + free(p); + p = s.p; + n = s.n; + c = s.c; + s.p = nullptr; + s.n = 0; + s.c = 0; + } + return *this; +} + +static String +StrCat(const StringView lhs, const StringView rhs) noexcept +{ + String res; + size_t need; + if (ckd_add(&need, lhs.n, rhs.n)) + __builtin_trap(); + if (ckd_add(&need, need, 1)) + __builtin_trap(); + res.reserve(need); + if (lhs.n) + memcpy(res.p, lhs.p, lhs.n); + if (rhs.n) + memcpy(res.p + lhs.n, rhs.p, rhs.n); + res.p[res.n = lhs.n + rhs.n] = 0; + return res; +} + +String +StringView::operator+(const StringView s) const noexcept +{ + return StrCat(*this, s); +} + +String +String::operator+(const StringView s) const noexcept +{ + return StrCat(*this, s); +} + +bool +String::operator==(const StringView s) const noexcept +{ + if (n != s.n) + return false; + return !memcmp(p, s.p, n); +} + +bool +String::operator!=(const StringView s) const noexcept +{ + if (n != s.n) + return true; + return !!memcmp(p, s.p, n); +} + +bool +String::contains(const StringView s) const noexcept +{ + if (!s.n) + return true; + return !!memmem(p, n, s.p, s.n); +} + +bool +String::ends_with(const StringView s) const noexcept +{ + if (n < s.n) + return false; + return !memcmp(p + n - s.n, s.p, s.n); +} + +bool +String::starts_with(const StringView s) const noexcept +{ + if (n < s.n) + return false; + return !memcmp(p, s.p, s.n); +} + +static int +StrCmp(const StringView lhs, const StringView rhs) noexcept +{ + int r; + size_t m = lhs.n; + if ((m = rhs.n < m ? rhs.n : m)) + if ((r = memcmp(lhs.p, rhs.p, m))) + return r; + if (lhs.n == rhs.n) + return 0; + if (m < lhs.n) + return +1; + return -1; +} + +int +String::compare(const StringView s) const noexcept +{ + return StrCmp(*this, s); +} + +size_t +String::find(char ch, size_t pos) const noexcept +{ + char* q; + if ((q = (char*)memchr(p, ch, n))) + return q - p; + return npos; +} + +size_t +String::find(const StringView s, size_t pos) const noexcept +{ + char* q; + if (pos > n) + __builtin_trap(); + if ((q = (char*)memmem(p + pos, n - pos, s.p, s.n))) + return q - p; + return npos; +} + +String +String::substr(size_t pos, size_t count) const noexcept +{ + size_t last; + if (pos > n) + __builtin_trap(); + if (count > n - pos) + count = n - pos; + if (ckd_add(&last, pos, count)) + last = n; + if (last > n) + __builtin_trap(); + return String(p + pos, count); +} + +String& +String::replace(size_t pos, size_t count, const StringView& s) noexcept +{ + size_t last; + if (ckd_add(&last, pos, count)) + __builtin_trap(); + if (last > n) + __builtin_trap(); + size_t need; + if (ckd_add(&need, pos, s.n)) + __builtin_trap(); + size_t extra = n - last; + if (ckd_add(&need, need, extra)) + __builtin_trap(); + size_t c2; + if (ckd_add(&c2, need, 1)) + __builtin_trap(); + reserve(c2); + if (extra) + memmove(p + pos + s.n, p + last, extra); + memcpy(p + pos, s.p, s.n); + p[n = need] = 0; + return *this; +} + +int +StringView::compare(const StringView s) const noexcept +{ + return StrCmp(*this, s); +} + +size_t +StringView::find(char ch, size_t pos) const noexcept +{ + char* q; + if (n && (q = (char*)memchr(p, ch, n))) + return q - p; + return npos; +} + +size_t +StringView::find(const StringView s, size_t pos) const noexcept +{ + char* q; + if (pos > n) + __builtin_trap(); + if ((q = (char*)memmem(p + pos, n - pos, s.p, s.n))) + return q - p; + return npos; +} + +StringView +StringView::substr(size_t pos, size_t count) const noexcept +{ + size_t last; + if (pos > n) + __builtin_trap(); + if (count > n - pos) + count = n - pos; + if (ckd_add(&last, pos, count)) + last = n; + if (last > n) + __builtin_trap(); + return StringView(p + pos, count); +} + +String& +String::insert(size_t i, const StringView s) noexcept +{ + if (i > n) + __builtin_trap(); + size_t extra = n - i; + size_t need; + if (ckd_add(&need, n, s.n)) + __builtin_trap(); + if (ckd_add(&need, need, 1)) + __builtin_trap(); + reserve(need); + if (extra) + memmove(p + i + s.n, p + i, extra); + memcpy(p + i, s.p, s.n); + p[n += s.n] = 0; + return *this; +} + +String& +String::erase(size_t pos, size_t count) noexcept +{ + if (pos > n) + __builtin_trap(); + if (count > n - pos) + count = n - pos; + size_t extra = n - (pos + count); + if (extra) + memmove(p + pos, p + pos + count, extra); + p[n = pos + extra] = 0; + return *this; +} + +bool +StringView::operator==(const StringView s) const noexcept +{ + if (n == s.n) + return true; + return !memcmp(p, s.p, n); +} + +bool +StringView::operator!=(const StringView s) const noexcept +{ + if (n != s.n) + return true; + return !!memcmp(p, s.p, n); +} + +bool +StringView::contains(const StringView s) const noexcept +{ + if (!s.n) + return true; + return !!memmem(p, n, s.p, s.n); +} + +bool +StringView::ends_with(const StringView s) const noexcept +{ + if (n < s.n) + return false; + return !memcmp(p + n - s.n, s.p, s.n); +} + +bool +StringView::starts_with(const StringView s) const noexcept +{ + if (n < s.n) + return false; + return !memcmp(p, s.p, s.n); +} diff --git a/ctl/string.h b/ctl/string.h new file mode 100644 index 000000000..5630367c2 --- /dev/null +++ b/ctl/string.h @@ -0,0 +1,320 @@ +// -*-mode:c++;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8-*- +// vi: set et ft=c++ ts=4 sts=4 sw=4 fenc=utf-8 :vi +#ifndef COSMOPOLITAN_CTL_STRING_H_ +#define COSMOPOLITAN_CTL_STRING_H_ + +struct String; + +struct StringView +{ + const char* p; + size_t n; + + static constexpr size_t npos = -1; + + constexpr StringView(const char* s) noexcept + : p(s), n(s ? __builtin_strlen(s) : 0) + { + } + + constexpr StringView(const char* s, size_t n) noexcept : p(s), n(n) + { + } + + inline constexpr ~StringView() noexcept + { + } + + int compare(const StringView) const noexcept; + bool operator==(const StringView) const noexcept; + bool operator!=(const StringView) const noexcept; + bool contains(const StringView) const noexcept; + String operator+(const StringView) const noexcept; + bool ends_with(const StringView) const noexcept; + bool starts_with(const StringView) const noexcept; + StringView substr(size_t = 0, size_t = npos) const noexcept; + size_t find(char, size_t = 0) const noexcept; + size_t find(const StringView, size_t = 0) const noexcept; + + constexpr StringView& operator=(const StringView& s) noexcept + { + p = s.p; + n = s.n; + return *this; + } + + constexpr bool empty() const noexcept + { + return !n; + } + + constexpr const char* data() const noexcept + { + return p; + } + + constexpr size_t size() const noexcept + { + return n; + } + + constexpr size_t length() const noexcept + { + return n; + } + + constexpr const char& operator[](size_t i) const noexcept + { + if (i >= n) + __builtin_trap(); + return p[i]; + } + + constexpr void remove_prefix(size_t count) + { + if (count > n) + __builtin_trap(); + p += count; + n -= count; + } + + constexpr void remove_suffix(size_t count) + { + if (count > n) + __builtin_trap(); + n -= count; + } + + bool operator<(const StringView& s) const noexcept + { + return compare(s) < 0; + } + + bool operator<=(const StringView& s) const noexcept + { + return compare(s) <= 0; + } + + bool operator>(const StringView& s) const noexcept + { + return compare(s) > 0; + } + + bool operator>=(const StringView& s) const noexcept + { + return compare(s) >= 0; + } +}; + +struct String +{ + char* p = nullptr; + size_t n = 0; + size_t c = 0; + + using iterator = char*; + using const_iterator = const char*; + static constexpr size_t npos = -1; + + ~String() noexcept; + String() = default; + String(const StringView) noexcept; + String(const char*) noexcept; + String(const String&) noexcept; + String(const char*, size_t) noexcept; + explicit String(size_t, char = 0) noexcept; + String& operator=(String&&) noexcept; + const char* c_str() const noexcept; + + void pop_back() noexcept; + void grow(size_t) noexcept; + void reserve(size_t) noexcept; + void resize(size_t, char = 0) noexcept; + void append(char) noexcept; + void append(char, size_t) noexcept; + void append(unsigned long) noexcept; + void append(const void*, size_t) noexcept; + String& insert(size_t, const StringView) noexcept; + String& erase(size_t = 0, size_t = npos) noexcept; + String operator+(const StringView) const noexcept; + String substr(size_t = 0, size_t = npos) const noexcept; + String& replace(size_t, size_t, const StringView&) noexcept; + bool operator==(const StringView) const noexcept; + bool operator!=(const StringView) const noexcept; + bool contains(const StringView) const noexcept; + bool ends_with(const StringView) const noexcept; + bool starts_with(const StringView) const noexcept; + int compare(const StringView) const noexcept; + size_t find(char, size_t = 0) const noexcept; + size_t find(const StringView, size_t = 0) const noexcept; + + String(String&& s) noexcept : p(s.p), n(s.n), c(s.c) + { + s.p = nullptr; + s.n = 0; + s.c = 0; + } + + void clear() noexcept + { + n = 0; + } + + bool empty() const noexcept + { + return !n; + } + + char* data() const noexcept + { + return p; + } + + size_t size() const noexcept + { + return n; + } + + size_t length() const noexcept + { + return n; + } + + size_t capacity() const noexcept + { + return c; + } + + iterator begin() noexcept + { + return p; + } + + iterator end() noexcept + { + return p + n; + } + + const_iterator cbegin() const noexcept + { + return p; + } + + const_iterator cend() const noexcept + { + return p + n; + } + + char& front() + { + if (!n) + __builtin_trap(); + return p[0]; + } + + const char& front() const + { + if (!n) + __builtin_trap(); + return p[0]; + } + + char& back() + { + if (!n) + __builtin_trap(); + return p[n - 1]; + } + + const char& back() const + { + if (!n) + __builtin_trap(); + return p[n - 1]; + } + + char& operator[](size_t i) noexcept + { + if (i >= n) + __builtin_trap(); + return p[i]; + } + + const char& operator[](size_t i) const noexcept + { + if (i >= n) + __builtin_trap(); + return p[i]; + } + + void push_back(char ch) noexcept + { + append(ch); + } + + void append(const StringView s) noexcept + { + append(s.p, s.n); + } + + inline constexpr operator StringView() const noexcept + { + return StringView(p, n); + } + + String& operator=(const char* s) noexcept + { + clear(); + append(s); + return *this; + } + + String& operator=(const StringView s) noexcept + { + clear(); + append(s); + return *this; + } + + String& operator+=(char x) noexcept + { + append(x); + return *this; + } + + String& operator+=(const StringView s) noexcept + { + append(s); + return *this; + } + + bool operator<(const StringView s) const noexcept + { + return compare(s) < 0; + } + + bool operator<=(const StringView s) const noexcept + { + return compare(s) <= 0; + } + + bool operator>(const StringView s) const noexcept + { + return compare(s) > 0; + } + + bool operator>=(const StringView s) const noexcept + { + return compare(s) >= 0; + } +}; + +#pragma GCC diagnostic ignored "-Wliteral-suffix" + +inline String +operator"" s(const char* s, size_t n) +{ + return String(s, n); +} + +#endif // COSMOPOLITAN_CTL_STRING_H_ diff --git a/ctl/vector.h b/ctl/vector.h new file mode 100644 index 000000000..d0ed97ffe --- /dev/null +++ b/ctl/vector.h @@ -0,0 +1,242 @@ +// -*-mode:c++;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8-*- +// vi: set et ft=c++ ts=4 sts=4 sw=4 fenc=utf-8 :vi +#ifndef COSMOPOLITAN_CTL_OPTIONAL_H_ +#define COSMOPOLITAN_CTL_OPTIONAL_H_ +#include <__utility/forward.h> +#include <__utility/move.h> +#include <__utility/swap.h> + +template +struct Vector +{ + size_t n = 0; + size_t c = 0; + T* p = nullptr; + + using iterator = T*; + using const_iterator = const T*; + + Vector() = default; + + ~Vector() + { + delete[] p; + } + + Vector(const Vector& other) + { + n = other.n; + c = other.c; + p = new T[c]; + for (size_t i = 0; i < n; ++i) + new (&p[i]) T(other.p[i]); + } + + Vector(Vector&& other) noexcept + { + n = other.n; + c = other.c; + p = other.p; + other.n = 0; + other.c = 0; + other.p = nullptr; + } + + explicit Vector(size_t count, const T& value = T()) + { + n = count; + c = count; + p = new T[c]; + for (size_t i = 0; i < n; ++i) + new (&p[i]) T(value); + } + + Vector& operator=(const Vector& other) + { + if (this != &other) { + T* newData = new T[other.c]; + for (size_t i = 0; i < other.n; ++i) { + newData[i] = other.p[i]; + } + delete[] p; + p = newData; + n = other.n; + c = other.c; + } + return *this; + } + + Vector& operator=(Vector&& other) noexcept + { + if (this != &other) { + delete[] p; + p = other.p; + n = other.n; + c = other.c; + other.p = nullptr; + other.n = 0; + other.c = 0; + } + return *this; + } + + bool empty() const + { + return !n; + } + + size_t size() const + { + return n; + } + + size_t capacity() const + { + return c; + } + + T& operator[](size_t i) + { + if (i >= n) + __builtin_trap(); + return p[i]; + } + + const T& operator[](size_t i) const + { + if (i >= n) + __builtin_trap(); + return p[i]; + } + + iterator begin() + { + return p; + } + + iterator end() + { + return p + n; + } + + const_iterator cbegin() const + { + return p; + } + + const_iterator cend() const + { + return p + n; + } + + T& front() + { + if (!n) + __builtin_trap(); + return p[0]; + } + + const T& front() const + { + if (!n) + __builtin_trap(); + return p[0]; + } + + T& back() + { + if (!n) + __builtin_trap(); + return p[n - 1]; + } + + const T& back() const + { + if (!n) + __builtin_trap(); + return p[n - 1]; + } + + void clear() + { + for (size_t i = 0; i < n; ++i) + p[i].~T(); + n = 0; + } + + void reserve(size_t c2) + { + if (c2 <= c) + return; + T* newP = new T[c2]; + for (size_t i = 0; i < n; ++i) + newP[i] = std::move(p[i]); + delete[] p; + p = newP; + c = c2; + } + + void push_back(const T& e) + { + if (n == c) { + size_t c2 = c + 1; + c2 += c2 >> 1; + reserve(c2); + } + new (&p[n]) T(e); + ++n; + } + + void push_back(T&& e) + { + if (n == c) { + size_t c2 = c + 1; + c2 += c2 >> 1; + reserve(c2); + } + new (&p[n]) T(std::forward(e)); + ++n; + } + + template + void emplace_back(Args&&... args) + { + if (n == c) { + size_t c2 = c + 1; + c2 += c2 >> 1; + reserve(c2); + } + new (&p[n]) T(std::forward(args)...); + ++n; + } + + void pop_back() + { + if (n > 0) { + --n; + p[n].~T(); + } + } + + void resize(size_t n2) + { + if (n2 > n) { + reserve(n2); + for (size_t i = n; i < n2; ++i) + new (&p[i]) T(); + } else if (n2 < n) { + for (size_t i = n2; i < n; ++i) + p[i].~T(); + } + n = n2; + } + + void swap(Vector& other) noexcept + { + std::swap(n, other.n); + std::swap(c, other.c); + std::swap(p, other.p); + } +}; + +#endif // COSMOPOLITAN_CTL_OPTIONAL_H_ diff --git a/test/BUILD.mk b/test/BUILD.mk index 63d89de46..b5d7a55d5 100644 --- a/test/BUILD.mk +++ b/test/BUILD.mk @@ -2,7 +2,8 @@ #── vi: set noet ft=make ts=8 sw=8 fenc=utf-8 :vi ────────────────────┘ .PHONY: o/$(MODE)/test -o/$(MODE)/test: o/$(MODE)/test/dsp \ +o/$(MODE)/test: o/$(MODE)/test/ctl \ + o/$(MODE)/test/dsp \ o/$(MODE)/test/libc \ o/$(MODE)/test/libcxx \ o/$(MODE)/test/math \ diff --git a/test/ctl/.clang-format b/test/ctl/.clang-format new file mode 100644 index 000000000..9daf0a9e9 --- /dev/null +++ b/test/ctl/.clang-format @@ -0,0 +1,12 @@ +--- +BasedOnStyle: Mozilla +IndentWidth: 4 +ColumnLimit: 80 +--- +Language: Cpp +AllowShortFunctionsOnASingleLine: false +AlignTrailingComments: false +AlignEscapedNewlines: DontAlign +AlwaysBreakTemplateDeclarations: true +ConstructorInitializerAllOnOneLineOrOnePerLine: true +--- diff --git a/test/ctl/BUILD.mk b/test/ctl/BUILD.mk new file mode 100644 index 000000000..3c45b36e2 --- /dev/null +++ b/test/ctl/BUILD.mk @@ -0,0 +1,38 @@ +#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐ +#── vi: set noet ft=make ts=8 sw=8 fenc=utf-8 :vi ────────────────────┘ + +PKGS += TEST_CTL + +TEST_CTL_FILES := $(wildcard test/ctl/*) +TEST_CTL_SRCS = $(filter %.cc,$(TEST_CTL_FILES)) +TEST_CTL_OBJS = $(TEST_CTL_SRCS:%.cc=o/$(MODE)/%.o) +TEST_CTL_COMS = $(TEST_CTL_OBJS:%.o=%) +TEST_CTL_BINS = $(TEST_CTL_COMS) $(TEST_CTL_COMS:%=%.dbg) +TEST_CTL_CHECKS = $(TEST_CTL_COMS:%=%.runs) +TEST_CTL_TESTS = $(TEST_CTL_COMS:%=%.ok) + +TEST_CTL_DIRECTDEPS = \ + CTL \ + LIBC_INTRIN \ + LIBC_LOG \ + THIRD_PARTY_LIBCXX \ + +TEST_CTL_DEPS := \ + $(call uniq,$(foreach x,$(TEST_CTL_DIRECTDEPS),$($(x)))) + +o/$(MODE)/test/ctl/ctl.pkg: \ + $(TEST_CTL_OBJS) \ + $(foreach x,$(TEST_CTL_DIRECTDEPS),$($(x)_A).pkg) + +o/$(MODE)/test/ctl/%.dbg: \ + $(TEST_CTL_DEPS) \ + o/$(MODE)/test/ctl/%.o \ + o/$(MODE)/test/ctl/ctl.pkg \ + $(CRT) \ + $(APE_NO_MODIFY_SELF) + @$(APELINK) + +.PHONY: o/$(MODE)/test/ctl +o/$(MODE)/test/ctl: \ + $(TEST_CTL_BINS) \ + $(TEST_CTL_CHECKS) diff --git a/test/ctl/optional_test.cc b/test/ctl/optional_test.cc new file mode 100644 index 000000000..96247581d --- /dev/null +++ b/test/ctl/optional_test.cc @@ -0,0 +1,114 @@ +// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*- +// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :vi +// +// Copyright 2024 Mozilla Foundation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "ctl/optional.h" + +#include + +#include "ctl/string.h" + +int +main() +{ + + { + Optional x; + if (x) + return 1; + if (x.has_value()) + return 2; + } + + { + Optional x(42); + if (!x) + return 3; + if (!x.has_value()) + return 4; + if (x.value() != 42) + return 5; + } + + { + Optional x("hello"); + Optional y(x); + if (!y) + return 6; + if (!y.has_value()) + return 7; + if (y.value() != "hello") + return 8; + } + + { + Optional x("world"); + Optional y(std::move(x)); + if (!y) + return 9; + if (!y.has_value()) + return 10; + if (y.value() != "world") + return 11; + } + + { + Optional x(42); + Optional y; + y = x; + if (!y) + return 13; + if (!y.has_value()) + return 14; + if (y.value() != 42) + return 15; + } + + { + Optional x("hello"); + Optional y; + y = std::move(x); + if (!y) + return 16; + if (!y.has_value()) + return 17; + if (y.value() != "hello") + return 18; + } + + { + Optional x(42); + x.reset(); + if (x) + return 20; + if (x.has_value()) + return 21; + } + + { + Optional x; + x.emplace("hello"); + if (!x) + return 22; + if (!x.has_value()) + return 23; + if (x.value() != "hello") + return 24; + } + + CheckForMemoryLeaks(); + return 0; +} diff --git a/test/ctl/string_test.cc b/test/ctl/string_test.cc new file mode 100644 index 000000000..3de4ebd79 --- /dev/null +++ b/test/ctl/string_test.cc @@ -0,0 +1,371 @@ +// -*- mode:c++; indent-tabs-mode:nil; c-basic-offset:4; coding:utf-8 -*- +// vi: set et ft=c++ ts=4 sts=4 sw=4 fenc=utf-8 +// +// Copyright 2024 Justine Alexandra Roberts Tunney +// +// Permission to use, copy, modify, and/or distribute this software for +// any purpose with or without fee is hereby granted, provided that the +// above copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL +// WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +// AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL +// DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR +// PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +// PERFORMANCE OF THIS SOFTWARE. + +#include "ctl/string.h" + +#include <__utility/move.h> + +#include "libc/runtime/runtime.h" +#include "libc/str/str.h" + +// #include +// #define String std::string + +int +main(int argc, char* argv[]) +{ + + { + String s; + s += 'h'; + s += 'i'; + if (s != "hi") + return 1; + } + + { + String s; + if (!s.empty()) + return 6; + s.reserve(32); + if (!s.empty()) + return 7; + if (!s.starts_with("")) + return 8; + if (s.starts_with("a")) + return 9; + s += "abc"; + if (!s.starts_with("a")) + return 10; + } + + { + String s; + s += "hello world how are you"; + s.reserve(3); + if (s != "hello world how are you") + return 11; + } + + { + String s(4, 'x'); + if (s != "xxxx") + return 12; + s.resize(3); + if (s != "xxx") + return 13; + s.resize(4, 'y'); + if (s != "xxxy") + return 14; + } + + { + String a = "a"; + String b = "a"; + if (a.compare(b) != 0) + return 17; + } + + { + String a = "a"; + String b = "b"; + if (a.compare(b) >= 0) + return 18; + } + + { + String a = "a"; + String b = "ab"; + if (a.compare(b) >= 0) + return 19; + } + + { + String a = "ab"; + String b = "a"; + if (a.compare(b) <= 0) + return 20; + } + + { + String a = ""; + String b = ""; + if (a.compare(b) != 0) + return 21; + } + + { + String a = "fooBARbaz"; + if (a.substr(3, 3) != "BAR") + return 22; + if (a.replace(3, 3, "MOO") != "fooMOObaz") + return 23; + } + + { + String a = "fooBAR"; + if (a.substr(3, 3) != "BAR") + return 24; + if (a.replace(3, 3, "MOO") != "fooMOO") + return 25; + } + + { + String a = "fooBAR"; + if (a.substr(1, 0) != "") + return 26; + if (a.replace(1, 0, "MOO") != "fMOOooBAR") + return 27; + if (!a.starts_with("fMOOooBAR")) + return 28; + if (!a.ends_with("")) + return 29; + if (!a.ends_with("BAR")) + return 30; + if (a.ends_with("bar")) + return 31; + } + + { + String s1 = "hello"; + String s2 = "world"; + String s3 = s1 + " " + s2; + if (s3 != "hello world") + return 32; + } + + { + String s = "hello"; + if (s.size() != 5) + return 33; + if (s.length() != 5) + return 34; + if (s.capacity() < 5) + return 35; + } + + { + String s = "hello"; + if (s[0] != 'h' || s[1] != 'e' || s[2] != 'l' || s[3] != 'l' || + s[4] != 'o') + return 36; + s[0] = 'H'; + if (s != "Hello") + return 37; + } + + { + String s = "hello"; + if (s.find('e') != 1) + return 38; + if (s.find('l') != 2) + return 39; + if (s.find('x') != String::npos) + return 40; + } + + { + String s = "hello"; + if (!s.ends_with("lo")) + return 41; + if (s.ends_with("el")) + return 42; + } + + { + String s = "hello"; + String sub = s.substr(1, 3); + if (sub != "ell") + return 43; + sub = s.substr(2); + if (sub != "llo") + return 44; + } + + { + String s = "hello"; + String s2 = s; + if (s != s2) + return 45; + s2[0] = 'H'; + if (s == s2) + return 46; + } + + { + String s = "hello"; + String s2 = std::move(s); + if (s2 != "hello") + return 47; + if (!s.empty()) + return 48; + } + + { + String s = "hello"; + const char* cstr = s.c_str(); + if (strcmp(cstr, "hello") != 0) + return 49; + } + + // { + // String s = "hello"; + // char buffer[10]; + // s.copy(buffer, sizeof(buffer)); + // if (strcmp(buffer, "hello") != 0) + // return 50; + // } + + { + String s = "hello"; + s.resize(3); + if (s != "hel") + return 51; + s.resize(10, 'x'); + if (s != "helxxxxxxx") + return 52; + } + + { + String s = "hello"; + s.clear(); + if (!s.empty()) + return 53; + } + + { + String s = "hello"; + auto it = s.begin(); + if (*it != 'h') + return 54; + ++it; + if (*it != 'e') + return 55; + } + + // { + // String s = "hello"; + // String s2 = "world"; + // s.swap(s2); + // if (s != "world" || s2 != "hello") + // return 56; + // } + + { + String s = "hello"; + if (s.front() != 'h' || s.back() != 'o') + return 57; + } + + { + String s = "hello"; + s.push_back('!'); + if (s != "hello!") + return 58; + s.pop_back(); + if (s != "hello") + return 59; + } + + { + String s = "hello"; + s.insert(2, "XYZ"); + if (s != "heXYZllo") + return 60; + } + + { + String s = "hello"; + s.erase(1, 2); + if (s != "hlo") + return 61; + } + + { + String s = "hello"; + s.replace(1, 2, "XYZ"); + if (s != "hXYZlo") + return 62; + } + + { + String s = "hello"; + s.append(" world"); + if (s != "hello world") + return 63; + } + + // { + // String s = "hello"; + // s.assign("world"); + // if (s != "world") + // return 64; + // } + + { + String s = "hello"; + if (s.compare("world") >= 0) + return 65; + if (s.compare("hello") != 0) + return 66; + if (s.compare("hallo") <= 0) + return 67; + } + + { + String s = "hello"; + if (s == "world") + return 68; + if (s != "hello") + return 69; + if (s < "hallo") + return 70; + if (s > "world") + return 71; + } + + { + StringView s = "hello"; + if (s.find('e') != 1) + return 72; + if (s.find('l') != 2) + return 73; + if (s.find('x') != String::npos) + return 74; + } + + { + StringView s = "hello there"; + s.remove_prefix(6); + if (s != "there") + return 75; + s.remove_suffix(1); + if (s != "ther") + return 76; + } + + { + if ("hello"s != "hello") + return 77; + if ("hell"s + "o" != "hello") + return 78; + } + + CheckForMemoryLeaks(); + return 0; +} diff --git a/test/ctl/vector_test.cc b/test/ctl/vector_test.cc new file mode 100644 index 000000000..11b1b6225 --- /dev/null +++ b/test/ctl/vector_test.cc @@ -0,0 +1,320 @@ +// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*- +// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :vi +// +// Copyright 2024 Mozilla Foundation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "ctl/vector.h" + +#include +#include + +#include "ctl/string.h" + +// #include +// #include +// #define String std::string +// #define Vector std::vector + +int +main(int argc, char* argv[]) +{ + + { + int x = 3; + Vector A; + A.push_back(1); + A.push_back(2); + A.push_back(x); + if (A[0] != 1) + return 1; + if (A[1] != 2) + return 2; + if (A[2] != 3) + return 3; + if (A.size() != 3) + return 4; + } + + { + String yo = "foo"; + Vector A; + A.push_back("fun"); + A.push_back(std::move(yo)); + if (yo != "") + return 5; + A.emplace_back("bar"); + if (A[0] != "fun") + return 7; + if (A[1] != "foo") + return 8; + if (A[2] != "bar") + return 9; + if (A.size() != 3) + return 10; + } + + { + Vector A; + if (!A.empty()) + return 11; + A.push_back(5); + if (A.empty()) + return 12; + if (A.front() != 5) + return 13; + if (A.back() != 5) + return 14; + } + + { + Vector A; + A.push_back(1); + A.push_back(2); + A.push_back(3); + Vector B(A); + if (B.size() != 3) + return 15; + if (B[0] != 1 || B[1] != 2 || B[2] != 3) + return 16; + } + + { + Vector A; + A.push_back(1); + A.push_back(2); + A.push_back(3); + Vector B(std::move(A)); + if (A.size() != 0) + return 17; + if (B.size() != 3) + return 18; + if (B[0] != 1 || B[1] != 2 || B[2] != 3) + return 19; + } + + { + Vector A; + A.push_back(1); + A.push_back(2); + A.push_back(3); + Vector B; + B = A; + if (B.size() != 3) + return 20; + if (B[0] != 1 || B[1] != 2 || B[2] != 3) + return 21; + } + + { + Vector A; + A.push_back(1); + A.push_back(2); + A.push_back(3); + Vector B; + B = std::move(A); + if (A.size() != 0) + return 22; + if (B.size() != 3) + return 23; + if (B[0] != 1 || B[1] != 2 || B[2] != 3) + return 24; + } + + { + Vector A; + A.push_back(1); + A.push_back(2); + A.push_back(3); + A.pop_back(); + if (A.size() != 2) + return 25; + if (A[0] != 1 || A[1] != 2) + return 26; + } + + { + Vector A; + A.resize(5); + if (A.size() != 5) + return 27; + A.resize(3); + if (A.size() != 3) + return 28; + } + + { + Vector A; + A.push_back(1); + A.push_back(2); + A.push_back(3); + Vector B; + B.push_back(4); + B.push_back(5); + A.swap(B); + if (A.size() != 2) + return 29; + if (B.size() != 3) + return 30; + if (A[0] != 4 || A[1] != 5) + return 31; + if (B[0] != 1 || B[1] != 2 || B[2] != 3) + return 32; + } + + { + Vector A; + A.push_back(1); + A.push_back(2); + A.push_back(3); + A.clear(); + if (A.size() != 0) + return 33; + if (!A.empty()) + return 34; + } + + { + Vector A; + A.push_back(1); + A.push_back(2); + A.push_back(3); + Vector::iterator it = A.begin(); + if (*it != 1) + return 35; + ++it; + if (*it != 2) + return 36; + ++it; + if (*it != 3) + return 37; + ++it; + if (it != A.end()) + return 38; + } + + { + Vector A; + A.push_back(1); + A.push_back(2); + A.push_back(3); + Vector::const_iterator cit = A.cbegin(); + if (*cit != 1) + return 39; + ++cit; + if (*cit != 2) + return 40; + ++cit; + if (*cit != 3) + return 41; + ++cit; + if (cit != A.cend()) + return 42; + } + + { + Vector A; + for (int i = 0; i < 100; ++i) { + A.push_back(i); + } + if (A.size() != 100) + return 51; + for (int i = 0; i < 100; ++i) { + if (A[i] != i) + return 52; + } + } + + { + Vector A; + A.push_back(1); + A.push_back(2); + A.push_back(3); + Vector B(A); + if (B.size() != 3) + return 53; + B.push_back(4); + if (A.size() != 3) + return 54; + if (B.size() != 4) + return 55; + } + + { + Vector A; + A.reserve(100); + if (A.size() != 0) + return 56; + if (A.capacity() != 100) + return 57; + A.push_back(1); + if (A.size() != 1) + return 58; + if (A.capacity() != 100) + return 59; + } + + { + Vector A; + A.push_back(1); + A.push_back(2); + A.push_back(3); + Vector B; + B = A; + if (B.size() != 3) + return 60; + B.push_back(4); + if (A.size() != 3) + return 61; + if (B.size() != 4) + return 62; + } + + { + Vector A; + A.push_back(1); + A.push_back(2); + A.push_back(3); + Vector B; + B = std::move(A); + if (A.size() != 0) + return 63; + if (B.size() != 3) + return 64; + if (B[0] != 1 || B[1] != 2 || B[2] != 3) + return 65; + } + + { + Vector A; + A.push_back(1); + A.push_back(2); + A.push_back(3); + Vector B; + B.push_back(4); + B.push_back(5); + A.swap(B); + if (A.size() != 2) + return 66; + if (B.size() != 3) + return 67; + if (A[0] != 4 || A[1] != 5) + return 68; + if (B[0] != 1 || B[1] != 2 || B[2] != 3) + return 69; + } + + CheckForMemoryLeaks(); + return 0; +} diff --git a/tool/emacs/cosmo-stuff.el b/tool/emacs/cosmo-stuff.el index d8dc17376..c18fbec96 100644 --- a/tool/emacs/cosmo-stuff.el +++ b/tool/emacs/cosmo-stuff.el @@ -211,7 +211,11 @@ (dots (file-relative-name root dir)) ;; e.g. "../" (file (file-relative-name this root)) ;; e.g. "libc/crc32c.c" (name (file-name-sans-extension file)) ;; e.g. "libc/crc32c" - (buddy (format "test/%s_test.c" name)) + (buddy (let ((c-version (format "test/%s_test.c" name)) + (cc-version (format "test/%s_test.cc" name))) + (if (file-exists-p cc-version) + cc-version + c-version))) (runs (format "o/$m/%s%s V=5 TESTARGS=-b" name runsuffix)) (buns (format "o/$m/test/%s_test%s V=5 TESTARGS=-b" name runsuffix))) (cond ((not (member ext '("c" "cc" "cpp" "s" "S" "rl" "f" "cu"))) @@ -761,8 +765,14 @@ (concat dots notest ".hookabi.c") (concat dots notest ".h")))) (t - (format "%stest/%s_test.c" - dots (cosmo-file-name-sans-extensions name)))))) + (let ((c-version (format "%stest/%s_test.c" + dots (cosmo-file-name-sans-extensions name))) + (cc-version (format "%stest/%s_test.cc" + dots (cosmo-file-name-sans-extensions name)))) + (if (file-exists-p cc-version) + cc-version + c-version)) + )))) (when buddy (find-file buddy)))))) diff --git a/tool/scripts/explain-deps.py b/tool/scripts/explain-deps.py index f53f521f4..15b289011 100755 --- a/tool/scripts/explain-deps.py +++ b/tool/scripts/explain-deps.py @@ -5,23 +5,41 @@ import re import sys def GetDeps(path): - def Dive(path, depth, visited): + visited = set() + def Dive(path, inside, depth, that_isnt=None): sys.stdout.write('%s%s' % ('\t' * depth, path)) - if path in visited: - sys.stdout.write(' cycle\n') - return sys.stdout.write('\n') + if path in visited: + return + visited.add(path) + if not os.path.exists(path): + if inside: + samedir = os.path.join(os.path.dirname(inside), path) + if inside and os.path.exists(samedir) and samedir != that_isnt: + path = samedir + elif os.path.exists('third_party/libcxx/' + path) and 'third_party/libcxx/' + path != that_isnt: + path = 'third_party/libcxx/' + path + elif os.path.exists('libc/isystem/' + path): + path = 'libc/isystem/' + path + else: + # sys.stderr.write('not found: %s\n' % (path)) + return with open(path) as f: code = f.read() - for dep in re.findall(r'[.#]include "([^"]+)"', code): - Dive(dep, depth + 1, visited + [path]) - Dive(path, 0, []) - sys.stdout.write('\n') + for dep in re.findall(r'[.#]\s*include\s+[<"]([^">]+)[">]', code): + Dive(dep, path, depth + 1) + for dep in re.findall(r'[.#]\s*include_next\s+[<"]([^">]+)[">]', code): + Dive(dep, path, depth + 1, path) + Dive(path, None, 0) +once = False for arg in sys.argv[1:]: if os.path.isdir(arg): for dirpath, dirs, files in os.walk(arg): for filepath in files: + if not once: + sys.stdout.write('\n') + once = True GetDeps(os.path.join(dirpath, filepath)) else: GetDeps(arg)