@zigc/lib 0.17.0-dev.131 → 0.17.0-dev.215
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/stdlib.zig +32 -22
- package/compiler/aro/aro/Compilation.zig +0 -3
- package/compiler/translate-c/ast.zig +5 -2
- package/compiler_rt/arm.zig +3 -3
- package/compiler_rt/trunctfhf2.zig +3 -0
- package/compiler_rt.zig +1 -22
- package/docs/wasm/markdown/Parser.zig +5 -9
- 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/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/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 +40 -19
- package/libunwind/src/CompactUnwinder.hpp +16 -5
- package/libunwind/src/DwarfInstructions.hpp +24 -13
- package/libunwind/src/DwarfParser.hpp +60 -22
- 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/Step/Compile.zig +18 -19
- package/std/Build/Step/Run.zig +13 -6
- package/std/Build/Step.zig +0 -3
- package/std/Io/Threaded.zig +3 -0
- 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 +11 -2
- package/std/c.zig +7 -0
- package/std/debug/Dwarf.zig +14 -11
- package/std/debug/Pdb.zig +24 -16
- package/std/hash/xxhash.zig +0 -6
- package/std/math/log10.zig +0 -2
- package/std/math/modf.zig +0 -1
- package/std/mem.zig +1 -2
- package/std/os/linux/syscalls.zig +26 -1
- package/std/os/linux/x86.zig +2 -2
- package/std/os/windows.zig +130 -1
- package/std/simd.zig +4 -21
- package/std/start.zig +4 -3
- package/std/zig/Ast.zig +5 -7
- package/std/zig/AstGen.zig +20 -14
- package/std/zig/ErrorBundle.zig +6 -2
- package/std/zig/ZonGen.zig +13 -21
- package/std/zig/llvm/Builder.zig +2 -2
- 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/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/libtsan/sanitizer_common/sanitizer_coverage_interface.inc +0 -43
- package/std/Build/Step/CheckObject.zig +0 -2764
package/libcxx/include/optional
CHANGED
|
@@ -20,6 +20,11 @@ namespace std {
|
|
|
20
20
|
template <class T>
|
|
21
21
|
class optional;
|
|
22
22
|
|
|
23
|
+
template<class T>
|
|
24
|
+
constexpr bool ranges::enable_view<optional<T>> = true;
|
|
25
|
+
template<class T>
|
|
26
|
+
constexpr auto format_kind<optional<T>> = range_format::disabled;
|
|
27
|
+
|
|
23
28
|
template<class T>
|
|
24
29
|
concept is-derived-from-optional = requires(const T& t) { // exposition only
|
|
25
30
|
[]<class U>(const optional<U>&){ }(t);
|
|
@@ -102,6 +107,8 @@ namespace std {
|
|
|
102
107
|
class optional {
|
|
103
108
|
public:
|
|
104
109
|
using value_type = T;
|
|
110
|
+
using iterator = implementation-defined; // see [optional.iterators]
|
|
111
|
+
using const_iterator = implementation-defined; // see [optional.iterators]
|
|
105
112
|
|
|
106
113
|
// [optional.ctor], constructors
|
|
107
114
|
constexpr optional() noexcept;
|
|
@@ -112,7 +119,7 @@ namespace std {
|
|
|
112
119
|
constexpr explicit optional(in_place_t, Args &&...);
|
|
113
120
|
template<class U, class... Args>
|
|
114
121
|
constexpr explicit optional(in_place_t, initializer_list<U>, Args &&...);
|
|
115
|
-
template<class U = T
|
|
122
|
+
template<class U = remove_cv_t<T>>
|
|
116
123
|
constexpr explicit(see-below) optional(U &&);
|
|
117
124
|
template<class U>
|
|
118
125
|
explicit(see-below) optional(const optional<U> &); // constexpr in C++20
|
|
@@ -126,7 +133,7 @@ namespace std {
|
|
|
126
133
|
optional &operator=(nullopt_t) noexcept; // constexpr in C++20
|
|
127
134
|
constexpr optional &operator=(const optional &);
|
|
128
135
|
constexpr optional &operator=(optional &&) noexcept(see below);
|
|
129
|
-
template<class U = T
|
|
136
|
+
template<class U = remove_cv_t<T>> optional &operator=(U &&); // constexpr in C++20
|
|
130
137
|
template<class U> optional &operator=(const optional<U> &); // constexpr in C++20
|
|
131
138
|
template<class U> optional &operator=(optional<U> &&); // constexpr in C++20
|
|
132
139
|
template<class... Args> T& emplace(Args &&...); // constexpr in C++20
|
|
@@ -135,6 +142,12 @@ namespace std {
|
|
|
135
142
|
// [optional.swap], swap
|
|
136
143
|
void swap(optional &) noexcept(see below ); // constexpr in C++20
|
|
137
144
|
|
|
145
|
+
// [optional.iterators], iterator support
|
|
146
|
+
constexpr iterator begin() noexcept;
|
|
147
|
+
constexpr const_iterator begin() const noexcept;
|
|
148
|
+
constexpr iterator end() noexcept;
|
|
149
|
+
constexpr const_iterator end() const noexcept;
|
|
150
|
+
|
|
138
151
|
// [optional.observe], observers
|
|
139
152
|
constexpr T const *operator->() const noexcept;
|
|
140
153
|
constexpr T *operator->() noexcept;
|
|
@@ -148,8 +161,8 @@ namespace std {
|
|
|
148
161
|
constexpr T &value() &;
|
|
149
162
|
constexpr T &&value() &&;
|
|
150
163
|
constexpr const T &&value() const &&;
|
|
151
|
-
template<class U
|
|
152
|
-
template<class U
|
|
164
|
+
template<class U = remove_cv_t<T>> constexpr T value_or(U &&) const &;
|
|
165
|
+
template<class U = remove_cv_t<T>> constexpr T value_or(U &&) &&;
|
|
153
166
|
|
|
154
167
|
// [optional.monadic], monadic operations
|
|
155
168
|
template<class F> constexpr auto and_then(F&& f) &; // since C++23
|
|
@@ -173,6 +186,71 @@ namespace std {
|
|
|
173
186
|
template<class T>
|
|
174
187
|
optional(T) -> optional<T>;
|
|
175
188
|
|
|
189
|
+
template<class T>
|
|
190
|
+
class optional<T&> { // since C++26
|
|
191
|
+
public:
|
|
192
|
+
using value_type = T;
|
|
193
|
+
using iterator = implementation-defined; // see [optional.ref.iterators]
|
|
194
|
+
|
|
195
|
+
public:
|
|
196
|
+
// [optional.ref.ctor], constructors
|
|
197
|
+
constexpr optional() noexcept = default;
|
|
198
|
+
constexpr optional(nullopt_t) noexcept : optional() {}
|
|
199
|
+
constexpr optional(const optional& rhs) noexcept = default;
|
|
200
|
+
|
|
201
|
+
template<class Arg>
|
|
202
|
+
constexpr explicit optional(in_place_t, Arg&& arg);
|
|
203
|
+
template<class U>
|
|
204
|
+
constexpr explicit(see below) optional(U&& u) noexcept(see below);
|
|
205
|
+
template<class U>
|
|
206
|
+
constexpr explicit(see below) optional(optional<U>& rhs) noexcept(see below);
|
|
207
|
+
template<class U>
|
|
208
|
+
constexpr explicit(see below) optional(const optional<U>& rhs) noexcept(see below);
|
|
209
|
+
template<class U>
|
|
210
|
+
constexpr explicit(see below) optional(optional<U>&& rhs) noexcept(see below);
|
|
211
|
+
template<class U>
|
|
212
|
+
constexpr explicit(see below) optional(const optional<U>&& rhs) noexcept(see below);
|
|
213
|
+
|
|
214
|
+
constexpr ~optional() = default;
|
|
215
|
+
|
|
216
|
+
// [optional.ref.assign], assignment
|
|
217
|
+
constexpr optional& operator=(nullopt_t) noexcept;
|
|
218
|
+
constexpr optional& operator=(const optional& rhs) noexcept = default;
|
|
219
|
+
|
|
220
|
+
template<class U> constexpr T& emplace(U&& u) noexcept(see below);
|
|
221
|
+
|
|
222
|
+
// [optional.ref.swap], swap
|
|
223
|
+
constexpr void swap(optional& rhs) noexcept;
|
|
224
|
+
|
|
225
|
+
// [optional.ref.iterators], iterator support
|
|
226
|
+
constexpr iterator begin() const noexcept;
|
|
227
|
+
constexpr iterator end() const noexcept;
|
|
228
|
+
|
|
229
|
+
// [optional.ref.observe], observers
|
|
230
|
+
constexpr T* operator->() const noexcept;
|
|
231
|
+
constexpr T& operator*() const noexcept;
|
|
232
|
+
constexpr explicit operator bool() const noexcept;
|
|
233
|
+
constexpr bool has_value() const noexcept;
|
|
234
|
+
constexpr T& value() const; // freestanding-deleted
|
|
235
|
+
template<class U = remove_cv_t<T>>
|
|
236
|
+
constexpr remove_cv_t<T> value_or(U&& u) const;
|
|
237
|
+
|
|
238
|
+
// [optional.ref.monadic], monadic operations
|
|
239
|
+
template<class F> constexpr auto and_then(F&& f) const;
|
|
240
|
+
template<class F> constexpr optional<invoke_result_t<F, T&>> transform(F&& f) const;
|
|
241
|
+
template<class F> constexpr optional or_else(F&& f) const;
|
|
242
|
+
|
|
243
|
+
// [optional.ref.mod], modifiers
|
|
244
|
+
constexpr void reset() noexcept;
|
|
245
|
+
|
|
246
|
+
private:
|
|
247
|
+
T* val = nullptr; // exposition only
|
|
248
|
+
|
|
249
|
+
// [optional.ref.expos], exposition only helper functions
|
|
250
|
+
template<class U>
|
|
251
|
+
constexpr void convert-ref-init-val(U&& u); // exposition only
|
|
252
|
+
};
|
|
253
|
+
|
|
176
254
|
} // namespace std
|
|
177
255
|
|
|
178
256
|
*/
|
|
@@ -186,13 +264,19 @@ namespace std {
|
|
|
186
264
|
# include <__compare/three_way_comparable.h>
|
|
187
265
|
# include <__concepts/invocable.h>
|
|
188
266
|
# include <__config>
|
|
267
|
+
# include <__cstddef/ptrdiff_t.h>
|
|
189
268
|
# include <__exception/exception.h>
|
|
269
|
+
# include <__format/range_format.h>
|
|
190
270
|
# include <__functional/hash.h>
|
|
191
271
|
# include <__functional/invoke.h>
|
|
192
272
|
# include <__functional/unary_function.h>
|
|
193
273
|
# include <__fwd/functional.h>
|
|
274
|
+
# include <__iterator/bounded_iter.h>
|
|
275
|
+
# include <__iterator/wrap_iter.h>
|
|
194
276
|
# include <__memory/addressof.h>
|
|
195
277
|
# include <__memory/construct_at.h>
|
|
278
|
+
# include <__ranges/enable_borrowed_range.h>
|
|
279
|
+
# include <__ranges/enable_view.h>
|
|
196
280
|
# include <__tuple/sfinae_helpers.h>
|
|
197
281
|
# include <__type_traits/add_pointer.h>
|
|
198
282
|
# include <__type_traits/conditional.h>
|
|
@@ -200,6 +284,7 @@ namespace std {
|
|
|
200
284
|
# include <__type_traits/decay.h>
|
|
201
285
|
# include <__type_traits/disjunction.h>
|
|
202
286
|
# include <__type_traits/enable_if.h>
|
|
287
|
+
# include <__type_traits/integral_constant.h>
|
|
203
288
|
# include <__type_traits/invoke.h>
|
|
204
289
|
# include <__type_traits/is_array.h>
|
|
205
290
|
# include <__type_traits/is_assignable.h>
|
|
@@ -207,11 +292,11 @@ namespace std {
|
|
|
207
292
|
# include <__type_traits/is_convertible.h>
|
|
208
293
|
# include <__type_traits/is_core_convertible.h>
|
|
209
294
|
# include <__type_traits/is_destructible.h>
|
|
295
|
+
# include <__type_traits/is_function.h>
|
|
210
296
|
# include <__type_traits/is_nothrow_assignable.h>
|
|
211
297
|
# include <__type_traits/is_nothrow_constructible.h>
|
|
212
298
|
# include <__type_traits/is_object.h>
|
|
213
299
|
# include <__type_traits/is_reference.h>
|
|
214
|
-
# include <__type_traits/is_replaceable.h>
|
|
215
300
|
# include <__type_traits/is_same.h>
|
|
216
301
|
# include <__type_traits/is_scalar.h>
|
|
217
302
|
# include <__type_traits/is_swappable.h>
|
|
@@ -220,6 +305,7 @@ namespace std {
|
|
|
220
305
|
# include <__type_traits/is_trivially_destructible.h>
|
|
221
306
|
# include <__type_traits/is_trivially_relocatable.h>
|
|
222
307
|
# include <__type_traits/negation.h>
|
|
308
|
+
# include <__type_traits/reference_constructs_from_temporary.h>
|
|
223
309
|
# include <__type_traits/remove_const.h>
|
|
224
310
|
# include <__type_traits/remove_cv.h>
|
|
225
311
|
# include <__type_traits/remove_cvref.h>
|
|
@@ -255,7 +341,7 @@ public:
|
|
|
255
341
|
_LIBCPP_HIDE_FROM_ABI bad_optional_access& operator=(const bad_optional_access&) _NOEXCEPT = default;
|
|
256
342
|
// Get the key function ~bad_optional_access() into the dylib
|
|
257
343
|
~bad_optional_access() _NOEXCEPT override;
|
|
258
|
-
const char* what() const _NOEXCEPT override;
|
|
344
|
+
[[__nodiscard__]] const char* what() const _NOEXCEPT override;
|
|
259
345
|
};
|
|
260
346
|
|
|
261
347
|
} // namespace std
|
|
@@ -358,7 +444,7 @@ struct __optional_storage_base : __optional_destruct_base<_Tp> {
|
|
|
358
444
|
using value_type = _Tp;
|
|
359
445
|
using __base::__base;
|
|
360
446
|
|
|
361
|
-
_LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return this->__engaged_; }
|
|
447
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return this->__engaged_; }
|
|
362
448
|
|
|
363
449
|
_LIBCPP_HIDE_FROM_ABI constexpr value_type& __get() & noexcept { return this->__val_; }
|
|
364
450
|
_LIBCPP_HIDE_FROM_ABI constexpr const value_type& __get() const& noexcept { return this->__val_; }
|
|
@@ -390,58 +476,60 @@ struct __optional_storage_base : __optional_destruct_base<_Tp> {
|
|
|
390
476
|
__construct(std::forward<_That>(__opt).__get());
|
|
391
477
|
}
|
|
392
478
|
}
|
|
479
|
+
|
|
480
|
+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
|
|
481
|
+
__swap(__optional_storage_base& __rhs) noexcept(is_nothrow_move_constructible_v<_Tp> && is_nothrow_swappable_v<_Tp>) {
|
|
482
|
+
using std::swap;
|
|
483
|
+
if (this->has_value() == __rhs.has_value()) {
|
|
484
|
+
if (this->has_value())
|
|
485
|
+
swap(this->__get(), __rhs.__get());
|
|
486
|
+
} else {
|
|
487
|
+
if (this->has_value()) {
|
|
488
|
+
__rhs.__construct(std::move(this->__get()));
|
|
489
|
+
this->reset();
|
|
490
|
+
} else {
|
|
491
|
+
this->__construct(std::move(__rhs.__get()));
|
|
492
|
+
__rhs.reset();
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}
|
|
393
496
|
};
|
|
394
497
|
|
|
395
|
-
// optional<T&> is currently required to be ill-formed. However, it may
|
|
396
|
-
// be allowed in the future. For this reason, it has already been implemented
|
|
397
|
-
// to ensure we can make the change in an ABI-compatible manner.
|
|
398
498
|
template <class _Tp>
|
|
399
499
|
struct __optional_storage_base<_Tp, true> {
|
|
400
500
|
using value_type = _Tp;
|
|
401
501
|
using __raw_type _LIBCPP_NODEBUG = remove_reference_t<_Tp>;
|
|
402
502
|
__raw_type* __value_;
|
|
403
503
|
|
|
504
|
+
_LIBCPP_HIDE_FROM_ABI constexpr __optional_storage_base() noexcept : __value_(nullptr) {}
|
|
505
|
+
|
|
404
506
|
template <class _Up>
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
using _RawTp = __libcpp_remove_reference_t<_Tp>;
|
|
409
|
-
using _TpPtr = _RawTp*;
|
|
410
|
-
using _CheckLValueArg =
|
|
411
|
-
integral_constant<bool,
|
|
412
|
-
(is_lvalue_reference<_Up>::value && is_convertible<_UpPtr, _TpPtr>::value) ||
|
|
413
|
-
is_same<_RawUp, reference_wrapper<_RawTp>>::value ||
|
|
414
|
-
is_same<_RawUp, reference_wrapper<__remove_const_t<_RawTp>>>::value >;
|
|
415
|
-
return (is_lvalue_reference<_Tp>::value && _CheckLValueArg::value) ||
|
|
416
|
-
(is_rvalue_reference<_Tp>::value && !is_lvalue_reference<_Up>::value &&
|
|
417
|
-
is_convertible<_UpPtr, _TpPtr>::value);
|
|
507
|
+
_LIBCPP_HIDE_FROM_ABI constexpr void __convert_init_ref_val(_Up&& __val) noexcept {
|
|
508
|
+
_Tp& __r(std::forward<_Up>(__val));
|
|
509
|
+
__value_ = std::addressof(__r);
|
|
418
510
|
}
|
|
419
511
|
|
|
420
|
-
_LIBCPP_HIDE_FROM_ABI constexpr __optional_storage_base() noexcept : __value_(nullptr) {}
|
|
421
|
-
|
|
422
512
|
template <class _UArg>
|
|
423
|
-
_LIBCPP_HIDE_FROM_ABI constexpr explicit __optional_storage_base(in_place_t, _UArg&& __uarg)
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
"Attempted to construct a reference element in tuple from a "
|
|
513
|
+
_LIBCPP_HIDE_FROM_ABI constexpr explicit __optional_storage_base(in_place_t, _UArg&& __uarg) {
|
|
514
|
+
static_assert(!__reference_constructs_from_temporary_v<_Tp, _UArg>,
|
|
515
|
+
"Attempted to construct a reference element in optional from a "
|
|
427
516
|
"possible temporary");
|
|
517
|
+
__convert_init_ref_val(std::forward<_UArg>(__uarg));
|
|
428
518
|
}
|
|
429
519
|
|
|
430
520
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void reset() noexcept { __value_ = nullptr; }
|
|
431
521
|
|
|
432
|
-
_LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return __value_ != nullptr; }
|
|
433
|
-
|
|
434
|
-
_LIBCPP_HIDE_FROM_ABI constexpr value_type& __get() const& noexcept { return *__value_; }
|
|
522
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return __value_ != nullptr; }
|
|
435
523
|
|
|
436
|
-
_LIBCPP_HIDE_FROM_ABI constexpr value_type
|
|
524
|
+
_LIBCPP_HIDE_FROM_ABI constexpr value_type& __get() const noexcept { return *__value_; }
|
|
437
525
|
|
|
438
526
|
template <class _UArg>
|
|
439
527
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct(_UArg&& __val) {
|
|
440
528
|
_LIBCPP_ASSERT_INTERNAL(!has_value(), "__construct called for engaged __optional_storage");
|
|
441
|
-
static_assert(
|
|
529
|
+
static_assert(!__reference_constructs_from_temporary_v<_Tp, _UArg>,
|
|
442
530
|
"Attempted to construct a reference element in tuple from a "
|
|
443
531
|
"possible temporary");
|
|
444
|
-
|
|
532
|
+
__convert_init_ref_val(std::forward<_UArg>(__val));
|
|
445
533
|
}
|
|
446
534
|
|
|
447
535
|
template <class _That>
|
|
@@ -462,9 +550,13 @@ struct __optional_storage_base<_Tp, true> {
|
|
|
462
550
|
__construct(std::forward<_That>(__opt).__get());
|
|
463
551
|
}
|
|
464
552
|
}
|
|
553
|
+
|
|
554
|
+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __swap(__optional_storage_base& __rhs) noexcept {
|
|
555
|
+
std::swap(__value_, __rhs.__value_);
|
|
556
|
+
}
|
|
465
557
|
};
|
|
466
558
|
|
|
467
|
-
template <class _Tp, bool =
|
|
559
|
+
template <class _Tp, bool = is_trivially_copy_constructible_v<_Tp> || is_lvalue_reference_v<_Tp>>
|
|
468
560
|
struct __optional_copy_base : __optional_storage_base<_Tp> {
|
|
469
561
|
using __optional_storage_base<_Tp>::__optional_storage_base;
|
|
470
562
|
};
|
|
@@ -484,7 +576,7 @@ struct __optional_copy_base<_Tp, false> : __optional_storage_base<_Tp> {
|
|
|
484
576
|
_LIBCPP_HIDE_FROM_ABI __optional_copy_base& operator=(__optional_copy_base&&) = default;
|
|
485
577
|
};
|
|
486
578
|
|
|
487
|
-
template <class _Tp, bool =
|
|
579
|
+
template <class _Tp, bool = is_trivially_move_constructible_v<_Tp> || is_lvalue_reference_v<_Tp>>
|
|
488
580
|
struct __optional_move_base : __optional_copy_base<_Tp> {
|
|
489
581
|
using __optional_copy_base<_Tp>::__optional_copy_base;
|
|
490
582
|
};
|
|
@@ -507,8 +599,9 @@ struct __optional_move_base<_Tp, false> : __optional_copy_base<_Tp> {
|
|
|
507
599
|
};
|
|
508
600
|
|
|
509
601
|
template <class _Tp,
|
|
510
|
-
bool =
|
|
511
|
-
|
|
602
|
+
bool = (is_trivially_destructible_v<_Tp> && is_trivially_copy_constructible_v<_Tp> &&
|
|
603
|
+
is_trivially_copy_assignable_v<_Tp>) ||
|
|
604
|
+
is_lvalue_reference_v<_Tp>>
|
|
512
605
|
struct __optional_copy_assign_base : __optional_move_base<_Tp> {
|
|
513
606
|
using __optional_move_base<_Tp>::__optional_move_base;
|
|
514
607
|
};
|
|
@@ -531,8 +624,9 @@ struct __optional_copy_assign_base<_Tp, false> : __optional_move_base<_Tp> {
|
|
|
531
624
|
};
|
|
532
625
|
|
|
533
626
|
template <class _Tp,
|
|
534
|
-
bool =
|
|
535
|
-
|
|
627
|
+
bool = (is_trivially_destructible_v<_Tp> && is_trivially_move_constructible_v<_Tp> &&
|
|
628
|
+
is_trivially_move_assignable_v<_Tp>) ||
|
|
629
|
+
is_lvalue_reference_v<_Tp>>
|
|
536
630
|
struct __optional_move_assign_base : __optional_copy_assign_base<_Tp> {
|
|
537
631
|
using __optional_copy_assign_base<_Tp>::__optional_copy_assign_base;
|
|
538
632
|
};
|
|
@@ -561,12 +655,24 @@ using __optional_sfinae_ctor_base_t _LIBCPP_NODEBUG =
|
|
|
561
655
|
|
|
562
656
|
template <class _Tp>
|
|
563
657
|
using __optional_sfinae_assign_base_t _LIBCPP_NODEBUG =
|
|
564
|
-
__sfinae_assign_base< (
|
|
565
|
-
(
|
|
658
|
+
__sfinae_assign_base< (is_copy_constructible_v<_Tp> && is_copy_assignable_v<_Tp>) || is_lvalue_reference_v<_Tp>,
|
|
659
|
+
(is_move_constructible_v<_Tp> && is_move_assignable_v<_Tp>) || is_lvalue_reference_v<_Tp>>;
|
|
566
660
|
|
|
567
661
|
template <class _Tp>
|
|
568
662
|
class optional;
|
|
569
663
|
|
|
664
|
+
# if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPERIMENTAL_OPTIONAL_ITERATOR
|
|
665
|
+
template <class _Tp>
|
|
666
|
+
constexpr bool ranges::enable_view<optional<_Tp>> = true;
|
|
667
|
+
|
|
668
|
+
template <class _Tp>
|
|
669
|
+
constexpr range_format format_kind<optional<_Tp>> = range_format::disabled;
|
|
670
|
+
|
|
671
|
+
template <class _Tp>
|
|
672
|
+
constexpr bool ranges::enable_borrowed_range<optional<_Tp&>> = true;
|
|
673
|
+
|
|
674
|
+
# endif
|
|
675
|
+
|
|
570
676
|
# if _LIBCPP_STD_VER >= 20
|
|
571
677
|
|
|
572
678
|
template <class _Tp>
|
|
@@ -579,29 +685,150 @@ struct __is_std_optional : false_type {};
|
|
|
579
685
|
template <class _Tp>
|
|
580
686
|
struct __is_std_optional<optional<_Tp>> : true_type {};
|
|
581
687
|
|
|
688
|
+
template <class _Tp, class... _Args>
|
|
689
|
+
inline constexpr bool __is_constructible_for_optional_v = is_constructible_v<_Tp, _Args...>;
|
|
690
|
+
|
|
691
|
+
template <class _Tp, class... _Args>
|
|
692
|
+
struct __is_constructible_for_optional : bool_constant<__is_constructible_for_optional_v<_Tp, _Args...>> {};
|
|
693
|
+
|
|
694
|
+
template <class _Tp, class _Up, class... _Args>
|
|
695
|
+
inline constexpr bool __is_constructible_for_optional_initializer_list_v =
|
|
696
|
+
is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>;
|
|
697
|
+
|
|
698
|
+
# if _LIBCPP_STD_VER >= 26
|
|
699
|
+
template <class _Tp, class... _Args>
|
|
700
|
+
inline constexpr bool __is_constructible_for_optional_v<_Tp&, _Args...> = false;
|
|
701
|
+
template <class _Tp, class _Arg>
|
|
702
|
+
inline constexpr bool __is_constructible_for_optional_v<_Tp&, _Arg> =
|
|
703
|
+
is_constructible_v<_Tp&, _Arg> && !reference_constructs_from_temporary_v<_Tp&, _Arg>;
|
|
704
|
+
|
|
705
|
+
template <class _Tp, class _Up, class... _Args>
|
|
706
|
+
inline constexpr bool __is_constructible_for_optional_initializer_list_v<_Tp&, _Up, _Args...> = false;
|
|
707
|
+
# endif
|
|
708
|
+
|
|
709
|
+
template <class _Tp, class = void>
|
|
710
|
+
struct __optional_iterator {};
|
|
711
|
+
|
|
712
|
+
# if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPERIMENTAL_OPTIONAL_ITERATOR
|
|
713
|
+
|
|
714
|
+
template <class _Tp>
|
|
715
|
+
struct __optional_iterator<_Tp, enable_if_t<is_object_v<_Tp>>> {
|
|
716
|
+
private:
|
|
717
|
+
using __pointer _LIBCPP_NODEBUG = add_pointer_t<_Tp>;
|
|
718
|
+
using __const_pointer _LIBCPP_NODEBUG = add_pointer_t<const _Tp>;
|
|
719
|
+
|
|
720
|
+
public:
|
|
721
|
+
# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL
|
|
722
|
+
using iterator = __bounded_iter<__wrap_iter<__pointer>>;
|
|
723
|
+
using const_iterator = __bounded_iter<__wrap_iter<__const_pointer>>;
|
|
724
|
+
# else
|
|
725
|
+
using iterator = __wrap_iter<__pointer>;
|
|
726
|
+
using const_iterator = __wrap_iter<__const_pointer>;
|
|
727
|
+
# endif
|
|
728
|
+
|
|
729
|
+
// [optional.iterators], iterator support
|
|
730
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator begin() noexcept {
|
|
731
|
+
auto& __derived_self = static_cast<optional<_Tp>&>(*this);
|
|
732
|
+
auto* __ptr = std::addressof(__derived_self.__get());
|
|
733
|
+
|
|
734
|
+
# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL
|
|
735
|
+
return std::__make_bounded_iter(
|
|
736
|
+
__wrap_iter<__pointer>(__ptr),
|
|
737
|
+
__wrap_iter<__pointer>(__ptr),
|
|
738
|
+
__wrap_iter<__pointer>(__ptr) + (__derived_self.has_value() ? 1 : 0));
|
|
739
|
+
# else
|
|
740
|
+
return iterator(__ptr);
|
|
741
|
+
# endif
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const_iterator begin() const noexcept {
|
|
745
|
+
auto& __derived_self = static_cast<const optional<_Tp>&>(*this);
|
|
746
|
+
auto* __ptr = std::addressof(__derived_self.__get());
|
|
747
|
+
|
|
748
|
+
# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL
|
|
749
|
+
return std::__make_bounded_iter(
|
|
750
|
+
__wrap_iter<__const_pointer>(__ptr),
|
|
751
|
+
__wrap_iter<__const_pointer>(__ptr),
|
|
752
|
+
__wrap_iter<__const_pointer>(__ptr) + (__derived_self.has_value() ? 1 : 0));
|
|
753
|
+
# else
|
|
754
|
+
return const_iterator(__ptr);
|
|
755
|
+
# endif
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr iterator end() noexcept {
|
|
759
|
+
return begin() + (static_cast<optional<_Tp>&>(*this).has_value() ? 1 : 0);
|
|
760
|
+
}
|
|
761
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const_iterator end() const noexcept {
|
|
762
|
+
return begin() + (static_cast<const optional<_Tp>&>(*this).has_value() ? 1 : 0);
|
|
763
|
+
}
|
|
764
|
+
};
|
|
765
|
+
|
|
766
|
+
template <class _Tp>
|
|
767
|
+
struct __optional_iterator<_Tp&, enable_if_t<is_object_v<_Tp> && !__is_unbounded_array_v<_Tp> >> {
|
|
768
|
+
private:
|
|
769
|
+
using __pointer _LIBCPP_NODEBUG = add_pointer_t<_Tp>;
|
|
770
|
+
|
|
771
|
+
public:
|
|
772
|
+
# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL
|
|
773
|
+
using iterator = __bounded_iter<__wrap_iter<__pointer>>;
|
|
774
|
+
# else
|
|
775
|
+
using iterator = __wrap_iter<__pointer>;
|
|
776
|
+
# endif
|
|
777
|
+
|
|
778
|
+
// [optional.ref.iterators], iterator support
|
|
779
|
+
|
|
780
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto begin() const noexcept {
|
|
781
|
+
auto& __derived_self = static_cast<const optional<_Tp&>&>(*this);
|
|
782
|
+
auto* __ptr = __derived_self.has_value() ? std::addressof(__derived_self.__get()) : nullptr;
|
|
783
|
+
|
|
784
|
+
# ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_OPTIONAL
|
|
785
|
+
return std::__make_bounded_iter(
|
|
786
|
+
__wrap_iter<__pointer>(__ptr),
|
|
787
|
+
__wrap_iter<__pointer>(__ptr),
|
|
788
|
+
__wrap_iter<__pointer>(__ptr) + (__derived_self.has_value() ? 1 : 0));
|
|
789
|
+
# else
|
|
790
|
+
return iterator(__ptr);
|
|
791
|
+
# endif
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto end() const noexcept {
|
|
795
|
+
return begin() + (static_cast<const optional<_Tp&>&>(*this).has_value() ? 1 : 0);
|
|
796
|
+
}
|
|
797
|
+
};
|
|
798
|
+
|
|
799
|
+
# endif // _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPERIMENTAL_OPTIONAL_ITERATOR
|
|
800
|
+
|
|
582
801
|
template <class _Tp>
|
|
583
802
|
class _LIBCPP_DECLSPEC_EMPTY_BASES optional
|
|
584
803
|
: private __optional_move_assign_base<_Tp>,
|
|
585
804
|
private __optional_sfinae_ctor_base_t<_Tp>,
|
|
586
|
-
private __optional_sfinae_assign_base_t<_Tp
|
|
805
|
+
private __optional_sfinae_assign_base_t<_Tp>,
|
|
806
|
+
public __optional_iterator<_Tp> {
|
|
587
807
|
using __base _LIBCPP_NODEBUG = __optional_move_assign_base<_Tp>;
|
|
588
808
|
|
|
589
809
|
public:
|
|
590
|
-
using value_type = _Tp
|
|
810
|
+
using value_type = __libcpp_remove_reference_t<_Tp>;
|
|
591
811
|
|
|
592
812
|
using __trivially_relocatable _LIBCPP_NODEBUG =
|
|
593
813
|
conditional_t<__libcpp_is_trivially_relocatable<_Tp>::value, optional, void>;
|
|
594
|
-
using __replaceable _LIBCPP_NODEBUG = conditional_t<__is_replaceable_v<_Tp>, optional, void>;
|
|
595
814
|
|
|
596
815
|
private:
|
|
597
|
-
|
|
598
|
-
static_assert(!is_same_v<__remove_cvref_t<value_type>, in_place_t>,
|
|
816
|
+
static_assert(!is_same_v<__remove_cvref_t<_Tp>, in_place_t>,
|
|
599
817
|
"instantiation of optional with in_place_t is ill-formed");
|
|
600
|
-
static_assert(!is_same_v<__remove_cvref_t<
|
|
601
|
-
|
|
602
|
-
static_assert(!
|
|
603
|
-
|
|
604
|
-
static_assert(!
|
|
818
|
+
static_assert(!is_same_v<__remove_cvref_t<_Tp>, nullopt_t>, "instantiation of optional with nullopt_t is ill-formed");
|
|
819
|
+
# if _LIBCPP_STD_VER >= 26
|
|
820
|
+
static_assert(!is_rvalue_reference_v<_Tp>, "instantiation of optional with an rvalue reference type is ill-formed");
|
|
821
|
+
# else
|
|
822
|
+
static_assert(!is_reference_v<_Tp>, "instantiation of optional with a reference type is ill-formed");
|
|
823
|
+
# endif
|
|
824
|
+
static_assert(is_destructible_v<_Tp>, "instantiation of optional with a non-destructible type is ill-formed");
|
|
825
|
+
static_assert(!is_array_v<_Tp>, "instantiation of optional with an array type is ill-formed");
|
|
826
|
+
|
|
827
|
+
# if _LIBCPP_STD_VER >= 26
|
|
828
|
+
template <class _Up>
|
|
829
|
+
constexpr static bool __libcpp_opt_ref_ctor_deleted =
|
|
830
|
+
is_lvalue_reference_v<_Tp> && reference_constructs_from_temporary_v<_Tp, _Up>;
|
|
831
|
+
# endif
|
|
605
832
|
|
|
606
833
|
// LWG2756: conditionally explicit conversion from _Up
|
|
607
834
|
struct _CheckOptionalArgsConstructor {
|
|
@@ -674,45 +901,131 @@ public:
|
|
|
674
901
|
_LIBCPP_HIDE_FROM_ABI constexpr optional(optional&&) = default;
|
|
675
902
|
_LIBCPP_HIDE_FROM_ABI constexpr optional(nullopt_t) noexcept {}
|
|
676
903
|
|
|
677
|
-
template <
|
|
678
|
-
|
|
679
|
-
|
|
904
|
+
template <
|
|
905
|
+
class _InPlaceT,
|
|
906
|
+
class... _Args,
|
|
907
|
+
enable_if_t<_And<_IsSame<_InPlaceT, in_place_t>, __is_constructible_for_optional<_Tp, _Args...>>::value, int> = 0>
|
|
680
908
|
_LIBCPP_HIDE_FROM_ABI constexpr explicit optional(_InPlaceT, _Args&&... __args)
|
|
681
909
|
: __base(in_place, std::forward<_Args>(__args)...) {}
|
|
682
910
|
|
|
683
911
|
template <class _Up,
|
|
684
912
|
class... _Args,
|
|
685
|
-
enable_if_t<
|
|
913
|
+
enable_if_t<__is_constructible_for_optional_initializer_list_v<_Tp, _Up, _Args...>, int> = 0>
|
|
686
914
|
_LIBCPP_HIDE_FROM_ABI constexpr explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args)
|
|
687
915
|
: __base(in_place, __il, std::forward<_Args>(__args)...) {}
|
|
688
916
|
|
|
689
|
-
template <class _Up
|
|
690
|
-
|
|
691
|
-
|
|
917
|
+
template <class _Up = _Tp, enable_if_t<_CheckOptionalArgsCtor<_Up>::template __enable_implicit<_Up>(), int> = 0>
|
|
918
|
+
_LIBCPP_HIDE_FROM_ABI constexpr optional(_Up&& __v)
|
|
919
|
+
# if _LIBCPP_STD_VER >= 26
|
|
920
|
+
noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp&, _Up>)
|
|
921
|
+
# endif
|
|
922
|
+
: __base(in_place, std::forward<_Up>(__v)) {
|
|
923
|
+
}
|
|
692
924
|
|
|
693
|
-
template <class _Up
|
|
694
|
-
|
|
925
|
+
template <class _Up = remove_cv_t<_Tp>,
|
|
926
|
+
enable_if_t<_CheckOptionalArgsCtor<_Up>::template __enable_explicit<_Up>(), int> = 0>
|
|
927
|
+
_LIBCPP_HIDE_FROM_ABI constexpr explicit optional(_Up&& __v)
|
|
928
|
+
# if _LIBCPP_STD_VER >= 26
|
|
929
|
+
noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp&, _Up>)
|
|
930
|
+
# endif
|
|
931
|
+
: __base(in_place, std::forward<_Up>(__v)) {
|
|
932
|
+
}
|
|
695
933
|
|
|
696
934
|
// LWG2756: conditionally explicit conversion from const optional<_Up>&
|
|
697
935
|
template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_implicit<_Up>(), int> = 0>
|
|
698
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(const optional<_Up>& __v)
|
|
936
|
+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(const optional<_Up>& __v)
|
|
937
|
+
# if _LIBCPP_STD_VER >= 26
|
|
938
|
+
noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp&, _Up&>)
|
|
939
|
+
# endif
|
|
940
|
+
{
|
|
699
941
|
this->__construct_from(__v);
|
|
700
942
|
}
|
|
701
943
|
template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_explicit<_Up>(), int> = 0>
|
|
702
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(const optional<_Up>& __v)
|
|
944
|
+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(const optional<_Up>& __v)
|
|
945
|
+
# if _LIBCPP_STD_VER >= 26
|
|
946
|
+
noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp&, _Up&>)
|
|
947
|
+
# endif
|
|
948
|
+
{
|
|
703
949
|
this->__construct_from(__v);
|
|
704
950
|
}
|
|
705
951
|
|
|
706
952
|
// LWG2756: conditionally explicit conversion from optional<_Up>&&
|
|
707
953
|
template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_implicit<_Up>(), int> = 0>
|
|
708
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(optional<_Up>&& __v)
|
|
954
|
+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(optional<_Up>&& __v)
|
|
955
|
+
# if _LIBCPP_STD_VER >= 26
|
|
956
|
+
noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp&, _Up>)
|
|
957
|
+
# endif
|
|
958
|
+
{
|
|
709
959
|
this->__construct_from(std::move(__v));
|
|
710
960
|
}
|
|
711
961
|
template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_explicit<_Up>(), int> = 0>
|
|
712
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(optional<_Up>&& __v)
|
|
962
|
+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit optional(optional<_Up>&& __v)
|
|
963
|
+
# if _LIBCPP_STD_VER >= 26
|
|
964
|
+
noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp&, _Up>)
|
|
965
|
+
# endif
|
|
966
|
+
{
|
|
713
967
|
this->__construct_from(std::move(__v));
|
|
714
968
|
}
|
|
715
969
|
|
|
970
|
+
// deleted optional<T&> constructors and additional optional<T&> constructors
|
|
971
|
+
# if _LIBCPP_STD_VER >= 26
|
|
972
|
+
// optional(U&&)
|
|
973
|
+
template <class _Up = _Tp, enable_if_t<_CheckOptionalArgsCtor<_Up>::template __enable_implicit<_Up>(), int> = 0>
|
|
974
|
+
requires __libcpp_opt_ref_ctor_deleted<_Up>
|
|
975
|
+
optional(_Up&&) = delete;
|
|
976
|
+
|
|
977
|
+
template <class _Up = remove_cv_t<_Tp>,
|
|
978
|
+
enable_if_t<_CheckOptionalArgsCtor<_Up>::template __enable_explicit<_Up>(), int> = 0>
|
|
979
|
+
requires __libcpp_opt_ref_ctor_deleted<_Up>
|
|
980
|
+
explicit optional(_Up&&) = delete;
|
|
981
|
+
|
|
982
|
+
// optional(optional<U>& rhs)
|
|
983
|
+
template <class _Up>
|
|
984
|
+
requires(!__libcpp_opt_ref_ctor_deleted<_Up>) && (!is_same_v<remove_cvref_t<_Tp>, optional<_Up>>) &&
|
|
985
|
+
(!is_same_v<_Tp&, _Up>) && is_constructible_v<_Tp&, _Up&>
|
|
986
|
+
_LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_Up&, _Tp&>)
|
|
987
|
+
optional(optional<_Up>& __rhs) noexcept(is_nothrow_constructible_v<_Tp&, _Up&>) {
|
|
988
|
+
this->__construct_from(__rhs);
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
template <class _Up>
|
|
992
|
+
requires __libcpp_opt_ref_ctor_deleted<_Up> && (!is_same_v<remove_cvref_t<_Tp>, optional<_Up>>) &&
|
|
993
|
+
(!is_same_v<_Tp&, _Up>) && is_constructible_v<_Tp&, _Up&>
|
|
994
|
+
constexpr explicit optional(optional<_Up>& __rhs) noexcept = delete;
|
|
995
|
+
|
|
996
|
+
// optional(const optional<U>&)
|
|
997
|
+
template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_implicit<_Up>(), int> = 0>
|
|
998
|
+
requires __libcpp_opt_ref_ctor_deleted<_Up>
|
|
999
|
+
optional(const optional<_Up>&) = delete;
|
|
1000
|
+
|
|
1001
|
+
template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_explicit<_Up>(), int> = 0>
|
|
1002
|
+
requires __libcpp_opt_ref_ctor_deleted<_Up>
|
|
1003
|
+
explicit optional(const optional<_Up>&) = delete;
|
|
1004
|
+
|
|
1005
|
+
// optional(optional<U>&&)
|
|
1006
|
+
template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_implicit<_Up>(), int> = 0>
|
|
1007
|
+
requires __libcpp_opt_ref_ctor_deleted<_Up>
|
|
1008
|
+
optional(optional<_Up>&&) = delete;
|
|
1009
|
+
|
|
1010
|
+
template <class _Up, enable_if_t<_CheckOptionalLikeCtor<_Up, _Up&&>::template __enable_explicit<_Up>(), int> = 0>
|
|
1011
|
+
requires __libcpp_opt_ref_ctor_deleted<_Up>
|
|
1012
|
+
explicit optional(optional<_Up>&&) = delete;
|
|
1013
|
+
|
|
1014
|
+
// optional(const optional<U>&&)
|
|
1015
|
+
template <class _Up>
|
|
1016
|
+
requires(!__libcpp_opt_ref_ctor_deleted<_Up>) && (!is_same_v<remove_cvref_t<_Tp>, optional<_Up>>) &&
|
|
1017
|
+
(!is_same_v<_Tp&, _Up>) && is_constructible_v<_Tp&, _Up>
|
|
1018
|
+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(!is_convertible_v<const _Up, _Tp&>)
|
|
1019
|
+
optional(const optional<_Up>&& __v) noexcept(is_nothrow_constructible_v<_Tp&, const _Up>) {
|
|
1020
|
+
this->__construct_from(std::move(__v));
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
template <class _Up>
|
|
1024
|
+
requires __libcpp_opt_ref_ctor_deleted<_Up> && (!is_same_v<remove_cvref_t<_Tp>, optional<_Up>>) &&
|
|
1025
|
+
(!is_same_v<_Tp&, _Up>) && is_constructible_v<_Tp&, _Up>
|
|
1026
|
+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional(const optional<_Up>&& __v) noexcept = delete;
|
|
1027
|
+
# endif
|
|
1028
|
+
|
|
716
1029
|
# if _LIBCPP_STD_VER >= 23
|
|
717
1030
|
template <class _Tag,
|
|
718
1031
|
class _Fp,
|
|
@@ -731,11 +1044,12 @@ public:
|
|
|
731
1044
|
_LIBCPP_HIDE_FROM_ABI constexpr optional& operator=(optional&&) = default;
|
|
732
1045
|
|
|
733
1046
|
// LWG2756
|
|
734
|
-
template <class _Up =
|
|
1047
|
+
template <class _Up = remove_cv_t<_Tp>,
|
|
735
1048
|
enable_if_t<_And<_IsNotSame<__remove_cvref_t<_Up>, optional>,
|
|
736
|
-
_Or<_IsNotSame<__remove_cvref_t<_Up>,
|
|
737
|
-
is_constructible<
|
|
738
|
-
is_assignable<
|
|
1049
|
+
_Or<_IsNotSame<__remove_cvref_t<_Up>, _Tp>, _Not<is_scalar<_Tp>>>,
|
|
1050
|
+
is_constructible<_Tp, _Up>,
|
|
1051
|
+
is_assignable<_Tp&, _Up>,
|
|
1052
|
+
is_object<_Tp>>::value,
|
|
739
1053
|
int> = 0>
|
|
740
1054
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator=(_Up&& __v) {
|
|
741
1055
|
if (this->has_value())
|
|
@@ -759,8 +1073,12 @@ public:
|
|
|
759
1073
|
return *this;
|
|
760
1074
|
}
|
|
761
1075
|
|
|
762
|
-
template <class... _Args, enable_if_t<
|
|
763
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace(_Args&&... __args)
|
|
1076
|
+
template <class... _Args, enable_if_t<__is_constructible_for_optional_v<_Tp, _Args...>, int> = 0>
|
|
1077
|
+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace(_Args&&... __args)
|
|
1078
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1079
|
+
noexcept(is_lvalue_reference_v<_Tp> && is_nothrow_constructible_v<_Tp, _Args...>)
|
|
1080
|
+
# endif
|
|
1081
|
+
{
|
|
764
1082
|
reset();
|
|
765
1083
|
this->__construct(std::forward<_Args>(__args)...);
|
|
766
1084
|
return this->__get();
|
|
@@ -768,56 +1086,72 @@ public:
|
|
|
768
1086
|
|
|
769
1087
|
template <class _Up,
|
|
770
1088
|
class... _Args,
|
|
771
|
-
enable_if_t<
|
|
1089
|
+
enable_if_t<__is_constructible_for_optional_initializer_list_v<_Tp, _Up, _Args...>, int> = 0>
|
|
772
1090
|
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) {
|
|
773
1091
|
reset();
|
|
774
1092
|
this->__construct(__il, std::forward<_Args>(__args)...);
|
|
775
1093
|
return this->__get();
|
|
776
1094
|
}
|
|
777
1095
|
|
|
778
|
-
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
|
|
779
|
-
|
|
780
|
-
if
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
if (this->has_value()) {
|
|
786
|
-
__opt.__construct(std::move(this->__get()));
|
|
787
|
-
reset();
|
|
788
|
-
} else {
|
|
789
|
-
this->__construct(std::move(__opt.__get()));
|
|
790
|
-
__opt.reset();
|
|
791
|
-
}
|
|
792
|
-
}
|
|
1096
|
+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(optional& __opt) noexcept(
|
|
1097
|
+
(is_nothrow_move_constructible_v<_Tp> && is_nothrow_swappable_v<_Tp>)
|
|
1098
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1099
|
+
|| is_lvalue_reference_v<_Tp>
|
|
1100
|
+
# endif
|
|
1101
|
+
) {
|
|
1102
|
+
this->__swap(__opt);
|
|
793
1103
|
}
|
|
794
1104
|
|
|
795
|
-
_LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<
|
|
1105
|
+
_LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp const> operator->() const noexcept
|
|
1106
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1107
|
+
requires(is_object_v<_Tp>)
|
|
1108
|
+
# endif
|
|
1109
|
+
{
|
|
796
1110
|
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value");
|
|
797
1111
|
return std::addressof(this->__get());
|
|
798
1112
|
}
|
|
799
1113
|
|
|
800
|
-
_LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<
|
|
1114
|
+
_LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp> operator->() noexcept
|
|
1115
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1116
|
+
requires(is_object_v<_Tp>)
|
|
1117
|
+
# endif
|
|
1118
|
+
{
|
|
801
1119
|
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value");
|
|
802
1120
|
return std::addressof(this->__get());
|
|
803
1121
|
}
|
|
804
1122
|
|
|
805
|
-
_LIBCPP_HIDE_FROM_ABI constexpr const
|
|
1123
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator*() const& noexcept
|
|
1124
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1125
|
+
requires(is_object_v<_Tp>)
|
|
1126
|
+
# endif
|
|
1127
|
+
{
|
|
806
1128
|
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
|
|
807
1129
|
return this->__get();
|
|
808
1130
|
}
|
|
809
1131
|
|
|
810
|
-
_LIBCPP_HIDE_FROM_ABI constexpr
|
|
1132
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() & noexcept
|
|
1133
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1134
|
+
requires(is_object_v<_Tp>)
|
|
1135
|
+
# endif
|
|
1136
|
+
{
|
|
811
1137
|
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
|
|
812
1138
|
return this->__get();
|
|
813
1139
|
}
|
|
814
1140
|
|
|
815
|
-
_LIBCPP_HIDE_FROM_ABI constexpr
|
|
1141
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator*() && noexcept
|
|
1142
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1143
|
+
requires(is_object_v<_Tp>)
|
|
1144
|
+
# endif
|
|
1145
|
+
{
|
|
816
1146
|
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
|
|
817
1147
|
return std::move(this->__get());
|
|
818
1148
|
}
|
|
819
1149
|
|
|
820
|
-
_LIBCPP_HIDE_FROM_ABI constexpr const
|
|
1150
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& operator*() const&& noexcept
|
|
1151
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1152
|
+
requires(is_object_v<_Tp>)
|
|
1153
|
+
# endif
|
|
1154
|
+
{
|
|
821
1155
|
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
|
|
822
1156
|
return std::move(this->__get());
|
|
823
1157
|
}
|
|
@@ -827,48 +1161,73 @@ public:
|
|
|
827
1161
|
using __base::__get;
|
|
828
1162
|
using __base::has_value;
|
|
829
1163
|
|
|
830
|
-
_LIBCPP_HIDE_FROM_ABI constexpr
|
|
1164
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp const& value() const&
|
|
1165
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1166
|
+
requires(is_object_v<_Tp>)
|
|
1167
|
+
# endif
|
|
1168
|
+
{
|
|
831
1169
|
if (!this->has_value())
|
|
832
1170
|
std::__throw_bad_optional_access();
|
|
833
1171
|
return this->__get();
|
|
834
1172
|
}
|
|
835
1173
|
|
|
836
|
-
_LIBCPP_HIDE_FROM_ABI constexpr
|
|
1174
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& value() &
|
|
1175
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1176
|
+
requires(is_object_v<_Tp>)
|
|
1177
|
+
# endif
|
|
1178
|
+
{
|
|
837
1179
|
if (!this->has_value())
|
|
838
1180
|
std::__throw_bad_optional_access();
|
|
839
1181
|
return this->__get();
|
|
840
1182
|
}
|
|
841
1183
|
|
|
842
|
-
_LIBCPP_HIDE_FROM_ABI constexpr
|
|
1184
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& value() &&
|
|
1185
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1186
|
+
requires(is_object_v<_Tp>)
|
|
1187
|
+
# endif
|
|
1188
|
+
{
|
|
843
1189
|
if (!this->has_value())
|
|
844
1190
|
std::__throw_bad_optional_access();
|
|
845
1191
|
return std::move(this->__get());
|
|
846
1192
|
}
|
|
847
1193
|
|
|
848
|
-
_LIBCPP_HIDE_FROM_ABI constexpr
|
|
1194
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp const&& value() const&&
|
|
1195
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1196
|
+
requires(is_object_v<_Tp>)
|
|
1197
|
+
# endif
|
|
1198
|
+
{
|
|
849
1199
|
if (!this->has_value())
|
|
850
1200
|
std::__throw_bad_optional_access();
|
|
851
1201
|
return std::move(this->__get());
|
|
852
1202
|
}
|
|
853
1203
|
|
|
854
|
-
template <class _Up
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
1204
|
+
template <class _Up = remove_cv_t<_Tp>>
|
|
1205
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1206
|
+
requires(is_object_v<_Tp>)
|
|
1207
|
+
# endif
|
|
1208
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp value_or(_Up&& __v) const& {
|
|
1209
|
+
static_assert(is_copy_constructible_v<_Tp>, "optional<T>::value_or: T must be copy constructible");
|
|
1210
|
+
static_assert(is_convertible_v<_Up, _Tp>, "optional<T>::value_or: U must be convertible to T");
|
|
1211
|
+
return this->has_value() ? this->__get() : static_cast<_Tp>(std::forward<_Up>(__v));
|
|
859
1212
|
}
|
|
860
1213
|
|
|
861
|
-
template <class _Up
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
1214
|
+
template <class _Up = remove_cv_t<_Tp>>
|
|
1215
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1216
|
+
requires(is_object_v<_Tp>)
|
|
1217
|
+
# endif
|
|
1218
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp value_or(_Up&& __v) && {
|
|
1219
|
+
static_assert(is_move_constructible_v<_Tp>, "optional<T>::value_or: T must be move constructible");
|
|
1220
|
+
static_assert(is_convertible_v<_Up, _Tp>, "optional<T>::value_or: U must be convertible to T");
|
|
1221
|
+
return this->has_value() ? std::move(this->__get()) : static_cast<_Tp>(std::forward<_Up>(__v));
|
|
866
1222
|
}
|
|
867
1223
|
|
|
868
1224
|
# if _LIBCPP_STD_VER >= 23
|
|
869
1225
|
template <class _Func>
|
|
870
|
-
|
|
871
|
-
|
|
1226
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1227
|
+
requires(is_object_v<_Tp>)
|
|
1228
|
+
# endif
|
|
1229
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) & {
|
|
1230
|
+
using _Up = invoke_result_t<_Func, _Tp&>;
|
|
872
1231
|
static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
|
|
873
1232
|
"Result of f(value()) must be a specialization of std::optional");
|
|
874
1233
|
if (*this)
|
|
@@ -877,8 +1236,11 @@ public:
|
|
|
877
1236
|
}
|
|
878
1237
|
|
|
879
1238
|
template <class _Func>
|
|
880
|
-
|
|
881
|
-
|
|
1239
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1240
|
+
requires(is_object_v<_Tp>)
|
|
1241
|
+
# endif
|
|
1242
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const& {
|
|
1243
|
+
using _Up = invoke_result_t<_Func, const _Tp&>;
|
|
882
1244
|
static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
|
|
883
1245
|
"Result of f(value()) must be a specialization of std::optional");
|
|
884
1246
|
if (*this)
|
|
@@ -887,8 +1249,11 @@ public:
|
|
|
887
1249
|
}
|
|
888
1250
|
|
|
889
1251
|
template <class _Func>
|
|
890
|
-
|
|
891
|
-
|
|
1252
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1253
|
+
requires(is_object_v<_Tp>)
|
|
1254
|
+
# endif
|
|
1255
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) && {
|
|
1256
|
+
using _Up = invoke_result_t<_Func, _Tp&&>;
|
|
892
1257
|
static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
|
|
893
1258
|
"Result of f(std::move(value())) must be a specialization of std::optional");
|
|
894
1259
|
if (*this)
|
|
@@ -897,8 +1262,11 @@ public:
|
|
|
897
1262
|
}
|
|
898
1263
|
|
|
899
1264
|
template <class _Func>
|
|
900
|
-
|
|
901
|
-
|
|
1265
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1266
|
+
requires(is_object_v<_Tp>)
|
|
1267
|
+
# endif
|
|
1268
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const&& {
|
|
1269
|
+
using _Up = invoke_result_t<_Func, const _Tp&&>;
|
|
902
1270
|
static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
|
|
903
1271
|
"Result of f(std::move(value())) must be a specialization of std::optional");
|
|
904
1272
|
if (*this)
|
|
@@ -907,8 +1275,11 @@ public:
|
|
|
907
1275
|
}
|
|
908
1276
|
|
|
909
1277
|
template <class _Func>
|
|
910
|
-
|
|
911
|
-
|
|
1278
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1279
|
+
requires(is_object_v<_Tp>)
|
|
1280
|
+
# endif
|
|
1281
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) & {
|
|
1282
|
+
using _Up = remove_cv_t<invoke_result_t<_Func, _Tp&>>;
|
|
912
1283
|
static_assert(!is_array_v<_Up>, "Result of f(value()) should not be an Array");
|
|
913
1284
|
static_assert(!is_same_v<_Up, in_place_t>, "Result of f(value()) should not be std::in_place_t");
|
|
914
1285
|
static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(value()) should not be std::nullopt_t");
|
|
@@ -919,8 +1290,11 @@ public:
|
|
|
919
1290
|
}
|
|
920
1291
|
|
|
921
1292
|
template <class _Func>
|
|
922
|
-
|
|
923
|
-
|
|
1293
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1294
|
+
requires(is_object_v<_Tp>)
|
|
1295
|
+
# endif
|
|
1296
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) const& {
|
|
1297
|
+
using _Up = remove_cv_t<invoke_result_t<_Func, const _Tp&>>;
|
|
924
1298
|
static_assert(!is_array_v<_Up>, "Result of f(value()) should not be an Array");
|
|
925
1299
|
static_assert(!is_same_v<_Up, in_place_t>, "Result of f(value()) should not be std::in_place_t");
|
|
926
1300
|
static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(value()) should not be std::nullopt_t");
|
|
@@ -931,8 +1305,11 @@ public:
|
|
|
931
1305
|
}
|
|
932
1306
|
|
|
933
1307
|
template <class _Func>
|
|
934
|
-
|
|
935
|
-
|
|
1308
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1309
|
+
requires(is_object_v<_Tp>)
|
|
1310
|
+
# endif
|
|
1311
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) && {
|
|
1312
|
+
using _Up = remove_cv_t<invoke_result_t<_Func, _Tp&&>>;
|
|
936
1313
|
static_assert(!is_array_v<_Up>, "Result of f(std::move(value())) should not be an Array");
|
|
937
1314
|
static_assert(!is_same_v<_Up, in_place_t>, "Result of f(std::move(value())) should not be std::in_place_t");
|
|
938
1315
|
static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(std::move(value())) should not be std::nullopt_t");
|
|
@@ -943,8 +1320,11 @@ public:
|
|
|
943
1320
|
}
|
|
944
1321
|
|
|
945
1322
|
template <class _Func>
|
|
946
|
-
|
|
947
|
-
|
|
1323
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1324
|
+
requires(is_object_v<_Tp>)
|
|
1325
|
+
# endif
|
|
1326
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto transform(_Func&& __f) const&& {
|
|
1327
|
+
using _Up = remove_cv_t<invoke_result_t<_Func, const _Tp&&>>;
|
|
948
1328
|
static_assert(!is_array_v<_Up>, "Result of f(std::move(value())) should not be an Array");
|
|
949
1329
|
static_assert(!is_same_v<_Up, in_place_t>, "Result of f(std::move(value())) should not be std::in_place_t");
|
|
950
1330
|
static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(std::move(value())) should not be std::nullopt_t");
|
|
@@ -955,8 +1335,11 @@ public:
|
|
|
955
1335
|
}
|
|
956
1336
|
|
|
957
1337
|
template <invocable _Func>
|
|
958
|
-
_LIBCPP_HIDE_FROM_ABI constexpr optional or_else(_Func&& __f) const&
|
|
959
|
-
requires is_copy_constructible_v<
|
|
1338
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr optional or_else(_Func&& __f) const&
|
|
1339
|
+
requires is_copy_constructible_v<_Tp>
|
|
1340
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1341
|
+
&& (is_object_v<_Tp>)
|
|
1342
|
+
# endif
|
|
960
1343
|
{
|
|
961
1344
|
static_assert(is_same_v<remove_cvref_t<invoke_result_t<_Func>>, optional>,
|
|
962
1345
|
"Result of f() should be the same type as this optional");
|
|
@@ -966,8 +1349,11 @@ public:
|
|
|
966
1349
|
}
|
|
967
1350
|
|
|
968
1351
|
template <invocable _Func>
|
|
969
|
-
_LIBCPP_HIDE_FROM_ABI constexpr optional or_else(_Func&& __f) &&
|
|
970
|
-
requires is_move_constructible_v<
|
|
1352
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr optional or_else(_Func&& __f) &&
|
|
1353
|
+
requires is_move_constructible_v<_Tp>
|
|
1354
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1355
|
+
&& (is_object_v<_Tp>)
|
|
1356
|
+
# endif
|
|
971
1357
|
{
|
|
972
1358
|
static_assert(is_same_v<remove_cvref_t<invoke_result_t<_Func>>, optional>,
|
|
973
1359
|
"Result of f() should be the same type as this optional");
|
|
@@ -978,6 +1364,78 @@ public:
|
|
|
978
1364
|
# endif // _LIBCPP_STD_VER >= 23
|
|
979
1365
|
|
|
980
1366
|
using __base::reset;
|
|
1367
|
+
|
|
1368
|
+
// optional<T&> overloads
|
|
1369
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1370
|
+
|
|
1371
|
+
_LIBCPP_HIDE_FROM_ABI constexpr add_pointer_t<_Tp> operator->() const noexcept
|
|
1372
|
+
requires(is_lvalue_reference_v<_Tp>)
|
|
1373
|
+
{
|
|
1374
|
+
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator-> called on a disengaged value");
|
|
1375
|
+
return std::addressof(this->__get());
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() const noexcept
|
|
1379
|
+
requires(is_lvalue_reference_v<_Tp>)
|
|
1380
|
+
{
|
|
1381
|
+
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(this->has_value(), "optional operator* called on a disengaged value");
|
|
1382
|
+
return this->__get();
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& value() const
|
|
1386
|
+
requires(is_lvalue_reference_v<_Tp>)
|
|
1387
|
+
{
|
|
1388
|
+
if (!this->has_value())
|
|
1389
|
+
std::__throw_bad_optional_access();
|
|
1390
|
+
return this->__get();
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
template <class _Up = remove_cvref_t<_Tp>>
|
|
1394
|
+
requires(is_lvalue_reference_v<_Tp> && is_object_v<__libcpp_remove_reference_t<_Tp>> &&
|
|
1395
|
+
!is_array_v<__libcpp_remove_reference_t<_Tp>>)
|
|
1396
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decay_t<_Tp> value_or(_Up&& __v) const {
|
|
1397
|
+
static_assert(
|
|
1398
|
+
is_constructible_v<remove_cvref_t<_Tp>, _Tp&>, "optional<T&>::value_or: remove_cv_t<T> must be constructible");
|
|
1399
|
+
static_assert(
|
|
1400
|
+
is_convertible_v<_Up, remove_cvref_t<_Tp>>, "optional<T&>::value_or: U must be convertible to remove_cv_t<T>");
|
|
1401
|
+
return this->has_value() ? this->__get() : static_cast<remove_cvref_t<_Tp>>(std::forward<_Up>(__v));
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
template <class _Func>
|
|
1405
|
+
requires(is_lvalue_reference_v<_Tp>)
|
|
1406
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto and_then(_Func&& __f) const {
|
|
1407
|
+
using _Up = invoke_result_t<_Func, _Tp&>;
|
|
1408
|
+
static_assert(__is_std_optional<remove_cvref_t<_Up>>::value,
|
|
1409
|
+
"Result of f(value()) must be a specialization of std::optional");
|
|
1410
|
+
if (*this)
|
|
1411
|
+
return std::invoke(std::forward<_Func>(__f), value());
|
|
1412
|
+
return remove_cvref_t<_Up>();
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
template <class _Func>
|
|
1416
|
+
requires(is_lvalue_reference_v<_Tp>)
|
|
1417
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr optional<remove_cv_t<invoke_result_t<_Func, _Tp&>>>
|
|
1418
|
+
transform(_Func&& __f) const {
|
|
1419
|
+
using _Up = remove_cvref_t<invoke_result_t<_Func, _Tp&>>;
|
|
1420
|
+
static_assert(!is_array_v<_Up>, "Result of f(value()) should not be an Array");
|
|
1421
|
+
static_assert(!is_same_v<_Up, in_place_t>, "Result of f(value()) should not be std::in_place_t");
|
|
1422
|
+
static_assert(!is_same_v<_Up, nullopt_t>, "Result of f(value()) should not be std::nullopt_t");
|
|
1423
|
+
static_assert(is_object_v<_Up>, "Result of f(value()) should be an object type");
|
|
1424
|
+
if (*this)
|
|
1425
|
+
return optional<_Up>(__optional_construct_from_invoke_tag{}, std::forward<_Func>(__f), value());
|
|
1426
|
+
return optional<_Up>();
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
template <invocable _Func>
|
|
1430
|
+
requires(is_lvalue_reference_v<_Tp>)
|
|
1431
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr optional or_else(_Func&& __f) const {
|
|
1432
|
+
static_assert(is_same_v<remove_cvref_t<invoke_result_t<_Func>>, optional>,
|
|
1433
|
+
"Result of f() should be the same type as this optional");
|
|
1434
|
+
if (*this)
|
|
1435
|
+
return *this;
|
|
1436
|
+
return std::forward<_Func>(__f)();
|
|
1437
|
+
}
|
|
1438
|
+
# endif
|
|
981
1439
|
};
|
|
982
1440
|
|
|
983
1441
|
template <class _Tp>
|
|
@@ -1154,7 +1612,9 @@ template <
|
|
|
1154
1612
|
enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() == std::declval<const _Up&>()), bool>,
|
|
1155
1613
|
int> = 0>
|
|
1156
1614
|
_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const optional<_Tp>& __x, const _Up& __v) {
|
|
1157
|
-
|
|
1615
|
+
if (__x.has_value())
|
|
1616
|
+
return *__x == __v;
|
|
1617
|
+
return false;
|
|
1158
1618
|
}
|
|
1159
1619
|
|
|
1160
1620
|
template <
|
|
@@ -1163,7 +1623,9 @@ template <
|
|
|
1163
1623
|
enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() == std::declval<const _Up&>()), bool>,
|
|
1164
1624
|
int> = 0>
|
|
1165
1625
|
_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const _Tp& __v, const optional<_Up>& __x) {
|
|
1166
|
-
|
|
1626
|
+
if (__x.has_value())
|
|
1627
|
+
return __v == *__x;
|
|
1628
|
+
return false;
|
|
1167
1629
|
}
|
|
1168
1630
|
|
|
1169
1631
|
template <
|
|
@@ -1172,7 +1634,9 @@ template <
|
|
|
1172
1634
|
enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() != std::declval<const _Up&>()), bool>,
|
|
1173
1635
|
int> = 0>
|
|
1174
1636
|
_LIBCPP_HIDE_FROM_ABI constexpr bool operator!=(const optional<_Tp>& __x, const _Up& __v) {
|
|
1175
|
-
|
|
1637
|
+
if (__x.has_value())
|
|
1638
|
+
return *__x != __v;
|
|
1639
|
+
return true;
|
|
1176
1640
|
}
|
|
1177
1641
|
|
|
1178
1642
|
template <
|
|
@@ -1181,7 +1645,9 @@ template <
|
|
|
1181
1645
|
enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() != std::declval<const _Up&>()), bool>,
|
|
1182
1646
|
int> = 0>
|
|
1183
1647
|
_LIBCPP_HIDE_FROM_ABI constexpr bool operator!=(const _Tp& __v, const optional<_Up>& __x) {
|
|
1184
|
-
|
|
1648
|
+
if (__x.has_value())
|
|
1649
|
+
return __v != *__x;
|
|
1650
|
+
return true;
|
|
1185
1651
|
}
|
|
1186
1652
|
|
|
1187
1653
|
template < class _Tp,
|
|
@@ -1189,7 +1655,9 @@ template < class _Tp,
|
|
|
1189
1655
|
enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() < std::declval<const _Up&>()), bool>,
|
|
1190
1656
|
int> = 0>
|
|
1191
1657
|
_LIBCPP_HIDE_FROM_ABI constexpr bool operator<(const optional<_Tp>& __x, const _Up& __v) {
|
|
1192
|
-
|
|
1658
|
+
if (__x.has_value())
|
|
1659
|
+
return *__x < __v;
|
|
1660
|
+
return true;
|
|
1193
1661
|
}
|
|
1194
1662
|
|
|
1195
1663
|
template < class _Tp,
|
|
@@ -1197,7 +1665,9 @@ template < class _Tp,
|
|
|
1197
1665
|
enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() < std::declval<const _Up&>()), bool>,
|
|
1198
1666
|
int> = 0>
|
|
1199
1667
|
_LIBCPP_HIDE_FROM_ABI constexpr bool operator<(const _Tp& __v, const optional<_Up>& __x) {
|
|
1200
|
-
|
|
1668
|
+
if (__x.has_value())
|
|
1669
|
+
return __v < *__x;
|
|
1670
|
+
return false;
|
|
1201
1671
|
}
|
|
1202
1672
|
|
|
1203
1673
|
template <
|
|
@@ -1206,7 +1676,9 @@ template <
|
|
|
1206
1676
|
enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() <= std::declval<const _Up&>()), bool>,
|
|
1207
1677
|
int> = 0>
|
|
1208
1678
|
_LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(const optional<_Tp>& __x, const _Up& __v) {
|
|
1209
|
-
|
|
1679
|
+
if (__x.has_value())
|
|
1680
|
+
return *__x <= __v;
|
|
1681
|
+
return true;
|
|
1210
1682
|
}
|
|
1211
1683
|
|
|
1212
1684
|
template <
|
|
@@ -1215,7 +1687,9 @@ template <
|
|
|
1215
1687
|
enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() <= std::declval<const _Up&>()), bool>,
|
|
1216
1688
|
int> = 0>
|
|
1217
1689
|
_LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(const _Tp& __v, const optional<_Up>& __x) {
|
|
1218
|
-
|
|
1690
|
+
if (__x.has_value())
|
|
1691
|
+
return __v <= *__x;
|
|
1692
|
+
return false;
|
|
1219
1693
|
}
|
|
1220
1694
|
|
|
1221
1695
|
template < class _Tp,
|
|
@@ -1223,7 +1697,9 @@ template < class _Tp,
|
|
|
1223
1697
|
enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() > std::declval<const _Up&>()), bool>,
|
|
1224
1698
|
int> = 0>
|
|
1225
1699
|
_LIBCPP_HIDE_FROM_ABI constexpr bool operator>(const optional<_Tp>& __x, const _Up& __v) {
|
|
1226
|
-
|
|
1700
|
+
if (__x.has_value())
|
|
1701
|
+
return *__x > __v;
|
|
1702
|
+
return false;
|
|
1227
1703
|
}
|
|
1228
1704
|
|
|
1229
1705
|
template < class _Tp,
|
|
@@ -1231,7 +1707,9 @@ template < class _Tp,
|
|
|
1231
1707
|
enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() > std::declval<const _Up&>()), bool>,
|
|
1232
1708
|
int> = 0>
|
|
1233
1709
|
_LIBCPP_HIDE_FROM_ABI constexpr bool operator>(const _Tp& __v, const optional<_Up>& __x) {
|
|
1234
|
-
|
|
1710
|
+
if (__x.has_value())
|
|
1711
|
+
return __v > *__x;
|
|
1712
|
+
return true;
|
|
1235
1713
|
}
|
|
1236
1714
|
|
|
1237
1715
|
template <
|
|
@@ -1240,7 +1718,9 @@ template <
|
|
|
1240
1718
|
enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() >= std::declval<const _Up&>()), bool>,
|
|
1241
1719
|
int> = 0>
|
|
1242
1720
|
_LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(const optional<_Tp>& __x, const _Up& __v) {
|
|
1243
|
-
|
|
1721
|
+
if (__x.has_value())
|
|
1722
|
+
return *__x >= __v;
|
|
1723
|
+
return false;
|
|
1244
1724
|
}
|
|
1245
1725
|
|
|
1246
1726
|
template <
|
|
@@ -1249,7 +1729,9 @@ template <
|
|
|
1249
1729
|
enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() >= std::declval<const _Up&>()), bool>,
|
|
1250
1730
|
int> = 0>
|
|
1251
1731
|
_LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(const _Tp& __v, const optional<_Up>& __x) {
|
|
1252
|
-
|
|
1732
|
+
if (__x.has_value())
|
|
1733
|
+
return __v >= *__x;
|
|
1734
|
+
return true;
|
|
1253
1735
|
}
|
|
1254
1736
|
|
|
1255
1737
|
# if _LIBCPP_STD_VER >= 20
|
|
@@ -1264,23 +1746,36 @@ operator<=>(const optional<_Tp>& __x, const _Up& __v) {
|
|
|
1264
1746
|
# endif // _LIBCPP_STD_VER >= 20
|
|
1265
1747
|
|
|
1266
1748
|
template <class _Tp, enable_if_t< is_move_constructible_v<_Tp> && is_swappable_v<_Tp>, int> = 0>
|
|
1267
|
-
inline _LIBCPP_HIDE_FROM_ABI
|
|
1268
|
-
swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y))) {
|
|
1749
|
+
inline _LIBCPP_HIDE_FROM_ABI
|
|
1750
|
+
_LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y))) {
|
|
1269
1751
|
__x.swap(__y);
|
|
1270
1752
|
}
|
|
1271
1753
|
|
|
1272
|
-
|
|
1273
|
-
|
|
1754
|
+
struct __make_optional_barrier_tag {
|
|
1755
|
+
explicit __make_optional_barrier_tag() = default;
|
|
1756
|
+
};
|
|
1757
|
+
|
|
1758
|
+
template <
|
|
1759
|
+
# if _LIBCPP_STD_VER >= 26
|
|
1760
|
+
__make_optional_barrier_tag = __make_optional_barrier_tag{},
|
|
1761
|
+
# endif
|
|
1762
|
+
class _Tp,
|
|
1763
|
+
enable_if_t<is_constructible_v<decay_t<_Tp>, _Tp>, int> = 0>
|
|
1764
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr optional<decay_t<_Tp>> make_optional(_Tp&& __v) {
|
|
1274
1765
|
return optional<decay_t<_Tp>>(std::forward<_Tp>(__v));
|
|
1275
1766
|
}
|
|
1276
1767
|
|
|
1277
|
-
template <class _Tp, class... _Args>
|
|
1278
|
-
_LIBCPP_HIDE_FROM_ABI constexpr optional<_Tp> make_optional(_Args&&... __args) {
|
|
1768
|
+
template <class _Tp, class... _Args, enable_if_t<__is_constructible_for_optional_v<_Tp, _Args...>, int> = 0>
|
|
1769
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr optional<_Tp> make_optional(_Args&&... __args) {
|
|
1279
1770
|
return optional<_Tp>(in_place, std::forward<_Args>(__args)...);
|
|
1280
1771
|
}
|
|
1281
1772
|
|
|
1282
|
-
template <class _Tp,
|
|
1283
|
-
|
|
1773
|
+
template <class _Tp,
|
|
1774
|
+
class _Up,
|
|
1775
|
+
class... _Args,
|
|
1776
|
+
enable_if_t<__is_constructible_for_optional_initializer_list_v<_Tp, _Up, _Args...>, int> = 0>
|
|
1777
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr optional<_Tp>
|
|
1778
|
+
make_optional(initializer_list<_Up> __il, _Args&&... __args) {
|
|
1284
1779
|
return optional<_Tp>(in_place, __il, std::forward<_Args>(__args)...);
|
|
1285
1780
|
}
|
|
1286
1781
|
|
|
@@ -1291,7 +1786,7 @@ struct hash< __enable_hash_helper<optional<_Tp>, remove_const_t<_Tp>> > {
|
|
|
1291
1786
|
_LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type;
|
|
1292
1787
|
# endif
|
|
1293
1788
|
|
|
1294
|
-
_LIBCPP_HIDE_FROM_ABI size_t operator()(const optional<_Tp>& __opt) const {
|
|
1789
|
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI size_t operator()(const optional<_Tp>& __opt) const {
|
|
1295
1790
|
return static_cast<bool>(__opt) ? hash<remove_const_t<_Tp>>()(*__opt) : 0;
|
|
1296
1791
|
}
|
|
1297
1792
|
};
|