@zigc/lib 0.17.0-dev.27 → 0.17.0-dev.296
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/c/fcntl.zig +6 -1
- package/c/inttypes.zig +0 -10
- package/c/math.zig +52 -112
- package/c/pthread.zig +57 -0
- package/c/search.zig +1 -27
- package/c/stdlib/drand48.zig +0 -57
- package/c/stdlib.zig +31 -121
- package/c/string.zig +20 -7
- package/c/strings.zig +0 -38
- package/c/unistd.zig +27 -26
- package/c/wchar.zig +10 -0
- package/c.zig +2 -2
- package/compiler/aro/aro/CodeGen.zig +7 -8
- package/compiler/aro/aro/Compilation.zig +17 -17
- package/compiler/aro/aro/Driver.zig +14 -13
- package/compiler/aro/aro/Parser.zig +20 -15
- package/compiler/aro/aro/Pragma.zig +3 -2
- package/compiler/aro/aro/Preprocessor.zig +9 -6
- package/compiler/aro/aro/pragmas/message.zig +3 -2
- package/compiler/aro/aro/text_literal.zig +3 -2
- package/compiler/aro/assembly_backend/x86_64.zig +4 -4
- package/compiler/build_runner.zig +2 -4
- package/compiler/reduce/Walk.zig +8 -13
- package/compiler/resinator/compile.zig +1 -1
- package/compiler/resinator/cvtres.zig +4 -4
- package/compiler/resinator/errors.zig +7 -7
- package/compiler/resinator/ico.zig +4 -4
- package/compiler/resinator/parse.zig +2 -2
- package/compiler/resinator/res.zig +1 -1
- package/compiler/std-docs.zig +1 -1
- package/compiler/test_runner.zig +1 -1
- package/compiler/translate-c/MacroTranslator.zig +1 -1
- package/compiler/translate-c/Translator.zig +6 -2
- package/compiler/translate-c/ast.zig +16 -23
- package/compiler/translate-c/main.zig +1 -1
- package/compiler_rt/addf3.zig +1 -1
- package/compiler_rt/arm.zig +3 -3
- package/compiler_rt/atomics.zig +1 -1
- package/compiler_rt/comparef.zig +3 -3
- package/compiler_rt/cos.zig +1 -3
- package/compiler_rt/count0bits.zig +1 -1
- package/compiler_rt/divdf3.zig +2 -2
- package/compiler_rt/divsf3.zig +1 -1
- package/compiler_rt/divtf3.zig +1 -1
- package/compiler_rt/divxf3.zig +1 -1
- package/compiler_rt/exp.zig +0 -2
- package/compiler_rt/exp2.zig +0 -2
- package/compiler_rt/extendf.zig +5 -5
- package/compiler_rt/fabs.zig +1 -3
- package/compiler_rt/float_from_int.zig +3 -4
- package/compiler_rt/fma.zig +0 -2
- package/compiler_rt/fmax.zig +1 -3
- package/compiler_rt/fmin.zig +1 -3
- package/compiler_rt/fmod.zig +2 -4
- package/compiler_rt/limb64.zig +3 -2
- package/compiler_rt/log.zig +0 -2
- package/compiler_rt/log10.zig +0 -2
- package/compiler_rt/log2.zig +0 -2
- package/compiler_rt/mulf3.zig +2 -2
- package/compiler_rt/rem_pio2l.zig +1 -1
- package/compiler_rt/round.zig +0 -2
- package/compiler_rt/sin.zig +1 -3
- package/compiler_rt/sincos.zig +1 -3
- package/compiler_rt/sqrt.zig +0 -2
- package/compiler_rt/ssp.zig +2 -2
- package/compiler_rt/tan.zig +1 -3
- package/compiler_rt/trunc.zig +0 -2
- package/compiler_rt/truncf.zig +3 -3
- package/compiler_rt/trunctfhf2.zig +3 -0
- package/compiler_rt.zig +5 -26
- package/docs/wasm/Walk.zig +1 -3
- package/docs/wasm/html_render.zig +1 -2
- package/docs/wasm/markdown/Parser.zig +16 -20
- package/fuzzer.zig +2 -0
- package/include/__clang_spirv_builtins.h +12 -12
- package/include/__float_float.h +176 -0
- package/include/__float_header_macro.h +12 -0
- package/include/__float_infinity_nan.h +20 -0
- package/include/amo.h +131 -0
- package/include/amxavx512intrin.h +215 -1
- package/include/amxintrin.h +0 -2
- package/include/arm_acle.h +37 -27
- package/include/arm_neon.h +218 -82
- package/include/arm_sme.h +8 -8
- package/include/arm_sve.h +4162 -3782
- package/include/avx10_2_512bf16intrin.h +19 -12
- package/include/avx10_2_512convertintrin.h +1 -1
- package/include/avx10_2_512niintrin.h +31 -31
- package/include/avx10_2_512satcvtdsintrin.h +1 -1
- package/include/avx10_2bf16intrin.h +54 -45
- package/include/avx10_2convertintrin.h +2 -2
- package/include/avx10_2copyintrin.h +1 -1
- package/include/avx10_2niintrin.h +14 -14
- package/include/avx10_2satcvtdsintrin.h +2 -2
- package/include/avx2intrin.h +275 -377
- package/include/avx512bf16intrin.h +25 -16
- package/include/avx512bitalgintrin.h +19 -30
- package/include/avx512bwintrin.h +386 -505
- package/include/avx512cdintrin.h +42 -55
- package/include/avx512dqintrin.h +132 -161
- package/include/avx512fintrin.h +1015 -1424
- package/include/avx512fp16intrin.h +112 -110
- package/include/avx512ifmaintrin.h +32 -34
- package/include/avx512ifmavlintrin.h +73 -46
- package/include/avx512vbmi2intrin.h +43 -32
- package/include/avx512vbmiintrin.h +19 -27
- package/include/avx512vbmivlintrin.h +35 -49
- package/include/avx512vlbf16intrin.h +32 -22
- package/include/avx512vlbitalgintrin.h +37 -53
- package/include/avx512vlbwintrin.h +470 -573
- package/include/avx512vlcdintrin.h +74 -102
- package/include/avx512vldqintrin.h +110 -127
- package/include/avx512vlfp16intrin.h +130 -111
- package/include/avx512vlintrin.h +945 -1299
- package/include/avx512vlvbmi2intrin.h +78 -63
- package/include/avx512vlvnniintrin.h +21 -18
- package/include/avx512vlvp2intersectintrin.h +2 -2
- package/include/avx512vnniintrin.h +10 -10
- package/include/avx512vp2intersectintrin.h +1 -2
- package/include/avx512vpopcntdqintrin.h +8 -10
- package/include/avx512vpopcntdqvlintrin.h +17 -15
- package/include/avxifmaintrin.h +16 -0
- package/include/avxintrin.h +165 -241
- package/include/avxvnniint16intrin.h +118 -99
- package/include/avxvnniint8intrin.h +56 -32
- package/include/avxvnniintrin.h +16 -8
- package/include/cpuid.h +101 -4
- package/include/emmintrin.h +168 -168
- package/include/f16cintrin.h +23 -9
- package/include/float.h +16 -155
- package/include/fma4intrin.h +98 -96
- package/include/fmaintrin.h +96 -66
- package/include/gfniintrin.h +21 -16
- package/include/hexagon_types.h +23 -20
- package/include/hvx_hexagon_protos.h +649 -860
- package/include/immintrin.h +0 -12
- package/include/intrin.h +4 -0
- package/include/lasxintrin.h +113 -0
- package/include/llvm_libc_wrappers/assert.h +3 -5
- package/include/llvm_libc_wrappers/ctype.h +3 -115
- package/include/llvm_libc_wrappers/inttypes.h +3 -5
- package/include/llvm_libc_wrappers/stdio.h +10 -38
- package/include/llvm_libc_wrappers/stdlib.h +3 -24
- package/include/llvm_libc_wrappers/string.h +2 -70
- package/include/llvm_libc_wrappers/time.h +4 -10
- package/include/mmintrin.h +188 -257
- package/include/module.modulemap +23 -4
- package/include/movrs_avx10_2_512intrin.h +2 -2
- package/include/movrs_avx10_2intrin.h +4 -4
- package/include/pmmintrin.h +12 -24
- package/include/ptrauth.h +16 -2
- package/include/riscv_mips.h +34 -0
- package/include/riscv_nds.h +89 -0
- package/include/sifive_vector.h +58 -2
- package/include/sm4evexintrin.h +2 -2
- package/include/smmintrin.h +77 -59
- package/include/spirvintrin.h +194 -0
- package/include/stddefer.h +19 -0
- package/include/tmmintrin.h +116 -147
- package/include/vaesintrin.h +1 -2
- package/include/xmmintrin.h +44 -70
- package/include/xopintrin.h +20 -10
- package/libc/include/aarch64-linux-any/asm/hwcap.h +1 -0
- package/libc/include/aarch64-linux-any/asm/unistd_64.h +1 -0
- package/libc/include/any-linux-any/asm-generic/errno.h +2 -0
- package/libc/include/any-linux-any/asm-generic/unistd.h +4 -1
- package/libc/include/any-linux-any/drm/amdgpu_drm.h +20 -6
- package/libc/include/any-linux-any/drm/amdxdna_accel.h +8 -0
- package/libc/include/any-linux-any/drm/drm_fourcc.h +6 -6
- package/libc/include/any-linux-any/drm/panfrost_drm.h +75 -1
- package/libc/include/any-linux-any/drm/panthor_drm.h +154 -3
- package/libc/include/any-linux-any/drm/rocket_accel.h +74 -24
- package/libc/include/any-linux-any/drm/xe_drm.h +89 -6
- package/libc/include/any-linux-any/linux/android/binder.h +1 -1
- package/libc/include/any-linux-any/linux/bpf.h +28 -0
- package/libc/include/any-linux-any/linux/btrfs.h +1 -0
- package/libc/include/any-linux-any/linux/btrfs_tree.h +32 -2
- package/libc/include/any-linux-any/linux/dma-buf.h +1 -0
- package/libc/include/any-linux-any/linux/dpll.h +1 -0
- package/libc/include/any-linux-any/linux/elf.h +2 -0
- package/libc/include/any-linux-any/linux/ethtool.h +21 -5
- package/libc/include/any-linux-any/linux/fs.h +1 -0
- package/libc/include/any-linux-any/linux/hyperv.h +1 -1
- package/libc/include/any-linux-any/linux/idxd.h +134 -134
- package/libc/include/any-linux-any/linux/if_alg.h +1 -1
- package/libc/include/any-linux-any/linux/if_link.h +1 -0
- package/libc/include/any-linux-any/linux/input-event-codes.h +4 -0
- package/libc/include/any-linux-any/linux/io_uring/bpf_filter.h +68 -0
- package/libc/include/any-linux-any/linux/io_uring/query.h +5 -1
- package/libc/include/any-linux-any/linux/io_uring.h +33 -2
- package/libc/include/any-linux-any/linux/iommufd.h +39 -0
- package/libc/include/any-linux-any/linux/kfd_ioctl.h +13 -3
- package/libc/include/any-linux-any/linux/kfd_sysfs.h +2 -1
- package/libc/include/any-linux-any/linux/kvm.h +30 -6
- package/libc/include/any-linux-any/linux/landlock.h +22 -8
- package/libc/include/any-linux-any/linux/magic.h +1 -0
- package/libc/include/any-linux-any/linux/mempolicy.h +3 -0
- package/libc/include/any-linux-any/linux/mount.h +11 -2
- package/libc/include/any-linux-any/linux/mptcp_pm.h +1 -1
- package/libc/include/any-linux-any/linux/mshv.h +2 -0
- package/libc/include/any-linux-any/linux/netfilter_bridge.h +5 -4
- package/libc/include/any-linux-any/linux/netfilter_ipv4.h +4 -5
- package/libc/include/any-linux-any/linux/netfilter_ipv6.h +3 -4
- package/libc/include/any-linux-any/linux/nfs.h +1 -1
- package/libc/include/any-linux-any/linux/nfsd_netlink.h +1 -0
- package/libc/include/any-linux-any/linux/nilfs2_api.h +2 -2
- package/libc/include/any-linux-any/linux/nilfs2_ondisk.h +97 -66
- package/libc/include/any-linux-any/linux/nl80211.h +104 -3
- package/libc/include/any-linux-any/linux/pci.h +7 -0
- package/libc/include/any-linux-any/linux/pci_regs.h +65 -6
- package/libc/include/any-linux-any/linux/pcitest.h +1 -0
- package/libc/include/any-linux-any/linux/perf_event.h +24 -3
- package/libc/include/any-linux-any/linux/pkt_sched.h +1 -0
- package/libc/include/any-linux-any/linux/prctl.h +30 -0
- package/libc/include/any-linux-any/linux/rseq.h +62 -5
- package/libc/include/any-linux-any/linux/shm.h +0 -1
- package/libc/include/any-linux-any/linux/stddef.h +4 -0
- package/libc/include/any-linux-any/linux/sysctl.h +1 -2
- package/libc/include/any-linux-any/linux/taskstats.h +12 -1
- package/libc/include/any-linux-any/linux/tcp.h +23 -3
- package/libc/include/any-linux-any/linux/typelimits.h +8 -0
- package/libc/include/any-linux-any/linux/ublk_cmd.h +120 -1
- package/libc/include/any-linux-any/linux/v4l2-controls.h +63 -0
- package/libc/include/any-linux-any/linux/vbox_vmmdev_types.h +2 -2
- package/libc/include/any-linux-any/linux/vduse.h +80 -5
- package/libc/include/any-linux-any/linux/version.h +3 -3
- package/libc/include/any-linux-any/linux/vfio.h +4 -0
- package/libc/include/any-linux-any/linux/videodev2.h +3 -0
- package/libc/include/any-linux-any/linux/virtio_ring.h +1 -2
- package/libc/include/any-linux-any/linux/vmclock-abi.h +20 -0
- package/libc/include/any-linux-any/rdma/bnxt_re-abi.h +16 -0
- package/libc/include/any-linux-any/rdma/ib_user_ioctl_cmds.h +16 -0
- package/libc/include/any-linux-any/rdma/mana-abi.h +3 -0
- package/libc/include/any-linux-any/scsi/scsi_bsg_ufs.h +8 -9
- package/libc/include/any-linux-any/sound/sof/tokens.h +6 -0
- package/libc/include/arc-linux-any/asm/swab.h +0 -63
- package/libc/include/arc-linux-any/asm/unistd_32.h +1 -0
- package/libc/include/arm-linux-any/asm/ptrace.h +0 -9
- package/libc/include/arm-linux-any/asm/unistd-eabi.h +1 -0
- package/libc/include/arm-linux-any/asm/unistd-oabi.h +1 -0
- package/libc/include/csky-linux-any/asm/unistd_32.h +1 -0
- package/libc/include/hexagon-linux-any/asm/unistd_32.h +1 -0
- package/libc/include/loongarch-linux-any/asm/hwcap.h +1 -0
- package/libc/include/loongarch-linux-any/asm/kvm.h +1 -0
- package/libc/include/loongarch-linux-any/asm/kvm_para.h +1 -0
- package/libc/include/loongarch-linux-any/asm/unistd_32.h +2 -0
- package/libc/include/loongarch-linux-any/asm/unistd_64.h +2 -0
- package/libc/include/m68k-linux-any/asm/unistd_32.h +1 -0
- package/libc/include/mips-linux-any/asm/errno.h +2 -0
- package/libc/include/mips-linux-any/asm/unistd_n32.h +1 -0
- package/libc/include/mips-linux-any/asm/unistd_n64.h +1 -0
- package/libc/include/mips-linux-any/asm/unistd_o32.h +1 -0
- package/libc/include/powerpc-linux-any/asm/unistd_32.h +1 -0
- package/libc/include/powerpc-linux-any/asm/unistd_64.h +1 -0
- package/libc/include/riscv-linux-any/asm/hwprobe.h +4 -0
- package/libc/include/riscv-linux-any/asm/kvm.h +3 -0
- package/libc/include/riscv-linux-any/asm/ptrace.h +37 -0
- package/libc/include/riscv-linux-any/asm/sigcontext.h +1 -0
- package/libc/include/riscv-linux-any/asm/unistd_32.h +1 -0
- package/libc/include/riscv-linux-any/asm/unistd_64.h +1 -0
- package/libc/include/s390x-linux-any/asm/unistd_64.h +1 -0
- package/libc/include/sparc-linux-any/asm/errno.h +2 -0
- package/libc/include/sparc-linux-any/asm/ioctls.h +4 -4
- package/libc/include/sparc-linux-any/asm/unistd_32.h +2 -0
- package/libc/include/sparc-linux-any/asm/unistd_64.h +2 -0
- package/libc/include/x86-linux-any/asm/auxvec.h +0 -4
- package/libc/include/x86-linux-any/asm/kvm.h +13 -8
- package/libc/include/x86-linux-any/asm/svm.h +16 -16
- package/libc/include/x86-linux-any/asm/unistd_32.h +1 -0
- package/libc/include/x86-linux-any/asm/unistd_64.h +1 -0
- package/libc/include/x86-linux-any/asm/unistd_x32.h +1 -0
- package/libc/include/xtensa-linux-any/asm/unistd_32.h +1 -0
- package/libc/musl/arch/mipsn32/syscall_arch.h +35 -32
- package/libcxx/include/__algorithm/all_of.h +11 -5
- package/libcxx/include/__algorithm/comp.h +4 -0
- package/libcxx/include/__algorithm/copy.h +28 -147
- package/libcxx/include/__algorithm/copy_backward.h +9 -24
- package/libcxx/include/__algorithm/copy_n.h +50 -16
- package/libcxx/include/__algorithm/count.h +2 -2
- package/libcxx/include/__algorithm/equal.h +43 -55
- package/libcxx/include/__algorithm/fill.h +26 -8
- package/libcxx/include/__algorithm/fill_n.h +32 -46
- package/libcxx/include/__algorithm/find.h +96 -39
- package/libcxx/include/__algorithm/find_end.h +105 -0
- package/libcxx/include/__algorithm/for_each.h +18 -24
- package/libcxx/include/__algorithm/for_each_n.h +20 -47
- package/libcxx/include/__algorithm/for_each_n_segment.h +1 -1
- package/libcxx/include/__algorithm/for_each_segment.h +26 -0
- package/libcxx/include/__algorithm/generate.h +4 -2
- package/libcxx/include/__algorithm/generate_n.h +19 -6
- package/libcxx/include/__algorithm/is_permutation.h +4 -4
- package/libcxx/include/__algorithm/iterator_operations.h +3 -0
- package/libcxx/include/__algorithm/lexicographical_compare.h +2 -2
- package/libcxx/include/__algorithm/lexicographical_compare_three_way.h +6 -6
- package/libcxx/include/__algorithm/make_heap.h +16 -4
- package/libcxx/include/__algorithm/mismatch.h +2 -2
- package/libcxx/include/__algorithm/move.h +8 -19
- package/libcxx/include/__algorithm/move_backward.h +9 -24
- package/libcxx/include/__algorithm/none_of.h +4 -4
- package/libcxx/include/__algorithm/partial_sort.h +1 -1
- package/libcxx/include/__algorithm/partial_sort_copy.h +1 -1
- package/libcxx/include/__algorithm/pstl.h +9 -9
- package/libcxx/include/__algorithm/radix_sort.h +27 -25
- package/libcxx/include/__algorithm/ranges_copy_n.h +3 -26
- package/libcxx/include/__algorithm/ranges_equal.h +17 -26
- package/libcxx/include/__algorithm/ranges_fill.h +7 -6
- package/libcxx/include/__algorithm/ranges_for_each.h +9 -1
- package/libcxx/include/__algorithm/ranges_generate_n.h +2 -6
- package/libcxx/include/__algorithm/ranges_search_n.h +2 -2
- package/libcxx/include/__algorithm/rotate.h +27 -44
- package/libcxx/include/__algorithm/search_n.h +49 -37
- package/libcxx/include/__algorithm/sift_down.h +19 -18
- package/libcxx/include/__algorithm/simd_utils.h +33 -4
- package/libcxx/include/__algorithm/specialized_algorithms.h +54 -0
- package/libcxx/include/__algorithm/stable_sort.h +1 -1
- package/libcxx/include/__assertion_handler +31 -4
- package/libcxx/include/__atomic/atomic.h +36 -60
- package/libcxx/include/__atomic/atomic_flag.h +19 -37
- package/libcxx/include/__atomic/atomic_ref.h +29 -12
- package/libcxx/include/__atomic/atomic_sync.h +127 -55
- package/libcxx/include/__atomic/atomic_sync_timed.h +144 -0
- package/libcxx/include/__atomic/atomic_waitable_traits.h +103 -0
- package/libcxx/include/__atomic/contention_t.h +27 -3
- package/libcxx/include/__atomic/floating_point_helper.h +55 -0
- package/libcxx/include/__bit/countl.h +1 -2
- package/libcxx/include/__bit/countr.h +1 -2
- package/libcxx/include/__bit/has_single_bit.h +1 -1
- package/libcxx/include/__bit/popcount.h +0 -1
- package/libcxx/include/__bit/rotate.h +15 -26
- package/libcxx/include/__bit_reference +207 -18
- package/libcxx/include/__charconv/from_chars_integral.h +1 -1
- package/libcxx/include/__charconv/from_chars_result.h +1 -1
- package/libcxx/include/__charconv/to_chars_integral.h +1 -0
- package/libcxx/include/__charconv/to_chars_result.h +1 -1
- package/libcxx/include/__charconv/traits.h +3 -24
- package/libcxx/include/__chrono/day.h +11 -0
- package/libcxx/include/__chrono/duration.h +58 -33
- package/libcxx/include/__chrono/file_clock.h +4 -2
- package/libcxx/include/__chrono/is_clock.h +72 -0
- package/libcxx/include/__chrono/leap_second.h +13 -0
- package/libcxx/include/__chrono/month.h +13 -0
- package/libcxx/include/__chrono/month_weekday.h +22 -0
- package/libcxx/include/__chrono/monthday.h +20 -0
- package/libcxx/include/__chrono/steady_clock.h +1 -1
- package/libcxx/include/__chrono/system_clock.h +3 -3
- package/libcxx/include/__chrono/time_point.h +37 -13
- package/libcxx/include/__chrono/weekday.h +25 -0
- package/libcxx/include/__chrono/year.h +11 -0
- package/libcxx/include/__chrono/year_month.h +13 -0
- package/libcxx/include/__chrono/year_month_day.h +23 -0
- package/libcxx/include/__chrono/year_month_weekday.h +26 -0
- package/libcxx/include/__chrono/zoned_time.h +16 -0
- package/libcxx/include/__compare/is_eq.h +6 -6
- package/libcxx/include/__compare/strong_order.h +12 -30
- package/libcxx/include/__compare/three_way_comparable.h +2 -2
- package/libcxx/include/__concepts/comparison_common_type.h +40 -0
- package/libcxx/include/__concepts/equality_comparable.h +2 -1
- package/libcxx/include/__condition_variable/condition_variable.h +1 -1
- package/libcxx/include/__config +63 -280
- package/libcxx/include/__configuration/abi.h +14 -24
- package/libcxx/include/__configuration/availability.h +65 -118
- package/libcxx/include/__configuration/compiler.h +6 -6
- package/libcxx/include/__configuration/experimental.h +38 -0
- package/libcxx/include/__configuration/hardening.h +215 -0
- package/libcxx/include/__configuration/language.h +3 -0
- package/libcxx/include/__configuration/platform.h +9 -16
- package/libcxx/include/__coroutine/coroutine_handle.h +9 -9
- package/libcxx/include/__coroutine/noop_coroutine_handle.h +11 -13
- package/libcxx/include/__debug_utils/strict_weak_ordering_check.h +1 -1
- package/libcxx/include/__exception/exception.h +6 -4
- package/libcxx/include/__exception/exception_ptr.h +27 -5
- package/libcxx/include/__exception/nested_exception.h +2 -2
- package/libcxx/include/__exception/operations.h +5 -5
- package/libcxx/include/__expected/bad_expected_access.h +8 -6
- package/libcxx/include/__expected/expected.h +62 -64
- package/libcxx/include/__expected/unexpected.h +4 -4
- package/libcxx/include/__filesystem/copy_options.h +4 -4
- package/libcxx/include/__filesystem/directory_entry.h +37 -33
- package/libcxx/include/__filesystem/directory_iterator.h +9 -11
- package/libcxx/include/__filesystem/directory_options.h +7 -4
- package/libcxx/include/__filesystem/file_status.h +3 -3
- package/libcxx/include/__filesystem/filesystem_error.h +9 -10
- package/libcxx/include/__filesystem/operations.h +97 -66
- package/libcxx/include/__filesystem/path.h +68 -64
- package/libcxx/include/__filesystem/path_iterator.h +1 -3
- package/libcxx/include/__filesystem/perm_options.h +4 -4
- package/libcxx/include/__filesystem/perms.h +4 -4
- package/libcxx/include/__filesystem/recursive_directory_iterator.h +9 -14
- package/libcxx/include/__filesystem/space_info.h +1 -1
- package/libcxx/include/__filesystem/u8path.h +12 -14
- package/libcxx/include/__flat_map/flat_map.h +88 -71
- package/libcxx/include/__flat_map/flat_multimap.h +251 -172
- package/libcxx/include/__flat_map/key_value_iterator.h +0 -1
- package/libcxx/include/__flat_map/utils.h +1 -0
- package/libcxx/include/__flat_set/flat_multiset.h +211 -143
- package/libcxx/include/__flat_set/flat_set.h +86 -68
- package/libcxx/include/__format/concepts.h +0 -14
- package/libcxx/include/__format/extended_grapheme_cluster_table.h +3 -2
- package/libcxx/include/__format/fmt_pair_like.h +42 -0
- package/libcxx/include/__format/format_arg.h +7 -10
- package/libcxx/include/__format/format_args.h +1 -1
- package/libcxx/include/__format/format_context.h +5 -5
- package/libcxx/include/__format/format_parse_context.h +2 -2
- package/libcxx/include/__format/formatter_output.h +30 -34
- package/libcxx/include/__format/indic_conjunct_break_table.h +3 -2
- package/libcxx/include/__format/range_default_formatter.h +2 -41
- package/libcxx/include/__format/range_format.h +71 -0
- package/libcxx/include/__format/range_formatter.h +1 -0
- package/libcxx/include/__format/width_estimation_table.h +4 -2
- package/libcxx/include/__functional/bind.h +10 -15
- package/libcxx/include/__functional/bind_back.h +1 -1
- package/libcxx/include/__functional/bind_front.h +1 -1
- package/libcxx/include/__functional/function.h +57 -75
- package/libcxx/include/__functional/hash.h +1 -10
- package/libcxx/include/__functional/identity.h +1 -1
- package/libcxx/include/__functional/is_transparent.h +8 -0
- package/libcxx/include/__functional/mem_fn.h +2 -1
- package/libcxx/include/__functional/operations.h +18 -0
- package/libcxx/include/__functional/ranges_operations.h +7 -0
- package/libcxx/include/__functional/reference_wrapper.h +7 -5
- package/libcxx/include/__functional/weak_result_type.h +14 -28
- package/libcxx/include/__fwd/ios.h +1 -1
- package/libcxx/include/__fwd/tuple.h +14 -0
- package/libcxx/include/__hash_table +371 -357
- package/libcxx/include/__ios/fpos.h +4 -4
- package/libcxx/include/__iterator/back_insert_iterator.h +1 -7
- package/libcxx/include/__iterator/bounded_iter.h +7 -8
- package/libcxx/include/__iterator/concepts.h +6 -9
- package/libcxx/include/__iterator/cpp17_iterator_concepts.h +13 -12
- package/libcxx/include/__iterator/distance.h +40 -18
- package/libcxx/include/__iterator/front_insert_iterator.h +1 -7
- package/libcxx/include/__iterator/insert_iterator.h +1 -7
- package/libcxx/include/__iterator/istream_iterator.h +6 -7
- package/libcxx/include/__iterator/istreambuf_iterator.h +6 -7
- package/libcxx/include/__iterator/iter_move.h +1 -1
- package/libcxx/include/__iterator/iterator.h +13 -0
- package/libcxx/include/__iterator/iterator_traits.h +13 -14
- package/libcxx/include/__iterator/ostream_iterator.h +1 -7
- package/libcxx/include/__iterator/ostreambuf_iterator.h +1 -7
- package/libcxx/include/__iterator/reverse_iterator.h +8 -13
- package/libcxx/include/__iterator/segmented_iterator.h +3 -8
- package/libcxx/include/__iterator/static_bounded_iter.h +3 -3
- package/libcxx/include/__iterator/wrap_iter.h +8 -6
- package/libcxx/include/__locale +3 -10
- package/libcxx/include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h +0 -10
- package/libcxx/include/__locale_dir/locale_base_api.h +5 -28
- package/libcxx/include/__locale_dir/messages.h +1 -1
- package/libcxx/include/__locale_dir/money.h +2 -2
- package/libcxx/include/__locale_dir/num.h +190 -243
- package/libcxx/include/__locale_dir/pad_and_output.h +5 -6
- package/libcxx/include/__locale_dir/support/bsd_like.h +0 -20
- package/libcxx/include/__locale_dir/support/fuchsia.h +0 -7
- package/libcxx/include/__locale_dir/support/linux.h +0 -37
- package/libcxx/include/__locale_dir/support/netbsd.h +0 -2
- package/libcxx/include/__locale_dir/support/newlib.h +243 -0
- package/libcxx/include/__locale_dir/support/no_locale/characters.h +0 -4
- package/libcxx/include/__locale_dir/support/no_locale/strtonum.h +0 -9
- package/libcxx/include/__locale_dir/support/windows.h +0 -29
- package/libcxx/include/__locale_dir/time.h +3 -7
- package/libcxx/include/__math/hypot.h +1 -1
- package/libcxx/include/__math/logarithms.h +1 -1
- package/libcxx/include/__math/traits.h +80 -11
- package/libcxx/include/__mdspan/extents.h +7 -4
- package/libcxx/include/__mdspan/layout_stride.h +4 -5
- package/libcxx/include/__mdspan/mdspan.h +29 -23
- package/libcxx/include/__memory/addressof.h +7 -5
- package/libcxx/include/__memory/align.h +18 -1
- package/libcxx/include/__memory/allocate_at_least.h +15 -10
- package/libcxx/include/__memory/allocator.h +14 -26
- package/libcxx/include/__memory/allocator_traits.h +6 -4
- package/libcxx/include/__memory/compressed_pair.h +15 -9
- package/libcxx/include/__memory/construct_at.h +12 -23
- package/libcxx/include/__memory/inout_ptr.h +1 -1
- package/libcxx/include/__memory/is_sufficiently_aligned.h +1 -1
- package/libcxx/include/__memory/out_ptr.h +1 -1
- package/libcxx/include/__memory/pointer_traits.h +1 -1
- package/libcxx/include/__memory/raw_storage_iterator.h +3 -9
- package/libcxx/include/__memory/shared_count.h +9 -30
- package/libcxx/include/__memory/shared_ptr.h +100 -145
- package/libcxx/include/__memory/temp_value.h +1 -2
- package/libcxx/include/__memory/uninitialized_algorithms.h +44 -115
- package/libcxx/include/__memory/unique_ptr.h +14 -16
- package/libcxx/include/__memory/uses_allocator_construction.h +1 -0
- package/libcxx/include/__memory_resource/memory_resource.h +4 -2
- package/libcxx/include/__memory_resource/monotonic_buffer_resource.h +1 -1
- package/libcxx/include/__memory_resource/polymorphic_allocator.h +13 -8
- package/libcxx/include/__memory_resource/pool_options.h +1 -1
- package/libcxx/include/__memory_resource/synchronized_pool_resource.h +4 -2
- package/libcxx/include/__memory_resource/unsynchronized_pool_resource.h +1 -1
- package/libcxx/include/__mutex/mutex.h +2 -2
- package/libcxx/include/__mutex/once_flag.h +14 -11
- package/libcxx/include/__mutex/tag_types.h +3 -3
- package/libcxx/include/__mutex/unique_lock.h +8 -7
- package/libcxx/include/__new/align_val_t.h +6 -0
- package/libcxx/include/__new/allocate.h +1 -2
- package/libcxx/include/__new/exceptions.h +8 -2
- package/libcxx/include/__new/global_new_delete.h +4 -11
- package/libcxx/include/__new/interference_size.h +0 -4
- package/libcxx/include/__new/launder.h +3 -5
- package/libcxx/include/__new/nothrow_t.h +1 -1
- package/libcxx/include/__numeric/gcd_lcm.h +24 -34
- package/libcxx/include/__numeric/midpoint.h +9 -14
- package/libcxx/include/__numeric/pstl.h +2 -2
- package/libcxx/include/__numeric/saturation_arithmetic.h +13 -5
- package/libcxx/include/__ostream/basic_ostream.h +8 -8
- package/libcxx/include/__pstl/backends/default.h +14 -14
- package/libcxx/include/__pstl/backends/libdispatch.h +2 -2
- package/libcxx/include/__pstl/cpu_algos/find_if.h +1 -1
- package/libcxx/include/__pstl/cpu_algos/transform.h +5 -6
- package/libcxx/include/__pstl/cpu_algos/transform_reduce.h +5 -4
- package/libcxx/include/__random/binomial_distribution.h +10 -4
- package/libcxx/include/__random/mersenne_twister_engine.h +50 -154
- package/libcxx/include/__random/piecewise_constant_distribution.h +3 -2
- package/libcxx/include/__random/piecewise_linear_distribution.h +3 -2
- package/libcxx/include/__ranges/adjacent_transform_view.h +406 -0
- package/libcxx/include/__ranges/adjacent_view.h +419 -0
- package/libcxx/include/__ranges/as_rvalue_view.h +9 -9
- package/libcxx/include/__ranges/chunk_by_view.h +6 -6
- package/libcxx/include/__ranges/common_view.h +7 -7
- package/libcxx/include/__ranges/drop_view.h +8 -8
- package/libcxx/include/__ranges/drop_while_view.h +5 -5
- package/libcxx/include/__ranges/elements_of.h +49 -0
- package/libcxx/include/__ranges/empty_view.h +5 -5
- package/libcxx/include/__ranges/filter_view.h +10 -10
- package/libcxx/include/__ranges/iota_view.h +41 -22
- package/libcxx/include/__ranges/owning_view.h +15 -15
- package/libcxx/include/__ranges/ref_view.h +6 -6
- package/libcxx/include/__ranges/repeat_view.h +17 -10
- package/libcxx/include/__ranges/single_view.h +8 -8
- package/libcxx/include/__ranges/take_view.h +9 -9
- package/libcxx/include/__ranges/transform_view.h +1 -2
- package/libcxx/include/__ranges/view_interface.h +10 -10
- package/libcxx/include/__ranges/zip_transform_view.h +357 -0
- package/libcxx/include/__ranges/zip_view.h +20 -20
- package/libcxx/include/__split_buffer +612 -240
- package/libcxx/include/__stop_token/atomic_unique_lock.h +1 -1
- package/libcxx/include/__stop_token/stop_callback.h +2 -2
- package/libcxx/include/__stop_token/stop_source.h +1 -1
- package/libcxx/include/__stop_token/stop_state.h +4 -4
- package/libcxx/include/__stop_token/stop_token.h +1 -1
- package/libcxx/include/__string/char_traits.h +51 -31
- package/libcxx/include/__string/constexpr_c_functions.h +5 -5
- package/libcxx/include/__support/xlocale/__strtonum_fallback.h +0 -8
- package/libcxx/include/__system_error/error_category.h +8 -8
- package/libcxx/include/__system_error/error_code.h +5 -5
- package/libcxx/include/__system_error/error_condition.h +4 -4
- package/libcxx/include/__system_error/system_error.h +1 -1
- package/libcxx/include/__thread/id.h +1 -1
- package/libcxx/include/__thread/jthread.h +1 -1
- package/libcxx/include/__thread/poll_with_backoff.h +27 -8
- package/libcxx/include/__thread/support/c11.h +8 -8
- package/libcxx/include/__thread/support/pthread.h +8 -8
- package/libcxx/include/__thread/support/windows.h +8 -8
- package/libcxx/include/__thread/thread.h +13 -8
- package/libcxx/include/__thread/timed_backoff_policy.h +3 -2
- package/libcxx/include/__tree +849 -701
- package/libcxx/include/__tuple/sfinae_helpers.h +1 -44
- package/libcxx/include/__tuple/tuple_element.h +0 -12
- package/libcxx/include/__tuple/tuple_size.h +0 -4
- package/libcxx/include/__tuple/tuple_transform.h +45 -0
- package/libcxx/include/__type_traits/aligned_storage.h +13 -40
- package/libcxx/include/__type_traits/desugars_to.h +4 -0
- package/libcxx/include/__type_traits/invoke.h +8 -0
- package/libcxx/include/__type_traits/is_allocator.h +6 -7
- package/libcxx/include/__type_traits/is_array.h +26 -0
- package/libcxx/include/__type_traits/is_equality_comparable.h +16 -21
- package/libcxx/include/__type_traits/is_final.h +1 -1
- package/libcxx/include/__type_traits/is_floating_point.h +7 -6
- package/libcxx/include/__type_traits/is_generic_transparent_comparator.h +30 -0
- package/libcxx/include/__type_traits/is_specialization.h +2 -6
- package/libcxx/include/__type_traits/is_within_lifetime.h +29 -0
- package/libcxx/include/__type_traits/make_transparent.h +52 -0
- package/libcxx/include/__type_traits/reference_constructs_from_temporary.h +1 -7
- package/libcxx/include/__type_traits/reference_converts_from_temporary.h +1 -1
- package/libcxx/include/__utility/cmp.h +19 -7
- package/libcxx/include/__utility/default_three_way_comparator.h +70 -0
- package/libcxx/include/__utility/in_place.h +1 -1
- package/libcxx/include/__utility/integer_sequence.h +56 -41
- package/libcxx/include/__utility/lazy_synth_three_way_comparator.h +120 -0
- package/libcxx/include/__utility/pair.h +22 -25
- package/libcxx/include/__utility/scope_guard.h +2 -0
- package/libcxx/include/__utility/try_key_extraction.h +114 -0
- package/libcxx/include/__vector/vector.h +187 -160
- package/libcxx/include/__vector/vector_bool.h +76 -83
- package/libcxx/include/any +118 -155
- package/libcxx/include/array +88 -56
- package/libcxx/include/atomic +2 -0
- package/libcxx/include/barrier +20 -24
- package/libcxx/include/bitset +49 -30
- package/libcxx/include/ccomplex +3 -11
- package/libcxx/include/chrono +47 -0
- package/libcxx/include/ciso646 +3 -6
- package/libcxx/include/complex +77 -65
- package/libcxx/include/complex.h +10 -10
- package/libcxx/include/condition_variable +3 -3
- package/libcxx/include/cstdalign +3 -10
- package/libcxx/include/cstdbool +3 -10
- package/libcxx/include/ctgmath +2 -11
- package/libcxx/include/ctype.h +24 -24
- package/libcxx/include/cwchar +2 -2
- package/libcxx/include/deque +109 -225
- package/libcxx/include/errno.h +269 -269
- package/libcxx/include/exception +4 -1
- package/libcxx/include/ext/hash_map +7 -48
- package/libcxx/include/ext/hash_set +2 -8
- package/libcxx/include/fenv.h +43 -43
- package/libcxx/include/flat_map +663 -11
- package/libcxx/include/flat_set +543 -8
- package/libcxx/include/float.h +16 -16
- package/libcxx/include/forward_list +33 -53
- package/libcxx/include/fstream +57 -42
- package/libcxx/include/future +41 -51
- package/libcxx/include/initializer_list +9 -3
- package/libcxx/include/inttypes.h +16 -16
- package/libcxx/include/ios +28 -28
- package/libcxx/include/istream +19 -13
- package/libcxx/include/iterator +10 -0
- package/libcxx/include/latch +7 -5
- package/libcxx/include/limits +4 -4
- package/libcxx/include/list +61 -79
- package/libcxx/include/map +386 -274
- package/libcxx/include/math.h +19 -0
- package/libcxx/include/mdspan +1 -5
- package/libcxx/include/mutex +29 -19
- package/libcxx/include/optional +644 -149
- package/libcxx/include/print +9 -5
- package/libcxx/include/queue +39 -37
- package/libcxx/include/ranges +48 -0
- package/libcxx/include/regex +33 -31
- package/libcxx/include/scoped_allocator +16 -11
- package/libcxx/include/semaphore +15 -18
- package/libcxx/include/set +220 -192
- package/libcxx/include/shared_mutex +3 -8
- package/libcxx/include/span +53 -37
- package/libcxx/include/sstream +34 -28
- package/libcxx/include/stack +13 -15
- package/libcxx/include/stddef.h +10 -10
- package/libcxx/include/stdexcept +2 -2
- package/libcxx/include/stdio.h +20 -21
- package/libcxx/include/streambuf +59 -19
- package/libcxx/include/string +574 -573
- package/libcxx/include/string_view +113 -89
- package/libcxx/include/strstream +10 -10
- package/libcxx/include/syncstream +4 -4
- package/libcxx/include/tgmath.h +12 -12
- package/libcxx/include/tuple +242 -212
- package/libcxx/include/type_traits +8 -2
- package/libcxx/include/typeindex +5 -3
- package/libcxx/include/typeinfo +92 -89
- package/libcxx/include/unordered_map +179 -304
- package/libcxx/include/unordered_set +168 -195
- package/libcxx/include/utility +12 -0
- package/libcxx/include/valarray +106 -161
- package/libcxx/include/variant +25 -33
- package/libcxx/include/version +41 -24
- package/libcxx/include/wctype.h +29 -29
- package/libcxx/libc/hdr/errno_macros.h +3 -1
- package/libcxx/libc/hdr/stdint_proxy.h +18 -0
- package/libcxx/libc/hdr/types/wchar_t.h +23 -0
- package/libcxx/libc/hdr/wchar_overlay.h +69 -0
- package/libcxx/libc/include/llvm-libc-macros/cfloat128-macros.h +41 -0
- package/libcxx/libc/include/llvm-libc-macros/cfloat16-macros.h +20 -0
- package/libcxx/libc/include/llvm-libc-macros/wchar-macros.h +18 -0
- package/libcxx/libc/include/llvm-libc-types/cfloat128.h +11 -28
- package/libcxx/libc/include/llvm-libc-types/cfloat16.h +4 -7
- package/libcxx/libc/include/llvm-libc-types/wint_t.h +14 -0
- package/libcxx/libc/shared/libc_common.h +5 -0
- package/libcxx/libc/src/__support/CPP/bit.h +50 -12
- package/libcxx/libc/src/__support/CPP/type_traits/is_complex.h +7 -0
- package/libcxx/libc/src/__support/CPP/type_traits/is_destructible.h +2 -1
- package/libcxx/libc/src/__support/CPP/type_traits/is_unsigned.h +6 -0
- package/libcxx/libc/src/__support/CPP/utility/integer_sequence.h +10 -0
- package/libcxx/libc/src/__support/FPUtil/FPBits.h +6 -7
- package/libcxx/libc/src/__support/FPUtil/rounding_mode.h +50 -4
- package/libcxx/libc/src/__support/big_int.h +14 -14
- package/libcxx/libc/src/__support/common.h +3 -2
- package/libcxx/libc/src/__support/ctype_utils.h +19 -12
- package/libcxx/libc/src/__support/detailed_powers_of_ten.h +1 -2
- package/libcxx/libc/src/__support/high_precision_decimal.h +33 -14
- package/libcxx/libc/src/__support/libc_assert.h +2 -0
- package/libcxx/libc/src/__support/macros/attributes.h +44 -1
- package/libcxx/libc/src/__support/macros/config.h +23 -0
- package/libcxx/libc/src/__support/macros/null_check.h +1 -2
- package/libcxx/libc/src/__support/macros/optimization.h +3 -0
- package/libcxx/libc/src/__support/macros/properties/architectures.h +5 -1
- package/libcxx/libc/src/__support/macros/properties/compiler.h +8 -3
- package/libcxx/libc/src/__support/macros/properties/cpu_features.h +17 -1
- package/libcxx/libc/src/__support/macros/properties/types.h +2 -3
- package/libcxx/libc/src/__support/macros/sanitizer.h +0 -10
- package/libcxx/libc/src/__support/math_extras.h +20 -4
- package/libcxx/libc/src/__support/str_to_float.h +98 -125
- package/libcxx/libc/src/__support/str_to_integer.h +39 -27
- package/libcxx/libc/src/__support/wctype_utils.h +588 -0
- package/libcxx/src/any.cpp +4 -0
- package/libcxx/src/atomic.cpp +365 -80
- package/libcxx/src/barrier.cpp +4 -3
- package/libcxx/src/charconv.cpp +6 -3
- package/libcxx/src/condition_variable_destructor.cpp +1 -1
- package/libcxx/src/error_category.cpp +3 -1
- package/libcxx/src/exception.cpp +2 -10
- package/libcxx/src/experimental/time_zone.cpp +1 -1
- package/libcxx/src/experimental/tzdb.cpp +4 -1
- package/libcxx/src/filesystem/error.h +4 -22
- package/libcxx/src/filesystem/format_string.h +9 -18
- package/libcxx/src/filesystem/int128_builtins.cpp +2 -0
- package/libcxx/src/filesystem/operations.cpp +2 -9
- package/libcxx/src/filesystem/path.cpp +3 -1
- package/libcxx/src/include/aligned_alloc.h +65 -0
- package/libcxx/src/include/config_elast.h +1 -1
- package/libcxx/src/include/from_chars_floating_point.h +11 -7
- package/libcxx/src/include/overridable_function.h +8 -10
- package/libcxx/src/iostream.cpp +56 -37
- package/libcxx/src/locale.cpp +213 -196
- package/libcxx/src/memory.cpp +12 -14
- package/libcxx/src/mutex_destructor.cpp +1 -1
- package/libcxx/src/new.cpp +5 -5
- package/libcxx/src/optional.cpp +4 -0
- package/libcxx/src/print.cpp +9 -1
- package/libcxx/src/random.cpp +0 -26
- package/libcxx/src/string.cpp +10 -25
- package/libcxx/src/support/runtime/exception_fallback.ipp +2 -0
- package/libcxx/src/support/runtime/exception_glibcxx.ipp +3 -0
- package/libcxx/src/support/runtime/exception_libcxxabi.ipp +6 -2
- package/libcxx/src/support/runtime/exception_libcxxrt.ipp +2 -0
- package/libcxx/src/support/runtime/exception_msvc.ipp +2 -0
- package/libcxx/src/support/runtime/exception_pointer_cxxabi.ipp +9 -10
- package/libcxx/src/support/runtime/exception_pointer_glibcxx.ipp +2 -0
- package/libcxx/src/support/runtime/exception_pointer_msvc.ipp +1 -0
- package/libcxx/src/support/runtime/exception_pointer_unimplemented.ipp +1 -0
- package/libcxx/src/support/win32/locale_win32.cpp +1 -1
- package/libcxx/src/system_error.cpp +2 -0
- package/libcxx/src/thread.cpp +1 -3
- package/libcxx/src/valarray.cpp +1 -2
- package/libcxx/src/vector.cpp +2 -2
- package/libcxxabi/include/__cxxabi_config.h +42 -23
- package/libcxxabi/src/cxa_exception.cpp +4 -2
- package/libcxxabi/src/cxa_exception.h +16 -14
- package/libcxxabi/src/cxa_personality.cpp +126 -9
- package/libcxxabi/src/cxa_thread_atexit.cpp +2 -1
- package/libcxxabi/src/demangle/DemangleConfig.h +4 -0
- package/libcxxabi/src/demangle/ItaniumDemangle.h +9 -6
- package/libcxxabi/src/demangle/Utility.h +21 -7
- package/libcxxabi/src/fallback_malloc.cpp +1 -1
- package/libcxxabi/src/private_typeinfo.cpp +6 -0
- package/libcxxabi/src/stdlib_new_delete.cpp +5 -5
- package/libtsan/LICENSE.TXT +311 -0
- package/libtsan/builtins/assembly.h +41 -8
- package/libtsan/interception/interception_win.cpp +4 -0
- package/libtsan/sanitizer_common/sanitizer_allocator_primary32.h +1 -0
- package/libtsan/sanitizer_common/sanitizer_allocator_primary64.h +18 -0
- package/libtsan/sanitizer_common/sanitizer_common.h +15 -2
- package/libtsan/sanitizer_common/sanitizer_common_interceptors.inc +30 -4
- package/libtsan/sanitizer_common/sanitizer_common_interceptors_ioctl.inc +4 -0
- package/libtsan/sanitizer_common/sanitizer_common_interceptors_vfork_aarch64.inc.S +2 -1
- package/libtsan/sanitizer_common/sanitizer_common_interceptors_vfork_i386.inc.S +2 -0
- package/libtsan/sanitizer_common/sanitizer_common_interceptors_vfork_x86_64.inc.S +2 -0
- package/libtsan/sanitizer_common/sanitizer_common_syscalls.inc +18 -0
- package/libtsan/sanitizer_common/sanitizer_file.cpp +40 -12
- package/libtsan/sanitizer_common/sanitizer_file.h +3 -0
- package/libtsan/sanitizer_common/sanitizer_flags.inc +7 -0
- package/libtsan/sanitizer_common/sanitizer_fuchsia.cpp +30 -3
- package/libtsan/sanitizer_common/sanitizer_haiku.cpp +2 -2
- package/libtsan/sanitizer_common/sanitizer_internal_defs.h +1 -1
- package/libtsan/sanitizer_common/sanitizer_libc.cpp +8 -0
- package/libtsan/sanitizer_common/sanitizer_libc.h +1 -0
- package/libtsan/sanitizer_common/sanitizer_linux.cpp +15 -7
- package/libtsan/sanitizer_common/sanitizer_linux.h +3 -3
- package/libtsan/sanitizer_common/sanitizer_linux_libcdep.cpp +1 -0
- package/libtsan/sanitizer_common/sanitizer_mac.cpp +255 -104
- package/libtsan/sanitizer_common/sanitizer_mac.h +5 -0
- package/libtsan/sanitizer_common/sanitizer_netbsd.cpp +2 -2
- package/libtsan/sanitizer_common/sanitizer_platform.h +27 -1
- package/libtsan/sanitizer_common/sanitizer_platform_interceptors.h +5 -4
- package/libtsan/sanitizer_common/sanitizer_platform_limits_posix.cpp +15 -17
- package/libtsan/sanitizer_common/sanitizer_platform_limits_posix.h +32 -6
- package/libtsan/sanitizer_common/sanitizer_posix.cpp +3 -12
- package/libtsan/sanitizer_common/sanitizer_posix.h +2 -1
- package/libtsan/sanitizer_common/sanitizer_posix_libcdep.cpp +19 -0
- package/libtsan/sanitizer_common/sanitizer_procmaps_mac.cpp +102 -37
- package/libtsan/sanitizer_common/sanitizer_redefine_builtins.h +1 -1
- package/libtsan/sanitizer_common/sanitizer_signal_interceptors.inc +40 -2
- package/libtsan/sanitizer_common/sanitizer_stoptheworld.h +1 -1
- package/libtsan/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp +83 -12
- package/libtsan/sanitizer_common/sanitizer_stoptheworld_mac.cpp +3 -3
- package/libtsan/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp +7 -7
- package/libtsan/sanitizer_common/sanitizer_stoptheworld_win.cpp +2 -2
- package/libtsan/sanitizer_common/sanitizer_symbolizer_internal.h +5 -1
- package/libtsan/sanitizer_common/sanitizer_symbolizer_libcdep.cpp +11 -1
- package/libtsan/sanitizer_common/sanitizer_symbolizer_mac.cpp +86 -29
- package/libtsan/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp +27 -16
- package/libtsan/sanitizer_common/sanitizer_thread_registry.cpp +5 -4
- package/libtsan/sanitizer_common/sanitizer_thread_registry.h +4 -4
- package/libtsan/sanitizer_common/sanitizer_win.cpp +1 -3
- package/libtsan/tsan_debugging.cpp +2 -2
- package/libtsan/tsan_flags.cpp +37 -0
- package/libtsan/tsan_flags.h +8 -0
- package/libtsan/tsan_flags.inc +12 -0
- package/libtsan/tsan_interceptors.h +9 -1
- package/libtsan/tsan_interceptors_mac.cpp +19 -0
- package/libtsan/tsan_interceptors_posix.cpp +78 -32
- package/libtsan/tsan_interface.h +3 -3
- package/libtsan/tsan_interface_ann.cpp +23 -9
- package/libtsan/tsan_mman.cpp +18 -4
- package/libtsan/tsan_platform.h +44 -7
- package/libtsan/tsan_platform_linux.cpp +42 -14
- package/libtsan/tsan_platform_mac.cpp +16 -3
- package/libtsan/tsan_report.h +14 -1
- package/libtsan/tsan_rtl.cpp +14 -0
- package/libtsan/tsan_rtl.h +7 -2
- package/libtsan/tsan_rtl_aarch64.S +3 -5
- package/libtsan/tsan_rtl_access.cpp +8 -3
- package/libtsan/tsan_rtl_amd64.S +2 -0
- package/libtsan/tsan_rtl_mutex.cpp +94 -49
- package/libtsan/tsan_rtl_report.cpp +132 -65
- package/libtsan/tsan_rtl_thread.cpp +31 -9
- package/libtsan/tsan_symbolize.cpp +1 -1
- package/libtsan/tsan_symbolize.h +1 -1
- package/libtsan/tsan_trace.h +1 -1
- package/libunwind/include/__libunwind_config.h +11 -2
- package/libunwind/include/libunwind.h +117 -11
- package/libunwind/include/unwind_arm_ehabi.h +4 -1
- package/libunwind/src/AddressSpace.hpp +42 -20
- package/libunwind/src/CompactUnwinder.hpp +16 -5
- package/libunwind/src/DwarfInstructions.hpp +24 -13
- package/libunwind/src/DwarfParser.hpp +62 -23
- package/libunwind/src/EHHeaderParser.hpp +7 -4
- package/libunwind/src/Registers.hpp +226 -22
- package/libunwind/src/Unwind-seh.cpp +6 -7
- package/libunwind/src/Unwind-wasm.c +7 -7
- package/libunwind/src/UnwindCursor.hpp +167 -49
- package/libunwind/src/UnwindLevel1.c +46 -17
- package/libunwind/src/UnwindRegistersRestore.S +46 -5
- package/libunwind/src/UnwindRegistersSave.S +86 -2
- package/libunwind/src/assembly.h +5 -1
- package/libunwind/src/config.h +9 -0
- package/libunwind/src/gcc_personality_v0.c +79 -6
- package/libunwind/src/libunwind.cpp +104 -4
- package/libunwind/src/libunwind_ext.h +7 -1
- package/libunwind/src/shadow_stack_unwind.h +2 -2
- package/lldb/pretty_printers.py +948 -0
- package/package.json +1 -1
- package/std/Build/Cache/Path.zig +1 -1
- package/std/Build/Cache.zig +6 -6
- package/std/Build/Step/Compile.zig +18 -20
- package/std/Build/Step/ConfigHeader.zig +1 -1
- package/std/Build/Step/Run.zig +15 -8
- package/std/Build/Step.zig +3 -7
- package/std/Build/Watch/FsEvents.zig +1 -1
- package/std/Build/WebServer.zig +2 -2
- package/std/Build/abi.zig +1 -1
- package/std/Build.zig +0 -3
- package/std/Io/Dir.zig +9 -4
- package/std/Io/Dispatch.zig +8 -18
- package/std/Io/File/Writer.zig +8 -6
- package/std/Io/File.zig +0 -9
- package/std/Io/Kqueue.zig +3 -3
- package/std/Io/Reader.zig +8 -14
- package/std/Io/Semaphore.zig +112 -17
- package/std/Io/Terminal.zig +1 -1
- package/std/Io/Threaded.zig +183 -46
- package/std/Io/Uring.zig +18 -20
- package/std/Io/Writer.zig +10 -7
- package/std/Io/net/HostName.zig +11 -6
- package/std/Io/net.zig +11 -11
- package/std/Io.zig +104 -38
- package/std/Random/ChaCha.zig +2 -2
- package/std/Random/benchmark.zig +2 -2
- package/std/Random.zig +6 -6
- package/std/SemanticVersion.zig +1 -1
- package/std/Target/Query.zig +2 -2
- package/std/Target/aarch64.zig +620 -77
- package/std/Target/amdgcn.zig +421 -21
- package/std/Target/arm.zig +40 -6
- package/std/Target/bpf.zig +6 -0
- package/std/Target/hexagon.zig +41 -6
- package/std/Target/loongarch.zig +18 -0
- package/std/Target/mips.zig +6 -0
- package/std/Target/nvptx.zig +58 -35
- package/std/Target/powerpc.zig +27 -19
- package/std/Target/riscv.zig +415 -177
- package/std/Target/sparc.zig +17 -0
- package/std/Target/wasm.zig +7 -0
- package/std/Target/x86.zig +200 -31
- package/std/Target/xtensa.zig +65 -0
- package/std/Target.zig +67 -14
- package/std/Thread.zig +5 -2
- package/std/array_hash_map.zig +103 -57
- package/std/array_list.zig +10 -31
- package/std/base64.zig +5 -5
- package/std/bit_set.zig +86 -69
- package/std/c/haiku.zig +3 -0
- package/std/c/serenity.zig +1 -6
- package/std/c.zig +123 -32
- package/std/compress/flate/Decompress.zig +3 -4
- package/std/compress/zstd/Decompress.zig +7 -9
- package/std/crypto/25519/curve25519.zig +2 -2
- package/std/crypto/25519/edwards25519.zig +3 -3
- package/std/crypto/25519/ristretto255.zig +2 -2
- package/std/crypto/25519/scalar.zig +6 -6
- package/std/crypto/25519/x25519.zig +1 -1
- package/std/crypto/Certificate.zig +14 -2
- package/std/crypto/Sha1.zig +1 -1
- package/std/crypto/aegis.zig +45 -39
- package/std/crypto/aes_ccm.zig +22 -22
- package/std/crypto/aes_gcm.zig +10 -12
- package/std/crypto/aes_ocb.zig +9 -9
- package/std/crypto/argon2.zig +15 -15
- package/std/crypto/ascon.zig +75 -33
- package/std/crypto/bcrypt.zig +20 -10
- package/std/crypto/benchmark.zig +7 -7
- package/std/crypto/blake2.zig +100 -64
- package/std/crypto/cbc_mac.zig +1 -1
- package/std/crypto/chacha20.zig +10 -10
- package/std/crypto/cmac.zig +3 -3
- package/std/crypto/codecs/asn1/Oid.zig +12 -1
- package/std/crypto/codecs/asn1/der/Encoder.zig +1 -1
- package/std/crypto/codecs/asn1.zig +1 -1
- package/std/crypto/codecs/base64_hex_ct.zig +3 -5
- package/std/crypto/ecdsa.zig +9 -9
- package/std/crypto/ff.zig +4 -5
- package/std/crypto/ghash_polyval.zig +4 -4
- package/std/crypto/hkdf.zig +1 -1
- package/std/crypto/isap.zig +3 -3
- package/std/crypto/kangarootwelve.zig +1 -1
- package/std/crypto/keccak_p.zig +8 -8
- package/std/crypto/md5.zig +1 -1
- package/std/crypto/ml_dsa.zig +39 -39
- package/std/crypto/ml_kem.zig +12 -34
- package/std/crypto/modes.zig +2 -2
- package/std/crypto/pbkdf2.zig +1 -1
- package/std/crypto/pcurves/common.zig +4 -5
- package/std/crypto/pcurves/p256/scalar.zig +3 -3
- package/std/crypto/pcurves/p384/scalar.zig +2 -2
- package/std/crypto/pcurves/secp256k1/scalar.zig +3 -3
- package/std/crypto/pcurves/tests/p256.zig +5 -5
- package/std/crypto/pcurves/tests/p384.zig +5 -5
- package/std/crypto/pcurves/tests/secp256k1.zig +3 -3
- package/std/crypto/salsa20.zig +8 -8
- package/std/crypto/sha2.zig +2 -2
- package/std/crypto/sha3.zig +2 -2
- package/std/crypto/siphash.zig +1 -1
- package/std/crypto/timing_safe.zig +10 -9
- package/std/crypto/tls/Client.zig +89 -13
- package/std/crypto/tls.zig +1 -1
- package/std/crypto.zig +4 -3
- package/std/debug/Dwarf.zig +15 -12
- package/std/debug/Pdb.zig +25 -17
- package/std/debug.zig +14 -8
- package/std/deque.zig +1 -1
- package/std/elf.zig +1 -1
- package/std/enums.zig +8 -8
- package/std/fmt/parse_float/decimal.zig +1 -1
- package/std/fmt/parse_float.zig +1 -1
- package/std/fmt.zig +14 -10
- package/std/fs/path.zig +7 -5
- package/std/hash/Adler32.zig +3 -3
- package/std/hash/benchmark.zig +2 -2
- package/std/hash/wyhash.zig +2 -2
- package/std/hash/xxhash.zig +0 -6
- package/std/hash_map.zig +20 -1
- package/std/heap/BufferFirstAllocator.zig +165 -0
- package/std/heap/debug_allocator.zig +2 -2
- package/std/heap/memory_pool.zig +34 -197
- package/std/heap.zig +2 -133
- package/std/http/Client.zig +21 -24
- package/std/http.zig +4 -5
- package/std/json/Scanner.zig +2 -2
- package/std/json/static.zig +2 -2
- package/std/{builtin.zig → lang.zig} +5 -1
- package/std/leb128.zig +2 -2
- package/std/math/big/int.zig +5 -5
- package/std/math/big.zig +4 -4
- package/std/math/copysign.zig +1 -1
- package/std/math/float.zig +62 -0
- package/std/math/frexp.zig +4 -4
- package/std/math/ilogb.zig +1 -1
- package/std/math/isfinite.zig +1 -1
- package/std/math/isinf.zig +1 -1
- package/std/math/isnan.zig +1 -2
- package/std/math/isnormal.zig +2 -2
- package/std/math/iszero.zig +2 -2
- package/std/math/ldexp.zig +2 -2
- package/std/math/log10.zig +0 -2
- package/std/math/modf.zig +1 -2
- package/std/math/nextafter.zig +3 -4
- package/std/math/pow.zig +1 -1
- package/std/math/powi.zig +2 -3
- package/std/math/signbit.zig +0 -1
- package/std/math.zig +21 -26
- package/std/mem/Allocator.zig +0 -6
- package/std/mem.zig +31 -31
- package/std/meta/trailer_flags.zig +1 -1
- package/std/meta.zig +4 -36
- package/std/multi_array_list.zig +24 -0
- package/std/os/emscripten.zig +7 -6
- package/std/os/linux/IoUring.zig +2 -0
- package/std/os/linux/aarch64.zig +41 -12
- package/std/os/linux/arc.zig +41 -12
- package/std/os/linux/arm.zig +41 -12
- package/std/os/linux/bpf.zig +6 -0
- package/std/os/linux/hexagon.zig +33 -11
- package/std/os/linux/ioctl.zig +2 -2
- package/std/os/linux/loongarch32.zig +41 -13
- package/std/os/linux/loongarch64.zig +41 -12
- package/std/os/linux/m68k.zig +41 -13
- package/std/os/linux/mips.zig +67 -36
- package/std/os/linux/mips64.zig +60 -29
- package/std/os/linux/mipsn32.zig +60 -29
- package/std/os/linux/or1k.zig +41 -12
- package/std/os/linux/powerpc.zig +41 -12
- package/std/os/linux/powerpc64.zig +41 -12
- package/std/os/linux/riscv32.zig +41 -12
- package/std/os/linux/riscv64.zig +41 -12
- package/std/os/linux/s390x.zig +44 -7
- package/std/os/linux/sparc64.zig +83 -52
- package/std/os/linux/syscalls.zig +26 -1
- package/std/os/linux/thumb.zig +52 -36
- package/std/os/linux/x32.zig +41 -12
- package/std/os/linux/x86.zig +44 -15
- package/std/os/linux/x86_64.zig +41 -12
- package/std/os/linux.zig +416 -450
- package/std/os/plan9.zig +1 -1
- package/std/os/uefi/hii.zig +1 -1
- package/std/os/uefi/tables/boot_services.zig +9 -8
- package/std/os/uefi/tables/runtime_services.zig +1 -1
- package/std/os/windows.zig +130 -1
- package/std/os.zig +41 -0
- package/std/posix.zig +1 -1
- package/std/process/Environ.zig +1 -1
- package/std/process.zig +5 -4
- package/std/simd.zig +4 -21
- package/std/sort.zig +3 -3
- package/std/start.zig +17 -4
- package/std/std.zig +8 -1
- package/std/tar/Writer.zig +39 -33
- package/std/tar.zig +8 -4
- package/std/testing.zig +2 -2
- package/std/unicode.zig +13 -8
- package/std/zig/Ast/Render.zig +6 -30
- package/std/zig/Ast.zig +12 -37
- package/std/zig/AstGen.zig +175 -332
- package/std/zig/AstRlAnnotate.zig +1 -22
- package/std/zig/AstSmith.zig +5 -11
- package/std/zig/BuiltinFn.zig +0 -32
- package/std/zig/ErrorBundle.zig +6 -2
- package/std/zig/LibCDirs.zig +15 -6
- package/std/zig/LibCInstallation.zig +34 -12
- package/std/zig/Parse.zig +11 -76
- package/std/zig/TokenSmith.zig +0 -6
- package/std/zig/WindowsSdk.zig +18 -18
- package/std/zig/Zir.zig +65 -132
- package/std/zig/ZonGen.zig +19 -27
- package/std/zig/llvm/Builder.zig +39 -33
- package/std/zig/llvm/bitcode_writer.zig +3 -3
- package/std/zig/llvm/ir.zig +8 -8
- package/std/zig/system/arm.zig +56 -2
- package/std/zig/system/windows.zig +34 -1
- package/std/zig/system/x86.zig +60 -16
- package/std/zig/system.zig +0 -10
- package/std/zig/target.zig +1 -4
- package/std/zig/tokenizer.zig +4 -43
- package/std/zig.zig +3 -14
- package/std/zip.zig +5 -5
- package/std/zon/parse.zig +1 -1
- package/zig.h +340 -1
- package/compiler_rt/long_double.zig +0 -37
- package/include/amxbf16transposeintrin.h +0 -94
- package/include/amxcomplextransposeintrin.h +0 -303
- package/include/amxfp16transposeintrin.h +0 -94
- package/include/amxmovrstransposeintrin.h +0 -200
- package/include/amxtf32transposeintrin.h +0 -105
- package/include/amxtransposeintrin.h +0 -248
- package/libc/include/hexagon-linux-any/asm/signal.h +0 -29
- package/libc/include/s390x-linux-any/asm/tape390.h +0 -103
- package/libc/mingw/math/lrintl.c +0 -18
- package/libc/mingw/math/rintl.c +0 -16
- package/libc/mingw/winpthreads/spinlock.c +0 -82
- package/libc/musl/src/linux/tee.c +0 -8
- package/libc/musl/src/math/i386/lrintl.c +0 -8
- package/libc/musl/src/math/i386/rintl.c +0 -7
- package/libc/musl/src/math/lrintl.c +0 -36
- package/libc/musl/src/math/rintl.c +0 -29
- package/libc/musl/src/math/s390x/rintl.c +0 -15
- package/libc/musl/src/math/x32/lrintl.s +0 -7
- package/libc/musl/src/math/x32/rintl.s +0 -6
- package/libc/musl/src/math/x86_64/lrintl.c +0 -8
- package/libc/musl/src/math/x86_64/rintl.c +0 -7
- package/libc/musl/src/string/strdup.c +0 -10
- package/libc/musl/src/string/strndup.c +0 -12
- package/libc/musl/src/string/wcsdup.c +0 -10
- package/libc/musl/src/thread/pthread_spin_destroy.c +0 -6
- package/libc/musl/src/thread/pthread_spin_init.c +0 -6
- package/libc/musl/src/thread/pthread_spin_lock.c +0 -8
- package/libc/musl/src/thread/pthread_spin_trylock.c +0 -7
- package/libc/musl/src/thread/pthread_spin_unlock.c +0 -7
- package/libc/musl/src/unistd/dup2.c +0 -20
- package/libc/musl/src/unistd/dup3.c +0 -26
- package/libc/wasi/thread-stub/pthread_spin_lock.c +0 -8
- package/libc/wasi/thread-stub/pthread_spin_trylock.c +0 -8
- package/libc/wasi/thread-stub/pthread_spin_unlock.c +0 -7
- package/libtsan/sanitizer_common/sanitizer_coverage_interface.inc +0 -43
- package/std/Build/Step/CheckObject.zig +0 -2764
- /package/std/{builtin → lang}/assembly.zig +0 -0
package/libcxx/include/string
CHANGED
|
@@ -280,6 +280,8 @@ public:
|
|
|
280
280
|
basic_string substr(size_type pos = 0, size_type n = npos) const; // constexpr in C++20, removed in C++23
|
|
281
281
|
basic_string substr(size_type pos = 0, size_type n = npos) const&; // since C++23
|
|
282
282
|
constexpr basic_string substr(size_type pos = 0, size_type n = npos) &&; // since C++23
|
|
283
|
+
constexpr basic_string_view<charT, traits> subview(size_type pos = 0,
|
|
284
|
+
size_type n = npos) const; // since C++26
|
|
283
285
|
void swap(basic_string& str)
|
|
284
286
|
noexcept(allocator_traits<allocator_type>::propagate_on_container_swap::value ||
|
|
285
287
|
allocator_traits<allocator_type>::is_always_equal::value); // C++17, constexpr since C++20
|
|
@@ -598,9 +600,9 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len );
|
|
|
598
600
|
# include <__debug_utils/sanitizers.h>
|
|
599
601
|
# include <__format/enable_insertable.h>
|
|
600
602
|
# include <__functional/hash.h>
|
|
603
|
+
# include <__functional/is_transparent.h>
|
|
601
604
|
# include <__functional/unary_function.h>
|
|
602
605
|
# include <__fwd/string.h>
|
|
603
|
-
# include <__ios/fpos.h>
|
|
604
606
|
# include <__iterator/bounded_iter.h>
|
|
605
607
|
# include <__iterator/distance.h>
|
|
606
608
|
# include <__iterator/iterator_traits.h>
|
|
@@ -620,7 +622,6 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len );
|
|
|
620
622
|
# include <__ranges/concepts.h>
|
|
621
623
|
# include <__ranges/container_compatible_range.h>
|
|
622
624
|
# include <__ranges/from_range.h>
|
|
623
|
-
# include <__ranges/size.h>
|
|
624
625
|
# include <__string/char_traits.h>
|
|
625
626
|
# include <__string/extern_template_lists.h>
|
|
626
627
|
# include <__type_traits/conditional.h>
|
|
@@ -628,24 +629,23 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len );
|
|
|
628
629
|
# include <__type_traits/is_allocator.h>
|
|
629
630
|
# include <__type_traits/is_array.h>
|
|
630
631
|
# include <__type_traits/is_convertible.h>
|
|
632
|
+
# include <__type_traits/is_generic_transparent_comparator.h>
|
|
631
633
|
# include <__type_traits/is_nothrow_assignable.h>
|
|
632
634
|
# include <__type_traits/is_nothrow_constructible.h>
|
|
633
|
-
# include <__type_traits/is_replaceable.h>
|
|
634
635
|
# include <__type_traits/is_same.h>
|
|
635
636
|
# include <__type_traits/is_standard_layout.h>
|
|
636
637
|
# include <__type_traits/is_trivially_constructible.h>
|
|
637
638
|
# include <__type_traits/is_trivially_copyable.h>
|
|
638
639
|
# include <__type_traits/is_trivially_relocatable.h>
|
|
639
640
|
# include <__type_traits/remove_cvref.h>
|
|
640
|
-
# include <
|
|
641
|
-
# include <__utility/
|
|
642
|
-
# include <__utility/declval.h>
|
|
641
|
+
# include <__utility/default_three_way_comparator.h>
|
|
642
|
+
# include <__utility/exception_guard.h>
|
|
643
643
|
# include <__utility/forward.h>
|
|
644
644
|
# include <__utility/is_pointer_in_range.h>
|
|
645
645
|
# include <__utility/move.h>
|
|
646
|
+
# include <__utility/no_destroy.h>
|
|
646
647
|
# include <__utility/scope_guard.h>
|
|
647
648
|
# include <__utility/swap.h>
|
|
648
|
-
# include <__utility/unreachable.h>
|
|
649
649
|
# include <climits>
|
|
650
650
|
# include <cstdio> // EOF
|
|
651
651
|
# include <cstring>
|
|
@@ -700,18 +700,18 @@ __concatenate_strings(const _Allocator& __alloc,
|
|
|
700
700
|
__type_identity_t<basic_string_view<_CharT, _Traits> > __str2);
|
|
701
701
|
|
|
702
702
|
template <class _Iter>
|
|
703
|
-
|
|
703
|
+
inline const bool __string_is_trivial_iterator_v = false;
|
|
704
704
|
|
|
705
705
|
template <class _Tp>
|
|
706
|
-
|
|
706
|
+
inline const bool __string_is_trivial_iterator_v<_Tp*> = is_arithmetic<_Tp>::value;
|
|
707
707
|
|
|
708
708
|
template <class _Iter>
|
|
709
|
-
|
|
709
|
+
inline const bool __string_is_trivial_iterator_v<__wrap_iter<_Iter> > = __string_is_trivial_iterator_v<_Iter>;
|
|
710
710
|
|
|
711
711
|
template <class _CharT, class _Traits, class _Tp>
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
712
|
+
inline const bool __can_be_converted_to_string_view_v =
|
|
713
|
+
is_convertible<const _Tp&, basic_string_view<_CharT, _Traits> >::value &&
|
|
714
|
+
!is_convertible<const _Tp&, const _CharT*>::value;
|
|
715
715
|
|
|
716
716
|
struct __uninitialized_size_tag {};
|
|
717
717
|
struct __init_with_sentinel_tag {};
|
|
@@ -756,20 +756,13 @@ public:
|
|
|
756
756
|
// external memory. In such cases, the destructor is responsible for unpoisoning
|
|
757
757
|
// the memory to avoid triggering false positives.
|
|
758
758
|
// Therefore it's crucial to ensure the destructor is called.
|
|
759
|
-
|
|
760
|
-
// However, it is replaceable since implementing move-assignment as a destroy + move-construct
|
|
761
|
-
// will maintain the right ASAN state.
|
|
762
|
-
using __trivially_relocatable = void;
|
|
759
|
+
using __trivially_relocatable _LIBCPP_NODEBUG = void;
|
|
763
760
|
# else
|
|
764
761
|
using __trivially_relocatable _LIBCPP_NODEBUG = __conditional_t<
|
|
765
762
|
__libcpp_is_trivially_relocatable<allocator_type>::value && __libcpp_is_trivially_relocatable<pointer>::value,
|
|
766
763
|
basic_string,
|
|
767
764
|
void>;
|
|
768
765
|
# endif
|
|
769
|
-
using __replaceable _LIBCPP_NODEBUG =
|
|
770
|
-
__conditional_t<__is_replaceable_v<pointer> && __container_allocator_is_replaceable<__alloc_traits>::value,
|
|
771
|
-
basic_string,
|
|
772
|
-
void>;
|
|
773
766
|
|
|
774
767
|
# if __has_feature(address_sanitizer) && _LIBCPP_INSTRUMENTED_WITH_ASAN
|
|
775
768
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __asan_volatile_wrapper(pointer const& __ptr) const {
|
|
@@ -819,12 +812,21 @@ public:
|
|
|
819
812
|
using reverse_iterator = std::reverse_iterator<iterator>;
|
|
820
813
|
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
|
821
814
|
|
|
815
|
+
using __alloc_result _LIBCPP_NODEBUG = __allocation_result<pointer, size_type>;
|
|
816
|
+
|
|
822
817
|
private:
|
|
823
818
|
static_assert(CHAR_BIT == 8, "This implementation assumes that one byte contains 8 bits");
|
|
824
819
|
|
|
825
820
|
# ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
|
|
826
821
|
|
|
827
822
|
struct __long {
|
|
823
|
+
__long() = default;
|
|
824
|
+
|
|
825
|
+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __long(__alloc_result __alloc, size_type __size)
|
|
826
|
+
: __data_(__alloc.ptr), __size_(__size), __cap_(__alloc.count / __endian_factor), __is_long_(true) {
|
|
827
|
+
_LIBCPP_ASSERT_INTERNAL(!__fits_in_sso(__alloc.count), "Long capacity should always be larger than the SSO");
|
|
828
|
+
}
|
|
829
|
+
|
|
828
830
|
pointer __data_;
|
|
829
831
|
size_type __size_;
|
|
830
832
|
size_type __cap_ : sizeof(size_type) * CHAR_BIT - 1;
|
|
@@ -872,6 +874,13 @@ private:
|
|
|
872
874
|
// some platforms bit fields have a default size rather than the actual
|
|
873
875
|
// size used, e.g., it is 4 bytes on AIX. See D128285 for details.
|
|
874
876
|
struct __long {
|
|
877
|
+
__long() = default;
|
|
878
|
+
|
|
879
|
+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __long(__alloc_result __alloc, size_type __size)
|
|
880
|
+
: __is_long_(true), __cap_(__alloc.count / __endian_factor), __size_(__size), __data_(__alloc.ptr) {
|
|
881
|
+
_LIBCPP_ASSERT_INTERNAL(!__fits_in_sso(__alloc.count), "Long capacity should always be larger than the SSO");
|
|
882
|
+
}
|
|
883
|
+
|
|
875
884
|
struct _LIBCPP_PACKED {
|
|
876
885
|
size_type __is_long_ : 1;
|
|
877
886
|
size_type __cap_ : sizeof(size_type) * CHAR_BIT - 1;
|
|
@@ -898,6 +907,11 @@ private:
|
|
|
898
907
|
union __rep {
|
|
899
908
|
__short __s;
|
|
900
909
|
__long __l;
|
|
910
|
+
|
|
911
|
+
__rep() = default;
|
|
912
|
+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __rep(__short __r) : __s(__r) {}
|
|
913
|
+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __rep(__long __r) : __l(__r) {}
|
|
914
|
+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __rep(__uninitialized_tag) {}
|
|
901
915
|
};
|
|
902
916
|
|
|
903
917
|
_LIBCPP_COMPRESSED_PAIR(__rep, __rep_, allocator_type, __alloc_);
|
|
@@ -917,20 +931,7 @@ private:
|
|
|
917
931
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(
|
|
918
932
|
__uninitialized_size_tag, size_type __size, const allocator_type& __a)
|
|
919
933
|
: __alloc_(__a) {
|
|
920
|
-
|
|
921
|
-
this->__throw_length_error();
|
|
922
|
-
if (__fits_in_sso(__size)) {
|
|
923
|
-
__rep_ = __rep();
|
|
924
|
-
__set_short_size(__size);
|
|
925
|
-
} else {
|
|
926
|
-
auto __capacity = __recommend(__size) + 1;
|
|
927
|
-
auto __allocation = __alloc_traits::allocate(__alloc_, __capacity);
|
|
928
|
-
__begin_lifetime(__allocation, __capacity);
|
|
929
|
-
__set_long_cap(__capacity);
|
|
930
|
-
__set_long_pointer(__allocation);
|
|
931
|
-
__set_long_size(__size);
|
|
932
|
-
}
|
|
933
|
-
__annotate_new(__size);
|
|
934
|
+
__init_internal_buffer(__size);
|
|
934
935
|
}
|
|
935
936
|
|
|
936
937
|
template <class _Iter, class _Sent>
|
|
@@ -966,7 +967,7 @@ private:
|
|
|
966
967
|
std::__wrap_iter<const_pointer>(__get_pointer() + size()));
|
|
967
968
|
# else
|
|
968
969
|
return const_iterator(__p);
|
|
969
|
-
# endif
|
|
970
|
+
# endif // _LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING
|
|
970
971
|
}
|
|
971
972
|
|
|
972
973
|
public:
|
|
@@ -1057,13 +1058,13 @@ public:
|
|
|
1057
1058
|
}
|
|
1058
1059
|
# endif // _LIBCPP_CXX03_LANG
|
|
1059
1060
|
|
|
1060
|
-
template <__enable_if_t<
|
|
1061
|
+
template <__enable_if_t<__is_allocator_v<_Allocator>, int> = 0>
|
|
1061
1062
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* _LIBCPP_DIAGNOSE_NULLPTR __s) {
|
|
1062
1063
|
_LIBCPP_ASSERT_NON_NULL(__s != nullptr, "basic_string(const char*) detected nullptr");
|
|
1063
1064
|
__init(__s, traits_type::length(__s));
|
|
1064
1065
|
}
|
|
1065
1066
|
|
|
1066
|
-
template <__enable_if_t<
|
|
1067
|
+
template <__enable_if_t<__is_allocator_v<_Allocator>, int> = 0>
|
|
1067
1068
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
|
1068
1069
|
basic_string(const _CharT* _LIBCPP_DIAGNOSE_NULLPTR __s, const _Allocator& __a)
|
|
1069
1070
|
: __alloc_(__a) {
|
|
@@ -1075,13 +1076,15 @@ public:
|
|
|
1075
1076
|
basic_string(nullptr_t) = delete;
|
|
1076
1077
|
# endif
|
|
1077
1078
|
|
|
1078
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, size_type __n)
|
|
1079
|
+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, size_type __n)
|
|
1080
|
+
_LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero") {
|
|
1079
1081
|
_LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr");
|
|
1080
1082
|
__init(__s, __n);
|
|
1081
1083
|
}
|
|
1082
1084
|
|
|
1083
1085
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
|
1084
1086
|
basic_string(const _CharT* __s, size_type __n, const _Allocator& __a)
|
|
1087
|
+
_LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero")
|
|
1085
1088
|
: __alloc_(__a) {
|
|
1086
1089
|
_LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr");
|
|
1087
1090
|
__init(__s, __n);
|
|
@@ -1110,7 +1113,7 @@ public:
|
|
|
1110
1113
|
}
|
|
1111
1114
|
# endif
|
|
1112
1115
|
|
|
1113
|
-
template <__enable_if_t<
|
|
1116
|
+
template <__enable_if_t<__is_allocator_v<_Allocator>, int> = 0>
|
|
1114
1117
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(size_type __n, _CharT __c, const _Allocator& __a)
|
|
1115
1118
|
: __alloc_(__a) {
|
|
1116
1119
|
__init(__n, __c);
|
|
@@ -1135,7 +1138,7 @@ public:
|
|
|
1135
1138
|
}
|
|
1136
1139
|
|
|
1137
1140
|
template <class _Tp,
|
|
1138
|
-
__enable_if_t<
|
|
1141
|
+
__enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> &&
|
|
1139
1142
|
!is_same<__remove_cvref_t<_Tp>, basic_string>::value,
|
|
1140
1143
|
int> = 0>
|
|
1141
1144
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
|
@@ -1147,7 +1150,7 @@ public:
|
|
|
1147
1150
|
}
|
|
1148
1151
|
|
|
1149
1152
|
template <class _Tp,
|
|
1150
|
-
__enable_if_t<
|
|
1153
|
+
__enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> &&
|
|
1151
1154
|
!is_same<__remove_cvref_t<_Tp>, basic_string>::value,
|
|
1152
1155
|
int> = 0>
|
|
1153
1156
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(const _Tp& __t) {
|
|
@@ -1156,7 +1159,7 @@ public:
|
|
|
1156
1159
|
}
|
|
1157
1160
|
|
|
1158
1161
|
template <class _Tp,
|
|
1159
|
-
__enable_if_t<
|
|
1162
|
+
__enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> &&
|
|
1160
1163
|
!is_same<__remove_cvref_t<_Tp>, basic_string>::value,
|
|
1161
1164
|
int> = 0>
|
|
1162
1165
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(const _Tp& __t, const allocator_type& __a)
|
|
@@ -1201,11 +1204,10 @@ public:
|
|
|
1201
1204
|
}
|
|
1202
1205
|
# endif // _LIBCPP_CXX03_LANG
|
|
1203
1206
|
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
}
|
|
1207
|
+
// TODO(boomanaiden154): Once we mark this in destructors as dead on return,
|
|
1208
|
+
// we can use a normal call to __reset_internal_buffer and remove the extra
|
|
1209
|
+
// __rep constructor.
|
|
1210
|
+
inline _LIBCPP_CONSTEXPR_SINCE_CXX20 ~basic_string() { __reset_internal_buffer(__rep(__uninitialized_tag())); }
|
|
1209
1211
|
|
|
1210
1212
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 operator __self_view() const _NOEXCEPT {
|
|
1211
1213
|
return __self_view(typename __self_view::__assume_valid(), data(), size());
|
|
@@ -1215,7 +1217,7 @@ public:
|
|
|
1215
1217
|
operator=(const basic_string& __str);
|
|
1216
1218
|
|
|
1217
1219
|
template <class _Tp,
|
|
1218
|
-
__enable_if_t<
|
|
1220
|
+
__enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> &&
|
|
1219
1221
|
!is_same<__remove_cvref_t<_Tp>, basic_string>::value,
|
|
1220
1222
|
int> = 0>
|
|
1221
1223
|
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(const _Tp& __t) {
|
|
@@ -1243,45 +1245,55 @@ public:
|
|
|
1243
1245
|
# endif
|
|
1244
1246
|
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(value_type __c);
|
|
1245
1247
|
|
|
1246
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator begin() _NOEXCEPT {
|
|
1248
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator begin() _NOEXCEPT {
|
|
1247
1249
|
return __make_iterator(__get_pointer());
|
|
1248
1250
|
}
|
|
1249
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator begin() const _NOEXCEPT {
|
|
1251
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator begin() const _NOEXCEPT {
|
|
1250
1252
|
return __make_const_iterator(__get_pointer());
|
|
1251
1253
|
}
|
|
1252
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator end() _NOEXCEPT {
|
|
1254
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator end() _NOEXCEPT {
|
|
1253
1255
|
return __make_iterator(__get_pointer() + size());
|
|
1254
1256
|
}
|
|
1255
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator end() const _NOEXCEPT {
|
|
1257
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator end() const _NOEXCEPT {
|
|
1256
1258
|
return __make_const_iterator(__get_pointer() + size());
|
|
1257
1259
|
}
|
|
1258
1260
|
|
|
1259
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reverse_iterator rbegin() _NOEXCEPT {
|
|
1261
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reverse_iterator rbegin() _NOEXCEPT {
|
|
1260
1262
|
return reverse_iterator(end());
|
|
1261
1263
|
}
|
|
1262
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator
|
|
1264
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator
|
|
1265
|
+
rbegin() const _NOEXCEPT {
|
|
1263
1266
|
return const_reverse_iterator(end());
|
|
1264
1267
|
}
|
|
1265
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reverse_iterator rend() _NOEXCEPT {
|
|
1268
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reverse_iterator rend() _NOEXCEPT {
|
|
1266
1269
|
return reverse_iterator(begin());
|
|
1267
1270
|
}
|
|
1268
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator rend() const _NOEXCEPT {
|
|
1271
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator rend() const _NOEXCEPT {
|
|
1269
1272
|
return const_reverse_iterator(begin());
|
|
1270
1273
|
}
|
|
1271
1274
|
|
|
1272
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator cbegin() const _NOEXCEPT {
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator cbegin() const _NOEXCEPT {
|
|
1276
|
+
return begin();
|
|
1277
|
+
}
|
|
1278
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_iterator cend() const _NOEXCEPT {
|
|
1279
|
+
return end();
|
|
1280
|
+
}
|
|
1281
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator
|
|
1282
|
+
crbegin() const _NOEXCEPT {
|
|
1275
1283
|
return rbegin();
|
|
1276
1284
|
}
|
|
1277
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator crend() const _NOEXCEPT {
|
|
1285
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reverse_iterator crend() const _NOEXCEPT {
|
|
1286
|
+
return rend();
|
|
1287
|
+
}
|
|
1278
1288
|
|
|
1279
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type size() const _NOEXCEPT {
|
|
1289
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type size() const _NOEXCEPT {
|
|
1280
1290
|
return __is_long() ? __get_long_size() : __get_short_size();
|
|
1281
1291
|
}
|
|
1282
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type length() const _NOEXCEPT {
|
|
1292
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type length() const _NOEXCEPT {
|
|
1293
|
+
return size();
|
|
1294
|
+
}
|
|
1283
1295
|
|
|
1284
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type max_size() const _NOEXCEPT {
|
|
1296
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type max_size() const _NOEXCEPT {
|
|
1285
1297
|
if (size_type __m = __alloc_traits::max_size(__alloc_); __m <= std::numeric_limits<size_type>::max() / 2) {
|
|
1286
1298
|
size_type __res = __m - __alignment;
|
|
1287
1299
|
|
|
@@ -1299,7 +1311,7 @@ public:
|
|
|
1299
1311
|
}
|
|
1300
1312
|
}
|
|
1301
1313
|
|
|
1302
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type capacity() const _NOEXCEPT {
|
|
1314
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type capacity() const _NOEXCEPT {
|
|
1303
1315
|
return (__is_long() ? __get_long_cap() : static_cast<size_type>(__min_cap)) - 1;
|
|
1304
1316
|
}
|
|
1305
1317
|
|
|
@@ -1311,13 +1323,19 @@ public:
|
|
|
1311
1323
|
# if _LIBCPP_STD_VER >= 23
|
|
1312
1324
|
template <class _Op>
|
|
1313
1325
|
_LIBCPP_HIDE_FROM_ABI constexpr void resize_and_overwrite(size_type __n, _Op __op) {
|
|
1314
|
-
|
|
1315
|
-
|
|
1326
|
+
using __result_type = decltype(std::move(__op)(data(), auto(__n)));
|
|
1327
|
+
static_assert(__integer_like<__result_type>, "Operation return type must be integer-like");
|
|
1328
|
+
size_type __sz = size();
|
|
1329
|
+
size_type __cap = capacity();
|
|
1330
|
+
if (__n > __cap)
|
|
1331
|
+
__grow_by_without_replace(__cap, __n - __cap, __sz, __sz, 0);
|
|
1332
|
+
__annotate_delete();
|
|
1333
|
+
__set_size(__n);
|
|
1334
|
+
__annotate_new(__n);
|
|
1335
|
+
__erase_to_end(std::move(__op)(data(), auto(__n)));
|
|
1316
1336
|
}
|
|
1317
1337
|
# endif
|
|
1318
1338
|
|
|
1319
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __resize_default_init(size_type __n);
|
|
1320
|
-
|
|
1321
1339
|
# if _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_STRING_RESERVE)
|
|
1322
1340
|
_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI void reserve() _NOEXCEPT { shrink_to_fit(); }
|
|
1323
1341
|
# endif
|
|
@@ -1328,7 +1346,8 @@ public:
|
|
|
1328
1346
|
return size() == 0;
|
|
1329
1347
|
}
|
|
1330
1348
|
|
|
1331
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference
|
|
1349
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference
|
|
1350
|
+
operator[](size_type __pos) const _NOEXCEPT {
|
|
1332
1351
|
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__pos <= size(), "string index out of bounds");
|
|
1333
1352
|
if (__builtin_constant_p(__pos) && !__fits_in_sso(__pos)) {
|
|
1334
1353
|
return *(__get_long_pointer() + __pos);
|
|
@@ -1336,7 +1355,8 @@ public:
|
|
|
1336
1355
|
return *(data() + __pos);
|
|
1337
1356
|
}
|
|
1338
1357
|
|
|
1339
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference
|
|
1358
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference
|
|
1359
|
+
operator[](size_type __pos) _NOEXCEPT {
|
|
1340
1360
|
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__pos <= size(), "string index out of bounds");
|
|
1341
1361
|
if (__builtin_constant_p(__pos) && !__fits_in_sso(__pos)) {
|
|
1342
1362
|
return *(__get_long_pointer() + __pos);
|
|
@@ -1344,15 +1364,15 @@ public:
|
|
|
1344
1364
|
return *(__get_pointer() + __pos);
|
|
1345
1365
|
}
|
|
1346
1366
|
|
|
1347
|
-
_LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference at(size_type __n) const;
|
|
1348
|
-
_LIBCPP_CONSTEXPR_SINCE_CXX20 reference at(size_type __n);
|
|
1367
|
+
[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference at(size_type __n) const;
|
|
1368
|
+
[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 reference at(size_type __n);
|
|
1349
1369
|
|
|
1350
1370
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(const basic_string& __str) {
|
|
1351
1371
|
return append(__str);
|
|
1352
1372
|
}
|
|
1353
1373
|
|
|
1354
1374
|
template <class _Tp,
|
|
1355
|
-
__enable_if_t<
|
|
1375
|
+
__enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> &&
|
|
1356
1376
|
!is_same<__remove_cvref_t<_Tp>, basic_string >::value,
|
|
1357
1377
|
int> = 0>
|
|
1358
1378
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(const _Tp& __t) {
|
|
@@ -1381,7 +1401,7 @@ public:
|
|
|
1381
1401
|
}
|
|
1382
1402
|
|
|
1383
1403
|
template <class _Tp,
|
|
1384
|
-
__enable_if_t<
|
|
1404
|
+
__enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> &&
|
|
1385
1405
|
!is_same<__remove_cvref_t<_Tp>, basic_string>::value,
|
|
1386
1406
|
int> = 0>
|
|
1387
1407
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const _Tp& __t) {
|
|
@@ -1392,7 +1412,7 @@ public:
|
|
|
1392
1412
|
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const basic_string& __str, size_type __pos, size_type __n = npos);
|
|
1393
1413
|
|
|
1394
1414
|
template <class _Tp,
|
|
1395
|
-
__enable_if_t<
|
|
1415
|
+
__enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> &&
|
|
1396
1416
|
!is_same<__remove_cvref_t<_Tp>, basic_string>::value,
|
|
1397
1417
|
int> = 0>
|
|
1398
1418
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
|
|
@@ -1404,12 +1424,11 @@ public:
|
|
|
1404
1424
|
return append(__sv.data() + __pos, std::min(__n, __sz - __pos));
|
|
1405
1425
|
}
|
|
1406
1426
|
|
|
1407
|
-
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* __s, size_type __n)
|
|
1427
|
+
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* __s, size_type __n)
|
|
1428
|
+
_LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero");
|
|
1408
1429
|
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s);
|
|
1409
1430
|
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(size_type __n, value_type __c);
|
|
1410
1431
|
|
|
1411
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __append_default_init(size_type __n);
|
|
1412
|
-
|
|
1413
1432
|
template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
|
|
1414
1433
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
|
|
1415
1434
|
append(_InputIterator __first, _InputIterator __last) {
|
|
@@ -1424,20 +1443,21 @@ public:
|
|
|
1424
1443
|
size_type __sz = size();
|
|
1425
1444
|
size_type __cap = capacity();
|
|
1426
1445
|
size_type __n = static_cast<size_type>(std::distance(__first, __last));
|
|
1427
|
-
if (__n)
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1446
|
+
if (__n == 0)
|
|
1447
|
+
return *this;
|
|
1448
|
+
|
|
1449
|
+
if (__string_is_trivial_iterator_v<_ForwardIterator> && !__addr_in_range(*__first)) {
|
|
1450
|
+
if (__cap - __sz < __n)
|
|
1451
|
+
__grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0);
|
|
1452
|
+
__annotate_increase(__n);
|
|
1453
|
+
auto __end = __copy_non_overlapping_range(__first, __last, std::__to_address(__get_pointer() + __sz));
|
|
1454
|
+
traits_type::assign(*__end, value_type());
|
|
1455
|
+
__set_size(__sz + __n);
|
|
1456
|
+
return *this;
|
|
1457
|
+
} else {
|
|
1458
|
+
const basic_string __temp(__first, __last, __alloc_);
|
|
1459
|
+
return append(__temp.data(), __temp.size());
|
|
1439
1460
|
}
|
|
1440
|
-
return *this;
|
|
1441
1461
|
}
|
|
1442
1462
|
|
|
1443
1463
|
# if _LIBCPP_STD_VER >= 23
|
|
@@ -1457,27 +1477,27 @@ public:
|
|
|
1457
1477
|
_LIBCPP_CONSTEXPR_SINCE_CXX20 void push_back(value_type __c);
|
|
1458
1478
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void pop_back();
|
|
1459
1479
|
|
|
1460
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference front() _NOEXCEPT {
|
|
1480
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference front() _NOEXCEPT {
|
|
1461
1481
|
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "string::front(): string is empty");
|
|
1462
1482
|
return *__get_pointer();
|
|
1463
1483
|
}
|
|
1464
1484
|
|
|
1465
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference front() const _NOEXCEPT {
|
|
1485
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference front() const _NOEXCEPT {
|
|
1466
1486
|
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "string::front(): string is empty");
|
|
1467
1487
|
return *data();
|
|
1468
1488
|
}
|
|
1469
1489
|
|
|
1470
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference back() _NOEXCEPT {
|
|
1490
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference back() _NOEXCEPT {
|
|
1471
1491
|
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "string::back(): string is empty");
|
|
1472
1492
|
return *(__get_pointer() + size() - 1);
|
|
1473
1493
|
}
|
|
1474
1494
|
|
|
1475
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference back() const _NOEXCEPT {
|
|
1495
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference back() const _NOEXCEPT {
|
|
1476
1496
|
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "string::back(): string is empty");
|
|
1477
1497
|
return *(data() + size() - 1);
|
|
1478
1498
|
}
|
|
1479
1499
|
|
|
1480
|
-
template <class _Tp, __enable_if_t<
|
|
1500
|
+
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
|
|
1481
1501
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const _Tp& __t) {
|
|
1482
1502
|
__self_view __sv = __t;
|
|
1483
1503
|
return assign(__sv.data(), __sv.size());
|
|
@@ -1519,7 +1539,7 @@ public:
|
|
|
1519
1539
|
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const basic_string& __str, size_type __pos, size_type __n = npos);
|
|
1520
1540
|
|
|
1521
1541
|
template <class _Tp,
|
|
1522
|
-
__enable_if_t<
|
|
1542
|
+
__enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> &&
|
|
1523
1543
|
!is_same<__remove_cvref_t<_Tp>, basic_string>::value,
|
|
1524
1544
|
int> = 0>
|
|
1525
1545
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
|
|
@@ -1531,8 +1551,9 @@ public:
|
|
|
1531
1551
|
return assign(__sv.data() + __pos, std::min(__n, __sz - __pos));
|
|
1532
1552
|
}
|
|
1533
1553
|
|
|
1534
|
-
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* __s, size_type __n)
|
|
1535
|
-
|
|
1554
|
+
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* __s, size_type __n)
|
|
1555
|
+
_LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero");
|
|
1556
|
+
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s);
|
|
1536
1557
|
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(size_type __n, value_type __c);
|
|
1537
1558
|
|
|
1538
1559
|
template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value, int> = 0>
|
|
@@ -1545,7 +1566,7 @@ public:
|
|
|
1545
1566
|
template <class _ForwardIterator, __enable_if_t<__has_forward_iterator_category<_ForwardIterator>::value, int> = 0>
|
|
1546
1567
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
|
|
1547
1568
|
assign(_ForwardIterator __first, _ForwardIterator __last) {
|
|
1548
|
-
if (
|
|
1569
|
+
if (__string_is_trivial_iterator_v<_ForwardIterator>) {
|
|
1549
1570
|
size_type __n = static_cast<size_type>(std::distance(__first, __last));
|
|
1550
1571
|
__assign_trivial(__first, __last, __n);
|
|
1551
1572
|
} else {
|
|
@@ -1558,7 +1579,7 @@ public:
|
|
|
1558
1579
|
# if _LIBCPP_STD_VER >= 23
|
|
1559
1580
|
template <_ContainerCompatibleRange<_CharT> _Range>
|
|
1560
1581
|
_LIBCPP_HIDE_FROM_ABI constexpr basic_string& assign_range(_Range&& __range) {
|
|
1561
|
-
if constexpr (
|
|
1582
|
+
if constexpr (__string_is_trivial_iterator_v<ranges::iterator_t<_Range>> &&
|
|
1562
1583
|
(ranges::forward_range<_Range> || ranges::sized_range<_Range>)) {
|
|
1563
1584
|
size_type __n = static_cast<size_type>(ranges::distance(__range));
|
|
1564
1585
|
__assign_trivial(ranges::begin(__range), ranges::end(__range), __n);
|
|
@@ -1582,14 +1603,14 @@ public:
|
|
|
1582
1603
|
return insert(__pos1, __str.data(), __str.size());
|
|
1583
1604
|
}
|
|
1584
1605
|
|
|
1585
|
-
template <class _Tp, __enable_if_t<
|
|
1606
|
+
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
|
|
1586
1607
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& insert(size_type __pos1, const _Tp& __t) {
|
|
1587
1608
|
__self_view __sv = __t;
|
|
1588
1609
|
return insert(__pos1, __sv.data(), __sv.size());
|
|
1589
1610
|
}
|
|
1590
1611
|
|
|
1591
1612
|
template <class _Tp,
|
|
1592
|
-
__enable_if_t<
|
|
1613
|
+
__enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> &&
|
|
1593
1614
|
!is_same<__remove_cvref_t<_Tp>, basic_string>::value,
|
|
1594
1615
|
int> = 0>
|
|
1595
1616
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
|
|
@@ -1603,7 +1624,8 @@ public:
|
|
|
1603
1624
|
|
|
1604
1625
|
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
|
|
1605
1626
|
insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n = npos);
|
|
1606
|
-
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& insert(size_type __pos, const value_type* __s, size_type __n)
|
|
1627
|
+
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& insert(size_type __pos, const value_type* __s, size_type __n)
|
|
1628
|
+
_LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero");
|
|
1607
1629
|
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& insert(size_type __pos, const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s);
|
|
1608
1630
|
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& insert(size_type __pos, size_type __n, value_type __c);
|
|
1609
1631
|
_LIBCPP_CONSTEXPR_SINCE_CXX20 iterator insert(const_iterator __pos, value_type __c);
|
|
@@ -1659,7 +1681,7 @@ public:
|
|
|
1659
1681
|
return replace(__pos1, __n1, __str.data(), __str.size());
|
|
1660
1682
|
}
|
|
1661
1683
|
|
|
1662
|
-
template <class _Tp, __enable_if_t<
|
|
1684
|
+
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
|
|
1663
1685
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
|
|
1664
1686
|
replace(size_type __pos1, size_type __n1, const _Tp& __t) {
|
|
1665
1687
|
__self_view __sv = __t;
|
|
@@ -1670,7 +1692,7 @@ public:
|
|
|
1670
1692
|
replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2 = npos);
|
|
1671
1693
|
|
|
1672
1694
|
template <class _Tp,
|
|
1673
|
-
__enable_if_t<
|
|
1695
|
+
__enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> &&
|
|
1674
1696
|
!is_same<__remove_cvref_t<_Tp>, basic_string>::value,
|
|
1675
1697
|
int> = 0>
|
|
1676
1698
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
|
|
@@ -1683,8 +1705,10 @@ public:
|
|
|
1683
1705
|
}
|
|
1684
1706
|
|
|
1685
1707
|
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
|
|
1686
|
-
replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2)
|
|
1687
|
-
|
|
1708
|
+
replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2)
|
|
1709
|
+
_LIBCPP_DIAGNOSE_NULLPTR_IF(__n2 != 0 && __s == nullptr, " if n2 is not zero");
|
|
1710
|
+
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
|
|
1711
|
+
replace(size_type __pos, size_type __n1, const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s);
|
|
1688
1712
|
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c);
|
|
1689
1713
|
|
|
1690
1714
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
|
|
@@ -1693,7 +1717,7 @@ public:
|
|
|
1693
1717
|
static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __str.data(), __str.size());
|
|
1694
1718
|
}
|
|
1695
1719
|
|
|
1696
|
-
template <class _Tp, __enable_if_t<
|
|
1720
|
+
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
|
|
1697
1721
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
|
|
1698
1722
|
replace(const_iterator __i1, const_iterator __i2, const _Tp& __t) {
|
|
1699
1723
|
__self_view __sv = __t;
|
|
@@ -1741,19 +1765,24 @@ public:
|
|
|
1741
1765
|
_LIBCPP_CONSTEXPR_SINCE_CXX20 size_type copy(value_type* __s, size_type __n, size_type __pos = 0) const;
|
|
1742
1766
|
|
|
1743
1767
|
# if _LIBCPP_STD_VER <= 20
|
|
1744
|
-
_LIBCPP_HIDE_FROM_ABI
|
|
1745
|
-
substr(size_type __pos = 0, size_type __n = npos) const {
|
|
1768
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI
|
|
1769
|
+
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string substr(size_type __pos = 0, size_type __n = npos) const {
|
|
1746
1770
|
return basic_string(*this, __pos, __n);
|
|
1747
1771
|
}
|
|
1748
1772
|
# else
|
|
1749
|
-
_LIBCPP_HIDE_FROM_ABI constexpr basic_string substr(size_type __pos = 0, size_type __n = npos) const& {
|
|
1773
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr basic_string substr(size_type __pos = 0, size_type __n = npos) const& {
|
|
1750
1774
|
return basic_string(*this, __pos, __n);
|
|
1751
1775
|
}
|
|
1752
1776
|
|
|
1753
|
-
_LIBCPP_HIDE_FROM_ABI constexpr basic_string substr(size_type __pos = 0, size_type __n = npos) && {
|
|
1777
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr basic_string substr(size_type __pos = 0, size_type __n = npos) && {
|
|
1754
1778
|
return basic_string(std::move(*this), __pos, __n);
|
|
1755
1779
|
}
|
|
1756
1780
|
# endif
|
|
1781
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1782
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __self_view subview(size_type __pos = 0, size_type __n = npos) const {
|
|
1783
|
+
return __self_view(*this).subview(__pos, __n);
|
|
1784
|
+
}
|
|
1785
|
+
# endif
|
|
1757
1786
|
|
|
1758
1787
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(basic_string& __str)
|
|
1759
1788
|
# if _LIBCPP_STD_VER >= 14
|
|
@@ -1765,225 +1794,238 @@ public:
|
|
|
1765
1794
|
// [string.ops]
|
|
1766
1795
|
// ------------
|
|
1767
1796
|
|
|
1768
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const value_type* c_str() const _NOEXCEPT {
|
|
1769
|
-
|
|
1797
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const value_type* c_str() const _NOEXCEPT {
|
|
1798
|
+
return data();
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const value_type* data() const _NOEXCEPT {
|
|
1770
1802
|
return std::__to_address(__get_pointer());
|
|
1771
1803
|
}
|
|
1772
1804
|
# if _LIBCPP_STD_VER >= 17
|
|
1773
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 value_type* data() _NOEXCEPT {
|
|
1805
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 value_type* data() _NOEXCEPT {
|
|
1774
1806
|
return std::__to_address(__get_pointer());
|
|
1775
1807
|
}
|
|
1776
1808
|
# endif
|
|
1777
1809
|
|
|
1778
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator_type get_allocator() const _NOEXCEPT {
|
|
1810
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator_type get_allocator() const _NOEXCEPT {
|
|
1779
1811
|
return __alloc_;
|
|
1780
1812
|
}
|
|
1781
1813
|
|
|
1782
1814
|
// find
|
|
1783
1815
|
|
|
1784
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1816
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1785
1817
|
find(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT {
|
|
1786
1818
|
return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __str.data(), __pos, __str.size());
|
|
1787
1819
|
}
|
|
1788
1820
|
|
|
1789
|
-
template <class _Tp, __enable_if_t<
|
|
1790
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1821
|
+
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
|
|
1822
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1791
1823
|
find(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT {
|
|
1792
1824
|
__self_view __sv = __t;
|
|
1793
1825
|
return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __sv.data(), __pos, __sv.size());
|
|
1794
1826
|
}
|
|
1795
1827
|
|
|
1796
|
-
_LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1828
|
+
[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1829
|
+
find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT
|
|
1830
|
+
_LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero") {
|
|
1797
1831
|
_LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find(): received nullptr");
|
|
1798
1832
|
return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
|
|
1799
1833
|
}
|
|
1800
1834
|
|
|
1801
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1835
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1802
1836
|
find(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = 0) const _NOEXCEPT {
|
|
1803
1837
|
_LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find(): received nullptr");
|
|
1804
1838
|
return std::__str_find<value_type, size_type, traits_type, npos>(
|
|
1805
1839
|
data(), size(), __s, __pos, traits_type::length(__s));
|
|
1806
1840
|
}
|
|
1807
1841
|
|
|
1808
|
-
_LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find(value_type __c, size_type __pos = 0) const _NOEXCEPT {
|
|
1842
|
+
[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find(value_type __c, size_type __pos = 0) const _NOEXCEPT {
|
|
1809
1843
|
return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
|
|
1810
1844
|
}
|
|
1811
1845
|
|
|
1812
1846
|
// rfind
|
|
1813
1847
|
|
|
1814
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1848
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1815
1849
|
rfind(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT {
|
|
1816
1850
|
return std::__str_rfind<value_type, size_type, traits_type, npos>(
|
|
1817
1851
|
data(), size(), __str.data(), __pos, __str.size());
|
|
1818
1852
|
}
|
|
1819
1853
|
|
|
1820
|
-
template <class _Tp, __enable_if_t<
|
|
1821
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1854
|
+
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
|
|
1855
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1822
1856
|
rfind(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT {
|
|
1823
1857
|
__self_view __sv = __t;
|
|
1824
1858
|
return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __sv.data(), __pos, __sv.size());
|
|
1825
1859
|
}
|
|
1826
1860
|
|
|
1827
|
-
_LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1861
|
+
[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1862
|
+
rfind(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT
|
|
1863
|
+
_LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero") {
|
|
1828
1864
|
_LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::rfind(): received nullptr");
|
|
1829
1865
|
return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
|
|
1830
1866
|
}
|
|
1831
1867
|
|
|
1832
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1868
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1833
1869
|
rfind(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = npos) const _NOEXCEPT {
|
|
1834
1870
|
_LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::rfind(): received nullptr");
|
|
1835
1871
|
return std::__str_rfind<value_type, size_type, traits_type, npos>(
|
|
1836
1872
|
data(), size(), __s, __pos, traits_type::length(__s));
|
|
1837
1873
|
}
|
|
1838
1874
|
|
|
1839
|
-
_LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1875
|
+
[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1876
|
+
rfind(value_type __c, size_type __pos = npos) const _NOEXCEPT {
|
|
1840
1877
|
return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
|
|
1841
1878
|
}
|
|
1842
1879
|
|
|
1843
1880
|
// find_first_of
|
|
1844
1881
|
|
|
1845
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1882
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1846
1883
|
find_first_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT {
|
|
1847
1884
|
return std::__str_find_first_of<value_type, size_type, traits_type, npos>(
|
|
1848
1885
|
data(), size(), __str.data(), __pos, __str.size());
|
|
1849
1886
|
}
|
|
1850
1887
|
|
|
1851
|
-
template <class _Tp, __enable_if_t<
|
|
1852
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1888
|
+
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
|
|
1889
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1853
1890
|
find_first_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT {
|
|
1854
1891
|
__self_view __sv = __t;
|
|
1855
1892
|
return std::__str_find_first_of<value_type, size_type, traits_type, npos>(
|
|
1856
1893
|
data(), size(), __sv.data(), __pos, __sv.size());
|
|
1857
1894
|
}
|
|
1858
1895
|
|
|
1859
|
-
_LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1860
|
-
find_first_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT
|
|
1896
|
+
[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1897
|
+
find_first_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT
|
|
1898
|
+
_LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero") {
|
|
1861
1899
|
_LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find_first_of(): received nullptr");
|
|
1862
1900
|
return std::__str_find_first_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
|
|
1863
1901
|
}
|
|
1864
1902
|
|
|
1865
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1903
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1866
1904
|
find_first_of(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = 0) const _NOEXCEPT {
|
|
1867
1905
|
_LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_first_of(): received nullptr");
|
|
1868
1906
|
return std::__str_find_first_of<value_type, size_type, traits_type, npos>(
|
|
1869
1907
|
data(), size(), __s, __pos, traits_type::length(__s));
|
|
1870
1908
|
}
|
|
1871
1909
|
|
|
1872
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1910
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1873
1911
|
find_first_of(value_type __c, size_type __pos = 0) const _NOEXCEPT {
|
|
1874
1912
|
return find(__c, __pos);
|
|
1875
1913
|
}
|
|
1876
1914
|
|
|
1877
1915
|
// find_last_of
|
|
1878
1916
|
|
|
1879
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1917
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1880
1918
|
find_last_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT {
|
|
1881
1919
|
return std::__str_find_last_of<value_type, size_type, traits_type, npos>(
|
|
1882
1920
|
data(), size(), __str.data(), __pos, __str.size());
|
|
1883
1921
|
}
|
|
1884
1922
|
|
|
1885
|
-
template <class _Tp, __enable_if_t<
|
|
1886
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1923
|
+
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
|
|
1924
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1887
1925
|
find_last_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT {
|
|
1888
1926
|
__self_view __sv = __t;
|
|
1889
1927
|
return std::__str_find_last_of<value_type, size_type, traits_type, npos>(
|
|
1890
1928
|
data(), size(), __sv.data(), __pos, __sv.size());
|
|
1891
1929
|
}
|
|
1892
1930
|
|
|
1893
|
-
_LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1894
|
-
find_last_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT
|
|
1931
|
+
[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1932
|
+
find_last_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT
|
|
1933
|
+
_LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero") {
|
|
1895
1934
|
_LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find_last_of(): received nullptr");
|
|
1896
1935
|
return std::__str_find_last_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
|
|
1897
1936
|
}
|
|
1898
1937
|
|
|
1899
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1938
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1900
1939
|
find_last_of(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = npos) const _NOEXCEPT {
|
|
1901
1940
|
_LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_last_of(): received nullptr");
|
|
1902
1941
|
return std::__str_find_last_of<value_type, size_type, traits_type, npos>(
|
|
1903
1942
|
data(), size(), __s, __pos, traits_type::length(__s));
|
|
1904
1943
|
}
|
|
1905
1944
|
|
|
1906
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1945
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1907
1946
|
find_last_of(value_type __c, size_type __pos = npos) const _NOEXCEPT {
|
|
1908
1947
|
return rfind(__c, __pos);
|
|
1909
1948
|
}
|
|
1910
1949
|
|
|
1911
1950
|
// find_first_not_of
|
|
1912
1951
|
|
|
1913
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1952
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1914
1953
|
find_first_not_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT {
|
|
1915
1954
|
return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(
|
|
1916
1955
|
data(), size(), __str.data(), __pos, __str.size());
|
|
1917
1956
|
}
|
|
1918
1957
|
|
|
1919
|
-
template <class _Tp, __enable_if_t<
|
|
1920
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1958
|
+
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
|
|
1959
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1921
1960
|
find_first_not_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT {
|
|
1922
1961
|
__self_view __sv = __t;
|
|
1923
1962
|
return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(
|
|
1924
1963
|
data(), size(), __sv.data(), __pos, __sv.size());
|
|
1925
1964
|
}
|
|
1926
1965
|
|
|
1927
|
-
_LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1928
|
-
find_first_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT
|
|
1966
|
+
[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1967
|
+
find_first_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT
|
|
1968
|
+
_LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero") {
|
|
1929
1969
|
_LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find_first_not_of(): received nullptr");
|
|
1930
1970
|
return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
|
|
1931
1971
|
}
|
|
1932
1972
|
|
|
1933
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1973
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1934
1974
|
find_first_not_of(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = 0) const _NOEXCEPT {
|
|
1935
1975
|
_LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_first_not_of(): received nullptr");
|
|
1936
1976
|
return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(
|
|
1937
1977
|
data(), size(), __s, __pos, traits_type::length(__s));
|
|
1938
1978
|
}
|
|
1939
1979
|
|
|
1940
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1980
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1941
1981
|
find_first_not_of(value_type __c, size_type __pos = 0) const _NOEXCEPT {
|
|
1942
1982
|
return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
|
|
1943
1983
|
}
|
|
1944
1984
|
|
|
1945
1985
|
// find_last_not_of
|
|
1946
1986
|
|
|
1947
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1987
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1948
1988
|
find_last_not_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT {
|
|
1949
1989
|
return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(
|
|
1950
1990
|
data(), size(), __str.data(), __pos, __str.size());
|
|
1951
1991
|
}
|
|
1952
1992
|
|
|
1953
|
-
template <class _Tp, __enable_if_t<
|
|
1954
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1993
|
+
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
|
|
1994
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1955
1995
|
find_last_not_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT {
|
|
1956
1996
|
__self_view __sv = __t;
|
|
1957
1997
|
return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(
|
|
1958
1998
|
data(), size(), __sv.data(), __pos, __sv.size());
|
|
1959
1999
|
}
|
|
1960
2000
|
|
|
1961
|
-
_LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1962
|
-
find_last_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT
|
|
2001
|
+
[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
2002
|
+
find_last_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT
|
|
2003
|
+
_LIBCPP_DIAGNOSE_NULLPTR_IF(__n != 0 && __s == nullptr, " if n is not zero") {
|
|
1963
2004
|
_LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::find_last_not_of(): received nullptr");
|
|
1964
2005
|
return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(data(), size(), __s, __pos, __n);
|
|
1965
2006
|
}
|
|
1966
2007
|
|
|
1967
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
2008
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1968
2009
|
find_last_not_of(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = npos) const _NOEXCEPT {
|
|
1969
2010
|
_LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_last_not_of(): received nullptr");
|
|
1970
2011
|
return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(
|
|
1971
2012
|
data(), size(), __s, __pos, traits_type::length(__s));
|
|
1972
2013
|
}
|
|
1973
2014
|
|
|
1974
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
2015
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
1975
2016
|
find_last_not_of(value_type __c, size_type __pos = npos) const _NOEXCEPT {
|
|
1976
2017
|
return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(data(), size(), __c, __pos);
|
|
1977
2018
|
}
|
|
1978
2019
|
|
|
1979
2020
|
// compare
|
|
1980
2021
|
|
|
1981
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int
|
|
2022
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int
|
|
2023
|
+
compare(const basic_string& __str) const _NOEXCEPT {
|
|
1982
2024
|
return compare(__self_view(__str));
|
|
1983
2025
|
}
|
|
1984
2026
|
|
|
1985
|
-
template <class _Tp, __enable_if_t<
|
|
1986
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int compare(const _Tp& __t) const _NOEXCEPT {
|
|
2027
|
+
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
|
|
2028
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int compare(const _Tp& __t) const _NOEXCEPT {
|
|
1987
2029
|
__self_view __sv = __t;
|
|
1988
2030
|
size_t __lhs_sz = size();
|
|
1989
2031
|
size_t __rhs_sz = __sv.size();
|
|
@@ -1997,73 +2039,77 @@ public:
|
|
|
1997
2039
|
return 0;
|
|
1998
2040
|
}
|
|
1999
2041
|
|
|
2000
|
-
template <class _Tp, __enable_if_t<
|
|
2001
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int
|
|
2042
|
+
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
|
|
2043
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int
|
|
2002
2044
|
compare(size_type __pos1, size_type __n1, const _Tp& __t) const {
|
|
2003
2045
|
__self_view __sv = __t;
|
|
2004
2046
|
return compare(__pos1, __n1, __sv.data(), __sv.size());
|
|
2005
2047
|
}
|
|
2006
2048
|
|
|
2007
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int
|
|
2049
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int
|
|
2008
2050
|
compare(size_type __pos1, size_type __n1, const basic_string& __str) const {
|
|
2009
2051
|
return compare(__pos1, __n1, __str.data(), __str.size());
|
|
2010
2052
|
}
|
|
2011
2053
|
|
|
2012
|
-
_LIBCPP_CONSTEXPR_SINCE_CXX20 int
|
|
2054
|
+
[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 int
|
|
2013
2055
|
compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2 = npos) const {
|
|
2014
2056
|
return compare(__pos1, __n1, __self_view(__str), __pos2, __n2);
|
|
2015
2057
|
}
|
|
2016
2058
|
|
|
2017
2059
|
template <class _Tp,
|
|
2018
|
-
__enable_if_t<
|
|
2060
|
+
__enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp> &&
|
|
2019
2061
|
!is_same<__remove_cvref_t<_Tp>, basic_string>::value,
|
|
2020
2062
|
int> = 0>
|
|
2021
|
-
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int
|
|
2063
|
+
[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int
|
|
2022
2064
|
compare(size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2 = npos) const {
|
|
2023
2065
|
__self_view __sv = __t;
|
|
2024
2066
|
return __self_view(*this).substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2));
|
|
2025
2067
|
}
|
|
2026
2068
|
|
|
2027
|
-
_LIBCPP_CONSTEXPR_SINCE_CXX20 int
|
|
2069
|
+
[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 int
|
|
2070
|
+
compare(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s) const _NOEXCEPT {
|
|
2028
2071
|
_LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::compare(): received nullptr");
|
|
2029
2072
|
return compare(0, npos, __s, traits_type::length(__s));
|
|
2030
2073
|
}
|
|
2031
2074
|
|
|
2032
|
-
_LIBCPP_CONSTEXPR_SINCE_CXX20 int
|
|
2075
|
+
[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 int
|
|
2033
2076
|
compare(size_type __pos1, size_type __n1, const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s) const {
|
|
2034
2077
|
_LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::compare(): received nullptr");
|
|
2035
2078
|
return compare(__pos1, __n1, __s, traits_type::length(__s));
|
|
2036
2079
|
}
|
|
2037
2080
|
|
|
2038
|
-
_LIBCPP_CONSTEXPR_SINCE_CXX20 int
|
|
2039
|
-
compare(size_type __pos1, size_type __n1, const value_type* __s, size_type __n2) const
|
|
2081
|
+
[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 int
|
|
2082
|
+
compare(size_type __pos1, size_type __n1, const value_type* __s, size_type __n2) const
|
|
2083
|
+
_LIBCPP_DIAGNOSE_NULLPTR_IF(__n2 != 0 && __s == nullptr, " if n2 is not zero");
|
|
2040
2084
|
|
|
2041
2085
|
// starts_with
|
|
2042
2086
|
|
|
2043
2087
|
# if _LIBCPP_STD_VER >= 20
|
|
2044
|
-
constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(__self_view __sv) const noexcept {
|
|
2088
|
+
[[__nodiscard__]] constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(__self_view __sv) const noexcept {
|
|
2045
2089
|
return __self_view(typename __self_view::__assume_valid(), data(), size()).starts_with(__sv);
|
|
2046
2090
|
}
|
|
2047
2091
|
|
|
2048
|
-
constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(value_type __c) const noexcept {
|
|
2092
|
+
[[__nodiscard__]] constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(value_type __c) const noexcept {
|
|
2049
2093
|
return !empty() && _Traits::eq(front(), __c);
|
|
2050
2094
|
}
|
|
2051
2095
|
|
|
2052
|
-
constexpr _LIBCPP_HIDE_FROM_ABI bool
|
|
2096
|
+
[[__nodiscard__]] constexpr _LIBCPP_HIDE_FROM_ABI bool
|
|
2097
|
+
starts_with(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s) const noexcept {
|
|
2053
2098
|
return starts_with(__self_view(__s));
|
|
2054
2099
|
}
|
|
2055
2100
|
|
|
2056
2101
|
// ends_with
|
|
2057
2102
|
|
|
2058
|
-
constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(__self_view __sv) const noexcept {
|
|
2103
|
+
[[__nodiscard__]] constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(__self_view __sv) const noexcept {
|
|
2059
2104
|
return __self_view(typename __self_view::__assume_valid(), data(), size()).ends_with(__sv);
|
|
2060
2105
|
}
|
|
2061
2106
|
|
|
2062
|
-
constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(value_type __c) const noexcept {
|
|
2107
|
+
[[__nodiscard__]] constexpr _LIBCPP_HIDE_FROM_ABI bool ends_with(value_type __c) const noexcept {
|
|
2063
2108
|
return !empty() && _Traits::eq(back(), __c);
|
|
2064
2109
|
}
|
|
2065
2110
|
|
|
2066
|
-
constexpr _LIBCPP_HIDE_FROM_ABI bool
|
|
2111
|
+
[[__nodiscard__]] constexpr _LIBCPP_HIDE_FROM_ABI bool
|
|
2112
|
+
ends_with(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s) const noexcept {
|
|
2067
2113
|
return ends_with(__self_view(__s));
|
|
2068
2114
|
}
|
|
2069
2115
|
# endif
|
|
@@ -2071,15 +2117,16 @@ public:
|
|
|
2071
2117
|
// contains
|
|
2072
2118
|
|
|
2073
2119
|
# if _LIBCPP_STD_VER >= 23
|
|
2074
|
-
constexpr _LIBCPP_HIDE_FROM_ABI bool contains(__self_view __sv) const noexcept {
|
|
2120
|
+
[[__nodiscard__]] constexpr _LIBCPP_HIDE_FROM_ABI bool contains(__self_view __sv) const noexcept {
|
|
2075
2121
|
return __self_view(typename __self_view::__assume_valid(), data(), size()).contains(__sv);
|
|
2076
2122
|
}
|
|
2077
2123
|
|
|
2078
|
-
constexpr _LIBCPP_HIDE_FROM_ABI bool contains(value_type __c) const noexcept {
|
|
2124
|
+
[[__nodiscard__]] constexpr _LIBCPP_HIDE_FROM_ABI bool contains(value_type __c) const noexcept {
|
|
2079
2125
|
return __self_view(typename __self_view::__assume_valid(), data(), size()).contains(__c);
|
|
2080
2126
|
}
|
|
2081
2127
|
|
|
2082
|
-
constexpr _LIBCPP_HIDE_FROM_ABI bool
|
|
2128
|
+
[[__nodiscard__]] constexpr _LIBCPP_HIDE_FROM_ABI bool
|
|
2129
|
+
contains(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s) const {
|
|
2083
2130
|
return __self_view(typename __self_view::__assume_valid(), data(), size()).contains(__s);
|
|
2084
2131
|
}
|
|
2085
2132
|
# endif
|
|
@@ -2095,18 +2142,6 @@ private:
|
|
|
2095
2142
|
return __rep_.__s.__is_long_;
|
|
2096
2143
|
}
|
|
2097
2144
|
|
|
2098
|
-
static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __begin_lifetime(pointer __begin, size_type __n) {
|
|
2099
|
-
# if _LIBCPP_STD_VER >= 20
|
|
2100
|
-
if (__libcpp_is_constant_evaluated()) {
|
|
2101
|
-
for (size_type __i = 0; __i != __n; ++__i)
|
|
2102
|
-
std::construct_at(std::addressof(__begin[__i]));
|
|
2103
|
-
}
|
|
2104
|
-
# else
|
|
2105
|
-
(void)__begin;
|
|
2106
|
-
(void)__n;
|
|
2107
|
-
# endif // _LIBCPP_STD_VER >= 20
|
|
2108
|
-
}
|
|
2109
|
-
|
|
2110
2145
|
_LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI static bool __fits_in_sso(size_type __sz) { return __sz < __min_cap; }
|
|
2111
2146
|
|
|
2112
2147
|
template <class _Iterator, class _Sentinel>
|
|
@@ -2165,6 +2200,9 @@ private:
|
|
|
2165
2200
|
_LIBCPP_CONSTEXPR_SINCE_CXX20 iterator
|
|
2166
2201
|
__insert_with_size(const_iterator __pos, _Iterator __first, _Sentinel __last, size_type __n);
|
|
2167
2202
|
|
|
2203
|
+
// internal buffer accessors
|
|
2204
|
+
// -------------------------
|
|
2205
|
+
|
|
2168
2206
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS void
|
|
2169
2207
|
__set_short_size(size_type __s) _NOEXCEPT {
|
|
2170
2208
|
_LIBCPP_ASSERT_INTERNAL(__s < __min_cap, "__s should never be greater than or equal to the short string capacity");
|
|
@@ -2194,21 +2232,11 @@ private:
|
|
|
2194
2232
|
__set_short_size(__s);
|
|
2195
2233
|
}
|
|
2196
2234
|
|
|
2197
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __set_long_cap(size_type __s) _NOEXCEPT {
|
|
2198
|
-
_LIBCPP_ASSERT_INTERNAL(!__fits_in_sso(__s), "Long capacity should always be larger than the SSO");
|
|
2199
|
-
__rep_.__l.__cap_ = __s / __endian_factor;
|
|
2200
|
-
__rep_.__l.__is_long_ = true;
|
|
2201
|
-
}
|
|
2202
|
-
|
|
2203
2235
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __get_long_cap() const _NOEXCEPT {
|
|
2204
2236
|
_LIBCPP_ASSERT_INTERNAL(__rep_.__l.__is_long_, "String has to be long when trying to get the long capacity");
|
|
2205
2237
|
return __rep_.__l.__cap_ * __endian_factor;
|
|
2206
2238
|
}
|
|
2207
2239
|
|
|
2208
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __set_long_pointer(pointer __p) _NOEXCEPT {
|
|
2209
|
-
__rep_.__l.__data_ = __p;
|
|
2210
|
-
}
|
|
2211
|
-
|
|
2212
2240
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __get_long_pointer() _NOEXCEPT {
|
|
2213
2241
|
_LIBCPP_ASSERT_INTERNAL(__rep_.__l.__is_long_, "String has to be long when trying to get the long pointer");
|
|
2214
2242
|
return _LIBCPP_ASAN_VOLATILE_WRAPPER(__rep_.__l.__data_);
|
|
@@ -2236,6 +2264,58 @@ private:
|
|
|
2236
2264
|
return __is_long() ? __get_long_pointer() : __get_short_pointer();
|
|
2237
2265
|
}
|
|
2238
2266
|
|
|
2267
|
+
// Internal buffer management
|
|
2268
|
+
// --------------------------
|
|
2269
|
+
//
|
|
2270
|
+
// These functions are only responsible for managing the buffer itself, not the value inside the buffer. As such,
|
|
2271
|
+
// none of these facilities ensure that there is a null terminator at `data()[size()]`.
|
|
2272
|
+
|
|
2273
|
+
// Allocate a buffer of __capacity size with __alloc and return it
|
|
2274
|
+
_LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX20 __long
|
|
2275
|
+
__allocate_long_buffer(_Allocator& __alloc, size_type __capacity) {
|
|
2276
|
+
_LIBCPP_ASSERT_INTERNAL(!__fits_in_sso(__capacity),
|
|
2277
|
+
"Trying to allocate long buffer for a capacity what would fit into the small buffer");
|
|
2278
|
+
auto __buffer = std::__allocate_at_least(__alloc, __align_allocation_size(__capacity));
|
|
2279
|
+
|
|
2280
|
+
if (__libcpp_is_constant_evaluated()) {
|
|
2281
|
+
for (size_type __i = 0; __i != __buffer.count; ++__i)
|
|
2282
|
+
std::__construct_at(std::addressof(__buffer.ptr[__i]));
|
|
2283
|
+
}
|
|
2284
|
+
|
|
2285
|
+
return __long(__buffer, __capacity);
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
// Replace the current buffer with __new_rep. Deallocate the old long buffer if it exists.
|
|
2289
|
+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __reset_internal_buffer(__rep __new_rep = __short()) {
|
|
2290
|
+
__annotate_delete();
|
|
2291
|
+
if (__is_long())
|
|
2292
|
+
__alloc_traits::deallocate(__alloc_, __get_long_pointer(), __get_long_cap());
|
|
2293
|
+
__rep_ = __new_rep;
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2296
|
+
// Initialize the internal buffer to hold __size elements
|
|
2297
|
+
// The elements and null terminator have to be set by the caller
|
|
2298
|
+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __init_internal_buffer(size_type __size) {
|
|
2299
|
+
if (__libcpp_is_constant_evaluated())
|
|
2300
|
+
__rep_ = __rep();
|
|
2301
|
+
|
|
2302
|
+
if (__size > max_size())
|
|
2303
|
+
__throw_length_error();
|
|
2304
|
+
|
|
2305
|
+
if (__fits_in_sso(__size)) {
|
|
2306
|
+
__set_short_size(__size);
|
|
2307
|
+
__annotate_new(__size);
|
|
2308
|
+
return __get_short_pointer();
|
|
2309
|
+
} else {
|
|
2310
|
+
__rep_.__l = __allocate_long_buffer(__alloc_, __size);
|
|
2311
|
+
__annotate_new(__size);
|
|
2312
|
+
return __get_long_pointer();
|
|
2313
|
+
}
|
|
2314
|
+
}
|
|
2315
|
+
|
|
2316
|
+
// ASan annotation helpers
|
|
2317
|
+
// -----------------------
|
|
2318
|
+
|
|
2239
2319
|
// The following functions are no-ops outside of AddressSanitizer mode.
|
|
2240
2320
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
|
|
2241
2321
|
__annotate_contiguous_container(const void* __old_mid, const void* __new_mid) const {
|
|
@@ -2243,7 +2323,7 @@ private:
|
|
|
2243
2323
|
(void)__new_mid;
|
|
2244
2324
|
# if _LIBCPP_INSTRUMENTED_WITH_ASAN
|
|
2245
2325
|
# if defined(__APPLE__)
|
|
2246
|
-
// TODO: remove after addressing issue #96099 (https://
|
|
2326
|
+
// TODO: remove after addressing issue #96099 (https://llvm.org/PR96099)
|
|
2247
2327
|
if (!__is_long())
|
|
2248
2328
|
return;
|
|
2249
2329
|
# endif
|
|
@@ -2287,19 +2367,36 @@ private:
|
|
|
2287
2367
|
return (__s + (__a - 1)) & ~(__a - 1);
|
|
2288
2368
|
}
|
|
2289
2369
|
enum { __alignment = 8 };
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2370
|
+
|
|
2371
|
+
// This makes sure that we're using a capacity with some extra alignment, since allocators almost always over-align
|
|
2372
|
+
// the allocations anyways, improving memory usage. More importantly, this ensures that the lowest bit is never set
|
|
2373
|
+
// if __endian_factor == 2, allowing us to store whether we're in the long string inside the lowest bit.
|
|
2374
|
+
_LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
2375
|
+
__align_allocation_size(size_type __size) _NOEXCEPT {
|
|
2376
|
+
_LIBCPP_ASSERT_INTERNAL(
|
|
2377
|
+
!__fits_in_sso(__size), "Trying to align allocation of a size which would fit into the SSO");
|
|
2294
2378
|
const size_type __boundary = sizeof(value_type) < __alignment ? __alignment / sizeof(value_type) : __endian_factor;
|
|
2295
|
-
size_type __guess = __align_it<__boundary>(
|
|
2296
|
-
if (__guess == __min_cap)
|
|
2379
|
+
size_type __guess = __align_it<__boundary>(__size + 1);
|
|
2380
|
+
if (__guess == __min_cap + 1)
|
|
2297
2381
|
__guess += __endian_factor;
|
|
2298
2382
|
|
|
2299
|
-
_LIBCPP_ASSERT_INTERNAL(__guess >=
|
|
2383
|
+
_LIBCPP_ASSERT_INTERNAL(__guess >= __size, "aligned allocation size is below the requested size");
|
|
2300
2384
|
return __guess;
|
|
2301
2385
|
}
|
|
2302
2386
|
|
|
2387
|
+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
|
|
2388
|
+
__get_amortized_growth_capacity(size_type __required_capacity) {
|
|
2389
|
+
size_type __max_size = max_size();
|
|
2390
|
+
if (__required_capacity > __max_size)
|
|
2391
|
+
__throw_length_error();
|
|
2392
|
+
size_type __current_cap = capacity();
|
|
2393
|
+
_LIBCPP_ASSERT_INTERNAL(
|
|
2394
|
+
__current_cap < __required_capacity, "Trying to grow string even though there is enough capacity already?");
|
|
2395
|
+
if (__current_cap > __max_size / 2 - __alignment)
|
|
2396
|
+
return __max_size;
|
|
2397
|
+
return std::max(__required_capacity, 2 * __current_cap);
|
|
2398
|
+
}
|
|
2399
|
+
|
|
2303
2400
|
inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void __init(const value_type* __s, size_type __sz);
|
|
2304
2401
|
inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void __init(size_type __n, value_type __c);
|
|
2305
2402
|
|
|
@@ -2366,7 +2463,8 @@ private:
|
|
|
2366
2463
|
|
|
2367
2464
|
// __erase_external_with_move is invoked for erase() invocations where
|
|
2368
2465
|
// `n ~= npos`, likely requiring memory moves on the string data.
|
|
2369
|
-
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE void
|
|
2466
|
+
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE void
|
|
2467
|
+
__erase_external_with_move(size_type __pos, size_type __n) _NOEXCEPT;
|
|
2370
2468
|
|
|
2371
2469
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __copy_assign_alloc(const basic_string& __str) {
|
|
2372
2470
|
__copy_assign_alloc(
|
|
@@ -2378,24 +2476,14 @@ private:
|
|
|
2378
2476
|
__alloc_ = __str.__alloc_;
|
|
2379
2477
|
else {
|
|
2380
2478
|
if (!__str.__is_long()) {
|
|
2381
|
-
|
|
2382
|
-
__annotate_delete();
|
|
2383
|
-
__alloc_traits::deallocate(__alloc_, __get_long_pointer(), __get_long_cap());
|
|
2384
|
-
__rep_ = __rep();
|
|
2385
|
-
}
|
|
2479
|
+
__reset_internal_buffer();
|
|
2386
2480
|
__alloc_ = __str.__alloc_;
|
|
2387
2481
|
} else {
|
|
2388
2482
|
__annotate_delete();
|
|
2389
|
-
auto __guard
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
if (__is_long())
|
|
2394
|
-
__alloc_traits::deallocate(__alloc_, __get_long_pointer(), __get_long_cap());
|
|
2395
|
-
__alloc_ = std::move(__a);
|
|
2396
|
-
__set_long_pointer(__allocation.ptr);
|
|
2397
|
-
__set_long_cap(__allocation.count);
|
|
2398
|
-
__set_long_size(__str.__get_long_size());
|
|
2483
|
+
auto __guard = std::__make_scope_guard(__annotate_new_size(*this));
|
|
2484
|
+
auto __alloc = __str.__alloc_;
|
|
2485
|
+
__reset_internal_buffer(__allocate_long_buffer(__alloc, __str.size()));
|
|
2486
|
+
__alloc_ = std::move(__alloc);
|
|
2399
2487
|
}
|
|
2400
2488
|
}
|
|
2401
2489
|
}
|
|
@@ -2507,26 +2595,55 @@ _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_DECLARE, wchar_t)
|
|
|
2507
2595
|
# endif
|
|
2508
2596
|
# undef _LIBCPP_DECLARE
|
|
2509
2597
|
|
|
2598
|
+
# if _LIBCPP_STD_VER <= 17 || !__has_builtin(__builtin_lt_synthesizes_from_spaceship)
|
|
2599
|
+
template <class _CharT, class _Traits, class _Alloc>
|
|
2600
|
+
struct __default_three_way_comparator<basic_string<_CharT, _Traits, _Alloc>, basic_string<_CharT, _Traits, _Alloc> > {
|
|
2601
|
+
using __string_t _LIBCPP_NODEBUG = basic_string<_CharT, _Traits, _Alloc>;
|
|
2602
|
+
|
|
2603
|
+
_LIBCPP_HIDE_FROM_ABI static int operator()(const __string_t& __lhs, const __string_t& __rhs) {
|
|
2604
|
+
auto __min_len = std::min(__lhs.size(), __rhs.size());
|
|
2605
|
+
auto __ret = _Traits::compare(__lhs.data(), __rhs.data(), __min_len);
|
|
2606
|
+
if (__ret == 0)
|
|
2607
|
+
return __lhs.size() == __rhs.size() ? 0 : __lhs.size() < __rhs.size() ? -1 : 1;
|
|
2608
|
+
return __ret;
|
|
2609
|
+
}
|
|
2610
|
+
};
|
|
2611
|
+
# endif
|
|
2612
|
+
|
|
2613
|
+
template <class _Comparator, class _CharT, class _Traits, class _Alloc>
|
|
2614
|
+
inline const bool __is_transparently_comparable_v<_Comparator,
|
|
2615
|
+
basic_string<_CharT, _Traits, _Alloc>,
|
|
2616
|
+
const _CharT*,
|
|
2617
|
+
__enable_if_t<__is_generic_transparent_comparator_v<_Comparator> > > =
|
|
2618
|
+
true;
|
|
2619
|
+
|
|
2620
|
+
template <class _Comparator, class _CharT, class _Traits, class _Alloc, size_t _Np>
|
|
2621
|
+
inline const bool __is_transparently_comparable_v<_Comparator,
|
|
2622
|
+
basic_string<_CharT, _Traits, _Alloc>,
|
|
2623
|
+
_CharT[_Np],
|
|
2624
|
+
__enable_if_t<__is_generic_transparent_comparator_v<_Comparator> > > =
|
|
2625
|
+
true;
|
|
2626
|
+
|
|
2510
2627
|
# if _LIBCPP_STD_VER >= 17
|
|
2511
2628
|
template <class _InputIterator,
|
|
2512
|
-
class _CharT =
|
|
2629
|
+
class _CharT = __iterator_value_type<_InputIterator>,
|
|
2513
2630
|
class _Allocator = allocator<_CharT>,
|
|
2514
2631
|
class = enable_if_t<__has_input_iterator_category<_InputIterator>::value>,
|
|
2515
|
-
class = enable_if_t<
|
|
2632
|
+
class = enable_if_t<__is_allocator_v<_Allocator>>>
|
|
2516
2633
|
basic_string(_InputIterator, _InputIterator, _Allocator = _Allocator())
|
|
2517
2634
|
-> basic_string<_CharT, char_traits<_CharT>, _Allocator>;
|
|
2518
2635
|
|
|
2519
2636
|
template <class _CharT,
|
|
2520
2637
|
class _Traits,
|
|
2521
2638
|
class _Allocator = allocator<_CharT>,
|
|
2522
|
-
class = enable_if_t<
|
|
2639
|
+
class = enable_if_t<__is_allocator_v<_Allocator>>>
|
|
2523
2640
|
explicit basic_string(basic_string_view<_CharT, _Traits>, const _Allocator& = _Allocator())
|
|
2524
2641
|
-> basic_string<_CharT, _Traits, _Allocator>;
|
|
2525
2642
|
|
|
2526
2643
|
template <class _CharT,
|
|
2527
2644
|
class _Traits,
|
|
2528
2645
|
class _Allocator = allocator<_CharT>,
|
|
2529
|
-
class = enable_if_t<
|
|
2646
|
+
class = enable_if_t<__is_allocator_v<_Allocator>>,
|
|
2530
2647
|
class _Sz = typename allocator_traits<_Allocator>::size_type >
|
|
2531
2648
|
basic_string(basic_string_view<_CharT, _Traits>, _Sz, _Sz, const _Allocator& = _Allocator())
|
|
2532
2649
|
-> basic_string<_CharT, _Traits, _Allocator>;
|
|
@@ -2535,7 +2652,7 @@ basic_string(basic_string_view<_CharT, _Traits>, _Sz, _Sz, const _Allocator& = _
|
|
|
2535
2652
|
# if _LIBCPP_STD_VER >= 23
|
|
2536
2653
|
template <ranges::input_range _Range,
|
|
2537
2654
|
class _Allocator = allocator<ranges::range_value_t<_Range>>,
|
|
2538
|
-
class = enable_if_t<
|
|
2655
|
+
class = enable_if_t<__is_allocator_v<_Allocator>>>
|
|
2539
2656
|
basic_string(from_range_t, _Range&&, _Allocator = _Allocator())
|
|
2540
2657
|
-> basic_string<ranges::range_value_t<_Range>, char_traits<ranges::range_value_t<_Range>>, _Allocator>;
|
|
2541
2658
|
# endif
|
|
@@ -2543,73 +2660,23 @@ basic_string(from_range_t, _Range&&, _Allocator = _Allocator())
|
|
|
2543
2660
|
template <class _CharT, class _Traits, class _Allocator>
|
|
2544
2661
|
_LIBCPP_CONSTEXPR_SINCE_CXX20 void
|
|
2545
2662
|
basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz) {
|
|
2546
|
-
|
|
2547
|
-
__rep_ = __rep();
|
|
2548
|
-
if (__sz > max_size())
|
|
2549
|
-
this->__throw_length_error();
|
|
2550
|
-
pointer __p;
|
|
2551
|
-
if (__fits_in_sso(__sz)) {
|
|
2552
|
-
__set_short_size(__sz);
|
|
2553
|
-
__p = __get_short_pointer();
|
|
2554
|
-
} else {
|
|
2555
|
-
auto __allocation = std::__allocate_at_least(__alloc_, __recommend(__sz) + 1);
|
|
2556
|
-
__p = __allocation.ptr;
|
|
2557
|
-
__begin_lifetime(__p, __allocation.count);
|
|
2558
|
-
__set_long_pointer(__p);
|
|
2559
|
-
__set_long_cap(__allocation.count);
|
|
2560
|
-
__set_long_size(__sz);
|
|
2561
|
-
}
|
|
2663
|
+
pointer __p = __init_internal_buffer(__sz);
|
|
2562
2664
|
traits_type::copy(std::__to_address(__p), __s, __sz);
|
|
2563
2665
|
traits_type::assign(__p[__sz], value_type());
|
|
2564
|
-
__annotate_new(__sz);
|
|
2565
2666
|
}
|
|
2566
2667
|
|
|
2567
2668
|
template <class _CharT, class _Traits, class _Allocator>
|
|
2568
2669
|
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE void
|
|
2569
2670
|
basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external(const value_type* __s, size_type __sz) {
|
|
2570
|
-
|
|
2571
|
-
__rep_ = __rep();
|
|
2572
|
-
|
|
2573
|
-
pointer __p;
|
|
2574
|
-
if (__fits_in_sso(__sz)) {
|
|
2575
|
-
__p = __get_short_pointer();
|
|
2576
|
-
__set_short_size(__sz);
|
|
2577
|
-
} else {
|
|
2578
|
-
if (__sz > max_size())
|
|
2579
|
-
this->__throw_length_error();
|
|
2580
|
-
auto __allocation = std::__allocate_at_least(__alloc_, __recommend(__sz) + 1);
|
|
2581
|
-
__p = __allocation.ptr;
|
|
2582
|
-
__begin_lifetime(__p, __allocation.count);
|
|
2583
|
-
__set_long_pointer(__p);
|
|
2584
|
-
__set_long_cap(__allocation.count);
|
|
2585
|
-
__set_long_size(__sz);
|
|
2586
|
-
}
|
|
2671
|
+
pointer __p = __init_internal_buffer(__sz);
|
|
2587
2672
|
traits_type::copy(std::__to_address(__p), __s, __sz + 1);
|
|
2588
|
-
__annotate_new(__sz);
|
|
2589
2673
|
}
|
|
2590
2674
|
|
|
2591
2675
|
template <class _CharT, class _Traits, class _Allocator>
|
|
2592
2676
|
_LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c) {
|
|
2593
|
-
|
|
2594
|
-
__rep_ = __rep();
|
|
2595
|
-
|
|
2596
|
-
if (__n > max_size())
|
|
2597
|
-
this->__throw_length_error();
|
|
2598
|
-
pointer __p;
|
|
2599
|
-
if (__fits_in_sso(__n)) {
|
|
2600
|
-
__set_short_size(__n);
|
|
2601
|
-
__p = __get_short_pointer();
|
|
2602
|
-
} else {
|
|
2603
|
-
auto __allocation = std::__allocate_at_least(__alloc_, __recommend(__n) + 1);
|
|
2604
|
-
__p = __allocation.ptr;
|
|
2605
|
-
__begin_lifetime(__p, __allocation.count);
|
|
2606
|
-
__set_long_pointer(__p);
|
|
2607
|
-
__set_long_cap(__allocation.count);
|
|
2608
|
-
__set_long_size(__n);
|
|
2609
|
-
}
|
|
2677
|
+
pointer __p = __init_internal_buffer(__n);
|
|
2610
2678
|
traits_type::assign(std::__to_address(__p), __n, __c);
|
|
2611
2679
|
traits_type::assign(__p[__n], value_type());
|
|
2612
|
-
__annotate_new(__n);
|
|
2613
2680
|
}
|
|
2614
2681
|
|
|
2615
2682
|
template <class _CharT, class _Traits, class _Allocator>
|
|
@@ -2626,19 +2693,10 @@ basic_string<_CharT, _Traits, _Allocator>::__init_with_sentinel(_InputIterator _
|
|
|
2626
2693
|
__rep_ = __rep();
|
|
2627
2694
|
__annotate_new(0);
|
|
2628
2695
|
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
push_back(*__first);
|
|
2634
|
-
# if _LIBCPP_HAS_EXCEPTIONS
|
|
2635
|
-
} catch (...) {
|
|
2636
|
-
__annotate_delete();
|
|
2637
|
-
if (__is_long())
|
|
2638
|
-
__alloc_traits::deallocate(__alloc_, __get_long_pointer(), __get_long_cap());
|
|
2639
|
-
throw;
|
|
2640
|
-
}
|
|
2641
|
-
# endif // _LIBCPP_HAS_EXCEPTIONS
|
|
2696
|
+
auto __guard = std::__make_exception_guard([this] { __reset_internal_buffer(); });
|
|
2697
|
+
for (; __first != __last; ++__first)
|
|
2698
|
+
push_back(*__first);
|
|
2699
|
+
__guard.__complete();
|
|
2642
2700
|
}
|
|
2643
2701
|
|
|
2644
2702
|
template <class _CharT, class _Traits, class _Allocator>
|
|
@@ -2653,39 +2711,12 @@ template <class _CharT, class _Traits, class _Allocator>
|
|
|
2653
2711
|
template <class _InputIterator, class _Sentinel>
|
|
2654
2712
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
|
|
2655
2713
|
basic_string<_CharT, _Traits, _Allocator>::__init_with_size(_InputIterator __first, _Sentinel __last, size_type __sz) {
|
|
2656
|
-
|
|
2657
|
-
__rep_ = __rep();
|
|
2714
|
+
pointer __p = __init_internal_buffer(__sz);
|
|
2658
2715
|
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
if (__fits_in_sso(__sz)) {
|
|
2664
|
-
__set_short_size(__sz);
|
|
2665
|
-
__p = __get_short_pointer();
|
|
2666
|
-
|
|
2667
|
-
} else {
|
|
2668
|
-
auto __allocation = std::__allocate_at_least(__alloc_, __recommend(__sz) + 1);
|
|
2669
|
-
__p = __allocation.ptr;
|
|
2670
|
-
__begin_lifetime(__p, __allocation.count);
|
|
2671
|
-
__set_long_pointer(__p);
|
|
2672
|
-
__set_long_cap(__allocation.count);
|
|
2673
|
-
__set_long_size(__sz);
|
|
2674
|
-
}
|
|
2675
|
-
|
|
2676
|
-
# if _LIBCPP_HAS_EXCEPTIONS
|
|
2677
|
-
try {
|
|
2678
|
-
# endif // _LIBCPP_HAS_EXCEPTIONS
|
|
2679
|
-
auto __end = __copy_non_overlapping_range(std::move(__first), std::move(__last), std::__to_address(__p));
|
|
2680
|
-
traits_type::assign(*__end, value_type());
|
|
2681
|
-
# if _LIBCPP_HAS_EXCEPTIONS
|
|
2682
|
-
} catch (...) {
|
|
2683
|
-
if (__is_long())
|
|
2684
|
-
__alloc_traits::deallocate(__alloc_, __get_long_pointer(), __get_long_cap());
|
|
2685
|
-
throw;
|
|
2686
|
-
}
|
|
2687
|
-
# endif // _LIBCPP_HAS_EXCEPTIONS
|
|
2688
|
-
__annotate_new(__sz);
|
|
2716
|
+
auto __guard = std::__make_exception_guard([this] { __reset_internal_buffer(); });
|
|
2717
|
+
auto __end = __copy_non_overlapping_range(std::move(__first), std::move(__last), std::__to_address(__p));
|
|
2718
|
+
traits_type::assign(*__end, value_type());
|
|
2719
|
+
__guard.__complete();
|
|
2689
2720
|
}
|
|
2690
2721
|
|
|
2691
2722
|
template <class _CharT, class _Traits, class _Allocator>
|
|
@@ -2697,32 +2728,22 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__
|
|
|
2697
2728
|
size_type __n_del,
|
|
2698
2729
|
size_type __n_add,
|
|
2699
2730
|
const value_type* __p_new_stuff) {
|
|
2700
|
-
|
|
2701
|
-
if (__delta_cap > __ms - __old_cap)
|
|
2702
|
-
__throw_length_error();
|
|
2731
|
+
__long __buffer = __allocate_long_buffer(__alloc_, __get_amortized_growth_capacity(__old_cap + __delta_cap));
|
|
2703
2732
|
pointer __old_p = __get_pointer();
|
|
2704
|
-
size_type __cap =
|
|
2705
|
-
__old_cap < __ms / 2 - __alignment ? __recommend(std::max(__old_cap + __delta_cap, 2 * __old_cap)) : __ms;
|
|
2706
2733
|
__annotate_delete();
|
|
2707
|
-
auto __guard
|
|
2708
|
-
auto __allocation = std::__allocate_at_least(__alloc_, __cap + 1);
|
|
2709
|
-
pointer __p = __allocation.ptr;
|
|
2710
|
-
__begin_lifetime(__p, __allocation.count);
|
|
2734
|
+
auto __guard = std::__make_scope_guard(__annotate_new_size(*this));
|
|
2711
2735
|
if (__n_copy != 0)
|
|
2712
|
-
traits_type::copy(std::__to_address(
|
|
2736
|
+
traits_type::copy(std::__to_address(__buffer.__data_), std::__to_address(__old_p), __n_copy);
|
|
2713
2737
|
if (__n_add != 0)
|
|
2714
|
-
traits_type::copy(std::__to_address(
|
|
2738
|
+
traits_type::copy(std::__to_address(__buffer.__data_) + __n_copy, __p_new_stuff, __n_add);
|
|
2715
2739
|
size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
|
|
2716
2740
|
if (__sec_cp_sz != 0)
|
|
2717
|
-
traits_type::copy(
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
__old_sz = __n_copy + __n_add + __sec_cp_sz;
|
|
2724
|
-
__set_long_size(__old_sz);
|
|
2725
|
-
traits_type::assign(__p[__old_sz], value_type());
|
|
2741
|
+
traits_type::copy(std::__to_address(__buffer.__data_) + __n_copy + __n_add,
|
|
2742
|
+
std::__to_address(__old_p) + __n_copy + __n_del,
|
|
2743
|
+
__sec_cp_sz);
|
|
2744
|
+
__buffer.__size_ = __n_copy + __n_add + __sec_cp_sz;
|
|
2745
|
+
traits_type::assign(__buffer.__data_[__buffer.__size_], value_type());
|
|
2746
|
+
__reset_internal_buffer(__buffer);
|
|
2726
2747
|
}
|
|
2727
2748
|
|
|
2728
2749
|
// __grow_by is deprecated because it does not set the size. It may not update the size when the size is changed, and it
|
|
@@ -2740,25 +2761,20 @@ _LIBCPP_DEPRECATED_("use __grow_by_without_replace") basic_string<_CharT, _Trait
|
|
|
2740
2761
|
size_type __n_copy,
|
|
2741
2762
|
size_type __n_del,
|
|
2742
2763
|
size_type __n_add) {
|
|
2743
|
-
|
|
2744
|
-
if (__delta_cap > __ms - __old_cap)
|
|
2745
|
-
this->__throw_length_error();
|
|
2764
|
+
__long __buffer = __allocate_long_buffer(__alloc_, __get_amortized_growth_capacity(__old_cap + __delta_cap));
|
|
2746
2765
|
pointer __old_p = __get_pointer();
|
|
2747
|
-
size_type __cap =
|
|
2748
|
-
__old_cap < __ms / 2 - __alignment ? __recommend(std::max(__old_cap + __delta_cap, 2 * __old_cap)) : __ms;
|
|
2749
|
-
auto __allocation = std::__allocate_at_least(__alloc_, __cap + 1);
|
|
2750
|
-
pointer __p = __allocation.ptr;
|
|
2751
|
-
__begin_lifetime(__p, __allocation.count);
|
|
2752
2766
|
if (__n_copy != 0)
|
|
2753
|
-
traits_type::copy(std::__to_address(
|
|
2767
|
+
traits_type::copy(std::__to_address(__buffer.__data_), std::__to_address(__old_p), __n_copy);
|
|
2754
2768
|
size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
|
|
2755
2769
|
if (__sec_cp_sz != 0)
|
|
2756
|
-
traits_type::copy(
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2770
|
+
traits_type::copy(std::__to_address(__buffer.__data_) + __n_copy + __n_add,
|
|
2771
|
+
std::__to_address(__old_p) + __n_copy + __n_del,
|
|
2772
|
+
__sec_cp_sz);
|
|
2773
|
+
|
|
2774
|
+
// This is -1 to make sure the caller sets the size properly, since old versions of this function didn't set the size
|
|
2775
|
+
// at all.
|
|
2776
|
+
__buffer.__size_ = -1;
|
|
2777
|
+
__reset_internal_buffer(__buffer);
|
|
2762
2778
|
}
|
|
2763
2779
|
|
|
2764
2780
|
template <class _CharT, class _Traits, class _Allocator>
|
|
@@ -2775,6 +2791,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by_without_replace(
|
|
|
2775
2791
|
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
|
2776
2792
|
__grow_by(__old_cap, __delta_cap, __old_sz, __n_copy, __n_del, __n_add);
|
|
2777
2793
|
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
|
2794
|
+
// Due to the ABI of __grow_by we have to set the size after calling it.
|
|
2778
2795
|
__set_long_size(__old_sz - __n_del + __n_add);
|
|
2779
2796
|
}
|
|
2780
2797
|
|
|
@@ -2786,24 +2803,23 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE basic_string<_CharT, _Traits, _Al
|
|
|
2786
2803
|
basic_string<_CharT, _Traits, _Allocator>::__assign_no_alias(const value_type* __s, size_type __n) {
|
|
2787
2804
|
const auto __cap = __is_short ? static_cast<size_type>(__min_cap) : __get_long_cap();
|
|
2788
2805
|
const auto __size = __is_short ? __get_short_size() : __get_long_size();
|
|
2789
|
-
if (__n
|
|
2790
|
-
if (__n > __size)
|
|
2791
|
-
__annotate_increase(__n - __size);
|
|
2792
|
-
pointer __p;
|
|
2793
|
-
if (__is_short) {
|
|
2794
|
-
__p = __get_short_pointer();
|
|
2795
|
-
__set_short_size(__n);
|
|
2796
|
-
} else {
|
|
2797
|
-
__p = __get_long_pointer();
|
|
2798
|
-
__set_long_size(__n);
|
|
2799
|
-
}
|
|
2800
|
-
traits_type::copy(std::__to_address(__p), __s, __n);
|
|
2801
|
-
traits_type::assign(__p[__n], value_type());
|
|
2802
|
-
if (__size > __n)
|
|
2803
|
-
__annotate_shrink(__size);
|
|
2804
|
-
} else {
|
|
2806
|
+
if (__n >= __cap) {
|
|
2805
2807
|
__grow_by_and_replace(__cap - 1, __n - __cap + 1, __size, 0, __size, __n, __s);
|
|
2808
|
+
return *this;
|
|
2806
2809
|
}
|
|
2810
|
+
|
|
2811
|
+
__annotate_delete();
|
|
2812
|
+
auto __guard = std::__make_scope_guard(__annotate_new_size(*this));
|
|
2813
|
+
pointer __p;
|
|
2814
|
+
if (__is_short) {
|
|
2815
|
+
__p = __get_short_pointer();
|
|
2816
|
+
__set_short_size(__n);
|
|
2817
|
+
} else {
|
|
2818
|
+
__p = __get_long_pointer();
|
|
2819
|
+
__set_long_size(__n);
|
|
2820
|
+
}
|
|
2821
|
+
traits_type::copy(std::__to_address(__p), __s, __n);
|
|
2822
|
+
traits_type::assign(__p[__n], value_type());
|
|
2807
2823
|
return *this;
|
|
2808
2824
|
}
|
|
2809
2825
|
|
|
@@ -2910,7 +2926,7 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, tr
|
|
|
2910
2926
|
{
|
|
2911
2927
|
__annotate_delete();
|
|
2912
2928
|
if (__is_long()) {
|
|
2913
|
-
|
|
2929
|
+
__reset_internal_buffer();
|
|
2914
2930
|
# if _LIBCPP_STD_VER <= 14
|
|
2915
2931
|
if (!is_nothrow_move_assignable<allocator_type>::value) {
|
|
2916
2932
|
__set_short_size(0);
|
|
@@ -2961,7 +2977,7 @@ template <class _Iterator, class _Sentinel>
|
|
|
2961
2977
|
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
|
|
2962
2978
|
basic_string<_CharT, _Traits, _Allocator>::__assign_trivial(_Iterator __first, _Sentinel __last, size_type __n) {
|
|
2963
2979
|
_LIBCPP_ASSERT_INTERNAL(
|
|
2964
|
-
|
|
2980
|
+
__string_is_trivial_iterator_v<_Iterator>, "The iterator type given to `__assign_trivial` must be trivial");
|
|
2965
2981
|
|
|
2966
2982
|
size_type __old_size = size();
|
|
2967
2983
|
size_type __cap = capacity();
|
|
@@ -3017,52 +3033,40 @@ basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_ty
|
|
|
3017
3033
|
_LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::append received nullptr");
|
|
3018
3034
|
size_type __cap = capacity();
|
|
3019
3035
|
size_type __sz = size();
|
|
3020
|
-
if (__cap - __sz
|
|
3021
|
-
if (__n) {
|
|
3022
|
-
__annotate_increase(__n);
|
|
3023
|
-
value_type* __p = std::__to_address(__get_pointer());
|
|
3024
|
-
traits_type::copy(__p + __sz, __s, __n);
|
|
3025
|
-
__sz += __n;
|
|
3026
|
-
__set_size(__sz);
|
|
3027
|
-
traits_type::assign(__p[__sz], value_type());
|
|
3028
|
-
}
|
|
3029
|
-
} else
|
|
3036
|
+
if (__cap - __sz < __n) {
|
|
3030
3037
|
__grow_by_and_replace(__cap, __sz + __n - __cap, __sz, __sz, 0, __n, __s);
|
|
3038
|
+
return *this;
|
|
3039
|
+
}
|
|
3040
|
+
|
|
3041
|
+
if (__n == 0)
|
|
3042
|
+
return *this;
|
|
3043
|
+
|
|
3044
|
+
__annotate_increase(__n);
|
|
3045
|
+
value_type* __p = std::__to_address(__get_pointer());
|
|
3046
|
+
traits_type::copy(__p + __sz, __s, __n);
|
|
3047
|
+
__sz += __n;
|
|
3048
|
+
__set_size(__sz);
|
|
3049
|
+
traits_type::assign(__p[__sz], value_type());
|
|
3031
3050
|
return *this;
|
|
3032
3051
|
}
|
|
3033
3052
|
|
|
3034
3053
|
template <class _CharT, class _Traits, class _Allocator>
|
|
3035
3054
|
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
|
|
3036
3055
|
basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c) {
|
|
3037
|
-
if (__n)
|
|
3038
|
-
|
|
3039
|
-
size_type __sz = size();
|
|
3040
|
-
if (__cap - __sz < __n)
|
|
3041
|
-
__grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0);
|
|
3042
|
-
__annotate_increase(__n);
|
|
3043
|
-
pointer __p = __get_pointer();
|
|
3044
|
-
traits_type::assign(std::__to_address(__p) + __sz, __n, __c);
|
|
3045
|
-
__sz += __n;
|
|
3046
|
-
__set_size(__sz);
|
|
3047
|
-
traits_type::assign(__p[__sz], value_type());
|
|
3048
|
-
}
|
|
3049
|
-
return *this;
|
|
3050
|
-
}
|
|
3056
|
+
if (__n == 0)
|
|
3057
|
+
return *this;
|
|
3051
3058
|
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
__set_size(__sz);
|
|
3064
|
-
traits_type::assign(__p[__sz], value_type());
|
|
3065
|
-
}
|
|
3059
|
+
size_type __cap = capacity();
|
|
3060
|
+
size_type __sz = size();
|
|
3061
|
+
if (__cap - __sz < __n)
|
|
3062
|
+
__grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __sz, 0);
|
|
3063
|
+
__annotate_increase(__n);
|
|
3064
|
+
pointer __p = __get_pointer();
|
|
3065
|
+
traits_type::assign(std::__to_address(__p) + __sz, __n, __c);
|
|
3066
|
+
__sz += __n;
|
|
3067
|
+
__set_size(__sz);
|
|
3068
|
+
traits_type::assign(__p[__sz], value_type());
|
|
3069
|
+
return *this;
|
|
3066
3070
|
}
|
|
3067
3071
|
|
|
3068
3072
|
template <class _CharT, class _Traits, class _Allocator>
|
|
@@ -3120,23 +3124,27 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_t
|
|
|
3120
3124
|
if (__pos > __sz)
|
|
3121
3125
|
this->__throw_out_of_range();
|
|
3122
3126
|
size_type __cap = capacity();
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
__annotate_increase(__n);
|
|
3126
|
-
value_type* __p = std::__to_address(__get_pointer());
|
|
3127
|
-
size_type __n_move = __sz - __pos;
|
|
3128
|
-
if (__n_move != 0) {
|
|
3129
|
-
if (std::__is_pointer_in_range(__p + __pos, __p + __sz, __s))
|
|
3130
|
-
__s += __n;
|
|
3131
|
-
traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
|
|
3132
|
-
}
|
|
3133
|
-
traits_type::move(__p + __pos, __s, __n);
|
|
3134
|
-
__sz += __n;
|
|
3135
|
-
__set_size(__sz);
|
|
3136
|
-
traits_type::assign(__p[__sz], value_type());
|
|
3137
|
-
}
|
|
3138
|
-
} else
|
|
3127
|
+
|
|
3128
|
+
if (__cap - __sz < __n) {
|
|
3139
3129
|
__grow_by_and_replace(__cap, __sz + __n - __cap, __sz, __pos, 0, __n, __s);
|
|
3130
|
+
return *this;
|
|
3131
|
+
}
|
|
3132
|
+
|
|
3133
|
+
if (__n == 0)
|
|
3134
|
+
return *this;
|
|
3135
|
+
|
|
3136
|
+
__annotate_increase(__n);
|
|
3137
|
+
value_type* __p = std::__to_address(__get_pointer());
|
|
3138
|
+
size_type __n_move = __sz - __pos;
|
|
3139
|
+
if (__n_move != 0) {
|
|
3140
|
+
if (std::__is_pointer_in_range(__p + __pos, __p + __sz, __s))
|
|
3141
|
+
__s += __n;
|
|
3142
|
+
traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
|
|
3143
|
+
}
|
|
3144
|
+
traits_type::move(__p + __pos, __s, __n);
|
|
3145
|
+
__sz += __n;
|
|
3146
|
+
__set_size(__sz);
|
|
3147
|
+
traits_type::assign(__p[__sz], value_type());
|
|
3140
3148
|
return *this;
|
|
3141
3149
|
}
|
|
3142
3150
|
|
|
@@ -3146,24 +3154,26 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n
|
|
|
3146
3154
|
size_type __sz = size();
|
|
3147
3155
|
if (__pos > __sz)
|
|
3148
3156
|
this->__throw_out_of_range();
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
__p
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
__set_size(__sz);
|
|
3165
|
-
traits_type::assign(__p[__sz], value_type());
|
|
3157
|
+
|
|
3158
|
+
if (__n == 0)
|
|
3159
|
+
return *this;
|
|
3160
|
+
|
|
3161
|
+
size_type __cap = capacity();
|
|
3162
|
+
value_type* __p;
|
|
3163
|
+
if (__cap - __sz >= __n) {
|
|
3164
|
+
__annotate_increase(__n);
|
|
3165
|
+
__p = std::__to_address(__get_pointer());
|
|
3166
|
+
size_type __n_move = __sz - __pos;
|
|
3167
|
+
if (__n_move != 0)
|
|
3168
|
+
traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
|
|
3169
|
+
} else {
|
|
3170
|
+
__grow_by_without_replace(__cap, __sz + __n - __cap, __sz, __pos, 0, __n);
|
|
3171
|
+
__p = std::__to_address(__get_long_pointer());
|
|
3166
3172
|
}
|
|
3173
|
+
traits_type::assign(__p + __pos, __n, __c);
|
|
3174
|
+
__sz += __n;
|
|
3175
|
+
__set_size(__sz);
|
|
3176
|
+
traits_type::assign(__p[__sz], value_type());
|
|
3167
3177
|
return *this;
|
|
3168
3178
|
}
|
|
3169
3179
|
|
|
@@ -3176,7 +3186,7 @@ basic_string<_CharT, _Traits, _Allocator>::__insert_with_size(
|
|
|
3176
3186
|
if (__n == 0)
|
|
3177
3187
|
return begin() + __ip;
|
|
3178
3188
|
|
|
3179
|
-
if (
|
|
3189
|
+
if (__string_is_trivial_iterator_v<_Iterator> && !__addr_in_range(*__first)) {
|
|
3180
3190
|
return __insert_from_safe_copy(__n, __ip, std::move(__first), std::move(__last));
|
|
3181
3191
|
} else {
|
|
3182
3192
|
const basic_string __temp(__init_with_sentinel_tag(), std::move(__first), std::move(__last), __alloc_);
|
|
@@ -3237,38 +3247,38 @@ basic_string<_CharT, _Traits, _Allocator>::replace(
|
|
|
3237
3247
|
this->__throw_out_of_range();
|
|
3238
3248
|
__n1 = std::min(__n1, __sz - __pos);
|
|
3239
3249
|
size_type __cap = capacity();
|
|
3240
|
-
if (__cap - __sz + __n1
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
if (__p + __pos + __n1 <= __s)
|
|
3254
|
-
__s += __n2 - __n1;
|
|
3255
|
-
else // __p + __pos < __s < __p + __pos + __n1
|
|
3256
|
-
{
|
|
3257
|
-
traits_type::move(__p + __pos, __s, __n1);
|
|
3258
|
-
__pos += __n1;
|
|
3259
|
-
__s += __n2;
|
|
3260
|
-
__n2 -= __n1;
|
|
3261
|
-
__n1 = 0;
|
|
3262
|
-
}
|
|
3263
|
-
}
|
|
3250
|
+
if (__cap - __sz + __n1 < __n2) {
|
|
3251
|
+
__grow_by_and_replace(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2, __s);
|
|
3252
|
+
return *this;
|
|
3253
|
+
}
|
|
3254
|
+
|
|
3255
|
+
value_type* __p = std::__to_address(__get_pointer());
|
|
3256
|
+
if (__n1 != __n2) {
|
|
3257
|
+
if (__n2 > __n1)
|
|
3258
|
+
__annotate_increase(__n2 - __n1);
|
|
3259
|
+
size_type __n_move = __sz - __pos - __n1;
|
|
3260
|
+
if (__n_move != 0) {
|
|
3261
|
+
if (__n1 > __n2) {
|
|
3262
|
+
traits_type::move(__p + __pos, __s, __n2);
|
|
3264
3263
|
traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
|
|
3264
|
+
return __null_terminate_at(__p, __sz + (__n2 - __n1));
|
|
3265
|
+
}
|
|
3266
|
+
if (std::__is_pointer_in_range(__p + __pos + 1, __p + __sz, __s)) {
|
|
3267
|
+
if (__p + __pos + __n1 <= __s) {
|
|
3268
|
+
__s += __n2 - __n1;
|
|
3269
|
+
} else { // __p + __pos < __s < __p + __pos + __n1
|
|
3270
|
+
traits_type::move(__p + __pos, __s, __n1);
|
|
3271
|
+
__pos += __n1;
|
|
3272
|
+
__s += __n2;
|
|
3273
|
+
__n2 -= __n1;
|
|
3274
|
+
__n1 = 0;
|
|
3275
|
+
}
|
|
3265
3276
|
}
|
|
3277
|
+
traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
|
|
3266
3278
|
}
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
__grow_by_and_replace(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2, __s);
|
|
3271
|
-
return *this;
|
|
3279
|
+
}
|
|
3280
|
+
traits_type::move(__p + __pos, __s, __n2);
|
|
3281
|
+
return __null_terminate_at(__p, __sz + (__n2 - __n1));
|
|
3272
3282
|
}
|
|
3273
3283
|
|
|
3274
3284
|
template <class _CharT, class _Traits, class _Allocator>
|
|
@@ -3320,16 +3330,17 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
|
|
|
3320
3330
|
// Does not check __pos against size()
|
|
3321
3331
|
template <class _CharT, class _Traits, class _Allocator>
|
|
3322
3332
|
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE void
|
|
3323
|
-
basic_string<_CharT, _Traits, _Allocator>::__erase_external_with_move(size_type __pos, size_type __n) {
|
|
3324
|
-
if (__n)
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
+
basic_string<_CharT, _Traits, _Allocator>::__erase_external_with_move(size_type __pos, size_type __n) _NOEXCEPT {
|
|
3334
|
+
if (__n == 0)
|
|
3335
|
+
return;
|
|
3336
|
+
|
|
3337
|
+
size_type __sz = size();
|
|
3338
|
+
value_type* __p = std::__to_address(__get_pointer());
|
|
3339
|
+
__n = std::min(__n, __sz - __pos);
|
|
3340
|
+
size_type __n_move = __sz - __pos - __n;
|
|
3341
|
+
if (__n_move != 0)
|
|
3342
|
+
traits_type::move(__p + __pos, __p + __pos + __n, __n_move);
|
|
3343
|
+
__null_terminate_at(__p, __sz - __n);
|
|
3333
3344
|
}
|
|
3334
3345
|
|
|
3335
3346
|
template <class _CharT, class _Traits, class _Allocator>
|
|
@@ -3396,16 +3407,6 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::re
|
|
|
3396
3407
|
__erase_to_end(__n);
|
|
3397
3408
|
}
|
|
3398
3409
|
|
|
3399
|
-
template <class _CharT, class _Traits, class _Allocator>
|
|
3400
|
-
_LIBCPP_CONSTEXPR_SINCE_CXX20 inline void
|
|
3401
|
-
basic_string<_CharT, _Traits, _Allocator>::__resize_default_init(size_type __n) {
|
|
3402
|
-
size_type __sz = size();
|
|
3403
|
-
if (__n > __sz) {
|
|
3404
|
-
__append_default_init(__n - __sz);
|
|
3405
|
-
} else
|
|
3406
|
-
__erase_to_end(__n);
|
|
3407
|
-
}
|
|
3408
|
-
|
|
3409
3410
|
template <class _CharT, class _Traits, class _Allocator>
|
|
3410
3411
|
_LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __requested_capacity) {
|
|
3411
3412
|
if (__requested_capacity > max_size())
|
|
@@ -3418,31 +3419,23 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::re
|
|
|
3418
3419
|
return;
|
|
3419
3420
|
|
|
3420
3421
|
__annotation_guard __g(*this);
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
if (__is_long())
|
|
3426
|
-
__alloc_traits::deallocate(__alloc_, __get_long_pointer(), __get_long_cap());
|
|
3427
|
-
__set_long_cap(__allocation.count);
|
|
3428
|
-
__set_long_size(__size);
|
|
3429
|
-
__set_long_pointer(__allocation.ptr);
|
|
3422
|
+
__long __buffer = __allocate_long_buffer(__alloc_, __requested_capacity);
|
|
3423
|
+
__buffer.__size_ = size();
|
|
3424
|
+
traits_type::copy(std::__to_address(__buffer.__data_), data(), __buffer.__size_ + 1);
|
|
3425
|
+
__reset_internal_buffer(__buffer);
|
|
3430
3426
|
}
|
|
3431
3427
|
|
|
3432
3428
|
template <class _CharT, class _Traits, class _Allocator>
|
|
3433
3429
|
inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::shrink_to_fit() _NOEXCEPT {
|
|
3434
|
-
|
|
3435
|
-
if (__target_capacity == capacity())
|
|
3430
|
+
if (!__is_long())
|
|
3436
3431
|
return;
|
|
3437
3432
|
|
|
3438
|
-
_LIBCPP_ASSERT_INTERNAL(__is_long(), "Trying to shrink small string");
|
|
3439
|
-
|
|
3440
|
-
// We're a long string and we're shrinking into the small buffer.
|
|
3441
3433
|
const auto __ptr = __get_long_pointer();
|
|
3442
3434
|
const auto __size = __get_long_size();
|
|
3443
3435
|
const auto __cap = __get_long_cap();
|
|
3444
3436
|
|
|
3445
|
-
|
|
3437
|
+
// We're a long string and we're shrinking into the small buffer.
|
|
3438
|
+
if (__fits_in_sso(__size)) {
|
|
3446
3439
|
__annotation_guard __g(*this);
|
|
3447
3440
|
__set_short_size(__size);
|
|
3448
3441
|
traits_type::copy(std::__to_address(__get_short_pointer()), std::__to_address(__ptr), __size + 1);
|
|
@@ -3450,25 +3443,25 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocat
|
|
|
3450
3443
|
return;
|
|
3451
3444
|
}
|
|
3452
3445
|
|
|
3446
|
+
if (__align_allocation_size(__size) == __cap)
|
|
3447
|
+
return;
|
|
3448
|
+
|
|
3453
3449
|
# if _LIBCPP_HAS_EXCEPTIONS
|
|
3454
3450
|
try {
|
|
3455
3451
|
# endif // _LIBCPP_HAS_EXCEPTIONS
|
|
3456
3452
|
__annotation_guard __g(*this);
|
|
3457
|
-
|
|
3453
|
+
__long __buffer = __allocate_long_buffer(__alloc_, __size);
|
|
3458
3454
|
|
|
3459
3455
|
// The Standard mandates shrink_to_fit() does not increase the capacity.
|
|
3460
3456
|
// With equal capacity keep the existing buffer. This avoids extra work
|
|
3461
3457
|
// due to swapping the elements.
|
|
3462
|
-
if (
|
|
3463
|
-
__alloc_traits::deallocate(__alloc_,
|
|
3458
|
+
if (__buffer.__cap_ * __endian_factor - 1 >= capacity()) {
|
|
3459
|
+
__alloc_traits::deallocate(__alloc_, __buffer.__data_, __buffer.__cap_ * __endian_factor);
|
|
3464
3460
|
return;
|
|
3465
3461
|
}
|
|
3466
3462
|
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
__alloc_traits::deallocate(__alloc_, __ptr, __cap);
|
|
3470
|
-
__set_long_cap(__allocation.count);
|
|
3471
|
-
__set_long_pointer(__allocation.ptr);
|
|
3463
|
+
traits_type::copy(std::__to_address(__buffer.__data_), std::__to_address(__get_long_pointer()), __size + 1);
|
|
3464
|
+
__reset_internal_buffer(__buffer);
|
|
3472
3465
|
# if _LIBCPP_HAS_EXCEPTIONS
|
|
3473
3466
|
} catch (...) {
|
|
3474
3467
|
return;
|
|
@@ -3574,7 +3567,8 @@ operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
|
|
|
3574
3567
|
|
|
3575
3568
|
template <class _CharT, class _Traits, class _Allocator>
|
|
3576
3569
|
inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool
|
|
3577
|
-
operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
|
|
3570
|
+
operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
|
|
3571
|
+
const _CharT* _LIBCPP_DIAGNOSE_NULLPTR __rhs) _NOEXCEPT {
|
|
3578
3572
|
_LIBCPP_ASSERT_NON_NULL(__rhs != nullptr, "operator==(basic_string, char*): received nullptr");
|
|
3579
3573
|
|
|
3580
3574
|
using _String = basic_string<_CharT, _Traits, _Allocator>;
|
|
@@ -3858,46 +3852,52 @@ swap(basic_string<_CharT, _Traits, _Allocator>& __lhs, basic_string<_CharT, _Tra
|
|
|
3858
3852
|
__lhs.swap(__rhs);
|
|
3859
3853
|
}
|
|
3860
3854
|
|
|
3861
|
-
_LIBCPP_EXPORTED_FROM_ABI int stoi(const string& __str, size_t* __idx = nullptr, int __base = 10);
|
|
3862
|
-
_LIBCPP_EXPORTED_FROM_ABI long
|
|
3863
|
-
|
|
3864
|
-
_LIBCPP_EXPORTED_FROM_ABI long
|
|
3865
|
-
_LIBCPP_EXPORTED_FROM_ABI
|
|
3866
|
-
|
|
3867
|
-
_LIBCPP_EXPORTED_FROM_ABI
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
_LIBCPP_EXPORTED_FROM_ABI
|
|
3872
|
-
_LIBCPP_EXPORTED_FROM_ABI
|
|
3873
|
-
|
|
3874
|
-
_LIBCPP_EXPORTED_FROM_ABI string to_string(
|
|
3875
|
-
_LIBCPP_EXPORTED_FROM_ABI string to_string(
|
|
3876
|
-
_LIBCPP_EXPORTED_FROM_ABI string to_string(
|
|
3877
|
-
_LIBCPP_EXPORTED_FROM_ABI string to_string(
|
|
3878
|
-
_LIBCPP_EXPORTED_FROM_ABI string to_string(
|
|
3879
|
-
_LIBCPP_EXPORTED_FROM_ABI string to_string(long
|
|
3855
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI int stoi(const string& __str, size_t* __idx = nullptr, int __base = 10);
|
|
3856
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI unsigned long
|
|
3857
|
+
stoul(const string& __str, size_t* __idx = nullptr, int __base = 10);
|
|
3858
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI long stol(const string& __str, size_t* __idx = nullptr, int __base = 10);
|
|
3859
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI long long
|
|
3860
|
+
stoll(const string& __str, size_t* __idx = nullptr, int __base = 10);
|
|
3861
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI unsigned long long
|
|
3862
|
+
stoull(const string& __str, size_t* __idx = nullptr, int __base = 10);
|
|
3863
|
+
|
|
3864
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI float stof(const string& __str, size_t* __idx = nullptr);
|
|
3865
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI double stod(const string& __str, size_t* __idx = nullptr);
|
|
3866
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI long double stold(const string& __str, size_t* __idx = nullptr);
|
|
3867
|
+
|
|
3868
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI string to_string(int __val);
|
|
3869
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI string to_string(unsigned __val);
|
|
3870
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI string to_string(long __val);
|
|
3871
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI string to_string(unsigned long __val);
|
|
3872
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI string to_string(long long __val);
|
|
3873
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI string to_string(unsigned long long __val);
|
|
3874
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI string to_string(float __val);
|
|
3875
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI string to_string(double __val);
|
|
3876
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI string to_string(long double __val);
|
|
3880
3877
|
|
|
3881
3878
|
# if _LIBCPP_HAS_WIDE_CHARACTERS
|
|
3882
|
-
_LIBCPP_EXPORTED_FROM_ABI int stoi(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
|
|
3883
|
-
_LIBCPP_EXPORTED_FROM_ABI long stol(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
|
|
3884
|
-
_LIBCPP_EXPORTED_FROM_ABI unsigned long
|
|
3885
|
-
|
|
3886
|
-
_LIBCPP_EXPORTED_FROM_ABI
|
|
3887
|
-
|
|
3888
|
-
_LIBCPP_EXPORTED_FROM_ABI
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
_LIBCPP_EXPORTED_FROM_ABI
|
|
3893
|
-
_LIBCPP_EXPORTED_FROM_ABI
|
|
3894
|
-
|
|
3895
|
-
_LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(
|
|
3896
|
-
_LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(
|
|
3897
|
-
_LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(
|
|
3898
|
-
_LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(
|
|
3899
|
-
_LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(
|
|
3900
|
-
_LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(long
|
|
3879
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI int stoi(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
|
|
3880
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI long stol(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
|
|
3881
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI unsigned long
|
|
3882
|
+
stoul(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
|
|
3883
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI long long
|
|
3884
|
+
stoll(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
|
|
3885
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI unsigned long long
|
|
3886
|
+
stoull(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
|
|
3887
|
+
|
|
3888
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI float stof(const wstring& __str, size_t* __idx = nullptr);
|
|
3889
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI double stod(const wstring& __str, size_t* __idx = nullptr);
|
|
3890
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI long double stold(const wstring& __str, size_t* __idx = nullptr);
|
|
3891
|
+
|
|
3892
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(int __val);
|
|
3893
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(unsigned __val);
|
|
3894
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(long __val);
|
|
3895
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(unsigned long __val);
|
|
3896
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(long long __val);
|
|
3897
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(unsigned long long __val);
|
|
3898
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(float __val);
|
|
3899
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(double __val);
|
|
3900
|
+
[[__nodiscard__]] _LIBCPP_EXPORTED_FROM_ABI wstring to_wstring(long double __val);
|
|
3901
3901
|
# endif // _LIBCPP_HAS_WIDE_CHARACTERS
|
|
3902
3902
|
|
|
3903
3903
|
template <class _CharT, class _Traits, class _Allocator>
|
|
@@ -3906,7 +3906,7 @@ _LIBCPP_TEMPLATE_DATA_VIS const typename basic_string<_CharT, _Traits, _Allocato
|
|
|
3906
3906
|
|
|
3907
3907
|
template <class _CharT, class _Allocator>
|
|
3908
3908
|
struct __string_hash : public __unary_function<basic_string<_CharT, char_traits<_CharT>, _Allocator>, size_t> {
|
|
3909
|
-
_LIBCPP_HIDE_FROM_ABI size_t
|
|
3909
|
+
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_t
|
|
3910
3910
|
operator()(const basic_string<_CharT, char_traits<_CharT>, _Allocator>& __val) const _NOEXCEPT {
|
|
3911
3911
|
return std::__do_string_hash(__val.data(), __val.data() + __val.size());
|
|
3912
3912
|
}
|
|
@@ -3977,30 +3977,31 @@ erase_if(basic_string<_CharT, _Traits, _Allocator>& __str, _Predicate __pred) {
|
|
|
3977
3977
|
// Literal suffixes for basic_string [basic.string.literals]
|
|
3978
3978
|
inline namespace literals {
|
|
3979
3979
|
inline namespace string_literals {
|
|
3980
|
-
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<char>
|
|
3980
|
+
[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<char>
|
|
3981
3981
|
operator""s(const char* __str, size_t __len) {
|
|
3982
3982
|
return basic_string<char>(__str, __len);
|
|
3983
3983
|
}
|
|
3984
3984
|
|
|
3985
3985
|
# if _LIBCPP_HAS_WIDE_CHARACTERS
|
|
3986
|
-
inline _LIBCPP_HIDE_FROM_ABI
|
|
3987
|
-
operator""s(const wchar_t* __str, size_t __len) {
|
|
3986
|
+
[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
|
|
3987
|
+
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<wchar_t> operator""s(const wchar_t* __str, size_t __len) {
|
|
3988
3988
|
return basic_string<wchar_t>(__str, __len);
|
|
3989
3989
|
}
|
|
3990
3990
|
# endif
|
|
3991
3991
|
|
|
3992
3992
|
# if _LIBCPP_HAS_CHAR8_T
|
|
3993
|
-
inline
|
|
3993
|
+
[[__nodiscard__]] inline
|
|
3994
|
+
_LIBCPP_HIDE_FROM_ABI constexpr basic_string<char8_t> operator""s(const char8_t* __str, size_t __len) {
|
|
3994
3995
|
return basic_string<char8_t>(__str, __len);
|
|
3995
3996
|
}
|
|
3996
3997
|
# endif
|
|
3997
3998
|
|
|
3998
|
-
inline _LIBCPP_HIDE_FROM_ABI
|
|
3999
|
-
operator""s(const char16_t* __str, size_t __len) {
|
|
3999
|
+
[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI
|
|
4000
|
+
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<char16_t> operator""s(const char16_t* __str, size_t __len) {
|
|
4000
4001
|
return basic_string<char16_t>(__str, __len);
|
|
4001
4002
|
}
|
|
4002
4003
|
|
|
4003
|
-
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<char32_t>
|
|
4004
|
+
[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<char32_t>
|
|
4004
4005
|
operator""s(const char32_t* __str, size_t __len) {
|
|
4005
4006
|
return basic_string<char32_t>(__str, __len);
|
|
4006
4007
|
}
|