Thanks for using Compiler Explorer
Sponsors
Jakt
C++
Ada
Algol68
Analysis
Android Java
Android Kotlin
Assembly
C
C3
Carbon
C with Coccinelle
C++ with Coccinelle
C++ (Circle)
CIRCT
Clean
CMake
CMakeScript
COBOL
C++ for OpenCL
MLIR
Cppx
Cppx-Blue
Cppx-Gold
Cpp2-cppfront
Crystal
C#
CUDA C++
D
Dart
Elixir
Erlang
Fortran
F#
GLSL
Go
Haskell
HLSL
Hook
Hylo
IL
ispc
Java
Julia
Kotlin
LLVM IR
LLVM MIR
Modula-2
Mojo
Nim
Numba
Nix
Objective-C
Objective-C++
OCaml
Odin
OpenCL C
Pascal
Pony
PTX
Python
Racket
Raku
Ruby
Rust
Sail
Snowball
Scala
Slang
Solidity
Spice
SPIR-V
Swift
LLVM TableGen
Toit
Triton
TypeScript Native
V
Vala
Visual Basic
Vyper
WASM
Zig
Javascript
GIMPLE
Ygen
sway
c++ source #1
Output
Compile to binary object
Link to binary
Execute the code
Intel asm syntax
Demangle identifiers
Verbose demangling
Filters
Unused labels
Library functions
Directives
Comments
Horizontal whitespace
Debug intrinsics
Compiler
6502-c++ 11.1.0
ARM GCC 10.2.0
ARM GCC 10.3.0
ARM GCC 10.4.0
ARM GCC 10.5.0
ARM GCC 11.1.0
ARM GCC 11.2.0
ARM GCC 11.3.0
ARM GCC 11.4.0
ARM GCC 12.1.0
ARM GCC 12.2.0
ARM GCC 12.3.0
ARM GCC 12.4.0
ARM GCC 12.5.0
ARM GCC 13.1.0
ARM GCC 13.2.0
ARM GCC 13.2.0 (unknown-eabi)
ARM GCC 13.3.0
ARM GCC 13.3.0 (unknown-eabi)
ARM GCC 13.4.0
ARM GCC 13.4.0 (unknown-eabi)
ARM GCC 14.1.0
ARM GCC 14.1.0 (unknown-eabi)
ARM GCC 14.2.0
ARM GCC 14.2.0 (unknown-eabi)
ARM GCC 14.3.0
ARM GCC 14.3.0 (unknown-eabi)
ARM GCC 15.1.0
ARM GCC 15.1.0 (unknown-eabi)
ARM GCC 15.2.0
ARM GCC 15.2.0 (unknown-eabi)
ARM GCC 4.5.4
ARM GCC 4.6.4
ARM GCC 5.4
ARM GCC 6.3.0
ARM GCC 6.4.0
ARM GCC 7.3.0
ARM GCC 7.5.0
ARM GCC 8.2.0
ARM GCC 8.5.0
ARM GCC 9.3.0
ARM GCC 9.4.0
ARM GCC 9.5.0
ARM GCC trunk
ARM gcc 10.2.1 (none)
ARM gcc 10.3.1 (2021.07 none)
ARM gcc 10.3.1 (2021.10 none)
ARM gcc 11.2.1 (none)
ARM gcc 5.4.1 (none)
ARM gcc 7.2.1 (none)
ARM gcc 8.2 (WinCE)
ARM gcc 8.3.1 (none)
ARM gcc 9.2.1 (none)
ARM msvc v19.0 (ex-WINE)
ARM msvc v19.10 (ex-WINE)
ARM msvc v19.14 (ex-WINE)
ARM64 Morello gcc 10.1 Alpha 2
ARM64 gcc 10.2
ARM64 gcc 10.3
ARM64 gcc 10.4
ARM64 gcc 10.5.0
ARM64 gcc 11.1
ARM64 gcc 11.2
ARM64 gcc 11.3
ARM64 gcc 11.4.0
ARM64 gcc 12.1
ARM64 gcc 12.2.0
ARM64 gcc 12.3.0
ARM64 gcc 12.4.0
ARM64 gcc 12.5.0
ARM64 gcc 13.1.0
ARM64 gcc 13.2.0
ARM64 gcc 13.3.0
ARM64 gcc 13.4.0
ARM64 gcc 14.1.0
ARM64 gcc 14.2.0
ARM64 gcc 14.3.0
ARM64 gcc 15.1.0
ARM64 gcc 15.2.0
ARM64 gcc 4.9.4
ARM64 gcc 5.4
ARM64 gcc 5.5.0
ARM64 gcc 6.3
ARM64 gcc 6.4
ARM64 gcc 7.3
ARM64 gcc 7.5
ARM64 gcc 8.2
ARM64 gcc 8.5
ARM64 gcc 9.3
ARM64 gcc 9.4
ARM64 gcc 9.5
ARM64 gcc trunk
ARM64 msvc v19.14 (ex-WINE)
AVR gcc 10.3.0
AVR gcc 11.1.0
AVR gcc 12.1.0
AVR gcc 12.2.0
AVR gcc 12.3.0
AVR gcc 12.4.0
AVR gcc 12.5.0
AVR gcc 13.1.0
AVR gcc 13.2.0
AVR gcc 13.3.0
AVR gcc 13.4.0
AVR gcc 14.1.0
AVR gcc 14.2.0
AVR gcc 14.3.0
AVR gcc 15.1.0
AVR gcc 15.2.0
AVR gcc 4.5.4
AVR gcc 4.6.4
AVR gcc 5.4.0
AVR gcc 9.2.0
AVR gcc 9.3.0
Arduino Mega (1.8.9)
Arduino Uno (1.8.9)
BPF clang (trunk)
BPF clang 13.0.0
BPF clang 14.0.0
BPF clang 15.0.0
BPF clang 16.0.0
BPF clang 17.0.1
BPF clang 18.1.0
BPF clang 19.1.0
BPF clang 20.1.0
EDG (experimental reflection)
EDG 6.5
EDG 6.5 (GNU mode gcc 13)
EDG 6.6
EDG 6.6 (GNU mode gcc 13)
EDG 6.7
EDG 6.7 (GNU mode gcc 14)
FRC 2019
FRC 2020
FRC 2023
HPPA gcc 14.2.0
HPPA gcc 14.3.0
HPPA gcc 15.1.0
HPPA gcc 15.2.0
KVX ACB 4.1.0 (GCC 7.5.0)
KVX ACB 4.1.0-cd1 (GCC 7.5.0)
KVX ACB 4.10.0 (GCC 10.3.1)
KVX ACB 4.11.1 (GCC 10.3.1)
KVX ACB 4.12.0 (GCC 11.3.0)
KVX ACB 4.2.0 (GCC 7.5.0)
KVX ACB 4.3.0 (GCC 7.5.0)
KVX ACB 4.4.0 (GCC 7.5.0)
KVX ACB 4.6.0 (GCC 9.4.1)
KVX ACB 4.8.0 (GCC 9.4.1)
KVX ACB 4.9.0 (GCC 9.4.1)
KVX ACB 5.0.0 (GCC 12.2.1)
KVX ACB 5.2.0 (GCC 13.2.1)
LoongArch64 clang (trunk)
LoongArch64 clang 17.0.1
LoongArch64 clang 18.1.0
LoongArch64 clang 19.1.0
LoongArch64 clang 20.1.0
M68K gcc 13.1.0
M68K gcc 13.2.0
M68K gcc 13.3.0
M68K gcc 13.4.0
M68K gcc 14.1.0
M68K gcc 14.2.0
M68K gcc 14.3.0
M68K gcc 15.1.0
M68K gcc 15.2.0
M68k clang (trunk)
MRISC32 gcc (trunk)
MSP430 gcc 4.5.3
MSP430 gcc 5.3.0
MSP430 gcc 6.2.1
MinGW clang 14.0.3
MinGW clang 14.0.6
MinGW clang 15.0.7
MinGW clang 16.0.0
MinGW clang 16.0.2
MinGW gcc 11.3.0
MinGW gcc 12.1.0
MinGW gcc 12.2.0
MinGW gcc 13.1.0
RISC-V (32-bits) gcc (trunk)
RISC-V (32-bits) gcc 10.2.0
RISC-V (32-bits) gcc 10.3.0
RISC-V (32-bits) gcc 11.2.0
RISC-V (32-bits) gcc 11.3.0
RISC-V (32-bits) gcc 11.4.0
RISC-V (32-bits) gcc 12.1.0
RISC-V (32-bits) gcc 12.2.0
RISC-V (32-bits) gcc 12.3.0
RISC-V (32-bits) gcc 12.4.0
RISC-V (32-bits) gcc 12.5.0
RISC-V (32-bits) gcc 13.1.0
RISC-V (32-bits) gcc 13.2.0
RISC-V (32-bits) gcc 13.3.0
RISC-V (32-bits) gcc 13.4.0
RISC-V (32-bits) gcc 14.1.0
RISC-V (32-bits) gcc 14.2.0
RISC-V (32-bits) gcc 14.3.0
RISC-V (32-bits) gcc 15.1.0
RISC-V (32-bits) gcc 15.2.0
RISC-V (32-bits) gcc 8.2.0
RISC-V (32-bits) gcc 8.5.0
RISC-V (32-bits) gcc 9.4.0
RISC-V (64-bits) gcc (trunk)
RISC-V (64-bits) gcc 10.2.0
RISC-V (64-bits) gcc 10.3.0
RISC-V (64-bits) gcc 11.2.0
RISC-V (64-bits) gcc 11.3.0
RISC-V (64-bits) gcc 11.4.0
RISC-V (64-bits) gcc 12.1.0
RISC-V (64-bits) gcc 12.2.0
RISC-V (64-bits) gcc 12.3.0
RISC-V (64-bits) gcc 12.4.0
RISC-V (64-bits) gcc 12.5.0
RISC-V (64-bits) gcc 13.1.0
RISC-V (64-bits) gcc 13.2.0
RISC-V (64-bits) gcc 13.3.0
RISC-V (64-bits) gcc 13.4.0
RISC-V (64-bits) gcc 14.1.0
RISC-V (64-bits) gcc 14.2.0
RISC-V (64-bits) gcc 14.3.0
RISC-V (64-bits) gcc 15.1.0
RISC-V (64-bits) gcc 15.2.0
RISC-V (64-bits) gcc 8.2.0
RISC-V (64-bits) gcc 8.5.0
RISC-V (64-bits) gcc 9.4.0
RISC-V rv32gc clang (trunk)
RISC-V rv32gc clang 10.0.0
RISC-V rv32gc clang 10.0.1
RISC-V rv32gc clang 11.0.0
RISC-V rv32gc clang 11.0.1
RISC-V rv32gc clang 12.0.0
RISC-V rv32gc clang 12.0.1
RISC-V rv32gc clang 13.0.0
RISC-V rv32gc clang 13.0.1
RISC-V rv32gc clang 14.0.0
RISC-V rv32gc clang 15.0.0
RISC-V rv32gc clang 16.0.0
RISC-V rv32gc clang 17.0.1
RISC-V rv32gc clang 18.1.0
RISC-V rv32gc clang 19.1.0
RISC-V rv32gc clang 20.1.0
RISC-V rv32gc clang 9.0.0
RISC-V rv32gc clang 9.0.1
RISC-V rv64gc clang (trunk)
RISC-V rv64gc clang 10.0.0
RISC-V rv64gc clang 10.0.1
RISC-V rv64gc clang 11.0.0
RISC-V rv64gc clang 11.0.1
RISC-V rv64gc clang 12.0.0
RISC-V rv64gc clang 12.0.1
RISC-V rv64gc clang 13.0.0
RISC-V rv64gc clang 13.0.1
RISC-V rv64gc clang 14.0.0
RISC-V rv64gc clang 15.0.0
RISC-V rv64gc clang 16.0.0
RISC-V rv64gc clang 17.0.1
RISC-V rv64gc clang 18.1.0
RISC-V rv64gc clang 19.1.0
RISC-V rv64gc clang 20.1.0
RISC-V rv64gc clang 9.0.0
RISC-V rv64gc clang 9.0.1
Raspbian Buster
Raspbian Stretch
SPARC LEON gcc 12.2.0
SPARC LEON gcc 12.3.0
SPARC LEON gcc 12.4.0
SPARC LEON gcc 12.5.0
SPARC LEON gcc 13.1.0
SPARC LEON gcc 13.2.0
SPARC LEON gcc 13.3.0
SPARC LEON gcc 13.4.0
SPARC LEON gcc 14.1.0
SPARC LEON gcc 14.2.0
SPARC LEON gcc 14.3.0
SPARC LEON gcc 15.1.0
SPARC LEON gcc 15.2.0
SPARC gcc 12.2.0
SPARC gcc 12.3.0
SPARC gcc 12.4.0
SPARC gcc 12.5.0
SPARC gcc 13.1.0
SPARC gcc 13.2.0
SPARC gcc 13.3.0
SPARC gcc 13.4.0
SPARC gcc 14.1.0
SPARC gcc 14.2.0
SPARC gcc 14.3.0
SPARC gcc 15.1.0
SPARC gcc 15.2.0
SPARC64 gcc 12.2.0
SPARC64 gcc 12.3.0
SPARC64 gcc 12.4.0
SPARC64 gcc 12.5.0
SPARC64 gcc 13.1.0
SPARC64 gcc 13.2.0
SPARC64 gcc 13.3.0
SPARC64 gcc 13.4.0
SPARC64 gcc 14.1.0
SPARC64 gcc 14.2.0
SPARC64 gcc 14.3.0
SPARC64 gcc 15.1.0
SPARC64 gcc 15.2.0
TI C6x gcc 12.2.0
TI C6x gcc 12.3.0
TI C6x gcc 12.4.0
TI C6x gcc 12.5.0
TI C6x gcc 13.1.0
TI C6x gcc 13.2.0
TI C6x gcc 13.3.0
TI C6x gcc 13.4.0
TI C6x gcc 14.1.0
TI C6x gcc 14.2.0
TI C6x gcc 14.3.0
TI C6x gcc 15.1.0
TI C6x gcc 15.2.0
TI CL430 21.6.1
Tricore gcc 11.3.0 (EEESlab)
VAX gcc NetBSDELF 10.4.0
VAX gcc NetBSDELF 10.5.0 (Nov 15 03:50:22 2023)
VAX gcc NetBSDELF 12.4.0 (Apr 16 05:27 2025)
WebAssembly clang (trunk)
Xtensa ESP32 gcc 11.2.0 (2022r1)
Xtensa ESP32 gcc 12.2.0 (20230208)
Xtensa ESP32 gcc 14.2.0 (20241119)
Xtensa ESP32 gcc 8.2.0 (2019r2)
Xtensa ESP32 gcc 8.2.0 (2020r1)
Xtensa ESP32 gcc 8.2.0 (2020r2)
Xtensa ESP32 gcc 8.4.0 (2020r3)
Xtensa ESP32 gcc 8.4.0 (2021r1)
Xtensa ESP32 gcc 8.4.0 (2021r2)
Xtensa ESP32-S2 gcc 11.2.0 (2022r1)
Xtensa ESP32-S2 gcc 12.2.0 (20230208)
Xtensa ESP32-S2 gcc 14.2.0 (20241119)
Xtensa ESP32-S2 gcc 8.2.0 (2019r2)
Xtensa ESP32-S2 gcc 8.2.0 (2020r1)
Xtensa ESP32-S2 gcc 8.2.0 (2020r2)
Xtensa ESP32-S2 gcc 8.4.0 (2020r3)
Xtensa ESP32-S2 gcc 8.4.0 (2021r1)
Xtensa ESP32-S2 gcc 8.4.0 (2021r2)
Xtensa ESP32-S3 gcc 11.2.0 (2022r1)
Xtensa ESP32-S3 gcc 12.2.0 (20230208)
Xtensa ESP32-S3 gcc 14.2.0 (20241119)
Xtensa ESP32-S3 gcc 8.4.0 (2020r3)
Xtensa ESP32-S3 gcc 8.4.0 (2021r1)
Xtensa ESP32-S3 gcc 8.4.0 (2021r2)
arm64 msvc v19.20 VS16.0
arm64 msvc v19.21 VS16.1
arm64 msvc v19.22 VS16.2
arm64 msvc v19.23 VS16.3
arm64 msvc v19.24 VS16.4
arm64 msvc v19.25 VS16.5
arm64 msvc v19.27 VS16.7
arm64 msvc v19.28 VS16.8
arm64 msvc v19.28 VS16.9
arm64 msvc v19.29 VS16.10
arm64 msvc v19.29 VS16.11
arm64 msvc v19.30 VS17.0
arm64 msvc v19.31 VS17.1
arm64 msvc v19.32 VS17.2
arm64 msvc v19.33 VS17.3
arm64 msvc v19.34 VS17.4
arm64 msvc v19.35 VS17.5
arm64 msvc v19.36 VS17.6
arm64 msvc v19.37 VS17.7
arm64 msvc v19.38 VS17.8
arm64 msvc v19.39 VS17.9
arm64 msvc v19.40 VS17.10
arm64 msvc v19.41 VS17.11
arm64 msvc v19.42 VS17.12
arm64 msvc v19.43 VS17.13
arm64 msvc v19.latest
armv7-a clang (trunk)
armv7-a clang 10.0.0
armv7-a clang 10.0.1
armv7-a clang 11.0.0
armv7-a clang 11.0.1
armv7-a clang 12.0.0
armv7-a clang 12.0.1
armv7-a clang 13.0.0
armv7-a clang 13.0.1
armv7-a clang 14.0.0
armv7-a clang 15.0.0
armv7-a clang 16.0.0
armv7-a clang 17.0.1
armv7-a clang 18.1.0
armv7-a clang 19.1.0
armv7-a clang 20.1.0
armv7-a clang 9.0.0
armv7-a clang 9.0.1
armv8-a clang (all architectural features, trunk)
armv8-a clang (trunk)
armv8-a clang 10.0.0
armv8-a clang 10.0.1
armv8-a clang 11.0.0
armv8-a clang 11.0.1
armv8-a clang 12.0.0
armv8-a clang 13.0.0
armv8-a clang 14.0.0
armv8-a clang 15.0.0
armv8-a clang 16.0.0
armv8-a clang 17.0.1
armv8-a clang 18.1.0
armv8-a clang 19.1.0
armv8-a clang 20.1.0
armv8-a clang 9.0.0
armv8-a clang 9.0.1
clad trunk (clang 20.1.0)
clad v1.10 (clang 20.1.0)
clad v1.8 (clang 18.1.0)
clad v1.9 (clang 19.1.0)
clad v2.00 (clang 20.1.0)
clang-cl 18.1.0
ellcc 0.1.33
ellcc 0.1.34
ellcc 2017-07-16
ez80-clang 15.0.0
ez80-clang 15.0.7
hexagon-clang 16.0.5
llvm-mos atari2600-3e
llvm-mos atari2600-4k
llvm-mos atari2600-common
llvm-mos atari5200-supercart
llvm-mos atari8-cart-megacart
llvm-mos atari8-cart-std
llvm-mos atari8-cart-xegs
llvm-mos atari8-common
llvm-mos atari8-dos
llvm-mos c128
llvm-mos c64
llvm-mos commodore
llvm-mos cpm65
llvm-mos cx16
llvm-mos dodo
llvm-mos eater
llvm-mos mega65
llvm-mos nes
llvm-mos nes-action53
llvm-mos nes-cnrom
llvm-mos nes-gtrom
llvm-mos nes-mmc1
llvm-mos nes-mmc3
llvm-mos nes-nrom
llvm-mos nes-unrom
llvm-mos nes-unrom-512
llvm-mos osi-c1p
llvm-mos pce
llvm-mos pce-cd
llvm-mos pce-common
llvm-mos pet
llvm-mos rp6502
llvm-mos rpc8e
llvm-mos supervision
llvm-mos vic20
loongarch64 gcc 12.2.0
loongarch64 gcc 12.3.0
loongarch64 gcc 12.4.0
loongarch64 gcc 12.5.0
loongarch64 gcc 13.1.0
loongarch64 gcc 13.2.0
loongarch64 gcc 13.3.0
loongarch64 gcc 13.4.0
loongarch64 gcc 14.1.0
loongarch64 gcc 14.2.0
loongarch64 gcc 14.3.0
loongarch64 gcc 15.1.0
loongarch64 gcc 15.2.0
mips clang 13.0.0
mips clang 14.0.0
mips clang 15.0.0
mips clang 16.0.0
mips clang 17.0.1
mips clang 18.1.0
mips clang 19.1.0
mips clang 20.1.0
mips gcc 11.2.0
mips gcc 12.1.0
mips gcc 12.2.0
mips gcc 12.3.0
mips gcc 12.4.0
mips gcc 12.5.0
mips gcc 13.1.0
mips gcc 13.2.0
mips gcc 13.3.0
mips gcc 13.4.0
mips gcc 14.1.0
mips gcc 14.2.0
mips gcc 14.3.0
mips gcc 15.1.0
mips gcc 15.2.0
mips gcc 4.9.4
mips gcc 5.4
mips gcc 5.5.0
mips gcc 9.3.0 (codescape)
mips gcc 9.5.0
mips64 (el) gcc 12.1.0
mips64 (el) gcc 12.2.0
mips64 (el) gcc 12.3.0
mips64 (el) gcc 12.4.0
mips64 (el) gcc 12.5.0
mips64 (el) gcc 13.1.0
mips64 (el) gcc 13.2.0
mips64 (el) gcc 13.3.0
mips64 (el) gcc 13.4.0
mips64 (el) gcc 14.1.0
mips64 (el) gcc 14.2.0
mips64 (el) gcc 14.3.0
mips64 (el) gcc 15.1.0
mips64 (el) gcc 15.2.0
mips64 (el) gcc 4.9.4
mips64 (el) gcc 5.4.0
mips64 (el) gcc 5.5.0
mips64 (el) gcc 9.5.0
mips64 clang 13.0.0
mips64 clang 14.0.0
mips64 clang 15.0.0
mips64 clang 16.0.0
mips64 clang 17.0.1
mips64 clang 18.1.0
mips64 clang 19.1.0
mips64 clang 20.1.0
mips64 gcc 11.2.0
mips64 gcc 12.1.0
mips64 gcc 12.2.0
mips64 gcc 12.3.0
mips64 gcc 12.4.0
mips64 gcc 12.5.0
mips64 gcc 13.1.0
mips64 gcc 13.2.0
mips64 gcc 13.3.0
mips64 gcc 13.4.0
mips64 gcc 14.1.0
mips64 gcc 14.2.0
mips64 gcc 14.3.0
mips64 gcc 15.1.0
mips64 gcc 15.2.0
mips64 gcc 4.9.4
mips64 gcc 5.4.0
mips64 gcc 5.5.0
mips64 gcc 9.5.0
mips64el clang 13.0.0
mips64el clang 14.0.0
mips64el clang 15.0.0
mips64el clang 16.0.0
mips64el clang 17.0.1
mips64el clang 18.1.0
mips64el clang 19.1.0
mips64el clang 20.1.0
mipsel clang 13.0.0
mipsel clang 14.0.0
mipsel clang 15.0.0
mipsel clang 16.0.0
mipsel clang 17.0.1
mipsel clang 18.1.0
mipsel clang 19.1.0
mipsel clang 20.1.0
mipsel gcc 12.1.0
mipsel gcc 12.2.0
mipsel gcc 12.3.0
mipsel gcc 12.4.0
mipsel gcc 12.5.0
mipsel gcc 13.1.0
mipsel gcc 13.2.0
mipsel gcc 13.3.0
mipsel gcc 13.4.0
mipsel gcc 14.1.0
mipsel gcc 14.2.0
mipsel gcc 14.3.0
mipsel gcc 15.1.0
mipsel gcc 15.2.0
mipsel gcc 4.9.4
mipsel gcc 5.4.0
mipsel gcc 5.5.0
mipsel gcc 9.5.0
nanoMIPS gcc 6.3.0 (mtk)
power gcc 11.2.0
power gcc 12.1.0
power gcc 12.2.0
power gcc 12.3.0
power gcc 12.4.0
power gcc 12.5.0
power gcc 13.1.0
power gcc 13.2.0
power gcc 13.3.0
power gcc 13.4.0
power gcc 14.1.0
power gcc 14.2.0
power gcc 14.3.0
power gcc 15.1.0
power gcc 15.2.0
power gcc 4.8.5
power64 AT12.0 (gcc8)
power64 AT13.0 (gcc9)
power64 gcc 11.2.0
power64 gcc 12.1.0
power64 gcc 12.2.0
power64 gcc 12.3.0
power64 gcc 12.4.0
power64 gcc 12.5.0
power64 gcc 13.1.0
power64 gcc 13.2.0
power64 gcc 13.3.0
power64 gcc 13.4.0
power64 gcc 14.1.0
power64 gcc 14.2.0
power64 gcc 14.3.0
power64 gcc 15.1.0
power64 gcc 15.2.0
power64 gcc trunk
power64le AT12.0 (gcc8)
power64le AT13.0 (gcc9)
power64le clang (trunk)
power64le gcc 11.2.0
power64le gcc 12.1.0
power64le gcc 12.2.0
power64le gcc 12.3.0
power64le gcc 12.4.0
power64le gcc 12.5.0
power64le gcc 13.1.0
power64le gcc 13.2.0
power64le gcc 13.3.0
power64le gcc 13.4.0
power64le gcc 14.1.0
power64le gcc 14.2.0
power64le gcc 14.3.0
power64le gcc 15.1.0
power64le gcc 15.2.0
power64le gcc 6.3.0
power64le gcc trunk
powerpc64 clang (trunk)
qnx 8.0.0
s390x gcc 11.2.0
s390x gcc 12.1.0
s390x gcc 12.2.0
s390x gcc 12.3.0
s390x gcc 12.4.0
s390x gcc 12.5.0
s390x gcc 13.1.0
s390x gcc 13.2.0
s390x gcc 13.3.0
s390x gcc 13.4.0
s390x gcc 14.1.0
s390x gcc 14.2.0
s390x gcc 14.3.0
s390x gcc 15.1.0
s390x gcc 15.2.0
sh gcc 12.2.0
sh gcc 12.3.0
sh gcc 12.4.0
sh gcc 12.5.0
sh gcc 13.1.0
sh gcc 13.2.0
sh gcc 13.3.0
sh gcc 13.4.0
sh gcc 14.1.0
sh gcc 14.2.0
sh gcc 14.3.0
sh gcc 15.1.0
sh gcc 15.2.0
sh gcc 4.9.4
sh gcc 9.5.0
vast (trunk)
x64 msvc v19.0 (ex-WINE)
x64 msvc v19.10 (ex-WINE)
x64 msvc v19.14 (ex-WINE)
x64 msvc v19.20 VS16.0
x64 msvc v19.21 VS16.1
x64 msvc v19.22 VS16.2
x64 msvc v19.23 VS16.3
x64 msvc v19.24 VS16.4
x64 msvc v19.25 VS16.5
x64 msvc v19.27 VS16.7
x64 msvc v19.28 VS16.8
x64 msvc v19.28 VS16.9
x64 msvc v19.29 VS16.10
x64 msvc v19.29 VS16.11
x64 msvc v19.30 VS17.0
x64 msvc v19.31 VS17.1
x64 msvc v19.32 VS17.2
x64 msvc v19.33 VS17.3
x64 msvc v19.34 VS17.4
x64 msvc v19.35 VS17.5
x64 msvc v19.36 VS17.6
x64 msvc v19.37 VS17.7
x64 msvc v19.38 VS17.8
x64 msvc v19.39 VS17.9
x64 msvc v19.40 VS17.10
x64 msvc v19.41 VS17.11
x64 msvc v19.42 VS17.12
x64 msvc v19.43 VS17.13
x64 msvc v19.latest
x86 djgpp 4.9.4
x86 djgpp 5.5.0
x86 djgpp 6.4.0
x86 djgpp 7.2.0
x86 msvc v19.0 (ex-WINE)
x86 msvc v19.10 (ex-WINE)
x86 msvc v19.14 (ex-WINE)
x86 msvc v19.20 VS16.0
x86 msvc v19.21 VS16.1
x86 msvc v19.22 VS16.2
x86 msvc v19.23 VS16.3
x86 msvc v19.24 VS16.4
x86 msvc v19.25 VS16.5
x86 msvc v19.27 VS16.7
x86 msvc v19.28 VS16.8
x86 msvc v19.28 VS16.9
x86 msvc v19.29 VS16.10
x86 msvc v19.29 VS16.11
x86 msvc v19.30 VS17.0
x86 msvc v19.31 VS17.1
x86 msvc v19.32 VS17.2
x86 msvc v19.33 VS17.3
x86 msvc v19.34 VS17.4
x86 msvc v19.35 VS17.5
x86 msvc v19.36 VS17.6
x86 msvc v19.37 VS17.7
x86 msvc v19.38 VS17.8
x86 msvc v19.39 VS17.9
x86 msvc v19.40 VS17.10
x86 msvc v19.41 VS17.11
x86 msvc v19.42 VS17.12
x86 msvc v19.43 VS17.13
x86 msvc v19.latest
x86 nvc++ 22.11
x86 nvc++ 22.7
x86 nvc++ 22.9
x86 nvc++ 23.1
x86 nvc++ 23.11
x86 nvc++ 23.3
x86 nvc++ 23.5
x86 nvc++ 23.7
x86 nvc++ 23.9
x86 nvc++ 24.1
x86 nvc++ 24.11
x86 nvc++ 24.3
x86 nvc++ 24.5
x86 nvc++ 24.7
x86 nvc++ 24.9
x86 nvc++ 25.1
x86 nvc++ 25.3
x86 nvc++ 25.5
x86 nvc++ 25.7
x86-64 Zapcc 190308
x86-64 clang (-fimplicit-constexpr)
x86-64 clang (Chris Bazley N3089)
x86-64 clang (EricWF contracts)
x86-64 clang (amd-staging)
x86-64 clang (assertions trunk)
x86-64 clang (clangir)
x86-64 clang (experimental -Wlifetime)
x86-64 clang (experimental P1061)
x86-64 clang (experimental P1144)
x86-64 clang (experimental P1221)
x86-64 clang (experimental P2998)
x86-64 clang (experimental P3068)
x86-64 clang (experimental P3309)
x86-64 clang (experimental P3367)
x86-64 clang (experimental P3372)
x86-64 clang (experimental P3385)
x86-64 clang (experimental P3776)
x86-64 clang (experimental metaprogramming - P2632)
x86-64 clang (old concepts branch)
x86-64 clang (p1974)
x86-64 clang (pattern matching - P2688)
x86-64 clang (reflection - C++26)
x86-64 clang (reflection - TS)
x86-64 clang (resugar)
x86-64 clang (string interpolation - P3412)
x86-64 clang (thephd.dev)
x86-64 clang (trunk)
x86-64 clang (variadic friends - P2893)
x86-64 clang (widberg)
x86-64 clang 10.0.0
x86-64 clang 10.0.0 (assertions)
x86-64 clang 10.0.1
x86-64 clang 11.0.0
x86-64 clang 11.0.0 (assertions)
x86-64 clang 11.0.1
x86-64 clang 12.0.0
x86-64 clang 12.0.0 (assertions)
x86-64 clang 12.0.1
x86-64 clang 13.0.0
x86-64 clang 13.0.0 (assertions)
x86-64 clang 13.0.1
x86-64 clang 14.0.0
x86-64 clang 14.0.0 (assertions)
x86-64 clang 15.0.0
x86-64 clang 15.0.0 (assertions)
x86-64 clang 16.0.0
x86-64 clang 16.0.0 (assertions)
x86-64 clang 17.0.1
x86-64 clang 17.0.1 (assertions)
x86-64 clang 18.1.0
x86-64 clang 18.1.0 (assertions)
x86-64 clang 19.1.0
x86-64 clang 19.1.0 (assertions)
x86-64 clang 2.6.0 (assertions)
x86-64 clang 2.7.0 (assertions)
x86-64 clang 2.8.0 (assertions)
x86-64 clang 2.9.0 (assertions)
x86-64 clang 20.1.0
x86-64 clang 20.1.0 (assertions)
x86-64 clang 3.0.0
x86-64 clang 3.0.0 (assertions)
x86-64 clang 3.1
x86-64 clang 3.1 (assertions)
x86-64 clang 3.2
x86-64 clang 3.2 (assertions)
x86-64 clang 3.3
x86-64 clang 3.3 (assertions)
x86-64 clang 3.4 (assertions)
x86-64 clang 3.4.1
x86-64 clang 3.5
x86-64 clang 3.5 (assertions)
x86-64 clang 3.5.1
x86-64 clang 3.5.2
x86-64 clang 3.6
x86-64 clang 3.6 (assertions)
x86-64 clang 3.7
x86-64 clang 3.7 (assertions)
x86-64 clang 3.7.1
x86-64 clang 3.8
x86-64 clang 3.8 (assertions)
x86-64 clang 3.8.1
x86-64 clang 3.9.0
x86-64 clang 3.9.0 (assertions)
x86-64 clang 3.9.1
x86-64 clang 4.0.0
x86-64 clang 4.0.0 (assertions)
x86-64 clang 4.0.1
x86-64 clang 5.0.0
x86-64 clang 5.0.0 (assertions)
x86-64 clang 5.0.1
x86-64 clang 5.0.2
x86-64 clang 6.0.0
x86-64 clang 6.0.0 (assertions)
x86-64 clang 6.0.1
x86-64 clang 7.0.0
x86-64 clang 7.0.0 (assertions)
x86-64 clang 7.0.1
x86-64 clang 7.1.0
x86-64 clang 8.0.0
x86-64 clang 8.0.0 (assertions)
x86-64 clang 8.0.1
x86-64 clang 9.0.0
x86-64 clang 9.0.0 (assertions)
x86-64 clang 9.0.1
x86-64 clang rocm-4.5.2
x86-64 clang rocm-5.0.2
x86-64 clang rocm-5.1.3
x86-64 clang rocm-5.2.3
x86-64 clang rocm-5.3.3
x86-64 clang rocm-5.7.0
x86-64 clang rocm-6.0.2
x86-64 clang rocm-6.1.2
x86-64 clang rocm-6.2.4
x86-64 clang rocm-6.3.3
x86-64 clang rocm-6.4.0
x86-64 gcc (P2034 lambdas)
x86-64 gcc (contract labels)
x86-64 gcc (contracts natural syntax)
x86-64 gcc (contracts)
x86-64 gcc (coroutines)
x86-64 gcc (modules)
x86-64 gcc (trunk)
x86-64 gcc 10.1
x86-64 gcc 10.2
x86-64 gcc 10.3
x86-64 gcc 10.3 (assertions)
x86-64 gcc 10.4
x86-64 gcc 10.4 (assertions)
x86-64 gcc 10.5
x86-64 gcc 10.5 (assertions)
x86-64 gcc 11.1
x86-64 gcc 11.1 (assertions)
x86-64 gcc 11.2
x86-64 gcc 11.2 (assertions)
x86-64 gcc 11.3
x86-64 gcc 11.3 (assertions)
x86-64 gcc 11.4
x86-64 gcc 11.4 (assertions)
x86-64 gcc 12.1
x86-64 gcc 12.1 (assertions)
x86-64 gcc 12.2
x86-64 gcc 12.2 (assertions)
x86-64 gcc 12.3
x86-64 gcc 12.3 (assertions)
x86-64 gcc 12.4
x86-64 gcc 12.4 (assertions)
x86-64 gcc 12.5
x86-64 gcc 12.5 (assertions)
x86-64 gcc 13.1
x86-64 gcc 13.1 (assertions)
x86-64 gcc 13.2
x86-64 gcc 13.2 (assertions)
x86-64 gcc 13.3
x86-64 gcc 13.3 (assertions)
x86-64 gcc 13.4
x86-64 gcc 13.4 (assertions)
x86-64 gcc 14.1
x86-64 gcc 14.1 (assertions)
x86-64 gcc 14.2
x86-64 gcc 14.2 (assertions)
x86-64 gcc 14.3
x86-64 gcc 14.3 (assertions)
x86-64 gcc 15.1
x86-64 gcc 15.1 (assertions)
x86-64 gcc 15.2
x86-64 gcc 15.2 (assertions)
x86-64 gcc 3.4.6
x86-64 gcc 4.0.4
x86-64 gcc 4.1.2
x86-64 gcc 4.4.7
x86-64 gcc 4.5.3
x86-64 gcc 4.6.4
x86-64 gcc 4.7.1
x86-64 gcc 4.7.2
x86-64 gcc 4.7.3
x86-64 gcc 4.7.4
x86-64 gcc 4.8.1
x86-64 gcc 4.8.2
x86-64 gcc 4.8.3
x86-64 gcc 4.8.4
x86-64 gcc 4.8.5
x86-64 gcc 4.9.0
x86-64 gcc 4.9.1
x86-64 gcc 4.9.2
x86-64 gcc 4.9.3
x86-64 gcc 4.9.4
x86-64 gcc 5.1
x86-64 gcc 5.2
x86-64 gcc 5.3
x86-64 gcc 5.4
x86-64 gcc 5.5
x86-64 gcc 6.1
x86-64 gcc 6.2
x86-64 gcc 6.3
x86-64 gcc 6.4
x86-64 gcc 6.5
x86-64 gcc 7.1
x86-64 gcc 7.2
x86-64 gcc 7.3
x86-64 gcc 7.4
x86-64 gcc 7.5
x86-64 gcc 8.1
x86-64 gcc 8.2
x86-64 gcc 8.3
x86-64 gcc 8.4
x86-64 gcc 8.5
x86-64 gcc 9.1
x86-64 gcc 9.2
x86-64 gcc 9.3
x86-64 gcc 9.4
x86-64 gcc 9.5
x86-64 icc 13.0.1
x86-64 icc 16.0.3
x86-64 icc 17.0.0
x86-64 icc 18.0.0
x86-64 icc 19.0.0
x86-64 icc 19.0.1
x86-64 icc 2021.1.2
x86-64 icc 2021.10.0
x86-64 icc 2021.2.0
x86-64 icc 2021.3.0
x86-64 icc 2021.4.0
x86-64 icc 2021.5.0
x86-64 icc 2021.6.0
x86-64 icc 2021.7.0
x86-64 icc 2021.7.1
x86-64 icc 2021.8.0
x86-64 icc 2021.9.0
x86-64 icx 2021.1.2
x86-64 icx 2021.2.0
x86-64 icx 2021.3.0
x86-64 icx 2021.4.0
x86-64 icx 2022.0.0
x86-64 icx 2022.1.0
x86-64 icx 2022.2.0
x86-64 icx 2022.2.1
x86-64 icx 2023.0.0
x86-64 icx 2023.1.0
x86-64 icx 2023.2.1
x86-64 icx 2024.0.0
x86-64 icx 2024.1.0
x86-64 icx 2024.2.0
x86-64 icx 2024.2.1
x86-64 icx 2025.0.0
x86-64 icx 2025.0.1
x86-64 icx 2025.0.3
x86-64 icx 2025.0.4
x86-64 icx 2025.1.0
x86-64 icx 2025.1.1
x86-64 icx 2025.2.0
x86-64 icx 2025.2.1
x86-64 icx 2025.2.1
z180-clang 15.0.0
z180-clang 15.0.7
z80-clang 15.0.0
z80-clang 15.0.7
zig c++ 0.10.0
zig c++ 0.11.0
zig c++ 0.12.0
zig c++ 0.12.1
zig c++ 0.13.0
zig c++ 0.14.0
zig c++ 0.14.1
zig c++ 0.15.1
zig c++ 0.6.0
zig c++ 0.7.0
zig c++ 0.7.1
zig c++ 0.8.0
zig c++ 0.9.0
zig c++ trunk
Options
Source code
#pragma once #pragma once #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma region Input Buffer SAL 1 compatibility macros #pragma endregion Input Buffer SAL 1 compatibility macros extern "C" { } #pragma external_header(push) #pragma once extern "C" { } #pragma external_header(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push) #pragma warning(disable: 4514 4820 ) extern "C" { typedef unsigned __int64 uintptr_t; typedef char* va_list; void __cdecl __va_start(va_list* , ...); } extern "C++" { template <typename _Ty> struct __vcrt_va_list_is_reference { enum : bool { __the_value = false }; }; template <typename _Ty> struct __vcrt_va_list_is_reference<_Ty&> { enum : bool { __the_value = true }; }; template <typename _Ty> struct __vcrt_va_list_is_reference<_Ty&&> { enum : bool { __the_value = true }; }; template <typename _Ty> struct __vcrt_assert_va_start_is_not_reference { static_assert(!__vcrt_va_list_is_reference<_Ty>::__the_value, "va_start argument must not have reference type and must not be parenthesized"); }; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma warning(push) #pragma warning(disable: 4514 4820 ) __pragma(pack(push, 8)) extern "C" { typedef unsigned __int64 size_t; typedef __int64 ptrdiff_t; typedef __int64 intptr_t; typedef bool __vcrt_bool; extern "C++" { template <typename _CountofType, size_t _SizeOfArray> char (*__countof_helper(__unaligned _CountofType (&_Array)[_SizeOfArray]))[_SizeOfArray]; } void __cdecl __security_init_cookie(void); void __cdecl __security_check_cookie( uintptr_t _StackCookie); __declspec(noreturn) void __cdecl __report_gsfailure( uintptr_t _StackCookie); extern uintptr_t __security_cookie; } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4514 4820 ) typedef signed char int8_t; typedef short int16_t; typedef int int32_t; typedef long long int64_t; typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; typedef unsigned long long uint64_t; typedef signed char int_least8_t; typedef short int_least16_t; typedef int int_least32_t; typedef long long int_least64_t; typedef unsigned char uint_least8_t; typedef unsigned short uint_least16_t; typedef unsigned int uint_least32_t; typedef unsigned long long uint_least64_t; typedef signed char int_fast8_t; typedef int int_fast16_t; typedef int int_fast32_t; typedef long long int_fast64_t; typedef unsigned char uint_fast8_t; typedef unsigned int uint_fast16_t; typedef unsigned int uint_fast32_t; typedef unsigned long long uint_fast64_t; typedef long long intmax_t; typedef unsigned long long uintmax_t; #pragma warning(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { using :: int8_t; using :: int16_t; using :: int32_t; using :: int64_t; using :: uint8_t; using :: uint16_t; using :: uint32_t; using :: uint64_t; using :: int_least8_t; using :: int_least16_t; using :: int_least32_t; using :: int_least64_t; using :: uint_least8_t; using :: uint_least16_t; using :: uint_least32_t; using :: uint_least64_t; using :: int_fast8_t; using :: int_fast16_t; using :: int_fast32_t; using :: int_fast64_t; using :: uint_fast8_t; using :: uint_fast16_t; using :: uint_fast32_t; using :: uint_fast64_t; using :: intmax_t; using :: intptr_t; using :: uintmax_t; using :: uintptr_t; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { extern "C++" { template<bool _Enable, typename _Ty> struct _CrtEnableIf; template<typename _Ty> struct _CrtEnableIf<true, _Ty> { typedef _Ty _Type; }; } typedef bool __crt_bool; __declspec(dllimport) void __cdecl _invalid_parameter( wchar_t const*, wchar_t const*, wchar_t const*, unsigned int, uintptr_t ); __declspec(dllimport) void __cdecl _invalid_parameter_noinfo(void); __declspec(dllimport) __declspec(noreturn) void __cdecl _invalid_parameter_noinfo_noreturn(void); __declspec(noreturn) __declspec(dllimport) void __cdecl _invoke_watson( wchar_t const* _Expression, wchar_t const* _FunctionName, wchar_t const* _FileName, unsigned int _LineNo, uintptr_t _Reserved); typedef int errno_t; typedef unsigned short wint_t; typedef unsigned short wctype_t; typedef long __time32_t; typedef __int64 __time64_t; typedef struct __crt_locale_data_public { unsigned short const* _locale_pctype; int _locale_mb_cur_max; unsigned int _locale_lc_codepage; } __crt_locale_data_public; typedef struct __crt_locale_pointers { struct __crt_locale_data* locinfo; struct __crt_multibyte_data* mbcinfo; } __crt_locale_pointers; typedef __crt_locale_pointers* _locale_t; typedef struct _Mbstatet { unsigned long _Wchar; unsigned short _Byte, _State; } _Mbstatet; typedef _Mbstatet mbstate_t; typedef __time64_t time_t; typedef size_t rsize_t; } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { namespace std { typedef decltype(__nullptr) nullptr_t; } using ::std::nullptr_t; __declspec(dllimport) int* __cdecl _errno(void); __declspec(dllimport) errno_t __cdecl _set_errno( int _Value); __declspec(dllimport) errno_t __cdecl _get_errno( int* _Value); __declspec(dllimport) extern unsigned long __cdecl __threadid(void); __declspec(dllimport) extern uintptr_t __cdecl __threadhandle(void); } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { template <class _Ty, _Ty _Val> struct integral_constant { static constexpr _Ty value = _Val; using value_type = _Ty; using type = integral_constant; constexpr operator value_type() const noexcept { return value; } [[nodiscard]] constexpr value_type operator()() const noexcept { return value; } }; template <bool _Val> using bool_constant = integral_constant<bool, _Val>; using true_type = bool_constant<true>; using false_type = bool_constant<false>; template <bool _Test, class _Ty = void> struct enable_if {}; template <class _Ty> struct enable_if<true, _Ty> { using type = _Ty; }; template <bool _Test, class _Ty = void> using enable_if_t = typename enable_if<_Test, _Ty>::type; template <bool _Test, class _Ty1, class _Ty2> struct conditional { using type = _Ty1; }; template <class _Ty1, class _Ty2> struct conditional<false, _Ty1, _Ty2> { using type = _Ty2; }; template <bool _Test, class _Ty1, class _Ty2> using conditional_t = typename conditional<_Test, _Ty1, _Ty2>::type; template <class, class> inline constexpr bool is_same_v = false; template <class _Ty> inline constexpr bool is_same_v<_Ty, _Ty> = true; template <class _Ty1, class _Ty2> struct is_same : bool_constant<is_same_v<_Ty1, _Ty2>> {}; template <class _Ty> struct remove_const { using type = _Ty; }; template <class _Ty> struct remove_const<const _Ty> { using type = _Ty; }; template <class _Ty> using remove_const_t = typename remove_const<_Ty>::type; template <class _Ty> struct remove_volatile { using type = _Ty; }; template <class _Ty> struct remove_volatile<volatile _Ty> { using type = _Ty; }; template <class _Ty> using remove_volatile_t = typename remove_volatile<_Ty>::type; template <class _Ty> struct remove_cv { using type = _Ty; template <template <class> class _Fn> using _Apply = _Fn<_Ty>; }; template <class _Ty> struct remove_cv<const _Ty> { using type = _Ty; template <template <class> class _Fn> using _Apply = const _Fn<_Ty>; }; template <class _Ty> struct remove_cv<volatile _Ty> { using type = _Ty; template <template <class> class _Fn> using _Apply = volatile _Fn<_Ty>; }; template <class _Ty> struct remove_cv<const volatile _Ty> { using type = _Ty; template <template <class> class _Fn> using _Apply = const volatile _Fn<_Ty>; }; template <class _Ty> using remove_cv_t = typename remove_cv<_Ty>::type; template <bool _First_value, class _First, class... _Rest> struct _Disjunction { using type = _First; }; template <class _False, class _Next, class... _Rest> struct _Disjunction<false, _False, _Next, _Rest...> { using type = typename _Disjunction<_Next::value, _Next, _Rest...>::type; }; template <class... _Traits> struct disjunction : false_type {}; template <class _First, class... _Rest> struct disjunction<_First, _Rest...> : _Disjunction<_First::value, _First, _Rest...>::type { }; template <class... _Traits> inline constexpr bool disjunction_v = disjunction<_Traits...>::value; template <class _Ty, class... _Types> inline constexpr bool _Is_any_of_v = disjunction_v<is_same<_Ty, _Types>...>; [[nodiscard]] constexpr bool is_constant_evaluated() noexcept { return __builtin_is_constant_evaluated(); } template <class _Ty> inline constexpr bool is_integral_v = _Is_any_of_v<remove_cv_t<_Ty>, bool, char, signed char, unsigned char, wchar_t, char8_t, char16_t, char32_t, short, unsigned short, int, unsigned int, long, unsigned long, long long, unsigned long long>; template <class _Ty> struct is_integral : bool_constant<is_integral_v<_Ty>> {}; template <class _Ty> inline constexpr bool is_floating_point_v = _Is_any_of_v<remove_cv_t<_Ty>, float, double, long double>; template <class _Ty> struct is_floating_point : bool_constant<is_floating_point_v<_Ty>> {}; template <class _Ty> inline constexpr bool is_arithmetic_v = is_integral_v<_Ty> || is_floating_point_v<_Ty>; template <class _Ty> struct is_arithmetic : bool_constant<is_arithmetic_v<_Ty>> {}; template <class _Ty> struct remove_reference { using type = _Ty; using _Const_thru_ref_type = const _Ty; }; template <class _Ty> struct remove_reference<_Ty&> { using type = _Ty; using _Const_thru_ref_type = const _Ty&; }; template <class _Ty> struct remove_reference<_Ty&&> { using type = _Ty; using _Const_thru_ref_type = const _Ty&&; }; template <class _Ty> using remove_reference_t = typename remove_reference<_Ty>::type; template <class _Ty> using _Const_thru_ref = typename remove_reference<_Ty>::_Const_thru_ref_type; template <class _Ty> using _Remove_cvref_t = remove_cv_t<remove_reference_t<_Ty>>; template <class _Ty> using remove_cvref_t = _Remove_cvref_t<_Ty>; template <class _Ty> struct remove_cvref { using type = remove_cvref_t<_Ty>; }; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { using :: ptrdiff_t; using :: size_t; using max_align_t = double; enum class byte : unsigned char {}; template <class _IntType, enable_if_t<is_integral_v<_IntType>, int> = 0> [[nodiscard]] constexpr byte operator<<( const byte _Arg, const _IntType _Shift) noexcept { return static_cast<byte>(static_cast<unsigned char>(static_cast<unsigned int>(_Arg) << _Shift)); } template <class _IntType, enable_if_t<is_integral_v<_IntType>, int> = 0> [[nodiscard]] constexpr byte operator>>( const byte _Arg, const _IntType _Shift) noexcept { return static_cast<byte>(static_cast<unsigned char>(static_cast<unsigned int>(_Arg) >> _Shift)); } [[nodiscard]] constexpr byte operator|( const byte _Left, const byte _Right) noexcept { return static_cast<byte>( static_cast<unsigned char>(static_cast<unsigned int>(_Left) | static_cast<unsigned int>(_Right))); } [[nodiscard]] constexpr byte operator&( const byte _Left, const byte _Right) noexcept { return static_cast<byte>( static_cast<unsigned char>(static_cast<unsigned int>(_Left) & static_cast<unsigned int>(_Right))); } [[nodiscard]] constexpr byte operator^( const byte _Left, const byte _Right) noexcept { return static_cast<byte>( static_cast<unsigned char>(static_cast<unsigned int>(_Left) ^ static_cast<unsigned int>(_Right))); } [[nodiscard]] constexpr byte operator~(const byte _Arg) noexcept { return static_cast<byte>(static_cast<unsigned char>(~static_cast<unsigned int>(_Arg))); } template <class _IntType, enable_if_t<is_integral_v<_IntType>, int> = 0> constexpr byte& operator<<=(byte& _Arg, const _IntType _Shift) noexcept { return _Arg = _Arg << _Shift; } template <class _IntType, enable_if_t<is_integral_v<_IntType>, int> = 0> constexpr byte& operator>>=(byte& _Arg, const _IntType _Shift) noexcept { return _Arg = _Arg >> _Shift; } constexpr byte& operator|=(byte& _Left, const byte _Right) noexcept { return _Left = _Left | _Right; } constexpr byte& operator&=(byte& _Left, const byte _Right) noexcept { return _Left = _Left & _Right; } constexpr byte& operator^=(byte& _Left, const byte _Right) noexcept { return _Left = _Left ^ _Right; } template <class _IntType, enable_if_t<is_integral_v<_IntType>, int> = 0> [[nodiscard]] constexpr _IntType to_integer(const byte _Arg) noexcept { return static_cast<_IntType>(_Arg); } } using ::std:: max_align_t; #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(push) #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { struct _exception { int type; char* name; double arg1; double arg2; double retval; }; struct _complex { double x, y; }; typedef float float_t; typedef double double_t; extern double const _HUGE; void __cdecl _fperrraise( int _Except); __declspec(dllimport) short __cdecl _dclass( double _X); __declspec(dllimport) short __cdecl _ldclass( long double _X); __declspec(dllimport) short __cdecl _fdclass( float _X); __declspec(dllimport) int __cdecl _dsign( double _X); __declspec(dllimport) int __cdecl _ldsign( long double _X); __declspec(dllimport) int __cdecl _fdsign( float _X); __declspec(dllimport) int __cdecl _dpcomp( double _X, double _Y); __declspec(dllimport) int __cdecl _ldpcomp( long double _X, long double _Y); __declspec(dllimport) int __cdecl _fdpcomp( float _X, float _Y); __declspec(dllimport) short __cdecl _dtest( double* _Px); __declspec(dllimport) short __cdecl _ldtest( long double* _Px); __declspec(dllimport) short __cdecl _fdtest( float* _Px); __declspec(dllimport) short __cdecl _d_int( double* _Px, short _Xexp); __declspec(dllimport) short __cdecl _ld_int( long double* _Px, short _Xexp); __declspec(dllimport) short __cdecl _fd_int( float* _Px, short _Xexp); __declspec(dllimport) short __cdecl _dscale( double* _Px, long _Lexp); __declspec(dllimport) short __cdecl _ldscale( long double* _Px, long _Lexp); __declspec(dllimport) short __cdecl _fdscale( float* _Px, long _Lexp); __declspec(dllimport) short __cdecl _dunscale( short* _Pex, double* _Px); __declspec(dllimport) short __cdecl _ldunscale( short* _Pex, long double* _Px); __declspec(dllimport) short __cdecl _fdunscale( short* _Pex, float* _Px); __declspec(dllimport) short __cdecl _dexp( double* _Px, double _Y, long _Eoff); __declspec(dllimport) short __cdecl _ldexp( long double* _Px, long double _Y, long _Eoff); __declspec(dllimport) short __cdecl _fdexp( float* _Px, float _Y, long _Eoff); __declspec(dllimport) short __cdecl _dnorm( unsigned short* _Ps); __declspec(dllimport) short __cdecl _fdnorm( unsigned short* _Ps); __declspec(dllimport) double __cdecl _dpoly( double _X, double const* _Tab, int _N); __declspec(dllimport) long double __cdecl _ldpoly( long double _X, long double const* _Tab, int _N); __declspec(dllimport) float __cdecl _fdpoly( float _X, float const* _Tab, int _N); __declspec(dllimport) double __cdecl _dlog( double _X, int _Baseflag); __declspec(dllimport) long double __cdecl _ldlog( long double _X, int _Baseflag); __declspec(dllimport) float __cdecl _fdlog( float _X, int _Baseflag); __declspec(dllimport) double __cdecl _dsin( double _X, unsigned int _Qoff); __declspec(dllimport) long double __cdecl _ldsin( long double _X, unsigned int _Qoff); __declspec(dllimport) float __cdecl _fdsin( float _X, unsigned int _Qoff); typedef union { unsigned short _Sh[4]; double _Val; } _double_val; typedef union { unsigned short _Sh[2]; float _Val; } _float_val; typedef union { unsigned short _Sh[4]; long double _Val; } _ldouble_val; typedef union { unsigned short _Word[4]; float _Float; double _Double; long double _Long_double; } _float_const; extern const _float_const _Denorm_C, _Inf_C, _Nan_C, _Snan_C, _Hugeval_C; extern const _float_const _FDenorm_C, _FInf_C, _FNan_C, _FSnan_C; extern const _float_const _LDenorm_C, _LInf_C, _LNan_C, _LSnan_C; extern const _float_const _Eps_C, _Rteps_C; extern const _float_const _FEps_C, _FRteps_C; extern const _float_const _LEps_C, _LRteps_C; extern const double _Zero_C, _Xbig_C; extern const float _FZero_C, _FXbig_C; extern const long double _LZero_C, _LXbig_C; extern "C++" { inline int fpclassify( float _X) throw() { return _fdtest(&_X); } inline int fpclassify( double _X) throw() { return _dtest(&_X); } inline int fpclassify( long double _X) throw() { return _ldtest(&_X); } inline bool signbit( float _X) throw() { return _fdsign(_X) != 0; } inline bool signbit( double _X) throw() { return _dsign(_X) != 0; } inline bool signbit( long double _X) throw() { return _ldsign(_X) != 0; } inline int _fpcomp( float _X, float _Y) throw() { return _fdpcomp(_X, _Y); } inline int _fpcomp( double _X, double _Y) throw() { return _dpcomp(_X, _Y); } inline int _fpcomp( long double _X, long double _Y) throw() { return _ldpcomp(_X, _Y); } template <class _Trc, class _Tre> struct _Combined_type { typedef float _Type; }; template <> struct _Combined_type<float, double> { typedef double _Type; }; template <> struct _Combined_type<float, long double> { typedef long double _Type; }; template <class _Ty, class _T2> struct _Real_widened { typedef long double _Type; }; template <> struct _Real_widened<float, float> { typedef float _Type; }; template <> struct _Real_widened<float, double> { typedef double _Type; }; template <> struct _Real_widened<double, float> { typedef double _Type; }; template <> struct _Real_widened<double, double> { typedef double _Type; }; template <class _Ty> struct _Real_type { typedef double _Type; }; template <> struct _Real_type<float> { typedef float _Type; }; template <> struct _Real_type<long double> { typedef long double _Type; }; template <class _T1, class _T2> inline int _fpcomp( _T1 _X, _T2 _Y) throw() { typedef typename _Combined_type<float, typename _Real_widened< typename _Real_type<_T1>::_Type, typename _Real_type<_T2>::_Type>::_Type>::_Type _Tw; return _fpcomp((_Tw)_X, (_Tw)_Y); } template <class _Ty> inline bool isfinite( _Ty _X) throw() { return fpclassify(_X) <= 0; } template <class _Ty> inline bool isinf( _Ty _X) throw() { return fpclassify(_X) == 1; } template <class _Ty> inline bool isnan( _Ty _X) throw() { return fpclassify(_X) == 2; } template <class _Ty> inline bool isnormal( _Ty _X) throw() { return fpclassify(_X) == (-1); } template <class _Ty1, class _Ty2> inline bool isgreater( _Ty1 _X, _Ty2 _Y) throw() { return (_fpcomp(_X, _Y) & 4) != 0; } template <class _Ty1, class _Ty2> inline bool isgreaterequal( _Ty1 _X, _Ty2 _Y) throw() { return (_fpcomp(_X, _Y) & (2 | 4)) != 0; } template <class _Ty1, class _Ty2> inline bool isless( _Ty1 _X, _Ty2 _Y) throw() { return (_fpcomp(_X, _Y) & 1) != 0; } template <class _Ty1, class _Ty2> inline bool islessequal( _Ty1 _X, _Ty2 _Y) throw() { return (_fpcomp(_X, _Y) & (1 | 2)) != 0; } template <class _Ty1, class _Ty2> inline bool islessgreater( _Ty1 _X, _Ty2 _Y) throw() { return (_fpcomp(_X, _Y) & (1 | 4)) != 0; } template <class _Ty1, class _Ty2> inline bool isunordered( _Ty1 _X, _Ty2 _Y) throw() { return _fpcomp(_X, _Y) == 0; } } int __cdecl abs( int _X); long __cdecl labs( long _X); long long __cdecl llabs( long long _X); double __cdecl acos( double _X); double __cdecl asin( double _X); double __cdecl atan( double _X); double __cdecl atan2( double _Y, double _X); double __cdecl cos( double _X); double __cdecl cosh( double _X); double __cdecl exp( double _X); double __cdecl fabs( double _X); double __cdecl fmod( double _X, double _Y); double __cdecl log( double _X); double __cdecl log10( double _X); double __cdecl pow( double _X, double _Y); double __cdecl sin( double _X); double __cdecl sinh( double _X); double __cdecl sqrt( double _X); double __cdecl tan( double _X); double __cdecl tanh( double _X); __declspec(dllimport) double __cdecl acosh( double _X); __declspec(dllimport) double __cdecl asinh( double _X); __declspec(dllimport) double __cdecl atanh( double _X); __declspec(dllimport) double __cdecl atof( char const* _String); __declspec(dllimport) double __cdecl _atof_l( char const* _String, _locale_t _Locale); __declspec(dllimport) double __cdecl _cabs( struct _complex _Complex_value); __declspec(dllimport) double __cdecl cbrt( double _X); __declspec(dllimport) double __cdecl ceil( double _X); __declspec(dllimport) double __cdecl _chgsign( double _X); __declspec(dllimport) double __cdecl copysign( double _Number, double _Sign); __declspec(dllimport) double __cdecl _copysign( double _Number, double _Sign); __declspec(dllimport) double __cdecl erf( double _X); __declspec(dllimport) double __cdecl erfc( double _X); __declspec(dllimport) double __cdecl exp2( double _X); __declspec(dllimport) double __cdecl expm1( double _X); __declspec(dllimport) double __cdecl fdim( double _X, double _Y); __declspec(dllimport) double __cdecl floor( double _X); __declspec(dllimport) double __cdecl fma( double _X, double _Y, double _Z); __declspec(dllimport) double __cdecl fmax( double _X, double _Y); __declspec(dllimport) double __cdecl fmin( double _X, double _Y); __declspec(dllimport) double __cdecl frexp( double _X, int* _Y); __declspec(dllimport) double __cdecl hypot( double _X, double _Y); __declspec(dllimport) double __cdecl _hypot( double _X, double _Y); __declspec(dllimport) int __cdecl ilogb( double _X); __declspec(dllimport) double __cdecl ldexp( double _X, int _Y); __declspec(dllimport) double __cdecl lgamma( double _X); __declspec(dllimport) long long __cdecl llrint( double _X); __declspec(dllimport) long long __cdecl llround( double _X); __declspec(dllimport) double __cdecl log1p( double _X); __declspec(dllimport) double __cdecl log2( double _X); __declspec(dllimport) double __cdecl logb( double _X); __declspec(dllimport) long __cdecl lrint( double _X); __declspec(dllimport) long __cdecl lround( double _X); int __cdecl _matherr( struct _exception* _Except); __declspec(dllimport) double __cdecl modf( double _X, double* _Y); __declspec(dllimport) double __cdecl nan( char const* _X); __declspec(dllimport) double __cdecl nearbyint( double _X); __declspec(dllimport) double __cdecl nextafter( double _X, double _Y); __declspec(dllimport) double __cdecl nexttoward( double _X, long double _Y); __declspec(dllimport) double __cdecl remainder( double _X, double _Y); __declspec(dllimport) double __cdecl remquo( double _X, double _Y, int* _Z); __declspec(dllimport) double __cdecl rint( double _X); __declspec(dllimport) double __cdecl round( double _X); __declspec(dllimport) double __cdecl scalbln( double _X, long _Y); __declspec(dllimport) double __cdecl scalbn( double _X, int _Y); __declspec(dllimport) double __cdecl tgamma( double _X); __declspec(dllimport) double __cdecl trunc( double _X); __declspec(dllimport) double __cdecl _j0( double _X ); __declspec(dllimport) double __cdecl _j1( double _X ); __declspec(dllimport) double __cdecl _jn(int _X, double _Y); __declspec(dllimport) double __cdecl _y0( double _X); __declspec(dllimport) double __cdecl _y1( double _X); __declspec(dllimport) double __cdecl _yn( int _X, double _Y); __declspec(dllimport) float __cdecl acoshf( float _X); __declspec(dllimport) float __cdecl asinhf( float _X); __declspec(dllimport) float __cdecl atanhf( float _X); __declspec(dllimport) float __cdecl cbrtf( float _X); __declspec(dllimport) float __cdecl _chgsignf( float _X); __declspec(dllimport) float __cdecl copysignf( float _Number, float _Sign); __declspec(dllimport) float __cdecl _copysignf( float _Number, float _Sign); __declspec(dllimport) float __cdecl erff( float _X); __declspec(dllimport) float __cdecl erfcf( float _X); __declspec(dllimport) float __cdecl expm1f( float _X); __declspec(dllimport) float __cdecl exp2f( float _X); __declspec(dllimport) float __cdecl fdimf( float _X, float _Y); __declspec(dllimport) float __cdecl fmaf( float _X, float _Y, float _Z); __declspec(dllimport) float __cdecl fmaxf( float _X, float _Y); __declspec(dllimport) float __cdecl fminf( float _X, float _Y); __declspec(dllimport) float __cdecl _hypotf( float _X, float _Y); __declspec(dllimport) int __cdecl ilogbf( float _X); __declspec(dllimport) float __cdecl lgammaf( float _X); __declspec(dllimport) long long __cdecl llrintf( float _X); __declspec(dllimport) long long __cdecl llroundf( float _X); __declspec(dllimport) float __cdecl log1pf( float _X); __declspec(dllimport) float __cdecl log2f( float _X); __declspec(dllimport) float __cdecl logbf( float _X); __declspec(dllimport) long __cdecl lrintf( float _X); __declspec(dllimport) long __cdecl lroundf( float _X); __declspec(dllimport) float __cdecl nanf( char const* _X); __declspec(dllimport) float __cdecl nearbyintf( float _X); __declspec(dllimport) float __cdecl nextafterf( float _X, float _Y); __declspec(dllimport) float __cdecl nexttowardf( float _X, long double _Y); __declspec(dllimport) float __cdecl remainderf( float _X, float _Y); __declspec(dllimport) float __cdecl remquof( float _X, float _Y, int* _Z); __declspec(dllimport) float __cdecl rintf( float _X); __declspec(dllimport) float __cdecl roundf( float _X); __declspec(dllimport) float __cdecl scalblnf( float _X, long _Y); __declspec(dllimport) float __cdecl scalbnf( float _X, int _Y); __declspec(dllimport) float __cdecl tgammaf( float _X); __declspec(dllimport) float __cdecl truncf( float _X); __declspec(dllimport) float __cdecl _logbf( float _X); __declspec(dllimport) float __cdecl _nextafterf( float _X, float _Y); __declspec(dllimport) int __cdecl _finitef( float _X); __declspec(dllimport) int __cdecl _isnanf( float _X); __declspec(dllimport) int __cdecl _fpclassf( float _X); __declspec(dllimport) int __cdecl _set_FMA3_enable( int _Flag); __declspec(dllimport) int __cdecl _get_FMA3_enable(void); __declspec(dllimport) float __cdecl acosf( float _X); __declspec(dllimport) float __cdecl asinf( float _X); __declspec(dllimport) float __cdecl atan2f( float _Y, float _X); __declspec(dllimport) float __cdecl atanf( float _X); __declspec(dllimport) float __cdecl ceilf( float _X); __declspec(dllimport) float __cdecl cosf( float _X); __declspec(dllimport) float __cdecl coshf( float _X); __declspec(dllimport) float __cdecl expf( float _X); __inline float __cdecl fabsf( float _X) { return (float)fabs(_X); } __declspec(dllimport) float __cdecl floorf( float _X); __declspec(dllimport) float __cdecl fmodf( float _X, float _Y); __inline float __cdecl frexpf( float _X, int *_Y) { return (float)frexp(_X, _Y); } __inline float __cdecl hypotf( float _X, float _Y) { return _hypotf(_X, _Y); } __inline float __cdecl ldexpf( float _X, int _Y) { return (float)ldexp(_X, _Y); } __declspec(dllimport) float __cdecl log10f( float _X); __declspec(dllimport) float __cdecl logf( float _X); __declspec(dllimport) float __cdecl modff( float _X, float *_Y); __declspec(dllimport) float __cdecl powf( float _X, float _Y); __declspec(dllimport) float __cdecl sinf( float _X); __declspec(dllimport) float __cdecl sinhf( float _X); __declspec(dllimport) float __cdecl sqrtf( float _X); __declspec(dllimport) float __cdecl tanf( float _X); __declspec(dllimport) float __cdecl tanhf( float _X); __declspec(dllimport) long double __cdecl acoshl( long double _X); __inline long double __cdecl acosl( long double _X) { return acos((double)_X); } __declspec(dllimport) long double __cdecl asinhl( long double _X); __inline long double __cdecl asinl( long double _X) { return asin((double)_X); } __inline long double __cdecl atan2l( long double _Y, long double _X) { return atan2((double)_Y, (double)_X); } __declspec(dllimport) long double __cdecl atanhl( long double _X); __inline long double __cdecl atanl( long double _X) { return atan((double)_X); } __declspec(dllimport) long double __cdecl cbrtl( long double _X); __inline long double __cdecl ceill( long double _X) { return ceil((double)_X); } __inline long double __cdecl _chgsignl( long double _X) { return _chgsign((double)_X); } __declspec(dllimport) long double __cdecl copysignl( long double _Number, long double _Sign); __inline long double __cdecl _copysignl( long double _Number, long double _Sign) { return _copysign((double)_Number, (double)_Sign); } __inline long double __cdecl coshl( long double _X) { return cosh((double)_X); } __inline long double __cdecl cosl( long double _X) { return cos((double)_X); } __declspec(dllimport) long double __cdecl erfl( long double _X); __declspec(dllimport) long double __cdecl erfcl( long double _X); __inline long double __cdecl expl( long double _X) { return exp((double)_X); } __declspec(dllimport) long double __cdecl exp2l( long double _X); __declspec(dllimport) long double __cdecl expm1l( long double _X); __inline long double __cdecl fabsl( long double _X) { return fabs((double)_X); } __declspec(dllimport) long double __cdecl fdiml( long double _X, long double _Y); __inline long double __cdecl floorl( long double _X) { return floor((double)_X); } __declspec(dllimport) long double __cdecl fmal( long double _X, long double _Y, long double _Z); __declspec(dllimport) long double __cdecl fmaxl( long double _X, long double _Y); __declspec(dllimport) long double __cdecl fminl( long double _X, long double _Y); __inline long double __cdecl fmodl( long double _X, long double _Y) { return fmod((double)_X, (double)_Y); } __inline long double __cdecl frexpl( long double _X, int *_Y) { return frexp((double)_X, _Y); } __declspec(dllimport) int __cdecl ilogbl( long double _X); __inline long double __cdecl _hypotl( long double _X, long double _Y) { return _hypot((double)_X, (double)_Y); } __inline long double __cdecl hypotl( long double _X, long double _Y) { return _hypot((double)_X, (double)_Y); } __inline long double __cdecl ldexpl( long double _X, int _Y) { return ldexp((double)_X, _Y); } __declspec(dllimport) long double __cdecl lgammal( long double _X); __declspec(dllimport) long long __cdecl llrintl( long double _X); __declspec(dllimport) long long __cdecl llroundl( long double _X); __inline long double __cdecl logl( long double _X) { return log((double)_X); } __inline long double __cdecl log10l( long double _X) { return log10((double)_X); } __declspec(dllimport) long double __cdecl log1pl( long double _X); __declspec(dllimport) long double __cdecl log2l( long double _X); __declspec(dllimport) long double __cdecl logbl( long double _X); __declspec(dllimport) long __cdecl lrintl( long double _X); __declspec(dllimport) long __cdecl lroundl( long double _X); __inline long double __cdecl modfl( long double _X, long double* _Y) { double _F, _I; _F = modf((double)_X, &_I); *_Y = _I; return _F; } __declspec(dllimport) long double __cdecl nanl( char const* _X); __declspec(dllimport) long double __cdecl nearbyintl( long double _X); __declspec(dllimport) long double __cdecl nextafterl( long double _X, long double _Y); __declspec(dllimport) long double __cdecl nexttowardl( long double _X, long double _Y); __inline long double __cdecl powl( long double _X, long double _Y) { return pow((double)_X, (double)_Y); } __declspec(dllimport) long double __cdecl remainderl( long double _X, long double _Y); __declspec(dllimport) long double __cdecl remquol( long double _X, long double _Y, int* _Z); __declspec(dllimport) long double __cdecl rintl( long double _X); __declspec(dllimport) long double __cdecl roundl( long double _X); __declspec(dllimport) long double __cdecl scalblnl( long double _X, long _Y); __declspec(dllimport) long double __cdecl scalbnl( long double _X, int _Y); __inline long double __cdecl sinhl( long double _X) { return sinh((double)_X); } __inline long double __cdecl sinl( long double _X) { return sin((double)_X); } __inline long double __cdecl sqrtl( long double _X) { return sqrt((double)_X); } __inline long double __cdecl tanhl( long double _X) { return tanh((double)_X); } __inline long double __cdecl tanl( long double _X) { return tan((double)_X); } __declspec(dllimport) long double __cdecl tgammal( long double _X); __declspec(dllimport) long double __cdecl truncl( long double _X); extern double HUGE; __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_j0" ". See online help for details.")) __declspec(dllimport) double __cdecl j0( double _X); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_j1" ". See online help for details.")) __declspec(dllimport) double __cdecl j1( double _X); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_jn" ". See online help for details.")) __declspec(dllimport) double __cdecl jn( int _X, double _Y); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_y0" ". See online help for details.")) __declspec(dllimport) double __cdecl y0( double _X); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_y1" ". See online help for details.")) __declspec(dllimport) double __cdecl y1( double _X); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_yn" ". See online help for details.")) __declspec(dllimport) double __cdecl yn( int _X, double _Y); } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { __declspec(dllimport) __declspec(allocator) __declspec(restrict) void* __cdecl _calloc_base( size_t _Count, size_t _Size ); __declspec(dllimport) __declspec(allocator) __declspec(restrict) void* __cdecl calloc( size_t _Count, size_t _Size ); __declspec(dllimport) int __cdecl _callnewh( size_t _Size ); __declspec(dllimport) __declspec(allocator) void* __cdecl _expand( void* _Block, size_t _Size ); __declspec(dllimport) void __cdecl _free_base( void* _Block ); __declspec(dllimport) void __cdecl free( void* _Block ); __declspec(dllimport) __declspec(allocator) __declspec(restrict) void* __cdecl _malloc_base( size_t _Size ); __declspec(dllimport) __declspec(allocator) __declspec(restrict) void* __cdecl malloc( size_t _Size ); __declspec(dllimport) size_t __cdecl _msize_base( void* _Block ); __declspec(dllimport) size_t __cdecl _msize( void* _Block ); __declspec(dllimport) __declspec(allocator) __declspec(restrict) void* __cdecl _realloc_base( void* _Block, size_t _Size ); __declspec(dllimport) __declspec(allocator) __declspec(restrict) void* __cdecl realloc( void* _Block, size_t _Size ); __declspec(dllimport) __declspec(allocator) __declspec(restrict) void* __cdecl _recalloc_base( void* _Block, size_t _Count, size_t _Size ); __declspec(dllimport) __declspec(allocator) __declspec(restrict) void* __cdecl _recalloc( void* _Block, size_t _Count, size_t _Size ); __declspec(dllimport) void __cdecl _aligned_free( void* _Block ); __declspec(dllimport) __declspec(allocator) __declspec(restrict) void* __cdecl _aligned_malloc( size_t _Size, size_t _Alignment ); __declspec(dllimport) __declspec(allocator) __declspec(restrict) void* __cdecl _aligned_offset_malloc( size_t _Size, size_t _Alignment, size_t _Offset ); __declspec(dllimport) size_t __cdecl _aligned_msize( void* _Block, size_t _Alignment, size_t _Offset ); __declspec(dllimport) __declspec(allocator) __declspec(restrict) void* __cdecl _aligned_offset_realloc( void* _Block, size_t _Size, size_t _Alignment, size_t _Offset ); __declspec(dllimport) __declspec(allocator) __declspec(restrict) void* __cdecl _aligned_offset_recalloc( void* _Block, size_t _Count, size_t _Size, size_t _Alignment, size_t _Offset ); __declspec(dllimport) __declspec(allocator) __declspec(restrict) void* __cdecl _aligned_realloc( void* _Block, size_t _Size, size_t _Alignment ); __declspec(dllimport) __declspec(allocator) __declspec(restrict) void* __cdecl _aligned_recalloc( void* _Block, size_t _Count, size_t _Size, size_t _Alignment ); } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { typedef int (__cdecl* _CoreCrtSecureSearchSortCompareFunction)(void*, void const*, void const*); typedef int (__cdecl* _CoreCrtNonSecureSearchSortCompareFunction)(void const*, void const*); __declspec(dllimport) void* __cdecl bsearch_s( void const* _Key, void const* _Base, rsize_t _NumOfElements, rsize_t _SizeOfElements, _CoreCrtSecureSearchSortCompareFunction _CompareFunction, void* _Context ); __declspec(dllimport) void __cdecl qsort_s( void* _Base, rsize_t _NumOfElements, rsize_t _SizeOfElements, _CoreCrtSecureSearchSortCompareFunction _CompareFunction, void* _Context ); __declspec(dllimport) void* __cdecl bsearch( void const* _Key, void const* _Base, size_t _NumOfElements, size_t _SizeOfElements, _CoreCrtNonSecureSearchSortCompareFunction _CompareFunction ); __declspec(dllimport) void __cdecl qsort( void* _Base, size_t _NumOfElements, size_t _SizeOfElements, _CoreCrtNonSecureSearchSortCompareFunction _CompareFunction ); __declspec(dllimport) void* __cdecl _lfind_s( void const* _Key, void const* _Base, unsigned int* _NumOfElements, size_t _SizeOfElements, _CoreCrtSecureSearchSortCompareFunction _CompareFunction, void* _Context ); __declspec(dllimport) void* __cdecl _lfind( void const* _Key, void const* _Base, unsigned int* _NumOfElements, unsigned int _SizeOfElements, _CoreCrtNonSecureSearchSortCompareFunction _CompareFunction ); __declspec(dllimport) void* __cdecl _lsearch_s( void const* _Key, void* _Base, unsigned int* _NumOfElements, size_t _SizeOfElements, _CoreCrtSecureSearchSortCompareFunction _CompareFunction, void* _Context ); __declspec(dllimport) void* __cdecl _lsearch( void const* _Key, void* _Base, unsigned int* _NumOfElements, unsigned int _SizeOfElements, _CoreCrtNonSecureSearchSortCompareFunction _CompareFunction ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_lfind" ". See online help for details.")) __declspec(dllimport) void* __cdecl lfind( void const* _Key, void const* _Base, unsigned int* _NumOfElements, unsigned int _SizeOfElements, _CoreCrtNonSecureSearchSortCompareFunction _CompareFunction ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_lsearch" ". See online help for details.")) __declspec(dllimport) void* __cdecl lsearch( void const* _Key, void* _Base, unsigned int* _NumOfElements, unsigned int _SizeOfElements, _CoreCrtNonSecureSearchSortCompareFunction _CompareFunction ); } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { __declspec(dllimport) errno_t __cdecl _itow_s( int _Value, wchar_t* _Buffer, size_t _BufferCount, int _Radix ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _itow_s( int _Value, wchar_t (&_Buffer)[_Size], int _Radix) throw() { return _itow_s(_Value, _Buffer, _Size, _Radix); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_itow_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl _itow( int _Value, wchar_t *_Buffer, int _Radix); __declspec(dllimport) errno_t __cdecl _ltow_s( long _Value, wchar_t* _Buffer, size_t _BufferCount, int _Radix ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _ltow_s( long _Value, wchar_t (&_Buffer)[_Size], int _Radix) throw() { return _ltow_s(_Value, _Buffer, _Size, _Radix); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_ltow_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl _ltow( long _Value, wchar_t *_Buffer, int _Radix); __declspec(dllimport) errno_t __cdecl _ultow_s( unsigned long _Value, wchar_t* _Buffer, size_t _BufferCount, int _Radix ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _ultow_s( unsigned long _Value, wchar_t (&_Buffer)[_Size], int _Radix) throw() { return _ultow_s(_Value, _Buffer, _Size, _Radix); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_ultow_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl _ultow( unsigned long _Value, wchar_t *_Buffer, int _Radix); __declspec(dllimport) double __cdecl wcstod( wchar_t const* _String, wchar_t** _EndPtr ); __declspec(dllimport) double __cdecl _wcstod_l( wchar_t const* _String, wchar_t** _EndPtr, _locale_t _Locale ); __declspec(dllimport) long __cdecl wcstol( wchar_t const* _String, wchar_t** _EndPtr, int _Radix ); __declspec(dllimport) long __cdecl _wcstol_l( wchar_t const* _String, wchar_t** _EndPtr, int _Radix, _locale_t _Locale ); __declspec(dllimport) long long __cdecl wcstoll( wchar_t const* _String, wchar_t** _EndPtr, int _Radix ); __declspec(dllimport) long long __cdecl _wcstoll_l( wchar_t const* _String, wchar_t** _EndPtr, int _Radix, _locale_t _Locale ); __declspec(dllimport) unsigned long __cdecl wcstoul( wchar_t const* _String, wchar_t** _EndPtr, int _Radix ); __declspec(dllimport) unsigned long __cdecl _wcstoul_l( wchar_t const* _String, wchar_t** _EndPtr, int _Radix, _locale_t _Locale ); __declspec(dllimport) unsigned long long __cdecl wcstoull( wchar_t const* _String, wchar_t** _EndPtr, int _Radix ); __declspec(dllimport) unsigned long long __cdecl _wcstoull_l( wchar_t const* _String, wchar_t** _EndPtr, int _Radix, _locale_t _Locale ); __declspec(dllimport) long double __cdecl wcstold( wchar_t const* _String, wchar_t** _EndPtr ); __declspec(dllimport) long double __cdecl _wcstold_l( wchar_t const* _String, wchar_t** _EndPtr, _locale_t _Locale ); __declspec(dllimport) float __cdecl wcstof( wchar_t const* _String, wchar_t** _EndPtr ); __declspec(dllimport) float __cdecl _wcstof_l( wchar_t const* _String, wchar_t** _EndPtr, _locale_t _Locale ); __declspec(dllimport) double __cdecl _wtof( wchar_t const* _String ); __declspec(dllimport) double __cdecl _wtof_l( wchar_t const* _String, _locale_t _Locale ); __declspec(dllimport) int __cdecl _wtoi( wchar_t const* _String ); __declspec(dllimport) int __cdecl _wtoi_l( wchar_t const* _String, _locale_t _Locale ); __declspec(dllimport) long __cdecl _wtol( wchar_t const* _String ); __declspec(dllimport) long __cdecl _wtol_l( wchar_t const* _String, _locale_t _Locale ); __declspec(dllimport) long long __cdecl _wtoll( wchar_t const* _String ); __declspec(dllimport) long long __cdecl _wtoll_l( wchar_t const* _String, _locale_t _Locale ); __declspec(dllimport) errno_t __cdecl _i64tow_s( __int64 _Value, wchar_t* _Buffer, size_t _BufferCount, int _Radix ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_i64tow_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl _i64tow( __int64 _Value, wchar_t* _Buffer, int _Radix ); __declspec(dllimport) errno_t __cdecl _ui64tow_s( unsigned __int64 _Value, wchar_t* _Buffer, size_t _BufferCount, int _Radix ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_ui64tow_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl _ui64tow( unsigned __int64 _Value, wchar_t* _Buffer, int _Radix ); __declspec(dllimport) __int64 __cdecl _wtoi64( wchar_t const* _String ); __declspec(dllimport) __int64 __cdecl _wtoi64_l( wchar_t const* _String, _locale_t _Locale ); __declspec(dllimport) __int64 __cdecl _wcstoi64( wchar_t const* _String, wchar_t** _EndPtr, int _Radix ); __declspec(dllimport) __int64 __cdecl _wcstoi64_l( wchar_t const* _String, wchar_t** _EndPtr, int _Radix, _locale_t _Locale ); __declspec(dllimport) unsigned __int64 __cdecl _wcstoui64( wchar_t const* _String, wchar_t** _EndPtr, int _Radix ); __declspec(dllimport) unsigned __int64 __cdecl _wcstoui64_l( wchar_t const* _String, wchar_t** _EndPtr, int _Radix, _locale_t _Locale ); __declspec(dllimport) __declspec(allocator) wchar_t* __cdecl _wfullpath( wchar_t* _Buffer, wchar_t const* _Path, size_t _BufferCount ); __declspec(dllimport) errno_t __cdecl _wmakepath_s( wchar_t* _Buffer, size_t _BufferCount, wchar_t const* _Drive, wchar_t const* _Dir, wchar_t const* _Filename, wchar_t const* _Ext ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _wmakepath_s(wchar_t (&_Buffer)[_Size], wchar_t const* _Drive, wchar_t const* _Dir, wchar_t const* _Filename, wchar_t const* _Ext) throw() { return _wmakepath_s(_Buffer, _Size, _Drive, _Dir, _Filename, _Ext); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wmakepath_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) void __cdecl _wmakepath( wchar_t *_Buffer, wchar_t const* _Drive, wchar_t const* _Dir, wchar_t const* _Filename, wchar_t const* _Ext); __declspec(dllimport) void __cdecl _wperror( wchar_t const* _ErrorMessage ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wsplitpath_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) void __cdecl _wsplitpath( wchar_t const* _FullPath, wchar_t* _Drive, wchar_t* _Dir, wchar_t* _Filename, wchar_t* _Ext ); __declspec(dllimport) errno_t __cdecl _wsplitpath_s( wchar_t const* _FullPath, wchar_t* _Drive, size_t _DriveCount, wchar_t* _Dir, size_t _DirCount, wchar_t* _Filename, size_t _FilenameCount, wchar_t* _Ext, size_t _ExtCount ); extern "C++" { template <size_t _DriveSize, size_t _DirSize, size_t _NameSize, size_t _ExtSize> inline errno_t __cdecl _wsplitpath_s( wchar_t const* _Path, wchar_t (&_Drive)[_DriveSize], wchar_t (&_Dir)[_DirSize], wchar_t (&_Name)[_NameSize], wchar_t (&_Ext)[_ExtSize] ) throw() { return _wsplitpath_s(_Path, _Drive, _DriveSize, _Dir, _DirSize, _Name, _NameSize, _Ext, _ExtSize); } } __declspec(dllimport) errno_t __cdecl _wdupenv_s( wchar_t** _Buffer, size_t* _BufferCount, wchar_t const* _VarName ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wdupenv_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl _wgetenv( wchar_t const* _VarName ); __declspec(dllimport) errno_t __cdecl _wgetenv_s( size_t* _RequiredCount, wchar_t* _Buffer, size_t _BufferCount, wchar_t const* _VarName ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _wgetenv_s( size_t* _RequiredCount, wchar_t (&_Buffer)[_Size], wchar_t const* _VarName) throw() { return _wgetenv_s(_RequiredCount, _Buffer, _Size, _VarName); } } __declspec(dllimport) int __cdecl _wputenv( wchar_t const* _EnvString ); __declspec(dllimport) errno_t __cdecl _wputenv_s( wchar_t const* _Name, wchar_t const* _Value ); __declspec(dllimport) errno_t __cdecl _wsearchenv_s( wchar_t const* _Filename, wchar_t const* _VarName, wchar_t* _Buffer, size_t _BufferCount ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _wsearchenv_s( wchar_t const* _Filename, wchar_t const* _VarName, wchar_t (&_ResultPath)[_Size]) throw() { return _wsearchenv_s(_Filename, _VarName, _ResultPath, _Size); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wsearchenv_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) void __cdecl _wsearchenv( wchar_t const* _Filename, wchar_t const* _VarName, wchar_t *_ResultPath); __declspec(dllimport) int __cdecl _wsystem( wchar_t const* _Command ); } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4514 4820 ) __pragma(pack(push, 8)) extern "C" { } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { __declspec(dllimport) void __cdecl _swab( char* _Buf1, char* _Buf2, int _SizeInBytes ); __declspec(dllimport) __declspec(noreturn) void __cdecl exit( int _Code); __declspec(dllimport) __declspec(noreturn) void __cdecl _exit( int _Code); __declspec(dllimport) __declspec(noreturn) void __cdecl _Exit( int _Code); __declspec(dllimport) __declspec(noreturn) void __cdecl quick_exit( int _Code); __declspec(dllimport) __declspec(noreturn) void __cdecl abort(void); __declspec(dllimport) unsigned int __cdecl _set_abort_behavior( unsigned int _Flags, unsigned int _Mask ); typedef int (__cdecl* _onexit_t)(void); int __cdecl atexit(void (__cdecl*)(void)); _onexit_t __cdecl _onexit( _onexit_t _Func); int __cdecl at_quick_exit(void (__cdecl*)(void)); typedef void (__cdecl* _purecall_handler)(void); typedef void (__cdecl* _invalid_parameter_handler)( wchar_t const*, wchar_t const*, wchar_t const*, unsigned int, uintptr_t ); _purecall_handler __cdecl _set_purecall_handler( _purecall_handler _Handler ); _purecall_handler __cdecl _get_purecall_handler(void); __declspec(dllimport) _invalid_parameter_handler __cdecl _set_invalid_parameter_handler( _invalid_parameter_handler _Handler ); __declspec(dllimport) _invalid_parameter_handler __cdecl _get_invalid_parameter_handler(void); __declspec(dllimport) _invalid_parameter_handler __cdecl _set_thread_local_invalid_parameter_handler( _invalid_parameter_handler _Handler ); __declspec(dllimport) _invalid_parameter_handler __cdecl _get_thread_local_invalid_parameter_handler(void); __declspec(dllimport) int __cdecl _set_error_mode( int _Mode); __declspec(dllimport) int* __cdecl _errno(void); __declspec(dllimport) errno_t __cdecl _set_errno( int _Value); __declspec(dllimport) errno_t __cdecl _get_errno( int* _Value); __declspec(dllimport) unsigned long* __cdecl __doserrno(void); __declspec(dllimport) errno_t __cdecl _set_doserrno( unsigned long _Value); __declspec(dllimport) errno_t __cdecl _get_doserrno( unsigned long * _Value); __declspec(dllimport) __declspec(deprecated("This function or variable may be unsafe. Consider using " "strerror" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char** __cdecl __sys_errlist(void); __declspec(dllimport) __declspec(deprecated("This function or variable may be unsafe. Consider using " "strerror" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) int * __cdecl __sys_nerr(void); __declspec(dllimport) void __cdecl perror( char const* _ErrMsg); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_get_pgmptr" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char** __cdecl __p__pgmptr (void); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_get_wpgmptr" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t** __cdecl __p__wpgmptr(void); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_get_fmode" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) int* __cdecl __p__fmode (void); __declspec(dllimport) errno_t __cdecl _get_pgmptr ( char** _Value); __declspec(dllimport) errno_t __cdecl _get_wpgmptr( wchar_t** _Value); __declspec(dllimport) errno_t __cdecl _set_fmode ( int _Mode ); __declspec(dllimport) errno_t __cdecl _get_fmode ( int* _PMode); typedef struct _div_t { int quot; int rem; } div_t; typedef struct _ldiv_t { long quot; long rem; } ldiv_t; typedef struct _lldiv_t { long long quot; long long rem; } lldiv_t; int __cdecl abs ( int _Number); long __cdecl labs ( long _Number); long long __cdecl llabs ( long long _Number); __int64 __cdecl _abs64( __int64 _Number); unsigned short __cdecl _byteswap_ushort( unsigned short _Number); unsigned long __cdecl _byteswap_ulong ( unsigned long _Number); unsigned __int64 __cdecl _byteswap_uint64( unsigned __int64 _Number); __declspec(dllimport) div_t __cdecl div ( int _Numerator, int _Denominator); __declspec(dllimport) ldiv_t __cdecl ldiv ( long _Numerator, long _Denominator); __declspec(dllimport) lldiv_t __cdecl lldiv( long long _Numerator, long long _Denominator); #pragma warning(push) #pragma warning(disable: 6540) unsigned int __cdecl _rotl( unsigned int _Value, int _Shift ); unsigned long __cdecl _lrotl( unsigned long _Value, int _Shift ); unsigned __int64 __cdecl _rotl64( unsigned __int64 _Value, int _Shift ); unsigned int __cdecl _rotr( unsigned int _Value, int _Shift ); unsigned long __cdecl _lrotr( unsigned long _Value, int _Shift ); unsigned __int64 __cdecl _rotr64( unsigned __int64 _Value, int _Shift ); #pragma warning(pop) __declspec(dllimport) void __cdecl srand( unsigned int _Seed); __declspec(dllimport) int __cdecl rand(void); extern "C++" { inline long abs(long const _X) throw() { return labs(_X); } inline long long abs(long long const _X) throw() { return llabs(_X); } inline ldiv_t div(long const _A1, long const _A2) throw() { return ldiv(_A1, _A2); } inline lldiv_t div(long long const _A1, long long const _A2) throw() { return lldiv(_A1, _A2); } } #pragma pack(push, 4) typedef struct { unsigned char ld[10]; } _LDOUBLE; #pragma pack(pop) typedef struct { double x; } _CRT_DOUBLE; typedef struct { float f; } _CRT_FLOAT; typedef struct { long double x; } _LONGDOUBLE; #pragma pack(push, 4) typedef struct { unsigned char ld12[12]; } _LDBL12; #pragma pack(pop) __declspec(dllimport) double __cdecl atof ( char const* _String); __declspec(dllimport) int __cdecl atoi ( char const* _String); __declspec(dllimport) long __cdecl atol ( char const* _String); __declspec(dllimport) long long __cdecl atoll ( char const* _String); __declspec(dllimport) __int64 __cdecl _atoi64( char const* _String); __declspec(dllimport) double __cdecl _atof_l ( char const* _String, _locale_t _Locale); __declspec(dllimport) int __cdecl _atoi_l ( char const* _String, _locale_t _Locale); __declspec(dllimport) long __cdecl _atol_l ( char const* _String, _locale_t _Locale); __declspec(dllimport) long long __cdecl _atoll_l ( char const* _String, _locale_t _Locale); __declspec(dllimport) __int64 __cdecl _atoi64_l( char const* _String, _locale_t _Locale); __declspec(dllimport) int __cdecl _atoflt ( _CRT_FLOAT* _Result, char const* _String); __declspec(dllimport) int __cdecl _atodbl ( _CRT_DOUBLE* _Result, char* _String); __declspec(dllimport) int __cdecl _atoldbl( _LDOUBLE* _Result, char* _String); __declspec(dllimport) int __cdecl _atoflt_l( _CRT_FLOAT* _Result, char const* _String, _locale_t _Locale ); __declspec(dllimport) int __cdecl _atodbl_l( _CRT_DOUBLE* _Result, char* _String, _locale_t _Locale ); __declspec(dllimport) int __cdecl _atoldbl_l( _LDOUBLE* _Result, char* _String, _locale_t _Locale ); __declspec(dllimport) float __cdecl strtof( char const* _String, char** _EndPtr ); __declspec(dllimport) float __cdecl _strtof_l( char const* _String, char** _EndPtr, _locale_t _Locale ); __declspec(dllimport) double __cdecl strtod( char const* _String, char** _EndPtr ); __declspec(dllimport) double __cdecl _strtod_l( char const* _String, char** _EndPtr, _locale_t _Locale ); __declspec(dllimport) long double __cdecl strtold( char const* _String, char** _EndPtr ); __declspec(dllimport) long double __cdecl _strtold_l( char const* _String, char** _EndPtr, _locale_t _Locale ); __declspec(dllimport) long __cdecl strtol( char const* _String, char** _EndPtr, int _Radix ); __declspec(dllimport) long __cdecl _strtol_l( char const* _String, char** _EndPtr, int _Radix, _locale_t _Locale ); __declspec(dllimport) long long __cdecl strtoll( char const* _String, char** _EndPtr, int _Radix ); __declspec(dllimport) long long __cdecl _strtoll_l( char const* _String, char** _EndPtr, int _Radix, _locale_t _Locale ); __declspec(dllimport) unsigned long __cdecl strtoul( char const* _String, char** _EndPtr, int _Radix ); __declspec(dllimport) unsigned long __cdecl _strtoul_l( char const* _String, char** _EndPtr, int _Radix, _locale_t _Locale ); __declspec(dllimport) unsigned long long __cdecl strtoull( char const* _String, char** _EndPtr, int _Radix ); __declspec(dllimport) unsigned long long __cdecl _strtoull_l( char const* _String, char** _EndPtr, int _Radix, _locale_t _Locale ); __declspec(dllimport) __int64 __cdecl _strtoi64( char const* _String, char** _EndPtr, int _Radix ); __declspec(dllimport) __int64 __cdecl _strtoi64_l( char const* _String, char** _EndPtr, int _Radix, _locale_t _Locale ); __declspec(dllimport) unsigned __int64 __cdecl _strtoui64( char const* _String, char** _EndPtr, int _Radix ); __declspec(dllimport) unsigned __int64 __cdecl _strtoui64_l( char const* _String, char** _EndPtr, int _Radix, _locale_t _Locale ); __declspec(dllimport) errno_t __cdecl _itoa_s( int _Value, char* _Buffer, size_t _BufferCount, int _Radix ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _itoa_s( int _Value, char (&_Buffer)[_Size], int _Radix) throw() { return _itoa_s(_Value, _Buffer, _Size, _Radix); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_itoa_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl _itoa( int _Value, char *_Buffer, int _Radix); __declspec(dllimport) errno_t __cdecl _ltoa_s( long _Value, char* _Buffer, size_t _BufferCount, int _Radix ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _ltoa_s( long _Value, char (&_Buffer)[_Size], int _Radix) throw() { return _ltoa_s(_Value, _Buffer, _Size, _Radix); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_ltoa_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl _ltoa( long _Value, char *_Buffer, int _Radix); __declspec(dllimport) errno_t __cdecl _ultoa_s( unsigned long _Value, char* _Buffer, size_t _BufferCount, int _Radix ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _ultoa_s( unsigned long _Value, char (&_Buffer)[_Size], int _Radix) throw() { return _ultoa_s(_Value, _Buffer, _Size, _Radix); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_ultoa_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl _ultoa( unsigned long _Value, char *_Buffer, int _Radix); __declspec(dllimport) errno_t __cdecl _i64toa_s( __int64 _Value, char* _Buffer, size_t _BufferCount, int _Radix ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_i64toa_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl _i64toa( __int64 _Value, char* _Buffer, int _Radix ); __declspec(dllimport) errno_t __cdecl _ui64toa_s( unsigned __int64 _Value, char* _Buffer, size_t _BufferCount, int _Radix ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_ui64toa_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl _ui64toa( unsigned __int64 _Value, char* _Buffer, int _Radix ); __declspec(dllimport) errno_t __cdecl _ecvt_s( char* _Buffer, size_t _BufferCount, double _Value, int _DigitCount, int* _PtDec, int* _PtSign ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _ecvt_s(char (&_Buffer)[_Size], double _Value, int _DigitCount, int* _PtDec, int* _PtSign) throw() { return _ecvt_s(_Buffer, _Size, _Value, _DigitCount, _PtDec, _PtSign); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_ecvt_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl _ecvt( double _Value, int _DigitCount, int* _PtDec, int* _PtSign ); __declspec(dllimport) errno_t __cdecl _fcvt_s( char* _Buffer, size_t _BufferCount, double _Value, int _FractionalDigitCount, int* _PtDec, int* _PtSign ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _fcvt_s(char (&_Buffer)[_Size], double _Value, int _FractionalDigitCount, int* _PtDec, int* _PtSign) throw() { return _fcvt_s(_Buffer, _Size, _Value, _FractionalDigitCount, _PtDec, _PtSign); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_fcvt_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl _fcvt( double _Value, int _FractionalDigitCount, int* _PtDec, int* _PtSign ); __declspec(dllimport) errno_t __cdecl _gcvt_s( char* _Buffer, size_t _BufferCount, double _Value, int _DigitCount ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _gcvt_s(char (&_Buffer)[_Size], double _Value, int _DigitCount) throw() { return _gcvt_s(_Buffer, _Size, _Value, _DigitCount); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_gcvt_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl _gcvt( double _Value, int _DigitCount, char* _Buffer ); __declspec(dllimport) int __cdecl ___mb_cur_max_func(void); __declspec(dllimport) int __cdecl ___mb_cur_max_l_func(_locale_t _Locale); __declspec(dllimport) int __cdecl mblen( char const* _Ch, size_t _MaxCount ); __declspec(dllimport) int __cdecl _mblen_l( char const* _Ch, size_t _MaxCount, _locale_t _Locale ); __declspec(dllimport) size_t __cdecl _mbstrlen( char const* _String ); __declspec(dllimport) size_t __cdecl _mbstrlen_l( char const* _String, _locale_t _Locale ); __declspec(dllimport) size_t __cdecl _mbstrnlen( char const* _String, size_t _MaxCount ); __declspec(dllimport) size_t __cdecl _mbstrnlen_l( char const* _String, size_t _MaxCount, _locale_t _Locale ); __declspec(dllimport) int __cdecl mbtowc( wchar_t* _DstCh, char const* _SrcCh, size_t _SrcSizeInBytes ); __declspec(dllimport) int __cdecl _mbtowc_l( wchar_t* _DstCh, char const* _SrcCh, size_t _SrcSizeInBytes, _locale_t _Locale ); __declspec(dllimport) errno_t __cdecl mbstowcs_s( size_t* _PtNumOfCharConverted, wchar_t* _DstBuf, size_t _SizeInWords, char const* _SrcBuf, size_t _MaxCount ); extern "C++" { template <size_t _Size> inline errno_t __cdecl mbstowcs_s( size_t* _PtNumOfCharConverted, wchar_t (&_Dest)[_Size], char const* _Source, size_t _MaxCount) throw() { return mbstowcs_s(_PtNumOfCharConverted, _Dest, _Size, _Source, _MaxCount); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "mbstowcs_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) size_t __cdecl mbstowcs( wchar_t *_Dest, char const* _Source, size_t _MaxCount); __declspec(dllimport) errno_t __cdecl _mbstowcs_s_l( size_t* _PtNumOfCharConverted, wchar_t* _DstBuf, size_t _SizeInWords, char const* _SrcBuf, size_t _MaxCount, _locale_t _Locale ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _mbstowcs_s_l( size_t* _PtNumOfCharConverted, wchar_t (&_Dest)[_Size], char const* _Source, size_t _MaxCount, _locale_t _Locale) throw() { return _mbstowcs_s_l(_PtNumOfCharConverted, _Dest, _Size, _Source, _MaxCount, _Locale); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_mbstowcs_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) size_t __cdecl _mbstowcs_l( wchar_t *_Dest, char const* _Source, size_t _MaxCount, _locale_t _Locale); __declspec(deprecated("This function or variable may be unsafe. Consider using " "wctomb_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) int __cdecl wctomb( char* _MbCh, wchar_t _WCh ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wctomb_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) int __cdecl _wctomb_l( char* _MbCh, wchar_t _WCh, _locale_t _Locale ); __declspec(dllimport) errno_t __cdecl wctomb_s( int* _SizeConverted, char* _MbCh, rsize_t _SizeInBytes, wchar_t _WCh ); __declspec(dllimport) errno_t __cdecl _wctomb_s_l( int* _SizeConverted, char* _MbCh, size_t _SizeInBytes, wchar_t _WCh, _locale_t _Locale); __declspec(dllimport) errno_t __cdecl wcstombs_s( size_t* _PtNumOfCharConverted, char* _Dst, size_t _DstSizeInBytes, wchar_t const* _Src, size_t _MaxCountInBytes ); extern "C++" { template <size_t _Size> inline errno_t __cdecl wcstombs_s( size_t* _PtNumOfCharConverted, char (&_Dest)[_Size], wchar_t const* _Source, size_t _MaxCount) throw() { return wcstombs_s(_PtNumOfCharConverted, _Dest, _Size, _Source, _MaxCount); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "wcstombs_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) size_t __cdecl wcstombs( char *_Dest, wchar_t const* _Source, size_t _MaxCount); __declspec(dllimport) errno_t __cdecl _wcstombs_s_l( size_t* _PtNumOfCharConverted, char* _Dst, size_t _DstSizeInBytes, wchar_t const* _Src, size_t _MaxCountInBytes, _locale_t _Locale ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _wcstombs_s_l( size_t* _PtNumOfCharConverted, char (&_Dest)[_Size], wchar_t const* _Source, size_t _MaxCount, _locale_t _Locale) throw() { return _wcstombs_s_l(_PtNumOfCharConverted, _Dest, _Size, _Source, _MaxCount, _Locale); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcstombs_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) size_t __cdecl _wcstombs_l( char *_Dest, wchar_t const* _Source, size_t _MaxCount, _locale_t _Locale); __declspec(dllimport) __declspec(allocator) char* __cdecl _fullpath( char* _Buffer, char const* _Path, size_t _BufferCount ); __declspec(dllimport) errno_t __cdecl _makepath_s( char* _Buffer, size_t _BufferCount, char const* _Drive, char const* _Dir, char const* _Filename, char const* _Ext ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _makepath_s(char (&_Buffer)[_Size], char const* _Drive, char const* _Dir, char const* _Filename, char const* _Ext) throw() { return _makepath_s(_Buffer, _Size, _Drive, _Dir, _Filename, _Ext); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_makepath_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) void __cdecl _makepath( char *_Buffer, char const* _Drive, char const* _Dir, char const* _Filename, char const* _Ext); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_splitpath_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) void __cdecl _splitpath( char const* _FullPath, char* _Drive, char* _Dir, char* _Filename, char* _Ext ); __declspec(dllimport) errno_t __cdecl _splitpath_s( char const* _FullPath, char* _Drive, size_t _DriveCount, char* _Dir, size_t _DirCount, char* _Filename, size_t _FilenameCount, char* _Ext, size_t _ExtCount ); extern "C++" { template <size_t _DriveSize, size_t _DirSize, size_t _NameSize, size_t _ExtSize> inline errno_t __cdecl _splitpath_s( char const* _Dest, char (&_Drive)[_DriveSize], char (&_Dir)[_DirSize], char (&_Name)[_NameSize], char (&_Ext)[_ExtSize] ) throw() { return _splitpath_s(_Dest, _Drive, _DriveSize, _Dir, _DirSize, _Name, _NameSize, _Ext, _ExtSize); } } __declspec(dllimport) errno_t __cdecl getenv_s( size_t* _RequiredCount, char* _Buffer, rsize_t _BufferCount, char const* _VarName ); __declspec(dllimport) int* __cdecl __p___argc (void); __declspec(dllimport) char*** __cdecl __p___argv (void); __declspec(dllimport) wchar_t*** __cdecl __p___wargv(void); __declspec(dllimport) char*** __cdecl __p__environ (void); __declspec(dllimport) wchar_t*** __cdecl __p__wenviron(void); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_dupenv_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl getenv( char const* _VarName ); extern "C++" { template <size_t _Size> inline errno_t __cdecl getenv_s( size_t* _RequiredCount, char (&_Buffer)[_Size], char const* _VarName) throw() { return getenv_s(_RequiredCount, _Buffer, _Size, _VarName); } } __declspec(dllimport) errno_t __cdecl _dupenv_s( char** _Buffer, size_t* _BufferCount, char const* _VarName ); __declspec(dllimport) int __cdecl system( char const* _Command ); #pragma warning(push) #pragma warning(disable: 6540) __declspec(dllimport) int __cdecl _putenv( char const* _EnvString ); __declspec(dllimport) errno_t __cdecl _putenv_s( char const* _Name, char const* _Value ); #pragma warning(pop) __declspec(dllimport) errno_t __cdecl _searchenv_s( char const* _Filename, char const* _VarName, char* _Buffer, size_t _BufferCount ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _searchenv_s( char const* _Filename, char const* _VarName, char (&_Buffer)[_Size]) throw() { return _searchenv_s(_Filename, _VarName, _Buffer, _Size); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_searchenv_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) void __cdecl _searchenv( char const* _Filename, char const* _VarName, char *_Buffer); __declspec(deprecated("This function or variable has been superceded by newer library " "or operating system functionality. Consider using " "SetErrorMode" " " "instead. See online help for details.")) __declspec(dllimport) void __cdecl _seterrormode( int _Mode ); __declspec(deprecated("This function or variable has been superceded by newer library " "or operating system functionality. Consider using " "Beep" " " "instead. See online help for details.")) __declspec(dllimport) void __cdecl _beep( unsigned _Frequency, unsigned _Duration ); __declspec(deprecated("This function or variable has been superceded by newer library " "or operating system functionality. Consider using " "Sleep" " " "instead. See online help for details.")) __declspec(dllimport) void __cdecl _sleep( unsigned long _Duration ); #pragma warning(push) #pragma warning(disable: 4141) __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_ecvt" ". See online help for details.")) __declspec(deprecated("This function or variable may be unsafe. Consider using " "_ecvt_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl ecvt( double _Value, int _DigitCount, int* _PtDec, int* _PtSign ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fcvt" ". See online help for details.")) __declspec(deprecated("This function or variable may be unsafe. Consider using " "_fcvt_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl fcvt( double _Value, int _FractionalDigitCount, int* _PtDec, int* _PtSign ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_gcvt" ". See online help for details.")) __declspec(deprecated("This function or variable may be unsafe. Consider using " "_fcvt_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl gcvt( double _Value, int _DigitCount, char* _DstBuf ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_itoa" ". See online help for details.")) __declspec(deprecated("This function or variable may be unsafe. Consider using " "_itoa_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl itoa( int _Value, char* _Buffer, int _Radix ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_ltoa" ". See online help for details.")) __declspec(deprecated("This function or variable may be unsafe. Consider using " "_ltoa_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl ltoa( long _Value, char* _Buffer, int _Radix ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_swab" ". See online help for details.")) __declspec(dllimport) void __cdecl swab( char* _Buf1, char* _Buf2, int _SizeInBytes ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_ultoa" ". See online help for details.")) __declspec(deprecated("This function or variable may be unsafe. Consider using " "_ultoa_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl ultoa( unsigned long _Value, char* _Buffer, int _Radix ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_putenv" ". See online help for details.")) __declspec(dllimport) int __cdecl putenv( char const* _EnvString ); #pragma warning(pop) _onexit_t __cdecl onexit( _onexit_t _Func); } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) [[nodiscard]] inline double abs( double _Xx) noexcept { return :: fabs(_Xx); } [[nodiscard]] inline float abs( float _Xx) noexcept { return :: fabsf(_Xx); } [[nodiscard]] inline long double abs( long double _Xx) noexcept { return :: fabsl(_Xx); } namespace std { using :: size_t; using :: div_t; using :: ldiv_t; using :: abort; using :: abs; using :: atexit; using :: atof; using :: atoi; using :: atol; using :: bsearch; using :: calloc; using :: div; using :: exit; using :: free; using :: labs; using :: ldiv; using :: malloc; using :: mblen; using :: mbstowcs; using :: mbtowc; using :: qsort; using :: rand; using :: realloc; using :: srand; using :: strtod; using :: strtol; using :: strtoul; using :: wcstombs; using :: wctomb; using :: lldiv_t; using :: getenv; using :: system; using :: atoll; using :: llabs; using :: lldiv; using :: strtof; using :: strtold; using :: strtoll; using :: strtoull; using :: _Exit; using :: at_quick_exit; using :: quick_exit; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { template <class _Elem> class initializer_list { public: using value_type = _Elem; using reference = const _Elem&; using const_reference = const _Elem&; using size_type = size_t; using iterator = const _Elem*; using const_iterator = const _Elem*; constexpr initializer_list() noexcept : _First(nullptr), _Last(nullptr) {} constexpr initializer_list(const _Elem* _First_arg, const _Elem* _Last_arg) noexcept : _First(_First_arg), _Last(_Last_arg) {} [[nodiscard]] constexpr const _Elem* begin() const noexcept { return _First; } [[nodiscard]] constexpr const _Elem* end() const noexcept { return _Last; } [[nodiscard]] constexpr size_t size() const noexcept { return static_cast<size_t>(_Last - _First); } private: const _Elem* _First; const _Elem* _Last; }; template <class _Elem> [[nodiscard]] constexpr const _Elem* begin(initializer_list<_Elem> _Ilist) noexcept { return _Ilist.begin(); } template <class _Elem> [[nodiscard]] constexpr const _Elem* end(initializer_list<_Elem> _Ilist) noexcept { return _Ilist.end(); } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { template <class> inline constexpr bool _Always_false = false; template <class _Ty = void> struct plus { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_first_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_second_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_result; [[nodiscard]] constexpr _Ty operator()(const _Ty& _Left, const _Ty& _Right) const { return _Left + _Right; } }; template <class _Ty = void> struct minus { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_first_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_second_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_result; [[nodiscard]] constexpr _Ty operator()(const _Ty& _Left, const _Ty& _Right) const { return _Left - _Right; } }; template <class _Ty = void> struct multiplies { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_first_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_second_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_result; [[nodiscard]] constexpr _Ty operator()(const _Ty& _Left, const _Ty& _Right) const { return _Left * _Right; } }; template <class _Ty = void> struct equal_to { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_first_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_second_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef bool _Unnameable_result; [[nodiscard]] constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const { return _Left == _Right; } }; template <class _Ty = void> struct not_equal_to { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_first_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_second_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef bool _Unnameable_result; [[nodiscard]] constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const { return _Left != _Right; } }; template <class _Ty = void> struct greater { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_first_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_second_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef bool _Unnameable_result; [[nodiscard]] constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const { return _Left > _Right; } }; template <class _Ty = void> struct less { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_first_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_second_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef bool _Unnameable_result; [[nodiscard]] constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const { return _Left < _Right; } }; template <class _Ty = void> struct greater_equal { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_first_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_second_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef bool _Unnameable_result; [[nodiscard]] constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const { return _Left >= _Right; } }; template <class _Ty = void> struct less_equal { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_first_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_second_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef bool _Unnameable_result; [[nodiscard]] constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const { return _Left <= _Right; } }; template <> struct plus<void> { template <class _Ty1, class _Ty2> [[nodiscard]] constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(noexcept(static_cast<_Ty1&&>(_Left) + static_cast<_Ty2&&>(_Right))) -> decltype(static_cast<_Ty1&&>(_Left) + static_cast<_Ty2&&>(_Right)) { return static_cast<_Ty1&&>(_Left) + static_cast<_Ty2&&>(_Right); } using is_transparent = int; }; template <> struct minus<void> { template <class _Ty1, class _Ty2> [[nodiscard]] constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(noexcept(static_cast<_Ty1&&>(_Left) - static_cast<_Ty2&&>(_Right))) -> decltype(static_cast<_Ty1&&>(_Left) - static_cast<_Ty2&&>(_Right)) { return static_cast<_Ty1&&>(_Left) - static_cast<_Ty2&&>(_Right); } using is_transparent = int; }; template <> struct multiplies<void> { template <class _Ty1, class _Ty2> [[nodiscard]] constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(noexcept(static_cast<_Ty1&&>(_Left) * static_cast<_Ty2&&>(_Right))) -> decltype(static_cast<_Ty1&&>(_Left) * static_cast<_Ty2&&>(_Right)) { return static_cast<_Ty1&&>(_Left) * static_cast<_Ty2&&>(_Right); } using is_transparent = int; }; template <> struct equal_to<void> { template <class _Ty1, class _Ty2> [[nodiscard]] constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(noexcept(static_cast<_Ty1&&>(_Left) == static_cast<_Ty2&&>(_Right))) -> decltype(static_cast<_Ty1&&>(_Left) == static_cast<_Ty2&&>(_Right)) { return static_cast<_Ty1&&>(_Left) == static_cast<_Ty2&&>(_Right); } using is_transparent = int; }; template <> struct not_equal_to<void> { template <class _Ty1, class _Ty2> [[nodiscard]] constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(noexcept(static_cast<_Ty1&&>(_Left) != static_cast<_Ty2&&>(_Right))) -> decltype(static_cast<_Ty1&&>(_Left) != static_cast<_Ty2&&>(_Right)) { return static_cast<_Ty1&&>(_Left) != static_cast<_Ty2&&>(_Right); } using is_transparent = int; }; template <> struct greater<void> { template <class _Ty1, class _Ty2> [[nodiscard]] constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(noexcept(static_cast<_Ty1&&>(_Left) > static_cast<_Ty2&&>(_Right))) -> decltype(static_cast<_Ty1&&>(_Left) > static_cast<_Ty2&&>(_Right)) { return static_cast<_Ty1&&>(_Left) > static_cast<_Ty2&&>(_Right); } using is_transparent = int; }; template <> struct less<void> { template <class _Ty1, class _Ty2> [[nodiscard]] constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(noexcept(static_cast<_Ty1&&>(_Left) < static_cast<_Ty2&&>(_Right))) -> decltype(static_cast<_Ty1&&>(_Left) < static_cast<_Ty2&&>(_Right)) { return static_cast<_Ty1&&>(_Left) < static_cast<_Ty2&&>(_Right); } using is_transparent = int; }; template <> struct greater_equal<void> { template <class _Ty1, class _Ty2> [[nodiscard]] constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(noexcept(static_cast<_Ty1&&>(_Left) >= static_cast<_Ty2&&>(_Right))) -> decltype(static_cast<_Ty1&&>(_Left) >= static_cast<_Ty2&&>(_Right)) { return static_cast<_Ty1&&>(_Left) >= static_cast<_Ty2&&>(_Right); } using is_transparent = int; }; template <> struct less_equal<void> { template <class _Ty1, class _Ty2> [[nodiscard]] constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(noexcept(static_cast<_Ty1&&>(_Left) <= static_cast<_Ty2&&>(_Right))) -> decltype(static_cast<_Ty1&&>(_Left) <= static_cast<_Ty2&&>(_Right)) { return static_cast<_Ty1&&>(_Left) <= static_cast<_Ty2&&>(_Right); } using is_transparent = int; }; template <class _Ty> [[nodiscard]] constexpr _Ty* addressof(_Ty& _Val) noexcept { return __builtin_addressof(_Val); } template <class _Ty> const _Ty* addressof(const _Ty&&) = delete; template <class _Ptrty> [[nodiscard]] constexpr auto _Unfancy(_Ptrty _Ptr) noexcept { return ::std:: addressof(*_Ptr); } template <class _Ty> [[nodiscard]] constexpr _Ty* _Unfancy(_Ty* _Ptr) noexcept { return _Ptr; } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { template <class _Ty, _Ty... _Vals> struct integer_sequence { static_assert(is_integral_v<_Ty>, "integer_sequence<T, I...> requires T to be an integral type."); using value_type = _Ty; [[nodiscard]] static constexpr size_t size() noexcept { return sizeof...(_Vals); } }; template <class _Ty, _Ty _Size> using make_integer_sequence = __make_integer_seq<integer_sequence, _Ty, _Size>; template <size_t... _Vals> using index_sequence = integer_sequence<size_t, _Vals...>; template <size_t _Size> using make_index_sequence = make_integer_sequence<size_t, _Size>; template <class... _Types> using index_sequence_for = make_index_sequence<sizeof...(_Types)>; template <bool _First_value, class _First, class... _Rest> struct _Conjunction { using type = _First; }; template <class _True, class _Next, class... _Rest> struct _Conjunction<true, _True, _Next, _Rest...> { using type = typename _Conjunction<_Next::value, _Next, _Rest...>::type; }; template <class... _Traits> struct conjunction : true_type {}; template <class _First, class... _Rest> struct conjunction<_First, _Rest...> : _Conjunction<_First::value, _First, _Rest...>::type { }; template <class... _Traits> inline constexpr bool conjunction_v = conjunction<_Traits...>::value; template <class _Trait> struct negation : bool_constant<!static_cast<bool>(_Trait::value)> {}; template <class _Trait> inline constexpr bool negation_v = negation<_Trait>::value; template <class _Ty> inline constexpr bool is_void_v = is_same_v<remove_cv_t<_Ty>, void>; template <class _Ty> struct is_void : bool_constant<is_void_v<_Ty>> {}; template <class... _Types> using void_t = void; template <class _Ty> struct add_const { using type = const _Ty; }; template <class _Ty> using add_const_t = typename add_const<_Ty>::type; template <class _Ty> struct add_volatile { using type = volatile _Ty; }; template <class _Ty> using add_volatile_t = typename add_volatile<_Ty>::type; template <class _Ty> struct add_cv { using type = const volatile _Ty; }; template <class _Ty> using add_cv_t = typename add_cv<_Ty>::type; template <class _Ty, class = void> struct _Add_reference { using _Lvalue = _Ty; using _Rvalue = _Ty; }; template <class _Ty> struct _Add_reference<_Ty, void_t<_Ty&>> { using _Lvalue = _Ty&; using _Rvalue = _Ty&&; }; template <class _Ty> struct add_lvalue_reference { using type = typename _Add_reference<_Ty>::_Lvalue; }; template <class _Ty> using add_lvalue_reference_t = typename _Add_reference<_Ty>::_Lvalue; template <class _Ty> struct add_rvalue_reference { using type = typename _Add_reference<_Ty>::_Rvalue; }; template <class _Ty> using add_rvalue_reference_t = typename _Add_reference<_Ty>::_Rvalue; template <class _Ty> add_rvalue_reference_t<_Ty> declval() noexcept; template <class _Ty> struct remove_extent { using type = _Ty; }; template <class _Ty, size_t _Ix> struct remove_extent<_Ty[_Ix]> { using type = _Ty; }; template <class _Ty> struct remove_extent<_Ty[]> { using type = _Ty; }; template <class _Ty> using remove_extent_t = typename remove_extent<_Ty>::type; template <class _Ty> struct remove_all_extents { using type = _Ty; }; template <class _Ty, size_t _Ix> struct remove_all_extents<_Ty[_Ix]> { using type = typename remove_all_extents<_Ty>::type; }; template <class _Ty> struct remove_all_extents<_Ty[]> { using type = typename remove_all_extents<_Ty>::type; }; template <class _Ty> using remove_all_extents_t = typename remove_all_extents<_Ty>::type; template <class _Ty> struct remove_pointer { using type = _Ty; }; template <class _Ty> struct remove_pointer<_Ty*> { using type = _Ty; }; template <class _Ty> struct remove_pointer<_Ty* const> { using type = _Ty; }; template <class _Ty> struct remove_pointer<_Ty* volatile> { using type = _Ty; }; template <class _Ty> struct remove_pointer<_Ty* const volatile> { using type = _Ty; }; template <class _Ty> using remove_pointer_t = typename remove_pointer<_Ty>::type; template <class _Ty, class = void> struct _Add_pointer { using type = _Ty; }; template <class _Ty> struct _Add_pointer<_Ty, void_t<remove_reference_t<_Ty>*>> { using type = remove_reference_t<_Ty>*; }; template <class _Ty> struct add_pointer { using type = typename _Add_pointer<_Ty>::type; }; template <class _Ty> using add_pointer_t = typename _Add_pointer<_Ty>::type; template <class> inline constexpr bool is_array_v = false; template <class _Ty, size_t _Nx> inline constexpr bool is_array_v<_Ty[_Nx]> = true; template <class _Ty> inline constexpr bool is_array_v<_Ty[]> = true; template <class _Ty> struct is_array : bool_constant<is_array_v<_Ty>> {}; template <class> inline constexpr bool is_bounded_array_v = false; template <class _Ty, size_t _Nx> inline constexpr bool is_bounded_array_v<_Ty[_Nx]> = true; template <class _Ty> struct is_bounded_array : bool_constant<is_bounded_array_v<_Ty>> {}; template <class> inline constexpr bool is_unbounded_array_v = false; template <class _Ty> inline constexpr bool is_unbounded_array_v<_Ty[]> = true; template <class _Ty> struct is_unbounded_array : bool_constant<is_unbounded_array_v<_Ty>> {}; template <class> inline constexpr bool is_lvalue_reference_v = false; template <class _Ty> inline constexpr bool is_lvalue_reference_v<_Ty&> = true; template <class _Ty> struct is_lvalue_reference : bool_constant<is_lvalue_reference_v<_Ty>> {}; template <class> inline constexpr bool is_rvalue_reference_v = false; template <class _Ty> inline constexpr bool is_rvalue_reference_v<_Ty&&> = true; template <class _Ty> struct is_rvalue_reference : bool_constant<is_rvalue_reference_v<_Ty>> {}; template <class> inline constexpr bool is_reference_v = false; template <class _Ty> inline constexpr bool is_reference_v<_Ty&> = true; template <class _Ty> inline constexpr bool is_reference_v<_Ty&&> = true; template <class _Ty> struct is_reference : bool_constant<is_reference_v<_Ty>> {}; template <class> inline constexpr bool is_pointer_v = false; template <class _Ty> inline constexpr bool is_pointer_v<_Ty*> = true; template <class _Ty> inline constexpr bool is_pointer_v<_Ty* const> = true; template <class _Ty> inline constexpr bool is_pointer_v<_Ty* volatile> = true; template <class _Ty> inline constexpr bool is_pointer_v<_Ty* const volatile> = true; template <class _Ty> struct is_pointer : bool_constant<is_pointer_v<_Ty>> {}; template <class _Ty> inline constexpr bool is_null_pointer_v = is_same_v<remove_cv_t<_Ty>, nullptr_t>; template <class _Ty> struct is_null_pointer : bool_constant<is_null_pointer_v<_Ty>> {}; template <class _Ty> struct is_union : bool_constant<__is_union(_Ty)> {}; template <class _Ty> inline constexpr bool is_union_v = __is_union(_Ty); template <class _Ty> struct is_class : bool_constant<__is_class(_Ty)> {}; template <class _Ty> inline constexpr bool is_class_v = __is_class(_Ty); template <class _Ty> inline constexpr bool is_fundamental_v = is_arithmetic_v<_Ty> || is_void_v<_Ty> || is_null_pointer_v<_Ty>; template <class _Ty> struct is_fundamental : bool_constant<is_fundamental_v<_Ty>> {}; template <class _From, class _To> struct is_convertible : bool_constant<__is_convertible_to(_From, _To)> { }; template <class _From, class _To> inline constexpr bool is_convertible_v = __is_convertible_to(_From, _To); template <class _Ty> struct is_enum : bool_constant<__is_enum(_Ty)> {}; template <class _Ty> inline constexpr bool is_enum_v = __is_enum(_Ty); template <class _Ty> struct is_compound : bool_constant<!is_fundamental_v<_Ty>> {}; template <class _Ty> inline constexpr bool is_compound_v = !is_fundamental_v<_Ty>; template <class... _Types> struct _Arg_types {}; template <class _Ty1> struct _Arg_types<_Ty1> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty1 _Unnameable_argument; }; template <class _Ty1, class _Ty2> struct _Arg_types<_Ty1, _Ty2> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty1 _Unnameable_first_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty2 _Unnameable_second_argument; }; template <class _Ty> struct _Is_memfunptr { using _Bool_type = false_type; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__cdecl _Arg0::*)(_Types...) > : _Arg_types< _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int , int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__vectorcall _Arg0::*)(_Types...) > : _Arg_types< _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int , int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__cdecl _Arg0::*)(_Types...) const > : _Arg_types<const _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int , int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__vectorcall _Arg0::*)(_Types...) const > : _Arg_types<const _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int , int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__cdecl _Arg0::*)(_Types...) volatile > : _Arg_types<volatile _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int , int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__vectorcall _Arg0::*)(_Types...) volatile > : _Arg_types<volatile _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int , int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__cdecl _Arg0::*)(_Types...) const volatile > : _Arg_types<const volatile _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int , int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__vectorcall _Arg0::*)(_Types...) const volatile > : _Arg_types<const volatile _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int , int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__cdecl _Arg0::*)(_Types...) & > : _Arg_types< _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__vectorcall _Arg0::*)(_Types...) & > : _Arg_types< _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__cdecl _Arg0::*)(_Types...) const & > : _Arg_types<const _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__vectorcall _Arg0::*)(_Types...) const & > : _Arg_types<const _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__cdecl _Arg0::*)(_Types...) volatile & > : _Arg_types<volatile _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__vectorcall _Arg0::*)(_Types...) volatile & > : _Arg_types<volatile _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__cdecl _Arg0::*)(_Types...) const volatile & > : _Arg_types<const volatile _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__vectorcall _Arg0::*)(_Types...) const volatile & > : _Arg_types<const volatile _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__cdecl _Arg0::*)(_Types...) && > : _Arg_types< _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &&, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__vectorcall _Arg0::*)(_Types...) && > : _Arg_types< _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &&, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__cdecl _Arg0::*)(_Types...) const && > : _Arg_types<const _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &&, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__vectorcall _Arg0::*)(_Types...) const && > : _Arg_types<const _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &&, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__cdecl _Arg0::*)(_Types...) volatile && > : _Arg_types<volatile _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &&, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__vectorcall _Arg0::*)(_Types...) volatile && > : _Arg_types<volatile _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &&, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__cdecl _Arg0::*)(_Types...) const volatile && > : _Arg_types<const volatile _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &&, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__vectorcall _Arg0::*)(_Types...) const volatile && > : _Arg_types<const volatile _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &&, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__cdecl _Arg0::*)(_Types...) noexcept> : _Arg_types< _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int , int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__vectorcall _Arg0::*)(_Types...) noexcept> : _Arg_types< _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int , int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__cdecl _Arg0::*)(_Types...) const noexcept> : _Arg_types<const _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int , int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__vectorcall _Arg0::*)(_Types...) const noexcept> : _Arg_types<const _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int , int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__cdecl _Arg0::*)(_Types...) volatile noexcept> : _Arg_types<volatile _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int , int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__vectorcall _Arg0::*)(_Types...) volatile noexcept> : _Arg_types<volatile _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int , int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__cdecl _Arg0::*)(_Types...) const volatile noexcept> : _Arg_types<const volatile _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int , int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__vectorcall _Arg0::*)(_Types...) const volatile noexcept> : _Arg_types<const volatile _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int , int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__cdecl _Arg0::*)(_Types...) & noexcept> : _Arg_types< _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__vectorcall _Arg0::*)(_Types...) & noexcept> : _Arg_types< _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__cdecl _Arg0::*)(_Types...) const & noexcept> : _Arg_types<const _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__vectorcall _Arg0::*)(_Types...) const & noexcept> : _Arg_types<const _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__cdecl _Arg0::*)(_Types...) volatile & noexcept> : _Arg_types<volatile _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__vectorcall _Arg0::*)(_Types...) volatile & noexcept> : _Arg_types<volatile _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__cdecl _Arg0::*)(_Types...) const volatile & noexcept> : _Arg_types<const volatile _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__vectorcall _Arg0::*)(_Types...) const volatile & noexcept> : _Arg_types<const volatile _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__cdecl _Arg0::*)(_Types...) && noexcept> : _Arg_types< _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &&, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__vectorcall _Arg0::*)(_Types...) && noexcept> : _Arg_types< _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &&, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__cdecl _Arg0::*)(_Types...) const && noexcept> : _Arg_types<const _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &&, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__vectorcall _Arg0::*)(_Types...) const && noexcept> : _Arg_types<const _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &&, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__cdecl _Arg0::*)(_Types...) volatile && noexcept> : _Arg_types<volatile _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &&, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__vectorcall _Arg0::*)(_Types...) volatile && noexcept> : _Arg_types<volatile _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &&, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__cdecl _Arg0::*)(_Types...) const volatile && noexcept> : _Arg_types<const volatile _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &&, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (__vectorcall _Arg0::*)(_Types...) const volatile && noexcept> : _Arg_types<const volatile _Arg0*, _Types...> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<!is_same_v<int &&, int&&>, _Ret(_Types...)>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (_Arg0::*)(_Types..., ...) > { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<false>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (_Arg0::*)(_Types..., ...) const> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<false>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (_Arg0::*)(_Types..., ...) volatile> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<false>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (_Arg0::*)(_Types..., ...) const volatile> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<false>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (_Arg0::*)(_Types..., ...) &> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<false>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (_Arg0::*)(_Types..., ...) const&> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<false>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (_Arg0::*)(_Types..., ...) volatile&> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<false>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (_Arg0::*)(_Types..., ...) const volatile&> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<false>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (_Arg0::*)(_Types..., ...) &&> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<false>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (_Arg0::*)(_Types..., ...) const&&> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<false>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (_Arg0::*)(_Types..., ...) volatile&&> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<false>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (_Arg0::*)(_Types..., ...) const volatile&&> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<false>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (_Arg0::*)(_Types..., ...) noexcept> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<false>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (_Arg0::*)(_Types..., ...) const noexcept> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<false>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (_Arg0::*)(_Types..., ...) volatile noexcept> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<false>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (_Arg0::*)(_Types..., ...) const volatile noexcept> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<false>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (_Arg0::*)(_Types..., ...) &noexcept> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<false>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (_Arg0::*)(_Types..., ...) const& noexcept> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<false>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (_Arg0::*)(_Types..., ...) volatile& noexcept> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<false>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (_Arg0::*)(_Types..., ...) const volatile& noexcept> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<false>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (_Arg0::*)(_Types..., ...) &&noexcept> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<false>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (_Arg0::*)(_Types..., ...) const&& noexcept> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<false>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (_Arg0::*)(_Types..., ...) volatile&& noexcept> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<false>; }; template <class _Ret, class _Arg0, class... _Types> struct _Is_memfunptr<_Ret (_Arg0::*)(_Types..., ...) const volatile&& noexcept> { using _Bool_type = true_type; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; using _Class_type = _Arg0; using _Guide_type = enable_if<false>; }; template <class _Ty> inline constexpr bool is_member_function_pointer_v = _Is_memfunptr<remove_cv_t<_Ty>>::_Bool_type::value; template <class _Ty> struct is_member_function_pointer : bool_constant<is_member_function_pointer_v<_Ty>> {}; template <class> inline constexpr bool is_const_v = false; template <class _Ty> inline constexpr bool is_const_v<const _Ty> = true; template <class _Ty> struct is_const : bool_constant<is_const_v<_Ty>> {}; template <class> inline constexpr bool is_volatile_v = false; template <class _Ty> inline constexpr bool is_volatile_v<volatile _Ty> = true; template <class _Ty> struct is_volatile : bool_constant<is_volatile_v<_Ty>> {}; template <class _Ty> inline constexpr bool is_function_v = !is_const_v<const _Ty> && !is_reference_v<_Ty>; template <class _Ty> struct is_function : bool_constant<is_function_v<_Ty>> {}; template <class _Ty> inline constexpr bool is_object_v = is_const_v<const _Ty> && !is_void_v<_Ty>; template <class _Ty> struct is_object : bool_constant<is_object_v<_Ty>> {}; template <class> struct _Is_member_object_pointer { static constexpr bool value = false; }; template <class _Ty1, class _Ty2> struct _Is_member_object_pointer<_Ty1 _Ty2::*> { static constexpr bool value = !is_function_v<_Ty1>; using _Class_type = _Ty2; }; template <class _Ty> inline constexpr bool is_member_object_pointer_v = _Is_member_object_pointer<remove_cv_t<_Ty>>::value; template <class _Ty> struct is_member_object_pointer : bool_constant<is_member_object_pointer_v<_Ty>> {}; template <class _Ty> inline constexpr bool is_member_pointer_v = is_member_object_pointer_v<_Ty> || is_member_function_pointer_v<_Ty>; template <class _Ty> struct is_member_pointer : bool_constant<is_member_pointer_v<_Ty>> {}; template <class _Ty> inline constexpr bool is_scalar_v = is_arithmetic_v<_Ty> || is_enum_v<_Ty> || is_pointer_v<_Ty> || is_member_pointer_v<_Ty> || is_null_pointer_v<_Ty>; template <class _Ty> struct is_scalar : bool_constant<is_scalar_v<_Ty>> {}; template <class _Ty> struct [[deprecated("warning STL4025: " "std::is_pod and std::is_pod_v are deprecated in C++20. " "The std::is_trivially_copyable and/or std::is_standard_layout traits likely suit your use case. " "You can define _SILENCE_CXX20_IS_POD_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] is_pod : bool_constant<__is_pod(_Ty)> {}; template <class _Ty> [[deprecated("warning STL4025: " "std::is_pod and std::is_pod_v are deprecated in C++20. " "The std::is_trivially_copyable and/or std::is_standard_layout traits likely suit your use case. " "You can define _SILENCE_CXX20_IS_POD_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] inline constexpr bool is_pod_v = __is_pod(_Ty); template <class _Ty> struct is_empty : bool_constant<__is_empty(_Ty)> {}; template <class _Ty> inline constexpr bool is_empty_v = __is_empty(_Ty); template <class _Ty> struct is_polymorphic : bool_constant<__is_polymorphic(_Ty)> {}; template <class _Ty> inline constexpr bool is_polymorphic_v = __is_polymorphic(_Ty); template <class _Ty> struct is_abstract : bool_constant<__is_abstract(_Ty)> {}; template <class _Ty> inline constexpr bool is_abstract_v = __is_abstract(_Ty); template <class _Ty> struct is_final : bool_constant<__is_final(_Ty)> {}; template <class _Ty> inline constexpr bool is_final_v = __is_final(_Ty); template <class _Ty> struct is_standard_layout : bool_constant<__is_standard_layout(_Ty)> {}; template <class _Ty> inline constexpr bool is_standard_layout_v = __is_standard_layout(_Ty); template <class _Ty> struct is_trivial : bool_constant<__is_trivially_constructible(_Ty) && __is_trivially_copyable(_Ty)> { }; template <class _Ty> inline constexpr bool is_trivial_v = __is_trivially_constructible(_Ty) && __is_trivially_copyable(_Ty); template <class _Ty> struct is_trivially_copyable : bool_constant<__is_trivially_copyable(_Ty)> { }; template <class _Ty> inline constexpr bool is_trivially_copyable_v = __is_trivially_copyable(_Ty); template <class _Ty> struct has_virtual_destructor : bool_constant<__has_virtual_destructor(_Ty)> { }; template <class _Ty> inline constexpr bool has_virtual_destructor_v = __has_virtual_destructor(_Ty); template <class _Ty> struct has_unique_object_representations : bool_constant<__has_unique_object_representations(_Ty)> { }; template <class _Ty> inline constexpr bool has_unique_object_representations_v = __has_unique_object_representations(_Ty); template <class _Ty> struct is_aggregate : bool_constant<__is_aggregate(_Ty)> {}; template <class _Ty> inline constexpr bool is_aggregate_v = __is_aggregate(_Ty); template <class _Ty, class... _Args> struct is_constructible : bool_constant<__is_constructible(_Ty, _Args...)> { }; template <class _Ty, class... _Args> inline constexpr bool is_constructible_v = __is_constructible(_Ty, _Args...); template <class _Ty> struct is_copy_constructible : bool_constant<__is_constructible(_Ty, add_lvalue_reference_t<const _Ty>)> { }; template <class _Ty> inline constexpr bool is_copy_constructible_v = __is_constructible(_Ty, add_lvalue_reference_t<const _Ty>); template <class _Ty> struct is_default_constructible : bool_constant<__is_constructible(_Ty)> { }; template <class _Ty> inline constexpr bool is_default_constructible_v = __is_constructible(_Ty); template <class _Ty, class = void> struct _Is_implicitly_default_constructible : false_type { }; template <class _Ty> void _Implicitly_default_construct(const _Ty&); template <class _Ty> struct _Is_implicitly_default_constructible<_Ty, void_t<decltype(_Implicitly_default_construct<_Ty>({}))>> : true_type { }; template <class _Ty> struct is_move_constructible : bool_constant<__is_constructible(_Ty, _Ty)> { }; template <class _Ty> inline constexpr bool is_move_constructible_v = __is_constructible(_Ty, _Ty); template <class _To, class _From> struct is_assignable : bool_constant<__is_assignable(_To, _From)> {}; template <class _To, class _From> inline constexpr bool is_assignable_v = __is_assignable(_To, _From); template <class _Ty> struct is_copy_assignable : bool_constant<__is_assignable(add_lvalue_reference_t<_Ty>, add_lvalue_reference_t<const _Ty>)> { }; template <class _Ty> inline constexpr bool is_copy_assignable_v = __is_assignable( add_lvalue_reference_t<_Ty>, add_lvalue_reference_t<const _Ty>); template <class _Ty> struct _Is_copy_assignable_no_precondition_check : bool_constant<__is_assignable_no_precondition_check( add_lvalue_reference_t<_Ty>, add_lvalue_reference_t<const _Ty>)> {}; template <class _Ty> inline constexpr bool _Is_copy_assignable_unchecked_v = __is_assignable_no_precondition_check( add_lvalue_reference_t<_Ty>, add_lvalue_reference_t<const _Ty>); template <class _Ty> struct is_move_assignable : bool_constant<__is_assignable(add_lvalue_reference_t<_Ty>, _Ty)> { }; template <class _Ty> inline constexpr bool is_move_assignable_v = __is_assignable(add_lvalue_reference_t<_Ty>, _Ty); template <class _Ty> struct _Is_move_assignable_no_precondition_check : bool_constant<__is_assignable_no_precondition_check(add_lvalue_reference_t<_Ty>, _Ty)> {}; template <class _Ty> inline constexpr bool _Is_move_assignable_unchecked_v = __is_assignable_no_precondition_check( add_lvalue_reference_t<_Ty>, _Ty); template <class _Ty> struct is_destructible : bool_constant<__is_destructible(_Ty)> { }; template <class _Ty> inline constexpr bool is_destructible_v = __is_destructible(_Ty); template <class _Ty, class... _Args> struct is_trivially_constructible : bool_constant<__is_trivially_constructible(_Ty, _Args...)> { }; template <class _Ty, class... _Args> inline constexpr bool is_trivially_constructible_v = __is_trivially_constructible(_Ty, _Args...); template <class _Ty> struct is_trivially_copy_constructible : bool_constant<__is_trivially_constructible(_Ty, add_lvalue_reference_t<const _Ty>)> { }; template <class _Ty> inline constexpr bool is_trivially_copy_constructible_v = __is_trivially_constructible( _Ty, add_lvalue_reference_t<const _Ty>); template <class _Ty> struct is_trivially_default_constructible : bool_constant<__is_trivially_constructible(_Ty)> { }; template <class _Ty> inline constexpr bool is_trivially_default_constructible_v = __is_trivially_constructible(_Ty); template <class _Ty> struct is_trivially_move_constructible : bool_constant<__is_trivially_constructible(_Ty, _Ty)> { }; template <class _Ty> inline constexpr bool is_trivially_move_constructible_v = __is_trivially_constructible(_Ty, _Ty); template <class _To, class _From> struct is_trivially_assignable : bool_constant<__is_trivially_assignable(_To, _From)> { }; template <class _To, class _From> inline constexpr bool is_trivially_assignable_v = __is_trivially_assignable(_To, _From); template <class _Ty> struct is_trivially_copy_assignable : bool_constant<__is_trivially_assignable(add_lvalue_reference_t<_Ty>, add_lvalue_reference_t<const _Ty>)> { }; template <class _Ty> inline constexpr bool is_trivially_copy_assignable_v = __is_trivially_assignable( add_lvalue_reference_t<_Ty>, add_lvalue_reference_t<const _Ty>); template <class _Ty> struct is_trivially_move_assignable : bool_constant<__is_trivially_assignable(add_lvalue_reference_t<_Ty>, _Ty)> { }; template <class _Ty> inline constexpr bool is_trivially_move_assignable_v = __is_trivially_assignable(add_lvalue_reference_t<_Ty>, _Ty); template <class _Ty> struct is_trivially_destructible : bool_constant<__is_trivially_destructible(_Ty)> { }; template <class _Ty> inline constexpr bool is_trivially_destructible_v = __is_trivially_destructible(_Ty); template <class _Ty, class... _Args> struct is_nothrow_constructible : bool_constant<__is_nothrow_constructible(_Ty, _Args...)> { }; template <class _Ty, class... _Args> inline constexpr bool is_nothrow_constructible_v = __is_nothrow_constructible(_Ty, _Args...); template <class _Ty> struct is_nothrow_copy_constructible : bool_constant<__is_nothrow_constructible(_Ty, add_lvalue_reference_t<const _Ty>)> { }; template <class _Ty> inline constexpr bool is_nothrow_copy_constructible_v = __is_nothrow_constructible( _Ty, add_lvalue_reference_t<const _Ty>); template <class _Ty> struct is_nothrow_default_constructible : bool_constant<__is_nothrow_constructible(_Ty)> { }; template <class _Ty> inline constexpr bool is_nothrow_default_constructible_v = __is_nothrow_constructible(_Ty); template <class _Ty> struct is_nothrow_move_constructible : bool_constant<__is_nothrow_constructible(_Ty, _Ty)> { }; template <class _Ty> inline constexpr bool is_nothrow_move_constructible_v = __is_nothrow_constructible(_Ty, _Ty); template <class _To, class _From> struct is_nothrow_assignable : bool_constant<__is_nothrow_assignable(_To, _From)> { }; template <class _To, class _From> inline constexpr bool is_nothrow_assignable_v = __is_nothrow_assignable(_To, _From); template <class _Ty> struct is_nothrow_copy_assignable : bool_constant<__is_nothrow_assignable(add_lvalue_reference_t<_Ty>, add_lvalue_reference_t<const _Ty>)> { }; template <class _Ty> inline constexpr bool is_nothrow_copy_assignable_v = __is_nothrow_assignable( add_lvalue_reference_t<_Ty>, add_lvalue_reference_t<const _Ty>); template <class _Ty> struct is_nothrow_move_assignable : bool_constant<__is_nothrow_assignable(add_lvalue_reference_t<_Ty>, _Ty)> { }; template <class _Ty> inline constexpr bool is_nothrow_move_assignable_v = __is_nothrow_assignable(add_lvalue_reference_t<_Ty>, _Ty); template <class _Ty> struct is_nothrow_destructible : bool_constant<__is_nothrow_destructible(_Ty)> { }; template <class _Ty> inline constexpr bool is_nothrow_destructible_v = __is_nothrow_destructible(_Ty); template <class _Ty, bool = is_integral_v<_Ty>> struct _Sign_base { using _Uty = remove_cv_t<_Ty>; static constexpr bool _Signed = static_cast<_Uty>(-1) < static_cast<_Uty>(0); static constexpr bool _Unsigned = !_Signed; }; template <class _Ty> struct _Sign_base<_Ty, false> { static constexpr bool _Signed = is_floating_point_v<_Ty>; static constexpr bool _Unsigned = false; }; template <class _Ty> struct is_signed : bool_constant<_Sign_base<_Ty>::_Signed> {}; template <class _Ty> inline constexpr bool is_signed_v = _Sign_base<_Ty>::_Signed; template <class _Ty> struct is_unsigned : bool_constant<_Sign_base<_Ty>::_Unsigned> {}; template <class _Ty> inline constexpr bool is_unsigned_v = _Sign_base<_Ty>::_Unsigned; template <class _Ty> inline constexpr bool _Is_nonbool_integral = is_integral_v<_Ty> && !is_same_v<remove_cv_t<_Ty>, bool>; template <bool> struct _Select { template <class _Ty1, class> using _Apply = _Ty1; }; template <> struct _Select<false> { template <class, class _Ty2> using _Apply = _Ty2; }; template <size_t> struct _Make_signed2; template <> struct _Make_signed2<1> { template <class> using _Apply = signed char; }; template <> struct _Make_signed2<2> { template <class> using _Apply = short; }; template <> struct _Make_signed2<4> { template <class _Ty> using _Apply = typename _Select<is_same_v<_Ty, long> || is_same_v<_Ty, unsigned long>>::template _Apply<long, int>; }; template <> struct _Make_signed2<8> { template <class> using _Apply = long long; }; template <class _Ty> using _Make_signed1 = typename _Make_signed2<sizeof(_Ty)>::template _Apply<_Ty>; template <class _Ty> struct make_signed { static_assert(_Is_nonbool_integral<_Ty> || is_enum_v<_Ty>, "make_signed<T> requires that T shall be a (possibly cv-qualified) " "integral type or enumeration but not a bool type."); using type = typename remove_cv<_Ty>::template _Apply<_Make_signed1>; }; template <class _Ty> using make_signed_t = typename make_signed<_Ty>::type; template <size_t> struct _Make_unsigned2; template <> struct _Make_unsigned2<1> { template <class> using _Apply = unsigned char; }; template <> struct _Make_unsigned2<2> { template <class> using _Apply = unsigned short; }; template <> struct _Make_unsigned2<4> { template <class _Ty> using _Apply = typename _Select<is_same_v<_Ty, long> || is_same_v<_Ty, unsigned long>>::template _Apply<unsigned long, unsigned int>; }; template <> struct _Make_unsigned2<8> { template <class> using _Apply = unsigned long long; }; template <class _Ty> using _Make_unsigned1 = typename _Make_unsigned2<sizeof(_Ty)>::template _Apply<_Ty>; template <class _Ty> struct make_unsigned { static_assert(_Is_nonbool_integral<_Ty> || is_enum_v<_Ty>, "make_unsigned<T> requires that T shall be a (possibly cv-qualified) " "integral type or enumeration but not a bool type."); using type = typename remove_cv<_Ty>::template _Apply<_Make_unsigned1>; }; template <class _Ty> using make_unsigned_t = typename make_unsigned<_Ty>::type; template <class _Rep> constexpr make_unsigned_t<_Rep> _Unsigned_value(_Rep _Val) { return static_cast<make_unsigned_t<_Rep>>(_Val); } template <class _Ty> struct alignment_of : integral_constant<size_t, alignof(_Ty)> {}; template <class _Ty> inline constexpr size_t alignment_of_v = alignof(_Ty); template <class _Ty, size_t _Len> union _Align_type { _Ty _Val; char _Pad[_Len]; }; template <size_t _Len, size_t _Align, class _Ty, bool _Ok> struct _Aligned; template <size_t _Len, size_t _Align, class _Ty> struct _Aligned<_Len, _Align, _Ty, true> { using type = _Align_type<_Ty, _Len>; }; template <size_t _Len, size_t _Align> struct _Aligned<_Len, _Align, double, false> { struct type { alignas(_Align) char _Space[_Len]; }; }; template <size_t _Len, size_t _Align> struct _Aligned<_Len, _Align, int, false> { using _Next = double; static constexpr bool _Fits = _Align <= alignof(_Next); using type = typename _Aligned<_Len, _Align, _Next, _Fits>::type; }; template <size_t _Len, size_t _Align> struct _Aligned<_Len, _Align, short, false> { using _Next = int; static constexpr bool _Fits = _Align <= alignof(_Next); using type = typename _Aligned<_Len, _Align, _Next, _Fits>::type; }; template <size_t _Len, size_t _Align> struct _Aligned<_Len, _Align, char, false> { using _Next = short; static constexpr bool _Fits = _Align <= alignof(_Next); using type = typename _Aligned<_Len, _Align, _Next, _Fits>::type; }; template <size_t _Len, size_t _Align = alignof(max_align_t)> struct aligned_storage { using _Next = char; static constexpr bool _Fits = _Align <= alignof(_Next); using type = typename _Aligned<_Len, _Align, _Next, _Fits>::type; }; template <size_t _Len, size_t _Align = alignof(max_align_t)> using aligned_storage_t = typename aligned_storage<_Len, _Align>::type; template <size_t... _Vals> struct _Maximum; template <> struct _Maximum<> : integral_constant<size_t, 0> {}; template <size_t _Val> struct _Maximum<_Val> : integral_constant<size_t, _Val> {}; template <size_t _First, size_t _Second, size_t... _Rest> struct _Maximum<_First, _Second, _Rest...> : _Maximum<(_First < _Second ? _Second : _First), _Rest...>::type { }; template <size_t _Len, class... _Types> struct aligned_union { static constexpr size_t _Max_len = _Maximum<_Len, sizeof(_Types)...>::value; static constexpr size_t alignment_value = _Maximum<alignof(_Types)...>::value; using type = aligned_storage_t<_Max_len, alignment_value>; }; template <size_t _Len, class... _Types> using aligned_union_t = typename aligned_union<_Len, _Types...>::type; template <class _Ty, bool = is_enum_v<_Ty>> struct _Underlying_type { using type = __underlying_type(_Ty); }; template <class _Ty> struct _Underlying_type<_Ty, false> {}; template <class _Ty> struct underlying_type : _Underlying_type<_Ty> {}; template <class _Ty> using underlying_type_t = typename _Underlying_type<_Ty>::type; template <class _Ty> inline constexpr size_t rank_v = 0; template <class _Ty, size_t _Nx> inline constexpr size_t rank_v<_Ty[_Nx]> = rank_v<_Ty> + 1; template <class _Ty> inline constexpr size_t rank_v<_Ty[]> = rank_v<_Ty> + 1; template <class _Ty> struct rank : integral_constant<size_t, rank_v<_Ty>> {}; template <class _Ty, unsigned int _Ix = 0> inline constexpr size_t extent_v = 0; template <class _Ty, size_t _Nx> inline constexpr size_t extent_v<_Ty[_Nx], 0> = _Nx; template <class _Ty, unsigned int _Ix, size_t _Nx> inline constexpr size_t extent_v<_Ty[_Nx], _Ix> = extent_v<_Ty, _Ix - 1>; template <class _Ty, unsigned int _Ix> inline constexpr size_t extent_v<_Ty[], _Ix> = extent_v<_Ty, _Ix - 1>; template <class _Ty, unsigned int _Ix = 0> struct extent : integral_constant<size_t, extent_v<_Ty, _Ix>> {}; template <class _Base, class _Derived> struct is_base_of : bool_constant<__is_base_of(_Base, _Derived)> { }; template <class _Base, class _Derived> inline constexpr bool is_base_of_v = __is_base_of(_Base, _Derived); template <class _Ty> struct decay { using _Ty1 = remove_reference_t<_Ty>; using _Ty2 = typename _Select<is_function_v<_Ty1>>::template _Apply<add_pointer<_Ty1>, remove_cv<_Ty1>>; using type = typename _Select<is_array_v<_Ty1>>::template _Apply<add_pointer<remove_extent_t<_Ty1>>, _Ty2>::type; }; template <class _Ty> using decay_t = typename decay<_Ty>::type; template <class _Ty1, class _Ty2> using _Conditional_type = decltype(false ? ::std:: declval<_Ty1>() : ::std:: declval<_Ty2>()); template <class _Ty1, class _Ty2, class = void> struct _Const_lvalue_cond_oper {}; template <class _Ty1, class _Ty2> struct _Const_lvalue_cond_oper<_Ty1, _Ty2, void_t<_Conditional_type<const _Ty1&, const _Ty2&>>> { using type = remove_cvref_t<_Conditional_type<const _Ty1&, const _Ty2&>>; }; template <class _Ty1, class _Ty2, class = void> struct _Decayed_cond_oper : _Const_lvalue_cond_oper<_Ty1, _Ty2> {}; template <class _Ty1, class _Ty2> struct _Decayed_cond_oper<_Ty1, _Ty2, void_t<_Conditional_type<_Ty1, _Ty2>>> { using type = decay_t<_Conditional_type<_Ty1, _Ty2>>; }; template <class... _Ty> struct common_type; template <class... _Ty> using common_type_t = typename common_type<_Ty...>::type; template <> struct common_type<> {}; template <class _Ty1> struct common_type<_Ty1> : common_type<_Ty1, _Ty1> {}; template <class _Ty1, class _Ty2, class _Decayed1 = decay_t<_Ty1>, class _Decayed2 = decay_t<_Ty2>> struct _Common_type2 : common_type<_Decayed1, _Decayed2> {}; template <class _Ty1, class _Ty2> struct _Common_type2<_Ty1, _Ty2, _Ty1, _Ty2> : _Decayed_cond_oper<_Ty1, _Ty2> {}; template <class _Ty1, class _Ty2> struct common_type<_Ty1, _Ty2> : _Common_type2<_Ty1, _Ty2> {}; template <class _Void, class _Ty1, class _Ty2, class... _Rest> struct _Common_type3 {}; template <class _Ty1, class _Ty2, class... _Rest> struct _Common_type3<void_t<common_type_t<_Ty1, _Ty2>>, _Ty1, _Ty2, _Rest...> : common_type<common_type_t<_Ty1, _Ty2>, _Rest...> {}; template <class _Ty1, class _Ty2, class... _Rest> struct common_type<_Ty1, _Ty2, _Rest...> : _Common_type3<void, _Ty1, _Ty2, _Rest...> {}; template <class, class, template <class> class, template <class> class> struct basic_common_reference {}; template <class _Ty> _Ty _Returns_exactly() noexcept; template <class _Ty1, class _Ty2> using _Cond_res = decltype(false ? _Returns_exactly<_Ty1>() : _Returns_exactly<_Ty2>()); template <class _From> struct _Copy_cv_impl { template <class _To> using _Apply = _To; }; template <class _From> struct _Copy_cv_impl<const _From> { template <class _To> using _Apply = const _To; }; template <class _From> struct _Copy_cv_impl<volatile _From> { template <class _To> using _Apply = volatile _To; }; template <class _From> struct _Copy_cv_impl<const volatile _From> { template <class _To> using _Apply = const volatile _To; }; template <class _From, class _To> using _Copy_cv = typename _Copy_cv_impl<_From>::template _Apply<_To>; template <class _Ty1> struct _Add_qualifiers { template <class _Ty2> using _Apply = _Copy_cv<_Ty1, _Ty2>; }; template <class _Ty1> struct _Add_qualifiers<_Ty1&> { template <class _Ty2> using _Apply = add_lvalue_reference_t<_Copy_cv<_Ty1, _Ty2>>; }; template <class _Ty1> struct _Add_qualifiers<_Ty1&&> { template <class _Ty2> using _Apply = add_rvalue_reference_t<_Copy_cv<_Ty1, _Ty2>>; }; template <class...> struct common_reference; template <class... _Types> using common_reference_t = typename common_reference<_Types...>::type; template <> struct common_reference<> {}; template <class _Ty> struct common_reference<_Ty> { using type = _Ty; }; template <class _Ty1, class _Ty2, class = void> struct _Common_reference2C : common_type<_Ty1, _Ty2> {}; template <class _Ty1, class _Ty2> struct _Common_reference2C<_Ty1, _Ty2, void_t<_Cond_res<_Ty1, _Ty2>>> { using type = _Cond_res<_Ty1, _Ty2>; }; template <class _Ty1, class _Ty2> using _Basic_specialization = typename basic_common_reference<remove_cvref_t<_Ty1>, remove_cvref_t<_Ty2>, _Add_qualifiers<_Ty1>::template _Apply, _Add_qualifiers<_Ty2>::template _Apply>::type; template <class _Ty1, class _Ty2, class = void> struct _Common_reference2B : _Common_reference2C<_Ty1, _Ty2> {}; template <class _Ty1, class _Ty2> struct _Common_reference2B<_Ty1, _Ty2, void_t<_Basic_specialization<_Ty1, _Ty2>>> { using type = _Basic_specialization<_Ty1, _Ty2>; }; template <class _Ty1, class _Ty2, class = void> struct _Common_reference2A : _Common_reference2B<_Ty1, _Ty2> {}; template <class _Ty1, class _Ty2, class _Result = _Cond_res<_Copy_cv<_Ty1, _Ty2>&, _Copy_cv<_Ty2, _Ty1>&>, enable_if_t<is_lvalue_reference_v<_Result>, int> = 0> using _LL_common_ref = _Result; template <class _Ty1, class _Ty2> struct _Common_reference2A<_Ty1&, _Ty2&, void_t<_LL_common_ref<_Ty1, _Ty2>>> { using type = _LL_common_ref<_Ty1, _Ty2>; }; template <class _Ty1, class _Ty2> struct _Common_reference2A<_Ty1&&, _Ty2&, enable_if_t<is_convertible_v<_Ty1&&, _LL_common_ref<const _Ty1, _Ty2>>>> { using type = _LL_common_ref<const _Ty1, _Ty2>; }; template <class _Ty1, class _Ty2> struct _Common_reference2A<_Ty1&, _Ty2&&, enable_if_t<is_convertible_v<_Ty2&&, _LL_common_ref<const _Ty2, _Ty1>>>> { using type = _LL_common_ref<const _Ty2, _Ty1>; }; template <class _Ty1, class _Ty2> using _RR_common_ref = remove_reference_t<_LL_common_ref<_Ty1, _Ty2>>&&; template <class _Ty1, class _Ty2> struct _Common_reference2A<_Ty1&&, _Ty2&&, enable_if_t< is_convertible_v<_Ty1&&, _RR_common_ref<_Ty1, _Ty2>> && is_convertible_v<_Ty2&&, _RR_common_ref<_Ty1, _Ty2>>>> { using type = _RR_common_ref<_Ty1, _Ty2>; }; template <class _Ty1, class _Ty2> struct common_reference<_Ty1, _Ty2> : _Common_reference2A<_Ty1, _Ty2> {}; template <class _Void, class _Ty1, class _Ty2, class... _Types> struct _Fold_common_reference {}; template <class _Ty1, class _Ty2, class... _Types> struct _Fold_common_reference<void_t<common_reference_t<_Ty1, _Ty2>>, _Ty1, _Ty2, _Types...> : common_reference<common_reference_t<_Ty1, _Ty2>, _Types...> {}; template <class _Ty1, class _Ty2, class _Ty3, class... _Rest> struct common_reference<_Ty1, _Ty2, _Ty3, _Rest...> : _Fold_common_reference<void, _Ty1, _Ty2, _Ty3, _Rest...> {}; template <class _Ty> struct _Identity { using type = _Ty; }; template <class _Ty> using _Identity_t = typename _Identity<_Ty>::type; template <class _Ty> struct type_identity { using type = _Ty; }; template <class _Ty> using type_identity_t = typename type_identity<_Ty>::type; template <class _Type, template <class...> class _Template> inline constexpr bool _Is_specialization_v = false; template <template <class...> class _Template, class... _Types> inline constexpr bool _Is_specialization_v<_Template<_Types...>, _Template> = true; template <class _Type, template <class...> class _Template> struct _Is_specialization : bool_constant<_Is_specialization_v<_Type, _Template>> {}; template <class _Ty> [[nodiscard]] constexpr _Ty&& forward( remove_reference_t<_Ty>& _Arg) noexcept { return static_cast<_Ty&&>(_Arg); } template <class _Ty> [[nodiscard]] constexpr _Ty&& forward(remove_reference_t<_Ty>&& _Arg) noexcept { static_assert(!is_lvalue_reference_v<_Ty>, "bad forward call"); return static_cast<_Ty&&>(_Arg); } template <class _Ty> [[nodiscard]] constexpr remove_reference_t<_Ty>&& move(_Ty&& _Arg) noexcept { return static_cast<remove_reference_t<_Ty>&&>(_Arg); } template <class _Ty> [[nodiscard]] constexpr conditional_t<!is_nothrow_move_constructible_v<_Ty> && is_copy_constructible_v<_Ty>, const _Ty&, _Ty&&> move_if_noexcept(_Ty& _Arg) noexcept { return ::std:: move(_Arg); } template <class _Ty> class reference_wrapper; #pragma warning(push) #pragma warning(disable : 28278) enum class _Invoker_strategy { _Functor, _Pmf_object, _Pmf_refwrap, _Pmf_pointer, _Pmd_object, _Pmd_refwrap, _Pmd_pointer }; struct _Invoker_functor { static constexpr _Invoker_strategy _Strategy = _Invoker_strategy::_Functor; template <class _Callable, class... _Types> static constexpr auto _Call(_Callable&& _Obj, _Types&&... _Args) noexcept( noexcept(static_cast<_Callable&&>(_Obj)(static_cast<_Types&&>(_Args)...))) -> decltype(static_cast<_Callable&&>(_Obj)(static_cast<_Types&&>(_Args)...)) { return static_cast<_Callable&&>(_Obj)(static_cast<_Types&&>(_Args)...); } }; struct _Invoker_pmf_object { static constexpr _Invoker_strategy _Strategy = _Invoker_strategy::_Pmf_object; template <class _Decayed, class _Ty1, class... _Types2> static constexpr auto _Call(_Decayed _Pmf, _Ty1&& _Arg1, _Types2&&... _Args2) noexcept( noexcept((static_cast<_Ty1&&>(_Arg1).*_Pmf)(static_cast<_Types2&&>(_Args2)...))) -> decltype((static_cast<_Ty1&&>(_Arg1).*_Pmf)(static_cast<_Types2&&>(_Args2)...)) { return (static_cast<_Ty1&&>(_Arg1).*_Pmf)(static_cast<_Types2&&>(_Args2)...); } }; struct _Invoker_pmf_refwrap { static constexpr _Invoker_strategy _Strategy = _Invoker_strategy::_Pmf_refwrap; template <class _Decayed, class _Refwrap, class... _Types2> static constexpr auto _Call(_Decayed _Pmf, _Refwrap _Rw, _Types2&&... _Args2) noexcept( noexcept((_Rw.get().*_Pmf)(static_cast<_Types2&&>(_Args2)...))) -> decltype((_Rw.get().*_Pmf)(static_cast<_Types2&&>(_Args2)...)) { return (_Rw.get().*_Pmf)(static_cast<_Types2&&>(_Args2)...); } }; struct _Invoker_pmf_pointer { static constexpr _Invoker_strategy _Strategy = _Invoker_strategy::_Pmf_pointer; template <class _Decayed, class _Ty1, class... _Types2> static constexpr auto _Call(_Decayed _Pmf, _Ty1&& _Arg1, _Types2&&... _Args2) noexcept( noexcept(((*static_cast<_Ty1&&>(_Arg1)).*_Pmf)(static_cast<_Types2&&>(_Args2)...))) -> decltype(((*static_cast<_Ty1&&>(_Arg1)).*_Pmf)(static_cast<_Types2&&>(_Args2)...)) { return ((*static_cast<_Ty1&&>(_Arg1)).*_Pmf)(static_cast<_Types2&&>(_Args2)...); } }; struct _Invoker_pmd_object { static constexpr _Invoker_strategy _Strategy = _Invoker_strategy::_Pmd_object; template <class _Decayed, class _Ty1> static constexpr auto _Call(_Decayed _Pmd, _Ty1&& _Arg1) noexcept -> decltype(static_cast<_Ty1&&>(_Arg1).*_Pmd) { return static_cast<_Ty1&&>(_Arg1).*_Pmd; } }; struct _Invoker_pmd_refwrap { static constexpr _Invoker_strategy _Strategy = _Invoker_strategy::_Pmd_refwrap; template <class _Decayed, class _Refwrap> static constexpr auto _Call(_Decayed _Pmd, _Refwrap _Rw) noexcept -> decltype(_Rw.get().*_Pmd) { return _Rw.get().*_Pmd; } }; struct _Invoker_pmd_pointer { static constexpr _Invoker_strategy _Strategy = _Invoker_strategy::_Pmd_pointer; template <class _Decayed, class _Ty1> static constexpr auto _Call(_Decayed _Pmd, _Ty1&& _Arg1) noexcept(noexcept((*static_cast<_Ty1&&>(_Arg1)).*_Pmd)) -> decltype((*static_cast<_Ty1&&>(_Arg1)).*_Pmd) { return (*static_cast<_Ty1&&>(_Arg1)).*_Pmd; } }; template <class _Callable, class _Ty1, class _Removed_cvref = _Remove_cvref_t<_Callable>, bool _Is_pmf = is_member_function_pointer_v<_Removed_cvref>, bool _Is_pmd = is_member_object_pointer_v<_Removed_cvref>> struct _Invoker1; template <class _Callable, class _Ty1, class _Removed_cvref> struct _Invoker1<_Callable, _Ty1, _Removed_cvref, true, false> : conditional_t<is_base_of_v<typename _Is_memfunptr<_Removed_cvref>::_Class_type, remove_reference_t<_Ty1>>, _Invoker_pmf_object, conditional_t<_Is_specialization_v<_Remove_cvref_t<_Ty1>, reference_wrapper>, _Invoker_pmf_refwrap, _Invoker_pmf_pointer>> {}; template <class _Callable, class _Ty1, class _Removed_cvref> struct _Invoker1<_Callable, _Ty1, _Removed_cvref, false, true> : conditional_t< is_base_of_v<typename _Is_member_object_pointer<_Removed_cvref>::_Class_type, remove_reference_t<_Ty1>>, _Invoker_pmd_object, conditional_t<_Is_specialization_v<_Remove_cvref_t<_Ty1>, reference_wrapper>, _Invoker_pmd_refwrap, _Invoker_pmd_pointer>> {}; template <class _Callable, class _Ty1, class _Removed_cvref> struct _Invoker1<_Callable, _Ty1, _Removed_cvref, false, false> : _Invoker_functor {}; template <class _Callable> constexpr auto invoke(_Callable&& _Obj) noexcept(noexcept(static_cast<_Callable&&>(_Obj)())) -> decltype(static_cast<_Callable&&>(_Obj)()) { return static_cast<_Callable&&>(_Obj)(); } template <class _Callable, class _Ty1, class... _Types2> constexpr auto invoke(_Callable&& _Obj, _Ty1&& _Arg1, _Types2&&... _Args2) noexcept( noexcept(_Invoker1<_Callable, _Ty1>::_Call( static_cast<_Callable&&>(_Obj), static_cast<_Ty1&&>(_Arg1), static_cast<_Types2&&>(_Args2)...))) -> decltype(_Invoker1<_Callable, _Ty1>::_Call( static_cast<_Callable&&>(_Obj), static_cast<_Ty1&&>(_Arg1), static_cast<_Types2&&>(_Args2)...)) { if constexpr (_Invoker1<_Callable, _Ty1>::_Strategy == _Invoker_strategy::_Functor) { return static_cast<_Callable&&>(_Obj)(static_cast<_Ty1&&>(_Arg1), static_cast<_Types2&&>(_Args2)...); } else if constexpr (_Invoker1<_Callable, _Ty1>::_Strategy == _Invoker_strategy::_Pmf_object) { return (static_cast<_Ty1&&>(_Arg1).*_Obj)(static_cast<_Types2&&>(_Args2)...); } else if constexpr (_Invoker1<_Callable, _Ty1>::_Strategy == _Invoker_strategy::_Pmf_refwrap) { return (_Arg1.get().*_Obj)(static_cast<_Types2&&>(_Args2)...); } else if constexpr (_Invoker1<_Callable, _Ty1>::_Strategy == _Invoker_strategy::_Pmf_pointer) { return ((*static_cast<_Ty1&&>(_Arg1)).*_Obj)(static_cast<_Types2&&>(_Args2)...); } else if constexpr (_Invoker1<_Callable, _Ty1>::_Strategy == _Invoker_strategy::_Pmd_object) { return static_cast<_Ty1&&>(_Arg1).*_Obj; } else if constexpr (_Invoker1<_Callable, _Ty1>::_Strategy == _Invoker_strategy::_Pmd_refwrap) { return _Arg1.get().*_Obj; } else { static_assert(_Invoker1<_Callable, _Ty1>::_Strategy == _Invoker_strategy::_Pmd_pointer, "bug in invoke"); return (*static_cast<_Ty1&&>(_Arg1)).*_Obj; } } #pragma warning(pop) #pragma warning(push) #pragma warning(disable : 4242) #pragma warning(disable : 4244) #pragma warning(disable : 4365) #pragma warning(disable : 5215) template <class _To> void _Implicitly_convert_to(_To) noexcept; template <class _From, class _To, bool = is_convertible_v<_From, _To>, bool = is_void_v<_To>> inline constexpr bool _Is_nothrow_convertible_v = noexcept(_Implicitly_convert_to<_To>(::std:: declval<_From>())); #pragma warning(pop) template <class _From, class _To, bool _IsVoid> inline constexpr bool _Is_nothrow_convertible_v<_From, _To, false, _IsVoid> = false; template <class _From, class _To> inline constexpr bool _Is_nothrow_convertible_v<_From, _To, true, true> = true; template <class _From, class _To> struct _Is_nothrow_convertible : bool_constant<_Is_nothrow_convertible_v<_From, _To>> { }; template <class _From, class _To> inline constexpr bool is_nothrow_convertible_v = _Is_nothrow_convertible_v<_From, _To>; template <class _From, class _To> using is_nothrow_convertible = _Is_nothrow_convertible<_From, _To>; template <class _Ty> _Ty _Returns_exactly() noexcept; template <class _From, class _To, class = void> struct _Invoke_convertible : false_type {}; template <class _From, class _To> struct _Invoke_convertible<_From, _To, void_t<decltype(_Implicitly_convert_to<_To>(_Returns_exactly<_From>()))>> : true_type {}; template <class _From, class _To> struct _Invoke_nothrow_convertible : bool_constant<noexcept(_Implicitly_convert_to<_To>(_Returns_exactly<_From>()))> {}; template <class _Result, bool _Nothrow> struct _Invoke_traits_common { using type = _Result; using _Is_invocable = true_type; using _Is_nothrow_invocable = bool_constant<_Nothrow>; template <class _Rx> using _Is_invocable_r = bool_constant<disjunction_v<is_void<_Rx>, _Invoke_convertible<type, _Rx>>>; template <class _Rx> using _Is_nothrow_invocable_r = bool_constant<conjunction_v<_Is_nothrow_invocable, disjunction<is_void<_Rx>, conjunction<_Invoke_convertible<type, _Rx>, _Invoke_nothrow_convertible<type, _Rx>>>>>; }; template <class _Void, class _Callable> struct _Invoke_traits_zero { using _Is_invocable = false_type; using _Is_nothrow_invocable = false_type; template <class _Rx> using _Is_invocable_r = false_type; template <class _Rx> using _Is_nothrow_invocable_r = false_type; }; template <class _Callable> using _Decltype_invoke_zero = decltype(::std:: declval<_Callable>()()); template <class _Callable> struct _Invoke_traits_zero<void_t<_Decltype_invoke_zero<_Callable>>, _Callable> : _Invoke_traits_common<_Decltype_invoke_zero<_Callable>, noexcept(::std:: declval<_Callable>()())> {}; template <class _Void, class... _Types> struct _Invoke_traits_nonzero { using _Is_invocable = false_type; using _Is_nothrow_invocable = false_type; template <class _Rx> using _Is_invocable_r = false_type; template <class _Rx> using _Is_nothrow_invocable_r = false_type; }; template <class _Callable, class _Ty1, class... _Types2> using _Decltype_invoke_nonzero = decltype( _Invoker1<_Callable, _Ty1>::_Call(::std:: declval<_Callable>(), ::std:: declval<_Ty1>(), ::std:: declval<_Types2>()...)); template <class _Callable, class _Ty1, class... _Types2> struct _Invoke_traits_nonzero<void_t<_Decltype_invoke_nonzero<_Callable, _Ty1, _Types2...>>, _Callable, _Ty1, _Types2...> : _Invoke_traits_common<_Decltype_invoke_nonzero<_Callable, _Ty1, _Types2...>, noexcept(_Invoker1<_Callable, _Ty1>::_Call( ::std:: declval<_Callable>(), ::std:: declval<_Ty1>(), ::std:: declval<_Types2>()...))> {}; template <class _Callable, class... _Args> using _Select_invoke_traits = conditional_t<sizeof...(_Args) == 0, _Invoke_traits_zero<void, _Callable>, _Invoke_traits_nonzero<void, _Callable, _Args...>>; template <class _Callable, class... _Args> using _Invoke_result_t = typename _Select_invoke_traits<_Callable, _Args...>::type; template <class _Rx, class _Callable, class... _Args> using _Is_invocable_r_ = typename _Select_invoke_traits<_Callable, _Args...>::template _Is_invocable_r<_Rx>; template <class _Rx, class _Callable, class... _Args> struct _Is_invocable_r : _Is_invocable_r_<_Rx, _Callable, _Args...> { }; template <class _Callable, class... _Args> struct invoke_result : _Select_invoke_traits<_Callable, _Args...> { }; template <class _Callable, class... _Args> using invoke_result_t = typename _Select_invoke_traits<_Callable, _Args...>::type; template <class _Callable, class... _Args> struct is_invocable : _Select_invoke_traits<_Callable, _Args...>::_Is_invocable { }; template <class _Callable, class... _Args> inline constexpr bool is_invocable_v = _Select_invoke_traits<_Callable, _Args...>::_Is_invocable::value; template <class _Callable, class... _Args> struct is_nothrow_invocable : _Select_invoke_traits<_Callable, _Args...>::_Is_nothrow_invocable { }; template <class _Callable, class... _Args> inline constexpr bool is_nothrow_invocable_v = _Select_invoke_traits<_Callable, _Args...>::_Is_nothrow_invocable::value; template <class _Rx, class _Callable, class... _Args> struct is_invocable_r : _Is_invocable_r_<_Rx, _Callable, _Args...> { }; template <class _Rx, class _Callable, class... _Args> inline constexpr bool is_invocable_r_v = _Is_invocable_r_<_Rx, _Callable, _Args...>::value; template <class _Rx, class _Callable, class... _Args> struct is_nothrow_invocable_r : _Select_invoke_traits<_Callable, _Args...>::template _Is_nothrow_invocable_r<_Rx> { }; template <class _Rx, class _Callable, class... _Args> inline constexpr bool is_nothrow_invocable_r_v = _Select_invoke_traits<_Callable, _Args...>::template _Is_nothrow_invocable_r<_Rx>::value; template <class _Ty1, class _Ty2> struct is_layout_compatible : bool_constant<__is_layout_compatible(_Ty1, _Ty2)> {}; template <class _Ty1, class _Ty2> inline constexpr bool is_layout_compatible_v = __is_layout_compatible(_Ty1, _Ty2); template <class _Base, class _Derived> struct is_pointer_interconvertible_base_of : bool_constant<__is_pointer_interconvertible_base_of(_Base, _Derived)> {}; template <class _Base, class _Derived> inline constexpr bool is_pointer_interconvertible_base_of_v = __is_pointer_interconvertible_base_of(_Base, _Derived); template <class _ClassTy, class _MemberTy> [[nodiscard]] constexpr bool is_pointer_interconvertible_with_class(_MemberTy _ClassTy::*_Pm) noexcept { return __is_pointer_interconvertible_with_class(_ClassTy, _Pm); } template <class _ClassTy1, class _ClassTy2, class _MemberTy1, class _MemberTy2> [[nodiscard]] constexpr bool is_corresponding_member(_MemberTy1 _ClassTy1::*_Pm1, _MemberTy2 _ClassTy2::*_Pm2) noexcept { return __is_corresponding_member(_ClassTy1, _ClassTy2, _Pm1, _Pm2); } template <class _Ty> struct _Function_args {}; template <class _Ret, class... _Types> struct _Function_args<_Ret __cdecl(_Types...) > : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __vectorcall(_Types...) > : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __cdecl(_Types...) const > : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __vectorcall(_Types...) const > : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __cdecl(_Types...) volatile > : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __vectorcall(_Types...) volatile > : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __cdecl(_Types...) const volatile > : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __vectorcall(_Types...) const volatile > : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __cdecl(_Types...) & > : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __vectorcall(_Types...) & > : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __cdecl(_Types...) const & > : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __vectorcall(_Types...) const & > : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __cdecl(_Types...) volatile & > : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __vectorcall(_Types...) volatile & > : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __cdecl(_Types...) const volatile & > : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __vectorcall(_Types...) const volatile & > : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __cdecl(_Types...) && > : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __vectorcall(_Types...) && > : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __cdecl(_Types...) const && > : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __vectorcall(_Types...) const && > : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __cdecl(_Types...) volatile && > : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __vectorcall(_Types...) volatile && > : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __cdecl(_Types...) const volatile && > : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __vectorcall(_Types...) const volatile && > : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __cdecl(_Types...) noexcept> : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __vectorcall(_Types...) noexcept> : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __cdecl(_Types...) const noexcept> : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __vectorcall(_Types...) const noexcept> : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __cdecl(_Types...) volatile noexcept> : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __vectorcall(_Types...) volatile noexcept> : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __cdecl(_Types...) const volatile noexcept> : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __vectorcall(_Types...) const volatile noexcept> : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __cdecl(_Types...) & noexcept> : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __vectorcall(_Types...) & noexcept> : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __cdecl(_Types...) const & noexcept> : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __vectorcall(_Types...) const & noexcept> : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __cdecl(_Types...) volatile & noexcept> : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __vectorcall(_Types...) volatile & noexcept> : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __cdecl(_Types...) const volatile & noexcept> : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __vectorcall(_Types...) const volatile & noexcept> : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __cdecl(_Types...) && noexcept> : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __vectorcall(_Types...) && noexcept> : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __cdecl(_Types...) const && noexcept> : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __vectorcall(_Types...) const && noexcept> : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __cdecl(_Types...) volatile && noexcept> : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __vectorcall(_Types...) volatile && noexcept> : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __cdecl(_Types...) const volatile && noexcept> : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret __vectorcall(_Types...) const volatile && noexcept> : _Arg_types<_Types...> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret(_Types..., ...) > { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret(_Types..., ...) const> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret(_Types..., ...) volatile> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret(_Types..., ...) const volatile> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret(_Types..., ...) &> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret(_Types..., ...) const&> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret(_Types..., ...) volatile&> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret(_Types..., ...) const volatile&> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret(_Types..., ...) &&> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret(_Types..., ...) const&&> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret(_Types..., ...) volatile&&> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret(_Types..., ...) const volatile&&> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret(_Types..., ...) noexcept> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret(_Types..., ...) const noexcept> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret(_Types..., ...) volatile noexcept> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret(_Types..., ...) const volatile noexcept> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret(_Types..., ...) &noexcept> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret(_Types..., ...) const& noexcept> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret(_Types..., ...) volatile& noexcept> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret(_Types..., ...) const volatile& noexcept> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret(_Types..., ...) &&noexcept> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret(_Types..., ...) const&& noexcept> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret(_Types..., ...) volatile&& noexcept> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class... _Types> struct _Function_args<_Ret(_Types..., ...) const volatile&& noexcept> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ty, class = void> struct _Weak_result_type {}; __pragma(warning(push)) __pragma(warning(disable : 4996)) template <class _Ty> struct _Weak_result_type<_Ty, void_t<typename _Ty::result_type>> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef typename _Ty::result_type _Unnameable_result; }; __pragma(warning(pop)) template <class _Ty, class = void> struct _Weak_argument_type : _Weak_result_type<_Ty> {}; __pragma(warning(push)) __pragma(warning(disable : 4996)) template <class _Ty> struct _Weak_argument_type<_Ty, void_t<typename _Ty::argument_type>> : _Weak_result_type<_Ty> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef typename _Ty::argument_type _Unnameable_argument; }; __pragma(warning(pop)) template <class _Ty, class = void> struct _Weak_binary_args : _Weak_argument_type<_Ty> {}; __pragma(warning(push)) __pragma(warning(disable : 4996)) template <class _Ty> struct _Weak_binary_args<_Ty, void_t<typename _Ty::first_argument_type, typename _Ty::second_argument_type>> : _Weak_argument_type<_Ty> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef typename _Ty::first_argument_type _Unnameable_first_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef typename _Ty::second_argument_type _Unnameable_second_argument; }; __pragma(warning(pop)) template <class _Ty> using _Weak_types = conditional_t<is_function_v<remove_pointer_t<_Ty>>, _Function_args<remove_pointer_t<_Ty>>, conditional_t<is_member_function_pointer_v<_Ty>, _Is_memfunptr<remove_cv_t<_Ty>>, _Weak_binary_args<_Ty>>>; template <class _Ty> void _Refwrap_ctor_fun(_Identity_t<_Ty&>) noexcept; template <class _Ty> void _Refwrap_ctor_fun(_Identity_t<_Ty&&>) = delete; template <class _Ty, class _Uty, class = void> struct _Refwrap_has_ctor_from : false_type {}; template <class _Ty, class _Uty> struct _Refwrap_has_ctor_from<_Ty, _Uty, void_t<decltype(_Refwrap_ctor_fun<_Ty>(::std:: declval<_Uty>()))>> : true_type {}; template <class _Ty> class reference_wrapper { public: static_assert(is_object_v<_Ty> || is_function_v<_Ty>, "reference_wrapper<T> requires T to be an object type or a function type."); using type = _Ty; template <class _Uty, enable_if_t<conjunction_v<negation<is_same<_Remove_cvref_t<_Uty>, reference_wrapper>>, _Refwrap_has_ctor_from<_Ty, _Uty>>, int> = 0> constexpr reference_wrapper(_Uty&& _Val) noexcept(noexcept(_Refwrap_ctor_fun<_Ty>(::std:: declval<_Uty>()))) { _Ty& _Ref = static_cast<_Uty&&>(_Val); _Ptr = ::std:: addressof(_Ref); } constexpr operator _Ty&() const noexcept { return *_Ptr; } [[nodiscard]] constexpr _Ty& get() const noexcept { return *_Ptr; } private: _Ty* _Ptr{}; public: template <class... _Types> constexpr auto operator()(_Types&&... _Args) const noexcept(noexcept(::std:: invoke(*_Ptr, static_cast<_Types&&>(_Args)...))) -> decltype(::std:: invoke(*_Ptr, static_cast<_Types&&>(_Args)...)) { return ::std:: invoke(*_Ptr, static_cast<_Types&&>(_Args)...); } }; template <class _Ty> reference_wrapper(_Ty&) -> reference_wrapper<_Ty>; template <class _Ty> [[nodiscard]] constexpr reference_wrapper<_Ty> ref(_Ty& _Val) noexcept { return reference_wrapper<_Ty>(_Val); } template <class _Ty> void ref(const _Ty&&) = delete; template <class _Ty> [[nodiscard]] constexpr reference_wrapper<_Ty> ref(reference_wrapper<_Ty> _Val) noexcept { return ::std:: ref(_Val.get()); } template <class _Ty> [[nodiscard]] constexpr reference_wrapper<const _Ty> cref(const _Ty& _Val) noexcept { return reference_wrapper<const _Ty>(_Val); } template <class _Ty> void cref(const _Ty&&) = delete; template <class _Ty> [[nodiscard]] constexpr reference_wrapper<const _Ty> cref(reference_wrapper<_Ty> _Val) noexcept { return ::std:: cref(_Val.get()); } template <class _Ty> struct unwrap_reference { using type = _Ty; }; template <class _Ty> struct unwrap_reference<reference_wrapper<_Ty>> { using type = _Ty&; }; template <class _Ty> using unwrap_reference_t = typename unwrap_reference<_Ty>::type; template <class _Ty> using unwrap_ref_decay_t = unwrap_reference_t<decay_t<_Ty>>; template <class _Ty> struct unwrap_ref_decay { using type = unwrap_ref_decay_t<_Ty>; }; template <class _Ty> struct _Is_swappable; template <class _Ty> struct _Is_nothrow_swappable; template <class _Ty, enable_if_t<is_move_constructible_v<_Ty> && is_move_assignable_v<_Ty>, int> = 0> constexpr void swap(_Ty&, _Ty&) noexcept(is_nothrow_move_constructible_v<_Ty>&& is_nothrow_move_assignable_v<_Ty>); template <class _Ty, size_t _Size, enable_if_t<_Is_swappable<_Ty>::value, int> = 0> constexpr void swap(_Ty (&)[_Size], _Ty (&)[_Size]) noexcept(_Is_nothrow_swappable<_Ty>::value); template <class _Ty1, class _Ty2, class = void> struct _Swappable_with_helper : false_type {}; template <class _Ty1, class _Ty2> struct _Swappable_with_helper<_Ty1, _Ty2, void_t<decltype(swap(::std:: declval<_Ty1>(), ::std:: declval<_Ty2>()))>> : true_type {}; template <class _Ty1, class _Ty2> struct _Is_swappable_with : bool_constant<conjunction_v<_Swappable_with_helper<_Ty1, _Ty2>, _Swappable_with_helper<_Ty2, _Ty1>>> { }; template <class _Ty> struct _Is_swappable : _Is_swappable_with<add_lvalue_reference_t<_Ty>, add_lvalue_reference_t<_Ty>>::type { }; template <class _Ty1, class _Ty2> struct _Swap_cannot_throw : bool_constant<noexcept(swap(::std:: declval<_Ty1>(), ::std:: declval<_Ty2>())) && noexcept(swap(::std:: declval<_Ty2>(), ::std:: declval<_Ty1>()))> { }; template <class _Ty1, class _Ty2> struct _Is_nothrow_swappable_with : bool_constant<conjunction_v<_Is_swappable_with<_Ty1, _Ty2>, _Swap_cannot_throw<_Ty1, _Ty2>>> { }; template <class _Ty> struct _Is_nothrow_swappable : _Is_nothrow_swappable_with<add_lvalue_reference_t<_Ty>, add_lvalue_reference_t<_Ty>>::type { }; template <class _Ty1, class _Ty2> struct is_swappable_with : _Is_swappable_with<_Ty1, _Ty2>::type { }; template <class _Ty1, class _Ty2> inline constexpr bool is_swappable_with_v = conjunction_v<_Swappable_with_helper<_Ty1, _Ty2>, _Swappable_with_helper<_Ty2, _Ty1>>; template <class _Ty> struct is_swappable : _Is_swappable<_Ty>::type {}; template <class _Ty> inline constexpr bool is_swappable_v = _Is_swappable<_Ty>::value; template <class _Ty1, class _Ty2> struct is_nothrow_swappable_with : _Is_nothrow_swappable_with<_Ty1, _Ty2>::type { }; template <class _Ty1, class _Ty2> inline constexpr bool is_nothrow_swappable_with_v = _Is_nothrow_swappable_with<_Ty1, _Ty2>::value; template <class _Ty> struct is_nothrow_swappable : _Is_nothrow_swappable<_Ty>::type { }; template <class _Ty> inline constexpr bool is_nothrow_swappable_v = _Is_nothrow_swappable<_Ty>::value; namespace _Has_ADL_swap_detail { void swap(); template <class, class = void> struct _Has_ADL_swap : false_type {}; template <class _Ty> struct _Has_ADL_swap<_Ty, void_t<decltype(swap(::std:: declval<_Ty&>(), ::std:: declval<_Ty&>()))>> : true_type {}; } using _Has_ADL_swap_detail::_Has_ADL_swap; template <class _Ty> inline constexpr bool _Is_trivially_swappable_v = conjunction_v<is_trivially_destructible<_Ty>, is_trivially_move_constructible<_Ty>, is_trivially_move_assignable<_Ty>, negation<_Has_ADL_swap<_Ty>>>; template <class _Ty> struct _Is_trivially_swappable : bool_constant<_Is_trivially_swappable_v<_Ty>> { }; inline constexpr size_t _FNV_offset_basis = 14695981039346656037ULL; inline constexpr size_t _FNV_prime = 1099511628211ULL; [[nodiscard]] inline size_t _Fnv1a_append_bytes(size_t _Val, const unsigned char* const _First, const size_t _Count) noexcept { for (size_t _Idx = 0; _Idx < _Count; ++_Idx) { _Val ^= static_cast<size_t>(_First[_Idx]); _Val *= _FNV_prime; } return _Val; } template <class _Ty> [[nodiscard]] size_t _Fnv1a_append_range(const size_t _Val, const _Ty* const _First, const _Ty* const _Last) noexcept { static_assert(is_trivial_v<_Ty>, "Only trivial types can be directly hashed."); const auto _Firstb = reinterpret_cast<const unsigned char*>(_First); const auto _Lastb = reinterpret_cast<const unsigned char*>(_Last); return _Fnv1a_append_bytes(_Val, _Firstb, static_cast<size_t>(_Lastb - _Firstb)); } template <class _Kty> [[nodiscard]] size_t _Fnv1a_append_value( const size_t _Val, const _Kty& _Keyval) noexcept { static_assert(is_trivial_v<_Kty>, "Only trivial types can be directly hashed."); return _Fnv1a_append_bytes(_Val, &reinterpret_cast<const unsigned char&>(_Keyval), sizeof(_Kty)); } template <class _Kty> [[nodiscard]] size_t _Hash_representation(const _Kty& _Keyval) noexcept { return _Fnv1a_append_value(_FNV_offset_basis, _Keyval); } template <class _Kty> [[nodiscard]] size_t _Hash_array_representation( const _Kty* const _First, const size_t _Count) noexcept { static_assert(is_trivial_v<_Kty>, "Only trivial types can be directly hashed."); return _Fnv1a_append_bytes( _FNV_offset_basis, reinterpret_cast<const unsigned char*>(_First), _Count * sizeof(_Kty)); } template <class _Kty> struct hash; template <class _Kty, bool _Enabled> struct _Conditionally_enabled_hash { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Kty _Unnameable_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef size_t _Unnameable_result; [[nodiscard]] size_t operator()(const _Kty& _Keyval) const noexcept(noexcept(hash<_Kty>::_Do_hash(_Keyval))) { return hash<_Kty>::_Do_hash(_Keyval); } }; template <class _Kty> struct _Conditionally_enabled_hash<_Kty, false> { _Conditionally_enabled_hash() = delete; _Conditionally_enabled_hash(const _Conditionally_enabled_hash&) = delete; _Conditionally_enabled_hash(_Conditionally_enabled_hash&&) = delete; _Conditionally_enabled_hash& operator=(const _Conditionally_enabled_hash&) = delete; _Conditionally_enabled_hash& operator=(_Conditionally_enabled_hash&&) = delete; }; template <class _Kty> struct hash : _Conditionally_enabled_hash<_Kty, !is_const_v<_Kty> && !is_volatile_v<_Kty> && (is_enum_v<_Kty> || is_integral_v<_Kty> || is_pointer_v<_Kty>)> { static size_t _Do_hash(const _Kty& _Keyval) noexcept { return _Hash_representation(_Keyval); } }; template <> struct hash<float> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef float _Unnameable_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef size_t _Unnameable_result; [[nodiscard]] size_t operator()(const float _Keyval) const noexcept { return _Hash_representation(_Keyval == 0.0F ? 0.0F : _Keyval); } }; template <> struct hash<double> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef double _Unnameable_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef size_t _Unnameable_result; [[nodiscard]] size_t operator()(const double _Keyval) const noexcept { return _Hash_representation(_Keyval == 0.0 ? 0.0 : _Keyval); } }; template <> struct hash<long double> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef long double _Unnameable_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef size_t _Unnameable_result; [[nodiscard]] size_t operator()(const long double _Keyval) const noexcept { return _Hash_representation(_Keyval == 0.0L ? 0.0L : _Keyval); } }; template <> struct hash<nullptr_t> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef nullptr_t _Unnameable_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef size_t _Unnameable_result; [[nodiscard]] size_t operator()(nullptr_t) const noexcept { void* _Null{}; return _Hash_representation(_Null); } }; template <class _Kty, class = void> struct _Is_nothrow_hashable : false_type {}; template <class _Kty> struct _Is_nothrow_hashable<_Kty, void_t<decltype(hash<_Kty>{}(::std:: declval<const _Kty&>()))>> : bool_constant<noexcept(hash<_Kty>{}(::std:: declval<const _Kty&>()))> {}; template <class _FloatingType> struct _Floating_type_traits; template <> struct _Floating_type_traits<float> { static constexpr int32_t _Mantissa_bits = 24; static constexpr int32_t _Exponent_bits = 8; static constexpr int32_t _Maximum_binary_exponent = 127; static constexpr int32_t _Minimum_binary_exponent = -126; static constexpr int32_t _Exponent_bias = 127; static constexpr int32_t _Sign_shift = 31; static constexpr int32_t _Exponent_shift = 23; using _Uint_type = uint32_t; static constexpr uint32_t _Exponent_mask = 0x000000FFu; static constexpr uint32_t _Normal_mantissa_mask = 0x00FFFFFFu; static constexpr uint32_t _Denormal_mantissa_mask = 0x007FFFFFu; static constexpr uint32_t _Special_nan_mantissa_mask = 0x00400000u; static constexpr uint32_t _Shifted_sign_mask = 0x80000000u; static constexpr uint32_t _Shifted_exponent_mask = 0x7F800000u; }; template <> struct _Floating_type_traits<double> { static constexpr int32_t _Mantissa_bits = 53; static constexpr int32_t _Exponent_bits = 11; static constexpr int32_t _Maximum_binary_exponent = 1023; static constexpr int32_t _Minimum_binary_exponent = -1022; static constexpr int32_t _Exponent_bias = 1023; static constexpr int32_t _Sign_shift = 63; static constexpr int32_t _Exponent_shift = 52; using _Uint_type = uint64_t; static constexpr uint64_t _Exponent_mask = 0x00000000000007FFu; static constexpr uint64_t _Normal_mantissa_mask = 0x001FFFFFFFFFFFFFu; static constexpr uint64_t _Denormal_mantissa_mask = 0x000FFFFFFFFFFFFFu; static constexpr uint64_t _Special_nan_mantissa_mask = 0x0008000000000000u; static constexpr uint64_t _Shifted_sign_mask = 0x8000000000000000u; static constexpr uint64_t _Shifted_exponent_mask = 0x7FF0000000000000u; }; template <> struct _Floating_type_traits<long double> : _Floating_type_traits<double> {}; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) template <typename T> struct type_wrapper { using type = T; }; template <auto v> struct value_as_type { static constexpr auto value = v; using type = decltype(value); [[nodiscard]] constexpr type to_value() const noexcept { return v; } [[nodiscard]] constexpr operator type() const noexcept { return v; } }; template <typename...> constexpr bool false_v = false; template <bool condition> using sfinae = std::enable_if_t<condition, bool>; #pragma once #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4514 4820 ) #pragma warning(disable: 4985) extern "C++" { #pragma pack(push, 8) namespace std { enum class align_val_t : size_t {}; } namespace std { struct nothrow_t { explicit nothrow_t() = default; }; extern nothrow_t const nothrow; } [[nodiscard]] __declspec(allocator) void* __cdecl operator new( size_t _Size ); [[nodiscard]] __declspec(allocator) void* __cdecl operator new( size_t _Size, ::std::nothrow_t const& ) noexcept; [[nodiscard]] __declspec(allocator) void* __cdecl operator new[]( size_t _Size ); [[nodiscard]] __declspec(allocator) void* __cdecl operator new[]( size_t _Size, ::std::nothrow_t const& ) noexcept; void __cdecl operator delete( void* _Block ) noexcept; void __cdecl operator delete( void* _Block, ::std::nothrow_t const& ) noexcept; void __cdecl operator delete[]( void* _Block ) noexcept; void __cdecl operator delete[]( void* _Block, ::std::nothrow_t const& ) noexcept; void __cdecl operator delete( void* _Block, size_t _Size ) noexcept; void __cdecl operator delete[]( void* _Block, size_t _Size ) noexcept; [[nodiscard]] __declspec(allocator) void* __cdecl operator new( size_t _Size, ::std::align_val_t _Al ); [[nodiscard]] __declspec(allocator) void* __cdecl operator new( size_t _Size, ::std::align_val_t _Al, ::std::nothrow_t const& ) noexcept; [[nodiscard]] __declspec(allocator) void* __cdecl operator new[]( size_t _Size, ::std::align_val_t _Al ); [[nodiscard]] __declspec(allocator) void* __cdecl operator new[]( size_t _Size, ::std::align_val_t _Al, ::std::nothrow_t const& ) noexcept; void __cdecl operator delete( void* _Block, ::std::align_val_t _Al ) noexcept; void __cdecl operator delete( void* _Block, ::std::align_val_t _Al, ::std::nothrow_t const& ) noexcept; void __cdecl operator delete[]( void* _Block, ::std::align_val_t _Al ) noexcept; void __cdecl operator delete[]( void* _Block, ::std::align_val_t _Al, ::std::nothrow_t const& ) noexcept; void __cdecl operator delete( void* _Block, size_t _Size, ::std::align_val_t _Al ) noexcept; void __cdecl operator delete[]( void* _Block, size_t _Size, ::std::align_val_t _Al ) noexcept; #pragma warning(push) #pragma warning(disable: 4577) #pragma warning(disable: 4514) [[nodiscard]] inline void* __cdecl operator new(size_t _Size, void* _Where) noexcept { (void)_Size; return _Where; } inline void __cdecl operator delete(void*, void*) noexcept { return; } [[nodiscard]] inline void* __cdecl operator new[](size_t _Size, void* _Where) noexcept { (void)_Size; return _Where; } inline void __cdecl operator delete[](void*, void*) noexcept { } #pragma warning(pop) #pragma pack(pop) } #pragma warning(pop) #pragma external_header(pop) #pragma warning(push) #pragma warning(disable: 4514 4820 ) extern "C++" { #pragma pack(push, 8) [[nodiscard]] __declspec(allocator) void* __cdecl operator new( size_t _Size, int _BlockUse, char const* _FileName, int _LineNumber ); [[nodiscard]] __declspec(allocator) void* __cdecl operator new[]( size_t _Size, int _BlockUse, char const* _FileName, int _LineNumber ); void __cdecl operator delete( void* _Block, int _BlockUse, char const* _FileName, int _LineNumber ) noexcept; void __cdecl operator delete[]( void* _Block, int _BlockUse, char const* _FileName, int _LineNumber ) noexcept; #pragma pack(pop) } #pragma warning(pop) #pragma external_header(pop) #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { typedef void* _HFILE; typedef int (__cdecl* _CRT_REPORT_HOOK )(int, char*, int*); typedef int (__cdecl* _CRT_REPORT_HOOKW)(int, wchar_t*, int*); typedef int (__cdecl* _CRT_ALLOC_HOOK)(int, void*, size_t, int, long, unsigned char const*, int); typedef void (__cdecl* _CRT_DUMP_CLIENT)(void*, size_t); struct _CrtMemBlockHeader; typedef struct _CrtMemState { struct _CrtMemBlockHeader* pBlockHeader; size_t lCounts[5]; size_t lSizes[5]; size_t lHighWaterCount; size_t lTotalCount; } _CrtMemState; __declspec(dllimport) int* __cdecl __p__crtDbgFlag(void); __declspec(dllimport) long* __cdecl __p__crtBreakAlloc(void); __declspec(dllimport) _CRT_ALLOC_HOOK __cdecl _CrtGetAllocHook(void); __declspec(dllimport) _CRT_ALLOC_HOOK __cdecl _CrtSetAllocHook( _CRT_ALLOC_HOOK _PfnNewHook ); __declspec(dllimport) _CRT_DUMP_CLIENT __cdecl _CrtGetDumpClient(void); __declspec(dllimport) _CRT_DUMP_CLIENT __cdecl _CrtSetDumpClient( _CRT_DUMP_CLIENT _PFnNewDump ); __declspec(dllimport) int __cdecl _CrtCheckMemory(void); typedef void (__cdecl* _CrtDoForAllClientObjectsCallback)(void*, void*); __declspec(dllimport) void __cdecl _CrtDoForAllClientObjects( _CrtDoForAllClientObjectsCallback _Callback, void* _Context ); __declspec(dllimport) int __cdecl _CrtDumpMemoryLeaks(void); __declspec(dllimport) int __cdecl _CrtIsMemoryBlock( void const* _Block, unsigned int _Size, long* _RequestNumber, char** _FileName, int* _LineNumber ); __declspec(dllimport) int __cdecl _CrtIsValidHeapPointer( void const* _Pointer ); __declspec(dllimport) int __cdecl _CrtIsValidPointer( void const* _Pointer, unsigned int _Size, int _ReadWrite ); __declspec(dllimport) void __cdecl _CrtMemCheckpoint( _CrtMemState* _State ); __declspec(dllimport) int __cdecl _CrtMemDifference( _CrtMemState* _State, _CrtMemState const* _OldState, _CrtMemState const* _NewState ); __declspec(dllimport) void __cdecl _CrtMemDumpAllObjectsSince( _CrtMemState const* _State ); __declspec(dllimport) void __cdecl _CrtMemDumpStatistics( _CrtMemState const* _State ); __declspec(dllimport) int __cdecl _CrtReportBlockType( void const* _Block ); __declspec(dllimport) long __cdecl _CrtSetBreakAlloc( long _NewValue ); __declspec(dllimport) int __cdecl _CrtSetDbgFlag( int _NewFlag ); __declspec(dllimport) void __cdecl _aligned_free_dbg( void* _Block ); __declspec(dllimport) __declspec(allocator) void* __cdecl _aligned_malloc_dbg( size_t _Size, size_t _Alignment, char const* _FileName, int _LineNumber ); __declspec(dllimport) size_t __cdecl _aligned_msize_dbg( void* _Block, size_t _Alignment, size_t _Offset ); __declspec(dllimport) __declspec(allocator) void* __cdecl _aligned_offset_malloc_dbg( size_t _Size, size_t _Alignment, size_t _Offset, char const* _FileName, int _LineNumber ); __declspec(dllimport) __declspec(allocator) void* __cdecl _aligned_offset_realloc_dbg( void* _Block, size_t _Size, size_t _Alignment, size_t _Offset, char const* _FileName, int _LineNumber ); __declspec(dllimport) __declspec(allocator) void* __cdecl _aligned_offset_recalloc_dbg( void* _Block, size_t _Count, size_t _Size, size_t _Alignment, size_t _Offset, char const* _FileName, int _LineNumber ); __declspec(dllimport) __declspec(allocator) void* __cdecl _aligned_realloc_dbg( void* _Block, size_t _Size, size_t _Alignment, char const* _FileName, int _LineNumber ); __declspec(dllimport) __declspec(allocator) void* __cdecl _aligned_recalloc_dbg( void* _Block, size_t _Count, size_t _Size, size_t _Alignment, char const* _FileName, int _LineNumber ); __declspec(dllimport) __declspec(allocator) void* __cdecl _calloc_dbg( size_t _Count, size_t _Size, int _BlockUse, char const* _FileName, int _LineNumber ); __declspec(dllimport) __declspec(allocator) void* __cdecl _expand_dbg( void* _Block, size_t _Size, int _BlockUse, char const* _FileName, int _LineNumber ); __declspec(dllimport) void __cdecl _free_dbg( void* _Block, int _BlockUse ); __declspec(dllimport) __declspec(allocator) void* __cdecl _malloc_dbg( size_t _Size, int _BlockUse, char const* _FileName, int _LineNumber ); __declspec(dllimport) size_t __cdecl _msize_dbg( void* _Block, int _BlockUse ); __declspec(dllimport) __declspec(allocator) void* __cdecl _realloc_dbg( void* _Block, size_t _Size, int _BlockUse, char const* _FileName, int _LineNumber ); __declspec(dllimport) __declspec(allocator) void* __cdecl _recalloc_dbg( void* _Block, size_t _Count, size_t _Size, int _BlockUse, char const* _FileName, int _LineNumber ); __declspec(dllimport) errno_t __cdecl _dupenv_s_dbg( char** _PBuffer, size_t* _PBufferSizeInBytes, char const* _VarName, int _BlockType, char const* _FileName, int _LineNumber ); __declspec(dllimport) __declspec(allocator) char* __cdecl _fullpath_dbg( char* _FullPath, char const* _Path, size_t _SizeInBytes, int _BlockType, char const* _FileName, int _LineNumber ); __declspec(dllimport) __declspec(allocator) char* __cdecl _getcwd_dbg( char* _DstBuf, int _SizeInBytes, int _BlockType, char const* _FileName, int _LineNumber ); __declspec(dllimport) __declspec(allocator) char* __cdecl _getdcwd_dbg( int _Drive, char* _DstBuf, int _SizeInBytes, int _BlockType, char const* _FileName, int _LineNumber ); __declspec(dllimport) __declspec(allocator) char* __cdecl _strdup_dbg( char const* _String, int _BlockUse, char const* _FileName, int _LineNumber ); __declspec(dllimport) __declspec(allocator) char* __cdecl _tempnam_dbg( char const* _DirName, char const* _FilePrefix, int _BlockType, char const* _FileName, int _LineNumber ); __declspec(dllimport) __declspec(allocator) wchar_t* __cdecl _wcsdup_dbg( wchar_t const* _String, int _BlockUse, char const* _FileName, int _LineNumber ); __declspec(dllimport) errno_t __cdecl _wdupenv_s_dbg( wchar_t** _PBuffer, size_t* _PBufferSizeInWords, wchar_t const* _VarName, int _BlockType, char const* _FileName, int _LineNumber ); __declspec(dllimport) __declspec(allocator) wchar_t* __cdecl _wfullpath_dbg( wchar_t* _FullPath, wchar_t const* _Path, size_t _SizeInWords, int _BlockType, char const* _FileName, int _LineNumber ); __declspec(dllimport) __declspec(allocator) wchar_t* __cdecl _wgetcwd_dbg( wchar_t* _DstBuf, int _SizeInWords, int _BlockType, char const* _FileName, int _LineNumber ); __declspec(dllimport) __declspec(allocator) wchar_t* __cdecl _wgetdcwd_dbg( int _Drive, wchar_t* _DstBuf, int _SizeInWords, int _BlockType, char const* _FileName, int _LineNumber ); __declspec(dllimport) __declspec(allocator) wchar_t* __cdecl _wtempnam_dbg( wchar_t const* _DirName, wchar_t const* _FilePrefix, int _BlockType, char const* _FileName, int _LineNumber ); __declspec(dllimport) int __cdecl _CrtDbgReport( int _ReportType, char const* _FileName, int _Linenumber, char const* _ModuleName, char const* _Format, ...); __declspec(dllimport) int __cdecl _CrtDbgReportW( int _ReportType, wchar_t const* _FileName, int _LineNumber, wchar_t const* _ModuleName, wchar_t const* _Format, ...); __declspec(dllimport) int __cdecl _VCrtDbgReportA( int _ReportType, void* _ReturnAddress, char const* _FileName, int _LineNumber, char const* _ModuleName, char const* _Format, va_list _ArgList ); __declspec(dllimport) int __cdecl _VCrtDbgReportW( int _ReportType, void* _ReturnAddress, wchar_t const* _FileName, int _LineNumber, wchar_t const* _ModuleName, wchar_t const* _Format, va_list _ArgList ); __declspec(dllimport) size_t __cdecl _CrtSetDebugFillThreshold( size_t _NewDebugFillThreshold ); __declspec(dllimport) size_t __cdecl _CrtGetDebugFillThreshold(void); __declspec(dllimport) _HFILE __cdecl _CrtSetReportFile( int _ReportType, _HFILE _ReportFile ); __declspec(dllimport) int __cdecl _CrtSetReportMode( int _ReportType, int _ReportMode ); extern long _crtAssertBusy; __declspec(dllimport) _CRT_REPORT_HOOK __cdecl _CrtGetReportHook(void); __declspec(dllimport) _CRT_REPORT_HOOK __cdecl _CrtSetReportHook( _CRT_REPORT_HOOK _PFnNewHook ); __declspec(dllimport) int __cdecl _CrtSetReportHook2( int _Mode, _CRT_REPORT_HOOK _PFnNewHook ); __declspec(dllimport) int __cdecl _CrtSetReportHookW2( int _Mode, _CRT_REPORT_HOOKW _PFnNewHook ); } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma external_header(push) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) #pragma detect_mismatch("_MSC_VER", "1900") #pragma detect_mismatch("_ITERATOR_DEBUG_LEVEL", "2") #pragma detect_mismatch("RuntimeLibrary", "MDd_DynamicDebug") #pragma external_header(push) #pragma once #pragma comment(lib, "msvcprt" "d" "") #pragma external_header(pop) namespace std { enum _Uninitialized { _Noinit }; class __declspec(dllimport) _Lockit { public: __thiscall _Lockit() noexcept; explicit __thiscall _Lockit(int) noexcept; __thiscall ~_Lockit() noexcept; static void __cdecl _Lockit_ctor(int) noexcept; static void __cdecl _Lockit_dtor(int) noexcept; private: static void __cdecl _Lockit_ctor(_Lockit*) noexcept; static void __cdecl _Lockit_ctor(_Lockit*, int) noexcept; static void __cdecl _Lockit_dtor(_Lockit*) noexcept; public: _Lockit(const _Lockit&) = delete; _Lockit& operator=(const _Lockit&) = delete; private: int _Locktype; }; class __declspec(dllimport) _Init_locks { public: __thiscall _Init_locks() noexcept; __thiscall ~_Init_locks() noexcept; private: static void __cdecl _Init_locks_ctor(_Init_locks*) noexcept; static void __cdecl _Init_locks_dtor(_Init_locks*) noexcept; }; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { int __cdecl uncaught_exceptions() noexcept; } #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { typedef struct _heapinfo { int* _pentry; size_t _size; int _useflag; } _HEAPINFO; void* __cdecl _alloca( size_t _Size); __declspec(dllimport) intptr_t __cdecl _get_heap_handle(void); __declspec(dllimport) int __cdecl _heapmin(void); __declspec(dllimport) int __cdecl _heapwalk( _HEAPINFO* _EntryInfo); __declspec(dllimport) int __cdecl _heapchk(void); __declspec(dllimport) int __cdecl _resetstkoflw(void); static_assert((sizeof(unsigned int) <= 16), "sizeof(unsigned int) <= _ALLOCA_S_MARKER_SIZE"); #pragma warning(push) #pragma warning(disable: 6540) __inline void* _MarkAllocaS( void* _Ptr, unsigned int _Marker) { if (_Ptr) { *((unsigned int*)_Ptr) = _Marker; _Ptr = (char*)_Ptr + 16; } return _Ptr; } __inline size_t _MallocaComputeSize(size_t _Size) { size_t _MarkedSize = _Size + 16; return _MarkedSize > _Size ? _MarkedSize : 0; } #pragma warning(pop) #pragma warning(push) #pragma warning(disable: 6014) __inline void __cdecl _freea( void* _Memory) { unsigned int _Marker; if (_Memory) { _Memory = (char*)_Memory - 16; _Marker = *(unsigned int*)_Memory; if (_Marker == 0xDDDD) { free(_Memory); } else if (_Marker != 0xCCCC) { (void)( (!!((("Corrupted pointer passed to _freea" && 0)))) || (1 != _CrtDbgReportW(2, L"C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.19041.0\\ucrt\\malloc.h", 164, 0, L"%ls", L"(\"Corrupted pointer passed to _freea\" && 0)")) || (__debugbreak(), 0) ); } } } #pragma warning(pop) } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { typedef void (__cdecl* terminate_handler )(void); typedef void (__cdecl* terminate_function)(void); __declspec(dllimport) __declspec(noreturn) void __cdecl abort(); __declspec(dllimport) __declspec(noreturn) void __cdecl terminate() throw(); __declspec(dllimport) terminate_handler __cdecl set_terminate( terminate_handler _NewTerminateHandler ) throw(); __declspec(dllimport) terminate_handler __cdecl _get_terminate(); } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma warning(push) #pragma warning(disable: 4514 4820 ) __pragma(pack(push, 8)) extern "C" { typedef void (__cdecl* unexpected_handler )(void); typedef void (__cdecl* unexpected_function)(void); struct _EXCEPTION_POINTERS; __declspec(noreturn) void __cdecl unexpected() noexcept(false); unexpected_handler __cdecl set_unexpected( unexpected_handler _NewUnexpectedHandler ) noexcept; unexpected_handler __cdecl _get_unexpected() noexcept; typedef void (__cdecl* _se_translator_function)(unsigned int, struct _EXCEPTION_POINTERS*); _se_translator_function __cdecl _set_se_translator( _se_translator_function _NewSETranslator ); class type_info; int __cdecl _is_exception_typeof( type_info const& _Type, _EXCEPTION_POINTERS* _ExceptionPtr ); bool __cdecl __uncaught_exception(); int __cdecl __uncaught_exceptions(); } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma warning(push) #pragma warning(disable: 4514 4820 ) #pragma pack(push, 8) __pragma(pack(push, 8)) extern "C" { struct __std_exception_data { char const* _What; bool _DoFree; }; void __cdecl __std_exception_copy( __std_exception_data const* _From, __std_exception_data* _To ); void __cdecl __std_exception_destroy( __std_exception_data* _Data ); } __pragma(pack(pop)) namespace std { #pragma warning(push) #pragma warning(disable: 4577) class exception { public: exception() noexcept : _Data() { } explicit exception(char const* const _Message) noexcept : _Data() { __std_exception_data _InitData = { _Message, true }; __std_exception_copy(&_InitData, &_Data); } exception(char const* const _Message, int) noexcept : _Data() { _Data._What = _Message; } exception(exception const& _Other) noexcept : _Data() { __std_exception_copy(&_Other._Data, &_Data); } exception& operator=(exception const& _Other) noexcept { if (this == &_Other) { return *this; } __std_exception_destroy(&_Data); __std_exception_copy(&_Other._Data, &_Data); return *this; } virtual ~exception() noexcept { __std_exception_destroy(&_Data); } [[nodiscard]] virtual char const* what() const { return _Data._What ? _Data._What : "Unknown exception"; } private: __std_exception_data _Data; }; class bad_exception : public exception { public: bad_exception() noexcept : exception("bad exception", 1) { } }; class bad_alloc : public exception { public: bad_alloc() noexcept : exception("bad allocation", 1) { } private: friend class bad_array_new_length; bad_alloc(char const* const _Message) noexcept : exception(_Message, 1) { } }; class bad_array_new_length : public bad_alloc { public: bad_array_new_length() noexcept : bad_alloc("bad array new length") { } }; #pragma warning(pop) } #pragma pack(pop) #pragma warning(pop) #pragma external_header(pop) namespace std { using ::terminate; using ::set_terminate; using ::terminate_handler; [[nodiscard]] inline terminate_handler __cdecl get_terminate() noexcept { return _get_terminate(); } } void __cdecl __ExceptionPtrCreate( void*) noexcept; void __cdecl __ExceptionPtrDestroy( void*) noexcept; void __cdecl __ExceptionPtrCopy( void*, const void*) noexcept; void __cdecl __ExceptionPtrAssign( void*, const void*) noexcept; bool __cdecl __ExceptionPtrCompare( const void*, const void*) noexcept; bool __cdecl __ExceptionPtrToBool( const void*) noexcept; void __cdecl __ExceptionPtrSwap( void*, void*) noexcept; void __cdecl __ExceptionPtrCurrentException(void*) noexcept; [[noreturn]] void __cdecl __ExceptionPtrRethrow( const void*); void __cdecl __ExceptionPtrCopyException( void*, const void*, const void*) noexcept; namespace std { class exception_ptr { public: exception_ptr() noexcept { __ExceptionPtrCreate(this); } exception_ptr(nullptr_t) noexcept { __ExceptionPtrCreate(this); } ~exception_ptr() noexcept { __ExceptionPtrDestroy(this); } exception_ptr(const exception_ptr& _Rhs) noexcept { __ExceptionPtrCopy(this, &_Rhs); } exception_ptr& operator=(const exception_ptr& _Rhs) noexcept { __ExceptionPtrAssign(this, &_Rhs); return *this; } exception_ptr& operator=(nullptr_t) noexcept { exception_ptr _Ptr; __ExceptionPtrAssign(this, &_Ptr); return *this; } explicit operator bool() const noexcept { return __ExceptionPtrToBool(this); } static exception_ptr _Current_exception() noexcept { exception_ptr _Retval; __ExceptionPtrCurrentException(&_Retval); return _Retval; } static exception_ptr _Copy_exception( void* _Except, const void* _Ptr) { exception_ptr _Retval; if (!_Ptr) { return _Retval; } __ExceptionPtrCopyException(&_Retval, _Except, _Ptr); return _Retval; } friend void swap(exception_ptr& _Lhs, exception_ptr& _Rhs) noexcept { __ExceptionPtrSwap(&_Lhs, &_Rhs); } [[nodiscard]] friend bool operator==(const exception_ptr& _Lhs, const exception_ptr& _Rhs) noexcept { return __ExceptionPtrCompare(&_Lhs, &_Rhs); } [[nodiscard]] friend bool operator==(nullptr_t, const exception_ptr& _Rhs) noexcept { return !_Rhs; } [[nodiscard]] friend bool operator==(const exception_ptr& _Lhs, nullptr_t) noexcept { return !_Lhs; } [[nodiscard]] friend bool operator!=(const exception_ptr& _Lhs, const exception_ptr& _Rhs) noexcept { return !(_Lhs == _Rhs); } [[nodiscard]] friend bool operator!=(nullptr_t _Lhs, const exception_ptr& _Rhs) noexcept { return !(_Lhs == _Rhs); } [[nodiscard]] friend bool operator!=(const exception_ptr& _Lhs, nullptr_t _Rhs) noexcept { return !(_Lhs == _Rhs); } private: void* _Data1; void* _Data2; }; [[nodiscard]] inline exception_ptr current_exception() noexcept { return exception_ptr::_Current_exception(); } [[noreturn]] inline void rethrow_exception( exception_ptr _Ptr) { __ExceptionPtrRethrow(&_Ptr); } template <class _Ex> void* __GetExceptionInfo(_Ex); template <class _Ex> [[nodiscard]] exception_ptr make_exception_ptr(_Ex _Except) noexcept { return exception_ptr::_Copy_exception(::std:: addressof(_Except), __GetExceptionInfo(_Except)); } [[noreturn]] inline void _Throw_bad_array_new_length() { throw bad_array_new_length{}; } class nested_exception { public: nested_exception() noexcept : _Exc(::std:: current_exception()) {} nested_exception(const nested_exception&) noexcept = default; nested_exception& operator=(const nested_exception&) noexcept = default; virtual ~nested_exception() noexcept {} [[noreturn]] void rethrow_nested() const { if (_Exc) { ::std:: rethrow_exception(_Exc); } else { ::std:: terminate(); } } [[nodiscard]] exception_ptr nested_ptr() const noexcept { return _Exc; } private: exception_ptr _Exc; }; template <class _Ty, class _Uty> struct _With_nested : _Uty, nested_exception { explicit _With_nested(_Ty&& _Arg) : _Uty(::std:: forward<_Ty>(_Arg)), nested_exception() {} }; template <class _Ty> [[noreturn]] void throw_with_nested(_Ty&& _Arg) { using _Uty = decay_t<_Ty>; if constexpr (is_class_v<_Uty> && !is_base_of_v<nested_exception, _Uty> && !is_final_v<_Uty>) { using _Glued = _With_nested<_Ty, _Uty>; throw _Glued(::std:: forward<_Ty>(_Arg)); } else { throw ::std:: forward<_Ty>(_Arg); } } template <class _Ty> void _Rethrow_if_nested(const _Ty* _Ptr, true_type) { const auto _Nested = dynamic_cast<const nested_exception*>(_Ptr); if (_Nested) { _Nested->rethrow_nested(); } } template <class _Ty> void _Rethrow_if_nested(const _Ty*, false_type) {} template <class _Ty> void rethrow_if_nested(const _Ty& _Arg) { bool_constant< is_polymorphic_v<_Ty> && (!is_base_of_v<nested_exception, _Ty> || is_convertible_v<_Ty*, nested_exception*>)> _Tag; _Rethrow_if_nested(::std:: addressof(_Arg), _Tag); } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4514 4820 ) extern "C" { unsigned char _BitScanForward(unsigned long * _Index, unsigned long _Mask); unsigned char _BitScanForward64(unsigned long * _Index, unsigned __int64 _Mask); unsigned char _BitScanReverse(unsigned long * _Index, unsigned long _Mask); unsigned char _BitScanReverse64(unsigned long * _Index, unsigned __int64 _Mask); unsigned char _bittest(long const *, long); long _InterlockedAnd(long volatile * _Value, long _Mask); short _InterlockedAnd16(short volatile * _Value, short _Mask); __int64 _InterlockedAnd64(__int64 volatile * _Value, __int64 _Mask); __int64 _interlockedand64(__int64 volatile * _Value, __int64 _Mask); char _InterlockedAnd8(char volatile * _Value, char _Mask); long _InterlockedCompareExchange(long volatile * _Destination, long _Exchange, long _Comparand); short _InterlockedCompareExchange16(short volatile * _Destination, short _Exchange, short _Comparand); __int64 _InterlockedCompareExchange64(__int64 volatile * _Destination, __int64 _Exchange, __int64 _Comparand); char _InterlockedCompareExchange8(char volatile * _Destination, char _Exchange, char _Comparand); unsigned char _InterlockedCompareExchange128(__int64 volatile * _Destination, __int64 _ExchangeHigh, __int64 _ExchangeLow, __int64 * _ComparandResult); long _InterlockedDecrement(long volatile * _Addend); short _InterlockedDecrement16(short volatile * _Addend); __int64 _InterlockedDecrement64(__int64 volatile * _Addend); __int64 _interlockeddecrement64(__int64 volatile * _Addend); long _InterlockedExchange(long volatile * _Target, long _Value); short _InterlockedExchange16(short volatile * _Target, short _Value); __int64 _InterlockedExchange64(__int64 volatile * _Target, __int64 _Value); __int64 _interlockedexchange64(__int64 volatile * _Target, __int64 _Value); char _InterlockedExchange8(char volatile * _Target, char _Value); long _InterlockedExchangeAdd(long volatile * _Addend, long _Value); short _InterlockedExchangeAdd16(short volatile * _Addend, short _Value); __int64 _InterlockedExchangeAdd64(__int64 volatile * _Addend, __int64 _Value); __int64 _interlockedexchangeadd64(__int64 volatile * _Addend, __int64 _Value); char _InterlockedExchangeAdd8(char volatile * _Addend, char _Value); long _InterlockedIncrement(long volatile * _Addend); short _InterlockedIncrement16(short volatile * _Addend); __int64 _InterlockedIncrement64(__int64 volatile * _Addend); __int64 _interlockedincrement64(__int64 volatile * _Addend); long _InterlockedOr(long volatile * _Value, long _Mask); short _InterlockedOr16(short volatile * _Value, short _Mask); __int64 _InterlockedOr64(__int64 volatile * _Value, __int64 _Mask); __int64 _interlockedor64(__int64 volatile * _Value, __int64 _Mask); char _InterlockedOr8(char volatile * _Value, char _Mask); long _InterlockedXor(long volatile * _Value, long _Mask); short _InterlockedXor16(short volatile * _Value, short _Mask); __int64 _InterlockedXor64(__int64 volatile * _Value, __int64 _Mask); __int64 _interlockedxor64(__int64 volatile * _Value, __int64 _Mask); char _InterlockedXor8(char volatile * _Value, char _Mask); void _ReadWriteBarrier(void); __int16 __iso_volatile_load16(const volatile __int16 *); __int32 __iso_volatile_load32(const volatile __int32 *); __int64 __iso_volatile_load64(const volatile __int64 *); __int8 __iso_volatile_load8(const volatile __int8 *); void __iso_volatile_store16(volatile __int16 *, __int16); void __iso_volatile_store32(volatile __int32 *, __int32); void __iso_volatile_store64(volatile __int64 *, __int64); void __iso_volatile_store8(volatile __int8 *, __int8); unsigned char _interlockedbittestandset(long volatile *, long); void _mm_pause(void); unsigned int __lzcnt(unsigned int); unsigned short __lzcnt16(unsigned short); unsigned __int64 __lzcnt64(unsigned __int64); unsigned int __popcnt(unsigned int); unsigned short __popcnt16(unsigned short); unsigned __int64 __popcnt64(unsigned __int64); unsigned __int64 __shiftright128(unsigned __int64 _LowPart, unsigned __int64 _HighPart, unsigned char _Shift); unsigned int _tzcnt_u32(unsigned int); unsigned __int64 _tzcnt_u64(unsigned __int64); unsigned __int64 _umul128(unsigned __int64 _Multiplier, unsigned __int64 _Multiplicand, unsigned __int64 * _HighProduct); double __ceil(double); float __ceilf(float); double __floor(double); float __floorf(float); double __round(double); float __roundf(float); double __trunc(double); float __truncf(float); double __copysign(double, double); float __copysignf(float, float); unsigned __signbitvalue(double); unsigned __signbitvaluef(float); int _cvt_ftoi_sat (float a); unsigned _cvt_ftoui_sat (float a); long long _cvt_ftoll_sat (float a); unsigned long long _cvt_ftoull_sat (float a); int _cvt_ftoi_sent (float a); unsigned _cvt_ftoui_sent (float a); long long _cvt_ftoll_sent (float a); unsigned long long _cvt_ftoull_sent (float a); int _cvt_dtoi_sat (double a); unsigned _cvt_dtoui_sat (double a); long long _cvt_dtoll_sat (double a); unsigned long long _cvt_dtoull_sat (double a); int _cvt_dtoi_sent (double a); unsigned _cvt_dtoui_sent (double a); long long _cvt_dtoll_sent (double a); unsigned long long _cvt_dtoull_sent (double a); constexpr void * __cdecl __builtin_assume_aligned(const void *, size_t, ...) noexcept; } #pragma warning(pop) #pragma external_header(pop) #pragma external_header(push) enum ISA_AVAILABILITY { __ISA_AVAILABLE_X86 = 0, __ISA_AVAILABLE_SSE2 = 1, __ISA_AVAILABLE_SSE42 = 2, __ISA_AVAILABLE_AVX = 3, __ISA_AVAILABLE_ENFSTRG = 4, __ISA_AVAILABLE_AVX2 = 5, __ISA_AVAILABLE_AVX512 = 6, __ISA_AVAILABLE_ARMNT = 0, __ISA_AVAILABLE_NEON = 1, __ISA_AVAILABLE_NEON_ARM64 = 2, }; #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { __declspec(dllimport) unsigned int __cdecl _clearfp(void); #pragma warning(push) #pragma warning(disable: 4141) __declspec(deprecated("This function or variable may be unsafe. Consider using " "_controlfp_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) unsigned int __cdecl _controlfp( unsigned int _NewValue, unsigned int _Mask ); #pragma warning(pop) __declspec(dllimport) void __cdecl _set_controlfp( unsigned int _NewValue, unsigned int _Mask ); __declspec(dllimport) errno_t __cdecl _controlfp_s( unsigned int* _CurrentState, unsigned int _NewValue, unsigned int _Mask ); __declspec(dllimport) unsigned int __cdecl _statusfp(void); __declspec(dllimport) void __cdecl _fpreset(void); __declspec(dllimport) unsigned int __cdecl _control87( unsigned int _NewValue, unsigned int _Mask ); __declspec(dllimport) int* __cdecl __fpecode(void); __declspec(dllimport) int __cdecl __fpe_flt_rounds(void); __declspec(dllimport) double __cdecl _copysign( double _Number, double _Sign); __declspec(dllimport) double __cdecl _chgsign( double _X); __declspec(dllimport) double __cdecl _scalb( double _X, long _Y); __declspec(dllimport) double __cdecl _logb( double _X); __declspec(dllimport) double __cdecl _nextafter( double _X, double _Y); __declspec(dllimport) int __cdecl _finite( double _X); __declspec(dllimport) int __cdecl _isnan( double _X); __declspec(dllimport) int __cdecl _fpclass( double _X); __declspec(dllimport) float __cdecl _scalbf( float _X, long _Y); __declspec(dllimport) void __cdecl fpreset(void); } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { #pragma detect_mismatch("_CRT_STDIO_ISO_WIDE_SPECIFIERS", "0") __declspec(noinline) __inline unsigned __int64* __cdecl __local_stdio_printf_options(void) { static unsigned __int64 _OptionsStorage; return &_OptionsStorage; } __declspec(noinline) __inline unsigned __int64* __cdecl __local_stdio_scanf_options(void) { static unsigned __int64 _OptionsStorage; return &_OptionsStorage; } } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { typedef struct _iobuf { void* _Placeholder; } FILE; __declspec(dllimport) FILE* __cdecl __acrt_iob_func(unsigned _Ix); __declspec(dllimport) wint_t __cdecl fgetwc( FILE* _Stream ); __declspec(dllimport) wint_t __cdecl _fgetwchar(void); __declspec(dllimport) wint_t __cdecl fputwc( wchar_t _Character, FILE* _Stream); __declspec(dllimport) wint_t __cdecl _fputwchar( wchar_t _Character ); __declspec(dllimport) wint_t __cdecl getwc( FILE* _Stream ); __declspec(dllimport) wint_t __cdecl getwchar(void); __declspec(dllimport) wchar_t* __cdecl fgetws( wchar_t* _Buffer, int _BufferCount, FILE* _Stream ); __declspec(dllimport) int __cdecl fputws( wchar_t const* _Buffer, FILE* _Stream ); __declspec(dllimport) wchar_t* __cdecl _getws_s( wchar_t* _Buffer, size_t _BufferCount ); extern "C++" { template <size_t _Size> inline wchar_t* __cdecl _getws_s( wchar_t (&_Buffer)[_Size]) throw() { return _getws_s(_Buffer, _Size); } } __declspec(dllimport) wint_t __cdecl putwc( wchar_t _Character, FILE* _Stream ); __declspec(dllimport) wint_t __cdecl putwchar( wchar_t _Character ); __declspec(dllimport) int __cdecl _putws( wchar_t const* _Buffer ); __declspec(dllimport) wint_t __cdecl ungetwc( wint_t _Character, FILE* _Stream ); __declspec(dllimport) FILE * __cdecl _wfdopen( int _FileHandle, wchar_t const* _Mode ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wfopen_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) FILE* __cdecl _wfopen( wchar_t const* _FileName, wchar_t const* _Mode ); __declspec(dllimport) errno_t __cdecl _wfopen_s( FILE** _Stream, wchar_t const* _FileName, wchar_t const* _Mode ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wfreopen_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) FILE* __cdecl _wfreopen( wchar_t const* _FileName, wchar_t const* _Mode, FILE* _OldStream ); __declspec(dllimport) errno_t __cdecl _wfreopen_s( FILE** _Stream, wchar_t const* _FileName, wchar_t const* _Mode, FILE* _OldStream ); __declspec(dllimport) FILE* __cdecl _wfsopen( wchar_t const* _FileName, wchar_t const* _Mode, int _ShFlag ); __declspec(dllimport) void __cdecl _wperror( wchar_t const* _ErrorMessage ); __declspec(dllimport) FILE* __cdecl _wpopen( wchar_t const* _Command, wchar_t const* _Mode ); __declspec(dllimport) int __cdecl _wremove( wchar_t const* _FileName ); __declspec(dllimport) __declspec(allocator) wchar_t* __cdecl _wtempnam( wchar_t const* _Directory, wchar_t const* _FilePrefix ); __declspec(dllimport) errno_t __cdecl _wtmpnam_s( wchar_t* _Buffer, size_t _BufferCount ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _wtmpnam_s( wchar_t (&_Buffer)[_Size]) throw() { return _wtmpnam_s(_Buffer, _Size); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wtmpnam_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl _wtmpnam( wchar_t *_Buffer); __declspec(dllimport) wint_t __cdecl _fgetwc_nolock( FILE* _Stream ); __declspec(dllimport) wint_t __cdecl _fputwc_nolock( wchar_t _Character, FILE* _Stream ); __declspec(dllimport) wint_t __cdecl _getwc_nolock( FILE* _Stream ); __declspec(dllimport) wint_t __cdecl _putwc_nolock( wchar_t _Character, FILE* _Stream ); __declspec(dllimport) wint_t __cdecl _ungetwc_nolock( wint_t _Character, FILE* _Stream ); __declspec(dllimport) int __cdecl __stdio_common_vfwprintf( unsigned __int64 _Options, FILE* _Stream, wchar_t const* _Format, _locale_t _Locale, va_list _ArgList ); __declspec(dllimport) int __cdecl __stdio_common_vfwprintf_s( unsigned __int64 _Options, FILE* _Stream, wchar_t const* _Format, _locale_t _Locale, va_list _ArgList ); __declspec(dllimport) int __cdecl __stdio_common_vfwprintf_p( unsigned __int64 _Options, FILE* _Stream, wchar_t const* _Format, _locale_t _Locale, va_list _ArgList ); __inline int __cdecl _vfwprintf_l( FILE* const _Stream, wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return __stdio_common_vfwprintf((*__local_stdio_printf_options()), _Stream, _Format, _Locale, _ArgList); } __inline int __cdecl vfwprintf( FILE* const _Stream, wchar_t const* const _Format, va_list _ArgList ) { return _vfwprintf_l(_Stream, _Format, 0, _ArgList); } __inline int __cdecl _vfwprintf_s_l( FILE* const _Stream, wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return __stdio_common_vfwprintf_s((*__local_stdio_printf_options()), _Stream, _Format, _Locale, _ArgList); } __inline int __cdecl vfwprintf_s( FILE* const _Stream, wchar_t const* const _Format, va_list _ArgList ) { return _vfwprintf_s_l(_Stream, _Format, 0, _ArgList); } __inline int __cdecl _vfwprintf_p_l( FILE* const _Stream, wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return __stdio_common_vfwprintf_p((*__local_stdio_printf_options()), _Stream, _Format, _Locale, _ArgList); } __inline int __cdecl _vfwprintf_p( FILE* const _Stream, wchar_t const* const _Format, va_list _ArgList ) { return _vfwprintf_p_l(_Stream, _Format, 0, _ArgList); } __inline int __cdecl _vwprintf_l( wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return _vfwprintf_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList); } __inline int __cdecl vwprintf( wchar_t const* const _Format, va_list _ArgList ) { return _vfwprintf_l((__acrt_iob_func(1)), _Format, 0, _ArgList); } __inline int __cdecl _vwprintf_s_l( wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return _vfwprintf_s_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList); } __inline int __cdecl vwprintf_s( wchar_t const* const _Format, va_list _ArgList ) { return _vfwprintf_s_l((__acrt_iob_func(1)), _Format, 0, _ArgList); } __inline int __cdecl _vwprintf_p_l( wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return _vfwprintf_p_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList); } __inline int __cdecl _vwprintf_p( wchar_t const* const _Format, va_list _ArgList ) { return _vfwprintf_p_l((__acrt_iob_func(1)), _Format, 0, _ArgList); } __inline int __cdecl _fwprintf_l( FILE* const _Stream, wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vfwprintf_l(_Stream, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl fwprintf( FILE* const _Stream, wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vfwprintf_l(_Stream, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _fwprintf_s_l( FILE* const _Stream, wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vfwprintf_s_l(_Stream, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl fwprintf_s( FILE* const _Stream, wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vfwprintf_s_l(_Stream, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _fwprintf_p_l( FILE* const _Stream, wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vfwprintf_p_l(_Stream, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _fwprintf_p( FILE* const _Stream, wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vfwprintf_p_l(_Stream, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _wprintf_l( wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vfwprintf_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl wprintf( wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vfwprintf_l((__acrt_iob_func(1)), _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _wprintf_s_l( wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vfwprintf_s_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl wprintf_s( wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vfwprintf_s_l((__acrt_iob_func(1)), _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _wprintf_p_l( wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vfwprintf_p_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _wprintf_p( wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vfwprintf_p_l((__acrt_iob_func(1)), _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __declspec(dllimport) int __cdecl __stdio_common_vfwscanf( unsigned __int64 _Options, FILE* _Stream, wchar_t const* _Format, _locale_t _Locale, va_list _ArgList ); __inline int __cdecl _vfwscanf_l( FILE* const _Stream, wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return __stdio_common_vfwscanf( (*__local_stdio_scanf_options ()), _Stream, _Format, _Locale, _ArgList); } __inline int __cdecl vfwscanf( FILE* const _Stream, wchar_t const* const _Format, va_list _ArgList ) { return _vfwscanf_l(_Stream, _Format, 0, _ArgList); } __inline int __cdecl _vfwscanf_s_l( FILE* const _Stream, wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return __stdio_common_vfwscanf( (*__local_stdio_scanf_options ()) | (1ULL << 0), _Stream, _Format, _Locale, _ArgList); } __inline int __cdecl vfwscanf_s( FILE* const _Stream, wchar_t const* const _Format, va_list _ArgList ) { return _vfwscanf_s_l(_Stream, _Format, 0, _ArgList); } __inline int __cdecl _vwscanf_l( wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return _vfwscanf_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList); } __inline int __cdecl vwscanf( wchar_t const* const _Format, va_list _ArgList ) { return _vfwscanf_l((__acrt_iob_func(0)), _Format, 0, _ArgList); } __inline int __cdecl _vwscanf_s_l( wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return _vfwscanf_s_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList); } __inline int __cdecl vwscanf_s( wchar_t const* const _Format, va_list _ArgList ) { return _vfwscanf_s_l((__acrt_iob_func(0)), _Format, 0, _ArgList); } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_fwscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _fwscanf_l( FILE* const _Stream, wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vfwscanf_l(_Stream, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __declspec(deprecated("This function or variable may be unsafe. Consider using " "fwscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl fwscanf( FILE* const _Stream, wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vfwscanf_l(_Stream, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _fwscanf_s_l( FILE* const _Stream, wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vfwscanf_s_l(_Stream, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl fwscanf_s( FILE* const _Stream, wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vfwscanf_s_l(_Stream, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _wscanf_l( wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vfwscanf_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __declspec(deprecated("This function or variable may be unsafe. Consider using " "wscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl wscanf( wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vfwscanf_l((__acrt_iob_func(0)), _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _wscanf_s_l( wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vfwscanf_s_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl wscanf_s( wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vfwscanf_s_l((__acrt_iob_func(0)), _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __declspec(dllimport) int __cdecl __stdio_common_vswprintf( unsigned __int64 _Options, wchar_t* _Buffer, size_t _BufferCount, wchar_t const* _Format, _locale_t _Locale, va_list _ArgList ); __declspec(dllimport) int __cdecl __stdio_common_vswprintf_s( unsigned __int64 _Options, wchar_t* _Buffer, size_t _BufferCount, wchar_t const* _Format, _locale_t _Locale, va_list _ArgList ); __declspec(dllimport) int __cdecl __stdio_common_vsnwprintf_s( unsigned __int64 _Options, wchar_t* _Buffer, size_t _BufferCount, size_t _MaxCount, wchar_t const* _Format, _locale_t _Locale, va_list _ArgList ); __declspec(dllimport) int __cdecl __stdio_common_vswprintf_p( unsigned __int64 _Options, wchar_t* _Buffer, size_t _BufferCount, wchar_t const* _Format, _locale_t _Locale, va_list _ArgList ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnwprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsnwprintf_l( wchar_t* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { int const _Result = __stdio_common_vswprintf( (*__local_stdio_printf_options()) | (1ULL << 0), _Buffer, _BufferCount, _Format, _Locale, _ArgList); return _Result < 0 ? -1 : _Result; } __inline int __cdecl _vsnwprintf_s_l( wchar_t* const _Buffer, size_t const _BufferCount, size_t const _MaxCount, wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { int const _Result = __stdio_common_vsnwprintf_s( (*__local_stdio_printf_options()), _Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList); return _Result < 0 ? -1 : _Result; } __inline int __cdecl _vsnwprintf_s( wchar_t* const _Buffer, size_t const _BufferCount, size_t const _MaxCount, wchar_t const* const _Format, va_list _ArgList ) { return _vsnwprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format, 0, _ArgList); } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snwprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snwprintf( wchar_t *_Buffer, size_t _BufferCount, wchar_t const* _Format, ...); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnwprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsnwprintf( wchar_t *_Buffer, size_t _BufferCount, wchar_t const* _Format, va_list _Args); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnwprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsnwprintf( wchar_t* _Buffer, size_t _BufferCount, wchar_t const* _Format, va_list _ArgList ) { return _vsnwprintf_l(_Buffer, _BufferCount, _Format, 0, _ArgList); } extern "C++" { template <size_t _Size> inline int __cdecl _vsnwprintf_s( wchar_t (&_Buffer)[_Size], size_t _BufferCount, wchar_t const* _Format, va_list _ArgList) throw() { return _vsnwprintf_s(_Buffer, _Size, _BufferCount, _Format, _ArgList); } } __inline int __cdecl _vswprintf_c_l( wchar_t* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { int const _Result = __stdio_common_vswprintf( (*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList); return _Result < 0 ? -1 : _Result; } __inline int __cdecl _vswprintf_c( wchar_t* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, va_list _ArgList ) { return _vswprintf_c_l(_Buffer, _BufferCount, _Format, 0, _ArgList); } __inline int __cdecl _vswprintf_l( wchar_t* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return _vswprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList); } __inline int __cdecl __vswprintf_l( wchar_t* const _Buffer, wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return _vswprintf_l(_Buffer, (size_t)-1, _Format, _Locale, _ArgList); } __inline int __cdecl _vswprintf( wchar_t* const _Buffer, wchar_t const* const _Format, va_list _ArgList ) { return _vswprintf_l(_Buffer, (size_t)-1, _Format, 0, _ArgList); } __inline int __cdecl vswprintf( wchar_t* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, va_list _ArgList ) { return _vswprintf_c_l(_Buffer, _BufferCount, _Format, 0, _ArgList); } __inline int __cdecl _vswprintf_s_l( wchar_t* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { int const _Result = __stdio_common_vswprintf_s( (*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList); return _Result < 0 ? -1 : _Result; } __inline int __cdecl vswprintf_s( wchar_t* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, va_list _ArgList ) { return _vswprintf_s_l(_Buffer, _BufferCount, _Format, 0, _ArgList); } extern "C++" { template <size_t _Size> inline int __cdecl vswprintf_s( wchar_t (&_Buffer)[_Size], wchar_t const* _Format, va_list _ArgList) throw() { return vswprintf_s(_Buffer, _Size, _Format, _ArgList); } } __inline int __cdecl _vswprintf_p_l( wchar_t* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { int const _Result = __stdio_common_vswprintf_p( (*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList); return _Result < 0 ? -1 : _Result; } __inline int __cdecl _vswprintf_p( wchar_t* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, va_list _ArgList ) { return _vswprintf_p_l(_Buffer, _BufferCount, _Format, 0, _ArgList); } __inline int __cdecl _vscwprintf_l( wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { int const _Result = __stdio_common_vswprintf( (*__local_stdio_printf_options()) | (1ULL << 1), 0, 0, _Format, _Locale, _ArgList); return _Result < 0 ? -1 : _Result; } __inline int __cdecl _vscwprintf( wchar_t const* const _Format, va_list _ArgList ) { return _vscwprintf_l(_Format, 0, _ArgList); } __inline int __cdecl _vscwprintf_p_l( wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { int const _Result = __stdio_common_vswprintf_p( (*__local_stdio_printf_options()) | (1ULL << 1), 0, 0, _Format, _Locale, _ArgList); return _Result < 0 ? -1 : _Result; } __inline int __cdecl _vscwprintf_p( wchar_t const* const _Format, va_list _ArgList ) { return _vscwprintf_p_l(_Format, 0, _ArgList); } __inline int __cdecl __swprintf_l( wchar_t* const _Buffer, wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = __vswprintf_l(_Buffer, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _swprintf_l( wchar_t* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vswprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _swprintf( wchar_t* const _Buffer, wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = __vswprintf_l(_Buffer, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl swprintf( wchar_t* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vswprintf_c_l(_Buffer, _BufferCount, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __declspec(deprecated("This function or variable may be unsafe. Consider using " "__swprintf_l_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl __swprintf_l( wchar_t *_Buffer, wchar_t const* _Format, _locale_t _Locale, ...); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_vswprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl __vswprintf_l( wchar_t *_Buffer, wchar_t const* _Format, _locale_t _Locale, va_list _Args); __declspec(deprecated("This function or variable may be unsafe. Consider using " "swprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _swprintf( wchar_t *_Buffer, wchar_t const* _Format, ...); __declspec(deprecated("This function or variable may be unsafe. Consider using " "vswprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vswprintf( wchar_t *_Buffer, wchar_t const* _Format, va_list _Args); __inline int __cdecl _swprintf_s_l( wchar_t* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vswprintf_s_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl swprintf_s( wchar_t* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vswprintf_s_l(_Buffer, _BufferCount, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } extern "C++" { template <size_t _Size> inline int __cdecl swprintf_s( wchar_t (&_Buffer)[_Size], wchar_t const* _Format, ...) throw() { va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); return vswprintf_s(_Buffer, _Size, _Format, _ArgList); } } __inline int __cdecl _swprintf_p_l( wchar_t* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vswprintf_p_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _swprintf_p( wchar_t* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vswprintf_p_l(_Buffer, _BufferCount, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _swprintf_c_l( wchar_t* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vswprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _swprintf_c( wchar_t* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vswprintf_c_l(_Buffer, _BufferCount, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snwprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snwprintf_l( wchar_t* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vsnwprintf_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _snwprintf( wchar_t* _Buffer, size_t _BufferCount, wchar_t const* _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vsnwprintf_l(_Buffer, _BufferCount, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _snwprintf_s_l( wchar_t* const _Buffer, size_t const _BufferCount, size_t const _MaxCount, wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vsnwprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _snwprintf_s( wchar_t* const _Buffer, size_t const _BufferCount, size_t const _MaxCount, wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vsnwprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } extern "C++" { template <size_t _Size> inline int __cdecl _snwprintf_s( wchar_t (&_Buffer)[_Size], size_t _BufferCount, wchar_t const* _Format, ...) throw() { va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); return _vsnwprintf_s(_Buffer, _Size, _BufferCount, _Format, _ArgList); } } __inline int __cdecl _scwprintf_l( wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vscwprintf_l(_Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _scwprintf( wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vscwprintf_l(_Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _scwprintf_p_l( wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vscwprintf_p_l(_Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _scwprintf_p( wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vscwprintf_p_l(_Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } #pragma warning(push) #pragma warning(disable: 4141 6054) extern "C++" __declspec(deprecated("function has been changed to conform with the ISO C standard, " "adding an extra character count parameter. To use the traditional " "Microsoft version, set _CRT_NON_CONFORMING_SWPRINTFS.")) __declspec(deprecated("This function or variable may be unsafe. Consider using " "swprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) inline int swprintf( wchar_t* const _Buffer, wchar_t const* const _Format, ...) throw() { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = vswprintf(_Buffer, 2147483647, _Format, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } extern "C++" __declspec(deprecated("function has been changed to conform with the ISO C standard, " "adding an extra character count parameter. To use the traditional " "Microsoft version, set _CRT_NON_CONFORMING_SWPRINTFS.")) __declspec(deprecated("This function or variable may be unsafe. Consider using " "vswprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) inline int __cdecl vswprintf( wchar_t* const _Buffer, wchar_t const* const _Format, va_list _ArgList ) throw() { return vswprintf(_Buffer, 2147483647, _Format, _ArgList); } extern "C++" __declspec(deprecated("function has been changed to conform with the ISO C standard, " "adding an extra character count parameter. To use the traditional " "Microsoft version, set _CRT_NON_CONFORMING_SWPRINTFS.")) __declspec(deprecated("This function or variable may be unsafe. Consider using " "_swprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) inline int _swprintf_l( wchar_t* const _Buffer, wchar_t const* const _Format, _locale_t const _Locale, ...) throw() { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vswprintf_l(_Buffer, (size_t)-1, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } extern "C++" __declspec(deprecated("function has been changed to conform with the ISO C standard, " "adding an extra character count parameter. To use the traditional " "Microsoft version, set _CRT_NON_CONFORMING_SWPRINTFS.")) __declspec(deprecated("This function or variable may be unsafe. Consider using " "_vswprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) inline int __cdecl _vswprintf_l( wchar_t* const _Buffer, wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) throw() { return _vswprintf_l(_Buffer, (size_t)-1, _Format, _Locale, _ArgList); } #pragma warning(pop) __declspec(dllimport) int __cdecl __stdio_common_vswscanf( unsigned __int64 _Options, wchar_t const* _Buffer, size_t _BufferCount, wchar_t const* _Format, _locale_t _Locale, va_list _ArgList ); __inline int __cdecl _vswscanf_l( wchar_t const* const _Buffer, wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return __stdio_common_vswscanf( (*__local_stdio_scanf_options ()), _Buffer, (size_t)-1, _Format, _Locale, _ArgList); } __inline int __cdecl vswscanf( wchar_t const* _Buffer, wchar_t const* _Format, va_list _ArgList ) { return _vswscanf_l(_Buffer, _Format, 0, _ArgList); } __inline int __cdecl _vswscanf_s_l( wchar_t const* const _Buffer, wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return __stdio_common_vswscanf( (*__local_stdio_scanf_options ()) | (1ULL << 0), _Buffer, (size_t)-1, _Format, _Locale, _ArgList); } __inline int __cdecl vswscanf_s( wchar_t const* const _Buffer, wchar_t const* const _Format, va_list _ArgList ) { return _vswscanf_s_l(_Buffer, _Format, 0, _ArgList); } extern "C++" { template <size_t _Size> inline int __cdecl vswscanf_s( wchar_t (&_Buffer)[_Size], wchar_t const* _Format, va_list _ArgList) throw() { return vswscanf_s(_Buffer, _Size, _Format, _ArgList); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnwscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsnwscanf_l( wchar_t const* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return __stdio_common_vswscanf( (*__local_stdio_scanf_options ()), _Buffer, _BufferCount, _Format, _Locale, _ArgList); } __inline int __cdecl _vsnwscanf_s_l( wchar_t const* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return __stdio_common_vswscanf( (*__local_stdio_scanf_options ()) | (1ULL << 0), _Buffer, _BufferCount, _Format, _Locale, _ArgList); } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_swscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _swscanf_l( wchar_t const* const _Buffer, wchar_t const* const _Format, _locale_t _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vswscanf_l(_Buffer, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __declspec(deprecated("This function or variable may be unsafe. Consider using " "swscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl swscanf( wchar_t const* const _Buffer, wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vswscanf_l(_Buffer, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _swscanf_s_l( wchar_t const* const _Buffer, wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vswscanf_s_l(_Buffer, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl swscanf_s( wchar_t const* const _Buffer, wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vswscanf_s_l(_Buffer, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snwscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snwscanf_l( wchar_t const* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vsnwscanf_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snwscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snwscanf( wchar_t const* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vsnwscanf_l(_Buffer, _BufferCount, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _snwscanf_s_l( wchar_t const* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vsnwscanf_s_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _snwscanf_s( wchar_t const* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vsnwscanf_s_l(_Buffer, _BufferCount, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { typedef __int64 fpos_t; __declspec(dllimport) errno_t __cdecl _get_stream_buffer_pointers( FILE* _Stream, char*** _Base, char*** _Pointer, int** _Count ); __declspec(dllimport) errno_t __cdecl clearerr_s( FILE* _Stream ); __declspec(dllimport) errno_t __cdecl fopen_s( FILE** _Stream, char const* _FileName, char const* _Mode ); __declspec(dllimport) size_t __cdecl fread_s( void* _Buffer, size_t _BufferSize, size_t _ElementSize, size_t _ElementCount, FILE* _Stream ); __declspec(dllimport) errno_t __cdecl freopen_s( FILE** _Stream, char const* _FileName, char const* _Mode, FILE* _OldStream ); __declspec(dllimport) char* __cdecl gets_s( char* _Buffer, rsize_t _Size ); __declspec(dllimport) errno_t __cdecl tmpfile_s( FILE** _Stream ); __declspec(dllimport) errno_t __cdecl tmpnam_s( char* _Buffer, rsize_t _Size ); __declspec(dllimport) void __cdecl clearerr( FILE* _Stream ); __declspec(dllimport) int __cdecl fclose( FILE* _Stream ); __declspec(dllimport) int __cdecl _fcloseall(void); __declspec(dllimport) FILE* __cdecl _fdopen( int _FileHandle, char const* _Mode ); __declspec(dllimport) int __cdecl feof( FILE* _Stream ); __declspec(dllimport) int __cdecl ferror( FILE* _Stream ); __declspec(dllimport) int __cdecl fflush( FILE* _Stream ); __declspec(dllimport) int __cdecl fgetc( FILE* _Stream ); __declspec(dllimport) int __cdecl _fgetchar(void); __declspec(dllimport) int __cdecl fgetpos( FILE* _Stream, fpos_t* _Position ); __declspec(dllimport) char* __cdecl fgets( char* _Buffer, int _MaxCount, FILE* _Stream ); __declspec(dllimport) int __cdecl _fileno( FILE* _Stream ); __declspec(dllimport) int __cdecl _flushall(void); __declspec(deprecated("This function or variable may be unsafe. Consider using " "fopen_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) FILE* __cdecl fopen( char const* _FileName, char const* _Mode ); __declspec(dllimport) int __cdecl fputc( int _Character, FILE* _Stream ); __declspec(dllimport) int __cdecl _fputchar( int _Character ); __declspec(dllimport) int __cdecl fputs( char const* _Buffer, FILE* _Stream ); __declspec(dllimport) size_t __cdecl fread( void* _Buffer, size_t _ElementSize, size_t _ElementCount, FILE* _Stream ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "freopen_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) FILE* __cdecl freopen( char const* _FileName, char const* _Mode, FILE* _Stream ); __declspec(dllimport) FILE* __cdecl _fsopen( char const* _FileName, char const* _Mode, int _ShFlag ); __declspec(dllimport) int __cdecl fsetpos( FILE* _Stream, fpos_t const* _Position ); __declspec(dllimport) int __cdecl fseek( FILE* _Stream, long _Offset, int _Origin ); __declspec(dllimport) int __cdecl _fseeki64( FILE* _Stream, __int64 _Offset, int _Origin ); __declspec(dllimport) long __cdecl ftell( FILE* _Stream ); __declspec(dllimport) __int64 __cdecl _ftelli64( FILE* _Stream ); __declspec(dllimport) size_t __cdecl fwrite( void const* _Buffer, size_t _ElementSize, size_t _ElementCount, FILE* _Stream ); __declspec(dllimport) int __cdecl getc( FILE* _Stream ); __declspec(dllimport) int __cdecl getchar(void); __declspec(dllimport) int __cdecl _getmaxstdio(void); extern "C++" { template <size_t _Size> inline char* __cdecl gets_s(char (&_Buffer)[_Size]) throw() { return gets_s(_Buffer, _Size); } } __declspec(dllimport) int __cdecl _getw( FILE* _Stream ); __declspec(dllimport) void __cdecl perror( char const* _ErrorMessage ); __declspec(dllimport) int __cdecl _pclose( FILE* _Stream ); __declspec(dllimport) FILE* __cdecl _popen( char const* _Command, char const* _Mode ); __declspec(dllimport) int __cdecl putc( int _Character, FILE* _Stream ); __declspec(dllimport) int __cdecl putchar( int _Character ); __declspec(dllimport) int __cdecl puts( char const* _Buffer ); __declspec(dllimport) int __cdecl _putw( int _Word, FILE* _Stream ); __declspec(dllimport) int __cdecl remove( char const* _FileName ); __declspec(dllimport) int __cdecl rename( char const* _OldFileName, char const* _NewFileName ); __declspec(dllimport) int __cdecl _unlink( char const* _FileName ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_unlink" ". See online help for details.")) __declspec(dllimport) int __cdecl unlink( char const* _FileName ); __declspec(dllimport) void __cdecl rewind( FILE* _Stream ); __declspec(dllimport) int __cdecl _rmtmp(void); __declspec(deprecated("This function or variable may be unsafe. Consider using " "setvbuf" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) void __cdecl setbuf( FILE* _Stream, char* _Buffer ); __declspec(dllimport) int __cdecl _setmaxstdio( int _Maximum ); __declspec(dllimport) int __cdecl setvbuf( FILE* _Stream, char* _Buffer, int _Mode, size_t _Size ); __declspec(dllimport) __declspec(allocator) char* __cdecl _tempnam( char const* _DirectoryName, char const* _FilePrefix ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "tmpfile_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) FILE* __cdecl tmpfile(void); extern "C++" { template <size_t _Size> inline errno_t __cdecl tmpnam_s( char (&_Buffer)[_Size]) throw() { return tmpnam_s(_Buffer, _Size); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "tmpnam_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl tmpnam( char *_Buffer); __declspec(dllimport) int __cdecl ungetc( int _Character, FILE* _Stream ); __declspec(dllimport) void __cdecl _lock_file( FILE* _Stream ); __declspec(dllimport) void __cdecl _unlock_file( FILE* _Stream ); __declspec(dllimport) int __cdecl _fclose_nolock( FILE* _Stream ); __declspec(dllimport) int __cdecl _fflush_nolock( FILE* _Stream ); __declspec(dllimport) int __cdecl _fgetc_nolock( FILE* _Stream ); __declspec(dllimport) int __cdecl _fputc_nolock( int _Character, FILE* _Stream ); __declspec(dllimport) size_t __cdecl _fread_nolock( void* _Buffer, size_t _ElementSize, size_t _ElementCount, FILE* _Stream ); __declspec(dllimport) size_t __cdecl _fread_nolock_s( void* _Buffer, size_t _BufferSize, size_t _ElementSize, size_t _ElementCount, FILE* _Stream ); __declspec(dllimport) int __cdecl _fseek_nolock( FILE* _Stream, long _Offset, int _Origin ); __declspec(dllimport) int __cdecl _fseeki64_nolock( FILE* _Stream, __int64 _Offset, int _Origin ); __declspec(dllimport) long __cdecl _ftell_nolock( FILE* _Stream ); __declspec(dllimport) __int64 __cdecl _ftelli64_nolock( FILE* _Stream ); __declspec(dllimport) size_t __cdecl _fwrite_nolock( void const* _Buffer, size_t _ElementSize, size_t _ElementCount, FILE* _Stream ); __declspec(dllimport) int __cdecl _getc_nolock( FILE* _Stream ); __declspec(dllimport) int __cdecl _putc_nolock( int _Character, FILE* _Stream ); __declspec(dllimport) int __cdecl _ungetc_nolock( int _Character, FILE* _Stream ); __declspec(dllimport) int* __cdecl __p__commode(void); __declspec(dllimport) int __cdecl __stdio_common_vfprintf( unsigned __int64 _Options, FILE* _Stream, char const* _Format, _locale_t _Locale, va_list _ArgList ); __declspec(dllimport) int __cdecl __stdio_common_vfprintf_s( unsigned __int64 _Options, FILE* _Stream, char const* _Format, _locale_t _Locale, va_list _ArgList ); __declspec(dllimport) int __cdecl __stdio_common_vfprintf_p( unsigned __int64 _Options, FILE* _Stream, char const* _Format, _locale_t _Locale, va_list _ArgList ); __inline int __cdecl _vfprintf_l( FILE* const _Stream, char const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return __stdio_common_vfprintf((*__local_stdio_printf_options()), _Stream, _Format, _Locale, _ArgList); } __inline int __cdecl vfprintf( FILE* const _Stream, char const* const _Format, va_list _ArgList ) { return _vfprintf_l(_Stream, _Format, 0, _ArgList); } __inline int __cdecl _vfprintf_s_l( FILE* const _Stream, char const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return __stdio_common_vfprintf_s((*__local_stdio_printf_options()), _Stream, _Format, _Locale, _ArgList); } __inline int __cdecl vfprintf_s( FILE* const _Stream, char const* const _Format, va_list _ArgList ) { return _vfprintf_s_l(_Stream, _Format, 0, _ArgList); } __inline int __cdecl _vfprintf_p_l( FILE* const _Stream, char const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return __stdio_common_vfprintf_p((*__local_stdio_printf_options()), _Stream, _Format, _Locale, _ArgList); } __inline int __cdecl _vfprintf_p( FILE* const _Stream, char const* const _Format, va_list _ArgList ) { return _vfprintf_p_l(_Stream, _Format, 0, _ArgList); } __inline int __cdecl _vprintf_l( char const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return _vfprintf_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList); } __inline int __cdecl vprintf( char const* const _Format, va_list _ArgList ) { return _vfprintf_l((__acrt_iob_func(1)), _Format, 0, _ArgList); } __inline int __cdecl _vprintf_s_l( char const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return _vfprintf_s_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList); } __inline int __cdecl vprintf_s( char const* const _Format, va_list _ArgList ) { return _vfprintf_s_l((__acrt_iob_func(1)), _Format, 0, _ArgList); } __inline int __cdecl _vprintf_p_l( char const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return _vfprintf_p_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList); } __inline int __cdecl _vprintf_p( char const* const _Format, va_list _ArgList ) { return _vfprintf_p_l((__acrt_iob_func(1)), _Format, 0, _ArgList); } __inline int __cdecl _fprintf_l( FILE* const _Stream, char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vfprintf_l(_Stream, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl fprintf( FILE* const _Stream, char const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vfprintf_l(_Stream, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __declspec(dllimport) int __cdecl _set_printf_count_output( int _Value ); __declspec(dllimport) int __cdecl _get_printf_count_output(void); __inline int __cdecl _fprintf_s_l( FILE* const _Stream, char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vfprintf_s_l(_Stream, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl fprintf_s( FILE* const _Stream, char const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vfprintf_s_l(_Stream, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _fprintf_p_l( FILE* const _Stream, char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vfprintf_p_l(_Stream, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _fprintf_p( FILE* const _Stream, char const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vfprintf_p_l(_Stream, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _printf_l( char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vfprintf_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl printf( char const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vfprintf_l((__acrt_iob_func(1)), _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _printf_s_l( char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vfprintf_s_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl printf_s( char const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vfprintf_s_l((__acrt_iob_func(1)), _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _printf_p_l( char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vfprintf_p_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _printf_p( char const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vfprintf_p_l((__acrt_iob_func(1)), _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __declspec(dllimport) int __cdecl __stdio_common_vfscanf( unsigned __int64 _Options, FILE* _Stream, char const* _Format, _locale_t _Locale, va_list _Arglist ); __inline int __cdecl _vfscanf_l( FILE* const _Stream, char const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return __stdio_common_vfscanf( (*__local_stdio_scanf_options ()), _Stream, _Format, _Locale, _ArgList); } __inline int __cdecl vfscanf( FILE* const _Stream, char const* const _Format, va_list _ArgList ) { return _vfscanf_l(_Stream, _Format, 0, _ArgList); } __inline int __cdecl _vfscanf_s_l( FILE* const _Stream, char const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return __stdio_common_vfscanf( (*__local_stdio_scanf_options ()) | (1ULL << 0), _Stream, _Format, _Locale, _ArgList); } __inline int __cdecl vfscanf_s( FILE* const _Stream, char const* const _Format, va_list _ArgList ) { return _vfscanf_s_l(_Stream, _Format, 0, _ArgList); } __inline int __cdecl _vscanf_l( char const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return _vfscanf_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList); } __inline int __cdecl vscanf( char const* const _Format, va_list _ArgList ) { return _vfscanf_l((__acrt_iob_func(0)), _Format, 0, _ArgList); } __inline int __cdecl _vscanf_s_l( char const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return _vfscanf_s_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList); } __inline int __cdecl vscanf_s( char const* const _Format, va_list _ArgList ) { return _vfscanf_s_l((__acrt_iob_func(0)), _Format, 0, _ArgList); } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_fscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _fscanf_l( FILE* const _Stream, char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vfscanf_l(_Stream, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __declspec(deprecated("This function or variable may be unsafe. Consider using " "fscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl fscanf( FILE* const _Stream, char const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vfscanf_l(_Stream, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _fscanf_s_l( FILE* const _Stream, char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vfscanf_s_l(_Stream, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl fscanf_s( FILE* const _Stream, char const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vfscanf_s_l(_Stream, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_scanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _scanf_l( char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vfscanf_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __declspec(deprecated("This function or variable may be unsafe. Consider using " "scanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl scanf( char const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vfscanf_l((__acrt_iob_func(0)), _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _scanf_s_l( char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vfscanf_s_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl scanf_s( char const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vfscanf_s_l((__acrt_iob_func(0)), _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __declspec(dllimport) int __cdecl __stdio_common_vsprintf( unsigned __int64 _Options, char* _Buffer, size_t _BufferCount, char const* _Format, _locale_t _Locale, va_list _ArgList ); __declspec(dllimport) int __cdecl __stdio_common_vsprintf_s( unsigned __int64 _Options, char* _Buffer, size_t _BufferCount, char const* _Format, _locale_t _Locale, va_list _ArgList ); __declspec(dllimport) int __cdecl __stdio_common_vsnprintf_s( unsigned __int64 _Options, char* _Buffer, size_t _BufferCount, size_t _MaxCount, char const* _Format, _locale_t _Locale, va_list _ArgList ); __declspec(dllimport) int __cdecl __stdio_common_vsprintf_p( unsigned __int64 _Options, char* _Buffer, size_t _BufferCount, char const* _Format, _locale_t _Locale, va_list _ArgList ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsnprintf_l( char* const _Buffer, size_t const _BufferCount, char const* const _Format, _locale_t const _Locale, va_list _ArgList ) { int const _Result = __stdio_common_vsprintf( (*__local_stdio_printf_options()) | (1ULL << 0), _Buffer, _BufferCount, _Format, _Locale, _ArgList); return _Result < 0 ? -1 : _Result; } __inline int __cdecl _vsnprintf( char* const _Buffer, size_t const _BufferCount, char const* const _Format, va_list _ArgList ) { return _vsnprintf_l(_Buffer, _BufferCount, _Format, 0, _ArgList); } __inline int __cdecl vsnprintf( char* const _Buffer, size_t const _BufferCount, char const* const _Format, va_list _ArgList ) { int const _Result = __stdio_common_vsprintf( (*__local_stdio_printf_options()) | (1ULL << 1), _Buffer, _BufferCount, _Format, 0, _ArgList); return _Result < 0 ? -1 : _Result; } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsprintf_l( char* const _Buffer, char const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return _vsnprintf_l(_Buffer, (size_t)-1, _Format, _Locale, _ArgList); } __declspec(deprecated("This function or variable may be unsafe. Consider using " "vsprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl vsprintf( char* const _Buffer, char const* const _Format, va_list _ArgList ) { return _vsnprintf_l(_Buffer, (size_t)-1, _Format, 0, _ArgList); } __inline int __cdecl _vsprintf_s_l( char* const _Buffer, size_t const _BufferCount, char const* const _Format, _locale_t const _Locale, va_list _ArgList ) { int const _Result = __stdio_common_vsprintf_s( (*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList); return _Result < 0 ? -1 : _Result; } __inline int __cdecl vsprintf_s( char* const _Buffer, size_t const _BufferCount, char const* const _Format, va_list _ArgList ) { return _vsprintf_s_l(_Buffer, _BufferCount, _Format, 0, _ArgList); } extern "C++" { template <size_t _Size> inline int __cdecl vsprintf_s( char (&_Buffer)[_Size], char const* _Format, va_list _ArgList) throw() { return vsprintf_s(_Buffer, _Size, _Format, _ArgList); } } __inline int __cdecl _vsprintf_p_l( char* const _Buffer, size_t const _BufferCount, char const* const _Format, _locale_t const _Locale, va_list _ArgList ) { int const _Result = __stdio_common_vsprintf_p( (*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList); return _Result < 0 ? -1 : _Result; } __inline int __cdecl _vsprintf_p( char* const _Buffer, size_t const _BufferCount, char const* const _Format, va_list _ArgList ) { return _vsprintf_p_l(_Buffer, _BufferCount, _Format, 0, _ArgList); } __inline int __cdecl _vsnprintf_s_l( char* const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const* const _Format, _locale_t const _Locale, va_list _ArgList ) { int const _Result = __stdio_common_vsnprintf_s( (*__local_stdio_printf_options()), _Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList); return _Result < 0 ? -1 : _Result; } __inline int __cdecl _vsnprintf_s( char* const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const* const _Format, va_list _ArgList ) { return _vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format, 0, _ArgList); } extern "C++" { template <size_t _Size> inline int __cdecl _vsnprintf_s( char (&_Buffer)[_Size], size_t _BufferCount, char const* _Format, va_list _ArgList) throw() { return _vsnprintf_s(_Buffer, _Size, _BufferCount, _Format, _ArgList); } } __inline int __cdecl vsnprintf_s( char* const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const* const _Format, va_list _ArgList ) { return _vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format, 0, _ArgList); } extern "C++" { template <size_t _Size> inline int __cdecl vsnprintf_s( char (&_Buffer)[_Size], size_t _BufferCount, char const* _Format, va_list _ArgList) throw() { return vsnprintf_s(_Buffer, _Size, _BufferCount, _Format, _ArgList); } } __inline int __cdecl _vscprintf_l( char const* const _Format, _locale_t const _Locale, va_list _ArgList ) { int const _Result = __stdio_common_vsprintf( (*__local_stdio_printf_options()) | (1ULL << 1), 0, 0, _Format, _Locale, _ArgList); return _Result < 0 ? -1 : _Result; } __inline int __cdecl _vscprintf( char const* const _Format, va_list _ArgList ) { return _vscprintf_l(_Format, 0, _ArgList); } __inline int __cdecl _vscprintf_p_l( char const* const _Format, _locale_t const _Locale, va_list _ArgList ) { int const _Result = __stdio_common_vsprintf_p( (*__local_stdio_printf_options()) | (1ULL << 1), 0, 0, _Format, _Locale, _ArgList); return _Result < 0 ? -1 : _Result; } __inline int __cdecl _vscprintf_p( char const* const _Format, va_list _ArgList ) { return _vscprintf_p_l(_Format, 0, _ArgList); } __inline int __cdecl _vsnprintf_c_l( char* const _Buffer, size_t const _BufferCount, char const* const _Format, _locale_t const _Locale, va_list _ArgList ) { int const _Result = __stdio_common_vsprintf( (*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList); return _Result < 0 ? -1 : _Result; } __inline int __cdecl _vsnprintf_c( char* const _Buffer, size_t const _BufferCount, char const* const _Format, va_list _ArgList ) { return _vsnprintf_c_l(_Buffer, _BufferCount, _Format, 0, _ArgList); } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_sprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _sprintf_l( char* const _Buffer, char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vsprintf_l(_Buffer, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl sprintf( char* const _Buffer, char const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vsprintf_l(_Buffer, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __declspec(deprecated("This function or variable may be unsafe. Consider using " "sprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) int __cdecl sprintf( char *_Buffer, char const* _Format, ...); __declspec(deprecated("This function or variable may be unsafe. Consider using " "vsprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) int __cdecl vsprintf( char *_Buffer, char const* _Format, va_list _Args); __inline int __cdecl _sprintf_s_l( char* const _Buffer, size_t const _BufferCount, char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vsprintf_s_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl sprintf_s( char* const _Buffer, size_t const _BufferCount, char const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vsprintf_s_l(_Buffer, _BufferCount, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } extern "C++" { template <size_t _Size> inline int __cdecl sprintf_s( char (&_Buffer)[_Size], char const* _Format, ...) throw() { va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); return vsprintf_s(_Buffer, _Size, _Format, _ArgList); } } __inline int __cdecl _sprintf_p_l( char* const _Buffer, size_t const _BufferCount, char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vsprintf_p_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _sprintf_p( char* const _Buffer, size_t const _BufferCount, char const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vsprintf_p_l(_Buffer, _BufferCount, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snprintf_l( char* const _Buffer, size_t const _BufferCount, char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vsnprintf_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl snprintf( char* const _Buffer, size_t const _BufferCount, char const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = vsnprintf(_Buffer, _BufferCount, _Format, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _snprintf( char* const _Buffer, size_t const _BufferCount, char const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vsnprintf(_Buffer, _BufferCount, _Format, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) int __cdecl _snprintf( char *_Buffer, size_t _BufferCount, char const* _Format, ...); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) int __cdecl _vsnprintf( char *_Buffer, size_t _BufferCount, char const* _Format, va_list _Args); __inline int __cdecl _snprintf_c_l( char* const _Buffer, size_t const _BufferCount, char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vsnprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _snprintf_c( char* const _Buffer, size_t const _BufferCount, char const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vsnprintf_c_l(_Buffer, _BufferCount, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _snprintf_s_l( char* const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _snprintf_s( char* const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } extern "C++" { template <size_t _Size> inline int __cdecl _snprintf_s( char (&_Buffer)[_Size], size_t _BufferCount, char const* _Format, ...) throw() { va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); return _vsnprintf_s(_Buffer, _Size, _BufferCount, _Format, _ArgList); } } __inline int __cdecl _scprintf_l( char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vscprintf_l(_Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _scprintf( char const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vscprintf_l(_Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _scprintf_p_l( char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vscprintf_p_l(_Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _scprintf_p( char const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vscprintf_p(_Format, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __declspec(dllimport) int __cdecl __stdio_common_vsscanf( unsigned __int64 _Options, char const* _Buffer, size_t _BufferCount, char const* _Format, _locale_t _Locale, va_list _ArgList ); __inline int __cdecl _vsscanf_l( char const* const _Buffer, char const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return __stdio_common_vsscanf( (*__local_stdio_scanf_options ()), _Buffer, (size_t)-1, _Format, _Locale, _ArgList); } __inline int __cdecl vsscanf( char const* const _Buffer, char const* const _Format, va_list _ArgList ) { return _vsscanf_l(_Buffer, _Format, 0, _ArgList); } __inline int __cdecl _vsscanf_s_l( char const* const _Buffer, char const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return __stdio_common_vsscanf( (*__local_stdio_scanf_options ()) | (1ULL << 0), _Buffer, (size_t)-1, _Format, _Locale, _ArgList); } #pragma warning(push) #pragma warning(disable: 6530) __inline int __cdecl vsscanf_s( char const* const _Buffer, char const* const _Format, va_list _ArgList ) { return _vsscanf_s_l(_Buffer, _Format, 0, _ArgList); } extern "C++" { template <size_t _Size> inline int __cdecl vsscanf_s( char const (&_Buffer)[_Size], char const* _Format, va_list _ArgList) throw() { return vsscanf_s(_Buffer, _Size, _Format, _ArgList); } } #pragma warning(pop) __declspec(deprecated("This function or variable may be unsafe. Consider using " "_sscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _sscanf_l( char const* const _Buffer, char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vsscanf_l(_Buffer, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __declspec(deprecated("This function or variable may be unsafe. Consider using " "sscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl sscanf( char const* const _Buffer, char const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vsscanf_l(_Buffer, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _sscanf_s_l( char const* const _Buffer, char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vsscanf_s_l(_Buffer, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl sscanf_s( char const* const _Buffer, char const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = vsscanf_s(_Buffer, _Format, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } #pragma warning(push) #pragma warning(disable: 6530) __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snscanf_l( char const* const _Buffer, size_t const _BufferCount, char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = __stdio_common_vsscanf( (*__local_stdio_scanf_options ()), _Buffer, _BufferCount, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snscanf( char const* const _Buffer, size_t const _BufferCount, char const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = __stdio_common_vsscanf( (*__local_stdio_scanf_options ()), _Buffer, _BufferCount, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _snscanf_s_l( char const* const _Buffer, size_t const _BufferCount, char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = __stdio_common_vsscanf( (*__local_stdio_scanf_options ()) | (1ULL << 0), _Buffer, _BufferCount, _Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _snscanf_s( char const* const _Buffer, size_t const _BufferCount, char const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = __stdio_common_vsscanf( (*__local_stdio_scanf_options ()) | (1ULL << 0), _Buffer, _BufferCount, _Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } #pragma warning(pop) __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_tempnam" ". See online help for details.")) __declspec(dllimport) char* __cdecl tempnam( char const* _Directory, char const* _FilePrefix ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fcloseall" ". See online help for details.")) __declspec(dllimport) int __cdecl fcloseall(void); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fdopen" ". See online help for details.")) __declspec(dllimport) FILE* __cdecl fdopen( int _FileHandle, char const* _Format); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fgetchar" ". See online help for details.")) __declspec(dllimport) int __cdecl fgetchar(void); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fileno" ". See online help for details.")) __declspec(dllimport) int __cdecl fileno( FILE* _Stream); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_flushall" ". See online help for details.")) __declspec(dllimport) int __cdecl flushall(void); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fputchar" ". See online help for details.")) __declspec(dllimport) int __cdecl fputchar( int _Ch); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_getw" ". See online help for details.")) __declspec(dllimport) int __cdecl getw( FILE* _Stream); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_putw" ". See online help for details.")) __declspec(dllimport) int __cdecl putw( int _Ch, FILE* _Stream); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_rmtmp" ". See online help for details.")) __declspec(dllimport) int __cdecl rmtmp(void); } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { #pragma warning(push) #pragma warning(disable : 4995) using :: FILE; using :: _Mbstatet; using :: size_t; using :: fpos_t; using :: FILE; using :: clearerr; using :: fclose; using :: feof; using :: ferror; using :: fflush; using :: fgetc; using :: fgetpos; using :: fgets; using :: fopen; using :: fprintf; using :: fputc; using :: fputs; using :: fread; using :: freopen; using :: fscanf; using :: fseek; using :: fsetpos; using :: ftell; using :: fwrite; using :: getc; using :: getchar; using :: perror; using :: putc; using :: putchar; using :: printf; using :: puts; using :: remove; using :: rename; using :: rewind; using :: scanf; using :: setbuf; using :: setvbuf; using :: sprintf; using :: sscanf; using :: tmpfile; using :: tmpnam; using :: ungetc; using :: vfprintf; using :: vprintf; using :: vsprintf; using :: snprintf; using :: vsnprintf; using :: vfscanf; using :: vscanf; using :: vsscanf; #pragma warning(pop) } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { __declspec(dllimport) int* __cdecl _errno(void); __declspec(dllimport) errno_t __cdecl _set_errno( int _Value); __declspec(dllimport) errno_t __cdecl _get_errno( int* _Value); __declspec(dllimport) unsigned long* __cdecl __doserrno(void); __declspec(dllimport) errno_t __cdecl _set_doserrno( unsigned long _Value); __declspec(dllimport) errno_t __cdecl _get_doserrno( unsigned long * _Value); } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4514 4820 ) __pragma(pack(push, 8)) extern "C" { [[nodiscard]] void const* __cdecl memchr( void const* _Buf, int _Val, size_t _MaxCount ); [[nodiscard]] int __cdecl memcmp( void const* _Buf1, void const* _Buf2, size_t _Size ); void* __cdecl memcpy( void* _Dst, void const* _Src, size_t _Size ); void* __cdecl memmove( void* _Dst, void const* _Src, size_t _Size ); void* __cdecl memset( void* _Dst, int _Val, size_t _Size ); [[nodiscard]] char const* __cdecl strchr( char const* _Str, int _Val ); [[nodiscard]] char const* __cdecl strrchr( char const* _Str, int _Ch ); [[nodiscard]] char const* __cdecl strstr( char const* _Str, char const* _SubStr ); [[nodiscard]] wchar_t const* __cdecl wcschr( wchar_t const* _Str, wchar_t _Ch ); [[nodiscard]] wchar_t const* __cdecl wcsrchr( wchar_t const* _Str, wchar_t _Ch ); [[nodiscard]] wchar_t const* __cdecl wcsstr( wchar_t const* _Str, wchar_t const* _SubStr ); } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { static __inline errno_t __cdecl memcpy_s( void* const _Destination, rsize_t const _DestinationSize, void const* const _Source, rsize_t const _SourceSize ) { if (_SourceSize == 0) { return 0; } { int _Expr_val=!!(_Destination != 0); if (!(_Expr_val)) { (*_errno()) = 22; _invalid_parameter_noinfo(); return 22; } }; if (_Source == 0 || _DestinationSize < _SourceSize) { memset(_Destination, 0, _DestinationSize); { int _Expr_val=!!(_Source != 0); if (!(_Expr_val)) { (*_errno()) = 22; _invalid_parameter_noinfo(); return 22; } }; { int _Expr_val=!!(_DestinationSize >= _SourceSize); if (!(_Expr_val)) { (*_errno()) = 34; _invalid_parameter_noinfo(); return 34; } }; return 22; } memcpy(_Destination, _Source, _SourceSize); return 0; } static __inline errno_t __cdecl memmove_s( void* const _Destination, rsize_t const _DestinationSize, void const* const _Source, rsize_t const _SourceSize ) { if (_SourceSize == 0) { return 0; } { int _Expr_val=!!(_Destination != 0); if (!(_Expr_val)) { (*_errno()) = 22; _invalid_parameter_noinfo(); return 22; } }; { int _Expr_val=!!(_Source != 0); if (!(_Expr_val)) { (*_errno()) = 22; _invalid_parameter_noinfo(); return 22; } }; { int _Expr_val=!!(_DestinationSize >= _SourceSize); if (!(_Expr_val)) { (*_errno()) = 34; _invalid_parameter_noinfo(); return 34; } }; memmove(_Destination, _Source, _SourceSize); return 0; } #pragma warning(pop) } __pragma(pack(pop)) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { __declspec(dllimport) errno_t __cdecl _cgetws_s( wchar_t* _Buffer, size_t _BufferCount, size_t* _SizeRead ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _cgetws_s( wchar_t (&_Buffer)[_Size], size_t* _SizeRead) throw() { return _cgetws_s(_Buffer, _Size, _SizeRead); } } __declspec(dllimport) int __cdecl _cputws( wchar_t const* _Buffer ); __declspec(dllimport) wint_t __cdecl _getwch (void); __declspec(dllimport) wint_t __cdecl _getwche (void); __declspec(dllimport) wint_t __cdecl _putwch ( wchar_t _Character); __declspec(dllimport) wint_t __cdecl _ungetwch( wint_t _Character); __declspec(dllimport) wint_t __cdecl _getwch_nolock (void); __declspec(dllimport) wint_t __cdecl _getwche_nolock (void); __declspec(dllimport) wint_t __cdecl _putwch_nolock ( wchar_t _Character); __declspec(dllimport) wint_t __cdecl _ungetwch_nolock( wint_t _Character); __declspec(dllimport) int __cdecl __conio_common_vcwprintf( unsigned __int64 _Options, wchar_t const* _Format, _locale_t _Locale, va_list _ArgList ); __declspec(dllimport) int __cdecl __conio_common_vcwprintf_s( unsigned __int64 _Options, wchar_t const* _Format, _locale_t _Locale, va_list _ArgList ); __declspec(dllimport) int __cdecl __conio_common_vcwprintf_p( unsigned __int64 _Options, wchar_t const* _Format, _locale_t _Locale, va_list _ArgList ); __inline int __cdecl _vcwprintf_l( wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return __conio_common_vcwprintf((*__local_stdio_printf_options()), _Format, _Locale, _ArgList); } __inline int __cdecl _vcwprintf( wchar_t const* const _Format, va_list _ArgList ) { return _vcwprintf_l(_Format, 0, _ArgList); } __inline int __cdecl _vcwprintf_s_l( wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return __conio_common_vcwprintf_s((*__local_stdio_printf_options()), _Format, _Locale, _ArgList); } __inline int __cdecl _vcwprintf_s( wchar_t const* const _Format, va_list _ArgList ) { return _vcwprintf_s_l(_Format, 0, _ArgList); } __inline int __cdecl _vcwprintf_p_l( wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return __conio_common_vcwprintf_p((*__local_stdio_printf_options()), _Format, _Locale, _ArgList); } __inline int __cdecl _vcwprintf_p( const wchar_t* const _Format, va_list _ArgList ) { return _vcwprintf_p_l(_Format, 0, _ArgList); } __inline int __cdecl _cwprintf_l( wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vcwprintf_l(_Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _cwprintf( wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vcwprintf_l(_Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _cwprintf_s_l( wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vcwprintf_s_l(_Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _cwprintf_s( wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vcwprintf_s_l(_Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _cwprintf_p_l( wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vcwprintf_p_l(_Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _cwprintf_p( wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vcwprintf_p_l(_Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __declspec(dllimport) int __cdecl __conio_common_vcwscanf( unsigned __int64 _Options, wchar_t const* _Format, _locale_t _Locale, va_list _ArgList ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_vcwscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vcwscanf_l( wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return __conio_common_vcwscanf( (*__local_stdio_scanf_options ()), _Format, _Locale, _ArgList); } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_vcwscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vcwscanf( wchar_t const* const _Format, va_list _ArgList ) { return _vcwscanf_l(_Format, 0, _ArgList); } __inline int __cdecl _vcwscanf_s_l( wchar_t const* const _Format, _locale_t const _Locale, va_list _ArgList ) { return __conio_common_vcwscanf( (*__local_stdio_scanf_options ()) | (1ULL << 0), _Format, _Locale, _ArgList); } __inline int __cdecl _vcwscanf_s( wchar_t const* const _Format, va_list _ArgList ) { return _vcwscanf_s_l(_Format, 0, _ArgList); } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_cwscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _cwscanf_l( wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vcwscanf_l(_Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_cwscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _cwscanf( wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vcwscanf_l(_Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _cwscanf_s_l( wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Locale)>(), ((void)(__va_start(&_ArgList, _Locale))))); _Result = _vcwscanf_s_l(_Format, _Locale, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } __inline int __cdecl _cwscanf_s( wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; ((void)(__vcrt_assert_va_start_is_not_reference<decltype(_Format)>(), ((void)(__va_start(&_ArgList, _Format))))); _Result = _vcwscanf_s_l(_Format, 0, _ArgList); ((void)(_ArgList = (va_list)0)); return _Result; } } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { __declspec(dllimport) const unsigned short* __cdecl __pctype_func(void); __declspec(dllimport) const wctype_t* __cdecl __pwctype_func(void); __declspec(dllimport) int __cdecl iswalnum ( wint_t _C); __declspec(dllimport) int __cdecl iswalpha ( wint_t _C); __declspec(dllimport) int __cdecl iswascii ( wint_t _C); __declspec(dllimport) int __cdecl iswblank ( wint_t _C); __declspec(dllimport) int __cdecl iswcntrl ( wint_t _C); __declspec(dllimport) int __cdecl iswdigit ( wint_t _C); __declspec(dllimport) int __cdecl iswgraph ( wint_t _C); __declspec(dllimport) int __cdecl iswlower ( wint_t _C); __declspec(dllimport) int __cdecl iswprint ( wint_t _C); __declspec(dllimport) int __cdecl iswpunct ( wint_t _C); __declspec(dllimport) int __cdecl iswspace ( wint_t _C); __declspec(dllimport) int __cdecl iswupper ( wint_t _C); __declspec(dllimport) int __cdecl iswxdigit ( wint_t _C); __declspec(dllimport) int __cdecl __iswcsymf( wint_t _C); __declspec(dllimport) int __cdecl __iswcsym ( wint_t _C); __declspec(dllimport) int __cdecl _iswalnum_l ( wint_t _C, _locale_t _Locale); __declspec(dllimport) int __cdecl _iswalpha_l ( wint_t _C, _locale_t _Locale); __declspec(dllimport) int __cdecl _iswblank_l ( wint_t _C, _locale_t _Locale); __declspec(dllimport) int __cdecl _iswcntrl_l ( wint_t _C, _locale_t _Locale); __declspec(dllimport) int __cdecl _iswdigit_l ( wint_t _C, _locale_t _Locale); __declspec(dllimport) int __cdecl _iswgraph_l ( wint_t _C, _locale_t _Locale); __declspec(dllimport) int __cdecl _iswlower_l ( wint_t _C, _locale_t _Locale); __declspec(dllimport) int __cdecl _iswprint_l ( wint_t _C, _locale_t _Locale); __declspec(dllimport) int __cdecl _iswpunct_l ( wint_t _C, _locale_t _Locale); __declspec(dllimport) int __cdecl _iswspace_l ( wint_t _C, _locale_t _Locale); __declspec(dllimport) int __cdecl _iswupper_l ( wint_t _C, _locale_t _Locale); __declspec(dllimport) int __cdecl _iswxdigit_l( wint_t _C, _locale_t _Locale); __declspec(dllimport) int __cdecl _iswcsymf_l ( wint_t _C, _locale_t _Locale); __declspec(dllimport) int __cdecl _iswcsym_l ( wint_t _C, _locale_t _Locale); __declspec(dllimport) wint_t __cdecl towupper( wint_t _C); __declspec(dllimport) wint_t __cdecl towlower( wint_t _C); __declspec(dllimport) int __cdecl iswctype( wint_t _C, wctype_t _Type); __declspec(dllimport) wint_t __cdecl _towupper_l( wint_t _C, _locale_t _Locale); __declspec(dllimport) wint_t __cdecl _towlower_l( wint_t _C, _locale_t _Locale); __declspec(dllimport) int __cdecl _iswctype_l( wint_t _C, wctype_t _Type, _locale_t _Locale); __declspec(dllimport) int __cdecl isleadbyte( int _C); __declspec(dllimport) int __cdecl _isleadbyte_l( int _C, _locale_t _Locale); __declspec(deprecated("This function or variable has been superceded by newer library " "or operating system functionality. Consider using " "iswctype" " " "instead. See online help for details.")) __declspec(dllimport) int __cdecl is_wctype( wint_t _C, wctype_t _Type); } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { __declspec(dllimport) __declspec(allocator) wchar_t* __cdecl _wgetcwd( wchar_t* _DstBuf, int _SizeInWords ); __declspec(dllimport) __declspec(allocator) wchar_t* __cdecl _wgetdcwd( int _Drive, wchar_t* _DstBuf, int _SizeInWords ); __declspec(dllimport) int __cdecl _wchdir( wchar_t const* _Path ); __declspec(dllimport) int __cdecl _wmkdir( wchar_t const* _Path ); __declspec(dllimport) int __cdecl _wrmdir( wchar_t const* _Path ); } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) #pragma warning(pop) #pragma external_header(pop) #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { typedef unsigned long _fsize_t; struct _wfinddata32_t { unsigned attrib; __time32_t time_create; __time32_t time_access; __time32_t time_write; _fsize_t size; wchar_t name[260]; }; struct _wfinddata32i64_t { unsigned attrib; __time32_t time_create; __time32_t time_access; __time32_t time_write; __int64 size; wchar_t name[260]; }; struct _wfinddata64i32_t { unsigned attrib; __time64_t time_create; __time64_t time_access; __time64_t time_write; _fsize_t size; wchar_t name[260]; }; struct _wfinddata64_t { unsigned attrib; __time64_t time_create; __time64_t time_access; __time64_t time_write; __int64 size; wchar_t name[260]; }; __declspec(dllimport) int __cdecl _waccess( wchar_t const* _FileName, int _AccessMode ); __declspec(dllimport) errno_t __cdecl _waccess_s( wchar_t const* _FileName, int _AccessMode ); __declspec(dllimport) int __cdecl _wchmod( wchar_t const* _FileName, int _Mode ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wsopen_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) int __cdecl _wcreat( wchar_t const* _FileName, int _PermissionMode ); __declspec(dllimport) intptr_t __cdecl _wfindfirst32( wchar_t const* _FileName, struct _wfinddata32_t* _FindData ); __declspec(dllimport) int __cdecl _wfindnext32( intptr_t _FindHandle, struct _wfinddata32_t* _FindData ); __declspec(dllimport) int __cdecl _wunlink( wchar_t const* _FileName ); __declspec(dllimport) int __cdecl _wrename( wchar_t const* _OldFileName, wchar_t const* _NewFileName ); __declspec(dllimport) errno_t __cdecl _wmktemp_s( wchar_t* _TemplateName, size_t _SizeInWords ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _wmktemp_s(wchar_t (&_TemplateName)[_Size]) throw() { return _wmktemp_s(_TemplateName, _Size); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wmktemp_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl _wmktemp( wchar_t *_TemplateName); __declspec(dllimport) intptr_t __cdecl _wfindfirst32i64( wchar_t const* _FileName, struct _wfinddata32i64_t* _FindData ); __declspec(dllimport) intptr_t __cdecl _wfindfirst64i32( wchar_t const* _FileName, struct _wfinddata64i32_t* _FindData ); __declspec(dllimport) intptr_t __cdecl _wfindfirst64( wchar_t const* _FileName, struct _wfinddata64_t* _FindData ); __declspec(dllimport) int __cdecl _wfindnext32i64( intptr_t _FindHandle, struct _wfinddata32i64_t* _FindData ); __declspec(dllimport) int __cdecl _wfindnext64i32( intptr_t _FindHandle, struct _wfinddata64i32_t* _FindData ); __declspec(dllimport) int __cdecl _wfindnext64( intptr_t _FindHandle, struct _wfinddata64_t* _FindData ); __declspec(dllimport) errno_t __cdecl _wsopen_s( int* _FileHandle, wchar_t const* _FileName, int _OpenFlag, int _ShareFlag, int _PermissionFlag ); __declspec(dllimport) errno_t __cdecl _wsopen_dispatch( wchar_t const* _FileName, int _OFlag, int _ShFlag, int _PMode, int* _PFileHandle, int _BSecure ); extern "C++" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wsopen_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) inline int __cdecl _wopen( wchar_t const* _FileName, int _OFlag, int _PMode = 0 ) { int _FileHandle; errno_t const _Result = _wsopen_dispatch(_FileName, _OFlag, 0x40, _PMode, &_FileHandle, 0); return _Result ? -1 : _FileHandle; } extern "C++" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wsopen_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) inline int __cdecl _wsopen( wchar_t const* _FileName, int _OFlag, int _ShFlag, int _PMode = 0 ) { int _FileHandle; errno_t const _Result = _wsopen_dispatch(_FileName, _OFlag, _ShFlag, _PMode, &_FileHandle, 0); return _Result ? -1 : _FileHandle; } } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { __declspec(dllimport) intptr_t __cdecl _wexecl( wchar_t const* _FileName, wchar_t const* _ArgList, ...); __declspec(dllimport) intptr_t __cdecl _wexecle( wchar_t const* _FileName, wchar_t const* _ArgList, ...); __declspec(dllimport) intptr_t __cdecl _wexeclp( wchar_t const* _FileName, wchar_t const* _ArgList, ...); __declspec(dllimport) intptr_t __cdecl _wexeclpe( wchar_t const* _FileName, wchar_t const* _ArgList, ...); __declspec(dllimport) intptr_t __cdecl _wexecv( wchar_t const* _FileName, wchar_t const* const* _ArgList ); __declspec(dllimport) intptr_t __cdecl _wexecve( wchar_t const* _FileName, wchar_t const* const* _ArgList, wchar_t const* const* _Env ); __declspec(dllimport) intptr_t __cdecl _wexecvp( wchar_t const* _FileName, wchar_t const* const* _ArgList ); __declspec(dllimport) intptr_t __cdecl _wexecvpe( wchar_t const* _FileName, wchar_t const* const* _ArgList, wchar_t const* const* _Env ); __declspec(dllimport) intptr_t __cdecl _wspawnl( int _Mode, wchar_t const* _FileName, wchar_t const* _ArgList, ...); __declspec(dllimport) intptr_t __cdecl _wspawnle( int _Mode, wchar_t const* _FileName, wchar_t const* _ArgList, ...); __declspec(dllimport) intptr_t __cdecl _wspawnlp( int _Mode, wchar_t const* _FileName, wchar_t const* _ArgList, ...); __declspec(dllimport) intptr_t __cdecl _wspawnlpe( int _Mode, wchar_t const* _FileName, wchar_t const* _ArgList, ...); __declspec(dllimport) intptr_t __cdecl _wspawnv( int _Mode, wchar_t const* _FileName, wchar_t const* const* _ArgList ); __declspec(dllimport) intptr_t __cdecl _wspawnve( int _Mode, wchar_t const* _FileName, wchar_t const* const* _ArgList, wchar_t const* const* _Env ); __declspec(dllimport) intptr_t __cdecl _wspawnvp( int _Mode, wchar_t const* _FileName, wchar_t const* const* _ArgList ); __declspec(dllimport) intptr_t __cdecl _wspawnvpe( int _Mode, wchar_t const* _FileName, wchar_t const* const* _ArgList, wchar_t const* const* _Env ); __declspec(dllimport) int __cdecl _wsystem( wchar_t const* _Command ); } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { __declspec(dllimport) errno_t __cdecl wcscat_s( wchar_t* _Destination, rsize_t _SizeInWords, wchar_t const* _Source ); __declspec(dllimport) errno_t __cdecl wcscpy_s( wchar_t* _Destination, rsize_t _SizeInWords, wchar_t const* _Source ); __declspec(dllimport) errno_t __cdecl wcsncat_s( wchar_t* _Destination, rsize_t _SizeInWords, wchar_t const* _Source, rsize_t _MaxCount ); __declspec(dllimport) errno_t __cdecl wcsncpy_s( wchar_t* _Destination, rsize_t _SizeInWords, wchar_t const* _Source, rsize_t _MaxCount ); __declspec(dllimport) wchar_t* __cdecl wcstok_s( wchar_t* _String, wchar_t const* _Delimiter, wchar_t** _Context ); __declspec(dllimport) __declspec(allocator) wchar_t* __cdecl _wcsdup( wchar_t const* _String ); extern "C++" { template <size_t _Size> inline errno_t __cdecl wcscat_s(wchar_t (&_Destination)[_Size], wchar_t const* _Source) throw() { return wcscat_s(_Destination, _Size, _Source); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "wcscat_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl wcscat( wchar_t *_Destination, wchar_t const* _Source); __declspec(dllimport) int __cdecl wcscmp( wchar_t const* _String1, wchar_t const* _String2 ); extern "C++" { template <size_t _Size> inline errno_t __cdecl wcscpy_s(wchar_t (&_Destination)[_Size], wchar_t const* _Source) throw() { return wcscpy_s(_Destination, _Size, _Source); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "wcscpy_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl wcscpy( wchar_t *_Destination, wchar_t const* _Source); __declspec(dllimport) size_t __cdecl wcscspn( wchar_t const* _String, wchar_t const* _Control ); __declspec(dllimport) size_t __cdecl wcslen( wchar_t const* _String ); __declspec(dllimport) size_t __cdecl wcsnlen( wchar_t const* _Source, size_t _MaxCount ); static __inline size_t __cdecl wcsnlen_s( wchar_t const* _Source, size_t _MaxCount ) { return (_Source == 0) ? 0 : wcsnlen(_Source, _MaxCount); } extern "C++" { template <size_t _Size> inline errno_t __cdecl wcsncat_s( wchar_t (&_Destination)[_Size], wchar_t const* _Source, size_t _Count) throw() { return wcsncat_s(_Destination, _Size, _Source, _Count); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "wcsncat_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl wcsncat( wchar_t *_Destination, wchar_t const* _Source, size_t _Count); __declspec(dllimport) int __cdecl wcsncmp( wchar_t const* _String1, wchar_t const* _String2, size_t _MaxCount ); extern "C++" { template <size_t _Size> inline errno_t __cdecl wcsncpy_s(wchar_t (&_Destination)[_Size], wchar_t const* _Source, size_t _Count) throw() { return wcsncpy_s(_Destination, _Size, _Source, _Count); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "wcsncpy_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl wcsncpy( wchar_t *_Destination, wchar_t const* _Source, size_t _Count); __declspec(dllimport) wchar_t const* __cdecl wcspbrk( wchar_t const* _String, wchar_t const* _Control ); __declspec(dllimport) size_t __cdecl wcsspn( wchar_t const* _String, wchar_t const* _Control ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "wcstok_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl wcstok( wchar_t* _String, wchar_t const* _Delimiter, wchar_t** _Context ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "wcstok_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) static __inline wchar_t* __cdecl _wcstok( wchar_t* const _String, wchar_t const* const _Delimiter ) { return wcstok(_String, _Delimiter, 0); } extern "C++" __declspec(deprecated("wcstok has been changed to conform with the ISO C standard, " "adding an extra context parameter. To use the legacy Microsoft " "wcstok, define _CRT_NON_CONFORMING_WCSTOK.")) inline wchar_t* __cdecl wcstok( wchar_t* _String, wchar_t const* _Delimiter ) throw() { return wcstok(_String, _Delimiter, 0); } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcserror_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl _wcserror( int _ErrorNumber ); __declspec(dllimport) errno_t __cdecl _wcserror_s( wchar_t* _Buffer, size_t _SizeInWords, int _ErrorNumber ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _wcserror_s(wchar_t (&_Buffer)[_Size], int _Error) throw() { return _wcserror_s(_Buffer, _Size, _Error); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "__wcserror_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl __wcserror( wchar_t const* _String ); __declspec(dllimport) errno_t __cdecl __wcserror_s( wchar_t* _Buffer, size_t _SizeInWords, wchar_t const* _ErrorMessage ); extern "C++" { template <size_t _Size> inline errno_t __cdecl __wcserror_s(wchar_t (&_Buffer)[_Size], wchar_t const* _ErrorMessage) throw() { return __wcserror_s(_Buffer, _Size, _ErrorMessage); } } __declspec(dllimport) int __cdecl _wcsicmp( wchar_t const* _String1, wchar_t const* _String2 ); __declspec(dllimport) int __cdecl _wcsicmp_l( wchar_t const* _String1, wchar_t const* _String2, _locale_t _Locale ); __declspec(dllimport) int __cdecl _wcsnicmp( wchar_t const* _String1, wchar_t const* _String2, size_t _MaxCount ); __declspec(dllimport) int __cdecl _wcsnicmp_l( wchar_t const* _String1, wchar_t const* _String2, size_t _MaxCount, _locale_t _Locale ); __declspec(dllimport) errno_t __cdecl _wcsnset_s( wchar_t* _Destination, size_t _SizeInWords, wchar_t _Value, size_t _MaxCount ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _wcsnset_s( wchar_t (&_Destination)[_Size], wchar_t _Value, size_t _MaxCount) throw() { return _wcsnset_s(_Destination, _Size, _Value, _MaxCount); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcsnset_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl _wcsnset( wchar_t *_String, wchar_t _Value, size_t _MaxCount); __declspec(dllimport) wchar_t* __cdecl _wcsrev( wchar_t* _String ); __declspec(dllimport) errno_t __cdecl _wcsset_s( wchar_t* _Destination, size_t _SizeInWords, wchar_t _Value ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _wcsset_s( wchar_t (&_String)[_Size], wchar_t _Value) throw() { return _wcsset_s(_String, _Size, _Value); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcsset_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl _wcsset( wchar_t *_String, wchar_t _Value); __declspec(dllimport) errno_t __cdecl _wcslwr_s( wchar_t* _String, size_t _SizeInWords ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _wcslwr_s( wchar_t (&_String)[_Size]) throw() { return _wcslwr_s(_String, _Size); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcslwr_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl _wcslwr( wchar_t *_String); __declspec(dllimport) errno_t __cdecl _wcslwr_s_l( wchar_t* _String, size_t _SizeInWords, _locale_t _Locale ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _wcslwr_s_l( wchar_t (&_String)[_Size], _locale_t _Locale) throw() { return _wcslwr_s_l(_String, _Size, _Locale); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcslwr_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl _wcslwr_l( wchar_t *_String, _locale_t _Locale); __declspec(dllimport) errno_t __cdecl _wcsupr_s( wchar_t* _String, size_t _Size ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _wcsupr_s( wchar_t (&_String)[_Size]) throw() { return _wcsupr_s(_String, _Size); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcsupr_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl _wcsupr( wchar_t *_String); __declspec(dllimport) errno_t __cdecl _wcsupr_s_l( wchar_t* _String, size_t _Size, _locale_t _Locale ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _wcsupr_s_l( wchar_t (&_String)[_Size], _locale_t _Locale) throw() { return _wcsupr_s_l(_String, _Size, _Locale); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcsupr_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl _wcsupr_l( wchar_t *_String, _locale_t _Locale); __declspec(dllimport) size_t __cdecl wcsxfrm( wchar_t* _Destination, wchar_t const* _Source, size_t _MaxCount ); __declspec(dllimport) size_t __cdecl _wcsxfrm_l( wchar_t* _Destination, wchar_t const* _Source, size_t _MaxCount, _locale_t _Locale ); __declspec(dllimport) int __cdecl wcscoll( wchar_t const* _String1, wchar_t const* _String2 ); __declspec(dllimport) int __cdecl _wcscoll_l( wchar_t const* _String1, wchar_t const* _String2, _locale_t _Locale ); __declspec(dllimport) int __cdecl _wcsicoll( wchar_t const* _String1, wchar_t const* _String2 ); __declspec(dllimport) int __cdecl _wcsicoll_l( wchar_t const* _String1, wchar_t const* _String2, _locale_t _Locale ); __declspec(dllimport) int __cdecl _wcsncoll( wchar_t const* _String1, wchar_t const* _String2, size_t _MaxCount ); __declspec(dllimport) int __cdecl _wcsncoll_l( wchar_t const* _String1, wchar_t const* _String2, size_t _MaxCount, _locale_t _Locale ); __declspec(dllimport) int __cdecl _wcsnicoll( wchar_t const* _String1, wchar_t const* _String2, size_t _MaxCount ); __declspec(dllimport) int __cdecl _wcsnicoll_l( wchar_t const* _String1, wchar_t const* _String2, size_t _MaxCount, _locale_t _Locale ); extern "C++" { inline wchar_t* __cdecl wcschr( wchar_t* _String, wchar_t _C) { return const_cast<wchar_t*>(wcschr(static_cast<wchar_t const*>(_String), _C)); } inline wchar_t* __cdecl wcspbrk( wchar_t* _String, wchar_t const* _Control) { return const_cast<wchar_t*>(wcspbrk(static_cast<wchar_t const*>(_String), _Control)); } inline wchar_t* __cdecl wcsrchr( wchar_t* _String, wchar_t _C) { return const_cast<wchar_t*>(wcsrchr(static_cast<wchar_t const*>(_String), _C)); } inline wchar_t* __cdecl wcsstr( wchar_t* _String, wchar_t const*_SubStr) { return const_cast<wchar_t*>(wcsstr(static_cast<wchar_t const*>(_String), _SubStr)); } } __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsdup" ". See online help for details.")) __declspec(dllimport) wchar_t* __cdecl wcsdup( wchar_t const* _String ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsicmp" ". See online help for details.")) __declspec(dllimport) int __cdecl wcsicmp( wchar_t const* _String1, wchar_t const* _String2 ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsnicmp" ". See online help for details.")) __declspec(dllimport) int __cdecl wcsnicmp( wchar_t const* _String1, wchar_t const* _String2, size_t _MaxCount ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsnset" ". See online help for details.")) __declspec(dllimport) wchar_t* __cdecl wcsnset( wchar_t* _String, wchar_t _Value, size_t _MaxCount ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsrev" ". See online help for details.")) __declspec(dllimport) wchar_t* __cdecl wcsrev( wchar_t* _String ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsset" ". See online help for details.")) __declspec(dllimport) wchar_t* __cdecl wcsset( wchar_t* _String, wchar_t _Value ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcslwr" ". See online help for details.")) __declspec(dllimport) wchar_t* __cdecl wcslwr( wchar_t* _String ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsupr" ". See online help for details.")) __declspec(dllimport) wchar_t* __cdecl wcsupr( wchar_t* _String ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsicoll" ". See online help for details.")) __declspec(dllimport) int __cdecl wcsicoll( wchar_t const* _String1, wchar_t const* _String2 ); } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; }; __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wasctime_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl _wasctime( struct tm const* _Tm ); __declspec(dllimport) errno_t __cdecl _wasctime_s( wchar_t* _Buffer, size_t _SizeInWords, struct tm const* _Tm ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _wasctime_s( wchar_t (&_Buffer)[_Size], struct tm const* _Time) throw() { return _wasctime_s(_Buffer, _Size, _Time); } } __declspec(dllimport) size_t __cdecl wcsftime( wchar_t* _Buffer, size_t _SizeInWords, wchar_t const* _Format, struct tm const* _Tm ); __declspec(dllimport) size_t __cdecl _wcsftime_l( wchar_t* _Buffer, size_t _SizeInWords, wchar_t const* _Format, struct tm const* _Tm, _locale_t _Locale ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wctime32_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl _wctime32( __time32_t const* _Time ); __declspec(dllimport) errno_t __cdecl _wctime32_s( wchar_t* _Buffer, size_t _SizeInWords, __time32_t const* _Time ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _wctime32_s( wchar_t (&_Buffer)[_Size], __time32_t const* _Time) throw() { return _wctime32_s(_Buffer, _Size, _Time); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wctime64_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl _wctime64( __time64_t const* _Time ); __declspec(dllimport) errno_t __cdecl _wctime64_s( wchar_t* _Buffer, size_t _SizeInWords, __time64_t const* _Time); extern "C++" { template <size_t _Size> inline errno_t __cdecl _wctime64_s( wchar_t (&_Buffer)[_Size], __time64_t const* _Time) throw() { return _wctime64_s(_Buffer, _Size, _Time); } } __declspec(dllimport) errno_t __cdecl _wstrdate_s( wchar_t* _Buffer, size_t _SizeInWords ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _wstrdate_s( wchar_t (&_Buffer)[_Size]) throw() { return _wstrdate_s(_Buffer, _Size); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wstrdate_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl _wstrdate( wchar_t *_Buffer); __declspec(dllimport) errno_t __cdecl _wstrtime_s( wchar_t* _Buffer, size_t _SizeInWords ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _wstrtime_s( wchar_t (&_Buffer)[_Size]) throw() { return _wstrtime_s(_Buffer, _Size); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wstrtime_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) wchar_t* __cdecl _wstrtime( wchar_t *_Buffer); static __inline wchar_t * __cdecl _wctime( time_t const* const _Time) { return _wctime64(_Time); } static __inline errno_t __cdecl _wctime_s( wchar_t* const _Buffer, size_t const _SizeInWords, time_t const* const _Time ) { return _wctime64_s(_Buffer, _SizeInWords, _Time); } } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) typedef unsigned short _ino_t; typedef _ino_t ino_t; typedef unsigned int _dev_t; typedef _dev_t dev_t; typedef long _off_t; typedef _off_t off_t; #pragma warning(pop) #pragma external_header(pop) #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { struct _stat32 { _dev_t st_dev; _ino_t st_ino; unsigned short st_mode; short st_nlink; short st_uid; short st_gid; _dev_t st_rdev; _off_t st_size; __time32_t st_atime; __time32_t st_mtime; __time32_t st_ctime; }; struct _stat32i64 { _dev_t st_dev; _ino_t st_ino; unsigned short st_mode; short st_nlink; short st_uid; short st_gid; _dev_t st_rdev; __int64 st_size; __time32_t st_atime; __time32_t st_mtime; __time32_t st_ctime; }; struct _stat64i32 { _dev_t st_dev; _ino_t st_ino; unsigned short st_mode; short st_nlink; short st_uid; short st_gid; _dev_t st_rdev; _off_t st_size; __time64_t st_atime; __time64_t st_mtime; __time64_t st_ctime; }; struct _stat64 { _dev_t st_dev; _ino_t st_ino; unsigned short st_mode; short st_nlink; short st_uid; short st_gid; _dev_t st_rdev; __int64 st_size; __time64_t st_atime; __time64_t st_mtime; __time64_t st_ctime; }; struct stat { _dev_t st_dev; _ino_t st_ino; unsigned short st_mode; short st_nlink; short st_uid; short st_gid; _dev_t st_rdev; _off_t st_size; time_t st_atime; time_t st_mtime; time_t st_ctime; }; __declspec(dllimport) int __cdecl _fstat32( int _FileHandle, struct _stat32* _Stat ); __declspec(dllimport) int __cdecl _fstat32i64( int _FileHandle, struct _stat32i64* _Stat ); __declspec(dllimport) int __cdecl _fstat64i32( int _FileHandle, struct _stat64i32* _Stat ); __declspec(dllimport) int __cdecl _fstat64( int _FileHandle, struct _stat64* _Stat ); __declspec(dllimport) int __cdecl _stat32( char const* _FileName, struct _stat32* _Stat ); __declspec(dllimport) int __cdecl _stat32i64( char const* _FileName, struct _stat32i64* _Stat ); __declspec(dllimport) int __cdecl _stat64i32( char const* _FileName, struct _stat64i32* _Stat ); __declspec(dllimport) int __cdecl _stat64( char const* _FileName, struct _stat64* _Stat ); __declspec(dllimport) int __cdecl _wstat32( wchar_t const* _FileName, struct _stat32* _Stat ); __declspec(dllimport) int __cdecl _wstat32i64( wchar_t const* _FileName, struct _stat32i64* _Stat ); __declspec(dllimport) int __cdecl _wstat64i32( wchar_t const* _FileName, struct _stat64i32* _Stat ); __declspec(dllimport) int __cdecl _wstat64( wchar_t const* _FileName, struct _stat64* _Stat ); static __inline int __cdecl fstat(int const _FileHandle, struct stat* const _Stat) { static_assert((sizeof(struct stat) == sizeof(struct _stat64i32)), "sizeof(struct stat) == sizeof(struct _stat64i32)"); return _fstat64i32(_FileHandle, (struct _stat64i32*)_Stat); } static __inline int __cdecl stat(char const* const _FileName, struct stat* const _Stat) { static_assert((sizeof(struct stat) == sizeof(struct _stat64i32)), "sizeof(struct stat) == sizeof(struct _stat64i32)"); return _stat64i32(_FileName, (struct _stat64i32*)_Stat); } } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { typedef wchar_t _Wint_t; __declspec(dllimport) wchar_t* __cdecl _wsetlocale( int _Category, wchar_t const* _Locale ); __declspec(dllimport) _locale_t __cdecl _wcreate_locale( int _Category, wchar_t const* _Locale ); __declspec(dllimport) wint_t __cdecl btowc( int _Ch ); __declspec(dllimport) size_t __cdecl mbrlen( char const* _Ch, size_t _SizeInBytes, mbstate_t* _State ); __declspec(dllimport) size_t __cdecl mbrtowc( wchar_t* _DstCh, char const* _SrcCh, size_t _SizeInBytes, mbstate_t* _State ); __declspec(dllimport) errno_t __cdecl mbsrtowcs_s( size_t* _Retval, wchar_t* _Dst, size_t _Size, char const** _PSrc, size_t _N, mbstate_t* _State ); extern "C++" { template <size_t _Size> inline errno_t __cdecl mbsrtowcs_s( size_t* _Retval, wchar_t (&_Dest)[_Size], char const** _PSource, size_t _Count, mbstate_t* _State) throw() { return mbsrtowcs_s(_Retval, _Dest, _Size, _PSource, _Count, _State); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "mbsrtowcs_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) size_t __cdecl mbsrtowcs( wchar_t *_Dest, char const** _PSrc, size_t _Count, mbstate_t* _State); __declspec(dllimport) errno_t __cdecl wcrtomb_s( size_t* _Retval, char* _Dst, size_t _SizeInBytes, wchar_t _Ch, mbstate_t* _State ); extern "C++" { template <size_t _Size> inline errno_t __cdecl wcrtomb_s( size_t* _Retval, char (&_Dest)[_Size], wchar_t _Source, mbstate_t* _State) throw() { return wcrtomb_s(_Retval, _Dest, _Size, _Source, _State); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "wcrtomb_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) size_t __cdecl wcrtomb( char *_Dest, wchar_t _Source, mbstate_t* _State); __declspec(dllimport) errno_t __cdecl wcsrtombs_s( size_t* _Retval, char* _Dst, size_t _SizeInBytes, wchar_t const** _Src, size_t _Size, mbstate_t* _State ); extern "C++" { template <size_t _Size> inline errno_t __cdecl wcsrtombs_s( size_t* _Retval, char (&_Dest)[_Size], wchar_t const** _PSrc, size_t _Count, mbstate_t* _State) throw() { return wcsrtombs_s(_Retval, _Dest, _Size, _PSrc, _Count, _State); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "wcsrtombs_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) size_t __cdecl wcsrtombs( char *_Dest, wchar_t const** _PSource, size_t _Count, mbstate_t* _State); __declspec(dllimport) int __cdecl wctob( wint_t _WCh ); errno_t __cdecl wmemcpy_s( wchar_t* _S1, rsize_t _N1, wchar_t const* _S2, rsize_t _N ); errno_t __cdecl wmemmove_s( wchar_t* _S1, rsize_t _N1, wchar_t const* _S2, rsize_t _N ); __inline int __cdecl fwide( FILE* _F, int _M ) { (void)_F; return (_M); } __inline int __cdecl mbsinit( mbstate_t const* _P ) { return _P == 0 || _P->_Wchar == 0; } __inline wchar_t const* __cdecl wmemchr( wchar_t const* _S, wchar_t _C, size_t _N ) { for (; 0 < _N; ++_S, --_N) if (*_S == _C) return (wchar_t const*)_S; return 0; } __inline int __cdecl wmemcmp( wchar_t const* _S1, wchar_t const* _S2, size_t _N ) { for (; 0 < _N; ++_S1, ++_S2, --_N) if (*_S1 != *_S2) return *_S1 < *_S2 ? -1 : 1; return 0; } __inline wchar_t* __cdecl wmemcpy( wchar_t* _S1, wchar_t const* _S2, size_t _N ) { #pragma warning(suppress: 6386) return (wchar_t*)memcpy(_S1, _S2, _N*sizeof(wchar_t)); } __inline wchar_t* __cdecl wmemmove( wchar_t* _S1, wchar_t const* _S2, size_t _N ) { #pragma warning(suppress: 6386) return (wchar_t*)memmove(_S1, _S2, _N*sizeof(wchar_t)); } __inline wchar_t* __cdecl wmemset( wchar_t* _S, wchar_t _C, size_t _N ) { wchar_t *_Su = _S; for (; 0 < _N; ++_Su, --_N) { *_Su = _C; } return _S; } extern "C++" inline wchar_t* __cdecl wmemchr( wchar_t* _S, wchar_t _C, size_t _N ) { wchar_t const* const _SC = _S; return const_cast<wchar_t*>(wmemchr(_SC, _C, _N)); } } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) using _Mbstatet = mbstate_t; namespace std { #pragma warning(push) #pragma warning(disable : 4995) using :: _Mbstatet; using :: mbstate_t; using :: size_t; using :: tm; using :: wint_t; using :: btowc; using :: fgetwc; using :: fgetws; using :: fputwc; using :: fputws; using :: fwide; using :: fwprintf; using :: fwscanf; using :: getwc; using :: getwchar; using :: mbrlen; using :: mbrtowc; using :: mbsrtowcs; using :: mbsinit; using :: putwc; using :: putwchar; using :: swprintf; using :: swscanf; using :: ungetwc; using :: vfwprintf; using :: vswprintf; using :: vwprintf; using :: wcrtomb; using :: wprintf; using :: wscanf; using :: wcsrtombs; using :: wcstol; using :: wcscat; using :: wcschr; using :: wcscmp; using :: wcscoll; using :: wcscpy; using :: wcscspn; using :: wcslen; using :: wcsncat; using :: wcsncmp; using :: wcsncpy; using :: wcspbrk; using :: wcsrchr; using :: wcsspn; using :: wcstod; using :: wcstoul; using :: wcsstr; using :: wcstok; using :: wcsxfrm; using :: wctob; using :: wmemchr; using :: wmemcmp; using :: wmemcpy; using :: wmemmove; using :: wmemset; using :: wcsftime; using :: vfwscanf; using :: vswscanf; using :: vwscanf; using :: wcstof; using :: wcstold; using :: wcstoll; using :: wcstoull; #pragma warning(pop) } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { enum float_denorm_style { denorm_indeterminate = -1, denorm_absent = 0, denorm_present = 1 }; enum float_round_style { round_indeterminate = -1, round_toward_zero = 0, round_to_nearest = 1, round_toward_infinity = 2, round_toward_neg_infinity = 3 }; struct _Num_base { static constexpr float_denorm_style has_denorm = denorm_absent; static constexpr bool has_denorm_loss = false; static constexpr bool has_infinity = false; static constexpr bool has_quiet_NaN = false; static constexpr bool has_signaling_NaN = false; static constexpr bool is_bounded = false; static constexpr bool is_exact = false; static constexpr bool is_iec559 = false; static constexpr bool is_integer = false; static constexpr bool is_modulo = false; static constexpr bool is_signed = false; static constexpr bool is_specialized = false; static constexpr bool tinyness_before = false; static constexpr bool traps = false; static constexpr float_round_style round_style = round_toward_zero; static constexpr int digits = 0; static constexpr int digits10 = 0; static constexpr int max_digits10 = 0; static constexpr int max_exponent = 0; static constexpr int max_exponent10 = 0; static constexpr int min_exponent = 0; static constexpr int min_exponent10 = 0; static constexpr int radix = 0; }; template <class _Ty> class numeric_limits : public _Num_base { public: [[nodiscard]] static constexpr _Ty(min)() noexcept { return _Ty(); } [[nodiscard]] static constexpr _Ty(max)() noexcept { return _Ty(); } [[nodiscard]] static constexpr _Ty lowest() noexcept { return _Ty(); } [[nodiscard]] static constexpr _Ty epsilon() noexcept { return _Ty(); } [[nodiscard]] static constexpr _Ty round_error() noexcept { return _Ty(); } [[nodiscard]] static constexpr _Ty denorm_min() noexcept { return _Ty(); } [[nodiscard]] static constexpr _Ty infinity() noexcept { return _Ty(); } [[nodiscard]] static constexpr _Ty quiet_NaN() noexcept { return _Ty(); } [[nodiscard]] static constexpr _Ty signaling_NaN() noexcept { return _Ty(); } }; template <class _Ty> class numeric_limits<const _Ty> : public numeric_limits<_Ty> {}; template <class _Ty> class numeric_limits<volatile _Ty> : public numeric_limits<_Ty> {}; template <class _Ty> class numeric_limits<const volatile _Ty> : public numeric_limits<_Ty> {}; struct _Num_int_base : _Num_base { static constexpr bool is_bounded = true; static constexpr bool is_exact = true; static constexpr bool is_integer = true; static constexpr bool is_specialized = true; static constexpr int radix = 2; }; struct _Num_float_base : _Num_base { static constexpr float_denorm_style has_denorm = denorm_present; static constexpr bool has_infinity = true; static constexpr bool has_quiet_NaN = true; static constexpr bool has_signaling_NaN = true; static constexpr bool is_bounded = true; static constexpr bool is_iec559 = true; static constexpr bool is_signed = true; static constexpr bool is_specialized = true; static constexpr float_round_style round_style = round_to_nearest; static constexpr int radix = 2; }; template <> class numeric_limits<bool> : public _Num_int_base { public: [[nodiscard]] static constexpr bool(min)() noexcept { return false; } [[nodiscard]] static constexpr bool(max)() noexcept { return true; } [[nodiscard]] static constexpr bool lowest() noexcept { return (min)(); } [[nodiscard]] static constexpr bool epsilon() noexcept { return 0; } [[nodiscard]] static constexpr bool round_error() noexcept { return 0; } [[nodiscard]] static constexpr bool denorm_min() noexcept { return 0; } [[nodiscard]] static constexpr bool infinity() noexcept { return 0; } [[nodiscard]] static constexpr bool quiet_NaN() noexcept { return 0; } [[nodiscard]] static constexpr bool signaling_NaN() noexcept { return 0; } static constexpr int digits = 1; }; template <> class numeric_limits<char> : public _Num_int_base { public: [[nodiscard]] static constexpr char(min)() noexcept { return (-128); } [[nodiscard]] static constexpr char(max)() noexcept { return 127; } [[nodiscard]] static constexpr char lowest() noexcept { return (min)(); } [[nodiscard]] static constexpr char epsilon() noexcept { return 0; } [[nodiscard]] static constexpr char round_error() noexcept { return 0; } [[nodiscard]] static constexpr char denorm_min() noexcept { return 0; } [[nodiscard]] static constexpr char infinity() noexcept { return 0; } [[nodiscard]] static constexpr char quiet_NaN() noexcept { return 0; } [[nodiscard]] static constexpr char signaling_NaN() noexcept { return 0; } static constexpr bool is_signed = (-128) != 0; static constexpr bool is_modulo = (-128) == 0; static constexpr int digits = 8 - ((-128) != 0); static constexpr int digits10 = 2; }; template <> class numeric_limits<signed char> : public _Num_int_base { public: [[nodiscard]] static constexpr signed char(min)() noexcept { return (-128); } [[nodiscard]] static constexpr signed char(max)() noexcept { return 127; } [[nodiscard]] static constexpr signed char lowest() noexcept { return (min)(); } [[nodiscard]] static constexpr signed char epsilon() noexcept { return 0; } [[nodiscard]] static constexpr signed char round_error() noexcept { return 0; } [[nodiscard]] static constexpr signed char denorm_min() noexcept { return 0; } [[nodiscard]] static constexpr signed char infinity() noexcept { return 0; } [[nodiscard]] static constexpr signed char quiet_NaN() noexcept { return 0; } [[nodiscard]] static constexpr signed char signaling_NaN() noexcept { return 0; } static constexpr bool is_signed = true; static constexpr int digits = 7; static constexpr int digits10 = 2; }; template <> class numeric_limits<unsigned char> : public _Num_int_base { public: [[nodiscard]] static constexpr unsigned char(min)() noexcept { return 0; } [[nodiscard]] static constexpr unsigned char(max)() noexcept { return 0xff; } [[nodiscard]] static constexpr unsigned char lowest() noexcept { return (min)(); } [[nodiscard]] static constexpr unsigned char epsilon() noexcept { return 0; } [[nodiscard]] static constexpr unsigned char round_error() noexcept { return 0; } [[nodiscard]] static constexpr unsigned char denorm_min() noexcept { return 0; } [[nodiscard]] static constexpr unsigned char infinity() noexcept { return 0; } [[nodiscard]] static constexpr unsigned char quiet_NaN() noexcept { return 0; } [[nodiscard]] static constexpr unsigned char signaling_NaN() noexcept { return 0; } static constexpr bool is_modulo = true; static constexpr int digits = 8; static constexpr int digits10 = 2; }; template <> class numeric_limits<char8_t> : public _Num_int_base { public: [[nodiscard]] static constexpr char8_t(min)() noexcept { return 0; } [[nodiscard]] static constexpr char8_t(max)() noexcept { return 0xff; } [[nodiscard]] static constexpr char8_t lowest() noexcept { return 0; } [[nodiscard]] static constexpr char8_t epsilon() noexcept { return 0; } [[nodiscard]] static constexpr char8_t round_error() noexcept { return 0; } [[nodiscard]] static constexpr char8_t denorm_min() noexcept { return 0; } [[nodiscard]] static constexpr char8_t infinity() noexcept { return 0; } [[nodiscard]] static constexpr char8_t quiet_NaN() noexcept { return 0; } [[nodiscard]] static constexpr char8_t signaling_NaN() noexcept { return 0; } static constexpr bool is_modulo = true; static constexpr int digits = 8; static constexpr int digits10 = 2; }; template <> class numeric_limits<char16_t> : public _Num_int_base { public: [[nodiscard]] static constexpr char16_t(min)() noexcept { return 0; } [[nodiscard]] static constexpr char16_t(max)() noexcept { return 0xffff; } [[nodiscard]] static constexpr char16_t lowest() noexcept { return (min)(); } [[nodiscard]] static constexpr char16_t epsilon() noexcept { return 0; } [[nodiscard]] static constexpr char16_t round_error() noexcept { return 0; } [[nodiscard]] static constexpr char16_t denorm_min() noexcept { return 0; } [[nodiscard]] static constexpr char16_t infinity() noexcept { return 0; } [[nodiscard]] static constexpr char16_t quiet_NaN() noexcept { return 0; } [[nodiscard]] static constexpr char16_t signaling_NaN() noexcept { return 0; } static constexpr bool is_modulo = true; static constexpr int digits = 16; static constexpr int digits10 = 4; }; template <> class numeric_limits<char32_t> : public _Num_int_base { public: [[nodiscard]] static constexpr char32_t(min)() noexcept { return 0; } [[nodiscard]] static constexpr char32_t(max)() noexcept { return 0xffffffff; } [[nodiscard]] static constexpr char32_t lowest() noexcept { return (min)(); } [[nodiscard]] static constexpr char32_t epsilon() noexcept { return 0; } [[nodiscard]] static constexpr char32_t round_error() noexcept { return 0; } [[nodiscard]] static constexpr char32_t denorm_min() noexcept { return 0; } [[nodiscard]] static constexpr char32_t infinity() noexcept { return 0; } [[nodiscard]] static constexpr char32_t quiet_NaN() noexcept { return 0; } [[nodiscard]] static constexpr char32_t signaling_NaN() noexcept { return 0; } static constexpr bool is_modulo = true; static constexpr int digits = 32; static constexpr int digits10 = 9; }; template <> class numeric_limits<wchar_t> : public _Num_int_base { public: [[nodiscard]] static constexpr wchar_t(min)() noexcept { return 0x0000; } [[nodiscard]] static constexpr wchar_t(max)() noexcept { return 0xffff; } [[nodiscard]] static constexpr wchar_t lowest() noexcept { return (min)(); } [[nodiscard]] static constexpr wchar_t epsilon() noexcept { return 0; } [[nodiscard]] static constexpr wchar_t round_error() noexcept { return 0; } [[nodiscard]] static constexpr wchar_t denorm_min() noexcept { return 0; } [[nodiscard]] static constexpr wchar_t infinity() noexcept { return 0; } [[nodiscard]] static constexpr wchar_t quiet_NaN() noexcept { return 0; } [[nodiscard]] static constexpr wchar_t signaling_NaN() noexcept { return 0; } static constexpr bool is_modulo = true; static constexpr int digits = 16; static constexpr int digits10 = 4; }; template <> class numeric_limits<short> : public _Num_int_base { public: [[nodiscard]] static constexpr short(min)() noexcept { return (-32768); } [[nodiscard]] static constexpr short(max)() noexcept { return 32767; } [[nodiscard]] static constexpr short lowest() noexcept { return (min)(); } [[nodiscard]] static constexpr short epsilon() noexcept { return 0; } [[nodiscard]] static constexpr short round_error() noexcept { return 0; } [[nodiscard]] static constexpr short denorm_min() noexcept { return 0; } [[nodiscard]] static constexpr short infinity() noexcept { return 0; } [[nodiscard]] static constexpr short quiet_NaN() noexcept { return 0; } [[nodiscard]] static constexpr short signaling_NaN() noexcept { return 0; } static constexpr bool is_signed = true; static constexpr int digits = 15; static constexpr int digits10 = 4; }; template <> class numeric_limits<int> : public _Num_int_base { public: [[nodiscard]] static constexpr int(min)() noexcept { return (-2147483647 - 1); } [[nodiscard]] static constexpr int(max)() noexcept { return 2147483647; } [[nodiscard]] static constexpr int lowest() noexcept { return (min)(); } [[nodiscard]] static constexpr int epsilon() noexcept { return 0; } [[nodiscard]] static constexpr int round_error() noexcept { return 0; } [[nodiscard]] static constexpr int denorm_min() noexcept { return 0; } [[nodiscard]] static constexpr int infinity() noexcept { return 0; } [[nodiscard]] static constexpr int quiet_NaN() noexcept { return 0; } [[nodiscard]] static constexpr int signaling_NaN() noexcept { return 0; } static constexpr bool is_signed = true; static constexpr int digits = 31; static constexpr int digits10 = 9; }; template <> class numeric_limits<long> : public _Num_int_base { public: [[nodiscard]] static constexpr long(min)() noexcept { return (-2147483647L - 1); } [[nodiscard]] static constexpr long(max)() noexcept { return 2147483647L; } [[nodiscard]] static constexpr long lowest() noexcept { return (min)(); } [[nodiscard]] static constexpr long epsilon() noexcept { return 0; } [[nodiscard]] static constexpr long round_error() noexcept { return 0; } [[nodiscard]] static constexpr long denorm_min() noexcept { return 0; } [[nodiscard]] static constexpr long infinity() noexcept { return 0; } [[nodiscard]] static constexpr long quiet_NaN() noexcept { return 0; } [[nodiscard]] static constexpr long signaling_NaN() noexcept { return 0; } static_assert(sizeof(int) == sizeof(long), "LLP64 assumption"); static constexpr bool is_signed = true; static constexpr int digits = 31; static constexpr int digits10 = 9; }; template <> class numeric_limits<long long> : public _Num_int_base { public: [[nodiscard]] static constexpr long long(min)() noexcept { return (-9223372036854775807i64 - 1); } [[nodiscard]] static constexpr long long(max)() noexcept { return 9223372036854775807i64; } [[nodiscard]] static constexpr long long lowest() noexcept { return (min)(); } [[nodiscard]] static constexpr long long epsilon() noexcept { return 0; } [[nodiscard]] static constexpr long long round_error() noexcept { return 0; } [[nodiscard]] static constexpr long long denorm_min() noexcept { return 0; } [[nodiscard]] static constexpr long long infinity() noexcept { return 0; } [[nodiscard]] static constexpr long long quiet_NaN() noexcept { return 0; } [[nodiscard]] static constexpr long long signaling_NaN() noexcept { return 0; } static constexpr bool is_signed = true; static constexpr int digits = 63; static constexpr int digits10 = 18; }; template <> class numeric_limits<unsigned short> : public _Num_int_base { public: [[nodiscard]] static constexpr unsigned short(min)() noexcept { return 0; } [[nodiscard]] static constexpr unsigned short(max)() noexcept { return 0xffff; } [[nodiscard]] static constexpr unsigned short lowest() noexcept { return (min)(); } [[nodiscard]] static constexpr unsigned short epsilon() noexcept { return 0; } [[nodiscard]] static constexpr unsigned short round_error() noexcept { return 0; } [[nodiscard]] static constexpr unsigned short denorm_min() noexcept { return 0; } [[nodiscard]] static constexpr unsigned short infinity() noexcept { return 0; } [[nodiscard]] static constexpr unsigned short quiet_NaN() noexcept { return 0; } [[nodiscard]] static constexpr unsigned short signaling_NaN() noexcept { return 0; } static constexpr bool is_modulo = true; static constexpr int digits = 16; static constexpr int digits10 = 4; }; template <> class numeric_limits<unsigned int> : public _Num_int_base { public: [[nodiscard]] static constexpr unsigned int(min)() noexcept { return 0; } [[nodiscard]] static constexpr unsigned int(max)() noexcept { return 0xffffffff; } [[nodiscard]] static constexpr unsigned int lowest() noexcept { return (min)(); } [[nodiscard]] static constexpr unsigned int epsilon() noexcept { return 0; } [[nodiscard]] static constexpr unsigned int round_error() noexcept { return 0; } [[nodiscard]] static constexpr unsigned int denorm_min() noexcept { return 0; } [[nodiscard]] static constexpr unsigned int infinity() noexcept { return 0; } [[nodiscard]] static constexpr unsigned int quiet_NaN() noexcept { return 0; } [[nodiscard]] static constexpr unsigned int signaling_NaN() noexcept { return 0; } static constexpr bool is_modulo = true; static constexpr int digits = 32; static constexpr int digits10 = 9; }; template <> class numeric_limits<unsigned long> : public _Num_int_base { public: [[nodiscard]] static constexpr unsigned long(min)() noexcept { return 0; } [[nodiscard]] static constexpr unsigned long(max)() noexcept { return 0xffffffffUL; } [[nodiscard]] static constexpr unsigned long lowest() noexcept { return (min)(); } [[nodiscard]] static constexpr unsigned long epsilon() noexcept { return 0; } [[nodiscard]] static constexpr unsigned long round_error() noexcept { return 0; } [[nodiscard]] static constexpr unsigned long denorm_min() noexcept { return 0; } [[nodiscard]] static constexpr unsigned long infinity() noexcept { return 0; } [[nodiscard]] static constexpr unsigned long quiet_NaN() noexcept { return 0; } [[nodiscard]] static constexpr unsigned long signaling_NaN() noexcept { return 0; } static_assert(sizeof(unsigned int) == sizeof(unsigned long), "LLP64 assumption"); static constexpr bool is_modulo = true; static constexpr int digits = 32; static constexpr int digits10 = 9; }; template <> class numeric_limits<unsigned long long> : public _Num_int_base { public: [[nodiscard]] static constexpr unsigned long long(min)() noexcept { return 0; } [[nodiscard]] static constexpr unsigned long long(max)() noexcept { return 0xffffffffffffffffui64; } [[nodiscard]] static constexpr unsigned long long lowest() noexcept { return (min)(); } [[nodiscard]] static constexpr unsigned long long epsilon() noexcept { return 0; } [[nodiscard]] static constexpr unsigned long long round_error() noexcept { return 0; } [[nodiscard]] static constexpr unsigned long long denorm_min() noexcept { return 0; } [[nodiscard]] static constexpr unsigned long long infinity() noexcept { return 0; } [[nodiscard]] static constexpr unsigned long long quiet_NaN() noexcept { return 0; } [[nodiscard]] static constexpr unsigned long long signaling_NaN() noexcept { return 0; } static constexpr bool is_modulo = true; static constexpr int digits = 64; static constexpr int digits10 = 19; }; template <> class numeric_limits<float> : public _Num_float_base { public: [[nodiscard]] static constexpr float(min)() noexcept { return 1.175494351e-38F; } [[nodiscard]] static constexpr float(max)() noexcept { return 3.402823466e+38F; } [[nodiscard]] static constexpr float lowest() noexcept { return -(max)(); } [[nodiscard]] static constexpr float epsilon() noexcept { return 1.192092896e-07F; } [[nodiscard]] static constexpr float round_error() noexcept { return 0.5F; } [[nodiscard]] static constexpr float denorm_min() noexcept { return 1.401298464e-45F; } [[nodiscard]] static constexpr float infinity() noexcept { return __builtin_huge_valf(); } [[nodiscard]] static constexpr float quiet_NaN() noexcept { return __builtin_nanf("0"); } [[nodiscard]] static constexpr float signaling_NaN() noexcept { return __builtin_nansf("1"); } static constexpr int digits = 24; static constexpr int digits10 = 6; static constexpr int max_digits10 = 9; static constexpr int max_exponent = 128; static constexpr int max_exponent10 = 38; static constexpr int min_exponent = (-125); static constexpr int min_exponent10 = (-37); }; template <> class numeric_limits<double> : public _Num_float_base { public: [[nodiscard]] static constexpr double(min)() noexcept { return 2.2250738585072014e-308; } [[nodiscard]] static constexpr double(max)() noexcept { return 1.7976931348623158e+308; } [[nodiscard]] static constexpr double lowest() noexcept { return -(max)(); } [[nodiscard]] static constexpr double epsilon() noexcept { return 2.2204460492503131e-016; } [[nodiscard]] static constexpr double round_error() noexcept { return 0.5; } [[nodiscard]] static constexpr double denorm_min() noexcept { return 4.9406564584124654e-324; } [[nodiscard]] static constexpr double infinity() noexcept { return __builtin_huge_val(); } [[nodiscard]] static constexpr double quiet_NaN() noexcept { return __builtin_nan("0"); } [[nodiscard]] static constexpr double signaling_NaN() noexcept { return __builtin_nans("1"); } static constexpr int digits = 53; static constexpr int digits10 = 15; static constexpr int max_digits10 = 17; static constexpr int max_exponent = 1024; static constexpr int max_exponent10 = 308; static constexpr int min_exponent = (-1021); static constexpr int min_exponent10 = (-307); }; template <> class numeric_limits<long double> : public _Num_float_base { public: [[nodiscard]] static constexpr long double(min)() noexcept { return 2.2250738585072014e-308; } [[nodiscard]] static constexpr long double(max)() noexcept { return 1.7976931348623158e+308; } [[nodiscard]] static constexpr long double lowest() noexcept { return -(max)(); } [[nodiscard]] static constexpr long double epsilon() noexcept { return 2.2204460492503131e-016; } [[nodiscard]] static constexpr long double round_error() noexcept { return 0.5L; } [[nodiscard]] static constexpr long double denorm_min() noexcept { return 4.9406564584124654e-324; } [[nodiscard]] static constexpr long double infinity() noexcept { return __builtin_huge_val(); } [[nodiscard]] static constexpr long double quiet_NaN() noexcept { return __builtin_nan("0"); } [[nodiscard]] static constexpr long double signaling_NaN() noexcept { return __builtin_nans("1"); } static constexpr int digits = 53; static constexpr int digits10 = 15; static constexpr int max_digits10 = 17; static constexpr int max_exponent = 1024; static constexpr int max_exponent10 = 308; static constexpr int min_exponent = (-1021); static constexpr int min_exponent10 = (-307); }; template <class _Ty> [[nodiscard]] constexpr int _Countl_zero_fallback(_Ty _Val) noexcept { _Ty _Yy = 0; unsigned int _Nn = numeric_limits<_Ty>::digits; unsigned int _Cc = numeric_limits<_Ty>::digits / 2; do { _Yy = static_cast<_Ty>(_Val >> _Cc); if (_Yy != 0) { _Nn -= _Cc; _Val = _Yy; } _Cc >>= 1; } while (_Cc != 0); return static_cast<int>(_Nn) - static_cast<int>(_Val); } template <class _Ty> [[nodiscard]] constexpr int _Countr_zero_fallback(const _Ty _Val) noexcept { constexpr int _Digits = std::numeric_limits<_Ty>::digits; return _Digits - _Countl_zero_fallback(static_cast<_Ty>(static_cast<_Ty>(~_Val) & static_cast<_Ty>(_Val - 1))); } extern "C" { extern int __isa_available; } template <class _Ty> [[nodiscard]] int _Checked_x86_x64_countr_zero(const _Ty _Val) noexcept { constexpr int _Digits = numeric_limits<_Ty>::digits; constexpr _Ty _Max = (numeric_limits<_Ty>::max)(); if constexpr (_Digits > 16) { const bool _Definitely_have_tzcnt = __isa_available >= __ISA_AVAILABLE_AVX2; if (!_Definitely_have_tzcnt && _Val == 0) { return _Digits; } } if constexpr (_Digits <= 32) { return static_cast<int>(_tzcnt_u32(static_cast<unsigned int>(~_Max | _Val))); } else { return static_cast<int>(_tzcnt_u64(_Val)); } } template <class _Ty> constexpr bool _Is_standard_unsigned_integer = _Is_any_of_v<remove_cv_t<_Ty>, unsigned char, unsigned short, unsigned int, unsigned long, unsigned long long>; template <class _Ty, enable_if_t<_Is_standard_unsigned_integer<_Ty>, int> = 0> [[nodiscard]] constexpr int _Countr_zero(const _Ty _Val) noexcept { if (!::std:: is_constant_evaluated()) { return _Checked_x86_x64_countr_zero(_Val); } return _Countr_zero_fallback(_Val); } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { template <class _To, class _From, enable_if_t<conjunction_v<bool_constant<sizeof(_To) == sizeof(_From)>, is_trivially_copyable<_To>, is_trivially_copyable<_From>>, int> = 0> [[nodiscard]] constexpr _To bit_cast(const _From& _Val) noexcept { return __builtin_bit_cast(_To, _Val); } template <class _Ty, enable_if_t<_Is_standard_unsigned_integer<_Ty>, int> = 0> [[nodiscard]] constexpr int countl_zero(_Ty _Val) noexcept; template <class _Ty, enable_if_t<_Is_standard_unsigned_integer<_Ty>, int> = 0> [[nodiscard]] constexpr bool has_single_bit(const _Ty _Val) noexcept { return _Val != 0 && (_Val & (_Val - 1)) == 0; } template <class _Ty, enable_if_t<_Is_standard_unsigned_integer<_Ty>, int> = 0> [[nodiscard]] constexpr _Ty bit_ceil(const _Ty _Val) noexcept { if (_Val == 0) { return 1; } return static_cast<_Ty>(_Ty{1} << (numeric_limits<_Ty>::digits - ::std:: countl_zero(static_cast<_Ty>(_Val - 1)))); } template <class _Ty, enable_if_t<_Is_standard_unsigned_integer<_Ty>, int> = 0> [[nodiscard]] constexpr _Ty bit_floor(const _Ty _Val) noexcept { if (_Val == 0) { return 0; } return static_cast<_Ty>(_Ty{1} << (numeric_limits<_Ty>::digits - 1 - ::std:: countl_zero(_Val))); } template <class _Ty, enable_if_t<_Is_standard_unsigned_integer<_Ty>, int> = 0> [[nodiscard]] constexpr _Ty bit_width(const _Ty _Val) noexcept { return static_cast<_Ty>(numeric_limits<_Ty>::digits - ::std:: countl_zero(_Val)); } template <class _Ty, enable_if_t<_Is_standard_unsigned_integer<_Ty>, int> = 0> [[nodiscard]] constexpr _Ty rotr(_Ty _Val, int _Rotation) noexcept; template <class _Ty, enable_if_t<_Is_standard_unsigned_integer<_Ty>, int> = 0> [[nodiscard]] constexpr _Ty rotl(const _Ty _Val, const int _Rotation) noexcept { constexpr auto _Digits = numeric_limits<_Ty>::digits; const auto _Remainder = _Rotation % _Digits; if (_Remainder > 0) { return static_cast<_Ty>( static_cast<_Ty>(_Val << _Remainder) | static_cast<_Ty>(_Val >> (_Digits - _Remainder))); } else if (_Remainder == 0) { return _Val; } else { return ::std:: rotr(_Val, -_Remainder); } } template <class _Ty, enable_if_t<_Is_standard_unsigned_integer<_Ty>, int> _Enabled> [[nodiscard]] constexpr _Ty rotr(const _Ty _Val, const int _Rotation) noexcept { constexpr auto _Digits = numeric_limits<_Ty>::digits; const auto _Remainder = _Rotation % _Digits; if (_Remainder > 0) { return static_cast<_Ty>( static_cast<_Ty>(_Val >> _Remainder) | static_cast<_Ty>(_Val << (_Digits - _Remainder))); } else if (_Remainder == 0) { return _Val; } else { return ::std:: rotl(_Val, -_Remainder); } } template <class _Ty> [[nodiscard]] constexpr int _Popcount_fallback(_Ty _Val) noexcept { constexpr int _Digits = numeric_limits<_Ty>::digits; _Val = static_cast<_Ty>(_Val - ((_Val >> 1) & static_cast<_Ty>(0x5555'5555'5555'5555ull))); _Val = static_cast<_Ty>((_Val & static_cast<_Ty>(0x3333'3333'3333'3333ull)) + ((_Val >> 2) & static_cast<_Ty>(0x3333'3333'3333'3333ull))); _Val = static_cast<_Ty>((_Val + (_Val >> 4)) & static_cast<_Ty>(0x0F0F'0F0F'0F0F'0F0Full)); for (int _Shift_digits = 8; _Shift_digits < _Digits; _Shift_digits <<= 1) { _Val = static_cast<_Ty>(_Val + static_cast<_Ty>(_Val >> _Shift_digits)); } return static_cast<int>(_Val & static_cast<_Ty>(_Digits + _Digits - 1)); } extern "C" { extern int __isa_available; } template <class _Ty> [[nodiscard]] int _Countl_zero_lzcnt(const _Ty _Val) noexcept { constexpr int _Digits = numeric_limits<_Ty>::digits; if constexpr (_Digits <= 16) { return static_cast<int>(__lzcnt16(_Val) - (16 - _Digits)); } else if constexpr (_Digits == 32) { return static_cast<int>(__lzcnt(_Val)); } else { return static_cast<int>(__lzcnt64(_Val)); } } template <class _Ty> [[nodiscard]] int _Countl_zero_bsr(const _Ty _Val) noexcept { constexpr int _Digits = numeric_limits<_Ty>::digits; unsigned long _Result; if constexpr (_Digits <= 32) { if (!_BitScanReverse(&_Result, _Val)) { return _Digits; } } else { if (!_BitScanReverse64(&_Result, _Val)) { return _Digits; } } return static_cast<int>(_Digits - 1 - _Result); } template <class _Ty> [[nodiscard]] int _Checked_x86_x64_countl_zero(const _Ty _Val) noexcept { const bool _Definitely_have_lzcnt = __isa_available >= __ISA_AVAILABLE_AVX2; if (_Definitely_have_lzcnt) { return _Countl_zero_lzcnt(_Val); } else { return _Countl_zero_bsr(_Val); } } template <class _Ty> [[nodiscard]] int _Checked_x86_x64_popcount(const _Ty _Val) noexcept { constexpr int _Digits = numeric_limits<_Ty>::digits; const bool _Definitely_have_popcnt = __isa_available >= __ISA_AVAILABLE_SSE42; if (!_Definitely_have_popcnt) { return _Popcount_fallback(_Val); } if constexpr (_Digits <= 16) { return static_cast<int>(__popcnt16(_Val)); } else if constexpr (_Digits == 32) { return static_cast<int>(__popcnt(_Val)); } else { return static_cast<int>(__popcnt64(_Val)); } } template <class _Ty, enable_if_t<_Is_standard_unsigned_integer<_Ty>, int> _Enabled> [[nodiscard]] constexpr int countl_zero(const _Ty _Val) noexcept { if (!::std:: is_constant_evaluated()) { return _Checked_x86_x64_countl_zero(_Val); } return _Countl_zero_fallback(_Val); } template <class _Ty, enable_if_t<_Is_standard_unsigned_integer<_Ty>, int> = 0> [[nodiscard]] constexpr int countl_one(const _Ty _Val) noexcept { return ::std:: countl_zero(static_cast<_Ty>(~_Val)); } template <class _Ty, enable_if_t<_Is_standard_unsigned_integer<_Ty>, int> = 0> [[nodiscard]] constexpr int countr_zero(const _Ty _Val) noexcept { return _Countr_zero(_Val); } template <class _Ty, enable_if_t<_Is_standard_unsigned_integer<_Ty>, int> _Enabled = 0> [[nodiscard]] constexpr int countr_one(const _Ty _Val) noexcept { return _Countr_zero(static_cast<_Ty>(~_Val)); } template <class _Ty, enable_if_t<_Is_standard_unsigned_integer<_Ty>, int> _Enabled = 0> [[nodiscard]] constexpr int popcount(const _Ty _Val) noexcept { if (!::std:: is_constant_evaluated()) { return _Checked_x86_x64_popcount(_Val); } return _Popcount_fallback(_Val); } enum class endian { little = 0, big = 1, native = little }; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { template <class _Ty1, class _Ty2> concept _Same_impl = is_same_v<_Ty1, _Ty2>; template <class _Ty1, class _Ty2> concept same_as = _Same_impl<_Ty1, _Ty2> && _Same_impl<_Ty2, _Ty1>; template <class _Derived, class _Base> concept derived_from = __is_base_of(_Base, _Derived) && __is_convertible_to(const volatile _Derived*, const volatile _Base*); template <class _From, class _To> concept convertible_to = __is_convertible_to(_From, _To) && requires(add_rvalue_reference_t<_From> (&_Fn)()) { static_cast<_To>(_Fn()); }; template <class _From, class _To> concept _Implicitly_convertible_to = is_convertible_v<_From, _To>; template <class _Ty1, class _Ty2> concept common_reference_with = requires { typename common_reference_t<_Ty1, _Ty2>; typename common_reference_t<_Ty2, _Ty1>; } && same_as<common_reference_t<_Ty1, _Ty2>, common_reference_t<_Ty2, _Ty1>> && convertible_to<_Ty1, common_reference_t<_Ty1, _Ty2>> && convertible_to<_Ty2, common_reference_t<_Ty1, _Ty2>>; template <class _Ty1, class _Ty2> concept common_with = requires { typename common_type_t<_Ty1, _Ty2>; typename common_type_t<_Ty2, _Ty1>; requires same_as<common_type_t<_Ty1, _Ty2>, common_type_t<_Ty2, _Ty1>>; static_cast<common_type_t<_Ty1, _Ty2>>(::std:: declval<_Ty1>()); static_cast<common_type_t<_Ty1, _Ty2>>(::std:: declval<_Ty2>()); } && common_reference_with<add_lvalue_reference_t<const _Ty1>, add_lvalue_reference_t<const _Ty2>> && common_reference_with<add_lvalue_reference_t<common_type_t<_Ty1, _Ty2>>, common_reference_t<add_lvalue_reference_t<const _Ty1>, add_lvalue_reference_t<const _Ty2>>>; template <class _Ty> concept integral = is_integral_v<_Ty>; template <class _Ty> concept signed_integral = integral<_Ty> && static_cast<_Ty>(-1) < static_cast<_Ty>(0); template <class _Ty> concept unsigned_integral = integral<_Ty> && !signed_integral<_Ty>; template <class _Ty> concept floating_point = is_floating_point_v<_Ty>; template <class _LTy, class _RTy> concept assignable_from = is_lvalue_reference_v<_LTy> && common_reference_with<const remove_reference_t<_LTy>&, const remove_reference_t<_RTy>&> && requires(_LTy _Left, _RTy&& _Right) { { _Left = static_cast<_RTy&&>(_Right) } -> same_as<_LTy>; }; template <class _Ty> concept destructible = __is_nothrow_destructible(_Ty); template <class _Ty, class... _ArgTys> concept constructible_from = destructible<_Ty> && __is_constructible(_Ty, _ArgTys...); template <class _Ty> concept default_initializable = constructible_from<_Ty> && requires { _Ty{}; ::new (static_cast<void*>(nullptr)) _Ty; }; template <class _Ty> concept move_constructible = constructible_from<_Ty, _Ty> && convertible_to<_Ty, _Ty>; template <class _Ty> concept _Has_class_or_enum_type = __is_class(remove_reference_t<_Ty>) || __is_enum(remove_reference_t<_Ty>) || __is_union(remove_reference_t<_Ty>); namespace ranges { namespace _Swap { template <class _Ty> void swap(_Ty&, _Ty&) = delete; template <class _Ty1, class _Ty2> concept _Use_ADL_swap = (_Has_class_or_enum_type<_Ty1> || _Has_class_or_enum_type<_Ty2>) && requires(_Ty1&& __t, _Ty2&& __u) { swap(static_cast<_Ty1&&>(__t), static_cast<_Ty2&&>(__u)); }; struct _Cpo { template <class _Ty1, class _Ty2> requires _Use_ADL_swap<_Ty1, _Ty2> constexpr void operator()(_Ty1&& __t, _Ty2&& __u) const noexcept(noexcept(swap(static_cast<_Ty1&&>(__t), static_cast<_Ty2&&>(__u)))) { swap(static_cast<_Ty1&&>(__t), static_cast<_Ty2&&>(__u)); } template <class _Ty> requires (!_Use_ADL_swap<_Ty&, _Ty&> && move_constructible<_Ty> && assignable_from<_Ty&, _Ty>) constexpr void operator()(_Ty& __x, _Ty& __y) const noexcept(is_nothrow_move_constructible_v<_Ty> && is_nothrow_move_assignable_v<_Ty>) { _Ty __tmp(static_cast<_Ty&&>(__x)); __x = static_cast<_Ty&&>(__y); __y = static_cast<_Ty&&>(__tmp); } template <class _Ty1, class _Ty2, size_t _Size> constexpr void operator()(_Ty1 (&__t)[_Size], _Ty2 (&__u)[_Size]) const noexcept(noexcept((*this)(__t[0], __u[0]))) requires requires { (*this)(__t[0], __u[0]); } { for (size_t __i = 0; __i < _Size; ++__i) { (*this)(__t[__i], __u[__i]); } } }; } inline namespace _Cpos { inline constexpr _Swap::_Cpo swap; } } template <class _Ty> concept swappable = requires(_Ty& __x, _Ty& __y) { ::std::ranges:: swap(__x, __y); }; template <class _Ty1, class _Ty2> concept swappable_with = common_reference_with<_Ty1, _Ty2> && requires(_Ty1&& __t, _Ty2&& __u) { ::std::ranges:: swap(static_cast<_Ty1&&>(__t), static_cast<_Ty1&&>(__t)); ::std::ranges:: swap(static_cast<_Ty2&&>(__u), static_cast<_Ty2&&>(__u)); ::std::ranges:: swap(static_cast<_Ty1&&>(__t), static_cast<_Ty2&&>(__u)); ::std::ranges:: swap(static_cast<_Ty2&&>(__u), static_cast<_Ty1&&>(__t)); }; template <class _Ty> concept copy_constructible = move_constructible<_Ty> && constructible_from<_Ty, _Ty&> && convertible_to<_Ty&, _Ty> && constructible_from<_Ty, const _Ty&> && convertible_to<const _Ty&, _Ty> && constructible_from<_Ty, const _Ty> && convertible_to<const _Ty, _Ty>; template <class _Ty> concept _Boolean_testable_impl = convertible_to<_Ty, bool>; template <class _Ty> concept _Boolean_testable = _Boolean_testable_impl<_Ty> && requires(_Ty&& __t) { { !static_cast<_Ty&&>(__t) } -> _Boolean_testable_impl; }; template <class _Ty1, class _Ty2> concept _Half_equality_comparable = requires(const remove_reference_t<_Ty1>& __x, const remove_reference_t<_Ty2>& __y) { { __x == __y } -> _Boolean_testable; { __x != __y } -> _Boolean_testable; }; template <class _Ty1, class _Ty2> concept _Weakly_equality_comparable_with = _Half_equality_comparable<_Ty1, _Ty2> && _Half_equality_comparable<_Ty2, _Ty1>; template <class _Ty> concept equality_comparable = _Half_equality_comparable<_Ty, _Ty>; template <class _Ty1, class _Ty2> concept equality_comparable_with = equality_comparable<_Ty1> && equality_comparable<_Ty2> && common_reference_with<const remove_reference_t<_Ty1>&, const remove_reference_t<_Ty2>&> && equality_comparable<common_reference_t<const remove_reference_t<_Ty1>&, const remove_reference_t<_Ty2>&>> && _Weakly_equality_comparable_with<_Ty1, _Ty2>; template <class _Ty1, class _Ty2> concept _Half_ordered = requires(const remove_reference_t<_Ty1>& __t, const remove_reference_t<_Ty2>& __u) { { __t < __u } -> _Boolean_testable; { __t > __u } -> _Boolean_testable; { __t <= __u } -> _Boolean_testable; { __t >= __u } -> _Boolean_testable; }; template <class _Ty1, class _Ty2> concept _Partially_ordered_with = _Half_ordered<_Ty1, _Ty2> && _Half_ordered<_Ty2, _Ty1>; template <class _Ty> concept totally_ordered = equality_comparable<_Ty> && _Half_ordered<_Ty, _Ty>; template <class _Ty1, class _Ty2> concept totally_ordered_with = totally_ordered<_Ty1> && totally_ordered<_Ty2> && equality_comparable_with<_Ty1, _Ty2> && totally_ordered<common_reference_t<const remove_reference_t<_Ty1>&, const remove_reference_t<_Ty2>&>> && _Partially_ordered_with<_Ty1, _Ty2>; template <class _Ty> concept movable = is_object_v<_Ty> && move_constructible<_Ty> && assignable_from<_Ty&, _Ty> && swappable<_Ty>; template <class _Ty> concept copyable = copy_constructible<_Ty> && movable<_Ty> && assignable_from<_Ty&, _Ty&> && assignable_from<_Ty&, const _Ty&> && assignable_from<_Ty&, const _Ty>; template <class _Ty> concept semiregular = copyable<_Ty> && default_initializable<_Ty>; template <class _Ty> concept regular = semiregular<_Ty> && equality_comparable<_Ty>; template <class _FTy, class... _ArgTys> concept invocable = requires(_FTy&& _Fn, _ArgTys&&... _Args) { ::std:: invoke(static_cast<_FTy&&>(_Fn), static_cast<_ArgTys&&>(_Args)...); }; template <class _FTy, class... _ArgTys> concept regular_invocable = invocable<_FTy, _ArgTys...>; template <class _FTy, class... _ArgTys> concept predicate = regular_invocable<_FTy, _ArgTys...> && _Boolean_testable<invoke_result_t<_FTy, _ArgTys...>>; template <class _FTy, class _Ty1, class _Ty2> concept relation = predicate<_FTy, _Ty1, _Ty1> && predicate<_FTy, _Ty2, _Ty2> && predicate<_FTy, _Ty1, _Ty2> && predicate<_FTy, _Ty2, _Ty1>; template <class _FTy, class _Ty1, class _Ty2> concept equivalence_relation = relation<_FTy, _Ty1, _Ty2>; template <class _FTy, class _Ty1, class _Ty2> concept strict_weak_order = relation<_FTy, _Ty1, _Ty2>; template <class _Ty> struct _Choice_t { _Ty _Strategy = _Ty{}; bool _No_throw = false; }; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { using _Literal_zero = decltype(nullptr); using _Compare_t = signed char; enum class _Compare_eq : _Compare_t { equal = 0, equivalent = equal }; enum class _Compare_ord : _Compare_t { less = -1, greater = 1 }; enum class _Compare_ncmp : _Compare_t { unordered = -128 }; struct partial_ordering { static const partial_ordering less; static const partial_ordering equivalent; static const partial_ordering greater; static const partial_ordering unordered; [[nodiscard]] friend constexpr bool operator==(const partial_ordering _Val, _Literal_zero) noexcept { return _Val._Value == 0; } [[nodiscard]] friend constexpr bool operator==(partial_ordering, partial_ordering) noexcept = default; [[nodiscard]] friend constexpr bool operator<(const partial_ordering _Val, _Literal_zero) noexcept { return _Val._Value == static_cast<_Compare_t>(_Compare_ord::less); } [[nodiscard]] friend constexpr bool operator>(const partial_ordering _Val, _Literal_zero) noexcept { return _Val._Value > 0; } [[nodiscard]] friend constexpr bool operator<=(const partial_ordering _Val, _Literal_zero) noexcept { return static_cast<signed char>(0 - static_cast<unsigned int>(_Val._Value)) >= 0; } [[nodiscard]] friend constexpr bool operator>=(const partial_ordering _Val, _Literal_zero) noexcept { return _Val._Value >= 0; } [[nodiscard]] friend constexpr bool operator<(_Literal_zero, const partial_ordering _Val) noexcept { return _Val > 0; } [[nodiscard]] friend constexpr bool operator>(_Literal_zero, const partial_ordering _Val) noexcept { return _Val < 0; } [[nodiscard]] friend constexpr bool operator<=(_Literal_zero, const partial_ordering _Val) noexcept { return _Val >= 0; } [[nodiscard]] friend constexpr bool operator>=(_Literal_zero, const partial_ordering _Val) noexcept { return _Val <= 0; } [[nodiscard]] friend constexpr partial_ordering operator<=>(const partial_ordering _Val, _Literal_zero) noexcept { return _Val; } [[nodiscard]] friend constexpr partial_ordering operator<=>(_Literal_zero, const partial_ordering _Val) noexcept { return {static_cast<_Compare_t>(0 - static_cast<unsigned int>(_Val._Value))}; } _Compare_t _Value; }; inline constexpr partial_ordering partial_ordering::less{static_cast<_Compare_t>(_Compare_ord::less)}; inline constexpr partial_ordering partial_ordering::equivalent{static_cast<_Compare_t>(_Compare_eq::equivalent)}; inline constexpr partial_ordering partial_ordering::greater{static_cast<_Compare_t>(_Compare_ord::greater)}; inline constexpr partial_ordering partial_ordering::unordered{static_cast<_Compare_t>(_Compare_ncmp::unordered)}; struct weak_ordering { static const weak_ordering less; static const weak_ordering equivalent; static const weak_ordering greater; constexpr operator partial_ordering() const noexcept { return {static_cast<_Compare_t>(_Value)}; } [[nodiscard]] friend constexpr bool operator==(const weak_ordering _Val, _Literal_zero) noexcept { return _Val._Value == 0; } [[nodiscard]] friend constexpr bool operator==(weak_ordering, weak_ordering) noexcept = default; [[nodiscard]] friend constexpr bool operator<(const weak_ordering _Val, _Literal_zero) noexcept { return _Val._Value < 0; } [[nodiscard]] friend constexpr bool operator>(const weak_ordering _Val, _Literal_zero) noexcept { return _Val._Value > 0; } [[nodiscard]] friend constexpr bool operator<=(const weak_ordering _Val, _Literal_zero) noexcept { return _Val._Value <= 0; } [[nodiscard]] friend constexpr bool operator>=(const weak_ordering _Val, _Literal_zero) noexcept { return _Val._Value >= 0; } [[nodiscard]] friend constexpr bool operator<(_Literal_zero, const weak_ordering _Val) noexcept { return _Val > 0; } [[nodiscard]] friend constexpr bool operator>(_Literal_zero, const weak_ordering _Val) noexcept { return _Val < 0; } [[nodiscard]] friend constexpr bool operator<=(_Literal_zero, const weak_ordering _Val) noexcept { return _Val >= 0; } [[nodiscard]] friend constexpr bool operator>=(_Literal_zero, const weak_ordering _Val) noexcept { return _Val <= 0; } [[nodiscard]] friend constexpr weak_ordering operator<=>(const weak_ordering _Val, _Literal_zero) noexcept { return _Val; } [[nodiscard]] friend constexpr weak_ordering operator<=>(_Literal_zero, const weak_ordering _Val) noexcept { return {static_cast<_Compare_t>(-_Val._Value)}; } _Compare_t _Value; }; inline constexpr weak_ordering weak_ordering::less{static_cast<_Compare_t>(_Compare_ord::less)}; inline constexpr weak_ordering weak_ordering::equivalent{static_cast<_Compare_t>(_Compare_eq::equivalent)}; inline constexpr weak_ordering weak_ordering::greater{static_cast<_Compare_t>(_Compare_ord::greater)}; struct strong_ordering { static const strong_ordering less; static const strong_ordering equal; static const strong_ordering equivalent; static const strong_ordering greater; constexpr operator partial_ordering() const noexcept { return {static_cast<_Compare_t>(_Value)}; } constexpr operator weak_ordering() const noexcept { return {static_cast<_Compare_t>(_Value)}; } [[nodiscard]] friend constexpr bool operator==(const strong_ordering _Val, _Literal_zero) noexcept { return _Val._Value == 0; } [[nodiscard]] friend constexpr bool operator==(strong_ordering, strong_ordering) noexcept = default; [[nodiscard]] friend constexpr bool operator<(const strong_ordering _Val, _Literal_zero) noexcept { return _Val._Value < 0; } [[nodiscard]] friend constexpr bool operator>(const strong_ordering _Val, _Literal_zero) noexcept { return _Val._Value > 0; } [[nodiscard]] friend constexpr bool operator<=(const strong_ordering _Val, _Literal_zero) noexcept { return _Val._Value <= 0; } [[nodiscard]] friend constexpr bool operator>=(const strong_ordering _Val, _Literal_zero) noexcept { return _Val._Value >= 0; } [[nodiscard]] friend constexpr bool operator<(_Literal_zero, const strong_ordering _Val) noexcept { return _Val > 0; } [[nodiscard]] friend constexpr bool operator>(_Literal_zero, const strong_ordering _Val) noexcept { return _Val < 0; } [[nodiscard]] friend constexpr bool operator<=(_Literal_zero, const strong_ordering _Val) noexcept { return _Val >= 0; } [[nodiscard]] friend constexpr bool operator>=(_Literal_zero, const strong_ordering _Val) noexcept { return _Val <= 0; } [[nodiscard]] friend constexpr strong_ordering operator<=>(const strong_ordering _Val, _Literal_zero) noexcept { return _Val; } [[nodiscard]] friend constexpr strong_ordering operator<=>(_Literal_zero, const strong_ordering _Val) noexcept { return {static_cast<_Compare_t>(-_Val._Value)}; } _Compare_t _Value; }; inline constexpr strong_ordering strong_ordering::less{static_cast<_Compare_t>(_Compare_ord::less)}; inline constexpr strong_ordering strong_ordering::equal{static_cast<_Compare_t>(_Compare_eq::equal)}; inline constexpr strong_ordering strong_ordering::equivalent{static_cast<_Compare_t>(_Compare_eq::equivalent)}; inline constexpr strong_ordering strong_ordering::greater{static_cast<_Compare_t>(_Compare_ord::greater)}; [[nodiscard]] constexpr bool is_eq(const partial_ordering _Comp) noexcept { return _Comp == 0; } [[nodiscard]] constexpr bool is_neq(const partial_ordering _Comp) noexcept { return _Comp != 0; } [[nodiscard]] constexpr bool is_lt(const partial_ordering _Comp) noexcept { return _Comp < 0; } [[nodiscard]] constexpr bool is_lteq(const partial_ordering _Comp) noexcept { return _Comp <= 0; } [[nodiscard]] constexpr bool is_gt(const partial_ordering _Comp) noexcept { return _Comp > 0; } [[nodiscard]] constexpr bool is_gteq(const partial_ordering _Comp) noexcept { return _Comp >= 0; } enum _Comparison_category : unsigned char { _Comparison_category_none = 1, _Comparison_category_partial = 2, _Comparison_category_weak = 4, _Comparison_category_strong = 0, }; template <class... _Types> inline constexpr unsigned char _Classify_category = _Comparison_category{(_Classify_category<_Types> | ... | _Comparison_category_strong)}; template <class _Ty> inline constexpr unsigned char _Classify_category<_Ty> = _Comparison_category_none; template <> inline constexpr unsigned char _Classify_category<partial_ordering> = _Comparison_category_partial; template <> inline constexpr unsigned char _Classify_category<weak_ordering> = _Comparison_category_weak; template <> inline constexpr unsigned char _Classify_category<strong_ordering> = _Comparison_category_strong; template <class... _Types> using common_comparison_category_t = conditional_t<(_Classify_category<_Types...> & _Comparison_category_none) != 0, void, conditional_t<(_Classify_category<_Types...> & _Comparison_category_partial) != 0, partial_ordering, conditional_t<(_Classify_category<_Types...> & _Comparison_category_weak) != 0, weak_ordering, strong_ordering>>>; template <class... _Types> struct common_comparison_category { using type = common_comparison_category_t<_Types...>; }; template <class _Ty, class _Cat> concept _Compares_as = same_as<common_comparison_category_t<_Ty, _Cat>, _Cat>; template <class _Ty, class _Cat = partial_ordering> concept three_way_comparable = _Half_equality_comparable<_Ty, _Ty> && _Half_ordered<_Ty, _Ty> && requires(const remove_reference_t<_Ty>& __a, const remove_reference_t<_Ty>& __b) { { __a <=> __b } -> _Compares_as<_Cat>; }; template <class _Ty1, class _Ty2, class _Cat = partial_ordering> concept three_way_comparable_with = three_way_comparable<_Ty1, _Cat> && three_way_comparable<_Ty2, _Cat> && common_reference_with<const remove_reference_t<_Ty1>&, const remove_reference_t<_Ty2>&> && three_way_comparable<common_reference_t<const remove_reference_t<_Ty1>&, const remove_reference_t<_Ty2>&>, _Cat> && _Weakly_equality_comparable_with<_Ty1, _Ty2> && _Partially_ordered_with<_Ty1, _Ty2> && requires(const remove_reference_t<_Ty1>& __t, const remove_reference_t<_Ty2>& __u) { { __t <=> __u } -> _Compares_as<_Cat>; { __u <=> __t } -> _Compares_as<_Cat>; }; template <class _Ty1, class _Ty2 = _Ty1> using compare_three_way_result_t = decltype(::std:: declval<const remove_reference_t<_Ty1>&>() <=> ::std:: declval<const remove_reference_t<_Ty2>&>()); template <class _Ty1, class _Ty2 = _Ty1> struct compare_three_way_result {}; template <class _Ty1, class _Ty2> requires requires { typename compare_three_way_result_t<_Ty1, _Ty2>; } struct compare_three_way_result<_Ty1, _Ty2> { using type = compare_three_way_result_t<_Ty1, _Ty2>; }; struct compare_three_way { template <class _Ty1, class _Ty2> requires three_way_comparable_with<_Ty1, _Ty2> [[nodiscard]] constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(noexcept(::std:: forward<_Ty1>(_Left) <=> ::std:: forward<_Ty2>(_Right))) { return ::std:: forward<_Ty1>(_Left) <=> ::std:: forward<_Ty2>(_Right); } using is_transparent = int; }; struct _Synth_three_way { template <class _Ty1, class _Ty2> [[nodiscard]] constexpr auto operator()(const _Ty1& _Left, const _Ty2& _Right) const requires requires { { _Left < _Right } -> _Boolean_testable; { _Right < _Left } -> _Boolean_testable; } { if constexpr (three_way_comparable_with<_Ty1, _Ty2>) { return _Left <=> _Right; } else { if (_Left < _Right) { return weak_ordering::less; } else if (_Right < _Left) { return weak_ordering::greater; } else { return weak_ordering::equivalent; } } } }; template <class _Ty1, class _Ty2 = _Ty1> using _Synth_three_way_result = decltype(_Synth_three_way{}(::std:: declval<_Ty1&>(), ::std:: declval<_Ty2&>())); namespace _Strong_order { void strong_order(); template <class _Ty1, class _Ty2> concept _Has_ADL = requires(_Ty1& _Left, _Ty2& _Right) { static_cast<strong_ordering>( strong_order(_Left, _Right)); }; template <class _Ty1, class _Ty2> concept _Can_compare_three_way = requires(_Ty1& _Left, _Ty2& _Right) { static_cast<strong_ordering>(compare_three_way{}(_Left, _Right)); }; class _Cpo { private: enum class _St { _None, _Adl, _Floating, _Three }; template <class _Ty1, class _Ty2> [[nodiscard]] static consteval _Choice_t<_St> _Choose() noexcept { if constexpr (!same_as<decay_t<_Ty1>, decay_t<_Ty2>>) { return {_St::_None}; } else if constexpr (_Has_ADL<_Ty1, _Ty2>) { return {_St::_Adl, noexcept(static_cast<strong_ordering>( strong_order(::std:: declval<_Ty1&>(), ::std:: declval<_Ty2&>())))}; } else if constexpr (floating_point<decay_t<_Ty1>>) { return {_St::_Floating, true}; } else if constexpr (_Can_compare_three_way<_Ty1, _Ty2>) { return {_St::_Three, noexcept(static_cast<strong_ordering>( compare_three_way{}(::std:: declval<_Ty1&>(), ::std:: declval<_Ty2&>())))}; } else { return {_St::_None}; } } template <class _Ty1, class _Ty2> static constexpr _Choice_t<_St> _Choice = _Choose<_Ty1, _Ty2>(); public: template <class _Ty1, class _Ty2> requires (_Choice<_Ty1&, _Ty2&>._Strategy != _St::_None) [[nodiscard]] constexpr strong_ordering operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(_Choice<_Ty1&, _Ty2&>._No_throw) { constexpr _St _Strat = _Choice<_Ty1&, _Ty2&>._Strategy; if constexpr (_Strat == _St::_Adl) { return static_cast<strong_ordering>( strong_order(_Left, _Right)); } else if constexpr (_Strat == _St::_Floating) { using _Floating_type = decay_t<_Ty1>; using _Traits = _Floating_type_traits<_Floating_type>; using _Uint_type = typename _Traits::_Uint_type; using _Sint_type = make_signed_t<_Uint_type>; const auto _Left_uint = ::std:: bit_cast<_Uint_type>(_Left); const auto _Right_uint = ::std:: bit_cast<_Uint_type>(_Right); if (_Left_uint == _Right_uint) { return strong_ordering::equal; } const _Uint_type _Left_shifted_sign = _Left_uint & _Traits::_Shifted_sign_mask; const _Uint_type _Right_shifted_sign = _Right_uint & _Traits::_Shifted_sign_mask; const _Uint_type _Left_sign = _Left_shifted_sign >> _Traits::_Sign_shift; const _Uint_type _Right_sign = _Right_shifted_sign >> _Traits::_Sign_shift; const _Uint_type _Left_xor = _Left_shifted_sign - _Left_sign; const _Uint_type _Right_xor = _Right_shifted_sign - _Right_sign; const _Uint_type _Left_ones_complement_uint = _Left_uint ^ _Left_xor; const _Uint_type _Right_ones_complement_uint = _Right_uint ^ _Right_xor; const auto _Left_ones_complement = static_cast<_Sint_type>(_Left_ones_complement_uint); const auto _Right_ones_complement = static_cast<_Sint_type>(_Right_ones_complement_uint); return _Left_ones_complement <=> _Right_ones_complement; } else if constexpr (_Strat == _St::_Three) { return static_cast<strong_ordering>(compare_three_way{}(_Left, _Right)); } else { static_assert(_Always_false<_Ty1>, "should be unreachable"); } } }; } inline namespace _Cpos { inline constexpr _Strong_order::_Cpo strong_order; } namespace _Weak_order { void weak_order(); template <class _Ty1, class _Ty2> concept _Has_ADL = requires(_Ty1& _Left, _Ty2& _Right) { static_cast<weak_ordering>( weak_order(_Left, _Right)); }; template <class _Ty1, class _Ty2> concept _Can_compare_three_way = requires(_Ty1& _Left, _Ty2& _Right) { static_cast<weak_ordering>(compare_three_way{}(_Left, _Right)); }; void strong_order(); class _Cpo { private: enum class _St { _None, _Adl, _Floating, _Three, _Strong }; template <class _Ty1, class _Ty2> [[nodiscard]] static consteval _Choice_t<_St> _Choose() noexcept { if constexpr (!same_as<decay_t<_Ty1>, decay_t<_Ty2>>) { return {_St::_None}; } else if constexpr (_Has_ADL<_Ty1, _Ty2>) { return {_St::_Adl, noexcept(static_cast<weak_ordering>( weak_order(::std:: declval<_Ty1&>(), ::std:: declval<_Ty2&>())))}; } else if constexpr (floating_point<decay_t<_Ty1>>) { return {_St::_Floating, true}; } else if constexpr (_Can_compare_three_way<_Ty1, _Ty2>) { return {_St::_Three, noexcept(static_cast<weak_ordering>( compare_three_way{}(::std:: declval<_Ty1&>(), ::std:: declval<_Ty2&>())))}; } else if constexpr (_Strong_order::_Has_ADL<_Ty1, _Ty2>) { return {_St::_Strong, noexcept(static_cast<weak_ordering>(static_cast<strong_ordering>( strong_order( ::std:: declval<_Ty1&>(), ::std:: declval<_Ty2&>()))))}; } else { return {_St::_None}; } } template <class _Ty1, class _Ty2> static constexpr _Choice_t<_St> _Choice = _Choose<_Ty1, _Ty2>(); public: template <class _Ty1, class _Ty2> requires (_Choice<_Ty1&, _Ty2&>._Strategy != _St::_None) [[nodiscard]] constexpr weak_ordering operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(_Choice<_Ty1&, _Ty2&>._No_throw) { constexpr _St _Strat = _Choice<_Ty1&, _Ty2&>._Strategy; if constexpr (_Strat == _St::_Adl) { return static_cast<weak_ordering>( weak_order(_Left, _Right)); } else if constexpr (_Strat == _St::_Floating) { using _Floating_type = decay_t<_Ty1>; using _Traits = _Floating_type_traits<_Floating_type>; using _Uint_type = typename _Traits::_Uint_type; using _Sint_type = make_signed_t<_Uint_type>; auto _Left_uint = ::std:: bit_cast<_Uint_type>(_Left); auto _Right_uint = ::std:: bit_cast<_Uint_type>(_Right); if (_Left_uint == _Right_uint) { return weak_ordering::equivalent; } const _Uint_type _Left_shifted_sign = _Left_uint & _Traits::_Shifted_sign_mask; const _Uint_type _Right_shifted_sign = _Right_uint & _Traits::_Shifted_sign_mask; constexpr _Uint_type _Infinity_plus_one = _Traits::_Shifted_exponent_mask + 1; const _Uint_type _Left_magnitude = _Left_uint & ~_Traits::_Shifted_sign_mask; const _Uint_type _Right_magnitude = _Right_uint & ~_Traits::_Shifted_sign_mask; if (_Left_magnitude > _Infinity_plus_one) { _Left_uint = _Left_shifted_sign | _Infinity_plus_one; } if (_Right_magnitude > _Infinity_plus_one) { _Right_uint = _Right_shifted_sign | _Infinity_plus_one; } const _Uint_type _Left_sign = _Left_shifted_sign >> _Traits::_Sign_shift; const _Uint_type _Right_sign = _Right_shifted_sign >> _Traits::_Sign_shift; const _Uint_type _Left_xor = _Left_shifted_sign - _Left_sign; const _Uint_type _Right_xor = _Right_shifted_sign - _Right_sign; const _Uint_type _Left_twos_complement_uint = (_Left_uint ^ _Left_xor) + _Left_sign; const _Uint_type _Right_twos_complement_uint = (_Right_uint ^ _Right_xor) + _Right_sign; const auto _Left_twos_complement = static_cast<_Sint_type>(_Left_twos_complement_uint); const auto _Right_twos_complement = static_cast<_Sint_type>(_Right_twos_complement_uint); return static_cast<weak_ordering>(_Left_twos_complement <=> _Right_twos_complement); } else if constexpr (_Strat == _St::_Three) { return static_cast<weak_ordering>(compare_three_way{}(_Left, _Right)); } else if constexpr (_Strat == _St::_Strong) { return static_cast<weak_ordering>( static_cast<strong_ordering>( strong_order(_Left, _Right))); } else { static_assert(_Always_false<_Ty1>, "should be unreachable"); } } }; } inline namespace _Cpos { inline constexpr _Weak_order::_Cpo weak_order; } namespace _Partial_order { void partial_order(); template <class _Ty1, class _Ty2> concept _Has_ADL = requires(_Ty1& _Left, _Ty2& _Right) { static_cast<partial_ordering>( partial_order(_Left, _Right)); }; template <class _Ty1, class _Ty2> concept _Can_compare_three_way = requires(_Ty1& _Left, _Ty2& _Right) { static_cast<partial_ordering>(compare_three_way{}(_Left, _Right)); }; void weak_order(); void strong_order(); class _Cpo { private: enum class _St { _None, _Adl, _Three, _Weak, _Strong }; template <class _Ty1, class _Ty2> [[nodiscard]] static consteval _Choice_t<_St> _Choose() noexcept { if constexpr (!same_as<decay_t<_Ty1>, decay_t<_Ty2>>) { return {_St::_None}; } else if constexpr (_Has_ADL<_Ty1, _Ty2>) { return {_St::_Adl, noexcept(static_cast<partial_ordering>( partial_order(::std:: declval<_Ty1&>(), ::std:: declval<_Ty2&>())))}; } else if constexpr (_Can_compare_three_way<_Ty1, _Ty2>) { return {_St::_Three, noexcept(static_cast<partial_ordering>( compare_three_way{}(::std:: declval<_Ty1&>(), ::std:: declval<_Ty2&>())))}; } else if constexpr (_Weak_order::_Has_ADL<_Ty1, _Ty2>) { return {_St::_Weak, noexcept(static_cast<partial_ordering>(static_cast<weak_ordering>( weak_order(::std:: declval<_Ty1&>(), ::std:: declval<_Ty2&>()))))}; } else if constexpr (_Strong_order::_Has_ADL<_Ty1, _Ty2>) { return {_St::_Strong, noexcept(static_cast<partial_ordering>(static_cast<strong_ordering>( strong_order( ::std:: declval<_Ty1&>(), ::std:: declval<_Ty2&>()))))}; } else { return {_St::_None}; } } template <class _Ty1, class _Ty2> static constexpr _Choice_t<_St> _Choice = _Choose<_Ty1, _Ty2>(); public: template <class _Ty1, class _Ty2> requires (_Choice<_Ty1&, _Ty2&>._Strategy != _St::_None) [[nodiscard]] constexpr partial_ordering operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(_Choice<_Ty1&, _Ty2&>._No_throw) { constexpr _St _Strat = _Choice<_Ty1&, _Ty2&>._Strategy; if constexpr (_Strat == _St::_Adl) { return static_cast<partial_ordering>( partial_order(_Left, _Right)); } else if constexpr (_Strat == _St::_Three) { return static_cast<partial_ordering>(compare_three_way{}(_Left, _Right)); } else if constexpr (_Strat == _St::_Weak) { return static_cast<partial_ordering>( static_cast<weak_ordering>( weak_order(_Left, _Right))); } else if constexpr (_Strat == _St::_Strong) { return static_cast<partial_ordering>( static_cast<strong_ordering>( strong_order(_Left, _Right))); } else { static_assert(_Always_false<_Ty1>, "should be unreachable"); } } }; } inline namespace _Cpos { inline constexpr _Partial_order::_Cpo partial_order; } template <class _Ty1, class _Ty2> concept _Can_fallback_eq_lt = requires(_Ty1& _Left, _Ty2& _Right) { { _Left == _Right } -> _Implicitly_convertible_to<bool>; { _Left < _Right } -> _Implicitly_convertible_to<bool>; }; namespace _Compare_strong_order_fallback { template <class _Ty1, class _Ty2> concept _Can_strong_order = requires(_Ty1& _Left, _Ty2& _Right) { ::std:: strong_order(_Left, _Right); }; class _Cpo { private: enum class _St { _None, _Strong, _Fallback }; template <class _Ty1, class _Ty2> [[nodiscard]] static consteval _Choice_t<_St> _Choose() noexcept { if constexpr (!same_as<decay_t<_Ty1>, decay_t<_Ty2>>) { return {_St::_None}; } else if constexpr (_Can_strong_order<_Ty1, _Ty2>) { return {_St::_Strong, noexcept(::std:: strong_order(::std:: declval<_Ty1&>(), ::std:: declval<_Ty2&>()))}; } else if constexpr (_Can_fallback_eq_lt<_Ty1, _Ty2>) { return {_St::_Fallback, noexcept(::std:: declval<_Ty1&>() == ::std:: declval<_Ty2&>() ? strong_ordering::equal : ::std:: declval<_Ty1&>() < ::std:: declval<_Ty2&>() ? strong_ordering::less : strong_ordering::greater)}; } else { return {_St::_None}; } } template <class _Ty1, class _Ty2> static constexpr _Choice_t<_St> _Choice = _Choose<_Ty1, _Ty2>(); public: template <class _Ty1, class _Ty2> requires (_Choice<_Ty1&, _Ty2&>._Strategy != _St::_None) [[nodiscard]] constexpr strong_ordering operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(_Choice<_Ty1&, _Ty2&>._No_throw) { constexpr _St _Strat = _Choice<_Ty1&, _Ty2&>._Strategy; if constexpr (_Strat == _St::_Strong) { return ::std:: strong_order(_Left, _Right); } else if constexpr (_Strat == _St::_Fallback) { return _Left == _Right ? strong_ordering::equal : _Left < _Right ? strong_ordering::less : strong_ordering::greater; } else { static_assert(_Always_false<_Ty1>, "should be unreachable"); } } }; } inline namespace _Cpos { inline constexpr _Compare_strong_order_fallback::_Cpo compare_strong_order_fallback; } namespace _Compare_weak_order_fallback { template <class _Ty1, class _Ty2> concept _Can_weak_order = requires(_Ty1& _Left, _Ty2& _Right) { ::std:: weak_order(_Left, _Right); }; class _Cpo { private: enum class _St { _None, _Weak, _Fallback }; template <class _Ty1, class _Ty2> [[nodiscard]] static consteval _Choice_t<_St> _Choose() noexcept { if constexpr (!same_as<decay_t<_Ty1>, decay_t<_Ty2>>) { return {_St::_None}; } else if constexpr (_Can_weak_order<_Ty1, _Ty2>) { return {_St::_Weak, noexcept(::std:: weak_order(::std:: declval<_Ty1&>(), ::std:: declval<_Ty2&>()))}; } else if constexpr (_Can_fallback_eq_lt<_Ty1, _Ty2>) { return { _St::_Fallback, noexcept(::std:: declval<_Ty1&>() == ::std:: declval<_Ty2&>() ? weak_ordering::equivalent : ::std:: declval<_Ty1&>() < ::std:: declval<_Ty2&>() ? weak_ordering::less : weak_ordering::greater)}; } else { return {_St::_None}; } } template <class _Ty1, class _Ty2> static constexpr _Choice_t<_St> _Choice = _Choose<_Ty1, _Ty2>(); public: template <class _Ty1, class _Ty2> requires (_Choice<_Ty1&, _Ty2&>._Strategy != _St::_None) [[nodiscard]] constexpr weak_ordering operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(_Choice<_Ty1&, _Ty2&>._No_throw) { constexpr _St _Strat = _Choice<_Ty1&, _Ty2&>._Strategy; if constexpr (_Strat == _St::_Weak) { return ::std:: weak_order(_Left, _Right); } else if constexpr (_Strat == _St::_Fallback) { return _Left == _Right ? weak_ordering::equivalent : _Left < _Right ? weak_ordering::less : weak_ordering::greater; } else { static_assert(_Always_false<_Ty1>, "should be unreachable"); } } }; } inline namespace _Cpos { inline constexpr _Compare_weak_order_fallback::_Cpo compare_weak_order_fallback; } namespace _Compare_partial_order_fallback { template <class _Ty1, class _Ty2> concept _Can_partial_order = requires(_Ty1& _Left, _Ty2& _Right) { ::std:: partial_order(_Left, _Right); }; template <class _Ty1, class _Ty2> concept _Can_fallback_eq_lt_twice = requires(_Ty1& _Left, _Ty2& _Right) { { _Left == _Right } -> _Implicitly_convertible_to<bool>; { _Left < _Right } -> _Implicitly_convertible_to<bool>; { _Right < _Left } -> _Implicitly_convertible_to<bool>; }; class _Cpo { private: enum class _St { _None, _Partial, _Fallback }; template <class _Ty1, class _Ty2> [[nodiscard]] static consteval _Choice_t<_St> _Choose() noexcept { if constexpr (!same_as<decay_t<_Ty1>, decay_t<_Ty2>>) { return {_St::_None}; } else if constexpr (_Can_partial_order<_Ty1, _Ty2>) { return {_St::_Partial, noexcept(::std:: partial_order(::std:: declval<_Ty1&>(), ::std:: declval<_Ty2&>()))}; } else if constexpr (_Can_fallback_eq_lt_twice<_Ty1, _Ty2>) { return {_St::_Fallback, noexcept(::std:: declval<_Ty1&>() == ::std:: declval<_Ty2&>() ? partial_ordering::equivalent : ::std:: declval<_Ty1&>() < ::std:: declval<_Ty2&>() ? partial_ordering::less : ::std:: declval<_Ty2&>() < ::std:: declval<_Ty1&>() ? partial_ordering::greater : partial_ordering::unordered)}; } else { return {_St::_None}; } } template <class _Ty1, class _Ty2> static constexpr _Choice_t<_St> _Choice = _Choose<_Ty1, _Ty2>(); public: template <class _Ty1, class _Ty2> requires (_Choice<_Ty1&, _Ty2&>._Strategy != _St::_None) [[nodiscard]] constexpr partial_ordering operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(_Choice<_Ty1&, _Ty2&>._No_throw) { constexpr _St _Strat = _Choice<_Ty1&, _Ty2&>._Strategy; if constexpr (_Strat == _St::_Partial) { return ::std:: partial_order(_Left, _Right); } else if constexpr (_Strat == _St::_Fallback) { return _Left == _Right ? partial_ordering::equivalent : _Left < _Right ? partial_ordering::less : _Right < _Left ? partial_ordering::greater : partial_ordering::unordered; } else { static_assert(_Always_false<_Ty1>, "should be unreachable"); } } }; } inline namespace _Cpos { inline constexpr _Compare_partial_order_fallback::_Cpo compare_partial_order_fallback; } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { __declspec(dllimport) int __cdecl _memicmp( void const* _Buf1, void const* _Buf2, size_t _Size ); __declspec(dllimport) int __cdecl _memicmp_l( void const* _Buf1, void const* _Buf2, size_t _Size, _locale_t _Locale ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_memccpy" ". See online help for details.")) __declspec(dllimport) void* __cdecl memccpy( void* _Dst, void const* _Src, int _Val, size_t _Size ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_memicmp" ". See online help for details.")) __declspec(dllimport) int __cdecl memicmp( void const* _Buf1, void const* _Buf2, size_t _Size ); extern "C++" inline void* __cdecl memchr( void* _Pv, int _C, size_t _N ) { void const* const _Pvc = _Pv; return const_cast<void*>(memchr(_Pvc, _C, _N)); } } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { __declspec(dllimport) errno_t __cdecl strcpy_s( char* _Destination, rsize_t _SizeInBytes, char const* _Source ); __declspec(dllimport) errno_t __cdecl strcat_s( char* _Destination, rsize_t _SizeInBytes, char const* _Source ); __declspec(dllimport) errno_t __cdecl strerror_s( char* _Buffer, size_t _SizeInBytes, int _ErrorNumber); __declspec(dllimport) errno_t __cdecl strncat_s( char* _Destination, rsize_t _SizeInBytes, char const* _Source, rsize_t _MaxCount ); __declspec(dllimport) errno_t __cdecl strncpy_s( char* _Destination, rsize_t _SizeInBytes, char const* _Source, rsize_t _MaxCount ); __declspec(dllimport) char* __cdecl strtok_s( char* _String, char const* _Delimiter, char** _Context ); __declspec(dllimport) void* __cdecl _memccpy( void* _Dst, void const* _Src, int _Val, size_t _MaxCount ); extern "C++" { template <size_t _Size> inline errno_t __cdecl strcat_s(char (&_Destination)[_Size], char const* _Source) throw() { return strcat_s(_Destination, _Size, _Source); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "strcat_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char* __cdecl strcat( char *_Destination, char const* _Source); int __cdecl strcmp( char const* _Str1, char const* _Str2 ); __declspec(dllimport) int __cdecl _strcmpi( char const* _String1, char const* _String2 ); __declspec(dllimport) int __cdecl strcoll( char const* _String1, char const* _String2 ); __declspec(dllimport) int __cdecl _strcoll_l( char const* _String1, char const* _String2, _locale_t _Locale ); extern "C++" { template <size_t _Size> inline errno_t __cdecl strcpy_s( char (&_Destination)[_Size], char const* _Source) throw() { return strcpy_s(_Destination, _Size, _Source); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "strcpy_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char* __cdecl strcpy( char *_Destination, char const* _Source); __declspec(dllimport) size_t __cdecl strcspn( char const* _Str, char const* _Control ); __declspec(dllimport) __declspec(allocator) char* __cdecl _strdup( char const* _Source ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_strerror_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl _strerror( char const* _ErrorMessage ); __declspec(dllimport) errno_t __cdecl _strerror_s( char* _Buffer, size_t _SizeInBytes, char const* _ErrorMessage ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _strerror_s(char (&_Buffer)[_Size], char const* _ErrorMessage) throw() { return _strerror_s(_Buffer, _Size, _ErrorMessage); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "strerror_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl strerror( int _ErrorMessage ); extern "C++" { template <size_t _Size> inline errno_t __cdecl strerror_s(char (&_Buffer)[_Size], int _ErrorMessage) throw() { return strerror_s(_Buffer, _Size, _ErrorMessage); } } __declspec(dllimport) int __cdecl _stricmp( char const* _String1, char const* _String2 ); __declspec(dllimport) int __cdecl _stricoll( char const* _String1, char const* _String2 ); __declspec(dllimport) int __cdecl _stricoll_l( char const* _String1, char const* _String2, _locale_t _Locale ); __declspec(dllimport) int __cdecl _stricmp_l( char const* _String1, char const* _String2, _locale_t _Locale ); size_t __cdecl strlen( char const* _Str ); __declspec(dllimport) errno_t __cdecl _strlwr_s( char* _String, size_t _Size ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _strlwr_s( char (&_String)[_Size]) throw() { return _strlwr_s(_String, _Size); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_strlwr_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl _strlwr( char *_String); __declspec(dllimport) errno_t __cdecl _strlwr_s_l( char* _String, size_t _Size, _locale_t _Locale ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _strlwr_s_l( char (&_String)[_Size], _locale_t _Locale) throw() { return _strlwr_s_l(_String, _Size, _Locale); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_strlwr_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl _strlwr_l( char *_String, _locale_t _Locale); extern "C++" { template <size_t _Size> inline errno_t __cdecl strncat_s( char (&_Destination)[_Size], char const* _Source, size_t _Count) throw() { return strncat_s(_Destination, _Size, _Source, _Count); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "strncat_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl strncat( char *_Destination, char const* _Source, size_t _Count); __declspec(dllimport) int __cdecl strncmp( char const* _Str1, char const* _Str2, size_t _MaxCount ); __declspec(dllimport) int __cdecl _strnicmp( char const* _String1, char const* _String2, size_t _MaxCount ); __declspec(dllimport) int __cdecl _strnicmp_l( char const* _String1, char const* _String2, size_t _MaxCount, _locale_t _Locale ); __declspec(dllimport) int __cdecl _strnicoll( char const* _String1, char const* _String2, size_t _MaxCount ); __declspec(dllimport) int __cdecl _strnicoll_l( char const* _String1, char const* _String2, size_t _MaxCount, _locale_t _Locale ); __declspec(dllimport) int __cdecl _strncoll( char const* _String1, char const* _String2, size_t _MaxCount ); __declspec(dllimport) int __cdecl _strncoll_l( char const* _String1, char const* _String2, size_t _MaxCount, _locale_t _Locale ); __declspec(dllimport) size_t __cdecl __strncnt( char const* _String, size_t _Count ); extern "C++" { template <size_t _Size> inline errno_t __cdecl strncpy_s(char (&_Destination)[_Size], char const* _Source, size_t _Count) throw() { return strncpy_s(_Destination, _Size, _Source, _Count); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "strncpy_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl strncpy( char *_Destination, char const* _Source, size_t _Count); __declspec(dllimport) size_t __cdecl strnlen( char const* _String, size_t _MaxCount ); static __inline size_t __cdecl strnlen_s( char const* _String, size_t _MaxCount ) { return _String == 0 ? 0 : strnlen(_String, _MaxCount); } __declspec(dllimport) errno_t __cdecl _strnset_s( char* _String, size_t _SizeInBytes, int _Value, size_t _MaxCount ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _strnset_s( char (&_Destination)[_Size], int _Value, size_t _Count) throw() { return _strnset_s(_Destination, _Size, _Value, _Count); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_strnset_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl _strnset( char *_Destination, int _Value, size_t _Count); __declspec(dllimport) char const* __cdecl strpbrk( char const* _Str, char const* _Control ); __declspec(dllimport) char* __cdecl _strrev( char* _Str ); __declspec(dllimport) errno_t __cdecl _strset_s( char* _Destination, size_t _DestinationSize, int _Value ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _strset_s( char (&_Destination)[_Size], int _Value) throw() { return _strset_s(_Destination, _Size, _Value); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_strset_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char* __cdecl _strset( char *_Destination, int _Value); __declspec(dllimport) size_t __cdecl strspn( char const* _Str, char const* _Control ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "strtok_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl strtok( char* _String, char const* _Delimiter ); __declspec(dllimport) errno_t __cdecl _strupr_s( char* _String, size_t _Size ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _strupr_s( char (&_String)[_Size]) throw() { return _strupr_s(_String, _Size); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_strupr_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl _strupr( char *_String); __declspec(dllimport) errno_t __cdecl _strupr_s_l( char* _String, size_t _Size, _locale_t _Locale ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _strupr_s_l( char (&_String)[_Size], _locale_t _Locale) throw() { return _strupr_s_l(_String, _Size, _Locale); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_strupr_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl _strupr_l( char *_String, _locale_t _Locale); __declspec(dllimport) size_t __cdecl strxfrm( char* _Destination, char const* _Source, size_t _MaxCount ); __declspec(dllimport) size_t __cdecl _strxfrm_l( char* _Destination, char const* _Source, size_t _MaxCount, _locale_t _Locale ); extern "C++" { inline char* __cdecl strchr( char* const _String, int const _Ch) { return const_cast<char*>(strchr(static_cast<char const*>(_String), _Ch)); } inline char* __cdecl strpbrk( char* const _String, char const* const _Control) { return const_cast<char*>(strpbrk(static_cast<char const*>(_String), _Control)); } inline char* __cdecl strrchr( char* const _String, int const _Ch) { return const_cast<char*>(strrchr(static_cast<char const*>(_String), _Ch)); } inline char* __cdecl strstr( char* const _String, char const* const _SubString) { return const_cast<char*>(strstr(static_cast<char const*>(_String), _SubString)); } } __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strdup" ". See online help for details.")) __declspec(dllimport) char* __cdecl strdup( char const* _String ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strcmpi" ". See online help for details.")) __declspec(dllimport) int __cdecl strcmpi( char const* _String1, char const* _String2 ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_stricmp" ". See online help for details.")) __declspec(dllimport) int __cdecl stricmp( char const* _String1, char const* _String2 ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strlwr" ". See online help for details.")) __declspec(dllimport) char* __cdecl strlwr( char* _String ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strnicmp" ". See online help for details.")) __declspec(dllimport) int __cdecl strnicmp( char const* _String1, char const* _String2, size_t _MaxCount ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strnset" ". See online help for details.")) __declspec(dllimport) char* __cdecl strnset( char* _String, int _Value, size_t _MaxCount ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strrev" ". See online help for details.")) __declspec(dllimport) char* __cdecl strrev( char* _String ); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strset" ". See online help for details.")) char* __cdecl strset( char* _String, int _Value); __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strupr" ". See online help for details.")) __declspec(dllimport) char* __cdecl strupr( char* _String ); } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { #pragma warning(push) #pragma warning(disable : 4995) using :: size_t; using :: memchr; using :: memcmp; using :: memcpy; using :: memmove; using :: memset; using :: strcat; using :: strchr; using :: strcmp; using :: strcoll; using :: strcpy; using :: strcspn; using :: strerror; using :: strlen; using :: strncat; using :: strncmp; using :: strncpy; using :: strpbrk; using :: strrchr; using :: strspn; using :: strstr; using :: strtok; using :: strxfrm; #pragma warning(pop) } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { template <class _Ty, class _Pr> [[nodiscard]] constexpr const _Ty&(max)(const _Ty& _Left, const _Ty& _Right, _Pr _Pred) noexcept( noexcept(_Pred(_Left, _Right))) { return _Pred(_Left, _Right) ? _Right : _Left; } #pragma warning(push) #pragma warning(disable : 28285) template <class _Ty> [[nodiscard]] constexpr const _Ty&(max)( const _Ty& _Left, const _Ty& _Right) noexcept(noexcept(_Left < _Right)) { return _Left < _Right ? _Right : _Left; } #pragma warning(pop) template <class _Ty, class _Pr> [[nodiscard]] constexpr _Ty(max)(initializer_list<_Ty>, _Pr); template <class _Ty> [[nodiscard]] constexpr _Ty(max)(initializer_list<_Ty>); template <class _Ty, class _Pr> [[nodiscard]] constexpr const _Ty&(min)(const _Ty& _Left, const _Ty& _Right, _Pr _Pred) noexcept( noexcept(_Pred(_Right, _Left))) { return _Pred(_Right, _Left) ? _Right : _Left; } #pragma warning(push) #pragma warning(disable : 28285) template <class _Ty> [[nodiscard]] constexpr const _Ty&(min)( const _Ty& _Left, const _Ty& _Right) noexcept(noexcept(_Right < _Left)) { return _Right < _Left ? _Right : _Left; } #pragma warning(pop) template <class _Ty, class _Pr> [[nodiscard]] constexpr _Ty(min)(initializer_list<_Ty>, _Pr); template <class _Ty> [[nodiscard]] constexpr _Ty(min)(initializer_list<_Ty>); template <class _FwdIt1, class _FwdIt2> constexpr void iter_swap(_FwdIt1 _Left, _FwdIt2 _Right) { swap(*_Left, *_Right); } template <class _Ty, size_t _Size, enable_if_t<_Is_swappable<_Ty>::value, int> _Enabled> constexpr void swap(_Ty (&_Left)[_Size], _Ty (&_Right)[_Size]) noexcept(_Is_nothrow_swappable<_Ty>::value) { if (&_Left != &_Right) { _Ty* _First1 = _Left; _Ty* _Last1 = _First1 + _Size; _Ty* _First2 = _Right; for (; _First1 != _Last1; ++_First1, ++_First2) { ::std:: iter_swap(_First1, _First2); } } } template <class _Ty, enable_if_t<is_move_constructible_v<_Ty> && is_move_assignable_v<_Ty>, int> _Enabled> constexpr void swap(_Ty& _Left, _Ty& _Right) noexcept( is_nothrow_move_constructible_v<_Ty>&& is_nothrow_move_assignable_v<_Ty>) { _Ty _Tmp = ::std:: move(_Left); _Left = ::std:: move(_Right); _Right = ::std:: move(_Tmp); } template <class _Ty> constexpr void _Swap_adl(_Ty& _Left, _Ty& _Right) noexcept(_Is_nothrow_swappable<_Ty>::value) { swap(_Left, _Right); } struct piecewise_construct_t { explicit piecewise_construct_t() = default; }; inline constexpr piecewise_construct_t piecewise_construct{}; template <class...> class tuple; template <size_t _Index, class... _Types> [[nodiscard]] constexpr auto&& _Tuple_get(tuple<_Types...>&& _Tuple) noexcept; template <class _Ty1, class _Ty2> struct pair { using first_type = _Ty1; using second_type = _Ty2; template <class _Uty1 = _Ty1, class _Uty2 = _Ty2, enable_if_t<conjunction_v<is_default_constructible<_Uty1>, is_default_constructible<_Uty2>>, int> = 0> constexpr explicit( !conjunction_v<_Is_implicitly_default_constructible<_Uty1>, _Is_implicitly_default_constructible<_Uty2>>) pair() noexcept( is_nothrow_default_constructible_v<_Uty1>&& is_nothrow_default_constructible_v<_Uty2>) : first(), second() {} template <class _Uty1 = _Ty1, class _Uty2 = _Ty2, enable_if_t<conjunction_v<is_copy_constructible<_Uty1>, is_copy_constructible<_Uty2>>, int> = 0> constexpr explicit(!conjunction_v<is_convertible<const _Uty1&, _Uty1>, is_convertible<const _Uty2&, _Uty2>>) pair(const _Ty1& _Val1, const _Ty2& _Val2) noexcept( is_nothrow_copy_constructible_v<_Uty1>&& is_nothrow_copy_constructible_v<_Uty2>) : first(_Val1), second(_Val2) {} template <class _Other1, class _Other2, enable_if_t<conjunction_v<is_constructible<_Ty1, _Other1>, is_constructible<_Ty2, _Other2>>, int> = 0> constexpr explicit(!conjunction_v<is_convertible<_Other1, _Ty1>, is_convertible<_Other2, _Ty2>>) pair(_Other1&& _Val1, _Other2&& _Val2) noexcept( is_nothrow_constructible_v<_Ty1, _Other1>&& is_nothrow_constructible_v<_Ty2, _Other2>) : first(::std:: forward<_Other1>(_Val1)), second(::std:: forward<_Other2>(_Val2)) {} pair(const pair&) = default; pair(pair&&) = default; template <class _Other1, class _Other2, enable_if_t<conjunction_v<is_constructible<_Ty1, const _Other1&>, is_constructible<_Ty2, const _Other2&>>, int> = 0> constexpr explicit(!conjunction_v<is_convertible<const _Other1&, _Ty1>, is_convertible<const _Other2&, _Ty2>>) pair(const pair<_Other1, _Other2>& _Right) noexcept(is_nothrow_constructible_v<_Ty1, const _Other1&>&& is_nothrow_constructible_v<_Ty2, const _Other2&>) : first(_Right.first), second(_Right.second) {} template <class _Other1, class _Other2, enable_if_t<conjunction_v<is_constructible<_Ty1, _Other1>, is_constructible<_Ty2, _Other2>>, int> = 0> constexpr explicit(!conjunction_v<is_convertible<_Other1, _Ty1>, is_convertible<_Other2, _Ty2>>) pair(pair<_Other1, _Other2>&& _Right) noexcept( is_nothrow_constructible_v<_Ty1, _Other1>&& is_nothrow_constructible_v<_Ty2, _Other2>) : first(::std:: forward<_Other1>(_Right.first)), second(::std:: forward<_Other2>(_Right.second)) {} template <class _Tuple1, class _Tuple2, size_t... _Indexes1, size_t... _Indexes2> constexpr pair(_Tuple1& _Val1, _Tuple2& _Val2, index_sequence<_Indexes1...>, index_sequence<_Indexes2...>) : first(_Tuple_get<_Indexes1>(::std:: move(_Val1))...), second(_Tuple_get<_Indexes2>(::std:: move(_Val2))...) {} template <class... _Types1, class... _Types2> constexpr pair(piecewise_construct_t, tuple<_Types1...> _Val1, tuple<_Types2...> _Val2) : pair(_Val1, _Val2, index_sequence_for<_Types1...>{}, index_sequence_for<_Types2...>{}) {} pair& operator=(const volatile pair&) = delete; template <class _Myself = pair, enable_if_t<conjunction_v<_Is_copy_assignable_no_precondition_check<typename _Myself::first_type>, _Is_copy_assignable_no_precondition_check<typename _Myself::second_type>>, int> = 0> constexpr pair& operator=(_Identity_t<const _Myself&> _Right) noexcept( conjunction_v<is_nothrow_copy_assignable<_Ty1>, is_nothrow_copy_assignable<_Ty2>>) { first = _Right.first; second = _Right.second; return *this; } template <class _Myself = pair, enable_if_t<conjunction_v<_Is_move_assignable_no_precondition_check<typename _Myself::first_type>, _Is_move_assignable_no_precondition_check<typename _Myself::second_type>>, int> = 0> constexpr pair& operator=(_Identity_t<_Myself&&> _Right) noexcept( conjunction_v<is_nothrow_move_assignable<_Ty1>, is_nothrow_move_assignable<_Ty2>>) { first = ::std:: forward<_Ty1>(_Right.first); second = ::std:: forward<_Ty2>(_Right.second); return *this; } template <class _Other1, class _Other2, enable_if_t<conjunction_v<negation<is_same<pair, pair<_Other1, _Other2>>>, is_assignable<_Ty1&, const _Other1&>, is_assignable<_Ty2&, const _Other2&>>, int> = 0> constexpr pair& operator=(const pair<_Other1, _Other2>& _Right) noexcept( is_nothrow_assignable_v<_Ty1&, const _Other1&>&& is_nothrow_assignable_v<_Ty2&, const _Other2&>) { first = _Right.first; second = _Right.second; return *this; } template <class _Other1, class _Other2, enable_if_t<conjunction_v<negation<is_same<pair, pair<_Other1, _Other2>>>, is_assignable<_Ty1&, _Other1>, is_assignable<_Ty2&, _Other2>>, int> = 0> constexpr pair& operator=(pair<_Other1, _Other2>&& _Right) noexcept( is_nothrow_assignable_v<_Ty1&, _Other1>&& is_nothrow_assignable_v<_Ty2&, _Other2>) { first = ::std:: forward<_Other1>(_Right.first); second = ::std:: forward<_Other2>(_Right.second); return *this; } constexpr void swap(pair& _Right) noexcept( _Is_nothrow_swappable<_Ty1>::value&& _Is_nothrow_swappable<_Ty2>::value) { if (this != ::std:: addressof(_Right)) { _Swap_adl(first, _Right.first); _Swap_adl(second, _Right.second); } } _Ty1 first; _Ty2 second; }; template <class _Ty1, class _Ty2> pair(_Ty1, _Ty2) -> pair<_Ty1, _Ty2>; template <class _Ty1, class _Ty2, enable_if_t<_Is_swappable<_Ty1>::value && _Is_swappable<_Ty2>::value, int> = 0> constexpr void swap(pair<_Ty1, _Ty2>& _Left, pair<_Ty1, _Ty2>& _Right) noexcept(noexcept(_Left.swap(_Right))) { _Left.swap(_Right); } template <class _Ty1, class _Ty2> [[nodiscard]] constexpr bool operator==(const pair<_Ty1, _Ty2>& _Left, const pair<_Ty1, _Ty2>& _Right) { return _Left.first == _Right.first && _Left.second == _Right.second; } template <class _Ty1, class _Ty2> [[nodiscard]] constexpr common_comparison_category_t<_Synth_three_way_result<_Ty1>, _Synth_three_way_result<_Ty2>> operator<=>(const pair<_Ty1, _Ty2>& _Left, const pair<_Ty1, _Ty2>& _Right) { if (auto _Result = _Synth_three_way{}(_Left.first, _Right.first); _Result != 0) { return _Result; } return _Synth_three_way{}(_Left.second, _Right.second); } template <class _Ty> struct _Unrefwrap_helper { using type = _Ty; }; template <class _Ty> struct _Unrefwrap_helper<reference_wrapper<_Ty>> { using type = _Ty&; }; template <class _Ty> using _Unrefwrap_t = typename _Unrefwrap_helper<decay_t<_Ty>>::type; template <class _Ty1, class _Ty2> [[nodiscard]] constexpr pair<_Unrefwrap_t<_Ty1>, _Unrefwrap_t<_Ty2>> make_pair(_Ty1&& _Val1, _Ty2&& _Val2) noexcept( is_nothrow_constructible_v<_Unrefwrap_t<_Ty1>, _Ty1>&& is_nothrow_constructible_v<_Unrefwrap_t<_Ty2>, _Ty2>) { using _Mypair = pair<_Unrefwrap_t<_Ty1>, _Unrefwrap_t<_Ty2>>; return _Mypair(::std:: forward<_Ty1>(_Val1), ::std:: forward<_Ty2>(_Val2)); } namespace [[deprecated("warning STL4027: " "The namespace std::rel_ops and its contents are deprecated in C++20. " "Their use is superseded by C++20's <=> operator and automatic rewrites of relational expressions. " "You can define _SILENCE_CXX20_REL_OPS_DEPRECATION_WARNING or " "_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] rel_ops { template <class _Ty> [[deprecated("warning STL4027: " "The namespace std::rel_ops and its contents are deprecated in C++20. " "Their use is superseded by C++20's <=> operator and automatic rewrites of relational expressions. " "You can define _SILENCE_CXX20_REL_OPS_DEPRECATION_WARNING or " "_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] [[nodiscard]] bool operator!=(const _Ty& _Left, const _Ty& _Right) { return !(_Left == _Right); } template <class _Ty> [[deprecated("warning STL4027: " "The namespace std::rel_ops and its contents are deprecated in C++20. " "Their use is superseded by C++20's <=> operator and automatic rewrites of relational expressions. " "You can define _SILENCE_CXX20_REL_OPS_DEPRECATION_WARNING or " "_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] [[nodiscard]] bool operator>(const _Ty& _Left, const _Ty& _Right) { return _Right < _Left; } template <class _Ty> [[deprecated("warning STL4027: " "The namespace std::rel_ops and its contents are deprecated in C++20. " "Their use is superseded by C++20's <=> operator and automatic rewrites of relational expressions. " "You can define _SILENCE_CXX20_REL_OPS_DEPRECATION_WARNING or " "_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] [[nodiscard]] bool operator<=(const _Ty& _Left, const _Ty& _Right) { return !(_Right < _Left); } template <class _Ty> [[deprecated("warning STL4027: " "The namespace std::rel_ops and its contents are deprecated in C++20. " "Their use is superseded by C++20's <=> operator and automatic rewrites of relational expressions. " "You can define _SILENCE_CXX20_REL_OPS_DEPRECATION_WARNING or " "_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] [[nodiscard]] bool operator>=(const _Ty& _Left, const _Ty& _Right) { return !(_Left < _Right); } } template <class _Tuple> struct tuple_size; template <class _Tuple, class = void> struct _Tuple_size_sfinae {}; template <class _Tuple> struct _Tuple_size_sfinae<_Tuple, void_t<decltype(tuple_size<_Tuple>::value)>> : integral_constant<size_t, tuple_size<_Tuple>::value> {}; template <class _Tuple> struct tuple_size<const _Tuple> : _Tuple_size_sfinae<_Tuple> {}; template <class _Tuple> struct [[deprecated("warning STL4030: " "Some operations on volatile-qualified types in the STL are deprecated in C++20. " "You can define _SILENCE_CXX20_VOLATILE_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] tuple_size<volatile _Tuple> : _Tuple_size_sfinae<_Tuple> {}; template <class _Tuple> struct [[deprecated("warning STL4030: " "Some operations on volatile-qualified types in the STL are deprecated in C++20. " "You can define _SILENCE_CXX20_VOLATILE_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] tuple_size<const volatile _Tuple> : _Tuple_size_sfinae<_Tuple> {}; template <class _Ty> inline constexpr size_t tuple_size_v = tuple_size<_Ty>::value; template <size_t _Index, class _Tuple> struct tuple_element; template <size_t _Index, class _Tuple> struct [[msvc::known_semantics]] tuple_element<_Index, const _Tuple> : tuple_element<_Index, _Tuple> { using _Mybase = tuple_element<_Index, _Tuple>; using type = add_const_t<typename _Mybase::type>; }; template <size_t _Index, class _Tuple> struct [[deprecated("warning STL4030: " "Some operations on volatile-qualified types in the STL are deprecated in C++20. " "You can define _SILENCE_CXX20_VOLATILE_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] [[msvc::known_semantics]] tuple_element<_Index, volatile _Tuple> : tuple_element<_Index, _Tuple> { using _Mybase = tuple_element<_Index, _Tuple>; using type = add_volatile_t<typename _Mybase::type>; }; template <size_t _Index, class _Tuple> struct [[deprecated("warning STL4030: " "Some operations on volatile-qualified types in the STL are deprecated in C++20. " "You can define _SILENCE_CXX20_VOLATILE_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] [[msvc::known_semantics]] tuple_element<_Index, const volatile _Tuple> : tuple_element<_Index, _Tuple> { using _Mybase = tuple_element<_Index, _Tuple>; using type = add_cv_t<typename _Mybase::type>; }; template <size_t _Index, class _Tuple> using tuple_element_t = typename tuple_element<_Index, _Tuple>::type; template <class _Ty, size_t _Size> class array; template <class _Ty, size_t _Size> struct tuple_size<array<_Ty, _Size>> : integral_constant<size_t, _Size> {}; template <size_t _Idx, class _Ty, size_t _Size> struct [[msvc::known_semantics]] tuple_element<_Idx, array<_Ty, _Size>> { static_assert(_Idx < _Size, "array index out of bounds"); using type = _Ty; }; template <class... _Types> struct tuple_size<tuple<_Types...>> : integral_constant<size_t, sizeof...(_Types)> {}; template <size_t _Index> struct [[msvc::known_semantics]] tuple_element<_Index, tuple<>> { static_assert(_Always_false<integral_constant<size_t, _Index>>, "tuple index out of bounds"); }; template <class _This, class... _Rest> struct [[msvc::known_semantics]] tuple_element<0, tuple<_This, _Rest...>> { using type = _This; using _Ttype = tuple<_This, _Rest...>; }; template <size_t _Index, class _This, class... _Rest> struct [[msvc::known_semantics]] tuple_element<_Index, tuple<_This, _Rest...>> : tuple_element<_Index - 1, tuple<_Rest...>> {}; template <class _Ty1, class _Ty2> struct tuple_size<pair<_Ty1, _Ty2>> : integral_constant<size_t, 2> {}; template <size_t _Idx, class _Ty1, class _Ty2> struct [[msvc::known_semantics]] tuple_element<_Idx, pair<_Ty1, _Ty2>> { static_assert(_Idx < 2, "pair index out of bounds"); using type = conditional_t<_Idx == 0, _Ty1, _Ty2>; }; template <class _Ret, class _Pair> constexpr _Ret _Pair_get(_Pair& _Pr, integral_constant<size_t, 0>) noexcept { return _Pr.first; } template <class _Ret, class _Pair> constexpr _Ret _Pair_get(_Pair& _Pr, integral_constant<size_t, 1>) noexcept { return _Pr.second; } template <size_t _Idx, class _Ty1, class _Ty2> [[nodiscard]] constexpr tuple_element_t<_Idx, pair<_Ty1, _Ty2>>& get( pair<_Ty1, _Ty2>& _Pr) noexcept { using _Rtype = tuple_element_t<_Idx, pair<_Ty1, _Ty2>>&; return _Pair_get<_Rtype>(_Pr, integral_constant<size_t, _Idx>{}); } template <class _Ty1, class _Ty2> [[nodiscard]] constexpr _Ty1& get(pair<_Ty1, _Ty2>& _Pr) noexcept { return ::std:: get<0>(_Pr); } template <class _Ty2, class _Ty1> [[nodiscard]] constexpr _Ty2& get(pair<_Ty1, _Ty2>& _Pr) noexcept { return ::std:: get<1>(_Pr); } template <size_t _Idx, class _Ty1, class _Ty2> [[nodiscard]] constexpr const tuple_element_t<_Idx, pair<_Ty1, _Ty2>>& get( const pair<_Ty1, _Ty2>& _Pr) noexcept { using _Ctype = const tuple_element_t<_Idx, pair<_Ty1, _Ty2>>&; return _Pair_get<_Ctype>(_Pr, integral_constant<size_t, _Idx>{}); } template <class _Ty1, class _Ty2> [[nodiscard]] constexpr const _Ty1& get( const pair<_Ty1, _Ty2>& _Pr) noexcept { return ::std:: get<0>(_Pr); } template <class _Ty2, class _Ty1> [[nodiscard]] constexpr const _Ty2& get( const pair<_Ty1, _Ty2>& _Pr) noexcept { return ::std:: get<1>(_Pr); } template <size_t _Idx, class _Ty1, class _Ty2> [[nodiscard]] constexpr tuple_element_t<_Idx, pair<_Ty1, _Ty2>>&& get( pair<_Ty1, _Ty2>&& _Pr) noexcept { using _RRtype = tuple_element_t<_Idx, pair<_Ty1, _Ty2>>&&; return ::std:: forward<_RRtype>(::std:: get<_Idx>(_Pr)); } template <class _Ty1, class _Ty2> [[nodiscard]] constexpr _Ty1&& get(pair<_Ty1, _Ty2>&& _Pr) noexcept { return ::std:: get<0>(::std:: move(_Pr)); } template <class _Ty2, class _Ty1> [[nodiscard]] constexpr _Ty2&& get(pair<_Ty1, _Ty2>&& _Pr) noexcept { return ::std:: get<1>(::std:: move(_Pr)); } template <size_t _Idx, class _Ty1, class _Ty2> [[nodiscard]] constexpr const tuple_element_t<_Idx, pair<_Ty1, _Ty2>>&& get( const pair<_Ty1, _Ty2>&& _Pr) noexcept { using _RRtype = const tuple_element_t<_Idx, pair<_Ty1, _Ty2>>&&; return ::std:: forward<_RRtype>(::std:: get<_Idx>(_Pr)); } template <class _Ty1, class _Ty2> [[nodiscard]] constexpr const _Ty1&& get( const pair<_Ty1, _Ty2>&& _Pr) noexcept { return ::std:: get<0>(::std:: move(_Pr)); } template <class _Ty2, class _Ty1> [[nodiscard]] constexpr const _Ty2&& get( const pair<_Ty1, _Ty2>&& _Pr) noexcept { return ::std:: get<1>(::std:: move(_Pr)); } template <class _Ty, class _Other = _Ty> constexpr _Ty exchange(_Ty& _Val, _Other&& _New_val) noexcept( conjunction_v<is_nothrow_move_constructible<_Ty>, is_nothrow_assignable<_Ty&, _Other>>) { _Ty _Old_val = static_cast<_Ty&&>(_Val); _Val = static_cast<_Other&&>(_New_val); return _Old_val; } template <class _Ty> [[nodiscard]] constexpr add_const_t<_Ty>& as_const(_Ty& _Val) noexcept { return _Val; } template <class _Ty> void as_const(const _Ty&&) = delete; struct in_place_t { explicit in_place_t() = default; }; inline constexpr in_place_t in_place{}; template <class> struct in_place_type_t { explicit in_place_type_t() = default; }; template <class _Ty> inline constexpr in_place_type_t<_Ty> in_place_type{}; template <size_t> struct in_place_index_t { explicit in_place_index_t() = default; }; template <size_t _Idx> inline constexpr in_place_index_t<_Idx> in_place_index{}; template <class _Ty> inline constexpr bool _Is_standard_integer = is_integral_v<_Ty> && !_Is_any_of_v<remove_cv_t<_Ty>, bool, char, wchar_t, char8_t, char16_t, char32_t>; template <class _Ty1, class _Ty2> [[nodiscard]] constexpr bool cmp_equal(const _Ty1 _Left, const _Ty2 _Right) noexcept { static_assert(_Is_standard_integer<_Ty1> && _Is_standard_integer<_Ty2>, "The integer comparison functions only accept standard and extended integer types."); if constexpr (is_signed_v<_Ty1> == is_signed_v<_Ty2>) { return _Left == _Right; } else if constexpr (is_signed_v<_Ty2>) { return _Left == static_cast<make_unsigned_t<_Ty2>>(_Right) && _Right >= 0; } else { return static_cast<make_unsigned_t<_Ty1>>(_Left) == _Right && _Left >= 0; } } template <class _Ty1, class _Ty2> [[nodiscard]] constexpr bool cmp_not_equal(const _Ty1 _Left, const _Ty2 _Right) noexcept { return !::std:: cmp_equal(_Left, _Right); } template <class _Ty1, class _Ty2> [[nodiscard]] constexpr bool cmp_less(const _Ty1 _Left, const _Ty2 _Right) noexcept { static_assert(_Is_standard_integer<_Ty1> && _Is_standard_integer<_Ty2>, "The integer comparison functions only accept standard and extended integer types."); if constexpr (is_signed_v<_Ty1> == is_signed_v<_Ty2>) { return _Left < _Right; } else if constexpr (is_signed_v<_Ty2>) { return _Right > 0 && _Left < static_cast<make_unsigned_t<_Ty2>>(_Right); } else { return _Left < 0 || static_cast<make_unsigned_t<_Ty1>>(_Left) < _Right; } } template <class _Ty1, class _Ty2> [[nodiscard]] constexpr bool cmp_greater(const _Ty1 _Left, const _Ty2 _Right) noexcept { return ::std:: cmp_less(_Right, _Left); } template <class _Ty1, class _Ty2> [[nodiscard]] constexpr bool cmp_less_equal(const _Ty1 _Left, const _Ty2 _Right) noexcept { return !::std:: cmp_less(_Right, _Left); } template <class _Ty1, class _Ty2> [[nodiscard]] constexpr bool cmp_greater_equal(const _Ty1 _Left, const _Ty2 _Right) noexcept { return !::std:: cmp_less(_Left, _Right); } template <class _Ty> [[nodiscard]] consteval _Ty _Min_limit() noexcept { static_assert(_Is_standard_integer<_Ty>); if constexpr (is_signed_v<_Ty>) { constexpr auto _Unsigned_max = static_cast<make_unsigned_t<_Ty>>(-1); return static_cast<_Ty>((_Unsigned_max >> 1) + 1); } else { return 0; } } template <class _Ty> [[nodiscard]] consteval _Ty _Max_limit() noexcept { static_assert(_Is_standard_integer<_Ty>); if constexpr (is_signed_v<_Ty>) { constexpr auto _Unsigned_max = static_cast<make_unsigned_t<_Ty>>(-1); return static_cast<_Ty>(_Unsigned_max >> 1); } else { return static_cast<_Ty>(-1); } } template <class _Rx, class _Ty> [[nodiscard]] constexpr bool in_range(const _Ty _Value) noexcept { static_assert(_Is_standard_integer<_Rx> && _Is_standard_integer<_Ty>, "The integer comparison functions only accept standard and extended integer types."); constexpr auto _Ty_min = _Min_limit<_Ty>(); constexpr auto _Rx_min = _Min_limit<_Rx>(); if constexpr (::std:: cmp_less(_Ty_min, _Rx_min)) { if (_Value < _Ty{_Rx_min}) { return false; } } constexpr auto _Ty_max = _Max_limit<_Ty>(); constexpr auto _Rx_max = _Max_limit<_Rx>(); if constexpr (::std:: cmp_greater(_Ty_max, _Rx_max)) { if (_Value > _Ty{_Rx_max}) { return false; } } return true; } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) extern "C" { __declspec(noalias) void __cdecl __std_reverse_trivially_swappable_1(void* _First, void* _Last) noexcept; __declspec(noalias) void __cdecl __std_reverse_trivially_swappable_2(void* _First, void* _Last) noexcept; __declspec(noalias) void __cdecl __std_reverse_trivially_swappable_4(void* _First, void* _Last) noexcept; __declspec(noalias) void __cdecl __std_reverse_trivially_swappable_8(void* _First, void* _Last) noexcept; __declspec(noalias) void __cdecl __std_swap_ranges_trivially_swappable_noalias( void* _First1, void* _Last1, void* _First2) noexcept; } namespace std { template <class _To, class _From, enable_if_t<conjunction_v<bool_constant<sizeof(_To) == sizeof(_From)>, is_trivially_copyable<_To>, is_trivially_copyable<_From>>, int> = 0> [[nodiscard]] constexpr _To _Bit_cast(const _From& _Val) noexcept { return __builtin_bit_cast(_To, _Val); } template <class _Ty> struct _Get_first_parameter; template <template <class, class...> class _Ty, class _First, class... _Rest> struct _Get_first_parameter<_Ty<_First, _Rest...>> { using type = _First; }; template <class _Newfirst, class _Ty> struct _Replace_first_parameter; template <class _Newfirst, template <class, class...> class _Ty, class _First, class... _Rest> struct _Replace_first_parameter<_Newfirst, _Ty<_First, _Rest...>> { using type = _Ty<_Newfirst, _Rest...>; }; template <class _Ty, class = void> struct _Get_element_type { using type = typename _Get_first_parameter<_Ty>::type; }; template <class _Ty> struct _Get_element_type<_Ty, void_t<typename _Ty::element_type>> { using type = typename _Ty::element_type; }; template <class _Ty, class = void> struct _Get_ptr_difference_type { using type = ptrdiff_t; }; template <class _Ty> struct _Get_ptr_difference_type<_Ty, void_t<typename _Ty::difference_type>> { using type = typename _Ty::difference_type; }; template <class _Ty, class _Other, class = void> struct _Get_rebind_alias { using type = typename _Replace_first_parameter<_Other, _Ty>::type; }; template <class _Ty, class _Other> struct _Get_rebind_alias<_Ty, _Other, void_t<typename _Ty::template rebind<_Other>>> { using type = typename _Ty::template rebind<_Other>; }; template <class _Iter> [[nodiscard]] constexpr void* _Voidify_iter(_Iter _It) noexcept { if constexpr (is_pointer_v<_Iter>) { return const_cast<void*>(static_cast<const volatile void*>(_It)); } else { return const_cast<void*>(static_cast<const volatile void*>(::std:: addressof(*_It))); } } template <class _Ty, class... _Types, class = void_t<decltype(::new (::std:: declval<void*>()) _Ty(::std:: declval<_Types>()...))>> constexpr _Ty* construct_at(_Ty* const _Location, _Types&&... _Args) noexcept( noexcept(::new (_Voidify_iter(_Location)) _Ty(::std:: forward<_Types>(_Args)...))) { return ::new (_Voidify_iter(_Location)) _Ty(::std:: forward<_Types>(_Args)...); } template <class _Ty, class... _Types> constexpr void _Construct_in_place(_Ty& _Obj, _Types&&... _Args) noexcept( is_nothrow_constructible_v<_Ty, _Types...>) { if (::std:: is_constant_evaluated()) { ::std:: construct_at(::std:: addressof(_Obj), ::std:: forward<_Types>(_Args)...); } else { ::new (_Voidify_iter(::std:: addressof(_Obj))) _Ty(::std:: forward<_Types>(_Args)...); } } template <class _Ty> void _Default_construct_in_place(_Ty& _Obj) noexcept(is_nothrow_default_constructible_v<_Ty>) { ::new (_Voidify_iter(::std:: addressof(_Obj))) _Ty; } template <class _Ty> struct pointer_traits { using pointer = _Ty; using element_type = typename _Get_element_type<_Ty>::type; using difference_type = typename _Get_ptr_difference_type<_Ty>::type; template <class _Other> using rebind = typename _Get_rebind_alias<_Ty, _Other>::type; using _Reftype = conditional_t<is_void_v<element_type>, char, element_type>&; [[nodiscard]] static pointer pointer_to(_Reftype _Val) noexcept(noexcept(_Ty::pointer_to(_Val))) { return _Ty::pointer_to(_Val); } }; template <class _Ty> struct pointer_traits<_Ty*> { using pointer = _Ty*; using element_type = _Ty; using difference_type = ptrdiff_t; template <class _Other> using rebind = _Other*; using _Reftype = conditional_t<is_void_v<_Ty>, char, _Ty>&; [[nodiscard]] static constexpr pointer pointer_to(_Reftype _Val) noexcept { return ::std:: addressof(_Val); } }; template <class _Ty, class = void> inline constexpr bool _Has_to_address_v = false; template <class _Ty> inline constexpr bool _Has_to_address_v<_Ty, void_t<decltype(pointer_traits<_Ty>::to_address(::std:: declval<const _Ty&>()))>> = true; template <class _Ty> [[nodiscard]] constexpr _Ty* to_address(_Ty* const _Val) noexcept { static_assert(!is_function_v<_Ty>, "N4810 20.10.4 [pointer.conversion]/2: The program is ill-formed if T is a function type."); return _Val; } template <class _Ptr> [[nodiscard]] constexpr auto to_address(const _Ptr& _Val) noexcept { if constexpr (_Has_to_address_v<_Ptr>) { return pointer_traits<_Ptr>::to_address(_Val); } else { return ::std:: to_address(_Val.operator->()); } } struct identity { template <class _Ty> [[nodiscard]] constexpr _Ty&& operator()(_Ty&& _Left) const noexcept { return ::std:: forward<_Ty>(_Left); } using is_transparent = int; }; template <class _Fx> struct _Ref_fn { template <class... _Args> constexpr decltype(auto) operator()(_Args&&... _Vals) { if constexpr (is_member_pointer_v<_Fx>) { return ::std:: invoke(_Fn, ::std:: forward<_Args>(_Vals)...); } else { return _Fn(::std:: forward<_Args>(_Vals)...); } } _Fx& _Fn; }; template <class _Fn> inline constexpr bool _Pass_functor_by_value_v = conjunction_v<bool_constant<sizeof(_Fn) <= sizeof(void*)>, is_trivially_copy_constructible<_Fn>, is_trivially_destructible<_Fn>>; template <class _Fn, enable_if_t<_Pass_functor_by_value_v<_Fn>, int> = 0> constexpr _Fn _Pass_fn(_Fn _Val) { return _Val; } template <class _Fn, enable_if_t<!_Pass_functor_by_value_v<_Fn>, int> = 0> constexpr _Ref_fn<_Fn> _Pass_fn(_Fn& _Val) { return {_Val}; } struct _Unused_parameter { constexpr _Unused_parameter() noexcept = default; template <class _Ty> constexpr _Unused_parameter(_Ty&&) noexcept {} }; using _Any_tag = _Unused_parameter; template <class _Ty> using _Algorithm_int_t = conditional_t<is_integral_v<_Ty>, _Ty, ptrdiff_t>; struct input_iterator_tag {}; struct output_iterator_tag {}; struct forward_iterator_tag : input_iterator_tag {}; struct bidirectional_iterator_tag : forward_iterator_tag {}; struct random_access_iterator_tag : bidirectional_iterator_tag {}; struct contiguous_iterator_tag : random_access_iterator_tag {}; template <class _Ty> using _With_reference = _Ty&; template <class _Ty> concept _Can_reference = requires { typename _With_reference<_Ty>; }; template <class _Ty> concept _Dereferenceable = requires(_Ty& __t) { { *__t } -> _Can_reference; }; template <class _Ty> concept _Has_member_iterator_concept = requires { typename _Ty::iterator_concept; }; template <class _Ty> concept _Has_member_iterator_category = requires { typename _Ty::iterator_category; }; template <class _Ty> concept _Has_member_value_type = requires { typename _Ty::value_type; }; template <class _Ty> concept _Has_member_element_type = requires { typename _Ty::element_type; }; template <class _Ty> concept _Has_member_difference_type = requires { typename _Ty::difference_type; }; template <class _Ty> concept _Has_member_pointer = requires { typename _Ty::pointer; }; template <class _Ty> concept _Has_member_reference = requires { typename _Ty::reference; }; template <class> struct incrementable_traits {}; template <class _Ty> requires is_object_v<_Ty> struct incrementable_traits<_Ty*> { using difference_type = ptrdiff_t; }; template <class _Ty> struct incrementable_traits<const _Ty> : incrementable_traits<_Ty> {}; template <_Has_member_difference_type _Ty> struct incrementable_traits<_Ty> { using difference_type = typename _Ty::difference_type; }; template <class _Ty> concept _Can_difference = requires(const _Ty& __a, const _Ty& __b) { { __a - __b } -> integral; }; template <class _Ty> requires (!_Has_member_difference_type<_Ty> && _Can_difference<_Ty>) struct incrementable_traits<_Ty> { using difference_type = make_signed_t<decltype(::std:: declval<_Ty>() - ::std:: declval<_Ty>())>; }; template <class _Ty> concept _Is_from_primary = _Same_impl<typename _Ty::_From_primary, _Ty>; template <class> struct iterator_traits; template <class _Ty> using iter_difference_t = typename conditional_t<_Is_from_primary<iterator_traits<remove_cvref_t<_Ty>>>, incrementable_traits<remove_cvref_t<_Ty>>, iterator_traits<remove_cvref_t<_Ty>>>::difference_type; template <class> struct _Cond_value_type {}; template <class _Ty> requires is_object_v<_Ty> struct _Cond_value_type<_Ty> { using value_type = remove_cv_t<_Ty>; }; template <class> struct indirectly_readable_traits {}; template <class _Ty> struct indirectly_readable_traits<_Ty*> : _Cond_value_type<_Ty> {}; template <class _Ty> requires is_array_v<_Ty> struct indirectly_readable_traits<_Ty> { using value_type = remove_cv_t<remove_extent_t<_Ty>>; }; template <class _Ty> struct indirectly_readable_traits<const _Ty> : indirectly_readable_traits<_Ty> {}; template <_Has_member_value_type _Ty> struct indirectly_readable_traits<_Ty> : _Cond_value_type<typename _Ty::value_type> {}; template <_Has_member_element_type _Ty> struct indirectly_readable_traits<_Ty> : _Cond_value_type<typename _Ty::element_type> {}; template <_Has_member_value_type _Ty> requires _Has_member_element_type<_Ty> && same_as<remove_cv_t<typename _Ty::value_type>, remove_cv_t<typename _Ty::element_type>> struct indirectly_readable_traits<_Ty> : _Cond_value_type<typename _Ty::value_type> {}; template <class _Ty> using iter_value_t = typename conditional_t<_Is_from_primary<iterator_traits<remove_cvref_t<_Ty>>>, indirectly_readable_traits<remove_cvref_t<_Ty>>, iterator_traits<remove_cvref_t<_Ty>>>::value_type; template <_Dereferenceable _Ty> using iter_reference_t = decltype(*::std:: declval<_Ty&>()); template <class> struct _Iterator_traits_base {}; template <class _It> concept _Has_iter_types = _Has_member_difference_type<_It> && _Has_member_value_type<_It> && _Has_member_reference<_It> && _Has_member_iterator_category<_It>; template <bool _Has_member_typedef> struct _Old_iter_traits_pointer { template <class _It> using _Apply = typename _It::pointer; }; template <> struct _Old_iter_traits_pointer<false> { template <class> using _Apply = void; }; template <_Has_iter_types _It> struct _Iterator_traits_base<_It> { using iterator_category = typename _It::iterator_category; using difference_type = typename _It::difference_type; using value_type = typename _It::value_type; using pointer = typename _Old_iter_traits_pointer<_Has_member_pointer<_It>>::template _Apply<_It>; using reference = typename _It::reference; }; template <bool _Has_member_typedef> struct _Iter_traits_difference { template <class _It> using _Apply = typename incrementable_traits<_It>::difference_type; }; template <> struct _Iter_traits_difference<false> { template <class> using _Apply = void; }; template <class _It> concept _Cpp17_iterator = requires(_It __i) { { *__i } -> _Can_reference; { ++__i } -> same_as<_It&>; { *__i++ } -> _Can_reference; } && copyable<_It>; template <class _It> concept _Cpp17_input_iterator = _Cpp17_iterator<_It> && equality_comparable<_It> && _Has_member_difference_type<incrementable_traits<_It>> && _Has_member_value_type<indirectly_readable_traits<_It>> && requires(_It __i) { typename common_reference_t<iter_reference_t<_It>&&, typename indirectly_readable_traits<_It>::value_type&>; typename common_reference_t<decltype(*__i++)&&, typename indirectly_readable_traits<_It>::value_type&>; requires signed_integral<typename incrementable_traits<_It>::difference_type>; }; template <class _It> requires (!_Has_iter_types<_It> && _Cpp17_iterator<_It> && !_Cpp17_input_iterator<_It> && (!requires { typename _It::iterator_category; } || derived_from<typename _It::iterator_category, output_iterator_tag>)) struct _Iterator_traits_base<_It> { using iterator_category = output_iterator_tag; using difference_type = typename _Iter_traits_difference<_Has_member_difference_type<incrementable_traits<_It>>>::template _Apply<_It>; using value_type = void; using pointer = void; using reference = void; }; enum class _Itraits_pointer_strategy { _Use_void, _Use_member, _Use_decltype }; template <_Itraits_pointer_strategy> struct _Iter_traits_pointer; template <> struct _Iter_traits_pointer<_Itraits_pointer_strategy::_Use_void> { template <class> using _Apply = void; }; template <> struct _Iter_traits_pointer<_Itraits_pointer_strategy::_Use_member> { template <class _It> using _Apply = typename _It::pointer; }; template <> struct _Iter_traits_pointer<_Itraits_pointer_strategy::_Use_decltype> { template <class _It> using _Apply = decltype(::std:: declval<_It&>().operator->()); }; template <class _Ty> concept _Has_member_arrow = requires(_Ty&& __t) { static_cast<_Ty&&>(__t).operator->(); }; template <bool _Has_member_typedef> struct _Iter_traits_reference { template <class _It> using _Apply = typename _It::reference; }; template <> struct _Iter_traits_reference<false> { template <class _It> using _Apply = iter_reference_t<_It>; }; template <bool _Is_random> struct _Iter_traits_category4 { using type = random_access_iterator_tag; }; template <> struct _Iter_traits_category4<false> { using type = bidirectional_iterator_tag; }; template <class _It> concept _Cpp17_random_delta = totally_ordered<_It> && requires(_It __i, typename incrementable_traits<_It>::difference_type __n) { { __i += __n } -> same_as<_It&>; { __i -= __n } -> same_as<_It&>; { __i + __n } -> same_as<_It>; { __n + __i } -> same_as<_It>; { __i - __n } -> same_as<_It>; { __i - __i } -> same_as<decltype(__n)>; { __i[__n] } -> convertible_to<iter_reference_t<_It>>; }; template <bool _Is_bidi> struct _Iter_traits_category3 { template <class _It> using _Apply = typename _Iter_traits_category4<_Cpp17_random_delta<_It>>::type; }; template <> struct _Iter_traits_category3<false> { template <class> using _Apply = forward_iterator_tag; }; template <class _It> concept _Cpp17_bidi_delta = requires(_It __i) { { --__i } -> same_as<_It&>; { __i-- } -> convertible_to<const _It&>; requires same_as<decltype(*__i--), iter_reference_t<_It>>; }; template <bool _Is_forward> struct _Iter_traits_category2 { template <class _It> using _Apply = typename _Iter_traits_category3<_Cpp17_bidi_delta<_It>>::template _Apply<_It>; }; template <> struct _Iter_traits_category2<false> { template <class> using _Apply = input_iterator_tag; }; template <class _It> concept _Cpp17_forward_delta = constructible_from<_It> && is_lvalue_reference_v<iter_reference_t<_It>> && same_as<remove_cvref_t<iter_reference_t<_It>>, typename indirectly_readable_traits<_It>::value_type> && requires(_It __i) { { __i++ } -> convertible_to<const _It&>; requires same_as<decltype(*__i++), iter_reference_t<_It>>; }; template <bool _Has_member_typedef> struct _Iter_traits_category { template <class _It> using _Apply = typename _It::iterator_category; }; template <> struct _Iter_traits_category<false> { template <class _It> using _Apply = typename _Iter_traits_category2<_Cpp17_forward_delta<_It>>::template _Apply<_It>; }; template <class _It> requires (!_Has_iter_types<_It> && _Cpp17_input_iterator<_It>) struct _Iterator_traits_base<_It> { using iterator_category = typename _Iter_traits_category<_Has_member_iterator_category<_It>>::template _Apply<_It>; using difference_type = typename incrementable_traits<_It>::difference_type; using value_type = typename indirectly_readable_traits<_It>::value_type; using pointer = typename _Iter_traits_pointer<( _Has_member_pointer<_It> ? _Itraits_pointer_strategy::_Use_member : _Has_member_arrow<_It&> ? _Itraits_pointer_strategy::_Use_decltype : _Itraits_pointer_strategy::_Use_void)>::template _Apply<_It>; using reference = typename _Iter_traits_reference<_Has_member_reference<_It>>::template _Apply<_It>; }; template <class _Ty> struct iterator_traits : _Iterator_traits_base<_Ty> { using _From_primary = iterator_traits; }; template <class _Ty> requires is_object_v<_Ty> struct iterator_traits<_Ty*> { using iterator_concept = contiguous_iterator_tag; using iterator_category = random_access_iterator_tag; using value_type = remove_cv_t<_Ty>; using difference_type = ptrdiff_t; using pointer = _Ty*; using reference = _Ty&; }; namespace ranges { namespace _Iter_move { void iter_move(); template <class _Ty> concept _Has_ADL = _Has_class_or_enum_type<_Ty> && requires(_Ty&& __t) { iter_move(static_cast<_Ty&&>(__t)); }; template <class _Ty> concept _Can_deref = requires(_Ty&& __t) { *static_cast<_Ty&&>(__t); }; class _Cpo { private: enum class _St { _None, _Custom, _Fallback }; template <class _Ty> [[nodiscard]] static consteval _Choice_t<_St> _Choose() noexcept { if constexpr (_Has_ADL<_Ty>) { return {_St::_Custom, noexcept(iter_move(::std:: declval<_Ty>()))}; } else if constexpr (_Can_deref<_Ty>) { return {_St::_Fallback, noexcept(*::std:: declval<_Ty>())}; } else { return {_St::_None}; } } template <class _Ty> static constexpr _Choice_t<_St> _Choice = _Choose<_Ty>(); public: template <class _Ty> requires (_Choice<_Ty>._Strategy != _St::_None) [[nodiscard]] constexpr decltype(auto) operator()(_Ty&& _Val) const noexcept(_Choice<_Ty>._No_throw) { constexpr _St _Strat = _Choice<_Ty>._Strategy; if constexpr (_Strat == _St::_Custom) { return iter_move(static_cast<_Ty&&>(_Val)); } else if constexpr (_Strat == _St::_Fallback) { using _Ref = decltype(*static_cast<_Ty&&>(_Val)); if constexpr (is_lvalue_reference_v<_Ref>) { return ::std:: move(*static_cast<_Ty&&>(_Val)); } else { return *static_cast<_Ty&&>(_Val); } } else { static_assert(_Always_false<_Ty>, "should be unreachable"); } } }; } inline namespace _Cpos { inline constexpr _Iter_move::_Cpo iter_move; } } template <class _Ty> requires _Dereferenceable<_Ty> && requires(_Ty& __t) { { ::std::ranges:: iter_move(__t) } -> _Can_reference; } using iter_rvalue_reference_t = decltype(::std::ranges:: iter_move(::std:: declval<_Ty&>())); template <class _It> concept _Indirectly_readable_impl = requires(const _It __i) { typename iter_value_t<_It>; typename iter_reference_t<_It>; typename iter_rvalue_reference_t<_It>; { *__i } -> same_as<iter_reference_t<_It>>; { ::std::ranges:: iter_move(__i) } -> same_as<iter_rvalue_reference_t<_It>>; } && common_reference_with<iter_reference_t<_It>&&, iter_value_t<_It>&> && common_reference_with<iter_reference_t<_It>&&, iter_rvalue_reference_t<_It>&&> && common_reference_with<iter_rvalue_reference_t<_It>&&, const iter_value_t<_It>&>; template <class _It> concept indirectly_readable = _Indirectly_readable_impl<remove_cvref_t<_It>>; template <indirectly_readable _Ty> using iter_common_reference_t = common_reference_t<iter_reference_t<_Ty>, iter_value_t<_Ty>&>; template <class _It, class _Ty> concept indirectly_writable = requires(_It&& __i, _Ty&& __t) { *__i = static_cast<_Ty&&>(__t); *static_cast<_It&&>(__i) = static_cast<_Ty&&>(__t); const_cast<const iter_reference_t<_It>&&>(*__i) = static_cast<_Ty&&>(__t); const_cast<const iter_reference_t<_It>&&>(*static_cast<_It&&>(__i)) = static_cast<_Ty&&>(__t); }; template <class _Ty> concept _Integer_like = _Is_nonbool_integral<remove_cv_t<_Ty>>; template <class _Ty> concept _Signed_integer_like = _Integer_like<_Ty> && static_cast<_Ty>(-1) < static_cast<_Ty>(0); template <class _Ty> using _Make_unsigned_like_t = make_unsigned_t<_Ty>; template <_Integer_like _Ty> [[nodiscard]] constexpr auto _To_unsigned_like(const _Ty _Value) noexcept { return static_cast<_Make_unsigned_like_t<_Ty>>(_Value); } template <class _Ty> using _Make_signed_like_t = make_signed_t<_Ty>; template <_Integer_like _Ty> [[nodiscard]] constexpr auto _To_signed_like(const _Ty _Value) noexcept { return static_cast<_Make_signed_like_t<_Ty>>(_Value); } template <class _Ty> concept weakly_incrementable = default_initializable<_Ty> && movable<_Ty> && requires(_Ty __i) { typename iter_difference_t<_Ty>; requires _Signed_integer_like<iter_difference_t<_Ty>>; { ++__i } -> same_as<_Ty&>; __i++; }; template <class _Ty> concept incrementable = regular<_Ty> && weakly_incrementable<_Ty> && requires(_Ty __t) { { __t++ } -> same_as<_Ty>; }; template <class _It> concept input_or_output_iterator = requires(_It __i) { { *__i } -> _Can_reference; requires weakly_incrementable<_It>; }; template <class _Se, class _It> concept sentinel_for = semiregular<_Se> && input_or_output_iterator<_It> && _Weakly_equality_comparable_with<_Se, _It>; template <class _Se, class _It> inline constexpr bool disable_sized_sentinel_for = false; template <class _Se, class _It> concept sized_sentinel_for = sentinel_for<_Se, _It> && !disable_sized_sentinel_for<remove_cv_t<_Se>, remove_cv_t<_It>> && requires(const _It& __i, const _Se& __s) { { __s - __i } -> same_as<iter_difference_t<_It>>; { __i - __s } -> same_as<iter_difference_t<_It>>; }; template <bool _Iterator_category_present> struct _Iter_concept_impl2 { template <class _It, class _Traits> using _Apply = typename _Traits::iterator_category; }; template <> struct _Iter_concept_impl2<false> { template <class _It, class _Traits> requires _Is_from_primary<iterator_traits<_It>> using _Apply = random_access_iterator_tag; }; template <bool _Iterator_concept_present> struct _Iter_concept_impl1 { template <class _It, class _Traits> using _Apply = typename _Traits::iterator_concept; }; template <> struct _Iter_concept_impl1<false> { template <class _It, class _Traits> using _Apply = typename _Iter_concept_impl2<_Has_member_iterator_category<_Traits>>::template _Apply<_It, _Traits>; }; template <class _It, class _Traits = conditional_t<_Is_from_primary<iterator_traits<_It>>, _It, iterator_traits<_It>>> using _Iter_concept = typename _Iter_concept_impl1<_Has_member_iterator_concept<_Traits>>::template _Apply<_It, _Traits>; template <class _It> concept input_iterator = input_or_output_iterator<_It> && indirectly_readable<_It> && requires { typename _Iter_concept<_It>; } && derived_from<_Iter_concept<_It>, input_iterator_tag>; template <class _It, class _Ty> concept output_iterator = input_or_output_iterator<_It> && indirectly_writable<_It, _Ty> && requires(_It __i, _Ty&& __t) { *__i++ = static_cast<_Ty&&>(__t); }; template <class _It> concept forward_iterator = input_iterator<_It> && derived_from<_Iter_concept<_It>, forward_iterator_tag> && incrementable<_It> && sentinel_for<_It, _It>; template <class _It> concept bidirectional_iterator = forward_iterator<_It> && derived_from<_Iter_concept<_It>, bidirectional_iterator_tag> && requires(_It __i) { { --__i } -> same_as<_It&>; { __i-- } -> same_as<_It>; }; template <class _It> concept random_access_iterator = bidirectional_iterator<_It> && derived_from<_Iter_concept<_It>, random_access_iterator_tag> && totally_ordered<_It> && sized_sentinel_for<_It, _It> && requires(_It __i, const _It __j, const iter_difference_t<_It> __n) { { __i += __n } -> same_as<_It&>; { __j + __n } -> same_as<_It>; { __n + __j } -> same_as<_It>; { __i -= __n } -> same_as<_It&>; { __j - __n } -> same_as<_It>; { __j[__n] } -> same_as<iter_reference_t<_It>>; }; template <class _It> concept contiguous_iterator = random_access_iterator<_It> && derived_from<_Iter_concept<_It>, contiguous_iterator_tag> && is_lvalue_reference_v<iter_reference_t<_It>> && same_as<iter_value_t<_It>, remove_cvref_t<iter_reference_t<_It>>> && requires(const _It& __i) { { ::std:: to_address(__i) } -> same_as<add_pointer_t<iter_reference_t<_It>>>; }; template <class _Fn, class _It> concept indirectly_unary_invocable = indirectly_readable<_It> && copy_constructible<_Fn> && invocable<_Fn&, iter_value_t<_It>&> && invocable<_Fn&, iter_reference_t<_It>> && invocable<_Fn&, iter_common_reference_t<_It>> && common_reference_with< invoke_result_t<_Fn&, iter_value_t<_It>&>, invoke_result_t<_Fn&, iter_reference_t<_It>>>; template <class _Fn, class _It> concept indirectly_regular_unary_invocable = indirectly_readable<_It> && copy_constructible<_Fn> && regular_invocable<_Fn&, iter_value_t<_It>&> && regular_invocable<_Fn&, iter_reference_t<_It>> && regular_invocable<_Fn&, iter_common_reference_t<_It>> && common_reference_with< invoke_result_t<_Fn&, iter_value_t<_It>&>, invoke_result_t<_Fn&, iter_reference_t<_It>>>; template <class _Fn, class _It> concept indirect_unary_predicate = indirectly_readable<_It> && copy_constructible<_Fn> && predicate<_Fn&, iter_value_t<_It>&> && predicate<_Fn&, iter_reference_t<_It>> && predicate<_Fn&, iter_common_reference_t<_It>>; template <class _Fn, class _It1, class _It2> concept indirect_binary_predicate = indirectly_readable<_It1> && indirectly_readable<_It2> && copy_constructible<_Fn> && predicate<_Fn&, iter_value_t<_It1>&, iter_value_t<_It2>&> && predicate<_Fn&, iter_value_t<_It1>&, iter_reference_t<_It2>> && predicate<_Fn&, iter_reference_t<_It1>, iter_value_t<_It2>&> && predicate<_Fn&, iter_reference_t<_It1>, iter_reference_t<_It2>> && predicate<_Fn&, iter_common_reference_t<_It1>, iter_common_reference_t<_It2>>; template <class _Fn, class _It1, class _It2 = _It1> concept indirect_equivalence_relation = indirectly_readable<_It1> && indirectly_readable<_It2> && copy_constructible<_Fn> && equivalence_relation<_Fn&, iter_value_t<_It1>&, iter_value_t<_It2>&> && equivalence_relation<_Fn&, iter_value_t<_It1>&, iter_reference_t<_It2>> && equivalence_relation<_Fn&, iter_reference_t<_It1>, iter_value_t<_It2>&> && equivalence_relation<_Fn&, iter_reference_t<_It1>, iter_reference_t<_It2>> && equivalence_relation<_Fn&, iter_common_reference_t<_It1>, iter_common_reference_t<_It2>>; template <class _Fn, class _It1, class _It2 = _It1> concept indirect_strict_weak_order = indirectly_readable<_It1> && indirectly_readable<_It2> && copy_constructible<_Fn> && strict_weak_order<_Fn&, iter_value_t<_It1>&, iter_value_t<_It2>&> && strict_weak_order<_Fn&, iter_value_t<_It1>&, iter_reference_t<_It2>> && strict_weak_order<_Fn&, iter_reference_t<_It1>, iter_value_t<_It2>&> && strict_weak_order<_Fn&, iter_reference_t<_It1>, iter_reference_t<_It2>> && strict_weak_order<_Fn&, iter_common_reference_t<_It1>, iter_common_reference_t<_It2>>; template <class _Fn, class... _Its> requires (indirectly_readable<_Its> && ...) && invocable<_Fn, iter_reference_t<_Its>...> using indirect_result_t = invoke_result_t<_Fn, iter_reference_t<_Its>...>; #pragma warning(push) #pragma warning(disable : 5046) template <indirectly_readable _It, indirectly_regular_unary_invocable<_It> _Proj> struct projected { using value_type = remove_cvref_t<indirect_result_t<_Proj&, _It>>; indirect_result_t<_Proj&, _It> operator*() const { :: abort(); } }; #pragma warning(pop) template <weakly_incrementable _It, class _Proj> struct incrementable_traits<projected<_It, _Proj>> { using difference_type = iter_difference_t<_It>; }; template <class _In, class _Out> concept indirectly_movable = indirectly_readable<_In> && indirectly_writable<_Out, iter_rvalue_reference_t<_In>>; template <class _In, class _Out> concept indirectly_movable_storable = indirectly_movable<_In, _Out> && indirectly_writable<_Out, iter_value_t<_In>> && movable<iter_value_t<_In>> && constructible_from<iter_value_t<_In>, iter_rvalue_reference_t<_In>> && assignable_from<iter_value_t<_In>&, iter_rvalue_reference_t<_In>>; template <class _In, class _Out> concept indirectly_copyable = indirectly_readable<_In> && indirectly_writable<_Out, iter_reference_t<_In>>; template <class _In, class _Out> concept indirectly_copyable_storable = indirectly_copyable<_In, _Out> && indirectly_writable<_Out, iter_value_t<_In>&> && indirectly_writable<_Out, const iter_value_t<_In>&> && indirectly_writable<_Out, iter_value_t<_In>&&> && indirectly_writable<_Out, const iter_value_t<_In>&&> && copyable<iter_value_t<_In>> && constructible_from<iter_value_t<_In>, iter_reference_t<_In>> && assignable_from<iter_value_t<_In>&, iter_reference_t<_In>>; namespace ranges { namespace _Iter_swap { template <class _Ty1, class _Ty2> void iter_swap(_Ty1, _Ty2) = delete; template <class _Ty1, class _Ty2> concept _Has_ADL = (_Has_class_or_enum_type<_Ty1> || _Has_class_or_enum_type<_Ty2>) && requires(_Ty1&& __t1, _Ty2&& __t2) { iter_swap(static_cast<_Ty1&&>(__t1), static_cast<_Ty2&&>(__t2)); }; template <class _Ty1, class _Ty2> concept _Can_swap_references = indirectly_readable<remove_reference_t<_Ty1>> && indirectly_readable<remove_reference_t<_Ty2>> && swappable_with<iter_reference_t<_Ty1>, iter_reference_t<_Ty2>>; template <class _Ty1, class _Ty2> concept _Symmetric_indirectly_movable_storable = indirectly_movable_storable<remove_reference_t<_Ty1>, remove_reference_t<_Ty2>> && indirectly_movable_storable<remove_reference_t<_Ty2>, remove_reference_t<_Ty1>>; template <class _Xty, class _Yty> [[nodiscard]] constexpr iter_value_t<remove_reference_t<_Xty>> _Iter_exchange_move(_Xty&& _XVal, _Yty&& _YVal) noexcept(noexcept(iter_value_t<remove_reference_t<_Xty>>(::std::ranges:: iter_move(_XVal)))) { iter_value_t<remove_reference_t<_Xty>> _Tmp(::std::ranges:: iter_move(_XVal)); *_XVal = ::std::ranges:: iter_move(_YVal); return _Tmp; } class _Cpo { private: enum class _St { _None, _Custom, _Swap, _Exchange }; template <class _Ty1, class _Ty2> [[nodiscard]] static consteval _Choice_t<_St> _Choose() noexcept { if constexpr (_Has_ADL<_Ty1, _Ty2>) { return {_St::_Custom, noexcept(iter_swap(::std:: declval<_Ty1>(), ::std:: declval<_Ty2>()))}; } else if constexpr (_Can_swap_references<_Ty1, _Ty2>) { return {_St::_Swap, noexcept(::std::ranges:: swap(*::std:: declval<_Ty1>(), *::std:: declval<_Ty2>()))}; } else if constexpr (_Symmetric_indirectly_movable_storable<_Ty1, _Ty2>) { constexpr auto _Nothrow = noexcept( *::std:: declval<_Ty1>() = _Iter_exchange_move(::std:: declval<_Ty2>(), ::std:: declval<_Ty1>())); return {_St::_Exchange, _Nothrow}; } else { return {_St::_None}; } } template <class _Ty1, class _Ty2> static constexpr _Choice_t<_St> _Choice = _Choose<_Ty1, _Ty2>(); public: template <class _Ty1, class _Ty2> requires (_Choice<_Ty1, _Ty2>._Strategy != _St::_None) constexpr void operator()(_Ty1&& _Val1, _Ty2&& _Val2) const noexcept(_Choice<_Ty1, _Ty2>._No_throw) { constexpr _St _Strat = _Choice<_Ty1, _Ty2>._Strategy; if constexpr (_Strat == _St::_Custom) { iter_swap(static_cast<_Ty1&&>(_Val1), static_cast<_Ty2&&>(_Val2)); } else if constexpr (_Strat == _St::_Swap) { ::std::ranges:: swap(*static_cast<_Ty1&&>(_Val1), *static_cast<_Ty2&&>(_Val2)); } else if constexpr (_Strat == _St::_Exchange) { *static_cast<_Ty1&&>(_Val1) = _Iter_exchange_move(static_cast<_Ty2&&>(_Val2), static_cast<_Ty1&&>(_Val1)); } else { static_assert(_Always_false<_Ty1>, "should be unreachable"); } } }; } inline namespace _Cpos { inline constexpr _Iter_swap::_Cpo iter_swap; } } template <class _It1, class _It2 = _It1> concept indirectly_swappable = indirectly_readable<_It1> && indirectly_readable<_It2> && requires(const _It1 __i1, const _It2 __i2) { ::std::ranges:: iter_swap(__i1, __i1); ::std::ranges:: iter_swap(__i2, __i2); ::std::ranges:: iter_swap(__i1, __i2); ::std::ranges:: iter_swap(__i2, __i1); }; template <class _It1, class _It2, class _Rel, class _Proj1 = identity, class _Proj2 = identity> concept indirectly_comparable = indirect_binary_predicate<_Rel, projected<_It1, _Proj1>, projected<_It2, _Proj2>>; template <class _It> concept permutable = forward_iterator<_It> && indirectly_movable_storable<_It, _It> && indirectly_swappable<_It, _It>; namespace ranges { struct less; } template <class _It1, class _It2, class _Out, class _Pr = ranges::less, class _Pj1 = identity, class _Pj2 = identity> concept mergeable = input_iterator<_It1> && input_iterator<_It2> && weakly_incrementable<_Out> && indirectly_copyable<_It1, _Out> && indirectly_copyable<_It2, _Out> && indirect_strict_weak_order<_Pr, projected<_It1, _Pj1>, projected<_It2, _Pj2>>; template <class _It, class _Pr = ranges::less, class _Proj = identity> concept sortable = permutable<_It> && indirect_strict_weak_order<_Pr, projected<_It, _Proj>>; template <class _Iter> using _Iter_ref_t = iter_reference_t<_Iter>; template <class _Iter> using _Iter_value_t = iter_value_t<_Iter>; template <class _Iter> using _Iter_diff_t = iter_difference_t<_Iter>; template <class... _Iters> using _Common_diff_t = common_type_t<_Iter_diff_t<_Iters>...>; template <class _Iter> using _Iter_cat_t = typename iterator_traits<_Iter>::iterator_category; template <class _Ty, class = void> inline constexpr bool _Is_iterator_v = false; template <class _Ty> inline constexpr bool _Is_iterator_v<_Ty, void_t<_Iter_cat_t<_Ty>>> = true; template <class _Ty> struct _Is_iterator : bool_constant<_Is_iterator_v<_Ty>> {}; template <class _Iter> inline constexpr bool _Is_input_iter_v = is_convertible_v<_Iter_cat_t<_Iter>, input_iterator_tag>; template <class _Iter> inline constexpr bool _Is_fwd_iter_v = is_convertible_v<_Iter_cat_t<_Iter>, forward_iterator_tag>; template <class _Iter> inline constexpr bool _Is_bidi_iter_v = is_convertible_v<_Iter_cat_t<_Iter>, bidirectional_iterator_tag>; template <class _Iter> inline constexpr bool _Is_random_iter_v = is_convertible_v<_Iter_cat_t<_Iter>, random_access_iterator_tag>; template <class, class = void> struct _Is_checked_helper {}; template <class _Ty> constexpr void _Verify_range(const _Ty* const _First, const _Ty* const _Last) noexcept { do { if (_First <= _Last) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 1287, 0, "%s", "transposed pointer range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"transposed pointer range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 1287, 0); } while (false); } ; } while (false); } template <class _Iter, class = void> inline constexpr bool _Allow_inheriting_unwrap_v = true; template <class _Iter> inline constexpr bool _Allow_inheriting_unwrap_v<_Iter, void_t<typename _Iter::_Prevent_inheriting_unwrap>> = is_same_v<_Iter, typename _Iter::_Prevent_inheriting_unwrap>; template <class _Iter, class _Sentinel = _Iter, class = void> inline constexpr bool _Range_verifiable_v = false; template <class _Iter, class _Sentinel> inline constexpr bool _Range_verifiable_v<_Iter, _Sentinel, void_t<decltype(_Verify_range(::std:: declval<const _Iter&>(), ::std:: declval<const _Sentinel&>()))>> = _Allow_inheriting_unwrap_v<_Iter>; template <class _Iter, class _Sentinel> constexpr void _Adl_verify_range(const _Iter& _First, const _Sentinel& _Last) { if constexpr (_Range_verifiable_v<_Iter, _Sentinel>) { _Verify_range(_First, _Last); } } template <class _Iter, class = void> inline constexpr bool _Unwrappable_v = false; template <class _Iter> inline constexpr bool _Unwrappable_v<_Iter, void_t<decltype(::std:: declval<_Remove_cvref_t<_Iter>&>()._Seek_to(::std:: declval<_Iter>()._Unwrapped()))>> = _Allow_inheriting_unwrap_v<_Remove_cvref_t<_Iter>>; template <class _Iter> [[nodiscard]] constexpr decltype(auto) _Get_unwrapped(_Iter&& _It) { if constexpr (is_pointer_v<decay_t<_Iter>>) { return _It + 0; } else if constexpr (_Unwrappable_v<_Iter>) { return static_cast<_Iter&&>(_It)._Unwrapped(); } else { return static_cast<_Iter&&>(_It); } } template <class _Iter> using _Unwrapped_t = _Remove_cvref_t<decltype(_Get_unwrapped(::std:: declval<_Iter>()))>; template <class _Iter, class = bool> inline constexpr bool _Do_unwrap_when_unverified_v = false; template <class _Iter> inline constexpr bool _Do_unwrap_when_unverified_v<_Iter, decltype(static_cast<bool>(_Iter::_Unwrap_when_unverified))> = static_cast<bool>(_Iter::_Unwrap_when_unverified); template <class _Iter> inline constexpr bool _Unwrappable_for_unverified_v = _Unwrappable_v<_Iter>&& _Do_unwrap_when_unverified_v<_Remove_cvref_t<_Iter>>; template <class _Iter> [[nodiscard]] constexpr decltype(auto) _Get_unwrapped_unverified(_Iter&& _It) { if constexpr (is_pointer_v<decay_t<_Iter>>) { return _It + 0; } else if constexpr (_Unwrappable_for_unverified_v<_Iter>) { return static_cast<_Iter&&>(_It)._Unwrapped(); } else { return static_cast<_Iter&&>(_It); } } template <class _Iter> using _Unwrapped_unverified_t = _Remove_cvref_t<decltype(_Get_unwrapped_unverified(::std:: declval<_Iter>()))>; struct _Distance_unknown { constexpr _Distance_unknown operator-() const noexcept { return {}; } }; template <class _Diff> inline constexpr auto _Max_possible_v = _Diff{static_cast<make_unsigned_t<_Diff>>(-1) >> 1}; template <class _Diff> inline constexpr auto _Min_possible_v = _Diff{-_Max_possible_v<_Diff> - 1}; template <class _Iter, class = void> inline constexpr bool _Offset_verifiable_v = false; template <class _Iter> inline constexpr bool _Offset_verifiable_v<_Iter, void_t<decltype(::std:: declval<const _Iter&>()._Verify_offset(_Iter_diff_t<_Iter>{}))>> = true; template <class _Iter> inline constexpr bool _Unwrappable_for_offset_v = _Unwrappable_v<_Iter>&& _Offset_verifiable_v<_Remove_cvref_t<_Iter>>; template <class _Iter, class _Diff> [[nodiscard]] constexpr decltype(auto) _Get_unwrapped_n(_Iter&& _It, const _Diff _Off) { if constexpr (is_pointer_v<decay_t<_Iter>>) { return _It + 0; } else if constexpr (_Unwrappable_for_offset_v<_Iter> && is_integral_v<_Diff>) { using _IDiff = _Iter_diff_t<_Remove_cvref_t<_Iter>>; using _CDiff = common_type_t<_Diff, _IDiff>; const auto _COff = static_cast<_CDiff>(_Off); do { if (_COff <= static_cast<_CDiff>(_Max_possible_v<_IDiff>) && (is_unsigned_v<_Diff> || static_cast<_CDiff>(_Min_possible_v<_IDiff>) <= _COff)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 1403, 0, "%s", "integer overflow")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"integer overflow\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 1403, 0); } while (false); } ; } while (false); (void) _COff; _It._Verify_offset(static_cast<_IDiff>(_Off)); return static_cast<_Iter&&>(_It)._Unwrapped(); } else if constexpr (_Unwrappable_for_unverified_v<_Iter>) { return static_cast<_Iter&&>(_It)._Unwrapped(); } else { return static_cast<_Iter&&>(_It); } } template <class _Iter, class _UIter, class = void> inline constexpr bool _Wrapped_seekable_v = false; template <class _Iter, class _UIter> inline constexpr bool _Wrapped_seekable_v<_Iter, _UIter, void_t<decltype(::std:: declval<_Iter&>()._Seek_to(::std:: declval<_UIter>()))>> = true; template <class _Iter, class _UIter> constexpr void _Seek_wrapped(_Iter& _It, _UIter&& _UIt) { if constexpr (_Wrapped_seekable_v<_Iter, _UIter>) { _It._Seek_to(::std:: forward<_UIter>(_UIt)); } else { _It = ::std:: forward<_UIter>(_UIt); } } template <class _Ty, class = void> struct _Is_allocator : false_type {}; template <class _Ty> struct _Is_allocator<_Ty, void_t<typename _Ty::value_type, decltype(::std:: declval<_Ty&>().deallocate( ::std:: declval<_Ty&>().allocate(size_t{1}), size_t{1}))>> : true_type {}; template <class _Iter> using _Guide_key_t = remove_const_t<typename iterator_traits<_Iter>::value_type::first_type>; template <class _Iter> using _Guide_val_t = typename iterator_traits<_Iter>::value_type::second_type; template <class _Iter> using _Guide_pair_t = pair<add_const_t<typename iterator_traits<_Iter>::value_type::first_type>, typename iterator_traits<_Iter>::value_type::second_type>; template <class _Ty> struct is_execution_policy : false_type {}; template <class _Ty> inline constexpr bool is_execution_policy_v = is_execution_policy<_Ty>::value; template <class _ExPo> using _Enable_if_execution_policy_t = typename remove_reference_t<_ExPo>::_Standard_execution_policy; template <class _Checked, class _Iter> [[nodiscard]] constexpr auto _Idl_distance(const _Iter& _First, const _Iter& _Last) { if constexpr (_Is_random_iter_v<_Iter>) { return static_cast<_Iter_diff_t<_Checked>>(_Last - _First); } else { return _Distance_unknown{}; } } template <class _Elem, bool _Is_enum = is_enum_v<_Elem>> struct _Unwrap_enum { using type = underlying_type_t<_Elem>; }; template <class _Elem> struct _Unwrap_enum<_Elem, false> { using type = _Elem; }; template <class _Elem> using _Unwrap_enum_t = typename _Unwrap_enum<_Elem>::type; template <class _Pr, class _Ty1, class _Ty2, enable_if_t<is_same_v<_Remove_cvref_t<_Ty1>, _Remove_cvref_t<_Ty2>>, int> = 0> constexpr bool _Debug_lt_pred(_Pr&& _Pred, _Ty1&& _Left, _Ty2&& _Right) noexcept( noexcept(_Pred(_Left, _Right)) && noexcept(_Pred(_Right, _Left))) { const auto _Result = static_cast<bool>(_Pred(_Left, _Right)); if (_Result) { do { if (!_Pred(_Right, _Left)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 1520, 0, "%s", "invalid comparator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"invalid comparator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 1520, 0); } while (false); } ; } while (false); } return _Result; } template <class _Pr, class _Ty1, class _Ty2, enable_if_t<!is_same_v<_Remove_cvref_t<_Ty1>, _Remove_cvref_t<_Ty2>>, int> = 0> constexpr bool _Debug_lt_pred(_Pr&& _Pred, _Ty1&& _Left, _Ty2&& _Right) noexcept(noexcept(_Pred(_Left, _Right))) { return static_cast<bool>(_Pred(_Left, _Right)); } template <class _InIt, class _Sentinel, class _Pr> constexpr void _Debug_order_unchecked(_InIt _First, _Sentinel _Last, _Pr&& _Pred) { if constexpr (_Is_fwd_iter_v<_InIt>) { if (_First != _Last) { for (auto _Next = _First; ++_Next != _Last; _First = _Next) { do { if (!static_cast<bool>(_Pred(*_Next, *_First))) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 1540, 0, "%s", "sequence not ordered")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"sequence not ordered\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 1540, 0); } while (false); } ; } while (false); } } } } template <class _OtherIt, class _InIt, class _Pr> constexpr void _Debug_order_set_unchecked(_InIt _First, _InIt _Last, _Pr&& _Pred) { if constexpr (is_same_v<_Iter_value_t<_OtherIt>, _Iter_value_t<_InIt>> && _Is_fwd_iter_v<_InIt>) { _Debug_order_unchecked(_First, _Last, _Pred); } } template <class _InIt, class _Diff> constexpr void advance(_InIt& _Where, _Diff _Off) { if constexpr (_Is_random_iter_v<_InIt>) { _Where += _Off; } else { if constexpr (is_signed_v<_Diff> && !_Is_bidi_iter_v<_InIt>) { do { if (_Off >= 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 1564, 0, "%s", "negative advance of non-bidirectional iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"negative advance of non-bidirectional iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 1564, 0); } while (false); } ; } while (false); } decltype(auto) _UWhere = _Get_unwrapped_n(::std:: move(_Where), _Off); constexpr bool _Need_rewrap = !is_reference_v<decltype(_Get_unwrapped_n(::std:: move(_Where), _Off))>; if constexpr (is_signed_v<_Diff> && _Is_bidi_iter_v<_InIt>) { for (; _Off < 0; ++_Off) { --_UWhere; } } for (; 0 < _Off; --_Off) { ++_UWhere; } if constexpr (_Need_rewrap) { _Seek_wrapped(_Where, ::std:: move(_UWhere)); } } } template <class _InIt> [[nodiscard]] constexpr _Iter_diff_t<_InIt> distance(_InIt _First, _InIt _Last) { if constexpr (_Is_random_iter_v<_InIt>) { return _Last - _First; } else { _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); _Iter_diff_t<_InIt> _Off = 0; for (; _UFirst != _ULast; ++_UFirst) { ++_Off; } return _Off; } } template <class _InIt> constexpr _InIt _Next_iter(_InIt _First) { return ++_First; } template <class _InIt> [[nodiscard]] constexpr _InIt next(_InIt _First, _Iter_diff_t<_InIt> _Off = 1) { static_assert(_Is_input_iter_v<_InIt>, "next requires input iterator"); ::std:: advance(_First, _Off); return _First; } template <class _BidIt> constexpr _BidIt _Prev_iter(_BidIt _First) { return --_First; } template <class _BidIt> [[nodiscard]] constexpr _BidIt prev(_BidIt _First, _Iter_diff_t<_BidIt> _Off = 1) { static_assert(_Is_bidi_iter_v<_BidIt>, "prev requires bidirectional iterator"); ::std:: advance(_First, -_Off); return _First; } template <class _BidIt> class reverse_iterator { public: using iterator_type = _BidIt; using iterator_concept = conditional_t<random_access_iterator<_BidIt>, random_access_iterator_tag, bidirectional_iterator_tag>; using iterator_category = conditional_t<derived_from<_Iter_cat_t<_BidIt>, random_access_iterator_tag>, random_access_iterator_tag, _Iter_cat_t<_BidIt>>; using value_type = _Iter_value_t<_BidIt>; using difference_type = _Iter_diff_t<_BidIt>; using pointer = typename iterator_traits<_BidIt>::pointer; using reference = _Iter_ref_t<_BidIt>; template <class> friend class reverse_iterator; constexpr reverse_iterator() = default; constexpr explicit reverse_iterator(_BidIt _Right) noexcept( is_nothrow_move_constructible_v<_BidIt>) : current(::std:: move(_Right)) {} template <class _Other> requires (!is_same_v<_Other, _BidIt>) && convertible_to<const _Other&, _BidIt> constexpr reverse_iterator(const reverse_iterator<_Other>& _Right) noexcept( is_nothrow_constructible_v<_BidIt, const _Other&>) : current(_Right.current) {} template <class _Other> requires (!is_same_v<_Other, _BidIt>) && convertible_to<const _Other&, _BidIt> && assignable_from<_BidIt&, const _Other&> constexpr reverse_iterator& operator=(const reverse_iterator<_Other>& _Right) { current = _Right.current; return *this; } [[nodiscard]] constexpr _BidIt base() const { return current; } [[nodiscard]] constexpr reference operator*() const { _BidIt _Tmp = current; return *--_Tmp; } [[nodiscard]] constexpr pointer operator->() const requires (is_pointer_v<_BidIt> || requires(const _BidIt __i) { __i.operator->(); }) { _BidIt _Tmp = current; --_Tmp; if constexpr (is_pointer_v<_BidIt>) { return _Tmp; } else { return _Tmp.operator->(); } } constexpr reverse_iterator& operator++() { --current; return *this; } constexpr reverse_iterator operator++(int) { reverse_iterator _Tmp = *this; --current; return _Tmp; } constexpr reverse_iterator& operator--() { ++current; return *this; } constexpr reverse_iterator operator--(int) { reverse_iterator _Tmp = *this; ++current; return _Tmp; } [[nodiscard]] constexpr reverse_iterator operator+(const difference_type _Off) const { return reverse_iterator(current - _Off); } constexpr reverse_iterator& operator+=(const difference_type _Off) { current -= _Off; return *this; } [[nodiscard]] constexpr reverse_iterator operator-(const difference_type _Off) const { return reverse_iterator(current + _Off); } constexpr reverse_iterator& operator-=(const difference_type _Off) { current += _Off; return *this; } [[nodiscard]] constexpr reference operator[](const difference_type _Off) const { return current[static_cast<difference_type>(-_Off - 1)]; } [[nodiscard]] friend constexpr iter_rvalue_reference_t<_BidIt> iter_move(const reverse_iterator& _It) noexcept( is_nothrow_copy_constructible_v<_BidIt>&& noexcept(::std::ranges:: iter_move(--::std:: declval<_BidIt&>()))) { auto _Tmp = _It.current; --_Tmp; return ::std::ranges:: iter_move(_Tmp); } template <indirectly_swappable<_BidIt> _BidIt2> friend constexpr void iter_swap(const reverse_iterator& _Left, const reverse_iterator<_BidIt2>& _Right) noexcept( is_nothrow_copy_constructible_v<_BidIt>&& is_nothrow_copy_constructible_v<_BidIt2>&& noexcept( ::std::ranges:: iter_swap(--::std:: declval<_BidIt&>(), --::std:: declval<_BidIt2&>()))) { auto _LTmp = _Left.current; auto _RTmp = _Right.base(); --_LTmp; --_RTmp; ::std::ranges:: iter_swap(_LTmp, _RTmp); } using _Prevent_inheriting_unwrap = reverse_iterator; template <class _BidIt2, enable_if_t<_Range_verifiable_v<_BidIt, _BidIt2>, int> = 0> friend constexpr void _Verify_range(const reverse_iterator& _First, const reverse_iterator<_BidIt2>& _Last) { _Verify_range(_Last._Get_current(), _First.current); } template <class _BidIt2 = _BidIt, enable_if_t<_Offset_verifiable_v<_BidIt2>, int> = 0> constexpr void _Verify_offset(const difference_type _Off) const { do { if (_Off != _Min_possible_v<difference_type>) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 1789, 0, "%s", "integer overflow")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"integer overflow\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 1789, 0); } while (false); } ; } while (false); current._Verify_offset(-_Off); } template <class _BidIt2 = _BidIt, enable_if_t<_Unwrappable_v<const _BidIt2&>, int> = 0> [[nodiscard]] constexpr reverse_iterator<_Unwrapped_t<const _BidIt2&>> _Unwrapped() const { return static_cast<reverse_iterator<_Unwrapped_t<const _BidIt2&>>>(current._Unwrapped()); } static constexpr bool _Unwrap_when_unverified = _Do_unwrap_when_unverified_v<_BidIt>; template <class _Src, enable_if_t<_Wrapped_seekable_v<_BidIt, const _Src&>, int> = 0> constexpr void _Seek_to(const reverse_iterator<_Src>& _It) { current._Seek_to(_It.current); } [[nodiscard]] constexpr const _BidIt& _Get_current() const noexcept { return current; } protected: _BidIt current{}; }; template <class _BidIt1, class _BidIt2> [[nodiscard]] constexpr bool operator==(const reverse_iterator<_BidIt1>& _Left, const reverse_iterator<_BidIt2>& _Right) requires requires { { _Left._Get_current() == _Right._Get_current() } -> _Implicitly_convertible_to<bool>; } { return _Left._Get_current() == _Right._Get_current(); } template <class _BidIt1, class _BidIt2> [[nodiscard]] constexpr bool operator!=(const reverse_iterator<_BidIt1>& _Left, const reverse_iterator<_BidIt2>& _Right) requires requires { { _Left._Get_current() != _Right._Get_current() } -> _Implicitly_convertible_to<bool>; } { return _Left._Get_current() != _Right._Get_current(); } template <class _BidIt1, class _BidIt2> [[nodiscard]] constexpr bool operator<(const reverse_iterator<_BidIt1>& _Left, const reverse_iterator<_BidIt2>& _Right) requires requires { { _Left._Get_current() > _Right._Get_current() } -> _Implicitly_convertible_to<bool>; } { return _Left._Get_current() > _Right._Get_current(); } template <class _BidIt1, class _BidIt2> [[nodiscard]] constexpr bool operator>(const reverse_iterator<_BidIt1>& _Left, const reverse_iterator<_BidIt2>& _Right) requires requires { { _Left._Get_current() < _Right._Get_current() } -> _Implicitly_convertible_to<bool>; } { return _Left._Get_current() < _Right._Get_current(); } template <class _BidIt1, class _BidIt2> [[nodiscard]] constexpr bool operator<=(const reverse_iterator<_BidIt1>& _Left, const reverse_iterator<_BidIt2>& _Right) requires requires { { _Left._Get_current() >= _Right._Get_current() } -> _Implicitly_convertible_to<bool>; } { return _Left._Get_current() >= _Right._Get_current(); } template <class _BidIt1, class _BidIt2> [[nodiscard]] constexpr bool operator>=(const reverse_iterator<_BidIt1>& _Left, const reverse_iterator<_BidIt2>& _Right) requires requires { { _Left._Get_current() <= _Right._Get_current() } -> _Implicitly_convertible_to<bool>; } { return _Left._Get_current() <= _Right._Get_current(); } template <class _BidIt1, three_way_comparable_with<_BidIt1> _BidIt2> [[nodiscard]] constexpr compare_three_way_result_t<_BidIt1, _BidIt2> operator<=>( const reverse_iterator<_BidIt1>& _Left, const reverse_iterator<_BidIt2>& _Right) { return _Right._Get_current() <=> _Left._Get_current(); } template <class _BidIt1, class _BidIt2> [[nodiscard]] constexpr auto operator-(const reverse_iterator<_BidIt1>& _Left, const reverse_iterator<_BidIt2>& _Right) -> decltype(_Right._Get_current() - _Left._Get_current()) { return _Right._Get_current() - _Left._Get_current(); } template <class _BidIt> [[nodiscard]] constexpr reverse_iterator<_BidIt> operator+( typename reverse_iterator<_BidIt>::difference_type _Off, const reverse_iterator<_BidIt>& _Right) { return _Right + _Off; } template <class _BidIt> [[nodiscard]] constexpr reverse_iterator<_BidIt> make_reverse_iterator(_BidIt _Iter) noexcept( is_nothrow_move_constructible_v<_BidIt>) { return reverse_iterator<_BidIt>(::std:: move(_Iter)); } template <class _BidIt1, class _BidIt2> requires (!sized_sentinel_for<_BidIt1, _BidIt2>) inline constexpr bool disable_sized_sentinel_for<reverse_iterator<_BidIt1>, reverse_iterator<_BidIt2>> = true; template <class _Container> [[nodiscard]] constexpr auto begin(_Container& _Cont) -> decltype(_Cont.begin()) { return _Cont.begin(); } template <class _Container> [[nodiscard]] constexpr auto begin(const _Container& _Cont) -> decltype(_Cont.begin()) { return _Cont.begin(); } template <class _Container> [[nodiscard]] constexpr auto end(_Container& _Cont) -> decltype(_Cont.end()) { return _Cont.end(); } template <class _Container> [[nodiscard]] constexpr auto end(const _Container& _Cont) -> decltype(_Cont.end()) { return _Cont.end(); } template <class _Ty, size_t _Size> [[nodiscard]] constexpr _Ty* begin(_Ty (&_Array)[_Size]) noexcept { return _Array; } template <class _Ty, size_t _Size> [[nodiscard]] constexpr _Ty* end(_Ty (&_Array)[_Size]) noexcept { return _Array + _Size; } template <class _Container> [[nodiscard]] constexpr auto cbegin(const _Container& _Cont) noexcept(noexcept(::std:: begin(_Cont))) -> decltype(::std:: begin(_Cont)) { return ::std:: begin(_Cont); } template <class _Container> [[nodiscard]] constexpr auto cend(const _Container& _Cont) noexcept(noexcept(::std:: end(_Cont))) -> decltype(::std:: end(_Cont)) { return ::std:: end(_Cont); } template <class _Container> [[nodiscard]] constexpr auto rbegin(_Container& _Cont) -> decltype(_Cont.rbegin()) { return _Cont.rbegin(); } template <class _Container> [[nodiscard]] constexpr auto rbegin(const _Container& _Cont) -> decltype(_Cont.rbegin()) { return _Cont.rbegin(); } template <class _Container> [[nodiscard]] constexpr auto rend(_Container& _Cont) -> decltype(_Cont.rend()) { return _Cont.rend(); } template <class _Container> [[nodiscard]] constexpr auto rend(const _Container& _Cont) -> decltype(_Cont.rend()) { return _Cont.rend(); } template <class _Ty, size_t _Size> [[nodiscard]] constexpr reverse_iterator<_Ty*> rbegin(_Ty (&_Array)[_Size]) { return reverse_iterator<_Ty*>(_Array + _Size); } template <class _Ty, size_t _Size> [[nodiscard]] constexpr reverse_iterator<_Ty*> rend(_Ty (&_Array)[_Size]) { return reverse_iterator<_Ty*>(_Array); } template <class _Elem> [[nodiscard]] constexpr reverse_iterator<const _Elem*> rbegin(initializer_list<_Elem> _Ilist) { return reverse_iterator<const _Elem*>(_Ilist.end()); } template <class _Elem> [[nodiscard]] constexpr reverse_iterator<const _Elem*> rend(initializer_list<_Elem> _Ilist) { return reverse_iterator<const _Elem*>(_Ilist.begin()); } template <class _Container> [[nodiscard]] constexpr auto crbegin(const _Container& _Cont) -> decltype(::std:: rbegin(_Cont)) { return ::std:: rbegin(_Cont); } template <class _Container> [[nodiscard]] constexpr auto crend(const _Container& _Cont) -> decltype(::std:: rend(_Cont)) { return ::std:: rend(_Cont); } template <class _Container> [[nodiscard]] constexpr auto size(const _Container& _Cont) -> decltype(_Cont.size()) { return _Cont.size(); } template <class _Ty, size_t _Size> [[nodiscard]] constexpr size_t size(const _Ty (&)[_Size]) noexcept { return _Size; } template <class _Container> [[nodiscard]] constexpr auto ssize(const _Container& _Cont) -> common_type_t<ptrdiff_t, make_signed_t<decltype(_Cont.size())>> { using _Common = common_type_t<ptrdiff_t, make_signed_t<decltype(_Cont.size())>>; return static_cast<_Common>(_Cont.size()); } template <class _Ty, ptrdiff_t _Size> [[nodiscard]] constexpr ptrdiff_t ssize(const _Ty (&)[_Size]) noexcept { return _Size; } template <class _Container> [[nodiscard]] constexpr auto empty(const _Container& _Cont) -> decltype(_Cont.empty()) { return _Cont.empty(); } template <class _Ty, size_t _Size> [[nodiscard]] constexpr bool empty(const _Ty (&)[_Size]) noexcept { return false; } template <class _Elem> [[nodiscard]] constexpr bool empty(initializer_list<_Elem> _Ilist) noexcept { return _Ilist.size() == 0; } template <class _Container> [[nodiscard]] constexpr auto data(_Container& _Cont) -> decltype(_Cont.data()) { return _Cont.data(); } template <class _Container> [[nodiscard]] constexpr auto data(const _Container& _Cont) -> decltype(_Cont.data()) { return _Cont.data(); } template <class _Ty, size_t _Size> [[nodiscard]] constexpr _Ty* data(_Ty (&_Array)[_Size]) noexcept { return _Array; } template <class _Elem> [[nodiscard]] constexpr const _Elem* data(initializer_list<_Elem> _Ilist) noexcept { return _Ilist.begin(); } template <class _Ty> [[nodiscard]] _Ty _Fake_decay_copy(_Ty) noexcept; template <class _Ty1, class _Ty2> concept _Not_same_as = !same_as<remove_cvref_t<_Ty1>, remove_cvref_t<_Ty2>>; namespace ranges { template <class> inline constexpr bool _Has_complete_elements = false; template <class _Ty> requires requires(_Ty& __t) { sizeof(__t[0]); } inline constexpr bool _Has_complete_elements<_Ty> = true; template <class> inline constexpr bool enable_borrowed_range = false; template <class _Rng> concept _Should_range_access = is_lvalue_reference_v<_Rng> || enable_borrowed_range<remove_cvref_t<_Rng>>; namespace _Begin { template <class _Ty> void begin(_Ty&) = delete; template <class _Ty> void begin(const _Ty&) = delete; template <class _Ty> concept _Has_member = requires(_Ty __t) { { _Fake_decay_copy(__t.begin()) } -> input_or_output_iterator; }; template <class _Ty> concept _Has_ADL = _Has_class_or_enum_type<_Ty> && requires(_Ty __t) { { _Fake_decay_copy(begin(__t)) } -> input_or_output_iterator; }; class _Cpo { private: enum class _St { _None, _Array, _Member, _Non_member }; template <class _Ty> [[nodiscard]] static consteval _Choice_t<_St> _Choose() noexcept { ; if constexpr (is_array_v<remove_reference_t<_Ty>>) { static_assert(_Has_complete_elements<_Ty>, "The range access customization point objects " "std::ranges::begin, std::ranges::end, std::ranges::rbegin, std::ranges::rend, " "and std::ranges::data do not accept arrays with incomplete element types."); return {_St::_Array, true}; } else if constexpr (_Has_member<_Ty>) { return {_St::_Member, noexcept(_Fake_decay_copy(::std:: declval<_Ty>().begin()))}; } else if constexpr (_Has_ADL<_Ty>) { return {_St::_Non_member, noexcept(_Fake_decay_copy(begin(::std:: declval<_Ty>())))}; } else { return {_St::_None}; } } template <class _Ty> static constexpr _Choice_t<_St> _Choice = _Choose<_Ty>(); public: template <_Should_range_access _Ty> requires (_Choice<_Ty&>._Strategy != _St::_None) [[nodiscard]] constexpr auto operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { constexpr _St _Strat = _Choice<_Ty&>._Strategy; if constexpr (_Strat == _St::_Array) { return _Val; } else if constexpr (_Strat == _St::_Member) { return _Val.begin(); } else if constexpr (_Strat == _St::_Non_member) { return begin(_Val); } else { static_assert(_Always_false<_Ty>, "Should be unreachable"); } } }; } inline namespace _Cpos { inline constexpr _Begin::_Cpo begin; } template <class _Ty> using iterator_t = decltype(::std::ranges:: begin(::std:: declval<_Ty&>())); namespace _Unchecked_begin { template <class _Ty> concept _Has_member = requires(_Ty& __t) { { __t._Unchecked_begin() } -> input_or_output_iterator; }; template <class _Ty> concept _Can_begin = requires(_Ty& __t) { _Get_unwrapped(::std::ranges:: begin(__t)); }; class _Cpo { private: enum class _St { _None, _Member, _Unwrap }; template <class _Ty> [[nodiscard]] static consteval _Choice_t<_St> _Choose() noexcept { ; if constexpr (_Has_member<_Ty>) { ; return {_St::_Member, noexcept(::std:: declval<_Ty>()._Unchecked_begin())}; } else if constexpr (_Can_begin<_Ty>) { return {_St::_Unwrap, noexcept(_Get_unwrapped(::std::ranges:: begin(::std:: declval<_Ty>())))}; } else { return {_St::_None}; } } template <class _Ty> static constexpr _Choice_t<_St> _Choice = _Choose<_Ty>(); public: template <_Should_range_access _Ty> requires (_Choice<_Ty&>._Strategy != _St::_None) [[nodiscard]] constexpr auto operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { constexpr _St _Strat = _Choice<_Ty&>._Strategy; if constexpr (_Strat == _St::_Member) { return _Val._Unchecked_begin(); } else if constexpr (_Strat == _St::_Unwrap) { return _Get_unwrapped(::std::ranges:: begin(_Val)); } else { static_assert(_Always_false<_Ty>, "Should be unreachable"); } } }; } inline namespace _Cpos { inline constexpr _Unchecked_begin::_Cpo _Ubegin; } namespace _End { template <class _Ty> void end(_Ty&) = delete; template <class _Ty> void end(const _Ty&) = delete; template <class _Ty> concept _Has_member = requires(_Ty __t) { { _Fake_decay_copy(__t.end()) } -> sentinel_for<iterator_t<_Ty>>; }; template <class _Ty> concept _Has_ADL = _Has_class_or_enum_type<_Ty> && requires(_Ty __t) { { _Fake_decay_copy(end(__t)) } -> sentinel_for<iterator_t<_Ty>>; }; class _Cpo { private: enum class _St { _None, _Array, _Member, _Non_member }; template <class _Ty> [[nodiscard]] static consteval _Choice_t<_St> _Choose() noexcept { ; using _UnRef = remove_reference_t<_Ty>; if constexpr (is_array_v<_UnRef>) { static_assert(_Has_complete_elements<_UnRef>, "The range access customization point objects " "std::ranges::begin, std::ranges::end, std::ranges::rbegin, std::ranges::rend, " "and std::ranges::data do not accept arrays with incomplete element types."); if constexpr (extent_v<_UnRef> != 0) { return {_St::_Array, true}; } else { return {_St::_None}; } } else if constexpr (_Has_member<_Ty>) { return {_St::_Member, noexcept(_Fake_decay_copy(::std:: declval<_Ty>().end()))}; } else if constexpr (_Has_ADL<_Ty>) { return {_St::_Non_member, noexcept(_Fake_decay_copy(end(::std:: declval<_Ty>())))}; } else { return {_St::_None}; } } template <class _Ty> static constexpr _Choice_t<_St> _Choice = _Choose<_Ty>(); public: template <_Should_range_access _Ty> requires (_Choice<_Ty&>._Strategy != _St::_None) [[nodiscard]] constexpr auto operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { constexpr _St _Strat = _Choice<_Ty&>._Strategy; if constexpr (_Strat == _St::_Array) { return _Val + extent_v<remove_reference_t<_Ty&>>; } else if constexpr (_Strat == _St::_Member) { return _Val.end(); } else if constexpr (_Strat == _St::_Non_member) { return end(_Val); } else { static_assert(_Always_false<_Ty>, "should be unreachable"); } } }; } inline namespace _Cpos { inline constexpr _End::_Cpo end; } namespace _Unchecked_end { template <class _Ty> concept _Has_member = _Unchecked_begin::_Has_member<_Ty> && requires(_Ty& __t) { __t._Unchecked_begin(); { __t._Unchecked_end() } -> sentinel_for<decltype(__t._Unchecked_begin())>; }; template <class _Ty> concept _Can_end = requires(_Ty& __t) { _Get_unwrapped(::std::ranges:: end(__t)); }; class _Cpo { private: enum class _St { _None, _Member, _Unwrap }; template <class _Ty> [[nodiscard]] static consteval _Choice_t<_St> _Choose() noexcept { ; if constexpr (_Has_member<_Ty>) { ; return {_St::_Member, noexcept(::std:: declval<_Ty>()._Unchecked_end())}; } else if constexpr (_Can_end<_Ty>) { return {_St::_Unwrap, noexcept(_Get_unwrapped(::std::ranges:: end(::std:: declval<_Ty>())))}; } else { return {_St::_None}; } } template <class _Ty> static constexpr _Choice_t<_St> _Choice = _Choose<_Ty>(); public: template <_Should_range_access _Ty> requires (_Choice<_Ty&>._Strategy != _St::_None) [[nodiscard]] constexpr auto operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { constexpr _St _Strat = _Choice<_Ty&>._Strategy; if constexpr (_Strat == _St::_Member) { return _Val._Unchecked_end(); } else if constexpr (_Strat == _St::_Unwrap) { return _Get_unwrapped(::std::ranges:: end(_Val)); } else { static_assert(_Always_false<_Ty>, "Should be unreachable"); } } }; } inline namespace _Cpos { inline constexpr _Unchecked_end::_Cpo _Uend; } template <class _Rng> concept range = requires(_Rng& __r) { ::std::ranges:: begin(__r); ::std::ranges:: end(__r); }; template <class _Rng> concept borrowed_range = range<_Rng> && _Should_range_access<_Rng>; template <range _Rng> using sentinel_t = decltype(::std::ranges:: end(::std:: declval<_Rng&>())); template <range _Rng> using range_difference_t = iter_difference_t<iterator_t<_Rng>>; template <range _Rng> using range_value_t = iter_value_t<iterator_t<_Rng>>; template <range _Rng> using range_reference_t = iter_reference_t<iterator_t<_Rng>>; template <range _Rng> using range_rvalue_reference_t = iter_rvalue_reference_t<iterator_t<_Rng>>; struct _Cbegin_fn { template <class _Ty, class _CTy = _Const_thru_ref<_Ty>> [[nodiscard]] constexpr auto operator()(_Ty&& _Val) const noexcept(noexcept(::std::ranges:: begin(static_cast<_CTy&&>(_Val)))) requires requires { ::std::ranges:: begin(static_cast<_CTy&&>(_Val)); } { return ::std::ranges:: begin(static_cast<_CTy&&>(_Val)); } }; inline namespace _Cpos { inline constexpr _Cbegin_fn cbegin; } struct _Cend_fn { template <class _Ty, class _CTy = _Const_thru_ref<_Ty>> [[nodiscard]] constexpr auto operator()(_Ty&& _Val) const noexcept(noexcept(::std::ranges:: end(static_cast<_CTy&&>(_Val)))) requires requires { ::std::ranges:: end(static_cast<_CTy&&>(_Val)); } { return ::std::ranges:: end(static_cast<_CTy&&>(_Val)); } }; inline namespace _Cpos { inline constexpr _Cend_fn cend; } namespace _Rbegin { template <class _Ty> void rbegin(_Ty&) = delete; template <class _Ty> void rbegin(const _Ty&) = delete; template <class _Ty> concept _Has_member = requires(_Ty __t) { { _Fake_decay_copy(__t.rbegin()) } -> input_or_output_iterator; }; template <class _Ty> concept _Has_ADL = _Has_class_or_enum_type<_Ty> && requires(_Ty __t) { { _Fake_decay_copy(rbegin(__t)) } -> input_or_output_iterator; }; template <class _Ty> concept _Can_make_reverse = requires(_Ty __t) { { ::std::ranges:: begin(__t) } -> bidirectional_iterator; { ::std::ranges:: end(__t) } -> same_as<decltype(::std::ranges:: begin(__t))>; }; class _Cpo { private: enum class _St { _None, _Member, _Non_member, _Make_reverse }; template <class _Ty> [[nodiscard]] static consteval _Choice_t<_St> _Choose() noexcept { ; if constexpr (_Has_member<_Ty>) { return {_St::_Member, noexcept(_Fake_decay_copy(::std:: declval<_Ty>().rbegin()))}; } else if constexpr (_Has_ADL<_Ty>) { return {_St::_Non_member, noexcept(_Fake_decay_copy(rbegin(::std:: declval<_Ty>())))}; } else if constexpr (_Can_make_reverse<_Ty>) { return {_St::_Make_reverse, noexcept(::std:: make_reverse_iterator(::std::ranges:: end(::std:: declval<_Ty>())))}; } else { return {_St::_None}; } } template <class _Ty> static constexpr _Choice_t<_St> _Choice = _Choose<_Ty>(); public: template <_Should_range_access _Ty> requires (_Choice<_Ty&>._Strategy != _St::_None) [[nodiscard]] constexpr auto operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { constexpr _St _Strat = _Choice<_Ty&>._Strategy; if constexpr (_Strat == _St::_Member) { return _Val.rbegin(); } else if constexpr (_Strat == _St::_Non_member) { return rbegin(_Val); } else if constexpr (_Strat == _St::_Make_reverse) { return ::std:: make_reverse_iterator(::std::ranges:: end(_Val)); } else { static_assert(_Always_false<_Ty>, "should be unreachable"); } } }; } inline namespace _Cpos { inline constexpr _Rbegin::_Cpo rbegin; } namespace _Rend { template <class _Ty> void rend(_Ty&) = delete; template <class _Ty> void rend(const _Ty&) = delete; template <class _Ty> concept _Has_member = requires(_Ty __t) { { _Fake_decay_copy(__t.rend()) } -> sentinel_for<decltype(::std::ranges:: rbegin(__t))>; }; template <class _Ty> concept _Has_ADL = _Has_class_or_enum_type<_Ty> && requires(_Ty __t) { { _Fake_decay_copy(rend(__t)) } -> sentinel_for<decltype(::std::ranges:: rbegin(__t))>; }; template <class _Ty> concept _Can_make_reverse = requires(_Ty __t) { { ::std::ranges:: begin(__t) } -> bidirectional_iterator; { ::std::ranges:: end(__t) } -> same_as<decltype(::std::ranges:: begin(__t))>; }; class _Cpo { private: enum class _St { _None, _Member, _Non_member, _Make_reverse }; template <class _Ty> [[nodiscard]] static consteval _Choice_t<_St> _Choose() noexcept { ; if constexpr (_Has_member<_Ty>) { return {_St::_Member, noexcept(_Fake_decay_copy(::std:: declval<_Ty>().rend()))}; } else if constexpr (_Has_ADL<_Ty>) { return {_St::_Non_member, noexcept(_Fake_decay_copy(rend(::std:: declval<_Ty>())))}; } else if constexpr (_Can_make_reverse<_Ty>) { return { _St::_Make_reverse, noexcept(::std:: make_reverse_iterator(::std::ranges:: begin(::std:: declval<_Ty>())))}; } else { return {_St::_None}; } } template <class _Ty> static constexpr _Choice_t<_St> _Choice = _Choose<_Ty>(); public: template <_Should_range_access _Ty> requires (_Choice<_Ty&>._Strategy != _St::_None) [[nodiscard]] constexpr auto operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { constexpr _St _Strat = _Choice<_Ty&>._Strategy; if constexpr (_Strat == _St::_Member) { return _Val.rend(); } else if constexpr (_Strat == _St::_Non_member) { return rend(_Val); } else if constexpr (_Strat == _St::_Make_reverse) { return ::std:: make_reverse_iterator(::std::ranges:: begin(_Val)); } else { static_assert(_Always_false<_Ty>, "should be unreachable"); } } }; } inline namespace _Cpos { inline constexpr _Rend::_Cpo rend; } struct _Crbegin_fn { template <class _Ty, class _CTy = _Const_thru_ref<_Ty>> [[nodiscard]] constexpr auto operator()(_Ty&& _Val) const noexcept(noexcept(::std::ranges:: rbegin(static_cast<_CTy&&>(_Val)))) requires requires { ::std::ranges:: rbegin(static_cast<_CTy&&>(_Val)); } { return ::std::ranges:: rbegin(static_cast<_CTy&&>(_Val)); } }; inline namespace _Cpos { inline constexpr _Crbegin_fn crbegin; } struct _Crend_fn { template <class _Ty, class _CTy = _Const_thru_ref<_Ty>> [[nodiscard]] constexpr auto operator()(_Ty&& _Val) const noexcept(noexcept(::std::ranges:: rend(static_cast<_CTy&&>(_Val)))) requires requires { ::std::ranges:: rend(static_cast<_CTy&&>(_Val)); } { return ::std::ranges:: rend(static_cast<_CTy&&>(_Val)); } }; inline namespace _Cpos { inline constexpr _Crend_fn crend; } template <class> inline constexpr bool disable_sized_range = false; namespace _Size { template <class _Ty> void size(_Ty&) = delete; template <class _Ty> void size(const _Ty&) = delete; template <class _Ty, class _UnCV> concept _Has_member = !disable_sized_range<_UnCV> && requires(_Ty __t) { { _Fake_decay_copy(__t.size()) } -> _Integer_like; }; template <class _Ty, class _UnCV> concept _Has_ADL = _Has_class_or_enum_type<_Ty> && !disable_sized_range<_UnCV> && requires(_Ty __t) { { _Fake_decay_copy(size(__t)) } -> _Integer_like; }; template <class _Ty> concept _Can_difference = requires(_Ty __t) { { ::std::ranges:: begin(__t) } -> forward_iterator; { ::std::ranges:: end(__t) } -> sized_sentinel_for<decltype(::std::ranges:: begin(__t))>; }; class _Cpo { private: enum class _St { _None, _Array, _Member, _Non_member, _Subtract }; template <class _Ty> [[nodiscard]] static consteval _Choice_t<_St> _Choose() noexcept { ; using _UnCV = remove_cvref_t<_Ty>; if constexpr (is_array_v<_UnCV>) { if constexpr (extent_v<_UnCV> != 0) { return {_St::_Array, true}; } else { return {_St::_None}; } } else if constexpr (_Has_member<_Ty, _UnCV>) { return {_St::_Member, noexcept(_Fake_decay_copy(::std:: declval<_Ty>().size()))}; } else if constexpr (_Has_ADL<_Ty, _UnCV>) { return {_St::_Non_member, noexcept(_Fake_decay_copy(size(::std:: declval<_Ty>())))}; } else if constexpr (_Can_difference<_Ty>) { return {_St::_Subtract, noexcept(::std::ranges:: end(::std:: declval<_Ty>()) - ::std::ranges:: begin(::std:: declval<_Ty>()))}; } else { return {_St::_None}; } } template <class _Ty> static constexpr _Choice_t<_St> _Choice = _Choose<_Ty>(); public: template <class _Ty> requires (_Choice<_Ty&>._Strategy != _St::_None) [[nodiscard]] constexpr auto operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { constexpr _St _Strat = _Choice<_Ty&>._Strategy; if constexpr (_Strat == _St::_Array) { return extent_v<remove_cvref_t<_Ty&>>; } else if constexpr (_Strat == _St::_Member) { return _Val.size(); } else if constexpr (_Strat == _St::_Non_member) { return size(_Val); } else if constexpr (_Strat == _St::_Subtract) { const auto _Delta = ::std::ranges:: end(_Val) - ::std::ranges:: begin(_Val); return static_cast<_Make_unsigned_like_t<remove_cv_t<decltype(_Delta)>>>(_Delta); } else { static_assert(_Always_false<_Ty>, "should be unreachable"); } } }; } inline namespace _Cpos { inline constexpr _Size::_Cpo size; } namespace _Empty { template <class _Ty> concept _Has_member = requires(_Ty __t) { static_cast<bool>(__t.empty()); }; template <class _Ty> concept _Has_size = requires(_Ty __t) { ::std::ranges:: size(__t); }; template <class _Ty> concept _Can_begin_end = requires(_Ty __t) { { ::std::ranges:: begin(__t) } -> forward_iterator; ::std::ranges:: end(__t); }; class _Cpo { private: enum class _St { _None, _Member, _Size, _Compare }; template <class _Ty> [[nodiscard]] static consteval _Choice_t<_St> _Choose() noexcept { ; if constexpr (is_unbounded_array_v<remove_reference_t<_Ty>>) { return {_St::_None}; } else if constexpr (_Has_member<_Ty>) { return {_St::_Member, noexcept(static_cast<bool>(::std:: declval<_Ty>().empty()))}; } else if constexpr (_Has_size<_Ty>) { return {_St::_Size, noexcept(::std::ranges:: size(::std:: declval<_Ty>()))}; } else if constexpr (_Can_begin_end<_Ty>) { constexpr auto _Nothrow = noexcept( static_cast<bool>(::std::ranges:: begin(::std:: declval<_Ty>()) == ::std::ranges:: end(::std:: declval<_Ty>()))); return {_St::_Compare, _Nothrow}; } else { return {_St::_None}; } } template <class _Ty> static constexpr _Choice_t<_St> _Choice = _Choose<_Ty>(); public: template <class _Ty> requires (_Choice<_Ty&>._Strategy != _St::_None) [[nodiscard]] constexpr bool operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { constexpr _St _Strat = _Choice<_Ty&>._Strategy; if constexpr (_Strat == _St::_Member) { return static_cast<bool>(_Val.empty()); } else if constexpr (_Strat == _St::_Size) { return ::std::ranges:: size(_Val) == 0; } else if constexpr (_Strat == _St::_Compare) { return static_cast<bool>(::std::ranges:: begin(_Val) == ::std::ranges:: end(_Val)); } else { static_assert(_Always_false<_Ty>, "should be unreachable"); } } }; } inline namespace _Cpos { inline constexpr _Empty::_Cpo empty; } namespace _Data { template <class _Ty> concept _Points_to_object = is_pointer_v<_Ty> && is_object_v<remove_pointer_t<_Ty>>; template <class _Ty> concept _Has_member = requires(_Ty __t) { { _Fake_decay_copy(__t.data()) } -> _Points_to_object; }; template <class _Ty> concept _Has_contiguous_iterator = requires(_Ty __t) { { ::std::ranges:: begin(__t) } -> contiguous_iterator; }; class _Cpo { private: enum class _St { _None, _Member, _Address }; template <class _Ty> [[nodiscard]] static consteval _Choice_t<_St> _Choose() noexcept { ; if constexpr (_Has_member<_Ty>) { return {_St::_Member, noexcept(::std:: declval<_Ty>().data())}; } else if constexpr (_Has_contiguous_iterator<_Ty>) { return {_St::_Address, noexcept(::std:: to_address(::std::ranges:: begin(::std:: declval<_Ty>())))}; } else { return {_St::_None}; } } template <class _Ty> static constexpr _Choice_t<_St> _Choice = _Choose<_Ty>(); public: template <_Should_range_access _Ty> requires (_Choice<_Ty&>._Strategy != _St::_None) [[nodiscard]] constexpr auto operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { constexpr _St _Strat = _Choice<_Ty&>._Strategy; if constexpr (_Strat == _St::_Member) { return _Val.data(); } else if constexpr (_Strat == _St::_Address) { return ::std:: to_address(::std::ranges:: begin(_Val)); } else { static_assert(_Always_false<_Ty>, "should be unreachable"); } } }; } inline namespace _Cpos { inline constexpr _Data::_Cpo data; } struct _Cdata_fn { template <class _Ty, class _CTy = _Const_thru_ref<_Ty>> [[nodiscard]] constexpr auto operator()(_Ty&& _Val) const noexcept(noexcept(::std::ranges:: data(static_cast<_CTy&&>(_Val)))) requires requires { ::std::ranges:: data(static_cast<_CTy&&>(_Val)); } { return ::std::ranges:: data(static_cast<_CTy&&>(_Val)); } }; inline namespace _Cpos { inline constexpr _Cdata_fn cdata; } template <class _Rng> concept sized_range = range<_Rng> && requires(_Rng& __r) { ::std::ranges:: size(__r); }; template <sized_range _Rng> using range_size_t = decltype(::std::ranges:: size(::std:: declval<_Rng&>())); struct view_base {}; template <class _Ty> inline constexpr bool enable_view = derived_from<_Ty, view_base>; template <class _Ty> concept view = range<_Ty> && movable<_Ty> && default_initializable<_Ty> && enable_view<_Ty>; template <class _Rng, class _Ty> concept output_range = range<_Rng> && output_iterator<iterator_t<_Rng>, _Ty>; template <class _Rng> concept input_range = range<_Rng> && input_iterator<iterator_t<_Rng>>; template <class _Rng> concept forward_range = range<_Rng> && forward_iterator<iterator_t<_Rng>>; template <class _Rng> concept bidirectional_range = range<_Rng> && bidirectional_iterator<iterator_t<_Rng>>; template <class _Rng> concept random_access_range = range<_Rng> && random_access_iterator<iterator_t<_Rng>>; template <class _Rng> concept contiguous_range = range<_Rng> && contiguous_iterator<iterator_t<_Rng>> && requires(_Rng& __r) { { ::std::ranges:: data(__r) } -> same_as<add_pointer_t<range_reference_t<_Rng>>>; }; class _Not_quite_object { public: struct _Construct_tag { explicit _Construct_tag() = default; }; _Not_quite_object() = delete; constexpr explicit _Not_quite_object(_Construct_tag) noexcept {} _Not_quite_object(const _Not_quite_object&) = delete; _Not_quite_object& operator=(const _Not_quite_object&) = delete; void operator&() const = delete; protected: ~_Not_quite_object() = default; }; class _Advance_fn : private _Not_quite_object { public: using _Not_quite_object::_Not_quite_object; template <input_or_output_iterator _It> constexpr void operator()(_It& _Where, iter_difference_t<_It> _Off) const { if constexpr (random_access_iterator<_It>) { _Where += _Off; } else { if constexpr (!bidirectional_iterator<_It>) { do { if (_Off >= 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 2928, 0, "%s", "negative advance of non-bidirectional iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"negative advance of non-bidirectional iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 2928, 0); } while (false); } ; } while (false); } decltype(auto) _UWhere = _Get_unwrapped_n(::std:: move(_Where), _Off); constexpr bool _Need_rewrap = !is_reference_v<decltype(_Get_unwrapped_n(::std:: move(_Where), _Off))>; if constexpr (bidirectional_iterator<_It>) { for (; _Off < 0; ++_Off) { --_UWhere; } } for (; _Off > 0; --_Off) { ++_UWhere; } if constexpr (_Need_rewrap) { _Seek_wrapped(_Where, ::std:: move(_UWhere)); } } } template <input_or_output_iterator _It, sentinel_for<_It> _Se> constexpr void operator()(_It& _Where, _Se _Last) const { if constexpr (assignable_from<_It&, _Se>) { _Where = static_cast<_Se&&>(_Last); } else if constexpr (sized_sentinel_for<_Se, _It>) { (*this)(_Where, _Last - _Where); } else { _Adl_verify_range(_Where, _Last); decltype(auto) _UWhere = _Get_unwrapped(static_cast<_It&&>(_Where)); constexpr bool _Need_rewrap = !is_reference_v<decltype(_Get_unwrapped(static_cast<_It&&>(_Where)))>; decltype(auto) _ULast = _Get_unwrapped(static_cast<_Se&&>(_Last)); while (_UWhere != _ULast) { ++_UWhere; } if constexpr (_Need_rewrap) { _Seek_wrapped(_Where, ::std:: move(_UWhere)); } } } template <input_or_output_iterator _It, sentinel_for<_It> _Se> constexpr iter_difference_t<_It> operator()(_It& _Where, iter_difference_t<_It> _Off, _Se _Last) const { if constexpr (sized_sentinel_for<_Se, _It>) { const iter_difference_t<_It> _Delta = _Last - _Where; if ((_Off < 0 && _Off <= _Delta) || (_Off > 0 && _Off >= _Delta)) { if constexpr (assignable_from<_It&, _Se>) { _Where = static_cast<_Se&&>(_Last); } else { (*this)(_Where, _Delta); } return _Off - _Delta; } (*this)(_Where, _Off); return 0; } else { if constexpr (bidirectional_iterator<_It>) { for (; _Off < 0 && _Where != _Last; ++_Off) { --_Where; } } else { do { if (_Off >= 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 2995, 0, "%s", "negative advance of non-bidirectional iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"negative advance of non-bidirectional iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 2995, 0); } while (false); } ; } while (false); } for (; _Off > 0 && _Where != _Last; --_Off) { ++_Where; } return _Off; } } }; inline constexpr _Advance_fn advance{_Not_quite_object::_Construct_tag{}}; class _Distance_fn : private _Not_quite_object { public: using _Not_quite_object::_Not_quite_object; template <input_or_output_iterator _It, sentinel_for<_It> _Se> [[nodiscard]] constexpr iter_difference_t<_It> operator()(_It _First, _Se _Last) const noexcept(_Nothrow_distance<_It, _Se>) { if constexpr (sized_sentinel_for<_Se, _It>) { return _Last - _First; } else { _Adl_verify_range(_First, _Last); return _Distance_unchecked(_Get_unwrapped(::std:: move(_First)), _Get_unwrapped(::std:: move(_Last))); } } template <range _Rng> [[nodiscard]] constexpr range_difference_t<_Rng> operator()(_Rng&& _Range) const noexcept(_Nothrow_size<_Rng>) { if constexpr (sized_range<_Rng>) { return static_cast<range_difference_t<_Rng>>(::std::ranges:: size(_Range)); } else { return _Distance_unchecked(_Ubegin(_Range), _Uend(_Range)); } } private: template <class _It, class _Se> [[nodiscard]] static constexpr iter_difference_t<_It> _Distance_unchecked(_It _First, const _Se _Last) noexcept( _Nothrow_distance<_It, _Se>) { ; ; iter_difference_t<_It> _Count = 0; for (; _First != _Last; ++_First) { ++_Count; } return _Count; } template <class _It, class _Se> static constexpr bool _Nothrow_distance = noexcept( noexcept(++::std:: declval<_Unwrapped_t<_It>&>() != ::std:: declval<const _Unwrapped_t<_Se>&>())); template <class _It, sized_sentinel_for<_It> _Se> static constexpr bool _Nothrow_distance<_It, _Se> = noexcept( noexcept(::std:: declval<_Se&>() - ::std:: declval<_It&>())); template <class _Rng> static constexpr bool _Nothrow_size = _Nothrow_distance<iterator_t<_Rng>, sentinel_t<_Rng>>; template <sized_range _Rng> static constexpr bool _Nothrow_size<_Rng> = noexcept(::std::ranges:: size(::std:: declval<_Rng&>())); }; inline constexpr _Distance_fn distance{_Not_quite_object::_Construct_tag{}}; class _Ssize_fn { public: template <class _Rng> [[nodiscard]] constexpr auto operator()(_Rng&& _Range) const requires requires { ::std::ranges:: size(_Range); } { using _Sty = _Make_signed_like_t<decltype(::std::ranges:: size(_Range))>; using _Ty = common_type_t<conditional_t<is_integral_v<_Sty>, ptrdiff_t, _Sty>, _Sty>; return static_cast<_Ty>(::std::ranges:: size(_Range)); } }; inline namespace _Cpos { inline constexpr _Ssize_fn ssize; } class _Next_fn : private _Not_quite_object { public: using _Not_quite_object::_Not_quite_object; template <input_or_output_iterator _It> [[nodiscard]] constexpr _It operator()(_It _Where) const { ++_Where; return _Where; } template <input_or_output_iterator _It> [[nodiscard]] constexpr _It operator()(_It _Where, const iter_difference_t<_It> _Off) const { ::std::ranges:: advance(_Where, _Off); return _Where; } template <input_or_output_iterator _It, sentinel_for<_It> _Se> [[nodiscard]] constexpr _It operator()(_It _Where, _Se _Last) const { ::std::ranges:: advance(_Where, static_cast<_Se&&>(_Last)); return _Where; } template <input_or_output_iterator _It, sentinel_for<_It> _Se> [[nodiscard]] constexpr _It operator()(_It _Where, const iter_difference_t<_It> _Off, _Se _Last) const { ::std::ranges:: advance(_Where, _Off, static_cast<_Se&&>(_Last)); return _Where; } }; inline constexpr _Next_fn next{_Not_quite_object::_Construct_tag{}}; class _Prev_fn : private _Not_quite_object { public: using _Not_quite_object::_Not_quite_object; template <bidirectional_iterator _It> [[nodiscard]] constexpr _It operator()(_It _Where) const { --_Where; return _Where; } template <bidirectional_iterator _It> [[nodiscard]] constexpr _It operator()(_It _Where, const iter_difference_t<_It> _Off) const { do { if (_Off != _Min_possible_v<iter_difference_t<_It>>) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 3127, 0, "%s", "integer overflow")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"integer overflow\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 3127, 0); } while (false); } ; } while (false); ::std::ranges:: advance(_Where, -_Off); return _Where; } template <bidirectional_iterator _It> [[nodiscard]] constexpr _It operator()(_It _Where, const iter_difference_t<_It> _Off, _It _Last) const { do { if (_Off != _Min_possible_v<iter_difference_t<_It>>) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 3134, 0, "%s", "integer overflow")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"integer overflow\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 3134, 0); } while (false); } ; } while (false); ::std::ranges:: advance(_Where, -_Off, static_cast<_It&&>(_Last)); return _Where; } }; inline constexpr _Prev_fn prev{_Not_quite_object::_Construct_tag{}}; template <forward_iterator _It, sentinel_for<_It> _Se> [[nodiscard]] constexpr _It _Find_last_iterator( const _It& _First, const _Se& _Last, const iter_difference_t<_It> _Count) { ; if constexpr (is_same_v<_It, _Se>) { return _Last; } else { return ::std::ranges:: next(_First, _Count); } } struct equal_to { template <class _Ty1, class _Ty2> requires equality_comparable_with<_Ty1, _Ty2> [[nodiscard]] constexpr bool operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(noexcept( static_cast<bool>(static_cast<_Ty1&&>(_Left) == static_cast<_Ty2&&>(_Right)))) { return static_cast<bool>(static_cast<_Ty1&&>(_Left) == static_cast<_Ty2&&>(_Right)); } using is_transparent = int; }; struct less { template <class _Ty1, class _Ty2> requires totally_ordered_with<_Ty1, _Ty2> [[nodiscard]] constexpr bool operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(noexcept( static_cast<bool>(static_cast<_Ty1&&>(_Left) < static_cast<_Ty2&&>(_Right)))) { return static_cast<bool>(static_cast<_Ty1&&>(_Left) < static_cast<_Ty2&&>(_Right)); } using is_transparent = int; }; struct greater { template <class _Ty1, class _Ty2> requires totally_ordered_with<_Ty1, _Ty2> [[nodiscard]] constexpr bool operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(noexcept( static_cast<bool>(static_cast<_Ty2&&>(_Right) < static_cast<_Ty1&&>(_Left)))) { return static_cast<bool>(static_cast<_Ty2&&>(_Right) < static_cast<_Ty1&&>(_Left)); } using is_transparent = int; }; template <class _Rng> concept common_range = range<_Rng> && same_as<iterator_t<_Rng>, sentinel_t<_Rng>>; template <class _Ty> concept _Can_empty = requires(_Ty __t) { ::std::ranges:: empty(__t); }; template <class _Derived> requires is_class_v<_Derived> && same_as<_Derived, remove_cv_t<_Derived>> class view_interface : public view_base { private: [[nodiscard]] constexpr _Derived& _Cast() noexcept { static_assert(derived_from<_Derived, view_interface>, "view_interface's template argument D must derive from view_interface<D> (N4849 [view.interface]/2)."); static_assert(view<_Derived>, "view_interface's template argument must model the view concept (N4849 [view.interface]/2)."); return static_cast<_Derived&>(*this); } [[nodiscard]] constexpr const _Derived& _Cast() const noexcept { static_assert(derived_from<_Derived, view_interface>, "view_interface's template argument D must derive from view_interface<D> (N4849 [view.interface]/2)."); static_assert(view<_Derived>, "view_interface's template argument must model the view concept (N4849 [view.interface]/2)."); return static_cast<const _Derived&>(*this); } public: [[nodiscard]] constexpr bool empty() requires forward_range<_Derived> { auto& _Self = _Cast(); return ::std::ranges:: begin(_Self) == ::std::ranges:: end(_Self); } [[nodiscard]] constexpr bool empty() const requires forward_range<const _Derived> { auto& _Self = _Cast(); return ::std::ranges:: begin(_Self) == ::std::ranges:: end(_Self); } constexpr explicit operator bool() requires _Can_empty<_Derived> { return !::std::ranges:: empty(_Cast()); } constexpr explicit operator bool() const requires _Can_empty<const _Derived> { return !::std::ranges:: empty(_Cast()); } [[nodiscard]] constexpr auto data() requires contiguous_iterator<iterator_t<_Derived>> { return ::std:: to_address(::std::ranges:: begin(_Cast())); } [[nodiscard]] constexpr auto data() const requires range<const _Derived> && contiguous_iterator<iterator_t<const _Derived>> { return ::std:: to_address(::std::ranges:: begin(_Cast())); } [[nodiscard]] constexpr auto size() requires forward_range<_Derived> && sized_sentinel_for<sentinel_t<_Derived>, iterator_t<_Derived>> { auto& _Self = _Cast(); return ::std::ranges:: end(_Self) - ::std::ranges:: begin(_Self); } [[nodiscard]] constexpr auto size() const requires forward_range<const _Derived> && sized_sentinel_for<sentinel_t<const _Derived>, iterator_t<const _Derived>> { auto& _Self = _Cast(); return ::std::ranges:: end(_Self) - ::std::ranges:: begin(_Self); } [[nodiscard]] constexpr decltype(auto) front() requires forward_range<_Derived> { auto& _Self = _Cast(); do { if (!::std::ranges:: empty(_Self)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 3327, 0, "%s", "front called on empty view_interface")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"front called on empty view_interface\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 3327, 0); } while (false); } ; } while (false); return *::std::ranges:: begin(_Self); } [[nodiscard]] constexpr decltype(auto) front() const requires forward_range<const _Derived> { auto& _Self = _Cast(); do { if (!::std::ranges:: empty(_Self)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 3341, 0, "%s", "front called on empty view_interface")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"front called on empty view_interface\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 3341, 0); } while (false); } ; } while (false); return *::std::ranges:: begin(_Self); } [[nodiscard]] constexpr decltype(auto) back() requires bidirectional_range<_Derived> && common_range<_Derived> { auto& _Self = _Cast(); do { if (!::std::ranges:: empty(_Self)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 3355, 0, "%s", "back called on empty view_interface")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"back called on empty view_interface\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 3355, 0); } while (false); } ; } while (false); auto _Last = ::std::ranges:: end(_Self); return *--_Last; } [[nodiscard]] constexpr decltype(auto) back() const requires bidirectional_range<const _Derived> && common_range<const _Derived> { auto& _Self = _Cast(); do { if (!::std::ranges:: empty(_Self)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 3372, 0, "%s", "back called on empty view_interface")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"back called on empty view_interface\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 3372, 0); } while (false); } ; } while (false); auto _Last = ::std::ranges:: end(_Self); return *--_Last; } template <random_access_range _Rng = _Derived> [[nodiscard]] constexpr decltype(auto) operator[](const range_difference_t<_Rng> _Idx) { auto& _Self = _Cast(); if constexpr (sized_range<_Derived>) { using _U_diff = _Make_unsigned_like_t<range_difference_t<_Rng>>; do { if (static_cast<_U_diff>(_Idx) < static_cast<_U_diff>(::std::ranges:: size(_Self))) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 3385, 0, "%s", "index out of range for view_interface")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"index out of range for view_interface\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 3385, 0); } while (false); } ; } while (false); } return ::std::ranges:: begin(_Self)[_Idx]; } template <random_access_range _Rng = const _Derived> [[nodiscard]] constexpr decltype(auto) operator[](const range_difference_t<_Rng> _Idx) const { auto& _Self = _Cast(); if constexpr (sized_range<_Derived>) { using _U_diff = _Make_unsigned_like_t<range_difference_t<_Rng>>; do { if (static_cast<_U_diff>(_Idx) < static_cast<_U_diff>(::std::ranges:: size(_Self))) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 3398, 0, "%s", "index out of range for view_interface")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"index out of range for view_interface\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 3398, 0); } while (false); } ; } while (false); } return ::std::ranges:: begin(_Self)[_Idx]; } }; enum class subrange_kind : bool { unsized, sized }; } template <size_t _Index, class... _Types> [[nodiscard]] constexpr tuple_element_t<_Index, tuple<_Types...>>& get(tuple<_Types...>& _Tuple) noexcept; template <size_t _Index, class... _Types> [[nodiscard]] constexpr const tuple_element_t<_Index, tuple<_Types...>>& get(const tuple<_Types...>& _Tuple) noexcept; template <size_t _Index, class... _Types> [[nodiscard]] constexpr tuple_element_t<_Index, tuple<_Types...>>&& get(tuple<_Types...>&& _Tuple) noexcept; template <size_t _Index, class... _Types> [[nodiscard]] constexpr const tuple_element_t<_Index, tuple<_Types...>>&& get(const tuple<_Types...>&& _Tuple) noexcept; namespace ranges { template <class _From, class _To> concept _Convertible_to_non_slicing = convertible_to<_From, _To> && !(is_pointer_v<decay_t<_From>> && is_pointer_v<decay_t<_To>> && _Not_same_as<remove_pointer_t<decay_t<_From>>, remove_pointer_t<decay_t<_To>>>); template <class _Ty> concept _Pair_like = !is_reference_v<_Ty> && requires(_Ty __t) { typename tuple_size<_Ty>::type; requires derived_from<tuple_size<_Ty>, integral_constant<size_t, 2>>; typename tuple_element_t<0, remove_const_t<_Ty>>; typename tuple_element_t<1, remove_const_t<_Ty>>; { ::std:: get<0>(__t) } -> convertible_to<const tuple_element_t<0, _Ty>&>; { ::std:: get<1>(__t) } -> convertible_to<const tuple_element_t<1, _Ty>&>; }; template <class _Ty, class _First, class _Second> concept _Pair_like_convertible_from = !range<_Ty> && _Pair_like<_Ty> && constructible_from<_Ty, _First, _Second> && _Convertible_to_non_slicing<_First, tuple_element_t<0, _Ty>> && convertible_to<_Second, tuple_element_t<1, _Ty>>; template <input_or_output_iterator _It, sentinel_for<_It> _Se = _It, subrange_kind _Ki = sized_sentinel_for<_Se, _It> ? subrange_kind::sized : subrange_kind::unsized> requires (_Ki == subrange_kind::sized || !sized_sentinel_for<_Se, _It>) class subrange; template <class _It, class _Se, subrange_kind _Ki, bool _Store = _Ki == subrange_kind::sized && !sized_sentinel_for<_Se, _It>> class _Subrange_base : public view_interface<subrange<_It, _Se, _Ki>> { protected: using _Size_type = _Make_unsigned_like_t<iter_difference_t<_It>>; static constexpr bool _Store_size = true; _Size_type _Size = 0; public: _Subrange_base() = default; constexpr explicit _Subrange_base(const _Size_type& _Size_) noexcept : _Size(_Size_) {} }; template <class _It, class _Se, subrange_kind _Ki> class _Subrange_base<_It, _Se, _Ki, false> : public view_interface<subrange<_It, _Se, _Ki>> { protected: using _Size_type = _Make_unsigned_like_t<iter_difference_t<_It>>; static constexpr bool _Store_size = false; public: _Subrange_base() = default; constexpr explicit _Subrange_base(const _Size_type&) noexcept {} }; template <input_or_output_iterator _It, sentinel_for<_It> _Se, subrange_kind _Ki> requires (_Ki == subrange_kind::sized || !sized_sentinel_for<_Se, _It>) class subrange : public _Subrange_base<_It, _Se, _Ki> { private: using _Mybase = _Subrange_base<_It, _Se, _Ki>; using typename _Mybase::_Size_type; using _Mybase::_Store_size; _It _First{}; _Se _Last{}; template <class _Rng> constexpr subrange(true_type, _Rng&& _Val) : subrange{::std:: forward<_Rng>(_Val), ::std::ranges:: size(_Val)} { ; } template <class _Rng> constexpr subrange(false_type, _Rng&& _Val) : subrange{::std::ranges:: begin(_Val), ::std::ranges:: end(_Val)} { ; } public: subrange() = default; template <_Convertible_to_non_slicing<_It> _It2> constexpr subrange(_It2 _First_, _Se _Last_) requires (!_Store_size) : _First(::std:: move(_First_)), _Last(::std:: move(_Last_)) {} template <_Convertible_to_non_slicing<_It> _It2> constexpr subrange(_It2 _First_, _Se _Last_, const _Size_type _Size_) requires (_Ki == subrange_kind::sized) : _Mybase(_Size_), _First(::std:: move(_First_)), _Last(::std:: move(_Last_)) { if constexpr (sized_sentinel_for<_Se, _It>) { do { if (_Size_ == static_cast<_Size_type>(_Last - _First)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 3516, 0, "%s", "This constructor's third argument should be equal to the distance " "between the first and second arguments (N4849 [range.subrange.ctor]/3).")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"This constructor's third argument should be equal to the distance \" \"between the first and second arguments (N4849 [range.subrange.ctor]/3).\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xutility", 3516, 0); } while (false); } ; } while (false); } } template <_Not_same_as<subrange> _Rng> requires borrowed_range<_Rng> && _Convertible_to_non_slicing<iterator_t<_Rng>, _It> && convertible_to<sentinel_t<_Rng>, _Se> constexpr subrange(_Rng&& _Val) requires (!_Store_size || sized_range<_Rng>) : subrange{bool_constant<_Store_size>{}, ::std:: forward<_Rng>(_Val)} {} template <borrowed_range _Rng> requires _Convertible_to_non_slicing<iterator_t<_Rng>, _It> && convertible_to<sentinel_t<_Rng>, _Se> constexpr subrange(_Rng&& _Val, const _Size_type _Count) requires (_Ki == subrange_kind::sized) : subrange{::std::ranges:: begin(_Val), ::std::ranges:: end(_Val), _Count} {} template <_Not_same_as<subrange> _Pair_like> requires _Pair_like_convertible_from<_Pair_like, const _It&, const _Se&> constexpr operator _Pair_like() const { return _Pair_like(_First, _Last); } [[nodiscard]] constexpr _It begin() const requires copyable<_It> { return _First; } [[nodiscard]] constexpr _It begin() requires (!copyable<_It>) { return ::std:: move(_First); } [[nodiscard]] constexpr _Se end() const { return _Last; } [[nodiscard]] constexpr bool empty() const { return _First == _Last; } [[nodiscard]] constexpr _Size_type size() const requires (_Ki == subrange_kind::sized) { if constexpr (_Store_size) { return this->_Size; } else { return static_cast<_Size_type>(_Last - _First); } } [[nodiscard]] constexpr subrange next() const & requires forward_iterator<_It> { auto _Tmp = *this; if (_Tmp._First != _Tmp._Last) { ++_Tmp._First; if constexpr (_Store_size) { --_Tmp._Size; } } return _Tmp; } [[nodiscard]] constexpr subrange next(const iter_difference_t<_It> _Count) const & requires forward_iterator<_It> { auto _Tmp = *this; _Tmp.advance(_Count); return _Tmp; } [[nodiscard]] constexpr subrange next() && { if (_First != _Last) { ++_First; if constexpr (_Store_size) { --this->_Size; } } return ::std:: move(*this); } [[nodiscard]] constexpr subrange next(const iter_difference_t<_It> _Count) && { advance(_Count); return ::std:: move(*this); } [[nodiscard]] constexpr subrange prev() const requires bidirectional_iterator<_It> { auto _Tmp = *this; --_Tmp._First; if constexpr (_Store_size) { ++_Tmp._Size; } return _Tmp; } [[nodiscard]] constexpr subrange prev(const iter_difference_t<_It> _Count) const requires bidirectional_iterator<_It> { auto _Tmp = *this; _Tmp.advance(-_Count); return _Tmp; } constexpr subrange& advance(const iter_difference_t<_It> _Count) { if constexpr (bidirectional_iterator<_It>) { if (_Count < 0) { ::std::ranges:: advance(_First, _Count); if constexpr (_Store_size) { this->_Size += static_cast<_Size_type>(-_Count); } return *this; } } const auto _Remainder = ::std::ranges:: advance(_First, _Count, _Last); if constexpr (_Store_size) { this->_Size -= static_cast<_Size_type>(_Count - _Remainder); } return *this; } }; template <input_or_output_iterator _It, sentinel_for<_It> _Se> subrange(_It, _Se) -> subrange<_It, _Se>; template <input_or_output_iterator _It, sentinel_for<_It> _Se> subrange(_It, _Se, _Make_unsigned_like_t<iter_difference_t<_It>>) -> subrange<_It, _Se, subrange_kind::sized>; template <borrowed_range _Rng> subrange(_Rng&&) -> subrange<iterator_t<_Rng>, sentinel_t<_Rng>, (sized_range<_Rng> || sized_sentinel_for<sentinel_t<_Rng>, iterator_t<_Rng>>) ? subrange_kind::sized : subrange_kind::unsized>; template <borrowed_range _Rng> subrange(_Rng&&, _Make_unsigned_like_t<range_difference_t<_Rng>>) -> subrange<iterator_t<_Rng>, sentinel_t<_Rng>, subrange_kind::sized>; template <class _It, class _Se, subrange_kind _Ki> inline constexpr bool enable_borrowed_range<subrange<_It, _Se, _Ki>> = true; template <size_t _Idx, class _It, class _Se, subrange_kind _Ki> requires (_Idx < 2) [[nodiscard]] constexpr auto get(const subrange<_It, _Se, _Ki>& _Val) { if constexpr (_Idx == 0) { return _Val.begin(); } else { return _Val.end(); } } template <size_t _Idx, class _It, class _Se, subrange_kind _Ki> requires (_Idx < 2) [[nodiscard]] constexpr auto get(subrange<_It, _Se, _Ki>&& _Val) { if constexpr (_Idx == 0) { return _Val.begin(); } else { return _Val.end(); } } } using ranges::get; template <class _It, class _Se, ranges::subrange_kind _Ki> struct tuple_size<ranges::subrange<_It, _Se, _Ki>> : integral_constant<size_t, 2> {}; template <class _It, class _Se, ranges::subrange_kind _Ki> struct tuple_element<0, ranges::subrange<_It, _Se, _Ki>> { using type = _It; }; template <class _It, class _Se, ranges::subrange_kind _Ki> struct tuple_element<1, ranges::subrange<_It, _Se, _Ki>> { using type = _Se; }; template <class _It, class _Se, ranges::subrange_kind _Ki> struct tuple_element<0, const ranges::subrange<_It, _Se, _Ki>> { using type = _It; }; template <class _It, class _Se, ranges::subrange_kind _Ki> struct tuple_element<1, const ranges::subrange<_It, _Se, _Ki>> { using type = _Se; }; namespace ranges { struct dangling { constexpr dangling() noexcept = default; template <class... _Args> constexpr dangling(_Args&&...) noexcept {} }; template <range _Rng> using borrowed_iterator_t = conditional_t<borrowed_range<_Rng>, iterator_t<_Rng>, dangling>; template <range _Rng> using borrowed_subrange_t = conditional_t<borrowed_range<_Rng>, subrange<iterator_t<_Rng>>, dangling>; } struct _Container_proxy; struct _Iterator_base12; struct _Default_sentinel {}; template <semiregular> class move_sentinel; template <class _Iter> class move_iterator { public: using iterator_type = _Iter; using iterator_concept = input_iterator_tag; using iterator_category = conditional_t<derived_from<_Iter_cat_t<_Iter>, random_access_iterator_tag>, random_access_iterator_tag, _Iter_cat_t<_Iter>>; using value_type = _Iter_value_t<_Iter>; using difference_type = _Iter_diff_t<_Iter>; using pointer = _Iter; using reference = iter_rvalue_reference_t<_Iter>; constexpr move_iterator() = default; constexpr explicit move_iterator(_Iter _Right) noexcept(is_nothrow_move_constructible_v<_Iter>) : _Current(::std:: move(_Right)) {} template <class _Other> requires (!is_same_v<_Other, _Iter>) && convertible_to<const _Other&, _Iter> constexpr move_iterator(const move_iterator<_Other>& _Right) noexcept( is_nothrow_constructible_v<_Iter, const _Other&>) : _Current(_Right.base()) {} template <class _Other> requires (!is_same_v<_Other, _Iter>) && convertible_to<const _Other&, _Iter> && assignable_from<_Iter&, const _Other&> constexpr move_iterator& operator=(const move_iterator<_Other>& _Right) noexcept( is_nothrow_assignable_v<_Iter&, const _Other&>) { _Current = _Right.base(); return *this; } [[nodiscard]] constexpr const iterator_type& base() const& noexcept { return _Current; } [[nodiscard]] constexpr iterator_type base() && noexcept(is_nothrow_move_constructible_v<_Iter>) { return ::std:: move(_Current); } [[nodiscard]] constexpr reference operator*() const { return ::std::ranges:: iter_move(_Current); } [[deprecated("warning STL4031: " "std::move_iterator::operator->() is deprecated in C++20. " "You can define _SILENCE_CXX20_MOVE_ITERATOR_ARROW_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] [[nodiscard]] constexpr pointer operator->() const { return _Current; } constexpr move_iterator& operator++() { ++_Current; return *this; } constexpr auto operator++(int) { if constexpr (forward_iterator<_Iter>) { move_iterator _Tmp = *this; ++_Current; return _Tmp; } else { ++_Current; } } constexpr move_iterator& operator--() { --_Current; return *this; } constexpr move_iterator operator--(int) { move_iterator _Tmp = *this; --_Current; return _Tmp; } template <class _Iter2 = _Iter> [[nodiscard]] auto operator==(_Default_sentinel _Sentinel) const noexcept -> decltype(::std:: declval<const _Iter2&>() == _Sentinel) { return _Current == _Sentinel; } template <class _Iter2 = _Iter> [[nodiscard]] auto operator!=(_Default_sentinel _Sentinel) const noexcept -> decltype(::std:: declval<const _Iter2&>() != _Sentinel) { return _Current != _Sentinel; } [[nodiscard]] constexpr move_iterator operator+(const difference_type _Off) const { return move_iterator(_Current + _Off); } constexpr move_iterator& operator+=(const difference_type _Off) { _Current += _Off; return *this; } [[nodiscard]] constexpr move_iterator operator-(const difference_type _Off) const { return move_iterator(_Current - _Off); } constexpr move_iterator& operator-=(const difference_type _Off) { _Current -= _Off; return *this; } [[nodiscard]] constexpr reference operator[](const difference_type _Off) const { return ::std::ranges:: iter_move(_Current + _Off); } template <sentinel_for<_Iter> _Sent> [[nodiscard]] friend constexpr bool operator==(const move_iterator& _Left, const move_sentinel<_Sent>& _Right) { return _Left._Current == _Right._Get_last(); } template <sized_sentinel_for<_Iter> _Sent> [[nodiscard]] friend constexpr difference_type operator-( const move_sentinel<_Sent>& _Left, const move_iterator& _Right) { return _Left._Get_last() - _Right._Current; } template <sized_sentinel_for<_Iter> _Sent> [[nodiscard]] friend constexpr difference_type operator-( const move_iterator& _Left, const move_sentinel<_Sent>& _Right) { return _Left._Current - _Right._Get_last(); } [[nodiscard]] friend constexpr reference iter_move(const move_iterator& _It) noexcept(noexcept(::std::ranges:: iter_move(_It._Current))) { return ::std::ranges:: iter_move(_It._Current); } template <indirectly_swappable<_Iter> _Iter2> friend constexpr void iter_swap(const move_iterator& _Left, const move_iterator<_Iter2>& _Right) noexcept(noexcept(::std::ranges:: iter_swap(_Left._Current, _Right.base()))) { ::std::ranges:: iter_swap(_Left._Current, _Right.base()); } template <class _Iter2, enable_if_t<_Range_verifiable_v<_Iter, _Iter2>, int> = 0> friend constexpr void _Verify_range(const move_iterator& _First, const move_iterator<_Iter2>& _Last) { _Verify_range(_First._Current, _Last.base()); } template <sentinel_for<_Iter> _Sent, enable_if_t<_Range_verifiable_v<_Iter, _Sent>, int> = 0> friend constexpr void _Verify_range(const move_iterator& _First, const move_sentinel<_Sent>& _Last) { _Verify_range(_First._Current, _Last._Get_last()); } using _Prevent_inheriting_unwrap = move_iterator; template <class _Iter2 = iterator_type, enable_if_t<_Offset_verifiable_v<_Iter2>, int> = 0> constexpr void _Verify_offset(const difference_type _Off) const { _Current._Verify_offset(_Off); } template <class _Iter2 = iterator_type, enable_if_t<_Unwrappable_v<const _Iter2&>, int> = 0> [[nodiscard]] constexpr move_iterator<_Unwrapped_t<const _Iter2&>> _Unwrapped() const& { return static_cast<move_iterator<_Unwrapped_t<const _Iter2&>>>(_Current._Unwrapped()); } template <class _Iter2 = iterator_type, enable_if_t<_Unwrappable_v<_Iter2>, int> = 0> [[nodiscard]] constexpr move_iterator<_Unwrapped_t<_Iter2>> _Unwrapped() && { return static_cast<move_iterator<_Unwrapped_t<_Iter2>>>(::std:: move(_Current)._Unwrapped()); } static constexpr bool _Unwrap_when_unverified = _Do_unwrap_when_unverified_v<iterator_type>; template <class _Src, enable_if_t<_Wrapped_seekable_v<iterator_type, const _Src&>, int> = 0> constexpr void _Seek_to(const move_iterator<_Src>& _It) { _Current._Seek_to(_It.base()); } template <class _Src, enable_if_t<_Wrapped_seekable_v<iterator_type, _Src>, int> = 0> constexpr void _Seek_to(move_iterator<_Src>&& _It) { _Current._Seek_to(::std:: move(_It).base()); } private: iterator_type _Current{}; }; template <class _Iter1, class _Iter2> [[nodiscard]] constexpr bool operator==(const move_iterator<_Iter1>& _Left, const move_iterator<_Iter2>& _Right) requires requires { { _Left.base() == _Right.base() } -> _Implicitly_convertible_to<bool>; } { return _Left.base() == _Right.base(); } template <class _Iter1, class _Iter2> [[nodiscard]] constexpr bool operator<(const move_iterator<_Iter1>& _Left, const move_iterator<_Iter2>& _Right) requires requires { { _Left.base() < _Right.base() } -> _Implicitly_convertible_to<bool>; } { return _Left.base() < _Right.base(); } template <class _Iter1, class _Iter2> [[nodiscard]] constexpr bool operator>(const move_iterator<_Iter1>& _Left, const move_iterator<_Iter2>& _Right) requires requires { _Right < _Left; } { return _Right < _Left; } template <class _Iter1, class _Iter2> [[nodiscard]] constexpr bool operator<=(const move_iterator<_Iter1>& _Left, const move_iterator<_Iter2>& _Right) requires requires { _Right < _Left; } { return !(_Right < _Left); } template <class _Iter1, class _Iter2> [[nodiscard]] constexpr bool operator>=(const move_iterator<_Iter1>& _Left, const move_iterator<_Iter2>& _Right) requires requires { _Left < _Right; } { return !(_Left < _Right); } template <class _Iter1, three_way_comparable_with<_Iter1> _Iter2> [[nodiscard]] constexpr compare_three_way_result_t<_Iter1, _Iter2> operator<=>( const move_iterator<_Iter1>& _Left, const move_iterator<_Iter2>& _Right) { return _Left.base() <=> _Right.base(); } template <class _Iter1, class _Iter2> [[nodiscard]] constexpr auto operator-(const move_iterator<_Iter1>& _Left, const move_iterator<_Iter2>& _Right) -> decltype(_Left.base() - _Right.base()) { return _Left.base() - _Right.base(); } template <class _Iter> [[nodiscard]] constexpr move_iterator<_Iter> operator+( typename move_iterator<_Iter>::difference_type _Off, const move_iterator<_Iter>& _Right) requires requires { { _Right.base() + _Off } -> same_as<_Iter>; } { return move_iterator<_Iter>{_Right.base() + _Off}; } template <class _Iter> [[nodiscard]] constexpr move_iterator<_Iter> make_move_iterator(_Iter _It) { return move_iterator<_Iter>(::std:: move(_It)); } struct default_sentinel_t {}; inline constexpr default_sentinel_t default_sentinel{}; struct unreachable_sentinel_t; namespace _Unreachable_sentinel_detail { struct _Base { template <weakly_incrementable _Winc> [[nodiscard]] friend constexpr bool operator==(const unreachable_sentinel_t&, const _Winc&) noexcept { return false; } }; } struct unreachable_sentinel_t : _Unreachable_sentinel_detail::_Base {}; inline constexpr unreachable_sentinel_t unreachable_sentinel{}; template <class _Iter> inline constexpr bool _Iterator_is_contiguous = contiguous_iterator<_Iter>; template <class _Iter> [[nodiscard]] constexpr auto _To_address(const _Iter& _Val) noexcept { ; return ::std:: to_address(_Val); } template <class _Iter1, class _Iter2> inline constexpr bool _Iterators_are_contiguous = _Iterator_is_contiguous<_Iter1>&& _Iterator_is_contiguous<_Iter2>; template <class _Source, class _Dest> struct _Ptr_cat_helper { using _USource = _Unwrap_enum_t<_Source>; using _UDest = _Unwrap_enum_t<_Dest>; static constexpr bool _Really_trivial = conjunction_v< bool_constant<sizeof(_USource) == sizeof(_UDest) && is_same_v<bool, _USource> == is_same_v<bool, _UDest>>, is_integral<_USource>, is_integral<_UDest>>; static constexpr bool _Trivially_copyable = _Really_trivial; }; template <class _Elem> struct _Ptr_cat_helper<_Elem, _Elem> { static constexpr bool _Really_trivial = is_trivial_v<_Elem>; static constexpr bool _Trivially_copyable = is_trivially_copyable_v<_Elem>; }; template <class _Anything> struct _Ptr_cat_helper<_Anything*, const _Anything*> { static constexpr bool _Really_trivial = true; static constexpr bool _Trivially_copyable = true; }; template <class _Anything> struct _Ptr_cat_helper<_Anything*, volatile _Anything*> { static constexpr bool _Really_trivial = true; static constexpr bool _Trivially_copyable = true; }; template <class _Anything> struct _Ptr_cat_helper<_Anything*, const volatile _Anything*> { static constexpr bool _Really_trivial = true; static constexpr bool _Trivially_copyable = true; }; struct _False_copy_cat { static constexpr bool _Really_trivial = false; static constexpr bool _Trivially_copyable = false; }; template <class _Source, class _Dest, bool _Non_contiguous = !_Iterators_are_contiguous<_Source, _Dest>> struct _Ptr_move_cat : _False_copy_cat {}; template <class _Source, class _Dest> struct _Ptr_move_cat<_Source, _Dest, false> : conditional_t<is_trivially_assignable_v<_Iter_ref_t<_Dest>, remove_reference_t<_Iter_ref_t<_Source>>>, _Ptr_cat_helper<_Iter_value_t<_Source>, _Iter_value_t<_Dest>>, _False_copy_cat> {}; template <class _Source, class _Dest> struct _Ptr_move_cat<move_iterator<_Source>, _Dest, true> : _Ptr_move_cat<_Source, _Dest> {}; template <class _Source, class _Dest, bool _Non_contiguous = !_Iterators_are_contiguous<_Source, _Dest>> struct _Ptr_copy_cat : _False_copy_cat {}; template <class _Source, class _Dest> struct _Ptr_copy_cat<_Source, _Dest, false> : conditional_t<is_trivially_assignable_v<_Iter_ref_t<_Dest>, _Iter_ref_t<_Source>>, _Ptr_cat_helper<_Iter_value_t<_Source>, _Iter_value_t<_Dest>>, _False_copy_cat> {}; template <class _Source, class _Dest> struct _Ptr_copy_cat<move_iterator<_Source>, _Dest, true> : _Ptr_move_cat<_Source, _Dest> {}; template <class _CtgIt, class _OutCtgIt> _OutCtgIt _Copy_memmove(_CtgIt _First, _CtgIt _Last, _OutCtgIt _Dest) { auto _FirstPtr = _To_address(_First); auto _LastPtr = _To_address(_Last); auto _DestPtr = _To_address(_Dest); const char* const _First_ch = const_cast<const char*>(reinterpret_cast<const volatile char*>(_FirstPtr)); const char* const _Last_ch = const_cast<const char*>(reinterpret_cast<const volatile char*>(_LastPtr)); char* const _Dest_ch = const_cast<char*>(reinterpret_cast<const volatile char*>(_DestPtr)); const auto _Count = static_cast<size_t>(_Last_ch - _First_ch); :: memmove(_Dest_ch, _First_ch, _Count); if constexpr (is_pointer_v<_OutCtgIt>) { return reinterpret_cast<_OutCtgIt>(_Dest_ch + _Count); } else { return _Dest + (_LastPtr - _FirstPtr); } } template <class _InIt, class _OutIt> _OutIt _Copy_memmove(move_iterator<_InIt> _First, move_iterator<_InIt> _Last, _OutIt _Dest) { return _Copy_memmove(_First.base(), _Last.base(), _Dest); } template <class _It, bool _RequiresMutable = false> inline constexpr bool _Is_vb_iterator = false; template <class _InIt, class _OutIt> constexpr _OutIt _Copy_unchecked(_InIt _First, _InIt _Last, _OutIt _Dest) { if constexpr (_Ptr_copy_cat<_InIt, _OutIt>::_Trivially_copyable) { if (!::std:: is_constant_evaluated()) { return _Copy_memmove(_First, _Last, _Dest); } } for (; _First != _Last; ++_Dest, (void) ++_First) { *_Dest = *_First; } return _Dest; } template <class _InIt, class _OutIt> constexpr _OutIt copy(_InIt _First, _InIt _Last, _OutIt _Dest) { _Adl_verify_range(_First, _Last); const auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); const auto _UDest = _Get_unwrapped_n(_Dest, _Idl_distance<_InIt>(_UFirst, _ULast)); _Seek_wrapped(_Dest, _Copy_unchecked(_UFirst, _ULast, _UDest)); return _Dest; } template <class _ExPo, class _FwdIt1, class _FwdIt2, _Enable_if_execution_policy_t<_ExPo> = 0> _FwdIt2 copy(_ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _FwdIt2 _Dest) noexcept { static_assert(_Is_fwd_iter_v<_FwdIt1>, "Parallel algorithms require forward iterators or stronger."); static_assert(_Is_fwd_iter_v<_FwdIt2>, "Parallel algorithms require forward iterators or stronger."); return ::std:: copy(_First, _Last, _Dest); } namespace ranges { template <class _To, class _From> concept _Convertible_from = convertible_to<_From, _To>; template <class _In, class _Out> struct in_out_result { _In in; _Out out; template <_Convertible_from<const _In&> _IIn, _Convertible_from<const _Out&> _OOut> constexpr operator in_out_result<_IIn, _OOut>() const& { return {in, out}; } template <_Convertible_from<_In> _IIn, _Convertible_from<_Out> _OOut> constexpr operator in_out_result<_IIn, _OOut>() && { return {::std:: move(in), ::std:: move(out)}; } }; template <class _In, class _Out> using copy_result = in_out_result<_In, _Out>; template <input_iterator _It, sentinel_for<_It> _Se, weakly_incrementable _Out> requires indirectly_copyable<_It, _Out> [[nodiscard]] constexpr copy_result<_It, _Out> _Copy_unchecked(_It _First, _Se _Last, _Out _Result) { if constexpr (_Ptr_copy_cat<_It, _Out>::_Trivially_copyable && sized_sentinel_for<_Se, _It>) { if (!::std:: is_constant_evaluated()) { auto _Final = ::std::ranges:: next(_First, ::std:: move(_Last)); _Result = _Copy_memmove(::std:: move(_First), _Final, ::std:: move(_Result)); return {::std:: move(_Final), ::std:: move(_Result)}; } } for (; _First != _Last; ++_First, (void) ++_Result) { *_Result = *_First; } return {::std:: move(_First), ::std:: move(_Result)}; } class _Copy_fn : private _Not_quite_object { public: using _Not_quite_object::_Not_quite_object; template <input_iterator _It, sentinel_for<_It> _Se, weakly_incrementable _Out> requires indirectly_copyable<_It, _Out> constexpr copy_result<_It, _Out> operator()(_It _First, _Se _Last, _Out _Result) const { _Adl_verify_range(_First, _Last); auto _UResult = ::std::ranges:: _Copy_unchecked( _Get_unwrapped(::std:: move(_First)), _Get_unwrapped(::std:: move(_Last)), ::std:: move(_Result)); _Seek_wrapped(_First, ::std:: move(_UResult.in)); return {::std:: move(_First), ::std:: move(_UResult.out)}; } template <input_range _Rng, weakly_incrementable _Out> requires indirectly_copyable<iterator_t<_Rng>, _Out> constexpr copy_result<borrowed_iterator_t<_Rng>, _Out> operator()(_Rng&& _Range, _Out _Result) const { auto _First = ::std::ranges:: begin(_Range); auto _UResult = ::std::ranges:: _Copy_unchecked(_Get_unwrapped(::std:: move(_First)), _Uend(_Range), ::std:: move(_Result)); _Seek_wrapped(_First, ::std:: move(_UResult.in)); return {::std:: move(_First), ::std:: move(_UResult.out)}; } }; inline constexpr _Copy_fn copy{_Not_quite_object::_Construct_tag{}}; } template <class _InIt, class _Diff, class _OutIt> constexpr _OutIt copy_n(_InIt _First, _Diff _Count_raw, _OutIt _Dest) { _Algorithm_int_t<_Diff> _Count = _Count_raw; if (0 < _Count) { auto _UFirst = _Get_unwrapped_n(_First, _Count); auto _UDest = _Get_unwrapped_n(_Dest, _Count); if constexpr (_Ptr_copy_cat<decltype(_UFirst), decltype(_UDest)>::_Trivially_copyable) { if (!::std:: is_constant_evaluated()) { _UDest = _Copy_memmove(_UFirst, _UFirst + _Count, _UDest); _Seek_wrapped(_Dest, _UDest); return _Dest; } } for (;;) { *_UDest = *_UFirst; ++_UDest; --_Count; if (_Count == 0) { break; } ++_UFirst; } _Seek_wrapped(_Dest, _UDest); } return _Dest; } template <class _ExPo, class _FwdIt1, class _Diff, class _FwdIt2, _Enable_if_execution_policy_t<_ExPo> = 0> _FwdIt2 copy_n(_ExPo&&, _FwdIt1 _First, _Diff _Count_raw, _FwdIt2 _Dest) noexcept { static_assert(_Is_fwd_iter_v<_FwdIt1>, "Parallel algorithms require forward iterators or stronger."); static_assert(_Is_fwd_iter_v<_FwdIt2>, "Parallel algorithms require forward iterators or stronger."); return ::std:: copy_n(_First, _Count_raw, _Dest); } template <class _CtgIt1, class _CtgIt2> _CtgIt2 _Copy_backward_memmove(_CtgIt1 _First, _CtgIt1 _Last, _CtgIt2 _Dest) { auto _FirstPtr = _To_address(_First); auto _LastPtr = _To_address(_Last); auto _DestPtr = _To_address(_Dest); const char* const _First_ch = const_cast<const char*>(reinterpret_cast<const volatile char*>(_FirstPtr)); const char* const _Last_ch = const_cast<const char*>(reinterpret_cast<const volatile char*>(_LastPtr)); char* const _Dest_ch = const_cast<char*>(reinterpret_cast<const volatile char*>(_DestPtr)); const auto _Count = static_cast<size_t>(_Last_ch - _First_ch); auto _Result = :: memmove(_Dest_ch - _Count, _First_ch, _Count); if constexpr (is_pointer_v<_CtgIt2>) { return static_cast<_CtgIt2>(_Result); } else { return _Dest - (_LastPtr - _FirstPtr); } } template <class _BidIt1, class _BidIt2> _BidIt2 _Copy_backward_memmove(move_iterator<_BidIt1> _First, move_iterator<_BidIt1> _Last, _BidIt2 _Dest) { return _Copy_backward_memmove(_First.base(), _Last.base(), _Dest); } template <class _BidIt1, class _BidIt2> [[nodiscard]] constexpr _BidIt2 _Copy_backward_unchecked(_BidIt1 _First, _BidIt1 _Last, _BidIt2 _Dest) { if constexpr (_Ptr_copy_cat<_BidIt1, _BidIt2>::_Trivially_copyable) { if (!::std:: is_constant_evaluated()) { return _Copy_backward_memmove(_First, _Last, _Dest); } } while (_First != _Last) { *--_Dest = *--_Last; } return _Dest; } template <class _BidIt1, class _BidIt2> constexpr _BidIt2 copy_backward(_BidIt1 _First, _BidIt1 _Last, _BidIt2 _Dest) { _Adl_verify_range(_First, _Last); const auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); const auto _UDest = _Get_unwrapped_n(_Dest, -_Idl_distance<_BidIt1>(_UFirst, _ULast)); _Seek_wrapped(_Dest, _Copy_backward_unchecked(_UFirst, _ULast, _UDest)); return _Dest; } template <class _ExPo, class _BidIt1, class _BidIt2, _Enable_if_execution_policy_t<_ExPo> = 0> _BidIt2 copy_backward(_ExPo&&, _BidIt1 _First, _BidIt1 _Last, _BidIt2 _Dest) noexcept { return ::std:: copy_backward(_First, _Last, _Dest); } template <class _InIt, class _OutIt> constexpr _OutIt _Move_unchecked(_InIt _First, _InIt _Last, _OutIt _Dest) { if constexpr (_Ptr_move_cat<_InIt, _OutIt>::_Trivially_copyable) { if (!::std:: is_constant_evaluated()) { return _Copy_memmove(_First, _Last, _Dest); } } for (; _First != _Last; ++_Dest, (void) ++_First) { *_Dest = ::std:: move(*_First); } return _Dest; } template <class _InIt, class _OutIt> constexpr _OutIt move(_InIt _First, _InIt _Last, _OutIt _Dest) { _Adl_verify_range(_First, _Last); const auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); const auto _UDest = _Get_unwrapped_n(_Dest, _Idl_distance<_InIt>(_UFirst, _ULast)); _Seek_wrapped(_Dest, _Move_unchecked(_UFirst, _ULast, _UDest)); return _Dest; } template <class _ExPo, class _FwdIt1, class _FwdIt2, _Enable_if_execution_policy_t<_ExPo> = 0> _FwdIt2 move(_ExPo&&, _FwdIt1 _First, _FwdIt1 _Last, _FwdIt2 _Dest) noexcept { static_assert(_Is_fwd_iter_v<_FwdIt1>, "Parallel algorithms require forward iterators or stronger."); static_assert(_Is_fwd_iter_v<_FwdIt2>, "Parallel algorithms require forward iterators or stronger."); return ::std:: move(_First, _Last, _Dest); } template <class _BidIt1, class _BidIt2> constexpr _BidIt2 _Move_backward_unchecked(_BidIt1 _First, _BidIt1 _Last, _BidIt2 _Dest) { if constexpr (_Ptr_move_cat<_BidIt1, _BidIt2>::_Trivially_copyable) { if (!::std:: is_constant_evaluated()) { return _Copy_backward_memmove(_First, _Last, _Dest); } } while (_First != _Last) { *--_Dest = ::std:: move(*--_Last); } return _Dest; } template <class _BidIt1, class _BidIt2> constexpr _BidIt2 move_backward(_BidIt1 _First, _BidIt1 _Last, _BidIt2 _Dest) { _Adl_verify_range(_First, _Last); const auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); const auto _UDest = _Get_unwrapped_n(_Dest, -_Idl_distance<_BidIt1>(_UFirst, _ULast)); _Seek_wrapped(_Dest, _Move_backward_unchecked(_UFirst, _ULast, _UDest)); return _Dest; } template <class _ExPo, class _BidIt1, class _BidIt2, _Enable_if_execution_policy_t<_ExPo> = 0> _BidIt2 move_backward(_ExPo&&, _BidIt1 _First, _BidIt1 _Last, _BidIt2 _Dest) noexcept { return ::std:: move_backward(_First, _Last, _Dest); } template <class _Ty> struct _Is_character : false_type {}; template <> struct _Is_character<char> : true_type {}; template <> struct _Is_character<signed char> : true_type {}; template <> struct _Is_character<unsigned char> : true_type {}; template <> struct _Is_character<char8_t> : true_type {}; template <class _Ty> struct _Is_character_or_bool : _Is_character<_Ty>::type {}; template <> struct _Is_character_or_bool<bool> : true_type {}; template <class _Ty> struct _Is_character_or_byte_or_bool : _Is_character_or_bool<_Ty>::type {}; template <> struct _Is_character_or_byte_or_bool<byte> : true_type {}; template <class _FwdIt, class _Ty, bool = _Iterator_is_contiguous<_FwdIt>> inline constexpr bool _Fill_memset_is_safe = conjunction_v<is_scalar<_Ty>, _Is_character_or_byte_or_bool<_Unwrap_enum_t<remove_reference_t<_Iter_ref_t<_FwdIt>>>>, negation<is_volatile<remove_reference_t<_Iter_ref_t<_FwdIt>>>>, is_assignable<_Iter_ref_t<_FwdIt>, const _Ty&>>; template <class _FwdIt, class _Ty> inline constexpr bool _Fill_memset_is_safe<_FwdIt, _Ty, false> = false; template <class _FwdIt, class _Ty, bool = _Iterator_is_contiguous<_FwdIt>> inline constexpr bool _Fill_zero_memset_is_safe = conjunction_v<is_scalar<_Ty>, is_scalar<_Iter_value_t<_FwdIt>>, negation<is_member_pointer<_Iter_value_t<_FwdIt>>>, negation<is_volatile<remove_reference_t<_Iter_ref_t<_FwdIt>>>>, is_assignable<_Iter_ref_t<_FwdIt>, const _Ty&>>; template <class _FwdIt, class _Ty> inline constexpr bool _Fill_zero_memset_is_safe<_FwdIt, _Ty, false> = false; template <class _CtgIt, class _Ty> void _Fill_memset(_CtgIt _Dest, const _Ty _Val, const size_t _Count) { _Iter_value_t<_CtgIt> _Dest_val = _Val; :: memset(_To_address(_Dest), static_cast<unsigned char>(_Dest_val), _Count); } template <class _CtgIt> void _Fill_zero_memset(_CtgIt _Dest, const size_t _Count) { :: memset(_To_address(_Dest), 0, _Count * sizeof(_Iter_value_t<_CtgIt>)); } template <class _Ty> [[nodiscard]] bool _Is_all_bits_zero(const _Ty& _Val) { ; constexpr _Ty _Zero{}; return :: memcmp(&_Val, &_Zero, sizeof(_Ty)) == 0; } template <class _FwdIt, class _Ty> constexpr void fill(const _FwdIt _First, const _FwdIt _Last, const _Ty& _Val) { _Adl_verify_range(_First, _Last); if constexpr (_Is_vb_iterator<_FwdIt, true>) { _Fill_vbool(_First, _Last, _Val); } else { auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); if (!::std:: is_constant_evaluated()) { if constexpr (_Fill_memset_is_safe<decltype(_UFirst), _Ty>) { _Fill_memset(_UFirst, _Val, static_cast<size_t>(_ULast - _UFirst)); return; } else if constexpr (_Fill_zero_memset_is_safe<decltype(_UFirst), _Ty>) { if (_Is_all_bits_zero(_Val)) { _Fill_zero_memset(_UFirst, static_cast<size_t>(_ULast - _UFirst)); return; } } } for (; _UFirst != _ULast; ++_UFirst) { *_UFirst = _Val; } } } template <class _ExPo, class _FwdIt, class _Ty, _Enable_if_execution_policy_t<_ExPo> = 0> void fill(_ExPo&&, _FwdIt _First, _FwdIt _Last, const _Ty& _Val) noexcept { static_assert(_Is_fwd_iter_v<_FwdIt>, "Parallel algorithms require forward iterators or stronger."); return ::std:: fill(_First, _Last, _Val); } template <class _OutIt, class _Diff, class _Ty> constexpr _OutIt fill_n(_OutIt _Dest, const _Diff _Count_raw, const _Ty& _Val) { _Algorithm_int_t<_Diff> _Count = _Count_raw; if (0 < _Count) { if constexpr (_Is_vb_iterator<_OutIt, true>) { const auto _Last = _Dest + static_cast<typename _OutIt::difference_type>(_Count); _Fill_vbool(_Dest, _Last, _Val); return _Last; } else { auto _UDest = _Get_unwrapped_n(_Dest, _Count); if (!::std:: is_constant_evaluated()) { if constexpr (_Fill_memset_is_safe<decltype(_UDest), _Ty>) { _Fill_memset(_UDest, _Val, static_cast<size_t>(_Count)); _Seek_wrapped(_Dest, _UDest + _Count); return _Dest; } else if constexpr (_Fill_zero_memset_is_safe<decltype(_UDest), _Ty>) { if (_Is_all_bits_zero(_Val)) { _Fill_zero_memset(_UDest, static_cast<size_t>(_Count)); _Seek_wrapped(_Dest, _UDest + _Count); return _Dest; } } } for (; 0 < _Count; --_Count, (void) ++_UDest) { *_UDest = _Val; } _Seek_wrapped(_Dest, _UDest); } } return _Dest; } template <class _ExPo, class _FwdIt, class _Diff, class _Ty, _Enable_if_execution_policy_t<_ExPo> = 0> _FwdIt fill_n(_ExPo&&, _FwdIt _Dest, _Diff _Count_raw, const _Ty& _Val) noexcept { static_assert(_Is_fwd_iter_v<_FwdIt>, "Parallel algorithms require forward iterators or stronger."); return ::std:: fill_n(_Dest, _Count_raw, _Val); } namespace ranges { class _Fill_n_fn : private _Not_quite_object { public: using _Not_quite_object::_Not_quite_object; template <class _Ty, output_iterator<const _Ty&> _It> constexpr _It operator()(_It _First, iter_difference_t<_It> _Count, const _Ty& _Value) const { if (_Count > 0) { auto _UFirst = _Get_unwrapped_n(::std:: move(_First), _Count); if (!::std:: is_constant_evaluated()) { if constexpr (_Fill_memset_is_safe<decltype(_UFirst), _Ty>) { _Fill_memset(_UFirst, _Value, static_cast<size_t>(_Count)); _Seek_wrapped(_First, _UFirst + _Count); return _First; } else if constexpr (_Fill_zero_memset_is_safe<decltype(_UFirst), _Ty>) { if (_Is_all_bits_zero(_Value)) { _Fill_zero_memset(_UFirst, static_cast<size_t>(_Count)); _Seek_wrapped(_First, _UFirst + _Count); return _First; } } } for (; _Count > 0; ++_UFirst, (void) --_Count) { *_UFirst = _Value; } _Seek_wrapped(_First, ::std:: move(_UFirst)); } return _First; } }; inline constexpr _Fill_n_fn fill_n{_Not_quite_object::_Construct_tag{}}; } #pragma warning(push) #pragma warning(disable : 4806) template <class _Elem1, class _Elem2, bool = sizeof(_Elem1) == sizeof(_Elem2) && is_integral_v<_Elem1> && !is_volatile_v<_Elem1> && is_integral_v<_Elem2> && !is_volatile_v<_Elem2>> inline constexpr bool _Can_memcmp_elements = is_same_v<_Elem1, bool> || is_same_v<_Elem2, bool> || static_cast<_Elem1>(-1) == static_cast<_Elem2>(-1); #pragma warning(pop) template <> inline constexpr bool _Can_memcmp_elements<byte, byte, false> = true; template <class _Ty1, class _Ty2> inline constexpr bool _Can_memcmp_elements<_Ty1*, _Ty2*, false> = is_same_v<remove_cv_t<_Ty1>, remove_cv_t<_Ty2>>; template <class _Elem1, class _Elem2> inline constexpr bool _Can_memcmp_elements<_Elem1, _Elem2, false> = false; template <class _Elem1, class _Elem2, class _Pr> inline constexpr bool _Pred_is_consistent_with_memcmp = false; template <class _Elem> inline constexpr bool _Pred_is_consistent_with_memcmp<_Elem, _Elem, equal_to<_Elem>> = true; template <class _Elem1, class _Elem2> inline constexpr bool _Pred_is_consistent_with_memcmp<_Elem1, _Elem2, equal_to<>> = true; template <class _Elem1, class _Elem2> inline constexpr bool _Pred_is_consistent_with_memcmp<_Elem1, _Elem2, ::std::ranges:: equal_to> = true; template <class _Elem1, class _Elem2, class _Pr> inline constexpr bool _Can_memcmp_elements_with_pred = _Can_memcmp_elements<_Elem1, _Elem2> && _Pred_is_consistent_with_memcmp<_Elem1, _Elem2, _Pr>; template <class _Iter1, class _Iter2, class _Pr> inline constexpr bool _Equal_memcmp_is_safe_helper = _Iterators_are_contiguous<_Iter1, _Iter2> && _Can_memcmp_elements_with_pred<remove_const_t<remove_reference_t<_Iter_ref_t<_Iter1>>>, remove_const_t<remove_reference_t<_Iter_ref_t<_Iter2>>>, _Pr>; template <class _Iter1, class _Iter2, class _Pr> inline constexpr bool _Equal_memcmp_is_safe = _Equal_memcmp_is_safe_helper<remove_const_t<_Iter1>, remove_const_t<_Iter2>, _Pr>; template <class _CtgIt1, class _CtgIt2> [[nodiscard]] int _Memcmp_ranges(_CtgIt1 _First1, _CtgIt1 _Last1, _CtgIt2 _First2) { ; const auto _First1_ch = reinterpret_cast<const char*>(_To_address(_First1)); const auto _Last1_ch = reinterpret_cast<const char*>(_To_address(_Last1)); const auto _First2_ch = reinterpret_cast<const char*>(_To_address(_First2)); return :: memcmp(_First1_ch, _First2_ch, static_cast<size_t>(_Last1_ch - _First1_ch)); } template <class _CtgIt1, class _CtgIt2> [[nodiscard]] int _Memcmp_count(_CtgIt1 _First1, _CtgIt2 _First2, const size_t _Count) { ; const auto _First1_ch = reinterpret_cast<const char*>(_To_address(_First1)); const auto _First2_ch = reinterpret_cast<const char*>(_To_address(_First2)); return :: memcmp(_First1_ch, _First2_ch, _Count * sizeof(_Iter_value_t<_CtgIt1>)); } template <class _InIt1, class _InIt2, class _Pr> [[nodiscard]] constexpr bool equal(const _InIt1 _First1, const _InIt1 _Last1, const _InIt2 _First2, _Pr _Pred) { _Adl_verify_range(_First1, _Last1); auto _UFirst1 = _Get_unwrapped(_First1); const auto _ULast1 = _Get_unwrapped(_Last1); auto _UFirst2 = _Get_unwrapped_n(_First2, _Idl_distance<_InIt1>(_UFirst1, _ULast1)); if constexpr (_Equal_memcmp_is_safe<decltype(_UFirst1), decltype(_UFirst2), _Pr>) { if (!::std:: is_constant_evaluated()) { return _Memcmp_ranges(_UFirst1, _ULast1, _UFirst2) == 0; } } for (; _UFirst1 != _ULast1; ++_UFirst1, (void) ++_UFirst2) { if (!_Pred(*_UFirst1, *_UFirst2)) { return false; } } return true; } template <class _ExPo, class _FwdIt1, class _FwdIt2, class _Pr, _Enable_if_execution_policy_t<_ExPo> = 0> [[nodiscard]] bool equal(_ExPo&& _Exec, const _FwdIt1 _First1, const _FwdIt1 _Last1, const _FwdIt2 _First2, _Pr _Pred) noexcept; template <class _InIt1, class _InIt2> [[nodiscard]] constexpr bool equal(const _InIt1 _First1, const _InIt1 _Last1, const _InIt2 _First2) { return ::std:: equal(_First1, _Last1, _First2, equal_to<>{}); } template <class _ExPo, class _FwdIt1, class _FwdIt2, _Enable_if_execution_policy_t<_ExPo> = 0> [[nodiscard]] bool equal(_ExPo&& _Exec, const _FwdIt1 _First1, const _FwdIt1 _Last1, const _FwdIt2 _First2) noexcept { return ::std:: equal(::std:: forward<_ExPo>(_Exec), _First1, _Last1, _First2, equal_to{}); } template <class _InIt1, class _InIt2, class _Pr> [[nodiscard]] constexpr bool equal( const _InIt1 _First1, const _InIt1 _Last1, const _InIt2 _First2, const _InIt2 _Last2, _Pr _Pred) { _Adl_verify_range(_First1, _Last1); _Adl_verify_range(_First2, _Last2); auto _UFirst1 = _Get_unwrapped(_First1); const auto _ULast1 = _Get_unwrapped(_Last1); auto _UFirst2 = _Get_unwrapped(_First2); const auto _ULast2 = _Get_unwrapped(_Last2); if constexpr (_Is_random_iter_v<_InIt1> && _Is_random_iter_v<_InIt2>) { if (_ULast1 - _UFirst1 != _ULast2 - _UFirst2) { return false; } return ::std:: equal(_UFirst1, _ULast1, _UFirst2, _Pass_fn(_Pred)); } else { for (;;) { if (_UFirst1 == _ULast1) { return _UFirst2 == _ULast2; } if (_UFirst2 == _ULast2) { return false; } if (!_Pred(*_UFirst1, *_UFirst2)) { return false; } ++_UFirst1; ++_UFirst2; } } } template <class _ExPo, class _FwdIt1, class _FwdIt2, class _Pr, _Enable_if_execution_policy_t<_ExPo> = 0> [[nodiscard]] bool equal(_ExPo&& _Exec, const _FwdIt1 _First1, const _FwdIt1 _Last1, const _FwdIt2 _First2, const _FwdIt2 _Last2, _Pr _Pred) noexcept; template <class _InIt1, class _InIt2> [[nodiscard]] constexpr bool equal( const _InIt1 _First1, const _InIt1 _Last1, const _InIt2 _First2, const _InIt2 _Last2) { return ::std:: equal(_First1, _Last1, _First2, _Last2, equal_to<>{}); } template <class _ExPo, class _FwdIt1, class _FwdIt2, _Enable_if_execution_policy_t<_ExPo> = 0> [[nodiscard]] bool equal(_ExPo&& _Exec, const _FwdIt1 _First1, const _FwdIt1 _Last1, const _FwdIt2 _First2, const _FwdIt2 _Last2) noexcept { return ::std:: equal(::std:: forward<_ExPo>(_Exec), _First1, _Last1, _First2, _Last2, equal_to{}); } namespace ranges { template <forward_range _Rng, class _It> [[nodiscard]] constexpr iterator_t<_Rng> _Rewrap_iterator(_Rng&& _Range, _It&& _Val) { ; if constexpr (is_same_v<remove_cvref_t<_It>, iterator_t<_Rng>>) { return ::std:: forward<_It>(_Val); } else { auto _Result = ::std::ranges:: begin(_Range); _Result._Seek_to(::std:: forward<_It>(_Val)); return _Result; } } template <class _In1, class _In2> struct in_in_result { _In1 in1; _In2 in2; template <_Convertible_from<const _In1&> _IIn1, _Convertible_from<const _In2&> _IIn2> constexpr operator in_in_result<_IIn1, _IIn2>() const& { return {in1, in2}; } template <_Convertible_from<_In1> _IIn1, _Convertible_from<_In2> _IIn2> constexpr operator in_in_result<_IIn1, _IIn2>() && { return {::std:: move(in1), ::std:: move(in2)}; } }; template <class _In1, class _In2> using mismatch_result = in_in_result<_In1, _In2>; class _Mismatch_fn : private _Not_quite_object { private: template <class _It1, class _It2, class _Pr, class _Pj1, class _Pj2> [[nodiscard]] static constexpr mismatch_result<_It1, _It2> _Mismatch_n( _It1 _First1, _It2 _First2, iter_difference_t<_It1> _Count, _Pr _Pred, _Pj1 _Proj1, _Pj2 _Proj2) { auto _UFirst1 = _Get_unwrapped(::std:: move(_First1)); auto _UFirst2 = _Get_unwrapped(::std:: move(_First2)); for (; _Count != 0; ++_UFirst1, (void) ++_UFirst2, --_Count) { if (!::std:: invoke(_Pred, ::std:: invoke(_Proj1, *_UFirst1), ::std:: invoke(_Proj2, *_UFirst2))) { break; } } _Seek_wrapped(_First1, ::std:: move(_UFirst1)); _Seek_wrapped(_First2, ::std:: move(_UFirst2)); return {::std:: move(_First1), ::std:: move(_First2)}; } template <class _It1, class _Se1, class _It2, class _Se2, class _Pr, class _Pj1, class _Pj2> [[nodiscard]] static constexpr mismatch_result<_It1, _It2> _Mismatch_4( _It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, _Pr _Pred, _Pj1 _Proj1, _Pj2 _Proj2) { auto _UFirst1 = _Get_unwrapped(::std:: move(_First1)); const auto _ULast1 = _Get_unwrapped(::std:: move(_Last1)); auto _UFirst2 = _Get_unwrapped(::std:: move(_First2)); const auto _ULast2 = _Get_unwrapped(::std:: move(_Last2)); for (; _UFirst1 != _ULast1 && _UFirst2 != _ULast2; ++_UFirst1, (void) ++_UFirst2) { if (!::std:: invoke(_Pred, ::std:: invoke(_Proj1, *_UFirst1), ::std:: invoke(_Proj2, *_UFirst2))) { break; } } _Seek_wrapped(_First1, ::std:: move(_UFirst1)); _Seek_wrapped(_First2, ::std:: move(_UFirst2)); return {::std:: move(_First1), ::std:: move(_First2)}; } public: using _Not_quite_object::_Not_quite_object; template <input_iterator _It1, sentinel_for<_It1> _Se1, input_iterator _It2, sentinel_for<_It2> _Se2, class _Pr = ranges::equal_to, class _Pj1 = identity, class _Pj2 = identity> requires indirectly_comparable<_It1, _It2, _Pr, _Pj1, _Pj2> [[nodiscard]] constexpr mismatch_result<_It1, _It2> operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { _Adl_verify_range(_First1, _Last1); _Adl_verify_range(_First2, _Last2); if constexpr (sized_sentinel_for<_Se1, _It1> && sized_sentinel_for<_Se2, _It2>) { iter_difference_t<_It1> _Count1 = _Last1 - _First1; const iter_difference_t<_It2> _Count2 = _Last2 - _First2; if (_Count1 > _Count2) { _Count1 = static_cast<decltype(_Count1)>(_Count2); } return _Mismatch_n(::std:: move(_First1), ::std:: move(_First2), _Count1, _Pass_fn(_Pred), _Pass_fn(_Proj1), _Pass_fn(_Proj2)); } else { return _Mismatch_4(::std:: move(_First1), ::std:: move(_Last1), ::std:: move(_First2), ::std:: move(_Last2), _Pass_fn(_Pred), _Pass_fn(_Proj1), _Pass_fn(_Proj2)); } } template <input_range _Rng1, input_range _Rng2, class _Pr = ranges::equal_to, class _Pj1 = identity, class _Pj2 = identity> requires indirectly_comparable<iterator_t<_Rng1>, iterator_t<_Rng2>, _Pr, _Pj1, _Pj2> [[nodiscard]] constexpr mismatch_result<borrowed_iterator_t<_Rng1>, borrowed_iterator_t<_Rng2>> operator()( _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { if constexpr (sized_range<_Rng1> && sized_range<_Rng2>) { range_difference_t<_Rng1> _Count1 = ::std::ranges:: distance(_Range1); const range_difference_t<_Rng2> _Count2 = ::std::ranges:: distance(_Range2); if (_Count1 > _Count2) { _Count1 = static_cast<range_difference_t<_Rng1>>(_Count2); } return _Mismatch_n(::std::ranges:: begin(_Range1), ::std::ranges:: begin(_Range2), _Count1, _Pass_fn(_Pred), _Pass_fn(_Proj1), _Pass_fn(_Proj2)); } else { return _Mismatch_4(::std::ranges:: begin(_Range1), ::std::ranges:: end(_Range1), ::std::ranges:: begin(_Range2), ::std::ranges:: end(_Range2), _Pass_fn(_Pred), _Pass_fn(_Proj1), _Pass_fn(_Proj2)); } } }; inline constexpr _Mismatch_fn mismatch{_Not_quite_object::_Construct_tag{}}; } template <class _Elem1, class _Elem2, class _FTy> struct _Lex_compare_check_element_types_helper : bool_constant< conjunction_v<_Is_character<_Elem1>, _Is_character<_Elem2>, _Is_character<_FTy>, is_unsigned<_FTy>>> { }; template <class _Elem1, class _Elem2> struct _Lex_compare_check_element_types_helper<_Elem1, _Elem2, void> : bool_constant< conjunction_v<_Is_character<_Elem1>, _Is_character<_Elem2>, is_unsigned<_Elem1>, is_unsigned<_Elem2>>> { }; template <> struct _Lex_compare_check_element_types_helper<byte, byte, byte> : true_type { }; template <> struct _Lex_compare_check_element_types_helper<byte, byte, void> : true_type { }; template <class _Memcmp_pr> struct _Lex_compare_optimize { explicit _Lex_compare_optimize() = default; using _Pred = _Memcmp_pr; }; template <class _Memcmp_pr, class _Obj1, class _Obj2, class _FTy> using _Lex_compare_check_element_types = _Lex_compare_optimize<conditional_t< _Lex_compare_check_element_types_helper<remove_const_t<_Obj1>, remove_const_t<_Obj2>, _FTy>::value, _Memcmp_pr, void>>; template <class _InIt1, class _InIt2, class _Pr> constexpr auto _Lex_compare_memcmp_classify(const _InIt1&, const _InIt2&, const _Pr&) { return _Lex_compare_optimize<void>{}; } template <class _CtgIt1, class _CtgIt2, class _FTy, enable_if_t<_Iterators_are_contiguous<_CtgIt1, _CtgIt2>, int> = 0> constexpr auto _Lex_compare_memcmp_classify(const _CtgIt1&, const _CtgIt2&, const less<_FTy>&) { return _Lex_compare_check_element_types<less<int>, remove_reference_t<_Iter_ref_t<_CtgIt1>>, remove_reference_t<_Iter_ref_t<_CtgIt2>>, _FTy>{}; } template <class _CtgIt1, class _CtgIt2, class _FTy, enable_if_t<_Iterators_are_contiguous<_CtgIt1, _CtgIt2>, int> = 0> constexpr auto _Lex_compare_memcmp_classify(const _CtgIt1&, const _CtgIt2&, const greater<_FTy>&) { return _Lex_compare_check_element_types<greater<int>, remove_reference_t<_Iter_ref_t<_CtgIt1>>, remove_reference_t<_Iter_ref_t<_CtgIt2>>, _FTy>{}; } template <class _CtgIt1, class _CtgIt2, enable_if_t<_Iterators_are_contiguous<_CtgIt1, _CtgIt2>, int> = 0> constexpr auto _Lex_compare_memcmp_classify(const _CtgIt1&, const _CtgIt2&, const ::std::ranges:: less&) { return _Lex_compare_check_element_types<less<int>, remove_reference_t<_Iter_ref_t<_CtgIt1>>, remove_reference_t<_Iter_ref_t<_CtgIt2>>, void>{}; } template <class _CtgIt1, class _CtgIt2, enable_if_t<_Iterators_are_contiguous<_CtgIt1, _CtgIt2>, int> = 0> constexpr auto _Lex_compare_memcmp_classify(const _CtgIt1&, const _CtgIt2&, const ::std::ranges:: greater&) { return _Lex_compare_check_element_types<greater<int>, remove_reference_t<_Iter_ref_t<_CtgIt1>>, remove_reference_t<_Iter_ref_t<_CtgIt2>>, void>{}; } template <class _InIt1, class _InIt2, class _Pr> [[nodiscard]] constexpr bool _Lex_compare_unchecked( _InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _InIt2 _Last2, _Pr _Pred, _Lex_compare_optimize<void>) { for (; _First1 != _Last1 && _First2 != _Last2; ++_First1, (void) ++_First2) { if (_Debug_lt_pred(_Pred, *_First1, *_First2)) { return true; } else if (_Pred(*_First2, *_First1)) { return false; } } return _First1 == _Last1 && _First2 != _Last2; } template <class _CtgIt1, class _CtgIt2, class _Pr, class _Memcmp_pr> [[nodiscard]] constexpr bool _Lex_compare_unchecked( _CtgIt1 _First1, _CtgIt1 _Last1, _CtgIt2 _First2, _CtgIt2 _Last2, _Pr _Pred, _Lex_compare_optimize<_Memcmp_pr>) { if (::std:: is_constant_evaluated()) { return _Lex_compare_unchecked(_First1, _Last1, _First2, _Last2, _Pred, _Lex_compare_optimize<void>{}); } (void) _Pred; const auto _Num1 = static_cast<size_t>(_Last1 - _First1); const auto _Num2 = static_cast<size_t>(_Last2 - _First2); const int _Ans = _Memcmp_count(_First1, _First2, (::std:: min)(_Num1, _Num2)); return _Memcmp_pr{}(_Ans, 0) || (_Ans == 0 && _Num1 < _Num2); } template <class _InIt1, class _InIt2, class _Pr> [[nodiscard]] constexpr bool lexicographical_compare( _InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _InIt2 _Last2, _Pr _Pred) { _Adl_verify_range(_First1, _Last1); _Adl_verify_range(_First2, _Last2); const auto _UFirst1 = _Get_unwrapped(_First1); const auto _ULast1 = _Get_unwrapped(_Last1); const auto _UFirst2 = _Get_unwrapped(_First2); const auto _ULast2 = _Get_unwrapped(_Last2); return _Lex_compare_unchecked( _UFirst1, _ULast1, _UFirst2, _ULast2, _Pass_fn(_Pred), _Lex_compare_memcmp_classify(_UFirst1, _UFirst2, _Pred)); } template <class _InIt1, class _InIt2> [[nodiscard]] constexpr bool lexicographical_compare(_InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _InIt2 _Last2) { return ::std:: lexicographical_compare(_First1, _Last1, _First2, _Last2, less<>{}); } template <class _ExPo, class _FwdIt1, class _FwdIt2, class _Pr, _Enable_if_execution_policy_t<_ExPo> = 0> [[nodiscard]] bool lexicographical_compare( _ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _FwdIt2 _Last2, _Pr _Pred) noexcept { static_assert(_Is_fwd_iter_v<_FwdIt1>, "Parallel algorithms require forward iterators or stronger."); static_assert(_Is_fwd_iter_v<_FwdIt2>, "Parallel algorithms require forward iterators or stronger."); return ::std:: lexicographical_compare(_First1, _Last1, _First2, _Last2, _Pass_fn(_Pred)); } template <class _ExPo, class _FwdIt1, class _FwdIt2, _Enable_if_execution_policy_t<_ExPo> = 0> [[nodiscard]] bool lexicographical_compare( _ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _FwdIt2 _Last2) noexcept { static_assert(_Is_fwd_iter_v<_FwdIt1>, "Parallel algorithms require forward iterators or stronger."); static_assert(_Is_fwd_iter_v<_FwdIt2>, "Parallel algorithms require forward iterators or stronger."); return ::std:: lexicographical_compare(_First1, _Last1, _First2, _Last2); } template <class _InIt1, class _InIt2, class _Cmp> [[nodiscard]] constexpr auto lexicographical_compare_three_way( _InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _InIt2 _Last2, _Cmp _Comp) -> decltype(_Comp(*_First1, *_First2)) { _Adl_verify_range(_First1, _Last1); _Adl_verify_range(_First2, _Last2); auto _UFirst1 = _Get_unwrapped(_First1); const auto _ULast1 = _Get_unwrapped(_Last1); auto _UFirst2 = _Get_unwrapped(_First2); const auto _ULast2 = _Get_unwrapped(_Last2); using _UIt1 = decltype(_UFirst1); using _UIt2 = decltype(_UFirst2); using _Ty1 = remove_const_t<remove_pointer_t<_UIt1>>; using _Ty2 = remove_const_t<remove_pointer_t<_UIt2>>; if constexpr ( conjunction_v<is_same<_Cmp, compare_three_way>, bool_constant<_Iterators_are_contiguous<_UIt1, _UIt2>>, disjunction< conjunction<is_same<_Ty1, byte>, is_same<_Ty2, byte>>, conjunction<_Is_character<_Ty1>, is_unsigned<_Ty1>, _Is_character<_Ty2>, is_unsigned<_Ty2>>>>) { if (!::std:: is_constant_evaluated()) { const auto _Num1 = static_cast<size_t>(_ULast1 - _UFirst1); const auto _Num2 = static_cast<size_t>(_ULast2 - _UFirst2); const int _Ans = _Memcmp_count(_UFirst1, _UFirst2, (::std:: min)(_Num1, _Num2)); if (_Ans == 0) { return _Num1 <=> _Num2; } else { return _Ans <=> 0; } } } for (;;) { if (_UFirst1 == _ULast1) { return _UFirst2 == _ULast2 ? strong_ordering::equal : strong_ordering::less; } if (_UFirst2 == _ULast2) { return strong_ordering::greater; } if (const auto _CmpResult = _Comp(*_UFirst1, *_UFirst2); _CmpResult != 0) { return _CmpResult; } ++_UFirst1; ++_UFirst2; } } template <class _InIt1, class _InIt2> [[nodiscard]] constexpr auto lexicographical_compare_three_way( _InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _InIt2 _Last2) { return ::std:: lexicographical_compare_three_way(_First1, _Last1, _First2, _Last2, compare_three_way{}); } template <class _Ty> [[nodiscard]] constexpr bool _Within_limits(const _Ty& _Val, true_type, true_type, _Any_tag, false_type) { return (-128) <= _Val && _Val <= 127; } template <class _Ty> [[nodiscard]] constexpr bool _Within_limits(const _Ty& _Val, true_type, false_type, true_type, false_type) { return _Val <= 127 || static_cast<_Ty>((-128)) <= _Val; } template <class _Ty> [[nodiscard]] constexpr bool _Within_limits(const _Ty& _Val, true_type, false_type, false_type, false_type) { return _Val <= 127; } template <class _Ty> [[nodiscard]] constexpr bool _Within_limits(const _Ty& _Val, false_type, true_type, _Any_tag, false_type) { return 0 <= _Val && _Val <= 0xff; } template <class _Ty> [[nodiscard]] constexpr bool _Within_limits(const _Ty& _Val, false_type, false_type, _Any_tag, false_type) { return _Val <= 0xff; } template <class _Ty> [[nodiscard]] constexpr bool _Within_limits(const _Ty& _Val, _Any_tag, _Any_tag, _Any_tag, true_type) { return _Val == true || _Val == false; } template <class _InIt, class _Ty> [[nodiscard]] constexpr bool _Within_limits(const _InIt&, const _Ty& _Val) { using _Elem = _Iter_value_t<_InIt>; return _Within_limits(_Val, bool_constant<is_signed_v<_Elem>>{}, bool_constant<is_signed_v<_Ty>>{}, bool_constant<-1 == static_cast<_Ty>(-1)>{}, bool_constant<is_same_v<_Elem, bool>>{}); } template <class _InIt> [[nodiscard]] constexpr bool _Within_limits(const _InIt&, const bool&) { return true; } template <class _InIt> [[nodiscard]] constexpr bool _Within_limits(const _InIt&, const byte&) { return true; } template <class _Iter, class _Ty> inline constexpr bool _Memchr_in_find_is_safe = _Iterator_is_contiguous<_Iter>&& disjunction_v<conjunction<is_integral<_Ty>, _Is_character_or_bool<_Iter_value_t<_Iter>>> , conjunction<is_same<_Ty, byte>, is_same<_Iter_value_t<_Iter>, byte>> > && !is_volatile_v<remove_reference_t<_Iter_ref_t<_Iter>>>; template <class _InIt, class _Ty> [[nodiscard]] constexpr _InIt _Find_unchecked1(_InIt _First, const _InIt _Last, const _Ty& _Val, false_type) { for (; _First != _Last; ++_First) { if (*_First == _Val) { break; } } return _First; } template <class _InIt, class _Ty> [[nodiscard]] constexpr _InIt _Find_unchecked1(_InIt _First, const _InIt _Last, const _Ty& _Val, true_type) { if (!_Within_limits(_First, _Val)) { return _Last; } if (::std:: is_constant_evaluated()) { using _Elem = _Iter_value_t<_InIt>; return _Find_unchecked1(_First, _Last, static_cast<_Elem>(_Val), false_type{}); } const auto _First_ptr = _To_address(_First); const auto _Result = static_cast<remove_reference_t<_Iter_ref_t<_InIt>>*>( :: memchr(_First_ptr, static_cast<unsigned char>(_Val), static_cast<size_t>(_Last - _First))); if constexpr (is_pointer_v<_InIt>) { return _Result ? _Result : _Last; } else { return _Result ? _First + (_Result - _First_ptr) : _Last; } } template <class _InIt, class _Ty> [[nodiscard]] constexpr _InIt _Find_unchecked(const _InIt _First, const _InIt _Last, const _Ty& _Val) { return _Find_unchecked1(_First, _Last, _Val, bool_constant<_Memchr_in_find_is_safe<_InIt, _Ty>>{}); } template <class _InIt, class _Ty> [[nodiscard]] constexpr _InIt find(_InIt _First, const _InIt _Last, const _Ty& _Val) { _Adl_verify_range(_First, _Last); _Seek_wrapped(_First, _Find_unchecked(_Get_unwrapped(_First), _Get_unwrapped(_Last), _Val)); return _First; } template <class _ExPo, class _FwdIt, class _Ty, _Enable_if_execution_policy_t<_ExPo> = 0> [[nodiscard]] _FwdIt find(_ExPo&& _Exec, _FwdIt _First, const _FwdIt _Last, const _Ty& _Val) noexcept; namespace ranges { template <input_iterator _It, sentinel_for<_It> _Se, class _Ty, class _Pj = identity> requires indirect_binary_predicate<ranges::equal_to, projected<_It, _Pj>, const _Ty*> [[nodiscard]] constexpr _It _Find_unchecked(_It _First, const _Se _Last, const _Ty& _Val, _Pj _Proj = {}) { if constexpr (_Memchr_in_find_is_safe<_It, _Ty> && sized_sentinel_for<_Se, _It> && same_as<_Pj, identity>) { if (!::std:: is_constant_evaluated()) { if (!_Within_limits(_First, _Val)) { return ::std::ranges:: next(::std:: move(_First), _Last); } const auto _First_ptr = ::std:: to_address(_First); const auto _Result = static_cast<remove_reference_t<_Iter_ref_t<_It>>*>( :: memchr(_First_ptr, static_cast<unsigned char>(_Val), static_cast<size_t>(_Last - _First))); if (_Result) { if constexpr (is_pointer_v<_It>) { return _Result; } else { return ::std::ranges:: next(::std:: move(_First), _Result - _First_ptr); } } else { return ::std::ranges:: next(::std:: move(_First), _Last); } } } for (; _First != _Last; ++_First) { if (::std:: invoke(_Proj, *_First) == _Val) { break; } } return _First; } class _Find_fn : private _Not_quite_object { public: using _Not_quite_object::_Not_quite_object; template <input_iterator _It, sentinel_for<_It> _Se, class _Ty, class _Pj = identity> requires indirect_binary_predicate<ranges::equal_to, projected<_It, _Pj>, const _Ty*> [[nodiscard]] constexpr _It operator()(_It _First, _Se _Last, const _Ty& _Val, _Pj _Proj = {}) const { _Adl_verify_range(_First, _Last); auto _UResult = ::std::ranges:: _Find_unchecked( _Get_unwrapped(::std:: move(_First)), _Get_unwrapped(::std:: move(_Last)), _Val, _Pass_fn(_Proj)); _Seek_wrapped(_First, ::std:: move(_UResult)); return _First; } template <input_range _Rng, class _Ty, class _Pj = identity> requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Rng>, _Pj>, const _Ty*> [[nodiscard]] constexpr borrowed_iterator_t<_Rng> operator()( _Rng&& _Range, const _Ty& _Val, _Pj _Proj = {}) const { auto _First = ::std::ranges:: begin(_Range); auto _UResult = ::std::ranges:: _Find_unchecked(_Get_unwrapped(::std:: move(_First)), _Uend(_Range), _Val, _Pass_fn(_Proj)); _Seek_wrapped(_First, ::std:: move(_UResult)); return _First; } }; inline constexpr _Find_fn find{_Not_quite_object::_Construct_tag{}}; } template <class _InIt, class _Ty> [[nodiscard]] constexpr _Iter_diff_t<_InIt> count(const _InIt _First, const _InIt _Last, const _Ty& _Val) { _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); _Iter_diff_t<_InIt> _Count = 0; for (; _UFirst != _ULast; ++_UFirst) { if (*_UFirst == _Val) { ++_Count; } } return _Count; } template <class _ExPo, class _FwdIt, class _Ty, _Enable_if_execution_policy_t<_ExPo> = 0> [[nodiscard]] _Iter_diff_t<_FwdIt> count( _ExPo&& _Exec, const _FwdIt _First, const _FwdIt _Last, const _Ty& _Val) noexcept; template <class _InIt, class _Ty, class _Pr> [[nodiscard]] constexpr _InIt _Find_pr(_InIt _First, const _InIt _Last, const _Ty& _Val, _Pr _Pred) { for (; _First != _Last; ++_First) { if (_Pred(*_First, _Val)) { break; } } return _First; } template <class _InIt, class _Ty, class _Pr> [[nodiscard]] constexpr _Iter_diff_t<_InIt> _Count_pr(_InIt _First, const _InIt _Last, const _Ty& _Val, _Pr _Pred) { _Iter_diff_t<_InIt> _Count = 0; for (; _First != _Last; ++_First) { if (_Pred(*_First, _Val)) { ++_Count; } } return _Count; } template <class _FwdIt1, class _FwdIt2, class _Pr> [[nodiscard]] constexpr bool _Check_match_counts( const _FwdIt1 _First1, _FwdIt1 _Last1, const _FwdIt2 _First2, _FwdIt2 _Last2, _Pr _Pred) { ; ; if constexpr (_Is_bidi_iter_v<_FwdIt1> && _Is_bidi_iter_v<_FwdIt2>) { do { --_Last1; --_Last2; } while (_Pred(*_Last1, *_Last2)); ++_Last1; ++_Last2; } for (_FwdIt1 _Next1 = _First1; _Next1 != _Last1; ++_Next1) { if (_Next1 == _Find_pr(_First1, _Next1, *_Next1, _Pred)) { _Iter_diff_t<_FwdIt2> _Count2 = _Count_pr(_First2, _Last2, *_Next1, _Pred); if (_Count2 == 0) { return false; } _FwdIt1 _Skip1 = _Next_iter(_Next1); _Iter_diff_t<_FwdIt1> _Count1 = _Count_pr(_Skip1, _Last1, *_Next1, _Pred) + 1; if (_Count2 != _Count1) { return false; } } } return true; } template <class _BidIt> constexpr void reverse(const _BidIt _First, const _BidIt _Last) { _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_First); auto _ULast = _Get_unwrapped(_Last); using _Elem = remove_reference_t<_Iter_ref_t<decltype(_UFirst)>>; constexpr bool _Allow_vectorization = conjunction_v<bool_constant<_Iterator_is_contiguous<decltype(_UFirst)>>, _Is_trivially_swappable<_Elem>, negation<is_volatile<_Elem>>>; constexpr size_t _Nx = sizeof(_Elem); #pragma warning(suppress : 6326) if constexpr (_Allow_vectorization && _Nx <= 8 && (_Nx & (_Nx - 1)) == 0) { if (!::std:: is_constant_evaluated()) { if constexpr (_Nx == 1) { __std_reverse_trivially_swappable_1(_To_address(_UFirst), _To_address(_ULast)); } else if constexpr (_Nx == 2) { __std_reverse_trivially_swappable_2(_To_address(_UFirst), _To_address(_ULast)); } else if constexpr (_Nx == 4) { __std_reverse_trivially_swappable_4(_To_address(_UFirst), _To_address(_ULast)); } else { __std_reverse_trivially_swappable_8(_To_address(_UFirst), _To_address(_ULast)); } return; } } for (; _UFirst != _ULast && _UFirst != --_ULast; ++_UFirst) { ::std:: iter_swap(_UFirst, _ULast); } } template <class _ExPo, class _BidIt, _Enable_if_execution_policy_t<_ExPo> = 0> void reverse(_ExPo&&, _BidIt _First, _BidIt _Last) noexcept { return ::std:: reverse(_First, _Last); } template <class _BidIt> constexpr pair<_BidIt, _BidIt> _Reverse_until_sentinel_unchecked(_BidIt _First, _BidIt _Sentinel, _BidIt _Last) { while (_First != _Sentinel && _Last != _Sentinel) { ::std:: iter_swap(_First, --_Last); ++_First; } return pair<_BidIt, _BidIt>(_First, _Last); } template <class _FwdIt> constexpr _FwdIt rotate(_FwdIt _First, _FwdIt _Mid, _FwdIt _Last) { _Adl_verify_range(_First, _Mid); _Adl_verify_range(_Mid, _Last); auto _UFirst = _Get_unwrapped(_First); auto _UMid = _Get_unwrapped(_Mid); const auto _ULast = _Get_unwrapped(_Last); if (_UFirst == _UMid) { return _Last; } if (_UMid == _ULast) { return _First; } if constexpr (_Is_random_iter_v<_FwdIt>) { ::std:: reverse(_UFirst, _UMid); ::std:: reverse(_UMid, _ULast); ::std:: reverse(_UFirst, _ULast); _Seek_wrapped(_First, _UFirst + (_ULast - _UMid)); } else if constexpr (_Is_bidi_iter_v<_FwdIt>) { ::std:: reverse(_UFirst, _UMid); ::std:: reverse(_UMid, _ULast); auto _Tmp = _Reverse_until_sentinel_unchecked(_UFirst, _UMid, _ULast); ::std:: reverse(_Tmp.first, _Tmp.second); _Seek_wrapped(_First, _UMid != _Tmp.first ? _Tmp.first : _Tmp.second); } else { auto _UNext = _UMid; do { ::std:: iter_swap(_UFirst, _UNext); ++_UFirst; ++_UNext; if (_UFirst == _UMid) { _UMid = _UNext; } } while (_UNext != _ULast); _Seek_wrapped(_First, _UFirst); while (_UMid != _ULast) { _UNext = _UMid; do { ::std:: iter_swap(_UFirst, _UNext); ++_UFirst; ++_UNext; if (_UFirst == _UMid) { _UMid = _UNext; } } while (_UNext != _ULast); } } return _First; } template <class _ExPo, class _FwdIt, _Enable_if_execution_policy_t<_ExPo> = 0> _FwdIt rotate(_ExPo&&, _FwdIt _First, _FwdIt _Mid, _FwdIt _Last) noexcept { return ::std:: rotate(_First, _Mid, _Last); } template <class _InIt, class _Pr> [[nodiscard]] constexpr _InIt find_if(_InIt _First, const _InIt _Last, _Pr _Pred) { _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); for (; _UFirst != _ULast; ++_UFirst) { if (_Pred(*_UFirst)) { break; } } _Seek_wrapped(_First, _UFirst); return _First; } namespace ranges { template <input_iterator _It, sentinel_for<_It> _Se, class _Pj, indirect_unary_predicate<projected<_It, _Pj>> _Pr> [[nodiscard]] constexpr _It _Find_if_unchecked(_It _First, const _Se _Last, _Pr _Pred, _Pj _Proj) { for (; _First != _Last; ++_First) { if (::std:: invoke(_Pred, ::std:: invoke(_Proj, *_First))) { break; } } return _First; } class _Find_if_fn : private _Not_quite_object { public: using _Not_quite_object::_Not_quite_object; template <input_iterator _It, sentinel_for<_It> _Se, class _Pj = identity, indirect_unary_predicate<projected<_It, _Pj>> _Pr> [[nodiscard]] constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) const { _Adl_verify_range(_First, _Last); auto _UResult = ::std::ranges:: _Find_if_unchecked( _Get_unwrapped(::std:: move(_First)), _Get_unwrapped(::std:: move(_Last)), _Pass_fn(_Pred), _Pass_fn(_Proj)); _Seek_wrapped(_First, ::std:: move(_UResult)); return _First; } template <input_range _Rng, class _Pj = identity, indirect_unary_predicate<projected<iterator_t<_Rng>, _Pj>> _Pr> [[nodiscard]] constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) const { auto _First = ::std::ranges:: begin(_Range); auto _UResult = ::std::ranges:: _Find_if_unchecked( _Get_unwrapped(::std:: move(_First)), _Uend(_Range), _Pass_fn(_Pred), _Pass_fn(_Proj)); _Seek_wrapped(_First, ::std:: move(_UResult)); return _First; } }; inline constexpr _Find_if_fn find_if{_Not_quite_object::_Construct_tag{}}; class _Find_if_not_fn : private _Not_quite_object { public: using _Not_quite_object::_Not_quite_object; template <input_iterator _It, sentinel_for<_It> _Se, class _Pj = identity, indirect_unary_predicate<projected<_It, _Pj>> _Pr> [[nodiscard]] constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) const { _Adl_verify_range(_First, _Last); auto _UResult = _Find_if_not_unchecked( _Get_unwrapped(::std:: move(_First)), _Get_unwrapped(::std:: move(_Last)), _Pass_fn(_Pred), _Pass_fn(_Proj)); _Seek_wrapped(_First, ::std:: move(_UResult)); return _First; } template <input_range _Rng, class _Pj = identity, indirect_unary_predicate<projected<iterator_t<_Rng>, _Pj>> _Pr> [[nodiscard]] constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) const { auto _First = ::std::ranges:: begin(_Range); auto _UResult = _Find_if_not_unchecked( _Get_unwrapped(::std:: move(_First)), _Uend(_Range), _Pass_fn(_Pred), _Pass_fn(_Proj)); _Seek_wrapped(_First, ::std:: move(_UResult)); return _First; } private: template <class _It, class _Se, class _Pj, class _Pr> [[nodiscard]] static constexpr _It _Find_if_not_unchecked(_It _First, const _Se _Last, _Pr _Pred, _Pj _Proj) { ; ; ; for (; _First != _Last; ++_First) { if (!::std:: invoke(_Pred, ::std:: invoke(_Proj, *_First))) { break; } } return _First; } }; inline constexpr _Find_if_not_fn find_if_not{_Not_quite_object::_Construct_tag{}}; } template <auto> struct _Require_constant; template <class _FwdIt, class _Ty, class _Pr> [[nodiscard]] constexpr _FwdIt lower_bound(_FwdIt _First, const _FwdIt _Last, const _Ty& _Val, _Pr _Pred) { _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_First); _Iter_diff_t<_FwdIt> _Count = ::std:: distance(_UFirst, _Get_unwrapped(_Last)); while (0 < _Count) { const _Iter_diff_t<_FwdIt> _Count2 = _Count / 2; const auto _UMid = ::std:: next(_UFirst, _Count2); if (_Pred(*_UMid, _Val)) { _UFirst = _Next_iter(_UMid); _Count -= _Count2 + 1; } else { _Count = _Count2; } } _Seek_wrapped(_First, _UFirst); return _First; } template <class _FwdIt, class _Ty> [[nodiscard]] constexpr _FwdIt lower_bound(_FwdIt _First, _FwdIt _Last, const _Ty& _Val) { return ::std:: lower_bound(_First, _Last, _Val, less<>{}); } template <class _FwdIt1, class _FwdIt2> constexpr _FwdIt2 _Swap_ranges_unchecked(_FwdIt1 _First1, const _FwdIt1 _Last1, _FwdIt2 _First2) { for (; _First1 != _Last1; ++_First1, (void) ++_First2) { ::std:: iter_swap(_First1, _First2); } return _First2; } template <class _Ty, enable_if_t<_Is_trivially_swappable_v<_Ty>, int> = 0> constexpr _Ty* _Swap_ranges_unchecked(_Ty* _First1, _Ty* const _Last1, _Ty* _First2) { if (::std:: is_constant_evaluated()) { for (; _First1 != _Last1; ++_First1, (void) ++_First2) { ::std:: iter_swap(_First1, _First2); } return _First2; } __std_swap_ranges_trivially_swappable_noalias(_First1, _Last1, _First2); return _First2 + (_Last1 - _First1); } template <class _Diff, class _Urng> class _Rng_from_urng { public: using _Ty0 = make_unsigned_t<_Diff>; using _Ty1 = typename _Urng::result_type; using _Udiff = conditional_t<sizeof(_Ty1) < sizeof(_Ty0), _Ty0, _Ty1>; explicit _Rng_from_urng(_Urng& _Func) : _Ref(_Func), _Bits(8 * sizeof(_Udiff)), _Bmask(_Udiff(-1)) { for (; (_Urng::max)() - (_Urng::min)() < _Bmask; _Bmask >>= 1) { --_Bits; } } _Diff operator()(_Diff _Index) { for (;;) { _Udiff _Ret = 0; _Udiff _Mask = 0; while (_Mask < _Udiff(_Index - 1)) { _Ret <<= _Bits - 1; _Ret <<= 1; _Ret |= _Get_bits(); _Mask <<= _Bits - 1; _Mask <<= 1; _Mask |= _Bmask; } if (_Ret / _Index < _Mask / _Index || _Mask % _Index == _Udiff(_Index - 1)) { return static_cast<_Diff>(_Ret % _Index); } } } _Udiff _Get_all_bits() { _Udiff _Ret = 0; for (size_t _Num = 0; _Num < 8 * sizeof(_Udiff); _Num += _Bits) { _Ret <<= _Bits - 1; _Ret <<= 1; _Ret |= _Get_bits(); } return _Ret; } _Rng_from_urng(const _Rng_from_urng&) = delete; _Rng_from_urng& operator=(const _Rng_from_urng&) = delete; private: _Udiff _Get_bits() { for (;;) { _Udiff _Val = _Ref() - (_Urng::min)(); if (_Val <= _Bmask) { return _Val; } } } _Urng& _Ref; size_t _Bits; _Udiff _Bmask; }; template <class _Ty, class _Alloc, class = void> struct _Has_allocator_type : false_type {}; template <class _Ty, class _Alloc> struct _Has_allocator_type<_Ty, _Alloc, void_t<typename _Ty::allocator_type>> : is_convertible<_Alloc, typename _Ty::allocator_type>::type {}; struct allocator_arg_t { explicit allocator_arg_t() = default; }; inline constexpr allocator_arg_t allocator_arg{}; [[noreturn]] void __cdecl _Xbad_alloc(); [[noreturn]] void __cdecl _Xinvalid_argument( const char*); [[noreturn]] void __cdecl _Xlength_error( const char*); [[noreturn]] void __cdecl _Xout_of_range( const char*); [[noreturn]] void __cdecl _Xoverflow_error( const char*); [[noreturn]] void __cdecl _Xruntime_error( const char*); [[noreturn]] void __cdecl _XGetLastError(); template <class _Ty, class _Alloc> struct uses_allocator : _Has_allocator_type<_Ty, _Alloc>::type { }; template <class _Ty, class _Alloc> inline constexpr bool uses_allocator_v = uses_allocator<_Ty, _Alloc>::value; template <class _Category, class _Ty, class _Diff = ptrdiff_t, class _Pointer = _Ty*, class _Reference = _Ty&> struct [[deprecated( "warning STL4015: " "The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17. " "(The <iterator> header is NOT deprecated.) The C++ Standard has never required user-defined iterators to " "derive from std::iterator. To fix this warning, stop deriving from std::iterator and start providing " "publicly accessible typedefs named iterator_category, value_type, difference_type, pointer, and reference. " "Note that value_type is required to be non-const, even for constant iterators. " "You can define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] iterator { using iterator_category = _Category; using value_type = _Ty; using difference_type = _Diff; using pointer = _Pointer; using reference = _Reference; }; template <class _Ty, enable_if_t<is_floating_point_v<_Ty>, int> = 0> [[nodiscard]] constexpr auto _Float_abs_bits(const _Ty& _Xx) { using _Traits = _Floating_type_traits<_Ty>; using _Uint_type = typename _Traits::_Uint_type; const auto _Bits = _Bit_cast<_Uint_type>(_Xx); return _Bits & ~_Traits::_Shifted_sign_mask; } template <class _Ty, enable_if_t<is_floating_point_v<_Ty>, int> = 0> [[nodiscard]] constexpr _Ty _Float_abs(const _Ty _Xx) { return _Bit_cast<_Ty>(_Float_abs_bits(_Xx)); } template <class _Ty, enable_if_t<is_floating_point_v<_Ty>, int> = 0> [[nodiscard]] constexpr _Ty _Float_copysign(const _Ty _Magnitude, const _Ty _Sign) { using _Traits = _Floating_type_traits<_Ty>; using _Uint_type = typename _Traits::_Uint_type; const auto _Signbit = _Bit_cast<_Uint_type>(_Sign) & _Traits::_Shifted_sign_mask; return _Bit_cast<_Ty>(_Float_abs_bits(_Magnitude) | _Signbit); } template <class _Ty, enable_if_t<is_floating_point_v<_Ty>, int> = 0> [[nodiscard]] constexpr bool _Is_nan(const _Ty _Xx) { using _Traits = _Floating_type_traits<_Ty>; return _Float_abs_bits(_Xx) > _Traits::_Shifted_exponent_mask; } template <class _Ty, enable_if_t<is_floating_point_v<_Ty>, int> = 0> [[nodiscard]] constexpr bool _Is_signaling_nan(const _Ty& _Xx) { using _Traits = _Floating_type_traits<_Ty>; const auto _Abs_bits = _Float_abs_bits(_Xx); return _Abs_bits > _Traits::_Shifted_exponent_mask && ((_Abs_bits & _Traits::_Special_nan_mantissa_mask) == 0); } template <class _Ty, enable_if_t<is_floating_point_v<_Ty>, int> = 0> [[nodiscard]] constexpr bool _Is_inf(const _Ty _Xx) { using _Traits = _Floating_type_traits<_Ty>; return _Float_abs_bits(_Xx) == _Traits::_Shifted_exponent_mask; } template <class _Ty, enable_if_t<is_floating_point_v<_Ty>, int> = 0> [[nodiscard]] constexpr bool _Is_finite(const _Ty _Xx) { using _Traits = _Floating_type_traits<_Ty>; return _Float_abs_bits(_Xx) < _Traits::_Shifted_exponent_mask; } struct _Nontrivial_dummy_type { constexpr _Nontrivial_dummy_type() noexcept { } }; ; struct monostate {}; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { template <bool _Same, class _Dest, class... _Srcs> inline constexpr bool _Tuple_conditional_explicit_v0 = false; template <class... _Dests, class... _Srcs> inline constexpr bool _Tuple_conditional_explicit_v0<true, tuple<_Dests...>, _Srcs...> = !conjunction_v<is_convertible<_Srcs, _Dests>...>; template <class _Dest, class... _Srcs> inline constexpr bool _Tuple_conditional_explicit_v = _Tuple_conditional_explicit_v0<tuple_size_v<_Dest> == sizeof...(_Srcs), _Dest, _Srcs...>; template <bool _Same, class _Dest, class... _Srcs> inline constexpr bool _Tuple_constructible_v0 = false; template <class... _Dests, class... _Srcs> inline constexpr bool _Tuple_constructible_v0<true, tuple<_Dests...>, _Srcs...> = conjunction_v<is_constructible<_Dests, _Srcs>...>; template <class _Dest, class... _Srcs> inline constexpr bool _Tuple_constructible_v = _Tuple_constructible_v0<tuple_size_v<_Dest> == sizeof...(_Srcs), _Dest, _Srcs...>; template <class _Dest, class... _Srcs> struct _Tuple_constructible_val : bool_constant<_Tuple_constructible_v<_Dest, _Srcs...>> {}; template <bool _Same, class _Dest, class... _Srcs> inline constexpr bool _Tuple_nothrow_constructible_v0 = false; template <class... _Dests, class... _Srcs> inline constexpr bool _Tuple_nothrow_constructible_v0<true, tuple<_Dests...>, _Srcs...> = conjunction_v<is_nothrow_constructible<_Dests, _Srcs>...>; template <class _Dest, class... _Srcs> inline constexpr bool _Tuple_nothrow_constructible_v = _Tuple_nothrow_constructible_v0<tuple_size_v<_Dest> == sizeof...(_Srcs), _Dest, _Srcs...>; template <bool _Same, class _Dest, class... _Srcs> inline constexpr bool _Tuple_assignable_v0 = false; template <class... _Dests, class... _Srcs> inline constexpr bool _Tuple_assignable_v0<true, tuple<_Dests...>, _Srcs...> = conjunction_v<is_assignable<_Dests&, _Srcs>...>; template <class _Dest, class... _Srcs> inline constexpr bool _Tuple_assignable_v = _Tuple_assignable_v0<tuple_size_v<_Dest> == sizeof...(_Srcs), _Dest, _Srcs...>; template <class _Dest, class... _Srcs> struct _Tuple_assignable_val : bool_constant<_Tuple_assignable_v<_Dest, _Srcs...>> {}; template <bool _Same, class _Dest, class... _Srcs> inline constexpr bool _Tuple_nothrow_assignable_v0 = false; template <class... _Dests, class... _Srcs> inline constexpr bool _Tuple_nothrow_assignable_v0<true, tuple<_Dests...>, _Srcs...> = conjunction_v<is_nothrow_assignable<_Dests&, _Srcs>...>; template <class _Dest, class... _Srcs> inline constexpr bool _Tuple_nothrow_assignable_v = _Tuple_nothrow_assignable_v0<tuple_size_v<_Dest> == sizeof...(_Srcs), _Dest, _Srcs...>; template <class _Myself, class... _Other> struct _Tuple_convert_copy_val : true_type {}; template <class _This, class _Uty> struct _Tuple_convert_copy_val<tuple<_This>, _Uty> : bool_constant<!disjunction_v<is_same<_This, _Uty>, is_constructible<_This, const tuple<_Uty>&>, is_convertible<const tuple<_Uty>&, _This>>> {}; template <class _Myself, class... _Other> struct _Tuple_convert_move_val : true_type {}; template <class _This, class _Uty> struct _Tuple_convert_move_val<tuple<_This>, _Uty> : bool_constant<!disjunction_v<is_same<_This, _Uty>, is_constructible<_This, tuple<_Uty>>, is_convertible<tuple<_Uty>, _This>>> {}; template <class _Myself, class _This2, class... _Rest2> struct _Tuple_perfect_val : true_type {}; template <class _Myself, class _This2> struct _Tuple_perfect_val<_Myself, _This2> : bool_constant<!is_same_v<_Myself, remove_const_t<remove_reference_t<_This2>>>> {}; struct _Ignore { template <class _Ty> constexpr const _Ignore& operator=(const _Ty&) const noexcept { return *this; } }; inline constexpr _Ignore ignore{}; template <class _Ty> struct _Tuple_val { constexpr _Tuple_val() : _Val() {} template <class _Other> constexpr _Tuple_val(_Other&& _Arg) : _Val(::std:: forward<_Other>(_Arg)) {} template <class _Alloc, class... _Other, enable_if_t<!uses_allocator_v<_Ty, _Alloc>, int> = 0> constexpr _Tuple_val(const _Alloc&, allocator_arg_t, _Other&&... _Arg) : _Val(::std:: forward<_Other>(_Arg)...) {} template <class _Alloc, class... _Other, enable_if_t<conjunction_v<::std:: uses_allocator<_Ty, _Alloc>, ::std:: is_constructible<_Ty, ::std:: allocator_arg_t, const _Alloc&, _Other...>>, int> = 0> constexpr _Tuple_val(const _Alloc& _Al, allocator_arg_t, _Other&&... _Arg) : _Val(allocator_arg, _Al, ::std:: forward<_Other>(_Arg)...) {} template <class _Alloc, class... _Other, enable_if_t<conjunction_v<::std:: uses_allocator<_Ty, _Alloc>, ::std:: negation<::std:: is_constructible<_Ty, ::std:: allocator_arg_t, const _Alloc&, _Other...>>>, int> = 0> constexpr _Tuple_val(const _Alloc& _Al, allocator_arg_t, _Other&&... _Arg) : _Val(::std:: forward<_Other>(_Arg)..., _Al) {} _Ty _Val; }; struct _Exact_args_t { explicit _Exact_args_t() = default; }; struct _Unpack_tuple_t { explicit _Unpack_tuple_t() = default; }; struct _Alloc_exact_args_t { explicit _Alloc_exact_args_t() = default; }; struct _Alloc_unpack_tuple_t { explicit _Alloc_unpack_tuple_t() = default; }; template <class... _Types> class tuple; template <> class tuple<> { public: constexpr tuple() noexcept = default; constexpr tuple(const tuple&) noexcept {} template <class _Alloc> constexpr tuple(allocator_arg_t, const _Alloc&) noexcept {} template <class _Alloc> constexpr tuple(allocator_arg_t, const _Alloc&, const tuple&) noexcept {} template <class _Tag, enable_if_t<is_same_v<_Tag, ::std:: _Exact_args_t>, int> = 0> constexpr tuple(_Tag) noexcept {} template <class _Tag, class _Alloc, enable_if_t<is_same_v<_Tag, ::std:: _Alloc_exact_args_t>, int> = 0> constexpr tuple(_Tag, const _Alloc&) noexcept {} constexpr tuple& operator=(const tuple&) = default; constexpr void swap(tuple&) noexcept {} constexpr bool _Equals(const tuple&) const noexcept { return true; } [[nodiscard]] constexpr strong_ordering _Three_way_compare(const tuple&) const noexcept { return strong_ordering::equal; } }; template <class _This, class... _Rest> class tuple<_This, _Rest...> : private tuple<_Rest...> { public: using _This_type = _This; using _Mybase = tuple<_Rest...>; template <class _Tag, class _This2, class... _Rest2, enable_if_t<is_same_v<_Tag, ::std:: _Exact_args_t>, int> = 0> constexpr tuple(_Tag, _This2&& _This_arg, _Rest2&&... _Rest_arg) : _Mybase(_Exact_args_t{}, ::std:: forward<_Rest2>(_Rest_arg)...), _Myfirst(::std:: forward<_This2>(_This_arg)) {} template <class _Tag, class _Tpl, size_t... _Indices, enable_if_t<is_same_v<_Tag, ::std:: _Unpack_tuple_t>, int> = 0> constexpr tuple(_Tag, _Tpl&& _Right, index_sequence<_Indices...>); template <class _Tag, class _Tpl, enable_if_t<is_same_v<_Tag, ::std:: _Unpack_tuple_t>, int> = 0> constexpr tuple(_Tag, _Tpl&& _Right) : tuple(_Unpack_tuple_t{}, ::std:: forward<_Tpl>(_Right), make_index_sequence<tuple_size_v<remove_reference_t<_Tpl>>>{}) {} template <class _Tag, class _Alloc, class _This2, class... _Rest2, enable_if_t<is_same_v<_Tag, ::std:: _Alloc_exact_args_t>, int> = 0> constexpr tuple(_Tag, const _Alloc& _Al, _This2&& _This_arg, _Rest2&&... _Rest_arg) : _Mybase(_Alloc_exact_args_t{}, _Al, ::std:: forward<_Rest2>(_Rest_arg)...), _Myfirst(_Al, allocator_arg, ::std:: forward<_This2>(_This_arg)) {} template <class _Tag, class _Alloc, class _Tpl, size_t... _Indices, enable_if_t<is_same_v<_Tag, ::std:: _Alloc_unpack_tuple_t>, int> = 0> constexpr tuple(_Tag, const _Alloc& _Al, _Tpl&& _Right, index_sequence<_Indices...>); template <class _Tag, class _Alloc, class _Tpl, enable_if_t<is_same_v<_Tag, ::std:: _Alloc_unpack_tuple_t>, int> = 0> constexpr tuple(_Tag, const _Alloc& _Al, _Tpl&& _Right) : tuple(_Alloc_unpack_tuple_t{}, _Al, ::std:: forward<_Tpl>(_Right), make_index_sequence<tuple_size_v<remove_reference_t<_Tpl>>>{}) {} template <class _This2 = _This, enable_if_t<conjunction_v<::std:: is_default_constructible<_This2>, ::std:: is_default_constructible<_Rest>...>, int> = 0> constexpr explicit( !conjunction_v<_Is_implicitly_default_constructible<_This2>, _Is_implicitly_default_constructible<_Rest>...>) tuple() noexcept(conjunction_v<is_nothrow_default_constructible<_This2>, is_nothrow_default_constructible<_Rest>...>) : _Mybase(), _Myfirst() {} template <class _This2 = _This, enable_if_t<_Tuple_constructible_v<tuple, const _This2&, const _Rest&...>, int> = 0> constexpr explicit(_Tuple_conditional_explicit_v<tuple, const _This2&, const _Rest&...>) tuple( const _This& _This_arg, const _Rest&... _Rest_arg) noexcept(conjunction_v<is_nothrow_copy_constructible<_This2>, is_nothrow_copy_constructible<_Rest>...>) : tuple(_Exact_args_t{}, _This_arg, _Rest_arg...) {} template <class _This2, class... _Rest2, enable_if_t<conjunction_v<::std:: _Tuple_perfect_val<tuple, _This2, _Rest2...>, ::std:: _Tuple_constructible_val<tuple, _This2, _Rest2...>>, int> = 0> constexpr explicit(_Tuple_conditional_explicit_v<tuple, _This2, _Rest2...>) tuple(_This2&& _This_arg, _Rest2&&... _Rest_arg) noexcept(_Tuple_nothrow_constructible_v<tuple, _This2, _Rest2...>) : tuple(_Exact_args_t{}, ::std:: forward<_This2>(_This_arg), ::std:: forward<_Rest2>(_Rest_arg)...) {} tuple(const tuple&) = default; tuple(tuple&&) = default; template <class... _Other, enable_if_t<conjunction_v<::std:: _Tuple_constructible_val<tuple, const _Other&...>, ::std:: _Tuple_convert_copy_val<tuple, _Other...>>, int> = 0> constexpr explicit(_Tuple_conditional_explicit_v<tuple, const _Other&...>) tuple(const tuple<_Other...>& _Right) noexcept( _Tuple_nothrow_constructible_v<tuple, const _Other&...>) : tuple(_Unpack_tuple_t{}, _Right) {} template <class... _Other, enable_if_t<conjunction_v<::std:: _Tuple_constructible_val<tuple, _Other...>, ::std:: _Tuple_convert_move_val<tuple, _Other...>>, int> = 0> constexpr explicit(_Tuple_conditional_explicit_v<tuple, _Other...>) tuple(tuple<_Other...>&& _Right) noexcept(_Tuple_nothrow_constructible_v<tuple, _Other...>) : tuple(_Unpack_tuple_t{}, ::std:: move(_Right)) {} template <class _First, class _Second, enable_if_t<_Tuple_constructible_v<tuple, const _First&, const _Second&>, int> = 0> constexpr explicit(_Tuple_conditional_explicit_v<tuple, const _First&, const _Second&>) tuple(const pair<_First, _Second>& _Right) noexcept( _Tuple_nothrow_constructible_v<tuple, const _First&, const _Second&>) : tuple(_Unpack_tuple_t{}, _Right) {} template <class _First, class _Second, enable_if_t<_Tuple_constructible_v<tuple, _First, _Second>, int> = 0> constexpr explicit(_Tuple_conditional_explicit_v<tuple, _First, _Second>) tuple( pair<_First, _Second>&& _Right) noexcept(_Tuple_nothrow_constructible_v<tuple, _First, _Second>) : tuple(_Unpack_tuple_t{}, ::std:: move(_Right)) {} template <class _Alloc, class _This2 = _This, enable_if_t<conjunction_v<::std:: is_default_constructible<_This2>, ::std:: is_default_constructible<_Rest>...>, int> = 0> constexpr explicit( !conjunction_v<_Is_implicitly_default_constructible<_This2>, _Is_implicitly_default_constructible<_Rest>...>) tuple(allocator_arg_t, const _Alloc& _Al) : _Mybase(allocator_arg, _Al), _Myfirst(_Al, allocator_arg) {} template <class _Alloc, class _This2 = _This, enable_if_t<_Tuple_constructible_v<tuple, const _This2&, const _Rest&...>, int> = 0> constexpr explicit(_Tuple_conditional_explicit_v<tuple, const _This2&, const _Rest&...>) tuple(allocator_arg_t, const _Alloc& _Al, const _This& _This_arg, const _Rest&... _Rest_arg) : tuple(_Alloc_exact_args_t{}, _Al, _This_arg, _Rest_arg...) {} template <class _Alloc, class _This2, class... _Rest2, enable_if_t<conjunction_v<::std:: _Tuple_perfect_val<tuple, _This2, _Rest2...>, ::std:: _Tuple_constructible_val<tuple, _This2, _Rest2...>>, int> = 0> constexpr explicit(_Tuple_conditional_explicit_v<tuple, _This2, _Rest2...>) tuple(allocator_arg_t, const _Alloc& _Al, _This2&& _This_arg, _Rest2&&... _Rest_arg) : tuple(_Alloc_exact_args_t{}, _Al, ::std:: forward<_This2>(_This_arg), ::std:: forward<_Rest2>(_Rest_arg)...) {} template <class _Alloc, class _This2 = _This, enable_if_t<_Tuple_constructible_v<tuple, const _This2&, const _Rest&...>, int> = 0> constexpr tuple(allocator_arg_t, const _Alloc& _Al, const tuple& _Right) : tuple(_Alloc_unpack_tuple_t{}, _Al, _Right) {} template <class _Alloc, class _This2 = _This, enable_if_t<_Tuple_constructible_v<tuple, _This2, _Rest...>, int> = 0> constexpr tuple(allocator_arg_t, const _Alloc& _Al, tuple&& _Right) : tuple(_Alloc_unpack_tuple_t{}, _Al, ::std:: move(_Right)) {} template <class _Alloc, class... _Other, enable_if_t<conjunction_v<::std:: _Tuple_constructible_val<tuple, const _Other&...>, ::std:: _Tuple_convert_copy_val<tuple, _Other...>>, int> = 0> constexpr explicit(_Tuple_conditional_explicit_v<tuple, const _Other&...>) tuple(allocator_arg_t, const _Alloc& _Al, const tuple<_Other...>& _Right) : tuple(_Alloc_unpack_tuple_t{}, _Al, _Right) {} template <class _Alloc, class... _Other, enable_if_t<conjunction_v<::std:: _Tuple_constructible_val<tuple, _Other...>, ::std:: _Tuple_convert_move_val<tuple, _Other...>>, int> = 0> constexpr explicit(_Tuple_conditional_explicit_v<tuple, _Other...>) tuple(allocator_arg_t, const _Alloc& _Al, tuple<_Other...>&& _Right) : tuple(_Alloc_unpack_tuple_t{}, _Al, ::std:: move(_Right)) {} template <class _Alloc, class _First, class _Second, enable_if_t<_Tuple_constructible_v<tuple, const _First&, const _Second&>, int> = 0> constexpr explicit(_Tuple_conditional_explicit_v<tuple, const _First&, const _Second&>) tuple(allocator_arg_t, const _Alloc& _Al, const pair<_First, _Second>& _Right) : tuple(_Alloc_unpack_tuple_t{}, _Al, _Right) {} template <class _Alloc, class _First, class _Second, enable_if_t<_Tuple_constructible_v<tuple, _First, _Second>, int> = 0> constexpr explicit(_Tuple_conditional_explicit_v<tuple, _First, _Second>) tuple(allocator_arg_t, const _Alloc& _Al, pair<_First, _Second>&& _Right) : tuple(_Alloc_unpack_tuple_t{}, _Al, ::std:: move(_Right)) {} tuple& operator=(const volatile tuple&) = delete; template <class _Myself = tuple, class _This2 = _This, enable_if_t<conjunction_v<::std:: _Is_copy_assignable_no_precondition_check<_This2>, ::std:: _Is_copy_assignable_no_precondition_check<_Rest>...>, int> = 0> constexpr tuple& operator=(_Identity_t<const _Myself&> _Right) noexcept( conjunction_v<is_nothrow_copy_assignable<_This2>, is_nothrow_copy_assignable<_Rest>...>) { _Myfirst._Val = _Right._Myfirst._Val; _Get_rest() = _Right._Get_rest(); return *this; } template <class _Myself = tuple, class _This2 = _This, enable_if_t<conjunction_v<::std:: _Is_move_assignable_no_precondition_check<_This2>, ::std:: _Is_move_assignable_no_precondition_check<_Rest>...>, int> = 0> constexpr tuple& operator=(_Identity_t<_Myself&&> _Right) noexcept( conjunction_v<is_nothrow_move_assignable<_This2>, is_nothrow_move_assignable<_Rest>...>) { _Myfirst._Val = ::std:: forward<_This>(_Right._Myfirst._Val); _Get_rest() = ::std:: forward<_Mybase>(_Right._Get_rest()); return *this; } template <class... _Other, enable_if_t<conjunction_v<::std:: negation<::std:: is_same<tuple, ::std:: tuple<_Other...>>>, ::std:: _Tuple_assignable_val<tuple, const _Other&...>>, int> = 0> constexpr tuple& operator=(const tuple<_Other...>& _Right) noexcept( _Tuple_nothrow_assignable_v<tuple, const _Other&...>) { _Myfirst._Val = _Right._Myfirst._Val; _Get_rest() = _Right._Get_rest(); return *this; } template <class... _Other, enable_if_t<conjunction_v<::std:: negation<::std:: is_same<tuple, ::std:: tuple<_Other...>>>, ::std:: _Tuple_assignable_val<tuple, _Other...>>, int> = 0> constexpr tuple& operator=(tuple<_Other...>&& _Right) noexcept( _Tuple_nothrow_assignable_v<tuple, _Other...>) { _Myfirst._Val = ::std:: forward<typename tuple<_Other...>::_This_type>(_Right._Myfirst._Val); _Get_rest() = ::std:: forward<typename tuple<_Other...>::_Mybase>(_Right._Get_rest()); return *this; } template <class _First, class _Second, enable_if_t<_Tuple_assignable_v<tuple, const _First&, const _Second&>, int> = 0> constexpr tuple& operator=(const pair<_First, _Second>& _Right) noexcept( _Tuple_nothrow_assignable_v<tuple, const _First&, const _Second&>) { _Myfirst._Val = _Right.first; _Get_rest()._Myfirst._Val = _Right.second; return *this; } template <class _First, class _Second, enable_if_t<_Tuple_assignable_v<tuple, _First, _Second>, int> = 0> constexpr tuple& operator=(pair<_First, _Second>&& _Right) noexcept( _Tuple_nothrow_assignable_v<tuple, _First, _Second>) { _Myfirst._Val = ::std:: forward<_First>(_Right.first); _Get_rest()._Myfirst._Val = ::std:: forward<_Second>(_Right.second); return *this; } constexpr void swap(tuple& _Right) noexcept( conjunction_v<_Is_nothrow_swappable<_This>, _Is_nothrow_swappable<_Rest>...>) { _Swap_adl(_Myfirst._Val, _Right._Myfirst._Val); _Mybase::swap(_Right._Get_rest()); } constexpr _Mybase& _Get_rest() noexcept { return *this; } constexpr const _Mybase& _Get_rest() const noexcept { return *this; } template <class... _Other> constexpr bool _Equals(const tuple<_Other...>& _Right) const { return _Myfirst._Val == _Right._Myfirst._Val && _Mybase::_Equals(_Right._Get_rest()); } template <class _First, class... _Other, class _Ret = common_comparison_category_t<_Synth_three_way_result<_This, _First>, _Synth_three_way_result<_Rest, _Other>...>> [[nodiscard]] constexpr _Ret _Three_way_compare(const tuple<_First, _Other...>& _Right) const { if (auto _Result = _Synth_three_way{}(_Myfirst._Val, _Right._Myfirst._Val); _Result != 0) { return _Result; } return _Mybase::_Three_way_compare(_Right._Get_rest()); } template <size_t _Index, class... _Types> friend constexpr tuple_element_t<_Index, tuple<_Types...>>& get(tuple<_Types...>& _Tuple) noexcept; template <size_t _Index, class... _Types> friend constexpr const tuple_element_t<_Index, tuple<_Types...>>& get(const tuple<_Types...>& _Tuple) noexcept; template <size_t _Index, class... _Types> friend constexpr tuple_element_t<_Index, tuple<_Types...>>&& get(tuple<_Types...>&& _Tuple) noexcept; template <size_t _Index, class... _Types> friend constexpr const tuple_element_t<_Index, tuple<_Types...>>&& get(const tuple<_Types...>&& _Tuple) noexcept; template <size_t _Index, class... _Types> friend constexpr auto&& _Tuple_get(tuple<_Types...>&& _Tuple) noexcept; template <class _Ty, class... _Types> friend constexpr _Ty& get(tuple<_Types...>& _Tuple) noexcept; template <class _Ty, class... _Types> friend constexpr const _Ty& get(const tuple<_Types...>& _Tuple) noexcept; template <class _Ty, class... _Types> friend constexpr _Ty&& get(tuple<_Types...>&& _Tuple) noexcept; template <class _Ty, class... _Types> friend constexpr const _Ty&& get(const tuple<_Types...>&& _Tuple) noexcept; _Tuple_val<_This> _Myfirst; }; template <class... _Types> tuple(_Types...) -> tuple<_Types...>; template <class _Ty1, class _Ty2> tuple(pair<_Ty1, _Ty2>) -> tuple<_Ty1, _Ty2>; template <class _Alloc, class... _Types> tuple(allocator_arg_t, _Alloc, _Types...) -> tuple<_Types...>; template <class _Alloc, class _Ty1, class _Ty2> tuple(allocator_arg_t, _Alloc, pair<_Ty1, _Ty2>) -> tuple<_Ty1, _Ty2>; template <class _Alloc, class... _Types> tuple(allocator_arg_t, _Alloc, tuple<_Types...>) -> tuple<_Types...>; template <class... _Types1, class... _Types2> [[nodiscard]] constexpr bool operator==(const tuple<_Types1...>& _Left, const tuple<_Types2...>& _Right) { static_assert(sizeof...(_Types1) == sizeof...(_Types2), "cannot compare tuples of different sizes"); return _Left._Equals(_Right); } template <class... _Types1, class... _Types2> [[nodiscard]] constexpr common_comparison_category_t<_Synth_three_way_result<_Types1, _Types2>...> operator<=>( const tuple<_Types1...>& _Left, const tuple<_Types2...>& _Right) { static_assert(sizeof...(_Types1) == sizeof...(_Types2), "cannot compare tuples of different sizes"); return _Left._Three_way_compare(_Right); } template <class... _Types, enable_if_t<conjunction_v<::std:: _Is_swappable<_Types>...>, int> = 0> constexpr void swap(tuple<_Types...>& _Left, tuple<_Types...>& _Right) noexcept(noexcept(_Left.swap(_Right))) { return _Left.swap(_Right); } template <class _Ty, class _Tuple> struct _Tuple_element {}; template <class _This, class... _Rest> struct _Tuple_element<_This, tuple<_This, _Rest...>> { static_assert(!_Is_any_of_v<_This, _Rest...>, "duplicate type T in get<T>(tuple)"); using _Ttype = tuple<_This, _Rest...>; }; template <class _Ty, class _This, class... _Rest> struct _Tuple_element<_Ty, tuple<_This, _Rest...>> { using _Ttype = typename _Tuple_element<_Ty, tuple<_Rest...>>::_Ttype; }; template <size_t _Index, class... _Types> [[nodiscard]] constexpr tuple_element_t<_Index, tuple<_Types...>>& get(tuple<_Types...>& _Tuple) noexcept { using _Ttype = typename tuple_element<_Index, tuple<_Types...>>::_Ttype; return static_cast<_Ttype&>(_Tuple)._Myfirst._Val; } template <size_t _Index, class... _Types> [[nodiscard]] constexpr const tuple_element_t<_Index, tuple<_Types...>>& get(const tuple<_Types...>& _Tuple) noexcept { using _Ttype = typename tuple_element<_Index, tuple<_Types...>>::_Ttype; return static_cast<const _Ttype&>(_Tuple)._Myfirst._Val; } template <size_t _Index, class... _Types> [[nodiscard]] constexpr tuple_element_t<_Index, tuple<_Types...>>&& get(tuple<_Types...>&& _Tuple) noexcept { using _Ty = tuple_element_t<_Index, tuple<_Types...>>; using _Ttype = typename tuple_element<_Index, tuple<_Types...>>::_Ttype; return static_cast<_Ty&&>(static_cast<_Ttype&>(_Tuple)._Myfirst._Val); } template <size_t _Index, class... _Types> [[nodiscard]] constexpr const tuple_element_t<_Index, tuple<_Types...>>&& get(const tuple<_Types...>&& _Tuple) noexcept { using _Ty = tuple_element_t<_Index, tuple<_Types...>>; using _Ttype = typename tuple_element<_Index, tuple<_Types...>>::_Ttype; return static_cast<const _Ty&&>(static_cast<const _Ttype&>(_Tuple)._Myfirst._Val); } template <size_t _Index, class... _Types> [[nodiscard]] constexpr auto&& _Tuple_get(tuple<_Types...>&& _Tuple) noexcept { using _Ty = tuple_element_t<_Index, tuple<_Types...>>; using _Ttype = typename tuple_element<_Index, tuple<_Types...>>::_Ttype; return static_cast<_Ty&&>(static_cast<_Ttype&>(_Tuple)._Myfirst._Val); } template <class _Ty, class... _Types> [[nodiscard]] constexpr _Ty& get(tuple<_Types...>& _Tuple) noexcept { using _Ttype = typename _Tuple_element<_Ty, tuple<_Types...>>::_Ttype; return static_cast<_Ttype&>(_Tuple)._Myfirst._Val; } template <class _Ty, class... _Types> [[nodiscard]] constexpr const _Ty& get(const tuple<_Types...>& _Tuple) noexcept { using _Ttype = typename _Tuple_element<_Ty, tuple<_Types...>>::_Ttype; return static_cast<const _Ttype&>(_Tuple)._Myfirst._Val; } template <class _Ty, class... _Types> [[nodiscard]] constexpr _Ty&& get(tuple<_Types...>&& _Tuple) noexcept { using _Ttype = typename _Tuple_element<_Ty, tuple<_Types...>>::_Ttype; return static_cast<_Ty&&>(static_cast<_Ttype&>(_Tuple)._Myfirst._Val); } template <class _Ty, class... _Types> [[nodiscard]] constexpr const _Ty&& get(const tuple<_Types...>&& _Tuple) noexcept { using _Ttype = typename _Tuple_element<_Ty, tuple<_Types...>>::_Ttype; return static_cast<const _Ty&&>(static_cast<const _Ttype&>(_Tuple)._Myfirst._Val); } template <class _This, class... _Rest> template <class _Tag, class _Tpl, size_t... _Indices, enable_if_t<is_same_v<_Tag, ::std:: _Unpack_tuple_t>, int>> constexpr tuple<_This, _Rest...>::tuple(_Tag, _Tpl&& _Right, index_sequence<_Indices...>) : tuple(_Exact_args_t{}, ::std:: get<_Indices>(::std:: forward<_Tpl>(_Right))...) {} template <class _This, class... _Rest> template <class _Tag, class _Alloc, class _Tpl, size_t... _Indices, enable_if_t<is_same_v<_Tag, ::std:: _Alloc_unpack_tuple_t>, int>> constexpr tuple<_This, _Rest...>::tuple(_Tag, const _Alloc& _Al, _Tpl&& _Right, index_sequence<_Indices...>) : tuple(_Alloc_exact_args_t{}, _Al, ::std:: get<_Indices>(::std:: forward<_Tpl>(_Right))...) {} template <class... _Types> [[nodiscard]] constexpr tuple<_Unrefwrap_t<_Types>...> make_tuple(_Types&&... _Args) { using _Ttype = tuple<_Unrefwrap_t<_Types>...>; return _Ttype(::std:: forward<_Types>(_Args)...); } template <class... _Types> [[nodiscard]] constexpr tuple<_Types&...> tie(_Types&... _Args) noexcept { using _Ttype = tuple<_Types&...>; return _Ttype(_Args...); } template <class... _Types> [[nodiscard]] constexpr tuple<_Types&&...> forward_as_tuple(_Types&&... _Args) noexcept { return tuple<_Types&&...>(::std:: forward<_Types>(_Args)...); } template <class _Seq_type1, class _Seq_type2> struct _Cat_sequences; template <size_t... _Indexes1, size_t... _Indexes2> struct _Cat_sequences<index_sequence<_Indexes1...>, index_sequence<_Indexes2...>> { using type = index_sequence<_Indexes1..., _Indexes2...>; }; template <class _Ty, size_t _Size> class array; template <size_t _Idx, class _Ty, size_t _Size> [[nodiscard]] constexpr _Ty& get(array<_Ty, _Size>& _Arr) noexcept; template <size_t _Idx, class _Ty, size_t _Size> [[nodiscard]] constexpr const _Ty& get(const array<_Ty, _Size>& _Arr) noexcept; template <size_t _Idx, class _Ty, size_t _Size> [[nodiscard]] constexpr _Ty&& get(array<_Ty, _Size>&& _Arr) noexcept; template <size_t _Idx, class _Ty, size_t _Size> [[nodiscard]] constexpr const _Ty&& get(const array<_Ty, _Size>&& _Arr) noexcept; template <class _Ty, class... _For_array> struct _View_as_tuple { static_assert(_Always_false<_Ty>, "Unsupported tuple_cat arguments."); }; template <class... _Types> struct _View_as_tuple<tuple<_Types...>> { using type = tuple<_Types...>; }; template <class _Ty1, class _Ty2> struct _View_as_tuple<pair<_Ty1, _Ty2>> { using type = tuple<_Ty1, _Ty2>; }; template <class _Ty, class... _Types> struct _View_as_tuple<array<_Ty, 0>, _Types...> { using type = tuple<_Types...>; }; template <class _Ty, size_t _Size, class... _Types> struct _View_as_tuple<array<_Ty, _Size>, _Types...> : _View_as_tuple<array<_Ty, _Size - 1>, _Ty, _Types...> { }; template <size_t _Nx, class _Ty> struct _Repeat_for : integral_constant<size_t, _Nx> {}; template <class _Ret, class _Kx_arg, class _Ix_arg, size_t _Ix_next, class... _Tuples> struct _Tuple_cat2 { static_assert(sizeof...(_Tuples) == 0, "Unsupported tuple_cat arguments."); using type = _Ret; using _Kx_arg_seq = _Kx_arg; using _Ix_arg_seq = _Ix_arg; }; template <class... _Types1, class _Kx_arg, size_t... _Ix, size_t _Ix_next, class... _Types2, class... _Rest> struct _Tuple_cat2<tuple<_Types1...>, _Kx_arg, index_sequence<_Ix...>, _Ix_next, tuple<_Types2...>, _Rest...> : _Tuple_cat2<tuple<_Types1..., _Types2...>, typename _Cat_sequences<_Kx_arg, index_sequence_for<_Types2...>>::type, index_sequence<_Ix..., _Repeat_for<_Ix_next, _Types2>::value...>, _Ix_next + 1, _Rest...> { }; template <class... _Tuples> struct _Tuple_cat1 : _Tuple_cat2<tuple<>, index_sequence<>, index_sequence<>, 0, typename _View_as_tuple<decay_t<_Tuples>>::type...> { }; template <class _Ret, size_t... _Kx, size_t... _Ix, class _Ty> constexpr _Ret _Tuple_cat(index_sequence<_Kx...>, index_sequence<_Ix...>, _Ty&& _Arg) { return _Ret(::std:: get<_Kx>(::std:: get<_Ix>(::std:: forward<_Ty>(_Arg)))...); } template <class... _Tuples> [[nodiscard]] constexpr typename _Tuple_cat1<_Tuples...>::type tuple_cat(_Tuples&&... _Tpls) { using _Cat1 = _Tuple_cat1<_Tuples...>; return _Tuple_cat<typename _Cat1::type>(typename _Cat1::_Kx_arg_seq(), typename _Cat1::_Ix_arg_seq(), ::std:: forward_as_tuple(::std:: forward<_Tuples>(_Tpls)...)); } template <class _Callable, class _Tuple, size_t... _Indices> constexpr decltype(auto) _Apply_impl( _Callable&& _Obj, _Tuple&& _Tpl, index_sequence<_Indices...>) { return ::std:: invoke(::std:: forward<_Callable>(_Obj), ::std:: get<_Indices>(::std:: forward<_Tuple>(_Tpl))...); } template <class _Callable, class _Tuple> constexpr decltype(auto) apply(_Callable&& _Obj, _Tuple&& _Tpl) { return _Apply_impl(::std:: forward<_Callable>(_Obj), ::std:: forward<_Tuple>(_Tpl), make_index_sequence<tuple_size_v<remove_reference_t<_Tuple>>>{}); } template <class _Ty, class _Tuple, size_t... _Indices> constexpr _Ty _Make_from_tuple_impl( _Tuple&& _Tpl, index_sequence<_Indices...>) { return _Ty(::std:: get<_Indices>(::std:: forward<_Tuple>(_Tpl))...); } template <class _Ty, class _Tuple> [[nodiscard]] constexpr _Ty make_from_tuple(_Tuple&& _Tpl) { return _Make_from_tuple_impl<_Ty>( ::std:: forward<_Tuple>(_Tpl), make_index_sequence<tuple_size_v<remove_reference_t<_Tuple>>>{}); } template <class... _Types, class _Alloc> struct uses_allocator<tuple<_Types...>, _Alloc> : true_type {}; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) #pragma warning(disable : 4275) #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4514 4820 ) #pragma pack(push, 8) struct __type_info_node; extern __type_info_node __type_info_root_node; __pragma(pack(push, 8)) extern "C" { struct __std_type_info_data { const char * _UndecoratedName; const char _DecoratedName[1]; __std_type_info_data() = delete; __std_type_info_data(const __std_type_info_data&) = delete; __std_type_info_data(__std_type_info_data&&) = delete; __std_type_info_data& operator=(const __std_type_info_data&) = delete; __std_type_info_data& operator=(__std_type_info_data&&) = delete; }; int __cdecl __std_type_info_compare( const __std_type_info_data* _Lhs, const __std_type_info_data* _Rhs ); size_t __cdecl __std_type_info_hash( const __std_type_info_data* _Data ); const char* __cdecl __std_type_info_name( __std_type_info_data* _Data, __type_info_node* _RootNode ); } __pragma(pack(pop)) #pragma warning(push) #pragma warning(disable: 4577) class type_info { public: type_info(const type_info&) = delete; type_info& operator=(const type_info&) = delete; size_t hash_code() const noexcept { return __std_type_info_hash(&_Data); } bool operator==(const type_info& _Other) const noexcept { return __std_type_info_compare(&_Data, &_Other._Data) == 0; } bool before(const type_info& _Other) const noexcept { return __std_type_info_compare(&_Data, &_Other._Data) < 0; } const char* name() const noexcept { return __std_type_info_name(&_Data, &__type_info_root_node); } const char* raw_name() const noexcept { return _Data._DecoratedName; } virtual ~type_info() noexcept; private: mutable __std_type_info_data _Data; }; #pragma warning(pop) namespace std { using ::type_info; } namespace std { #pragma warning(push) #pragma warning(disable: 4577) class bad_cast : public exception { public: bad_cast() noexcept : exception("bad cast", 1) { } static bad_cast __construct_from_string_literal(const char* const _Message) noexcept { return bad_cast(_Message, 1); } private: bad_cast(const char* const _Message, int) noexcept : exception(_Message, 1) { } }; class bad_typeid : public exception { public: bad_typeid() noexcept : exception("bad typeid", 1) { } static bad_typeid __construct_from_string_literal(const char* const _Message) noexcept { return bad_typeid(_Message, 1); } private: friend class __non_rtti_object; bad_typeid(const char* const _Message, int) noexcept : exception(_Message, 1) { } }; class __non_rtti_object : public bad_typeid { public: static __non_rtti_object __construct_from_string_literal(const char* const _Message) noexcept { return __non_rtti_object(_Message, 1); } private: __non_rtti_object(const char* const _Message, int) noexcept : bad_typeid(_Message, 1) { } }; #pragma warning(pop) } #pragma pack(pop) #pragma warning(pop) #pragma external_header(pop) namespace std { constexpr int _Small_object_num_ptrs = 6 + 16 / sizeof(void*); [[noreturn]] inline void _Throw_bad_cast() { throw bad_cast{}; } } #pragma pack(pop) #pragma warning(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { struct destroying_delete_t { explicit destroying_delete_t() = default; }; inline constexpr destroying_delete_t destroying_delete{}; template <class _Ty> [[nodiscard]] constexpr _Ty* launder(_Ty* _Ptr) noexcept { static_assert(!is_function_v<_Ty> && !is_void_v<_Ty>, "N4727 21.6.4 [ptr.launder]/3: The program is ill-formed if T is a function type or cv void."); return __builtin_launder(_Ptr); } inline constexpr size_t hardware_constructive_interference_size = 64; inline constexpr size_t hardware_destructive_interference_size = 64; using new_handler = void(__cdecl*)(); new_handler __cdecl set_new_handler( new_handler) noexcept; [[nodiscard]] new_handler __cdecl get_new_handler() noexcept; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { enum class memory_order : int { relaxed, consume, acquire, release, acq_rel, seq_cst, memory_order_relaxed = relaxed, memory_order_consume = consume, memory_order_acquire = acquire, memory_order_release = release, memory_order_acq_rel = acq_rel, memory_order_seq_cst = seq_cst }; inline constexpr memory_order memory_order_relaxed = memory_order::relaxed; inline constexpr memory_order memory_order_consume = memory_order::consume; inline constexpr memory_order memory_order_acquire = memory_order::acquire; inline constexpr memory_order memory_order_release = memory_order::release; inline constexpr memory_order memory_order_acq_rel = memory_order::acq_rel; inline constexpr memory_order memory_order_seq_cst = memory_order::seq_cst; using _Atomic_counter_t = unsigned long; template <class _Integral, class _Ty> [[nodiscard]] volatile _Integral* _Atomic_address_as(_Ty& _Source) noexcept { static_assert(is_integral_v<_Integral>, "Tried to reinterpret memory as non-integral"); return &reinterpret_cast<volatile _Integral&>(_Source); } template <class _Integral, class _Ty> [[nodiscard]] const volatile _Integral* _Atomic_address_as(const _Ty& _Source) noexcept { static_assert(is_integral_v<_Integral>, "Tried to reinterpret memory as non-integral"); return &reinterpret_cast<const volatile _Integral&>(_Source); } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { template <class _Ty> struct [[nodiscard]] _Tidy_guard { _Ty* _Target; constexpr ~_Tidy_guard() { if (_Target) { _Target->_Tidy(); } } }; template <class _Ty> struct [[nodiscard]] _Tidy_deallocate_guard { _Ty* _Target; constexpr ~_Tidy_deallocate_guard() { if (_Target) { _Target->_Tidy_deallocate(); } } }; template <class _Keycmp, class _Lhs, class _Rhs> inline constexpr bool _Nothrow_compare = noexcept( static_cast<bool>(::std:: declval<const _Keycmp&>()(::std:: declval<const _Lhs&>(), ::std:: declval<const _Rhs&>()))); template <size_t _Ty_size> [[nodiscard]] constexpr size_t _Get_size_of_n(const size_t _Count) { constexpr bool _Overflow_is_possible = _Ty_size > 1; if constexpr (_Overflow_is_possible) { constexpr size_t _Max_possible = static_cast<size_t>(-1) / _Ty_size; if (_Count > _Max_possible) { _Throw_bad_array_new_length(); } } return _Count * _Ty_size; } template <class _Ty> inline constexpr size_t _New_alignof = (::std:: max)(alignof(_Ty), static_cast<size_t>(16ull) ); struct _Default_allocate_traits { __declspec(allocator) static void* _Allocate(const size_t _Bytes) { return ::operator new(_Bytes); } __declspec(allocator) static void* _Allocate_aligned(const size_t _Bytes, const size_t _Align) { { return ::operator new (_Bytes, align_val_t{_Align}); } } }; constexpr bool _Is_pow_2(const size_t _Value) noexcept { return _Value != 0 && (_Value & (_Value - 1)) == 0; } constexpr size_t _Big_allocation_threshold = 4096; constexpr size_t _Big_allocation_alignment = 32; static_assert(2 * sizeof(void*) <= _Big_allocation_alignment, "Big allocation alignment should at least match vector register alignment"); static_assert(_Is_pow_2(_Big_allocation_alignment), "Big allocation alignment must be a power of two"); constexpr size_t _Non_user_size = 2 * sizeof(void*) + _Big_allocation_alignment - 1; constexpr size_t _Big_allocation_sentinel = 0xFAFAFAFAFAFAFAFAULL; template <class _Traits> __declspec(allocator) void* _Allocate_manually_vector_aligned(const size_t _Bytes) { const size_t _Block_size = _Non_user_size + _Bytes; if (_Block_size <= _Bytes) { _Throw_bad_array_new_length(); } const uintptr_t _Ptr_container = reinterpret_cast<uintptr_t>(_Traits::_Allocate(_Block_size)); do { if (_Ptr_container != 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xmemory", 142, 0, "%s", "invalid argument")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"invalid argument\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xmemory", 142, 0); } while (false); } ; } while (false); void* const _Ptr = reinterpret_cast<void*>((_Ptr_container + _Non_user_size) & ~(_Big_allocation_alignment - 1)); static_cast<uintptr_t*>(_Ptr)[-1] = _Ptr_container; static_cast<uintptr_t*>(_Ptr)[-2] = _Big_allocation_sentinel; return _Ptr; } inline void _Adjust_manually_vector_aligned(void*& _Ptr, size_t& _Bytes) { _Bytes += _Non_user_size; const uintptr_t* const _Ptr_user = reinterpret_cast<uintptr_t*>(_Ptr); const uintptr_t _Ptr_container = _Ptr_user[-1]; do { if (_Ptr_user[-2] == _Big_allocation_sentinel) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xmemory", 162, 0, "%s", "invalid argument")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"invalid argument\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xmemory", 162, 0); } while (false); } ; } while (false); constexpr uintptr_t _Min_back_shift = 2 * sizeof(void*); const uintptr_t _Back_shift = reinterpret_cast<uintptr_t>(_Ptr) - _Ptr_container; do { if (_Back_shift >= _Min_back_shift && _Back_shift <= _Non_user_size) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xmemory", 172, 0, "%s", "invalid argument")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"invalid argument\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xmemory", 172, 0); } while (false); } ; } while (false); _Ptr = reinterpret_cast<void*>(_Ptr_container); } template <size_t _Align, class _Traits = _Default_allocate_traits, enable_if_t<(_Align > 16ull), int> = 0> __declspec(allocator) constexpr void* _Allocate(const size_t _Bytes) { if (_Bytes == 0) { return nullptr; } if (::std:: is_constant_evaluated()) { return _Traits::_Allocate(_Bytes); } else { size_t _Passed_align = _Align; if (_Bytes >= _Big_allocation_threshold) { _Passed_align = (::std:: max)(_Align, _Big_allocation_alignment); } return _Traits::_Allocate_aligned(_Bytes, _Passed_align); } } template <size_t _Align, enable_if_t<(_Align > 16ull), int> = 0> constexpr void _Deallocate(void* _Ptr, const size_t _Bytes) noexcept { if (::std:: is_constant_evaluated()) { ::operator delete(_Ptr); } else { size_t _Passed_align = _Align; if (_Bytes >= _Big_allocation_threshold) { _Passed_align = (::std:: max)(_Align, _Big_allocation_alignment); } ::operator delete (_Ptr, _Bytes, align_val_t{_Passed_align}); } } template <size_t _Align, class _Traits = _Default_allocate_traits, enable_if_t<(!1 || _Align <= 16ull), int> = 0> __declspec(allocator) constexpr void* _Allocate(const size_t _Bytes) { if (!::std:: is_constant_evaluated()) { if (_Bytes >= _Big_allocation_threshold) { return _Allocate_manually_vector_aligned<_Traits>(_Bytes); } } if (_Bytes != 0) { return _Traits::_Allocate(_Bytes); } return nullptr; } template <size_t _Align, enable_if_t<(!1 || _Align <= 16ull), int> = 0> constexpr void _Deallocate(void* _Ptr, size_t _Bytes) noexcept { if (::std:: is_constant_evaluated()) { ::operator delete(_Ptr); } else { if (_Bytes >= _Big_allocation_threshold) { _Adjust_manually_vector_aligned(_Ptr, _Bytes); } ::operator delete(_Ptr, _Bytes); } } template <class _Ty, class... _Types> _Ty* _Global_new(_Types&&... _Args) { struct [[nodiscard]] _Guard_type { void* _Result; ~_Guard_type() { if (_Result) { _Deallocate<_New_alignof<_Ty>>(_Result, sizeof(_Ty)); } } }; _Guard_type _Guard{_Allocate<_New_alignof<_Ty>>(sizeof(_Ty))}; ::new (_Guard._Result) _Ty(::std:: forward<_Types>(_Args)...); return static_cast<_Ty*>(::std:: exchange(_Guard._Result, nullptr)); } template <class _Ptr, class _Ty> using _Rebind_pointer_t = typename pointer_traits<_Ptr>::template rebind<_Ty>; template <class _Pointer, enable_if_t<!is_pointer_v<_Pointer>, int> = 0> constexpr _Pointer _Refancy(typename pointer_traits<_Pointer>::element_type* _Ptr) noexcept { return pointer_traits<_Pointer>::pointer_to(*_Ptr); } template <class _Pointer, enable_if_t<is_pointer_v<_Pointer>, int> = 0> constexpr _Pointer _Refancy(_Pointer _Ptr) noexcept { return _Ptr; } template <class _NoThrowFwdIt, class _NoThrowSentinel> constexpr void _Destroy_range(_NoThrowFwdIt _First, _NoThrowSentinel _Last) noexcept; template <class _Ty> constexpr void _Destroy_in_place(_Ty& _Obj) noexcept { if constexpr (is_array_v<_Ty>) { _Destroy_range(_Obj, _Obj + extent_v<_Ty>); } else { _Obj.~_Ty(); } } template <class _Ty> constexpr void destroy_at(_Ty* const _Location) noexcept { if constexpr (is_array_v<_Ty>) { _Destroy_range(::std:: begin(*_Location), ::std:: end(*_Location)); } else { _Location->~_Ty(); } } template <class _Ptrty> auto _Const_cast(_Ptrty _Ptr) noexcept { using _Elem = typename pointer_traits<_Ptrty>::element_type; using _Modifiable = remove_const_t<_Elem>; using _Dest = typename pointer_traits<_Ptrty>::template rebind<_Modifiable>; return pointer_traits<_Dest>::pointer_to(const_cast<_Modifiable&>(*_Ptr)); } template <class _Ty> auto _Const_cast(_Ty* _Ptr) noexcept { return const_cast<remove_const_t<_Ty>*>(_Ptr); } template <class _Ty, class = void> struct _Get_pointer_type { using type = typename _Ty::value_type*; }; __pragma(warning(push)) __pragma(warning(disable : 4996)) template <class _Ty> struct _Get_pointer_type<_Ty, void_t<typename _Ty::pointer>> { using type = typename _Ty::pointer; }; __pragma(warning(pop)) template <class _Ty, class = void> struct _Get_const_pointer_type { using _Ptrty = typename _Get_pointer_type<_Ty>::type; using _Valty = typename _Ty::value_type; using type = typename pointer_traits<_Ptrty>::template rebind<const _Valty>; }; __pragma(warning(push)) __pragma(warning(disable : 4996)) template <class _Ty> struct _Get_const_pointer_type<_Ty, void_t<typename _Ty::const_pointer>> { using type = typename _Ty::const_pointer; }; __pragma(warning(pop)) template <class _Ty, class = void> struct _Get_void_pointer_type { using _Ptrty = typename _Get_pointer_type<_Ty>::type; using type = typename pointer_traits<_Ptrty>::template rebind<void>; }; template <class _Ty> struct _Get_void_pointer_type<_Ty, void_t<typename _Ty::void_pointer>> { using type = typename _Ty::void_pointer; }; template <class _Ty, class = void> struct _Get_const_void_pointer_type { using _Ptrty = typename _Get_pointer_type<_Ty>::type; using type = typename pointer_traits<_Ptrty>::template rebind<const void>; }; template <class _Ty> struct _Get_const_void_pointer_type<_Ty, void_t<typename _Ty::const_void_pointer>> { using type = typename _Ty::const_void_pointer; }; template <class _Ty, class = void> struct _Get_difference_type { using _Ptrty = typename _Get_pointer_type<_Ty>::type; using type = typename pointer_traits<_Ptrty>::difference_type; }; template <class _Ty> struct _Get_difference_type<_Ty, void_t<typename _Ty::difference_type>> { using type = typename _Ty::difference_type; }; template <class _Ty, class = void> struct _Get_size_type { using type = make_unsigned_t<typename _Get_difference_type<_Ty>::type>; }; template <class _Ty> struct _Get_size_type<_Ty, void_t<typename _Ty::size_type>> { using type = typename _Ty::size_type; }; template <class _Ty, class = void> struct _Get_propagate_on_container_copy { using type = false_type; }; template <class _Ty> struct _Get_propagate_on_container_copy<_Ty, void_t<typename _Ty::propagate_on_container_copy_assignment>> { using type = typename _Ty::propagate_on_container_copy_assignment; }; template <class _Ty, class = void> struct _Get_propagate_on_container_move { using type = false_type; }; template <class _Ty> struct _Get_propagate_on_container_move<_Ty, void_t<typename _Ty::propagate_on_container_move_assignment>> { using type = typename _Ty::propagate_on_container_move_assignment; }; template <class _Ty, class = void> struct _Get_propagate_on_container_swap { using type = false_type; }; template <class _Ty> struct _Get_propagate_on_container_swap<_Ty, void_t<typename _Ty::propagate_on_container_swap>> { using type = typename _Ty::propagate_on_container_swap; }; template <class _Ty, class = void> struct _Get_is_always_equal { using type = bool_constant<is_empty_v<_Ty>>; }; __pragma(warning(push)) __pragma(warning(disable : 4996)) template <class _Ty> struct _Get_is_always_equal<_Ty, void_t<typename _Ty::is_always_equal>> { using type = typename _Ty::is_always_equal; }; __pragma(warning(pop)) template <class _Ty, class _Other, class = void> struct _Get_rebind_type { using type = typename _Replace_first_parameter<_Other, _Ty>::type; }; __pragma(warning(push)) __pragma(warning(disable : 4996)) template <class _Ty, class _Other> struct _Get_rebind_type<_Ty, _Other, void_t<typename _Ty::template rebind<_Other>::other>> { using type = typename _Ty::template rebind<_Other>::other; }; __pragma(warning(pop)) template <class _Ty> class allocator; template <class _Alloc, class = void> struct _Is_default_allocator : false_type {}; template <class _Ty> struct _Is_default_allocator<allocator<_Ty>, void_t<typename allocator<_Ty>::_From_primary>> : is_same<typename allocator<_Ty>::_From_primary, allocator<_Ty>>::type {}; template <class _Void, class... _Types> struct _Has_no_allocator_construct : true_type {}; __pragma(warning(push)) __pragma(warning(disable : 4996)) template <class _Alloc, class _Ptr, class... _Args> struct _Has_no_allocator_construct< void_t<decltype(::std:: declval<_Alloc&>().construct(::std:: declval<_Ptr>(), ::std:: declval<_Args>()...))>, _Alloc, _Ptr, _Args...> : false_type {}; __pragma(warning(pop)) template <class _Alloc, class _Ptr, class... _Args> using _Uses_default_construct = disjunction<_Is_default_allocator<_Alloc>, _Has_no_allocator_construct<void, _Alloc, _Ptr, _Args...>>; template <class _Alloc, class _Ptr, class = void> struct _Has_no_alloc_destroy : true_type {}; __pragma(warning(push)) __pragma(warning(disable : 4996)) template <class _Alloc, class _Ptr> struct _Has_no_alloc_destroy<_Alloc, _Ptr, void_t<decltype(::std:: declval<_Alloc&>().destroy(::std:: declval<_Ptr>()))>> : false_type {}; __pragma(warning(pop)) template <class _Alloc, class _Ptr> using _Uses_default_destroy = disjunction<_Is_default_allocator<_Alloc>, _Has_no_alloc_destroy<_Alloc, _Ptr>>; template <class _Alloc, class _Ptr> using _Uses_default_destroy_t = typename _Uses_default_destroy<_Alloc, _Ptr>::type; template <class _Alloc, class _Size_type, class _Const_void_pointer, class = void> struct _Has_allocate_hint : false_type {}; __pragma(warning(push)) __pragma(warning(disable : 4996)) template <class _Alloc, class _Size_type, class _Const_void_pointer> struct _Has_allocate_hint<_Alloc, _Size_type, _Const_void_pointer, void_t<decltype(::std:: declval<_Alloc&>().allocate( ::std:: declval<const _Size_type&>(), ::std:: declval<const _Const_void_pointer&>()))>> : true_type {}; __pragma(warning(pop)) template <class _Alloc, class = void> struct _Has_max_size : false_type {}; __pragma(warning(push)) __pragma(warning(disable : 4996)) template <class _Alloc> struct _Has_max_size<_Alloc, void_t<decltype(::std:: declval<const _Alloc&>().max_size())>> : true_type {}; __pragma(warning(pop)) template <class _Alloc, class = void> struct _Has_select_on_container_copy_construction : false_type {}; template <class _Alloc> struct _Has_select_on_container_copy_construction<_Alloc, void_t<decltype(::std:: declval<const _Alloc&>().select_on_container_copy_construction())>> : true_type {}; template <class _Alloc> struct allocator_traits; __pragma(warning(push)) __pragma(warning(disable : 4996)) template <class _Alloc> struct _Normal_allocator_traits { using allocator_type = _Alloc; using value_type = typename _Alloc::value_type; using pointer = typename _Get_pointer_type<_Alloc>::type; using const_pointer = typename _Get_const_pointer_type<_Alloc>::type; using void_pointer = typename _Get_void_pointer_type<_Alloc>::type; using const_void_pointer = typename _Get_const_void_pointer_type<_Alloc>::type; using size_type = typename _Get_size_type<_Alloc>::type; using difference_type = typename _Get_difference_type<_Alloc>::type; using propagate_on_container_copy_assignment = typename _Get_propagate_on_container_copy<_Alloc>::type; using propagate_on_container_move_assignment = typename _Get_propagate_on_container_move<_Alloc>::type; using propagate_on_container_swap = typename _Get_propagate_on_container_swap<_Alloc>::type; using is_always_equal = typename _Get_is_always_equal<_Alloc>::type; template <class _Other> using rebind_alloc = typename _Get_rebind_type<_Alloc, _Other>::type; template <class _Other> using rebind_traits = allocator_traits<rebind_alloc<_Other>>; [[nodiscard]] static constexpr __declspec(allocator) pointer allocate(_Alloc& _Al, const size_type _Count) { return _Al.allocate(_Count); } [[nodiscard]] static constexpr __declspec(allocator) pointer allocate(_Alloc& _Al, const size_type _Count, const const_void_pointer _Hint) { if constexpr (_Has_allocate_hint<_Alloc, size_type, const_void_pointer>::value) { return _Al.allocate(_Count, _Hint); } else { return _Al.allocate(_Count); } } static constexpr void deallocate(_Alloc& _Al, pointer _Ptr, size_type _Count) { _Al.deallocate(_Ptr, _Count); } template <class _Ty, class... _Types> static constexpr void construct(_Alloc& _Al, _Ty* _Ptr, _Types&&... _Args) { if constexpr (_Uses_default_construct<_Alloc, _Ty*, _Types...>::value) { (void) _Al; ::std:: construct_at(_Ptr, ::std:: forward<_Types>(_Args)...); } else { _Al.construct(_Ptr, ::std:: forward<_Types>(_Args)...); } } template <class _Ty> static constexpr void destroy(_Alloc& _Al, _Ty* _Ptr) { if constexpr (_Uses_default_destroy<_Alloc, _Ty*>::value) { ::std:: destroy_at(_Ptr); } else { _Al.destroy(_Ptr); } } [[nodiscard]] static constexpr size_type max_size(const _Alloc& _Al) noexcept { if constexpr (_Has_max_size<_Alloc>::value) { return _Al.max_size(); } else { return (numeric_limits<size_type>::max)() / sizeof(value_type); } } [[nodiscard]] static constexpr _Alloc select_on_container_copy_construction(const _Alloc& _Al) { if constexpr (_Has_select_on_container_copy_construction<_Alloc>::value) { return _Al.select_on_container_copy_construction(); } else { return _Al; } } }; __pragma(warning(pop)) template <class _Alloc> struct _Default_allocator_traits { using allocator_type = _Alloc; using value_type = typename _Alloc::value_type; using pointer = value_type*; using const_pointer = const value_type*; using void_pointer = void*; using const_void_pointer = const void*; using size_type = size_t; using difference_type = ptrdiff_t; using propagate_on_container_copy_assignment = false_type; using propagate_on_container_move_assignment = true_type; using propagate_on_container_swap = false_type; using is_always_equal = true_type; template <class _Other> using rebind_alloc = allocator<_Other>; template <class _Other> using rebind_traits = allocator_traits<allocator<_Other>>; [[nodiscard]] static constexpr __declspec(allocator) pointer allocate(_Alloc& _Al, const size_type _Count) { if (::std:: is_constant_evaluated()) { return _Al.allocate(_Count); } else { (void) _Al; return static_cast<pointer>( _Allocate<_New_alignof<value_type>>(_Get_size_of_n<sizeof(value_type)>(_Count))); } } [[nodiscard]] static constexpr __declspec(allocator) pointer allocate(_Alloc& _Al, const size_type _Count, const_void_pointer) { if (::std:: is_constant_evaluated()) { return _Al.allocate(_Count); } else { (void) _Al; return static_cast<pointer>( _Allocate<_New_alignof<value_type>>(_Get_size_of_n<sizeof(value_type)>(_Count))); } } static constexpr void deallocate(_Alloc& _Al, const pointer _Ptr, const size_type _Count) { if (::std:: is_constant_evaluated()) { _Al.deallocate(_Ptr, _Count); } else { (void) _Al; _Deallocate<_New_alignof<value_type>>(_Ptr, sizeof(value_type) * _Count); } } template <class _Objty, class... _Types> static constexpr void construct(_Alloc&, _Objty* const _Ptr, _Types&&... _Args) { if (::std:: is_constant_evaluated()) { ::std:: construct_at(_Ptr, ::std:: forward<_Types>(_Args)...); } else { ::new (_Voidify_iter(_Ptr)) _Objty(::std:: forward<_Types>(_Args)...); } } template <class _Uty> static constexpr void destroy(_Alloc&, _Uty* const _Ptr) { ::std:: destroy_at(_Ptr); } [[nodiscard]] static constexpr size_type max_size(const _Alloc&) noexcept { return static_cast<size_t>(-1) / sizeof(value_type); } [[nodiscard]] static constexpr _Alloc select_on_container_copy_construction(const _Alloc& _Al) { return _Al; } }; template <class _Alloc> struct allocator_traits : conditional_t<_Is_default_allocator<_Alloc>::value, _Default_allocator_traits<_Alloc>, _Normal_allocator_traits<_Alloc>> {}; template <class _Alloc> using _Choose_pocca = bool_constant<allocator_traits<_Alloc>::propagate_on_container_copy_assignment::value && !allocator_traits<_Alloc>::is_always_equal::value>; struct _Equal_allocators {}; using _Propagate_allocators = true_type; using _No_propagate_allocators = false_type; template <class _Alloc> using _Choose_pocma = conditional_t<allocator_traits<_Alloc>::is_always_equal::value, _Equal_allocators, typename allocator_traits<_Alloc>::propagate_on_container_move_assignment::type>; template <class _Alloc, class _Value_type> using _Rebind_alloc_t = typename allocator_traits<_Alloc>::template rebind_alloc<_Value_type>; template <class _Alloc, class _Value_type> using _Maybe_rebind_alloc_t = typename _Select<is_same_v<typename _Alloc::value_type, _Value_type>>::template _Apply<_Alloc&, _Rebind_alloc_t<_Alloc, _Value_type>>; template <class _Alloc> inline constexpr bool _Is_simple_alloc_v = is_same_v<typename allocator_traits<_Alloc>::size_type, size_t>&& is_same_v<typename allocator_traits<_Alloc>::difference_type, ptrdiff_t>&& is_same_v<typename allocator_traits<_Alloc>::pointer, typename _Alloc::value_type*>&& is_same_v<typename allocator_traits<_Alloc>::const_pointer, const typename _Alloc::value_type*>; template <class _Value_type> struct _Simple_types { using value_type = _Value_type; using size_type = size_t; using difference_type = ptrdiff_t; using pointer = value_type*; using const_pointer = const value_type*; }; template <class _Ty> class allocator { public: static_assert(!is_const_v<_Ty>, "The C++ Standard forbids containers of const elements " "because allocator<const T> is ill-formed."); using _From_primary = allocator; using value_type = _Ty; using size_type = size_t; using difference_type = ptrdiff_t; using propagate_on_container_move_assignment = true_type; constexpr allocator() noexcept {} constexpr allocator(const allocator&) noexcept = default; template <class _Other> constexpr allocator(const allocator<_Other>&) noexcept {} constexpr ~allocator() = default; constexpr allocator& operator=(const allocator&) = default; constexpr void deallocate(_Ty* const _Ptr, const size_t _Count) { _Deallocate<_New_alignof<_Ty>>(_Ptr, sizeof(_Ty) * _Count); } [[nodiscard]] constexpr __declspec(allocator) _Ty* allocate( const size_t _Count) { return static_cast<_Ty*>(_Allocate<_New_alignof<_Ty>>(_Get_size_of_n<sizeof(_Ty)>(_Count))); } }; template <> class allocator<void> { public: using value_type = void; using size_type = size_t; using difference_type = ptrdiff_t; using propagate_on_container_move_assignment = true_type; }; template <class _Ty, class _Other> [[nodiscard]] constexpr bool operator==(const allocator<_Ty>&, const allocator<_Other>&) noexcept { return true; } template <class _Alloc> using _Guide_size_type_t = typename allocator_traits<conditional_t<_Is_allocator<_Alloc>::value, _Alloc, allocator<int>>>::size_type; template <class _Alloc> using _Alloc_ptr_t = typename allocator_traits<_Alloc>::pointer; template <class _Alloc> using _Alloc_size_t = typename allocator_traits<_Alloc>::size_type; template <class _Alloc> constexpr void _Pocca(_Alloc& _Left, const _Alloc& _Right) noexcept { if constexpr (allocator_traits<_Alloc>::propagate_on_container_copy_assignment::value) { _Left = _Right; } } template <class _Alloc> constexpr void _Pocma(_Alloc& _Left, _Alloc& _Right) noexcept { if constexpr (allocator_traits<_Alloc>::propagate_on_container_move_assignment::value) { _Left = ::std:: move(_Right); } } template <class _Alloc> constexpr void _Pocs(_Alloc& _Left, _Alloc& _Right) noexcept { if constexpr (allocator_traits<_Alloc>::propagate_on_container_swap::value) { _Swap_adl(_Left, _Right); } else { do { if (_Left == _Right) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xmemory", 938, 0, "%s", "containers incompatible for swap")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"containers incompatible for swap\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xmemory", 938, 0); } while (false); } ; } while (false); } } template <class _Alloc> constexpr void _Destroy_range( _Alloc_ptr_t<_Alloc> _First, const _Alloc_ptr_t<_Alloc> _Last, _Alloc& _Al) noexcept { using _Ty = typename _Alloc::value_type; if constexpr (!conjunction_v<is_trivially_destructible<_Ty>, _Uses_default_destroy<_Alloc, _Ty*>>) { for (; _First != _Last; ++_First) { allocator_traits<_Alloc>::destroy(_Al, _Unfancy(_First)); } } } template <class _NoThrowFwdIt, class _NoThrowSentinel> constexpr void _Destroy_range(_NoThrowFwdIt _First, const _NoThrowSentinel _Last) noexcept { if constexpr (!is_trivially_destructible_v<_Iter_value_t<_NoThrowFwdIt>>) { for (; _First != _Last; ++_First) { _Destroy_in_place(*_First); } } } template <class _Size_type> [[nodiscard]] constexpr _Size_type _Convert_size(const size_t _Len) noexcept { if (_Len > (numeric_limits<_Size_type>::max)()) { _Xlength_error("size_t too long for _Size_type"); } return static_cast<_Size_type>(_Len); } template <> [[nodiscard]] constexpr size_t _Convert_size<size_t>(const size_t _Len) noexcept { return _Len; } template <class _Alloc> constexpr void _Deallocate_plain(_Alloc& _Al, typename _Alloc::value_type* const _Ptr) noexcept { using _Alloc_traits = allocator_traits<_Alloc>; if constexpr (is_same_v<_Alloc_ptr_t<_Alloc>, typename _Alloc::value_type*>) { _Alloc_traits::deallocate(_Al, _Ptr, 1); } else { using _Ptr_traits = pointer_traits<_Alloc_ptr_t<_Alloc>>; _Alloc_traits::deallocate(_Al, _Ptr_traits::pointer_to(*_Ptr), 1); } } template <class _Alloc> constexpr void _Delete_plain_internal(_Alloc& _Al, typename _Alloc::value_type* const _Ptr) noexcept { using _Ty = typename _Alloc::value_type; _Ptr->~_Ty(); _Deallocate_plain(_Al, _Ptr); } template <class _Alloc> struct _Alloc_construct_ptr { using pointer = _Alloc_ptr_t<_Alloc>; _Alloc& _Al; pointer _Ptr; constexpr explicit _Alloc_construct_ptr(_Alloc& _Al_) : _Al(_Al_), _Ptr(nullptr) {} [[nodiscard]] constexpr pointer _Release() noexcept { return ::std:: exchange(_Ptr, nullptr); } constexpr void _Allocate() { _Ptr = nullptr; _Ptr = _Al.allocate(1); } constexpr ~_Alloc_construct_ptr() { if (_Ptr) { _Al.deallocate(_Ptr, 1); } } _Alloc_construct_ptr(const _Alloc_construct_ptr&) = delete; _Alloc_construct_ptr& operator=(const _Alloc_construct_ptr&) = delete; }; struct _Fake_allocator {}; struct _Container_base0 { constexpr void _Orphan_all() noexcept {} constexpr void _Swap_proxy_and_iterators(_Container_base0&) noexcept {} constexpr void _Alloc_proxy(const _Fake_allocator&) noexcept {} constexpr void _Reload_proxy(const _Fake_allocator&, const _Fake_allocator&) noexcept {} }; struct _Iterator_base0 { constexpr void _Adopt(const void*) noexcept {} constexpr const _Container_base0* _Getcont() const noexcept { return nullptr; } static constexpr bool _Unwrap_when_unverified = true; }; struct _Container_base12; struct _Container_proxy { constexpr _Container_proxy() noexcept = default; constexpr _Container_proxy(_Container_base12* _Mycont_) noexcept : _Mycont(_Mycont_) {} const _Container_base12* _Mycont = nullptr; mutable _Iterator_base12* _Myfirstiter = nullptr; }; struct _Container_base12 { public: constexpr _Container_base12() noexcept = default; _Container_base12(const _Container_base12&) = delete; _Container_base12& operator=(const _Container_base12&) = delete; constexpr void _Orphan_all() noexcept; constexpr void _Swap_proxy_and_iterators(_Container_base12&) noexcept; template <class _Alloc> constexpr void _Alloc_proxy(_Alloc&& _Al) { _Container_proxy* const _New_proxy = _Unfancy(_Al.allocate(1)); _Construct_in_place(*_New_proxy, this); _Myproxy = _New_proxy; _New_proxy->_Mycont = this; } template <class _Alloc> constexpr void _Reload_proxy(_Alloc&& _Old_alloc, _Alloc&& _New_alloc) { _Container_proxy* const _New_proxy = _Unfancy(_New_alloc.allocate(1)); _Construct_in_place(*_New_proxy, this); _New_proxy->_Mycont = this; _Delete_plain_internal(_Old_alloc, ::std:: exchange(_Myproxy, _New_proxy)); } _Container_proxy* _Myproxy = nullptr; private: constexpr void _Orphan_all_unlocked() noexcept; constexpr void _Swap_proxy_and_iterators_unlocked(_Container_base12&) noexcept; void _Orphan_all_locked() noexcept { _Lockit _Lock(3); _Orphan_all_unlocked(); } void _Swap_proxy_and_iterators_locked(_Container_base12& _Right) noexcept { _Lockit _Lock(3); _Swap_proxy_and_iterators_unlocked(_Right); } }; struct _Iterator_base12 { public: constexpr _Iterator_base12() noexcept = default; constexpr _Iterator_base12(const _Iterator_base12& _Right) noexcept { *this = _Right; } constexpr _Iterator_base12& operator=(const _Iterator_base12& _Right) noexcept { if (_Myproxy != _Right._Myproxy) { if (_Right._Myproxy) { _Adopt(_Right._Myproxy->_Mycont); } else { _Orphan_me_v2(); } } return *this; } constexpr ~_Iterator_base12() noexcept { _Orphan_me_v2(); } constexpr void _Adopt(const _Container_base12* _Parent) noexcept { if (_Parent) { _Container_proxy* _Parent_proxy = _Parent->_Myproxy; if (_Myproxy != _Parent_proxy) { if (::std:: is_constant_evaluated()) { _Adopt_unlocked(_Parent_proxy); } else { _Adopt_locked(_Parent_proxy); } } } else { _Orphan_me_v2(); } } constexpr void _Orphan_me_v2() noexcept { if (_Myproxy) { if (::std:: is_constant_evaluated()) { _Orphan_me_unlocked(); } else { _Orphan_me_locked(); } } } constexpr const _Container_base12* _Getcont() const noexcept { return _Myproxy ? _Myproxy->_Mycont : nullptr; } static constexpr bool _Unwrap_when_unverified = 2 == 0; mutable _Container_proxy* _Myproxy = nullptr; mutable _Iterator_base12* _Mynextiter = nullptr; private: constexpr void _Adopt_unlocked(_Container_proxy* _Parent_proxy) noexcept { if (_Myproxy) { _Orphan_me_unlocked(); } _Mynextiter = _Parent_proxy->_Myfirstiter; _Parent_proxy->_Myfirstiter = this; _Myproxy = _Parent_proxy; } void _Adopt_locked(_Container_proxy* _Parent_proxy) noexcept { _Lockit _Lock(3); _Adopt_unlocked(_Parent_proxy); } constexpr void _Orphan_me_unlocked() noexcept { _Iterator_base12** _Pnext = &_Myproxy->_Myfirstiter; while (*_Pnext && *_Pnext != this) { const auto _Temp = *_Pnext; _Pnext = &_Temp->_Mynextiter; } do { if (*_Pnext) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xmemory", 1207, 0, "%s", "ITERATOR LIST CORRUPTED!")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"ITERATOR LIST CORRUPTED!\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xmemory", 1207, 0); } while (false); } ; } while (false); *_Pnext = _Mynextiter; _Myproxy = nullptr; } void _Orphan_me_locked() noexcept { _Lockit _Lock(3); _Orphan_me_unlocked(); } }; constexpr void _Container_base12::_Orphan_all_unlocked() noexcept { for (auto& _Pnext = _Myproxy->_Myfirstiter; _Pnext; _Pnext = _Pnext->_Mynextiter) { _Pnext->_Myproxy = nullptr; } _Myproxy->_Myfirstiter = nullptr; } constexpr void _Container_base12::_Orphan_all() noexcept { if (_Myproxy) { if (::std:: is_constant_evaluated()) { _Orphan_all_unlocked(); } else { _Orphan_all_locked(); } } } constexpr void _Container_base12::_Swap_proxy_and_iterators_unlocked(_Container_base12& _Right) noexcept { _Container_proxy* _Temp = _Myproxy; _Myproxy = _Right._Myproxy; _Right._Myproxy = _Temp; if (_Myproxy) { _Myproxy->_Mycont = this; } if (_Right._Myproxy) { _Right._Myproxy->_Mycont = &_Right; } } constexpr void _Container_base12::_Swap_proxy_and_iterators(_Container_base12& _Right) noexcept { if (::std:: is_constant_evaluated()) { _Swap_proxy_and_iterators_unlocked(_Right); } else { _Swap_proxy_and_iterators_locked(_Right); } } using _Container_base = _Container_base12; using _Iterator_base = _Iterator_base12; struct _Leave_proxy_unbound { explicit _Leave_proxy_unbound() = default; }; struct _Fake_proxy_ptr_impl { _Fake_proxy_ptr_impl(const _Fake_proxy_ptr_impl&) = delete; _Fake_proxy_ptr_impl& operator=(const _Fake_proxy_ptr_impl&) = delete; constexpr _Fake_proxy_ptr_impl(const _Fake_allocator&, _Leave_proxy_unbound) noexcept {} constexpr _Fake_proxy_ptr_impl(const _Fake_allocator&, const _Container_base0&) noexcept {} constexpr void _Bind(const _Fake_allocator&, _Container_base0*) noexcept {} constexpr void _Release() noexcept {} }; struct _Basic_container_proxy_ptr12 { _Container_proxy* _Ptr = nullptr; constexpr void _Release() noexcept { _Ptr = nullptr; } protected: constexpr _Basic_container_proxy_ptr12() = default; _Basic_container_proxy_ptr12(const _Basic_container_proxy_ptr12&) = delete; _Basic_container_proxy_ptr12(_Basic_container_proxy_ptr12&&) = delete; }; template <class _Alloc> struct _Container_proxy_ptr12 : _Basic_container_proxy_ptr12 { _Alloc& _Al; constexpr _Container_proxy_ptr12(_Alloc& _Al_, _Leave_proxy_unbound) : _Al(_Al_) { _Ptr = _Unfancy(_Al_.allocate(1)); _Construct_in_place(*_Ptr); } constexpr _Container_proxy_ptr12(_Alloc& _Al_, _Container_base12& _Mycont) : _Al(_Al_) { _Ptr = _Unfancy(_Al_.allocate(1)); _Construct_in_place(*_Ptr, ::std:: addressof(_Mycont)); _Mycont._Myproxy = _Ptr; } constexpr void _Bind(_Alloc& _Old_alloc, _Container_base12* _Mycont) noexcept { _Ptr->_Mycont = _Mycont; _Delete_plain_internal(_Old_alloc, ::std:: exchange(_Mycont->_Myproxy, ::std:: exchange(_Ptr, nullptr))); } constexpr ~_Container_proxy_ptr12() { if (_Ptr) { _Delete_plain_internal(_Al, _Ptr); } } }; template <class _Alloc> using _Container_proxy_ptr = _Container_proxy_ptr12<_Rebind_alloc_t<_Alloc, _Container_proxy>>; struct _Zero_then_variadic_args_t { explicit _Zero_then_variadic_args_t() = default; }; struct _One_then_variadic_args_t { explicit _One_then_variadic_args_t() = default; }; template <class _Ty1, class _Ty2, bool = is_empty_v<_Ty1> && !is_final_v<_Ty1>> class _Compressed_pair final : private _Ty1 { public: _Ty2 _Myval2; using _Mybase = _Ty1; template <class... _Other2> constexpr explicit _Compressed_pair(_Zero_then_variadic_args_t, _Other2&&... _Val2) noexcept( conjunction_v<is_nothrow_default_constructible<_Ty1>, is_nothrow_constructible<_Ty2, _Other2...>>) : _Ty1(), _Myval2(::std:: forward<_Other2>(_Val2)...) {} template <class _Other1, class... _Other2> constexpr _Compressed_pair(_One_then_variadic_args_t, _Other1&& _Val1, _Other2&&... _Val2) noexcept( conjunction_v<is_nothrow_constructible<_Ty1, _Other1>, is_nothrow_constructible<_Ty2, _Other2...>>) : _Ty1(::std:: forward<_Other1>(_Val1)), _Myval2(::std:: forward<_Other2>(_Val2)...) {} constexpr _Ty1& _Get_first() noexcept { return *this; } constexpr const _Ty1& _Get_first() const noexcept { return *this; } }; template <class _Ty1, class _Ty2> class _Compressed_pair<_Ty1, _Ty2, false> final { public: _Ty1 _Myval1; _Ty2 _Myval2; template <class... _Other2> constexpr explicit _Compressed_pair(_Zero_then_variadic_args_t, _Other2&&... _Val2) noexcept( conjunction_v<is_nothrow_default_constructible<_Ty1>, is_nothrow_constructible<_Ty2, _Other2...>>) : _Myval1(), _Myval2(::std:: forward<_Other2>(_Val2)...) {} template <class _Other1, class... _Other2> constexpr _Compressed_pair(_One_then_variadic_args_t, _Other1&& _Val1, _Other2&&... _Val2) noexcept( conjunction_v<is_nothrow_constructible<_Ty1, _Other1>, is_nothrow_constructible<_Ty2, _Other2...>>) : _Myval1(::std:: forward<_Other1>(_Val1)), _Myval2(::std:: forward<_Other2>(_Val2)...) {} constexpr _Ty1& _Get_first() noexcept { return _Myval1; } constexpr const _Ty1& _Get_first() const noexcept { return _Myval1; } }; struct _Move_allocator_tag { explicit _Move_allocator_tag() = default; }; template <class _Ty> pair<_Ty*, ptrdiff_t> _Get_temporary_buffer(ptrdiff_t _Count) noexcept { if (static_cast<size_t>(_Count) <= static_cast<size_t>(-1) / sizeof(_Ty)) { for (; 0 < _Count; _Count /= 2) { const auto _Size = static_cast<size_t>(_Count) * sizeof(_Ty); void* _Pbuf; if constexpr (alignof(_Ty) > 16ull) { _Pbuf = ::operator new (_Size, align_val_t{alignof(_Ty)}, nothrow); } else { _Pbuf = ::operator new(_Size, nothrow); } if (_Pbuf) { return {static_cast<_Ty*>(_Pbuf), _Count}; } } } return {nullptr, 0}; } template <class _Ty> void _Return_temporary_buffer(_Ty* const _Pbuf) noexcept { if constexpr (alignof(_Ty) > 16ull) { ::operator delete (_Pbuf, align_val_t{alignof(_Ty)}); } else { ::operator delete(_Pbuf); } } template <class _NoThrowFwdIt> struct [[nodiscard]] _Uninitialized_backout { _NoThrowFwdIt _First; _NoThrowFwdIt _Last; constexpr explicit _Uninitialized_backout(_NoThrowFwdIt _Dest) : _First(_Dest), _Last(_Dest) {} constexpr _Uninitialized_backout(_NoThrowFwdIt _First_, _NoThrowFwdIt _Last_) : _First(_First_), _Last(_Last_) {} _Uninitialized_backout(const _Uninitialized_backout&) = delete; _Uninitialized_backout& operator=(const _Uninitialized_backout&) = delete; constexpr ~_Uninitialized_backout() { _Destroy_range(_First, _Last); } template <class... _Types> constexpr void _Emplace_back(_Types&&... _Vals) { _Construct_in_place(*_Last, ::std:: forward<_Types>(_Vals)...); ++_Last; } constexpr _NoThrowFwdIt _Release() { _First = _Last; return _Last; } }; template <class _InIt, class _NoThrowFwdIt> constexpr _NoThrowFwdIt _Uninitialized_move_unchecked( _InIt _First, const _InIt _Last, _NoThrowFwdIt _Dest) { if constexpr (_Ptr_move_cat<_InIt, _NoThrowFwdIt>::_Really_trivial) { if (!::std:: is_constant_evaluated()) { return _Copy_memmove(_First, _Last, _Dest); } } _Uninitialized_backout<_NoThrowFwdIt> _Backout{_Dest}; for (; _First != _Last; ++_First) { _Backout._Emplace_back(::std:: move(*_First)); } return _Backout._Release(); } namespace ranges { template <class _It> concept _No_throw_input_iterator = input_iterator<_It> && is_lvalue_reference_v<iter_reference_t<_It>> && same_as<remove_cvref_t<iter_reference_t<_It>>, iter_value_t<_It>>; template <class _Se, class _It> concept _No_throw_sentinel_for = sentinel_for<_Se, _It>; template <class _It> concept _No_throw_forward_iterator = _No_throw_input_iterator<_It> && forward_iterator<_It> && _No_throw_sentinel_for<_It, _It>; template <class _Rng> concept _No_throw_input_range = range<_Rng> && _No_throw_input_iterator<iterator_t<_Rng>> && _No_throw_sentinel_for<sentinel_t<_Rng>, iterator_t<_Rng>>; template <class _Rng> concept _No_throw_forward_range = _No_throw_input_range<_Rng> && _No_throw_forward_iterator<iterator_t<_Rng>>; template <class _InIt, class _OutIt> in_out_result<_InIt, _OutIt> _Copy_memcpy_common( _InIt _IFirst, _InIt _ILast, _OutIt _OFirst, _OutIt _OLast) noexcept { const auto _IFirstPtr = _To_address(_IFirst); const auto _ILastPtr = _To_address(_ILast); const auto _OFirstPtr = _To_address(_OFirst); const auto _OLastPtr = _To_address(_OLast); const auto _IFirst_ch = const_cast<char*>(reinterpret_cast<const volatile char*>(_IFirstPtr)); const auto _ILast_ch = const_cast<const char*>(reinterpret_cast<const volatile char*>(_ILastPtr)); const auto _OFirst_ch = const_cast<char*>(reinterpret_cast<const volatile char*>(_OFirstPtr)); const auto _OLast_ch = const_cast<const char*>(reinterpret_cast<const volatile char*>(_OLastPtr)); const auto _Count = static_cast<size_t>((::std:: min)(_ILast_ch - _IFirst_ch, _OLast_ch - _OFirst_ch)); :: memcpy(_OFirst_ch, _IFirst_ch, _Count); if constexpr (is_pointer_v<_InIt>) { _IFirst = reinterpret_cast<_InIt>(_IFirst_ch + _Count); } else { _IFirst += _Count / sizeof(iter_value_t<_InIt>); } if constexpr (is_pointer_v<_OutIt>) { _OFirst = reinterpret_cast<_OutIt>(_OFirst_ch + _Count); } else { _OFirst += _Count / sizeof(iter_value_t<_OutIt>); } return {::std:: move(_IFirst), ::std:: move(_OFirst)}; } template <class _In, class _Out> using uninitialized_move_result = in_out_result<_In, _Out>; template <input_iterator _It, sentinel_for<_It> _Se, _No_throw_forward_iterator _Out, _No_throw_sentinel_for<_Out> _OSe> requires constructible_from<iter_value_t<_Out>, iter_rvalue_reference_t<_It>> uninitialized_move_result<_It, _Out> _Uninitialized_move_unchecked( _It _IFirst, _Se _ILast, _Out _OFirst, _OSe _OLast) { if constexpr (_Ptr_move_cat<_It, _Out>::_Really_trivial && sized_sentinel_for<_Se, _It> && sized_sentinel_for<_OSe, _Out>) { return _Copy_memcpy_common( _IFirst, ::std::ranges:: next(_IFirst, ::std:: move(_ILast)), _OFirst, ::std::ranges:: next(_OFirst, ::std:: move(_OLast))); } else { _Uninitialized_backout _Backout{::std:: move(_OFirst)}; for (; _IFirst != _ILast && _Backout._Last != _OLast; ++_IFirst) { _Backout._Emplace_back(::std::ranges:: iter_move(_IFirst)); } return {::std:: move(_IFirst), _Backout._Release()}; } } } template <class _Alloc> class [[nodiscard]] _Uninitialized_backout_al { using pointer = _Alloc_ptr_t<_Alloc>; public: constexpr _Uninitialized_backout_al(pointer _Dest, _Alloc& _Al_) : _First(_Dest), _Last(_Dest), _Al(_Al_) {} _Uninitialized_backout_al(const _Uninitialized_backout_al&) = delete; _Uninitialized_backout_al& operator=(const _Uninitialized_backout_al&) = delete; constexpr ~_Uninitialized_backout_al() { _Destroy_range(_First, _Last, _Al); } template <class... _Types> constexpr void _Emplace_back(_Types&&... _Vals) { allocator_traits<_Alloc>::construct(_Al, _Unfancy(_Last), ::std:: forward<_Types>(_Vals)...); ++_Last; } constexpr pointer _Release() { _First = _Last; return _Last; } private: pointer _First; pointer _Last; _Alloc& _Al; }; template <class _InIt, class _Alloc> constexpr _Alloc_ptr_t<_Alloc> _Uninitialized_copy( const _InIt _First, const _InIt _Last, _Alloc_ptr_t<_Alloc> _Dest, _Alloc& _Al) { using _Ptrval = typename _Alloc::value_type*; auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); if constexpr (conjunction_v<bool_constant<_Ptr_copy_cat<decltype(_UFirst), _Ptrval>::_Really_trivial>, _Uses_default_construct<_Alloc, _Ptrval, decltype(*_UFirst)>>) { if (!::std:: is_constant_evaluated()) { _Copy_memmove(_UFirst, _ULast, _Unfancy(_Dest)); _Dest += _ULast - _UFirst; return _Dest; } } _Uninitialized_backout_al<_Alloc> _Backout{_Dest, _Al}; for (; _UFirst != _ULast; ++_UFirst) { _Backout._Emplace_back(*_UFirst); } return _Backout._Release(); } template <class _InIt, class _NoThrowFwdIt> constexpr _NoThrowFwdIt _Uninitialized_copy_unchecked( _InIt _First, const _InIt _Last, _NoThrowFwdIt _Dest) { if constexpr (_Ptr_copy_cat<_InIt, _NoThrowFwdIt>::_Really_trivial) { if (!::std:: is_constant_evaluated()) { return _Copy_memmove(_First, _Last, _Dest); } } _Uninitialized_backout<_NoThrowFwdIt> _Backout{_Dest}; for (; _First != _Last; ++_First) { _Backout._Emplace_back(*_First); } return _Backout._Release(); } template <class _InIt, class _NoThrowFwdIt> _NoThrowFwdIt uninitialized_copy(const _InIt _First, const _InIt _Last, _NoThrowFwdIt _Dest) { _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); auto _UDest = _Get_unwrapped_n(_Dest, _Idl_distance<_InIt>(_UFirst, _ULast)); _Seek_wrapped(_Dest, _Uninitialized_copy_unchecked(_UFirst, _ULast, _UDest)); return _Dest; } template <class _InIt, class _Alloc> constexpr _Alloc_ptr_t<_Alloc> _Uninitialized_move( const _InIt _First, const _InIt _Last, _Alloc_ptr_t<_Alloc> _Dest, _Alloc& _Al) { using _Ptrval = typename _Alloc::value_type*; auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); if constexpr (conjunction_v<bool_constant<_Ptr_move_cat<decltype(_UFirst), _Ptrval>::_Really_trivial>, _Uses_default_construct<_Alloc, _Ptrval, decltype(::std:: move(*_UFirst))>>) { if (!::std:: is_constant_evaluated()) { _Copy_memmove(_UFirst, _ULast, _Unfancy(_Dest)); return _Dest + (_ULast - _UFirst); } } _Uninitialized_backout_al<_Alloc> _Backout{_Dest, _Al}; for (; _UFirst != _ULast; ++_UFirst) { _Backout._Emplace_back(::std:: move(*_UFirst)); } return _Backout._Release(); } template <class _Alloc> constexpr _Alloc_ptr_t<_Alloc> _Uninitialized_fill_n( _Alloc_ptr_t<_Alloc> _First, _Alloc_size_t<_Alloc> _Count, const typename _Alloc::value_type& _Val, _Alloc& _Al) { using _Ty = typename _Alloc::value_type; if constexpr (_Fill_memset_is_safe<_Ty*, _Ty> && _Uses_default_construct<_Alloc, _Ty*, _Ty>::value) { if (!::std:: is_constant_evaluated()) { _Fill_memset(_Unfancy(_First), _Val, static_cast<size_t>(_Count)); return _First + _Count; } } else if constexpr (_Fill_zero_memset_is_safe<_Ty*, _Ty> && _Uses_default_construct<_Alloc, _Ty*, _Ty>::value) { if (!::std:: is_constant_evaluated()) { if (_Is_all_bits_zero(_Val)) { _Fill_zero_memset(_Unfancy(_First), static_cast<size_t>(_Count)); return _First + _Count; } } } _Uninitialized_backout_al<_Alloc> _Backout{_First, _Al}; for (; 0 < _Count; --_Count) { _Backout._Emplace_back(_Val); } return _Backout._Release(); } template <class _NoThrowFwdIt, class _Tval> void uninitialized_fill(const _NoThrowFwdIt _First, const _NoThrowFwdIt _Last, const _Tval& _Val) { _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); if constexpr (_Fill_memset_is_safe<_Unwrapped_t<const _NoThrowFwdIt&>, _Tval>) { _Fill_memset(_UFirst, _Val, static_cast<size_t>(_ULast - _UFirst)); } else { if constexpr (_Fill_zero_memset_is_safe<_Unwrapped_t<const _NoThrowFwdIt&>, _Tval>) { if (_Is_all_bits_zero(_Val)) { _Fill_zero_memset(_UFirst, static_cast<size_t>(_ULast - _UFirst)); return; } } _Uninitialized_backout<_Unwrapped_t<const _NoThrowFwdIt&>> _Backout{_UFirst}; while (_Backout._Last != _ULast) { _Backout._Emplace_back(_Val); } _Backout._Release(); } } template <class _NoThrowFwdIt> inline constexpr bool _Use_memset_value_construct_v = conjunction_v<bool_constant<_Iterator_is_contiguous<_NoThrowFwdIt>>, is_scalar<_Iter_value_t<_NoThrowFwdIt>>, negation<is_volatile<remove_reference_t<_Iter_ref_t<_NoThrowFwdIt>>>>, negation<is_member_pointer<_Iter_value_t<_NoThrowFwdIt>>>>; template <class _Ptr> _Ptr _Zero_range(const _Ptr _First, const _Ptr _Last) { char* const _First_ch = reinterpret_cast<char*>(_To_address(_First)); char* const _Last_ch = reinterpret_cast<char*>(_To_address(_Last)); :: memset(_First_ch, 0, static_cast<size_t>(_Last_ch - _First_ch)); return _Last; } template <class _Alloc> constexpr _Alloc_ptr_t<_Alloc> _Uninitialized_value_construct_n( _Alloc_ptr_t<_Alloc> _First, _Alloc_size_t<_Alloc> _Count, _Alloc& _Al) { using _Ptrty = typename _Alloc::value_type*; if constexpr (_Use_memset_value_construct_v<_Ptrty> && _Uses_default_construct<_Alloc, _Ptrty>::value) { if (!::std:: is_constant_evaluated()) { auto _PFirst = _Unfancy(_First); _Zero_range(_PFirst, _PFirst + _Count); return _First + _Count; } } _Uninitialized_backout_al<_Alloc> _Backout{_First, _Al}; for (; 0 < _Count; --_Count) { _Backout._Emplace_back(); } return _Backout._Release(); } template <class _NoThrowFwdIt, class _Diff> _NoThrowFwdIt _Uninitialized_value_construct_n_unchecked1(_NoThrowFwdIt _UFirst, _Diff _Count) { ; if constexpr (_Use_memset_value_construct_v<_NoThrowFwdIt>) { return _Zero_range(_UFirst, _UFirst + _Count); } else { _Uninitialized_backout<_NoThrowFwdIt> _Backout{_UFirst}; for (; 0 < _Count; --_Count) { _Backout._Emplace_back(); } return _Backout._Release(); } } template <class _Key, class... _Args> struct _In_place_key_extract_set { static constexpr bool _Extractable = false; }; template <class _Key> struct _In_place_key_extract_set<_Key, _Key> { static constexpr bool _Extractable = true; static const _Key& _Extract(const _Key& _Val) noexcept { return _Val; } }; template <class _Key, class... _Args> struct _In_place_key_extract_map { static constexpr bool _Extractable = false; }; template <class _Key, class _Second> struct _In_place_key_extract_map<_Key, _Key, _Second> { static constexpr bool _Extractable = true; static const _Key& _Extract(const _Key& _Val, const _Second&) noexcept { return _Val; } }; template <class _Key, class _First, class _Second> struct _In_place_key_extract_map<_Key, pair<_First, _Second>> { static constexpr bool _Extractable = is_same_v<_Key, _Remove_cvref_t<_First>>; static const _Key& _Extract(const pair<_First, _Second>& _Val) { return _Val.first; } }; #pragma warning(push) #pragma warning(disable : 4624) template <class _Ty> struct _Wrap { _Ty _Value; }; #pragma warning(pop) template <class _Alloc> struct _Alloc_temporary { using value_type = typename _Alloc::value_type; using _Traits = allocator_traits<_Alloc>; _Alloc& _Al; union { _Wrap<value_type> _Storage; }; template <class... _Args> explicit _Alloc_temporary(_Alloc& _Al_, _Args&&... _Vals) noexcept( noexcept(_Traits::construct(_Al_, ::std:: addressof(_Storage._Value), ::std:: forward<_Args>(_Vals)...))) : _Al(_Al_) { _Traits::construct(_Al, ::std:: addressof(_Storage._Value), ::std:: forward<_Args>(_Vals)...); } _Alloc_temporary(const _Alloc_temporary&) = delete; _Alloc_temporary& operator=(const _Alloc_temporary&) = delete; ~_Alloc_temporary() { _Traits::destroy(_Al, ::std:: addressof(_Storage._Value)); } }; template <class _Alloc> [[nodiscard]] constexpr bool _Allocators_equal(const _Alloc& _Lhs, const _Alloc& _Rhs) noexcept { if constexpr (allocator_traits<_Alloc>::is_always_equal::value) { return true; } else { return _Lhs == _Rhs; } } template <class _FwdIt, class _Ty> [[nodiscard]] constexpr _FwdIt remove(_FwdIt _First, const _FwdIt _Last, const _Ty& _Val) { _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); _UFirst = _Find_unchecked(_UFirst, _ULast, _Val); auto _UNext = _UFirst; if (_UFirst != _ULast) { while (++_UFirst != _ULast) { if (!(*_UFirst == _Val)) { *_UNext = ::std:: move(*_UFirst); ++_UNext; } } } _Seek_wrapped(_First, _UNext); return _First; } template <class _FwdIt, class _Pr> [[nodiscard]] constexpr _FwdIt remove_if(_FwdIt _First, const _FwdIt _Last, _Pr _Pred) { _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); _UFirst = ::std:: find_if(_UFirst, _ULast, _Pass_fn(_Pred)); auto _UNext = _UFirst; if (_UFirst != _ULast) { while (++_UFirst != _ULast) { if (!_Pred(*_UFirst)) { *_UNext = ::std:: move(*_UFirst); ++_UNext; } } } _Seek_wrapped(_First, _UNext); return _First; } template <class _Container, class _Uty> constexpr typename _Container::size_type _Erase_remove(_Container& _Cont, const _Uty& _Val) { auto _First = _Cont.begin(); const auto _Last = _Cont.end(); const auto _Old_size = _Cont.size(); _Seek_wrapped(_First, ::std:: remove(_Get_unwrapped(_First), _Get_unwrapped(_Last), _Val)); _Cont.erase(_First, _Last); return _Old_size - _Cont.size(); } template <class _Container, class _Pr> constexpr typename _Container::size_type _Erase_remove_if(_Container& _Cont, _Pr _Pred) { auto _First = _Cont.begin(); const auto _Last = _Cont.end(); const auto _Old_size = _Cont.size(); _Seek_wrapped(_First, ::std:: remove_if(_Get_unwrapped(_First), _Get_unwrapped(_Last), _Pred)); _Cont.erase(_First, _Last); return _Old_size - _Cont.size(); } template <class _Container, class _Pr> typename _Container::size_type _Erase_nodes_if(_Container& _Cont, _Pr _Pred) { auto _First = _Cont.begin(); const auto _Last = _Cont.end(); const auto _Old_size = _Cont.size(); while (_First != _Last) { if (_Pred(*_First)) { _First = _Cont.erase(_First); } else { ++_First; } } return _Old_size - _Cont.size(); } template <class _Ty, class _Alloc, class... _Types, enable_if_t<!_Is_specialization_v<_Ty, pair>, int> = 0> [[nodiscard]] constexpr auto uses_allocator_construction_args(const _Alloc& _Al, _Types&&... _Args) noexcept { if constexpr (!uses_allocator_v<_Ty, _Alloc>) { static_assert(is_constructible_v<_Ty, _Types...>, "If uses_allocator_v<T, Alloc> does not hold, T must be constructible from Types..."); (void) _Al; return ::std:: forward_as_tuple(::std:: forward<_Types>(_Args)...); } else if constexpr (is_constructible_v<_Ty, allocator_arg_t, const _Alloc&, _Types...>) { using _ReturnType = tuple<allocator_arg_t, const _Alloc&, _Types&&...>; return _ReturnType{allocator_arg, _Al, ::std:: forward<_Types>(_Args)...}; } else if constexpr (is_constructible_v<_Ty, _Types..., const _Alloc&>) { return ::std:: forward_as_tuple(::std:: forward<_Types>(_Args)..., _Al); } else { static_assert(_Always_false<_Ty>, "T must be constructible from either (allocator_arg_t, const Alloc&, Types...) " "or (Types..., const Alloc&) if uses_allocator_v<T, Alloc> is true"); } } template <class _Ty, class _Alloc, class _Tuple1, class _Tuple2, enable_if_t<_Is_specialization_v<_Ty, pair>, int> = 0> [[nodiscard]] constexpr auto uses_allocator_construction_args( const _Alloc& _Al, piecewise_construct_t, _Tuple1&& _Tup1, _Tuple2&& _Tup2) noexcept { return ::std:: make_tuple(piecewise_construct, ::std:: apply( [&_Al](auto&&... _Tuple_args) { return ::std:: uses_allocator_construction_args<typename _Ty::first_type>( _Al, ::std:: forward<decltype(_Tuple_args)>(_Tuple_args)...); }, ::std:: forward<_Tuple1>(_Tup1)), ::std:: apply( [&_Al](auto&&... _Tuple_args) { return ::std:: uses_allocator_construction_args<typename _Ty::second_type>( _Al, ::std:: forward<decltype(_Tuple_args)>(_Tuple_args)...); }, ::std:: forward<_Tuple2>(_Tup2))); } template <class _Ty, class _Alloc, enable_if_t<_Is_specialization_v<_Ty, pair>, int> = 0> [[nodiscard]] constexpr auto uses_allocator_construction_args(const _Alloc& _Al) noexcept { return ::std:: make_tuple(piecewise_construct, ::std:: uses_allocator_construction_args<typename _Ty::first_type>(_Al), ::std:: uses_allocator_construction_args<typename _Ty::second_type>(_Al)); } template <class _Ty, class _Alloc, class _Uty1, class _Uty2, enable_if_t<_Is_specialization_v<_Ty, pair>, int> = 0> [[nodiscard]] constexpr auto uses_allocator_construction_args(const _Alloc& _Al, _Uty1&& _Val1, _Uty2&& _Val2) noexcept { return ::std:: make_tuple(piecewise_construct, ::std:: uses_allocator_construction_args<typename _Ty::first_type>(_Al, ::std:: forward<_Uty1>(_Val1)), ::std:: uses_allocator_construction_args<typename _Ty::second_type>(_Al, ::std:: forward<_Uty2>(_Val2))); } template <class _Ty, class _Alloc, class _Uty1, class _Uty2, enable_if_t<_Is_specialization_v<_Ty, pair>, int> = 0> [[nodiscard]] constexpr auto uses_allocator_construction_args( const _Alloc& _Al, const pair<_Uty1, _Uty2>& _Pair) noexcept { return ::std:: make_tuple(piecewise_construct, ::std:: uses_allocator_construction_args<typename _Ty::first_type>(_Al, _Pair.first), ::std:: uses_allocator_construction_args<typename _Ty::second_type>(_Al, _Pair.second)); } template <class _Ty, class _Alloc, class _Uty1, class _Uty2, enable_if_t<_Is_specialization_v<_Ty, pair>, int> = 0> [[nodiscard]] constexpr auto uses_allocator_construction_args(const _Alloc& _Al, pair<_Uty1, _Uty2>&& _Pair) noexcept { return ::std:: make_tuple(piecewise_construct, ::std:: uses_allocator_construction_args<typename _Ty::first_type>(_Al, ::std:: move(_Pair).first), ::std:: uses_allocator_construction_args<typename _Ty::second_type>(_Al, ::std:: move(_Pair).second)); } template <class _Ty, class _Alloc, class... _Types> [[nodiscard]] constexpr _Ty make_obj_using_allocator(const _Alloc& _Al, _Types&&... _Args) { return ::std:: make_from_tuple<_Ty>(::std:: uses_allocator_construction_args<_Ty>(_Al, ::std:: forward<_Types>(_Args)...)); } template <class _Ty, class _Alloc, class... _Types> constexpr _Ty* uninitialized_construct_using_allocator(_Ty* _Ptr, const _Alloc& _Al, _Types&&... _Args) { return ::std:: apply( [&](auto&&... _Construct_args) { return ::std:: construct_at(_Ptr, ::std:: forward<decltype(_Construct_args)>(_Construct_args)...); }, ::std:: uses_allocator_construction_args<_Ty>(_Al, ::std:: forward<_Types>(_Args)...)); } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { using streamoff = long long; using streamsize = long long; template <class _Statetype> class fpos { public: fpos(streamoff _Off = 0) : _Myoff(_Off), _Fpos(0), _Mystate() {} fpos(_Statetype _State, fpos_t _Fileposition) : _Myoff(_Fileposition), _Fpos(0), _Mystate(_State) {} [[nodiscard]] _Statetype state() const { return _Mystate; } void state(_Statetype _State) { _Mystate = _State; } operator streamoff() const { return _Myoff + _Fpos; } [[deprecated("warning STL4019: " "The member std::fpos::seekpos() is non-Standard, and is preserved only for compatibility with " "workarounds for old versions of Visual C++. It will be removed in a future release, and in this " "release always returns 0. Please use standards-conforming mechanisms to manipulate fpos, such as " "conversions to and from streamoff, or an integral type, instead. If you are receiving this message " "while compiling Boost.IOStreams, a fix has been submitted upstream to make Boost use " "standards-conforming mechanisms, as it does for other compilers. You can define " "_SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING to acknowledge that you have received this warning, " "or define _REMOVE_FPOS_SEEKPOS to remove std::fpos::seekpos entirely.")]] fpos_t seekpos() const noexcept { return {}; } [[nodiscard]] streamoff operator-(const fpos& _Right) const { return static_cast<streamoff>(*this) - static_cast<streamoff>(_Right); } fpos& operator+=(streamoff _Off) { _Myoff += _Off; return *this; } fpos& operator-=(streamoff _Off) { _Myoff -= _Off; return *this; } [[nodiscard]] fpos operator+(streamoff _Off) const { fpos _Tmp = *this; _Tmp += _Off; return _Tmp; } [[nodiscard]] fpos operator-(streamoff _Off) const { fpos _Tmp = *this; _Tmp -= _Off; return _Tmp; } [[nodiscard]] bool operator==(const fpos& _Right) const { return static_cast<streamoff>(*this) == static_cast<streamoff>(_Right); } template <class _Int, enable_if_t<is_integral_v<_Int>, int> = 0> [[nodiscard]] friend bool operator==(const fpos& _Left, const _Int _Right) { return static_cast<streamoff>(_Left) == _Right; } template <class _Int, enable_if_t<is_integral_v<_Int>, int> = 0> [[nodiscard]] friend bool operator==(const _Int _Left, const fpos& _Right) { return _Left == static_cast<streamoff>(_Right); } [[nodiscard]] bool operator!=(const fpos& _Right) const { return static_cast<streamoff>(*this) != static_cast<streamoff>(_Right); } template <class _Int, enable_if_t<is_integral_v<_Int>, int> = 0> [[nodiscard]] friend bool operator!=(const fpos& _Left, const _Int _Right) { return static_cast<streamoff>(_Left) != _Right; } template <class _Int, enable_if_t<is_integral_v<_Int>, int> = 0> [[nodiscard]] friend bool operator!=(const _Int _Left, const fpos& _Right) { return _Left != static_cast<streamoff>(_Right); } private: streamoff _Myoff; fpos_t _Fpos; _Statetype _Mystate; }; using streampos = fpos<_Mbstatet>; using wstreampos = streampos; class locale; template <class _Facet> const _Facet& __cdecl use_facet(const locale&); template <class _Elem> struct char_traits; template <> struct char_traits<char>; template <> struct char_traits<char8_t>; template <> struct char_traits<char16_t>; template <> struct char_traits<char32_t>; template <> struct char_traits<wchar_t>; template <> struct char_traits<unsigned short>; template <class _Ty> class allocator; class ios_base; template <class _Elem, class _Traits = char_traits<_Elem>> class basic_ios; template <class _Elem, class _Traits = char_traits<_Elem>> class istreambuf_iterator; template <class _Elem, class _Traits = char_traits<_Elem>> class ostreambuf_iterator; template <class _Elem, class _Traits = char_traits<_Elem>> class basic_streambuf; #pragma vtordisp(push, 2) template <class _Elem, class _Traits = char_traits<_Elem>> class basic_istream; template <class _Elem, class _Traits = char_traits<_Elem>> class basic_ostream; #pragma vtordisp(pop) template <class _Elem, class _Traits = char_traits<_Elem>> class basic_iostream; template <class _Elem, class _Traits = char_traits<_Elem>, class _Alloc = allocator<_Elem>> class basic_stringbuf; template <class _Elem, class _Traits = char_traits<_Elem>, class _Alloc = allocator<_Elem>> class basic_istringstream; template <class _Elem, class _Traits = char_traits<_Elem>, class _Alloc = allocator<_Elem>> class basic_ostringstream; template <class _Elem, class _Traits = char_traits<_Elem>, class _Alloc = allocator<_Elem>> class basic_stringstream; template <class _Elem, class _Traits = char_traits<_Elem>> class basic_filebuf; template <class _Elem, class _Traits = char_traits<_Elem>> class basic_ifstream; template <class _Elem, class _Traits = char_traits<_Elem>> class basic_ofstream; template <class _Elem, class _Traits = char_traits<_Elem>> class basic_fstream; template <class _Elem, class _Traits = char_traits<_Elem>> class _Basic_syncbuf_impl; template <class _Elem, class _Traits = char_traits<_Elem>, class _Alloc = allocator<_Elem>> class basic_syncbuf; template <class _Elem, class _Traits = char_traits<_Elem>, class _Alloc = allocator<_Elem>> class basic_osyncstream; template <class _Elem, class _InIt> class num_get; template <class _Elem, class _OutIt> class num_put; template <class _Elem> class collate; using ios = basic_ios<char, char_traits<char>>; using streambuf = basic_streambuf<char, char_traits<char>>; using istream = basic_istream<char, char_traits<char>>; using ostream = basic_ostream<char, char_traits<char>>; using iostream = basic_iostream<char, char_traits<char>>; using stringbuf = basic_stringbuf<char, char_traits<char>, allocator<char>>; using istringstream = basic_istringstream<char, char_traits<char>, allocator<char>>; using ostringstream = basic_ostringstream<char, char_traits<char>, allocator<char>>; using stringstream = basic_stringstream<char, char_traits<char>, allocator<char>>; using filebuf = basic_filebuf<char, char_traits<char>>; using ifstream = basic_ifstream<char, char_traits<char>>; using ofstream = basic_ofstream<char, char_traits<char>>; using fstream = basic_fstream<char, char_traits<char>>; using syncbuf = basic_syncbuf<char>; using osyncstream = basic_osyncstream<char>; using wios = basic_ios<wchar_t, char_traits<wchar_t>>; using wstreambuf = basic_streambuf<wchar_t, char_traits<wchar_t>>; using wistream = basic_istream<wchar_t, char_traits<wchar_t>>; using wostream = basic_ostream<wchar_t, char_traits<wchar_t>>; using wiostream = basic_iostream<wchar_t, char_traits<wchar_t>>; using wstringbuf = basic_stringbuf<wchar_t, char_traits<wchar_t>, allocator<wchar_t>>; using wistringstream = basic_istringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t>>; using wostringstream = basic_ostringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t>>; using wstringstream = basic_stringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t>>; using wfilebuf = basic_filebuf<wchar_t, char_traits<wchar_t>>; using wifstream = basic_ifstream<wchar_t, char_traits<wchar_t>>; using wofstream = basic_ofstream<wchar_t, char_traits<wchar_t>>; using wfstream = basic_fstream<wchar_t, char_traits<wchar_t>>; using wsyncbuf = basic_syncbuf<wchar_t>; using wosyncstream = basic_osyncstream<wchar_t>; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) inline constexpr unsigned long long _Atomic_wait_no_deadline = 0xFFFF'FFFF'FFFF'FFFF; inline constexpr unsigned long _Atomic_wait_no_timeout = 0xFFFF'FFFF; extern "C" { enum class __std_atomic_api_level : unsigned long { __not_set, __detecting, __has_srwlock, __has_wait_on_address, }; __std_atomic_api_level __stdcall __std_atomic_set_api_level(__std_atomic_api_level _Requested_api_level) noexcept; int __stdcall __std_atomic_wait_direct( const void* _Storage, void* _Comparand, size_t _Size, unsigned long _Remaining_timeout) noexcept; void __stdcall __std_atomic_notify_one_direct(const void* _Storage) noexcept; void __stdcall __std_atomic_notify_all_direct(const void* _Storage) noexcept; using _Atomic_wait_indirect_equal_callback_t = bool(__stdcall*)( const void* _Storage, void* _Comparand, size_t _Size, void* _Param) noexcept; int __stdcall __std_atomic_wait_indirect(const void* _Storage, void* _Comparand, size_t _Size, void* _Param, _Atomic_wait_indirect_equal_callback_t _Are_equal, unsigned long _Remaining_timeout) noexcept; void __stdcall __std_atomic_notify_one_indirect(const void* _Storage) noexcept; void __stdcall __std_atomic_notify_all_indirect(const void* _Storage) noexcept; unsigned long long __stdcall __std_atomic_wait_get_deadline(unsigned long long _Timeout) noexcept; unsigned long __stdcall __std_atomic_wait_get_remaining_timeout(unsigned long long _Deadline) noexcept; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { typedef long clock_t; struct _timespec32 { __time32_t tv_sec; long tv_nsec; }; struct _timespec64 { __time64_t tv_sec; long tv_nsec; }; struct timespec { time_t tv_sec; long tv_nsec; }; __declspec(deprecated("This function or variable may be unsafe. Consider using " "_get_daylight" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) int* __cdecl __daylight(void); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_get_dstbias" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) long* __cdecl __dstbias(void); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_get_timezone" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) long* __cdecl __timezone(void); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_get_tzname" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char** __cdecl __tzname(void); __declspec(dllimport) errno_t __cdecl _get_daylight( int* _Daylight ); __declspec(dllimport) errno_t __cdecl _get_dstbias( long* _DaylightSavingsBias ); __declspec(dllimport) errno_t __cdecl _get_timezone( long* _TimeZone ); __declspec(dllimport) errno_t __cdecl _get_tzname( size_t* _ReturnValue, char* _Buffer, size_t _SizeInBytes, int _Index ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "asctime_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl asctime( struct tm const* _Tm ); __declspec(dllimport) errno_t __cdecl asctime_s( char* _Buffer, size_t _SizeInBytes, struct tm const* _Tm ); extern "C++" { template <size_t _Size> inline errno_t __cdecl asctime_s( char (&_Buffer)[_Size], struct tm const* _Time) throw() { return asctime_s(_Buffer, _Size, _Time); } } __declspec(dllimport) clock_t __cdecl clock(void); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_ctime32_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl _ctime32( __time32_t const* _Time ); __declspec(dllimport) errno_t __cdecl _ctime32_s( char* _Buffer, size_t _SizeInBytes, __time32_t const* _Time ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _ctime32_s( char (&_Buffer)[_Size], __time32_t const* _Time) throw() { return _ctime32_s(_Buffer, _Size, _Time); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_ctime64_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl _ctime64( __time64_t const* _Time ); __declspec(dllimport) errno_t __cdecl _ctime64_s( char* _Buffer, size_t _SizeInBytes, __time64_t const* _Time ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _ctime64_s( char (&_Buffer)[_Size], __time64_t const* _Time) throw() { return _ctime64_s(_Buffer, _Size, _Time); } } __declspec(dllimport) double __cdecl _difftime32( __time32_t _Time1, __time32_t _Time2 ); __declspec(dllimport) double __cdecl _difftime64( __time64_t _Time1, __time64_t _Time2 ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_gmtime32_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) struct tm* __cdecl _gmtime32( __time32_t const* _Time ); __declspec(dllimport) errno_t __cdecl _gmtime32_s( struct tm* _Tm, __time32_t const* _Time ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_gmtime64_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) struct tm* __cdecl _gmtime64( __time64_t const* _Time ); __declspec(dllimport) errno_t __cdecl _gmtime64_s( struct tm* _Tm, __time64_t const* _Time ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_localtime32_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) struct tm* __cdecl _localtime32( __time32_t const* _Time ); __declspec(dllimport) errno_t __cdecl _localtime32_s( struct tm* _Tm, __time32_t const* _Time ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "_localtime64_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) struct tm* __cdecl _localtime64( __time64_t const* _Time ); __declspec(dllimport) errno_t __cdecl _localtime64_s( struct tm* _Tm, __time64_t const* _Time ); __declspec(dllimport) __time32_t __cdecl _mkgmtime32( struct tm* _Tm ); __declspec(dllimport) __time64_t __cdecl _mkgmtime64( struct tm* _Tm ); __declspec(dllimport) __time32_t __cdecl _mktime32( struct tm* _Tm ); __declspec(dllimport) __time64_t __cdecl _mktime64( struct tm* _Tm ); __declspec(dllimport) size_t __cdecl strftime( char* _Buffer, size_t _SizeInBytes, char const* _Format, struct tm const* _Tm ); __declspec(dllimport) size_t __cdecl _strftime_l( char* _Buffer, size_t _MaxSize, char const* _Format, struct tm const* _Tm, _locale_t _Locale ); __declspec(dllimport) errno_t __cdecl _strdate_s( char* _Buffer, size_t _SizeInBytes ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _strdate_s( char (&_Buffer)[_Size]) throw() { return _strdate_s(_Buffer, _Size); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_strdate_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl _strdate( char *_Buffer); __declspec(dllimport) errno_t __cdecl _strtime_s( char* _Buffer, size_t _SizeInBytes ); extern "C++" { template <size_t _Size> inline errno_t __cdecl _strtime_s( char (&_Buffer)[_Size]) throw() { return _strtime_s(_Buffer, _Size); } } __declspec(deprecated("This function or variable may be unsafe. Consider using " "_strtime_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __declspec(dllimport) char* __cdecl _strtime( char *_Buffer); __declspec(dllimport) __time32_t __cdecl _time32( __time32_t* _Time ); __declspec(dllimport) __time64_t __cdecl _time64( __time64_t* _Time ); __declspec(dllimport) int __cdecl _timespec32_get( struct _timespec32* _Ts, int _Base ); __declspec(dllimport) int __cdecl _timespec64_get( struct _timespec64* _Ts, int _Base ); __declspec(dllimport) void __cdecl _tzset(void); __declspec(deprecated("This function or variable has been superceded by newer library " "or operating system functionality. Consider using " "GetLocalTime" " " "instead. See online help for details.")) __declspec(dllimport) unsigned __cdecl _getsystime( struct tm* _Tm ); __declspec(deprecated("This function or variable has been superceded by newer library " "or operating system functionality. Consider using " "SetLocalTime" " " "instead. See online help for details.")) __declspec(dllimport) unsigned __cdecl _setsystime( struct tm* _Tm, unsigned _Milliseconds ); __declspec(deprecated("This function or variable may be unsafe. Consider using " "ctime_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) static __inline char* __cdecl ctime( time_t const* const _Time ) { return _ctime64(_Time); } static __inline double __cdecl difftime( time_t const _Time1, time_t const _Time2 ) { return _difftime64(_Time1, _Time2); } __declspec(deprecated("This function or variable may be unsafe. Consider using " "gmtime_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) static __inline struct tm* __cdecl gmtime( time_t const* const _Time) { return _gmtime64(_Time); } __declspec(deprecated("This function or variable may be unsafe. Consider using " "localtime_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) static __inline struct tm* __cdecl localtime( time_t const* const _Time ) { return _localtime64(_Time); } static __inline time_t __cdecl _mkgmtime( struct tm* const _Tm ) { return _mkgmtime64(_Tm); } static __inline time_t __cdecl mktime( struct tm* const _Tm ) { return _mktime64(_Tm); } static __inline time_t __cdecl time( time_t* const _Time ) { return _time64(_Time); } static __inline int __cdecl timespec_get( struct timespec* const _Ts, int const _Base ) { return _timespec64_get((struct _timespec64*)_Ts, _Base); } static __inline errno_t __cdecl ctime_s( char* const _Buffer, size_t const _SizeInBytes, time_t const* const _Time ) { return _ctime64_s(_Buffer, _SizeInBytes, _Time); } static __inline errno_t __cdecl gmtime_s( struct tm* const _Tm, time_t const* const _Time ) { return _gmtime64_s(_Tm, _Time); } static __inline errno_t __cdecl localtime_s( struct tm* const _Tm, time_t const* const _Time ) { return _localtime64_s(_Tm, _Time); } __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_tzset" ". See online help for details.")) __declspec(dllimport) void __cdecl tzset(void); } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { using :: clock_t; using :: size_t; using :: time_t; using :: tm; using :: asctime; using :: clock; using :: ctime; using :: difftime; using :: gmtime; using :: localtime; using :: mktime; using :: strftime; using :: time; using :: timespec; using :: timespec_get; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) extern "C" { struct xtime { __time64_t sec; long nsec; }; int __cdecl xtime_get(xtime*, int); long __cdecl _Xtime_diff_to_millis(const xtime*); long __cdecl _Xtime_diff_to_millis2(const xtime*, const xtime*); long long __cdecl _Xtime_get_ticks(); long long __cdecl _Query_perf_counter(); long long __cdecl _Query_perf_frequency(); } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) extern "C" { using _Thrd_id_t = unsigned int; struct _Thrd_t { void* _Hnd; _Thrd_id_t _Id; }; using _Mtx_t = struct _Mtx_internal_imp_t*; using _Cnd_t = struct _Cnd_internal_imp_t*; enum { _Thrd_success, _Thrd_nomem, _Thrd_timedout, _Thrd_busy, _Thrd_error }; int __cdecl _Thrd_detach(_Thrd_t); int __cdecl _Thrd_join(_Thrd_t, int*); void __cdecl _Thrd_sleep(const xtime*); void __cdecl _Thrd_yield(); unsigned int __cdecl _Thrd_hardware_concurrency(); _Thrd_id_t __cdecl _Thrd_id(); enum { _Mtx_plain = 0x01, _Mtx_try = 0x02, _Mtx_timed = 0x04, _Mtx_recursive = 0x100 }; int __cdecl _Mtx_init(_Mtx_t*, int); void __cdecl _Mtx_destroy(_Mtx_t); void __cdecl _Mtx_init_in_situ(_Mtx_t, int); void __cdecl _Mtx_destroy_in_situ(_Mtx_t); int __cdecl _Mtx_current_owns(_Mtx_t); int __cdecl _Mtx_lock(_Mtx_t); int __cdecl _Mtx_trylock(_Mtx_t); int __cdecl _Mtx_timedlock(_Mtx_t, const xtime*); int __cdecl _Mtx_unlock(_Mtx_t); void* __cdecl _Mtx_getconcrtcs(_Mtx_t); void __cdecl _Mtx_clear_owner(_Mtx_t); void __cdecl _Mtx_reset_owner(_Mtx_t); using _Smtx_t = void*; void __cdecl _Smtx_lock_exclusive(_Smtx_t*); void __cdecl _Smtx_lock_shared(_Smtx_t*); int __cdecl _Smtx_try_lock_exclusive(_Smtx_t*); int __cdecl _Smtx_try_lock_shared(_Smtx_t*); void __cdecl _Smtx_unlock_exclusive(_Smtx_t*); void __cdecl _Smtx_unlock_shared(_Smtx_t*); int __cdecl _Cnd_init(_Cnd_t*); void __cdecl _Cnd_destroy(_Cnd_t); void __cdecl _Cnd_init_in_situ(_Cnd_t); void __cdecl _Cnd_destroy_in_situ(_Cnd_t); int __cdecl _Cnd_wait(_Cnd_t, _Mtx_t); int __cdecl _Cnd_timedwait(_Cnd_t, _Mtx_t, const xtime*); int __cdecl _Cnd_broadcast(_Cnd_t); int __cdecl _Cnd_signal(_Cnd_t); void __cdecl _Cnd_register_at_thread_exit(_Cnd_t, _Mtx_t, int*); void __cdecl _Cnd_unregister_at_thread_exit(_Mtx_t); void __cdecl _Cnd_do_broadcast_at_thread_exit(); } namespace std { enum { _DEVICE_OR_RESOURCE_BUSY, _INVALID_ARGUMENT, _NO_SUCH_PROCESS, _NOT_ENOUGH_MEMORY, _OPERATION_NOT_PERMITTED, _RESOURCE_DEADLOCK_WOULD_OCCUR, _RESOURCE_UNAVAILABLE_TRY_AGAIN }; [[noreturn]] void __cdecl _Throw_C_error(int _Code); [[noreturn]] void __cdecl _Throw_Cpp_error(int _Code); inline int _Check_C_return(int _Res) { if (_Res != _Thrd_success) { _Throw_C_error(_Res); } return _Res; } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) extern "C" [[nodiscard]] unsigned char __stdcall __std_atomic_compare_exchange_128( long long* _Destination, long long _ExchangeHigh, long long _ExchangeLow, long long* _ComparandResult) noexcept; extern "C" [[nodiscard]] char __stdcall __std_atomic_has_cmpxchg16b() noexcept; extern "C" { _Smtx_t* __stdcall __std_atomic_get_mutex(const void* _Key) noexcept; } namespace std { struct _Form_mask_t {}; inline constexpr _Form_mask_t _Form_mask{}; template <class _Ty> struct _Storage_for { alignas(_Ty) unsigned char _Storage[sizeof(_Ty)]; _Storage_for() = default; _Storage_for(const _Storage_for&) = delete; _Storage_for& operator=(const _Storage_for&) = delete; explicit _Storage_for(_Form_mask_t) noexcept { :: memset(_Storage, 0xff, sizeof(_Ty)); __builtin_zero_non_value_bits(_Ptr()); } [[nodiscard]] _Ty& _Ref() noexcept { return reinterpret_cast<_Ty&>(_Storage); } [[nodiscard]] _Ty* _Ptr() noexcept { return reinterpret_cast<_Ty*>(&_Storage); } }; template <class _Ty> inline constexpr bool _Might_have_non_value_bits = !has_unique_object_representations_v<_Ty> && !is_floating_point_v<_Ty>; extern "C" inline void atomic_thread_fence(const memory_order _Order) noexcept { if (_Order == memory_order_relaxed) { return; } __pragma(warning(push)) __pragma(warning(disable : 4996)) _ReadWriteBarrier() __pragma(warning(pop)); if (_Order == memory_order_seq_cst) { volatile long _Guard; #pragma warning(suppress : 6001) #pragma warning(suppress : 28113) (void) _InterlockedIncrement(&_Guard); __pragma(warning(push)) __pragma(warning(disable : 4996)) _ReadWriteBarrier() __pragma(warning(pop)); } } extern "C" inline void atomic_signal_fence(const memory_order _Order) noexcept { if (_Order != memory_order_relaxed) { __pragma(warning(push)) __pragma(warning(disable : 4996)) _ReadWriteBarrier() __pragma(warning(pop)); } } template <class _Ty> _Ty kill_dependency(_Ty _Arg) noexcept { return _Arg; } inline void _Check_memory_order(const memory_order _Order) noexcept { if (static_cast<unsigned int>(_Order) > static_cast<unsigned int>(memory_order_seq_cst)) { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\atomic", 292, 0, "%s", "Invalid memory order")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"Invalid memory order\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\atomic", 292, 0); } while (false); } } inline void _Check_store_memory_order(const memory_order _Order) noexcept { switch (_Order) { case memory_order_relaxed: case memory_order_release: case memory_order_seq_cst: break; case memory_order_consume: case memory_order_acquire: case memory_order_acq_rel: default: do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\atomic", 308, 0, "%s", "Invalid memory order")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"Invalid memory order\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\atomic", 308, 0); } while (false); break; } } inline void _Check_load_memory_order(const memory_order _Order) noexcept { switch (_Order) { case memory_order_relaxed: case memory_order_consume: case memory_order_acquire: case memory_order_seq_cst: break; case memory_order_release: case memory_order_acq_rel: default: do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\atomic", 325, 0, "%s", "Invalid memory order")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"Invalid memory order\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\atomic", 325, 0); } while (false); break; } } [[nodiscard]] inline memory_order _Combine_cas_memory_orders( const memory_order _Success, const memory_order _Failure) noexcept { static constexpr memory_order _Combined_memory_orders[6][6] = { {memory_order_relaxed, memory_order_consume, memory_order_acquire, memory_order_release, memory_order_acq_rel, memory_order_seq_cst}, {memory_order_consume, memory_order_consume, memory_order_acquire, memory_order_acq_rel, memory_order_acq_rel, memory_order_seq_cst}, {memory_order_acquire, memory_order_acquire, memory_order_acquire, memory_order_acq_rel, memory_order_acq_rel, memory_order_seq_cst}, {memory_order_release, memory_order_acq_rel, memory_order_acq_rel, memory_order_release, memory_order_acq_rel, memory_order_seq_cst}, {memory_order_acq_rel, memory_order_acq_rel, memory_order_acq_rel, memory_order_acq_rel, memory_order_acq_rel, memory_order_seq_cst}, {memory_order_seq_cst, memory_order_seq_cst, memory_order_seq_cst, memory_order_seq_cst, memory_order_seq_cst, memory_order_seq_cst}}; _Check_memory_order(_Success); _Check_load_memory_order(_Failure); return _Combined_memory_orders[static_cast<int>(_Success)][static_cast<int>(_Failure)]; } template <class _Integral, class _Ty> [[nodiscard]] _Integral _Atomic_reinterpret_as(const _Ty& _Source) noexcept { static_assert(is_integral_v<_Integral>, "Tried to reinterpret memory as non-integral"); if constexpr (is_integral_v<_Ty> && sizeof(_Integral) == sizeof(_Ty)) { return static_cast<_Integral>(_Source); } else if constexpr (is_pointer_v<_Ty> && sizeof(_Integral) == sizeof(_Ty)) { return reinterpret_cast<_Integral>(_Source); } else { _Integral _Result{}; :: memcpy(&_Result, ::std:: addressof(_Source), sizeof(_Source)); return _Result; } } inline void _Load_barrier(const memory_order _Order) noexcept { switch (_Order) { case memory_order_relaxed: break; default: case memory_order_release: case memory_order_acq_rel: do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\atomic", 388, 0, "%s", "Invalid memory order")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"Invalid memory order\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\atomic", 388, 0); } while (false); case memory_order_consume: case memory_order_acquire: case memory_order_seq_cst: __pragma(warning(push)) __pragma(warning(disable : 4996)) _ReadWriteBarrier() __pragma(warning(pop)); break; } } template <class _Ty> struct _Atomic_padded { alignas(sizeof(_Ty)) mutable _Ty _Value; }; template <class _Ty> struct _Atomic_storage_types { using _TStorage = _Atomic_padded<_Ty>; using _Spinlock = long; }; template <class _Ty> struct _Atomic_storage_types<_Ty&> { using _TStorage = _Ty&; using _Spinlock = _Smtx_t*; }; template <class _Ty, size_t = sizeof(remove_reference_t<_Ty>)> struct _Atomic_storage; template <class _Ty, class _Value_type> void _Atomic_wait_direct( const _Atomic_storage<_Ty>* const _This, _Value_type _Expected_bytes, const memory_order _Order) noexcept { const auto _Storage_ptr = ::std:: addressof(_This->_Storage); for (;;) { const _Value_type _Observed_bytes = _Atomic_reinterpret_as<_Value_type>(_This->load(_Order)); if (_Expected_bytes != _Observed_bytes) { using _TVal = remove_reference_t<_Ty>; if constexpr (_Might_have_non_value_bits<_TVal>) { _Storage_for<_TVal> _Mask{_Form_mask}; const _Value_type _Mask_val = _Atomic_reinterpret_as<_Value_type>(_Mask._Ref()); if (((_Expected_bytes ^ _Observed_bytes) & _Mask_val) == 0) { _Expected_bytes = _Observed_bytes; continue; } } return; } __std_atomic_wait_direct(_Storage_ptr, &_Expected_bytes, sizeof(_Value_type), _Atomic_wait_no_timeout); } } inline void _Atomic_lock_acquire(long& _Spinlock) noexcept { int _Current_backoff = 1; const int _Max_backoff = 64; while (_InterlockedExchange(&_Spinlock, 1) != 0) { while (__iso_volatile_load32(&reinterpret_cast<int&>(_Spinlock)) != 0) { for (int _Count_down = _Current_backoff; _Count_down != 0; --_Count_down) { _mm_pause(); } _Current_backoff = _Current_backoff < _Max_backoff ? _Current_backoff << 1 : _Max_backoff; } } } inline void _Atomic_lock_release(long& _Spinlock) noexcept { _InterlockedExchange(&_Spinlock, 0); } inline void _Atomic_lock_acquire(_Smtx_t* _Spinlock) noexcept { _Smtx_lock_exclusive(_Spinlock); } inline void _Atomic_lock_release(_Smtx_t* _Spinlock) noexcept { _Smtx_unlock_exclusive(_Spinlock); } template <class _Spinlock_t> class [[nodiscard]] _Atomic_lock_guard { public: explicit _Atomic_lock_guard(_Spinlock_t& _Spinlock_) noexcept : _Spinlock(_Spinlock_) { _Atomic_lock_acquire(_Spinlock); } ~_Atomic_lock_guard() { _Atomic_lock_release(_Spinlock); } _Atomic_lock_guard(const _Atomic_lock_guard&) = delete; _Atomic_lock_guard& operator=(const _Atomic_lock_guard&) = delete; private: _Spinlock_t& _Spinlock; }; template <class _Spinlock_t> bool __stdcall _Atomic_wait_compare_non_lock_free( const void* _Storage, void* _Comparand, size_t _Size, void* _Spinlock_raw) noexcept { _Spinlock_t& _Spinlock = *static_cast<_Spinlock_t*>(_Spinlock_raw); _Atomic_lock_acquire(_Spinlock); const auto _Cmp_result = :: memcmp(_Storage, _Comparand, _Size); _Atomic_lock_release(_Spinlock); return _Cmp_result == 0; } inline bool __stdcall _Atomic_wait_compare_16_bytes(const void* _Storage, void* _Comparand, size_t, void*) noexcept { const auto _Dest = static_cast<long long*>(const_cast<void*>(_Storage)); const auto _Cmp = static_cast<const long long*>(_Comparand); alignas(16) long long _Tmp[2] = {_Cmp[0], _Cmp[1]}; return __std_atomic_compare_exchange_128(_Dest, _Tmp[1], _Tmp[0], _Tmp) != 0; } template <class _Ty, size_t > struct _Atomic_storage { using _TVal = remove_reference_t<_Ty>; using _Guard = _Atomic_lock_guard<typename _Atomic_storage_types<_Ty>::_Spinlock>; _Atomic_storage() = default; constexpr _Atomic_storage(conditional_t<is_reference_v<_Ty>, _Ty, const _TVal> _Value) noexcept : _Storage(_Value) { } void store(const _TVal _Value, const memory_order _Order = memory_order_seq_cst) noexcept { _Check_store_memory_order(_Order); _Guard _Lock{_Spinlock}; _Storage = _Value; } [[nodiscard]] _TVal load(const memory_order _Order = memory_order_seq_cst) const noexcept { _Check_load_memory_order(_Order); _Guard _Lock{_Spinlock}; _TVal _Local(_Storage); return _Local; } _TVal exchange(const _TVal _Value, const memory_order _Order = memory_order_seq_cst) noexcept { _Check_memory_order(_Order); _Guard _Lock{_Spinlock}; _TVal _Result(_Storage); _Storage = _Value; return _Result; } bool compare_exchange_strong(_TVal& _Expected, const _TVal _Desired, const memory_order _Order = memory_order_seq_cst) noexcept { _Check_memory_order(_Order); const auto _Storage_ptr = ::std:: addressof(_Storage); const auto _Expected_ptr = ::std:: addressof(_Expected); bool _Result; __builtin_zero_non_value_bits(_Expected_ptr); _Guard _Lock{_Spinlock}; if constexpr (_Might_have_non_value_bits<_TVal>) { _Storage_for<_TVal> _Local; const auto _Local_ptr = _Local._Ptr(); :: memcpy(_Local_ptr, _Storage_ptr, sizeof(_TVal)); __builtin_zero_non_value_bits(_Local_ptr); _Result = :: memcmp(_Local_ptr, _Expected_ptr, sizeof(_TVal)) == 0; } else { _Result = :: memcmp(_Storage_ptr, _Expected_ptr, sizeof(_TVal)) == 0; } if (_Result) { :: memcpy(_Storage_ptr, ::std:: addressof(_Desired), sizeof(_TVal)); } else { :: memcpy(_Expected_ptr, _Storage_ptr, sizeof(_TVal)); } return _Result; } void wait(_TVal _Expected, memory_order = memory_order_seq_cst) const noexcept { const auto _Storage_ptr = ::std:: addressof(_Storage); const auto _Expected_ptr = ::std:: addressof(_Expected); for (;;) { { _Guard _Lock{_Spinlock}; if (:: memcmp(_Storage_ptr, _Expected_ptr, sizeof(_TVal)) != 0) { if constexpr (_Might_have_non_value_bits<_TVal>) { _Storage_for<_TVal> _Local; const auto _Local_ptr = _Local._Ptr(); :: memcpy(_Local_ptr, _Storage_ptr, sizeof(_TVal)); __builtin_zero_non_value_bits(_Local_ptr); __builtin_zero_non_value_bits(_Expected_ptr); if (:: memcmp(_Local_ptr, _Expected_ptr, sizeof(_TVal)) == 0) { :: memcpy(_Expected_ptr, _Storage_ptr, sizeof(_TVal)); } else { return; } } else { return; } } } __std_atomic_wait_indirect(_Storage_ptr, _Expected_ptr, sizeof(_TVal), &_Spinlock, &_Atomic_wait_compare_non_lock_free<decltype(_Spinlock)>, _Atomic_wait_no_timeout); } } void notify_one() noexcept { __std_atomic_notify_one_indirect(::std:: addressof(_Storage)); } void notify_all() noexcept { __std_atomic_notify_all_indirect(::std:: addressof(_Storage)); } protected: void _Init_spinlock_for_ref() noexcept { _Spinlock = __std_atomic_get_mutex(::std:: addressof(_Storage)); } private: mutable typename _Atomic_storage_types<_Ty>::_Spinlock _Spinlock{}; public: _Ty _Storage{}; }; template <class _Ty> struct _Atomic_storage<_Ty, 1> { using _TVal = remove_reference_t<_Ty>; _Atomic_storage() = default; constexpr _Atomic_storage(conditional_t<is_reference_v<_Ty>, _Ty, const _TVal> _Value) noexcept : _Storage{_Value} { } void store(const _TVal _Value) noexcept { const auto _Mem = _Atomic_address_as<char>(_Storage); const char _As_bytes = _Atomic_reinterpret_as<char>(_Value); (void) _InterlockedExchange8(_Mem, _As_bytes); } void store(const _TVal _Value, const memory_order _Order) noexcept { const auto _Mem = _Atomic_address_as<char>(_Storage); const char _As_bytes = _Atomic_reinterpret_as<char>(_Value); switch (_Order) { case memory_order_relaxed: __iso_volatile_store8(_Mem, _As_bytes); return; case memory_order_release: __pragma(warning(push)) __pragma(warning(disable : 4996)) _ReadWriteBarrier() __pragma(warning(pop)); __iso_volatile_store8(_Mem, _As_bytes); return; default: case memory_order_consume: case memory_order_acquire: case memory_order_acq_rel: do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\atomic", 761, 0, "%s", "Invalid memory order")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"Invalid memory order\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\atomic", 761, 0); } while (false); case memory_order_seq_cst: store(_Value); return; } } [[nodiscard]] _TVal load() const noexcept { const auto _Mem = _Atomic_address_as<char>(_Storage); char _As_bytes = __iso_volatile_load8(_Mem); __pragma(warning(push)) __pragma(warning(disable : 4996)) _ReadWriteBarrier() __pragma(warning(pop)); return reinterpret_cast<_TVal&>(_As_bytes); } [[nodiscard]] _TVal load(const memory_order _Order) const noexcept { const auto _Mem = _Atomic_address_as<char>(_Storage); char _As_bytes = __iso_volatile_load8(_Mem); _Load_barrier(_Order); return reinterpret_cast<_TVal&>(_As_bytes); } _TVal exchange(const _TVal _Value, const memory_order _Order = memory_order_seq_cst) noexcept { char _As_bytes; _Check_memory_order(_Order); _As_bytes = _InterlockedExchange8(_Atomic_address_as<char>(_Storage), _Atomic_reinterpret_as<char>(_Value)); return reinterpret_cast<_TVal&>(_As_bytes); } bool compare_exchange_strong(_TVal& _Expected, const _TVal _Desired, const memory_order _Order = memory_order_seq_cst) noexcept { char _Expected_bytes = _Atomic_reinterpret_as<char>(_Expected); char _Prev_bytes; if constexpr (_Might_have_non_value_bits<_TVal>) { _Storage_for<_TVal> _Mask{_Form_mask}; const char _Mask_val = _Atomic_reinterpret_as<char>(_Mask._Ref()); for (;;) { _Check_memory_order(_Order); _Prev_bytes = _InterlockedCompareExchange8(_Atomic_address_as<char>(_Storage), _Atomic_reinterpret_as<char>(_Desired), _Expected_bytes); if (_Prev_bytes == _Expected_bytes) { return true; } if ((_Prev_bytes ^ _Expected_bytes) & _Mask_val) { reinterpret_cast<char&>(_Expected) = _Prev_bytes; return false; } _Expected_bytes = (_Expected_bytes & _Mask_val) | (_Prev_bytes & ~_Mask_val); } } _Check_memory_order(_Order); _Prev_bytes = _InterlockedCompareExchange8(_Atomic_address_as<char>(_Storage), _Atomic_reinterpret_as<char>(_Desired), _Expected_bytes); if (_Prev_bytes == _Expected_bytes) { return true; } reinterpret_cast<char&>(_Expected) = _Prev_bytes; return false; } void wait(const _TVal _Expected, const memory_order _Order = memory_order_seq_cst) const noexcept { _Atomic_wait_direct(this, _Atomic_reinterpret_as<char>(_Expected), _Order); } void notify_one() noexcept { __std_atomic_notify_one_direct(::std:: addressof(_Storage)); } void notify_all() noexcept { __std_atomic_notify_all_direct(::std:: addressof(_Storage)); } typename _Atomic_storage_types<_Ty>::_TStorage _Storage; }; template <class _Ty> struct _Atomic_storage<_Ty, 2> { using _TVal = remove_reference_t<_Ty>; _Atomic_storage() = default; constexpr _Atomic_storage(conditional_t<is_reference_v<_Ty>, _Ty, const _TVal> _Value) noexcept : _Storage{_Value} { } void store(const _TVal _Value) noexcept { const auto _Mem = _Atomic_address_as<short>(_Storage); const short _As_bytes = _Atomic_reinterpret_as<short>(_Value); (void) _InterlockedExchange16(_Mem, _As_bytes); } void store(const _TVal _Value, const memory_order _Order) noexcept { const auto _Mem = _Atomic_address_as<short>(_Storage); const short _As_bytes = _Atomic_reinterpret_as<short>(_Value); switch (_Order) { case memory_order_relaxed: __iso_volatile_store16(_Mem, _As_bytes); return; case memory_order_release: __pragma(warning(push)) __pragma(warning(disable : 4996)) _ReadWriteBarrier() __pragma(warning(pop)); __iso_volatile_store16(_Mem, _As_bytes); return; default: case memory_order_consume: case memory_order_acquire: case memory_order_acq_rel: do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\atomic", 882, 0, "%s", "Invalid memory order")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"Invalid memory order\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\atomic", 882, 0); } while (false); case memory_order_seq_cst: store(_Value); return; } } [[nodiscard]] _TVal load() const noexcept { const auto _Mem = _Atomic_address_as<short>(_Storage); short _As_bytes = __iso_volatile_load16(_Mem); __pragma(warning(push)) __pragma(warning(disable : 4996)) _ReadWriteBarrier() __pragma(warning(pop)); return reinterpret_cast<_TVal&>(_As_bytes); } [[nodiscard]] _TVal load(const memory_order _Order) const noexcept { const auto _Mem = _Atomic_address_as<short>(_Storage); short _As_bytes = __iso_volatile_load16(_Mem); _Load_barrier(_Order); return reinterpret_cast<_TVal&>(_As_bytes); } _TVal exchange(const _TVal _Value, const memory_order _Order = memory_order_seq_cst) noexcept { short _As_bytes; _Check_memory_order(_Order); _As_bytes = _InterlockedExchange16(_Atomic_address_as<short>(_Storage), _Atomic_reinterpret_as<short>(_Value)); return reinterpret_cast<_TVal&>(_As_bytes); } bool compare_exchange_strong(_TVal& _Expected, const _TVal _Desired, const memory_order _Order = memory_order_seq_cst) noexcept { short _Expected_bytes = _Atomic_reinterpret_as<short>(_Expected); short _Prev_bytes; if constexpr (_Might_have_non_value_bits<_Ty>) { _Storage_for<_TVal> _Mask{_Form_mask}; const short _Mask_val = _Atomic_reinterpret_as<short>(_Mask._Ref()); for (;;) { _Check_memory_order(_Order); _Prev_bytes = _InterlockedCompareExchange16(_Atomic_address_as<short>(_Storage), _Atomic_reinterpret_as<short>(_Desired), _Expected_bytes); if (_Prev_bytes == _Expected_bytes) { return true; } if ((_Prev_bytes ^ _Expected_bytes) & _Mask_val) { :: memcpy(::std:: addressof(_Expected), &_Prev_bytes, sizeof(_TVal)); return false; } _Expected_bytes = (_Expected_bytes & _Mask_val) | (_Prev_bytes & ~_Mask_val); } } _Check_memory_order(_Order); _Prev_bytes = _InterlockedCompareExchange16(_Atomic_address_as<short>(_Storage), _Atomic_reinterpret_as<short>(_Desired), _Expected_bytes); if (_Prev_bytes == _Expected_bytes) { return true; } :: memcpy(::std:: addressof(_Expected), &_Prev_bytes, sizeof(_Ty)); return false; } void wait(const _TVal _Expected, const memory_order _Order = memory_order_seq_cst) const noexcept { _Atomic_wait_direct(this, _Atomic_reinterpret_as<short>(_Expected), _Order); } void notify_one() noexcept { __std_atomic_notify_one_direct(::std:: addressof(_Storage)); } void notify_all() noexcept { __std_atomic_notify_all_direct(::std:: addressof(_Storage)); } typename _Atomic_storage_types<_Ty>::_TStorage _Storage; }; template <class _Ty> struct _Atomic_storage<_Ty, 4> { using _TVal = remove_reference_t<_Ty>; _Atomic_storage() = default; constexpr _Atomic_storage(conditional_t<is_reference_v<_Ty>, _Ty, const _TVal> _Value) noexcept : _Storage{_Value} { } void store(const _TVal _Value) noexcept { (void) _InterlockedExchange(_Atomic_address_as<long>(_Storage), _Atomic_reinterpret_as<long>(_Value)); } void store(const _TVal _Value, const memory_order _Order) noexcept { const auto _Mem = _Atomic_address_as<int>(_Storage); const int _As_bytes = _Atomic_reinterpret_as<int>(_Value); switch (_Order) { case memory_order_relaxed: __iso_volatile_store32(_Mem, _As_bytes); return; case memory_order_release: __pragma(warning(push)) __pragma(warning(disable : 4996)) _ReadWriteBarrier() __pragma(warning(pop)); __iso_volatile_store32(_Mem, _As_bytes); return; default: case memory_order_consume: case memory_order_acquire: case memory_order_acq_rel: do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\atomic", 1000, 0, "%s", "Invalid memory order")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"Invalid memory order\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\atomic", 1000, 0); } while (false); case memory_order_seq_cst: store(_Value); return; } } [[nodiscard]] _TVal load() const noexcept { const auto _Mem = _Atomic_address_as<int>(_Storage); auto _As_bytes = __iso_volatile_load32(_Mem); __pragma(warning(push)) __pragma(warning(disable : 4996)) _ReadWriteBarrier() __pragma(warning(pop)); return reinterpret_cast<_TVal&>(_As_bytes); } [[nodiscard]] _TVal load(const memory_order _Order) const noexcept { const auto _Mem = _Atomic_address_as<int>(_Storage); auto _As_bytes = __iso_volatile_load32(_Mem); _Load_barrier(_Order); return reinterpret_cast<_TVal&>(_As_bytes); } _TVal exchange(const _TVal _Value, const memory_order _Order = memory_order_seq_cst) noexcept { long _As_bytes; _Check_memory_order(_Order); _As_bytes = _InterlockedExchange(_Atomic_address_as<long>(_Storage), _Atomic_reinterpret_as<long>(_Value)); return reinterpret_cast<_TVal&>(_As_bytes); } bool compare_exchange_strong(_TVal& _Expected, const _TVal _Desired, const memory_order _Order = memory_order_seq_cst) noexcept { long _Expected_bytes = _Atomic_reinterpret_as<long>(_Expected); long _Prev_bytes; if constexpr (_Might_have_non_value_bits<_TVal>) { _Storage_for<_TVal> _Mask{_Form_mask}; const long _Mask_val = _Atomic_reinterpret_as<long>(_Mask); for (;;) { _Check_memory_order(_Order); _Prev_bytes = _InterlockedCompareExchange(_Atomic_address_as<long>(_Storage), _Atomic_reinterpret_as<long>(_Desired), _Expected_bytes); if (_Prev_bytes == _Expected_bytes) { return true; } if ((_Prev_bytes ^ _Expected_bytes) & _Mask_val) { :: memcpy(::std:: addressof(_Expected), &_Prev_bytes, sizeof(_TVal)); return false; } _Expected_bytes = (_Expected_bytes & _Mask_val) | (_Prev_bytes & ~_Mask_val); } } _Check_memory_order(_Order); _Prev_bytes = _InterlockedCompareExchange(_Atomic_address_as<long>(_Storage), _Atomic_reinterpret_as<long>(_Desired), _Expected_bytes); if (_Prev_bytes == _Expected_bytes) { return true; } :: memcpy(::std:: addressof(_Expected), &_Prev_bytes, sizeof(_TVal)); return false; } void wait(const _TVal _Expected, const memory_order _Order = memory_order_seq_cst) const noexcept { _Atomic_wait_direct(this, _Atomic_reinterpret_as<long>(_Expected), _Order); } void notify_one() noexcept { __std_atomic_notify_one_direct(::std:: addressof(_Storage)); } void notify_all() noexcept { __std_atomic_notify_all_direct(::std:: addressof(_Storage)); } typename _Atomic_storage_types<_Ty>::_TStorage _Storage; }; template <class _Ty> struct _Atomic_storage<_Ty, 8> { using _TVal = remove_reference_t<_Ty>; _Atomic_storage() = default; constexpr _Atomic_storage(conditional_t<is_reference_v<_Ty>, _Ty, const _TVal> _Value) noexcept : _Storage{_Value} { } void store(const _TVal _Value) noexcept { const auto _Mem = _Atomic_address_as<long long>(_Storage); const long long _As_bytes = _Atomic_reinterpret_as<long long>(_Value); (void) _InterlockedExchange64(_Mem, _As_bytes); } void store(const _TVal _Value, const memory_order _Order) noexcept { const auto _Mem = _Atomic_address_as<long long>(_Storage); const long long _As_bytes = _Atomic_reinterpret_as<long long>(_Value); switch (_Order) { case memory_order_relaxed: __iso_volatile_store64(_Mem, _As_bytes); return; case memory_order_release: __pragma(warning(push)) __pragma(warning(disable : 4996)) _ReadWriteBarrier() __pragma(warning(pop)); __iso_volatile_store64(_Mem, _As_bytes); return; default: case memory_order_consume: case memory_order_acquire: case memory_order_acq_rel: do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\atomic", 1124, 0, "%s", "Invalid memory order")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"Invalid memory order\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\atomic", 1124, 0); } while (false); case memory_order_seq_cst: store(_Value); return; } } [[nodiscard]] _TVal load() const noexcept { const auto _Mem = _Atomic_address_as<long long>(_Storage); long long _As_bytes; _As_bytes = __iso_volatile_load64(_Mem); __pragma(warning(push)) __pragma(warning(disable : 4996)) _ReadWriteBarrier() __pragma(warning(pop)); return reinterpret_cast<_TVal&>(_As_bytes); } [[nodiscard]] _TVal load(const memory_order _Order) const noexcept { const auto _Mem = _Atomic_address_as<long long>(_Storage); long long _As_bytes = __iso_volatile_load64(_Mem); _Load_barrier(_Order); return reinterpret_cast<_TVal&>(_As_bytes); } _TVal exchange(const _TVal _Value, const memory_order _Order = memory_order_seq_cst) noexcept { long long _As_bytes; _Check_memory_order(_Order); _As_bytes = _InterlockedExchange64(_Atomic_address_as<long long>(_Storage), _Atomic_reinterpret_as<long long>(_Value)); return reinterpret_cast<_TVal&>(_As_bytes); } bool compare_exchange_strong(_TVal& _Expected, const _TVal _Desired, const memory_order _Order = memory_order_seq_cst) noexcept { long long _Expected_bytes = _Atomic_reinterpret_as<long long>(_Expected); long long _Prev_bytes; if constexpr (_Might_have_non_value_bits<_TVal>) { _Storage_for<_TVal> _Mask{_Form_mask}; const long long _Mask_val = _Atomic_reinterpret_as<long long>(_Mask); for (;;) { _Check_memory_order(_Order); _Prev_bytes = _InterlockedCompareExchange64(_Atomic_address_as<long long>(_Storage), _Atomic_reinterpret_as<long long>(_Desired), _Expected_bytes); if (_Prev_bytes == _Expected_bytes) { return true; } if ((_Prev_bytes ^ _Expected_bytes) & _Mask_val) { :: memcpy(::std:: addressof(_Expected), &_Prev_bytes, sizeof(_TVal)); return false; } _Expected_bytes = (_Expected_bytes & _Mask_val) | (_Prev_bytes & ~_Mask_val); } } _Check_memory_order(_Order); _Prev_bytes = _InterlockedCompareExchange64(_Atomic_address_as<long long>(_Storage), _Atomic_reinterpret_as<long long>(_Desired), _Expected_bytes); if (_Prev_bytes == _Expected_bytes) { return true; } :: memcpy(::std:: addressof(_Expected), &_Prev_bytes, sizeof(_TVal)); return false; } void wait(const _TVal _Expected, const memory_order _Order = memory_order_seq_cst) const noexcept { _Atomic_wait_direct(this, _Atomic_reinterpret_as<long long>(_Expected), _Order); } void notify_one() noexcept { __std_atomic_notify_one_direct(::std:: addressof(_Storage)); } void notify_all() noexcept { __std_atomic_notify_all_direct(::std:: addressof(_Storage)); } typename _Atomic_storage_types<_Ty>::_TStorage _Storage; }; template <class _Ty> struct _Atomic_storage<_Ty&, 16> { using _TVal = remove_reference_t<_Ty&>; _Atomic_storage() = default; constexpr _Atomic_storage(conditional_t<is_reference_v<_Ty&>, _Ty&, const _TVal> _Value) noexcept : _Storage{_Value} {} void store(const _TVal _Value) noexcept { (void) exchange(_Value); } void store(const _TVal _Value, const memory_order _Order) noexcept { _Check_store_memory_order(_Order); (void) exchange(_Value, _Order); } [[nodiscard]] _TVal load() const noexcept { long long* const _Storage_ptr = const_cast<long long*>(_Atomic_address_as<const long long>(_Storage)); _Int128 _Result{}; (void) __std_atomic_compare_exchange_128(_Storage_ptr, 0, 0, &_Result._Low); return reinterpret_cast<_TVal&>(_Result); } [[nodiscard]] _TVal load(const memory_order _Order) const noexcept { _Check_load_memory_order(_Order); return load(); } _TVal exchange(const _TVal _Value) noexcept { _TVal _Result{_Value}; while (!compare_exchange_strong(_Result, _Value)) { } return _Result; } _TVal exchange(const _TVal _Value, const memory_order _Order) noexcept { _TVal _Result{_Value}; while (!compare_exchange_strong(_Result, _Value, _Order)) { } return _Result; } bool compare_exchange_strong(_TVal& _Expected, const _TVal _Desired, const memory_order _Order = memory_order_seq_cst) noexcept { _Int128 _Desired_bytes{}; :: memcpy(&_Desired_bytes, ::std:: addressof(_Desired), sizeof(_TVal)); _Int128 _Expected_temp{}; :: memcpy(&_Expected_temp, ::std:: addressof(_Expected), sizeof(_TVal)); unsigned char _Result; if constexpr (_Might_have_non_value_bits<_TVal>) { _Int128 _Expected_originally{}; :: memcpy(&_Expected_originally, ::std:: addressof(_Expected), sizeof(_TVal)); _Storage_for<_TVal> _Mask{_Form_mask}; _Int128 _Mask_val{}; :: memcpy(&_Mask_val, _Mask._Ptr(), sizeof(_TVal)); for (;;) { (void) _Order; _Result = __std_atomic_compare_exchange_128(&reinterpret_cast<long long&>(_Storage), _Desired_bytes._High, _Desired_bytes._Low, &_Expected_temp._Low); if (_Result) { return true; } if (((_Expected_temp._Low ^ _Expected_originally._Low) & _Mask_val._Low) != 0 || ((_Expected_temp._High ^ _Expected_originally._High) & _Mask_val._High) != 0) { :: memcpy(::std:: addressof(_Expected), &_Expected_temp, sizeof(_TVal)); return false; } _Expected_temp._Low = (_Expected_originally._Low & _Mask_val._Low) | (_Expected_temp._Low & ~_Mask_val._Low); _Expected_temp._High = (_Expected_originally._High & _Mask_val._High) | (_Expected_temp._High & ~_Mask_val._High); } } (void) _Order; _Result = __std_atomic_compare_exchange_128( &reinterpret_cast<long long&>(_Storage), _Desired_bytes._High, _Desired_bytes._Low, &_Expected_temp._Low); if (_Result == 0) { :: memcpy(::std:: addressof(_Expected), &_Expected_temp, sizeof(_TVal)); } return _Result != 0; } void wait(_TVal _Expected, memory_order _Order = memory_order_seq_cst) const noexcept { const auto _Storage_ptr = ::std:: addressof(_Storage); const auto _Expected_ptr = ::std:: addressof(_Expected); _Int128 _Expected_bytes = reinterpret_cast<const _Int128&>(_Expected); for (;;) { const _TVal _Observed = load(_Order); _Int128 _Observed_bytes = reinterpret_cast<const _Int128&>(_Observed); if (_Observed_bytes._Low != _Expected_bytes._Low || _Observed_bytes._High != _Expected_bytes._High) { if constexpr (_Might_have_non_value_bits<_TVal>) { _Storage_for<_TVal> _Mask{_Form_mask}; const _Int128 _Mask_val = reinterpret_cast<const _Int128&>(_Mask._Ref()); if (((_Expected_bytes._Low ^ _Observed_bytes._Low) & _Mask_val._Low) == 0 && ((_Expected_bytes._High ^ _Observed_bytes._High) & _Mask_val._High) == 0) { _Expected_bytes = _Observed_bytes; continue; } } return; } __std_atomic_wait_indirect(_Storage_ptr, _Expected_ptr, sizeof(_TVal), nullptr, &_Atomic_wait_compare_16_bytes, _Atomic_wait_no_timeout); } } void notify_one() noexcept { __std_atomic_notify_one_indirect(::std:: addressof(_Storage)); } void notify_all() noexcept { __std_atomic_notify_all_indirect(::std:: addressof(_Storage)); } struct _Int128 { alignas(16) long long _Low; long long _High; }; typename _Atomic_storage_types<_Ty&>::_TStorage _Storage; }; template <class _Ty, size_t = sizeof(_Ty)> struct _Atomic_integral; template <class _Ty> struct _Atomic_integral<_Ty, 1> : _Atomic_storage<_Ty> { using _Base = _Atomic_storage<_Ty>; using typename _Base::_TVal; using _Base::_Base; _TVal fetch_add(const _TVal _Operand, const memory_order _Order = memory_order_seq_cst) noexcept { char _Result; _Check_memory_order(_Order); _Result = _InterlockedExchangeAdd8(_Atomic_address_as<char>(this->_Storage), static_cast<char>(_Operand)); return static_cast<_TVal>(_Result); } _TVal fetch_and(const _TVal _Operand, const memory_order _Order = memory_order_seq_cst) noexcept { char _Result; _Check_memory_order(_Order); _Result = _InterlockedAnd8(_Atomic_address_as<char>(this->_Storage), static_cast<char>(_Operand)); return static_cast<_TVal>(_Result); } _TVal fetch_or(const _TVal _Operand, const memory_order _Order = memory_order_seq_cst) noexcept { char _Result; _Check_memory_order(_Order); _Result = _InterlockedOr8(_Atomic_address_as<char>(this->_Storage), static_cast<char>(_Operand)); return static_cast<_TVal>(_Result); } _TVal fetch_xor(const _TVal _Operand, const memory_order _Order = memory_order_seq_cst) noexcept { char _Result; _Check_memory_order(_Order); _Result = _InterlockedXor8(_Atomic_address_as<char>(this->_Storage), static_cast<char>(_Operand)); return static_cast<_TVal>(_Result); } _TVal operator++(int) noexcept { return static_cast<_TVal>(_InterlockedExchangeAdd8(_Atomic_address_as<char>(this->_Storage), 1)); } _TVal operator++() noexcept { unsigned char _Before = static_cast<unsigned char>(_InterlockedExchangeAdd8(_Atomic_address_as<char>(this->_Storage), 1)); ++_Before; return static_cast<_TVal>(_Before); } _TVal operator--(int) noexcept { return static_cast<_TVal>(_InterlockedExchangeAdd8(_Atomic_address_as<char>(this->_Storage), -1)); } _TVal operator--() noexcept { unsigned char _Before = static_cast<unsigned char>(_InterlockedExchangeAdd8(_Atomic_address_as<char>(this->_Storage), -1)); --_Before; return static_cast<_TVal>(_Before); } }; template <class _Ty> struct _Atomic_integral<_Ty, 2> : _Atomic_storage<_Ty> { using _Base = _Atomic_storage<_Ty>; using typename _Base::_TVal; using _Base::_Base; _TVal fetch_add(const _TVal _Operand, const memory_order _Order = memory_order_seq_cst) noexcept { short _Result; _Check_memory_order(_Order); _Result = _InterlockedExchangeAdd16(_Atomic_address_as<short>(this->_Storage), static_cast<short>(_Operand)); return static_cast<_TVal>(_Result); } _TVal fetch_and(const _TVal _Operand, const memory_order _Order = memory_order_seq_cst) noexcept { short _Result; _Check_memory_order(_Order); _Result = _InterlockedAnd16(_Atomic_address_as<short>(this->_Storage), static_cast<short>(_Operand)); return static_cast<_TVal>(_Result); } _TVal fetch_or(const _TVal _Operand, const memory_order _Order = memory_order_seq_cst) noexcept { short _Result; _Check_memory_order(_Order); _Result = _InterlockedOr16(_Atomic_address_as<short>(this->_Storage), static_cast<short>(_Operand)); return static_cast<_TVal>(_Result); } _TVal fetch_xor(const _TVal _Operand, const memory_order _Order = memory_order_seq_cst) noexcept { short _Result; _Check_memory_order(_Order); _Result = _InterlockedXor16(_Atomic_address_as<short>(this->_Storage), static_cast<short>(_Operand)); return static_cast<_TVal>(_Result); } _TVal operator++(int) noexcept { unsigned short _After = static_cast<unsigned short>(_InterlockedIncrement16(_Atomic_address_as<short>(this->_Storage))); --_After; return static_cast<_TVal>(_After); } _TVal operator++() noexcept { return static_cast<_TVal>(_InterlockedIncrement16(_Atomic_address_as<short>(this->_Storage))); } _TVal operator--(int) noexcept { unsigned short _After = static_cast<unsigned short>(_InterlockedDecrement16(_Atomic_address_as<short>(this->_Storage))); ++_After; return static_cast<_TVal>(_After); } _TVal operator--() noexcept { return static_cast<_TVal>(_InterlockedDecrement16(_Atomic_address_as<short>(this->_Storage))); } }; template <class _Ty> struct _Atomic_integral<_Ty, 4> : _Atomic_storage<_Ty> { using _Base = _Atomic_storage<_Ty>; using typename _Base::_TVal; using _Base::_Base; _TVal fetch_add(const _TVal _Operand, const memory_order _Order = memory_order_seq_cst) noexcept { long _Result; _Check_memory_order(_Order); _Result = _InterlockedExchangeAdd(_Atomic_address_as<long>(this->_Storage), static_cast<long>(_Operand)); return static_cast<_TVal>(_Result); } _TVal fetch_and(const _TVal _Operand, const memory_order _Order = memory_order_seq_cst) noexcept { long _Result; _Check_memory_order(_Order); _Result = _InterlockedAnd(_Atomic_address_as<long>(this->_Storage), static_cast<long>(_Operand)); return static_cast<_TVal>(_Result); } _TVal fetch_or(const _TVal _Operand, const memory_order _Order = memory_order_seq_cst) noexcept { long _Result; _Check_memory_order(_Order); _Result = _InterlockedOr(_Atomic_address_as<long>(this->_Storage), static_cast<long>(_Operand)); return static_cast<_TVal>(_Result); } _TVal fetch_xor(const _TVal _Operand, const memory_order _Order = memory_order_seq_cst) noexcept { long _Result; _Check_memory_order(_Order); _Result = _InterlockedXor(_Atomic_address_as<long>(this->_Storage), static_cast<long>(_Operand)); return static_cast<_TVal>(_Result); } _TVal operator++(int) noexcept { unsigned long _After = static_cast<unsigned long>(_InterlockedIncrement(_Atomic_address_as<long>(this->_Storage))); --_After; return static_cast<_TVal>(_After); } _TVal operator++() noexcept { return static_cast<_TVal>(_InterlockedIncrement(_Atomic_address_as<long>(this->_Storage))); } _TVal operator--(int) noexcept { unsigned long _After = static_cast<unsigned long>(_InterlockedDecrement(_Atomic_address_as<long>(this->_Storage))); ++_After; return static_cast<_TVal>(_After); } _TVal operator--() noexcept { return static_cast<_TVal>(_InterlockedDecrement(_Atomic_address_as<long>(this->_Storage))); } }; template <class _Ty> struct _Atomic_integral<_Ty, 8> : _Atomic_storage<_Ty> { using _Base = _Atomic_storage<_Ty>; using typename _Base::_TVal; using _Base::_Base; _TVal fetch_add(const _TVal _Operand, const memory_order _Order = memory_order_seq_cst) noexcept { long long _Result; _Check_memory_order(_Order); _Result = _InterlockedExchangeAdd64(_Atomic_address_as<long long>(this->_Storage), static_cast<long long>(_Operand)); return static_cast<_TVal>(_Result); } _TVal fetch_and(const _TVal _Operand, const memory_order _Order = memory_order_seq_cst) noexcept { long long _Result; _Check_memory_order(_Order); _Result = _InterlockedAnd64(_Atomic_address_as<long long>(this->_Storage), static_cast<long long>(_Operand)); return static_cast<_TVal>(_Result); } _TVal fetch_or(const _TVal _Operand, const memory_order _Order = memory_order_seq_cst) noexcept { long long _Result; _Check_memory_order(_Order); _Result = _InterlockedOr64(_Atomic_address_as<long long>(this->_Storage), static_cast<long long>(_Operand)); return static_cast<_TVal>(_Result); } _TVal fetch_xor(const _TVal _Operand, const memory_order _Order = memory_order_seq_cst) noexcept { long long _Result; _Check_memory_order(_Order); _Result = _InterlockedXor64(_Atomic_address_as<long long>(this->_Storage), static_cast<long long>(_Operand)); return static_cast<_TVal>(_Result); } _TVal operator++(int) noexcept { unsigned long long _After = static_cast<unsigned long long>(_InterlockedIncrement64(_Atomic_address_as<long long>(this->_Storage))); --_After; return static_cast<_TVal>(_After); } _TVal operator++() noexcept { return static_cast<_TVal>(_InterlockedIncrement64(_Atomic_address_as<long long>(this->_Storage))); } _TVal operator--(int) noexcept { unsigned long long _After = static_cast<unsigned long long>(_InterlockedDecrement64(_Atomic_address_as<long long>(this->_Storage))); ++_After; return static_cast<_TVal>(_After); } _TVal operator--() noexcept { return static_cast<_TVal>(_InterlockedDecrement64(_Atomic_address_as<long long>(this->_Storage))); } }; template <size_t _TypeSize> inline constexpr bool _Is_always_lock_free = _TypeSize <= 8 && (_TypeSize & (_TypeSize - 1)) == 0; template <class _Ty, bool _Is_lock_free = _Is_always_lock_free<sizeof(_Ty)>> inline constexpr bool _Deprecate_non_lock_free_volatile = true; template <class _Ty> [[deprecated("warning STL4030: " "Some operations on volatile-qualified types in the STL are deprecated in C++20. " "You can define _SILENCE_CXX20_VOLATILE_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] inline constexpr bool _Deprecate_non_lock_free_volatile<_Ty, false> = true; template <class _Ty> struct _Atomic_integral_facade : _Atomic_integral<_Ty> { using _Base = _Atomic_integral<_Ty>; using difference_type = _Ty; using _Base::_Base; using _Base::fetch_add; _Ty fetch_add(const _Ty _Operand) volatile noexcept { return const_cast<_Atomic_integral_facade*>(this)->_Base::fetch_add(_Operand); } _Ty fetch_add(const _Ty _Operand, const memory_order _Order) volatile noexcept { return const_cast<_Atomic_integral_facade*>(this)->_Base::fetch_add(_Operand, _Order); } [[nodiscard]] static _Ty _Negate(const _Ty _Value) noexcept { return static_cast<_Ty>(0U - static_cast<make_unsigned_t<_Ty>>(_Value)); } _Ty fetch_sub(const _Ty _Operand) noexcept { return fetch_add(_Negate(_Operand)); } _Ty fetch_sub(const _Ty _Operand) volatile noexcept { return fetch_add(_Negate(_Operand)); } _Ty fetch_sub(const _Ty _Operand, const memory_order _Order) noexcept { return fetch_add(_Negate(_Operand), _Order); } _Ty fetch_sub(const _Ty _Operand, const memory_order _Order) volatile noexcept { return fetch_add(_Negate(_Operand), _Order); } using _Base::fetch_and; _Ty fetch_and(const _Ty _Operand) volatile noexcept { return const_cast<_Atomic_integral_facade*>(this)->_Base::fetch_and(_Operand); } _Ty fetch_and(const _Ty _Operand, const memory_order _Order) volatile noexcept { return const_cast<_Atomic_integral_facade*>(this)->_Base::fetch_and(_Operand, _Order); } using _Base::fetch_or; _Ty fetch_or(const _Ty _Operand) volatile noexcept { return const_cast<_Atomic_integral_facade*>(this)->_Base::fetch_or(_Operand); } _Ty fetch_or(const _Ty _Operand, const memory_order _Order) volatile noexcept { return const_cast<_Atomic_integral_facade*>(this)->_Base::fetch_or(_Operand, _Order); } using _Base::fetch_xor; _Ty fetch_xor(const _Ty _Operand) volatile noexcept { return const_cast<_Atomic_integral_facade*>(this)->_Base::fetch_xor(_Operand); } _Ty fetch_xor(const _Ty _Operand, const memory_order _Order) volatile noexcept { return const_cast<_Atomic_integral_facade*>(this)->_Base::fetch_xor(_Operand, _Order); } using _Base::operator++; _Ty operator++(int) volatile noexcept { return const_cast<_Atomic_integral_facade*>(this)->_Base::operator++(0); } _Ty operator++() volatile noexcept { return const_cast<_Atomic_integral_facade*>(this)->_Base::operator++(); } using _Base::operator--; _Ty operator--(int) volatile noexcept { return const_cast<_Atomic_integral_facade*>(this)->_Base::operator--(0); } _Ty operator--() volatile noexcept { return const_cast<_Atomic_integral_facade*>(this)->_Base::operator--(); } _Ty operator+=(const _Ty _Operand) noexcept { return static_cast<_Ty>(this->_Base::fetch_add(_Operand) + _Operand); } _Ty operator+=(const _Ty _Operand) volatile noexcept { return static_cast<_Ty>(const_cast<_Atomic_integral_facade*>(this)->_Base::fetch_add(_Operand) + _Operand); } _Ty operator-=(const _Ty _Operand) noexcept { return static_cast<_Ty>(fetch_sub(_Operand) - _Operand); } _Ty operator-=(const _Ty _Operand) volatile noexcept { return static_cast<_Ty>(const_cast<_Atomic_integral_facade*>(this)->fetch_sub(_Operand) - _Operand); } _Ty operator&=(const _Ty _Operand) noexcept { return static_cast<_Ty>(this->_Base::fetch_and(_Operand) & _Operand); } _Ty operator&=(const _Ty _Operand) volatile noexcept { return static_cast<_Ty>(const_cast<_Atomic_integral_facade*>(this)->_Base::fetch_and(_Operand) & _Operand); } _Ty operator|=(const _Ty _Operand) noexcept { return static_cast<_Ty>(this->_Base::fetch_or(_Operand) | _Operand); } _Ty operator|=(const _Ty _Operand) volatile noexcept { return static_cast<_Ty>(const_cast<_Atomic_integral_facade*>(this)->_Base::fetch_or(_Operand) | _Operand); } _Ty operator^=(const _Ty _Operand) noexcept { return static_cast<_Ty>(this->_Base::fetch_xor(_Operand) ^ _Operand); } _Ty operator^=(const _Ty _Operand) volatile noexcept { return static_cast<_Ty>(const_cast<_Atomic_integral_facade*>(this)->_Base::fetch_xor(_Operand) ^ _Operand); } }; template <class _Ty> struct _Atomic_integral_facade<_Ty&> : _Atomic_integral<_Ty&> { using _Base = _Atomic_integral<_Ty&>; using difference_type = _Ty; using _Base::_Base; [[nodiscard]] static _Ty _Negate(const _Ty _Value) noexcept { return static_cast<_Ty>(0U - static_cast<make_unsigned_t<_Ty>>(_Value)); } _Ty fetch_add(const _Ty _Operand) const noexcept { return const_cast<_Atomic_integral_facade*>(this)->_Base::fetch_add(_Operand); } _Ty fetch_add(const _Ty _Operand, const memory_order _Order) const noexcept { return const_cast<_Atomic_integral_facade*>(this)->_Base::fetch_add(_Operand, _Order); } _Ty fetch_sub(const _Ty _Operand) const noexcept { return fetch_add(_Negate(_Operand)); } _Ty fetch_sub(const _Ty _Operand, const memory_order _Order) const noexcept { return fetch_add(_Negate(_Operand), _Order); } _Ty operator++(int) const noexcept { return const_cast<_Atomic_integral_facade*>(this)->_Base::operator++(0); } _Ty operator++() const noexcept { return const_cast<_Atomic_integral_facade*>(this)->_Base::operator++(); } _Ty operator--(int) const noexcept { return const_cast<_Atomic_integral_facade*>(this)->_Base::operator--(0); } _Ty operator--() const noexcept { return const_cast<_Atomic_integral_facade*>(this)->_Base::operator--(); } _Ty operator+=(const _Ty _Operand) const noexcept { return static_cast<_Ty>(fetch_add(_Operand) + _Operand); } _Ty operator-=(const _Ty _Operand) const noexcept { return static_cast<_Ty>(fetch_sub(_Operand) - _Operand); } _Ty fetch_and(const _Ty _Operand) const noexcept { return const_cast<_Atomic_integral_facade*>(this)->_Base::fetch_and(_Operand); } _Ty fetch_and(const _Ty _Operand, const memory_order _Order) const noexcept { return const_cast<_Atomic_integral_facade*>(this)->_Base::fetch_and(_Operand, _Order); } _Ty fetch_or(const _Ty _Operand) const noexcept { return const_cast<_Atomic_integral_facade*>(this)->_Base::fetch_or(_Operand); } _Ty fetch_or(const _Ty _Operand, const memory_order _Order) const noexcept { return const_cast<_Atomic_integral_facade*>(this)->_Base::fetch_or(_Operand, _Order); } _Ty fetch_xor(const _Ty _Operand) const noexcept { return const_cast<_Atomic_integral_facade*>(this)->_Base::fetch_xor(_Operand); } _Ty fetch_xor(const _Ty _Operand, const memory_order _Order) const noexcept { return const_cast<_Atomic_integral_facade*>(this)->_Base::fetch_xor(_Operand, _Order); } _Ty operator&=(const _Ty _Operand) const noexcept { return static_cast<_Ty>(fetch_and(_Operand) & _Operand); } _Ty operator|=(const _Ty _Operand) const noexcept { return static_cast<_Ty>(fetch_or(_Operand) | _Operand); } _Ty operator^=(const _Ty _Operand) const noexcept { return static_cast<_Ty>(fetch_xor(_Operand) ^ _Operand); } }; template <class _Ty> struct _Atomic_floating : _Atomic_storage<_Ty> { using _Base = _Atomic_storage<_Ty>; using difference_type = _Ty; using _Base::_Base; _Ty fetch_add(const _Ty _Operand, const memory_order _Order = memory_order_seq_cst) noexcept { _Ty _Temp{this->load(memory_order_relaxed)}; while (!this->compare_exchange_strong(_Temp, _Temp + _Operand, _Order)) { } return _Temp; } _Ty fetch_add(const _Ty _Operand, const memory_order _Order = memory_order_seq_cst) volatile noexcept { return const_cast<_Atomic_floating*>(this)->fetch_add(_Operand, _Order); } _Ty fetch_sub(const _Ty _Operand, const memory_order _Order = memory_order_seq_cst) noexcept { _Ty _Temp{this->load(memory_order_relaxed)}; while (!this->compare_exchange_strong(_Temp, _Temp - _Operand, _Order)) { } return _Temp; } _Ty fetch_sub(const _Ty _Operand, const memory_order _Order = memory_order_seq_cst) volatile noexcept { return const_cast<_Atomic_floating*>(this)->fetch_sub(_Operand, _Order); } _Ty operator+=(const _Ty _Operand) noexcept { return fetch_add(_Operand) + _Operand; } _Ty operator+=(const _Ty _Operand) volatile noexcept { return const_cast<_Atomic_floating*>(this)->fetch_add(_Operand) + _Operand; } _Ty operator-=(const _Ty _Operand) noexcept { return fetch_sub(_Operand) - _Operand; } _Ty operator-=(const _Ty _Operand) volatile noexcept { return const_cast<_Atomic_floating*>(this)->fetch_sub(_Operand) - _Operand; } }; template <class _Ty> struct _Atomic_floating<_Ty&> : _Atomic_storage<_Ty&> { using _Base = _Atomic_storage<_Ty&>; using difference_type = _Ty; using _Base::_Base; _Ty fetch_add(const _Ty _Operand, const memory_order _Order = memory_order_seq_cst) const noexcept { _Ty _Temp{this->load(memory_order_relaxed)}; while (!const_cast<_Atomic_floating*>(this)->_Base::compare_exchange_strong( _Temp, _Temp + _Operand, _Order)) { } return _Temp; } _Ty fetch_sub(const _Ty _Operand, const memory_order _Order = memory_order_seq_cst) const noexcept { _Ty _Temp{this->load(memory_order_relaxed)}; while (!const_cast<_Atomic_floating*>(this)->_Base::compare_exchange_strong( _Temp, _Temp - _Operand, _Order)) { } return _Temp; } _Ty operator+=(const _Ty _Operand) const noexcept { return fetch_add(_Operand) + _Operand; } _Ty operator-=(const _Ty _Operand) const noexcept { return fetch_sub(_Operand) - _Operand; } }; template <class _Ty> struct _Atomic_pointer : _Atomic_storage<_Ty> { using _Base = _Atomic_storage<_Ty>; using difference_type = ptrdiff_t; using _Base::_Base; _Ty fetch_add(const ptrdiff_t _Diff, const memory_order _Order = memory_order_seq_cst) noexcept { const ptrdiff_t _Shift_bytes = static_cast<ptrdiff_t>(static_cast<size_t>(_Diff) * sizeof(remove_pointer_t<_Ty>)); ptrdiff_t _Result; _Check_memory_order(_Order); _Result = _InterlockedExchangeAdd64(_Atomic_address_as<long long>(this->_Storage), _Shift_bytes); return reinterpret_cast<_Ty>(_Result); } _Ty fetch_add(const ptrdiff_t _Diff) volatile noexcept { return const_cast<_Atomic_pointer*>(this)->fetch_add(_Diff); } _Ty fetch_add(const ptrdiff_t _Diff, const memory_order _Order) volatile noexcept { return const_cast<_Atomic_pointer*>(this)->fetch_add(_Diff, _Order); } _Ty fetch_sub(const ptrdiff_t _Diff) volatile noexcept { return fetch_add(static_cast<ptrdiff_t>(0 - static_cast<size_t>(_Diff))); } _Ty fetch_sub(const ptrdiff_t _Diff) noexcept { return fetch_add(static_cast<ptrdiff_t>(0 - static_cast<size_t>(_Diff))); } _Ty fetch_sub(const ptrdiff_t _Diff, const memory_order _Order) volatile noexcept { return fetch_add(static_cast<ptrdiff_t>(0 - static_cast<size_t>(_Diff)), _Order); } _Ty fetch_sub(const ptrdiff_t _Diff, const memory_order _Order) noexcept { return fetch_add(static_cast<ptrdiff_t>(0 - static_cast<size_t>(_Diff)), _Order); } _Ty operator++(int) volatile noexcept { return fetch_add(1); } _Ty operator++(int) noexcept { return fetch_add(1); } _Ty operator++() volatile noexcept { return fetch_add(1) + 1; } _Ty operator++() noexcept { return fetch_add(1) + 1; } _Ty operator--(int) volatile noexcept { return fetch_add(-1); } _Ty operator--(int) noexcept { return fetch_add(-1); } _Ty operator--() volatile noexcept { return fetch_add(-1) - 1; } _Ty operator--() noexcept { return fetch_add(-1) - 1; } _Ty operator+=(const ptrdiff_t _Diff) volatile noexcept { return fetch_add(_Diff) + _Diff; } _Ty operator+=(const ptrdiff_t _Diff) noexcept { return fetch_add(_Diff) + _Diff; } _Ty operator-=(const ptrdiff_t _Diff) volatile noexcept { return fetch_add(static_cast<ptrdiff_t>(0 - static_cast<size_t>(_Diff))) - _Diff; } _Ty operator-=(const ptrdiff_t _Diff) noexcept { return fetch_add(static_cast<ptrdiff_t>(0 - static_cast<size_t>(_Diff))) - _Diff; } }; template <class _Ty> struct _Atomic_pointer<_Ty&> : _Atomic_storage<_Ty&> { using _Base = _Atomic_storage<_Ty&>; using difference_type = ptrdiff_t; using _Base::_Base; _Ty fetch_add(const ptrdiff_t _Diff, const memory_order _Order = memory_order_seq_cst) const noexcept { const ptrdiff_t _Shift_bytes = static_cast<ptrdiff_t>(static_cast<size_t>(_Diff) * sizeof(remove_pointer_t<_Ty>)); ptrdiff_t _Result; _Check_memory_order(_Order); _Result = _InterlockedExchangeAdd64(_Atomic_address_as<long long>(this->_Storage), _Shift_bytes); return reinterpret_cast<_Ty>(_Result); } _Ty fetch_sub(const ptrdiff_t _Diff) const noexcept { return fetch_add(static_cast<ptrdiff_t>(0 - static_cast<size_t>(_Diff))); } _Ty fetch_sub(const ptrdiff_t _Diff, const memory_order _Order) const noexcept { return fetch_add(static_cast<ptrdiff_t>(0 - static_cast<size_t>(_Diff)), _Order); } _Ty operator++(int) const noexcept { return fetch_add(1); } _Ty operator++() const noexcept { return fetch_add(1) + 1; } _Ty operator--(int) const noexcept { return fetch_add(-1); } _Ty operator--() const noexcept { return fetch_add(-1) - 1; } _Ty operator+=(const ptrdiff_t _Diff) const noexcept { return fetch_add(_Diff) + _Diff; } _Ty operator-=(const ptrdiff_t _Diff) const noexcept { return fetch_add(static_cast<ptrdiff_t>(0 - static_cast<size_t>(_Diff))) - _Diff; } }; template <class _TVal, class _Ty = _TVal> using _Choose_atomic_base2_t = typename _Select<is_integral_v<_TVal> && !is_same_v<bool, _TVal>>::template _Apply<_Atomic_integral_facade<_Ty>, typename _Select<is_pointer_v<_TVal> && is_object_v<remove_pointer_t<_TVal>>>::template _Apply< _Atomic_pointer<_Ty>, _Atomic_storage<_Ty>>>; template <class _TVal, class _Ty = _TVal> using _Choose_atomic_base_t = typename _Select<is_floating_point_v<_TVal>>::template _Apply<_Atomic_floating<_Ty>, _Choose_atomic_base2_t<_TVal, _Ty>>; template <class _Ty> struct atomic : _Choose_atomic_base_t<_Ty> { private: using _Base = _Choose_atomic_base_t<_Ty>; public: static_assert(is_trivially_copyable_v<_Ty> && is_copy_constructible_v<_Ty> && is_move_constructible_v<_Ty> && is_copy_assignable_v<_Ty> && is_move_assignable_v<_Ty>, "atomic<T> requires T to be trivially copyable, copy constructible, move constructible, copy assignable, " "and move assignable."); using value_type = _Ty; using _Base::_Base; constexpr atomic() noexcept(is_nothrow_default_constructible_v<_Ty>) : _Base() {} atomic(const atomic&) = delete; atomic& operator=(const atomic&) = delete; static constexpr bool is_always_lock_free = _Is_always_lock_free<sizeof(_Ty)>; [[nodiscard]] bool is_lock_free() const volatile noexcept { constexpr bool _Result = sizeof(_Ty) <= 8 && (sizeof(_Ty) & sizeof(_Ty) - 1) == 0; return _Result; } [[nodiscard]] bool is_lock_free() const noexcept { return static_cast<const volatile atomic*>(this)->is_lock_free(); } _Ty operator=(const _Ty _Value) volatile noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); this->store(_Value); return _Value; } _Ty operator=(const _Ty _Value) noexcept { this->store(_Value); return _Value; } using _Base::store; void store(const _Ty _Value) volatile noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); const_cast<atomic*>(this)->_Base::store(_Value); } void store(const _Ty _Value, const memory_order _Order) volatile noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); const_cast<atomic*>(this)->_Base::store(_Value, _Order); } using _Base::load; [[nodiscard]] _Ty load() const volatile noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return const_cast<const atomic*>(this)->_Base::load(); } [[nodiscard]] _Ty load(const memory_order _Order) const volatile noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return const_cast<const atomic*>(this)->_Base::load(_Order); } using _Base::exchange; _Ty exchange(const _Ty _Value) volatile noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return const_cast<atomic*>(this)->_Base::exchange(_Value); } _Ty exchange(const _Ty _Value, const memory_order _Order) volatile noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return const_cast<atomic*>(this)->_Base::exchange(_Value, _Order); } using _Base::compare_exchange_strong; bool compare_exchange_strong(_Ty& _Expected, const _Ty _Desired) volatile noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return const_cast<atomic*>(this)->_Base::compare_exchange_strong(_Expected, _Desired); } bool compare_exchange_strong(_Ty& _Expected, const _Ty _Desired, const memory_order _Order) volatile noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return const_cast<atomic*>(this)->_Base::compare_exchange_strong(_Expected, _Desired, _Order); } bool compare_exchange_strong(_Ty& _Expected, const _Ty _Desired, const memory_order _Success, const memory_order _Failure) volatile noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return this->compare_exchange_strong(_Expected, _Desired, _Combine_cas_memory_orders(_Success, _Failure)); } bool compare_exchange_strong( _Ty& _Expected, const _Ty _Desired, const memory_order _Success, const memory_order _Failure) noexcept { return this->compare_exchange_strong(_Expected, _Desired, _Combine_cas_memory_orders(_Success, _Failure)); } bool compare_exchange_weak(_Ty& _Expected, const _Ty _Desired) volatile noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return this->compare_exchange_strong(_Expected, _Desired); } bool compare_exchange_weak(_Ty& _Expected, const _Ty _Desired) noexcept { return this->compare_exchange_strong(_Expected, _Desired); } bool compare_exchange_weak(_Ty& _Expected, const _Ty _Desired, const memory_order _Order) volatile noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return this->compare_exchange_strong(_Expected, _Desired, _Order); } bool compare_exchange_weak(_Ty& _Expected, const _Ty _Desired, const memory_order _Order) noexcept { return this->compare_exchange_strong(_Expected, _Desired, _Order); } bool compare_exchange_weak(_Ty& _Expected, const _Ty _Desired, const memory_order _Success, const memory_order _Failure) volatile noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return this->compare_exchange_strong(_Expected, _Desired, _Combine_cas_memory_orders(_Success, _Failure)); } bool compare_exchange_weak( _Ty& _Expected, const _Ty _Desired, const memory_order _Success, const memory_order _Failure) noexcept { return this->compare_exchange_strong(_Expected, _Desired, _Combine_cas_memory_orders(_Success, _Failure)); } using _Base::wait; void wait(const _Ty _Expected, const memory_order _Order = memory_order_seq_cst) const volatile noexcept { const_cast<const atomic*>(this)->_Base::wait(_Expected, _Order); } using _Base::notify_one; void notify_one() volatile noexcept { const_cast<atomic*>(this)->_Base::notify_one(); } using _Base::notify_all; void notify_all() volatile noexcept { const_cast<atomic*>(this)->_Base::notify_all(); } operator _Ty() const volatile noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return this->load(); } operator _Ty() const noexcept { return this->load(); } }; template <class _Ty> atomic(_Ty) -> atomic<_Ty>; template <class _Ty> struct atomic_ref : _Choose_atomic_base_t<_Ty, _Ty&> { private: using _Base = _Choose_atomic_base_t<_Ty, _Ty&>; public: static_assert(is_trivially_copyable_v<_Ty>, "atomic_ref<T> requires T to be trivially copyable."); using value_type = _Ty; explicit atomic_ref(_Ty& _Value) noexcept : _Base(_Value) { if constexpr (_Is_potentially_lock_free) { _Check_alignment(_Value); } else { this->_Init_spinlock_for_ref(); } } atomic_ref(const atomic_ref&) noexcept = default; atomic_ref& operator=(const atomic_ref&) = delete; static constexpr bool is_always_lock_free = _Is_always_lock_free<sizeof(_Ty)>; static constexpr bool _Is_potentially_lock_free = sizeof(_Ty) <= 2 * sizeof(void*) && (sizeof(_Ty) & (sizeof(_Ty) - 1)) == 0; static constexpr size_t required_alignment = _Is_potentially_lock_free ? sizeof(_Ty) : alignof(_Ty); [[nodiscard]] bool is_lock_free() const noexcept { if constexpr (is_always_lock_free) { return true; } else { return __std_atomic_has_cmpxchg16b() != 0; } } void store(const _Ty _Value) const noexcept { const_cast<atomic_ref*>(this)->_Base::store(_Value); } void store(const _Ty _Value, const memory_order _Order) const noexcept { const_cast<atomic_ref*>(this)->_Base::store(_Value, _Order); } _Ty operator=(const _Ty _Value) const noexcept { store(_Value); return _Value; } _Ty exchange(const _Ty _Value) const noexcept { return const_cast<atomic_ref*>(this)->_Base::exchange(_Value); } _Ty exchange(const _Ty _Value, const memory_order _Order) const noexcept { return const_cast<atomic_ref*>(this)->_Base::exchange(_Value, _Order); } bool compare_exchange_strong(_Ty& _Expected, const _Ty _Desired) const noexcept { return const_cast<atomic_ref*>(this)->_Base::compare_exchange_strong(_Expected, _Desired); } bool compare_exchange_strong(_Ty& _Expected, const _Ty _Desired, const memory_order _Order) const noexcept { return const_cast<atomic_ref*>(this)->_Base::compare_exchange_strong(_Expected, _Desired, _Order); } bool compare_exchange_strong( _Ty& _Expected, const _Ty _Desired, const memory_order _Success, const memory_order _Failure) const noexcept { return compare_exchange_strong(_Expected, _Desired, _Combine_cas_memory_orders(_Success, _Failure)); } bool compare_exchange_weak(_Ty& _Expected, const _Ty _Desired) const noexcept { return compare_exchange_strong(_Expected, _Desired); } bool compare_exchange_weak(_Ty& _Expected, const _Ty _Desired, const memory_order _Order) const noexcept { return compare_exchange_strong(_Expected, _Desired, _Order); } bool compare_exchange_weak( _Ty& _Expected, const _Ty _Desired, const memory_order _Success, const memory_order _Failure) const noexcept { return compare_exchange_strong(_Expected, _Desired, _Combine_cas_memory_orders(_Success, _Failure)); } operator _Ty() const noexcept { return this->load(); } void notify_one() const noexcept { const_cast<atomic_ref*>(this)->_Base::notify_one(); } void notify_all() const noexcept { const_cast<atomic_ref*>(this)->_Base::notify_all(); } private: static void _Check_alignment([[maybe_unused]] const _Ty& _Value) { do { if ((reinterpret_cast<uintptr_t>(::std:: addressof(_Value)) & (required_alignment - 1)) == 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\atomic", 2542, 0, "%s", "atomic_ref underlying object is not aligned as required_alignment")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"atomic_ref underlying object is not aligned as required_alignment\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\atomic", 2542, 0); } while (false); } ; } while (false); } }; template <class _Ty> [[nodiscard]] bool atomic_is_lock_free(const volatile atomic<_Ty>* _Mem) noexcept { return _Mem->is_lock_free(); } template <class _Ty> [[nodiscard]] bool atomic_is_lock_free(const atomic<_Ty>* _Mem) noexcept { return _Mem->is_lock_free(); } template <class _Ty> void atomic_store(volatile atomic<_Ty>* const _Mem, const _Identity_t<_Ty> _Value) noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); _Mem->store(_Value); } template <class _Ty> void atomic_store(atomic<_Ty>* const _Mem, const _Identity_t<_Ty> _Value) noexcept { _Mem->store(_Value); } template <class _Ty> void atomic_store_explicit( volatile atomic<_Ty>* const _Mem, const _Identity_t<_Ty> _Value, const memory_order _Order) noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); _Mem->store(_Value, _Order); } template <class _Ty> void atomic_store_explicit(atomic<_Ty>* const _Mem, const _Identity_t<_Ty> _Value, const memory_order _Order) noexcept { _Mem->store(_Value, _Order); } template <class _Ty> [[deprecated("warning STL4028: " "std::atomic_init() overloads are deprecated in C++20. " "The constructors of std::atomic provide equivalent functionality. " "You can define _SILENCE_CXX20_ATOMIC_INIT_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] void atomic_init( volatile atomic<_Ty>* const _Mem, const typename atomic<_Ty>::value_type _Value) noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); ::std:: atomic_store_explicit(_Mem, _Value, memory_order_relaxed); } template <class _Ty> [[deprecated("warning STL4028: " "std::atomic_init() overloads are deprecated in C++20. " "The constructors of std::atomic provide equivalent functionality. " "You can define _SILENCE_CXX20_ATOMIC_INIT_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] void atomic_init( atomic<_Ty>* const _Mem, const typename atomic<_Ty>::value_type _Value) noexcept { ::std:: atomic_store_explicit(_Mem, _Value, memory_order_relaxed); } template <class _Ty> [[nodiscard]] _Ty atomic_load(const volatile atomic<_Ty>* const _Mem) noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return _Mem->load(); } template <class _Ty> [[nodiscard]] _Ty atomic_load(const atomic<_Ty>* const _Mem) noexcept { return _Mem->load(); } template <class _Ty> [[nodiscard]] _Ty atomic_load_explicit(const volatile atomic<_Ty>* const _Mem, const memory_order _Order) noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return _Mem->load(_Order); } template <class _Ty> [[nodiscard]] _Ty atomic_load_explicit(const atomic<_Ty>* const _Mem, const memory_order _Order) noexcept { return _Mem->load(_Order); } template <class _Ty> _Ty atomic_exchange(volatile atomic<_Ty>* const _Mem, const _Identity_t<_Ty> _Value) noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return _Mem->exchange(_Value); } template <class _Ty> _Ty atomic_exchange(atomic<_Ty>* const _Mem, const _Identity_t<_Ty> _Value) noexcept { return _Mem->exchange(_Value); } template <class _Ty> _Ty atomic_exchange_explicit( volatile atomic<_Ty>* const _Mem, const _Identity_t<_Ty> _Value, const memory_order _Order) noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return _Mem->exchange(_Value, _Order); } template <class _Ty> _Ty atomic_exchange_explicit( atomic<_Ty>* const _Mem, const _Identity_t<_Ty> _Value, const memory_order _Order) noexcept { return _Mem->exchange(_Value, _Order); } template <class _Ty> bool atomic_compare_exchange_strong( volatile atomic<_Ty>* const _Mem, _Identity_t<_Ty>* const _Expected, const _Identity_t<_Ty> _Desired) noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return _Mem->compare_exchange_strong(*_Expected, _Desired); } template <class _Ty> bool atomic_compare_exchange_strong( atomic<_Ty>* const _Mem, _Identity_t<_Ty>* const _Expected, const _Identity_t<_Ty> _Desired) noexcept { return _Mem->compare_exchange_strong(*_Expected, _Desired); } template <class _Ty> bool atomic_compare_exchange_strong_explicit(volatile atomic<_Ty>* const _Mem, _Identity_t<_Ty>* const _Expected, const _Identity_t<_Ty> _Desired, const memory_order _Success, const memory_order _Failure) noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return _Mem->compare_exchange_strong(*_Expected, _Desired, _Combine_cas_memory_orders(_Success, _Failure)); } template <class _Ty> bool atomic_compare_exchange_strong_explicit(atomic<_Ty>* const _Mem, _Identity_t<_Ty>* const _Expected, const _Identity_t<_Ty> _Desired, const memory_order _Success, const memory_order _Failure) noexcept { return _Mem->compare_exchange_strong(*_Expected, _Desired, _Combine_cas_memory_orders(_Success, _Failure)); } template <class _Ty> bool atomic_compare_exchange_weak( volatile atomic<_Ty>* const _Mem, _Identity_t<_Ty>* const _Expected, const _Identity_t<_Ty> _Desired) noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return _Mem->compare_exchange_strong(*_Expected, _Desired); } template <class _Ty> bool atomic_compare_exchange_weak( atomic<_Ty>* const _Mem, _Identity_t<_Ty>* const _Expected, const _Identity_t<_Ty> _Desired) noexcept { return _Mem->compare_exchange_strong(*_Expected, _Desired); } template <class _Ty> bool atomic_compare_exchange_weak_explicit(volatile atomic<_Ty>* const _Mem, _Identity_t<_Ty>* const _Expected, const _Identity_t<_Ty> _Desired, const memory_order _Success, const memory_order _Failure) noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return _Mem->compare_exchange_strong(*_Expected, _Desired, _Combine_cas_memory_orders(_Success, _Failure)); } template <class _Ty> bool atomic_compare_exchange_weak_explicit(atomic<_Ty>* const _Mem, _Identity_t<_Ty>* const _Expected, const _Identity_t<_Ty> _Desired, const memory_order _Success, const memory_order _Failure) noexcept { return _Mem->compare_exchange_strong(*_Expected, _Desired, _Combine_cas_memory_orders(_Success, _Failure)); } template <class _Ty> _Ty atomic_fetch_add(volatile atomic<_Ty>* _Mem, const typename atomic<_Ty>::difference_type _Value) noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return _Mem->fetch_add(_Value); } template <class _Ty> _Ty atomic_fetch_add(atomic<_Ty>* _Mem, const typename atomic<_Ty>::difference_type _Value) noexcept { return _Mem->fetch_add(_Value); } template <class _Ty> _Ty atomic_fetch_add_explicit(volatile atomic<_Ty>* _Mem, const typename atomic<_Ty>::difference_type _Value, const memory_order _Order) noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return _Mem->fetch_add(_Value, _Order); } template <class _Ty> _Ty atomic_fetch_add_explicit( atomic<_Ty>* _Mem, const typename atomic<_Ty>::difference_type _Value, const memory_order _Order) noexcept { return _Mem->fetch_add(_Value, _Order); } template <class _Ty> _Ty atomic_fetch_sub(volatile atomic<_Ty>* _Mem, const typename atomic<_Ty>::difference_type _Value) noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return _Mem->fetch_sub(_Value); } template <class _Ty> _Ty atomic_fetch_sub(atomic<_Ty>* _Mem, const typename atomic<_Ty>::difference_type _Value) noexcept { return _Mem->fetch_sub(_Value); } template <class _Ty> _Ty atomic_fetch_sub_explicit(volatile atomic<_Ty>* _Mem, const typename atomic<_Ty>::difference_type _Value, const memory_order _Order) noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return _Mem->fetch_sub(_Value, _Order); } template <class _Ty> _Ty atomic_fetch_sub_explicit( atomic<_Ty>* _Mem, const typename atomic<_Ty>::difference_type _Value, const memory_order _Order) noexcept { return _Mem->fetch_sub(_Value, _Order); } template <class _Ty> _Ty atomic_fetch_and(volatile atomic<_Ty>* _Mem, const typename atomic<_Ty>::value_type _Value) noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return _Mem->fetch_and(_Value); } template <class _Ty> _Ty atomic_fetch_and(atomic<_Ty>* _Mem, const typename atomic<_Ty>::value_type _Value) noexcept { return _Mem->fetch_and(_Value); } template <class _Ty> _Ty atomic_fetch_and_explicit( volatile atomic<_Ty>* _Mem, const typename atomic<_Ty>::value_type _Value, const memory_order _Order) noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return _Mem->fetch_and(_Value, _Order); } template <class _Ty> _Ty atomic_fetch_and_explicit( atomic<_Ty>* _Mem, const typename atomic<_Ty>::value_type _Value, const memory_order _Order) noexcept { return _Mem->fetch_and(_Value, _Order); } template <class _Ty> _Ty atomic_fetch_or(volatile atomic<_Ty>* _Mem, const typename atomic<_Ty>::value_type _Value) noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return _Mem->fetch_or(_Value); } template <class _Ty> _Ty atomic_fetch_or(atomic<_Ty>* _Mem, const typename atomic<_Ty>::value_type _Value) noexcept { return _Mem->fetch_or(_Value); } template <class _Ty> _Ty atomic_fetch_or_explicit( volatile atomic<_Ty>* _Mem, const typename atomic<_Ty>::value_type _Value, const memory_order _Order) noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return _Mem->fetch_or(_Value, _Order); } template <class _Ty> _Ty atomic_fetch_or_explicit( atomic<_Ty>* _Mem, const typename atomic<_Ty>::value_type _Value, const memory_order _Order) noexcept { return _Mem->fetch_or(_Value, _Order); } template <class _Ty> _Ty atomic_fetch_xor(volatile atomic<_Ty>* _Mem, const typename atomic<_Ty>::value_type _Value) noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return _Mem->fetch_xor(_Value); } template <class _Ty> _Ty atomic_fetch_xor(atomic<_Ty>* _Mem, const typename atomic<_Ty>::value_type _Value) noexcept { return _Mem->fetch_xor(_Value); } template <class _Ty> _Ty atomic_fetch_xor_explicit( volatile atomic<_Ty>* _Mem, const typename atomic<_Ty>::value_type _Value, const memory_order _Order) noexcept { static_assert(_Deprecate_non_lock_free_volatile<_Ty>, "Never fails"); return _Mem->fetch_xor(_Value, _Order); } template <class _Ty> _Ty atomic_fetch_xor_explicit( atomic<_Ty>* _Mem, const typename atomic<_Ty>::value_type _Value, const memory_order _Order) noexcept { return _Mem->fetch_xor(_Value, _Order); } template <class _Ty> void atomic_wait(const volatile atomic<_Ty>* const _Mem, const typename atomic<_Ty>::value_type _Expected) noexcept { _Mem->wait(_Expected); } template <class _Ty> void atomic_wait(const atomic<_Ty>* const _Mem, const typename atomic<_Ty>::value_type _Expected) noexcept { _Mem->wait(_Expected); } template <class _Ty> void atomic_wait_explicit(const volatile atomic<_Ty>* const _Mem, const typename atomic<_Ty>::value_type _Expected, const memory_order _Order) noexcept { _Mem->wait(_Expected, _Order); } template <class _Ty> void atomic_wait_explicit(const atomic<_Ty>* const _Mem, const typename atomic<_Ty>::value_type _Expected, const memory_order _Order) noexcept { _Mem->wait(_Expected, _Order); } template <class _Ty> void atomic_notify_one(volatile atomic<_Ty>* const _Mem) noexcept { _Mem->notify_one(); } template <class _Ty> void atomic_notify_one(atomic<_Ty>* const _Mem) noexcept { _Mem->notify_one(); } template <class _Ty> void atomic_notify_all(volatile atomic<_Ty>* const _Mem) noexcept { _Mem->notify_all(); } template <class _Ty> void atomic_notify_all(atomic<_Ty>* const _Mem) noexcept { _Mem->notify_all(); } using atomic_bool = atomic<bool>; using atomic_char = atomic<char>; using atomic_schar = atomic<signed char>; using atomic_uchar = atomic<unsigned char>; using atomic_short = atomic<short>; using atomic_ushort = atomic<unsigned short>; using atomic_int = atomic<int>; using atomic_uint = atomic<unsigned int>; using atomic_long = atomic<long>; using atomic_ulong = atomic<unsigned long>; using atomic_llong = atomic<long long>; using atomic_ullong = atomic<unsigned long long>; using atomic_char8_t = atomic<char8_t>; using atomic_char16_t = atomic<char16_t>; using atomic_char32_t = atomic<char32_t>; using atomic_wchar_t = atomic<wchar_t>; using atomic_int8_t = atomic<int8_t>; using atomic_uint8_t = atomic<uint8_t>; using atomic_int16_t = atomic<int16_t>; using atomic_uint16_t = atomic<uint16_t>; using atomic_int32_t = atomic<int32_t>; using atomic_uint32_t = atomic<uint32_t>; using atomic_int64_t = atomic<int64_t>; using atomic_uint64_t = atomic<uint64_t>; using atomic_int_least8_t = atomic<int_least8_t>; using atomic_uint_least8_t = atomic<uint_least8_t>; using atomic_int_least16_t = atomic<int_least16_t>; using atomic_uint_least16_t = atomic<uint_least16_t>; using atomic_int_least32_t = atomic<int_least32_t>; using atomic_uint_least32_t = atomic<uint_least32_t>; using atomic_int_least64_t = atomic<int_least64_t>; using atomic_uint_least64_t = atomic<uint_least64_t>; using atomic_int_fast8_t = atomic<int_fast8_t>; using atomic_uint_fast8_t = atomic<uint_fast8_t>; using atomic_int_fast16_t = atomic<int_fast16_t>; using atomic_uint_fast16_t = atomic<uint_fast16_t>; using atomic_int_fast32_t = atomic<int_fast32_t>; using atomic_uint_fast32_t = atomic<uint_fast32_t>; using atomic_int_fast64_t = atomic<int_fast64_t>; using atomic_uint_fast64_t = atomic<uint_fast64_t>; using atomic_intptr_t = atomic<intptr_t>; using atomic_uintptr_t = atomic<uintptr_t>; using atomic_size_t = atomic<size_t>; using atomic_ptrdiff_t = atomic<ptrdiff_t>; using atomic_intmax_t = atomic<intmax_t>; using atomic_uintmax_t = atomic<uintmax_t>; using atomic_signed_lock_free = atomic_intptr_t; using atomic_unsigned_lock_free = atomic_uintptr_t; struct atomic_flag { [[nodiscard]] bool test(const memory_order _Order = memory_order_seq_cst) const noexcept { return _Storage.load(_Order) != 0; } [[nodiscard]] bool test(const memory_order _Order = memory_order_seq_cst) const volatile noexcept { return _Storage.load(_Order) != 0; } bool test_and_set(const memory_order _Order = memory_order_seq_cst) noexcept { return _Storage.exchange(true, _Order) != 0; } bool test_and_set(const memory_order _Order = memory_order_seq_cst) volatile noexcept { return _Storage.exchange(true, _Order) != 0; } void clear(const memory_order _Order = memory_order_seq_cst) noexcept { _Storage.store(false, _Order); } void clear(const memory_order _Order = memory_order_seq_cst) volatile noexcept { _Storage.store(false, _Order); } constexpr atomic_flag() noexcept = default; void wait(const bool _Expected, const memory_order _Order = memory_order_seq_cst) const noexcept { _Storage.wait(static_cast<decltype(_Storage)::value_type>(_Expected), _Order); } void wait(const bool _Expected, const memory_order _Order = memory_order_seq_cst) const volatile noexcept { _Storage.wait(static_cast<decltype(_Storage)::value_type>(_Expected), _Order); } void notify_one() noexcept { _Storage.notify_one(); } void notify_one() volatile noexcept { _Storage.notify_one(); } void notify_all() noexcept { _Storage.notify_all(); } void notify_all() volatile noexcept { _Storage.notify_all(); } atomic<long> _Storage; }; [[nodiscard]] inline bool atomic_flag_test(const volatile atomic_flag* const _Flag) noexcept { return _Flag->test(); } [[nodiscard]] inline bool atomic_flag_test(const atomic_flag* const _Flag) noexcept { return _Flag->test(); } [[nodiscard]] inline bool atomic_flag_test_explicit( const volatile atomic_flag* const _Flag, const memory_order _Order) noexcept { return _Flag->test(_Order); } [[nodiscard]] inline bool atomic_flag_test_explicit(const atomic_flag* const _Flag, const memory_order _Order) noexcept { return _Flag->test(_Order); } inline bool atomic_flag_test_and_set(atomic_flag* const _Flag) noexcept { return _Flag->test_and_set(); } inline bool atomic_flag_test_and_set(volatile atomic_flag* const _Flag) noexcept { return _Flag->test_and_set(); } inline bool atomic_flag_test_and_set_explicit(atomic_flag* const _Flag, const memory_order _Order) noexcept { return _Flag->test_and_set(_Order); } inline bool atomic_flag_test_and_set_explicit(volatile atomic_flag* const _Flag, const memory_order _Order) noexcept { return _Flag->test_and_set(_Order); } inline void atomic_flag_clear(atomic_flag* const _Flag) noexcept { _Flag->clear(); } inline void atomic_flag_clear(volatile atomic_flag* const _Flag) noexcept { _Flag->clear(); } inline void atomic_flag_clear_explicit(atomic_flag* const _Flag, const memory_order _Order) noexcept { _Flag->clear(_Order); } inline void atomic_flag_clear_explicit(volatile atomic_flag* const _Flag, const memory_order _Order) noexcept { _Flag->clear(_Order); } inline void atomic_flag_wait(const volatile atomic_flag* const _Flag, const bool _Expected) noexcept { return _Flag->wait(_Expected); } inline void atomic_flag_wait(const atomic_flag* const _Flag, const bool _Expected) noexcept { return _Flag->wait(_Expected); } inline void atomic_flag_wait_explicit( const volatile atomic_flag* const _Flag, const bool _Expected, const memory_order _Order) noexcept { return _Flag->wait(_Expected, _Order); } inline void atomic_flag_wait_explicit( const atomic_flag* const _Flag, const bool _Expected, const memory_order _Order) noexcept { return _Flag->wait(_Expected, _Order); } inline void atomic_flag_notify_one(volatile atomic_flag* const _Flag) noexcept { return _Flag->notify_one(); } inline void atomic_flag_notify_one(atomic_flag* const _Flag) noexcept { return _Flag->notify_one(); } inline void atomic_flag_notify_all(volatile atomic_flag* const _Flag) noexcept { return _Flag->notify_all(); } inline void atomic_flag_notify_all(atomic_flag* const _Flag) noexcept { return _Flag->notify_all(); } template <class _Ty> class _Locked_pointer { public: static_assert(alignof(_Ty) >= (1 << 2), "2 low order bits are needed by _Locked_pointer"); static constexpr uintptr_t _Lock_mask = 3; static constexpr uintptr_t _Not_locked = 0; static constexpr uintptr_t _Locked_notify_not_needed = 1; static constexpr uintptr_t _Locked_notify_needed = 2; static constexpr uintptr_t _Ptr_value_mask = ~_Lock_mask; constexpr _Locked_pointer() noexcept : _Storage{} {} explicit _Locked_pointer(_Ty* const _Ptr) noexcept : _Storage{reinterpret_cast<uintptr_t>(_Ptr)} {} _Locked_pointer(const _Locked_pointer&) = delete; _Locked_pointer& operator=(const _Locked_pointer&) = delete; [[nodiscard]] _Ty* _Lock_and_load() noexcept { uintptr_t _Rep = _Storage.load(memory_order_relaxed); for (;;) { switch (_Rep & _Lock_mask) { case _Not_locked: if (_Storage.compare_exchange_weak(_Rep, _Rep | _Locked_notify_not_needed)) { return reinterpret_cast<_Ty*>(_Rep); } _mm_pause(); break; case _Locked_notify_not_needed: if (!_Storage.compare_exchange_weak(_Rep, (_Rep & _Ptr_value_mask) | _Locked_notify_needed)) { _mm_pause(); break; } _Rep = (_Rep & _Ptr_value_mask) | _Locked_notify_needed; [[fallthrough]]; case _Locked_notify_needed: _Storage.wait(_Rep, memory_order_relaxed); _Rep = _Storage.load(memory_order_relaxed); break; default: :: abort(); } } } void _Store_and_unlock(_Ty* const _Value) noexcept { const auto _Rep = _Storage.exchange(reinterpret_cast<uintptr_t>(_Value)); if ((_Rep & _Lock_mask) == _Locked_notify_needed) { _Storage.notify_all(); } } [[nodiscard]] _Ty* _Unsafe_load_relaxed() const noexcept { return reinterpret_cast<_Ty*>(_Storage.load(memory_order_relaxed)); } private: atomic<uintptr_t> _Storage; }; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { namespace ranges { template <class _In, class _Out> using uninitialized_copy_result = in_out_result<_In, _Out>; class _Uninitialized_copy_fn : private _Not_quite_object { public: using _Not_quite_object::_Not_quite_object; template <input_iterator _It, sentinel_for<_It> _Se, _No_throw_forward_iterator _Out, _No_throw_sentinel_for<_Out> _OSe> requires constructible_from<iter_value_t<_Out>, iter_reference_t<_It>> uninitialized_copy_result<_It, _Out> operator()(_It _First1, _Se _Last1, _Out _First2, _OSe _Last2) const { _Adl_verify_range(_First1, _Last1); _Adl_verify_range(_First2, _Last2); auto _UResult = _Uninitialized_copy_unchecked(_Get_unwrapped(::std:: move(_First1)), _Get_unwrapped(::std:: move(_Last1)), _Get_unwrapped(::std:: move(_First2)), _Get_unwrapped(::std:: move(_Last2))); _Seek_wrapped(_First1, ::std:: move(_UResult.in)); _Seek_wrapped(_First2, ::std:: move(_UResult.out)); return {::std:: move(_First1), ::std:: move(_First2)}; } template <input_range _Rng1, _No_throw_forward_range _Rng2> requires constructible_from<range_value_t<_Rng2>, range_reference_t<_Rng1>> uninitialized_copy_result<borrowed_iterator_t<_Rng1>, borrowed_iterator_t<_Rng2>> operator()( _Rng1&& _Range1, _Rng2&& _Range2) const { auto _First1 = ::std::ranges:: begin(_Range1); auto _UResult = _Uninitialized_copy_unchecked( _Get_unwrapped(::std:: move(_First1)), _Uend(_Range1), _Ubegin(_Range2), _Uend(_Range2)); _Seek_wrapped(_First1, ::std:: move(_UResult.in)); return {::std:: move(_First1), _Rewrap_iterator(_Range2, ::std:: move(_UResult.out))}; } private: template <class _It, class _Se, class _Out, class _OSe> [[nodiscard]] static uninitialized_copy_result<_It, _Out> _Uninitialized_copy_unchecked( _It _IFirst, _Se _ILast, _Out _OFirst, _OSe _OLast) { ; ; ; ; ; if constexpr (_Ptr_copy_cat<_It, _Out>::_Really_trivial && sized_sentinel_for<_Se, _It> && sized_sentinel_for<_OSe, _Out>) { return _Copy_memcpy_common(_IFirst, ::std::ranges:: next(_IFirst, ::std:: move(_ILast)), _OFirst, ::std::ranges:: next(_OFirst, ::std:: move(_OLast))); } else { _Uninitialized_backout _Backout{::std:: move(_OFirst)}; for (; _IFirst != _ILast && _Backout._Last != _OLast; ++_IFirst) { _Backout._Emplace_back(*_IFirst); } return {::std:: move(_IFirst), _Backout._Release()}; } } }; inline constexpr _Uninitialized_copy_fn uninitialized_copy{_Not_quite_object::_Construct_tag{}}; } template <class _InIt, class _Diff, class _NoThrowFwdIt> _NoThrowFwdIt uninitialized_copy_n(const _InIt _First, const _Diff _Count_raw, _NoThrowFwdIt _Dest) { _Algorithm_int_t<_Diff> _Count = _Count_raw; if (_Count <= 0) { return _Dest; } auto _UFirst = _Get_unwrapped_n(_First, _Count); auto _UDest = _Get_unwrapped_n(_Dest, _Count); if constexpr (_Ptr_copy_cat<decltype(_UFirst), decltype(_UDest)>::_Really_trivial) { _UDest = _Copy_memmove(_UFirst, _UFirst + _Count, _UDest); } else { _Uninitialized_backout<decltype(_UDest)> _Backout{_UDest}; for (; _Count > 0; --_Count, (void) ++_UFirst) { _Backout._Emplace_back(*_UFirst); } _UDest = _Backout._Release(); } _Seek_wrapped(_Dest, _UDest); return _Dest; } namespace ranges { template <class _In, class _Out> using uninitialized_copy_n_result = in_out_result<_In, _Out>; class _Uninitialized_copy_n_fn : private _Not_quite_object { public: using _Not_quite_object::_Not_quite_object; template <input_iterator _It, _No_throw_forward_iterator _Out, _No_throw_sentinel_for<_Out> _OSe> requires constructible_from<iter_value_t<_Out>, iter_reference_t<_It>> uninitialized_copy_n_result<_It, _Out> operator()( _It _First1, iter_difference_t<_It> _Count, _Out _First2, _OSe _Last2) const { if (_Count <= 0) { return {::std:: move(_First1), ::std:: move(_First2)}; } _Adl_verify_range(_First2, _Last2); auto _IFirst = _Get_unwrapped_n(::std:: move(_First1), _Count); auto _OFirst = _Get_unwrapped(::std:: move(_First2)); const auto _OLast = _Get_unwrapped(::std:: move(_Last2)); if constexpr (_Ptr_copy_cat<_It, _Out>::_Really_trivial) { auto _UResult = _Copy_memcpy_common(_IFirst, _IFirst + _Count, _OFirst, _OLast); _IFirst = _UResult.in; _OFirst = _UResult.out; } else { _Uninitialized_backout _Backout{::std:: move(_OFirst)}; for (; _Count > 0 && _OFirst != _OLast; --_Count, (void) ++_IFirst) { _Backout._Emplace_back(*_IFirst); } _OFirst = _Backout._Release(); } _Seek_wrapped(_First1, _IFirst); _Seek_wrapped(_First2, _OFirst); return {::std:: move(_First1), ::std:: move(_First2)}; } }; inline constexpr _Uninitialized_copy_n_fn uninitialized_copy_n{_Not_quite_object::_Construct_tag{}}; } template <class _InIt, class _NoThrowFwdIt> _NoThrowFwdIt uninitialized_move(const _InIt _First, const _InIt _Last, _NoThrowFwdIt _Dest) { _Adl_verify_range(_First, _Last); const auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); const auto _UDest = _Get_unwrapped_n(_Dest, _Idl_distance<_InIt>(_UFirst, _ULast)); _Seek_wrapped(_Dest, _Uninitialized_move_unchecked(_UFirst, _ULast, _UDest)); return _Dest; } namespace ranges { class _Uninitialized_move_fn : private _Not_quite_object { public: using _Not_quite_object::_Not_quite_object; template <input_iterator _It, sentinel_for<_It> _Se, _No_throw_forward_iterator _Out, _No_throw_sentinel_for<_Out> _OSe> requires constructible_from<iter_value_t<_Out>, iter_rvalue_reference_t<_It>> uninitialized_move_result<_It, _Out> operator()(_It _First1, _Se _Last1, _Out _First2, _OSe _Last2) const { _Adl_verify_range(_First1, _Last1); _Adl_verify_range(_First2, _Last2); auto _UResult = ::std::ranges:: _Uninitialized_move_unchecked(_Get_unwrapped(::std:: move(_First1)), _Get_unwrapped(::std:: move(_Last1)), _Get_unwrapped(::std:: move(_First2)), _Get_unwrapped(::std:: move(_Last2))); _Seek_wrapped(_First1, ::std:: move(_UResult.in)); _Seek_wrapped(_First2, ::std:: move(_UResult.out)); return {::std:: move(_First1), ::std:: move(_First2)}; } template <input_range _Rng1, _No_throw_forward_range _Rng2> requires constructible_from<range_value_t<_Rng2>, range_rvalue_reference_t<_Rng1>> uninitialized_move_result<borrowed_iterator_t<_Rng1>, borrowed_iterator_t<_Rng2>> operator()( _Rng1&& _Range1, _Rng2&& _Range2) const { auto _First1 = ::std::ranges:: begin(_Range1); auto _UResult = ::std::ranges:: _Uninitialized_move_unchecked( _Get_unwrapped(::std:: move(_First1)), _Uend(_Range1), _Ubegin(_Range2), _Uend(_Range2)); _Seek_wrapped(_First1, ::std:: move(_UResult.in)); return {::std:: move(_First1), _Rewrap_iterator(_Range2, ::std:: move(_UResult.out))}; } }; inline constexpr _Uninitialized_move_fn uninitialized_move{_Not_quite_object::_Construct_tag{}}; } template <class _InIt, class _Diff, class _NoThrowFwdIt> pair<_InIt, _NoThrowFwdIt> uninitialized_move_n(_InIt _First, const _Diff _Count_raw, _NoThrowFwdIt _Dest) { _Algorithm_int_t<_Diff> _Count = _Count_raw; if (_Count <= 0) { return {_First, _Dest}; } auto _UFirst = _Get_unwrapped_n(_First, _Count); auto _UDest = _Get_unwrapped_n(_Dest, _Count); if constexpr (_Ptr_move_cat<decltype(_UFirst), decltype(_UDest)>::_Really_trivial) { _UDest = _Copy_memmove(_UFirst, _UFirst + _Count, _UDest); _UFirst += _Count; } else { _Uninitialized_backout<decltype(_UDest)> _Backout{_UDest}; for (; _Count > 0; --_Count, (void) ++_UFirst) { _Backout._Emplace_back(::std:: move(*_UFirst)); } _UDest = _Backout._Release(); } _Seek_wrapped(_Dest, _UDest); _Seek_wrapped(_First, _UFirst); return {_First, _Dest}; } namespace ranges { template <class _In, class _Out> using uninitialized_move_n_result = in_out_result<_In, _Out>; class _Uninitialized_move_n_fn : private _Not_quite_object { public: using _Not_quite_object::_Not_quite_object; template <input_iterator _It, _No_throw_forward_iterator _Out, _No_throw_sentinel_for<_Out> _OSe> requires constructible_from<iter_value_t<_Out>, iter_rvalue_reference_t<_It>> uninitialized_move_n_result<_It, _Out> operator()( _It _First1, iter_difference_t<_It> _Count, _Out _First2, _OSe _Last2) const { if (_Count <= 0) { return {::std:: move(_First1), ::std:: move(_First2)}; } _Adl_verify_range(_First2, _Last2); auto _IFirst = _Get_unwrapped_n(::std:: move(_First1), _Count); auto _OFirst = _Get_unwrapped(::std:: move(_First2)); const auto _OLast = _Get_unwrapped(::std:: move(_Last2)); if constexpr (_Ptr_move_cat<_It, _Out>::_Really_trivial) { auto _UResult = _Copy_memcpy_common(_IFirst, _IFirst + _Count, _OFirst, _OLast); _IFirst = _UResult.in; _OFirst = _UResult.out; } else { _Uninitialized_backout _Backout{::std:: move(_OFirst)}; for (; _Count > 0 && _Backout._Last != _OLast; --_Count, (void) ++_IFirst) { _Backout._Emplace_back(::std::ranges:: iter_move(_IFirst)); } _OFirst = _Backout._Release(); } _Seek_wrapped(_First1, _IFirst); _Seek_wrapped(_First2, _OFirst); return {::std:: move(_First1), ::std:: move(_First2)}; } }; inline constexpr _Uninitialized_move_n_fn uninitialized_move_n{_Not_quite_object::_Construct_tag{}}; class _Uninitialized_fill_fn : private _Not_quite_object { public: using _Not_quite_object::_Not_quite_object; template <_No_throw_forward_iterator _It, _No_throw_sentinel_for<_It> _Se, class _Ty> requires constructible_from<iter_value_t<_It>, const _Ty&> _It operator()(_It _First, _Se _Last, const _Ty& _Val) const { _Adl_verify_range(_First, _Last); auto _UResult = _Uninitialized_fill_unchecked( _Get_unwrapped(::std:: move(_First)), _Get_unwrapped(::std:: move(_Last)), _Val); _Seek_wrapped(_First, ::std:: move(_UResult)); return _First; } template <_No_throw_forward_range _Rng, class _Ty> requires constructible_from<range_value_t<_Rng>, const _Ty&> borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, const _Ty& _Val) const { return _Rewrap_iterator(_Range, _Uninitialized_fill_unchecked(_Ubegin(_Range), _Uend(_Range), _Val)); } private: template <class _It, class _Se, class _Ty> [[nodiscard]] static _It _Uninitialized_fill_unchecked(_It _OFirst, _Se _OLast, const _Ty& _Val) { ; ; ; if constexpr (_Fill_memset_is_safe<_It, _Ty>) { const auto _OFinal = ::std::ranges:: next(_OFirst, ::std:: move(_OLast)); _Fill_memset(_OFirst, _Val, static_cast<size_t>(_OFinal - _OFirst)); return _OFinal; } else { if constexpr (_Fill_zero_memset_is_safe<_It, _Ty>) { if (_Is_all_bits_zero(_Val)) { const auto _OFinal = ::std::ranges:: next(_OFirst, ::std:: move(_OLast)); _Fill_zero_memset(_OFirst, static_cast<size_t>(_OFinal - _OFirst)); return _OFinal; } } _Uninitialized_backout _Backout{::std:: move(_OFirst)}; while (_Backout._Last != _OLast) { _Backout._Emplace_back(_Val); } return _Backout._Release(); } } }; inline constexpr _Uninitialized_fill_fn uninitialized_fill{_Not_quite_object::_Construct_tag{}}; } template <class _NoThrowFwdIt, class _Diff, class _Tval> _NoThrowFwdIt uninitialized_fill_n(_NoThrowFwdIt _First, const _Diff _Count_raw, const _Tval& _Val) { _Algorithm_int_t<_Diff> _Count = _Count_raw; if (_Count <= 0) { return _First; } auto _UFirst = _Get_unwrapped_n(_First, _Count); if constexpr (_Fill_memset_is_safe<decltype(_UFirst), _Tval>) { _Fill_memset(_UFirst, _Val, static_cast<size_t>(_Count)); _UFirst += _Count; } else { if constexpr (_Fill_zero_memset_is_safe<decltype(_UFirst), _Tval>) { if (_Is_all_bits_zero(_Val)) { _Fill_zero_memset(_UFirst, static_cast<size_t>(_Count)); _Seek_wrapped(_First, _UFirst + _Count); return _First; } } _Uninitialized_backout<decltype(_UFirst)> _Backout{_UFirst}; for (; _Count > 0; --_Count) { _Backout._Emplace_back(_Val); } _UFirst = _Backout._Release(); } _Seek_wrapped(_First, _UFirst); return _First; } namespace ranges { class _Uninitialized_fill_n_fn : private _Not_quite_object { public: using _Not_quite_object::_Not_quite_object; template <_No_throw_forward_iterator _It, class _Ty> requires constructible_from<iter_value_t<_It>, const _Ty&> _It operator()(_It _First, iter_difference_t<_It> _Count, const _Ty& _Val) const { if (_Count <= 0) { return _First; } auto _UFirst = _Get_unwrapped_n(::std:: move(_First), _Count); if constexpr (_Fill_memset_is_safe<decltype(_UFirst), _Ty>) { _Fill_memset(_UFirst, _Val, static_cast<size_t>(_Count)); _Seek_wrapped(_First, _UFirst + _Count); } else { if constexpr (_Fill_zero_memset_is_safe<decltype(_UFirst), _Ty>) { if (_Is_all_bits_zero(_Val)) { _Fill_zero_memset(_UFirst, static_cast<size_t>(_Count)); _Seek_wrapped(_First, _UFirst + _Count); return _First; } } _Uninitialized_backout _Backout{::std:: move(_UFirst)}; for (; _Count > 0; --_Count) { _Backout._Emplace_back(_Val); } _Seek_wrapped(_First, _Backout._Release()); } return _First; } }; inline constexpr _Uninitialized_fill_n_fn uninitialized_fill_n{_Not_quite_object::_Construct_tag{}}; class _Construct_at_fn : private _Not_quite_object { public: using _Not_quite_object::_Not_quite_object; template <class _Ty, class... _Types> requires requires(void* _Void_ptr, _Types&&... _Args) { ::new (_Void_ptr) _Ty(static_cast<_Types&&>(_Args)...); } constexpr _Ty* operator()(_Ty* _Location, _Types&&... _Args) const noexcept(noexcept(::new (const_cast<void*>(static_cast<const volatile void*>(_Location))) _Ty(::std:: forward<_Types>(_Args)...))) { return ::new (const_cast<void*>(static_cast<const volatile void*>(_Location))) _Ty(::std:: forward<_Types>(_Args)...); } }; inline constexpr _Construct_at_fn construct_at{_Not_quite_object::_Construct_tag{}}; template <_No_throw_input_iterator _It, _No_throw_sentinel_for<_It> _Se> requires destructible<iter_value_t<_It>> [[nodiscard]] constexpr _It _Destroy_unchecked(_It _First, _Se _Last) noexcept; class _Destroy_at_fn : private _Not_quite_object { public: using _Not_quite_object::_Not_quite_object; template <destructible _Ty> constexpr void operator()(_Ty* const _Location) const noexcept { if constexpr (is_array_v<_Ty>) { (void) ::std::ranges:: _Destroy_unchecked(::std::ranges:: begin(*_Location), ::std::ranges:: end(*_Location)); } else { _Location->~_Ty(); } } }; inline constexpr _Destroy_at_fn destroy_at{_Not_quite_object::_Construct_tag{}}; } template <class _NoThrowFwdIt> constexpr void destroy(const _NoThrowFwdIt _First, const _NoThrowFwdIt _Last) { _Adl_verify_range(_First, _Last); _Destroy_range(_Get_unwrapped(_First), _Get_unwrapped(_Last)); } namespace ranges { template <_No_throw_input_iterator _It, _No_throw_sentinel_for<_It> _Se> requires destructible<iter_value_t<_It>> [[nodiscard]] constexpr _It _Destroy_unchecked(_It _First, _Se _Last) noexcept { if constexpr (is_trivially_destructible_v<iter_value_t<_It>>) { ::std::ranges:: advance(_First, ::std:: move(_Last)); } else { for (; _First != _Last; ++_First) { ::std::ranges:: destroy_at(::std:: addressof(*_First)); } } return _First; } class _Destroy_fn : private _Not_quite_object { public: using _Not_quite_object::_Not_quite_object; template <_No_throw_input_iterator _It, _No_throw_sentinel_for<_It> _Se> requires destructible<iter_value_t<_It>> constexpr _It operator()(_It _First, _Se _Last) const noexcept { _Adl_verify_range(_First, _Last); _Seek_wrapped(_First, ::std::ranges:: _Destroy_unchecked(_Get_unwrapped(::std:: move(_First)), _Get_unwrapped(::std:: move(_Last)))); return _First; } template <_No_throw_input_range _Rng> requires destructible<range_value_t<_Rng>> constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range) const noexcept { auto _First = ::std::ranges:: begin(_Range); _Seek_wrapped(_First, ::std::ranges:: _Destroy_unchecked(_Get_unwrapped(::std:: move(_First)), _Uend(_Range))); return _First; } }; inline constexpr _Destroy_fn destroy{_Not_quite_object::_Construct_tag{}}; } template <class _NoThrowFwdIt, class _Diff> constexpr _NoThrowFwdIt destroy_n(_NoThrowFwdIt _First, const _Diff _Count_raw) { _Algorithm_int_t<_Diff> _Count = _Count_raw; if (_Count <= 0) { return _First; } auto _UFirst = _Get_unwrapped_n(_First, _Count); if constexpr (is_trivially_destructible_v<_Iter_value_t<_NoThrowFwdIt>>) { ::std:: advance(_UFirst, _Count); } else { for (; _Count > 0; --_Count, (void) ++_UFirst) { _Destroy_in_place(*_UFirst); } } _Seek_wrapped(_First, _UFirst); return _First; } namespace ranges { class _Destroy_n_fn : private _Not_quite_object { public: using _Not_quite_object::_Not_quite_object; template <_No_throw_input_iterator _It> requires destructible<iter_value_t<_It>> constexpr _It operator()(_It _First, const iter_difference_t<_It> _Count_raw) const noexcept { _Algorithm_int_t<iter_difference_t<_It>> _Count = _Count_raw; if (_Count <= 0) { return _First; } auto _UFirst = _Get_unwrapped_n(::std:: move(_First), _Count); if constexpr (is_trivially_destructible_v<iter_value_t<_It>>) { ::std::ranges:: advance(_UFirst, _Count); } else { do { ::std::ranges:: destroy_at(::std:: addressof(*_UFirst)); ++_UFirst; --_Count; } while (_Count > 0); } _Seek_wrapped(_First, ::std:: move(_UFirst)); return _First; } }; inline constexpr _Destroy_n_fn destroy_n{_Not_quite_object::_Construct_tag{}}; } template <class _NoThrowFwdIt> void uninitialized_default_construct(const _NoThrowFwdIt _First, const _NoThrowFwdIt _Last) { using _Ty = remove_reference_t<_Iter_ref_t<_NoThrowFwdIt>>; _Adl_verify_range(_First, _Last); if constexpr (!is_trivially_default_constructible_v<_Ty>) { _Uninitialized_backout _Backout{_Get_unwrapped(_First)}; for (const auto _ULast = _Get_unwrapped(_Last); _Backout._Last != _ULast; ++_Backout._Last) { _Default_construct_in_place(*_Backout._Last); } _Backout._Release(); } } namespace ranges { class _Uninitialized_default_construct_fn : private _Not_quite_object { public: using _Not_quite_object::_Not_quite_object; template <_No_throw_forward_iterator _It, _No_throw_sentinel_for<_It> _Se> requires default_initializable<iter_value_t<_It>> _It operator()(_It _First, _Se _Last) const { _Adl_verify_range(_First, _Last); auto _UResult = _Uninitialized_default_construct_unchecked( _Get_unwrapped(::std:: move(_First)), _Get_unwrapped(::std:: move(_Last))); _Seek_wrapped(_First, ::std:: move(_UResult)); return _First; } template <_No_throw_forward_range _Rng> requires default_initializable<range_value_t<_Rng>> borrowed_iterator_t<_Rng> operator()(_Rng&& _Range) const { auto _UResult = _Uninitialized_default_construct_unchecked(_Ubegin(_Range), _Uend(_Range)); return _Rewrap_iterator(_Range, ::std:: move(_UResult)); } private: template <class _It, class _Se> [[nodiscard]] static _It _Uninitialized_default_construct_unchecked(_It _OFirst, const _Se _OLast) { ; ; ; using _Ty = remove_reference_t<iter_reference_t<_It>>; if constexpr (is_trivially_default_constructible_v<_Ty>) { ::std::ranges:: advance(_OFirst, _OLast); return _OFirst; } else { _Uninitialized_backout _Backout{::std:: move(_OFirst)}; for (; _Backout._Last != _OLast; ++_Backout._Last) { _Default_construct_in_place(*_Backout._Last); } return _Backout._Release(); } } }; inline constexpr _Uninitialized_default_construct_fn uninitialized_default_construct{ _Not_quite_object::_Construct_tag{}}; } template <class _NoThrowFwdIt, class _Diff> _NoThrowFwdIt uninitialized_default_construct_n(_NoThrowFwdIt _First, const _Diff _Count_raw) { using _Ty = _Iter_value_t<_NoThrowFwdIt>; _Algorithm_int_t<_Diff> _Count = _Count_raw; if (_Count <= 0) { return _First; } if constexpr (is_trivially_default_constructible_v<_Ty>) { ::std:: advance(_First, _Count); } else { _Uninitialized_backout _Backout{_Get_unwrapped_n(_First, _Count)}; for (; _Count > 0; ++_Backout._Last, (void) --_Count) { _Default_construct_in_place(*_Backout._Last); } _Seek_wrapped(_First, _Backout._Release()); } return _First; } namespace ranges { class _Uninitialized_default_construct_n_fn : private _Not_quite_object { public: using _Not_quite_object::_Not_quite_object; template <_No_throw_forward_iterator _It> requires default_initializable<iter_value_t<_It>> _It operator()(_It _First, iter_difference_t<_It> _Count) const { if (_Count <= 0) { return _First; } using _Ty = remove_reference_t<iter_reference_t<_It>>; if constexpr (is_trivially_default_constructible_v<_Ty>) { ::std::ranges:: advance(_First, _Count); } else { _Uninitialized_backout _Backout{_Get_unwrapped_n(::std:: move(_First), _Count)}; for (; _Count > 0; --_Count, (void) ++_Backout._Last) { _Default_construct_in_place(*_Backout._Last); } _Seek_wrapped(_First, _Backout._Release()); } return _First; } }; inline constexpr _Uninitialized_default_construct_n_fn uninitialized_default_construct_n{ _Not_quite_object::_Construct_tag{}}; } template <class _NoThrowFwdIt> void uninitialized_value_construct(const _NoThrowFwdIt _First, const _NoThrowFwdIt _Last) { _Adl_verify_range(_First, _Last); const auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); if constexpr (_Use_memset_value_construct_v<_Unwrapped_t<const _NoThrowFwdIt&>>) { _Zero_range(_UFirst, _ULast); } else { _Uninitialized_backout _Backout{_UFirst}; while (_Backout._Last != _ULast) { _Backout._Emplace_back(); } _Backout._Release(); } } namespace ranges { class _Uninitialized_value_construct_fn : private _Not_quite_object { public: using _Not_quite_object::_Not_quite_object; template <_No_throw_forward_iterator _It, _No_throw_sentinel_for<_It> _Se> requires default_initializable<iter_value_t<_It>> _It operator()(_It _First, _Se _Last) const { _Adl_verify_range(_First, _Last); auto _UResult = _Uninitialized_value_construct_unchecked( _Get_unwrapped(::std:: move(_First)), _Get_unwrapped(::std:: move(_Last))); _Seek_wrapped(_First, ::std:: move(_UResult)); return _First; } template <_No_throw_forward_range _Rng> requires default_initializable<range_value_t<_Rng>> borrowed_iterator_t<_Rng> operator()(_Rng&& _Range) const { auto _UResult = _Uninitialized_value_construct_unchecked(_Ubegin(_Range), _Uend(_Range)); return _Rewrap_iterator(_Range, ::std:: move(_UResult)); } private: template <class _It, class _Se> [[nodiscard]] static _It _Uninitialized_value_construct_unchecked(_It _OFirst, _Se _OLast) { ; ; ; if constexpr (_Use_memset_value_construct_v<_It>) { return _Zero_range(_OFirst, ::std::ranges:: next(_OFirst, ::std:: move(_OLast))); } else { _Uninitialized_backout _Backout{::std:: move(_OFirst)}; while (_Backout._Last != _OLast) { _Backout._Emplace_back(); } return _Backout._Release(); } } }; inline constexpr _Uninitialized_value_construct_fn uninitialized_value_construct{ _Not_quite_object::_Construct_tag{}}; } template <class _NoThrowFwdIt, class _Diff> _NoThrowFwdIt uninitialized_value_construct_n(_NoThrowFwdIt _First, const _Diff _Count_raw) { _Algorithm_int_t<_Diff> _Count = _Count_raw; if (_Count <= 0) { return _First; } _Seek_wrapped(_First, _Uninitialized_value_construct_n_unchecked1(_Get_unwrapped_n(_First, _Count), _Count)); return _First; } namespace ranges { class _Uninitialized_value_construct_n_fn : private _Not_quite_object { public: using _Not_quite_object::_Not_quite_object; template <_No_throw_forward_iterator _It> requires default_initializable<iter_value_t<_It>> _It operator()(_It _First, iter_difference_t<_It> _Count) const { if (_Count <= 0) { return _First; } auto _UFirst = _Get_unwrapped_n(::std:: move(_First), _Count); if constexpr (_Use_memset_value_construct_v<_It>) { _Seek_wrapped(_First, _Zero_range(_UFirst, _UFirst + _Count)); } else { _Uninitialized_backout _Backout{::std:: move(_UFirst)}; for (; _Count > 0; --_Count) { _Backout._Emplace_back(); } _Seek_wrapped(_First, _Backout._Release()); } return _First; } }; inline constexpr _Uninitialized_value_construct_n_fn uninitialized_value_construct_n{ _Not_quite_object::_Construct_tag{}}; } class bad_weak_ptr : public exception { public: bad_weak_ptr() noexcept {} [[nodiscard]] virtual const char* what() const noexcept override { return "bad_weak_ptr"; } }; [[noreturn]] inline void _Throw_bad_weak_ptr() { throw bad_weak_ptr{}; } class __declspec(novtable) _Ref_count_base { private: virtual void _Destroy() noexcept = 0; virtual void _Delete_this() noexcept = 0; _Atomic_counter_t _Uses = 1; _Atomic_counter_t _Weaks = 1; protected: constexpr _Ref_count_base() noexcept = default; public: _Ref_count_base(const _Ref_count_base&) = delete; _Ref_count_base& operator=(const _Ref_count_base&) = delete; virtual ~_Ref_count_base() noexcept {} bool _Incref_nz() noexcept { auto& _Volatile_uses = reinterpret_cast<volatile long&>(_Uses); long _Count = __iso_volatile_load32(reinterpret_cast<volatile int*>(&_Volatile_uses)); while (_Count != 0) { const long _Old_value = _InterlockedCompareExchange(&_Volatile_uses, _Count + 1, _Count); if (_Old_value == _Count) { return true; } _Count = _Old_value; } return false; } void _Incref() noexcept { _InterlockedIncrement(reinterpret_cast<volatile long*>(&_Uses)); } void _Incwref() noexcept { _InterlockedIncrement(reinterpret_cast<volatile long*>(&_Weaks)); } void _Decref() noexcept { if (_InterlockedDecrement(reinterpret_cast<volatile long*>(&_Uses)) == 0) { _Destroy(); _Decwref(); } } void _Decwref() noexcept { if (_InterlockedDecrement(reinterpret_cast<volatile long*>(&_Weaks)) == 0) { _Delete_this(); } } long _Use_count() const noexcept { return static_cast<long>(_Uses); } virtual void* _Get_deleter(const type_info&) const noexcept { return nullptr; } }; template <class _Ty> class _Ref_count : public _Ref_count_base { public: explicit _Ref_count(_Ty* _Px) : _Ref_count_base(), _Ptr(_Px) {} private: virtual void _Destroy() noexcept override { delete _Ptr; } virtual void _Delete_this() noexcept override { delete this; } _Ty* _Ptr; }; template <class _Resource, class _Dx> class _Ref_count_resource : public _Ref_count_base { public: _Ref_count_resource(_Resource _Px, _Dx _Dt) : _Ref_count_base(), _Mypair(_One_then_variadic_args_t{}, ::std:: move(_Dt), _Px) {} virtual ~_Ref_count_resource() noexcept override = default; virtual void* _Get_deleter(const type_info& _Typeid) const noexcept override { if (_Typeid == typeid(_Dx)) { return const_cast<_Dx*>(::std:: addressof(_Mypair._Get_first())); } return nullptr; } private: virtual void _Destroy() noexcept override { _Mypair._Get_first()(_Mypair._Myval2); } virtual void _Delete_this() noexcept override { delete this; } _Compressed_pair<_Dx, _Resource> _Mypair; }; template <class _Resource, class _Dx, class _Alloc> class _Ref_count_resource_alloc : public _Ref_count_base { public: _Ref_count_resource_alloc(_Resource _Px, _Dx _Dt, const _Alloc& _Ax) : _Ref_count_base(), _Mypair(_One_then_variadic_args_t{}, ::std:: move(_Dt), _One_then_variadic_args_t{}, _Ax, _Px) {} virtual ~_Ref_count_resource_alloc() noexcept override = default; virtual void* _Get_deleter(const type_info& _Typeid) const noexcept override { if (_Typeid == typeid(_Dx)) { return const_cast<_Dx*>(::std:: addressof(_Mypair._Get_first())); } return nullptr; } private: using _Myalty = _Rebind_alloc_t<_Alloc, _Ref_count_resource_alloc>; virtual void _Destroy() noexcept override { _Mypair._Get_first()(_Mypair._Myval2._Myval2); } virtual void _Delete_this() noexcept override { _Myalty _Al = _Mypair._Myval2._Get_first(); this->~_Ref_count_resource_alloc(); _Deallocate_plain(_Al, this); } _Compressed_pair<_Dx, _Compressed_pair<_Myalty, _Resource>> _Mypair; }; template <class _Ty> struct default_delete; template <class _Ty, class _Dx = default_delete<_Ty>> class unique_ptr; template <class _Ty> class shared_ptr; template <class _Ty> class weak_ptr; template <class _Yty, class = void> struct _Can_enable_shared : false_type {}; template <class _Yty> struct _Can_enable_shared<_Yty, void_t<typename _Yty::_Esft_type>> : is_convertible<remove_cv_t<_Yty>*, typename _Yty::_Esft_type*>::type { }; struct _Exception_ptr_access; template <class _Ty> class _Ptr_base { public: using element_type = remove_extent_t<_Ty>; [[nodiscard]] long use_count() const noexcept { return _Rep ? _Rep->_Use_count() : 0; } template <class _Ty2> [[nodiscard]] bool owner_before(const _Ptr_base<_Ty2>& _Right) const noexcept { return _Rep < _Right._Rep; } _Ptr_base(const _Ptr_base&) = delete; _Ptr_base& operator=(const _Ptr_base&) = delete; protected: [[nodiscard]] element_type* get() const noexcept { return _Ptr; } constexpr _Ptr_base() noexcept = default; ~_Ptr_base() = default; template <class _Ty2> void _Move_construct_from(_Ptr_base<_Ty2>&& _Right) noexcept { _Ptr = _Right._Ptr; _Rep = _Right._Rep; _Right._Ptr = nullptr; _Right._Rep = nullptr; } template <class _Ty2> void _Copy_construct_from(const shared_ptr<_Ty2>& _Other) noexcept { _Other._Incref(); _Ptr = _Other._Ptr; _Rep = _Other._Rep; } template <class _Ty2> void _Alias_construct_from(const shared_ptr<_Ty2>& _Other, element_type* _Px) noexcept { _Other._Incref(); _Ptr = _Px; _Rep = _Other._Rep; } template <class _Ty2> void _Alias_move_construct_from(shared_ptr<_Ty2>&& _Other, element_type* _Px) noexcept { _Ptr = _Px; _Rep = _Other._Rep; _Other._Ptr = nullptr; _Other._Rep = nullptr; } template <class _Ty0> friend class weak_ptr; template <class _Ty2> bool _Construct_from_weak(const weak_ptr<_Ty2>& _Other) noexcept { if (_Other._Rep && _Other._Rep->_Incref_nz()) { _Ptr = _Other._Ptr; _Rep = _Other._Rep; return true; } return false; } void _Incref() const noexcept { if (_Rep) { _Rep->_Incref(); } } void _Decref() noexcept { if (_Rep) { _Rep->_Decref(); } } void _Swap(_Ptr_base& _Right) noexcept { ::std:: swap(_Ptr, _Right._Ptr); ::std:: swap(_Rep, _Right._Rep); } template <class _Ty2> void _Weakly_construct_from(const _Ptr_base<_Ty2>& _Other) noexcept { if (_Other._Rep) { _Ptr = _Other._Ptr; _Rep = _Other._Rep; _Rep->_Incwref(); } else { ; } } template <class _Ty2> void _Weakly_convert_lvalue_avoiding_expired_conversions(const _Ptr_base<_Ty2>& _Other) noexcept { if (_Other._Rep) { _Rep = _Other._Rep; _Rep->_Incwref(); if (_Rep->_Incref_nz()) { _Ptr = _Other._Ptr; _Rep->_Decref(); } else { ; } } else { ; } } template <class _Ty2> void _Weakly_convert_rvalue_avoiding_expired_conversions(_Ptr_base<_Ty2>&& _Other) noexcept { _Rep = _Other._Rep; _Other._Rep = nullptr; if (_Rep && _Rep->_Incref_nz()) { _Ptr = _Other._Ptr; _Rep->_Decref(); } else { ; } _Other._Ptr = nullptr; } void _Incwref() const noexcept { if (_Rep) { _Rep->_Incwref(); } } void _Decwref() noexcept { if (_Rep) { _Rep->_Decwref(); } } private: element_type* _Ptr{nullptr}; _Ref_count_base* _Rep{nullptr}; template <class _Ty0> friend class _Ptr_base; friend shared_ptr<_Ty>; template <class _Ty0> friend struct atomic; friend _Exception_ptr_access; template <class _Dx, class _Ty0> friend _Dx* get_deleter(const shared_ptr<_Ty0>& _Sx) noexcept; }; template <class _Yty, class = void> struct _Can_scalar_delete : false_type {}; template <class _Yty> struct _Can_scalar_delete<_Yty, void_t<decltype(delete ::std:: declval<_Yty*>())>> : true_type {}; template <class _Yty, class = void> struct _Can_array_delete : false_type {}; template <class _Yty> struct _Can_array_delete<_Yty, void_t<decltype(delete[] ::std:: declval<_Yty*>())>> : true_type {}; template <class _Fx, class _Arg, class = void> struct _Can_call_function_object : false_type {}; template <class _Fx, class _Arg> struct _Can_call_function_object<_Fx, _Arg, void_t<decltype(::std:: declval<_Fx>()(::std:: declval<_Arg>()))>> : true_type {}; template <class _Yty, class _Ty> struct _SP_convertible : is_convertible<_Yty*, _Ty*>::type {}; template <class _Yty, class _Uty> struct _SP_convertible<_Yty, _Uty[]> : is_convertible<_Yty (*)[], _Uty (*)[]>::type {}; template <class _Yty, class _Uty, size_t _Ext> struct _SP_convertible<_Yty, _Uty[_Ext]> : is_convertible<_Yty (*)[_Ext], _Uty (*)[_Ext]>::type {}; template <class _Yty, class _Ty> struct _SP_pointer_compatible : is_convertible<_Yty*, _Ty*>::type { }; template <class _Uty, size_t _Ext> struct _SP_pointer_compatible<_Uty[_Ext], _Uty[]> : true_type { }; template <class _Uty, size_t _Ext> struct _SP_pointer_compatible<_Uty[_Ext], const _Uty[]> : true_type { }; template <class _Uty, size_t _Ext> struct _SP_pointer_compatible<_Uty[_Ext], volatile _Uty[]> : true_type { }; template <class _Uty, size_t _Ext> struct _SP_pointer_compatible<_Uty[_Ext], const volatile _Uty[]> : true_type { }; template <class _Ux> struct _Temporary_owner { _Ux* _Ptr; explicit _Temporary_owner(_Ux* const _Ptr_) noexcept : _Ptr(_Ptr_) {} _Temporary_owner(const _Temporary_owner&) = delete; _Temporary_owner& operator=(const _Temporary_owner&) = delete; ~_Temporary_owner() { delete _Ptr; } }; template <class _UxptrOrNullptr, class _Dx> struct _Temporary_owner_del { _UxptrOrNullptr _Ptr; _Dx& _Dt; bool _Call_deleter = true; explicit _Temporary_owner_del(const _UxptrOrNullptr _Ptr_, _Dx& _Dt_) noexcept : _Ptr(_Ptr_), _Dt(_Dt_) {} _Temporary_owner_del(const _Temporary_owner_del&) = delete; _Temporary_owner_del& operator=(const _Temporary_owner_del&) = delete; ~_Temporary_owner_del() { if (_Call_deleter) { _Dt(_Ptr); } } }; template <class _Ty> class shared_ptr : public _Ptr_base<_Ty> { private: using _Mybase = _Ptr_base<_Ty>; public: using typename _Mybase::element_type; using weak_type = weak_ptr<_Ty>; constexpr shared_ptr() noexcept = default; constexpr shared_ptr(nullptr_t) noexcept {} template <class _Ux, enable_if_t<conjunction_v<conditional_t<is_array_v<_Ty>, _Can_array_delete<_Ux>, _Can_scalar_delete<_Ux>>, _SP_convertible<_Ux, _Ty>>, int> = 0> explicit shared_ptr(_Ux* _Px) { if constexpr (is_array_v<_Ty>) { _Setpd(_Px, default_delete<_Ux[]>{}); } else { _Temporary_owner<_Ux> _Owner(_Px); _Set_ptr_rep_and_enable_shared(_Owner._Ptr, new _Ref_count<_Ux>(_Owner._Ptr)); _Owner._Ptr = nullptr; } } template <class _Ux, class _Dx, enable_if_t<conjunction_v<is_move_constructible<_Dx>, _Can_call_function_object<_Dx&, _Ux*&>, _SP_convertible<_Ux, _Ty>>, int> = 0> shared_ptr(_Ux* _Px, _Dx _Dt) { _Setpd(_Px, ::std:: move(_Dt)); } template <class _Ux, class _Dx, class _Alloc, enable_if_t<conjunction_v<is_move_constructible<_Dx>, _Can_call_function_object<_Dx&, _Ux*&>, _SP_convertible<_Ux, _Ty>>, int> = 0> shared_ptr(_Ux* _Px, _Dx _Dt, _Alloc _Ax) { _Setpda(_Px, ::std:: move(_Dt), _Ax); } template <class _Dx, enable_if_t<conjunction_v<is_move_constructible<_Dx>, _Can_call_function_object<_Dx&, nullptr_t&>>, int> = 0> shared_ptr(nullptr_t, _Dx _Dt) { _Setpd(nullptr, ::std:: move(_Dt)); } template <class _Dx, class _Alloc, enable_if_t<conjunction_v<is_move_constructible<_Dx>, _Can_call_function_object<_Dx&, nullptr_t&>>, int> = 0> shared_ptr(nullptr_t, _Dx _Dt, _Alloc _Ax) { _Setpda(nullptr, ::std:: move(_Dt), _Ax); } template <class _Ty2> shared_ptr(const shared_ptr<_Ty2>& _Right, element_type* _Px) noexcept { this->_Alias_construct_from(_Right, _Px); } template <class _Ty2> shared_ptr(shared_ptr<_Ty2>&& _Right, element_type* _Px) noexcept { this->_Alias_move_construct_from(::std:: move(_Right), _Px); } shared_ptr(const shared_ptr& _Other) noexcept { this->_Copy_construct_from(_Other); } template <class _Ty2, enable_if_t<_SP_pointer_compatible<_Ty2, _Ty>::value, int> = 0> shared_ptr(const shared_ptr<_Ty2>& _Other) noexcept { this->_Copy_construct_from(_Other); } shared_ptr(shared_ptr&& _Right) noexcept { this->_Move_construct_from(::std:: move(_Right)); } template <class _Ty2, enable_if_t<_SP_pointer_compatible<_Ty2, _Ty>::value, int> = 0> shared_ptr(shared_ptr<_Ty2>&& _Right) noexcept { this->_Move_construct_from(::std:: move(_Right)); } template <class _Ty2, enable_if_t<_SP_pointer_compatible<_Ty2, _Ty>::value, int> = 0> explicit shared_ptr(const weak_ptr<_Ty2>& _Other) { if (!this->_Construct_from_weak(_Other)) { _Throw_bad_weak_ptr(); } } template <class _Ux, class _Dx, enable_if_t<conjunction_v<_SP_pointer_compatible<_Ux, _Ty>, is_convertible<typename unique_ptr<_Ux, _Dx>::pointer, element_type*>>, int> = 0> shared_ptr(unique_ptr<_Ux, _Dx>&& _Other) { using _Fancy_t = typename unique_ptr<_Ux, _Dx>::pointer; using _Raw_t = typename unique_ptr<_Ux, _Dx>::element_type*; using _Deleter_t = conditional_t<is_reference_v<_Dx>, decltype(::std:: ref(_Other.get_deleter())), _Dx>; const _Fancy_t _Fancy = _Other.get(); if (_Fancy) { const _Raw_t _Raw = _Fancy; const auto _Rx = new _Ref_count_resource<_Fancy_t, _Deleter_t>(_Fancy, _Other.get_deleter()); _Set_ptr_rep_and_enable_shared(_Raw, _Rx); _Other.release(); } } ~shared_ptr() noexcept { this->_Decref(); } shared_ptr& operator=(const shared_ptr& _Right) noexcept { shared_ptr(_Right).swap(*this); return *this; } template <class _Ty2> shared_ptr& operator=(const shared_ptr<_Ty2>& _Right) noexcept { shared_ptr(_Right).swap(*this); return *this; } shared_ptr& operator=(shared_ptr&& _Right) noexcept { shared_ptr(::std:: move(_Right)).swap(*this); return *this; } template <class _Ty2> shared_ptr& operator=(shared_ptr<_Ty2>&& _Right) noexcept { shared_ptr(::std:: move(_Right)).swap(*this); return *this; } template <class _Ux, class _Dx> shared_ptr& operator=(unique_ptr<_Ux, _Dx>&& _Right) { shared_ptr(::std:: move(_Right)).swap(*this); return *this; } void swap(shared_ptr& _Other) noexcept { this->_Swap(_Other); } void reset() noexcept { shared_ptr().swap(*this); } template <class _Ux> void reset(_Ux* _Px) { shared_ptr(_Px).swap(*this); } template <class _Ux, class _Dx> void reset(_Ux* _Px, _Dx _Dt) { shared_ptr(_Px, _Dt).swap(*this); } template <class _Ux, class _Dx, class _Alloc> void reset(_Ux* _Px, _Dx _Dt, _Alloc _Ax) { shared_ptr(_Px, _Dt, _Ax).swap(*this); } using _Mybase::get; template <class _Ty2 = _Ty, enable_if_t<!disjunction_v<is_array<_Ty2>, is_void<_Ty2>>, int> = 0> [[nodiscard]] _Ty2& operator*() const noexcept { return *get(); } template <class _Ty2 = _Ty, enable_if_t<!is_array_v<_Ty2>, int> = 0> [[nodiscard]] _Ty2* operator->() const noexcept { return get(); } template <class _Ty2 = _Ty, class _Elem = element_type, enable_if_t<is_array_v<_Ty2>, int> = 0> [[nodiscard]] _Elem& operator[](ptrdiff_t _Idx) const noexcept { return get()[_Idx]; } explicit operator bool() const noexcept { return get() != nullptr; } private: template <class _UxptrOrNullptr, class _Dx> void _Setpd(const _UxptrOrNullptr _Px, _Dx _Dt) { _Temporary_owner_del<_UxptrOrNullptr, _Dx> _Owner(_Px, _Dt); _Set_ptr_rep_and_enable_shared( _Owner._Ptr, new _Ref_count_resource<_UxptrOrNullptr, _Dx>(_Owner._Ptr, ::std:: move(_Dt))); _Owner._Call_deleter = false; } template <class _UxptrOrNullptr, class _Dx, class _Alloc> void _Setpda(const _UxptrOrNullptr _Px, _Dx _Dt, _Alloc _Ax) { using _Alref_alloc = _Rebind_alloc_t<_Alloc, _Ref_count_resource_alloc<_UxptrOrNullptr, _Dx, _Alloc>>; _Temporary_owner_del<_UxptrOrNullptr, _Dx> _Owner(_Px, _Dt); _Alref_alloc _Alref(_Ax); _Alloc_construct_ptr<_Alref_alloc> _Constructor(_Alref); _Constructor._Allocate(); _Construct_in_place(*_Constructor._Ptr, _Owner._Ptr, ::std:: move(_Dt), _Ax); _Set_ptr_rep_and_enable_shared(_Owner._Ptr, _Unfancy(_Constructor._Ptr)); _Constructor._Ptr = nullptr; _Owner._Call_deleter = false; } template <class _Ty0, class... _Types> friend enable_if_t<!is_array_v<_Ty0>, shared_ptr<_Ty0>> make_shared(_Types&&... _Args); template <class _Ty0, class _Alloc, class... _Types> friend enable_if_t<!is_array_v<_Ty0>, shared_ptr<_Ty0>> allocate_shared(const _Alloc& _Al_arg, _Types&&... _Args); template <class _Ty0> friend enable_if_t<is_bounded_array_v<_Ty0>, shared_ptr<_Ty0>> make_shared(); template <class _Ty0, class _Alloc> friend enable_if_t<is_bounded_array_v<_Ty0>, shared_ptr<_Ty0>> allocate_shared(const _Alloc& _Al_arg); template <class _Ty0> friend enable_if_t<is_bounded_array_v<_Ty0>, shared_ptr<_Ty0>> make_shared(const remove_extent_t<_Ty0>& _Val); template <class _Ty0, class _Alloc> friend enable_if_t<is_bounded_array_v<_Ty0>, shared_ptr<_Ty0>> allocate_shared( const _Alloc& _Al_arg, const remove_extent_t<_Ty0>& _Val); template <class _Ty0> friend enable_if_t<!is_unbounded_array_v<_Ty0>, shared_ptr<_Ty0>> make_shared_for_overwrite(); template <class _Ty0, class _Alloc> friend enable_if_t<!is_unbounded_array_v<_Ty0>, shared_ptr<_Ty0>> allocate_shared_for_overwrite( const _Alloc& _Al_arg); template <class _Ty0, class... _ArgTypes> friend shared_ptr<_Ty0> _Make_shared_unbounded_array(size_t _Count, const _ArgTypes&... _Args); template <class _Ty0, class _Alloc, class... _ArgTypes> friend shared_ptr<_Ty0> _Allocate_shared_unbounded_array( const _Alloc& _Al, size_t _Count, const _ArgTypes&... _Args); template <class _Ux> void _Set_ptr_rep_and_enable_shared(_Ux* const _Px, _Ref_count_base* const _Rx) noexcept { this->_Ptr = _Px; this->_Rep = _Rx; if constexpr (conjunction_v<negation<is_array<_Ty>>, negation<is_volatile<_Ux>>, _Can_enable_shared<_Ux>>) { if (_Px && _Px->_Wptr.expired()) { _Px->_Wptr = shared_ptr<remove_cv_t<_Ux>>(*this, const_cast<remove_cv_t<_Ux>*>(_Px)); } } } void _Set_ptr_rep_and_enable_shared(nullptr_t, _Ref_count_base* const _Rx) noexcept { this->_Ptr = nullptr; this->_Rep = _Rx; } }; template <class _Ty> shared_ptr(weak_ptr<_Ty>) -> shared_ptr<_Ty>; template <class _Ty, class _Dx> shared_ptr(unique_ptr<_Ty, _Dx>) -> shared_ptr<_Ty>; template <class _Ty1, class _Ty2> [[nodiscard]] bool operator==(const shared_ptr<_Ty1>& _Left, const shared_ptr<_Ty2>& _Right) noexcept { return _Left.get() == _Right.get(); } template <class _Ty1, class _Ty2> [[nodiscard]] strong_ordering operator<=>(const shared_ptr<_Ty1>& _Left, const shared_ptr<_Ty2>& _Right) noexcept { return _Left.get() <=> _Right.get(); } template <class _Ty> [[nodiscard]] bool operator==(const shared_ptr<_Ty>& _Left, nullptr_t) noexcept { return _Left.get() == nullptr; } template <class _Ty> [[nodiscard]] strong_ordering operator<=>(const shared_ptr<_Ty>& _Left, nullptr_t) noexcept { return _Left.get() <=> static_cast<typename shared_ptr<_Ty>::element_type*>(nullptr); } template <class _Elem, class _Traits, class _Ty> basic_ostream<_Elem, _Traits>& operator<<(basic_ostream<_Elem, _Traits>& _Out, const shared_ptr<_Ty>& _Px) { return _Out << _Px.get(); } template <class _Ty> void swap(shared_ptr<_Ty>& _Left, shared_ptr<_Ty>& _Right) noexcept { _Left.swap(_Right); } template <class _Ty1, class _Ty2> [[nodiscard]] shared_ptr<_Ty1> static_pointer_cast(const shared_ptr<_Ty2>& _Other) noexcept { const auto _Ptr = static_cast<typename shared_ptr<_Ty1>::element_type*>(_Other.get()); return shared_ptr<_Ty1>(_Other, _Ptr); } template <class _Ty1, class _Ty2> [[nodiscard]] shared_ptr<_Ty1> static_pointer_cast(shared_ptr<_Ty2>&& _Other) noexcept { const auto _Ptr = static_cast<typename shared_ptr<_Ty1>::element_type*>(_Other.get()); return shared_ptr<_Ty1>(::std:: move(_Other), _Ptr); } template <class _Ty1, class _Ty2> [[nodiscard]] shared_ptr<_Ty1> const_pointer_cast(const shared_ptr<_Ty2>& _Other) noexcept { const auto _Ptr = const_cast<typename shared_ptr<_Ty1>::element_type*>(_Other.get()); return shared_ptr<_Ty1>(_Other, _Ptr); } template <class _Ty1, class _Ty2> [[nodiscard]] shared_ptr<_Ty1> const_pointer_cast(shared_ptr<_Ty2>&& _Other) noexcept { const auto _Ptr = const_cast<typename shared_ptr<_Ty1>::element_type*>(_Other.get()); return shared_ptr<_Ty1>(::std:: move(_Other), _Ptr); } template <class _Ty1, class _Ty2> [[nodiscard]] shared_ptr<_Ty1> reinterpret_pointer_cast(const shared_ptr<_Ty2>& _Other) noexcept { const auto _Ptr = reinterpret_cast<typename shared_ptr<_Ty1>::element_type*>(_Other.get()); return shared_ptr<_Ty1>(_Other, _Ptr); } template <class _Ty1, class _Ty2> [[nodiscard]] shared_ptr<_Ty1> reinterpret_pointer_cast(shared_ptr<_Ty2>&& _Other) noexcept { const auto _Ptr = reinterpret_cast<typename shared_ptr<_Ty1>::element_type*>(_Other.get()); return shared_ptr<_Ty1>(::std:: move(_Other), _Ptr); } template <class _Ty1, class _Ty2> [[nodiscard]] shared_ptr<_Ty1> dynamic_pointer_cast(const shared_ptr<_Ty2>& _Other) noexcept { const auto _Ptr = dynamic_cast<typename shared_ptr<_Ty1>::element_type*>(_Other.get()); if (_Ptr) { return shared_ptr<_Ty1>(_Other, _Ptr); } return {}; } template <class _Ty1, class _Ty2> [[nodiscard]] shared_ptr<_Ty1> dynamic_pointer_cast(shared_ptr<_Ty2>&& _Other) noexcept { const auto _Ptr = dynamic_cast<typename shared_ptr<_Ty1>::element_type*>(_Other.get()); if (_Ptr) { return shared_ptr<_Ty1>(::std:: move(_Other), _Ptr); } return {}; } template <class _Dx, class _Ty> [[nodiscard]] _Dx* get_deleter(const shared_ptr<_Ty>& _Sx) noexcept { if (_Sx._Rep) { return static_cast<_Dx*>(_Sx._Rep->_Get_deleter(typeid(_Dx))); } return nullptr; } struct _For_overwrite_tag { explicit _For_overwrite_tag() = default; }; template <class _Ty> class _Ref_count_obj2 : public _Ref_count_base { public: template <class... _Types> explicit _Ref_count_obj2(_Types&&... _Args) : _Ref_count_base() { if constexpr (sizeof...(_Types) == 1 && (is_same_v<_For_overwrite_tag, remove_cvref_t<_Types>> && ...)) { _Default_construct_in_place(_Storage._Value); ((void) _Args, ...); } else { _Construct_in_place(_Storage._Value, ::std:: forward<_Types>(_Args)...); } } virtual ~_Ref_count_obj2() noexcept override { } union { _Wrap<_Ty> _Storage; }; private: virtual void _Destroy() noexcept override { _Destroy_in_place(_Storage._Value); } virtual void _Delete_this() noexcept override { delete this; } }; template <size_t _Align> struct _Alignas_storage_unit { alignas(_Align) char _Space[_Align]; }; enum class _Check_overflow : bool { _Nope, _Yes }; template <class _Refc, _Check_overflow _Check> [[nodiscard]] size_t _Calculate_bytes_for_flexible_array(const size_t _Count) noexcept(_Check == _Check_overflow::_Nope) { constexpr size_t _Align = alignof(_Refc); size_t _Bytes = sizeof(_Refc); if (_Count > 1) { constexpr size_t _Element_size = sizeof(typename _Refc::_Element_type); size_t _Extra_bytes; if constexpr (_Check == _Check_overflow::_Yes) { _Extra_bytes = _Get_size_of_n<_Element_size>(_Count - 1); if (_Extra_bytes > static_cast<size_t>(-1) - _Bytes - (_Align - 1)) { _Throw_bad_array_new_length(); } } else { _Extra_bytes = _Element_size * (_Count - 1); } _Bytes += _Extra_bytes; _Bytes = (_Bytes + _Align - 1) & ~(_Align - 1); } return _Bytes; } template <class _Refc> [[nodiscard]] _Refc* _Allocate_flexible_array(const size_t _Count) { const size_t _Bytes = _Calculate_bytes_for_flexible_array<_Refc, _Check_overflow::_Yes>(_Count); constexpr size_t _Align = alignof(_Refc); if constexpr (_Align > 16ull) { return static_cast<_Refc*>(::operator new (_Bytes, align_val_t{_Align})); } else { return static_cast<_Refc*>(::operator new(_Bytes)); } } template <class _Refc> void _Deallocate_flexible_array(_Refc* const _Ptr) noexcept { constexpr size_t _Align = alignof(_Refc); if constexpr (_Align > 16ull) { ::operator delete (static_cast<void*>(_Ptr), align_val_t{_Align}); } else { ::operator delete(static_cast<void*>(_Ptr)); } } template <class _NoThrowIt> struct [[nodiscard]] _Uninitialized_rev_destroying_backout { _NoThrowIt _First; _NoThrowIt _Last; explicit _Uninitialized_rev_destroying_backout(_NoThrowIt _Dest) noexcept : _First(_Dest), _Last(_Dest) {} _Uninitialized_rev_destroying_backout(const _Uninitialized_rev_destroying_backout&) = delete; _Uninitialized_rev_destroying_backout& operator=(const _Uninitialized_rev_destroying_backout&) = delete; ~_Uninitialized_rev_destroying_backout() { while (_Last != _First) { --_Last; ::std:: destroy_at(::std:: addressof(*_Last)); } } template <class... _Types> void _Emplace_back(_Types&&... _Vals) { _Construct_in_place(*_Last, ::std:: forward<_Types>(_Vals)...); ++_Last; } void _Emplace_back_for_overwrite() { _Default_construct_in_place(*_Last); ++_Last; } _NoThrowIt _Release() noexcept { _First = _Last; return _Last; } }; template <class _Ty> void _Reverse_destroy_multidimensional_n(_Ty* const _Arr, size_t _Size) noexcept { while (_Size > 0) { --_Size; if constexpr (is_array_v<_Ty>) { _Reverse_destroy_multidimensional_n(_Arr[_Size], extent_v<_Ty>); } else { _Destroy_in_place(_Arr[_Size]); } } } template <class _Ty> struct [[nodiscard]] _Reverse_destroy_multidimensional_n_guard { _Ty* _Target; size_t _Index; ~_Reverse_destroy_multidimensional_n_guard() { if (_Target) { _Reverse_destroy_multidimensional_n(_Target, _Index); } } }; template <class _Ty, size_t _Size> void _Uninitialized_copy_multidimensional(const _Ty (&_In)[_Size], _Ty (&_Out)[_Size]) { if constexpr (is_trivial_v<_Ty>) { _Copy_memmove(_In, _In + _Size, _Out); } else if constexpr (is_array_v<_Ty>) { _Reverse_destroy_multidimensional_n_guard<_Ty> _Guard{_Out, 0}; for (size_t& _Idx = _Guard._Index; _Idx < _Size; ++_Idx) { _Uninitialized_copy_multidimensional(_In[_Idx], _Out[_Idx]); } _Guard._Target = nullptr; } else { _Uninitialized_rev_destroying_backout _Backout{_Out}; for (size_t _Idx = 0; _Idx < _Size; ++_Idx) { _Backout._Emplace_back(_In[_Idx]); } _Backout._Release(); } } template <class _Ty> void _Uninitialized_value_construct_multidimensional_n(_Ty* const _Out, const size_t _Size) { using _Item = remove_all_extents_t<_Ty>; if constexpr (_Use_memset_value_construct_v<_Item*>) { _Zero_range(_Out, _Out + _Size); } else if constexpr (is_array_v<_Ty>) { _Reverse_destroy_multidimensional_n_guard<_Ty> _Guard{_Out, 0}; for (size_t& _Idx = _Guard._Index; _Idx < _Size; ++_Idx) { _Uninitialized_value_construct_multidimensional_n(_Out[_Idx], extent_v<_Ty>); } _Guard._Target = nullptr; } else { _Uninitialized_rev_destroying_backout _Backout{_Out}; for (size_t _Idx = 0; _Idx < _Size; ++_Idx) { _Backout._Emplace_back(); } _Backout._Release(); } } template <class _Ty> void _Uninitialized_default_construct_multidimensional_n(_Ty* const _Out, const size_t _Size) { if constexpr (!is_trivially_default_constructible_v<_Ty>) { if constexpr (is_array_v<_Ty>) { _Reverse_destroy_multidimensional_n_guard<_Ty> _Guard{_Out, 0}; for (size_t& _Idx = _Guard._Index; _Idx < _Size; ++_Idx) { _Uninitialized_default_construct_multidimensional_n(_Out[_Idx], extent_v<_Ty>); } _Guard._Target = nullptr; } else { _Uninitialized_rev_destroying_backout _Backout{_Out}; for (size_t _Idx = 0; _Idx < _Size; ++_Idx) { _Backout._Emplace_back_for_overwrite(); } _Backout._Release(); } } } template <class _Ty> void _Uninitialized_fill_multidimensional_n(_Ty* const _Out, const size_t _Size, const _Ty& _Val) { if constexpr (is_array_v<_Ty>) { _Reverse_destroy_multidimensional_n_guard<_Ty> _Guard{_Out, 0}; for (size_t& _Idx = _Guard._Index; _Idx < _Size; ++_Idx) { _Uninitialized_copy_multidimensional(_Val, _Out[_Idx]); } _Guard._Target = nullptr; } else if constexpr (_Fill_memset_is_safe<_Ty*, _Ty>) { _Fill_memset(_Out, _Val, _Size); } else { if constexpr (_Fill_zero_memset_is_safe<_Ty*, _Ty>) { if (_Is_all_bits_zero(_Val)) { _Fill_zero_memset(_Out, _Size); return; } } _Uninitialized_rev_destroying_backout _Backout{_Out}; for (size_t _Idx = 0; _Idx < _Size; ++_Idx) { _Backout._Emplace_back(_Val); } _Backout._Release(); } } template <class _Ty, bool = is_trivially_destructible_v<remove_extent_t<_Ty>>> class _Ref_count_unbounded_array : public _Ref_count_base { public: static_assert(is_unbounded_array_v<_Ty>); using _Element_type = remove_extent_t<_Ty>; explicit _Ref_count_unbounded_array(const size_t _Count) : _Ref_count_base() { _Uninitialized_value_construct_multidimensional_n(_Get_ptr(), _Count); } template <class _Arg> explicit _Ref_count_unbounded_array(const size_t _Count, const _Arg& _Val) : _Ref_count_base() { if constexpr (is_same_v<_For_overwrite_tag, _Arg>) { _Uninitialized_default_construct_multidimensional_n(_Get_ptr(), _Count); } else { _Uninitialized_fill_multidimensional_n(_Get_ptr(), _Count, _Val); } } [[nodiscard]] auto _Get_ptr() noexcept { return ::std:: addressof(_Storage._Value); } private: union { _Wrap<_Element_type> _Storage; }; virtual ~_Ref_count_unbounded_array() noexcept override { } virtual void _Destroy() noexcept override { } virtual void _Delete_this() noexcept override { this->~_Ref_count_unbounded_array(); _Deallocate_flexible_array(this); } }; template <class _Ty> class _Ref_count_unbounded_array<_Ty, false> : public _Ref_count_base { public: static_assert(is_unbounded_array_v<_Ty>); using _Element_type = remove_extent_t<_Ty>; explicit _Ref_count_unbounded_array(const size_t _Count) : _Ref_count_base(), _Size(_Count) { _Uninitialized_value_construct_multidimensional_n(_Get_ptr(), _Size); } template <class _Arg> explicit _Ref_count_unbounded_array(const size_t _Count, const _Arg& _Val) : _Ref_count_base(), _Size(_Count) { if constexpr (is_same_v<_For_overwrite_tag, _Arg>) { _Uninitialized_default_construct_multidimensional_n(_Get_ptr(), _Size); } else { _Uninitialized_fill_multidimensional_n(_Get_ptr(), _Size, _Val); } } [[nodiscard]] auto _Get_ptr() noexcept { return ::std:: addressof(_Storage._Value); } private: size_t _Size; union { _Wrap<_Element_type> _Storage; }; virtual ~_Ref_count_unbounded_array() noexcept override { } virtual void _Destroy() noexcept override { _Reverse_destroy_multidimensional_n(_Get_ptr(), _Size); } virtual void _Delete_this() noexcept override { this->~_Ref_count_unbounded_array(); _Deallocate_flexible_array(this); } }; template <class _Ty> class _Ref_count_bounded_array : public _Ref_count_base { public: static_assert(is_bounded_array_v<_Ty>); _Ref_count_bounded_array() : _Ref_count_base(), _Storage() {} template <class _Arg> explicit _Ref_count_bounded_array(const _Arg& _Val) : _Ref_count_base() { if constexpr (is_same_v<_For_overwrite_tag, _Arg>) { _Uninitialized_default_construct_multidimensional_n(_Storage._Value, extent_v<_Ty>); } else { _Uninitialized_fill_multidimensional_n(_Storage._Value, extent_v<_Ty>, _Val); } } union { _Wrap<_Ty> _Storage; }; private: virtual ~_Ref_count_bounded_array() noexcept override { } virtual void _Destroy() noexcept override { _Destroy_in_place(_Storage); } virtual void _Delete_this() noexcept override { delete this; } }; template <class _Ty, bool = is_empty_v<_Ty> && !is_final_v<_Ty>> class _Ebco_base : private _Ty { private: using _Mybase = _Ty; protected: template <class _Other, enable_if_t<!is_same_v<_Remove_cvref_t<_Other>, _Ebco_base>, int> = 0> constexpr explicit _Ebco_base(_Other&& _Val) noexcept(is_nothrow_constructible_v<_Ty, _Other>) : _Ty(::std:: forward<_Other>(_Val)) {} constexpr _Ty& _Get_val() noexcept { return *this; } constexpr const _Ty& _Get_val() const noexcept { return *this; } }; template <class _Ty> class _Ebco_base<_Ty, false> { private: _Ty _Myval; protected: template <class _Other, enable_if_t<!is_same_v<_Remove_cvref_t<_Other>, _Ebco_base>, int> = 0> constexpr explicit _Ebco_base(_Other&& _Val) noexcept(is_nothrow_constructible_v<_Ty, _Other>) : _Myval(::std:: forward<_Other>(_Val)) {} constexpr _Ty& _Get_val() noexcept { return _Myval; } constexpr const _Ty& _Get_val() const noexcept { return _Myval; } }; template <class _Ty, class _Alloc> class _Ref_count_obj_alloc3 : public _Ebco_base<_Rebind_alloc_t<_Alloc, _Ty>>, public _Ref_count_base { private: static_assert(is_same_v<_Ty, remove_cv_t<_Ty>>, "allocate_shared should remove_cv_t"); using _Rebound = _Rebind_alloc_t<_Alloc, _Ty>; public: template <class... _Types> explicit _Ref_count_obj_alloc3(const _Alloc& _Al_arg, _Types&&... _Args) : _Ebco_base<_Rebound>(_Al_arg), _Ref_count_base() { if constexpr (sizeof...(_Types) == 1 && (is_same_v<_For_overwrite_tag, remove_cvref_t<_Types>> && ...)) { _Default_construct_in_place(_Storage._Value); ((void) _Args, ...); } else { allocator_traits<_Rebound>::construct( this->_Get_val(), ::std:: addressof(_Storage._Value), ::std:: forward<_Types>(_Args)...); } } union { _Wrap<_Ty> _Storage; }; private: virtual ~_Ref_count_obj_alloc3() noexcept override { } virtual void _Destroy() noexcept override { allocator_traits<_Rebound>::destroy(this->_Get_val(), ::std:: addressof(_Storage._Value)); } virtual void _Delete_this() noexcept override { _Rebind_alloc_t<_Alloc, _Ref_count_obj_alloc3> _Al(this->_Get_val()); this->~_Ref_count_obj_alloc3(); _Deallocate_plain(_Al, this); } }; template <class _Alloc> class [[nodiscard]] _Uninitialized_rev_destroying_backout_al { private: using pointer = _Alloc_ptr_t<_Alloc>; public: _Uninitialized_rev_destroying_backout_al(pointer _Dest, _Alloc& _Al_) noexcept : _First(_Dest), _Last(_Dest), _Al(_Al_) {} _Uninitialized_rev_destroying_backout_al(const _Uninitialized_rev_destroying_backout_al&) = delete; _Uninitialized_rev_destroying_backout_al& operator=(const _Uninitialized_rev_destroying_backout_al&) = delete; ~_Uninitialized_rev_destroying_backout_al() { while (_Last != _First) { --_Last; allocator_traits<_Alloc>::destroy(_Al, _Last); } } template <class... _Types> void _Emplace_back(_Types&&... _Vals) { allocator_traits<_Alloc>::construct(_Al, _Unfancy(_Last), ::std:: forward<_Types>(_Vals)...); ++_Last; } pointer _Release() noexcept { _First = _Last; return _Last; } private: pointer _First; pointer _Last; _Alloc& _Al; }; template <class _Ty, class _Alloc> void _Reverse_destroy_multidimensional_n_al(_Ty* const _Arr, size_t _Size, _Alloc& _Al) noexcept { while (_Size > 0) { --_Size; if constexpr (is_array_v<_Ty>) { _Reverse_destroy_multidimensional_n_al(_Arr[_Size], extent_v<_Ty>, _Al); } else { allocator_traits<_Alloc>::destroy(_Al, _Arr + _Size); } } } template <class _Ty, class _Alloc> struct [[nodiscard]] _Reverse_destroy_multidimensional_n_al_guard { _Ty* _Target; size_t _Index; _Alloc& _Al; ~_Reverse_destroy_multidimensional_n_al_guard() { if (_Target) { _Reverse_destroy_multidimensional_n_al(_Target, _Index, _Al); } } }; template <class _Ty, size_t _Size, class _Alloc> void _Uninitialized_copy_multidimensional_al(const _Ty (&_In)[_Size], _Ty (&_Out)[_Size], _Alloc& _Al) { using _Item = remove_all_extents_t<_Ty>; if constexpr (conjunction_v<is_trivial<_Ty>, _Uses_default_construct<_Alloc, _Item*, const _Item&>>) { _Copy_memmove(_In, _In + _Size, _Out); } else if constexpr (is_array_v<_Ty>) { _Reverse_destroy_multidimensional_n_al_guard<_Ty, _Alloc> _Guard{_Out, 0, _Al}; for (size_t& _Idx = _Guard._Index; _Idx < _Size; ++_Idx) { _Uninitialized_copy_multidimensional_al(_In[_Idx], _Out[_Idx], _Al); } _Guard._Target = nullptr; } else { _Uninitialized_rev_destroying_backout_al _Backout{_Out, _Al}; for (size_t _Idx = 0; _Idx < _Size; ++_Idx) { _Backout._Emplace_back(_In[_Idx]); } _Backout._Release(); } } template <class _Ty, class _Alloc> void _Uninitialized_value_construct_multidimensional_n_al(_Ty* const _Out, const size_t _Size, _Alloc& _Al) { using _Item = remove_all_extents_t<_Ty>; if constexpr (_Use_memset_value_construct_v<_Item*> && _Uses_default_construct<_Alloc, _Item*>::value) { _Zero_range(_Out, _Out + _Size); } else if constexpr (is_array_v<_Ty>) { _Reverse_destroy_multidimensional_n_al_guard<_Ty, _Alloc> _Guard{_Out, 0, _Al}; for (size_t& _Idx = _Guard._Index; _Idx < _Size; ++_Idx) { _Uninitialized_value_construct_multidimensional_n_al(_Out[_Idx], extent_v<_Ty>, _Al); } _Guard._Target = nullptr; } else { _Uninitialized_rev_destroying_backout_al _Backout{_Out, _Al}; for (size_t _Idx = 0; _Idx < _Size; ++_Idx) { _Backout._Emplace_back(); } _Backout._Release(); } } template <class _Ty, class _Alloc> void _Uninitialized_fill_multidimensional_n_al(_Ty* const _Out, const size_t _Size, const _Ty& _Val, _Alloc& _Al) { if constexpr (is_array_v<_Ty>) { _Reverse_destroy_multidimensional_n_al_guard<_Ty, _Alloc> _Guard{_Out, 0, _Al}; for (size_t& _Idx = _Guard._Index; _Idx < _Size; ++_Idx) { _Uninitialized_copy_multidimensional_al(_Val, _Out[_Idx], _Al); } _Guard._Target = nullptr; } else if constexpr (_Fill_memset_is_safe<_Ty*, _Ty> && _Uses_default_construct<_Alloc, _Ty*, const _Ty&>::value) { _Fill_memset(_Out, _Val, _Size); } else { if constexpr (_Fill_zero_memset_is_safe<_Ty*, _Ty> && _Uses_default_construct<_Alloc, _Ty*, const _Ty&>::value) { if (_Is_all_bits_zero(_Val)) { _Fill_zero_memset(_Out, _Size); return; } } _Uninitialized_rev_destroying_backout_al _Backout{_Out, _Al}; for (size_t _Idx = 0; _Idx < _Size; ++_Idx) { _Backout._Emplace_back(_Val); } _Backout._Release(); } } template <class _Ty, class _Alloc> class _Ref_count_unbounded_array_alloc : public _Ebco_base<_Rebind_alloc_t<_Alloc, remove_all_extents_t<_Ty>>>, public _Ref_count_base { private: static_assert(is_unbounded_array_v<_Ty>); static_assert(is_same_v<_Ty, remove_cv_t<_Ty>>, "allocate_shared should remove_cv_t"); using _Item = remove_all_extents_t<_Ty>; using _Rebound = _Rebind_alloc_t<_Alloc, _Item>; public: using _Element_type = remove_extent_t<_Ty>; explicit _Ref_count_unbounded_array_alloc(const _Alloc& _Al_arg, const size_t _Count) : _Ebco_base<_Rebound>(_Al_arg), _Ref_count_base(), _Size(_Count) { _Uninitialized_value_construct_multidimensional_n_al(_Get_ptr(), _Size, this->_Get_val()); } template <class _Arg> explicit _Ref_count_unbounded_array_alloc(const _Alloc& _Al_arg, const size_t _Count, const _Arg& _Val) : _Ebco_base<_Rebound>(_Al_arg), _Ref_count_base(), _Size(_Count) { if constexpr (is_same_v<_For_overwrite_tag, _Arg>) { _Uninitialized_default_construct_multidimensional_n(_Get_ptr(), _Size); } else { _Uninitialized_fill_multidimensional_n_al(_Get_ptr(), _Size, _Val, this->_Get_val()); } } [[nodiscard]] auto _Get_ptr() noexcept { return ::std:: addressof(_Storage._Value); } private: size_t _Size; union { _Wrap<_Element_type> _Storage; }; virtual ~_Ref_count_unbounded_array_alloc() noexcept override { } virtual void _Destroy() noexcept override { if constexpr (!conjunction_v<is_trivially_destructible<_Item>, _Uses_default_destroy<_Rebound, _Item*>>) { _Reverse_destroy_multidimensional_n_al(_Get_ptr(), _Size, this->_Get_val()); } } virtual void _Delete_this() noexcept override { constexpr size_t _Align = alignof(_Ref_count_unbounded_array_alloc); using _Storage = _Alignas_storage_unit<_Align>; _Rebind_alloc_t<_Alloc, _Storage> _Al(this->_Get_val()); const size_t _Bytes = _Calculate_bytes_for_flexible_array<_Ref_count_unbounded_array_alloc, _Check_overflow::_Nope>(_Size); const size_t _Storage_units = _Bytes / sizeof(_Storage); this->~_Ref_count_unbounded_array_alloc(); _Al.deallocate(reinterpret_cast<_Storage*>(this), _Storage_units); } }; template <class _Ty, class _Alloc> class _Ref_count_bounded_array_alloc : public _Ebco_base<_Rebind_alloc_t<_Alloc, remove_all_extents_t<_Ty>>>, public _Ref_count_base { private: static_assert(is_bounded_array_v<_Ty>); static_assert(is_same_v<_Ty, remove_cv_t<_Ty>>, "allocate_shared should remove_cv_t"); using _Item = remove_all_extents_t<_Ty>; using _Rebound = _Rebind_alloc_t<_Alloc, _Item>; public: explicit _Ref_count_bounded_array_alloc(const _Alloc& _Al_arg) : _Ebco_base<_Rebound>(_Al_arg), _Ref_count_base() { _Uninitialized_value_construct_multidimensional_n_al(_Storage._Value, extent_v<_Ty>, this->_Get_val()); } template <class _Arg> explicit _Ref_count_bounded_array_alloc(const _Alloc& _Al_arg, const _Arg& _Val) : _Ebco_base<_Rebound>(_Al_arg), _Ref_count_base() { if constexpr (is_same_v<_For_overwrite_tag, _Arg>) { _Uninitialized_default_construct_multidimensional_n( _Storage._Value, extent_v<_Ty>); } else { _Uninitialized_fill_multidimensional_n_al(_Storage._Value, extent_v<_Ty>, _Val, this->_Get_val()); } } union { _Wrap<_Ty> _Storage; }; private: virtual ~_Ref_count_bounded_array_alloc() noexcept override { } virtual void _Destroy() noexcept override { if constexpr (!conjunction_v<is_trivially_destructible<_Item>, _Uses_default_destroy<_Rebound, _Item*>>) { _Reverse_destroy_multidimensional_n_al(_Storage._Value, extent_v<_Ty>, this->_Get_val()); } } virtual void _Delete_this() noexcept override { _Rebind_alloc_t<_Alloc, _Ref_count_bounded_array_alloc> _Al(this->_Get_val()); this->~_Ref_count_bounded_array_alloc(); _Deallocate_plain(_Al, this); } }; template <class _Ty, class... _Types> [[nodiscard]] enable_if_t<!is_array_v<_Ty>, shared_ptr<_Ty>> make_shared(_Types&&... _Args) { const auto _Rx = new _Ref_count_obj2<_Ty>(::std:: forward<_Types>(_Args)...); shared_ptr<_Ty> _Ret; _Ret._Set_ptr_rep_and_enable_shared(::std:: addressof(_Rx->_Storage._Value), _Rx); return _Ret; } template <class _Refc> struct [[nodiscard]] _Global_delete_guard { _Refc* _Target; ~_Global_delete_guard() { if (_Target) { _Deallocate_flexible_array(_Target); } } }; template <class _Ty, class... _ArgTypes> [[nodiscard]] shared_ptr<_Ty> _Make_shared_unbounded_array(const size_t _Count, const _ArgTypes&... _Args) { static_assert(is_unbounded_array_v<_Ty>); using _Refc = _Ref_count_unbounded_array<_Ty>; const auto _Rx = _Allocate_flexible_array<_Refc>(_Count); _Global_delete_guard<_Refc> _Guard{_Rx}; ::new (static_cast<void*>(_Rx)) _Refc(_Count, _Args...); _Guard._Target = nullptr; shared_ptr<_Ty> _Ret; _Ret._Set_ptr_rep_and_enable_shared(_Rx->_Get_ptr(), _Rx); return _Ret; } template <class _Ty> [[nodiscard]] enable_if_t<is_unbounded_array_v<_Ty>, shared_ptr<_Ty>> make_shared(const size_t _Count) { return _Make_shared_unbounded_array<_Ty>(_Count); } template <class _Ty> [[nodiscard]] enable_if_t<is_unbounded_array_v<_Ty>, shared_ptr<_Ty>> make_shared( const size_t _Count, const remove_extent_t<_Ty>& _Val) { return _Make_shared_unbounded_array<_Ty>(_Count, _Val); } template <class _Ty> [[nodiscard]] enable_if_t<is_bounded_array_v<_Ty>, shared_ptr<_Ty>> make_shared() { const auto _Rx = new _Ref_count_bounded_array<_Ty>(); shared_ptr<_Ty> _Ret; _Ret._Set_ptr_rep_and_enable_shared(_Rx->_Storage._Value, _Rx); return _Ret; } template <class _Ty> [[nodiscard]] enable_if_t<is_bounded_array_v<_Ty>, shared_ptr<_Ty>> make_shared(const remove_extent_t<_Ty>& _Val) { const auto _Rx = new _Ref_count_bounded_array<_Ty>(_Val); shared_ptr<_Ty> _Ret; _Ret._Set_ptr_rep_and_enable_shared(_Rx->_Storage._Value, _Rx); return _Ret; } template <class _Ty> [[nodiscard]] enable_if_t<!is_unbounded_array_v<_Ty>, shared_ptr<_Ty>> make_shared_for_overwrite() { shared_ptr<_Ty> _Ret; if constexpr (is_array_v<_Ty>) { const auto _Rx = new _Ref_count_bounded_array<_Ty>(_For_overwrite_tag{}); _Ret._Set_ptr_rep_and_enable_shared(_Rx->_Storage._Value, _Rx); } else { const auto _Rx = new _Ref_count_obj2<_Ty>(_For_overwrite_tag{}); _Ret._Set_ptr_rep_and_enable_shared(::std:: addressof(_Rx->_Storage._Value), _Rx); } return _Ret; } template <class _Ty> [[nodiscard]] enable_if_t<is_unbounded_array_v<_Ty>, shared_ptr<_Ty>> make_shared_for_overwrite(const size_t _Count) { return _Make_shared_unbounded_array<_Ty>(_Count, _For_overwrite_tag{}); } template <class _Ty, class _Alloc, class... _Types> [[nodiscard]] enable_if_t<!is_array_v<_Ty>, shared_ptr<_Ty>> allocate_shared(const _Alloc& _Al, _Types&&... _Args) { using _Refoa = _Ref_count_obj_alloc3<remove_cv_t<_Ty>, _Alloc>; using _Alblock = _Rebind_alloc_t<_Alloc, _Refoa>; _Alblock _Rebound(_Al); _Alloc_construct_ptr<_Alblock> _Constructor{_Rebound}; _Constructor._Allocate(); _Construct_in_place(*_Constructor._Ptr, _Al, ::std:: forward<_Types>(_Args)...); shared_ptr<_Ty> _Ret; const auto _Ptr = reinterpret_cast<_Ty*>(::std:: addressof(_Constructor._Ptr->_Storage._Value)); _Ret._Set_ptr_rep_and_enable_shared(_Ptr, _Unfancy(_Constructor._Release())); return _Ret; } template <class _Alloc> struct _Allocate_n_ptr { _Alloc& _Al; _Alloc_ptr_t<_Alloc> _Ptr; size_t _Nx; _Allocate_n_ptr(_Alloc& _Al_, const size_t _Nx_) : _Al(_Al_), _Ptr(_Al_.allocate(_Nx_)), _Nx(_Nx_) {} ~_Allocate_n_ptr() { if (_Ptr) { _Al.deallocate(_Ptr, _Nx); } } _Allocate_n_ptr(const _Allocate_n_ptr&) = delete; _Allocate_n_ptr& operator=(const _Allocate_n_ptr&) = delete; }; template <class _Ty, class _Alloc, class... _ArgTypes> [[nodiscard]] shared_ptr<_Ty> _Allocate_shared_unbounded_array( const _Alloc& _Al, const size_t _Count, const _ArgTypes&... _Args) { static_assert(is_unbounded_array_v<_Ty>); using _Refc = _Ref_count_unbounded_array_alloc<remove_cv_t<_Ty>, _Alloc>; constexpr size_t _Align = alignof(_Refc); using _Storage = _Alignas_storage_unit<_Align>; _Rebind_alloc_t<_Alloc, _Storage> _Rebound(_Al); const size_t _Bytes = _Calculate_bytes_for_flexible_array<_Refc, _Check_overflow::_Yes>(_Count); const size_t _Storage_units = _Bytes / sizeof(_Storage); _Allocate_n_ptr _Guard{_Rebound, _Storage_units}; const auto _Rx = reinterpret_cast<_Refc*>(_Unfancy(_Guard._Ptr)); ::new (static_cast<void*>(_Rx)) _Refc(_Al, _Count, _Args...); _Guard._Ptr = nullptr; shared_ptr<_Ty> _Ret; _Ret._Set_ptr_rep_and_enable_shared(_Rx->_Get_ptr(), _Rx); return _Ret; } template <class _Ty, class _Alloc> [[nodiscard]] enable_if_t<is_unbounded_array_v<_Ty>, shared_ptr<_Ty>> allocate_shared( const _Alloc& _Al, const size_t _Count) { return _Allocate_shared_unbounded_array<_Ty>(_Al, _Count); } template <class _Ty, class _Alloc> [[nodiscard]] enable_if_t<is_unbounded_array_v<_Ty>, shared_ptr<_Ty>> allocate_shared( const _Alloc& _Al, const size_t _Count, const remove_extent_t<_Ty>& _Val) { return _Allocate_shared_unbounded_array<_Ty>(_Al, _Count, _Val); } template <class _Ty, class _Alloc> [[nodiscard]] enable_if_t<is_bounded_array_v<_Ty>, shared_ptr<_Ty>> allocate_shared(const _Alloc& _Al) { using _Refc = _Ref_count_bounded_array_alloc<remove_cv_t<_Ty>, _Alloc>; using _Alblock = _Rebind_alloc_t<_Alloc, _Refc>; _Alblock _Rebound(_Al); _Alloc_construct_ptr _Constructor{_Rebound}; _Constructor._Allocate(); ::new (_Voidify_iter(_Constructor._Ptr)) _Refc(_Al); shared_ptr<_Ty> _Ret; const auto _Ptr = static_cast<remove_extent_t<_Ty>*>(_Constructor._Ptr->_Storage._Value); _Ret._Set_ptr_rep_and_enable_shared(_Ptr, _Unfancy(_Constructor._Release())); return _Ret; } template <class _Ty, class _Alloc> [[nodiscard]] enable_if_t<is_bounded_array_v<_Ty>, shared_ptr<_Ty>> allocate_shared( const _Alloc& _Al, const remove_extent_t<_Ty>& _Val) { using _Refc = _Ref_count_bounded_array_alloc<remove_cv_t<_Ty>, _Alloc>; using _Alblock = _Rebind_alloc_t<_Alloc, _Refc>; _Alblock _Rebound(_Al); _Alloc_construct_ptr _Constructor{_Rebound}; _Constructor._Allocate(); ::new (_Voidify_iter(_Constructor._Ptr)) _Refc(_Al, _Val); shared_ptr<_Ty> _Ret; const auto _Ptr = static_cast<remove_extent_t<_Ty>*>(_Constructor._Ptr->_Storage._Value); _Ret._Set_ptr_rep_and_enable_shared(_Ptr, _Unfancy(_Constructor._Release())); return _Ret; } template <class _Ty, class _Alloc> [[nodiscard]] enable_if_t<!is_unbounded_array_v<_Ty>, shared_ptr<_Ty>> allocate_shared_for_overwrite(const _Alloc& _Al) { shared_ptr<_Ty> _Ret; if constexpr (is_array_v<_Ty>) { using _Refc = _Ref_count_bounded_array_alloc<remove_cv_t<_Ty>, _Alloc>; using _Alblock = _Rebind_alloc_t<_Alloc, _Refc>; _Alblock _Rebound(_Al); _Alloc_construct_ptr _Constructor{_Rebound}; _Constructor._Allocate(); ::new (_Voidify_iter(_Constructor._Ptr)) _Refc(_Al, _For_overwrite_tag{}); const auto _Ptr = static_cast<remove_extent_t<_Ty>*>(_Constructor._Ptr->_Storage._Value); _Ret._Set_ptr_rep_and_enable_shared(_Ptr, _Unfancy(_Constructor._Release())); } else { using _Refoa = _Ref_count_obj_alloc3<remove_cv_t<_Ty>, _Alloc>; using _Alblock = _Rebind_alloc_t<_Alloc, _Refoa>; _Alblock _Rebound(_Al); _Alloc_construct_ptr<_Alblock> _Constructor{_Rebound}; _Constructor._Allocate(); _Construct_in_place(*_Constructor._Ptr, _Al, _For_overwrite_tag{}); const auto _Ptr = reinterpret_cast<_Ty*>(::std:: addressof(_Constructor._Ptr->_Storage._Value)); _Ret._Set_ptr_rep_and_enable_shared(_Ptr, _Unfancy(_Constructor._Release())); } return _Ret; } template <class _Ty, class _Alloc> [[nodiscard]] enable_if_t<is_unbounded_array_v<_Ty>, shared_ptr<_Ty>> allocate_shared_for_overwrite( const _Alloc& _Al, const size_t _Count) { return _Allocate_shared_unbounded_array<_Ty>(_Al, _Count, _For_overwrite_tag{}); } template <class _Ty> class weak_ptr : public _Ptr_base<_Ty> { public: constexpr weak_ptr() noexcept {} weak_ptr(const weak_ptr& _Other) noexcept { this->_Weakly_construct_from(_Other); } template <class _Ty2, enable_if_t<_SP_pointer_compatible<_Ty2, _Ty>::value, int> = 0> weak_ptr(const shared_ptr<_Ty2>& _Other) noexcept { this->_Weakly_construct_from(_Other); } template <class _Ty2, enable_if_t<_SP_pointer_compatible<_Ty2, _Ty>::value, int> = 0> weak_ptr(const weak_ptr<_Ty2>& _Other) noexcept { this->_Weakly_convert_lvalue_avoiding_expired_conversions(_Other); } weak_ptr(weak_ptr&& _Other) noexcept { this->_Move_construct_from(::std:: move(_Other)); } template <class _Ty2, enable_if_t<_SP_pointer_compatible<_Ty2, _Ty>::value, int> = 0> weak_ptr(weak_ptr<_Ty2>&& _Other) noexcept { this->_Weakly_convert_rvalue_avoiding_expired_conversions(::std:: move(_Other)); } ~weak_ptr() noexcept { this->_Decwref(); } weak_ptr& operator=(const weak_ptr& _Right) noexcept { weak_ptr(_Right).swap(*this); return *this; } template <class _Ty2> weak_ptr& operator=(const weak_ptr<_Ty2>& _Right) noexcept { weak_ptr(_Right).swap(*this); return *this; } weak_ptr& operator=(weak_ptr&& _Right) noexcept { weak_ptr(::std:: move(_Right)).swap(*this); return *this; } template <class _Ty2> weak_ptr& operator=(weak_ptr<_Ty2>&& _Right) noexcept { weak_ptr(::std:: move(_Right)).swap(*this); return *this; } template <class _Ty2> weak_ptr& operator=(const shared_ptr<_Ty2>& _Right) noexcept { weak_ptr(_Right).swap(*this); return *this; } void reset() noexcept { weak_ptr{}.swap(*this); } void swap(weak_ptr& _Other) noexcept { this->_Swap(_Other); } [[nodiscard]] bool expired() const noexcept { return this->use_count() == 0; } [[nodiscard]] shared_ptr<_Ty> lock() const noexcept { shared_ptr<_Ty> _Ret; (void) _Ret._Construct_from_weak(*this); return _Ret; } }; template <class _Ty> weak_ptr(shared_ptr<_Ty>) -> weak_ptr<_Ty>; template <class _Ty> void swap(weak_ptr<_Ty>& _Left, weak_ptr<_Ty>& _Right) noexcept { _Left.swap(_Right); } template <class _Ty> class enable_shared_from_this { public: using _Esft_type = enable_shared_from_this; [[nodiscard]] shared_ptr<_Ty> shared_from_this() { return shared_ptr<_Ty>(_Wptr); } [[nodiscard]] shared_ptr<const _Ty> shared_from_this() const { return shared_ptr<const _Ty>(_Wptr); } [[nodiscard]] weak_ptr<_Ty> weak_from_this() noexcept { return _Wptr; } [[nodiscard]] weak_ptr<const _Ty> weak_from_this() const noexcept { return _Wptr; } protected: constexpr enable_shared_from_this() noexcept : _Wptr() {} enable_shared_from_this(const enable_shared_from_this&) noexcept : _Wptr() { } enable_shared_from_this& operator=(const enable_shared_from_this&) noexcept { return *this; } ~enable_shared_from_this() = default; private: template <class _Yty> friend class shared_ptr; mutable weak_ptr<_Ty> _Wptr; }; template <class _Ty> struct default_delete { constexpr default_delete() noexcept = default; template <class _Ty2, enable_if_t<is_convertible_v<_Ty2*, _Ty*>, int> = 0> default_delete(const default_delete<_Ty2>&) noexcept {} void operator()(_Ty* _Ptr) const noexcept { static_assert(0 < sizeof(_Ty), "can't delete an incomplete type"); delete _Ptr; } }; template <class _Ty> struct default_delete<_Ty[]> { constexpr default_delete() noexcept = default; template <class _Uty, enable_if_t<is_convertible_v<_Uty (*)[], _Ty (*)[]>, int> = 0> default_delete(const default_delete<_Uty[]>&) noexcept {} template <class _Uty, enable_if_t<is_convertible_v<_Uty (*)[], _Ty (*)[]>, int> = 0> void operator()(_Uty* _Ptr) const noexcept { static_assert(0 < sizeof(_Uty), "can't delete an incomplete type"); delete[] _Ptr; } }; template <class _Ty, class _Dx_noref, class = void> struct _Get_deleter_pointer_type { using type = _Ty*; }; template <class _Ty, class _Dx_noref> struct _Get_deleter_pointer_type<_Ty, _Dx_noref, void_t<typename _Dx_noref::pointer>> { using type = typename _Dx_noref::pointer; }; template <class _Dx2> using _Unique_ptr_enable_default_t = enable_if_t<conjunction_v<negation<is_pointer<_Dx2>>, is_default_constructible<_Dx2>>, int>; template <class _Ty, class _Dx > class unique_ptr { public: using pointer = typename _Get_deleter_pointer_type<_Ty, remove_reference_t<_Dx>>::type; using element_type = _Ty; using deleter_type = _Dx; template <class _Dx2 = _Dx, _Unique_ptr_enable_default_t<_Dx2> = 0> constexpr unique_ptr() noexcept : _Mypair(_Zero_then_variadic_args_t{}) {} template <class _Dx2 = _Dx, _Unique_ptr_enable_default_t<_Dx2> = 0> constexpr unique_ptr(nullptr_t) noexcept : _Mypair(_Zero_then_variadic_args_t{}) {} unique_ptr& operator=(nullptr_t) noexcept { reset(); return *this; } template <class _Dx2 = _Dx, _Unique_ptr_enable_default_t<_Dx2> = 0> explicit unique_ptr(pointer _Ptr) noexcept : _Mypair(_Zero_then_variadic_args_t{}, _Ptr) {} template <class _Dx2 = _Dx, enable_if_t<is_constructible_v<_Dx2, const _Dx2&>, int> = 0> unique_ptr(pointer _Ptr, const _Dx& _Dt) noexcept : _Mypair(_One_then_variadic_args_t{}, _Dt, _Ptr) {} template <class _Dx2 = _Dx, enable_if_t<conjunction_v<negation<is_reference<_Dx2>>, is_constructible<_Dx2, _Dx2>>, int> = 0> unique_ptr(pointer _Ptr, _Dx&& _Dt) noexcept : _Mypair(_One_then_variadic_args_t{}, ::std:: move(_Dt), _Ptr) {} template <class _Dx2 = _Dx, enable_if_t<conjunction_v<is_reference<_Dx2>, is_constructible<_Dx2, remove_reference_t<_Dx2>>>, int> = 0> unique_ptr(pointer, remove_reference_t<_Dx>&&) = delete; template <class _Dx2 = _Dx, enable_if_t<is_move_constructible_v<_Dx2>, int> = 0> unique_ptr(unique_ptr&& _Right) noexcept : _Mypair(_One_then_variadic_args_t{}, ::std:: forward<_Dx>(_Right.get_deleter()), _Right.release()) {} template <class _Ty2, class _Dx2, enable_if_t< conjunction_v<negation<is_array<_Ty2>>, is_convertible<typename unique_ptr<_Ty2, _Dx2>::pointer, pointer>, conditional_t<is_reference_v<_Dx>, is_same<_Dx2, _Dx>, is_convertible<_Dx2, _Dx>>>, int> = 0> unique_ptr(unique_ptr<_Ty2, _Dx2>&& _Right) noexcept : _Mypair(_One_then_variadic_args_t{}, ::std:: forward<_Dx2>(_Right.get_deleter()), _Right.release()) {} template <class _Ty2, class _Dx2, enable_if_t<conjunction_v<negation<is_array<_Ty2>>, is_assignable<_Dx&, _Dx2>, is_convertible<typename unique_ptr<_Ty2, _Dx2>::pointer, pointer>>, int> = 0> unique_ptr& operator=(unique_ptr<_Ty2, _Dx2>&& _Right) noexcept { reset(_Right.release()); _Mypair._Get_first() = ::std:: forward<_Dx2>(_Right._Mypair._Get_first()); return *this; } template <class _Dx2 = _Dx, enable_if_t<is_move_assignable_v<_Dx2>, int> = 0> unique_ptr& operator=(unique_ptr&& _Right) noexcept { if (this != ::std:: addressof(_Right)) { reset(_Right.release()); _Mypair._Get_first() = ::std:: forward<_Dx>(_Right._Mypair._Get_first()); } return *this; } void swap(unique_ptr& _Right) noexcept { _Swap_adl(_Mypair._Myval2, _Right._Mypair._Myval2); _Swap_adl(_Mypair._Get_first(), _Right._Mypair._Get_first()); } ~unique_ptr() noexcept { if (_Mypair._Myval2) { _Mypair._Get_first()(_Mypair._Myval2); } } [[nodiscard]] _Dx& get_deleter() noexcept { return _Mypair._Get_first(); } [[nodiscard]] const _Dx& get_deleter() const noexcept { return _Mypair._Get_first(); } [[nodiscard]] add_lvalue_reference_t<_Ty> operator*() const noexcept { return *_Mypair._Myval2; } [[nodiscard]] pointer operator->() const noexcept { return _Mypair._Myval2; } [[nodiscard]] pointer get() const noexcept { return _Mypair._Myval2; } explicit operator bool() const noexcept { return static_cast<bool>(_Mypair._Myval2); } pointer release() noexcept { return ::std:: exchange(_Mypair._Myval2, nullptr); } void reset(pointer _Ptr = nullptr) noexcept { pointer _Old = ::std:: exchange(_Mypair._Myval2, _Ptr); if (_Old) { _Mypair._Get_first()(_Old); } } unique_ptr(const unique_ptr&) = delete; unique_ptr& operator=(const unique_ptr&) = delete; private: template <class, class> friend class unique_ptr; _Compressed_pair<_Dx, pointer> _Mypair; }; template <class _Ty, class _Dx> class unique_ptr<_Ty[], _Dx> { public: using pointer = typename _Get_deleter_pointer_type<_Ty, remove_reference_t<_Dx>>::type; using element_type = _Ty; using deleter_type = _Dx; template <class _Dx2 = _Dx, _Unique_ptr_enable_default_t<_Dx2> = 0> constexpr unique_ptr() noexcept : _Mypair(_Zero_then_variadic_args_t{}) {} template <class _Uty, class _Is_nullptr = is_same<_Uty, nullptr_t>> using _Enable_ctor_reset = enable_if_t<is_same_v<_Uty, pointer> || _Is_nullptr::value || (is_same_v<pointer, element_type*> && is_pointer_v<_Uty> && is_convertible_v<remove_pointer_t<_Uty> (*)[], element_type (*)[]>)>; template <class _Uty, class _Dx2 = _Dx, _Unique_ptr_enable_default_t<_Dx2> = 0, class = _Enable_ctor_reset<_Uty>> explicit unique_ptr(_Uty _Ptr) noexcept : _Mypair(_Zero_then_variadic_args_t{}, _Ptr) {} template <class _Uty, class _Dx2 = _Dx, enable_if_t<is_constructible_v<_Dx2, const _Dx2&>, int> = 0, class = _Enable_ctor_reset<_Uty>> unique_ptr(_Uty _Ptr, const _Dx& _Dt) noexcept : _Mypair(_One_then_variadic_args_t{}, _Dt, _Ptr) {} template <class _Uty, class _Dx2 = _Dx, enable_if_t<conjunction_v<negation<is_reference<_Dx2>>, is_constructible<_Dx2, _Dx2>>, int> = 0, class = _Enable_ctor_reset<_Uty>> unique_ptr(_Uty _Ptr, _Dx&& _Dt) noexcept : _Mypair(_One_then_variadic_args_t{}, ::std:: move(_Dt), _Ptr) {} template <class _Uty, class _Dx2 = _Dx, enable_if_t<conjunction_v<is_reference<_Dx2>, is_constructible<_Dx2, remove_reference_t<_Dx2>>>, int> = 0> unique_ptr(_Uty, remove_reference_t<_Dx>&&) = delete; template <class _Dx2 = _Dx, enable_if_t<is_move_constructible_v<_Dx2>, int> = 0> unique_ptr(unique_ptr&& _Right) noexcept : _Mypair(_One_then_variadic_args_t{}, ::std:: forward<_Dx>(_Right.get_deleter()), _Right.release()) {} template <class _Dx2 = _Dx, enable_if_t<is_move_assignable_v<_Dx2>, int> = 0> unique_ptr& operator=(unique_ptr&& _Right) noexcept { if (this != ::std:: addressof(_Right)) { reset(_Right.release()); _Mypair._Get_first() = ::std:: move(_Right._Mypair._Get_first()); } return *this; } template <class _Uty, class _Ex, class _More, class _UP_pointer = typename unique_ptr<_Uty, _Ex>::pointer, class _UP_element_type = typename unique_ptr<_Uty, _Ex>::element_type> using _Enable_conversion = enable_if_t< conjunction_v<is_array<_Uty>, is_same<pointer, element_type*>, is_same<_UP_pointer, _UP_element_type*>, is_convertible<_UP_element_type (*)[], element_type (*)[]>, _More>>; template <class _Uty, class _Ex, class = _Enable_conversion<_Uty, _Ex, conditional_t<is_reference_v<_Dx>, is_same<_Ex, _Dx>, is_convertible<_Ex, _Dx>>>> unique_ptr(unique_ptr<_Uty, _Ex>&& _Right) noexcept : _Mypair(_One_then_variadic_args_t{}, ::std:: forward<_Ex>(_Right.get_deleter()), _Right.release()) {} template <class _Uty, class _Ex, class = _Enable_conversion<_Uty, _Ex, is_assignable<_Dx&, _Ex>>> unique_ptr& operator=(unique_ptr<_Uty, _Ex>&& _Right) noexcept { reset(_Right.release()); _Mypair._Get_first() = ::std:: forward<_Ex>(_Right._Mypair._Get_first()); return *this; } template <class _Dx2 = _Dx, _Unique_ptr_enable_default_t<_Dx2> = 0> constexpr unique_ptr(nullptr_t) noexcept : _Mypair(_Zero_then_variadic_args_t{}) {} unique_ptr& operator=(nullptr_t) noexcept { reset(); return *this; } void reset(nullptr_t = nullptr) noexcept { reset(pointer()); } void swap(unique_ptr& _Right) noexcept { _Swap_adl(_Mypair._Myval2, _Right._Mypair._Myval2); _Swap_adl(_Mypair._Get_first(), _Right._Mypair._Get_first()); } ~unique_ptr() noexcept { if (_Mypair._Myval2) { _Mypair._Get_first()(_Mypair._Myval2); } } [[nodiscard]] _Dx& get_deleter() noexcept { return _Mypair._Get_first(); } [[nodiscard]] const _Dx& get_deleter() const noexcept { return _Mypair._Get_first(); } [[nodiscard]] _Ty& operator[](size_t _Idx) const noexcept { return _Mypair._Myval2[_Idx]; } [[nodiscard]] pointer get() const noexcept { return _Mypair._Myval2; } explicit operator bool() const noexcept { return static_cast<bool>(_Mypair._Myval2); } pointer release() noexcept { return ::std:: exchange(_Mypair._Myval2, nullptr); } template <class _Uty, class = _Enable_ctor_reset<_Uty, false_type>> void reset(_Uty _Ptr) noexcept { pointer _Old = ::std:: exchange(_Mypair._Myval2, _Ptr); if (_Old) { _Mypair._Get_first()(_Old); } } unique_ptr(const unique_ptr&) = delete; unique_ptr& operator=(const unique_ptr&) = delete; private: template <class, class> friend class unique_ptr; _Compressed_pair<_Dx, pointer> _Mypair; }; template <class _Ty, class... _Types, enable_if_t<!is_array_v<_Ty>, int> = 0> [[nodiscard]] unique_ptr<_Ty> make_unique(_Types&&... _Args) { return unique_ptr<_Ty>(new _Ty(::std:: forward<_Types>(_Args)...)); } template <class _Ty, enable_if_t<is_array_v<_Ty> && extent_v<_Ty> == 0, int> = 0> [[nodiscard]] unique_ptr<_Ty> make_unique(const size_t _Size) { using _Elem = remove_extent_t<_Ty>; return unique_ptr<_Ty>(new _Elem[_Size]()); } template <class _Ty, class... _Types, enable_if_t<extent_v<_Ty> != 0, int> = 0> void make_unique(_Types&&...) = delete; template <class _Ty, enable_if_t<!is_array_v<_Ty>, int> = 0> [[nodiscard]] unique_ptr<_Ty> make_unique_for_overwrite() { return unique_ptr<_Ty>(new _Ty); } template <class _Ty, enable_if_t<is_unbounded_array_v<_Ty>, int> = 0> [[nodiscard]] unique_ptr<_Ty> make_unique_for_overwrite( const size_t _Size) { using _Elem = remove_extent_t<_Ty>; return unique_ptr<_Ty>(new _Elem[_Size]); } template <class _Ty, class... _Types, enable_if_t<is_bounded_array_v<_Ty>, int> = 0> void make_unique_for_overwrite(_Types&&...) = delete; template <class _Ty, class _Dx, enable_if_t<_Is_swappable<_Dx>::value, int> = 0> void swap(unique_ptr<_Ty, _Dx>& _Left, unique_ptr<_Ty, _Dx>& _Right) noexcept { _Left.swap(_Right); } template <class _Ty1, class _Dx1, class _Ty2, class _Dx2> [[nodiscard]] bool operator==(const unique_ptr<_Ty1, _Dx1>& _Left, const unique_ptr<_Ty2, _Dx2>& _Right) { return _Left.get() == _Right.get(); } template <class _Ty1, class _Dx1, class _Ty2, class _Dx2> [[nodiscard]] bool operator<(const unique_ptr<_Ty1, _Dx1>& _Left, const unique_ptr<_Ty2, _Dx2>& _Right) { using _Ptr1 = typename unique_ptr<_Ty1, _Dx1>::pointer; using _Ptr2 = typename unique_ptr<_Ty2, _Dx2>::pointer; using _Common = common_type_t<_Ptr1, _Ptr2>; return less<_Common>{}(_Left.get(), _Right.get()); } template <class _Ty1, class _Dx1, class _Ty2, class _Dx2> [[nodiscard]] bool operator>=(const unique_ptr<_Ty1, _Dx1>& _Left, const unique_ptr<_Ty2, _Dx2>& _Right) { return !(_Left < _Right); } template <class _Ty1, class _Dx1, class _Ty2, class _Dx2> [[nodiscard]] bool operator>(const unique_ptr<_Ty1, _Dx1>& _Left, const unique_ptr<_Ty2, _Dx2>& _Right) { return _Right < _Left; } template <class _Ty1, class _Dx1, class _Ty2, class _Dx2> [[nodiscard]] bool operator<=(const unique_ptr<_Ty1, _Dx1>& _Left, const unique_ptr<_Ty2, _Dx2>& _Right) { return !(_Right < _Left); } template <class _Ty1, class _Dx1, class _Ty2, class _Dx2> requires three_way_comparable_with<typename unique_ptr<_Ty1, _Dx1>::pointer, typename unique_ptr<_Ty2, _Dx2>::pointer> [[nodiscard]] compare_three_way_result_t<typename unique_ptr<_Ty1, _Dx1>::pointer, typename unique_ptr<_Ty2, _Dx2>::pointer> operator<=>(const unique_ptr<_Ty1, _Dx1>& _Left, const unique_ptr<_Ty2, _Dx2>& _Right) { return _Left.get() <=> _Right.get(); } template <class _Ty, class _Dx> [[nodiscard]] bool operator==(const unique_ptr<_Ty, _Dx>& _Left, nullptr_t) noexcept { return !_Left; } template <class _Ty, class _Dx> [[nodiscard]] bool operator<(const unique_ptr<_Ty, _Dx>& _Left, nullptr_t _Right) { using _Ptr = typename unique_ptr<_Ty, _Dx>::pointer; return less<_Ptr>{}(_Left.get(), _Right); } template <class _Ty, class _Dx> [[nodiscard]] bool operator<(nullptr_t _Left, const unique_ptr<_Ty, _Dx>& _Right) { using _Ptr = typename unique_ptr<_Ty, _Dx>::pointer; return less<_Ptr>{}(_Left, _Right.get()); } template <class _Ty, class _Dx> [[nodiscard]] bool operator>=(const unique_ptr<_Ty, _Dx>& _Left, nullptr_t _Right) { return !(_Left < _Right); } template <class _Ty, class _Dx> [[nodiscard]] bool operator>=(nullptr_t _Left, const unique_ptr<_Ty, _Dx>& _Right) { return !(_Left < _Right); } template <class _Ty, class _Dx> [[nodiscard]] bool operator>(const unique_ptr<_Ty, _Dx>& _Left, nullptr_t _Right) { return _Right < _Left; } template <class _Ty, class _Dx> [[nodiscard]] bool operator>(nullptr_t _Left, const unique_ptr<_Ty, _Dx>& _Right) { return _Right < _Left; } template <class _Ty, class _Dx> [[nodiscard]] bool operator<=(const unique_ptr<_Ty, _Dx>& _Left, nullptr_t _Right) { return !(_Right < _Left); } template <class _Ty, class _Dx> [[nodiscard]] bool operator<=(nullptr_t _Left, const unique_ptr<_Ty, _Dx>& _Right) { return !(_Right < _Left); } template <class _Ty, class _Dx> requires three_way_comparable<typename unique_ptr<_Ty, _Dx>::pointer> [[nodiscard]] compare_three_way_result_t<typename unique_ptr<_Ty, _Dx>::pointer> operator<=>( const unique_ptr<_Ty, _Dx>& _Left, nullptr_t) { return _Left.get() <=> static_cast<typename unique_ptr<_Ty, _Dx>::pointer>(nullptr); } template <class _OutTy, class _PxTy, class = void> struct _Can_stream_unique_ptr : false_type {}; template <class _OutTy, class _PxTy> struct _Can_stream_unique_ptr<_OutTy, _PxTy, void_t<decltype(::std:: declval<_OutTy>() << ::std:: declval<_PxTy>().get())>> : true_type {}; template <class _Elem, class _Traits, class _Yty, class _Dx, enable_if_t<_Can_stream_unique_ptr<basic_ostream<_Elem, _Traits>&, const unique_ptr<_Yty, _Dx>&>::value, int> = 0> basic_ostream<_Elem, _Traits>& operator<<(basic_ostream<_Elem, _Traits>& _Out, const unique_ptr<_Yty, _Dx>& _Px) { _Out << _Px.get(); return _Out; } enum class pointer_safety { relaxed, preferred, strict }; inline void declare_reachable(void*) {} template <class _Ty> _Ty* undeclare_reachable(_Ty* _Ptr) { return _Ptr; } inline void declare_no_pointers(char*, size_t) {} inline void undeclare_no_pointers(char*, size_t) {} inline pointer_safety get_pointer_safety() noexcept { return pointer_safety::relaxed; } template <class _Ty = void> struct owner_less; template <class _Ty> struct owner_less<shared_ptr<_Ty>> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef shared_ptr<_Ty> _Unnameable_first_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef shared_ptr<_Ty> _Unnameable_second_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef bool _Unnameable_result; [[nodiscard]] bool operator()(const shared_ptr<_Ty>& _Left, const shared_ptr<_Ty>& _Right) const noexcept { return _Left.owner_before(_Right); } [[nodiscard]] bool operator()(const shared_ptr<_Ty>& _Left, const weak_ptr<_Ty>& _Right) const noexcept { return _Left.owner_before(_Right); } [[nodiscard]] bool operator()(const weak_ptr<_Ty>& _Left, const shared_ptr<_Ty>& _Right) const noexcept { return _Left.owner_before(_Right); } }; template <class _Ty> struct owner_less<weak_ptr<_Ty>> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef weak_ptr<_Ty> _Unnameable_first_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef weak_ptr<_Ty> _Unnameable_second_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef bool _Unnameable_result; [[nodiscard]] bool operator()(const weak_ptr<_Ty>& _Left, const weak_ptr<_Ty>& _Right) const noexcept { return _Left.owner_before(_Right); } [[nodiscard]] bool operator()(const weak_ptr<_Ty>& _Left, const shared_ptr<_Ty>& _Right) const noexcept { return _Left.owner_before(_Right); } [[nodiscard]] bool operator()(const shared_ptr<_Ty>& _Left, const weak_ptr<_Ty>& _Right) const noexcept { return _Left.owner_before(_Right); } }; template <> struct owner_less<void> { template <class _Ty, class _Uty> [[nodiscard]] bool operator()(const shared_ptr<_Ty>& _Left, const shared_ptr<_Uty>& _Right) const noexcept { return _Left.owner_before(_Right); } template <class _Ty, class _Uty> [[nodiscard]] bool operator()(const shared_ptr<_Ty>& _Left, const weak_ptr<_Uty>& _Right) const noexcept { return _Left.owner_before(_Right); } template <class _Ty, class _Uty> [[nodiscard]] bool operator()(const weak_ptr<_Ty>& _Left, const shared_ptr<_Uty>& _Right) const noexcept { return _Left.owner_before(_Right); } template <class _Ty, class _Uty> [[nodiscard]] bool operator()(const weak_ptr<_Ty>& _Left, const weak_ptr<_Uty>& _Right) const noexcept { return _Left.owner_before(_Right); } using is_transparent = int; }; template <class _Ty, class _Dx> struct hash<unique_ptr<_Ty, _Dx>> : _Conditionally_enabled_hash<unique_ptr<_Ty, _Dx>, is_default_constructible_v<hash<typename unique_ptr<_Ty, _Dx>::pointer>>> { static size_t _Do_hash(const unique_ptr<_Ty, _Dx>& _Keyval) noexcept( _Is_nothrow_hashable<typename unique_ptr<_Ty, _Dx>::pointer>::value) { return hash<typename unique_ptr<_Ty, _Dx>::pointer>{}(_Keyval.get()); } }; template <class _Ty> struct hash<shared_ptr<_Ty>> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef shared_ptr<_Ty> _Unnameable_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef size_t _Unnameable_result; [[nodiscard]] size_t operator()(const shared_ptr<_Ty>& _Keyval) const noexcept { return hash<typename shared_ptr<_Ty>::element_type*>()(_Keyval.get()); } }; inline void* align(size_t _Bound, size_t _Size, void*& _Ptr, size_t& _Space) noexcept { size_t _Off = static_cast<size_t>(reinterpret_cast<uintptr_t>(_Ptr) & (_Bound - 1)); if (_Off != 0) { _Off = _Bound - _Off; } if (_Space < _Off || _Space - _Off < _Size) { return nullptr; } _Ptr = static_cast<char*>(_Ptr) + _Off; _Space -= _Off; return _Ptr; } template <size_t _Nx, class _Ty> [[nodiscard]] constexpr _Ty* assume_aligned(_Ty* const _Ptr) noexcept { if (::std:: is_constant_evaluated()) { return _Ptr; } else { return static_cast<_Ty*>(__builtin_assume_aligned(_Ptr, _Nx)); } } extern "C" { void __cdecl _Lock_shared_ptr_spin_lock(); void __cdecl _Unlock_shared_ptr_spin_lock(); } struct _Shared_ptr_spin_lock { _Shared_ptr_spin_lock() { _Lock_shared_ptr_spin_lock(); } ~_Shared_ptr_spin_lock() noexcept { _Unlock_shared_ptr_spin_lock(); } }; template <class _Ty> [[deprecated("warning STL4029: " "std::atomic_*() overloads for shared_ptr are deprecated in C++20. " "The shared_ptr specialization of std::atomic provides superior functionality. " "You can define _SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] [[nodiscard]] bool atomic_is_lock_free(const shared_ptr<_Ty>*) { return false; } template <class _Ty> [[deprecated("warning STL4029: " "std::atomic_*() overloads for shared_ptr are deprecated in C++20. " "The shared_ptr specialization of std::atomic provides superior functionality. " "You can define _SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] [[nodiscard]] shared_ptr<_Ty> atomic_load_explicit( const shared_ptr<_Ty>* _Ptr, memory_order) { _Shared_ptr_spin_lock _Lock; shared_ptr<_Ty> _Result = *_Ptr; return _Result; } template <class _Ty> [[deprecated("warning STL4029: " "std::atomic_*() overloads for shared_ptr are deprecated in C++20. " "The shared_ptr specialization of std::atomic provides superior functionality. " "You can define _SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] [[nodiscard]] shared_ptr<_Ty> atomic_load( const shared_ptr<_Ty>* _Ptr) { return ::std:: atomic_load_explicit(_Ptr, memory_order_seq_cst); } template <class _Ty> [[deprecated("warning STL4029: " "std::atomic_*() overloads for shared_ptr are deprecated in C++20. " "The shared_ptr specialization of std::atomic provides superior functionality. " "You can define _SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] void atomic_store_explicit( shared_ptr<_Ty>* _Ptr, shared_ptr<_Ty> _Other, memory_order) { _Shared_ptr_spin_lock _Lock; _Ptr->swap(_Other); } template <class _Ty> [[deprecated("warning STL4029: " "std::atomic_*() overloads for shared_ptr are deprecated in C++20. " "The shared_ptr specialization of std::atomic provides superior functionality. " "You can define _SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] void atomic_store( shared_ptr<_Ty>* _Ptr, shared_ptr<_Ty> _Other) { ::std:: atomic_store_explicit(_Ptr, ::std:: move(_Other), memory_order_seq_cst); } template <class _Ty> [[deprecated("warning STL4029: " "std::atomic_*() overloads for shared_ptr are deprecated in C++20. " "The shared_ptr specialization of std::atomic provides superior functionality. " "You can define _SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] shared_ptr<_Ty> atomic_exchange_explicit( shared_ptr<_Ty>* _Ptr, shared_ptr<_Ty> _Other, memory_order) { _Shared_ptr_spin_lock _Lock; _Ptr->swap(_Other); return _Other; } template <class _Ty> [[deprecated("warning STL4029: " "std::atomic_*() overloads for shared_ptr are deprecated in C++20. " "The shared_ptr specialization of std::atomic provides superior functionality. " "You can define _SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] shared_ptr<_Ty> atomic_exchange( shared_ptr<_Ty>* _Ptr, shared_ptr<_Ty> _Other) { return ::std:: atomic_exchange_explicit(_Ptr, ::std:: move(_Other), memory_order_seq_cst); } template <class _Ty> [[deprecated("warning STL4029: " "std::atomic_*() overloads for shared_ptr are deprecated in C++20. " "The shared_ptr specialization of std::atomic provides superior functionality. " "You can define _SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] bool atomic_compare_exchange_weak_explicit(shared_ptr<_Ty>* _Ptr, shared_ptr<_Ty>* _Exp, shared_ptr<_Ty> _Value, memory_order, memory_order) { shared_ptr<_Ty> _Old_exp; _Shared_ptr_spin_lock _Lock; bool _Success = _Ptr->get() == _Exp->get() && !_Ptr->owner_before(*_Exp) && !_Exp->owner_before(*_Ptr); if (_Success) { _Ptr->swap(_Value); } else { _Exp->swap(_Old_exp); *_Exp = *_Ptr; } return _Success; } template <class _Ty> [[deprecated("warning STL4029: " "std::atomic_*() overloads for shared_ptr are deprecated in C++20. " "The shared_ptr specialization of std::atomic provides superior functionality. " "You can define _SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] bool atomic_compare_exchange_weak( shared_ptr<_Ty>* _Ptr, shared_ptr<_Ty>* _Exp, shared_ptr<_Ty> _Value) { return ::std:: atomic_compare_exchange_weak_explicit( _Ptr, _Exp, ::std:: move(_Value), memory_order_seq_cst, memory_order_seq_cst); } template <class _Ty> [[deprecated("warning STL4029: " "std::atomic_*() overloads for shared_ptr are deprecated in C++20. " "The shared_ptr specialization of std::atomic provides superior functionality. " "You can define _SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] bool atomic_compare_exchange_strong_explicit(shared_ptr<_Ty>* _Ptr, shared_ptr<_Ty>* _Exp, shared_ptr<_Ty> _Value, memory_order, memory_order) { return ::std:: atomic_compare_exchange_weak_explicit( _Ptr, _Exp, ::std:: move(_Value), memory_order_seq_cst, memory_order_seq_cst); } template <class _Ty> [[deprecated("warning STL4029: " "std::atomic_*() overloads for shared_ptr are deprecated in C++20. " "The shared_ptr specialization of std::atomic provides superior functionality. " "You can define _SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] bool atomic_compare_exchange_strong( shared_ptr<_Ty>* _Ptr, shared_ptr<_Ty>* _Exp, shared_ptr<_Ty> _Value) { return ::std:: atomic_compare_exchange_strong_explicit( _Ptr, _Exp, ::std:: move(_Value), memory_order_seq_cst, memory_order_seq_cst); } template <class _Ty> class alignas(2 * sizeof(void*)) _Atomic_ptr_base { protected: constexpr _Atomic_ptr_base() noexcept = default; _Atomic_ptr_base(_Ty* const _Px, _Ref_count_base* const _Ref) noexcept : _Ptr(_Px), _Repptr(_Ref) {} void _Wait(_Ty* _Old, memory_order) const noexcept { for (;;) { auto _Rep = _Repptr._Lock_and_load(); bool _Equal = _Ptr.load(memory_order_relaxed) == _Old; _Repptr._Store_and_unlock(_Rep); if (!_Equal) { break; } __std_atomic_wait_direct(&_Ptr, &_Old, sizeof(_Old), _Atomic_wait_no_timeout); } } void notify_one() noexcept { _Ptr.notify_one(); } void notify_all() noexcept { _Ptr.notify_all(); } atomic<_Ty*> _Ptr{nullptr}; mutable _Locked_pointer<_Ref_count_base> _Repptr; }; template <class _Ty> struct atomic<shared_ptr<_Ty>> : private _Atomic_ptr_base<_Ty> { private: using _Base = _Atomic_ptr_base<_Ty>; public: using value_type = shared_ptr<_Ty>; static constexpr bool is_always_lock_free = false; [[nodiscard]] bool is_lock_free() const noexcept { return false; } void store(shared_ptr<_Ty> _Value, const memory_order _Order = memory_order_seq_cst) noexcept { _Check_store_memory_order(_Order); const auto _Rep = this->_Repptr._Lock_and_load(); _Ty* const _Tmp = _Value._Ptr; _Value._Ptr = this->_Ptr.load(memory_order_relaxed); this->_Ptr.store(_Tmp, memory_order_relaxed); this->_Repptr._Store_and_unlock(_Value._Rep); _Value._Rep = _Rep; } [[nodiscard]] shared_ptr<_Ty> load(const memory_order _Order = memory_order_seq_cst) const noexcept { _Check_load_memory_order(_Order); shared_ptr<_Ty> _Result; const auto _Rep = this->_Repptr._Lock_and_load(); _Result._Ptr = this->_Ptr.load(memory_order_relaxed); _Result._Rep = _Rep; _Result._Incref(); this->_Repptr._Store_and_unlock(_Rep); return _Result; } operator shared_ptr<_Ty>() const noexcept { return load(); } shared_ptr<_Ty> exchange(shared_ptr<_Ty> _Value, const memory_order _Order = memory_order_seq_cst) noexcept { _Check_memory_order(_Order); shared_ptr<_Ty> _Result; _Result._Rep = this->_Repptr._Lock_and_load(); _Result._Ptr = this->_Ptr.load(memory_order_relaxed); this->_Ptr.store(_Value._Ptr, memory_order_relaxed); this->_Repptr._Store_and_unlock(_Value._Rep); _Value._Ptr = nullptr; _Value._Rep = nullptr; return _Result; } bool compare_exchange_weak(shared_ptr<_Ty>& _Expected, shared_ptr<_Ty> _Desired, const memory_order _Success, const memory_order _Failure) noexcept { return compare_exchange_strong(_Expected, ::std:: move(_Desired), _Combine_cas_memory_orders(_Success, _Failure)); } bool compare_exchange_strong(shared_ptr<_Ty>& _Expected, shared_ptr<_Ty> _Desired, const memory_order _Success, const memory_order _Failure) noexcept { return compare_exchange_strong(_Expected, ::std:: move(_Desired), _Combine_cas_memory_orders(_Success, _Failure)); } bool compare_exchange_weak(shared_ptr<_Ty>& _Expected, shared_ptr<_Ty> _Desired, const memory_order _Order = memory_order_seq_cst) noexcept { return compare_exchange_strong(_Expected, ::std:: move(_Desired), _Order); } bool compare_exchange_strong(shared_ptr<_Ty>& _Expected, shared_ptr<_Ty> _Desired, const memory_order _Order = memory_order_seq_cst) noexcept { _Check_memory_order(_Order); auto _Rep = this->_Repptr._Lock_and_load(); if (this->_Ptr.load(memory_order_relaxed) == _Expected._Ptr && _Rep == _Expected._Rep) { _Ty* const _Tmp = _Desired._Ptr; _Desired._Ptr = this->_Ptr.load(memory_order_relaxed); this->_Ptr.store(_Tmp, memory_order_relaxed); ::std:: swap(_Rep, _Desired._Rep); this->_Repptr._Store_and_unlock(_Rep); return true; } _Ref_count_base* _Expected_rep = _Expected._Rep; _Expected._Ptr = this->_Ptr.load(memory_order_relaxed); _Expected._Rep = _Rep; _Expected._Incref(); this->_Repptr._Store_and_unlock(_Rep); if (_Expected_rep) { _Expected_rep->_Decref(); } return false; } void wait(shared_ptr<_Ty> _Old, memory_order _Order = memory_order_seq_cst) const noexcept { this->_Wait(_Old._Ptr, _Order); } using _Base::notify_all; using _Base::notify_one; constexpr atomic() noexcept = default; atomic(const shared_ptr<_Ty> _Value) noexcept : _Base(_Value._Ptr, _Value._Rep) { _Value._Incref(); } atomic(const atomic&) = delete; void operator=(const atomic&) = delete; void operator=(shared_ptr<_Ty> _Value) noexcept { store(::std:: move(_Value)); } ~atomic() { const auto _Rep = this->_Repptr._Unsafe_load_relaxed(); if (_Rep) { _Rep->_Decref(); } } }; template <class _Ty> struct atomic<weak_ptr<_Ty>> : private _Atomic_ptr_base<_Ty> { private: using _Base = _Atomic_ptr_base<_Ty>; public: using value_type = weak_ptr<_Ty>; static constexpr bool is_always_lock_free = false; [[nodiscard]] bool is_lock_free() const noexcept { return false; } void store(weak_ptr<_Ty> _Value, const memory_order _Order = memory_order_seq_cst) noexcept { _Check_store_memory_order(_Order); const auto _Rep = this->_Repptr._Lock_and_load(); _Ty* const _Tmp = _Value._Ptr; _Value._Ptr = this->_Ptr.load(memory_order_relaxed); this->_Ptr.store(_Tmp, memory_order_relaxed); this->_Repptr._Store_and_unlock(_Value._Rep); _Value._Rep = _Rep; } [[nodiscard]] weak_ptr<_Ty> load(const memory_order _Order = memory_order_seq_cst) const noexcept { _Check_load_memory_order(_Order); weak_ptr<_Ty> _Result; const auto _Rep = this->_Repptr._Lock_and_load(); _Result._Ptr = this->_Ptr.load(memory_order_relaxed); _Result._Rep = _Rep; _Result._Incwref(); this->_Repptr._Store_and_unlock(_Rep); return _Result; } operator weak_ptr<_Ty>() const noexcept { return load(); } weak_ptr<_Ty> exchange(weak_ptr<_Ty> _Value, const memory_order _Order = memory_order_seq_cst) noexcept { _Check_memory_order(_Order); weak_ptr<_Ty> _Result; _Result._Rep = this->_Repptr._Lock_and_load(); _Result._Ptr = this->_Ptr.load(memory_order_relaxed); this->_Ptr.store(_Value._Ptr, memory_order_relaxed); this->_Repptr._Store_and_unlock(_Value._Rep); _Value._Ptr = nullptr; _Value._Rep = nullptr; return _Result; } bool compare_exchange_weak(weak_ptr<_Ty>& _Expected, weak_ptr<_Ty> _Desired, const memory_order _Success, const memory_order _Failure) noexcept { return compare_exchange_strong(_Expected, ::std:: move(_Desired), _Combine_cas_memory_orders(_Success, _Failure)); } bool compare_exchange_strong(weak_ptr<_Ty>& _Expected, weak_ptr<_Ty> _Desired, const memory_order _Success, const memory_order _Failure) noexcept { return compare_exchange_strong(_Expected, ::std:: move(_Desired), _Combine_cas_memory_orders(_Success, _Failure)); } bool compare_exchange_weak( weak_ptr<_Ty>& _Expected, weak_ptr<_Ty> _Desired, const memory_order _Order = memory_order_seq_cst) noexcept { return compare_exchange_strong(_Expected, ::std:: move(_Desired), _Order); } bool compare_exchange_strong( weak_ptr<_Ty>& _Expected, weak_ptr<_Ty> _Desired, const memory_order _Order = memory_order_seq_cst) noexcept { _Check_memory_order(_Order); auto _Rep = this->_Repptr._Lock_and_load(); if (this->_Ptr.load(memory_order_relaxed) == _Expected._Ptr && _Rep == _Expected._Rep) { _Ty* const _Tmp = _Desired._Ptr; _Desired._Ptr = this->_Ptr.load(memory_order_relaxed); this->_Ptr.store(_Tmp, memory_order_relaxed); ::std:: swap(_Rep, _Desired._Rep); this->_Repptr._Store_and_unlock(_Rep); return true; } const auto _Expected_rep = _Expected._Rep; _Expected._Ptr = this->_Ptr.load(memory_order_relaxed); _Expected._Rep = _Rep; _Expected._Incwref(); this->_Repptr._Store_and_unlock(_Rep); if (_Expected_rep) { _Expected_rep->_Decwref(); } return false; } void wait(weak_ptr<_Ty> _Old, memory_order _Order = memory_order_seq_cst) const noexcept { this->_Wait(_Old._Ptr, _Order); } using _Base::notify_all; using _Base::notify_one; constexpr atomic() noexcept = default; atomic(const weak_ptr<_Ty> _Value) noexcept : _Base(_Value._Ptr, _Value._Rep) { _Value._Incwref(); } atomic(const atomic&) = delete; void operator=(const atomic&) = delete; void operator=(weak_ptr<_Ty> _Value) noexcept { store(::std:: move(_Value)); } ~atomic() { const auto _Rep = this->_Repptr._Unsafe_load_relaxed(); if (_Rep) { _Rep->_Decwref(); } } }; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) [[nodiscard]] inline float acos( float _Xx) noexcept { return :: acosf(_Xx); } [[nodiscard]] inline float acosh( float _Xx) noexcept { return :: acoshf(_Xx); } [[nodiscard]] inline float asin( float _Xx) noexcept { return :: asinf(_Xx); } [[nodiscard]] inline float asinh( float _Xx) noexcept { return :: asinhf(_Xx); } [[nodiscard]] inline float atan( float _Xx) noexcept { return :: atanf(_Xx); } [[nodiscard]] inline float atanh( float _Xx) noexcept { return :: atanhf(_Xx); } [[nodiscard]] inline float atan2( float _Yx, float _Xx) noexcept { return :: atan2f(_Yx, _Xx); } [[nodiscard]] inline float cbrt( float _Xx) noexcept { return :: cbrtf(_Xx); } [[nodiscard]] inline float ceil( float _Xx) noexcept { return __ceilf(_Xx); } [[nodiscard]] inline float copysign( float _Number, float _Sign) noexcept { return __copysignf(_Number, _Sign); } [[nodiscard]] inline float cos( float _Xx) noexcept { return :: cosf(_Xx); } [[nodiscard]] inline float cosh( float _Xx) noexcept { return :: coshf(_Xx); } [[nodiscard]] inline float erf( float _Xx) noexcept { return :: erff(_Xx); } [[nodiscard]] inline float erfc( float _Xx) noexcept { return :: erfcf(_Xx); } [[nodiscard]] inline float exp( float _Xx) noexcept { return :: expf(_Xx); } [[nodiscard]] inline float exp2( float _Xx) noexcept { return :: exp2f(_Xx); } [[nodiscard]] inline float expm1( float _Xx) noexcept { return :: expm1f(_Xx); } [[nodiscard]] inline float fabs( float _Xx) noexcept { return :: fabsf(_Xx); } [[nodiscard]] inline float fdim( float _Xx, float _Yx) noexcept { return :: fdimf(_Xx, _Yx); } [[nodiscard]] inline float floor( float _Xx) noexcept { return __floorf(_Xx); } [[nodiscard]] inline float fma( float _Xx, float _Yx, float _Zx) noexcept { return :: fmaf(_Xx, _Yx, _Zx); } [[nodiscard]] inline float fmax( float _Xx, float _Yx) noexcept { return :: fmaxf(_Xx, _Yx); } [[nodiscard]] inline float fmin( float _Xx, float _Yx) noexcept { return :: fminf(_Xx, _Yx); } [[nodiscard]] inline float fmod( float _Xx, float _Yx) noexcept { return :: fmodf(_Xx, _Yx); } inline float frexp( float _Xx, int* _Yx) noexcept { return :: frexpf(_Xx, _Yx); } [[nodiscard]] inline float hypot( float _Xx, float _Yx) noexcept { return :: hypotf(_Xx, _Yx); } [[nodiscard]] inline int ilogb( float _Xx) noexcept { return :: ilogbf(_Xx); } [[nodiscard]] inline float ldexp( float _Xx, int _Yx) noexcept { return :: ldexpf(_Xx, _Yx); } [[nodiscard]] inline float lgamma( float _Xx) noexcept { return :: lgammaf(_Xx); } [[nodiscard]] inline long long llrint( float _Xx) noexcept { return :: llrintf(_Xx); } [[nodiscard]] inline long long llround( float _Xx) noexcept { return :: llroundf(_Xx); } [[nodiscard]] inline float log( float _Xx) noexcept { return :: logf(_Xx); } [[nodiscard]] inline float log10( float _Xx) noexcept { return :: log10f(_Xx); } [[nodiscard]] inline float log1p( float _Xx) noexcept { return :: log1pf(_Xx); } [[nodiscard]] inline float log2( float _Xx) noexcept { return :: log2f(_Xx); } [[nodiscard]] inline float logb( float _Xx) noexcept { return :: logbf(_Xx); } [[nodiscard]] inline long lrint( float _Xx) noexcept { return :: lrintf(_Xx); } [[nodiscard]] inline long lround( float _Xx) noexcept { return :: lroundf(_Xx); } inline float modf( float _Xx, float* _Yx) noexcept { return :: modff(_Xx, _Yx); } [[nodiscard]] inline float nearbyint( float _Xx) noexcept { return :: nearbyintf(_Xx); } [[nodiscard]] inline float nextafter( float _Xx, float _Yx) noexcept { return :: nextafterf(_Xx, _Yx); } [[nodiscard]] inline float nexttoward( float _Xx, long double _Yx) noexcept { return :: nexttowardf(_Xx, _Yx); } [[nodiscard]] inline float pow( float _Xx, float _Yx) noexcept { return :: powf(_Xx, _Yx); } [[nodiscard]] inline float remainder( float _Xx, float _Yx) noexcept { return :: remainderf(_Xx, _Yx); } inline float remquo( float _Xx, float _Yx, int* _Zx) noexcept { return :: remquof(_Xx, _Yx, _Zx); } [[nodiscard]] inline float rint( float _Xx) noexcept { return :: rintf(_Xx); } [[nodiscard]] inline float round( float _Xx) noexcept { return __roundf(_Xx); } [[nodiscard]] inline float scalbln( float _Xx, long _Yx) noexcept { return :: scalblnf(_Xx, _Yx); } [[nodiscard]] inline float scalbn( float _Xx, int _Yx) noexcept { return :: scalbnf(_Xx, _Yx); } [[nodiscard]] inline float sin( float _Xx) noexcept { return :: sinf(_Xx); } [[nodiscard]] inline float sinh( float _Xx) noexcept { return :: sinhf(_Xx); } [[nodiscard]] inline float sqrt( float _Xx) noexcept { return :: sqrtf(_Xx); } [[nodiscard]] inline float tan( float _Xx) noexcept { return :: tanf(_Xx); } [[nodiscard]] inline float tanh( float _Xx) noexcept { return :: tanhf(_Xx); } [[nodiscard]] inline float tgamma( float _Xx) noexcept { return :: tgammaf(_Xx); } [[nodiscard]] inline float trunc( float _Xx) noexcept { return __truncf(_Xx); } [[nodiscard]] inline long double acos( long double _Xx) noexcept { return :: acosl(_Xx); } [[nodiscard]] inline long double acosh( long double _Xx) noexcept { return :: acoshl(_Xx); } [[nodiscard]] inline long double asin( long double _Xx) noexcept { return :: asinl(_Xx); } [[nodiscard]] inline long double asinh( long double _Xx) noexcept { return :: asinhl(_Xx); } [[nodiscard]] inline long double atan( long double _Xx) noexcept { return :: atanl(_Xx); } [[nodiscard]] inline long double atanh( long double _Xx) noexcept { return :: atanhl(_Xx); } [[nodiscard]] inline long double atan2( long double _Yx, long double _Xx) noexcept { return :: atan2l(_Yx, _Xx); } [[nodiscard]] inline long double cbrt( long double _Xx) noexcept { return :: cbrtl(_Xx); } [[nodiscard]] inline long double ceil( long double _Xx) noexcept { return __ceil(static_cast<double>(_Xx)); } [[nodiscard]] inline long double copysign( long double _Number, long double _Sign) noexcept { return __copysign(static_cast<double>(_Number), static_cast<double>(_Sign)); } [[nodiscard]] inline long double cos( long double _Xx) noexcept { return :: cosl(_Xx); } [[nodiscard]] inline long double cosh( long double _Xx) noexcept { return :: coshl(_Xx); } [[nodiscard]] inline long double erf( long double _Xx) noexcept { return :: erfl(_Xx); } [[nodiscard]] inline long double erfc( long double _Xx) noexcept { return :: erfcl(_Xx); } [[nodiscard]] inline long double exp( long double _Xx) noexcept { return :: expl(_Xx); } [[nodiscard]] inline long double exp2( long double _Xx) noexcept { return :: exp2l(_Xx); } [[nodiscard]] inline long double expm1( long double _Xx) noexcept { return :: expm1l(_Xx); } [[nodiscard]] inline long double fabs( long double _Xx) noexcept { return :: fabsl(_Xx); } [[nodiscard]] inline long double fdim( long double _Xx, long double _Yx) noexcept { return :: fdiml(_Xx, _Yx); } [[nodiscard]] inline long double floor( long double _Xx) noexcept { return __floor(static_cast<double>(_Xx)); } [[nodiscard]] inline long double fma( long double _Xx, long double _Yx, long double _Zx) noexcept { return :: fmal(_Xx, _Yx, _Zx); } [[nodiscard]] inline long double fmax( long double _Xx, long double _Yx) noexcept { return :: fmaxl(_Xx, _Yx); } [[nodiscard]] inline long double fmin( long double _Xx, long double _Yx) noexcept { return :: fminl(_Xx, _Yx); } [[nodiscard]] inline long double fmod( long double _Xx, long double _Yx) noexcept { return :: fmodl(_Xx, _Yx); } inline long double frexp( long double _Xx, int* _Yx) noexcept { return :: frexpl(_Xx, _Yx); } [[nodiscard]] inline long double hypot( long double _Xx, long double _Yx) noexcept { return :: hypotl(_Xx, _Yx); } [[nodiscard]] inline int ilogb( long double _Xx) noexcept { return :: ilogbl(_Xx); } [[nodiscard]] inline long double ldexp( long double _Xx, int _Yx) noexcept { return :: ldexpl(_Xx, _Yx); } [[nodiscard]] inline long double lgamma( long double _Xx) noexcept { return :: lgammal(_Xx); } [[nodiscard]] inline long long llrint( long double _Xx) noexcept { return :: llrintl(_Xx); } [[nodiscard]] inline long long llround( long double _Xx) noexcept { return :: llroundl(_Xx); } [[nodiscard]] inline long double log( long double _Xx) noexcept { return :: logl(_Xx); } [[nodiscard]] inline long double log10( long double _Xx) noexcept { return :: log10l(_Xx); } [[nodiscard]] inline long double log1p( long double _Xx) noexcept { return :: log1pl(_Xx); } [[nodiscard]] inline long double log2( long double _Xx) noexcept { return :: log2l(_Xx); } [[nodiscard]] inline long double logb( long double _Xx) noexcept { return :: logbl(_Xx); } [[nodiscard]] inline long lrint( long double _Xx) noexcept { return :: lrintl(_Xx); } [[nodiscard]] inline long lround( long double _Xx) noexcept { return :: lroundl(_Xx); } inline long double modf( long double _Xx, long double* _Yx) noexcept { return :: modfl(_Xx, _Yx); } [[nodiscard]] inline long double nearbyint( long double _Xx) noexcept { return :: nearbyintl(_Xx); } [[nodiscard]] inline long double nextafter( long double _Xx, long double _Yx) noexcept { return :: nextafterl(_Xx, _Yx); } [[nodiscard]] inline long double nexttoward( long double _Xx, long double _Yx) noexcept { return :: nexttowardl(_Xx, _Yx); } [[nodiscard]] inline long double pow( long double _Xx, long double _Yx) noexcept { return :: powl(_Xx, _Yx); } [[nodiscard]] inline long double remainder( long double _Xx, long double _Yx) noexcept { return :: remainderl(_Xx, _Yx); } inline long double remquo( long double _Xx, long double _Yx, int* _Zx) noexcept { return :: remquol(_Xx, _Yx, _Zx); } [[nodiscard]] inline long double rint( long double _Xx) noexcept { return :: rintl(_Xx); } [[nodiscard]] inline long double round( long double _Xx) noexcept { return __round(static_cast<double>(_Xx)); } [[nodiscard]] inline long double scalbln( long double _Xx, long _Yx) noexcept { return :: scalblnl(_Xx, _Yx); } [[nodiscard]] inline long double scalbn( long double _Xx, int _Yx) noexcept { return :: scalbnl(_Xx, _Yx); } [[nodiscard]] inline long double sin( long double _Xx) noexcept { return :: sinl(_Xx); } [[nodiscard]] inline long double sinh( long double _Xx) noexcept { return :: sinhl(_Xx); } [[nodiscard]] inline long double sqrt( long double _Xx) noexcept { return :: sqrtl(_Xx); } [[nodiscard]] inline long double tan( long double _Xx) noexcept { return :: tanl(_Xx); } [[nodiscard]] inline long double tanh( long double _Xx) noexcept { return :: tanhl(_Xx); } [[nodiscard]] inline long double tgamma( long double _Xx) noexcept { return :: tgammal(_Xx); } [[nodiscard]] inline long double trunc( long double _Xx) noexcept { return __trunc(static_cast<double>(_Xx)); } namespace std { template <class _Ty1, class _Ty2> using _Common_float_type_t = conditional_t<is_same_v<_Ty1, long double> || is_same_v<_Ty2, long double>, long double, conditional_t<is_same_v<_Ty1, float> && is_same_v<_Ty2, float>, float, double>>; } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> double frexp(_Ty _Value, int* const _Exp) noexcept { return :: frexp(static_cast<double>(_Value), _Exp); } template <class _Ty1, class _Ty2, class _Ty3, ::std:: enable_if_t<::std:: is_arithmetic_v<_Ty1> && ::std:: is_arithmetic_v<_Ty2> && ::std:: is_arithmetic_v<_Ty3>, int> = 0> [[nodiscard]] ::std:: _Common_float_type_t<_Ty1, ::std:: _Common_float_type_t<_Ty2, _Ty3>> fma( _Ty1 _Left, _Ty2 _Middle, _Ty3 _Right) noexcept { using _Common = ::std:: _Common_float_type_t<_Ty1, ::std:: _Common_float_type_t<_Ty2, _Ty3>>; if constexpr (::std:: is_same_v<_Common, float>) { return :: fmaf(static_cast<_Common>(_Left), static_cast<_Common>(_Middle), static_cast<_Common>(_Right)); } else if constexpr (::std:: is_same_v<_Common, double>) { return :: fma(static_cast<_Common>(_Left), static_cast<_Common>(_Middle), static_cast<_Common>(_Right)); } else { return :: fmal(static_cast<_Common>(_Left), static_cast<_Common>(_Middle), static_cast<_Common>(_Right)); } } template <class _Ty1, class _Ty2, ::std:: enable_if_t<::std:: is_arithmetic_v<_Ty1> && ::std:: is_arithmetic_v<_Ty2>, int> = 0> ::std:: _Common_float_type_t<_Ty1, _Ty2> remquo(_Ty1 _Left, _Ty2 _Right, int* _Pquo) noexcept { using _Common = ::std:: _Common_float_type_t<_Ty1, _Ty2>; if constexpr (::std:: is_same_v<_Common, float>) { return :: remquof(static_cast<_Common>(_Left), static_cast<_Common>(_Right), _Pquo); } else if constexpr (::std:: is_same_v<_Common, double>) { return :: remquo(static_cast<_Common>(_Left), static_cast<_Common>(_Right), _Pquo); } else { return :: remquol(static_cast<_Common>(_Left), static_cast<_Common>(_Right), _Pquo); } } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double acos(_Ty _Left) noexcept { return :: acos(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double asin(_Ty _Left) noexcept { return :: asin(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double atan(_Ty _Left) noexcept { return :: atan(static_cast<double>(_Left)); } template <class _Ty1, class _Ty2, ::std:: enable_if_t<::std:: is_arithmetic_v<_Ty1> && ::std:: is_arithmetic_v<_Ty2>, int> = 0> [[nodiscard]] ::std:: _Common_float_type_t<_Ty1, _Ty2> atan2(_Ty1 _Left, _Ty2 _Right) noexcept { using _Common = ::std:: _Common_float_type_t<_Ty1, _Ty2>; return :: atan2(static_cast<_Common>(_Left), static_cast<_Common>(_Right)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double cos(_Ty _Left) noexcept { return :: cos(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double sin(_Ty _Left) noexcept { return :: sin(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double tan(_Ty _Left) noexcept { return :: tan(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double acosh(_Ty _Left) noexcept { return :: acosh(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double asinh(_Ty _Left) noexcept { return :: asinh(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double atanh(_Ty _Left) noexcept { return :: atanh(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double cosh(_Ty _Left) noexcept { return :: cosh(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double sinh(_Ty _Left) noexcept { return :: sinh(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double tanh(_Ty _Left) noexcept { return :: tanh(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double exp(_Ty _Left) noexcept { return :: exp(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double exp2(_Ty _Left) noexcept { return :: exp2(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double expm1(_Ty _Left) noexcept { return :: expm1(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] int ilogb(_Ty _Left) noexcept { return :: ilogb(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double ldexp(_Ty _Left, int _Arg2) noexcept { return :: ldexp(static_cast<double>(_Left), _Arg2); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double log(_Ty _Left) noexcept { return :: log(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double log10(_Ty _Left) noexcept { return :: log10(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double log1p(_Ty _Left) noexcept { return :: log1p(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double log2(_Ty _Left) noexcept { return :: log2(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double logb(_Ty _Left) noexcept { return :: logb(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double scalbn(_Ty _Left, int _Arg2) noexcept { return :: scalbn(static_cast<double>(_Left), _Arg2); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double scalbln(_Ty _Left, long _Arg2) noexcept { return :: scalbln(static_cast<double>(_Left), _Arg2); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double cbrt(_Ty _Left) noexcept { return :: cbrt(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double fabs(_Ty _Left) noexcept { return :: fabs(static_cast<double>(_Left)); } template <class _Ty1, class _Ty2, ::std:: enable_if_t<::std:: is_arithmetic_v<_Ty1> && ::std:: is_arithmetic_v<_Ty2>, int> = 0> [[nodiscard]] ::std:: _Common_float_type_t<_Ty1, _Ty2> hypot(_Ty1 _Left, _Ty2 _Right) noexcept { using _Common = ::std:: _Common_float_type_t<_Ty1, _Ty2>; return :: hypot(static_cast<_Common>(_Left), static_cast<_Common>(_Right)); } template <class _Ty1, class _Ty2, ::std:: enable_if_t<::std:: is_arithmetic_v<_Ty1> && ::std:: is_arithmetic_v<_Ty2>, int> = 0> [[nodiscard]] ::std:: _Common_float_type_t<_Ty1, _Ty2> pow(_Ty1 _Left, _Ty2 _Right) noexcept { using _Common = ::std:: _Common_float_type_t<_Ty1, _Ty2>; return :: pow(static_cast<_Common>(_Left), static_cast<_Common>(_Right)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double sqrt(_Ty _Left) noexcept { return :: sqrt(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double erf(_Ty _Left) noexcept { return :: erf(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double erfc(_Ty _Left) noexcept { return :: erfc(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double lgamma(_Ty _Left) noexcept { return :: lgamma(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double tgamma(_Ty _Left) noexcept { return :: tgamma(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double ceil(_Ty _Left) noexcept { return __ceil(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double floor(_Ty _Left) noexcept { return __floor(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double nearbyint(_Ty _Left) noexcept { return :: nearbyint(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double rint(_Ty _Left) noexcept { return :: rint(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] long lrint(_Ty _Left) noexcept { return :: lrint(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] long long llrint(_Ty _Left) noexcept { return :: llrint(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double round(_Ty _Left) noexcept { return __round(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] long lround(_Ty _Left) noexcept { return :: lround(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] long long llround(_Ty _Left) noexcept { return :: llround(static_cast<double>(_Left)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double trunc(_Ty _Left) noexcept { return __trunc(static_cast<double>(_Left)); } template <class _Ty1, class _Ty2, ::std:: enable_if_t<::std:: is_arithmetic_v<_Ty1> && ::std:: is_arithmetic_v<_Ty2>, int> = 0> [[nodiscard]] ::std:: _Common_float_type_t<_Ty1, _Ty2> fmod(_Ty1 _Left, _Ty2 _Right) noexcept { using _Common = ::std:: _Common_float_type_t<_Ty1, _Ty2>; return :: fmod(static_cast<_Common>(_Left), static_cast<_Common>(_Right)); } template <class _Ty1, class _Ty2, ::std:: enable_if_t<::std:: is_arithmetic_v<_Ty1> && ::std:: is_arithmetic_v<_Ty2>, int> = 0> [[nodiscard]] ::std:: _Common_float_type_t<_Ty1, _Ty2> remainder(_Ty1 _Left, _Ty2 _Right) noexcept { using _Common = ::std:: _Common_float_type_t<_Ty1, _Ty2>; return :: remainder(static_cast<_Common>(_Left), static_cast<_Common>(_Right)); } template <class _Ty1, class _Ty2, ::std:: enable_if_t<::std:: is_arithmetic_v<_Ty1> && ::std:: is_arithmetic_v<_Ty2>, int> = 0> [[nodiscard]] ::std:: _Common_float_type_t<_Ty1, _Ty2> copysign(_Ty1 _Left, _Ty2 _Right) noexcept { using _Common = ::std:: _Common_float_type_t<_Ty1, _Ty2>; return __copysign(static_cast<_Common>(_Left), static_cast<_Common>(_Right)); } template <class _Ty1, class _Ty2, ::std:: enable_if_t<::std:: is_arithmetic_v<_Ty1> && ::std:: is_arithmetic_v<_Ty2>, int> = 0> [[nodiscard]] ::std:: _Common_float_type_t<_Ty1, _Ty2> nextafter(_Ty1 _Left, _Ty2 _Right) noexcept { using _Common = ::std:: _Common_float_type_t<_Ty1, _Ty2>; return :: nextafter(static_cast<_Common>(_Left), static_cast<_Common>(_Right)); } template <class _Ty, ::std:: enable_if_t<::std:: is_integral_v<_Ty>, int> = 0> [[nodiscard]] double nexttoward(_Ty _Left, long double _Arg2) noexcept { return :: nexttoward(static_cast<double>(_Left), _Arg2); } template <class _Ty1, class _Ty2, ::std:: enable_if_t<::std:: is_arithmetic_v<_Ty1> && ::std:: is_arithmetic_v<_Ty2>, int> = 0> [[nodiscard]] ::std:: _Common_float_type_t<_Ty1, _Ty2> fdim(_Ty1 _Left, _Ty2 _Right) noexcept { using _Common = ::std:: _Common_float_type_t<_Ty1, _Ty2>; return :: fdim(static_cast<_Common>(_Left), static_cast<_Common>(_Right)); } template <class _Ty1, class _Ty2, ::std:: enable_if_t<::std:: is_arithmetic_v<_Ty1> && ::std:: is_arithmetic_v<_Ty2>, int> = 0> [[nodiscard]] ::std:: _Common_float_type_t<_Ty1, _Ty2> fmax(_Ty1 _Left, _Ty2 _Right) noexcept { using _Common = ::std:: _Common_float_type_t<_Ty1, _Ty2>; return :: fmax(static_cast<_Common>(_Left), static_cast<_Common>(_Right)); } template <class _Ty1, class _Ty2, ::std:: enable_if_t<::std:: is_arithmetic_v<_Ty1> && ::std:: is_arithmetic_v<_Ty2>, int> = 0> [[nodiscard]] ::std:: _Common_float_type_t<_Ty1, _Ty2> fmin(_Ty1 _Left, _Ty2 _Right) noexcept { using _Common = ::std:: _Common_float_type_t<_Ty1, _Ty2>; return :: fmin(static_cast<_Common>(_Left), static_cast<_Common>(_Right)); } namespace std { using :: abs; using :: acos; using :: asin; using :: atan; using :: atan2; using :: ceil; using :: cos; using :: cosh; using :: exp; using :: fabs; using :: floor; using :: fmod; using :: frexp; using :: ldexp; using :: log; using :: log10; using :: modf; using :: pow; using :: sin; using :: sinh; using :: sqrt; using :: tan; using :: tanh; using :: acosf; using :: asinf; using :: atanf; using :: atan2f; using :: ceilf; using :: cosf; using :: coshf; using :: expf; using :: fabsf; using :: floorf; using :: fmodf; using :: frexpf; using :: ldexpf; using :: logf; using :: log10f; using :: modff; using :: powf; using :: sinf; using :: sinhf; using :: sqrtf; using :: tanf; using :: tanhf; using :: acosl; using :: asinl; using :: atanl; using :: atan2l; using :: ceill; using :: cosl; using :: coshl; using :: expl; using :: fabsl; using :: floorl; using :: fmodl; using :: frexpl; using :: ldexpl; using :: logl; using :: log10l; using :: modfl; using :: powl; using :: sinl; using :: sinhl; using :: sqrtl; using :: tanl; using :: tanhl; using :: float_t; using :: double_t; using :: acosh; using :: asinh; using :: atanh; using :: cbrt; using :: erf; using :: erfc; using :: expm1; using :: exp2; using :: hypot; using :: ilogb; using :: lgamma; using :: log1p; using :: log2; using :: logb; using :: llrint; using :: lrint; using :: nearbyint; using :: rint; using :: llround; using :: lround; using :: fdim; using :: fma; using :: fmax; using :: fmin; using :: round; using :: trunc; using :: remainder; using :: remquo; using :: copysign; using :: nan; using :: nextafter; using :: scalbn; using :: scalbln; using :: nexttoward; using :: tgamma; using :: acoshf; using :: asinhf; using :: atanhf; using :: cbrtf; using :: erff; using :: erfcf; using :: expm1f; using :: exp2f; using :: hypotf; using :: ilogbf; using :: lgammaf; using :: log1pf; using :: log2f; using :: logbf; using :: llrintf; using :: lrintf; using :: nearbyintf; using :: rintf; using :: llroundf; using :: lroundf; using :: fdimf; using :: fmaf; using :: fmaxf; using :: fminf; using :: roundf; using :: truncf; using :: remainderf; using :: remquof; using :: copysignf; using :: nanf; using :: nextafterf; using :: scalbnf; using :: scalblnf; using :: nexttowardf; using :: tgammaf; using :: acoshl; using :: asinhl; using :: atanhl; using :: cbrtl; using :: erfl; using :: erfcl; using :: expm1l; using :: exp2l; using :: hypotl; using :: ilogbl; using :: lgammal; using :: log1pl; using :: log2l; using :: logbl; using :: llrintl; using :: lrintl; using :: nearbyintl; using :: rintl; using :: llroundl; using :: lroundl; using :: fdiml; using :: fmal; using :: fmaxl; using :: fminl; using :: roundl; using :: truncl; using :: remainderl; using :: remquol; using :: copysignl; using :: nanl; using :: nextafterl; using :: scalbnl; using :: scalblnl; using :: nexttowardl; using :: tgammal; using :: fpclassify; using :: signbit; using :: isfinite; using :: isinf; using :: isnan; using :: isnormal; using :: isgreater; using :: isgreaterequal; using :: isless; using :: islessequal; using :: islessgreater; using :: isunordered; } extern "C" { [[nodiscard]] double __stdcall __std_smf_assoc_laguerre(unsigned int, unsigned int, double) noexcept; [[nodiscard]] float __stdcall __std_smf_assoc_laguerref(unsigned int, unsigned int, float) noexcept; [[nodiscard]] double __stdcall __std_smf_assoc_legendre(unsigned int, unsigned int, double) noexcept; [[nodiscard]] float __stdcall __std_smf_assoc_legendref(unsigned int, unsigned int, float) noexcept; [[nodiscard]] double __stdcall __std_smf_beta(double, double) noexcept; [[nodiscard]] float __stdcall __std_smf_betaf(float, float) noexcept; [[nodiscard]] double __stdcall __std_smf_comp_ellint_1(double) noexcept; [[nodiscard]] float __stdcall __std_smf_comp_ellint_1f(float) noexcept; [[nodiscard]] double __stdcall __std_smf_comp_ellint_2(double) noexcept; [[nodiscard]] float __stdcall __std_smf_comp_ellint_2f(float) noexcept; [[nodiscard]] double __stdcall __std_smf_comp_ellint_3(double, double) noexcept; [[nodiscard]] float __stdcall __std_smf_comp_ellint_3f(float, float) noexcept; [[nodiscard]] double __stdcall __std_smf_cyl_bessel_i(double, double) noexcept; [[nodiscard]] float __stdcall __std_smf_cyl_bessel_if(float, float) noexcept; [[nodiscard]] double __stdcall __std_smf_cyl_bessel_j(double, double) noexcept; [[nodiscard]] float __stdcall __std_smf_cyl_bessel_jf(float, float) noexcept; [[nodiscard]] double __stdcall __std_smf_cyl_bessel_k(double, double) noexcept; [[nodiscard]] float __stdcall __std_smf_cyl_bessel_kf(float, float) noexcept; [[nodiscard]] double __stdcall __std_smf_cyl_neumann(double, double) noexcept; [[nodiscard]] float __stdcall __std_smf_cyl_neumannf(float, float) noexcept; [[nodiscard]] double __stdcall __std_smf_ellint_1(double, double) noexcept; [[nodiscard]] float __stdcall __std_smf_ellint_1f(float, float) noexcept; [[nodiscard]] double __stdcall __std_smf_ellint_2(double, double) noexcept; [[nodiscard]] float __stdcall __std_smf_ellint_2f(float, float) noexcept; [[nodiscard]] double __stdcall __std_smf_ellint_3(double, double, double) noexcept; [[nodiscard]] float __stdcall __std_smf_ellint_3f(float, float, float) noexcept; [[nodiscard]] double __stdcall __std_smf_expint(double) noexcept; [[nodiscard]] float __stdcall __std_smf_expintf(float) noexcept; [[nodiscard]] double __stdcall __std_smf_hermite(unsigned int, double) noexcept; [[nodiscard]] float __stdcall __std_smf_hermitef(unsigned int, float) noexcept; [[nodiscard]] double __stdcall __std_smf_laguerre(unsigned int, double) noexcept; [[nodiscard]] float __stdcall __std_smf_laguerref(unsigned int, float) noexcept; [[nodiscard]] double __stdcall __std_smf_legendre(unsigned int, double) noexcept; [[nodiscard]] float __stdcall __std_smf_legendref(unsigned int, float) noexcept; [[nodiscard]] double __stdcall __std_smf_riemann_zeta(double) noexcept; [[nodiscard]] float __stdcall __std_smf_riemann_zetaf(float) noexcept; [[nodiscard]] double __stdcall __std_smf_sph_bessel(unsigned int, double) noexcept; [[nodiscard]] float __stdcall __std_smf_sph_besself(unsigned int, float) noexcept; [[nodiscard]] double __stdcall __std_smf_sph_legendre(unsigned int, unsigned int, double) noexcept; [[nodiscard]] float __stdcall __std_smf_sph_legendref(unsigned int, unsigned int, float) noexcept; [[nodiscard]] double __stdcall __std_smf_sph_neumann(unsigned int, double) noexcept; [[nodiscard]] float __stdcall __std_smf_sph_neumannf(unsigned int, float) noexcept; [[nodiscard]] double __stdcall __std_smf_hypot3(double, double, double) noexcept; [[nodiscard]] float __stdcall __std_smf_hypot3f(float, float, float) noexcept; } namespace std { [[nodiscard]] inline double assoc_laguerre(const unsigned int _Degree, const unsigned int _Order, const double _Value) { return __std_smf_assoc_laguerre(_Degree, _Order, _Value); } [[nodiscard]] inline float assoc_laguerref(const unsigned int _Degree, const unsigned int _Order, const float _Value) { return __std_smf_assoc_laguerref(_Degree, _Order, _Value); } [[nodiscard]] inline long double assoc_laguerrel( const unsigned int _Degree, const unsigned int _Order, const long double _Value) { return __std_smf_assoc_laguerre(_Degree, _Order, static_cast<double>(_Value)); } [[nodiscard]] inline double assoc_legendre(const unsigned int _Degree, const unsigned int _Order, const double _Value) { return __std_smf_assoc_legendre(_Degree, _Order, _Value); } [[nodiscard]] inline float assoc_legendref(const unsigned int _Degree, const unsigned int _Order, const float _Value) { return __std_smf_assoc_legendref(_Degree, _Order, _Value); } [[nodiscard]] inline long double assoc_legendrel( const unsigned int _Degree, const unsigned int _Order, const long double _Value) { return __std_smf_assoc_legendre(_Degree, _Order, static_cast<double>(_Value)); } [[nodiscard]] inline double beta(const double _Arg1, const double _Arg2) { return __std_smf_beta(_Arg1, _Arg2); } [[nodiscard]] inline float betaf(const float _Arg1, const float _Arg2) { return __std_smf_betaf(_Arg1, _Arg2); } [[nodiscard]] inline long double betal(const long double _Arg1, const long double _Arg2) { return __std_smf_beta(static_cast<double>(_Arg1), static_cast<double>(_Arg2)); } [[nodiscard]] inline double comp_ellint_1(const double _Arg) { return __std_smf_comp_ellint_1(_Arg); } [[nodiscard]] inline float comp_ellint_1f(const float _Arg) { return __std_smf_comp_ellint_1f(_Arg); } [[nodiscard]] inline long double comp_ellint_1l(const long double _Arg) { return __std_smf_comp_ellint_1(static_cast<double>(_Arg)); } [[nodiscard]] inline double comp_ellint_2(const double _Arg) { return __std_smf_comp_ellint_2(_Arg); } [[nodiscard]] inline float comp_ellint_2f(const float _Arg) { return __std_smf_comp_ellint_2f(_Arg); } [[nodiscard]] inline long double comp_ellint_2l(const long double _Arg) { return __std_smf_comp_ellint_2(static_cast<double>(_Arg)); } [[nodiscard]] inline double comp_ellint_3(const double _Arg1, const double _Arg2) { return __std_smf_comp_ellint_3(_Arg1, _Arg2); } [[nodiscard]] inline float comp_ellint_3f(const float _Arg1, const float _Arg2) { return __std_smf_comp_ellint_3f(_Arg1, _Arg2); } [[nodiscard]] inline long double comp_ellint_3l(const long double _Arg1, const long double _Arg2) { return __std_smf_comp_ellint_3(static_cast<double>(_Arg1), static_cast<double>(_Arg2)); } [[nodiscard]] inline double cyl_bessel_i(const double _Arg1, const double _Arg2) { return __std_smf_cyl_bessel_i(_Arg1, _Arg2); } [[nodiscard]] inline float cyl_bessel_if(const float _Arg1, const float _Arg2) { return __std_smf_cyl_bessel_if(_Arg1, _Arg2); } [[nodiscard]] inline long double cyl_bessel_il(const long double _Arg1, const long double _Arg2) { return __std_smf_cyl_bessel_i(static_cast<double>(_Arg1), static_cast<double>(_Arg2)); } [[nodiscard]] inline double cyl_bessel_j(const double _Arg1, const double _Arg2) { return __std_smf_cyl_bessel_j(_Arg1, _Arg2); } [[nodiscard]] inline float cyl_bessel_jf(const float _Arg1, const float _Arg2) { return __std_smf_cyl_bessel_jf(_Arg1, _Arg2); } [[nodiscard]] inline long double cyl_bessel_jl(const long double _Arg1, const long double _Arg2) { return __std_smf_cyl_bessel_j(static_cast<double>(_Arg1), static_cast<double>(_Arg2)); } [[nodiscard]] inline double cyl_bessel_k(const double _Arg1, const double _Arg2) { return __std_smf_cyl_bessel_k(_Arg1, _Arg2); } [[nodiscard]] inline float cyl_bessel_kf(const float _Arg1, const float _Arg2) { return __std_smf_cyl_bessel_kf(_Arg1, _Arg2); } [[nodiscard]] inline long double cyl_bessel_kl(const long double _Arg1, const long double _Arg2) { return __std_smf_cyl_bessel_k(static_cast<double>(_Arg1), static_cast<double>(_Arg2)); } [[nodiscard]] inline double cyl_neumann(const double _Arg1, const double _Arg2) { return __std_smf_cyl_neumann(_Arg1, _Arg2); } [[nodiscard]] inline float cyl_neumannf(const float _Arg1, const float _Arg2) { return __std_smf_cyl_neumannf(_Arg1, _Arg2); } [[nodiscard]] inline long double cyl_neumannl(const long double _Arg1, const long double _Arg2) { return __std_smf_cyl_neumann(static_cast<double>(_Arg1), static_cast<double>(_Arg2)); } [[nodiscard]] inline double ellint_1(const double _Arg1, const double _Arg2) { return __std_smf_ellint_1(_Arg1, _Arg2); } [[nodiscard]] inline float ellint_1f(const float _Arg1, const float _Arg2) { return __std_smf_ellint_1f(_Arg1, _Arg2); } [[nodiscard]] inline long double ellint_1l(const long double _Arg1, const long double _Arg2) { return __std_smf_ellint_1(static_cast<double>(_Arg1), static_cast<double>(_Arg2)); } [[nodiscard]] inline double ellint_2(const double _Arg1, const double _Arg2) { return __std_smf_ellint_2(_Arg1, _Arg2); } [[nodiscard]] inline float ellint_2f(const float _Arg1, const float _Arg2) { return __std_smf_ellint_2f(_Arg1, _Arg2); } [[nodiscard]] inline long double ellint_2l(const long double _Arg1, const long double _Arg2) { return __std_smf_ellint_2(static_cast<double>(_Arg1), static_cast<double>(_Arg2)); } [[nodiscard]] inline double ellint_3(const double _Arg1, const double _Arg2, const double _Arg3) { return __std_smf_ellint_3(_Arg1, _Arg2, _Arg3); } [[nodiscard]] inline float ellint_3f(const float _Arg1, const float _Arg2, const float _Arg3) { return __std_smf_ellint_3f(_Arg1, _Arg2, _Arg3); } [[nodiscard]] inline long double ellint_3l(const long double _Arg1, const long double _Arg2, const long double _Arg3) { return __std_smf_ellint_3(static_cast<double>(_Arg1), static_cast<double>(_Arg2), static_cast<double>(_Arg3)); } [[nodiscard]] inline double expint(const double _Arg) { return __std_smf_expint(_Arg); } [[nodiscard]] inline float expintf(const float _Arg) { return __std_smf_expintf(_Arg); } [[nodiscard]] inline long double expintl(const long double _Arg) { return __std_smf_expint(static_cast<double>(_Arg)); } [[nodiscard]] inline double hermite(const unsigned int _Arg1, const double _Arg2) { return __std_smf_hermite(_Arg1, _Arg2); } [[nodiscard]] inline float hermitef(const unsigned int _Arg1, const float _Arg2) { return __std_smf_hermitef(_Arg1, _Arg2); } [[nodiscard]] inline long double hermitel(const unsigned int _Arg1, const long double _Arg2) { return __std_smf_hermite(_Arg1, static_cast<double>(_Arg2)); } [[nodiscard]] inline double laguerre(const unsigned int _Arg1, const double _Arg2) { return __std_smf_laguerre(_Arg1, _Arg2); } [[nodiscard]] inline float laguerref(const unsigned int _Arg1, const float _Arg2) { return __std_smf_laguerref(_Arg1, _Arg2); } [[nodiscard]] inline long double laguerrel(const unsigned int _Arg1, const long double _Arg2) { return __std_smf_laguerre(_Arg1, static_cast<double>(_Arg2)); } [[nodiscard]] inline double legendre(const unsigned int _Degree, const double _Value) { return __std_smf_legendre(_Degree, _Value); } [[nodiscard]] inline float legendref(const unsigned int _Degree, const float _Value) { return __std_smf_legendref(_Degree, _Value); } [[nodiscard]] inline long double legendrel(const unsigned int _Degree, const long double _Value) { return __std_smf_legendre(_Degree, static_cast<double>(_Value)); } [[nodiscard]] inline double riemann_zeta(const double _Arg) { return __std_smf_riemann_zeta(_Arg); } [[nodiscard]] inline float riemann_zetaf(const float _Arg) { return __std_smf_riemann_zetaf(_Arg); } [[nodiscard]] inline long double riemann_zetal(const long double _Arg) { return __std_smf_riemann_zeta(static_cast<double>(_Arg)); } [[nodiscard]] inline double sph_bessel(const unsigned int _Arg1, const double _Arg2) { return __std_smf_sph_bessel(_Arg1, _Arg2); } [[nodiscard]] inline float sph_besself(const unsigned int _Arg1, const float _Arg2) { return __std_smf_sph_besself(_Arg1, _Arg2); } [[nodiscard]] inline long double sph_bessell(const unsigned int _Arg1, const long double _Arg2) { return __std_smf_sph_bessel(_Arg1, static_cast<double>(_Arg2)); } [[nodiscard]] inline double sph_legendre(const unsigned int _Arg1, const unsigned int _Arg2, const double _Theta) { return __std_smf_sph_legendre(_Arg1, _Arg2, _Theta); } [[nodiscard]] inline float sph_legendref(const unsigned int _Arg1, const unsigned int _Arg2, const float _Theta) { return __std_smf_sph_legendref(_Arg1, _Arg2, _Theta); } [[nodiscard]] inline long double sph_legendrel( const unsigned int _Arg1, const unsigned int _Arg2, const long double _Theta) { return __std_smf_sph_legendre(_Arg1, _Arg2, static_cast<double>(_Theta)); } [[nodiscard]] inline double sph_neumann(const unsigned int _Arg1, const double _Arg2) { return __std_smf_sph_neumann(_Arg1, _Arg2); } [[nodiscard]] inline float sph_neumannf(const unsigned int _Arg1, const float _Arg2) { return __std_smf_sph_neumannf(_Arg1, _Arg2); } [[nodiscard]] inline long double sph_neumannl(const unsigned int _Arg1, const long double _Arg2) { return __std_smf_sph_neumann(_Arg1, static_cast<double>(_Arg2)); } [[nodiscard]] inline double hypot(const double _Dx, const double _Dy, const double _Dz) { return __std_smf_hypot3(_Dx, _Dy, _Dz); } [[nodiscard]] inline float hypot(const float _Dx, const float _Dy, const float _Dz) { return __std_smf_hypot3f(_Dx, _Dy, _Dz); } [[nodiscard]] inline long double hypot(const long double _Dx, const long double _Dy, const long double _Dz) { return __std_smf_hypot3(static_cast<double>(_Dx), static_cast<double>(_Dy), static_cast<double>(_Dz)); } template <class _Ty1, class _Ty2, class _Ty3, enable_if_t<is_arithmetic_v<_Ty1> && is_arithmetic_v<_Ty2> && is_arithmetic_v<_Ty3>, int> = 0> [[nodiscard]] auto hypot(const _Ty1 _Dx, const _Ty2 _Dy, const _Ty3 _Dz) { using _Common = _Common_float_type_t<_Ty1, _Common_float_type_t<_Ty2, _Ty3>>; const auto _Result = __std_smf_hypot3(static_cast<double>(_Dx), static_cast<double>(_Dy), static_cast<double>(_Dz)); return static_cast<_Common>(_Result); } template <class _Ty> [[nodiscard]] constexpr _Ty _Common_lerp(const _Ty _ArgA, const _Ty _ArgB, const _Ty _ArgT) noexcept { const bool _T_is_finite = _Is_finite(_ArgT); if (_T_is_finite && _Is_finite(_ArgA) && _Is_finite(_ArgB)) { if ((_ArgA <= 0 && _ArgB >= 0) || (_ArgA >= 0 && _ArgB <= 0)) { return _ArgT * _ArgB + (1 - _ArgT) * _ArgA; } if (_ArgT == 1) { return _ArgB; } const auto _Candidate = _ArgA + _ArgT * (_ArgB - _ArgA); if ((_ArgT > 1) == (_ArgB > _ArgA)) { if (_ArgB > _Candidate) { return _ArgB; } } else { if (_Candidate > _ArgB) { return _ArgB; } } return _Candidate; } if (::std:: is_constant_evaluated()) { if (_Is_nan(_ArgA)) { return _ArgA; } if (_Is_nan(_ArgB)) { return _ArgB; } if (_Is_nan(_ArgT)) { return _ArgT; } } else { if (_Is_nan(_ArgA) || _Is_nan(_ArgB)) { return (_ArgA + _ArgB) + _ArgT; } if (_Is_nan(_ArgT)) { return _ArgT + _ArgT; } } if (_T_is_finite) { if (_ArgT < 0) { return _ArgA - _ArgB; } else if (_ArgT <= 1) { return _ArgT * _ArgB + (1 - _ArgT) * _ArgA; } else { return _ArgB - _ArgA; } } else { return _ArgT * (_ArgB - _ArgA); } } [[nodiscard]] constexpr inline float lerp(const float _ArgA, const float _ArgB, const float _ArgT) noexcept { return _Common_lerp(_ArgA, _ArgB, _ArgT); } [[nodiscard]] constexpr inline double lerp(const double _ArgA, const double _ArgB, const double _ArgT) noexcept { return _Common_lerp(_ArgA, _ArgB, _ArgT); } [[nodiscard]] constexpr inline long double lerp( const long double _ArgA, const long double _ArgB, const long double _ArgT) noexcept { return _Common_lerp(_ArgA, _ArgB, _ArgT); } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { namespace pmr { class __declspec(novtable) memory_resource { public: virtual ~memory_resource() noexcept = default; [[nodiscard]] __declspec(allocator) void* allocate( const size_t _Bytes, const size_t _Align = alignof(max_align_t)) { do { if (_Is_pow_2(_Align)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xpolymorphic_allocator.h", 148, 0, "%s", "memory_resource::allocate(): Alignment must be a power of two.")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"memory_resource::allocate(): Alignment must be a power of two.\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xpolymorphic_allocator.h", 148, 0); } while (false); } ; } while (false); return do_allocate(_Bytes, _Align); } void deallocate(void* const _Ptr, const size_t _Bytes, const size_t _Align = alignof(max_align_t)) { do { if (_Is_pow_2(_Align)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xpolymorphic_allocator.h", 154, 0, "%s", "memory_resource::deallocate(): Alignment must be a power of two.")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"memory_resource::deallocate(): Alignment must be a power of two.\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xpolymorphic_allocator.h", 154, 0); } while (false); } ; } while (false); return do_deallocate(_Ptr, _Bytes, _Align); } [[nodiscard]] bool is_equal(const memory_resource& _That) const noexcept { return do_is_equal(_That); } private: virtual void* do_allocate(size_t _Bytes, size_t _Align) = 0; virtual void do_deallocate(void* _Ptr, size_t _Bytes, size_t _Align) = 0; virtual bool do_is_equal(const memory_resource& _That) const noexcept = 0; }; [[nodiscard]] inline bool operator==(const memory_resource& _Left, const memory_resource& _Right) noexcept { return &_Left == &_Right || _Left.is_equal(_Right); } extern "C" memory_resource* __cdecl _Aligned_get_default_resource() noexcept; extern "C" memory_resource* __cdecl _Unaligned_get_default_resource() noexcept; [[nodiscard]] inline memory_resource* get_default_resource() noexcept { return _Aligned_get_default_resource(); } template <class _Ty = byte> class polymorphic_allocator { public: template <class> friend class polymorphic_allocator; using value_type = _Ty; polymorphic_allocator() noexcept = default; polymorphic_allocator(memory_resource* const _Resource_) noexcept : _Resource{_Resource_} { do { if (_Resource) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xpolymorphic_allocator.h", 209, 0, "%s", "Cannot initialize polymorphic_allocator with null resource (N4810 20.12.3.1 " "[mem.poly.allocator.ctor]/2)")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"Cannot initialize polymorphic_allocator with null resource (N4810 20.12.3.1 \" \"[mem.poly.allocator.ctor]/2)\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xpolymorphic_allocator.h", 209, 0); } while (false); } ; } while (false); } polymorphic_allocator(const polymorphic_allocator&) = default; template <class _Uty> polymorphic_allocator(const polymorphic_allocator<_Uty>& _That) noexcept : _Resource{_That._Resource} {} polymorphic_allocator& operator=(const polymorphic_allocator&) = delete; [[nodiscard]] __declspec(allocator) _Ty* allocate( const size_t _Count) { void* const _Vp = _Resource->allocate(_Get_size_of_n<sizeof(_Ty)>(_Count), alignof(_Ty)); return static_cast<_Ty*>(_Vp); } void deallocate(_Ty* const _Ptr, const size_t _Count) noexcept { _Resource->deallocate(_Ptr, _Count * sizeof(_Ty), alignof(_Ty)); } [[nodiscard]] __declspec(allocator) void* allocate_bytes( const size_t _Bytes, const size_t _Align = alignof(max_align_t)) { return _Resource->allocate(_Bytes, _Align); } void deallocate_bytes(void* const _Ptr, const size_t _Bytes, const size_t _Align = alignof(max_align_t)) noexcept { _Resource->deallocate(_Ptr, _Bytes, _Align); } template <class _Uty> [[nodiscard]] __declspec(allocator) _Uty* allocate_object( const size_t _Count = 1) { void* const _Vp = allocate_bytes(_Get_size_of_n<sizeof(_Uty)>(_Count), alignof(_Uty)); return static_cast<_Uty*>(_Vp); } template <class _Uty> void deallocate_object(_Uty* const _Ptr, const size_t _Count = 1) noexcept { deallocate_bytes(_Ptr, _Count * sizeof(_Uty), alignof(_Uty)); } template <class _Uty, class... _Types> [[nodiscard]] __declspec(allocator) _Uty* new_object(_Types&&... _Args) { _Uty* const _Ptr = allocate_object<_Uty>(); try { construct(_Ptr, ::std:: forward<_Types>(_Args)...); } catch (...) { deallocate_object(_Ptr); throw; } return _Ptr; } template <class _Uty> void delete_object(_Uty* const _Ptr) noexcept { _Destroy_in_place(*_Ptr); deallocate_object(_Ptr); } template <class _Uty, class... _Types> void construct(_Uty* const _Ptr, _Types&&... _Args) { ::std:: uninitialized_construct_using_allocator(_Ptr, *this, ::std:: forward<_Types>(_Args)...); } template <class _Uty> [[deprecated("warning STL4032: " "std::pmr::polymorphic_allocator::destroy() is deprecated in C++17 by LWG-3036. " "Prefer std::destroy_at() or std::allocator_traits<polymorphic_allocator>::destroy(). " "You can define _SILENCE_CXX17_POLYMORPHIC_ALLOCATOR_DESTROY_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] void destroy(_Uty* const _Ptr) noexcept { _Destroy_in_place(*_Ptr); } [[nodiscard]] polymorphic_allocator select_on_container_copy_construction() const noexcept { return {}; } [[nodiscard]] memory_resource* resource() const noexcept { return _Resource; } private: memory_resource* _Resource = ::std:: pmr::get_default_resource(); }; template <class _Ty1, class _Ty2> [[nodiscard]] bool operator==( const polymorphic_allocator<_Ty1>& _Left, const polymorphic_allocator<_Ty2>& _Right) noexcept { return *_Left.resource() == *_Right.resource(); } } template <class _Ty, class _Ptr> struct _Has_no_alloc_destroy<pmr::polymorphic_allocator<_Ty>, _Ptr, void> : true_type { }; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { template <class _Mylist, class _Base = _Iterator_base0> class _List_unchecked_const_iterator : public _Base { public: using iterator_category = bidirectional_iterator_tag; using _Nodeptr = typename _Mylist::_Nodeptr; using value_type = typename _Mylist::value_type; using difference_type = typename _Mylist::difference_type; using pointer = typename _Mylist::const_pointer; using reference = const value_type&; _List_unchecked_const_iterator() noexcept : _Ptr() {} _List_unchecked_const_iterator(_Nodeptr _Pnode, const _Mylist* _Plist) noexcept : _Ptr(_Pnode) { this->_Adopt(_Plist); } [[nodiscard]] reference operator*() const noexcept { return _Ptr->_Myval; } [[nodiscard]] pointer operator->() const noexcept { return pointer_traits<pointer>::pointer_to(**this); } _List_unchecked_const_iterator& operator++() noexcept { _Ptr = _Ptr->_Next; return *this; } _List_unchecked_const_iterator operator++(int) noexcept { _List_unchecked_const_iterator _Tmp = *this; _Ptr = _Ptr->_Next; return _Tmp; } _List_unchecked_const_iterator& operator--() noexcept { _Ptr = _Ptr->_Prev; return *this; } _List_unchecked_const_iterator operator--(int) noexcept { _List_unchecked_const_iterator _Tmp = *this; _Ptr = _Ptr->_Prev; return _Tmp; } [[nodiscard]] bool operator==(const _List_unchecked_const_iterator& _Right) const noexcept { return _Ptr == _Right._Ptr; } _Nodeptr _Ptr; }; template <class _Mylist> class _List_unchecked_iterator : public _List_unchecked_const_iterator<_Mylist> { public: using _Mybase = _List_unchecked_const_iterator<_Mylist>; using iterator_category = bidirectional_iterator_tag; using _Nodeptr = typename _Mylist::_Nodeptr; using value_type = typename _Mylist::value_type; using difference_type = typename _Mylist::difference_type; using pointer = typename _Mylist::pointer; using reference = value_type&; using _Mybase::_Mybase; [[nodiscard]] reference operator*() const noexcept { return const_cast<reference>(_Mybase::operator*()); } [[nodiscard]] pointer operator->() const noexcept { return pointer_traits<pointer>::pointer_to(**this); } _List_unchecked_iterator& operator++() noexcept { _Mybase::operator++(); return *this; } _List_unchecked_iterator operator++(int) noexcept { _List_unchecked_iterator _Tmp = *this; _Mybase::operator++(); return _Tmp; } _List_unchecked_iterator& operator--() noexcept { _Mybase::operator--(); return *this; } _List_unchecked_iterator operator--(int) noexcept { _List_unchecked_iterator _Tmp = *this; _Mybase::operator--(); return _Tmp; } }; template <class _Mylist> class _List_const_iterator : public _List_unchecked_const_iterator<_Mylist, _Iterator_base> { public: using _Mybase = _List_unchecked_const_iterator<_Mylist, _Iterator_base>; using iterator_category = bidirectional_iterator_tag; using _Nodeptr = typename _Mylist::_Nodeptr; using value_type = typename _Mylist::value_type; using difference_type = typename _Mylist::difference_type; using pointer = typename _Mylist::const_pointer; using reference = const value_type&; using _Mybase::_Mybase; [[nodiscard]] reference operator*() const noexcept { const auto _Mycont = static_cast<const _Mylist*>(this->_Getcont()); do { if (_Mycont) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 150, 0, "%s", "cannot dereference value-initialized list iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot dereference value-initialized list iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 150, 0); } while (false); } ; } while (false); do { if (this->_Ptr != _Mycont->_Myhead) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 151, 0, "%s", "cannot dereference end list iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot dereference end list iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 151, 0); } while (false); } ; } while (false); return this->_Ptr->_Myval; } [[nodiscard]] pointer operator->() const noexcept { return pointer_traits<pointer>::pointer_to(**this); } _List_const_iterator& operator++() noexcept { const auto _Mycont = static_cast<const _Mylist*>(this->_Getcont()); do { if (_Mycont) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 164, 0, "%s", "cannot increment value-initialized list iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot increment value-initialized list iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 164, 0); } while (false); } ; } while (false); do { if (this->_Ptr != _Mycont->_Myhead) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 165, 0, "%s", "cannot increment end list iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot increment end list iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 165, 0); } while (false); } ; } while (false); this->_Ptr = this->_Ptr->_Next; return *this; } _List_const_iterator operator++(int) noexcept { _List_const_iterator _Tmp = *this; ++*this; return _Tmp; } _List_const_iterator& operator--() noexcept { const auto _New_ptr = this->_Ptr->_Prev; const auto _Mycont = static_cast<const _Mylist*>(this->_Getcont()); do { if (_Mycont) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 182, 0, "%s", "cannot decrement value-initialized list iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot decrement value-initialized list iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 182, 0); } while (false); } ; } while (false); do { if (_New_ptr != _Mycont->_Myhead) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 183, 0, "%s", "cannot decrement begin list iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot decrement begin list iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 183, 0); } while (false); } ; } while (false); this->_Ptr = _New_ptr; return *this; } _List_const_iterator operator--(int) noexcept { _List_const_iterator _Tmp = *this; --*this; return _Tmp; } [[nodiscard]] bool operator==(const _List_const_iterator& _Right) const noexcept { do { if (this->_Getcont() == _Right._Getcont()) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 198, 0, "%s", "list iterators incompatible")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"list iterators incompatible\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 198, 0); } while (false); } ; } while (false); return this->_Ptr == _Right._Ptr; } friend void _Verify_range(const _List_const_iterator& _First, const _List_const_iterator& _Last) noexcept { do { if (_First._Getcont() == _Last._Getcont()) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 212, 0, "%s", "list iterators in range are from different containers")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"list iterators in range are from different containers\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 212, 0); } while (false); } ; } while (false); } using _Prevent_inheriting_unwrap = _List_const_iterator; [[nodiscard]] _List_unchecked_const_iterator<_Mylist> _Unwrapped() const noexcept { return _List_unchecked_const_iterator<_Mylist>(this->_Ptr, static_cast<const _Mylist*>(this->_Getcont())); } void _Seek_to(const _List_unchecked_const_iterator<_Mylist> _It) noexcept { this->_Ptr = _It._Ptr; } }; template <class _Mylist> class _List_iterator : public _List_const_iterator<_Mylist> { public: using _Mybase = _List_const_iterator<_Mylist>; using iterator_category = bidirectional_iterator_tag; using _Nodeptr = typename _Mylist::_Nodeptr; using value_type = typename _Mylist::value_type; using difference_type = typename _Mylist::difference_type; using pointer = typename _Mylist::pointer; using reference = value_type&; using _Mybase::_Mybase; [[nodiscard]] reference operator*() const noexcept { return const_cast<reference>(_Mybase::operator*()); } [[nodiscard]] pointer operator->() const noexcept { return pointer_traits<pointer>::pointer_to(**this); } _List_iterator& operator++() noexcept { _Mybase::operator++(); return *this; } _List_iterator operator++(int) noexcept { _List_iterator _Tmp = *this; _Mybase::operator++(); return _Tmp; } _List_iterator& operator--() noexcept { _Mybase::operator--(); return *this; } _List_iterator operator--(int) noexcept { _List_iterator _Tmp = *this; _Mybase::operator--(); return _Tmp; } using _Prevent_inheriting_unwrap = _List_iterator; [[nodiscard]] _List_unchecked_iterator<_Mylist> _Unwrapped() const noexcept { return _List_unchecked_iterator<_Mylist>(this->_Ptr, static_cast<const _Mylist*>(this->_Getcont())); } }; template <class _Value_type, class _Size_type, class _Difference_type, class _Pointer, class _Const_pointer, class _Reference, class _Const_reference, class _Nodeptr_type> struct _List_iter_types { using value_type = _Value_type; using size_type = _Size_type; using difference_type = _Difference_type; using pointer = _Pointer; using const_pointer = _Const_pointer; using _Nodeptr = _Nodeptr_type; }; template <class _Value_type, class _Voidptr> struct _List_node { using value_type = _Value_type; using _Nodeptr = _Rebind_pointer_t<_Voidptr, _List_node>; _Nodeptr _Next; _Nodeptr _Prev; _Value_type _Myval; _List_node(const _List_node&) = delete; _List_node& operator=(const _List_node&) = delete; template <class _Alnode> static _Nodeptr _Buyheadnode(_Alnode& _Al) { const auto _Result = _Al.allocate(1); _Construct_in_place(_Result->_Next, _Result); _Construct_in_place(_Result->_Prev, _Result); return _Result; } template <class _Alnode> static void _Freenode0(_Alnode& _Al, _Nodeptr _Ptr) noexcept { static_assert(is_same_v<typename _Alnode::value_type, _List_node>, "Bad _Freenode0 call"); _Destroy_in_place(_Ptr->_Next); _Destroy_in_place(_Ptr->_Prev); allocator_traits<_Alnode>::deallocate(_Al, _Ptr, 1); } template <class _Alnode> static void _Freenode(_Alnode& _Al, _Nodeptr _Ptr) noexcept { allocator_traits<_Alnode>::destroy(_Al, ::std:: addressof(_Ptr->_Myval)); _Freenode0(_Al, _Ptr); } template <class _Alnode> static void _Free_non_head( _Alnode& _Al, _Nodeptr _Head) noexcept { _Head->_Prev->_Next = nullptr; auto _Pnode = _Head->_Next; for (_Nodeptr _Pnext; _Pnode; _Pnode = _Pnext) { _Pnext = _Pnode->_Next; _Freenode(_Al, _Pnode); } } }; template <class _Ty> struct _List_simple_types : _Simple_types<_Ty> { using _Node = _List_node<_Ty, void*>; using _Nodeptr = _Node*; }; template <class _Val_types> class _List_val : public _Container_base { public: using _Nodeptr = typename _Val_types::_Nodeptr; using value_type = typename _Val_types::value_type; using size_type = typename _Val_types::size_type; using difference_type = typename _Val_types::difference_type; using pointer = typename _Val_types::pointer; using const_pointer = typename _Val_types::const_pointer; using reference = value_type&; using const_reference = const value_type&; _List_val() noexcept : _Myhead(), _Mysize(0) {} void _Orphan_ptr2(_Nodeptr _Ptr) noexcept { _Lockit _Lock(3); _Iterator_base12** _Pnext = &this->_Myproxy->_Myfirstiter; const auto _Head = _Myhead; while (*_Pnext) { _Iterator_base12** _Pnextnext = &(*_Pnext)->_Mynextiter; const auto _Pnextptr = static_cast<_List_const_iterator<_List_val>&>(**_Pnext)._Ptr; if (_Pnextptr == _Head || _Pnextptr != _Ptr) { _Pnext = _Pnextnext; } else { (*_Pnext)->_Myproxy = nullptr; *_Pnext = *_Pnextnext; } } } void _Orphan_non_end() noexcept { _Lockit _Lock(3); _Iterator_base12** _Pnext = &this->_Myproxy->_Myfirstiter; const auto _Head = _Myhead; while (*_Pnext) { _Iterator_base12** _Pnextnext = &(*_Pnext)->_Mynextiter; if (static_cast<_List_const_iterator<_List_val>&>(**_Pnext)._Ptr == _Head) { _Pnext = _Pnextnext; } else { (*_Pnext)->_Myproxy = nullptr; *_Pnext = *_Pnextnext; } } } _Nodeptr _Unlinknode(_Nodeptr _Pnode) noexcept { _Orphan_ptr2(_Pnode); _Pnode->_Prev->_Next = _Pnode->_Next; _Pnode->_Next->_Prev = _Pnode->_Prev; --_Mysize; return _Pnode; } void _Adopt_unique(_List_val& _Other, _Nodeptr _Pnode) noexcept { _Lockit _Lock(3); _Iterator_base12** _Pnext = &_Other._Myproxy->_Myfirstiter; const auto _Myproxy = this->_Myproxy; while (*_Pnext) { auto& _Iter = static_cast<_List_const_iterator<_List_val>&>(**_Pnext); if (_Iter._Ptr == _Pnode) { *_Pnext = _Iter._Mynextiter; _Iter._Myproxy = _Myproxy; _Iter._Mynextiter = _Myproxy->_Myfirstiter; _Myproxy->_Myfirstiter = ::std:: addressof(_Iter); } else { _Pnext = &_Iter._Mynextiter; } } } void _Adopt_all(_List_val& _Other) noexcept { _Lockit _Lock(3); _Iterator_base12** _Pnext = &_Other._Myproxy->_Myfirstiter; const auto _Myproxy = this->_Myproxy; const auto _Otherhead = _Other._Myhead; while (*_Pnext) { auto& _Iter = static_cast<_List_const_iterator<_List_val>&>(**_Pnext); if (_Iter._Ptr != _Otherhead) { *_Pnext = _Iter._Mynextiter; _Iter._Myproxy = _Myproxy; _Iter._Mynextiter = _Myproxy->_Myfirstiter; _Myproxy->_Myfirstiter = ::std:: addressof(_Iter); } else { _Pnext = &_Iter._Mynextiter; } } } void _Adopt_range(_List_val& _Other, const _Nodeptr _First, const _Nodeptr _Last) noexcept { _Lockit _Lock(3); _Iterator_base12** _Pnext = &_Other._Myproxy->_Myfirstiter; const auto _Myproxy = this->_Myproxy; _Nodeptr _Oldprev = _First->_Prev; for (_Nodeptr _Ptr = _First; _Ptr != _Last; _Ptr = _Ptr->_Next) { _Ptr->_Prev = nullptr; } while (*_Pnext) { auto& _Iter = static_cast<_List_const_iterator<_List_val>&>(**_Pnext); if (_Iter._Ptr->_Prev) { _Pnext = &_Iter._Mynextiter; } else { *_Pnext = _Iter._Mynextiter; _Iter._Myproxy = _Myproxy; _Iter._Mynextiter = _Myproxy->_Myfirstiter; _Myproxy->_Myfirstiter = ::std:: addressof(_Iter); } } for (_Nodeptr _Ptr = _First; _Ptr != _Last; _Ptr = _Ptr->_Next) { _Ptr->_Prev = _Oldprev; _Oldprev = _Ptr; } } static _Nodeptr _Unchecked_splice(const _Nodeptr _Before, const _Nodeptr _First, const _Nodeptr _Last) noexcept { ; const auto _First_prev = _First->_Prev; _First_prev->_Next = _Last; const auto _Last_prev = _Last->_Prev; _Last_prev->_Next = _Before; const auto _Before_prev = _Before->_Prev; _Before_prev->_Next = _First; _Before->_Prev = _Last_prev; _Last->_Prev = _First_prev; _First->_Prev = _Before_prev; return _Last; } static _Nodeptr _Unchecked_splice(const _Nodeptr _Before, const _Nodeptr _First) noexcept { ; const auto _Last = _First->_Next; const auto _First_prev = _First->_Prev; _First_prev->_Next = _Last; _First->_Next = _Before; const auto _Before_prev = _Before->_Prev; _Before_prev->_Next = _First; _Before->_Prev = _First; _Last->_Prev = _First_prev; _First->_Prev = _Before_prev; return _Last; } template <class _Pr2> static _Nodeptr _Merge_same(_Nodeptr _First, _Nodeptr _Mid, const _Nodeptr _Last, _Pr2 _Pred) { ; _Nodeptr _Newfirst; if (_Debug_lt_pred(_Pred, _Mid->_Myval, _First->_Myval)) { _Newfirst = _Mid; } else { _Newfirst = _First; do { _First = _First->_Next; if (_First == _Mid) { return _Newfirst; } } while (!_Debug_lt_pred(_Pred, _Mid->_Myval, _First->_Myval)); } for (;;) { auto _Run_start = _Mid; do { _Mid = _Mid->_Next; } while (_Mid != _Last && _Debug_lt_pred(_Pred, _Mid->_Myval, _First->_Myval)); _Unchecked_splice(_First, _Run_start, _Mid); if (_Mid == _Last) { return _Newfirst; } do { _First = _First->_Next; if (_First == _Mid) { return _Newfirst; } } while (!_Debug_lt_pred(_Pred, _Mid->_Myval, _First->_Myval)); } } template <class _Pr2> static _Nodeptr _Sort(_Nodeptr& _First, const size_type _Size, _Pr2 _Pred) { switch (_Size) { case 0: return _First; case 1: return _First->_Next; default: break; } auto _Mid = _Sort(_First, _Size / 2, _Pred); const auto _Last = _Sort(_Mid, _Size - _Size / 2, _Pred); _First = _Merge_same(_First, _Mid, _Last, _Pred); return _Last; } _Nodeptr _Myhead; size_type _Mysize; }; template <class _Alnode> struct _List_node_emplace_op2 : _Alloc_construct_ptr<_Alnode> { using _Alnode_traits = allocator_traits<_Alnode>; using pointer = typename _Alnode_traits::pointer; template <class... _Valtys> explicit _List_node_emplace_op2(_Alnode& _Al_, _Valtys&&... _Vals) : _Alloc_construct_ptr<_Alnode>(_Al_) { this->_Allocate(); _Alnode_traits::construct(this->_Al, ::std:: addressof(this->_Ptr->_Myval), ::std:: forward<_Valtys>(_Vals)...); } ~_List_node_emplace_op2() { if (this->_Ptr != pointer{}) { _Alnode_traits::destroy(this->_Al, ::std:: addressof(this->_Ptr->_Myval)); } } _List_node_emplace_op2(const _List_node_emplace_op2&) = delete; _List_node_emplace_op2& operator=(const _List_node_emplace_op2&) = delete; pointer _Transfer_before(const pointer _Insert_before) noexcept { const pointer _Insert_after = _Insert_before->_Prev; _Construct_in_place(this->_Ptr->_Next, _Insert_before); _Construct_in_place(this->_Ptr->_Prev, _Insert_after); const auto _Result = this->_Ptr; this->_Ptr = pointer{}; _Insert_before->_Prev = _Result; _Insert_after->_Next = _Result; return _Result; } }; template <class _Alnode> struct _List_node_insert_op2 { using _Alnode_traits = allocator_traits<_Alnode>; using pointer = typename _Alnode_traits::pointer; using size_type = typename _Alnode_traits::size_type; using value_type = typename _Alnode_traits::value_type; explicit _List_node_insert_op2(_Alnode& _Al_) : _Al(_Al_), _Added(0) {} _List_node_insert_op2(const _List_node_insert_op2&) = delete; _List_node_insert_op2& operator=(const _List_node_insert_op2&) = delete; template <class... _CArgT> void _Append_n(size_type _Count, const _CArgT&... _Carg) { if (_Count <= 0) { return; } _Alloc_construct_ptr<_Alnode> _Newnode(_Al); if (_Added == 0) { _Newnode._Allocate(); _Alnode_traits::construct(_Al, ::std:: addressof(_Newnode._Ptr->_Myval), _Carg...); _Head = _Newnode._Ptr; _Tail = _Newnode._Ptr; ++_Added; --_Count; } for (; 0 < _Count; --_Count) { _Newnode._Allocate(); _Alnode_traits::construct(_Al, ::std:: addressof(_Newnode._Ptr->_Myval), _Carg...); _Construct_in_place(_Tail->_Next, _Newnode._Ptr); _Construct_in_place(_Newnode._Ptr->_Prev, _Tail); _Tail = _Newnode._Ptr; ++_Added; } _Newnode._Ptr = pointer{}; } template <class _InIt, class _Sentinel> void _Append_range_unchecked(_InIt _First, const _Sentinel _Last) { if (_First == _Last) { return; } _Alloc_construct_ptr<_Alnode> _Newnode(_Al); if (_Added == 0) { _Newnode._Allocate(); _Alnode_traits::construct(_Al, ::std:: addressof(_Newnode._Ptr->_Myval), *_First); const auto _Newhead = ::std:: exchange(_Newnode._Ptr, pointer{}); _Head = _Newhead; _Tail = _Newhead; ++_Added; ++_First; } while (_First != _Last) { _Newnode._Allocate(); _Alnode_traits::construct(_Al, ::std:: addressof(_Newnode._Ptr->_Myval), *_First); _Construct_in_place(_Tail->_Next, _Newnode._Ptr); _Construct_in_place(_Newnode._Ptr->_Prev, _Tail); _Tail = ::std:: exchange(_Newnode._Ptr, pointer{}); ++_Added; ++_First; } } template <class _Val_types> pointer _Attach_before(_List_val<_Val_types>& _List_data, const pointer _Insert_before) noexcept { const auto _Local_added = _Added; if (_Local_added == 0) { return _Insert_before; } const auto _Local_head = _Head; const auto _Local_tail = _Tail; const auto _Insert_after = _Insert_before->_Prev; _Construct_in_place(_Local_head->_Prev, _Insert_after); _Insert_after->_Next = _Local_head; _Construct_in_place(_Local_tail->_Next, _Insert_before); _Insert_before->_Prev = _Local_tail; _List_data._Mysize += _Local_added; _Added = 0; return _Local_head; } template <class _Val_types> void _Attach_at_end(_List_val<_Val_types>& _List_data) noexcept { _Attach_before(_List_data, _List_data._Myhead); } template <class _Val_types> void _Attach_head(_List_val<_Val_types>& _List_data) { _Alloc_construct_ptr<_Alnode> _Newnode(_Al); _Newnode._Allocate(); const auto _Local_added = ::std:: exchange(_Added, size_type{0}); if (_Local_added == 0) { _Construct_in_place(_Newnode._Ptr->_Next, _Newnode._Ptr); _Construct_in_place(_Newnode._Ptr->_Prev, _Newnode._Ptr); } else { const auto _Local_head = _Head; const auto _Local_tail = _Tail; _Construct_in_place(_Newnode._Ptr->_Next, _Local_head); _Construct_in_place(_Newnode._Ptr->_Prev, _Local_tail); _Construct_in_place(_Local_head->_Prev, _Newnode._Ptr); _Construct_in_place(_Local_tail->_Next, _Newnode._Ptr); } _List_data._Mysize = _Local_added; _List_data._Myhead = _Newnode._Release(); } ~_List_node_insert_op2() { if (_Added == 0) { return; } _Construct_in_place(_Head->_Prev, pointer{}); _Construct_in_place(_Tail->_Next, pointer{}); pointer _Subject = _Head; while (_Subject) { value_type::_Freenode(_Al, ::std:: exchange(_Subject, _Subject->_Next)); } } private: _Alnode& _Al; size_type _Added; pointer _Tail; pointer _Head; }; template <class _Traits> class _Hash; template <class _Ty, class _Alloc = allocator<_Ty>> class list { private: template <class> friend class _Hash; template <class _Traits> friend bool _Hash_equal(const _Hash<_Traits>&, const _Hash<_Traits>&); using _Alty = _Rebind_alloc_t<_Alloc, _Ty>; using _Alty_traits = allocator_traits<_Alty>; using _Node = _List_node<_Ty, typename allocator_traits<_Alloc>::void_pointer>; using _Alnode = _Rebind_alloc_t<_Alloc, _Node>; using _Alnode_traits = allocator_traits<_Alnode>; using _Nodeptr = typename _Alnode_traits::pointer; using _Val_types = conditional_t<_Is_simple_alloc_v<_Alnode>, _List_simple_types<_Ty>, _List_iter_types<_Ty, typename _Alty_traits::size_type, typename _Alty_traits::difference_type, typename _Alty_traits::pointer, typename _Alty_traits::const_pointer, _Ty&, const _Ty&, _Nodeptr>>; using _Scary_val = _List_val<_Val_types>; public: static_assert(!1 || is_same_v<_Ty, typename _Alloc::value_type>, "list<T, Allocator>" " requires that Allocator's value_type match " "T" " (See N4659 26.2.1 [container.requirements.general]/16 allocator_type)" " Either fix the allocator value_type or define _ENFORCE_MATCHING_ALLOCATORS=0" " to suppress this diagnostic."); using value_type = _Ty; using allocator_type = _Alloc; using size_type = typename _Alty_traits::size_type; using difference_type = typename _Alty_traits::difference_type; using pointer = typename _Alty_traits::pointer; using const_pointer = typename _Alty_traits::const_pointer; using reference = value_type&; using const_reference = const value_type&; using iterator = _List_iterator<_Scary_val>; using const_iterator = _List_const_iterator<_Scary_val>; using _Unchecked_iterator = _List_unchecked_iterator<_Scary_val>; using _Unchecked_const_iterator = _List_unchecked_const_iterator<_Scary_val>; using reverse_iterator = ::std:: reverse_iterator<iterator>; using const_reverse_iterator = ::std:: reverse_iterator<const_iterator>; list() : _Mypair(_Zero_then_variadic_args_t{}) { _Alloc_sentinel_and_proxy(); } explicit list(const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { _Alloc_sentinel_and_proxy(); } private: template <class _Any_alloc> explicit list(_Move_allocator_tag, _Any_alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, ::std:: move(_Al)) { _Alloc_sentinel_and_proxy(); } void _Construct_n( size_type _Count) { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alnode, _Container_proxy>>(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _List_node_insert_op2<_Alnode> _Appended(_Getal()); _Appended._Append_n(_Count); _Appended._Attach_head(_Mypair._Myval2); _Proxy._Release(); } public: explicit list( size_type _Count) : _Mypair(_Zero_then_variadic_args_t{}) { _Construct_n(_Count); } explicit list( size_type _Count, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { _Construct_n(_Count); } private: void _Construct_n( size_type _Count, const _Ty& _Val) { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alnode, _Container_proxy>>(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _List_node_insert_op2<_Alnode> _Appended(_Getal()); _Appended._Append_n(_Count, _Val); _Appended._Attach_head(_Mypair._Myval2); _Proxy._Release(); } public: list( size_type _Count, const _Ty& _Val) : _Mypair(_Zero_then_variadic_args_t{}) { _Construct_n(_Count, _Val); } list( size_type _Count, const _Ty& _Val, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { _Construct_n(_Count, _Val); } private: template <class _Iter> void _Construct_range_unchecked(_Iter _First, _Iter _Last) { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alnode, _Container_proxy>>(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _List_node_insert_op2<_Alnode> _Appended(_Getal()); _Appended._Append_range_unchecked(_First, _Last); _Appended._Attach_head(_Mypair._Myval2); _Proxy._Release(); } public: list(const list& _Right) : _Mypair(_One_then_variadic_args_t{}, _Alnode_traits::select_on_container_copy_construction(_Right._Getal())) { _Construct_range_unchecked(_Right._Unchecked_begin(), _Right._Unchecked_end()); } list(const list& _Right, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { _Construct_range_unchecked(_Right._Unchecked_begin(), _Right._Unchecked_end()); } template <class _Iter, enable_if_t<_Is_iterator_v<_Iter>, int> = 0> list(_Iter _First, _Iter _Last) : _Mypair(_Zero_then_variadic_args_t{}) { _Adl_verify_range(_First, _Last); _Construct_range_unchecked(_Get_unwrapped(_First), _Get_unwrapped(_Last)); } template <class _Iter, enable_if_t<_Is_iterator_v<_Iter>, int> = 0> list(_Iter _First, _Iter _Last, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { _Adl_verify_range(_First, _Last); _Construct_range_unchecked(_Get_unwrapped(_First), _Get_unwrapped(_Last)); } list(list&& _Right) : _Mypair(_One_then_variadic_args_t{}, ::std:: move(_Right._Getal())) { _Alloc_sentinel_and_proxy(); _Swap_val(_Right); } list(list&& _Right, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { if constexpr (!_Alnode_traits::is_always_equal::value) { if (_Getal() != _Right._Getal()) { _Construct_range_unchecked(::std:: make_move_iterator(_Right._Unchecked_begin()), ::std:: make_move_iterator(_Right._Unchecked_end())); return; } } _Alloc_sentinel_and_proxy(); _Swap_val(_Right); } private: void _Move_assign(list& _Right, _Equal_allocators) noexcept { clear(); _Pocma(_Getal(), _Right._Getal()); _Swap_val(_Right); } void _Move_assign(list& _Right, _Propagate_allocators) { auto& _Al = _Getal(); auto& _Right_al = _Right._Getal(); if (_Al == _Right_al) { _Move_assign(_Right, _Equal_allocators{}); } else { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alnode, _Container_proxy>>(_Al); auto&& _Right_alproxy = static_cast<_Rebind_alloc_t<_Alnode, _Container_proxy>>(_Right_al); _Container_proxy_ptr<_Alty> _Proxy(_Right_alproxy, _Leave_proxy_unbound{}); auto& _My_data = _Mypair._Myval2; auto& _Right_data = _Right._Mypair._Myval2; const auto _Newhead = ::std:: exchange(_Right_data._Myhead, _Node::_Buyheadnode(_Right_al)); const auto _Newsize = ::std:: exchange(_Right_data._Mysize, size_type{0}); _Tidy(); _Pocma(_Al, _Right_al); _My_data._Myhead = _Newhead; _My_data._Mysize = _Newsize; _Proxy._Bind(_Alproxy, ::std:: addressof(_My_data)); _My_data._Swap_proxy_and_iterators(_Right_data); } } void _Move_assign(list& _Right, _No_propagate_allocators) { if (_Getal() == _Right._Getal()) { _Move_assign(_Right, _Equal_allocators{}); } else { assign( ::std:: make_move_iterator(_Right._Unchecked_begin()), ::std:: make_move_iterator(_Right._Unchecked_end())); } } public: list& operator=(list&& _Right) noexcept( noexcept(_Move_assign(_Right, _Choose_pocma<_Alnode>{}))) { if (this != ::std:: addressof(_Right)) { _Move_assign(_Right, _Choose_pocma<_Alnode>{}); } return *this; } private: void _Swap_val(list& _Right) noexcept { auto& _My_data = _Mypair._Myval2; auto& _Right_data = _Right._Mypair._Myval2; _My_data._Swap_proxy_and_iterators(_Right_data); _Swap_adl(_My_data._Myhead, _Right_data._Myhead); ::std:: swap(_My_data._Mysize, _Right_data._Mysize); } public: void push_front(_Ty&& _Val) { _Emplace(_Mypair._Myval2._Myhead->_Next, ::std:: move(_Val)); } void push_back(_Ty&& _Val) { _Emplace(_Mypair._Myval2._Myhead, ::std:: move(_Val)); } iterator insert(const_iterator _Where, _Ty&& _Val) { return emplace(_Where, ::std:: move(_Val)); } template <class... _Valty> decltype(auto) emplace_front(_Valty&&... _Val) { reference _Result = _Emplace(_Mypair._Myval2._Myhead->_Next, ::std:: forward<_Valty>(_Val)...)->_Myval; return _Result; } template <class... _Valty> decltype(auto) emplace_back(_Valty&&... _Val) { reference _Result = _Emplace(_Mypair._Myval2._Myhead, ::std:: forward<_Valty>(_Val)...)->_Myval; return _Result; } template <class... _Valty> iterator emplace(const const_iterator _Where, _Valty&&... _Val) { do { if (_Where._Getcont() == ::std:: addressof(_Mypair._Myval2)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1005, 0, "%s", "list emplace iterator outside range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"list emplace iterator outside range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1005, 0); } while (false); } ; } while (false); return _Make_iter(_Emplace(_Where._Ptr, ::std:: forward<_Valty>(_Val)...)); } template <class... _Valty> _Nodeptr _Emplace(const _Nodeptr _Where, _Valty&&... _Val) { size_type& _Mysize = _Mypair._Myval2._Mysize; if (_Mysize == max_size()) { _Xlength_error("list too long"); } _List_node_emplace_op2<_Alnode> _Op{_Getal(), ::std:: forward<_Valty>(_Val)...}; ++_Mysize; return _Op._Transfer_before(_Where); } list(initializer_list<_Ty> _Ilist) : _Mypair(_Zero_then_variadic_args_t{}) { _Construct_range_unchecked(_Ilist.begin(), _Ilist.end()); } list(initializer_list<_Ty> _Ilist, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { _Construct_range_unchecked(_Ilist.begin(), _Ilist.end()); } list& operator=(initializer_list<_Ty> _Ilist) { assign(_Ilist.begin(), _Ilist.end()); return *this; } void assign(initializer_list<_Ty> _Ilist) { assign(_Ilist.begin(), _Ilist.end()); } iterator insert(const_iterator _Where, initializer_list<_Ty> _Ilist) { return insert(_Where, _Ilist.begin(), _Ilist.end()); } ~list() noexcept { _Tidy(); auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alnode, _Container_proxy>>(_Getal()); _Delete_plain_internal(_Alproxy, _Mypair._Myval2._Myproxy); } private: void _Reload_sentinel_and_proxy(const list& _Right) { auto& _Al = _Getal(); auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alnode, _Container_proxy>>(_Al); auto& _Right_al = _Right._Getal(); auto&& _Right_alproxy = static_cast<_Rebind_alloc_t<_Alnode, _Container_proxy>>(_Right_al); _Container_proxy_ptr<_Alty> _Proxy(_Right_alproxy, _Leave_proxy_unbound{}); auto _Right_al_non_const = _Right_al; auto _Newhead = _Node::_Buyheadnode(_Right_al_non_const); _Tidy(); _Pocca(_Al, _Right_al); _Mypair._Myval2._Myhead = _Newhead; _Mypair._Myval2._Mysize = 0; _Proxy._Bind(_Alproxy, ::std:: addressof(_Mypair._Myval2)); } void _Copy_assign(const list& _Right, false_type) { _Pocca(_Getal(), _Right._Getal()); assign(_Right._Unchecked_begin(), _Right._Unchecked_end()); } void _Copy_assign(const list& _Right, true_type) { if (_Getal() != _Right._Getal()) { _Reload_sentinel_and_proxy(_Right); } assign(_Right._Unchecked_begin(), _Right._Unchecked_end()); } public: list& operator=(const list& _Right) { if (this != ::std:: addressof(_Right)) { _Copy_assign(_Right, _Choose_pocca<_Alnode>{}); } return *this; } [[nodiscard]] iterator begin() noexcept { return iterator(_Mypair._Myval2._Myhead->_Next, ::std:: addressof(_Mypair._Myval2)); } [[nodiscard]] const_iterator begin() const noexcept { return const_iterator(_Mypair._Myval2._Myhead->_Next, ::std:: addressof(_Mypair._Myval2)); } [[nodiscard]] iterator end() noexcept { return iterator(_Mypair._Myval2._Myhead, ::std:: addressof(_Mypair._Myval2)); } [[nodiscard]] const_iterator end() const noexcept { return const_iterator(_Mypair._Myval2._Myhead, ::std:: addressof(_Mypair._Myval2)); } _Unchecked_iterator _Unchecked_begin() noexcept { return _Unchecked_iterator(_Mypair._Myval2._Myhead->_Next, nullptr); } _Unchecked_const_iterator _Unchecked_begin() const noexcept { return _Unchecked_const_iterator(_Mypair._Myval2._Myhead->_Next, nullptr); } _Unchecked_iterator _Unchecked_end() noexcept { return _Unchecked_iterator(_Mypair._Myval2._Myhead, nullptr); } _Unchecked_const_iterator _Unchecked_end() const noexcept { return _Unchecked_const_iterator(_Mypair._Myval2._Myhead, nullptr); } iterator _Make_iter(_Nodeptr _Where) const noexcept { return iterator(_Where, ::std:: addressof(_Mypair._Myval2)); } const_iterator _Make_const_iter(_Nodeptr _Where) const noexcept { return const_iterator(_Where, ::std:: addressof(_Mypair._Myval2)); } [[nodiscard]] reverse_iterator rbegin() noexcept { return reverse_iterator(end()); } [[nodiscard]] const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } [[nodiscard]] reverse_iterator rend() noexcept { return reverse_iterator(begin()); } [[nodiscard]] const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } [[nodiscard]] const_iterator cbegin() const noexcept { return begin(); } [[nodiscard]] const_iterator cend() const noexcept { return end(); } [[nodiscard]] const_reverse_iterator crbegin() const noexcept { return rbegin(); } [[nodiscard]] const_reverse_iterator crend() const noexcept { return rend(); } void resize( size_type _Newsize) { auto& _My_data = _Mypair._Myval2; if (_My_data._Mysize < _Newsize) { _List_node_insert_op2<_Alnode> _Op(_Getal()); _Op._Append_n(_Newsize - _My_data._Mysize); _Op._Attach_at_end(_My_data); } else { while (_Newsize < _My_data._Mysize) { pop_back(); } } } void resize( size_type _Newsize, const _Ty& _Val) { auto& _My_data = _Mypair._Myval2; if (_My_data._Mysize < _Newsize) { _List_node_insert_op2<_Alnode> _Op(_Getal()); _Op._Append_n(_Newsize - _My_data._Mysize, _Val); _Op._Attach_at_end(_My_data); } else { while (_Newsize < _My_data._Mysize) { pop_back(); } } } [[nodiscard]] size_type size() const noexcept { return _Mypair._Myval2._Mysize; } [[nodiscard]] size_type max_size() const noexcept { return (::std:: min)( static_cast<size_type>((numeric_limits<difference_type>::max)()), _Alnode_traits::max_size(_Getal())); } [[nodiscard]] bool empty() const noexcept { return _Mypair._Myval2._Mysize == 0; } [[nodiscard]] allocator_type get_allocator() const noexcept { return static_cast<allocator_type>(_Getal()); } [[nodiscard]] reference front() noexcept { do { if (_Mypair._Myval2._Mysize != 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1209, 0, "%s", "front() called on empty list")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"front() called on empty list\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1209, 0); } while (false); } ; } while (false); return _Mypair._Myval2._Myhead->_Next->_Myval; } [[nodiscard]] const_reference front() const noexcept { do { if (_Mypair._Myval2._Mysize != 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1217, 0, "%s", "front() called on empty list")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"front() called on empty list\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1217, 0); } while (false); } ; } while (false); return _Mypair._Myval2._Myhead->_Next->_Myval; } [[nodiscard]] reference back() noexcept { do { if (_Mypair._Myval2._Mysize != 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1225, 0, "%s", "back() called on empty list")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"back() called on empty list\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1225, 0); } while (false); } ; } while (false); return _Mypair._Myval2._Myhead->_Prev->_Myval; } [[nodiscard]] const_reference back() const noexcept { do { if (_Mypair._Myval2._Mysize != 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1233, 0, "%s", "back() called on empty list")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"back() called on empty list\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1233, 0); } while (false); } ; } while (false); return _Mypair._Myval2._Myhead->_Prev->_Myval; } void push_front(const _Ty& _Val) { _Emplace(_Mypair._Myval2._Myhead->_Next, _Val); } void pop_front() noexcept { do { if (_Mypair._Myval2._Mysize != 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1245, 0, "%s", "pop_front called on empty list")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"pop_front called on empty list\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1245, 0); } while (false); } ; } while (false); _Unchecked_erase(_Mypair._Myval2._Myhead->_Next); } void push_back(const _Ty& _Val) { _Emplace(_Mypair._Myval2._Myhead, _Val); } void pop_back() noexcept { do { if (_Mypair._Myval2._Mysize != 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1257, 0, "%s", "pop_back called on empty list")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"pop_back called on empty list\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1257, 0); } while (false); } ; } while (false); _Unchecked_erase(_Mypair._Myval2._Myhead->_Prev); } private: template <class _Target_ref, class _UIter> void _Assign_cast(_UIter _UFirst, const _UIter _ULast) { const auto _Myend = _Mypair._Myval2._Myhead; auto _Old = _Myend->_Next; for (;;) { if (_Old == _Myend) { _List_node_insert_op2<_Alnode> _Op(_Getal()); _Op._Append_range_unchecked(_UFirst, _ULast); _Op._Attach_at_end(_Mypair._Myval2); return; } if (_UFirst == _ULast) { _Unchecked_erase(_Old, _Myend); return; } reinterpret_cast<_Target_ref>(_Old->_Myval) = *_UFirst; _Old = _Old->_Next; ++_UFirst; } } public: template <class _Iter, enable_if_t<_Is_iterator_v<_Iter>, int> = 0> void assign(_Iter _First, _Iter _Last) { _Assign_cast<reference>(_Get_unwrapped(_First), _Get_unwrapped(_Last)); } void assign( size_type _Count, const _Ty& _Val) { const auto _Myend = _Mypair._Myval2._Myhead; auto _Old = _Myend->_Next; for (;;) { if (_Old == _Myend) { _List_node_insert_op2<_Alnode> _Op(_Getal()); _Op._Append_n(_Count, _Val); _Op._Attach_at_end(_Mypair._Myval2); return; } if (_Count == 0) { _Unchecked_erase(_Old, _Myend); return; } _Old->_Myval = _Val; _Old = _Old->_Next; --_Count; } } iterator insert(const_iterator _Where, const _Ty& _Val) { do { if (_Where._Getcont() == ::std:: addressof(_Mypair._Myval2)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1322, 0, "%s", "list insert iterator outside range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"list insert iterator outside range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1322, 0); } while (false); } ; } while (false); return _Make_iter(_Emplace(_Where._Ptr, _Val)); } iterator insert(const_iterator _Where, size_type _Count, const _Ty& _Val) { do { if (_Where._Getcont() == ::std:: addressof(_Mypair._Myval2)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1330, 0, "%s", "list insert iterator outside range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"list insert iterator outside range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1330, 0); } while (false); } ; } while (false); _List_node_insert_op2<_Alnode> _Op(_Getal()); _Op._Append_n(_Count, _Val); return _Make_iter(_Op._Attach_before(_Mypair._Myval2, _Where._Ptr)); } template <class _Iter, enable_if_t<_Is_iterator_v<_Iter>, int> = 0> iterator insert(const const_iterator _Where, _Iter _First, _Iter _Last) { do { if (_Where._Getcont() == ::std:: addressof(_Mypair._Myval2)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1340, 0, "%s", "list insert iterator outside range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"list insert iterator outside range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1340, 0); } while (false); } ; } while (false); _Adl_verify_range(_First, _Last); _List_node_insert_op2<_Alnode> _Op(_Getal()); _Op._Append_range_unchecked(_Get_unwrapped(_First), _Get_unwrapped(_Last)); return _Make_iter(_Op._Attach_before(_Mypair._Myval2, _Where._Ptr)); } public: iterator erase(const const_iterator _Where) noexcept { do { if (_Where._Getcont() == ::std:: addressof(_Mypair._Myval2)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1351, 0, "%s", "list erase iterator outside range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"list erase iterator outside range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1351, 0); } while (false); } ; } while (false); const auto _Result = _Where._Ptr->_Next; _Node::_Freenode(_Getal(), _Mypair._Myval2._Unlinknode(_Where._Ptr)); return _Make_iter(_Result); } private: _Nodeptr _Unchecked_erase(const _Nodeptr _Pnode) noexcept { const auto _Result = _Pnode->_Next; _Mypair._Myval2._Orphan_ptr2(_Pnode); --_Mypair._Myval2._Mysize; _Pnode->_Prev->_Next = _Result; _Result->_Prev = _Pnode->_Prev; _Node::_Freenode(_Getal(), _Pnode); return _Result; } public: iterator erase(const const_iterator _First, const const_iterator _Last) noexcept { _Adl_verify_range(_First, _Last); return _Make_iter(_Unchecked_erase(_First._Ptr, _Last._Ptr)); } private: _Nodeptr _Unchecked_erase(_Nodeptr _First, const _Nodeptr _Last) noexcept { if (_First == _Last) { return _Last; } const auto _Predecessor = _First->_Prev; const auto _Head = _Mypair._Myval2._Myhead; if (_First == _Head->_Next && _Last == _Head) { _Mypair._Myval2._Orphan_non_end(); } else { _Lockit _Lock(3); for (auto _Marked = _First; _Marked != _Last; _Marked = _Marked->_Next) { _Marked->_Prev = nullptr; } _Iterator_base12** _Pnext = &_Mypair._Myval2._Myproxy->_Myfirstiter; while (*_Pnext) { _Iterator_base12** _Pnextnext = &(*_Pnext)->_Mynextiter; if (static_cast<const_iterator&>(**_Pnext)._Ptr->_Prev) { _Pnext = _Pnextnext; } else { (*_Pnext)->_Myproxy = nullptr; *_Pnext = *_Pnextnext; } } } _Predecessor->_Next = _Last; _Last->_Prev = _Predecessor; auto& _Al = _Getal(); size_type _Erasures = 0; do { const auto _Next = _First->_Next; _Node::_Freenode(_Al, _First); _First = _Next; ++_Erasures; } while (_First != _Last); _Mypair._Myval2._Mysize -= _Erasures; return _Last; } public: void clear() noexcept { auto& _My_data = _Mypair._Myval2; _My_data._Orphan_non_end(); _Node::_Free_non_head(_Getal(), _My_data._Myhead); _My_data._Myhead->_Next = _My_data._Myhead; _My_data._Myhead->_Prev = _My_data._Myhead; _My_data._Mysize = 0; } private: void _Tidy() noexcept { auto& _Al = _Getal(); auto& _My_data = _Mypair._Myval2; _My_data._Orphan_all(); _Node::_Free_non_head(_Al, _My_data._Myhead); _Node::_Freenode0(_Al, _My_data._Myhead); } public: void swap(list& _Right) noexcept { if (this != ::std:: addressof(_Right)) { _Pocs(_Getal(), _Right._Getal()); _Swap_val(_Right); } } void splice(const const_iterator _Where, list& _Right) { auto& _Right_data = _Right._Mypair._Myval2; if (this != ::std:: addressof(_Right) && _Right_data._Mysize != 0) { do { if (_Where._Getcont() == ::std:: addressof(_Mypair._Myval2)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1456, 0, "%s", "list splice iterator outside range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"list splice iterator outside range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1456, 0); } while (false); } ; } while (false); const auto _Right_head = _Right_data._Myhead; _Splice(_Where._Ptr, _Right, _Right_head->_Next, _Right_head, _Right_data._Mysize); } } void splice(const const_iterator _Where, list&& _Right) { splice(_Where, _Right); } void splice(const const_iterator _Where, list& _Right, const const_iterator _First) { do { if (_Where._Getcont() == ::std:: addressof(_Mypair._Myval2) && _First._Getcont() == ::std:: addressof(_Right._Mypair._Myval2)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1472, 0, "%s", "list splice iterator outside range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"list splice iterator outside range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1472, 0); } while (false); } ; } while (false); const auto _UWhere = _Where._Ptr; const auto _UFirst = _First._Ptr; if (_UFirst == _Right._Mypair._Myval2._Myhead) { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1479, 0, "%s", "list splice iterator outside range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"list splice iterator outside range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1479, 0); } while (false); } const auto _ULast = _UFirst->_Next; if (this != ::std:: addressof(_Right) || (_UWhere != _UFirst && _UWhere != _ULast)) { _Splice(_UWhere, _Right, _UFirst, _ULast, 1); } } void splice(const const_iterator _Where, list&& _Right, const const_iterator _First) { splice(_Where, _Right, _First); } void splice(const const_iterator _Where, list& _Right, const const_iterator _First, const const_iterator _Last) { const auto _Right_data_ptr = ::std:: addressof(_Right._Mypair._Myval2); do { if (_Where._Getcont() == ::std:: addressof(_Mypair._Myval2) && _First._Getcont() == _Right_data_ptr && _Last._Getcont() == _Right_data_ptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1500, 0, "%s", "list splice iterator outside range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"list splice iterator outside range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1500, 0); } while (false); } ; } while (false); const auto _UWhere = _Where._Ptr; const auto _UFirst = _First._Ptr; const auto _ULast = _Last._Ptr; if (_UFirst != _ULast && (this != ::std:: addressof(_Right) || _UWhere != _ULast)) { size_type _Count = 0; if (this != ::std:: addressof(_Right)) { const auto _Right_end = _Right._Mypair._Myval2._Myhead; if (_UFirst == _Right_end->_Next && _ULast == _Right_end) { _Count = _Right._Mypair._Myval2._Mysize; } else { for (auto _To_check = _UFirst; _To_check != _ULast; _To_check = _To_check->_Next, (void) ++_Count) { do { if (_To_check != _Right_end) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1517, 0, "%s", "list bad splice")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"list bad splice\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1517, 0); } while (false); } ; } while (false); } } } _Splice(_UWhere, _Right, _UFirst, _ULast, _Count); } } void splice(const const_iterator _Where, list&& _Right, const const_iterator _First, const const_iterator _Last) { splice(_Where, _Right, _First, _Last); } struct _List_node_remove_op { explicit _List_node_remove_op(list& _List_) noexcept : _List(_List_), _Head(), _Tail(::std:: addressof(_Head)) {} _List_node_remove_op(const _List_node_remove_op&) = delete; _List_node_remove_op& operator=(const _List_node_remove_op&) = delete; _Nodeptr _Transfer_back(const _Nodeptr _Removed) noexcept { ; --_List._Mypair._Myval2._Mysize; const auto _Next = ::std:: exchange(_Removed->_Next, _Nodeptr()); const auto _Prev = _Removed->_Prev; _Prev->_Next = _Next; _Next->_Prev = _Prev; _Removed->_Prev = _Nodeptr(); *_Tail = _Removed; _Tail = ::std:: addressof(_Removed->_Next); return _Next; } ~_List_node_remove_op() { auto& _Al = _List._Getal(); { _Lockit _Lock(3); _Iterator_base12** _Pnext = &_List._Mypair._Myval2._Myproxy->_Myfirstiter; while (*_Pnext) { _Iterator_base12** _Pnextnext = &(*_Pnext)->_Mynextiter; const auto _Pnextptr = static_cast<const_iterator&>(**_Pnext)._Ptr; if (_Pnextptr->_Prev) { _Pnext = _Pnextnext; } else { (*_Pnext)->_Myproxy = nullptr; *_Pnext = *_Pnextnext; } } } auto _Target = _Head; while (_Target) { auto _Next = _Target->_Next; _List._Mypair._Myval2._Orphan_ptr2(_Target); _Alnode_traits::destroy(_Al, ::std:: addressof(_Target->_Next)); _Alnode_traits::destroy(_Al, ::std:: addressof(_Target->_Prev)); _Alnode_traits::destroy(_Al, ::std:: addressof(_Target->_Myval)); _Al.deallocate(_Target, 1); _Target = _Next; } } list& _List; _Nodeptr _Head; _Nodeptr* _Tail; }; auto remove(const _Ty& _Val) { return remove_if([&](const _Ty& _Other) { return _Other == _Val; }); } template <class _Pr1> auto remove_if(_Pr1 _Pred) { auto& _My_data = _Mypair._Myval2; _List_node_remove_op _Op(*this); const auto _Last = _My_data._Myhead; const size_type _Oldsize = _My_data._Mysize; for (auto _First = _Last->_Next; _First != _Last;) { auto _Next = _First->_Next; if (_Pred(_First->_Myval)) { _Op._Transfer_back(_First); } _First = _Next; } return _Oldsize - _My_data._Mysize; } auto unique() { return unique(equal_to<>{}); } template <class _Pr2> auto unique(_Pr2 _Pred) { _List_node_remove_op _Op(*this); const _Nodeptr _Phead = _Mypair._Myval2._Myhead; _Nodeptr _Pprev = _Phead->_Next; _Nodeptr _Pnode = _Pprev->_Next; const size_type _Oldsize = _Mypair._Myval2._Mysize; while (_Pnode != _Phead) { if (_Pred(_Pprev->_Myval, _Pnode->_Myval)) { _Pnode = _Op._Transfer_back(_Pnode); } else { _Pprev = _Pnode; _Pnode = _Pnode->_Next; } } return _Oldsize - _Mypair._Myval2._Mysize; } void merge(list& _Right) { _Merge1(_Right, less<>{}); } void merge(list&& _Right) { _Merge1(_Right, less<>{}); } template <class _Pr2> void merge(list& _Right, _Pr2 _Pred) { _Merge1(_Right, _Pass_fn(_Pred)); } template <class _Pr2> void merge(list&& _Right, _Pr2 _Pred) { _Merge1(_Right, _Pass_fn(_Pred)); } private: template <class _Pr2> void _Merge1(list& _Right, _Pr2 _Pred) { _Debug_order_unchecked(_Unchecked_begin(), _Unchecked_end(), _Pred); if (this == ::std:: addressof(_Right)) { return; } _Debug_order_unchecked(_Right._Unchecked_begin(), _Right._Unchecked_end(), _Pred); if constexpr (!_Alnode_traits::is_always_equal::value) { do { if (_Getal() == _Right._Getal()) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1686, 0, "%s", "list allocators incompatible for merge")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"list allocators incompatible for merge\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1686, 0); } while (false); } ; } while (false); } const auto _Right_size = _Right._Mypair._Myval2._Mysize; if (_Right_size == 0) { return; } const auto _Myhead = _Mypair._Myval2._Myhead; const auto _Right_head = _Right._Mypair._Myval2._Myhead; const auto _Mid = _Right_head->_Next; _Splice(_Myhead, _Right, _Mid, _Right_head, _Right_size); if (_Myhead->_Next != _Mid) { _Scary_val::_Merge_same(_Myhead->_Next, _Mid, _Myhead, _Pred); } } public: void sort() { sort(less<>{}); } template <class _Pr2> void sort(_Pr2 _Pred) { auto& _My_data = _Mypair._Myval2; _Scary_val::_Sort(_My_data._Myhead->_Next, _My_data._Mysize, _Pass_fn(_Pred)); } void reverse() noexcept { const _Nodeptr _Phead = _Mypair._Myval2._Myhead; _Nodeptr _Pnode = _Phead; for (;;) { const _Nodeptr _Pnext = _Pnode->_Next; _Pnode->_Next = _Pnode->_Prev; _Pnode->_Prev = _Pnext; if (_Pnext == _Phead) { break; } _Pnode = _Pnext; } } private: _Nodeptr _Splice( const _Nodeptr _Where, list& _Right, const _Nodeptr _First, const _Nodeptr _Last, const size_type _Count) { if (this != ::std:: addressof(_Right)) { if constexpr (!_Alnode_traits::is_always_equal::value) { do { if (_Getal() == _Right._Getal()) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1743, 0, "%s", "list allocators incompatible for splice")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"list allocators incompatible for splice\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\list", 1743, 0); } while (false); } ; } while (false); } auto& _My_data = _Mypair._Myval2; if (max_size() - _My_data._Mysize < _Count) { _Xlength_error("list too long"); } auto& _Right_data = _Right._Mypair._Myval2; if (_Count == 1) { _My_data._Adopt_unique(_Right_data, _First); } else if (_Count == _Right_data._Mysize) { _My_data._Adopt_all(_Right_data); } else { _My_data._Adopt_range(_Right_data, _First, _Last); } _My_data._Mysize += _Count; _Right_data._Mysize -= _Count; } return _Scary_val::_Unchecked_splice(_Where, _First, _Last); } void _Alloc_sentinel_and_proxy() { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alnode, _Container_proxy>>(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); auto& _Al = _Getal(); auto _Newhead = _Al.allocate(1); _Construct_in_place(_Newhead->_Next, _Newhead); _Construct_in_place(_Newhead->_Prev, _Newhead); _Mypair._Myval2._Myhead = _Newhead; _Proxy._Release(); } void _Orphan_all() noexcept { _Mypair._Myval2._Orphan_all(); } _Alnode& _Getal() noexcept { return _Mypair._Get_first(); } const _Alnode& _Getal() const noexcept { return _Mypair._Get_first(); } _Compressed_pair<_Alnode, _Scary_val> _Mypair; }; template <class _Iter, class _Alloc = allocator<_Iter_value_t<_Iter>>, enable_if_t<conjunction_v<_Is_iterator<_Iter>, _Is_allocator<_Alloc>>, int> = 0> list(_Iter, _Iter, _Alloc = _Alloc()) -> list<_Iter_value_t<_Iter>, _Alloc>; template <class _Ty, class _Alloc> void swap(list<_Ty, _Alloc>& _Left, list<_Ty, _Alloc>& _Right) noexcept { _Left.swap(_Right); } template <class _Ty, class _Alloc> [[nodiscard]] bool operator==(const list<_Ty, _Alloc>& _Left, const list<_Ty, _Alloc>& _Right) { return _Left.size() == _Right.size() && ::std:: equal(_Left._Unchecked_begin(), _Left._Unchecked_end(), _Right._Unchecked_begin()); } template <class _Ty, class _Alloc> [[nodiscard]] _Synth_three_way_result<_Ty> operator<=>(const list<_Ty, _Alloc>& _Left, const list<_Ty, _Alloc>& _Right) { return ::std:: lexicographical_compare_three_way(_Left._Unchecked_begin(), _Left._Unchecked_end(), _Right._Unchecked_begin(), _Right._Unchecked_end(), _Synth_three_way{}); } template <class _Ty, class _Alloc, class _Uty> typename list<_Ty, _Alloc>::size_type erase(list<_Ty, _Alloc>& _Cont, const _Uty& _Val) { return _Cont.remove_if([&](_Ty& _Elem) { return _Elem == _Val; }); } template <class _Ty, class _Alloc, class _Pr> typename list<_Ty, _Alloc>::size_type erase_if(list<_Ty, _Alloc>& _Cont, _Pr _Pred) { return _Cont.remove_if(_Pass_fn(_Pred)); } namespace pmr { template <class _Ty> using list = ::std:: list<_Ty, polymorphic_allocator<_Ty>>; } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { template <class _Myvec> class _Vector_const_iterator : public _Iterator_base { public: using iterator_concept = contiguous_iterator_tag; using iterator_category = random_access_iterator_tag; using value_type = typename _Myvec::value_type; using difference_type = typename _Myvec::difference_type; using pointer = typename _Myvec::const_pointer; using reference = const value_type&; using _Tptr = typename _Myvec::pointer; constexpr _Vector_const_iterator() noexcept : _Ptr() {} constexpr _Vector_const_iterator(_Tptr _Parg, const _Container_base* _Pvector) noexcept : _Ptr(_Parg) { this->_Adopt(_Pvector); } constexpr _Vector_const_iterator& operator=(const _Vector_const_iterator&) noexcept = default; [[nodiscard]] constexpr reference operator*() const noexcept { const auto _Mycont = static_cast<const _Myvec*>(this->_Getcont()); do { if (_Ptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 52, 0, "%s", "can't dereference value-initialized vector iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"can't dereference value-initialized vector iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 52, 0); } while (false); } ; } while (false); do { if (_Mycont->_Myfirst <= _Ptr && _Ptr < _Mycont->_Mylast) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 54, 0, "%s", "can't dereference out of range vector iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"can't dereference out of range vector iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 54, 0); } while (false); } ; } while (false); return *_Ptr; } [[nodiscard]] constexpr pointer operator->() const noexcept { const auto _Mycont = static_cast<const _Myvec*>(this->_Getcont()); do { if (_Ptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 63, 0, "%s", "can't dereference value-initialized vector iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"can't dereference value-initialized vector iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 63, 0); } while (false); } ; } while (false); do { if (_Mycont->_Myfirst <= _Ptr && _Ptr < _Mycont->_Mylast) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 65, 0, "%s", "can't dereference out of range vector iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"can't dereference out of range vector iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 65, 0); } while (false); } ; } while (false); return _Ptr; } constexpr _Vector_const_iterator& operator++() noexcept { const auto _Mycont = static_cast<const _Myvec*>(this->_Getcont()); do { if (_Ptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 74, 0, "%s", "can't increment value-initialized vector iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"can't increment value-initialized vector iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 74, 0); } while (false); } ; } while (false); do { if (_Ptr < _Mycont->_Mylast) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 75, 0, "%s", "can't increment vector iterator past end")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"can't increment vector iterator past end\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 75, 0); } while (false); } ; } while (false); ++_Ptr; return *this; } constexpr _Vector_const_iterator operator++(int) noexcept { _Vector_const_iterator _Tmp = *this; ++*this; return _Tmp; } constexpr _Vector_const_iterator& operator--() noexcept { const auto _Mycont = static_cast<const _Myvec*>(this->_Getcont()); do { if (_Ptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 91, 0, "%s", "can't decrement value-initialized vector iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"can't decrement value-initialized vector iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 91, 0); } while (false); } ; } while (false); do { if (_Mycont->_Myfirst < _Ptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 92, 0, "%s", "can't decrement vector iterator before begin")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"can't decrement vector iterator before begin\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 92, 0); } while (false); } ; } while (false); --_Ptr; return *this; } constexpr _Vector_const_iterator operator--(int) noexcept { _Vector_const_iterator _Tmp = *this; --*this; return _Tmp; } constexpr void _Verify_offset(const difference_type _Off) const noexcept { const auto _Mycont = static_cast<const _Myvec*>(this->_Getcont()); do { if (_Off == 0 || _Ptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 110, 0, "%s", "cannot seek value-initialized vector iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek value-initialized vector iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 110, 0); } while (false); } ; } while (false); if (_Off < 0) { do { if (_Off >= _Mycont->_Myfirst - _Ptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 112, 0, "%s", "cannot seek vector iterator before begin")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek vector iterator before begin\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 112, 0); } while (false); } ; } while (false); } if (_Off > 0) { do { if (_Off <= _Mycont->_Mylast - _Ptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 116, 0, "%s", "cannot seek vector iterator after end")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek vector iterator after end\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 116, 0); } while (false); } ; } while (false); } } constexpr _Vector_const_iterator& operator+=(const difference_type _Off) noexcept { _Verify_offset(_Off); _Ptr += _Off; return *this; } [[nodiscard]] constexpr _Vector_const_iterator operator+(const difference_type _Off) const noexcept { _Vector_const_iterator _Tmp = *this; _Tmp += _Off; return _Tmp; } constexpr _Vector_const_iterator& operator-=(const difference_type _Off) noexcept { return *this += -_Off; } [[nodiscard]] constexpr _Vector_const_iterator operator-(const difference_type _Off) const noexcept { _Vector_const_iterator _Tmp = *this; _Tmp -= _Off; return _Tmp; } [[nodiscard]] constexpr difference_type operator-(const _Vector_const_iterator& _Right) const noexcept { _Compat(_Right); return _Ptr - _Right._Ptr; } [[nodiscard]] constexpr reference operator[](const difference_type _Off) const noexcept { return *(*this + _Off); } [[nodiscard]] constexpr bool operator==(const _Vector_const_iterator& _Right) const noexcept { _Compat(_Right); return _Ptr == _Right._Ptr; } [[nodiscard]] constexpr strong_ordering operator<=>(const _Vector_const_iterator& _Right) const noexcept { _Compat(_Right); return _Unfancy(_Ptr) <=> _Unfancy(_Right._Ptr); } constexpr void _Compat(const _Vector_const_iterator& _Right) const noexcept { do { if (this->_Getcont() == _Right._Getcont()) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 190, 0, "%s", "vector iterators incompatible")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"vector iterators incompatible\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 190, 0); } while (false); } ; } while (false); } friend constexpr void _Verify_range( const _Vector_const_iterator& _First, const _Vector_const_iterator& _Last) noexcept { do { if (_First._Getcont() == _Last._Getcont()) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 197, 0, "%s", "vector iterators in range are from different containers")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"vector iterators in range are from different containers\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 197, 0); } while (false); } ; } while (false); do { if (_First._Ptr <= _Last._Ptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 198, 0, "%s", "vector iterator range transposed")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"vector iterator range transposed\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 198, 0); } while (false); } ; } while (false); } using _Prevent_inheriting_unwrap = _Vector_const_iterator; [[nodiscard]] constexpr const value_type* _Unwrapped() const noexcept { return _Unfancy(_Ptr); } constexpr void _Seek_to(const value_type* _It) noexcept { _Ptr = _Refancy<_Tptr>(const_cast<value_type*>(_It)); } _Tptr _Ptr; }; template <class _Myvec> [[nodiscard]] constexpr _Vector_const_iterator<_Myvec> operator+( typename _Vector_const_iterator<_Myvec>::difference_type _Off, _Vector_const_iterator<_Myvec> _Next) noexcept { return _Next += _Off; } template <class _Myvec> struct pointer_traits<_Vector_const_iterator<_Myvec>> { using pointer = _Vector_const_iterator<_Myvec>; using element_type = const typename pointer::value_type; using difference_type = typename pointer::difference_type; [[nodiscard]] static constexpr element_type* to_address(const pointer _Iter) noexcept { const auto _Mycont = static_cast<const _Myvec*>(_Iter._Getcont()); if (_Mycont) { do { if (_Mycont->_Myfirst <= _Iter._Ptr && _Iter._Ptr <= _Mycont->_Mylast) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 237, 0, "%s", "can't convert out-of-range vector iterator to pointer")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"can't convert out-of-range vector iterator to pointer\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 237, 0); } while (false); } ; } while (false); } else { do { if (!_Iter._Ptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 239, 0, "%s", "can't convert invalid vector iterator to pointer")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"can't convert invalid vector iterator to pointer\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 239, 0); } while (false); } ; } while (false); } return ::std:: to_address(_Iter._Ptr); } }; template <class _Myvec> class _Vector_iterator : public _Vector_const_iterator<_Myvec> { public: using _Mybase = _Vector_const_iterator<_Myvec>; using iterator_concept = contiguous_iterator_tag; using iterator_category = random_access_iterator_tag; using value_type = typename _Myvec::value_type; using difference_type = typename _Myvec::difference_type; using pointer = typename _Myvec::pointer; using reference = value_type&; using _Mybase::_Mybase; constexpr _Vector_iterator& operator=(const _Vector_iterator&) noexcept = default; [[nodiscard]] constexpr reference operator*() const noexcept { return const_cast<reference>(_Mybase::operator*()); } [[nodiscard]] constexpr pointer operator->() const noexcept { const auto _Mycont = static_cast<const _Myvec*>(this->_Getcont()); do { if (this->_Ptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 275, 0, "%s", "can't dereference value-initialized vector iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"can't dereference value-initialized vector iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 275, 0); } while (false); } ; } while (false); do { if (_Mycont->_Myfirst <= this->_Ptr && this->_Ptr < _Mycont->_Mylast) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 277, 0, "%s", "can't dereference out of range vector iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"can't dereference out of range vector iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 277, 0); } while (false); } ; } while (false); return this->_Ptr; } constexpr _Vector_iterator& operator++() noexcept { _Mybase::operator++(); return *this; } constexpr _Vector_iterator operator++(int) noexcept { _Vector_iterator _Tmp = *this; _Mybase::operator++(); return _Tmp; } constexpr _Vector_iterator& operator--() noexcept { _Mybase::operator--(); return *this; } constexpr _Vector_iterator operator--(int) noexcept { _Vector_iterator _Tmp = *this; _Mybase::operator--(); return _Tmp; } constexpr _Vector_iterator& operator+=(const difference_type _Off) noexcept { _Mybase::operator+=(_Off); return *this; } [[nodiscard]] constexpr _Vector_iterator operator+(const difference_type _Off) const noexcept { _Vector_iterator _Tmp = *this; _Tmp += _Off; return _Tmp; } constexpr _Vector_iterator& operator-=(const difference_type _Off) noexcept { _Mybase::operator-=(_Off); return *this; } using _Mybase::operator-; [[nodiscard]] constexpr _Vector_iterator operator-(const difference_type _Off) const noexcept { _Vector_iterator _Tmp = *this; _Tmp -= _Off; return _Tmp; } [[nodiscard]] constexpr reference operator[](const difference_type _Off) const noexcept { return const_cast<reference>(_Mybase::operator[](_Off)); } using _Prevent_inheriting_unwrap = _Vector_iterator; [[nodiscard]] constexpr value_type* _Unwrapped() const noexcept { return _Unfancy(this->_Ptr); } }; template <class _Myvec> [[nodiscard]] constexpr _Vector_iterator<_Myvec> operator+( typename _Vector_iterator<_Myvec>::difference_type _Off, _Vector_iterator<_Myvec> _Next) noexcept { return _Next += _Off; } template <class _Myvec> struct pointer_traits<_Vector_iterator<_Myvec>> { using pointer = _Vector_iterator<_Myvec>; using element_type = typename pointer::value_type; using difference_type = typename pointer::difference_type; [[nodiscard]] static constexpr element_type* to_address(const pointer _Iter) noexcept { const auto _Mycont = static_cast<const _Myvec*>(_Iter._Getcont()); if (_Mycont) { do { if (_Mycont->_Myfirst <= _Iter._Ptr && _Iter._Ptr <= _Mycont->_Mylast) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 362, 0, "%s", "can't convert out-of-range vector iterator to pointer")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"can't convert out-of-range vector iterator to pointer\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 362, 0); } while (false); } ; } while (false); } else { do { if (!_Iter._Ptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 364, 0, "%s", "can't convert invalid vector iterator to pointer")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"can't convert invalid vector iterator to pointer\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 364, 0); } while (false); } ; } while (false); } return ::std:: to_address(_Iter._Ptr); } }; template <class _Value_type, class _Size_type, class _Difference_type, class _Pointer, class _Const_pointer, class _Reference, class _Const_reference> struct _Vec_iter_types { using value_type = _Value_type; using size_type = _Size_type; using difference_type = _Difference_type; using pointer = _Pointer; using const_pointer = _Const_pointer; }; struct _Value_init_tag { explicit _Value_init_tag() = default; }; template <class _Val_types> class _Vector_val : public _Container_base { public: using value_type = typename _Val_types::value_type; using size_type = typename _Val_types::size_type; using difference_type = typename _Val_types::difference_type; using pointer = typename _Val_types::pointer; using const_pointer = typename _Val_types::const_pointer; using reference = value_type&; using const_reference = const value_type&; constexpr _Vector_val() noexcept : _Myfirst(), _Mylast(), _Myend() {} constexpr _Vector_val(pointer _First, pointer _Last, pointer _End) noexcept : _Myfirst(_First), _Mylast(_Last), _Myend(_End) {} constexpr void _Swap_val(_Vector_val& _Right) noexcept { this->_Swap_proxy_and_iterators(_Right); _Swap_adl(_Myfirst, _Right._Myfirst); _Swap_adl(_Mylast, _Right._Mylast); _Swap_adl(_Myend, _Right._Myend); } constexpr void _Take_contents(_Vector_val& _Right) noexcept { this->_Swap_proxy_and_iterators(_Right); _Myfirst = _Right._Myfirst; _Mylast = _Right._Mylast; _Myend = _Right._Myend; _Right._Myfirst = nullptr; _Right._Mylast = nullptr; _Right._Myend = nullptr; } pointer _Myfirst; pointer _Mylast; pointer _Myend; }; template <class _Ptrty> constexpr auto _Unfancy_maybe_null(_Ptrty _Ptr) noexcept { return _Ptr ? ::std:: addressof(*_Ptr) : nullptr; } template <class _Ty> constexpr _Ty* _Unfancy_maybe_null(_Ty* _Ptr) noexcept { return _Ptr; } template <class _Ty, class _Alloc = allocator<_Ty>> class vector { private: template <class> friend class _Vb_val; friend _Tidy_guard<vector>; using _Alty = _Rebind_alloc_t<_Alloc, _Ty>; using _Alty_traits = allocator_traits<_Alty>; public: static_assert(!1 || is_same_v<_Ty, typename _Alloc::value_type>, "vector<T, Allocator>" " requires that Allocator's value_type match " "T" " (See N4659 26.2.1 [container.requirements.general]/16 allocator_type)" " Either fix the allocator value_type or define _ENFORCE_MATCHING_ALLOCATORS=0" " to suppress this diagnostic."); using value_type = _Ty; using allocator_type = _Alloc; using pointer = typename _Alty_traits::pointer; using const_pointer = typename _Alty_traits::const_pointer; using reference = _Ty&; using const_reference = const _Ty&; using size_type = typename _Alty_traits::size_type; using difference_type = typename _Alty_traits::difference_type; private: using _Scary_val = _Vector_val<conditional_t<_Is_simple_alloc_v<_Alty>, _Simple_types<_Ty>, _Vec_iter_types<_Ty, size_type, difference_type, pointer, const_pointer, _Ty&, const _Ty&>>>; public: using iterator = _Vector_iterator<_Scary_val>; using const_iterator = _Vector_const_iterator<_Scary_val>; using reverse_iterator = ::std:: reverse_iterator<iterator>; using const_reverse_iterator = ::std:: reverse_iterator<const_iterator>; constexpr vector() noexcept(is_nothrow_default_constructible_v<_Alty>) : _Mypair(_Zero_then_variadic_args_t{}) { _Mypair._Myval2._Alloc_proxy(static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal())); } constexpr explicit vector(const _Alloc& _Al) noexcept : _Mypair(_One_then_variadic_args_t{}, _Al) { _Mypair._Myval2._Alloc_proxy(static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal())); } private: template <class _Ty2> constexpr void _Construct_n_copies_of_ty( const size_type _Count, const _Ty2& _Val) { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()); auto& _My_data = _Mypair._Myval2; _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _My_data); if (_Count != 0) { _Buy_nonzero(_Count); _Tidy_guard<vector> _Guard{this}; _My_data._Mylast = _Ufill(_My_data._Myfirst, _Count, _Val); _Guard._Target = nullptr; } _Proxy._Release(); } public: constexpr explicit vector( const size_type _Count, const _Alloc& _Al = _Alloc()) : _Mypair(_One_then_variadic_args_t{}, _Al) { _Construct_n_copies_of_ty(_Count, _Value_init_tag{}); } constexpr vector( const size_type _Count, const _Ty& _Val, const _Alloc& _Al = _Alloc()) : _Mypair(_One_then_variadic_args_t{}, _Al) { _Construct_n_copies_of_ty(_Count, _Val); } private: template <class _Iter> constexpr void _Range_construct_or_tidy(_Iter _First, _Iter _Last, input_iterator_tag) { _Tidy_guard<vector> _Guard{this}; for (; _First != _Last; ++_First) { emplace_back(*_First); } _Guard._Target = nullptr; } template <class _Iter> constexpr void _Range_construct_or_tidy(_Iter _First, _Iter _Last, forward_iterator_tag) { const auto _Count = _Convert_size<size_type>(static_cast<size_t>(::std:: distance(_First, _Last))); if (_Count != 0) { _Buy_nonzero(_Count); _Tidy_guard<vector> _Guard{this}; auto& _My_data = _Mypair._Myval2; _My_data._Mylast = _Ucopy(_First, _Last, _My_data._Myfirst); _Guard._Target = nullptr; } } public: template <class _Iter, enable_if_t<_Is_iterator_v<_Iter>, int> = 0> constexpr vector(_Iter _First, _Iter _Last, const _Alloc& _Al = _Alloc()) : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Adl_verify_range(_First, _Last); _Range_construct_or_tidy(_Get_unwrapped(_First), _Get_unwrapped(_Last), _Iter_cat_t<_Iter>{}); _Proxy._Release(); } constexpr vector(initializer_list<_Ty> _Ilist, const _Alloc& _Al = _Alloc()) : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Range_construct_or_tidy(_Ilist.begin(), _Ilist.end(), random_access_iterator_tag{}); _Proxy._Release(); } constexpr vector(const vector& _Right) : _Mypair(_One_then_variadic_args_t{}, _Alty_traits::select_on_container_copy_construction(_Right._Getal())) { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()); auto& _My_data = _Mypair._Myval2; const auto& _Right_data = _Right._Mypair._Myval2; const pointer _Rightfirst = _Right_data._Myfirst; const pointer _Rightlast = _Right_data._Mylast; _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _My_data); if (_Rightfirst != _Rightlast) { _Buy_raw(static_cast<size_type>(_Rightlast - _Rightfirst)); _Tidy_guard<vector> _Guard{this}; _My_data._Mylast = _Ucopy(_Rightfirst, _Rightlast, _My_data._Myfirst); _Guard._Target = nullptr; } _Proxy._Release(); } constexpr vector(const vector& _Right, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()); auto& _My_data = _Mypair._Myval2; const auto& _Right_data = _Right._Mypair._Myval2; const pointer _Rightfirst = _Right_data._Myfirst; const pointer _Rightlast = _Right_data._Mylast; _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _My_data); if (_Rightfirst != _Rightlast) { _Buy_raw(static_cast<size_type>(_Rightlast - _Rightfirst)); _Tidy_guard<vector> _Guard{this}; _My_data._Mylast = _Ucopy(_Rightfirst, _Rightlast, _My_data._Myfirst); _Guard._Target = nullptr; } _Proxy._Release(); } private: constexpr void _Move_construct(vector& _Right, true_type) noexcept { _Mypair._Myval2._Take_contents(_Right._Mypair._Myval2); } constexpr void _Move_construct(vector& _Right, false_type) { if constexpr (!_Alty_traits::is_always_equal::value) { if (_Getal() != _Right._Getal()) { const auto& _Right_data = _Right._Mypair._Myval2; const pointer _Rightfirst = _Right_data._Myfirst; const pointer _Rightlast = _Right_data._Mylast; if (_Rightfirst != _Rightlast) { _Buy_raw(static_cast<size_type>(_Rightlast - _Rightfirst)); _Tidy_guard<vector> _Guard{this}; auto& _My_data = _Mypair._Myval2; _My_data._Mylast = _Umove(_Rightfirst, _Rightlast, _My_data._Myfirst); _Guard._Target = nullptr; } return; } } _Move_construct(_Right, true_type{}); } public: constexpr vector(vector&& _Right) noexcept : _Mypair(_One_then_variadic_args_t{}, ::std:: move(_Right._Getal()), ::std:: exchange(_Right._Mypair._Myval2._Myfirst, nullptr), ::std:: exchange(_Right._Mypair._Myval2._Mylast, nullptr), ::std:: exchange(_Right._Mypair._Myval2._Myend, nullptr)) { _Mypair._Myval2._Alloc_proxy(static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal())); _Mypair._Myval2._Swap_proxy_and_iterators(_Right._Mypair._Myval2); } constexpr vector(vector&& _Right, const _Alloc& _Al) noexcept( _Alty_traits::is_always_equal::value) : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Move_construct(_Right, typename _Alty_traits::is_always_equal::type{}); _Proxy._Release(); } private: constexpr void _Move_assign(vector& _Right, _Equal_allocators) noexcept { _Tidy(); _Pocma(_Getal(), _Right._Getal()); _Mypair._Myval2._Take_contents(_Right._Mypair._Myval2); } constexpr void _Move_assign(vector& _Right, _Propagate_allocators) noexcept { _Tidy(); if (_Getal() != _Right._Getal()) { _Mypair._Myval2._Reload_proxy( static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()), static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Right._Getal())); } _Pocma(_Getal(), _Right._Getal()); _Mypair._Myval2._Take_contents(_Right._Mypair._Myval2); } constexpr void _Move_assign(vector& _Right, _No_propagate_allocators) { if (_Getal() == _Right._Getal()) { _Move_assign(_Right, _Equal_allocators{}); } else { auto& _Right_data = _Right._Mypair._Myval2; const pointer _First = _Right_data._Myfirst; const pointer _Last = _Right_data._Mylast; const auto _Newsize = static_cast<size_type>(_Last - _First); auto& _My_data = _Mypair._Myval2; pointer& _Myfirst = _My_data._Myfirst; pointer& _Mylast = _My_data._Mylast; _My_data._Orphan_all(); const auto _Oldcapacity = static_cast<size_type>(_My_data._Myend - _Myfirst); if constexpr (conjunction_v<bool_constant<_Ptr_copy_cat<_Ty*, _Ty*>::_Trivially_copyable>, _Uses_default_construct<_Alty, _Ty*, _Ty>, _Uses_default_destroy<_Alty, _Ty*>>) { if (_Newsize > _Oldcapacity) { _Clear_and_reserve_geometric(_Newsize); } _Mylast = _Refancy<pointer>(_Copy_memmove(_Unfancy(_First), _Unfancy(_Last), _Unfancy(_Myfirst))); } else { auto _Oldsize = static_cast<size_type>(_Mylast - _Myfirst); if (_Newsize > _Oldsize) { if (_Newsize > _Oldcapacity) { _Clear_and_reserve_geometric(_Newsize); _Oldsize = 0; } const pointer _Mid = _First + _Oldsize; _Move_unchecked(_First, _Mid, _Myfirst); _Mylast = _Umove(_Mid, _Last, _Mylast); } else { const pointer _Newlast = _Myfirst + _Newsize; _Move_unchecked(_First, _Last, _Myfirst); _Destroy(_Newlast, _Mylast); _Mylast = _Newlast; } } } } public: constexpr vector& operator=(vector&& _Right) noexcept( noexcept(_Move_assign(_Right, _Choose_pocma<_Alty>{}))) { if (this != ::std:: addressof(_Right)) { _Move_assign(_Right, _Choose_pocma<_Alty>{}); } return *this; } constexpr ~vector() noexcept { _Tidy(); auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()); _Delete_plain_internal(_Alproxy, ::std:: exchange(_Mypair._Myval2._Myproxy, nullptr)); } private: template <class... _Valty> constexpr decltype(auto) _Emplace_back_with_unused_capacity(_Valty&&... _Val) { auto& _My_data = _Mypair._Myval2; pointer& _Mylast = _My_data._Mylast; ; _Alty_traits::construct(_Getal(), _Unfancy(_Mylast), ::std:: forward<_Valty>(_Val)...); _Orphan_range(_Mylast, _Mylast); _Ty& _Result = *_Mylast; ++_Mylast; return _Result; } public: template <class... _Valty> constexpr decltype(auto) emplace_back(_Valty&&... _Val) { auto& _My_data = _Mypair._Myval2; pointer& _Mylast = _My_data._Mylast; if (_Mylast != _My_data._Myend) { return _Emplace_back_with_unused_capacity(::std:: forward<_Valty>(_Val)...); } _Ty& _Result = *_Emplace_reallocate(_Mylast, ::std:: forward<_Valty>(_Val)...); return _Result; } constexpr void push_back(const _Ty& _Val) { emplace_back(_Val); } constexpr void push_back(_Ty&& _Val) { emplace_back(::std:: move(_Val)); } template <class... _Valty> constexpr pointer _Emplace_reallocate(const pointer _Whereptr, _Valty&&... _Val) { _Alty& _Al = _Getal(); auto& _My_data = _Mypair._Myval2; pointer& _Myfirst = _My_data._Myfirst; pointer& _Mylast = _My_data._Mylast; ; const auto _Whereoff = static_cast<size_type>(_Whereptr - _Myfirst); const auto _Oldsize = static_cast<size_type>(_Mylast - _Myfirst); if (_Oldsize == max_size()) { _Xlength(); } const size_type _Newsize = _Oldsize + 1; const size_type _Newcapacity = _Calculate_growth(_Newsize); const pointer _Newvec = _Al.allocate(_Newcapacity); const pointer _Constructed_last = _Newvec + _Whereoff + 1; pointer _Constructed_first = _Constructed_last; try { _Alty_traits::construct(_Al, _Unfancy(_Newvec + _Whereoff), ::std:: forward<_Valty>(_Val)...); _Constructed_first = _Newvec + _Whereoff; if (_Whereptr == _Mylast) { _Umove_if_noexcept(_Myfirst, _Mylast, _Newvec); } else { _Umove(_Myfirst, _Whereptr, _Newvec); _Constructed_first = _Newvec; _Umove(_Whereptr, _Mylast, _Newvec + _Whereoff + 1); } } catch (...) { _Destroy(_Constructed_first, _Constructed_last); _Al.deallocate(_Newvec, _Newcapacity); throw; } _Change_array(_Newvec, _Newsize, _Newcapacity); return _Newvec + _Whereoff; } template <class... _Valty> constexpr iterator emplace(const_iterator _Where, _Valty&&... _Val) { const pointer _Whereptr = _Where._Ptr; auto& _My_data = _Mypair._Myval2; const pointer _Oldlast = _My_data._Mylast; do { if (_Where._Getcont() == ::std:: addressof(_My_data) && _Whereptr >= _My_data._Myfirst && _Oldlast >= _Whereptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 818, 0, "%s", "vector emplace iterator outside range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"vector emplace iterator outside range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 818, 0); } while (false); } ; } while (false); if (_Oldlast != _My_data._Myend) { if (_Whereptr == _Oldlast) { _Emplace_back_with_unused_capacity(::std:: forward<_Valty>(_Val)...); } else { auto& _Al = _Getal(); _Alloc_temporary<_Alty> _Obj(_Al, ::std:: forward<_Valty>(_Val)...); _Orphan_range(_Whereptr, _Oldlast); _Alty_traits::construct(_Al, _Unfancy(_Oldlast), ::std:: move(_Oldlast[-1])); ++_My_data._Mylast; _Move_backward_unchecked(_Whereptr, _Oldlast - 1, _Oldlast); *_Whereptr = ::std:: move(_Obj._Storage._Value); } return _Make_iterator(_Whereptr); } return _Make_iterator(_Emplace_reallocate(_Whereptr, ::std:: forward<_Valty>(_Val)...)); } constexpr iterator insert(const_iterator _Where, const _Ty& _Val) { return emplace(_Where, _Val); } constexpr iterator insert(const_iterator _Where, _Ty&& _Val) { return emplace(_Where, ::std:: move(_Val)); } constexpr iterator insert( const_iterator _Where, const size_type _Count, const _Ty& _Val) { const pointer _Whereptr = _Where._Ptr; auto& _My_data = _Mypair._Myval2; pointer& _Mylast = _My_data._Mylast; const pointer _Oldfirst = _My_data._Myfirst; const pointer _Oldlast = _Mylast; do { if (_Where._Getcont() == ::std:: addressof(_My_data) && _Whereptr >= _Oldfirst && _Oldlast >= _Whereptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 861, 0, "%s", "vector insert iterator outside range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"vector insert iterator outside range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 861, 0); } while (false); } ; } while (false); const auto _Whereoff = static_cast<size_type>(_Whereptr - _Oldfirst); const auto _Unused_capacity = static_cast<size_type>(_My_data._Myend - _Oldlast); const bool _One_at_back = _Count == 1 && _Whereptr == _Oldlast; if (_Count == 0) { } else if (_Count > _Unused_capacity) { const auto _Oldsize = static_cast<size_type>(_Oldlast - _Oldfirst); if (_Count > max_size() - _Oldsize) { _Xlength(); } const size_type _Newsize = _Oldsize + _Count; const size_type _Newcapacity = _Calculate_growth(_Newsize); const pointer _Newvec = _Getal().allocate(_Newcapacity); const pointer _Constructed_last = _Newvec + _Whereoff + _Count; pointer _Constructed_first = _Constructed_last; try { _Ufill(_Newvec + _Whereoff, _Count, _Val); _Constructed_first = _Newvec + _Whereoff; if (_One_at_back) { _Umove_if_noexcept(_Oldfirst, _Oldlast, _Newvec); } else { _Umove(_Oldfirst, _Whereptr, _Newvec); _Constructed_first = _Newvec; _Umove(_Whereptr, _Oldlast, _Newvec + _Whereoff + _Count); } } catch (...) { _Destroy(_Constructed_first, _Constructed_last); _Getal().deallocate(_Newvec, _Newcapacity); throw; } _Change_array(_Newvec, _Newsize, _Newcapacity); } else if (_One_at_back) { _Emplace_back_with_unused_capacity(_Val); } else { const _Alloc_temporary<_Alty> _Tmp_storage(_Getal(), _Val); const auto& _Tmp = _Tmp_storage._Storage._Value; const auto _Affected_elements = static_cast<size_type>(_Oldlast - _Whereptr); _Orphan_range(_Whereptr, _Oldlast); if (_Count > _Affected_elements) { _Mylast = _Ufill(_Oldlast, _Count - _Affected_elements, _Tmp); _Mylast = _Umove(_Whereptr, _Oldlast, _Mylast); ::std:: fill(_Whereptr, _Oldlast, _Tmp); } else { _Mylast = _Umove(_Oldlast - _Count, _Oldlast, _Oldlast); _Move_backward_unchecked(_Whereptr, _Oldlast - _Count, _Oldlast); ::std:: fill(_Whereptr, _Whereptr + _Count, _Tmp); } } return _Make_iterator_offset(_Whereoff); } private: template <class _Iter> constexpr void _Insert_range(const_iterator _Where, _Iter _First, _Iter _Last, input_iterator_tag) { if (_First == _Last) { return; } auto& _My_data = _Mypair._Myval2; pointer& _Myfirst = _My_data._Myfirst; pointer& _Mylast = _My_data._Mylast; const auto _Whereoff = static_cast<size_type>(_Where._Ptr - _Myfirst); const auto _Oldsize = static_cast<size_type>(_Mylast - _Myfirst); for (; _First != _Last; ++_First) { emplace_back(*_First); } _Orphan_range(_Myfirst + _Whereoff, _Myfirst + _Oldsize); ::std:: rotate(_Myfirst + _Whereoff, _Myfirst + _Oldsize, _Mylast); } template <class _Iter> constexpr void _Insert_range(const_iterator _Where, _Iter _First, _Iter _Last, forward_iterator_tag) { const pointer _Whereptr = _Where._Ptr; const auto _Count = _Convert_size<size_type>(static_cast<size_t>(::std:: distance(_First, _Last))); auto& _My_data = _Mypair._Myval2; pointer& _Mylast = _My_data._Mylast; const pointer _Oldfirst = _My_data._Myfirst; const pointer _Oldlast = _Mylast; const auto _Unused_capacity = static_cast<size_type>(_My_data._Myend - _Oldlast); if (_Count == 0) { } else if (_Count > _Unused_capacity) { const auto _Oldsize = static_cast<size_type>(_Oldlast - _Oldfirst); if (_Count > max_size() - _Oldsize) { _Xlength(); } const size_type _Newsize = _Oldsize + _Count; const size_type _Newcapacity = _Calculate_growth(_Newsize); const pointer _Newvec = _Getal().allocate(_Newcapacity); const auto _Whereoff = static_cast<size_type>(_Whereptr - _Oldfirst); const pointer _Constructed_last = _Newvec + _Whereoff + _Count; pointer _Constructed_first = _Constructed_last; try { _Ucopy(_First, _Last, _Newvec + _Whereoff); _Constructed_first = _Newvec + _Whereoff; if (_Count == 1 && _Whereptr == _Oldlast) { _Umove_if_noexcept(_Oldfirst, _Oldlast, _Newvec); } else { _Umove(_Oldfirst, _Whereptr, _Newvec); _Constructed_first = _Newvec; _Umove(_Whereptr, _Oldlast, _Newvec + _Whereoff + _Count); } } catch (...) { _Destroy(_Constructed_first, _Constructed_last); _Getal().deallocate(_Newvec, _Newcapacity); throw; } _Change_array(_Newvec, _Newsize, _Newcapacity); } else { const auto _Affected_elements = static_cast<size_type>(_Oldlast - _Whereptr); if (_Count < _Affected_elements) { _Mylast = _Umove(_Oldlast - _Count, _Oldlast, _Oldlast); _Move_backward_unchecked(_Whereptr, _Oldlast - _Count, _Oldlast); _Destroy(_Whereptr, _Whereptr + _Count); try { _Ucopy(_First, _Last, _Whereptr); } catch (...) { try { _Umove(_Whereptr + _Count, _Whereptr + 2 * _Count, _Whereptr); } catch (...) { _Orphan_range(_Whereptr, _Oldlast); _Destroy(_Whereptr + _Count, _Mylast); _Mylast = _Whereptr; throw; } _Move_unchecked(_Whereptr + 2 * _Count, _Mylast, _Whereptr + _Count); _Destroy(_Oldlast, _Mylast); _Mylast = _Oldlast; throw; } } else { const pointer _Relocated = _Whereptr + _Count; _Mylast = _Umove(_Whereptr, _Oldlast, _Relocated); _Destroy(_Whereptr, _Oldlast); try { _Ucopy(_First, _Last, _Whereptr); } catch (...) { try { _Umove(_Relocated, _Mylast, _Whereptr); } catch (...) { _Orphan_range(_Whereptr, _Oldlast); _Destroy(_Relocated, _Mylast); _Mylast = _Whereptr; throw; } _Destroy(_Relocated, _Mylast); _Mylast = _Oldlast; throw; } } _Orphan_range(_Whereptr, _Oldlast); } } public: template <class _Iter, enable_if_t<_Is_iterator_v<_Iter>, int> = 0> constexpr iterator insert(const_iterator _Where, _Iter _First, _Iter _Last) { const pointer _Whereptr = _Where._Ptr; auto& _My_data = _Mypair._Myval2; const pointer _Oldfirst = _My_data._Myfirst; do { if (_Where._Getcont() == ::std:: addressof(_My_data) && _Whereptr >= _Oldfirst && _My_data._Mylast >= _Whereptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 1066, 0, "%s", "vector insert iterator outside range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"vector insert iterator outside range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 1066, 0); } while (false); } ; } while (false); _Adl_verify_range(_First, _Last); const auto _Whereoff = static_cast<size_type>(_Whereptr - _Oldfirst); _Insert_range(_Where, _Get_unwrapped(_First), _Get_unwrapped(_Last), _Iter_cat_t<_Iter>{}); return _Make_iterator_offset(_Whereoff); } constexpr iterator insert(const_iterator _Where, initializer_list<_Ty> _Ilist) { return insert(_Where, _Ilist.begin(), _Ilist.end()); } constexpr void assign( const size_type _Newsize, const _Ty& _Val) { auto& _My_data = _Mypair._Myval2; pointer& _Myfirst = _My_data._Myfirst; pointer& _Mylast = _My_data._Mylast; _My_data._Orphan_all(); auto _Oldsize = static_cast<size_type>(_Mylast - _Myfirst); if (_Newsize > _Oldsize) { const auto _Oldcapacity = static_cast<size_type>(_My_data._Myend - _Myfirst); if (_Newsize > _Oldcapacity) { _Clear_and_reserve_geometric(_Newsize); _Oldsize = 0; } else { ::std:: fill(_Myfirst, _Mylast, _Val); } _Mylast = _Ufill(_Mylast, _Newsize - _Oldsize, _Val); } else { const pointer _Newlast = _Myfirst + _Newsize; ::std:: fill(_Myfirst, _Newlast, _Val); _Destroy(_Newlast, _Mylast); _Mylast = _Newlast; } } private: template <class _Iter> constexpr void _Assign_range(_Iter _First, _Iter _Last, input_iterator_tag) { auto& _My_data = _Mypair._Myval2; pointer& _Myfirst = _My_data._Myfirst; pointer& _Mylast = _My_data._Mylast; _My_data._Orphan_all(); pointer _Next = _Myfirst; for (; _First != _Last && _Next != _Mylast; ++_First, (void) ++_Next) { *_Next = *_First; } _Destroy(_Next, _Mylast); _Mylast = _Next; for (; _First != _Last; ++_First) { emplace_back(*_First); } } template <class _Iter> constexpr void _Assign_range(_Iter _First, _Iter _Last, forward_iterator_tag) { const auto _Newsize = _Convert_size<size_type>(static_cast<size_t>(::std:: distance(_First, _Last))); auto& _My_data = _Mypair._Myval2; pointer& _Myfirst = _My_data._Myfirst; pointer& _Mylast = _My_data._Mylast; pointer& _Myend = _My_data._Myend; _My_data._Orphan_all(); if constexpr (conjunction_v<bool_constant<_Ptr_copy_cat<_Iter, _Ty*>::_Trivially_copyable>, _Uses_default_construct<_Alty, _Ty*, decltype(*_First)>, _Uses_default_destroy<_Alty, _Ty*>>) { if (!::std:: is_constant_evaluated()) { const auto _Oldcapacity = static_cast<size_type>(_Myend - _Myfirst); if (_Newsize > _Oldcapacity) { _Clear_and_reserve_geometric(_Newsize); } _Mylast = _Refancy<pointer>(_Copy_memmove(_First, _Last, _Unfancy(_Myfirst))); return; } } auto _Oldsize = static_cast<size_type>(_Mylast - _Myfirst); if (_Newsize > _Oldsize) { const auto _Oldcapacity = static_cast<size_type>(_Myend - _Myfirst); if (_Newsize > _Oldcapacity) { _Clear_and_reserve_geometric(_Newsize); _Oldsize = 0; } const _Iter _Mid = ::std:: next(_First, static_cast<difference_type>(_Oldsize)); _Copy_unchecked(_First, _Mid, _Myfirst); _Mylast = _Ucopy(_Mid, _Last, _Mylast); } else { const pointer _Newlast = _Myfirst + _Newsize; _Copy_unchecked(_First, _Last, _Myfirst); _Destroy(_Newlast, _Mylast); _Mylast = _Newlast; } } public: template <class _Iter, enable_if_t<_Is_iterator_v<_Iter>, int> = 0> constexpr void assign(_Iter _First, _Iter _Last) { _Adl_verify_range(_First, _Last); _Assign_range(_Get_unwrapped(_First), _Get_unwrapped(_Last), _Iter_cat_t<_Iter>{}); } constexpr void assign(initializer_list<_Ty> _Ilist) { _Assign_range(_Ilist.begin(), _Ilist.end(), random_access_iterator_tag{}); } private: constexpr void _Copy_assign(const vector& _Right, false_type) { _Pocca(_Getal(), _Right._Getal()); auto& _Right_data = _Right._Mypair._Myval2; assign(_Right_data._Myfirst, _Right_data._Mylast); } constexpr void _Copy_assign(const vector& _Right, true_type) { if (_Getal() != _Right._Getal()) { _Tidy(); _Mypair._Myval2._Reload_proxy( static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()), static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Right._Getal())); } _Copy_assign(_Right, false_type{}); } public: constexpr vector& operator=(const vector& _Right) { if (this != ::std:: addressof(_Right)) { _Copy_assign(_Right, _Choose_pocca<_Alty>{}); } return *this; } constexpr vector& operator=(initializer_list<_Ty> _Ilist) { _Assign_range(_Ilist.begin(), _Ilist.end(), random_access_iterator_tag{}); return *this; } private: template <class _Ty2> constexpr void _Resize_reallocate(const size_type _Newsize, const _Ty2& _Val) { if (_Newsize > max_size()) { _Xlength(); } auto& _My_data = _Mypair._Myval2; pointer& _Myfirst = _My_data._Myfirst; pointer& _Mylast = _My_data._Mylast; const auto _Oldsize = static_cast<size_type>(_Mylast - _Myfirst); const size_type _Newcapacity = _Calculate_growth(_Newsize); const pointer _Newvec = _Getal().allocate(_Newcapacity); const pointer _Appended_first = _Newvec + _Oldsize; pointer _Appended_last = _Appended_first; try { _Appended_last = _Ufill(_Appended_first, _Newsize - _Oldsize, _Val); _Umove_if_noexcept(_Myfirst, _Mylast, _Newvec); } catch (...) { _Destroy(_Appended_first, _Appended_last); _Getal().deallocate(_Newvec, _Newcapacity); throw; } _Change_array(_Newvec, _Newsize, _Newcapacity); } template <class _Ty2> constexpr void _Resize(const size_type _Newsize, const _Ty2& _Val) { auto& _My_data = _Mypair._Myval2; pointer& _Myfirst = _My_data._Myfirst; pointer& _Mylast = _My_data._Mylast; const auto _Oldsize = static_cast<size_type>(_Mylast - _Myfirst); if (_Newsize < _Oldsize) { const pointer _Newlast = _Myfirst + _Newsize; _Orphan_range(_Newlast, _Mylast); _Destroy(_Newlast, _Mylast); _Mylast = _Newlast; return; } if (_Newsize > _Oldsize) { const auto _Oldcapacity = static_cast<size_type>(_My_data._Myend - _Myfirst); if (_Newsize > _Oldcapacity) { _Resize_reallocate(_Newsize, _Val); return; } const pointer _Oldlast = _Mylast; _Mylast = _Ufill(_Oldlast, _Newsize - _Oldsize, _Val); _Orphan_range(_Oldlast, _Oldlast); } } public: constexpr void resize( const size_type _Newsize) { _Resize(_Newsize, _Value_init_tag{}); } constexpr void resize( const size_type _Newsize, const _Ty& _Val) { _Resize(_Newsize, _Val); } private: constexpr void _Reallocate_exactly(const size_type _Newcapacity) { auto& _My_data = _Mypair._Myval2; pointer& _Myfirst = _My_data._Myfirst; pointer& _Mylast = _My_data._Mylast; const auto _Size = static_cast<size_type>(_Mylast - _Myfirst); const pointer _Newvec = _Getal().allocate(_Newcapacity); try { _Umove_if_noexcept(_Myfirst, _Mylast, _Newvec); } catch (...) { _Getal().deallocate(_Newvec, _Newcapacity); throw; } _Change_array(_Newvec, _Size, _Newcapacity); } constexpr void _Clear_and_reserve_geometric(const size_type _Newsize) { auto& _My_data = _Mypair._Myval2; pointer& _Myfirst = _My_data._Myfirst; pointer& _Mylast = _My_data._Mylast; pointer& _Myend = _My_data._Myend; if (_Newsize > max_size()) { _Xlength(); } const size_type _Newcapacity = _Calculate_growth(_Newsize); if (_Myfirst) { _Destroy(_Myfirst, _Mylast); _Getal().deallocate(_Myfirst, static_cast<size_type>(_Myend - _Myfirst)); _Myfirst = nullptr; _Mylast = nullptr; _Myend = nullptr; } _Buy_raw(_Newcapacity); } public: constexpr void reserve( const size_type _Newcapacity) { if (_Newcapacity > capacity()) { if (_Newcapacity > max_size()) { _Xlength(); } _Reallocate_exactly(_Newcapacity); } } constexpr void shrink_to_fit() { auto& _My_data = _Mypair._Myval2; const pointer _Oldlast = _My_data._Mylast; if (_Oldlast != _My_data._Myend) { const pointer _Oldfirst = _My_data._Myfirst; if (_Oldfirst == _Oldlast) { _Tidy(); } else { _Reallocate_exactly(static_cast<size_type>(_Oldlast - _Oldfirst)); } } } constexpr void pop_back() noexcept { auto& _My_data = _Mypair._Myval2; pointer& _Mylast = _My_data._Mylast; do { if (_My_data._Myfirst != _Mylast) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 1398, 0, "%s", "vector empty before pop")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"vector empty before pop\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 1398, 0); } while (false); } ; } while (false); _Orphan_range(_Mylast - 1, _Mylast); _Alty_traits::destroy(_Getal(), _Unfancy(_Mylast - 1)); --_Mylast; } constexpr iterator erase(const_iterator _Where) noexcept( is_nothrow_move_assignable_v<value_type>) { const pointer _Whereptr = _Where._Ptr; auto& _My_data = _Mypair._Myval2; pointer& _Mylast = _My_data._Mylast; do { if (_Where._Getcont() == ::std:: addressof(_My_data) && _Whereptr >= _My_data._Myfirst && _Mylast > _Whereptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 1415, 0, "%s", "vector erase iterator outside range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"vector erase iterator outside range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 1415, 0); } while (false); } ; } while (false); _Orphan_range(_Whereptr, _Mylast); _Move_unchecked(_Whereptr + 1, _Mylast, _Whereptr); _Alty_traits::destroy(_Getal(), _Unfancy(_Mylast - 1)); --_Mylast; return iterator(_Whereptr, ::std:: addressof(_My_data)); } constexpr iterator erase(const_iterator _First, const_iterator _Last) noexcept( is_nothrow_move_assignable_v<value_type>) { const pointer _Firstptr = _First._Ptr; const pointer _Lastptr = _Last._Ptr; auto& _My_data = _Mypair._Myval2; pointer& _Mylast = _My_data._Mylast; do { if (_First._Getcont() == ::std:: addressof(_My_data) && _Last._Getcont() == ::std:: addressof(_My_data) && _Firstptr >= _My_data._Myfirst && _Lastptr >= _Firstptr && _Mylast >= _Lastptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 1435, 0, "%s", "vector erase iterator outside range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"vector erase iterator outside range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 1435, 0); } while (false); } ; } while (false); if (_Firstptr != _Lastptr) { _Orphan_range(_Firstptr, _Mylast); const pointer _Newlast = _Move_unchecked(_Lastptr, _Mylast, _Firstptr); _Destroy(_Newlast, _Mylast); _Mylast = _Newlast; } return iterator(_Firstptr, ::std:: addressof(_My_data)); } constexpr void clear() noexcept { auto& _My_data = _Mypair._Myval2; pointer& _Myfirst = _My_data._Myfirst; pointer& _Mylast = _My_data._Mylast; _My_data._Orphan_all(); _Destroy(_Myfirst, _Mylast); _Mylast = _Myfirst; } constexpr void swap(vector& _Right) noexcept { if (this != ::std:: addressof(_Right)) { _Pocs(_Getal(), _Right._Getal()); _Mypair._Myval2._Swap_val(_Right._Mypair._Myval2); } } [[nodiscard]] constexpr _Ty* data() noexcept { return _Unfancy_maybe_null(_Mypair._Myval2._Myfirst); } [[nodiscard]] constexpr const _Ty* data() const noexcept { return _Unfancy_maybe_null(_Mypair._Myval2._Myfirst); } [[nodiscard]] constexpr iterator begin() noexcept { auto& _My_data = _Mypair._Myval2; return iterator(_My_data._Myfirst, ::std:: addressof(_My_data)); } [[nodiscard]] constexpr const_iterator begin() const noexcept { auto& _My_data = _Mypair._Myval2; return const_iterator(_My_data._Myfirst, ::std:: addressof(_My_data)); } [[nodiscard]] constexpr iterator end() noexcept { auto& _My_data = _Mypair._Myval2; return iterator(_My_data._Mylast, ::std:: addressof(_My_data)); } [[nodiscard]] constexpr const_iterator end() const noexcept { auto& _My_data = _Mypair._Myval2; return const_iterator(_My_data._Mylast, ::std:: addressof(_My_data)); } [[nodiscard]] constexpr reverse_iterator rbegin() noexcept { return reverse_iterator(end()); } [[nodiscard]] constexpr const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } [[nodiscard]] constexpr reverse_iterator rend() noexcept { return reverse_iterator(begin()); } [[nodiscard]] constexpr const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } [[nodiscard]] constexpr const_iterator cbegin() const noexcept { return begin(); } [[nodiscard]] constexpr const_iterator cend() const noexcept { return end(); } [[nodiscard]] constexpr const_reverse_iterator crbegin() const noexcept { return rbegin(); } [[nodiscard]] constexpr const_reverse_iterator crend() const noexcept { return rend(); } [[nodiscard]] constexpr pointer _Unchecked_begin() noexcept { return _Mypair._Myval2._Myfirst; } [[nodiscard]] constexpr const_pointer _Unchecked_begin() const noexcept { return _Mypair._Myval2._Myfirst; } [[nodiscard]] constexpr pointer _Unchecked_end() noexcept { return _Mypair._Myval2._Mylast; } [[nodiscard]] constexpr const_pointer _Unchecked_end() const noexcept { return _Mypair._Myval2._Mylast; } [[nodiscard]] constexpr bool empty() const noexcept { auto& _My_data = _Mypair._Myval2; return _My_data._Myfirst == _My_data._Mylast; } [[nodiscard]] constexpr size_type size() const noexcept { auto& _My_data = _Mypair._Myval2; return static_cast<size_type>(_My_data._Mylast - _My_data._Myfirst); } [[nodiscard]] constexpr size_type max_size() const noexcept { return (::std:: min)( static_cast<size_type>((numeric_limits<difference_type>::max)()), _Alty_traits::max_size(_Getal())); } [[nodiscard]] constexpr size_type capacity() const noexcept { auto& _My_data = _Mypair._Myval2; return static_cast<size_type>(_My_data._Myend - _My_data._Myfirst); } [[nodiscard]] constexpr _Ty& operator[](const size_type _Pos) noexcept { auto& _My_data = _Mypair._Myval2; do { if (_Pos < static_cast<size_type>(_My_data._Mylast - _My_data._Myfirst)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 1566, 0, "%s", "vector subscript out of range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"vector subscript out of range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 1566, 0); } while (false); } ; } while (false); return _My_data._Myfirst[_Pos]; } [[nodiscard]] constexpr const _Ty& operator[](const size_type _Pos) const noexcept { auto& _My_data = _Mypair._Myval2; do { if (_Pos < static_cast<size_type>(_My_data._Mylast - _My_data._Myfirst)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 1576, 0, "%s", "vector subscript out of range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"vector subscript out of range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 1576, 0); } while (false); } ; } while (false); return _My_data._Myfirst[_Pos]; } [[nodiscard]] constexpr _Ty& at(const size_type _Pos) { auto& _My_data = _Mypair._Myval2; if (static_cast<size_type>(_My_data._Mylast - _My_data._Myfirst) <= _Pos) { _Xrange(); } return _My_data._Myfirst[_Pos]; } [[nodiscard]] constexpr const _Ty& at(const size_type _Pos) const { auto& _My_data = _Mypair._Myval2; if (static_cast<size_type>(_My_data._Mylast - _My_data._Myfirst) <= _Pos) { _Xrange(); } return _My_data._Myfirst[_Pos]; } [[nodiscard]] constexpr _Ty& front() noexcept { auto& _My_data = _Mypair._Myval2; do { if (_My_data._Myfirst != _My_data._Mylast) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 1603, 0, "%s", "front() called on empty vector")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"front() called on empty vector\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 1603, 0); } while (false); } ; } while (false); return *_My_data._Myfirst; } [[nodiscard]] constexpr const _Ty& front() const noexcept { auto& _My_data = _Mypair._Myval2; do { if (_My_data._Myfirst != _My_data._Mylast) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 1612, 0, "%s", "front() called on empty vector")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"front() called on empty vector\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 1612, 0); } while (false); } ; } while (false); return *_My_data._Myfirst; } [[nodiscard]] constexpr _Ty& back() noexcept { auto& _My_data = _Mypair._Myval2; do { if (_My_data._Myfirst != _My_data._Mylast) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 1621, 0, "%s", "back() called on empty vector")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"back() called on empty vector\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 1621, 0); } while (false); } ; } while (false); return _My_data._Mylast[-1]; } [[nodiscard]] constexpr const _Ty& back() const noexcept { auto& _My_data = _Mypair._Myval2; do { if (_My_data._Myfirst != _My_data._Mylast) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 1630, 0, "%s", "back() called on empty vector")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"back() called on empty vector\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 1630, 0); } while (false); } ; } while (false); return _My_data._Mylast[-1]; } [[nodiscard]] constexpr allocator_type get_allocator() const noexcept { return static_cast<allocator_type>(_Getal()); } private: constexpr pointer _Ufill(pointer _Dest, const size_type _Count, const _Ty& _Val) { return _Uninitialized_fill_n(_Dest, _Count, _Val, _Getal()); } constexpr pointer _Ufill(pointer _Dest, const size_type _Count, _Value_init_tag) { return _Uninitialized_value_construct_n(_Dest, _Count, _Getal()); } template <class _Iter> constexpr pointer _Ucopy(_Iter _First, _Iter _Last, pointer _Dest) { return _Uninitialized_copy(_First, _Last, _Dest, _Getal()); } constexpr pointer _Umove(pointer _First, pointer _Last, pointer _Dest) { return _Uninitialized_move(_First, _Last, _Dest, _Getal()); } constexpr void _Umove_if_noexcept1(pointer _First, pointer _Last, pointer _Dest, true_type) { _Uninitialized_move(_First, _Last, _Dest, _Getal()); } constexpr void _Umove_if_noexcept1(pointer _First, pointer _Last, pointer _Dest, false_type) { _Uninitialized_copy(_First, _Last, _Dest, _Getal()); } constexpr void _Umove_if_noexcept(pointer _First, pointer _Last, pointer _Dest) { _Umove_if_noexcept1(_First, _Last, _Dest, bool_constant<disjunction_v<is_nothrow_move_constructible<_Ty>, negation<is_copy_constructible<_Ty>>>>{}); } constexpr void _Destroy(pointer _First, pointer _Last) { _Destroy_range(_First, _Last, _Getal()); } constexpr size_type _Calculate_growth(const size_type _Newsize) const { const size_type _Oldcapacity = capacity(); const auto _Max = max_size(); if (_Oldcapacity > _Max - _Oldcapacity / 2) { return _Max; } const size_type _Geometric = _Oldcapacity + _Oldcapacity / 2; if (_Geometric < _Newsize) { return _Newsize; } return _Geometric; } constexpr void _Buy_raw(const size_type _Newcapacity) { auto& _My_data = _Mypair._Myval2; pointer& _Myfirst = _My_data._Myfirst; pointer& _Mylast = _My_data._Mylast; pointer& _Myend = _My_data._Myend; ; ; const auto _Newvec = _Getal().allocate(_Newcapacity); _Myfirst = _Newvec; _Mylast = _Newvec; _Myend = _Newvec + _Newcapacity; } constexpr void _Buy_nonzero(const size_type _Newcapacity) { if (_Newcapacity > max_size()) { _Xlength(); } _Buy_raw(_Newcapacity); } constexpr void _Change_array( const pointer _Newvec, const size_type _Newsize, const size_type _Newcapacity) { auto& _My_data = _Mypair._Myval2; pointer& _Myfirst = _My_data._Myfirst; pointer& _Mylast = _My_data._Mylast; pointer& _Myend = _My_data._Myend; _My_data._Orphan_all(); if (_Myfirst) { _Destroy(_Myfirst, _Mylast); _Getal().deallocate(_Myfirst, static_cast<size_type>(_Myend - _Myfirst)); } _Myfirst = _Newvec; _Mylast = _Newvec + _Newsize; _Myend = _Newvec + _Newcapacity; } constexpr void _Tidy() noexcept { auto& _My_data = _Mypair._Myval2; pointer& _Myfirst = _My_data._Myfirst; pointer& _Mylast = _My_data._Mylast; pointer& _Myend = _My_data._Myend; _My_data._Orphan_all(); if (_Myfirst) { _Destroy(_Myfirst, _Mylast); _Getal().deallocate(_Myfirst, static_cast<size_type>(_Myend - _Myfirst)); _Myfirst = nullptr; _Mylast = nullptr; _Myend = nullptr; } } [[noreturn]] static void _Xlength() { _Xlength_error("vector too long"); } [[noreturn]] static void _Xrange() { _Xout_of_range("invalid vector subscript"); } constexpr void _Orphan_range_unlocked(pointer _First, pointer _Last) const { _Iterator_base12** _Pnext = &_Mypair._Myval2._Myproxy->_Myfirstiter; while (*_Pnext) { const auto _Pnextptr = static_cast<const_iterator&>(**_Pnext)._Ptr; if (_Pnextptr < _First || _Last < _Pnextptr) { const auto _Temp = *_Pnext; _Pnext = &_Temp->_Mynextiter; } else { const auto _Temp = *_Pnext; _Temp->_Myproxy = nullptr; *_Pnext = _Temp->_Mynextiter; } } } void _Orphan_range_locked(pointer _First, pointer _Last) const { _Lockit _Lock(3); _Orphan_range_unlocked(_First, _Last); } constexpr void _Orphan_range(pointer _First, pointer _Last) const { if (::std:: is_constant_evaluated()) { _Orphan_range_unlocked(_First, _Last); } else { _Orphan_range_locked(_First, _Last); } } [[nodiscard]] constexpr _Alty& _Getal() noexcept { return _Mypair._Get_first(); } [[nodiscard]] constexpr const _Alty& _Getal() const noexcept { return _Mypair._Get_first(); } [[nodiscard]] constexpr iterator _Make_iterator(const pointer _Ptr) noexcept { return iterator(_Ptr, ::std:: addressof(_Mypair._Myval2)); } [[nodiscard]] constexpr iterator _Make_iterator_offset(const size_type _Offset) noexcept { auto& _My_data = _Mypair._Myval2; return iterator(_My_data._Myfirst + _Offset, ::std:: addressof(_My_data)); } _Compressed_pair<_Alty, _Scary_val> _Mypair; }; template <class _Iter, class _Alloc = allocator<_Iter_value_t<_Iter>>, enable_if_t<conjunction_v<_Is_iterator<_Iter>, _Is_allocator<_Alloc>>, int> = 0> vector(_Iter, _Iter, _Alloc = _Alloc()) -> vector<_Iter_value_t<_Iter>, _Alloc>; template <class _Alloc> class vector<bool, _Alloc>; using _Vbase = unsigned int; constexpr int _VBITS = 8 * sizeof(_Vbase); template <class _Ty, class _Alloc> [[nodiscard]] constexpr bool operator==(const vector<_Ty, _Alloc>& _Left, const vector<_Ty, _Alloc>& _Right) { if (_Left.size() != _Right.size()) { return false; } if constexpr (is_same_v<_Ty, bool>) { return ::std:: equal( _Left._Myvec._Unchecked_begin(), _Left._Myvec._Unchecked_end(), _Right._Myvec._Unchecked_begin()); } else { return ::std:: equal(_Left._Unchecked_begin(), _Left._Unchecked_end(), _Right._Unchecked_begin()); } } template <class _Ret> struct _Vbase_compare_three_way { [[nodiscard]] constexpr _Ret operator()(const _Vbase _Left, const _Vbase _Right) const noexcept { const _Vbase _Differing_bits = _Left ^ _Right; if (_Differing_bits == 0) { return strong_ordering::equal; } const int _Bit_index = _Countr_zero(_Differing_bits); ; const _Vbase _Mask = _Vbase{1} << _Bit_index; return (_Left & _Mask) == 0 ? strong_ordering::less : strong_ordering::greater; } }; template <class _Ty, class _Alloc> [[nodiscard]] constexpr _Synth_three_way_result<_Ty> operator<=>( const vector<_Ty, _Alloc>& _Left, const vector<_Ty, _Alloc>& _Right) { if constexpr (is_same_v<_Ty, bool>) { const auto _Min_word_size = (::std:: min)(_Left._Myvec.size(), _Right._Myvec.size()); const auto _Left_words = _Left._Myvec._Unchecked_begin(); const auto _Right_words = _Right._Myvec._Unchecked_begin(); using _Comp = _Vbase_compare_three_way<strong_ordering>; const strong_ordering _Word_comparison = ::std:: lexicographical_compare_three_way( _Left_words, _Left_words + _Min_word_size, _Right_words, _Right_words + _Min_word_size, _Comp{}); if (_Word_comparison != 0) { return _Word_comparison; } return _Left.size() <=> _Right.size(); } else { return ::std:: lexicographical_compare_three_way(_Left._Unchecked_begin(), _Left._Unchecked_end(), _Right._Unchecked_begin(), _Right._Unchecked_end(), _Synth_three_way{}); } } template <class _Ty, class _Alloc> constexpr void swap(vector<_Ty, _Alloc>& _Left, vector<_Ty, _Alloc>& _Right) noexcept { _Left.swap(_Right); } template <class _Ty, class _Alloc, class _Uty> constexpr typename vector<_Ty, _Alloc>::size_type erase(vector<_Ty, _Alloc>& _Cont, const _Uty& _Val) { return _Erase_remove(_Cont, _Val); } template <class _Ty, class _Alloc, class _Pr> constexpr typename vector<_Ty, _Alloc>::size_type erase_if(vector<_Ty, _Alloc>& _Cont, _Pr _Pred) { return _Erase_remove_if(_Cont, _Pass_fn(_Pred)); } template <class _Alloc0> struct _Wrap_alloc { using _Alloc = _Alloc0; }; template <class _Alvbase_wrapped> class _Vb_iter_base : public _Iterator_base { public: using _Alvbase = typename _Alvbase_wrapped::_Alloc; using _Size_type = typename allocator_traits<_Alvbase>::size_type; using _Difference_type = typename allocator_traits<_Alvbase>::difference_type; using _Mycont = vector<bool, _Rebind_alloc_t<_Alvbase, bool>>; constexpr _Vb_iter_base() = default; constexpr _Vb_iter_base(const _Vbase* _Ptr, _Size_type _Off, const _Container_base* _Mypvbool) noexcept : _Myptr(_Ptr), _Myoff(_Off) { this->_Adopt(_Mypvbool); } constexpr _Vb_iter_base& operator=(const _Vb_iter_base&) noexcept = default; constexpr void _Advance(_Size_type _Off) noexcept { _Myoff += _Off; _Myptr += _Myoff / _VBITS; _Myoff %= _VBITS; } constexpr _Difference_type _Total_off(const _Mycont* _Cont) const noexcept { return static_cast<_Difference_type>(_VBITS * (_Myptr - _Cont->_Myvec.data()) + _Myoff); } const _Vbase* _Myptr = nullptr; _Size_type _Myoff = 0; }; template <class _Alvbase_wrapped> class _Vb_reference : public _Vb_iter_base<_Alvbase_wrapped> { using _Mybase = _Vb_iter_base<_Alvbase_wrapped>; using _Mycont = typename _Mybase::_Mycont; using _Difference_type = typename _Mybase::_Difference_type; constexpr _Vb_reference() = default; public: constexpr _Vb_reference(const _Vb_reference&) = default; constexpr _Vb_reference(const _Mybase& _Right) noexcept : _Mybase(_Right._Myptr, _Right._Myoff, _Right._Getcont()) {} constexpr _Vb_reference& operator=(const _Vb_reference& _Right) noexcept { return *this = static_cast<bool>(_Right); } constexpr _Vb_reference& operator=(bool _Val) noexcept { if (_Val) { *const_cast<_Vbase*>(_Getptr()) |= _Mask(); } else { *const_cast<_Vbase*>(_Getptr()) &= ~_Mask(); } return *this; } constexpr void flip() noexcept { *const_cast<_Vbase*>(_Getptr()) ^= _Mask(); } constexpr operator bool() const noexcept { return (*_Getptr() & _Mask()) != 0; } constexpr const _Vbase* _Getptr() const noexcept { const auto _Cont = static_cast<const _Mycont*>(this->_Getcont()); do { if (_Cont) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2083, 0, "%s", "cannot dereference value-initialized vector<bool> iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot dereference value-initialized vector<bool> iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2083, 0); } while (false); } ; } while (false); do { if (this->_Total_off(_Cont) <= static_cast<_Difference_type>(_Cont->_Mysize)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2085, 0, "%s", "vector<bool> iterator not dereferenceable")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"vector<bool> iterator not dereferenceable\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2085, 0); } while (false); } ; } while (false); return this->_Myptr; } friend constexpr void swap(_Vb_reference _Left, _Vb_reference _Right) noexcept { bool _Val = _Left; _Left = _Right; _Right = _Val; } protected: constexpr _Vbase _Mask() const noexcept { return static_cast<_Vbase>(1) << this->_Myoff; } }; template <class _Alvbase_wrapped> class _Vb_const_iterator : public _Vb_iter_base<_Alvbase_wrapped> { private: using _Mybase = _Vb_iter_base<_Alvbase_wrapped>; public: using _Mycont = typename _Mybase::_Mycont; using _Difference_type = typename _Mybase::_Difference_type; using _Size_type = typename _Mybase::_Size_type; using _Reft = _Vb_reference<_Alvbase_wrapped>; using const_reference = bool; using iterator_category = random_access_iterator_tag; using value_type = bool; using difference_type = typename _Mybase::_Difference_type; using pointer = const_reference*; using reference = const_reference; constexpr _Vb_const_iterator() = default; constexpr _Vb_const_iterator(const _Vbase* _Ptr, const _Container_base* _Mypvbool) noexcept : _Mybase(_Ptr, 0, _Mypvbool) {} constexpr _Vb_const_iterator& operator=(const _Vb_const_iterator&) noexcept = default; [[nodiscard]] constexpr const_reference operator*() const noexcept { const auto _Cont = static_cast<const _Mycont*>(this->_Getcont()); do { if (_Cont) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2133, 0, "%s", "cannot dereference value-initialized vector<bool> iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot dereference value-initialized vector<bool> iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2133, 0); } while (false); } ; } while (false); do { if (this->_Total_off(_Cont) < static_cast<_Difference_type>(_Cont->_Mysize)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2135, 0, "%s", "vector<bool> iterator not dereferenceable")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"vector<bool> iterator not dereferenceable\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2135, 0); } while (false); } ; } while (false); return _Reft(*this); } constexpr _Vb_const_iterator& operator++() noexcept { _Inc(); return *this; } constexpr _Vb_const_iterator operator++(int) noexcept { _Vb_const_iterator _Tmp = *this; _Inc(); return _Tmp; } constexpr _Vb_const_iterator& operator--() noexcept { _Dec(); return *this; } constexpr _Vb_const_iterator operator--(int) noexcept { _Vb_const_iterator _Tmp = *this; _Dec(); return _Tmp; } constexpr _Vb_const_iterator& operator+=(const difference_type _Off) noexcept { if (_Off != 0) { const auto _Cont = static_cast<const _Mycont*>(this->_Getcont()); do { if (_Cont) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2167, 0, "%s", "cannot seek value-initialized vector<bool> iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek value-initialized vector<bool> iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2167, 0); } while (false); } ; } while (false); const auto _Start_offset = this->_Total_off(_Cont); if (_Off < 0) { do { if (-_Start_offset <= _Off) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2170, 0, "%s", "cannot seek vector<bool> iterator before begin")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek vector<bool> iterator before begin\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2170, 0); } while (false); } ; } while (false); } else if (0 < _Off) { do { if (_Off <= static_cast<_Difference_type>(_Cont->_Mysize - _Start_offset)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2173, 0, "%s", "cannot seek vector<bool> iterator after end")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek vector<bool> iterator after end\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2173, 0); } while (false); } ; } while (false); } } if (_Off < 0 && this->_Myoff < 0 - static_cast<_Size_type>(_Off)) { this->_Myoff += static_cast<_Size_type>(_Off); this->_Myptr -= 1 + (static_cast<_Size_type>(-1) - this->_Myoff) / _VBITS; this->_Myoff %= _VBITS; } else { this->_Myoff += static_cast<_Size_type>(_Off); this->_Myptr += this->_Myoff / _VBITS; this->_Myoff %= _VBITS; } return *this; } [[nodiscard]] constexpr _Vb_const_iterator operator+(const difference_type _Off) const noexcept { _Vb_const_iterator _Tmp = *this; _Tmp += _Off; return _Tmp; } constexpr _Vb_const_iterator& operator-=(const difference_type _Off) noexcept { return *this += -_Off; } [[nodiscard]] constexpr _Vb_const_iterator operator-(const difference_type _Off) const noexcept { _Vb_const_iterator _Tmp = *this; _Tmp -= _Off; return _Tmp; } [[nodiscard]] constexpr difference_type operator-(const _Vb_const_iterator& _Right) const noexcept { _Compat(_Right); return static_cast<difference_type>(_VBITS * (this->_Myptr - _Right._Myptr)) + static_cast<difference_type>(this->_Myoff) - static_cast<difference_type>(_Right._Myoff); } [[nodiscard]] constexpr const_reference operator[](const difference_type _Off) const noexcept { return *(*this + _Off); } [[nodiscard]] constexpr bool operator==(const _Vb_const_iterator& _Right) const noexcept { _Compat(_Right); return this->_Myptr == _Right._Myptr && this->_Myoff == _Right._Myoff; } [[nodiscard]] constexpr strong_ordering operator<=>(const _Vb_const_iterator& _Right) const noexcept { _Compat(_Right); if (const auto _CmpResult = this->_Myptr <=> _Right._Myptr; _CmpResult != 0) { return _CmpResult; } return this->_Myoff <=> _Right._Myoff; } constexpr void _Compat(const _Vb_const_iterator& _Right) const noexcept { do { if (this->_Getcont() == _Right._Getcont()) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2257, 0, "%s", "vector<bool> iterators incompatible")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"vector<bool> iterators incompatible\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2257, 0); } while (false); } ; } while (false); } using _Prevent_inheriting_unwrap = _Vb_const_iterator; friend constexpr void _Verify_range( const _Vb_const_iterator& _First, const _Vb_const_iterator& _Last) noexcept { do { if (_First <= _Last) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2267, 0, "%s", "vector<bool> iterator range transposed")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"vector<bool> iterator range transposed\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2267, 0); } while (false); } ; } while (false); } constexpr void _Dec() noexcept { const auto _Cont = static_cast<const _Mycont*>(this->_Getcont()); do { if (_Cont) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2274, 0, "%s", "cannot decrement value-initialized vector<bool> iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot decrement value-initialized vector<bool> iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2274, 0); } while (false); } ; } while (false); do { if (this->_Total_off(_Cont) > 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2275, 0, "%s", "cannot decrement vector<bool> begin iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot decrement vector<bool> begin iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2275, 0); } while (false); } ; } while (false); if (this->_Myoff != 0) { --this->_Myoff; } else { this->_Myoff = _VBITS - 1; --this->_Myptr; } } constexpr void _Inc() noexcept { const auto _Cont = static_cast<const _Mycont*>(this->_Getcont()); do { if (_Cont) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2289, 0, "%s", "cannot increment value-initialized vector<bool> iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot increment value-initialized vector<bool> iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2289, 0); } while (false); } ; } while (false); do { if (this->_Total_off(_Cont) < static_cast<_Difference_type>(_Cont->_Mysize)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2291, 0, "%s", "cannot increment vector<bool> end iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot increment vector<bool> end iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2291, 0); } while (false); } ; } while (false); if (this->_Myoff < _VBITS - 1) { ++this->_Myoff; } else { this->_Myoff = 0; ++this->_Myptr; } } }; template <class _Alvbase_wrapped> [[nodiscard]] constexpr _Vb_const_iterator<_Alvbase_wrapped> operator+( typename _Vb_const_iterator<_Alvbase_wrapped>::difference_type _Off, _Vb_const_iterator<_Alvbase_wrapped> _Right) noexcept { return _Right += _Off; } template <class _Alvbase_wrapped> class _Vb_iterator : public _Vb_const_iterator<_Alvbase_wrapped> { public: using _Mybase = _Vb_const_iterator<_Alvbase_wrapped>; using _Mycont = typename _Mybase::_Mycont; using _Difference_type = typename _Mybase::_Difference_type; using _Reft = _Vb_reference<_Alvbase_wrapped>; using const_reference = bool; using iterator_category = random_access_iterator_tag; using value_type = bool; using difference_type = typename _Mybase::difference_type; using pointer = _Reft*; using reference = _Reft; using _Mybase::_Mybase; [[nodiscard]] constexpr reference operator*() const noexcept { const auto _Cont = static_cast<const _Mycont*>(this->_Getcont()); do { if (_Cont) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2332, 0, "%s", "cannot dereference value-initialized vector<bool> iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot dereference value-initialized vector<bool> iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2332, 0); } while (false); } ; } while (false); do { if (this->_Total_off(_Cont) < static_cast<_Difference_type>(_Cont->_Mysize)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2334, 0, "%s", "vector<bool> iterator not dereferenceable")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"vector<bool> iterator not dereferenceable\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2334, 0); } while (false); } ; } while (false); return _Reft(*this); } constexpr _Vb_iterator& operator=(const _Vb_iterator&) noexcept = default; constexpr _Vb_iterator& operator++() noexcept { _Mybase::operator++(); return *this; } constexpr _Vb_iterator operator++(int) noexcept { _Vb_iterator _Tmp = *this; _Mybase::operator++(); return _Tmp; } constexpr _Vb_iterator& operator--() noexcept { _Mybase::operator--(); return *this; } constexpr _Vb_iterator operator--(int) noexcept { _Vb_iterator _Tmp = *this; _Mybase::operator--(); return _Tmp; } constexpr _Vb_iterator& operator+=(const difference_type _Off) noexcept { _Mybase::operator+=(_Off); return *this; } [[nodiscard]] constexpr _Vb_iterator operator+(const difference_type _Off) const noexcept { _Vb_iterator _Tmp = *this; _Tmp += _Off; return _Tmp; } constexpr _Vb_iterator& operator-=(const difference_type _Off) noexcept { _Mybase::operator-=(_Off); return *this; } using _Mybase::operator-; [[nodiscard]] constexpr _Vb_iterator operator-(const difference_type _Off) const noexcept { _Vb_iterator _Tmp = *this; _Tmp -= _Off; return _Tmp; } [[nodiscard]] constexpr reference operator[](const difference_type _Off) const noexcept { return *(*this + _Off); } using _Prevent_inheriting_unwrap = _Vb_iterator; }; template <class _Alvbase_wrapped> [[nodiscard]] constexpr _Vb_iterator<_Alvbase_wrapped> operator+( typename _Vb_iterator<_Alvbase_wrapped>::difference_type _Off, _Vb_iterator<_Alvbase_wrapped> _Right) noexcept { return _Right += _Off; } template <class _Alloc> class _Vb_val : public _Container_base { public: using _Alvbase = _Rebind_alloc_t<_Alloc, _Vbase>; using _Alvbase_traits = allocator_traits<_Alvbase>; using _Vectype = vector<_Vbase, _Alvbase>; using _Alvbase_wrapped = _Wrap_alloc<_Alvbase>; using size_type = typename _Alvbase_traits::size_type; constexpr _Vb_val() noexcept(is_nothrow_default_constructible_v<_Vectype>) : _Myvec(), _Mysize(0) { this->_Alloc_proxy(static_cast<_Rebind_alloc_t<_Alvbase, _Container_proxy>>(_Getal())); } constexpr _Vb_val(const _Alloc& _Al) noexcept(is_nothrow_constructible_v<_Vectype, _Alvbase>) : _Myvec(static_cast<_Alvbase>(_Al)), _Mysize(0) { this->_Alloc_proxy(static_cast<_Rebind_alloc_t<_Alvbase, _Container_proxy>>(_Getal())); } constexpr _Vb_val(size_type _Count, const bool& _Val) : _Myvec(_Nw(_Count), static_cast<_Vbase>(_Val ? -1 : 0)), _Mysize(0) { this->_Alloc_proxy(static_cast<_Rebind_alloc_t<_Alvbase, _Container_proxy>>(_Getal())); } constexpr _Vb_val(size_type _Count, const bool& _Val, const _Alloc& _Al) : _Myvec(_Nw(_Count), static_cast<_Vbase>(_Val ? -1 : 0), static_cast<_Alvbase>(_Al)), _Mysize(0) { this->_Alloc_proxy(static_cast<_Rebind_alloc_t<_Alvbase, _Container_proxy>>(_Getal())); } constexpr _Vb_val(const _Vb_val& _Right) : _Myvec(_Right._Myvec), _Mysize(_Right._Mysize) { this->_Alloc_proxy(static_cast<_Rebind_alloc_t<_Alvbase, _Container_proxy>>(_Getal())); } constexpr _Vb_val(const _Vb_val& _Right, const _Alloc& _Al) : _Myvec(_Right._Myvec, static_cast<_Alvbase>(_Al)), _Mysize(_Right._Mysize) { this->_Alloc_proxy(static_cast<_Rebind_alloc_t<_Alvbase, _Container_proxy>>(_Getal())); } constexpr _Vb_val(_Vb_val&& _Right) noexcept(is_nothrow_move_constructible_v<_Vectype>) : _Myvec(::std:: move(_Right._Myvec)), _Mysize(::std:: exchange(_Right._Mysize, size_type{0})) { this->_Alloc_proxy(static_cast<_Rebind_alloc_t<_Alvbase, _Container_proxy>>(_Getal())); } constexpr _Vb_val(_Vb_val&& _Right, const _Alloc& _Al) noexcept( is_nothrow_constructible_v<_Vectype, _Vectype, _Alvbase>) : _Myvec(::std:: move(_Right._Myvec), static_cast<_Alvbase>(_Al)), _Mysize(_Right._Mysize) { if (_Right._Myvec.empty()) { _Right._Mysize = 0; } this->_Alloc_proxy(static_cast<_Rebind_alloc_t<_Alvbase, _Container_proxy>>(_Getal())); } constexpr ~_Vb_val() noexcept { this->_Orphan_all(); auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alvbase, _Container_proxy>>(this->_Getal()); _Delete_plain_internal(_Alproxy, ::std:: exchange(this->_Myproxy, nullptr)); } constexpr _Alvbase& _Getal() noexcept { return _Myvec._Getal(); } constexpr const _Alvbase& _Getal() const noexcept { return _Myvec._Getal(); } static constexpr size_type _Nw(size_type _Count) noexcept { return (_Count + _VBITS - 1) / _VBITS; } _Vectype _Myvec; size_type _Mysize; }; template <class _Alloc> class vector<bool, _Alloc> : public _Vb_val<_Alloc> { public: static_assert(!1 || is_same_v<bool, typename _Alloc::value_type>, "vector<bool, Allocator>" " requires that Allocator's value_type match " "bool" " (See N4659 26.2.1 [container.requirements.general]/16 allocator_type)" " Either fix the allocator value_type or define _ENFORCE_MATCHING_ALLOCATORS=0" " to suppress this diagnostic."); using _Mybase = _Vb_val<_Alloc>; using _Alvbase_wrapped = typename _Mybase::_Alvbase_wrapped; using _Alvbase = typename _Mybase::_Alvbase; using _Alvbase_traits = typename _Mybase::_Alvbase_traits; using size_type = typename _Alvbase_traits::size_type; using difference_type = typename _Alvbase_traits::difference_type; using allocator_type = _Alloc; using reference = _Vb_reference<_Alvbase_wrapped>; using const_reference = bool; using value_type = bool; using _Reft = reference; using iterator = _Vb_iterator<_Alvbase_wrapped>; using const_iterator = _Vb_const_iterator<_Alvbase_wrapped>; using pointer = iterator; using const_pointer = const_iterator; using reverse_iterator = ::std:: reverse_iterator<iterator>; using const_reverse_iterator = ::std:: reverse_iterator<const_iterator>; static const int _VBITS = ::std:: _VBITS; enum { _EEN_VBITS = _VBITS }; constexpr vector() noexcept(is_nothrow_default_constructible_v<_Mybase>) : _Mybase() {} constexpr explicit vector(const _Alloc& _Al) noexcept( is_nothrow_constructible_v<_Mybase, const _Alloc&>) : _Mybase(_Al) {} constexpr explicit vector( size_type _Count, const _Alloc& _Al = _Alloc()) : _Mybase(_Count, false, _Al) { _Trim(_Count); } constexpr vector( size_type _Count, const bool& _Val, const _Alloc& _Al = _Alloc()) : _Mybase(_Count, _Val, _Al) { _Trim(_Count); } constexpr vector(const vector& _Right) : _Mybase(_Right) {} constexpr vector(const vector& _Right, const _Alloc& _Al) : _Mybase(_Right, _Al) {} template <class _Iter, enable_if_t<_Is_iterator_v<_Iter>, int> = 0> constexpr vector(_Iter _First, _Iter _Last, const _Alloc& _Al = _Alloc()) : _Mybase(_Al) { _BConstruct(_First, _Last); } template <class _Iter> constexpr void _BConstruct(_Iter _First, _Iter _Last) { insert(begin(), _First, _Last); } constexpr vector(vector&& _Right) noexcept(is_nothrow_move_constructible_v<_Mybase>) : _Mybase(::std:: move(_Right)) { this->_Swap_proxy_and_iterators(_Right); } constexpr vector(vector&& _Right, const _Alloc& _Al) noexcept( is_nothrow_constructible_v<_Mybase, _Mybase, const _Alloc&>) : _Mybase(::std:: move(_Right), _Al) { if constexpr (!_Alvbase_traits::is_always_equal::value) { if (this->_Getal() != _Right._Getal()) { return; } } this->_Swap_proxy_and_iterators(_Right); } private: constexpr void _Move_assign(vector& _Right, _Equal_allocators) noexcept { this->_Myvec = ::std:: move(_Right._Myvec); this->_Mysize = ::std:: exchange(_Right._Mysize, size_type{0}); this->_Swap_proxy_and_iterators(_Right); } constexpr void _Move_assign(vector& _Right, _Propagate_allocators) noexcept { using _Alproxy_type = _Rebind_alloc_t<_Alvbase, _Container_proxy>; if (this->_Getal() != _Right._Getal()) { _Alproxy_type _Oldal(this->_Getal()); _Alproxy_type _Right_proxy_al(_Right._Getal()); _Container_proxy_ptr<_Alvbase> _Proxy(_Right_proxy_al, _Leave_proxy_unbound{}); this->_Myvec = ::std:: move(_Right._Myvec); this->_Mysize = ::std:: exchange(_Right._Mysize, size_type{0}); _Proxy._Bind(_Oldal, this); this->_Swap_proxy_and_iterators(_Right); return; } this->_Myvec = ::std:: move(_Right._Myvec); this->_Mysize = ::std:: exchange(_Right._Mysize, size_type{0}); this->_Swap_proxy_and_iterators(_Right); } constexpr void _Move_assign(vector& _Right, _No_propagate_allocators) { this->_Myvec = ::std:: move(_Right._Myvec); this->_Mysize = _Right._Mysize; if (_Right._Myvec.empty()) { _Right._Mysize = 0; } if (this->_Getal() == _Right._Getal()) { this->_Swap_proxy_and_iterators(_Right); } } public: constexpr vector& operator=(vector&& _Right) noexcept(is_nothrow_move_assignable_v<_Mybase>) { if (this != ::std:: addressof(_Right)) { this->_Orphan_all(); _Move_assign(_Right, _Choose_pocma<_Alvbase>{}); } return *this; } template <class... _Valty> constexpr decltype(auto) emplace_back(_Valty&&... _Val) { bool _Tmp(::std:: forward<_Valty>(_Val)...); push_back(_Tmp); return back(); } template <class... _Valty> constexpr iterator emplace(const_iterator _Where, _Valty&&... _Val) { bool _Tmp(::std:: forward<_Valty>(_Val)...); return insert(_Where, _Tmp); } constexpr vector(initializer_list<bool> _Ilist, const _Alloc& _Al = allocator_type()) : _Mybase(0, false, _Al) { insert(begin(), _Ilist.begin(), _Ilist.end()); } constexpr vector& operator=(initializer_list<bool> _Ilist) { assign(_Ilist.begin(), _Ilist.end()); return *this; } constexpr void assign(initializer_list<bool> _Ilist) { assign(_Ilist.begin(), _Ilist.end()); } constexpr iterator insert(const_iterator _Where, initializer_list<bool> _Ilist) { return insert(_Where, _Ilist.begin(), _Ilist.end()); } constexpr ~vector() noexcept {} private: constexpr void _Copy_assign(const vector& _Right, false_type) { this->_Myvec = _Right._Myvec; this->_Mysize = _Right._Mysize; } constexpr void _Copy_assign(const vector& _Right, true_type) { if (this->_Getal() == _Right._Getal()) { _Copy_assign(_Right, false_type{}); } else { using _Alproxy_type = _Rebind_alloc_t<_Alvbase, _Container_proxy>; _Alproxy_type _Oldal(this->_Getal()); _Alproxy_type _Right_proxy_al(_Right._Getal()); _Container_proxy_ptr<_Alvbase> _Proxy(_Right_proxy_al, _Leave_proxy_unbound{}); this->_Myvec = _Right._Myvec; this->_Mysize = _Right._Mysize; _Proxy._Bind(_Oldal, this); } } public: constexpr vector& operator=(const vector& _Right) { if (this != ::std:: addressof(_Right)) { this->_Orphan_all(); _Copy_assign(_Right, _Choose_pocca<_Alvbase>{}); } return *this; } constexpr void reserve( size_type _Count) { this->_Myvec.reserve(this->_Nw(_Count)); } [[nodiscard]] constexpr size_type capacity() const noexcept { return this->_Myvec.capacity() * _VBITS; } [[nodiscard]] constexpr iterator begin() noexcept { return iterator(this->_Myvec.data(), this); } [[nodiscard]] constexpr const_iterator begin() const noexcept { return const_iterator(this->_Myvec.data(), this); } [[nodiscard]] constexpr iterator end() noexcept { return begin() + static_cast<difference_type>(this->_Mysize); } [[nodiscard]] constexpr const_iterator end() const noexcept { return begin() + static_cast<difference_type>(this->_Mysize); } [[nodiscard]] constexpr const_iterator cbegin() const noexcept { return begin(); } [[nodiscard]] constexpr const_iterator cend() const noexcept { return end(); } [[nodiscard]] constexpr const_reverse_iterator crbegin() const noexcept { return rbegin(); } [[nodiscard]] constexpr const_reverse_iterator crend() const noexcept { return rend(); } [[nodiscard]] constexpr iterator _Unchecked_begin() noexcept { return iterator(this->_Myvec.data(), this); } [[nodiscard]] constexpr const_iterator _Unchecked_begin() const noexcept { return const_iterator(this->_Myvec.data(), this); } [[nodiscard]] constexpr iterator _Unchecked_end() noexcept { return _Unchecked_begin() + static_cast<difference_type>(this->_Mysize); } [[nodiscard]] constexpr const_iterator _Unchecked_end() const noexcept { return _Unchecked_begin() + static_cast<difference_type>(this->_Mysize); } constexpr void shrink_to_fit() { if (this->_Myvec.capacity() != this->_Myvec.size()) { this->_Orphan_all(); this->_Myvec.shrink_to_fit(); } } constexpr iterator _Make_iter(const_iterator _Where) noexcept { iterator _Tmp = begin(); if (0 < this->_Mysize) { _Tmp += _Where - begin(); } return _Tmp; } [[nodiscard]] constexpr reverse_iterator rbegin() noexcept { return reverse_iterator(end()); } [[nodiscard]] constexpr const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } [[nodiscard]] constexpr reverse_iterator rend() noexcept { return reverse_iterator(begin()); } [[nodiscard]] constexpr const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } constexpr void resize( size_type _Newsize, bool _Val = false) { if (size() < _Newsize) { _Insert_n(end(), _Newsize - size(), _Val); } else if (_Newsize < size()) { erase(begin() + static_cast<difference_type>(_Newsize), end()); } } [[nodiscard]] constexpr size_type size() const noexcept { return this->_Mysize; } [[nodiscard]] constexpr size_type max_size() const noexcept { constexpr auto _Diff_max = static_cast<size_type>((numeric_limits<difference_type>::max)()); const size_type _Ints_max = this->_Myvec.max_size(); if (_Ints_max > _Diff_max / _VBITS) { return _Diff_max; } return _Ints_max * _VBITS; } [[nodiscard]] constexpr bool empty() const noexcept { return size() == 0; } [[nodiscard]] constexpr allocator_type get_allocator() const noexcept { return static_cast<allocator_type>(this->_Myvec.get_allocator()); } [[nodiscard]] constexpr const_reference at(size_type _Off) const { if (size() <= _Off) { _Xran(); } return (*this)[_Off]; } [[nodiscard]] constexpr reference at(size_type _Off) { if (size() <= _Off) { _Xran(); } return (*this)[_Off]; } [[nodiscard]] constexpr const_reference operator[](size_type _Off) const noexcept { do { if (_Off < this->_Mysize) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2826, 0, "%s", "vector<bool> subscript out of range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"vector<bool> subscript out of range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2826, 0); } while (false); } ; } while (false); const_iterator _It = begin(); _It._Advance(_Off); return *_It; } [[nodiscard]] constexpr reference operator[](size_type _Off) noexcept { do { if (_Off < this->_Mysize) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2836, 0, "%s", "vector<bool> subscript out of range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"vector<bool> subscript out of range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2836, 0); } while (false); } ; } while (false); iterator _It = begin(); _It._Advance(_Off); return *_It; } [[nodiscard]] constexpr reference front() noexcept { do { if (this->_Mysize != 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2846, 0, "%s", "front() called on empty vector<bool>")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"front() called on empty vector<bool>\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2846, 0); } while (false); } ; } while (false); return *begin(); } [[nodiscard]] constexpr const_reference front() const noexcept { do { if (this->_Mysize != 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2854, 0, "%s", "front() called on empty vector<bool>")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"front() called on empty vector<bool>\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2854, 0); } while (false); } ; } while (false); return *begin(); } [[nodiscard]] constexpr reference back() noexcept { do { if (this->_Mysize != 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2862, 0, "%s", "back() called on empty vector<bool>")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"back() called on empty vector<bool>\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2862, 0); } while (false); } ; } while (false); return *(end() - 1); } [[nodiscard]] constexpr const_reference back() const noexcept { do { if (this->_Mysize != 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2870, 0, "%s", "back() called on empty vector<bool>")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"back() called on empty vector<bool>\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2870, 0); } while (false); } ; } while (false); return *(end() - 1); } constexpr void push_back(const bool& _Val) { insert(end(), _Val); } constexpr void pop_back() noexcept { erase(end() - 1); } template <class _Iter, enable_if_t<_Is_iterator_v<_Iter>, int> = 0> constexpr void assign(_Iter _First, _Iter _Last) { clear(); insert(begin(), _First, _Last); } constexpr void assign( size_type _Count, const bool& _Val) { clear(); _Insert_n(begin(), _Count, _Val); } constexpr iterator insert(const_iterator _Where, const bool& _Val) { return _Insert_n(_Where, static_cast<size_type>(1), _Val); } constexpr iterator insert( const_iterator _Where, size_type _Count, const bool& _Val) { return _Insert_n(_Where, _Count, _Val); } template <class _Iter, enable_if_t<_Is_iterator_v<_Iter>, int> = 0> constexpr iterator insert(const_iterator _Where, _Iter _First, _Iter _Last) { difference_type _Off = _Where - begin(); _Insert(_Where, _First, _Last, _Iter_cat_t<_Iter>{}); return begin() + _Off; } template <class _Iter> constexpr void _Insert(const_iterator _Where, _Iter _First, _Iter _Last, input_iterator_tag) { difference_type _Off = _Where - begin(); for (; _First != _Last; ++_First, (void) ++_Off) { insert(begin() + _Off, *_First); } } template <class _Iter> constexpr void _Insert(const_iterator _Where, _Iter _First, _Iter _Last, forward_iterator_tag) { _Adl_verify_range(_First, _Last); auto _Count = _Convert_size<size_type>(static_cast<size_t>(::std:: distance(_First, _Last))); size_type _Off = _Insert_x(_Where, _Count); _Copy_unchecked(_Get_unwrapped(_First), _Get_unwrapped(_Last), begin() + static_cast<difference_type>(_Off)); } constexpr iterator erase(const_iterator _Where_arg) noexcept { iterator _Where = _Make_iter(_Where_arg); difference_type _Off = _Where - begin(); do { if (end() > _Where) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2933, 0, "%s", "vector<bool> erase iterator outside range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"vector<bool> erase iterator outside range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2933, 0); } while (false); } ; } while (false); ::std:: copy(_Next_iter(_Where), end(), _Where); _Orphan_range(static_cast<size_type>(_Off), this->_Mysize); _Trim(this->_Mysize - 1); return begin() + _Off; } constexpr iterator erase(const_iterator _First_arg, const_iterator _Last_arg) noexcept { iterator _First = _Make_iter(_First_arg); iterator _Last = _Make_iter(_Last_arg); difference_type _Off = _First - begin(); if (_First != _Last) { do { if (_Last >= _First && end() >= _Last) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2953, 0, "%s", "vector<bool> erase iterator outside range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"vector<bool> erase iterator outside range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 2953, 0); } while (false); } ; } while (false); iterator _Next = ::std:: copy(_Last, end(), _First); const auto _Newsize = static_cast<size_type>(_Next - begin()); _Orphan_range(_Newsize, this->_Mysize); _Trim(_Newsize); } return begin() + _Off; } constexpr void clear() noexcept { this->_Orphan_all(); this->_Myvec.clear(); this->_Mysize = 0; } constexpr void flip() noexcept { for (auto& _Elem : this->_Myvec) { _Elem = ~_Elem; } _Trim(this->_Mysize); } constexpr void swap(vector& _Right) noexcept { if (this != ::std:: addressof(_Right)) { this->_Swap_proxy_and_iterators(_Right); this->_Myvec.swap(_Right._Myvec); ::std:: swap(this->_Mysize, _Right._Mysize); } } static constexpr void swap(reference _Left, reference _Right) noexcept { bool _Val = _Left; _Left = _Right; _Right = _Val; } friend hash<vector<bool, _Alloc>>; constexpr iterator _Insert_n(const_iterator _Where, size_type _Count, const bool& _Val) { size_type _Off = _Insert_x(_Where, _Count); const auto _Result = begin() + static_cast<difference_type>(_Off); ::std:: fill(_Result, _Result + static_cast<difference_type>(_Count), _Val); return _Result; } constexpr size_type _Insert_x(const_iterator _Where, size_type _Count) { difference_type _Off = _Where - begin(); do { if (end() >= _Where) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 3008, 0, "%s", "vector<bool> insert iterator outside range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"vector<bool> insert iterator outside range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\vector", 3008, 0); } while (false); } ; } while (false); bool _Realloc = capacity() - size() < _Count; if (_Count != 0) { if (max_size() - size() < _Count) { _Xlen(); } this->_Myvec.resize(this->_Nw(size() + _Count), 0); if (empty()) { this->_Mysize += _Count; } else { iterator _Oldend = end(); this->_Mysize += _Count; ::std:: copy_backward(begin() + _Off, _Oldend, end()); } _Orphan_range(static_cast<size_type>(_Realloc ? 0 : _Off), this->_Mysize); } return static_cast<size_type>(_Off); } constexpr void _Orphan_range_unlocked(size_type _Offlo, size_type _Offhi) const { const auto _Base = this->_Myvec.data(); _Iterator_base12** _Pnext = &this->_Myproxy->_Myfirstiter; while (*_Pnext) { const auto& _Pnextiter = static_cast<const_iterator&>(**_Pnext); const auto _Temp = *_Pnext; if (!_Pnextiter._Myptr) { _Temp->_Myproxy = nullptr; *_Pnext = _Temp->_Mynextiter; continue; } const auto _Off = static_cast<size_type>(_VBITS * (_Pnextiter._Myptr - _Base)) + _Pnextiter._Myoff; if (_Off < _Offlo || _Offhi < _Off) { _Pnext = &_Temp->_Mynextiter; } else { _Temp->_Myproxy = nullptr; *_Pnext = _Temp->_Mynextiter; } } } void _Orphan_range_locked(size_type _Offlo, size_type _Offhi) const { _Lockit _Lock(3); _Orphan_range_unlocked(_Offlo, _Offhi); } constexpr void _Orphan_range(size_type _Offlo, size_type _Offhi) const { if (::std:: is_constant_evaluated()) { _Orphan_range_unlocked(_Offlo, _Offhi); } else { _Orphan_range_locked(_Offlo, _Offhi); } } constexpr void _Trim(size_type _Size) { if (max_size() < _Size) { _Xlen(); } const size_type _Words = this->_Nw(_Size); if (_Words < this->_Myvec.size()) { this->_Myvec.erase(this->_Myvec.begin() + static_cast<difference_type>(_Words), this->_Myvec.end()); } this->_Mysize = _Size; _Size %= _VBITS; if (0 < _Size) { this->_Myvec[_Words - 1] &= (static_cast<_Vbase>(1) << _Size) - 1; } } [[noreturn]] void _Xlen() const { _Xlength_error("vector<bool> too long"); } [[noreturn]] void _Xran() const { _Xout_of_range("invalid vector<bool> subscript"); } }; template <class _Alloc> struct hash<vector<bool, _Alloc>> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef vector<bool, _Alloc> _Unnameable_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef size_t _Unnameable_result; [[nodiscard]] size_t operator()(const vector<bool, _Alloc>& _Keyval) const noexcept { return _Hash_array_representation(_Keyval._Myvec.data(), _Keyval._Myvec.size()); } }; namespace pmr { template <class _Ty> using vector = ::std:: vector<_Ty, polymorphic_allocator<_Ty>>; } template <class _Alloc, bool _RequiresMutable> inline constexpr bool _Is_vb_iterator<_Vb_iterator<_Alloc>, _RequiresMutable> = true; template <class _Alloc> inline constexpr bool _Is_vb_iterator<_Vb_const_iterator<_Alloc>, false> = true; template <class _FwdIt, class _Ty> constexpr void _Fill_vbool(_FwdIt _First, _FwdIt _Last, const _Ty& _Val) { if (_First == _Last) { return; } _Vbase* _VbFirst = const_cast<_Vbase*>(_First._Myptr); _Vbase* const _VbLast = const_cast<_Vbase*>(_Last._Myptr); const auto _FirstSourceMask = static_cast<_Vbase>(-1) << _First._Myoff; const auto _FirstDestMask = ~_FirstSourceMask; const auto _FillVal = static_cast<_Vbase>(_Val ? -1 : 0); if (_VbFirst == _VbLast) { const auto _LastSourceMask = static_cast<_Vbase>(-1) >> (_VBITS - _Last._Myoff); const auto _LastDestMask = ~_LastSourceMask; const auto _SourceMask = _FirstSourceMask & _LastSourceMask; const auto _DestMask = _FirstDestMask | _LastDestMask; *_VbFirst = (*_VbFirst & _DestMask) | (_FillVal & _SourceMask); return; } *_VbFirst = (*_VbFirst & _FirstDestMask) | (_FillVal & _FirstSourceMask); ++_VbFirst; if (::std:: is_constant_evaluated()) { for (; _VbFirst != _VbLast; ++_VbFirst) { *_VbFirst = _FillVal; } } else { const auto _VbFirst_ch = reinterpret_cast<const char*>(_VbFirst); const auto _VbLast_ch = reinterpret_cast<const char*>(_VbLast); const auto _Count_ch = static_cast<size_t>(_VbLast_ch - _VbFirst_ch); const auto _ValChar = static_cast<unsigned char>(_Val ? -1 : 0); :: memset(_VbFirst, _ValChar, _Count_ch); _VbFirst = _VbLast; } if (_Last._Myoff != 0) { const auto _LastSourceMask = static_cast<_Vbase>(-1) >> (_VBITS - _Last._Myoff); const auto _LastDestMask = ~_LastSourceMask; *_VbFirst = (*_VbFirst & _LastDestMask) | (_FillVal & _LastSourceMask); } } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { [[nodiscard]] inline unsigned long _Floor_of_log_2(size_t _Value) noexcept { _Value |= size_t{1}; unsigned long _Result; _BitScanReverse64(&_Result, _Value); return _Result; } [[nodiscard]] inline unsigned long _Ceiling_of_log_2(const size_t _Value) noexcept { return 1 + _Floor_of_log_2(_Value - 1); } [[nodiscard]] inline uint32_t _Bit_scan_reverse(const uint32_t _Value) noexcept { unsigned long _Index; if (_BitScanReverse(&_Index, _Value)) { return _Index + 1; } return 0; } [[nodiscard]] inline uint32_t _Bit_scan_reverse(const uint64_t _Value) noexcept { unsigned long _Index; if (_BitScanReverse64(&_Index, _Value)) { return _Index + 1; } return 0; } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { template <class _Elem, class _Int_type> struct _Char_traits { using char_type = _Elem; using int_type = _Int_type; using pos_type = streampos; using off_type = streamoff; using state_type = _Mbstatet; using comparison_category = strong_ordering; static constexpr _Elem* copy( _Elem* const _First1, const _Elem* const _First2, const size_t _Count) noexcept { if (::std:: is_constant_evaluated()) { for (size_t _Idx = 0; _Idx < _Count; ++_Idx) { _First1[_Idx] = _First2[_Idx]; } return _First1; } :: memcpy(_First1, _First2, _Count * sizeof(_Elem)); return _First1; } static constexpr _Elem* _Copy_s( _Elem* const _First1, const size_t _Dest_size, const _Elem* const _First2, const size_t _Count) noexcept { do { if (_Count <= _Dest_size) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 75, 0, "%s", "invalid argument")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"invalid argument\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 75, 0); } while (false); } ; } while (false); return copy(_First1, _First2, _Count); } static constexpr _Elem* move( _Elem* const _First1, const _Elem* const _First2, const size_t _Count) noexcept { if (::std:: is_constant_evaluated()) { if (_First1 == _First2) { return _First1; } bool _Loop_forward = true; for (const _Elem* _Src = _First2; _Src != _First2 + _Count; ++_Src) { if (_First1 == _Src) { _Loop_forward = false; break; } } if (_Loop_forward) { for (size_t _Idx = 0; _Idx < _Count; ++_Idx) { _First1[_Idx] = _First2[_Idx]; } } else { for (size_t _Idx = 0; _Idx < _Count; ++_Idx) { _First1[_Count - 1 - _Idx] = _First2[_Count - 1 - _Idx]; } } return _First1; } :: memmove(_First1, _First2, _Count * sizeof(_Elem)); return _First1; } [[nodiscard]] static constexpr int compare( const _Elem* _First1, const _Elem* _First2, size_t _Count) noexcept { for (; 0 < _Count; --_Count, ++_First1, ++_First2) { if (*_First1 != *_First2) { return *_First1 < *_First2 ? -1 : +1; } } return 0; } [[nodiscard]] static constexpr size_t length( const _Elem* _First) noexcept { size_t _Count = 0; while (*_First != _Elem()) { ++_Count; ++_First; } return _Count; } [[nodiscard]] static constexpr const _Elem* find( const _Elem* _First, size_t _Count, const _Elem& _Ch) noexcept { for (; 0 < _Count; --_Count, ++_First) { if (*_First == _Ch) { return _First; } } return nullptr; } static constexpr _Elem* assign( _Elem* const _First, size_t _Count, const _Elem _Ch) noexcept { if (::std:: is_constant_evaluated()) { for (_Elem* _Next = _First; _Count > 0; --_Count, ++_Next) { ::std:: construct_at(_Next, _Ch); } } else { for (_Elem* _Next = _First; _Count > 0; --_Count, ++_Next) { *_Next = _Ch; } } return _First; } static constexpr void assign(_Elem& _Left, const _Elem& _Right) noexcept { if (::std:: is_constant_evaluated()) { ::std:: construct_at(::std:: addressof(_Left), _Right); } else { _Left = _Right; } } [[nodiscard]] static constexpr bool eq(const _Elem& _Left, const _Elem& _Right) noexcept { return _Left == _Right; } [[nodiscard]] static constexpr bool lt(const _Elem& _Left, const _Elem& _Right) noexcept { return _Left < _Right; } [[nodiscard]] static constexpr _Elem to_char_type(const int_type& _Meta) noexcept { return static_cast<_Elem>(_Meta); } [[nodiscard]] static constexpr int_type to_int_type(const _Elem& _Ch) noexcept { return static_cast<int_type>(_Ch); } [[nodiscard]] static constexpr bool eq_int_type(const int_type& _Left, const int_type& _Right) noexcept { return _Left == _Right; } [[nodiscard]] static constexpr int_type not_eof(const int_type& _Meta) noexcept { return _Meta != eof() ? _Meta : !eof(); } [[nodiscard]] static constexpr int_type eof() noexcept { return static_cast<int_type>((-1)); } }; template <class _Elem> struct _WChar_traits : private _Char_traits<_Elem, unsigned short> { private: using _Primary_char_traits = _Char_traits<_Elem, unsigned short>; public: using char_type = _Elem; using int_type = unsigned short; using pos_type = streampos; using off_type = streamoff; using state_type = mbstate_t; using comparison_category = strong_ordering; using _Primary_char_traits::_Copy_s; using _Primary_char_traits::copy; using _Primary_char_traits::move; [[nodiscard]] static constexpr int compare( const _Elem* const _First1, const _Elem* const _First2, const size_t _Count) noexcept { if constexpr (is_same_v<_Elem, wchar_t>) { return __builtin_wmemcmp(_First1, _First2, _Count); } else { return _Primary_char_traits::compare(_First1, _First2, _Count); } } [[nodiscard]] static constexpr size_t length( const _Elem* _First) noexcept { if constexpr (is_same_v<_Elem, wchar_t>) { return __builtin_wcslen(_First); } else { return _Primary_char_traits::length(_First); } } [[nodiscard]] static constexpr const _Elem* find( const _Elem* _First, const size_t _Count, const _Elem& _Ch) noexcept { if constexpr (is_same_v<_Elem, wchar_t>) { return __builtin_wmemchr(_First, _Ch, _Count); } else { return _Primary_char_traits::find(_First, _Count, _Ch); } } static constexpr _Elem* assign( _Elem* const _First, size_t _Count, const _Elem _Ch) noexcept { if (::std:: is_constant_evaluated()) { return _Primary_char_traits::assign(_First, _Count, _Ch); } return reinterpret_cast<_Elem*>(:: wmemset(reinterpret_cast<wchar_t*>(_First), _Ch, _Count)); } static constexpr void assign(_Elem& _Left, const _Elem& _Right) noexcept { _Left = _Right; } [[nodiscard]] static constexpr bool eq(const _Elem& _Left, const _Elem& _Right) noexcept { return _Left == _Right; } [[nodiscard]] static constexpr bool lt(const _Elem& _Left, const _Elem& _Right) noexcept { return _Left < _Right; } [[nodiscard]] static constexpr _Elem to_char_type(const int_type& _Meta) noexcept { return _Meta; } [[nodiscard]] static constexpr int_type to_int_type(const _Elem& _Ch) noexcept { return _Ch; } [[nodiscard]] static constexpr bool eq_int_type(const int_type& _Left, const int_type& _Right) noexcept { return _Left == _Right; } [[nodiscard]] static constexpr int_type not_eof(const int_type& _Meta) noexcept { return _Meta != eof() ? _Meta : static_cast<int_type>(!eof()); } [[nodiscard]] static constexpr int_type eof() noexcept { return ((wint_t)(0xFFFF)); } }; template <class _Elem> struct char_traits : _Char_traits<_Elem, long> {}; template <> struct char_traits<char16_t> : _WChar_traits<char16_t> {}; using u16streampos = streampos; template <> struct char_traits<char32_t> : _Char_traits<char32_t, unsigned int> {}; using u32streampos = streampos; template <> struct char_traits<wchar_t> : _WChar_traits<wchar_t> {}; template <> struct char_traits<unsigned short> : _WChar_traits<unsigned short> {}; template <class _Elem, class _Int_type> struct _Narrow_char_traits : private _Char_traits<_Elem, _Int_type> { private: using _Primary_char_traits = _Char_traits<_Elem, _Int_type>; public: using char_type = _Elem; using int_type = _Int_type; using pos_type = streampos; using off_type = streamoff; using state_type = mbstate_t; using comparison_category = strong_ordering; using _Primary_char_traits::_Copy_s; using _Primary_char_traits::copy; using _Primary_char_traits::move; [[nodiscard]] static constexpr int compare( const _Elem* const _First1, const _Elem* const _First2, const size_t _Count) noexcept { return __builtin_memcmp(_First1, _First2, _Count); } [[nodiscard]] static constexpr size_t length( const _Elem* const _First) noexcept { if constexpr (is_same_v<_Elem, char8_t>) { return __builtin_u8strlen(_First); } else { return __builtin_strlen(_First); } } [[nodiscard]] static constexpr const _Elem* find( const _Elem* const _First, const size_t _Count, const _Elem& _Ch) noexcept { if constexpr (is_same_v<_Elem, char8_t>) { return __builtin_u8memchr(_First, _Ch, _Count); } else { return __builtin_char_memchr(_First, _Ch, _Count); } } static constexpr _Elem* assign( _Elem* const _First, size_t _Count, const _Elem _Ch) noexcept { if (::std:: is_constant_evaluated()) { return _Primary_char_traits::assign(_First, _Count, _Ch); } return static_cast<_Elem*>(:: memset(_First, _Ch, _Count)); } static constexpr void assign(_Elem& _Left, const _Elem& _Right) noexcept { _Left = _Right; } [[nodiscard]] static constexpr bool eq(const _Elem& _Left, const _Elem& _Right) noexcept { return _Left == _Right; } [[nodiscard]] static constexpr bool lt(const _Elem& _Left, const _Elem& _Right) noexcept { return static_cast<unsigned char>(_Left) < static_cast<unsigned char>(_Right); } [[nodiscard]] static constexpr _Elem to_char_type(const int_type& _Meta) noexcept { return static_cast<_Elem>(_Meta); } [[nodiscard]] static constexpr int_type to_int_type(const _Elem& _Ch) noexcept { return static_cast<unsigned char>(_Ch); } [[nodiscard]] static constexpr bool eq_int_type(const int_type& _Left, const int_type& _Right) noexcept { return _Left == _Right; } [[nodiscard]] static constexpr int_type not_eof(const int_type& _Meta) noexcept { return _Meta != eof() ? _Meta : !eof(); } [[nodiscard]] static constexpr int_type eof() noexcept { return static_cast<int_type>((-1)); } }; template <> struct char_traits<char> : _Narrow_char_traits<char, int> {}; template <> struct char_traits<char8_t> : _Narrow_char_traits<char8_t, unsigned int> {}; using u8streampos = streampos; template <class _Elem, class _Traits, class _SizeT> basic_ostream<_Elem, _Traits>& _Insert_string( basic_ostream<_Elem, _Traits>& _Ostr, const _Elem* const _Data, const _SizeT _Size) { using _Ostr_t = basic_ostream<_Elem, _Traits>; typename _Ostr_t::iostate _State = _Ostr_t::goodbit; _SizeT _Pad; if (_Ostr.width() <= 0 || static_cast<_SizeT>(_Ostr.width()) <= _Size) { _Pad = 0; } else { _Pad = static_cast<_SizeT>(_Ostr.width()) - _Size; } const typename _Ostr_t::sentry _Ok(_Ostr); if (!_Ok) { _State |= _Ostr_t::badbit; } else { try { if ((_Ostr.flags() & _Ostr_t::adjustfield) != _Ostr_t::left) { for (; 0 < _Pad; --_Pad) { if (_Traits::eq_int_type(_Traits::eof(), _Ostr.rdbuf()->sputc(_Ostr.fill()))) { _State |= _Ostr_t::badbit; break; } } } if (_State == _Ostr_t::goodbit && _Ostr.rdbuf()->sputn(_Data, static_cast<streamsize>(_Size)) != static_cast<streamsize>(_Size)) { _State |= _Ostr_t::badbit; } else { for (; 0 < _Pad; --_Pad) { if (_Traits::eq_int_type(_Traits::eof(), _Ostr.rdbuf()->sputc(_Ostr.fill()))) { _State |= _Ostr_t::badbit; break; } } } _Ostr.width(0); } catch (...) { (_Ostr) .setstate(_Ostr_t::badbit, true); } } _Ostr.setstate(_State); return _Ostr; } template <class _Traits> struct _Char_traits_eq { using _Elem = typename _Traits::char_type; bool operator()(_Elem _Left, _Elem _Right) const { return _Traits::eq(_Left, _Right); } }; template <class _Traits> struct _Char_traits_lt { using _Elem = typename _Traits::char_type; bool operator()(_Elem _Left, _Elem _Right) const { return _Traits::lt(_Left, _Right); } }; template <class _Elem> inline constexpr bool _Pred_is_consistent_with_memcmp<_Elem, _Elem, _Char_traits_eq<char_traits<_Elem>>> = true; template <class _Traits> using _Traits_ch_t = typename _Traits::char_type; template <class _Traits> using _Traits_ptr_t = const typename _Traits::char_type*; template <class _Traits> constexpr bool _Traits_equal( const _Traits_ptr_t<_Traits> _Left, const size_t _Left_size, const _Traits_ptr_t<_Traits> _Right, const size_t _Right_size) noexcept { return _Left_size == _Right_size && _Traits::compare(_Left, _Right, _Left_size) == 0; } template <class _Traits> constexpr int _Traits_compare( const _Traits_ptr_t<_Traits> _Left, const size_t _Left_size, const _Traits_ptr_t<_Traits> _Right, const size_t _Right_size) noexcept { const int _Ans = _Traits::compare(_Left, _Right, (::std:: min)(_Left_size, _Right_size)); if (_Ans != 0) { return _Ans; } if (_Left_size < _Right_size) { return -1; } if (_Left_size > _Right_size) { return 1; } return 0; } template <class _Traits> constexpr size_t _Traits_find( const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at, const _Traits_ptr_t<_Traits> _Needle, const size_t _Needle_size) noexcept { if (_Needle_size > _Hay_size || _Start_at > _Hay_size - _Needle_size) { return static_cast<size_t>(-1); } if (_Needle_size == 0) { return _Start_at; } const auto _Possible_matches_end = _Haystack + (_Hay_size - _Needle_size) + 1; for (auto _Match_try = _Haystack + _Start_at;; ++_Match_try) { _Match_try = _Traits::find(_Match_try, static_cast<size_t>(_Possible_matches_end - _Match_try), *_Needle); if (!_Match_try) { return static_cast<size_t>(-1); } if (_Traits::compare(_Match_try, _Needle, _Needle_size) == 0) { return static_cast<size_t>(_Match_try - _Haystack); } } } template <class _Traits> constexpr size_t _Traits_find_ch( const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at, const _Traits_ch_t<_Traits> _Ch) noexcept { if (_Start_at < _Hay_size) { const auto _Found_at = _Traits::find(_Haystack + _Start_at, _Hay_size - _Start_at, _Ch); if (_Found_at) { return static_cast<size_t>(_Found_at - _Haystack); } } return static_cast<size_t>(-1); } template <class _Traits> constexpr size_t _Traits_rfind( const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at, const _Traits_ptr_t<_Traits> _Needle, const size_t _Needle_size) noexcept { if (_Needle_size == 0) { return (::std:: min)(_Start_at, _Hay_size); } if (_Needle_size <= _Hay_size) { for (auto _Match_try = _Haystack + (::std:: min)(_Start_at, _Hay_size - _Needle_size);; --_Match_try) { if (_Traits::eq(*_Match_try, *_Needle) && _Traits::compare(_Match_try, _Needle, _Needle_size) == 0) { return static_cast<size_t>(_Match_try - _Haystack); } if (_Match_try == _Haystack) { break; } } } return static_cast<size_t>(-1); } template <class _Traits> constexpr size_t _Traits_rfind_ch( const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at, const _Traits_ch_t<_Traits> _Ch) noexcept { if (_Hay_size != 0) { for (auto _Match_try = _Haystack + (::std:: min)(_Start_at, _Hay_size - 1);; --_Match_try) { if (_Traits::eq(*_Match_try, _Ch)) { return static_cast<size_t>(_Match_try - _Haystack); } if (_Match_try == _Haystack) { break; } } } return static_cast<size_t>(-1); } template <class _Elem, bool = _Is_character<_Elem>::value> class _String_bitmap { public: constexpr bool _Mark(const _Elem* _First, const _Elem* const _Last) { for (; _First != _Last; ++_First) { _Matches[static_cast<unsigned char>(*_First)] = true; } return true; } constexpr bool _Match(const _Elem _Ch) const { return _Matches[static_cast<unsigned char>(_Ch)]; } private: bool _Matches[256] = {}; }; template <class _Elem> class _String_bitmap<_Elem, false> { public: static_assert(is_unsigned_v<_Elem>, "Standard char_traits is only provided for char, wchar_t, char16_t, and char32_t. See N5687 [char.traits]. " "Visual C++ accepts other unsigned integral types as an extension."); constexpr bool _Mark(const _Elem* _First, const _Elem* const _Last) { for (; _First != _Last; ++_First) { const auto _Ch = *_First; if (_Ch >= 256U) { return false; } _Matches[static_cast<unsigned char>(_Ch)] = true; } return true; } constexpr bool _Match(const _Elem _Ch) const { return _Ch < 256U && _Matches[_Ch]; } private: bool _Matches[256] = {}; }; template <class _Traits> constexpr size_t _Traits_find_first_of( const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at, const _Traits_ptr_t<_Traits> _Needle, const size_t _Needle_size, false_type) noexcept { if (_Needle_size != 0 && _Start_at < _Hay_size) { const auto _End = _Haystack + _Hay_size; for (auto _Match_try = _Haystack + _Start_at; _Match_try < _End; ++_Match_try) { if (_Traits::find(_Needle, _Needle_size, *_Match_try)) { return static_cast<size_t>(_Match_try - _Haystack); } } } return static_cast<size_t>(-1); } template <class _Traits> constexpr size_t _Traits_find_first_of( const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at, const _Traits_ptr_t<_Traits> _Needle, const size_t _Needle_size, true_type) noexcept { if (_Needle_size != 0 && _Start_at < _Hay_size) { _String_bitmap<typename _Traits::char_type> _Matches; if (!_Matches._Mark(_Needle, _Needle + _Needle_size)) { return _Traits_find_first_of<_Traits>(_Haystack, _Hay_size, _Start_at, _Needle, _Needle_size, false_type{}); } const auto _End = _Haystack + _Hay_size; for (auto _Match_try = _Haystack + _Start_at; _Match_try < _End; ++_Match_try) { if (_Matches._Match(*_Match_try)) { return static_cast<size_t>(_Match_try - _Haystack); } } } return static_cast<size_t>(-1); } template <class _Traits> constexpr size_t _Traits_find_last_of( const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at, const _Traits_ptr_t<_Traits> _Needle, const size_t _Needle_size, false_type) noexcept { if (_Needle_size != 0 && _Hay_size != 0) { for (auto _Match_try = _Haystack + (::std:: min)(_Start_at, _Hay_size - 1);; --_Match_try) { if (_Traits::find(_Needle, _Needle_size, *_Match_try)) { return static_cast<size_t>(_Match_try - _Haystack); } if (_Match_try == _Haystack) { break; } } } return static_cast<size_t>(-1); } template <class _Traits> constexpr size_t _Traits_find_last_of( const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at, const _Traits_ptr_t<_Traits> _Needle, const size_t _Needle_size, true_type) noexcept { if (_Needle_size != 0 && _Hay_size != 0) { _String_bitmap<typename _Traits::char_type> _Matches; if (!_Matches._Mark(_Needle, _Needle + _Needle_size)) { return _Traits_find_last_of<_Traits>(_Haystack, _Hay_size, _Start_at, _Needle, _Needle_size, false_type{}); } for (auto _Match_try = _Haystack + (::std:: min)(_Start_at, _Hay_size - 1);; --_Match_try) { if (_Matches._Match(*_Match_try)) { return static_cast<size_t>(_Match_try - _Haystack); } if (_Match_try == _Haystack) { break; } } } return static_cast<size_t>(-1); } template <class _Traits> constexpr size_t _Traits_find_first_not_of( const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at, const _Traits_ptr_t<_Traits> _Needle, const size_t _Needle_size, false_type) noexcept { if (_Start_at < _Hay_size) { const auto _End = _Haystack + _Hay_size; for (auto _Match_try = _Haystack + _Start_at; _Match_try < _End; ++_Match_try) { if (!_Traits::find(_Needle, _Needle_size, *_Match_try)) { return static_cast<size_t>(_Match_try - _Haystack); } } } return static_cast<size_t>(-1); } template <class _Traits> constexpr size_t _Traits_find_first_not_of( const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at, const _Traits_ptr_t<_Traits> _Needle, const size_t _Needle_size, true_type) noexcept { if (_Start_at < _Hay_size) { _String_bitmap<typename _Traits::char_type> _Matches; if (!_Matches._Mark(_Needle, _Needle + _Needle_size)) { return _Traits_find_first_not_of<_Traits>( _Haystack, _Hay_size, _Start_at, _Needle, _Needle_size, false_type{}); } const auto _End = _Haystack + _Hay_size; for (auto _Match_try = _Haystack + _Start_at; _Match_try < _End; ++_Match_try) { if (!_Matches._Match(*_Match_try)) { return static_cast<size_t>(_Match_try - _Haystack); } } } return static_cast<size_t>(-1); } template <class _Traits> constexpr size_t _Traits_find_not_ch( const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at, const _Traits_ch_t<_Traits> _Ch) noexcept { if (_Start_at < _Hay_size) { const auto _End = _Haystack + _Hay_size; for (auto _Match_try = _Haystack + _Start_at; _Match_try < _End; ++_Match_try) { if (!_Traits::eq(*_Match_try, _Ch)) { return static_cast<size_t>(_Match_try - _Haystack); } } } return static_cast<size_t>(-1); } template <class _Traits> constexpr size_t _Traits_find_last_not_of( const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at, const _Traits_ptr_t<_Traits> _Needle, const size_t _Needle_size, false_type) noexcept { if (_Hay_size != 0) { for (auto _Match_try = _Haystack + (::std:: min)(_Start_at, _Hay_size - 1);; --_Match_try) { if (!_Traits::find(_Needle, _Needle_size, *_Match_try)) { return static_cast<size_t>(_Match_try - _Haystack); } if (_Match_try == _Haystack) { break; } } } return static_cast<size_t>(-1); } template <class _Traits> constexpr size_t _Traits_find_last_not_of( const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at, const _Traits_ptr_t<_Traits> _Needle, const size_t _Needle_size, true_type) noexcept { if (_Hay_size != 0) { _String_bitmap<typename _Traits::char_type> _Matches; if (!_Matches._Mark(_Needle, _Needle + _Needle_size)) { return _Traits_find_last_not_of<_Traits>( _Haystack, _Hay_size, _Start_at, _Needle, _Needle_size, false_type{}); } for (auto _Match_try = _Haystack + (::std:: min)(_Start_at, _Hay_size - 1);; --_Match_try) { if (!_Matches._Match(*_Match_try)) { return static_cast<size_t>(_Match_try - _Haystack); } if (_Match_try == _Haystack) { break; } } } return static_cast<size_t>(-1); } template <class _Traits> constexpr size_t _Traits_rfind_not_ch( const _Traits_ptr_t<_Traits> _Haystack, const size_t _Hay_size, const size_t _Start_at, const _Traits_ch_t<_Traits> _Ch) noexcept { if (_Hay_size != 0) { for (auto _Match_try = _Haystack + (::std:: min)(_Start_at, _Hay_size - 1);; --_Match_try) { if (!_Traits::eq(*_Match_try, _Ch)) { return static_cast<size_t>(_Match_try - _Haystack); } if (_Match_try == _Haystack) { break; } } } return static_cast<size_t>(-1); } template <class _Elem, class _Traits = char_traits<_Elem>> class basic_string_view; template <class _Traits> class _String_view_iterator { public: using iterator_concept = contiguous_iterator_tag; using iterator_category = random_access_iterator_tag; using value_type = typename _Traits::char_type; using difference_type = ptrdiff_t; using pointer = const value_type*; using reference = const value_type&; constexpr _String_view_iterator() noexcept = default; private: friend basic_string_view<value_type, _Traits>; constexpr _String_view_iterator(const pointer _Data, const size_t _Size, const size_t _Off) noexcept : _Mydata(_Data), _Mysize(_Size), _Myoff(_Off) {} public: [[nodiscard]] constexpr reference operator*() const noexcept { do { if (_Mydata) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 999, 0, "%s", "cannot dereference value-initialized string_view iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot dereference value-initialized string_view iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 999, 0); } while (false); } ; } while (false); do { if (_Myoff < _Mysize) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1000, 0, "%s", "cannot dereference end string_view iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot dereference end string_view iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1000, 0); } while (false); } ; } while (false); return _Mydata[_Myoff]; } [[nodiscard]] constexpr pointer operator->() const noexcept { do { if (_Mydata) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1009, 0, "%s", "cannot dereference value-initialized string_view iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot dereference value-initialized string_view iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1009, 0); } while (false); } ; } while (false); do { if (_Myoff < _Mysize) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1010, 0, "%s", "cannot dereference end string_view iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot dereference end string_view iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1010, 0); } while (false); } ; } while (false); return _Mydata + _Myoff; } constexpr _String_view_iterator& operator++() noexcept { do { if (_Mydata) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1019, 0, "%s", "cannot increment value-initialized string_view iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot increment value-initialized string_view iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1019, 0); } while (false); } ; } while (false); do { if (_Myoff < _Mysize) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1020, 0, "%s", "cannot increment string_view iterator past end")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot increment string_view iterator past end\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1020, 0); } while (false); } ; } while (false); ++_Myoff; return *this; } constexpr _String_view_iterator operator++(int) noexcept { _String_view_iterator _Tmp{*this}; ++*this; return _Tmp; } constexpr _String_view_iterator& operator--() noexcept { do { if (_Mydata) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1036, 0, "%s", "cannot decrement value-initialized string_view iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot decrement value-initialized string_view iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1036, 0); } while (false); } ; } while (false); do { if (_Myoff != 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1037, 0, "%s", "cannot decrement string_view iterator before begin")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot decrement string_view iterator before begin\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1037, 0); } while (false); } ; } while (false); --_Myoff; return *this; } constexpr _String_view_iterator operator--(int) noexcept { _String_view_iterator _Tmp{*this}; --*this; return _Tmp; } constexpr void _Verify_offset(const difference_type _Off) const noexcept { if (_Off != 0) { do { if (_Mydata) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1054, 0, "%s", "cannot seek value-initialized string_view iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek value-initialized string_view iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1054, 0); } while (false); } ; } while (false); } if (_Off < 0) { do { if (_Myoff >= size_t{0} - static_cast<size_t>(_Off)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1059, 0, "%s", "cannot seek string_view iterator before begin")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek string_view iterator before begin\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1059, 0); } while (false); } ; } while (false); } if (_Off > 0) { do { if (_Mysize - _Myoff >= static_cast<size_t>(_Off)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1063, 0, "%s", "cannot seek string_view iterator after end")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek string_view iterator after end\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1063, 0); } while (false); } ; } while (false); } } constexpr _String_view_iterator& operator+=(const difference_type _Off) noexcept { _Verify_offset(_Off); _Myoff += static_cast<size_t>(_Off); return *this; } [[nodiscard]] constexpr _String_view_iterator operator+(const difference_type _Off) const noexcept { _String_view_iterator _Tmp{*this}; _Tmp += _Off; return _Tmp; } constexpr _String_view_iterator& operator-=(const difference_type _Off) noexcept { if (_Off != 0) { do { if (_Mydata) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1090, 0, "%s", "cannot seek value-initialized string_view iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek value-initialized string_view iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1090, 0); } while (false); } ; } while (false); } if (_Off > 0) { do { if (_Myoff >= static_cast<size_t>(_Off)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1094, 0, "%s", "cannot seek string_view iterator before begin")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek string_view iterator before begin\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1094, 0); } while (false); } ; } while (false); } if (_Off < 0) { do { if (_Mysize - _Myoff >= size_t{0} - static_cast<size_t>(_Off)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1099, 0, "%s", "cannot seek string_view iterator after end")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek string_view iterator after end\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1099, 0); } while (false); } ; } while (false); } _Myoff -= static_cast<size_t>(_Off); return *this; } [[nodiscard]] constexpr _String_view_iterator operator-(const difference_type _Off) const noexcept { _String_view_iterator _Tmp{*this}; _Tmp -= _Off; return _Tmp; } [[nodiscard]] constexpr difference_type operator-(const _String_view_iterator& _Right) const noexcept { do { if (_Mydata == _Right._Mydata && _Mysize == _Right._Mysize) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1119, 0, "%s", "cannot subtract incompatible string_view iterators")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot subtract incompatible string_view iterators\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1119, 0); } while (false); } ; } while (false); return static_cast<difference_type>(_Myoff - _Right._Myoff); } [[nodiscard]] constexpr reference operator[](const difference_type _Off) const noexcept { return *(*this + _Off); } [[nodiscard]] constexpr bool operator==(const _String_view_iterator& _Right) const noexcept { do { if (_Mydata == _Right._Mydata && _Mysize == _Right._Mysize) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1133, 0, "%s", "cannot compare incompatible string_view iterators for equality")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot compare incompatible string_view iterators for equality\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1133, 0); } while (false); } ; } while (false); return _Myoff == _Right._Myoff; } [[nodiscard]] constexpr strong_ordering operator<=>(const _String_view_iterator& _Right) const noexcept { do { if (_Mydata == _Right._Mydata && _Mysize == _Right._Mysize) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1144, 0, "%s", "cannot compare incompatible string_view iterators")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot compare incompatible string_view iterators\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1144, 0); } while (false); } ; } while (false); return _Myoff <=> _Right._Myoff; } friend constexpr void _Verify_range(const _String_view_iterator& _First, const _String_view_iterator& _Last) { do { if (_First._Mydata == _Last._Mydata && _First._Mysize == _Last._Mysize) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1181, 0, "%s", "string_view iterators in range are from different views")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"string_view iterators in range are from different views\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1181, 0); } while (false); } ; } while (false); do { if (_First._Myoff <= _Last._Myoff) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1182, 0, "%s", "string_view iterator range transposed")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"string_view iterator range transposed\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1182, 0); } while (false); } ; } while (false); } using _Prevent_inheriting_unwrap = _String_view_iterator; [[nodiscard]] constexpr pointer _Unwrapped() const noexcept { return _Mydata + _Myoff; } static constexpr bool _Unwrap_when_unverified = 2 == 0; constexpr void _Seek_to(pointer _It) noexcept { _Myoff = static_cast<size_t>(_It - _Mydata); } private: pointer _Mydata = nullptr; size_t _Mysize = 0; size_t _Myoff = 0; }; template <class _Traits> [[nodiscard]] constexpr _String_view_iterator<_Traits> operator+( const typename _String_view_iterator<_Traits>::difference_type _Off, _String_view_iterator<_Traits> _Right) noexcept { _Right += _Off; return _Right; } template <class _Traits> struct pointer_traits<_String_view_iterator<_Traits>> { using pointer = _String_view_iterator<_Traits>; using element_type = const typename pointer::value_type; using difference_type = typename pointer::difference_type; [[nodiscard]] static constexpr element_type* to_address(const pointer& _Iter) noexcept { return _Iter._Unwrapped(); } }; template <class _Elem, class _Traits> class basic_string_view { public: static_assert(is_same_v<_Elem, typename _Traits::char_type>, "Bad char_traits for basic_string_view; " "N4659 24.4.2 [string.view.template]/1 \"the type traits::char_type shall name the same type as charT.\""); static_assert(!is_array_v<_Elem> && is_trivial_v<_Elem> && is_standard_layout_v<_Elem>, "The character type of basic_string_view must be a non-array trivial standard-layout type. See N4861 " "[strings.general]/1."); using traits_type = _Traits; using value_type = _Elem; using pointer = _Elem*; using const_pointer = const _Elem*; using reference = _Elem&; using const_reference = const _Elem&; using const_iterator = _String_view_iterator<_Traits>; using iterator = const_iterator; using const_reverse_iterator = ::std:: reverse_iterator<const_iterator>; using reverse_iterator = const_reverse_iterator; using size_type = size_t; using difference_type = ptrdiff_t; static constexpr auto npos{static_cast<size_type>(-1)}; constexpr basic_string_view() noexcept : _Mydata(), _Mysize(0) {} constexpr basic_string_view(const basic_string_view&) noexcept = default; constexpr basic_string_view& operator=(const basic_string_view&) noexcept = default; constexpr basic_string_view( const const_pointer _Ntcts) noexcept : _Mydata(_Ntcts), _Mysize(_Traits::length(_Ntcts)) {} constexpr basic_string_view( const const_pointer _Cts, const size_type _Count) noexcept : _Mydata(_Cts), _Mysize(_Count) { do { if (_Count == 0 || _Cts) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1277, 0, "%s", "non-zero size null string_view")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"non-zero size null string_view\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1277, 0); } while (false); } ; } while (false); } template <contiguous_iterator _It, sized_sentinel_for<_It> _Se> requires (is_same_v<iter_value_t<_It>, _Elem> && !is_convertible_v<_Se, size_type>) constexpr basic_string_view(_It _First, _Se _Last) noexcept(noexcept(_Last - _First)) : _Mydata(::std:: to_address(_First)), _Mysize(static_cast<size_type>(_Last - _First)) {} [[nodiscard]] constexpr const_iterator begin() const noexcept { return const_iterator(_Mydata, _Mysize, 0); } [[nodiscard]] constexpr const_iterator end() const noexcept { return const_iterator(_Mydata, _Mysize, _Mysize); } [[nodiscard]] constexpr const_iterator cbegin() const noexcept { return begin(); } [[nodiscard]] constexpr const_iterator cend() const noexcept { return end(); } [[nodiscard]] constexpr const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator{end()}; } [[nodiscard]] constexpr const_reverse_iterator rend() const noexcept { return const_reverse_iterator{begin()}; } [[nodiscard]] constexpr const_reverse_iterator crbegin() const noexcept { return rbegin(); } [[nodiscard]] constexpr const_reverse_iterator crend() const noexcept { return rend(); } constexpr const_pointer _Unchecked_begin() const noexcept { return _Mydata; } constexpr const_pointer _Unchecked_end() const noexcept { return _Mydata + _Mysize; } [[nodiscard]] constexpr size_type size() const noexcept { return _Mysize; } [[nodiscard]] constexpr size_type length() const noexcept { return _Mysize; } [[nodiscard]] constexpr bool empty() const noexcept { return _Mysize == 0; } [[nodiscard]] constexpr const_pointer data() const noexcept { return _Mydata; } [[nodiscard]] constexpr size_type max_size() const noexcept { return (::std:: min)(static_cast<size_t>(9223372036854775807i64), static_cast<size_t>(-1) / sizeof(_Elem)); } [[nodiscard]] constexpr const_reference operator[](const size_type _Off) const noexcept { do { if (_Off < _Mysize) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1362, 0, "%s", "string_view subscript out of range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"string_view subscript out of range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1362, 0); } while (false); } ; } while (false); return _Mydata[_Off]; } [[nodiscard]] constexpr const_reference at(const size_type _Off) const { _Check_offset_exclusive(_Off); return _Mydata[_Off]; } [[nodiscard]] constexpr const_reference front() const noexcept { do { if (_Mysize != 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1375, 0, "%s", "cannot call front on empty string_view")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot call front on empty string_view\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1375, 0); } while (false); } ; } while (false); return _Mydata[0]; } [[nodiscard]] constexpr const_reference back() const noexcept { do { if (_Mysize != 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1382, 0, "%s", "cannot call back on empty string_view")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot call back on empty string_view\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1382, 0); } while (false); } ; } while (false); return _Mydata[_Mysize - 1]; } constexpr void remove_prefix(const size_type _Count) noexcept { do { if (_Mysize >= _Count) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1389, 0, "%s", "cannot remove prefix longer than total size")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot remove prefix longer than total size\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1389, 0); } while (false); } ; } while (false); _Mydata += _Count; _Mysize -= _Count; } constexpr void remove_suffix(const size_type _Count) noexcept { do { if (_Mysize >= _Count) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1397, 0, "%s", "cannot remove suffix longer than total size")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot remove suffix longer than total size\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1397, 0); } while (false); } ; } while (false); _Mysize -= _Count; } constexpr void swap(basic_string_view& _Other) noexcept { const basic_string_view _Tmp{_Other}; _Other = *this; *this = _Tmp; } constexpr size_type copy( _Elem* const _Ptr, size_type _Count, const size_type _Off = 0) const { _Check_offset(_Off); _Count = _Clamp_suffix_size(_Off, _Count); _Traits::copy(_Ptr, _Mydata + _Off, _Count); return _Count; } constexpr size_type _Copy_s( _Elem* const _Dest, const size_type _Dest_size, size_type _Count, const size_type _Off = 0) const { _Check_offset(_Off); _Count = _Clamp_suffix_size(_Off, _Count); _Traits::_Copy_s(_Dest, _Dest_size, _Mydata + _Off, _Count); return _Count; } [[nodiscard]] constexpr basic_string_view substr(const size_type _Off = 0, size_type _Count = npos) const { _Check_offset(_Off); _Count = _Clamp_suffix_size(_Off, _Count); return basic_string_view(_Mydata + _Off, _Count); } constexpr bool _Equal(const basic_string_view _Right) const noexcept { return _Traits_equal<_Traits>(_Mydata, _Mysize, _Right._Mydata, _Right._Mysize); } [[nodiscard]] constexpr int compare(const basic_string_view _Right) const noexcept { return _Traits_compare<_Traits>(_Mydata, _Mysize, _Right._Mydata, _Right._Mysize); } [[nodiscard]] constexpr int compare(const size_type _Off, const size_type _Nx, const basic_string_view _Right) const { return substr(_Off, _Nx).compare(_Right); } [[nodiscard]] constexpr int compare(const size_type _Off, const size_type _Nx, const basic_string_view _Right, const size_type _Roff, const size_type _Count) const { return substr(_Off, _Nx).compare(_Right.substr(_Roff, _Count)); } [[nodiscard]] constexpr int compare( const _Elem* const _Ptr) const { return compare(basic_string_view(_Ptr)); } [[nodiscard]] constexpr int compare(const size_type _Off, const size_type _Nx, const _Elem* const _Ptr) const { return substr(_Off, _Nx).compare(basic_string_view(_Ptr)); } [[nodiscard]] constexpr int compare(const size_type _Off, const size_type _Nx, const _Elem* const _Ptr, const size_type _Count) const { return substr(_Off, _Nx).compare(basic_string_view(_Ptr, _Count)); } [[nodiscard]] constexpr bool starts_with(const basic_string_view _Right) const noexcept { const auto _Rightsize = _Right._Mysize; if (_Mysize < _Rightsize) { return false; } return _Traits::compare(_Mydata, _Right._Mydata, _Rightsize) == 0; } [[nodiscard]] constexpr bool starts_with(const _Elem _Right) const noexcept { return !empty() && _Traits::eq(front(), _Right); } [[nodiscard]] constexpr bool starts_with(const _Elem* const _Right) const noexcept { return starts_with(basic_string_view(_Right)); } [[nodiscard]] constexpr bool ends_with(const basic_string_view _Right) const noexcept { const auto _Rightsize = _Right._Mysize; if (_Mysize < _Rightsize) { return false; } return _Traits::compare(_Mydata + (_Mysize - _Rightsize), _Right._Mydata, _Rightsize) == 0; } [[nodiscard]] constexpr bool ends_with(const _Elem _Right) const noexcept { return !empty() && _Traits::eq(back(), _Right); } [[nodiscard]] constexpr bool ends_with(const _Elem* const _Right) const noexcept { return ends_with(basic_string_view(_Right)); } [[nodiscard]] constexpr size_type find(const basic_string_view _Right, const size_type _Off = 0) const noexcept { return _Traits_find<_Traits>(_Mydata, _Mysize, _Off, _Right._Mydata, _Right._Mysize); } [[nodiscard]] constexpr size_type find(const _Elem _Ch, const size_type _Off = 0) const noexcept { return _Traits_find_ch<_Traits>(_Mydata, _Mysize, _Off, _Ch); } [[nodiscard]] constexpr size_type find( const _Elem* const _Ptr, const size_type _Off, const size_type _Count) const noexcept { return _Traits_find<_Traits>(_Mydata, _Mysize, _Off, _Ptr, _Count); } [[nodiscard]] constexpr size_type find( const _Elem* const _Ptr, const size_type _Off = 0) const noexcept { return _Traits_find<_Traits>(_Mydata, _Mysize, _Off, _Ptr, _Traits::length(_Ptr)); } [[nodiscard]] constexpr size_type rfind(const basic_string_view _Right, const size_type _Off = npos) const noexcept { return _Traits_rfind<_Traits>(_Mydata, _Mysize, _Off, _Right._Mydata, _Right._Mysize); } [[nodiscard]] constexpr size_type rfind(const _Elem _Ch, const size_type _Off = npos) const noexcept { return _Traits_rfind_ch<_Traits>(_Mydata, _Mysize, _Off, _Ch); } [[nodiscard]] constexpr size_type rfind( const _Elem* const _Ptr, const size_type _Off, const size_type _Count) const noexcept { return _Traits_rfind<_Traits>(_Mydata, _Mysize, _Off, _Ptr, _Count); } [[nodiscard]] constexpr size_type rfind( const _Elem* const _Ptr, const size_type _Off = npos) const noexcept { return _Traits_rfind<_Traits>(_Mydata, _Mysize, _Off, _Ptr, _Traits::length(_Ptr)); } [[nodiscard]] constexpr size_type find_first_of(const basic_string_view _Right, const size_type _Off = 0) const noexcept { return _Traits_find_first_of<_Traits>( _Mydata, _Mysize, _Off, _Right._Mydata, _Right._Mysize, _Is_specialization<_Traits, char_traits>{}); } [[nodiscard]] constexpr size_type find_first_of(const _Elem _Ch, const size_type _Off = 0) const noexcept { return _Traits_find_ch<_Traits>(_Mydata, _Mysize, _Off, _Ch); } [[nodiscard]] constexpr size_type find_first_of( const _Elem* const _Ptr, const size_type _Off, const size_type _Count) const noexcept { return _Traits_find_first_of<_Traits>( _Mydata, _Mysize, _Off, _Ptr, _Count, _Is_specialization<_Traits, char_traits>{}); } [[nodiscard]] constexpr size_type find_first_of( const _Elem* const _Ptr, const size_type _Off = 0) const noexcept { return _Traits_find_first_of<_Traits>( _Mydata, _Mysize, _Off, _Ptr, _Traits::length(_Ptr), _Is_specialization<_Traits, char_traits>{}); } [[nodiscard]] constexpr size_type find_last_of(const basic_string_view _Right, const size_type _Off = npos) const noexcept { return _Traits_find_last_of<_Traits>( _Mydata, _Mysize, _Off, _Right._Mydata, _Right._Mysize, _Is_specialization<_Traits, char_traits>{}); } [[nodiscard]] constexpr size_type find_last_of(const _Elem _Ch, const size_type _Off = npos) const noexcept { return _Traits_rfind_ch<_Traits>(_Mydata, _Mysize, _Off, _Ch); } [[nodiscard]] constexpr size_type find_last_of( const _Elem* const _Ptr, const size_type _Off, const size_type _Count) const noexcept { return _Traits_find_last_of<_Traits>( _Mydata, _Mysize, _Off, _Ptr, _Count, _Is_specialization<_Traits, char_traits>{}); } [[nodiscard]] constexpr size_type find_last_of( const _Elem* const _Ptr, const size_type _Off = npos) const noexcept { return _Traits_find_last_of<_Traits>( _Mydata, _Mysize, _Off, _Ptr, _Traits::length(_Ptr), _Is_specialization<_Traits, char_traits>{}); } [[nodiscard]] constexpr size_type find_first_not_of(const basic_string_view _Right, const size_type _Off = 0) const noexcept { return _Traits_find_first_not_of<_Traits>( _Mydata, _Mysize, _Off, _Right._Mydata, _Right._Mysize, _Is_specialization<_Traits, char_traits>{}); } [[nodiscard]] constexpr size_type find_first_not_of(const _Elem _Ch, const size_type _Off = 0) const noexcept { return _Traits_find_not_ch<_Traits>(_Mydata, _Mysize, _Off, _Ch); } [[nodiscard]] constexpr size_type find_first_not_of( const _Elem* const _Ptr, const size_type _Off, const size_type _Count) const noexcept { return _Traits_find_first_not_of<_Traits>( _Mydata, _Mysize, _Off, _Ptr, _Count, _Is_specialization<_Traits, char_traits>{}); } [[nodiscard]] constexpr size_type find_first_not_of( const _Elem* const _Ptr, const size_type _Off = 0) const noexcept { return _Traits_find_first_not_of<_Traits>( _Mydata, _Mysize, _Off, _Ptr, _Traits::length(_Ptr), _Is_specialization<_Traits, char_traits>{}); } [[nodiscard]] constexpr size_type find_last_not_of(const basic_string_view _Right, const size_type _Off = npos) const noexcept { return _Traits_find_last_not_of<_Traits>( _Mydata, _Mysize, _Off, _Right._Mydata, _Right._Mysize, _Is_specialization<_Traits, char_traits>{}); } [[nodiscard]] constexpr size_type find_last_not_of(const _Elem _Ch, const size_type _Off = npos) const noexcept { return _Traits_rfind_not_ch<_Traits>(_Mydata, _Mysize, _Off, _Ch); } [[nodiscard]] constexpr size_type find_last_not_of( const _Elem* const _Ptr, const size_type _Off, const size_type _Count) const noexcept { return _Traits_find_last_not_of<_Traits>( _Mydata, _Mysize, _Off, _Ptr, _Count, _Is_specialization<_Traits, char_traits>{}); } [[nodiscard]] constexpr size_type find_last_not_of( const _Elem* const _Ptr, const size_type _Off = npos) const noexcept { return _Traits_find_last_not_of<_Traits>( _Mydata, _Mysize, _Off, _Ptr, _Traits::length(_Ptr), _Is_specialization<_Traits, char_traits>{}); } [[nodiscard]] constexpr bool _Starts_with(const basic_string_view _View) const noexcept { return _Mysize >= _View._Mysize && _Traits::compare(_Mydata, _View._Mydata, _View._Mysize) == 0; } private: constexpr void _Check_offset(const size_type _Off) const { if (_Mysize < _Off) { _Xran(); } } constexpr void _Check_offset_exclusive(const size_type _Off) const { if (_Mysize <= _Off) { _Xran(); } } constexpr size_type _Clamp_suffix_size(const size_type _Off, const size_type _Size) const noexcept { return (::std:: min)(_Size, _Mysize - _Off); } [[noreturn]] static void _Xran() { _Xout_of_range("invalid string_view position"); } const_pointer _Mydata; size_type _Mysize; }; template <contiguous_iterator _It, sized_sentinel_for<_It> _Se> basic_string_view(_It, _Se) -> basic_string_view<iter_value_t<_It>>; namespace ranges { template <class _Elem, class _Traits> inline constexpr bool enable_view<basic_string_view<_Elem, _Traits>> = true; template <class _Elem, class _Traits> inline constexpr bool enable_borrowed_range<basic_string_view<_Elem, _Traits>> = true; } template <class _Elem, class _Traits> [[nodiscard]] constexpr bool operator==( const basic_string_view<_Elem, _Traits> _Lhs, const basic_string_view<_Elem, _Traits> _Rhs) noexcept { return _Lhs._Equal(_Rhs); } template <class _Elem, class _Traits, int = 2> [[nodiscard]] constexpr bool operator==( const basic_string_view<_Elem, _Traits> _Lhs, const _Identity_t<basic_string_view<_Elem, _Traits>> _Rhs) noexcept { return _Lhs._Equal(_Rhs); } template <class _Traits, class = void> struct _Get_comparison_category { using type = weak_ordering; }; template <class _Traits> struct _Get_comparison_category<_Traits, void_t<typename _Traits::comparison_category>> { using type = typename _Traits::comparison_category; static_assert(_Is_any_of_v<type, partial_ordering, weak_ordering, strong_ordering>, "N4878 [string.view.comparison]/4: Mandates: R denotes a comparison category type."); }; template <class _Traits> using _Get_comparison_category_t = typename _Get_comparison_category<_Traits>::type; template <class _Elem, class _Traits> [[nodiscard]] constexpr _Get_comparison_category_t<_Traits> operator<=>( const basic_string_view<_Elem, _Traits> _Lhs, const basic_string_view<_Elem, _Traits> _Rhs) noexcept { return static_cast<_Get_comparison_category_t<_Traits>>(_Lhs.compare(_Rhs) <=> 0); } template <class _Elem, class _Traits, int = 2> [[nodiscard]] constexpr _Get_comparison_category_t<_Traits> operator<=>( const basic_string_view<_Elem, _Traits> _Lhs, const _Identity_t<basic_string_view<_Elem, _Traits>> _Rhs) noexcept { return static_cast<_Get_comparison_category_t<_Traits>>(_Lhs.compare(_Rhs) <=> 0); } using string_view = basic_string_view<char>; using u8string_view = basic_string_view<char8_t>; using u16string_view = basic_string_view<char16_t>; using u32string_view = basic_string_view<char32_t>; using wstring_view = basic_string_view<wchar_t>; template <class _Elem, class _Traits> struct hash<basic_string_view<_Elem, _Traits>> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef basic_string_view<_Elem, _Traits> _Unnameable_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef size_t _Unnameable_result; [[nodiscard]] size_t operator()(const basic_string_view<_Elem, _Traits> _Keyval) const noexcept { return _Hash_array_representation(_Keyval.data(), _Keyval.size()); } }; template <class _Elem, class _Traits> basic_ostream<_Elem, _Traits>& operator<<( basic_ostream<_Elem, _Traits>& _Ostr, const basic_string_view<_Elem, _Traits> _Str) { return _Insert_string(_Ostr, _Str.data(), _Str.size()); } inline namespace literals { inline namespace string_view_literals { [[nodiscard]] constexpr string_view operator"" sv(const char* _Str, size_t _Len) noexcept { return string_view(_Str, _Len); } [[nodiscard]] constexpr wstring_view operator"" sv(const wchar_t* _Str, size_t _Len) noexcept { return wstring_view(_Str, _Len); } [[nodiscard]] constexpr basic_string_view<char8_t> operator"" sv(const char8_t* _Str, size_t _Len) noexcept { return basic_string_view<char8_t>(_Str, _Len); } [[nodiscard]] constexpr u16string_view operator"" sv(const char16_t* _Str, size_t _Len) noexcept { return u16string_view(_Str, _Len); } [[nodiscard]] constexpr u32string_view operator"" sv(const char32_t* _Str, size_t _Len) noexcept { return u32string_view(_Str, _Len); } } } template <class _Mystr> class _String_const_iterator : public _Iterator_base { public: using iterator_concept = contiguous_iterator_tag; using iterator_category = random_access_iterator_tag; using value_type = typename _Mystr::value_type; using difference_type = typename _Mystr::difference_type; using pointer = typename _Mystr::const_pointer; using reference = const value_type&; constexpr _String_const_iterator() noexcept : _Ptr() {} constexpr _String_const_iterator(pointer _Parg, const _Container_base* _Pstring) noexcept : _Ptr(_Parg) { this->_Adopt(_Pstring); } constexpr _String_const_iterator& operator=(const _String_const_iterator&) noexcept = default; [[nodiscard]] constexpr reference operator*() const noexcept { do { if (_Ptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1922, 0, "%s", "cannot dereference value-initialized string iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot dereference value-initialized string iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1922, 0); } while (false); } ; } while (false); const auto _Mycont = static_cast<const _Mystr*>(this->_Getcont()); do { if (_Mycont) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1925, 0, "%s", "cannot dereference string iterator because the iterator was" " invalidated (e.g. reallocation occurred, or the string was destroyed)")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot dereference string iterator because the iterator was\" \" invalidated (e.g. reallocation occurred, or the string was destroyed)\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1925, 0); } while (false); } ; } while (false); const auto _Contptr = _Mycont->_Myptr(); const auto _Rawptr = _Unfancy(_Ptr); do { if (_Contptr <= _Rawptr && _Rawptr < _Contptr + _Mycont->_Mysize) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1929, 0, "%s", "cannot dereference string iterator because it is out of range (e.g. an end iterator)")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot dereference string iterator because it is out of range (e.g. an end iterator)\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1929, 0); } while (false); } ; } while (false); ; return *_Ptr; } [[nodiscard]] constexpr pointer operator->() const noexcept { return pointer_traits<pointer>::pointer_to(**this); } constexpr _String_const_iterator& operator++() noexcept { do { if (_Ptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1942, 0, "%s", "cannot increment value-initialized string iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot increment value-initialized string iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1942, 0); } while (false); } ; } while (false); const auto _Mycont = static_cast<const _Mystr*>(this->_Getcont()); do { if (_Mycont) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1945, 0, "%s", "cannot increment string iterator because the iterator was" " invalidated (e.g. reallocation occurred, or the string was destroyed)")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot increment string iterator because the iterator was\" \" invalidated (e.g. reallocation occurred, or the string was destroyed)\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1945, 0); } while (false); } ; } while (false); do { if (_Unfancy(_Ptr) < _Mycont->_Myptr() + _Mycont->_Mysize) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1946, 0, "%s", "cannot increment string iterator past end")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot increment string iterator past end\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1946, 0); } while (false); } ; } while (false); ++_Ptr; return *this; } constexpr _String_const_iterator operator++(int) noexcept { _String_const_iterator _Tmp = *this; ++*this; return _Tmp; } constexpr _String_const_iterator& operator--() noexcept { do { if (_Ptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1961, 0, "%s", "cannot decrement value-initialized string iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot decrement value-initialized string iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1961, 0); } while (false); } ; } while (false); const auto _Mycont = static_cast<const _Mystr*>(this->_Getcont()); do { if (_Mycont) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1964, 0, "%s", "cannot decrement string iterator because the iterator was" " invalidated (e.g. reallocation occurred, or the string was destroyed)")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot decrement string iterator because the iterator was\" \" invalidated (e.g. reallocation occurred, or the string was destroyed)\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1964, 0); } while (false); } ; } while (false); do { if (_Mycont->_Myptr() < _Unfancy(_Ptr)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1965, 0, "%s", "cannot decrement string iterator before begin")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot decrement string iterator before begin\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1965, 0); } while (false); } ; } while (false); --_Ptr; return *this; } constexpr _String_const_iterator operator--(int) noexcept { _String_const_iterator _Tmp = *this; --*this; return _Tmp; } constexpr void _Verify_offset(const difference_type _Off) const noexcept { if (_Off == 0) { return; } do { if (_Ptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1984, 0, "%s", "cannot seek value-initialized string iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek value-initialized string iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1984, 0); } while (false); } ; } while (false); const auto _Mycont = static_cast<const _Mystr*>(this->_Getcont()); do { if (_Mycont) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1987, 0, "%s", "cannot seek string iterator because the iterator was" " invalidated (e.g. reallocation occurred, or the string was destroyed)")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek string iterator because the iterator was\" \" invalidated (e.g. reallocation occurred, or the string was destroyed)\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1987, 0); } while (false); } ; } while (false); const auto _Contptr = _Mycont->_Myptr(); const auto _Rawptr = _Unfancy(_Ptr); if (_Off < 0) { do { if (_Contptr - _Rawptr <= _Off) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1992, 0, "%s", "cannot seek string iterator before begin")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek string iterator before begin\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1992, 0); } while (false); } ; } while (false); } if (_Off > 0) { using _Size_type = typename _Mystr::size_type; const auto _Left = _Mycont->_Mysize - static_cast<_Size_type>(_Rawptr - _Contptr); do { if (static_cast<_Size_type>(_Off) <= _Left) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1998, 0, "%s", "cannot seek string iterator after end")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek string iterator after end\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 1998, 0); } while (false); } ; } while (false); } } constexpr _String_const_iterator& operator+=(const difference_type _Off) noexcept { _Verify_offset(_Off); _Ptr += _Off; return *this; } [[nodiscard]] constexpr _String_const_iterator operator+(const difference_type _Off) const noexcept { _String_const_iterator _Tmp = *this; _Tmp += _Off; return _Tmp; } constexpr _String_const_iterator& operator-=(const difference_type _Off) noexcept { return *this += -_Off; } [[nodiscard]] constexpr _String_const_iterator operator-(const difference_type _Off) const noexcept { _String_const_iterator _Tmp = *this; _Tmp -= _Off; return _Tmp; } [[nodiscard]] constexpr difference_type operator-(const _String_const_iterator& _Right) const noexcept { _Compat(_Right); return _Ptr - _Right._Ptr; } [[nodiscard]] constexpr reference operator[](const difference_type _Off) const noexcept { return *(*this + _Off); } [[nodiscard]] constexpr bool operator==(const _String_const_iterator& _Right) const noexcept { _Compat(_Right); return _Ptr == _Right._Ptr; } [[nodiscard]] constexpr strong_ordering operator<=>(const _String_const_iterator& _Right) const noexcept { _Compat(_Right); return _Unfancy(_Ptr) <=> _Unfancy(_Right._Ptr); } constexpr void _Compat(const _String_const_iterator& _Right) const noexcept { do { if (this->_Getcont() == _Right._Getcont()) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 2075, 0, "%s", "string iterators incompatible (e.g." " point to different string instances)")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"string iterators incompatible (e.g.\" \" point to different string instances)\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 2075, 0); } while (false); } ; } while (false); } friend constexpr void _Verify_range( const _String_const_iterator& _First, const _String_const_iterator& _Last) noexcept { do { if (_First._Getcont() == _Last._Getcont()) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 2084, 0, "%s", "string iterators in range are from different containers")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"string iterators in range are from different containers\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 2084, 0); } while (false); } ; } while (false); do { if (_First._Ptr <= _Last._Ptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 2085, 0, "%s", "string iterator range transposed")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"string iterator range transposed\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 2085, 0); } while (false); } ; } while (false); } using _Prevent_inheriting_unwrap = _String_const_iterator; [[nodiscard]] constexpr const value_type* _Unwrapped() const noexcept { return _Unfancy(_Ptr); } constexpr void _Seek_to(const value_type* _It) noexcept { _Ptr = _Refancy<pointer>(const_cast<value_type*>(_It)); } pointer _Ptr; }; template <class _Mystr> [[nodiscard]] constexpr _String_const_iterator<_Mystr> operator+( typename _String_const_iterator<_Mystr>::difference_type _Off, _String_const_iterator<_Mystr> _Next) noexcept { return _Next += _Off; } template <class _Mystr> struct pointer_traits<_String_const_iterator<_Mystr>> { using pointer = _String_const_iterator<_Mystr>; using element_type = const typename pointer::value_type; using difference_type = typename pointer::difference_type; [[nodiscard]] static constexpr element_type* to_address(const pointer _Iter) noexcept { const auto _Mycont = static_cast<const _Mystr*>(_Iter._Getcont()); if (!_Mycont) { do { if (!_Iter._Ptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 2120, 0, "%s", "cannot convert string iterator to pointer because the iterator was invalidated " "(e.g. reallocation occurred, or the string was destroyed)")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot convert string iterator to pointer because the iterator was invalidated \" \"(e.g. reallocation occurred, or the string was destroyed)\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 2120, 0); } while (false); } ; } while (false); } const auto _Rawptr = ::std:: to_address(_Iter._Ptr); if (_Mycont) { const auto _Contptr = _Mycont->_Myptr(); do { if (_Contptr <= _Rawptr && _Rawptr <= _Contptr + _Mycont->_Mysize) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 2130, 0, "%s", "cannot convert string iterator to pointer because it is out of range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot convert string iterator to pointer because it is out of range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 2130, 0); } while (false); } ; } while (false); } return _Rawptr; } }; template <class _Mystr> class _String_iterator : public _String_const_iterator<_Mystr> { public: using _Mybase = _String_const_iterator<_Mystr>; using iterator_concept = contiguous_iterator_tag; using iterator_category = random_access_iterator_tag; using value_type = typename _Mystr::value_type; using difference_type = typename _Mystr::difference_type; using pointer = typename _Mystr::pointer; using reference = value_type&; using _Mybase::_Mybase; constexpr _String_iterator& operator=(const _String_iterator&) noexcept = default; [[nodiscard]] constexpr reference operator*() const noexcept { return const_cast<reference>(_Mybase::operator*()); } [[nodiscard]] constexpr pointer operator->() const noexcept { return pointer_traits<pointer>::pointer_to(**this); } constexpr _String_iterator& operator++() noexcept { _Mybase::operator++(); return *this; } constexpr _String_iterator operator++(int) noexcept { _String_iterator _Tmp = *this; _Mybase::operator++(); return _Tmp; } constexpr _String_iterator& operator--() noexcept { _Mybase::operator--(); return *this; } constexpr _String_iterator operator--(int) noexcept { _String_iterator _Tmp = *this; _Mybase::operator--(); return _Tmp; } constexpr _String_iterator& operator+=(const difference_type _Off) noexcept { _Mybase::operator+=(_Off); return *this; } [[nodiscard]] constexpr _String_iterator operator+(const difference_type _Off) const noexcept { _String_iterator _Tmp = *this; _Tmp += _Off; return _Tmp; } constexpr _String_iterator& operator-=(const difference_type _Off) noexcept { _Mybase::operator-=(_Off); return *this; } using _Mybase::operator-; [[nodiscard]] constexpr _String_iterator operator-(const difference_type _Off) const noexcept { _String_iterator _Tmp = *this; _Tmp -= _Off; return _Tmp; } [[nodiscard]] constexpr reference operator[](const difference_type _Off) const noexcept { return const_cast<reference>(_Mybase::operator[](_Off)); } using _Prevent_inheriting_unwrap = _String_iterator; [[nodiscard]] constexpr value_type* _Unwrapped() const noexcept { return const_cast<value_type*>(_Unfancy(this->_Ptr)); } }; template <class _Mystr> [[nodiscard]] constexpr _String_iterator<_Mystr> operator+( typename _String_iterator<_Mystr>::difference_type _Off, _String_iterator<_Mystr> _Next) noexcept { return _Next += _Off; } template <class _Mystr> struct pointer_traits<_String_iterator<_Mystr>> { using pointer = _String_iterator<_Mystr>; using element_type = typename pointer::value_type; using difference_type = typename pointer::difference_type; [[nodiscard]] static constexpr element_type* to_address(const pointer _Iter) noexcept { const auto _Mycont = static_cast<const _Mystr*>(_Iter._Getcont()); if (!_Mycont) { do { if (!_Iter._Ptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 2242, 0, "%s", "cannot convert string iterator to pointer because the iterator was invalidated " "(e.g. reallocation occurred, or the string was destroyed)")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot convert string iterator to pointer because the iterator was invalidated \" \"(e.g. reallocation occurred, or the string was destroyed)\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 2242, 0); } while (false); } ; } while (false); } const auto _Rawptr = ::std:: to_address(_Iter._Ptr); if (_Mycont) { const auto _Contptr = _Mycont->_Myptr(); do { if (_Contptr <= _Rawptr && _Rawptr <= _Contptr + _Mycont->_Mysize) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 2252, 0, "%s", "cannot convert string iterator to pointer because it is out of range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot convert string iterator to pointer because it is out of range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 2252, 0); } while (false); } ; } while (false); } return const_cast<element_type*>(_Rawptr); } }; template <class _Value_type, class _Size_type, class _Difference_type, class _Pointer, class _Const_pointer, class _Reference, class _Const_reference> struct _String_iter_types { using value_type = _Value_type; using size_type = _Size_type; using difference_type = _Difference_type; using pointer = _Pointer; using const_pointer = _Const_pointer; }; template <class _Val_types> class _String_val : public _Container_base { public: using value_type = typename _Val_types::value_type; using size_type = typename _Val_types::size_type; using difference_type = typename _Val_types::difference_type; using pointer = typename _Val_types::pointer; using const_pointer = typename _Val_types::const_pointer; using reference = value_type&; using const_reference = const value_type&; constexpr _String_val() noexcept : _Bx() {} static constexpr size_type _BUF_SIZE = 16 / sizeof(value_type) < 1 ? 1 : 16 / sizeof(value_type); static constexpr size_type _ALLOC_MASK = sizeof(value_type) <= 1 ? 15 : sizeof(value_type) <= 2 ? 7 : sizeof(value_type) <= 4 ? 3 : sizeof(value_type) <= 8 ? 1 : 0; constexpr value_type* _Myptr() noexcept { value_type* _Result = _Bx._Buf; if (_Large_string_engaged()) { _Result = _Unfancy(_Bx._Ptr); } return _Result; } constexpr const value_type* _Myptr() const noexcept { const value_type* _Result = _Bx._Buf; if (_Large_string_engaged()) { _Result = _Unfancy(_Bx._Ptr); } return _Result; } constexpr bool _Large_string_engaged() const noexcept { if (::std:: is_constant_evaluated()) { return true; } return _BUF_SIZE <= _Myres; } constexpr void _Check_offset(const size_type _Off) const { if (_Mysize < _Off) { _Xran(); } } constexpr void _Check_offset_exclusive(const size_type _Off) const { if (_Mysize <= _Off) { _Xran(); } } [[noreturn]] static void _Xran() { _Xout_of_range("invalid string position"); } constexpr size_type _Clamp_suffix_size(const size_type _Off, const size_type _Size) const noexcept { return (::std:: min)(_Size, _Mysize - _Off); } union _Bxty { constexpr _Bxty() noexcept : _Ptr() {} constexpr ~_Bxty() noexcept {} value_type _Buf[_BUF_SIZE]; pointer _Ptr; char _Alias[_BUF_SIZE]; } _Bx; size_type _Mysize = 0; size_type _Myres = 0; }; template <class _Ty> constexpr size_t _Size_after_ebco_v = is_empty_v<_Ty> ? 0 : sizeof(_Ty); struct _String_constructor_concat_tag { explicit _String_constructor_concat_tag() = default; }; struct _String_constructor_rvalue_allocator_tag { explicit _String_constructor_rvalue_allocator_tag() = default; }; [[noreturn]] inline void _Xlen_string() { _Xlength_error("string too long"); } template <class _Elem, class _Traits = char_traits<_Elem>, class _Alloc = allocator<_Elem>> class basic_string { private: friend _Tidy_deallocate_guard<basic_string>; friend basic_stringbuf<_Elem, _Traits, _Alloc>; using _Alty = _Rebind_alloc_t<_Alloc, _Elem>; using _Alty_traits = allocator_traits<_Alty>; using _Scary_val = _String_val<conditional_t<_Is_simple_alloc_v<_Alty>, _Simple_types<_Elem>, _String_iter_types<_Elem, typename _Alty_traits::size_type, typename _Alty_traits::difference_type, typename _Alty_traits::pointer, typename _Alty_traits::const_pointer, _Elem&, const _Elem&>>>; static_assert(!1 || is_same_v<_Elem, typename _Alloc::value_type>, "basic_string<T, Traits, Allocator>" " requires that Allocator's value_type match " "T" " (See N4659 26.2.1 [container.requirements.general]/16 allocator_type)" " Either fix the allocator value_type or define _ENFORCE_MATCHING_ALLOCATORS=0" " to suppress this diagnostic."); static_assert(is_same_v<_Elem, typename _Traits::char_type>, "N4659 24.3.2.1 [string.require]/3 requires that the supplied " "char_traits character type match the string's character type."); static_assert(!is_array_v<_Elem> && is_trivial_v<_Elem> && is_standard_layout_v<_Elem>, "The character type of basic_string must be a non-array trivial standard-layout type. See N4861 " "[strings.general]/1."); public: using traits_type = _Traits; using allocator_type = _Alloc; using value_type = _Elem; using size_type = typename _Alty_traits::size_type; using difference_type = typename _Alty_traits::difference_type; using pointer = typename _Alty_traits::pointer; using const_pointer = typename _Alty_traits::const_pointer; using reference = value_type&; using const_reference = const value_type&; using iterator = _String_iterator<_Scary_val>; using const_iterator = _String_const_iterator<_Scary_val>; using reverse_iterator = ::std:: reverse_iterator<iterator>; using const_reverse_iterator = ::std:: reverse_iterator<const_iterator>; private: static constexpr auto _BUF_SIZE = _Scary_val::_BUF_SIZE; static constexpr auto _ALLOC_MASK = _Scary_val::_ALLOC_MASK; static constexpr bool _Can_memcpy_val = _Is_specialization_v<_Traits, char_traits> && is_trivial_v<pointer>; static constexpr size_t _Memcpy_val_offset = _Size_after_ebco_v<_Container_base>; static constexpr size_t _Memcpy_val_size = sizeof(_Scary_val) - _Memcpy_val_offset; template <class _Iter> using _Is_elem_cptr = bool_constant<_Is_any_of_v<_Iter, const _Elem* const, _Elem* const, const _Elem*, _Elem*>>; template <class _StringViewIsh> using _Is_string_view_ish = enable_if_t<conjunction_v<is_convertible<const _StringViewIsh&, basic_string_view<_Elem, _Traits>>, negation<is_convertible<const _StringViewIsh&, const _Elem*>>>, int>; public: constexpr basic_string(const basic_string& _Right) : _Mypair(_One_then_variadic_args_t{}, _Alty_traits::select_on_container_copy_construction(_Right._Getal())) { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Construct_lv_contents(_Right); _Proxy._Release(); } constexpr basic_string(const basic_string& _Right, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Construct_lv_contents(_Right); _Proxy._Release(); } constexpr basic_string() noexcept(is_nothrow_default_constructible_v<_Alty>) : _Mypair(_Zero_then_variadic_args_t{}) { _Mypair._Myval2._Alloc_proxy(static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal())); _Tidy_init(); } constexpr explicit basic_string(const _Alloc& _Al) noexcept : _Mypair(_One_then_variadic_args_t{}, _Al) { _Mypair._Myval2._Alloc_proxy(static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal())); _Tidy_init(); } constexpr basic_string(const basic_string& _Right, const size_type _Roff, const _Alloc& _Al = _Alloc()) : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Tidy_init(); assign(_Right, _Roff, npos); _Proxy._Release(); } constexpr basic_string( const basic_string& _Right, const size_type _Roff, const size_type _Count, const _Alloc& _Al = _Alloc()) : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Tidy_init(); assign(_Right, _Roff, _Count); _Proxy._Release(); } constexpr basic_string( const _Elem* const _Ptr, const size_type _Count) : _Mypair(_Zero_then_variadic_args_t{}) { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Tidy_init(); assign(_Ptr, _Count); _Proxy._Release(); } constexpr basic_string( const _Elem* const _Ptr, const size_type _Count, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Tidy_init(); assign(_Ptr, _Count); _Proxy._Release(); } constexpr basic_string( const _Elem* const _Ptr) : _Mypair(_Zero_then_variadic_args_t{}) { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Tidy_init(); assign(_Ptr); _Proxy._Release(); } template <class _Alloc2 = _Alloc, enable_if_t<_Is_allocator<_Alloc2>::value, int> = 0> constexpr basic_string( const _Elem* const _Ptr, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Tidy_init(); assign(_Ptr); _Proxy._Release(); } constexpr basic_string( const size_type _Count, const _Elem _Ch) : _Mypair(_Zero_then_variadic_args_t{}) { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Tidy_init(); assign(_Count, _Ch); _Proxy._Release(); } template <class _Alloc2 = _Alloc, enable_if_t<_Is_allocator<_Alloc2>::value, int> = 0> constexpr basic_string( const size_type _Count, const _Elem _Ch, const _Alloc& _Al) : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Tidy_init(); assign(_Count, _Ch); _Proxy._Release(); } template <class _Iter, enable_if_t<_Is_iterator_v<_Iter>, int> = 0> constexpr basic_string(_Iter _First, _Iter _Last, const _Alloc& _Al = _Alloc()) : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Tidy_init(); _Adl_verify_range(_First, _Last); _Construct(_Get_unwrapped(_First), _Get_unwrapped(_Last), _Iter_cat_t<_Iter>{}); _Proxy._Release(); } template <class _Iter> constexpr void _Construct(_Iter _First, const _Iter _Last, input_iterator_tag) { _Tidy_deallocate_guard<basic_string> _Guard{this}; for (; _First != _Last; ++_First) { push_back(*_First); } _Guard._Target = nullptr; } template <class _Iter> constexpr void _Construct(const _Iter _First, const _Iter _Last, forward_iterator_tag) { const size_type _Count = _Convert_size<size_type>(static_cast<size_t>(::std:: distance(_First, _Last))); reserve(_Count); _Construct(_First, _Last, input_iterator_tag{}); } constexpr void _Construct(_Elem* const _First, _Elem* const _Last, random_access_iterator_tag) { if (_First != _Last) { assign(_First, _Convert_size<size_type>(static_cast<size_t>(_Last - _First))); } } constexpr void _Construct( const _Elem* const _First, const _Elem* const _Last, random_access_iterator_tag) { if (_First != _Last) { assign(_First, _Convert_size<size_type>(static_cast<size_t>(_Last - _First))); } } constexpr basic_string(basic_string&& _Right) noexcept : _Mypair(_One_then_variadic_args_t{}, ::std:: move(_Right._Getal())) { _Mypair._Myval2._Alloc_proxy(static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal())); _Take_contents(_Right); } constexpr basic_string(basic_string&& _Right, const _Alloc& _Al) noexcept( _Alty_traits::is_always_equal::value) : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); if constexpr (!_Alty_traits::is_always_equal::value) { if (_Getal() != _Right._Getal()) { _Construct_lv_contents(_Right); _Proxy._Release(); return; } } _Take_contents(_Right); _Proxy._Release(); } constexpr basic_string(_String_constructor_concat_tag, const basic_string& _Source_of_al, const _Elem* const _Left_ptr, const size_type _Left_size, const _Elem* const _Right_ptr, const size_type _Right_size) : _Mypair( _One_then_variadic_args_t{}, _Alty_traits::select_on_container_copy_construction(_Source_of_al._Getal())) { ; ; ; const auto _New_size = static_cast<size_type>(_Left_size + _Right_size); size_type _New_capacity = _BUF_SIZE - 1; auto& _My_data = _Mypair._Myval2; _Elem* _Ptr = _My_data._Bx._Buf; auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _My_data); const bool _Activate_large_mode = _New_capacity < _New_size || ::std:: is_constant_evaluated(); if (_Activate_large_mode) { const size_type _Requested_size = (::std:: max)(_New_size, _BUF_SIZE); _New_capacity = _Calculate_growth(_Requested_size, _BUF_SIZE - 1, max_size()); const pointer _Fancyptr = _Getal().allocate(_New_capacity + 1); _Ptr = _Unfancy(_Fancyptr); _Construct_in_place(_My_data._Bx._Ptr, _Fancyptr); } if (::std:: is_constant_evaluated()) { _Traits::assign(_Ptr, _New_capacity + 1, _Elem()); } _My_data._Mysize = _New_size; _My_data._Myres = _New_capacity; _Traits::copy(_Ptr, _Left_ptr, _Left_size); _Traits::copy(_Ptr + static_cast<ptrdiff_t>(_Left_size), _Right_ptr, _Right_size); _Traits::assign(_Ptr[_New_size], _Elem()); _Proxy._Release(); } constexpr basic_string(_String_constructor_concat_tag, basic_string& _Left, basic_string& _Right) : _Mypair(_One_then_variadic_args_t{}, _Left._Getal()) { auto& _My_data = _Mypair._Myval2; auto& _Left_data = _Left._Mypair._Myval2; auto& _Right_data = _Right._Mypair._Myval2; _Left_data._Orphan_all(); _Right_data._Orphan_all(); const auto _Left_size = _Left_data._Mysize; const auto _Right_size = _Right_data._Mysize; const auto _Left_capacity = _Left_data._Myres; const auto _Right_capacity = _Right_data._Myres; const auto _New_size = static_cast<size_type>(_Left_size + _Right_size); const bool _Fits_in_left = _Right_size <= _Left_capacity - _Left_size; if (_Fits_in_left && _Right_capacity <= _Left_capacity) { _My_data._Alloc_proxy(static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal())); _Take_contents(_Left); const auto _Ptr = _My_data._Myptr(); _Traits::copy(_Ptr + _Left_size, _Right_data._Myptr(), _Right_size + 1); _My_data._Mysize = _New_size; return; } const bool _Fits_in_right = _Left_size <= _Right_capacity - _Right_size; if (_Allocators_equal(_Getal(), _Right._Getal()) && _Fits_in_right) { ; _My_data._Alloc_proxy(static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal())); _Take_contents(_Right); const auto _Ptr = _Unfancy(_My_data._Bx._Ptr); _Traits::move(_Ptr + _Left_size, _Ptr, _Right_size + 1); _Traits::copy(_Ptr, _Left_data._Myptr(), _Left_size); _My_data._Mysize = _New_size; return; } const auto _Max = max_size(); if (_Max - _Left_size < _Right_size) { _Xlen_string(); } const auto _New_capacity = _Calculate_growth(_New_size, _BUF_SIZE - 1, _Max); auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _My_data); const pointer _Fancyptr = _Getal().allocate(_New_capacity + 1); if (::std:: is_constant_evaluated()) { _Traits::assign(_Unfancy(_Fancyptr), _New_capacity + 1, _Elem()); } _Construct_in_place(_My_data._Bx._Ptr, _Fancyptr); _My_data._Mysize = _New_size; _My_data._Myres = _New_capacity; const auto _Ptr = _Unfancy(_Fancyptr); _Traits::copy(_Ptr, _Left_data._Myptr(), _Left_size); _Traits::copy(_Ptr + _Left_size, _Right_data._Myptr(), _Right_size + 1); _Proxy._Release(); } template <class _StringViewIsh, _Is_string_view_ish<_StringViewIsh> = 0> constexpr explicit basic_string(const _StringViewIsh& _Right, const _Alloc& _Al = _Alloc()) : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Tidy_init(); assign(_Right); _Proxy._Release(); } template <class _StringViewIsh, _Is_string_view_ish<_StringViewIsh> = 0> constexpr basic_string( const _StringViewIsh& _Right, const size_type _Roff, const size_type _Count, const _Alloc& _Al = _Alloc()) : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Tidy_init(); assign(_Right, _Roff, _Count); _Proxy._Release(); } basic_string(_String_constructor_rvalue_allocator_tag, _Alloc&& _Al) : _Mypair(_One_then_variadic_args_t{}, ::std:: move(_Al)) { _Mypair._Myval2._Alloc_proxy(static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal())); _Tidy_init(); } private: constexpr void _Move_assign(basic_string& _Right, _Equal_allocators) noexcept { _Tidy_deallocate(); _Pocma(_Getal(), _Right._Getal()); _Take_contents(_Right); } constexpr void _Move_assign(basic_string& _Right, _Propagate_allocators) noexcept { if (_Getal() == _Right._Getal()) { _Move_assign(_Right, _Equal_allocators{}); } else { _Mypair._Myval2._Orphan_all(); _Mypair._Myval2._Reload_proxy( static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()), static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Right._Getal())); _Pocma(_Getal(), _Right._Getal()); _Take_contents(_Right); } } constexpr void _Move_assign(basic_string& _Right, _No_propagate_allocators) { if (_Getal() == _Right._Getal()) { _Move_assign(_Right, _Equal_allocators{}); } else { assign(_Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize); } } public: [[nodiscard]] bool _Move_assign_from_buffer(_Elem* const _Right, const size_type _Size, const size_type _Res) { _Tidy_deallocate(); pointer _Fancy_right = _Refancy<pointer>(_Right); auto& _My_data = _Mypair._Myval2; _My_data._Mysize = _Size; _My_data._Myres = _Res - 1; if (_My_data._Large_string_engaged()) { _Construct_in_place(_My_data._Bx._Ptr, _Fancy_right); return true; } else { _Traits::copy(_My_data._Bx._Buf, _Right, _Res); _My_data._Myres = _BUF_SIZE - 1; return false; } } struct _Released_buffer { pointer _Ptr; size_type _Size; size_type _Res; }; [[nodiscard]] _Released_buffer _Release_to_buffer(_Alloc& _Al) { _Released_buffer _Result; auto& _My_data = _Mypair._Myval2; _Result._Size = _My_data._Mysize; if (_My_data._Large_string_engaged()) { _Result._Ptr = _My_data._Bx._Ptr; _Result._Res = _My_data._Myres + 1; } else { _Result._Ptr = _Al.allocate(_BUF_SIZE + 1); _Traits::copy(_Unfancy(_Result._Ptr), _My_data._Bx._Buf, _BUF_SIZE); _Result._Res = _BUF_SIZE + 1; } _My_data._Orphan_all(); _Tidy_init(); return _Result; } constexpr basic_string& operator=(basic_string&& _Right) noexcept( noexcept(_Move_assign(_Right, _Choose_pocma<_Alty>{}))) { if (this != ::std:: addressof(_Right)) { _Move_assign(_Right, _Choose_pocma<_Alty>{}); } return *this; } constexpr basic_string& assign(basic_string&& _Right) noexcept(noexcept(*this = ::std:: move(_Right))) { *this = ::std:: move(_Right); return *this; } private: void _Memcpy_val_from(const basic_string& _Right) noexcept { ; const auto _My_data_mem = reinterpret_cast<unsigned char*>(::std:: addressof(_Mypair._Myval2)) + _Memcpy_val_offset; const auto _Right_data_mem = reinterpret_cast<const unsigned char*>(::std:: addressof(_Right._Mypair._Myval2)) + _Memcpy_val_offset; :: memcpy(_My_data_mem, _Right_data_mem, _Memcpy_val_size); } constexpr void _Take_contents(basic_string& _Right) noexcept { auto& _My_data = _Mypair._Myval2; auto& _Right_data = _Right._Mypair._Myval2; if constexpr (_Can_memcpy_val) { if (!::std:: is_constant_evaluated()) { if (_Right_data._Large_string_engaged()) { _Swap_proxy_and_iterators(_Right); } else { _Right_data._Orphan_all(); } _Memcpy_val_from(_Right); _Right._Tidy_init(); return; } } if (_Right_data._Large_string_engaged()) { _Construct_in_place(_My_data._Bx._Ptr, _Right_data._Bx._Ptr); _Right_data._Bx._Ptr = nullptr; _Swap_proxy_and_iterators(_Right); } else { _Traits::copy(_My_data._Bx._Buf, _Right_data._Bx._Buf, _Right_data._Mysize + 1); _Right_data._Orphan_all(); } _My_data._Mysize = _Right_data._Mysize; _My_data._Myres = _Right_data._Myres; _Right._Tidy_init(); } constexpr void _Construct_lv_contents(const basic_string& _Right) { auto& _Right_data = _Right._Mypair._Myval2; const size_type _Right_size = _Right_data._Mysize; const _Elem* const _Right_ptr = _Right_data._Myptr(); auto& _My_data = _Mypair._Myval2; const bool _Stay_small = _Right_size < _BUF_SIZE && !::std:: is_constant_evaluated(); if (_Stay_small) { _Traits::copy(_My_data._Bx._Buf, _Right_ptr, _BUF_SIZE); _My_data._Mysize = _Right_size; _My_data._Myres = _BUF_SIZE - 1; return; } auto& _Al = _Getal(); const size_type _New_capacity = (::std:: min)(_Right_size | _ALLOC_MASK, max_size()); const pointer _New_array = _Al.allocate(_New_capacity + 1); _Construct_in_place(_My_data._Bx._Ptr, _New_array); if (::std:: is_constant_evaluated()) { _Traits::assign(_Unfancy(_New_array), _New_capacity + 1, _Elem()); } _Traits::copy(_Unfancy(_New_array), _Right_ptr, _Right_size + 1); _My_data._Mysize = _Right_size; _My_data._Myres = _New_capacity; } public: constexpr basic_string(initializer_list<_Elem> _Ilist, const _Alloc& _Al = allocator_type()) : _Mypair(_One_then_variadic_args_t{}, _Al) { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Tidy_init(); assign(_Ilist.begin(), _Convert_size<size_type>(_Ilist.size())); _Proxy._Release(); } constexpr basic_string& operator=(initializer_list<_Elem> _Ilist) { return assign(_Ilist.begin(), _Convert_size<size_type>(_Ilist.size())); } constexpr basic_string& operator+=(initializer_list<_Elem> _Ilist) { return append(_Ilist.begin(), _Convert_size<size_type>(_Ilist.size())); } constexpr basic_string& assign(initializer_list<_Elem> _Ilist) { return assign(_Ilist.begin(), _Convert_size<size_type>(_Ilist.size())); } constexpr basic_string& append(initializer_list<_Elem> _Ilist) { return append(_Ilist.begin(), _Convert_size<size_type>(_Ilist.size())); } constexpr iterator insert(const const_iterator _Where, const initializer_list<_Elem> _Ilist) { do { if (_Where._Getcont() == ::std:: addressof(_Mypair._Myval2)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 2983, 0, "%s", "string iterator incompatible")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"string iterator incompatible\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 2983, 0); } while (false); } ; } while (false); const auto _Off = static_cast<size_type>(_Unfancy(_Where._Ptr) - _Mypair._Myval2._Myptr()); insert(_Off, _Ilist.begin(), _Convert_size<size_type>(_Ilist.size())); return begin() + static_cast<difference_type>(_Off); } constexpr basic_string& replace( const const_iterator _First, const const_iterator _Last, const initializer_list<_Elem> _Ilist) { _Adl_verify_range(_First, _Last); do { if (_First._Getcont() == ::std:: addressof(_Mypair._Myval2)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 2995, 0, "%s", "string iterators incompatible")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"string iterators incompatible\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 2995, 0); } while (false); } ; } while (false); const auto _Offset = static_cast<size_type>(_Unfancy(_First._Ptr) - _Mypair._Myval2._Myptr()); const auto _Length = static_cast<size_type>(_Last._Ptr - _First._Ptr); return replace(_Offset, _Length, _Ilist.begin(), _Convert_size<size_type>(_Ilist.size())); } constexpr ~basic_string() noexcept { _Tidy_deallocate(); auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Getal()); const auto _To_delete = _Mypair._Myval2._Myproxy; _Mypair._Myval2._Myproxy = nullptr; _Delete_plain_internal(_Alproxy, _To_delete); } static constexpr auto npos{static_cast<size_type>(-1)}; private: void _Copy_assign_val_from_small(const basic_string& _Right) { do { if (!::std:: is_constant_evaluated()) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3018, 0, "%s", "SSO should be disabled in a constexpr context")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"SSO should be disabled in a constexpr context\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3018, 0); } while (false); } ; } while (false); _Tidy_deallocate(); if constexpr (_Can_memcpy_val) { _Memcpy_val_from(_Right); } else { auto& _My_data = _Mypair._Myval2; auto& _Right_data = _Right._Mypair._Myval2; _Traits::copy(_My_data._Bx._Buf, _Right_data._Bx._Buf, _Right_data._Mysize + 1); _My_data._Mysize = _Right_data._Mysize; _My_data._Myres = _Right_data._Myres; } } constexpr void _Copy_assign(const basic_string& _Right, false_type) { _Pocca(_Getal(), _Right._Getal()); assign(_Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize); } constexpr void _Copy_assign(const basic_string& _Right, true_type) { auto& _Al = _Getal(); const auto& _Right_al = _Right._Getal(); if (_Al == _Right_al) { _Copy_assign(_Right, false_type{}); return; } auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Al); auto&& _Right_alproxy = static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Right_al); _Container_proxy_ptr<_Alty> _New_proxy(_Right_alproxy, _Leave_proxy_unbound{}); if (_Right._Mypair._Myval2._Large_string_engaged()) { const auto _New_size = _Right._Mypair._Myval2._Mysize; const auto _New_capacity = _Calculate_growth(_New_size, 0, _Right.max_size()); auto _Right_al_non_const = _Right_al; const auto _New_ptr = _Right_al_non_const.allocate(_New_capacity); if (::std:: is_constant_evaluated()) { _Traits::assign(_Unfancy(_New_ptr), _New_size + 1, _Elem()); } _Traits::copy(_Unfancy(_New_ptr), _Unfancy(_Right._Mypair._Myval2._Bx._Ptr), _New_size + 1); _Tidy_deallocate(); _Mypair._Myval2._Bx._Ptr = _New_ptr; _Mypair._Myval2._Mysize = _New_size; _Mypair._Myval2._Myres = _New_capacity; } else { _Copy_assign_val_from_small(_Right); } _Pocca(_Al, _Right_al); _New_proxy._Bind(_Alproxy, ::std:: addressof(_Mypair._Myval2)); } public: constexpr basic_string& operator=(const basic_string& _Right) { if (this != ::std:: addressof(_Right)) { _Copy_assign(_Right, _Choose_pocca<_Alty>{}); } return *this; } template <class _StringViewIsh, _Is_string_view_ish<_StringViewIsh> = 0> constexpr basic_string& operator=(const _StringViewIsh& _Right) { return assign(_Right); } constexpr basic_string& operator=( const _Elem* const _Ptr) { return assign(_Ptr); } constexpr basic_string& operator=(const _Elem _Ch) { _Mypair._Myval2._Mysize = 1; _Elem* const _Ptr = _Mypair._Myval2._Myptr(); _Traits::assign(_Ptr[0], _Ch); _Traits::assign(_Ptr[1], _Elem()); return *this; } constexpr basic_string& operator+=(const basic_string& _Right) { return append(_Right); } template <class _StringViewIsh, _Is_string_view_ish<_StringViewIsh> = 0> constexpr basic_string& operator+=(const _StringViewIsh& _Right) { return append(_Right); } constexpr basic_string& operator+=( const _Elem* const _Ptr) { return append(_Ptr); } constexpr basic_string& operator+=(_Elem _Ch) { push_back(_Ch); return *this; } constexpr basic_string& append(const basic_string& _Right) { return append(_Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize); } constexpr basic_string& append( const basic_string& _Right, const size_type _Roff, size_type _Count = npos) { _Right._Mypair._Myval2._Check_offset(_Roff); _Count = _Right._Mypair._Myval2._Clamp_suffix_size(_Roff, _Count); return append(_Right._Mypair._Myval2._Myptr() + _Roff, _Count); } template <class _StringViewIsh, _Is_string_view_ish<_StringViewIsh> = 0> constexpr basic_string& append(const _StringViewIsh& _Right) { const basic_string_view<_Elem, _Traits> _As_view = _Right; return append(_As_view.data(), _Convert_size<size_type>(_As_view.size())); } template <class _StringViewIsh, _Is_string_view_ish<_StringViewIsh> = 0> constexpr basic_string& append( const _StringViewIsh& _Right, const size_type _Roff, const size_type _Count = npos) { basic_string_view<_Elem, _Traits> _As_view = _Right; return append(_As_view.substr(_Roff, _Count)); } constexpr basic_string& append( const _Elem* const _Ptr, const size_type _Count) { const size_type _Old_size = _Mypair._Myval2._Mysize; if (_Count <= _Mypair._Myval2._Myres - _Old_size) { _Mypair._Myval2._Mysize = _Old_size + _Count; _Elem* const _Old_ptr = _Mypair._Myval2._Myptr(); _Traits::move(_Old_ptr + _Old_size, _Ptr, _Count); _Traits::assign(_Old_ptr[_Old_size + _Count], _Elem()); return *this; } return _Reallocate_grow_by( _Count, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const _Elem* const _Ptr, const size_type _Count) { _Traits::copy(_New_ptr, _Old_ptr, _Old_size); _Traits::copy(_New_ptr + _Old_size, _Ptr, _Count); _Traits::assign(_New_ptr[_Old_size + _Count], _Elem()); }, _Ptr, _Count); } constexpr basic_string& append( const _Elem* const _Ptr) { return append(_Ptr, _Convert_size<size_type>(_Traits::length(_Ptr))); } constexpr basic_string& append( const size_type _Count, const _Elem _Ch) { const size_type _Old_size = _Mypair._Myval2._Mysize; if (_Count <= _Mypair._Myval2._Myres - _Old_size) { _Mypair._Myval2._Mysize = _Old_size + _Count; _Elem* const _Old_ptr = _Mypair._Myval2._Myptr(); _Traits::assign(_Old_ptr + _Old_size, _Count, _Ch); _Traits::assign(_Old_ptr[_Old_size + _Count], _Elem()); return *this; } return _Reallocate_grow_by( _Count, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const size_type _Count, const _Elem _Ch) { _Traits::copy(_New_ptr, _Old_ptr, _Old_size); _Traits::assign(_New_ptr + _Old_size, _Count, _Ch); _Traits::assign(_New_ptr[_Old_size + _Count], _Elem()); }, _Count, _Ch); } template <class _Iter, enable_if_t<_Is_iterator_v<_Iter>, int> = 0> constexpr basic_string& append(const _Iter _First, const _Iter _Last) { _Adl_verify_range(_First, _Last); const auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); if constexpr (_Is_elem_cptr<decltype(_UFirst)>::value) { return append(_UFirst, _Convert_size<size_type>(static_cast<size_t>(_ULast - _UFirst))); } else { const basic_string _Right(_UFirst, _ULast, get_allocator()); return append(_Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize); } } constexpr basic_string& assign(const basic_string& _Right) { *this = _Right; return *this; } constexpr basic_string& assign( const basic_string& _Right, const size_type _Roff, size_type _Count = npos) { _Right._Mypair._Myval2._Check_offset(_Roff); _Count = _Right._Mypair._Myval2._Clamp_suffix_size(_Roff, _Count); return assign(_Right._Mypair._Myval2._Myptr() + _Roff, _Count); } template <class _StringViewIsh, _Is_string_view_ish<_StringViewIsh> = 0> constexpr basic_string& assign(const _StringViewIsh& _Right) { const basic_string_view<_Elem, _Traits> _As_view = _Right; return assign(_As_view.data(), _Convert_size<size_type>(_As_view.size())); } template <class _StringViewIsh, _Is_string_view_ish<_StringViewIsh> = 0> constexpr basic_string& assign( const _StringViewIsh& _Right, const size_type _Roff, const size_type _Count = npos) { basic_string_view<_Elem, _Traits> _As_view = _Right; return assign(_As_view.substr(_Roff, _Count)); } constexpr basic_string& assign( const _Elem* const _Ptr, const size_type _Count) { if (_Count <= _Mypair._Myval2._Myres) { _Elem* const _Old_ptr = _Mypair._Myval2._Myptr(); _Mypair._Myval2._Mysize = _Count; _Traits::move(_Old_ptr, _Ptr, _Count); _Traits::assign(_Old_ptr[_Count], _Elem()); return *this; } return _Reallocate_for( _Count, [](_Elem* const _New_ptr, const size_type _Count, const _Elem* const _Ptr) { _Traits::copy(_New_ptr, _Ptr, _Count); _Traits::assign(_New_ptr[_Count], _Elem()); }, _Ptr); } constexpr basic_string& assign( const _Elem* const _Ptr) { return assign(_Ptr, _Convert_size<size_type>(_Traits::length(_Ptr))); } constexpr basic_string& assign( const size_type _Count, const _Elem _Ch) { if (_Count <= _Mypair._Myval2._Myres) { _Elem* const _Old_ptr = _Mypair._Myval2._Myptr(); _Mypair._Myval2._Mysize = _Count; _Traits::assign(_Old_ptr, _Count, _Ch); _Traits::assign(_Old_ptr[_Count], _Elem()); return *this; } return _Reallocate_for( _Count, [](_Elem* const _New_ptr, const size_type _Count, const _Elem _Ch) { _Traits::assign(_New_ptr, _Count, _Ch); _Traits::assign(_New_ptr[_Count], _Elem()); }, _Ch); } template <class _Iter, enable_if_t<_Is_iterator_v<_Iter>, int> = 0> constexpr basic_string& assign(const _Iter _First, const _Iter _Last) { _Adl_verify_range(_First, _Last); const auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); if constexpr (_Is_elem_cptr<decltype(_UFirst)>::value) { return assign(_UFirst, _Convert_size<size_type>(static_cast<size_t>(_ULast - _UFirst))); } else { basic_string _Right(_UFirst, _ULast, get_allocator()); if (_Mypair._Myval2._Myres < _Right._Mypair._Myval2._Myres) { _Mypair._Myval2._Orphan_all(); _Swap_data(_Right); return *this; } else { return assign(_Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize); } } } constexpr basic_string& insert(const size_type _Off, const basic_string& _Right) { return insert(_Off, _Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize); } constexpr basic_string& insert( const size_type _Off, const basic_string& _Right, const size_type _Roff, size_type _Count = npos) { _Right._Mypair._Myval2._Check_offset(_Roff); _Count = _Right._Mypair._Myval2._Clamp_suffix_size(_Roff, _Count); return insert(_Off, _Right._Mypair._Myval2._Myptr() + _Roff, _Count); } template <class _StringViewIsh, _Is_string_view_ish<_StringViewIsh> = 0> constexpr basic_string& insert(const size_type _Off, const _StringViewIsh& _Right) { const basic_string_view<_Elem, _Traits> _As_view = _Right; return insert(_Off, _As_view.data(), _Convert_size<size_type>(_As_view.size())); } template <class _StringViewIsh, _Is_string_view_ish<_StringViewIsh> = 0> constexpr basic_string& insert( const size_type _Off, const _StringViewIsh& _Right, const size_type _Roff, const size_type _Count = npos) { basic_string_view<_Elem, _Traits> _As_view = _Right; return insert(_Off, _As_view.substr(_Roff, _Count)); } constexpr basic_string& insert( const size_type _Off, const _Elem* const _Ptr, const size_type _Count) { _Mypair._Myval2._Check_offset(_Off); const size_type _Old_size = _Mypair._Myval2._Mysize; const bool _Check_overlap = _Count <= _Mypair._Myval2._Myres - _Old_size && !::std:: is_constant_evaluated(); if (_Check_overlap) { _Mypair._Myval2._Mysize = _Old_size + _Count; _Elem* const _Old_ptr = _Mypair._Myval2._Myptr(); _Elem* const _Insert_at = _Old_ptr + _Off; size_type _Ptr_shifted_after; if (_Ptr + _Count <= _Insert_at || _Ptr > _Old_ptr + _Old_size) { _Ptr_shifted_after = _Count; } else if (_Insert_at <= _Ptr) { _Ptr_shifted_after = 0; } else { _Ptr_shifted_after = static_cast<size_type>(_Insert_at - _Ptr); } _Traits::move(_Insert_at + _Count, _Insert_at, _Old_size - _Off + 1); _Traits::copy(_Insert_at, _Ptr, _Ptr_shifted_after); _Traits::copy( _Insert_at + _Ptr_shifted_after, _Ptr + _Count + _Ptr_shifted_after, _Count - _Ptr_shifted_after); return *this; } return _Reallocate_grow_by( _Count, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const size_type _Off, const _Elem* const _Ptr, const size_type _Count) { _Traits::copy(_New_ptr, _Old_ptr, _Off); _Traits::copy(_New_ptr + _Off, _Ptr, _Count); _Traits::copy(_New_ptr + _Off + _Count, _Old_ptr + _Off, _Old_size - _Off + 1); }, _Off, _Ptr, _Count); } constexpr basic_string& insert(const size_type _Off, const _Elem* const _Ptr) { return insert(_Off, _Ptr, _Convert_size<size_type>(_Traits::length(_Ptr))); } constexpr basic_string& insert( const size_type _Off, const size_type _Count, const _Elem _Ch) { _Mypair._Myval2._Check_offset(_Off); const size_type _Old_size = _Mypair._Myval2._Mysize; if (_Count <= _Mypair._Myval2._Myres - _Old_size) { _Mypair._Myval2._Mysize = _Old_size + _Count; _Elem* const _Old_ptr = _Mypair._Myval2._Myptr(); _Elem* const _Insert_at = _Old_ptr + _Off; _Traits::move(_Insert_at + _Count, _Insert_at, _Old_size - _Off + 1); _Traits::assign(_Insert_at, _Count, _Ch); return *this; } return _Reallocate_grow_by( _Count, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const size_type _Off, const size_type _Count, const _Elem _Ch) { _Traits::copy(_New_ptr, _Old_ptr, _Off); _Traits::assign(_New_ptr + _Off, _Count, _Ch); _Traits::copy(_New_ptr + _Off + _Count, _Old_ptr + _Off, _Old_size - _Off + 1); }, _Off, _Count, _Ch); } constexpr iterator insert(const const_iterator _Where, const _Elem _Ch) { do { if (_Where._Getcont() == ::std:: addressof(_Mypair._Myval2)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3415, 0, "%s", "string iterator incompatible")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"string iterator incompatible\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3415, 0); } while (false); } ; } while (false); const auto _Off = static_cast<size_type>(_Unfancy(_Where._Ptr) - _Mypair._Myval2._Myptr()); insert(_Off, 1, _Ch); return begin() + static_cast<difference_type>(_Off); } constexpr iterator insert( const const_iterator _Where, const size_type _Count, const _Elem _Ch) { do { if (_Where._Getcont() == ::std:: addressof(_Mypair._Myval2)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3426, 0, "%s", "string iterator incompatible")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"string iterator incompatible\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3426, 0); } while (false); } ; } while (false); const auto _Off = static_cast<size_type>(_Unfancy(_Where._Ptr) - _Mypair._Myval2._Myptr()); insert(_Off, _Count, _Ch); return begin() + static_cast<difference_type>(_Off); } template <class _Iter, enable_if_t<_Is_iterator_v<_Iter>, int> = 0> constexpr iterator insert(const const_iterator _Where, const _Iter _First, const _Iter _Last) { do { if (_Where._Getcont() == ::std:: addressof(_Mypair._Myval2)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3437, 0, "%s", "string iterator incompatible")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"string iterator incompatible\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3437, 0); } while (false); } ; } while (false); const auto _Off = static_cast<size_type>(_Unfancy(_Where._Ptr) - _Mypair._Myval2._Myptr()); _Adl_verify_range(_First, _Last); const auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); if constexpr (_Is_elem_cptr<decltype(_UFirst)>::value) { insert(_Off, _UFirst, _Convert_size<size_type>(static_cast<size_t>(_ULast - _UFirst))); } else { const basic_string _Right(_UFirst, _ULast, get_allocator()); insert(_Off, _Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize); } return begin() + static_cast<difference_type>(_Off); } constexpr basic_string& erase(const size_type _Off = 0) { _Mypair._Myval2._Check_offset(_Off); _Eos(_Off); return *this; } private: constexpr basic_string& _Erase_noexcept(const size_type _Off, size_type _Count) noexcept { _Count = _Mypair._Myval2._Clamp_suffix_size(_Off, _Count); const size_type _Old_size = _Mypair._Myval2._Mysize; _Elem* const _My_ptr = _Mypair._Myval2._Myptr(); _Elem* const _Erase_at = _My_ptr + _Off; const size_type _New_size = _Old_size - _Count; _Mypair._Myval2._Mysize = _New_size; _Traits::move(_Erase_at, _Erase_at + _Count, _New_size - _Off + 1); return *this; } public: constexpr basic_string& erase(const size_type _Off, const size_type _Count) { _Mypair._Myval2._Check_offset(_Off); return _Erase_noexcept(_Off, _Count); } constexpr iterator erase(const const_iterator _Where) noexcept { do { if (_Where._Getcont() == ::std:: addressof(_Mypair._Myval2)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3480, 0, "%s", "string iterator incompatible")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"string iterator incompatible\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3480, 0); } while (false); } ; } while (false); const auto _Off = static_cast<size_type>(_Unfancy(_Where._Ptr) - _Mypair._Myval2._Myptr()); _Erase_noexcept(_Off, 1); return begin() + static_cast<difference_type>(_Off); } constexpr iterator erase(const const_iterator _First, const const_iterator _Last) noexcept { _Adl_verify_range(_First, _Last); do { if (_First._Getcont() == ::std:: addressof(_Mypair._Myval2)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3491, 0, "%s", "string iterators incompatible")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"string iterators incompatible\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3491, 0); } while (false); } ; } while (false); const auto _Off = static_cast<size_type>(_Unfancy(_First._Ptr) - _Mypair._Myval2._Myptr()); _Erase_noexcept(_Off, static_cast<size_type>(_Last._Ptr - _First._Ptr)); return begin() + static_cast<difference_type>(_Off); } constexpr void clear() noexcept { _Eos(0); } constexpr basic_string& replace( const size_type _Off, const size_type _Nx, const basic_string& _Right) { return replace(_Off, _Nx, _Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize); } constexpr basic_string& replace(const size_type _Off, size_type _Nx, const basic_string& _Right, const size_type _Roff, size_type _Count = npos) { _Right._Mypair._Myval2._Check_offset(_Roff); _Count = _Right._Mypair._Myval2._Clamp_suffix_size(_Roff, _Count); return replace(_Off, _Nx, _Right._Mypair._Myval2._Myptr() + _Roff, _Count); } template <class _StringViewIsh, _Is_string_view_ish<_StringViewIsh> = 0> constexpr basic_string& replace( const size_type _Off, const size_type _Nx, const _StringViewIsh& _Right) { basic_string_view<_Elem, _Traits> _As_view = _Right; return replace(_Off, _Nx, _As_view.data(), _Convert_size<size_type>(_As_view.size())); } template <class _StringViewIsh, _Is_string_view_ish<_StringViewIsh> = 0> constexpr basic_string& replace(const size_type _Off, const size_type _Nx, const _StringViewIsh& _Right, const size_type _Roff, const size_type _Count = npos) { basic_string_view<_Elem, _Traits> _As_view = _Right; return replace(_Off, _Nx, _As_view.substr(_Roff, _Count)); } constexpr basic_string& replace( const size_type _Off, size_type _Nx, const _Elem* const _Ptr, const size_type _Count) { _Mypair._Myval2._Check_offset(_Off); _Nx = _Mypair._Myval2._Clamp_suffix_size(_Off, _Nx); if (_Nx == _Count) { _Traits::move(_Mypair._Myval2._Myptr() + _Off, _Ptr, _Count); return *this; } const size_type _Old_size = _Mypair._Myval2._Mysize; const size_type _Suffix_size = _Old_size - _Nx - _Off + 1; if (_Count < _Nx) { _Mypair._Myval2._Mysize = _Old_size - (_Nx - _Count); _Elem* const _Old_ptr = _Mypair._Myval2._Myptr(); _Elem* const _Insert_at = _Old_ptr + _Off; _Traits::move(_Insert_at, _Ptr, _Count); _Traits::move(_Insert_at + _Count, _Insert_at + _Nx, _Suffix_size); return *this; } const size_type _Growth = static_cast<size_type>(_Count - _Nx); if (!::std:: is_constant_evaluated()) { if (_Growth <= _Mypair._Myval2._Myres - _Old_size) { _Mypair._Myval2._Mysize = _Old_size + _Growth; _Elem* const _Old_ptr = _Mypair._Myval2._Myptr(); _Elem* const _Insert_at = _Old_ptr + _Off; _Elem* const _Suffix_at = _Insert_at + _Nx; size_type _Ptr_shifted_after; if (_Ptr + _Count <= _Insert_at || _Ptr > _Old_ptr + _Old_size) { _Ptr_shifted_after = _Count; } else if (_Suffix_at <= _Ptr) { _Ptr_shifted_after = 0; } else { _Ptr_shifted_after = static_cast<size_type>(_Suffix_at - _Ptr); } _Traits::move(_Suffix_at + _Growth, _Suffix_at, _Suffix_size); _Traits::move(_Insert_at, _Ptr, _Ptr_shifted_after); _Traits::copy( _Insert_at + _Ptr_shifted_after, _Ptr + _Growth + _Ptr_shifted_after, _Count - _Ptr_shifted_after); return *this; } } return _Reallocate_grow_by( _Growth, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const size_type _Off, const size_type _Nx, const _Elem* const _Ptr, const size_type _Count) { _Traits::copy(_New_ptr, _Old_ptr, _Off); _Traits::copy(_New_ptr + _Off, _Ptr, _Count); _Traits::copy(_New_ptr + _Off + _Count, _Old_ptr + _Off + _Nx, _Old_size - _Nx - _Off + 1); }, _Off, _Nx, _Ptr, _Count); } constexpr basic_string& replace( const size_type _Off, const size_type _Nx, const _Elem* const _Ptr) { return replace(_Off, _Nx, _Ptr, _Convert_size<size_type>(_Traits::length(_Ptr))); } constexpr basic_string& replace( const size_type _Off, size_type _Nx, const size_type _Count, const _Elem _Ch) { _Mypair._Myval2._Check_offset(_Off); _Nx = _Mypair._Myval2._Clamp_suffix_size(_Off, _Nx); if (_Count == _Nx) { _Traits::assign(_Mypair._Myval2._Myptr() + _Off, _Count, _Ch); return *this; } const size_type _Old_size = _Mypair._Myval2._Mysize; if (_Count < _Nx || _Count - _Nx <= _Mypair._Myval2._Myres - _Old_size) { _Mypair._Myval2._Mysize = _Old_size + _Count - _Nx; _Elem* const _Old_ptr = _Mypair._Myval2._Myptr(); _Elem* const _Insert_at = _Old_ptr + _Off; _Traits::move(_Insert_at + _Count, _Insert_at + _Nx, _Old_size - _Nx - _Off + 1); _Traits::assign(_Insert_at, _Count, _Ch); return *this; } return _Reallocate_grow_by( _Count - _Nx, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const size_type _Off, const size_type _Nx, const size_type _Count, const _Elem _Ch) { _Traits::copy(_New_ptr, _Old_ptr, _Off); _Traits::assign(_New_ptr + _Off, _Count, _Ch); _Traits::copy(_New_ptr + _Off + _Count, _Old_ptr + _Off + _Nx, _Old_size - _Nx - _Off + 1); }, _Off, _Nx, _Count, _Ch); } constexpr basic_string& replace( const const_iterator _First, const const_iterator _Last, const basic_string& _Right) { _Adl_verify_range(_First, _Last); do { if (_First._Getcont() == ::std:: addressof(_Mypair._Myval2)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3646, 0, "%s", "string iterators incompatible")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"string iterators incompatible\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3646, 0); } while (false); } ; } while (false); return replace(static_cast<size_type>(_Unfancy(_First._Ptr) - _Mypair._Myval2._Myptr()), static_cast<size_type>(_Last._Ptr - _First._Ptr), _Right); } template <class _StringViewIsh, _Is_string_view_ish<_StringViewIsh> = 0> constexpr basic_string& replace( const const_iterator _First, const const_iterator _Last, const _StringViewIsh& _Right) { _Adl_verify_range(_First, _Last); do { if (_First._Getcont() == ::std:: addressof(_Mypair._Myval2)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3659, 0, "%s", "string iterators incompatible")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"string iterators incompatible\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3659, 0); } while (false); } ; } while (false); return replace(static_cast<size_type>(_Unfancy(_First._Ptr) - _Mypair._Myval2._Myptr()), static_cast<size_type>(_Last._Ptr - _First._Ptr), _Right); } constexpr basic_string& replace(const const_iterator _First, const const_iterator _Last, const _Elem* const _Ptr, const size_type _Count) { _Adl_verify_range(_First, _Last); do { if (_First._Getcont() == ::std:: addressof(_Mypair._Myval2)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3671, 0, "%s", "string iterators incompatible")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"string iterators incompatible\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3671, 0); } while (false); } ; } while (false); return replace(static_cast<size_type>(_Unfancy(_First._Ptr) - _Mypair._Myval2._Myptr()), static_cast<size_type>(_Last._Ptr - _First._Ptr), _Ptr, _Count); } constexpr basic_string& replace( const const_iterator _First, const const_iterator _Last, const _Elem* const _Ptr) { _Adl_verify_range(_First, _Last); do { if (_First._Getcont() == ::std:: addressof(_Mypair._Myval2)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3682, 0, "%s", "string iterators incompatible")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"string iterators incompatible\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3682, 0); } while (false); } ; } while (false); return replace(static_cast<size_type>(_Unfancy(_First._Ptr) - _Mypair._Myval2._Myptr()), static_cast<size_type>(_Last._Ptr - _First._Ptr), _Ptr); } constexpr basic_string& replace( const const_iterator _First, const const_iterator _Last, const size_type _Count, const _Elem _Ch) { _Adl_verify_range(_First, _Last); do { if (_First._Getcont() == ::std:: addressof(_Mypair._Myval2)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3693, 0, "%s", "string iterators incompatible")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"string iterators incompatible\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3693, 0); } while (false); } ; } while (false); return replace(static_cast<size_type>(_Unfancy(_First._Ptr) - _Mypair._Myval2._Myptr()), static_cast<size_type>(_Last._Ptr - _First._Ptr), _Count, _Ch); } template <class _Iter, enable_if_t<_Is_iterator_v<_Iter>, int> = 0> constexpr basic_string& replace( const const_iterator _First, const const_iterator _Last, const _Iter _First2, const _Iter _Last2) { _Adl_verify_range(_First, _Last); do { if (_First._Getcont() == ::std:: addressof(_Mypair._Myval2)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3705, 0, "%s", "string iterators incompatible")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"string iterators incompatible\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3705, 0); } while (false); } ; } while (false); const auto _Off = static_cast<size_type>(_Unfancy(_First._Ptr) - _Mypair._Myval2._Myptr()); const auto _Length = static_cast<size_type>(_Last._Ptr - _First._Ptr); _Adl_verify_range(_First2, _Last2); const auto _UFirst2 = _Get_unwrapped(_First2); const auto _ULast2 = _Get_unwrapped(_Last2); if constexpr (_Is_elem_cptr<decltype(_UFirst2)>::value) { return replace(_Off, _Length, _UFirst2, _Convert_size<size_type>(static_cast<size_t>(_ULast2 - _UFirst2))); } else { const basic_string _Right(_UFirst2, _ULast2, get_allocator()); return replace(_Off, _Length, _Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize); } } [[nodiscard]] constexpr iterator begin() noexcept { return iterator(_Refancy<pointer>(_Mypair._Myval2._Myptr()), ::std:: addressof(_Mypair._Myval2)); } [[nodiscard]] constexpr const_iterator begin() const noexcept { return const_iterator(_Refancy<const_pointer>(_Mypair._Myval2._Myptr()), ::std:: addressof(_Mypair._Myval2)); } [[nodiscard]] constexpr iterator end() noexcept { return iterator( _Refancy<pointer>(_Mypair._Myval2._Myptr()) + static_cast<difference_type>(_Mypair._Myval2._Mysize), ::std:: addressof(_Mypair._Myval2)); } [[nodiscard]] constexpr const_iterator end() const noexcept { return const_iterator( _Refancy<const_pointer>(_Mypair._Myval2._Myptr()) + static_cast<difference_type>(_Mypair._Myval2._Mysize), ::std:: addressof(_Mypair._Myval2)); } [[nodiscard]] constexpr _Elem* _Unchecked_begin() noexcept { return _Mypair._Myval2._Myptr(); } [[nodiscard]] constexpr const _Elem* _Unchecked_begin() const noexcept { return _Mypair._Myval2._Myptr(); } [[nodiscard]] constexpr _Elem* _Unchecked_end() noexcept { return _Mypair._Myval2._Myptr() + _Mypair._Myval2._Mysize; } [[nodiscard]] constexpr const _Elem* _Unchecked_end() const noexcept { return _Mypair._Myval2._Myptr() + _Mypair._Myval2._Mysize; } [[nodiscard]] constexpr reverse_iterator rbegin() noexcept { return reverse_iterator(end()); } [[nodiscard]] constexpr const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } [[nodiscard]] constexpr reverse_iterator rend() noexcept { return reverse_iterator(begin()); } [[nodiscard]] constexpr const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } [[nodiscard]] constexpr const_iterator cbegin() const noexcept { return begin(); } [[nodiscard]] constexpr const_iterator cend() const noexcept { return end(); } [[nodiscard]] constexpr const_reverse_iterator crbegin() const noexcept { return rbegin(); } [[nodiscard]] constexpr const_reverse_iterator crend() const noexcept { return rend(); } constexpr void shrink_to_fit() { auto& _My_data = _Mypair._Myval2; if (!::std:: is_constant_evaluated()) { if (!_My_data._Large_string_engaged()) { return; } if (_My_data._Mysize < _BUF_SIZE) { _Become_small(); return; } } size_type _Target_capacity = (::std:: min)(_My_data._Mysize | _ALLOC_MASK, max_size()); _Target_capacity = (::std:: max)(_Target_capacity, _BUF_SIZE); if (_Target_capacity < _My_data._Myres) { auto& _Al = _Getal(); const pointer _New_ptr = _Al.allocate(_Target_capacity + 1); if (::std:: is_constant_evaluated()) { _Traits::assign(_Unfancy(_New_ptr), _Target_capacity + 1, _Elem()); } _My_data._Orphan_all(); _Traits::copy(_Unfancy(_New_ptr), _Unfancy(_My_data._Bx._Ptr), _My_data._Mysize + 1); _Al.deallocate(_My_data._Bx._Ptr, _My_data._Myres + 1); _My_data._Bx._Ptr = _New_ptr; _My_data._Myres = _Target_capacity; } } [[nodiscard]] constexpr reference at(const size_type _Off) { _Mypair._Myval2._Check_offset_exclusive(_Off); return _Mypair._Myval2._Myptr()[_Off]; } [[nodiscard]] constexpr const_reference at(const size_type _Off) const { _Mypair._Myval2._Check_offset_exclusive(_Off); return _Mypair._Myval2._Myptr()[_Off]; } [[nodiscard]] constexpr reference operator[](const size_type _Off) noexcept { do { if (_Off <= _Mypair._Myval2._Mysize) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3841, 0, "%s", "string subscript out of range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"string subscript out of range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3841, 0); } while (false); } ; } while (false); return _Mypair._Myval2._Myptr()[_Off]; } [[nodiscard]] constexpr const_reference operator[](const size_type _Off) const noexcept { do { if (_Off <= _Mypair._Myval2._Mysize) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3849, 0, "%s", "string subscript out of range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"string subscript out of range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3849, 0); } while (false); } ; } while (false); return _Mypair._Myval2._Myptr()[_Off]; } constexpr operator basic_string_view<_Elem, _Traits>() const noexcept { return basic_string_view<_Elem, _Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize); } constexpr void push_back(const _Elem _Ch) { const size_type _Old_size = _Mypair._Myval2._Mysize; if (_Old_size < _Mypair._Myval2._Myres) { _Mypair._Myval2._Mysize = _Old_size + 1; _Elem* const _Ptr = _Mypair._Myval2._Myptr(); _Traits::assign(_Ptr[_Old_size], _Ch); _Traits::assign(_Ptr[_Old_size + 1], _Elem()); return; } _Reallocate_grow_by( 1, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size, const _Elem _Ch) { _Traits::copy(_New_ptr, _Old_ptr, _Old_size); _Traits::assign(_New_ptr[_Old_size], _Ch); _Traits::assign(_New_ptr[_Old_size + 1], _Elem()); }, _Ch); } constexpr void pop_back() noexcept { const size_type _Old_size = _Mypair._Myval2._Mysize; do { if (_Old_size != 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3884, 0, "%s", "invalid to pop_back empty string")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"invalid to pop_back empty string\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3884, 0); } while (false); } ; } while (false); _Eos(_Old_size - 1); } [[nodiscard]] constexpr reference front() noexcept { do { if (_Mypair._Myval2._Mysize != 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3891, 0, "%s", "front() called on empty string")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"front() called on empty string\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3891, 0); } while (false); } ; } while (false); return _Mypair._Myval2._Myptr()[0]; } [[nodiscard]] constexpr const_reference front() const noexcept { do { if (_Mypair._Myval2._Mysize != 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3899, 0, "%s", "front() called on empty string")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"front() called on empty string\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3899, 0); } while (false); } ; } while (false); return _Mypair._Myval2._Myptr()[0]; } [[nodiscard]] constexpr reference back() noexcept { do { if (_Mypair._Myval2._Mysize != 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3907, 0, "%s", "back() called on empty string")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"back() called on empty string\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3907, 0); } while (false); } ; } while (false); return _Mypair._Myval2._Myptr()[_Mypair._Myval2._Mysize - 1]; } [[nodiscard]] constexpr const_reference back() const noexcept { do { if (_Mypair._Myval2._Mysize != 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3915, 0, "%s", "back() called on empty string")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"back() called on empty string\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 3915, 0); } while (false); } ; } while (false); return _Mypair._Myval2._Myptr()[_Mypair._Myval2._Mysize - 1]; } [[nodiscard]] constexpr const _Elem* c_str() const noexcept { return _Mypair._Myval2._Myptr(); } [[nodiscard]] constexpr const _Elem* data() const noexcept { return _Mypair._Myval2._Myptr(); } [[nodiscard]] constexpr _Elem* data() noexcept { return _Mypair._Myval2._Myptr(); } [[nodiscard]] constexpr size_type length() const noexcept { return _Mypair._Myval2._Mysize; } [[nodiscard]] constexpr size_type size() const noexcept { return _Mypair._Myval2._Mysize; } [[nodiscard]] constexpr size_type max_size() const noexcept { const size_type _Alloc_max = _Alty_traits::max_size(_Getal()); const size_type _Storage_max = (::std:: max)(_Alloc_max, static_cast<size_type>(_BUF_SIZE)); return (::std:: min)(static_cast<size_type>((numeric_limits<difference_type>::max)()), _Storage_max - 1 ); } constexpr void resize( const size_type _Newsize, const _Elem _Ch = _Elem()) { const size_type _Old_size = size(); if (_Newsize <= _Old_size) { _Eos(_Newsize); } else { append(_Newsize - _Old_size, _Ch); } } [[nodiscard]] constexpr size_type capacity() const noexcept { return _Mypair._Myval2._Myres; } constexpr void reserve( const size_type _Newcap) { if (_Mypair._Myval2._Myres >= _Newcap) { return; } const size_type _Old_size = _Mypair._Myval2._Mysize; _Reallocate_grow_by( _Newcap - _Old_size, [](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size) { _Traits::copy(_New_ptr, _Old_ptr, _Old_size + 1); }); _Mypair._Myval2._Mysize = _Old_size; } [[deprecated("warning STL4024: " "std::string::reserve() without an argument is deprecated in C++20. " "To shrink the string's capacity, use std::string::shrink_to_fit() instead. Otherwise, provide an " "argument to std::string::reserve(). " "You can define _SILENCE_CXX20_STRING_RESERVE_WITHOUT_ARGUMENT_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] void reserve() { if (_Mypair._Myval2._Mysize == 0 && _Mypair._Myval2._Large_string_engaged()) { _Become_small(); } } [[nodiscard]] constexpr bool empty() const noexcept { return size() == 0; } constexpr size_type copy( _Elem* const _Ptr, size_type _Count, const size_type _Off = 0) const { _Mypair._Myval2._Check_offset(_Off); _Count = _Mypair._Myval2._Clamp_suffix_size(_Off, _Count); _Traits::copy(_Ptr, _Mypair._Myval2._Myptr() + _Off, _Count); return _Count; } constexpr size_type _Copy_s( _Elem* const _Dest, const size_type _Dest_size, size_type _Count, const size_type _Off = 0) const { _Mypair._Myval2._Check_offset(_Off); _Count = _Mypair._Myval2._Clamp_suffix_size(_Off, _Count); _Traits::_Copy_s(_Dest, _Dest_size, _Mypair._Myval2._Myptr() + _Off, _Count); return _Count; } void _Swap_bx_large_with_small(_Scary_val& _Starts_large, _Scary_val& _Starts_small) { const pointer _Ptr = _Starts_large._Bx._Ptr; _Destroy_in_place(_Starts_large._Bx._Ptr); _Traits::copy(_Starts_large._Bx._Buf, _Starts_small._Bx._Buf, _BUF_SIZE); _Construct_in_place(_Starts_small._Bx._Ptr, _Ptr); } constexpr void _Swap_data(basic_string& _Right) { auto& _My_data = _Mypair._Myval2; auto& _Right_data = _Right._Mypair._Myval2; if constexpr (_Can_memcpy_val) { if (!::std:: is_constant_evaluated()) { const auto _My_data_mem = reinterpret_cast<unsigned char*>(::std:: addressof(_My_data)) + _Memcpy_val_offset; const auto _Right_data_mem = reinterpret_cast<unsigned char*>(::std:: addressof(_Right_data)) + _Memcpy_val_offset; unsigned char _Temp_mem[_Memcpy_val_size]; :: memcpy(_Temp_mem, _My_data_mem, _Memcpy_val_size); :: memcpy(_My_data_mem, _Right_data_mem, _Memcpy_val_size); :: memcpy(_Right_data_mem, _Temp_mem, _Memcpy_val_size); return; } } const bool _My_large = _My_data._Large_string_engaged(); const bool _Right_large = _Right_data._Large_string_engaged(); if (_My_large) { if (_Right_large) { _Swap_adl(_My_data._Bx._Ptr, _Right_data._Bx._Ptr); } else { _Swap_bx_large_with_small(_My_data, _Right_data); } } else { if (_Right_large) { _Swap_bx_large_with_small(_Right_data, _My_data); } else { _Elem _Temp_buf[_BUF_SIZE]; _Traits::copy(_Temp_buf, _My_data._Bx._Buf, _BUF_SIZE); _Traits::copy(_My_data._Bx._Buf, _Right_data._Bx._Buf, _BUF_SIZE); _Traits::copy(_Right_data._Bx._Buf, _Temp_buf, _BUF_SIZE); } } ::std:: swap(_My_data._Mysize, _Right_data._Mysize); ::std:: swap(_My_data._Myres, _Right_data._Myres); } constexpr void swap(basic_string& _Right) noexcept { if (this != ::std:: addressof(_Right)) { _Pocs(_Getal(), _Right._Getal()); const bool _My_large = _Mypair._Myval2._Large_string_engaged(); const bool _Right_large = _Right._Mypair._Myval2._Large_string_engaged(); if (!_My_large) { _Mypair._Myval2._Orphan_all(); } if (!_Right_large) { _Right._Mypair._Myval2._Orphan_all(); } if (_My_large || _Right_large) { _Mypair._Myval2._Swap_proxy_and_iterators(_Right._Mypair._Myval2); } } _Swap_data(_Right); } template <class _StringViewIsh, _Is_string_view_ish<_StringViewIsh> = 0> [[nodiscard]] constexpr size_type find(const _StringViewIsh& _Right, const size_type _Off = 0) const { basic_string_view<_Elem, _Traits> _As_view = _Right; return static_cast<size_type>(_Traits_find<_Traits>( _Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _As_view.data(), _As_view.size())); } [[nodiscard]] constexpr size_type find( const basic_string& _Right, const size_type _Off = 0) const noexcept { return static_cast<size_type>(_Traits_find<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize)); } [[nodiscard]] constexpr size_type find( const _Elem* const _Ptr, const size_type _Off, const size_type _Count) const noexcept { return static_cast<size_type>( _Traits_find<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Count)); } [[nodiscard]] constexpr size_type find( const _Elem* const _Ptr, const size_type _Off = 0) const noexcept { return static_cast<size_type>(_Traits_find<_Traits>( _Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Traits::length(_Ptr))); } [[nodiscard]] constexpr size_type find(const _Elem _Ch, const size_type _Off = 0) const noexcept { return static_cast<size_type>( _Traits_find_ch<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ch)); } template <class _StringViewIsh, _Is_string_view_ish<_StringViewIsh> = 0> [[nodiscard]] constexpr size_type rfind(const _StringViewIsh& _Right, const size_type _Off = npos) const { basic_string_view<_Elem, _Traits> _As_view = _Right; return static_cast<size_type>(_Traits_rfind<_Traits>( _Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _As_view.data(), _As_view.size())); } [[nodiscard]] constexpr size_type rfind( const basic_string& _Right, const size_type _Off = npos) const noexcept { return static_cast<size_type>(_Traits_rfind<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize)); } [[nodiscard]] constexpr size_type rfind( const _Elem* const _Ptr, const size_type _Off, const size_type _Count) const noexcept { return static_cast<size_type>( _Traits_rfind<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Count)); } [[nodiscard]] constexpr size_type rfind( const _Elem* const _Ptr, const size_type _Off = npos) const noexcept { return static_cast<size_type>(_Traits_rfind<_Traits>( _Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Traits::length(_Ptr))); } [[nodiscard]] constexpr size_type rfind(const _Elem _Ch, const size_type _Off = npos) const noexcept { return static_cast<size_type>( _Traits_rfind_ch<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ch)); } template <class _StringViewIsh, _Is_string_view_ish<_StringViewIsh> = 0> [[nodiscard]] constexpr size_type find_first_of( const _StringViewIsh& _Right, const size_type _Off = 0) const { basic_string_view<_Elem, _Traits> _As_view = _Right; return static_cast<size_type>(_Traits_find_first_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _As_view.data(), _As_view.size(), _Is_specialization<_Traits, char_traits>{})); } [[nodiscard]] constexpr size_type find_first_of( const basic_string& _Right, const size_type _Off = 0) const noexcept { return static_cast<size_type>(_Traits_find_first_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize, _Is_specialization<_Traits, char_traits>{})); } [[nodiscard]] constexpr size_type find_first_of( const _Elem* const _Ptr, const size_type _Off, const size_type _Count) const noexcept { return static_cast<size_type>(_Traits_find_first_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Count, _Is_specialization<_Traits, char_traits>{})); } [[nodiscard]] constexpr size_type find_first_of( const _Elem* const _Ptr, const size_type _Off = 0) const noexcept { return static_cast<size_type>(_Traits_find_first_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Traits::length(_Ptr), _Is_specialization<_Traits, char_traits>{})); } [[nodiscard]] constexpr size_type find_first_of(const _Elem _Ch, const size_type _Off = 0) const noexcept { return static_cast<size_type>( _Traits_find_ch<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ch)); } template <class _StringViewIsh, _Is_string_view_ish<_StringViewIsh> = 0> [[nodiscard]] constexpr size_type find_last_of( const _StringViewIsh& _Right, const size_type _Off = npos) const { basic_string_view<_Elem, _Traits> _As_view = _Right; return static_cast<size_type>(_Traits_find_last_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _As_view.data(), _As_view.size(), _Is_specialization<_Traits, char_traits>{})); } [[nodiscard]] constexpr size_type find_last_of( const basic_string& _Right, size_type _Off = npos) const noexcept { return static_cast<size_type>(_Traits_find_last_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize, _Is_specialization<_Traits, char_traits>{})); } [[nodiscard]] constexpr size_type find_last_of( const _Elem* const _Ptr, const size_type _Off, const size_type _Count) const noexcept { return static_cast<size_type>(_Traits_find_last_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Count, _Is_specialization<_Traits, char_traits>{})); } [[nodiscard]] constexpr size_type find_last_of( const _Elem* const _Ptr, const size_type _Off = npos) const noexcept { return static_cast<size_type>(_Traits_find_last_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Traits::length(_Ptr), _Is_specialization<_Traits, char_traits>{})); } [[nodiscard]] constexpr size_type find_last_of( const _Elem _Ch, const size_type _Off = npos) const noexcept { return static_cast<size_type>( _Traits_rfind_ch<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ch)); } template <class _StringViewIsh, _Is_string_view_ish<_StringViewIsh> = 0> [[nodiscard]] constexpr size_type find_first_not_of( const _StringViewIsh& _Right, const size_type _Off = 0) const { basic_string_view<_Elem, _Traits> _As_view = _Right; return static_cast<size_type>( _Traits_find_first_not_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _As_view.data(), _As_view.size(), _Is_specialization<_Traits, char_traits>{})); } [[nodiscard]] constexpr size_type find_first_not_of( const basic_string& _Right, const size_type _Off = 0) const noexcept { return static_cast<size_type>(_Traits_find_first_not_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize, _Is_specialization<_Traits, char_traits>{})); } [[nodiscard]] constexpr size_type find_first_not_of( const _Elem* const _Ptr, const size_type _Off, const size_type _Count) const noexcept { return static_cast<size_type>(_Traits_find_first_not_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Count, _Is_specialization<_Traits, char_traits>{})); } [[nodiscard]] constexpr size_type find_first_not_of( const _Elem* const _Ptr, size_type _Off = 0) const noexcept { return static_cast<size_type>(_Traits_find_first_not_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Traits::length(_Ptr), _Is_specialization<_Traits, char_traits>{})); } [[nodiscard]] constexpr size_type find_first_not_of( const _Elem _Ch, const size_type _Off = 0) const noexcept { return static_cast<size_type>( _Traits_find_not_ch<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ch)); } template <class _StringViewIsh, _Is_string_view_ish<_StringViewIsh> = 0> [[nodiscard]] constexpr size_type find_last_not_of( const _StringViewIsh& _Right, const size_type _Off = npos) const { basic_string_view<_Elem, _Traits> _As_view = _Right; return static_cast<size_type>( _Traits_find_last_not_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _As_view.data(), _As_view.size(), _Is_specialization<_Traits, char_traits>{})); } [[nodiscard]] constexpr size_type find_last_not_of( const basic_string& _Right, const size_type _Off = npos) const noexcept { return static_cast<size_type>(_Traits_find_last_not_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize, _Is_specialization<_Traits, char_traits>{})); } [[nodiscard]] constexpr size_type find_last_not_of( const _Elem* const _Ptr, const size_type _Off, const size_type _Count) const noexcept { return static_cast<size_type>(_Traits_find_last_not_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Count, _Is_specialization<_Traits, char_traits>{})); } [[nodiscard]] constexpr size_type find_last_not_of( const _Elem* const _Ptr, const size_type _Off = npos) const noexcept { return static_cast<size_type>(_Traits_find_last_not_of<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ptr, _Traits::length(_Ptr), _Is_specialization<_Traits, char_traits>{})); } [[nodiscard]] constexpr size_type find_last_not_of( const _Elem _Ch, const size_type _Off = npos) const noexcept { return static_cast<size_type>( _Traits_rfind_not_ch<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Off, _Ch)); } [[nodiscard]] bool _Starts_with(const basic_string_view<_Elem, _Traits> _Right) const noexcept { return basic_string_view<_Elem, _Traits>(*this)._Starts_with(_Right); } [[nodiscard]] constexpr basic_string substr( const size_type _Off = 0, const size_type _Count = npos) const { return basic_string(*this, _Off, _Count, get_allocator()); } constexpr bool _Equal(const basic_string& _Right) const noexcept { return _Traits_equal<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize); } constexpr bool _Equal( const _Elem* const _Ptr) const noexcept { return _Traits_equal<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Ptr, _Traits::length(_Ptr)); } template <class _StringViewIsh, _Is_string_view_ish<_StringViewIsh> = 0> [[nodiscard]] constexpr int compare(const _StringViewIsh& _Right) const { basic_string_view<_Elem, _Traits> _As_view = _Right; return _Traits_compare<_Traits>( _Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _As_view.data(), _As_view.size()); } template <class _StringViewIsh, _Is_string_view_ish<_StringViewIsh> = 0> [[nodiscard]] constexpr int compare( const size_type _Off, const size_type _Nx, const _StringViewIsh& _Right) const { basic_string_view<_Elem, _Traits> _As_view = _Right; _Mypair._Myval2._Check_offset(_Off); return _Traits_compare<_Traits>(_Mypair._Myval2._Myptr() + _Off, _Mypair._Myval2._Clamp_suffix_size(_Off, _Nx), _As_view.data(), _As_view.size()); } template <class _StringViewIsh, _Is_string_view_ish<_StringViewIsh> = 0> [[nodiscard]] constexpr int compare(const size_type _Off, const size_type _Nx, const _StringViewIsh& _Right, const size_type _Roff, const size_type _Count = npos) const { basic_string_view<_Elem, _Traits> _As_view = _Right; _Mypair._Myval2._Check_offset(_Off); const auto _With_substr = _As_view.substr(_Roff, _Count); return _Traits_compare<_Traits>(_Mypair._Myval2._Myptr() + _Off, _Mypair._Myval2._Clamp_suffix_size(_Off, _Nx), _With_substr.data(), _With_substr.size()); } [[nodiscard]] constexpr int compare(const basic_string& _Right) const noexcept { return _Traits_compare<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize); } [[nodiscard]] constexpr int compare(size_type _Off, size_type _Nx, const basic_string& _Right) const { _Mypair._Myval2._Check_offset(_Off); return _Traits_compare<_Traits>(_Mypair._Myval2._Myptr() + _Off, _Mypair._Myval2._Clamp_suffix_size(_Off, _Nx), _Right._Mypair._Myval2._Myptr(), _Right._Mypair._Myval2._Mysize); } [[nodiscard]] constexpr int compare(const size_type _Off, const size_type _Nx, const basic_string& _Right, const size_type _Roff, const size_type _Count = npos) const { _Mypair._Myval2._Check_offset(_Off); _Right._Mypair._Myval2._Check_offset(_Roff); return _Traits_compare<_Traits>(_Mypair._Myval2._Myptr() + _Off, _Mypair._Myval2._Clamp_suffix_size(_Off, _Nx), _Right._Mypair._Myval2._Myptr() + _Roff, _Right._Mypair._Myval2._Clamp_suffix_size(_Roff, _Count)); } [[nodiscard]] constexpr int compare( const _Elem* const _Ptr) const noexcept { return _Traits_compare<_Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize, _Ptr, _Traits::length(_Ptr)); } [[nodiscard]] constexpr int compare( const size_type _Off, const size_type _Nx, const _Elem* const _Ptr) const { _Mypair._Myval2._Check_offset(_Off); return _Traits_compare<_Traits>(_Mypair._Myval2._Myptr() + _Off, _Mypair._Myval2._Clamp_suffix_size(_Off, _Nx), _Ptr, _Traits::length(_Ptr)); } [[nodiscard]] constexpr int compare(const size_type _Off, const size_type _Nx, const _Elem* const _Ptr, const size_type _Count) const { _Mypair._Myval2._Check_offset(_Off); return _Traits_compare<_Traits>( _Mypair._Myval2._Myptr() + _Off, _Mypair._Myval2._Clamp_suffix_size(_Off, _Nx), _Ptr, _Count); } [[nodiscard]] constexpr bool starts_with(const basic_string_view<_Elem, _Traits> _Right) const noexcept { return basic_string_view<_Elem, _Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize).starts_with(_Right); } [[nodiscard]] constexpr bool starts_with(const _Elem _Right) const noexcept { return basic_string_view<_Elem, _Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize).starts_with(_Right); } [[nodiscard]] constexpr bool starts_with(const _Elem* const _Right) const noexcept { return basic_string_view<_Elem, _Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize).starts_with(_Right); } [[nodiscard]] constexpr bool ends_with(const basic_string_view<_Elem, _Traits> _Right) const noexcept { return basic_string_view<_Elem, _Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize).ends_with(_Right); } [[nodiscard]] constexpr bool ends_with(const _Elem _Right) const noexcept { return basic_string_view<_Elem, _Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize).ends_with(_Right); } [[nodiscard]] constexpr bool ends_with(const _Elem* const _Right) const noexcept { return basic_string_view<_Elem, _Traits>(_Mypair._Myval2._Myptr(), _Mypair._Myval2._Mysize).ends_with(_Right); } [[nodiscard]] constexpr allocator_type get_allocator() const noexcept { return static_cast<allocator_type>(_Getal()); } private: [[nodiscard]] static constexpr size_type _Calculate_growth( const size_type _Requested, const size_type _Old, const size_type _Max) noexcept { const size_type _Masked = _Requested | _ALLOC_MASK; if (_Masked > _Max) { return _Max; } if (_Old > _Max - _Old / 2) { return _Max; } return (::std:: max)(_Masked, _Old + _Old / 2); } [[nodiscard]] constexpr size_type _Calculate_growth(const size_type _Requested) const noexcept { return _Calculate_growth(_Requested, _Mypair._Myval2._Myres, max_size()); } template <class _Fty, class... _ArgTys> constexpr basic_string& _Reallocate_for(const size_type _New_size, _Fty _Fn, _ArgTys... _Args) { if (_New_size > max_size()) { _Xlen_string(); } const size_type _Old_capacity = _Mypair._Myval2._Myres; const size_type _New_capacity = _Calculate_growth(_New_size); auto& _Al = _Getal(); const pointer _New_ptr = _Al.allocate(_New_capacity + 1); if (::std:: is_constant_evaluated()) { _Traits::assign(_Unfancy(_New_ptr), _New_capacity + 1, _Elem()); } _Mypair._Myval2._Orphan_all(); _Mypair._Myval2._Mysize = _New_size; _Mypair._Myval2._Myres = _New_capacity; _Fn(_Unfancy(_New_ptr), _New_size, _Args...); if (_BUF_SIZE <= _Old_capacity) { _Al.deallocate(_Mypair._Myval2._Bx._Ptr, _Old_capacity + 1); _Mypair._Myval2._Bx._Ptr = _New_ptr; } else { _Construct_in_place(_Mypair._Myval2._Bx._Ptr, _New_ptr); } return *this; } template <class _Fty, class... _ArgTys> constexpr basic_string& _Reallocate_grow_by( const size_type _Size_increase, _Fty _Fn, _ArgTys... _Args) { auto& _My_data = _Mypair._Myval2; const size_type _Old_size = _My_data._Mysize; if (max_size() - _Old_size < _Size_increase) { _Xlen_string(); } const size_type _New_size = _Old_size + _Size_increase; const size_type _Old_capacity = _My_data._Myres; const size_type _New_capacity = _Calculate_growth(_New_size); auto& _Al = _Getal(); const pointer _New_ptr = _Al.allocate(_New_capacity + 1); if (::std:: is_constant_evaluated()) { _Traits::assign(_Unfancy(_New_ptr), _New_capacity + 1, _Elem()); } _My_data._Orphan_all(); _My_data._Mysize = _New_size; _My_data._Myres = _New_capacity; _Elem* const _Raw_new = _Unfancy(_New_ptr); if (_BUF_SIZE <= _Old_capacity) { const pointer _Old_ptr = _My_data._Bx._Ptr; _Fn(_Raw_new, _Unfancy(_Old_ptr), _Old_size, _Args...); _Al.deallocate(_Old_ptr, _Old_capacity + 1); _My_data._Bx._Ptr = _New_ptr; } else { _Fn(_Raw_new, _My_data._Bx._Buf, _Old_size, _Args...); _Construct_in_place(_My_data._Bx._Ptr, _New_ptr); } return *this; } void _Become_small() { _Mypair._Myval2._Orphan_all(); const pointer _Ptr = _Mypair._Myval2._Bx._Ptr; auto& _Al = _Getal(); _Destroy_in_place(_Mypair._Myval2._Bx._Ptr); _Traits::copy(_Mypair._Myval2._Bx._Buf, _Unfancy(_Ptr), _Mypair._Myval2._Mysize + 1); _Al.deallocate(_Ptr, _Mypair._Myval2._Myres + 1); _Mypair._Myval2._Myres = _BUF_SIZE - 1; } constexpr void _Eos(const size_type _Newsize) { _Traits::assign(_Mypair._Myval2._Myptr()[_Mypair._Myval2._Mysize = _Newsize], _Elem()); } constexpr void _Tidy_init() noexcept { auto& _My_data = _Mypair._Myval2; _My_data._Mysize = 0; if (::std:: is_constant_evaluated()) { _My_data._Myres = _BUF_SIZE; auto& _Al = _Getal(); const pointer _New_ptr = _Al.allocate(_BUF_SIZE + 1); _My_data._Bx._Ptr = _New_ptr; _Elem* const _Raw_new = _Unfancy(_New_ptr); _Traits::assign(_Raw_new, _BUF_SIZE + 1, _Elem()); } else { _My_data._Myres = _BUF_SIZE - 1; _Traits::assign(_My_data._Bx._Buf[0], _Elem()); } } constexpr void _Tidy_deallocate() noexcept { _Mypair._Myval2._Orphan_all(); if (_Mypair._Myval2._Large_string_engaged()) { const pointer _Ptr = _Mypair._Myval2._Bx._Ptr; auto& _Al = _Getal(); _Destroy_in_place(_Mypair._Myval2._Bx._Ptr); _Al.deallocate(_Ptr, _Mypair._Myval2._Myres + 1); } if (::std:: is_constant_evaluated()) { _Mypair._Myval2._Bx._Ptr = nullptr; _Mypair._Myval2._Mysize = 0; _Mypair._Myval2._Myres = 0; } else { _Mypair._Myval2._Mysize = 0; _Mypair._Myval2._Myres = _BUF_SIZE - 1; _Traits::assign(_Mypair._Myval2._Bx._Buf[0], _Elem()); } } public: constexpr void _Orphan_all() noexcept { _Mypair._Myval2._Orphan_all(); } private: constexpr void _Swap_proxy_and_iterators(basic_string& _Right) { _Mypair._Myval2._Swap_proxy_and_iterators(_Right._Mypair._Myval2); } constexpr _Alty& _Getal() noexcept { return _Mypair._Get_first(); } constexpr const _Alty& _Getal() const noexcept { return _Mypair._Get_first(); } _Compressed_pair<_Alty, _Scary_val> _Mypair; }; template <class _Iter, class _Alloc = allocator<_Iter_value_t<_Iter>>, enable_if_t<conjunction_v<_Is_iterator<_Iter>, _Is_allocator<_Alloc>>, int> = 0> basic_string(_Iter, _Iter, _Alloc = _Alloc()) -> basic_string<_Iter_value_t<_Iter>, char_traits<_Iter_value_t<_Iter>>, _Alloc>; template <class _Elem, class _Traits, class _Alloc = allocator<_Elem>, enable_if_t<_Is_allocator<_Alloc>::value, int> = 0> explicit basic_string(basic_string_view<_Elem, _Traits>, const _Alloc& = _Alloc()) -> basic_string<_Elem, _Traits, _Alloc>; template <class _Elem, class _Traits, class _Alloc = allocator<_Elem>, enable_if_t<_Is_allocator<_Alloc>::value, int> = 0> basic_string(basic_string_view<_Elem, _Traits>, _Guide_size_type_t<_Alloc>, _Guide_size_type_t<_Alloc>, const _Alloc& = _Alloc()) -> basic_string<_Elem, _Traits, _Alloc>; template <class _Elem, class _Traits, class _Alloc> constexpr void swap(basic_string<_Elem, _Traits, _Alloc>& _Left, basic_string<_Elem, _Traits, _Alloc>& _Right) noexcept { _Left.swap(_Right); } template <class _Elem, class _Traits, class _Alloc> [[nodiscard]] constexpr basic_string<_Elem, _Traits, _Alloc> operator+( const basic_string<_Elem, _Traits, _Alloc>& _Left, const basic_string<_Elem, _Traits, _Alloc>& _Right) { const auto _Left_size = _Left.size(); const auto _Right_size = _Right.size(); if (_Left.max_size() - _Left_size < _Right_size) { _Xlen_string(); } return {_String_constructor_concat_tag{}, _Left, _Left.c_str(), _Left_size, _Right.c_str(), _Right_size}; } template <class _Elem, class _Traits, class _Alloc> [[nodiscard]] constexpr basic_string<_Elem, _Traits, _Alloc> operator+( const _Elem* const _Left, const basic_string<_Elem, _Traits, _Alloc>& _Right) { using _Size_type = typename basic_string<_Elem, _Traits, _Alloc>::size_type; const auto _Left_size = _Convert_size<_Size_type>(_Traits::length(_Left)); const auto _Right_size = _Right.size(); if (_Right.max_size() - _Right_size < _Left_size) { _Xlen_string(); } return {_String_constructor_concat_tag{}, _Right, _Left, _Left_size, _Right.c_str(), _Right_size}; } template <class _Elem, class _Traits, class _Alloc> [[nodiscard]] constexpr basic_string<_Elem, _Traits, _Alloc> operator+( const _Elem _Left, const basic_string<_Elem, _Traits, _Alloc>& _Right) { const auto _Right_size = _Right.size(); if (_Right_size == _Right.max_size()) { _Xlen_string(); } return {_String_constructor_concat_tag{}, _Right, ::std:: addressof(_Left), 1, _Right.c_str(), _Right_size}; } template <class _Elem, class _Traits, class _Alloc> [[nodiscard]] constexpr basic_string<_Elem, _Traits, _Alloc> operator+( const basic_string<_Elem, _Traits, _Alloc>& _Left, const _Elem* const _Right) { using _Size_type = typename basic_string<_Elem, _Traits, _Alloc>::size_type; const auto _Left_size = _Left.size(); const auto _Right_size = _Convert_size<_Size_type>(_Traits::length(_Right)); if (_Left.max_size() - _Left_size < _Right_size) { _Xlen_string(); } return {_String_constructor_concat_tag{}, _Left, _Left.c_str(), _Left_size, _Right, _Right_size}; } template <class _Elem, class _Traits, class _Alloc> [[nodiscard]] constexpr basic_string<_Elem, _Traits, _Alloc> operator+( const basic_string<_Elem, _Traits, _Alloc>& _Left, const _Elem _Right) { const auto _Left_size = _Left.size(); if (_Left_size == _Left.max_size()) { _Xlen_string(); } return {_String_constructor_concat_tag{}, _Left, _Left.c_str(), _Left_size, ::std:: addressof(_Right), 1}; } template <class _Elem, class _Traits, class _Alloc> [[nodiscard]] constexpr basic_string<_Elem, _Traits, _Alloc> operator+( const basic_string<_Elem, _Traits, _Alloc>& _Left, basic_string<_Elem, _Traits, _Alloc>&& _Right) { return ::std:: move(_Right.insert(0, _Left)); } template <class _Elem, class _Traits, class _Alloc> [[nodiscard]] constexpr basic_string<_Elem, _Traits, _Alloc> operator+( basic_string<_Elem, _Traits, _Alloc>&& _Left, const basic_string<_Elem, _Traits, _Alloc>& _Right) { return ::std:: move(_Left.append(_Right)); } template <class _Elem, class _Traits, class _Alloc> [[nodiscard]] constexpr basic_string<_Elem, _Traits, _Alloc> operator+( basic_string<_Elem, _Traits, _Alloc>&& _Left, basic_string<_Elem, _Traits, _Alloc>&& _Right) { do { if (::std:: addressof(_Left) != ::std:: addressof(_Right)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 4764, 0, "%s", "You cannot concatenate the same moved string to itself. See " "N4849 [res.on.arguments]/1.3: If a function argument binds to an rvalue reference " "parameter, the implementation may assume that this parameter is a unique reference " "to this argument")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"You cannot concatenate the same moved string to itself. See \" \"N4849 [res.on.arguments]/1.3: If a function argument binds to an rvalue reference \" \"parameter, the implementation may assume that this parameter is a unique reference \" \"to this argument\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xstring", 4764, 0); } while (false); } ; } while (false); return {_String_constructor_concat_tag{}, _Left, _Right}; } template <class _Elem, class _Traits, class _Alloc> [[nodiscard]] constexpr basic_string<_Elem, _Traits, _Alloc> operator+( const _Elem* const _Left, basic_string<_Elem, _Traits, _Alloc>&& _Right) { return ::std:: move(_Right.insert(0, _Left)); } template <class _Elem, class _Traits, class _Alloc> [[nodiscard]] constexpr basic_string<_Elem, _Traits, _Alloc> operator+( const _Elem _Left, basic_string<_Elem, _Traits, _Alloc>&& _Right) { return ::std:: move(_Right.insert(0, 1, _Left)); } template <class _Elem, class _Traits, class _Alloc> [[nodiscard]] constexpr basic_string<_Elem, _Traits, _Alloc> operator+( basic_string<_Elem, _Traits, _Alloc>&& _Left, const _Elem* const _Right) { return ::std:: move(_Left.append(_Right)); } template <class _Elem, class _Traits, class _Alloc> [[nodiscard]] constexpr basic_string<_Elem, _Traits, _Alloc> operator+( basic_string<_Elem, _Traits, _Alloc>&& _Left, const _Elem _Right) { _Left.push_back(_Right); return ::std:: move(_Left); } template <class _Elem, class _Traits, class _Alloc> [[nodiscard]] constexpr bool operator==( const basic_string<_Elem, _Traits, _Alloc>& _Left, const basic_string<_Elem, _Traits, _Alloc>& _Right) noexcept { return _Left._Equal(_Right); } template <class _Elem, class _Traits, class _Alloc> [[nodiscard]] constexpr bool operator==( const basic_string<_Elem, _Traits, _Alloc>& _Left, const _Elem* const _Right) { return _Left._Equal(_Right); } template <class _Elem, class _Traits, class _Alloc> [[nodiscard]] constexpr _Get_comparison_category_t<_Traits> operator<=>( const basic_string<_Elem, _Traits, _Alloc>& _Left, const basic_string<_Elem, _Traits, _Alloc>& _Right) noexcept { return static_cast<_Get_comparison_category_t<_Traits>>(_Left.compare(_Right) <=> 0); } template <class _Elem, class _Traits, class _Alloc> [[nodiscard]] constexpr _Get_comparison_category_t<_Traits> operator<=>( const basic_string<_Elem, _Traits, _Alloc>& _Left, const _Elem* const _Right) { return static_cast<_Get_comparison_category_t<_Traits>>(_Left.compare(_Right) <=> 0); } using string = basic_string<char, char_traits<char>, allocator<char>>; using wstring = basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t>>; using u8string = basic_string<char8_t, char_traits<char8_t>, allocator<char8_t>>; using u16string = basic_string<char16_t, char_traits<char16_t>, allocator<char16_t>>; using u32string = basic_string<char32_t, char_traits<char32_t>, allocator<char32_t>>; template <class _Elem, class _Traits, class _Alloc> struct hash<basic_string<_Elem, _Traits, _Alloc>> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef basic_string<_Elem, _Traits, _Alloc> _Unnameable_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef size_t _Unnameable_result; [[nodiscard]] size_t operator()(const basic_string<_Elem, _Traits, _Alloc>& _Keyval) const noexcept { return _Hash_array_representation(_Keyval.c_str(), _Keyval.size()); } }; template <class _Elem, class _Traits, class _Alloc> basic_istream<_Elem, _Traits>& operator>>( basic_istream<_Elem, _Traits>&& _Istr, basic_string<_Elem, _Traits, _Alloc>& _Str) { using _Myis = basic_istream<_Elem, _Traits>; using _Ctype = typename _Myis::_Ctype; using _Mystr = basic_string<_Elem, _Traits, _Alloc>; using _Mysizt = typename _Mystr::size_type; typename _Myis::iostate _State = _Myis::goodbit; bool _Changed = false; const typename _Myis::sentry _Ok(_Istr); if (_Ok) { const _Ctype& _Ctype_fac = ::std:: use_facet<_Ctype>(_Istr.getloc()); _Str.erase(); try { _Mysizt _Size; if (0 < _Istr.width() && static_cast<_Mysizt>(_Istr.width()) < _Str.max_size()) { _Size = static_cast<_Mysizt>(_Istr.width()); } else { _Size = _Str.max_size(); } typename _Traits::int_type _Meta = _Istr.rdbuf()->sgetc(); for (; 0 < _Size; --_Size, _Meta = _Istr.rdbuf()->snextc()) { if (_Traits::eq_int_type(_Traits::eof(), _Meta)) { _State |= _Myis::eofbit; break; } else if (_Ctype_fac.is(_Ctype::space, _Traits::to_char_type(_Meta))) { break; } else { _Str.push_back(_Traits::to_char_type(_Meta)); _Changed = true; } } } catch (...) { (_Istr) .setstate(_Myis::badbit, true); } } _Istr.width(0); if (!_Changed) { _State |= _Myis::failbit; } _Istr.setstate(_State); return _Istr; } template <class _Elem, class _Traits, class _Alloc> basic_istream<_Elem, _Traits>& operator>>( basic_istream<_Elem, _Traits>& _Istr, basic_string<_Elem, _Traits, _Alloc>& _Str) { return ::std:: move(_Istr) >> _Str; } template <class _Elem, class _Traits, class _Alloc> basic_ostream<_Elem, _Traits>& operator<<( basic_ostream<_Elem, _Traits>& _Ostr, const basic_string<_Elem, _Traits, _Alloc>& _Str) { return _Insert_string(_Ostr, _Str.data(), _Str.size()); } inline namespace literals { inline namespace string_literals { [[nodiscard]] constexpr string operator"" s(const char* _Str, size_t _Len) { return string(_Str, _Len); } [[nodiscard]] constexpr wstring operator"" s(const wchar_t* _Str, size_t _Len) { return wstring(_Str, _Len); } [[nodiscard]] constexpr basic_string<char8_t> operator"" s(const char8_t* _Str, size_t _Len) { return basic_string<char8_t>(_Str, _Len); } [[nodiscard]] constexpr u16string operator"" s(const char16_t* _Str, size_t _Len) { return u16string(_Str, _Len); } [[nodiscard]] constexpr u32string operator"" s(const char32_t* _Str, size_t _Len) { return u32string(_Str, _Len); } } } template <class _Elem, class _Traits, class _Alloc, class _Uty> constexpr typename basic_string<_Elem, _Traits, _Alloc>::size_type erase( basic_string<_Elem, _Traits, _Alloc>& _Cont, const _Uty& _Val) { return _Erase_remove(_Cont, _Val); } template <class _Elem, class _Traits, class _Alloc, class _Pr> constexpr typename basic_string<_Elem, _Traits, _Alloc>::size_type erase_if( basic_string<_Elem, _Traits, _Alloc>& _Cont, _Pr _Pred) { return _Erase_remove_if(_Cont, _Pass_fn(_Pred)); } namespace pmr { template <class _Elem, class _Traits = char_traits<_Elem>> using basic_string = ::std:: basic_string<_Elem, _Traits, polymorphic_allocator<_Elem>>; using string = basic_string<char>; using u8string = basic_string<char8_t>; using u16string = basic_string<char16_t>; using u32string = basic_string<char32_t>; using wstring = basic_string<wchar_t>; } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { template <class _Iterator, class _NodeType> struct _Insert_return_type { _Iterator position; bool inserted; _NodeType node; }; template <class _Derived_type, class _KeyTy, class _ValueTy> struct _Node_handle_map_base { using key_type = _KeyTy; using mapped_type = _ValueTy; key_type& key() const noexcept { return _Datum().first; } mapped_type& mapped() const noexcept { return _Datum().second; } private: using _Pair_type = pair<key_type, mapped_type>; _Pair_type& _Datum() const { const auto& _Self = static_cast<const _Derived_type&>(*this); auto& _Data = _Self._Getptr()->_Myval; return reinterpret_cast<_Pair_type&>(_Data); } }; template <class _Derived_type, class _ValueTy> struct _Node_handle_set_base { using value_type = _ValueTy; value_type& value() const noexcept { const auto& _Self = static_cast<const _Derived_type&>(*this); return _Self._Getptr()->_Myval; } }; template <class _Node, class _Alloc, template <class...> class _Base, class... _Types> class _Node_handle : public _Base<_Node_handle<_Node, _Alloc, _Base, _Types...>, _Types...> { public: using allocator_type = _Alloc; private: using _Alty_traits = allocator_traits<_Alloc>; using _Alnode = _Rebind_alloc_t<_Alloc, _Node>; using _Alnode_traits = allocator_traits<_Alnode>; using _Nodeptr = typename _Alnode_traits::pointer; _Nodeptr _Ptr{}; aligned_union_t<0, _Alloc> _Alloc_storage; void _Clear() noexcept { if (_Ptr != nullptr) { _Alloc& _Al = _Getal(); _Alty_traits::destroy(_Al, ::std:: addressof(_Ptr->_Myval)); _Alnode _Node_alloc{_Al}; _Node::_Freenode0(_Node_alloc, _Ptr); _Destroy_in_place(_Al); _Ptr = nullptr; } } _Node_handle(const _Nodeptr _Ptr_, const _Alloc& _Al) noexcept : _Ptr{_Ptr_} { ; _Construct_in_place(_Getal(), _Al); } public: constexpr _Node_handle() noexcept : _Alloc_storage{} {} ~_Node_handle() noexcept { _Clear(); } _Node_handle(_Node_handle&& _That) noexcept : _Ptr{_That._Ptr} { if (_Ptr != nullptr) { _That._Ptr = nullptr; _Alloc& _That_al = _That._Getal(); _Construct_in_place(_Getal(), ::std:: move(_That_al)); _Destroy_in_place(_That_al); } } _Node_handle& operator=(_Node_handle&& _That) noexcept { if (_Ptr == nullptr) { if (_That._Ptr != nullptr) { _Alloc& _That_al = _That._Getal(); _Construct_in_place(_Getal(), ::std:: move(_That_al)); _Destroy_in_place(_That_al); _Ptr = ::std:: exchange(_That._Ptr, nullptr); } return *this; } if (_That._Ptr == nullptr || this == ::std:: addressof(_That)) { _Clear(); return *this; } _Alloc& _Al = _Getal(); _Alty_traits::destroy(_Al, ::std:: addressof(_Ptr->_Myval)); _Alnode _Node_alloc{_Al}; _Alnode_traits::deallocate(_Node_alloc, _Ptr, 1); _Alloc& _That_al = _That._Getal(); _Pocma(_Al, _That_al); _Destroy_in_place(_That_al); _Ptr = ::std:: exchange(_That._Ptr, nullptr); return *this; } _Nodeptr _Getptr() const noexcept { return _Ptr; } _Alloc& _Getal() noexcept { return reinterpret_cast<_Alloc&>(_Alloc_storage); } const _Alloc& _Getal() const noexcept { ; return reinterpret_cast<const _Alloc&>(_Alloc_storage); } [[nodiscard]] allocator_type get_allocator() const noexcept { ; return _Getal(); } explicit operator bool() const noexcept { return _Ptr != nullptr; } [[nodiscard]] bool empty() const noexcept { return _Ptr == nullptr; } _Nodeptr _Release() noexcept { ; _Destroy_in_place(_Getal()); return ::std:: exchange(_Ptr, nullptr); } void swap(_Node_handle& _That) noexcept { if (_Ptr != nullptr) { if (_That._Ptr != nullptr) { _Pocs(_Getal(), _That._Getal()); } else { _Alloc& _Al = _Getal(); _Construct_in_place(_That._Getal(), ::std:: move(_Al)); _Destroy_in_place(_Al); } } else { if (_That._Ptr == nullptr) { return; } _Alloc& _That_al = _That._Getal(); _Construct_in_place(_Getal(), ::std:: move(_That_al)); _Destroy_in_place(_That_al); } _Swap_adl(_Ptr, _That._Ptr); } friend void swap(_Node_handle& _Left, _Node_handle& _Right) noexcept { _Left.swap(_Right); } static _Node_handle _Make(const _Nodeptr _Ptr, const allocator_type& _Al) { ; return _Node_handle{_Ptr, _Al}; } }; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace stdext { using ::std:: basic_string; using ::std:: less; using ::std:: size_t; template <class _Kty> [[nodiscard]] size_t hash_value(const _Kty& _Keyval) noexcept { if constexpr (::std:: is_pointer_v<_Kty> || ::std:: is_null_pointer_v<_Kty>) { return reinterpret_cast<size_t>(_Keyval) ^ 0xdeadbeefu; } else { return static_cast<size_t>(_Keyval) ^ 0xdeadbeefu; } } template <class _Elem, class _Traits, class _Alloc> [[nodiscard]] size_t hash_value(const basic_string<_Elem, _Traits, _Alloc>& _Str) noexcept { return ::std:: _Hash_array_representation(_Str.c_str(), _Str.size()); } [[nodiscard]] inline size_t hash_value( const char* _Str) noexcept { return ::std:: _Hash_array_representation(_Str, :: strlen(_Str)); } [[nodiscard]] inline size_t hash_value( const wchar_t* _Str) noexcept { return ::std:: _Hash_array_representation(_Str, :: wcslen(_Str)); } template <class _Kty, class _Pr = less<_Kty>> class hash_compare { public: enum { bucket_size = 1 }; hash_compare() = default; hash_compare(const _Pr& _Pred) noexcept(::std:: is_nothrow_copy_constructible_v<_Pr>) : comp(_Pred) {} [[nodiscard]] size_t operator()(const _Kty& _Keyval) const noexcept(noexcept(hash_value(_Keyval))) { long _Quot = static_cast<long>(hash_value(_Keyval) & 2147483647L); ldiv_t _Qrem = :: ldiv(_Quot, 127773); _Qrem.rem = 16807 * _Qrem.rem - 2836 * _Qrem.quot; if (_Qrem.rem < 0) { _Qrem.rem += 2147483647L; } return static_cast<size_t>(_Qrem.rem); } [[nodiscard]] bool operator()(const _Kty& _Keyval1, const _Kty& _Keyval2) const noexcept(noexcept(comp(_Keyval1, _Keyval2))) { return comp(_Keyval1, _Keyval2); } _Pr comp{}; }; } namespace std { using stdext::hash_compare; template <class _Kty, class _Hasher, class _Keyeq, class = void> struct _Uhash_choose_transparency { template <class> using _Deduce_key = const _Kty&; }; template <class _Kty, class _Hasher, class _Keyeq> struct _Uhash_choose_transparency<_Kty, _Hasher, _Keyeq, void_t<typename _Hasher::is_transparent, typename _Keyeq::is_transparent>> { template <class _Keyty> using _Deduce_key = const _Keyty&; }; template <class _Hasher, class _Kty> inline constexpr bool _Nothrow_hash = noexcept( static_cast<size_t>(::std:: declval<const _Hasher&>()(::std:: declval<const _Kty&>()))); template <class _Kty, class _Hasher, class _Keyeq> class _Uhash_compare : public _Uhash_choose_transparency<_Kty, _Hasher, _Keyeq> { public: enum { bucket_size = 1 }; _Uhash_compare() noexcept( conjunction_v<is_nothrow_default_constructible<_Hasher>, is_nothrow_default_constructible<_Keyeq>>) : _Mypair(_Zero_then_variadic_args_t{}, _Zero_then_variadic_args_t{}, 0.0f) {} explicit _Uhash_compare(const _Hasher& _Hasharg) noexcept( conjunction_v<is_nothrow_copy_constructible<_Hasher>, is_nothrow_default_constructible<_Keyeq>>) : _Mypair(_One_then_variadic_args_t{}, _Hasharg, _Zero_then_variadic_args_t{}, 0.0f) {} explicit _Uhash_compare(const _Hasher& _Hasharg, const _Keyeq& _Keyeqarg) noexcept( conjunction_v<is_nothrow_copy_constructible<_Hasher>, is_nothrow_copy_constructible<_Keyeq>>) : _Mypair(_One_then_variadic_args_t{}, _Hasharg, _One_then_variadic_args_t{}, _Keyeqarg, 0.0f) {} template <class _Keyty> [[nodiscard]] size_t operator()(const _Keyty& _Keyval) const noexcept(_Nothrow_hash<_Hasher, _Keyty>) { return static_cast<size_t>(_Mypair._Get_first()(_Keyval)); } template <class _Keyty1, class _Keyty2> [[nodiscard]] bool operator()(const _Keyty1& _Keyval1, const _Keyty2& _Keyval2) const noexcept(_Nothrow_compare<_Keyeq, _Keyty1, _Keyty2>) { return !static_cast<bool>(_Mypair._Myval2._Get_first()(_Keyval1, _Keyval2)); } [[nodiscard]] float& _Get_max_bucket_size() noexcept { return _Mypair._Myval2._Myval2; } [[nodiscard]] const float& _Get_max_bucket_size() const noexcept { return _Mypair._Myval2._Myval2; } void swap(_Uhash_compare& _Rhs) noexcept( conjunction_v<_Is_nothrow_swappable<_Hasher>, _Is_nothrow_swappable<_Keyeq>>) { _Swap_adl(_Mypair._Get_first(), _Rhs._Mypair._Get_first()); auto& _Lsecond = _Mypair._Myval2; auto& _Rsecond = _Rhs._Mypair._Myval2; _Swap_adl(_Lsecond._Get_first(), _Rsecond._Get_first()); ::std:: swap(_Lsecond._Myval2, _Rsecond._Myval2); } _Compressed_pair<_Hasher, _Compressed_pair<_Keyeq, float>> _Mypair; }; template <class _Iter, class _Val> struct _Reinterpret_move_iter { _Iter _Base; using iterator_category = input_iterator_tag; using value_type = typename iterator_traits<_Iter>::value_type; using difference_type = typename iterator_traits<_Iter>::difference_type; using reference = _Val&&; reference operator*() const { return static_cast<reference>(reinterpret_cast<_Val&>(*_Base)); } _Reinterpret_move_iter& operator++() { ++_Base; return *this; } [[nodiscard]] friend bool operator==(const _Reinterpret_move_iter& _Lhs, const _Reinterpret_move_iter& _Rhs) { return _Lhs._Base == _Rhs._Base; } }; template <class _Alnode> struct _List_head_construct_ptr { using value_type = typename _Alnode::value_type; static_assert(_Is_specialization_v<value_type, _List_node>, "_List_head_construct_ptr allocator not rebound"); using _Alnode_traits = allocator_traits<_Alnode>; using pointer = typename _Alnode_traits::pointer; _Alnode& _Al; pointer _Newhead; explicit _List_head_construct_ptr(_Alnode& _Al_) : _Al(_Al_), _Newhead(value_type::_Buyheadnode(_Al)) {} template <class _Val_types> _List_head_construct_ptr(_Alnode& _Al_, _List_val<_Val_types>& _Mycont) : _Al(_Al_), _Newhead(value_type::_Buyheadnode(_Al)) { _Mycont._Myhead = _Newhead; } _List_head_construct_ptr(const _List_head_construct_ptr&) = delete; _List_head_construct_ptr& operator=(const _List_head_construct_ptr&) = delete; [[nodiscard]] pointer _Release() noexcept { return ::std:: exchange(_Newhead, nullptr); } ~_List_head_construct_ptr() { if (_Newhead) { value_type::_Freenode0(_Al, _Newhead); } } }; template <class _Nodeptr> struct _Hash_find_last_result { _Nodeptr _Insert_before; _Nodeptr _Duplicate; }; template <class _Aliter> struct _Hash_vec { using _Aliter_traits = allocator_traits<_Aliter>; using value_type = typename _Aliter::value_type; using size_type = typename _Aliter_traits::size_type; using difference_type = typename _Aliter_traits::difference_type; using pointer = typename _Aliter_traits::pointer; using _Aliter_scary_val = _Vector_val<conditional_t<_Is_simple_alloc_v<_Aliter>, _Simple_types<value_type>, _Vec_iter_types<value_type, size_type, difference_type, pointer, typename _Aliter_traits::const_pointer, value_type&, const value_type&>>>; _Hash_vec() : _Mypair(_Zero_then_variadic_args_t{}) { _Mypair._Myval2._Alloc_proxy(static_cast<_Rebind_alloc_t<_Aliter, _Container_proxy>>(_Mypair._Get_first())); } template <class _Any_alloc, enable_if_t<!is_same_v<_Remove_cvref_t<_Any_alloc>, _Hash_vec>, int> = 0> explicit _Hash_vec(_Any_alloc&& _Al) noexcept : _Mypair(_One_then_variadic_args_t{}, ::std:: forward<_Any_alloc>(_Al)) { _Mypair._Myval2._Alloc_proxy(static_cast<_Rebind_alloc_t<_Aliter, _Container_proxy>>(_Mypair._Get_first())); } _Hash_vec(const _Hash_vec&) = delete; _Hash_vec& operator=(const _Hash_vec&) = delete; [[nodiscard]] size_type size() const noexcept { return static_cast<size_type>(_Mypair._Myval2._Mylast - _Mypair._Myval2._Myfirst); } [[nodiscard]] size_type max_size() const noexcept { return (::std:: min)(static_cast<size_type>((numeric_limits<difference_type>::max)()), _Aliter_traits::max_size(_Mypair._Get_first())); } void _Assign_grow(const size_type _Cells, const value_type _Val) { const auto _Oldsize = size(); ; auto& _Alvec = _Mypair._Get_first(); if (_Oldsize < _Cells) { const auto _Newvec = _Alvec.allocate(_Cells); if (_Oldsize != 0) { _Destroy_range(_Mypair._Myval2._Myfirst, _Mypair._Myval2._Mylast); _Alvec.deallocate(_Mypair._Myval2._Myfirst, _Oldsize); } _Mypair._Myval2._Myfirst = _Newvec; const auto _Newend = _Newvec + _Cells; _Mypair._Myval2._Mylast = _Newend; _Mypair._Myval2._Myend = _Newend; ::std:: uninitialized_fill(_Newvec, _Newend, _Val); } else { ::std:: fill(_Mypair._Myval2._Myfirst, _Mypair._Myval2._Mylast, _Val); } } void _Tidy() noexcept { _Destroy_range(_Mypair._Myval2._Myfirst, _Mypair._Myval2._Mylast); _Mypair._Get_first().deallocate(_Mypair._Myval2._Myfirst, size()); _Mypair._Myval2._Myfirst = nullptr; _Mypair._Myval2._Mylast = nullptr; _Mypair._Myval2._Myend = nullptr; } ~_Hash_vec() { _Tidy(); auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Aliter, _Container_proxy>>(_Mypair._Get_first()); _Delete_plain_internal(_Alproxy, ::std:: exchange(_Mypair._Myval2._Myproxy, nullptr)); } _Compressed_pair<_Aliter, _Aliter_scary_val> _Mypair; }; template <class _Traits> class _Hash { protected: using _Mylist = list<typename _Traits::value_type, typename _Traits::allocator_type>; using _Alnode = typename _Mylist::_Alnode; using _Alnode_traits = typename _Mylist::_Alnode_traits; using _Node = typename _Mylist::_Node; using _Nodeptr = typename _Mylist::_Nodeptr; using _Mutable_value_type = typename _Traits::_Mutable_value_type; using _Key_compare = typename _Traits::key_compare; using _Value_compare = typename _Traits::value_compare; public: using key_type = typename _Traits::key_type; using value_type = typename _Mylist::value_type; using allocator_type = typename _Mylist::allocator_type; using size_type = typename _Mylist::size_type; using difference_type = typename _Mylist::difference_type; using pointer = typename _Mylist::pointer; using const_pointer = typename _Mylist::const_pointer; using reference = value_type&; using const_reference = const value_type&; using iterator = conditional_t<is_same_v<key_type, value_type>, typename _Mylist::const_iterator, typename _Mylist::iterator>; using const_iterator = typename _Mylist::const_iterator; using _Unchecked_iterator = conditional_t<is_same_v<key_type, value_type>, typename _Mylist::_Unchecked_const_iterator, typename _Mylist::_Unchecked_iterator>; using _Unchecked_const_iterator = typename _Mylist::_Unchecked_const_iterator; using _Aliter = _Rebind_alloc_t<_Alnode, _Unchecked_iterator>; static constexpr size_type _Bucket_size = _Key_compare::bucket_size; static constexpr size_type _Min_buckets = 8; static constexpr bool _Multi = _Traits::_Multi; template <class _TraitsT> friend bool _Hash_equal(const _Hash<_TraitsT>& _Left, const _Hash<_TraitsT>& _Right); protected: _Hash(const _Key_compare& _Parg, const allocator_type& _Al) : _Traitsobj(_Parg), _List(_Al), _Vec(_Al), _Mask(_Min_buckets - 1), _Maxidx(_Min_buckets) { _Max_bucket_size() = _Bucket_size; _Vec._Assign_grow(_Min_buckets * 2, _List._Unchecked_end()); } template <class _Any_alloc> _Hash(const _Hash& _Right, const _Any_alloc& _Al) : _Traitsobj(_Right._Traitsobj), _List(static_cast<allocator_type>(_Al)), _Vec(_Al), _Mask(_Right._Mask), _Maxidx(_Right._Maxidx) { _Vec._Assign_grow(_Right._Vec.size(), _List._Unchecked_end()); insert(_Right._Unchecked_begin(), _Right._Unchecked_end()); } _Hash(_Hash&& _Right) : _Traitsobj(_Right._Traitsobj), _List(_Move_allocator_tag{}, _Right._List._Getal()), _Vec(::std:: move(_Right._Vec._Mypair._Get_first())) { _Vec._Assign_grow(_Min_buckets * 2, _Unchecked_end()); _List._Swap_val(_Right._List); _Vec._Mypair._Myval2._Swap_val(_Right._Vec._Mypair._Myval2); _Mask = ::std:: exchange(_Right._Mask, _Min_buckets - 1); _Maxidx = ::std:: exchange(_Right._Maxidx, _Min_buckets); } private: void _Move_construct_equal_alloc(_Hash& _Right) { _Vec._Assign_grow(_Min_buckets * 2, _Unchecked_end()); _List._Swap_val(_Right._List); _Vec._Mypair._Myval2._Swap_val(_Right._Vec._Mypair._Myval2); _Mask = ::std:: exchange(_Right._Mask, _Min_buckets - 1); _Maxidx = ::std:: exchange(_Right._Maxidx, _Min_buckets); } public: _Hash(_Hash&& _Right, const allocator_type& _Al) : _Traitsobj(_Right._Traitsobj), _List(_Al), _Vec(_Al) { if constexpr (_Alnode_traits::is_always_equal::value) { _Move_construct_equal_alloc(_Right); } else if (_List._Getal() == _Right._List._Getal()) { _Move_construct_equal_alloc(_Right); } else { _Maxidx = _Min_buckets; const auto _Myhead = _List._Mypair._Myval2._Myhead; for (auto& _Val : _Right._List) { _List._Emplace(_Myhead, reinterpret_cast<_Mutable_value_type&&>(_Val)); } _Reinsert_with_invalid_vec(); _Right.clear(); } } private: void _Swap_val(_Hash& _Right) noexcept { _List._Swap_val(_Right._List); _Vec._Mypair._Myval2._Swap_val(_Right._Vec._Mypair._Myval2); ::std:: swap(_Mask, _Right._Mask); ::std:: swap(_Maxidx, _Right._Maxidx); } struct _Min_buckets_construct_ptr { using pointer = typename allocator_traits<_Aliter>::pointer; _Aliter& _Al; pointer _Base; _Min_buckets_construct_ptr(_Aliter& _Al_) : _Al(_Al_), _Base(_Al.allocate(_Min_buckets * 2)) {} _Min_buckets_construct_ptr(const _Min_buckets_construct_ptr&) = delete; [[nodiscard]] pointer _Release(_Unchecked_iterator _Newend) noexcept { ::std:: uninitialized_fill(_Base, _Base + _Min_buckets * 2, _Newend); return ::std:: exchange(_Base, nullptr); } ~_Min_buckets_construct_ptr() { if (_Base) { _Al.deallocate(_Base, _Min_buckets * 2); } } }; void _Pocma_both(_Hash& _Right) { _Pocma(_List._Getal(), _Right._List._Getal()); _Pocma(_Vec._Mypair._Get_first(), _Right._Vec._Mypair._Get_first()); } struct [[nodiscard]] _Clear_guard { _Hash* _Target; explicit _Clear_guard(_Hash* const _Target_) : _Target(_Target_) {} _Clear_guard(const _Clear_guard&) = delete; _Clear_guard& operator=(const _Clear_guard&) = delete; ~_Clear_guard() { if (_Target) { _Target->clear(); } } }; void _Move_assign(_Hash& _Right, _Equal_allocators) { clear(); _Traitsobj = _Right._Traitsobj; _Pocma_both(_Right); _Swap_val(_Right); } void _Move_assign(_Hash& _Right, _Propagate_allocators) { if (_Getal() == _Right._Getal()) { _Move_assign(_Right, _Equal_allocators{}); } else { auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alnode, _Container_proxy>>(_Getal()); auto&& _Right_alproxy = static_cast<_Rebind_alloc_t<_Alnode, _Container_proxy>>(_Right._Getal()); _Container_proxy_ptr<_Alnode> _List_proxy(_Right_alproxy, _Leave_proxy_unbound{}); _Container_proxy_ptr<_Alnode> _Vec_proxy(_Right_alproxy, _Leave_proxy_unbound{}); _List_head_construct_ptr<_Alnode> _Newhead(_Right._Getal()); _Min_buckets_construct_ptr _Buckets(_Right._Vec._Mypair._Get_first()); _Traitsobj = _Right._Traitsobj; _List._Tidy(); _Vec._Tidy(); _Pocma_both(_Right); auto& _List_data = _List._Mypair._Myval2; auto& _Right_list_data = _Right._List._Mypair._Myval2; _List_data._Myhead = ::std:: exchange(_Right_list_data._Myhead, _Newhead._Release()); _List_data._Mysize = ::std:: exchange(_Right_list_data._Mysize, size_type{0}); _List_proxy._Bind(_Alproxy, ::std:: addressof(_List_data)); _List_data._Swap_proxy_and_iterators(_Right_list_data); auto& _Vec_data = _Vec._Mypair._Myval2; auto& _Right_vec_data = _Right._Vec._Mypair._Myval2; const auto _Newfirst = _Buckets._Release(_Right._Unchecked_end()); const auto _Newlast = _Newfirst + _Min_buckets * 2; _Vec_data._Myfirst = ::std:: exchange(_Right_vec_data._Myfirst, _Newfirst); _Vec_data._Mylast = ::std:: exchange(_Right_vec_data._Mylast, _Newlast); _Vec_data._Myend = ::std:: exchange(_Right_vec_data._Myend, _Newlast); _Vec_proxy._Bind(_Alproxy, ::std:: addressof(_Vec_data)); _Vec_data._Swap_proxy_and_iterators(_Right_vec_data); _Mask = ::std:: exchange(_Right._Mask, _Min_buckets - 1); _Maxidx = ::std:: exchange(_Right._Maxidx, _Min_buckets); } } void _Move_assign(_Hash& _Right, _No_propagate_allocators) { if (_Getal() == _Right._Getal()) { _Move_assign(_Right, _Equal_allocators{}); return; } _Clear_guard _Guard{this}; _Traitsobj = _Right._Traitsobj; using _Adapter = _Reinterpret_move_iter<typename _Mylist::_Unchecked_iterator, _Mutable_value_type>; _List.template _Assign_cast<_Mutable_value_type&>( _Adapter{_Right._List._Unchecked_begin()}, _Adapter{_Right._List._Unchecked_end()}); _Reinsert_with_invalid_vec(); _Guard._Target = nullptr; } public: _Hash& operator=(_Hash&& _Right) { if (this != ::std:: addressof(_Right)) { _Move_assign(_Right, _Choose_pocma<_Alnode>{}); } return *this; } template <class... _Valtys> conditional_t<_Multi, iterator, pair<iterator, bool>> emplace(_Valtys&&... _Vals) { using _In_place_key_extractor = typename _Traits::template _In_place_key_extractor<_Remove_cvref_t<_Valtys>...>; if constexpr (_Multi) { _Check_max_size(); _List_node_emplace_op2<_Alnode> _Newnode(_List._Getal(), ::std:: forward<_Valtys>(_Vals)...); const auto& _Keyval = _Traits::_Kfn(_Newnode._Ptr->_Myval); const auto _Hashval = _Traitsobj(_Keyval); if (_Check_rehash_required_1()) { _Rehash_for_1(); } const auto _Target = _Find_last(_Keyval, _Hashval); return _List._Make_iter(_Insert_new_node_before(_Hashval, _Target._Insert_before, _Newnode._Release())); } else if constexpr (_In_place_key_extractor::_Extractable) { const auto& _Keyval = _In_place_key_extractor::_Extract(_Vals...); const auto _Hashval = _Traitsobj(_Keyval); auto _Target = _Find_last(_Keyval, _Hashval); if (_Target._Duplicate) { return {_List._Make_iter(_Target._Duplicate), false}; } _Check_max_size(); _List_node_emplace_op2<_Alnode> _Newnode(_List._Getal(), ::std:: forward<_Valtys>(_Vals)...); if (_Check_rehash_required_1()) { _Rehash_for_1(); _Target = _Find_last(_Traits::_Kfn(_Newnode._Ptr->_Myval), _Hashval); } return { _List._Make_iter(_Insert_new_node_before(_Hashval, _Target._Insert_before, _Newnode._Release())), true}; } else { _List_node_emplace_op2<_Alnode> _Newnode(_List._Getal(), ::std:: forward<_Valtys>(_Vals)...); const auto& _Keyval = _Traits::_Kfn(_Newnode._Ptr->_Myval); const auto _Hashval = _Traitsobj(_Keyval); auto _Target = _Find_last(_Keyval, _Hashval); if (_Target._Duplicate) { return {_List._Make_iter(_Target._Duplicate), false}; } _Check_max_size(); if (_Check_rehash_required_1()) { _Rehash_for_1(); _Target = _Find_last(_Traits::_Kfn(_Newnode._Ptr->_Myval), _Hashval); } return { _List._Make_iter(_Insert_new_node_before(_Hashval, _Target._Insert_before, _Newnode._Release())), true}; } } template <class... _Valtys> iterator emplace_hint(const_iterator _Hint, _Valtys&&... _Vals) { using _In_place_key_extractor = typename _Traits::template _In_place_key_extractor<_Remove_cvref_t<_Valtys>...>; if constexpr (_Multi) { _Check_max_size(); _List_node_emplace_op2<_Alnode> _Newnode(_List._Getal(), ::std:: forward<_Valtys>(_Vals)...); const auto& _Keyval = _Traits::_Kfn(_Newnode._Ptr->_Myval); const auto _Hashval = _Traitsobj(_Keyval); if (_Check_rehash_required_1()) { _Rehash_for_1(); } const auto _Target = _Find_hint(_Hint._Ptr, _Keyval, _Hashval); return _List._Make_iter(_Insert_new_node_before(_Hashval, _Target._Insert_before, _Newnode._Release())); } else if constexpr (_In_place_key_extractor::_Extractable) { const auto& _Keyval = _In_place_key_extractor::_Extract(_Vals...); const auto _Hashval = _Traitsobj(_Keyval); auto _Target = _Find_hint(_Hint._Ptr, _Keyval, _Hashval); if (_Target._Duplicate) { return _List._Make_iter(_Target._Duplicate); } _Check_max_size(); _List_node_emplace_op2<_Alnode> _Newnode(_List._Getal(), ::std:: forward<_Valtys>(_Vals)...); if (_Check_rehash_required_1()) { _Rehash_for_1(); _Target = _Find_hint(_Hint._Ptr, _Traits::_Kfn(_Newnode._Ptr->_Myval), _Hashval); } return _List._Make_iter(_Insert_new_node_before(_Hashval, _Target._Insert_before, _Newnode._Release())); } else { _List_node_emplace_op2<_Alnode> _Newnode(_List._Getal(), ::std:: forward<_Valtys>(_Vals)...); const auto& _Keyval = _Traits::_Kfn(_Newnode._Ptr->_Myval); const auto _Hashval = _Traitsobj(_Keyval); auto _Target = _Find_hint(_Hint._Ptr, _Keyval, _Hashval); if (_Target._Duplicate) { return _List._Make_iter(_Target._Duplicate); } _Check_max_size(); if (_Check_rehash_required_1()) { _Rehash_for_1(); _Target = _Find_hint(_Hint._Ptr, _Traits::_Kfn(_Newnode._Ptr->_Myval), _Hashval); } return _List._Make_iter(_Insert_new_node_before(_Hashval, _Target._Insert_before, _Newnode._Release())); } } protected: template <class _Keyty, class... _Mappedty> pair<_Nodeptr, bool> _Try_emplace(_Keyty&& _Keyval_arg, _Mappedty&&... _Mapval) { const auto& _Keyval = _Keyval_arg; const auto _Hashval = _Traitsobj(_Keyval); auto _Target = _Find_last(_Keyval, _Hashval); if (_Target._Duplicate) { return {_Target._Duplicate, false}; } _Check_max_size(); _List_node_emplace_op2<_Alnode> _Newnode(_List._Getal(), piecewise_construct, ::std:: forward_as_tuple(::std:: forward<_Keyty>(_Keyval_arg)), ::std:: forward_as_tuple(::std:: forward<_Mappedty>(_Mapval)...)); if (_Check_rehash_required_1()) { _Rehash_for_1(); _Target = _Find_last(_Traits::_Kfn(_Newnode._Ptr->_Myval), _Hashval); } return {_Insert_new_node_before(_Hashval, _Target._Insert_before, _Newnode._Release()), true}; } template <class _Keyty, class... _Mappedty> _Nodeptr _Try_emplace_hint(const _Nodeptr _Hint, _Keyty&& _Keyval_arg, _Mappedty&&... _Mapval) { const auto& _Keyval = _Keyval_arg; const auto _Hashval = _Traitsobj(_Keyval); auto _Target = _Find_hint(_Hint, _Keyval, _Hashval); if (_Target._Duplicate) { return _Target._Duplicate; } _Check_max_size(); _List_node_emplace_op2<_Alnode> _Newnode(_List._Getal(), piecewise_construct, ::std:: forward_as_tuple(::std:: forward<_Keyty>(_Keyval_arg)), ::std:: forward_as_tuple(::std:: forward<_Mappedty>(_Mapval)...)); if (_Check_rehash_required_1()) { _Rehash_for_1(); _Target = _Find_hint(_Hint, _Traits::_Kfn(_Newnode._Ptr->_Myval), _Hashval); } return _Insert_new_node_before(_Hashval, _Target._Insert_before, _Newnode._Release()); } private: void _Pocca_both(const _Hash& _Right) { _Pocca(_List._Getal(), _Right._List._Getal()); _Pocca(_Vec._Mypair._Get_first(), _Right._Vec._Mypair._Get_first()); } void _Copy_assign(const _Hash& _Right, false_type) { _Clear_guard _Guard{this}; _Traitsobj = _Right._Traitsobj; _Pocca_both(_Right); _List.template _Assign_cast<_Mutable_value_type&>( _Right._List._Unchecked_begin(), _Right._List._Unchecked_end()); _Reinsert_with_invalid_vec(); _Guard._Target = nullptr; } void _Copy_assign(const _Hash& _Right, true_type) { auto& _Al = _Getal(); const auto& _Right_al = _Right._Getal(); if (_Al == _Right_al) { _Copy_assign(_Right, false_type{}); return; } auto&& _Alproxy = static_cast<_Rebind_alloc_t<_Alnode, _Container_proxy>>(_Al); auto&& _Right_alproxy = static_cast<_Rebind_alloc_t<_Alnode, _Container_proxy>>(_Right_al); _Container_proxy_ptr<_Alnode> _Vec_proxy(_Right_alproxy, _Leave_proxy_unbound{}); _List._Reload_sentinel_and_proxy(_Right._List); _Vec._Tidy(); _Pocca_both(_Right); _Vec_proxy._Bind(_Alproxy, ::std:: addressof(_Vec._Mypair._Myval2)); _Clear_guard _Guard{this}; _Traitsobj = _Right._Traitsobj; _List.template _Assign_cast<_Mutable_value_type&>( _Right._List._Unchecked_begin(), _Right._List._Unchecked_end()); _Reinsert_with_invalid_vec(); _Guard._Target = nullptr; } public: _Hash& operator=(const _Hash& _Right) { if (this != ::std:: addressof(_Right)) { _Copy_assign(_Right, _Choose_pocca<_Alnode>{}); } return *this; } [[nodiscard]] iterator begin() noexcept { return _List.begin(); } [[nodiscard]] const_iterator begin() const noexcept { return _List.begin(); } [[nodiscard]] iterator end() noexcept { return _List.end(); } [[nodiscard]] const_iterator end() const noexcept { return _List.end(); } _Unchecked_iterator _Unchecked_begin() noexcept { return _List._Unchecked_begin(); } _Unchecked_const_iterator _Unchecked_begin() const noexcept { return _List._Unchecked_begin(); } _Unchecked_iterator _Unchecked_end() noexcept { return _List._Unchecked_end(); } _Unchecked_const_iterator _Unchecked_end() const noexcept { return _List._Unchecked_end(); } [[nodiscard]] const_iterator cbegin() const noexcept { return begin(); } [[nodiscard]] const_iterator cend() const noexcept { return end(); } [[nodiscard]] size_type size() const noexcept { return _List.size(); } [[nodiscard]] size_type max_size() const noexcept { return _List.max_size(); } [[nodiscard]] bool empty() const noexcept { return _List.empty(); } [[nodiscard]] allocator_type get_allocator() const noexcept { return static_cast<allocator_type>(_List.get_allocator()); } using local_iterator = iterator; using const_local_iterator = const_iterator; [[nodiscard]] size_type bucket_count() const noexcept { return _Maxidx; } [[nodiscard]] size_type max_bucket_count() const noexcept { return _Vec.max_size() >> 1; } [[nodiscard]] size_type bucket(const key_type& _Keyval) const noexcept(_Nothrow_hash<_Traits, key_type>) { return _Traitsobj(_Keyval) & _Mask; } [[nodiscard]] size_type bucket_size(size_type _Bucket) const noexcept { _Unchecked_iterator _Bucket_lo = _Vec._Mypair._Myval2._Myfirst[_Bucket << 1]; if (_Bucket_lo == _Unchecked_end()) { return 0; } return static_cast<size_type>(::std:: distance(_Bucket_lo, _Vec._Mypair._Myval2._Myfirst[(_Bucket << 1) + 1])) + 1; } [[nodiscard]] local_iterator begin(size_type _Bucket) noexcept { return _List._Make_iter(_Vec._Mypair._Myval2._Myfirst[_Bucket << 1]._Ptr); } [[nodiscard]] const_local_iterator begin(size_type _Bucket) const noexcept { return _List._Make_const_iter(_Vec._Mypair._Myval2._Myfirst[_Bucket << 1]._Ptr); } [[nodiscard]] local_iterator end(size_type _Bucket) noexcept { _Nodeptr _Bucket_hi = _Vec._Mypair._Myval2._Myfirst[(_Bucket << 1) + 1]._Ptr; if (_Bucket_hi != _List._Mypair._Myval2._Myhead) { _Bucket_hi = _Bucket_hi->_Next; } return _List._Make_iter(_Bucket_hi); } [[nodiscard]] const_local_iterator end(size_type _Bucket) const noexcept { _Nodeptr _Bucket_hi = _Vec._Mypair._Myval2._Myfirst[(_Bucket << 1) + 1]._Ptr; if (_Bucket_hi != _List._Mypair._Myval2._Myhead) { _Bucket_hi = _Bucket_hi->_Next; } return _List._Make_const_iter(_Bucket_hi); } [[nodiscard]] const_local_iterator cbegin(size_type _Bucket) const noexcept { return _List._Make_const_iter(_Vec._Mypair._Myval2._Myfirst[_Bucket << 1]._Ptr); } [[nodiscard]] const_local_iterator cend(size_type _Bucket) const noexcept { _Nodeptr _Bucket_hi = _Vec._Mypair._Myval2._Myfirst[(_Bucket << 1) + 1]._Ptr; if (_Bucket_hi != _List._Mypair._Myval2._Myhead) { _Bucket_hi = _Bucket_hi->_Next; } return _List._Make_const_iter(_Bucket_hi); } [[nodiscard]] float load_factor() const noexcept { return static_cast<float>(size()) / static_cast<float>(bucket_count()); } [[nodiscard]] float max_load_factor() const noexcept { return _Max_bucket_size(); } void max_load_factor(float _Newmax) noexcept { do { if (!(:: isnan)(_Newmax) && _Newmax > 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xhash", 896, 0, "%s", "invalid hash load factor")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"invalid hash load factor\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xhash", 896, 0); } while (false); } ; } while (false); _Max_bucket_size() = _Newmax; } void rehash(size_type _Buckets) { _Buckets = (::std:: max)(_Min_load_factor_buckets(_List.size()), _Buckets); if (_Buckets <= _Maxidx) { return; } _Forced_rehash(_Buckets); } void reserve(size_type _Maxcount) { rehash(static_cast<size_type>(static_cast<float>(_Maxcount) / max_load_factor() + 0.5F)); } conditional_t<_Multi, iterator, pair<iterator, bool>> insert(const value_type& _Val) { return emplace(_Val); } conditional_t<_Multi, iterator, pair<iterator, bool>> insert(value_type&& _Val) { return emplace(::std:: move(_Val)); } iterator insert(const_iterator _Hint, const value_type& _Val) { return emplace_hint(_Hint, _Val); } iterator insert(const_iterator _Hint, value_type&& _Val) { return emplace_hint(_Hint, ::std:: move(_Val)); } template <class _Iter> void insert(_Iter _First, _Iter _Last) { _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); for (; _UFirst != _ULast; ++_UFirst) { emplace(*_UFirst); } } void insert(initializer_list<value_type> _Ilist) { insert(_Ilist.begin(), _Ilist.end()); } private: _Nodeptr _Unchecked_erase(_Nodeptr _Plist) noexcept(_Nothrow_hash<_Traits, key_type>) { size_type _Bucket = bucket(_Traits::_Kfn(_Plist->_Myval)); _Erase_bucket(_Plist, _Bucket); return _List._Unchecked_erase(_Plist); } struct _Range_eraser { _Range_eraser(const _Range_eraser&) = delete; _Range_eraser& operator=(const _Range_eraser&) = delete; _Range_eraser(_Mylist& _List_, const _Nodeptr _First_) noexcept : _List(_List_), _First(_First_), _Next(_First_) {} void _Bump_erased() noexcept { _Next = _Next->_Next; } ~_Range_eraser() noexcept { _List._Unchecked_erase(_First, _Next); } _Mylist& _List; const _Nodeptr _First; _Nodeptr _Next; }; _Nodeptr _Unchecked_erase(_Nodeptr _First, const _Nodeptr _Last) noexcept(_Nothrow_hash<_Traits, key_type>) { if (_First == _Last) { return _Last; } const auto _End = _List._Mypair._Myval2._Myhead; const auto _Bucket_bounds = _Vec._Mypair._Myval2._Myfirst; _Range_eraser _Eraser{_List, _First}; { const auto _Predecessor = _First->_Prev; const size_type _Bucket = bucket(_Traits::_Kfn(_Eraser._Next->_Myval)); _Nodeptr& _Bucket_lo = _Bucket_bounds[_Bucket << 1]._Ptr; _Nodeptr& _Bucket_hi = _Bucket_bounds[(_Bucket << 1) + 1]._Ptr; const bool _Update_lo = _Bucket_lo == _Eraser._Next; const _Nodeptr _Old_hi = _Bucket_hi; for (;;) { const bool _At_bucket_back = _Eraser._Next == _Old_hi; _Eraser._Bump_erased(); if (_At_bucket_back) { break; } if (_Eraser._Next == _Last) { if (_Update_lo) { _Bucket_lo = _Eraser._Next; } return _Last; } } if (_Update_lo) { _Bucket_lo = _End; _Bucket_hi = _End; } else { _Bucket_hi = _Predecessor; } } while (_Eraser._Next != _Last) { const size_type _Bucket = bucket(_Traits::_Kfn(_Eraser._Next->_Myval)); _Nodeptr& _Bucket_lo = _Bucket_bounds[_Bucket << 1]._Ptr; _Nodeptr& _Bucket_hi = _Bucket_bounds[(_Bucket << 1) + 1]._Ptr; const _Nodeptr _Old_hi = _Bucket_hi; for (;;) { const bool _At_bucket_back = _Eraser._Next == _Old_hi; _Eraser._Bump_erased(); if (_At_bucket_back) { break; } if (_Eraser._Next == _Last) { _Bucket_lo = _Eraser._Next; return _Last; } } _Bucket_lo = _End; _Bucket_hi = _End; } return _Last; } public: template <class _Iter = iterator, enable_if_t<!is_same_v<_Iter, const_iterator>, int> = 0> iterator erase(iterator _Plist) noexcept(_Nothrow_hash<_Traits, key_type>) { return _List._Make_iter(_Unchecked_erase(_Plist._Ptr)); } iterator erase(const_iterator _Plist) noexcept(_Nothrow_hash<_Traits, key_type>) { return _List._Make_iter(_Unchecked_erase(_Plist._Ptr)); } iterator erase(const_iterator _First, const_iterator _Last) noexcept( _Nothrow_hash<_Traits, key_type>) { return _List._Make_iter(_Unchecked_erase(_First._Ptr, _Last._Ptr)); } size_type erase(const key_type& _Keyval) noexcept( _Nothrow_hash<_Traits, key_type> && (!_Multi || _Nothrow_compare<_Traits, key_type, key_type>) ) { const size_t _Hashval = _Traitsobj(_Keyval); if constexpr (_Multi) { const auto _Where = _Equal_range(_Keyval, _Hashval); _Unchecked_erase(_Where._First._Ptr, _Where._Last._Ptr); return _Where._Distance; } else { const auto _Target = _Find_last(_Keyval, _Hashval)._Duplicate; if (_Target) { _Erase_bucket(_Target, _Hashval & _Mask); _List._Unchecked_erase(_Target); return 1; } return 0; } } void clear() noexcept { const auto _Oldsize = _List._Mypair._Myval2._Mysize; if (_Oldsize == 0) { return; } if constexpr (_Nothrow_hash<_Traits, key_type>) { if (bucket_count() / 8 > _Oldsize) { const auto _Head = _List._Mypair._Myval2._Myhead; _Unchecked_erase(_Head->_Next, _Head); return; } } _List.clear(); ::std:: fill(_Vec._Mypair._Myval2._Myfirst, _Vec._Mypair._Myval2._Mylast, _Unchecked_end()); } private: template <class _Keyty> [[nodiscard]] _Nodeptr _Find_first(const _Keyty& _Keyval, const size_t _Hashval) const { const size_type _Bucket = _Hashval & _Mask; _Nodeptr _Where = _Vec._Mypair._Myval2._Myfirst[_Bucket << 1]._Ptr; const _Nodeptr _End = _List._Mypair._Myval2._Myhead; if (_Where == _End) { return _End; } const _Nodeptr _Bucket_hi = _Vec._Mypair._Myval2._Myfirst[(_Bucket << 1) + 1]._Ptr; for (;;) { if (!_Traitsobj(_Traits::_Kfn(_Where->_Myval), _Keyval)) { if constexpr (!_Traits::_Standard) { if (_Traitsobj(_Keyval, _Traits::_Kfn(_Where->_Myval))) { return _End; } } return _Where; } if (_Where == _Bucket_hi) { return _End; } _Where = _Where->_Next; } } template <class _Keyty> _Nodeptr _Find(const _Keyty& _Keyval, const size_t _Hashval) const { if constexpr (_Traits::_Multi) { return _Find_first(_Keyval, _Hashval); } else { auto _Target = _Find_last(_Keyval, _Hashval)._Duplicate; if (_Target) { return _Target; } return _List._Mypair._Myval2._Myhead; } } public: template <class _Keyty = void> [[nodiscard]] iterator find(typename _Traits::template _Deduce_key<_Keyty> _Keyval) { return _List._Make_iter(_Find(_Keyval, _Traitsobj(_Keyval))); } template <class _Keyty = void> [[nodiscard]] const_iterator find(typename _Traits::template _Deduce_key<_Keyty> _Keyval) const { return _List._Make_const_iter(_Find(_Keyval, _Traitsobj(_Keyval))); } template <class _Keyty = void> [[nodiscard]] bool contains(typename _Traits::template _Deduce_key<_Keyty> _Keyval) const { return static_cast<bool>(_Find_last(_Keyval, _Traitsobj(_Keyval))._Duplicate); } template <class _Keyty = void> [[nodiscard]] size_type count(typename _Traits::template _Deduce_key<_Keyty> _Keyval) const { const size_t _Hashval = _Traitsobj(_Keyval); if constexpr (_Multi) { return _Equal_range(_Keyval, _Hashval)._Distance; } else { return static_cast<bool>(_Find_last(_Keyval, _Hashval)._Duplicate); } } [[deprecated( "warning STL4022: " "The hash_meow and unordered_meow containers' non-Standard lower_bound() member was provided for interface " "compatibility with the ordered associative containers, and doesn't match the semantics of the " "hash_meow or unordered_meow containers. Please use the find() member instead. You can define " "_SILENCE_STDEXT_HASH_LOWER_BOUND_DEPRECATION_WARNING to suppress this deprecation.")]] [[nodiscard]] iterator lower_bound(const key_type& _Keyval) { return _List._Make_iter(_Find(_Keyval, _Traitsobj(_Keyval))); } [[deprecated( "warning STL4022: " "The hash_meow and unordered_meow containers' non-Standard lower_bound() member was provided for interface " "compatibility with the ordered associative containers, and doesn't match the semantics of the " "hash_meow or unordered_meow containers. Please use the find() member instead. You can define " "_SILENCE_STDEXT_HASH_LOWER_BOUND_DEPRECATION_WARNING to suppress this deprecation.")]] [[nodiscard]] const_iterator lower_bound(const key_type& _Keyval) const { return _List._Make_const_iter(_Find(_Keyval, _Traitsobj(_Keyval))); } [[deprecated( "warning STL4023: " "The hash_meow and unordered_meow containers' non-Standard upper_bound() member was provided for interface " "compatibility with the ordered associative containers, and doesn't match the semantics of the " "hash_meow or unordered_meow containers. Please use the second iterator returned by the " "equal_range() member instead. You can define " "_SILENCE_STDEXT_HASH_UPPER_BOUND_DEPRECATION_WARNING to suppress this deprecation.")]] [[nodiscard]] iterator upper_bound(const key_type& _Keyval) { auto _Target = _Find_last(_Keyval, _Traitsobj(_Keyval))._Duplicate; if (_Target) { _Target = _Target->_Next; } else { _Target = _List._Mypair._Myval2._Myhead; } return _List._Make_iter(_Target); } [[deprecated( "warning STL4023: " "The hash_meow and unordered_meow containers' non-Standard upper_bound() member was provided for interface " "compatibility with the ordered associative containers, and doesn't match the semantics of the " "hash_meow or unordered_meow containers. Please use the second iterator returned by the " "equal_range() member instead. You can define " "_SILENCE_STDEXT_HASH_UPPER_BOUND_DEPRECATION_WARNING to suppress this deprecation.")]] [[nodiscard]] const_iterator upper_bound(const key_type& _Keyval) const { auto _Target = _Find_last(_Keyval, _Traitsobj(_Keyval))._Duplicate; if (_Target) { _Target = _Target->_Next; } else { _Target = _List._Mypair._Myval2._Myhead; } return _List._Make_const_iter(_Target); } private: struct _Equal_range_result { _Unchecked_const_iterator _First; _Unchecked_const_iterator _Last; size_type _Distance; }; template <class _Keyty> [[nodiscard]] _Equal_range_result _Equal_range(const _Keyty& _Keyval, const size_t _Hashval) const noexcept(_Nothrow_compare<_Traits, key_type, _Keyty>&& _Nothrow_compare<_Traits, _Keyty, key_type>) { const size_type _Bucket = _Hashval & _Mask; _Unchecked_const_iterator _Where = _Vec._Mypair._Myval2._Myfirst[_Bucket << 1]; const _Unchecked_const_iterator _End = _Unchecked_end(); if (_Where == _End) { return {_End, _End, 0}; } const _Unchecked_const_iterator _Bucket_hi = _Vec._Mypair._Myval2._Myfirst[(_Bucket << 1) + 1]; for (; _Traitsobj(_Traits::_Kfn(*_Where), _Keyval); ++_Where) { if (_Where == _Bucket_hi) { return {_End, _End, 0}; } } if constexpr (!_Traits::_Standard) { if (_Traitsobj(_Keyval, _Traits::_Kfn(*_Where))) { return {_End, _End, 0}; } } const _Unchecked_const_iterator _First = _Where; if constexpr (_Multi) { size_type _Distance = 0; for (;;) { ++_Distance; const bool _At_bucket_end = _Where == _Bucket_hi; ++_Where; if (_At_bucket_end) { break; } if (_Traitsobj(_Keyval, _Traits::_Kfn(*_Where))) { break; } } return {_First, _Where, _Distance}; } else { ++_Where; return {_First, _Where, 1}; } } public: template <class _Keyty = void> [[nodiscard]] pair<iterator, iterator> equal_range(typename _Traits::template _Deduce_key<_Keyty> _Keyval) { const auto _Result = _Equal_range(_Keyval, _Traitsobj(_Keyval)); return {_List._Make_iter(_Result._First._Ptr), _List._Make_iter(_Result._Last._Ptr)}; } template <class _Keyty = void> [[nodiscard]] pair<const_iterator, const_iterator> equal_range( typename _Traits::template _Deduce_key<_Keyty> _Keyval) const { const auto _Result = _Equal_range(_Keyval, _Traitsobj(_Keyval)); return {_List._Make_const_iter(_Result._First._Ptr), _List._Make_const_iter(_Result._Last._Ptr)}; } void swap(_Hash& _Right) noexcept(noexcept(_Traitsobj.swap(_Right._Traitsobj))) { if (this != ::std:: addressof(_Right)) { _Traitsobj.swap(_Right._Traitsobj); _Pocs(_List._Getal(), _Right._List._Getal()); _Pocs(_Vec._Mypair._Get_first(), _Right._Vec._Mypair._Get_first()); _Swap_val(_Right); } } using node_type = typename _Traits::node_type; node_type extract(const const_iterator _Where) { const auto _List_data = ::std:: addressof(_List._Mypair._Myval2); do { if (_Where._Getcont() == _List_data) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xhash", 1318, 0, "%s", "extract mismatched container")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"extract mismatched container\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xhash", 1318, 0); } while (false); } ; } while (false); do { if (_Where._Ptr != _List_data->_Myhead) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xhash", 1319, 0, "%s", "cannot extract end()")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot extract end()\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xhash", 1319, 0); } while (false); } ; } while (false); return node_type::_Make(_Extract(_Where._Unwrapped()), _List._Getal()); } node_type extract(const key_type& _Keyval) { const auto _Ptr = _Extract(_Keyval); if (!_Ptr) { return node_type{}; } return node_type::_Make(_Ptr, _List._Getal()); } iterator insert(const_iterator _Hint, node_type&& _Handle) { if (_Handle.empty()) { return end(); } do { if (_List.get_allocator() == _Handle._Getal()) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xhash", 1340, 0, "%s", "node handle allocator incompatible for insert")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"node handle allocator incompatible for insert\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xhash", 1340, 0); } while (false); } ; } while (false); const auto& _Keyval = _Traits::_Kfn(_Handle._Getptr()->_Myval); const size_t _Hashval = _Traitsobj(_Keyval); auto _Target = _Find_hint(_Hint._Ptr, _Keyval, _Hashval); if constexpr (!_Traits::_Multi) { if (_Target._Duplicate) { return _List._Make_iter(_Target._Duplicate); } } _Check_max_size(); if (_Check_rehash_required_1()) { _Rehash_for_1(); _Target = _Find_hint(_Hint._Ptr, _Keyval, _Hashval); } const auto _Released = _Handle._Release(); _Destroy_in_place(_Released->_Next); _Destroy_in_place(_Released->_Prev); return _List._Make_iter(_Insert_new_node_before(_Hashval, _Target._Insert_before, _Released)); } template <class> friend class _Hash; template <class _Other_traits> void merge(_Hash<_Other_traits>& _That) { static_assert(is_same_v<_Nodeptr, typename _Hash<_Other_traits>::_Nodeptr>, "merge() requires an argument with a compatible node type."); static_assert(is_same_v<allocator_type, typename _Hash<_Other_traits>::allocator_type>, "merge() requires an argument with the same allocator type."); if constexpr (is_same_v<_Hash, _Hash<_Other_traits>>) { if (this == ::std:: addressof(_That)) { return; } } if constexpr (!_Alnode_traits::is_always_equal::value) { do { if (_List._Getal() == _That._List._Getal()) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xhash", 1383, 0, "%s", "allocator incompatible for merge")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"allocator incompatible for merge\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xhash", 1383, 0); } while (false); } ; } while (false); } auto _First = _That._Unchecked_begin(); const auto _Last = _That._Unchecked_end(); while (_First != _Last) { const auto _Candidate = _First._Ptr; ++_First; const auto& _Keyval = _Traits::_Kfn(_Candidate->_Myval); const size_t _Hashval = _Traitsobj(_Keyval); auto _Target = _Find_last(_Keyval, _Hashval); if constexpr (!_Traits::_Multi) { if (_Target._Duplicate) { continue; } } _Check_max_size(); if (_Check_rehash_required_1()) { _Rehash_for_1(); _Target = _Find_last(_Keyval, _Hashval); } const auto _Source_bucket = _Hashval & _That._Mask; _That._Erase_bucket(_Candidate, _Source_bucket); _Candidate->_Prev->_Next = _Candidate->_Next; _Candidate->_Next->_Prev = _Candidate->_Prev; --_That._List._Mypair._Myval2._Mysize; _Destroy_in_place(_Candidate->_Next); _Destroy_in_place(_Candidate->_Prev); _List._Mypair._Myval2._Adopt_unique(_That._List._Mypair._Myval2, _Candidate); (void) _Insert_new_node_before(_Hashval, _Target._Insert_before, _Candidate); } } template <class _Other_traits> void merge(_Hash<_Other_traits>&& _That) { static_assert(is_same_v<_Nodeptr, typename _Hash<_Other_traits>::_Nodeptr>, "merge() requires an argument with a compatible node type."); static_assert(is_same_v<allocator_type, typename _Hash<_Other_traits>::allocator_type>, "merge() requires an argument with the same allocator type."); merge(_That); } protected: _Nodeptr _Extract(const _Unchecked_const_iterator _Where) { const size_type _Bucket = bucket(_Traits::_Kfn(*_Where)); _Erase_bucket(_Where._Ptr, _Bucket); return _List._Mypair._Myval2._Unlinknode(_Where._Ptr); } _Nodeptr _Extract(const key_type& _Keyval) { const size_t _Hashval = _Traitsobj(_Keyval); _Nodeptr _Target; if constexpr (_Traits::_Multi) { _Target = _Find_first(_Keyval, _Hashval); if (_Target == _List._Mypair._Myval2._Myhead) { return _Nodeptr{}; } } else { _Target = _Find_last(_Keyval, _Hashval)._Duplicate; if (_Target == nullptr) { return _Nodeptr{}; } } _Erase_bucket(_Target, _Hashval & _Mask); return _List._Mypair._Myval2._Unlinknode(_Target); } public: conditional_t<_Traits::_Multi, iterator, _Insert_return_type<iterator, node_type>> insert(node_type&& _Handle) { if (_Handle.empty()) { if constexpr (_Traits::_Multi) { return end(); } else { return {end(), false, ::std:: move(_Handle)}; } } do { if (_List.get_allocator() == _Handle._Getal()) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xhash", 1471, 0, "%s", "node handle allocator incompatible for insert")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"node handle allocator incompatible for insert\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xhash", 1471, 0); } while (false); } ; } while (false); const auto& _Keyval = _Traits::_Kfn(_Handle._Getptr()->_Myval); const size_t _Hashval = _Traitsobj(_Keyval); auto _Target = _Find_last(_Keyval, _Hashval); if constexpr (!_Traits::_Multi) { if (_Target._Duplicate) { return {_List._Make_iter(_Target._Duplicate), false, ::std:: move(_Handle)}; } } _Check_max_size(); if (_Check_rehash_required_1()) { _Rehash_for_1(); _Target = _Find_last(_Keyval, _Hashval); } const auto _Released = _Handle._Release(); _Destroy_in_place(_Released->_Next); _Destroy_in_place(_Released->_Prev); const auto _Newnode = _Insert_new_node_before(_Hashval, _Target._Insert_before, _Released); if constexpr (_Traits::_Multi) { return _List._Make_iter(_Newnode); } else { return {_List._Make_iter(_Newnode), true, node_type{}}; } } protected: template <class _Keyty> [[nodiscard]] _Hash_find_last_result<_Nodeptr> _Find_last(const _Keyty& _Keyval, const size_t _Hashval) const { const size_type _Bucket = _Hashval & _Mask; _Nodeptr _Where = _Vec._Mypair._Myval2._Myfirst[(_Bucket << 1) + 1]._Ptr; const _Nodeptr _End = _List._Mypair._Myval2._Myhead; if (_Where == _End) { return {_End, _Nodeptr{}}; } const _Nodeptr _Bucket_lo = _Vec._Mypair._Myval2._Myfirst[_Bucket << 1]._Ptr; for (;;) { if (!_Traitsobj(_Keyval, _Traits::_Kfn(_Where->_Myval))) { if constexpr (!_Traits::_Standard) { if (_Traitsobj(_Traits::_Kfn(_Where->_Myval), _Keyval)) { return {_Where->_Next, _Nodeptr{}}; } } return {_Where->_Next, _Where}; } if (_Where == _Bucket_lo) { return {_Where, _Nodeptr{}}; } _Where = _Where->_Prev; } } template <class _Keyty> [[nodiscard]] _Hash_find_last_result<_Nodeptr> _Find_hint( const _Nodeptr _Hint, const _Keyty& _Keyval, const size_t _Hashval) const { if (_Hint != _List._Mypair._Myval2._Myhead && !_Traitsobj(_Traits::_Kfn(_Hint->_Myval), _Keyval)) { if constexpr (!_Traits::_Standard) { if (_Traitsobj(_Keyval, _Traits::_Kfn(_Hint->_Myval))) { return _Find_last(_Keyval, _Hashval); } } return {_Hint->_Next, _Hint}; } return _Find_last(_Keyval, _Hashval); } _Nodeptr _Insert_new_node_before( const size_t _Hashval, const _Nodeptr _Insert_before, const _Nodeptr _Newnode) noexcept { const _Nodeptr _Insert_after = _Insert_before->_Prev; ++_List._Mypair._Myval2._Mysize; _Construct_in_place(_Newnode->_Next, _Insert_before); _Construct_in_place(_Newnode->_Prev, _Insert_after); _Insert_after->_Next = _Newnode; _Insert_before->_Prev = _Newnode; const auto _Head = _List._Mypair._Myval2._Myhead; const auto _Bucket_array = _Vec._Mypair._Myval2._Myfirst; const size_type _Bucket = _Hashval & _Mask; _Unchecked_iterator& _Bucket_lo = _Bucket_array[_Bucket << 1]; _Unchecked_iterator& _Bucket_hi = _Bucket_array[(_Bucket << 1) + 1]; if (_Bucket_lo._Ptr == _Head) { _Bucket_lo._Ptr = _Newnode; _Bucket_hi._Ptr = _Newnode; } else if (_Bucket_lo._Ptr == _Insert_before) { _Bucket_lo._Ptr = _Newnode; } else if (_Bucket_hi._Ptr == _Insert_after) { _Bucket_hi._Ptr = _Newnode; } return _Newnode; } void _Check_max_size() const { const size_type _Oldsize = _List._Mypair._Myval2._Mysize; if (_Oldsize == _List.max_size()) { _Xlength_error("unordered_map/set too long"); } } bool _Check_rehash_required_1() const noexcept { const size_type _Oldsize = _List._Mypair._Myval2._Mysize; const auto _Newsize = _Oldsize + 1; return max_load_factor() < static_cast<float>(_Newsize) / static_cast<float>(bucket_count()); } void _Rehash_for_1() { const auto _Oldsize = _List._Mypair._Myval2._Mysize; const auto _Newsize = _Oldsize + 1; _Forced_rehash(_Desired_grow_bucket_count(_Newsize)); } void _Erase_bucket(_Nodeptr _Plist, size_type _Bucket) noexcept { _Nodeptr& _Bucket_lo = _Vec._Mypair._Myval2._Myfirst[_Bucket << 1]._Ptr; _Nodeptr& _Bucket_hi = _Vec._Mypair._Myval2._Myfirst[(_Bucket << 1) + 1]._Ptr; if (_Bucket_hi == _Plist) { if (_Bucket_lo == _Plist) { const auto _End = _List._Mypair._Myval2._Myhead; _Bucket_lo = _End; _Bucket_hi = _End; } else { _Bucket_hi = _Plist->_Prev; } } else if (_Bucket_lo == _Plist) { _Bucket_lo = _Plist->_Next; } } [[nodiscard]] size_type _Min_load_factor_buckets(const size_type _For_size) const noexcept { return static_cast<size_type>(:: ceilf(static_cast<float>(_For_size) / max_load_factor())); } [[nodiscard]] size_type _Desired_grow_bucket_count(const size_type _For_size) const noexcept { const size_type _Old_buckets = bucket_count(); const size_type _Req_buckets = (::std:: max)(_Min_buckets, _Min_load_factor_buckets(_For_size)); if (_Old_buckets >= _Req_buckets) { return _Old_buckets; } if (_Old_buckets < 512 && _Old_buckets * 8 >= _Req_buckets) { return _Old_buckets * 8; } return _Req_buckets; } void _Reinsert_with_invalid_vec() { _Forced_rehash(_Desired_grow_bucket_count(_List.size())); } void _Forced_rehash(size_type _Buckets) { const unsigned long _Max_storage_buckets_log2 = _Floor_of_log_2(static_cast<size_t>(_Vec.max_size() >> 1)); const auto _Max_storage_buckets = static_cast<size_type>(1) << _Max_storage_buckets_log2; if (_Buckets > _Max_storage_buckets) { _Xlength_error("invalid hash bucket count"); } _Buckets = static_cast<size_type>(1) << _Ceiling_of_log_2(static_cast<size_t>(_Buckets)); const _Unchecked_iterator _End = _Unchecked_end(); _Vec._Assign_grow(_Buckets << 1, _End); _Mask = _Buckets - 1; _Maxidx = _Buckets; _Clear_guard _Guard{this}; _Unchecked_iterator _Inserted = _Unchecked_begin(); for (_Unchecked_iterator _Next_inserted = _Inserted; _Inserted != _End; _Inserted = _Next_inserted) { ++_Next_inserted; auto& _Inserted_key = _Traits::_Kfn(*_Inserted); const size_type _Bucket = bucket(_Inserted_key); _Unchecked_iterator& _Bucket_lo = _Vec._Mypair._Myval2._Myfirst[_Bucket << 1]; _Unchecked_iterator& _Bucket_hi = _Vec._Mypair._Myval2._Myfirst[(_Bucket << 1) + 1]; if (_Bucket_lo == _End) { _Bucket_lo = _Inserted; _Bucket_hi = _Inserted; continue; } _Unchecked_const_iterator _Insert_before = _Bucket_hi; if (!_Traitsobj(_Inserted_key, _Traits::_Kfn(*_Insert_before))) { ++_Insert_before; if (_Insert_before != _Inserted) { _Mylist::_Scary_val::_Unchecked_splice(_Insert_before._Ptr, _Inserted._Ptr, _Next_inserted._Ptr); } _Bucket_hi = _Inserted; continue; } for (;;) { if (_Bucket_lo == _Insert_before) { _Mylist::_Scary_val::_Unchecked_splice(_Insert_before._Ptr, _Inserted._Ptr, _Next_inserted._Ptr); _Bucket_lo = _Inserted; break; } if (!_Traitsobj(_Inserted_key, _Traits::_Kfn(*--_Insert_before))) { ++_Insert_before; _Mylist::_Scary_val::_Unchecked_splice(_Insert_before._Ptr, _Inserted._Ptr, _Next_inserted._Ptr); break; } } } _Guard._Target = nullptr; } float& _Max_bucket_size() noexcept { return _Traitsobj._Get_max_bucket_size(); } const float& _Max_bucket_size() const noexcept { return _Traitsobj._Get_max_bucket_size(); } _Alnode& _Getal() noexcept { return _List._Getal(); } const _Alnode& _Getal() const noexcept { return _List._Getal(); } struct _Multi_equal_check_result { bool _Equal_possible = false; _Unchecked_const_iterator _Subsequent_first{}; }; [[nodiscard]] _Multi_equal_check_result _Multi_equal_check_equal_range( const _Hash& _Right, _Unchecked_const_iterator _First1) const { auto& _Keyval = _Traits::_Kfn(*_First1); const size_t _Hashval = _Right._Traitsobj(_Keyval); const size_type _Bucket = _Hashval & _Right._Mask; auto _First2 = _Right._Vec._Mypair._Myval2._Myfirst[_Bucket << 1]; if (_First2 == _Right._Unchecked_end()) { return {}; } const auto _Bucket_hi = _Right._Vec._Mypair._Myval2._Myfirst[(_Bucket << 1) + 1]; for (; _Right._Traitsobj(_Traits::_Kfn(*_First2), _Keyval); ++_First2) { if (_First2 == _Bucket_hi) { return {}; } } _Unchecked_const_iterator _Left_stop_at; if constexpr (_Traits::_Standard) { _Left_stop_at = _Unchecked_end(); } else { if (_Right._Traitsobj(_Keyval, _Traits::_Kfn(*_First2))) { return {}; } const size_t _LHashval = _Traitsobj(_Keyval); const size_type _LBucket = _LHashval & _Mask; const auto _LBucket_hi = _Vec._Mypair._Myval2._Myfirst[(_LBucket << 1) + 1]; _Left_stop_at = _LBucket_hi; ++_Left_stop_at; } while (*_First1 == *_First2) { bool _Right_range_end = _First2 == _Bucket_hi; ++_First2; if (!_Right_range_end) { _Right_range_end = _Right._Traitsobj(_Keyval, _Traits::_Kfn(*_First2)); } ++_First1; const bool _Left_range_end = _First1 == _Left_stop_at || _Traitsobj(_Keyval, _Traits::_Kfn(*_First1)); if (_Left_range_end && _Right_range_end) { return {true, _First1}; } if (_Left_range_end || _Right_range_end) { return {}; } } auto _Last1 = _First1; auto _Last2 = _First2; for (;;) { bool _Right_range_end = _Last2 == _Bucket_hi; ++_Last2; if (!_Right_range_end) { _Right_range_end = _Right._Traitsobj(_Keyval, _Traits::_Kfn(*_Last2)); } ++_Last1; const bool _Left_range_end = _Last1 == _Left_stop_at || _Traitsobj(_Keyval, _Traits::_Kfn(*_Last1)); if (_Left_range_end && _Right_range_end) { return {_Check_match_counts(_First1, _Last1, _First2, _Last2, equal_to<>{}), _Last1}; } if (_Left_range_end || _Right_range_end) { return {}; } } } template <bool _Multi2 = _Traits::_Multi, enable_if_t<_Multi2, int> = 0> [[nodiscard]] bool _Multi_equal(const _Hash& _Right) const { static_assert(_Traits::_Multi, "This function only works with multi containers"); ; const auto _Last1 = _Unchecked_end(); auto _First1 = _Unchecked_begin(); while (_First1 != _Last1) { const auto _Result = _Multi_equal_check_equal_range(_Right, _First1); if (!_Result._Equal_possible) { return false; } _First1 = _Result._Subsequent_first; } return true; } _Traits _Traitsobj; _Mylist _List; _Hash_vec<_Aliter> _Vec; size_type _Mask; size_type _Maxidx; }; template <class _Hasher> using _Is_hasher = negation<disjunction<is_integral<_Hasher>, _Is_allocator<_Hasher>>>; template <class _Traits> [[nodiscard]] bool _Hash_equal(const _Hash<_Traits>& _Left, const _Hash<_Traits>& _Right) { if (_Left.size() != _Right.size()) { return false; } if constexpr (_Traits::_Multi) { return _Left._Multi_equal(_Right); } else { for (const auto& _LVal : _Left) { const auto& _Keyval = _Traits::_Kfn(_LVal); const auto _Next2 = _Right._Find_last(_Keyval, _Right._Traitsobj(_Keyval))._Duplicate; if (!(static_cast<bool>(_Next2) && _Traits::_Nonkfn(_LVal) == _Traits::_Nonkfn(_Next2->_Myval))) { return false; } } } return true; } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { template <class _Kty, class _Ty, class _Tr, class _Alloc, bool _Mfl> class _Umap_traits : public _Tr { public: using key_type = _Kty; using value_type = pair<const _Kty, _Ty>; using _Mutable_value_type = pair<_Kty, _Ty>; using key_compare = _Tr; using allocator_type = _Alloc; using node_type = _Node_handle<_List_node<value_type, typename allocator_traits<_Alloc>::void_pointer>, _Alloc, _Node_handle_map_base, _Kty, _Ty>; static constexpr bool _Multi = _Mfl; static constexpr bool _Standard = true; template <class... _Args> using _In_place_key_extractor = _In_place_key_extract_map<_Kty, _Args...>; _Umap_traits() = default; explicit _Umap_traits(const _Tr& _Traits) noexcept(is_nothrow_copy_constructible_v<_Tr>) : _Tr(_Traits) {} using value_compare = void; template <class _Ty1, class _Ty2> static const _Kty& _Kfn(const pair<_Ty1, _Ty2>& _Val) noexcept { return _Val.first; } template <class _Ty1, class _Ty2> static const _Ty2& _Nonkfn(const pair<_Ty1, _Ty2>& _Val) noexcept { return _Val.second; } }; template <class _Kty, class _Ty, class _Hasher = hash<_Kty>, class _Keyeq = equal_to<_Kty>, class _Alloc = allocator<pair<const _Kty, _Ty>>> class unordered_map : public _Hash<_Umap_traits<_Kty, _Ty, _Uhash_compare<_Kty, _Hasher, _Keyeq>, _Alloc, false>> { public: static_assert(!1 || is_same_v<pair<const _Kty, _Ty>, typename _Alloc::value_type>, "unordered_map<Key, Value, Hasher, Eq, Allocator>" " requires that Allocator's value_type match " "pair<const Key, Value>" " (See N4659 26.2.1 [container.requirements.general]/16 allocator_type)" " Either fix the allocator value_type or define _ENFORCE_MATCHING_ALLOCATORS=0" " to suppress this diagnostic."); private: using _Mytraits = _Uhash_compare<_Kty, _Hasher, _Keyeq>; using _Mybase = _Hash<_Umap_traits<_Kty, _Ty, _Mytraits, _Alloc, false>>; using _Alnode = typename _Mybase::_Alnode; using _Alnode_traits = typename _Mybase::_Alnode_traits; using _Nodeptr = typename _Mybase::_Nodeptr; using _Key_compare = typename _Mybase::_Key_compare; public: using hasher = _Hasher; using key_type = _Kty; using mapped_type = _Ty; using key_equal = _Keyeq; using value_type = pair<const _Kty, _Ty>; using allocator_type = typename _Mybase::allocator_type; using size_type = typename _Mybase::size_type; using difference_type = typename _Mybase::difference_type; using pointer = typename _Mybase::pointer; using const_pointer = typename _Mybase::const_pointer; using reference = value_type&; using const_reference = const value_type&; using iterator = typename _Mybase::iterator; using const_iterator = typename _Mybase::const_iterator; using local_iterator = typename _Mybase::iterator; using const_local_iterator = typename _Mybase::const_iterator; using insert_return_type = _Insert_return_type<iterator, typename _Mybase::node_type>; unordered_map() : _Mybase(_Key_compare(), allocator_type()) {} explicit unordered_map(const allocator_type& _Al) : _Mybase(_Key_compare(), _Al) {} unordered_map(const unordered_map& _Right) : _Mybase(_Right, _Alnode_traits::select_on_container_copy_construction(_Right._Getal())) {} unordered_map(const unordered_map& _Right, const allocator_type& _Al) : _Mybase(_Right, _Al) {} explicit unordered_map(size_type _Buckets) : _Mybase(_Key_compare(), allocator_type()) { _Mybase::rehash(_Buckets); } unordered_map(size_type _Buckets, const allocator_type& _Al) : _Mybase(_Key_compare(), _Al) { _Mybase::rehash(_Buckets); } unordered_map(size_type _Buckets, const hasher& _Hasharg) : _Mybase(_Key_compare(_Hasharg), allocator_type()) { _Mybase::rehash(_Buckets); } unordered_map(size_type _Buckets, const hasher& _Hasharg, const allocator_type& _Al) : _Mybase(_Key_compare(_Hasharg), _Al) { _Mybase::rehash(_Buckets); } unordered_map(size_type _Buckets, const hasher& _Hasharg, const _Keyeq& _Keyeqarg) : _Mybase(_Key_compare(_Hasharg, _Keyeqarg), allocator_type()) { _Mybase::rehash(_Buckets); } unordered_map(size_type _Buckets, const hasher& _Hasharg, const _Keyeq& _Keyeqarg, const allocator_type& _Al) : _Mybase(_Key_compare(_Hasharg, _Keyeqarg), _Al) { _Mybase::rehash(_Buckets); } template <class _Iter> unordered_map(_Iter _First, _Iter _Last) : _Mybase(_Key_compare(), allocator_type()) { insert(_First, _Last); } template <class _Iter> unordered_map(_Iter _First, _Iter _Last, const allocator_type& _Al) : _Mybase(_Key_compare(), _Al) { insert(_First, _Last); } template <class _Iter> unordered_map(_Iter _First, _Iter _Last, size_type _Buckets) : _Mybase(_Key_compare(), allocator_type()) { _Mybase::rehash(_Buckets); insert(_First, _Last); } template <class _Iter> unordered_map(_Iter _First, _Iter _Last, size_type _Buckets, const allocator_type& _Al) : _Mybase(_Key_compare(), _Al) { _Mybase::rehash(_Buckets); insert(_First, _Last); } template <class _Iter> unordered_map(_Iter _First, _Iter _Last, size_type _Buckets, const hasher& _Hasharg) : _Mybase(_Key_compare(_Hasharg), allocator_type()) { _Mybase::rehash(_Buckets); insert(_First, _Last); } template <class _Iter> unordered_map(_Iter _First, _Iter _Last, size_type _Buckets, const hasher& _Hasharg, const allocator_type& _Al) : _Mybase(_Key_compare(_Hasharg), _Al) { _Mybase::rehash(_Buckets); insert(_First, _Last); } template <class _Iter> unordered_map(_Iter _First, _Iter _Last, size_type _Buckets, const hasher& _Hasharg, const _Keyeq& _Keyeqarg) : _Mybase(_Key_compare(_Hasharg, _Keyeqarg), allocator_type()) { _Mybase::rehash(_Buckets); insert(_First, _Last); } template <class _Iter> unordered_map(_Iter _First, _Iter _Last, size_type _Buckets, const hasher& _Hasharg, const _Keyeq& _Keyeqarg, const allocator_type& _Al) : _Mybase(_Key_compare(_Hasharg, _Keyeqarg), _Al) { _Mybase::rehash(_Buckets); insert(_First, _Last); } unordered_map& operator=(const unordered_map& _Right) { _Mybase::operator=(_Right); return *this; } unordered_map(unordered_map&& _Right) : _Mybase(::std:: move(_Right)) {} unordered_map(unordered_map&& _Right, const allocator_type& _Al) : _Mybase(::std:: move(_Right), _Al) {} unordered_map& operator=(unordered_map&& _Right) noexcept(_Alnode_traits::is_always_equal::value&& is_nothrow_move_assignable_v<_Hasher>&& is_nothrow_move_assignable_v<_Keyeq>) { _Mybase::operator=(::std:: move(_Right)); return *this; } mapped_type& operator[](key_type&& _Keyval) { return this->_Try_emplace(::std:: move(_Keyval)).first->_Myval.second; } void swap(unordered_map& _Right) noexcept(noexcept(_Mybase::swap(_Right))) { _Mybase::swap(_Right); } using _Mybase::insert; template <class _Valty, enable_if_t<is_constructible_v<value_type, _Valty>, int> = 0> pair<iterator, bool> insert(_Valty&& _Val) { return this->emplace(::std:: forward<_Valty>(_Val)); } template <class _Valty, enable_if_t<is_constructible_v<value_type, _Valty>, int> = 0> iterator insert(const_iterator _Where, _Valty&& _Val) { return this->emplace_hint(_Where, ::std:: forward<_Valty>(_Val)); } template <class... _Mappedty> pair<iterator, bool> try_emplace(const key_type& _Keyval, _Mappedty&&... _Mapval) { const auto _Result = this->_Try_emplace(_Keyval, ::std:: forward<_Mappedty>(_Mapval)...); return {this->_List._Make_iter(_Result.first), _Result.second}; } template <class... _Mappedty> pair<iterator, bool> try_emplace(key_type&& _Keyval, _Mappedty&&... _Mapval) { const auto _Result = this->_Try_emplace(::std:: move(_Keyval), ::std:: forward<_Mappedty>(_Mapval)...); return {this->_List._Make_iter(_Result.first), _Result.second}; } template <class... _Mappedty> iterator try_emplace(const const_iterator _Hint, const key_type& _Keyval, _Mappedty&&... _Mapval) { return this->_List._Make_iter( this->_Try_emplace_hint(_Hint._Ptr, _Keyval, ::std:: forward<_Mappedty>(_Mapval)...)); } template <class... _Mappedty> iterator try_emplace(const const_iterator _Hint, key_type&& _Keyval, _Mappedty&&... _Mapval) { return this->_List._Make_iter( this->_Try_emplace_hint(_Hint._Ptr, ::std:: move(_Keyval), ::std:: forward<_Mappedty>(_Mapval)...)); } private: template <class _Keyty, class _Mappedty> pair<iterator, bool> _Insert_or_assign(_Keyty&& _Keyval_arg, _Mappedty&& _Mapval) { const auto& _Keyval = _Keyval_arg; const size_t _Hashval = this->_Traitsobj(_Keyval); auto _Target = this->_Find_last(_Keyval, _Hashval); if (_Target._Duplicate) { _Target._Duplicate->_Myval.second = ::std:: forward<_Mappedty>(_Mapval); return {this->_List._Make_iter(_Target._Duplicate), false}; } this->_Check_max_size(); _List_node_emplace_op2<_Alnode> _Newnode( this->_Getal(), ::std:: forward<_Keyty>(_Keyval_arg), ::std:: forward<_Mappedty>(_Mapval)); if (this->_Check_rehash_required_1()) { this->_Rehash_for_1(); _Target = this->_Find_last(_Newnode._Ptr->_Myval.first, _Hashval); } return {this->_List._Make_iter( this->_Insert_new_node_before(_Hashval, _Target._Insert_before, _Newnode._Release())), true}; } template <class _Keyty, class _Mappedty> iterator _Insert_or_assign(const _Nodeptr _Hint, _Keyty&& _Keyval_arg, _Mappedty&& _Mapval) { const auto& _Keyval = _Keyval_arg; const size_t _Hashval = this->_Traitsobj(_Keyval); auto _Target = this->_Find_hint(_Hint, _Keyval, _Hashval); if (_Target._Duplicate) { _Target._Duplicate->_Myval.second = ::std:: forward<_Mappedty>(_Mapval); return this->_List._Make_iter(_Target._Duplicate); } this->_Check_max_size(); _List_node_emplace_op2<_Alnode> _Newnode( this->_Getal(), ::std:: forward<_Keyty>(_Keyval_arg), ::std:: forward<_Mappedty>(_Mapval)); if (this->_Check_rehash_required_1()) { this->_Rehash_for_1(); _Target = this->_Find_hint(_Hint, _Newnode._Ptr->_Myval.first, _Hashval); } return this->_List._Make_iter( this->_Insert_new_node_before(_Hashval, _Target._Insert_before, _Newnode._Release())); } public: template <class _Mappedty> pair<iterator, bool> insert_or_assign(const key_type& _Keyval, _Mappedty&& _Mapval) { return _Insert_or_assign(_Keyval, ::std:: forward<_Mappedty>(_Mapval)); } template <class _Mappedty> pair<iterator, bool> insert_or_assign(key_type&& _Keyval, _Mappedty&& _Mapval) { return _Insert_or_assign(::std:: move(_Keyval), ::std:: forward<_Mappedty>(_Mapval)); } template <class _Mappedty> iterator insert_or_assign(const_iterator _Hint, const key_type& _Keyval, _Mappedty&& _Mapval) { return _Insert_or_assign(_Hint._Ptr, _Keyval, ::std:: forward<_Mappedty>(_Mapval)); } template <class _Mappedty> iterator insert_or_assign(const_iterator _Hint, key_type&& _Keyval, _Mappedty&& _Mapval) { return _Insert_or_assign(_Hint._Ptr, ::std:: move(_Keyval), ::std:: forward<_Mappedty>(_Mapval)); } unordered_map(initializer_list<value_type> _Ilist) : _Mybase(_Key_compare(), allocator_type()) { insert(_Ilist); } unordered_map(initializer_list<value_type> _Ilist, const allocator_type& _Al) : _Mybase(_Key_compare(), _Al) { insert(_Ilist); } unordered_map(initializer_list<value_type> _Ilist, size_type _Buckets) : _Mybase(_Key_compare(), allocator_type()) { _Mybase::rehash(_Buckets); insert(_Ilist); } unordered_map(initializer_list<value_type> _Ilist, size_type _Buckets, const allocator_type& _Al) : _Mybase(_Key_compare(), _Al) { _Mybase::rehash(_Buckets); insert(_Ilist); } unordered_map(initializer_list<value_type> _Ilist, size_type _Buckets, const hasher& _Hasharg) : _Mybase(_Key_compare(_Hasharg), allocator_type()) { _Mybase::rehash(_Buckets); insert(_Ilist); } unordered_map( initializer_list<value_type> _Ilist, size_type _Buckets, const hasher& _Hasharg, const allocator_type& _Al) : _Mybase(_Key_compare(_Hasharg), _Al) { _Mybase::rehash(_Buckets); insert(_Ilist); } unordered_map( initializer_list<value_type> _Ilist, size_type _Buckets, const hasher& _Hasharg, const _Keyeq& _Keyeqarg) : _Mybase(_Key_compare(_Hasharg, _Keyeqarg), allocator_type()) { _Mybase::rehash(_Buckets); insert(_Ilist); } unordered_map(initializer_list<value_type> _Ilist, size_type _Buckets, const hasher& _Hasharg, const _Keyeq& _Keyeqarg, const allocator_type& _Al) : _Mybase(_Key_compare(_Hasharg, _Keyeqarg), _Al) { _Mybase::rehash(_Buckets); insert(_Ilist); } unordered_map& operator=(initializer_list<value_type> _Ilist) { _Mybase::clear(); insert(_Ilist); return *this; } [[nodiscard]] hasher hash_function() const { return _Mybase::_Traitsobj._Mypair._Get_first(); } [[nodiscard]] key_equal key_eq() const { return _Mybase::_Traitsobj._Mypair._Myval2._Get_first(); } mapped_type& operator[](const key_type& _Keyval) { return this->_Try_emplace(_Keyval).first->_Myval.second; } [[nodiscard]] mapped_type& at(const key_type& _Keyval) { const auto _Target = this->_Find_last(_Keyval, this->_Traitsobj(_Keyval)); if (_Target._Duplicate) { return _Target._Duplicate->_Myval.second; } _Xout_of_range("invalid unordered_map<K, T> key"); } [[nodiscard]] const mapped_type& at(const key_type& _Keyval) const { const auto _Target = this->_Find_last(_Keyval, this->_Traitsobj(_Keyval)); if (_Target._Duplicate) { return _Target._Duplicate->_Myval.second; } _Xout_of_range("invalid unordered_map<K, T> key"); } using _Mybase::_Unchecked_begin; using _Mybase::_Unchecked_end; }; template <class _Iter, class _Hasher = hash<_Guide_key_t<_Iter>>, class _Keyeq = equal_to<_Guide_key_t<_Iter>>, class _Alloc = allocator<_Guide_pair_t<_Iter>>, enable_if_t< conjunction_v<_Is_iterator<_Iter>, _Is_hasher<_Hasher>, negation<_Is_allocator<_Keyeq>>, _Is_allocator<_Alloc>>, int> = 0> unordered_map(_Iter, _Iter, _Guide_size_type_t<_Alloc> = 0, _Hasher = _Hasher(), _Keyeq = _Keyeq(), _Alloc = _Alloc()) -> unordered_map<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, _Hasher, _Keyeq, _Alloc>; template <class _Kty, class _Ty, class _Hasher = hash<_Kty>, class _Keyeq = equal_to<_Kty>, class _Alloc = allocator<pair<const _Kty, _Ty>>, enable_if_t<conjunction_v<_Is_hasher<_Hasher>, negation<_Is_allocator<_Keyeq>>, _Is_allocator<_Alloc>>, int> = 0> unordered_map(initializer_list<pair<_Kty, _Ty>>, _Guide_size_type_t<_Alloc> = 0, _Hasher = _Hasher(), _Keyeq = _Keyeq(), _Alloc = _Alloc()) -> unordered_map<_Kty, _Ty, _Hasher, _Keyeq, _Alloc>; template <class _Iter, class _Alloc, enable_if_t<conjunction_v<_Is_iterator<_Iter>, _Is_allocator<_Alloc>>, int> = 0> unordered_map(_Iter, _Iter, _Alloc) -> unordered_map<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, hash<_Guide_key_t<_Iter>>, equal_to<_Guide_key_t<_Iter>>, _Alloc>; template <class _Iter, class _Alloc, enable_if_t<conjunction_v<_Is_iterator<_Iter>, _Is_allocator<_Alloc>>, int> = 0> unordered_map(_Iter, _Iter, _Guide_size_type_t<_Alloc>, _Alloc) -> unordered_map<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, hash<_Guide_key_t<_Iter>>, equal_to<_Guide_key_t<_Iter>>, _Alloc>; template <class _Iter, class _Hasher, class _Alloc, enable_if_t<conjunction_v<_Is_iterator<_Iter>, _Is_hasher<_Hasher>, _Is_allocator<_Alloc>>, int> = 0> unordered_map(_Iter, _Iter, _Guide_size_type_t<_Alloc>, _Hasher, _Alloc) -> unordered_map<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, _Hasher, equal_to<_Guide_key_t<_Iter>>, _Alloc>; template <class _Kty, class _Ty, class _Alloc, enable_if_t<_Is_allocator<_Alloc>::value, int> = 0> unordered_map(initializer_list<pair<_Kty, _Ty>>, _Alloc) -> unordered_map<_Kty, _Ty, hash<_Kty>, equal_to<_Kty>, _Alloc>; template <class _Kty, class _Ty, class _Alloc, enable_if_t<_Is_allocator<_Alloc>::value, int> = 0> unordered_map(initializer_list<pair<_Kty, _Ty>>, _Guide_size_type_t<_Alloc>, _Alloc) -> unordered_map<_Kty, _Ty, hash<_Kty>, equal_to<_Kty>, _Alloc>; template <class _Kty, class _Ty, class _Hasher, class _Alloc, enable_if_t<conjunction_v<_Is_hasher<_Hasher>, _Is_allocator<_Alloc>>, int> = 0> unordered_map(initializer_list<pair<_Kty, _Ty>>, _Guide_size_type_t<_Alloc>, _Hasher, _Alloc) -> unordered_map<_Kty, _Ty, _Hasher, equal_to<_Kty>, _Alloc>; template <class _Kty, class _Ty, class _Hasher, class _Keyeq, class _Alloc> void swap(unordered_map<_Kty, _Ty, _Hasher, _Keyeq, _Alloc>& _Left, unordered_map<_Kty, _Ty, _Hasher, _Keyeq, _Alloc>& _Right) noexcept(noexcept(_Left.swap(_Right))) { _Left.swap(_Right); } template <class _Kty, class _Ty, class _Hasher, class _Keyeq, class _Alloc, class _Pr> typename unordered_map<_Kty, _Ty, _Hasher, _Keyeq, _Alloc>::size_type erase_if( unordered_map<_Kty, _Ty, _Hasher, _Keyeq, _Alloc>& _Cont, _Pr _Pred) { return _Erase_nodes_if(_Cont, _Pass_fn(_Pred)); } template <class _Kty, class _Ty, class _Hasher, class _Keyeq, class _Alloc> [[nodiscard]] bool operator==(const unordered_map<_Kty, _Ty, _Hasher, _Keyeq, _Alloc>& _Left, const unordered_map<_Kty, _Ty, _Hasher, _Keyeq, _Alloc>& _Right) { return _Hash_equal(_Left, _Right); } template <class _Kty, class _Ty, class _Hasher = hash<_Kty>, class _Keyeq = equal_to<_Kty>, class _Alloc = allocator<pair<const _Kty, _Ty>>> class unordered_multimap : public _Hash<_Umap_traits<_Kty, _Ty, _Uhash_compare<_Kty, _Hasher, _Keyeq>, _Alloc, true>> { public: static_assert(!1 || is_same_v<pair<const _Kty, _Ty>, typename _Alloc::value_type>, "unordered_multimap<Key, Value, Hasher, Eq, Allocator>" " requires that Allocator's value_type match " "pair<const Key, Value>" " (See N4659 26.2.1 [container.requirements.general]/16 allocator_type)" " Either fix the allocator value_type or define _ENFORCE_MATCHING_ALLOCATORS=0" " to suppress this diagnostic."); private: using _Mytraits = _Uhash_compare<_Kty, _Hasher, _Keyeq>; using _Mybase = _Hash<_Umap_traits<_Kty, _Ty, _Mytraits, _Alloc, true>>; using _Alnode = typename _Mybase::_Alnode; using _Alnode_traits = typename _Mybase::_Alnode_traits; using _Key_compare = typename _Mybase::_Key_compare; public: using hasher = _Hasher; using key_type = _Kty; using mapped_type = _Ty; using key_equal = _Keyeq; using value_type = pair<const _Kty, _Ty>; using allocator_type = typename _Mybase::allocator_type; using size_type = typename _Mybase::size_type; using difference_type = typename _Mybase::difference_type; using pointer = typename _Mybase::pointer; using const_pointer = typename _Mybase::const_pointer; using reference = value_type&; using const_reference = const value_type&; using iterator = typename _Mybase::iterator; using const_iterator = typename _Mybase::const_iterator; using local_iterator = typename _Mybase::iterator; using const_local_iterator = typename _Mybase::const_iterator; unordered_multimap() : _Mybase(_Key_compare(), allocator_type()) {} explicit unordered_multimap(const allocator_type& _Al) : _Mybase(_Key_compare(), _Al) {} unordered_multimap(const unordered_multimap& _Right) : _Mybase(_Right, _Alnode_traits::select_on_container_copy_construction(_Right._Getal())) {} unordered_multimap(const unordered_multimap& _Right, const allocator_type& _Al) : _Mybase(_Right, _Al) {} explicit unordered_multimap(size_type _Buckets) : _Mybase(_Key_compare(), allocator_type()) { _Mybase::rehash(_Buckets); } unordered_multimap(size_type _Buckets, const allocator_type& _Al) : _Mybase(_Key_compare(), _Al) { _Mybase::rehash(_Buckets); } unordered_multimap(size_type _Buckets, const hasher& _Hasharg) : _Mybase(_Key_compare(_Hasharg), allocator_type()) { _Mybase::rehash(_Buckets); } unordered_multimap(size_type _Buckets, const hasher& _Hasharg, const allocator_type& _Al) : _Mybase(_Key_compare(_Hasharg), _Al) { _Mybase::rehash(_Buckets); } unordered_multimap(size_type _Buckets, const hasher& _Hasharg, const _Keyeq& _Keyeqarg) : _Mybase(_Key_compare(_Hasharg, _Keyeqarg), allocator_type()) { _Mybase::rehash(_Buckets); } unordered_multimap(size_type _Buckets, const hasher& _Hasharg, const _Keyeq& _Keyeqarg, const allocator_type& _Al) : _Mybase(_Key_compare(_Hasharg, _Keyeqarg), _Al) { _Mybase::rehash(_Buckets); } template <class _Iter> unordered_multimap(_Iter _First, _Iter _Last) : _Mybase(_Key_compare(), allocator_type()) { insert(_First, _Last); } template <class _Iter> unordered_multimap(_Iter _First, _Iter _Last, const allocator_type& _Al) : _Mybase(_Key_compare(), _Al) { insert(_First, _Last); } template <class _Iter> unordered_multimap(_Iter _First, _Iter _Last, size_type _Buckets) : _Mybase(_Key_compare(), allocator_type()) { _Mybase::rehash(_Buckets); insert(_First, _Last); } template <class _Iter> unordered_multimap(_Iter _First, _Iter _Last, size_type _Buckets, const allocator_type& _Al) : _Mybase(_Key_compare(), _Al) { _Mybase::rehash(_Buckets); insert(_First, _Last); } template <class _Iter> unordered_multimap(_Iter _First, _Iter _Last, size_type _Buckets, const hasher& _Hasharg) : _Mybase(_Key_compare(_Hasharg), allocator_type()) { _Mybase::rehash(_Buckets); insert(_First, _Last); } template <class _Iter> unordered_multimap(_Iter _First, _Iter _Last, size_type _Buckets, const hasher& _Hasharg, const allocator_type& _Al) : _Mybase(_Key_compare(_Hasharg), _Al) { _Mybase::rehash(_Buckets); insert(_First, _Last); } template <class _Iter> unordered_multimap(_Iter _First, _Iter _Last, size_type _Buckets, const hasher& _Hasharg, const _Keyeq& _Keyeqarg) : _Mybase(_Key_compare(_Hasharg, _Keyeqarg), allocator_type()) { _Mybase::rehash(_Buckets); insert(_First, _Last); } template <class _Iter> unordered_multimap(_Iter _First, _Iter _Last, size_type _Buckets, const hasher& _Hasharg, const _Keyeq& _Keyeqarg, const allocator_type& _Al) : _Mybase(_Key_compare(_Hasharg, _Keyeqarg), _Al) { _Mybase::rehash(_Buckets); insert(_First, _Last); } unordered_multimap& operator=(const unordered_multimap& _Right) { _Mybase::operator=(_Right); return *this; } unordered_multimap(unordered_multimap&& _Right) : _Mybase(::std:: move(_Right)) {} unordered_multimap(unordered_multimap&& _Right, const allocator_type& _Al) : _Mybase(::std:: move(_Right), _Al) {} unordered_multimap& operator=(unordered_multimap&& _Right) noexcept(_Alnode_traits::is_always_equal::value&& is_nothrow_move_assignable_v<_Hasher>&& is_nothrow_move_assignable_v<_Keyeq>) { _Mybase::operator=(::std:: move(_Right)); return *this; } void swap(unordered_multimap& _Right) noexcept(noexcept(_Mybase::swap(_Right))) { _Mybase::swap(_Right); } using _Mybase::insert; template <class _Valty, enable_if_t<is_constructible_v<value_type, _Valty>, int> = 0> iterator insert(_Valty&& _Val) { return this->emplace(::std:: forward<_Valty>(_Val)); } template <class _Valty, enable_if_t<is_constructible_v<value_type, _Valty>, int> = 0> iterator insert(const_iterator _Where, _Valty&& _Val) { return this->emplace_hint(_Where, ::std:: forward<_Valty>(_Val)); } unordered_multimap(initializer_list<value_type> _Ilist) : _Mybase(_Key_compare(), allocator_type()) { insert(_Ilist); } unordered_multimap(initializer_list<value_type> _Ilist, const allocator_type& _Al) : _Mybase(_Key_compare(), _Al) { insert(_Ilist); } unordered_multimap(initializer_list<value_type> _Ilist, size_type _Buckets) : _Mybase(_Key_compare(), allocator_type()) { _Mybase::rehash(_Buckets); insert(_Ilist); } unordered_multimap(initializer_list<value_type> _Ilist, size_type _Buckets, const allocator_type& _Al) : _Mybase(_Key_compare(), _Al) { _Mybase::rehash(_Buckets); insert(_Ilist); } unordered_multimap(initializer_list<value_type> _Ilist, size_type _Buckets, const hasher& _Hasharg) : _Mybase(_Key_compare(_Hasharg), allocator_type()) { _Mybase::rehash(_Buckets); insert(_Ilist); } unordered_multimap( initializer_list<value_type> _Ilist, size_type _Buckets, const hasher& _Hasharg, const allocator_type& _Al) : _Mybase(_Key_compare(_Hasharg), _Al) { _Mybase::rehash(_Buckets); insert(_Ilist); } unordered_multimap( initializer_list<value_type> _Ilist, size_type _Buckets, const hasher& _Hasharg, const _Keyeq& _Keyeqarg) : _Mybase(_Key_compare(_Hasharg, _Keyeqarg), allocator_type()) { _Mybase::rehash(_Buckets); insert(_Ilist); } unordered_multimap(initializer_list<value_type> _Ilist, size_type _Buckets, const hasher& _Hasharg, const _Keyeq& _Keyeqarg, const allocator_type& _Al) : _Mybase(_Key_compare(_Hasharg, _Keyeqarg), _Al) { _Mybase::rehash(_Buckets); insert(_Ilist); } unordered_multimap& operator=(initializer_list<value_type> _Ilist) { _Mybase::clear(); insert(_Ilist); return *this; } [[nodiscard]] hasher hash_function() const { return _Mybase::_Traitsobj._Mypair._Get_first(); } [[nodiscard]] key_equal key_eq() const { return _Mybase::_Traitsobj._Mypair._Myval2._Get_first(); } using _Mybase::_Unchecked_begin; using _Mybase::_Unchecked_end; }; template <class _Iter, class _Hasher = hash<_Guide_key_t<_Iter>>, class _Keyeq = equal_to<_Guide_key_t<_Iter>>, class _Alloc = allocator<_Guide_pair_t<_Iter>>, enable_if_t< conjunction_v<_Is_iterator<_Iter>, _Is_hasher<_Hasher>, negation<_Is_allocator<_Keyeq>>, _Is_allocator<_Alloc>>, int> = 0> unordered_multimap(_Iter, _Iter, _Guide_size_type_t<_Alloc> = 0, _Hasher = _Hasher(), _Keyeq = _Keyeq(), _Alloc = _Alloc()) -> unordered_multimap<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, _Hasher, _Keyeq, _Alloc>; template <class _Kty, class _Ty, class _Hasher = hash<_Kty>, class _Keyeq = equal_to<_Kty>, class _Alloc = allocator<pair<const _Kty, _Ty>>, enable_if_t<conjunction_v<_Is_hasher<_Hasher>, negation<_Is_allocator<_Keyeq>>, _Is_allocator<_Alloc>>, int> = 0> unordered_multimap(initializer_list<pair<_Kty, _Ty>>, _Guide_size_type_t<_Alloc> = 0, _Hasher = _Hasher(), _Keyeq = _Keyeq(), _Alloc = _Alloc()) -> unordered_multimap<_Kty, _Ty, _Hasher, _Keyeq, _Alloc>; template <class _Iter, class _Alloc, enable_if_t<conjunction_v<_Is_iterator<_Iter>, _Is_allocator<_Alloc>>, int> = 0> unordered_multimap(_Iter, _Iter, _Alloc) -> unordered_multimap<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, hash<_Guide_key_t<_Iter>>, equal_to<_Guide_key_t<_Iter>>, _Alloc>; template <class _Iter, class _Alloc, enable_if_t<conjunction_v<_Is_iterator<_Iter>, _Is_allocator<_Alloc>>, int> = 0> unordered_multimap(_Iter, _Iter, _Guide_size_type_t<_Alloc>, _Alloc) -> unordered_multimap<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, hash<_Guide_key_t<_Iter>>, equal_to<_Guide_key_t<_Iter>>, _Alloc>; template <class _Iter, class _Hasher, class _Alloc, enable_if_t<conjunction_v<_Is_iterator<_Iter>, _Is_hasher<_Hasher>, _Is_allocator<_Alloc>>, int> = 0> unordered_multimap(_Iter, _Iter, _Guide_size_type_t<_Alloc>, _Hasher, _Alloc) -> unordered_multimap<_Guide_key_t<_Iter>, _Guide_val_t<_Iter>, _Hasher, equal_to<_Guide_key_t<_Iter>>, _Alloc>; template <class _Kty, class _Ty, class _Alloc, enable_if_t<_Is_allocator<_Alloc>::value, int> = 0> unordered_multimap(initializer_list<pair<_Kty, _Ty>>, _Alloc) -> unordered_multimap<_Kty, _Ty, hash<_Kty>, equal_to<_Kty>, _Alloc>; template <class _Kty, class _Ty, class _Alloc, enable_if_t<_Is_allocator<_Alloc>::value, int> = 0> unordered_multimap(initializer_list<pair<_Kty, _Ty>>, _Guide_size_type_t<_Alloc>, _Alloc) -> unordered_multimap<_Kty, _Ty, hash<_Kty>, equal_to<_Kty>, _Alloc>; template <class _Kty, class _Ty, class _Hasher, class _Alloc, enable_if_t<conjunction_v<_Is_hasher<_Hasher>, _Is_allocator<_Alloc>>, int> = 0> unordered_multimap(initializer_list<pair<_Kty, _Ty>>, _Guide_size_type_t<_Alloc>, _Hasher, _Alloc) -> unordered_multimap<_Kty, _Ty, _Hasher, equal_to<_Kty>, _Alloc>; template <class _Kty, class _Ty, class _Hasher, class _Keyeq, class _Alloc> void swap(unordered_multimap<_Kty, _Ty, _Hasher, _Keyeq, _Alloc>& _Left, unordered_multimap<_Kty, _Ty, _Hasher, _Keyeq, _Alloc>& _Right) noexcept(noexcept(_Left.swap(_Right))) { _Left.swap(_Right); } template <class _Kty, class _Ty, class _Hasher, class _Keyeq, class _Alloc, class _Pr> typename unordered_multimap<_Kty, _Ty, _Hasher, _Keyeq, _Alloc>::size_type erase_if( unordered_multimap<_Kty, _Ty, _Hasher, _Keyeq, _Alloc>& _Cont, _Pr _Pred) { return _Erase_nodes_if(_Cont, _Pass_fn(_Pred)); } template <class _Kty, class _Ty, class _Hasher, class _Keyeq, class _Alloc> [[nodiscard]] bool operator==(const unordered_multimap<_Kty, _Ty, _Hasher, _Keyeq, _Alloc>& _Left, const unordered_multimap<_Kty, _Ty, _Hasher, _Keyeq, _Alloc>& _Right) { return _Hash_equal(_Left, _Right); } namespace pmr { template <class _Kty, class _Ty, class _Hasher = hash<_Kty>, class _Keyeq = equal_to<_Kty>> using unordered_map = ::std:: unordered_map<_Kty, _Ty, _Hasher, _Keyeq, polymorphic_allocator<pair<const _Kty, _Ty>>>; template <class _Kty, class _Ty, class _Hasher = hash<_Kty>, class _Keyeq = equal_to<_Kty>> using unordered_multimap = ::std:: unordered_multimap<_Kty, _Ty, _Hasher, _Keyeq, polymorphic_allocator<pair<const _Kty, _Ty>>>; } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { template <class _Ty = void> struct divides { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_first_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_second_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_result; [[nodiscard]] constexpr _Ty operator()(const _Ty& _Left, const _Ty& _Right) const { return _Left / _Right; } }; template <class _Ty = void> struct modulus { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_first_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_second_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_result; [[nodiscard]] constexpr _Ty operator()(const _Ty& _Left, const _Ty& _Right) const { return _Left % _Right; } }; template <class _Ty = void> struct negate { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_result; [[nodiscard]] constexpr _Ty operator()(const _Ty& _Left) const { return -_Left; } }; template <class _Ty = void> struct logical_and { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_first_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_second_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef bool _Unnameable_result; [[nodiscard]] constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const { return _Left && _Right; } }; template <class _Ty = void> struct logical_or { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_first_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_second_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef bool _Unnameable_result; [[nodiscard]] constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const { return _Left || _Right; } }; template <class _Ty = void> struct logical_not { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef bool _Unnameable_result; [[nodiscard]] constexpr bool operator()(const _Ty& _Left) const { return !_Left; } }; template <class _Ty = void> struct bit_and { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_first_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_second_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_result; [[nodiscard]] constexpr _Ty operator()(const _Ty& _Left, const _Ty& _Right) const { return _Left & _Right; } }; template <class _Ty = void> struct bit_or { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_first_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_second_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_result; [[nodiscard]] constexpr _Ty operator()(const _Ty& _Left, const _Ty& _Right) const { return _Left | _Right; } }; template <class _Ty = void> struct bit_xor { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_first_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_second_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_result; [[nodiscard]] constexpr _Ty operator()(const _Ty& _Left, const _Ty& _Right) const { return _Left ^ _Right; } }; template <class _Ty = void> struct bit_not { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ty _Unnameable_result; [[nodiscard]] constexpr _Ty operator()(const _Ty& _Left) const { return ~_Left; } }; template <> struct divides<void> { template <class _Ty1, class _Ty2> [[nodiscard]] constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const -> decltype(::std:: forward<_Ty1>(_Left) / ::std:: forward<_Ty2>(_Right)) { return ::std:: forward<_Ty1>(_Left) / ::std:: forward<_Ty2>(_Right); } using is_transparent = int; }; template <> struct modulus<void> { template <class _Ty1, class _Ty2> [[nodiscard]] constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const -> decltype(::std:: forward<_Ty1>(_Left) % ::std:: forward<_Ty2>(_Right)) { return ::std:: forward<_Ty1>(_Left) % ::std:: forward<_Ty2>(_Right); } using is_transparent = int; }; template <> struct negate<void> { template <class _Ty> [[nodiscard]] constexpr auto operator()(_Ty&& _Left) const -> decltype(-::std:: forward<_Ty>(_Left)) { return -::std:: forward<_Ty>(_Left); } using is_transparent = int; }; template <> struct logical_and<void> { template <class _Ty1, class _Ty2> [[nodiscard]] constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const -> decltype(::std:: forward<_Ty1>(_Left) && ::std:: forward<_Ty2>(_Right)) { return ::std:: forward<_Ty1>(_Left) && ::std:: forward<_Ty2>(_Right); } using is_transparent = int; }; template <> struct logical_or<void> { template <class _Ty1, class _Ty2> [[nodiscard]] constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const -> decltype(::std:: forward<_Ty1>(_Left) || ::std:: forward<_Ty2>(_Right)) { return ::std:: forward<_Ty1>(_Left) || ::std:: forward<_Ty2>(_Right); } using is_transparent = int; }; template <> struct logical_not<void> { template <class _Ty> [[nodiscard]] constexpr auto operator()(_Ty&& _Left) const -> decltype(!::std:: forward<_Ty>(_Left)) { return !::std:: forward<_Ty>(_Left); } using is_transparent = int; }; template <> struct bit_and<void> { template <class _Ty1, class _Ty2> [[nodiscard]] constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const -> decltype(::std:: forward<_Ty1>(_Left) & ::std:: forward<_Ty2>(_Right)) { return ::std:: forward<_Ty1>(_Left) & ::std:: forward<_Ty2>(_Right); } using is_transparent = int; }; template <> struct bit_or<void> { template <class _Ty1, class _Ty2> [[nodiscard]] constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const -> decltype(::std:: forward<_Ty1>(_Left) | ::std:: forward<_Ty2>(_Right)) { return ::std:: forward<_Ty1>(_Left) | ::std:: forward<_Ty2>(_Right); } using is_transparent = int; }; template <> struct bit_xor<void> { template <class _Ty1, class _Ty2> [[nodiscard]] constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const -> decltype(::std:: forward<_Ty1>(_Left) ^ ::std:: forward<_Ty2>(_Right)) { return ::std:: forward<_Ty1>(_Left) ^ ::std:: forward<_Ty2>(_Right); } using is_transparent = int; }; template <> struct bit_not<void> { template <class _Ty> [[nodiscard]] constexpr auto operator()(_Ty&& _Left) const -> decltype(~::std:: forward<_Ty>(_Left)) { return ~::std:: forward<_Ty>(_Left); } using is_transparent = int; }; template <class _Memptr> class _Mem_fn : public _Weak_types<_Memptr> { private: _Memptr _Pm; public: constexpr explicit _Mem_fn(_Memptr _Val) noexcept : _Pm(_Val) {} template <class... _Types> constexpr auto operator()(_Types&&... _Args) const noexcept(noexcept(::std:: invoke(_Pm, ::std:: forward<_Types>(_Args)...))) -> decltype(::std:: invoke(_Pm, ::std:: forward<_Types>(_Args)...)) { return ::std:: invoke(_Pm, ::std:: forward<_Types>(_Args)...); } }; template <class _Rx, class _Ty> [[nodiscard]] constexpr _Mem_fn<_Rx _Ty::*> mem_fn(_Rx _Ty::*_Pm) noexcept { return _Mem_fn<_Rx _Ty::*>(_Pm); } struct _Not_fn_tag { explicit _Not_fn_tag() = default; }; template <class _Decayed> class _Not_fn : private _Ebco_base<_Decayed> { private: using _Mybase = _Ebco_base<_Decayed>; public: template <class _Callable, class _Tag, enable_if_t<is_same_v<_Tag, _Not_fn_tag>, int> = 0> constexpr explicit _Not_fn(_Callable&& _Obj, _Tag) noexcept( is_nothrow_constructible_v<_Decayed, _Callable>) : _Mybase(::std:: forward<_Callable>(_Obj)) {} constexpr _Not_fn(const _Not_fn&) = default; constexpr _Not_fn(_Not_fn&&) = default; template <class... _Types> constexpr auto operator()(_Types&&... _Args) & noexcept( noexcept(!::std:: invoke(this->_Get_val(), ::std:: forward<_Types>(_Args)...))) -> decltype(!::std:: declval<invoke_result_t<_Decayed&, _Types...>>()) { return !::std:: invoke(this->_Get_val(), ::std:: forward<_Types>(_Args)...); } template <class... _Types> constexpr auto operator()(_Types&&... _Args) const& noexcept( noexcept(!::std:: invoke(this->_Get_val(), ::std:: forward<_Types>(_Args)...))) -> decltype(!::std:: declval<invoke_result_t<const _Decayed&, _Types...>>()) { return !::std:: invoke(this->_Get_val(), ::std:: forward<_Types>(_Args)...); } template <class... _Types> constexpr auto operator()(_Types&&... _Args) && noexcept( noexcept(!::std:: invoke(::std:: move(this->_Get_val()), ::std:: forward<_Types>(_Args)...))) -> decltype(!::std:: declval<invoke_result_t<_Decayed, _Types...>>()) { return !::std:: invoke(::std:: move(this->_Get_val()), ::std:: forward<_Types>(_Args)...); } template <class... _Types> constexpr auto operator()(_Types&&... _Args) const&& noexcept( noexcept(!::std:: invoke(::std:: move(this->_Get_val()), ::std:: forward<_Types>(_Args)...))) -> decltype(!::std:: declval<invoke_result_t<const _Decayed, _Types...>>()) { return !::std:: invoke(::std:: move(this->_Get_val()), ::std:: forward<_Types>(_Args)...); } }; template <class _Callable> [[nodiscard]] constexpr _Not_fn<decay_t<_Callable>> not_fn(_Callable&& _Obj) noexcept( is_nothrow_constructible_v<decay_t<_Callable>, _Callable>) { return _Not_fn<decay_t<_Callable>>(::std:: forward<_Callable>(_Obj), _Not_fn_tag{}); } class bad_function_call : public exception { public: bad_function_call() noexcept {} [[nodiscard]] virtual const char* what() const noexcept override { return "bad function call"; } }; [[noreturn]] void __cdecl _Xbad_function_call(); struct _Unforced { explicit _Unforced() = default; }; template <class _Rx, bool = is_void_v<_Rx>> struct _Invoker_ret { template <class _Fx, class... _Valtys> static constexpr void _Call(_Fx&& _Func, _Valtys&&... _Vals) noexcept(_Select_invoke_traits<_Fx, _Valtys...>::_Is_nothrow_invocable::value) { ::std:: invoke(static_cast<_Fx&&>(_Func), static_cast<_Valtys&&>(_Vals)...); } }; template <class _Rx> struct _Invoker_ret<_Rx, false> { template <class _Fx, class... _Valtys> static constexpr _Rx _Call(_Fx&& _Func, _Valtys&&... _Vals) noexcept(_Select_invoke_traits<_Fx, _Valtys...>::template _Is_nothrow_invocable_r<_Rx>::value) { return ::std:: invoke(static_cast<_Fx&&>(_Func), static_cast<_Valtys&&>(_Vals)...); } }; template <> struct _Invoker_ret<_Unforced, false> { template <class _Fx, class... _Valtys> static constexpr auto _Call(_Fx&& _Func, _Valtys&&... _Vals) noexcept( _Select_invoke_traits<_Fx, _Valtys...>::_Is_nothrow_invocable::value) -> decltype(::std:: invoke(static_cast<_Fx&&>(_Func), static_cast<_Valtys&&>(_Vals)...)) { return ::std:: invoke(static_cast<_Fx&&>(_Func), static_cast<_Valtys&&>(_Vals)...); } }; template <class _Fty> class function; template <class _Ty> inline constexpr bool _Testable_callable_v = disjunction_v<is_pointer<_Ty>, _Is_specialization<_Ty, function>, is_member_pointer<_Ty>>; template <class _Ty> bool _Test_callable(const _Ty& _Arg) noexcept { if constexpr (_Testable_callable_v<_Ty>) { return !!_Arg; } else { return true; } } template <class _Rx, class... _Types> class __declspec(novtable) _Func_base { public: virtual _Func_base* _Copy(void*) const = 0; virtual _Func_base* _Move(void*) noexcept = 0; virtual _Rx _Do_call(_Types&&...) = 0; virtual const type_info& _Target_type() const noexcept = 0; virtual void _Delete_this(bool) noexcept = 0; const void* _Target(const type_info& _Info) const noexcept { return _Target_type() == _Info ? _Get() : nullptr; } _Func_base() = default; _Func_base(const _Func_base&) = delete; _Func_base& operator=(const _Func_base&) = delete; private: virtual const void* _Get() const noexcept = 0; }; constexpr size_t _Space_size = (_Small_object_num_ptrs - 1) * sizeof(void*); template <class _Impl> inline constexpr bool _Is_large = sizeof(_Impl) > _Space_size || alignof(_Impl) > alignof(max_align_t) || !_Impl::_Nothrow_move::value; template <class _Callable, class _Rx, class... _Types> class _Func_impl_no_alloc final : public _Func_base<_Rx, _Types...> { public: using _Mybase = _Func_base<_Rx, _Types...>; using _Nothrow_move = is_nothrow_move_constructible<_Callable>; template <class _Other, enable_if_t<!is_same_v<_Func_impl_no_alloc, decay_t<_Other>>, int> = 0> explicit _Func_impl_no_alloc(_Other&& _Val) : _Callee(::std:: forward<_Other>(_Val)) {} private: virtual _Mybase* _Copy(void* _Where) const override { if constexpr (_Is_large<_Func_impl_no_alloc>) { (void) _Where; return _Global_new<_Func_impl_no_alloc>(_Callee); } else { return ::new (_Where) _Func_impl_no_alloc(_Callee); } } virtual _Mybase* _Move(void* _Where) noexcept override { if constexpr (_Is_large<_Func_impl_no_alloc>) { (void) _Where; return nullptr; } else { return ::new (_Where) _Func_impl_no_alloc(::std:: move(_Callee)); } } virtual _Rx _Do_call(_Types&&... _Args) override { return _Invoker_ret<_Rx>::_Call(_Callee, ::std:: forward<_Types>(_Args)...); } virtual const type_info& _Target_type() const noexcept override { return typeid(_Callable); } virtual const void* _Get() const noexcept override { return ::std:: addressof(_Callee); } virtual void _Delete_this(bool _Dealloc) noexcept override { this->~_Func_impl_no_alloc(); if (_Dealloc) { _Deallocate<alignof(_Func_impl_no_alloc)>(this, sizeof(_Func_impl_no_alloc)); } } _Callable _Callee; }; template <class _Ret, class... _Types> class _Func_class : public _Arg_types<_Types...> { public: using result_type = _Ret; using _Ptrt = _Func_base<_Ret, _Types...>; _Func_class() noexcept { _Set(nullptr); } _Ret operator()(_Types... _Args) const { if (_Empty()) { _Xbad_function_call(); } const auto _Impl = _Getimpl(); return _Impl->_Do_call(::std:: forward<_Types>(_Args)...); } ~_Func_class() noexcept { _Tidy(); } protected: template <class _Fx, class _Function> using _Enable_if_callable_t = enable_if_t<conjunction_v<negation<is_same<decay_t<_Fx>, _Function>>, _Is_invocable_r<_Ret, _Fx, _Types...>>, int>; bool _Empty() const noexcept { return !_Getimpl(); } void _Reset_copy(const _Func_class& _Right) { if (!_Right._Empty()) { _Set(_Right._Getimpl()->_Copy(&_Mystorage)); } } void _Reset_move(_Func_class&& _Right) noexcept { if (!_Right._Empty()) { if (_Right._Local()) { _Set(_Right._Getimpl()->_Move(&_Mystorage)); _Right._Tidy(); } else { _Set(_Right._Getimpl()); _Right._Set(nullptr); } } } template <class _Fx> void _Reset(_Fx&& _Val) { if (!_Test_callable(_Val)) { return; } using _Impl = _Func_impl_no_alloc<decay_t<_Fx>, _Ret, _Types...>; if constexpr (_Is_large<_Impl>) { _Set(_Global_new<_Impl>(::std:: forward<_Fx>(_Val))); } else { _Set(::new (static_cast<void*>(&_Mystorage)) _Impl(::std:: forward<_Fx>(_Val))); } } void _Tidy() noexcept { if (!_Empty()) { _Getimpl()->_Delete_this(!_Local()); _Set(nullptr); } } void _Swap(_Func_class& _Right) noexcept { if (!_Local() && !_Right._Local()) { _Ptrt* _Temp = _Getimpl(); _Set(_Right._Getimpl()); _Right._Set(_Temp); } else { _Func_class _Temp; _Temp._Reset_move(::std:: move(*this)); _Reset_move(::std:: move(_Right)); _Right._Reset_move(::std:: move(_Temp)); } } const type_info& _Target_type() const noexcept { return _Getimpl() ? _Getimpl()->_Target_type() : typeid(void); } const void* _Target(const type_info& _Info) const noexcept { return _Getimpl() ? _Getimpl()->_Target(_Info) : nullptr; } private: bool _Local() const noexcept { return _Getimpl() == static_cast<const void*>(&_Mystorage); } union _Storage { max_align_t _Dummy1; char _Dummy2[_Space_size]; _Ptrt* _Ptrs[_Small_object_num_ptrs]; }; _Storage _Mystorage; enum { _EEN_IMPL = _Small_object_num_ptrs - 1 }; _Ptrt* _Getimpl() const noexcept { return _Mystorage._Ptrs[_Small_object_num_ptrs - 1]; } void _Set(_Ptrt* _Ptr) noexcept { _Mystorage._Ptrs[_Small_object_num_ptrs - 1] = _Ptr; } }; template <class _Tx> struct _Get_function_impl { static_assert(_Always_false<_Tx>, "std::function does not accept non-function types as template arguments."); }; template <class _Ret, class... _Types> struct _Get_function_impl<_Ret __cdecl(_Types...)> { using type = _Func_class<_Ret, _Types...>; }; template <class _Ret, class... _Types> struct _Get_function_impl<_Ret __vectorcall(_Types...)> { using type = _Func_class<_Ret, _Types...>; }; template <class _Ret, class... _Types> struct _Get_function_impl<_Ret __cdecl(_Types...) noexcept> { static_assert( _Always_false<_Ret>, "std::function does not accept noexcept function types as template arguments."); }; template <class _Ret, class... _Types> struct _Get_function_impl<_Ret __vectorcall(_Types...) noexcept> { static_assert( _Always_false<_Ret>, "std::function does not accept noexcept function types as template arguments."); }; template <class _Fty> class function : public _Get_function_impl<_Fty>::type { private: using _Mybase = typename _Get_function_impl<_Fty>::type; public: function() noexcept {} function(nullptr_t) noexcept {} function(const function& _Right) { this->_Reset_copy(_Right); } template <class _Fx, typename _Mybase::template _Enable_if_callable_t<_Fx&, function> = 0> function(_Fx _Func) { this->_Reset(::std:: move(_Func)); } function& operator=(const function& _Right) { function(_Right).swap(*this); return *this; } function(function&& _Right) noexcept { this->_Reset_move(::std:: move(_Right)); } function& operator=(function&& _Right) noexcept { if (this != ::std:: addressof(_Right)) { this->_Tidy(); this->_Reset_move(::std:: move(_Right)); } return *this; } template <class _Fx, typename _Mybase::template _Enable_if_callable_t<decay_t<_Fx>&, function> = 0> function& operator=(_Fx&& _Func) { function(::std:: forward<_Fx>(_Func)).swap(*this); return *this; } function& operator=(nullptr_t) noexcept { this->_Tidy(); return *this; } template <class _Fx> function& operator=(reference_wrapper<_Fx> _Func) noexcept { this->_Tidy(); this->_Reset(_Func); return *this; } void swap(function& _Right) noexcept { this->_Swap(_Right); } explicit operator bool() const noexcept { return !this->_Empty(); } [[nodiscard]] const type_info& target_type() const noexcept { return this->_Target_type(); } template <class _Fx> [[nodiscard]] _Fx* target() noexcept { return reinterpret_cast<_Fx*>(const_cast<void*>(this->_Target(typeid(_Fx)))); } template <class _Fx> [[nodiscard]] const _Fx* target() const noexcept { return reinterpret_cast<const _Fx*>(this->_Target(typeid(_Fx))); } }; template <class _Ret, class... _Types> function(_Ret(__cdecl*)(_Types...)) -> function<_Ret(_Types...)>; template <class _Ret, class... _Types> function(_Ret(__vectorcall*)(_Types...)) -> function<_Ret(_Types...)>; template <class _Fx, class = void> struct _Deduce_signature {}; template <class _Fx> struct _Deduce_signature<_Fx, void_t<decltype(&_Fx::operator())>> : _Is_memfunptr<decltype(&_Fx::operator())>::_Guide_type {}; template <class _Fx> function(_Fx) -> function<typename _Deduce_signature<_Fx>::type>; template <class _Fty> void swap(function<_Fty>& _Left, function<_Fty>& _Right) noexcept { _Left.swap(_Right); } template <class _Fty> [[nodiscard]] bool operator==(const function<_Fty>& _Other, nullptr_t) noexcept { return !_Other; } template <int _Nx> struct _Ph { static_assert(_Nx > 0, "invalid placeholder index"); }; template <class _Tx> struct is_placeholder : integral_constant<int, 0> {}; template <int _Nx> struct is_placeholder<_Ph<_Nx>> : integral_constant<int, _Nx> {}; template <class _Tx> struct is_placeholder<const _Tx> : is_placeholder<_Tx>::type {}; template <class _Tx> struct is_placeholder<volatile _Tx> : is_placeholder<_Tx>::type {}; template <class _Tx> struct is_placeholder<const volatile _Tx> : is_placeholder<_Tx>::type {}; template <class _Ty> inline constexpr int is_placeholder_v = is_placeholder<_Ty>::value; template <class _Ret, class _Fx, class... _Types> class _Binder; template <class _Tx> struct is_bind_expression : false_type {}; template <class _Ret, class _Fx, class... _Types> struct is_bind_expression<_Binder<_Ret, _Fx, _Types...>> : true_type {}; template <class _Tx> struct is_bind_expression<const _Tx> : is_bind_expression<_Tx>::type {}; template <class _Tx> struct is_bind_expression<volatile _Tx> : is_bind_expression<_Tx>::type {}; template <class _Tx> struct is_bind_expression<const volatile _Tx> : is_bind_expression<_Tx>::type {}; template <class _Ty> inline constexpr bool is_bind_expression_v = is_bind_expression<_Ty>::value; template <class _Cv_TiD, bool = _Is_specialization_v<remove_cv_t<_Cv_TiD>, reference_wrapper>, bool = is_bind_expression_v<_Cv_TiD>, int = is_placeholder_v<_Cv_TiD>> struct _Select_fixer; template <class _Cv_TiD> struct _Select_fixer<_Cv_TiD, true, false, 0> { template <class _Untuple> static constexpr auto _Fix(_Cv_TiD& _Tid, _Untuple&&) noexcept -> typename _Cv_TiD::type& { return _Tid.get(); } }; template <class _Cv_TiD> struct _Select_fixer<_Cv_TiD, false, true, 0> { template <class _Untuple, size_t... _Jx> static constexpr auto _Apply(_Cv_TiD& _Tid, _Untuple&& _Ut, index_sequence<_Jx...>) noexcept( noexcept(_Tid(::std:: get<_Jx>(::std:: move(_Ut))...))) -> decltype(_Tid(::std:: get<_Jx>(::std:: move(_Ut))...)) { return _Tid(::std:: get<_Jx>(::std:: move(_Ut))...); } template <class _Untuple> static constexpr auto _Fix(_Cv_TiD& _Tid, _Untuple&& _Ut) noexcept( noexcept(_Apply(_Tid, ::std:: move(_Ut), make_index_sequence<tuple_size_v<_Untuple>>{}))) -> decltype(_Apply(_Tid, ::std:: move(_Ut), make_index_sequence<tuple_size_v<_Untuple>>{})) { return _Apply(_Tid, ::std:: move(_Ut), make_index_sequence<tuple_size_v<_Untuple>>{}); } }; template <class _Cv_TiD> struct _Select_fixer<_Cv_TiD, false, false, 0> { template <class _Untuple> static constexpr _Cv_TiD& _Fix(_Cv_TiD& _Tid, _Untuple&&) noexcept { return _Tid; } }; template <class _Cv_TiD, int _Jx> struct _Select_fixer<_Cv_TiD, false, false, _Jx> { static_assert(_Jx > 0, "invalid is_placeholder value"); template <class _Untuple> static constexpr auto _Fix(_Cv_TiD&, _Untuple&& _Ut) noexcept -> decltype(::std:: get<_Jx - 1>(::std:: move(_Ut))) { return ::std:: get<_Jx - 1>(::std:: move(_Ut)); } }; template <class _Cv_TiD, class _Untuple> constexpr auto _Fix_arg(_Cv_TiD& _Tid, _Untuple&& _Ut) noexcept( noexcept(_Select_fixer<_Cv_TiD>::_Fix(_Tid, ::std:: move(_Ut)))) -> decltype(_Select_fixer<_Cv_TiD>::_Fix(_Tid, ::std:: move(_Ut))) { return _Select_fixer<_Cv_TiD>::_Fix(_Tid, ::std:: move(_Ut)); } template <class _Ret, size_t... _Ix, class _Cv_FD, class _Cv_tuple_TiD, class _Untuple> constexpr auto _Call_binder(_Invoker_ret<_Ret>, index_sequence<_Ix...>, _Cv_FD& _Obj, _Cv_tuple_TiD& _Tpl, _Untuple&& _Ut) noexcept(noexcept(_Invoker_ret<_Ret>::_Call(_Obj, _Fix_arg(::std:: get<_Ix>(_Tpl), ::std:: move(_Ut))...))) -> decltype(_Invoker_ret<_Ret>::_Call(_Obj, _Fix_arg(::std:: get<_Ix>(_Tpl), ::std:: move(_Ut))...)) { return _Invoker_ret<_Ret>::_Call(_Obj, _Fix_arg(::std:: get<_Ix>(_Tpl), ::std:: move(_Ut))...); } template <class _Ret> struct _Forced_result_type { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef _Ret _Unnameable_result; }; template <class _Ret, class _Fx> struct _Binder_result_type { using _Decayed = decay_t<_Fx>; using _All_weak_types = _Weak_types<_Decayed>; using type = conditional_t<is_same_v<_Ret, _Unforced>, _Weak_result_type<_All_weak_types>, _Forced_result_type<_Ret>>; }; template <class _Ret, class _Fx, class... _Types> class _Binder : public _Binder_result_type<_Ret, _Fx>::type { private: using _Seq = index_sequence_for<_Types...>; using _First = decay_t<_Fx>; using _Second = tuple<decay_t<_Types>...>; _Compressed_pair<_First, _Second> _Mypair; public: constexpr explicit _Binder(_Fx&& _Func, _Types&&... _Args) : _Mypair(_One_then_variadic_args_t{}, ::std:: forward<_Fx>(_Func), ::std:: forward<_Types>(_Args)...) {} template <class... _Unbound> constexpr auto operator()(_Unbound&&... _Unbargs) noexcept(noexcept(_Call_binder(_Invoker_ret<_Ret>{}, _Seq{}, _Mypair._Get_first(), _Mypair._Myval2, ::std:: forward_as_tuple(::std:: forward<_Unbound>(_Unbargs)...)))) -> decltype(_Call_binder(_Invoker_ret<_Ret>{}, _Seq{}, _Mypair._Get_first(), _Mypair._Myval2, ::std:: forward_as_tuple(::std:: forward<_Unbound>(_Unbargs)...))) { return _Call_binder(_Invoker_ret<_Ret>{}, _Seq{}, _Mypair._Get_first(), _Mypair._Myval2, ::std:: forward_as_tuple(::std:: forward<_Unbound>(_Unbargs)...)); } template <class... _Unbound> constexpr auto operator()(_Unbound&&... _Unbargs) const noexcept(noexcept(_Call_binder(_Invoker_ret<_Ret>{}, _Seq{}, _Mypair._Get_first(), _Mypair._Myval2, ::std:: forward_as_tuple(::std:: forward<_Unbound>(_Unbargs)...)))) -> decltype(_Call_binder(_Invoker_ret<_Ret>{}, _Seq{}, _Mypair._Get_first(), _Mypair._Myval2, ::std:: forward_as_tuple(::std:: forward<_Unbound>(_Unbargs)...))) { return _Call_binder(_Invoker_ret<_Ret>{}, _Seq{}, _Mypair._Get_first(), _Mypair._Myval2, ::std:: forward_as_tuple(::std:: forward<_Unbound>(_Unbargs)...)); } }; template <class _Fx, class... _Types> [[nodiscard]] constexpr _Binder<_Unforced, _Fx, _Types...> bind(_Fx&& _Func, _Types&&... _Args) { return _Binder<_Unforced, _Fx, _Types...>(::std:: forward<_Fx>(_Func), ::std:: forward<_Types>(_Args)...); } template <class _Ret, class _Fx, class... _Types> [[nodiscard]] constexpr _Binder<_Ret, _Fx, _Types...> bind(_Fx&& _Func, _Types&&... _Args) { return _Binder<_Ret, _Fx, _Types...>(::std:: forward<_Fx>(_Func), ::std:: forward<_Types>(_Args)...); } namespace placeholders { inline constexpr _Ph<1> _1{}; inline constexpr _Ph<2> _2{}; inline constexpr _Ph<3> _3{}; inline constexpr _Ph<4> _4{}; inline constexpr _Ph<5> _5{}; inline constexpr _Ph<6> _6{}; inline constexpr _Ph<7> _7{}; inline constexpr _Ph<8> _8{}; inline constexpr _Ph<9> _9{}; inline constexpr _Ph<10> _10{}; inline constexpr _Ph<11> _11{}; inline constexpr _Ph<12> _12{}; inline constexpr _Ph<13> _13{}; inline constexpr _Ph<14> _14{}; inline constexpr _Ph<15> _15{}; inline constexpr _Ph<16> _16{}; inline constexpr _Ph<17> _17{}; inline constexpr _Ph<18> _18{}; inline constexpr _Ph<19> _19{}; inline constexpr _Ph<20> _20{}; } template <size_t... _Ix, class _Cv_FD, class _Cv_tuple_TiD, class... _Unbound> constexpr auto _Call_front_binder(index_sequence<_Ix...>, _Cv_FD&& _Obj, _Cv_tuple_TiD&& _Tpl, _Unbound&&... _Unbargs) noexcept(noexcept(::std:: invoke(::std:: forward<_Cv_FD>(_Obj), ::std:: get<_Ix>(::std:: forward<_Cv_tuple_TiD>(_Tpl))..., ::std:: forward<_Unbound>(_Unbargs)...))) -> decltype(::std:: invoke(::std:: forward<_Cv_FD>(_Obj), ::std:: get<_Ix>(::std:: forward<_Cv_tuple_TiD>(_Tpl))..., ::std:: forward<_Unbound>(_Unbargs)...)) { return ::std:: invoke(::std:: forward<_Cv_FD>(_Obj), ::std:: get<_Ix>(::std:: forward<_Cv_tuple_TiD>(_Tpl))..., ::std:: forward<_Unbound>(_Unbargs)...); } template <class _Fx, class... _Types> class _Front_binder { private: using _Seq = index_sequence_for<_Types...>; _Compressed_pair<_Fx, tuple<_Types...>> _Mypair; ; ; public: template <class _FxInit, class... _TypesInit, enable_if_t<sizeof...(_TypesInit) != 0 || !is_same_v<remove_cvref_t<_FxInit>, _Front_binder>, int> = 0> constexpr explicit _Front_binder(_FxInit&& _Func, _TypesInit&&... _Args) : _Mypair(_One_then_variadic_args_t{}, ::std:: forward<_FxInit>(_Func), ::std:: forward<_TypesInit>(_Args)...) {} template <class... _Unbound> constexpr auto operator()(_Unbound&&... _Unbargs) & noexcept(noexcept( _Call_front_binder(_Seq{}, _Mypair._Get_first(), _Mypair._Myval2, ::std:: forward<_Unbound>(_Unbargs)...))) -> decltype( _Call_front_binder(_Seq{}, _Mypair._Get_first(), _Mypair._Myval2, ::std:: forward<_Unbound>(_Unbargs)...)) { return _Call_front_binder(_Seq{}, _Mypair._Get_first(), _Mypair._Myval2, ::std:: forward<_Unbound>(_Unbargs)...); } template <class... _Unbound> constexpr auto operator()(_Unbound&&... _Unbargs) const& noexcept(noexcept( _Call_front_binder(_Seq{}, _Mypair._Get_first(), _Mypair._Myval2, ::std:: forward<_Unbound>(_Unbargs)...))) -> decltype( _Call_front_binder(_Seq{}, _Mypair._Get_first(), _Mypair._Myval2, ::std:: forward<_Unbound>(_Unbargs)...)) { return _Call_front_binder(_Seq{}, _Mypair._Get_first(), _Mypair._Myval2, ::std:: forward<_Unbound>(_Unbargs)...); } template <class... _Unbound> constexpr auto operator()(_Unbound&&... _Unbargs) && noexcept(noexcept(_Call_front_binder( _Seq{}, ::std:: move(_Mypair._Get_first()), ::std:: move(_Mypair._Myval2), ::std:: forward<_Unbound>(_Unbargs)...))) -> decltype(_Call_front_binder( _Seq{}, ::std:: move(_Mypair._Get_first()), ::std:: move(_Mypair._Myval2), ::std:: forward<_Unbound>(_Unbargs)...)) { return _Call_front_binder( _Seq{}, ::std:: move(_Mypair._Get_first()), ::std:: move(_Mypair._Myval2), ::std:: forward<_Unbound>(_Unbargs)...); } template <class... _Unbound> constexpr auto operator()(_Unbound&&... _Unbargs) const&& noexcept(noexcept(_Call_front_binder( _Seq{}, ::std:: move(_Mypair._Get_first()), ::std:: move(_Mypair._Myval2), ::std:: forward<_Unbound>(_Unbargs)...))) -> decltype(_Call_front_binder( _Seq{}, ::std:: move(_Mypair._Get_first()), ::std:: move(_Mypair._Myval2), ::std:: forward<_Unbound>(_Unbargs)...)) { return _Call_front_binder( _Seq{}, ::std:: move(_Mypair._Get_first()), ::std:: move(_Mypair._Myval2), ::std:: forward<_Unbound>(_Unbargs)...); } }; template <class _Fx, class... _Types> [[nodiscard]] constexpr auto bind_front(_Fx&& _Func, _Types&&... _Args) { static_assert(is_constructible_v<decay_t<_Fx>, _Fx>, "std::bind_front requires the decayed callable to be constructible from an undecayed callable"); static_assert(is_move_constructible_v<decay_t<_Fx>>, "std::bind_front requires the decayed callable to be move constructible"); static_assert(conjunction_v<is_constructible<decay_t<_Types>, _Types>...>, "std::bind_front requires the decayed bound arguments to be constructible from undecayed bound arguments"); static_assert(conjunction_v<is_move_constructible<decay_t<_Types>>...>, "std::bind_front requires the decayed bound arguments to be move constructible"); return _Front_binder<decay_t<_Fx>, decay_t<_Types>...>(::std:: forward<_Fx>(_Func), ::std:: forward<_Types>(_Args)...); } inline void _Add_alloc_size(size_t& _Size, const size_t _Size_added, const size_t _Alignment) { const size_t _Align_masked = _Size & (_Alignment - 1u); _Size += _Size_added; if (_Align_masked != 0) { _Size += _Alignment - _Align_masked; } } template <class _Ty> void _Add_alloc_size(size_t& _Size) { _Add_alloc_size(_Size, sizeof(_Ty), alignof(_Ty)); } template <class _Ty> void _Add_alloc_size(size_t& _Size, const size_t _Count) { _Add_alloc_size(_Size, _Get_size_of_n<sizeof(_Ty)>(_Count), alignof(_Ty)); } inline void* _Decode_aligned_block(void*& _Base, size_t _Size, const size_t _Alignment) { auto _Space = static_cast<size_t>(-1); auto _Result = ::std:: align(_Alignment, _Size, _Base, _Space); _Base = static_cast<char*>(_Base) + _Size; return _Result; } template <class _Ty> _Ty* _Decode_aligned_block(void*& _Base) { return static_cast<_Ty*>(_Decode_aligned_block(_Base, sizeof(_Ty), alignof(_Ty))); } template <class _Ty> _Ty* _Decode_aligned_block(void*& _Base, const size_t _Count) { return static_cast<_Ty*>(_Decode_aligned_block(_Base, sizeof(_Ty) * _Count, alignof(_Ty))); } struct _Global_delete { void operator()(void* const _Ptr) const { ::operator delete(_Ptr); } }; template <class _FwdItHaystack, class _FwdItPat, class _Pred_eq> constexpr pair<_FwdItHaystack, _FwdItHaystack> _Search_pair_unchecked(_FwdItHaystack _First1, _FwdItHaystack _Last1, _FwdItPat _First2, _FwdItPat _Last2, _Pred_eq& _Eq, forward_iterator_tag, forward_iterator_tag) { for (;; ++_First1) { _FwdItHaystack _Mid1 = _First1; for (_FwdItPat _Mid2 = _First2;; ++_Mid1, (void) ++_Mid2) { if (_Mid2 == _Last2) { return {_First1, _Mid1}; } if (_Mid1 == _Last1) { return {_Last1, _Last1}; } if (!_Eq(*_Mid1, *_Mid2)) { break; } } } } template <class _FwdItHaystack, class _FwdItPat, class _Pred_eq> constexpr pair<_FwdItHaystack, _FwdItHaystack> _Search_pair_unchecked(_FwdItHaystack _First1, _FwdItHaystack _Last1, _FwdItPat _First2, _FwdItPat _Last2, _Pred_eq& _Eq, random_access_iterator_tag, random_access_iterator_tag) { _Iter_diff_t<_FwdItHaystack> _Count1 = _Last1 - _First1; _Iter_diff_t<_FwdItPat> _Count2 = _Last2 - _First2; for (; _Count2 <= _Count1; ++_First1, (void) --_Count1) { _FwdItHaystack _Mid1 = _First1; for (_FwdItPat _Mid2 = _First2;; ++_Mid1, (void) ++_Mid2) { if (_Mid2 == _Last2) { return {_First1, _Mid1}; } if (!_Eq(*_Mid1, *_Mid2)) { break; } } } return {_Last1, _Last1}; } template <class _FwdItPat, class _Pred_eq = equal_to<>> class default_searcher { public: constexpr default_searcher(_FwdItPat _First, _FwdItPat _Last, _Pred_eq _Eq = _Pred_eq()) : _Data{_One_then_variadic_args_t{}, ::std:: move(_Eq), pair<_FwdItPat, _FwdItPat>{_First, _Last}} { const auto& _Pat = _Data._Myval2; _Adl_verify_range(_Pat.first, _Pat.second); } template <class _FwdItHaystack> [[nodiscard]] constexpr pair<_FwdItHaystack, _FwdItHaystack> operator()( _FwdItHaystack _First, _FwdItHaystack _Last) const { _Adl_verify_range(_First, _Last); const auto& _Eq = _Data._Get_first(); const auto& _Pat = _Data._Myval2; _Adl_verify_range(_Pat.first, _Pat.second); const auto _Result = _Search_pair_unchecked(_Get_unwrapped(_First), _Get_unwrapped(_Last), _Get_unwrapped(_Pat.first), _Get_unwrapped(_Pat.second), _Eq, _Iter_cat_t<_FwdItHaystack>{}, _Iter_cat_t<_FwdItPat>{}); _Seek_wrapped(_Last, _Result.second); _Seek_wrapped(_First, _Result.first); return {_First, _Last}; } private: _Compressed_pair<_Pred_eq, pair<_FwdItPat, _FwdItPat>> _Data; }; template <class _RanItPat, class _Hash_ty, class _Pred_eq> struct _Boyer_moore_hash_delta_1_table { using _Value_t = _Iter_value_t<_RanItPat>; using _Diff = _Iter_diff_t<_RanItPat>; _Boyer_moore_hash_delta_1_table(_RanItPat _Pat_first_arg, _Unwrapped_t<const _RanItPat&> _UPat_first, const _Diff _Pat_size_arg, _Hash_ty&& _Hash_fn, _Pred_eq&& _Eq) : _Pat_first(_Pat_first_arg), _Pat_size(_Pat_size_arg), _Map(0, ::std:: move(_Hash_fn), ::std:: move(_Eq)) { for (_Diff _Idx = 1; _Idx <= _Pat_size; ++_Idx, (void) ++_UPat_first) { _Map.insert_or_assign(*_UPat_first, _Pat_size - _Idx); } } _Diff _Lookup(const _Value_t& _Value) const { const auto _Iter = _Map.find(_Value); if (_Iter == _Map.end()) { return _Pat_size; } return _Iter->second; } _Pred_eq _Get_eq() const { return _Map.key_eq(); } const _RanItPat _Pat_first; const _Diff _Pat_size; private: unordered_map<_Value_t, _Diff, _Hash_ty, _Pred_eq> _Map; }; template <class _RanItPat, _Iter_diff_t<_RanItPat> _Limit> struct _Boyer_moore_flat_delta_1_table { using _Value_t = _Iter_value_t<_RanItPat>; using _Diff = _Iter_diff_t<_RanItPat>; _Boyer_moore_flat_delta_1_table(_RanItPat _Pat_first_arg, _Unwrapped_t<const _RanItPat&> _UPat_first, const _Diff _Pat_size_arg, _Unused_parameter, _Unused_parameter) : _Pat_first(_Pat_first_arg), _Pat_size(_Pat_size_arg) { ::std:: fill(::std:: begin(_Table), ::std:: end(_Table), _Pat_size); for (_Diff _Idx = 1; _Idx <= _Pat_size; ++_Idx, (void) ++_UPat_first) { _Table[_Unsigned_value(*_UPat_first)] = _Pat_size - _Idx; } } _Diff _Lookup(const _Value_t _Value) const { const auto _UValue = _Unsigned_value(_Value); if (_UValue < ::std:: size(_Table)) { return _Table[_UValue]; } return _Pat_size; } equal_to<> _Get_eq() const { return {}; } const _RanItPat _Pat_first; const _Diff _Pat_size; private: _Diff _Table[_Limit]; }; template <class _RanItPat, class _Pred_eq> void _Build_boyer_moore_delta_2_table(_Iter_diff_t<_RanItPat>* const _Shifts, const _RanItPat _Pat_first, const _Iter_diff_t<_RanItPat> _Pat_size, _Pred_eq& _Eq) { using _Diff = _Iter_diff_t<_RanItPat>; if (_Pat_size == 0) { return; } if ((numeric_limits<_Diff>::max)() - _Pat_size < _Pat_size) { _Xlength_error("Boyer-Moore pattern is too long"); } const auto _Mx = static_cast<size_t>(_Pat_size); const unique_ptr<size_t[]> _Fx{new size_t[_Mx]}; for (size_t _Kx = 1; _Kx <= _Mx; ++_Kx) { _Shifts[_Kx - 1] = static_cast<_Diff>(2 * _Mx - _Kx); } size_t _Tx = _Mx + 1; for (size_t _Jx = _Mx; _Jx > 0; --_Jx, --_Tx) { _Fx[_Jx - 1] = _Tx; while (_Tx <= _Mx && !_Eq(_Pat_first[_Jx - 1], _Pat_first[_Tx - 1])) { _Shifts[_Tx - 1] = (::std:: min)(_Shifts[_Tx - 1], static_cast<_Diff>(_Mx - _Jx)); _Tx = _Fx[_Tx - 1]; } } size_t _Qx = _Tx; _Tx = _Mx + 1 - _Qx; for (size_t _Jx = 1, _Tx1 = 0; _Jx <= _Tx; ++_Tx1, ++_Jx) { _Fx[_Jx - 1] = _Tx1; while (_Tx1 >= 1 && !_Eq(_Pat_first[_Jx - 1], _Pat_first[_Tx1 - 1])) { _Tx1 = _Fx[_Tx1 - 1]; } } size_t _Qx1 = 1; while (_Qx < _Mx) { for (size_t _Kx = _Qx1; _Kx <= _Qx; ++_Kx) { _Shifts[_Kx - 1] = (::std:: min)(_Shifts[_Kx - 1], static_cast<_Diff>(_Mx + _Qx - _Kx)); } _Qx1 = _Qx + 1; const size_t _Temp = _Fx[_Tx - 1]; _Qx = _Qx + _Tx - _Temp; _Tx = _Temp; } } template <class _Delta1_t, class _RanItHaystack> pair<_RanItHaystack, _RanItHaystack> _Boyer_moore_search( const _Delta1_t& _Delta1, typename _Delta1_t::_Diff* _Delta2, _RanItHaystack _First, _RanItHaystack _Last) { static_assert(is_same_v<typename _Delta1_t::_Value_t, _Iter_value_t<_RanItHaystack>>, "boyer_moore_searcher requires matching iterator value types"); using _Diff = typename _Delta1_t::_Diff; _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); const auto _Pat_size = _Delta1._Pat_size; if (_Pat_size == 0) { return {_First, _First}; } const auto _UPat_first = _Get_unwrapped_n(_Delta1._Pat_first, _Pat_size); const auto _Eq = _Delta1._Get_eq(); _Diff _Shift = _Pat_size - 1; while (_Shift < _ULast - _UFirst) { _UFirst += _Shift; _Shift = _Delta1._Lookup(*_UFirst); if (_Shift == 0) { _Diff _Idx = _Pat_size - 1; do { if (_Idx == 0) { _Seek_wrapped(_Last, _UFirst + _Pat_size); _Seek_wrapped(_First, _UFirst); return {_First, _Last}; } --_Idx; --_UFirst; } while (_Eq(*_UFirst, _UPat_first[_Idx])); _Shift = (::std:: max)(_Delta1._Lookup(*_UFirst), _Delta2[_Idx]); } } _Seek_wrapped(_Last, _ULast); _Seek_wrapped(_First, _ULast); return {_First, _Last}; } template <class _Delta1_t, class _RanItHaystack> pair<_RanItHaystack, _RanItHaystack> _Boyer_moore_horspool_search( const _Delta1_t& _Delta1, _RanItHaystack _First, _RanItHaystack _Last) { static_assert(is_same_v<typename _Delta1_t::_Value_t, _Iter_value_t<_RanItHaystack>>, "boyer_moore_horspool_searcher requires matching iterator value types"); using _Diff = typename _Delta1_t::_Diff; _Adl_verify_range(_First, _Last); const auto _Pat_size = _Delta1._Pat_size; if (_Pat_size == 0) { return {_First, _First}; } auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); const auto _UPat_first = _Get_unwrapped_n(_Delta1._Pat_first, _Pat_size); const auto _Eq = _Delta1._Get_eq(); _Diff _Shift = _Pat_size - 1; while (_Shift < _ULast - _UFirst) { _UFirst += _Shift; _Shift = _Delta1._Lookup(*_UFirst); if (_Shift == 0) { const auto _Candidate = _UFirst - (_Pat_size - 1); if (::std:: equal(_UPat_first, _UPat_first + (_Pat_size - 1), _Candidate, _Pass_fn(_Eq))) { _Seek_wrapped(_Last, _Candidate + _Pat_size); _Seek_wrapped(_First, _Candidate); return {_First, _Last}; } _Shift = 1; } } _Seek_wrapped(_Last, _ULast); _Seek_wrapped(_First, _ULast); return {_First, _Last}; } template <class _RanItPat, class _Hash_ty, class _Pred_eq, class _Delta1_t> struct _Single_delta1_type_boyer_moore_traits { using _Diff = _Iter_diff_t<_RanItPat>; template <bool _Build_delta2> static void* _Build_boyer_moore(_RanItPat _First, _RanItPat _Last, _Hash_ty _Hash_fn, _Pred_eq _Eq) { _Adl_verify_range(_First, _Last); const auto _UFirst = _Get_unwrapped(_First); const auto _Pat_size_raw = _Get_unwrapped(_Last) - _UFirst; using _CT = common_type_t<_Iter_diff_t<_RanItPat>, size_t>; if (static_cast<_CT>(_Pat_size_raw) > static_cast<_CT>(0xffffffffffffffffui64)) { _Xbad_alloc(); } const auto _Pat_size = static_cast<size_t>(_Pat_size_raw); size_t _Buf_size = 0; _Add_alloc_size<_Atomic_counter_t>(_Buf_size); _Add_alloc_size<_Delta1_t>(_Buf_size); if (_Build_delta2) { _Add_alloc_size<_Diff>(_Buf_size, _Pat_size); } unique_ptr<void, _Global_delete> _Buf_bytes(::operator new(_Buf_size)); void* _Buf = _Buf_bytes.get(); *_Decode_aligned_block<_Atomic_counter_t>(_Buf) = 1; void* const _Delta1 = _Decode_aligned_block<_Delta1_t>(_Buf); if (_Build_delta2) { _Build_boyer_moore_delta_2_table( _Decode_aligned_block<_Diff>(_Buf, _Pat_size), _UFirst, _Pat_size_raw, _Eq); } ::new (_Delta1) _Delta1_t(_First, _UFirst, _Pat_size_raw, ::std:: move(_Hash_fn), ::std:: move(_Eq)); return _Buf_bytes.release(); } template <class _RanItHaystack> static pair<_RanItHaystack, _RanItHaystack> _Use_boyer_moore( void* _Data, _RanItHaystack _First, _RanItHaystack _Last) { (void) _Decode_aligned_block<_Atomic_counter_t>(_Data); const auto _Delta1 = _Decode_aligned_block<_Delta1_t>(_Data); const auto _Delta2 = _Decode_aligned_block<_Diff>(_Data, static_cast<size_t>(_Delta1->_Pat_size)); return _Boyer_moore_search(*_Delta1, _Delta2, _First, _Last); } template <class _RanItHaystack> static pair<_RanItHaystack, _RanItHaystack> _Use_boyer_moore_horspool( void* _Data, _RanItHaystack _First, _RanItHaystack _Last) { (void) _Decode_aligned_block<_Atomic_counter_t>(_Data); const auto _Delta1 = _Decode_aligned_block<_Delta1_t>(_Data); return _Boyer_moore_horspool_search(*_Delta1, _First, _Last); } static void _Destroy(void* const _Base) noexcept { void* _Data = _Base; (void) _Decode_aligned_block<_Atomic_counter_t>(_Data); _Decode_aligned_block<_Delta1_t>(_Data)->~_Delta1_t(); ::operator delete(_Base); } }; template <class _RanItPat, class _Hash_ty, class _Pred_eq> using _Boyer_moore_traits_char_mode = _Single_delta1_type_boyer_moore_traits<_RanItPat, _Hash_ty, _Pred_eq, _Boyer_moore_flat_delta_1_table<_RanItPat, 256>>; template <class _RanItPat> struct _Boyer_moore_traits_wchar_t_mode { using _Value_t = _Iter_value_t<_RanItPat>; using _Diff = _Iter_diff_t<_RanItPat>; using _Big_table_t = _Boyer_moore_flat_delta_1_table<_RanItPat, 65536>; using _Small_table_t = _Boyer_moore_flat_delta_1_table<_RanItPat, 256>; template <bool _Build_delta2> static void* _Build_boyer_moore(_RanItPat _First, _RanItPat _Last, _Unused_parameter, _Unused_parameter) { _Adl_verify_range(_First, _Last); const auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); const auto _Pat_size_raw = _ULast - _UFirst; using _CT = common_type_t<_Iter_diff_t<_RanItPat>, size_t>; if (static_cast<_CT>(_Pat_size_raw) > static_cast<_CT>(0xffffffffffffffffui64)) { _Xbad_alloc(); } const auto _Pat_size = static_cast<size_t>(_Pat_size_raw); size_t _Buf_size = 0; _Add_alloc_size<_Atomic_counter_t>(_Buf_size); bool _Use_large_table = false; for (auto _Temp = _UFirst; _Temp != _ULast; ++_Temp) { if (_Unsigned_value(*_Temp) > 255) { _Use_large_table = true; break; } } _Add_alloc_size<bool>(_Buf_size); if (_Use_large_table) { _Add_alloc_size<_Big_table_t>(_Buf_size); } else { _Add_alloc_size<_Small_table_t>(_Buf_size); } if (_Build_delta2) { _Add_alloc_size<_Diff>(_Buf_size, _Pat_size); } unique_ptr<void, _Global_delete> _Buf_bytes(::operator new(_Buf_size)); void* _Buf = _Buf_bytes.get(); *_Decode_aligned_block<_Atomic_counter_t>(_Buf) = 1; *_Decode_aligned_block<bool>(_Buf) = _Use_large_table; if (_Use_large_table) { using _Delta1_t = _Big_table_t; ::new (static_cast<void*>(_Decode_aligned_block<_Delta1_t>(_Buf))) _Delta1_t(_First, _UFirst, _Pat_size_raw, {}, {}); } else { using _Delta1_t = _Small_table_t; ::new (static_cast<void*>(_Decode_aligned_block<_Delta1_t>(_Buf))) _Delta1_t(_First, _UFirst, _Pat_size_raw, {}, {}); } if (_Build_delta2) { equal_to<> _Eq; _Build_boyer_moore_delta_2_table( _Decode_aligned_block<_Diff>(_Buf, _Pat_size), _UFirst, _Pat_size_raw, _Eq); } return _Buf_bytes.release(); } template <class _RanItHaystack> static pair<_RanItHaystack, _RanItHaystack> _Use_boyer_moore( void* _Data, _RanItHaystack _First, _RanItHaystack _Last) { (void) _Decode_aligned_block<_Atomic_counter_t>(_Data); if (*_Decode_aligned_block<bool>(_Data)) { const auto _Delta1 = _Decode_aligned_block<_Big_table_t>(_Data); const auto _Delta2 = _Decode_aligned_block<_Diff>(_Data, static_cast<size_t>(_Delta1->_Pat_size)); return _Boyer_moore_search(*_Delta1, _Delta2, _First, _Last); } else { const auto _Delta1 = _Decode_aligned_block<_Small_table_t>(_Data); const auto _Delta2 = _Decode_aligned_block<_Diff>(_Data, static_cast<size_t>(_Delta1->_Pat_size)); return _Boyer_moore_search(*_Delta1, _Delta2, _First, _Last); } } template <class _RanItHaystack> static pair<_RanItHaystack, _RanItHaystack> _Use_boyer_moore_horspool( void* _Data, _RanItHaystack _First, _RanItHaystack _Last) { (void) _Decode_aligned_block<_Atomic_counter_t>(_Data); if (*_Decode_aligned_block<bool>(_Data)) { const auto _Delta1 = _Decode_aligned_block<_Big_table_t>(_Data); return _Boyer_moore_horspool_search(*_Delta1, _First, _Last); } else { const auto _Delta1 = _Decode_aligned_block<_Small_table_t>(_Data); return _Boyer_moore_horspool_search(*_Delta1, _First, _Last); } } static void _Destroy(void* const _Base) noexcept { void* _Data = _Base; (void) _Decode_aligned_block<_Atomic_counter_t>(_Data); if (*_Decode_aligned_block<bool>(_Data)) { const auto _Delta1 = _Decode_aligned_block<_Big_table_t>(_Data); _Delta1->~_Big_table_t(); } else { const auto _Delta1 = _Decode_aligned_block<_Small_table_t>(_Data); _Delta1->~_Small_table_t(); } static_assert(is_trivially_destructible_v<_Diff>, "allows Boyer-Moore and Boyer-Moore-Horspool to " "share cleanup functions"); ::operator delete(_Base); } }; template <class _RanItPat, class _Hash_ty, class _Pred_eq> using _Boyer_moore_traits_general_mode = _Single_delta1_type_boyer_moore_traits<_RanItPat, _Hash_ty, _Pred_eq, _Boyer_moore_hash_delta_1_table<_RanItPat, _Hash_ty, _Pred_eq>>; template <class _RanItPat, class _Hash_ty, class _Pred_eq, class _Value_t = _Iter_value_t<_RanItPat>> using _Boyer_moore_traits = conditional_t<is_integral_v<_Value_t> && sizeof(_Value_t) <= 2 && (is_same_v<equal_to<>, _Pred_eq> || is_same_v<equal_to<_Value_t>, _Pred_eq>), conditional_t<sizeof(_Value_t) == 1, _Boyer_moore_traits_char_mode<_RanItPat, _Hash_ty, _Pred_eq>, _Boyer_moore_traits_wchar_t_mode<_RanItPat>>, _Boyer_moore_traits_general_mode<_RanItPat, _Hash_ty, _Pred_eq>>; template <class _RanItPat, class _Hash_ty = hash<_Iter_value_t<_RanItPat>>, class _Pred_eq = equal_to<>> class boyer_moore_searcher { public: boyer_moore_searcher( const _RanItPat _First, const _RanItPat _Last, _Hash_ty _Hash_fn = _Hash_ty(), _Pred_eq _Eq = _Pred_eq()) : _Data(_Traits::template _Build_boyer_moore<true>(_First, _Last, ::std:: move(_Hash_fn), ::std:: move(_Eq))) { } boyer_moore_searcher(const boyer_moore_searcher& _Other) noexcept : _Data(_Other._Data) { _InterlockedIncrement(reinterpret_cast<volatile long*>(&*static_cast<_Atomic_counter_t*>(_Data))); } ~boyer_moore_searcher() noexcept { if (_InterlockedDecrement(reinterpret_cast<volatile long*>(&*static_cast<_Atomic_counter_t*>(_Data))) == 0) { _Traits::_Destroy(_Data); } } boyer_moore_searcher& operator=(const boyer_moore_searcher& _Other) noexcept { boyer_moore_searcher _Cpy(_Other); swap(_Data, _Cpy._Data); return *this; } template <class _RanItHaystack> [[nodiscard]] pair<_RanItHaystack, _RanItHaystack> operator()( const _RanItHaystack _First, const _RanItHaystack _Last) const { return _Traits::_Use_boyer_moore(_Data, _First, _Last); } private: using _Traits = _Boyer_moore_traits<_RanItPat, _Hash_ty, _Pred_eq>; void* _Data; }; template <class _RanItPat, class _Hash_ty = hash<_Iter_value_t<_RanItPat>>, class _Pred_eq = equal_to<>> class boyer_moore_horspool_searcher { public: boyer_moore_horspool_searcher( const _RanItPat _First, const _RanItPat _Last, _Hash_ty _Hash_fn = _Hash_ty(), _Pred_eq _Eq = _Pred_eq()) : _Data(_Traits::template _Build_boyer_moore<false>(_First, _Last, ::std:: move(_Hash_fn), ::std:: move(_Eq))) { } boyer_moore_horspool_searcher(const boyer_moore_horspool_searcher& _Other) noexcept : _Data(_Other._Data) { _InterlockedIncrement(reinterpret_cast<volatile long*>(&*static_cast<_Atomic_counter_t*>(_Data))); } ~boyer_moore_horspool_searcher() noexcept { if (_InterlockedDecrement(reinterpret_cast<volatile long*>(&*static_cast<_Atomic_counter_t*>(_Data))) == 0) { _Traits::_Destroy(_Data); } } boyer_moore_horspool_searcher& operator=(const boyer_moore_horspool_searcher& _Other) noexcept { boyer_moore_horspool_searcher _Cpy(_Other); swap(_Data, _Cpy._Data); return *this; } template <class _RanItHaystack> [[nodiscard]] pair<_RanItHaystack, _RanItHaystack> operator()( const _RanItHaystack _First, const _RanItHaystack _Last) const { return _Traits::_Use_boyer_moore_horspool(_Data, _First, _Last); } private: using _Traits = _Boyer_moore_traits<_RanItPat, _Hash_ty, _Pred_eq>; void* _Data; }; namespace ranges { struct not_equal_to { template <class _Ty1, class _Ty2> requires equality_comparable_with<_Ty1, _Ty2> [[nodiscard]] constexpr bool operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(noexcept( static_cast<bool>(static_cast<_Ty1&&>(_Left) == static_cast<_Ty2&&>(_Right)))) { return !static_cast<bool>(static_cast<_Ty1&&>(_Left) == static_cast<_Ty2&&>(_Right)); } using is_transparent = int; }; struct greater_equal { template <class _Ty1, class _Ty2> requires totally_ordered_with<_Ty1, _Ty2> [[nodiscard]] constexpr bool operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(noexcept( static_cast<bool>(static_cast<_Ty1&&>(_Left) < static_cast<_Ty2&&>(_Right)))) { return !static_cast<bool>(static_cast<_Ty1&&>(_Left) < static_cast<_Ty2&&>(_Right)); } using is_transparent = int; }; struct less_equal { template <class _Ty1, class _Ty2> requires totally_ordered_with<_Ty1, _Ty2> [[nodiscard]] constexpr bool operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(noexcept( static_cast<bool>(static_cast<_Ty2&&>(_Right) < static_cast<_Ty1&&>(_Left)))) { return !static_cast<bool>(static_cast<_Ty2&&>(_Right) < static_cast<_Ty1&&>(_Left)); } using is_transparent = int; }; } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { template <class _Container> class back_insert_iterator { public: using iterator_category = output_iterator_tag; using value_type = void; using pointer = void; using reference = void; using container_type = _Container; using difference_type = ptrdiff_t; constexpr back_insert_iterator() noexcept = default; constexpr explicit back_insert_iterator(_Container& _Cont) noexcept : container(::std:: addressof(_Cont)) {} constexpr back_insert_iterator& operator=(const typename _Container::value_type& _Val) { container->push_back(_Val); return *this; } constexpr back_insert_iterator& operator=(typename _Container::value_type&& _Val) { container->push_back(::std:: move(_Val)); return *this; } [[nodiscard]] constexpr back_insert_iterator& operator*() noexcept { return *this; } constexpr back_insert_iterator& operator++() noexcept { return *this; } constexpr back_insert_iterator operator++(int) noexcept { return *this; } protected: _Container* container = nullptr; }; template <class _Container> [[nodiscard]] constexpr back_insert_iterator<_Container> back_inserter(_Container& _Cont) noexcept { return back_insert_iterator<_Container>(_Cont); } template <class _Container> class front_insert_iterator { public: using iterator_category = output_iterator_tag; using value_type = void; using pointer = void; using reference = void; using container_type = _Container; using difference_type = ptrdiff_t; constexpr front_insert_iterator() noexcept = default; constexpr explicit front_insert_iterator(_Container& _Cont) : container(::std:: addressof(_Cont)) {} constexpr front_insert_iterator& operator=(const typename _Container::value_type& _Val) { container->push_front(_Val); return *this; } constexpr front_insert_iterator& operator=(typename _Container::value_type&& _Val) { container->push_front(::std:: move(_Val)); return *this; } [[nodiscard]] constexpr front_insert_iterator& operator*() { return *this; } constexpr front_insert_iterator& operator++() { return *this; } constexpr front_insert_iterator operator++(int) { return *this; } protected: _Container* container = nullptr; }; template <class _Container> [[nodiscard]] constexpr front_insert_iterator<_Container> front_inserter(_Container& _Cont) { return front_insert_iterator<_Container>(_Cont); } template <class _Container> class insert_iterator { public: using iterator_category = output_iterator_tag; using value_type = void; using pointer = void; using reference = void; using container_type = _Container; using difference_type = ptrdiff_t; insert_iterator() = default; constexpr insert_iterator(_Container& _Cont, typename _Container::iterator _Where) : container(::std:: addressof(_Cont)), iter(_Where) {} constexpr insert_iterator& operator=(const typename _Container::value_type& _Val) { iter = container->insert(iter, _Val); ++iter; return *this; } constexpr insert_iterator& operator=(typename _Container::value_type&& _Val) { iter = container->insert(iter, ::std:: move(_Val)); ++iter; return *this; } [[nodiscard]] constexpr insert_iterator& operator*() { return *this; } constexpr insert_iterator& operator++() { return *this; } constexpr insert_iterator& operator++(int) { return *this; } protected: _Container* container = nullptr; typename _Container::iterator iter{}; }; template <class _Container> [[nodiscard]] constexpr insert_iterator<_Container> inserter(_Container& _Cont, typename _Container::iterator _Where) { return insert_iterator<_Container>(_Cont, _Where); } template <semiregular _Se> class move_sentinel { public: constexpr move_sentinel() = default; constexpr explicit move_sentinel(_Se _Val) noexcept(is_nothrow_move_constructible_v<_Se>) : _Last{::std:: move(_Val)} {} template <class _Se2> requires convertible_to<const _Se2&, _Se> constexpr move_sentinel(const move_sentinel<_Se2>& _Val) noexcept(is_nothrow_constructible_v<_Se, const _Se2&>) : _Last{_Val._Get_last()} {} template <class _Se2> requires assignable_from<_Se&, const _Se2&> constexpr move_sentinel& operator=(const move_sentinel<_Se2>& _Val) noexcept(is_nothrow_assignable_v<_Se&, const _Se2&>) { _Last = _Val._Get_last(); return *this; } [[nodiscard]] constexpr _Se base() const noexcept(is_nothrow_copy_constructible_v<_Se>) { return _Last; } [[nodiscard]] constexpr const _Se& _Get_last() const noexcept { return _Last; } private: _Se _Last{}; }; template <class _Ty, class _Elem = char, class _Traits = char_traits<_Elem>, class _Diff = ptrdiff_t> class istream_iterator { public: using iterator_category = input_iterator_tag; using value_type = _Ty; using difference_type = _Diff; using pointer = const _Ty*; using reference = const _Ty&; using char_type = _Elem; using traits_type = _Traits; using istream_type = basic_istream<_Elem, _Traits>; static_assert(conjunction_v<is_default_constructible<_Ty>, is_copy_constructible<_Ty>, is_copy_assignable<_Ty>>, "istream_iterator<T> requires T to be default constructible, copy constructible, and copy assignable. " "(N4835 [istream.iterator]/2)"); constexpr istream_iterator() noexcept(is_nothrow_default_constructible_v<_Ty>) {} constexpr istream_iterator(default_sentinel_t) noexcept(is_nothrow_default_constructible_v<_Ty>) {} istream_iterator(istream_type& _Istr) : _Myistr(::std:: addressof(_Istr)) { _Getval(); } [[nodiscard]] const _Ty& operator*() const noexcept { do { if (_Myistr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 257, 0, "%s", "The stored stream pointer in_stream must be non-null")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"The stored stream pointer in_stream must be non-null\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 257, 0); } while (false); } ; } while (false); return _Myval; } [[nodiscard]] const _Ty* operator->() const noexcept { do { if (_Myistr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 262, 0, "%s", "The stored stream pointer in_stream must be non-null")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"The stored stream pointer in_stream must be non-null\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 262, 0); } while (false); } ; } while (false); return ::std:: addressof(_Myval); } istream_iterator& operator++() { _Getval(); return *this; } istream_iterator operator++(int) { istream_iterator _Tmp = *this; _Getval(); return _Tmp; } [[nodiscard]] bool _Equal(const istream_iterator& _Right) const noexcept { return _Myistr == _Right._Myistr; } [[nodiscard]] friend bool operator==(const istream_iterator& _Left, default_sentinel_t) noexcept { return !_Left._Myistr; } private: void _Getval() { do { if (_Myistr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 289, 0, "%s", "The stored stream pointer in_stream must be non-null")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"The stored stream pointer in_stream must be non-null\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 289, 0); } while (false); } ; } while (false); if (!(*_Myistr >> _Myval)) { _Myistr = nullptr; } } istream_type* _Myistr{nullptr}; _Ty _Myval{}; }; template <class _Ty, class _Elem, class _Traits, class _Diff> [[nodiscard]] bool operator==(const istream_iterator<_Ty, _Elem, _Traits, _Diff>& _Left, const istream_iterator<_Ty, _Elem, _Traits, _Diff>& _Right) noexcept { return _Left._Equal(_Right); } template <class _Ty, class _Elem = char, class _Traits = char_traits<_Elem>> class ostream_iterator { public: using iterator_category = output_iterator_tag; using value_type = void; using difference_type = ptrdiff_t; using pointer = void; using reference = void; using char_type = _Elem; using traits_type = _Traits; using ostream_type = basic_ostream<_Elem, _Traits>; constexpr ostream_iterator() noexcept = default; ostream_iterator(ostream_type& _Ostr, const _Elem* const _Delim = nullptr) noexcept : _Mydelim(_Delim), _Myostr(::std:: addressof(_Ostr)) {} ostream_iterator& operator=(const _Ty& _Val) { *_Myostr << _Val; if (_Mydelim) { *_Myostr << _Mydelim; } return *this; } [[nodiscard]] ostream_iterator& operator*() noexcept { return *this; } ostream_iterator& operator++() noexcept { return *this; } ostream_iterator& operator++(int) noexcept { return *this; } private: const _Elem* _Mydelim = nullptr; ostream_type* _Myostr = nullptr; }; template <class _Elem, class _Traits> class istreambuf_iterator { public: using iterator_category = input_iterator_tag; using value_type = _Elem; using difference_type = typename _Traits::off_type; using pointer = const _Elem*; using reference = _Elem; using char_type = _Elem; using traits_type = _Traits; using int_type = typename traits_type::int_type; using streambuf_type = basic_streambuf<_Elem, _Traits>; using istream_type = basic_istream<_Elem, _Traits>; constexpr istreambuf_iterator() noexcept : _Strbuf(nullptr), _Got(true), _Val() {} constexpr istreambuf_iterator(default_sentinel_t) noexcept : _Strbuf(nullptr), _Got(true), _Val() {} istreambuf_iterator(istream_type& _Istr) noexcept : _Strbuf(_Istr.rdbuf()), _Got(!_Strbuf), _Val() {} istreambuf_iterator(streambuf_type* _Sb) noexcept : _Strbuf(_Sb), _Got(!_Sb), _Val() {} private: class _Istreambuf_proxy { public: [[nodiscard]] _Elem operator*() const noexcept(is_nothrow_copy_constructible_v<_Elem>) { return _Keep; } private: friend istreambuf_iterator; _Istreambuf_proxy(streambuf_type* _Strbuf_, _Elem _Keep_) noexcept( is_nothrow_copy_constructible_v<_Elem>) : _Strbuf(_Strbuf_), _Keep(_Keep_) {} streambuf_type* _Strbuf; _Elem _Keep; }; public: istreambuf_iterator(const _Istreambuf_proxy& _Px) noexcept : _Strbuf(_Px._Strbuf), _Got(!_Strbuf), _Val() {} [[nodiscard]] _Elem operator*() const { if (!_Got) { _Peek(); } do { if (_Strbuf) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 413, 0, "%s", "istreambuf_iterator is not dereferenceable")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"istreambuf_iterator is not dereferenceable\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 413, 0); } while (false); } ; } while (false); return _Val; } istreambuf_iterator& operator++() { do { if (_Strbuf) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 421, 0, "%s", "istreambuf_iterator is not incrementable")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"istreambuf_iterator is not incrementable\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 421, 0); } while (false); } ; } while (false); _Inc(); return *this; } _Istreambuf_proxy operator++(int) { if (!_Got) { _Peek(); } _Istreambuf_proxy _Tmp{_Strbuf, _Val}; ++*this; return _Tmp; } [[nodiscard]] bool equal(const istreambuf_iterator& _Right) const { if (!_Got) { _Peek(); } if (!_Right._Got) { _Right._Peek(); } return (!_Strbuf && !_Right._Strbuf) || (_Strbuf && _Right._Strbuf); } [[nodiscard]] friend bool operator==(const istreambuf_iterator& _Left, default_sentinel_t) { if (!_Left._Got) { _Left._Peek(); } return !_Left._Strbuf; } private: void _Inc() { if (!_Strbuf || traits_type::eq_int_type(traits_type::eof(), _Strbuf->sbumpc())) { _Strbuf = nullptr; _Got = true; } else { _Got = false; } } _Elem _Peek() const { int_type _Meta; if (!_Strbuf || traits_type::eq_int_type(traits_type::eof(), _Meta = _Strbuf->sgetc())) { _Strbuf = nullptr; } else { _Val = traits_type::to_char_type(_Meta); } _Got = true; return _Val; } mutable streambuf_type* _Strbuf; mutable bool _Got; mutable _Elem _Val; }; template <class _Elem, class _Traits> [[nodiscard]] bool operator==( const istreambuf_iterator<_Elem, _Traits>& _Left, const istreambuf_iterator<_Elem, _Traits>& _Right) { return _Left.equal(_Right); } template <class _Elem, class _Traits> class ostreambuf_iterator { public: using iterator_category = output_iterator_tag; using value_type = void; using difference_type = ptrdiff_t; using pointer = void; using reference = void; using char_type = _Elem; using traits_type = _Traits; using streambuf_type = basic_streambuf<_Elem, _Traits>; using ostream_type = basic_ostream<_Elem, _Traits>; constexpr ostreambuf_iterator() noexcept = default; ostreambuf_iterator(streambuf_type* _Sb) noexcept : _Strbuf(_Sb) {} ostreambuf_iterator(ostream_type& _Ostr) noexcept : _Strbuf(_Ostr.rdbuf()) {} ostreambuf_iterator& operator=(_Elem _Right) { if (!_Strbuf || traits_type::eq_int_type(_Traits::eof(), _Strbuf->sputc(_Right))) { _Failed = true; } return *this; } [[nodiscard]] ostreambuf_iterator& operator*() noexcept { return *this; } ostreambuf_iterator& operator++() noexcept { return *this; } ostreambuf_iterator& operator++(int) noexcept { return *this; } [[nodiscard]] bool failed() const noexcept { return _Failed; } private: bool _Failed = false; streambuf_type* _Strbuf = nullptr; }; enum class _Variantish_state : unsigned char { _Nothing, _Holds_iter, _Holds_sentinel }; struct _Common_iterator_construct_tag { explicit _Common_iterator_construct_tag() = default; }; template <input_or_output_iterator _It, sentinel_for<_It> _Se> class _Variantish { public: constexpr explicit _Variantish(_Common_iterator_construct_tag) noexcept : _Contains{_Variantish_state::_Nothing} {} constexpr _Variantish() noexcept(is_nothrow_default_constructible_v<_It>) : _Iterator{}, _Contains{_Variantish_state::_Holds_iter} {} template <class... _Types> constexpr explicit _Variantish(in_place_type_t<_It>, _Types&&... _Args) noexcept( is_nothrow_constructible_v<_It, _Types...>) : _Iterator(::std:: forward<_Types>(_Args)...), _Contains{_Variantish_state::_Holds_iter} {} template <class... _Types> constexpr explicit _Variantish(in_place_type_t<_Se>, _Types&&... _Args) noexcept( is_nothrow_constructible_v<_Se, _Types...>) : _Sentinel(::std:: forward<_Types>(_Args)...), _Contains{_Variantish_state::_Holds_sentinel} {} template <class _OIter, class _OSe> requires _Not_same_as<_Variantish<_OIter, _OSe>, _Variantish> _Variantish(const _Variantish<_OIter, _OSe>& _That) noexcept( is_nothrow_constructible_v<_It, const _OIter&> && is_nothrow_constructible_v<_Se, const _OSe&>) : _Contains{_That._Contains} { switch (_That._Contains) { case _Variantish_state::_Holds_iter: _Construct_in_place(_Iterator, _That._Iterator); break; case _Variantish_state::_Holds_sentinel: _Construct_in_place(_Sentinel, _That._Sentinel); break; case _Variantish_state::_Nothing: break; } } _Variantish(const _Variantish&) requires is_trivially_copy_constructible_v<_It> && is_trivially_copy_constructible_v<_Se> = default; _Variantish(const _Variantish& _That) noexcept( is_nothrow_copy_constructible_v<_It>&& is_nothrow_copy_constructible_v<_Se>) : _Contains{_That._Contains} { switch (_Contains) { case _Variantish_state::_Holds_iter: _Construct_in_place(_Iterator, _That._Iterator); break; case _Variantish_state::_Holds_sentinel: _Construct_in_place(_Sentinel, _That._Sentinel); break; case _Variantish_state::_Nothing: break; } } _Variantish(_Variantish&&) requires is_trivially_move_constructible_v<_It> && is_trivially_move_constructible_v<_Se> = default; _Variantish(_Variantish&& _That) noexcept( is_nothrow_move_constructible_v<_It>&& is_nothrow_move_constructible_v<_Se>) : _Contains{_That._Contains} { switch (_Contains) { case _Variantish_state::_Holds_iter: _Construct_in_place(_Iterator, ::std:: move(_That._Iterator)); break; case _Variantish_state::_Holds_sentinel: _Construct_in_place(_Sentinel, ::std:: move(_That._Sentinel)); break; case _Variantish_state::_Nothing: break; } } ~_Variantish() requires is_trivially_destructible_v<_It> && is_trivially_destructible_v<_Se> = default; ~_Variantish() { _Raw_clear(); } _Variantish& operator=(const _Variantish&) requires is_trivially_destructible_v<_It> && is_trivially_destructible_v<_Se> && is_trivially_copy_constructible_v<_It> && is_trivially_copy_constructible_v<_Se> && is_trivially_copy_assignable_v<_It> && is_trivially_copy_assignable_v<_Se> = default; _Variantish& operator=(const _Variantish& _That) noexcept( is_nothrow_copy_constructible_v<_It>&& is_nothrow_copy_constructible_v<_Se>&& is_nothrow_copy_assignable_v<_It>&& is_nothrow_copy_assignable_v<_Se>) { if (_Contains == _That._Contains) { switch (_Contains) { case _Variantish_state::_Holds_iter: _Iterator = _That._Iterator; break; case _Variantish_state::_Holds_sentinel: _Sentinel = _That._Sentinel; break; case _Variantish_state::_Nothing: break; } return *this; } _Clear(); switch (_That._Contains) { case _Variantish_state::_Holds_iter: _Construct_in_place(_Iterator, _That._Iterator); break; case _Variantish_state::_Holds_sentinel: _Construct_in_place(_Sentinel, _That._Sentinel); break; case _Variantish_state::_Nothing: break; } _Contains = _That._Contains; return *this; } _Variantish& operator=(_Variantish&&) requires is_trivially_destructible_v<_It> && is_trivially_destructible_v<_Se> && is_trivially_move_constructible_v<_It> && is_trivially_move_constructible_v<_Se> && is_trivially_move_assignable_v<_It> && is_trivially_move_assignable_v<_Se> = default; _Variantish& operator=(_Variantish&& _That) noexcept( is_nothrow_move_constructible_v<_It>&& is_nothrow_move_constructible_v<_Se>&& is_nothrow_move_assignable_v<_It>&& is_nothrow_move_assignable_v<_Se>) { if (_Contains == _That._Contains) { switch (_Contains) { case _Variantish_state::_Holds_iter: _Iterator = ::std:: move(_That._Iterator); break; case _Variantish_state::_Holds_sentinel: _Sentinel = ::std:: move(_That._Sentinel); break; case _Variantish_state::_Nothing: break; } return *this; } _Clear(); switch (_That._Contains) { case _Variantish_state::_Holds_iter: _Construct_in_place(_Iterator, ::std:: move(_That._Iterator)); break; case _Variantish_state::_Holds_sentinel: _Construct_in_place(_Sentinel, ::std:: move(_That._Sentinel)); break; case _Variantish_state::_Nothing: break; } _Contains = _That._Contains; return *this; } template <class _OIter, class _OSe> requires _Not_same_as<_Variantish<_OIter, _OSe>, _Variantish> _Variantish& operator=(const _Variantish<_OIter, _OSe>& _That) noexcept( is_nothrow_constructible_v<_It, const _OIter&> && is_nothrow_constructible_v<_Se, const _OSe&> && is_nothrow_assignable_v<_It&, const _OIter&> && is_nothrow_assignable_v<_Se&, const _OSe&>) { if (_Contains == _That._Contains) { switch (_Contains) { case _Variantish_state::_Holds_iter: _Iterator = _That._Iterator; break; case _Variantish_state::_Holds_sentinel: _Sentinel = _That._Sentinel; break; case _Variantish_state::_Nothing: break; } return *this; } _Clear(); switch (_That._Contains) { case _Variantish_state::_Holds_iter: _Construct_in_place(_Iterator, _That._Iterator); break; case _Variantish_state::_Holds_sentinel: _Construct_in_place(_Sentinel, _That._Sentinel); break; case _Variantish_state::_Nothing: break; } _Contains = _That._Contains; return *this; } constexpr friend void swap(_Variantish& _Left, _Variantish& _Right) noexcept( is_nothrow_move_constructible_v<_It> && is_nothrow_move_constructible_v<_Se> && is_nothrow_swappable_v<_It> && is_nothrow_swappable_v<_Se>) requires (!_Is_trivially_swappable_v<_It> || !_Is_trivially_swappable_v<_Se>) { if (_Left._Contains == _Right._Contains) { switch (_Left._Contains) { case _Variantish_state::_Holds_iter: ::std::ranges:: swap(_Left._Iterator, _Right._Iterator); break; case _Variantish_state::_Holds_sentinel: ::std::ranges:: swap(_Left._Sentinel, _Right._Sentinel); break; case _Variantish_state::_Nothing: break; } return; } auto _Tmp = ::std:: move(_Left); _Left = ::std:: move(_Right); _Right = ::std:: move(_Tmp); } void _Raw_clear() noexcept { switch (_Contains) { case _Variantish_state::_Holds_iter: _Iterator.~_It(); break; case _Variantish_state::_Holds_sentinel: _Sentinel.~_Se(); break; case _Variantish_state::_Nothing: break; } } void _Clear() noexcept { _Raw_clear(); _Contains = _Variantish_state::_Nothing; } union { _It _Iterator; _Se _Sentinel; }; _Variantish_state _Contains; }; template <input_or_output_iterator _Iter, sentinel_for<_Iter> _Se> requires (!same_as<_Iter, _Se> && copyable<_Iter>) class common_iterator { private: class _Proxy { private: iter_value_t<_Iter> _Keep; public: explicit _Proxy(iter_reference_t<_Iter>&& _Right) noexcept( is_nothrow_move_constructible_v<iter_value_t<_Iter>>) : _Keep(::std:: move(_Right)) {} [[nodiscard]] const iter_value_t<_Iter>* operator->() const noexcept { return ::std:: addressof(_Keep); } }; public: constexpr common_iterator() = default; constexpr common_iterator(_Iter _Right) noexcept(is_nothrow_move_constructible_v<_Iter>) : _Val{in_place_type<_Iter>, ::std:: move(_Right)} {} constexpr common_iterator(_Se _Right) noexcept(is_nothrow_move_constructible_v<_Se>) : _Val{in_place_type<_Se>, ::std:: move(_Right)} {} constexpr explicit common_iterator(_Common_iterator_construct_tag _Tag) noexcept : _Val{_Tag} {} template <class _OIter, class _OSe> requires convertible_to<const _OIter&, _Iter> && convertible_to<const _OSe&, _Se> constexpr common_iterator(const common_iterator<_OIter, _OSe>& _Right) noexcept( is_nothrow_constructible_v<_Iter, const _OIter&>&& is_nothrow_constructible_v<_Se, const _OSe&>) : _Val{_Right._Val} {} template <class _OIter, class _OSe> requires convertible_to<const _OIter&, _Iter> && convertible_to<const _OSe&, _Se> && assignable_from<_Iter&, const _OIter&> && assignable_from<_Se&, const _OSe&> common_iterator& operator=(const common_iterator<_OIter, _OSe>& _Right) noexcept( is_nothrow_constructible_v<_Iter, const _OIter&> && is_nothrow_constructible_v<_Se, const _OSe&> && is_nothrow_assignable_v<_Iter&, const _OIter&> && is_nothrow_assignable_v<_Se&, const _OSe&>) { _Val = _Right._Val; return *this; } [[nodiscard]] decltype(auto) operator*() { do { if (_Val._Contains == _Variantish_state::_Holds_iter) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 884, 0, "%s", "common_iterator can only be dereferenced if it holds an iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"common_iterator can only be dereferenced if it holds an iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 884, 0); } while (false); } ; } while (false); return *_Val._Iterator; } [[nodiscard]] decltype(auto) operator*() const requires _Dereferenceable<const _Iter> { do { if (_Val._Contains == _Variantish_state::_Holds_iter) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 892, 0, "%s", "common_iterator can only be dereferenced if it holds an iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"common_iterator can only be dereferenced if it holds an iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 892, 0); } while (false); } ; } while (false); return *_Val._Iterator; } [[nodiscard]] decltype(auto) operator->() const requires indirectly_readable<const _Iter> && (_Has_member_arrow<_Iter> || is_reference_v<iter_reference_t<_Iter>> || constructible_from<iter_value_t<_Iter>, iter_reference_t<_Iter>>) { do { if (_Val._Contains == _Variantish_state::_Holds_iter) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 905, 0, "%s", "common_iterator can only be dereferenced if it holds an iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"common_iterator can only be dereferenced if it holds an iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 905, 0); } while (false); } ; } while (false); if constexpr (is_pointer_v<_Iter> || _Has_member_arrow<_Iter>) { return (_Val._Iterator); } else if constexpr (is_reference_v<iter_reference_t<_Iter>>) { auto&& _Tmp = *_Val._Iterator; return ::std:: addressof(_Tmp); } else { return _Proxy{*_Val._Iterator}; } } common_iterator& operator++() { do { if (_Val._Contains == _Variantish_state::_Holds_iter) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 920, 0, "%s", "common_iterator can only be incremented if it holds an iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"common_iterator can only be incremented if it holds an iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 920, 0); } while (false); } ; } while (false); ++_Val._Iterator; return *this; } decltype(auto) operator++(int) { do { if (_Val._Contains == _Variantish_state::_Holds_iter) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 929, 0, "%s", "common_iterator can only be incremented if it holds an iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"common_iterator can only be incremented if it holds an iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 929, 0); } while (false); } ; } while (false); if constexpr (forward_iterator<_Iter>) { common_iterator _Tmp = *this; ++_Val._Iterator; return _Tmp; } else { return _Val._Iterator++; } } template <class _OIter, sentinel_for<_Iter> _OSe> requires sentinel_for<_Se, _OIter> [[nodiscard]] friend bool operator==(const common_iterator& _Left, const common_iterator<_OIter, _OSe>& _Right) { do { if (_Left._Val._Contains != _Variantish_state::_Nothing && _Right._Val._Contains != _Variantish_state::_Nothing) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 948, 0, "%s", "common_iterators can only be compared if both hold a value")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"common_iterators can only be compared if both hold a value\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 948, 0); } while (false); } ; } while (false); if (_Left._Val._Contains == _Variantish_state::_Holds_iter) { if (_Right._Val._Contains == _Variantish_state::_Holds_iter) { if constexpr (equality_comparable_with<_Iter, _OIter>) { return _Left._Val._Iterator == _Right._Val._Iterator; } else { return true; } } else { return _Left._Val._Iterator == _Right._Val._Sentinel; } } else { if (_Right._Val._Contains == _Variantish_state::_Holds_iter) { return _Left._Val._Sentinel == _Right._Val._Iterator; } else { return true; } } } template <sized_sentinel_for<_Iter> _OIter, sized_sentinel_for<_Iter> _OSe> requires sized_sentinel_for<_Se, _OIter> [[nodiscard]] friend iter_difference_t<_OIter> operator-( const common_iterator& _Left, const common_iterator<_OIter, _OSe>& _Right) { do { if (_Left._Val._Contains != _Variantish_state::_Nothing && _Right._Val._Contains != _Variantish_state::_Nothing) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 979, 0, "%s", "Cannot take difference of valueless common_iterators")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"Cannot take difference of valueless common_iterators\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 979, 0); } while (false); } ; } while (false); if (_Left._Val._Contains == _Variantish_state::_Holds_iter) { if (_Right._Val._Contains == _Variantish_state::_Holds_iter) { return _Left._Val._Iterator - _Right._Val._Iterator; } else { return _Left._Val._Iterator - _Right._Val._Sentinel; } } else { if (_Right._Val._Contains == _Variantish_state::_Holds_iter) { return _Left._Val._Sentinel - _Right._Val._Iterator; } else { return 0; } } } [[nodiscard]] friend iter_rvalue_reference_t<_Iter> iter_move(const common_iterator& _Right) noexcept( noexcept(::std::ranges:: iter_move(_Right._Val._Iterator))) requires input_iterator<_Iter> { do { if (_Right._Val._Contains == _Variantish_state::_Holds_iter) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1001, 0, "%s", "can only iter_move from common_iterator if it holds an iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"can only iter_move from common_iterator if it holds an iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1001, 0); } while (false); } ; } while (false); return ::std::ranges:: iter_move(_Right._Val._Iterator); } template <indirectly_swappable<_Iter> _OIter, class _OSe> friend void iter_swap(const common_iterator& _Left, const common_iterator<_OIter, _OSe>& _Right) noexcept( noexcept(::std::ranges:: iter_swap(_Left._Val._Iterator, _Right._Val._Iterator))) { do { if (_Left._Val._Contains == _Variantish_state::_Holds_iter && _Right._Val._Contains == _Variantish_state::_Holds_iter) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1012, 0, "%s", "can only iter_swap common_iterators if both hold iterators")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"can only iter_swap common_iterators if both hold iterators\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1012, 0); } while (false); } ; } while (false); return ::std::ranges:: iter_swap(_Left._Val._Iterator, _Right._Val._Iterator); } private: template <input_or_output_iterator _OIter, sentinel_for<_OIter> _OSe> requires (!same_as<_OIter, _OSe> && copyable<_OIter>) friend class common_iterator; _Variantish<_Iter, _Se> _Val; }; template <class _Iter, class _Se> struct incrementable_traits<common_iterator<_Iter, _Se>> { using difference_type = iter_difference_t<_Iter>; }; template <class> struct _Common_iterator_pointer_type { using pointer = void; }; template <_Has_member_arrow _Iter> struct _Common_iterator_pointer_type<_Iter> { using pointer = decltype(::std:: declval<_Iter&>().operator->()); }; template <input_iterator _Iter, class _Se> struct iterator_traits<common_iterator<_Iter, _Se>> { using iterator_concept = conditional_t<forward_iterator<_Iter>, forward_iterator_tag, input_iterator_tag>; using iterator_category = conditional_t<derived_from<_Iter_cat_t<_Iter>, forward_iterator_tag>, forward_iterator_tag, input_iterator_tag>; using value_type = iter_value_t<_Iter>; using difference_type = iter_difference_t<_Iter>; using pointer = typename _Common_iterator_pointer_type<_Iter>::pointer; using reference = iter_reference_t<_Iter>; }; template <input_or_output_iterator _Iter> class counted_iterator { public: using iterator_type = _Iter; constexpr counted_iterator() = default; constexpr counted_iterator(_Iter _Right, const iter_difference_t<_Iter> _Diff) noexcept( is_nothrow_move_constructible_v<_Iter>) : _Current(::std:: move(_Right)), _Length(_Diff) { do { if (_Diff >= 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1065, 0, "%s", "counted_iterator requires non-negative length n")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"counted_iterator requires non-negative length n\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1065, 0); } while (false); } ; } while (false); } template <class _Other> requires convertible_to<const _Other&, _Iter> constexpr counted_iterator(const counted_iterator<_Other>& _Right) noexcept( is_nothrow_constructible_v<_Iter, const _Other&>) : _Current(_Right.base()), _Length(_Right.count()) {} template <class _Other> requires assignable_from<_Iter&, const _Other&> constexpr counted_iterator& operator=(const counted_iterator<_Other>& _Right) noexcept( is_nothrow_assignable_v<_Iter&, const _Other&>) { _Current = _Right.base(); _Length = _Right.count(); return *this; } [[nodiscard]] constexpr const _Iter& base() const& noexcept { return _Current; } [[nodiscard]] constexpr _Iter base() && noexcept(is_nothrow_move_constructible_v<_Iter>) { return ::std:: move(_Current); } [[nodiscard]] constexpr iter_difference_t<_Iter> count() const noexcept { return _Length; } [[nodiscard]] constexpr decltype(auto) operator*() noexcept(noexcept(*_Current)) { do { if (_Length > 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1102, 0, "%s", "counted_iterator dereference beyond end of range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"counted_iterator dereference beyond end of range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1102, 0); } while (false); } ; } while (false); return *_Current; } [[nodiscard]] constexpr decltype(auto) operator*() const noexcept(noexcept(*_Current)) requires _Dereferenceable<const _Iter> { do { if (_Length > 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1110, 0, "%s", "counted_iterator dereference beyond end of range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"counted_iterator dereference beyond end of range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1110, 0); } while (false); } ; } while (false); return *_Current; } [[nodiscard]] constexpr decltype(auto) operator[](const iter_difference_t<_Iter> _Diff) const requires random_access_iterator<_Iter> { do { if (_Diff < _Length) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1118, 0, "%s", "counted_iterator index out of range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"counted_iterator index out of range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1118, 0); } while (false); } ; } while (false); return _Current[_Diff]; } constexpr counted_iterator& operator++() { do { if (_Length > 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1126, 0, "%s", "counted_iterator increment beyond end of range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"counted_iterator increment beyond end of range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1126, 0); } while (false); } ; } while (false); ++_Current; --_Length; return *this; } constexpr decltype(auto) operator++(int) { do { if (_Length > 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1135, 0, "%s", "counted_iterator increment beyond end of range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"counted_iterator increment beyond end of range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1135, 0); } while (false); } ; } while (false); --_Length; try { return _Current++; } catch (...) { ++_Length; throw; } } constexpr counted_iterator operator++(int) requires forward_iterator<_Iter> { do { if (_Length > 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1150, 0, "%s", "counted_iterator increment beyond end of range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"counted_iterator increment beyond end of range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1150, 0); } while (false); } ; } while (false); counted_iterator _Tmp = *this; ++_Current; --_Length; return _Tmp; } constexpr counted_iterator& operator--() requires bidirectional_iterator<_Iter> { --_Current; ++_Length; return *this; } constexpr counted_iterator operator--(int) requires bidirectional_iterator<_Iter> { counted_iterator _Tmp = *this; --_Current; ++_Length; return _Tmp; } [[nodiscard]] constexpr counted_iterator operator+(const iter_difference_t<_Iter> _Diff) const requires random_access_iterator<_Iter> { return counted_iterator{_Current + _Diff, static_cast<iter_difference_t<_Iter>>(_Length - _Diff)}; } [[nodiscard]] friend constexpr counted_iterator operator+( const iter_difference_t<_Iter> _Diff, const counted_iterator& _Right) requires random_access_iterator<_Iter> { return counted_iterator{_Right._Current + _Diff, static_cast<iter_difference_t<_Iter>>(_Right._Length - _Diff)}; } constexpr counted_iterator& operator+=( const iter_difference_t<_Iter> _Diff) requires random_access_iterator<_Iter> { do { if (_Diff <= _Length) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1184, 0, "%s", "counted_iterator seek beyond end of range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"counted_iterator seek beyond end of range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1184, 0); } while (false); } ; } while (false); _Current += _Diff; _Length -= _Diff; return *this; } [[nodiscard]] constexpr counted_iterator operator-(const iter_difference_t<_Iter> _Diff) const requires random_access_iterator<_Iter> { return counted_iterator{_Current - _Diff, static_cast<iter_difference_t<_Iter>>(_Length + _Diff)}; } template <common_with<_Iter> _Other> [[nodiscard]] friend constexpr iter_difference_t<_Other> operator-( const counted_iterator& _Left, const counted_iterator<_Other>& _Right) noexcept { _Same_sequence(_Left, _Right); return _Right.count() - _Left._Length; } [[nodiscard]] friend constexpr iter_difference_t<_Iter> operator-( const counted_iterator& _Left, default_sentinel_t) noexcept { return -_Left._Length; } [[nodiscard]] friend constexpr iter_difference_t<_Iter> operator-( default_sentinel_t, const counted_iterator& _Right) noexcept { return _Right._Length; } constexpr counted_iterator& operator-=( const iter_difference_t<_Iter> _Diff) requires random_access_iterator<_Iter> { do { if (-_Diff <= _Length) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1218, 0, "%s", "counted_iterator decrement beyond end of range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"counted_iterator decrement beyond end of range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1218, 0); } while (false); } ; } while (false); _Current -= _Diff; _Length += _Diff; return *this; } template <common_with<_Iter> _Other> [[nodiscard]] friend constexpr bool operator==( const counted_iterator& _Left, const counted_iterator<_Other>& _Right) noexcept { _Same_sequence(_Left, _Right); return _Left._Length == _Right.count(); } [[nodiscard]] friend constexpr bool operator==(const counted_iterator& _Left, default_sentinel_t) noexcept { return _Left._Length == 0; } template <common_with<_Iter> _Other> [[nodiscard]] friend constexpr strong_ordering operator<=>( const counted_iterator& _Left, const counted_iterator<_Other>& _Right) noexcept { _Same_sequence(_Left, _Right); return _Right.count() <=> _Left._Length; } [[nodiscard]] friend constexpr iter_rvalue_reference_t<_Iter> iter_move(const counted_iterator& _Right) noexcept( noexcept(::std::ranges:: iter_move(_Right._Current))) requires input_iterator<_Iter> { return ::std::ranges:: iter_move(_Right._Current); } template <indirectly_swappable<_Iter> _Other> friend constexpr void iter_swap(const counted_iterator& _Left, const counted_iterator<_Other>& _Right) noexcept( noexcept(::std::ranges:: iter_swap(_Left._Current, _Right.base()))) { ::std::ranges:: iter_swap(_Left._Current, _Right.base()); } template <common_with<_Iter> _Other> friend constexpr void _Same_sequence( const counted_iterator& _Left, const counted_iterator<_Other>& _Right) noexcept { if constexpr (forward_iterator<_Iter> && forward_iterator<_Other>) { using _CIter = common_type_t<_Iter, _Other>; using _CDiff = common_type_t<iter_difference_t<_Iter>, iter_difference_t<_Other>>; const _CDiff _Diff = static_cast<_CDiff>(_Left._Length) - static_cast<_CDiff>(_Right.count()); if (_Diff < 0) { do { if (static_cast<_CIter>(_Left._Current) == ::std::ranges:: next(static_cast<_CIter>(_Right.base()), -_Diff)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1275, 0, "%s", "counted_iterators from different ranges")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"counted_iterators from different ranges\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1275, 0); } while (false); } ; } while (false); } else { do { if (::std::ranges:: next(static_cast<_CIter>(_Left._Current), _Diff) == static_cast<_CIter>(_Right.base())) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1279, 0, "%s", "counted_iterators from different ranges")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"counted_iterators from different ranges\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1279, 0); } while (false); } ; } while (false); } } } template <common_with<_Iter> _Other> friend constexpr void _Verify_range(const counted_iterator& _Left, const counted_iterator<_Other>& _Right) { if constexpr (_Range_verifiable_v<_Iter, _Other>) { _Verify_range(_Left._Current, _Right.base()); } _Same_sequence(_Left, _Right); } constexpr void _Verify_offset(const iter_difference_t<_Iter> _Off) const { do { if (_Off <= _Length) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1296, 0, "%s", "Offset larger than counted_iterator length")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"Offset larger than counted_iterator length\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1296, 0); } while (false); } ; } while (false); if constexpr (_Offset_verifiable_v<_Iter>) { _Current._Verify_offset(_Off); } } using _Prevent_inheriting_unwrap = counted_iterator; [[nodiscard]] constexpr counted_iterator<_Unwrapped_t<const _Iter&>> _Unwrapped() const& requires _Unwrappable_v<const _Iter&> { return counted_iterator<_Unwrapped_t<const _Iter&>>{_Current._Unwrapped(), _Length}; } [[nodiscard]] constexpr counted_iterator<_Unwrapped_t<_Iter>> _Unwrapped() && requires _Unwrappable_v<_Iter> { return counted_iterator<_Unwrapped_t<_Iter>>{::std:: move(_Current)._Unwrapped(), _Length}; } static constexpr bool _Unwrap_when_unverified = _Do_unwrap_when_unverified_v<_Iter>; template <class _Other> requires _Wrapped_seekable_v<_Iter, const _Other&> constexpr void _Seek_to(const counted_iterator<_Other>& _It) { _Current._Seek_to(_It.base()); _Length = _It.count(); } template <class _Other> requires _Wrapped_seekable_v<_Iter, _Other> constexpr void _Seek_to(counted_iterator<_Other>&& _It) { _Current._Seek_to(::std:: move(_It).base()); _Length = _It.count(); } private: _Iter _Current{}; iter_difference_t<_Iter> _Length = 0; }; template <class _Iter> struct incrementable_traits<counted_iterator<_Iter>> { using difference_type = iter_difference_t<_Iter>; }; template <input_iterator _Iter> struct iterator_traits<counted_iterator<_Iter>> : iterator_traits<_Iter> { using pointer = void; }; template <contiguous_iterator _Iter> struct pointer_traits<counted_iterator<_Iter>> { using pointer = counted_iterator<_Iter>; using element_type = remove_reference_t<iter_reference_t<_Iter>>; using difference_type = iter_difference_t<_Iter>; [[nodiscard]] static constexpr element_type* to_address(const pointer _It) noexcept { return ::std:: to_address(_It.base()); } }; } namespace stdext { using ::std:: iterator_traits; using ::std:: size_t; template <class _Ptr> class checked_array_iterator { static_assert(::std:: is_pointer_v<_Ptr>, "checked_array_iterator requires pointers"); public: using iterator_category = typename iterator_traits<_Ptr>::iterator_category; using value_type = typename iterator_traits<_Ptr>::value_type; using difference_type = typename iterator_traits<_Ptr>::difference_type; using pointer = typename iterator_traits<_Ptr>::pointer; using reference = typename iterator_traits<_Ptr>::reference; constexpr checked_array_iterator() noexcept : _Myarray(nullptr), _Mysize(0), _Myindex(0) {} constexpr checked_array_iterator(const _Ptr _Array, const size_t _Size, const size_t _Index = 0) noexcept : _Myarray(_Array), _Mysize(_Size), _Myindex(_Index) { do { if (_Index <= _Size) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1383, 0, "%s", "checked_array_iterator construction index out of range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"checked_array_iterator construction index out of range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1383, 0); } while (false); } ; } while (false); } [[nodiscard]] constexpr _Ptr base() const noexcept { return _Myarray + _Myindex; } [[nodiscard]] constexpr reference operator*() const noexcept { return *operator->(); } [[nodiscard]] constexpr pointer operator->() const noexcept { do { if (_Myarray) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1395, 0, "%s", "cannot dereference value-initialized or null checked_array_iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot dereference value-initialized or null checked_array_iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1395, 0); } while (false); } ; } while (false); do { if (_Myindex < _Mysize) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1396, 0, "%s", "cannot dereference end checked_array_iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot dereference end checked_array_iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1396, 0); } while (false); } ; } while (false); return _Myarray + _Myindex; } constexpr checked_array_iterator& operator++() noexcept { do { if (_Myarray) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1401, 0, "%s", "cannot increment value-initialized or null checked_array_iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot increment value-initialized or null checked_array_iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1401, 0); } while (false); } ; } while (false); do { if (_Myindex < _Mysize) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1402, 0, "%s", "cannot increment checked_array_iterator past end")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot increment checked_array_iterator past end\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1402, 0); } while (false); } ; } while (false); ++_Myindex; return *this; } constexpr checked_array_iterator operator++(int) noexcept { checked_array_iterator _Tmp = *this; ++*this; return _Tmp; } constexpr checked_array_iterator& operator--() noexcept { do { if (_Myarray) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1414, 0, "%s", "cannot decrement value-initialized or null checked_array_iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot decrement value-initialized or null checked_array_iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1414, 0); } while (false); } ; } while (false); do { if (_Myindex != 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1415, 0, "%s", "cannot decrement checked_array_iterator before begin")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot decrement checked_array_iterator before begin\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1415, 0); } while (false); } ; } while (false); --_Myindex; return *this; } constexpr checked_array_iterator operator--(int) noexcept { checked_array_iterator _Tmp = *this; --*this; return _Tmp; } constexpr checked_array_iterator& operator+=(const difference_type _Off) noexcept { if (_Off != 0) { do { if (_Myarray) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1428, 0, "%s", "cannot seek value-initialized or null checked_array_iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek value-initialized or null checked_array_iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1428, 0); } while (false); } ; } while (false); } if (_Off < 0) { do { if (_Myindex >= size_t{0} - static_cast<size_t>(_Off)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1433, 0, "%s", "cannot seek checked_array_iterator before begin")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek checked_array_iterator before begin\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1433, 0); } while (false); } ; } while (false); } if (_Off > 0) { do { if (_Mysize - _Myindex >= static_cast<size_t>(_Off)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1438, 0, "%s", "cannot seek checked_array_iterator after end")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek checked_array_iterator after end\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1438, 0); } while (false); } ; } while (false); } _Myindex += _Off; return *this; } [[nodiscard]] constexpr checked_array_iterator operator+(const difference_type _Off) const noexcept { checked_array_iterator _Tmp = *this; _Tmp += _Off; return _Tmp; } [[nodiscard]] friend constexpr checked_array_iterator operator+( const difference_type _Off, const checked_array_iterator<_Ptr>& _Next) noexcept { return _Next + _Off; } constexpr checked_array_iterator& operator-=(const difference_type _Off) noexcept { if (_Off != 0) { do { if (_Myarray) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1461, 0, "%s", "cannot seek value-initialized or null checked_array_iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek value-initialized or null checked_array_iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1461, 0); } while (false); } ; } while (false); } if (_Off > 0) { do { if (_Myindex >= static_cast<size_t>(_Off)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1465, 0, "%s", "cannot seek checked_array_iterator before begin")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek checked_array_iterator before begin\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1465, 0); } while (false); } ; } while (false); } if (_Off < 0) { do { if (_Mysize - _Myindex >= size_t{0} - static_cast<size_t>(_Off)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1470, 0, "%s", "cannot seek checked_array_iterator after end")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek checked_array_iterator after end\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1470, 0); } while (false); } ; } while (false); } _Myindex -= _Off; return *this; } [[nodiscard]] constexpr checked_array_iterator operator-(const difference_type _Off) const noexcept { checked_array_iterator _Tmp = *this; _Tmp -= _Off; return _Tmp; } [[nodiscard]] constexpr difference_type operator-(const checked_array_iterator& _Right) const noexcept { do { if (_Myarray == _Right._Myarray && _Mysize == _Right._Mysize) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1485, 0, "%s", "cannot subtract incompatible checked_array_iterators")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot subtract incompatible checked_array_iterators\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1485, 0); } while (false); } ; } while (false); return static_cast<difference_type>(_Myindex - _Right._Myindex); } [[nodiscard]] constexpr reference operator[](const difference_type _Off) const noexcept { return *(*this + _Off); } [[nodiscard]] constexpr bool operator==(const checked_array_iterator& _Right) const noexcept { do { if (_Myarray == _Right._Myarray && _Mysize == _Right._Mysize) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1495, 0, "%s", "cannot compare incompatible checked_array_iterators for equality")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot compare incompatible checked_array_iterators for equality\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1495, 0); } while (false); } ; } while (false); return _Myindex == _Right._Myindex; } [[nodiscard]] constexpr ::std:: strong_ordering operator<=>(const checked_array_iterator& _Right) const noexcept { do { if (_Myarray == _Right._Myarray && _Mysize == _Right._Mysize) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1502, 0, "%s", "cannot compare incompatible checked_array_iterators")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot compare incompatible checked_array_iterators\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1502, 0); } while (false); } ; } while (false); return _Myindex <=> _Right._Myindex; } friend constexpr void _Verify_range( const checked_array_iterator& _First, const checked_array_iterator& _Last) noexcept { do { if (_First._Myarray == _Last._Myarray && _First._Mysize == _Last._Mysize) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1532, 0, "%s", "mismatching checked_array_iterators")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"mismatching checked_array_iterators\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1532, 0); } while (false); } ; } while (false); do { if (_First._Myindex <= _Last._Myindex) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1533, 0, "%s", "transposed checked_array_iterator range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"transposed checked_array_iterator range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1533, 0); } while (false); } ; } while (false); } constexpr void _Verify_offset(const difference_type _Off) const noexcept { if (_Off < 0) { do { if (_Myindex >= size_t{0} - static_cast<size_t>(_Off)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1539, 0, "%s", "cannot seek checked_array_iterator iterator before begin")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek checked_array_iterator iterator before begin\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1539, 0); } while (false); } ; } while (false); } if (_Off > 0) { do { if (_Mysize - _Myindex >= static_cast<size_t>(_Off)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1544, 0, "%s", "cannot seek checked_array_iterator iterator after end")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek checked_array_iterator iterator after end\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\iterator", 1544, 0); } while (false); } ; } while (false); } } using _Prevent_inheriting_unwrap = checked_array_iterator; [[nodiscard]] constexpr _Ptr _Unwrapped() const noexcept { return _Myarray + _Myindex; } constexpr void _Seek_to(_Ptr _It) noexcept { _Myindex = static_cast<size_t>(_It - _Myarray); } private: _Ptr _Myarray; size_t _Mysize; size_t _Myindex; }; template <class _Ptr> [[nodiscard]] constexpr checked_array_iterator<_Ptr> make_checked_array_iterator( const _Ptr _Array, const size_t _Size, const size_t _Index = 0) { return checked_array_iterator<_Ptr>(_Array, _Size, _Index); } template <class _Ptr> class unchecked_array_iterator { static_assert(::std:: is_pointer_v<_Ptr>, "unchecked_array_iterator requires pointers"); public: using iterator_category = typename iterator_traits<_Ptr>::iterator_category; using value_type = typename iterator_traits<_Ptr>::value_type; using difference_type = typename iterator_traits<_Ptr>::difference_type; using pointer = typename iterator_traits<_Ptr>::pointer; using reference = typename iterator_traits<_Ptr>::reference; constexpr unchecked_array_iterator() noexcept : _Myptr(nullptr) {} constexpr explicit unchecked_array_iterator(const _Ptr _Src) noexcept : _Myptr(_Src) {} [[nodiscard]] constexpr _Ptr base() const noexcept { return _Myptr; } [[nodiscard]] constexpr reference operator*() const noexcept { return *_Myptr; } [[nodiscard]] constexpr pointer operator->() const noexcept { return _Myptr; } constexpr unchecked_array_iterator& operator++() noexcept { ++_Myptr; return *this; } constexpr unchecked_array_iterator operator++(int) noexcept { unchecked_array_iterator _Tmp = *this; ++_Myptr; return _Tmp; } constexpr unchecked_array_iterator& operator--() noexcept { --_Myptr; return *this; } constexpr unchecked_array_iterator operator--(int) noexcept { unchecked_array_iterator _Tmp = *this; --_Myptr; return _Tmp; } constexpr unchecked_array_iterator& operator+=(const difference_type _Off) noexcept { _Myptr += _Off; return *this; } [[nodiscard]] constexpr unchecked_array_iterator operator+(const difference_type _Off) const noexcept { unchecked_array_iterator _Tmp = *this; _Tmp += _Off; return _Tmp; } [[nodiscard]] friend constexpr unchecked_array_iterator operator+( const difference_type _Off, const unchecked_array_iterator& _Next) noexcept { return _Next + _Off; } constexpr unchecked_array_iterator& operator-=(const difference_type _Off) noexcept { return *this += -_Off; } [[nodiscard]] constexpr unchecked_array_iterator operator-(const difference_type _Off) const noexcept { unchecked_array_iterator _Tmp = *this; _Tmp -= _Off; return _Tmp; } [[nodiscard]] constexpr difference_type operator-(const unchecked_array_iterator& _Right) const noexcept { return _Myptr - _Right._Myptr; } [[nodiscard]] constexpr reference operator[](const difference_type _Off) const noexcept { return *(*this + _Off); } [[nodiscard]] constexpr bool operator==(const unchecked_array_iterator& _Right) const noexcept { return _Myptr == _Right._Myptr; } [[nodiscard]] constexpr ::std:: strong_ordering operator<=>(const unchecked_array_iterator& _Right) const noexcept { return _Myptr <=> _Right._Myptr; } friend constexpr void _Verify_range( const unchecked_array_iterator _First, const unchecked_array_iterator _Last) noexcept { ::std:: _Verify_range(_First._Myptr, _Last._Myptr); } using _Prevent_inheriting_unwrap = unchecked_array_iterator; static constexpr bool _Unwrap_when_unverified = true; [[nodiscard]] constexpr _Ptr _Unwrapped() const noexcept { return _Myptr; } constexpr void _Seek_to(_Ptr _It) noexcept { _Myptr = _It; } private: _Ptr _Myptr; }; template <class _Ptr> [[nodiscard]] unchecked_array_iterator<_Ptr> make_unchecked_array_iterator(const _Ptr _It) noexcept { return unchecked_array_iterator<_Ptr>(_It); } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) extern "C" { [[nodiscard]] size_t __stdcall __std_get_string_size_without_trailing_whitespace( const char* _Str, size_t _Size) noexcept; [[nodiscard]] size_t __stdcall __std_system_error_allocate_message( unsigned long _Message_id, char** _Ptr_str) noexcept; void __stdcall __std_system_error_deallocate_message(char* _Str) noexcept; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { class logic_error : public exception { public: using _Mybase = exception; explicit logic_error(const string& _Message) : _Mybase(_Message.c_str()) {} explicit logic_error(const char* _Message) : _Mybase(_Message) {} }; class domain_error : public logic_error { public: using _Mybase = logic_error; explicit domain_error(const string& _Message) : _Mybase(_Message.c_str()) {} explicit domain_error(const char* _Message) : _Mybase(_Message) {} }; class invalid_argument : public logic_error { public: using _Mybase = logic_error; explicit invalid_argument(const string& _Message) : _Mybase(_Message.c_str()) {} explicit invalid_argument(const char* _Message) : _Mybase(_Message) {} }; class length_error : public logic_error { public: using _Mybase = logic_error; explicit length_error(const string& _Message) : _Mybase(_Message.c_str()) {} explicit length_error(const char* _Message) : _Mybase(_Message) {} }; class out_of_range : public logic_error { public: using _Mybase = logic_error; explicit out_of_range(const string& _Message) : _Mybase(_Message.c_str()) {} explicit out_of_range(const char* _Message) : _Mybase(_Message) {} }; class runtime_error : public exception { public: using _Mybase = exception; explicit runtime_error(const string& _Message) : _Mybase(_Message.c_str()) {} explicit runtime_error(const char* _Message) : _Mybase(_Message) {} }; class overflow_error : public runtime_error { public: using _Mybase = runtime_error; explicit overflow_error(const string& _Message) : _Mybase(_Message.c_str()) {} explicit overflow_error(const char* _Message) : _Mybase(_Message) {} }; class underflow_error : public runtime_error { public: using _Mybase = runtime_error; explicit underflow_error(const string& _Message) : _Mybase(_Message.c_str()) {} explicit underflow_error(const char* _Message) : _Mybase(_Message) {} }; class range_error : public runtime_error { public: using _Mybase = runtime_error; explicit range_error(const string& _Message) : _Mybase(_Message.c_str()) {} explicit range_error(const char* _Message) : _Mybase(_Message) {} }; [[noreturn]] inline void _Throw_range_error(const char* const _Message) { throw range_error{_Message}; } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { struct once_flag { constexpr once_flag() noexcept : _Opaque(nullptr) {} once_flag(const once_flag&) = delete; once_flag& operator=(const once_flag&) = delete; void* _Opaque; }; using _Execute_once_fp_t = int(__stdcall*)(void*, void*, void**); int __cdecl _Execute_once( once_flag& _Flag, _Execute_once_fp_t _Callback, void* _Pv) noexcept; template <class _Ty> union _Immortalizer_impl { constexpr _Immortalizer_impl() noexcept : _Storage{} {} _Immortalizer_impl(const _Immortalizer_impl&) = delete; _Immortalizer_impl& operator=(const _Immortalizer_impl&) = delete; ~_Immortalizer_impl() { } _Ty _Storage; }; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { enum class errc { address_family_not_supported = 102, address_in_use = 100, address_not_available = 101, already_connected = 113, argument_list_too_long = 7, argument_out_of_domain = 33, bad_address = 14, bad_file_descriptor = 9, bad_message = 104, broken_pipe = 32, connection_aborted = 106, connection_already_in_progress = 103, connection_refused = 107, connection_reset = 108, cross_device_link = 18, destination_address_required = 109, device_or_resource_busy = 16, directory_not_empty = 41, executable_format_error = 8, file_exists = 17, file_too_large = 27, filename_too_long = 38, function_not_supported = 40, host_unreachable = 110, identifier_removed = 111, illegal_byte_sequence = 42, inappropriate_io_control_operation = 25, interrupted = 4, invalid_argument = 22, invalid_seek = 29, io_error = 5, is_a_directory = 21, message_size = 115, network_down = 116, network_reset = 117, network_unreachable = 118, no_buffer_space = 119, no_child_process = 10, no_link = 121, no_lock_available = 39, no_message_available = 120, no_message = 122, no_protocol_option = 123, no_space_on_device = 28, no_stream_resources = 124, no_such_device_or_address = 6, no_such_device = 19, no_such_file_or_directory = 2, no_such_process = 3, not_a_directory = 20, not_a_socket = 128, not_a_stream = 125, not_connected = 126, not_enough_memory = 12, not_supported = 129, operation_canceled = 105, operation_in_progress = 112, operation_not_permitted = 1, operation_not_supported = 130, operation_would_block = 140, owner_dead = 133, permission_denied = 13, protocol_error = 134, protocol_not_supported = 135, read_only_file_system = 30, resource_deadlock_would_occur = 36, resource_unavailable_try_again = 11, result_out_of_range = 34, state_not_recoverable = 127, stream_timeout = 137, text_file_busy = 139, timed_out = 138, too_many_files_open_in_system = 23, too_many_files_open = 24, too_many_links = 31, too_many_symbolic_link_levels = 114, value_too_large = 132, wrong_protocol_type = 136 }; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { enum class io_errc { stream = 1 }; template <class _Enum> struct is_error_code_enum : false_type {}; template <> struct is_error_code_enum<io_errc> : true_type {}; template <class _Ty> inline constexpr bool is_error_code_enum_v = is_error_code_enum<_Ty>::value; template <class _Enum> struct is_error_condition_enum : false_type {}; template <> struct is_error_condition_enum<errc> : true_type {}; template <class _Ty> inline constexpr bool is_error_condition_enum_v = is_error_condition_enum<_Ty>::value; class error_code; class error_condition; [[nodiscard]] error_code make_error_code(errc) noexcept; [[nodiscard]] error_code make_error_code(io_errc) noexcept; [[nodiscard]] error_condition make_error_condition(errc) noexcept; [[nodiscard]] error_condition make_error_condition(io_errc) noexcept; class error_category; [[nodiscard]] const error_category& generic_category() noexcept; [[nodiscard]] const error_category& iostream_category() noexcept; [[nodiscard]] const error_category& system_category() noexcept; class __declspec(novtable) error_category { public: error_category() noexcept { _Addr = reinterpret_cast<uintptr_t>(this); } constexpr virtual ~error_category() noexcept = default; [[nodiscard]] virtual const char* name() const noexcept = 0; [[nodiscard]] virtual string message(int _Errval) const = 0; [[nodiscard]] virtual error_condition default_error_condition(int _Errval) const noexcept; [[nodiscard]] virtual bool equivalent(int _Errval, const error_condition& _Cond) const noexcept; [[nodiscard]] virtual bool equivalent(const error_code& _Code, int _Errval) const noexcept; [[nodiscard]] bool operator==(const error_category& _Right) const noexcept { return _Addr == _Right._Addr; } [[nodiscard]] strong_ordering operator<=>(const error_category& _Right) const noexcept { return compare_three_way{}(_Addr, _Right._Addr); } error_category(const error_category&) = delete; error_category& operator=(const error_category&) = delete; protected: uintptr_t _Addr; constexpr explicit error_category(const uintptr_t _Addr_) noexcept : _Addr(_Addr_) {} enum : uintptr_t { _Future_addr = 1, _Generic_addr = 3, _Iostream_addr = 5, _System_addr = 7 }; }; [[nodiscard]] inline bool _System_error_equal(const error_code&, const error_condition&) noexcept; class error_code { public: error_code() noexcept : _Myval(0), _Mycat(&::std:: system_category()) {} error_code(int _Val, const error_category& _Cat) noexcept : _Myval(_Val), _Mycat(&_Cat) {} template <class _Enum, enable_if_t<is_error_code_enum_v<_Enum>, int> = 0> error_code(_Enum _Errcode) noexcept : _Myval(0), _Mycat(nullptr) { *this = make_error_code(_Errcode); } void assign(int _Val, const error_category& _Cat) noexcept { _Myval = _Val; _Mycat = &_Cat; } template <class _Enum, enable_if_t<is_error_code_enum_v<_Enum>, int> = 0> error_code& operator=(_Enum _Errcode) noexcept { *this = make_error_code(_Errcode); return *this; } void clear() noexcept { _Myval = 0; _Mycat = &::std:: system_category(); } [[nodiscard]] int value() const noexcept { return _Myval; } [[nodiscard]] const error_category& category() const noexcept { return *_Mycat; } [[nodiscard]] error_condition default_error_condition() const noexcept; [[nodiscard]] string message() const { return category().message(value()); } explicit operator bool() const noexcept { return value() != 0; } [[nodiscard]] friend bool operator==(const error_code& _Left, const error_code& _Right) noexcept { return _Left.category() == _Right.category() && _Left.value() == _Right.value(); } [[nodiscard]] friend bool operator==(const error_code& _Left, const error_condition& _Right) noexcept { return _System_error_equal(_Left, _Right); } [[nodiscard]] friend strong_ordering operator<=>(const error_code& _Left, const error_code& _Right) noexcept { if (const auto _Result = _Left.category() <=> _Right.category(); _Result != 0) { return _Result; } return _Left.value() <=> _Right.value(); } private: int _Myval; const error_category* _Mycat; }; class error_condition { public: error_condition() noexcept : _Myval(0), _Mycat(&::std:: generic_category()) {} error_condition(int _Val, const error_category& _Cat) noexcept : _Myval(_Val), _Mycat(&_Cat) {} template <class _Enum, enable_if_t<is_error_condition_enum_v<_Enum>, int> = 0> error_condition(_Enum _Errcode) noexcept : _Myval(0), _Mycat(nullptr) { *this = make_error_condition(_Errcode); } void assign(int _Val, const error_category& _Cat) noexcept { _Myval = _Val; _Mycat = &_Cat; } template <class _Enum, enable_if_t<is_error_condition_enum_v<_Enum>, int> = 0> error_condition& operator=(_Enum _Errcode) noexcept { *this = make_error_condition(_Errcode); return *this; } void clear() noexcept { _Myval = 0; _Mycat = &::std:: generic_category(); } [[nodiscard]] int value() const noexcept { return _Myval; } [[nodiscard]] const error_category& category() const noexcept { return *_Mycat; } [[nodiscard]] string message() const { return category().message(value()); } explicit operator bool() const noexcept { return value() != 0; } [[nodiscard]] friend bool operator==(const error_condition& _Left, const error_condition& _Right) noexcept { return _Left.category() == _Right.category() && _Left.value() == _Right.value(); } [[nodiscard]] friend strong_ordering operator<=>( const error_condition& _Left, const error_condition& _Right) noexcept { if (const auto _Result = _Left.category() <=> _Right.category(); _Result != 0) { return _Result; } return _Left.value() <=> _Right.value(); } friend bool operator==(const error_code& _Left, const error_condition& _Right) noexcept; private: int _Myval; const error_category* _Mycat; }; [[nodiscard]] inline bool _System_error_equal(const error_code& _Left, const error_condition& _Right) noexcept { return _Left.category().equivalent(_Left.value(), _Right) || _Right.category().equivalent(_Left, _Right.value()); } [[nodiscard]] inline error_condition error_category::default_error_condition(int _Errval) const noexcept { return error_condition(_Errval, *this); } [[nodiscard]] inline bool error_category::equivalent(int _Errval, const error_condition& _Cond) const noexcept { return default_error_condition(_Errval) == _Cond; } [[nodiscard]] inline bool error_category::equivalent(const error_code& _Code, int _Errval) const noexcept { return *this == _Code.category() && _Code.value() == _Errval; } [[nodiscard]] inline error_condition error_code::default_error_condition() const noexcept { return category().default_error_condition(value()); } [[nodiscard]] inline error_code make_error_code(errc _Errno) noexcept { return error_code(static_cast<int>(_Errno), ::std:: generic_category()); } [[nodiscard]] inline error_code make_error_code(io_errc _Errno) noexcept { return error_code(static_cast<int>(_Errno), ::std:: iostream_category()); } [[nodiscard]] inline error_condition make_error_condition(errc _Errno) noexcept { return error_condition(static_cast<int>(_Errno), ::std:: generic_category()); } [[nodiscard]] inline error_condition make_error_condition(io_errc _Errno) noexcept { return error_condition(static_cast<int>(_Errno), ::std:: iostream_category()); } template <> struct hash<error_code> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef error_code _Unnameable_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef size_t _Unnameable_result; [[nodiscard]] size_t operator()(const error_code& _Keyval) const noexcept { return hash<int>{}(_Keyval.value()); } }; template <> struct hash<error_condition> { [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef error_condition _Unnameable_argument; [[deprecated( "warning STL4007: Many result_type typedefs " "and all argument_type, first_argument_type, and second_argument_type typedefs are deprecated in C++17. " "You can define _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] typedef size_t _Unnameable_result; [[nodiscard]] size_t operator()(const error_condition& _Keyval) const noexcept { return hash<int>{}(_Keyval.value()); } }; class _System_error : public runtime_error { private: static string _Makestr(error_code _Errcode, string _Message) { if (!_Message.empty()) { _Message.append(": "); } _Message.append(_Errcode.message()); return _Message; } protected: _System_error(error_code _Errcode, const string& _Message) : runtime_error(_Makestr(_Errcode, _Message)), _Mycode(_Errcode) {} error_code _Mycode; }; class system_error : public _System_error { private: using _Mybase = _System_error; public: system_error(error_code _Errcode) : _Mybase(_Errcode, "") {} system_error(error_code _Errcode, const string& _Message) : _Mybase(_Errcode, _Message) {} system_error(error_code _Errcode, const char* _Message) : _Mybase(_Errcode, _Message) {} system_error(int _Errval, const error_category& _Errcat) : _Mybase(error_code(_Errval, _Errcat), "") {} system_error(int _Errval, const error_category& _Errcat, const string& _Message) : _Mybase(error_code(_Errval, _Errcat), _Message) {} system_error(int _Errval, const error_category& _Errcat, const char* _Message) : _Mybase(error_code(_Errval, _Errcat), _Message) {} [[nodiscard]] const error_code& code() const noexcept { return _Mycode; } }; [[noreturn]] inline void _Throw_system_error(const errc _Errno) { throw system_error{::std:: make_error_code(_Errno)}; } const char* __cdecl _Syserror_map(int); int __cdecl _Winerror_map(int); struct _System_error_message { char* _Str; size_t _Length; explicit _System_error_message(const unsigned long _Ec) noexcept : _Str(nullptr), _Length(:: __std_system_error_allocate_message(_Ec, &_Str)) {} _System_error_message(const _System_error_message&) = delete; _System_error_message& operator=(const _System_error_message&) = delete; ~_System_error_message() { :: __std_system_error_deallocate_message(_Str); } }; class _Generic_error_category : public error_category { public: constexpr _Generic_error_category() noexcept : error_category(_Generic_addr) {} [[nodiscard]] virtual const char* name() const noexcept override { return "generic"; } [[nodiscard]] virtual string message(int _Errcode) const override { return _Syserror_map(_Errcode); } }; class _Iostream_error_category2 : public error_category { public: constexpr _Iostream_error_category2() noexcept : error_category(_Iostream_addr) {} [[nodiscard]] virtual const char* name() const noexcept override { return "iostream"; } [[nodiscard]] virtual string message(int _Errcode) const override { if (_Errcode == static_cast<int>(io_errc::stream)) { static constexpr char _Iostream_error[] = "iostream stream error"; constexpr size_t _Iostream_error_length = sizeof(_Iostream_error) - 1; return string(_Iostream_error, _Iostream_error_length); } else { return _Syserror_map(_Errcode); } } }; class _System_error_category : public error_category { public: constexpr _System_error_category() noexcept : error_category(_System_addr) {} [[nodiscard]] virtual const char* name() const noexcept override { return "system"; } [[nodiscard]] virtual string message(int _Errcode) const override { const _System_error_message _Msg(static_cast<unsigned long>(_Errcode)); if (_Msg._Length == 0) { static constexpr char _Unknown_error[] = "unknown error"; constexpr size_t _Unknown_error_length = sizeof(_Unknown_error) - 1; return string(_Unknown_error, _Unknown_error_length); } else { return string(_Msg._Str, _Msg._Length); } } [[nodiscard]] virtual error_condition default_error_condition(int _Errval) const noexcept override { const int _Posv = _Winerror_map(_Errval); if (_Posv == 0) { return error_condition(_Errval, ::std:: system_category()); } else { return error_condition(_Posv, ::std:: generic_category()); } } }; template <class _Ty> [[nodiscard]] const _Ty& _Immortalize_memcpy_image() noexcept { static constexpr _Ty _Static; return _Static; } [[nodiscard]] inline const error_category& generic_category() noexcept { return _Immortalize_memcpy_image<_Generic_error_category>(); } [[nodiscard]] inline const error_category& iostream_category() noexcept { return _Immortalize_memcpy_image<_Iostream_error_category2>(); } [[nodiscard]] inline const error_category& system_category() noexcept { return _Immortalize_memcpy_image<_System_error_category>(); } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { class __declspec(dllimport) _Facet_base { public: virtual ~_Facet_base() noexcept {} virtual void _Incref() noexcept = 0; virtual _Facet_base* _Decref() noexcept = 0; }; void __cdecl _Facet_Register(_Facet_base*); } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { __declspec(dllimport) int __cdecl _isctype( int _C, int _Type); __declspec(dllimport) int __cdecl _isctype_l( int _C, int _Type, _locale_t _Locale); __declspec(dllimport) int __cdecl isalpha( int _C); __declspec(dllimport) int __cdecl _isalpha_l( int _C, _locale_t _Locale); __declspec(dllimport) int __cdecl isupper( int _C); __declspec(dllimport) int __cdecl _isupper_l( int _C, _locale_t _Locale); __declspec(dllimport) int __cdecl islower( int _C); __declspec(dllimport) int __cdecl _islower_l( int _C, _locale_t _Locale); __declspec(dllimport) int __cdecl isdigit( int _C); __declspec(dllimport) int __cdecl _isdigit_l( int _C, _locale_t _Locale); __declspec(dllimport) int __cdecl isxdigit( int _C); __declspec(dllimport) int __cdecl _isxdigit_l( int _C, _locale_t _Locale); __declspec(dllimport) int __cdecl isspace( int _C); __declspec(dllimport) int __cdecl _isspace_l( int _C, _locale_t _Locale); __declspec(dllimport) int __cdecl ispunct( int _C); __declspec(dllimport) int __cdecl _ispunct_l( int _C, _locale_t _Locale); __declspec(dllimport) int __cdecl isblank( int _C); __declspec(dllimport) int __cdecl _isblank_l( int _C, _locale_t _Locale); __declspec(dllimport) int __cdecl isalnum( int _C); __declspec(dllimport) int __cdecl _isalnum_l( int _C, _locale_t _Locale); __declspec(dllimport) int __cdecl isprint( int _C); __declspec(dllimport) int __cdecl _isprint_l( int _C, _locale_t _Locale); __declspec(dllimport) int __cdecl isgraph( int _C); __declspec(dllimport) int __cdecl _isgraph_l( int _C, _locale_t _Locale); __declspec(dllimport) int __cdecl iscntrl( int _C); __declspec(dllimport) int __cdecl _iscntrl_l( int _C, _locale_t _Locale); __declspec(dllimport) int __cdecl toupper( int _C); __declspec(dllimport) int __cdecl tolower( int _C); __declspec(dllimport) int __cdecl _tolower( int _C); __declspec(dllimport) int __cdecl _tolower_l( int _C, _locale_t _Locale); __declspec(dllimport) int __cdecl _toupper( int _C); __declspec(dllimport) int __cdecl _toupper_l( int _C, _locale_t _Locale); __declspec(dllimport) int __cdecl __isascii( int _C); __declspec(dllimport) int __cdecl __toascii( int _C); __declspec(dllimport) int __cdecl __iscsymf( int _C); __declspec(dllimport) int __cdecl __iscsym( int _C); __inline int __cdecl __acrt_locale_get_ctype_array_value( unsigned short const * const _Locale_pctype_array, int const _Char_value, int const _Mask ) { if (_Char_value >= -1 && _Char_value <= 255) { return _Locale_pctype_array[_Char_value] & _Mask; } return 0; } __declspec(dllimport) int __cdecl _chvalidator( int _Ch, int _Mask); __forceinline int __cdecl __ascii_tolower(int const _C) { if (_C >= 'A' && _C <= 'Z') { return _C - ('A' - 'a'); } return _C; } __forceinline int __cdecl __ascii_toupper(int const _C) { if (_C >= 'a' && _C <= 'z') { return _C - ('a' - 'A'); } return _C; } __forceinline int __cdecl __ascii_iswalpha(int const _C) { return (_C >= 'A' && _C <= 'Z') || (_C >= 'a' && _C <= 'z'); } __forceinline int __cdecl __ascii_iswdigit(int const _C) { return _C >= '0' && _C <= '9'; } __forceinline int __cdecl __ascii_towlower(int const _C) { return __ascii_tolower(_C); } __forceinline int __cdecl __ascii_towupper(int const _C) { return __ascii_toupper(_C); } __inline __crt_locale_data_public* __cdecl __acrt_get_locale_data_prefix(void const volatile* const _LocalePointers) { _locale_t const _TypedLocalePointers = (_locale_t)_LocalePointers; return (__crt_locale_data_public*)_TypedLocalePointers->locinfo; } __declspec(dllimport) int __cdecl _chvalidator_l( _locale_t, int _Ch, int _Mask); __inline int __cdecl _chvalidchk_l( int const _C, int const _Mask, _locale_t const _Locale ) { return _chvalidator_l(_Locale, _C, _Mask); } __inline int __cdecl _ischartype_l( int const _C, int const _Mask, _locale_t const _Locale ) { if (_Locale) { if (_C >= -1 && _C <= 255) { return __acrt_get_locale_data_prefix(_Locale)->_locale_pctype[_C] & _Mask; } if (__acrt_get_locale_data_prefix(_Locale)->_locale_mb_cur_max > 1) { return _isctype_l(_C, _Mask, _Locale); } return 0; } return _chvalidchk_l(_C, _Mask, 0); } } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { using :: isalnum; using :: isalpha; using :: iscntrl; using :: isdigit; using :: isgraph; using :: islower; using :: isprint; using :: ispunct; using :: isspace; using :: isupper; using :: isxdigit; using :: tolower; using :: toupper; using :: isblank; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma warning(push) #pragma warning(disable: 4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727 ) __pragma(pack(push, 8)) extern "C" { struct lconv { char* decimal_point; char* thousands_sep; char* grouping; char* int_curr_symbol; char* currency_symbol; char* mon_decimal_point; char* mon_thousands_sep; char* mon_grouping; char* positive_sign; char* negative_sign; char int_frac_digits; char frac_digits; char p_cs_precedes; char p_sep_by_space; char n_cs_precedes; char n_sep_by_space; char p_sign_posn; char n_sign_posn; wchar_t* _W_decimal_point; wchar_t* _W_thousands_sep; wchar_t* _W_int_curr_symbol; wchar_t* _W_currency_symbol; wchar_t* _W_mon_decimal_point; wchar_t* _W_mon_thousands_sep; wchar_t* _W_positive_sign; wchar_t* _W_negative_sign; }; struct tm; __declspec(dllimport) void __cdecl _lock_locales(void); __declspec(dllimport) void __cdecl _unlock_locales(void); __declspec(dllimport) int __cdecl _configthreadlocale( int _Flag ); __declspec(dllimport) char* __cdecl setlocale( int _Category, char const* _Locale ); __declspec(dllimport) struct lconv* __cdecl localeconv(void); __declspec(dllimport) _locale_t __cdecl _get_current_locale(void); __declspec(dllimport) _locale_t __cdecl _create_locale( int _Category, char const* _Locale ); __declspec(dllimport) void __cdecl _free_locale( _locale_t _Locale ); __declspec(dllimport) wchar_t* __cdecl _wsetlocale( int _Category, wchar_t const* _Locale ); __declspec(dllimport) _locale_t __cdecl _wcreate_locale( int _Category, wchar_t const* _Locale ); __declspec(dllimport) wchar_t** __cdecl ___lc_locale_name_func(void); __declspec(dllimport) unsigned int __cdecl ___lc_codepage_func (void); __declspec(dllimport) unsigned int __cdecl ___lc_collate_cp_func (void); __declspec(dllimport) char* __cdecl _Getdays(void); __declspec(dllimport) char* __cdecl _Getmonths(void); __declspec(dllimport) void* __cdecl _Gettnames(void); __declspec(dllimport) wchar_t* __cdecl _W_Getdays(void); __declspec(dllimport) wchar_t* __cdecl _W_Getmonths(void); __declspec(dllimport) void* __cdecl _W_Gettnames(void); __declspec(dllimport) size_t __cdecl _Strftime( char* _Buffer, size_t _Max_size, char const* _Format, struct tm const* _Timeptr, void* _Lc_time_arg); __declspec(dllimport) size_t __cdecl _Wcsftime( wchar_t* _Buffer, size_t _Max_size, wchar_t const* _Format, struct tm const* _Timeptr, void* _Lc_time_arg ); } __pragma(pack(pop)) #pragma warning(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { using :: lconv; using :: localeconv; using :: setlocale; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) extern "C" { struct _Collvec { unsigned int _Page; wchar_t* _LocaleName; }; struct _Ctypevec { unsigned int _Page; const short* _Table; int _Delfl; wchar_t* _LocaleName; }; struct _Cvtvec { unsigned int _Page; unsigned int _Mbcurmax; int _Isclocale; unsigned char _Isleadbyte[32]; }; _Collvec __cdecl _Getcoll(); _Ctypevec __cdecl _Getctype(); _Cvtvec __cdecl _Getcvt(); int __cdecl _Getdateorder(); int __cdecl _Mbrtowc( wchar_t*, const char*, size_t _Max_multibyte, mbstate_t*, const _Cvtvec*); float __cdecl _Stof(const char*, char**, long); double __cdecl _Stod(const char*, char**, long); long double __cdecl _Stold(const char*, char**, long); int __cdecl _Strcoll(const char*, const char*, const char*, const char*, const _Collvec*); size_t __cdecl _Strxfrm( char* _String1, char* _End1, const char*, const char*, const _Collvec*); int __cdecl _Tolower(int, const _Ctypevec*); int __cdecl _Toupper(int, const _Ctypevec*); int __cdecl _Wcrtomb( char*, wchar_t, mbstate_t*, const _Cvtvec*); int __cdecl _Wcscoll( const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*, const _Collvec*); size_t __cdecl _Wcsxfrm( wchar_t* _String1, wchar_t* _End1, const wchar_t*, const wchar_t*, const _Collvec*); short __cdecl _Getwctype(wchar_t, const _Ctypevec*); const wchar_t* __cdecl _Getwctypes( const wchar_t*, const wchar_t*, short*, const _Ctypevec*); wchar_t __cdecl _Towlower(wchar_t, const _Ctypevec*); wchar_t __cdecl _Towupper(wchar_t, const _Ctypevec*); } extern "C" { __declspec(dllimport) char* __cdecl _Getdays(); __declspec(dllimport) char* __cdecl _Getmonths(); __declspec(dllimport) void* __cdecl _Gettnames(); __declspec(dllimport) size_t __cdecl _Strftime( char*, size_t _Maxsize, const char*, const tm*, void*); __declspec(dllimport) wchar_t* __cdecl _W_Getdays(); __declspec(dllimport) wchar_t* __cdecl _W_Getmonths(); __declspec(dllimport) void* __cdecl _W_Gettnames(); __declspec(dllimport) size_t __cdecl _Wcsftime( wchar_t*, size_t _Maxsize, const wchar_t*, const tm*, void*); } _locale_t __cdecl _GetLocaleForCP(unsigned int); #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { class __declspec(dllimport) _Timevec { public: explicit _Timevec(void* _Ptr = nullptr) : _Timeptr(_Ptr) {} _Timevec(const _Timevec& _Right) : _Timeptr(nullptr) { *this = _Right; } ~_Timevec() noexcept { :: free(_Timeptr); } _Timevec& operator=(const _Timevec& _Right) { if (this != &_Right) { :: free(_Timeptr); _Timeptr = _Right._Timeptr; const_cast<_Timevec&>(_Right)._Timeptr = nullptr; } return *this; } void* _Getptr() const { return _Timeptr; } private: void* _Timeptr; }; template <class _Elem> class __declspec(dllimport) _Yarn { public: _Yarn() noexcept : _Myptr(nullptr), _Nul(0) {} _Yarn(const _Yarn& _Right) noexcept : _Myptr(nullptr), _Nul(0) { *this = _Right; } _Yarn(const _Elem* _Right) noexcept : _Myptr(nullptr), _Nul(0) { *this = _Right; } _Yarn& operator=(const _Yarn& _Right) noexcept { return *this = _Right._Myptr; } _Yarn& operator=(const _Elem* _Right) noexcept { if (_Myptr != _Right) { _Tidy(); if (_Right) { const _Elem* _Ptr = _Right; while (*_Ptr != _Elem{}) { ++_Ptr; } const auto _Count = (++_Ptr - _Right) * sizeof(_Elem); _Myptr = static_cast<_Elem*>(_malloc_dbg(_Count, 2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xlocinfo", 86)); if (_Myptr) { :: memcpy(_Myptr, _Right, _Count); } } } return *this; } ~_Yarn() noexcept { _Tidy(); } [[nodiscard]] bool empty() const noexcept { return _Myptr == nullptr; } const _Elem* c_str() const noexcept { return _Myptr ? _Myptr : &_Nul; } [[nodiscard]] bool _Empty() const noexcept { return _Myptr == nullptr; } const _Elem* _C_str() const noexcept { return _Myptr ? _Myptr : &_Nul; } private: void _Tidy() noexcept { if (_Myptr) { _free_dbg(_Myptr, 2); } _Myptr = nullptr; } _Elem* _Myptr; _Elem _Nul; }; class __declspec(dllimport) _Locinfo { public: using _Collvec = ::_Collvec; using _Ctypevec = ::_Ctypevec; using _Cvtvec = ::_Cvtvec; using _Timevec = ::std:: _Timevec; static void __cdecl _Locinfo_ctor(_Locinfo*, const char*); static void __cdecl _Locinfo_ctor(_Locinfo*, int, const char*); static void __cdecl _Locinfo_dtor(_Locinfo*); static _Locinfo& __cdecl _Locinfo_Addcats(_Locinfo*, int, const char*); _Locinfo(const char* _Pch = "C") : _Lock(0) { if (_Pch) { _Locinfo_ctor(this, _Pch); return; } _Xruntime_error("bad locale name"); } _Locinfo(int _Cat, const char* _Pch) : _Lock(0) { if (_Pch) { _Locinfo_ctor(this, _Cat, _Pch); return; } _Xruntime_error("bad locale name"); } ~_Locinfo() noexcept { _Locinfo_dtor(this); } _Locinfo& _Addcats(int _Cat, const char* _Pch) { if (_Pch) { return _Locinfo_Addcats(this, _Cat, _Pch); } _Xruntime_error("bad locale name"); } const char* _Getname() const { return _Newlocname._C_str(); } _Collvec _Getcoll() const { return ::_Getcoll(); } _Ctypevec _Getctype() const { return ::_Getctype(); } _Cvtvec _Getcvt() const { return ::_Getcvt(); } const lconv* _Getlconv() const { return localeconv(); } _Timevec _Gettnames() const { return _Timevec(::_Gettnames()); } const char* _Getdays() const { const char* _Ptr = ::_Getdays(); if (_Ptr) { const_cast<_Locinfo*>(this)->_Days = _Ptr; :: free(const_cast<char*>(_Ptr)); } return !_Days._Empty() ? _Days._C_str() : ":Sun:Sunday:Mon:Monday:Tue:Tuesday:Wed:Wednesday" ":Thu:Thursday:Fri:Friday:Sat:Saturday"; } const char* _Getmonths() const { const char* _Ptr = ::_Getmonths(); if (_Ptr) { const_cast<_Locinfo*>(this)->_Months = _Ptr; :: free(const_cast<char*>(_Ptr)); } return !_Months._Empty() ? _Months._C_str() : ":Jan:January:Feb:February:Mar:March" ":Apr:April:May:May:Jun:June" ":Jul:July:Aug:August:Sep:September" ":Oct:October:Nov:November:Dec:December"; } const char* _Getfalse() const { return "false"; } const char* _Gettrue() const { return "true"; } int _Getdateorder() const { return ::_Getdateorder(); } _Timevec _W_Gettnames() const { return _Timevec(::_W_Gettnames()); } const unsigned short* _W_Getdays() const { const wchar_t* _Ptr = ::_W_Getdays(); if (_Ptr) { const_cast<_Locinfo*>(this)->_W_Days = _Ptr; :: free(const_cast<wchar_t*>(_Ptr)); } const wchar_t* _Ret; if (_W_Days._Empty()) { _Ret = L":Sun:Sunday:Mon:Monday:Tue:Tuesday:Wed:Wednesday:Thu:Thursday:Fri:Friday:Sat:Saturday"; } else { _Ret = _W_Days._C_str(); } return reinterpret_cast<const unsigned short*>(_Ret); } const unsigned short* _W_Getmonths() const { const wchar_t* _Ptr = ::_W_Getmonths(); if (_Ptr) { const_cast<_Locinfo*>(this)->_W_Months = _Ptr; :: free(const_cast<wchar_t*>(_Ptr)); } const wchar_t* _Ret; if (_W_Months._Empty()) { _Ret = L":Jan:January:Feb:February:Mar:March:Apr:April:May:May:Jun:June" L":Jul:July:Aug:August:Sep:September:Oct:October:Nov:November:Dec:December"; } else { _Ret = _W_Months._C_str(); } return reinterpret_cast<const unsigned short*>(_Ret); } _Locinfo(const _Locinfo&) = delete; _Locinfo& operator=(const _Locinfo&) = delete; private: _Lockit _Lock; _Yarn<char> _Days; _Yarn<char> _Months; _Yarn<wchar_t> _W_Days; _Yarn<wchar_t> _W_Months; _Yarn<char> _Oldlocname; _Yarn<char> _Newlocname; }; template <class _Elem> int __cdecl _LStrcoll(const _Elem* _First1, const _Elem* _Last1, const _Elem* _First2, const _Elem* _Last2, const _Locinfo::_Collvec*) { for (; _First1 != _Last1 && _First2 != _Last2; ++_First1, ++_First2) { if (*_First1 < *_First2) { return -1; } else if (*_First2 < *_First1) { return +1; } } return _First2 != _Last2 ? -1 : _First1 != _Last1 ? +1 : 0; } template <> inline int __cdecl _LStrcoll(const char* _First1, const char* _Last1, const char* _First2, const char* _Last2, const _Locinfo::_Collvec* _Vector) { return _Strcoll(_First1, _Last1, _First2, _Last2, _Vector); } template <> inline int __cdecl _LStrcoll(const wchar_t* _First1, const wchar_t* _Last1, const wchar_t* _First2, const wchar_t* _Last2, const _Locinfo::_Collvec* _Vector) { return _Wcscoll(_First1, _Last1, _First2, _Last2, _Vector); } template <class _Elem> size_t __cdecl _LStrxfrm(_Elem* _First1, _Elem* _Last1, const _Elem* _First2, const _Elem* _Last2, const _Locinfo::_Collvec*) { const ptrdiff_t _Count = _Last2 - _First2; if (_Count <= _Last1 - _First1) { :: memcpy(_First1, _First2, _Count * sizeof(_Elem)); } return _Count; } template <> inline size_t __cdecl _LStrxfrm( char* _First1, char* _Last1, const char* _First2, const char* _Last2, const _Locinfo::_Collvec* _Vector) { return _Strxfrm(_First1, _Last1, _First2, _Last2, _Vector); } template <> inline size_t __cdecl _LStrxfrm( wchar_t* _First1, wchar_t* _Last1, const wchar_t* _First2, const wchar_t* _Last2, const _Locinfo::_Collvec* _Vector) { return _Wcsxfrm(_First1, _Last1, _First2, _Last2, _Vector); } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { template <class _Dummy> class _Locbase { public: static const int collate = ((1 << (1)) >> 1); static const int ctype = ((1 << (2)) >> 1); static const int monetary = ((1 << (3)) >> 1); static const int numeric = ((1 << (4)) >> 1); static const int time = ((1 << (5)) >> 1); static const int messages = ((1 << (6)) >> 1); static const int all = (((1 << ((6 + 1))) >> 1) - 1); static const int none = 0; }; template <class _Dummy> const int _Locbase<_Dummy>::collate; template <class _Dummy> const int _Locbase<_Dummy>::ctype; template <class _Dummy> const int _Locbase<_Dummy>::monetary; template <class _Dummy> const int _Locbase<_Dummy>::numeric; template <class _Dummy> const int _Locbase<_Dummy>::time; template <class _Dummy> const int _Locbase<_Dummy>::messages; template <class _Dummy> const int _Locbase<_Dummy>::all; template <class _Dummy> const int _Locbase<_Dummy>::none; template <class _Elem> class collate; struct __declspec(dllimport) _Crt_new_delete { void* __cdecl operator new(size_t _Size) { void* _Ptr = operator new(_Size, nothrow); if (!_Ptr) { _Xbad_alloc(); } return _Ptr; } void* __cdecl operator new(size_t _Size, const nothrow_t&) noexcept { return _malloc_dbg(_Size > 0 ? _Size : 1, 2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xlocale", 73); } void __cdecl operator delete(void* _Ptr) noexcept { :: free(_Ptr); } void __cdecl operator delete(void* _Ptr, const nothrow_t&) noexcept { operator delete(_Ptr); } void* __cdecl operator new(size_t, void* _Ptr) noexcept { return _Ptr; } void __cdecl operator delete(void*, void*) noexcept {} }; class locale : public _Locbase<int>, public _Crt_new_delete { public: using category = int; class __declspec(dllimport) id { public: id(size_t _Val = 0) : _Id(_Val) {} id(const id&) = delete; id& operator=(const id&) = delete; operator size_t() { if (_Id == 0) { { ::std:: _Lockit _Lock(0); if (_Id == 0) { _Id = static_cast<size_t>(++_Id_cnt); } } } return _Id; } private: size_t _Id; static int _Id_cnt; }; class _Locimp; class __declspec(dllimport) facet : public _Facet_base, public _Crt_new_delete { private: friend struct _Facet_guard; public: static size_t __cdecl _Getcat(const facet** = nullptr, const locale* = nullptr) { return static_cast<size_t>(-1); } virtual void _Incref() noexcept override { _InterlockedIncrement(reinterpret_cast<volatile long*>(&_Myrefs)); } virtual _Facet_base* _Decref() noexcept override { if (_InterlockedDecrement(reinterpret_cast<volatile long*>(&_Myrefs)) == 0) { return this; } return nullptr; } private: _Atomic_counter_t _Myrefs; protected: explicit facet(size_t _Initrefs = 0) : _Myrefs(static_cast<_Atomic_counter_t>(_Initrefs)) {} virtual ~facet() noexcept override {} public: facet(const facet&) = delete; facet& operator=(const facet&) = delete; }; struct [[nodiscard]] _Facet_guard { facet* _Target; ~_Facet_guard() { if (_Target) { delete _Target->_Decref(); } } }; class __declspec(dllimport) _Locimp : public facet { protected: ~_Locimp() noexcept { _Locimp_dtor(this); } private: static _Locimp* __cdecl _New_Locimp(bool _Transparent = false); static _Locimp* __cdecl _New_Locimp(const _Locimp& _Right); static void __cdecl _Locimp_dtor(_Locimp*); static void __cdecl _Locimp_Addfac(_Locimp*, facet*, size_t); static void __cdecl _Locimp_ctor(_Locimp*, const _Locimp&); friend locale; _Locimp(bool _Transparent) : locale::facet(1), _Facetvec(nullptr), _Facetcount(0), _Catmask(none), _Xparent(_Transparent), _Name("*") { } _Locimp(const _Locimp& _Right) : locale::facet(1), _Facetvec(nullptr), _Facetcount(_Right._Facetcount), _Catmask(_Right._Catmask), _Xparent(_Right._Xparent), _Name(_Right._Name.c_str()) { _Locimp_ctor(this, _Right); } void _Addfac(facet* _Pfacet, size_t _Id) { _Locimp_Addfac(this, _Pfacet, _Id); } static _Locimp* __cdecl _Makeloc( const _Locinfo&, category, _Locimp*, const locale*); static void __cdecl _Makewloc( const _Locinfo&, category, _Locimp*, const locale*); static void __cdecl _Makeushloc( const _Locinfo&, category, _Locimp*, const locale*); static void __cdecl _Makexloc( const _Locinfo&, category, _Locimp*, const locale*); facet** _Facetvec; size_t _Facetcount; category _Catmask; bool _Xparent; _Yarn<char> _Name; static _Locimp* _Clocptr; public: _Locimp& operator=(const _Locimp&) = delete; }; template <class _Elem, class _Traits, class _Alloc> bool operator()( const basic_string<_Elem, _Traits, _Alloc>& _Left, const basic_string<_Elem, _Traits, _Alloc>& _Right) const { const auto& _Coll_fac = ::std:: use_facet<::std:: collate<_Elem>>(*this); const _Elem* const _Left_data = _Left.data(); const _Elem* const _Right_data = _Right.data(); return _Coll_fac.compare(_Left_data, _Left_data + _Left.size(), _Right_data, _Right_data + _Right.size()) < 0; } template <class _Facet> locale combine(const locale& _Loc) const { _Facet* _Facptr; try { _Facptr = const_cast<_Facet*>(::std:: addressof(::std:: use_facet<_Facet>(_Loc))); } catch (...) { _Xruntime_error("locale::combine facet missing"); } _Locimp* _Newimp = _Locimp::_New_Locimp(*_Ptr); _Newimp->_Addfac(_Facptr, _Facet::id); _Newimp->_Catmask = none; _Newimp->_Name = "*"; return locale(_Newimp); } template <class _Facet> locale(const locale& _Loc, const _Facet* _Facptr) : _Ptr(_Locimp::_New_Locimp(*_Loc._Ptr)) { if (_Facptr) { _Ptr->_Addfac(const_cast<_Facet*>(_Facptr), _Facet::id); _Ptr->_Catmask = none; _Ptr->_Name = "*"; } } locale(_Uninitialized) {} locale(const locale& _Right) noexcept : _Ptr(_Right._Ptr) { _Ptr->_Incref(); } locale() noexcept : _Ptr(_Init(true)) {} locale(const locale& _Loc, const locale& _Other, category _Cat) : _Ptr(_Locimp::_New_Locimp(*_Loc._Ptr)) { if (_Cat != none) { _Facet_guard _Guard{_Ptr}; { _Locinfo _Lobj; _Locimp::_Makeloc(_Lobj, _Cat, _Ptr, &_Other); _Lobj._Addcats(_Loc._Ptr->_Catmask, _Loc.name().c_str()); _Lobj._Addcats(_Other._Ptr->_Catmask, _Other.name().c_str()); _Ptr->_Catmask = _Loc._Ptr->_Catmask | _Other._Ptr->_Catmask; _Ptr->_Name = _Lobj._Getname(); } _Guard._Target = nullptr; } } private: void _Construct(const string& _Str, category _Cat) { bool _Bad = false; _Init(); if (_Cat != none) { _Facet_guard _Guard{_Ptr}; { _Locinfo _Lobj(_Cat, _Str.c_str()); if (_Badname(_Lobj)) { _Bad = true; } else { _Locimp::_Makeloc(_Lobj, _Cat, _Ptr, nullptr); _Ptr->_Catmask = _Cat; _Ptr->_Name = _Str.c_str(); } } _Guard._Target = nullptr; } if (_Bad) { delete _Ptr->_Decref(); _Xruntime_error("bad locale name"); } } public: explicit locale(const char* _Locname, category _Cat = all) : _Ptr(_Locimp::_New_Locimp()) { if (_Locname) { _Construct(_Locname, _Cat); return; } _Xruntime_error("bad locale name"); } locale(const locale& _Loc, const char* _Locname, category _Cat) : _Ptr(_Locimp::_New_Locimp(*_Loc._Ptr)) { if (_Locname) { _Construct(_Locname, _Cat); return; } _Xruntime_error("bad locale name"); } explicit locale(const string& _Str, category _Cat = all) : _Ptr(_Locimp::_New_Locimp()) { _Construct(_Str, _Cat); } locale(const locale& _Loc, const string& _Str, category _Cat) : _Ptr(_Locimp::_New_Locimp(*_Loc._Ptr)) { _Construct(_Str, _Cat); } ~locale() noexcept { if (_Ptr) { delete _Ptr->_Decref(); } } const locale& operator=(const locale& _Right) noexcept { if (_Ptr != _Right._Ptr) { delete _Ptr->_Decref(); _Ptr = _Right._Ptr; _Ptr->_Incref(); } return *this; } string name() const { return _Ptr ? _Ptr->_Name.c_str() : string(); } const char* c_str() const { return _Ptr ? _Ptr->_Name.c_str() : ""; } const facet* _Getfacet(size_t _Id) const { const facet* _Facptr = _Id < _Ptr->_Facetcount ? _Ptr->_Facetvec[_Id] : nullptr; if (_Facptr || !_Ptr->_Xparent) { return _Facptr; } locale::_Locimp* _Ptr0 = _Getgloballocale(); if (_Id < _Ptr0->_Facetcount) { return _Ptr0->_Facetvec[_Id]; } return nullptr; } [[nodiscard]] bool operator==(const locale& _Loc) const { return _Ptr == _Loc._Ptr || (name().compare("*") != 0 && name().compare(_Loc.name()) == 0); } static const locale& __cdecl classic(); static locale __cdecl global(const locale&); static locale __cdecl empty(); private: locale(_Locimp* _Ptrimp) : _Ptr(_Ptrimp) {} static _Locimp* __cdecl _Init(bool _Do_incref = false); static _Locimp* __cdecl _Getgloballocale(); static void __cdecl _Setgloballocale(void*); bool _Badname(const _Locinfo& _Lobj) { return :: strcmp(_Lobj._Getname(), "*") == 0; } _Locimp* _Ptr; }; template <class _Facet> struct _Facetptr { static const locale::facet* _Psave; }; template <class _Facet> const locale::facet* _Facetptr<_Facet>::_Psave = nullptr; template <class _Facet> const _Facet& __cdecl use_facet(const locale& _Loc) { { ::std:: _Lockit _Lock(0); const locale::facet* _Psave = _Facetptr<_Facet>::_Psave; const size_t _Id = _Facet::id; const locale::facet* _Pf = _Loc._Getfacet(_Id); if (!_Pf) { if (_Psave) { _Pf = _Psave; } else if (_Facet::_Getcat(&_Psave, &_Loc) == static_cast<size_t>(-1)) { _Throw_bad_cast(); } else { auto _Pfmod = const_cast<locale::facet*>(_Psave); unique_ptr<_Facet_base> _Psave_guard(static_cast<_Facet_base*>(_Pfmod)); _Facet_Register(_Pfmod); _Pfmod->_Incref(); _Facetptr<_Facet>::_Psave = _Psave; _Pf = _Psave; (void) _Psave_guard.release(); } } return static_cast<const _Facet&>(*_Pf); } } template <class _Elem> char __cdecl _Maklocbyte(_Elem _Char, const _Locinfo::_Cvtvec&) { return static_cast<char>(static_cast<unsigned char>(_Char)); } template <> inline char __cdecl _Maklocbyte(wchar_t _Char, const _Locinfo::_Cvtvec& _Cvt) { char _Byte = '\0'; mbstate_t _Mbst1 = {}; _Wcrtomb(&_Byte, _Char, &_Mbst1, &_Cvt); return _Byte; } template <> inline char __cdecl _Maklocbyte(unsigned short _Char, const _Locinfo::_Cvtvec& _Cvt) { char _Byte = '\0'; mbstate_t _Mbst1 = {}; _Wcrtomb(&_Byte, static_cast<wchar_t>(_Char), &_Mbst1, &_Cvt); return _Byte; } template <class _Elem> _Elem __cdecl _Maklocchr(char _Byte, _Elem*, const _Locinfo::_Cvtvec&) { return static_cast<_Elem>(static_cast<unsigned char>(_Byte)); } template <> inline wchar_t __cdecl _Maklocchr(char _Byte, wchar_t*, const _Locinfo::_Cvtvec& _Cvt) { wchar_t _Wc = L'\0'; mbstate_t _Mbst1 = {}; _Mbrtowc(&_Wc, &_Byte, 1, &_Mbst1, &_Cvt); return _Wc; } template <> inline unsigned short __cdecl _Maklocchr(char _Byte, unsigned short*, const _Locinfo::_Cvtvec& _Cvt) { unsigned short _Wc = 0; mbstate_t _Mbst1 = {}; _Mbrtowc(reinterpret_cast<wchar_t*>(&_Wc), &_Byte, 1, &_Mbst1, &_Cvt); return _Wc; } template <class _Elem> _Elem* __cdecl _Maklocstr(const char* _Ptr, _Elem*, const _Locinfo::_Cvtvec&) { size_t _Count = :: strlen(_Ptr) + 1; _Elem* _Ptrdest = static_cast<_Elem*>(_calloc_dbg(_Count, sizeof(_Elem), 2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xlocale", 526)); if (!_Ptrdest) { _Xbad_alloc(); } for (_Elem* _Ptrnext = _Ptrdest; 0 < _Count; --_Count, ++_Ptrnext, ++_Ptr) { *_Ptrnext = static_cast<_Elem>(static_cast<unsigned char>(*_Ptr)); } return _Ptrdest; } template <> inline wchar_t* __cdecl _Maklocstr(const char* _Ptr, wchar_t*, const _Locinfo::_Cvtvec& _Cvt) { size_t _Count; size_t _Count1; size_t _Wchars; const char* _Ptr1; int _Bytes; wchar_t _Wc; mbstate_t _Mbst1 = {}; _Count1 = :: strlen(_Ptr) + 1; for (_Count = _Count1, _Wchars = 0, _Ptr1 = _Ptr; 0 < _Count; _Count -= _Bytes, _Ptr1 += _Bytes, ++_Wchars) { if ((_Bytes = _Mbrtowc(&_Wc, _Ptr1, _Count, &_Mbst1, &_Cvt)) <= 0) { break; } } ++_Wchars; wchar_t* _Ptrdest = static_cast<wchar_t*>(_calloc_dbg(_Wchars, sizeof(wchar_t), 2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xlocale", 559)); if (!_Ptrdest) { _Xbad_alloc(); } wchar_t* _Ptrnext = _Ptrdest; mbstate_t _Mbst2 = {}; for (; 0 < _Wchars; _Count -= _Bytes, _Ptr += _Bytes, --_Wchars, ++_Ptrnext) { if ((_Bytes = _Mbrtowc(_Ptrnext, _Ptr, _Count1, &_Mbst2, &_Cvt)) <= 0) { break; } } *_Ptrnext = L'\0'; return _Ptrdest; } template <> inline unsigned short* __cdecl _Maklocstr(const char* _Ptr, unsigned short*, const _Locinfo::_Cvtvec& _Cvt) { size_t _Count; size_t _Count1; size_t _Wchars; const char* _Ptr1; int _Bytes; unsigned short _Wc; mbstate_t _Mbst1 = {}; _Count1 = :: strlen(_Ptr) + 1; for (_Count = _Count1, _Wchars = 0, _Ptr1 = _Ptr; 0 < _Count; _Count -= _Bytes, _Ptr1 += _Bytes, ++_Wchars) { if ((_Bytes = _Mbrtowc(reinterpret_cast<wchar_t*>(&_Wc), _Ptr1, _Count, &_Mbst1, &_Cvt)) <= 0) { break; } } ++_Wchars; wchar_t* _Ptrdest = static_cast<wchar_t*>(_calloc_dbg(_Wchars, sizeof(wchar_t), 2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xlocale", 600)); if (!_Ptrdest) { _Xbad_alloc(); } wchar_t* _Ptrnext = _Ptrdest; mbstate_t _Mbst2 = {}; for (; 0 < _Wchars; _Count -= _Bytes, _Ptr += _Bytes, --_Wchars, ++_Ptrnext) { if ((_Bytes = _Mbrtowc(_Ptrnext, _Ptr, _Count1, &_Mbst2, &_Cvt)) <= 0) { break; } } *_Ptrnext = L'\0'; return reinterpret_cast<unsigned short*>(_Ptrdest); } class __declspec(dllimport) codecvt_base : public locale::facet { public: enum { ok, partial, error, noconv }; using result = int; codecvt_base(size_t _Refs = 0) : locale::facet(_Refs) {} bool always_noconv() const noexcept { return do_always_noconv(); } int max_length() const noexcept { return do_max_length(); } int encoding() const noexcept { return do_encoding(); } ~codecvt_base() noexcept {} protected: virtual bool do_always_noconv() const noexcept { return false; } virtual int do_max_length() const noexcept { return 1; } virtual int do_encoding() const noexcept { return 1; } }; template <class _Elem, class _Byte, class _Statype> class codecvt : public codecvt_base { public: static_assert(!0 || is_same_v<codecvt, codecvt<char, char, mbstate_t>>, "Unsupported facet specialization; see N4800 27.3.1.1.1 [locale.category]. " "Either use a Standard specialization or define _ENFORCE_FACET_SPECIALIZATIONS=0 " "to suppress this diagnostic."); using intern_type = _Elem; using extern_type = _Byte; using state_type = _Statype; result in(_Statype& _State, const _Byte* _First1, const _Byte* _Last1, const _Byte*& _Mid1, _Elem* _First2, _Elem* _Last2, _Elem*& _Mid2) const { return do_in(_State, _First1, _Last1, _Mid1, _First2, _Last2, _Mid2); } result out(_Statype& _State, const _Elem* _First1, const _Elem* _Last1, const _Elem*& _Mid1, _Byte* _First2, _Byte* _Last2, _Byte*& _Mid2) const { return do_out(_State, _First1, _Last1, _Mid1, _First2, _Last2, _Mid2); } result unshift(_Statype& _State, _Byte* _First2, _Byte* _Last2, _Byte*& _Mid2) const { return do_unshift(_State, _First2, _Last2, _Mid2); } int length(_Statype& _State, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const { return do_length(_State, _First1, _Last1, _Count); } static locale::id id; explicit codecvt(size_t _Refs = 0) : codecvt_base(_Refs) { _Init(_Locinfo()); } explicit codecvt(const _Locinfo& _Lobj, size_t _Refs = 0) : codecvt_base(_Refs) { _Init(_Lobj); } static size_t __cdecl _Getcat(const locale::facet** _Ppf = nullptr, const locale* _Ploc = nullptr) { if (_Ppf && !*_Ppf) { *_Ppf = new codecvt(_Locinfo(_Ploc->c_str())); } return 2; } protected: virtual ~codecvt() noexcept {} void _Init(const _Locinfo&) {} virtual bool do_always_noconv() const noexcept override { return is_same_v<_Byte, _Elem>; } virtual result do_in(_Statype&, const _Byte* _First1, const _Byte* _Last1, const _Byte*& _Mid1, _Elem* _First2, _Elem* _Last2, _Elem*& _Mid2) const { _Mid1 = _First1; _Mid2 = _First2; if constexpr (is_same_v<_Byte, _Elem>) { return noconv; } else { for (; _Mid1 != _Last1; ++_Mid1, ++_Mid2) { if (_Mid2 == _Last2) { return partial; } *_Mid2 = static_cast<_Elem>(*_Mid1); } return ok; } } virtual result do_out(_Statype&, const _Elem* _First1, const _Elem* _Last1, const _Elem*& _Mid1, _Byte* _First2, _Byte* _Last2, _Byte*& _Mid2) const { _Mid1 = _First1; _Mid2 = _First2; if constexpr (is_same_v<_Byte, _Elem>) { return noconv; } else { for (; _Mid1 != _Last1; ++_Mid1, ++_Mid2) { if (_Mid2 == _Last2) { return partial; } *_Mid2 = static_cast<_Byte>(*_Mid1); } return ok; } } virtual result do_unshift(_Statype&, _Byte* _First2, _Byte*, _Byte*& _Mid2) const { _Mid2 = _First2; return noconv; } virtual int do_length( _Statype&, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const { const auto _Dist = static_cast<size_t>((::std:: min)(_Last1 - _First1, ptrdiff_t{2147483647})); return static_cast<int>((::std:: min)(_Count, _Dist)); } }; template <class _Elem, class _Byte, class _Statype> locale::id codecvt<_Elem, _Byte, _Statype>::id; template <class _CvtTy, class _Byte, class _Statype> [[nodiscard]] int _Codecvt_do_length( const _CvtTy& _Cvt, _Statype& _State, const _Byte* _First1, const _Byte* _Last1, size_t _Count) { __pragma(warning(push)) __pragma(warning(disable : 4996)) using _Elem = typename _CvtTy::intern_type; __pragma(warning(pop)) _Adl_verify_range(_First1, _Last1); const auto _Old_first1 = _First1; while (_Count > 0 && _First1 != _Last1) { const _Byte* _Mid1; _Elem* _Mid2; _Elem _Ch; __pragma(warning(push)) __pragma(warning(disable : 4996)) const auto _Result = _Cvt._CvtTy::do_in(_State, _First1, _Last1, _Mid1, &_Ch, &_Ch + 1, _Mid2); __pragma(warning(pop)) if (_Result != codecvt_base::ok) { if (_Result == codecvt_base::noconv) { _First1 += (::std:: min)(static_cast<size_t>(_Last1 - _First1), _Count); } break; } if (_Mid2 == &_Ch + 1) { --_Count; } _First1 = _Mid1; } return static_cast<int>((::std:: min)(_First1 - _Old_first1, ptrdiff_t{2147483647})); } enum _Codecvt_mode { _Consume_header = 4, _Generate_header = 2 }; template <> class __declspec(dllimport) [[deprecated("warning STL4020: " "std::codecvt<char16_t, char, mbstate_t>, std::codecvt<char32_t, char, mbstate_t>, " "std::codecvt_byname<char16_t, char, mbstate_t>, and std::codecvt_byname<char32_t, char, mbstate_t> " "are deprecated in C++20 and replaced by specializations with a second argument of type char8_t. " "You can define _SILENCE_CXX20_CODECVT_FACETS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] codecvt<char16_t, char, mbstate_t> : public codecvt_base { public: using intern_type = char16_t; using extern_type = char; using state_type = mbstate_t; result in(mbstate_t& _State, const char* _First1, const char* _Last1, const char*& _Mid1, char16_t* _First2, char16_t* _Last2, char16_t*& _Mid2) const { return do_in(_State, _First1, _Last1, _Mid1, _First2, _Last2, _Mid2); } result out(mbstate_t& _State, const char16_t* _First1, const char16_t* _Last1, const char16_t*& _Mid1, char* _First2, char* _Last2, char*& _Mid2) const { return do_out(_State, _First1, _Last1, _Mid1, _First2, _Last2, _Mid2); } result unshift(mbstate_t& _State, char* _First2, char* _Last2, char*& _Mid2) const { return do_unshift(_State, _First2, _Last2, _Mid2); } int length(mbstate_t& _State, const char* _First1, const char* _Last1, size_t _Count) const { return do_length(_State, _First1, _Last1, _Count); } static locale::id id; explicit codecvt(size_t _Refs = 0) : codecvt_base(_Refs), _Maxcode(0x10ffff), _Mode(_Consume_header) { { _Locinfo _Lobj; _Init(_Lobj); } } explicit codecvt(const _Locinfo& _Lobj, size_t _Refs = 0) : codecvt_base(_Refs), _Maxcode(0x10ffff), _Mode(_Consume_header) { _Init(_Lobj); } codecvt( const _Locinfo& _Lobj, unsigned long _Maxcode_arg, _Codecvt_mode _Mode_arg, size_t _Refs = 0) : codecvt_base(_Refs), _Maxcode(_Maxcode_arg), _Mode(_Mode_arg) { _Init(_Lobj); } static size_t __cdecl _Getcat(const locale::facet** _Ppf = nullptr, const locale* _Ploc = nullptr) { if (_Ppf && !*_Ppf) { __pragma(warning(push)) __pragma(warning(disable : 4996)) *_Ppf = new codecvt(_Locinfo(_Ploc->c_str())); __pragma(warning(pop)) } return 2; } protected: virtual ~codecvt() noexcept {} void _Init(const _Locinfo&) {} virtual result do_in(mbstate_t& _State, const char* _First1, const char* _Last1, const char*& _Mid1, char16_t* _First2, char16_t* _Last2, char16_t*& _Mid2) const { unsigned short* _Pstate = reinterpret_cast<unsigned short*>(&_State); _Mid1 = _First1; _Mid2 = _First2; while (_Mid1 != _Last1 && _Mid2 != _Last2) { unsigned char _By = static_cast<unsigned char>(*_Mid1); unsigned long _Ch; int _Nextra; int _Nskip; if (*_Pstate > 1) { if (_By < 0x80 || 0xc0 <= _By) { return codecvt::error; } ++_Mid1; *_Mid2++ = static_cast<char16_t>(*_Pstate | (_By & 0x3f)); *_Pstate = 1; continue; } if (_By < 0x80u) { _Ch = _By; _Nextra = 0; } else if (_By < 0xc0u) { ++_Mid1; return codecvt::error; } else if (_By < 0xe0u) { _Ch = static_cast<unsigned long>(_By & 0x1f); _Nextra = 1; } else if (_By < 0xf0u) { _Ch = static_cast<unsigned long>(_By & 0x0f); _Nextra = 2; } else if (_By < 0xf8u) { _Ch = static_cast<unsigned long>(_By & 0x07); _Nextra = 3; } else { _Ch = static_cast<unsigned long>(_By & 0x03); _Nextra = _By < 0xfc ? 4 : 5; } _Nskip = _Nextra < 3 ? 0 : 1; _First1 = _Mid1; if (_Nextra == 0) { ++_Mid1; } else if (_Last1 - _Mid1 < _Nextra + 1 - _Nskip) { break; } else { for (++_Mid1; _Nskip < _Nextra; --_Nextra, ++_Mid1) { if ((_By = static_cast<unsigned char>(*_Mid1)) < 0x80u || 0xc0u <= _By) { return codecvt::error; } else { _Ch = _Ch << 6 | (_By & 0x3f); } } } if (0 < _Nskip) { _Ch <<= 6; } if ((_Maxcode < 0x10ffffu ? _Maxcode : 0x10ffffu) < _Ch) { return codecvt::error; } if (0xffffu < _Ch) { unsigned short _Ch0 = static_cast<unsigned short>(0xd800 | (_Ch >> 10) - 0x0040); *_Mid2++ = static_cast<char16_t>(_Ch0); *_Pstate = static_cast<unsigned short>(0xdc00 | (_Ch & 0x03ff)); continue; } if (_Nskip != 0) { if (_Mid1 == _Last1) { _Mid1 = _First1; break; } if ((_By = static_cast<unsigned char>(*_Mid1++)) < 0x80u || 0xc0u <= _By) { return codecvt::error; } _Ch |= _By & 0x3f; } if (*_Pstate == 0u) { *_Pstate = 1; if ((_Mode & _Consume_header) != 0 && _Ch == 0xfeffu) { const result _Ans = do_in(_State, _Mid1, _Last1, _Mid1, _First2, _Last2, _Mid2); if (_Ans == codecvt::partial) { *_Pstate = 0; _Mid1 = _First1; } return _Ans; } } *_Mid2++ = static_cast<char16_t>(_Ch); } return _First1 == _Mid1 ? codecvt::partial : codecvt::ok; } virtual result do_out(mbstate_t& _State, const char16_t* _First1, const char16_t* _Last1, const char16_t*& _Mid1, char* _First2, char* _Last2, char*& _Mid2) const { unsigned short* _Pstate = reinterpret_cast<unsigned short*>(&_State); _Mid1 = _First1; _Mid2 = _First2; while (_Mid1 != _Last1 && _Mid2 != _Last2) { unsigned long _Ch; const unsigned short _Ch1 = static_cast<unsigned short>(*_Mid1); bool _Save = false; if (1 < *_Pstate) { if (_Ch1 < 0xdc00u || 0xe000u <= _Ch1) { return codecvt::error; } _Ch = static_cast<unsigned long>((*_Pstate << 10) | (_Ch1 - 0xdc00)); } else if (0xd800u <= _Ch1 && _Ch1 < 0xdc00u) { _Ch = static_cast<unsigned long>((_Ch1 - 0xd800 + 0x0040) << 10); _Save = true; } else { _Ch = _Ch1; } char _By; int _Nextra; if (_Ch < 0x0080u) { _By = static_cast<char>(_Ch); _Nextra = 0; } else if (_Ch < 0x0800u) { _By = static_cast<char>(0xc0 | _Ch >> 6); _Nextra = 1; } else if (_Ch < 0x10000u) { _By = static_cast<char>(0xe0 | _Ch >> 12); _Nextra = 2; } else { _By = static_cast<char>(0xf0 | _Ch >> 18); _Nextra = 3; } int _Nput = _Nextra < 3 ? _Nextra + 1 : _Save ? 1 : 3; if (_Last2 - _Mid2 < _Nput) { break; } if (*_Pstate == 0u && (_Mode & _Generate_header) != 0) { if (_Last2 - _Mid2 < 3 + _Nput) { break; } *_Mid2++ = '\xef'; *_Mid2++ = '\xbb'; *_Mid2++ = '\xbf'; } ++_Mid1; if (_Save || _Nextra < 3) { *_Mid2++ = _By; --_Nput; } for (; 0 < _Nput; --_Nput) { *_Mid2++ = static_cast<char>((_Ch >> 6 * --_Nextra & 0x3f) | 0x80); } *_Pstate = static_cast<unsigned short>(_Save ? _Ch >> 10 : 1); } return _First1 == _Mid1 ? codecvt::partial : codecvt::ok; } virtual result do_unshift(mbstate_t& _State, char* _First2, char*, char*& _Mid2) const { unsigned short* _Pstate = reinterpret_cast<unsigned short*>(&_State); _Mid2 = _First2; return 1u < *_Pstate ? codecvt::error : codecvt::ok; } friend int _Codecvt_do_length<>(const codecvt&, mbstate_t&, const char*, const char*, size_t); virtual int do_length( mbstate_t& _State, const char* _First1, const char* _Last1, size_t _Count) const { return _Codecvt_do_length(*this, _State, _First1, _Last1, _Count); } virtual bool do_always_noconv() const noexcept override { return false; } virtual int do_max_length() const noexcept override { if ((_Mode & _Consume_header) != 0) { return 9; } if ((_Mode & _Generate_header) != 0) { return 7; } return 6; } virtual int do_encoding() const noexcept override { return 0; } private: unsigned long _Maxcode; _Codecvt_mode _Mode; }; template <> class __declspec(dllimport) [[deprecated("warning STL4020: " "std::codecvt<char16_t, char, mbstate_t>, std::codecvt<char32_t, char, mbstate_t>, " "std::codecvt_byname<char16_t, char, mbstate_t>, and std::codecvt_byname<char32_t, char, mbstate_t> " "are deprecated in C++20 and replaced by specializations with a second argument of type char8_t. " "You can define _SILENCE_CXX20_CODECVT_FACETS_DEPRECATION_WARNING " "or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]] codecvt<char32_t, char, mbstate_t> : public codecvt_base { public: using intern_type = char32_t; using extern_type = char; using state_type = mbstate_t; result in(mbstate_t& _State, const char* _First1, const char* _Last1, const char*& _Mid1, char32_t* _First2, char32_t* _Last2, char32_t*& _Mid2) const { return do_in(_State, _First1, _Last1, _Mid1, _First2, _Last2, _Mid2); } result out(mbstate_t& _State, const char32_t* _First1, const char32_t* _Last1, const char32_t*& _Mid1, char* _First2, char* _Last2, char*& _Mid2) const { return do_out(_State, _First1, _Last1, _Mid1, _First2, _Last2, _Mid2); } result unshift(mbstate_t& _State, char* _First2, char* _Last2, char*& _Mid2) const { return do_unshift(_State, _First2, _Last2, _Mid2); } int length(mbstate_t& _State, const char* _First1, const char* _Last1, size_t _Count) const { return do_length(_State, _First1, _Last1, _Count); } static locale::id id; explicit codecvt(size_t _Refs = 0) : codecvt_base(_Refs), _Maxcode(0xffffffff), _Mode(_Consume_header) { { _Locinfo _Lobj; _Init(_Lobj); } } explicit codecvt(const _Locinfo& _Lobj, size_t _Refs = 0) : codecvt_base(_Refs), _Maxcode(0xffffffff), _Mode(_Consume_header) { _Init(_Lobj); } codecvt( const _Locinfo& _Lobj, unsigned long _Maxcode_arg, _Codecvt_mode _Mode_arg, size_t _Refs = 0) : codecvt_base(_Refs), _Maxcode(_Maxcode_arg), _Mode(_Mode_arg) { _Init(_Lobj); } static size_t __cdecl _Getcat(const locale::facet** _Ppf = nullptr, const locale* _Ploc = nullptr) { if (_Ppf && !*_Ppf) { __pragma(warning(push)) __pragma(warning(disable : 4996)) *_Ppf = new codecvt(_Locinfo(_Ploc->c_str())); __pragma(warning(pop)) } return 2; } protected: virtual ~codecvt() noexcept {} void _Init(const _Locinfo&) {} virtual result do_in(mbstate_t& _State, const char* _First1, const char* _Last1, const char*& _Mid1, char32_t* _First2, char32_t* _Last2, char32_t*& _Mid2) const { char* _Pstate = reinterpret_cast<char*>(&_State); _Mid1 = _First1; _Mid2 = _First2; while (_Mid1 != _Last1 && _Mid2 != _Last2) { unsigned char _By = static_cast<unsigned char>(*_Mid1); unsigned long _Ch; int _Nextra; if (_By < 0x80u) { _Ch = _By; _Nextra = 0; } else if (_By < 0xc0u) { ++_Mid1; return codecvt::error; } else if (_By < 0xe0u) { _Ch = static_cast<unsigned long>(_By & 0x1f); _Nextra = 1; } else if (_By < 0xf0u) { _Ch = static_cast<unsigned long>(_By & 0x0f); _Nextra = 2; } else if (_By < 0xf8u) { _Ch = static_cast<unsigned long>(_By & 0x07); _Nextra = 3; } else { _Ch = static_cast<unsigned long>(_By & 0x03); _Nextra = _By < 0xfc ? 4 : 5; } if (_Nextra == 0) { ++_Mid1; } else if (_Last1 - _Mid1 < _Nextra + 1) { break; } else { for (++_Mid1; 0 < _Nextra; --_Nextra, ++_Mid1) { if ((_By = static_cast<unsigned char>(*_Mid1)) < 0x80u || 0xc0u <= _By) { return codecvt::error; } else { _Ch = _Ch << 6 | (_By & 0x3f); } } } if (*_Pstate == 0) { *_Pstate = 1; if ((_Mode & _Consume_header) != 0 && _Ch == 0xfeffu) { const result _Ans = do_in(_State, _Mid1, _Last1, _Mid1, _First2, _Last2, _Mid2); if (_Ans == codecvt::partial) { *_Pstate = 0; _Mid1 = _First1; } return _Ans; } } if (_Maxcode < _Ch) { return codecvt::error; } *_Mid2++ = static_cast<char32_t>(_Ch); } return _First1 == _Mid1 ? codecvt::partial : codecvt::ok; } virtual result do_out(mbstate_t& _State, const char32_t* _First1, const char32_t* _Last1, const char32_t*& _Mid1, char* _First2, char* _Last2, char*& _Mid2) const { char* _Pstate = reinterpret_cast<char*>(&_State); _Mid1 = _First1; _Mid2 = _First2; while (_Mid1 != _Last1 && _Mid2 != _Last2) { char _By; int _Nextra; unsigned long _Ch = static_cast<unsigned long>(*_Mid1); if (_Maxcode < _Ch) { return codecvt::error; } if (_Ch < 0x0080u) { _By = static_cast<char>(_Ch); _Nextra = 0; } else if (_Ch < 0x0800u) { _By = static_cast<char>(0xc0 | _Ch >> 6); _Nextra = 1; } else if (_Ch < 0x00010000u) { _By = static_cast<char>(0xe0 | _Ch >> 12); _Nextra = 2; } else if (_Ch < 0x00200000u) { _By = static_cast<char>(0xf0 | _Ch >> 18); _Nextra = 3; } else if (_Ch < 0x04000000u) { _By = static_cast<char>(0xf8 | _Ch >> 24); _Nextra = 4; } else { _By = static_cast<char>(0xfc | (_Ch >> 30 & 0x03)); _Nextra = 5; } if (*_Pstate == 0) { *_Pstate = 1; if ((_Mode & _Generate_header) != 0) { if (_Last2 - _Mid2 < 3 + 1 + _Nextra) { return codecvt::partial; } *_Mid2++ = '\xef'; *_Mid2++ = '\xbb'; *_Mid2++ = '\xbf'; } } if (_Last2 - _Mid2 < 1 + _Nextra) { break; } ++_Mid1; for (*_Mid2++ = _By; 0 < _Nextra;) { *_Mid2++ = static_cast<char>((_Ch >> 6 * --_Nextra & 0x3f) | 0x80); } } return _First1 == _Mid1 ? codecvt::partial : codecvt::ok; } virtual result do_unshift(mbstate_t&, char* _First2, char*, char*& _Mid2) const { _Mid2 = _First2; return codecvt::noconv; } friend int _Codecvt_do_length<>(const codecvt&, mbstate_t&, const char*, const char*, size_t); virtual int do_length( mbstate_t& _State, const char* _First1, const char* _Last1, size_t _Count) const { return _Codecvt_do_length(*this, _State, _First1, _Last1, _Count); } virtual bool do_always_noconv() const noexcept override { return false; } virtual int do_max_length() const noexcept override { return (_Mode & (_Consume_header | _Generate_header)) != 0 ? 9 : 6; } virtual int do_encoding() const noexcept override { return (_Mode & (_Consume_header | _Generate_header)) != 0 ? -1 : 0; } private: unsigned long _Maxcode; _Codecvt_mode _Mode; }; template <class _From, class _To> struct [[nodiscard]] _Codecvt_guard { const _From* const& _First1; const _From*& _Mid1; _To* const& _First2; _To*& _Mid2; _Codecvt_guard(const _From* const& _First1_, const _From*& _Mid1_, _To* const& _First2_, _To*& _Mid2_) : _First1{_First1_}, _Mid1{_Mid1_}, _First2{_First2_}, _Mid2{_Mid2_} {} _Codecvt_guard(const _Codecvt_guard&) = delete; _Codecvt_guard& operator=(const _Codecvt_guard&) = delete; ~_Codecvt_guard() { _Mid1 = _First1; _Mid2 = _First2; } }; template <> class codecvt<char16_t, char8_t, mbstate_t> : public codecvt_base { public: using intern_type = char16_t; using extern_type = char8_t; using state_type = mbstate_t; result in(mbstate_t& _State, const char8_t* _First1, const char8_t* _Last1, const char8_t*& _Mid1, char16_t* _First2, char16_t* _Last2, char16_t*& _Mid2) const { return do_in(_State, _First1, _Last1, _Mid1, _First2, _Last2, _Mid2); } result out(mbstate_t& _State, const char16_t* _First1, const char16_t* _Last1, const char16_t*& _Mid1, char8_t* _First2, char8_t* _Last2, char8_t*& _Mid2) const { return do_out(_State, _First1, _Last1, _Mid1, _First2, _Last2, _Mid2); } result unshift(mbstate_t& _State, char8_t* _First2, char8_t* _Last2, char8_t*& _Mid2) const { return do_unshift(_State, _First2, _Last2, _Mid2); } int length(mbstate_t& _State, const char8_t* _First1, const char8_t* _Last1, size_t _Count) const { return do_length(_State, _First1, _Last1, _Count); } __declspec(dllimport) static locale::id id; explicit codecvt(size_t _Refs = 0) : codecvt_base(_Refs) {} explicit codecvt(const _Locinfo&, size_t _Refs = 0) : codecvt_base(_Refs) {} static size_t _Getcat(const locale::facet** _Ppf = nullptr, const locale* = nullptr) { if (_Ppf && !*_Ppf) { *_Ppf = new codecvt; } return 2; } protected: virtual ~codecvt() noexcept override = default; virtual result do_in(mbstate_t&, const char8_t* _First1, const char8_t* _Last1, const char8_t*& _Mid1, char16_t* _First2, char16_t* _Last2, char16_t*& _Mid2) const { _Adl_verify_range(_First1, _Last1); _Adl_verify_range(_First2, _Last2); _Codecvt_guard<char8_t, char16_t> _Guard{_First1, _Mid1, _First2, _Mid2}; for (; _First1 != _Last1; ++_First1, ++_First2) { if (_First2 == _Last2) { return partial; } char8_t _Lead_byte = *_First1; if (_Lead_byte < 0b1000'0000u) { *_First2 = static_cast<char16_t>(_Lead_byte); continue; } int _Trailing_count = 1; if (_Lead_byte < 0b1110'0000u) { if (_Lead_byte < 0b1100'0000u) { return error; } _Lead_byte &= 0b0001'1111u; } else if (_Lead_byte < 0b1111'0000u) { _Lead_byte &= 0b0000'1111u; _Trailing_count = 2; } else if (_Lead_byte < 0b1111'1000u) { if (_Last2 - _First2 < 2) { return partial; } _Lead_byte &= 0b0000'0111u; _Trailing_count = 3; } else { return error; } if (_Last1 - _First1 < _Trailing_count + 1) { return partial; } const char8_t* _Peek = _First1; char32_t _Code_point = _Lead_byte; do { const char8_t _By = *++_Peek; if ((_By & 0b1100'0000u) != 0b1000'0000u) { return error; } _Code_point = (_Code_point << 6) | (_By & 0b11'1111u); } while (--_Trailing_count != 0); if (_Code_point < 0x10000u) { if (_Code_point >= 0xd800u && _Code_point < 0xe000u) { return error; } *_First2 = static_cast<char16_t>(_Code_point); } else if (_Code_point >= 0x110000u) { return error; } else { _Code_point -= 0x10000u; *_First2 = static_cast<char16_t>(0xd800u | (_Code_point >> 10)); *++_First2 = static_cast<char16_t>(0xdc00u | (_Code_point & 0b11'1111'1111u)); } _First1 = _Peek; } return ok; } virtual result do_out(mbstate_t&, const char16_t* _First1, const char16_t* _Last1, const char16_t*& _Mid1, char8_t* _First2, char8_t* _Last2, char8_t*& _Mid2) const { _Adl_verify_range(_First1, _Last1); _Adl_verify_range(_First2, _Last2); _Codecvt_guard<char16_t, char8_t> _Guard{_First1, _Mid1, _First2, _Mid2}; for (; _First1 != _Last1; ++_First1, ++_First2) { if (_First2 == _Last2) { return partial; } char32_t _Code_point = *_First1; if (_Code_point < 0x80u) { *_First2 = static_cast<char8_t>(_Code_point); continue; } int _Trailing_count = 1; if (_Code_point < 0x800u) { *_First2 = static_cast<char8_t>(0b1100'0000u | (_Code_point >> 6)); } else if (_Code_point < 0xd800u || _Code_point >= 0xe000u) { *_First2 = static_cast<char8_t>(0b1110'0000u | (_Code_point >> 12)); _Trailing_count = 2; } else if (_Code_point < 0xdc00u) { if (_Last1 - _First1 < 2) { return partial; } const char16_t _Low_surrogate = *++_First1; if (_Low_surrogate < 0xdc00u || _Low_surrogate >= 0xe000u) { --_First1; return error; } _Code_point = 0x10000u + (((_Code_point & 0b11'1111'1111u) << 10) | (_Low_surrogate & 0b11'1111'1111u)); *_First2 = static_cast<char8_t>(0b1111'0000u | (_Code_point >> 18)); _Trailing_count = 3; } else { return error; } if (_Last2 - _First2 < _Trailing_count + 1) { if (_Trailing_count > 2) { --_First1; } return partial; } do { --_Trailing_count; *++_First2 = static_cast<char8_t>(0b1000'0000u | ((_Code_point >> (6 * _Trailing_count)) & 0b11'1111u)); } while (_Trailing_count != 0); } return ok; } virtual result do_unshift(mbstate_t&, char8_t* _First2, char8_t*, char8_t*& _Mid2) const { _Mid2 = _First2; return noconv; } virtual int do_length( mbstate_t&, const char8_t* _First1, const char8_t* _Last1, size_t _Count) const { _Adl_verify_range(_First1, _Last1); const auto _Old_first1 = _First1; for (; _First1 != _Last1 && _Count > 0u; ++_First1, --_Count) { char32_t _Code_point = *_First1; if (_Code_point < 0b1000'0000u) { continue; } int _Trailing_count = 1; if (_Code_point < 0b1110'0000u) { if (_Code_point < 0b1100'0000u) { break; } _Code_point &= 0b0001'1111u; } else if (_Code_point < 0b1111'0000u) { _Code_point &= 0b0000'1111u; _Trailing_count = 2; } else if (_Code_point < 0b1111'1000u) { if (_Count < 2u) { break; } _Code_point &= 0b0000'0111u; _Trailing_count = 3; } else { break; } if (_Last1 - _First1 < _Trailing_count + 1) { break; } const char8_t* _Peek = _First1; bool _Done = false; do { const char8_t _By = *++_Peek; if ((_By & 0b1100'0000u) != 0b1000'0000u) { _Done = true; break; } _Code_point = (_Code_point << 6) | (_By & 0b11'1111u); } while (--_Trailing_count != 0); if (_Done) { break; } if (_Code_point < 0x10000u) { if (_Code_point >= 0xd800u && _Code_point < 0xe0000u) { break; } } else if (_Code_point < 0x110000u) { --_Count; } else { break; } _First1 = _Peek; } return static_cast<int>((::std:: min)(_First1 - _Old_first1, ptrdiff_t{2147483647})); } virtual bool do_always_noconv() const noexcept override { return false; } virtual int do_max_length() const noexcept override { return 4; } virtual int do_encoding() const noexcept override { return 0; } }; template <> class codecvt<char32_t, char8_t, mbstate_t> : public codecvt_base { public: using intern_type = char32_t; using extern_type = char8_t; using state_type = mbstate_t; result in(mbstate_t& _State, const char8_t* _First1, const char8_t* _Last1, const char8_t*& _Mid1, char32_t* _First2, char32_t* _Last2, char32_t*& _Mid2) const { return do_in(_State, _First1, _Last1, _Mid1, _First2, _Last2, _Mid2); } result out(mbstate_t& _State, const char32_t* _First1, const char32_t* _Last1, const char32_t*& _Mid1, char8_t* _First2, char8_t* _Last2, char8_t*& _Mid2) const { return do_out(_State, _First1, _Last1, _Mid1, _First2, _Last2, _Mid2); } result unshift(mbstate_t& _State, char8_t* _First2, char8_t* _Last2, char8_t*& _Mid2) const { return do_unshift(_State, _First2, _Last2, _Mid2); } int length(mbstate_t& _State, const char8_t* _First1, const char8_t* _Last1, size_t _Count) const { return do_length(_State, _First1, _Last1, _Count); } __declspec(dllimport) static locale::id id; explicit codecvt(size_t _Refs = 0) : codecvt_base(_Refs) {} explicit codecvt(const _Locinfo&, size_t _Refs = 0) : codecvt_base(_Refs) {} static size_t __cdecl _Getcat(const locale::facet** _Ppf = nullptr, const locale* = nullptr) { if (_Ppf && !*_Ppf) { *_Ppf = new codecvt; } return 2; } protected: virtual ~codecvt() noexcept override = default; virtual result do_in(mbstate_t&, const char8_t* _First1, const char8_t* _Last1, const char8_t*& _Mid1, char32_t* _First2, char32_t* _Last2, char32_t*& _Mid2) const { _Adl_verify_range(_First1, _Last1); _Adl_verify_range(_First2, _Last2); _Codecvt_guard<char8_t, char32_t> _Guard{_First1, _Mid1, _First2, _Mid2}; for (; _First1 != _Last1; ++_First1, ++_First2) { if (_First2 == _Last2) { return partial; } char8_t _Lead_byte = *_First1; if (_Lead_byte < 0b1000'0000u) { *_First2 = _Lead_byte; continue; } int _Trailing_count = 1; if (_Lead_byte < 0b1110'0000u) { if (_Lead_byte < 0b1100'0000u) { return partial; } _Lead_byte &= 0b0001'1111u; } else if (_Lead_byte < 0b1111'0000u) { _Lead_byte &= 0b0000'1111u; _Trailing_count = 2; } else if (_Lead_byte < 0b1111'1000u) { _Lead_byte &= 0b0000'0111u; _Trailing_count = 3; } else { return error; } if (_Last1 - _First1 < _Trailing_count + 1) { return partial; } const char8_t* _Peek = _First1; char32_t _Code_point = _Lead_byte; do { const char8_t _By = *++_Peek; if ((_By & 0b1100'0000u) != 0b1000'0000u) { return error; } _Code_point = (_Code_point << 6) | (_By & 0b11'1111u); } while (--_Trailing_count != 0); if (_Code_point >= 0xd800u && (_Code_point < 0xe000u || _Code_point >= 0x110000u)) { return error; } _First1 = _Peek; *_First2 = _Code_point; } return ok; } virtual result do_out(mbstate_t&, const char32_t* _First1, const char32_t* _Last1, const char32_t*& _Mid1, char8_t* _First2, char8_t* _Last2, char8_t*& _Mid2) const { _Adl_verify_range(_First1, _Last1); _Adl_verify_range(_First2, _Last2); _Codecvt_guard<char32_t, char8_t> _Guard{_First1, _Mid1, _First2, _Mid2}; for (; _First1 != _Last1; ++_First1, ++_First2) { if (_First2 == _Last2) { return partial; } const char32_t _Code_point = *_First1; if (_Code_point < 0x80u) { *_First2 = static_cast<char8_t>(_Code_point); continue; } int _Trailing_count = 1; if (_Code_point < 0x800u) { *_First2 = static_cast<char8_t>(0b1100'0000u | (_Code_point >> 6)); } else if (_Code_point < 0x10000u) { if (_Code_point >= 0xd800u && _Code_point < 0xe000u) { return error; } *_First2 = static_cast<char8_t>(0b1110'0000u | (_Code_point >> 12)); _Trailing_count = 2; } else if (_Code_point < 0x110000u) { *_First2 = static_cast<char8_t>(0b1111'0000u | (_Code_point >> 18)); _Trailing_count = 3; } else { return error; } if (_Last2 - _First2 < _Trailing_count + 1) { return partial; } do { --_Trailing_count; *++_First2 = static_cast<char8_t>(0b1000'0000u | ((_Code_point >> (6 * _Trailing_count)) & 0b11'1111u)); } while (_Trailing_count != 0); } return ok; } virtual result do_unshift(mbstate_t&, char8_t* _First2, char8_t*, char8_t*& _Mid2) const { _Mid2 = _First2; return noconv; } virtual int do_length( mbstate_t&, const char8_t* _First1, const char8_t* _Last1, size_t _Count) const { _Adl_verify_range(_First1, _Last1); const auto _Old_first1 = _First1; for (; _First1 != _Last1 && _Count > 0u; ++_First1, --_Count) { char32_t _Code_point = *_First1; if (_Code_point < 0b1000'0000u) { continue; } int _Trailing_count = 1; if (_Code_point < 0b1110'0000u) { if (_Code_point < 0b1100'0000u) { break; } _Code_point &= 0b0001'1111u; } else if (_Code_point < 0b1111'0000u) { _Code_point &= 0b0000'1111u; _Trailing_count = 2; } else if (_Code_point < 0b1111'1000u) { _Code_point &= 0b0000'0111u; _Trailing_count = 3; } else { break; } if (_Last1 - _First1 < _Trailing_count + 1) { break; } const char8_t* _Peek = _First1; bool _Done = false; do { const char8_t _By = *++_Peek; if ((_By & 0b1100'0000u) != 0b1000'0000u) { _Done = true; break; } _Code_point = (_Code_point << 6) | (_By & 0b11'1111u); } while (--_Trailing_count != 0); if (_Done || (_Code_point >= 0xd800u && (_Code_point < 0xe000u || _Code_point >= 0x110000u))) { break; } _First1 = _Peek; } return static_cast<int>((::std:: min)(_First1 - _Old_first1, ptrdiff_t{2147483647})); } virtual bool do_always_noconv() const noexcept override { return false; } virtual int do_max_length() const noexcept override { return 4; } virtual int do_encoding() const noexcept override { return 0; } }; template <> class __declspec(dllimport) codecvt<wchar_t, char, mbstate_t> : public codecvt_base { public: using intern_type = wchar_t; using extern_type = char; using state_type = mbstate_t; result in(mbstate_t& _State, const char* _First1, const char* _Last1, const char*& _Mid1, wchar_t* _First2, wchar_t* _Last2, wchar_t*& _Mid2) const { return do_in(_State, _First1, _Last1, _Mid1, _First2, _Last2, _Mid2); } result out(mbstate_t& _State, const wchar_t* _First1, const wchar_t* _Last1, const wchar_t*& _Mid1, char* _First2, char* _Last2, char*& _Mid2) const { return do_out(_State, _First1, _Last1, _Mid1, _First2, _Last2, _Mid2); } result unshift(mbstate_t& _State, char* _First2, char* _Last2, char*& _Mid2) const { return do_unshift(_State, _First2, _Last2, _Mid2); } int length(mbstate_t& _State, const char* _First1, const char* _Last1, size_t _Count) const { return do_length(_State, _First1, _Last1, _Count); } static locale::id id; explicit codecvt(size_t _Refs = 0) : codecvt_base(_Refs) { { _Locinfo _Lobj; _Init(_Lobj); } } explicit codecvt(const _Locinfo& _Lobj, size_t _Refs = 0) : codecvt_base(_Refs) { _Init(_Lobj); } static size_t __cdecl _Getcat(const locale::facet** _Ppf = nullptr, const locale* _Ploc = nullptr) { if (_Ppf && !*_Ppf) { *_Ppf = new codecvt(_Locinfo(_Ploc->c_str())); } return 2; } protected: virtual ~codecvt() noexcept {} void _Init(const _Locinfo& _Lobj) { _Cvt = _Lobj._Getcvt(); } virtual result do_in(mbstate_t&, const char* _First1, const char* _Last1, const char*& _Mid1, wchar_t* _First2, wchar_t* _Last2, wchar_t*& _Mid2) const { mbstate_t _Mystate{}; _Adl_verify_range(_First1, _Last1); _Adl_verify_range(_First2, _Last2); _Mid1 = _First1; _Mid2 = _First2; for (;;) { if (_Mid1 == _Last1) { return ok; } if (_Mid2 == _Last2) { return partial; } int _Bytes = _Mbrtowc(_Mid2, _Mid1, static_cast<size_t>(_Last1 - _Mid1), &_Mystate, &_Cvt); switch (_Bytes) { case -2: return partial; case -1: return error; case 0: _Bytes = 1; default: _Mid1 += _Bytes; ++_Mid2; break; } } } virtual result do_out(mbstate_t& _State, const wchar_t* _First1, const wchar_t* _Last1, const wchar_t*& _Mid1, char* _First2, char* _Last2, char*& _Mid2) const { _Adl_verify_range(_First1, _Last1); _Adl_verify_range(_First2, _Last2); _Mid1 = _First1; _Mid2 = _First2; int _Bytes; while (_Mid1 != _Last1 && _Mid2 != _Last2) { if (5 <= _Last2 - _Mid2) { if ((_Bytes = _Wcrtomb(_Mid2, *_Mid1, &_State, &_Cvt)) < 0) { return error; } else { ++_Mid1; _Mid2 += _Bytes; } } else { char _Buf[5]; mbstate_t _Stsave = _State; if ((_Bytes = _Wcrtomb(_Buf, *_Mid1, &_State, &_Cvt)) < 0) { return error; } else if (_Last2 - _Mid2 < _Bytes) { _State = _Stsave; break; } else { :: memcpy(_Mid2, _Buf, static_cast<size_t>(_Bytes)); ++_Mid1; _Mid2 += _Bytes; } } } return _Mid1 == _Last1 ? ok : partial; } virtual result do_unshift(mbstate_t& _State, char* _First2, char* _Last2, char*& _Mid2) const { _Adl_verify_range(_First2, _Last2); _Mid2 = _First2; result _Ans = ok; int _Bytes; char _Buf[5]; mbstate_t _Stsave = _State; if ((_Bytes = _Wcrtomb(_Buf, L'\0', &_State, &_Cvt)) <= 0) { _Ans = error; } else if (_Last2 - _Mid2 < --_Bytes) { _State = _Stsave; _Ans = partial; } else if (0 < _Bytes) { :: memcpy(_Mid2, _Buf, static_cast<size_t>(_Bytes)); _Mid2 += _Bytes; } return _Ans; } virtual int do_length( mbstate_t& _State, const char* _First1, const char* _Last1, size_t _Count) const { _Adl_verify_range(_First1, _Last1); const auto _Old_first1 = _First1; for (; _Count > 0u && _First1 != _Last1; --_Count) { wchar_t _Ch; int _Bytes = _Mbrtowc(&_Ch, _First1, static_cast<size_t>(_Last1 - _First1), &_State, &_Cvt); if (_Bytes < 0) { break; } if (_Bytes == 0) { _Bytes = 1; } _First1 += _Bytes; } return static_cast<int>((::std:: min)(_First1 - _Old_first1, ptrdiff_t{2147483647})); } virtual bool do_always_noconv() const noexcept override { return false; } virtual int do_max_length() const noexcept override { return static_cast<int>(_Cvt._Mbcurmax); } virtual int do_encoding() const noexcept override { return _Cvt._Mbcurmax == 1; } private: _Locinfo::_Cvtvec _Cvt; }; template <> class __declspec(dllimport) codecvt<unsigned short, char, mbstate_t> : public codecvt_base { public: using intern_type = unsigned short; using extern_type = char; using state_type = mbstate_t; result in(mbstate_t& _State, const char* _First1, const char* _Last1, const char*& _Mid1, unsigned short* _First2, unsigned short* _Last2, unsigned short*& _Mid2) const { return do_in(_State, _First1, _Last1, _Mid1, _First2, _Last2, _Mid2); } result out(mbstate_t& _State, const unsigned short* _First1, const unsigned short* _Last1, const unsigned short*& _Mid1, char* _First2, char* _Last2, char*& _Mid2) const { return do_out(_State, _First1, _Last1, _Mid1, _First2, _Last2, _Mid2); } result unshift(mbstate_t& _State, char* _First2, char* _Last2, char*& _Mid2) const { return do_unshift(_State, _First2, _Last2, _Mid2); } int length(mbstate_t& _State, const char* _First1, const char* _Last1, size_t _Count) const { return do_length(_State, _First1, _Last1, _Count); } static locale::id id; explicit codecvt(size_t _Refs = 0) : codecvt_base(_Refs) { { _Locinfo _Lobj; _Init(_Lobj); } } explicit codecvt(const _Locinfo& _Lobj, size_t _Refs = 0) : codecvt_base(_Refs) { _Init(_Lobj); } static size_t __cdecl _Getcat(const locale::facet** _Ppf = nullptr, const locale* _Ploc = nullptr) { if (_Ppf && !*_Ppf) { *_Ppf = new codecvt(_Locinfo(_Ploc->c_str())); } return 2; } protected: virtual ~codecvt() noexcept {} void _Init(const _Locinfo& _Lobj) { _Cvt = _Lobj._Getcvt(); } virtual result do_in(mbstate_t&, const char* _First1, const char* _Last1, const char*& _Mid1, unsigned short* _First2, unsigned short* _Last2, unsigned short*& _Mid2) const { mbstate_t _Mystate{}; _Adl_verify_range(_First1, _Last1); _Adl_verify_range(_First2, _Last2); _Mid1 = _First1; _Mid2 = _First2; for (;;) { if (_Mid1 == _Last1) { return ok; } if (_Mid2 == _Last2) { return partial; } int _Bytes = _Mbrtowc( reinterpret_cast<wchar_t*>(_Mid2), _Mid1, static_cast<size_t>(_Last1 - _Mid1), &_Mystate, &_Cvt); switch (_Bytes) { case -2: return partial; case -1: return error; case 0: _Bytes = 1; default: _Mid1 += _Bytes; ++_Mid2; break; } } } virtual result do_out(mbstate_t& _State, const unsigned short* _First1, const unsigned short* _Last1, const unsigned short*& _Mid1, char* _First2, char* _Last2, char*& _Mid2) const { _Adl_verify_range(_First1, _Last1); _Adl_verify_range(_First2, _Last2); _Mid1 = _First1; _Mid2 = _First2; int _Bytes; while (_Mid1 != _Last1 && _Mid2 != _Last2) { if (5 <= _Last2 - _Mid2) { if ((_Bytes = _Wcrtomb(_Mid2, *_Mid1, &_State, &_Cvt)) < 0) { return error; } else { ++_Mid1; _Mid2 += _Bytes; } } else { char _Buf[5]; mbstate_t _Stsave = _State; if ((_Bytes = _Wcrtomb(_Buf, *_Mid1, &_State, &_Cvt)) < 0) { return error; } else if (_Last2 - _Mid2 < _Bytes) { _State = _Stsave; break; } else { :: memcpy(_Mid2, _Buf, static_cast<size_t>(_Bytes)); ++_Mid1; _Mid2 += _Bytes; } } } return _Mid1 == _Last1 ? ok : partial; } virtual result do_unshift(mbstate_t& _State, char* _First2, char* _Last2, char*& _Mid2) const { _Adl_verify_range(_First2, _Last2); _Mid2 = _First2; result _Ans = ok; int _Bytes; char _Buf[5]; mbstate_t _Stsave = _State; if ((_Bytes = _Wcrtomb(_Buf, L'\0', &_State, &_Cvt)) <= 0) { _Ans = error; } else if (_Last2 - _Mid2 < --_Bytes) { _State = _Stsave; _Ans = partial; } else if (0 < _Bytes) { :: memcpy(_Mid2, _Buf, static_cast<size_t>(_Bytes)); _Mid2 += _Bytes; } return _Ans; } virtual int do_length( mbstate_t& _State, const char* _First1, const char* _Last1, size_t _Count) const { _Adl_verify_range(_First1, _Last1); const auto _Old_first1 = _First1; for (; _Count > 0u && _First1 != _Last1; --_Count) { wchar_t _Ch; int _Bytes = _Mbrtowc(&_Ch, _First1, static_cast<size_t>(_Last1 - _First1), &_State, &_Cvt); if (_Bytes < 0) { break; } if (_Bytes == 0) { _Bytes = 1; } _First1 += _Bytes; } return static_cast<int>((::std:: min)(_First1 - _Old_first1, ptrdiff_t{2147483647})); } virtual bool do_always_noconv() const noexcept override { return false; } virtual int do_max_length() const noexcept override { return static_cast<int>(_Cvt._Mbcurmax); } virtual int do_encoding() const noexcept override { return _Cvt._Mbcurmax == 1u; } private: _Locinfo::_Cvtvec _Cvt; }; template <class _Elem, class _Byte, class _Statype> class codecvt_byname : public codecvt<_Elem, _Byte, _Statype> { public: static_assert(!0 || _Is_any_of_v<codecvt_byname, codecvt_byname<char16_t, char8_t, mbstate_t>, codecvt_byname<char32_t, char8_t, mbstate_t>, codecvt_byname<char, char, mbstate_t>, codecvt_byname<wchar_t, char, mbstate_t>>, "Unsupported facet specialization; see N4800 27.3.1.1.1 [locale.category]. " "Either use a Standard specialization or define _ENFORCE_FACET_SPECIALIZATIONS=0 " "to suppress this diagnostic."); explicit codecvt_byname(const char* _Locname, size_t _Refs = 0) : codecvt<_Elem, _Byte, _Statype>(_Locinfo(_Locname), _Refs) {} explicit codecvt_byname(const string& _Str, size_t _Refs = 0) : codecvt<_Elem, _Byte, _Statype>(_Locinfo(_Str.c_str()), _Refs) {} protected: virtual ~codecvt_byname() noexcept {} }; struct __declspec(dllimport) ctype_base : locale::facet { enum { alnum = 0x04 | 0x02 | 0x01 | 0x100, alpha = 0x02 | 0x01 | 0x100, cntrl = 0x20, digit = 0x04, graph = 0x04 | 0x02 | 0x10 | 0x01 | 0x100, lower = 0x02, print = 0x04 | 0x02 | 0x10 | 0x40 | 0x01 | 0x100 | 0x80, punct = 0x10, space = 0x08 | 0x40, upper = 0x01, xdigit = 0x80, blank = 0x08 | 0x40 }; using mask = short; ctype_base(size_t _Refs = 0) : locale::facet(_Refs) {} ~ctype_base() noexcept {} }; template <class _Elem> class ctype : public ctype_base { public: static_assert(!0 || _Always_false<_Elem>, "Unsupported facet specialization; see N4800 27.3.1.1.1 [locale.category]. " "Either use a Standard specialization or define _ENFORCE_FACET_SPECIALIZATIONS=0 " "to suppress this diagnostic."); using char_type = _Elem; bool is(mask _Maskval, _Elem _Ch) const { return do_is(_Maskval, _Ch); } const _Elem* is(const _Elem* _First, const _Elem* _Last, mask* _Dest) const { return do_is(_First, _Last, _Dest); } const _Elem* scan_is(mask _Maskval, const _Elem* _First, const _Elem* _Last) const { return do_scan_is(_Maskval, _First, _Last); } const _Elem* scan_not(mask _Maskval, const _Elem* _First, const _Elem* _Last) const { return do_scan_not(_Maskval, _First, _Last); } _Elem tolower(_Elem _Ch) const { return do_tolower(_Ch); } const _Elem* tolower( _Elem* _First, const _Elem* _Last) const { return do_tolower(_First, _Last); } _Elem toupper(_Elem _Ch) const { return do_toupper(_Ch); } const _Elem* toupper( _Elem* _First, const _Elem* _Last) const { return do_toupper(_First, _Last); } _Elem widen(char _Byte) const { return do_widen(_Byte); } const char* widen(const char* _First, const char* _Last, _Elem* _Dest) const { return do_widen(_First, _Last, _Dest); } char narrow(_Elem _Ch, char _Dflt = '\0') const { return do_narrow(_Ch, _Dflt); } const _Elem* narrow(const _Elem* _First, const _Elem* _Last, char _Dflt, char* _Dest) const { return do_narrow(_First, _Last, _Dflt, _Dest); } static locale::id id; explicit ctype(size_t _Refs = 0) : ctype_base(_Refs) { { _Locinfo _Lobj; _Init(_Lobj); } } ctype(const _Locinfo& _Lobj, size_t _Refs = 0) : ctype_base(_Refs) { _Init(_Lobj); } static size_t __cdecl _Getcat(const locale::facet** _Ppf = nullptr, const locale* _Ploc = nullptr) { if (_Ppf && !*_Ppf) { *_Ppf = new ctype<_Elem>(_Locinfo(_Ploc->c_str())); } return 2; } protected: virtual ~ctype() noexcept { if (_Ctype._Delfl) { :: free(const_cast<short*>(_Ctype._Table)); } :: free(_Ctype._LocaleName); } void _Init(const _Locinfo& _Lobj) { _Ctype = _Lobj._Getctype(); _Cvt = _Lobj._Getcvt(); } virtual bool do_is( mask _Maskval, _Elem _Ch) const { return (_Ctype._Table[static_cast<unsigned char>(narrow(_Ch))] & _Maskval) != 0; } virtual const _Elem* do_is(const _Elem* _First, const _Elem* _Last, mask* _Dest) const { _Adl_verify_range(_First, _Last); for (; _First != _Last; ++_First, ++_Dest) { *_Dest = _Ctype._Table[static_cast<unsigned char>(narrow(*_First))]; } return _First; } virtual const _Elem* do_scan_is(mask _Maskval, const _Elem* _First, const _Elem* _Last) const { _Adl_verify_range(_First, _Last); while (_First != _Last && !is(_Maskval, *_First)) { ++_First; } return _First; } virtual const _Elem* do_scan_not(mask _Maskval, const _Elem* _First, const _Elem* _Last) const { _Adl_verify_range(_First, _Last); while (_First != _Last && is(_Maskval, *_First)) { ++_First; } return _First; } virtual _Elem do_tolower(_Elem _Ch) const { unsigned char _Byte = static_cast<unsigned char>(narrow(_Ch, '\0')); if (_Byte == '\0') { return _Ch; } return widen(static_cast<char>(_Tolower(_Byte, &_Ctype))); } virtual const _Elem* do_tolower(_Elem* _First, const _Elem* _Last) const { _Adl_verify_range(_First, _Last); for (; _First != _Last; ++_First) { unsigned char _Byte = static_cast<unsigned char>(narrow(*_First, '\0')); if (_Byte != '\0') { *_First = (widen(static_cast<char>(_Tolower(_Byte, &_Ctype)))); } } return _First; } virtual _Elem do_toupper(_Elem _Ch) const { unsigned char _Byte = static_cast<unsigned char>(narrow(_Ch, '\0')); if (_Byte == '\0') { return _Ch; } return widen(static_cast<char>(_Toupper(_Byte, &_Ctype))); } virtual const _Elem* do_toupper(_Elem* _First, const _Elem* _Last) const { _Adl_verify_range(_First, _Last); for (; _First != _Last; ++_First) { unsigned char _Byte = static_cast<unsigned char>(narrow(*_First, '\0')); if (_Byte != '\0') { *_First = (widen(static_cast<char>(_Toupper(_Byte, &_Ctype)))); } } return _First; } virtual _Elem do_widen(char _Byte) const { return _Maklocchr(_Byte, static_cast<_Elem*>(nullptr), _Cvt); } virtual const char* do_widen( const char* _First, const char* _Last, _Elem* _Dest) const { _Adl_verify_range(_First, _Last); for (; _First != _Last; ++_First, ++_Dest) { *_Dest = _Maklocchr(*_First, static_cast<_Elem*>(nullptr), _Cvt); } return _First; } char _Donarrow(_Elem _Ch, char _Dflt) const { char _Byte; if (_Ch == _Elem{}) { return '\0'; } if ((_Byte = _Maklocbyte(_Ch, _Cvt)) == '\0') { return _Dflt; } return _Byte; } virtual char do_narrow(_Elem _Ch, char _Dflt) const { return _Donarrow(_Ch, _Dflt); } virtual const _Elem* do_narrow(const _Elem* _First, const _Elem* _Last, char _Dflt, char* _Dest) const { _Adl_verify_range(_First, _Last); for (; _First != _Last; ++_First, ++_Dest) { *_Dest = _Donarrow(*_First, _Dflt); } return _First; } private: _Locinfo::_Ctypevec _Ctype; _Locinfo::_Cvtvec _Cvt; }; template <class _Elem> locale::id ctype<_Elem>::id; template <> class __declspec(dllimport) ctype<char> : public ctype_base { public: using _Elem = char; using char_type = _Elem; bool is(mask _Maskval, _Elem _Ch) const { return (_Ctype._Table[static_cast<unsigned char>(_Ch)] & _Maskval) != 0; } const _Elem* is(const _Elem* _First, const _Elem* _Last, mask* _Dest) const { _Adl_verify_range(_First, _Last); for (; _First != _Last; ++_First, ++_Dest) { *_Dest = _Ctype._Table[static_cast<unsigned char>(*_First)]; } return _First; } const _Elem* scan_is(mask _Maskval, const _Elem* _First, const _Elem* _Last) const { _Adl_verify_range(_First, _Last); while (_First != _Last && !is(_Maskval, *_First)) { ++_First; } return _First; } const _Elem* scan_not(mask _Maskval, const _Elem* _First, const _Elem* _Last) const { _Adl_verify_range(_First, _Last); while (_First != _Last && is(_Maskval, *_First)) { ++_First; } return _First; } _Elem tolower(_Elem _Ch) const { return do_tolower(_Ch); } const _Elem* tolower( _Elem* _First, const _Elem* _Last) const { return do_tolower(_First, _Last); } _Elem toupper(_Elem _Ch) const { return do_toupper(_Ch); } const _Elem* toupper( _Elem* _First, const _Elem* _Last) const { return do_toupper(_First, _Last); } _Elem widen(char _Byte) const { return do_widen(_Byte); } const _Elem* widen(const char* _First, const char* _Last, _Elem* _Dest) const { return do_widen(_First, _Last, _Dest); } _Elem narrow(_Elem _Ch, char _Dflt = '\0') const { return do_narrow(_Ch, _Dflt); } const _Elem* narrow(const _Elem* _First, const _Elem* _Last, char _Dflt, char* _Dest) const { return do_narrow(_First, _Last, _Dflt, _Dest); } static locale::id id; explicit ctype(const mask* _Table = nullptr, bool _Deletetable = false, size_t _Refs = 0) : ctype_base(_Refs) { { _Locinfo _Lobj; _Init(_Lobj); } _Tidy(); if (_Table) { _Ctype._Table = _Table; _Ctype._Delfl = _Deletetable ? -1 : 0; } else { _Ctype._Table = classic_table(); _Ctype._Delfl = 0; } } ctype(const _Locinfo& _Lobj, size_t _Refs = 0) : ctype_base(_Refs) { _Init(_Lobj); } static size_t __cdecl _Getcat(const locale::facet** _Ppf = nullptr, const locale* _Ploc = nullptr) { if (_Ppf && !*_Ppf) { *_Ppf = new ctype<_Elem>(_Locinfo(_Ploc->c_str())); } return 2; } const mask* table() const noexcept { return _Ctype._Table; } static const mask* __cdecl classic_table() noexcept { return ::std:: use_facet<ctype>(locale::classic()).table(); } static const size_t table_size = 1 << 8; protected: virtual ~ctype() noexcept { _Tidy(); } void _Init(const _Locinfo& _Lobj) { _Ctype = _Lobj._Getctype(); } void _Tidy() noexcept { if (0 < _Ctype._Delfl) { :: free(const_cast<short*>(_Ctype._Table)); } else if (_Ctype._Delfl < 0) { delete[] _Ctype._Table; } :: free(_Ctype._LocaleName); } virtual _Elem do_tolower(_Elem _Ch) const { return static_cast<_Elem>(_Tolower(static_cast<unsigned char>(_Ch), &_Ctype)); } virtual const _Elem* do_tolower(_Elem* _First, const _Elem* _Last) const { _Adl_verify_range(_First, _Last); for (; _First != _Last; ++_First) { *_First = static_cast<_Elem>(_Tolower(static_cast<unsigned char>(*_First), &_Ctype)); } return _First; } virtual _Elem do_toupper(_Elem _Ch) const { return static_cast<_Elem>(_Toupper(static_cast<unsigned char>(_Ch), &_Ctype)); } virtual const _Elem* do_toupper(_Elem* _First, const _Elem* _Last) const { _Adl_verify_range(_First, _Last); for (; _First != _Last; ++_First) { *_First = static_cast<_Elem>(_Toupper(static_cast<unsigned char>(*_First), &_Ctype)); } return _First; } virtual _Elem do_widen(char _Byte) const { return _Byte; } virtual const _Elem* do_widen( const char* _First, const char* _Last, _Elem* _Dest) const { _Adl_verify_range(_First, _Last); :: memcpy(_Dest, _First, static_cast<size_t>(_Last - _First)); return _Last; } virtual _Elem do_narrow(_Elem _Ch, char) const { return _Ch; } virtual const _Elem* do_narrow(const _Elem* _First, const _Elem* _Last, char, char* _Dest) const { _Adl_verify_range(_First, _Last); :: memcpy(_Dest, _First, static_cast<size_t>(_Last - _First)); return _Last; } private: _Locinfo::_Ctypevec _Ctype; }; template <> class __declspec(dllimport) ctype<wchar_t> : public ctype_base { public: using _Elem = wchar_t; using char_type = _Elem; bool is(mask _Maskval, _Elem _Ch) const { return do_is(_Maskval, _Ch); } const _Elem* is(const _Elem* _First, const _Elem* _Last, mask* _Dest) const { return do_is(_First, _Last, _Dest); } const _Elem* scan_is(mask _Maskval, const _Elem* _First, const _Elem* _Last) const { return do_scan_is(_Maskval, _First, _Last); } const _Elem* scan_not(mask _Maskval, const _Elem* _First, const _Elem* _Last) const { return do_scan_not(_Maskval, _First, _Last); } _Elem tolower(_Elem _Ch) const { return do_tolower(_Ch); } const _Elem* tolower( _Elem* _First, const _Elem* _Last) const { return do_tolower(_First, _Last); } _Elem toupper(_Elem _Ch) const { return do_toupper(_Ch); } const _Elem* toupper( _Elem* _First, const _Elem* _Last) const { return do_toupper(_First, _Last); } _Elem widen(char _Byte) const { return do_widen(_Byte); } const char* widen(const char* _First, const char* _Last, _Elem* _Dest) const { return do_widen(_First, _Last, _Dest); } char narrow(_Elem _Ch, char _Dflt = '\0') const { return do_narrow(_Ch, _Dflt); } const _Elem* narrow(const _Elem* _First, const _Elem* _Last, char _Dflt, char* _Dest) const { return do_narrow(_First, _Last, _Dflt, _Dest); } static locale::id id; explicit ctype(size_t _Refs = 0) : ctype_base(_Refs) { { _Locinfo _Lobj; _Init(_Lobj); } } ctype(const _Locinfo& _Lobj, size_t _Refs = 0) : ctype_base(_Refs) { _Init(_Lobj); } static size_t __cdecl _Getcat(const locale::facet** _Ppf = nullptr, const locale* _Ploc = nullptr) { if (_Ppf && !*_Ppf) { *_Ppf = new ctype<_Elem>(_Locinfo(_Ploc->c_str())); } return 2; } protected: virtual ~ctype() noexcept { if (_Ctype._Delfl) { :: free(const_cast<short*>(_Ctype._Table)); } :: free(_Ctype._LocaleName); } void _Init(const _Locinfo& _Lobj) { _Ctype = _Lobj._Getctype(); _Cvt = _Lobj._Getcvt(); } virtual bool do_is( mask _Maskval, _Elem _Ch) const { return (:: _Getwctype(_Ch, &_Ctype) & _Maskval) != 0; } virtual const _Elem* do_is(const _Elem* _First, const _Elem* _Last, mask* _Dest) const { _Adl_verify_range(_First, _Last); return :: _Getwctypes(_First, _Last, _Dest, &_Ctype); } virtual const _Elem* do_scan_is(mask _Maskval, const _Elem* _First, const _Elem* _Last) const { _Adl_verify_range(_First, _Last); while (_First != _Last && !is(_Maskval, *_First)) { ++_First; } return _First; } virtual const _Elem* do_scan_not(mask _Maskval, const _Elem* _First, const _Elem* _Last) const { _Adl_verify_range(_First, _Last); while (_First != _Last && is(_Maskval, *_First)) { ++_First; } return _First; } virtual _Elem do_tolower(_Elem _Ch) const { return _Towlower(_Ch, &_Ctype); } virtual const _Elem* do_tolower(_Elem* _First, const _Elem* _Last) const { _Adl_verify_range(_First, _Last); for (; _First != _Last; ++_First) { *_First = _Towlower(*_First, &_Ctype); } return _First; } virtual _Elem do_toupper(_Elem _Ch) const { return _Towupper(_Ch, &_Ctype); } virtual const _Elem* do_toupper(_Elem* _First, const _Elem* _Last) const { _Adl_verify_range(_First, _Last); for (; _First != _Last; ++_First) { *_First = _Towupper(*_First, &_Ctype); } return _First; } _Elem _Dowiden(char _Byte) const { mbstate_t _Mbst = {}; wchar_t _Wc; return _Mbrtowc(&_Wc, &_Byte, 1, &_Mbst, &_Cvt) < 0 ? static_cast<wchar_t>(((wint_t)(0xFFFF))) : _Wc; } virtual _Elem do_widen(char _Byte) const { return _Dowiden(_Byte); } virtual const char* do_widen( const char* _First, const char* _Last, _Elem* _Dest) const { _Adl_verify_range(_First, _Last); for (; _First != _Last; ++_First, ++_Dest) { *_Dest = _Dowiden(*_First); } return _First; } char _Donarrow(_Elem _Ch, char _Dflt) const { char _Buf[5]; mbstate_t _Mbst = {}; return _Wcrtomb(_Buf, _Ch, &_Mbst, &_Cvt) != 1 ? _Dflt : _Buf[0]; } virtual char do_narrow(_Elem _Ch, char _Dflt) const { return _Donarrow(_Ch, _Dflt); } virtual const _Elem* do_narrow(const _Elem* _First, const _Elem* _Last, char _Dflt, char* _Dest) const { _Adl_verify_range(_First, _Last); for (; _First != _Last; ++_First, ++_Dest) { *_Dest = _Donarrow(*_First, _Dflt); } return _First; } private: _Locinfo::_Ctypevec _Ctype; _Locinfo::_Cvtvec _Cvt; }; template <> class __declspec(dllimport) ctype<unsigned short> : public ctype_base { public: using _Elem = unsigned short; using char_type = _Elem; bool is(mask _Maskval, _Elem _Ch) const { return do_is(_Maskval, _Ch); } const _Elem* is(const _Elem* _First, const _Elem* _Last, mask* _Dest) const { return do_is(_First, _Last, _Dest); } const _Elem* scan_is(mask _Maskval, const _Elem* _First, const _Elem* _Last) const { return do_scan_is(_Maskval, _First, _Last); } const _Elem* scan_not(mask _Maskval, const _Elem* _First, const _Elem* _Last) const { return do_scan_not(_Maskval, _First, _Last); } _Elem tolower(_Elem _Ch) const { return do_tolower(_Ch); } const _Elem* tolower( _Elem* _First, const _Elem* _Last) const { return do_tolower(_First, _Last); } _Elem toupper(_Elem _Ch) const { return do_toupper(_Ch); } const _Elem* toupper( _Elem* _First, const _Elem* _Last) const { return do_toupper(_First, _Last); } _Elem widen(char _Byte) const { return do_widen(_Byte); } const char* widen(const char* _First, const char* _Last, _Elem* _Dest) const { return do_widen(_First, _Last, _Dest); } char narrow(_Elem _Ch, char _Dflt = '\0') const { return do_narrow(_Ch, _Dflt); } const _Elem* narrow(const _Elem* _First, const _Elem* _Last, char _Dflt, char* _Dest) const { return do_narrow(_First, _Last, _Dflt, _Dest); } static locale::id id; explicit ctype(size_t _Refs = 0) : ctype_base(_Refs) { { _Locinfo _Lobj; _Init(_Lobj); } } ctype(const _Locinfo& _Lobj, size_t _Refs = 0) : ctype_base(_Refs) { _Init(_Lobj); } static size_t __cdecl _Getcat(const locale::facet** _Ppf = nullptr, const locale* _Ploc = nullptr) { if (_Ppf && !*_Ppf) { *_Ppf = new ctype<_Elem>(_Locinfo(_Ploc->c_str())); } return 2; } protected: virtual ~ctype() noexcept { if (_Ctype._Delfl) { :: free(const_cast<short*>(_Ctype._Table)); } :: free(_Ctype._LocaleName); } void _Init(const _Locinfo& _Lobj) { _Ctype = _Lobj._Getctype(); _Cvt = _Lobj._Getcvt(); } virtual bool do_is( mask _Maskval, _Elem _Ch) const { return (:: _Getwctype(_Ch, &_Ctype) & _Maskval) != 0; } virtual const _Elem* do_is(const _Elem* _First, const _Elem* _Last, mask* _Dest) const { _Adl_verify_range(_First, _Last); return reinterpret_cast<const _Elem*>(:: _Getwctypes( reinterpret_cast<const wchar_t*>(_First), reinterpret_cast<const wchar_t*>(_Last), _Dest, &_Ctype)); } virtual const _Elem* do_scan_is(mask _Maskval, const _Elem* _First, const _Elem* _Last) const { _Adl_verify_range(_First, _Last); while (_First != _Last && !is(_Maskval, *_First)) { ++_First; } return _First; } virtual const _Elem* do_scan_not(mask _Maskval, const _Elem* _First, const _Elem* _Last) const { _Adl_verify_range(_First, _Last); while (_First != _Last && is(_Maskval, *_First)) { ++_First; } return _First; } virtual _Elem do_tolower(_Elem _Ch) const { return _Towlower(_Ch, &_Ctype); } virtual const _Elem* do_tolower(_Elem* _First, const _Elem* _Last) const { _Adl_verify_range(_First, _Last); for (; _First != _Last; ++_First) { *_First = _Towlower(*_First, &_Ctype); } return _First; } virtual _Elem do_toupper(_Elem _Ch) const { return _Towupper(_Ch, &_Ctype); } virtual const _Elem* do_toupper(_Elem* _First, const _Elem* _Last) const { _Adl_verify_range(_First, _Last); for (; _First != _Last; ++_First) { *_First = _Towupper(*_First, &_Ctype); } return _First; } _Elem _Dowiden(char _Byte) const { mbstate_t _Mbst = {}; unsigned short _Wc; if (_Mbrtowc(reinterpret_cast<wchar_t*>(&_Wc), &_Byte, 1, &_Mbst, &_Cvt) < 0) { return static_cast<unsigned short>(((wint_t)(0xFFFF))); } return _Wc; } virtual _Elem do_widen(char _Byte) const { return _Dowiden(_Byte); } virtual const char* do_widen( const char* _First, const char* _Last, _Elem* _Dest) const { _Adl_verify_range(_First, _Last); for (; _First != _Last; ++_First, ++_Dest) { *_Dest = _Dowiden(*_First); } return _First; } char _Donarrow(_Elem _Ch, char _Dflt) const { char _Buf[5]; mbstate_t _Mbst = {}; return _Wcrtomb(_Buf, _Ch, &_Mbst, &_Cvt) != 1 ? _Dflt : _Buf[0]; } virtual char do_narrow(_Elem _Ch, char _Dflt) const { return _Donarrow(_Ch, _Dflt); } virtual const _Elem* do_narrow(const _Elem* _First, const _Elem* _Last, char _Dflt, char* _Dest) const { _Adl_verify_range(_First, _Last); for (; _First != _Last; ++_First, ++_Dest) { *_Dest = _Donarrow(*_First, _Dflt); } return _First; } private: _Locinfo::_Ctypevec _Ctype; _Locinfo::_Cvtvec _Cvt; }; template <class _Elem> class ctype_byname : public ctype<_Elem> { public: static_assert(!0 || _Is_any_of_v<_Elem, char, wchar_t>, "Unsupported facet specialization; see N4800 27.3.1.1.1 [locale.category]. " "Either use a Standard specialization or define _ENFORCE_FACET_SPECIALIZATIONS=0 " "to suppress this diagnostic."); explicit ctype_byname(const char* _Locname, size_t _Refs = 0) : ctype<_Elem>(_Locinfo(_Locname), _Refs) {} explicit ctype_byname(const string& _Str, size_t _Refs = 0) : ctype<_Elem>(_Locinfo(_Str.c_str()), _Refs) {} protected: virtual ~ctype_byname() noexcept {} }; enum class _Case_sensitive : bool { _Nope, _Yes }; template <class _InIt, class _Elem> int __cdecl _Getloctxt( _InIt& _First, _InIt& _Last, size_t _Numfields, const _Elem* _Ptr, const _Case_sensitive _Matching) { for (size_t _Off = 0; _Ptr[_Off] != _Elem{}; ++_Off) { if (_Ptr[_Off] == _Ptr[0]) { ++_Numfields; } } string _Str(_Numfields, '\0'); const ctype<_Elem>& _CType = ::std:: use_facet<ctype<_Elem>>(locale{}); int _Ans = -2; for (size_t _Column = 1;; ++_Column, (void) ++_First, _Ans = -1) { bool _Prefix = false; size_t _Off = 0; size_t _Field = 0; for (; _Field < _Numfields; ++_Field) { while (_Ptr[_Off] != _Elem{} && _Ptr[_Off] != _Ptr[0]) { ++_Off; } if (_Str[_Field] != '\0') { _Off += _Str[_Field]; } else if (_Ptr[_Off += _Column] == _Ptr[0] || _Ptr[_Off] == _Elem{}) { _Str[_Field] = static_cast<char>(_Column < 127 ? _Column : 127); _Ans = static_cast<int>(_Field); } else if (_First == _Last || (_Matching == _Case_sensitive::_Yes ? _Ptr[_Off] != *_First : _CType.tolower(_Ptr[_Off]) != _CType.tolower(static_cast<_Elem>(*_First)))) { _Str[_Field] = static_cast<char>(_Column < 127 ? _Column : 127); } else { _Prefix = true; } } if (!_Prefix || _First == _Last) { break; } } return _Ans; } template class __declspec(dllimport) codecvt<char, char, mbstate_t>; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { template <class _Dummy> class _Iosb { public: enum _Dummy_enum { _Dummy_enum_val = 1 }; enum _Fmtflags { _Fmtmask = 0xffff, _Fmtzero = 0 }; static constexpr _Fmtflags skipws = static_cast<_Fmtflags>(0x0001); static constexpr _Fmtflags unitbuf = static_cast<_Fmtflags>(0x0002); static constexpr _Fmtflags uppercase = static_cast<_Fmtflags>(0x0004); static constexpr _Fmtflags showbase = static_cast<_Fmtflags>(0x0008); static constexpr _Fmtflags showpoint = static_cast<_Fmtflags>(0x0010); static constexpr _Fmtflags showpos = static_cast<_Fmtflags>(0x0020); static constexpr _Fmtflags left = static_cast<_Fmtflags>(0x0040); static constexpr _Fmtflags right = static_cast<_Fmtflags>(0x0080); static constexpr _Fmtflags internal = static_cast<_Fmtflags>(0x0100); static constexpr _Fmtflags dec = static_cast<_Fmtflags>(0x0200); static constexpr _Fmtflags oct = static_cast<_Fmtflags>(0x0400); static constexpr _Fmtflags hex = static_cast<_Fmtflags>(0x0800); static constexpr _Fmtflags scientific = static_cast<_Fmtflags>(0x1000); static constexpr _Fmtflags fixed = static_cast<_Fmtflags>(0x2000); static constexpr _Fmtflags hexfloat = static_cast<_Fmtflags>(0x3000); static constexpr _Fmtflags boolalpha = static_cast<_Fmtflags>(0x4000); static constexpr _Fmtflags _Stdio = static_cast<_Fmtflags>(0x8000); static constexpr _Fmtflags adjustfield = static_cast<_Fmtflags>(0x01C0); static constexpr _Fmtflags basefield = static_cast<_Fmtflags>(0x0E00); static constexpr _Fmtflags floatfield = static_cast<_Fmtflags>(0x3000); enum _Iostate { _Statmask = 0x17 }; static constexpr _Iostate goodbit = static_cast<_Iostate>(0x0); static constexpr _Iostate eofbit = static_cast<_Iostate>(0x1); static constexpr _Iostate failbit = static_cast<_Iostate>(0x2); static constexpr _Iostate badbit = static_cast<_Iostate>(0x4); enum _Openmode { _Openmask = 0xff }; static constexpr _Openmode in = static_cast<_Openmode>(0x01); static constexpr _Openmode out = static_cast<_Openmode>(0x02); static constexpr _Openmode ate = static_cast<_Openmode>(0x04); static constexpr _Openmode app = static_cast<_Openmode>(0x08); static constexpr _Openmode trunc = static_cast<_Openmode>(0x10); static constexpr _Openmode _Nocreate = static_cast<_Openmode>(0x40); static constexpr _Openmode _Noreplace = static_cast<_Openmode>(0x80); static constexpr _Openmode binary = static_cast<_Openmode>(0x20); enum _Seekdir { _Seekbeg, _Seekcur, _Seekend }; static constexpr _Seekdir beg = _Seekbeg; static constexpr _Seekdir cur = _Seekcur; static constexpr _Seekdir end = _Seekend; enum { _Openprot = 0x40 }; static constexpr int _Default_open_prot = 0x40; }; template <class _Dummy> const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::skipws; template <class _Dummy> const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::unitbuf; template <class _Dummy> const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::uppercase; template <class _Dummy> const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::showbase; template <class _Dummy> const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::showpoint; template <class _Dummy> const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::showpos; template <class _Dummy> const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::left; template <class _Dummy> const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::right; template <class _Dummy> const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::internal; template <class _Dummy> const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::dec; template <class _Dummy> const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::oct; template <class _Dummy> const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::hex; template <class _Dummy> const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::scientific; template <class _Dummy> const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::fixed; template <class _Dummy> const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::hexfloat; template <class _Dummy> const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::boolalpha; template <class _Dummy> const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::_Stdio; template <class _Dummy> const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::adjustfield; template <class _Dummy> const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::basefield; template <class _Dummy> const typename _Iosb<_Dummy>::_Fmtflags _Iosb<_Dummy>::floatfield; template <class _Dummy> const typename _Iosb<_Dummy>::_Iostate _Iosb<_Dummy>::goodbit; template <class _Dummy> const typename _Iosb<_Dummy>::_Iostate _Iosb<_Dummy>::eofbit; template <class _Dummy> const typename _Iosb<_Dummy>::_Iostate _Iosb<_Dummy>::failbit; template <class _Dummy> const typename _Iosb<_Dummy>::_Iostate _Iosb<_Dummy>::badbit; template <class _Dummy> const typename _Iosb<_Dummy>::_Openmode _Iosb<_Dummy>::in; template <class _Dummy> const typename _Iosb<_Dummy>::_Openmode _Iosb<_Dummy>::out; template <class _Dummy> const typename _Iosb<_Dummy>::_Openmode _Iosb<_Dummy>::ate; template <class _Dummy> const typename _Iosb<_Dummy>::_Openmode _Iosb<_Dummy>::app; template <class _Dummy> const typename _Iosb<_Dummy>::_Openmode _Iosb<_Dummy>::trunc; template <class _Dummy> const typename _Iosb<_Dummy>::_Openmode _Iosb<_Dummy>::_Nocreate; template <class _Dummy> const typename _Iosb<_Dummy>::_Openmode _Iosb<_Dummy>::_Noreplace; template <class _Dummy> const typename _Iosb<_Dummy>::_Openmode _Iosb<_Dummy>::binary; template <class _Dummy> const typename _Iosb<_Dummy>::_Seekdir _Iosb<_Dummy>::beg; template <class _Dummy> const typename _Iosb<_Dummy>::_Seekdir _Iosb<_Dummy>::cur; template <class _Dummy> const typename _Iosb<_Dummy>::_Seekdir _Iosb<_Dummy>::end; class __declspec(dllimport) ios_base : public _Iosb<int> { public: using fmtflags = int; using iostate = int; using openmode = int; using seekdir = int; enum event { erase_event, imbue_event, copyfmt_event }; using event_callback = void(__cdecl*)(event, ios_base&, int); class failure : public system_error { public: explicit failure(const string& _Message, const error_code& _Errcode = make_error_code(io_errc::stream)) : system_error(_Errcode, _Message) {} explicit failure(const char* _Message, const error_code& _Errcode = make_error_code(io_errc::stream)) : system_error(_Errcode, _Message) {} }; class __declspec(dllimport) Init { public: Init() { _Init_ctor(this); } ~Init() noexcept { _Init_dtor(this); } private: static void __cdecl _Init_ctor(Init*); static void __cdecl _Init_dtor(Init*); static int _Init_cnt; static int& __cdecl _Init_cnt_func(); }; explicit operator bool() const { return !fail(); } [[nodiscard]] bool operator!() const { return fail(); } void clear(iostate _State, bool _Reraise) { _State &= _Statmask; _Mystate = _State; const auto _Filtered = _State & _Except; if (_Filtered) { if (_Reraise) { throw; } const char* _Msg; if (_Filtered & ios_base::badbit) { _Msg = "ios_base::badbit set"; } else if (_Filtered & ios_base::failbit) { _Msg = "ios_base::failbit set"; } else { _Msg = "ios_base::eofbit set"; } throw failure(_Msg); } } void clear(iostate _State = goodbit) { clear(_State, false); } [[nodiscard]] iostate rdstate() const { return _Mystate; } void setstate( iostate _State, bool _Exreraise) { clear(rdstate() | _State, _Exreraise); } void setstate(iostate _State) { clear(rdstate() | _State, false); } [[nodiscard]] bool good() const { return rdstate() == ios_base::goodbit; } [[nodiscard]] bool eof() const { return rdstate() & ios_base::eofbit; } [[nodiscard]] bool fail() const { return rdstate() & (ios_base::badbit | ios_base::failbit); } [[nodiscard]] bool bad() const { return rdstate() & ios_base::badbit; } [[nodiscard]] iostate exceptions() const { return _Except; } void exceptions(iostate _Newexcept) { _Except = _Newexcept & _Statmask; clear(rdstate()); } [[nodiscard]] fmtflags flags() const { return _Fmtfl; } fmtflags flags(fmtflags _Newfmtflags) { const fmtflags _Oldfmtflags = _Fmtfl; _Fmtfl = _Newfmtflags & _Fmtmask; return _Oldfmtflags; } fmtflags setf(fmtflags _Newfmtflags) { const ios_base::fmtflags _Oldfmtflags = _Fmtfl; _Fmtfl |= _Newfmtflags & _Fmtmask; return _Oldfmtflags; } fmtflags setf( fmtflags _Newfmtflags, fmtflags _Mask) { const ios_base::fmtflags _Oldfmtflags = _Fmtfl; _Fmtfl = (_Oldfmtflags & ~_Mask) | (_Newfmtflags & _Mask & _Fmtmask); return _Oldfmtflags; } void unsetf(fmtflags _Mask) { _Fmtfl &= ~_Mask; } [[nodiscard]] streamsize precision() const { return _Prec; } streamsize precision(streamsize _Newprecision) { const streamsize _Oldprecision = _Prec; _Prec = _Newprecision; return _Oldprecision; } [[nodiscard]] streamsize width() const { return _Wide; } streamsize width(streamsize _Newwidth) { const streamsize _Oldwidth = _Wide; _Wide = _Newwidth; return _Oldwidth; } [[nodiscard]] locale getloc() const { return *_Ploc; } locale imbue(const locale& _Loc) { locale _Oldlocale = *_Ploc; *_Ploc = _Loc; _Callfns(imbue_event); return _Oldlocale; } [[nodiscard]] static int __cdecl xalloc() { { ::std:: _Lockit _Lock(2); return _Index++; } } [[nodiscard]] long& iword(int _Idx) { return _Findarr(_Idx)._Lo; } [[nodiscard]] void*& pword(int _Idx) { return _Findarr(_Idx)._Vp; } void register_callback(event_callback _Pfn, int _Idx) { _Calls = new _Fnarray(_Idx, _Pfn, _Calls); } ios_base& copyfmt(const ios_base& _Other) { if (this != ::std:: addressof(_Other)) { _Tidy(); *_Ploc = *_Other._Ploc; _Fmtfl = _Other._Fmtfl; _Prec = _Other._Prec; _Wide = _Other._Wide; _Iosarray* _Ptr = _Other._Arr; for (_Arr = nullptr; _Ptr; _Ptr = _Ptr->_Next) { if (_Ptr->_Lo != 0 || _Ptr->_Vp) { iword(_Ptr->_Index) = _Ptr->_Lo; pword(_Ptr->_Index) = _Ptr->_Vp; } } for (_Fnarray* _Pfa = _Other._Calls; _Pfa; _Pfa = _Pfa->_Next) { register_callback(_Pfa->_Pfn, _Pfa->_Index); } _Callfns(copyfmt_event); exceptions(_Other._Except); } return *this; } static bool __cdecl sync_with_stdio( bool _Newsync = true) { { ::std:: _Lockit _Lock(2); const bool _Oldsync = _Sync; _Sync = _Newsync; return _Oldsync; } } void swap(ios_base& _Right) { if (this != ::std:: addressof(_Right)) { ::std:: swap(_Mystate, _Right._Mystate); ::std:: swap(_Except, _Right._Except); ::std:: swap(_Fmtfl, _Right._Fmtfl); ::std:: swap(_Prec, _Right._Prec); ::std:: swap(_Wide, _Right._Wide); ::std:: swap(_Arr, _Right._Arr); ::std:: swap(_Calls, _Right._Calls); ::std:: swap(_Ploc, _Right._Ploc); } } virtual ~ios_base() noexcept { _Ios_base_dtor(this); } static void __cdecl _Addstd(ios_base*); size_t _Stdstr{0}; protected: ios_base() {} void _Init() { _Ploc = nullptr; _Stdstr = 0; _Except = goodbit; _Fmtfl = skipws | dec; _Prec = 6; _Wide = 0; _Arr = nullptr; _Calls = nullptr; clear(goodbit); _Ploc = new locale; } private: struct _Iosarray : _Crt_new_delete { public: _Iosarray(int _Idx, _Iosarray* _Link) : _Next(_Link), _Index(_Idx), _Lo(0), _Vp(nullptr) {} _Iosarray* _Next; int _Index; long _Lo; void* _Vp; }; struct _Fnarray : _Crt_new_delete { _Fnarray(int _Idx, event_callback _Pnew, _Fnarray* _Link) : _Next(_Link), _Index(_Idx), _Pfn(_Pnew) {} _Fnarray* _Next; int _Index; event_callback _Pfn; }; void _Callfns(event _Ev) { for (_Fnarray* _Pfa = _Calls; _Pfa; _Pfa = _Pfa->_Next) { (*_Pfa->_Pfn)(_Ev, *this, _Pfa->_Index); } } _Iosarray& _Findarr(int _Idx) { _Iosarray* _Ptr1; _Iosarray* _Ptr2; for (_Ptr1 = _Arr, _Ptr2 = nullptr; _Ptr1; _Ptr1 = _Ptr1->_Next) { if (_Ptr1->_Index == _Idx) { return *_Ptr1; } else if (!_Ptr2 && _Ptr1->_Lo == 0 && !_Ptr1->_Vp) { _Ptr2 = _Ptr1; } } if (_Ptr2) { _Ptr2->_Index = _Idx; return *_Ptr2; } _Arr = new _Iosarray(_Idx, _Arr); return *_Arr; } void _Tidy() noexcept { _Callfns(erase_event); _Iosarray* _Ptr1; _Iosarray* _Ptr2; for (_Ptr1 = _Arr; _Ptr1; _Ptr1 = _Ptr2) { _Ptr2 = _Ptr1->_Next; delete _Ptr1; } _Arr = nullptr; _Fnarray* _Pfa1; _Fnarray* _Pfa2; for (_Pfa1 = _Calls; _Pfa1; _Pfa1 = _Pfa2) { _Pfa2 = _Pfa1->_Next; delete _Pfa1; } _Calls = nullptr; } iostate _Mystate; iostate _Except; fmtflags _Fmtfl; streamsize _Prec; streamsize _Wide; _Iosarray* _Arr{nullptr}; _Fnarray* _Calls{nullptr}; locale* _Ploc{nullptr}; static int _Index; static bool _Sync; static void __cdecl _Ios_base_dtor(ios_base*); public: ios_base(const ios_base&) = delete; ios_base& operator=(const ios_base&) = delete; }; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { template <class _Elem, class _Traits> class basic_streambuf { protected: basic_streambuf() : _Plocale(new locale) { _Init(); } basic_streambuf(_Uninitialized) {} basic_streambuf(const basic_streambuf& _Right) : _Plocale(new locale(_Right.getloc())) { _Init(); setp(_Right.pbase(), _Right.pptr(), _Right.epptr()); setg(_Right.eback(), _Right.gptr(), _Right.egptr()); } basic_streambuf& operator=(const basic_streambuf& _Right) { if (this != ::std:: addressof(_Right)) { setp(_Right.pbase(), _Right.pptr(), _Right.epptr()); setg(_Right.eback(), _Right.gptr(), _Right.egptr()); pubimbue(_Right.getloc()); } return *this; } void swap(basic_streambuf& _Right) { if (this != ::std:: addressof(_Right)) { _Elem* _Pfirst0 = pbase(); _Elem* _Pnext0 = pptr(); _Elem* _Pend = epptr(); _Elem* _Gfirst0 = eback(); _Elem* _Gnext0 = gptr(); _Elem* _Gend = egptr(); setp(_Right.pbase(), _Right.pptr(), _Right.epptr()); _Right.setp(_Pfirst0, _Pnext0, _Pend); setg(_Right.eback(), _Right.gptr(), _Right.egptr()); _Right.setg(_Gfirst0, _Gnext0, _Gend); ::std:: swap(_Plocale, _Right._Plocale); } } public: using char_type = _Elem; using traits_type = _Traits; virtual ~basic_streambuf() noexcept { delete _Plocale; } using int_type = typename _Traits::int_type; using pos_type = typename _Traits::pos_type; using off_type = typename _Traits::off_type; pos_type pubseekoff(off_type _Off, ios_base::seekdir _Way, ios_base::openmode _Mode = ios_base::in | ios_base::out) { return seekoff(_Off, _Way, _Mode); } pos_type pubseekpos(pos_type _Pos, ios_base::openmode _Mode = ios_base::in | ios_base::out) { return seekpos(_Pos, _Mode); } basic_streambuf* pubsetbuf(_Elem* _Buffer, streamsize _Count) { return setbuf(_Buffer, _Count); } locale pubimbue(const locale& _Newlocale) { locale _Oldlocale = *_Plocale; imbue(_Newlocale); *_Plocale = _Newlocale; return _Oldlocale; } locale getloc() const { return *_Plocale; } streamsize in_avail() { streamsize _Res = _Gnavail(); return 0 < _Res ? _Res : showmanyc(); } int pubsync() { return sync(); } int_type sbumpc() { return 0 < _Gnavail() ? _Traits::to_int_type(*_Gninc()) : uflow(); } int_type sgetc() { return 0 < _Gnavail() ? _Traits::to_int_type(*gptr()) : underflow(); } streamsize sgetn(_Elem* _Ptr, streamsize _Count) { return xsgetn(_Ptr, _Count); } int_type snextc() { return 1 < _Gnavail() ? _Traits::to_int_type(*_Gnpreinc()) : _Traits::eq_int_type(_Traits::eof(), sbumpc()) ? _Traits::eof() : sgetc(); } int_type sputbackc(_Elem _Ch) { if (gptr() && eback() < gptr() && _Traits::eq(_Ch, gptr()[-1])) { return _Traits::to_int_type(*_Gndec()); } return pbackfail(_Traits::to_int_type(_Ch)); } int_type sungetc() { return gptr() && eback() < gptr() ? _Traits::to_int_type(*_Gndec()) : pbackfail(); } int_type sputc(_Elem _Ch) { return 0 < _Pnavail() ? _Traits::to_int_type(*_Pninc() = _Ch) : overflow(_Traits::to_int_type(_Ch)); } streamsize sputn(const _Elem* _Ptr, streamsize _Count) { return xsputn(_Ptr, _Count); } virtual void _Lock() {} virtual void _Unlock() {} protected: _Elem* eback() const { return *_IGfirst; } _Elem* gptr() const { return *_IGnext; } _Elem* pbase() const { return *_IPfirst; } _Elem* pptr() const { return *_IPnext; } _Elem* egptr() const { return *_IGnext + *_IGcount; } void gbump(int _Off) { *_IGcount -= _Off; *_IGnext += _Off; } void setg(_Elem* _First, _Elem* _Next, _Elem* _Last) { *_IGfirst = _First; *_IGnext = _Next; *_IGcount = static_cast<int>(_Last - _Next); } _Elem* epptr() const { return *_IPnext + *_IPcount; } _Elem* _Gndec() { ++*_IGcount; return --*_IGnext; } _Elem* _Gninc() { --*_IGcount; return (*_IGnext)++; } _Elem* _Gnpreinc() { --*_IGcount; return ++(*_IGnext); } streamsize _Gnavail() const { return *_IGnext ? *_IGcount : 0; } void pbump(int _Off) { *_IPcount -= _Off; *_IPnext += _Off; } void setp(_Elem* _First, _Elem* _Last) { *_IPfirst = _First; *_IPnext = _First; *_IPcount = static_cast<int>(_Last - _First); } void setp( _Elem* _First, _Elem* _Next, _Elem* _Last) { *_IPfirst = _First; *_IPnext = _Next; *_IPcount = static_cast<int>(_Last - _Next); } _Elem* _Pninc() { --*_IPcount; return (*_IPnext)++; } streamsize _Pnavail() const { return *_IPnext ? *_IPcount : 0; } void _Init() { _IGfirst = &_Gfirst; _IPfirst = &_Pfirst; _IGnext = &_Gnext; _IPnext = &_Pnext; _IGcount = &_Gcount; _IPcount = &_Pcount; setp(nullptr, nullptr); setg(nullptr, nullptr, nullptr); } void _Init(_Elem** _Gf, _Elem** _Gn, int* _Gc, _Elem** _Pf, _Elem** _Pn, int* _Pc) { _IGfirst = _Gf; _IPfirst = _Pf; _IGnext = _Gn; _IPnext = _Pn; _IGcount = _Gc; _IPcount = _Pc; } virtual int_type overflow(int_type = _Traits::eof()) { return _Traits::eof(); } virtual int_type pbackfail(int_type = _Traits::eof()) { return _Traits::eof(); } virtual streamsize showmanyc() { return 0; } virtual int_type underflow() { return _Traits::eof(); } virtual int_type uflow() { return _Traits::eq_int_type(_Traits::eof(), underflow()) ? _Traits::eof() : _Traits::to_int_type(*_Gninc()); } virtual streamsize xsgetn(_Elem* _Ptr, streamsize _Count) { const streamsize _Start_count = _Count; while (0 < _Count) { streamsize _Size = _Gnavail(); if (0 < _Size) { if (_Count < _Size) { _Size = _Count; } _Traits::copy(_Ptr, gptr(), static_cast<size_t>(_Size)); _Ptr += _Size; _Count -= _Size; gbump(static_cast<int>(_Size)); } else { const int_type _Meta = uflow(); if (_Traits::eq_int_type(_Traits::eof(), _Meta)) { break; } *_Ptr++ = _Traits::to_char_type(_Meta); --_Count; } } return _Start_count - _Count; } virtual streamsize xsputn(const _Elem* _Ptr, streamsize _Count) { const streamsize _Start_count = _Count; while (0 < _Count) { streamsize _Size = _Pnavail(); if (0 < _Size) { if (_Count < _Size) { _Size = _Count; } _Traits::copy(pptr(), _Ptr, static_cast<size_t>(_Size)); _Ptr += _Size; _Count -= _Size; pbump(static_cast<int>(_Size)); } else if (_Traits::eq_int_type(_Traits::eof(), overflow(_Traits::to_int_type(*_Ptr)))) { break; } else { ++_Ptr; --_Count; } } return _Start_count - _Count; } virtual pos_type seekoff( off_type, ios_base::seekdir, ios_base::openmode = ios_base::in | ios_base::out) { return streampos(-1); } virtual pos_type seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out) { return streampos(-1); } virtual basic_streambuf* setbuf(_Elem*, streamsize) { return this; } virtual int sync() { return 0; } virtual void imbue(const locale&) {} private: _Elem* _Gfirst; _Elem* _Pfirst; _Elem** _IGfirst; _Elem** _IPfirst; _Elem* _Gnext; _Elem* _Pnext; _Elem** _IGnext; _Elem** _IPnext; int _Gcount; int _Pcount; int* _IGcount; int* _IPcount; protected: locale* _Plocale; }; template class __declspec(dllimport) basic_streambuf<char, char_traits<char>>; template class __declspec(dllimport) basic_streambuf<wchar_t, char_traits<wchar_t>>; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) extern "C" { extern float __cdecl _Stofx( const char*, char**, long, int*); extern double __cdecl _Stodx( const char*, char**, long, int*); extern long double __cdecl _Stoldx( const char*, char**, long, int*); extern long __cdecl _Stolx( const char*, char**, int, int*); extern unsigned long __cdecl _Stoulx( const char*, char**, int, int*); extern long long __cdecl _Stollx( const char*, char**, int, int*); extern unsigned long long __cdecl _Stoullx( const char*, char**, int, int*); } namespace std { inline double _Stodx_v2(const char* _Str, char** _Endptr, int _Pten, int* _Perr) { int& _Errno_ref = (*_errno()); const int _Orig = _Errno_ref; _Errno_ref = 0; double _Val = :: strtod(_Str, _Endptr); *_Perr = _Errno_ref; _Errno_ref = _Orig; if (_Pten != 0) { _Val *= :: pow(10.0, static_cast<double>(_Pten)); } return _Val; } inline float _Stofx_v2(const char* _Str, char** _Endptr, int _Pten, int* _Perr) { int& _Errno_ref = (*_errno()); const int _Orig = _Errno_ref; _Errno_ref = 0; float _Val = :: strtof(_Str, _Endptr); *_Perr = _Errno_ref; _Errno_ref = _Orig; if (_Pten != 0) { _Val *= :: powf(10.0f, static_cast<float>(_Pten)); } return _Val; } template <class _Elem, size_t _Base_size> size_t _Find_elem(const _Elem (&_Base)[_Base_size], const _Elem _Ch) { return static_cast<size_t>(_Find_unchecked(_Base, _Base + (_Base_size - 1), _Ch) - _Base); } inline wchar_t* _Maklocwcs(const wchar_t* _Ptr) { const size_t _Count = :: wcslen(_Ptr) + 1; wchar_t* _Ptrdest = static_cast<wchar_t*>(_calloc_dbg(_Count, sizeof(wchar_t), 2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\xlocnum", 93)); if (!_Ptrdest) { _Xbad_alloc(); } :: wmemcpy(_Ptrdest, _Ptr, _Count); return _Ptrdest; } template <class _Elem> class numpunct : public locale::facet { private: friend _Tidy_guard<numpunct>; public: static_assert(!0 || _Is_any_of_v<_Elem, char, wchar_t, unsigned short>, "Unsupported facet specialization; see N4800 27.3.1.1.1 [locale.category]. " "Either use a Standard specialization or define _ENFORCE_FACET_SPECIALIZATIONS=0 " "to suppress this diagnostic."); using string_type = basic_string<_Elem, char_traits<_Elem>, allocator<_Elem>>; using char_type = _Elem; __declspec(dllimport) static locale::id id; _Elem decimal_point() const { return do_decimal_point(); } _Elem thousands_sep() const { return do_thousands_sep(); } string grouping() const { return do_grouping(); } string_type falsename() const { return do_falsename(); } string_type truename() const { return do_truename(); } explicit numpunct(size_t _Refs = 0) : locale::facet(_Refs) { { _Locinfo _Lobj; _Init(_Lobj); if (_Kseparator == 0) { _Kseparator = _Maklocchr(',', static_cast<_Elem*>(nullptr), _Lobj._Getcvt()); } } } numpunct(const _Locinfo& _Lobj, size_t _Refs = 0, bool _Isdef = false) : locale::facet(_Refs) { _Init(_Lobj, _Isdef); } static size_t _Getcat(const locale::facet** _Ppf = nullptr, const locale* _Ploc = nullptr) { if (_Ppf && !*_Ppf) { *_Ppf = new numpunct<_Elem>(_Locinfo(_Ploc->c_str()), 0, true); } return 4; } protected: virtual ~numpunct() noexcept { _Tidy(); } numpunct(const char* _Locname, size_t _Refs = 0, bool _Isdef = false) : locale::facet(_Refs) { { _Locinfo _Lobj(_Locname); _Init(_Lobj, _Isdef); } } template <class _Elem2> void _Getvals(_Elem2, const lconv* _Ptr, _Locinfo::_Cvtvec _Cvt) { _Dp = _Maklocchr(_Ptr->decimal_point[0], static_cast<_Elem2*>(nullptr), _Cvt); _Kseparator = _Maklocchr(_Ptr->thousands_sep[0], static_cast<_Elem2*>(nullptr), _Cvt); } void _Getvals(wchar_t, const lconv* _Ptr, _Locinfo::_Cvtvec) { _Dp = static_cast<_Elem>(_Ptr->_W_decimal_point[0]); _Kseparator = static_cast<_Elem>(_Ptr->_W_thousands_sep[0]); } void _Init(const _Locinfo& _Lobj, bool _Isdef = false) { const lconv* _Ptr = _Lobj._Getlconv(); _Locinfo::_Cvtvec _Cvt = _Lobj._Getcvt(); _Grouping = nullptr; _Falsename = nullptr; _Truename = nullptr; _Tidy_guard<numpunct> _Guard{this}; _Grouping = _Maklocstr(_Isdef ? "" : _Ptr->grouping, static_cast<char*>(nullptr), _Lobj._Getcvt()); _Falsename = _Maklocstr(_Lobj._Getfalse(), static_cast<_Elem*>(nullptr), _Cvt); _Truename = _Maklocstr(_Lobj._Gettrue(), static_cast<_Elem*>(nullptr), _Cvt); _Guard._Target = nullptr; if (_Isdef) { _Dp = _Maklocchr('.', static_cast<_Elem*>(nullptr), _Cvt); _Kseparator = _Maklocchr(',', static_cast<_Elem*>(nullptr), _Cvt); } else { _Getvals(_Elem{}, _Ptr, _Cvt); } } virtual _Elem do_decimal_point() const { return _Dp; } virtual _Elem do_thousands_sep() const { return _Kseparator; } virtual string do_grouping() const { return string(_Grouping); } virtual string_type do_falsename() const { return string_type(_Falsename); } virtual string_type do_truename() const { return string_type(_Truename); } private: void _Tidy() noexcept { :: free(const_cast<char*>(_Grouping)); :: free(const_cast<_Elem*>(_Falsename)); :: free(const_cast<_Elem*>(_Truename)); } const char* _Grouping; _Elem _Dp; _Elem _Kseparator; const _Elem* _Falsename; const _Elem* _Truename; }; template <class _Elem> class numpunct_byname : public numpunct<_Elem> { public: static_assert(!0 || _Is_any_of_v<_Elem, char, wchar_t>, "Unsupported facet specialization; see N4800 27.3.1.1.1 [locale.category]. " "Either use a Standard specialization or define _ENFORCE_FACET_SPECIALIZATIONS=0 " "to suppress this diagnostic."); explicit numpunct_byname(const char* _Locname, size_t _Refs = 0) : numpunct<_Elem>(_Locname, _Refs) {} explicit numpunct_byname(const string& _Str, size_t _Refs = 0) : numpunct<_Elem>(_Str.c_str(), _Refs) {} protected: virtual ~numpunct_byname() noexcept {} }; template <class _Elem> locale::id numpunct<_Elem>::id; template <class _Elem, class _InIt = istreambuf_iterator<_Elem, char_traits<_Elem>>> class num_get : public locale::facet { public: static_assert(!0 || _Is_any_of_v<_Elem, char, wchar_t, unsigned short>, "Unsupported facet specialization; see N4800 27.3.1.1.1 [locale.category]. " "Either use a Standard specialization or define _ENFORCE_FACET_SPECIALIZATIONS=0 " "to suppress this diagnostic."); static size_t __cdecl _Getcat(const locale::facet** _Ppf = nullptr, const locale* _Ploc = nullptr) { if (_Ppf && !*_Ppf) { *_Ppf = new num_get<_Elem, _InIt>(_Locinfo(_Ploc->c_str())); } return 4; } static locale::id id; protected: virtual ~num_get() noexcept {} void _Init(const _Locinfo&) {} public: explicit num_get(size_t _Refs = 0) : locale::facet(_Refs) { { _Locinfo _Lobj; _Init(_Lobj); } } num_get(const _Locinfo& _Lobj, size_t _Refs = 0) : locale::facet(_Refs) { _Init(_Lobj); } using char_type = _Elem; using iter_type = _InIt; _InIt get(_InIt _First, _InIt _Last, ios_base& _Iosbase, ios_base::iostate& _State, bool& _Val) const { return do_get(_First, _Last, _Iosbase, _State, _Val); } _InIt get(_InIt _First, _InIt _Last, ios_base& _Iosbase, ios_base::iostate& _State, unsigned short& _Val) const { return do_get(_First, _Last, _Iosbase, _State, _Val); } _InIt get(_InIt _First, _InIt _Last, ios_base& _Iosbase, ios_base::iostate& _State, unsigned int& _Val) const { return do_get(_First, _Last, _Iosbase, _State, _Val); } _InIt get(_InIt _First, _InIt _Last, ios_base& _Iosbase, ios_base::iostate& _State, long& _Val) const { return do_get(_First, _Last, _Iosbase, _State, _Val); } _InIt get(_InIt _First, _InIt _Last, ios_base& _Iosbase, ios_base::iostate& _State, unsigned long& _Val) const { return do_get(_First, _Last, _Iosbase, _State, _Val); } _InIt get(_InIt _First, _InIt _Last, ios_base& _Iosbase, ios_base::iostate& _State, long long& _Val) const { return do_get(_First, _Last, _Iosbase, _State, _Val); } _InIt get(_InIt _First, _InIt _Last, ios_base& _Iosbase, ios_base::iostate& _State, unsigned long long& _Val) const { return do_get(_First, _Last, _Iosbase, _State, _Val); } _InIt get(_InIt _First, _InIt _Last, ios_base& _Iosbase, ios_base::iostate& _State, float& _Val) const { return do_get(_First, _Last, _Iosbase, _State, _Val); } _InIt get(_InIt _First, _InIt _Last, ios_base& _Iosbase, ios_base::iostate& _State, double& _Val) const { return do_get(_First, _Last, _Iosbase, _State, _Val); } _InIt get(_InIt _First, _InIt _Last, ios_base& _Iosbase, ios_base::iostate& _State, long double& _Val) const { return do_get(_First, _Last, _Iosbase, _State, _Val); } _InIt get(_InIt _First, _InIt _Last, ios_base& _Iosbase, ios_base::iostate& _State, void*& _Val) const { return do_get(_First, _Last, _Iosbase, _State, _Val); } protected: virtual _InIt do_get(_InIt _First, _InIt _Last, ios_base& _Iosbase, ios_base::iostate& _State, bool& _Val) const { _Adl_verify_range(_First, _Last); if (_Iosbase.flags() & ios_base::boolalpha) { const auto& _Punct_fac = ::std:: use_facet<numpunct<_Elem>>(_Iosbase.getloc()); basic_string<_Elem> _Str(static_cast<size_t>(1), _Elem{}); _Str += _Punct_fac.falsename(); _Str.push_back(_Elem{}); _Str += _Punct_fac.truename(); switch (_Getloctxt(_First, _Last, 2, _Str.c_str(), _Case_sensitive::_Yes)) { case 0: _Val = false; break; case 1: _Val = true; break; default: _Val = false; _State = ios_base::failbit; break; } } else { char _Ac[32]; const int _Base = _Getifld(_Ac, _First, _Last, _Iosbase.flags(), _Iosbase.getloc()); if (_Ac[0] == '\0') { _Val = false; _State = ios_base::failbit; } else { char* _Ep; int _Errno; const long _Ans = :: _Stolx(_Ac, &_Ep, _Base, &_Errno); if (_Ep == _Ac || _Errno != 0) { _Val = true; _State = ios_base::failbit; } else { _Val = _Ans != 0; if (_Ans != 0 && _Ans != 1) { _State = ios_base::failbit; } } } } if (_First == _Last) { _State |= ios_base::eofbit; } return _First; } virtual _InIt do_get(_InIt _First, _InIt _Last, ios_base& _Iosbase, ios_base::iostate& _State, unsigned short& _Val) const { _Adl_verify_range(_First, _Last); char _Ac[32]; const int _Base = _Getifld(_Ac, _First, _Last, _Iosbase.flags(), _Iosbase.getloc()); if (_Ac[0] == '\0') { _State = ios_base::failbit; _Val = 0; } else { const bool _Minus = _Ac[0] == '-'; const char* _Digits = _Ac; if (_Minus) { ++_Digits; } char* _Ep; int _Errno; const unsigned long _Tmp = :: _Stoulx(_Digits, &_Ep, _Base, &_Errno); _Val = static_cast<unsigned short>(_Tmp); if (_Ep == _Digits || _Errno != 0 || _Tmp > 0xffff) { _State = ios_base::failbit; _Val = 0xffff; } else if (_Minus) { _Val = static_cast<unsigned short>(0 - _Val); } } if (_First == _Last) { _State |= ios_base::eofbit; } return _First; } virtual _InIt do_get(_InIt _First, _InIt _Last, ios_base& _Iosbase, ios_base::iostate& _State, unsigned int& _Val) const { static_assert(sizeof(unsigned int) == sizeof(unsigned long), "Bad overflow assumptions due to sizeof(unsigned int) != sizeof(unsigned long)"); unsigned long _Tmp; _First = num_get::do_get(_First, _Last, _Iosbase, _State, _Tmp); _Val = _Tmp; return _First; } virtual _InIt do_get(_InIt _First, _InIt _Last, ios_base& _Iosbase, ios_base::iostate& _State, long& _Val) const { _Adl_verify_range(_First, _Last); char _Ac[32]; const int _Base = _Getifld(_Ac, _First, _Last, _Iosbase.flags(), _Iosbase.getloc()); if (_Ac[0] == '\0') { _State = ios_base::failbit; _Val = 0; } else { char* _Ep; int _Errno; _Val = :: _Stolx(_Ac, &_Ep, _Base, &_Errno); if (_Ep == _Ac || _Errno != 0) { _State = ios_base::failbit; } } if (_First == _Last) { _State |= ios_base::eofbit; } return _First; } virtual _InIt do_get(_InIt _First, _InIt _Last, ios_base& _Iosbase, ios_base::iostate& _State, unsigned long& _Val) const { _Adl_verify_range(_First, _Last); char _Ac[32]; const int _Base = _Getifld(_Ac, _First, _Last, _Iosbase.flags(), _Iosbase.getloc()); if (_Ac[0] == '\0') { _State = ios_base::failbit; _Val = 0; } else { char* _Ep; int _Errno; _Val = :: _Stoulx(_Ac, &_Ep, _Base, &_Errno); if (_Ep == _Ac || _Errno != 0) { _State = ios_base::failbit; } } if (_First == _Last) { _State |= ios_base::eofbit; } return _First; } virtual _InIt do_get(_InIt _First, _InIt _Last, ios_base& _Iosbase, ios_base::iostate& _State, long long& _Val) const { _Adl_verify_range(_First, _Last); char _Ac[32]; const int _Base = _Getifld(_Ac, _First, _Last, _Iosbase.flags(), _Iosbase.getloc()); if (_Ac[0] == '\0') { _State = ios_base::failbit; _Val = 0; } else { char* _Ep; int _Errno; _Val = :: _Stollx(_Ac, &_Ep, _Base, &_Errno); if (_Ep == _Ac || _Errno != 0) { _State = ios_base::failbit; } } if (_First == _Last) { _State |= ios_base::eofbit; } return _First; } virtual _InIt do_get(_InIt _First, _InIt _Last, ios_base& _Iosbase, ios_base::iostate& _State, unsigned long long& _Val) const { _Adl_verify_range(_First, _Last); char _Ac[32]; const int _Base = _Getifld(_Ac, _First, _Last, _Iosbase.flags(), _Iosbase.getloc()); if (_Ac[0] == '\0') { _State = ios_base::failbit; _Val = 0; } else { int _Errno; char* _Ep; _Val = :: _Stoullx(_Ac, &_Ep, _Base, &_Errno); if (_Ep == _Ac || _Errno != 0) { _State = ios_base::failbit; } } if (_First == _Last) { _State |= ios_base::eofbit; } return _First; } virtual _InIt do_get(_InIt _First, _InIt _Last, ios_base& _Iosbase, ios_base::iostate& _State, float& _Val) const { _Adl_verify_range(_First, _Last); char _Ac[(8 + 768 + 16)]; int _Hexexp = 1000000000; const int _Base = _Getffld(_Ac, _First, _Last, _Iosbase, &_Hexexp); if (_Ac[0] == '\0') { _State = ios_base::failbit; _Val = 0.0f; } else { int _Errno; char* _Ep; _Val = _Stofx_v2(_Ac, &_Ep, _Base, &_Errno); if (_Ep == _Ac || _Errno != 0) { _State = ios_base::failbit; _Val = 0.0f; } else if (_Hexexp != 1000000000 && _Hexexp != 0) { _Val = :: ldexpf(_Val, 4 * _Hexexp); } } if (_First == _Last) { _State |= ios_base::eofbit; } return _First; } virtual _InIt do_get(_InIt _First, _InIt _Last, ios_base& _Iosbase, ios_base::iostate& _State, double& _Val) const { _Adl_verify_range(_First, _Last); char _Ac[(8 + 768 + 16)]; int _Hexexp = 1000000000; const int _Base = _Getffld(_Ac, _First, _Last, _Iosbase, &_Hexexp); if (_Ac[0] == '\0') { _State = ios_base::failbit; _Val = 0.0; } else { int _Errno; char* _Ep; _Val = _Stodx_v2(_Ac, &_Ep, _Base, &_Errno); if (_Ep == _Ac || _Errno != 0) { _State = ios_base::failbit; _Val = 0.0; } else if (_Hexexp != 1000000000 && _Hexexp != 0) { _Val = :: ldexp(_Val, 4 * _Hexexp); } } if (_First == _Last) { _State |= ios_base::eofbit; } return _First; } virtual _InIt do_get(_InIt _First, _InIt _Last, ios_base& _Iosbase, ios_base::iostate& _State, long double& _Val) const { static_assert(sizeof(double) == sizeof(long double), "Bad assumption: sizeof(double) == sizeof(long double)."); double _Result; _First = num_get::do_get(_First, _Last, _Iosbase, _State, _Result); _Val = _Result; return _First; } virtual _InIt do_get(_InIt _First, _InIt _Last, ios_base& _Iosbase, ios_base::iostate& _State, void*& _Val) const { _Adl_verify_range(_First, _Last); char _Ac[32]; const int _Base = _Getifld(_Ac, _First, _Last, ios_base::hex, _Iosbase.getloc()); if (_Ac[0] == '\0') { _State = ios_base::failbit; _Val = nullptr; } else { int _Errno; char* _Ep; _Val = reinterpret_cast<void*>(:: _Stoullx(_Ac, &_Ep, _Base, &_Errno)); if (_Ep == _Ac || _Errno != 0) { _State = ios_base::failbit; _Val = nullptr; } } if (_First == _Last) { _State |= ios_base::eofbit; } return _First; } private: int __cdecl _Getifld(char* _Ac, _InIt& _First, _InIt& _Last, ios_base::fmtflags _Basefield, const locale& _Loc) const { const auto& _Punct_fac = ::std:: use_facet<numpunct<_Elem>>(_Loc); const string _Grouping = _Punct_fac.grouping(); const _Elem _Kseparator = _Grouping.size() == 0 ? _Elem{} : _Punct_fac.thousands_sep(); constexpr int _Numget_signoff = 22; constexpr int _Numget_xoff = 24; static constexpr char _Src[] = "0123456789ABCDEFabcdef-+Xx"; _Elem _Atoms[sizeof(_Src)]; const ctype<_Elem>& _Ctype_fac = ::std:: use_facet<ctype<_Elem>>(_Loc); _Ctype_fac.widen(::std:: begin(_Src), ::std:: end(_Src), _Atoms); char* _Ptr = _Ac; if (_First != _Last) { if (*_First == _Atoms[_Numget_signoff + 1]) { *_Ptr++ = '+'; ++_First; } else if (*_First == _Atoms[_Numget_signoff]) { *_Ptr++ = '-'; ++_First; } } _Basefield &= ios_base::basefield; int _Base; if (_Basefield == ios_base::oct) { _Base = 8; } else if (_Basefield == ios_base::hex) { _Base = 16; } else if (_Basefield == ios_base::_Fmtzero) { _Base = 0; } else { _Base = 10; } bool _Seendigit = false; bool _Nonzero = false; if (_First != _Last && *_First == _Atoms[0]) { _Seendigit = true; ++_First; if (_First != _Last && (*_First == _Atoms[_Numget_xoff + 1] || *_First == _Atoms[_Numget_xoff]) && (_Base == 0 || _Base == 16)) { _Base = 16; _Seendigit = false; ++_First; } else if (_Base == 0) { _Base = 8; } } const auto _Dlen = static_cast<size_t>(_Base == 0 || _Base == 10 ? 10 : _Base == 8 ? 8 : 16 + 6); string _Groups(1, static_cast<char>(_Seendigit)); size_t _Group = 0; for (char* const _Pe = &_Ac[32 - 1]; _First != _Last; ++_First) { size_t _Idx = _Find_elem(_Atoms, *_First); if (_Idx < _Dlen) { *_Ptr = _Src[_Idx]; if ((_Nonzero || *_Ptr != '0') && _Ptr < _Pe) { ++_Ptr; _Nonzero = true; } _Seendigit = true; if (_Groups[_Group] != 127) { ++_Groups[_Group]; } } else if (_Groups[_Group] == '\0' || _Kseparator == _Elem{} || *_First != _Kseparator) { break; } else { _Groups.push_back('\0'); ++_Group; } } if (_Group != 0) { if ('\0' < _Groups[_Group]) { ++_Group; } else { _Seendigit = false; } } for (const char* _Pg = &_Grouping[0]; _Seendigit && 0 < _Group;) { if (*_Pg == 127) { break; } else if ((0 < --_Group && *_Pg != _Groups[_Group]) || (0 == _Group && *_Pg < _Groups[_Group])) { _Seendigit = false; } else if ('\0' < _Pg[1]) { ++_Pg; } } if (_Seendigit && !_Nonzero) { *_Ptr++ = '0'; } else if (!_Seendigit) { _Ptr = _Ac; } *_Ptr = '\0'; return _Base; } int __cdecl _Getffld(char* _Ac, _InIt& _First, _InIt& _Last, ios_base& _Iosbase, int* _Phexexp) const { if ((_Iosbase.flags() & ios_base::floatfield) == ios_base::hexfloat) { return _Getffldx(_Ac, _First, _Last, _Iosbase, _Phexexp); } const auto& _Punct_fac = ::std:: use_facet<numpunct<_Elem>>(_Iosbase.getloc()); const string _Grouping = _Punct_fac.grouping(); char* _Ptr = _Ac; bool _Bad = false; bool _Sticky = false; constexpr int _Numget_signoff = 10; constexpr int _Numget_eoff = 12; static constexpr char _Src[] = "0123456789-+Ee"; _Elem _Atoms[sizeof(_Src)]; const ctype<_Elem>& _Ctype_fac = ::std:: use_facet<ctype<_Elem>>(_Iosbase.getloc()); _Ctype_fac.widen(::std:: begin(_Src), ::std:: end(_Src), _Atoms); if (_First != _Last) { if (*_First == _Atoms[_Numget_signoff + 1]) { *_Ptr++ = '+'; ++_First; } else if (*_First == _Atoms[_Numget_signoff]) { *_Ptr++ = '-'; ++_First; } } char* _Leading = _Ptr; *_Ptr++ = '0'; bool _Seendigit = false; int _Significant = 0; int _Pten = 0; size_t _Idx; const int _Max_sig_dig = (*_Phexexp == 1000000000 ? 768 : 36); const char* _Pg = &_Grouping[0]; if (*_Pg == 127 || *_Pg <= '\0') { for (; _First != _Last && (_Idx = _Find_elem(_Atoms, *_First)) < 10; _Seendigit = true, (void) ++_First) { if (_Max_sig_dig <= _Significant) { ++_Pten; if (0 < _Idx) { _Sticky = true; } } else if (_Idx != 0 || _Significant != 0) { *_Ptr++ = _Src[_Idx]; ++_Significant; } } } else { const _Elem _Kseparator = _Grouping.size() == 0 ? _Elem{} : _Punct_fac.thousands_sep(); string _Groups(1, '\0'); size_t _Group = 0; for (; _First != _Last; ++_First) { if ((_Idx = _Find_elem(_Atoms, *_First)) < 10) { _Seendigit = true; if (_Max_sig_dig <= _Significant) { ++_Pten; if (0 < _Idx) { _Sticky = true; } } else if (_Idx != 0 || _Significant != 0) { *_Ptr++ = _Src[_Idx]; ++_Significant; } if (_Groups[_Group] != 127) { ++_Groups[_Group]; } } else if (_Groups[_Group] == '\0' || _Kseparator == _Elem{} || *_First != _Kseparator) { break; } else { _Groups.push_back('\0'); ++_Group; } } if (_Group != 0) { if ('\0' < _Groups[_Group]) { ++_Group; } else { _Bad = true; } } while (!_Bad && 0 < _Group) { if (*_Pg == 127) { break; } if ((0 < --_Group && *_Pg != _Groups[_Group]) || (0 == _Group && *_Pg < _Groups[_Group])) { _Bad = true; } else if ('\0' < _Pg[1]) { ++_Pg; } } } if (_First != _Last && *_First == _Punct_fac.decimal_point()) { *_Ptr++ = localeconv()->decimal_point[0]; ++_First; } if (*_Phexexp != 1000000000 && _Significant == 0) { for (; _First != _Last && *_First == _Atoms[0]; _Seendigit = true, (void) ++_First) { --_Pten; } if (_Pten < 0) { *_Ptr++ = '0'; ++_Pten; } } for (; _First != _Last && (_Idx = _Find_elem(_Atoms, *_First)) < 10; _Seendigit = true, (void) ++_First) { if (_Significant < _Max_sig_dig) { *_Ptr++ = _Src[_Idx]; ++_Significant; } else if (0 < _Idx) { _Sticky = true; } } if (_Sticky) { char* _Px = _Ptr; while (--_Px != _Leading) { if (*_Px != localeconv()->decimal_point[0]) { if (*_Px != '9') { ++*_Px; break; } *_Px = '0'; } } if (_Px == _Leading) { *_Px = '1'; ++_Pten; } } if (_Seendigit && _First != _Last && (*_First == _Atoms[_Numget_eoff + 1] || *_First == _Atoms[_Numget_eoff])) { *_Ptr++ = 'e'; ++_First; _Seendigit = false; _Significant = 0; if (_First != _Last) { if (*_First == _Atoms[_Numget_signoff + 1]) { *_Ptr++ = '+'; ++_First; } else if (*_First == _Atoms[_Numget_signoff]) { *_Ptr++ = '-'; ++_First; } } for (; _First != _Last && *_First == _Atoms[0]; ++_First) { _Seendigit = true; } if (_Seendigit) { *_Ptr++ = '0'; } for (; _First != _Last && (_Idx = _Find_elem(_Atoms, *_First)) < 10; _Seendigit = true, (void) ++_First) { if (_Significant < 8) { *_Ptr++ = _Src[_Idx]; ++_Significant; } } } if (_Bad || !_Seendigit) { _Ptr = _Ac; } *_Ptr = '\0'; return _Pten; } int __cdecl _Getffldx(char* _Ac, _InIt& _First, _InIt& _Last, ios_base& _Iosbase, int* _Phexexp) const { const auto& _Punct_fac = ::std:: use_facet<numpunct<_Elem>>(_Iosbase.getloc()); const string _Grouping = _Punct_fac.grouping(); constexpr int _Numget_signoff = 22; constexpr int _Numget_xoff = 24; constexpr int _Numget_poff = 26; static constexpr char _Src[] = "0123456789ABCDEFabcdef-+XxPp"; _Elem _Atoms[sizeof(_Src)]; const ctype<_Elem>& _Ctype_fac = ::std:: use_facet<ctype<_Elem>>(_Iosbase.getloc()); _Ctype_fac.widen(::std:: begin(_Src), ::std:: end(_Src), _Atoms); char* _Ptr = _Ac; bool _Bad = false; size_t _Idx; if (_First != _Last) { if (*_First == _Atoms[_Numget_signoff + 1]) { *_Ptr++ = '+'; ++_First; } else if (*_First == _Atoms[_Numget_signoff]) { *_Ptr++ = '-'; ++_First; } } *_Ptr++ = '0'; *_Ptr++ = 'x'; bool _Seendigit = false; int _Significant = 0; int _Phex = 0; if (_First != _Last && *_First == _Atoms[0]) { if (++_First != _Last && (*_First == _Atoms[_Numget_xoff + 1] || *_First == _Atoms[_Numget_xoff])) { ++_First; } else { _Seendigit = true; } } const int _Max_sig_dig = (*_Phexexp == 1000000000 ? 768 : 36); const char* _Pg = &_Grouping[0]; if (*_Pg == 127 || *_Pg <= '\0') { for (; _First != _Last && (_Idx = _Find_elem(_Atoms, *_First)) < _Numget_signoff; _Seendigit = true, (void) ++_First) { if (_Max_sig_dig <= _Significant) { ++_Phex; } else if (_Idx != 0 || _Significant != 0) { *_Ptr++ = _Src[_Idx]; ++_Significant; } } } else { const _Elem _Kseparator = _Grouping.size() == 0 ? _Elem{} : _Punct_fac.thousands_sep(); string _Groups(1, '\0'); size_t _Group = 0; for (; _First != _Last; ++_First) { if ((_Idx = _Find_elem(_Atoms, *_First)) < _Numget_signoff) { _Seendigit = true; if (_Max_sig_dig <= _Significant) { ++_Phex; } else if (_Idx != 0 || _Significant != 0) { *_Ptr++ = _Src[_Idx]; ++_Significant; } if (_Groups[_Group] != 127) { ++_Groups[_Group]; } } else if (_Groups[_Group] == '\0' || _Kseparator == _Elem{} || *_First != _Kseparator) { break; } else { _Groups.push_back('\0'); ++_Group; } } if (_Group != 0) { if ('\0' < _Groups[_Group]) { ++_Group; } else { _Bad = true; } } while (!_Bad && 0 < _Group) { if (*_Pg == 127) { break; } if ((0 < --_Group && *_Pg != _Groups[_Group]) || (0 == _Group && *_Pg < _Groups[_Group])) { _Bad = true; } else if ('\0' < _Pg[1]) { ++_Pg; } } } if (_Seendigit && _Significant == 0) { *_Ptr++ = '0'; } if (_First != _Last && *_First == _Punct_fac.decimal_point()) { *_Ptr++ = localeconv()->decimal_point[0]; ++_First; } if (_Significant == 0) { for (; _First != _Last && *_First == _Atoms[0]; _Seendigit = true, (void) ++_First) { --_Phex; } if (_Phex < 0) { *_Ptr++ = '0'; ++_Phex; } } for (; _First != _Last && (_Idx = _Find_elem(_Atoms, *_First)) < _Numget_signoff; _Seendigit = true, (void) ++_First) { if (_Significant < _Max_sig_dig) { *_Ptr++ = _Src[_Idx]; ++_Significant; } } if (_Seendigit && _First != _Last && (*_First == _Atoms[_Numget_poff + 1] || *_First == _Atoms[_Numget_poff])) { *_Ptr++ = 'p'; ++_First; _Seendigit = false; _Significant = 0; if (_First != _Last) { if (*_First == _Atoms[_Numget_signoff + 1]) { *_Ptr++ = '+'; ++_First; } else if (*_First == _Atoms[_Numget_signoff]) { *_Ptr++ = '-'; ++_First; } } for (; _First != _Last && *_First == _Atoms[0]; ++_First) { _Seendigit = true; } if (_Seendigit) { *_Ptr++ = '0'; } for (; _First != _Last && (_Idx = _Find_elem(_Atoms, *_First)) < _Numget_signoff; _Seendigit = true, (void) ++_First) { if (_Significant < 8) { *_Ptr++ = _Src[_Idx]; ++_Significant; } } } if (_Bad || !_Seendigit) { _Ptr = _Ac; } *_Ptr = '\0'; *_Phexexp = _Phex; return 0; } }; template <class _Elem, class _InIt> locale::id num_get<_Elem, _InIt>::id; template <class _Ty> struct _Hex_float_precision; template <> struct _Hex_float_precision<double> { static constexpr int value = ((53 - 1) + 3) / 4; }; template <> struct _Hex_float_precision<long double> { static constexpr int value = ((53 - 1) + 3) / 4; }; template <class _Ty> int _Float_put_desired_precision(const streamsize _Precision, const ios_base::fmtflags _Float_flags) { const bool _Is_hex = _Float_flags == (ios_base::fixed | ios_base::scientific); if (_Is_hex) { return _Hex_float_precision<_Ty>::value; } if (_Precision > 0) { return static_cast<int>(_Precision); } else if (_Precision == 0) { const bool _Is_default_float = _Float_flags == 0; if (_Is_default_float) { return 1; } else { return 0; } } else { constexpr int _Default_precision = 6; return _Default_precision; } } template <class _Elem, class _OutIt = ostreambuf_iterator<_Elem, char_traits<_Elem>>> class num_put : public locale::facet { public: static_assert(!0 || _Is_any_of_v<_Elem, char, wchar_t, unsigned short>, "Unsupported facet specialization; see N4800 27.3.1.1.1 [locale.category]. " "Either use a Standard specialization or define _ENFORCE_FACET_SPECIALIZATIONS=0 " "to suppress this diagnostic."); static size_t __cdecl _Getcat(const locale::facet** _Ppf = nullptr, const locale* _Ploc = nullptr) { if (_Ppf && !*_Ppf) { *_Ppf = new num_put<_Elem, _OutIt>(_Locinfo(_Ploc->c_str())); } return 4; } static locale::id id; protected: virtual ~num_put() noexcept {} void _Init(const _Locinfo&) {} public: explicit num_put(size_t _Refs = 0) : locale::facet(_Refs) { { _Locinfo _Lobj; _Init(_Lobj); } } num_put(const _Locinfo& _Lobj, size_t _Refs = 0) : locale::facet(_Refs) { _Init(_Lobj); } using char_type = _Elem; using iter_type = _OutIt; _OutIt put( _OutIt _Dest, ios_base& _Iosbase, _Elem _Fill, bool _Val) const { return do_put(_Dest, _Iosbase, _Fill, _Val); } _OutIt put( _OutIt _Dest, ios_base& _Iosbase, _Elem _Fill, long _Val) const { return do_put(_Dest, _Iosbase, _Fill, _Val); } _OutIt put(_OutIt _Dest, ios_base& _Iosbase, _Elem _Fill, unsigned long _Val) const { return do_put(_Dest, _Iosbase, _Fill, _Val); } _OutIt put( _OutIt _Dest, ios_base& _Iosbase, _Elem _Fill, long long _Val) const { return do_put(_Dest, _Iosbase, _Fill, _Val); } _OutIt put(_OutIt _Dest, ios_base& _Iosbase, _Elem _Fill, unsigned long long _Val) const { return do_put(_Dest, _Iosbase, _Fill, _Val); } _OutIt put( _OutIt _Dest, ios_base& _Iosbase, _Elem _Fill, double _Val) const { return do_put(_Dest, _Iosbase, _Fill, _Val); } _OutIt put( _OutIt _Dest, ios_base& _Iosbase, _Elem _Fill, long double _Val) const { return do_put(_Dest, _Iosbase, _Fill, _Val); } _OutIt put( _OutIt _Dest, ios_base& _Iosbase, _Elem _Fill, const void* _Val) const { return do_put(_Dest, _Iosbase, _Fill, _Val); } protected: virtual _OutIt do_put( _OutIt _Dest, ios_base& _Iosbase, _Elem _Fill, bool _Val) const { if (!(_Iosbase.flags() & ios_base::boolalpha)) { return do_put(_Dest, _Iosbase, _Fill, static_cast<long>(_Val)); } else { const auto& _Punct_fac = ::std:: use_facet<numpunct<_Elem>>(_Iosbase.getloc()); basic_string<_Elem> _Str; if (_Val) { _Str.assign(_Punct_fac.truename()); } else { _Str.assign(_Punct_fac.falsename()); } size_t _Fillcount; if (_Iosbase.width() <= 0 || static_cast<size_t>(_Iosbase.width()) <= _Str.size()) { _Fillcount = 0; } else { _Fillcount = static_cast<size_t>(_Iosbase.width()) - _Str.size(); } if ((_Iosbase.flags() & ios_base::adjustfield) != ios_base::left) { _Dest = _Rep(_Dest, _Fill, _Fillcount); _Fillcount = 0; } _Dest = _Put(_Dest, _Str.c_str(), _Str.size()); _Iosbase.width(0); return _Rep(_Dest, _Fill, _Fillcount); } } #pragma warning(push) #pragma warning(disable : 4774) virtual _OutIt do_put( _OutIt _Dest, ios_base& _Iosbase, _Elem _Fill, long _Val) const { char _Buf[2 * 32]; char _Fmt[6]; return _Iput(_Dest, _Iosbase, _Fill, _Buf, static_cast<size_t>(:: sprintf_s(_Buf, sizeof(_Buf), _Ifmt(_Fmt, "ld", _Iosbase.flags()), _Val))); } virtual _OutIt do_put(_OutIt _Dest, ios_base& _Iosbase, _Elem _Fill, unsigned long _Val) const { char _Buf[2 * 32]; char _Fmt[6]; return _Iput(_Dest, _Iosbase, _Fill, _Buf, static_cast<size_t>(:: sprintf_s(_Buf, sizeof(_Buf), _Ifmt(_Fmt, "lu", _Iosbase.flags()), _Val))); } virtual _OutIt do_put( _OutIt _Dest, ios_base& _Iosbase, _Elem _Fill, long long _Val) const { char _Buf[2 * 32]; char _Fmt[8]; return _Iput(_Dest, _Iosbase, _Fill, _Buf, static_cast<size_t>(:: sprintf_s(_Buf, sizeof(_Buf), _Ifmt(_Fmt, "Ld", _Iosbase.flags()), _Val))); } virtual _OutIt do_put(_OutIt _Dest, ios_base& _Iosbase, _Elem _Fill, unsigned long long _Val) const { char _Buf[2 * 32]; char _Fmt[8]; return _Iput(_Dest, _Iosbase, _Fill, _Buf, static_cast<size_t>(:: sprintf_s(_Buf, sizeof(_Buf), _Ifmt(_Fmt, "Lu", _Iosbase.flags()), _Val))); } virtual _OutIt do_put( _OutIt _Dest, ios_base& _Iosbase, _Elem _Fill, double _Val) const { string _Buf; char _Fmt[8]; const auto _Float_flags = _Iosbase.flags() & ios_base::floatfield; const bool _Is_fixed = _Float_flags == ios_base::fixed; const bool _Is_hex = _Float_flags == (ios_base::fixed | ios_base::scientific); const streamsize _Precision = _Is_hex ? -1 : _Iosbase.precision(); const int _Desired_precision = _Float_put_desired_precision<double>(_Precision, _Float_flags); size_t _Bufsize = static_cast<size_t>(_Desired_precision); if (_Is_fixed && 1e10 < :: fabs(_Val)) { int _Ptwo; (void) :: frexp(_Val, &_Ptwo); _Bufsize += :: abs(_Ptwo) * 30103L / 100000L; } _Buf.resize(_Bufsize + 50); const auto _Ngen = static_cast<size_t>(:: sprintf_s( &_Buf[0], _Buf.size(), _Ffmt(_Fmt, 0, _Iosbase.flags()), static_cast<int>(_Precision), _Val)); return _Fput(_Dest, _Iosbase, _Fill, _Buf.c_str(), _Ngen); } virtual _OutIt do_put( _OutIt _Dest, ios_base& _Iosbase, _Elem _Fill, long double _Val) const { string _Buf; char _Fmt[8]; const auto _Float_flags = _Iosbase.flags() & ios_base::floatfield; const bool _Is_fixed = _Float_flags == ios_base::fixed; const bool _Is_hex = _Float_flags == (ios_base::fixed | ios_base::scientific); const streamsize _Precision = _Is_hex ? -1 : _Iosbase.precision(); const int _Desired_precision = _Float_put_desired_precision<long double>(_Precision, _Float_flags); size_t _Bufsize = static_cast<size_t>(_Desired_precision); if (_Is_fixed && 1e10 < :: fabsl(_Val)) { int _Ptwo; (void) :: frexpl(_Val, &_Ptwo); _Bufsize += :: abs(_Ptwo) * 30103L / 100000L; } _Buf.resize(_Bufsize + 50); const auto _Ngen = static_cast<size_t>(:: sprintf_s( &_Buf[0], _Buf.size(), _Ffmt(_Fmt, 'L', _Iosbase.flags()), static_cast<int>(_Precision), _Val)); return _Fput(_Dest, _Iosbase, _Fill, _Buf.c_str(), _Ngen); } #pragma warning(pop) virtual _OutIt do_put( _OutIt _Dest, ios_base& _Iosbase, _Elem _Fill, const void* _Val) const { char _Buf[2 * 32]; return _Iput( _Dest, _Iosbase, _Fill, _Buf, static_cast<size_t>(:: sprintf_s(_Buf, sizeof(_Buf), "%p", _Val))); } private: char* __cdecl _Ffmt( char* _Fmt, char _Spec, ios_base::fmtflags _Flags) const { char* _Ptr = _Fmt; *_Ptr++ = '%'; if (_Flags & ios_base::showpos) { *_Ptr++ = '+'; } if (_Flags & ios_base::showpoint) { *_Ptr++ = '#'; } *_Ptr++ = '.'; *_Ptr++ = '*'; if (_Spec != '\0') { *_Ptr++ = _Spec; } char _Ch; ios_base::fmtflags _Ffl = _Flags & ios_base::floatfield; if (_Flags & ios_base::uppercase) { if (_Ffl == ios_base::fixed) { _Ch = 'f'; } else if (_Ffl == ios_base::hexfloat) { _Ch = 'A'; } else if (_Ffl == ios_base::scientific) { _Ch = 'E'; } else { _Ch = 'G'; } } else { if (_Ffl == ios_base::fixed) { _Ch = 'f'; } else if (_Ffl == ios_base::hexfloat) { _Ch = 'a'; } else if (_Ffl == ios_base::scientific) { _Ch = 'e'; } else { _Ch = 'g'; } } *_Ptr++ = _Ch; *_Ptr = '\0'; return _Fmt; } _OutIt __cdecl _Fput(_OutIt _Dest, ios_base& _Iosbase, _Elem _Fill, const char* _Buf, size_t _Count) const { auto _Prefix = static_cast<size_t>(0 < _Count && (*_Buf == '+' || *_Buf == '-')); const char* _Exps; if ((_Iosbase.flags() & ios_base::floatfield) != ios_base::hexfloat) { _Exps = "eE"; } else { _Exps = "pP"; if (_Prefix + 2 <= _Count && _Buf[_Prefix] == '0' && (_Buf[_Prefix + 1] == 'x' || _Buf[_Prefix + 1] == 'X')) { _Prefix += 2; } } const size_t _Eoff = :: strcspn(&_Buf[0], _Exps); char _Dp[2] = {"."}; _Dp[0] = :: localeconv()->decimal_point[0]; const size_t _Poff = :: strcspn(&_Buf[0], &_Dp[0]); const ctype<_Elem>& _Ctype_fac = ::std:: use_facet<ctype<_Elem>>(_Iosbase.getloc()); basic_string<_Elem> _Groupstring(_Count, _Elem(0)); _Ctype_fac.widen(_Buf, _Buf + _Count, &_Groupstring[0]); const auto& _Punct_fac = ::std:: use_facet<numpunct<_Elem>>(_Iosbase.getloc()); const string _Grouping = _Punct_fac.grouping(); const _Elem _Kseparator = _Punct_fac.thousands_sep(); if (_Poff != _Count) { _Groupstring[_Poff] = _Punct_fac.decimal_point(); } size_t _Off = _Poff == _Count ? _Eoff : _Poff; const char* _Pg = &_Grouping[0]; while (*_Pg != 127 && '\0' < *_Pg && static_cast<size_t>(*_Pg) < _Off - _Prefix) { _Groupstring.insert(_Off -= *_Pg, 1, _Kseparator); if ('\0' < _Pg[1]) { ++_Pg; } } _Count = _Groupstring.size(); size_t _Fillcount; if (_Iosbase.width() <= 0 || static_cast<size_t>(_Iosbase.width()) <= _Count) { _Fillcount = 0; } else { _Fillcount = static_cast<size_t>(_Iosbase.width()) - _Count; } ios_base::fmtflags _Adjustfield = _Iosbase.flags() & ios_base::adjustfield; if (_Adjustfield != ios_base::left && _Adjustfield != ios_base::internal) { _Dest = _Rep(_Dest, _Fill, _Fillcount); _Fillcount = 0; _Dest = _Put(_Dest, &_Groupstring[0], _Prefix); } else if (_Adjustfield == ios_base::internal) { _Dest = _Put(_Dest, &_Groupstring[0], _Prefix); _Dest = _Rep(_Dest, _Fill, _Fillcount); _Fillcount = 0; } else { _Dest = _Put(_Dest, &_Groupstring[0], _Prefix); } _Dest = _Put(_Dest, &_Groupstring[_Prefix], _Count - _Prefix); _Iosbase.width(0); return _Rep(_Dest, _Fill, _Fillcount); } char* __cdecl _Ifmt( char* _Fmt, const char* _Spec, ios_base::fmtflags _Flags) const { char* _Ptr = _Fmt; *_Ptr++ = '%'; if (_Flags & ios_base::showpos) { *_Ptr++ = '+'; } if (_Flags & ios_base::showbase) { *_Ptr++ = '#'; } if (_Spec[0] != 'L') { *_Ptr++ = _Spec[0]; } else { *_Ptr++ = 'I'; *_Ptr++ = '6'; *_Ptr++ = '4'; } ios_base::fmtflags _Basefield = _Flags & ios_base::basefield; *_Ptr++ = _Basefield == ios_base::oct ? 'o' : _Basefield != ios_base::hex ? _Spec[1] : _Flags & ios_base::uppercase ? 'X' : 'x'; *_Ptr = '\0'; return _Fmt; } _OutIt __cdecl _Iput(_OutIt _Dest, ios_base& _Iosbase, _Elem _Fill, char* _Buf, size_t _Count) const { auto _Prefix = static_cast<size_t>(0 < _Count && (*_Buf == '+' || *_Buf == '-')); if ((_Iosbase.flags() & ios_base::basefield) == ios_base::hex && _Prefix + 2 <= _Count && _Buf[_Prefix] == '0' && (_Buf[_Prefix + 1] == 'x' || _Buf[_Prefix + 1] == 'X')) { _Prefix += 2; } const ctype<_Elem>& _Ctype_fac = ::std:: use_facet<ctype<_Elem>>(_Iosbase.getloc()); basic_string<_Elem> _Groupstring(_Count, _Elem(0)); _Ctype_fac.widen(_Buf, _Buf + _Count, &_Groupstring[0]); const auto& _Punct_fac = ::std:: use_facet<numpunct<_Elem>>(_Iosbase.getloc()); const string _Grouping = _Punct_fac.grouping(); const char* _Pg = &_Grouping[0]; if (*_Pg != 127 && '\0' < *_Pg) { const _Elem _Kseparator = _Punct_fac.thousands_sep(); while (*_Pg != 127 && '\0' < *_Pg && static_cast<size_t>(*_Pg) < _Count - _Prefix) { _Count -= *_Pg; _Groupstring.insert(_Count, 1, _Kseparator); if ('\0' < _Pg[1]) { ++_Pg; } } } _Count = _Groupstring.size(); size_t _Fillcount; if (_Iosbase.width() <= 0 || static_cast<size_t>(_Iosbase.width()) <= _Count) { _Fillcount = 0; } else { _Fillcount = static_cast<size_t>(_Iosbase.width()) - _Count; } ios_base::fmtflags _Adjustfield = _Iosbase.flags() & ios_base::adjustfield; if (_Adjustfield != ios_base::left && _Adjustfield != ios_base::internal) { _Dest = _Rep(_Dest, _Fill, _Fillcount); _Fillcount = 0; _Dest = _Put(_Dest, &_Groupstring[0], _Prefix); } else if (_Adjustfield == ios_base::internal) { _Dest = _Put(_Dest, &_Groupstring[0], _Prefix); _Dest = _Rep(_Dest, _Fill, _Fillcount); _Fillcount = 0; } else { _Dest = _Put(_Dest, &_Groupstring[0], _Prefix); } _Dest = _Put(_Dest, &_Groupstring[_Prefix], _Count - _Prefix); _Iosbase.width(0); return _Rep(_Dest, _Fill, _Fillcount); } _OutIt __cdecl _Put( _OutIt _Dest, const _Elem* _Ptr, size_t _Count) const { for (; 0 < _Count; --_Count, (void) ++_Dest, ++_Ptr) { *_Dest = *_Ptr; } return _Dest; } _OutIt __cdecl _Rep(_OutIt _Dest, _Elem _Ch, size_t _Count) const { for (; 0 < _Count; --_Count, (void) ++_Dest) { *_Dest = _Ch; } return _Dest; } }; template <class _Elem, class _OutIt> locale::id num_put<_Elem, _OutIt>::id; template locale::id numpunct<char>::id; template class __declspec(dllimport) num_get<char, istreambuf_iterator<char, char_traits<char>>>; template class __declspec(dllimport) num_put<char, ostreambuf_iterator<char, char_traits<char>>>; template locale::id numpunct<wchar_t>::id; template class __declspec(dllimport) num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t>>>; template class __declspec(dllimport) num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t>>>; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { template <class _Elem, class _Traits> class basic_ios : public ios_base { public: using _Myos = basic_ostream<_Elem, _Traits>; using _Mysb = basic_streambuf<_Elem, _Traits>; using _Ctype = ctype<_Elem>; using char_type = _Elem; using traits_type = _Traits; using int_type = typename _Traits::int_type; using pos_type = typename _Traits::pos_type; using off_type = typename _Traits::off_type; explicit basic_ios(_Mysb* _Strbuf) { init(_Strbuf); } virtual ~basic_ios() noexcept {} void clear(iostate _State = goodbit, bool _Reraise = false) { ios_base::clear(_State | (_Mystrbuf ? ios_base::_Iostate{} : ios_base::badbit), _Reraise); } void setstate( iostate _State, bool _Reraise = false) { clear(rdstate() | _State, _Reraise); } basic_ios& copyfmt(const basic_ios& _Right) { _Tiestr = _Right.tie(); _Fillch = _Right.fill(); ios_base::copyfmt(_Right); return *this; } _Myos* tie() const { return _Tiestr; } _Myos* tie(_Myos* _Newtie) { _Myos* _Oldtie = _Tiestr; _Tiestr = _Newtie; return _Oldtie; } [[nodiscard]] _Mysb* rdbuf() const { return _Mystrbuf; } _Mysb* rdbuf(_Mysb* _Strbuf) { _Mysb* _Oldstrbuf = _Mystrbuf; _Mystrbuf = _Strbuf; clear(); return _Oldstrbuf; } locale imbue(const locale& _Loc) { locale _Oldlocale = ios_base::imbue(_Loc); const auto _Rdbuf = rdbuf(); if (_Rdbuf) { _Rdbuf->pubimbue(_Loc); } return _Oldlocale; } _Elem fill() const { return _Fillch; } _Elem fill(_Elem _Newfill) { _Elem _Oldfill = _Fillch; _Fillch = _Newfill; return _Oldfill; } char narrow(_Elem _Ch, char _Dflt = '\0') const { return ::std:: use_facet<_Ctype>(getloc()).narrow(_Ch, _Dflt); } _Elem widen(char _Byte) const { return ::std:: use_facet<_Ctype>(getloc()).widen(_Byte); } void move(basic_ios& _Right) { if (this != ::std:: addressof(_Right)) { _Mystrbuf = nullptr; _Tiestr = nullptr; this->swap(_Right); } } void move(basic_ios&& _Right) { if (this != ::std:: addressof(_Right)) { _Mystrbuf = nullptr; _Tiestr = nullptr; this->swap(_Right); } } void swap(basic_ios& _Right) noexcept { ios_base::swap(_Right); ::std:: swap(_Fillch, _Right._Fillch); ::std:: swap(_Tiestr, _Right._Tiestr); } void set_rdbuf(_Mysb* _Strbuf) { _Mystrbuf = _Strbuf; } protected: void init(_Mysb* _Strbuf = nullptr, bool _Isstd = false) { _Init(); _Mystrbuf = _Strbuf; _Tiestr = nullptr; _Fillch = widen(' '); if (!_Mystrbuf) { setstate(badbit); } if (_Isstd) { _Addstd(this); } } basic_ios() {} private: _Mysb* _Mystrbuf; _Myos* _Tiestr; _Elem _Fillch; public: basic_ios(const basic_ios&) = delete; basic_ios& operator=(const basic_ios&) = delete; }; template class __declspec(dllimport) basic_ios<char, char_traits<char>>; template class __declspec(dllimport) basic_ios<wchar_t, char_traits<wchar_t>>; inline ios_base& __cdecl boolalpha(ios_base& _Iosbase) { _Iosbase.setf(ios_base::boolalpha); return _Iosbase; } inline ios_base& __cdecl dec(ios_base& _Iosbase) { _Iosbase.setf(ios_base::dec, ios_base::basefield); return _Iosbase; } inline ios_base& __cdecl defaultfloat(ios_base& _Iosbase) { _Iosbase.unsetf(ios_base::floatfield); return _Iosbase; } inline ios_base& __cdecl fixed(ios_base& _Iosbase) { _Iosbase.setf(ios_base::fixed, ios_base::floatfield); return _Iosbase; } inline ios_base& __cdecl hex(ios_base& _Iosbase) { _Iosbase.setf(ios_base::hex, ios_base::basefield); return _Iosbase; } inline ios_base& __cdecl hexfloat(ios_base& _Iosbase) { _Iosbase.setf(ios_base::hexfloat, ios_base::floatfield); return _Iosbase; } inline ios_base& __cdecl internal(ios_base& _Iosbase) { _Iosbase.setf(ios_base::internal, ios_base::adjustfield); return _Iosbase; } inline ios_base& __cdecl left(ios_base& _Iosbase) { _Iosbase.setf(ios_base::left, ios_base::adjustfield); return _Iosbase; } inline ios_base& __cdecl noboolalpha(ios_base& _Iosbase) { _Iosbase.unsetf(ios_base::boolalpha); return _Iosbase; } inline ios_base& __cdecl noshowbase(ios_base& _Iosbase) { _Iosbase.unsetf(ios_base::showbase); return _Iosbase; } inline ios_base& __cdecl noshowpoint(ios_base& _Iosbase) { _Iosbase.unsetf(ios_base::showpoint); return _Iosbase; } inline ios_base& __cdecl noshowpos(ios_base& _Iosbase) { _Iosbase.unsetf(ios_base::showpos); return _Iosbase; } inline ios_base& __cdecl noskipws(ios_base& _Iosbase) { _Iosbase.unsetf(ios_base::skipws); return _Iosbase; } inline ios_base& __cdecl nounitbuf(ios_base& _Iosbase) { _Iosbase.unsetf(ios_base::unitbuf); return _Iosbase; } inline ios_base& __cdecl nouppercase(ios_base& _Iosbase) { _Iosbase.unsetf(ios_base::uppercase); return _Iosbase; } inline ios_base& __cdecl oct(ios_base& _Iosbase) { _Iosbase.setf(ios_base::oct, ios_base::basefield); return _Iosbase; } inline ios_base& __cdecl right(ios_base& _Iosbase) { _Iosbase.setf(ios_base::right, ios_base::adjustfield); return _Iosbase; } inline ios_base& __cdecl scientific(ios_base& _Iosbase) { _Iosbase.setf(ios_base::scientific, ios_base::floatfield); return _Iosbase; } inline ios_base& __cdecl showbase(ios_base& _Iosbase) { _Iosbase.setf(ios_base::showbase); return _Iosbase; } inline ios_base& __cdecl showpoint(ios_base& _Iosbase) { _Iosbase.setf(ios_base::showpoint); return _Iosbase; } inline ios_base& __cdecl showpos(ios_base& _Iosbase) { _Iosbase.setf(ios_base::showpos); return _Iosbase; } inline ios_base& __cdecl skipws(ios_base& _Iosbase) { _Iosbase.setf(ios_base::skipws); return _Iosbase; } inline ios_base& __cdecl unitbuf(ios_base& _Iosbase) { _Iosbase.setf(ios_base::unitbuf); return _Iosbase; } inline ios_base& __cdecl uppercase(ios_base& _Iosbase) { _Iosbase.setf(ios_base::uppercase); return _Iosbase; } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { #pragma vtordisp(push, 2) template <class _Elem, class _Traits> class basic_ostream : virtual public basic_ios<_Elem, _Traits> { public: using _Myios = basic_ios<_Elem, _Traits>; using _Mysb = basic_streambuf<_Elem, _Traits>; using _Iter = ostreambuf_iterator<_Elem, _Traits>; using _Nput = num_put<_Elem, _Iter>; explicit basic_ostream(basic_streambuf<_Elem, _Traits>* _Strbuf, bool _Isstd = false) { _Myios::init(_Strbuf, _Isstd); } basic_ostream(_Uninitialized, bool _Addit = true) { if (_Addit) { this->_Addstd(this); } } protected: basic_ostream(basic_ostream&& _Right) { _Myios::init(); _Myios::move(::std:: move(_Right)); } basic_ostream& operator=(basic_ostream&& _Right) { this->swap(_Right); return *this; } void swap(basic_ostream& _Right) { if (this != ::std:: addressof(_Right)) { _Myios::swap(_Right); } } public: basic_ostream(const basic_ostream&) = delete; basic_ostream& operator=(const basic_ostream&) = delete; virtual ~basic_ostream() noexcept {} using int_type = typename _Traits::int_type; using pos_type = typename _Traits::pos_type; using off_type = typename _Traits::off_type; class _Sentry_base { public: _Sentry_base(basic_ostream& _Ostr) : _Myostr(_Ostr) { const auto _Rdbuf = _Myostr.rdbuf(); if (_Rdbuf) { _Rdbuf->_Lock(); } } ~_Sentry_base() noexcept { const auto _Rdbuf = _Myostr.rdbuf(); if (_Rdbuf) { _Rdbuf->_Unlock(); } } basic_ostream& _Myostr; _Sentry_base& operator=(const _Sentry_base&) = delete; }; class sentry : public _Sentry_base { public: explicit sentry(basic_ostream& _Ostr) : _Sentry_base(_Ostr) { if (!_Ostr.good()) { _Ok = false; return; } const auto _Tied = _Ostr.tie(); if (!_Tied || _Tied == &_Ostr) { _Ok = true; return; } _Tied->flush(); _Ok = _Ostr.good(); } __pragma(warning(push)) __pragma(warning(disable : 4996)) ~sentry() noexcept { const bool _Zero_uncaught_exceptions = ::std:: uncaught_exceptions() == 0; if (_Zero_uncaught_exceptions) { this->_Myostr._Osfx(); } } __pragma(warning(pop)) explicit operator bool() const { return _Ok; } sentry(const sentry&) = delete; sentry& operator=(const sentry&) = delete; private: bool _Ok; }; bool opfx() { if (!this->good()) { return false; } const auto _Tied = _Myios::tie(); if (!_Tied || _Myios::tie() == this) { return true; } _Tied->flush(); return this->good(); } void osfx() { _Osfx(); } void _Osfx() { try { if (this->good() && this->flags() & ios_base::unitbuf) { if (_Myios::rdbuf()->pubsync() == -1) { _Myios::setstate(ios_base::badbit); } } } catch (...) { } } basic_ostream& operator<<( basic_ostream&(__cdecl* _Pfn)(basic_ostream&) ) { return _Pfn(*this); } basic_ostream& operator<<(_Myios&(__cdecl* _Pfn)(_Myios&) ) { _Pfn(*this); return *this; } basic_ostream& operator<<(ios_base&(__cdecl* _Pfn)(ios_base&) ) { _Pfn(*this); return *this; } basic_ostream& operator<<(bool _Val) { ios_base::iostate _State = ios_base::goodbit; const sentry _Ok(*this); if (_Ok) { const _Nput& _Nput_fac = ::std:: use_facet<_Nput>(this->getloc()); try { if (_Nput_fac.put(_Iter(_Myios::rdbuf()), *this, _Myios::fill(), _Val).failed()) { _State |= ios_base::badbit; } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } _Myios::setstate(_State); return *this; } basic_ostream& operator<<(short _Val) { ios_base::iostate _State = ios_base::goodbit; const sentry _Ok(*this); if (_Ok) { const _Nput& _Nput_fac = ::std:: use_facet<_Nput>(this->getloc()); ios_base::fmtflags _Bfl = this->flags() & ios_base::basefield; long _Tmp; if (_Bfl == ios_base::oct || _Bfl == ios_base::hex) { _Tmp = static_cast<long>(static_cast<unsigned short>(_Val)); } else { _Tmp = static_cast<long>(_Val); } try { if (_Nput_fac.put(_Iter(_Myios::rdbuf()), *this, _Myios::fill(), _Tmp).failed()) { _State |= ios_base::badbit; } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } _Myios::setstate(_State); return *this; } basic_ostream& operator<<(unsigned short _Val) { ios_base::iostate _State = ios_base::goodbit; const sentry _Ok(*this); if (_Ok) { const _Nput& _Nput_fac = ::std:: use_facet<_Nput>(this->getloc()); try { if (_Nput_fac.put(_Iter(_Myios::rdbuf()), *this, _Myios::fill(), static_cast<unsigned long>(_Val)) .failed()) { _State |= ios_base::badbit; } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } _Myios::setstate(_State); return *this; } basic_ostream& operator<<(int _Val) { ios_base::iostate _State = ios_base::goodbit; const sentry _Ok(*this); if (_Ok) { const _Nput& _Nput_fac = ::std:: use_facet<_Nput>(this->getloc()); ios_base::fmtflags _Bfl = this->flags() & ios_base::basefield; long _Tmp; if (_Bfl == ios_base::oct || _Bfl == ios_base::hex) { _Tmp = static_cast<long>(static_cast<unsigned int>(_Val)); } else { _Tmp = static_cast<long>(_Val); } try { if (_Nput_fac.put(_Iter(_Myios::rdbuf()), *this, _Myios::fill(), _Tmp).failed()) { _State |= ios_base::badbit; } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } _Myios::setstate(_State); return *this; } basic_ostream& operator<<(unsigned int _Val) { ios_base::iostate _State = ios_base::goodbit; const sentry _Ok(*this); if (_Ok) { const _Nput& _Nput_fac = ::std:: use_facet<_Nput>(this->getloc()); try { if (_Nput_fac.put(_Iter(_Myios::rdbuf()), *this, _Myios::fill(), static_cast<unsigned long>(_Val)) .failed()) { _State |= ios_base::badbit; } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } _Myios::setstate(_State); return *this; } basic_ostream& operator<<(long _Val) { ios_base::iostate _State = ios_base::goodbit; const sentry _Ok(*this); if (_Ok) { const _Nput& _Nput_fac = ::std:: use_facet<_Nput>(this->getloc()); try { if (_Nput_fac.put(_Iter(_Myios::rdbuf()), *this, _Myios::fill(), _Val).failed()) { _State |= ios_base::badbit; } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } _Myios::setstate(_State); return *this; } basic_ostream& operator<<(unsigned long _Val) { ios_base::iostate _State = ios_base::goodbit; const sentry _Ok(*this); if (_Ok) { const _Nput& _Nput_fac = ::std:: use_facet<_Nput>(this->getloc()); try { if (_Nput_fac.put(_Iter(_Myios::rdbuf()), *this, _Myios::fill(), _Val).failed()) { _State |= ios_base::badbit; } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } _Myios::setstate(_State); return *this; } basic_ostream& operator<<(long long _Val) { ios_base::iostate _State = ios_base::goodbit; const sentry _Ok(*this); if (_Ok) { const _Nput& _Nput_fac = ::std:: use_facet<_Nput>(this->getloc()); try { if (_Nput_fac.put(_Iter(_Myios::rdbuf()), *this, _Myios::fill(), _Val).failed()) { _State |= ios_base::badbit; } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } _Myios::setstate(_State); return *this; } basic_ostream& operator<<(unsigned long long _Val) { ios_base::iostate _State = ios_base::goodbit; const sentry _Ok(*this); if (_Ok) { const _Nput& _Nput_fac = ::std:: use_facet<_Nput>(this->getloc()); try { if (_Nput_fac.put(_Iter(_Myios::rdbuf()), *this, _Myios::fill(), _Val).failed()) { _State |= ios_base::badbit; } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } _Myios::setstate(_State); return *this; } basic_ostream& operator<<(float _Val) { ios_base::iostate _State = ios_base::goodbit; const sentry _Ok(*this); if (_Ok) { const _Nput& _Nput_fac = ::std:: use_facet<_Nput>(this->getloc()); try { if (_Nput_fac.put(_Iter(_Myios::rdbuf()), *this, _Myios::fill(), static_cast<double>(_Val)).failed()) { _State |= ios_base::badbit; } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } _Myios::setstate(_State); return *this; } basic_ostream& operator<<(double _Val) { ios_base::iostate _State = ios_base::goodbit; const sentry _Ok(*this); if (_Ok) { const _Nput& _Nput_fac = ::std:: use_facet<_Nput>(this->getloc()); try { if (_Nput_fac.put(_Iter(_Myios::rdbuf()), *this, _Myios::fill(), _Val).failed()) { _State |= ios_base::badbit; } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } _Myios::setstate(_State); return *this; } basic_ostream& operator<<(long double _Val) { ios_base::iostate _State = ios_base::goodbit; const sentry _Ok(*this); if (_Ok) { const _Nput& _Nput_fac = ::std:: use_facet<_Nput>(this->getloc()); try { if (_Nput_fac.put(_Iter(_Myios::rdbuf()), *this, _Myios::fill(), _Val).failed()) { _State |= ios_base::badbit; } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } _Myios::setstate(_State); return *this; } basic_ostream& operator<<(const void* _Val) { ios_base::iostate _State = ios_base::goodbit; const sentry _Ok(*this); if (_Ok) { const _Nput& _Nput_fac = ::std:: use_facet<_Nput>(this->getloc()); try { if (_Nput_fac.put(_Iter(_Myios::rdbuf()), *this, _Myios::fill(), _Val).failed()) { _State |= ios_base::badbit; } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } _Myios::setstate(_State); return *this; } template <class = void> basic_ostream& operator<<(nullptr_t) { return *this << "nullptr"; } basic_ostream& operator<<(_Mysb* _Strbuf) { ios_base::iostate _State = ios_base::goodbit; bool _Copied = false; const sentry _Ok(*this); if (_Ok && _Strbuf) { for (int_type _Meta = _Traits::eof();; _Copied = true) { try { _Meta = _Traits::eq_int_type(_Traits::eof(), _Meta) ? _Strbuf->sgetc() : _Strbuf->snextc(); } catch (...) { _Myios::setstate(ios_base::failbit); throw; } if (_Traits::eq_int_type(_Traits::eof(), _Meta)) { break; } try { if (_Traits::eq_int_type(_Traits::eof(), _Myios::rdbuf()->sputc(_Traits::to_char_type(_Meta)))) { _State |= ios_base::badbit; break; } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } } this->width(0); int _Setstate_with; if (_Strbuf) { if (_Copied) { _Setstate_with = _State; } else { _Setstate_with = _State | ios_base::failbit; } } else { _Setstate_with = ios_base::badbit; } _Myios::setstate(_Setstate_with); return *this; } basic_ostream& put(_Elem _Ch) { ios_base::iostate _State = ios_base::goodbit; const sentry _Ok(*this); if (!_Ok) { _State |= ios_base::badbit; } else { try { if (_Traits::eq_int_type(_Traits::eof(), _Myios::rdbuf()->sputc(_Ch))) { _State |= ios_base::badbit; } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } _Myios::setstate(_State); return *this; } basic_ostream& write(const _Elem* _Str, streamsize _Count) { ios_base::iostate _State = ios_base::goodbit; const sentry _Ok(*this); if (!_Ok) { _State |= ios_base::badbit; } else if (0 < _Count) { try { if (_Myios::rdbuf()->sputn(_Str, _Count) != _Count) { _State |= ios_base::badbit; } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } _Myios::setstate(_State); return *this; } basic_ostream& flush() { const auto _Rdbuf = _Myios::rdbuf(); if (_Rdbuf) { const sentry _Ok(*this); if (_Ok && _Rdbuf->pubsync() == -1) { _Myios::setstate(ios_base::badbit); } } return *this; } basic_ostream& seekp(pos_type _Pos) { const sentry _Ok(*this); if (!this->fail() && static_cast<off_type>(_Myios::rdbuf()->pubseekpos(_Pos, ios_base::out)) == -1) { _Myios::setstate(ios_base::failbit); } return *this; } basic_ostream& seekp( off_type _Off, ios_base::seekdir _Way) { const sentry _Ok(*this); if (!this->fail() && static_cast<off_type>(_Myios::rdbuf()->pubseekoff(_Off, _Way, ios_base::out)) == -1) { _Myios::setstate(ios_base::failbit); } return *this; } pos_type tellp() { const sentry _Ok(*this); if (!this->fail()) { return _Myios::rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out); } else { return pos_type(-1); } } }; #pragma vtordisp(pop) template class __declspec(dllimport) basic_ostream<char, char_traits<char>>; template class __declspec(dllimport) basic_ostream<wchar_t, char_traits<wchar_t>>; template <class _Elem, class _Traits> basic_ostream<_Elem, _Traits>& operator<<(basic_ostream<_Elem, _Traits>& _Ostr, const char* _Val) { ios_base::iostate _State = ios_base::goodbit; streamsize _Count = static_cast<streamsize>(:: strlen(_Val)); streamsize _Pad = _Ostr.width() <= 0 || _Ostr.width() <= _Count ? 0 : _Ostr.width() - _Count; const typename basic_ostream<_Elem, _Traits>::sentry _Ok(_Ostr); if (!_Ok) { _State |= ios_base::badbit; } else { try { const ctype<_Elem>& _Ctype_fac = ::std:: use_facet<ctype<_Elem>>(_Ostr.getloc()); if ((_Ostr.flags() & ios_base::adjustfield) != ios_base::left) { for (; 0 < _Pad; --_Pad) { if (_Traits::eq_int_type(_Traits::eof(), _Ostr.rdbuf()->sputc(_Ostr.fill()))) { _State |= ios_base::badbit; break; } } } for (; _State == ios_base::goodbit && 0 < _Count; --_Count, ++_Val) { if (_Traits::eq_int_type(_Traits::eof(), _Ostr.rdbuf()->sputc(_Ctype_fac.widen(*_Val)))) { _State |= ios_base::badbit; } } if (_State == ios_base::goodbit) { for (; 0 < _Pad; --_Pad) { if (_Traits::eq_int_type(_Traits::eof(), _Ostr.rdbuf()->sputc(_Ostr.fill()))) { _State |= ios_base::badbit; break; } } } _Ostr.width(0); } catch (...) { (_Ostr) .setstate(ios_base::badbit, true); } } _Ostr.setstate(_State); return _Ostr; } template <class _Elem, class _Traits> basic_ostream<_Elem, _Traits>& operator<<(basic_ostream<_Elem, _Traits>& _Ostr, char _Ch) { ios_base::iostate _State = ios_base::goodbit; const typename basic_ostream<_Elem, _Traits>::sentry _Ok(_Ostr); if (_Ok) { const ctype<_Elem>& _Ctype_fac = ::std:: use_facet<ctype<_Elem>>(_Ostr.getloc()); streamsize _Pad = _Ostr.width() <= 1 ? 0 : _Ostr.width() - 1; try { if ((_Ostr.flags() & ios_base::adjustfield) != ios_base::left) { for (; _State == ios_base::goodbit && 0 < _Pad; --_Pad) { if (_Traits::eq_int_type(_Traits::eof(), _Ostr.rdbuf()->sputc(_Ostr.fill()))) { _State |= ios_base::badbit; } } } if (_State == ios_base::goodbit && _Traits::eq_int_type(_Traits::eof(), _Ostr.rdbuf()->sputc(_Ctype_fac.widen(_Ch)))) { _State |= ios_base::badbit; } for (; _State == ios_base::goodbit && 0 < _Pad; --_Pad) { if (_Traits::eq_int_type(_Traits::eof(), _Ostr.rdbuf()->sputc(_Ostr.fill()))) { _State |= ios_base::badbit; } } } catch (...) { (_Ostr) .setstate(ios_base::badbit, true); } } _Ostr.width(0); _Ostr.setstate(_State); return _Ostr; } template <class _Traits> basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& _Ostr, const char* _Val) { using _Elem = char; using _Myos = basic_ostream<_Elem, _Traits>; ios_base::iostate _State = ios_base::goodbit; streamsize _Count = static_cast<streamsize>(_Traits::length(_Val)); streamsize _Pad = _Ostr.width() <= 0 || _Ostr.width() <= _Count ? 0 : _Ostr.width() - _Count; const typename _Myos::sentry _Ok(_Ostr); if (!_Ok) { _State |= ios_base::badbit; } else { try { if ((_Ostr.flags() & ios_base::adjustfield) != ios_base::left) { for (; 0 < _Pad; --_Pad) { if (_Traits::eq_int_type(_Traits::eof(), _Ostr.rdbuf()->sputc(_Ostr.fill()))) { _State |= ios_base::badbit; break; } } } if (_State == ios_base::goodbit && _Ostr.rdbuf()->sputn(_Val, _Count) != _Count) { _State |= ios_base::badbit; } if (_State == ios_base::goodbit) { for (; 0 < _Pad; --_Pad) { if (_Traits::eq_int_type(_Traits::eof(), _Ostr.rdbuf()->sputc(_Ostr.fill()))) { _State |= ios_base::badbit; break; } } } _Ostr.width(0); } catch (...) { (_Ostr) .setstate(ios_base::badbit, true); } } _Ostr.setstate(_State); return _Ostr; } template <class _Traits> basic_ostream<char, _Traits>& operator<<( basic_ostream<char, _Traits>& _Ostr, char _Ch) { using _Elem = char; using _Myos = basic_ostream<_Elem, _Traits>; ios_base::iostate _State = ios_base::goodbit; const typename _Myos::sentry _Ok(_Ostr); if (_Ok) { streamsize _Pad = _Ostr.width() <= 1 ? 0 : _Ostr.width() - 1; try { if ((_Ostr.flags() & ios_base::adjustfield) != ios_base::left) { for (; _State == ios_base::goodbit && 0 < _Pad; --_Pad) { if (_Traits::eq_int_type(_Traits::eof(), _Ostr.rdbuf()->sputc(_Ostr.fill()))) { _State |= ios_base::badbit; } } } if (_State == ios_base::goodbit && _Traits::eq_int_type(_Traits::eof(), _Ostr.rdbuf()->sputc(_Ch))) { _State |= ios_base::badbit; } for (; _State == ios_base::goodbit && 0 < _Pad; --_Pad) { if (_Traits::eq_int_type(_Traits::eof(), _Ostr.rdbuf()->sputc(_Ostr.fill()))) { _State |= ios_base::badbit; } } } catch (...) { (_Ostr) .setstate(ios_base::badbit, true); } } _Ostr.width(0); _Ostr.setstate(_State); return _Ostr; } template <class _Elem, class _Traits> basic_ostream<_Elem, _Traits>& operator<<(basic_ostream<_Elem, _Traits>& _Ostr, const _Elem* _Val) { using _Myos = basic_ostream<_Elem, _Traits>; ios_base::iostate _State = ios_base::goodbit; streamsize _Count = static_cast<streamsize>(_Traits::length(_Val)); streamsize _Pad = _Ostr.width() <= 0 || _Ostr.width() <= _Count ? 0 : _Ostr.width() - _Count; const typename _Myos::sentry _Ok(_Ostr); if (!_Ok) { _State |= ios_base::badbit; } else { try { if ((_Ostr.flags() & ios_base::adjustfield) != ios_base::left) { for (; 0 < _Pad; --_Pad) { if (_Traits::eq_int_type(_Traits::eof(), _Ostr.rdbuf()->sputc(_Ostr.fill()))) { _State |= ios_base::badbit; break; } } } if (_State == ios_base::goodbit && _Ostr.rdbuf()->sputn(_Val, _Count) != _Count) { _State |= ios_base::badbit; } if (_State == ios_base::goodbit) { for (; 0 < _Pad; --_Pad) { if (_Traits::eq_int_type(_Traits::eof(), _Ostr.rdbuf()->sputc(_Ostr.fill()))) { _State |= ios_base::badbit; break; } } } _Ostr.width(0); } catch (...) { (_Ostr) .setstate(ios_base::badbit, true); } } _Ostr.setstate(_State); return _Ostr; } template <class _Elem, class _Traits> basic_ostream<_Elem, _Traits>& operator<<(basic_ostream<_Elem, _Traits>& _Ostr, _Elem _Ch) { using _Myos = basic_ostream<_Elem, _Traits>; ios_base::iostate _State = ios_base::goodbit; const typename _Myos::sentry _Ok(_Ostr); if (_Ok) { streamsize _Pad = _Ostr.width() <= 1 ? 0 : _Ostr.width() - 1; try { if ((_Ostr.flags() & ios_base::adjustfield) != ios_base::left) { for (; _State == ios_base::goodbit && 0 < _Pad; --_Pad) { if (_Traits::eq_int_type(_Traits::eof(), _Ostr.rdbuf()->sputc(_Ostr.fill()))) { _State |= ios_base::badbit; } } } if (_State == ios_base::goodbit && _Traits::eq_int_type(_Traits::eof(), _Ostr.rdbuf()->sputc(_Ch))) { _State |= ios_base::badbit; } for (; _State == ios_base::goodbit && 0 < _Pad; --_Pad) { if (_Traits::eq_int_type(_Traits::eof(), _Ostr.rdbuf()->sputc(_Ostr.fill()))) { _State |= ios_base::badbit; } } } catch (...) { (_Ostr) .setstate(ios_base::badbit, true); } } _Ostr.width(0); _Ostr.setstate(_State); return _Ostr; } template <class _Traits> basic_ostream<char, _Traits>& operator<<( basic_ostream<char, _Traits>& _Ostr, const signed char* _Val) { return _Ostr << reinterpret_cast<const char*>(_Val); } template <class _Traits> basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& _Ostr, signed char _Ch) { return _Ostr << static_cast<char>(_Ch); } template <class _Traits> basic_ostream<char, _Traits>& operator<<( basic_ostream<char, _Traits>& _Ostr, const unsigned char* _Val) { return _Ostr << reinterpret_cast<const char*>(_Val); } template <class _Traits> basic_ostream<char, _Traits>& operator<<( basic_ostream<char, _Traits>& _Ostr, unsigned char _Ch) { return _Ostr << static_cast<char>(_Ch); } template <class _Traits> basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, const char8_t*) = delete; template <class _Traits> basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, const char8_t*) = delete; template <class _Traits> basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, char8_t) = delete; template <class _Traits> basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, char8_t) = delete; template <class _Traits> basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, wchar_t) = delete; template <class _Traits> basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, const wchar_t*) = delete; template <class _Traits> basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, char16_t) = delete; template <class _Traits> basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, char32_t) = delete; template <class _Traits> basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, char16_t) = delete; template <class _Traits> basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, char32_t) = delete; template <class _Traits> basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, const char16_t*) = delete; template <class _Traits> basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, const char32_t*) = delete; template <class _Traits> basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, const char16_t*) = delete; template <class _Traits> basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, const char32_t*) = delete; template <class _Ostr, class _Ty, class = void> struct _Can_stream_out : false_type {}; template <class _Ostr, class _Ty> struct _Can_stream_out<_Ostr, _Ty, void_t<decltype(::std:: declval<_Ostr&>() << ::std:: declval<const _Ty&>())>> : true_type { }; template <class _Ostr, class _Ty, enable_if_t<conjunction_v<is_convertible<_Ostr*, ios_base*>, _Can_stream_out<_Ostr, _Ty>>, int> = 0> _Ostr&& operator<<(_Ostr&& _Os, const _Ty& _Val) { _Os << _Val; return ::std:: move(_Os); } template <class _Elem, class _Traits> basic_ostream<_Elem, _Traits>& __cdecl endl( basic_ostream<_Elem, _Traits>& _Ostr) { _Ostr.put(_Ostr.widen('\n')); _Ostr.flush(); return _Ostr; } template <class _Elem, class _Traits> basic_ostream<_Elem, _Traits>& __cdecl ends(basic_ostream<_Elem, _Traits>& _Ostr) { _Ostr.put(_Elem()); return _Ostr; } template <class _Elem, class _Traits> basic_ostream<_Elem, _Traits>& __cdecl flush(basic_ostream<_Elem, _Traits>& _Ostr) { _Ostr.flush(); return _Ostr; } template <class _Elem, class _Traits> basic_ostream<_Elem, _Traits>& emit_on_flush(basic_ostream<_Elem, _Traits>& _Ostr) { const auto _Sync_buf_ptr = dynamic_cast<_Basic_syncbuf_impl<_Elem, _Traits>*>(_Ostr.rdbuf()); if (_Sync_buf_ptr) { _Sync_buf_ptr->set_emit_on_sync(true); } return _Ostr; } template <class _Elem, class _Traits> basic_ostream<_Elem, _Traits>& noemit_on_flush(basic_ostream<_Elem, _Traits>& _Ostr) { const auto _Sync_buf_ptr = dynamic_cast<_Basic_syncbuf_impl<_Elem, _Traits>*>(_Ostr.rdbuf()); if (_Sync_buf_ptr) { _Sync_buf_ptr->set_emit_on_sync(false); } return _Ostr; } template <class _Elem, class _Traits> basic_ostream<_Elem, _Traits>& flush_emit(basic_ostream<_Elem, _Traits>& _Ostr) { _Ostr.flush(); const auto _Sync_buf_ptr = dynamic_cast<_Basic_syncbuf_impl<_Elem, _Traits>*>(_Ostr.rdbuf()); if (_Sync_buf_ptr) { _Sync_buf_ptr->_Do_emit(); } return _Ostr; } template <class _Elem, class _Traits> basic_ostream<_Elem, _Traits>& operator<<(basic_ostream<_Elem, _Traits>& _Ostr, const error_code& _Errcode) { return _Ostr << _Errcode.category().name() << ':' << _Errcode.value(); } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { #pragma vtordisp(push, 2) template <class _Elem, class _Traits> class basic_istream : virtual public basic_ios<_Elem, _Traits> { public: using _Myios = basic_ios<_Elem, _Traits>; using _Mysb = basic_streambuf<_Elem, _Traits>; using _Iter = istreambuf_iterator<_Elem, _Traits>; using _Ctype = ctype<_Elem>; using _Nget = num_get<_Elem, _Iter>; explicit basic_istream(_Mysb* _Strbuf, bool _Isstd = false) : _Chcount(0) { _Myios::init(_Strbuf, _Isstd); } basic_istream(_Uninitialized) { this->_Addstd(this); } protected: basic_istream(basic_istream&& _Right) : _Chcount(_Right._Chcount) { _Myios::init(); _Myios::move(::std:: move(_Right)); _Right._Chcount = 0; } basic_istream& operator=(basic_istream&& _Right) { this->swap(_Right); return *this; } void swap(basic_istream& _Right) { _Myios::swap(_Right); ::std:: swap(_Chcount, _Right._Chcount); } public: basic_istream(const basic_istream&) = delete; basic_istream& operator=(const basic_istream&) = delete; virtual ~basic_istream() noexcept {} using int_type = typename _Traits::int_type; using pos_type = typename _Traits::pos_type; using off_type = typename _Traits::off_type; class _Sentry_base { public: _Sentry_base(basic_istream& _Istr) : _Myistr(_Istr) { const auto _Rdbuf = _Myistr.rdbuf(); if (_Rdbuf) { _Rdbuf->_Lock(); } } ~_Sentry_base() noexcept { const auto _Rdbuf = _Myistr.rdbuf(); if (_Rdbuf) { _Rdbuf->_Unlock(); } } basic_istream& _Myistr; _Sentry_base& operator=(const _Sentry_base&) = delete; }; class sentry : public _Sentry_base { public: explicit sentry(basic_istream& _Istr, bool _Noskip = false) : _Sentry_base(_Istr), _Ok(_Sentry_base::_Myistr._Ipfx(_Noskip)) {} explicit operator bool() const { return _Ok; } sentry(const sentry&) = delete; sentry& operator=(const sentry&) = delete; private: bool _Ok; }; bool _Ipfx(bool _Noskip = false) { if (!this->good()) { _Myios::setstate(ios_base::failbit); return false; } const auto _Tied = _Myios::tie(); if (_Tied) { _Tied->flush(); } bool _Eof = false; if (!_Noskip && this->flags() & ios_base::skipws) { const _Ctype& _Ctype_fac = ::std:: use_facet<_Ctype>(this->getloc()); try { int_type _Meta = _Myios::rdbuf()->sgetc(); for (;; _Meta = _Myios::rdbuf()->snextc()) { if (_Traits::eq_int_type(_Traits::eof(), _Meta)) { _Eof = true; break; } else if (!_Ctype_fac.is(_Ctype::space, _Traits::to_char_type(_Meta))) { break; } } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } if (_Eof) { _Myios::setstate(ios_base::eofbit | ios_base::failbit); } return this->good(); } bool ipfx(bool _Noskip = false) { return _Ipfx(_Noskip); } void isfx() {} basic_istream& operator>>(basic_istream&(__cdecl* _Pfn)(basic_istream&) ) { return _Pfn(*this); } basic_istream& operator>>(_Myios&(__cdecl* _Pfn)(_Myios&) ) { _Pfn(*this); return *this; } basic_istream& operator>>(ios_base&(__cdecl* _Pfn)(ios_base&) ) { _Pfn(*this); return *this; } private: template <class _Ty> basic_istream& _Common_extract_with_num_get(_Ty& _Val) { ios_base::iostate _Err = ios_base::goodbit; const sentry _Ok(*this); if (_Ok) { try { ::std:: use_facet<_Nget>(this->getloc()).get(*this, {}, *this, _Err, _Val); } catch (...) { _Myios::setstate(ios_base::badbit, true); } } _Myios::setstate(_Err); return *this; } template <class = void> void _Increment_gcount() { if (_Chcount != (numeric_limits<streamsize>::max)()) { ++_Chcount; } } public: basic_istream& operator>>(bool& _Val) { return _Common_extract_with_num_get(_Val); } basic_istream& operator>>(short& _Val) { ios_base::iostate _Err = ios_base::goodbit; const sentry _Ok(*this); if (_Ok) { try { long _Lval; ::std:: use_facet<_Nget>(this->getloc()).get(*this, {}, *this, _Err, _Lval); if (_Lval < (-32768)) { _Err |= ios_base::failbit; _Val = (-32768); } else if (_Lval > 32767) { _Err |= ios_base::failbit; _Val = 32767; } else { _Val = static_cast<short>(_Lval); } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } _Myios::setstate(_Err); return *this; } basic_istream& operator>>(unsigned short& _Val) { return _Common_extract_with_num_get(_Val); } basic_istream& operator>>(int& _Val) { static_assert(sizeof(int) == sizeof(long), "Bad overflow assumptions due to sizeof(int) != sizeof(long)"); long _Result = _Val; _Common_extract_with_num_get(_Result); _Val = _Result; return *this; } basic_istream& operator>>(unsigned int& _Val) { return _Common_extract_with_num_get(_Val); } basic_istream& operator>>(long& _Val) { return _Common_extract_with_num_get(_Val); } basic_istream& operator>>(unsigned long& _Val) { return _Common_extract_with_num_get(_Val); } basic_istream& operator>>(long long& _Val) { return _Common_extract_with_num_get(_Val); } basic_istream& operator>>(unsigned long long& _Val) { return _Common_extract_with_num_get(_Val); } basic_istream& operator>>(float& _Val) { return _Common_extract_with_num_get(_Val); } basic_istream& operator>>(double& _Val) { return _Common_extract_with_num_get(_Val); } basic_istream& operator>>(long double& _Val) { return _Common_extract_with_num_get(_Val); } basic_istream& operator>>(void*& _Val) { return _Common_extract_with_num_get(_Val); } basic_istream& operator>>(_Mysb* _Strbuf) { _Chcount = 0; const sentry _Ok(*this, true); ios_base::iostate _State = ios_base::goodbit; if (_Ok && _Strbuf) { try { for (int_type _Meta = _Myios::rdbuf()->sgetc();; _Meta = _Myios::rdbuf()->snextc()) { if (_Traits::eq_int_type(_Traits::eof(), _Meta)) { _State |= ios_base::eofbit; break; } try { if (_Traits::eq_int_type(_Traits::eof(), _Strbuf->sputc(_Traits::to_char_type(_Meta)))) { break; } } catch (...) { break; } _Increment_gcount(); } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } if (_Chcount == 0) { _State |= ios_base::failbit; } _Myios::setstate(_State); return *this; } int_type get() { int_type _Meta = 0; ios_base::iostate _State = ios_base::goodbit; _Chcount = 0; const sentry _Ok(*this, true); if (!_Ok) { _Meta = _Traits::eof(); } else { try { _Meta = _Myios::rdbuf()->sgetc(); if (_Traits::eq_int_type(_Traits::eof(), _Meta)) { _State |= ios_base::eofbit | ios_base::failbit; } else { _Myios::rdbuf()->sbumpc(); _Chcount = 1; } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } _Myios::setstate(_State); return _Meta; } basic_istream& get(_Elem* _Str, streamsize _Count) { return get(_Str, _Count, _Myios::widen('\n')); } basic_istream& get( _Elem* _Str, streamsize _Count, _Elem _Delim) { ios_base::iostate _State = ios_base::goodbit; _Chcount = 0; const sentry _Ok(*this, true); if (_Ok && 0 < _Count) { try { int_type _Meta = _Myios::rdbuf()->sgetc(); for (; 0 < --_Count; _Meta = _Myios::rdbuf()->snextc()) { if (_Traits::eq_int_type(_Traits::eof(), _Meta)) { _State |= ios_base::eofbit; break; } else if (_Traits::to_char_type(_Meta) == _Delim) { break; } else { *_Str++ = _Traits::to_char_type(_Meta); _Increment_gcount(); } } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } _Myios::setstate(_Chcount == 0 ? _State | ios_base::failbit : _State); *_Str = _Elem(); return *this; } basic_istream& get(_Elem& _Ch) { int_type _Meta = get(); if (!_Traits::eq_int_type(_Traits::eof(), _Meta)) { _Ch = _Traits::to_char_type(_Meta); } return *this; } basic_istream& get(_Mysb& _Strbuf) { return get(_Strbuf, _Myios::widen('\n')); } basic_istream& get( _Mysb& _Strbuf, _Elem _Delim) { ios_base::iostate _State = ios_base::goodbit; _Chcount = 0; const sentry _Ok(*this, true); if (_Ok) { try { int_type _Meta = _Myios::rdbuf()->sgetc(); for (;; _Meta = _Myios::rdbuf()->snextc()) { if (_Traits::eq_int_type(_Traits::eof(), _Meta)) { _State |= ios_base::eofbit; break; } else { try { _Elem _Ch = _Traits::to_char_type(_Meta); if (_Ch == _Delim || _Traits::eq_int_type(_Traits::eof(), _Strbuf.sputc(_Ch))) { break; } } catch (...) { break; } _Increment_gcount(); } } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } if (_Chcount == 0) { _State |= ios_base::failbit; } _Myios::setstate(_State); return *this; } basic_istream& getline( _Elem* _Str, streamsize _Count) { return getline(_Str, _Count, _Myios::widen('\n')); } basic_istream& getline( _Elem* _Str, streamsize _Count, _Elem _Delim) { ios_base::iostate _State = ios_base::goodbit; _Chcount = 0; const sentry _Ok(*this, true); if (_Ok && 0 < _Count) { int_type _Metadelim = _Traits::to_int_type(_Delim); try { int_type _Meta = _Myios::rdbuf()->sgetc(); for (;; _Meta = _Myios::rdbuf()->snextc()) { if (_Traits::eq_int_type(_Traits::eof(), _Meta)) { _State |= ios_base::eofbit; break; } else if (_Meta == _Metadelim) { _Increment_gcount(); _Myios::rdbuf()->sbumpc(); break; } else if (--_Count <= 0) { _State |= ios_base::failbit; break; } else { *_Str++ = _Traits::to_char_type(_Meta); _Increment_gcount(); } } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } *_Str = _Elem(); _Myios::setstate(_Chcount == 0 ? _State | ios_base::failbit : _State); return *this; } basic_istream& ignore(streamsize _Count = 1, int_type _Metadelim = _Traits::eof()) { ios_base::iostate _State = ios_base::goodbit; _Chcount = 0; const sentry _Ok(*this, true); if (_Ok && 0 < _Count) { try { for (;;) { int_type _Meta; if (_Count != (numeric_limits<streamsize>::max)() && --_Count < 0) { break; } else if (_Traits::eq_int_type(_Traits::eof(), _Meta = _Myios::rdbuf()->sbumpc())) { _State |= ios_base::eofbit; break; } else { _Increment_gcount(); if (_Meta == _Metadelim) { break; } } } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } _Myios::setstate(_State); return *this; } basic_istream& read(_Elem* _Str, streamsize _Count) { ios_base::iostate _State = ios_base::goodbit; _Chcount = 0; const sentry _Ok(*this, true); if (_Ok && 0 < _Count) { try { const streamsize _Num = _Myios::rdbuf()->sgetn(_Str, _Count); _Chcount = _Num; if (_Num != _Count) { _State |= ios_base::eofbit | ios_base::failbit; } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } _Myios::setstate(_State); return *this; } streamsize readsome(_Elem* _Str, streamsize _Count) { ios_base::iostate _State = ios_base::goodbit; _Chcount = 0; const sentry _Ok(*this, true); streamsize _Num; if (!_Ok) { _State |= ios_base::failbit; } else if ((_Num = _Myios::rdbuf()->in_avail()) < 0) { _State |= ios_base::eofbit; } else if (0 < _Count && 0 < _Num) { read(_Str, _Num < _Count ? _Num : _Count); } _Myios::setstate(_State); return gcount(); } int_type peek() { ios_base::iostate _State = ios_base::goodbit; _Chcount = 0; int_type _Meta = 0; const sentry _Ok(*this, true); if (!_Ok) { _Meta = _Traits::eof(); } else { try { if (_Traits::eq_int_type(_Traits::eof(), _Meta = _Myios::rdbuf()->sgetc())) { _State |= ios_base::eofbit; } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } _Myios::setstate(_State); return _Meta; } basic_istream& putback(_Elem _Ch) { _Chcount = 0; ios_base::iostate _State = ios_base::goodbit; ios_base::iostate _Oldstate = _Myios::rdstate(); _Myios::clear(_Oldstate & ~ios_base::eofbit); const sentry _Ok(*this, true); if (_Ok) { try { if (_Traits::eq_int_type(_Traits::eof(), _Myios::rdbuf()->sputbackc(_Ch))) { _State |= ios_base::badbit | _Oldstate; } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } _Myios::setstate(_State); return *this; } basic_istream& unget() { _Chcount = 0; ios_base::iostate _State = ios_base::goodbit; ios_base::iostate _Oldstate = _Myios::rdstate(); _Myios::clear(_Oldstate & ~ios_base::eofbit); const sentry _Ok(*this, true); if (_Ok) { try { if (_Traits::eq_int_type(_Traits::eof(), _Myios::rdbuf()->sungetc())) { _State |= ios_base::badbit | _Oldstate; } } catch (...) { _Myios::setstate(ios_base::badbit, true); } } _Myios::setstate(_State); return *this; } [[nodiscard]] streamsize gcount() const { return _Chcount; } int sync() { const sentry _Ok(*this, true); const auto _Rdbuf = _Myios::rdbuf(); if (!_Rdbuf) { return -1; } bool _Sync_failed = true; try { _Sync_failed = _Rdbuf->pubsync() == -1; } catch (...) { _Myios::setstate(ios_base::badbit, true); } if (_Sync_failed) { _Myios::setstate(ios_base::badbit); return -1; } return 0; } basic_istream& seekg(pos_type _Pos) { ios_base::iostate _State = ios_base::goodbit; ios_base::iostate _Oldstate = _Myios::rdstate(); _Myios::clear(_Oldstate & ~ios_base::eofbit); const sentry _Ok(*this, true); if (!this->fail() && static_cast<off_type>(_Myios::rdbuf()->pubseekpos(_Pos, ios_base::in)) == -1) { _Myios::setstate(_State | ios_base::failbit); } return *this; } basic_istream& seekg( off_type _Off, ios_base::seekdir _Way) { ios_base::iostate _State = ios_base::goodbit; ios_base::iostate _Oldstate = _Myios::rdstate(); _Myios::clear(_Oldstate & ~ios_base::eofbit); const sentry _Ok(*this, true); if (!this->fail() && static_cast<off_type>(_Myios::rdbuf()->pubseekoff(_Off, _Way, ios_base::in)) == -1) { _Myios::setstate(_State | ios_base::failbit); } return *this; } pos_type tellg() { const sentry _Ok(*this, true); if (!this->fail()) { return _Myios::rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in); } else { return pos_type(-1); } } private: streamsize _Chcount; }; #pragma vtordisp(pop) template class __declspec(dllimport) basic_istream<char, char_traits<char>>; template class __declspec(dllimport) basic_istream<wchar_t, char_traits<wchar_t>>; template <class _Elem, class _Traits> class basic_iostream : public basic_istream<_Elem, _Traits>, public basic_ostream<_Elem, _Traits> { public: using _Myis = basic_istream<_Elem, _Traits>; using _Myos = basic_ostream<_Elem, _Traits>; using _Myios = basic_ios<_Elem, _Traits>; using char_type = _Elem; using traits_type = _Traits; using int_type = typename _Traits::int_type; using pos_type = typename _Traits::pos_type; using off_type = typename _Traits::off_type; explicit basic_iostream(basic_streambuf<_Elem, _Traits>* _Strbuf) : _Myis(_Strbuf, false), _Myos(_Noinit, false) {} protected: basic_iostream(basic_iostream&& _Right) : _Myis(_Right.rdbuf(), false), _Myos(_Noinit, false) { _Myios::init(); _Myios::move(::std:: move(_Right)); } basic_iostream& operator=(basic_iostream&& _Right) { this->swap(_Right); return *this; } void swap(basic_iostream& _Right) { if (this != ::std:: addressof(_Right)) { _Myios::swap(_Right); } } public: basic_iostream(const basic_iostream&) = delete; basic_iostream& operator=(const basic_iostream&) = delete; virtual ~basic_iostream() noexcept {} }; template class __declspec(dllimport) basic_iostream<char, char_traits<char>>; template class __declspec(dllimport) basic_iostream<wchar_t, char_traits<wchar_t>>; template <class _Elem, class _Traits> basic_istream<_Elem, _Traits>& _Istream_extract_into_buffer( basic_istream<_Elem, _Traits>& _Istr, size_t _Size, _Elem* _Str) { using _Myis = basic_istream<_Elem, _Traits>; using _Ctype = ctype<_Elem>; ios_base::iostate _State = ios_base::goodbit; size_t _Current = 0; const typename _Myis::sentry _Ok(_Istr); if (_Ok) { const _Ctype& _Ctype_fac = ::std:: use_facet<_Ctype>(_Istr.getloc()); try { size_t _Count = _Size; const size_t _Width = static_cast<size_t>(_Istr.width()); if (_Width > 0 && _Width < _Size) { _Count = _Width; } typename _Myis::int_type _Meta = _Istr.rdbuf()->sgetc(); _Elem _Ch; for (; _Current < _Count - 1; _Meta = _Istr.rdbuf()->snextc(), (void) ++_Current) { if (_Traits::eq_int_type(_Traits::eof(), _Meta)) { _State |= ios_base::eofbit; break; } else if (_Ctype_fac.is(_Ctype::space, _Ch = _Traits::to_char_type(_Meta)) || _Ch == _Elem()) { break; } else { _Str[_Current] = _Traits::to_char_type(_Meta); } } } catch (...) { (_Istr) .setstate(ios_base::badbit, true); } } ; _Str[_Current] = _Elem(); _Istr.width(0); if (_Current == 0) { _State |= ios_base::failbit; } _Istr.setstate(_State); return _Istr; } #pragma warning(push) #pragma warning(disable : 6001) template <class _Elem, class _Traits, size_t _Size> basic_istream<_Elem, _Traits>& operator>>( basic_istream<_Elem, _Traits>& _Istr, _Elem (&_Str)[_Size]) { return _Istream_extract_into_buffer(_Istr, _Size, _Str); } template <class _Traits, size_t _Size> basic_istream<char, _Traits>& operator>>( basic_istream<char, _Traits>& _Istr, signed char (&_Str)[_Size]) { return _Istream_extract_into_buffer(_Istr, _Size, reinterpret_cast<char*>(_Str)); } template <class _Traits, size_t _Size> basic_istream<char, _Traits>& operator>>( basic_istream<char, _Traits>& _Istr, unsigned char (&_Str)[_Size]) { return _Istream_extract_into_buffer(_Istr, _Size, reinterpret_cast<char*>(_Str)); } #pragma warning(pop) template <class _Elem, class _Traits> basic_istream<_Elem, _Traits>& operator>>(basic_istream<_Elem, _Traits>& _Istr, _Elem& _Ch) { using _Myis = basic_istream<_Elem, _Traits>; typename _Myis::int_type _Meta; ios_base::iostate _State = ios_base::goodbit; const typename _Myis::sentry _Ok(_Istr); if (_Ok) { try { _Meta = _Istr.rdbuf()->sbumpc(); if (_Traits::eq_int_type(_Traits::eof(), _Meta)) { _State |= ios_base::eofbit | ios_base::failbit; } else { _Ch = _Traits::to_char_type(_Meta); } } catch (...) { (_Istr) .setstate(ios_base::badbit, true); } } _Istr.setstate(_State); return _Istr; } template <class _Traits> basic_istream<char, _Traits>& operator>>( basic_istream<char, _Traits>& _Istr, signed char& _Ch) { return _Istr >> reinterpret_cast<char&>(_Ch); } template <class _Traits> basic_istream<char, _Traits>& operator>>( basic_istream<char, _Traits>& _Istr, unsigned char& _Ch) { return _Istr >> reinterpret_cast<char&>(_Ch); } template <class _Istr, class _Ty, class = void> struct _Can_stream_in : false_type {}; template <class _Istr, class _Ty> struct _Can_stream_in<_Istr, _Ty, void_t<decltype(::std:: declval<_Istr&>() >> ::std:: declval<_Ty>())>> : true_type {}; template <class _Istr, class _Ty, enable_if_t<conjunction_v<is_convertible<_Istr*, ios_base*>, _Can_stream_in<_Istr, _Ty>>, int> = 0> _Istr&& operator>>(_Istr&& _Is, _Ty&& _Val) { _Is >> ::std:: forward<_Ty>(_Val); return ::std:: move(_Is); } template <class _Elem, class _Traits> basic_istream<_Elem, _Traits>& __cdecl ws(basic_istream<_Elem, _Traits>& _Istr) { const typename basic_istream<_Elem, _Traits>::sentry _Ok(_Istr, true); if (_Ok) { ios_base::iostate _State = ios_base::goodbit; const auto& _Ctype_fac = ::std:: use_facet<ctype<_Elem>>(_Istr.getloc()); try { for (typename _Traits::int_type _Meta = _Istr.rdbuf()->sgetc();; _Meta = _Istr.rdbuf()->snextc()) { if (_Traits::eq_int_type(_Traits::eof(), _Meta)) { _State |= ios_base::eofbit; break; } else if (!_Ctype_fac.is(ctype<_Elem>::space, _Traits::to_char_type(_Meta))) { break; } } } catch (...) { (_Istr) .setstate(ios_base::badbit, true); } _Istr.setstate(_State); } return _Istr; } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { template <class _Elem, class _Traits, class _Alloc> basic_istream<_Elem, _Traits>& getline(basic_istream<_Elem, _Traits>&& _Istr, basic_string<_Elem, _Traits, _Alloc>& _Str, const _Elem _Delim) { using _Myis = basic_istream<_Elem, _Traits>; typename _Myis::iostate _State = _Myis::goodbit; bool _Changed = false; const typename _Myis::sentry _Ok(_Istr, true); if (_Ok) { try { _Str.erase(); const typename _Traits::int_type _Metadelim = _Traits::to_int_type(_Delim); typename _Traits::int_type _Meta = _Istr.rdbuf()->sgetc(); for (;; _Meta = _Istr.rdbuf()->snextc()) { if (_Traits::eq_int_type(_Traits::eof(), _Meta)) { _State |= _Myis::eofbit; break; } else if (_Traits::eq_int_type(_Meta, _Metadelim)) { _Changed = true; _Istr.rdbuf()->sbumpc(); break; } else if (_Str.max_size() <= _Str.size()) { _State |= _Myis::failbit; break; } else { _Str += _Traits::to_char_type(_Meta); _Changed = true; } } } catch (...) { (_Istr) .setstate(_Myis::badbit, true); } } if (!_Changed) { _State |= _Myis::failbit; } _Istr.setstate(_State); return _Istr; } template <class _Elem, class _Traits, class _Alloc> basic_istream<_Elem, _Traits>& getline(basic_istream<_Elem, _Traits>&& _Istr, basic_string<_Elem, _Traits, _Alloc>& _Str) { return getline(_Istr, _Str, _Istr.widen('\n')); } template <class _Elem, class _Traits, class _Alloc> basic_istream<_Elem, _Traits>& getline(basic_istream<_Elem, _Traits>& _Istr, basic_string<_Elem, _Traits, _Alloc>& _Str, const _Elem _Delim) { return getline(::std:: move(_Istr), _Str, _Delim); } template <class _Elem, class _Traits, class _Alloc> basic_istream<_Elem, _Traits>& getline(basic_istream<_Elem, _Traits>& _Istr, basic_string<_Elem, _Traits, _Alloc>& _Str) { return getline(::std:: move(_Istr), _Str, _Istr.widen('\n')); } inline int stoi(const string& _Str, size_t* _Idx = nullptr, int _Base = 10) { int& _Errno_ref = (*_errno()); const char* _Ptr = _Str.c_str(); char* _Eptr; _Errno_ref = 0; const long _Ans = :: strtol(_Ptr, &_Eptr, _Base); if (_Ptr == _Eptr) { _Xinvalid_argument("invalid stoi argument"); } if (_Errno_ref == 34 || _Ans < (-2147483647 - 1) || 2147483647 < _Ans) { _Xout_of_range("stoi argument out of range"); } if (_Idx) { *_Idx = static_cast<size_t>(_Eptr - _Ptr); } return static_cast<int>(_Ans); } inline long stol(const string& _Str, size_t* _Idx = nullptr, int _Base = 10) { int& _Errno_ref = (*_errno()); const char* _Ptr = _Str.c_str(); char* _Eptr; _Errno_ref = 0; const long _Ans = :: strtol(_Ptr, &_Eptr, _Base); if (_Ptr == _Eptr) { _Xinvalid_argument("invalid stol argument"); } if (_Errno_ref == 34) { _Xout_of_range("stol argument out of range"); } if (_Idx) { *_Idx = static_cast<size_t>(_Eptr - _Ptr); } return _Ans; } inline unsigned long stoul(const string& _Str, size_t* _Idx = nullptr, int _Base = 10) { int& _Errno_ref = (*_errno()); const char* _Ptr = _Str.c_str(); char* _Eptr; _Errno_ref = 0; const unsigned long _Ans = :: strtoul(_Ptr, &_Eptr, _Base); if (_Ptr == _Eptr) { _Xinvalid_argument("invalid stoul argument"); } if (_Errno_ref == 34) { _Xout_of_range("stoul argument out of range"); } if (_Idx) { *_Idx = static_cast<size_t>(_Eptr - _Ptr); } return _Ans; } inline long long stoll(const string& _Str, size_t* _Idx = nullptr, int _Base = 10) { int& _Errno_ref = (*_errno()); const char* _Ptr = _Str.c_str(); char* _Eptr; _Errno_ref = 0; const long long _Ans = :: strtoll(_Ptr, &_Eptr, _Base); if (_Ptr == _Eptr) { _Xinvalid_argument("invalid stoll argument"); } if (_Errno_ref == 34) { _Xout_of_range("stoll argument out of range"); } if (_Idx) { *_Idx = static_cast<size_t>(_Eptr - _Ptr); } return _Ans; } inline unsigned long long stoull(const string& _Str, size_t* _Idx = nullptr, int _Base = 10) { int& _Errno_ref = (*_errno()); const char* _Ptr = _Str.c_str(); char* _Eptr; _Errno_ref = 0; const unsigned long long _Ans = :: strtoull(_Ptr, &_Eptr, _Base); if (_Ptr == _Eptr) { _Xinvalid_argument("invalid stoull argument"); } if (_Errno_ref == 34) { _Xout_of_range("stoull argument out of range"); } if (_Idx) { *_Idx = static_cast<size_t>(_Eptr - _Ptr); } return _Ans; } inline float stof(const string& _Str, size_t* _Idx = nullptr) { int& _Errno_ref = (*_errno()); const char* _Ptr = _Str.c_str(); char* _Eptr; _Errno_ref = 0; const float _Ans = :: strtof(_Ptr, &_Eptr); if (_Ptr == _Eptr) { _Xinvalid_argument("invalid stof argument"); } if (_Errno_ref == 34) { _Xout_of_range("stof argument out of range"); } if (_Idx) { *_Idx = static_cast<size_t>(_Eptr - _Ptr); } return _Ans; } inline double stod(const string& _Str, size_t* _Idx = nullptr) { int& _Errno_ref = (*_errno()); const char* _Ptr = _Str.c_str(); char* _Eptr; _Errno_ref = 0; const double _Ans = :: strtod(_Ptr, &_Eptr); if (_Ptr == _Eptr) { _Xinvalid_argument("invalid stod argument"); } if (_Errno_ref == 34) { _Xout_of_range("stod argument out of range"); } if (_Idx) { *_Idx = static_cast<size_t>(_Eptr - _Ptr); } return _Ans; } inline long double stold(const string& _Str, size_t* _Idx = nullptr) { int& _Errno_ref = (*_errno()); const char* _Ptr = _Str.c_str(); char* _Eptr; _Errno_ref = 0; const long double _Ans = :: strtold(_Ptr, &_Eptr); if (_Ptr == _Eptr) { _Xinvalid_argument("invalid stold argument"); } if (_Errno_ref == 34) { _Xout_of_range("stold argument out of range"); } if (_Idx) { *_Idx = static_cast<size_t>(_Eptr - _Ptr); } return _Ans; } inline int stoi(const wstring& _Str, size_t* _Idx = nullptr, int _Base = 10) { int& _Errno_ref = (*_errno()); const wchar_t* _Ptr = _Str.c_str(); wchar_t* _Eptr; _Errno_ref = 0; const long _Ans = :: wcstol(_Ptr, &_Eptr, _Base); if (_Ptr == _Eptr) { _Xinvalid_argument("invalid stoi argument"); } if (_Errno_ref == 34 || _Ans < (-2147483647 - 1) || 2147483647 < _Ans) { _Xout_of_range("stoi argument out of range"); } if (_Idx) { *_Idx = static_cast<size_t>(_Eptr - _Ptr); } return static_cast<int>(_Ans); } inline long stol(const wstring& _Str, size_t* _Idx = nullptr, int _Base = 10) { int& _Errno_ref = (*_errno()); const wchar_t* _Ptr = _Str.c_str(); wchar_t* _Eptr; _Errno_ref = 0; const long _Ans = :: wcstol(_Ptr, &_Eptr, _Base); if (_Ptr == _Eptr) { _Xinvalid_argument("invalid stol argument"); } if (_Errno_ref == 34) { _Xout_of_range("stol argument out of range"); } if (_Idx) { *_Idx = static_cast<size_t>(_Eptr - _Ptr); } return _Ans; } inline unsigned long stoul(const wstring& _Str, size_t* _Idx = nullptr, int _Base = 10) { int& _Errno_ref = (*_errno()); const wchar_t* _Ptr = _Str.c_str(); wchar_t* _Eptr; _Errno_ref = 0; const unsigned long _Ans = :: wcstoul(_Ptr, &_Eptr, _Base); if (_Ptr == _Eptr) { _Xinvalid_argument("invalid stoul argument"); } if (_Errno_ref == 34) { _Xout_of_range("stoul argument out of range"); } if (_Idx) { *_Idx = static_cast<size_t>(_Eptr - _Ptr); } return _Ans; } inline long long stoll(const wstring& _Str, size_t* _Idx = nullptr, int _Base = 10) { int& _Errno_ref = (*_errno()); const wchar_t* _Ptr = _Str.c_str(); wchar_t* _Eptr; _Errno_ref = 0; const long long _Ans = :: wcstoll(_Ptr, &_Eptr, _Base); if (_Ptr == _Eptr) { _Xinvalid_argument("invalid stoll argument"); } if (_Errno_ref == 34) { _Xout_of_range("stoll argument out of range"); } if (_Idx) { *_Idx = static_cast<size_t>(_Eptr - _Ptr); } return _Ans; } inline unsigned long long stoull(const wstring& _Str, size_t* _Idx = nullptr, int _Base = 10) { int& _Errno_ref = (*_errno()); const wchar_t* _Ptr = _Str.c_str(); wchar_t* _Eptr; _Errno_ref = 0; const unsigned long long _Ans = :: wcstoull(_Ptr, &_Eptr, _Base); if (_Ptr == _Eptr) { _Xinvalid_argument("invalid stoull argument"); } if (_Errno_ref == 34) { _Xout_of_range("stoull argument out of range"); } if (_Idx) { *_Idx = static_cast<size_t>(_Eptr - _Ptr); } return _Ans; } inline float stof(const wstring& _Str, size_t* _Idx = nullptr) { int& _Errno_ref = (*_errno()); const wchar_t* _Ptr = _Str.c_str(); wchar_t* _Eptr; _Errno_ref = 0; const float _Ans = :: wcstof(_Ptr, &_Eptr); if (_Ptr == _Eptr) { _Xinvalid_argument("invalid stof argument"); } if (_Errno_ref == 34) { _Xout_of_range("stof argument out of range"); } if (_Idx) { *_Idx = static_cast<size_t>(_Eptr - _Ptr); } return _Ans; } inline double stod(const wstring& _Str, size_t* _Idx = nullptr) { int& _Errno_ref = (*_errno()); const wchar_t* _Ptr = _Str.c_str(); wchar_t* _Eptr; _Errno_ref = 0; const double _Ans = :: wcstod(_Ptr, &_Eptr); if (_Ptr == _Eptr) { _Xinvalid_argument("invalid stod argument"); } if (_Errno_ref == 34) { _Xout_of_range("stod argument out of range"); } if (_Idx) { *_Idx = static_cast<size_t>(_Eptr - _Ptr); } return _Ans; } inline long double stold(const wstring& _Str, size_t* _Idx = nullptr) { int& _Errno_ref = (*_errno()); const wchar_t* _Ptr = _Str.c_str(); wchar_t* _Eptr; _Errno_ref = 0; const long double _Ans = :: wcstold(_Ptr, &_Eptr); if (_Ptr == _Eptr) { _Xinvalid_argument("invalid stold argument"); } if (_Errno_ref == 34) { _Xout_of_range("stold argument out of range"); } if (_Idx) { *_Idx = static_cast<size_t>(_Eptr - _Ptr); } return _Ans; } template <class _Elem, class _UTy> _Elem* _UIntegral_to_buff(_Elem* _RNext, _UTy _UVal) { static_assert(is_unsigned_v<_UTy>, "_UTy must be unsigned"); auto _UVal_trunc = _UVal; do { *--_RNext = static_cast<_Elem>('0' + _UVal_trunc % 10); _UVal_trunc /= 10; } while (_UVal_trunc != 0); return _RNext; } template <class _Elem, class _Ty> basic_string<_Elem> _Integral_to_string(const _Ty _Val) { static_assert(is_integral_v<_Ty>, "_Ty must be integral"); using _UTy = make_unsigned_t<_Ty>; _Elem _Buff[21]; _Elem* const _Buff_end = ::std:: end(_Buff); _Elem* _RNext = _Buff_end; const auto _UVal = static_cast<_UTy>(_Val); if (_Val < 0) { _RNext = _UIntegral_to_buff(_RNext, 0 - _UVal); *--_RNext = '-'; } else { _RNext = _UIntegral_to_buff(_RNext, _UVal); } return basic_string<_Elem>(_RNext, _Buff_end); } template <class _Elem, class _Ty> basic_string<_Elem> _UIntegral_to_string(const _Ty _Val) { static_assert(is_integral_v<_Ty>, "_Ty must be integral"); static_assert(is_unsigned_v<_Ty>, "_Ty must be unsigned"); _Elem _Buff[21]; _Elem* const _Buff_end = ::std:: end(_Buff); _Elem* const _RNext = _UIntegral_to_buff(_Buff_end, _Val); return basic_string<_Elem>(_RNext, _Buff_end); } [[nodiscard]] inline string to_string(int _Val) { return _Integral_to_string<char>(_Val); } [[nodiscard]] inline string to_string(unsigned int _Val) { return _UIntegral_to_string<char>(_Val); } [[nodiscard]] inline string to_string(long _Val) { return _Integral_to_string<char>(_Val); } [[nodiscard]] inline string to_string(unsigned long _Val) { return _UIntegral_to_string<char>(_Val); } [[nodiscard]] inline string to_string(long long _Val) { return _Integral_to_string<char>(_Val); } [[nodiscard]] inline string to_string(unsigned long long _Val) { return _UIntegral_to_string<char>(_Val); } [[nodiscard]] inline string to_string(double _Val) { const auto _Len = static_cast<size_t>(:: _scprintf("%f", _Val)); string _Str(_Len, '\0'); :: sprintf_s(&_Str[0], _Len + 1, "%f", _Val); return _Str; } [[nodiscard]] inline string to_string(float _Val) { return ::std:: to_string(static_cast<double>(_Val)); } [[nodiscard]] inline string to_string(long double _Val) { return ::std:: to_string(static_cast<double>(_Val)); } [[nodiscard]] inline wstring to_wstring(int _Val) { return _Integral_to_string<wchar_t>(_Val); } [[nodiscard]] inline wstring to_wstring(unsigned int _Val) { return _UIntegral_to_string<wchar_t>(_Val); } [[nodiscard]] inline wstring to_wstring(long _Val) { return _Integral_to_string<wchar_t>(_Val); } [[nodiscard]] inline wstring to_wstring(unsigned long _Val) { return _UIntegral_to_string<wchar_t>(_Val); } [[nodiscard]] inline wstring to_wstring(long long _Val) { return _Integral_to_string<wchar_t>(_Val); } [[nodiscard]] inline wstring to_wstring(unsigned long long _Val) { return _UIntegral_to_string<wchar_t>(_Val); } [[nodiscard]] inline wstring to_wstring(double _Val) { const auto _Len = static_cast<size_t>(:: _scwprintf(L"%f", _Val)); wstring _Str(_Len, L'\0'); :: swprintf_s(&_Str[0], _Len + 1, L"%f", _Val); return _Str; } [[nodiscard]] inline wstring to_wstring(float _Val) { return ::std:: to_wstring(static_cast<double>(_Val)); } [[nodiscard]] inline wstring to_wstring(long double _Val) { return ::std:: to_wstring(static_cast<double>(_Val)); } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { template <class _Elem, class _Traits, class _Alloc> class basic_stringbuf : public basic_streambuf<_Elem, _Traits> { public: using allocator_type = _Alloc; using _Mysb = basic_streambuf<_Elem, _Traits>; using _Mystr = basic_string<_Elem, _Traits, _Alloc>; using _Mysize_type = typename _Mystr::size_type; using _Mystr_view = basic_string_view<_Elem, _Traits>; basic_stringbuf() : _Seekhigh(nullptr), _Mystate(_Getstate(ios_base::in | ios_base::out)), _Al() {} explicit basic_stringbuf(ios_base::openmode _Mode) : _Seekhigh(nullptr), _Mystate(_Getstate(_Mode)), _Al() {} explicit basic_stringbuf(const _Mystr& _Str, ios_base::openmode _Mode = ios_base::in | ios_base::out) : _Al(_Str.get_allocator()) { _Init(_Str.c_str(), _Str.size(), _Getstate(_Mode)); } explicit basic_stringbuf(const _Alloc& _Al_) : basic_stringbuf(ios_base::in | ios_base::out, _Al_) {} basic_stringbuf(ios_base::openmode _Mode, const _Alloc& _Al_) : _Seekhigh(nullptr), _Mystate(_Getstate(_Mode)), _Al(_Al_) {} explicit basic_stringbuf(_Mystr&& _Str, ios_base::openmode _Mode = ios_base::in | ios_base::out) : _Al(::std:: move(_Str._Getal())) { _Init_string_inplace(::std:: move(_Str), _Getstate(_Mode)); } template <class _Alloc2> basic_stringbuf(const basic_string<_Elem, _Traits, _Alloc2>& _Str, ios_base::openmode _Mode, const _Alloc& _Al_) : _Al(_Al_) { _Init(_Str.c_str(), _Str.size(), _Getstate(_Mode)); } template <class _Alloc2> basic_stringbuf(const basic_string<_Elem, _Traits, _Alloc2>& _Str, const _Alloc& _Al_) : basic_stringbuf(_Str, ios_base::in | ios_base::out, _Al_) {} template <class _Alloc2, enable_if_t<!is_same_v<_Alloc2, _Alloc>, int> = 0> explicit basic_stringbuf( const basic_string<_Elem, _Traits, _Alloc2>& _Str, ios_base::openmode _Mode = ios_base::in | ios_base::out) : basic_stringbuf(_Str, _Mode, _Alloc{}) {} basic_stringbuf(basic_stringbuf&& _Right, const _Alloc& _Al_) : _Al(_Al_) { _Assign_rv(::std:: move(_Right)); } basic_stringbuf(basic_stringbuf&& _Right) { _Assign_rv(::std:: move(_Right)); } basic_stringbuf& operator=(basic_stringbuf&& _Right) { _Assign_rv(::std:: move(_Right)); return *this; } void _Assign_rv(basic_stringbuf&& _Right) { if (this != ::std:: addressof(_Right)) { _Tidy(); this->swap(_Right); } } void swap(basic_stringbuf& _Right) noexcept { if (this != ::std:: addressof(_Right)) { if constexpr (!allocator_traits<_Alloc>::propagate_on_container_swap::value) { do { if (_Al == _Right._Al) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\sstream", 96, 0, "%s", "The allocators of basic_stringbuf should propagate or be equal on swap.")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"The allocators of basic_stringbuf should propagate or be equal on swap.\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\sstream", 96, 0); } while (false); } ; } while (false); } _Mysb::swap(_Right); ::std:: swap(_Seekhigh, _Right._Seekhigh); ::std:: swap(_Mystate, _Right._Mystate); _Pocs(_Al, _Right._Al); } } basic_stringbuf(const basic_stringbuf&) = delete; basic_stringbuf& operator=(const basic_stringbuf&) = delete; virtual ~basic_stringbuf() noexcept { _Tidy(); } enum { _Allocated = 1, _Constant = 2, _Noread = 4, _Append = 8, _Atend = 16, _From_rvalue = 32 }; using int_type = typename _Traits::int_type; using pos_type = typename _Traits::pos_type; using off_type = typename _Traits::off_type; struct _Buffer_view { _Elem* _Ptr; _Mysize_type _Size; _Mysize_type _Res; }; [[nodiscard]] _Buffer_view _Get_buffer_view() const noexcept { _Buffer_view _Result{}; if ((!(_Mystate & _Constant) || (_Mystate & _From_rvalue)) && _Mysb::pptr()) { const auto _Base = _Mysb::pbase(); _Result._Ptr = _Base; _Result._Size = static_cast<_Mysize_type>((::std:: max)(_Mysb::pptr(), _Seekhigh) - _Base); _Result._Res = static_cast<_Mysize_type>(_Mysb::epptr() - _Base); } else if (!(_Mystate & _Noread) && _Mysb::gptr()) { const auto _Base = _Mysb::eback(); _Result._Ptr = _Base; _Result._Size = static_cast<_Mysize_type>(_Mysb::egptr() - _Base); _Result._Res = _Result._Size; } return _Result; } [[nodiscard]] _Mystr str() const& { _Mystr _Result(_Al); const auto _View = _Get_buffer_view(); if (_View._Ptr) { _Result.assign(_View._Ptr, _View._Size); } return _Result; } void str(const _Mystr& _Newstr) { _Tidy(); _Init(_Newstr.c_str(), _Newstr.size(), _Mystate); } template <class _Alloc2, enable_if_t<_Is_allocator<_Alloc2>::value, int> = 0> [[nodiscard]] basic_string<_Elem, _Traits, _Alloc2> str(const _Alloc2& _Al) const { return basic_string<_Elem, _Traits, _Alloc2>{view(), _Al}; } [[nodiscard]] _Mystr str() && { _Mystr _Result{_String_constructor_rvalue_allocator_tag{}, ::std:: move(_Al)}; const auto _View = _Get_buffer_view(); if (_View._Size == _View._Res) { _Result.assign(_View._Ptr, _View._Size); } else { _Traits::assign(_View._Ptr[_View._Size], _Elem()); if (_Result._Move_assign_from_buffer(_View._Ptr, _View._Size, _View._Res)) { _Mystate &= ~_Allocated; } } _Tidy(); return _Result; } [[nodiscard]] _Mystr_view view() const noexcept { const auto _View = _Get_buffer_view(); return _Mystr_view{_View._Ptr, _View._Size}; } template <class _Alloc2, enable_if_t<!is_same_v<_Alloc2, _Alloc>, int> = 0> void str(const basic_string<_Elem, _Traits, _Alloc2>& _Newstr) { _Tidy(); _Init(_Newstr.c_str(), _Newstr.size(), _Mystate); } void _Str(_Mystr&& _Newstr, _Equal_allocators) { _Tidy(); _Pocma(_Al, _Newstr._Getal()); _Init_string_inplace(::std:: move(_Newstr), _Mystate); } void _Str(_Mystr&& _Newstr, _Propagate_allocators) { _Str(::std:: move(_Newstr), _Equal_allocators{}); } void _Str(_Mystr&& _Newstr, _No_propagate_allocators) { if (_Al == _Newstr._Getal()) { _Str(::std:: move(_Newstr), _Equal_allocators{}); } else { _Tidy(); _Init(_Newstr.c_str(), _Newstr.size(), _Mystate); } } void str(_Mystr&& _Newstr) { _Str(::std:: move(_Newstr), _Choose_pocma<_Alloc>{}); } [[nodiscard]] allocator_type get_allocator() const noexcept { return _Al; } protected: virtual int_type overflow(int_type _Meta = _Traits::eof()) { if (_Mystate & _Constant) { return _Traits::eof(); } if (_Traits::eq_int_type(_Traits::eof(), _Meta)) { return _Traits::not_eof(_Meta); } const auto _Pptr = _Mysb::pptr(); const auto _Epptr = _Mysb::epptr(); if (_Pptr && _Pptr < _Epptr) { *_Mysb::_Pninc() = _Traits::to_char_type(_Meta); _Seekhigh = _Pptr + 1; return _Meta; } size_t _Oldsize = 0; const auto _Oldptr = _Mysb::eback(); if (_Pptr) { _Oldsize = static_cast<size_t>(_Epptr - _Oldptr); } size_t _Newsize; if (_Oldsize < _MINSIZE) { _Newsize = _MINSIZE; } else if (_Oldsize < 2147483647 / 2) { _Newsize = _Oldsize << 1; } else if (_Oldsize < 2147483647) { _Newsize = 2147483647; } else { return _Traits::eof(); } const auto _Newptr = _Unfancy(_Al.allocate(_Newsize)); _Traits::copy(_Newptr, _Oldptr, _Oldsize); const auto _New_pnext = _Newptr + _Oldsize; _Seekhigh = _New_pnext + 1; _Mysb::setp(_Newptr, _New_pnext, _Newptr + _Newsize); if (_Mystate & _Noread) { _Mysb::setg(_Newptr, nullptr, _Newptr); } else { _Mysb::setg(_Newptr, _Newptr + (_Mysb::gptr() - _Oldptr), _Seekhigh); } if (_Mystate & _Allocated) { _Al.deallocate(_Ptr_traits::pointer_to(*_Oldptr), _Oldsize); } _Mystate |= _Allocated; *_Mysb::_Pninc() = _Traits::to_char_type(_Meta); return _Meta; } virtual int_type pbackfail(int_type _Meta = _Traits::eof()) { const auto _Gptr = _Mysb::gptr(); if (!_Gptr || _Gptr <= _Mysb::eback() || (!_Traits::eq_int_type(_Traits::eof(), _Meta) && !_Traits::eq(_Traits::to_char_type(_Meta), _Gptr[-1]) && (_Mystate & _Constant))) { return _Traits::eof(); } _Mysb::gbump(-1); if (!_Traits::eq_int_type(_Traits::eof(), _Meta)) { *_Mysb::gptr() = _Traits::to_char_type(_Meta); } return _Traits::not_eof(_Meta); } virtual int_type underflow() { const auto _Gptr = _Mysb::gptr(); if (!_Gptr) { return _Traits::eof(); } if (_Gptr < _Mysb::egptr()) { return _Traits::to_int_type(*_Gptr); } const auto _Pptr = _Mysb::pptr(); if (!_Pptr || (_Mystate & _Noread)) { return _Traits::eof(); } const auto _Local_highwater = (::std:: max)(_Seekhigh, _Pptr); if (_Local_highwater <= _Gptr) { return _Traits::eof(); } _Seekhigh = _Local_highwater; _Mysb::setg(_Mysb::eback(), _Mysb::gptr(), _Local_highwater); return _Traits::to_int_type(*_Mysb::gptr()); } virtual pos_type seekoff( off_type _Off, ios_base::seekdir _Way, ios_base::openmode _Mode = ios_base::in | ios_base::out) { const auto _Gptr_old = _Mysb::gptr(); const auto _Pptr_old = (_Mystate & _Constant) ? nullptr : _Mysb::pptr(); if (_Pptr_old && _Seekhigh < _Pptr_old) { _Seekhigh = _Pptr_old; } const auto _Seeklow = _Mysb::eback(); const auto _Seekdist = _Seekhigh - _Seeklow; off_type _Newoff; switch (_Way) { case ios_base::beg: _Newoff = 0; break; case ios_base::end: _Newoff = _Seekdist; break; case ios_base::cur: { constexpr auto _Both = ios_base::in | ios_base::out; if ((_Mode & _Both) != _Both) { if (_Mode & ios_base::in) { if (_Gptr_old || !_Seeklow) { _Newoff = _Gptr_old - _Seeklow; break; } } else if ((_Mode & ios_base::out) && (_Pptr_old || !_Seeklow)) { _Newoff = _Pptr_old - _Seeklow; break; } } } default: return pos_type(off_type(-1)); } if (static_cast<unsigned long long>(_Off) + _Newoff > static_cast<unsigned long long>(_Seekdist)) { return pos_type(off_type(-1)); } _Off += _Newoff; if (_Off != 0 && (((_Mode & ios_base::in) && !_Gptr_old) || ((_Mode & ios_base::out) && !_Pptr_old))) { return pos_type(off_type(-1)); } const auto _Newptr = _Seeklow + _Off; if ((_Mode & ios_base::in) && _Gptr_old) { _Mysb::setg(_Seeklow, _Newptr, _Seekhigh); } if ((_Mode & ios_base::out) && _Pptr_old) { _Mysb::setp(_Seeklow, _Newptr, _Mysb::epptr()); } return pos_type(_Off); } virtual pos_type seekpos(pos_type _Pos, ios_base::openmode _Mode = ios_base::in | ios_base::out) { const auto _Off = static_cast<streamoff>(_Pos); const auto _Gptr_old = _Mysb::gptr(); const auto _Pptr_old = (_Mystate & _Constant) ? nullptr : _Mysb::pptr(); if (_Pptr_old && _Seekhigh < _Pptr_old) { _Seekhigh = _Pptr_old; } const auto _Seeklow = _Mysb::eback(); const auto _Seekdist = _Seekhigh - _Seeklow; if (static_cast<unsigned long long>(_Off) > static_cast<unsigned long long>(_Seekdist)) { return pos_type(off_type(-1)); } if (_Off != 0 && (((_Mode & ios_base::in) && !_Gptr_old) || ((_Mode & ios_base::out) && !_Pptr_old))) { return pos_type(off_type(-1)); } const auto _Newptr = _Seeklow + _Off; if ((_Mode & ios_base::in) && _Gptr_old) { _Mysb::setg(_Seeklow, _Newptr, _Seekhigh); } if ((_Mode & ios_base::out) && _Pptr_old) { _Mysb::setp(_Seeklow, _Newptr, _Mysb::epptr()); } return pos_type(_Off); } protected: void _Init(const _Elem* _Ptr, _Mysize_type _Count, int _State) { _State &= ~_From_rvalue; if (_Count > 2147483647) { _Xbad_alloc(); } if (_Count != 0 && (_State & (_Noread | _Constant)) != (_Noread | _Constant)) { const auto _Pnew = _Unfancy(_Al.allocate(_Count)); _Traits::copy(_Pnew, _Ptr, _Count); _Seekhigh = _Pnew + _Count; if (!(_State & _Noread)) { _Mysb::setg(_Pnew, _Pnew, _Seekhigh); } if (!(_State & _Constant)) { _Mysb::setp(_Pnew, (_State & (_Atend | _Append)) ? _Seekhigh : _Pnew, _Seekhigh); if (_State & _Noread) { _Mysb::setg(_Pnew, nullptr, _Pnew); } } _State |= _Allocated; } else { _Seekhigh = nullptr; } _Mystate = _State; } void _Init_string_inplace(_Mystr&& _Str, int _State) { _State |= _From_rvalue; auto [_Ptr, _Size, _Res] = _Str._Release_to_buffer(_Al); _Elem* const _Pnew = _Unfancy(_Ptr); if (_Res != 0 && (_State & (_Noread | _Constant)) != (_Noread | _Constant)) { _Seekhigh = _Pnew + _Size; auto _End_buffer = _Pnew + _Res; _Mysb::setp(_Pnew, (_State & (_Atend | _Append)) ? _Seekhigh : _Pnew, _End_buffer); if (_State & _Noread) { _Mysb::setg(_Pnew, nullptr, _Pnew); } else { _Mysb::setg(_Pnew, _Pnew, _Seekhigh); } _State |= _Allocated; } else { _Seekhigh = nullptr; } _Mystate = _State; } void _Tidy() noexcept { if (_Mystate & _Allocated) { _Al.deallocate(_Ptr_traits::pointer_to(*_Mysb::eback()), static_cast<typename allocator_traits<allocator_type>::size_type>( (_Mysb::pptr() ? _Mysb::epptr() : _Mysb::egptr()) - _Mysb::eback())); } _Mysb::setg(nullptr, nullptr, nullptr); _Mysb::setp(nullptr, nullptr); _Seekhigh = nullptr; _Mystate &= ~_Allocated; } private: using _Ptr_traits = pointer_traits<typename allocator_traits<allocator_type>::pointer>; enum { _MINSIZE = 32 }; static int _Getstate(ios_base::openmode _Mode) { int _State = 0; if (!(_Mode & ios_base::in)) { _State |= _Noread; } if (!(_Mode & ios_base::out)) { _State |= _Constant; } if (_Mode & ios_base::app) { _State |= _Append; } if (_Mode & ios_base::ate) { _State |= _Atend; } return _State; } _Elem* _Seekhigh; int _Mystate; allocator_type _Al; }; template <class _Elem, class _Traits, class _Alloc> void swap(basic_stringbuf<_Elem, _Traits, _Alloc>& _Left, basic_stringbuf<_Elem, _Traits, _Alloc>& _Right) noexcept { _Left.swap(_Right); } template <class _Elem, class _Traits, class _Alloc> class basic_istringstream : public basic_istream<_Elem, _Traits> { public: using _Mybase = basic_istream<_Elem, _Traits>; using allocator_type = _Alloc; using _Mysb = basic_stringbuf<_Elem, _Traits, _Alloc>; using _Mystr = basic_string<_Elem, _Traits, _Alloc>; using _Mystr_view = basic_string_view<_Elem, _Traits>; basic_istringstream() : _Mybase(::std:: addressof(_Stringbuffer)), _Stringbuffer(ios_base::in) {} explicit basic_istringstream(ios_base::openmode _Mode) : _Mybase(::std:: addressof(_Stringbuffer)), _Stringbuffer(_Mode | ios_base::in) {} explicit basic_istringstream(const _Mystr& _Str, ios_base::openmode _Mode = ios_base::in) : _Mybase(::std:: addressof(_Stringbuffer)), _Stringbuffer(_Str, _Mode | ios_base::in) {} basic_istringstream(ios_base::openmode _Mode, const _Alloc& _Al) : _Mybase(::std:: addressof(_Stringbuffer)), _Stringbuffer(_Mode | ios_base::in, _Al) {} explicit basic_istringstream(_Mystr&& _Str, ios_base::openmode _Mode = ios_base::in) : _Mybase(::std:: addressof(_Stringbuffer)), _Stringbuffer(::std:: move(_Str), _Mode | ios_base::in) {} template <class _Alloc2> basic_istringstream(const basic_string<_Elem, _Traits, _Alloc2>& _Str, const _Alloc& _Al) : _Mybase(::std:: addressof(_Stringbuffer)), _Stringbuffer(_Str, ios_base::in, _Al) {} template <class _Alloc2> basic_istringstream(const basic_string<_Elem, _Traits, _Alloc2>& _Str, ios_base::openmode _Mode, const _Alloc& _Al) : _Mybase(::std:: addressof(_Stringbuffer)), _Stringbuffer(_Str, _Mode | ios_base::in, _Al) {} template <class _Alloc2, enable_if_t<!is_same_v<_Alloc2, _Alloc>, int> = 0> explicit basic_istringstream( const basic_string<_Elem, _Traits, _Alloc2>& _Str, ios_base::openmode _Mode = ios_base::in) : _Mybase(::std:: addressof(_Stringbuffer)), _Stringbuffer(_Str, _Mode | ios_base::in) {} basic_istringstream(basic_istringstream&& _Right) : _Mybase(::std:: addressof(_Stringbuffer)) { _Assign_rv(::std:: move(_Right)); } basic_istringstream& operator=(basic_istringstream&& _Right) { _Assign_rv(::std:: move(_Right)); return *this; } void _Assign_rv(basic_istringstream&& _Right) { if (this != ::std:: addressof(_Right)) { _Stringbuffer.str(_Mystr()); this->swap(_Right); } } void swap(basic_istringstream& _Right) { if (this != ::std:: addressof(_Right)) { _Mybase::swap(_Right); _Stringbuffer.swap(_Right._Stringbuffer); } } basic_istringstream(const basic_istringstream&) = delete; basic_istringstream& operator=(const basic_istringstream&) = delete; virtual ~basic_istringstream() noexcept {} [[nodiscard]] _Mysb* rdbuf() const { return const_cast<_Mysb*>(::std:: addressof(_Stringbuffer)); } [[nodiscard]] _Mystr str() const& { return _Stringbuffer.str(); } void str(const _Mystr& _Newstr) { _Stringbuffer.str(_Newstr); } template <class _Alloc2, enable_if_t<_Is_allocator<_Alloc2>::value, int> = 0> [[nodiscard]] basic_string<_Elem, _Traits, _Alloc2> str(const _Alloc2& _Al) const { return _Stringbuffer.str(_Al); } [[nodiscard]] _Mystr str() && { return ::std:: move(_Stringbuffer).str(); } [[nodiscard]] _Mystr_view view() const noexcept { return _Stringbuffer.view(); } template <class _Alloc2, enable_if_t<!is_same_v<_Alloc2, _Alloc>, int> = 0> void str(const basic_string<_Elem, _Traits, _Alloc2>& _Newstr) { _Stringbuffer.str(_Newstr); } void str(_Mystr&& _Newstr) { _Stringbuffer.str(::std:: move(_Newstr)); } private: _Mysb _Stringbuffer; }; template <class _Elem, class _Traits, class _Alloc> void swap(basic_istringstream<_Elem, _Traits, _Alloc>& _Left, basic_istringstream<_Elem, _Traits, _Alloc>& _Right) { _Left.swap(_Right); } template <class _Elem, class _Traits, class _Alloc> class basic_ostringstream : public basic_ostream<_Elem, _Traits> { public: using _Mybase = basic_ostream<_Elem, _Traits>; using allocator_type = _Alloc; using _Mysb = basic_stringbuf<_Elem, _Traits, _Alloc>; using _Mystr = basic_string<_Elem, _Traits, _Alloc>; using _Mystr_view = basic_string_view<_Elem, _Traits>; basic_ostringstream() : _Mybase(::std:: addressof(_Stringbuffer)), _Stringbuffer(ios_base::out) {} explicit basic_ostringstream(ios_base::openmode _Mode) : _Mybase(::std:: addressof(_Stringbuffer)), _Stringbuffer(_Mode | ios_base::out) {} explicit basic_ostringstream(const _Mystr& _Str, ios_base::openmode _Mode = ios_base::out) : _Mybase(::std:: addressof(_Stringbuffer)), _Stringbuffer(_Str, _Mode | ios_base::out) {} basic_ostringstream(ios_base::openmode _Mode, const _Alloc& _Al) : _Mybase(::std:: addressof(_Stringbuffer)), _Stringbuffer(_Mode | ios_base::out, _Al) {} explicit basic_ostringstream(_Mystr&& _Str, ios_base::openmode _Mode = ios_base::out) : _Mybase(::std:: addressof(_Stringbuffer)), _Stringbuffer(::std:: move(_Str), _Mode | ios_base::out) {} template <class _Alloc2> basic_ostringstream(const basic_string<_Elem, _Traits, _Alloc2>& _Str, const _Alloc& _Al) : _Mybase(::std:: addressof(_Stringbuffer)), _Stringbuffer(_Str, ios_base::out, _Al) {} template <class _Alloc2> basic_ostringstream(const basic_string<_Elem, _Traits, _Alloc2>& _Str, ios_base::openmode _Mode, const _Alloc& _Al) : _Mybase(::std:: addressof(_Stringbuffer)), _Stringbuffer(_Str, _Mode | ios_base::out, _Al) {} template <class _Alloc2, enable_if_t<!is_same_v<_Alloc2, _Alloc>, int> = 0> explicit basic_ostringstream( const basic_string<_Elem, _Traits, _Alloc2>& _Str, ios_base::openmode _Mode = ios_base::out) : _Mybase(::std:: addressof(_Stringbuffer)), _Stringbuffer(_Str, _Mode | ios_base::out) {} basic_ostringstream(basic_ostringstream&& _Right) : _Mybase(::std:: addressof(_Stringbuffer)) { _Assign_rv(::std:: move(_Right)); } basic_ostringstream& operator=(basic_ostringstream&& _Right) { _Assign_rv(::std:: move(_Right)); return *this; } void _Assign_rv(basic_ostringstream&& _Right) { if (this != ::std:: addressof(_Right)) { _Stringbuffer.str(_Mystr()); this->swap(_Right); } } void swap(basic_ostringstream& _Right) { if (this != ::std:: addressof(_Right)) { _Mybase::swap(_Right); _Stringbuffer.swap(_Right._Stringbuffer); } } basic_ostringstream(const basic_ostringstream&) = delete; basic_ostringstream& operator=(const basic_ostringstream&) = delete; virtual ~basic_ostringstream() noexcept {} [[nodiscard]] _Mysb* rdbuf() const { return const_cast<_Mysb*>(::std:: addressof(_Stringbuffer)); } [[nodiscard]] _Mystr str() const& { return _Stringbuffer.str(); } void str(const _Mystr& _Newstr) { _Stringbuffer.str(_Newstr); } template <class _Alloc2, enable_if_t<_Is_allocator<_Alloc2>::value, int> = 0> [[nodiscard]] basic_string<_Elem, _Traits, _Alloc2> str(const _Alloc2& _Al) const { return _Stringbuffer.str(_Al); } [[nodiscard]] _Mystr str() && { return ::std:: move(_Stringbuffer).str(); } [[nodiscard]] _Mystr_view view() const noexcept { return _Stringbuffer.view(); } template <class _Alloc2, enable_if_t<!is_same_v<_Alloc2, _Alloc>, int> = 0> void str(const basic_string<_Elem, _Traits, _Alloc2>& _Newstr) { _Stringbuffer.str(_Newstr); } void str(_Mystr&& _Newstr) { _Stringbuffer.str(::std:: move(_Newstr)); } private: _Mysb _Stringbuffer; }; template <class _Elem, class _Traits, class _Alloc> void swap(basic_ostringstream<_Elem, _Traits, _Alloc>& _Left, basic_ostringstream<_Elem, _Traits, _Alloc>& _Right) { _Left.swap(_Right); } template <class _Elem, class _Traits, class _Alloc> class basic_stringstream : public basic_iostream<_Elem, _Traits> { public: using _Mybase = basic_iostream<_Elem, _Traits>; using char_type = _Elem; using traits_type = _Traits; using allocator_type = _Alloc; using int_type = typename _Traits::int_type; using pos_type = typename _Traits::pos_type; using off_type = typename _Traits::off_type; using _Mysb = basic_stringbuf<_Elem, _Traits, _Alloc>; using _Mystr = basic_string<_Elem, _Traits, _Alloc>; using _Mystr_view = basic_string_view<_Elem, _Traits>; basic_stringstream() : _Mybase(::std:: addressof(_Stringbuffer)), _Stringbuffer(ios_base::in | ios_base::out) {} explicit basic_stringstream(ios_base::openmode _Mode) : _Mybase(::std:: addressof(_Stringbuffer)), _Stringbuffer(_Mode) {} explicit basic_stringstream(const _Mystr& _Str, ios_base::openmode _Mode = ios_base::in | ios_base::out) : _Mybase(::std:: addressof(_Stringbuffer)), _Stringbuffer(_Str, _Mode) {} basic_stringstream(ios_base::openmode _Mode, const _Alloc& _Al) : _Mybase(::std:: addressof(_Stringbuffer)), _Stringbuffer(_Mode, _Al) {} explicit basic_stringstream(_Mystr&& _Str, ios_base::openmode _Mode = ios_base::in | ios_base::out) : _Mybase(::std:: addressof(_Stringbuffer)), _Stringbuffer(::std:: move(_Str), _Mode) {} template <class _Alloc2> basic_stringstream(const basic_string<_Elem, _Traits, _Alloc2>& _Str, const _Alloc& _Al) : _Mybase(::std:: addressof(_Stringbuffer)), _Stringbuffer(_Str, ios_base::in | ios_base::out, _Al) {} template <class _Alloc2> basic_stringstream(const basic_string<_Elem, _Traits, _Alloc2>& _Str, ios_base::openmode _Mode, const _Alloc& _Al) : _Mybase(::std:: addressof(_Stringbuffer)), _Stringbuffer(_Str, _Mode, _Al) {} template <class _Alloc2, enable_if_t<!is_same_v<_Alloc2, _Alloc>, int> = 0> explicit basic_stringstream( const basic_string<_Elem, _Traits, _Alloc2>& _Str, ios_base::openmode _Mode = ios_base::in | ios_base::out) : _Mybase(::std:: addressof(_Stringbuffer)), _Stringbuffer(_Str, _Mode) {} basic_stringstream(basic_stringstream&& _Right) : _Mybase(::std:: addressof(_Stringbuffer)) { _Assign_rv(::std:: move(_Right)); } basic_stringstream& operator=(basic_stringstream&& _Right) { _Assign_rv(::std:: move(_Right)); return *this; } void _Assign_rv(basic_stringstream&& _Right) { if (this != ::std:: addressof(_Right)) { _Stringbuffer.str(_Mystr()); this->swap(_Right); } } void swap(basic_stringstream& _Right) { if (this != ::std:: addressof(_Right)) { _Mybase::swap(_Right); _Stringbuffer.swap(_Right._Stringbuffer); } } basic_stringstream(const basic_stringstream&) = delete; basic_stringstream& operator=(const basic_stringstream&) = delete; virtual ~basic_stringstream() noexcept {} [[nodiscard]] _Mysb* rdbuf() const { return const_cast<_Mysb*>(::std:: addressof(_Stringbuffer)); } [[nodiscard]] _Mystr str() const& { return _Stringbuffer.str(); } void str(const _Mystr& _Newstr) { _Stringbuffer.str(_Newstr); } template <class _Alloc2, enable_if_t<_Is_allocator<_Alloc2>::value, int> = 0> [[nodiscard]] basic_string<_Elem, _Traits, _Alloc2> str(const _Alloc2& _Al) const { return _Stringbuffer.str(_Al); } [[nodiscard]] _Mystr str() && { return ::std:: move(_Stringbuffer).str(); } [[nodiscard]] _Mystr_view view() const noexcept { return _Stringbuffer.view(); } template <class _Alloc2, enable_if_t<!is_same_v<_Alloc2, _Alloc>, int> = 0> void str(const basic_string<_Elem, _Traits, _Alloc2>& _Newstr) { _Stringbuffer.str(_Newstr); } void str(_Mystr&& _Newstr) { _Stringbuffer.str(::std:: move(_Newstr)); } private: _Mysb _Stringbuffer; }; template <class _Elem, class _Traits, class _Alloc> void swap(basic_stringstream<_Elem, _Traits, _Alloc>& _Left, basic_stringstream<_Elem, _Traits, _Alloc>& _Right) { _Left.swap(_Right); } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) class AdvancedAssert { public: static void setLoggingFunc(const std::function<void (const char*)>& func); inline static void logAssertion(const char* condition, const char* func, int line) { if (_loggingFunc) { std::ostringstream stream; stream << "Assertion failed at " << func << ", line " << line << ": " << condition; _loggingFunc(stream.str().c_str()); } } inline static void logMessage(std::string message, const char* func, int line) { if (!_loggingFunc) return; std::ostringstream stream; stream << func << ", line " << line << ": " << message; _loggingFunc(stream.str().c_str()); } private: static std::function<void (const char*)> _loggingFunc; }; #pragma once template <typename T> struct is_trivially_serializable { using BaseT = std::remove_cv_t<T>; static constexpr bool value = !std::is_pointer_v<T> && !std::is_reference_v<BaseT> && std::is_same_v<BaseT, std::decay_t<BaseT>> && std::is_trivially_copyable_v<BaseT> && std::is_standard_layout_v<BaseT>; }; template <typename T> constexpr bool is_trivially_serializable_v = is_trivially_serializable<T>::value; template <typename T> using remove_cv_and_reference_t = std::remove_cv_t<std::remove_reference_t<std::remove_cv_t<T>>>; template<class, template<class...> class> inline constexpr bool is_specialization_of_v = false; template<template<class...> class T, class... Args> inline constexpr bool is_specialization_of_v<T<Args...>, T> = true; namespace detail { template <class Class, typename FieldType> constexpr FieldType member_type_from_ptr(FieldType Class::*) { return {}; } } template <auto memberPointer> using member_type_from_ptr_t = decltype(detail::member_type_from_ptr(memberPointer)); template <typename L, typename R, typename = std::void_t<>> struct is_equal_comparable : std::false_type {}; template <typename L, typename R> struct is_equal_comparable<L, R, std::void_t<decltype(std::declval<L>() == std::declval<R>())>> : std::true_type {}; template <typename L, typename R> constexpr bool is_equal_comparable_v = is_equal_comparable<L, R>::value; template <typename T> struct type_printer { template <typename U = T> void print() { static_assert(fail<U>); } private: template <typename> static constexpr bool fail = false; }; #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { template <class _InIt, class _Ty, class _Fn> [[nodiscard]] constexpr _Ty accumulate(const _InIt _First, const _InIt _Last, _Ty _Val, _Fn _Reduce_op) { _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); for (; _UFirst != _ULast; ++_UFirst) { _Val = _Reduce_op(::std:: move(_Val), *_UFirst); } return _Val; } template <class _InIt, class _Ty> [[nodiscard]] constexpr _Ty accumulate(const _InIt _First, const _InIt _Last, _Ty _Val) { return ::std:: accumulate(_First, _Last, _Val, plus<>{}); } template <class _InIt, class _Ty, class _BinOp> inline constexpr bool _Plus_on_arithmetic_ranges_reduction_v = conjunction_v<is_arithmetic<_Ty>, is_arithmetic<remove_pointer_t<_InIt>>, is_same<plus<>, _BinOp>>; #pragma float_control(precise, off, push) template <class _InIt, class _Ty> _Ty _Reduce_plus_arithmetic_ranges(_InIt _First, const _InIt _Last, _Ty _Val) { #pragma loop(ivdep) for (; _First != _Last; ++_First) { _Val += *_First; } return _Val; } #pragma float_control(pop) template <class _InIt, class _Ty, class _BinOp> [[nodiscard]] constexpr _Ty reduce(const _InIt _First, const _InIt _Last, _Ty _Val, _BinOp _Reduce_op) { _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); if constexpr (_Plus_on_arithmetic_ranges_reduction_v<_Unwrapped_t<const _InIt&>, _Ty, _BinOp>) { if (!::std:: is_constant_evaluated()) { return _Reduce_plus_arithmetic_ranges(_UFirst, _ULast, _Val); } } for (; _UFirst != _ULast; ++_UFirst) { _Val = _Reduce_op(::std:: move(_Val), *_UFirst); } return _Val; } template <class _InIt, class _Ty> [[nodiscard]] constexpr _Ty reduce(const _InIt _First, const _InIt _Last, _Ty _Val) { return ::std:: reduce(_First, _Last, ::std:: move(_Val), plus{}); } template <class _InIt> [[nodiscard]] constexpr _Iter_value_t<_InIt> reduce(const _InIt _First, const _InIt _Last) { return ::std:: reduce(_First, _Last, _Iter_value_t<_InIt>{}, plus{}); } template <class _ExPo, class _FwdIt, class _Ty, class _BinOp, _Enable_if_execution_policy_t<_ExPo> = 0> [[nodiscard]] _Ty reduce(_ExPo&& _Exec, _FwdIt _First, _FwdIt _Last, _Ty _Val, _BinOp _Reduce_op) noexcept; template <class _ExPo, class _FwdIt, class _Ty, _Enable_if_execution_policy_t<_ExPo> = 0> [[nodiscard]] _Ty reduce(_ExPo&& _Exec, const _FwdIt _First, const _FwdIt _Last, _Ty _Val) noexcept { static_assert(_Is_fwd_iter_v<_FwdIt>, "Parallel algorithms require forward iterators or stronger."); return ::std:: reduce(::std:: forward<_ExPo>(_Exec), _First, _Last, ::std:: move(_Val), plus{}); } template <class _ExPo, class _FwdIt, _Enable_if_execution_policy_t<_ExPo> = 0> [[nodiscard]] _Iter_value_t<_FwdIt> reduce(_ExPo&& _Exec, const _FwdIt _First, const _FwdIt _Last) noexcept { static_assert(_Is_fwd_iter_v<_FwdIt>, "Parallel algorithms require forward iterators or stronger."); return ::std:: reduce(::std:: forward<_ExPo>(_Exec), _First, _Last, _Iter_value_t<_FwdIt>{}, plus{}); } template <class _InIt1, class _InIt2, class _Ty, class _BinOp1, class _BinOp2> [[nodiscard]] constexpr _Ty inner_product( _InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _Ty _Val, _BinOp1 _Reduce_op, _BinOp2 _Transform_op) { _Adl_verify_range(_First1, _Last1); auto _UFirst1 = _Get_unwrapped(_First1); const auto _ULast1 = _Get_unwrapped(_Last1); auto _UFirst2 = _Get_unwrapped_n(_First2, _Idl_distance<_InIt1>(_UFirst1, _ULast1)); for (; _UFirst1 != _ULast1; ++_UFirst1, (void) ++_UFirst2) { _Val = _Reduce_op(::std:: move(_Val), _Transform_op(*_UFirst1, *_UFirst2)); } return _Val; } template <class _InIt1, class _InIt2, class _Ty> [[nodiscard]] constexpr _Ty inner_product(const _InIt1 _First1, const _InIt1 _Last1, const _InIt2 _First2, _Ty _Val) { return ::std:: inner_product(_First1, _Last1, _First2, ::std:: move(_Val), plus<>{}, multiplies<>{}); } template <class _InIt1, class _InIt2, class _Ty, class _BinOp1, class _BinOp2> inline constexpr bool _Default_ops_transform_reduce_v = conjunction_v<is_arithmetic<_Ty>, is_arithmetic<remove_pointer_t<_InIt1>>, is_arithmetic<remove_pointer_t<_InIt2>>, is_same<plus<>, _BinOp1>, is_same<multiplies<>, _BinOp2>>; #pragma float_control(precise, off, push) template <class _InIt1, class _InIt2, class _Ty> _Ty _Transform_reduce_arithmetic_defaults(_InIt1 _First1, const _InIt1 _Last1, _InIt2 _First2, _Ty _Val) { #pragma loop(ivdep) for (; _First1 != _Last1; ++_First1, (void) ++_First2) { _Val += *_First1 * *_First2; } return _Val; } #pragma float_control(pop) template <class _InIt1, class _InIt2, class _Ty, class _BinOp1, class _BinOp2> [[nodiscard]] constexpr _Ty transform_reduce( _InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _Ty _Val, _BinOp1 _Reduce_op, _BinOp2 _Transform_op) { _Adl_verify_range(_First1, _Last1); auto _UFirst1 = _Get_unwrapped(_First1); const auto _ULast1 = _Get_unwrapped(_Last1); auto _UFirst2 = _Get_unwrapped_n(_First2, _Idl_distance<_InIt1>(_UFirst1, _ULast1)); if constexpr (_Default_ops_transform_reduce_v<_Unwrapped_t<const _InIt1&>, _Unwrapped_t<const _InIt2&>, _Ty, _BinOp1, _BinOp2>) { if (!::std:: is_constant_evaluated()) { return _Transform_reduce_arithmetic_defaults(_UFirst1, _ULast1, _UFirst2, ::std:: move(_Val)); } } for (; _UFirst1 != _ULast1; ++_UFirst1, (void) ++_UFirst2) { _Val = _Reduce_op(::std:: move(_Val), _Transform_op(*_UFirst1, *_UFirst2)); } return _Val; } template <class _InIt1, class _InIt2, class _Ty> [[nodiscard]] constexpr _Ty transform_reduce(_InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _Ty _Val) { return ::std:: transform_reduce(_First1, _Last1, _First2, ::std:: move(_Val), plus{}, multiplies{}); } template <class _InIt, class _Ty, class _BinOp, class _UnaryOp> [[nodiscard]] constexpr _Ty transform_reduce( const _InIt _First, const _InIt _Last, _Ty _Val, _BinOp _Reduce_op, _UnaryOp _Transform_op) { _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); for (; _UFirst != _ULast; ++_UFirst) { _Val = _Reduce_op(::std:: move(_Val), _Transform_op(*_UFirst)); } return _Val; } template <class _ExPo, class _FwdIt1, class _FwdIt2, class _Ty, class _BinOp1, class _BinOp2, _Enable_if_execution_policy_t<_ExPo> = 0> [[nodiscard]] _Ty transform_reduce(_ExPo&& _Exec, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _Ty _Val, _BinOp1 _Reduce_op, _BinOp2 _Transform_op) noexcept; template <class _ExPo, class _FwdIt1, class _FwdIt2, class _Ty, _Enable_if_execution_policy_t<_ExPo> = 0> [[nodiscard]] _Ty transform_reduce(_ExPo&& _Exec, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _Ty _Val) noexcept { static_assert(_Is_fwd_iter_v<_FwdIt1>, "Parallel algorithms require forward iterators or stronger."); static_assert(_Is_fwd_iter_v<_FwdIt2>, "Parallel algorithms require forward iterators or stronger."); return ::std:: transform_reduce( ::std:: forward<_ExPo>(_Exec), _First1, _Last1, _First2, ::std:: move(_Val), plus{}, multiplies{}); } template <class _ExPo, class _FwdIt, class _Ty, class _BinOp, class _UnaryOp, _Enable_if_execution_policy_t<_ExPo> = 0> [[nodiscard]] _Ty transform_reduce(_ExPo&& _Exec, const _FwdIt _First1, const _FwdIt _Last1, _Ty _Val, _BinOp _Reduce_op, _UnaryOp _Transform_op) noexcept; template <class _InIt, class _OutIt, class _BinOp> constexpr _OutIt partial_sum(const _InIt _First, const _InIt _Last, _OutIt _Dest, _BinOp _Reduce_op) { _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); auto _UDest = _Get_unwrapped_n(_Dest, _Idl_distance<_InIt>(_UFirst, _ULast)); if (_UFirst != _ULast) { _Iter_value_t<_InIt> _Val(*_UFirst); for (;;) { *_UDest = _Val; ++_UDest; ++_UFirst; if (_UFirst == _ULast) { break; } _Val = _Reduce_op(::std:: move(_Val), *_UFirst); } } _Seek_wrapped(_Dest, _UDest); return _Dest; } template <class _InIt, class _OutIt> constexpr _OutIt partial_sum(_InIt _First, _InIt _Last, _OutIt _Dest) { return ::std:: partial_sum(_First, _Last, _Dest, plus<>{}); } template <class _InIt, class _OutIt, class _Ty, class _BinOp> constexpr _OutIt exclusive_scan(const _InIt _First, const _InIt _Last, _OutIt _Dest, _Ty _Val, _BinOp _Reduce_op) { _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); auto _UDest = _Get_unwrapped_n(_Dest, _Idl_distance<_InIt>(_UFirst, _ULast)); if (_UFirst != _ULast) { for (;;) { _Ty _Tmp(_Reduce_op(_Val, *_UFirst)); *_UDest = _Val; ++_UDest; ++_UFirst; if (_UFirst == _ULast) { break; } _Val = ::std:: move(_Tmp); } } _Seek_wrapped(_Dest, _UDest); return _Dest; } template <class _InIt, class _OutIt, class _Ty> constexpr _OutIt exclusive_scan(const _InIt _First, const _InIt _Last, const _OutIt _Dest, _Ty _Val) { return ::std:: exclusive_scan(_First, _Last, _Dest, ::std:: move(_Val), plus{}); } template <class _ExPo, class _FwdIt1, class _FwdIt2, class _Ty, class _BinOp, _Enable_if_execution_policy_t<_ExPo> = 0> _FwdIt2 exclusive_scan(_ExPo&& _Exec, const _FwdIt1 _First, const _FwdIt1 _Last, _FwdIt2 _Dest, _Ty _Val, _BinOp _Reduce_op) noexcept; template <class _ExPo, class _FwdIt1, class _FwdIt2, class _Ty, _Enable_if_execution_policy_t<_ExPo> = 0> _FwdIt2 exclusive_scan(_ExPo&& _Exec, const _FwdIt1 _First, const _FwdIt1 _Last, const _FwdIt2 _Dest, _Ty _Val) noexcept { return ::std:: exclusive_scan(::std:: forward<_ExPo>(_Exec), _First, _Last, _Dest, ::std:: move(_Val), plus{}); } template <class _InIt, class _OutIt, class _Ty, class _BinOp> constexpr _OutIt inclusive_scan(const _InIt _First, const _InIt _Last, _OutIt _Dest, _BinOp _Reduce_op, _Ty _Val) { _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); auto _UDest = _Get_unwrapped_n(_Dest, _Idl_distance<_InIt>(_UFirst, _ULast)); for (; _UFirst != _ULast; ++_UFirst) { _Val = _Reduce_op(::std:: move(_Val), *_UFirst); *_UDest = _Val; ++_UDest; } _Seek_wrapped(_Dest, _UDest); return _Dest; } template <class _InIt, class _OutIt, class _BinOp> constexpr _OutIt inclusive_scan(const _InIt _First, const _InIt _Last, _OutIt _Dest, _BinOp _Reduce_op) { _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); auto _UDest = _Get_unwrapped_n(_Dest, _Idl_distance<_InIt>(_UFirst, _ULast)); if (_UFirst != _ULast) { _Iter_value_t<_InIt> _Val = *_UFirst; for (;;) { *_UDest = _Val; ++_UDest; ++_UFirst; if (_UFirst == _ULast) { break; } _Val = _Reduce_op(::std:: move(_Val), *_UFirst); } } _Seek_wrapped(_Dest, _UDest); return _Dest; } template <class _InIt, class _OutIt> constexpr _OutIt inclusive_scan(const _InIt _First, const _InIt _Last, const _OutIt _Dest) { return ::std:: inclusive_scan(_First, _Last, _Dest, plus{}); } template <class _ExPo, class _FwdIt1, class _FwdIt2, class _BinOp, class _Ty, _Enable_if_execution_policy_t<_ExPo> = 0> _FwdIt2 inclusive_scan( _ExPo&& _Exec, _FwdIt1 _First, _FwdIt1 _Last, _FwdIt2 _Dest, _BinOp _Reduce_op, _Ty _Val) noexcept; template <class _ExPo, class _FwdIt1, class _FwdIt2, class _BinOp, _Enable_if_execution_policy_t<_ExPo> = 0> _FwdIt2 inclusive_scan( _ExPo&& _Exec, _FwdIt1 _First, _FwdIt1 _Last, _FwdIt2 _Dest, _BinOp _Reduce_op) noexcept; template <class _ExPo, class _FwdIt1, class _FwdIt2, _Enable_if_execution_policy_t<_ExPo> = 0> _FwdIt2 inclusive_scan(_ExPo&& _Exec, const _FwdIt1 _First, const _FwdIt1 _Last, const _FwdIt2 _Dest) noexcept { return ::std:: inclusive_scan(::std:: forward<_ExPo>(_Exec), _First, _Last, _Dest, plus{}); } template <class _InIt, class _OutIt, class _Ty, class _BinOp, class _UnaryOp> constexpr _OutIt transform_exclusive_scan( const _InIt _First, const _InIt _Last, _OutIt _Dest, _Ty _Val, _BinOp _Reduce_op, _UnaryOp _Transform_op) { _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); auto _UDest = _Get_unwrapped_n(_Dest, _Idl_distance<_InIt>(_UFirst, _ULast)); if (_UFirst != _ULast) { for (;;) { _Ty _Tmp(_Reduce_op(_Val, _Transform_op(*_UFirst))); *_UDest = _Val; ++_UDest; ++_UFirst; if (_UFirst == _ULast) { break; } _Val = ::std:: move(_Tmp); } } _Seek_wrapped(_Dest, _UDest); return _Dest; } template <class _ExPo, class _FwdIt1, class _OutIt, class _Ty, class _BinOp, class _UnaryOp, _Enable_if_execution_policy_t<_ExPo> = 0> _OutIt transform_exclusive_scan(_ExPo&& _Exec, const _FwdIt1 _First, const _FwdIt1 _Last, _OutIt _Dest, _Ty _Val, _BinOp _Reduce_op, _UnaryOp _Transform_op) noexcept; template <class _InIt, class _OutIt, class _Ty, class _BinOp, class _UnaryOp> constexpr _OutIt transform_inclusive_scan( const _InIt _First, const _InIt _Last, _OutIt _Dest, _BinOp _Reduce_op, _UnaryOp _Transform_op, _Ty _Val) { _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); auto _UDest = _Get_unwrapped_n(_Dest, _Idl_distance<_InIt>(_UFirst, _ULast)); for (; _UFirst != _ULast; ++_UFirst) { _Val = _Reduce_op(::std:: move(_Val), _Transform_op(*_UFirst)); *_UDest = _Val; ++_UDest; } _Seek_wrapped(_Dest, _UDest); return _Dest; } template <class _InIt, class _OutIt, class _BinOp, class _UnaryOp> constexpr _OutIt transform_inclusive_scan( const _InIt _First, const _InIt _Last, _OutIt _Dest, _BinOp _Reduce_op, _UnaryOp _Transform_op) { _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); auto _UDest = _Get_unwrapped_n(_Dest, _Idl_distance<_InIt>(_UFirst, _ULast)); if (_UFirst != _ULast) { auto _Val = _Transform_op(*_UFirst); for (;;) { *_UDest = _Val; ++_UDest; ++_UFirst; if (_UFirst == _ULast) { break; } _Val = _Reduce_op(::std:: move(_Val), _Transform_op(*_UFirst)); } } _Seek_wrapped(_Dest, _UDest); return _Dest; } template <class _ExPo, class _FwdIt1, class _FwdIt2, class _Ty, class _BinOp, class _UnaryOp, _Enable_if_execution_policy_t<_ExPo> = 0> _FwdIt2 transform_inclusive_scan(_ExPo&& _Exec, const _FwdIt1 _First, const _FwdIt1 _Last, _FwdIt2 _Dest, _BinOp _Reduce_op, _UnaryOp _Transform_op, _Ty _Val) noexcept; template <class _ExPo, class _FwdIt1, class _FwdIt2, class _BinOp, class _UnaryOp, _Enable_if_execution_policy_t<_ExPo> = 0> _FwdIt2 transform_inclusive_scan(_ExPo&& _Exec, const _FwdIt1 _First, const _FwdIt1 _Last, _FwdIt2 _Dest, _BinOp _Reduce_op, _UnaryOp _Transform_op) noexcept; template <class _InIt, class _OutIt, class _BinOp> constexpr _OutIt adjacent_difference(const _InIt _First, const _InIt _Last, _OutIt _Dest, _BinOp _Func) { _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); auto _UDest = _Get_unwrapped_n(_Dest, _Idl_distance<_InIt>(_UFirst, _ULast)); if (_UFirst != _ULast) { _Iter_value_t<_InIt> _Val = *_UFirst; *_UDest = _Val; while (++_UFirst != _ULast) { _Iter_value_t<_InIt> _Tmp = *_UFirst; *++_UDest = _Func(_Tmp, ::std:: move(_Val)); _Val = ::std:: move(_Tmp); } ++_UDest; } _Seek_wrapped(_Dest, _UDest); return _Dest; } template <class _InIt, class _OutIt> constexpr _OutIt adjacent_difference(const _InIt _First, const _InIt _Last, const _OutIt _Dest) { return ::std:: adjacent_difference(_First, _Last, _Dest, minus<>{}); } template <class _ExPo, class _FwdIt1, class _FwdIt2, class _BinOp, _Enable_if_execution_policy_t<_ExPo> = 0> _FwdIt2 adjacent_difference( _ExPo&& _Exec, const _FwdIt1 _First, const _FwdIt1 _Last, _FwdIt2 _Dest, _BinOp _Diff_op) noexcept; template <class _ExPo, class _FwdIt1, class _FwdIt2, _Enable_if_execution_policy_t<_ExPo> = 0> _FwdIt2 adjacent_difference(_ExPo&& _Exec, const _FwdIt1 _First, const _FwdIt1 _Last, const _FwdIt2 _Dest) noexcept { return ::std:: adjacent_difference(::std:: forward<_ExPo>(_Exec), _First, _Last, _Dest, minus{}); } template <class _FwdIt, class _Ty> constexpr void iota(_FwdIt _First, _FwdIt _Last, _Ty _Val) { _Adl_verify_range(_First, _Last); auto _UFirst = _Get_unwrapped(_First); const auto _ULast = _Get_unwrapped(_Last); for (; _UFirst != _ULast; ++_UFirst, (void) ++_Val) { *_UFirst = _Val; } } template <class _Integral> [[nodiscard]] constexpr auto _Abs_u(const _Integral _Val) noexcept { static_assert(is_integral_v<_Integral>); if constexpr (is_signed_v<_Integral>) { using _Unsigned = make_unsigned_t<_Integral>; if (_Val < 0) { return static_cast<_Unsigned>(_Unsigned{0} - static_cast<_Unsigned>(_Val)); } return static_cast<_Unsigned>(_Val); } else { return _Val; } } template <class _Mt, class _Nt> [[nodiscard]] constexpr common_type_t<_Mt, _Nt> gcd(const _Mt _Mx, const _Nt _Nx) noexcept { static_assert(_Is_nonbool_integral<_Mt> && _Is_nonbool_integral<_Nt>, "GCD requires nonbool integral types"); using _Common = common_type_t<_Mt, _Nt>; using _Common_unsigned = make_unsigned_t<_Common>; _Common_unsigned _Mx_magnitude = _Abs_u(_Mx); _Common_unsigned _Nx_magnitude = _Abs_u(_Nx); if (_Mx_magnitude == 0U) { return static_cast<_Common>(_Nx_magnitude); } if (_Nx_magnitude == 0U) { return static_cast<_Common>(_Mx_magnitude); } const auto _Mx_trailing_zeroes = static_cast<unsigned long>(_Countr_zero(_Mx_magnitude)); const auto _Common_factors_of_2 = (::std:: min)(_Mx_trailing_zeroes, static_cast<unsigned long>(_Countr_zero(_Nx_magnitude))); _Nx_magnitude >>= _Common_factors_of_2; _Mx_magnitude >>= _Mx_trailing_zeroes; do { _Nx_magnitude >>= static_cast<unsigned long>(_Countr_zero(_Nx_magnitude)); if (_Mx_magnitude > _Nx_magnitude) { _Common_unsigned _Temp = _Mx_magnitude; _Mx_magnitude = _Nx_magnitude; _Nx_magnitude = _Temp; } _Nx_magnitude -= _Mx_magnitude; } while (_Nx_magnitude != 0U); return static_cast<_Common>(_Mx_magnitude << _Common_factors_of_2); } template <class _Mt, class _Nt> [[nodiscard]] constexpr common_type_t<_Mt, _Nt> lcm(const _Mt _Mx, const _Nt _Nx) noexcept { static_assert(_Is_nonbool_integral<_Mt> && _Is_nonbool_integral<_Nt>, "LCM requires nonbool integral types"); using _Common = common_type_t<_Mt, _Nt>; using _Common_unsigned = make_unsigned_t<_Common>; const _Common_unsigned _Mx_magnitude = _Abs_u(_Mx); const _Common_unsigned _Nx_magnitude = _Abs_u(_Nx); if (_Mx_magnitude == 0 || _Nx_magnitude == 0) { return 0; } return static_cast<_Common>((_Mx_magnitude / ::std:: gcd(_Mx_magnitude, _Nx_magnitude)) * _Nx_magnitude); } template <class _Ty, enable_if_t<is_arithmetic_v<_Ty> && !is_same_v<remove_cv_t<_Ty>, bool>, int> = 0> [[nodiscard]] constexpr _Ty midpoint(const _Ty _Val1, const _Ty _Val2) noexcept { if constexpr (is_floating_point_v<_Ty>) { if (::std:: is_constant_evaluated()) { if (_Is_nan(_Val1)) { return _Val1; } if (_Is_nan(_Val2)) { return _Val2; } } else { if (_Is_nan(_Val1) || _Is_nan(_Val2)) { return _Val1 + _Val2; } } constexpr _Ty _High_limit = (numeric_limits<_Ty>::max)() / 2; const auto _Val1_a = _Float_abs(_Val1); const auto _Val2_a = _Float_abs(_Val2); if (_Val1_a <= _High_limit && _Val2_a <= _High_limit) { return (_Val1 + _Val2) / 2; } constexpr _Ty _Low_limit = (numeric_limits<_Ty>::min)() * 2; if (_Val1_a < _Low_limit) { return _Val1 + _Val2 / 2; } if (_Val2_a < _Low_limit) { return _Val1 / 2 + _Val2; } return _Val1 / 2 + _Val2 / 2; } else { using _Unsigned = make_unsigned_t<_Ty>; const auto _Val1_u = static_cast<_Unsigned>(_Val1); const auto _Val2_u = static_cast<_Unsigned>(_Val2); if (_Val1 > _Val2) { return static_cast<_Ty>(_Val1 - static_cast<_Ty>(static_cast<_Unsigned>(_Val1_u - _Val2_u) / 2)); } else { return static_cast<_Ty>(_Val1 + static_cast<_Ty>(static_cast<_Unsigned>(_Val2_u - _Val1_u) / 2)); } } } template <class _Ty, enable_if_t<is_object_v<_Ty>, int> = 0> [[nodiscard]] constexpr _Ty* midpoint(_Ty* const _Val1, _Ty* const _Val2) noexcept { if (_Val1 > _Val2) { return _Val1 - ((_Val1 - _Val2) >> 1); } else { return _Val1 + ((_Val2 - _Val1) >> 1); } } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) inline size_t valueSize(const std::string& value) noexcept { (void)( (!!((value.size() < std::numeric_limits<uint32_t>::max()))) || (1 != _CrtDbgReportW(2, L"E:\\Development\\Projects\\Personal\\ChromiumCrawler\\cpp-db\\src\\dbfield_size_helpers.hpp", 14, 0, L"%ls", 0)) || (__debugbreak(), 0) ); return sizeof(uint32_t) + value.size(); } template <typename T> size_t valueSize(const std::vector<T>& v) noexcept { (void)( (!!((v.size() < std::numeric_limits<uint32_t>::max()))) || (1 != _CrtDbgReportW(2, L"E:\\Development\\Projects\\Personal\\ChromiumCrawler\\cpp-db\\src\\dbfield_size_helpers.hpp", 21, 0, L"%ls", 0)) || (__debugbreak(), 0) ); static_assert(!std::is_reference_v<T> && !std::is_pointer_v<T>); if constexpr (is_trivially_serializable_v<T>) return sizeof(uint32_t) + v.size() * sizeof(T); else return sizeof(uint32_t) + std::accumulate(v.cbegin(), v.cend(), size_t{ 0 }, [](auto&& acc, auto&& item) { return acc + ::valueSize(item); }); } template <typename T, auto fieldId, bool is_array = false> struct Field { using ValueType = std::conditional_t<is_array, std::vector<T>, T>; static constexpr auto id = fieldId; static constexpr bool isField() noexcept { return true; } static constexpr bool isArray() noexcept { return is_array; } constexpr Field() noexcept = default; constexpr Field(ValueType val) noexcept : value{ std::move(val) } {} static constexpr bool sizeKnownAtCompileTime() noexcept { return !isArray() && std::is_trivial_v<ValueType> && std::is_standard_layout_v<ValueType>; } static constexpr size_t staticSize() noexcept { static_assert(sizeKnownAtCompileTime(), "This field type does not have compile-time-static size."); return sizeof(ValueType); } size_t fieldSize() const noexcept { if constexpr (sizeKnownAtCompileTime()) return staticSize(); else return ::valueSize(value); } static constexpr bool isSuitableForTombstone() noexcept { return std::is_trivial_v<ValueType> && sizeKnownAtCompileTime(); } constexpr bool operator==(const Field& other) const noexcept { return value == other.value; } constexpr bool operator!=(const Field& other) const noexcept { return !operator==(other); } constexpr bool operator<(const Field& other) const noexcept requires(!is_array) { return value < other.value; } public: ValueType value {}; private: static_assert(sizeKnownAtCompileTime() == std::is_trivial_v<ValueType>); }; template <auto id, typename FirstField = void, typename... OtherFields> struct FieldById { using Type = std::conditional_t<FirstField::id == id, FirstField, typename FieldById<id, OtherFields...>::Type>; }; template <auto id> struct FieldById<id, void> { using Type = void; }; template <auto id, typename... Fields> using FieldById_t = typename FieldById<id, Fields...>::Type; template <auto id, typename... Fields> using FieldValueTypeById_t = typename FieldById_t<id, Fields...>::ValueType; #pragma once template <size_t First, size_t Last, typename Functor> constexpr void constexpr_for([[maybe_unused]] Functor&& f) noexcept { if constexpr (First < Last) { if constexpr (std::is_same_v<bool, std::invoke_result_t<Functor()>>) { if (f(value_as_type<First>{}) == false) return; } else f(value_as_type<First>{}); constexpr_for<First + 1, Last, Functor>(std::forward<Functor>(f)); } } namespace detail { template <std::size_t First, std::size_t... Indices, typename Functor> constexpr void constexpr_for_fold_impl([[maybe_unused]] Functor&& f, std::index_sequence<Indices...>) noexcept { (std::forward<Functor>(f).template operator() < First + Indices > (), ...); } } template <std::size_t First, std::size_t Last, typename Functor> constexpr void constexpr_for_fold([[maybe_unused]] Functor&& f) noexcept { detail::constexpr_for_fold_impl<First>(std::forward<Functor>(f), std::make_index_sequence<Last - First>{}); } template <auto first, auto last, typename Functor, typename ValueType> constexpr void constexpr_from_runtime_value(const ValueType value, [[maybe_unused]] Functor&& f) noexcept { if (first == value) { f(value_as_type<static_cast<ValueType>(first)>{}); return; } if constexpr (first != last) constexpr_from_runtime_value<first + 1, last, Functor>(value, std::forward<Functor>(f)); } #pragma once #pragma external_header(push) #pragma once #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { template <class _Base> struct _Non_trivial_copy : _Base { using _Base::_Base; _Non_trivial_copy() = default; _Non_trivial_copy(const _Non_trivial_copy& _That) noexcept( noexcept(_Base::_Construct_from(static_cast<const _Base&>(_That)))) { _Base::_Construct_from(static_cast<const _Base&>(_That)); } _Non_trivial_copy(_Non_trivial_copy&&) = default; _Non_trivial_copy& operator=(const _Non_trivial_copy&) = default; _Non_trivial_copy& operator=(_Non_trivial_copy&&) = default; }; template <class _Base, class... _Types> using _SMF_control_copy = conditional_t< conjunction_v<is_copy_constructible<_Types>..., negation<conjunction<is_trivially_copy_constructible<_Types>...>>>, _Non_trivial_copy<_Base>, _Base>; template <class _Base, class... _Types> struct _Non_trivial_move : _SMF_control_copy<_Base, _Types...> { using _Mybase = _SMF_control_copy<_Base, _Types...>; using _Mybase::_Mybase; _Non_trivial_move() = default; _Non_trivial_move(const _Non_trivial_move&) = default; _Non_trivial_move(_Non_trivial_move&& _That) noexcept( noexcept(_Mybase::_Construct_from(static_cast<_Base&&>(_That)))) { _Mybase::_Construct_from(static_cast<_Base&&>(_That)); } _Non_trivial_move& operator=(const _Non_trivial_move&) = default; _Non_trivial_move& operator=(_Non_trivial_move&&) = default; }; template <class _Base, class... _Types> using _SMF_control_move = conditional_t< conjunction_v<is_move_constructible<_Types>..., negation<conjunction<is_trivially_move_constructible<_Types>...>>>, _Non_trivial_move<_Base, _Types...>, _SMF_control_copy<_Base, _Types...>>; template <class _Base, class... _Types> struct _Non_trivial_copy_assign : _SMF_control_move<_Base, _Types...> { using _Mybase = _SMF_control_move<_Base, _Types...>; using _Mybase::_Mybase; _Non_trivial_copy_assign() = default; _Non_trivial_copy_assign(const _Non_trivial_copy_assign&) = default; _Non_trivial_copy_assign(_Non_trivial_copy_assign&&) = default; _Non_trivial_copy_assign& operator=(const _Non_trivial_copy_assign& _That) noexcept( noexcept(_Mybase::_Assign_from(static_cast<const _Base&>(_That)))) { _Mybase::_Assign_from(static_cast<const _Base&>(_That)); return *this; } _Non_trivial_copy_assign& operator=(_Non_trivial_copy_assign&&) = default; }; template <class _Base, class... _Types> struct _Deleted_copy_assign : _SMF_control_move<_Base, _Types...> { using _Mybase = _SMF_control_move<_Base, _Types...>; using _Mybase::_Mybase; _Deleted_copy_assign() = default; _Deleted_copy_assign(const _Deleted_copy_assign&) = default; _Deleted_copy_assign(_Deleted_copy_assign&&) = default; _Deleted_copy_assign& operator=(const _Deleted_copy_assign&) = delete; _Deleted_copy_assign& operator=(_Deleted_copy_assign&&) = default; }; template <class _Base, class... _Types> using _SMF_control_copy_assign = conditional_t<conjunction_v<is_trivially_destructible<_Types>..., is_trivially_copy_constructible<_Types>..., is_trivially_copy_assignable<_Types>...>, _SMF_control_move<_Base, _Types...>, conditional_t<conjunction_v<is_copy_constructible<_Types>..., is_copy_assignable<_Types>...>, _Non_trivial_copy_assign<_Base, _Types...>, _Deleted_copy_assign<_Base, _Types...>>>; template <class _Base, class... _Types> struct _Non_trivial_move_assign : _SMF_control_copy_assign<_Base, _Types...> { using _Mybase = _SMF_control_copy_assign<_Base, _Types...>; using _Mybase::_Mybase; _Non_trivial_move_assign() = default; _Non_trivial_move_assign(const _Non_trivial_move_assign&) = default; _Non_trivial_move_assign(_Non_trivial_move_assign&&) = default; _Non_trivial_move_assign& operator=(const _Non_trivial_move_assign&) = default; _Non_trivial_move_assign& operator=(_Non_trivial_move_assign&& _That) noexcept( noexcept(_Mybase::_Assign_from(static_cast<_Base&&>(_That)))) { _Mybase::_Assign_from(static_cast<_Base&&>(_That)); return *this; } }; template <class _Base, class... _Types> struct _Deleted_move_assign : _SMF_control_copy_assign<_Base, _Types...> { using _Mybase = _SMF_control_copy_assign<_Base, _Types...>; using _Mybase::_Mybase; _Deleted_move_assign() = default; _Deleted_move_assign(const _Deleted_move_assign&) = default; _Deleted_move_assign(_Deleted_move_assign&&) = default; _Deleted_move_assign& operator=(const _Deleted_move_assign&) = default; _Deleted_move_assign& operator=(_Deleted_move_assign&&) = delete; }; template <class _Base, class... _Types> using _SMF_control_move_assign = conditional_t<conjunction_v<is_trivially_destructible<_Types>..., is_trivially_move_constructible<_Types>..., is_trivially_move_assignable<_Types>...>, _SMF_control_copy_assign<_Base, _Types...>, conditional_t<conjunction_v<is_move_constructible<_Types>..., is_move_assignable<_Types>...>, _Non_trivial_move_assign<_Base, _Types...>, _Deleted_move_assign<_Base, _Types...>>>; template <class _Base, class... _Types> using _SMF_control = _SMF_control_move_assign<_Base, _Types...>; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { struct nullopt_t { struct _Tag {}; constexpr explicit nullopt_t(_Tag) {} }; inline constexpr nullopt_t nullopt{nullopt_t::_Tag{}}; class bad_optional_access : public exception { public: [[nodiscard]] virtual const char* what() const noexcept override { return "Bad optional access"; } }; [[noreturn]] inline void _Throw_bad_optional_access() { throw bad_optional_access{}; } template <class _Ty, bool = is_trivially_destructible_v<_Ty>> struct _Optional_destruct_base { union { _Nontrivial_dummy_type _Dummy; remove_const_t<_Ty> _Value; }; bool _Has_value; constexpr _Optional_destruct_base() noexcept : _Dummy{}, _Has_value{false} {} template <class... _Types> constexpr explicit _Optional_destruct_base(in_place_t, _Types&&... _Args) : _Value(::std:: forward<_Types>(_Args)...), _Has_value{true} {} void reset() noexcept { _Has_value = false; } }; template <class _Ty> struct _Optional_destruct_base<_Ty, false> { union { _Nontrivial_dummy_type _Dummy; remove_const_t<_Ty> _Value; }; bool _Has_value; ~_Optional_destruct_base() noexcept { if (_Has_value) { _Destroy_in_place(_Value); } } constexpr _Optional_destruct_base() noexcept : _Dummy{}, _Has_value{false} {} template <class... _Types> constexpr explicit _Optional_destruct_base(in_place_t, _Types&&... _Args) : _Value(::std:: forward<_Types>(_Args)...), _Has_value{true} {} _Optional_destruct_base(const _Optional_destruct_base&) = default; _Optional_destruct_base(_Optional_destruct_base&&) = default; _Optional_destruct_base& operator=(const _Optional_destruct_base&) = default; _Optional_destruct_base& operator=(_Optional_destruct_base&&) = default; void reset() noexcept { if (_Has_value) { _Destroy_in_place(_Value); _Has_value = false; } } }; template <class _Ty> struct _Optional_construct_base : _Optional_destruct_base<_Ty> { using _Optional_destruct_base<_Ty>::_Optional_destruct_base; template <class... _Types> _Ty& _Construct(_Types&&... _Args) { ; _Construct_in_place(this->_Value, ::std:: forward<_Types>(_Args)...); this->_Has_value = true; return this->_Value; } template <class _Ty2> void _Assign(_Ty2&& _Right) { if (this->_Has_value) { this->_Value = ::std:: forward<_Ty2>(_Right); } else { _Construct(::std:: forward<_Ty2>(_Right)); } } template <class _Self> void _Construct_from(_Self&& _Right) noexcept( is_nothrow_constructible_v<_Ty, decltype((::std:: forward<_Self>(_Right)._Value))>) { if (_Right._Has_value) { _Construct(::std:: forward<_Self>(_Right)._Value); } } template <class _Self> void _Assign_from(_Self&& _Right) noexcept( is_nothrow_constructible_v<_Ty, decltype((::std:: forward<_Self>(_Right)._Value))>&& is_nothrow_assignable_v<_Ty&, decltype((::std:: forward<_Self>(_Right)._Value))>) { if (_Right._Has_value) { _Assign(::std:: forward<_Self>(_Right)._Value); } else { this->reset(); } } }; template <class _Ty> class optional : private _SMF_control<_Optional_construct_base<_Ty>, _Ty> { private: using _Mybase = _SMF_control<_Optional_construct_base<_Ty>, _Ty>; public: static_assert(!_Is_any_of_v<remove_cv_t<_Ty>, nullopt_t, in_place_t>, "T in optional<T> must be a type other than nullopt_t or in_place_t (N4828 [optional.optional]/3)."); static_assert(is_object_v<_Ty> && is_destructible_v<_Ty> && !is_array_v<_Ty>, "T in optional<T> must meet the Cpp17Destructible requirements (N4828 [optional.optional]/3)."); using value_type = _Ty; constexpr optional() noexcept {} constexpr optional(nullopt_t) noexcept {} template <class... _Types, enable_if_t<is_constructible_v<_Ty, _Types...>, int> = 0> constexpr explicit optional(in_place_t, _Types&&... _Args) : _Mybase(in_place, ::std:: forward<_Types>(_Args)...) {} template <class _Elem, class... _Types, enable_if_t<is_constructible_v<_Ty, initializer_list<_Elem>&, _Types...>, int> = 0> constexpr explicit optional(in_place_t, initializer_list<_Elem> _Ilist, _Types&&... _Args) : _Mybase(in_place, _Ilist, ::std:: forward<_Types>(_Args)...) {} template <class _Ty2> using _AllowDirectConversion = bool_constant<conjunction_v<negation<is_same<_Remove_cvref_t<_Ty2>, optional>>, negation<is_same<_Remove_cvref_t<_Ty2>, in_place_t>>, is_constructible<_Ty, _Ty2>>>; template <class _Ty2 = _Ty, enable_if_t<_AllowDirectConversion<_Ty2>::value, int> = 0> constexpr explicit(!is_convertible_v<_Ty2, _Ty>) optional(_Ty2&& _Right) : _Mybase(in_place, ::std:: forward<_Ty2>(_Right)) {} template <class _Ty2> struct _AllowUnwrapping : bool_constant<!disjunction_v<is_same<_Ty, _Ty2>, is_constructible<_Ty, optional<_Ty2>&>, is_constructible<_Ty, const optional<_Ty2>&>, is_constructible<_Ty, const optional<_Ty2>>, is_constructible<_Ty, optional<_Ty2>>, is_convertible<optional<_Ty2>&, _Ty>, is_convertible<const optional<_Ty2>&, _Ty>, is_convertible<const optional<_Ty2>, _Ty>, is_convertible<optional<_Ty2>, _Ty>>> {}; template <class _Ty2, enable_if_t<conjunction_v<_AllowUnwrapping<_Ty2>, is_constructible<_Ty, const _Ty2&>>, int> = 0> explicit(!is_convertible_v<const _Ty2&, _Ty>) optional(const optional<_Ty2>& _Right) { if (_Right) { this->_Construct(*_Right); } } template <class _Ty2, enable_if_t<conjunction_v<_AllowUnwrapping<_Ty2>, is_constructible<_Ty, _Ty2>>, int> = 0> explicit(!is_convertible_v<_Ty2, _Ty>) optional(optional<_Ty2>&& _Right) { if (_Right) { this->_Construct(::std:: move(*_Right)); } } optional& operator=(nullopt_t) noexcept { reset(); return *this; } template <class _Ty2 = _Ty, enable_if_t<conjunction_v<negation<is_same<optional, _Remove_cvref_t<_Ty2>>>, negation<conjunction<is_scalar<_Ty>, is_same<_Ty, decay_t<_Ty2>>>>, is_constructible<_Ty, _Ty2>, is_assignable<_Ty&, _Ty2>>, int> = 0> optional& operator=(_Ty2&& _Right) { this->_Assign(::std:: forward<_Ty2>(_Right)); return *this; } template <class _Ty2> struct _AllowUnwrappingAssignment : bool_constant<!disjunction_v<is_same<_Ty, _Ty2>, is_assignable<_Ty&, optional<_Ty2>&>, is_assignable<_Ty&, const optional<_Ty2>&>, is_assignable<_Ty&, const optional<_Ty2>>, is_assignable<_Ty&, optional<_Ty2>>>> {}; template <class _Ty2, enable_if_t<conjunction_v<_AllowUnwrappingAssignment<_Ty2>, is_constructible<_Ty, const _Ty2&>, is_assignable<_Ty&, const _Ty2&>>, int> = 0> optional& operator=(const optional<_Ty2>& _Right) { if (_Right) { this->_Assign(*_Right); } else { reset(); } return *this; } template <class _Ty2, enable_if_t<conjunction_v<_AllowUnwrappingAssignment<_Ty2>, is_constructible<_Ty, _Ty2>, is_assignable<_Ty&, _Ty2>>, int> = 0> optional& operator=(optional<_Ty2>&& _Right) { if (_Right) { this->_Assign(::std:: move(*_Right)); } else { reset(); } return *this; } template <class... _Types> _Ty& emplace(_Types&&... _Args) { reset(); return this->_Construct(::std:: forward<_Types>(_Args)...); } template <class _Elem, class... _Types, enable_if_t<is_constructible_v<_Ty, initializer_list<_Elem>&, _Types...>, int> = 0> _Ty& emplace(initializer_list<_Elem> _Ilist, _Types&&... _Args) { reset(); return this->_Construct(_Ilist, ::std:: forward<_Types>(_Args)...); } void swap(optional& _Right) noexcept(is_nothrow_move_constructible_v<_Ty>&& is_nothrow_swappable_v<_Ty>) { static_assert(is_move_constructible_v<_Ty>, "optional<T>::swap requires T to be move constructible (N4828 [optional.swap]/1)."); static_assert(!is_move_constructible_v<_Ty> || is_swappable_v<_Ty>, "optional<T>::swap requires T to be swappable (N4828 [optional.swap]/1)."); if constexpr (_Is_trivially_swappable_v<_Ty>) { using _TrivialBaseTy = _Optional_destruct_base<_Ty>; ::std:: swap(static_cast<_TrivialBaseTy&>(*this), static_cast<_TrivialBaseTy&>(_Right)); } else { const bool _Engaged = this->_Has_value; if (_Engaged == _Right._Has_value) { if (_Engaged) { _Swap_adl(**this, *_Right); } } else { optional& _Source = _Engaged ? *this : _Right; optional& _Target = _Engaged ? _Right : *this; _Target._Construct(::std:: move(*_Source)); _Source.reset(); } } } [[nodiscard]] constexpr const _Ty* operator->() const { do { if (this->_Has_value) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\optional", 345, 0, "%s", "Cannot access value of empty optional")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"Cannot access value of empty optional\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\optional", 345, 0); } while (false); } ; } while (false); return ::std:: addressof(this->_Value); } [[nodiscard]] constexpr _Ty* operator->() { do { if (this->_Has_value) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\optional", 351, 0, "%s", "Cannot access value of empty optional")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"Cannot access value of empty optional\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\optional", 351, 0); } while (false); } ; } while (false); return ::std:: addressof(this->_Value); } [[nodiscard]] constexpr const _Ty& operator*() const& { do { if (this->_Has_value) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\optional", 358, 0, "%s", "Cannot access value of empty optional")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"Cannot access value of empty optional\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\optional", 358, 0); } while (false); } ; } while (false); return this->_Value; } [[nodiscard]] constexpr _Ty& operator*() & { do { if (this->_Has_value) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\optional", 364, 0, "%s", "Cannot access value of empty optional")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"Cannot access value of empty optional\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\optional", 364, 0); } while (false); } ; } while (false); return this->_Value; } [[nodiscard]] constexpr _Ty&& operator*() && { do { if (this->_Has_value) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\optional", 370, 0, "%s", "Cannot access value of empty optional")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"Cannot access value of empty optional\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\optional", 370, 0); } while (false); } ; } while (false); return ::std:: move(this->_Value); } [[nodiscard]] constexpr const _Ty&& operator*() const&& { do { if (this->_Has_value) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\optional", 376, 0, "%s", "Cannot access value of empty optional")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"Cannot access value of empty optional\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\optional", 376, 0); } while (false); } ; } while (false); return ::std:: move(this->_Value); } constexpr explicit operator bool() const noexcept { return this->_Has_value; } [[nodiscard]] constexpr bool has_value() const noexcept { return this->_Has_value; } [[nodiscard]] constexpr const _Ty& value() const& { if (!this->_Has_value) { _Throw_bad_optional_access(); } return this->_Value; } [[nodiscard]] constexpr _Ty& value() & { if (!this->_Has_value) { _Throw_bad_optional_access(); } return this->_Value; } [[nodiscard]] constexpr _Ty&& value() && { if (!this->_Has_value) { _Throw_bad_optional_access(); } return ::std:: move(this->_Value); } [[nodiscard]] constexpr const _Ty&& value() const&& { if (!this->_Has_value) { _Throw_bad_optional_access(); } return ::std:: move(this->_Value); } template <class _Ty2> [[nodiscard]] constexpr remove_cv_t<_Ty> value_or(_Ty2&& _Right) const& { static_assert(is_convertible_v<const _Ty&, remove_cv_t<_Ty>>, "The const overload of optional<T>::value_or requires const T& to be convertible to remove_cv_t<T> " "(N4885 [optional.observe]/17 as modified by LWG-3424)."); static_assert(is_convertible_v<_Ty2, _Ty>, "optional<T>::value_or(U) requires U to be convertible to T (N4828 [optional.observe]/18)."); if (this->_Has_value) { return this->_Value; } return static_cast<remove_cv_t<_Ty>>(::std:: forward<_Ty2>(_Right)); } template <class _Ty2> [[nodiscard]] constexpr remove_cv_t<_Ty> value_or(_Ty2&& _Right) && { static_assert(is_convertible_v<_Ty, remove_cv_t<_Ty>>, "The rvalue overload of optional<T>::value_or requires T to be convertible to remove_cv_t<T> " "(N4885 [optional.observe]/19 as modified by LWG-3424)."); static_assert(is_convertible_v<_Ty2, _Ty>, "optional<T>::value_or(U) requires U to be convertible to T (N4828 [optional.observe]/20)."); if (this->_Has_value) { return ::std:: move(this->_Value); } return static_cast<remove_cv_t<_Ty>>(::std:: forward<_Ty2>(_Right)); } using _Mybase::reset; }; template <class _Ty> optional(_Ty) -> optional<_Ty>; template <class _Ty1, class _Ty2> [[nodiscard]] constexpr bool operator==(const optional<_Ty1>& _Left, const optional<_Ty2>& _Right) { const bool _Left_has_value = _Left.has_value(); return _Left_has_value == _Right.has_value() && (!_Left_has_value || *_Left == *_Right); } template <class _Ty1, class _Ty2> [[nodiscard]] constexpr bool operator!=(const optional<_Ty1>& _Left, const optional<_Ty2>& _Right) { const bool _Left_has_value = _Left.has_value(); return _Left_has_value != _Right.has_value() || (_Left_has_value && *_Left != *_Right); } template <class _Ty1, class _Ty2> [[nodiscard]] constexpr bool operator<(const optional<_Ty1>& _Left, const optional<_Ty2>& _Right) { return _Right.has_value() && (!_Left.has_value() || *_Left < *_Right); } template <class _Ty1, class _Ty2> [[nodiscard]] constexpr bool operator>(const optional<_Ty1>& _Left, const optional<_Ty2>& _Right) { return _Left.has_value() && (!_Right.has_value() || *_Left > *_Right); } template <class _Ty1, class _Ty2> [[nodiscard]] constexpr bool operator<=(const optional<_Ty1>& _Left, const optional<_Ty2>& _Right) { return !_Left.has_value() || (_Right.has_value() && *_Left <= *_Right); } template <class _Ty1, class _Ty2> [[nodiscard]] constexpr bool operator>=(const optional<_Ty1>& _Left, const optional<_Ty2>& _Right) { return !_Right.has_value() || (_Left.has_value() && *_Left >= *_Right); } template <class _Ty1, three_way_comparable_with<_Ty1> _Ty2> [[nodiscard]] constexpr compare_three_way_result_t<_Ty1, _Ty2> operator<=>( const optional<_Ty1>& _Left, const optional<_Ty2>& _Right) { if (_Left && _Right) { return *_Left <=> *_Right; } return _Left.has_value() <=> _Right.has_value(); } template <class _Ty> [[nodiscard]] constexpr bool operator==(const optional<_Ty>& _Left, nullopt_t) noexcept { return !_Left.has_value(); } template <class _Ty> [[nodiscard]] constexpr strong_ordering operator<=>(const optional<_Ty>& _Left, nullopt_t) noexcept { return _Left.has_value() <=> false; } template <class _Ty> using _Enable_if_bool_convertible = enable_if_t<is_convertible_v<_Ty, bool>, int>; template <class _Lhs, class _Rhs> using _Enable_if_comparable_with_equal = _Enable_if_bool_convertible<decltype(::std:: declval<const _Lhs&>() == ::std:: declval<const _Rhs&>())>; template <class _Lhs, class _Rhs> using _Enable_if_comparable_with_not_equal = _Enable_if_bool_convertible<decltype(::std:: declval<const _Lhs&>() != ::std:: declval<const _Rhs&>())>; template <class _Lhs, class _Rhs> using _Enable_if_comparable_with_less = _Enable_if_bool_convertible<decltype(::std:: declval<const _Lhs&>() < ::std:: declval<const _Rhs&>())>; template <class _Lhs, class _Rhs> using _Enable_if_comparable_with_greater = _Enable_if_bool_convertible<decltype(::std:: declval<const _Lhs&>() > ::std:: declval<const _Rhs&>())>; template <class _Lhs, class _Rhs> using _Enable_if_comparable_with_less_equal = _Enable_if_bool_convertible<decltype(::std:: declval<const _Lhs&>() <= ::std:: declval<const _Rhs&>())>; template <class _Lhs, class _Rhs> using _Enable_if_comparable_with_greater_equal = _Enable_if_bool_convertible<decltype(::std:: declval<const _Lhs&>() >= ::std:: declval<const _Rhs&>())>; template <class _Ty1, class _Ty2, _Enable_if_comparable_with_equal<_Ty1, _Ty2> = 0> [[nodiscard]] constexpr bool operator==(const optional<_Ty1>& _Left, const _Ty2& _Right) { return _Left ? *_Left == _Right : false; } template <class _Ty1, class _Ty2, _Enable_if_comparable_with_equal<_Ty1, _Ty2> = 0> [[nodiscard]] constexpr bool operator==(const _Ty1& _Left, const optional<_Ty2>& _Right) { return _Right ? _Left == *_Right : false; } template <class _Ty1, class _Ty2, _Enable_if_comparable_with_not_equal<_Ty1, _Ty2> = 0> [[nodiscard]] constexpr bool operator!=(const optional<_Ty1>& _Left, const _Ty2& _Right) { return _Left ? *_Left != _Right : true; } template <class _Ty1, class _Ty2, _Enable_if_comparable_with_not_equal<_Ty1, _Ty2> = 0> [[nodiscard]] constexpr bool operator!=(const _Ty1& _Left, const optional<_Ty2>& _Right) { return _Right ? _Left != *_Right : true; } template <class _Ty1, class _Ty2, _Enable_if_comparable_with_less<_Ty1, _Ty2> = 0> [[nodiscard]] constexpr bool operator<(const optional<_Ty1>& _Left, const _Ty2& _Right) { return _Left ? *_Left < _Right : true; } template <class _Ty1, class _Ty2, _Enable_if_comparable_with_less<_Ty1, _Ty2> = 0> [[nodiscard]] constexpr bool operator<(const _Ty1& _Left, const optional<_Ty2>& _Right) { return _Right ? _Left < *_Right : false; } template <class _Ty1, class _Ty2, _Enable_if_comparable_with_greater<_Ty1, _Ty2> = 0> [[nodiscard]] constexpr bool operator>(const optional<_Ty1>& _Left, const _Ty2& _Right) { return _Left ? *_Left > _Right : false; } template <class _Ty1, class _Ty2, _Enable_if_comparable_with_greater<_Ty1, _Ty2> = 0> [[nodiscard]] constexpr bool operator>(const _Ty1& _Left, const optional<_Ty2>& _Right) { return _Right ? _Left > *_Right : true; } template <class _Ty1, class _Ty2, _Enable_if_comparable_with_less_equal<_Ty1, _Ty2> = 0> [[nodiscard]] constexpr bool operator<=(const optional<_Ty1>& _Left, const _Ty2& _Right) { return _Left ? *_Left <= _Right : true; } template <class _Ty1, class _Ty2, _Enable_if_comparable_with_less_equal<_Ty1, _Ty2> = 0> [[nodiscard]] constexpr bool operator<=(const _Ty1& _Left, const optional<_Ty2>& _Right) { return _Right ? _Left <= *_Right : false; } template <class _Ty1, class _Ty2, _Enable_if_comparable_with_greater_equal<_Ty1, _Ty2> = 0> [[nodiscard]] constexpr bool operator>=(const optional<_Ty1>& _Left, const _Ty2& _Right) { return _Left ? *_Left >= _Right : false; } template <class _Ty1, class _Ty2, _Enable_if_comparable_with_greater_equal<_Ty1, _Ty2> = 0> [[nodiscard]] constexpr bool operator>=(const _Ty1& _Left, const optional<_Ty2>& _Right) { return _Right ? _Left >= *_Right : true; } template <class _Ty1, class _Ty2> requires (!_Is_specialization_v<_Ty2, optional>) && three_way_comparable_with<_Ty1, _Ty2> [[nodiscard]] constexpr compare_three_way_result_t<_Ty1, _Ty2> operator<=>(const optional<_Ty1>& _Left, const _Ty2& _Right) { if (_Left) { return *_Left <=> _Right; } return strong_ordering::less; } template <class _Ty, enable_if_t<is_move_constructible_v<_Ty> && is_swappable_v<_Ty>, int> = 0> void swap(optional<_Ty>& _Left, optional<_Ty>& _Right) noexcept(noexcept(_Left.swap(_Right))) { _Left.swap(_Right); } template <class _Ty> [[nodiscard]] constexpr optional<decay_t<_Ty>> make_optional(_Ty&& _Value) { return optional<decay_t<_Ty>>{::std:: forward<_Ty>(_Value)}; } template <class _Ty, class... _Types> [[nodiscard]] constexpr optional<_Ty> make_optional(_Types&&... _Args) { return optional<_Ty>{in_place, ::std:: forward<_Types>(_Args)...}; } template <class _Ty, class _Elem, class... _Types> [[nodiscard]] constexpr optional<_Ty> make_optional(initializer_list<_Elem> _Ilist, _Types&&... _Args) { return optional<_Ty>{in_place, _Ilist, ::std:: forward<_Types>(_Args)...}; } template <class _Ty> struct hash<optional<_Ty>> : _Conditionally_enabled_hash<optional<_Ty>, is_default_constructible_v<hash<remove_const_t<_Ty>>>> { static size_t _Do_hash(const optional<_Ty>& _Opt) noexcept(_Is_nothrow_hashable<remove_const_t<_Ty>>::value) { constexpr size_t _Unspecified_value = 0; if (_Opt) { return hash<remove_const_t<_Ty>>{}(*_Opt); } return _Unspecified_value; } }; } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) namespace pack { template <size_t index, typename... Args> using type_by_index = std::tuple_element_t<index, std::tuple<Args...>>; template <typename T, typename... Args> [[nodiscard]] constexpr std::optional<size_t> index_for_type() noexcept { std::optional<size_t> index; constexpr_for<0, sizeof...(Args)>([&index](auto i) { if (!index) { if constexpr (std::is_same_v<T, type_by_index < static_cast<size_t>(decltype(i){}), Args... >> ) index = static_cast<size_t>(decltype(i){}); } }); return index; } namespace detail { template <typename T, typename... Args> [[nodiscard]] constexpr size_t index_for_type_strict() noexcept { constexpr auto index = index_for_type<T, Args...>(); static_assert (index, "Type not found in pack"); return *index; } } template <typename T, typename... Args> constexpr size_t index_for_type_v = detail::index_for_type_strict<T, Args...>(); template <typename T, typename... Args> constexpr bool has_type_v = static_cast<bool>(index_for_type<T, Args...>()); template <typename T, typename... Args> [[nodiscard]] constexpr size_t type_count() noexcept { size_t count = 0; constexpr_for<0, sizeof...(Args)>([&count](auto i) { if constexpr (std::is_same_v<T, type_by_index < static_cast<size_t>(decltype(i){}), Args... >> ) ++count; }); return count; } template <typename... Args> using first_type = type_by_index<0, Args...>; template <size_t index, typename... Args> [[nodiscard]] constexpr auto value_by_index(Args&&... args) noexcept { return std::get<index>(std::forward_as_tuple(std::forward<Args>(args)...)); } template <typename Functor> constexpr void for_value(Functor&&) noexcept { } template <typename Functor, class Arg, class... Args> constexpr void for_value(Functor&& f, Arg&& a, Args&&... args) noexcept { f(std::forward<Arg>(a)); for_value(std::forward<Functor>(f), std::forward<Args>(args)...); } template <typename... Args, typename Functor> constexpr void for_type(Functor&& f) noexcept { constexpr_for<0, sizeof...(Args)>([f{ std::forward<Functor>(f) }](auto i) { f(type_wrapper<type_by_index<decltype(i)::value, Args...>>{}); }); } } template <typename... Pack> struct type_pack { static constexpr size_t type_count = sizeof...(Pack); template <auto index> using Type = pack::type_by_index<index, Pack...>; template <typename T> static constexpr auto index_of = pack::detail::index_for_type_strict<T, Pack...>(); template <typename... NewArgs> using Append = type_pack<Pack..., NewArgs...>; template <template <typename...> class T> using Construct = T<Pack...>; using Tuple = std::tuple<Pack...>; }; #pragma once #pragma external_header(push) #pragma once #pragma pack(push, 8) #pragma warning(push, 4) #pragma warning(disable : 4180 4412 4455 4494 4514 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 4988 5026 5027 5045 6294 ) namespace std { struct _Iterator_base12_compatible { _Container_proxy* _Myproxy{}; _Iterator_base12* _Mynextiter{}; }; template <class _Ty, size_t _Size> class _Array_const_iterator : private _Iterator_base12_compatible { public: using iterator_concept = contiguous_iterator_tag; using iterator_category = random_access_iterator_tag; using value_type = _Ty; using difference_type = ptrdiff_t; using pointer = const _Ty*; using reference = const _Ty&; enum { _EEN_SIZE = _Size }; constexpr _Array_const_iterator() noexcept : _Ptr(), _Idx(0) {} constexpr explicit _Array_const_iterator(pointer _Parg, size_t _Off = 0) noexcept : _Ptr(_Parg), _Idx(_Off) {} [[nodiscard]] constexpr reference operator*() const noexcept { return *operator->(); } [[nodiscard]] constexpr pointer operator->() const noexcept { do { if (_Ptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 165, 0, "%s", "cannot dereference value-initialized array iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot dereference value-initialized array iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 165, 0); } while (false); } ; } while (false); do { if (_Idx < _Size) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 166, 0, "%s", "cannot dereference out of range array iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot dereference out of range array iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 166, 0); } while (false); } ; } while (false); return _Ptr + _Idx; } constexpr _Array_const_iterator& operator++() noexcept { do { if (_Ptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 171, 0, "%s", "cannot increment value-initialized array iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot increment value-initialized array iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 171, 0); } while (false); } ; } while (false); do { if (_Idx < _Size) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 172, 0, "%s", "cannot increment array iterator past end")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot increment array iterator past end\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 172, 0); } while (false); } ; } while (false); ++_Idx; return *this; } constexpr _Array_const_iterator operator++(int) noexcept { _Array_const_iterator _Tmp = *this; ++*this; return _Tmp; } constexpr _Array_const_iterator& operator--() noexcept { do { if (_Ptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 184, 0, "%s", "cannot decrement value-initialized array iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot decrement value-initialized array iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 184, 0); } while (false); } ; } while (false); do { if (_Idx != 0) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 185, 0, "%s", "cannot decrement array iterator before begin")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot decrement array iterator before begin\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 185, 0); } while (false); } ; } while (false); --_Idx; return *this; } constexpr _Array_const_iterator operator--(int) noexcept { _Array_const_iterator _Tmp = *this; --*this; return _Tmp; } constexpr void _Verify_offset(const ptrdiff_t _Off) const noexcept { if (_Off != 0) { do { if (_Ptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 198, 0, "%s", "cannot seek value-initialized array iterator")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek value-initialized array iterator\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 198, 0); } while (false); } ; } while (false); } if (_Off < 0) { do { if (_Idx >= size_t{0} - static_cast<size_t>(_Off)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 202, 0, "%s", "cannot seek array iterator before begin")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek array iterator before begin\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 202, 0); } while (false); } ; } while (false); } if (_Off > 0) { do { if (_Size - _Idx >= static_cast<size_t>(_Off)) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 206, 0, "%s", "cannot seek array iterator after end")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"cannot seek array iterator after end\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 206, 0); } while (false); } ; } while (false); } } constexpr _Array_const_iterator& operator+=(const ptrdiff_t _Off) noexcept { _Verify_offset(_Off); _Idx += static_cast<size_t>(_Off); return *this; } [[nodiscard]] constexpr _Array_const_iterator operator+(const ptrdiff_t _Off) const noexcept { _Array_const_iterator _Tmp = *this; return _Tmp += _Off; } constexpr _Array_const_iterator& operator-=(const ptrdiff_t _Off) noexcept { return *this += -_Off; } [[nodiscard]] constexpr _Array_const_iterator operator-(const ptrdiff_t _Off) const noexcept { _Array_const_iterator _Tmp = *this; return _Tmp -= _Off; } [[nodiscard]] constexpr ptrdiff_t operator-(const _Array_const_iterator& _Right) const noexcept { _Compat(_Right); return static_cast<ptrdiff_t>(_Idx - _Right._Idx); } [[nodiscard]] constexpr reference operator[](const ptrdiff_t _Off) const noexcept { return *(*this + _Off); } [[nodiscard]] constexpr bool operator==(const _Array_const_iterator& _Right) const noexcept { _Compat(_Right); return _Idx == _Right._Idx; } [[nodiscard]] constexpr strong_ordering operator<=>(const _Array_const_iterator& _Right) const noexcept { _Compat(_Right); return _Idx <=> _Right._Idx; } constexpr void _Compat(const _Array_const_iterator& _Right) const noexcept { do { if (_Ptr == _Right._Ptr) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 273, 0, "%s", "array iterators incompatible")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"array iterators incompatible\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 273, 0); } while (false); } ; } while (false); } using _Prevent_inheriting_unwrap = _Array_const_iterator; [[nodiscard]] constexpr pointer _Unwrapped() const noexcept { return _Ptr + _Idx; } constexpr void _Verify_with(const _Array_const_iterator& _Last) const noexcept { do { if (*this <= _Last) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 284, 0, "%s", "array iterator range transposed")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"array iterator range transposed\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 284, 0); } while (false); } ; } while (false); } constexpr void _Seek_to(pointer _It) noexcept { _Idx = static_cast<size_t>(_It - _Ptr); } private: pointer _Ptr; size_t _Idx; }; template <class _Ty, size_t _Size> constexpr void _Verify_range( const _Array_const_iterator<_Ty, _Size>& _First, const _Array_const_iterator<_Ty, _Size>& _Last) noexcept { _First._Verify_with(_Last); } template <class _Ty, size_t _Size> [[nodiscard]] constexpr _Array_const_iterator<_Ty, _Size> operator+( const ptrdiff_t _Off, _Array_const_iterator<_Ty, _Size> _Next) noexcept { return _Next += _Off; } template <class _Ty, size_t _Size> struct pointer_traits<_Array_const_iterator<_Ty, _Size>> { using pointer = _Array_const_iterator<_Ty, _Size>; using element_type = const _Ty; using difference_type = ptrdiff_t; [[nodiscard]] static constexpr element_type* to_address(const pointer _Iter) noexcept { return _Iter._Unwrapped(); } }; template <class _Ty, size_t _Size> class _Array_iterator : public _Array_const_iterator<_Ty, _Size> { public: using _Mybase = _Array_const_iterator<_Ty, _Size>; using iterator_concept = contiguous_iterator_tag; using iterator_category = random_access_iterator_tag; using value_type = _Ty; using difference_type = ptrdiff_t; using pointer = _Ty*; using reference = _Ty&; enum { _EEN_SIZE = _Size }; constexpr _Array_iterator() noexcept {} constexpr explicit _Array_iterator(pointer _Parg, size_t _Off = 0) noexcept : _Mybase(_Parg, _Off) {} [[nodiscard]] constexpr reference operator*() const noexcept { return const_cast<reference>(_Mybase::operator*()); } [[nodiscard]] constexpr pointer operator->() const noexcept { return const_cast<pointer>(_Mybase::operator->()); } constexpr _Array_iterator& operator++() noexcept { _Mybase::operator++(); return *this; } constexpr _Array_iterator operator++(int) noexcept { _Array_iterator _Tmp = *this; _Mybase::operator++(); return _Tmp; } constexpr _Array_iterator& operator--() noexcept { _Mybase::operator--(); return *this; } constexpr _Array_iterator operator--(int) noexcept { _Array_iterator _Tmp = *this; _Mybase::operator--(); return _Tmp; } constexpr _Array_iterator& operator+=(const ptrdiff_t _Off) noexcept { _Mybase::operator+=(_Off); return *this; } [[nodiscard]] constexpr _Array_iterator operator+(const ptrdiff_t _Off) const noexcept { _Array_iterator _Tmp = *this; return _Tmp += _Off; } constexpr _Array_iterator& operator-=(const ptrdiff_t _Off) noexcept { _Mybase::operator-=(_Off); return *this; } using _Mybase::operator-; [[nodiscard]] constexpr _Array_iterator operator-(const ptrdiff_t _Off) const noexcept { _Array_iterator _Tmp = *this; return _Tmp -= _Off; } [[nodiscard]] constexpr reference operator[](const ptrdiff_t _Off) const noexcept { return const_cast<reference>(_Mybase::operator[](_Off)); } using _Prevent_inheriting_unwrap = _Array_iterator; [[nodiscard]] constexpr pointer _Unwrapped() const noexcept { return const_cast<pointer>(_Mybase::_Unwrapped()); } }; template <class _Ty, size_t _Size> [[nodiscard]] constexpr _Array_iterator<_Ty, _Size> operator+( const ptrdiff_t _Off, _Array_iterator<_Ty, _Size> _Next) noexcept { return _Next += _Off; } template <class _Ty, size_t _Size> struct pointer_traits<_Array_iterator<_Ty, _Size>> { using pointer = _Array_iterator<_Ty, _Size>; using element_type = _Ty; using difference_type = ptrdiff_t; [[nodiscard]] static constexpr element_type* to_address(const pointer _Iter) noexcept { return _Iter._Unwrapped(); } }; template <class _Ty, size_t _Size> class array { public: using value_type = _Ty; using size_type = size_t; using difference_type = ptrdiff_t; using pointer = _Ty*; using const_pointer = const _Ty*; using reference = _Ty&; using const_reference = const _Ty&; using iterator = _Array_iterator<_Ty, _Size>; using const_iterator = _Array_const_iterator<_Ty, _Size>; using reverse_iterator = ::std:: reverse_iterator<iterator>; using const_reverse_iterator = ::std:: reverse_iterator<const_iterator>; constexpr void fill(const _Ty& _Value) { ::std:: fill_n(_Elems, _Size, _Value); } constexpr void swap(array& _Other) noexcept(_Is_nothrow_swappable<_Ty>::value) { _Swap_ranges_unchecked(_Elems, _Elems + _Size, _Other._Elems); } [[nodiscard]] constexpr iterator begin() noexcept { return iterator(_Elems, 0); } [[nodiscard]] constexpr const_iterator begin() const noexcept { return const_iterator(_Elems, 0); } [[nodiscard]] constexpr iterator end() noexcept { return iterator(_Elems, _Size); } [[nodiscard]] constexpr const_iterator end() const noexcept { return const_iterator(_Elems, _Size); } [[nodiscard]] constexpr reverse_iterator rbegin() noexcept { return reverse_iterator(end()); } [[nodiscard]] constexpr const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } [[nodiscard]] constexpr reverse_iterator rend() noexcept { return reverse_iterator(begin()); } [[nodiscard]] constexpr const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } [[nodiscard]] constexpr const_iterator cbegin() const noexcept { return begin(); } [[nodiscard]] constexpr const_iterator cend() const noexcept { return end(); } [[nodiscard]] constexpr const_reverse_iterator crbegin() const noexcept { return rbegin(); } [[nodiscard]] constexpr const_reverse_iterator crend() const noexcept { return rend(); } constexpr _Ty* _Unchecked_begin() noexcept { return _Elems; } constexpr const _Ty* _Unchecked_begin() const noexcept { return _Elems; } constexpr _Ty* _Unchecked_end() noexcept { return _Elems + _Size; } constexpr const _Ty* _Unchecked_end() const noexcept { return _Elems + _Size; } [[nodiscard]] constexpr size_type size() const noexcept { return _Size; } [[nodiscard]] constexpr size_type max_size() const noexcept { return _Size; } [[nodiscard]] constexpr bool empty() const noexcept { return false; } [[nodiscard]] constexpr reference at(size_type _Pos) { if (_Size <= _Pos) { _Xran(); } return _Elems[_Pos]; } [[nodiscard]] constexpr const_reference at(size_type _Pos) const { if (_Size <= _Pos) { _Xran(); } return _Elems[_Pos]; } [[nodiscard]] constexpr reference operator[]( size_type _Pos) noexcept { do { if (_Pos < _Size) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 554, 0, "%s", "array subscript out of range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"array subscript out of range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 554, 0); } while (false); } ; } while (false); return _Elems[_Pos]; } [[nodiscard]] constexpr const_reference operator[]( size_type _Pos) const noexcept { do { if (_Pos < _Size) { } else { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 563, 0, "%s", "array subscript out of range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"array subscript out of range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 563, 0); } while (false); } ; } while (false); return _Elems[_Pos]; } [[nodiscard]] constexpr reference front() noexcept { return _Elems[0]; } [[nodiscard]] constexpr const_reference front() const noexcept { return _Elems[0]; } [[nodiscard]] constexpr reference back() noexcept { return _Elems[_Size - 1]; } [[nodiscard]] constexpr const_reference back() const noexcept { return _Elems[_Size - 1]; } [[nodiscard]] constexpr _Ty* data() noexcept { return _Elems; } [[nodiscard]] constexpr const _Ty* data() const noexcept { return _Elems; } [[noreturn]] void _Xran() const { _Xout_of_range("invalid array<T, N> subscript"); } _Ty _Elems[_Size]; }; template <class _First, class... _Rest> struct _Enforce_same { static_assert(conjunction_v<is_same<_First, _Rest>...>, "N4687 26.3.7.2 [array.cons]/2: " "Requires: (is_same_v<T, U> && ...) is true. Otherwise the program is ill-formed."); using type = _First; }; template <class _First, class... _Rest> array(_First, _Rest...) -> array<typename _Enforce_same<_First, _Rest...>::type, 1 + sizeof...(_Rest)>; template <class _Ty> class array<_Ty, 0> { public: using value_type = _Ty; using size_type = size_t; using difference_type = ptrdiff_t; using pointer = _Ty*; using const_pointer = const _Ty*; using reference = _Ty&; using const_reference = const _Ty&; using iterator = _Array_iterator<_Ty, 0>; using const_iterator = _Array_const_iterator<_Ty, 0>; using reverse_iterator = ::std:: reverse_iterator<iterator>; using const_reverse_iterator = ::std:: reverse_iterator<const_iterator>; constexpr void fill(const _Ty&) {} constexpr void swap(array&) noexcept {} [[nodiscard]] constexpr iterator begin() noexcept { return iterator{}; } [[nodiscard]] constexpr const_iterator begin() const noexcept { return const_iterator{}; } [[nodiscard]] constexpr iterator end() noexcept { return iterator{}; } [[nodiscard]] constexpr const_iterator end() const noexcept { return const_iterator{}; } [[nodiscard]] constexpr reverse_iterator rbegin() noexcept { return reverse_iterator(end()); } [[nodiscard]] constexpr const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } [[nodiscard]] constexpr reverse_iterator rend() noexcept { return reverse_iterator(begin()); } [[nodiscard]] constexpr const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } [[nodiscard]] constexpr const_iterator cbegin() const noexcept { return begin(); } [[nodiscard]] constexpr const_iterator cend() const noexcept { return end(); } [[nodiscard]] constexpr const_reverse_iterator crbegin() const noexcept { return rbegin(); } [[nodiscard]] constexpr const_reverse_iterator crend() const noexcept { return rend(); } constexpr _Ty* _Unchecked_begin() noexcept { return nullptr; } constexpr const _Ty* _Unchecked_begin() const noexcept { return nullptr; } constexpr _Ty* _Unchecked_end() noexcept { return nullptr; } constexpr const _Ty* _Unchecked_end() const noexcept { return nullptr; } [[nodiscard]] constexpr size_type size() const noexcept { return 0; } [[nodiscard]] constexpr size_type max_size() const noexcept { return 0; } [[nodiscard]] constexpr bool empty() const noexcept { return true; } [[noreturn]] reference at(size_type) { _Xran(); } [[noreturn]] const_reference at(size_type) const { _Xran(); } [[nodiscard]] reference operator[](size_type) noexcept { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 723, 0, "%s", "array subscript out of range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"array subscript out of range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 723, 0); } while (false); return _Elems[0]; } [[nodiscard]] const_reference operator[](size_type) const noexcept { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 731, 0, "%s", "array subscript out of range")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"array subscript out of range\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 731, 0); } while (false); return _Elems[0]; } [[nodiscard]] reference front() noexcept { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 739, 0, "%s", "array<T, 0>::front() invalid")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"array<T, 0>::front() invalid\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 739, 0); } while (false); return _Elems[0]; } [[nodiscard]] const_reference front() const noexcept { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 747, 0, "%s", "array<T, 0>::front() invalid")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"array<T, 0>::front() invalid\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 747, 0); } while (false); return _Elems[0]; } [[nodiscard]] reference back() noexcept { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 755, 0, "%s", "array<T, 0>::back() invalid")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"array<T, 0>::back() invalid\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 755, 0); } while (false); return _Elems[0]; } [[nodiscard]] const_reference back() const noexcept { do { (void) ((1 != _CrtDbgReport(2, "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 763, 0, "%s", "array<T, 0>::back() invalid")) || (__debugbreak(), 0)); ::_invalid_parameter(L"\"array<T, 0>::back() invalid\"", __LPREFIX( __FUNCTION__), L"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\include\\array", 763, 0); } while (false); return _Elems[0]; } [[nodiscard]] constexpr _Ty* data() noexcept { return nullptr; } [[nodiscard]] constexpr const _Ty* data() const noexcept { return nullptr; } [[noreturn]] void _Xran() const { _Xout_of_range("invalid array<T, 0> subscript"); } _Ty _Elems[1]; }; template <class _Ty, size_t _Size, enable_if_t<_Size == 0 || _Is_swappable<_Ty>::value, int> = 0> constexpr void swap(array<_Ty, _Size>& _Left, array<_Ty, _Size>& _Right) noexcept(noexcept(_Left.swap(_Right))) { return _Left.swap(_Right); } template <class _Ty, size_t _Size> [[nodiscard]] constexpr bool operator==(const array<_Ty, _Size>& _Left, const array<_Ty, _Size>& _Right) { return ::std:: equal(_Left._Unchecked_begin(), _Left._Unchecked_end(), _Right._Unchecked_begin()); } template <class _Ty, size_t _Size> [[nodiscard]] constexpr _Synth_three_way_result<_Ty> operator<=>( const array<_Ty, _Size>& _Left, const array<_Ty, _Size>& _Right) { return ::std:: lexicographical_compare_three_way(_Left._Unchecked_begin(), _Left._Unchecked_end(), _Right._Unchecked_begin(), _Right._Unchecked_end(), _Synth_three_way{}); } template <class _Ty, size_t _Size, size_t... _Idx> [[nodiscard]] constexpr array<remove_cv_t<_Ty>, _Size> _To_array_lvalue_impl( _Ty (&_Array)[_Size], index_sequence<_Idx...>) { return {{_Array[_Idx]...}}; } template <class _Ty, size_t _Size, size_t... _Idx> [[nodiscard]] constexpr array<remove_cv_t<_Ty>, _Size> _To_array_rvalue_impl( _Ty(&&_Array)[_Size], index_sequence<_Idx...>) { return {{::std:: move(_Array[_Idx])...}}; } template <class _Ty, size_t _Size> [[nodiscard]] constexpr array<remove_cv_t<_Ty>, _Size> to_array(_Ty (&_Array)[_Size]) { static_assert(!is_array_v<_Ty>, "N4830 [array.creation]/1: " "to_array does not accept multidimensional arrays."); static_assert(is_constructible_v<_Ty, _Ty&>, "N4830 [array.creation]/1: " "to_array requires copy constructible elements."); return _To_array_lvalue_impl(_Array, make_index_sequence<_Size>{}); } template <class _Ty, size_t _Size> [[nodiscard]] constexpr array<remove_cv_t<_Ty>, _Size> to_array(_Ty(&&_Array)[_Size]) { static_assert(!is_array_v<_Ty>, "N4830 [array.creation]/4: " "to_array does not accept multidimensional arrays."); static_assert(is_move_constructible_v<_Ty>, "N4830 [array.creation]/4: " "to_array requires move constructible elements."); return _To_array_rvalue_impl(::std:: move(_Array), make_index_sequence<_Size>{}); } template <size_t _Idx, class _Ty, size_t _Size> [[nodiscard]] constexpr _Ty& get(array<_Ty, _Size>& _Arr) noexcept { static_assert(_Idx < _Size, "array index out of bounds"); return _Arr._Elems[_Idx]; } template <size_t _Idx, class _Ty, size_t _Size> [[nodiscard]] constexpr const _Ty& get(const array<_Ty, _Size>& _Arr) noexcept { static_assert(_Idx < _Size, "array index out of bounds"); return _Arr._Elems[_Idx]; } template <size_t _Idx, class _Ty, size_t _Size> [[nodiscard]] constexpr _Ty&& get(array<_Ty, _Size>&& _Arr) noexcept { static_assert(_Idx < _Size, "array index out of bounds"); return ::std:: move(_Arr._Elems[_Idx]); } template <size_t _Idx, class _Ty, size_t _Size> [[nodiscard]] constexpr const _Ty&& get(const array<_Ty, _Size>&& _Arr) noexcept { static_assert(_Idx < _Size, "array index out of bounds"); return ::std:: move(_Arr._Elems[_Idx]); } } #pragma warning(pop) #pragma pack(pop) #pragma external_header(pop) namespace tuple { namespace detail { template <class Tuple, class F, size_t I> constexpr void invoke(Tuple&& tuple, F f) noexcept { f(std::get<I>(tuple)); } template <class Tuple, class F, size_t... I> [[nodiscard]] constexpr auto make_functor(std::index_sequence<I...>) noexcept { return std::array<void (*)(Tuple &, F), sizeof...(I)>{invoke<Tuple, F, I>...}; } template <class Tuple, class F, size_t... I> [[nodiscard]] constexpr auto make_functor_const(std::index_sequence<I...>) noexcept { return std::array<void (*)(const Tuple &, F), sizeof...(I)>{invoke<const Tuple, F, I>...}; } } template <class Tuple> inline constexpr size_t tuple_size_v_omnivorous = std::tuple_size_v<std::remove_reference_t<Tuple>>; template <class Tuple, class F> constexpr void visit(Tuple&& t, size_t index, F f) noexcept { if constexpr (std::is_const_v<Tuple>) { constexpr auto functors = detail::make_functor_const<Tuple, F>(std::make_index_sequence<tuple_size_v_omnivorous<Tuple>>()); return functors[index](std::forward<Tuple>(t), f); } else { constexpr auto functors = detail::make_functor<Tuple, F>(std::make_index_sequence<tuple_size_v_omnivorous<Tuple>>()); return functors[index](std::forward<Tuple>(t), f); } } template <typename T, typename... Args> [[nodiscard]] constexpr size_t indexForType(const std::tuple<Args...>&) noexcept { return ::pack::index_for_type_v<T, Args...>; } template <class Tuple> [[nodiscard]] constexpr size_t size(Tuple&&) noexcept { return tuple_size_v_omnivorous<Tuple>; } template<class Tuple, class F> void for_each(Tuple&& tuple, F func) noexcept { constexpr_for<0, tuple_size_v_omnivorous<Tuple>>([&](auto index_wrapper){ ::tuple::visit(tuple, index_wrapper, func); }); } } #pragma once template <typename TargetType, typename SourceType, typename... TargetType_Constructor_Arguments> constexpr TargetType memory_cast(SourceType source, TargetType_Constructor_Arguments&& ...constructorArguments) noexcept { static_assert((!std::is_pointer_v<std::remove_cv_t<SourceType>> && is_trivially_serializable_v<SourceType>) || (std::is_pointer_v< std::remove_cv_t<SourceType>> && is_trivially_serializable_v<std::remove_pointer_t<std::remove_cv_t<SourceType>>>)); static_assert(!std::is_pointer_v<TargetType> && is_trivially_serializable_v<TargetType>); TargetType value{std::forward<TargetType_Constructor_Arguments>(constructorArguments)...}; if constexpr (std::is_pointer_v<SourceType>) ::memcpy(std::addressof(value), source, sizeof(value)); else { static_assert(sizeof(SourceType) == sizeof(TargetType)); ::memcpy(std::addressof(value), std::addressof(source), sizeof(value)); } return value; } #pragma external_header(push) #pragma once #pragma external_header(pop) template <typename T, auto bitPattern> struct Tombstone { using FieldType = T; static constexpr auto id = FieldType::id; static constexpr bool is_valid_v = true; static_assert(FieldType::staticSize() == sizeof(bitPattern)); static_assert(FieldType::isField()); [[nodiscard]] constexpr static auto tombstoneValue() noexcept { return bitPattern; } template <typename U> [[nodiscard]] constexpr static bool isTombstoneValue(U&& value) noexcept { static_assert(sizeof(value) == sizeof(bitPattern)); if constexpr (is_equal_comparable_v<remove_cv_and_reference_t<U>, decltype(bitPattern)>) return value == bitPattern; else { const auto localBitPattern = bitPattern; return ::memcmp(std::addressof(value), std::addressof(localBitPattern), sizeof(bitPattern)) == 0; } } }; template <auto fieldId, bool is_array> struct Tombstone<Field<std::string, fieldId, is_array>, 0> { using FieldType = Field<std::string, fieldId, is_array>; static constexpr auto id = fieldId; static constexpr bool is_valid_v = true; [[nodiscard]] constexpr static std::string_view tombstoneValue() noexcept { return std::string_view(tombstoneString, std::size(tombstoneString) - 1); } template <typename U> [[nodiscard]] constexpr static bool isTombstoneValue(const std::string& value) noexcept { return value == tombstoneValue(); } private: static constexpr const char tombstoneString[] = "#1IcX~|"; }; template<> struct Tombstone<void, 0> { using FieldType = void; static constexpr auto id = -1; static constexpr bool is_valid_v = false; template <typename T> static constexpr bool isTombstoneValue(T&&) noexcept { return false; } }; using NoTombstone = Tombstone<void, 0>; template <class TombstoneField , typename... FieldsSequence> class DbRecord { public: static constexpr bool isRecord() noexcept { return true; } static constexpr bool hasTombstone() noexcept { return TombstoneField::is_valid_v; } template <size_t index> using FieldTypeByIndex_t = pack::type_by_index<index, FieldsSequence...>; template <auto id> using FieldById_t = ::FieldById_t<id, FieldsSequence...>; using FieldTypesPack = type_pack<FieldsSequence...>; using KeyField = typename FieldTypesPack::template Type<0>; public: constexpr DbRecord() = default; template <typename... Values> constexpr explicit DbRecord(Values&&... values) : _fields{std::forward<Values>(values)...} { static_assert(sizeof...(Values) == sizeof...(FieldsSequence)); } template <typename Field> constexpr const auto& fieldValue() const & noexcept { return std::get<pack::index_for_type_v<Field, FieldsSequence...>>(_fields).value; } template <typename Field> constexpr auto& fieldValue() & noexcept { return std::get<pack::index_for_type_v<Field, FieldsSequence...>>(_fields).value; } static constexpr bool allFieldsHaveStaticSize() noexcept { bool nonStaticSizeFieldDetected = false; pack::for_type<FieldsSequence...>([&nonStaticSizeFieldDetected](auto type) { if (!decltype(type)::type::sizeKnownAtCompileTime()) nonStaticSizeFieldDetected = true; }); return nonStaticSizeFieldDetected == false; } static constexpr size_t staticFieldsCount() noexcept { size_t count = 0; constexpr_for<0, sizeof...(FieldsSequence)>([&count](auto i) { using FieldType = pack::type_by_index<decltype(i)::value, FieldsSequence...>; if constexpr (FieldType::sizeKnownAtCompileTime() == true) ++count; }); return count; } static constexpr size_t staticFieldsSize() noexcept { size_t totalSize = 0; constexpr_for<0, staticFieldsCount()>([&totalSize](auto i) { using FieldType = pack::type_by_index<decltype(i)::value, FieldsSequence...>; static_assert(FieldType::sizeKnownAtCompileTime() == true); totalSize += FieldType::staticSize(); }); return totalSize; } size_t totalSize() const noexcept { size_t totalSize = staticFieldsSize(); constexpr_for<staticFieldsCount(), sizeof...(FieldsSequence)>([&totalSize, this](auto i) { using FieldType = pack::type_by_index<decltype(i)::value, FieldsSequence...>; static_assert(FieldType::sizeKnownAtCompileTime() == false); totalSize += std::get<i>(_fields).fieldSize(); }); return totalSize; } template <int index> constexpr auto& fieldAtIndex() & noexcept { return std::get<index>(_fields); } template <int index> constexpr const auto& fieldAtIndex() const & noexcept { return std::get<index>(_fields); } static constexpr size_t fieldCount() noexcept { return sizeof...(FieldsSequence); } template <typename U> static constexpr bool isTombstoneValue(U&& value) noexcept { return TombstoneField::isTombstoneValue(std::forward<U>(value)); } constexpr bool operator==(const DbRecord& other) const noexcept { return _fields == other._fields; } template <typename F> static constexpr bool has_field_v = pack::has_type_v<F, FieldsSequence...>; private: static constexpr bool checkAssertions() noexcept { constexpr_for<1, sizeof...(FieldsSequence)>([](auto index) { using Field1 = typename pack::type_by_index<index - 1, FieldsSequence...>; using Field2 = typename pack::type_by_index<index, FieldsSequence...>; static_assert(!(Field1::sizeKnownAtCompileTime() == false && Field2::sizeKnownAtCompileTime() == true), "All the fields with compile-time size must be grouped before fields with dynamic size."); static_assert(pack::type_count<Field1, FieldsSequence...>() == 1 && pack::type_count<Field2, FieldsSequence...>() == 1, "Each unique field type shall only be specified once within a record!"); static_assert(Field1::id != Field2::id, "All the fields must have different IDs!"); static_assert(std::is_same_v<Field2, std::tuple_element_t<index, std::tuple<FieldsSequence...>>>); }); return true; } static_assert(checkAssertions()); private: std::tuple<FieldsSequence...> _fields; }; using Fi = Field<uint64_t, 5>; using Fd = Field<double, 6>; const DbRecord<Tombstone<Fi, 0ULL>, Fi, Fd> record{ 123, 1.0 };
Become a Patron
Sponsor on GitHub
Donate via PayPal
Compiler Explorer Shop
Source on GitHub
Mailing list
Installed libraries
Wiki
Report an issue
How it works
Contact the author
CE on Mastodon
CE on Bluesky
Statistics
Changelog
Version tree