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
Yul (Solidity IR)
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
BPF clang 21.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
LoongArch64 clang 21.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
MinGW gcc 14.3.0
MinGW gcc 15.2.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 21.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 21.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 21.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 21.1.0
armv8-a clang 9.0.0
armv8-a clang 9.0.1
clad trunk (clang 21.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)
clad v2.1 (clang 21.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 clang 21.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 clang 21.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
mips64el clang 21.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 clang 21.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 nvc++ 25.9
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 21.1.0
x86-64 clang 21.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 clang rocm-7.0.1
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 warning(push) #pragma warning(disable: 4001) #pragma warning(push) #pragma warning(disable: 4001) #pragma warning(pop) #pragma warning(pop) namespace std { inline namespace __1 { } } extern "C" { } extern "C" { } #pragma pack(push, 8) 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 pack(pop) #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 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; void __cdecl _invalid_parameter_noinfo(void); __declspec(noreturn) void __cdecl _invalid_parameter_noinfo_noreturn(void); __declspec(noreturn) 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 pack(push, 8) extern "C" { int* __cdecl _errno(void); errno_t __cdecl _set_errno( int _Value); errno_t __cdecl _get_errno( int* _Value); unsigned long* __cdecl __doserrno(void); errno_t __cdecl _set_doserrno( unsigned long _Value); errno_t __cdecl _get_doserrno( unsigned long * _Value); } #pragma pack(pop) #pragma pack(push, 8) extern "C" { } #pragma pack(pop) #pragma pack(push, 8) extern "C" { __declspec(allocator) __declspec(restrict) void* __cdecl _calloc_base( size_t _Count, size_t _Size ); __declspec(allocator) __declspec(restrict) void* __cdecl calloc( size_t _Count, size_t _Size ); int __cdecl _callnewh( size_t _Size ); __declspec(allocator) void* __cdecl _expand( void* _Block, size_t _Size ); void __cdecl _free_base( void* _Block ); void __cdecl free( void* _Block ); __declspec(allocator) __declspec(restrict) void* __cdecl _malloc_base( size_t _Size ); __declspec(allocator) __declspec(restrict) void* __cdecl malloc( size_t _Size ); size_t __cdecl _msize_base( void* _Block ); size_t __cdecl _msize( void* _Block ); __declspec(allocator) __declspec(restrict) void* __cdecl _realloc_base( void* _Block, size_t _Size ); __declspec(allocator) __declspec(restrict) void* __cdecl realloc( void* _Block, size_t _Size ); __declspec(allocator) __declspec(restrict) void* __cdecl _recalloc_base( void* _Block, size_t _Count, size_t _Size ); __declspec(allocator) __declspec(restrict) void* __cdecl _recalloc( void* _Block, size_t _Count, size_t _Size ); void __cdecl _aligned_free( void* _Block ); __declspec(allocator) __declspec(restrict) void* __cdecl _aligned_malloc( size_t _Size, size_t _Alignment ); __declspec(allocator) __declspec(restrict) void* __cdecl _aligned_offset_malloc( size_t _Size, size_t _Alignment, size_t _Offset ); size_t __cdecl _aligned_msize( void* _Block, size_t _Alignment, size_t _Offset ); __declspec(allocator) __declspec(restrict) void* __cdecl _aligned_offset_realloc( void* _Block, size_t _Size, size_t _Alignment, size_t _Offset ); __declspec(allocator) __declspec(restrict) void* __cdecl _aligned_offset_recalloc( void* _Block, size_t _Count, size_t _Size, size_t _Alignment, size_t _Offset ); __declspec(allocator) __declspec(restrict) void* __cdecl _aligned_realloc( void* _Block, size_t _Size, size_t _Alignment ); __declspec(allocator) __declspec(restrict) void* __cdecl _aligned_recalloc( void* _Block, size_t _Count, size_t _Size, size_t _Alignment ); } #pragma pack(pop) typedef long long int ptrdiff_t; typedef long long unsigned int size_t; namespace std { typedef decltype(nullptr) nullptr_t; } using ::std::nullptr_t; typedef double max_align_t; extern "C++" { namespace std { typedef decltype(nullptr) nullptr_t; } using std::nullptr_t; } #pragma pack(push, 8) extern "C" { typedef int (__cdecl* _CoreCrtSecureSearchSortCompareFunction)(void*, void const*, void const*); typedef int (__cdecl* _CoreCrtNonSecureSearchSortCompareFunction)(void const*, void const*); void* __cdecl bsearch_s( void const* _Key, void const* _Base, rsize_t _NumOfElements, rsize_t _SizeOfElements, _CoreCrtSecureSearchSortCompareFunction _CompareFunction, void* _Context ); void __cdecl qsort_s( void* _Base, rsize_t _NumOfElements, rsize_t _SizeOfElements, _CoreCrtSecureSearchSortCompareFunction _CompareFunction, void* _Context ); void* __cdecl bsearch( void const* _Key, void const* _Base, size_t _NumOfElements, size_t _SizeOfElements, _CoreCrtNonSecureSearchSortCompareFunction _CompareFunction ); void __cdecl qsort( void* _Base, size_t _NumOfElements, size_t _SizeOfElements, _CoreCrtNonSecureSearchSortCompareFunction _CompareFunction ); void* __cdecl _lfind_s( void const* _Key, void const* _Base, unsigned int* _NumOfElements, size_t _SizeOfElements, _CoreCrtSecureSearchSortCompareFunction _CompareFunction, void* _Context ); void* __cdecl _lfind( void const* _Key, void const* _Base, unsigned int* _NumOfElements, unsigned int _SizeOfElements, _CoreCrtNonSecureSearchSortCompareFunction _CompareFunction ); void* __cdecl _lsearch_s( void const* _Key, void* _Base, unsigned int* _NumOfElements, size_t _SizeOfElements, _CoreCrtSecureSearchSortCompareFunction _CompareFunction, void* _Context ); 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.")) 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.")) void* __cdecl lsearch( void const* _Key, void* _Base, unsigned int* _NumOfElements, unsigned int _SizeOfElements, _CoreCrtNonSecureSearchSortCompareFunction _CompareFunction ); } #pragma pack(pop) #pragma pack(push, 8) extern "C" { 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); } } wchar_t* __cdecl _itow(int _Value, wchar_t *_Buffer, int _Radix); 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); } } wchar_t* __cdecl _ltow(long _Value, wchar_t *_Buffer, int _Radix); 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); } } wchar_t* __cdecl _ultow(unsigned long _Value, wchar_t *_Buffer, int _Radix); double __cdecl wcstod( wchar_t const* _String, wchar_t** _EndPtr ); double __cdecl _wcstod_l( wchar_t const* _String, wchar_t** _EndPtr, _locale_t _Locale ); long __cdecl wcstol( wchar_t const* _String, wchar_t** _EndPtr, int _Radix ); long __cdecl _wcstol_l( wchar_t const* _String, wchar_t** _EndPtr, int _Radix, _locale_t _Locale ); long long __cdecl wcstoll( wchar_t const* _String, wchar_t** _EndPtr, int _Radix ); long long __cdecl _wcstoll_l( wchar_t const* _String, wchar_t** _EndPtr, int _Radix, _locale_t _Locale ); unsigned long __cdecl wcstoul( wchar_t const* _String, wchar_t** _EndPtr, int _Radix ); unsigned long __cdecl _wcstoul_l( wchar_t const* _String, wchar_t** _EndPtr, int _Radix, _locale_t _Locale ); unsigned long long __cdecl wcstoull( wchar_t const* _String, wchar_t** _EndPtr, int _Radix ); unsigned long long __cdecl _wcstoull_l( wchar_t const* _String, wchar_t** _EndPtr, int _Radix, _locale_t _Locale ); long double __cdecl wcstold( wchar_t const* _String, wchar_t** _EndPtr ); long double __cdecl _wcstold_l( wchar_t const* _String, wchar_t** _EndPtr, _locale_t _Locale ); float __cdecl wcstof( wchar_t const* _String, wchar_t** _EndPtr ); float __cdecl _wcstof_l( wchar_t const* _String, wchar_t** _EndPtr, _locale_t _Locale ); double __cdecl _wtof( wchar_t const* _String ); double __cdecl _wtof_l( wchar_t const* _String, _locale_t _Locale ); int __cdecl _wtoi( wchar_t const* _String ); int __cdecl _wtoi_l( wchar_t const* _String, _locale_t _Locale ); long __cdecl _wtol( wchar_t const* _String ); long __cdecl _wtol_l( wchar_t const* _String, _locale_t _Locale ); long long __cdecl _wtoll( wchar_t const* _String ); long long __cdecl _wtoll_l( wchar_t const* _String, _locale_t _Locale ); errno_t __cdecl _i64tow_s( __int64 _Value, wchar_t* _Buffer, size_t _BufferCount, int _Radix ); wchar_t* __cdecl _i64tow( __int64 _Value, wchar_t* _Buffer, int _Radix ); errno_t __cdecl _ui64tow_s( unsigned __int64 _Value, wchar_t* _Buffer, size_t _BufferCount, int _Radix ); wchar_t* __cdecl _ui64tow( unsigned __int64 _Value, wchar_t* _Buffer, int _Radix ); __int64 __cdecl _wtoi64( wchar_t const* _String ); __int64 __cdecl _wtoi64_l( wchar_t const* _String, _locale_t _Locale ); __int64 __cdecl _wcstoi64( wchar_t const* _String, wchar_t** _EndPtr, int _Radix ); __int64 __cdecl _wcstoi64_l( wchar_t const* _String, wchar_t** _EndPtr, int _Radix, _locale_t _Locale ); unsigned __int64 __cdecl _wcstoui64( wchar_t const* _String, wchar_t** _EndPtr, int _Radix ); unsigned __int64 __cdecl _wcstoui64_l( wchar_t const* _String, wchar_t** _EndPtr, int _Radix, _locale_t _Locale ); __declspec(allocator) wchar_t* __cdecl _wfullpath( wchar_t* _Buffer, wchar_t const* _Path, size_t _BufferCount ); 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); } } #pragma warning(push) #pragma warning(disable: 28719) #pragma warning(disable: 28726) void __cdecl _wmakepath( wchar_t *_Buffer, wchar_t const* _Drive, wchar_t const* _Dir, wchar_t const* _Filename, wchar_t const* _Ext); #pragma warning(pop) void __cdecl _wperror( wchar_t const* _ErrorMessage ); void __cdecl _wsplitpath( wchar_t const* _FullPath, wchar_t* _Drive, wchar_t* _Dir, wchar_t* _Filename, wchar_t* _Ext ); 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); } } errno_t __cdecl _wdupenv_s( wchar_t** _Buffer, size_t* _BufferCount, wchar_t const* _VarName ); wchar_t* __cdecl _wgetenv( wchar_t const* _VarName ); 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); } } int __cdecl _wputenv( wchar_t const* _EnvString ); errno_t __cdecl _wputenv_s( wchar_t const* _Name, wchar_t const* _Value ); 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); } } void __cdecl _wsearchenv(wchar_t const* _Filename, wchar_t const* _VarName, wchar_t *_ResultPath); int __cdecl _wsystem( wchar_t const* _Command ); } #pragma pack(pop) #pragma pack(push, 8) extern "C" { void __cdecl _swab( char* _Buf1, char* _Buf2, int _SizeInBytes ); __declspec(noreturn) void __cdecl exit( int _Code); __declspec(noreturn) void __cdecl _exit( int _Code); __declspec(noreturn) void __cdecl _Exit( int _Code); __declspec(noreturn) void __cdecl quick_exit( int _Code); __declspec(noreturn) void __cdecl abort(void); 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); _invalid_parameter_handler __cdecl _set_invalid_parameter_handler( _invalid_parameter_handler _Handler ); _invalid_parameter_handler __cdecl _get_invalid_parameter_handler(void); _invalid_parameter_handler __cdecl _set_thread_local_invalid_parameter_handler( _invalid_parameter_handler _Handler ); _invalid_parameter_handler __cdecl _get_thread_local_invalid_parameter_handler(void); int __cdecl _set_error_mode( int _Mode); int* __cdecl _errno(void); errno_t __cdecl _set_errno( int _Value); errno_t __cdecl _get_errno( int* _Value); unsigned long* __cdecl __doserrno(void); errno_t __cdecl _set_doserrno( unsigned long _Value); errno_t __cdecl _get_doserrno( unsigned long * _Value); char** __cdecl __sys_errlist(void); int * __cdecl __sys_nerr(void); void __cdecl perror( char const* _ErrMsg); char** __cdecl __p__pgmptr (void); wchar_t** __cdecl __p__wpgmptr(void); int* __cdecl __p__fmode (void); errno_t __cdecl _get_pgmptr ( char** _Value); errno_t __cdecl _get_wpgmptr( wchar_t** _Value); errno_t __cdecl _set_fmode ( int _Mode ); 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); div_t __cdecl div ( int _Numerator, int _Denominator); ldiv_t __cdecl ldiv ( long _Numerator, long _Denominator); 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) void __cdecl srand( unsigned int _Seed); int __cdecl rand(void); errno_t __cdecl rand_s( unsigned int* _RandomValue); 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) double __cdecl atof ( char const* _String); int __cdecl atoi ( char const* _String); long __cdecl atol ( char const* _String); long long __cdecl atoll ( char const* _String); __int64 __cdecl _atoi64( char const* _String); double __cdecl _atof_l ( char const* _String, _locale_t _Locale); int __cdecl _atoi_l ( char const* _String, _locale_t _Locale); long __cdecl _atol_l ( char const* _String, _locale_t _Locale); long long __cdecl _atoll_l ( char const* _String, _locale_t _Locale); __int64 __cdecl _atoi64_l( char const* _String, _locale_t _Locale); int __cdecl _atoflt ( _CRT_FLOAT* _Result, char const* _String); int __cdecl _atodbl ( _CRT_DOUBLE* _Result, char* _String); int __cdecl _atoldbl( _LDOUBLE* _Result, char* _String); int __cdecl _atoflt_l( _CRT_FLOAT* _Result, char const* _String, _locale_t _Locale ); int __cdecl _atodbl_l( _CRT_DOUBLE* _Result, char* _String, _locale_t _Locale ); int __cdecl _atoldbl_l( _LDOUBLE* _Result, char* _String, _locale_t _Locale ); float __cdecl strtof( char const* _String, char** _EndPtr ); float __cdecl _strtof_l( char const* _String, char** _EndPtr, _locale_t _Locale ); double __cdecl strtod( char const* _String, char** _EndPtr ); double __cdecl _strtod_l( char const* _String, char** _EndPtr, _locale_t _Locale ); long double __cdecl strtold( char const* _String, char** _EndPtr ); long double __cdecl _strtold_l( char const* _String, char** _EndPtr, _locale_t _Locale ); long __cdecl strtol( char const* _String, char** _EndPtr, int _Radix ); long __cdecl _strtol_l( char const* _String, char** _EndPtr, int _Radix, _locale_t _Locale ); long long __cdecl strtoll( char const* _String, char** _EndPtr, int _Radix ); long long __cdecl _strtoll_l( char const* _String, char** _EndPtr, int _Radix, _locale_t _Locale ); unsigned long __cdecl strtoul( char const* _String, char** _EndPtr, int _Radix ); unsigned long __cdecl _strtoul_l( char const* _String, char** _EndPtr, int _Radix, _locale_t _Locale ); unsigned long long __cdecl strtoull( char const* _String, char** _EndPtr, int _Radix ); unsigned long long __cdecl _strtoull_l( char const* _String, char** _EndPtr, int _Radix, _locale_t _Locale ); __int64 __cdecl _strtoi64( char const* _String, char** _EndPtr, int _Radix ); __int64 __cdecl _strtoi64_l( char const* _String, char** _EndPtr, int _Radix, _locale_t _Locale ); unsigned __int64 __cdecl _strtoui64( char const* _String, char** _EndPtr, int _Radix ); unsigned __int64 __cdecl _strtoui64_l( char const* _String, char** _EndPtr, int _Radix, _locale_t _Locale ); 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); } } #pragma warning(push) #pragma warning(disable: 28719) #pragma warning(disable: 28726) char* __cdecl _itoa(int _Value, char *_Buffer, int _Radix); #pragma warning(pop) 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); } } char* __cdecl _ltoa(long _Value, char *_Buffer, int _Radix); 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); } } #pragma warning(push) #pragma warning(disable: 28726) char* __cdecl _ultoa(unsigned long _Value, char *_Buffer, int _Radix); #pragma warning(pop) errno_t __cdecl _i64toa_s( __int64 _Value, char* _Buffer, size_t _BufferCount, int _Radix ); char* __cdecl _i64toa( __int64 _Value, char* _Buffer, int _Radix ); errno_t __cdecl _ui64toa_s( unsigned __int64 _Value, char* _Buffer, size_t _BufferCount, int _Radix ); char* __cdecl _ui64toa( unsigned __int64 _Value, char* _Buffer, int _Radix ); 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); } } char* __cdecl _ecvt( double _Value, int _DigitCount, int* _PtDec, int* _PtSign ); 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); } } char* __cdecl _fcvt( double _Value, int _FractionalDigitCount, int* _PtDec, int* _PtSign ); 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); } } char* __cdecl _gcvt( double _Value, int _DigitCount, char* _Buffer ); int __cdecl ___mb_cur_max_func(void); int __cdecl ___mb_cur_max_l_func(_locale_t _Locale); int __cdecl mblen( char const* _Ch, size_t _MaxCount ); int __cdecl _mblen_l( char const* _Ch, size_t _MaxCount, _locale_t _Locale ); size_t __cdecl _mbstrlen( char const* _String ); size_t __cdecl _mbstrlen_l( char const* _String, _locale_t _Locale ); size_t __cdecl _mbstrnlen( char const* _String, size_t _MaxCount ); size_t __cdecl _mbstrnlen_l( char const* _String, size_t _MaxCount, _locale_t _Locale ); int __cdecl mbtowc( wchar_t* _DstCh, char const* _SrcCh, size_t _SrcSizeInBytes ); int __cdecl _mbtowc_l( wchar_t* _DstCh, char const* _SrcCh, size_t _SrcSizeInBytes, _locale_t _Locale ); 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); } } size_t __cdecl mbstowcs( wchar_t *_Dest, char const* _Source, size_t _MaxCount); 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); } } size_t __cdecl _mbstowcs_l( wchar_t *_Dest, char const* _Source, size_t _MaxCount, _locale_t _Locale); int __cdecl wctomb( char* _MbCh, wchar_t _WCh ); int __cdecl _wctomb_l( char* _MbCh, wchar_t _WCh, _locale_t _Locale ); errno_t __cdecl wctomb_s( int* _SizeConverted, char* _MbCh, rsize_t _SizeInBytes, wchar_t _WCh ); errno_t __cdecl _wctomb_s_l( int* _SizeConverted, char* _MbCh, size_t _SizeInBytes, wchar_t _WCh, _locale_t _Locale); 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); } } size_t __cdecl wcstombs( char *_Dest, wchar_t const* _Source, size_t _MaxCount); 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); } } size_t __cdecl _wcstombs_l( char *_Dest, wchar_t const* _Source, size_t _MaxCount, _locale_t _Locale); __declspec(allocator) char* __cdecl _fullpath( char* _Buffer, char const* _Path, size_t _BufferCount ); 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); } } #pragma warning(push) #pragma warning(disable: 28719) #pragma warning(disable: 28726) void __cdecl _makepath( char *_Buffer, char const* _Drive, char const* _Dir, char const* _Filename, char const* _Ext); #pragma warning(pop) void __cdecl _splitpath( char const* _FullPath, char* _Drive, char* _Dir, char* _Filename, char* _Ext ); 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); } } errno_t __cdecl getenv_s( size_t* _RequiredCount, char* _Buffer, rsize_t _BufferCount, char const* _VarName ); int* __cdecl __p___argc (void); char*** __cdecl __p___argv (void); wchar_t*** __cdecl __p___wargv(void); char*** __cdecl __p__environ (void); wchar_t*** __cdecl __p__wenviron(void); 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); } } errno_t __cdecl _dupenv_s( char** _Buffer, size_t* _BufferCount, char const* _VarName ); int __cdecl system( char const* _Command ); #pragma warning(push) #pragma warning(disable: 6540) int __cdecl _putenv( char const* _EnvString ); errno_t __cdecl _putenv_s( char const* _Name, char const* _Value ); #pragma warning(pop) 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); } } 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.")) 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.")) 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.")) 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.")) 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.")) 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.")) 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.")) 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.")) 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.")) 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.")) 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.")) int __cdecl putenv( char const* _EnvString ); #pragma warning(pop) _onexit_t __cdecl onexit( _onexit_t _Func); } #pragma pack(pop) #pragma pack(push, 8) extern "C" { #pragma warning(push) #pragma warning(disable: 4738) #pragma warning(disable: 4820) 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); short __cdecl _dclass( double _X); short __cdecl _ldclass( long double _X); short __cdecl _fdclass( float _X); int __cdecl _dsign( double _X); int __cdecl _ldsign( long double _X); int __cdecl _fdsign( float _X); int __cdecl _dpcomp( double _X, double _Y); int __cdecl _ldpcomp( long double _X, long double _Y); int __cdecl _fdpcomp( float _X, float _Y); short __cdecl _dtest( double* _Px); short __cdecl _ldtest( long double* _Px); short __cdecl _fdtest( float* _Px); short __cdecl _d_int( double* _Px, short _Xexp); short __cdecl _ld_int( long double* _Px, short _Xexp); short __cdecl _fd_int( float* _Px, short _Xexp); short __cdecl _dscale( double* _Px, long _Lexp); short __cdecl _ldscale( long double* _Px, long _Lexp); short __cdecl _fdscale( float* _Px, long _Lexp); short __cdecl _dunscale( short* _Pex, double* _Px); short __cdecl _ldunscale( short* _Pex, long double* _Px); short __cdecl _fdunscale( short* _Pex, float* _Px); short __cdecl _dexp( double* _Px, double _Y, long _Eoff); short __cdecl _ldexp( long double* _Px, long double _Y, long _Eoff); short __cdecl _fdexp( float* _Px, float _Y, long _Eoff); short __cdecl _dnorm( unsigned short* _Ps); short __cdecl _fdnorm( unsigned short* _Ps); double __cdecl _dpoly( double _X, double const* _Tab, int _N); long double __cdecl _ldpoly( long double _X, long double const* _Tab, int _N); float __cdecl _fdpoly( float _X, float const* _Tab, int _N); double __cdecl _dlog( double _X, int _Baseflag); long double __cdecl _ldlog( long double _X, int _Baseflag); float __cdecl _fdlog( float _X, int _Baseflag); double __cdecl _dsin( double _X, unsigned int _Qoff); long double __cdecl _ldsin( long double _X, unsigned int _Qoff); 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); double __cdecl acosh( double _X); double __cdecl asinh( double _X); double __cdecl atanh( double _X); double __cdecl atof( char const* _String); double __cdecl _atof_l( char const* _String, _locale_t _Locale); double __cdecl _cabs( struct _complex _Complex_value); double __cdecl cbrt( double _X); double __cdecl ceil( double _X); double __cdecl _chgsign( double _X); double __cdecl copysign( double _Number, double _Sign); double __cdecl _copysign( double _Number, double _Sign); double __cdecl erf( double _X); double __cdecl erfc( double _X); double __cdecl exp2( double _X); double __cdecl expm1( double _X); double __cdecl fdim( double _X, double _Y); double __cdecl floor( double _X); double __cdecl fma( double _X, double _Y, double _Z); double __cdecl fmax( double _X, double _Y); double __cdecl fmin( double _X, double _Y); double __cdecl frexp( double _X, int* _Y); double __cdecl hypot( double _X, double _Y); double __cdecl _hypot( double _X, double _Y); int __cdecl ilogb( double _X); double __cdecl ldexp( double _X, int _Y); double __cdecl lgamma( double _X); long long __cdecl llrint( double _X); long long __cdecl llround( double _X); double __cdecl log1p( double _X); double __cdecl log2( double _X); double __cdecl logb( double _X); long __cdecl lrint( double _X); long __cdecl lround( double _X); int __cdecl _matherr( struct _exception* _Except); double __cdecl modf( double _X, double* _Y); double __cdecl nan( char const* _X); double __cdecl nearbyint( double _X); double __cdecl nextafter( double _X, double _Y); double __cdecl nexttoward( double _X, long double _Y); double __cdecl remainder( double _X, double _Y); double __cdecl remquo( double _X, double _Y, int* _Z); double __cdecl rint( double _X); double __cdecl round( double _X); double __cdecl scalbln( double _X, long _Y); double __cdecl scalbn( double _X, int _Y); double __cdecl tgamma( double _X); double __cdecl trunc( double _X); double __cdecl _j0( double _X ); double __cdecl _j1( double _X ); double __cdecl _jn(int _X, double _Y); double __cdecl _y0( double _X); double __cdecl _y1( double _X); double __cdecl _yn( int _X, double _Y); float __cdecl acoshf( float _X); float __cdecl asinhf( float _X); float __cdecl atanhf( float _X); float __cdecl cbrtf( float _X); float __cdecl _chgsignf( float _X); float __cdecl copysignf( float _Number, float _Sign); float __cdecl _copysignf( float _Number, float _Sign); float __cdecl erff( float _X); float __cdecl erfcf( float _X); float __cdecl expm1f( float _X); float __cdecl exp2f( float _X); float __cdecl fdimf( float _X, float _Y); float __cdecl fmaf( float _X, float _Y, float _Z); float __cdecl fmaxf( float _X, float _Y); float __cdecl fminf( float _X, float _Y); float __cdecl _hypotf( float _X, float _Y); int __cdecl ilogbf( float _X); float __cdecl lgammaf( float _X); long long __cdecl llrintf( float _X); long long __cdecl llroundf( float _X); float __cdecl log1pf( float _X); float __cdecl log2f( float _X); float __cdecl logbf( float _X); long __cdecl lrintf( float _X); long __cdecl lroundf( float _X); float __cdecl nanf( char const* _X); float __cdecl nearbyintf( float _X); float __cdecl nextafterf( float _X, float _Y); float __cdecl nexttowardf( float _X, long double _Y); float __cdecl remainderf( float _X, float _Y); float __cdecl remquof( float _X, float _Y, int* _Z); float __cdecl rintf( float _X); float __cdecl roundf( float _X); float __cdecl scalblnf( float _X, long _Y); float __cdecl scalbnf( float _X, int _Y); float __cdecl tgammaf( float _X); float __cdecl truncf( float _X); float __cdecl _logbf( float _X); float __cdecl _nextafterf( float _X, float _Y); int __cdecl _finitef( float _X); int __cdecl _isnanf( float _X); int __cdecl _fpclassf( float _X); int __cdecl _set_FMA3_enable( int _Flag); int __cdecl _get_FMA3_enable(void); float __cdecl acosf( float _X); float __cdecl asinf( float _X); float __cdecl atan2f( float _Y, float _X); float __cdecl atanf( float _X); float __cdecl ceilf( float _X); float __cdecl cosf( float _X); float __cdecl coshf( float _X); float __cdecl expf( float _X); __inline float __cdecl fabsf( float _X) { return (float)fabs(_X); } float __cdecl floorf( float _X); 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); } float __cdecl log10f( float _X); float __cdecl logf( float _X); float __cdecl modff( float _X, float *_Y); float __cdecl powf( float _X, float _Y); float __cdecl sinf( float _X); float __cdecl sinhf( float _X); float __cdecl sqrtf( float _X); float __cdecl tanf( float _X); float __cdecl tanhf( float _X); long double __cdecl acoshl( long double _X); __inline long double __cdecl acosl( long double _X) { return acos((double)_X); } 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); } long double __cdecl atanhl( long double _X); __inline long double __cdecl atanl( long double _X) { return atan((double)_X); } 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); } 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); } long double __cdecl erfl( long double _X); long double __cdecl erfcl( long double _X); __inline long double __cdecl expl( long double _X) { return exp((double)_X); } long double __cdecl exp2l( long double _X); long double __cdecl expm1l( long double _X); __inline long double __cdecl fabsl( long double _X) { return fabs((double)_X); } long double __cdecl fdiml( long double _X, long double _Y); __inline long double __cdecl floorl( long double _X) { return floor((double)_X); } long double __cdecl fmal( long double _X, long double _Y, long double _Z); long double __cdecl fmaxl( long double _X, long double _Y); 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); } 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); } long double __cdecl lgammal( long double _X); long long __cdecl llrintl( long double _X); 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); } long double __cdecl log1pl( long double _X); long double __cdecl log2l( long double _X); long double __cdecl logbl( long double _X); long __cdecl lrintl( long double _X); 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; } long double __cdecl nanl( char const* _X); long double __cdecl nearbyintl( long double _X); long double __cdecl nextafterl( long double _X, long double _Y); 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); } long double __cdecl remainderl( long double _X, long double _Y); long double __cdecl remquol( long double _X, long double _Y, int* _Z); long double __cdecl rintl( long double _X); long double __cdecl roundl( long double _X); long double __cdecl scalblnl( long double _X, long _Y); 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); } long double __cdecl tgammal( long double _X); 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.")) 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.")) 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.")) 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.")) 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.")) 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.")) double __cdecl yn( int _X, double _Y); #pragma warning(pop) } #pragma pack(pop) extern "C++" { namespace std { inline namespace __1 { using ::ptrdiff_t; using ::size_t; using ::max_align_t; } } namespace std { inline namespace __1 { template <class _T1, class _T2> struct pair; template <class _Tp> class reference_wrapper; template <class _Tp> struct hash; template <class _Tp, _Tp __v> struct integral_constant { static constexpr const _Tp value = __v; typedef _Tp value_type; typedef integral_constant type; __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr operator value_type() const noexcept {return value;} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr value_type operator ()() const noexcept {return value;} }; template <class _Tp, _Tp __v> constexpr const _Tp integral_constant<_Tp, __v>::value; typedef integral_constant<bool,(true)> true_type; typedef integral_constant<bool,(false)> false_type; template <bool _Val> using _BoolConstant __attribute__((nodebug)) = integral_constant<bool, _Val>; template <bool> struct _MetaBase; template <> struct _MetaBase<true> { template <class _Tp, class _Up> using _SelectImpl __attribute__((nodebug)) = _Tp; template <template <class...> class _FirstFn, template <class...> class, class ..._Args> using _SelectApplyImpl __attribute__((nodebug)) = _FirstFn<_Args...>; template <class _First, class...> using _FirstImpl __attribute__((nodebug)) = _First; template <class, class _Second, class...> using _SecondImpl __attribute__((nodebug)) = _Second; template <class _Tp = void> using _EnableIfImpl __attribute__((nodebug)) = _Tp; template <class _Result, class _First, class ..._Rest> using _OrImpl __attribute__((nodebug)) = typename _MetaBase<_First::value != true && sizeof...(_Rest) != 0>::template _OrImpl<_First, _Rest...>; template <class _Result, class _First, class ..._Rest> using _AndImpl __attribute__((nodebug)) = typename _MetaBase<_First::value == true && sizeof...(_Rest) != 0>::template _AndImpl<_First, _Rest...>; }; template <> struct _MetaBase<false> { template <class _Tp, class _Up> using _SelectImpl __attribute__((nodebug)) = _Up; template <template <class...> class, template <class...> class _SecondFn, class ..._Args> using _SelectApplyImpl __attribute__((nodebug)) = _SecondFn<_Args...>; template <class _Result, class ...> using _OrImpl __attribute__((nodebug)) = _Result; template <class _Result, class ...> using _AndImpl __attribute__((nodebug)) = _Result; }; template <bool _Cond, class _Ret = void> using _EnableIf __attribute__((nodebug)) = typename _MetaBase<_Cond>::template _EnableIfImpl<_Ret>; template <bool _Cond, class _IfRes, class _ElseRes> using _If __attribute__((nodebug)) = typename _MetaBase<_Cond>::template _SelectImpl<_IfRes, _ElseRes>; template <class ..._Rest> using _Or __attribute__((nodebug)) = typename _MetaBase< sizeof...(_Rest) != 0 >::template _OrImpl<false_type, _Rest...>; template <class ..._Rest> using _And __attribute__((nodebug)) = typename _MetaBase< sizeof...(_Rest) != 0 >::template _AndImpl<true_type, _Rest...>; template <class _Pred> struct _Not : _BoolConstant<!_Pred::value> {}; template <class ..._Args> using _FirstType __attribute__((nodebug)) = typename _MetaBase<(sizeof...(_Args) >= 1)>::template _FirstImpl<_Args...>; template <class ..._Args> using _SecondType __attribute__((nodebug)) = typename _MetaBase<(sizeof...(_Args) >= 2)>::template _SecondImpl<_Args...>; template <template <class...> class _Func, class ..._Args> struct _Lazy : _Func<_Args...> {}; template <template <class...> class _Templ, class ..._Args, class = _Templ<_Args...> > true_type __sfinae_test_impl(int); template <template <class...> class, class ...> false_type __sfinae_test_impl(...); template <template <class ...> class _Templ, class ..._Args> using _IsValidExpansion __attribute__((nodebug)) = decltype(std::__sfinae_test_impl<_Templ, _Args...>(0)); template <class> struct __void_t { typedef void type; }; template <class _Tp> struct __identity { typedef _Tp type; }; template <class _Tp, bool> struct __dependent_type : public _Tp {}; template <bool _Bp, class _If, class _Then> struct conditional {typedef _If type;}; template <class _If, class _Then> struct conditional<false, _If, _Then> {typedef _Then type;}; template <bool _Bp, class _If, class _Then> using conditional_t = typename conditional<_Bp, _If, _Then>::type; template <bool, class _Tp = void> struct enable_if {}; template <class _Tp> struct enable_if<true, _Tp> {typedef _Tp type;}; template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type; template <class _Tp, class _Up> struct is_same : public false_type {}; template <class _Tp> struct is_same<_Tp, _Tp> : public true_type {}; template <class _Tp, class _Up> using _IsSame = _BoolConstant< __is_same(_Tp, _Up) >; template <class _Tp, class _Up> using _IsNotSame = _BoolConstant< !__is_same(_Tp, _Up) >; template <class _Tp> inline __attribute__((__no_sanitize__("cfi"))) __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* addressof(_Tp& __x) noexcept { return __builtin_addressof(__x); } template <class _Tp> _Tp* addressof(const _Tp&&) noexcept = delete; struct __two {char __lx[2];}; template <class _Tp> struct is_const : public false_type {}; template <class _Tp> struct is_const<_Tp const> : public true_type {}; template <class _Tp> struct is_volatile : public false_type {}; template <class _Tp> struct is_volatile<_Tp volatile> : public true_type {}; template <class _Tp> struct remove_const {typedef _Tp type;}; template <class _Tp> struct remove_const<const _Tp> {typedef _Tp type;}; template <class _Tp> using remove_const_t = typename remove_const<_Tp>::type; template <class _Tp> struct remove_volatile {typedef _Tp type;}; template <class _Tp> struct remove_volatile<volatile _Tp> {typedef _Tp type;}; template <class _Tp> using remove_volatile_t = typename remove_volatile<_Tp>::type; template <class _Tp> struct remove_cv {typedef typename remove_volatile<typename remove_const<_Tp>::type>::type type;}; template <class _Tp> using remove_cv_t = typename remove_cv<_Tp>::type; template <class _Tp> struct __libcpp_is_void : public false_type {}; template <> struct __libcpp_is_void<void> : public true_type {}; template <class _Tp> struct is_void : public __libcpp_is_void<typename remove_cv<_Tp>::type> {}; template <class _Tp> struct __is_nullptr_t_impl : public false_type {}; template <> struct __is_nullptr_t_impl<nullptr_t> : public true_type {}; template <class _Tp> struct __is_nullptr_t : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {}; template <class _Tp> struct is_null_pointer : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {}; template <class _Tp> struct __libcpp_is_integral : public false_type {}; template <> struct __libcpp_is_integral<bool> : public true_type {}; template <> struct __libcpp_is_integral<char> : public true_type {}; template <> struct __libcpp_is_integral<signed char> : public true_type {}; template <> struct __libcpp_is_integral<unsigned char> : public true_type {}; template <> struct __libcpp_is_integral<wchar_t> : public true_type {}; template <> struct __libcpp_is_integral<char16_t> : public true_type {}; template <> struct __libcpp_is_integral<char32_t> : public true_type {}; template <> struct __libcpp_is_integral<short> : public true_type {}; template <> struct __libcpp_is_integral<unsigned short> : public true_type {}; template <> struct __libcpp_is_integral<int> : public true_type {}; template <> struct __libcpp_is_integral<unsigned int> : public true_type {}; template <> struct __libcpp_is_integral<long> : public true_type {}; template <> struct __libcpp_is_integral<unsigned long> : public true_type {}; template <> struct __libcpp_is_integral<long long> : public true_type {}; template <> struct __libcpp_is_integral<unsigned long long> : public true_type {}; template <> struct __libcpp_is_integral<__int128_t> : public true_type {}; template <> struct __libcpp_is_integral<__uint128_t> : public true_type {}; template <class _Tp> struct is_integral : public __libcpp_is_integral<typename remove_cv<_Tp>::type> {}; template <class _Tp> struct __libcpp_is_floating_point : public false_type {}; template <> struct __libcpp_is_floating_point<float> : public true_type {}; template <> struct __libcpp_is_floating_point<double> : public true_type {}; template <> struct __libcpp_is_floating_point<long double> : public true_type {}; template <class _Tp> struct is_floating_point : public __libcpp_is_floating_point<typename remove_cv<_Tp>::type> {}; template <class _Tp> struct is_array : public false_type {}; template <class _Tp> struct is_array<_Tp[]> : public true_type {}; template <class _Tp, size_t _Np> struct is_array<_Tp[_Np]> : public true_type {}; template <class _Tp> struct __libcpp_is_pointer : public false_type {}; template <class _Tp> struct __libcpp_is_pointer<_Tp*> : public true_type {}; template <class _Tp> struct __libcpp_remove_objc_qualifiers { typedef _Tp type; }; template <class _Tp> struct is_pointer : public __libcpp_is_pointer<typename __libcpp_remove_objc_qualifiers<typename remove_cv<_Tp>::type>::type> {}; template <class _Tp> struct is_lvalue_reference : public false_type {}; template <class _Tp> struct is_lvalue_reference<_Tp&> : public true_type {}; template <class _Tp> struct is_rvalue_reference : public false_type {}; template <class _Tp> struct is_rvalue_reference<_Tp&&> : public true_type {}; template <class _Tp> struct is_reference : public false_type {}; template <class _Tp> struct is_reference<_Tp&> : public true_type {}; template <class _Tp> struct is_reference<_Tp&&> : public true_type {}; template <class _Tp> struct is_union : public integral_constant<bool, __is_union(_Tp)> {}; template <class _Tp> struct is_class : public integral_constant<bool, __is_class(_Tp)> {}; template <class _Tp> struct is_function : public _BoolConstant< __is_function(_Tp) > {}; template <class _Tp> struct __libcpp_is_member_pointer { enum { __is_member = false, __is_func = false, __is_obj = false }; }; template <class _Tp, class _Up> struct __libcpp_is_member_pointer<_Tp _Up::*> { enum { __is_member = true, __is_func = is_function<_Tp>::value, __is_obj = !__is_func, }; }; template <class _Tp> struct is_member_function_pointer : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_func > {}; template <class _Tp> struct is_member_pointer : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_member > {}; template <class _Tp> struct is_member_object_pointer : public _BoolConstant< __libcpp_is_member_pointer<typename remove_cv<_Tp>::type>::__is_obj > {}; template <class _Tp> struct is_enum : public integral_constant<bool, __is_enum(_Tp)> {}; template <class _Tp> struct is_arithmetic : public integral_constant<bool, is_integral<_Tp>::value || is_floating_point<_Tp>::value> {}; template <class _Tp> struct is_fundamental : public integral_constant<bool, is_void<_Tp>::value || __is_nullptr_t<_Tp>::value || is_arithmetic<_Tp>::value> {}; template <class _Tp> struct is_scalar : public integral_constant<bool, is_arithmetic<_Tp>::value || is_member_pointer<_Tp>::value || is_pointer<_Tp>::value || __is_nullptr_t<_Tp>::value || is_enum<_Tp>::value > {}; template <> struct is_scalar<nullptr_t> : public true_type {}; template <class _Tp> struct is_object : public integral_constant<bool, is_scalar<_Tp>::value || is_array<_Tp>::value || is_union<_Tp>::value || is_class<_Tp>::value > {}; template <class _Tp> struct is_compound : public integral_constant<bool, !is_fundamental<_Tp>::value> {}; struct __is_referenceable_impl { template <class _Tp> static _Tp& __test(int); template <class _Tp> static __two __test(...); }; template <class _Tp> struct __is_referenceable : integral_constant<bool, _IsNotSame<decltype(__is_referenceable_impl::__test<_Tp>(0)), __two>::value> {}; template <class _Tp> struct add_const { typedef __attribute__((nodebug)) const _Tp type; }; template <class _Tp> using add_const_t = typename add_const<_Tp>::type; template <class _Tp> struct add_volatile { typedef __attribute__((nodebug)) volatile _Tp type; }; template <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type; template <class _Tp> struct add_cv { typedef __attribute__((nodebug)) const volatile _Tp type; }; template <class _Tp> using add_cv_t = typename add_cv<_Tp>::type; template <class _Tp> struct remove_reference {typedef __attribute__((nodebug)) _Tp type;}; template <class _Tp> struct remove_reference<_Tp&> {typedef __attribute__((nodebug)) _Tp type;}; template <class _Tp> struct remove_reference<_Tp&&> {typedef __attribute__((nodebug)) _Tp type;}; template <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::type; template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_lvalue_reference_impl { typedef __attribute__((nodebug)) _Tp type; }; template <class _Tp > struct __add_lvalue_reference_impl<_Tp, true> { typedef __attribute__((nodebug)) _Tp& type; }; template <class _Tp> struct add_lvalue_reference {typedef __attribute__((nodebug)) typename __add_lvalue_reference_impl<_Tp>::type type;}; template <class _Tp> using add_lvalue_reference_t = typename add_lvalue_reference<_Tp>::type; template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_rvalue_reference_impl { typedef __attribute__((nodebug)) _Tp type; }; template <class _Tp > struct __add_rvalue_reference_impl<_Tp, true> { typedef __attribute__((nodebug)) _Tp&& type; }; template <class _Tp> struct add_rvalue_reference {typedef __attribute__((nodebug)) typename __add_rvalue_reference_impl<_Tp>::type type;}; template <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type; #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated" template <class _Tp> _Tp&& __declval(int); template <class _Tp> _Tp __declval(long); #pragma GCC diagnostic pop template <class _Tp> decltype(std::__1::__declval<_Tp>(0)) declval() noexcept; template <class _Tp> struct __uncvref { typedef __attribute__((nodebug)) typename remove_cv<typename remove_reference<_Tp>::type>::type type; }; template <class _Tp> struct __unconstref { typedef __attribute__((nodebug)) typename remove_const<typename remove_reference<_Tp>::type>::type type; }; template <class _Tp> using __uncvref_t __attribute__((nodebug)) = typename __uncvref<_Tp>::type; template <class _Tp, class _Up> struct __is_same_uncvref : _IsSame<typename __uncvref<_Tp>::type, typename __uncvref<_Up>::type> {}; struct __any { __any(...); }; template <class _Tp> struct remove_pointer {typedef __attribute__((nodebug)) _Tp type;}; template <class _Tp> struct remove_pointer<_Tp*> {typedef __attribute__((nodebug)) _Tp type;}; template <class _Tp> struct remove_pointer<_Tp* const> {typedef __attribute__((nodebug)) _Tp type;}; template <class _Tp> struct remove_pointer<_Tp* volatile> {typedef __attribute__((nodebug)) _Tp type;}; template <class _Tp> struct remove_pointer<_Tp* const volatile> {typedef __attribute__((nodebug)) _Tp type;}; template <class _Tp> using remove_pointer_t = typename remove_pointer<_Tp>::type; template <class _Tp, bool = __is_referenceable<_Tp>::value || _IsSame<typename remove_cv<_Tp>::type, void>::value> struct __add_pointer_impl {typedef __attribute__((nodebug)) typename remove_reference<_Tp>::type* type;}; template <class _Tp> struct __add_pointer_impl<_Tp, false> {typedef __attribute__((nodebug)) _Tp type;}; template <class _Tp> struct add_pointer {typedef __attribute__((nodebug)) typename __add_pointer_impl<_Tp>::type type;}; template <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type; template <class _Tp, bool = is_integral<_Tp>::value> struct __libcpp_is_signed_impl : public integral_constant<bool,(_Tp(-1) < _Tp(0))> {}; template <class _Tp> struct __libcpp_is_signed_impl<_Tp, false> : public true_type {}; template <class _Tp, bool = is_arithmetic<_Tp>::value> struct __libcpp_is_signed : public __libcpp_is_signed_impl<_Tp> {}; template <class _Tp> struct __libcpp_is_signed<_Tp, false> : public false_type {}; template <class _Tp> struct is_signed : public __libcpp_is_signed<_Tp> {}; template <class _Tp, bool = is_integral<_Tp>::value> struct __libcpp_is_unsigned_impl : public integral_constant<bool,(_Tp(0) < _Tp(-1))> {}; template <class _Tp> struct __libcpp_is_unsigned_impl<_Tp, false> : public false_type {}; template <class _Tp, bool = is_arithmetic<_Tp>::value> struct __libcpp_is_unsigned : public __libcpp_is_unsigned_impl<_Tp> {}; template <class _Tp> struct __libcpp_is_unsigned<_Tp, false> : public false_type {}; template <class _Tp> struct is_unsigned : public __libcpp_is_unsigned<_Tp> {}; template <class _Tp> struct rank : public integral_constant<size_t, 0> {}; template <class _Tp> struct rank<_Tp[]> : public integral_constant<size_t, rank<_Tp>::value + 1> {}; template <class _Tp, size_t _Np> struct rank<_Tp[_Np]> : public integral_constant<size_t, rank<_Tp>::value + 1> {}; template <class _Tp, unsigned _Ip = 0> struct extent : public integral_constant<size_t, 0> {}; template <class _Tp> struct extent<_Tp[], 0> : public integral_constant<size_t, 0> {}; template <class _Tp, unsigned _Ip> struct extent<_Tp[], _Ip> : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {}; template <class _Tp, size_t _Np> struct extent<_Tp[_Np], 0> : public integral_constant<size_t, _Np> {}; template <class _Tp, size_t _Np, unsigned _Ip> struct extent<_Tp[_Np], _Ip> : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {}; template <class _Tp> struct remove_extent {typedef _Tp type;}; template <class _Tp> struct remove_extent<_Tp[]> {typedef _Tp type;}; template <class _Tp, size_t _Np> struct remove_extent<_Tp[_Np]> {typedef _Tp type;}; template <class _Tp> using remove_extent_t = typename remove_extent<_Tp>::type; template <class _Tp> struct remove_all_extents {typedef _Tp type;}; template <class _Tp> struct remove_all_extents<_Tp[]> {typedef typename remove_all_extents<_Tp>::type type;}; template <class _Tp, size_t _Np> struct remove_all_extents<_Tp[_Np]> {typedef typename remove_all_extents<_Tp>::type type;}; template <class _Tp> using remove_all_extents_t = typename remove_all_extents<_Tp>::type; template <class _Up, bool> struct __decay { typedef __attribute__((nodebug)) typename remove_cv<_Up>::type type; }; template <class _Up> struct __decay<_Up, true> { public: typedef __attribute__((nodebug)) typename conditional < is_array<_Up>::value, typename remove_extent<_Up>::type*, typename conditional < is_function<_Up>::value, typename add_pointer<_Up>::type, typename remove_cv<_Up>::type >::type >::type type; }; template <class _Tp> struct decay { private: typedef __attribute__((nodebug)) typename remove_reference<_Tp>::type _Up; public: typedef __attribute__((nodebug)) typename __decay<_Up, __is_referenceable<_Up>::value>::type type; }; template <class _Tp> using decay_t = typename decay<_Tp>::type; template <class _Tp> struct is_abstract : public integral_constant<bool, __is_abstract(_Tp)> {}; template <class _Tp> struct __libcpp_is_final : public integral_constant<bool, __is_final(_Tp)> {}; template <class _Tp> struct is_final : public integral_constant<bool, __is_final(_Tp)> {}; template <class _Bp, class _Dp> struct is_base_of : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {}; template <class _T1, class _T2> struct is_convertible : public integral_constant<bool, __is_convertible_to(_T1, _T2) && !is_abstract<_T2>::value> {}; template <class _Tp> struct is_empty : public integral_constant<bool, __is_empty(_Tp)> {}; template <class _Tp> struct is_polymorphic : public integral_constant<bool, __is_polymorphic(_Tp)> {}; template <class _Tp> struct has_virtual_destructor : public integral_constant<bool, __has_virtual_destructor(_Tp)> {}; template <class _Tp> struct alignment_of : public integral_constant<size_t, alignof(_Tp)> {}; template <class _Hp, class _Tp> struct __type_list { typedef _Hp _Head; typedef _Tp _Tail; }; struct __nat { __nat() = delete; __nat(const __nat&) = delete; __nat& operator=(const __nat&) = delete; ~__nat() = delete; }; template <class _Tp> struct __align_type { static const size_t value = __alignof(_Tp); typedef _Tp type; }; struct __struct_double {long double __lx;}; struct __struct_double4 {double __lx[4];}; typedef __type_list<__align_type<unsigned char>, __type_list<__align_type<unsigned short>, __type_list<__align_type<unsigned int>, __type_list<__align_type<unsigned long>, __type_list<__align_type<unsigned long long>, __type_list<__align_type<double>, __type_list<__align_type<long double>, __type_list<__align_type<__struct_double>, __type_list<__align_type<__struct_double4>, __type_list<__align_type<int*>, __nat > > > > > > > > > > __all_types; template <size_t _Align> struct alignas(_Align) __fallback_overaligned {}; template <class _TL, size_t _Align> struct __find_pod; template <class _Hp, size_t _Align> struct __find_pod<__type_list<_Hp, __nat>, _Align> { typedef typename conditional< _Align == _Hp::value, typename _Hp::type, __fallback_overaligned<_Align> >::type type; }; template <class _Hp, class _Tp, size_t _Align> struct __find_pod<__type_list<_Hp, _Tp>, _Align> { typedef typename conditional< _Align == _Hp::value, typename _Hp::type, typename __find_pod<_Tp, _Align>::type >::type type; }; template <class _TL, size_t _Len> struct __find_max_align; template <class _Hp, size_t _Len> struct __find_max_align<__type_list<_Hp, __nat>, _Len> : public integral_constant<size_t, _Hp::value> {}; template <size_t _Len, size_t _A1, size_t _A2> struct __select_align { private: static const size_t __min = _A2 < _A1 ? _A2 : _A1; static const size_t __max = _A1 < _A2 ? _A2 : _A1; public: static const size_t value = _Len < __max ? __min : __max; }; template <class _Hp, class _Tp, size_t _Len> struct __find_max_align<__type_list<_Hp, _Tp>, _Len> : public integral_constant<size_t, __select_align<_Len, _Hp::value, __find_max_align<_Tp, _Len>::value>::value> {}; template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value> struct aligned_storage { typedef typename __find_pod<__all_types, _Align>::type _Aligner; union type { _Aligner __align; unsigned char __data[(_Len + _Align - 1)/_Align * _Align]; }; }; template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value> using aligned_storage_t = typename aligned_storage<_Len, _Align>::type; template <size_t _Len>struct aligned_storage<_Len, 0x1>{ struct alignas(0x1) type { unsigned char __lx[(_Len + 0x1 - 1)/0x1 * 0x1]; };}; template <size_t _Len>struct aligned_storage<_Len, 0x2>{ struct alignas(0x2) type { unsigned char __lx[(_Len + 0x2 - 1)/0x2 * 0x2]; };}; template <size_t _Len>struct aligned_storage<_Len, 0x4>{ struct alignas(0x4) type { unsigned char __lx[(_Len + 0x4 - 1)/0x4 * 0x4]; };}; template <size_t _Len>struct aligned_storage<_Len, 0x8>{ struct alignas(0x8) type { unsigned char __lx[(_Len + 0x8 - 1)/0x8 * 0x8]; };}; template <size_t _Len>struct aligned_storage<_Len, 0x10>{ struct alignas(0x10) type { unsigned char __lx[(_Len + 0x10 - 1)/0x10 * 0x10]; };}; template <size_t _Len>struct aligned_storage<_Len, 0x20>{ struct alignas(0x20) type { unsigned char __lx[(_Len + 0x20 - 1)/0x20 * 0x20]; };}; template <size_t _Len>struct aligned_storage<_Len, 0x40>{ struct alignas(0x40) type { unsigned char __lx[(_Len + 0x40 - 1)/0x40 * 0x40]; };}; template <size_t _Len>struct aligned_storage<_Len, 0x80>{ struct alignas(0x80) type { unsigned char __lx[(_Len + 0x80 - 1)/0x80 * 0x80]; };}; template <size_t _Len>struct aligned_storage<_Len, 0x100>{ struct alignas(0x100) type { unsigned char __lx[(_Len + 0x100 - 1)/0x100 * 0x100]; };}; template <size_t _Len>struct aligned_storage<_Len, 0x200>{ struct alignas(0x200) type { unsigned char __lx[(_Len + 0x200 - 1)/0x200 * 0x200]; };}; template <size_t _Len>struct aligned_storage<_Len, 0x400>{ struct alignas(0x400) type { unsigned char __lx[(_Len + 0x400 - 1)/0x400 * 0x400]; };}; template <size_t _Len>struct aligned_storage<_Len, 0x800>{ struct alignas(0x800) type { unsigned char __lx[(_Len + 0x800 - 1)/0x800 * 0x800]; };}; template <size_t _Len>struct aligned_storage<_Len, 0x1000>{ struct alignas(0x1000) type { unsigned char __lx[(_Len + 0x1000 - 1)/0x1000 * 0x1000]; };}; template <size_t _Len>struct aligned_storage<_Len, 0x2000>{ struct alignas(0x2000) type { unsigned char __lx[(_Len + 0x2000 - 1)/0x2000 * 0x2000]; };}; template <size_t _I0, size_t ..._In> struct __static_max; template <size_t _I0> struct __static_max<_I0> { static const size_t value = _I0; }; template <size_t _I0, size_t _I1, size_t ..._In> struct __static_max<_I0, _I1, _In...> { static const size_t value = _I0 >= _I1 ? __static_max<_I0, _In...>::value : __static_max<_I1, _In...>::value; }; template <size_t _Len, class _Type0, class ..._Types> struct aligned_union { static const size_t alignment_value = __static_max<__alignof(_Type0), __alignof(_Types)...>::value; static const size_t __len = __static_max<_Len, sizeof(_Type0), sizeof(_Types)...>::value; typedef typename aligned_storage<__len, alignment_value>::type type; }; template <size_t _Len, class ..._Types> using aligned_union_t = typename aligned_union<_Len, _Types...>::type; template <class _Tp> struct __numeric_type { static void __test(...); static float __test(float); static double __test(char); static double __test(int); static double __test(unsigned); static double __test(long); static double __test(unsigned long); static double __test(long long); static double __test(unsigned long long); static double __test(double); static long double __test(long double); typedef decltype(__test(declval<_Tp>())) type; static const bool value = _IsNotSame<type, void>::value; }; template <> struct __numeric_type<void> { static const bool value = true; }; template <class _A1, class _A2 = void, class _A3 = void, bool = __numeric_type<_A1>::value && __numeric_type<_A2>::value && __numeric_type<_A3>::value> class __promote_imp { public: static const bool value = false; }; template <class _A1, class _A2, class _A3> class __promote_imp<_A1, _A2, _A3, true> { private: typedef typename __promote_imp<_A1>::type __type1; typedef typename __promote_imp<_A2>::type __type2; typedef typename __promote_imp<_A3>::type __type3; public: typedef decltype(__type1() + __type2() + __type3()) type; static const bool value = true; }; template <class _A1, class _A2> class __promote_imp<_A1, _A2, void, true> { private: typedef typename __promote_imp<_A1>::type __type1; typedef typename __promote_imp<_A2>::type __type2; public: typedef decltype(__type1() + __type2()) type; static const bool value = true; }; template <class _A1> class __promote_imp<_A1, void, void, true> { public: typedef typename __numeric_type<_A1>::type type; static const bool value = true; }; template <class _A1, class _A2 = void, class _A3 = void> class __promote : public __promote_imp<_A1, _A2, _A3> {}; typedef __type_list<signed char, __type_list<signed short, __type_list<signed int, __type_list<signed long, __type_list<signed long long, __type_list<__int128_t, __nat > > > > > > __signed_types; typedef __type_list<unsigned char, __type_list<unsigned short, __type_list<unsigned int, __type_list<unsigned long, __type_list<unsigned long long, __type_list<__uint128_t, __nat > > > > > > __unsigned_types; template <class _TypeList, size_t _Size, bool = _Size <= sizeof(typename _TypeList::_Head)> struct __find_first; template <class _Hp, class _Tp, size_t _Size> struct __find_first<__type_list<_Hp, _Tp>, _Size, true> { typedef __attribute__((nodebug)) _Hp type; }; template <class _Hp, class _Tp, size_t _Size> struct __find_first<__type_list<_Hp, _Tp>, _Size, false> { typedef __attribute__((nodebug)) typename __find_first<_Tp, _Size>::type type; }; template <class _Tp, class _Up, bool = is_const<typename remove_reference<_Tp>::type>::value, bool = is_volatile<typename remove_reference<_Tp>::type>::value> struct __apply_cv { typedef __attribute__((nodebug)) _Up type; }; template <class _Tp, class _Up> struct __apply_cv<_Tp, _Up, true, false> { typedef __attribute__((nodebug)) const _Up type; }; template <class _Tp, class _Up> struct __apply_cv<_Tp, _Up, false, true> { typedef volatile _Up type; }; template <class _Tp, class _Up> struct __apply_cv<_Tp, _Up, true, true> { typedef const volatile _Up type; }; template <class _Tp, class _Up> struct __apply_cv<_Tp&, _Up, false, false> { typedef _Up& type; }; template <class _Tp, class _Up> struct __apply_cv<_Tp&, _Up, true, false> { typedef const _Up& type; }; template <class _Tp, class _Up> struct __apply_cv<_Tp&, _Up, false, true> { typedef volatile _Up& type; }; template <class _Tp, class _Up> struct __apply_cv<_Tp&, _Up, true, true> { typedef const volatile _Up& type; }; template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value> struct __make_signed {}; template <class _Tp> struct __make_signed<_Tp, true> { typedef typename __find_first<__signed_types, sizeof(_Tp)>::type type; }; template <> struct __make_signed<bool, true> {}; template <> struct __make_signed< signed short, true> {typedef short type;}; template <> struct __make_signed<unsigned short, true> {typedef short type;}; template <> struct __make_signed< signed int, true> {typedef int type;}; template <> struct __make_signed<unsigned int, true> {typedef int type;}; template <> struct __make_signed< signed long, true> {typedef long type;}; template <> struct __make_signed<unsigned long, true> {typedef long type;}; template <> struct __make_signed< signed long long, true> {typedef long long type;}; template <> struct __make_signed<unsigned long long, true> {typedef long long type;}; template <> struct __make_signed<__int128_t, true> {typedef __int128_t type;}; template <> struct __make_signed<__uint128_t, true> {typedef __int128_t type;}; template <class _Tp> struct make_signed { typedef typename __apply_cv<_Tp, typename __make_signed<typename remove_cv<_Tp>::type>::type>::type type; }; template <class _Tp> using make_signed_t = typename make_signed<_Tp>::type; template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value> struct __make_unsigned {}; template <class _Tp> struct __make_unsigned<_Tp, true> { typedef typename __find_first<__unsigned_types, sizeof(_Tp)>::type type; }; template <> struct __make_unsigned<bool, true> {}; template <> struct __make_unsigned< signed short, true> {typedef unsigned short type;}; template <> struct __make_unsigned<unsigned short, true> {typedef unsigned short type;}; template <> struct __make_unsigned< signed int, true> {typedef unsigned int type;}; template <> struct __make_unsigned<unsigned int, true> {typedef unsigned int type;}; template <> struct __make_unsigned< signed long, true> {typedef unsigned long type;}; template <> struct __make_unsigned<unsigned long, true> {typedef unsigned long type;}; template <> struct __make_unsigned< signed long long, true> {typedef unsigned long long type;}; template <> struct __make_unsigned<unsigned long long, true> {typedef unsigned long long type;}; template <> struct __make_unsigned<__int128_t, true> {typedef __uint128_t type;}; template <> struct __make_unsigned<__uint128_t, true> {typedef __uint128_t type;}; template <class _Tp> struct make_unsigned { typedef typename __apply_cv<_Tp, typename __make_unsigned<typename remove_cv<_Tp>::type>::type>::type type; }; template <class _Tp> using make_unsigned_t = typename make_unsigned<_Tp>::type; template <class _Tp, class _Up, class = void> struct __common_type2_imp {}; template <class _Tp, class _Up> struct __common_type2_imp<_Tp, _Up, typename __void_t<decltype( true ? std::__1::declval<_Tp>() : std::__1::declval<_Up>() )>::type> { typedef __attribute__((nodebug)) typename decay<decltype( true ? std::__1::declval<_Tp>() : std::__1::declval<_Up>() )>::type type; }; template <class, class = void> struct __common_type_impl {}; template <class... Tp> struct __common_types; template <class... _Tp> struct common_type; template <class _Tp, class _Up> struct __common_type_impl< __common_types<_Tp, _Up>, typename __void_t<typename common_type<_Tp, _Up>::type>::type> { typedef typename common_type<_Tp, _Up>::type type; }; template <class _Tp, class _Up, class _Vp , class... _Rest> struct __common_type_impl< __common_types<_Tp, _Up, _Vp , _Rest...>, typename __void_t<typename common_type<_Tp, _Up>::type>::type> : __common_type_impl<__common_types<typename common_type<_Tp, _Up>::type, _Vp , _Rest...> > { }; template <> struct common_type<> {}; template <class _Tp> struct common_type<_Tp> : public common_type<_Tp, _Tp> {}; template <class _Tp, class _Up> struct common_type<_Tp, _Up> : conditional< _IsSame<_Tp, typename decay<_Tp>::type>::value && _IsSame<_Up, typename decay<_Up>::type>::value, __common_type2_imp<_Tp, _Up>, common_type<typename decay<_Tp>::type, typename decay<_Up>::type> >::type {}; template <class _Tp, class _Up, class _Vp , class... _Rest> struct common_type<_Tp, _Up, _Vp , _Rest...> : __common_type_impl< __common_types<_Tp, _Up, _Vp , _Rest...> > {}; template <class ..._Tp> using common_type_t = typename common_type<_Tp...>::type; template<typename, typename _Tp> struct __select_2nd { typedef __attribute__((nodebug)) _Tp type; }; template <class _Tp, class _Arg> typename __select_2nd<decltype((std::__1::declval<_Tp>() = std::__1::declval<_Arg>())), true_type>::type __is_assignable_test(int); template <class, class> false_type __is_assignable_test(...); template <class _Tp, class _Arg, bool = is_void<_Tp>::value || is_void<_Arg>::value> struct __is_assignable_imp : public decltype((std::__1::__is_assignable_test<_Tp, _Arg>(0))) {}; template <class _Tp, class _Arg> struct __is_assignable_imp<_Tp, _Arg, true> : public false_type { }; template <class _Tp, class _Arg> struct is_assignable : public __is_assignable_imp<_Tp, _Arg> {}; template <class _Tp> struct is_copy_assignable : public is_assignable<typename add_lvalue_reference<_Tp>::type, typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; template <class _Tp> struct is_move_assignable : public is_assignable<typename add_lvalue_reference<_Tp>::type, typename add_rvalue_reference<_Tp>::type> {}; template <class> struct __is_destructible_apply { typedef int type; }; template <typename _Tp> struct __is_destructor_wellformed { template <typename _Tp1> static char __test ( typename __is_destructible_apply<decltype(std::__1::declval<_Tp1&>().~_Tp1())>::type ); template <typename _Tp1> static __two __test (...); static const bool value = sizeof(__test<_Tp>(12)) == sizeof(char); }; template <class _Tp, bool> struct __destructible_imp; template <class _Tp> struct __destructible_imp<_Tp, false> : public std::__1::integral_constant<bool, __is_destructor_wellformed<typename std::__1::remove_all_extents<_Tp>::type>::value> {}; template <class _Tp> struct __destructible_imp<_Tp, true> : public std::__1::true_type {}; template <class _Tp, bool> struct __destructible_false; template <class _Tp> struct __destructible_false<_Tp, false> : public __destructible_imp<_Tp, std::__1::is_reference<_Tp>::value> {}; template <class _Tp> struct __destructible_false<_Tp, true> : public std::__1::false_type {}; template <class _Tp> struct is_destructible : public __destructible_false<_Tp, std::__1::is_function<_Tp>::value> {}; template <class _Tp> struct is_destructible<_Tp[]> : public std::__1::false_type {}; template <> struct is_destructible<void> : public std::__1::false_type {}; template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename remove_reference<_Tp>::type&& move(_Tp&& __t) noexcept { typedef __attribute__((nodebug)) typename remove_reference<_Tp>::type _Up; return static_cast<_Up&&>(__t); } template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _Tp&& forward(typename remove_reference<_Tp>::type& __t) noexcept { return static_cast<_Tp&&>(__t); } template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _Tp&& forward(typename remove_reference<_Tp>::type&& __t) noexcept { static_assert(!is_lvalue_reference<_Tp>::value, "can not forward an rvalue as an lvalue"); return static_cast<_Tp&&>(__t); } template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename decay<_Tp>::type __decay_copy(_Tp&& __t) { return std::__1::forward<_Tp>(__t); } template <class _MP, bool _IsMemberFunctionPtr, bool _IsMemberObjectPtr> struct __member_pointer_traits_imp { }; template <class _Rp, class _Class, class ..._Param> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false> { typedef _Class _ClassType; typedef _Rp _ReturnType; typedef _Rp (_FnType) (_Param...); }; template <class _Rp, class _Class, class ..._Param> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...), true, false> { typedef _Class _ClassType; typedef _Rp _ReturnType; typedef _Rp (_FnType) (_Param..., ...); }; template <class _Rp, class _Class, class ..._Param> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false> { typedef _Class const _ClassType; typedef _Rp _ReturnType; typedef _Rp (_FnType) (_Param...); }; template <class _Rp, class _Class, class ..._Param> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const, true, false> { typedef _Class const _ClassType; typedef _Rp _ReturnType; typedef _Rp (_FnType) (_Param..., ...); }; template <class _Rp, class _Class, class ..._Param> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false> { typedef _Class volatile _ClassType; typedef _Rp _ReturnType; typedef _Rp (_FnType) (_Param...); }; template <class _Rp, class _Class, class ..._Param> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile, true, false> { typedef _Class volatile _ClassType; typedef _Rp _ReturnType; typedef _Rp (_FnType) (_Param..., ...); }; template <class _Rp, class _Class, class ..._Param> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false> { typedef _Class const volatile _ClassType; typedef _Rp _ReturnType; typedef _Rp (_FnType) (_Param...); }; template <class _Rp, class _Class, class ..._Param> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile, true, false> { typedef _Class const volatile _ClassType; typedef _Rp _ReturnType; typedef _Rp (_FnType) (_Param..., ...); }; template <class _Rp, class _Class, class ..._Param> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false> { typedef _Class& _ClassType; typedef _Rp _ReturnType; typedef _Rp (_FnType) (_Param...); }; template <class _Rp, class _Class, class ..._Param> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &, true, false> { typedef _Class& _ClassType; typedef _Rp _ReturnType; typedef _Rp (_FnType) (_Param..., ...); }; template <class _Rp, class _Class, class ..._Param> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false> { typedef _Class const& _ClassType; typedef _Rp _ReturnType; typedef _Rp (_FnType) (_Param...); }; template <class _Rp, class _Class, class ..._Param> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&, true, false> { typedef _Class const& _ClassType; typedef _Rp _ReturnType; typedef _Rp (_FnType) (_Param..., ...); }; template <class _Rp, class _Class, class ..._Param> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false> { typedef _Class volatile& _ClassType; typedef _Rp _ReturnType; typedef _Rp (_FnType) (_Param...); }; template <class _Rp, class _Class, class ..._Param> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&, true, false> { typedef _Class volatile& _ClassType; typedef _Rp _ReturnType; typedef _Rp (_FnType) (_Param..., ...); }; template <class _Rp, class _Class, class ..._Param> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false> { typedef _Class const volatile& _ClassType; typedef _Rp _ReturnType; typedef _Rp (_FnType) (_Param...); }; template <class _Rp, class _Class, class ..._Param> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&, true, false> { typedef _Class const volatile& _ClassType; typedef _Rp _ReturnType; typedef _Rp (_FnType) (_Param..., ...); }; template <class _Rp, class _Class, class ..._Param> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false> { typedef _Class&& _ClassType; typedef _Rp _ReturnType; typedef _Rp (_FnType) (_Param...); }; template <class _Rp, class _Class, class ..._Param> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &&, true, false> { typedef _Class&& _ClassType; typedef _Rp _ReturnType; typedef _Rp (_FnType) (_Param..., ...); }; template <class _Rp, class _Class, class ..._Param> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false> { typedef _Class const&& _ClassType; typedef _Rp _ReturnType; typedef _Rp (_FnType) (_Param...); }; template <class _Rp, class _Class, class ..._Param> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&&, true, false> { typedef _Class const&& _ClassType; typedef _Rp _ReturnType; typedef _Rp (_FnType) (_Param..., ...); }; template <class _Rp, class _Class, class ..._Param> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false> { typedef _Class volatile&& _ClassType; typedef _Rp _ReturnType; typedef _Rp (_FnType) (_Param...); }; template <class _Rp, class _Class, class ..._Param> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&&, true, false> { typedef _Class volatile&& _ClassType; typedef _Rp _ReturnType; typedef _Rp (_FnType) (_Param..., ...); }; template <class _Rp, class _Class, class ..._Param> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false> { typedef _Class const volatile&& _ClassType; typedef _Rp _ReturnType; typedef _Rp (_FnType) (_Param...); }; template <class _Rp, class _Class, class ..._Param> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&&, true, false> { typedef _Class const volatile&& _ClassType; typedef _Rp _ReturnType; typedef _Rp (_FnType) (_Param..., ...); }; template <class _Rp, class _Class> struct __member_pointer_traits_imp<_Rp _Class::*, false, true> { typedef _Class _ClassType; typedef _Rp _ReturnType; }; template <class _MP> struct __member_pointer_traits : public __member_pointer_traits_imp<typename remove_cv<_MP>::type, is_member_function_pointer<_MP>::value, is_member_object_pointer<_MP>::value> { }; template <class _DecayedFp> struct __member_pointer_class_type {}; template <class _Ret, class _ClassType> struct __member_pointer_class_type<_Ret _ClassType::*> { typedef _ClassType type; }; template <class _Callable> class result_of; namespace __is_construct { struct __nat {}; } template <class _Tp, class ..._Args> struct is_constructible : public integral_constant<bool, __is_constructible(_Tp, _Args...)> {}; template <class _Tp> struct is_default_constructible : public is_constructible<_Tp> {}; template <class _Tp> void __test_implicit_default_constructible(_Tp); template <class _Tp, class = void, bool = is_default_constructible<_Tp>::value> struct __is_implicitly_default_constructible : false_type { }; template <class _Tp> struct __is_implicitly_default_constructible<_Tp, decltype(__test_implicit_default_constructible<_Tp const&>({})), true> : true_type { }; template <class _Tp> struct __is_implicitly_default_constructible<_Tp, decltype(__test_implicit_default_constructible<_Tp const&>({})), false> : false_type { }; template <class _Tp> struct is_copy_constructible : public is_constructible<_Tp, typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; template <class _Tp> struct is_move_constructible : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> {}; template <class _Tp, class... _Args> struct is_trivially_constructible : integral_constant<bool, __is_trivially_constructible(_Tp, _Args...)> { }; template <class _Tp> struct is_trivially_default_constructible : public is_trivially_constructible<_Tp> {}; template <class _Tp> struct is_trivially_copy_constructible : public is_trivially_constructible<_Tp, typename add_lvalue_reference<const _Tp>::type> {}; template <class _Tp> struct is_trivially_move_constructible : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> {}; template <class _Tp, class _Arg> struct is_trivially_assignable : integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)> { }; template <class _Tp> struct is_trivially_copy_assignable : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; template <class _Tp> struct is_trivially_move_assignable : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, typename add_rvalue_reference<_Tp>::type> {}; template <class _Tp> struct is_trivially_destructible : public integral_constant<bool, __is_trivially_destructible(_Tp)> {}; template <class _Tp, class... _Args> struct is_nothrow_constructible : public integral_constant<bool, __is_nothrow_constructible(_Tp, _Args...)> {}; template <class _Tp> struct is_nothrow_default_constructible : public is_nothrow_constructible<_Tp> {}; template <class _Tp> struct is_nothrow_copy_constructible : public is_nothrow_constructible<_Tp, typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; template <class _Tp> struct is_nothrow_move_constructible : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> {}; template <class _Tp, class _Arg> struct is_nothrow_assignable : public integral_constant<bool, __is_nothrow_assignable(_Tp, _Arg)> {}; template <class _Tp> struct is_nothrow_copy_assignable : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; template <class _Tp> struct is_nothrow_move_assignable : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, typename add_rvalue_reference<_Tp>::type> {}; template <bool, class _Tp> struct __libcpp_is_nothrow_destructible; template <class _Tp> struct __libcpp_is_nothrow_destructible<false, _Tp> : public false_type { }; template <class _Tp> struct __libcpp_is_nothrow_destructible<true, _Tp> : public integral_constant<bool, noexcept(std::__1::declval<_Tp>().~_Tp()) > { }; template <class _Tp> struct is_nothrow_destructible : public __libcpp_is_nothrow_destructible<is_destructible<_Tp>::value, _Tp> { }; template <class _Tp, size_t _Ns> struct is_nothrow_destructible<_Tp[_Ns]> : public is_nothrow_destructible<_Tp> { }; template <class _Tp> struct is_nothrow_destructible<_Tp&> : public true_type { }; template <class _Tp> struct is_nothrow_destructible<_Tp&&> : public true_type { }; template <class _Tp> struct is_pod : public integral_constant<bool, __is_pod(_Tp)> {}; template <class _Tp> struct is_literal_type : public integral_constant<bool, __is_literal_type(_Tp)> {}; template <class _Tp> struct is_standard_layout : public integral_constant<bool, __is_standard_layout(_Tp)> {}; template <class _Tp> struct is_trivially_copyable : public integral_constant<bool, __is_trivially_copyable(_Tp)> {}; template <class _Tp> struct is_trivial : public integral_constant<bool, __is_trivial(_Tp)> {}; template <class _Tp> struct __is_reference_wrapper_impl : public false_type {}; template <class _Tp> struct __is_reference_wrapper_impl<reference_wrapper<_Tp> > : public true_type {}; template <class _Tp> struct __is_reference_wrapper : public __is_reference_wrapper_impl<typename remove_cv<_Tp>::type> {}; template <class _Fp, class _A0, class _DecayFp = typename decay<_Fp>::type, class _DecayA0 = typename decay<_A0>::type, class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> using __enable_if_bullet1 = typename enable_if < is_member_function_pointer<_DecayFp>::value && is_base_of<_ClassT, _DecayA0>::value >::type; template <class _Fp, class _A0, class _DecayFp = typename decay<_Fp>::type, class _DecayA0 = typename decay<_A0>::type> using __enable_if_bullet2 = typename enable_if < is_member_function_pointer<_DecayFp>::value && __is_reference_wrapper<_DecayA0>::value >::type; template <class _Fp, class _A0, class _DecayFp = typename decay<_Fp>::type, class _DecayA0 = typename decay<_A0>::type, class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> using __enable_if_bullet3 = typename enable_if < is_member_function_pointer<_DecayFp>::value && !is_base_of<_ClassT, _DecayA0>::value && !__is_reference_wrapper<_DecayA0>::value >::type; template <class _Fp, class _A0, class _DecayFp = typename decay<_Fp>::type, class _DecayA0 = typename decay<_A0>::type, class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> using __enable_if_bullet4 = typename enable_if < is_member_object_pointer<_DecayFp>::value && is_base_of<_ClassT, _DecayA0>::value >::type; template <class _Fp, class _A0, class _DecayFp = typename decay<_Fp>::type, class _DecayA0 = typename decay<_A0>::type> using __enable_if_bullet5 = typename enable_if < is_member_object_pointer<_DecayFp>::value && __is_reference_wrapper<_DecayA0>::value >::type; template <class _Fp, class _A0, class _DecayFp = typename decay<_Fp>::type, class _DecayA0 = typename decay<_A0>::type, class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> using __enable_if_bullet6 = typename enable_if < is_member_object_pointer<_DecayFp>::value && !is_base_of<_ClassT, _DecayA0>::value && !__is_reference_wrapper<_DecayA0>::value >::type; template <class ..._Args> auto __invoke(__any, _Args&& ...__args) -> __nat; template <class ..._Args> auto __invoke_constexpr(__any, _Args&& ...__args) -> __nat; template <class _Fp, class _A0, class ..._Args, class = __enable_if_bullet1<_Fp, _A0>> inline __attribute__ ((__exclude_from_explicit_instantiation__)) auto __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) noexcept(noexcept((std::__1::forward<_A0>(__a0).*__f)(std::__1::forward<_Args>(__args)...))) -> decltype((std::__1::forward<_A0>(__a0).*__f)(std::__1::forward<_Args>(__args)...)) { return (std::__1::forward<_A0>(__a0).*__f)(std::__1::forward<_Args>(__args)...); } template <class _Fp, class _A0, class ..._Args, class = __enable_if_bullet1<_Fp, _A0>> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr auto __invoke_constexpr(_Fp&& __f, _A0&& __a0, _Args&& ...__args) noexcept(noexcept((std::__1::forward<_A0>(__a0).*__f)(std::__1::forward<_Args>(__args)...))) -> decltype((std::__1::forward<_A0>(__a0).*__f)(std::__1::forward<_Args>(__args)...)) { return (std::__1::forward<_A0>(__a0).*__f)(std::__1::forward<_Args>(__args)...); } template <class _Fp, class _A0, class ..._Args, class = __enable_if_bullet2<_Fp, _A0>> inline __attribute__ ((__exclude_from_explicit_instantiation__)) auto __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) noexcept(noexcept((__a0.get().*__f)(std::__1::forward<_Args>(__args)...))) -> decltype((__a0.get().*__f)(std::__1::forward<_Args>(__args)...)) { return (__a0.get().*__f)(std::__1::forward<_Args>(__args)...); } template <class _Fp, class _A0, class ..._Args, class = __enable_if_bullet2<_Fp, _A0>> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr auto __invoke_constexpr(_Fp&& __f, _A0&& __a0, _Args&& ...__args) noexcept(noexcept((__a0.get().*__f)(std::__1::forward<_Args>(__args)...))) -> decltype((__a0.get().*__f)(std::__1::forward<_Args>(__args)...)) { return (__a0.get().*__f)(std::__1::forward<_Args>(__args)...); } template <class _Fp, class _A0, class ..._Args, class = __enable_if_bullet3<_Fp, _A0>> inline __attribute__ ((__exclude_from_explicit_instantiation__)) auto __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) noexcept(noexcept(((*std::__1::forward<_A0>(__a0)).*__f)(std::__1::forward<_Args>(__args)...))) -> decltype(((*std::__1::forward<_A0>(__a0)).*__f)(std::__1::forward<_Args>(__args)...)) { return ((*std::__1::forward<_A0>(__a0)).*__f)(std::__1::forward<_Args>(__args)...); } template <class _Fp, class _A0, class ..._Args, class = __enable_if_bullet3<_Fp, _A0>> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr auto __invoke_constexpr(_Fp&& __f, _A0&& __a0, _Args&& ...__args) noexcept(noexcept(((*std::__1::forward<_A0>(__a0)).*__f)(std::__1::forward<_Args>(__args)...))) -> decltype(((*std::__1::forward<_A0>(__a0)).*__f)(std::__1::forward<_Args>(__args)...)) { return ((*std::__1::forward<_A0>(__a0)).*__f)(std::__1::forward<_Args>(__args)...); } template <class _Fp, class _A0, class = __enable_if_bullet4<_Fp, _A0>> inline __attribute__ ((__exclude_from_explicit_instantiation__)) auto __invoke(_Fp&& __f, _A0&& __a0) noexcept(noexcept(std::__1::forward<_A0>(__a0).*__f)) -> decltype(std::__1::forward<_A0>(__a0).*__f) { return std::__1::forward<_A0>(__a0).*__f; } template <class _Fp, class _A0, class = __enable_if_bullet4<_Fp, _A0>> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr auto __invoke_constexpr(_Fp&& __f, _A0&& __a0) noexcept(noexcept(std::__1::forward<_A0>(__a0).*__f)) -> decltype(std::__1::forward<_A0>(__a0).*__f) { return std::__1::forward<_A0>(__a0).*__f; } template <class _Fp, class _A0, class = __enable_if_bullet5<_Fp, _A0>> inline __attribute__ ((__exclude_from_explicit_instantiation__)) auto __invoke(_Fp&& __f, _A0&& __a0) noexcept(noexcept(__a0.get().*__f)) -> decltype(__a0.get().*__f) { return __a0.get().*__f; } template <class _Fp, class _A0, class = __enable_if_bullet5<_Fp, _A0>> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr auto __invoke_constexpr(_Fp&& __f, _A0&& __a0) noexcept(noexcept(__a0.get().*__f)) -> decltype(__a0.get().*__f) { return __a0.get().*__f; } template <class _Fp, class _A0, class = __enable_if_bullet6<_Fp, _A0>> inline __attribute__ ((__exclude_from_explicit_instantiation__)) auto __invoke(_Fp&& __f, _A0&& __a0) noexcept(noexcept((*std::__1::forward<_A0>(__a0)).*__f)) -> decltype((*std::__1::forward<_A0>(__a0)).*__f) { return (*std::__1::forward<_A0>(__a0)).*__f; } template <class _Fp, class _A0, class = __enable_if_bullet6<_Fp, _A0>> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr auto __invoke_constexpr(_Fp&& __f, _A0&& __a0) noexcept(noexcept((*std::__1::forward<_A0>(__a0)).*__f)) -> decltype((*std::__1::forward<_A0>(__a0)).*__f) { return (*std::__1::forward<_A0>(__a0)).*__f; } template <class _Fp, class ..._Args> inline __attribute__ ((__exclude_from_explicit_instantiation__)) auto __invoke(_Fp&& __f, _Args&& ...__args) noexcept(noexcept(std::__1::forward<_Fp>(__f)(std::__1::forward<_Args>(__args)...))) -> decltype(std::__1::forward<_Fp>(__f)(std::__1::forward<_Args>(__args)...)) { return std::__1::forward<_Fp>(__f)(std::__1::forward<_Args>(__args)...); } template <class _Fp, class ..._Args> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr auto __invoke_constexpr(_Fp&& __f, _Args&& ...__args) noexcept(noexcept(std::__1::forward<_Fp>(__f)(std::__1::forward<_Args>(__args)...))) -> decltype(std::__1::forward<_Fp>(__f)(std::__1::forward<_Args>(__args)...)) { return std::__1::forward<_Fp>(__f)(std::__1::forward<_Args>(__args)...); } template <class _Ret, class _Fp, class ..._Args> struct __invokable_r { template <class _XFp, class ..._XArgs> static auto __try_call(int) -> decltype( std::__1::__invoke(std::__1::declval<_XFp>(), std::__1::declval<_XArgs>()...)); template <class _XFp, class ..._XArgs> static __nat __try_call(...); using _Result = decltype(__try_call<_Fp, _Args...>(0)); using type = typename conditional< _IsNotSame<_Result, __nat>::value, typename conditional< is_void<_Ret>::value, true_type, is_convertible<_Result, _Ret> >::type, false_type >::type; static const bool value = type::value; }; template <class _Fp, class ..._Args> using __invokable = __invokable_r<void, _Fp, _Args...>; template <bool _IsInvokable, bool _IsCVVoid, class _Ret, class _Fp, class ..._Args> struct __nothrow_invokable_r_imp { static const bool value = false; }; template <class _Ret, class _Fp, class ..._Args> struct __nothrow_invokable_r_imp<true, false, _Ret, _Fp, _Args...> { typedef __nothrow_invokable_r_imp _ThisT; template <class _Tp> static void __test_noexcept(_Tp) noexcept; static const bool value = noexcept(_ThisT::__test_noexcept<_Ret>( std::__1::__invoke(std::__1::declval<_Fp>(), std::__1::declval<_Args>()...))); }; template <class _Ret, class _Fp, class ..._Args> struct __nothrow_invokable_r_imp<true, true, _Ret, _Fp, _Args...> { static const bool value = noexcept( std::__1::__invoke(std::__1::declval<_Fp>(), std::__1::declval<_Args>()...)); }; template <class _Ret, class _Fp, class ..._Args> using __nothrow_invokable_r = __nothrow_invokable_r_imp< __invokable_r<_Ret, _Fp, _Args...>::value, is_void<_Ret>::value, _Ret, _Fp, _Args... >; template <class _Fp, class ..._Args> using __nothrow_invokable = __nothrow_invokable_r_imp< __invokable<_Fp, _Args...>::value, true, void, _Fp, _Args... >; template <class _Fp, class ..._Args> struct __invoke_of : public enable_if< __invokable<_Fp, _Args...>::value, typename __invokable_r<void, _Fp, _Args...>::_Result> { }; template <class _Fp, class ..._Args> class result_of<_Fp(_Args...)> : public __invoke_of<_Fp, _Args...> { }; template <class _Tp> using result_of_t = typename result_of<_Tp>::type; template <class _Tp> struct __is_swappable; template <class _Tp> struct __is_nothrow_swappable; template <class _ForwardIterator1, class _ForwardIterator2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _ForwardIterator2 swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2); template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_move_constructible<_Tp>::value && is_move_assignable<_Tp>::value >::type swap(_Tp& __x, _Tp& __y) noexcept(is_nothrow_move_constructible<_Tp>::value && is_nothrow_move_assignable<_Tp>::value) { _Tp __t(std::__1::move(__x)); __x = std::__1::move(__y); __y = std::__1::move(__t); } template<class _Tp, size_t _Np> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if< __is_swappable<_Tp>::value >::type swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) noexcept(__is_nothrow_swappable<_Tp>::value) { std::__1::swap_ranges(__a, __a + _Np, __b); } template <class _ForwardIterator1, class _ForwardIterator2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _ForwardIterator2 swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2) { for(; __first1 != __last1; ++__first1, (void) ++__first2) swap(*__first1, *__first2); return __first2; } template <class _ForwardIterator1, class _ForwardIterator2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) noexcept(noexcept(swap(*std::__1::declval<_ForwardIterator1>(), *std::__1::declval<_ForwardIterator2>()))) { swap(*__a, *__b); } namespace __detail { template <class _Tp, class _Up = _Tp, bool _NotVoid = !is_void<_Tp>::value && !is_void<_Up>::value> struct __swappable_with { template <class _LHS, class _RHS> static decltype(swap(std::__1::declval<_LHS>(), std::__1::declval<_RHS>())) __test_swap(int); template <class, class> static __nat __test_swap(long); typedef decltype((__test_swap<_Tp, _Up>(0))) __swap1; typedef decltype((__test_swap<_Up, _Tp>(0))) __swap2; static const bool value = _IsNotSame<__swap1, __nat>::value && _IsNotSame<__swap2, __nat>::value; }; template <class _Tp, class _Up> struct __swappable_with<_Tp, _Up, false> : false_type {}; template <class _Tp, class _Up = _Tp, bool _Swappable = __swappable_with<_Tp, _Up>::value> struct __nothrow_swappable_with { static const bool value = noexcept(swap(std::__1::declval<_Tp>(), std::__1::declval<_Up>())) && noexcept(swap(std::__1::declval<_Up>(), std::__1::declval<_Tp>())); }; template <class _Tp, class _Up> struct __nothrow_swappable_with<_Tp, _Up, false> : false_type {}; } template <class _Tp> struct __is_swappable : public integral_constant<bool, __detail::__swappable_with<_Tp&>::value> { }; template <class _Tp> struct __is_nothrow_swappable : public integral_constant<bool, __detail::__nothrow_swappable_with<_Tp&>::value> { }; template <class _Tp, bool = is_enum<_Tp>::value> struct __underlying_type_impl; template <class _Tp> struct __underlying_type_impl<_Tp, false> {}; template <class _Tp> struct __underlying_type_impl<_Tp, true> { typedef __underlying_type(_Tp) type; }; template <class _Tp> struct underlying_type : __underlying_type_impl<_Tp, is_enum<_Tp>::value> {}; template <class _Tp> using underlying_type_t = typename underlying_type<_Tp>::type; template <class _Tp, bool = is_enum<_Tp>::value> struct __sfinae_underlying_type { typedef typename underlying_type<_Tp>::type type; typedef decltype(((type)1) + 0) __promoted_type; }; template <class _Tp> struct __sfinae_underlying_type<_Tp, false> {}; inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr int __convert_to_integral(int __val) { return __val; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr unsigned __convert_to_integral(unsigned __val) { return __val; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr long __convert_to_integral(long __val) { return __val; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr unsigned long __convert_to_integral(unsigned long __val) { return __val; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr long long __convert_to_integral(long long __val) { return __val; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr unsigned long long __convert_to_integral(unsigned long long __val) {return __val; } template<typename _Fp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename enable_if<is_floating_point<_Fp>::value, long long>::type __convert_to_integral(_Fp __val) { return __val; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __int128_t __convert_to_integral(__int128_t __val) { return __val; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __uint128_t __convert_to_integral(__uint128_t __val) { return __val; } template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename __sfinae_underlying_type<_Tp>::__promoted_type __convert_to_integral(_Tp __val) { return __val; } template <class _Tp> struct __has_operator_addressof_member_imp { template <class _Up> static auto __test(int) -> typename __select_2nd<decltype(std::__1::declval<_Up>().operator&()), true_type>::type; template <class> static auto __test(long) -> false_type; static const bool value = decltype(__test<_Tp>(0))::value; }; template <class _Tp> struct __has_operator_addressof_free_imp { template <class _Up> static auto __test(int) -> typename __select_2nd<decltype(operator&(std::__1::declval<_Up>())), true_type>::type; template <class> static auto __test(long) -> false_type; static const bool value = decltype(__test<_Tp>(0))::value; }; template <class _Tp> struct __has_operator_addressof : public integral_constant<bool, __has_operator_addressof_member_imp<_Tp>::value || __has_operator_addressof_free_imp<_Tp>::value> {}; struct __extract_key_fail_tag {}; struct __extract_key_self_tag {}; struct __extract_key_first_tag {}; template <class _ValTy, class _Key, class _RawValTy = typename __unconstref<_ValTy>::type> struct __can_extract_key : conditional<_IsSame<_RawValTy, _Key>::value, __extract_key_self_tag, __extract_key_fail_tag>::type {}; template <class _Pair, class _Key, class _First, class _Second> struct __can_extract_key<_Pair, _Key, pair<_First, _Second>> : conditional<_IsSame<typename remove_const<_First>::type, _Key>::value, __extract_key_first_tag, __extract_key_fail_tag>::type {}; template <class _ValTy, class _Key, class _ContainerValueTy, class _RawValTy = typename __unconstref<_ValTy>::type> struct __can_extract_map_key : integral_constant<bool, _IsSame<_RawValTy, _Key>::value> {}; template <class _ValTy, class _Key, class _RawValTy> struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy> : false_type {}; inline constexpr bool __libcpp_is_constant_evaluated() noexcept { return __builtin_is_constant_evaluated(); } template <class _CharT> using _IsCharLikeType = _And<is_standard_layout<_CharT>, is_trivial<_CharT> >; } } namespace std { inline namespace __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 }; enum float_denorm_style { denorm_indeterminate = -1, denorm_absent = 0, denorm_present = 1 }; template <class _Tp, bool = is_arithmetic<_Tp>::value> class __libcpp_numeric_limits { protected: typedef _Tp type; static constexpr const bool is_specialized = false; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type min() noexcept {return type();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type max() noexcept {return type();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type lowest() noexcept {return type();} static constexpr const int digits = 0; static constexpr const int digits10 = 0; static constexpr const int max_digits10 = 0; static constexpr const bool is_signed = false; static constexpr const bool is_integer = false; static constexpr const bool is_exact = false; static constexpr const int radix = 0; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type epsilon() noexcept {return type();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type round_error() noexcept {return type();} static constexpr const int min_exponent = 0; static constexpr const int min_exponent10 = 0; static constexpr const int max_exponent = 0; static constexpr const int max_exponent10 = 0; static constexpr const bool has_infinity = false; static constexpr const bool has_quiet_NaN = false; static constexpr const bool has_signaling_NaN = false; static constexpr const float_denorm_style has_denorm = denorm_absent; static constexpr const bool has_denorm_loss = false; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type infinity() noexcept {return type();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type quiet_NaN() noexcept {return type();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type signaling_NaN() noexcept {return type();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type denorm_min() noexcept {return type();} static constexpr const bool is_iec559 = false; static constexpr const bool is_bounded = false; static constexpr const bool is_modulo = false; static constexpr const bool traps = false; static constexpr const bool tinyness_before = false; static constexpr const float_round_style round_style = round_toward_zero; }; template <class _Tp, int __digits, bool _IsSigned> struct __libcpp_compute_min { static constexpr const _Tp value = _Tp(_Tp(1) << __digits); }; template <class _Tp, int __digits> struct __libcpp_compute_min<_Tp, __digits, false> { static constexpr const _Tp value = _Tp(0); }; template <class _Tp> class __libcpp_numeric_limits<_Tp, true> { protected: typedef _Tp type; static constexpr const bool is_specialized = true; static constexpr const bool is_signed = type(-1) < type(0); static constexpr const int digits = static_cast<int>(sizeof(type) * 8 - is_signed); static constexpr const int digits10 = digits * 3 / 10; static constexpr const int max_digits10 = 0; static constexpr const type __min = __libcpp_compute_min<type, digits, is_signed>::value; static constexpr const type __max = is_signed ? type(type(~0) ^ __min) : type(~0); __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type min() noexcept {return __min;} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type max() noexcept {return __max;} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type lowest() noexcept {return min();} static constexpr const bool is_integer = true; static constexpr const bool is_exact = true; static constexpr const int radix = 2; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type epsilon() noexcept {return type(0);} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type round_error() noexcept {return type(0);} static constexpr const int min_exponent = 0; static constexpr const int min_exponent10 = 0; static constexpr const int max_exponent = 0; static constexpr const int max_exponent10 = 0; static constexpr const bool has_infinity = false; static constexpr const bool has_quiet_NaN = false; static constexpr const bool has_signaling_NaN = false; static constexpr const float_denorm_style has_denorm = denorm_absent; static constexpr const bool has_denorm_loss = false; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type infinity() noexcept {return type(0);} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type quiet_NaN() noexcept {return type(0);} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type signaling_NaN() noexcept {return type(0);} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type denorm_min() noexcept {return type(0);} static constexpr const bool is_iec559 = false; static constexpr const bool is_bounded = true; static constexpr const bool is_modulo = !std::__1::is_signed<_Tp>::value; static constexpr const bool traps = true; static constexpr const bool tinyness_before = false; static constexpr const float_round_style round_style = round_toward_zero; }; template <> class __libcpp_numeric_limits<bool, true> { protected: typedef bool type; static constexpr const bool is_specialized = true; static constexpr const bool is_signed = false; static constexpr const int digits = 1; static constexpr const int digits10 = 0; static constexpr const int max_digits10 = 0; static constexpr const type __min = false; static constexpr const type __max = true; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type min() noexcept {return __min;} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type max() noexcept {return __max;} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type lowest() noexcept {return min();} static constexpr const bool is_integer = true; static constexpr const bool is_exact = true; static constexpr const int radix = 2; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type epsilon() noexcept {return type(0);} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type round_error() noexcept {return type(0);} static constexpr const int min_exponent = 0; static constexpr const int min_exponent10 = 0; static constexpr const int max_exponent = 0; static constexpr const int max_exponent10 = 0; static constexpr const bool has_infinity = false; static constexpr const bool has_quiet_NaN = false; static constexpr const bool has_signaling_NaN = false; static constexpr const float_denorm_style has_denorm = denorm_absent; static constexpr const bool has_denorm_loss = false; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type infinity() noexcept {return type(0);} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type quiet_NaN() noexcept {return type(0);} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type signaling_NaN() noexcept {return type(0);} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type denorm_min() noexcept {return type(0);} static constexpr const bool is_iec559 = false; static constexpr const bool is_bounded = true; static constexpr const bool is_modulo = false; static constexpr const bool traps = false; static constexpr const bool tinyness_before = false; static constexpr const float_round_style round_style = round_toward_zero; }; template <> class __libcpp_numeric_limits<float, true> { protected: typedef float type; static constexpr const bool is_specialized = true; static constexpr const bool is_signed = true; static constexpr const int digits = 24; static constexpr const int digits10 = 6; static constexpr const int max_digits10 = 2+(digits * 30103l)/100000l; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type min() noexcept {return 1.17549435e-38F;} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type max() noexcept {return 3.40282347e+38F;} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type lowest() noexcept {return -max();} static constexpr const bool is_integer = false; static constexpr const bool is_exact = false; static constexpr const int radix = 2; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type epsilon() noexcept {return 1.19209290e-7F;} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type round_error() noexcept {return 0.5F;} static constexpr const int min_exponent = (-125); static constexpr const int min_exponent10 = (-37); static constexpr const int max_exponent = 128; static constexpr const int max_exponent10 = 38; static constexpr const bool has_infinity = true; static constexpr const bool has_quiet_NaN = true; static constexpr const bool has_signaling_NaN = true; static constexpr const float_denorm_style has_denorm = denorm_present; static constexpr const bool has_denorm_loss = false; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type infinity() noexcept {return __builtin_huge_valf();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type quiet_NaN() noexcept {return __builtin_nanf("");} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type signaling_NaN() noexcept {return __builtin_nansf("");} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type denorm_min() noexcept {return 1.40129846e-45F;} static constexpr const bool is_iec559 = true; static constexpr const bool is_bounded = true; static constexpr const bool is_modulo = false; static constexpr const bool traps = false; static constexpr const bool tinyness_before = false; static constexpr const float_round_style round_style = round_to_nearest; }; template <> class __libcpp_numeric_limits<double, true> { protected: typedef double type; static constexpr const bool is_specialized = true; static constexpr const bool is_signed = true; static constexpr const int digits = 53; static constexpr const int digits10 = 15; static constexpr const int max_digits10 = 2+(digits * 30103l)/100000l; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type min() noexcept {return 2.2250738585072014e-308;} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type max() noexcept {return 1.7976931348623157e+308;} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type lowest() noexcept {return -max();} static constexpr const bool is_integer = false; static constexpr const bool is_exact = false; static constexpr const int radix = 2; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type epsilon() noexcept {return 2.2204460492503131e-16;} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type round_error() noexcept {return 0.5;} static constexpr const int min_exponent = (-1021); static constexpr const int min_exponent10 = (-307); static constexpr const int max_exponent = 1024; static constexpr const int max_exponent10 = 308; static constexpr const bool has_infinity = true; static constexpr const bool has_quiet_NaN = true; static constexpr const bool has_signaling_NaN = true; static constexpr const float_denorm_style has_denorm = denorm_present; static constexpr const bool has_denorm_loss = false; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type infinity() noexcept {return __builtin_huge_val();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type quiet_NaN() noexcept {return __builtin_nan("");} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type signaling_NaN() noexcept {return __builtin_nans("");} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type denorm_min() noexcept {return 4.9406564584124654e-324;} static constexpr const bool is_iec559 = true; static constexpr const bool is_bounded = true; static constexpr const bool is_modulo = false; static constexpr const bool traps = false; static constexpr const bool tinyness_before = false; static constexpr const float_round_style round_style = round_to_nearest; }; template <> class __libcpp_numeric_limits<long double, true> { protected: typedef long double type; static constexpr const bool is_specialized = true; static constexpr const bool is_signed = true; static constexpr const int digits = 53; static constexpr const int digits10 = 15; static constexpr const int max_digits10 = 2+(digits * 30103l)/100000l; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type min() noexcept {return 2.2250738585072014e-308L;} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type max() noexcept {return 1.7976931348623157e+308L;} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type lowest() noexcept {return -max();} static constexpr const bool is_integer = false; static constexpr const bool is_exact = false; static constexpr const int radix = 2; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type epsilon() noexcept {return 2.2204460492503131e-16L;} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type round_error() noexcept {return 0.5L;} static constexpr const int min_exponent = (-1021); static constexpr const int min_exponent10 = (-307); static constexpr const int max_exponent = 1024; static constexpr const int max_exponent10 = 308; static constexpr const bool has_infinity = true; static constexpr const bool has_quiet_NaN = true; static constexpr const bool has_signaling_NaN = true; static constexpr const float_denorm_style has_denorm = denorm_present; static constexpr const bool has_denorm_loss = false; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type infinity() noexcept {return __builtin_huge_vall();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type quiet_NaN() noexcept {return __builtin_nanl("");} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type signaling_NaN() noexcept {return __builtin_nansl("");} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type denorm_min() noexcept {return 4.9406564584124654e-324L;} static constexpr const bool is_iec559 = true; static constexpr const bool is_bounded = true; static constexpr const bool is_modulo = false; static constexpr const bool traps = false; static constexpr const bool tinyness_before = false; static constexpr const float_round_style round_style = round_to_nearest; }; template <class _Tp> class numeric_limits : private __libcpp_numeric_limits<typename remove_cv<_Tp>::type> { typedef __libcpp_numeric_limits<typename remove_cv<_Tp>::type> __base; typedef typename __base::type type; public: static constexpr const bool is_specialized = __base::is_specialized; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type min() noexcept {return __base::min();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type max() noexcept {return __base::max();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type lowest() noexcept {return __base::lowest();} static constexpr const int digits = __base::digits; static constexpr const int digits10 = __base::digits10; static constexpr const int max_digits10 = __base::max_digits10; static constexpr const bool is_signed = __base::is_signed; static constexpr const bool is_integer = __base::is_integer; static constexpr const bool is_exact = __base::is_exact; static constexpr const int radix = __base::radix; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type epsilon() noexcept {return __base::epsilon();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type round_error() noexcept {return __base::round_error();} static constexpr const int min_exponent = __base::min_exponent; static constexpr const int min_exponent10 = __base::min_exponent10; static constexpr const int max_exponent = __base::max_exponent; static constexpr const int max_exponent10 = __base::max_exponent10; static constexpr const bool has_infinity = __base::has_infinity; static constexpr const bool has_quiet_NaN = __base::has_quiet_NaN; static constexpr const bool has_signaling_NaN = __base::has_signaling_NaN; static constexpr const float_denorm_style has_denorm = __base::has_denorm; static constexpr const bool has_denorm_loss = __base::has_denorm_loss; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type infinity() noexcept {return __base::infinity();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type quiet_NaN() noexcept {return __base::quiet_NaN();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type signaling_NaN() noexcept {return __base::signaling_NaN();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type denorm_min() noexcept {return __base::denorm_min();} static constexpr const bool is_iec559 = __base::is_iec559; static constexpr const bool is_bounded = __base::is_bounded; static constexpr const bool is_modulo = __base::is_modulo; static constexpr const bool traps = __base::traps; static constexpr const bool tinyness_before = __base::tinyness_before; static constexpr const float_round_style round_style = __base::round_style; }; template <class _Tp> constexpr const bool numeric_limits<_Tp>::is_specialized; template <class _Tp> constexpr const int numeric_limits<_Tp>::digits; template <class _Tp> constexpr const int numeric_limits<_Tp>::digits10; template <class _Tp> constexpr const int numeric_limits<_Tp>::max_digits10; template <class _Tp> constexpr const bool numeric_limits<_Tp>::is_signed; template <class _Tp> constexpr const bool numeric_limits<_Tp>::is_integer; template <class _Tp> constexpr const bool numeric_limits<_Tp>::is_exact; template <class _Tp> constexpr const int numeric_limits<_Tp>::radix; template <class _Tp> constexpr const int numeric_limits<_Tp>::min_exponent; template <class _Tp> constexpr const int numeric_limits<_Tp>::min_exponent10; template <class _Tp> constexpr const int numeric_limits<_Tp>::max_exponent; template <class _Tp> constexpr const int numeric_limits<_Tp>::max_exponent10; template <class _Tp> constexpr const bool numeric_limits<_Tp>::has_infinity; template <class _Tp> constexpr const bool numeric_limits<_Tp>::has_quiet_NaN; template <class _Tp> constexpr const bool numeric_limits<_Tp>::has_signaling_NaN; template <class _Tp> constexpr const float_denorm_style numeric_limits<_Tp>::has_denorm; template <class _Tp> constexpr const bool numeric_limits<_Tp>::has_denorm_loss; template <class _Tp> constexpr const bool numeric_limits<_Tp>::is_iec559; template <class _Tp> constexpr const bool numeric_limits<_Tp>::is_bounded; template <class _Tp> constexpr const bool numeric_limits<_Tp>::is_modulo; template <class _Tp> constexpr const bool numeric_limits<_Tp>::traps; template <class _Tp> constexpr const bool numeric_limits<_Tp>::tinyness_before; template <class _Tp> constexpr const float_round_style numeric_limits<_Tp>::round_style; template <class _Tp> class numeric_limits<const _Tp> : private numeric_limits<_Tp> { typedef numeric_limits<_Tp> __base; typedef _Tp type; public: static constexpr const bool is_specialized = __base::is_specialized; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type min() noexcept {return __base::min();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type max() noexcept {return __base::max();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type lowest() noexcept {return __base::lowest();} static constexpr const int digits = __base::digits; static constexpr const int digits10 = __base::digits10; static constexpr const int max_digits10 = __base::max_digits10; static constexpr const bool is_signed = __base::is_signed; static constexpr const bool is_integer = __base::is_integer; static constexpr const bool is_exact = __base::is_exact; static constexpr const int radix = __base::radix; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type epsilon() noexcept {return __base::epsilon();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type round_error() noexcept {return __base::round_error();} static constexpr const int min_exponent = __base::min_exponent; static constexpr const int min_exponent10 = __base::min_exponent10; static constexpr const int max_exponent = __base::max_exponent; static constexpr const int max_exponent10 = __base::max_exponent10; static constexpr const bool has_infinity = __base::has_infinity; static constexpr const bool has_quiet_NaN = __base::has_quiet_NaN; static constexpr const bool has_signaling_NaN = __base::has_signaling_NaN; static constexpr const float_denorm_style has_denorm = __base::has_denorm; static constexpr const bool has_denorm_loss = __base::has_denorm_loss; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type infinity() noexcept {return __base::infinity();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type quiet_NaN() noexcept {return __base::quiet_NaN();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type signaling_NaN() noexcept {return __base::signaling_NaN();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type denorm_min() noexcept {return __base::denorm_min();} static constexpr const bool is_iec559 = __base::is_iec559; static constexpr const bool is_bounded = __base::is_bounded; static constexpr const bool is_modulo = __base::is_modulo; static constexpr const bool traps = __base::traps; static constexpr const bool tinyness_before = __base::tinyness_before; static constexpr const float_round_style round_style = __base::round_style; }; template <class _Tp> constexpr const bool numeric_limits<const _Tp>::is_specialized; template <class _Tp> constexpr const int numeric_limits<const _Tp>::digits; template <class _Tp> constexpr const int numeric_limits<const _Tp>::digits10; template <class _Tp> constexpr const int numeric_limits<const _Tp>::max_digits10; template <class _Tp> constexpr const bool numeric_limits<const _Tp>::is_signed; template <class _Tp> constexpr const bool numeric_limits<const _Tp>::is_integer; template <class _Tp> constexpr const bool numeric_limits<const _Tp>::is_exact; template <class _Tp> constexpr const int numeric_limits<const _Tp>::radix; template <class _Tp> constexpr const int numeric_limits<const _Tp>::min_exponent; template <class _Tp> constexpr const int numeric_limits<const _Tp>::min_exponent10; template <class _Tp> constexpr const int numeric_limits<const _Tp>::max_exponent; template <class _Tp> constexpr const int numeric_limits<const _Tp>::max_exponent10; template <class _Tp> constexpr const bool numeric_limits<const _Tp>::has_infinity; template <class _Tp> constexpr const bool numeric_limits<const _Tp>::has_quiet_NaN; template <class _Tp> constexpr const bool numeric_limits<const _Tp>::has_signaling_NaN; template <class _Tp> constexpr const float_denorm_style numeric_limits<const _Tp>::has_denorm; template <class _Tp> constexpr const bool numeric_limits<const _Tp>::has_denorm_loss; template <class _Tp> constexpr const bool numeric_limits<const _Tp>::is_iec559; template <class _Tp> constexpr const bool numeric_limits<const _Tp>::is_bounded; template <class _Tp> constexpr const bool numeric_limits<const _Tp>::is_modulo; template <class _Tp> constexpr const bool numeric_limits<const _Tp>::traps; template <class _Tp> constexpr const bool numeric_limits<const _Tp>::tinyness_before; template <class _Tp> constexpr const float_round_style numeric_limits<const _Tp>::round_style; template <class _Tp> class numeric_limits<volatile _Tp> : private numeric_limits<_Tp> { typedef numeric_limits<_Tp> __base; typedef _Tp type; public: static constexpr const bool is_specialized = __base::is_specialized; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type min() noexcept {return __base::min();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type max() noexcept {return __base::max();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type lowest() noexcept {return __base::lowest();} static constexpr const int digits = __base::digits; static constexpr const int digits10 = __base::digits10; static constexpr const int max_digits10 = __base::max_digits10; static constexpr const bool is_signed = __base::is_signed; static constexpr const bool is_integer = __base::is_integer; static constexpr const bool is_exact = __base::is_exact; static constexpr const int radix = __base::radix; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type epsilon() noexcept {return __base::epsilon();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type round_error() noexcept {return __base::round_error();} static constexpr const int min_exponent = __base::min_exponent; static constexpr const int min_exponent10 = __base::min_exponent10; static constexpr const int max_exponent = __base::max_exponent; static constexpr const int max_exponent10 = __base::max_exponent10; static constexpr const bool has_infinity = __base::has_infinity; static constexpr const bool has_quiet_NaN = __base::has_quiet_NaN; static constexpr const bool has_signaling_NaN = __base::has_signaling_NaN; static constexpr const float_denorm_style has_denorm = __base::has_denorm; static constexpr const bool has_denorm_loss = __base::has_denorm_loss; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type infinity() noexcept {return __base::infinity();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type quiet_NaN() noexcept {return __base::quiet_NaN();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type signaling_NaN() noexcept {return __base::signaling_NaN();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type denorm_min() noexcept {return __base::denorm_min();} static constexpr const bool is_iec559 = __base::is_iec559; static constexpr const bool is_bounded = __base::is_bounded; static constexpr const bool is_modulo = __base::is_modulo; static constexpr const bool traps = __base::traps; static constexpr const bool tinyness_before = __base::tinyness_before; static constexpr const float_round_style round_style = __base::round_style; }; template <class _Tp> constexpr const bool numeric_limits<volatile _Tp>::is_specialized; template <class _Tp> constexpr const int numeric_limits<volatile _Tp>::digits; template <class _Tp> constexpr const int numeric_limits<volatile _Tp>::digits10; template <class _Tp> constexpr const int numeric_limits<volatile _Tp>::max_digits10; template <class _Tp> constexpr const bool numeric_limits<volatile _Tp>::is_signed; template <class _Tp> constexpr const bool numeric_limits<volatile _Tp>::is_integer; template <class _Tp> constexpr const bool numeric_limits<volatile _Tp>::is_exact; template <class _Tp> constexpr const int numeric_limits<volatile _Tp>::radix; template <class _Tp> constexpr const int numeric_limits<volatile _Tp>::min_exponent; template <class _Tp> constexpr const int numeric_limits<volatile _Tp>::min_exponent10; template <class _Tp> constexpr const int numeric_limits<volatile _Tp>::max_exponent; template <class _Tp> constexpr const int numeric_limits<volatile _Tp>::max_exponent10; template <class _Tp> constexpr const bool numeric_limits<volatile _Tp>::has_infinity; template <class _Tp> constexpr const bool numeric_limits<volatile _Tp>::has_quiet_NaN; template <class _Tp> constexpr const bool numeric_limits<volatile _Tp>::has_signaling_NaN; template <class _Tp> constexpr const float_denorm_style numeric_limits<volatile _Tp>::has_denorm; template <class _Tp> constexpr const bool numeric_limits<volatile _Tp>::has_denorm_loss; template <class _Tp> constexpr const bool numeric_limits<volatile _Tp>::is_iec559; template <class _Tp> constexpr const bool numeric_limits<volatile _Tp>::is_bounded; template <class _Tp> constexpr const bool numeric_limits<volatile _Tp>::is_modulo; template <class _Tp> constexpr const bool numeric_limits<volatile _Tp>::traps; template <class _Tp> constexpr const bool numeric_limits<volatile _Tp>::tinyness_before; template <class _Tp> constexpr const float_round_style numeric_limits<volatile _Tp>::round_style; template <class _Tp> class numeric_limits<const volatile _Tp> : private numeric_limits<_Tp> { typedef numeric_limits<_Tp> __base; typedef _Tp type; public: static constexpr const bool is_specialized = __base::is_specialized; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type min() noexcept {return __base::min();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type max() noexcept {return __base::max();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type lowest() noexcept {return __base::lowest();} static constexpr const int digits = __base::digits; static constexpr const int digits10 = __base::digits10; static constexpr const int max_digits10 = __base::max_digits10; static constexpr const bool is_signed = __base::is_signed; static constexpr const bool is_integer = __base::is_integer; static constexpr const bool is_exact = __base::is_exact; static constexpr const int radix = __base::radix; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type epsilon() noexcept {return __base::epsilon();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type round_error() noexcept {return __base::round_error();} static constexpr const int min_exponent = __base::min_exponent; static constexpr const int min_exponent10 = __base::min_exponent10; static constexpr const int max_exponent = __base::max_exponent; static constexpr const int max_exponent10 = __base::max_exponent10; static constexpr const bool has_infinity = __base::has_infinity; static constexpr const bool has_quiet_NaN = __base::has_quiet_NaN; static constexpr const bool has_signaling_NaN = __base::has_signaling_NaN; static constexpr const float_denorm_style has_denorm = __base::has_denorm; static constexpr const bool has_denorm_loss = __base::has_denorm_loss; __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type infinity() noexcept {return __base::infinity();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type quiet_NaN() noexcept {return __base::quiet_NaN();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type signaling_NaN() noexcept {return __base::signaling_NaN();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr type denorm_min() noexcept {return __base::denorm_min();} static constexpr const bool is_iec559 = __base::is_iec559; static constexpr const bool is_bounded = __base::is_bounded; static constexpr const bool is_modulo = __base::is_modulo; static constexpr const bool traps = __base::traps; static constexpr const bool tinyness_before = __base::tinyness_before; static constexpr const float_round_style round_style = __base::round_style; }; template <class _Tp> constexpr const bool numeric_limits<const volatile _Tp>::is_specialized; template <class _Tp> constexpr const int numeric_limits<const volatile _Tp>::digits; template <class _Tp> constexpr const int numeric_limits<const volatile _Tp>::digits10; template <class _Tp> constexpr const int numeric_limits<const volatile _Tp>::max_digits10; template <class _Tp> constexpr const bool numeric_limits<const volatile _Tp>::is_signed; template <class _Tp> constexpr const bool numeric_limits<const volatile _Tp>::is_integer; template <class _Tp> constexpr const bool numeric_limits<const volatile _Tp>::is_exact; template <class _Tp> constexpr const int numeric_limits<const volatile _Tp>::radix; template <class _Tp> constexpr const int numeric_limits<const volatile _Tp>::min_exponent; template <class _Tp> constexpr const int numeric_limits<const volatile _Tp>::min_exponent10; template <class _Tp> constexpr const int numeric_limits<const volatile _Tp>::max_exponent; template <class _Tp> constexpr const int numeric_limits<const volatile _Tp>::max_exponent10; template <class _Tp> constexpr const bool numeric_limits<const volatile _Tp>::has_infinity; template <class _Tp> constexpr const bool numeric_limits<const volatile _Tp>::has_quiet_NaN; template <class _Tp> constexpr const bool numeric_limits<const volatile _Tp>::has_signaling_NaN; template <class _Tp> constexpr const float_denorm_style numeric_limits<const volatile _Tp>::has_denorm; template <class _Tp> constexpr const bool numeric_limits<const volatile _Tp>::has_denorm_loss; template <class _Tp> constexpr const bool numeric_limits<const volatile _Tp>::is_iec559; template <class _Tp> constexpr const bool numeric_limits<const volatile _Tp>::is_bounded; template <class _Tp> constexpr const bool numeric_limits<const volatile _Tp>::is_modulo; template <class _Tp> constexpr const bool numeric_limits<const volatile _Tp>::traps; template <class _Tp> constexpr const bool numeric_limits<const volatile _Tp>::tinyness_before; template <class _Tp> constexpr const float_round_style numeric_limits<const volatile _Tp>::round_style; } } template <typename _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type signbit(_A1 __lcpp_x) noexcept { return ::signbit(static_cast<typename std::__promote<_A1>::type>(__lcpp_x)); } template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if< std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type signbit(_A1 __lcpp_x) noexcept { return __lcpp_x < 0; } template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if< std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type signbit(_A1) noexcept { return false; } template <typename _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type fpclassify(_A1 __lcpp_x) noexcept { return ::fpclassify(static_cast<typename std::__promote<_A1>::type>(__lcpp_x)); } template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, int>::type fpclassify(_A1 __lcpp_x) noexcept { return __lcpp_x == 0 ? 0 : (-1); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) float abs(float __lcpp_x) noexcept { return ::fabsf(__lcpp_x); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) double abs(double __lcpp_x) noexcept { return ::fabs(__lcpp_x); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double abs(long double __lcpp_x) noexcept { return ::fabsl(__lcpp_x); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) float acos(float __lcpp_x) noexcept {return ::acosf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double acos(long double __lcpp_x) noexcept {return ::acosl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type acos(_A1 __lcpp_x) noexcept {return ::acos((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float asin(float __lcpp_x) noexcept {return ::asinf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double asin(long double __lcpp_x) noexcept {return ::asinl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type asin(_A1 __lcpp_x) noexcept {return ::asin((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float atan(float __lcpp_x) noexcept {return ::atanf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double atan(long double __lcpp_x) noexcept {return ::atanl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type atan(_A1 __lcpp_x) noexcept {return ::atan((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float atan2(float __lcpp_y, float __lcpp_x) noexcept {return ::atan2f(__lcpp_y, __lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double atan2(long double __lcpp_y, long double __lcpp_x) noexcept {return ::atan2l(__lcpp_y, __lcpp_x);} template <class _A1, class _A2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::_EnableIf < std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, std::__promote<_A1, _A2> >::type atan2(_A1 __lcpp_y, _A2 __lcpp_x) noexcept { typedef typename std::__promote<_A1, _A2>::type __result_type; static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), ""); return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) float ceil(float __lcpp_x) noexcept {return ::ceilf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double ceil(long double __lcpp_x) noexcept {return ::ceill(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type ceil(_A1 __lcpp_x) noexcept {return ::ceil((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float cos(float __lcpp_x) noexcept {return ::cosf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double cos(long double __lcpp_x) noexcept {return ::cosl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type cos(_A1 __lcpp_x) noexcept {return ::cos((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float cosh(float __lcpp_x) noexcept {return ::coshf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double cosh(long double __lcpp_x) noexcept {return ::coshl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type cosh(_A1 __lcpp_x) noexcept {return ::cosh((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float exp(float __lcpp_x) noexcept {return ::expf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double exp(long double __lcpp_x) noexcept {return ::expl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type exp(_A1 __lcpp_x) noexcept {return ::exp((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float fabs(float __lcpp_x) noexcept {return ::fabsf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double fabs(long double __lcpp_x) noexcept {return ::fabsl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type fabs(_A1 __lcpp_x) noexcept {return ::fabs((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float floor(float __lcpp_x) noexcept {return ::floorf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double floor(long double __lcpp_x) noexcept {return ::floorl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type floor(_A1 __lcpp_x) noexcept {return ::floor((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float fmod(float __lcpp_x, float __lcpp_y) noexcept {return ::fmodf(__lcpp_x, __lcpp_y);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double fmod(long double __lcpp_x, long double __lcpp_y) noexcept {return ::fmodl(__lcpp_x, __lcpp_y);} template <class _A1, class _A2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::_EnableIf < std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, std::__promote<_A1, _A2> >::type fmod(_A1 __lcpp_x, _A2 __lcpp_y) noexcept { typedef typename std::__promote<_A1, _A2>::type __result_type; static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), ""); return ::fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) float frexp(float __lcpp_x, int* __lcpp_e) noexcept {return ::frexpf(__lcpp_x, __lcpp_e);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double frexp(long double __lcpp_x, int* __lcpp_e) noexcept {return ::frexpl(__lcpp_x, __lcpp_e);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type frexp(_A1 __lcpp_x, int* __lcpp_e) noexcept {return ::frexp((double)__lcpp_x, __lcpp_e);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float ldexp(float __lcpp_x, int __lcpp_e) noexcept {return ::ldexpf(__lcpp_x, __lcpp_e);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double ldexp(long double __lcpp_x, int __lcpp_e) noexcept {return ::ldexpl(__lcpp_x, __lcpp_e);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type ldexp(_A1 __lcpp_x, int __lcpp_e) noexcept {return ::ldexp((double)__lcpp_x, __lcpp_e);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float log(float __lcpp_x) noexcept {return ::logf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double log(long double __lcpp_x) noexcept {return ::logl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type log(_A1 __lcpp_x) noexcept {return ::log((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float log10(float __lcpp_x) noexcept {return ::log10f(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double log10(long double __lcpp_x) noexcept {return ::log10l(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type log10(_A1 __lcpp_x) noexcept {return ::log10((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float modf(float __lcpp_x, float* __lcpp_y) noexcept {return ::modff(__lcpp_x, __lcpp_y);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double modf(long double __lcpp_x, long double* __lcpp_y) noexcept {return ::modfl(__lcpp_x, __lcpp_y);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float pow(float __lcpp_x, float __lcpp_y) noexcept {return ::powf(__lcpp_x, __lcpp_y);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double pow(long double __lcpp_x, long double __lcpp_y) noexcept {return ::powl(__lcpp_x, __lcpp_y);} template <class _A1, class _A2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::_EnableIf < std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, std::__promote<_A1, _A2> >::type pow(_A1 __lcpp_x, _A2 __lcpp_y) noexcept { typedef typename std::__promote<_A1, _A2>::type __result_type; static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), ""); return ::pow((__result_type)__lcpp_x, (__result_type)__lcpp_y); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) float sin(float __lcpp_x) noexcept {return ::sinf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double sin(long double __lcpp_x) noexcept {return ::sinl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type sin(_A1 __lcpp_x) noexcept {return ::sin((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float sinh(float __lcpp_x) noexcept {return ::sinhf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double sinh(long double __lcpp_x) noexcept {return ::sinhl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type sinh(_A1 __lcpp_x) noexcept {return ::sinh((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float sqrt(float __lcpp_x) noexcept {return ::sqrtf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double sqrt(long double __lcpp_x) noexcept {return ::sqrtl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type sqrt(_A1 __lcpp_x) noexcept {return ::sqrt((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float tan(float __lcpp_x) noexcept {return ::tanf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double tan(long double __lcpp_x) noexcept {return ::tanl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type tan(_A1 __lcpp_x) noexcept {return ::tan((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float tanh(float __lcpp_x) noexcept {return ::tanhf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double tanh(long double __lcpp_x) noexcept {return ::tanhl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type tanh(_A1 __lcpp_x) noexcept {return ::tanh((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float acosh(float __lcpp_x) noexcept {return ::acoshf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double acosh(long double __lcpp_x) noexcept {return ::acoshl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type acosh(_A1 __lcpp_x) noexcept {return ::acosh((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float asinh(float __lcpp_x) noexcept {return ::asinhf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double asinh(long double __lcpp_x) noexcept {return ::asinhl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type asinh(_A1 __lcpp_x) noexcept {return ::asinh((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float atanh(float __lcpp_x) noexcept {return ::atanhf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double atanh(long double __lcpp_x) noexcept {return ::atanhl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type atanh(_A1 __lcpp_x) noexcept {return ::atanh((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float cbrt(float __lcpp_x) noexcept {return ::cbrtf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double cbrt(long double __lcpp_x) noexcept {return ::cbrtl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type cbrt(_A1 __lcpp_x) noexcept {return ::cbrt((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float copysign(float __lcpp_x, float __lcpp_y) noexcept { return ::copysignf(__lcpp_x, __lcpp_y); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double copysign(long double __lcpp_x, long double __lcpp_y) noexcept { return ::copysignl(__lcpp_x, __lcpp_y); } template <class _A1, class _A2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::_EnableIf < std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, std::__promote<_A1, _A2> >::type copysign(_A1 __lcpp_x, _A2 __lcpp_y) noexcept { typedef typename std::__promote<_A1, _A2>::type __result_type; static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), ""); return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) float erf(float __lcpp_x) noexcept {return ::erff(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double erf(long double __lcpp_x) noexcept {return ::erfl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type erf(_A1 __lcpp_x) noexcept {return ::erf((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float erfc(float __lcpp_x) noexcept {return ::erfcf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double erfc(long double __lcpp_x) noexcept {return ::erfcl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type erfc(_A1 __lcpp_x) noexcept {return ::erfc((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float exp2(float __lcpp_x) noexcept {return ::exp2f(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double exp2(long double __lcpp_x) noexcept {return ::exp2l(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type exp2(_A1 __lcpp_x) noexcept {return ::exp2((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float expm1(float __lcpp_x) noexcept {return ::expm1f(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double expm1(long double __lcpp_x) noexcept {return ::expm1l(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type expm1(_A1 __lcpp_x) noexcept {return ::expm1((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float fdim(float __lcpp_x, float __lcpp_y) noexcept {return ::fdimf(__lcpp_x, __lcpp_y);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double fdim(long double __lcpp_x, long double __lcpp_y) noexcept {return ::fdiml(__lcpp_x, __lcpp_y);} template <class _A1, class _A2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::_EnableIf < std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, std::__promote<_A1, _A2> >::type fdim(_A1 __lcpp_x, _A2 __lcpp_y) noexcept { typedef typename std::__promote<_A1, _A2>::type __result_type; static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), ""); return ::fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) noexcept {return ::fmaf(__lcpp_x, __lcpp_y, __lcpp_z);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double fma(long double __lcpp_x, long double __lcpp_y, long double __lcpp_z) noexcept {return ::fmal(__lcpp_x, __lcpp_y, __lcpp_z);} template <class _A1, class _A2, class _A3> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::_EnableIf < std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value && std::is_arithmetic<_A3>::value, std::__promote<_A1, _A2, _A3> >::type fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) noexcept { typedef typename std::__promote<_A1, _A2, _A3>::type __result_type; static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value && std::_IsSame<_A3, __result_type>::value)), ""); return ::fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) float fmax(float __lcpp_x, float __lcpp_y) noexcept {return ::fmaxf(__lcpp_x, __lcpp_y);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double fmax(long double __lcpp_x, long double __lcpp_y) noexcept {return ::fmaxl(__lcpp_x, __lcpp_y);} template <class _A1, class _A2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::_EnableIf < std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, std::__promote<_A1, _A2> >::type fmax(_A1 __lcpp_x, _A2 __lcpp_y) noexcept { typedef typename std::__promote<_A1, _A2>::type __result_type; static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), ""); return ::fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) float fmin(float __lcpp_x, float __lcpp_y) noexcept {return ::fminf(__lcpp_x, __lcpp_y);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double fmin(long double __lcpp_x, long double __lcpp_y) noexcept {return ::fminl(__lcpp_x, __lcpp_y);} template <class _A1, class _A2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::_EnableIf < std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, std::__promote<_A1, _A2> >::type fmin(_A1 __lcpp_x, _A2 __lcpp_y) noexcept { typedef typename std::__promote<_A1, _A2>::type __result_type; static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), ""); return ::fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) float hypot(float __lcpp_x, float __lcpp_y) noexcept {return ::hypotf(__lcpp_x, __lcpp_y);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double hypot(long double __lcpp_x, long double __lcpp_y) noexcept {return ::hypotl(__lcpp_x, __lcpp_y);} template <class _A1, class _A2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::_EnableIf < std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, std::__promote<_A1, _A2> >::type hypot(_A1 __lcpp_x, _A2 __lcpp_y) noexcept { typedef typename std::__promote<_A1, _A2>::type __result_type; static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), ""); return ::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) int ilogb(float __lcpp_x) noexcept {return ::ilogbf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) int ilogb(long double __lcpp_x) noexcept {return ::ilogbl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, int>::type ilogb(_A1 __lcpp_x) noexcept {return ::ilogb((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float lgamma(float __lcpp_x) noexcept {return ::lgammaf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double lgamma(long double __lcpp_x) noexcept {return ::lgammal(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type lgamma(_A1 __lcpp_x) noexcept {return ::lgamma((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long long llrint(float __lcpp_x) noexcept {return ::llrintf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long long llrint(long double __lcpp_x) noexcept {return ::llrintl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, long long>::type llrint(_A1 __lcpp_x) noexcept {return ::llrint((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long long llround(float __lcpp_x) noexcept {return ::llroundf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long long llround(long double __lcpp_x) noexcept {return ::llroundl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, long long>::type llround(_A1 __lcpp_x) noexcept {return ::llround((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float log1p(float __lcpp_x) noexcept {return ::log1pf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double log1p(long double __lcpp_x) noexcept {return ::log1pl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type log1p(_A1 __lcpp_x) noexcept {return ::log1p((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float log2(float __lcpp_x) noexcept {return ::log2f(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double log2(long double __lcpp_x) noexcept {return ::log2l(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type log2(_A1 __lcpp_x) noexcept {return ::log2((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float logb(float __lcpp_x) noexcept {return ::logbf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double logb(long double __lcpp_x) noexcept {return ::logbl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type logb(_A1 __lcpp_x) noexcept {return ::logb((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long lrint(float __lcpp_x) noexcept {return ::lrintf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long lrint(long double __lcpp_x) noexcept {return ::lrintl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, long>::type lrint(_A1 __lcpp_x) noexcept {return ::lrint((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long lround(float __lcpp_x) noexcept {return ::lroundf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long lround(long double __lcpp_x) noexcept {return ::lroundl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, long>::type lround(_A1 __lcpp_x) noexcept {return ::lround((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float nearbyint(float __lcpp_x) noexcept {return ::nearbyintf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double nearbyint(long double __lcpp_x) noexcept {return ::nearbyintl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type nearbyint(_A1 __lcpp_x) noexcept {return ::nearbyint((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float nextafter(float __lcpp_x, float __lcpp_y) noexcept {return ::nextafterf(__lcpp_x, __lcpp_y);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double nextafter(long double __lcpp_x, long double __lcpp_y) noexcept {return ::nextafterl(__lcpp_x, __lcpp_y);} template <class _A1, class _A2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::_EnableIf < std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, std::__promote<_A1, _A2> >::type nextafter(_A1 __lcpp_x, _A2 __lcpp_y) noexcept { typedef typename std::__promote<_A1, _A2>::type __result_type; static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), ""); return ::nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) float nexttoward(float __lcpp_x, long double __lcpp_y) noexcept {return ::nexttowardf(__lcpp_x, __lcpp_y);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double nexttoward(long double __lcpp_x, long double __lcpp_y) noexcept {return ::nexttowardl(__lcpp_x, __lcpp_y);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type nexttoward(_A1 __lcpp_x, long double __lcpp_y) noexcept {return ::nexttoward((double)__lcpp_x, __lcpp_y);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float remainder(float __lcpp_x, float __lcpp_y) noexcept {return ::remainderf(__lcpp_x, __lcpp_y);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double remainder(long double __lcpp_x, long double __lcpp_y) noexcept {return ::remainderl(__lcpp_x, __lcpp_y);} template <class _A1, class _A2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::_EnableIf < std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, std::__promote<_A1, _A2> >::type remainder(_A1 __lcpp_x, _A2 __lcpp_y) noexcept { typedef typename std::__promote<_A1, _A2>::type __result_type; static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), ""); return ::remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) noexcept {return ::remquof(__lcpp_x, __lcpp_y, __lcpp_z);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double remquo(long double __lcpp_x, long double __lcpp_y, int* __lcpp_z) noexcept {return ::remquol(__lcpp_x, __lcpp_y, __lcpp_z);} template <class _A1, class _A2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::_EnableIf < std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, std::__promote<_A1, _A2> >::type remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) noexcept { typedef typename std::__promote<_A1, _A2>::type __result_type; static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), ""); return ::remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) float rint(float __lcpp_x) noexcept {return ::rintf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double rint(long double __lcpp_x) noexcept {return ::rintl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type rint(_A1 __lcpp_x) noexcept {return ::rint((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float round(float __lcpp_x) noexcept {return ::roundf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double round(long double __lcpp_x) noexcept {return ::roundl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type round(_A1 __lcpp_x) noexcept {return ::round((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float scalbln(float __lcpp_x, long __lcpp_y) noexcept {return ::scalblnf(__lcpp_x, __lcpp_y);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double scalbln(long double __lcpp_x, long __lcpp_y) noexcept {return ::scalblnl(__lcpp_x, __lcpp_y);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type scalbln(_A1 __lcpp_x, long __lcpp_y) noexcept {return ::scalbln((double)__lcpp_x, __lcpp_y);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float scalbn(float __lcpp_x, int __lcpp_y) noexcept {return ::scalbnf(__lcpp_x, __lcpp_y);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double scalbn(long double __lcpp_x, int __lcpp_y) noexcept {return ::scalbnl(__lcpp_x, __lcpp_y);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type scalbn(_A1 __lcpp_x, int __lcpp_y) noexcept {return ::scalbn((double)__lcpp_x, __lcpp_y);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float tgamma(float __lcpp_x) noexcept {return ::tgammaf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double tgamma(long double __lcpp_x) noexcept {return ::tgammal(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type tgamma(_A1 __lcpp_x) noexcept {return ::tgamma((double)__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) float trunc(float __lcpp_x) noexcept {return ::truncf(__lcpp_x);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double trunc(long double __lcpp_x) noexcept {return ::truncl(__lcpp_x);} template <class _A1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::enable_if<std::is_integral<_A1>::value, double>::type trunc(_A1 __lcpp_x) noexcept {return ::trunc((double)__lcpp_x);} } #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 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; } #pragma warning(suppress: 4996) 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; } }; #pragma warning(suppress: 4996) memmove(_Destination, _Source, _SourceSize); return 0; } } #pragma pack(pop) #pragma pack(push, 8) extern "C" { int __cdecl _memicmp( void const* _Buf1, void const* _Buf2, size_t _Size ); 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.")) 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.")) 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 pack(push, 8) extern "C" { typedef int sig_atomic_t; typedef void (__cdecl* _crt_signal_t)(int); void** __cdecl __pxcptinfoptrs(void); _crt_signal_t __cdecl signal( int _Signal, _crt_signal_t _Function); int __cdecl raise( int _Signal); } #pragma pack(pop) typedef __builtin_va_list va_list; typedef __builtin_va_list __gnuc_va_list; #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 pack(push, 8) extern "C" { typedef struct _iobuf { void* _Placeholder; } FILE; FILE* __cdecl __acrt_iob_func(unsigned _Ix); wint_t __cdecl fgetwc( FILE* _Stream ); wint_t __cdecl _fgetwchar(void); wint_t __cdecl fputwc( wchar_t _Character, FILE* _Stream); wint_t __cdecl _fputwchar( wchar_t _Character ); wint_t __cdecl getwc( FILE* _Stream ); wint_t __cdecl getwchar(void); wchar_t* __cdecl fgetws( wchar_t* _Buffer, int _BufferCount, FILE* _Stream ); int __cdecl fputws( wchar_t const* _Buffer, FILE* _Stream ); 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); } } wint_t __cdecl putwc( wchar_t _Character, FILE* _Stream ); wint_t __cdecl putwchar( wchar_t _Character ); int __cdecl _putws( wchar_t const* _Buffer ); wint_t __cdecl ungetwc( wint_t _Character, FILE* _Stream ); FILE * __cdecl _wfdopen( int _FileHandle, wchar_t const* _Mode ); FILE* __cdecl _wfopen( wchar_t const* _FileName, wchar_t const* _Mode ); errno_t __cdecl _wfopen_s( FILE** _Stream, wchar_t const* _FileName, wchar_t const* _Mode ); FILE* __cdecl _wfreopen( wchar_t const* _FileName, wchar_t const* _Mode, FILE* _OldStream ); errno_t __cdecl _wfreopen_s( FILE** _Stream, wchar_t const* _FileName, wchar_t const* _Mode, FILE* _OldStream ); FILE* __cdecl _wfsopen( wchar_t const* _FileName, wchar_t const* _Mode, int _ShFlag ); void __cdecl _wperror( wchar_t const* _ErrorMessage ); FILE* __cdecl _wpopen( wchar_t const* _Command, wchar_t const* _Mode ); int __cdecl _wremove( wchar_t const* _FileName ); __declspec(allocator) wchar_t* __cdecl _wtempnam( wchar_t const* _Directory, wchar_t const* _FilePrefix ); 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); } } wchar_t* __cdecl _wtmpnam( wchar_t *_Buffer); wint_t __cdecl _fgetwc_nolock( FILE* _Stream ); wint_t __cdecl _fputwc_nolock( wchar_t _Character, FILE* _Stream ); wint_t __cdecl _getwc_nolock( FILE* _Stream ); wint_t __cdecl _putwc_nolock( wchar_t _Character, FILE* _Stream ); wint_t __cdecl _ungetwc_nolock( wint_t _Character, FILE* _Stream ); int __cdecl __stdio_common_vfwprintf( unsigned __int64 _Options, FILE* _Stream, wchar_t const* _Format, _locale_t _Locale, va_list _ArgList ); int __cdecl __stdio_common_vfwprintf_s( unsigned __int64 _Options, FILE* _Stream, wchar_t const* _Format, _locale_t _Locale, va_list _ArgList ); 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; __builtin_va_start(_ArgList, _Locale); _Result = _vfwprintf_l(_Stream, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl fwprintf( FILE* const _Stream, wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vfwprintf_l(_Stream, _Format, 0, _ArgList); __builtin_va_end(_ArgList); 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; __builtin_va_start(_ArgList, _Locale); _Result = _vfwprintf_s_l(_Stream, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl fwprintf_s( FILE* const _Stream, wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vfwprintf_s_l(_Stream, _Format, 0, _ArgList); __builtin_va_end(_ArgList); 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; __builtin_va_start(_ArgList, _Locale); _Result = _vfwprintf_p_l(_Stream, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _fwprintf_p( FILE* const _Stream, wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vfwprintf_p_l(_Stream, _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _wprintf_l( wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); _Result = _vfwprintf_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl wprintf( wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vfwprintf_l((__acrt_iob_func(1)), _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _wprintf_s_l( wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); _Result = _vfwprintf_s_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl wprintf_s( wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vfwprintf_s_l((__acrt_iob_func(1)), _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _wprintf_p_l( wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); _Result = _vfwprintf_p_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _wprintf_p( wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vfwprintf_p_l((__acrt_iob_func(1)), _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } 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); } __inline int __cdecl _fwscanf_l( FILE* const _Stream, wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); _Result = _vfwscanf_l(_Stream, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl fwscanf( FILE* const _Stream, wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vfwscanf_l(_Stream, _Format, 0, _ArgList); __builtin_va_end(_ArgList); 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; __builtin_va_start(_ArgList, _Locale); _Result = _vfwscanf_s_l(_Stream, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl fwscanf_s( FILE* const _Stream, wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vfwscanf_s_l(_Stream, _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _wscanf_l( wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); _Result = _vfwscanf_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl wscanf( wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vfwscanf_l((__acrt_iob_func(0)), _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _wscanf_s_l( wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); _Result = _vfwscanf_s_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl wscanf_s( wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vfwscanf_s_l((__acrt_iob_func(0)), _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } int __cdecl __stdio_common_vswprintf( unsigned __int64 _Options, wchar_t* _Buffer, size_t _BufferCount, wchar_t const* _Format, _locale_t _Locale, va_list _ArgList ); 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 ); 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 ); 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 ); __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; } #pragma warning(push) #pragma warning(disable: 4793) __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); } __inline int __cdecl _snwprintf( wchar_t *_Buffer, size_t _BufferCount, wchar_t const* _Format, ...); __inline int __cdecl _vsnwprintf( wchar_t *_Buffer, size_t _BufferCount, wchar_t const* _Format, va_list _Args); #pragma warning(pop) __inline int __cdecl _vsnwprintf( wchar_t* _Buffer, size_t _BufferCount, wchar_t const* _Format, va_list _ArgList ) { #pragma warning(push) #pragma warning(disable: 4996) return _vsnwprintf_l(_Buffer, _BufferCount, _Format, 0, _ArgList); #pragma warning(pop) } 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 ) { #pragma warning(push) #pragma warning(disable: 4996) return _vswprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList); #pragma warning(pop) } __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; __builtin_va_start(_ArgList, _Locale); _Result = __vswprintf_l(_Buffer, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); 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; __builtin_va_start(_ArgList, _Locale); _Result = _vswprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _swprintf( wchar_t* const _Buffer, wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = __vswprintf_l(_Buffer, _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl swprintf( wchar_t* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vswprintf_c_l(_Buffer, _BufferCount, _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } #pragma warning(push) #pragma warning(disable: 4793 4996) __inline int __cdecl __swprintf_l( wchar_t *_Buffer, wchar_t const* _Format, _locale_t _Locale, ...); __inline int __cdecl __vswprintf_l( wchar_t *_Buffer, wchar_t const* _Format, _locale_t _Locale, va_list _Args); __inline int __cdecl _swprintf( wchar_t *_Buffer, wchar_t const* _Format, ...); __inline int __cdecl _vswprintf( wchar_t *_Buffer, wchar_t const* _Format, va_list _Args); #pragma warning(pop) __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; __builtin_va_start(_ArgList, _Locale); _Result = _vswprintf_s_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); 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; __builtin_va_start(_ArgList, _Format); _Result = _vswprintf_s_l(_Buffer, _BufferCount, _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } extern "C++" { #pragma warning(push) ; #pragma warning(disable: 4793) ; template <size_t _Size> inline int __cdecl swprintf_s(wchar_t (&_Buffer)[_Size], wchar_t const* _Format, ...) throw() { va_list _ArgList; __builtin_va_start(_ArgList, _Format); return vswprintf_s(_Buffer, _Size, _Format, _ArgList); } #pragma warning(pop) ; } __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; __builtin_va_start(_ArgList, _Locale); _Result = _vswprintf_p_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); 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; __builtin_va_start(_ArgList, _Format); _Result = _vswprintf_p_l(_Buffer, _BufferCount, _Format, 0, _ArgList); __builtin_va_end(_ArgList); 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; __builtin_va_start(_ArgList, _Locale); _Result = _vswprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); 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; __builtin_va_start(_ArgList, _Format); _Result = _vswprintf_c_l(_Buffer, _BufferCount, _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } __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; __builtin_va_start(_ArgList, _Locale); #pragma warning(push) #pragma warning(disable: 4996) _Result = _vsnwprintf_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList); #pragma warning(pop) __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _snwprintf( wchar_t* _Buffer, size_t _BufferCount, wchar_t const* _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); #pragma warning(push) #pragma warning(disable: 4996) _Result = _vsnwprintf_l(_Buffer, _BufferCount, _Format, 0, _ArgList); #pragma warning(pop) __builtin_va_end(_ArgList); 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; __builtin_va_start(_ArgList, _Locale); _Result = _vsnwprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); 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; __builtin_va_start(_ArgList, _Format); _Result = _vsnwprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } extern "C++" { #pragma warning(push) ; #pragma warning(disable: 4793) ; template <size_t _Size> inline int __cdecl _snwprintf_s(wchar_t (&_Buffer)[_Size], size_t _BufferCount, wchar_t const* _Format, ...) throw() { va_list _ArgList; __builtin_va_start(_ArgList, _Format); return _vsnwprintf_s(_Buffer, _Size, _BufferCount, _Format, _ArgList); } #pragma warning(pop) ; } __inline int __cdecl _scwprintf_l( wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); _Result = _vscwprintf_l(_Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _scwprintf( wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vscwprintf_l(_Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _scwprintf_p_l( wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); _Result = _vscwprintf_p_l(_Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _scwprintf_p( wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vscwprintf_p_l(_Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } #pragma warning(push) #pragma warning(disable: 4141 4412 4793 4996 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.")) inline int swprintf( wchar_t* const _Buffer, wchar_t const* const _Format, ...) throw() { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); #pragma warning(suppress: 28719) _Result = vswprintf(_Buffer, 2147483647, _Format, _ArgList); __builtin_va_end(_ArgList); 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.")) inline int __cdecl vswprintf( wchar_t* const _Buffer, wchar_t const* const _Format, va_list _ArgList ) throw() { #pragma warning(suppress: 28719) 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.")) inline int _swprintf_l( wchar_t* const _Buffer, wchar_t const* const _Format, _locale_t const _Locale, ...) throw() { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); _Result = _vswprintf_l(_Buffer, (size_t)-1, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); 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.")) 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) 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); } } __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); } __inline int __cdecl _swscanf_l( wchar_t const* const _Buffer, wchar_t const* const _Format, _locale_t _Locale, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); _Result = _vswscanf_l(_Buffer, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl swscanf( wchar_t const* const _Buffer, wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vswscanf_l(_Buffer, _Format, 0, _ArgList); __builtin_va_end(_ArgList); 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; __builtin_va_start(_ArgList, _Locale); _Result = _vswscanf_s_l(_Buffer, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl swscanf_s( wchar_t const* const _Buffer, wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vswscanf_s_l(_Buffer, _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } __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; __builtin_va_start(_ArgList, _Locale); #pragma warning(push) #pragma warning(disable: 4996) _Result = _vsnwscanf_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList); #pragma warning(pop) __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _snwscanf( wchar_t const* const _Buffer, size_t const _BufferCount, wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); #pragma warning(push) #pragma warning(disable: 4996) _Result = _vsnwscanf_l(_Buffer, _BufferCount, _Format, 0, _ArgList); #pragma warning(pop) __builtin_va_end(_ArgList); 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; __builtin_va_start(_ArgList, _Locale); _Result = _vsnwscanf_s_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); 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; __builtin_va_start(_ArgList, _Format); _Result = _vsnwscanf_s_l(_Buffer, _BufferCount, _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } } #pragma pack(pop) #pragma pack(push, 8) extern "C" { typedef __int64 fpos_t; errno_t __cdecl _get_stream_buffer_pointers( FILE* _Stream, char*** _Base, char*** _Pointer, int** _Count ); errno_t __cdecl clearerr_s( FILE* _Stream ); errno_t __cdecl fopen_s( FILE** _Stream, char const* _FileName, char const* _Mode ); size_t __cdecl fread_s( void* _Buffer, size_t _BufferSize, size_t _ElementSize, size_t _ElementCount, FILE* _Stream ); errno_t __cdecl freopen_s( FILE** _Stream, char const* _FileName, char const* _Mode, FILE* _OldStream ); char* __cdecl gets_s( char* _Buffer, rsize_t _Size ); errno_t __cdecl tmpfile_s( FILE** _Stream ); errno_t __cdecl tmpnam_s( char* _Buffer, rsize_t _Size ); void __cdecl clearerr( FILE* _Stream ); int __cdecl fclose( FILE* _Stream ); int __cdecl _fcloseall(void); FILE* __cdecl _fdopen( int _FileHandle, char const* _Mode ); int __cdecl feof( FILE* _Stream ); int __cdecl ferror( FILE* _Stream ); int __cdecl fflush( FILE* _Stream ); int __cdecl fgetc( FILE* _Stream ); int __cdecl _fgetchar(void); int __cdecl fgetpos( FILE* _Stream, fpos_t* _Position ); char* __cdecl fgets( char* _Buffer, int _MaxCount, FILE* _Stream ); int __cdecl _fileno( FILE* _Stream ); int __cdecl _flushall(void); FILE* __cdecl fopen( char const* _FileName, char const* _Mode ); int __cdecl fputc( int _Character, FILE* _Stream ); int __cdecl _fputchar( int _Character ); int __cdecl fputs( char const* _Buffer, FILE* _Stream ); size_t __cdecl fread( void* _Buffer, size_t _ElementSize, size_t _ElementCount, FILE* _Stream ); FILE* __cdecl freopen( char const* _FileName, char const* _Mode, FILE* _Stream ); FILE* __cdecl _fsopen( char const* _FileName, char const* _Mode, int _ShFlag ); int __cdecl fsetpos( FILE* _Stream, fpos_t const* _Position ); int __cdecl fseek( FILE* _Stream, long _Offset, int _Origin ); int __cdecl _fseeki64( FILE* _Stream, __int64 _Offset, int _Origin ); long __cdecl ftell( FILE* _Stream ); __int64 __cdecl _ftelli64( FILE* _Stream ); size_t __cdecl fwrite( void const* _Buffer, size_t _ElementSize, size_t _ElementCount, FILE* _Stream ); int __cdecl getc( FILE* _Stream ); int __cdecl getchar(void); int __cdecl _getmaxstdio(void); extern "C++" { template <size_t _Size> inline char* __cdecl gets_s(char (&_Buffer)[_Size]) throw() { return gets_s(_Buffer, _Size); } } int __cdecl _getw( FILE* _Stream ); void __cdecl perror( char const* _ErrorMessage ); int __cdecl _pclose( FILE* _Stream ); FILE* __cdecl _popen( char const* _Command, char const* _Mode ); int __cdecl putc( int _Character, FILE* _Stream ); int __cdecl putchar( int _Character ); int __cdecl puts( char const* _Buffer ); int __cdecl _putw( int _Word, FILE* _Stream ); int __cdecl remove( char const* _FileName ); int __cdecl rename( char const* _OldFileName, char const* _NewFileName ); 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.")) int __cdecl unlink( char const* _FileName ); void __cdecl rewind( FILE* _Stream ); int __cdecl _rmtmp(void); void __cdecl setbuf( FILE* _Stream, char* _Buffer ); int __cdecl _setmaxstdio( int _Maximum ); int __cdecl setvbuf( FILE* _Stream, char* _Buffer, int _Mode, size_t _Size ); __declspec(allocator) char* __cdecl _tempnam( char const* _DirectoryName, char const* _FilePrefix ); 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); } } #pragma warning(push) #pragma warning(disable: 28726) char* __cdecl tmpnam( char *_Buffer); #pragma warning(pop) int __cdecl ungetc( int _Character, FILE* _Stream ); void __cdecl _lock_file( FILE* _Stream ); void __cdecl _unlock_file( FILE* _Stream ); int __cdecl _fclose_nolock( FILE* _Stream ); int __cdecl _fflush_nolock( FILE* _Stream ); int __cdecl _fgetc_nolock( FILE* _Stream ); int __cdecl _fputc_nolock( int _Character, FILE* _Stream ); size_t __cdecl _fread_nolock( void* _Buffer, size_t _ElementSize, size_t _ElementCount, FILE* _Stream ); size_t __cdecl _fread_nolock_s( void* _Buffer, size_t _BufferSize, size_t _ElementSize, size_t _ElementCount, FILE* _Stream ); int __cdecl _fseek_nolock( FILE* _Stream, long _Offset, int _Origin ); int __cdecl _fseeki64_nolock( FILE* _Stream, __int64 _Offset, int _Origin ); long __cdecl _ftell_nolock( FILE* _Stream ); __int64 __cdecl _ftelli64_nolock( FILE* _Stream ); size_t __cdecl _fwrite_nolock( void const* _Buffer, size_t _ElementSize, size_t _ElementCount, FILE* _Stream ); int __cdecl _getc_nolock( FILE* _Stream ); int __cdecl _putc_nolock( int _Character, FILE* _Stream ); int __cdecl _ungetc_nolock( int _Character, FILE* _Stream ); int* __cdecl __p__commode(void); int __cdecl __stdio_common_vfprintf( unsigned __int64 _Options, FILE* _Stream, char const* _Format, _locale_t _Locale, va_list _ArgList ); int __cdecl __stdio_common_vfprintf_s( unsigned __int64 _Options, FILE* _Stream, char const* _Format, _locale_t _Locale, va_list _ArgList ); 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; __builtin_va_start(_ArgList, _Locale); _Result = _vfprintf_l(_Stream, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl fprintf( FILE* const _Stream, char const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vfprintf_l(_Stream, _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } int __cdecl _set_printf_count_output( int _Value ); 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; __builtin_va_start(_ArgList, _Locale); _Result = _vfprintf_s_l(_Stream, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl fprintf_s( FILE* const _Stream, char const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vfprintf_s_l(_Stream, _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _fprintf_p_l( FILE* const _Stream, char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); _Result = _vfprintf_p_l(_Stream, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _fprintf_p( FILE* const _Stream, char const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vfprintf_p_l(_Stream, _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _printf_l( char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); _Result = _vfprintf_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl printf( char const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vfprintf_l((__acrt_iob_func(1)), _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _printf_s_l( char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); _Result = _vfprintf_s_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl printf_s( char const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vfprintf_s_l((__acrt_iob_func(1)), _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _printf_p_l( char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); _Result = _vfprintf_p_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _printf_p( char const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vfprintf_p_l((__acrt_iob_func(1)), _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } 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); } __inline int __cdecl _fscanf_l( FILE* const _Stream, char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); _Result = _vfscanf_l(_Stream, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl fscanf( FILE* const _Stream, char const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vfscanf_l(_Stream, _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _fscanf_s_l( FILE* const _Stream, char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); _Result = _vfscanf_s_l(_Stream, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl fscanf_s( FILE* const _Stream, char const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vfscanf_s_l(_Stream, _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _scanf_l( char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); _Result = _vfscanf_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl scanf( char const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vfscanf_l((__acrt_iob_func(0)), _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _scanf_s_l( char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); _Result = _vfscanf_s_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl scanf_s( char const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vfscanf_s_l((__acrt_iob_func(0)), _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } int __cdecl __stdio_common_vsprintf( unsigned __int64 _Options, char* _Buffer, size_t _BufferCount, char const* _Format, _locale_t _Locale, va_list _ArgList ); int __cdecl __stdio_common_vsprintf_s( unsigned __int64 _Options, char* _Buffer, size_t _BufferCount, char const* _Format, _locale_t _Locale, va_list _ArgList ); 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 ); int __cdecl __stdio_common_vsprintf_p( unsigned __int64 _Options, char* _Buffer, size_t _BufferCount, char const* _Format, _locale_t _Locale, va_list _ArgList ); __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 ) { #pragma warning(push) #pragma warning(disable: 4996) return _vsnprintf_l(_Buffer, _BufferCount, _Format, 0, _ArgList); #pragma warning(pop) } __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; } __inline int __cdecl _vsprintf_l( char* const _Buffer, char const* const _Format, _locale_t const _Locale, va_list _ArgList ) { #pragma warning(push) #pragma warning(disable: 4996) return _vsnprintf_l(_Buffer, (size_t)-1, _Format, _Locale, _ArgList); #pragma warning(pop) } __inline int __cdecl vsprintf( char* const _Buffer, char const* const _Format, va_list _ArgList ) { #pragma warning(push) #pragma warning(disable: 4996) return _vsnprintf_l(_Buffer, (size_t)-1, _Format, 0, _ArgList); #pragma warning(pop) } __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); } __inline int __cdecl _sprintf_l( char* const _Buffer, char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); #pragma warning(push) #pragma warning(disable: 4996) _Result = _vsprintf_l(_Buffer, _Format, _Locale, _ArgList); #pragma warning(pop) __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl sprintf( char* const _Buffer, char const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); #pragma warning(push) #pragma warning(disable: 4996) _Result = _vsprintf_l(_Buffer, _Format, 0, _ArgList); #pragma warning(pop) __builtin_va_end(_ArgList); return _Result; } #pragma warning(push) #pragma warning(disable: 4996) #pragma warning(disable: 28719) #pragma warning(disable: 28726) int __cdecl sprintf( char *_Buffer, char const* _Format, ...); int __cdecl vsprintf( char *_Buffer, char const* _Format, va_list _Args); #pragma warning(pop) __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; __builtin_va_start(_ArgList, _Locale); _Result = _vsprintf_s_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl sprintf_s( char* const _Buffer, size_t const _BufferCount, char const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vsprintf_s_l(_Buffer, _BufferCount, _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } extern "C++" { #pragma warning(push) ; #pragma warning(disable: 4793) ; template <size_t _Size> inline int __cdecl sprintf_s(char (&_Buffer)[_Size], char const* _Format, ...) throw() { va_list _ArgList; __builtin_va_start(_ArgList, _Format); return vsprintf_s(_Buffer, _Size, _Format, _ArgList); } #pragma warning(pop) ; } __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; __builtin_va_start(_ArgList, _Locale); _Result = _vsprintf_p_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _sprintf_p( char* const _Buffer, size_t const _BufferCount, char const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vsprintf_p_l(_Buffer, _BufferCount, _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } __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; __builtin_va_start(_ArgList, _Locale); #pragma warning(push) #pragma warning(disable: 4996) _Result = _vsnprintf_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList); #pragma warning(pop) __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl snprintf( char* const _Buffer, size_t const _BufferCount, char const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); #pragma warning(suppress: 28719) _Result = vsnprintf(_Buffer, _BufferCount, _Format, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _snprintf( char* const _Buffer, size_t const _BufferCount, char const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); #pragma warning(suppress: 28719) _Result = _vsnprintf(_Buffer, _BufferCount, _Format, _ArgList); __builtin_va_end(_ArgList); return _Result; } int __cdecl _snprintf( char *_Buffer, size_t _BufferCount, char const* _Format, ...); 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; __builtin_va_start(_ArgList, _Locale); _Result = _vsnprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _snprintf_c( char* const _Buffer, size_t const _BufferCount, char const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vsnprintf_c_l(_Buffer, _BufferCount, _Format, 0, _ArgList); __builtin_va_end(_ArgList); 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; __builtin_va_start(_ArgList, _Locale); _Result = _vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); 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; __builtin_va_start(_ArgList, _Format); _Result = _vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } extern "C++" { #pragma warning(push) ; #pragma warning(disable: 4793) ; template <size_t _Size> inline int __cdecl _snprintf_s(char (&_Buffer)[_Size], size_t _BufferCount, char const* _Format, ...) throw() { va_list _ArgList; __builtin_va_start(_ArgList, _Format); return _vsnprintf_s(_Buffer, _Size, _BufferCount, _Format, _ArgList); } #pragma warning(pop) ; } __inline int __cdecl _scprintf_l( char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); _Result = _vscprintf_l(_Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _scprintf( char const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vscprintf_l(_Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _scprintf_p_l( char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); _Result = _vscprintf_p_l(_Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _scprintf_p( char const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vscprintf_p(_Format, _ArgList); __builtin_va_end(_ArgList); return _Result; } 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) __inline int __cdecl _sscanf_l( char const* const _Buffer, char const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); _Result = _vsscanf_l(_Buffer, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl sscanf( char const* const _Buffer, char const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vsscanf_l(_Buffer, _Format, 0, _ArgList); __builtin_va_end(_ArgList); 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; __builtin_va_start(_ArgList, _Locale); _Result = _vsscanf_s_l(_Buffer, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl sscanf_s( char const* const _Buffer, char const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); #pragma warning(push) #pragma warning(disable: 4996) _Result = vsscanf_s(_Buffer, _Format, _ArgList); #pragma warning(pop) __builtin_va_end(_ArgList); return _Result; } #pragma warning(push) #pragma warning(disable: 6530) __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; __builtin_va_start(_ArgList, _Locale); _Result = __stdio_common_vsscanf( (*__local_stdio_scanf_options ()), _Buffer, _BufferCount, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _snscanf( char const* const _Buffer, size_t const _BufferCount, char const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = __stdio_common_vsscanf( (*__local_stdio_scanf_options ()), _Buffer, _BufferCount, _Format, 0, _ArgList); __builtin_va_end(_ArgList); 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; __builtin_va_start(_ArgList, _Locale); _Result = __stdio_common_vsscanf( (*__local_stdio_scanf_options ()) | (1ULL << 0), _Buffer, _BufferCount, _Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _snscanf_s( char const* const _Buffer, size_t const _BufferCount, char const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = __stdio_common_vsscanf( (*__local_stdio_scanf_options ()) | (1ULL << 0), _Buffer, _BufferCount, _Format, 0, _ArgList); __builtin_va_end(_ArgList); 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.")) 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.")) 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.")) 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.")) 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.")) 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.")) 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.")) 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.")) 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.")) 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.")) int __cdecl rmtmp(void); } #pragma pack(pop) #pragma pack(push, 8) extern "C" { errno_t __cdecl wcscat_s( wchar_t* _Destination, rsize_t _SizeInWords, wchar_t const* _Source ); errno_t __cdecl wcscpy_s( wchar_t* _Destination, rsize_t _SizeInWords, wchar_t const* _Source ); errno_t __cdecl wcsncat_s( wchar_t* _Destination, rsize_t _SizeInWords, wchar_t const* _Source, rsize_t _MaxCount ); errno_t __cdecl wcsncpy_s( wchar_t* _Destination, rsize_t _SizeInWords, wchar_t const* _Source, rsize_t _MaxCount ); wchar_t* __cdecl wcstok_s( wchar_t* _String, wchar_t const* _Delimiter, wchar_t** _Context ); __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); } } #pragma warning(push) #pragma warning(disable: 28719) #pragma warning(disable: 28726) wchar_t* __cdecl wcscat( wchar_t *_Destination, wchar_t const* _Source); #pragma warning(pop) 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); } } #pragma warning(push) #pragma warning(disable: 28719) #pragma warning(disable: 28726) wchar_t* __cdecl wcscpy( wchar_t *_Destination, wchar_t const* _Source); #pragma warning(pop) size_t __cdecl wcscspn( wchar_t const* _String, wchar_t const* _Control ); size_t __cdecl wcslen( wchar_t const* _String ); 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); } } wchar_t* __cdecl wcsncat( wchar_t *_Destination, wchar_t const* _Source, size_t _Count); 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); } } wchar_t* __cdecl wcsncpy( wchar_t *_Destination, wchar_t const* _Source, size_t _Count); wchar_t const* __cdecl wcspbrk( wchar_t const* _String, wchar_t const* _Control ); size_t __cdecl wcsspn( wchar_t const* _String, wchar_t const* _Control ); wchar_t* __cdecl wcstok( wchar_t* _String, wchar_t const* _Delimiter, wchar_t** _Context ); #pragma warning(push) #pragma warning(disable: 4141 4996) #pragma warning(disable: 28719 28726 28727) 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); } #pragma warning(pop) wchar_t* __cdecl _wcserror( int _ErrorNumber ); 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); } } wchar_t* __cdecl __wcserror( wchar_t const* _String ); 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); } } int __cdecl _wcsicmp( wchar_t const* _String1, wchar_t const* _String2 ); int __cdecl _wcsicmp_l( wchar_t const* _String1, wchar_t const* _String2, _locale_t _Locale ); int __cdecl _wcsnicmp( wchar_t const* _String1, wchar_t const* _String2, size_t _MaxCount ); int __cdecl _wcsnicmp_l( wchar_t const* _String1, wchar_t const* _String2, size_t _MaxCount, _locale_t _Locale ); 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); } } wchar_t* __cdecl _wcsnset( wchar_t *_String, wchar_t _Value, size_t _MaxCount); wchar_t* __cdecl _wcsrev( wchar_t* _String ); 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); } } wchar_t* __cdecl _wcsset( wchar_t *_String, wchar_t _Value); 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); } } wchar_t* __cdecl _wcslwr( wchar_t *_String); 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); } } wchar_t* __cdecl _wcslwr_l( wchar_t *_String, _locale_t _Locale); 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); } } wchar_t* __cdecl _wcsupr( wchar_t *_String); 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); } } wchar_t* __cdecl _wcsupr_l( wchar_t *_String, _locale_t _Locale); size_t __cdecl wcsxfrm( wchar_t* _Destination, wchar_t const* _Source, size_t _MaxCount ); size_t __cdecl _wcsxfrm_l( wchar_t* _Destination, wchar_t const* _Source, size_t _MaxCount, _locale_t _Locale ); int __cdecl wcscoll( wchar_t const* _String1, wchar_t const* _String2 ); int __cdecl _wcscoll_l( wchar_t const* _String1, wchar_t const* _String2, _locale_t _Locale ); int __cdecl _wcsicoll( wchar_t const* _String1, wchar_t const* _String2 ); int __cdecl _wcsicoll_l( wchar_t const* _String1, wchar_t const* _String2, _locale_t _Locale ); int __cdecl _wcsncoll( wchar_t const* _String1, wchar_t const* _String2, size_t _MaxCount ); int __cdecl _wcsncoll_l( wchar_t const* _String1, wchar_t const* _String2, size_t _MaxCount, _locale_t _Locale ); int __cdecl _wcsnicoll( wchar_t const* _String1, wchar_t const* _String2, size_t _MaxCount ); 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.")) 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.")) 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.")) 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.")) 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.")) 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.")) 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.")) 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.")) 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.")) int __cdecl wcsicoll( wchar_t const* _String1, wchar_t const* _String2 ); } #pragma pack(pop) #pragma pack(push, 8) extern "C" { errno_t __cdecl strcpy_s( char* _Destination, rsize_t _SizeInBytes, char const* _Source ); errno_t __cdecl strcat_s( char* _Destination, rsize_t _SizeInBytes, char const* _Source ); errno_t __cdecl strerror_s( char* _Buffer, size_t _SizeInBytes, int _ErrorNumber); errno_t __cdecl strncat_s( char* _Destination, rsize_t _SizeInBytes, char const* _Source, rsize_t _MaxCount ); errno_t __cdecl strncpy_s( char* _Destination, rsize_t _SizeInBytes, char const* _Source, rsize_t _MaxCount ); char* __cdecl strtok_s( char* _String, char const* _Delimiter, char** _Context ); 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); } } #pragma warning(push) #pragma warning(disable: 28719) #pragma warning(disable: 28726) char* __cdecl strcat( char *_Destination, char const* _Source); #pragma warning(pop) int __cdecl strcmp( char const* _Str1, char const* _Str2 ); int __cdecl _strcmpi( char const* _String1, char const* _String2 ); int __cdecl strcoll( char const* _String1, char const* _String2 ); 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); } } #pragma warning(push) #pragma warning(disable: 28719) #pragma warning(disable: 28726) char* __cdecl strcpy( char *_Destination, char const* _Source); #pragma warning(pop) size_t __cdecl strcspn( char const* _Str, char const* _Control ); __declspec(allocator) char* __cdecl _strdup( char const* _Source ); char* __cdecl _strerror( char const* _ErrorMessage ); 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); } } 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); } } int __cdecl _stricmp( char const* _String1, char const* _String2 ); int __cdecl _stricoll( char const* _String1, char const* _String2 ); int __cdecl _stricoll_l( char const* _String1, char const* _String2, _locale_t _Locale ); int __cdecl _stricmp_l( char const* _String1, char const* _String2, _locale_t _Locale ); size_t __cdecl strlen( char const* _Str ); 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); } } char* __cdecl _strlwr( char *_String); 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); } } 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); } } char* __cdecl strncat( char *_Destination, char const* _Source, size_t _Count); int __cdecl strncmp( char const* _Str1, char const* _Str2, size_t _MaxCount ); int __cdecl _strnicmp( char const* _String1, char const* _String2, size_t _MaxCount ); int __cdecl _strnicmp_l( char const* _String1, char const* _String2, size_t _MaxCount, _locale_t _Locale ); int __cdecl _strnicoll( char const* _String1, char const* _String2, size_t _MaxCount ); int __cdecl _strnicoll_l( char const* _String1, char const* _String2, size_t _MaxCount, _locale_t _Locale ); int __cdecl _strncoll( char const* _String1, char const* _String2, size_t _MaxCount ); int __cdecl _strncoll_l( char const* _String1, char const* _String2, size_t _MaxCount, _locale_t _Locale ); 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); } } char* __cdecl strncpy( char *_Destination, char const* _Source, size_t _Count); 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); } 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); } } char* __cdecl _strnset( char *_Destination, int _Value, size_t _Count); char const* __cdecl strpbrk( char const* _Str, char const* _Control ); char* __cdecl _strrev( char* _Str ); 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); } } char* __cdecl _strset( char *_Destination, int _Value); size_t __cdecl strspn( char const* _Str, char const* _Control ); char* __cdecl strtok( char* _String, char const* _Delimiter ); 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); } } char* __cdecl _strupr( char *_String); 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); } } char* __cdecl _strupr_l( char *_String, _locale_t _Locale); size_t __cdecl strxfrm( char* _Destination, char const* _Source, size_t _MaxCount ); 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.")) 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.")) 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.")) 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.")) 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.")) 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.")) 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.")) 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.")) char* __cdecl strupr( char* _String ); } #pragma pack(pop) #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; }; wchar_t* __cdecl _wasctime( struct tm const* _Tm ); 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); } } size_t __cdecl wcsftime( wchar_t* _Buffer, size_t _SizeInWords, wchar_t const* _Format, struct tm const* _Tm ); size_t __cdecl _wcsftime_l( wchar_t* _Buffer, size_t _SizeInWords, wchar_t const* _Format, struct tm const* _Tm, _locale_t _Locale ); wchar_t* __cdecl _wctime32( __time32_t const* _Time ); 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); } } wchar_t* __cdecl _wctime64( __time64_t const* _Time ); 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); } } 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); } } wchar_t* __cdecl _wstrdate( wchar_t *_Buffer); 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); } } wchar_t* __cdecl _wstrtime( wchar_t *_Buffer); #pragma warning(push) #pragma warning(disable: 4996) 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 warning(pop) } #pragma pack(pop) #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; }; int* __cdecl __daylight(void); long* __cdecl __dstbias(void); long* __cdecl __timezone(void); char** __cdecl __tzname(void); errno_t __cdecl _get_daylight( int* _Daylight ); errno_t __cdecl _get_dstbias( long* _DaylightSavingsBias ); errno_t __cdecl _get_timezone( long* _TimeZone ); errno_t __cdecl _get_tzname( size_t* _ReturnValue, char* _Buffer, size_t _SizeInBytes, int _Index ); char* __cdecl asctime( struct tm const* _Tm ); 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); } } clock_t __cdecl clock(void); char* __cdecl _ctime32( __time32_t const* _Time ); 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); } } char* __cdecl _ctime64( __time64_t const* _Time ); 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); } } double __cdecl _difftime32( __time32_t _Time1, __time32_t _Time2 ); double __cdecl _difftime64( __time64_t _Time1, __time64_t _Time2 ); struct tm* __cdecl _gmtime32( __time32_t const* _Time ); errno_t __cdecl _gmtime32_s( struct tm* _Tm, __time32_t const* _Time ); struct tm* __cdecl _gmtime64( __time64_t const* _Time ); errno_t __cdecl _gmtime64_s( struct tm* _Tm, __time64_t const* _Time ); struct tm* __cdecl _localtime32( __time32_t const* _Time ); errno_t __cdecl _localtime32_s( struct tm* _Tm, __time32_t const* _Time ); struct tm* __cdecl _localtime64( __time64_t const* _Time ); errno_t __cdecl _localtime64_s( struct tm* _Tm, __time64_t const* _Time ); __time32_t __cdecl _mkgmtime32( struct tm* _Tm ); __time64_t __cdecl _mkgmtime64( struct tm* _Tm ); __time32_t __cdecl _mktime32( struct tm* _Tm ); __time64_t __cdecl _mktime64( struct tm* _Tm ); size_t __cdecl strftime( char* _Buffer, size_t _SizeInBytes, char const* _Format, struct tm const* _Tm ); size_t __cdecl _strftime_l( char* _Buffer, size_t _MaxSize, char const* _Format, struct tm const* _Tm, _locale_t _Locale ); 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); } } char* __cdecl _strdate( char *_Buffer); 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); } } char* __cdecl _strtime( char *_Buffer); __time32_t __cdecl _time32( __time32_t* _Time ); __time64_t __cdecl _time64( __time64_t* _Time ); int __cdecl _timespec32_get( struct _timespec32* _Ts, int _Base ); int __cdecl _timespec64_get( struct _timespec64* _Ts, int _Base ); 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.")) 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.")) unsigned __cdecl _setsystime( struct tm* _Tm, unsigned _Milliseconds ); static __inline char* __cdecl ctime( time_t const* const _Time ) { #pragma warning(push) #pragma warning(disable: 4996) return _ctime64(_Time); #pragma warning(pop) } static __inline double __cdecl difftime( time_t const _Time1, time_t const _Time2 ) { return _difftime64(_Time1, _Time2); } static __inline struct tm* __cdecl gmtime( time_t const* const _Time) { #pragma warning(push) #pragma warning(disable: 4996) return _gmtime64(_Time); #pragma warning(pop) } static __inline struct tm* __cdecl localtime( time_t const* const _Time ) { #pragma warning(push) #pragma warning(disable: 4996) return _localtime64(_Time); #pragma warning(pop) } 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.")) void __cdecl tzset(void); } #pragma pack(pop) namespace std { template<class _Ep> class initializer_list { const _Ep* __begin_; size_t __size_; __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr initializer_list(const _Ep* __b, size_t __s) noexcept : __begin_(__b), __size_(__s) {} public: typedef _Ep value_type; typedef const _Ep& reference; typedef const _Ep& const_reference; typedef size_t size_type; typedef const _Ep* iterator; typedef const _Ep* const_iterator; __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr initializer_list() noexcept : __begin_(nullptr), __size_(0) {} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr size_t size() const noexcept {return __size_;} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const _Ep* begin() const noexcept {return __begin_;} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const _Ep* end() const noexcept {return __begin_ + __size_;} }; template<class _Ep> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const _Ep* begin(initializer_list<_Ep> __il) noexcept { return __il.begin(); } template<class _Ep> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const _Ep* end(initializer_list<_Ep> __il) noexcept { return __il.end(); } } namespace std { inline namespace __1 { using ::size_t; using ::memcpy; using ::memmove; using ::strcpy; using ::strncpy; using ::strcat; using ::strncat; using ::memcmp; using ::strcmp; using ::strncmp; using ::strcoll; using ::strxfrm; using ::memchr; using ::strchr; using ::strcspn; using ::strpbrk; using ::strrchr; using ::strspn; using ::strstr; using ::strtok; using ::memset; using ::strerror; using ::strlen; } } namespace std { inline namespace __1 { template <class _Tp> struct tuple_size; template <class _Tp, class...> using __enable_if_tuple_size_imp = _Tp; template <class _Tp> struct tuple_size<__enable_if_tuple_size_imp< const _Tp, typename enable_if<!is_volatile<_Tp>::value>::type, integral_constant<size_t, sizeof(tuple_size<_Tp>)>>> : public integral_constant<size_t, tuple_size<_Tp>::value> {}; template <class _Tp> struct tuple_size<__enable_if_tuple_size_imp< volatile _Tp, typename enable_if<!is_const<_Tp>::value>::type, integral_constant<size_t, sizeof(tuple_size<_Tp>)>>> : public integral_constant<size_t, tuple_size<_Tp>::value> {}; template <class _Tp> struct tuple_size<__enable_if_tuple_size_imp< const volatile _Tp, integral_constant<size_t, sizeof(tuple_size<_Tp>)>>> : public integral_constant<size_t, tuple_size<_Tp>::value> {}; template <size_t _Ip, class _Tp> struct tuple_element; template <size_t _Ip, class _Tp> struct tuple_element<_Ip, const _Tp> { typedef __attribute__((nodebug)) typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type; }; template <size_t _Ip, class _Tp> struct tuple_element<_Ip, volatile _Tp> { typedef __attribute__((nodebug)) typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type; }; template <size_t _Ip, class _Tp> struct tuple_element<_Ip, const volatile _Tp> { typedef __attribute__((nodebug)) typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type; }; template <class _Tp> struct __tuple_like : false_type {}; template <class _Tp> struct __tuple_like<const _Tp> : public __tuple_like<_Tp> {}; template <class _Tp> struct __tuple_like<volatile _Tp> : public __tuple_like<_Tp> {}; template <class _Tp> struct __tuple_like<const volatile _Tp> : public __tuple_like<_Tp> {}; template <size_t...> struct __tuple_indices {}; template <class _IdxType, _IdxType... _Values> struct __integer_sequence { template <template <class _OIdxType, _OIdxType...> class _ToIndexSeq, class _ToIndexType> using __convert = _ToIndexSeq<_ToIndexType, _Values...>; template <size_t _Sp> using __to_tuple_indices = __tuple_indices<(_Values + _Sp)...>; }; template <size_t _Ep, size_t _Sp> using __make_indices_imp = typename __make_integer_seq<__integer_sequence, size_t, _Ep - _Sp>::template __to_tuple_indices<_Sp>; template <size_t _Ep, size_t _Sp = 0> struct __make_tuple_indices { static_assert(_Sp <= _Ep, "__make_tuple_indices input error"); typedef __make_indices_imp<_Ep, _Sp> type; }; template <class ..._Tp> class tuple; template <class... _Tp> struct __tuple_like<tuple<_Tp...> > : true_type {}; template <class ..._Tp> struct tuple_size<tuple<_Tp...> > : public integral_constant<size_t, sizeof...(_Tp)> { }; template <size_t _Ip, class ..._Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename tuple_element<_Ip, tuple<_Tp...> >::type& get(tuple<_Tp...>&) noexcept; template <size_t _Ip, class ..._Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const typename tuple_element<_Ip, tuple<_Tp...> >::type& get(const tuple<_Tp...>&) noexcept; template <size_t _Ip, class ..._Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename tuple_element<_Ip, tuple<_Tp...> >::type&& get(tuple<_Tp...>&&) noexcept; template <size_t _Ip, class ..._Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const typename tuple_element<_Ip, tuple<_Tp...> >::type&& get(const tuple<_Tp...>&&) noexcept; template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type {}; template <size_t _Ip, class _T1, class _T2> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename tuple_element<_Ip, pair<_T1, _T2> >::type& get(pair<_T1, _T2>&) noexcept; template <size_t _Ip, class _T1, class _T2> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const typename tuple_element<_Ip, pair<_T1, _T2> >::type& get(const pair<_T1, _T2>&) noexcept; template <size_t _Ip, class _T1, class _T2> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename tuple_element<_Ip, pair<_T1, _T2> >::type&& get(pair<_T1, _T2>&&) noexcept; template <size_t _Ip, class _T1, class _T2> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const typename tuple_element<_Ip, pair<_T1, _T2> >::type&& get(const pair<_T1, _T2>&&) noexcept; template <class _Tp, size_t _Size> struct array; template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {}; template <size_t _Ip, class _Tp, size_t _Size> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _Tp& get(array<_Tp, _Size>&) noexcept; template <size_t _Ip, class _Tp, size_t _Size> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const _Tp& get(const array<_Tp, _Size>&) noexcept; template <size_t _Ip, class _Tp, size_t _Size> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _Tp&& get(array<_Tp, _Size>&&) noexcept; template <size_t _Ip, class _Tp, size_t _Size> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const _Tp&& get(const array<_Tp, _Size>&&) noexcept; template <class ..._Tp> struct __tuple_types {}; template <size_t _Ip, class ..._Types> struct tuple_element<_Ip, __tuple_types<_Types...>> { static_assert(_Ip < sizeof...(_Types), "tuple_element index out of range"); typedef __attribute__((nodebug)) __type_pack_element<_Ip, _Types...> type; }; template <class ..._Tp> struct tuple_size<__tuple_types<_Tp...> > : public integral_constant<size_t, sizeof...(_Tp)> { }; template <class... _Tp> struct __tuple_like<__tuple_types<_Tp...> > : true_type {}; template <bool _ApplyLV, bool _ApplyConst, bool _ApplyVolatile> struct __apply_cv_mf; template <> struct __apply_cv_mf<false, false, false> { template <class _Tp> using __apply = _Tp; }; template <> struct __apply_cv_mf<false, true, false> { template <class _Tp> using __apply __attribute__((nodebug)) = const _Tp; }; template <> struct __apply_cv_mf<false, false, true> { template <class _Tp> using __apply __attribute__((nodebug)) = volatile _Tp; }; template <> struct __apply_cv_mf<false, true, true> { template <class _Tp> using __apply __attribute__((nodebug)) = const volatile _Tp; }; template <> struct __apply_cv_mf<true, false, false> { template <class _Tp> using __apply __attribute__((nodebug)) = _Tp&; }; template <> struct __apply_cv_mf<true, true, false> { template <class _Tp> using __apply __attribute__((nodebug)) = const _Tp&; }; template <> struct __apply_cv_mf<true, false, true> { template <class _Tp> using __apply __attribute__((nodebug)) = volatile _Tp&; }; template <> struct __apply_cv_mf<true, true, true> { template <class _Tp> using __apply __attribute__((nodebug)) = const volatile _Tp&; }; template <class _Tp, class _RawTp = typename remove_reference<_Tp>::type> using __apply_cv_t __attribute__((nodebug)) = __apply_cv_mf< is_lvalue_reference<_Tp>::value, is_const<_RawTp>::value, is_volatile<_RawTp>::value>; template <class _TupleTypes, class _TupleIndices> struct __make_tuple_types_flat; template <template <class...> class _Tuple, class ..._Types, size_t ..._Idx> struct __make_tuple_types_flat<_Tuple<_Types...>, __tuple_indices<_Idx...>> { template <class _Tp, class _ApplyFn = __apply_cv_t<_Tp>> using __apply_quals __attribute__((nodebug)) = __tuple_types< typename _ApplyFn::template __apply<__type_pack_element<_Idx, _Types...>>... >; }; template <class _Vt, size_t _Np, size_t ..._Idx> struct __make_tuple_types_flat<array<_Vt, _Np>, __tuple_indices<_Idx...>> { template <size_t> using __value_type = _Vt; template <class _Tp, class _ApplyFn = __apply_cv_t<_Tp>> using __apply_quals = __tuple_types< typename _ApplyFn::template __apply<__value_type<_Idx>>... >; }; template <class _Tp, size_t _Ep = tuple_size<typename remove_reference<_Tp>::type>::value, size_t _Sp = 0, bool _SameSize = (_Ep == tuple_size<typename remove_reference<_Tp>::type>::value)> struct __make_tuple_types { static_assert(_Sp <= _Ep, "__make_tuple_types input error"); using _RawTp = typename remove_cv<typename remove_reference<_Tp>::type>::type; using _Maker = __make_tuple_types_flat<_RawTp, typename __make_tuple_indices<_Ep, _Sp>::type>; using type = typename _Maker::template __apply_quals<_Tp>; }; template <class ..._Types, size_t _Ep> struct __make_tuple_types<tuple<_Types...>, _Ep, 0, true> { typedef __attribute__((nodebug)) __tuple_types<_Types...> type; }; template <class ..._Types, size_t _Ep> struct __make_tuple_types<__tuple_types<_Types...>, _Ep, 0, true> { typedef __attribute__((nodebug)) __tuple_types<_Types...> type; }; template <bool ..._Preds> struct __all_dummy; template <bool ..._Pred> using __all = _IsSame<__all_dummy<_Pred...>, __all_dummy<((void)_Pred, true)...>>; struct __tuple_sfinae_base { template <template <class, class...> class _Trait, class ..._LArgs, class ..._RArgs> static auto __do_test(__tuple_types<_LArgs...>, __tuple_types<_RArgs...>) -> __all<typename enable_if<_Trait<_LArgs, _RArgs>::value, bool>::type{true}...>; template <template <class...> class> static auto __do_test(...) -> false_type; template <class _FromArgs, class _ToArgs> using __constructible = decltype(__do_test<is_constructible>(_ToArgs{}, _FromArgs{})); template <class _FromArgs, class _ToArgs> using __convertible = decltype(__do_test<is_convertible>(_FromArgs{}, _ToArgs{})); template <class _FromArgs, class _ToArgs> using __assignable = decltype(__do_test<is_assignable>(_ToArgs{}, _FromArgs{})); }; template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value, bool = __tuple_like<_Up>::value> struct __tuple_convertible : public false_type {}; template <class _Tp, class _Up> struct __tuple_convertible<_Tp, _Up, true, true> : public __tuple_sfinae_base::__convertible< typename __make_tuple_types<_Tp>::type , typename __make_tuple_types<_Up>::type > {}; template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value, bool = __tuple_like<_Up>::value> struct __tuple_constructible : public false_type {}; template <class _Tp, class _Up> struct __tuple_constructible<_Tp, _Up, true, true> : public __tuple_sfinae_base::__constructible< typename __make_tuple_types<_Tp>::type , typename __make_tuple_types<_Up>::type > {}; template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value, bool = __tuple_like<_Up>::value> struct __tuple_assignable : public false_type {}; template <class _Tp, class _Up> struct __tuple_assignable<_Tp, _Up, true, true> : public __tuple_sfinae_base::__assignable< typename __make_tuple_types<_Tp>::type , typename __make_tuple_types<_Up&>::type > {}; template <size_t _Ip, class ..._Tp> struct tuple_element<_Ip, tuple<_Tp...> > { typedef __attribute__((nodebug)) typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type; }; template <size_t _Ip, class ..._Tp> using tuple_element_t __attribute__((nodebug)) = typename tuple_element <_Ip, _Tp...>::type; template <bool _IsTuple, class _SizeTrait, size_t _Expected> struct __tuple_like_with_size_imp : false_type {}; template <class _SizeTrait, size_t _Expected> struct __tuple_like_with_size_imp<true, _SizeTrait, _Expected> : integral_constant<bool, _SizeTrait::value == _Expected> {}; template <class _Tuple, size_t _ExpectedSize, class _RawTuple = typename __uncvref<_Tuple>::type> using __tuple_like_with_size __attribute__((nodebug)) = __tuple_like_with_size_imp< __tuple_like<_RawTuple>::value, tuple_size<_RawTuple>, _ExpectedSize >; struct __check_tuple_constructor_fail { static constexpr bool __enable_explicit_default() { return false; } static constexpr bool __enable_implicit_default() { return false; } template <class ...> static constexpr bool __enable_explicit() { return false; } template <class ...> static constexpr bool __enable_implicit() { return false; } template <class ...> static constexpr bool __enable_assign() { return false; } }; } } 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; namespace std { inline namespace __1 { 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::intptr_t; using::uintptr_t; using::intmax_t; using::uintmax_t; } } #pragma pack(push, 8) extern "C" { 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); } } int __cdecl _cputws( wchar_t const* _Buffer ); wint_t __cdecl _getwch (void); wint_t __cdecl _getwche (void); wint_t __cdecl _putwch ( wchar_t _Character); wint_t __cdecl _ungetwch( wint_t _Character); wint_t __cdecl _getwch_nolock (void); wint_t __cdecl _getwche_nolock (void); wint_t __cdecl _putwch_nolock ( wchar_t _Character); wint_t __cdecl _ungetwch_nolock( wint_t _Character); int __cdecl __conio_common_vcwprintf( unsigned __int64 _Options, wchar_t const* _Format, _locale_t _Locale, va_list _ArgList ); int __cdecl __conio_common_vcwprintf_s( unsigned __int64 _Options, wchar_t const* _Format, _locale_t _Locale, va_list _ArgList ); 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; __builtin_va_start(_ArgList, _Locale); _Result = _vcwprintf_l(_Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _cwprintf( wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vcwprintf_l(_Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _cwprintf_s_l( wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); _Result = _vcwprintf_s_l(_Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _cwprintf_s( wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vcwprintf_s_l(_Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _cwprintf_p_l( wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); _Result = _vcwprintf_p_l(_Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _cwprintf_p( wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vcwprintf_p_l(_Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } int __cdecl __conio_common_vcwscanf( unsigned __int64 _Options, wchar_t const* _Format, _locale_t _Locale, va_list _ArgList ); __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); } __inline int __cdecl _vcwscanf( wchar_t const* const _Format, va_list _ArgList ) { #pragma warning(push) #pragma warning(disable: 4996) return _vcwscanf_l(_Format, 0, _ArgList); #pragma warning(pop) } __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); } __inline int __cdecl _cwscanf_l( wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); #pragma warning(push) #pragma warning(disable: 4996) _Result = _vcwscanf_l(_Format, _Locale, _ArgList); #pragma warning(pop) __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _cwscanf( wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); #pragma warning(push) #pragma warning(disable: 4996) _Result = _vcwscanf_l(_Format, 0, _ArgList); #pragma warning(pop) __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _cwscanf_s_l( wchar_t const* const _Format, _locale_t const _Locale, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Locale); _Result = _vcwscanf_s_l(_Format, _Locale, _ArgList); __builtin_va_end(_ArgList); return _Result; } __inline int __cdecl _cwscanf_s( wchar_t const* const _Format, ...) { int _Result; va_list _ArgList; __builtin_va_start(_ArgList, _Format); _Result = _vcwscanf_s_l(_Format, 0, _ArgList); __builtin_va_end(_ArgList); return _Result; } } #pragma pack(pop) #pragma pack(push, 8) extern "C" { const unsigned short* __cdecl __pctype_func(void); const wctype_t* __cdecl __pwctype_func(void); int __cdecl iswalnum ( wint_t _C); int __cdecl iswalpha ( wint_t _C); int __cdecl iswascii ( wint_t _C); int __cdecl iswblank ( wint_t _C); int __cdecl iswcntrl ( wint_t _C); int __cdecl iswdigit ( wint_t _C); int __cdecl iswgraph ( wint_t _C); int __cdecl iswlower ( wint_t _C); int __cdecl iswprint ( wint_t _C); int __cdecl iswpunct ( wint_t _C); int __cdecl iswspace ( wint_t _C); int __cdecl iswupper ( wint_t _C); int __cdecl iswxdigit ( wint_t _C); int __cdecl __iswcsymf( wint_t _C); int __cdecl __iswcsym ( wint_t _C); int __cdecl _iswalnum_l ( wint_t _C, _locale_t _Locale); int __cdecl _iswalpha_l ( wint_t _C, _locale_t _Locale); int __cdecl _iswblank_l ( wint_t _C, _locale_t _Locale); int __cdecl _iswcntrl_l ( wint_t _C, _locale_t _Locale); int __cdecl _iswdigit_l ( wint_t _C, _locale_t _Locale); int __cdecl _iswgraph_l ( wint_t _C, _locale_t _Locale); int __cdecl _iswlower_l ( wint_t _C, _locale_t _Locale); int __cdecl _iswprint_l ( wint_t _C, _locale_t _Locale); int __cdecl _iswpunct_l ( wint_t _C, _locale_t _Locale); int __cdecl _iswspace_l ( wint_t _C, _locale_t _Locale); int __cdecl _iswupper_l ( wint_t _C, _locale_t _Locale); int __cdecl _iswxdigit_l( wint_t _C, _locale_t _Locale); int __cdecl _iswcsymf_l ( wint_t _C, _locale_t _Locale); int __cdecl _iswcsym_l ( wint_t _C, _locale_t _Locale); wint_t __cdecl towupper( wint_t _C); wint_t __cdecl towlower( wint_t _C); int __cdecl iswctype( wint_t _C, wctype_t _Type); wint_t __cdecl _towupper_l( wint_t _C, _locale_t _Locale); wint_t __cdecl _towlower_l( wint_t _C, _locale_t _Locale); int __cdecl _iswctype_l( wint_t _C, wctype_t _Type, _locale_t _Locale); int __cdecl isleadbyte( int _C); 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.")) int __cdecl is_wctype( wint_t _C, wctype_t _Type); } #pragma pack(pop) #pragma pack(push, 8) extern "C" { __declspec(allocator) wchar_t* __cdecl _wgetcwd( wchar_t* _DstBuf, int _SizeInWords ); __declspec(allocator) wchar_t* __cdecl _wgetdcwd( int _Drive, wchar_t* _DstBuf, int _SizeInWords ); int __cdecl _wchdir( wchar_t const* _Path ); int __cdecl _wmkdir( wchar_t const* _Path ); int __cdecl _wrmdir( wchar_t const* _Path ); } #pragma pack(pop) #pragma pack(push, 8) extern "C" { #pragma warning(push) #pragma warning(disable: 4820) 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]; }; int __cdecl _waccess( wchar_t const* _FileName, int _AccessMode ); errno_t __cdecl _waccess_s( wchar_t const* _FileName, int _AccessMode ); int __cdecl _wchmod( wchar_t const* _FileName, int _Mode ); int __cdecl _wcreat( wchar_t const* _FileName, int _PermissionMode ); intptr_t __cdecl _wfindfirst32( wchar_t const* _FileName, struct _wfinddata32_t* _FindData ); int __cdecl _wfindnext32( intptr_t _FindHandle, struct _wfinddata32_t* _FindData ); int __cdecl _wunlink( wchar_t const* _FileName ); int __cdecl _wrename( wchar_t const* _OldFileName, wchar_t const* _NewFileName ); 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); } } wchar_t* __cdecl _wmktemp( wchar_t *_TemplateName); intptr_t __cdecl _wfindfirst32i64( wchar_t const* _FileName, struct _wfinddata32i64_t* _FindData ); intptr_t __cdecl _wfindfirst64i32( wchar_t const* _FileName, struct _wfinddata64i32_t* _FindData ); intptr_t __cdecl _wfindfirst64( wchar_t const* _FileName, struct _wfinddata64_t* _FindData ); int __cdecl _wfindnext32i64( intptr_t _FindHandle, struct _wfinddata32i64_t* _FindData ); int __cdecl _wfindnext64i32( intptr_t _FindHandle, struct _wfinddata64i32_t* _FindData ); int __cdecl _wfindnext64( intptr_t _FindHandle, struct _wfinddata64_t* _FindData ); errno_t __cdecl _wsopen_s( int* _FileHandle, wchar_t const* _FileName, int _OpenFlag, int _ShareFlag, int _PermissionFlag ); errno_t __cdecl _wsopen_dispatch( wchar_t const* _FileName, int _OFlag, int _ShFlag, int _PMode, int* _PFileHandle, int _BSecure ); extern "C++" 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++" 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 warning(pop) } #pragma pack(pop) #pragma pack(push, 8) extern "C" { intptr_t __cdecl _wexecl( wchar_t const* _FileName, wchar_t const* _ArgList, ...); intptr_t __cdecl _wexecle( wchar_t const* _FileName, wchar_t const* _ArgList, ...); intptr_t __cdecl _wexeclp( wchar_t const* _FileName, wchar_t const* _ArgList, ...); intptr_t __cdecl _wexeclpe( wchar_t const* _FileName, wchar_t const* _ArgList, ...); intptr_t __cdecl _wexecv( wchar_t const* _FileName, wchar_t const* const* _ArgList ); intptr_t __cdecl _wexecve( wchar_t const* _FileName, wchar_t const* const* _ArgList, wchar_t const* const* _Env ); intptr_t __cdecl _wexecvp( wchar_t const* _FileName, wchar_t const* const* _ArgList ); intptr_t __cdecl _wexecvpe( wchar_t const* _FileName, wchar_t const* const* _ArgList, wchar_t const* const* _Env ); intptr_t __cdecl _wspawnl( int _Mode, wchar_t const* _FileName, wchar_t const* _ArgList, ...); intptr_t __cdecl _wspawnle( int _Mode, wchar_t const* _FileName, wchar_t const* _ArgList, ...); intptr_t __cdecl _wspawnlp( int _Mode, wchar_t const* _FileName, wchar_t const* _ArgList, ...); intptr_t __cdecl _wspawnlpe( int _Mode, wchar_t const* _FileName, wchar_t const* _ArgList, ...); intptr_t __cdecl _wspawnv( int _Mode, wchar_t const* _FileName, wchar_t const* const* _ArgList ); intptr_t __cdecl _wspawnve( int _Mode, wchar_t const* _FileName, wchar_t const* const* _ArgList, wchar_t const* const* _Env ); intptr_t __cdecl _wspawnvp( int _Mode, wchar_t const* _FileName, wchar_t const* const* _ArgList ); intptr_t __cdecl _wspawnvpe( int _Mode, wchar_t const* _FileName, wchar_t const* const* _ArgList, wchar_t const* const* _Env ); int __cdecl _wsystem( wchar_t const* _Command ); } #pragma pack(pop) 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 pack(push, 8) extern "C" { #pragma warning(push) #pragma warning(disable: 4820) 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; }; int __cdecl _fstat32( int _FileHandle, struct _stat32* _Stat ); int __cdecl _fstat32i64( int _FileHandle, struct _stat32i64* _Stat ); int __cdecl _fstat64i32( int _FileHandle, struct _stat64i32* _Stat ); int __cdecl _fstat64( int _FileHandle, struct _stat64* _Stat ); int __cdecl _stat32( char const* _FileName, struct _stat32* _Stat ); int __cdecl _stat32i64( char const* _FileName, struct _stat32i64* _Stat ); int __cdecl _stat64i32( char const* _FileName, struct _stat64i32* _Stat ); int __cdecl _stat64( char const* _FileName, struct _stat64* _Stat ); int __cdecl _wstat32( wchar_t const* _FileName, struct _stat32* _Stat ); int __cdecl _wstat32i64( wchar_t const* _FileName, struct _stat32i64* _Stat ); int __cdecl _wstat64i32( wchar_t const* _FileName, struct _stat64i32* _Stat ); int __cdecl _wstat64( wchar_t const* _FileName, struct _stat64* _Stat ); static __inline int __cdecl fstat(int const _FileHandle, struct stat* const _Stat) { typedef char __static_assert_t[(sizeof(struct stat) == sizeof(struct _stat64i32)) != 0]; return _fstat64i32(_FileHandle, (struct _stat64i32*)_Stat); } static __inline int __cdecl stat(char const* const _FileName, struct stat* const _Stat) { typedef char __static_assert_t[(sizeof(struct stat) == sizeof(struct _stat64i32)) != 0]; return _stat64i32(_FileName, (struct _stat64i32*)_Stat); } #pragma warning(pop) } #pragma pack(pop) #pragma pack(push, 8) extern "C" { typedef wchar_t _Wint_t; wchar_t* __cdecl _wsetlocale( int _Category, wchar_t const* _Locale ); _locale_t __cdecl _wcreate_locale( int _Category, wchar_t const* _Locale ); wint_t __cdecl btowc( int _Ch ); size_t __cdecl mbrlen( char const* _Ch, size_t _SizeInBytes, mbstate_t* _State ); size_t __cdecl mbrtowc( wchar_t* _DstCh, char const* _SrcCh, size_t _SizeInBytes, mbstate_t* _State ); 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); } } size_t __cdecl mbsrtowcs( wchar_t *_Dest, char const** _PSrc, size_t _Count, mbstate_t* _State); 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); } } size_t __cdecl wcrtomb( char *_Dest, wchar_t _Source, mbstate_t* _State); 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); } } size_t __cdecl wcsrtombs( char *_Dest, wchar_t const** _PSource, size_t _Count, mbstate_t* _State); 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(push) #pragma warning(disable: 4995 4996 6386) return (wchar_t*)memcpy(_S1, _S2, _N*sizeof(wchar_t)); #pragma warning(pop) } __inline wchar_t* __cdecl wmemmove( wchar_t* _S1, wchar_t const* _S2, size_t _N ) { #pragma warning(push) #pragma warning(disable: 4996 6386) return (wchar_t*)memmove(_S1, _S2, _N*sizeof(wchar_t)); #pragma warning(pop) } __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) extern "C" { size_t mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src, size_t nmc, size_t len, mbstate_t *__restrict ps); size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src, size_t nwc, size_t len, mbstate_t *__restrict ps); } namespace std { inline namespace __1 { class ios_base; template<class _CharT> struct char_traits; template<> struct char_traits<char>; template<> struct char_traits<char16_t>; template<> struct char_traits<char32_t>; template<> struct char_traits<wchar_t>; template<class _Tp> class allocator; template <class _CharT, class _Traits = char_traits<_CharT> > class basic_ios; template <class _CharT, class _Traits = char_traits<_CharT> > class basic_streambuf; template <class _CharT, class _Traits = char_traits<_CharT> > class basic_istream; template <class _CharT, class _Traits = char_traits<_CharT> > class basic_ostream; template <class _CharT, class _Traits = char_traits<_CharT> > class basic_iostream; template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> > class basic_stringbuf; template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> > class basic_istringstream; template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> > class basic_ostringstream; template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> > class basic_stringstream; template <class _CharT, class _Traits = char_traits<_CharT> > class basic_filebuf; template <class _CharT, class _Traits = char_traits<_CharT> > class basic_ifstream; template <class _CharT, class _Traits = char_traits<_CharT> > class basic_ofstream; template <class _CharT, class _Traits = char_traits<_CharT> > class basic_fstream; template <class _CharT, class _Traits = char_traits<_CharT> > class istreambuf_iterator; template <class _CharT, class _Traits = char_traits<_CharT> > class ostreambuf_iterator; typedef basic_ios<char> ios; typedef basic_ios<wchar_t> wios; typedef basic_streambuf<char> streambuf; typedef basic_istream<char> istream; typedef basic_ostream<char> ostream; typedef basic_iostream<char> iostream; typedef basic_stringbuf<char> stringbuf; typedef basic_istringstream<char> istringstream; typedef basic_ostringstream<char> ostringstream; typedef basic_stringstream<char> stringstream; typedef basic_filebuf<char> filebuf; typedef basic_ifstream<char> ifstream; typedef basic_ofstream<char> ofstream; typedef basic_fstream<char> fstream; typedef basic_streambuf<wchar_t> wstreambuf; typedef basic_istream<wchar_t> wistream; typedef basic_ostream<wchar_t> wostream; typedef basic_iostream<wchar_t> wiostream; typedef basic_stringbuf<wchar_t> wstringbuf; typedef basic_istringstream<wchar_t> wistringstream; typedef basic_ostringstream<wchar_t> wostringstream; typedef basic_stringstream<wchar_t> wstringstream; typedef basic_filebuf<wchar_t> wfilebuf; typedef basic_ifstream<wchar_t> wifstream; typedef basic_ofstream<wchar_t> wofstream; typedef basic_fstream<wchar_t> wfstream; template <class _State> class fpos; typedef fpos<mbstate_t> streampos; typedef fpos<mbstate_t> wstreampos; typedef fpos<mbstate_t> u16streampos; typedef fpos<mbstate_t> u32streampos; typedef long long streamoff; template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> > class basic_string; typedef basic_string<char, char_traits<char>, allocator<char> > string; typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring; template <class _Tp, class _Alloc = allocator<_Tp> > class vector; } } namespace std { inline namespace __1 { struct __libcpp_debug_info { __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __libcpp_debug_info() : __file_(nullptr), __line_(-1), __pred_(nullptr), __msg_(nullptr) {} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __libcpp_debug_info(const char* __f, int __l, const char* __p, const char* __m) : __file_(__f), __line_(__l), __pred_(__p), __msg_(__m) {} std::string what() const; const char* __file_; int __line_; const char* __pred_; const char* __msg_; }; typedef void(*__libcpp_debug_function_type)(__libcpp_debug_info const&); extern __libcpp_debug_function_type __libcpp_debug_function; [[noreturn]] void __libcpp_abort_debug_function(__libcpp_debug_info const&); bool __libcpp_set_debug_function(__libcpp_debug_function_type __func); } } namespace std { inline namespace __1 { namespace rel_ops { template<class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const _Tp& __x, const _Tp& __y) { return !(__x == __y); } template<class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator> (const _Tp& __x, const _Tp& __y) { return __y < __x; } template<class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(const _Tp& __x, const _Tp& __y) { return !(__y < __x); } template<class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(const _Tp& __x, const _Tp& __y) { return !(__x < __y); } } template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename conditional < !is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value, const _Tp&, _Tp&& >::type move_if_noexcept(_Tp& __x) noexcept { return std::__1::move(__x); } struct piecewise_construct_t { explicit piecewise_construct_t() = default; }; constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t(); template <class _T1, class _T2> struct pair { typedef _T1 first_type; typedef _T2 second_type; _T1 first; _T2 second; pair(pair const&) = default; pair(pair&&) = default; template <bool _Val> using _EnableB __attribute__((nodebug)) = typename enable_if<_Val, bool>::type; struct _CheckArgs { template <int&...> static constexpr bool __enable_explicit_default() { return is_default_constructible<_T1>::value && is_default_constructible<_T2>::value && !__enable_implicit_default<>(); } template <int&...> static constexpr bool __enable_implicit_default() { return __is_implicitly_default_constructible<_T1>::value && __is_implicitly_default_constructible<_T2>::value; } template <class _U1, class _U2> static constexpr bool __enable_explicit() { return is_constructible<first_type, _U1>::value && is_constructible<second_type, _U2>::value && (!is_convertible<_U1, first_type>::value || !is_convertible<_U2, second_type>::value); } template <class _U1, class _U2> static constexpr bool __enable_implicit() { return is_constructible<first_type, _U1>::value && is_constructible<second_type, _U2>::value && is_convertible<_U1, first_type>::value && is_convertible<_U2, second_type>::value; } }; template <bool _MaybeEnable> using _CheckArgsDep __attribute__((nodebug)) = typename conditional< _MaybeEnable, _CheckArgs, __check_tuple_constructor_fail>::type; struct _CheckTupleLikeConstructor { template <class _Tuple> static constexpr bool __enable_implicit() { return __tuple_convertible<_Tuple, pair>::value; } template <class _Tuple> static constexpr bool __enable_explicit() { return __tuple_constructible<_Tuple, pair>::value && !__tuple_convertible<_Tuple, pair>::value; } template <class _Tuple> static constexpr bool __enable_assign() { return __tuple_assignable<_Tuple, pair>::value; } }; template <class _Tuple> using _CheckTLC __attribute__((nodebug)) = typename conditional< __tuple_like_with_size<_Tuple, 2>::value && !is_same<typename decay<_Tuple>::type, pair>::value, _CheckTupleLikeConstructor, __check_tuple_constructor_fail >::type; template<bool _Dummy = true, _EnableB< _CheckArgsDep<_Dummy>::__enable_explicit_default() > = false> explicit __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr pair() noexcept(is_nothrow_default_constructible<first_type>::value && is_nothrow_default_constructible<second_type>::value) : first(), second() {} template<bool _Dummy = true, _EnableB< _CheckArgsDep<_Dummy>::__enable_implicit_default() > = false> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr pair() noexcept(is_nothrow_default_constructible<first_type>::value && is_nothrow_default_constructible<second_type>::value) : first(), second() {} template <bool _Dummy = true, _EnableB< _CheckArgsDep<_Dummy>::template __enable_explicit<_T1 const&, _T2 const&>() > = false> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr explicit pair(_T1 const& __t1, _T2 const& __t2) noexcept(is_nothrow_copy_constructible<first_type>::value && is_nothrow_copy_constructible<second_type>::value) : first(__t1), second(__t2) {} template<bool _Dummy = true, _EnableB< _CheckArgsDep<_Dummy>::template __enable_implicit<_T1 const&, _T2 const&>() > = false> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr pair(_T1 const& __t1, _T2 const& __t2) noexcept(is_nothrow_copy_constructible<first_type>::value && is_nothrow_copy_constructible<second_type>::value) : first(__t1), second(__t2) {} template<class _U1, class _U2, _EnableB< _CheckArgs::template __enable_explicit<_U1, _U2>() > = false> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr explicit pair(_U1&& __u1, _U2&& __u2) noexcept((is_nothrow_constructible<first_type, _U1>::value && is_nothrow_constructible<second_type, _U2>::value)) : first(std::__1::forward<_U1>(__u1)), second(std::__1::forward<_U2>(__u2)) {} template<class _U1, class _U2, _EnableB< _CheckArgs::template __enable_implicit<_U1, _U2>() > = false> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr pair(_U1&& __u1, _U2&& __u2) noexcept((is_nothrow_constructible<first_type, _U1>::value && is_nothrow_constructible<second_type, _U2>::value)) : first(std::__1::forward<_U1>(__u1)), second(std::__1::forward<_U2>(__u2)) {} template<class _U1, class _U2, _EnableB< _CheckArgs::template __enable_explicit<_U1 const&, _U2 const&>() > = false> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr explicit pair(pair<_U1, _U2> const& __p) noexcept((is_nothrow_constructible<first_type, _U1 const&>::value && is_nothrow_constructible<second_type, _U2 const&>::value)) : first(__p.first), second(__p.second) {} template<class _U1, class _U2, _EnableB< _CheckArgs::template __enable_implicit<_U1 const&, _U2 const&>() > = false> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr pair(pair<_U1, _U2> const& __p) noexcept((is_nothrow_constructible<first_type, _U1 const&>::value && is_nothrow_constructible<second_type, _U2 const&>::value)) : first(__p.first), second(__p.second) {} template<class _U1, class _U2, _EnableB< _CheckArgs::template __enable_explicit<_U1, _U2>() > = false> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr explicit pair(pair<_U1, _U2>&&__p) noexcept((is_nothrow_constructible<first_type, _U1&&>::value && is_nothrow_constructible<second_type, _U2&&>::value)) : first(std::__1::forward<_U1>(__p.first)), second(std::__1::forward<_U2>(__p.second)) {} template<class _U1, class _U2, _EnableB< _CheckArgs::template __enable_implicit<_U1, _U2>() > = false> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr pair(pair<_U1, _U2>&& __p) noexcept((is_nothrow_constructible<first_type, _U1&&>::value && is_nothrow_constructible<second_type, _U2&&>::value)) : first(std::__1::forward<_U1>(__p.first)), second(std::__1::forward<_U2>(__p.second)) {} template<class _Tuple, _EnableB< _CheckTLC<_Tuple>::template __enable_explicit<_Tuple>() > = false> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr explicit pair(_Tuple&& __p) : first(std::__1::get<0>(std::__1::forward<_Tuple>(__p))), second(std::__1::get<1>(std::__1::forward<_Tuple>(__p))) {} template<class _Tuple, _EnableB< _CheckTLC<_Tuple>::template __enable_implicit<_Tuple>() > = false> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr pair(_Tuple&& __p) : first(std::__1::get<0>(std::__1::forward<_Tuple>(__p))), second(std::__1::get<1>(std::__1::forward<_Tuple>(__p))) {} template <class... _Args1, class... _Args2> __attribute__ ((__exclude_from_explicit_instantiation__)) pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, tuple<_Args2...> __second_args) noexcept((is_nothrow_constructible<first_type, _Args1...>::value && is_nothrow_constructible<second_type, _Args2...>::value)) : pair(__pc, __first_args, __second_args, typename __make_tuple_indices<sizeof...(_Args1)>::type(), typename __make_tuple_indices<sizeof...(_Args2) >::type()) {} __attribute__ ((__exclude_from_explicit_instantiation__)) pair& operator=(typename conditional< is_copy_assignable<first_type>::value && is_copy_assignable<second_type>::value, pair, __nat>::type const& __p) noexcept(is_nothrow_copy_assignable<first_type>::value && is_nothrow_copy_assignable<second_type>::value) { first = __p.first; second = __p.second; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) pair& operator=(typename conditional< is_move_assignable<first_type>::value && is_move_assignable<second_type>::value, pair, __nat>::type&& __p) noexcept(is_nothrow_move_assignable<first_type>::value && is_nothrow_move_assignable<second_type>::value) { first = std::__1::forward<first_type>(__p.first); second = std::__1::forward<second_type>(__p.second); return *this; } template <class _Tuple, _EnableB< _CheckTLC<_Tuple>::template __enable_assign<_Tuple>() > = false> __attribute__ ((__exclude_from_explicit_instantiation__)) pair& operator=(_Tuple&& __p) { first = std::__1::get<0>(std::__1::forward<_Tuple>(__p)); second = std::__1::get<1>(std::__1::forward<_Tuple>(__p)); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(pair& __p) noexcept(__is_nothrow_swappable<first_type>::value && __is_nothrow_swappable<second_type>::value) { using std::__1::swap; swap(first, __p.first); swap(second, __p.second); } private: template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2> __attribute__ ((__exclude_from_explicit_instantiation__)) pair(piecewise_construct_t, tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args, __tuple_indices<_I1...>, __tuple_indices<_I2...>); }; template <class _T1, class _T2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator==(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) { return __x.first == __y.first && __x.second == __y.second; } template <class _T1, class _T2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator!=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) { return !(__x == __y); } template <class _T1, class _T2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator< (const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) { return __x.first < __y.first || (!(__y.first < __x.first) && __x.second < __y.second); } template <class _T1, class _T2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator> (const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) { return __y < __x; } template <class _T1, class _T2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator>=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) { return !(__x < __y); } template <class _T1, class _T2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator<=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) { return !(__y < __x); } template <class _T1, class _T2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < __is_swappable<_T1>::value && __is_swappable<_T2>::value, void >::type swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) noexcept((__is_nothrow_swappable<_T1>::value && __is_nothrow_swappable<_T2>::value)) { __x.swap(__y); } template <class _Tp> struct __unwrap_reference { typedef __attribute__((nodebug)) _Tp type; }; template <class _Tp> struct __unwrap_reference<reference_wrapper<_Tp> > { typedef __attribute__((nodebug)) _Tp& type; }; template <class _Tp> struct __unwrap_ref_decay : __unwrap_reference<typename decay<_Tp>::type> { }; template <class _T1, class _T2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr pair<typename __unwrap_ref_decay<_T1>::type, typename __unwrap_ref_decay<_T2>::type> make_pair(_T1&& __t1, _T2&& __t2) { return pair<typename __unwrap_ref_decay<_T1>::type, typename __unwrap_ref_decay<_T2>::type> (std::__1::forward<_T1>(__t1), std::__1::forward<_T2>(__t2)); } template <class _T1, class _T2> struct tuple_size<pair<_T1, _T2> > : public integral_constant<size_t, 2> {}; template <size_t _Ip, class _T1, class _T2> struct tuple_element<_Ip, pair<_T1, _T2> > { static_assert(_Ip < 2, "Index out of bounds in std::tuple_element<std::pair<T1, T2>>"); }; template <class _T1, class _T2> struct tuple_element<0, pair<_T1, _T2> > { typedef __attribute__((nodebug)) _T1 type; }; template <class _T1, class _T2> struct tuple_element<1, pair<_T1, _T2> > { typedef __attribute__((nodebug)) _T2 type; }; template <size_t _Ip> struct __get_pair; template <> struct __get_pair<0> { template <class _T1, class _T2> static __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _T1& get(pair<_T1, _T2>& __p) noexcept {return __p.first;} template <class _T1, class _T2> static __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const _T1& get(const pair<_T1, _T2>& __p) noexcept {return __p.first;} template <class _T1, class _T2> static __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _T1&& get(pair<_T1, _T2>&& __p) noexcept {return std::__1::forward<_T1>(__p.first);} template <class _T1, class _T2> static __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const _T1&& get(const pair<_T1, _T2>&& __p) noexcept {return std::__1::forward<const _T1>(__p.first);} }; template <> struct __get_pair<1> { template <class _T1, class _T2> static __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _T2& get(pair<_T1, _T2>& __p) noexcept {return __p.second;} template <class _T1, class _T2> static __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const _T2& get(const pair<_T1, _T2>& __p) noexcept {return __p.second;} template <class _T1, class _T2> static __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _T2&& get(pair<_T1, _T2>&& __p) noexcept {return std::__1::forward<_T2>(__p.second);} template <class _T1, class _T2> static __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const _T2&& get(const pair<_T1, _T2>&& __p) noexcept {return std::__1::forward<const _T2>(__p.second);} }; template <size_t _Ip, class _T1, class _T2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename tuple_element<_Ip, pair<_T1, _T2> >::type& get(pair<_T1, _T2>& __p) noexcept { return __get_pair<_Ip>::get(__p); } template <size_t _Ip, class _T1, class _T2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const typename tuple_element<_Ip, pair<_T1, _T2> >::type& get(const pair<_T1, _T2>& __p) noexcept { return __get_pair<_Ip>::get(__p); } template <size_t _Ip, class _T1, class _T2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename tuple_element<_Ip, pair<_T1, _T2> >::type&& get(pair<_T1, _T2>&& __p) noexcept { return __get_pair<_Ip>::get(std::__1::move(__p)); } template <size_t _Ip, class _T1, class _T2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const typename tuple_element<_Ip, pair<_T1, _T2> >::type&& get(const pair<_T1, _T2>&& __p) noexcept { return __get_pair<_Ip>::get(std::__1::move(__p)); } template <class _T1, class _T2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _T1 & get(pair<_T1, _T2>& __p) noexcept { return __get_pair<0>::get(__p); } template <class _T1, class _T2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _T1 const & get(pair<_T1, _T2> const& __p) noexcept { return __get_pair<0>::get(__p); } template <class _T1, class _T2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _T1 && get(pair<_T1, _T2>&& __p) noexcept { return __get_pair<0>::get(std::__1::move(__p)); } template <class _T1, class _T2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _T1 const && get(pair<_T1, _T2> const&& __p) noexcept { return __get_pair<0>::get(std::__1::move(__p)); } template <class _T1, class _T2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _T1 & get(pair<_T2, _T1>& __p) noexcept { return __get_pair<1>::get(__p); } template <class _T1, class _T2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _T1 const & get(pair<_T2, _T1> const& __p) noexcept { return __get_pair<1>::get(__p); } template <class _T1, class _T2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _T1 && get(pair<_T2, _T1>&& __p) noexcept { return __get_pair<1>::get(std::__1::move(__p)); } template <class _T1, class _T2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _T1 const && get(pair<_T2, _T1> const&& __p) noexcept { return __get_pair<1>::get(std::__1::move(__p)); } template<class _Tp, _Tp... _Ip> struct integer_sequence { typedef _Tp value_type; static_assert( is_integral<_Tp>::value, "std::integer_sequence can only be instantiated with an integral type" ); static __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr size_t size() noexcept { return sizeof...(_Ip); } }; template<size_t... _Ip> using index_sequence = integer_sequence<size_t, _Ip...>; template <class _Tp, _Tp _Ep> using __make_integer_sequence __attribute__((nodebug)) = __make_integer_seq<integer_sequence, _Tp, _Ep>; template<class _Tp, _Tp _Np> using make_integer_sequence = __make_integer_sequence<_Tp, _Np>; template<size_t _Np> using make_index_sequence = make_integer_sequence<size_t, _Np>; template<class... _Tp> using index_sequence_for = make_index_sequence<sizeof...(_Tp)>; template<class _T1, class _T2 = _T1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _T1 exchange(_T1& __obj, _T2 && __new_value) { _T1 __old_value = std::__1::move(__obj); __obj = std::__1::forward<_T2>(__new_value); return __old_value; } template <class _Arg, class _Result> struct unary_function { typedef _Arg argument_type; typedef _Result result_type; }; template <class _Size> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _Size __loadword(const void* __p) { _Size __r; std::memcpy(&__r, __p, sizeof(__r)); return __r; } template <class _Size, size_t = sizeof(_Size)*8> struct __murmur2_or_cityhash; template <class _Size> struct __murmur2_or_cityhash<_Size, 32> { inline _Size operator()(const void* __key, _Size __len) __attribute__((__no_sanitize__("unsigned-integer-overflow"))); }; template <class _Size> _Size __murmur2_or_cityhash<_Size, 32>::operator()(const void* __key, _Size __len) { const _Size __m = 0x5bd1e995; const _Size __r = 24; _Size __h = __len; const unsigned char* __data = static_cast<const unsigned char*>(__key); for (; __len >= 4; __data += 4, __len -= 4) { _Size __k = __loadword<_Size>(__data); __k *= __m; __k ^= __k >> __r; __k *= __m; __h *= __m; __h ^= __k; } switch (__len) { case 3: __h ^= __data[2] << 16; [[clang::fallthrough]]; case 2: __h ^= __data[1] << 8; [[clang::fallthrough]]; case 1: __h ^= __data[0]; __h *= __m; } __h ^= __h >> 13; __h *= __m; __h ^= __h >> 15; return __h; } template <class _Size> struct __murmur2_or_cityhash<_Size, 64> { inline _Size operator()(const void* __key, _Size __len) __attribute__((__no_sanitize__("unsigned-integer-overflow"))); private: static const _Size __k0 = 0xc3a5c85c97cb3127ULL; static const _Size __k1 = 0xb492b66fbe98f273ULL; static const _Size __k2 = 0x9ae16a3b2f90404fULL; static const _Size __k3 = 0xc949d7c7509e6557ULL; static _Size __rotate(_Size __val, int __shift) { return __shift == 0 ? __val : ((__val >> __shift) | (__val << (64 - __shift))); } static _Size __rotate_by_at_least_1(_Size __val, int __shift) { return (__val >> __shift) | (__val << (64 - __shift)); } static _Size __shift_mix(_Size __val) { return __val ^ (__val >> 47); } static _Size __hash_len_16(_Size __u, _Size __v) __attribute__((__no_sanitize__("unsigned-integer-overflow"))) { const _Size __mul = 0x9ddfea08eb382d69ULL; _Size __a = (__u ^ __v) * __mul; __a ^= (__a >> 47); _Size __b = (__v ^ __a) * __mul; __b ^= (__b >> 47); __b *= __mul; return __b; } static _Size __hash_len_0_to_16(const char* __s, _Size __len) __attribute__((__no_sanitize__("unsigned-integer-overflow"))) { if (__len > 8) { const _Size __a = __loadword<_Size>(__s); const _Size __b = __loadword<_Size>(__s + __len - 8); return __hash_len_16(__a, __rotate_by_at_least_1(__b + __len, __len)) ^ __b; } if (__len >= 4) { const uint32_t __a = __loadword<uint32_t>(__s); const uint32_t __b = __loadword<uint32_t>(__s + __len - 4); return __hash_len_16(__len + (__a << 3), __b); } if (__len > 0) { const unsigned char __a = __s[0]; const unsigned char __b = __s[__len >> 1]; const unsigned char __c = __s[__len - 1]; const uint32_t __y = static_cast<uint32_t>(__a) + (static_cast<uint32_t>(__b) << 8); const uint32_t __z = __len + (static_cast<uint32_t>(__c) << 2); return __shift_mix(__y * __k2 ^ __z * __k3) * __k2; } return __k2; } static _Size __hash_len_17_to_32(const char *__s, _Size __len) __attribute__((__no_sanitize__("unsigned-integer-overflow"))) { const _Size __a = __loadword<_Size>(__s) * __k1; const _Size __b = __loadword<_Size>(__s + 8); const _Size __c = __loadword<_Size>(__s + __len - 8) * __k2; const _Size __d = __loadword<_Size>(__s + __len - 16) * __k0; return __hash_len_16(__rotate(__a - __b, 43) + __rotate(__c, 30) + __d, __a + __rotate(__b ^ __k3, 20) - __c + __len); } static pair<_Size, _Size> __weak_hash_len_32_with_seeds( _Size __w, _Size __x, _Size __y, _Size __z, _Size __a, _Size __b) __attribute__((__no_sanitize__("unsigned-integer-overflow"))) { __a += __w; __b = __rotate(__b + __a + __z, 21); const _Size __c = __a; __a += __x; __a += __y; __b += __rotate(__a, 44); return pair<_Size, _Size>(__a + __z, __b + __c); } static pair<_Size, _Size> __weak_hash_len_32_with_seeds( const char* __s, _Size __a, _Size __b) __attribute__((__no_sanitize__("unsigned-integer-overflow"))) { return __weak_hash_len_32_with_seeds(__loadword<_Size>(__s), __loadword<_Size>(__s + 8), __loadword<_Size>(__s + 16), __loadword<_Size>(__s + 24), __a, __b); } static _Size __hash_len_33_to_64(const char *__s, size_t __len) __attribute__((__no_sanitize__("unsigned-integer-overflow"))) { _Size __z = __loadword<_Size>(__s + 24); _Size __a = __loadword<_Size>(__s) + (__len + __loadword<_Size>(__s + __len - 16)) * __k0; _Size __b = __rotate(__a + __z, 52); _Size __c = __rotate(__a, 37); __a += __loadword<_Size>(__s + 8); __c += __rotate(__a, 7); __a += __loadword<_Size>(__s + 16); _Size __vf = __a + __z; _Size __vs = __b + __rotate(__a, 31) + __c; __a = __loadword<_Size>(__s + 16) + __loadword<_Size>(__s + __len - 32); __z += __loadword<_Size>(__s + __len - 8); __b = __rotate(__a + __z, 52); __c = __rotate(__a, 37); __a += __loadword<_Size>(__s + __len - 24); __c += __rotate(__a, 7); __a += __loadword<_Size>(__s + __len - 16); _Size __wf = __a + __z; _Size __ws = __b + __rotate(__a, 31) + __c; _Size __r = __shift_mix((__vf + __ws) * __k2 + (__wf + __vs) * __k0); return __shift_mix(__r * __k0 + __vs) * __k2; } }; template <class _Size> _Size __murmur2_or_cityhash<_Size, 64>::operator()(const void* __key, _Size __len) { const char* __s = static_cast<const char*>(__key); if (__len <= 32) { if (__len <= 16) { return __hash_len_0_to_16(__s, __len); } else { return __hash_len_17_to_32(__s, __len); } } else if (__len <= 64) { return __hash_len_33_to_64(__s, __len); } _Size __x = __loadword<_Size>(__s + __len - 40); _Size __y = __loadword<_Size>(__s + __len - 16) + __loadword<_Size>(__s + __len - 56); _Size __z = __hash_len_16(__loadword<_Size>(__s + __len - 48) + __len, __loadword<_Size>(__s + __len - 24)); pair<_Size, _Size> __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z); pair<_Size, _Size> __w = __weak_hash_len_32_with_seeds(__s + __len - 32, __y + __k1, __x); __x = __x * __k1 + __loadword<_Size>(__s); __len = (__len - 1) & ~static_cast<_Size>(63); do { __x = __rotate(__x + __y + __v.first + __loadword<_Size>(__s + 8), 37) * __k1; __y = __rotate(__y + __v.second + __loadword<_Size>(__s + 48), 42) * __k1; __x ^= __w.second; __y += __v.first + __loadword<_Size>(__s + 40); __z = __rotate(__z + __w.first, 33) * __k1; __v = __weak_hash_len_32_with_seeds(__s, __v.second * __k1, __x + __w.first); __w = __weak_hash_len_32_with_seeds(__s + 32, __z + __w.second, __y + __loadword<_Size>(__s + 16)); std::swap(__z, __x); __s += 64; __len -= 64; } while (__len != 0); return __hash_len_16( __hash_len_16(__v.first, __w.first) + __shift_mix(__y) * __k1 + __z, __hash_len_16(__v.second, __w.second) + __x); } template <class _Tp, size_t = sizeof(_Tp) / sizeof(size_t)> struct __scalar_hash; template <class _Tp> struct __scalar_hash<_Tp, 0> : public unary_function<_Tp, size_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(_Tp __v) const noexcept { union { _Tp __t; size_t __a; } __u; __u.__a = 0; __u.__t = __v; return __u.__a; } }; template <class _Tp> struct __scalar_hash<_Tp, 1> : public unary_function<_Tp, size_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(_Tp __v) const noexcept { union { _Tp __t; size_t __a; } __u; __u.__t = __v; return __u.__a; } }; template <class _Tp> struct __scalar_hash<_Tp, 2> : public unary_function<_Tp, size_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(_Tp __v) const noexcept { union { _Tp __t; struct { size_t __a; size_t __b; } __s; } __u; __u.__t = __v; return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u)); } }; template <class _Tp> struct __scalar_hash<_Tp, 3> : public unary_function<_Tp, size_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(_Tp __v) const noexcept { union { _Tp __t; struct { size_t __a; size_t __b; size_t __c; } __s; } __u; __u.__t = __v; return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u)); } }; template <class _Tp> struct __scalar_hash<_Tp, 4> : public unary_function<_Tp, size_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(_Tp __v) const noexcept { union { _Tp __t; struct { size_t __a; size_t __b; size_t __c; size_t __d; } __s; } __u; __u.__t = __v; return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u)); } }; struct _PairT { size_t first; size_t second; }; __attribute__ ((__exclude_from_explicit_instantiation__)) inline size_t __hash_combine(size_t __lhs, size_t __rhs) noexcept { typedef __scalar_hash<_PairT> _HashT; const _PairT __p = {__lhs, __rhs}; return _HashT()(__p); } template<class _Tp> struct hash<_Tp*> : public unary_function<_Tp*, size_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(_Tp* __v) const noexcept { union { _Tp* __t; size_t __a; } __u; __u.__t = __v; return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u)); } }; template <> struct hash<bool> : public unary_function<bool, size_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(bool __v) const noexcept {return static_cast<size_t>(__v);} }; template <> struct hash<char> : public unary_function<char, size_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(char __v) const noexcept {return static_cast<size_t>(__v);} }; template <> struct hash<signed char> : public unary_function<signed char, size_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(signed char __v) const noexcept {return static_cast<size_t>(__v);} }; template <> struct hash<unsigned char> : public unary_function<unsigned char, size_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(unsigned char __v) const noexcept {return static_cast<size_t>(__v);} }; template <> struct hash<char16_t> : public unary_function<char16_t, size_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(char16_t __v) const noexcept {return static_cast<size_t>(__v);} }; template <> struct hash<char32_t> : public unary_function<char32_t, size_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(char32_t __v) const noexcept {return static_cast<size_t>(__v);} }; template <> struct hash<wchar_t> : public unary_function<wchar_t, size_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(wchar_t __v) const noexcept {return static_cast<size_t>(__v);} }; template <> struct hash<short> : public unary_function<short, size_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(short __v) const noexcept {return static_cast<size_t>(__v);} }; template <> struct hash<unsigned short> : public unary_function<unsigned short, size_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(unsigned short __v) const noexcept {return static_cast<size_t>(__v);} }; template <> struct hash<int> : public unary_function<int, size_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(int __v) const noexcept {return static_cast<size_t>(__v);} }; template <> struct hash<unsigned int> : public unary_function<unsigned int, size_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(unsigned int __v) const noexcept {return static_cast<size_t>(__v);} }; template <> struct hash<long> : public unary_function<long, size_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(long __v) const noexcept {return static_cast<size_t>(__v);} }; template <> struct hash<unsigned long> : public unary_function<unsigned long, size_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(unsigned long __v) const noexcept {return static_cast<size_t>(__v);} }; template <> struct hash<long long> : public __scalar_hash<long long> { }; template <> struct hash<unsigned long long> : public __scalar_hash<unsigned long long> { }; template <> struct hash<__int128_t> : public __scalar_hash<__int128_t> { }; template <> struct hash<__uint128_t> : public __scalar_hash<__uint128_t> { }; template <> struct hash<float> : public __scalar_hash<float> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(float __v) const noexcept { if (__v == 0.0f) return 0; return __scalar_hash<float>::operator()(__v); } }; template <> struct hash<double> : public __scalar_hash<double> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(double __v) const noexcept { if (__v == 0.0) return 0; return __scalar_hash<double>::operator()(__v); } }; template <> struct hash<long double> : public __scalar_hash<long double> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(long double __v) const noexcept { if (__v == 0.0L) return 0; union { long double __t; struct { size_t __a; size_t __b; } __s; } __u; __u.__s.__a = 0; __u.__s.__b = 0; __u.__t = __v; return __u.__s.__a ^ __u.__s.__b; } }; template <class _Tp, bool = is_enum<_Tp>::value> struct __enum_hash : public unary_function<_Tp, size_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(_Tp __v) const noexcept { typedef typename underlying_type<_Tp>::type type; return hash<type>{}(static_cast<type>(__v)); } }; template <class _Tp> struct __enum_hash<_Tp, false> { __enum_hash() = delete; __enum_hash(__enum_hash const&) = delete; __enum_hash& operator=(__enum_hash const&) = delete; }; template <class _Tp> struct hash : public __enum_hash<_Tp> { }; template <class _Key, class _Hash> using __check_hash_requirements __attribute__((nodebug)) = integral_constant<bool, is_copy_constructible<_Hash>::value && is_move_constructible<_Hash>::value && __invokable_r<size_t, _Hash, _Key const&>::value >; template <class _Key, class _Hash = std::hash<_Key> > using __has_enabled_hash __attribute__((nodebug)) = integral_constant<bool, __check_hash_requirements<_Key, _Hash>::value && is_default_constructible<_Hash>::value >; template <class _Type, class ...> using __enable_hash_helper __attribute__((nodebug)) = _Type; } } namespace std { inline namespace __1 { using ::size_t; using ::div_t; using ::ldiv_t; using ::lldiv_t; using ::atof; using ::atoi; using ::atol; using ::atoll; using ::strtod; using ::strtof; using ::strtold; using ::strtol; using ::strtoll; using ::strtoul; using ::strtoull; using ::rand; using ::srand; using ::calloc; using ::free; using ::malloc; using ::realloc; using ::abort; using ::atexit; using ::exit; using ::_Exit; using ::getenv; using ::system; using ::bsearch; using ::qsort; using ::abs; using ::labs; using ::llabs; using ::div; using ::ldiv; using ::lldiv; using ::mblen; using ::mbtowc; using ::wctomb; using ::mbstowcs; using ::wcstombs; using ::at_quick_exit; using ::quick_exit; } } #pragma pack(push, 8) extern "C" { typedef void (__cdecl* terminate_handler )(); typedef void (__cdecl* terminate_function)(); __declspec(noreturn) void __cdecl abort(); __declspec(noreturn) void __cdecl terminate() throw(); terminate_handler __cdecl set_terminate( terminate_handler _NewTerminateHandler ) throw(); terminate_handler __cdecl _get_terminate(); } #pragma pack(pop) #pragma pack(push, 8) extern "C" { typedef void (__cdecl* unexpected_handler )(); typedef void (__cdecl* unexpected_function)(); 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 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) namespace std { typedef void (*unexpected_handler)(); unexpected_handler set_unexpected(unexpected_handler) noexcept; unexpected_handler get_unexpected() noexcept; [[noreturn]] void unexpected(); typedef void (*terminate_handler)(); terminate_handler set_terminate(terminate_handler) noexcept; terminate_handler get_terminate() noexcept; [[noreturn]] void terminate() noexcept; bool uncaught_exception() noexcept; int uncaught_exceptions() noexcept; class exception_ptr; exception_ptr current_exception() noexcept; [[noreturn]] void rethrow_exception(exception_ptr); class exception_ptr { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunused-private-field" void* __ptr1_; void* __ptr2_; #pragma clang diagnostic pop public: exception_ptr() noexcept; exception_ptr(nullptr_t) noexcept; exception_ptr(const exception_ptr& __other) noexcept; exception_ptr& operator=(const exception_ptr& __other) noexcept; exception_ptr& operator=(nullptr_t) noexcept; ~exception_ptr() noexcept; explicit operator bool() const noexcept; }; bool operator==(const exception_ptr& __x, const exception_ptr& __y) noexcept; inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const exception_ptr& __x, const exception_ptr& __y) noexcept {return !(__x == __y);} void swap(exception_ptr&, exception_ptr&) noexcept; exception_ptr __copy_exception_ptr(void *__except, const void* __ptr); exception_ptr current_exception() noexcept; [[noreturn]] void rethrow_exception(exception_ptr p); template <class _E> void *__GetExceptionInfo(_E); template<class _Ep> __attribute__ ((__exclude_from_explicit_instantiation__)) exception_ptr make_exception_ptr(_Ep __e) noexcept { return __copy_exception_ptr(std::__1::addressof(__e), __GetExceptionInfo(__e)); } class nested_exception { exception_ptr __ptr_; public: nested_exception() noexcept; virtual ~nested_exception() noexcept; [[noreturn]] void rethrow_nested() const; __attribute__ ((__exclude_from_explicit_instantiation__)) exception_ptr nested_ptr() const noexcept {return __ptr_;} }; template <class _Tp> struct __nested : public _Tp, public nested_exception { __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __nested(const _Tp& __t) : _Tp(__t) {} }; template <class _Tp> [[noreturn]] void throw_with_nested(_Tp&& __t) { ((void)__t); } template <class _From, class _To> struct __can_dynamic_cast : public integral_constant<bool,(is_polymorphic<_From>::value && (!is_base_of<_To, _From>::value || is_convertible<const _From*, const _To*>::value))> {}; template <class _Ep> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void rethrow_if_nested(const _Ep& __e, typename enable_if< __can_dynamic_cast<_Ep, nested_exception>::value>::type* = 0) { const nested_exception* __nep = dynamic_cast<const nested_exception*>(std::__1::addressof(__e)); if (__nep) __nep->rethrow_nested(); } template <class _Ep> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void rethrow_if_nested(const _Ep&, typename enable_if<!__can_dynamic_cast<_Ep, nested_exception>::value>::type* = 0) { } } #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 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) namespace std { inline namespace __1 { [[noreturn]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __throw_bad_cast() { std::__1::abort(); } } } extern "C++" { #pragma pack(push, 8) #pragma warning(push) #pragma warning(disable: 4985) 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; #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 warning(pop) #pragma pack(pop) } 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) } namespace std { typedef void (__cdecl* new_handler)(); new_handler __cdecl set_new_handler( new_handler _NewHandler) throw(); } using std::new_handler; using std::set_new_handler; #pragma pack(push, 8) extern "C" { typedef int (__cdecl* _PNH)(size_t); _PNH __cdecl _query_new_handler(void); _PNH __cdecl _set_new_handler( _PNH _NewHandler); int __cdecl _query_new_mode(void); int __cdecl _set_new_mode( int _NewMode); } #pragma pack(pop) namespace std { [[noreturn]] void __throw_bad_alloc(); } namespace std { inline namespace __1 { constexpr inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool __is_overaligned_for_new(size_t __align) noexcept { return __align > 16ULL; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void *__libcpp_allocate(size_t __size, size_t __align) { ((void)__align); return __builtin_operator_new(__size); } struct _DeallocateCaller { static inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __do_deallocate_handle_size_align(void *__ptr, size_t __size, size_t __align) { ((void)__align); return __do_deallocate_handle_size(__ptr, __size); } static inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __do_deallocate_handle_align(void *__ptr, size_t __align) { ((void)__align); return __do_call(__ptr); } private: static inline void __do_deallocate_handle_size(void *__ptr, size_t __size) { ((void)__size); return __do_call(__ptr); } private: template <class _A1, class _A2> static inline void __do_call(void *__ptr, _A1 __a1, _A2 __a2) { return __builtin_operator_delete(__ptr, __a1, __a2); } template <class _A1> static inline void __do_call(void *__ptr, _A1 __a1) { return __builtin_operator_delete(__ptr, __a1); } static inline void __do_call(void *__ptr) { return __builtin_operator_delete(__ptr); } }; inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __libcpp_deallocate(void* __ptr, size_t __size, size_t __align) { _DeallocateCaller::__do_deallocate_handle_size_align(__ptr, __size, __align); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __libcpp_deallocate_unsized(void* __ptr, size_t __align) { _DeallocateCaller::__do_deallocate_handle_align(__ptr, __align); } template <class _Tp> [[nodiscard]] inline constexpr _Tp* __launder(_Tp* __p) noexcept { static_assert (!(is_function<_Tp>::value), "can't launder functions" ); static_assert (!(is_same<void, typename remove_cv<_Tp>::type>::value), "can't launder cv-void" ); return __builtin_launder(__p); } } } namespace std { inline namespace __1 { template <class _Arg1, class _Arg2, class _Result> struct binary_function { typedef _Arg1 first_argument_type; typedef _Arg2 second_argument_type; typedef _Result result_type; }; template <class _Tp> struct __has_result_type { private: struct __two {char __lx; char __lxx;}; template <class _Up> static __two __test(...); template <class _Up> static char __test(typename _Up::result_type* = 0); public: static const bool value = sizeof(__test<_Tp>(0)) == 1; }; template <class _Tp = void> struct less : binary_function<_Tp, _Tp, bool> { constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const _Tp& __x, const _Tp& __y) const {return __x < __y;} }; template <> struct less<void> { template <class _T1, class _T2> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) auto operator()(_T1&& __t, _T2&& __u) const noexcept(noexcept(std::__1::forward<_T1>(__t) < std::__1::forward<_T2>(__u))) -> decltype (std::__1::forward<_T1>(__t) < std::__1::forward<_T2>(__u)) { return std::__1::forward<_T1>(__t) < std::__1::forward<_T2>(__u); } typedef void is_transparent; }; template <class _Tp> struct __derives_from_unary_function { private: struct __two {char __lx; char __lxx;}; static __two __test(...); template <class _Ap, class _Rp> static unary_function<_Ap, _Rp> __test(const volatile unary_function<_Ap, _Rp>*); public: static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value; typedef decltype(__test((_Tp*)0)) type; }; template <class _Tp> struct __derives_from_binary_function { private: struct __two {char __lx; char __lxx;}; static __two __test(...); template <class _A1, class _A2, class _Rp> static binary_function<_A1, _A2, _Rp> __test(const volatile binary_function<_A1, _A2, _Rp>*); public: static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value; typedef decltype(__test((_Tp*)0)) type; }; template <class _Tp, bool = __derives_from_unary_function<_Tp>::value> struct __maybe_derive_from_unary_function : public __derives_from_unary_function<_Tp>::type { }; template <class _Tp> struct __maybe_derive_from_unary_function<_Tp, false> { }; template <class _Tp, bool = __derives_from_binary_function<_Tp>::value> struct __maybe_derive_from_binary_function : public __derives_from_binary_function<_Tp>::type { }; template <class _Tp> struct __maybe_derive_from_binary_function<_Tp, false> { }; template <class _Tp, bool = __has_result_type<_Tp>::value> struct __weak_result_type_imp : public __maybe_derive_from_unary_function<_Tp>, public __maybe_derive_from_binary_function<_Tp> { typedef __attribute__((nodebug)) typename _Tp::result_type result_type; }; template <class _Tp> struct __weak_result_type_imp<_Tp, false> : public __maybe_derive_from_unary_function<_Tp>, public __maybe_derive_from_binary_function<_Tp> { }; template <class _Tp> struct __weak_result_type : public __weak_result_type_imp<_Tp> { }; template <class _Rp> struct __weak_result_type<_Rp ()> { typedef __attribute__((nodebug)) _Rp result_type; }; template <class _Rp> struct __weak_result_type<_Rp (&)()> { typedef __attribute__((nodebug)) _Rp result_type; }; template <class _Rp> struct __weak_result_type<_Rp (*)()> { typedef __attribute__((nodebug)) _Rp result_type; }; template <class _Rp, class _A1> struct __weak_result_type<_Rp (_A1)> : public unary_function<_A1, _Rp> { }; template <class _Rp, class _A1> struct __weak_result_type<_Rp (&)(_A1)> : public unary_function<_A1, _Rp> { }; template <class _Rp, class _A1> struct __weak_result_type<_Rp (*)(_A1)> : public unary_function<_A1, _Rp> { }; template <class _Rp, class _Cp> struct __weak_result_type<_Rp (_Cp::*)()> : public unary_function<_Cp*, _Rp> { }; template <class _Rp, class _Cp> struct __weak_result_type<_Rp (_Cp::*)() const> : public unary_function<const _Cp*, _Rp> { }; template <class _Rp, class _Cp> struct __weak_result_type<_Rp (_Cp::*)() volatile> : public unary_function<volatile _Cp*, _Rp> { }; template <class _Rp, class _Cp> struct __weak_result_type<_Rp (_Cp::*)() const volatile> : public unary_function<const volatile _Cp*, _Rp> { }; template <class _Rp, class _A1, class _A2> struct __weak_result_type<_Rp (_A1, _A2)> : public binary_function<_A1, _A2, _Rp> { }; template <class _Rp, class _A1, class _A2> struct __weak_result_type<_Rp (*)(_A1, _A2)> : public binary_function<_A1, _A2, _Rp> { }; template <class _Rp, class _A1, class _A2> struct __weak_result_type<_Rp (&)(_A1, _A2)> : public binary_function<_A1, _A2, _Rp> { }; template <class _Rp, class _Cp, class _A1> struct __weak_result_type<_Rp (_Cp::*)(_A1)> : public binary_function<_Cp*, _A1, _Rp> { }; template <class _Rp, class _Cp, class _A1> struct __weak_result_type<_Rp (_Cp::*)(_A1) const> : public binary_function<const _Cp*, _A1, _Rp> { }; template <class _Rp, class _Cp, class _A1> struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile> : public binary_function<volatile _Cp*, _A1, _Rp> { }; template <class _Rp, class _Cp, class _A1> struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile> : public binary_function<const volatile _Cp*, _A1, _Rp> { }; template <class _Rp, class _A1, class _A2, class _A3, class ..._A4> struct __weak_result_type<_Rp (_A1, _A2, _A3, _A4...)> { typedef _Rp result_type; }; template <class _Rp, class _A1, class _A2, class _A3, class ..._A4> struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)> { typedef _Rp result_type; }; template <class _Rp, class _A1, class _A2, class _A3, class ..._A4> struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)> { typedef _Rp result_type; }; template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3> struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)> { typedef _Rp result_type; }; template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3> struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const> { typedef _Rp result_type; }; template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3> struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile> { typedef _Rp result_type; }; template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3> struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile> { typedef _Rp result_type; }; template <class _Tp, class ..._Args> struct __invoke_return { typedef decltype(__invoke(std::__1::declval<_Tp>(), std::__1::declval<_Args>()...)) type; }; template <class _Ret> struct __invoke_void_return_wrapper { template <class ..._Args> static _Ret __call(_Args&&... __args) { return __invoke(std::__1::forward<_Args>(__args)...); } }; template <> struct __invoke_void_return_wrapper<void> { template <class ..._Args> static void __call(_Args&&... __args) { __invoke(std::__1::forward<_Args>(__args)...); } }; template <class _Tp> class reference_wrapper : public __weak_result_type<_Tp> { public: typedef _Tp type; private: type* __f_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) reference_wrapper(type& __f) noexcept : __f_(std::__1::addressof(__f)) {} private: reference_wrapper(type&&); public: __attribute__ ((__exclude_from_explicit_instantiation__)) operator type& () const noexcept {return *__f_;} __attribute__ ((__exclude_from_explicit_instantiation__)) type& get() const noexcept {return *__f_;} template <class... _ArgTypes> __attribute__ ((__exclude_from_explicit_instantiation__)) typename __invoke_of<type&, _ArgTypes...>::type operator() (_ArgTypes&&... __args) const { return __invoke(get(), std::__1::forward<_ArgTypes>(__args)...); } }; template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) reference_wrapper<_Tp> ref(_Tp& __t) noexcept { return reference_wrapper<_Tp>(__t); } template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) reference_wrapper<_Tp> ref(reference_wrapper<_Tp> __t) noexcept { return ref(__t.get()); } template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) reference_wrapper<const _Tp> cref(const _Tp& __t) noexcept { return reference_wrapper<const _Tp>(__t); } template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) reference_wrapper<const _Tp> cref(reference_wrapper<_Tp> __t) noexcept { return cref(__t.get()); } template <class _Tp> void ref(const _Tp&&) = delete; template <class _Tp> void cref(const _Tp&&) = delete; template <class _Tp, class, class = void> struct __is_transparent : false_type {}; template <class _Tp, class _Up> struct __is_transparent<_Tp, _Up, typename __void_t<typename _Tp::is_transparent>::type> : true_type {}; struct allocator_arg_t { explicit allocator_arg_t() = default; }; constexpr allocator_arg_t allocator_arg = allocator_arg_t(); template <class _Tp> struct __has_allocator_type { private: struct __two {char __lx; char __lxx;}; template <class _Up> static __two __test(...); template <class _Up> static char __test(typename _Up::allocator_type* = 0); public: static const bool value = sizeof(__test<_Tp>(0)) == 1; }; template <class _Tp, class _Alloc, bool = __has_allocator_type<_Tp>::value> struct __uses_allocator : public integral_constant<bool, is_convertible<_Alloc, typename _Tp::allocator_type>::value> { }; template <class _Tp, class _Alloc> struct __uses_allocator<_Tp, _Alloc, false> : public false_type { }; template <class _Tp, class _Alloc> struct uses_allocator : public __uses_allocator<_Tp, _Alloc> { }; template <class _Tp, class _Alloc, class ..._Args> struct __uses_alloc_ctor_imp { typedef __attribute__((nodebug)) typename __uncvref<_Alloc>::type _RawAlloc; static const bool __ua = uses_allocator<_Tp, _RawAlloc>::value; static const bool __ic = is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value; static const int value = __ua ? 2 - __ic : 0; }; template <class _Tp, class _Alloc, class ..._Args> struct __uses_alloc_ctor : integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value> {}; template <class _Tp, class _Allocator, class... _Args> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __user_alloc_construct_impl (integral_constant<int, 0>, _Tp *__storage, const _Allocator &, _Args &&... __args ) { new (__storage) _Tp (std::__1::forward<_Args>(__args)...); } template <class _Tp, class _Allocator, class... _Args> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __user_alloc_construct_impl (integral_constant<int, 1>, _Tp *__storage, const _Allocator &__a, _Args &&... __args ) { new (__storage) _Tp (allocator_arg, __a, std::__1::forward<_Args>(__args)...); } template <class _Tp, class _Allocator, class... _Args> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __user_alloc_construct_impl (integral_constant<int, 2>, _Tp *__storage, const _Allocator &__a, _Args &&... __args ) { new (__storage) _Tp (std::__1::forward<_Args>(__args)..., __a); } } } namespace std { inline namespace __1 { struct input_iterator_tag {}; struct output_iterator_tag {}; struct forward_iterator_tag : public input_iterator_tag {}; struct bidirectional_iterator_tag : public forward_iterator_tag {}; struct random_access_iterator_tag : public bidirectional_iterator_tag {}; template <class _Tp> struct __has_iterator_typedefs { private: struct __two {char __lx; char __lxx;}; template <class _Up> static __two __test(...); template <class _Up> static char __test(typename std::__void_t<typename _Up::iterator_category>::type* = 0, typename std::__void_t<typename _Up::difference_type>::type* = 0, typename std::__void_t<typename _Up::value_type>::type* = 0, typename std::__void_t<typename _Up::reference>::type* = 0, typename std::__void_t<typename _Up::pointer>::type* = 0 ); public: static const bool value = sizeof(__test<_Tp>(0,0,0,0,0)) == 1; }; template <class _Tp> struct __has_iterator_category { private: struct __two {char __lx; char __lxx;}; template <class _Up> static __two __test(...); template <class _Up> static char __test(typename _Up::iterator_category* = 0); public: static const bool value = sizeof(__test<_Tp>(0)) == 1; }; template <class _Iter, bool> struct __iterator_traits_impl {}; template <class _Iter> struct __iterator_traits_impl<_Iter, true> { typedef typename _Iter::difference_type difference_type; typedef typename _Iter::value_type value_type; typedef typename _Iter::pointer pointer; typedef typename _Iter::reference reference; typedef typename _Iter::iterator_category iterator_category; }; template <class _Iter, bool> struct __iterator_traits {}; template <class _Iter> struct __iterator_traits<_Iter, true> : __iterator_traits_impl < _Iter, is_convertible<typename _Iter::iterator_category, input_iterator_tag>::value || is_convertible<typename _Iter::iterator_category, output_iterator_tag>::value > {}; template <class _Iter> struct iterator_traits : __iterator_traits<_Iter, __has_iterator_typedefs<_Iter>::value> {}; template<class _Tp> struct iterator_traits<_Tp*> { typedef ptrdiff_t difference_type; typedef typename remove_cv<_Tp>::type value_type; typedef _Tp* pointer; typedef _Tp& reference; typedef random_access_iterator_tag iterator_category; }; template <class _Tp, class _Up, bool = __has_iterator_category<iterator_traits<_Tp> >::value> struct __has_iterator_category_convertible_to : public integral_constant<bool, is_convertible<typename iterator_traits<_Tp>::iterator_category, _Up>::value> {}; template <class _Tp, class _Up> struct __has_iterator_category_convertible_to<_Tp, _Up, false> : public false_type {}; template <class _Tp> struct __is_input_iterator : public __has_iterator_category_convertible_to<_Tp, input_iterator_tag> {}; template <class _Tp> struct __is_forward_iterator : public __has_iterator_category_convertible_to<_Tp, forward_iterator_tag> {}; template <class _Tp> struct __is_bidirectional_iterator : public __has_iterator_category_convertible_to<_Tp, bidirectional_iterator_tag> {}; template <class _Tp> struct __is_random_access_iterator : public __has_iterator_category_convertible_to<_Tp, random_access_iterator_tag> {}; template <class _Tp> struct __is_exactly_input_iterator : public integral_constant<bool, __has_iterator_category_convertible_to<_Tp, input_iterator_tag>::value && !__has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value> {}; template<class _Category, class _Tp, class _Distance = ptrdiff_t, class _Pointer = _Tp*, class _Reference = _Tp&> struct iterator { typedef _Tp value_type; typedef _Distance difference_type; typedef _Pointer pointer; typedef _Reference reference; typedef _Category iterator_category; }; template <class _InputIter> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __advance(_InputIter& __i, typename iterator_traits<_InputIter>::difference_type __n, input_iterator_tag) { for (; __n > 0; --__n) ++__i; } template <class _BiDirIter> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __advance(_BiDirIter& __i, typename iterator_traits<_BiDirIter>::difference_type __n, bidirectional_iterator_tag) { if (__n >= 0) for (; __n > 0; --__n) ++__i; else for (; __n < 0; ++__n) --__i; } template <class _RandIter> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __advance(_RandIter& __i, typename iterator_traits<_RandIter>::difference_type __n, random_access_iterator_tag) { __i += __n; } template <class _InputIter> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void advance(_InputIter& __i, typename iterator_traits<_InputIter>::difference_type __n) { ((void)0); __advance(__i, __n, typename iterator_traits<_InputIter>::iterator_category()); } template <class _InputIter> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename iterator_traits<_InputIter>::difference_type __distance(_InputIter __first, _InputIter __last, input_iterator_tag) { typename iterator_traits<_InputIter>::difference_type __r(0); for (; __first != __last; ++__first) ++__r; return __r; } template <class _RandIter> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename iterator_traits<_RandIter>::difference_type __distance(_RandIter __first, _RandIter __last, random_access_iterator_tag) { return __last - __first; } template <class _InputIter> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename iterator_traits<_InputIter>::difference_type distance(_InputIter __first, _InputIter __last) { return __distance(__first, __last, typename iterator_traits<_InputIter>::iterator_category()); } template <class _InputIter> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < __is_input_iterator<_InputIter>::value, _InputIter >::type next(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = 1) { ((void)0); std::__1::advance(__x, __n); return __x; } template <class _InputIter> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < __is_input_iterator<_InputIter>::value, _InputIter >::type prev(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = 1) { ((void)0); std::__1::advance(__x, -__n); return __x; } template <class _Tp, class = void> struct __is_stashing_iterator : false_type {}; template <class _Tp> struct __is_stashing_iterator<_Tp, typename __void_t<typename _Tp::__stashing_iterator_tag>::type> : true_type {}; template <class _Iter> class reverse_iterator : public iterator<typename iterator_traits<_Iter>::iterator_category, typename iterator_traits<_Iter>::value_type, typename iterator_traits<_Iter>::difference_type, typename iterator_traits<_Iter>::pointer, typename iterator_traits<_Iter>::reference> { private: _Iter __t; static_assert(!__is_stashing_iterator<_Iter>::value, "The specified iterator type cannot be used with reverse_iterator; " "Using stashing iterators with reverse_iterator causes undefined behavior"); protected: _Iter current; public: typedef _Iter iterator_type; typedef typename iterator_traits<_Iter>::difference_type difference_type; typedef typename iterator_traits<_Iter>::reference reference; typedef typename iterator_traits<_Iter>::pointer pointer; __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator() : __t(), current() {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit reverse_iterator(_Iter __x) : __t(__x), current(__x) {} template <class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator(const reverse_iterator<_Up>& __u) : __t(__u.base()), current(__u.base()) {} template <class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator& operator=(const reverse_iterator<_Up>& __u) { __t = current = __u.base(); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) _Iter base() const {return current;} __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator*() const {_Iter __tmp = current; return *--__tmp;} __attribute__ ((__exclude_from_explicit_instantiation__)) pointer operator->() const {return std::__1::addressof(operator*());} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator& operator++() {--current; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator operator++(int) {reverse_iterator __tmp(*this); --current; return __tmp;} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator& operator--() {++current; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator operator--(int) {reverse_iterator __tmp(*this); ++current; return __tmp;} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator operator+ (difference_type __n) const {return reverse_iterator(current - __n);} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator& operator+=(difference_type __n) {current -= __n; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator operator- (difference_type __n) const {return reverse_iterator(current + __n);} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator& operator-=(difference_type __n) {current += __n; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator[](difference_type __n) const {return *(*this + __n);} }; template <class _Iter1, class _Iter2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) { return __x.base() == __y.base(); } template <class _Iter1, class _Iter2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) { return __x.base() > __y.base(); } template <class _Iter1, class _Iter2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) { return __x.base() != __y.base(); } template <class _Iter1, class _Iter2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) { return __x.base() < __y.base(); } template <class _Iter1, class _Iter2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) { return __x.base() <= __y.base(); } template <class _Iter1, class _Iter2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) { return __x.base() >= __y.base(); } template <class _Iter1, class _Iter2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) auto operator-(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) -> decltype(__y.base() - __x.base()) { return __y.base() - __x.base(); } template <class _Iter> inline __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator<_Iter> operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_iterator<_Iter>& __x) { return reverse_iterator<_Iter>(__x.base() - __n); } template <class _Iter> inline __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator<_Iter> make_reverse_iterator(_Iter __i) { return reverse_iterator<_Iter>(__i); } template <class _Container> class back_insert_iterator : public iterator<output_iterator_tag, void, void, void, void> { protected: _Container* container; public: typedef _Container container_type; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit back_insert_iterator(_Container& __x) : container(std::__1::addressof(__x)) {} __attribute__ ((__exclude_from_explicit_instantiation__)) back_insert_iterator& operator=(const typename _Container::value_type& __value_) {container->push_back(__value_); return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) back_insert_iterator& operator=(typename _Container::value_type&& __value_) {container->push_back(std::__1::move(__value_)); return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) back_insert_iterator& operator*() {return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) back_insert_iterator& operator++() {return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) back_insert_iterator operator++(int) {return *this;} }; template <class _Container> inline __attribute__ ((__exclude_from_explicit_instantiation__)) back_insert_iterator<_Container> back_inserter(_Container& __x) { return back_insert_iterator<_Container>(__x); } template <class _Container> class front_insert_iterator : public iterator<output_iterator_tag, void, void, void, void> { protected: _Container* container; public: typedef _Container container_type; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit front_insert_iterator(_Container& __x) : container(std::__1::addressof(__x)) {} __attribute__ ((__exclude_from_explicit_instantiation__)) front_insert_iterator& operator=(const typename _Container::value_type& __value_) {container->push_front(__value_); return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) front_insert_iterator& operator=(typename _Container::value_type&& __value_) {container->push_front(std::__1::move(__value_)); return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) front_insert_iterator& operator*() {return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) front_insert_iterator& operator++() {return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) front_insert_iterator operator++(int) {return *this;} }; template <class _Container> inline __attribute__ ((__exclude_from_explicit_instantiation__)) front_insert_iterator<_Container> front_inserter(_Container& __x) { return front_insert_iterator<_Container>(__x); } template <class _Container> class insert_iterator : public iterator<output_iterator_tag, void, void, void, void> { protected: _Container* container; typename _Container::iterator iter; public: typedef _Container container_type; __attribute__ ((__exclude_from_explicit_instantiation__)) insert_iterator(_Container& __x, typename _Container::iterator __i) : container(std::__1::addressof(__x)), iter(__i) {} __attribute__ ((__exclude_from_explicit_instantiation__)) insert_iterator& operator=(const typename _Container::value_type& __value_) {iter = container->insert(iter, __value_); ++iter; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) insert_iterator& operator=(typename _Container::value_type&& __value_) {iter = container->insert(iter, std::__1::move(__value_)); ++iter; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) insert_iterator& operator*() {return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) insert_iterator& operator++() {return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) insert_iterator& operator++(int) {return *this;} }; template <class _Container> inline __attribute__ ((__exclude_from_explicit_instantiation__)) insert_iterator<_Container> inserter(_Container& __x, typename _Container::iterator __i) { return insert_iterator<_Container>(__x, __i); } template <class _Tp, class _CharT = char, class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t> class istream_iterator : public iterator<input_iterator_tag, _Tp, _Distance, const _Tp*, const _Tp&> { public: typedef _CharT char_type; typedef _Traits traits_type; typedef basic_istream<_CharT,_Traits> istream_type; private: istream_type* __in_stream_; _Tp __value_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr istream_iterator() : __in_stream_(0), __value_() {} __attribute__ ((__exclude_from_explicit_instantiation__)) istream_iterator(istream_type& __s) : __in_stream_(std::__1::addressof(__s)) { if (!(*__in_stream_ >> __value_)) __in_stream_ = 0; } __attribute__ ((__exclude_from_explicit_instantiation__)) const _Tp& operator*() const {return __value_;} __attribute__ ((__exclude_from_explicit_instantiation__)) const _Tp* operator->() const {return std::__1::addressof((operator*()));} __attribute__ ((__exclude_from_explicit_instantiation__)) istream_iterator& operator++() { if (!(*__in_stream_ >> __value_)) __in_stream_ = 0; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) istream_iterator operator++(int) {istream_iterator __t(*this); ++(*this); return __t;} template <class _Up, class _CharU, class _TraitsU, class _DistanceU> friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const istream_iterator<_Up, _CharU, _TraitsU, _DistanceU>& __x, const istream_iterator<_Up, _CharU, _TraitsU, _DistanceU>& __y); template <class _Up, class _CharU, class _TraitsU, class _DistanceU> friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const istream_iterator<_Up, _CharU, _TraitsU, _DistanceU>& __x, const istream_iterator<_Up, _CharU, _TraitsU, _DistanceU>& __y); }; template <class _Tp, class _CharT, class _Traits, class _Distance> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __x, const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __y) { return __x.__in_stream_ == __y.__in_stream_; } template <class _Tp, class _CharT, class _Traits, class _Distance> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __x, const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __y) { return !(__x == __y); } template <class _Tp, class _CharT = char, class _Traits = char_traits<_CharT> > class ostream_iterator : public iterator<output_iterator_tag, void, void, void, void> { public: typedef _CharT char_type; typedef _Traits traits_type; typedef basic_ostream<_CharT,_Traits> ostream_type; private: ostream_type* __out_stream_; const char_type* __delim_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) ostream_iterator(ostream_type& __s) noexcept : __out_stream_(std::__1::addressof(__s)), __delim_(0) {} __attribute__ ((__exclude_from_explicit_instantiation__)) ostream_iterator(ostream_type& __s, const _CharT* __delimiter) noexcept : __out_stream_(std::__1::addressof(__s)), __delim_(__delimiter) {} __attribute__ ((__exclude_from_explicit_instantiation__)) ostream_iterator& operator=(const _Tp& __value_) { *__out_stream_ << __value_; if (__delim_) *__out_stream_ << __delim_; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) ostream_iterator& operator*() {return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) ostream_iterator& operator++() {return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) ostream_iterator& operator++(int) {return *this;} }; template<class _CharT, class _Traits> class istreambuf_iterator : public iterator<input_iterator_tag, _CharT, typename _Traits::off_type, _CharT*, _CharT> { public: typedef _CharT char_type; typedef _Traits traits_type; typedef typename _Traits::int_type int_type; typedef basic_streambuf<_CharT,_Traits> streambuf_type; typedef basic_istream<_CharT,_Traits> istream_type; private: mutable streambuf_type* __sbuf_; class __proxy { char_type __keep_; streambuf_type* __sbuf_; __attribute__ ((__exclude_from_explicit_instantiation__)) __proxy(char_type __c, streambuf_type* __s) : __keep_(__c), __sbuf_(__s) {} friend class istreambuf_iterator; public: __attribute__ ((__exclude_from_explicit_instantiation__)) char_type operator*() const {return __keep_;} }; __attribute__ ((__exclude_from_explicit_instantiation__)) bool __test_for_eof() const { if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sgetc(), traits_type::eof())) __sbuf_ = 0; return __sbuf_ == 0; } public: __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr istreambuf_iterator() noexcept : __sbuf_(0) {} __attribute__ ((__exclude_from_explicit_instantiation__)) istreambuf_iterator(istream_type& __s) noexcept : __sbuf_(__s.rdbuf()) {} __attribute__ ((__exclude_from_explicit_instantiation__)) istreambuf_iterator(streambuf_type* __s) noexcept : __sbuf_(__s) {} __attribute__ ((__exclude_from_explicit_instantiation__)) istreambuf_iterator(const __proxy& __p) noexcept : __sbuf_(__p.__sbuf_) {} __attribute__ ((__exclude_from_explicit_instantiation__)) char_type operator*() const {return static_cast<char_type>(__sbuf_->sgetc());} __attribute__ ((__exclude_from_explicit_instantiation__)) istreambuf_iterator& operator++() { __sbuf_->sbumpc(); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __proxy operator++(int) { return __proxy(__sbuf_->sbumpc(), __sbuf_); } __attribute__ ((__exclude_from_explicit_instantiation__)) bool equal(const istreambuf_iterator& __b) const {return __test_for_eof() == __b.__test_for_eof();} }; template <class _CharT, class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const istreambuf_iterator<_CharT,_Traits>& __a, const istreambuf_iterator<_CharT,_Traits>& __b) {return __a.equal(__b);} template <class _CharT, class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const istreambuf_iterator<_CharT,_Traits>& __a, const istreambuf_iterator<_CharT,_Traits>& __b) {return !__a.equal(__b);} template <class _CharT, class _Traits> class ostreambuf_iterator : public iterator<output_iterator_tag, void, void, void, void> { public: typedef _CharT char_type; typedef _Traits traits_type; typedef basic_streambuf<_CharT,_Traits> streambuf_type; typedef basic_ostream<_CharT,_Traits> ostream_type; private: streambuf_type* __sbuf_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) ostreambuf_iterator(ostream_type& __s) noexcept : __sbuf_(__s.rdbuf()) {} __attribute__ ((__exclude_from_explicit_instantiation__)) ostreambuf_iterator(streambuf_type* __s) noexcept : __sbuf_(__s) {} __attribute__ ((__exclude_from_explicit_instantiation__)) ostreambuf_iterator& operator=(_CharT __c) { if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sputc(__c), traits_type::eof())) __sbuf_ = 0; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) ostreambuf_iterator& operator*() {return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) ostreambuf_iterator& operator++() {return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) ostreambuf_iterator& operator++(int) {return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) bool failed() const noexcept {return __sbuf_ == 0;} template <class _Ch, class _Tr> friend ostreambuf_iterator<_Ch, _Tr> __pad_and_output(ostreambuf_iterator<_Ch, _Tr> __s, const _Ch* __ob, const _Ch* __op, const _Ch* __oe, ios_base& __iob, _Ch __fl); }; template <class _Iter> class move_iterator { private: _Iter __i; public: typedef _Iter iterator_type; typedef typename iterator_traits<iterator_type>::iterator_category iterator_category; typedef typename iterator_traits<iterator_type>::value_type value_type; typedef typename iterator_traits<iterator_type>::difference_type difference_type; typedef iterator_type pointer; typedef typename iterator_traits<iterator_type>::reference __reference; typedef typename conditional< is_reference<__reference>::value, typename remove_reference<__reference>::type&&, __reference >::type reference; __attribute__ ((__exclude_from_explicit_instantiation__)) move_iterator() : __i() {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit move_iterator(_Iter __x) : __i(__x) {} template <class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) move_iterator(const move_iterator<_Up>& __u) : __i(__u.base()) {} __attribute__ ((__exclude_from_explicit_instantiation__)) _Iter base() const {return __i;} __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator*() const { return static_cast<reference>(*__i); } __attribute__ ((__exclude_from_explicit_instantiation__)) pointer operator->() const { return __i;} __attribute__ ((__exclude_from_explicit_instantiation__)) move_iterator& operator++() {++__i; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) move_iterator operator++(int) {move_iterator __tmp(*this); ++__i; return __tmp;} __attribute__ ((__exclude_from_explicit_instantiation__)) move_iterator& operator--() {--__i; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) move_iterator operator--(int) {move_iterator __tmp(*this); --__i; return __tmp;} __attribute__ ((__exclude_from_explicit_instantiation__)) move_iterator operator+ (difference_type __n) const {return move_iterator(__i + __n);} __attribute__ ((__exclude_from_explicit_instantiation__)) move_iterator& operator+=(difference_type __n) {__i += __n; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) move_iterator operator- (difference_type __n) const {return move_iterator(__i - __n);} __attribute__ ((__exclude_from_explicit_instantiation__)) move_iterator& operator-=(difference_type __n) {__i -= __n; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator[](difference_type __n) const { return static_cast<reference>(__i[__n]); } }; template <class _Iter1, class _Iter2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { return __x.base() == __y.base(); } template <class _Iter1, class _Iter2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { return __x.base() < __y.base(); } template <class _Iter1, class _Iter2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { return __x.base() != __y.base(); } template <class _Iter1, class _Iter2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { return __x.base() > __y.base(); } template <class _Iter1, class _Iter2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { return __x.base() >= __y.base(); } template <class _Iter1, class _Iter2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { return __x.base() <= __y.base(); } template <class _Iter1, class _Iter2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) auto operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) -> decltype(__x.base() - __y.base()) { return __x.base() - __y.base(); } template <class _Iter> inline __attribute__ ((__exclude_from_explicit_instantiation__)) move_iterator<_Iter> operator+(typename move_iterator<_Iter>::difference_type __n, const move_iterator<_Iter>& __x) { return move_iterator<_Iter>(__x.base() + __n); } template <class _Iter> inline __attribute__ ((__exclude_from_explicit_instantiation__)) move_iterator<_Iter> make_move_iterator(_Iter __i) { return move_iterator<_Iter>(__i); } template <class _Iter> class __wrap_iter; template <class _Iter1, class _Iter2> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) noexcept; template <class _Iter1, class _Iter2> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) noexcept; template <class _Iter1, class _Iter2> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) noexcept; template <class _Iter1, class _Iter2> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) noexcept; template <class _Iter1, class _Iter2> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) noexcept; template <class _Iter1, class _Iter2> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) noexcept; template <class _Iter1, class _Iter2> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr auto operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) noexcept -> decltype(__x.base() - __y.base()); template <class _Iter> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __wrap_iter<_Iter> operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) noexcept; template <class _Ip, class _Op> _Op __attribute__ ((__exclude_from_explicit_instantiation__)) copy(_Ip, _Ip, _Op); template <class _B1, class _B2> _B2 __attribute__ ((__exclude_from_explicit_instantiation__)) copy_backward(_B1, _B1, _B2); template <class _Ip, class _Op> _Op __attribute__ ((__exclude_from_explicit_instantiation__)) move(_Ip, _Ip, _Op); template <class _B1, class _B2> _B2 __attribute__ ((__exclude_from_explicit_instantiation__)) move_backward(_B1, _B1, _B2); template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename enable_if < is_trivially_copy_assignable<_Tp>::value, _Tp* >::type __unwrap_iter(__wrap_iter<_Tp*>); template <class _Iter> class __wrap_iter { public: typedef _Iter iterator_type; typedef typename iterator_traits<iterator_type>::iterator_category iterator_category; typedef typename iterator_traits<iterator_type>::value_type value_type; typedef typename iterator_traits<iterator_type>::difference_type difference_type; typedef typename iterator_traits<iterator_type>::pointer pointer; typedef typename iterator_traits<iterator_type>::reference reference; private: iterator_type __i; public: __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __wrap_iter() noexcept : __i{} { } template <class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __wrap_iter(const __wrap_iter<_Up>& __u, typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0) noexcept : __i(__u.base()) { } __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr reference operator*() const noexcept { return *__i; } __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr pointer operator->() const noexcept { return (pointer)std::__1::addressof(*__i); } __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __wrap_iter& operator++() noexcept { ++__i; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __wrap_iter operator++(int) noexcept {__wrap_iter __tmp(*this); ++(*this); return __tmp;} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __wrap_iter& operator--() noexcept { --__i; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __wrap_iter operator--(int) noexcept {__wrap_iter __tmp(*this); --(*this); return __tmp;} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __wrap_iter operator+ (difference_type __n) const noexcept {__wrap_iter __w(*this); __w += __n; return __w;} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __wrap_iter& operator+=(difference_type __n) noexcept { __i += __n; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __wrap_iter operator- (difference_type __n) const noexcept {return *this + (-__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __wrap_iter& operator-=(difference_type __n) noexcept {*this += -__n; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr reference operator[](difference_type __n) const noexcept { return __i[__n]; } __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr iterator_type base() const noexcept {return __i;} private: __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __wrap_iter(iterator_type __x) noexcept : __i(__x) {} template <class _Up> friend class __wrap_iter; template <class _CharT, class _Traits, class _Alloc> friend class basic_string; template <class _Tp, class _Alloc> friend class vector; template <class _Tp, size_t> friend class span; template <class _Iter1, class _Iter2> constexpr friend bool operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) noexcept; template <class _Iter1, class _Iter2> constexpr friend bool operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) noexcept; template <class _Iter1, class _Iter2> constexpr friend bool operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) noexcept; template <class _Iter1, class _Iter2> constexpr friend bool operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) noexcept; template <class _Iter1, class _Iter2> constexpr friend bool operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) noexcept; template <class _Iter1, class _Iter2> constexpr friend bool operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) noexcept; template <class _Iter1, class _Iter2> constexpr friend auto operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) noexcept -> decltype(__x.base() - __y.base()); template <class _Iter1> constexpr friend __wrap_iter<_Iter1> operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) noexcept; template <class _Ip, class _Op> friend _Op copy(_Ip, _Ip, _Op); template <class _B1, class _B2> friend _B2 copy_backward(_B1, _B1, _B2); template <class _Ip, class _Op> friend _Op move(_Ip, _Ip, _Op); template <class _B1, class _B2> friend _B2 move_backward(_B1, _B1, _B2); template <class _Tp> constexpr friend typename enable_if < is_trivially_copy_assignable<_Tp>::value, _Tp* >::type __unwrap_iter(__wrap_iter<_Tp*>); }; template <class _Iter1, class _Iter2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) noexcept { return __x.base() == __y.base(); } template <class _Iter1, class _Iter2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) noexcept { return __x.base() < __y.base(); } template <class _Iter1, class _Iter2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) noexcept { return !(__x == __y); } template <class _Iter1, class _Iter2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) noexcept { return __y < __x; } template <class _Iter1, class _Iter2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) noexcept { return !(__x < __y); } template <class _Iter1, class _Iter2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) noexcept { return !(__y < __x); } template <class _Iter1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) noexcept { return !(__x == __y); } template <class _Iter1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) noexcept { return __y < __x; } template <class _Iter1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) noexcept { return !(__x < __y); } template <class _Iter1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) noexcept { return !(__y < __x); } template <class _Iter1, class _Iter2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr auto operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) noexcept -> decltype(__x.base() - __y.base()) { return __x.base() - __y.base(); } template <class _Iter> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __wrap_iter<_Iter> operator+(typename __wrap_iter<_Iter>::difference_type __n, __wrap_iter<_Iter> __x) noexcept { __x += __n; return __x; } template <class _Iter> struct __libcpp_is_trivial_iterator : public integral_constant<bool,(is_pointer<_Iter>::value)> {}; template <class _Iter> struct __libcpp_is_trivial_iterator<move_iterator<_Iter> > : public integral_constant<bool,(__libcpp_is_trivial_iterator<_Iter>::value)> {}; template <class _Iter> struct __libcpp_is_trivial_iterator<reverse_iterator<_Iter> > : public integral_constant<bool,(__libcpp_is_trivial_iterator<_Iter>::value)> {}; template <class _Iter> struct __libcpp_is_trivial_iterator<__wrap_iter<_Iter> > : public integral_constant<bool,(__libcpp_is_trivial_iterator<_Iter>::value)> {}; template <class _Tp, size_t _Np> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _Tp* begin(_Tp (&__array)[_Np]) { return __array; } template <class _Tp, size_t _Np> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _Tp* end(_Tp (&__array)[_Np]) { return __array + _Np; } template <class _Cp> __attribute__ ((__exclude_from_explicit_instantiation__)) auto begin(_Cp& __c) -> decltype(__c.begin()) { return __c.begin(); } template <class _Cp> __attribute__ ((__exclude_from_explicit_instantiation__)) auto begin(const _Cp& __c) -> decltype(__c.begin()) { return __c.begin(); } template <class _Cp> __attribute__ ((__exclude_from_explicit_instantiation__)) auto end(_Cp& __c) -> decltype(__c.end()) { return __c.end(); } template <class _Cp> __attribute__ ((__exclude_from_explicit_instantiation__)) auto end(const _Cp& __c) -> decltype(__c.end()) { return __c.end(); } template <class _Tp, size_t _Np> __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator<_Tp*> rbegin(_Tp (&__array)[_Np]) { return reverse_iterator<_Tp*>(__array + _Np); } template <class _Tp, size_t _Np> __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator<_Tp*> rend(_Tp (&__array)[_Np]) { return reverse_iterator<_Tp*>(__array); } template <class _Ep> __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator<const _Ep*> rbegin(initializer_list<_Ep> __il) { return reverse_iterator<const _Ep*>(__il.end()); } template <class _Ep> __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator<const _Ep*> rend(initializer_list<_Ep> __il) { return reverse_iterator<const _Ep*>(__il.begin()); } template <class _Cp> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr auto cbegin(const _Cp& __c) -> decltype(std::__1::begin(__c)) { return std::__1::begin(__c); } template <class _Cp> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr auto cend(const _Cp& __c) -> decltype(std::__1::end(__c)) { return std::__1::end(__c); } template <class _Cp> __attribute__ ((__exclude_from_explicit_instantiation__)) auto rbegin(_Cp& __c) -> decltype(__c.rbegin()) { return __c.rbegin(); } template <class _Cp> __attribute__ ((__exclude_from_explicit_instantiation__)) auto rbegin(const _Cp& __c) -> decltype(__c.rbegin()) { return __c.rbegin(); } template <class _Cp> __attribute__ ((__exclude_from_explicit_instantiation__)) auto rend(_Cp& __c) -> decltype(__c.rend()) { return __c.rend(); } template <class _Cp> __attribute__ ((__exclude_from_explicit_instantiation__)) auto rend(const _Cp& __c) -> decltype(__c.rend()) { return __c.rend(); } template <class _Cp> __attribute__ ((__exclude_from_explicit_instantiation__)) auto crbegin(const _Cp& __c) -> decltype(std::__1::rbegin(__c)) { return std::__1::rbegin(__c); } template <class _Cp> __attribute__ ((__exclude_from_explicit_instantiation__)) auto crend(const _Cp& __c) -> decltype(std::__1::rend(__c)) { return std::__1::rend(__c); } } } namespace std { inline namespace __1 { template <size_t _Ip, class _Hp, bool=is_empty<_Hp>::value && !__libcpp_is_final<_Hp>::value > class __tuple_leaf; template <size_t _Ip, class _Hp, bool _Ep> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y) noexcept(__is_nothrow_swappable<_Hp>::value) { swap(__x.get(), __y.get()); } template <size_t _Ip, class _Hp, bool> class __tuple_leaf { _Hp __value_; template <class _Tp> static constexpr bool __can_bind_reference() { return !__reference_binds_to_temporary(_Hp, _Tp); } __tuple_leaf& operator=(const __tuple_leaf&); public: __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __tuple_leaf() noexcept(is_nothrow_default_constructible<_Hp>::value) : __value_() {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} template <class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) __tuple_leaf(integral_constant<int, 0>, const _Alloc&) : __value_() {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} template <class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a) : __value_(allocator_arg_t(), __a) {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} template <class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a) : __value_(__a) {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} template <class _Tp, class = _EnableIf< _And< _IsNotSame<__uncvref_t<_Tp>, __tuple_leaf>, is_constructible<_Hp, _Tp> >::value > > __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr explicit __tuple_leaf(_Tp&& __t) noexcept((is_nothrow_constructible<_Hp, _Tp>::value)) : __value_(std::__1::forward<_Tp>(__t)) {static_assert(__can_bind_reference<_Tp&&>(), "Attempted construction of reference element binds to a temporary whose lifetime has ended");} template <class _Tp, class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t) : __value_(std::__1::forward<_Tp>(__t)) {static_assert(__can_bind_reference<_Tp&&>(), "Attempted construction of reference element binds to a temporary whose lifetime has ended");} template <class _Tp, class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t) : __value_(allocator_arg_t(), __a, std::__1::forward<_Tp>(__t)) {static_assert(!is_reference<_Hp>::value, "Attempted to uses-allocator construct a reference element in a tuple");} template <class _Tp, class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t) : __value_(std::__1::forward<_Tp>(__t), __a) {static_assert(!is_reference<_Hp>::value, "Attempted to uses-allocator construct a reference element in a tuple");} __tuple_leaf(const __tuple_leaf& __t) = default; __tuple_leaf(__tuple_leaf&& __t) = default; template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) __tuple_leaf& operator=(_Tp&& __t) noexcept((is_nothrow_assignable<_Hp&, _Tp>::value)) { __value_ = std::__1::forward<_Tp>(__t); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) int swap(__tuple_leaf& __t) noexcept(__is_nothrow_swappable<__tuple_leaf>::value) { std::__1::swap(*this, __t); return 0; } __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _Hp& get() noexcept {return __value_;} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const _Hp& get() const noexcept {return __value_;} }; template <size_t _Ip, class _Hp> class __tuple_leaf<_Ip, _Hp, true> : private _Hp { __tuple_leaf& operator=(const __tuple_leaf&); public: __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __tuple_leaf() noexcept(is_nothrow_default_constructible<_Hp>::value) {} template <class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) __tuple_leaf(integral_constant<int, 0>, const _Alloc&) {} template <class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a) : _Hp(allocator_arg_t(), __a) {} template <class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a) : _Hp(__a) {} template <class _Tp, class = _EnableIf< _And< _IsNotSame<__uncvref_t<_Tp>, __tuple_leaf>, is_constructible<_Hp, _Tp> >::value > > __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr explicit __tuple_leaf(_Tp&& __t) noexcept((is_nothrow_constructible<_Hp, _Tp>::value)) : _Hp(std::__1::forward<_Tp>(__t)) {} template <class _Tp, class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t) : _Hp(std::__1::forward<_Tp>(__t)) {} template <class _Tp, class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t) : _Hp(allocator_arg_t(), __a, std::__1::forward<_Tp>(__t)) {} template <class _Tp, class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t) : _Hp(std::__1::forward<_Tp>(__t), __a) {} __tuple_leaf(__tuple_leaf const &) = default; __tuple_leaf(__tuple_leaf &&) = default; template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) __tuple_leaf& operator=(_Tp&& __t) noexcept((is_nothrow_assignable<_Hp&, _Tp>::value)) { _Hp::operator=(std::__1::forward<_Tp>(__t)); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) int swap(__tuple_leaf& __t) noexcept(__is_nothrow_swappable<__tuple_leaf>::value) { std::__1::swap(*this, __t); return 0; } __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _Hp& get() noexcept {return static_cast<_Hp&>(*this);} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const _Hp& get() const noexcept {return static_cast<const _Hp&>(*this);} }; template <class ..._Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) void __swallow(_Tp&&...) noexcept {} template <class _Tp> struct __all_default_constructible; template <class ..._Tp> struct __all_default_constructible<__tuple_types<_Tp...>> : __all<is_default_constructible<_Tp>::value...> { }; template<class _Indx, class ..._Tp> struct __tuple_impl; template<size_t ..._Indx, class ..._Tp> struct __declspec(empty_bases) __tuple_impl<__tuple_indices<_Indx...>, _Tp...> : public __tuple_leaf<_Indx, _Tp>... { __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __tuple_impl() noexcept(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {} template <size_t ..._Uf, class ..._Tf, size_t ..._Ul, class ..._Tl, class ..._Up> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr explicit __tuple_impl(__tuple_indices<_Uf...>, __tuple_types<_Tf...>, __tuple_indices<_Ul...>, __tuple_types<_Tl...>, _Up&&... __u) noexcept((__all<is_nothrow_constructible<_Tf, _Up>::value...>::value && __all<is_nothrow_default_constructible<_Tl>::value...>::value)) : __tuple_leaf<_Uf, _Tf>(std::__1::forward<_Up>(__u))..., __tuple_leaf<_Ul, _Tl>()... {} template <class _Alloc, size_t ..._Uf, class ..._Tf, size_t ..._Ul, class ..._Tl, class ..._Up> __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __tuple_impl(allocator_arg_t, const _Alloc& __a, __tuple_indices<_Uf...>, __tuple_types<_Tf...>, __tuple_indices<_Ul...>, __tuple_types<_Tl...>, _Up&&... __u) : __tuple_leaf<_Uf, _Tf>(__uses_alloc_ctor<_Tf, _Alloc, _Up>(), __a, std::__1::forward<_Up>(__u))..., __tuple_leaf<_Ul, _Tl>(__uses_alloc_ctor<_Tl, _Alloc>(), __a)... {} template <class _Tuple, class = typename enable_if < __tuple_constructible<_Tuple, tuple<_Tp...> >::value >::type > __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __tuple_impl(_Tuple&& __t) noexcept((__all<is_nothrow_constructible<_Tp, typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>::value...>::value)) : __tuple_leaf<_Indx, _Tp>(std::__1::forward<typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>(std::__1::get<_Indx>(__t)))... {} template <class _Alloc, class _Tuple, class = typename enable_if < __tuple_constructible<_Tuple, tuple<_Tp...> >::value >::type > __attribute__ ((__exclude_from_explicit_instantiation__)) __tuple_impl(allocator_arg_t, const _Alloc& __a, _Tuple&& __t) : __tuple_leaf<_Indx, _Tp>(__uses_alloc_ctor<_Tp, _Alloc, typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>(), __a, std::__1::forward<typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>(std::__1::get<_Indx>(__t)))... {} template <class _Tuple> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < __tuple_assignable<_Tuple, tuple<_Tp...> >::value, __tuple_impl& >::type operator=(_Tuple&& __t) noexcept((__all<is_nothrow_assignable<_Tp&, typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>::value...>::value)) { __swallow(__tuple_leaf<_Indx, _Tp>::operator=(std::__1::forward<typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>(std::__1::get<_Indx>(__t)))...); return *this; } __tuple_impl(const __tuple_impl&) = default; __tuple_impl(__tuple_impl&&) = default; __attribute__ ((__exclude_from_explicit_instantiation__)) __tuple_impl& operator=(const __tuple_impl& __t) noexcept((__all<is_nothrow_copy_assignable<_Tp>::value...>::value)) { __swallow(__tuple_leaf<_Indx, _Tp>::operator=(static_cast<const __tuple_leaf<_Indx, _Tp>&>(__t).get())...); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __tuple_impl& operator=(__tuple_impl&& __t) noexcept((__all<is_nothrow_move_assignable<_Tp>::value...>::value)) { __swallow(__tuple_leaf<_Indx, _Tp>::operator=(std::__1::forward<_Tp>(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t).get()))...); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(__tuple_impl& __t) noexcept(__all<__is_nothrow_swappable<_Tp>::value...>::value) { __swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t))...); } }; template <class ..._Tp> class tuple { typedef __tuple_impl<typename __make_tuple_indices<sizeof...(_Tp)>::type, _Tp...> _BaseT; _BaseT __base_; static constexpr bool _EnableImplicitReducedArityExtension = false; template <class ..._Args> struct _PackExpandsToThisTuple : false_type {}; template <class _Arg> struct _PackExpandsToThisTuple<_Arg> : is_same<typename __uncvref<_Arg>::type, tuple> {}; template <bool _MaybeEnable, class _Dummy = void> struct _CheckArgsConstructor : __check_tuple_constructor_fail {}; template <class _Dummy> struct _CheckArgsConstructor<true, _Dummy> { template <int&...> static constexpr bool __enable_implicit_default() { return __all<__is_implicitly_default_constructible<_Tp>::value... >::value; } template <int&...> static constexpr bool __enable_explicit_default() { return __all<is_default_constructible<_Tp>::value...>::value && !__enable_implicit_default< >(); } template <class ..._Args> static constexpr bool __enable_explicit() { return __tuple_constructible< tuple<_Args...>, typename __make_tuple_types<tuple, sizeof...(_Args) < sizeof...(_Tp) ? sizeof...(_Args) : sizeof...(_Tp)>::type >::value && !__tuple_convertible< tuple<_Args...>, typename __make_tuple_types<tuple, sizeof...(_Args) < sizeof...(_Tp) ? sizeof...(_Args) : sizeof...(_Tp)>::type >::value && __all_default_constructible< typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Args) < sizeof...(_Tp) ? sizeof...(_Args) : sizeof...(_Tp)>::type >::value; } template <class ..._Args> static constexpr bool __enable_implicit() { return __tuple_constructible< tuple<_Args...>, typename __make_tuple_types<tuple, sizeof...(_Args) < sizeof...(_Tp) ? sizeof...(_Args) : sizeof...(_Tp)>::type >::value && __tuple_convertible< tuple<_Args...>, typename __make_tuple_types<tuple, sizeof...(_Args) < sizeof...(_Tp) ? sizeof...(_Args) : sizeof...(_Tp)>::type >::value && __all_default_constructible< typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Args) < sizeof...(_Tp) ? sizeof...(_Args) : sizeof...(_Tp)>::type >::value; } }; template <bool _MaybeEnable, bool = sizeof...(_Tp) == 1, class _Dummy = void> struct _CheckTupleLikeConstructor : __check_tuple_constructor_fail {}; template <class _Dummy> struct _CheckTupleLikeConstructor<true, false, _Dummy> { template <class _Tuple> static constexpr bool __enable_implicit() { return __tuple_constructible<_Tuple, tuple>::value && __tuple_convertible<_Tuple, tuple>::value; } template <class _Tuple> static constexpr bool __enable_explicit() { return __tuple_constructible<_Tuple, tuple>::value && !__tuple_convertible<_Tuple, tuple>::value; } }; template <class _Dummy> struct _CheckTupleLikeConstructor<true, true, _Dummy> { template <class _Tuple> using _PreferTupleLikeConstructor = _Or< _IsSame<__uncvref_t<_Tuple>, tuple>, _Lazy<_And, _Not<is_constructible<_Tp..., _Tuple>>, _Not<is_convertible<_Tuple, _Tp...>> > >; template <class _Tuple> static constexpr bool __enable_implicit() { return _And< __tuple_constructible<_Tuple, tuple>, __tuple_convertible<_Tuple, tuple>, _PreferTupleLikeConstructor<_Tuple> >::value; } template <class _Tuple> static constexpr bool __enable_explicit() { return _And< __tuple_constructible<_Tuple, tuple>, _PreferTupleLikeConstructor<_Tuple>, _Not<__tuple_convertible<_Tuple, tuple>> >::value; } }; template <class _Tuple, bool _DisableIfLValue> using _EnableImplicitTupleLikeConstructor = _EnableIf< _CheckTupleLikeConstructor< __tuple_like_with_size<_Tuple, sizeof...(_Tp)>::value && !_PackExpandsToThisTuple<_Tuple>::value && (!is_lvalue_reference<_Tuple>::value || !_DisableIfLValue) >::template __enable_implicit<_Tuple>(), bool >; template <class _Tuple, bool _DisableIfLValue> using _EnableExplicitTupleLikeConstructor = _EnableIf< _CheckTupleLikeConstructor< __tuple_like_with_size<_Tuple, sizeof...(_Tp)>::value && !_PackExpandsToThisTuple<_Tuple>::value && (!is_lvalue_reference<_Tuple>::value || !_DisableIfLValue) >::template __enable_explicit<_Tuple>(), bool >; template <size_t _Jp, class ..._Up> friend constexpr typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) noexcept; template <size_t _Jp, class ..._Up> friend constexpr const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&) noexcept; template <size_t _Jp, class ..._Up> friend constexpr typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&) noexcept; template <size_t _Jp, class ..._Up> friend constexpr const typename tuple_element<_Jp, tuple<_Up...> >::type&& get(const tuple<_Up...>&&) noexcept; public: template <bool _Dummy = true, _EnableIf< _CheckArgsConstructor<_Dummy>::__enable_implicit_default() , void*> = nullptr> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr tuple() noexcept(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {} template <bool _Dummy = true, _EnableIf< _CheckArgsConstructor<_Dummy>::__enable_explicit_default() , void*> = nullptr> explicit __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr tuple() noexcept(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {} tuple(tuple const&) = default; tuple(tuple&&) = default; template <class _AllocArgT, class _Alloc, _EnableIf< _CheckArgsConstructor<_IsSame<allocator_arg_t, _AllocArgT>::value >::__enable_implicit_default() , void*> = nullptr > __attribute__ ((__exclude_from_explicit_instantiation__)) tuple(_AllocArgT, _Alloc const& __a) : __base_(allocator_arg_t(), __a, __tuple_indices<>(), __tuple_types<>(), typename __make_tuple_indices<sizeof...(_Tp), 0>::type(), __tuple_types<_Tp...>()) {} template <class _AllocArgT, class _Alloc, _EnableIf< _CheckArgsConstructor<_IsSame<allocator_arg_t, _AllocArgT>::value>::__enable_explicit_default() , void*> = nullptr > explicit __attribute__ ((__exclude_from_explicit_instantiation__)) tuple(_AllocArgT, _Alloc const& __a) : __base_(allocator_arg_t(), __a, __tuple_indices<>(), __tuple_types<>(), typename __make_tuple_indices<sizeof...(_Tp), 0>::type(), __tuple_types<_Tp...>()) {} template <bool _Dummy = true, typename enable_if < _CheckArgsConstructor< _Dummy >::template __enable_implicit<_Tp const&...>(), bool >::type = false > __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr tuple(const _Tp& ... __t) noexcept((__all<is_nothrow_copy_constructible<_Tp>::value...>::value)) : __base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(), typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(), typename __make_tuple_indices<0>::type(), typename __make_tuple_types<tuple, 0>::type(), __t... ) {} template <bool _Dummy = true, typename enable_if < _CheckArgsConstructor< _Dummy >::template __enable_explicit<_Tp const&...>(), bool >::type = false > __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr explicit tuple(const _Tp& ... __t) noexcept((__all<is_nothrow_copy_constructible<_Tp>::value...>::value)) : __base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(), typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(), typename __make_tuple_indices<0>::type(), typename __make_tuple_types<tuple, 0>::type(), __t... ) {} template <class _Alloc, bool _Dummy = true, typename enable_if < _CheckArgsConstructor< _Dummy >::template __enable_implicit<_Tp const&...>(), bool >::type = false > __attribute__ ((__exclude_from_explicit_instantiation__)) tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t) : __base_(allocator_arg_t(), __a, typename __make_tuple_indices<sizeof...(_Tp)>::type(), typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(), typename __make_tuple_indices<0>::type(), typename __make_tuple_types<tuple, 0>::type(), __t... ) {} template <class _Alloc, bool _Dummy = true, typename enable_if < _CheckArgsConstructor< _Dummy >::template __enable_explicit<_Tp const&...>(), bool >::type = false > __attribute__ ((__exclude_from_explicit_instantiation__)) explicit tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t) : __base_(allocator_arg_t(), __a, typename __make_tuple_indices<sizeof...(_Tp)>::type(), typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(), typename __make_tuple_indices<0>::type(), typename __make_tuple_types<tuple, 0>::type(), __t... ) {} template <class ..._Up, bool _PackIsTuple = _PackExpandsToThisTuple<_Up...>::value, typename enable_if < _CheckArgsConstructor< sizeof...(_Up) == sizeof...(_Tp) && !_PackIsTuple >::template __enable_implicit<_Up...>() || _CheckArgsConstructor< _EnableImplicitReducedArityExtension && sizeof...(_Up) < sizeof...(_Tp) && !_PackIsTuple >::template __enable_implicit<_Up...>(), bool >::type = false > __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr tuple(_Up&&... __u) noexcept(( is_nothrow_constructible<_BaseT, typename __make_tuple_indices<sizeof...(_Up)>::type, typename __make_tuple_types<tuple, sizeof...(_Up)>::type, typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type, typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type, _Up... >::value )) : __base_(typename __make_tuple_indices<sizeof...(_Up)>::type(), typename __make_tuple_types<tuple, sizeof...(_Up)>::type(), typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(), typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(), std::__1::forward<_Up>(__u)...) {} template <class ..._Up, typename enable_if < _CheckArgsConstructor< sizeof...(_Up) <= sizeof...(_Tp) && !_PackExpandsToThisTuple<_Up...>::value >::template __enable_explicit<_Up...>() || _CheckArgsConstructor< !_EnableImplicitReducedArityExtension && sizeof...(_Up) < sizeof...(_Tp) && !_PackExpandsToThisTuple<_Up...>::value >::template __enable_implicit<_Up...>(), bool >::type = false > __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr explicit tuple(_Up&&... __u) noexcept(( is_nothrow_constructible<_BaseT, typename __make_tuple_indices<sizeof...(_Up)>::type, typename __make_tuple_types<tuple, sizeof...(_Up)>::type, typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type, typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type, _Up... >::value )) : __base_(typename __make_tuple_indices<sizeof...(_Up)>::type(), typename __make_tuple_types<tuple, sizeof...(_Up)>::type(), typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(), typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(), std::__1::forward<_Up>(__u)...) {} template <class _Alloc, class ..._Up, typename enable_if < _CheckArgsConstructor< sizeof...(_Up) == sizeof...(_Tp) && !_PackExpandsToThisTuple<_Up...>::value >::template __enable_implicit<_Up...>(), bool >::type = false > __attribute__ ((__exclude_from_explicit_instantiation__)) tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u) : __base_(allocator_arg_t(), __a, typename __make_tuple_indices<sizeof...(_Up)>::type(), typename __make_tuple_types<tuple, sizeof...(_Up)>::type(), typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(), typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(), std::__1::forward<_Up>(__u)...) {} template <class _Alloc, class ..._Up, typename enable_if < _CheckArgsConstructor< sizeof...(_Up) == sizeof...(_Tp) && !_PackExpandsToThisTuple<_Up...>::value >::template __enable_explicit<_Up...>(), bool >::type = false > __attribute__ ((__exclude_from_explicit_instantiation__)) explicit tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u) : __base_(allocator_arg_t(), __a, typename __make_tuple_indices<sizeof...(_Up)>::type(), typename __make_tuple_types<tuple, sizeof...(_Up)>::type(), typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(), typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(), std::__1::forward<_Up>(__u)...) {} template <class _Tuple, _EnableImplicitTupleLikeConstructor<_Tuple, true> = false> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr tuple(_Tuple&& __t) noexcept((is_nothrow_constructible<_BaseT, _Tuple>::value)) : __base_(std::__1::forward<_Tuple>(__t)) {} template <class _Tuple, _EnableImplicitTupleLikeConstructor<const _Tuple&, false> = false> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr tuple(const _Tuple& __t) noexcept((is_nothrow_constructible<_BaseT, const _Tuple&>::value)) : __base_(__t) {} template <class _Tuple, _EnableExplicitTupleLikeConstructor<_Tuple, true> = false> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr explicit tuple(_Tuple&& __t) noexcept((is_nothrow_constructible<_BaseT, _Tuple>::value)) : __base_(std::__1::forward<_Tuple>(__t)) {} template <class _Tuple, _EnableExplicitTupleLikeConstructor<const _Tuple&, false> = false> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr explicit tuple(const _Tuple& __t) noexcept((is_nothrow_constructible<_BaseT, const _Tuple&>::value)) : __base_(__t) {} template <class _Alloc, class _Tuple, typename enable_if < _CheckTupleLikeConstructor< __tuple_like_with_size<_Tuple, sizeof...(_Tp)>::value >::template __enable_implicit<_Tuple>(), bool >::type = false > __attribute__ ((__exclude_from_explicit_instantiation__)) tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t) : __base_(allocator_arg_t(), __a, std::__1::forward<_Tuple>(__t)) {} template <class _Alloc, class _Tuple, typename enable_if < _CheckTupleLikeConstructor< __tuple_like_with_size<_Tuple, sizeof...(_Tp)>::value >::template __enable_explicit<_Tuple>(), bool >::type = false > __attribute__ ((__exclude_from_explicit_instantiation__)) explicit tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t) : __base_(allocator_arg_t(), __a, std::__1::forward<_Tuple>(__t)) {} using _CanCopyAssign = __all<is_copy_assignable<_Tp>::value...>; using _CanMoveAssign = __all<is_move_assignable<_Tp>::value...>; __attribute__ ((__exclude_from_explicit_instantiation__)) tuple& operator=(typename conditional<_CanCopyAssign::value, tuple, __nat>::type const& __t) noexcept((__all<is_nothrow_copy_assignable<_Tp>::value...>::value)) { __base_.operator=(__t.__base_); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) tuple& operator=(typename conditional<_CanMoveAssign::value, tuple, __nat>::type&& __t) noexcept((__all<is_nothrow_move_assignable<_Tp>::value...>::value)) { __base_.operator=(static_cast<_BaseT&&>(__t.__base_)); return *this; } template <class _Tuple, class = typename enable_if < __tuple_assignable<_Tuple, tuple>::value >::type > __attribute__ ((__exclude_from_explicit_instantiation__)) tuple& operator=(_Tuple&& __t) noexcept((is_nothrow_assignable<_BaseT&, _Tuple>::value)) { __base_.operator=(std::__1::forward<_Tuple>(__t)); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(tuple& __t) noexcept(__all<__is_nothrow_swappable<_Tp>::value...>::value) {__base_.swap(__t.__base_);} }; template <> class tuple<> { public: __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr tuple() noexcept = default; template <class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) tuple(allocator_arg_t, const _Alloc&) noexcept {} template <class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) tuple(allocator_arg_t, const _Alloc&, const tuple&) noexcept {} template <class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) tuple(array<_Up, 0>) noexcept {} template <class _Alloc, class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) tuple(allocator_arg_t, const _Alloc&, array<_Up, 0>) noexcept {} __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(tuple&) noexcept {} }; template <class ..._Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < __all<__is_swappable<_Tp>::value...>::value, void >::type swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u) noexcept(__all<__is_nothrow_swappable<_Tp>::value...>::value) {__t.swap(__u);} template <size_t _Ip, class ..._Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename tuple_element<_Ip, tuple<_Tp...> >::type& get(tuple<_Tp...>& __t) noexcept { typedef __attribute__((nodebug)) typename tuple_element<_Ip, tuple<_Tp...> >::type type; return static_cast<__tuple_leaf<_Ip, type>&>(__t.__base_).get(); } template <size_t _Ip, class ..._Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const typename tuple_element<_Ip, tuple<_Tp...> >::type& get(const tuple<_Tp...>& __t) noexcept { typedef __attribute__((nodebug)) typename tuple_element<_Ip, tuple<_Tp...> >::type type; return static_cast<const __tuple_leaf<_Ip, type>&>(__t.__base_).get(); } template <size_t _Ip, class ..._Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename tuple_element<_Ip, tuple<_Tp...> >::type&& get(tuple<_Tp...>&& __t) noexcept { typedef __attribute__((nodebug)) typename tuple_element<_Ip, tuple<_Tp...> >::type type; return static_cast<type&&>( static_cast<__tuple_leaf<_Ip, type>&&>(__t.__base_).get()); } template <size_t _Ip, class ..._Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const typename tuple_element<_Ip, tuple<_Tp...> >::type&& get(const tuple<_Tp...>&& __t) noexcept { typedef __attribute__((nodebug)) typename tuple_element<_Ip, tuple<_Tp...> >::type type; return static_cast<const type&&>( static_cast<const __tuple_leaf<_Ip, type>&&>(__t.__base_).get()); } namespace __find_detail { static constexpr size_t __not_found = -1; static constexpr size_t __ambiguous = __not_found - 1; inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr size_t __find_idx_return(size_t __curr_i, size_t __res, bool __matches) { return !__matches ? __res : (__res == __not_found ? __curr_i : __ambiguous); } template <size_t _Nx> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr size_t __find_idx(size_t __i, const bool (&__matches)[_Nx]) { return __i == _Nx ? __not_found : __find_idx_return(__i, __find_idx(__i + 1, __matches), __matches[__i]); } template <class _T1, class ..._Args> struct __find_exactly_one_checked { static constexpr bool __matches[sizeof...(_Args)] = {is_same<_T1, _Args>::value...}; static constexpr size_t value = __find_detail::__find_idx(0, __matches); static_assert(value != __not_found, "type not found in type list" ); static_assert(value != __ambiguous, "type occurs more than once in type list"); }; template <class _T1> struct __find_exactly_one_checked<_T1> { static_assert(!is_same<_T1, _T1>::value, "type not in empty type list"); }; } template <typename _T1, typename... _Args> struct __find_exactly_one_t : public __find_detail::__find_exactly_one_checked<_T1, _Args...> { }; template <class _T1, class... _Args> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _T1& get(tuple<_Args...>& __tup) noexcept { return std::__1::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup); } template <class _T1, class... _Args> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _T1 const& get(tuple<_Args...> const& __tup) noexcept { return std::__1::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup); } template <class _T1, class... _Args> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _T1&& get(tuple<_Args...>&& __tup) noexcept { return std::__1::get<__find_exactly_one_t<_T1, _Args...>::value>(std::__1::move(__tup)); } template <class _T1, class... _Args> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _T1 const&& get(tuple<_Args...> const&& __tup) noexcept { return std::__1::get<__find_exactly_one_t<_T1, _Args...>::value>(std::__1::move(__tup)); } template <class ..._Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr tuple<_Tp&...> tie(_Tp&... __t) noexcept { return tuple<_Tp&...>(__t...); } template <class _Up> struct __ignore_t { template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const __ignore_t& operator=(_Tp&&) const {return *this;} }; namespace { constexpr __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>(); } template <class... _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr tuple<typename __unwrap_ref_decay<_Tp>::type...> make_tuple(_Tp&&... __t) { return tuple<typename __unwrap_ref_decay<_Tp>::type...>(std::__1::forward<_Tp>(__t)...); } template <class... _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr tuple<_Tp&&...> forward_as_tuple(_Tp&&... __t) noexcept { return tuple<_Tp&&...>(std::__1::forward<_Tp>(__t)...); } template <size_t _Ip> struct __tuple_equal { template <class _Tp, class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator()(const _Tp& __x, const _Up& __y) { return __tuple_equal<_Ip - 1>()(__x, __y) && std::__1::get<_Ip-1>(__x) == std::__1::get<_Ip-1>(__y); } }; template <> struct __tuple_equal<0> { template <class _Tp, class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator()(const _Tp&, const _Up&) { return true; } }; template <class ..._Tp, class ..._Up> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) { static_assert (sizeof...(_Tp) == sizeof...(_Up), "Can't compare tuples of different sizes"); return __tuple_equal<sizeof...(_Tp)>()(__x, __y); } template <class ..._Tp, class ..._Up> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator!=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) { return !(__x == __y); } template <size_t _Ip> struct __tuple_less { template <class _Tp, class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator()(const _Tp& __x, const _Up& __y) { const size_t __idx = tuple_size<_Tp>::value - _Ip; if (std::__1::get<__idx>(__x) < std::__1::get<__idx>(__y)) return true; if (std::__1::get<__idx>(__y) < std::__1::get<__idx>(__x)) return false; return __tuple_less<_Ip-1>()(__x, __y); } }; template <> struct __tuple_less<0> { template <class _Tp, class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator()(const _Tp&, const _Up&) { return false; } }; template <class ..._Tp, class ..._Up> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) { static_assert (sizeof...(_Tp) == sizeof...(_Up), "Can't compare tuples of different sizes"); return __tuple_less<sizeof...(_Tp)>()(__x, __y); } template <class ..._Tp, class ..._Up> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) { return __y < __x; } template <class ..._Tp, class ..._Up> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator>=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) { return !(__x < __y); } template <class ..._Tp, class ..._Up> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) { return !(__y < __x); } template <class _Tp, class _Up> struct __tuple_cat_type; template <class ..._Ttypes, class ..._Utypes> struct __tuple_cat_type<tuple<_Ttypes...>, __tuple_types<_Utypes...> > { typedef __attribute__((nodebug)) tuple<_Ttypes..., _Utypes...> type; }; template <class _ResultTuple, bool _Is_Tuple0TupleLike, class ..._Tuples> struct __tuple_cat_return_1 { }; template <class ..._Types, class _Tuple0> struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0> { typedef __attribute__((nodebug)) typename __tuple_cat_type<tuple<_Types...>, typename __make_tuple_types<typename __uncvref<_Tuple0>::type>::type>::type type; }; template <class ..._Types, class _Tuple0, class _Tuple1, class ..._Tuples> struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0, _Tuple1, _Tuples...> : public __tuple_cat_return_1< typename __tuple_cat_type< tuple<_Types...>, typename __make_tuple_types<typename __uncvref<_Tuple0>::type>::type >::type, __tuple_like<typename remove_reference<_Tuple1>::type>::value, _Tuple1, _Tuples...> { }; template <class ..._Tuples> struct __tuple_cat_return; template <class _Tuple0, class ..._Tuples> struct __tuple_cat_return<_Tuple0, _Tuples...> : public __tuple_cat_return_1<tuple<>, __tuple_like<typename remove_reference<_Tuple0>::type>::value, _Tuple0, _Tuples...> { }; template <> struct __tuple_cat_return<> { typedef __attribute__((nodebug)) tuple<> type; }; inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr tuple<> tuple_cat() { return tuple<>(); } template <class _Rp, class _Indices, class _Tuple0, class ..._Tuples> struct __tuple_cat_return_ref_imp; template <class ..._Types, size_t ..._I0, class _Tuple0> struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0> { typedef __attribute__((nodebug)) typename remove_reference<_Tuple0>::type _T0; typedef tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_I0, _T0>::type>::type&&...> type; }; template <class ..._Types, size_t ..._I0, class _Tuple0, class _Tuple1, class ..._Tuples> struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0, _Tuple1, _Tuples...> : public __tuple_cat_return_ref_imp< tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_I0, typename remove_reference<_Tuple0>::type>::type>::type&&...>, typename __make_tuple_indices<tuple_size<typename remove_reference<_Tuple1>::type>::value>::type, _Tuple1, _Tuples...> { }; template <class _Tuple0, class ..._Tuples> struct __tuple_cat_return_ref : public __tuple_cat_return_ref_imp<tuple<>, typename __make_tuple_indices< tuple_size<typename remove_reference<_Tuple0>::type>::value >::type, _Tuple0, _Tuples...> { }; template <class _Types, class _I0, class _J0> struct __tuple_cat; template <class ..._Types, size_t ..._I0, size_t ..._J0> struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J0...> > { template <class _Tuple0> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&>::type operator()(tuple<_Types...> __t, _Tuple0&& __t0) { return forward_as_tuple(std::__1::forward<_Types>(std::__1::get<_I0>(__t))..., std::__1::get<_J0>(std::__1::forward<_Tuple0>(__t0))...); } template <class _Tuple0, class _Tuple1, class ..._Tuples> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&& ...__tpls) { typedef __attribute__((nodebug)) typename remove_reference<_Tuple0>::type _T0; typedef __attribute__((nodebug)) typename remove_reference<_Tuple1>::type _T1; return __tuple_cat< tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_J0, _T0>::type>::type&&...>, typename __make_tuple_indices<sizeof ...(_Types) + tuple_size<_T0>::value>::type, typename __make_tuple_indices<tuple_size<_T1>::value>::type>() (forward_as_tuple( std::__1::forward<_Types>(std::__1::get<_I0>(__t))..., std::__1::get<_J0>(std::__1::forward<_Tuple0>(__t0))... ), std::__1::forward<_Tuple1>(__t1), std::__1::forward<_Tuples>(__tpls)...); } }; template <class _Tuple0, class... _Tuples> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename __tuple_cat_return<_Tuple0, _Tuples...>::type tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls) { typedef __attribute__((nodebug)) typename remove_reference<_Tuple0>::type _T0; return __tuple_cat<tuple<>, __tuple_indices<>, typename __make_tuple_indices<tuple_size<_T0>::value>::type>() (tuple<>(), std::__1::forward<_Tuple0>(__t0), std::__1::forward<_Tuples>(__tpls)...); } template <class ..._Tp, class _Alloc> struct uses_allocator<tuple<_Tp...>, _Alloc> : true_type {}; template <class _T1, class _T2> template <class... _Args1, class... _Args2, size_t ..._I1, size_t ..._I2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) pair<_T1, _T2>::pair(piecewise_construct_t, tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args, __tuple_indices<_I1...>, __tuple_indices<_I2...>) : first(std::__1::forward<_Args1>(std::__1::get<_I1>( __first_args))...), second(std::__1::forward<_Args2>(std::__1::get<_I2>(__second_args))...) { } } } namespace std { inline namespace __1 { } } namespace std { class logic_error : public exception { public: explicit logic_error(const std::__1::string&); __attribute__ ((__exclude_from_explicit_instantiation__)) explicit logic_error(const char* __s) : exception(__s) {} }; class runtime_error : public exception { public: explicit runtime_error(const std::__1::string&); __attribute__ ((__exclude_from_explicit_instantiation__)) explicit runtime_error(const char* __s) : exception(__s) {} }; class domain_error : public logic_error { public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit domain_error(const string& __s) : logic_error(__s) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit domain_error(const char* __s) : logic_error(__s) {} }; class invalid_argument : public logic_error { public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit invalid_argument(const string& __s) : logic_error(__s) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit invalid_argument(const char* __s) : logic_error(__s) {} }; class length_error : public logic_error { public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit length_error(const string& __s) : logic_error(__s) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit length_error(const char* __s) : logic_error(__s) {} }; class out_of_range : public logic_error { public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit out_of_range(const string& __s) : logic_error(__s) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit out_of_range(const char* __s) : logic_error(__s) {} }; class range_error : public runtime_error { public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit range_error(const string& __s) : runtime_error(__s) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit range_error(const char* __s) : runtime_error(__s) {} }; class overflow_error : public runtime_error { public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit overflow_error(const string& __s) : runtime_error(__s) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit overflow_error(const char* __s) : runtime_error(__s) {} }; class underflow_error : public runtime_error { public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit underflow_error(const string& __s) : runtime_error(__s) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit underflow_error(const char* __s) : runtime_error(__s) {} }; } namespace std { inline namespace __1 { [[noreturn]] void __throw_runtime_error(const char*); [[noreturn]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __throw_logic_error(const char*__msg) { ((void)__msg); std::__1::abort(); } [[noreturn]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __throw_domain_error(const char*__msg) { ((void)__msg); std::__1::abort(); } [[noreturn]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __throw_invalid_argument(const char*__msg) { ((void)__msg); std::__1::abort(); } [[noreturn]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __throw_length_error(const char*__msg) { ((void)__msg); std::__1::abort(); } [[noreturn]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __throw_out_of_range(const char*__msg) { ((void)__msg); std::__1::abort(); } [[noreturn]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __throw_range_error(const char*__msg) { ((void)__msg); std::__1::abort(); } [[noreturn]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __throw_overflow_error(const char*__msg) { ((void)__msg); std::__1::abort(); } [[noreturn]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __throw_underflow_error(const char*__msg) { ((void)__msg); std::__1::abort(); } } } namespace std { inline namespace __1 { enum __legacy_memory_order { __mo_relaxed, __mo_consume, __mo_acquire, __mo_release, __mo_acq_rel, __mo_seq_cst }; typedef underlying_type<__legacy_memory_order>::type __memory_order_underlying_t; typedef enum memory_order { memory_order_relaxed = __mo_relaxed, memory_order_consume = __mo_consume, memory_order_acquire = __mo_acquire, memory_order_release = __mo_release, memory_order_acq_rel = __mo_acq_rel, memory_order_seq_cst = __mo_seq_cst, } memory_order; static_assert((is_same<underlying_type<memory_order>::type, __memory_order_underlying_t>::value), "unexpected underlying type for std::memory_order"); template <typename _Tp> struct __cxx_atomic_base_impl { __attribute__ ((__exclude_from_explicit_instantiation__)) __cxx_atomic_base_impl() noexcept = default; constexpr explicit __cxx_atomic_base_impl(_Tp value) noexcept : __a_value(value) {} __extension__ _Atomic(_Tp) __a_value; }; __attribute__ ((__exclude_from_explicit_instantiation__)) inline void __cxx_atomic_thread_fence(memory_order __order) noexcept { __c11_atomic_thread_fence(static_cast<__memory_order_underlying_t>(__order)); } __attribute__ ((__exclude_from_explicit_instantiation__)) inline void __cxx_atomic_signal_fence(memory_order __order) noexcept { __c11_atomic_signal_fence(static_cast<__memory_order_underlying_t>(__order)); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __val) noexcept { __c11_atomic_init(&__a->__a_value, __val); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp> * __a, _Tp __val) noexcept { __c11_atomic_init(&__a->__a_value, __val); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __val, memory_order __order) noexcept { __c11_atomic_store(&__a->__a_value, __val, static_cast<__memory_order_underlying_t>(__order)); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp> * __a, _Tp __val, memory_order __order) noexcept { __c11_atomic_store(&__a->__a_value, __val, static_cast<__memory_order_underlying_t>(__order)); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp __cxx_atomic_load(__cxx_atomic_base_impl<_Tp> const volatile* __a, memory_order __order) noexcept { using __ptr_type = typename remove_const<decltype(__a->__a_value)>::type*; return __c11_atomic_load(const_cast<__ptr_type>(&__a->__a_value), static_cast<__memory_order_underlying_t>(__order)); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp __cxx_atomic_load(__cxx_atomic_base_impl<_Tp> const* __a, memory_order __order) noexcept { using __ptr_type = typename remove_const<decltype(__a->__a_value)>::type*; return __c11_atomic_load(const_cast<__ptr_type>(&__a->__a_value), static_cast<__memory_order_underlying_t>(__order)); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __value, memory_order __order) noexcept { return __c11_atomic_exchange(&__a->__a_value, __value, static_cast<__memory_order_underlying_t>(__order)); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp> * __a, _Tp __value, memory_order __order) noexcept { return __c11_atomic_exchange(&__a->__a_value, __value, static_cast<__memory_order_underlying_t>(__order)); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) noexcept { return __c11_atomic_compare_exchange_strong(&__a->__a_value, __expected, __value, static_cast<__memory_order_underlying_t>(__success), static_cast<__memory_order_underlying_t>(__failure)); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_base_impl<_Tp> * __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) noexcept { return __c11_atomic_compare_exchange_strong(&__a->__a_value, __expected, __value, static_cast<__memory_order_underlying_t>(__success), static_cast<__memory_order_underlying_t>(__failure)); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) noexcept { return __c11_atomic_compare_exchange_weak(&__a->__a_value, __expected, __value, static_cast<__memory_order_underlying_t>(__success), static_cast<__memory_order_underlying_t>(__failure)); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_base_impl<_Tp> * __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) noexcept { return __c11_atomic_compare_exchange_weak(&__a->__a_value, __expected, __value, static_cast<__memory_order_underlying_t>(__success), static_cast<__memory_order_underlying_t>(__failure)); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __delta, memory_order __order) noexcept { return __c11_atomic_fetch_add(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order)); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp> * __a, _Tp __delta, memory_order __order) noexcept { return __c11_atomic_fetch_add(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order)); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) noexcept { return __c11_atomic_fetch_add(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order)); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*> * __a, ptrdiff_t __delta, memory_order __order) noexcept { return __c11_atomic_fetch_add(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order)); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __delta, memory_order __order) noexcept { return __c11_atomic_fetch_sub(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order)); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp> * __a, _Tp __delta, memory_order __order) noexcept { return __c11_atomic_fetch_sub(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order)); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) noexcept { return __c11_atomic_fetch_sub(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order)); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp*> * __a, ptrdiff_t __delta, memory_order __order) noexcept { return __c11_atomic_fetch_sub(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order)); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp __cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) noexcept { return __c11_atomic_fetch_and(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order)); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp __cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, memory_order __order) noexcept { return __c11_atomic_fetch_and(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order)); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp __cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) noexcept { return __c11_atomic_fetch_or(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order)); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp __cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, memory_order __order) noexcept { return __c11_atomic_fetch_or(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order)); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) noexcept { return __c11_atomic_fetch_xor(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order)); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, memory_order __order) noexcept { return __c11_atomic_fetch_xor(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order)); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp kill_dependency(_Tp __y) noexcept { return __y; } template <typename _Tp, typename _Base = __cxx_atomic_base_impl<_Tp> > struct __cxx_atomic_impl : public _Base { __attribute__ ((__exclude_from_explicit_instantiation__)) __cxx_atomic_impl() noexcept = default; __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr explicit __cxx_atomic_impl(_Tp value) noexcept : _Base(value) {} }; template <class _Tp, bool = is_integral<_Tp>::value && !is_same<_Tp, bool>::value> struct __atomic_base { mutable __cxx_atomic_impl<_Tp> __a_; __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_lock_free() const volatile noexcept {return __c11_atomic_is_lock_free(sizeof(_Tp));} __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_lock_free() const noexcept {return static_cast<__atomic_base const volatile*>(this)->is_lock_free();} __attribute__ ((__exclude_from_explicit_instantiation__)) void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile noexcept __attribute__((diagnose_if(__m == memory_order_consume || __m == memory_order_acquire || __m == memory_order_acq_rel, "memory order argument to atomic operation is invalid", "warning"))) {__cxx_atomic_store(&__a_, __d, __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) void store(_Tp __d, memory_order __m = memory_order_seq_cst) noexcept __attribute__((diagnose_if(__m == memory_order_consume || __m == memory_order_acquire || __m == memory_order_acq_rel, "memory order argument to atomic operation is invalid", "warning"))) {__cxx_atomic_store(&__a_, __d, __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp load(memory_order __m = memory_order_seq_cst) const volatile noexcept __attribute__((diagnose_if(__m == memory_order_release || __m == memory_order_acq_rel, "memory order argument to atomic operation is invalid", "warning"))) {return __cxx_atomic_load(&__a_, __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp load(memory_order __m = memory_order_seq_cst) const noexcept __attribute__((diagnose_if(__m == memory_order_release || __m == memory_order_acq_rel, "memory order argument to atomic operation is invalid", "warning"))) {return __cxx_atomic_load(&__a_, __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) operator _Tp() const volatile noexcept {return load();} __attribute__ ((__exclude_from_explicit_instantiation__)) operator _Tp() const noexcept {return load();} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) volatile noexcept {return __cxx_atomic_exchange(&__a_, __d, __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) noexcept {return __cxx_atomic_exchange(&__a_, __d, __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) bool compare_exchange_weak(_Tp& __e, _Tp __d, memory_order __s, memory_order __f) volatile noexcept __attribute__((diagnose_if(__f == memory_order_release || __f == memory_order_acq_rel, "memory order argument to atomic operation is invalid", "warning"))) {return __cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);} __attribute__ ((__exclude_from_explicit_instantiation__)) bool compare_exchange_weak(_Tp& __e, _Tp __d, memory_order __s, memory_order __f) noexcept __attribute__((diagnose_if(__f == memory_order_release || __f == memory_order_acq_rel, "memory order argument to atomic operation is invalid", "warning"))) {return __cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);} __attribute__ ((__exclude_from_explicit_instantiation__)) bool compare_exchange_strong(_Tp& __e, _Tp __d, memory_order __s, memory_order __f) volatile noexcept __attribute__((diagnose_if(__f == memory_order_release || __f == memory_order_acq_rel, "memory order argument to atomic operation is invalid", "warning"))) {return __cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);} __attribute__ ((__exclude_from_explicit_instantiation__)) bool compare_exchange_strong(_Tp& __e, _Tp __d, memory_order __s, memory_order __f) noexcept __attribute__((diagnose_if(__f == memory_order_release || __f == memory_order_acq_rel, "memory order argument to atomic operation is invalid", "warning"))) {return __cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);} __attribute__ ((__exclude_from_explicit_instantiation__)) bool compare_exchange_weak(_Tp& __e, _Tp __d, memory_order __m = memory_order_seq_cst) volatile noexcept {return __cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) bool compare_exchange_weak(_Tp& __e, _Tp __d, memory_order __m = memory_order_seq_cst) noexcept {return __cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) bool compare_exchange_strong(_Tp& __e, _Tp __d, memory_order __m = memory_order_seq_cst) volatile noexcept {return __cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) bool compare_exchange_strong(_Tp& __e, _Tp __d, memory_order __m = memory_order_seq_cst) noexcept {return __cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) __atomic_base() noexcept = default; __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __atomic_base(_Tp __d) noexcept : __a_(__d) {} __atomic_base(const __atomic_base&) = delete; __atomic_base& operator=(const __atomic_base&) = delete; __atomic_base& operator=(const __atomic_base&) volatile = delete; }; template <class _Tp> struct __atomic_base<_Tp, true> : public __atomic_base<_Tp, false> { typedef __atomic_base<_Tp, false> __base; __attribute__ ((__exclude_from_explicit_instantiation__)) __atomic_base() noexcept = default; __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __atomic_base(_Tp __d) noexcept : __base(__d) {} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) volatile noexcept {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) noexcept {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) volatile noexcept {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) noexcept {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) volatile noexcept {return __cxx_atomic_fetch_and(&this->__a_, __op, __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) noexcept {return __cxx_atomic_fetch_and(&this->__a_, __op, __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) volatile noexcept {return __cxx_atomic_fetch_or(&this->__a_, __op, __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) noexcept {return __cxx_atomic_fetch_or(&this->__a_, __op, __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) volatile noexcept {return __cxx_atomic_fetch_xor(&this->__a_, __op, __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) noexcept {return __cxx_atomic_fetch_xor(&this->__a_, __op, __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator++(int) volatile noexcept {return fetch_add(_Tp(1));} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator++(int) noexcept {return fetch_add(_Tp(1));} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator--(int) volatile noexcept {return fetch_sub(_Tp(1));} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator--(int) noexcept {return fetch_sub(_Tp(1));} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator++() volatile noexcept {return fetch_add(_Tp(1)) + _Tp(1);} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator++() noexcept {return fetch_add(_Tp(1)) + _Tp(1);} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator--() volatile noexcept {return fetch_sub(_Tp(1)) - _Tp(1);} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator--() noexcept {return fetch_sub(_Tp(1)) - _Tp(1);} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator+=(_Tp __op) volatile noexcept {return fetch_add(__op) + __op;} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator+=(_Tp __op) noexcept {return fetch_add(__op) + __op;} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator-=(_Tp __op) volatile noexcept {return fetch_sub(__op) - __op;} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator-=(_Tp __op) noexcept {return fetch_sub(__op) - __op;} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator&=(_Tp __op) volatile noexcept {return fetch_and(__op) & __op;} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator&=(_Tp __op) noexcept {return fetch_and(__op) & __op;} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator|=(_Tp __op) volatile noexcept {return fetch_or(__op) | __op;} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator|=(_Tp __op) noexcept {return fetch_or(__op) | __op;} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator^=(_Tp __op) volatile noexcept {return fetch_xor(__op) ^ __op;} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator^=(_Tp __op) noexcept {return fetch_xor(__op) ^ __op;} }; template <class _Tp> struct atomic : public __atomic_base<_Tp> { typedef __atomic_base<_Tp> __base; __attribute__ ((__exclude_from_explicit_instantiation__)) atomic() noexcept = default; __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr atomic(_Tp __d) noexcept : __base(__d) {} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator=(_Tp __d) volatile noexcept {__base::store(__d); return __d;} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator=(_Tp __d) noexcept {__base::store(__d); return __d;} }; template <class _Tp> struct atomic<_Tp*> : public __atomic_base<_Tp*> { typedef __atomic_base<_Tp*> __base; __attribute__ ((__exclude_from_explicit_instantiation__)) atomic() noexcept = default; __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr atomic(_Tp* __d) noexcept : __base(__d) {} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* operator=(_Tp* __d) volatile noexcept {__base::store(__d); return __d;} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* operator=(_Tp* __d) noexcept {__base::store(__d); return __d;} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) volatile noexcept {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) noexcept {return __cxx_atomic_fetch_add(&this->__a_, __op, __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) volatile noexcept {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) noexcept {return __cxx_atomic_fetch_sub(&this->__a_, __op, __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* operator++(int) volatile noexcept {return fetch_add(1);} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* operator++(int) noexcept {return fetch_add(1);} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* operator--(int) volatile noexcept {return fetch_sub(1);} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* operator--(int) noexcept {return fetch_sub(1);} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* operator++() volatile noexcept {return fetch_add(1) + 1;} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* operator++() noexcept {return fetch_add(1) + 1;} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* operator--() volatile noexcept {return fetch_sub(1) - 1;} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* operator--() noexcept {return fetch_sub(1) - 1;} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* operator+=(ptrdiff_t __op) volatile noexcept {return fetch_add(__op) + __op;} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* operator+=(ptrdiff_t __op) noexcept {return fetch_add(__op) + __op;} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* operator-=(ptrdiff_t __op) volatile noexcept {return fetch_sub(__op) - __op;} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* operator-=(ptrdiff_t __op) noexcept {return fetch_sub(__op) - __op;} }; template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) bool atomic_is_lock_free(const volatile atomic<_Tp>* __o) noexcept { return __o->is_lock_free(); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) bool atomic_is_lock_free(const atomic<_Tp>* __o) noexcept { return __o->is_lock_free(); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) void atomic_init(volatile atomic<_Tp>* __o, _Tp __d) noexcept { __cxx_atomic_init(&__o->__a_, __d); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) void atomic_init(atomic<_Tp>* __o, _Tp __d) noexcept { __cxx_atomic_init(&__o->__a_, __d); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) void atomic_store(volatile atomic<_Tp>* __o, _Tp __d) noexcept { __o->store(__d); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) void atomic_store(atomic<_Tp>* __o, _Tp __d) noexcept { __o->store(__d); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) void atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) noexcept __attribute__((diagnose_if(__m == memory_order_consume || __m == memory_order_acquire || __m == memory_order_acq_rel, "memory order argument to atomic operation is invalid", "warning"))) { __o->store(__d, __m); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) void atomic_store_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) noexcept __attribute__((diagnose_if(__m == memory_order_consume || __m == memory_order_acquire || __m == memory_order_acq_rel, "memory order argument to atomic operation is invalid", "warning"))) { __o->store(__d, __m); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp atomic_load(const volatile atomic<_Tp>* __o) noexcept { return __o->load(); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp atomic_load(const atomic<_Tp>* __o) noexcept { return __o->load(); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) noexcept __attribute__((diagnose_if(__m == memory_order_release || __m == memory_order_acq_rel, "memory order argument to atomic operation is invalid", "warning"))) { return __o->load(__m); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) noexcept __attribute__((diagnose_if(__m == memory_order_release || __m == memory_order_acq_rel, "memory order argument to atomic operation is invalid", "warning"))) { return __o->load(__m); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp atomic_exchange(volatile atomic<_Tp>* __o, _Tp __d) noexcept { return __o->exchange(__d); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp atomic_exchange(atomic<_Tp>* __o, _Tp __d) noexcept { return __o->exchange(__d); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp atomic_exchange_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) noexcept { return __o->exchange(__d, __m); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp atomic_exchange_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) noexcept { return __o->exchange(__d, __m); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) bool atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) noexcept { return __o->compare_exchange_weak(*__e, __d); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) bool atomic_compare_exchange_weak(atomic<_Tp>* __o, _Tp* __e, _Tp __d) noexcept { return __o->compare_exchange_weak(*__e, __d); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) bool atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) noexcept { return __o->compare_exchange_strong(*__e, __d); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) bool atomic_compare_exchange_strong(atomic<_Tp>* __o, _Tp* __e, _Tp __d) noexcept { return __o->compare_exchange_strong(*__e, __d); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) bool atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d, memory_order __s, memory_order __f) noexcept __attribute__((diagnose_if(__f == memory_order_release || __f == memory_order_acq_rel, "memory order argument to atomic operation is invalid", "warning"))) { return __o->compare_exchange_weak(*__e, __d, __s, __f); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) bool atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, _Tp* __e, _Tp __d, memory_order __s, memory_order __f) noexcept __attribute__((diagnose_if(__f == memory_order_release || __f == memory_order_acq_rel, "memory order argument to atomic operation is invalid", "warning"))) { return __o->compare_exchange_weak(*__e, __d, __s, __f); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) bool atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d, memory_order __s, memory_order __f) noexcept __attribute__((diagnose_if(__f == memory_order_release || __f == memory_order_acq_rel, "memory order argument to atomic operation is invalid", "warning"))) { return __o->compare_exchange_strong(*__e, __d, __s, __f); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) bool atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, _Tp* __e, _Tp __d, memory_order __s, memory_order __f) noexcept __attribute__((diagnose_if(__f == memory_order_release || __f == memory_order_acq_rel, "memory order argument to atomic operation is invalid", "warning"))) { return __o->compare_exchange_strong(*__e, __d, __s, __f); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type atomic_fetch_add(volatile atomic<_Tp>* __o, _Tp __op) noexcept { return __o->fetch_add(__op); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type atomic_fetch_add(atomic<_Tp>* __o, _Tp __op) noexcept { return __o->fetch_add(__op); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* atomic_fetch_add(volatile atomic<_Tp*>* __o, ptrdiff_t __op) noexcept { return __o->fetch_add(__op); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* atomic_fetch_add(atomic<_Tp*>* __o, ptrdiff_t __op) noexcept { return __o->fetch_add(__op); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type atomic_fetch_add_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) noexcept { return __o->fetch_add(__op, __m); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type atomic_fetch_add_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) noexcept { return __o->fetch_add(__op, __m); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) noexcept { return __o->fetch_add(__op, __m); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* atomic_fetch_add_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) noexcept { return __o->fetch_add(__op, __m); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type atomic_fetch_sub(volatile atomic<_Tp>* __o, _Tp __op) noexcept { return __o->fetch_sub(__op); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type atomic_fetch_sub(atomic<_Tp>* __o, _Tp __op) noexcept { return __o->fetch_sub(__op); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* atomic_fetch_sub(volatile atomic<_Tp*>* __o, ptrdiff_t __op) noexcept { return __o->fetch_sub(__op); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* atomic_fetch_sub(atomic<_Tp*>* __o, ptrdiff_t __op) noexcept { return __o->fetch_sub(__op); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type atomic_fetch_sub_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) noexcept { return __o->fetch_sub(__op, __m); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type atomic_fetch_sub_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) noexcept { return __o->fetch_sub(__op, __m); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) noexcept { return __o->fetch_sub(__op, __m); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* atomic_fetch_sub_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) noexcept { return __o->fetch_sub(__op, __m); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type atomic_fetch_and(volatile atomic<_Tp>* __o, _Tp __op) noexcept { return __o->fetch_and(__op); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type atomic_fetch_and(atomic<_Tp>* __o, _Tp __op) noexcept { return __o->fetch_and(__op); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type atomic_fetch_and_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) noexcept { return __o->fetch_and(__op, __m); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type atomic_fetch_and_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) noexcept { return __o->fetch_and(__op, __m); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type atomic_fetch_or(volatile atomic<_Tp>* __o, _Tp __op) noexcept { return __o->fetch_or(__op); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type atomic_fetch_or(atomic<_Tp>* __o, _Tp __op) noexcept { return __o->fetch_or(__op); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type atomic_fetch_or_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) noexcept { return __o->fetch_or(__op, __m); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type atomic_fetch_or_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) noexcept { return __o->fetch_or(__op, __m); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type atomic_fetch_xor(volatile atomic<_Tp>* __o, _Tp __op) noexcept { return __o->fetch_xor(__op); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type atomic_fetch_xor(atomic<_Tp>* __o, _Tp __op) noexcept { return __o->fetch_xor(__op); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type atomic_fetch_xor_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) noexcept { return __o->fetch_xor(__op, __m); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_integral<_Tp>::value && !is_same<_Tp, bool>::value, _Tp >::type atomic_fetch_xor_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) noexcept { return __o->fetch_xor(__op, __m); } typedef struct atomic_flag { __cxx_atomic_impl<bool> __a_; __attribute__ ((__exclude_from_explicit_instantiation__)) bool test_and_set(memory_order __m = memory_order_seq_cst) volatile noexcept {return __cxx_atomic_exchange(&__a_, bool(true), __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) bool test_and_set(memory_order __m = memory_order_seq_cst) noexcept {return __cxx_atomic_exchange(&__a_, bool(true), __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) void clear(memory_order __m = memory_order_seq_cst) volatile noexcept {__cxx_atomic_store(&__a_, bool(false), __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) void clear(memory_order __m = memory_order_seq_cst) noexcept {__cxx_atomic_store(&__a_, bool(false), __m);} __attribute__ ((__exclude_from_explicit_instantiation__)) atomic_flag() noexcept = default; __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr atomic_flag(bool __b) noexcept : __a_(__b) {} atomic_flag(const atomic_flag&) = delete; atomic_flag& operator=(const atomic_flag&) = delete; atomic_flag& operator=(const atomic_flag&) volatile = delete; } atomic_flag; inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool atomic_flag_test_and_set(volatile atomic_flag* __o) noexcept { return __o->test_and_set(); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool atomic_flag_test_and_set(atomic_flag* __o) noexcept { return __o->test_and_set(); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool atomic_flag_test_and_set_explicit(volatile atomic_flag* __o, memory_order __m) noexcept { return __o->test_and_set(__m); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool atomic_flag_test_and_set_explicit(atomic_flag* __o, memory_order __m) noexcept { return __o->test_and_set(__m); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void atomic_flag_clear(volatile atomic_flag* __o) noexcept { __o->clear(); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void atomic_flag_clear(atomic_flag* __o) noexcept { __o->clear(); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void atomic_flag_clear_explicit(volatile atomic_flag* __o, memory_order __m) noexcept { __o->clear(__m); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void atomic_flag_clear_explicit(atomic_flag* __o, memory_order __m) noexcept { __o->clear(__m); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void atomic_thread_fence(memory_order __m) noexcept { __cxx_atomic_thread_fence(__m); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void atomic_signal_fence(memory_order __m) noexcept { __cxx_atomic_signal_fence(__m); } typedef atomic<bool> atomic_bool; typedef atomic<char> atomic_char; typedef atomic<signed char> atomic_schar; typedef atomic<unsigned char> atomic_uchar; typedef atomic<short> atomic_short; typedef atomic<unsigned short> atomic_ushort; typedef atomic<int> atomic_int; typedef atomic<unsigned int> atomic_uint; typedef atomic<long> atomic_long; typedef atomic<unsigned long> atomic_ulong; typedef atomic<long long> atomic_llong; typedef atomic<unsigned long long> atomic_ullong; typedef atomic<char16_t> atomic_char16_t; typedef atomic<char32_t> atomic_char32_t; typedef atomic<wchar_t> atomic_wchar_t; typedef atomic<int_least8_t> atomic_int_least8_t; typedef atomic<uint_least8_t> atomic_uint_least8_t; typedef atomic<int_least16_t> atomic_int_least16_t; typedef atomic<uint_least16_t> atomic_uint_least16_t; typedef atomic<int_least32_t> atomic_int_least32_t; typedef atomic<uint_least32_t> atomic_uint_least32_t; typedef atomic<int_least64_t> atomic_int_least64_t; typedef atomic<uint_least64_t> atomic_uint_least64_t; typedef atomic<int_fast8_t> atomic_int_fast8_t; typedef atomic<uint_fast8_t> atomic_uint_fast8_t; typedef atomic<int_fast16_t> atomic_int_fast16_t; typedef atomic<uint_fast16_t> atomic_uint_fast16_t; typedef atomic<int_fast32_t> atomic_int_fast32_t; typedef atomic<uint_fast32_t> atomic_uint_fast32_t; typedef atomic<int_fast64_t> atomic_int_fast64_t; typedef atomic<uint_fast64_t> atomic_uint_fast64_t; typedef atomic< int8_t> atomic_int8_t; typedef atomic<uint8_t> atomic_uint8_t; typedef atomic< int16_t> atomic_int16_t; typedef atomic<uint16_t> atomic_uint16_t; typedef atomic< int32_t> atomic_int32_t; typedef atomic<uint32_t> atomic_uint32_t; typedef atomic< int64_t> atomic_int64_t; typedef atomic<uint64_t> atomic_uint64_t; typedef atomic<intptr_t> atomic_intptr_t; typedef atomic<uintptr_t> atomic_uintptr_t; typedef atomic<size_t> atomic_size_t; typedef atomic<ptrdiff_t> atomic_ptrdiff_t; typedef atomic<intmax_t> atomic_intmax_t; typedef atomic<uintmax_t> atomic_uintmax_t; } } namespace std { inline namespace __1 { template <class _ValueType> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _ValueType __libcpp_relaxed_load(_ValueType const* __value) { return __atomic_load_n(__value, 0); } template <class _ValueType> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _ValueType __libcpp_acquire_load(_ValueType const* __value) { return __atomic_load_n(__value, 2); } template <class _Tp> class allocator; template <> class allocator<void> { public: typedef void* pointer; typedef const void* const_pointer; typedef void value_type; template <class _Up> struct rebind {typedef allocator<_Up> other;}; }; template <> class allocator<const void> { public: typedef const void* pointer; typedef const void* const_pointer; typedef const void value_type; template <class _Up> struct rebind {typedef allocator<_Up> other;}; }; template <class _Tp, class = void> struct __has_element_type : false_type {}; template <class _Tp> struct __has_element_type<_Tp, typename __void_t<typename _Tp::element_type>::type> : true_type {}; template <class _Ptr, bool = __has_element_type<_Ptr>::value> struct __pointer_traits_element_type; template <class _Ptr> struct __pointer_traits_element_type<_Ptr, true> { typedef __attribute__((nodebug)) typename _Ptr::element_type type; }; template <template <class, class...> class _Sp, class _Tp, class ..._Args> struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, true> { typedef __attribute__((nodebug)) typename _Sp<_Tp, _Args...>::element_type type; }; template <template <class, class...> class _Sp, class _Tp, class ..._Args> struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, false> { typedef __attribute__((nodebug)) _Tp type; }; template <class _Tp, class = void> struct __has_difference_type : false_type {}; template <class _Tp> struct __has_difference_type<_Tp, typename __void_t<typename _Tp::difference_type>::type> : true_type {}; template <class _Ptr, bool = __has_difference_type<_Ptr>::value> struct __pointer_traits_difference_type { typedef __attribute__((nodebug)) ptrdiff_t type; }; template <class _Ptr> struct __pointer_traits_difference_type<_Ptr, true> { typedef __attribute__((nodebug)) typename _Ptr::difference_type type; }; template <class _Tp, class _Up> struct __has_rebind { private: struct __two {char __lx; char __lxx;}; template <class _Xp> static __two __test(...); template <class _Xp> static char __test(typename _Xp::template rebind<_Up>* = 0); public: static const bool value = sizeof(__test<_Tp>(0)) == 1; }; template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value> struct __pointer_traits_rebind { typedef __attribute__((nodebug)) typename _Tp::template rebind<_Up> type; }; template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up> struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, true> { typedef __attribute__((nodebug)) typename _Sp<_Tp, _Args...>::template rebind<_Up> type; }; template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up> struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, false> { typedef _Sp<_Up, _Args...> type; }; template <class _Ptr> struct pointer_traits { typedef _Ptr pointer; typedef typename __pointer_traits_element_type<pointer>::type element_type; typedef typename __pointer_traits_difference_type<pointer>::type difference_type; template <class _Up> using rebind = typename __pointer_traits_rebind<pointer, _Up>::type; private: struct __nat {}; public: __attribute__ ((__exclude_from_explicit_instantiation__)) static pointer pointer_to(typename conditional<is_void<element_type>::value, __nat, element_type>::type& __r) {return pointer::pointer_to(__r);} }; template <class _Tp> struct pointer_traits<_Tp*> { typedef _Tp* pointer; typedef _Tp element_type; typedef ptrdiff_t difference_type; template <class _Up> using rebind = _Up*; private: struct __nat {}; public: __attribute__ ((__exclude_from_explicit_instantiation__)) static pointer pointer_to(typename conditional<is_void<element_type>::value, __nat, element_type>::type& __r) noexcept {return std::__1::addressof(__r);} }; template <class _From, class _To> struct __rebind_pointer { typedef typename pointer_traits<_From>::template rebind<_To> type; }; template <class _Tp, class = void> struct __has_pointer_type : false_type {}; template <class _Tp> struct __has_pointer_type<_Tp, typename __void_t<typename _Tp::pointer>::type> : true_type {}; namespace __pointer_type_imp { template <class _Tp, class _Dp, bool = __has_pointer_type<_Dp>::value> struct __pointer_type { typedef __attribute__((nodebug)) typename _Dp::pointer type; }; template <class _Tp, class _Dp> struct __pointer_type<_Tp, _Dp, false> { typedef __attribute__((nodebug)) _Tp* type; }; } template <class _Tp, class _Dp> struct __pointer_type { typedef __attribute__((nodebug)) typename __pointer_type_imp::__pointer_type<_Tp, typename remove_reference<_Dp>::type>::type type; }; template <class _Tp, class = void> struct __has_const_pointer : false_type {}; template <class _Tp> struct __has_const_pointer<_Tp, typename __void_t<typename _Tp::const_pointer>::type> : true_type {}; template <class _Tp, class _Ptr, class _Alloc, bool = __has_const_pointer<_Alloc>::value> struct __const_pointer { typedef __attribute__((nodebug)) typename _Alloc::const_pointer type; }; template <class _Tp, class _Ptr, class _Alloc> struct __const_pointer<_Tp, _Ptr, _Alloc, false> { typedef __attribute__((nodebug)) typename pointer_traits<_Ptr>::template rebind<const _Tp> type; }; template <class _Tp, class = void> struct __has_void_pointer : false_type {}; template <class _Tp> struct __has_void_pointer<_Tp, typename __void_t<typename _Tp::void_pointer>::type> : true_type {}; template <class _Ptr, class _Alloc, bool = __has_void_pointer<_Alloc>::value> struct __void_pointer { typedef __attribute__((nodebug)) typename _Alloc::void_pointer type; }; template <class _Ptr, class _Alloc> struct __void_pointer<_Ptr, _Alloc, false> { typedef __attribute__((nodebug)) typename pointer_traits<_Ptr>::template rebind<void> type; }; template <class _Tp, class = void> struct __has_const_void_pointer : false_type {}; template <class _Tp> struct __has_const_void_pointer<_Tp, typename __void_t<typename _Tp::const_void_pointer>::type> : true_type {}; template <class _Ptr, class _Alloc, bool = __has_const_void_pointer<_Alloc>::value> struct __const_void_pointer { typedef __attribute__((nodebug)) typename _Alloc::const_void_pointer type; }; template <class _Ptr, class _Alloc> struct __const_void_pointer<_Ptr, _Alloc, false> { typedef __attribute__((nodebug)) typename pointer_traits<_Ptr>::template rebind<const void> type; }; template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _Tp* __to_raw_pointer(_Tp* __p) noexcept { return __p; } template <class _Pointer> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename pointer_traits<_Pointer>::element_type* __to_raw_pointer(_Pointer __p) noexcept { return std::__1::__to_raw_pointer(__p.operator->()); } template <class _Tp, class = void> struct __has_size_type : false_type {}; template <class _Tp> struct __has_size_type<_Tp, typename __void_t<typename _Tp::size_type>::type> : true_type {}; template <class _Alloc, class _DiffType, bool = __has_size_type<_Alloc>::value> struct __size_type { typedef __attribute__((nodebug)) typename make_unsigned<_DiffType>::type type; }; template <class _Alloc, class _DiffType> struct __size_type<_Alloc, _DiffType, true> { typedef __attribute__((nodebug)) typename _Alloc::size_type type; }; template <class _Tp, class = void> struct __has_propagate_on_container_copy_assignment : false_type {}; template <class _Tp> struct __has_propagate_on_container_copy_assignment<_Tp, typename __void_t<typename _Tp::propagate_on_container_copy_assignment>::type> : true_type {}; template <class _Alloc, bool = __has_propagate_on_container_copy_assignment<_Alloc>::value> struct __propagate_on_container_copy_assignment { typedef __attribute__((nodebug)) false_type type; }; template <class _Alloc> struct __propagate_on_container_copy_assignment<_Alloc, true> { typedef __attribute__((nodebug)) typename _Alloc::propagate_on_container_copy_assignment type; }; template <class _Tp, class = void> struct __has_propagate_on_container_move_assignment : false_type {}; template <class _Tp> struct __has_propagate_on_container_move_assignment<_Tp, typename __void_t<typename _Tp::propagate_on_container_move_assignment>::type> : true_type {}; template <class _Alloc, bool = __has_propagate_on_container_move_assignment<_Alloc>::value> struct __propagate_on_container_move_assignment { typedef false_type type; }; template <class _Alloc> struct __propagate_on_container_move_assignment<_Alloc, true> { typedef __attribute__((nodebug)) typename _Alloc::propagate_on_container_move_assignment type; }; template <class _Tp, class = void> struct __has_propagate_on_container_swap : false_type {}; template <class _Tp> struct __has_propagate_on_container_swap<_Tp, typename __void_t<typename _Tp::propagate_on_container_swap>::type> : true_type {}; template <class _Alloc, bool = __has_propagate_on_container_swap<_Alloc>::value> struct __propagate_on_container_swap { typedef false_type type; }; template <class _Alloc> struct __propagate_on_container_swap<_Alloc, true> { typedef __attribute__((nodebug)) typename _Alloc::propagate_on_container_swap type; }; template <class _Tp, class = void> struct __has_is_always_equal : false_type {}; template <class _Tp> struct __has_is_always_equal<_Tp, typename __void_t<typename _Tp::is_always_equal>::type> : true_type {}; template <class _Alloc, bool = __has_is_always_equal<_Alloc>::value> struct __is_always_equal { typedef __attribute__((nodebug)) typename std::__1::is_empty<_Alloc>::type type; }; template <class _Alloc> struct __is_always_equal<_Alloc, true> { typedef __attribute__((nodebug)) typename _Alloc::is_always_equal type; }; template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value> struct __has_rebind_other { private: struct __two {char __lx; char __lxx;}; template <class _Xp> static __two __test(...); template <class _Xp> static char __test(typename _Xp::template rebind<_Up>::other* = 0); public: static const bool value = sizeof(__test<_Tp>(0)) == 1; }; template <class _Tp, class _Up> struct __has_rebind_other<_Tp, _Up, false> { static const bool value = false; }; template <class _Tp, class _Up, bool = __has_rebind_other<_Tp, _Up>::value> struct __allocator_traits_rebind { typedef __attribute__((nodebug)) typename _Tp::template rebind<_Up>::other type; }; template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up> struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, true> { typedef __attribute__((nodebug)) typename _Alloc<_Tp, _Args...>::template rebind<_Up>::other type; }; template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up> struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, false> { typedef __attribute__((nodebug)) _Alloc<_Up, _Args...> type; }; template <class _Alloc, class _SizeType, class _ConstVoidPtr> auto __has_allocate_hint_test(_Alloc&& __a, _SizeType&& __sz, _ConstVoidPtr&& __p) -> decltype((void)__a.allocate(__sz, __p), true_type()); template <class _Alloc, class _SizeType, class _ConstVoidPtr> auto __has_allocate_hint_test(const _Alloc& __a, _SizeType&& __sz, _ConstVoidPtr&& __p) -> false_type; template <class _Alloc, class _SizeType, class _ConstVoidPtr> struct __has_allocate_hint : integral_constant<bool, is_same< decltype(std::__1::__has_allocate_hint_test(declval<_Alloc>(), declval<_SizeType>(), declval<_ConstVoidPtr>())), true_type>::value> { }; template <class _Alloc, class _Tp, class ..._Args> decltype(std::__1::declval<_Alloc>().construct(std::__1::declval<_Tp*>(), std::__1::declval<_Args>()...), true_type()) __has_construct_test(_Alloc&& __a, _Tp* __p, _Args&& ...__args); template <class _Alloc, class _Pointer, class ..._Args> false_type __has_construct_test(const _Alloc& __a, _Pointer&& __p, _Args&& ...__args); template <class _Alloc, class _Pointer, class ..._Args> struct __has_construct : integral_constant<bool, is_same< decltype(std::__1::__has_construct_test(declval<_Alloc>(), declval<_Pointer>(), declval<_Args>()...)), true_type>::value> { }; template <class _Alloc, class _Pointer> auto __has_destroy_test(_Alloc&& __a, _Pointer&& __p) -> decltype(__a.destroy(__p), true_type()); template <class _Alloc, class _Pointer> auto __has_destroy_test(const _Alloc& __a, _Pointer&& __p) -> false_type; template <class _Alloc, class _Pointer> struct __has_destroy : integral_constant<bool, is_same< decltype(std::__1::__has_destroy_test(declval<_Alloc>(), declval<_Pointer>())), true_type>::value> { }; template <class _Alloc> auto __has_max_size_test(_Alloc&& __a) -> decltype(__a.max_size(), true_type()); template <class _Alloc> auto __has_max_size_test(const volatile _Alloc& __a) -> false_type; template <class _Alloc> struct __has_max_size : integral_constant<bool, is_same< decltype(std::__1::__has_max_size_test(declval<_Alloc&>())), true_type>::value> { }; template <class _Alloc> auto __has_select_on_container_copy_construction_test(_Alloc&& __a) -> decltype(__a.select_on_container_copy_construction(), true_type()); template <class _Alloc> auto __has_select_on_container_copy_construction_test(const volatile _Alloc& __a) -> false_type; template <class _Alloc> struct __has_select_on_container_copy_construction : integral_constant<bool, is_same< decltype(std::__1::__has_select_on_container_copy_construction_test(declval<_Alloc&>())), true_type>::value> { }; template <class _Alloc, class _Ptr, bool = __has_difference_type<_Alloc>::value> struct __alloc_traits_difference_type { typedef __attribute__((nodebug)) typename pointer_traits<_Ptr>::difference_type type; }; template <class _Alloc, class _Ptr> struct __alloc_traits_difference_type<_Alloc, _Ptr, true> { typedef __attribute__((nodebug)) typename _Alloc::difference_type type; }; template <class _Tp> struct __is_default_allocator : false_type {}; template <class _Tp> struct __is_default_allocator<std::__1::allocator<_Tp> > : true_type {}; template <class _Alloc, bool = __has_construct<_Alloc, typename _Alloc::value_type*, typename _Alloc::value_type&&>::value && !__is_default_allocator<_Alloc>::value > struct __is_cpp17_move_insertable; template <class _Alloc> struct __is_cpp17_move_insertable<_Alloc, true> : std::true_type {}; template <class _Alloc> struct __is_cpp17_move_insertable<_Alloc, false> : std::is_move_constructible<typename _Alloc::value_type> {}; template <class _Alloc, bool = __has_construct<_Alloc, typename _Alloc::value_type*, const typename _Alloc::value_type&>::value && !__is_default_allocator<_Alloc>::value > struct __is_cpp17_copy_insertable; template <class _Alloc> struct __is_cpp17_copy_insertable<_Alloc, true> : __is_cpp17_move_insertable<_Alloc> {}; template <class _Alloc> struct __is_cpp17_copy_insertable<_Alloc, false> : integral_constant<bool, std::is_copy_constructible<typename _Alloc::value_type>::value && __is_cpp17_move_insertable<_Alloc>::value> {}; template <class _Alloc> struct allocator_traits { typedef _Alloc allocator_type; typedef typename allocator_type::value_type value_type; typedef typename __pointer_type<value_type, allocator_type>::type pointer; typedef typename __const_pointer<value_type, pointer, allocator_type>::type const_pointer; typedef typename __void_pointer<pointer, allocator_type>::type void_pointer; typedef typename __const_void_pointer<pointer, allocator_type>::type const_void_pointer; typedef typename __alloc_traits_difference_type<allocator_type, pointer>::type difference_type; typedef typename __size_type<allocator_type, difference_type>::type size_type; typedef typename __propagate_on_container_copy_assignment<allocator_type>::type propagate_on_container_copy_assignment; typedef typename __propagate_on_container_move_assignment<allocator_type>::type propagate_on_container_move_assignment; typedef typename __propagate_on_container_swap<allocator_type>::type propagate_on_container_swap; typedef typename __is_always_equal<allocator_type>::type is_always_equal; template <class _Tp> using rebind_alloc = typename __allocator_traits_rebind<allocator_type, _Tp>::type; template <class _Tp> using rebind_traits = allocator_traits<rebind_alloc<_Tp> >; [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) static pointer allocate(allocator_type& __a, size_type __n) {return __a.allocate(__n);} [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer __hint) {return __allocate(__a, __n, __hint, __has_allocate_hint<allocator_type, size_type, const_void_pointer>());} __attribute__ ((__exclude_from_explicit_instantiation__)) static void deallocate(allocator_type& __a, pointer __p, size_type __n) noexcept {__a.deallocate(__p, __n);} template <class _Tp, class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) static void construct(allocator_type& __a, _Tp* __p, _Args&&... __args) {__construct(__has_construct<allocator_type, _Tp*, _Args...>(), __a, __p, std::__1::forward<_Args>(__args)...);} template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) static void destroy(allocator_type& __a, _Tp* __p) {__destroy(__has_destroy<allocator_type, _Tp*>(), __a, __p);} __attribute__ ((__exclude_from_explicit_instantiation__)) static size_type max_size(const allocator_type& __a) noexcept {return __max_size(__has_max_size<const allocator_type>(), __a);} __attribute__ ((__exclude_from_explicit_instantiation__)) static allocator_type select_on_container_copy_construction(const allocator_type& __a) {return __select_on_container_copy_construction( __has_select_on_container_copy_construction<const allocator_type>(), __a);} template <class _Ptr> __attribute__ ((__exclude_from_explicit_instantiation__)) static void __construct_forward_with_exception_guarantees(allocator_type& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __begin2) { static_assert(__is_cpp17_move_insertable<allocator_type>::value, "The specified type does not meet the requirements of Cpp17MoveInsertible"); for (; __begin1 != __end1; ++__begin1, (void) ++__begin2) construct(__a, std::__1::__to_raw_pointer(__begin2), std::__1::move(*__begin1) ); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) static typename enable_if < (__is_default_allocator<allocator_type>::value || !__has_construct<allocator_type, _Tp*, _Tp>::value) && is_trivially_move_constructible<_Tp>::value, void >::type __construct_forward_with_exception_guarantees(allocator_type&, _Tp* __begin1, _Tp* __end1, _Tp*& __begin2) { ptrdiff_t _Np = __end1 - __begin1; if (_Np > 0) { std::__1::memcpy(__begin2, __begin1, _Np * sizeof(_Tp)); __begin2 += _Np; } } template <class _Iter, class _Ptr> __attribute__ ((__exclude_from_explicit_instantiation__)) static void __construct_range_forward(allocator_type& __a, _Iter __begin1, _Iter __end1, _Ptr& __begin2) { for (; __begin1 != __end1; ++__begin1, (void) ++__begin2) construct(__a, std::__1::__to_raw_pointer(__begin2), *__begin1); } template <class _SourceTp, class _DestTp, class _RawSourceTp = typename remove_const<_SourceTp>::type, class _RawDestTp = typename remove_const<_DestTp>::type> __attribute__ ((__exclude_from_explicit_instantiation__)) static typename enable_if < is_trivially_move_constructible<_DestTp>::value && is_same<_RawSourceTp, _RawDestTp>::value && (__is_default_allocator<allocator_type>::value || !__has_construct<allocator_type, _DestTp*, _SourceTp&>::value), void >::type __construct_range_forward(allocator_type&, _SourceTp* __begin1, _SourceTp* __end1, _DestTp*& __begin2) { ptrdiff_t _Np = __end1 - __begin1; if (_Np > 0) { std::__1::memcpy(const_cast<_RawDestTp*>(__begin2), __begin1, _Np * sizeof(_DestTp)); __begin2 += _Np; } } template <class _Ptr> __attribute__ ((__exclude_from_explicit_instantiation__)) static void __construct_backward_with_exception_guarantees(allocator_type& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __end2) { static_assert(__is_cpp17_move_insertable<allocator_type>::value, "The specified type does not meet the requirements of Cpp17MoveInsertable"); while (__end1 != __begin1) { construct(__a, std::__1::__to_raw_pointer(__end2 - 1), std::__1::move(*--__end1) ); --__end2; } } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) static typename enable_if < (__is_default_allocator<allocator_type>::value || !__has_construct<allocator_type, _Tp*, _Tp>::value) && is_trivially_move_constructible<_Tp>::value, void >::type __construct_backward_with_exception_guarantees(allocator_type&, _Tp* __begin1, _Tp* __end1, _Tp*& __end2) { ptrdiff_t _Np = __end1 - __begin1; __end2 -= _Np; if (_Np > 0) std::__1::memcpy(__end2, __begin1, _Np * sizeof(_Tp)); } private: __attribute__ ((__exclude_from_explicit_instantiation__)) static pointer __allocate(allocator_type& __a, size_type __n, const_void_pointer __hint, true_type) {return __a.allocate(__n, __hint);} __attribute__ ((__exclude_from_explicit_instantiation__)) static pointer __allocate(allocator_type& __a, size_type __n, const_void_pointer, false_type) {return __a.allocate(__n);} template <class _Tp, class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) static void __construct(true_type, allocator_type& __a, _Tp* __p, _Args&&... __args) {__a.construct(__p, std::__1::forward<_Args>(__args)...);} template <class _Tp, class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) static void __construct(false_type, allocator_type&, _Tp* __p, _Args&&... __args) { ::new ((void*)__p) _Tp(std::__1::forward<_Args>(__args)...); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) static void __destroy(true_type, allocator_type& __a, _Tp* __p) {__a.destroy(__p);} template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) static void __destroy(false_type, allocator_type&, _Tp* __p) { __p->~_Tp(); } __attribute__ ((__exclude_from_explicit_instantiation__)) static size_type __max_size(true_type, const allocator_type& __a) noexcept {return __a.max_size();} __attribute__ ((__exclude_from_explicit_instantiation__)) static size_type __max_size(false_type, const allocator_type&) noexcept {return numeric_limits<size_type>::max() / sizeof(value_type);} __attribute__ ((__exclude_from_explicit_instantiation__)) static allocator_type __select_on_container_copy_construction(true_type, const allocator_type& __a) {return __a.select_on_container_copy_construction();} __attribute__ ((__exclude_from_explicit_instantiation__)) static allocator_type __select_on_container_copy_construction(false_type, const allocator_type& __a) {return __a;} }; template <class _Traits, class _Tp> struct __rebind_alloc_helper { typedef __attribute__((nodebug)) typename _Traits::template rebind_alloc<_Tp> type; }; template <class _Tp> class allocator { public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef _Tp* pointer; typedef const _Tp* const_pointer; typedef _Tp& reference; typedef const _Tp& const_reference; typedef _Tp value_type; typedef true_type propagate_on_container_move_assignment; typedef true_type is_always_equal; template <class _Up> struct rebind {typedef allocator<_Up> other;}; __attribute__ ((__exclude_from_explicit_instantiation__)) allocator() noexcept {} template <class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) allocator(const allocator<_Up>&) noexcept {} __attribute__ ((__exclude_from_explicit_instantiation__)) pointer address(reference __x) const noexcept {return std::__1::addressof(__x);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_pointer address(const_reference __x) const noexcept {return std::__1::addressof(__x);} [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) pointer allocate(size_type __n, allocator<void>::const_pointer = 0) { if (__n > max_size()) __throw_length_error("allocator<T>::allocate(size_t n)" " 'n' exceeds maximum supported size"); return static_cast<pointer>(std::__1::__libcpp_allocate(__n * sizeof(_Tp), alignof(_Tp))); } __attribute__ ((__exclude_from_explicit_instantiation__)) void deallocate(pointer __p, size_type __n) noexcept {std::__1::__libcpp_deallocate((void*)__p, __n * sizeof(_Tp), alignof(_Tp));} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type max_size() const noexcept {return size_type(~0) / sizeof(_Tp);} template <class _Up, class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) void construct(_Up* __p, _Args&&... __args) { ::new((void*)__p) _Up(std::__1::forward<_Args>(__args)...); } __attribute__ ((__exclude_from_explicit_instantiation__)) void destroy(pointer __p) {__p->~_Tp();} }; template <class _Tp> class allocator<const _Tp> { public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef const _Tp* pointer; typedef const _Tp* const_pointer; typedef const _Tp& reference; typedef const _Tp& const_reference; typedef const _Tp value_type; typedef true_type propagate_on_container_move_assignment; typedef true_type is_always_equal; template <class _Up> struct rebind {typedef allocator<_Up> other;}; __attribute__ ((__exclude_from_explicit_instantiation__)) allocator() noexcept {} template <class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) allocator(const allocator<_Up>&) noexcept {} __attribute__ ((__exclude_from_explicit_instantiation__)) const_pointer address(const_reference __x) const noexcept {return std::__1::addressof(__x);} __attribute__ ((__exclude_from_explicit_instantiation__)) pointer allocate(size_type __n, allocator<void>::const_pointer = 0) { if (__n > max_size()) __throw_length_error("allocator<const T>::allocate(size_t n)" " 'n' exceeds maximum supported size"); return static_cast<pointer>(std::__1::__libcpp_allocate(__n * sizeof(_Tp), alignof(_Tp))); } __attribute__ ((__exclude_from_explicit_instantiation__)) void deallocate(pointer __p, size_type __n) noexcept {std::__1::__libcpp_deallocate((void*) const_cast<_Tp *>(__p), __n * sizeof(_Tp), alignof(_Tp));} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type max_size() const noexcept {return size_type(~0) / sizeof(_Tp);} template <class _Up, class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) void construct(_Up* __p, _Args&&... __args) { ::new((void*)__p) _Up(std::__1::forward<_Args>(__args)...); } __attribute__ ((__exclude_from_explicit_instantiation__)) void destroy(pointer __p) {__p->~_Tp();} }; template <class _Tp, class _Up> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const allocator<_Tp>&, const allocator<_Up>&) noexcept {return true;} template <class _Tp, class _Up> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const allocator<_Tp>&, const allocator<_Up>&) noexcept {return false;} template <class _OutputIterator, class _Tp> class raw_storage_iterator : public iterator<output_iterator_tag, _Tp, ptrdiff_t, _Tp*, raw_storage_iterator<_OutputIterator, _Tp>&> { private: _OutputIterator __x_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit raw_storage_iterator(_OutputIterator __x) : __x_(__x) {} __attribute__ ((__exclude_from_explicit_instantiation__)) raw_storage_iterator& operator*() {return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) raw_storage_iterator& operator=(const _Tp& __element) {::new(std::__1::addressof(*__x_)) _Tp(__element); return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) raw_storage_iterator& operator=(_Tp&& __element) {::new(std::__1::addressof(*__x_)) _Tp(std::__1::move(__element)); return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) raw_storage_iterator& operator++() {++__x_; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) raw_storage_iterator operator++(int) {raw_storage_iterator __t(*this); ++__x_; return __t;} __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator base() const { return __x_; } }; template <class _Tp> [[nodiscard]] __attribute__((__no_sanitize__("cfi"))) pair<_Tp*, ptrdiff_t> get_temporary_buffer(ptrdiff_t __n) noexcept { pair<_Tp*, ptrdiff_t> __r(0, 0); const ptrdiff_t __m = (~ptrdiff_t(0) ^ ptrdiff_t(ptrdiff_t(1) << (sizeof(ptrdiff_t) * 8 - 1))) / sizeof(_Tp); if (__n > __m) __n = __m; while (__n > 0) { if (__is_overaligned_for_new(alignof(_Tp))) { return __r; } __r.first = static_cast<_Tp*>(::operator new(__n * sizeof(_Tp), nothrow)); if (__r.first) { __r.second = __n; break; } __n /= 2; } return __r; } template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void return_temporary_buffer(_Tp* __p) noexcept { std::__1::__libcpp_deallocate_unsized((void*)__p, alignof(_Tp)); } template <class _Tp> struct __attribute__ ((deprecated)) auto_ptr_ref { _Tp* __ptr_; }; template<class _Tp> class __attribute__ ((deprecated)) auto_ptr { private: _Tp* __ptr_; public: typedef _Tp element_type; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit auto_ptr(_Tp* __p = 0) throw() : __ptr_(__p) {} __attribute__ ((__exclude_from_explicit_instantiation__)) auto_ptr(auto_ptr& __p) throw() : __ptr_(__p.release()) {} template<class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) auto_ptr(auto_ptr<_Up>& __p) throw() : __ptr_(__p.release()) {} __attribute__ ((__exclude_from_explicit_instantiation__)) auto_ptr& operator=(auto_ptr& __p) throw() {reset(__p.release()); return *this;} template<class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) auto_ptr& operator=(auto_ptr<_Up>& __p) throw() {reset(__p.release()); return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) auto_ptr& operator=(auto_ptr_ref<_Tp> __p) throw() {reset(__p.__ptr_); return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) ~auto_ptr() throw() {delete __ptr_;} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp& operator*() const throw() {return *__ptr_;} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* operator->() const throw() {return __ptr_;} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* get() const throw() {return __ptr_;} __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* release() throw() { _Tp* __t = __ptr_; __ptr_ = 0; return __t; } __attribute__ ((__exclude_from_explicit_instantiation__)) void reset(_Tp* __p = 0) throw() { if (__ptr_ != __p) delete __ptr_; __ptr_ = __p; } __attribute__ ((__exclude_from_explicit_instantiation__)) auto_ptr(auto_ptr_ref<_Tp> __p) throw() : __ptr_(__p.__ptr_) {} template<class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) operator auto_ptr_ref<_Up>() throw() {auto_ptr_ref<_Up> __t; __t.__ptr_ = release(); return __t;} template<class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) operator auto_ptr<_Up>() throw() {return auto_ptr<_Up>(release());} }; template <> class __attribute__ ((deprecated)) auto_ptr<void> { public: typedef void element_type; }; template <class _Tp, int _Idx, bool _CanBeEmptyBase = is_empty<_Tp>::value && !__libcpp_is_final<_Tp>::value> struct __compressed_pair_elem { typedef _Tp _ParamT; typedef _Tp& reference; typedef const _Tp& const_reference; __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __compressed_pair_elem() : __value_() {} template <class _Up, class = typename enable_if< !is_same<__compressed_pair_elem, typename decay<_Up>::type>::value >::type> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr explicit __compressed_pair_elem(_Up&& __u) : __value_(std::__1::forward<_Up>(__u)) { } template <class... _Args, size_t... _Indexes> __attribute__ ((__exclude_from_explicit_instantiation__)) __compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args, __tuple_indices<_Indexes...>) : __value_(std::__1::forward<_Args>(std::__1::get<_Indexes>(__args))...) {} __attribute__ ((__exclude_from_explicit_instantiation__)) reference __get() noexcept { return __value_; } __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference __get() const noexcept { return __value_; } private: _Tp __value_; }; template <class _Tp, int _Idx> struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp { typedef _Tp _ParamT; typedef _Tp& reference; typedef const _Tp& const_reference; typedef _Tp __value_type; __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __compressed_pair_elem() = default; template <class _Up, class = typename enable_if< !is_same<__compressed_pair_elem, typename decay<_Up>::type>::value >::type> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr explicit __compressed_pair_elem(_Up&& __u) : __value_type(std::__1::forward<_Up>(__u)) {} template <class... _Args, size_t... _Indexes> __attribute__ ((__exclude_from_explicit_instantiation__)) __compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args, __tuple_indices<_Indexes...>) : __value_type(std::__1::forward<_Args>(std::__1::get<_Indexes>(__args))...) {} __attribute__ ((__exclude_from_explicit_instantiation__)) reference __get() noexcept { return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference __get() const noexcept { return *this; } }; struct __second_tag {}; template <class _T1, class _T2> class __compressed_pair : private __compressed_pair_elem<_T1, 0>, private __compressed_pair_elem<_T2, 1> { typedef __attribute__((nodebug)) __compressed_pair_elem<_T1, 0> _Base1; typedef __attribute__((nodebug)) __compressed_pair_elem<_T2, 1> _Base2; static_assert((!is_same<_T1, _T2>::value), "__compressed_pair cannot be instantated when T1 and T2 are the same type; " "The current implementation is NOT ABI-compatible with the previous " "implementation for this configuration"); public: template <bool _Dummy = true, class = typename enable_if< __dependent_type<is_default_constructible<_T1>, _Dummy>::value && __dependent_type<is_default_constructible<_T2>, _Dummy>::value >::type > __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __compressed_pair() {} template <class _Tp, typename enable_if<!is_same<typename decay<_Tp>::type, __compressed_pair>::value, bool>::type = true> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr explicit __compressed_pair(_Tp&& __t) : _Base1(std::forward<_Tp>(__t)), _Base2() {} template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __compressed_pair(__second_tag, _Tp&& __t) : _Base1(), _Base2(std::forward<_Tp>(__t)) {} template <class _U1, class _U2> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __compressed_pair(_U1&& __t1, _U2&& __t2) : _Base1(std::forward<_U1>(__t1)), _Base2(std::forward<_U2>(__t2)) {} template <class... _Args1, class... _Args2> __attribute__ ((__exclude_from_explicit_instantiation__)) __compressed_pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, tuple<_Args2...> __second_args) : _Base1(__pc, std::__1::move(__first_args), typename __make_tuple_indices<sizeof...(_Args1)>::type()), _Base2(__pc, std::__1::move(__second_args), typename __make_tuple_indices<sizeof...(_Args2)>::type()) {} __attribute__ ((__exclude_from_explicit_instantiation__)) typename _Base1::reference first() noexcept { return static_cast<_Base1&>(*this).__get(); } __attribute__ ((__exclude_from_explicit_instantiation__)) typename _Base1::const_reference first() const noexcept { return static_cast<_Base1 const&>(*this).__get(); } __attribute__ ((__exclude_from_explicit_instantiation__)) typename _Base2::reference second() noexcept { return static_cast<_Base2&>(*this).__get(); } __attribute__ ((__exclude_from_explicit_instantiation__)) typename _Base2::const_reference second() const noexcept { return static_cast<_Base2 const&>(*this).__get(); } __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(__compressed_pair& __x) noexcept(__is_nothrow_swappable<_T1>::value && __is_nothrow_swappable<_T2>::value) { using std::swap; swap(first(), __x.first()); swap(second(), __x.second()); } }; template <class _T1, class _T2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(__compressed_pair<_T1, _T2>& __x, __compressed_pair<_T1, _T2>& __y) noexcept(__is_nothrow_swappable<_T1>::value && __is_nothrow_swappable<_T2>::value) { __x.swap(__y); } template <class _Tp> struct default_delete { static_assert(!is_function<_Tp>::value, "default_delete cannot be instantiated for function types"); __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr default_delete() noexcept = default; template <class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) default_delete(const default_delete<_Up>&, typename enable_if<is_convertible<_Up*, _Tp*>::value>::type* = 0) noexcept {} __attribute__ ((__exclude_from_explicit_instantiation__)) void operator()(_Tp* __ptr) const noexcept { static_assert(sizeof(_Tp) > 0, "default_delete can not delete incomplete type"); static_assert(!is_void<_Tp>::value, "default_delete can not delete incomplete type"); delete __ptr; } }; template <class _Tp> struct default_delete<_Tp[]> { private: template <class _Up> struct _EnableIfConvertible : enable_if<is_convertible<_Up(*)[], _Tp(*)[]>::value> {}; public: __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr default_delete() noexcept = default; template <class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) default_delete(const default_delete<_Up[]>&, typename _EnableIfConvertible<_Up>::type* = 0) noexcept {} template <class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) typename _EnableIfConvertible<_Up>::type operator()(_Up* __ptr) const noexcept { static_assert(sizeof(_Tp) > 0, "default_delete can not delete incomplete type"); static_assert(!is_void<_Tp>::value, "default_delete can not delete void type"); delete[] __ptr; } }; template <class _Deleter> struct __unique_ptr_deleter_sfinae { static_assert(!is_reference<_Deleter>::value, "incorrect specialization"); typedef const _Deleter& __lval_ref_type; typedef _Deleter&& __good_rval_ref_type; typedef true_type __enable_rval_overload; }; template <class _Deleter> struct __unique_ptr_deleter_sfinae<_Deleter const&> { typedef const _Deleter& __lval_ref_type; typedef const _Deleter&& __bad_rval_ref_type; typedef false_type __enable_rval_overload; }; template <class _Deleter> struct __unique_ptr_deleter_sfinae<_Deleter&> { typedef _Deleter& __lval_ref_type; typedef _Deleter&& __bad_rval_ref_type; typedef false_type __enable_rval_overload; }; template <class _Tp, class _Dp = default_delete<_Tp> > class unique_ptr { public: typedef _Tp element_type; typedef _Dp deleter_type; typedef __attribute__((nodebug)) typename __pointer_type<_Tp, deleter_type>::type pointer; static_assert(!is_rvalue_reference<deleter_type>::value, "the specified deleter type cannot be an rvalue reference"); private: __compressed_pair<pointer, deleter_type> __ptr_; struct __nat { int __for_bool_; }; typedef __attribute__((nodebug)) __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE; template <bool _Dummy> using _LValRefType __attribute__((nodebug)) = typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type; template <bool _Dummy> using _GoodRValRefType __attribute__((nodebug)) = typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type; template <bool _Dummy> using _BadRValRefType __attribute__((nodebug)) = typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type; template <bool _Dummy, class _Deleter = typename __dependent_type< __identity<deleter_type>, _Dummy>::type> using _EnableIfDeleterDefaultConstructible __attribute__((nodebug)) = typename enable_if<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value>::type; template <class _ArgType> using _EnableIfDeleterConstructible __attribute__((nodebug)) = typename enable_if<is_constructible<deleter_type, _ArgType>::value>::type; template <class _UPtr, class _Up> using _EnableIfMoveConvertible __attribute__((nodebug)) = typename enable_if< is_convertible<typename _UPtr::pointer, pointer>::value && !is_array<_Up>::value >::type; template <class _UDel> using _EnableIfDeleterConvertible __attribute__((nodebug)) = typename enable_if< (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) || (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value) >::type; template <class _UDel> using _EnableIfDeleterAssignable = typename enable_if< is_assignable<_Dp&, _UDel&&>::value >::type; public: template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr unique_ptr() noexcept : __ptr_(pointer()) {} template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr unique_ptr(nullptr_t) noexcept : __ptr_(pointer()) {} template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > __attribute__ ((__exclude_from_explicit_instantiation__)) explicit unique_ptr(pointer __p) noexcept : __ptr_(__p) {} template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > > __attribute__ ((__exclude_from_explicit_instantiation__)) unique_ptr(pointer __p, _LValRefType<_Dummy> __d) noexcept : __ptr_(__p, __d) {} template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > > __attribute__ ((__exclude_from_explicit_instantiation__)) unique_ptr(pointer __p, _GoodRValRefType<_Dummy> __d) noexcept : __ptr_(__p, std::__1::move(__d)) { static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference"); } template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy> > > __attribute__ ((__exclude_from_explicit_instantiation__)) unique_ptr(pointer __p, _BadRValRefType<_Dummy> __d) = delete; __attribute__ ((__exclude_from_explicit_instantiation__)) unique_ptr(unique_ptr&& __u) noexcept : __ptr_(__u.release(), std::__1::forward<deleter_type>(__u.get_deleter())) { } template <class _Up, class _Ep, class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>, class = _EnableIfDeleterConvertible<_Ep> > __attribute__ ((__exclude_from_explicit_instantiation__)) unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept : __ptr_(__u.release(), std::__1::forward<_Ep>(__u.get_deleter())) {} template <class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) unique_ptr(auto_ptr<_Up>&& __p, typename enable_if<is_convertible<_Up*, _Tp*>::value && is_same<_Dp, default_delete<_Tp> >::value, __nat>::type = __nat()) noexcept : __ptr_(__p.release()) {} __attribute__ ((__exclude_from_explicit_instantiation__)) unique_ptr& operator=(unique_ptr&& __u) noexcept { reset(__u.release()); __ptr_.second() = std::__1::forward<deleter_type>(__u.get_deleter()); return *this; } template <class _Up, class _Ep, class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>, class = _EnableIfDeleterAssignable<_Ep> > __attribute__ ((__exclude_from_explicit_instantiation__)) unique_ptr& operator=(unique_ptr<_Up, _Ep>&& __u) noexcept { reset(__u.release()); __ptr_.second() = std::__1::forward<_Ep>(__u.get_deleter()); return *this; } template <class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<is_convertible<_Up*, _Tp*>::value && is_same<_Dp, default_delete<_Tp> >::value, unique_ptr&>::type operator=(auto_ptr<_Up> __p) { reset(__p.release()); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) ~unique_ptr() { reset(); } __attribute__ ((__exclude_from_explicit_instantiation__)) unique_ptr& operator=(nullptr_t) noexcept { reset(); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) typename add_lvalue_reference<_Tp>::type operator*() const { return *__ptr_.first(); } __attribute__ ((__exclude_from_explicit_instantiation__)) pointer operator->() const noexcept { return __ptr_.first(); } __attribute__ ((__exclude_from_explicit_instantiation__)) pointer get() const noexcept { return __ptr_.first(); } __attribute__ ((__exclude_from_explicit_instantiation__)) deleter_type& get_deleter() noexcept { return __ptr_.second(); } __attribute__ ((__exclude_from_explicit_instantiation__)) const deleter_type& get_deleter() const noexcept { return __ptr_.second(); } __attribute__ ((__exclude_from_explicit_instantiation__)) explicit operator bool() const noexcept { return __ptr_.first() != nullptr; } __attribute__ ((__exclude_from_explicit_instantiation__)) pointer release() noexcept { pointer __t = __ptr_.first(); __ptr_.first() = pointer(); return __t; } __attribute__ ((__exclude_from_explicit_instantiation__)) void reset(pointer __p = pointer()) noexcept { pointer __tmp = __ptr_.first(); __ptr_.first() = __p; if (__tmp) __ptr_.second()(__tmp); } __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(unique_ptr& __u) noexcept { __ptr_.swap(__u.__ptr_); } }; template <class _Tp, class _Dp> class unique_ptr<_Tp[], _Dp> { public: typedef _Tp element_type; typedef _Dp deleter_type; typedef typename __pointer_type<_Tp, deleter_type>::type pointer; private: __compressed_pair<pointer, deleter_type> __ptr_; template <class _From> struct _CheckArrayPointerConversion : is_same<_From, pointer> {}; template <class _FromElem> struct _CheckArrayPointerConversion<_FromElem*> : integral_constant<bool, is_same<_FromElem*, pointer>::value || (is_same<pointer, element_type*>::value && is_convertible<_FromElem(*)[], element_type(*)[]>::value) > {}; typedef __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE; template <bool _Dummy> using _LValRefType __attribute__((nodebug)) = typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type; template <bool _Dummy> using _GoodRValRefType __attribute__((nodebug)) = typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type; template <bool _Dummy> using _BadRValRefType __attribute__((nodebug)) = typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type; template <bool _Dummy, class _Deleter = typename __dependent_type< __identity<deleter_type>, _Dummy>::type> using _EnableIfDeleterDefaultConstructible __attribute__((nodebug)) = typename enable_if<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value>::type; template <class _ArgType> using _EnableIfDeleterConstructible __attribute__((nodebug)) = typename enable_if<is_constructible<deleter_type, _ArgType>::value>::type; template <class _Pp> using _EnableIfPointerConvertible __attribute__((nodebug)) = typename enable_if< _CheckArrayPointerConversion<_Pp>::value >::type; template <class _UPtr, class _Up, class _ElemT = typename _UPtr::element_type> using _EnableIfMoveConvertible __attribute__((nodebug)) = typename enable_if< is_array<_Up>::value && is_same<pointer, element_type*>::value && is_same<typename _UPtr::pointer, _ElemT*>::value && is_convertible<_ElemT(*)[], element_type(*)[]>::value >::type; template <class _UDel> using _EnableIfDeleterConvertible __attribute__((nodebug)) = typename enable_if< (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) || (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value) >::type; template <class _UDel> using _EnableIfDeleterAssignable __attribute__((nodebug)) = typename enable_if< is_assignable<_Dp&, _UDel&&>::value >::type; public: template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr unique_ptr() noexcept : __ptr_(pointer()) {} template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr unique_ptr(nullptr_t) noexcept : __ptr_(pointer()) {} template <class _Pp, bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy>, class = _EnableIfPointerConvertible<_Pp> > __attribute__ ((__exclude_from_explicit_instantiation__)) explicit unique_ptr(_Pp __p) noexcept : __ptr_(__p) {} template <class _Pp, bool _Dummy = true, class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> >, class = _EnableIfPointerConvertible<_Pp> > __attribute__ ((__exclude_from_explicit_instantiation__)) unique_ptr(_Pp __p, _LValRefType<_Dummy> __d) noexcept : __ptr_(__p, __d) {} template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > > __attribute__ ((__exclude_from_explicit_instantiation__)) unique_ptr(nullptr_t, _LValRefType<_Dummy> __d) noexcept : __ptr_(nullptr, __d) {} template <class _Pp, bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> >, class = _EnableIfPointerConvertible<_Pp> > __attribute__ ((__exclude_from_explicit_instantiation__)) unique_ptr(_Pp __p, _GoodRValRefType<_Dummy> __d) noexcept : __ptr_(__p, std::__1::move(__d)) { static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference"); } template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > > __attribute__ ((__exclude_from_explicit_instantiation__)) unique_ptr(nullptr_t, _GoodRValRefType<_Dummy> __d) noexcept : __ptr_(nullptr, std::__1::move(__d)) { static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference"); } template <class _Pp, bool _Dummy = true, class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy> >, class = _EnableIfPointerConvertible<_Pp> > __attribute__ ((__exclude_from_explicit_instantiation__)) unique_ptr(_Pp __p, _BadRValRefType<_Dummy> __d) = delete; __attribute__ ((__exclude_from_explicit_instantiation__)) unique_ptr(unique_ptr&& __u) noexcept : __ptr_(__u.release(), std::__1::forward<deleter_type>(__u.get_deleter())) { } __attribute__ ((__exclude_from_explicit_instantiation__)) unique_ptr& operator=(unique_ptr&& __u) noexcept { reset(__u.release()); __ptr_.second() = std::__1::forward<deleter_type>(__u.get_deleter()); return *this; } template <class _Up, class _Ep, class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>, class = _EnableIfDeleterConvertible<_Ep> > __attribute__ ((__exclude_from_explicit_instantiation__)) unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept : __ptr_(__u.release(), std::__1::forward<_Ep>(__u.get_deleter())) { } template <class _Up, class _Ep, class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>, class = _EnableIfDeleterAssignable<_Ep> > __attribute__ ((__exclude_from_explicit_instantiation__)) unique_ptr& operator=(unique_ptr<_Up, _Ep>&& __u) noexcept { reset(__u.release()); __ptr_.second() = std::__1::forward<_Ep>(__u.get_deleter()); return *this; } public: __attribute__ ((__exclude_from_explicit_instantiation__)) ~unique_ptr() { reset(); } __attribute__ ((__exclude_from_explicit_instantiation__)) unique_ptr& operator=(nullptr_t) noexcept { reset(); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) typename add_lvalue_reference<_Tp>::type operator[](size_t __i) const { return __ptr_.first()[__i]; } __attribute__ ((__exclude_from_explicit_instantiation__)) pointer get() const noexcept { return __ptr_.first(); } __attribute__ ((__exclude_from_explicit_instantiation__)) deleter_type& get_deleter() noexcept { return __ptr_.second(); } __attribute__ ((__exclude_from_explicit_instantiation__)) const deleter_type& get_deleter() const noexcept { return __ptr_.second(); } __attribute__ ((__exclude_from_explicit_instantiation__)) explicit operator bool() const noexcept { return __ptr_.first() != nullptr; } __attribute__ ((__exclude_from_explicit_instantiation__)) pointer release() noexcept { pointer __t = __ptr_.first(); __ptr_.first() = pointer(); return __t; } template <class _Pp> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if< _CheckArrayPointerConversion<_Pp>::value >::type reset(_Pp __p) noexcept { pointer __tmp = __ptr_.first(); __ptr_.first() = __p; if (__tmp) __ptr_.second()(__tmp); } __attribute__ ((__exclude_from_explicit_instantiation__)) void reset(nullptr_t = nullptr) noexcept { pointer __tmp = __ptr_.first(); __ptr_.first() = nullptr; if (__tmp) __ptr_.second()(__tmp); } __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(unique_ptr& __u) noexcept { __ptr_.swap(__u.__ptr_); } }; template <class _Tp, class _Dp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if< __is_swappable<_Dp>::value, void >::type swap(unique_ptr<_Tp, _Dp>& __x, unique_ptr<_Tp, _Dp>& __y) noexcept {__x.swap(__y);} template <class _T1, class _D1, class _T2, class _D2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return __x.get() == __y.get();} template <class _T1, class _D1, class _T2, class _D2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__x == __y);} template <class _T1, class _D1, class _T2, class _D2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator< (const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) { typedef typename unique_ptr<_T1, _D1>::pointer _P1; typedef typename unique_ptr<_T2, _D2>::pointer _P2; typedef typename common_type<_P1, _P2>::type _Vp; return less<_Vp>()(__x.get(), __y.get()); } template <class _T1, class _D1, class _T2, class _D2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator> (const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return __y < __x;} template <class _T1, class _D1, class _T2, class _D2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__y < __x);} template <class _T1, class _D1, class _T2, class _D2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__x < __y);} template <class _T1, class _D1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const unique_ptr<_T1, _D1>& __x, nullptr_t) noexcept { return !__x; } template <class _T1, class _D1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(nullptr_t, const unique_ptr<_T1, _D1>& __x) noexcept { return !__x; } template <class _T1, class _D1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const unique_ptr<_T1, _D1>& __x, nullptr_t) noexcept { return static_cast<bool>(__x); } template <class _T1, class _D1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(nullptr_t, const unique_ptr<_T1, _D1>& __x) noexcept { return static_cast<bool>(__x); } template <class _T1, class _D1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<(const unique_ptr<_T1, _D1>& __x, nullptr_t) { typedef typename unique_ptr<_T1, _D1>::pointer _P1; return less<_P1>()(__x.get(), nullptr); } template <class _T1, class _D1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<(nullptr_t, const unique_ptr<_T1, _D1>& __x) { typedef typename unique_ptr<_T1, _D1>::pointer _P1; return less<_P1>()(nullptr, __x.get()); } template <class _T1, class _D1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>(const unique_ptr<_T1, _D1>& __x, nullptr_t) { return nullptr < __x; } template <class _T1, class _D1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>(nullptr_t, const unique_ptr<_T1, _D1>& __x) { return __x < nullptr; } template <class _T1, class _D1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(const unique_ptr<_T1, _D1>& __x, nullptr_t) { return !(nullptr < __x); } template <class _T1, class _D1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(nullptr_t, const unique_ptr<_T1, _D1>& __x) { return !(__x < nullptr); } template <class _T1, class _D1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(const unique_ptr<_T1, _D1>& __x, nullptr_t) { return !(__x < nullptr); } template <class _T1, class _D1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(nullptr_t, const unique_ptr<_T1, _D1>& __x) { return !(nullptr < __x); } template<class _Tp> struct __unique_if { typedef unique_ptr<_Tp> __unique_single; }; template<class _Tp> struct __unique_if<_Tp[]> { typedef unique_ptr<_Tp[]> __unique_array_unknown_bound; }; template<class _Tp, size_t _Np> struct __unique_if<_Tp[_Np]> { typedef void __unique_array_known_bound; }; template<class _Tp, class... _Args> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename __unique_if<_Tp>::__unique_single make_unique(_Args&&... __args) { return unique_ptr<_Tp>(new _Tp(std::__1::forward<_Args>(__args)...)); } template<class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename __unique_if<_Tp>::__unique_array_unknown_bound make_unique(size_t __n) { typedef typename remove_extent<_Tp>::type _Up; return unique_ptr<_Tp>(new _Up[__n]()); } template<class _Tp, class... _Args> typename __unique_if<_Tp>::__unique_array_known_bound make_unique(_Args&&...) = delete; template <class _Tp, class _Dp> struct hash<__enable_hash_helper< unique_ptr<_Tp, _Dp>, typename unique_ptr<_Tp, _Dp>::pointer> > { typedef unique_ptr<_Tp, _Dp> argument_type; typedef size_t result_type; __attribute__ ((__exclude_from_explicit_instantiation__)) result_type operator()(const argument_type& __ptr) const { typedef typename argument_type::pointer pointer; return hash<pointer>()(__ptr.get()); } }; struct __destruct_n { private: size_t __size_; template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) void __process(_Tp* __p, false_type) noexcept {for (size_t __i = 0; __i < __size_; ++__i, ++__p) __p->~_Tp();} template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) void __process(_Tp*, true_type) noexcept {} __attribute__ ((__exclude_from_explicit_instantiation__)) void __incr(false_type) noexcept {++__size_;} __attribute__ ((__exclude_from_explicit_instantiation__)) void __incr(true_type) noexcept {} __attribute__ ((__exclude_from_explicit_instantiation__)) void __set(size_t __s, false_type) noexcept {__size_ = __s;} __attribute__ ((__exclude_from_explicit_instantiation__)) void __set(size_t, true_type) noexcept {} public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __destruct_n(size_t __s) noexcept : __size_(__s) {} template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) void __incr(_Tp*) noexcept {__incr(integral_constant<bool, is_trivially_destructible<_Tp>::value>());} template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) void __set(size_t __s, _Tp*) noexcept {__set(__s, integral_constant<bool, is_trivially_destructible<_Tp>::value>());} template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) void operator()(_Tp* __p) noexcept {__process(__p, integral_constant<bool, is_trivially_destructible<_Tp>::value>());} }; template <class _Alloc> class __allocator_destructor { typedef __attribute__((nodebug)) allocator_traits<_Alloc> __alloc_traits; public: typedef __attribute__((nodebug)) typename __alloc_traits::pointer pointer; typedef __attribute__((nodebug)) typename __alloc_traits::size_type size_type; private: _Alloc& __alloc_; size_type __s_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) __allocator_destructor(_Alloc& __a, size_type __s) noexcept : __alloc_(__a), __s_(__s) {} __attribute__ ((__exclude_from_explicit_instantiation__)) void operator()(pointer __p) noexcept {__alloc_traits::deallocate(__alloc_, __p, __s_);} }; template <class _InputIterator, class _ForwardIterator> _ForwardIterator uninitialized_copy(_InputIterator __f, _InputIterator __l, _ForwardIterator __r) { typedef typename iterator_traits<_ForwardIterator>::value_type value_type; for (; __f != __l; ++__f, (void) ++__r) ::new (static_cast<void*>(std::__1::addressof(*__r))) value_type(*__f); return __r; } template <class _InputIterator, class _Size, class _ForwardIterator> _ForwardIterator uninitialized_copy_n(_InputIterator __f, _Size __n, _ForwardIterator __r) { typedef typename iterator_traits<_ForwardIterator>::value_type value_type; for (; __n > 0; ++__f, (void) ++__r, (void) --__n) ::new (static_cast<void*>(std::__1::addressof(*__r))) value_type(*__f); return __r; } template <class _ForwardIterator, class _Tp> void uninitialized_fill(_ForwardIterator __f, _ForwardIterator __l, const _Tp& __x) { typedef typename iterator_traits<_ForwardIterator>::value_type value_type; for (; __f != __l; ++__f) ::new (static_cast<void*>(std::__1::addressof(*__f))) value_type(__x); } template <class _ForwardIterator, class _Size, class _Tp> _ForwardIterator uninitialized_fill_n(_ForwardIterator __f, _Size __n, const _Tp& __x) { typedef typename iterator_traits<_ForwardIterator>::value_type value_type; for (; __n > 0; ++__f, (void) --__n) ::new (static_cast<void*>(std::__1::addressof(*__f))) value_type(__x); return __f; } template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp __libcpp_atomic_refcount_increment(_Tp& __t) noexcept { return __atomic_add_fetch(&__t, 1, 0); } template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp __libcpp_atomic_refcount_decrement(_Tp& __t) noexcept { return __atomic_add_fetch(&__t, -1, 4); } class bad_weak_ptr : public std::exception { public: virtual ~bad_weak_ptr() noexcept; virtual const char* what() const noexcept; }; [[noreturn]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __throw_bad_weak_ptr() { std::__1::abort(); } template<class _Tp> class weak_ptr; class __shared_count { __shared_count(const __shared_count&); __shared_count& operator=(const __shared_count&); protected: long __shared_owners_; virtual ~__shared_count(); private: virtual void __on_zero_shared() noexcept = 0; public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __shared_count(long __refs = 0) noexcept : __shared_owners_(__refs) {} __attribute__ ((__exclude_from_explicit_instantiation__)) void __add_shared() noexcept { __libcpp_atomic_refcount_increment(__shared_owners_); } __attribute__ ((__exclude_from_explicit_instantiation__)) bool __release_shared() noexcept { if (__libcpp_atomic_refcount_decrement(__shared_owners_) == -1) { __on_zero_shared(); return true; } return false; } __attribute__ ((__exclude_from_explicit_instantiation__)) long use_count() const noexcept { return __libcpp_relaxed_load(&__shared_owners_) + 1; } }; class __shared_weak_count : private __shared_count { long __shared_weak_owners_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __shared_weak_count(long __refs = 0) noexcept : __shared_count(__refs), __shared_weak_owners_(__refs) {} protected: virtual ~__shared_weak_count(); public: __attribute__ ((__exclude_from_explicit_instantiation__)) void __add_shared() noexcept { __shared_count::__add_shared(); } __attribute__ ((__exclude_from_explicit_instantiation__)) void __add_weak() noexcept { __libcpp_atomic_refcount_increment(__shared_weak_owners_); } __attribute__ ((__exclude_from_explicit_instantiation__)) void __release_shared() noexcept { if (__shared_count::__release_shared()) __release_weak(); } void __release_weak() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) long use_count() const noexcept {return __shared_count::use_count();} __shared_weak_count* lock() noexcept; virtual const void* __get_deleter(const type_info&) const noexcept; private: virtual void __on_zero_shared_weak() noexcept = 0; }; template <class _Tp, class _Dp, class _Alloc> class __shared_ptr_pointer : public __shared_weak_count { __compressed_pair<__compressed_pair<_Tp, _Dp>, _Alloc> __data_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) __shared_ptr_pointer(_Tp __p, _Dp __d, _Alloc __a) : __data_(__compressed_pair<_Tp, _Dp>(__p, std::__1::move(__d)), std::__1::move(__a)) {} private: virtual void __on_zero_shared() noexcept; virtual void __on_zero_shared_weak() noexcept; }; template <class _Tp, class _Dp, class _Alloc> void __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared() noexcept { __data_.first().second()(__data_.first().first()); __data_.first().second().~_Dp(); } template <class _Tp, class _Dp, class _Alloc> void __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared_weak() noexcept { typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_pointer>::type _Al; typedef allocator_traits<_Al> _ATraits; typedef pointer_traits<typename _ATraits::pointer> _PTraits; _Al __a(__data_.second()); __data_.second().~_Alloc(); __a.deallocate(_PTraits::pointer_to(*this), 1); } template <class _Tp, class _Alloc> class __shared_ptr_emplace : public __shared_weak_count { __compressed_pair<_Alloc, _Tp> __data_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) __shared_ptr_emplace(_Alloc __a) : __data_(std::__1::move(__a)) {} template <class ..._Args> __attribute__ ((__exclude_from_explicit_instantiation__)) __shared_ptr_emplace(_Alloc __a, _Args&& ...__args) : __data_(piecewise_construct, std::__1::forward_as_tuple(__a), std::__1::forward_as_tuple(std::__1::forward<_Args>(__args)...)) {} private: virtual void __on_zero_shared() noexcept; virtual void __on_zero_shared_weak() noexcept; public: __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* get() noexcept {return std::__1::addressof(__data_.second());} }; template <class _Tp, class _Alloc> void __shared_ptr_emplace<_Tp, _Alloc>::__on_zero_shared() noexcept { __data_.second().~_Tp(); } template <class _Tp, class _Alloc> void __shared_ptr_emplace<_Tp, _Alloc>::__on_zero_shared_weak() noexcept { typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_emplace>::type _Al; typedef allocator_traits<_Al> _ATraits; typedef pointer_traits<typename _ATraits::pointer> _PTraits; _Al __a(__data_.first()); __data_.first().~_Alloc(); __a.deallocate(_PTraits::pointer_to(*this), 1); } struct __shared_ptr_dummy_rebind_allocator_type; template <> class allocator<__shared_ptr_dummy_rebind_allocator_type> { public: template <class _Other> struct rebind { typedef allocator<_Other> other; }; }; template<class _Tp> class enable_shared_from_this; template<class _Tp> class shared_ptr { public: typedef _Tp element_type; private: element_type* __ptr_; __shared_weak_count* __cntrl_; struct __nat {int __for_bool_;}; public: __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr shared_ptr() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr shared_ptr(nullptr_t) noexcept; template<class _Yp> explicit shared_ptr(_Yp* __p, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat()); template<class _Yp, class _Dp> shared_ptr(_Yp* __p, _Dp __d, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat()); template<class _Yp, class _Dp, class _Alloc> shared_ptr(_Yp* __p, _Dp __d, _Alloc __a, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat()); template <class _Dp> shared_ptr(nullptr_t __p, _Dp __d); template <class _Dp, class _Alloc> shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a); template<class _Yp> __attribute__ ((__exclude_from_explicit_instantiation__)) shared_ptr(const shared_ptr<_Yp>& __r, element_type* __p) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) shared_ptr(const shared_ptr& __r) noexcept; template<class _Yp> __attribute__ ((__exclude_from_explicit_instantiation__)) shared_ptr(const shared_ptr<_Yp>& __r, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat()) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) shared_ptr(shared_ptr&& __r) noexcept; template<class _Yp> __attribute__ ((__exclude_from_explicit_instantiation__)) shared_ptr(shared_ptr<_Yp>&& __r, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat()) noexcept; template<class _Yp> explicit shared_ptr(const weak_ptr<_Yp>& __r, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type= __nat()); template<class _Yp> shared_ptr(auto_ptr<_Yp>&& __r, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat()); template <class _Yp, class _Dp> shared_ptr(unique_ptr<_Yp, _Dp>&&, typename enable_if < !is_lvalue_reference<_Dp>::value && !is_array<_Yp>::value && is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value, __nat >::type = __nat()); template <class _Yp, class _Dp> shared_ptr(unique_ptr<_Yp, _Dp>&&, typename enable_if < is_lvalue_reference<_Dp>::value && !is_array<_Yp>::value && is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value, __nat >::type = __nat()); ~shared_ptr(); __attribute__ ((__exclude_from_explicit_instantiation__)) shared_ptr& operator=(const shared_ptr& __r) noexcept; template<class _Yp> typename enable_if < is_convertible<_Yp*, element_type*>::value, shared_ptr& >::type __attribute__ ((__exclude_from_explicit_instantiation__)) operator=(const shared_ptr<_Yp>& __r) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) shared_ptr& operator=(shared_ptr&& __r) noexcept; template<class _Yp> typename enable_if < is_convertible<_Yp*, element_type*>::value, shared_ptr<_Tp>& >::type __attribute__ ((__exclude_from_explicit_instantiation__)) operator=(shared_ptr<_Yp>&& __r); template<class _Yp> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < !is_array<_Yp>::value && is_convertible<_Yp*, element_type*>::value, shared_ptr >::type& operator=(auto_ptr<_Yp>&& __r); template <class _Yp, class _Dp> typename enable_if < !is_array<_Yp>::value && is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value, shared_ptr& >::type __attribute__ ((__exclude_from_explicit_instantiation__)) operator=(unique_ptr<_Yp, _Dp>&& __r); __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(shared_ptr& __r) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) void reset() noexcept; template<class _Yp> typename enable_if < is_convertible<_Yp*, element_type*>::value, void >::type __attribute__ ((__exclude_from_explicit_instantiation__)) reset(_Yp* __p); template<class _Yp, class _Dp> typename enable_if < is_convertible<_Yp*, element_type*>::value, void >::type __attribute__ ((__exclude_from_explicit_instantiation__)) reset(_Yp* __p, _Dp __d); template<class _Yp, class _Dp, class _Alloc> typename enable_if < is_convertible<_Yp*, element_type*>::value, void >::type __attribute__ ((__exclude_from_explicit_instantiation__)) reset(_Yp* __p, _Dp __d, _Alloc __a); __attribute__ ((__exclude_from_explicit_instantiation__)) element_type* get() const noexcept {return __ptr_;} __attribute__ ((__exclude_from_explicit_instantiation__)) typename add_lvalue_reference<element_type>::type operator*() const noexcept {return *__ptr_;} __attribute__ ((__exclude_from_explicit_instantiation__)) element_type* operator->() const noexcept {return __ptr_;} __attribute__ ((__exclude_from_explicit_instantiation__)) long use_count() const noexcept {return __cntrl_ ? __cntrl_->use_count() : 0;} __attribute__ ((__exclude_from_explicit_instantiation__)) bool unique() const noexcept {return use_count() == 1;} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit operator bool() const noexcept {return get() != 0;} template <class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) bool owner_before(shared_ptr<_Up> const& __p) const noexcept {return __cntrl_ < __p.__cntrl_;} template <class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) bool owner_before(weak_ptr<_Up> const& __p) const noexcept {return __cntrl_ < __p.__cntrl_;} __attribute__ ((__exclude_from_explicit_instantiation__)) bool __owner_equivalent(const shared_ptr& __p) const {return __cntrl_ == __p.__cntrl_;} template<class _Yp, class _CntrlBlk> static shared_ptr<_Tp> __create_with_control_block(_Yp* __p, _CntrlBlk* __cntrl) { shared_ptr<_Tp> __r; __r.__ptr_ = __p; __r.__cntrl_ = __cntrl; __r.__enable_weak_this(__r.__ptr_, __r.__ptr_); return __r; } template<class _Alloc, class ..._Args> static shared_ptr<_Tp> allocate_shared(const _Alloc& __a, _Args&& ...__args); private: template <class _Yp, bool = is_function<_Yp>::value> struct __shared_ptr_default_allocator { typedef allocator<_Yp> type; }; template <class _Yp> struct __shared_ptr_default_allocator<_Yp, true> { typedef allocator<__shared_ptr_dummy_rebind_allocator_type> type; }; template <class _Yp, class _OrigPtr> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<is_convertible<_OrigPtr*, const enable_shared_from_this<_Yp>* >::value, void>::type __enable_weak_this(const enable_shared_from_this<_Yp>* __e, _OrigPtr* __ptr) noexcept { typedef typename remove_cv<_Yp>::type _RawYp; if (__e && __e->__weak_this_.expired()) { __e->__weak_this_ = shared_ptr<_RawYp>(*this, const_cast<_RawYp*>(static_cast<const _Yp*>(__ptr))); } } __attribute__ ((__exclude_from_explicit_instantiation__)) void __enable_weak_this(...) noexcept {} template <class _Up> friend class shared_ptr; template <class _Up> friend class weak_ptr; }; template<class _Tp> inline constexpr shared_ptr<_Tp>::shared_ptr() noexcept : __ptr_(0), __cntrl_(0) { } template<class _Tp> inline constexpr shared_ptr<_Tp>::shared_ptr(nullptr_t) noexcept : __ptr_(0), __cntrl_(0) { } template<class _Tp> template<class _Yp> shared_ptr<_Tp>::shared_ptr(_Yp* __p, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type) : __ptr_(__p) { unique_ptr<_Yp> __hold(__p); typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, _AllocT > _CntrlBlk; __cntrl_ = new _CntrlBlk(__p, default_delete<_Yp>(), _AllocT()); __hold.release(); __enable_weak_this(__p, __p); } template<class _Tp> template<class _Yp, class _Dp> shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type) : __ptr_(__p) { typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT > _CntrlBlk; __cntrl_ = new _CntrlBlk(__p, __d, _AllocT()); __enable_weak_this(__p, __p); } template<class _Tp> template<class _Dp> shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d) : __ptr_(0) { typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT; typedef __shared_ptr_pointer<nullptr_t, _Dp, _AllocT > _CntrlBlk; __cntrl_ = new _CntrlBlk(__p, __d, _AllocT()); } template<class _Tp> template<class _Yp, class _Dp, class _Alloc> shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d, _Alloc __a, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type) : __ptr_(__p) { typedef __shared_ptr_pointer<_Yp*, _Dp, _Alloc> _CntrlBlk; typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2; typedef __allocator_destructor<_A2> _D2; _A2 __a2(__a); unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1)); ::new(static_cast<void*>(std::__1::addressof(*__hold2.get()))) _CntrlBlk(__p, __d, __a); __cntrl_ = std::__1::addressof(*__hold2.release()); __enable_weak_this(__p, __p); } template<class _Tp> template<class _Dp, class _Alloc> shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a) : __ptr_(0) { typedef __shared_ptr_pointer<nullptr_t, _Dp, _Alloc> _CntrlBlk; typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2; typedef __allocator_destructor<_A2> _D2; _A2 __a2(__a); unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1)); ::new(static_cast<void*>(std::__1::addressof(*__hold2.get()))) _CntrlBlk(__p, __d, __a); __cntrl_ = std::__1::addressof(*__hold2.release()); } template<class _Tp> template<class _Yp> inline shared_ptr<_Tp>::shared_ptr(const shared_ptr<_Yp>& __r, element_type *__p) noexcept : __ptr_(__p), __cntrl_(__r.__cntrl_) { if (__cntrl_) __cntrl_->__add_shared(); } template<class _Tp> inline shared_ptr<_Tp>::shared_ptr(const shared_ptr& __r) noexcept : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) { if (__cntrl_) __cntrl_->__add_shared(); } template<class _Tp> template<class _Yp> inline shared_ptr<_Tp>::shared_ptr(const shared_ptr<_Yp>& __r, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type) noexcept : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) { if (__cntrl_) __cntrl_->__add_shared(); } template<class _Tp> inline shared_ptr<_Tp>::shared_ptr(shared_ptr&& __r) noexcept : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) { __r.__ptr_ = 0; __r.__cntrl_ = 0; } template<class _Tp> template<class _Yp> inline shared_ptr<_Tp>::shared_ptr(shared_ptr<_Yp>&& __r, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type) noexcept : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) { __r.__ptr_ = 0; __r.__cntrl_ = 0; } template<class _Tp> template<class _Yp> shared_ptr<_Tp>::shared_ptr(auto_ptr<_Yp>&& __r, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type) : __ptr_(__r.get()) { typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<_Yp> > _CntrlBlk; __cntrl_ = new _CntrlBlk(__r.get(), default_delete<_Yp>(), allocator<_Yp>()); __enable_weak_this(__r.get(), __r.get()); __r.release(); } template<class _Tp> template <class _Yp, class _Dp> shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp>&& __r, typename enable_if < !is_lvalue_reference<_Dp>::value && !is_array<_Yp>::value && is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value, __nat >::type) : __ptr_(__r.get()) { if (__ptr_ == nullptr) __cntrl_ = nullptr; else { typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT > _CntrlBlk; __cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), _AllocT()); __enable_weak_this(__r.get(), __r.get()); } __r.release(); } template<class _Tp> template <class _Yp, class _Dp> shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp>&& __r, typename enable_if < is_lvalue_reference<_Dp>::value && !is_array<_Yp>::value && is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value, __nat >::type) : __ptr_(__r.get()) { if (__ptr_ == nullptr) __cntrl_ = nullptr; else { typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; typedef __shared_ptr_pointer<_Yp*, reference_wrapper<typename remove_reference<_Dp>::type>, _AllocT > _CntrlBlk; __cntrl_ = new _CntrlBlk(__r.get(), ref(__r.get_deleter()), _AllocT()); __enable_weak_this(__r.get(), __r.get()); } __r.release(); } template<class _Tp> template<class _Alloc, class ..._Args> shared_ptr<_Tp> shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _Args&& ...__args) { static_assert( is_constructible<_Tp, _Args...>::value, "Can't construct object in allocate_shared" ); typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk; typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2; typedef __allocator_destructor<_A2> _D2; _A2 __a2(__a); unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1)); ::new(static_cast<void*>(std::__1::addressof(*__hold2.get()))) _CntrlBlk(__a, std::__1::forward<_Args>(__args)...); shared_ptr<_Tp> __r; __r.__ptr_ = __hold2.get()->get(); __r.__cntrl_ = std::__1::addressof(*__hold2.release()); __r.__enable_weak_this(__r.__ptr_, __r.__ptr_); return __r; } template<class _Tp> shared_ptr<_Tp>::~shared_ptr() { if (__cntrl_) __cntrl_->__release_shared(); } template<class _Tp> inline shared_ptr<_Tp>& shared_ptr<_Tp>::operator=(const shared_ptr& __r) noexcept { shared_ptr(__r).swap(*this); return *this; } template<class _Tp> template<class _Yp> inline typename enable_if < is_convertible<_Yp*, typename shared_ptr<_Tp>::element_type*>::value, shared_ptr<_Tp>& >::type shared_ptr<_Tp>::operator=(const shared_ptr<_Yp>& __r) noexcept { shared_ptr(__r).swap(*this); return *this; } template<class _Tp> inline shared_ptr<_Tp>& shared_ptr<_Tp>::operator=(shared_ptr&& __r) noexcept { shared_ptr(std::__1::move(__r)).swap(*this); return *this; } template<class _Tp> template<class _Yp> inline typename enable_if < is_convertible<_Yp*, typename shared_ptr<_Tp>::element_type*>::value, shared_ptr<_Tp>& >::type shared_ptr<_Tp>::operator=(shared_ptr<_Yp>&& __r) { shared_ptr(std::__1::move(__r)).swap(*this); return *this; } template<class _Tp> template<class _Yp> inline typename enable_if < !is_array<_Yp>::value && is_convertible<_Yp*, typename shared_ptr<_Tp>::element_type*>::value, shared_ptr<_Tp> >::type& shared_ptr<_Tp>::operator=(auto_ptr<_Yp>&& __r) { shared_ptr(std::__1::move(__r)).swap(*this); return *this; } template<class _Tp> template <class _Yp, class _Dp> inline typename enable_if < !is_array<_Yp>::value && is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, typename shared_ptr<_Tp>::element_type*>::value, shared_ptr<_Tp>& >::type shared_ptr<_Tp>::operator=(unique_ptr<_Yp, _Dp>&& __r) { shared_ptr(std::__1::move(__r)).swap(*this); return *this; } template<class _Tp> inline void shared_ptr<_Tp>::swap(shared_ptr& __r) noexcept { std::__1::swap(__ptr_, __r.__ptr_); std::__1::swap(__cntrl_, __r.__cntrl_); } template<class _Tp> inline void shared_ptr<_Tp>::reset() noexcept { shared_ptr().swap(*this); } template<class _Tp> template<class _Yp> inline typename enable_if < is_convertible<_Yp*, typename shared_ptr<_Tp>::element_type*>::value, void >::type shared_ptr<_Tp>::reset(_Yp* __p) { shared_ptr(__p).swap(*this); } template<class _Tp> template<class _Yp, class _Dp> inline typename enable_if < is_convertible<_Yp*, typename shared_ptr<_Tp>::element_type*>::value, void >::type shared_ptr<_Tp>::reset(_Yp* __p, _Dp __d) { shared_ptr(__p, __d).swap(*this); } template<class _Tp> template<class _Yp, class _Dp, class _Alloc> inline typename enable_if < is_convertible<_Yp*, typename shared_ptr<_Tp>::element_type*>::value, void >::type shared_ptr<_Tp>::reset(_Yp* __p, _Dp __d, _Alloc __a) { shared_ptr(__p, __d, __a).swap(*this); } template<class _Tp, class ..._Args> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < !is_array<_Tp>::value, shared_ptr<_Tp> >::type make_shared(_Args&& ...__args) { static_assert(is_constructible<_Tp, _Args...>::value, "Can't construct object in make_shared"); typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk; typedef allocator<_CntrlBlk> _A2; typedef __allocator_destructor<_A2> _D2; _A2 __a2; unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1)); ::new(__hold2.get()) _CntrlBlk(__a2, std::__1::forward<_Args>(__args)...); _Tp *__ptr = __hold2.get()->get(); return shared_ptr<_Tp>::__create_with_control_block(__ptr, __hold2.release()); } template<class _Tp, class _Alloc, class ..._Args> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < !is_array<_Tp>::value, shared_ptr<_Tp> >::type allocate_shared(const _Alloc& __a, _Args&& ...__args) { return shared_ptr<_Tp>::allocate_shared(__a, std::__1::forward<_Args>(__args)...); } template<class _Tp, class _Up> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) noexcept { return __x.get() == __y.get(); } template<class _Tp, class _Up> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) noexcept { return !(__x == __y); } template<class _Tp, class _Up> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) noexcept { return less<>()(__x.get(), __y.get()); } template<class _Tp, class _Up> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) noexcept { return __y < __x; } template<class _Tp, class _Up> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) noexcept { return !(__y < __x); } template<class _Tp, class _Up> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) noexcept { return !(__x < __y); } template<class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const shared_ptr<_Tp>& __x, nullptr_t) noexcept { return !__x; } template<class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(nullptr_t, const shared_ptr<_Tp>& __x) noexcept { return !__x; } template<class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const shared_ptr<_Tp>& __x, nullptr_t) noexcept { return static_cast<bool>(__x); } template<class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(nullptr_t, const shared_ptr<_Tp>& __x) noexcept { return static_cast<bool>(__x); } template<class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<(const shared_ptr<_Tp>& __x, nullptr_t) noexcept { return less<_Tp*>()(__x.get(), nullptr); } template<class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<(nullptr_t, const shared_ptr<_Tp>& __x) noexcept { return less<_Tp*>()(nullptr, __x.get()); } template<class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>(const shared_ptr<_Tp>& __x, nullptr_t) noexcept { return nullptr < __x; } template<class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>(nullptr_t, const shared_ptr<_Tp>& __x) noexcept { return __x < nullptr; } template<class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(const shared_ptr<_Tp>& __x, nullptr_t) noexcept { return !(nullptr < __x); } template<class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(nullptr_t, const shared_ptr<_Tp>& __x) noexcept { return !(__x < nullptr); } template<class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(const shared_ptr<_Tp>& __x, nullptr_t) noexcept { return !(__x < nullptr); } template<class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(nullptr_t, const shared_ptr<_Tp>& __x) noexcept { return !(nullptr < __x); } template<class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(shared_ptr<_Tp>& __x, shared_ptr<_Tp>& __y) noexcept { __x.swap(__y); } template<class _Tp, class _Up> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < !is_array<_Tp>::value && !is_array<_Up>::value, shared_ptr<_Tp> >::type static_pointer_cast(const shared_ptr<_Up>& __r) noexcept { return shared_ptr<_Tp>(__r, static_cast<_Tp*>(__r.get())); } template<class _Tp, class _Up> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < !is_array<_Tp>::value && !is_array<_Up>::value, shared_ptr<_Tp> >::type dynamic_pointer_cast(const shared_ptr<_Up>& __r) noexcept { _Tp* __p = dynamic_cast<_Tp*>(__r.get()); return __p ? shared_ptr<_Tp>(__r, __p) : shared_ptr<_Tp>(); } template<class _Tp, class _Up> typename enable_if < is_array<_Tp>::value == is_array<_Up>::value, shared_ptr<_Tp> >::type const_pointer_cast(const shared_ptr<_Up>& __r) noexcept { typedef typename remove_extent<_Tp>::type _RTp; return shared_ptr<_Tp>(__r, const_cast<_RTp*>(__r.get())); } template<class _Tp> class weak_ptr { public: typedef _Tp element_type; private: element_type* __ptr_; __shared_weak_count* __cntrl_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr weak_ptr() noexcept; template<class _Yp> __attribute__ ((__exclude_from_explicit_instantiation__)) weak_ptr(shared_ptr<_Yp> const& __r, typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) weak_ptr(weak_ptr const& __r) noexcept; template<class _Yp> __attribute__ ((__exclude_from_explicit_instantiation__)) weak_ptr(weak_ptr<_Yp> const& __r, typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) weak_ptr(weak_ptr&& __r) noexcept; template<class _Yp> __attribute__ ((__exclude_from_explicit_instantiation__)) weak_ptr(weak_ptr<_Yp>&& __r, typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0) noexcept; ~weak_ptr(); __attribute__ ((__exclude_from_explicit_instantiation__)) weak_ptr& operator=(weak_ptr const& __r) noexcept; template<class _Yp> typename enable_if < is_convertible<_Yp*, element_type*>::value, weak_ptr& >::type __attribute__ ((__exclude_from_explicit_instantiation__)) operator=(weak_ptr<_Yp> const& __r) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) weak_ptr& operator=(weak_ptr&& __r) noexcept; template<class _Yp> typename enable_if < is_convertible<_Yp*, element_type*>::value, weak_ptr& >::type __attribute__ ((__exclude_from_explicit_instantiation__)) operator=(weak_ptr<_Yp>&& __r) noexcept; template<class _Yp> typename enable_if < is_convertible<_Yp*, element_type*>::value, weak_ptr& >::type __attribute__ ((__exclude_from_explicit_instantiation__)) operator=(shared_ptr<_Yp> const& __r) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(weak_ptr& __r) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) void reset() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) long use_count() const noexcept {return __cntrl_ ? __cntrl_->use_count() : 0;} __attribute__ ((__exclude_from_explicit_instantiation__)) bool expired() const noexcept {return __cntrl_ == 0 || __cntrl_->use_count() == 0;} shared_ptr<_Tp> lock() const noexcept; template<class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) bool owner_before(const shared_ptr<_Up>& __r) const noexcept {return __cntrl_ < __r.__cntrl_;} template<class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) bool owner_before(const weak_ptr<_Up>& __r) const noexcept {return __cntrl_ < __r.__cntrl_;} template <class _Up> friend class weak_ptr; template <class _Up> friend class shared_ptr; }; template<class _Tp> inline constexpr weak_ptr<_Tp>::weak_ptr() noexcept : __ptr_(0), __cntrl_(0) { } template<class _Tp> inline weak_ptr<_Tp>::weak_ptr(weak_ptr const& __r) noexcept : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) { if (__cntrl_) __cntrl_->__add_weak(); } template<class _Tp> template<class _Yp> inline weak_ptr<_Tp>::weak_ptr(shared_ptr<_Yp> const& __r, typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type) noexcept : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) { if (__cntrl_) __cntrl_->__add_weak(); } template<class _Tp> template<class _Yp> inline weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp> const& __r, typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type) noexcept : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) { if (__cntrl_) __cntrl_->__add_weak(); } template<class _Tp> inline weak_ptr<_Tp>::weak_ptr(weak_ptr&& __r) noexcept : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) { __r.__ptr_ = 0; __r.__cntrl_ = 0; } template<class _Tp> template<class _Yp> inline weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp>&& __r, typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type) noexcept : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) { __r.__ptr_ = 0; __r.__cntrl_ = 0; } template<class _Tp> weak_ptr<_Tp>::~weak_ptr() { if (__cntrl_) __cntrl_->__release_weak(); } template<class _Tp> inline weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(weak_ptr const& __r) noexcept { weak_ptr(__r).swap(*this); return *this; } template<class _Tp> template<class _Yp> inline typename enable_if < is_convertible<_Yp*, _Tp*>::value, weak_ptr<_Tp>& >::type weak_ptr<_Tp>::operator=(weak_ptr<_Yp> const& __r) noexcept { weak_ptr(__r).swap(*this); return *this; } template<class _Tp> inline weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(weak_ptr&& __r) noexcept { weak_ptr(std::__1::move(__r)).swap(*this); return *this; } template<class _Tp> template<class _Yp> inline typename enable_if < is_convertible<_Yp*, _Tp*>::value, weak_ptr<_Tp>& >::type weak_ptr<_Tp>::operator=(weak_ptr<_Yp>&& __r) noexcept { weak_ptr(std::__1::move(__r)).swap(*this); return *this; } template<class _Tp> template<class _Yp> inline typename enable_if < is_convertible<_Yp*, _Tp*>::value, weak_ptr<_Tp>& >::type weak_ptr<_Tp>::operator=(shared_ptr<_Yp> const& __r) noexcept { weak_ptr(__r).swap(*this); return *this; } template<class _Tp> inline void weak_ptr<_Tp>::swap(weak_ptr& __r) noexcept { std::__1::swap(__ptr_, __r.__ptr_); std::__1::swap(__cntrl_, __r.__cntrl_); } template<class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(weak_ptr<_Tp>& __x, weak_ptr<_Tp>& __y) noexcept { __x.swap(__y); } template<class _Tp> inline void weak_ptr<_Tp>::reset() noexcept { weak_ptr().swap(*this); } template<class _Tp> template<class _Yp> shared_ptr<_Tp>::shared_ptr(const weak_ptr<_Yp>& __r, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type) : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_ ? __r.__cntrl_->lock() : __r.__cntrl_) { if (__cntrl_ == 0) __throw_bad_weak_ptr(); } template<class _Tp> shared_ptr<_Tp> weak_ptr<_Tp>::lock() const noexcept { shared_ptr<_Tp> __r; __r.__cntrl_ = __cntrl_ ? __cntrl_->lock() : __cntrl_; if (__r.__cntrl_) __r.__ptr_ = __ptr_; return __r; } template <class _Tp> struct owner_less; template <class _Tp> struct owner_less<shared_ptr<_Tp> > : binary_function<shared_ptr<_Tp>, shared_ptr<_Tp>, bool> { typedef bool result_type; __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(shared_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const noexcept {return __x.owner_before(__y);} __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const noexcept {return __x.owner_before(__y);} __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const noexcept {return __x.owner_before(__y);} }; template <class _Tp> struct owner_less<weak_ptr<_Tp> > : binary_function<weak_ptr<_Tp>, weak_ptr<_Tp>, bool> { typedef bool result_type; __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const noexcept {return __x.owner_before(__y);} __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const noexcept {return __x.owner_before(__y);} __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const noexcept {return __x.owner_before(__y);} }; template<class _Tp> class enable_shared_from_this { mutable weak_ptr<_Tp> __weak_this_; protected: __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr enable_shared_from_this() noexcept {} __attribute__ ((__exclude_from_explicit_instantiation__)) enable_shared_from_this(enable_shared_from_this const&) noexcept {} __attribute__ ((__exclude_from_explicit_instantiation__)) enable_shared_from_this& operator=(enable_shared_from_this const&) noexcept {return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) ~enable_shared_from_this() {} public: __attribute__ ((__exclude_from_explicit_instantiation__)) shared_ptr<_Tp> shared_from_this() {return shared_ptr<_Tp>(__weak_this_);} __attribute__ ((__exclude_from_explicit_instantiation__)) shared_ptr<_Tp const> shared_from_this() const {return shared_ptr<const _Tp>(__weak_this_);} template <class _Up> friend class shared_ptr; }; template <class _Tp> struct hash<shared_ptr<_Tp> > { typedef shared_ptr<_Tp> argument_type; typedef size_t result_type; __attribute__ ((__exclude_from_explicit_instantiation__)) result_type operator()(const argument_type& __ptr) const noexcept { return hash<_Tp*>()(__ptr.get()); } }; template<class _CharT, class _Traits, class _Yp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p); class __sp_mut { void* __lx; public: void lock() noexcept; void unlock() noexcept; private: constexpr __sp_mut(void*) noexcept; __sp_mut(const __sp_mut&); __sp_mut& operator=(const __sp_mut&); friend __sp_mut& __get_sp_mut(const void*); }; __sp_mut& __get_sp_mut(const void*); template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool atomic_is_lock_free(const shared_ptr<_Tp>*) { return false; } template <class _Tp> shared_ptr<_Tp> atomic_load(const shared_ptr<_Tp>* __p) { __sp_mut& __m = __get_sp_mut(__p); __m.lock(); shared_ptr<_Tp> __q = *__p; __m.unlock(); return __q; } template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) shared_ptr<_Tp> atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order) { return atomic_load(__p); } template <class _Tp> void atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) { __sp_mut& __m = __get_sp_mut(__p); __m.lock(); __p->swap(__r); __m.unlock(); } template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void atomic_store_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order) { atomic_store(__p, __r); } template <class _Tp> shared_ptr<_Tp> atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) { __sp_mut& __m = __get_sp_mut(__p); __m.lock(); __p->swap(__r); __m.unlock(); return __r; } template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) shared_ptr<_Tp> atomic_exchange_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order) { return atomic_exchange(__p, __r); } template <class _Tp> bool atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w) { shared_ptr<_Tp> __temp; __sp_mut& __m = __get_sp_mut(__p); __m.lock(); if (__p->__owner_equivalent(*__v)) { std::__1::swap(__temp, *__p); *__p = __w; __m.unlock(); return true; } std::__1::swap(__temp, *__v); *__v = *__p; __m.unlock(); return false; } template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool atomic_compare_exchange_weak(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w) { return atomic_compare_exchange_strong(__p, __v, __w); } template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool atomic_compare_exchange_strong_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w, memory_order, memory_order) { return atomic_compare_exchange_strong(__p, __v, __w); } template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool atomic_compare_exchange_weak_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w, memory_order, memory_order) { return atomic_compare_exchange_weak(__p, __v, __w); } enum class pointer_safety : unsigned char { relaxed, preferred, strict }; inline __attribute__ ((__exclude_from_explicit_instantiation__)) pointer_safety get_pointer_safety() noexcept { return pointer_safety::relaxed; } void declare_reachable(void* __p); void declare_no_pointers(char* __p, size_t __n); void undeclare_no_pointers(char* __p, size_t __n); void* __undeclare_reachable(void* __p); template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp* undeclare_reachable(_Tp* __p) { return static_cast<_Tp*>(__undeclare_reachable(__p)); } void* align(size_t __align, size_t __sz, void*& __ptr, size_t& __space); template <typename _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __swap_allocator(_Alloc & __a1, _Alloc & __a2) noexcept { __swap_allocator(__a1, __a2, integral_constant<bool, std::__1::allocator_traits<_Alloc>::propagate_on_container_swap::value>()); } template <typename _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) void __swap_allocator(_Alloc & __a1, _Alloc & __a2, true_type) noexcept { using std::__1::swap; swap(__a1, __a2); } template <typename _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __swap_allocator(_Alloc &, _Alloc &, false_type) noexcept {} template <typename _Alloc, typename _Traits=allocator_traits<_Alloc> > struct __noexcept_move_assign_container : public integral_constant<bool, _Traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable<_Alloc>::value > {}; template <class _Tp, class _Alloc> struct __temp_value { typedef allocator_traits<_Alloc> _Traits; typename aligned_storage<sizeof(_Tp), alignof(_Tp)>::type __v; _Alloc &__a; _Tp *__addr() { return reinterpret_cast<_Tp *>(addressof(__v)); } _Tp & get() { return *__addr(); } template<class... _Args> __attribute__((__no_sanitize__("cfi"))) __temp_value(_Alloc &__alloc, _Args&& ... __args) : __a(__alloc) { _Traits::construct(__a, reinterpret_cast<_Tp*>(addressof(__v)), std::__1::forward<_Args>(__args)...); } ~__temp_value() { _Traits::destroy(__a, __addr()); } }; template<typename _Alloc, typename = void, typename = void> struct __is_allocator : false_type {}; template<typename _Alloc> struct __is_allocator<_Alloc, typename __void_t<typename _Alloc::value_type>::type, typename __void_t<decltype(std::__1::declval<_Alloc&>().allocate(size_t(0)))>::type > : true_type {}; struct __builtin_new_allocator { struct __builtin_new_deleter { typedef void* pointer_type; constexpr explicit __builtin_new_deleter(size_t __size, size_t __align) : __size_(__size), __align_(__align) {} void operator()(void* p) const noexcept { std::__libcpp_deallocate(p, __size_, __align_); } private: size_t __size_; size_t __align_; }; typedef unique_ptr<void, __builtin_new_deleter> __holder_t; static __holder_t __allocate_bytes(size_t __s, size_t __align) { return __holder_t(std::__libcpp_allocate(__s, __align), __builtin_new_deleter(__s, __align)); } static void __deallocate_bytes(void* __p, size_t __s, size_t __align) noexcept { std::__libcpp_deallocate(__p, __s, __align); } template <class _Tp> __attribute__((__nodebug__)) __attribute__ ((__always_inline__)) static __holder_t __allocate_type(size_t __n) { return __allocate_bytes(__n * sizeof(_Tp), alignof(_Tp)); } template <class _Tp> __attribute__((__nodebug__)) __attribute__ ((__always_inline__)) static void __deallocate_type(void* __p, size_t __n) noexcept { __deallocate_bytes(__p, __n * sizeof(_Tp), alignof(_Tp)); } }; } } namespace std { inline namespace __1 { template <class _Tp = void> struct plus : binary_function<_Tp, _Tp, _Tp> { constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator()(const _Tp& __x, const _Tp& __y) const {return __x + __y;} }; template <> struct plus<void> { template <class _T1, class _T2> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) auto operator()(_T1&& __t, _T2&& __u) const noexcept(noexcept(std::__1::forward<_T1>(__t) + std::__1::forward<_T2>(__u))) -> decltype (std::__1::forward<_T1>(__t) + std::__1::forward<_T2>(__u)) { return std::__1::forward<_T1>(__t) + std::__1::forward<_T2>(__u); } typedef void is_transparent; }; template <class _Tp = void> struct minus : binary_function<_Tp, _Tp, _Tp> { constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator()(const _Tp& __x, const _Tp& __y) const {return __x - __y;} }; template <> struct minus<void> { template <class _T1, class _T2> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) auto operator()(_T1&& __t, _T2&& __u) const noexcept(noexcept(std::__1::forward<_T1>(__t) - std::__1::forward<_T2>(__u))) -> decltype (std::__1::forward<_T1>(__t) - std::__1::forward<_T2>(__u)) { return std::__1::forward<_T1>(__t) - std::__1::forward<_T2>(__u); } typedef void is_transparent; }; template <class _Tp = void> struct multiplies : binary_function<_Tp, _Tp, _Tp> { constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator()(const _Tp& __x, const _Tp& __y) const {return __x * __y;} }; template <> struct multiplies<void> { template <class _T1, class _T2> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) auto operator()(_T1&& __t, _T2&& __u) const noexcept(noexcept(std::__1::forward<_T1>(__t) * std::__1::forward<_T2>(__u))) -> decltype (std::__1::forward<_T1>(__t) * std::__1::forward<_T2>(__u)) { return std::__1::forward<_T1>(__t) * std::__1::forward<_T2>(__u); } typedef void is_transparent; }; template <class _Tp = void> struct divides : binary_function<_Tp, _Tp, _Tp> { constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator()(const _Tp& __x, const _Tp& __y) const {return __x / __y;} }; template <> struct divides<void> { template <class _T1, class _T2> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) auto operator()(_T1&& __t, _T2&& __u) const noexcept(noexcept(std::__1::forward<_T1>(__t) / std::__1::forward<_T2>(__u))) -> decltype (std::__1::forward<_T1>(__t) / std::__1::forward<_T2>(__u)) { return std::__1::forward<_T1>(__t) / std::__1::forward<_T2>(__u); } typedef void is_transparent; }; template <class _Tp = void> struct modulus : binary_function<_Tp, _Tp, _Tp> { constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator()(const _Tp& __x, const _Tp& __y) const {return __x % __y;} }; template <> struct modulus<void> { template <class _T1, class _T2> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) auto operator()(_T1&& __t, _T2&& __u) const noexcept(noexcept(std::__1::forward<_T1>(__t) % std::__1::forward<_T2>(__u))) -> decltype (std::__1::forward<_T1>(__t) % std::__1::forward<_T2>(__u)) { return std::__1::forward<_T1>(__t) % std::__1::forward<_T2>(__u); } typedef void is_transparent; }; template <class _Tp = void> struct negate : unary_function<_Tp, _Tp> { constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator()(const _Tp& __x) const {return -__x;} }; template <> struct negate<void> { template <class _Tp> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) auto operator()(_Tp&& __x) const noexcept(noexcept(- std::__1::forward<_Tp>(__x))) -> decltype (- std::__1::forward<_Tp>(__x)) { return - std::__1::forward<_Tp>(__x); } typedef void is_transparent; }; template <class _Tp = void> struct equal_to : binary_function<_Tp, _Tp, bool> { constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const _Tp& __x, const _Tp& __y) const {return __x == __y;} }; template <> struct equal_to<void> { template <class _T1, class _T2> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) auto operator()(_T1&& __t, _T2&& __u) const noexcept(noexcept(std::__1::forward<_T1>(__t) == std::__1::forward<_T2>(__u))) -> decltype (std::__1::forward<_T1>(__t) == std::__1::forward<_T2>(__u)) { return std::__1::forward<_T1>(__t) == std::__1::forward<_T2>(__u); } typedef void is_transparent; }; template <class _Tp = void> struct not_equal_to : binary_function<_Tp, _Tp, bool> { constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const _Tp& __x, const _Tp& __y) const {return __x != __y;} }; template <> struct not_equal_to<void> { template <class _T1, class _T2> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) auto operator()(_T1&& __t, _T2&& __u) const noexcept(noexcept(std::__1::forward<_T1>(__t) != std::__1::forward<_T2>(__u))) -> decltype (std::__1::forward<_T1>(__t) != std::__1::forward<_T2>(__u)) { return std::__1::forward<_T1>(__t) != std::__1::forward<_T2>(__u); } typedef void is_transparent; }; template <class _Tp = void> struct greater : binary_function<_Tp, _Tp, bool> { constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const _Tp& __x, const _Tp& __y) const {return __x > __y;} }; template <> struct greater<void> { template <class _T1, class _T2> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) auto operator()(_T1&& __t, _T2&& __u) const noexcept(noexcept(std::__1::forward<_T1>(__t) > std::__1::forward<_T2>(__u))) -> decltype (std::__1::forward<_T1>(__t) > std::__1::forward<_T2>(__u)) { return std::__1::forward<_T1>(__t) > std::__1::forward<_T2>(__u); } typedef void is_transparent; }; template <class _Tp = void> struct greater_equal : binary_function<_Tp, _Tp, bool> { constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const _Tp& __x, const _Tp& __y) const {return __x >= __y;} }; template <> struct greater_equal<void> { template <class _T1, class _T2> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) auto operator()(_T1&& __t, _T2&& __u) const noexcept(noexcept(std::__1::forward<_T1>(__t) >= std::__1::forward<_T2>(__u))) -> decltype (std::__1::forward<_T1>(__t) >= std::__1::forward<_T2>(__u)) { return std::__1::forward<_T1>(__t) >= std::__1::forward<_T2>(__u); } typedef void is_transparent; }; template <class _Tp = void> struct less_equal : binary_function<_Tp, _Tp, bool> { constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const _Tp& __x, const _Tp& __y) const {return __x <= __y;} }; template <> struct less_equal<void> { template <class _T1, class _T2> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) auto operator()(_T1&& __t, _T2&& __u) const noexcept(noexcept(std::__1::forward<_T1>(__t) <= std::__1::forward<_T2>(__u))) -> decltype (std::__1::forward<_T1>(__t) <= std::__1::forward<_T2>(__u)) { return std::__1::forward<_T1>(__t) <= std::__1::forward<_T2>(__u); } typedef void is_transparent; }; template <class _Tp = void> struct logical_and : binary_function<_Tp, _Tp, bool> { constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const _Tp& __x, const _Tp& __y) const {return __x && __y;} }; template <> struct logical_and<void> { template <class _T1, class _T2> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) auto operator()(_T1&& __t, _T2&& __u) const noexcept(noexcept(std::__1::forward<_T1>(__t) && std::__1::forward<_T2>(__u))) -> decltype (std::__1::forward<_T1>(__t) && std::__1::forward<_T2>(__u)) { return std::__1::forward<_T1>(__t) && std::__1::forward<_T2>(__u); } typedef void is_transparent; }; template <class _Tp = void> struct logical_or : binary_function<_Tp, _Tp, bool> { constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const _Tp& __x, const _Tp& __y) const {return __x || __y;} }; template <> struct logical_or<void> { template <class _T1, class _T2> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) auto operator()(_T1&& __t, _T2&& __u) const noexcept(noexcept(std::__1::forward<_T1>(__t) || std::__1::forward<_T2>(__u))) -> decltype (std::__1::forward<_T1>(__t) || std::__1::forward<_T2>(__u)) { return std::__1::forward<_T1>(__t) || std::__1::forward<_T2>(__u); } typedef void is_transparent; }; template <class _Tp = void> struct logical_not : unary_function<_Tp, bool> { constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const _Tp& __x) const {return !__x;} }; template <> struct logical_not<void> { template <class _Tp> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) auto operator()(_Tp&& __x) const noexcept(noexcept(!std::__1::forward<_Tp>(__x))) -> decltype (!std::__1::forward<_Tp>(__x)) { return !std::__1::forward<_Tp>(__x); } typedef void is_transparent; }; template <class _Tp = void> struct bit_and : binary_function<_Tp, _Tp, _Tp> { constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator()(const _Tp& __x, const _Tp& __y) const {return __x & __y;} }; template <> struct bit_and<void> { template <class _T1, class _T2> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) auto operator()(_T1&& __t, _T2&& __u) const noexcept(noexcept(std::__1::forward<_T1>(__t) & std::__1::forward<_T2>(__u))) -> decltype (std::__1::forward<_T1>(__t) & std::__1::forward<_T2>(__u)) { return std::__1::forward<_T1>(__t) & std::__1::forward<_T2>(__u); } typedef void is_transparent; }; template <class _Tp = void> struct bit_or : binary_function<_Tp, _Tp, _Tp> { constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator()(const _Tp& __x, const _Tp& __y) const {return __x | __y;} }; template <> struct bit_or<void> { template <class _T1, class _T2> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) auto operator()(_T1&& __t, _T2&& __u) const noexcept(noexcept(std::__1::forward<_T1>(__t) | std::__1::forward<_T2>(__u))) -> decltype (std::__1::forward<_T1>(__t) | std::__1::forward<_T2>(__u)) { return std::__1::forward<_T1>(__t) | std::__1::forward<_T2>(__u); } typedef void is_transparent; }; template <class _Tp = void> struct bit_xor : binary_function<_Tp, _Tp, _Tp> { constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator()(const _Tp& __x, const _Tp& __y) const {return __x ^ __y;} }; template <> struct bit_xor<void> { template <class _T1, class _T2> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) auto operator()(_T1&& __t, _T2&& __u) const noexcept(noexcept(std::__1::forward<_T1>(__t) ^ std::__1::forward<_T2>(__u))) -> decltype (std::__1::forward<_T1>(__t) ^ std::__1::forward<_T2>(__u)) { return std::__1::forward<_T1>(__t) ^ std::__1::forward<_T2>(__u); } typedef void is_transparent; }; template <class _Tp = void> struct bit_not : unary_function<_Tp, _Tp> { constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp operator()(const _Tp& __x) const {return ~__x;} }; template <> struct bit_not<void> { template <class _Tp> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) auto operator()(_Tp&& __x) const noexcept(noexcept(~std::__1::forward<_Tp>(__x))) -> decltype (~std::__1::forward<_Tp>(__x)) { return ~std::__1::forward<_Tp>(__x); } typedef void is_transparent; }; template <class _Predicate> class unary_negate : public unary_function<typename _Predicate::argument_type, bool> { _Predicate __pred_; public: constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) explicit unary_negate(const _Predicate& __pred) : __pred_(__pred) {} constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const typename _Predicate::argument_type& __x) const {return !__pred_(__x);} }; template <class _Predicate> inline constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) unary_negate<_Predicate> not1(const _Predicate& __pred) {return unary_negate<_Predicate>(__pred);} template <class _Predicate> class binary_negate : public binary_function<typename _Predicate::first_argument_type, typename _Predicate::second_argument_type, bool> { _Predicate __pred_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit constexpr binary_negate(const _Predicate& __pred) : __pred_(__pred) {} constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const typename _Predicate::first_argument_type& __x, const typename _Predicate::second_argument_type& __y) const {return !__pred_(__x, __y);} }; template <class _Predicate> inline constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) binary_negate<_Predicate> not2(const _Predicate& __pred) {return binary_negate<_Predicate>(__pred);} template <class __Operation> class __attribute__ ((deprecated)) binder1st : public unary_function<typename __Operation::second_argument_type, typename __Operation::result_type> { protected: __Operation op; typename __Operation::first_argument_type value; public: __attribute__ ((__exclude_from_explicit_instantiation__)) binder1st(const __Operation& __x, const typename __Operation::first_argument_type __y) : op(__x), value(__y) {} __attribute__ ((__exclude_from_explicit_instantiation__)) typename __Operation::result_type operator() (typename __Operation::second_argument_type& __x) const {return op(value, __x);} __attribute__ ((__exclude_from_explicit_instantiation__)) typename __Operation::result_type operator() (const typename __Operation::second_argument_type& __x) const {return op(value, __x);} }; template <class __Operation, class _Tp> __attribute__ ((deprecated)) inline __attribute__ ((__exclude_from_explicit_instantiation__)) binder1st<__Operation> bind1st(const __Operation& __op, const _Tp& __x) {return binder1st<__Operation>(__op, __x);} template <class __Operation> class __attribute__ ((deprecated)) binder2nd : public unary_function<typename __Operation::first_argument_type, typename __Operation::result_type> { protected: __Operation op; typename __Operation::second_argument_type value; public: __attribute__ ((__exclude_from_explicit_instantiation__)) binder2nd(const __Operation& __x, const typename __Operation::second_argument_type __y) : op(__x), value(__y) {} __attribute__ ((__exclude_from_explicit_instantiation__)) typename __Operation::result_type operator() ( typename __Operation::first_argument_type& __x) const {return op(__x, value);} __attribute__ ((__exclude_from_explicit_instantiation__)) typename __Operation::result_type operator() (const typename __Operation::first_argument_type& __x) const {return op(__x, value);} }; template <class __Operation, class _Tp> __attribute__ ((deprecated)) inline __attribute__ ((__exclude_from_explicit_instantiation__)) binder2nd<__Operation> bind2nd(const __Operation& __op, const _Tp& __x) {return binder2nd<__Operation>(__op, __x);} template <class _Arg, class _Result> class __attribute__ ((deprecated)) pointer_to_unary_function : public unary_function<_Arg, _Result> { _Result (*__f_)(_Arg); public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit pointer_to_unary_function(_Result (*__f)(_Arg)) : __f_(__f) {} __attribute__ ((__exclude_from_explicit_instantiation__)) _Result operator()(_Arg __x) const {return __f_(__x);} }; template <class _Arg, class _Result> __attribute__ ((deprecated)) inline __attribute__ ((__exclude_from_explicit_instantiation__)) pointer_to_unary_function<_Arg,_Result> ptr_fun(_Result (*__f)(_Arg)) {return pointer_to_unary_function<_Arg,_Result>(__f);} template <class _Arg1, class _Arg2, class _Result> class __attribute__ ((deprecated)) pointer_to_binary_function : public binary_function<_Arg1, _Arg2, _Result> { _Result (*__f_)(_Arg1, _Arg2); public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit pointer_to_binary_function(_Result (*__f)(_Arg1, _Arg2)) : __f_(__f) {} __attribute__ ((__exclude_from_explicit_instantiation__)) _Result operator()(_Arg1 __x, _Arg2 __y) const {return __f_(__x, __y);} }; template <class _Arg1, class _Arg2, class _Result> __attribute__ ((deprecated)) inline __attribute__ ((__exclude_from_explicit_instantiation__)) pointer_to_binary_function<_Arg1,_Arg2,_Result> ptr_fun(_Result (*__f)(_Arg1,_Arg2)) {return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__f);} template<class _Sp, class _Tp> class __attribute__ ((deprecated)) mem_fun_t : public unary_function<_Tp*, _Sp> { _Sp (_Tp::*__p_)(); public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit mem_fun_t(_Sp (_Tp::*__p)()) : __p_(__p) {} __attribute__ ((__exclude_from_explicit_instantiation__)) _Sp operator()(_Tp* __p) const {return (__p->*__p_)();} }; template<class _Sp, class _Tp, class _Ap> class __attribute__ ((deprecated)) mem_fun1_t : public binary_function<_Tp*, _Ap, _Sp> { _Sp (_Tp::*__p_)(_Ap); public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit mem_fun1_t(_Sp (_Tp::*__p)(_Ap)) : __p_(__p) {} __attribute__ ((__exclude_from_explicit_instantiation__)) _Sp operator()(_Tp* __p, _Ap __x) const {return (__p->*__p_)(__x);} }; template<class _Sp, class _Tp> __attribute__ ((deprecated)) inline __attribute__ ((__exclude_from_explicit_instantiation__)) mem_fun_t<_Sp,_Tp> mem_fun(_Sp (_Tp::*__f)()) {return mem_fun_t<_Sp,_Tp>(__f);} template<class _Sp, class _Tp, class _Ap> __attribute__ ((deprecated)) inline __attribute__ ((__exclude_from_explicit_instantiation__)) mem_fun1_t<_Sp,_Tp,_Ap> mem_fun(_Sp (_Tp::*__f)(_Ap)) {return mem_fun1_t<_Sp,_Tp,_Ap>(__f);} template<class _Sp, class _Tp> class __attribute__ ((deprecated)) mem_fun_ref_t : public unary_function<_Tp, _Sp> { _Sp (_Tp::*__p_)(); public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit mem_fun_ref_t(_Sp (_Tp::*__p)()) : __p_(__p) {} __attribute__ ((__exclude_from_explicit_instantiation__)) _Sp operator()(_Tp& __p) const {return (__p.*__p_)();} }; template<class _Sp, class _Tp, class _Ap> class __attribute__ ((deprecated)) mem_fun1_ref_t : public binary_function<_Tp, _Ap, _Sp> { _Sp (_Tp::*__p_)(_Ap); public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit mem_fun1_ref_t(_Sp (_Tp::*__p)(_Ap)) : __p_(__p) {} __attribute__ ((__exclude_from_explicit_instantiation__)) _Sp operator()(_Tp& __p, _Ap __x) const {return (__p.*__p_)(__x);} }; template<class _Sp, class _Tp> __attribute__ ((deprecated)) inline __attribute__ ((__exclude_from_explicit_instantiation__)) mem_fun_ref_t<_Sp,_Tp> mem_fun_ref(_Sp (_Tp::*__f)()) {return mem_fun_ref_t<_Sp,_Tp>(__f);} template<class _Sp, class _Tp, class _Ap> __attribute__ ((deprecated)) inline __attribute__ ((__exclude_from_explicit_instantiation__)) mem_fun1_ref_t<_Sp,_Tp,_Ap> mem_fun_ref(_Sp (_Tp::*__f)(_Ap)) {return mem_fun1_ref_t<_Sp,_Tp,_Ap>(__f);} template <class _Sp, class _Tp> class __attribute__ ((deprecated)) const_mem_fun_t : public unary_function<const _Tp*, _Sp> { _Sp (_Tp::*__p_)() const; public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit const_mem_fun_t(_Sp (_Tp::*__p)() const) : __p_(__p) {} __attribute__ ((__exclude_from_explicit_instantiation__)) _Sp operator()(const _Tp* __p) const {return (__p->*__p_)();} }; template <class _Sp, class _Tp, class _Ap> class __attribute__ ((deprecated)) const_mem_fun1_t : public binary_function<const _Tp*, _Ap, _Sp> { _Sp (_Tp::*__p_)(_Ap) const; public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit const_mem_fun1_t(_Sp (_Tp::*__p)(_Ap) const) : __p_(__p) {} __attribute__ ((__exclude_from_explicit_instantiation__)) _Sp operator()(const _Tp* __p, _Ap __x) const {return (__p->*__p_)(__x);} }; template <class _Sp, class _Tp> __attribute__ ((deprecated)) inline __attribute__ ((__exclude_from_explicit_instantiation__)) const_mem_fun_t<_Sp,_Tp> mem_fun(_Sp (_Tp::*__f)() const) {return const_mem_fun_t<_Sp,_Tp>(__f);} template <class _Sp, class _Tp, class _Ap> __attribute__ ((deprecated)) inline __attribute__ ((__exclude_from_explicit_instantiation__)) const_mem_fun1_t<_Sp,_Tp,_Ap> mem_fun(_Sp (_Tp::*__f)(_Ap) const) {return const_mem_fun1_t<_Sp,_Tp,_Ap>(__f);} template <class _Sp, class _Tp> class __attribute__ ((deprecated)) const_mem_fun_ref_t : public unary_function<_Tp, _Sp> { _Sp (_Tp::*__p_)() const; public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit const_mem_fun_ref_t(_Sp (_Tp::*__p)() const) : __p_(__p) {} __attribute__ ((__exclude_from_explicit_instantiation__)) _Sp operator()(const _Tp& __p) const {return (__p.*__p_)();} }; template <class _Sp, class _Tp, class _Ap> class __attribute__ ((deprecated)) const_mem_fun1_ref_t : public binary_function<_Tp, _Ap, _Sp> { _Sp (_Tp::*__p_)(_Ap) const; public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit const_mem_fun1_ref_t(_Sp (_Tp::*__p)(_Ap) const) : __p_(__p) {} __attribute__ ((__exclude_from_explicit_instantiation__)) _Sp operator()(const _Tp& __p, _Ap __x) const {return (__p.*__p_)(__x);} }; template <class _Sp, class _Tp> __attribute__ ((deprecated)) inline __attribute__ ((__exclude_from_explicit_instantiation__)) const_mem_fun_ref_t<_Sp,_Tp> mem_fun_ref(_Sp (_Tp::*__f)() const) {return const_mem_fun_ref_t<_Sp,_Tp>(__f);} template <class _Sp, class _Tp, class _Ap> __attribute__ ((deprecated)) inline __attribute__ ((__exclude_from_explicit_instantiation__)) const_mem_fun1_ref_t<_Sp,_Tp,_Ap> mem_fun_ref(_Sp (_Tp::*__f)(_Ap) const) {return const_mem_fun1_ref_t<_Sp,_Tp,_Ap>(__f);} template <class _Tp> class __mem_fn : public __weak_result_type<_Tp> { public: typedef _Tp type; private: type __f_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) __mem_fn(type __f) noexcept : __f_(__f) {} template <class... _ArgTypes> __attribute__ ((__exclude_from_explicit_instantiation__)) typename __invoke_return<type, _ArgTypes...>::type operator() (_ArgTypes&&... __args) const { return __invoke(__f_, std::__1::forward<_ArgTypes>(__args)...); } }; template<class _Rp, class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) __mem_fn<_Rp _Tp::*> mem_fn(_Rp _Tp::* __pm) noexcept { return __mem_fn<_Rp _Tp::*>(__pm); } class bad_function_call : public exception { public: virtual ~bad_function_call() noexcept; virtual const char* what() const noexcept; }; [[noreturn]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __throw_bad_function_call() { std::__1::abort(); } template<class _Fp> class function; namespace __function { template<class _Rp> struct __maybe_derive_from_unary_function { }; template<class _Rp, class _A1> struct __maybe_derive_from_unary_function<_Rp(_A1)> : public unary_function<_A1, _Rp> { }; template<class _Rp> struct __maybe_derive_from_binary_function { }; template<class _Rp, class _A1, class _A2> struct __maybe_derive_from_binary_function<_Rp(_A1, _A2)> : public binary_function<_A1, _A2, _Rp> { }; template <class _Fp> __attribute__ ((__exclude_from_explicit_instantiation__)) bool __not_null(_Fp const&) { return true; } template <class _Fp> __attribute__ ((__exclude_from_explicit_instantiation__)) bool __not_null(_Fp* __ptr) { return __ptr; } template <class _Ret, class _Class> __attribute__ ((__exclude_from_explicit_instantiation__)) bool __not_null(_Ret _Class::*__ptr) { return __ptr; } template <class _Fp> __attribute__ ((__exclude_from_explicit_instantiation__)) bool __not_null(function<_Fp> const& __f) { return !!__f; } } namespace __function { template <class _Fp, class _Ap, class _FB> class __alloc_func; template <class _Fp, class _FB> class __default_alloc_func; template <class _Fp, class _Ap, class _Rp, class... _ArgTypes> class __alloc_func<_Fp, _Ap, _Rp(_ArgTypes...)> { __compressed_pair<_Fp, _Ap> __f_; public: typedef __attribute__((nodebug)) _Fp _Target; typedef __attribute__((nodebug)) _Ap _Alloc; __attribute__ ((__exclude_from_explicit_instantiation__)) const _Target& __target() const { return __f_.first(); } __attribute__ ((__exclude_from_explicit_instantiation__)) const _Alloc& __get_allocator() const { return __f_.second(); } __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __alloc_func(_Target&& __f) : __f_(piecewise_construct, std::__1::forward_as_tuple(std::__1::move(__f)), std::__1::forward_as_tuple()) { } __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __alloc_func(const _Target& __f, const _Alloc& __a) : __f_(piecewise_construct, std::__1::forward_as_tuple(__f), std::__1::forward_as_tuple(__a)) { } __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __alloc_func(const _Target& __f, _Alloc&& __a) : __f_(piecewise_construct, std::__1::forward_as_tuple(__f), std::__1::forward_as_tuple(std::__1::move(__a))) { } __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __alloc_func(_Target&& __f, _Alloc&& __a) : __f_(piecewise_construct, std::__1::forward_as_tuple(std::__1::move(__f)), std::__1::forward_as_tuple(std::__1::move(__a))) { } __attribute__ ((__exclude_from_explicit_instantiation__)) _Rp operator()(_ArgTypes&&... __arg) { typedef __invoke_void_return_wrapper<_Rp> _Invoker; return _Invoker::__call(__f_.first(), std::__1::forward<_ArgTypes>(__arg)...); } __attribute__ ((__exclude_from_explicit_instantiation__)) __alloc_func* __clone() const { typedef allocator_traits<_Alloc> __alloc_traits; typedef typename __rebind_alloc_helper<__alloc_traits, __alloc_func>::type _AA; _AA __a(__f_.second()); typedef __allocator_destructor<_AA> _Dp; unique_ptr<__alloc_func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); ::new ((void*)__hold.get()) __alloc_func(__f_.first(), _Alloc(__a)); return __hold.release(); } __attribute__ ((__exclude_from_explicit_instantiation__)) void destroy() noexcept { __f_.~__compressed_pair<_Target, _Alloc>(); } static void __destroy_and_delete(__alloc_func* __f) { typedef allocator_traits<_Alloc> __alloc_traits; typedef typename __rebind_alloc_helper<__alloc_traits, __alloc_func>::type _FunAlloc; _FunAlloc __a(__f->__get_allocator()); __f->destroy(); __a.deallocate(__f, 1); } }; template <class _Fp, class _Rp, class... _ArgTypes> class __default_alloc_func<_Fp, _Rp(_ArgTypes...)> { _Fp __f_; public: typedef __attribute__((nodebug)) _Fp _Target; __attribute__ ((__exclude_from_explicit_instantiation__)) const _Target& __target() const { return __f_; } __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __default_alloc_func(_Target&& __f) : __f_(std::move(__f)) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __default_alloc_func(const _Target& __f) : __f_(__f) {} __attribute__ ((__exclude_from_explicit_instantiation__)) _Rp operator()(_ArgTypes&&... __arg) { typedef __invoke_void_return_wrapper<_Rp> _Invoker; return _Invoker::__call(__f_, std::__1::forward<_ArgTypes>(__arg)...); } __attribute__ ((__exclude_from_explicit_instantiation__)) __default_alloc_func* __clone() const { __builtin_new_allocator::__holder_t __hold = __builtin_new_allocator::__allocate_type<__default_alloc_func>(1); __default_alloc_func* __res = ::new (__hold.get()) __default_alloc_func(__f_); (void)__hold.release(); return __res; } __attribute__ ((__exclude_from_explicit_instantiation__)) void destroy() noexcept { __f_.~_Target(); } static void __destroy_and_delete(__default_alloc_func* __f) { __f->destroy(); __builtin_new_allocator::__deallocate_type<__default_alloc_func>(__f, 1); } }; template<class _Fp> class __base; template<class _Rp, class ..._ArgTypes> class __base<_Rp(_ArgTypes...)> { __base(const __base&); __base& operator=(const __base&); public: __attribute__ ((__exclude_from_explicit_instantiation__)) __base() {} __attribute__ ((__exclude_from_explicit_instantiation__)) virtual ~__base() {} virtual __base* __clone() const = 0; virtual void __clone(__base*) const = 0; virtual void destroy() noexcept = 0; virtual void destroy_deallocate() noexcept = 0; virtual _Rp operator()(_ArgTypes&& ...) = 0; }; template<class _FD, class _Alloc, class _FB> class __func; template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes> class __func<_Fp, _Alloc, _Rp(_ArgTypes...)> : public __base<_Rp(_ArgTypes...)> { __alloc_func<_Fp, _Alloc, _Rp(_ArgTypes...)> __f_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __func(_Fp&& __f) : __f_(std::__1::move(__f)) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __func(const _Fp& __f, const _Alloc& __a) : __f_(__f, __a) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __func(const _Fp& __f, _Alloc&& __a) : __f_(__f, std::__1::move(__a)) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __func(_Fp&& __f, _Alloc&& __a) : __f_(std::__1::move(__f), std::__1::move(__a)) {} virtual __base<_Rp(_ArgTypes...)>* __clone() const; virtual void __clone(__base<_Rp(_ArgTypes...)>*) const; virtual void destroy() noexcept; virtual void destroy_deallocate() noexcept; virtual _Rp operator()(_ArgTypes&&... __arg); }; template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes> __base<_Rp(_ArgTypes...)>* __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone() const { typedef allocator_traits<_Alloc> __alloc_traits; typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap; _Ap __a(__f_.__get_allocator()); typedef __allocator_destructor<_Ap> _Dp; unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); ::new ((void*)__hold.get()) __func(__f_.__target(), _Alloc(__a)); return __hold.release(); } template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes> void __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone(__base<_Rp(_ArgTypes...)>* __p) const { ::new (__p) __func(__f_.__target(), __f_.__get_allocator()); } template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes> void __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy() noexcept { __f_.destroy(); } template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes> void __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate() noexcept { typedef allocator_traits<_Alloc> __alloc_traits; typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap; _Ap __a(__f_.__get_allocator()); __f_.destroy(); __a.deallocate(this, 1); } template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes> _Rp __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&& ... __arg) { return __f_(std::__1::forward<_ArgTypes>(__arg)...); } template <class _Fp> class __value_func; template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)> { typename aligned_storage<3 * sizeof(void*)>::type __buf_; typedef __base<_Rp(_ArgTypes...)> __func; __func* __f_; __attribute__((__no_sanitize__("cfi"))) static __func* __as_base(void* p) { return reinterpret_cast<__func*>(p); } public: __attribute__ ((__exclude_from_explicit_instantiation__)) __value_func() noexcept : __f_(0) {} template <class _Fp, class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) __value_func(_Fp&& __f, const _Alloc& __a) : __f_(0) { typedef allocator_traits<_Alloc> __alloc_traits; typedef __function::__func<_Fp, _Alloc, _Rp(_ArgTypes...)> _Fun; typedef typename __rebind_alloc_helper<__alloc_traits, _Fun>::type _FunAlloc; if (__function::__not_null(__f)) { _FunAlloc __af(__a); if (sizeof(_Fun) <= sizeof(__buf_) && is_nothrow_copy_constructible<_Fp>::value && is_nothrow_copy_constructible<_FunAlloc>::value) { __f_ = ::new ((void*)&__buf_) _Fun(std::__1::move(__f), _Alloc(__af)); } else { typedef __allocator_destructor<_FunAlloc> _Dp; unique_ptr<__func, _Dp> __hold(__af.allocate(1), _Dp(__af, 1)); ::new ((void*)__hold.get()) _Fun(std::__1::move(__f), _Alloc(__a)); __f_ = __hold.release(); } } } template <class _Fp, class = typename enable_if<!is_same<typename decay<_Fp>::type, __value_func>::value>::type> __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __value_func(_Fp&& __f) : __value_func(std::forward<_Fp>(__f), allocator<_Fp>()) {} __attribute__ ((__exclude_from_explicit_instantiation__)) __value_func(const __value_func& __f) { if (__f.__f_ == 0) __f_ = 0; else if ((void*)__f.__f_ == &__f.__buf_) { __f_ = __as_base(&__buf_); __f.__f_->__clone(__f_); } else __f_ = __f.__f_->__clone(); } __attribute__ ((__exclude_from_explicit_instantiation__)) __value_func(__value_func&& __f) noexcept { if (__f.__f_ == 0) __f_ = 0; else if ((void*)__f.__f_ == &__f.__buf_) { __f_ = __as_base(&__buf_); __f.__f_->__clone(__f_); } else { __f_ = __f.__f_; __f.__f_ = 0; } } __attribute__ ((__exclude_from_explicit_instantiation__)) ~__value_func() { if ((void*)__f_ == &__buf_) __f_->destroy(); else if (__f_) __f_->destroy_deallocate(); } __attribute__ ((__exclude_from_explicit_instantiation__)) __value_func& operator=(__value_func&& __f) { *this = nullptr; if (__f.__f_ == 0) __f_ = 0; else if ((void*)__f.__f_ == &__f.__buf_) { __f_ = __as_base(&__buf_); __f.__f_->__clone(__f_); } else { __f_ = __f.__f_; __f.__f_ = 0; } return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __value_func& operator=(nullptr_t) { __func* __f = __f_; __f_ = 0; if ((void*)__f == &__buf_) __f->destroy(); else if (__f) __f->destroy_deallocate(); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) _Rp operator()(_ArgTypes&&... __args) const { if (__f_ == 0) __throw_bad_function_call(); return (*__f_)(std::__1::forward<_ArgTypes>(__args)...); } __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(__value_func& __f) noexcept { if (&__f == this) return; if ((void*)__f_ == &__buf_ && (void*)__f.__f_ == &__f.__buf_) { typename aligned_storage<sizeof(__buf_)>::type __tempbuf; __func* __t = __as_base(&__tempbuf); __f_->__clone(__t); __f_->destroy(); __f_ = 0; __f.__f_->__clone(__as_base(&__buf_)); __f.__f_->destroy(); __f.__f_ = 0; __f_ = __as_base(&__buf_); __t->__clone(__as_base(&__f.__buf_)); __t->destroy(); __f.__f_ = __as_base(&__f.__buf_); } else if ((void*)__f_ == &__buf_) { __f_->__clone(__as_base(&__f.__buf_)); __f_->destroy(); __f_ = __f.__f_; __f.__f_ = __as_base(&__f.__buf_); } else if ((void*)__f.__f_ == &__f.__buf_) { __f.__f_->__clone(__as_base(&__buf_)); __f.__f_->destroy(); __f.__f_ = __f_; __f_ = __as_base(&__buf_); } else std::__1::swap(__f_, __f.__f_); } __attribute__ ((__exclude_from_explicit_instantiation__)) explicit operator bool() const noexcept { return __f_ != 0; } }; union __policy_storage { mutable char __small[sizeof(void*) * 2]; void* __large; }; template <typename _Fun> struct __use_small_storage : public std::__1::integral_constant< bool, sizeof(_Fun) <= sizeof(__policy_storage) && alignof(_Fun) <= alignof(__policy_storage) && std::__1::is_trivially_copy_constructible<_Fun>::value && std::__1::is_trivially_destructible<_Fun>::value> {}; struct __policy { void* (*const __clone)(const void*); void (*const __destroy)(void*); const bool __is_null; const std::type_info* const __type_info; template <typename _Fun> __attribute__ ((__exclude_from_explicit_instantiation__)) static const __policy* __create() { return __choose_policy<_Fun>(__use_small_storage<_Fun>()); } __attribute__ ((__exclude_from_explicit_instantiation__)) static const __policy* __create_empty() { static const constexpr __policy __policy_ = {nullptr, nullptr, true, nullptr }; return &__policy_; } private: template <typename _Fun> static void* __large_clone(const void* __s) { const _Fun* __f = static_cast<const _Fun*>(__s); return __f->__clone(); } template <typename _Fun> static void __large_destroy(void* __s) { _Fun::__destroy_and_delete(static_cast<_Fun*>(__s)); } template <typename _Fun> __attribute__ ((__exclude_from_explicit_instantiation__)) static const __policy* __choose_policy( false_type) { static const constexpr __policy __policy_ = { &__large_clone<_Fun>, &__large_destroy<_Fun>, false, nullptr }; return &__policy_; } template <typename _Fun> __attribute__ ((__exclude_from_explicit_instantiation__)) static const __policy* __choose_policy( true_type) { static const constexpr __policy __policy_ = { nullptr, nullptr, false, nullptr }; return &__policy_; } }; template <typename _Tp> using __fast_forward = typename std::__1::conditional<std::__1::is_scalar<_Tp>::value, _Tp, _Tp&&>::type; template <class _Fp> struct __policy_invoker; template <class _Rp, class... _ArgTypes> struct __policy_invoker<_Rp(_ArgTypes...)> { typedef _Rp (*__Call)(const __policy_storage*, __fast_forward<_ArgTypes>...); __Call __call_; __attribute__ ((__exclude_from_explicit_instantiation__)) __policy_invoker() : __call_(&__call_empty) {} template <typename _Fun> __attribute__ ((__exclude_from_explicit_instantiation__)) static __policy_invoker __create() { return __policy_invoker(&__call_impl<_Fun>); } private: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __policy_invoker(__Call __c) : __call_(__c) {} static _Rp __call_empty(const __policy_storage*, __fast_forward<_ArgTypes>...) { __throw_bad_function_call(); } template <typename _Fun> static _Rp __call_impl(const __policy_storage* __buf, __fast_forward<_ArgTypes>... __args) { _Fun* __f = reinterpret_cast<_Fun*>(__use_small_storage<_Fun>::value ? &__buf->__small : __buf->__large); return (*__f)(std::__1::forward<_ArgTypes>(__args)...); } }; template <class _Fp> class __policy_func; template <class _Rp, class... _ArgTypes> class __policy_func<_Rp(_ArgTypes...)> { __policy_storage __buf_; typedef __function::__policy_invoker<_Rp(_ArgTypes...)> __invoker; __invoker __invoker_; const __policy* __policy_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) __policy_func() : __policy_(__policy::__create_empty()) {} template <class _Fp, class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) __policy_func(_Fp&& __f, const _Alloc& __a) : __policy_(__policy::__create_empty()) { typedef __alloc_func<_Fp, _Alloc, _Rp(_ArgTypes...)> _Fun; typedef allocator_traits<_Alloc> __alloc_traits; typedef typename __rebind_alloc_helper<__alloc_traits, _Fun>::type _FunAlloc; if (__function::__not_null(__f)) { __invoker_ = __invoker::template __create<_Fun>(); __policy_ = __policy::__create<_Fun>(); _FunAlloc __af(__a); if (__use_small_storage<_Fun>()) { ::new ((void*)&__buf_.__small) _Fun(std::__1::move(__f), _Alloc(__af)); } else { typedef __allocator_destructor<_FunAlloc> _Dp; unique_ptr<_Fun, _Dp> __hold(__af.allocate(1), _Dp(__af, 1)); ::new ((void*)__hold.get()) _Fun(std::__1::move(__f), _Alloc(__af)); __buf_.__large = __hold.release(); } } } template <class _Fp, class = typename enable_if<!is_same<typename decay<_Fp>::type, __policy_func>::value>::type> __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __policy_func(_Fp&& __f) : __policy_(__policy::__create_empty()) { typedef __default_alloc_func<_Fp, _Rp(_ArgTypes...)> _Fun; if (__function::__not_null(__f)) { __invoker_ = __invoker::template __create<_Fun>(); __policy_ = __policy::__create<_Fun>(); if (__use_small_storage<_Fun>()) { ::new ((void*)&__buf_.__small) _Fun(std::__1::move(__f)); } else { __builtin_new_allocator::__holder_t __hold = __builtin_new_allocator::__allocate_type<_Fun>(1); __buf_.__large = ::new (__hold.get()) _Fun(std::__1::move(__f)); (void)__hold.release(); } } } __attribute__ ((__exclude_from_explicit_instantiation__)) __policy_func(const __policy_func& __f) : __buf_(__f.__buf_), __invoker_(__f.__invoker_), __policy_(__f.__policy_) { if (__policy_->__clone) __buf_.__large = __policy_->__clone(__f.__buf_.__large); } __attribute__ ((__exclude_from_explicit_instantiation__)) __policy_func(__policy_func&& __f) : __buf_(__f.__buf_), __invoker_(__f.__invoker_), __policy_(__f.__policy_) { if (__policy_->__destroy) { __f.__policy_ = __policy::__create_empty(); __f.__invoker_ = __invoker(); } } __attribute__ ((__exclude_from_explicit_instantiation__)) ~__policy_func() { if (__policy_->__destroy) __policy_->__destroy(__buf_.__large); } __attribute__ ((__exclude_from_explicit_instantiation__)) __policy_func& operator=(__policy_func&& __f) { *this = nullptr; __buf_ = __f.__buf_; __invoker_ = __f.__invoker_; __policy_ = __f.__policy_; __f.__policy_ = __policy::__create_empty(); __f.__invoker_ = __invoker(); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __policy_func& operator=(nullptr_t) { const __policy* __p = __policy_; __policy_ = __policy::__create_empty(); __invoker_ = __invoker(); if (__p->__destroy) __p->__destroy(__buf_.__large); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) _Rp operator()(_ArgTypes&&... __args) const { return __invoker_.__call_(std::__1::addressof(__buf_), std::__1::forward<_ArgTypes>(__args)...); } __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(__policy_func& __f) { std::__1::swap(__invoker_, __f.__invoker_); std::__1::swap(__policy_, __f.__policy_); std::__1::swap(__buf_, __f.__buf_); } __attribute__ ((__exclude_from_explicit_instantiation__)) explicit operator bool() const noexcept { return !__policy_->__is_null; } }; } template<class _Rp, class ..._ArgTypes> class function<_Rp(_ArgTypes...)> : public __function::__maybe_derive_from_unary_function<_Rp(_ArgTypes...)>, public __function::__maybe_derive_from_binary_function<_Rp(_ArgTypes...)> { typedef __function::__policy_func<_Rp(_ArgTypes...)> __func; __func __f_; template <class _Fp, bool = _And< _IsNotSame<__uncvref_t<_Fp>, function>, __invokable<_Fp&, _ArgTypes...> >::value> struct __callable; template <class _Fp> struct __callable<_Fp, true> { static const bool value = is_same<void, _Rp>::value || is_convertible<typename __invoke_of<_Fp&, _ArgTypes...>::type, _Rp>::value; }; template <class _Fp> struct __callable<_Fp, false> { static const bool value = false; }; template <class _Fp> using _EnableIfCallable = typename enable_if<__callable<_Fp>::value>::type; public: typedef _Rp result_type; __attribute__ ((__exclude_from_explicit_instantiation__)) function() noexcept { } __attribute__ ((__exclude_from_explicit_instantiation__)) function(nullptr_t) noexcept {} function(const function&); function(function&&) noexcept; template<class _Fp, class = _EnableIfCallable<_Fp>> function(_Fp); template<class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) function(allocator_arg_t, const _Alloc&) noexcept {} template<class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) function(allocator_arg_t, const _Alloc&, nullptr_t) noexcept {} template<class _Alloc> function(allocator_arg_t, const _Alloc&, const function&); template<class _Alloc> function(allocator_arg_t, const _Alloc&, function&&); template<class _Fp, class _Alloc, class = _EnableIfCallable<_Fp>> function(allocator_arg_t, const _Alloc& __a, _Fp __f); function& operator=(const function&); function& operator=(function&&) noexcept; function& operator=(nullptr_t) noexcept; template<class _Fp, class = _EnableIfCallable<_Fp>> function& operator=(_Fp&&); ~function(); void swap(function&) noexcept; template<class _Fp, class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) void assign(_Fp&& __f, const _Alloc& __a) {function(allocator_arg, __a, std::__1::forward<_Fp>(__f)).swap(*this);} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit operator bool() const noexcept { return static_cast<bool>(__f_); } template<class _R2, class... _ArgTypes2> bool operator==(const function<_R2(_ArgTypes2...)>&) const = delete; template<class _R2, class... _ArgTypes2> bool operator!=(const function<_R2(_ArgTypes2...)>&) const = delete; public: _Rp operator()(_ArgTypes...) const; }; template<class _Rp, class ..._ArgTypes> function<_Rp(_ArgTypes...)>::function(const function& __f) : __f_(__f.__f_) {} template<class _Rp, class ..._ArgTypes> template <class _Alloc> function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&, const function& __f) : __f_(__f.__f_) {} template <class _Rp, class... _ArgTypes> function<_Rp(_ArgTypes...)>::function(function&& __f) noexcept : __f_(std::__1::move(__f.__f_)) {} template<class _Rp, class ..._ArgTypes> template <class _Alloc> function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&, function&& __f) : __f_(std::__1::move(__f.__f_)) {} template <class _Rp, class... _ArgTypes> template <class _Fp, class> function<_Rp(_ArgTypes...)>::function(_Fp __f) : __f_(std::__1::move(__f)) {} template <class _Rp, class... _ArgTypes> template <class _Fp, class _Alloc, class> function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a, _Fp __f) : __f_(std::__1::move(__f), __a) {} template<class _Rp, class ..._ArgTypes> function<_Rp(_ArgTypes...)>& function<_Rp(_ArgTypes...)>::operator=(const function& __f) { function(__f).swap(*this); return *this; } template<class _Rp, class ..._ArgTypes> function<_Rp(_ArgTypes...)>& function<_Rp(_ArgTypes...)>::operator=(function&& __f) noexcept { __f_ = std::move(__f.__f_); return *this; } template<class _Rp, class ..._ArgTypes> function<_Rp(_ArgTypes...)>& function<_Rp(_ArgTypes...)>::operator=(nullptr_t) noexcept { __f_ = nullptr; return *this; } template<class _Rp, class ..._ArgTypes> template <class _Fp, class> function<_Rp(_ArgTypes...)>& function<_Rp(_ArgTypes...)>::operator=(_Fp&& __f) { function(std::__1::forward<_Fp>(__f)).swap(*this); return *this; } template<class _Rp, class ..._ArgTypes> function<_Rp(_ArgTypes...)>::~function() {} template<class _Rp, class ..._ArgTypes> void function<_Rp(_ArgTypes...)>::swap(function& __f) noexcept { __f_.swap(__f.__f_); } template<class _Rp, class ..._ArgTypes> _Rp function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) const { return __f_(std::__1::forward<_ArgTypes>(__arg)...); } template <class _Rp, class... _ArgTypes> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) noexcept {return !__f;} template <class _Rp, class... _ArgTypes> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(nullptr_t, const function<_Rp(_ArgTypes...)>& __f) noexcept {return !__f;} template <class _Rp, class... _ArgTypes> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) noexcept {return (bool)__f;} template <class _Rp, class... _ArgTypes> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(nullptr_t, const function<_Rp(_ArgTypes...)>& __f) noexcept {return (bool)__f;} template <class _Rp, class... _ArgTypes> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(function<_Rp(_ArgTypes...)>& __x, function<_Rp(_ArgTypes...)>& __y) noexcept {return __x.swap(__y);} template<class _Tp> struct __is_bind_expression : public false_type {}; template<class _Tp> struct is_bind_expression : public __is_bind_expression<typename remove_cv<_Tp>::type> {}; template<class _Tp> struct __is_placeholder : public integral_constant<int, 0> {}; template<class _Tp> struct is_placeholder : public __is_placeholder<typename remove_cv<_Tp>::type> {}; namespace placeholders { template <int _Np> struct __ph {}; constexpr __ph<1> _1{}; constexpr __ph<2> _2{}; constexpr __ph<3> _3{}; constexpr __ph<4> _4{}; constexpr __ph<5> _5{}; constexpr __ph<6> _6{}; constexpr __ph<7> _7{}; constexpr __ph<8> _8{}; constexpr __ph<9> _9{}; constexpr __ph<10> _10{}; } template<int _Np> struct __is_placeholder<placeholders::__ph<_Np> > : public integral_constant<int, _Np> {}; template <class _Tp, class _Uj> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp& __mu(reference_wrapper<_Tp> __t, _Uj&) { return __t.get(); } template <class _Ti, class ..._Uj, size_t ..._Indx> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename __invoke_of<_Ti&, _Uj...>::type __mu_expand(_Ti& __ti, tuple<_Uj...>& __uj, __tuple_indices<_Indx...>) { return __ti(std::__1::forward<_Uj>(std::__1::get<_Indx>(__uj))...); } template <class _Ti, class ..._Uj> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename _EnableIf < is_bind_expression<_Ti>::value, __invoke_of<_Ti&, _Uj...> >::type __mu(_Ti& __ti, tuple<_Uj...>& __uj) { typedef typename __make_tuple_indices<sizeof...(_Uj)>::type __indices; return __mu_expand(__ti, __uj, __indices()); } template <bool IsPh, class _Ti, class _Uj> struct __mu_return2 {}; template <class _Ti, class _Uj> struct __mu_return2<true, _Ti, _Uj> { typedef typename tuple_element<is_placeholder<_Ti>::value - 1, _Uj>::type type; }; template <class _Ti, class _Uj> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < 0 < is_placeholder<_Ti>::value, typename __mu_return2<0 < is_placeholder<_Ti>::value, _Ti, _Uj>::type >::type __mu(_Ti&, _Uj& __uj) { const size_t _Indx = is_placeholder<_Ti>::value - 1; return std::__1::forward<typename tuple_element<_Indx, _Uj>::type>(std::__1::get<_Indx>(__uj)); } template <class _Ti, class _Uj> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < !is_bind_expression<_Ti>::value && is_placeholder<_Ti>::value == 0 && !__is_reference_wrapper<_Ti>::value, _Ti& >::type __mu(_Ti& __ti, _Uj&) { return __ti; } template <class _Ti, bool IsReferenceWrapper, bool IsBindEx, bool IsPh, class _TupleUj> struct __mu_return_impl; template <bool _Invokable, class _Ti, class ..._Uj> struct __mu_return_invokable { typedef __nat type; }; template <class _Ti, class ..._Uj> struct __mu_return_invokable<true, _Ti, _Uj...> { typedef typename __invoke_of<_Ti&, _Uj...>::type type; }; template <class _Ti, class ..._Uj> struct __mu_return_impl<_Ti, false, true, false, tuple<_Uj...> > : public __mu_return_invokable<__invokable<_Ti&, _Uj...>::value, _Ti, _Uj...> { }; template <class _Ti, class _TupleUj> struct __mu_return_impl<_Ti, false, false, true, _TupleUj> { typedef typename tuple_element<is_placeholder<_Ti>::value - 1, _TupleUj>::type&& type; }; template <class _Ti, class _TupleUj> struct __mu_return_impl<_Ti, true, false, false, _TupleUj> { typedef typename _Ti::type& type; }; template <class _Ti, class _TupleUj> struct __mu_return_impl<_Ti, false, false, false, _TupleUj> { typedef _Ti& type; }; template <class _Ti, class _TupleUj> struct __mu_return : public __mu_return_impl<_Ti, __is_reference_wrapper<_Ti>::value, is_bind_expression<_Ti>::value, 0 < is_placeholder<_Ti>::value && is_placeholder<_Ti>::value <= tuple_size<_TupleUj>::value, _TupleUj> { }; template <class _Fp, class _BoundArgs, class _TupleUj> struct __is_valid_bind_return { static const bool value = false; }; template <class _Fp, class ..._BoundArgs, class _TupleUj> struct __is_valid_bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj> { static const bool value = __invokable<_Fp, typename __mu_return<_BoundArgs, _TupleUj>::type...>::value; }; template <class _Fp, class ..._BoundArgs, class _TupleUj> struct __is_valid_bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj> { static const bool value = __invokable<_Fp, typename __mu_return<const _BoundArgs, _TupleUj>::type...>::value; }; template <class _Fp, class _BoundArgs, class _TupleUj, bool = __is_valid_bind_return<_Fp, _BoundArgs, _TupleUj>::value> struct __bind_return; template <class _Fp, class ..._BoundArgs, class _TupleUj> struct __bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj, true> { typedef typename __invoke_of < _Fp&, typename __mu_return < _BoundArgs, _TupleUj >::type... >::type type; }; template <class _Fp, class ..._BoundArgs, class _TupleUj> struct __bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj, true> { typedef typename __invoke_of < _Fp&, typename __mu_return < const _BoundArgs, _TupleUj >::type... >::type type; }; template <class _Fp, class _BoundArgs, size_t ..._Indx, class _Args> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename __bind_return<_Fp, _BoundArgs, _Args>::type __apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>, _Args&& __args) { return std::__1::__invoke(__f, std::__1::__mu(std::__1::get<_Indx>(__bound_args), __args)...); } template<class _Fp, class ..._BoundArgs> class __bind : public __weak_result_type<typename decay<_Fp>::type> { protected: typedef typename decay<_Fp>::type _Fd; typedef tuple<typename decay<_BoundArgs>::type...> _Td; private: _Fd __f_; _Td __bound_args_; typedef typename __make_tuple_indices<sizeof...(_BoundArgs)>::type __indices; public: template <class _Gp, class ..._BA, class = typename enable_if < is_constructible<_Fd, _Gp>::value && !is_same<typename remove_reference<_Gp>::type, __bind>::value >::type> __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __bind(_Gp&& __f, _BA&& ...__bound_args) : __f_(std::__1::forward<_Gp>(__f)), __bound_args_(std::__1::forward<_BA>(__bound_args)...) {} template <class ..._Args> __attribute__ ((__exclude_from_explicit_instantiation__)) typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type operator()(_Args&& ...__args) { return std::__1::__apply_functor(__f_, __bound_args_, __indices(), tuple<_Args&&...>(std::__1::forward<_Args>(__args)...)); } template <class ..._Args> __attribute__ ((__exclude_from_explicit_instantiation__)) typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type operator()(_Args&& ...__args) const { return std::__1::__apply_functor(__f_, __bound_args_, __indices(), tuple<_Args&&...>(std::__1::forward<_Args>(__args)...)); } }; template<class _Fp, class ..._BoundArgs> struct __is_bind_expression<__bind<_Fp, _BoundArgs...> > : public true_type {}; template<class _Rp, class _Fp, class ..._BoundArgs> class __bind_r : public __bind<_Fp, _BoundArgs...> { typedef __bind<_Fp, _BoundArgs...> base; typedef typename base::_Fd _Fd; typedef typename base::_Td _Td; public: typedef _Rp result_type; template <class _Gp, class ..._BA, class = typename enable_if < is_constructible<_Fd, _Gp>::value && !is_same<typename remove_reference<_Gp>::type, __bind_r>::value >::type> __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __bind_r(_Gp&& __f, _BA&& ...__bound_args) : base(std::__1::forward<_Gp>(__f), std::__1::forward<_BA>(__bound_args)...) {} template <class ..._Args> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_convertible<typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type, result_type>::value || is_void<_Rp>::value, result_type >::type operator()(_Args&& ...__args) { typedef __invoke_void_return_wrapper<_Rp> _Invoker; return _Invoker::__call(static_cast<base&>(*this), std::__1::forward<_Args>(__args)...); } template <class ..._Args> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_convertible<typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type, result_type>::value || is_void<_Rp>::value, result_type >::type operator()(_Args&& ...__args) const { typedef __invoke_void_return_wrapper<_Rp> _Invoker; return _Invoker::__call(static_cast<base const&>(*this), std::__1::forward<_Args>(__args)...); } }; template<class _Rp, class _Fp, class ..._BoundArgs> struct __is_bind_expression<__bind_r<_Rp, _Fp, _BoundArgs...> > : public true_type {}; template<class _Fp, class ..._BoundArgs> inline __attribute__ ((__exclude_from_explicit_instantiation__)) __bind<_Fp, _BoundArgs...> bind(_Fp&& __f, _BoundArgs&&... __bound_args) { typedef __bind<_Fp, _BoundArgs...> type; return type(std::__1::forward<_Fp>(__f), std::__1::forward<_BoundArgs>(__bound_args)...); } template<class _Rp, class _Fp, class ..._BoundArgs> inline __attribute__ ((__exclude_from_explicit_instantiation__)) __bind_r<_Rp, _Fp, _BoundArgs...> bind(_Fp&& __f, _BoundArgs&&... __bound_args) { typedef __bind_r<_Rp, _Fp, _BoundArgs...> type; return type(std::__1::forward<_Fp>(__f), std::__1::forward<_BoundArgs>(__bound_args)...); } template <class _BinaryPredicate, class _ForwardIterator1, class _ForwardIterator2> pair<_ForwardIterator1, _ForwardIterator1> constexpr __search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred, forward_iterator_tag, forward_iterator_tag) { if (__first2 == __last2) return make_pair(__first1, __first1); while (true) { while (true) { if (__first1 == __last1) return make_pair(__last1, __last1); if (__pred(*__first1, *__first2)) break; ++__first1; } _ForwardIterator1 __m1 = __first1; _ForwardIterator2 __m2 = __first2; while (true) { if (++__m2 == __last2) return make_pair(__first1, __m1); if (++__m1 == __last1) return make_pair(__last1, __last1); if (!__pred(*__m1, *__m2)) { ++__first1; break; } } } } template <class _BinaryPredicate, class _RandomAccessIterator1, class _RandomAccessIterator2> constexpr pair<_RandomAccessIterator1, _RandomAccessIterator1> __search(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, _RandomAccessIterator2 __first2, _RandomAccessIterator2 __last2, _BinaryPredicate __pred, random_access_iterator_tag, random_access_iterator_tag) { typedef typename iterator_traits<_RandomAccessIterator1>::difference_type _D1; typedef typename iterator_traits<_RandomAccessIterator2>::difference_type _D2; const _D2 __len2 = __last2 - __first2; if (__len2 == 0) return make_pair(__first1, __first1); const _D1 __len1 = __last1 - __first1; if (__len1 < __len2) return make_pair(__last1, __last1); const _RandomAccessIterator1 __s = __last1 - (__len2 - 1); while (true) { while (true) { if (__first1 == __s) return make_pair(__last1, __last1); if (__pred(*__first1, *__first2)) break; ++__first1; } _RandomAccessIterator1 __m1 = __first1; _RandomAccessIterator2 __m2 = __first2; while (true) { if (++__m2 == __last2) return make_pair(__first1, __first1 + __len2); ++__m1; if (!__pred(*__m1, *__m2)) { ++__first1; break; } } } } template <class _Container, class _Predicate> inline void __libcpp_erase_if_container( _Container& __c, _Predicate __pred) { for (typename _Container::iterator __iter = __c.begin(), __last = __c.end(); __iter != __last;) { if (__pred(*__iter)) __iter = __c.erase(__iter); else ++__iter; } } } } namespace std { inline namespace __1 { inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr int __libcpp_ctz(unsigned __x) noexcept { return __builtin_ctz(__x); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr int __libcpp_ctz(unsigned long __x) noexcept { return __builtin_ctzl(__x); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr int __libcpp_ctz(unsigned long long __x) noexcept { return __builtin_ctzll(__x); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr int __libcpp_clz(unsigned __x) noexcept { return __builtin_clz(__x); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr int __libcpp_clz(unsigned long __x) noexcept { return __builtin_clzl(__x); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr int __libcpp_clz(unsigned long long __x) noexcept { return __builtin_clzll(__x); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr int __libcpp_popcount(unsigned __x) noexcept { return __builtin_popcount(__x); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr int __libcpp_popcount(unsigned long __x) noexcept { return __builtin_popcountl(__x); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr int __libcpp_popcount(unsigned long long __x) noexcept { return __builtin_popcountll(__x); } template <class _Tp> using __bitop_unsigned_integer __attribute__((nodebug)) = integral_constant<bool, is_integral<_Tp>::value && is_unsigned<_Tp>::value && _IsNotSame<typename remove_cv<_Tp>::type, bool>::value && _IsNotSame<typename remove_cv<_Tp>::type, signed char>::value && _IsNotSame<typename remove_cv<_Tp>::type, wchar_t>::value && _IsNotSame<typename remove_cv<_Tp>::type, char16_t>::value && _IsNotSame<typename remove_cv<_Tp>::type, char32_t>::value >; template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _Tp __rotl(_Tp __t, unsigned int __cnt) noexcept { static_assert(__bitop_unsigned_integer<_Tp>::value, "__rotl requires unsigned"); const unsigned int __dig = numeric_limits<_Tp>::digits; if ((__cnt % __dig) == 0) return __t; return (__t << (__cnt % __dig)) | (__t >> (__dig - (__cnt % __dig))); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _Tp __rotr(_Tp __t, unsigned int __cnt) noexcept { static_assert(__bitop_unsigned_integer<_Tp>::value, "__rotr requires unsigned"); const unsigned int __dig = numeric_limits<_Tp>::digits; if ((__cnt % __dig) == 0) return __t; return (__t >> (__cnt % __dig)) | (__t << (__dig - (__cnt % __dig))); } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr int __countr_zero(_Tp __t) noexcept { static_assert(__bitop_unsigned_integer<_Tp>::value, "__countr_zero requires unsigned"); if (__t == 0) return numeric_limits<_Tp>::digits; if (sizeof(_Tp) <= sizeof(unsigned int)) return __libcpp_ctz(static_cast<unsigned int>(__t)); else if (sizeof(_Tp) <= sizeof(unsigned long)) return __libcpp_ctz(static_cast<unsigned long>(__t)); else if (sizeof(_Tp) <= sizeof(unsigned long long)) return __libcpp_ctz(static_cast<unsigned long long>(__t)); else { int __ret = 0; int __iter = 0; const unsigned int __ulldigits = numeric_limits<unsigned long long>::digits; while ((__iter = __libcpp_ctz(static_cast<unsigned long long>(__t))) == __ulldigits) { __ret += __iter; __t >>= __ulldigits; } return __ret + __iter; } } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr int __countl_zero(_Tp __t) noexcept { static_assert(__bitop_unsigned_integer<_Tp>::value, "__countl_zero requires unsigned"); if (__t == 0) return numeric_limits<_Tp>::digits; if (sizeof(_Tp) <= sizeof(unsigned int)) return __libcpp_clz(static_cast<unsigned int>(__t)) - (numeric_limits<unsigned int>::digits - numeric_limits<_Tp>::digits); else if (sizeof(_Tp) <= sizeof(unsigned long)) return __libcpp_clz(static_cast<unsigned long>(__t)) - (numeric_limits<unsigned long>::digits - numeric_limits<_Tp>::digits); else if (sizeof(_Tp) <= sizeof(unsigned long long)) return __libcpp_clz(static_cast<unsigned long long>(__t)) - (numeric_limits<unsigned long long>::digits - numeric_limits<_Tp>::digits); else { int __ret = 0; int __iter = 0; const unsigned int __ulldigits = numeric_limits<unsigned long long>::digits; while (true) { __t = __rotr(__t, __ulldigits); if ((__iter = __countl_zero(static_cast<unsigned long long>(__t))) != __ulldigits) break; __ret += __iter; } return __ret + __iter; } } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr int __countl_one(_Tp __t) noexcept { static_assert(__bitop_unsigned_integer<_Tp>::value, "__countl_one requires unsigned"); return __t != numeric_limits<_Tp>::max() ? __countl_zero(static_cast<_Tp>(~__t)) : numeric_limits<_Tp>::digits; } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr int __countr_one(_Tp __t) noexcept { static_assert(__bitop_unsigned_integer<_Tp>::value, "__countr_one requires unsigned"); return __t != numeric_limits<_Tp>::max() ? __countr_zero(static_cast<_Tp>(~__t)) : numeric_limits<_Tp>::digits; } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr int __popcount(_Tp __t) noexcept { static_assert(__bitop_unsigned_integer<_Tp>::value, "__libcpp_popcount requires unsigned"); if (sizeof(_Tp) <= sizeof(unsigned int)) return __libcpp_popcount(static_cast<unsigned int>(__t)); else if (sizeof(_Tp) <= sizeof(unsigned long)) return __libcpp_popcount(static_cast<unsigned long>(__t)); else if (sizeof(_Tp) <= sizeof(unsigned long long)) return __libcpp_popcount(static_cast<unsigned long long>(__t)); else { int __ret = 0; while (__t != 0) { __ret += __libcpp_popcount(static_cast<unsigned long long>(__t)); __t >>= numeric_limits<unsigned long long>::digits; } return __ret; } } template<class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr unsigned __bit_log2(_Tp __t) noexcept { static_assert(__bitop_unsigned_integer<_Tp>::value, "__bit_log2 requires unsigned"); return std::numeric_limits<_Tp>::digits - 1 - __countl_zero(__t); } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool __ispow2(_Tp __t) noexcept { static_assert(__bitop_unsigned_integer<_Tp>::value, "__ispow2 requires unsigned"); return __t != 0 && (((__t & (__t - 1)) == 0)); } } } namespace std { inline namespace __1 { template <class _T1, class _T2 = _T1> struct __equal_to { __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator()(const _T1& __x, const _T2& __y) const {return __x == __y;} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator()(const _T2& __x, const _T1& __y) const {return __x == __y;} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator()(const _T2& __x, const _T2& __y) const {return __x == __y;} }; template <class _T1> struct __equal_to<_T1, _T1> { __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;} }; template <class _T1> struct __equal_to<const _T1, _T1> { __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;} }; template <class _T1> struct __equal_to<_T1, const _T1> { __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;} }; template <class _T1, class _T2 = _T1> struct __less { __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator()(const _T1& __x, const _T2& __y) const {return __x < __y;} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator()(const _T2& __x, const _T1& __y) const {return __x < __y;} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator()(const _T2& __x, const _T2& __y) const {return __x < __y;} }; template <class _T1> struct __less<_T1, _T1> { __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;} }; template <class _T1> struct __less<const _T1, _T1> { __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;} }; template <class _T1> struct __less<_T1, const _T1> { __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;} }; template <class _Predicate> class __invert { private: _Predicate __p_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) __invert() {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __invert(_Predicate __p) : __p_(__p) {} template <class _T1> __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const _T1& __x) {return !__p_(__x);} template <class _T1, class _T2> __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const _T1& __x, const _T2& __y) {return __p_(__y, __x);} }; template <typename _Integral> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename enable_if < is_integral<_Integral>::value, _Integral >::type __half_positive(_Integral __value) { return static_cast<_Integral>(static_cast<typename make_unsigned<_Integral>::type>(__value) / 2); } template <typename _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename enable_if < !is_integral<_Tp>::value, _Tp >::type __half_positive(_Tp __value) { return __value / 2; } template <class _Comp> struct __comp_ref_type { typedef typename add_lvalue_reference<_Comp>::type type; }; template <class _InputIterator, class _Predicate> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) { for (; __first != __last; ++__first) if (!__pred(*__first)) return false; return true; } template <class _InputIterator, class _Predicate> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) { for (; __first != __last; ++__first) if (__pred(*__first)) return true; return false; } template <class _InputIterator, class _Predicate> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool none_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) { for (; __first != __last; ++__first) if (__pred(*__first)) return false; return true; } template <class _InputIterator, class _Function> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _Function for_each(_InputIterator __first, _InputIterator __last, _Function __f) { for (; __first != __last; ++__first) __f(*__first); return __f; } template <class _InputIterator, class _Tp> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) _InputIterator find(_InputIterator __first, _InputIterator __last, const _Tp& __value_) { for (; __first != __last; ++__first) if (*__first == __value_) break; return __first; } template <class _InputIterator, class _Predicate> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) _InputIterator find_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) { for (; __first != __last; ++__first) if (__pred(*__first)) break; return __first; } template<class _InputIterator, class _Predicate> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) _InputIterator find_if_not(_InputIterator __first, _InputIterator __last, _Predicate __pred) { for (; __first != __last; ++__first) if (!__pred(*__first)) break; return __first; } template <class _BinaryPredicate, class _ForwardIterator1, class _ForwardIterator2> _ForwardIterator1 __find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred, forward_iterator_tag, forward_iterator_tag) { _ForwardIterator1 __r = __last1; if (__first2 == __last2) return __r; while (true) { while (true) { if (__first1 == __last1) return __r; if (__pred(*__first1, *__first2)) break; ++__first1; } _ForwardIterator1 __m1 = __first1; _ForwardIterator2 __m2 = __first2; while (true) { if (++__m2 == __last2) { __r = __first1; ++__first1; break; } if (++__m1 == __last1) return __r; if (!__pred(*__m1, *__m2)) { ++__first1; break; } } } } template <class _BinaryPredicate, class _BidirectionalIterator1, class _BidirectionalIterator2> _BidirectionalIterator1 __find_end(_BidirectionalIterator1 __first1, _BidirectionalIterator1 __last1, _BidirectionalIterator2 __first2, _BidirectionalIterator2 __last2, _BinaryPredicate __pred, bidirectional_iterator_tag, bidirectional_iterator_tag) { if (__first2 == __last2) return __last1; _BidirectionalIterator1 __l1 = __last1; _BidirectionalIterator2 __l2 = __last2; --__l2; while (true) { while (true) { if (__first1 == __l1) return __last1; if (__pred(*--__l1, *__l2)) break; } _BidirectionalIterator1 __m1 = __l1; _BidirectionalIterator2 __m2 = __l2; while (true) { if (__m2 == __first2) return __m1; if (__m1 == __first1) return __last1; if (!__pred(*--__m1, *--__m2)) { break; } } } } template <class _BinaryPredicate, class _RandomAccessIterator1, class _RandomAccessIterator2> constexpr _RandomAccessIterator1 __find_end(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, _RandomAccessIterator2 __first2, _RandomAccessIterator2 __last2, _BinaryPredicate __pred, random_access_iterator_tag, random_access_iterator_tag) { typename iterator_traits<_RandomAccessIterator2>::difference_type __len2 = __last2 - __first2; if (__len2 == 0) return __last1; typename iterator_traits<_RandomAccessIterator1>::difference_type __len1 = __last1 - __first1; if (__len1 < __len2) return __last1; const _RandomAccessIterator1 __s = __first1 + (__len2 - 1); _RandomAccessIterator1 __l1 = __last1; _RandomAccessIterator2 __l2 = __last2; --__l2; while (true) { while (true) { if (__s == __l1) return __last1; if (__pred(*--__l1, *__l2)) break; } _RandomAccessIterator1 __m1 = __l1; _RandomAccessIterator2 __m2 = __l2; while (true) { if (__m2 == __first2) return __m1; if (!__pred(*--__m1, *--__m2)) { break; } } } } template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) _ForwardIterator1 find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred) { return std::__1::__find_end<typename add_lvalue_reference<_BinaryPredicate>::type> (__first1, __last1, __first2, __last2, __pred, typename iterator_traits<_ForwardIterator1>::iterator_category(), typename iterator_traits<_ForwardIterator2>::iterator_category()); } template <class _ForwardIterator1, class _ForwardIterator2> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) _ForwardIterator1 find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) { typedef typename iterator_traits<_ForwardIterator1>::value_type __v1; typedef typename iterator_traits<_ForwardIterator2>::value_type __v2; return std::__1::find_end(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>()); } template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> constexpr _ForwardIterator1 __find_first_of_ce(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred) { for (; __first1 != __last1; ++__first1) for (_ForwardIterator2 __j = __first2; __j != __last2; ++__j) if (__pred(*__first1, *__j)) return __first1; return __last1; } template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) _ForwardIterator1 find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred) { return std::__1::__find_first_of_ce(__first1, __last1, __first2, __last2, __pred); } template <class _ForwardIterator1, class _ForwardIterator2> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) _ForwardIterator1 find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) { typedef typename iterator_traits<_ForwardIterator1>::value_type __v1; typedef typename iterator_traits<_ForwardIterator2>::value_type __v2; return std::__1::__find_first_of_ce(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>()); } template <class _ForwardIterator, class _BinaryPredicate> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) _ForwardIterator adjacent_find(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred) { if (__first != __last) { _ForwardIterator __i = __first; while (++__i != __last) { if (__pred(*__first, *__i)) return __first; __first = __i; } } return __last; } template <class _ForwardIterator> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) _ForwardIterator adjacent_find(_ForwardIterator __first, _ForwardIterator __last) { typedef typename iterator_traits<_ForwardIterator>::value_type __v; return std::__1::adjacent_find(__first, __last, __equal_to<__v>()); } template <class _InputIterator, class _Tp> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename iterator_traits<_InputIterator>::difference_type count(_InputIterator __first, _InputIterator __last, const _Tp& __value_) { typename iterator_traits<_InputIterator>::difference_type __r(0); for (; __first != __last; ++__first) if (*__first == __value_) ++__r; return __r; } template <class _InputIterator, class _Predicate> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename iterator_traits<_InputIterator>::difference_type count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) { typename iterator_traits<_InputIterator>::difference_type __r(0); for (; __first != __last; ++__first) if (__pred(*__first)) ++__r; return __r; } template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) pair<_InputIterator1, _InputIterator2> mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred) { for (; __first1 != __last1; ++__first1, (void) ++__first2) if (!__pred(*__first1, *__first2)) break; return pair<_InputIterator1, _InputIterator2>(__first1, __first2); } template <class _InputIterator1, class _InputIterator2> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) pair<_InputIterator1, _InputIterator2> mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2) { typedef typename iterator_traits<_InputIterator1>::value_type __v1; typedef typename iterator_traits<_InputIterator2>::value_type __v2; return std::__1::mismatch(__first1, __last1, __first2, __equal_to<__v1, __v2>()); } template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) pair<_InputIterator1, _InputIterator2> mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _BinaryPredicate __pred) { for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void) ++__first2) if (!__pred(*__first1, *__first2)) break; return pair<_InputIterator1, _InputIterator2>(__first1, __first2); } template <class _InputIterator1, class _InputIterator2> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) pair<_InputIterator1, _InputIterator2> mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) { typedef typename iterator_traits<_InputIterator1>::value_type __v1; typedef typename iterator_traits<_InputIterator2>::value_type __v2; return std::__1::mismatch(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>()); } template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred) { for (; __first1 != __last1; ++__first1, (void) ++__first2) if (!__pred(*__first1, *__first2)) return false; return true; } template <class _InputIterator1, class _InputIterator2> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2) { typedef typename iterator_traits<_InputIterator1>::value_type __v1; typedef typename iterator_traits<_InputIterator2>::value_type __v2; return std::__1::equal(__first1, __last1, __first2, __equal_to<__v1, __v2>()); } template <class _BinaryPredicate, class _InputIterator1, class _InputIterator2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool __equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _BinaryPredicate __pred, input_iterator_tag, input_iterator_tag ) { for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void) ++__first2) if (!__pred(*__first1, *__first2)) return false; return __first1 == __last1 && __first2 == __last2; } template <class _BinaryPredicate, class _RandomAccessIterator1, class _RandomAccessIterator2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool __equal(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, _RandomAccessIterator2 __first2, _RandomAccessIterator2 __last2, _BinaryPredicate __pred, random_access_iterator_tag, random_access_iterator_tag ) { if ( std::__1::distance(__first1, __last1) != std::__1::distance(__first2, __last2)) return false; return std::__1::equal<_RandomAccessIterator1, _RandomAccessIterator2, typename add_lvalue_reference<_BinaryPredicate>::type> (__first1, __last1, __first2, __pred ); } template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _BinaryPredicate __pred ) { return std::__1::__equal<typename add_lvalue_reference<_BinaryPredicate>::type> (__first1, __last1, __first2, __last2, __pred, typename iterator_traits<_InputIterator1>::iterator_category(), typename iterator_traits<_InputIterator2>::iterator_category()); } template <class _InputIterator1, class _InputIterator2> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) { typedef typename iterator_traits<_InputIterator1>::value_type __v1; typedef typename iterator_traits<_InputIterator2>::value_type __v2; return std::__1::__equal(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>(), typename iterator_traits<_InputIterator1>::iterator_category(), typename iterator_traits<_InputIterator2>::iterator_category()); } template<class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> [[nodiscard]] bool is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _BinaryPredicate __pred) { for (; __first1 != __last1; ++__first1, (void) ++__first2) if (!__pred(*__first1, *__first2)) break; if (__first1 == __last1) return true; typedef typename iterator_traits<_ForwardIterator1>::difference_type _D1; _D1 __l1 = std::__1::distance(__first1, __last1); if (__l1 == _D1(1)) return false; _ForwardIterator2 __last2 = std::__1::next(__first2, __l1); for (_ForwardIterator1 __i = __first1; __i != __last1; ++__i) { _ForwardIterator1 __match = __first1; for (; __match != __i; ++__match) if (__pred(*__match, *__i)) break; if (__match == __i) { _D1 __c2 = 0; for (_ForwardIterator2 __j = __first2; __j != __last2; ++__j) if (__pred(*__i, *__j)) ++__c2; if (__c2 == 0) return false; _D1 __c1 = 1; for (_ForwardIterator1 __j = std::__1::next(__i); __j != __last1; ++__j) if (__pred(*__i, *__j)) ++__c1; if (__c1 != __c2) return false; } } return true; } template<class _ForwardIterator1, class _ForwardIterator2> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2) { typedef typename iterator_traits<_ForwardIterator1>::value_type __v1; typedef typename iterator_traits<_ForwardIterator2>::value_type __v2; return std::__1::is_permutation(__first1, __last1, __first2, __equal_to<__v1, __v2>()); } template<class _BinaryPredicate, class _ForwardIterator1, class _ForwardIterator2> bool __is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred, forward_iterator_tag, forward_iterator_tag ) { for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void) ++__first2) if (!__pred(*__first1, *__first2)) break; if (__first1 == __last1) return __first2 == __last2; else if (__first2 == __last2) return false; typedef typename iterator_traits<_ForwardIterator1>::difference_type _D1; _D1 __l1 = std::__1::distance(__first1, __last1); typedef typename iterator_traits<_ForwardIterator2>::difference_type _D2; _D2 __l2 = std::__1::distance(__first2, __last2); if (__l1 != __l2) return false; for (_ForwardIterator1 __i = __first1; __i != __last1; ++__i) { _ForwardIterator1 __match = __first1; for (; __match != __i; ++__match) if (__pred(*__match, *__i)) break; if (__match == __i) { _D1 __c2 = 0; for (_ForwardIterator2 __j = __first2; __j != __last2; ++__j) if (__pred(*__i, *__j)) ++__c2; if (__c2 == 0) return false; _D1 __c1 = 1; for (_ForwardIterator1 __j = std::__1::next(__i); __j != __last1; ++__j) if (__pred(*__i, *__j)) ++__c1; if (__c1 != __c2) return false; } } return true; } template<class _BinaryPredicate, class _RandomAccessIterator1, class _RandomAccessIterator2> bool __is_permutation(_RandomAccessIterator1 __first1, _RandomAccessIterator2 __last1, _RandomAccessIterator1 __first2, _RandomAccessIterator2 __last2, _BinaryPredicate __pred, random_access_iterator_tag, random_access_iterator_tag ) { if ( std::__1::distance(__first1, __last1) != std::__1::distance(__first2, __last2)) return false; return std::__1::is_permutation<_RandomAccessIterator1, _RandomAccessIterator2, typename add_lvalue_reference<_BinaryPredicate>::type> (__first1, __last1, __first2, __pred ); } template<class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred ) { return std::__1::__is_permutation<typename add_lvalue_reference<_BinaryPredicate>::type> (__first1, __last1, __first2, __last2, __pred, typename iterator_traits<_ForwardIterator1>::iterator_category(), typename iterator_traits<_ForwardIterator2>::iterator_category()); } template<class _ForwardIterator1, class _ForwardIterator2> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) { typedef typename iterator_traits<_ForwardIterator1>::value_type __v1; typedef typename iterator_traits<_ForwardIterator2>::value_type __v2; return std::__1::__is_permutation(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>(), typename iterator_traits<_ForwardIterator1>::iterator_category(), typename iterator_traits<_ForwardIterator2>::iterator_category()); } template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) _ForwardIterator1 search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred) { return std::__1::__search<typename add_lvalue_reference<_BinaryPredicate>::type> (__first1, __last1, __first2, __last2, __pred, typename iterator_traits<_ForwardIterator1>::iterator_category(), typename iterator_traits<_ForwardIterator2>::iterator_category()) .first; } template <class _ForwardIterator1, class _ForwardIterator2> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) _ForwardIterator1 search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2) { typedef typename iterator_traits<_ForwardIterator1>::value_type __v1; typedef typename iterator_traits<_ForwardIterator2>::value_type __v2; return std::__1::search(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>()); } template <class _BinaryPredicate, class _ForwardIterator, class _Size, class _Tp> _ForwardIterator __search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value_, _BinaryPredicate __pred, forward_iterator_tag) { if (__count <= 0) return __first; while (true) { while (true) { if (__first == __last) return __last; if (__pred(*__first, __value_)) break; ++__first; } _ForwardIterator __m = __first; _Size __c(0); while (true) { if (++__c == __count) return __first; if (++__m == __last) return __last; if (!__pred(*__m, __value_)) { __first = __m; ++__first; break; } } } } template <class _BinaryPredicate, class _RandomAccessIterator, class _Size, class _Tp> _RandomAccessIterator __search_n(_RandomAccessIterator __first, _RandomAccessIterator __last, _Size __count, const _Tp& __value_, _BinaryPredicate __pred, random_access_iterator_tag) { if (__count <= 0) return __first; _Size __len = static_cast<_Size>(__last - __first); if (__len < __count) return __last; const _RandomAccessIterator __s = __last - (__count - 1); while (true) { while (true) { if (__first >= __s) return __last; if (__pred(*__first, __value_)) break; ++__first; } _RandomAccessIterator __m = __first; _Size __c(0); while (true) { if (++__c == __count) return __first; ++__m; if (!__pred(*__m, __value_)) { __first = __m; ++__first; break; } } } } template <class _ForwardIterator, class _Size, class _Tp, class _BinaryPredicate> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) _ForwardIterator search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value_, _BinaryPredicate __pred) { return std::__1::__search_n<typename add_lvalue_reference<_BinaryPredicate>::type> (__first, __last, __convert_to_integral(__count), __value_, __pred, typename iterator_traits<_ForwardIterator>::iterator_category()); } template <class _ForwardIterator, class _Size, class _Tp> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) _ForwardIterator search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value_) { typedef typename iterator_traits<_ForwardIterator>::value_type __v; return std::__1::search_n(__first, __last, __convert_to_integral(__count), __value_, __equal_to<__v, _Tp>()); } template <class _Iter> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _Iter __unwrap_iter(_Iter __i) { return __i; } template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_trivially_copy_assignable<_Tp>::value, _Tp* >::type __unwrap_iter(move_iterator<_Tp*> __i) { return __i.base(); } template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename enable_if < is_trivially_copy_assignable<_Tp>::value, _Tp* >::type __unwrap_iter(__wrap_iter<_Tp*> __i) { return __i.base(); } template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename enable_if < is_trivially_copy_assignable<_Tp>::value, const _Tp* >::type __unwrap_iter(__wrap_iter<const _Tp*> __i) { return __i.base(); } template <class _InputIterator, class _OutputIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator __copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { for (; __first != __last; ++__first, (void) ++__result) *__result = *__first; return __result; } template <class _Tp, class _Up> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_same<typename remove_const<_Tp>::type, _Up>::value && is_trivially_copy_assignable<_Up>::value, _Up* >::type __copy(_Tp* __first, _Tp* __last, _Up* __result) { const size_t __n = static_cast<size_t>(__last - __first); if (__n > 0) std::__1::memmove(__result, __first, __n * sizeof(_Up)); return __result + __n; } template <class _InputIterator, class _OutputIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { return std::__1::__copy(__unwrap_iter(__first), __unwrap_iter(__last), __unwrap_iter(__result)); } template <class _BidirectionalIterator, class _OutputIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator __copy_backward(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result) { while (__first != __last) *--__result = *--__last; return __result; } template <class _Tp, class _Up> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_same<typename remove_const<_Tp>::type, _Up>::value && is_trivially_copy_assignable<_Up>::value, _Up* >::type __copy_backward(_Tp* __first, _Tp* __last, _Up* __result) { const size_t __n = static_cast<size_t>(__last - __first); if (__n > 0) { __result -= __n; std::__1::memmove(__result, __first, __n * sizeof(_Up)); } return __result; } template <class _BidirectionalIterator1, class _BidirectionalIterator2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _BidirectionalIterator2 copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, _BidirectionalIterator2 __result) { return std::__1::__copy_backward(__unwrap_iter(__first), __unwrap_iter(__last), __unwrap_iter(__result)); } template<class _InputIterator, class _OutputIterator, class _Predicate> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Predicate __pred) { for (; __first != __last; ++__first) { if (__pred(*__first)) { *__result = *__first; ++__result; } } return __result; } template<class _InputIterator, class _Size, class _OutputIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < __is_input_iterator<_InputIterator>::value && !__is_random_access_iterator<_InputIterator>::value, _OutputIterator >::type copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result) { typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize; _IntegralSize __n = __orig_n; if (__n > 0) { *__result = *__first; ++__result; for (--__n; __n > 0; --__n) { ++__first; *__result = *__first; ++__result; } } return __result; } template<class _InputIterator, class _Size, class _OutputIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < __is_random_access_iterator<_InputIterator>::value, _OutputIterator >::type copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result) { typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize; _IntegralSize __n = __orig_n; return std::__1::copy(__first, __first + __n, __result); } template <class _InputIterator, class _OutputIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator __move(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { for (; __first != __last; ++__first, (void) ++__result) *__result = std::__1::move(*__first); return __result; } template <class _Tp, class _Up> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_same<typename remove_const<_Tp>::type, _Up>::value && is_trivially_copy_assignable<_Up>::value, _Up* >::type __move(_Tp* __first, _Tp* __last, _Up* __result) { const size_t __n = static_cast<size_t>(__last - __first); if (__n > 0) std::__1::memmove(__result, __first, __n * sizeof(_Up)); return __result + __n; } template <class _InputIterator, class _OutputIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator move(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { return std::__1::__move(__unwrap_iter(__first), __unwrap_iter(__last), __unwrap_iter(__result)); } template <class _InputIterator, class _OutputIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator __move_backward(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { while (__first != __last) *--__result = std::__1::move(*--__last); return __result; } template <class _Tp, class _Up> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_same<typename remove_const<_Tp>::type, _Up>::value && is_trivially_copy_assignable<_Up>::value, _Up* >::type __move_backward(_Tp* __first, _Tp* __last, _Up* __result) { const size_t __n = static_cast<size_t>(__last - __first); if (__n > 0) { __result -= __n; std::__1::memmove(__result, __first, __n * sizeof(_Up)); } return __result; } template <class _BidirectionalIterator1, class _BidirectionalIterator2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _BidirectionalIterator2 move_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last, _BidirectionalIterator2 __result) { return std::__1::__move_backward(__unwrap_iter(__first), __unwrap_iter(__last), __unwrap_iter(__result)); } template <class _InputIterator, class _OutputIterator, class _UnaryOperation> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator transform(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _UnaryOperation __op) { for (; __first != __last; ++__first, (void) ++__result) *__result = __op(*__first); return __result; } template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _BinaryOperation> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator transform(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _OutputIterator __result, _BinaryOperation __binary_op) { for (; __first1 != __last1; ++__first1, (void) ++__first2, ++__result) *__result = __binary_op(*__first1, *__first2); return __result; } template <class _ForwardIterator, class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void replace(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value, const _Tp& __new_value) { for (; __first != __last; ++__first) if (*__first == __old_value) *__first = __new_value; } template <class _ForwardIterator, class _Predicate, class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void replace_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, const _Tp& __new_value) { for (; __first != __last; ++__first) if (__pred(*__first)) *__first = __new_value; } template <class _InputIterator, class _OutputIterator, class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator replace_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, const _Tp& __old_value, const _Tp& __new_value) { for (; __first != __last; ++__first, (void) ++__result) if (*__first == __old_value) *__result = __new_value; else *__result = *__first; return __result; } template <class _InputIterator, class _OutputIterator, class _Predicate, class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator replace_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Predicate __pred, const _Tp& __new_value) { for (; __first != __last; ++__first, (void) ++__result) if (__pred(*__first)) *__result = __new_value; else *__result = *__first; return __result; } template <class _OutputIterator, class _Size, class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator __fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_) { for (; __n > 0; ++__first, (void) --__n) *__first = __value_; return __first; } template <class _OutputIterator, class _Size, class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_) { return std::__1::__fill_n(__first, __convert_to_integral(__n), __value_); } template <class _ForwardIterator, class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, forward_iterator_tag) { for (; __first != __last; ++__first) *__first = __value_; } template <class _RandomAccessIterator, class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __value_, random_access_iterator_tag) { std::__1::fill_n(__first, __last - __first, __value_); } template <class _ForwardIterator, class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) { std::__1::__fill(__first, __last, __value_, typename iterator_traits<_ForwardIterator>::iterator_category()); } template <class _ForwardIterator, class _Generator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void generate(_ForwardIterator __first, _ForwardIterator __last, _Generator __gen) { for (; __first != __last; ++__first) *__first = __gen(); } template <class _OutputIterator, class _Size, class _Generator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator generate_n(_OutputIterator __first, _Size __orig_n, _Generator __gen) { typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize; _IntegralSize __n = __orig_n; for (; __n > 0; ++__first, (void) --__n) *__first = __gen(); return __first; } template <class _ForwardIterator, class _Tp> [[nodiscard]] _ForwardIterator remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) { __first = std::__1::find(__first, __last, __value_); if (__first != __last) { _ForwardIterator __i = __first; while (++__i != __last) { if (!(*__i == __value_)) { *__first = std::__1::move(*__i); ++__first; } } } return __first; } template <class _ForwardIterator, class _Predicate> [[nodiscard]] _ForwardIterator remove_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) { __first = std::__1::find_if<_ForwardIterator, typename add_lvalue_reference<_Predicate>::type> (__first, __last, __pred); if (__first != __last) { _ForwardIterator __i = __first; while (++__i != __last) { if (!__pred(*__i)) { *__first = std::__1::move(*__i); ++__first; } } } return __first; } template <class _InputIterator, class _OutputIterator, class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator remove_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, const _Tp& __value_) { for (; __first != __last; ++__first) { if (!(*__first == __value_)) { *__result = *__first; ++__result; } } return __result; } template <class _InputIterator, class _OutputIterator, class _Predicate> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator remove_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _Predicate __pred) { for (; __first != __last; ++__first) { if (!__pred(*__first)) { *__result = *__first; ++__result; } } return __result; } template <class _ForwardIterator, class _BinaryPredicate> [[nodiscard]] _ForwardIterator unique(_ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred) { __first = std::__1::adjacent_find<_ForwardIterator, typename add_lvalue_reference<_BinaryPredicate>::type> (__first, __last, __pred); if (__first != __last) { _ForwardIterator __i = __first; for (++__i; ++__i != __last;) if (!__pred(*__first, *__i)) *++__first = std::__1::move(*__i); ++__first; } return __first; } template <class _ForwardIterator> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) _ForwardIterator unique(_ForwardIterator __first, _ForwardIterator __last) { typedef typename iterator_traits<_ForwardIterator>::value_type __v; return std::__1::unique(__first, __last, __equal_to<__v>()); } template <class _BinaryPredicate, class _InputIterator, class _OutputIterator> _OutputIterator __unique_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryPredicate __pred, input_iterator_tag, output_iterator_tag) { if (__first != __last) { typename iterator_traits<_InputIterator>::value_type __t(*__first); *__result = __t; ++__result; while (++__first != __last) { if (!__pred(__t, *__first)) { __t = *__first; *__result = __t; ++__result; } } } return __result; } template <class _BinaryPredicate, class _ForwardIterator, class _OutputIterator> _OutputIterator __unique_copy(_ForwardIterator __first, _ForwardIterator __last, _OutputIterator __result, _BinaryPredicate __pred, forward_iterator_tag, output_iterator_tag) { if (__first != __last) { _ForwardIterator __i = __first; *__result = *__i; ++__result; while (++__first != __last) { if (!__pred(*__i, *__first)) { *__result = *__first; ++__result; __i = __first; } } } return __result; } template <class _BinaryPredicate, class _InputIterator, class _ForwardIterator> _ForwardIterator __unique_copy(_InputIterator __first, _InputIterator __last, _ForwardIterator __result, _BinaryPredicate __pred, input_iterator_tag, forward_iterator_tag) { if (__first != __last) { *__result = *__first; while (++__first != __last) if (!__pred(*__result, *__first)) *++__result = *__first; ++__result; } return __result; } template <class _InputIterator, class _OutputIterator, class _BinaryPredicate> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator unique_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryPredicate __pred) { return std::__1::__unique_copy<typename add_lvalue_reference<_BinaryPredicate>::type> (__first, __last, __result, __pred, typename iterator_traits<_InputIterator>::iterator_category(), typename iterator_traits<_OutputIterator>::iterator_category()); } template <class _InputIterator, class _OutputIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator unique_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { typedef typename iterator_traits<_InputIterator>::value_type __v; return std::__1::unique_copy(__first, __last, __result, __equal_to<__v>()); } template <class _BidirectionalIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __reverse(_BidirectionalIterator __first, _BidirectionalIterator __last, bidirectional_iterator_tag) { while (__first != __last) { if (__first == --__last) break; std::__1::iter_swap(__first, __last); ++__first; } } template <class _RandomAccessIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __reverse(_RandomAccessIterator __first, _RandomAccessIterator __last, random_access_iterator_tag) { if (__first != __last) for (; __first < --__last; ++__first) std::__1::iter_swap(__first, __last); } template <class _BidirectionalIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void reverse(_BidirectionalIterator __first, _BidirectionalIterator __last) { std::__1::__reverse(__first, __last, typename iterator_traits<_BidirectionalIterator>::iterator_category()); } template <class _BidirectionalIterator, class _OutputIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator reverse_copy(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result) { for (; __first != __last; ++__result) *__result = *--__last; return __result; } template <class _ForwardIterator> _ForwardIterator __rotate_left(_ForwardIterator __first, _ForwardIterator __last) { typedef typename iterator_traits<_ForwardIterator>::value_type value_type; value_type __tmp = std::__1::move(*__first); _ForwardIterator __lm1 = std::__1::move(std::__1::next(__first), __last, __first); *__lm1 = std::__1::move(__tmp); return __lm1; } template <class _BidirectionalIterator> _BidirectionalIterator __rotate_right(_BidirectionalIterator __first, _BidirectionalIterator __last) { typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type; _BidirectionalIterator __lm1 = std::__1::prev(__last); value_type __tmp = std::__1::move(*__lm1); _BidirectionalIterator __fp1 = std::__1::move_backward(__first, __lm1, __last); *__first = std::__1::move(__tmp); return __fp1; } template <class _ForwardIterator> _ForwardIterator __rotate_forward(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last) { _ForwardIterator __i = __middle; while (true) { swap(*__first, *__i); ++__first; if (++__i == __last) break; if (__first == __middle) __middle = __i; } _ForwardIterator __r = __first; if (__first != __middle) { __i = __middle; while (true) { swap(*__first, *__i); ++__first; if (++__i == __last) { if (__first == __middle) break; __i = __middle; } else if (__first == __middle) __middle = __i; } } return __r; } template<typename _Integral> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _Integral __algo_gcd(_Integral __x, _Integral __y) { do { _Integral __t = __x % __y; __x = __y; __y = __t; } while (__y); return __x; } template<typename _RandomAccessIterator> _RandomAccessIterator __rotate_gcd(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last) { typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; const difference_type __m1 = __middle - __first; const difference_type __m2 = __last - __middle; if (__m1 == __m2) { std::__1::swap_ranges(__first, __middle, __middle); return __middle; } const difference_type __g = std::__1::__algo_gcd(__m1, __m2); for (_RandomAccessIterator __p = __first + __g; __p != __first;) { value_type __t(std::__1::move(*--__p)); _RandomAccessIterator __p1 = __p; _RandomAccessIterator __p2 = __p1 + __m1; do { *__p1 = std::__1::move(*__p2); __p1 = __p2; const difference_type __d = __last - __p2; if (__m1 < __d) __p2 += __m1; else __p2 = __first + (__m1 - __d); } while (__p2 != __p); *__p1 = std::__1::move(__t); } return __first + __m2; } template <class _ForwardIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _ForwardIterator __rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, std::__1::forward_iterator_tag) { typedef typename std::__1::iterator_traits<_ForwardIterator>::value_type value_type; if (std::__1::is_trivially_move_assignable<value_type>::value) { if (std::__1::next(__first) == __middle) return std::__1::__rotate_left(__first, __last); } return std::__1::__rotate_forward(__first, __middle, __last); } template <class _BidirectionalIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _BidirectionalIterator __rotate(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last, std::__1::bidirectional_iterator_tag) { typedef typename std::__1::iterator_traits<_BidirectionalIterator>::value_type value_type; if (std::__1::is_trivially_move_assignable<value_type>::value) { if (std::__1::next(__first) == __middle) return std::__1::__rotate_left(__first, __last); if (std::__1::next(__middle) == __last) return std::__1::__rotate_right(__first, __last); } return std::__1::__rotate_forward(__first, __middle, __last); } template <class _RandomAccessIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _RandomAccessIterator __rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last, std::__1::random_access_iterator_tag) { typedef typename std::__1::iterator_traits<_RandomAccessIterator>::value_type value_type; if (std::__1::is_trivially_move_assignable<value_type>::value) { if (std::__1::next(__first) == __middle) return std::__1::__rotate_left(__first, __last); if (std::__1::next(__middle) == __last) return std::__1::__rotate_right(__first, __last); return std::__1::__rotate_gcd(__first, __middle, __last); } return std::__1::__rotate_forward(__first, __middle, __last); } template <class _ForwardIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _ForwardIterator rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last) { if (__first == __middle) return __last; if (__middle == __last) return __first; return std::__1::__rotate(__first, __middle, __last, typename std::__1::iterator_traits<_ForwardIterator>::iterator_category()); } template <class _ForwardIterator, class _OutputIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, _OutputIterator __result) { return std::__1::copy(__first, __middle, std::__1::copy(__middle, __last, __result)); } template <class _ForwardIterator, class _Compare> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _ForwardIterator min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) { static_assert(__is_forward_iterator<_ForwardIterator>::value, "std::min_element requires a ForwardIterator"); if (__first != __last) { _ForwardIterator __i = __first; while (++__i != __last) if (__comp(*__i, *__first)) __first = __i; } return __first; } template <class _ForwardIterator> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _ForwardIterator min_element(_ForwardIterator __first, _ForwardIterator __last) { return std::__1::min_element(__first, __last, __less<typename iterator_traits<_ForwardIterator>::value_type>()); } template <class _Tp, class _Compare> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const _Tp& min(const _Tp& __a, const _Tp& __b, _Compare __comp) { return __comp(__b, __a) ? __b : __a; } template <class _Tp> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const _Tp& min(const _Tp& __a, const _Tp& __b) { return std::__1::min(__a, __b, __less<_Tp>()); } template<class _Tp, class _Compare> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _Tp min(initializer_list<_Tp> __t, _Compare __comp) { return *std::__1::min_element(__t.begin(), __t.end(), __comp); } template<class _Tp> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _Tp min(initializer_list<_Tp> __t) { return *std::__1::min_element(__t.begin(), __t.end(), __less<_Tp>()); } template <class _ForwardIterator, class _Compare> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _ForwardIterator max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) { static_assert(__is_forward_iterator<_ForwardIterator>::value, "std::max_element requires a ForwardIterator"); if (__first != __last) { _ForwardIterator __i = __first; while (++__i != __last) if (__comp(*__first, *__i)) __first = __i; } return __first; } template <class _ForwardIterator> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _ForwardIterator max_element(_ForwardIterator __first, _ForwardIterator __last) { return std::__1::max_element(__first, __last, __less<typename iterator_traits<_ForwardIterator>::value_type>()); } template <class _Tp, class _Compare> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const _Tp& max(const _Tp& __a, const _Tp& __b, _Compare __comp) { return __comp(__a, __b) ? __b : __a; } template <class _Tp> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const _Tp& max(const _Tp& __a, const _Tp& __b) { return std::__1::max(__a, __b, __less<_Tp>()); } template<class _Tp, class _Compare> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _Tp max(initializer_list<_Tp> __t, _Compare __comp) { return *std::__1::max_element(__t.begin(), __t.end(), __comp); } template<class _Tp> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _Tp max(initializer_list<_Tp> __t) { return *std::__1::max_element(__t.begin(), __t.end(), __less<_Tp>()); } template <class _ForwardIterator, class _Compare> [[nodiscard]] constexpr std::pair<_ForwardIterator, _ForwardIterator> minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) { static_assert(__is_forward_iterator<_ForwardIterator>::value, "std::minmax_element requires a ForwardIterator"); std::pair<_ForwardIterator, _ForwardIterator> __result(__first, __first); if (__first != __last) { if (++__first != __last) { if (__comp(*__first, *__result.first)) __result.first = __first; else __result.second = __first; while (++__first != __last) { _ForwardIterator __i = __first; if (++__first == __last) { if (__comp(*__i, *__result.first)) __result.first = __i; else if (!__comp(*__i, *__result.second)) __result.second = __i; break; } else { if (__comp(*__first, *__i)) { if (__comp(*__first, *__result.first)) __result.first = __first; if (!__comp(*__i, *__result.second)) __result.second = __i; } else { if (__comp(*__i, *__result.first)) __result.first = __i; if (!__comp(*__first, *__result.second)) __result.second = __first; } } } } } return __result; } template <class _ForwardIterator> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr std::pair<_ForwardIterator, _ForwardIterator> minmax_element(_ForwardIterator __first, _ForwardIterator __last) { return std::__1::minmax_element(__first, __last, __less<typename iterator_traits<_ForwardIterator>::value_type>()); } template<class _Tp, class _Compare> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr pair<const _Tp&, const _Tp&> minmax(const _Tp& __a, const _Tp& __b, _Compare __comp) { return __comp(__b, __a) ? pair<const _Tp&, const _Tp&>(__b, __a) : pair<const _Tp&, const _Tp&>(__a, __b); } template<class _Tp> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr pair<const _Tp&, const _Tp&> minmax(const _Tp& __a, const _Tp& __b) { return std::__1::minmax(__a, __b, __less<_Tp>()); } template<class _Tp, class _Compare> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr pair<_Tp, _Tp> minmax(initializer_list<_Tp> __t, _Compare __comp) { typedef typename initializer_list<_Tp>::const_iterator _Iter; _Iter __first = __t.begin(); _Iter __last = __t.end(); std::pair<_Tp, _Tp> __result(*__first, *__first); ++__first; if (__t.size() % 2 == 0) { if (__comp(*__first, __result.first)) __result.first = *__first; else __result.second = *__first; ++__first; } while (__first != __last) { _Tp __prev = *__first++; if (__comp(*__first, __prev)) { if ( __comp(*__first, __result.first)) __result.first = *__first; if (!__comp(__prev, __result.second)) __result.second = __prev; } else { if ( __comp(__prev, __result.first)) __result.first = __prev; if (!__comp(*__first, __result.second)) __result.second = *__first; } __first++; } return __result; } template<class _Tp> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr pair<_Tp, _Tp> minmax(initializer_list<_Tp> __t) { return std::__1::minmax(__t, __less<_Tp>()); } template <unsigned long long _Xp, size_t _Rp> struct __log2_imp { static const size_t value = _Xp & ((unsigned long long)(1) << _Rp) ? _Rp : __log2_imp<_Xp, _Rp - 1>::value; }; template <unsigned long long _Xp> struct __log2_imp<_Xp, 0> { static const size_t value = 0; }; template <size_t _Rp> struct __log2_imp<0, _Rp> { static const size_t value = _Rp + 1; }; template <class _UIntType, _UIntType _Xp> struct __log2 { static const size_t value = __log2_imp<_Xp, sizeof(_UIntType) * 8 - 1>::value; }; template<class _Engine, class _UIntType> class __independent_bits_engine { public: typedef _UIntType result_type; private: typedef typename _Engine::result_type _Engine_result_type; typedef typename conditional < sizeof(_Engine_result_type) <= sizeof(result_type), result_type, _Engine_result_type >::type _Working_result_type; _Engine& __e_; size_t __w_; size_t __w0_; size_t __n_; size_t __n0_; _Working_result_type __y0_; _Working_result_type __y1_; _Engine_result_type __mask0_; _Engine_result_type __mask1_; static constexpr const _Working_result_type _Rp = _Engine::max() - _Engine::min() + _Working_result_type(1); static constexpr const size_t __m = __log2<_Working_result_type, _Rp>::value; static constexpr const size_t _WDt = numeric_limits<_Working_result_type>::digits; static constexpr const size_t _EDt = numeric_limits<_Engine_result_type>::digits; public: __independent_bits_engine(_Engine& __e, size_t __w); result_type operator()() {return __eval(integral_constant<bool, _Rp != 0>());} private: result_type __eval(false_type); result_type __eval(true_type); }; template<class _Engine, class _UIntType> __independent_bits_engine<_Engine, _UIntType> ::__independent_bits_engine(_Engine& __e, size_t __w) : __e_(__e), __w_(__w) { __n_ = __w_ / __m + (__w_ % __m != 0); __w0_ = __w_ / __n_; if (_Rp == 0) __y0_ = _Rp; else if (__w0_ < _WDt) __y0_ = (_Rp >> __w0_) << __w0_; else __y0_ = 0; if (_Rp - __y0_ > __y0_ / __n_) { ++__n_; __w0_ = __w_ / __n_; if (__w0_ < _WDt) __y0_ = (_Rp >> __w0_) << __w0_; else __y0_ = 0; } __n0_ = __n_ - __w_ % __n_; if (__w0_ < _WDt - 1) __y1_ = (_Rp >> (__w0_ + 1)) << (__w0_ + 1); else __y1_ = 0; __mask0_ = __w0_ > 0 ? _Engine_result_type(~0) >> (_EDt - __w0_) : _Engine_result_type(0); __mask1_ = __w0_ < _EDt - 1 ? _Engine_result_type(~0) >> (_EDt - (__w0_ + 1)) : _Engine_result_type(~0); } template<class _Engine, class _UIntType> inline _UIntType __independent_bits_engine<_Engine, _UIntType>::__eval(false_type) { return static_cast<result_type>(__e_() & __mask0_); } template<class _Engine, class _UIntType> _UIntType __independent_bits_engine<_Engine, _UIntType>::__eval(true_type) { const size_t _WRt = numeric_limits<result_type>::digits; result_type _Sp = 0; for (size_t __k = 0; __k < __n0_; ++__k) { _Engine_result_type __u; do { __u = __e_() - _Engine::min(); } while (__u >= __y0_); if (__w0_ < _WRt) _Sp <<= __w0_; else _Sp = 0; _Sp += __u & __mask0_; } for (size_t __k = __n0_; __k < __n_; ++__k) { _Engine_result_type __u; do { __u = __e_() - _Engine::min(); } while (__u >= __y1_); if (__w0_ < _WRt - 1) _Sp <<= __w0_ + 1; else _Sp = 0; _Sp += __u & __mask1_; } return _Sp; } template<class _IntType = int> class uniform_int_distribution { public: typedef _IntType result_type; class param_type { result_type __a_; result_type __b_; public: typedef uniform_int_distribution distribution_type; explicit param_type(result_type __a = 0, result_type __b = numeric_limits<result_type>::max()) : __a_(__a), __b_(__b) {} result_type a() const {return __a_;} result_type b() const {return __b_;} friend bool operator==(const param_type& __x, const param_type& __y) {return __x.__a_ == __y.__a_ && __x.__b_ == __y.__b_;} friend bool operator!=(const param_type& __x, const param_type& __y) {return !(__x == __y);} }; private: param_type __p_; public: explicit uniform_int_distribution(result_type __a = 0, result_type __b = numeric_limits<result_type>::max()) : __p_(param_type(__a, __b)) {} explicit uniform_int_distribution(const param_type& __p) : __p_(__p) {} void reset() {} template<class _URNG> result_type operator()(_URNG& __g) {return (*this)(__g, __p_);} template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p); result_type a() const {return __p_.a();} result_type b() const {return __p_.b();} param_type param() const {return __p_;} void param(const param_type& __p) {__p_ = __p;} result_type min() const {return a();} result_type max() const {return b();} friend bool operator==(const uniform_int_distribution& __x, const uniform_int_distribution& __y) {return __x.__p_ == __y.__p_;} friend bool operator!=(const uniform_int_distribution& __x, const uniform_int_distribution& __y) {return !(__x == __y);} }; template<class _IntType> template<class _URNG> typename uniform_int_distribution<_IntType>::result_type uniform_int_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p) __attribute__((__no_sanitize__("unsigned-integer-overflow"))) { typedef typename conditional<sizeof(result_type) <= sizeof(uint32_t), uint32_t, uint64_t>::type _UIntType; const _UIntType _Rp = _UIntType(__p.b()) - _UIntType(__p.a()) + _UIntType(1); if (_Rp == 1) return __p.a(); const size_t _Dt = numeric_limits<_UIntType>::digits; typedef __independent_bits_engine<_URNG, _UIntType> _Eng; if (_Rp == 0) return static_cast<result_type>(_Eng(__g, _Dt)()); size_t __w = _Dt - __libcpp_clz(_Rp) - 1; if ((_Rp & (std::numeric_limits<_UIntType>::max() >> (_Dt - __w))) != 0) ++__w; _Eng __e(__g, __w); _UIntType __u; do { __u = __e(); } while (__u >= _Rp); return static_cast<result_type>(__u + __p.a()); } class __rs_default; __rs_default __rs_get(); class __rs_default { static unsigned __c_; __rs_default(); public: typedef uint_fast32_t result_type; static const result_type _Min = 0; static const result_type _Max = 0xFFFFFFFF; __rs_default(const __rs_default&); ~__rs_default(); result_type operator()(); static constexpr result_type min() {return _Min;} static constexpr result_type max() {return _Max;} friend __rs_default __rs_get(); }; __rs_default __rs_get(); template <class _RandomAccessIterator> __attribute__ ((deprecated)) void random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last) { typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; typedef uniform_int_distribution<ptrdiff_t> _Dp; typedef typename _Dp::param_type _Pp; difference_type __d = __last - __first; if (__d > 1) { _Dp __uid; __rs_default __g = __rs_get(); for (--__last, (void) --__d; __first < __last; ++__first, (void) --__d) { difference_type __i = __uid(__g, _Pp(0, __d)); if (__i != difference_type(0)) swap(*__first, *(__first + __i)); } } } template <class _RandomAccessIterator, class _RandomNumberGenerator> __attribute__ ((deprecated)) void random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, _RandomNumberGenerator&& __rand) { typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; difference_type __d = __last - __first; if (__d > 1) { for (--__last; __first < __last; ++__first, (void) --__d) { difference_type __i = __rand(__d); if (__i != difference_type(0)) swap(*__first, *(__first + __i)); } } } template <class _PopulationIterator, class _SampleIterator, class _Distance, class _UniformRandomNumberGenerator> __attribute__ ((__exclude_from_explicit_instantiation__)) _SampleIterator __sample(_PopulationIterator __first, _PopulationIterator __last, _SampleIterator __output_iter, _Distance __n, _UniformRandomNumberGenerator & __g, input_iterator_tag) { _Distance __k = 0; for (; __first != __last && __k < __n; ++__first, (void) ++__k) __output_iter[__k] = *__first; _Distance __sz = __k; for (; __first != __last; ++__first, (void) ++__k) { _Distance __r = std::__1::uniform_int_distribution<_Distance>(0, __k)(__g); if (__r < __sz) __output_iter[__r] = *__first; } return __output_iter + std::__1::min(__n, __k); } template <class _PopulationIterator, class _SampleIterator, class _Distance, class _UniformRandomNumberGenerator> __attribute__ ((__exclude_from_explicit_instantiation__)) _SampleIterator __sample(_PopulationIterator __first, _PopulationIterator __last, _SampleIterator __output_iter, _Distance __n, _UniformRandomNumberGenerator& __g, forward_iterator_tag) { _Distance __unsampled_sz = std::__1::distance(__first, __last); for (__n = std::__1::min(__n, __unsampled_sz); __n != 0; ++__first) { _Distance __r = std::__1::uniform_int_distribution<_Distance>(0, --__unsampled_sz)(__g); if (__r < __n) { *__output_iter++ = *__first; --__n; } } return __output_iter; } template <class _PopulationIterator, class _SampleIterator, class _Distance, class _UniformRandomNumberGenerator> __attribute__ ((__exclude_from_explicit_instantiation__)) _SampleIterator __sample(_PopulationIterator __first, _PopulationIterator __last, _SampleIterator __output_iter, _Distance __n, _UniformRandomNumberGenerator& __g) { typedef typename iterator_traits<_PopulationIterator>::iterator_category _PopCategory; typedef typename iterator_traits<_PopulationIterator>::difference_type _Difference; static_assert(__is_forward_iterator<_PopulationIterator>::value || __is_random_access_iterator<_SampleIterator>::value, "SampleIterator must meet the requirements of RandomAccessIterator"); typedef typename common_type<_Distance, _Difference>::type _CommonType; ((void)0); return std::__1::__sample( __first, __last, __output_iter, _CommonType(__n), __g, _PopCategory()); } template<class _RandomAccessIterator, class _UniformRandomNumberGenerator> void shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, _UniformRandomNumberGenerator&& __g) { typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; typedef uniform_int_distribution<ptrdiff_t> _Dp; typedef typename _Dp::param_type _Pp; difference_type __d = __last - __first; if (__d > 1) { _Dp __uid; for (--__last, (void) --__d; __first < __last; ++__first, (void) --__d) { difference_type __i = __uid(__g, _Pp(0, __d)); if (__i != difference_type(0)) swap(*__first, *(__first + __i)); } } } template <class _InputIterator, class _Predicate> [[nodiscard]] bool is_partitioned(_InputIterator __first, _InputIterator __last, _Predicate __pred) { for (; __first != __last; ++__first) if (!__pred(*__first)) break; if ( __first == __last ) return true; ++__first; for (; __first != __last; ++__first) if (__pred(*__first)) return false; return true; } template <class _Predicate, class _ForwardIterator> _ForwardIterator __partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, forward_iterator_tag) { while (true) { if (__first == __last) return __first; if (!__pred(*__first)) break; ++__first; } for (_ForwardIterator __p = __first; ++__p != __last;) { if (__pred(*__p)) { swap(*__first, *__p); ++__first; } } return __first; } template <class _Predicate, class _BidirectionalIterator> _BidirectionalIterator __partition(_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred, bidirectional_iterator_tag) { while (true) { while (true) { if (__first == __last) return __first; if (!__pred(*__first)) break; ++__first; } do { if (__first == --__last) return __first; } while (!__pred(*__last)); swap(*__first, *__last); ++__first; } } template <class _ForwardIterator, class _Predicate> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _ForwardIterator partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) { return std::__1::__partition<typename add_lvalue_reference<_Predicate>::type> (__first, __last, __pred, typename iterator_traits<_ForwardIterator>::iterator_category()); } template <class _InputIterator, class _OutputIterator1, class _OutputIterator2, class _Predicate> pair<_OutputIterator1, _OutputIterator2> partition_copy(_InputIterator __first, _InputIterator __last, _OutputIterator1 __out_true, _OutputIterator2 __out_false, _Predicate __pred) { for (; __first != __last; ++__first) { if (__pred(*__first)) { *__out_true = *__first; ++__out_true; } else { *__out_false = *__first; ++__out_false; } } return pair<_OutputIterator1, _OutputIterator2>(__out_true, __out_false); } template<class _ForwardIterator, class _Predicate> _ForwardIterator partition_point(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) { typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type; difference_type __len = std::__1::distance(__first, __last); while (__len != 0) { difference_type __l2 = std::__1::__half_positive(__len); _ForwardIterator __m = __first; std::__1::advance(__m, __l2); if (__pred(*__m)) { __first = ++__m; __len -= __l2 + 1; } else __len = __l2; } return __first; } template <class _Predicate, class _ForwardIterator, class _Distance, class _Pair> _ForwardIterator __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, _Distance __len, _Pair __p, forward_iterator_tag __fit) { if (__len == 1) return __first; if (__len == 2) { _ForwardIterator __m = __first; if (__pred(*++__m)) { swap(*__first, *__m); return __m; } return __first; } if (__len <= __p.second) { typedef typename iterator_traits<_ForwardIterator>::value_type value_type; __destruct_n __d(0); unique_ptr<value_type, __destruct_n&> __h(__p.first, __d); value_type* __t = __p.first; ::new(__t) value_type(std::__1::move(*__first)); __d.__incr((value_type*)0); ++__t; _ForwardIterator __i = __first; while (++__i != __last) { if (__pred(*__i)) { *__first = std::__1::move(*__i); ++__first; } else { ::new(__t) value_type(std::__1::move(*__i)); __d.__incr((value_type*)0); ++__t; } } __i = __first; for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, (void) ++__i) *__i = std::__1::move(*__t2); return __first; } _ForwardIterator __m = __first; _Distance __len2 = __len / 2; std::__1::advance(__m, __len2); typedef typename add_lvalue_reference<_Predicate>::type _PredRef; _ForwardIterator __first_false = __stable_partition<_PredRef>(__first, __m, __pred, __len2, __p, __fit); _ForwardIterator __m1 = __m; _ForwardIterator __second_false = __last; _Distance __len_half = __len - __len2; while (__pred(*__m1)) { if (++__m1 == __last) goto __second_half_done; --__len_half; } __second_false = __stable_partition<_PredRef>(__m1, __last, __pred, __len_half, __p, __fit); __second_half_done: return std::__1::rotate(__first_false, __m, __second_false); } struct __return_temporary_buffer { template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) void operator()(_Tp* __p) const {std::__1::return_temporary_buffer(__p);} }; template <class _Predicate, class _ForwardIterator> _ForwardIterator __stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, forward_iterator_tag) { const unsigned __alloc_limit = 3; while (true) { if (__first == __last) return __first; if (!__pred(*__first)) break; ++__first; } typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type; typedef typename iterator_traits<_ForwardIterator>::value_type value_type; difference_type __len = std::__1::distance(__first, __last); pair<value_type*, ptrdiff_t> __p(0, 0); unique_ptr<value_type, __return_temporary_buffer> __h; if (__len >= __alloc_limit) { __p = std::__1::get_temporary_buffer<value_type>(__len); __h.reset(__p.first); } return __stable_partition<typename add_lvalue_reference<_Predicate>::type> (__first, __last, __pred, __len, __p, forward_iterator_tag()); } template <class _Predicate, class _BidirectionalIterator, class _Distance, class _Pair> _BidirectionalIterator __stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred, _Distance __len, _Pair __p, bidirectional_iterator_tag __bit) { if (__len == 2) { swap(*__first, *__last); return __last; } if (__len == 3) { _BidirectionalIterator __m = __first; if (__pred(*++__m)) { swap(*__first, *__m); swap(*__m, *__last); return __last; } swap(*__m, *__last); swap(*__first, *__m); return __m; } if (__len <= __p.second) { typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type; __destruct_n __d(0); unique_ptr<value_type, __destruct_n&> __h(__p.first, __d); value_type* __t = __p.first; ::new(__t) value_type(std::__1::move(*__first)); __d.__incr((value_type*)0); ++__t; _BidirectionalIterator __i = __first; while (++__i != __last) { if (__pred(*__i)) { *__first = std::__1::move(*__i); ++__first; } else { ::new(__t) value_type(std::__1::move(*__i)); __d.__incr((value_type*)0); ++__t; } } *__first = std::__1::move(*__i); __i = ++__first; for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, (void) ++__i) *__i = std::__1::move(*__t2); return __first; } _BidirectionalIterator __m = __first; _Distance __len2 = __len / 2; std::__1::advance(__m, __len2); _BidirectionalIterator __m1 = __m; _BidirectionalIterator __first_false = __first; _Distance __len_half = __len2; while (!__pred(*--__m1)) { if (__m1 == __first) goto __first_half_done; --__len_half; } typedef typename add_lvalue_reference<_Predicate>::type _PredRef; __first_false = __stable_partition<_PredRef>(__first, __m1, __pred, __len_half, __p, __bit); __first_half_done: __m1 = __m; _BidirectionalIterator __second_false = __last; ++__second_false; __len_half = __len - __len2; while (__pred(*__m1)) { if (++__m1 == __last) goto __second_half_done; --__len_half; } __second_false = __stable_partition<_PredRef>(__m1, __last, __pred, __len_half, __p, __bit); __second_half_done: return std::__1::rotate(__first_false, __m, __second_false); } template <class _Predicate, class _BidirectionalIterator> _BidirectionalIterator __stable_partition(_BidirectionalIterator __first, _BidirectionalIterator __last, _Predicate __pred, bidirectional_iterator_tag) { typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type; typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type; const difference_type __alloc_limit = 4; while (true) { if (__first == __last) return __first; if (!__pred(*__first)) break; ++__first; } do { if (__first == --__last) return __first; } while (!__pred(*__last)); difference_type __len = std::__1::distance(__first, __last) + 1; pair<value_type*, ptrdiff_t> __p(0, 0); unique_ptr<value_type, __return_temporary_buffer> __h; if (__len >= __alloc_limit) { __p = std::__1::get_temporary_buffer<value_type>(__len); __h.reset(__p.first); } return __stable_partition<typename add_lvalue_reference<_Predicate>::type> (__first, __last, __pred, __len, __p, bidirectional_iterator_tag()); } template <class _ForwardIterator, class _Predicate> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _ForwardIterator stable_partition(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) { return __stable_partition<typename add_lvalue_reference<_Predicate>::type> (__first, __last, __pred, typename iterator_traits<_ForwardIterator>::iterator_category()); } template <class _ForwardIterator, class _Compare> [[nodiscard]] _ForwardIterator is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) { if (__first != __last) { _ForwardIterator __i = __first; while (++__i != __last) { if (__comp(*__i, *__first)) return __i; __first = __i; } } return __last; } template<class _ForwardIterator> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) _ForwardIterator is_sorted_until(_ForwardIterator __first, _ForwardIterator __last) { return std::__1::is_sorted_until(__first, __last, __less<typename iterator_traits<_ForwardIterator>::value_type>()); } template <class _ForwardIterator, class _Compare> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_sorted(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) { return std::__1::is_sorted_until(__first, __last, __comp) == __last; } template<class _ForwardIterator> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_sorted(_ForwardIterator __first, _ForwardIterator __last) { return std::__1::is_sorted(__first, __last, __less<typename iterator_traits<_ForwardIterator>::value_type>()); } template <class _Compare, class _ForwardIterator> unsigned __sort3(_ForwardIterator __x, _ForwardIterator __y, _ForwardIterator __z, _Compare __c) { unsigned __r = 0; if (!__c(*__y, *__x)) { if (!__c(*__z, *__y)) return __r; swap(*__y, *__z); __r = 1; if (__c(*__y, *__x)) { swap(*__x, *__y); __r = 2; } return __r; } if (__c(*__z, *__y)) { swap(*__x, *__z); __r = 1; return __r; } swap(*__x, *__y); __r = 1; if (__c(*__z, *__y)) { swap(*__y, *__z); __r = 2; } return __r; } template <class _Compare, class _ForwardIterator> unsigned __sort4(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3, _ForwardIterator __x4, _Compare __c) { unsigned __r = __sort3<_Compare>(__x1, __x2, __x3, __c); if (__c(*__x4, *__x3)) { swap(*__x3, *__x4); ++__r; if (__c(*__x3, *__x2)) { swap(*__x2, *__x3); ++__r; if (__c(*__x2, *__x1)) { swap(*__x1, *__x2); ++__r; } } } return __r; } template <class _Compare, class _ForwardIterator> unsigned __sort5(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3, _ForwardIterator __x4, _ForwardIterator __x5, _Compare __c) { unsigned __r = __sort4<_Compare>(__x1, __x2, __x3, __x4, __c); if (__c(*__x5, *__x4)) { swap(*__x4, *__x5); ++__r; if (__c(*__x4, *__x3)) { swap(*__x3, *__x4); ++__r; if (__c(*__x3, *__x2)) { swap(*__x2, *__x3); ++__r; if (__c(*__x2, *__x1)) { swap(*__x1, *__x2); ++__r; } } } } return __r; } template <class _Compare, class _BirdirectionalIterator> void __selection_sort(_BirdirectionalIterator __first, _BirdirectionalIterator __last, _Compare __comp) { _BirdirectionalIterator __lm1 = __last; for (--__lm1; __first != __lm1; ++__first) { _BirdirectionalIterator __i = std::__1::min_element<_BirdirectionalIterator, typename add_lvalue_reference<_Compare>::type> (__first, __last, __comp); if (__i != __first) swap(*__first, *__i); } } template <class _Compare, class _BirdirectionalIterator> void __insertion_sort(_BirdirectionalIterator __first, _BirdirectionalIterator __last, _Compare __comp) { typedef typename iterator_traits<_BirdirectionalIterator>::value_type value_type; if (__first != __last) { _BirdirectionalIterator __i = __first; for (++__i; __i != __last; ++__i) { _BirdirectionalIterator __j = __i; value_type __t(std::__1::move(*__j)); for (_BirdirectionalIterator __k = __i; __k != __first && __comp(__t, *--__k); --__j) *__j = std::__1::move(*__k); *__j = std::__1::move(__t); } } } template <class _Compare, class _RandomAccessIterator> void __insertion_sort_3(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; _RandomAccessIterator __j = __first+2; __sort3<_Compare>(__first, __first+1, __j, __comp); for (_RandomAccessIterator __i = __j+1; __i != __last; ++__i) { if (__comp(*__i, *__j)) { value_type __t(std::__1::move(*__i)); _RandomAccessIterator __k = __j; __j = __i; do { *__j = std::__1::move(*__k); __j = __k; } while (__j != __first && __comp(__t, *--__k)); *__j = std::__1::move(__t); } __j = __i; } } template <class _Compare, class _RandomAccessIterator> bool __insertion_sort_incomplete(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { switch (__last - __first) { case 0: case 1: return true; case 2: if (__comp(*--__last, *__first)) swap(*__first, *__last); return true; case 3: std::__1::__sort3<_Compare>(__first, __first+1, --__last, __comp); return true; case 4: std::__1::__sort4<_Compare>(__first, __first+1, __first+2, --__last, __comp); return true; case 5: std::__1::__sort5<_Compare>(__first, __first+1, __first+2, __first+3, --__last, __comp); return true; } typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; _RandomAccessIterator __j = __first+2; __sort3<_Compare>(__first, __first+1, __j, __comp); const unsigned __limit = 8; unsigned __count = 0; for (_RandomAccessIterator __i = __j+1; __i != __last; ++__i) { if (__comp(*__i, *__j)) { value_type __t(std::__1::move(*__i)); _RandomAccessIterator __k = __j; __j = __i; do { *__j = std::__1::move(*__k); __j = __k; } while (__j != __first && __comp(__t, *--__k)); *__j = std::__1::move(__t); if (++__count == __limit) return ++__i == __last; } __j = __i; } return true; } template <class _Compare, class _BirdirectionalIterator> void __insertion_sort_move(_BirdirectionalIterator __first1, _BirdirectionalIterator __last1, typename iterator_traits<_BirdirectionalIterator>::value_type* __first2, _Compare __comp) { typedef typename iterator_traits<_BirdirectionalIterator>::value_type value_type; if (__first1 != __last1) { __destruct_n __d(0); unique_ptr<value_type, __destruct_n&> __h(__first2, __d); value_type* __last2 = __first2; ::new(__last2) value_type(std::__1::move(*__first1)); __d.__incr((value_type*)0); for (++__last2; ++__first1 != __last1; ++__last2) { value_type* __j2 = __last2; value_type* __i2 = __j2; if (__comp(*__first1, *--__i2)) { ::new(__j2) value_type(std::__1::move(*__i2)); __d.__incr((value_type*)0); for (--__j2; __i2 != __first2 && __comp(*__first1, *--__i2); --__j2) *__j2 = std::__1::move(*__i2); *__j2 = std::__1::move(*__first1); } else { ::new(__j2) value_type(std::__1::move(*__first1)); __d.__incr((value_type*)0); } } __h.release(); } } template <class _Compare, class _RandomAccessIterator> void __sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; const difference_type __limit = is_trivially_copy_constructible<value_type>::value && is_trivially_copy_assignable<value_type>::value ? 30 : 6; while (true) { __restart: difference_type __len = __last - __first; switch (__len) { case 0: case 1: return; case 2: if (__comp(*--__last, *__first)) swap(*__first, *__last); return; case 3: std::__1::__sort3<_Compare>(__first, __first+1, --__last, __comp); return; case 4: std::__1::__sort4<_Compare>(__first, __first+1, __first+2, --__last, __comp); return; case 5: std::__1::__sort5<_Compare>(__first, __first+1, __first+2, __first+3, --__last, __comp); return; } if (__len <= __limit) { std::__1::__insertion_sort_3<_Compare>(__first, __last, __comp); return; } _RandomAccessIterator __m = __first; _RandomAccessIterator __lm1 = __last; --__lm1; unsigned __n_swaps; { difference_type __delta; if (__len >= 1000) { __delta = __len/2; __m += __delta; __delta /= 2; __n_swaps = std::__1::__sort5<_Compare>(__first, __first + __delta, __m, __m+__delta, __lm1, __comp); } else { __delta = __len/2; __m += __delta; __n_swaps = std::__1::__sort3<_Compare>(__first, __m, __lm1, __comp); } } _RandomAccessIterator __i = __first; _RandomAccessIterator __j = __lm1; if (!__comp(*__i, *__m)) { while (true) { if (__i == --__j) { ++__i; __j = __last; if (!__comp(*__first, *--__j)) { while (true) { if (__i == __j) return; if (__comp(*__first, *__i)) { swap(*__i, *__j); ++__n_swaps; ++__i; break; } ++__i; } } if (__i == __j) return; while (true) { while (!__comp(*__first, *__i)) ++__i; while (__comp(*__first, *--__j)) ; if (__i >= __j) break; swap(*__i, *__j); ++__n_swaps; ++__i; } __first = __i; goto __restart; } if (__comp(*__j, *__m)) { swap(*__i, *__j); ++__n_swaps; break; } } } ++__i; if (__i < __j) { while (true) { while (__comp(*__i, *__m)) ++__i; while (!__comp(*--__j, *__m)) ; if (__i > __j) break; swap(*__i, *__j); ++__n_swaps; if (__m == __i) __m = __j; ++__i; } } if (__i != __m && __comp(*__m, *__i)) { swap(*__i, *__m); ++__n_swaps; } if (__n_swaps == 0) { bool __fs = std::__1::__insertion_sort_incomplete<_Compare>(__first, __i, __comp); if (std::__1::__insertion_sort_incomplete<_Compare>(__i+1, __last, __comp)) { if (__fs) return; __last = __i; continue; } else { if (__fs) { __first = ++__i; continue; } } } if (__i - __first < __last - __i) { std::__1::__sort<_Compare>(__first, __i, __comp); __first = ++__i; } else { std::__1::__sort<_Compare>(__i+1, __last, __comp); __last = __i; } } } template <class _RandomAccessIterator, class _Compare> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { typedef typename __comp_ref_type<_Compare>::type _Comp_ref; std::__1::__sort<_Comp_ref>(__first, __last, _Comp_ref(__comp)); } template <class _RandomAccessIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void sort(_RandomAccessIterator __first, _RandomAccessIterator __last) { std::__1::sort(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>()); } template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void sort(_Tp** __first, _Tp** __last) { std::__1::sort((size_t*)__first, (size_t*)__last, __less<size_t>()); } template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void sort(__wrap_iter<_Tp*> __first, __wrap_iter<_Tp*> __last) { std::__1::sort(__first.base(), __last.base()); } template <class _Tp, class _Compare> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void sort(__wrap_iter<_Tp*> __first, __wrap_iter<_Tp*> __last, _Compare __comp) { typedef typename add_lvalue_reference<_Compare>::type _Comp_ref; std::__1::sort<_Tp*, _Comp_ref>(__first.base(), __last.base(), __comp); } extern template void __sort<__less<char>&, char*>(char*, char*, __less<char>&); extern template void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&); extern template void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&); extern template void __sort<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&); extern template void __sort<__less<short>&, short*>(short*, short*, __less<short>&); extern template void __sort<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&); extern template void __sort<__less<int>&, int*>(int*, int*, __less<int>&); extern template void __sort<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&); extern template void __sort<__less<long>&, long*>(long*, long*, __less<long>&); extern template void __sort<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&); extern template void __sort<__less<long long>&, long long*>(long long*, long long*, __less<long long>&); extern template void __sort<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&); extern template void __sort<__less<float>&, float*>(float*, float*, __less<float>&); extern template void __sort<__less<double>&, double*>(double*, double*, __less<double>&); extern template void __sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&); extern template bool __insertion_sort_incomplete<__less<char>&, char*>(char*, char*, __less<char>&); extern template bool __insertion_sort_incomplete<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&); extern template bool __insertion_sort_incomplete<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&); extern template bool __insertion_sort_incomplete<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&); extern template bool __insertion_sort_incomplete<__less<short>&, short*>(short*, short*, __less<short>&); extern template bool __insertion_sort_incomplete<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&); extern template bool __insertion_sort_incomplete<__less<int>&, int*>(int*, int*, __less<int>&); extern template bool __insertion_sort_incomplete<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&); extern template bool __insertion_sort_incomplete<__less<long>&, long*>(long*, long*, __less<long>&); extern template bool __insertion_sort_incomplete<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&); extern template bool __insertion_sort_incomplete<__less<long long>&, long long*>(long long*, long long*, __less<long long>&); extern template bool __insertion_sort_incomplete<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&); extern template bool __insertion_sort_incomplete<__less<float>&, float*>(float*, float*, __less<float>&); extern template bool __insertion_sort_incomplete<__less<double>&, double*>(double*, double*, __less<double>&); extern template bool __insertion_sort_incomplete<__less<long double>&, long double*>(long double*, long double*, __less<long double>&); extern template unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&); template <class _Compare, class _ForwardIterator, class _Tp> _ForwardIterator __lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) { typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type; difference_type __len = std::__1::distance(__first, __last); while (__len != 0) { difference_type __l2 = std::__1::__half_positive(__len); _ForwardIterator __m = __first; std::__1::advance(__m, __l2); if (__comp(*__m, __value_)) { __first = ++__m; __len -= __l2 + 1; } else __len = __l2; } return __first; } template <class _ForwardIterator, class _Tp, class _Compare> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) _ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) { typedef typename add_lvalue_reference<_Compare>::type _Comp_ref; return __lower_bound<_Comp_ref>(__first, __last, __value_, __comp); } template <class _ForwardIterator, class _Tp> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) _ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) { return std::__1::lower_bound(__first, __last, __value_, __less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>()); } template <class _Compare, class _ForwardIterator, class _Tp> _ForwardIterator __upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) { typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type; difference_type __len = std::__1::distance(__first, __last); while (__len != 0) { difference_type __l2 = std::__1::__half_positive(__len); _ForwardIterator __m = __first; std::__1::advance(__m, __l2); if (__comp(__value_, *__m)) __len = __l2; else { __first = ++__m; __len -= __l2 + 1; } } return __first; } template <class _ForwardIterator, class _Tp, class _Compare> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) _ForwardIterator upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) { typedef typename add_lvalue_reference<_Compare>::type _Comp_ref; return __upper_bound<_Comp_ref>(__first, __last, __value_, __comp); } template <class _ForwardIterator, class _Tp> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) _ForwardIterator upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) { return std::__1::upper_bound(__first, __last, __value_, __less<_Tp, typename iterator_traits<_ForwardIterator>::value_type>()); } template <class _Compare, class _ForwardIterator, class _Tp> pair<_ForwardIterator, _ForwardIterator> __equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) { typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type; difference_type __len = std::__1::distance(__first, __last); while (__len != 0) { difference_type __l2 = std::__1::__half_positive(__len); _ForwardIterator __m = __first; std::__1::advance(__m, __l2); if (__comp(*__m, __value_)) { __first = ++__m; __len -= __l2 + 1; } else if (__comp(__value_, *__m)) { __last = __m; __len = __l2; } else { _ForwardIterator __mp1 = __m; return pair<_ForwardIterator, _ForwardIterator> ( __lower_bound<_Compare>(__first, __m, __value_, __comp), __upper_bound<_Compare>(++__mp1, __last, __value_, __comp) ); } } return pair<_ForwardIterator, _ForwardIterator>(__first, __first); } template <class _ForwardIterator, class _Tp, class _Compare> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) pair<_ForwardIterator, _ForwardIterator> equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) { typedef typename __comp_ref_type<_Compare>::type _Comp_ref; return __equal_range<_Comp_ref>(__first, __last, __value_, __comp); } template <class _ForwardIterator, class _Tp> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) pair<_ForwardIterator, _ForwardIterator> equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) { return std::__1::equal_range(__first, __last, __value_, __less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>()); } template <class _Compare, class _ForwardIterator, class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool __binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) { __first = __lower_bound<_Compare>(__first, __last, __value_, __comp); return __first != __last && !__comp(__value_, *__first); } template <class _ForwardIterator, class _Tp, class _Compare> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) { typedef typename __comp_ref_type<_Compare>::type _Comp_ref; return __binary_search<_Comp_ref>(__first, __last, __value_, __comp); } template <class _ForwardIterator, class _Tp> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) { return std::__1::binary_search(__first, __last, __value_, __less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>()); } template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator> _OutputIterator __merge(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) { for (; __first1 != __last1; ++__result) { if (__first2 == __last2) return std::__1::copy(__first1, __last1, __result); if (__comp(*__first2, *__first1)) { *__result = *__first2; ++__first2; } else { *__result = *__first1; ++__first1; } } return std::__1::copy(__first2, __last2, __result); } template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator merge(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) { typedef typename __comp_ref_type<_Compare>::type _Comp_ref; return std::__1::__merge<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp); } template <class _InputIterator1, class _InputIterator2, class _OutputIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator merge(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result) { typedef typename iterator_traits<_InputIterator1>::value_type __v1; typedef typename iterator_traits<_InputIterator2>::value_type __v2; return std::__1::merge(__first1, __last1, __first2, __last2, __result, __less<__v1, __v2>()); } template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator> void __half_inplace_merge(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) { for (; __first1 != __last1; ++__result) { if (__first2 == __last2) { std::__1::move(__first1, __last1, __result); return; } if (__comp(*__first2, *__first1)) { *__result = std::__1::move(*__first2); ++__first2; } else { *__result = std::__1::move(*__first1); ++__first1; } } } template <class _Compare, class _BidirectionalIterator> void __buffered_inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last, _Compare __comp, typename iterator_traits<_BidirectionalIterator>::difference_type __len1, typename iterator_traits<_BidirectionalIterator>::difference_type __len2, typename iterator_traits<_BidirectionalIterator>::value_type* __buff) { typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type; __destruct_n __d(0); unique_ptr<value_type, __destruct_n&> __h2(__buff, __d); if (__len1 <= __len2) { value_type* __p = __buff; for (_BidirectionalIterator __i = __first; __i != __middle; __d.__incr((value_type*)0), (void) ++__i, (void) ++__p) ::new(__p) value_type(std::__1::move(*__i)); __half_inplace_merge(__buff, __p, __middle, __last, __first, __comp); } else { value_type* __p = __buff; for (_BidirectionalIterator __i = __middle; __i != __last; __d.__incr((value_type*)0), (void) ++__i, (void) ++__p) ::new(__p) value_type(std::__1::move(*__i)); typedef reverse_iterator<_BidirectionalIterator> _RBi; typedef reverse_iterator<value_type*> _Rv; __half_inplace_merge(_Rv(__p), _Rv(__buff), _RBi(__middle), _RBi(__first), _RBi(__last), __invert<_Compare>(__comp)); } } template <class _Compare, class _BidirectionalIterator> void __inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last, _Compare __comp, typename iterator_traits<_BidirectionalIterator>::difference_type __len1, typename iterator_traits<_BidirectionalIterator>::difference_type __len2, typename iterator_traits<_BidirectionalIterator>::value_type* __buff, ptrdiff_t __buff_size) { typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type; while (true) { if (__len2 == 0) return; if (__len1 <= __buff_size || __len2 <= __buff_size) return __buffered_inplace_merge<_Compare> (__first, __middle, __last, __comp, __len1, __len2, __buff); for (; true; ++__first, (void) --__len1) { if (__len1 == 0) return; if (__comp(*__middle, *__first)) break; } _BidirectionalIterator __m1; _BidirectionalIterator __m2; difference_type __len11; difference_type __len21; if (__len1 < __len2) { __len21 = __len2 / 2; __m2 = __middle; std::__1::advance(__m2, __len21); __m1 = __upper_bound<_Compare>(__first, __middle, *__m2, __comp); __len11 = std::__1::distance(__first, __m1); } else { if (__len1 == 1) { swap(*__first, *__middle); return; } __len11 = __len1 / 2; __m1 = __first; std::__1::advance(__m1, __len11); __m2 = __lower_bound<_Compare>(__middle, __last, *__m1, __comp); __len21 = std::__1::distance(__middle, __m2); } difference_type __len12 = __len1 - __len11; difference_type __len22 = __len2 - __len21; __middle = std::__1::rotate(__m1, __middle, __m2); if (__len11 + __len21 < __len12 + __len22) { __inplace_merge<_Compare>(__first, __m1, __middle, __comp, __len11, __len21, __buff, __buff_size); __first = __middle; __middle = __m2; __len1 = __len12; __len2 = __len22; } else { __inplace_merge<_Compare>(__middle, __m2, __last, __comp, __len12, __len22, __buff, __buff_size); __last = __middle; __middle = __m1; __len1 = __len11; __len2 = __len21; } } } template <class _BidirectionalIterator, class _Compare> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last, _Compare __comp) { typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type; typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type; difference_type __len1 = std::__1::distance(__first, __middle); difference_type __len2 = std::__1::distance(__middle, __last); difference_type __buf_size = std::__1::min(__len1, __len2); pair<value_type*, ptrdiff_t> __buf = std::__1::get_temporary_buffer<value_type>(__buf_size); unique_ptr<value_type, __return_temporary_buffer> __h(__buf.first); typedef typename __comp_ref_type<_Compare>::type _Comp_ref; return std::__1::__inplace_merge<_Comp_ref>(__first, __middle, __last, __comp, __len1, __len2, __buf.first, __buf.second); } template <class _BidirectionalIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last) { std::__1::inplace_merge(__first, __middle, __last, __less<typename iterator_traits<_BidirectionalIterator>::value_type>()); } template <class _Compare, class _InputIterator1, class _InputIterator2> void __merge_move_construct(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, typename iterator_traits<_InputIterator1>::value_type* __result, _Compare __comp) { typedef typename iterator_traits<_InputIterator1>::value_type value_type; __destruct_n __d(0); unique_ptr<value_type, __destruct_n&> __h(__result, __d); for (; true; ++__result) { if (__first1 == __last1) { for (; __first2 != __last2; ++__first2, ++__result, (void) __d.__incr((value_type*)0)) ::new (__result) value_type(std::__1::move(*__first2)); __h.release(); return; } if (__first2 == __last2) { for (; __first1 != __last1; ++__first1, ++__result, (void) __d.__incr((value_type*)0)) ::new (__result) value_type(std::__1::move(*__first1)); __h.release(); return; } if (__comp(*__first2, *__first1)) { ::new (__result) value_type(std::__1::move(*__first2)); __d.__incr((value_type*)0); ++__first2; } else { ::new (__result) value_type(std::__1::move(*__first1)); __d.__incr((value_type*)0); ++__first1; } } } template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator> void __merge_move_assign(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) { for (; __first1 != __last1; ++__result) { if (__first2 == __last2) { for (; __first1 != __last1; ++__first1, (void) ++__result) *__result = std::__1::move(*__first1); return; } if (__comp(*__first2, *__first1)) { *__result = std::__1::move(*__first2); ++__first2; } else { *__result = std::__1::move(*__first1); ++__first1; } } for (; __first2 != __last2; ++__first2, (void) ++__result) *__result = std::__1::move(*__first2); } template <class _Compare, class _RandomAccessIterator> void __stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp, typename iterator_traits<_RandomAccessIterator>::difference_type __len, typename iterator_traits<_RandomAccessIterator>::value_type* __buff, ptrdiff_t __buff_size); template <class _Compare, class _RandomAccessIterator> void __stable_sort_move(_RandomAccessIterator __first1, _RandomAccessIterator __last1, _Compare __comp, typename iterator_traits<_RandomAccessIterator>::difference_type __len, typename iterator_traits<_RandomAccessIterator>::value_type* __first2) { typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; switch (__len) { case 0: return; case 1: ::new(__first2) value_type(std::__1::move(*__first1)); return; case 2: __destruct_n __d(0); unique_ptr<value_type, __destruct_n&> __h2(__first2, __d); if (__comp(*--__last1, *__first1)) { ::new(__first2) value_type(std::__1::move(*__last1)); __d.__incr((value_type*)0); ++__first2; ::new(__first2) value_type(std::__1::move(*__first1)); } else { ::new(__first2) value_type(std::__1::move(*__first1)); __d.__incr((value_type*)0); ++__first2; ::new(__first2) value_type(std::__1::move(*__last1)); } __h2.release(); return; } if (__len <= 8) { __insertion_sort_move<_Compare>(__first1, __last1, __first2, __comp); return; } typename iterator_traits<_RandomAccessIterator>::difference_type __l2 = __len / 2; _RandomAccessIterator __m = __first1 + __l2; __stable_sort<_Compare>(__first1, __m, __comp, __l2, __first2, __l2); __stable_sort<_Compare>(__m, __last1, __comp, __len - __l2, __first2 + __l2, __len - __l2); __merge_move_construct<_Compare>(__first1, __m, __m, __last1, __first2, __comp); } template <class _Tp> struct __stable_sort_switch { static const unsigned value = 128*is_trivially_copy_assignable<_Tp>::value; }; template <class _Compare, class _RandomAccessIterator> void __stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp, typename iterator_traits<_RandomAccessIterator>::difference_type __len, typename iterator_traits<_RandomAccessIterator>::value_type* __buff, ptrdiff_t __buff_size) { typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; switch (__len) { case 0: case 1: return; case 2: if (__comp(*--__last, *__first)) swap(*__first, *__last); return; } if (__len <= static_cast<difference_type>(__stable_sort_switch<value_type>::value)) { __insertion_sort<_Compare>(__first, __last, __comp); return; } typename iterator_traits<_RandomAccessIterator>::difference_type __l2 = __len / 2; _RandomAccessIterator __m = __first + __l2; if (__len <= __buff_size) { __destruct_n __d(0); unique_ptr<value_type, __destruct_n&> __h2(__buff, __d); __stable_sort_move<_Compare>(__first, __m, __comp, __l2, __buff); __d.__set(__l2, (value_type*)0); __stable_sort_move<_Compare>(__m, __last, __comp, __len - __l2, __buff + __l2); __d.__set(__len, (value_type*)0); __merge_move_assign<_Compare>(__buff, __buff + __l2, __buff + __l2, __buff + __len, __first, __comp); return; } __stable_sort<_Compare>(__first, __m, __comp, __l2, __buff, __buff_size); __stable_sort<_Compare>(__m, __last, __comp, __len - __l2, __buff, __buff_size); __inplace_merge<_Compare>(__first, __m, __last, __comp, __l2, __len - __l2, __buff, __buff_size); } template <class _RandomAccessIterator, class _Compare> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; difference_type __len = __last - __first; pair<value_type*, ptrdiff_t> __buf(0, 0); unique_ptr<value_type, __return_temporary_buffer> __h; if (__len > static_cast<difference_type>(__stable_sort_switch<value_type>::value)) { __buf = std::__1::get_temporary_buffer<value_type>(__len); __h.reset(__buf.first); } typedef typename __comp_ref_type<_Compare>::type _Comp_ref; __stable_sort<_Comp_ref>(__first, __last, __comp, __len, __buf.first, __buf.second); } template <class _RandomAccessIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last) { std::__1::stable_sort(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>()); } template <class _RandomAccessIterator, class _Compare> [[nodiscard]] _RandomAccessIterator is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { typedef typename std::__1::iterator_traits<_RandomAccessIterator>::difference_type difference_type; difference_type __len = __last - __first; difference_type __p = 0; difference_type __c = 1; _RandomAccessIterator __pp = __first; while (__c < __len) { _RandomAccessIterator __cp = __first + __c; if (__comp(*__pp, *__cp)) return __cp; ++__c; ++__cp; if (__c == __len) return __last; if (__comp(*__pp, *__cp)) return __cp; ++__p; ++__pp; __c = 2 * __p + 1; } return __last; } template<class _RandomAccessIterator> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) _RandomAccessIterator is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last) { return std::__1::is_heap_until(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>()); } template <class _RandomAccessIterator, class _Compare> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { return std::__1::is_heap_until(__first, __last, __comp) == __last; } template<class _RandomAccessIterator> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) { return std::__1::is_heap(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>()); } template <class _Compare, class _RandomAccessIterator> void __sift_up(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp, typename iterator_traits<_RandomAccessIterator>::difference_type __len) { typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; if (__len > 1) { __len = (__len - 2) / 2; _RandomAccessIterator __ptr = __first + __len; if (__comp(*__ptr, *--__last)) { value_type __t(std::__1::move(*__last)); do { *__last = std::__1::move(*__ptr); __last = __ptr; if (__len == 0) break; __len = (__len - 1) / 2; __ptr = __first + __len; } while (__comp(*__ptr, __t)); *__last = std::__1::move(__t); } } } template <class _RandomAccessIterator, class _Compare> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { typedef typename __comp_ref_type<_Compare>::type _Comp_ref; __sift_up<_Comp_ref>(__first, __last, __comp, __last - __first); } template <class _RandomAccessIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) { std::__1::push_heap(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>()); } template <class _Compare, class _RandomAccessIterator> void __sift_down(_RandomAccessIterator __first, _RandomAccessIterator , _Compare __comp, typename iterator_traits<_RandomAccessIterator>::difference_type __len, _RandomAccessIterator __start) { typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; difference_type __child = __start - __first; if (__len < 2 || (__len - 2) / 2 < __child) return; __child = 2 * __child + 1; _RandomAccessIterator __child_i = __first + __child; if ((__child + 1) < __len && __comp(*__child_i, *(__child_i + 1))) { ++__child_i; ++__child; } if (__comp(*__child_i, *__start)) return; value_type __top(std::__1::move(*__start)); do { *__start = std::__1::move(*__child_i); __start = __child_i; if ((__len - 2) / 2 < __child) break; __child = 2 * __child + 1; __child_i = __first + __child; if ((__child + 1) < __len && __comp(*__child_i, *(__child_i + 1))) { ++__child_i; ++__child; } } while (!__comp(*__child_i, __top)); *__start = std::__1::move(__top); } template <class _Compare, class _RandomAccessIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp, typename iterator_traits<_RandomAccessIterator>::difference_type __len) { if (__len > 1) { swap(*__first, *--__last); __sift_down<_Compare>(__first, __last, __comp, __len - 1, __first); } } template <class _RandomAccessIterator, class _Compare> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { typedef typename __comp_ref_type<_Compare>::type _Comp_ref; __pop_heap<_Comp_ref>(__first, __last, __comp, __last - __first); } template <class _RandomAccessIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) { std::__1::pop_heap(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>()); } template <class _Compare, class _RandomAccessIterator> void __make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; difference_type __n = __last - __first; if (__n > 1) { for (difference_type __start = (__n - 2) / 2; __start >= 0; --__start) { __sift_down<_Compare>(__first, __last, __comp, __n, __first + __start); } } } template <class _RandomAccessIterator, class _Compare> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { typedef typename __comp_ref_type<_Compare>::type _Comp_ref; __make_heap<_Comp_ref>(__first, __last, __comp); } template <class _RandomAccessIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) { std::__1::make_heap(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>()); } template <class _Compare, class _RandomAccessIterator> void __sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; for (difference_type __n = __last - __first; __n > 1; --__last, (void) --__n) __pop_heap<_Compare>(__first, __last, __comp, __n); } template <class _RandomAccessIterator, class _Compare> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { typedef typename __comp_ref_type<_Compare>::type _Comp_ref; __sort_heap<_Comp_ref>(__first, __last, __comp); } template <class _RandomAccessIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) { std::__1::sort_heap(__first, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>()); } template <class _Compare, class _RandomAccessIterator> void __partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last, _Compare __comp) { __make_heap<_Compare>(__first, __middle, __comp); typename iterator_traits<_RandomAccessIterator>::difference_type __len = __middle - __first; for (_RandomAccessIterator __i = __middle; __i != __last; ++__i) { if (__comp(*__i, *__first)) { swap(*__i, *__first); __sift_down<_Compare>(__first, __middle, __comp, __len, __first); } } __sort_heap<_Compare>(__first, __middle, __comp); } template <class _RandomAccessIterator, class _Compare> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last, _Compare __comp) { typedef typename __comp_ref_type<_Compare>::type _Comp_ref; __partial_sort<_Comp_ref>(__first, __middle, __last, __comp); } template <class _RandomAccessIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last) { std::__1::partial_sort(__first, __middle, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>()); } template <class _Compare, class _InputIterator, class _RandomAccessIterator> _RandomAccessIterator __partial_sort_copy(_InputIterator __first, _InputIterator __last, _RandomAccessIterator __result_first, _RandomAccessIterator __result_last, _Compare __comp) { _RandomAccessIterator __r = __result_first; if (__r != __result_last) { for (; __first != __last && __r != __result_last; ++__first, (void) ++__r) *__r = *__first; __make_heap<_Compare>(__result_first, __r, __comp); typename iterator_traits<_RandomAccessIterator>::difference_type __len = __r - __result_first; for (; __first != __last; ++__first) if (__comp(*__first, *__result_first)) { *__result_first = *__first; __sift_down<_Compare>(__result_first, __r, __comp, __len, __result_first); } __sort_heap<_Compare>(__result_first, __r, __comp); } return __r; } template <class _InputIterator, class _RandomAccessIterator, class _Compare> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _RandomAccessIterator partial_sort_copy(_InputIterator __first, _InputIterator __last, _RandomAccessIterator __result_first, _RandomAccessIterator __result_last, _Compare __comp) { typedef typename __comp_ref_type<_Compare>::type _Comp_ref; return __partial_sort_copy<_Comp_ref>(__first, __last, __result_first, __result_last, __comp); } template <class _InputIterator, class _RandomAccessIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _RandomAccessIterator partial_sort_copy(_InputIterator __first, _InputIterator __last, _RandomAccessIterator __result_first, _RandomAccessIterator __result_last) { return std::__1::partial_sort_copy(__first, __last, __result_first, __result_last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>()); } template <class _Compare, class _RandomAccessIterator> void __nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp) { typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; const difference_type __limit = 7; while (true) { __restart: if (__nth == __last) return; difference_type __len = __last - __first; switch (__len) { case 0: case 1: return; case 2: if (__comp(*--__last, *__first)) swap(*__first, *__last); return; case 3: { _RandomAccessIterator __m = __first; std::__1::__sort3<_Compare>(__first, ++__m, --__last, __comp); return; } } if (__len <= __limit) { __selection_sort<_Compare>(__first, __last, __comp); return; } _RandomAccessIterator __m = __first + __len/2; _RandomAccessIterator __lm1 = __last; unsigned __n_swaps = std::__1::__sort3<_Compare>(__first, __m, --__lm1, __comp); _RandomAccessIterator __i = __first; _RandomAccessIterator __j = __lm1; if (!__comp(*__i, *__m)) { while (true) { if (__i == --__j) { ++__i; __j = __last; if (!__comp(*__first, *--__j)) { while (true) { if (__i == __j) return; if (__comp(*__first, *__i)) { swap(*__i, *__j); ++__n_swaps; ++__i; break; } ++__i; } } if (__i == __j) return; while (true) { while (!__comp(*__first, *__i)) ++__i; while (__comp(*__first, *--__j)) ; if (__i >= __j) break; swap(*__i, *__j); ++__n_swaps; ++__i; } if (__nth < __i) return; __first = __i; goto __restart; } if (__comp(*__j, *__m)) { swap(*__i, *__j); ++__n_swaps; break; } } } ++__i; if (__i < __j) { while (true) { while (__comp(*__i, *__m)) ++__i; while (!__comp(*--__j, *__m)) ; if (__i >= __j) break; swap(*__i, *__j); ++__n_swaps; if (__m == __i) __m = __j; ++__i; } } if (__i != __m && __comp(*__m, *__i)) { swap(*__i, *__m); ++__n_swaps; } if (__nth == __i) return; if (__n_swaps == 0) { if (__nth < __i) { __j = __m = __first; while (++__j != __i) { if (__comp(*__j, *__m)) goto not_sorted; __m = __j; } return; } else { __j = __m = __i; while (++__j != __last) { if (__comp(*__j, *__m)) goto not_sorted; __m = __j; } return; } } not_sorted: if (__nth < __i) { __last = __i; } else { __first = ++__i; } } } template <class _RandomAccessIterator, class _Compare> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp) { typedef typename __comp_ref_type<_Compare>::type _Comp_ref; __nth_element<_Comp_ref>(__first, __nth, __last, __comp); } template <class _RandomAccessIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last) { std::__1::nth_element(__first, __nth, __last, __less<typename iterator_traits<_RandomAccessIterator>::value_type>()); } template <class _Compare, class _InputIterator1, class _InputIterator2> bool __includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp) { for (; __first2 != __last2; ++__first1) { if (__first1 == __last1 || __comp(*__first2, *__first1)) return false; if (!__comp(*__first1, *__first2)) ++__first2; } return true; } template <class _InputIterator1, class _InputIterator2, class _Compare> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp) { typedef typename __comp_ref_type<_Compare>::type _Comp_ref; return __includes<_Comp_ref>(__first1, __last1, __first2, __last2, __comp); } template <class _InputIterator1, class _InputIterator2> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) { return std::__1::includes(__first1, __last1, __first2, __last2, __less<typename iterator_traits<_InputIterator1>::value_type, typename iterator_traits<_InputIterator2>::value_type>()); } template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator> _OutputIterator __set_union(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) { for (; __first1 != __last1; ++__result) { if (__first2 == __last2) return std::__1::copy(__first1, __last1, __result); if (__comp(*__first2, *__first1)) { *__result = *__first2; ++__first2; } else { if (!__comp(*__first1, *__first2)) ++__first2; *__result = *__first1; ++__first1; } } return std::__1::copy(__first2, __last2, __result); } template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator set_union(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) { typedef typename __comp_ref_type<_Compare>::type _Comp_ref; return __set_union<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp); } template <class _InputIterator1, class _InputIterator2, class _OutputIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator set_union(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result) { return std::__1::set_union(__first1, __last1, __first2, __last2, __result, __less<typename iterator_traits<_InputIterator1>::value_type, typename iterator_traits<_InputIterator2>::value_type>()); } template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator> _OutputIterator __set_intersection(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) { while (__first1 != __last1 && __first2 != __last2) { if (__comp(*__first1, *__first2)) ++__first1; else { if (!__comp(*__first2, *__first1)) { *__result = *__first1; ++__result; ++__first1; } ++__first2; } } return __result; } template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator set_intersection(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) { typedef typename __comp_ref_type<_Compare>::type _Comp_ref; return __set_intersection<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp); } template <class _InputIterator1, class _InputIterator2, class _OutputIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator set_intersection(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result) { return std::__1::set_intersection(__first1, __last1, __first2, __last2, __result, __less<typename iterator_traits<_InputIterator1>::value_type, typename iterator_traits<_InputIterator2>::value_type>()); } template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator> _OutputIterator __set_difference(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) { while (__first1 != __last1) { if (__first2 == __last2) return std::__1::copy(__first1, __last1, __result); if (__comp(*__first1, *__first2)) { *__result = *__first1; ++__result; ++__first1; } else { if (!__comp(*__first2, *__first1)) ++__first1; ++__first2; } } return __result; } template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator set_difference(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) { typedef typename __comp_ref_type<_Compare>::type _Comp_ref; return __set_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp); } template <class _InputIterator1, class _InputIterator2, class _OutputIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator set_difference(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result) { return std::__1::set_difference(__first1, __last1, __first2, __last2, __result, __less<typename iterator_traits<_InputIterator1>::value_type, typename iterator_traits<_InputIterator2>::value_type>()); } template <class _Compare, class _InputIterator1, class _InputIterator2, class _OutputIterator> _OutputIterator __set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) { while (__first1 != __last1) { if (__first2 == __last2) return std::__1::copy(__first1, __last1, __result); if (__comp(*__first1, *__first2)) { *__result = *__first1; ++__result; ++__first1; } else { if (__comp(*__first2, *__first1)) { *__result = *__first2; ++__result; } else ++__first1; ++__first2; } } return std::__1::copy(__first2, __last2, __result); } template <class _InputIterator1, class _InputIterator2, class _OutputIterator, class _Compare> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp) { typedef typename __comp_ref_type<_Compare>::type _Comp_ref; return __set_symmetric_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp); } template <class _InputIterator1, class _InputIterator2, class _OutputIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result) { return std::__1::set_symmetric_difference(__first1, __last1, __first2, __last2, __result, __less<typename iterator_traits<_InputIterator1>::value_type, typename iterator_traits<_InputIterator2>::value_type>()); } template <class _Compare, class _InputIterator1, class _InputIterator2> bool __lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp) { for (; __first2 != __last2; ++__first1, (void) ++__first2) { if (__first1 == __last1 || __comp(*__first1, *__first2)) return true; if (__comp(*__first2, *__first1)) return false; } return false; } template <class _InputIterator1, class _InputIterator2, class _Compare> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp) { typedef typename __comp_ref_type<_Compare>::type _Comp_ref; return __lexicographical_compare<_Comp_ref>(__first1, __last1, __first2, __last2, __comp); } template <class _InputIterator1, class _InputIterator2> [[nodiscard]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) { return std::__1::lexicographical_compare(__first1, __last1, __first2, __last2, __less<typename iterator_traits<_InputIterator1>::value_type, typename iterator_traits<_InputIterator2>::value_type>()); } template <class _Compare, class _BidirectionalIterator> bool __next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) { _BidirectionalIterator __i = __last; if (__first == __last || __first == --__i) return false; while (true) { _BidirectionalIterator __ip1 = __i; if (__comp(*--__i, *__ip1)) { _BidirectionalIterator __j = __last; while (!__comp(*__i, *--__j)) ; swap(*__i, *__j); std::__1::reverse(__ip1, __last); return true; } if (__i == __first) { std::__1::reverse(__first, __last); return false; } } } template <class _BidirectionalIterator, class _Compare> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) { typedef typename __comp_ref_type<_Compare>::type _Comp_ref; return __next_permutation<_Comp_ref>(__first, __last, __comp); } template <class _BidirectionalIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last) { return std::__1::next_permutation(__first, __last, __less<typename iterator_traits<_BidirectionalIterator>::value_type>()); } template <class _Compare, class _BidirectionalIterator> bool __prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) { _BidirectionalIterator __i = __last; if (__first == __last || __first == --__i) return false; while (true) { _BidirectionalIterator __ip1 = __i; if (__comp(*__ip1, *--__i)) { _BidirectionalIterator __j = __last; while (!__comp(*--__j, *__i)) ; swap(*__i, *__j); std::__1::reverse(__ip1, __last); return true; } if (__i == __first) { std::__1::reverse(__first, __last); return false; } } } template <class _BidirectionalIterator, class _Compare> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp) { typedef typename __comp_ref_type<_Compare>::type _Comp_ref; return __prev_permutation<_Comp_ref>(__first, __last, __comp); } template <class _BidirectionalIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last) { return std::__1::prev_permutation(__first, __last, __less<typename iterator_traits<_BidirectionalIterator>::value_type>()); } } } namespace std { inline namespace __1 { template <class _Cp, bool _IsConst, typename _Cp::__storage_type = 0> class __bit_iterator; template <class _Cp> class __bit_const_reference; template <class _Tp> struct __has_storage_type { static const bool value = false; }; template <class _Cp, bool = __has_storage_type<_Cp>::value> class __bit_reference { typedef typename _Cp::__storage_type __storage_type; typedef typename _Cp::__storage_pointer __storage_pointer; __storage_pointer __seg_; __storage_type __mask_; friend typename _Cp::__self; friend class __bit_const_reference<_Cp>; friend class __bit_iterator<_Cp, false>; public: __attribute__ ((__exclude_from_explicit_instantiation__)) operator bool() const noexcept {return static_cast<bool>(*__seg_ & __mask_);} __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator ~() const noexcept {return !static_cast<bool>(*this);} __attribute__ ((__exclude_from_explicit_instantiation__)) __bit_reference& operator=(bool __x) noexcept { if (__x) *__seg_ |= __mask_; else *__seg_ &= ~__mask_; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __bit_reference& operator=(const __bit_reference& __x) noexcept {return operator=(static_cast<bool>(__x));} __attribute__ ((__exclude_from_explicit_instantiation__)) void flip() noexcept {*__seg_ ^= __mask_;} __attribute__ ((__exclude_from_explicit_instantiation__)) __bit_iterator<_Cp, false> operator&() const noexcept {return __bit_iterator<_Cp, false>(__seg_, static_cast<unsigned>(__libcpp_ctz(__mask_)));} private: __attribute__ ((__exclude_from_explicit_instantiation__)) __bit_reference(__storage_pointer __s, __storage_type __m) noexcept : __seg_(__s), __mask_(__m) {} }; template <class _Cp> class __bit_reference<_Cp, false> { }; template <class _Cp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(__bit_reference<_Cp> __x, __bit_reference<_Cp> __y) noexcept { bool __t = __x; __x = __y; __y = __t; } template <class _Cp, class _Dp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(__bit_reference<_Cp> __x, __bit_reference<_Dp> __y) noexcept { bool __t = __x; __x = __y; __y = __t; } template <class _Cp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(__bit_reference<_Cp> __x, bool& __y) noexcept { bool __t = __x; __x = __y; __y = __t; } template <class _Cp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(bool& __x, __bit_reference<_Cp> __y) noexcept { bool __t = __x; __x = __y; __y = __t; } template <class _Cp> class __bit_const_reference { typedef typename _Cp::__storage_type __storage_type; typedef typename _Cp::__const_storage_pointer __storage_pointer; __storage_pointer __seg_; __storage_type __mask_; friend typename _Cp::__self; friend class __bit_iterator<_Cp, true>; public: __attribute__ ((__exclude_from_explicit_instantiation__)) __bit_const_reference(const __bit_reference<_Cp>& __x) noexcept : __seg_(__x.__seg_), __mask_(__x.__mask_) {} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr operator bool() const noexcept {return static_cast<bool>(*__seg_ & __mask_);} __attribute__ ((__exclude_from_explicit_instantiation__)) __bit_iterator<_Cp, true> operator&() const noexcept {return __bit_iterator<_Cp, true>(__seg_, static_cast<unsigned>(__libcpp_ctz(__mask_)));} private: __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __bit_const_reference(__storage_pointer __s, __storage_type __m) noexcept : __seg_(__s), __mask_(__m) {} __bit_const_reference& operator=(const __bit_const_reference& __x); }; template <class _Cp, bool _IsConst> __bit_iterator<_Cp, _IsConst> __find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) { typedef __bit_iterator<_Cp, _IsConst> _It; typedef typename _It::__storage_type __storage_type; static const int __bits_per_word = _It::__bits_per_word; if (__first.__ctz_ != 0) { __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); __storage_type __dn = std::__1::min(__clz_f, __n); __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); __storage_type __b = *__first.__seg_ & __m; if (__b) return _It(__first.__seg_, static_cast<unsigned>(std::__1::__libcpp_ctz(__b))); if (__n == __dn) return __first + __n; __n -= __dn; ++__first.__seg_; } for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word) if (*__first.__seg_) return _It(__first.__seg_, static_cast<unsigned>(std::__1::__libcpp_ctz(*__first.__seg_))); if (__n > 0) { __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); __storage_type __b = *__first.__seg_ & __m; if (__b) return _It(__first.__seg_, static_cast<unsigned>(std::__1::__libcpp_ctz(__b))); } return _It(__first.__seg_, static_cast<unsigned>(__n)); } template <class _Cp, bool _IsConst> __bit_iterator<_Cp, _IsConst> __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) { typedef __bit_iterator<_Cp, _IsConst> _It; typedef typename _It::__storage_type __storage_type; const int __bits_per_word = _It::__bits_per_word; if (__first.__ctz_ != 0) { __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); __storage_type __dn = std::__1::min(__clz_f, __n); __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); __storage_type __b = ~*__first.__seg_ & __m; if (__b) return _It(__first.__seg_, static_cast<unsigned>(std::__1::__libcpp_ctz(__b))); if (__n == __dn) return __first + __n; __n -= __dn; ++__first.__seg_; } for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word) { __storage_type __b = ~*__first.__seg_; if (__b) return _It(__first.__seg_, static_cast<unsigned>(std::__1::__libcpp_ctz(__b))); } if (__n > 0) { __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); __storage_type __b = ~*__first.__seg_ & __m; if (__b) return _It(__first.__seg_, static_cast<unsigned>(std::__1::__libcpp_ctz(__b))); } return _It(__first.__seg_, static_cast<unsigned>(__n)); } template <class _Cp, bool _IsConst, class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) __bit_iterator<_Cp, _IsConst> find(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_) { if (static_cast<bool>(__value_)) return __find_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first)); return __find_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first)); } template <class _Cp, bool _IsConst> typename __bit_iterator<_Cp, _IsConst>::difference_type __count_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) { typedef __bit_iterator<_Cp, _IsConst> _It; typedef typename _It::__storage_type __storage_type; typedef typename _It::difference_type difference_type; const int __bits_per_word = _It::__bits_per_word; difference_type __r = 0; if (__first.__ctz_ != 0) { __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); __storage_type __dn = std::__1::min(__clz_f, __n); __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); __r = std::__1::__libcpp_popcount(*__first.__seg_ & __m); __n -= __dn; ++__first.__seg_; } for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word) __r += std::__1::__libcpp_popcount(*__first.__seg_); if (__n > 0) { __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); __r += std::__1::__libcpp_popcount(*__first.__seg_ & __m); } return __r; } template <class _Cp, bool _IsConst> typename __bit_iterator<_Cp, _IsConst>::difference_type __count_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) { typedef __bit_iterator<_Cp, _IsConst> _It; typedef typename _It::__storage_type __storage_type; typedef typename _It::difference_type difference_type; const int __bits_per_word = _It::__bits_per_word; difference_type __r = 0; if (__first.__ctz_ != 0) { __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); __storage_type __dn = std::__1::min(__clz_f, __n); __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); __r = std::__1::__libcpp_popcount(~*__first.__seg_ & __m); __n -= __dn; ++__first.__seg_; } for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word) __r += std::__1::__libcpp_popcount(~*__first.__seg_); if (__n > 0) { __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); __r += std::__1::__libcpp_popcount(~*__first.__seg_ & __m); } return __r; } template <class _Cp, bool _IsConst, class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename __bit_iterator<_Cp, _IsConst>::difference_type count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_) { if (static_cast<bool>(__value_)) return __count_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first)); return __count_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first)); } template <class _Cp> void __fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) { typedef __bit_iterator<_Cp, false> _It; typedef typename _It::__storage_type __storage_type; const int __bits_per_word = _It::__bits_per_word; if (__first.__ctz_ != 0) { __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); __storage_type __dn = std::__1::min(__clz_f, __n); __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); *__first.__seg_ &= ~__m; __n -= __dn; ++__first.__seg_; } __storage_type __nw = __n / __bits_per_word; std::__1::memset(std::__1::__to_raw_pointer(__first.__seg_), 0, __nw * sizeof(__storage_type)); __n -= __nw * __bits_per_word; if (__n > 0) { __first.__seg_ += __nw; __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); *__first.__seg_ &= ~__m; } } template <class _Cp> void __fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) { typedef __bit_iterator<_Cp, false> _It; typedef typename _It::__storage_type __storage_type; const int __bits_per_word = _It::__bits_per_word; if (__first.__ctz_ != 0) { __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); __storage_type __dn = std::__1::min(__clz_f, __n); __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); *__first.__seg_ |= __m; __n -= __dn; ++__first.__seg_; } __storage_type __nw = __n / __bits_per_word; std::__1::memset(std::__1::__to_raw_pointer(__first.__seg_), -1, __nw * sizeof(__storage_type)); __n -= __nw * __bits_per_word; if (__n > 0) { __first.__seg_ += __nw; __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); *__first.__seg_ |= __m; } } template <class _Cp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n, bool __value_) { if (__n > 0) { if (__value_) __fill_n_true(__first, __n); else __fill_n_false(__first, __n); } } template <class _Cp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void fill(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, bool __value_) { std::__1::fill_n(__first, static_cast<typename _Cp::size_type>(__last - __first), __value_); } template <class _Cp, bool _IsConst> __bit_iterator<_Cp, false> __copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) { typedef __bit_iterator<_Cp, _IsConst> _In; typedef typename _In::difference_type difference_type; typedef typename _In::__storage_type __storage_type; const int __bits_per_word = _In::__bits_per_word; difference_type __n = __last - __first; if (__n > 0) { if (__first.__ctz_ != 0) { unsigned __clz = __bits_per_word - __first.__ctz_; difference_type __dn = std::__1::min(static_cast<difference_type>(__clz), __n); __n -= __dn; __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz - __dn)); __storage_type __b = *__first.__seg_ & __m; *__result.__seg_ &= ~__m; *__result.__seg_ |= __b; __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word; __result.__ctz_ = static_cast<unsigned>((__dn + __result.__ctz_) % __bits_per_word); ++__first.__seg_; } __storage_type __nw = __n / __bits_per_word; std::__1::memmove(std::__1::__to_raw_pointer(__result.__seg_), std::__1::__to_raw_pointer(__first.__seg_), __nw * sizeof(__storage_type)); __n -= __nw * __bits_per_word; __result.__seg_ += __nw; if (__n > 0) { __first.__seg_ += __nw; __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); __storage_type __b = *__first.__seg_ & __m; *__result.__seg_ &= ~__m; *__result.__seg_ |= __b; __result.__ctz_ = static_cast<unsigned>(__n); } } return __result; } template <class _Cp, bool _IsConst> __bit_iterator<_Cp, false> __copy_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) { typedef __bit_iterator<_Cp, _IsConst> _In; typedef typename _In::difference_type difference_type; typedef typename _In::__storage_type __storage_type; static const int __bits_per_word = _In::__bits_per_word; difference_type __n = __last - __first; if (__n > 0) { if (__first.__ctz_ != 0) { unsigned __clz_f = __bits_per_word - __first.__ctz_; difference_type __dn = std::__1::min(static_cast<difference_type>(__clz_f), __n); __n -= __dn; __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); __storage_type __b = *__first.__seg_ & __m; unsigned __clz_r = __bits_per_word - __result.__ctz_; __storage_type __ddn = std::__1::min<__storage_type>(__dn, __clz_r); __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn)); *__result.__seg_ &= ~__m; if (__result.__ctz_ > __first.__ctz_) *__result.__seg_ |= __b << (__result.__ctz_ - __first.__ctz_); else *__result.__seg_ |= __b >> (__first.__ctz_ - __result.__ctz_); __result.__seg_ += (__ddn + __result.__ctz_) / __bits_per_word; __result.__ctz_ = static_cast<unsigned>((__ddn + __result.__ctz_) % __bits_per_word); __dn -= __ddn; if (__dn > 0) { __m = ~__storage_type(0) >> (__bits_per_word - __dn); *__result.__seg_ &= ~__m; *__result.__seg_ |= __b >> (__first.__ctz_ + __ddn); __result.__ctz_ = static_cast<unsigned>(__dn); } ++__first.__seg_; } unsigned __clz_r = __bits_per_word - __result.__ctz_; __storage_type __m = ~__storage_type(0) << __result.__ctz_; for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first.__seg_) { __storage_type __b = *__first.__seg_; *__result.__seg_ &= ~__m; *__result.__seg_ |= __b << __result.__ctz_; ++__result.__seg_; *__result.__seg_ &= __m; *__result.__seg_ |= __b >> __clz_r; } if (__n > 0) { __m = ~__storage_type(0) >> (__bits_per_word - __n); __storage_type __b = *__first.__seg_ & __m; __storage_type __dn = std::__1::min(__n, static_cast<difference_type>(__clz_r)); __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn)); *__result.__seg_ &= ~__m; *__result.__seg_ |= __b << __result.__ctz_; __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word; __result.__ctz_ = static_cast<unsigned>((__dn + __result.__ctz_) % __bits_per_word); __n -= __dn; if (__n > 0) { __m = ~__storage_type(0) >> (__bits_per_word - __n); *__result.__seg_ &= ~__m; *__result.__seg_ |= __b >> __dn; __result.__ctz_ = static_cast<unsigned>(__n); } } } return __result; } template <class _Cp, bool _IsConst> inline __attribute__ ((__exclude_from_explicit_instantiation__)) __bit_iterator<_Cp, false> copy(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) { if (__first.__ctz_ == __result.__ctz_) return __copy_aligned(__first, __last, __result); return __copy_unaligned(__first, __last, __result); } template <class _Cp, bool _IsConst> __bit_iterator<_Cp, false> __copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) { typedef __bit_iterator<_Cp, _IsConst> _In; typedef typename _In::difference_type difference_type; typedef typename _In::__storage_type __storage_type; const int __bits_per_word = _In::__bits_per_word; difference_type __n = __last - __first; if (__n > 0) { if (__last.__ctz_ != 0) { difference_type __dn = std::__1::min(static_cast<difference_type>(__last.__ctz_), __n); __n -= __dn; unsigned __clz = __bits_per_word - __last.__ctz_; __storage_type __m = (~__storage_type(0) << (__last.__ctz_ - __dn)) & (~__storage_type(0) >> __clz); __storage_type __b = *__last.__seg_ & __m; *__result.__seg_ &= ~__m; *__result.__seg_ |= __b; __result.__ctz_ = static_cast<unsigned>(((-__dn & (__bits_per_word - 1)) + __result.__ctz_) % __bits_per_word); } __storage_type __nw = __n / __bits_per_word; __result.__seg_ -= __nw; __last.__seg_ -= __nw; std::__1::memmove(std::__1::__to_raw_pointer(__result.__seg_), std::__1::__to_raw_pointer(__last.__seg_), __nw * sizeof(__storage_type)); __n -= __nw * __bits_per_word; if (__n > 0) { __storage_type __m = ~__storage_type(0) << (__bits_per_word - __n); __storage_type __b = *--__last.__seg_ & __m; *--__result.__seg_ &= ~__m; *__result.__seg_ |= __b; __result.__ctz_ = static_cast<unsigned>(-__n & (__bits_per_word - 1)); } } return __result; } template <class _Cp, bool _IsConst> __bit_iterator<_Cp, false> __copy_backward_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) { typedef __bit_iterator<_Cp, _IsConst> _In; typedef typename _In::difference_type difference_type; typedef typename _In::__storage_type __storage_type; const int __bits_per_word = _In::__bits_per_word; difference_type __n = __last - __first; if (__n > 0) { if (__last.__ctz_ != 0) { difference_type __dn = std::__1::min(static_cast<difference_type>(__last.__ctz_), __n); __n -= __dn; unsigned __clz_l = __bits_per_word - __last.__ctz_; __storage_type __m = (~__storage_type(0) << (__last.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_l); __storage_type __b = *__last.__seg_ & __m; unsigned __clz_r = __bits_per_word - __result.__ctz_; __storage_type __ddn = std::__1::min(__dn, static_cast<difference_type>(__result.__ctz_)); if (__ddn > 0) { __m = (~__storage_type(0) << (__result.__ctz_ - __ddn)) & (~__storage_type(0) >> __clz_r); *__result.__seg_ &= ~__m; if (__result.__ctz_ > __last.__ctz_) *__result.__seg_ |= __b << (__result.__ctz_ - __last.__ctz_); else *__result.__seg_ |= __b >> (__last.__ctz_ - __result.__ctz_); __result.__ctz_ = static_cast<unsigned>(((-__ddn & (__bits_per_word - 1)) + __result.__ctz_) % __bits_per_word); __dn -= __ddn; } if (__dn > 0) { --__result.__seg_; __result.__ctz_ = static_cast<unsigned>(-__dn & (__bits_per_word - 1)); __m = ~__storage_type(0) << __result.__ctz_; *__result.__seg_ &= ~__m; __last.__ctz_ -= __dn + __ddn; *__result.__seg_ |= __b << (__result.__ctz_ - __last.__ctz_); } } unsigned __clz_r = __bits_per_word - __result.__ctz_; __storage_type __m = ~__storage_type(0) >> __clz_r; for (; __n >= __bits_per_word; __n -= __bits_per_word) { __storage_type __b = *--__last.__seg_; *__result.__seg_ &= ~__m; *__result.__seg_ |= __b >> __clz_r; *--__result.__seg_ &= __m; *__result.__seg_ |= __b << __result.__ctz_; } if (__n > 0) { __m = ~__storage_type(0) << (__bits_per_word - __n); __storage_type __b = *--__last.__seg_ & __m; __clz_r = __bits_per_word - __result.__ctz_; __storage_type __dn = std::__1::min(__n, static_cast<difference_type>(__result.__ctz_)); __m = (~__storage_type(0) << (__result.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_r); *__result.__seg_ &= ~__m; *__result.__seg_ |= __b >> (__bits_per_word - __result.__ctz_); __result.__ctz_ = static_cast<unsigned>(((-__dn & (__bits_per_word - 1)) + __result.__ctz_) % __bits_per_word); __n -= __dn; if (__n > 0) { --__result.__seg_; __result.__ctz_ = static_cast<unsigned>(-__n & (__bits_per_word - 1)); __m = ~__storage_type(0) << __result.__ctz_; *__result.__seg_ &= ~__m; *__result.__seg_ |= __b << (__result.__ctz_ - (__bits_per_word - __n - __dn)); } } } return __result; } template <class _Cp, bool _IsConst> inline __attribute__ ((__exclude_from_explicit_instantiation__)) __bit_iterator<_Cp, false> copy_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) { if (__last.__ctz_ == __result.__ctz_) return __copy_backward_aligned(__first, __last, __result); return __copy_backward_unaligned(__first, __last, __result); } template <class _Cp, bool _IsConst> inline __attribute__ ((__exclude_from_explicit_instantiation__)) __bit_iterator<_Cp, false> move(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) { return std::__1::copy(__first, __last, __result); } template <class _Cp, bool _IsConst> inline __attribute__ ((__exclude_from_explicit_instantiation__)) __bit_iterator<_Cp, false> move_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) { return std::__1::copy_backward(__first, __last, __result); } template <class __C1, class __C2> __bit_iterator<__C2, false> __swap_ranges_aligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last, __bit_iterator<__C2, false> __result) { typedef __bit_iterator<__C1, false> _I1; typedef typename _I1::difference_type difference_type; typedef typename _I1::__storage_type __storage_type; const int __bits_per_word = _I1::__bits_per_word; difference_type __n = __last - __first; if (__n > 0) { if (__first.__ctz_ != 0) { unsigned __clz = __bits_per_word - __first.__ctz_; difference_type __dn = std::__1::min(static_cast<difference_type>(__clz), __n); __n -= __dn; __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz - __dn)); __storage_type __b1 = *__first.__seg_ & __m; *__first.__seg_ &= ~__m; __storage_type __b2 = *__result.__seg_ & __m; *__result.__seg_ &= ~__m; *__result.__seg_ |= __b1; *__first.__seg_ |= __b2; __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word; __result.__ctz_ = static_cast<unsigned>((__dn + __result.__ctz_) % __bits_per_word); ++__first.__seg_; } for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first.__seg_, ++__result.__seg_) swap(*__first.__seg_, *__result.__seg_); if (__n > 0) { __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); __storage_type __b1 = *__first.__seg_ & __m; *__first.__seg_ &= ~__m; __storage_type __b2 = *__result.__seg_ & __m; *__result.__seg_ &= ~__m; *__result.__seg_ |= __b1; *__first.__seg_ |= __b2; __result.__ctz_ = static_cast<unsigned>(__n); } } return __result; } template <class __C1, class __C2> __bit_iterator<__C2, false> __swap_ranges_unaligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last, __bit_iterator<__C2, false> __result) { typedef __bit_iterator<__C1, false> _I1; typedef typename _I1::difference_type difference_type; typedef typename _I1::__storage_type __storage_type; const int __bits_per_word = _I1::__bits_per_word; difference_type __n = __last - __first; if (__n > 0) { if (__first.__ctz_ != 0) { unsigned __clz_f = __bits_per_word - __first.__ctz_; difference_type __dn = std::__1::min(static_cast<difference_type>(__clz_f), __n); __n -= __dn; __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); __storage_type __b1 = *__first.__seg_ & __m; *__first.__seg_ &= ~__m; unsigned __clz_r = __bits_per_word - __result.__ctz_; __storage_type __ddn = std::__1::min<__storage_type>(__dn, __clz_r); __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn)); __storage_type __b2 = *__result.__seg_ & __m; *__result.__seg_ &= ~__m; if (__result.__ctz_ > __first.__ctz_) { unsigned __s = __result.__ctz_ - __first.__ctz_; *__result.__seg_ |= __b1 << __s; *__first.__seg_ |= __b2 >> __s; } else { unsigned __s = __first.__ctz_ - __result.__ctz_; *__result.__seg_ |= __b1 >> __s; *__first.__seg_ |= __b2 << __s; } __result.__seg_ += (__ddn + __result.__ctz_) / __bits_per_word; __result.__ctz_ = static_cast<unsigned>((__ddn + __result.__ctz_) % __bits_per_word); __dn -= __ddn; if (__dn > 0) { __m = ~__storage_type(0) >> (__bits_per_word - __dn); __b2 = *__result.__seg_ & __m; *__result.__seg_ &= ~__m; unsigned __s = __first.__ctz_ + __ddn; *__result.__seg_ |= __b1 >> __s; *__first.__seg_ |= __b2 << __s; __result.__ctz_ = static_cast<unsigned>(__dn); } ++__first.__seg_; } __storage_type __m = ~__storage_type(0) << __result.__ctz_; unsigned __clz_r = __bits_per_word - __result.__ctz_; for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first.__seg_) { __storage_type __b1 = *__first.__seg_; __storage_type __b2 = *__result.__seg_ & __m; *__result.__seg_ &= ~__m; *__result.__seg_ |= __b1 << __result.__ctz_; *__first.__seg_ = __b2 >> __result.__ctz_; ++__result.__seg_; __b2 = *__result.__seg_ & ~__m; *__result.__seg_ &= __m; *__result.__seg_ |= __b1 >> __clz_r; *__first.__seg_ |= __b2 << __clz_r; } if (__n > 0) { __m = ~__storage_type(0) >> (__bits_per_word - __n); __storage_type __b1 = *__first.__seg_ & __m; *__first.__seg_ &= ~__m; __storage_type __dn = std::__1::min<__storage_type>(__n, __clz_r); __m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn)); __storage_type __b2 = *__result.__seg_ & __m; *__result.__seg_ &= ~__m; *__result.__seg_ |= __b1 << __result.__ctz_; *__first.__seg_ |= __b2 >> __result.__ctz_; __result.__seg_ += (__dn + __result.__ctz_) / __bits_per_word; __result.__ctz_ = static_cast<unsigned>((__dn + __result.__ctz_) % __bits_per_word); __n -= __dn; if (__n > 0) { __m = ~__storage_type(0) >> (__bits_per_word - __n); __b2 = *__result.__seg_ & __m; *__result.__seg_ &= ~__m; *__result.__seg_ |= __b1 >> __dn; *__first.__seg_ |= __b2 << __dn; __result.__ctz_ = static_cast<unsigned>(__n); } } } return __result; } template <class __C1, class __C2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) __bit_iterator<__C2, false> swap_ranges(__bit_iterator<__C1, false> __first1, __bit_iterator<__C1, false> __last1, __bit_iterator<__C2, false> __first2) { if (__first1.__ctz_ == __first2.__ctz_) return __swap_ranges_aligned(__first1, __last1, __first2); return __swap_ranges_unaligned(__first1, __last1, __first2); } template <class _Cp> struct __bit_array { typedef typename _Cp::difference_type difference_type; typedef typename _Cp::__storage_type __storage_type; typedef typename _Cp::__storage_pointer __storage_pointer; typedef typename _Cp::iterator iterator; static const unsigned __bits_per_word = _Cp::__bits_per_word; static const unsigned _Np = 4; difference_type __size_; __storage_type __word_[_Np]; __attribute__ ((__exclude_from_explicit_instantiation__)) static difference_type capacity() {return static_cast<difference_type>(_Np * __bits_per_word);} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __bit_array(difference_type __s) : __size_(__s) {} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator begin() { return iterator(pointer_traits<__storage_pointer>::pointer_to(__word_[0]), 0); } __attribute__ ((__exclude_from_explicit_instantiation__)) iterator end() { return iterator(pointer_traits<__storage_pointer>::pointer_to(__word_[0]) + __size_ / __bits_per_word, static_cast<unsigned>(__size_ % __bits_per_word)); } }; template <class _Cp> __bit_iterator<_Cp, false> rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle, __bit_iterator<_Cp, false> __last) { typedef __bit_iterator<_Cp, false> _I1; typedef typename _I1::difference_type difference_type; difference_type __d1 = __middle - __first; difference_type __d2 = __last - __middle; _I1 __r = __first + __d2; while (__d1 != 0 && __d2 != 0) { if (__d1 <= __d2) { if (__d1 <= __bit_array<_Cp>::capacity()) { __bit_array<_Cp> __b(__d1); std::__1::copy(__first, __middle, __b.begin()); std::__1::copy(__b.begin(), __b.end(), std::__1::copy(__middle, __last, __first)); break; } else { __bit_iterator<_Cp, false> __mp = std::__1::swap_ranges(__first, __middle, __middle); __first = __middle; __middle = __mp; __d2 -= __d1; } } else { if (__d2 <= __bit_array<_Cp>::capacity()) { __bit_array<_Cp> __b(__d2); std::__1::copy(__middle, __last, __b.begin()); std::__1::copy_backward(__b.begin(), __b.end(), std::__1::copy_backward(__first, __middle, __last)); break; } else { __bit_iterator<_Cp, false> __mp = __first + __d2; std::__1::swap_ranges(__first, __mp, __middle); __first = __mp; __d1 -= __d2; } } } return __r; } template <class _Cp, bool _IC1, bool _IC2> bool __equal_unaligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, __bit_iterator<_Cp, _IC2> __first2) { typedef __bit_iterator<_Cp, _IC1> _It; typedef typename _It::difference_type difference_type; typedef typename _It::__storage_type __storage_type; static const int __bits_per_word = _It::__bits_per_word; difference_type __n = __last1 - __first1; if (__n > 0) { if (__first1.__ctz_ != 0) { unsigned __clz_f = __bits_per_word - __first1.__ctz_; difference_type __dn = std::__1::min(static_cast<difference_type>(__clz_f), __n); __n -= __dn; __storage_type __m = (~__storage_type(0) << __first1.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); __storage_type __b = *__first1.__seg_ & __m; unsigned __clz_r = __bits_per_word - __first2.__ctz_; __storage_type __ddn = std::__1::min<__storage_type>(__dn, __clz_r); __m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn)); if (__first2.__ctz_ > __first1.__ctz_) { if ((*__first2.__seg_ & __m) != (__b << (__first2.__ctz_ - __first1.__ctz_))) return false; } else { if ((*__first2.__seg_ & __m) != (__b >> (__first1.__ctz_ - __first2.__ctz_))) return false; } __first2.__seg_ += (__ddn + __first2.__ctz_) / __bits_per_word; __first2.__ctz_ = static_cast<unsigned>((__ddn + __first2.__ctz_) % __bits_per_word); __dn -= __ddn; if (__dn > 0) { __m = ~__storage_type(0) >> (__bits_per_word - __dn); if ((*__first2.__seg_ & __m) != (__b >> (__first1.__ctz_ + __ddn))) return false; __first2.__ctz_ = static_cast<unsigned>(__dn); } ++__first1.__seg_; } unsigned __clz_r = __bits_per_word - __first2.__ctz_; __storage_type __m = ~__storage_type(0) << __first2.__ctz_; for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first1.__seg_) { __storage_type __b = *__first1.__seg_; if ((*__first2.__seg_ & __m) != (__b << __first2.__ctz_)) return false; ++__first2.__seg_; if ((*__first2.__seg_ & ~__m) != (__b >> __clz_r)) return false; } if (__n > 0) { __m = ~__storage_type(0) >> (__bits_per_word - __n); __storage_type __b = *__first1.__seg_ & __m; __storage_type __dn = std::__1::min(__n, static_cast<difference_type>(__clz_r)); __m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn)); if ((*__first2.__seg_ & __m) != (__b << __first2.__ctz_)) return false; __first2.__seg_ += (__dn + __first2.__ctz_) / __bits_per_word; __first2.__ctz_ = static_cast<unsigned>((__dn + __first2.__ctz_) % __bits_per_word); __n -= __dn; if (__n > 0) { __m = ~__storage_type(0) >> (__bits_per_word - __n); if ((*__first2.__seg_ & __m) != (__b >> __dn)) return false; } } } return true; } template <class _Cp, bool _IC1, bool _IC2> bool __equal_aligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, __bit_iterator<_Cp, _IC2> __first2) { typedef __bit_iterator<_Cp, _IC1> _It; typedef typename _It::difference_type difference_type; typedef typename _It::__storage_type __storage_type; static const int __bits_per_word = _It::__bits_per_word; difference_type __n = __last1 - __first1; if (__n > 0) { if (__first1.__ctz_ != 0) { unsigned __clz = __bits_per_word - __first1.__ctz_; difference_type __dn = std::__1::min(static_cast<difference_type>(__clz), __n); __n -= __dn; __storage_type __m = (~__storage_type(0) << __first1.__ctz_) & (~__storage_type(0) >> (__clz - __dn)); if ((*__first2.__seg_ & __m) != (*__first1.__seg_ & __m)) return false; ++__first2.__seg_; ++__first1.__seg_; } for (; __n >= __bits_per_word; __n -= __bits_per_word, ++__first1.__seg_, ++__first2.__seg_) if (*__first2.__seg_ != *__first1.__seg_) return false; if (__n > 0) { __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); if ((*__first2.__seg_ & __m) != (*__first1.__seg_ & __m)) return false; } } return true; } template <class _Cp, bool _IC1, bool _IC2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool equal(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, __bit_iterator<_Cp, _IC2> __first2) { if (__first1.__ctz_ == __first2.__ctz_) return __equal_aligned(__first1, __last1, __first2); return __equal_unaligned(__first1, __last1, __first2); } template <class _Cp, bool _IsConst, typename _Cp::__storage_type> class __bit_iterator { public: typedef typename _Cp::difference_type difference_type; typedef bool value_type; typedef __bit_iterator pointer; typedef typename conditional<_IsConst, __bit_const_reference<_Cp>, __bit_reference<_Cp> >::type reference; typedef random_access_iterator_tag iterator_category; private: typedef typename _Cp::__storage_type __storage_type; typedef typename conditional<_IsConst, typename _Cp::__const_storage_pointer, typename _Cp::__storage_pointer>::type __storage_pointer; static const unsigned __bits_per_word = _Cp::__bits_per_word; __storage_pointer __seg_; unsigned __ctz_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) __bit_iterator() noexcept : __seg_(nullptr), __ctz_(0) {} __attribute__ ((__exclude_from_explicit_instantiation__)) __bit_iterator(const __bit_iterator<_Cp, false>& __it) noexcept : __seg_(__it.__seg_), __ctz_(__it.__ctz_) {} __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator*() const noexcept {return reference(__seg_, __storage_type(1) << __ctz_);} __attribute__ ((__exclude_from_explicit_instantiation__)) __bit_iterator& operator++() { if (__ctz_ != __bits_per_word-1) ++__ctz_; else { __ctz_ = 0; ++__seg_; } return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __bit_iterator operator++(int) { __bit_iterator __tmp = *this; ++(*this); return __tmp; } __attribute__ ((__exclude_from_explicit_instantiation__)) __bit_iterator& operator--() { if (__ctz_ != 0) --__ctz_; else { __ctz_ = __bits_per_word - 1; --__seg_; } return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __bit_iterator operator--(int) { __bit_iterator __tmp = *this; --(*this); return __tmp; } __attribute__ ((__exclude_from_explicit_instantiation__)) __bit_iterator& operator+=(difference_type __n) { if (__n >= 0) __seg_ += (__n + __ctz_) / __bits_per_word; else __seg_ += static_cast<difference_type>(__n - __bits_per_word + __ctz_ + 1) / static_cast<difference_type>(__bits_per_word); __n &= (__bits_per_word - 1); __ctz_ = static_cast<unsigned>((__n + __ctz_) % __bits_per_word); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __bit_iterator& operator-=(difference_type __n) { return *this += -__n; } __attribute__ ((__exclude_from_explicit_instantiation__)) __bit_iterator operator+(difference_type __n) const { __bit_iterator __t(*this); __t += __n; return __t; } __attribute__ ((__exclude_from_explicit_instantiation__)) __bit_iterator operator-(difference_type __n) const { __bit_iterator __t(*this); __t -= __n; return __t; } __attribute__ ((__exclude_from_explicit_instantiation__)) friend __bit_iterator operator+(difference_type __n, const __bit_iterator& __it) {return __it + __n;} __attribute__ ((__exclude_from_explicit_instantiation__)) friend difference_type operator-(const __bit_iterator& __x, const __bit_iterator& __y) {return (__x.__seg_ - __y.__seg_) * __bits_per_word + __x.__ctz_ - __y.__ctz_;} __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator[](difference_type __n) const {return *(*this + __n);} __attribute__ ((__exclude_from_explicit_instantiation__)) friend bool operator==(const __bit_iterator& __x, const __bit_iterator& __y) {return __x.__seg_ == __y.__seg_ && __x.__ctz_ == __y.__ctz_;} __attribute__ ((__exclude_from_explicit_instantiation__)) friend bool operator!=(const __bit_iterator& __x, const __bit_iterator& __y) {return !(__x == __y);} __attribute__ ((__exclude_from_explicit_instantiation__)) friend bool operator<(const __bit_iterator& __x, const __bit_iterator& __y) {return __x.__seg_ < __y.__seg_ || (__x.__seg_ == __y.__seg_ && __x.__ctz_ < __y.__ctz_);} __attribute__ ((__exclude_from_explicit_instantiation__)) friend bool operator>(const __bit_iterator& __x, const __bit_iterator& __y) {return __y < __x;} __attribute__ ((__exclude_from_explicit_instantiation__)) friend bool operator<=(const __bit_iterator& __x, const __bit_iterator& __y) {return !(__y < __x);} __attribute__ ((__exclude_from_explicit_instantiation__)) friend bool operator>=(const __bit_iterator& __x, const __bit_iterator& __y) {return !(__x < __y);} private: __attribute__ ((__exclude_from_explicit_instantiation__)) __bit_iterator(__storage_pointer __s, unsigned __ctz) noexcept : __seg_(__s), __ctz_(__ctz) {} friend typename _Cp::__self; friend class __bit_reference<_Cp>; friend class __bit_const_reference<_Cp>; friend class __bit_iterator<_Cp, true>; template <class _Dp> friend struct __bit_array; template <class _Dp> friend void __fill_n_false(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n); template <class _Dp> friend void __fill_n_true(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n); template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_aligned(__bit_iterator<_Dp, _IC> __first, __bit_iterator<_Dp, _IC> __last, __bit_iterator<_Dp, false> __result); template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_unaligned(__bit_iterator<_Dp, _IC> __first, __bit_iterator<_Dp, _IC> __last, __bit_iterator<_Dp, false> __result); template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> copy(__bit_iterator<_Dp, _IC> __first, __bit_iterator<_Dp, _IC> __last, __bit_iterator<_Dp, false> __result); template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_backward_aligned(__bit_iterator<_Dp, _IC> __first, __bit_iterator<_Dp, _IC> __last, __bit_iterator<_Dp, false> __result); template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_backward_unaligned(__bit_iterator<_Dp, _IC> __first, __bit_iterator<_Dp, _IC> __last, __bit_iterator<_Dp, false> __result); template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> copy_backward(__bit_iterator<_Dp, _IC> __first, __bit_iterator<_Dp, _IC> __last, __bit_iterator<_Dp, false> __result); template <class __C1, class __C2>friend __bit_iterator<__C2, false> __swap_ranges_aligned(__bit_iterator<__C1, false>, __bit_iterator<__C1, false>, __bit_iterator<__C2, false>); template <class __C1, class __C2>friend __bit_iterator<__C2, false> __swap_ranges_unaligned(__bit_iterator<__C1, false>, __bit_iterator<__C1, false>, __bit_iterator<__C2, false>); template <class __C1, class __C2>friend __bit_iterator<__C2, false> swap_ranges(__bit_iterator<__C1, false>, __bit_iterator<__C1, false>, __bit_iterator<__C2, false>); template <class _Dp> friend __bit_iterator<_Dp, false> rotate(__bit_iterator<_Dp, false>, __bit_iterator<_Dp, false>, __bit_iterator<_Dp, false>); template <class _Dp, bool _IC1, bool _IC2> friend bool __equal_aligned(__bit_iterator<_Dp, _IC1>, __bit_iterator<_Dp, _IC1>, __bit_iterator<_Dp, _IC2>); template <class _Dp, bool _IC1, bool _IC2> friend bool __equal_unaligned(__bit_iterator<_Dp, _IC1>, __bit_iterator<_Dp, _IC1>, __bit_iterator<_Dp, _IC2>); template <class _Dp, bool _IC1, bool _IC2> friend bool equal(__bit_iterator<_Dp, _IC1>, __bit_iterator<_Dp, _IC1>, __bit_iterator<_Dp, _IC2>); template <class _Dp, bool _IC> friend __bit_iterator<_Dp, _IC> __find_bool_true(__bit_iterator<_Dp, _IC>, typename _Dp::size_type); template <class _Dp, bool _IC> friend __bit_iterator<_Dp, _IC> __find_bool_false(__bit_iterator<_Dp, _IC>, typename _Dp::size_type); template <class _Dp, bool _IC> friend typename __bit_iterator<_Dp, _IC>::difference_type __count_bool_true(__bit_iterator<_Dp, _IC>, typename _Dp::size_type); template <class _Dp, bool _IC> friend typename __bit_iterator<_Dp, _IC>::difference_type __count_bool_false(__bit_iterator<_Dp, _IC>, typename _Dp::size_type); }; } } namespace std { inline namespace __1 { using ::FILE; using ::fpos_t; using ::size_t; using ::fclose; using ::fflush; using ::setbuf; using ::setvbuf; using ::fprintf; using ::fscanf; using ::snprintf; using ::sprintf; using ::sscanf; using ::vfprintf; using ::vfscanf; using ::vsscanf; using ::vsnprintf; using ::vsprintf; using ::fgetc; using ::fgets; using ::fputc; using ::fputs; using ::getc; using ::putc; using ::ungetc; using ::fread; using ::fwrite; using ::fgetpos; using ::fseek; using ::fsetpos; using ::ftell; using ::rewind; using ::clearerr; using ::feof; using ::ferror; using ::perror; using ::fopen; using ::freopen; using ::remove; using ::rename; using ::tmpfile; using ::tmpnam; using ::getchar; using ::scanf; using ::vscanf; using ::printf; using ::putchar; using ::puts; using ::vprintf; } } namespace std { inline namespace __1 { template <class _CharT> struct char_traits { typedef _CharT char_type; typedef int int_type; typedef streamoff off_type; typedef streampos pos_type; typedef mbstate_t state_type; static inline void assign(char_type& __c1, const char_type& __c2) noexcept {__c1 = __c2;} static inline constexpr bool eq(char_type __c1, char_type __c2) noexcept {return __c1 == __c2;} static inline constexpr bool lt(char_type __c1, char_type __c2) noexcept {return __c1 < __c2;} static int compare(const char_type* __s1, const char_type* __s2, size_t __n); __attribute__ ((__exclude_from_explicit_instantiation__)) static size_t length(const char_type* __s); __attribute__ ((__exclude_from_explicit_instantiation__)) static const char_type* find(const char_type* __s, size_t __n, const char_type& __a); static char_type* move(char_type* __s1, const char_type* __s2, size_t __n); __attribute__ ((__exclude_from_explicit_instantiation__)) static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n); __attribute__ ((__exclude_from_explicit_instantiation__)) static char_type* assign(char_type* __s, size_t __n, char_type __a); static inline constexpr int_type not_eof(int_type __c) noexcept {return eq_int_type(__c, eof()) ? ~eof() : __c;} static inline constexpr char_type to_char_type(int_type __c) noexcept {return char_type(__c);} static inline constexpr int_type to_int_type(char_type __c) noexcept {return int_type(__c);} static inline constexpr bool eq_int_type(int_type __c1, int_type __c2) noexcept {return __c1 == __c2;} static inline constexpr int_type eof() noexcept {return int_type((-1));} }; template <class _CharT> int char_traits<_CharT>::compare(const char_type* __s1, const char_type* __s2, size_t __n) { for (; __n; --__n, ++__s1, ++__s2) { if (lt(*__s1, *__s2)) return -1; if (lt(*__s2, *__s1)) return 1; } return 0; } template <class _CharT> inline size_t char_traits<_CharT>::length(const char_type* __s) { size_t __len = 0; for (; !eq(*__s, char_type(0)); ++__s) ++__len; return __len; } template <class _CharT> inline const _CharT* char_traits<_CharT>::find(const char_type* __s, size_t __n, const char_type& __a) { for (; __n; --__n) { if (eq(*__s, __a)) return __s; ++__s; } return 0; } template <class _CharT> _CharT* char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size_t __n) { char_type* __r = __s1; if (__s1 < __s2) { for (; __n; --__n, ++__s1, ++__s2) assign(*__s1, *__s2); } else if (__s2 < __s1) { __s1 += __n; __s2 += __n; for (; __n; --__n) assign(*--__s1, *--__s2); } return __r; } template <class _CharT> inline _CharT* char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n) { ((void)0); char_type* __r = __s1; for (; __n; --__n, ++__s1, ++__s2) assign(*__s1, *__s2); return __r; } template <class _CharT> inline _CharT* char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a) { char_type* __r = __s; for (; __n; --__n, ++__s) assign(*__s, __a); return __r; } template <> struct char_traits<char> { typedef char char_type; typedef int int_type; typedef streamoff off_type; typedef streampos pos_type; typedef mbstate_t state_type; static inline void assign(char_type& __c1, const char_type& __c2) noexcept {__c1 = __c2;} static inline constexpr bool eq(char_type __c1, char_type __c2) noexcept {return __c1 == __c2;} static inline constexpr bool lt(char_type __c1, char_type __c2) noexcept {return (unsigned char)__c1 < (unsigned char)__c2;} static int compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept; static inline size_t length(const char_type* __s) noexcept {return __builtin_strlen(__s);} static const char_type* find(const char_type* __s, size_t __n, const char_type& __a) noexcept; static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n) noexcept {return __n == 0 ? __s1 : (char_type*) memmove(__s1, __s2, __n);} static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) noexcept { ((void)0); return __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n); } static inline char_type* assign(char_type* __s, size_t __n, char_type __a) noexcept {return __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n);} static inline constexpr int_type not_eof(int_type __c) noexcept {return eq_int_type(__c, eof()) ? ~eof() : __c;} static inline constexpr char_type to_char_type(int_type __c) noexcept {return char_type(__c);} static inline constexpr int_type to_int_type(char_type __c) noexcept {return int_type((unsigned char)__c);} static inline constexpr bool eq_int_type(int_type __c1, int_type __c2) noexcept {return __c1 == __c2;} static inline constexpr int_type eof() noexcept {return int_type((-1));} }; inline int char_traits<char>::compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept { if (__n == 0) return 0; return __builtin_memcmp(__s1, __s2, __n); } inline const char* char_traits<char>::find(const char_type* __s, size_t __n, const char_type& __a) noexcept { if (__n == 0) return nullptr; return __builtin_char_memchr(__s, to_int_type(__a), __n); } template <> struct char_traits<wchar_t> { typedef wchar_t char_type; typedef wint_t int_type; typedef streamoff off_type; typedef streampos pos_type; typedef mbstate_t state_type; static inline void assign(char_type& __c1, const char_type& __c2) noexcept {__c1 = __c2;} static inline constexpr bool eq(char_type __c1, char_type __c2) noexcept {return __c1 == __c2;} static inline constexpr bool lt(char_type __c1, char_type __c2) noexcept {return __c1 < __c2;} static int compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept; static size_t length(const char_type* __s) noexcept; static const char_type* find(const char_type* __s, size_t __n, const char_type& __a) noexcept; static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n) noexcept {return __n == 0 ? __s1 : (char_type*)wmemmove(__s1, __s2, __n);} static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) noexcept { ((void)0); return __n == 0 ? __s1 : (char_type*)wmemcpy(__s1, __s2, __n); } static inline char_type* assign(char_type* __s, size_t __n, char_type __a) noexcept {return __n == 0 ? __s : (char_type*)wmemset(__s, __a, __n);} static inline constexpr int_type not_eof(int_type __c) noexcept {return eq_int_type(__c, eof()) ? ~eof() : __c;} static inline constexpr char_type to_char_type(int_type __c) noexcept {return char_type(__c);} static inline constexpr int_type to_int_type(char_type __c) noexcept {return int_type(__c);} static inline constexpr bool eq_int_type(int_type __c1, int_type __c2) noexcept {return __c1 == __c2;} static inline constexpr int_type eof() noexcept {return int_type(((wint_t)(0xFFFF)));} }; inline int char_traits<wchar_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept { if (__n == 0) return 0; return __builtin_wmemcmp(__s1, __s2, __n); } template <class _Traits> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr inline size_t __char_traits_length_checked(const typename _Traits::char_type* __s) noexcept { return _Traits::length(__s); } inline size_t char_traits<wchar_t>::length(const char_type* __s) noexcept { return __builtin_wcslen(__s); } inline const wchar_t* char_traits<wchar_t>::find(const char_type* __s, size_t __n, const char_type& __a) noexcept { if (__n == 0) return nullptr; return __builtin_wmemchr(__s, __a, __n); } template <> struct char_traits<char16_t> { typedef char16_t char_type; typedef uint_least16_t int_type; typedef streamoff off_type; typedef u16streampos pos_type; typedef mbstate_t state_type; static inline void assign(char_type& __c1, const char_type& __c2) noexcept {__c1 = __c2;} static inline constexpr bool eq(char_type __c1, char_type __c2) noexcept {return __c1 == __c2;} static inline constexpr bool lt(char_type __c1, char_type __c2) noexcept {return __c1 < __c2;} __attribute__ ((__exclude_from_explicit_instantiation__)) static int compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) static size_t length(const char_type* __s) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) static const char_type* find(const char_type* __s, size_t __n, const char_type& __a) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) static char_type* assign(char_type* __s, size_t __n, char_type __a) noexcept; static inline constexpr int_type not_eof(int_type __c) noexcept {return eq_int_type(__c, eof()) ? ~eof() : __c;} static inline constexpr char_type to_char_type(int_type __c) noexcept {return char_type(__c);} static inline constexpr int_type to_int_type(char_type __c) noexcept {return int_type(__c);} static inline constexpr bool eq_int_type(int_type __c1, int_type __c2) noexcept {return __c1 == __c2;} static inline constexpr int_type eof() noexcept {return int_type(0xFFFF);} }; inline int char_traits<char16_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept { for (; __n; --__n, ++__s1, ++__s2) { if (lt(*__s1, *__s2)) return -1; if (lt(*__s2, *__s1)) return 1; } return 0; } inline size_t char_traits<char16_t>::length(const char_type* __s) noexcept { size_t __len = 0; for (; !eq(*__s, char_type(0)); ++__s) ++__len; return __len; } inline const char16_t* char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& __a) noexcept { for (; __n; --__n) { if (eq(*__s, __a)) return __s; ++__s; } return 0; } inline char16_t* char_traits<char16_t>::move(char_type* __s1, const char_type* __s2, size_t __n) noexcept { char_type* __r = __s1; if (__s1 < __s2) { for (; __n; --__n, ++__s1, ++__s2) assign(*__s1, *__s2); } else if (__s2 < __s1) { __s1 += __n; __s2 += __n; for (; __n; --__n) assign(*--__s1, *--__s2); } return __r; } inline char16_t* char_traits<char16_t>::copy(char_type* __s1, const char_type* __s2, size_t __n) noexcept { ((void)0); char_type* __r = __s1; for (; __n; --__n, ++__s1, ++__s2) assign(*__s1, *__s2); return __r; } inline char16_t* char_traits<char16_t>::assign(char_type* __s, size_t __n, char_type __a) noexcept { char_type* __r = __s; for (; __n; --__n, ++__s) assign(*__s, __a); return __r; } template <> struct char_traits<char32_t> { typedef char32_t char_type; typedef uint_least32_t int_type; typedef streamoff off_type; typedef u32streampos pos_type; typedef mbstate_t state_type; static inline void assign(char_type& __c1, const char_type& __c2) noexcept {__c1 = __c2;} static inline constexpr bool eq(char_type __c1, char_type __c2) noexcept {return __c1 == __c2;} static inline constexpr bool lt(char_type __c1, char_type __c2) noexcept {return __c1 < __c2;} __attribute__ ((__exclude_from_explicit_instantiation__)) static int compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) static size_t length(const char_type* __s) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) static const char_type* find(const char_type* __s, size_t __n, const char_type& __a) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) static char_type* assign(char_type* __s, size_t __n, char_type __a) noexcept; static inline constexpr int_type not_eof(int_type __c) noexcept {return eq_int_type(__c, eof()) ? ~eof() : __c;} static inline constexpr char_type to_char_type(int_type __c) noexcept {return char_type(__c);} static inline constexpr int_type to_int_type(char_type __c) noexcept {return int_type(__c);} static inline constexpr bool eq_int_type(int_type __c1, int_type __c2) noexcept {return __c1 == __c2;} static inline constexpr int_type eof() noexcept {return int_type(0xFFFFFFFF);} }; inline int char_traits<char32_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept { for (; __n; --__n, ++__s1, ++__s2) { if (lt(*__s1, *__s2)) return -1; if (lt(*__s2, *__s1)) return 1; } return 0; } inline size_t char_traits<char32_t>::length(const char_type* __s) noexcept { size_t __len = 0; for (; !eq(*__s, char_type(0)); ++__s) ++__len; return __len; } inline const char32_t* char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& __a) noexcept { for (; __n; --__n) { if (eq(*__s, __a)) return __s; ++__s; } return 0; } inline char32_t* char_traits<char32_t>::move(char_type* __s1, const char_type* __s2, size_t __n) noexcept { char_type* __r = __s1; if (__s1 < __s2) { for (; __n; --__n, ++__s1, ++__s2) assign(*__s1, *__s2); } else if (__s2 < __s1) { __s1 += __n; __s2 += __n; for (; __n; --__n) assign(*--__s1, *--__s2); } return __r; } inline char32_t* char_traits<char32_t>::copy(char_type* __s1, const char_type* __s2, size_t __n) noexcept { ((void)0); char_type* __r = __s1; for (; __n; --__n, ++__s1, ++__s2) assign(*__s1, *__s2); return __r; } inline char32_t* char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a) noexcept { char_type* __r = __s; for (; __n; --__n, ++__s) assign(*__s, __a); return __r; } template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> inline _SizeT constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) __str_find(const _CharT *__p, _SizeT __sz, _CharT __c, _SizeT __pos) noexcept { if (__pos >= __sz) return __npos; const _CharT* __r = _Traits::find(__p + __pos, __sz - __pos, __c); if (__r == 0) return __npos; return static_cast<_SizeT>(__r - __p); } template <class _CharT, class _Traits> inline constexpr const _CharT * __search_substring(const _CharT *__first1, const _CharT *__last1, const _CharT *__first2, const _CharT *__last2) { const ptrdiff_t __len2 = __last2 - __first2; if (__len2 == 0) return __first1; ptrdiff_t __len1 = __last1 - __first1; if (__len1 < __len2) return __last1; _CharT __f2 = *__first2; while (true) { __len1 = __last1 - __first1; if (__len1 < __len2) return __last1; __first1 = _Traits::find(__first1, __len1 - __len2 + 1, __f2); if (__first1 == 0) return __last1; if (_Traits::compare(__first1, __first2, __len2) == 0) return __first1; ++__first1; } } template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> inline _SizeT constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) __str_find(const _CharT *__p, _SizeT __sz, const _CharT* __s, _SizeT __pos, _SizeT __n) noexcept { if (__pos > __sz) return __npos; if (__n == 0) return __pos; const _CharT *__r = __search_substring<_CharT, _Traits>( __p + __pos, __p + __sz, __s, __s + __n); if (__r == __p + __sz) return __npos; return static_cast<_SizeT>(__r - __p); } template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> inline _SizeT constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) __str_rfind(const _CharT *__p, _SizeT __sz, _CharT __c, _SizeT __pos) noexcept { if (__sz < 1) return __npos; if (__pos < __sz) ++__pos; else __pos = __sz; for (const _CharT* __ps = __p + __pos; __ps != __p;) { if (_Traits::eq(*--__ps, __c)) return static_cast<_SizeT>(__ps - __p); } return __npos; } template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> inline _SizeT constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) __str_rfind(const _CharT *__p, _SizeT __sz, const _CharT* __s, _SizeT __pos, _SizeT __n) noexcept { __pos = std::__1::min(__pos, __sz); if (__n < __sz - __pos) __pos += __n; else __pos = __sz; const _CharT* __r = std::__1::__find_end( __p, __p + __pos, __s, __s + __n, _Traits::eq, random_access_iterator_tag(), random_access_iterator_tag()); if (__n > 0 && __r == __p + __pos) return __npos; return static_cast<_SizeT>(__r - __p); } template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> inline _SizeT constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) __str_find_first_of(const _CharT *__p, _SizeT __sz, const _CharT* __s, _SizeT __pos, _SizeT __n) noexcept { if (__pos >= __sz || __n == 0) return __npos; const _CharT* __r = std::__1::__find_first_of_ce (__p + __pos, __p + __sz, __s, __s + __n, _Traits::eq ); if (__r == __p + __sz) return __npos; return static_cast<_SizeT>(__r - __p); } template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> inline _SizeT constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) __str_find_last_of(const _CharT *__p, _SizeT __sz, const _CharT* __s, _SizeT __pos, _SizeT __n) noexcept { if (__n != 0) { if (__pos < __sz) ++__pos; else __pos = __sz; for (const _CharT* __ps = __p + __pos; __ps != __p;) { const _CharT* __r = _Traits::find(__s, __n, *--__ps); if (__r) return static_cast<_SizeT>(__ps - __p); } } return __npos; } template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> inline _SizeT constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) __str_find_first_not_of(const _CharT *__p, _SizeT __sz, const _CharT* __s, _SizeT __pos, _SizeT __n) noexcept { if (__pos < __sz) { const _CharT* __pe = __p + __sz; for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps) if (_Traits::find(__s, __n, *__ps) == 0) return static_cast<_SizeT>(__ps - __p); } return __npos; } template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> inline _SizeT constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) __str_find_first_not_of(const _CharT *__p, _SizeT __sz, _CharT __c, _SizeT __pos) noexcept { if (__pos < __sz) { const _CharT* __pe = __p + __sz; for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps) if (!_Traits::eq(*__ps, __c)) return static_cast<_SizeT>(__ps - __p); } return __npos; } template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> inline _SizeT constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) __str_find_last_not_of(const _CharT *__p, _SizeT __sz, const _CharT* __s, _SizeT __pos, _SizeT __n) noexcept { if (__pos < __sz) ++__pos; else __pos = __sz; for (const _CharT* __ps = __p + __pos; __ps != __p;) if (_Traits::find(__s, __n, *--__ps) == 0) return static_cast<_SizeT>(__ps - __p); return __npos; } template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> inline _SizeT constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) __str_find_last_not_of(const _CharT *__p, _SizeT __sz, _CharT __c, _SizeT __pos) noexcept { if (__pos < __sz) ++__pos; else __pos = __sz; for (const _CharT* __ps = __p + __pos; __ps != __p;) if (!_Traits::eq(*--__ps, __c)) return static_cast<_SizeT>(__ps - __p); return __npos; } template<class _Ptr> inline __attribute__ ((__exclude_from_explicit_instantiation__)) size_t __do_string_hash(_Ptr __p, _Ptr __e) { typedef typename iterator_traits<_Ptr>::value_type value_type; return __murmur2_or_cityhash<size_t>()(__p, (__e-__p)*sizeof(value_type)); } template <class _CharT, class _Iter, class _Traits=char_traits<_CharT> > struct __quoted_output_proxy { _Iter __first; _Iter __last; _CharT __delim; _CharT __escape; __quoted_output_proxy(_Iter __f, _Iter __l, _CharT __d, _CharT __e) : __first(__f), __last(__l), __delim(__d), __escape(__e) {} }; } } namespace std { inline namespace __1 { template<class _CharT, class _Traits = char_traits<_CharT> > class basic_string_view { public: typedef _Traits traits_type; typedef _CharT value_type; typedef _CharT* pointer; typedef const _CharT* const_pointer; typedef _CharT& reference; typedef const _CharT& const_reference; typedef const_pointer const_iterator; typedef const_iterator iterator; typedef std::__1::reverse_iterator<const_iterator> const_reverse_iterator; typedef const_reverse_iterator reverse_iterator; typedef size_t size_type; typedef ptrdiff_t difference_type; static constexpr const size_type npos = -1; static_assert((!is_array<value_type>::value), "Character type of basic_string_view must not be an array"); static_assert(( is_standard_layout<value_type>::value), "Character type of basic_string_view must be standard-layout"); static_assert(( is_trivial<value_type>::value), "Character type of basic_string_view must be trivial"); static_assert((is_same<_CharT, typename traits_type::char_type>::value), "traits_type::char_type must be the same type as CharT"); constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string_view() noexcept : __data (nullptr), __size(0) {} constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string_view(const basic_string_view&) noexcept = default; constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string_view& operator=(const basic_string_view&) noexcept = default; constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string_view(const _CharT* __s, size_type __len) noexcept : __data(__s), __size(__len) { ((void)0); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string_view(const _CharT* __s) : __data(__s), __size(std::__char_traits_length_checked<_Traits>(__s)) {} constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator begin() const noexcept { return cbegin(); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator end() const noexcept { return cend(); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cbegin() const noexcept { return __data; } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cend() const noexcept { return __data + __size; } __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(cend()); } __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator rend() const noexcept { return const_reverse_iterator(cbegin()); } __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(cend()); } __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator crend() const noexcept { return const_reverse_iterator(cbegin()); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type size() const noexcept { return __size; } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type length() const noexcept { return __size; } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type max_size() const noexcept { return numeric_limits<size_type>::max(); } [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool empty() const noexcept { return __size == 0; } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference operator[](size_type __pos) const noexcept { return __data[__pos]; } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference at(size_type __pos) const { return __pos >= size() ? (__throw_out_of_range("string_view::at"), __data[0]) : __data[__pos]; } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference front() const noexcept { return ((void)0), __data[0]; } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference back() const noexcept { return ((void)0), __data[__size-1]; } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) const_pointer data() const noexcept { return __data; } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) void remove_prefix(size_type __n) noexcept { ((void)0); __data += __n; __size -= __n; } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) void remove_suffix(size_type __n) noexcept { ((void)0); __size -= __n; } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(basic_string_view& __other) noexcept { const value_type *__p = __data; __data = __other.__data; __other.__data = __p; size_type __sz = __size; __size = __other.__size; __other.__size = __sz; } __attribute__ ((__exclude_from_explicit_instantiation__)) size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const { if (__pos > size()) __throw_out_of_range("string_view::copy"); size_type __rlen = std::__1::min(__n, size() - __pos); _Traits::copy(__s, data() + __pos, __rlen); return __rlen; } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string_view substr(size_type __pos = 0, size_type __n = npos) const { return __pos > size() ? (__throw_out_of_range("string_view::substr"), basic_string_view()) : basic_string_view(data() + __pos, std::__1::min(__n, size() - __pos)); } constexpr int compare(basic_string_view __sv) const noexcept { size_type __rlen = std::__1::min( size(), __sv.size()); int __retval = _Traits::compare(data(), __sv.data(), __rlen); if ( __retval == 0 ) __retval = size() == __sv.size() ? 0 : ( size() < __sv.size() ? -1 : 1 ); return __retval; } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) int compare(size_type __pos1, size_type __n1, basic_string_view __sv) const { return substr(__pos1, __n1).compare(__sv); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) int compare( size_type __pos1, size_type __n1, basic_string_view __sv, size_type __pos2, size_type __n2) const { return substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2)); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) int compare(const _CharT* __s) const noexcept { return compare(basic_string_view(__s)); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) int compare(size_type __pos1, size_type __n1, const _CharT* __s) const { return substr(__pos1, __n1).compare(basic_string_view(__s)); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) int compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const { return substr(__pos1, __n1).compare(basic_string_view(__s, __n2)); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find(basic_string_view __s, size_type __pos = 0) const noexcept { ((void)0); return __str_find<value_type, size_type, traits_type, npos> (data(), size(), __s.data(), __pos, __s.size()); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find(_CharT __c, size_type __pos = 0) const noexcept { return __str_find<value_type, size_type, traits_type, npos> (data(), size(), __c, __pos); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find(const _CharT* __s, size_type __pos, size_type __n) const { ((void)0); return __str_find<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, __n); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find(const _CharT* __s, size_type __pos = 0) const { ((void)0); return __str_find<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, traits_type::length(__s)); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type rfind(basic_string_view __s, size_type __pos = npos) const noexcept { ((void)0); return __str_rfind<value_type, size_type, traits_type, npos> (data(), size(), __s.data(), __pos, __s.size()); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type rfind(_CharT __c, size_type __pos = npos) const noexcept { return __str_rfind<value_type, size_type, traits_type, npos> (data(), size(), __c, __pos); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const { ((void)0); return __str_rfind<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, __n); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type rfind(const _CharT* __s, size_type __pos=npos) const { ((void)0); return __str_rfind<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, traits_type::length(__s)); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_first_of(basic_string_view __s, size_type __pos = 0) const noexcept { ((void)0); return __str_find_first_of<value_type, size_type, traits_type, npos> (data(), size(), __s.data(), __pos, __s.size()); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_first_of(_CharT __c, size_type __pos = 0) const noexcept { return find(__c, __pos); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const { ((void)0); return __str_find_first_of<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, __n); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_first_of(const _CharT* __s, size_type __pos=0) const { ((void)0); return __str_find_first_of<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, traits_type::length(__s)); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_last_of(basic_string_view __s, size_type __pos=npos) const noexcept { ((void)0); return __str_find_last_of<value_type, size_type, traits_type, npos> (data(), size(), __s.data(), __pos, __s.size()); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_last_of(_CharT __c, size_type __pos = npos) const noexcept { return rfind(__c, __pos); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const { ((void)0); return __str_find_last_of<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, __n); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_last_of(const _CharT* __s, size_type __pos=npos) const { ((void)0); return __str_find_last_of<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, traits_type::length(__s)); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_first_not_of(basic_string_view __s, size_type __pos=0) const noexcept { ((void)0); return __str_find_first_not_of<value_type, size_type, traits_type, npos> (data(), size(), __s.data(), __pos, __s.size()); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_first_not_of(_CharT __c, size_type __pos=0) const noexcept { return __str_find_first_not_of<value_type, size_type, traits_type, npos> (data(), size(), __c, __pos); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const { ((void)0); return __str_find_first_not_of<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, __n); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_first_not_of(const _CharT* __s, size_type __pos=0) const { ((void)0); return __str_find_first_not_of<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, traits_type::length(__s)); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_last_not_of(basic_string_view __s, size_type __pos=npos) const noexcept { ((void)0); return __str_find_last_not_of<value_type, size_type, traits_type, npos> (data(), size(), __s.data(), __pos, __s.size()); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_last_not_of(_CharT __c, size_type __pos=npos) const noexcept { return __str_find_last_not_of<value_type, size_type, traits_type, npos> (data(), size(), __c, __pos); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const { ((void)0); return __str_find_last_not_of<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, __n); } constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_last_not_of(const _CharT* __s, size_type __pos=npos) const { ((void)0); return __str_find_last_not_of<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, traits_type::length(__s)); } private: const value_type* __data; size_type __size; }; template<class _CharT, class _Traits> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) noexcept { if ( __lhs.size() != __rhs.size()) return false; return __lhs.compare(__rhs) == 0; } template<class _CharT, class _Traits> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(basic_string_view<_CharT, _Traits> __lhs, typename common_type<basic_string_view<_CharT, _Traits> >::type __rhs) noexcept { if ( __lhs.size() != __rhs.size()) return false; return __lhs.compare(__rhs) == 0; } template<class _CharT, class _Traits> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, basic_string_view<_CharT, _Traits> __rhs) noexcept { if ( __lhs.size() != __rhs.size()) return false; return __lhs.compare(__rhs) == 0; } template<class _CharT, class _Traits> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) noexcept { if ( __lhs.size() != __rhs.size()) return true; return __lhs.compare(__rhs) != 0; } template<class _CharT, class _Traits> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(basic_string_view<_CharT, _Traits> __lhs, typename common_type<basic_string_view<_CharT, _Traits> >::type __rhs) noexcept { if ( __lhs.size() != __rhs.size()) return true; return __lhs.compare(__rhs) != 0; } template<class _CharT, class _Traits> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, basic_string_view<_CharT, _Traits> __rhs) noexcept { if ( __lhs.size() != __rhs.size()) return true; return __lhs.compare(__rhs) != 0; } template<class _CharT, class _Traits> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) noexcept { return __lhs.compare(__rhs) < 0; } template<class _CharT, class _Traits> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<(basic_string_view<_CharT, _Traits> __lhs, typename common_type<basic_string_view<_CharT, _Traits> >::type __rhs) noexcept { return __lhs.compare(__rhs) < 0; } template<class _CharT, class _Traits> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, basic_string_view<_CharT, _Traits> __rhs) noexcept { return __lhs.compare(__rhs) < 0; } template<class _CharT, class _Traits> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator> (basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) noexcept { return __lhs.compare(__rhs) > 0; } template<class _CharT, class _Traits> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>(basic_string_view<_CharT, _Traits> __lhs, typename common_type<basic_string_view<_CharT, _Traits> >::type __rhs) noexcept { return __lhs.compare(__rhs) > 0; } template<class _CharT, class _Traits> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, basic_string_view<_CharT, _Traits> __rhs) noexcept { return __lhs.compare(__rhs) > 0; } template<class _CharT, class _Traits> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) noexcept { return __lhs.compare(__rhs) <= 0; } template<class _CharT, class _Traits> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(basic_string_view<_CharT, _Traits> __lhs, typename common_type<basic_string_view<_CharT, _Traits> >::type __rhs) noexcept { return __lhs.compare(__rhs) <= 0; } template<class _CharT, class _Traits> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, basic_string_view<_CharT, _Traits> __rhs) noexcept { return __lhs.compare(__rhs) <= 0; } template<class _CharT, class _Traits> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) noexcept { return __lhs.compare(__rhs) >= 0; } template<class _CharT, class _Traits> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(basic_string_view<_CharT, _Traits> __lhs, typename common_type<basic_string_view<_CharT, _Traits> >::type __rhs) noexcept { return __lhs.compare(__rhs) >= 0; } template<class _CharT, class _Traits> constexpr __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, basic_string_view<_CharT, _Traits> __rhs) noexcept { return __lhs.compare(__rhs) >= 0; } template<class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, basic_string_view<_CharT, _Traits> __str); typedef basic_string_view<char> string_view; typedef basic_string_view<char16_t> u16string_view; typedef basic_string_view<char32_t> u32string_view; typedef basic_string_view<wchar_t> wstring_view; template<class _CharT> struct hash<basic_string_view<_CharT, char_traits<_CharT> > > : public unary_function<basic_string_view<_CharT, char_traits<_CharT> >, size_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(const basic_string_view<_CharT, char_traits<_CharT> > __val) const noexcept { return __do_string_hash(__val.data(), __val.data() + __val.size()); } }; inline namespace literals { inline namespace string_view_literals { inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr basic_string_view<char> operator "" sv(const char *__str, size_t __len) noexcept { return basic_string_view<char> (__str, __len); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr basic_string_view<wchar_t> operator "" sv(const wchar_t *__str, size_t __len) noexcept { return basic_string_view<wchar_t> (__str, __len); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr basic_string_view<char16_t> operator "" sv(const char16_t *__str, size_t __len) noexcept { return basic_string_view<char16_t> (__str, __len); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr basic_string_view<char32_t> operator "" sv(const char32_t *__str, size_t __len) noexcept { return basic_string_view<char32_t> (__str, __len); } } } } } #pragma pack(push, 8) extern "C" { int __cdecl _isctype( int _C, int _Type); int __cdecl _isctype_l( int _C, int _Type, _locale_t _Locale); int __cdecl isalpha( int _C); int __cdecl _isalpha_l( int _C, _locale_t _Locale); int __cdecl isupper( int _C); int __cdecl _isupper_l( int _C, _locale_t _Locale); int __cdecl islower( int _C); int __cdecl _islower_l( int _C, _locale_t _Locale); int __cdecl isdigit( int _C); int __cdecl _isdigit_l( int _C, _locale_t _Locale); int __cdecl isxdigit( int _C); int __cdecl _isxdigit_l( int _C, _locale_t _Locale); int __cdecl isspace( int _C); int __cdecl _isspace_l( int _C, _locale_t _Locale); int __cdecl ispunct( int _C); int __cdecl _ispunct_l( int _C, _locale_t _Locale); int __cdecl isblank( int _C); int __cdecl _isblank_l( int _C, _locale_t _Locale); int __cdecl isalnum( int _C); int __cdecl _isalnum_l( int _C, _locale_t _Locale); int __cdecl isprint( int _C); int __cdecl _isprint_l( int _C, _locale_t _Locale); int __cdecl isgraph( int _C); int __cdecl _isgraph_l( int _C, _locale_t _Locale); int __cdecl iscntrl( int _C); int __cdecl _iscntrl_l( int _C, _locale_t _Locale); int __cdecl toupper( int _C); int __cdecl tolower( int _C); int __cdecl _tolower( int _C); int __cdecl _tolower_l( int _C, _locale_t _Locale); int __cdecl _toupper( int _C); int __cdecl _toupper_l( int _C, _locale_t _Locale); int __cdecl __isascii( int _C); int __cdecl __toascii( int _C); int __cdecl __iscsymf( int _C); 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; } __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; } __inline int __cdecl _chvalidchk_l( int const _C, int const _Mask, _locale_t const _Locale ) { if (_Locale) { return __acrt_locale_get_ctype_array_value(__acrt_get_locale_data_prefix(_Locale)->_locale_pctype, _C, _Mask); } return (__acrt_locale_get_ctype_array_value(__pctype_func(), (_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) namespace std { inline namespace __1 { using ::isalnum; using ::isalpha; using ::isblank; using ::iscntrl; using ::isdigit; using ::isgraph; using ::islower; using ::isprint; using ::ispunct; using ::isspace; using ::isupper; using ::isxdigit; using ::tolower; using ::toupper; } } #pragma pack(push, 8) extern "C" { typedef wchar_t wctrans_t; wint_t __cdecl towctrans(wint_t c, wctrans_t value); wctrans_t __cdecl wctrans(const char *name); wctype_t __cdecl wctype(const char *name); } #pragma pack(pop) namespace std { inline namespace __1 { using ::wint_t; using ::wctrans_t; using ::wctype_t; using ::iswalnum; using ::iswalpha; using ::iswblank; using ::iswcntrl; using ::iswdigit; using ::iswgraph; using ::iswlower; using ::iswprint; using ::iswpunct; using ::iswspace; using ::iswupper; using ::iswxdigit; using ::iswctype; using ::wctype; using ::towlower; using ::towupper; using ::towctrans; using ::wctrans; } } namespace std { inline namespace __1 { using ::mbstate_t; using ::size_t; using ::tm; using ::wint_t; using ::FILE; using ::fwprintf; using ::fwscanf; using ::swprintf; using ::vfwprintf; using ::vswprintf; using ::swscanf; using ::vfwscanf; using ::vswscanf; using ::fgetwc; using ::fgetws; using ::fputwc; using ::fputws; using ::fwide; using ::getwc; using ::putwc; using ::ungetwc; using ::wcstod; using ::wcstof; using ::wcstold; using ::wcstol; using ::wcstoll; using ::wcstoul; using ::wcstoull; using ::wcscpy; using ::wcsncpy; using ::wcscat; using ::wcsncat; using ::wcscmp; using ::wcscoll; using ::wcsncmp; using ::wcsxfrm; using ::wcschr; using ::wcspbrk; using ::wcsrchr; using ::wcsstr; using ::wmemchr; using ::wcscspn; using ::wcslen; using ::wcsspn; using ::wcstok; using ::wmemcmp; using ::wmemcpy; using ::wmemmove; using ::wmemset; using ::wcsftime; using ::btowc; using ::wctob; using ::mbsinit; using ::mbrlen; using ::mbrtowc; using ::wcrtomb; using ::mbsrtowcs; using ::wcsrtombs; using ::getwchar; using ::vwscanf; using ::wscanf; using ::putwchar; using ::vwprintf; using ::wprintf; } } namespace std { inline namespace __1 { template <class _StateT> class fpos { private: _StateT __st_; streamoff __off_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) fpos(streamoff __off = streamoff()) : __st_(), __off_(__off) {} __attribute__ ((__exclude_from_explicit_instantiation__)) operator streamoff() const {return __off_;} __attribute__ ((__exclude_from_explicit_instantiation__)) _StateT state() const {return __st_;} __attribute__ ((__exclude_from_explicit_instantiation__)) void state(_StateT __st) {__st_ = __st;} __attribute__ ((__exclude_from_explicit_instantiation__)) fpos& operator+=(streamoff __off) {__off_ += __off; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) fpos operator+ (streamoff __off) const {fpos __t(*this); __t += __off; return __t;} __attribute__ ((__exclude_from_explicit_instantiation__)) fpos& operator-=(streamoff __off) {__off_ -= __off; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) fpos operator- (streamoff __off) const {fpos __t(*this); __t -= __off; return __t;} }; template <class _StateT> inline __attribute__ ((__exclude_from_explicit_instantiation__)) streamoff operator-(const fpos<_StateT>& __x, const fpos<_StateT>& __y) {return streamoff(__x) - streamoff(__y);} template <class _StateT> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const fpos<_StateT>& __x, const fpos<_StateT>& __y) {return streamoff(__x) == streamoff(__y);} template <class _StateT> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const fpos<_StateT>& __x, const fpos<_StateT>& __y) {return streamoff(__x) != streamoff(__y);} template<class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator> operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, const basic_string<_CharT, _Traits, _Allocator>& __y); template<class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator> operator+(const _CharT* __x, const basic_string<_CharT,_Traits,_Allocator>& __y); template<class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator> operator+(_CharT __x, const basic_string<_CharT,_Traits,_Allocator>& __y); template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string<_CharT, _Traits, _Allocator> operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, const _CharT* __y); template<class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator> operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, _CharT __y); extern template string operator+<char, char_traits<char>, allocator<char> >(char const*, string const&); template <bool> class __basic_string_common { protected: [[noreturn]] void __throw_length_error() const; [[noreturn]] void __throw_out_of_range() const; }; template <bool __b> void __basic_string_common<__b>::__throw_length_error() const { std::__1::__throw_length_error("basic_string"); } template <bool __b> void __basic_string_common<__b>::__throw_out_of_range() const { std::__1::__throw_out_of_range("basic_string"); } extern template class __basic_string_common<true>; template <class _Iter> struct __libcpp_string_gets_noexcept_iterator_impl : public true_type {}; template <class _Iter> struct __libcpp_string_gets_noexcept_iterator : public integral_constant<bool,(__libcpp_is_trivial_iterator<_Iter>::value || __libcpp_string_gets_noexcept_iterator_impl<_Iter>::value)> {}; template <class _CharT, class _Traits, class _Tp> struct __can_be_converted_to_string_view : public integral_constant<bool,(( is_convertible<const _Tp&, basic_string_view<_CharT, _Traits> >::value && !is_convertible<const _Tp&, const _CharT*>::value))> {}; template <class _CharT, size_t = sizeof(_CharT)> struct __padding { unsigned char __xx[sizeof(_CharT)-1]; }; template <class _CharT> struct __padding<_CharT, 1> { }; template<class _CharT, class _Traits, class _Allocator> class basic_string : private __basic_string_common<true> { public: typedef basic_string __self; typedef basic_string_view<_CharT, _Traits> __self_view; typedef _Traits traits_type; typedef _CharT value_type; typedef _Allocator allocator_type; typedef allocator_traits<allocator_type> __alloc_traits; typedef typename __alloc_traits::size_type size_type; typedef typename __alloc_traits::difference_type difference_type; typedef value_type& reference; typedef const value_type& const_reference; typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::const_pointer const_pointer; static_assert((!is_array<value_type>::value), "Character type of basic_string must not be an array"); static_assert(( is_standard_layout<value_type>::value), "Character type of basic_string must be standard-layout"); static_assert(( is_trivial<value_type>::value), "Character type of basic_string must be trivial"); static_assert(( is_same<_CharT, typename traits_type::char_type>::value), "traits_type::char_type must be the same type as CharT"); static_assert(( is_same<typename allocator_type::value_type, value_type>::value), "Allocator::value_type must be same type as value_type"); typedef __wrap_iter<pointer> iterator; typedef __wrap_iter<const_pointer> const_iterator; typedef std::__1::reverse_iterator<iterator> reverse_iterator; typedef std::__1::reverse_iterator<const_iterator> const_reverse_iterator; private: struct __long { pointer __data_; size_type __size_; size_type __cap_; }; static const size_type __short_mask = 0x80; static const size_type __long_mask = ~(size_type(~0) >> 1); enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ? (sizeof(__long) - 1)/sizeof(value_type) : 2}; struct __short { value_type __data_[__min_cap]; struct : __padding<value_type> { unsigned char __size_; }; }; union __ulx{__long __lx; __short __lxx;}; enum {__n_words = sizeof(__ulx) / sizeof(size_type)}; struct __raw { size_type __words[__n_words]; }; struct __rep { union { __long __l; __short __s; __raw __r; }; }; __compressed_pair<__rep, allocator_type> __r_; public: static const size_type npos = -1; __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string() noexcept(is_nothrow_default_constructible<allocator_type>::value); __attribute__ ((__exclude_from_explicit_instantiation__)) explicit basic_string(const allocator_type& __a) noexcept(is_nothrow_copy_constructible<allocator_type>::value); basic_string(const basic_string& __str); basic_string(const basic_string& __str, const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string(basic_string&& __str) noexcept(is_nothrow_move_constructible<allocator_type>::value); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string(basic_string&& __str, const allocator_type& __a); template <class = typename enable_if<__is_allocator<_Allocator>::value, nullptr_t>::type> __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string(const _CharT* __s) { ((void)0); __init(__s, traits_type::length(__s)); } template <class = typename enable_if<__is_allocator<_Allocator>::value, nullptr_t>::type> __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string(const _CharT* __s, const _Allocator& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string(const _CharT* __s, size_type __n); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string(const _CharT* __s, size_type __n, const _Allocator& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string(size_type __n, _CharT __c); template <class = typename enable_if<__is_allocator<_Allocator>::value, nullptr_t>::type> __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string(size_type __n, _CharT __c, const _Allocator& __a); basic_string(const basic_string& __str, size_type __pos, size_type __n, const _Allocator& __a = _Allocator()); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string(const basic_string& __str, size_type __pos, const _Allocator& __a = _Allocator()); template<class _Tp, class = typename enable_if<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, void>::type> basic_string(const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a = allocator_type()); template<class _Tp, class = typename enable_if<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, void>::type> explicit basic_string(const _Tp& __t); template<class _Tp, class = typename enable_if<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, void>::type> explicit basic_string(const _Tp& __t, const allocator_type& __a); template<class _InputIterator, class = typename enable_if<__is_input_iterator<_InputIterator>::value>::type> __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string(_InputIterator __first, _InputIterator __last); template<class _InputIterator, class = typename enable_if<__is_input_iterator<_InputIterator>::value>::type> __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string(initializer_list<_CharT> __il); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string(initializer_list<_CharT> __il, const _Allocator& __a); inline ~basic_string(); __attribute__ ((__exclude_from_explicit_instantiation__)) operator __self_view() const noexcept { return __self_view(data(), size()); } basic_string& operator=(const basic_string& __str); template <class _Tp, class = typename enable_if<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, void>::type> basic_string& operator=(const _Tp& __t) {__self_view __sv = __t; return assign(__sv);} __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string& operator=(basic_string&& __str) noexcept((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string& operator=(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());} __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string& operator=(const value_type* __s) {return assign(__s);} basic_string& operator=(value_type __c); __attribute__ ((__exclude_from_explicit_instantiation__)) iterator begin() noexcept {return iterator(__get_pointer());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator begin() const noexcept {return const_iterator(__get_pointer());} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator end() noexcept {return iterator(__get_pointer() + size());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator end() const noexcept {return const_iterator(__get_pointer() + size());} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator rbegin() noexcept {return reverse_iterator(end());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator rbegin() const noexcept {return const_reverse_iterator(end());} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator rend() noexcept {return reverse_iterator(begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator rend() const noexcept {return const_reverse_iterator(begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cbegin() const noexcept {return begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cend() const noexcept {return end();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator crbegin() const noexcept {return rbegin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator crend() const noexcept {return rend();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type size() const noexcept {return __is_long() ? __get_long_size() : __get_short_size();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type length() const noexcept {return size();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type max_size() const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) size_type capacity() const noexcept {return (__is_long() ? __get_long_cap() : static_cast<size_type>(__min_cap)) - 1;} void resize(size_type __n, value_type __c); __attribute__ ((__exclude_from_explicit_instantiation__)) void resize(size_type __n) {resize(__n, value_type());} void reserve(size_type __res_arg); __attribute__ ((__exclude_from_explicit_instantiation__)) void __resize_default_init(size_type __n); __attribute__ ((__exclude_from_explicit_instantiation__)) void reserve() noexcept {reserve(0);} __attribute__ ((__exclude_from_explicit_instantiation__)) void shrink_to_fit() noexcept {reserve();} __attribute__ ((__exclude_from_explicit_instantiation__)) void clear() noexcept; [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) bool empty() const noexcept {return size() == 0;} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference operator[](size_type __pos) const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator[](size_type __pos) noexcept; const_reference at(size_type __n) const; reference at(size_type __n); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string& operator+=(const basic_string& __str) {return append(__str);} template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, basic_string& >::type operator+=(const _Tp& __t) {__self_view __sv = __t; return append(__sv);} __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string& operator+=(const value_type* __s) {return append(__s);} __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string& operator+=(value_type __c) {push_back(__c); return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string& operator+=(initializer_list<value_type> __il) {return append(__il);} __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string& append(const basic_string& __str); template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, basic_string& >::type append(const _Tp& __t) { __self_view __sv = __t; return append(__sv.data(), __sv.size()); } basic_string& append(const basic_string& __str, size_type __pos, size_type __n=npos); template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, basic_string& >::type append(const _Tp& __t, size_type __pos, size_type __n=npos); basic_string& append(const value_type* __s, size_type __n); basic_string& append(const value_type* __s); basic_string& append(size_type __n, value_type __c); __attribute__ ((__exclude_from_explicit_instantiation__)) void __append_default_init(size_type __n); template <class _ForwardIterator> basic_string& __append_forward_unsafe(_ForwardIterator, _ForwardIterator); template<class _InputIterator> typename enable_if < __is_exactly_input_iterator<_InputIterator>::value || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value, basic_string& >::type __attribute__ ((__exclude_from_explicit_instantiation__)) append(_InputIterator __first, _InputIterator __last) { const basic_string __temp (__first, __last, __alloc()); append(__temp.data(), __temp.size()); return *this; } template<class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value, basic_string& >::type __attribute__ ((__exclude_from_explicit_instantiation__)) append(_ForwardIterator __first, _ForwardIterator __last) { return __append_forward_unsafe(__first, __last); } __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string& append(initializer_list<value_type> __il) {return append(__il.begin(), __il.size());} void push_back(value_type __c); __attribute__ ((__exclude_from_explicit_instantiation__)) void pop_back(); __attribute__ ((__exclude_from_explicit_instantiation__)) reference front() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference front() const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) reference back() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference back() const noexcept; template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, basic_string& >::type assign(const _Tp & __t) { __self_view __sv = __t; return assign(__sv.data(), __sv.size()); } __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string& assign(const basic_string& __str) { return *this = __str; } __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string& assign(basic_string&& __str) noexcept((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) {*this = std::__1::move(__str); return *this;} basic_string& assign(const basic_string& __str, size_type __pos, size_type __n=npos); template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, basic_string& >::type assign(const _Tp & __t, size_type __pos, size_type __n=npos); basic_string& assign(const value_type* __s, size_type __n); basic_string& assign(const value_type* __s); basic_string& assign(size_type __n, value_type __c); template<class _InputIterator> typename enable_if < __is_exactly_input_iterator<_InputIterator>::value || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value, basic_string& >::type assign(_InputIterator __first, _InputIterator __last); template<class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value, basic_string& >::type assign(_ForwardIterator __first, _ForwardIterator __last); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string& assign(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());} __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string& insert(size_type __pos1, const basic_string& __str); template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, basic_string& >::type insert(size_type __pos1, const _Tp& __t) { __self_view __sv = __t; return insert(__pos1, __sv.data(), __sv.size()); } template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, basic_string& >::type insert(size_type __pos1, const _Tp& __t, size_type __pos2, size_type __n=npos); basic_string& insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n=npos); basic_string& insert(size_type __pos, const value_type* __s, size_type __n); basic_string& insert(size_type __pos, const value_type* __s); basic_string& insert(size_type __pos, size_type __n, value_type __c); iterator insert(const_iterator __pos, value_type __c); __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const_iterator __pos, size_type __n, value_type __c); template<class _InputIterator> typename enable_if < __is_exactly_input_iterator<_InputIterator>::value || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value, iterator >::type insert(const_iterator __pos, _InputIterator __first, _InputIterator __last); template<class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value, iterator >::type insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last); __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const_iterator __pos, initializer_list<value_type> __il) {return insert(__pos, __il.begin(), __il.end());} basic_string& erase(size_type __pos = 0, size_type __n = npos); __attribute__ ((__exclude_from_explicit_instantiation__)) iterator erase(const_iterator __pos); __attribute__ ((__exclude_from_explicit_instantiation__)) iterator erase(const_iterator __first, const_iterator __last); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str); template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, basic_string& >::type replace(size_type __pos1, size_type __n1, const _Tp& __t) { __self_view __sv = __t; return replace(__pos1, __n1, __sv.data(), __sv.size()); } basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2=npos); template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, basic_string& >::type replace(size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2=npos); basic_string& replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2); basic_string& replace(size_type __pos, size_type __n1, const value_type* __s); basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string& replace(const_iterator __i1, const_iterator __i2, const basic_string& __str); template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, basic_string& >::type replace(const_iterator __i1, const_iterator __i2, const _Tp& __t) { __self_view __sv = __t; return replace(__i1 - begin(), __i2 - __i1, __sv); } __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string& replace(const_iterator __i1, const_iterator __i2, const value_type* __s, size_type __n); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string& replace(const_iterator __i1, const_iterator __i2, const value_type* __s); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string& replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c); template<class _InputIterator> typename enable_if < __is_input_iterator<_InputIterator>::value, basic_string& >::type replace(const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string& replace(const_iterator __i1, const_iterator __i2, initializer_list<value_type> __il) {return replace(__i1, __i2, __il.begin(), __il.end());} size_type copy(value_type* __s, size_type __n, size_type __pos = 0) const; __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string substr(size_type __pos = 0, size_type __n = npos) const; __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(basic_string& __str) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) const value_type* c_str() const noexcept {return data();} __attribute__ ((__exclude_from_explicit_instantiation__)) const value_type* data() const noexcept {return std::__1::__to_raw_pointer(__get_pointer());} __attribute__ ((__exclude_from_explicit_instantiation__)) allocator_type get_allocator() const noexcept {return __alloc();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find(const basic_string& __str, size_type __pos = 0) const noexcept; template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, size_type >::type find(const _Tp& __t, size_type __pos = 0) const; size_type find(const value_type* __s, size_type __pos, size_type __n) const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find(const value_type* __s, size_type __pos = 0) const noexcept; size_type find(value_type __c, size_type __pos = 0) const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) size_type rfind(const basic_string& __str, size_type __pos = npos) const noexcept; template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, size_type >::type rfind(const _Tp& __t, size_type __pos = npos) const; size_type rfind(const value_type* __s, size_type __pos, size_type __n) const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) size_type rfind(const value_type* __s, size_type __pos = npos) const noexcept; size_type rfind(value_type __c, size_type __pos = npos) const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_first_of(const basic_string& __str, size_type __pos = 0) const noexcept; template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, size_type >::type find_first_of(const _Tp& __t, size_type __pos = 0) const; size_type find_first_of(const value_type* __s, size_type __pos, size_type __n) const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_first_of(const value_type* __s, size_type __pos = 0) const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_first_of(value_type __c, size_type __pos = 0) const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_last_of(const basic_string& __str, size_type __pos = npos) const noexcept; template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, size_type >::type find_last_of(const _Tp& __t, size_type __pos = npos) const; size_type find_last_of(const value_type* __s, size_type __pos, size_type __n) const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_last_of(const value_type* __s, size_type __pos = npos) const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_last_of(value_type __c, size_type __pos = npos) const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const noexcept; template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, size_type >::type find_first_not_of(const _Tp &__t, size_type __pos = 0) const; size_type find_first_not_of(const value_type* __s, size_type __pos, size_type __n) const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_first_not_of(const value_type* __s, size_type __pos = 0) const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_first_not_of(value_type __c, size_type __pos = 0) const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const noexcept; template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, size_type >::type find_last_not_of(const _Tp& __t, size_type __pos = npos) const; size_type find_last_not_of(const value_type* __s, size_type __pos, size_type __n) const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_last_not_of(const value_type* __s, size_type __pos = npos) const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) size_type find_last_not_of(value_type __c, size_type __pos = npos) const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) int compare(const basic_string& __str) const noexcept; template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int >::type compare(const _Tp &__t) const; template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int >::type compare(size_type __pos1, size_type __n1, const _Tp& __t) const; __attribute__ ((__exclude_from_explicit_instantiation__)) int compare(size_type __pos1, size_type __n1, const basic_string& __str) const; int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2=npos) const; template <class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int >::type compare(size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2=npos) const; int compare(const value_type* __s) const noexcept; int compare(size_type __pos1, size_type __n1, const value_type* __s) const; int compare(size_type __pos1, size_type __n1, const value_type* __s, size_type __n2) const; __attribute__ ((__exclude_from_explicit_instantiation__)) bool __invariants() const; __attribute__ ((__exclude_from_explicit_instantiation__)) void __clear_and_shrink() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) bool __is_long() const noexcept {return bool(__r_.first().__s.__size_ & __short_mask);} private: __attribute__ ((__exclude_from_explicit_instantiation__)) allocator_type& __alloc() noexcept {return __r_.second();} __attribute__ ((__exclude_from_explicit_instantiation__)) const allocator_type& __alloc() const noexcept {return __r_.second();} __attribute__ ((__exclude_from_explicit_instantiation__)) void __set_short_size(size_type __s) noexcept {__r_.first().__s.__size_ = (unsigned char)(__s);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type __get_short_size() const noexcept {return __r_.first().__s.__size_;} __attribute__ ((__exclude_from_explicit_instantiation__)) void __set_long_size(size_type __s) noexcept {__r_.first().__l.__size_ = __s;} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type __get_long_size() const noexcept {return __r_.first().__l.__size_;} __attribute__ ((__exclude_from_explicit_instantiation__)) void __set_size(size_type __s) noexcept {if (__is_long()) __set_long_size(__s); else __set_short_size(__s);} __attribute__ ((__exclude_from_explicit_instantiation__)) void __set_long_cap(size_type __s) noexcept {__r_.first().__l.__cap_ = __long_mask | __s;} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type __get_long_cap() const noexcept {return __r_.first().__l.__cap_ & size_type(~__long_mask);} __attribute__ ((__exclude_from_explicit_instantiation__)) void __set_long_pointer(pointer __p) noexcept {__r_.first().__l.__data_ = __p;} __attribute__ ((__exclude_from_explicit_instantiation__)) pointer __get_long_pointer() noexcept {return __r_.first().__l.__data_;} __attribute__ ((__exclude_from_explicit_instantiation__)) const_pointer __get_long_pointer() const noexcept {return __r_.first().__l.__data_;} __attribute__ ((__exclude_from_explicit_instantiation__)) pointer __get_short_pointer() noexcept {return pointer_traits<pointer>::pointer_to(__r_.first().__s.__data_[0]);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_pointer __get_short_pointer() const noexcept {return pointer_traits<const_pointer>::pointer_to(__r_.first().__s.__data_[0]);} __attribute__ ((__exclude_from_explicit_instantiation__)) pointer __get_pointer() noexcept {return __is_long() ? __get_long_pointer() : __get_short_pointer();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_pointer __get_pointer() const noexcept {return __is_long() ? __get_long_pointer() : __get_short_pointer();} __attribute__ ((__exclude_from_explicit_instantiation__)) void __zero() noexcept { size_type (&__a)[__n_words] = __r_.first().__r.__words; for (unsigned __i = 0; __i < __n_words; ++__i) __a[__i] = 0; } template <size_type __a> static __attribute__ ((__exclude_from_explicit_instantiation__)) size_type __align_it(size_type __s) noexcept {return (__s + (__a-1)) & ~(__a-1);} enum {__alignment = 16}; static __attribute__ ((__exclude_from_explicit_instantiation__)) size_type __recommend(size_type __s) noexcept { if (__s < __min_cap) return static_cast<size_type>(__min_cap) - 1; size_type __guess = __align_it<sizeof(value_type) < __alignment ? __alignment/sizeof(value_type) : 1 > (__s+1) - 1; if (__guess == __min_cap) ++__guess; return __guess; } inline void __init(const value_type* __s, size_type __sz, size_type __reserve); inline void __init(const value_type* __s, size_type __sz); inline void __init(size_type __n, value_type __c); template <class _InputIterator> inline typename enable_if < __is_exactly_input_iterator<_InputIterator>::value, void >::type __init(_InputIterator __first, _InputIterator __last); template <class _ForwardIterator> inline typename enable_if < __is_forward_iterator<_ForwardIterator>::value, void >::type __init(_ForwardIterator __first, _ForwardIterator __last); void __grow_by(size_type __old_cap, size_type __delta_cap, size_type __old_sz, size_type __n_copy, size_type __n_del, size_type __n_add = 0); void __grow_by_and_replace(size_type __old_cap, size_type __delta_cap, size_type __old_sz, size_type __n_copy, size_type __n_del, size_type __n_add, const value_type* __p_new_stuff); __attribute__ ((__exclude_from_explicit_instantiation__)) void __erase_to_end(size_type __pos); __attribute__ ((__exclude_from_explicit_instantiation__)) void __copy_assign_alloc(const basic_string& __str) {__copy_assign_alloc(__str, integral_constant<bool, __alloc_traits::propagate_on_container_copy_assignment::value>());} __attribute__ ((__exclude_from_explicit_instantiation__)) void __copy_assign_alloc(const basic_string& __str, true_type) { if (__alloc() == __str.__alloc()) __alloc() = __str.__alloc(); else { if (!__str.__is_long()) { __clear_and_shrink(); __alloc() = __str.__alloc(); } else { allocator_type __a = __str.__alloc(); pointer __p = __alloc_traits::allocate(__a, __str.__get_long_cap()); __clear_and_shrink(); __alloc() = std::__1::move(__a); __set_long_pointer(__p); __set_long_cap(__str.__get_long_cap()); __set_long_size(__str.size()); } } } __attribute__ ((__exclude_from_explicit_instantiation__)) void __copy_assign_alloc(const basic_string&, false_type) noexcept {} __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign(basic_string& __str, false_type) noexcept(__alloc_traits::is_always_equal::value); __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign(basic_string& __str, true_type) noexcept(is_nothrow_move_assignable<allocator_type>::value); __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(basic_string& __str) noexcept(!__alloc_traits::propagate_on_container_move_assignment::value || is_nothrow_move_assignable<allocator_type>::value) {__move_assign_alloc(__str, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());} __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(basic_string& __c, true_type) noexcept(is_nothrow_move_assignable<allocator_type>::value) { __alloc() = std::__1::move(__c.__alloc()); } __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(basic_string&, false_type) noexcept {} __attribute__ ((__exclude_from_explicit_instantiation__)) void __invalidate_all_iterators(); __attribute__ ((__exclude_from_explicit_instantiation__)) void __invalidate_iterators_past(size_type); friend basic_string operator+<>(const basic_string&, const basic_string&); friend basic_string operator+<>(const value_type*, const basic_string&); friend basic_string operator+<>(value_type, const basic_string&); friend basic_string operator+<>(const basic_string&, const value_type*); friend basic_string operator+<>(const basic_string&, value_type); }; template <class _CharT, class _Traits, class _Allocator> inline void basic_string<_CharT, _Traits, _Allocator>::__invalidate_all_iterators() { } template <class _CharT, class _Traits, class _Allocator> inline void basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type ) { } template <class _CharT, class _Traits, class _Allocator> inline basic_string<_CharT, _Traits, _Allocator>::basic_string() noexcept(is_nothrow_default_constructible<allocator_type>::value) { __zero(); } template <class _CharT, class _Traits, class _Allocator> inline basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __a) noexcept(is_nothrow_copy_constructible<allocator_type>::value) : __r_(__second_tag(), __a) { __zero(); } template <class _CharT, class _Traits, class _Allocator> void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz, size_type __reserve) { if (__reserve > max_size()) this->__throw_length_error(); pointer __p; if (__reserve < __min_cap) { __set_short_size(__sz); __p = __get_short_pointer(); } else { size_type __cap = __recommend(__reserve); __p = __alloc_traits::allocate(__alloc(), __cap+1); __set_long_pointer(__p); __set_long_cap(__cap+1); __set_long_size(__sz); } traits_type::copy(std::__1::__to_raw_pointer(__p), __s, __sz); traits_type::assign(__p[__sz], value_type()); } template <class _CharT, class _Traits, class _Allocator> void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz) { if (__sz > max_size()) this->__throw_length_error(); pointer __p; if (__sz < __min_cap) { __set_short_size(__sz); __p = __get_short_pointer(); } else { size_type __cap = __recommend(__sz); __p = __alloc_traits::allocate(__alloc(), __cap+1); __set_long_pointer(__p); __set_long_cap(__cap+1); __set_long_size(__sz); } traits_type::copy(std::__1::__to_raw_pointer(__p), __s, __sz); traits_type::assign(__p[__sz], value_type()); } template <class _CharT, class _Traits, class _Allocator> template <class> basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const _Allocator& __a) : __r_(__second_tag(), __a) { ((void)0); __init(__s, traits_type::length(__s)); } template <class _CharT, class _Traits, class _Allocator> inline basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n) { ((void)0); __init(__s, __n); } template <class _CharT, class _Traits, class _Allocator> inline basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n, const _Allocator& __a) : __r_(__second_tag(), __a) { ((void)0); __init(__s, __n); } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str) : __r_(__second_tag(), __alloc_traits::select_on_container_copy_construction(__str.__alloc())) { if (!__str.__is_long()) __r_.first().__r = __str.__r_.first().__r; else __init(std::__1::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size()); } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>::basic_string( const basic_string& __str, const allocator_type& __a) : __r_(__second_tag(), __a) { if (!__str.__is_long()) __r_.first().__r = __str.__r_.first().__r; else __init(std::__1::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size()); } template <class _CharT, class _Traits, class _Allocator> inline basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str) noexcept(is_nothrow_move_constructible<allocator_type>::value) : __r_(std::__1::move(__str.__r_)) { __str.__zero(); } template <class _CharT, class _Traits, class _Allocator> inline basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, const allocator_type& __a) : __r_(__second_tag(), __a) { if (__str.__is_long() && __a != __str.__alloc()) __init(std::__1::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size()); else { __r_.first().__r = __str.__r_.first().__r; __str.__zero(); } } template <class _CharT, class _Traits, class _Allocator> void basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c) { if (__n > max_size()) this->__throw_length_error(); pointer __p; if (__n < __min_cap) { __set_short_size(__n); __p = __get_short_pointer(); } else { size_type __cap = __recommend(__n); __p = __alloc_traits::allocate(__alloc(), __cap+1); __set_long_pointer(__p); __set_long_cap(__cap+1); __set_long_size(__n); } traits_type::assign(std::__1::__to_raw_pointer(__p), __n, __c); traits_type::assign(__p[__n], value_type()); } template <class _CharT, class _Traits, class _Allocator> inline basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c) { __init(__n, __c); } template <class _CharT, class _Traits, class _Allocator> template <class> basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c, const _Allocator& __a) : __r_(__second_tag(), __a) { __init(__n, __c); } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos, size_type __n, const _Allocator& __a) : __r_(__second_tag(), __a) { size_type __str_sz = __str.size(); if (__pos > __str_sz) this->__throw_out_of_range(); __init(__str.data() + __pos, std::__1::min(__n, __str_sz - __pos)); } template <class _CharT, class _Traits, class _Allocator> inline basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos, const _Allocator& __a) : __r_(__second_tag(), __a) { size_type __str_sz = __str.size(); if (__pos > __str_sz) this->__throw_out_of_range(); __init(__str.data() + __pos, __str_sz - __pos); } template <class _CharT, class _Traits, class _Allocator> template <class _Tp, class> basic_string<_CharT, _Traits, _Allocator>::basic_string( const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a) : __r_(__second_tag(), __a) { __self_view __sv0 = __t; __self_view __sv = __sv0.substr(__pos, __n); __init(__sv.data(), __sv.size()); } template <class _CharT, class _Traits, class _Allocator> template <class _Tp, class> basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t) { __self_view __sv = __t; __init(__sv.data(), __sv.size()); } template <class _CharT, class _Traits, class _Allocator> template <class _Tp, class> basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t, const _Allocator& __a) : __r_(__second_tag(), __a) { __self_view __sv = __t; __init(__sv.data(), __sv.size()); } template <class _CharT, class _Traits, class _Allocator> template <class _InputIterator> typename enable_if < __is_exactly_input_iterator<_InputIterator>::value, void >::type basic_string<_CharT, _Traits, _Allocator>::__init(_InputIterator __first, _InputIterator __last) { __zero(); for (; __first != __last; ++__first) push_back(*__first); } template <class _CharT, class _Traits, class _Allocator> template <class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value, void >::type basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _ForwardIterator __last) { size_type __sz = static_cast<size_type>(std::__1::distance(__first, __last)); if (__sz > max_size()) this->__throw_length_error(); pointer __p; if (__sz < __min_cap) { __set_short_size(__sz); __p = __get_short_pointer(); } else { size_type __cap = __recommend(__sz); __p = __alloc_traits::allocate(__alloc(), __cap+1); __set_long_pointer(__p); __set_long_cap(__cap+1); __set_long_size(__sz); } for (; __first != __last; ++__first, (void) ++__p) traits_type::assign(*__p, *__first); traits_type::assign(*__p, value_type()); } template <class _CharT, class _Traits, class _Allocator> template<class _InputIterator, class> inline basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last) { __init(__first, __last); } template <class _CharT, class _Traits, class _Allocator> template<class _InputIterator, class> inline basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a) : __r_(__second_tag(), __a) { __init(__first, __last); } template <class _CharT, class _Traits, class _Allocator> inline basic_string<_CharT, _Traits, _Allocator>::basic_string( initializer_list<_CharT> __il) { __init(__il.begin(), __il.end()); } template <class _CharT, class _Traits, class _Allocator> inline basic_string<_CharT, _Traits, _Allocator>::basic_string( initializer_list<_CharT> __il, const _Allocator& __a) : __r_(__second_tag(), __a) { __init(__il.begin(), __il.end()); } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>::~basic_string() { if (__is_long()) __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap()); } template <class _CharT, class _Traits, class _Allocator> void basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace (size_type __old_cap, size_type __delta_cap, size_type __old_sz, size_type __n_copy, size_type __n_del, size_type __n_add, const value_type* __p_new_stuff) { size_type __ms = max_size(); if (__delta_cap > __ms - __old_cap - 1) this->__throw_length_error(); pointer __old_p = __get_pointer(); size_type __cap = __old_cap < __ms / 2 - __alignment ? __recommend(std::__1::max(__old_cap + __delta_cap, 2 * __old_cap)) : __ms - 1; pointer __p = __alloc_traits::allocate(__alloc(), __cap+1); __invalidate_all_iterators(); if (__n_copy != 0) traits_type::copy(std::__1::__to_raw_pointer(__p), std::__1::__to_raw_pointer(__old_p), __n_copy); if (__n_add != 0) traits_type::copy(std::__1::__to_raw_pointer(__p) + __n_copy, __p_new_stuff, __n_add); size_type __sec_cp_sz = __old_sz - __n_del - __n_copy; if (__sec_cp_sz != 0) traits_type::copy(std::__1::__to_raw_pointer(__p) + __n_copy + __n_add, std::__1::__to_raw_pointer(__old_p) + __n_copy + __n_del, __sec_cp_sz); if (__old_cap+1 != __min_cap) __alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1); __set_long_pointer(__p); __set_long_cap(__cap+1); __old_sz = __n_copy + __n_add + __sec_cp_sz; __set_long_size(__old_sz); traits_type::assign(__p[__old_sz], value_type()); } template <class _CharT, class _Traits, class _Allocator> void basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_type __delta_cap, size_type __old_sz, size_type __n_copy, size_type __n_del, size_type __n_add) { size_type __ms = max_size(); if (__delta_cap > __ms - __old_cap) this->__throw_length_error(); pointer __old_p = __get_pointer(); size_type __cap = __old_cap < __ms / 2 - __alignment ? __recommend(std::__1::max(__old_cap + __delta_cap, 2 * __old_cap)) : __ms - 1; pointer __p = __alloc_traits::allocate(__alloc(), __cap+1); __invalidate_all_iterators(); if (__n_copy != 0) traits_type::copy(std::__1::__to_raw_pointer(__p), std::__1::__to_raw_pointer(__old_p), __n_copy); size_type __sec_cp_sz = __old_sz - __n_del - __n_copy; if (__sec_cp_sz != 0) traits_type::copy(std::__1::__to_raw_pointer(__p) + __n_copy + __n_add, std::__1::__to_raw_pointer(__old_p) + __n_copy + __n_del, __sec_cp_sz); if (__old_cap+1 != __min_cap) __alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1); __set_long_pointer(__p); __set_long_cap(__cap+1); } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_type __n) { ((void)0); size_type __cap = capacity(); if (__cap >= __n) { value_type* __p = std::__1::__to_raw_pointer(__get_pointer()); traits_type::move(__p, __s, __n); traits_type::assign(__p[__n], value_type()); __set_size(__n); __invalidate_iterators_past(__n); } else { size_type __sz = size(); __grow_by_and_replace(__cap, __n - __cap, __sz, 0, __sz, __n, __s); } return *this; } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c) { size_type __cap = capacity(); if (__cap < __n) { size_type __sz = size(); __grow_by(__cap, __n - __cap, __sz, 0, __sz); } else __invalidate_iterators_past(__n); value_type* __p = std::__1::__to_raw_pointer(__get_pointer()); traits_type::assign(__p, __n, __c); traits_type::assign(__p[__n], value_type()); __set_size(__n); return *this; } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c) { pointer __p; if (__is_long()) { __p = __get_long_pointer(); __set_long_size(1); } else { __p = __get_short_pointer(); __set_short_size(1); } traits_type::assign(*__p, __c); traits_type::assign(*++__p, value_type()); __invalidate_iterators_past(1); return *this; } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str) { if (this != &__str) { __copy_assign_alloc(__str); return assign(__str.data(), __str.size()); } return *this; } template <class _CharT, class _Traits, class _Allocator> inline void basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, false_type) noexcept(__alloc_traits::is_always_equal::value) { if (__alloc() != __str.__alloc()) assign(__str); else __move_assign(__str, true_type()); } template <class _CharT, class _Traits, class _Allocator> inline void basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, true_type) noexcept(is_nothrow_move_assignable<allocator_type>::value) { __clear_and_shrink(); __r_.first() = __str.__r_.first(); __move_assign_alloc(__str); __str.__zero(); } template <class _CharT, class _Traits, class _Allocator> inline basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::operator=(basic_string&& __str) noexcept((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) { __move_assign(__str, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>()); return *this; } template <class _CharT, class _Traits, class _Allocator> template<class _InputIterator> typename enable_if < __is_exactly_input_iterator <_InputIterator>::value || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value, basic_string<_CharT, _Traits, _Allocator>& >::type basic_string<_CharT, _Traits, _Allocator>::assign(_InputIterator __first, _InputIterator __last) { const basic_string __temp(__first, __last, __alloc()); assign(__temp.data(), __temp.size()); return *this; } template <class _CharT, class _Traits, class _Allocator> template<class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value, basic_string<_CharT, _Traits, _Allocator>& >::type basic_string<_CharT, _Traits, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last) { size_type __n = static_cast<size_type>(std::__1::distance(__first, __last)); size_type __cap = capacity(); if (__cap < __n) { size_type __sz = size(); __grow_by(__cap, __n - __cap, __sz, 0, __sz); } else __invalidate_iterators_past(__n); pointer __p = __get_pointer(); for (; __first != __last; ++__first, ++__p) traits_type::assign(*__p, *__first); traits_type::assign(*__p, value_type()); __set_size(__n); return *this; } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str, size_type __pos, size_type __n) { size_type __sz = __str.size(); if (__pos > __sz) this->__throw_out_of_range(); return assign(__str.data() + __pos, std::__1::min(__n, __sz - __pos)); } template <class _CharT, class _Traits, class _Allocator> template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, basic_string<_CharT, _Traits, _Allocator>& >::type basic_string<_CharT, _Traits, _Allocator>::assign(const _Tp & __t, size_type __pos, size_type __n) { __self_view __sv = __t; size_type __sz = __sv.size(); if (__pos > __sz) this->__throw_out_of_range(); return assign(__sv.data() + __pos, std::__1::min(__n, __sz - __pos)); } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s) { ((void)0); return assign(__s, traits_type::length(__s)); } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_type __n) { ((void)0); size_type __cap = capacity(); size_type __sz = size(); if (__cap - __sz >= __n) { if (__n) { value_type* __p = std::__1::__to_raw_pointer(__get_pointer()); traits_type::copy(__p + __sz, __s, __n); __sz += __n; __set_size(__sz); traits_type::assign(__p[__sz], value_type()); } } else __grow_by_and_replace(__cap, __sz + __n - __cap, __sz, __sz, 0, __n, __s); return *this; } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c) { if (__n) { size_type __cap = capacity(); size_type __sz = size(); if (__cap - __sz < __n) __grow_by(__cap, __sz + __n - __cap, __sz, __sz, 0); pointer __p = __get_pointer(); traits_type::assign(std::__1::__to_raw_pointer(__p) + __sz, __n, __c); __sz += __n; __set_size(__sz); traits_type::assign(__p[__sz], value_type()); } return *this; } template <class _CharT, class _Traits, class _Allocator> inline void basic_string<_CharT, _Traits, _Allocator>::__append_default_init(size_type __n) { if (__n) { size_type __cap = capacity(); size_type __sz = size(); if (__cap - __sz < __n) __grow_by(__cap, __sz + __n - __cap, __sz, __sz, 0); pointer __p = __get_pointer(); __sz += __n; __set_size(__sz); traits_type::assign(__p[__sz], value_type()); } } template <class _CharT, class _Traits, class _Allocator> void basic_string<_CharT, _Traits, _Allocator>::push_back(value_type __c) { bool __is_short = !__is_long(); size_type __cap; size_type __sz; if (__is_short) { __cap = __min_cap - 1; __sz = __get_short_size(); } else { __cap = __get_long_cap() - 1; __sz = __get_long_size(); } if (__sz == __cap) { __grow_by(__cap, 1, __sz, __sz, 0); __is_short = !__is_long(); } pointer __p; if (__is_short) { __p = __get_short_pointer() + __sz; __set_short_size(__sz+1); } else { __p = __get_long_pointer() + __sz; __set_long_size(__sz+1); } traits_type::assign(*__p, __c); traits_type::assign(*++__p, value_type()); } template <class _Tp> bool __ptr_in_range (const _Tp* __p, const _Tp* __first, const _Tp* __last) { return __first <= __p && __p < __last; } template <class _Tp1, class _Tp2> bool __ptr_in_range (const _Tp1*, const _Tp2*, const _Tp2*) { return false; } template <class _CharT, class _Traits, class _Allocator> template<class _ForwardIterator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::__append_forward_unsafe( _ForwardIterator __first, _ForwardIterator __last) { static_assert(__is_forward_iterator<_ForwardIterator>::value, "function requires a ForwardIterator"); size_type __sz = size(); size_type __cap = capacity(); size_type __n = static_cast<size_type>(std::__1::distance(__first, __last)); if (__n) { typedef typename iterator_traits<_ForwardIterator>::reference _CharRef; _CharRef __tmp_ref = *__first; if (__ptr_in_range(std::__1::addressof(__tmp_ref), data(), data() + size())) { const basic_string __temp (__first, __last, __alloc()); append(__temp.data(), __temp.size()); } else { if (__cap - __sz < __n) __grow_by(__cap, __sz + __n - __cap, __sz, __sz, 0); pointer __p = __get_pointer() + __sz; for (; __first != __last; ++__p, ++__first) traits_type::assign(*__p, *__first); traits_type::assign(*__p, value_type()); __set_size(__sz + __n); } } return *this; } template <class _CharT, class _Traits, class _Allocator> inline basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str) { return append(__str.data(), __str.size()); } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str, size_type __pos, size_type __n) { size_type __sz = __str.size(); if (__pos > __sz) this->__throw_out_of_range(); return append(__str.data() + __pos, std::__1::min(__n, __sz - __pos)); } template <class _CharT, class _Traits, class _Allocator> template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, basic_string<_CharT, _Traits, _Allocator>& >::type basic_string<_CharT, _Traits, _Allocator>::append(const _Tp & __t, size_type __pos, size_type __n) { __self_view __sv = __t; size_type __sz = __sv.size(); if (__pos > __sz) this->__throw_out_of_range(); return append(__sv.data() + __pos, std::__1::min(__n, __sz - __pos)); } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s) { ((void)0); return append(__s, traits_type::length(__s)); } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s, size_type __n) { ((void)0); size_type __sz = size(); if (__pos > __sz) this->__throw_out_of_range(); size_type __cap = capacity(); if (__cap - __sz >= __n) { if (__n) { value_type* __p = std::__1::__to_raw_pointer(__get_pointer()); size_type __n_move = __sz - __pos; if (__n_move != 0) { if (__p + __pos <= __s && __s < __p + __sz) __s += __n; traits_type::move(__p + __pos + __n, __p + __pos, __n_move); } traits_type::move(__p + __pos, __s, __n); __sz += __n; __set_size(__sz); traits_type::assign(__p[__sz], value_type()); } } else __grow_by_and_replace(__cap, __sz + __n - __cap, __sz, __pos, 0, __n, __s); return *this; } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n, value_type __c) { size_type __sz = size(); if (__pos > __sz) this->__throw_out_of_range(); if (__n) { size_type __cap = capacity(); value_type* __p; if (__cap - __sz >= __n) { __p = std::__1::__to_raw_pointer(__get_pointer()); size_type __n_move = __sz - __pos; if (__n_move != 0) traits_type::move(__p + __pos + __n, __p + __pos, __n_move); } else { __grow_by(__cap, __sz + __n - __cap, __sz, __pos, 0, __n); __p = std::__1::__to_raw_pointer(__get_long_pointer()); } traits_type::assign(__p + __pos, __n, __c); __sz += __n; __set_size(__sz); traits_type::assign(__p[__sz], value_type()); } return *this; } template <class _CharT, class _Traits, class _Allocator> template<class _InputIterator> typename enable_if < __is_exactly_input_iterator<_InputIterator>::value || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value, typename basic_string<_CharT, _Traits, _Allocator>::iterator >::type basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _InputIterator __first, _InputIterator __last) { const basic_string __temp(__first, __last, __alloc()); return insert(__pos, __temp.data(), __temp.data() + __temp.size()); } template <class _CharT, class _Traits, class _Allocator> template<class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value, typename basic_string<_CharT, _Traits, _Allocator>::iterator >::type basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last) { size_type __ip = static_cast<size_type>(__pos - begin()); size_type __n = static_cast<size_type>(std::__1::distance(__first, __last)); if (__n) { typedef typename iterator_traits<_ForwardIterator>::reference _CharRef; _CharRef __tmp_char = *__first; if (__ptr_in_range(std::__1::addressof(__tmp_char), data(), data() + size())) { const basic_string __temp(__first, __last, __alloc()); return insert(__pos, __temp.data(), __temp.data() + __temp.size()); } size_type __sz = size(); size_type __cap = capacity(); value_type* __p; if (__cap - __sz >= __n) { __p = std::__1::__to_raw_pointer(__get_pointer()); size_type __n_move = __sz - __ip; if (__n_move != 0) traits_type::move(__p + __ip + __n, __p + __ip, __n_move); } else { __grow_by(__cap, __sz + __n - __cap, __sz, __ip, 0, __n); __p = std::__1::__to_raw_pointer(__get_long_pointer()); } __sz += __n; __set_size(__sz); traits_type::assign(__p[__sz], value_type()); for (__p += __ip; __first != __last; ++__p, ++__first) traits_type::assign(*__p, *__first); } return begin() + __ip; } template <class _CharT, class _Traits, class _Allocator> inline basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const basic_string& __str) { return insert(__pos1, __str.data(), __str.size()); } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n) { size_type __str_sz = __str.size(); if (__pos2 > __str_sz) this->__throw_out_of_range(); return insert(__pos1, __str.data() + __pos2, std::__1::min(__n, __str_sz - __pos2)); } template <class _CharT, class _Traits, class _Allocator> template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, basic_string<_CharT, _Traits, _Allocator>& >::type basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const _Tp& __t, size_type __pos2, size_type __n) { __self_view __sv = __t; size_type __str_sz = __sv.size(); if (__pos2 > __str_sz) this->__throw_out_of_range(); return insert(__pos1, __sv.data() + __pos2, std::__1::min(__n, __str_sz - __pos2)); } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s) { ((void)0); return insert(__pos, __s, traits_type::length(__s)); } template <class _CharT, class _Traits, class _Allocator> typename basic_string<_CharT, _Traits, _Allocator>::iterator basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_type __c) { size_type __ip = static_cast<size_type>(__pos - begin()); size_type __sz = size(); size_type __cap = capacity(); value_type* __p; if (__cap == __sz) { __grow_by(__cap, 1, __sz, __ip, 0, 1); __p = std::__1::__to_raw_pointer(__get_long_pointer()); } else { __p = std::__1::__to_raw_pointer(__get_pointer()); size_type __n_move = __sz - __ip; if (__n_move != 0) traits_type::move(__p + __ip + 1, __p + __ip, __n_move); } traits_type::assign(__p[__ip], __c); traits_type::assign(__p[++__sz], value_type()); __set_size(__sz); return begin() + static_cast<difference_type>(__ip); } template <class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::iterator basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, size_type __n, value_type __c) { difference_type __p = __pos - begin(); insert(static_cast<size_type>(__p), __n, __c); return begin() + __p; } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2) __attribute__((__no_sanitize__("unsigned-integer-overflow"))) { ((void)0); size_type __sz = size(); if (__pos > __sz) this->__throw_out_of_range(); __n1 = std::__1::min(__n1, __sz - __pos); size_type __cap = capacity(); if (__cap - __sz + __n1 >= __n2) { value_type* __p = std::__1::__to_raw_pointer(__get_pointer()); if (__n1 != __n2) { size_type __n_move = __sz - __pos - __n1; if (__n_move != 0) { if (__n1 > __n2) { traits_type::move(__p + __pos, __s, __n2); traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move); goto __finish; } if (__p + __pos < __s && __s < __p + __sz) { if (__p + __pos + __n1 <= __s) __s += __n2 - __n1; else { traits_type::move(__p + __pos, __s, __n1); __pos += __n1; __s += __n2; __n2 -= __n1; __n1 = 0; } } traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move); } } traits_type::move(__p + __pos, __s, __n2); __finish: __sz += __n2 - __n1; __set_size(__sz); __invalidate_iterators_past(__sz); traits_type::assign(__p[__sz], value_type()); } else __grow_by_and_replace(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2, __s); return *this; } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, size_type __n2, value_type __c) __attribute__((__no_sanitize__("unsigned-integer-overflow"))) { size_type __sz = size(); if (__pos > __sz) this->__throw_out_of_range(); __n1 = std::__1::min(__n1, __sz - __pos); size_type __cap = capacity(); value_type* __p; if (__cap - __sz + __n1 >= __n2) { __p = std::__1::__to_raw_pointer(__get_pointer()); if (__n1 != __n2) { size_type __n_move = __sz - __pos - __n1; if (__n_move != 0) traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move); } } else { __grow_by(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2); __p = std::__1::__to_raw_pointer(__get_long_pointer()); } traits_type::assign(__p + __pos, __n2, __c); __sz += __n2 - __n1; __set_size(__sz); __invalidate_iterators_past(__sz); traits_type::assign(__p[__sz], value_type()); return *this; } template <class _CharT, class _Traits, class _Allocator> template<class _InputIterator> typename enable_if < __is_input_iterator<_InputIterator>::value, basic_string<_CharT, _Traits, _Allocator>& >::type basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2) { const basic_string __temp(__j1, __j2, __alloc()); return this->replace(__i1, __i2, __temp); } template <class _CharT, class _Traits, class _Allocator> inline basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type __n1, const basic_string& __str) { return replace(__pos1, __n1, __str.data(), __str.size()); } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) { size_type __str_sz = __str.size(); if (__pos2 > __str_sz) this->__throw_out_of_range(); return replace(__pos1, __n1, __str.data() + __pos2, std::__1::min(__n2, __str_sz - __pos2)); } template <class _CharT, class _Traits, class _Allocator> template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, basic_string<_CharT, _Traits, _Allocator>& >::type basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2) { __self_view __sv = __t; size_type __str_sz = __sv.size(); if (__pos2 > __str_sz) this->__throw_out_of_range(); return replace(__pos1, __n1, __sv.data() + __pos2, std::__1::min(__n2, __str_sz - __pos2)); } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s) { ((void)0); return replace(__pos, __n1, __s, traits_type::length(__s)); } template <class _CharT, class _Traits, class _Allocator> inline basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const basic_string& __str) { return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __str.data(), __str.size()); } template <class _CharT, class _Traits, class _Allocator> inline basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const value_type* __s, size_type __n) { return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s, __n); } template <class _CharT, class _Traits, class _Allocator> inline basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const value_type* __s) { return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s); } template <class _CharT, class _Traits, class _Allocator> inline basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c) { return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __n, __c); } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos, size_type __n) { size_type __sz = size(); if (__pos > __sz) this->__throw_out_of_range(); if (__n) { value_type* __p = std::__1::__to_raw_pointer(__get_pointer()); __n = std::__1::min(__n, __sz - __pos); size_type __n_move = __sz - __pos - __n; if (__n_move != 0) traits_type::move(__p + __pos, __p + __pos + __n, __n_move); __sz -= __n; __set_size(__sz); __invalidate_iterators_past(__sz); traits_type::assign(__p[__sz], value_type()); } return *this; } template <class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::iterator basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos) { ((void)0); iterator __b = begin(); size_type __r = static_cast<size_type>(__pos - __b); erase(__r, 1); return __b + static_cast<difference_type>(__r); } template <class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::iterator basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __first, const_iterator __last) { ((void)0); iterator __b = begin(); size_type __r = static_cast<size_type>(__first - __b); erase(__r, static_cast<size_type>(__last - __first)); return __b + static_cast<difference_type>(__r); } template <class _CharT, class _Traits, class _Allocator> inline void basic_string<_CharT, _Traits, _Allocator>::pop_back() { ((void)0); size_type __sz; if (__is_long()) { __sz = __get_long_size() - 1; __set_long_size(__sz); traits_type::assign(*(__get_long_pointer() + __sz), value_type()); } else { __sz = __get_short_size() - 1; __set_short_size(__sz); traits_type::assign(*(__get_short_pointer() + __sz), value_type()); } __invalidate_iterators_past(__sz); } template <class _CharT, class _Traits, class _Allocator> inline void basic_string<_CharT, _Traits, _Allocator>::clear() noexcept { __invalidate_all_iterators(); if (__is_long()) { traits_type::assign(*__get_long_pointer(), value_type()); __set_long_size(0); } else { traits_type::assign(*__get_short_pointer(), value_type()); __set_short_size(0); } } template <class _CharT, class _Traits, class _Allocator> inline void basic_string<_CharT, _Traits, _Allocator>::__erase_to_end(size_type __pos) { if (__is_long()) { traits_type::assign(*(__get_long_pointer() + __pos), value_type()); __set_long_size(__pos); } else { traits_type::assign(*(__get_short_pointer() + __pos), value_type()); __set_short_size(__pos); } __invalidate_iterators_past(__pos); } template <class _CharT, class _Traits, class _Allocator> void basic_string<_CharT, _Traits, _Allocator>::resize(size_type __n, value_type __c) { size_type __sz = size(); if (__n > __sz) append(__n - __sz, __c); else __erase_to_end(__n); } template <class _CharT, class _Traits, class _Allocator> inline void basic_string<_CharT, _Traits, _Allocator>::__resize_default_init(size_type __n) { size_type __sz = size(); if (__n > __sz) { __append_default_init(__n - __sz); } else __erase_to_end(__n); } template <class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::max_size() const noexcept { size_type __m = __alloc_traits::max_size(__alloc()); return __m - __alignment; } template <class _CharT, class _Traits, class _Allocator> void basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg) { if (__res_arg > max_size()) this->__throw_length_error(); size_type __cap = capacity(); size_type __sz = size(); __res_arg = std::__1::max(__res_arg, __sz); __res_arg = __recommend(__res_arg); if (__res_arg != __cap) { pointer __new_data, __p; bool __was_long, __now_long; if (__res_arg == __min_cap - 1) { __was_long = true; __now_long = false; __new_data = __get_short_pointer(); __p = __get_long_pointer(); } else { if (__res_arg > __cap) __new_data = __alloc_traits::allocate(__alloc(), __res_arg+1); else { __new_data = __alloc_traits::allocate(__alloc(), __res_arg+1); if (__new_data == nullptr) return; } __now_long = true; __was_long = __is_long(); __p = __get_pointer(); } traits_type::copy(std::__1::__to_raw_pointer(__new_data), std::__1::__to_raw_pointer(__p), size()+1); if (__was_long) __alloc_traits::deallocate(__alloc(), __p, __cap+1); if (__now_long) { __set_long_cap(__res_arg+1); __set_long_size(__sz); __set_long_pointer(__new_data); } else __set_short_size(__sz); __invalidate_all_iterators(); } } template <class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::const_reference basic_string<_CharT, _Traits, _Allocator>::operator[](size_type __pos) const noexcept { ((void)0); return *(data() + __pos); } template <class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::reference basic_string<_CharT, _Traits, _Allocator>::operator[](size_type __pos) noexcept { ((void)0); return *(__get_pointer() + __pos); } template <class _CharT, class _Traits, class _Allocator> typename basic_string<_CharT, _Traits, _Allocator>::const_reference basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) const { if (__n >= size()) this->__throw_out_of_range(); return (*this)[__n]; } template <class _CharT, class _Traits, class _Allocator> typename basic_string<_CharT, _Traits, _Allocator>::reference basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) { if (__n >= size()) this->__throw_out_of_range(); return (*this)[__n]; } template <class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::reference basic_string<_CharT, _Traits, _Allocator>::front() noexcept { ((void)0); return *__get_pointer(); } template <class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::const_reference basic_string<_CharT, _Traits, _Allocator>::front() const noexcept { ((void)0); return *data(); } template <class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::reference basic_string<_CharT, _Traits, _Allocator>::back() noexcept { ((void)0); return *(__get_pointer() + size() - 1); } template <class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::const_reference basic_string<_CharT, _Traits, _Allocator>::back() const noexcept { ((void)0); return *(data() + size() - 1); } template <class _CharT, class _Traits, class _Allocator> typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::copy(value_type* __s, size_type __n, size_type __pos) const { size_type __sz = size(); if (__pos > __sz) this->__throw_out_of_range(); size_type __rlen = std::__1::min(__n, __sz - __pos); traits_type::copy(__s, data() + __pos, __rlen); return __rlen; } template <class _CharT, class _Traits, class _Allocator> inline basic_string<_CharT, _Traits, _Allocator> basic_string<_CharT, _Traits, _Allocator>::substr(size_type __pos, size_type __n) const { return basic_string(*this, __pos, __n, __alloc()); } template <class _CharT, class _Traits, class _Allocator> inline void basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str) noexcept { ((void)0); std::__1::swap(__r_.first(), __str.__r_.first()); __swap_allocator(__alloc(), __str.__alloc()); } template <class _Traits> struct __traits_eq { typedef typename _Traits::char_type char_type; __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const char_type& __x, const char_type& __y) noexcept {return _Traits::eq(__x, __y);} }; template<class _CharT, class _Traits, class _Allocator> typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s, size_type __pos, size_type __n) const noexcept { ((void)0); return __str_find<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, __n); } template<class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find(const basic_string& __str, size_type __pos) const noexcept { return __str_find<value_type, size_type, traits_type, npos> (data(), size(), __str.data(), __pos, __str.size()); } template<class _CharT, class _Traits, class _Allocator> template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, typename basic_string<_CharT, _Traits, _Allocator>::size_type >::type basic_string<_CharT, _Traits, _Allocator>::find(const _Tp &__t, size_type __pos) const { __self_view __sv = __t; return __str_find<value_type, size_type, traits_type, npos> (data(), size(), __sv.data(), __pos, __sv.size()); } template<class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s, size_type __pos) const noexcept { ((void)0); return __str_find<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, traits_type::length(__s)); } template<class _CharT, class _Traits, class _Allocator> typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find(value_type __c, size_type __pos) const noexcept { return __str_find<value_type, size_type, traits_type, npos> (data(), size(), __c, __pos); } template<class _CharT, class _Traits, class _Allocator> typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s, size_type __pos, size_type __n) const noexcept { ((void)0); return __str_rfind<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, __n); } template<class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::rfind(const basic_string& __str, size_type __pos) const noexcept { return __str_rfind<value_type, size_type, traits_type, npos> (data(), size(), __str.data(), __pos, __str.size()); } template<class _CharT, class _Traits, class _Allocator> template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, typename basic_string<_CharT, _Traits, _Allocator>::size_type >::type basic_string<_CharT, _Traits, _Allocator>::rfind(const _Tp& __t, size_type __pos) const { __self_view __sv = __t; return __str_rfind<value_type, size_type, traits_type, npos> (data(), size(), __sv.data(), __pos, __sv.size()); } template<class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s, size_type __pos) const noexcept { ((void)0); return __str_rfind<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, traits_type::length(__s)); } template<class _CharT, class _Traits, class _Allocator> typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::rfind(value_type __c, size_type __pos) const noexcept { return __str_rfind<value_type, size_type, traits_type, npos> (data(), size(), __c, __pos); } template<class _CharT, class _Traits, class _Allocator> typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s, size_type __pos, size_type __n) const noexcept { ((void)0); return __str_find_first_of<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, __n); } template<class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_first_of(const basic_string& __str, size_type __pos) const noexcept { return __str_find_first_of<value_type, size_type, traits_type, npos> (data(), size(), __str.data(), __pos, __str.size()); } template<class _CharT, class _Traits, class _Allocator> template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, typename basic_string<_CharT, _Traits, _Allocator>::size_type >::type basic_string<_CharT, _Traits, _Allocator>::find_first_of(const _Tp& __t, size_type __pos) const { __self_view __sv = __t; return __str_find_first_of<value_type, size_type, traits_type, npos> (data(), size(), __sv.data(), __pos, __sv.size()); } template<class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s, size_type __pos) const noexcept { ((void)0); return __str_find_first_of<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, traits_type::length(__s)); } template<class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_first_of(value_type __c, size_type __pos) const noexcept { return find(__c, __pos); } template<class _CharT, class _Traits, class _Allocator> typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s, size_type __pos, size_type __n) const noexcept { ((void)0); return __str_find_last_of<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, __n); } template<class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_last_of(const basic_string& __str, size_type __pos) const noexcept { return __str_find_last_of<value_type, size_type, traits_type, npos> (data(), size(), __str.data(), __pos, __str.size()); } template<class _CharT, class _Traits, class _Allocator> template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, typename basic_string<_CharT, _Traits, _Allocator>::size_type >::type basic_string<_CharT, _Traits, _Allocator>::find_last_of(const _Tp& __t, size_type __pos) const { __self_view __sv = __t; return __str_find_last_of<value_type, size_type, traits_type, npos> (data(), size(), __sv.data(), __pos, __sv.size()); } template<class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s, size_type __pos) const noexcept { ((void)0); return __str_find_last_of<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, traits_type::length(__s)); } template<class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_last_of(value_type __c, size_type __pos) const noexcept { return rfind(__c, __pos); } template<class _CharT, class _Traits, class _Allocator> typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s, size_type __pos, size_type __n) const noexcept { ((void)0); return __str_find_first_not_of<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, __n); } template<class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const basic_string& __str, size_type __pos) const noexcept { return __str_find_first_not_of<value_type, size_type, traits_type, npos> (data(), size(), __str.data(), __pos, __str.size()); } template<class _CharT, class _Traits, class _Allocator> template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, typename basic_string<_CharT, _Traits, _Allocator>::size_type >::type basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const _Tp& __t, size_type __pos) const { __self_view __sv = __t; return __str_find_first_not_of<value_type, size_type, traits_type, npos> (data(), size(), __sv.data(), __pos, __sv.size()); } template<class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s, size_type __pos) const noexcept { ((void)0); return __str_find_first_not_of<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, traits_type::length(__s)); } template<class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c, size_type __pos) const noexcept { return __str_find_first_not_of<value_type, size_type, traits_type, npos> (data(), size(), __c, __pos); } template<class _CharT, class _Traits, class _Allocator> typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s, size_type __pos, size_type __n) const noexcept { ((void)0); return __str_find_last_not_of<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, __n); } template<class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const basic_string& __str, size_type __pos) const noexcept { return __str_find_last_not_of<value_type, size_type, traits_type, npos> (data(), size(), __str.data(), __pos, __str.size()); } template<class _CharT, class _Traits, class _Allocator> template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, typename basic_string<_CharT, _Traits, _Allocator>::size_type >::type basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const _Tp& __t, size_type __pos) const { __self_view __sv = __t; return __str_find_last_not_of<value_type, size_type, traits_type, npos> (data(), size(), __sv.data(), __pos, __sv.size()); } template<class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s, size_type __pos) const noexcept { ((void)0); return __str_find_last_not_of<value_type, size_type, traits_type, npos> (data(), size(), __s, __pos, traits_type::length(__s)); } template<class _CharT, class _Traits, class _Allocator> inline typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(value_type __c, size_type __pos) const noexcept { return __str_find_last_not_of<value_type, size_type, traits_type, npos> (data(), size(), __c, __pos); } template <class _CharT, class _Traits, class _Allocator> template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int >::type basic_string<_CharT, _Traits, _Allocator>::compare(const _Tp& __t) const { __self_view __sv = __t; size_t __lhs_sz = size(); size_t __rhs_sz = __sv.size(); int __result = traits_type::compare(data(), __sv.data(), std::__1::min(__lhs_sz, __rhs_sz)); if (__result != 0) return __result; if (__lhs_sz < __rhs_sz) return -1; if (__lhs_sz > __rhs_sz) return 1; return 0; } template <class _CharT, class _Traits, class _Allocator> inline int basic_string<_CharT, _Traits, _Allocator>::compare(const basic_string& __str) const noexcept { return compare(__self_view(__str)); } template <class _CharT, class _Traits, class _Allocator> int basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type __n1, const value_type* __s, size_type __n2) const { ((void)0); size_type __sz = size(); if (__pos1 > __sz || __n2 == npos) this->__throw_out_of_range(); size_type __rlen = std::__1::min(__n1, __sz - __pos1); int __r = traits_type::compare(data() + __pos1, __s, std::__1::min(__rlen, __n2)); if (__r == 0) { if (__rlen < __n2) __r = -1; else if (__rlen > __n2) __r = 1; } return __r; } template <class _CharT, class _Traits, class _Allocator> template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int >::type basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type __n1, const _Tp& __t) const { __self_view __sv = __t; return compare(__pos1, __n1, __sv.data(), __sv.size()); } template <class _CharT, class _Traits, class _Allocator> inline int basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type __n1, const basic_string& __str) const { return compare(__pos1, __n1, __str.data(), __str.size()); } template <class _CharT, class _Traits, class _Allocator> template <class _Tp> typename enable_if < __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int >::type basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2) const { __self_view __sv = __t; return __self_view(*this).substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2)); } template <class _CharT, class _Traits, class _Allocator> int basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) const { return compare(__pos1, __n1, __self_view(__str), __pos2, __n2); } template <class _CharT, class _Traits, class _Allocator> int basic_string<_CharT, _Traits, _Allocator>::compare(const value_type* __s) const noexcept { ((void)0); return compare(0, npos, __s, traits_type::length(__s)); } template <class _CharT, class _Traits, class _Allocator> int basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type __n1, const value_type* __s) const { ((void)0); return compare(__pos1, __n1, __s, traits_type::length(__s)); } template<class _CharT, class _Traits, class _Allocator> inline bool basic_string<_CharT, _Traits, _Allocator>::__invariants() const { if (size() > capacity()) return false; if (capacity() < __min_cap - 1) return false; if (data() == 0) return false; if (data()[size()] != value_type(0)) return false; return true; } template<class _CharT, class _Traits, class _Allocator> inline void basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() noexcept { clear(); if(__is_long()) { __alloc_traits::deallocate(__alloc(), __get_long_pointer(), capacity() + 1); __set_long_cap(0); __set_short_size(0); } } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) noexcept { size_t __lhs_sz = __lhs.size(); return __lhs_sz == __rhs.size() && _Traits::compare(__lhs.data(), __rhs.data(), __lhs_sz) == 0; } template<class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const basic_string<char, char_traits<char>, _Allocator>& __lhs, const basic_string<char, char_traits<char>, _Allocator>& __rhs) noexcept { size_t __lhs_sz = __lhs.size(); if (__lhs_sz != __rhs.size()) return false; const char* __lp = __lhs.data(); const char* __rp = __rhs.data(); if (__lhs.__is_long()) return char_traits<char>::compare(__lp, __rp, __lhs_sz) == 0; for (; __lhs_sz != 0; --__lhs_sz, ++__lp, ++__rp) if (*__lp != *__rp) return false; return true; } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) noexcept { typedef basic_string<_CharT, _Traits, _Allocator> _String; ((void)0); size_t __lhs_len = _Traits::length(__lhs); if (__lhs_len != __rhs.size()) return false; return __rhs.compare(0, _String::npos, __lhs, __lhs_len) == 0; } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const _CharT* __rhs) noexcept { typedef basic_string<_CharT, _Traits, _Allocator> _String; ((void)0); size_t __rhs_len = _Traits::length(__rhs); if (__rhs_len != __lhs.size()) return false; return __lhs.compare(0, _String::npos, __rhs, __rhs_len) == 0; } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) noexcept { return !(__lhs == __rhs); } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) noexcept { return !(__lhs == __rhs); } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) noexcept { return !(__lhs == __rhs); } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) noexcept { return __lhs.compare(__rhs) < 0; } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) noexcept { return __lhs.compare(__rhs) < 0; } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator< (const _CharT* __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) noexcept { return __rhs.compare(__lhs) > 0; } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator> (const basic_string<_CharT, _Traits, _Allocator>& __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) noexcept { return __rhs < __lhs; } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator> (const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) noexcept { return __rhs < __lhs; } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator> (const _CharT* __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) noexcept { return __rhs < __lhs; } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) noexcept { return !(__rhs < __lhs); } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) noexcept { return !(__rhs < __lhs); } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) noexcept { return !(__rhs < __lhs); } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) noexcept { return !(__lhs < __rhs); } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) noexcept { return !(__lhs < __rhs); } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) noexcept { return !(__lhs < __rhs); } template<class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator> operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) { basic_string<_CharT, _Traits, _Allocator> __r(__lhs.get_allocator()); typename basic_string<_CharT, _Traits, _Allocator>::size_type __lhs_sz = __lhs.size(); typename basic_string<_CharT, _Traits, _Allocator>::size_type __rhs_sz = __rhs.size(); __r.__init(__lhs.data(), __lhs_sz, __lhs_sz + __rhs_sz); __r.append(__rhs.data(), __rhs_sz); return __r; } template<class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator> operator+(const _CharT* __lhs , const basic_string<_CharT,_Traits,_Allocator>& __rhs) { basic_string<_CharT, _Traits, _Allocator> __r(__rhs.get_allocator()); typename basic_string<_CharT, _Traits, _Allocator>::size_type __lhs_sz = _Traits::length(__lhs); typename basic_string<_CharT, _Traits, _Allocator>::size_type __rhs_sz = __rhs.size(); __r.__init(__lhs, __lhs_sz, __lhs_sz + __rhs_sz); __r.append(__rhs.data(), __rhs_sz); return __r; } template<class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator> operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs) { basic_string<_CharT, _Traits, _Allocator> __r(__rhs.get_allocator()); typename basic_string<_CharT, _Traits, _Allocator>::size_type __rhs_sz = __rhs.size(); __r.__init(&__lhs, 1, 1 + __rhs_sz); __r.append(__rhs.data(), __rhs_sz); return __r; } template<class _CharT, class _Traits, class _Allocator> inline basic_string<_CharT, _Traits, _Allocator> operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) { basic_string<_CharT, _Traits, _Allocator> __r(__lhs.get_allocator()); typename basic_string<_CharT, _Traits, _Allocator>::size_type __lhs_sz = __lhs.size(); typename basic_string<_CharT, _Traits, _Allocator>::size_type __rhs_sz = _Traits::length(__rhs); __r.__init(__lhs.data(), __lhs_sz, __lhs_sz + __rhs_sz); __r.append(__rhs, __rhs_sz); return __r; } template<class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator> operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, _CharT __rhs) { basic_string<_CharT, _Traits, _Allocator> __r(__lhs.get_allocator()); typename basic_string<_CharT, _Traits, _Allocator>::size_type __lhs_sz = __lhs.size(); __r.__init(__lhs.data(), __lhs_sz, __lhs_sz + 1); __r.push_back(__rhs); return __r; } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string<_CharT, _Traits, _Allocator> operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) { return std::__1::move(__lhs.append(__rhs)); } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string<_CharT, _Traits, _Allocator> operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs) { return std::__1::move(__rhs.insert(0, __lhs)); } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string<_CharT, _Traits, _Allocator> operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs) { return std::__1::move(__lhs.append(__rhs)); } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string<_CharT, _Traits, _Allocator> operator+(const _CharT* __lhs , basic_string<_CharT,_Traits,_Allocator>&& __rhs) { return std::__1::move(__rhs.insert(0, __lhs)); } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string<_CharT, _Traits, _Allocator> operator+(_CharT __lhs, basic_string<_CharT,_Traits,_Allocator>&& __rhs) { __rhs.insert(__rhs.begin(), __lhs); return std::__1::move(__rhs); } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string<_CharT, _Traits, _Allocator> operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const _CharT* __rhs) { return std::__1::move(__lhs.append(__rhs)); } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string<_CharT, _Traits, _Allocator> operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, _CharT __rhs) { __lhs.push_back(__rhs); return std::__1::move(__lhs); } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(basic_string<_CharT, _Traits, _Allocator>& __lhs, basic_string<_CharT, _Traits, _Allocator>& __rhs) noexcept(noexcept(__lhs.swap(__rhs))) { __lhs.swap(__rhs); } typedef basic_string<char16_t> u16string; typedef basic_string<char32_t> u32string; int stoi (const string& __str, size_t* __idx = 0, int __base = 10); long stol (const string& __str, size_t* __idx = 0, int __base = 10); unsigned long stoul (const string& __str, size_t* __idx = 0, int __base = 10); long long stoll (const string& __str, size_t* __idx = 0, int __base = 10); unsigned long long stoull(const string& __str, size_t* __idx = 0, int __base = 10); float stof (const string& __str, size_t* __idx = 0); double stod (const string& __str, size_t* __idx = 0); long double stold(const string& __str, size_t* __idx = 0); string to_string(int __val); string to_string(unsigned __val); string to_string(long __val); string to_string(unsigned long __val); string to_string(long long __val); string to_string(unsigned long long __val); string to_string(float __val); string to_string(double __val); string to_string(long double __val); int stoi (const wstring& __str, size_t* __idx = 0, int __base = 10); long stol (const wstring& __str, size_t* __idx = 0, int __base = 10); unsigned long stoul (const wstring& __str, size_t* __idx = 0, int __base = 10); long long stoll (const wstring& __str, size_t* __idx = 0, int __base = 10); unsigned long long stoull(const wstring& __str, size_t* __idx = 0, int __base = 10); float stof (const wstring& __str, size_t* __idx = 0); double stod (const wstring& __str, size_t* __idx = 0); long double stold(const wstring& __str, size_t* __idx = 0); wstring to_wstring(int __val); wstring to_wstring(unsigned __val); wstring to_wstring(long __val); wstring to_wstring(unsigned long __val); wstring to_wstring(long long __val); wstring to_wstring(unsigned long long __val); wstring to_wstring(float __val); wstring to_wstring(double __val); wstring to_wstring(long double __val); template<class _CharT, class _Traits, class _Allocator> const typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::npos; template <class _CharT, class _Allocator> struct hash<basic_string<_CharT, char_traits<_CharT>, _Allocator> > : public unary_function< basic_string<_CharT, char_traits<_CharT>, _Allocator>, size_t> { size_t operator()(const basic_string<_CharT, char_traits<_CharT>, _Allocator>& __val) const noexcept { return __do_string_hash(__val.data(), __val.data() + __val.size()); } }; template<class _CharT, class _Traits, class _Allocator> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const basic_string<_CharT, _Traits, _Allocator>& __str); template<class _CharT, class _Traits, class _Allocator> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Allocator>& __str); template<class _CharT, class _Traits, class _Allocator> basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm); template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Allocator>& __str); template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>&& __is, basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm); template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>&& __is, basic_string<_CharT, _Traits, _Allocator>& __str); extern template class basic_string<char>; extern template class basic_string<wchar_t>; inline namespace literals { inline namespace string_literals { inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string<char> operator "" s( const char *__str, size_t __len ) { return basic_string<char> (__str, __len); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string<wchar_t> operator "" s( const wchar_t *__str, size_t __len ) { return basic_string<wchar_t> (__str, __len); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string<char16_t> operator "" s( const char16_t *__str, size_t __len ) { return basic_string<char16_t> (__str, __len); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string<char32_t> operator "" s( const char32_t *__str, size_t __len ) { return basic_string<char32_t> (__str, __len); } } } } } namespace std { inline namespace __1 { template <size_t _N_words, size_t _Size> class __bitset; template <size_t _N_words, size_t _Size> struct __has_storage_type<__bitset<_N_words, _Size> > { static const bool value = true; }; template <size_t _N_words, size_t _Size> class __bitset { public: typedef ptrdiff_t difference_type; typedef size_t size_type; typedef size_type __storage_type; protected: typedef __bitset __self; typedef __storage_type* __storage_pointer; typedef const __storage_type* __const_storage_pointer; static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * 8); friend class __bit_reference<__bitset>; friend class __bit_const_reference<__bitset>; friend class __bit_iterator<__bitset, false>; friend class __bit_iterator<__bitset, true>; friend struct __bit_array<__bitset>; __storage_type __first_[_N_words]; typedef __bit_reference<__bitset> reference; typedef __bit_const_reference<__bitset> const_reference; typedef __bit_iterator<__bitset, false> iterator; typedef __bit_iterator<__bitset, true> const_iterator; __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __bitset() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit constexpr __bitset(unsigned long long __v) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) reference __make_ref(size_t __pos) noexcept {return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const_reference __make_ref(size_t __pos) const noexcept {return const_reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __make_iter(size_t __pos) noexcept {return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator __make_iter(size_t __pos) const noexcept {return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} __attribute__ ((__exclude_from_explicit_instantiation__)) void operator&=(const __bitset& __v) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) void operator|=(const __bitset& __v) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) void operator^=(const __bitset& __v) noexcept; void flip() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) unsigned long to_ulong() const {return to_ulong(integral_constant<bool, _Size < sizeof(unsigned long) * 8>());} __attribute__ ((__exclude_from_explicit_instantiation__)) unsigned long long to_ullong() const {return to_ullong(integral_constant<bool, _Size < sizeof(unsigned long long) * 8>());} bool all() const noexcept; bool any() const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) size_t __hash_code() const noexcept; private: unsigned long to_ulong(false_type) const; __attribute__ ((__exclude_from_explicit_instantiation__)) unsigned long to_ulong(true_type) const; unsigned long long to_ullong(false_type) const; __attribute__ ((__exclude_from_explicit_instantiation__)) unsigned long long to_ullong(true_type) const; __attribute__ ((__exclude_from_explicit_instantiation__)) unsigned long long to_ullong(true_type, false_type) const; unsigned long long to_ullong(true_type, true_type) const; }; template <size_t _N_words, size_t _Size> inline constexpr __bitset<_N_words, _Size>::__bitset() noexcept : __first_{0} { } template <size_t _N_words, size_t _Size> inline constexpr __bitset<_N_words, _Size>::__bitset(unsigned long long __v) noexcept : __first_{__v} { } template <size_t _N_words, size_t _Size> inline void __bitset<_N_words, _Size>::operator&=(const __bitset& __v) noexcept { for (size_type __i = 0; __i < _N_words; ++__i) __first_[__i] &= __v.__first_[__i]; } template <size_t _N_words, size_t _Size> inline void __bitset<_N_words, _Size>::operator|=(const __bitset& __v) noexcept { for (size_type __i = 0; __i < _N_words; ++__i) __first_[__i] |= __v.__first_[__i]; } template <size_t _N_words, size_t _Size> inline void __bitset<_N_words, _Size>::operator^=(const __bitset& __v) noexcept { for (size_type __i = 0; __i < _N_words; ++__i) __first_[__i] ^= __v.__first_[__i]; } template <size_t _N_words, size_t _Size> void __bitset<_N_words, _Size>::flip() noexcept { size_type __n = _Size; __storage_pointer __p = __first_; for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word) *__p = ~*__p; if (__n > 0) { __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); __storage_type __b = *__p & __m; *__p &= ~__m; *__p |= ~__b & __m; } } template <size_t _N_words, size_t _Size> unsigned long __bitset<_N_words, _Size>::to_ulong(false_type) const { const_iterator __e = __make_iter(_Size); const_iterator __i = std::__1::find(__make_iter(sizeof(unsigned long) * 8), __e, true); if (__i != __e) __throw_overflow_error("bitset to_ulong overflow error"); return __first_[0]; } template <size_t _N_words, size_t _Size> inline unsigned long __bitset<_N_words, _Size>::to_ulong(true_type) const { return __first_[0]; } template <size_t _N_words, size_t _Size> unsigned long long __bitset<_N_words, _Size>::to_ullong(false_type) const { const_iterator __e = __make_iter(_Size); const_iterator __i = std::__1::find(__make_iter(sizeof(unsigned long long) * 8), __e, true); if (__i != __e) __throw_overflow_error("bitset to_ullong overflow error"); return to_ullong(true_type()); } template <size_t _N_words, size_t _Size> inline unsigned long long __bitset<_N_words, _Size>::to_ullong(true_type) const { return to_ullong(true_type(), integral_constant<bool, sizeof(__storage_type) < sizeof(unsigned long long)>()); } template <size_t _N_words, size_t _Size> inline unsigned long long __bitset<_N_words, _Size>::to_ullong(true_type, false_type) const { return __first_[0]; } template <size_t _N_words, size_t _Size> unsigned long long __bitset<_N_words, _Size>::to_ullong(true_type, true_type) const { unsigned long long __r = __first_[0]; for (std::size_t __i = 1; __i < sizeof(unsigned long long) / sizeof(__storage_type); ++__i) __r |= static_cast<unsigned long long>(__first_[__i]) << (sizeof(__storage_type) * 8); return __r; } template <size_t _N_words, size_t _Size> bool __bitset<_N_words, _Size>::all() const noexcept { size_type __n = _Size; __const_storage_pointer __p = __first_; for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word) if (~*__p) return false; if (__n > 0) { __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); if (~*__p & __m) return false; } return true; } template <size_t _N_words, size_t _Size> bool __bitset<_N_words, _Size>::any() const noexcept { size_type __n = _Size; __const_storage_pointer __p = __first_; for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word) if (*__p) return true; if (__n > 0) { __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); if (*__p & __m) return true; } return false; } template <size_t _N_words, size_t _Size> inline size_t __bitset<_N_words, _Size>::__hash_code() const noexcept { size_t __h = 0; for (size_type __i = 0; __i < _N_words; ++__i) __h ^= __first_[__i]; return __h; } template <size_t _Size> class __bitset<1, _Size> { public: typedef ptrdiff_t difference_type; typedef size_t size_type; typedef size_type __storage_type; protected: typedef __bitset __self; typedef __storage_type* __storage_pointer; typedef const __storage_type* __const_storage_pointer; static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * 8); friend class __bit_reference<__bitset>; friend class __bit_const_reference<__bitset>; friend class __bit_iterator<__bitset, false>; friend class __bit_iterator<__bitset, true>; friend struct __bit_array<__bitset>; __storage_type __first_; typedef __bit_reference<__bitset> reference; typedef __bit_const_reference<__bitset> const_reference; typedef __bit_iterator<__bitset, false> iterator; typedef __bit_iterator<__bitset, true> const_iterator; __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __bitset() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit constexpr __bitset(unsigned long long __v) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) reference __make_ref(size_t __pos) noexcept {return reference(&__first_, __storage_type(1) << __pos);} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const_reference __make_ref(size_t __pos) const noexcept {return const_reference(&__first_, __storage_type(1) << __pos);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __make_iter(size_t __pos) noexcept {return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator __make_iter(size_t __pos) const noexcept {return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} __attribute__ ((__exclude_from_explicit_instantiation__)) void operator&=(const __bitset& __v) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) void operator|=(const __bitset& __v) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) void operator^=(const __bitset& __v) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) void flip() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) unsigned long to_ulong() const; __attribute__ ((__exclude_from_explicit_instantiation__)) unsigned long long to_ullong() const; __attribute__ ((__exclude_from_explicit_instantiation__)) bool all() const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) bool any() const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) size_t __hash_code() const noexcept; }; template <size_t _Size> inline constexpr __bitset<1, _Size>::__bitset() noexcept : __first_(0) { } template <size_t _Size> inline constexpr __bitset<1, _Size>::__bitset(unsigned long long __v) noexcept : __first_( _Size == __bits_per_word ? static_cast<__storage_type>(__v) : static_cast<__storage_type>(__v) & ((__storage_type(1) << _Size) - 1) ) { } template <size_t _Size> inline void __bitset<1, _Size>::operator&=(const __bitset& __v) noexcept { __first_ &= __v.__first_; } template <size_t _Size> inline void __bitset<1, _Size>::operator|=(const __bitset& __v) noexcept { __first_ |= __v.__first_; } template <size_t _Size> inline void __bitset<1, _Size>::operator^=(const __bitset& __v) noexcept { __first_ ^= __v.__first_; } template <size_t _Size> inline void __bitset<1, _Size>::flip() noexcept { __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size); __first_ = ~__first_; __first_ &= __m; } template <size_t _Size> inline unsigned long __bitset<1, _Size>::to_ulong() const { return __first_; } template <size_t _Size> inline unsigned long long __bitset<1, _Size>::to_ullong() const { return __first_; } template <size_t _Size> inline bool __bitset<1, _Size>::all() const noexcept { __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size); return !(~__first_ & __m); } template <size_t _Size> inline bool __bitset<1, _Size>::any() const noexcept { __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size); return __first_ & __m; } template <size_t _Size> inline size_t __bitset<1, _Size>::__hash_code() const noexcept { return __first_; } template <> class __bitset<0, 0> { public: typedef ptrdiff_t difference_type; typedef size_t size_type; typedef size_type __storage_type; protected: typedef __bitset __self; typedef __storage_type* __storage_pointer; typedef const __storage_type* __const_storage_pointer; static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * 8); friend class __bit_reference<__bitset>; friend class __bit_const_reference<__bitset>; friend class __bit_iterator<__bitset, false>; friend class __bit_iterator<__bitset, true>; friend struct __bit_array<__bitset>; typedef __bit_reference<__bitset> reference; typedef __bit_const_reference<__bitset> const_reference; typedef __bit_iterator<__bitset, false> iterator; typedef __bit_iterator<__bitset, true> const_iterator; __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr __bitset() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit constexpr __bitset(unsigned long long) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) reference __make_ref(size_t) noexcept {return reference(0, 1);} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const_reference __make_ref(size_t) const noexcept {return const_reference(0, 1);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __make_iter(size_t) noexcept {return iterator(0, 0);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator __make_iter(size_t) const noexcept {return const_iterator(0, 0);} __attribute__ ((__exclude_from_explicit_instantiation__)) void operator&=(const __bitset&) noexcept {} __attribute__ ((__exclude_from_explicit_instantiation__)) void operator|=(const __bitset&) noexcept {} __attribute__ ((__exclude_from_explicit_instantiation__)) void operator^=(const __bitset&) noexcept {} __attribute__ ((__exclude_from_explicit_instantiation__)) void flip() noexcept {} __attribute__ ((__exclude_from_explicit_instantiation__)) unsigned long to_ulong() const {return 0;} __attribute__ ((__exclude_from_explicit_instantiation__)) unsigned long long to_ullong() const {return 0;} __attribute__ ((__exclude_from_explicit_instantiation__)) bool all() const noexcept {return true;} __attribute__ ((__exclude_from_explicit_instantiation__)) bool any() const noexcept {return false;} __attribute__ ((__exclude_from_explicit_instantiation__)) size_t __hash_code() const noexcept {return 0;} }; inline constexpr __bitset<0, 0>::__bitset() noexcept { } inline constexpr __bitset<0, 0>::__bitset(unsigned long long) noexcept { } template <size_t _Size> class bitset; template <size_t _Size> struct hash<bitset<_Size> >; template <size_t _Size> class bitset : private __bitset<_Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * 8) + 1, _Size> { public: static const unsigned __n_words = _Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * 8) + 1; typedef __bitset<__n_words, _Size> base; public: typedef typename base::reference reference; typedef typename base::const_reference const_reference; __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bitset() noexcept {} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bitset(unsigned long long __v) noexcept : base(__v) {} template<class _CharT, class = _EnableIf<_IsCharLikeType<_CharT>::value> > explicit bitset(const _CharT* __str, typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos, _CharT __zero = _CharT('0'), _CharT __one = _CharT('1')); template<class _CharT, class _Traits, class _Allocator> explicit bitset(const basic_string<_CharT,_Traits,_Allocator>& __str, typename basic_string<_CharT,_Traits,_Allocator>::size_type __pos = 0, typename basic_string<_CharT,_Traits,_Allocator>::size_type __n = (basic_string<_CharT,_Traits,_Allocator>::npos), _CharT __zero = _CharT('0'), _CharT __one = _CharT('1')); __attribute__ ((__exclude_from_explicit_instantiation__)) bitset& operator&=(const bitset& __rhs) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) bitset& operator|=(const bitset& __rhs) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) bitset& operator^=(const bitset& __rhs) noexcept; bitset& operator<<=(size_t __pos) noexcept; bitset& operator>>=(size_t __pos) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) bitset& set() noexcept; bitset& set(size_t __pos, bool __val = true); __attribute__ ((__exclude_from_explicit_instantiation__)) bitset& reset() noexcept; bitset& reset(size_t __pos); __attribute__ ((__exclude_from_explicit_instantiation__)) bitset operator~() const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) bitset& flip() noexcept; bitset& flip(size_t __pos); __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const_reference operator[](size_t __p) const {return base::__make_ref(__p);} __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator[](size_t __p) {return base::__make_ref(__p);} __attribute__ ((__exclude_from_explicit_instantiation__)) unsigned long to_ulong() const; __attribute__ ((__exclude_from_explicit_instantiation__)) unsigned long long to_ullong() const; template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator> to_string(_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const; template <class _CharT, class _Traits> __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string<_CharT, _Traits, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const; template <class _CharT> __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const; __attribute__ ((__exclude_from_explicit_instantiation__)) basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0', char __one = '1') const; __attribute__ ((__exclude_from_explicit_instantiation__)) size_t count() const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr size_t size() const noexcept {return _Size;} __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const bitset& __rhs) const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const bitset& __rhs) const noexcept; bool test(size_t __pos) const; __attribute__ ((__exclude_from_explicit_instantiation__)) bool all() const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) bool any() const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) bool none() const noexcept {return !any();} __attribute__ ((__exclude_from_explicit_instantiation__)) bitset operator<<(size_t __pos) const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) bitset operator>>(size_t __pos) const noexcept; private: __attribute__ ((__exclude_from_explicit_instantiation__)) size_t __hash_code() const noexcept {return base::__hash_code();} friend struct hash<bitset>; }; template <size_t _Size> template<class _CharT, class> bitset<_Size>::bitset(const _CharT* __str, typename basic_string<_CharT>::size_type __n, _CharT __zero, _CharT __one) { size_t __rlen = std::__1::min(__n, char_traits<_CharT>::length(__str)); for (size_t __i = 0; __i < __rlen; ++__i) if (__str[__i] != __zero && __str[__i] != __one) __throw_invalid_argument("bitset string ctor has invalid argument"); size_t _Mp = std::__1::min(__rlen, _Size); size_t __i = 0; for (; __i < _Mp; ++__i) { _CharT __c = __str[_Mp - 1 - __i]; if (__c == __zero) (*this)[__i] = false; else (*this)[__i] = true; } std::__1::fill(base::__make_iter(__i), base::__make_iter(_Size), false); } template <size_t _Size> template<class _CharT, class _Traits, class _Allocator> bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str, typename basic_string<_CharT,_Traits,_Allocator>::size_type __pos, typename basic_string<_CharT,_Traits,_Allocator>::size_type __n, _CharT __zero, _CharT __one) { if (__pos > __str.size()) __throw_out_of_range("bitset string pos out of range"); size_t __rlen = std::__1::min(__n, __str.size() - __pos); for (size_t __i = __pos; __i < __pos + __rlen; ++__i) if (!_Traits::eq(__str[__i], __zero) && !_Traits::eq(__str[__i], __one)) __throw_invalid_argument("bitset string ctor has invalid argument"); size_t _Mp = std::__1::min(__rlen, _Size); size_t __i = 0; for (; __i < _Mp; ++__i) { _CharT __c = __str[__pos + _Mp - 1 - __i]; if (_Traits::eq(__c, __zero)) (*this)[__i] = false; else (*this)[__i] = true; } std::__1::fill(base::__make_iter(__i), base::__make_iter(_Size), false); } template <size_t _Size> inline bitset<_Size>& bitset<_Size>::operator&=(const bitset& __rhs) noexcept { base::operator&=(__rhs); return *this; } template <size_t _Size> inline bitset<_Size>& bitset<_Size>::operator|=(const bitset& __rhs) noexcept { base::operator|=(__rhs); return *this; } template <size_t _Size> inline bitset<_Size>& bitset<_Size>::operator^=(const bitset& __rhs) noexcept { base::operator^=(__rhs); return *this; } template <size_t _Size> bitset<_Size>& bitset<_Size>::operator<<=(size_t __pos) noexcept { __pos = std::__1::min(__pos, _Size); std::__1::copy_backward(base::__make_iter(0), base::__make_iter(_Size - __pos), base::__make_iter(_Size)); std::__1::fill_n(base::__make_iter(0), __pos, false); return *this; } template <size_t _Size> bitset<_Size>& bitset<_Size>::operator>>=(size_t __pos) noexcept { __pos = std::__1::min(__pos, _Size); std::__1::copy(base::__make_iter(__pos), base::__make_iter(_Size), base::__make_iter(0)); std::__1::fill_n(base::__make_iter(_Size - __pos), __pos, false); return *this; } template <size_t _Size> inline bitset<_Size>& bitset<_Size>::set() noexcept { std::__1::fill_n(base::__make_iter(0), _Size, true); return *this; } template <size_t _Size> bitset<_Size>& bitset<_Size>::set(size_t __pos, bool __val) { if (__pos >= _Size) __throw_out_of_range("bitset set argument out of range"); (*this)[__pos] = __val; return *this; } template <size_t _Size> inline bitset<_Size>& bitset<_Size>::reset() noexcept { std::__1::fill_n(base::__make_iter(0), _Size, false); return *this; } template <size_t _Size> bitset<_Size>& bitset<_Size>::reset(size_t __pos) { if (__pos >= _Size) __throw_out_of_range("bitset reset argument out of range"); (*this)[__pos] = false; return *this; } template <size_t _Size> inline bitset<_Size> bitset<_Size>::operator~() const noexcept { bitset __x(*this); __x.flip(); return __x; } template <size_t _Size> inline bitset<_Size>& bitset<_Size>::flip() noexcept { base::flip(); return *this; } template <size_t _Size> bitset<_Size>& bitset<_Size>::flip(size_t __pos) { if (__pos >= _Size) __throw_out_of_range("bitset flip argument out of range"); reference r = base::__make_ref(__pos); r = ~r; return *this; } template <size_t _Size> inline unsigned long bitset<_Size>::to_ulong() const { return base::to_ulong(); } template <size_t _Size> inline unsigned long long bitset<_Size>::to_ullong() const { return base::to_ullong(); } template <size_t _Size> template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator> bitset<_Size>::to_string(_CharT __zero, _CharT __one) const { basic_string<_CharT, _Traits, _Allocator> __r(_Size, __zero); for (size_t __i = 0; __i < _Size; ++__i) { if ((*this)[__i]) __r[_Size - 1 - __i] = __one; } return __r; } template <size_t _Size> template <class _CharT, class _Traits> inline basic_string<_CharT, _Traits, allocator<_CharT> > bitset<_Size>::to_string(_CharT __zero, _CharT __one) const { return to_string<_CharT, _Traits, allocator<_CharT> >(__zero, __one); } template <size_t _Size> template <class _CharT> inline basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > bitset<_Size>::to_string(_CharT __zero, _CharT __one) const { return to_string<_CharT, char_traits<_CharT>, allocator<_CharT> >(__zero, __one); } template <size_t _Size> inline basic_string<char, char_traits<char>, allocator<char> > bitset<_Size>::to_string(char __zero, char __one) const { return to_string<char, char_traits<char>, allocator<char> >(__zero, __one); } template <size_t _Size> inline size_t bitset<_Size>::count() const noexcept { return static_cast<size_t>(__count_bool_true(base::__make_iter(0), _Size)); } template <size_t _Size> inline bool bitset<_Size>::operator==(const bitset& __rhs) const noexcept { return std::__1::equal(base::__make_iter(0), base::__make_iter(_Size), __rhs.__make_iter(0)); } template <size_t _Size> inline bool bitset<_Size>::operator!=(const bitset& __rhs) const noexcept { return !(*this == __rhs); } template <size_t _Size> bool bitset<_Size>::test(size_t __pos) const { if (__pos >= _Size) __throw_out_of_range("bitset test argument out of range"); return (*this)[__pos]; } template <size_t _Size> inline bool bitset<_Size>::all() const noexcept { return base::all(); } template <size_t _Size> inline bool bitset<_Size>::any() const noexcept { return base::any(); } template <size_t _Size> inline bitset<_Size> bitset<_Size>::operator<<(size_t __pos) const noexcept { bitset __r = *this; __r <<= __pos; return __r; } template <size_t _Size> inline bitset<_Size> bitset<_Size>::operator>>(size_t __pos) const noexcept { bitset __r = *this; __r >>= __pos; return __r; } template <size_t _Size> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bitset<_Size> operator&(const bitset<_Size>& __x, const bitset<_Size>& __y) noexcept { bitset<_Size> __r = __x; __r &= __y; return __r; } template <size_t _Size> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bitset<_Size> operator|(const bitset<_Size>& __x, const bitset<_Size>& __y) noexcept { bitset<_Size> __r = __x; __r |= __y; return __r; } template <size_t _Size> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bitset<_Size> operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) noexcept { bitset<_Size> __r = __x; __r ^= __y; return __r; } template <size_t _Size> struct hash<bitset<_Size> > : public unary_function<bitset<_Size>, size_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(const bitset<_Size>& __bs) const noexcept {return __bs.__hash_code();} }; template <class _CharT, class _Traits, size_t _Size> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x); template <class _CharT, class _Traits, size_t _Size> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x); } } namespace std { inline namespace __1 { using ::signbit; using ::fpclassify; using ::isfinite; using ::isinf; using ::isnan; using ::isnormal; using ::isgreater; using ::isgreaterequal; using ::isless; using ::islessequal; using ::islessgreater; using ::isunordered; using ::isunordered; using ::float_t; using ::double_t; using ::abs; using ::acos; using ::acosf; using ::asin; using ::asinf; using ::atan; using ::atanf; using ::atan2; using ::atan2f; using ::ceil; using ::ceilf; using ::cos; using ::cosf; using ::cosh; using ::coshf; using ::exp; using ::expf; using ::fabs; using ::fabsf; using ::floor; using ::floorf; using ::fmod; using ::fmodf; using ::frexp; using ::frexpf; using ::ldexp; using ::ldexpf; using ::log; using ::logf; using ::log10; using ::log10f; using ::modf; using ::modff; using ::pow; using ::powf; using ::sin; using ::sinf; using ::sinh; using ::sinhf; using ::sqrt; using ::sqrtf; using ::tan; using ::tanf; using ::tanh; using ::tanhf; using ::acosh; using ::acoshf; using ::asinh; using ::asinhf; using ::atanh; using ::atanhf; using ::cbrt; using ::cbrtf; using ::copysign; using ::copysignf; using ::erf; using ::erff; using ::erfc; using ::erfcf; using ::exp2; using ::exp2f; using ::expm1; using ::expm1f; using ::fdim; using ::fdimf; using ::fmaf; using ::fma; using ::fmax; using ::fmaxf; using ::fmin; using ::fminf; using ::hypot; using ::hypotf; using ::ilogb; using ::ilogbf; using ::lgamma; using ::lgammaf; using ::llrint; using ::llrintf; using ::llround; using ::llroundf; using ::log1p; using ::log1pf; using ::log2; using ::log2f; using ::logb; using ::logbf; using ::lrint; using ::lrintf; using ::lround; using ::lroundf; using ::nan; using ::nanf; using ::nearbyint; using ::nearbyintf; using ::nextafter; using ::nextafterf; using ::nexttoward; using ::nexttowardf; using ::remainder; using ::remainderf; using ::remquo; using ::remquof; using ::rint; using ::rintf; using ::round; using ::roundf; using ::scalbln; using ::scalblnf; using ::scalbn; using ::scalbnf; using ::tgamma; using ::tgammaf; using ::trunc; using ::truncf; 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 ::acoshl; using ::asinhl; using ::atanhl; using ::cbrtl; using ::copysignl; using ::erfl; using ::erfcl; using ::exp2l; using ::expm1l; using ::fdiml; using ::fmal; using ::fmaxl; using ::fminl; using ::hypotl; using ::ilogbl; using ::lgammal; using ::llrintl; using ::llroundl; using ::log1pl; using ::log2l; using ::logbl; using ::lrintl; using ::lroundl; using ::nanl; using ::nearbyintl; using ::nextafterl; using ::nexttowardl; using ::remainderl; using ::remquol; using ::rintl; using ::roundl; using ::scalblnl; using ::scalbnl; using ::tgammal; using ::truncl; template <class _A1> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename enable_if<is_floating_point<_A1>::value, bool>::type __libcpp_isnan_or_builtin(_A1 __lcpp_x) noexcept { return __builtin_isnan(__lcpp_x); } template <class _A1> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename enable_if<!is_floating_point<_A1>::value, bool>::type __libcpp_isnan_or_builtin(_A1 __lcpp_x) noexcept { return isnan(__lcpp_x); } template <class _A1> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename enable_if<is_floating_point<_A1>::value, bool>::type __libcpp_isinf_or_builtin(_A1 __lcpp_x) noexcept { return __builtin_isinf(__lcpp_x); } template <class _A1> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename enable_if<!is_floating_point<_A1>::value, bool>::type __libcpp_isinf_or_builtin(_A1 __lcpp_x) noexcept { return isinf(__lcpp_x); } template <class _A1> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename enable_if<is_floating_point<_A1>::value, bool>::type __libcpp_isfinite_or_builtin(_A1 __lcpp_x) noexcept { return __builtin_isfinite(__lcpp_x); } template <class _A1> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename enable_if<!is_floating_point<_A1>::value, bool>::type __libcpp_isfinite_or_builtin(_A1 __lcpp_x) noexcept { return isfinite(__lcpp_x); } template <class _IntT, class _FloatT, bool _FloatBigger = (numeric_limits<_FloatT>::digits > numeric_limits<_IntT>::digits), int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>::digits)> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _IntT __max_representable_int_for_float() noexcept { static_assert(is_floating_point<_FloatT>::value, "must be a floating point type"); static_assert(is_integral<_IntT>::value, "must be an integral type"); static_assert(numeric_limits<_FloatT>::radix == 2, "FloatT has incorrect radix"); static_assert((_IsSame<_FloatT, float>::value || _IsSame<_FloatT, double>::value || _IsSame<_FloatT,long double>::value), "unsupported floating point type"); return _FloatBigger ? numeric_limits<_IntT>::max() : (numeric_limits<_IntT>::max() >> _Bits << _Bits); } template <class _IntT, class _RealT> __attribute__ ((__exclude_from_explicit_instantiation__)) _IntT __clamp_to_integral(_RealT __r) noexcept { using _Lim = std::numeric_limits<_IntT>; const _IntT _MaxVal = std::__max_representable_int_for_float<_IntT, _RealT>(); if (__r >= ::nextafter(static_cast<_RealT>(_MaxVal), ((float)(1e+300 * 1e+300)))) { return _Lim::max(); } else if (__r <= _Lim::lowest()) { return _Lim::min(); } return static_cast<_IntT>(__r); } } } namespace std { inline namespace __1 { using ::clock_t; using ::size_t; using ::time_t; using ::tm; using ::clock; using ::difftime; using ::mktime; using ::time; using ::asctime; using ::ctime; using ::gmtime; using ::localtime; using ::strftime; } } namespace std { inline namespace __1 { template <intmax_t _Xp, intmax_t _Yp> struct __static_gcd { static const intmax_t value = __static_gcd<_Yp, _Xp % _Yp>::value; }; template <intmax_t _Xp> struct __static_gcd<_Xp, 0> { static const intmax_t value = _Xp; }; template <> struct __static_gcd<0, 0> { static const intmax_t value = 1; }; template <intmax_t _Xp, intmax_t _Yp> struct __static_lcm { static const intmax_t value = _Xp / __static_gcd<_Xp, _Yp>::value * _Yp; }; template <intmax_t _Xp> struct __static_abs { static const intmax_t value = _Xp < 0 ? -_Xp : _Xp; }; template <intmax_t _Xp> struct __static_sign { static const intmax_t value = _Xp == 0 ? 0 : (_Xp < 0 ? -1 : 1); }; template <intmax_t _Xp, intmax_t _Yp, intmax_t = __static_sign<_Yp>::value> class __ll_add; template <intmax_t _Xp, intmax_t _Yp> class __ll_add<_Xp, _Yp, 1> { static const intmax_t min = (1LL << (sizeof(intmax_t) * 8 - 1)) + 1; static const intmax_t max = -min; static_assert(_Xp <= max - _Yp, "overflow in __ll_add"); public: static const intmax_t value = _Xp + _Yp; }; template <intmax_t _Xp, intmax_t _Yp> class __ll_add<_Xp, _Yp, 0> { public: static const intmax_t value = _Xp; }; template <intmax_t _Xp, intmax_t _Yp> class __ll_add<_Xp, _Yp, -1> { static const intmax_t min = (1LL << (sizeof(intmax_t) * 8 - 1)) + 1; static const intmax_t max = -min; static_assert(min - _Yp <= _Xp, "overflow in __ll_add"); public: static const intmax_t value = _Xp + _Yp; }; template <intmax_t _Xp, intmax_t _Yp, intmax_t = __static_sign<_Yp>::value> class __ll_sub; template <intmax_t _Xp, intmax_t _Yp> class __ll_sub<_Xp, _Yp, 1> { static const intmax_t min = (1LL << (sizeof(intmax_t) * 8 - 1)) + 1; static const intmax_t max = -min; static_assert(min + _Yp <= _Xp, "overflow in __ll_sub"); public: static const intmax_t value = _Xp - _Yp; }; template <intmax_t _Xp, intmax_t _Yp> class __ll_sub<_Xp, _Yp, 0> { public: static const intmax_t value = _Xp; }; template <intmax_t _Xp, intmax_t _Yp> class __ll_sub<_Xp, _Yp, -1> { static const intmax_t min = (1LL << (sizeof(intmax_t) * 8 - 1)) + 1; static const intmax_t max = -min; static_assert(_Xp <= max + _Yp, "overflow in __ll_sub"); public: static const intmax_t value = _Xp - _Yp; }; template <intmax_t _Xp, intmax_t _Yp> class __ll_mul { static const intmax_t nan = (1LL << (sizeof(intmax_t) * 8 - 1)); static const intmax_t min = nan + 1; static const intmax_t max = -min; static const intmax_t __a_x = __static_abs<_Xp>::value; static const intmax_t __a_y = __static_abs<_Yp>::value; static_assert(_Xp != nan && _Yp != nan && __a_x <= max / __a_y, "overflow in __ll_mul"); public: static const intmax_t value = _Xp * _Yp; }; template <intmax_t _Yp> class __ll_mul<0, _Yp> { public: static const intmax_t value = 0; }; template <intmax_t _Xp> class __ll_mul<_Xp, 0> { public: static const intmax_t value = 0; }; template <> class __ll_mul<0, 0> { public: static const intmax_t value = 0; }; template <intmax_t _Xp, intmax_t _Yp> class __ll_div { static const intmax_t nan = (1LL << (sizeof(intmax_t) * 8 - 1)); static const intmax_t min = nan + 1; static const intmax_t max = -min; static_assert(_Xp != nan && _Yp != nan && _Yp != 0, "overflow in __ll_div"); public: static const intmax_t value = _Xp / _Yp; }; template <intmax_t _Num, intmax_t _Den = 1> class ratio { static_assert(__static_abs<_Num>::value >= 0, "ratio numerator is out of range"); static_assert(_Den != 0, "ratio divide by 0"); static_assert(__static_abs<_Den>::value > 0, "ratio denominator is out of range"); static constexpr const intmax_t __na = __static_abs<_Num>::value; static constexpr const intmax_t __da = __static_abs<_Den>::value; static constexpr const intmax_t __s = __static_sign<_Num>::value * __static_sign<_Den>::value; static constexpr const intmax_t __gcd = __static_gcd<__na, __da>::value; public: static constexpr const intmax_t num = __s * __na / __gcd; static constexpr const intmax_t den = __da / __gcd; typedef ratio<num, den> type; }; template <intmax_t _Num, intmax_t _Den> constexpr const intmax_t ratio<_Num, _Den>::num; template <intmax_t _Num, intmax_t _Den> constexpr const intmax_t ratio<_Num, _Den>::den; template <class _Tp> struct __is_ratio : false_type {}; template <intmax_t _Num, intmax_t _Den> struct __is_ratio<ratio<_Num, _Den> > : true_type {}; typedef ratio<1LL, 1000000000000000000LL> atto; typedef ratio<1LL, 1000000000000000LL> femto; typedef ratio<1LL, 1000000000000LL> pico; typedef ratio<1LL, 1000000000LL> nano; typedef ratio<1LL, 1000000LL> micro; typedef ratio<1LL, 1000LL> milli; typedef ratio<1LL, 100LL> centi; typedef ratio<1LL, 10LL> deci; typedef ratio< 10LL, 1LL> deca; typedef ratio< 100LL, 1LL> hecto; typedef ratio< 1000LL, 1LL> kilo; typedef ratio< 1000000LL, 1LL> mega; typedef ratio< 1000000000LL, 1LL> giga; typedef ratio< 1000000000000LL, 1LL> tera; typedef ratio< 1000000000000000LL, 1LL> peta; typedef ratio<1000000000000000000LL, 1LL> exa; template <class _R1, class _R2> struct __ratio_multiply { private: static const intmax_t __gcd_n1_d2 = __static_gcd<_R1::num, _R2::den>::value; static const intmax_t __gcd_d1_n2 = __static_gcd<_R1::den, _R2::num>::value; public: typedef typename ratio < __ll_mul<_R1::num / __gcd_n1_d2, _R2::num / __gcd_d1_n2>::value, __ll_mul<_R2::den / __gcd_n1_d2, _R1::den / __gcd_d1_n2>::value >::type type; }; template <class _R1, class _R2> using ratio_multiply = typename __ratio_multiply<_R1, _R2>::type; template <class _R1, class _R2> struct __ratio_divide { private: static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value; static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value; public: typedef typename ratio < __ll_mul<_R1::num / __gcd_n1_n2, _R2::den / __gcd_d1_d2>::value, __ll_mul<_R2::num / __gcd_n1_n2, _R1::den / __gcd_d1_d2>::value >::type type; }; template <class _R1, class _R2> using ratio_divide = typename __ratio_divide<_R1, _R2>::type; template <class _R1, class _R2> struct __ratio_add { private: static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value; static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value; public: typedef typename ratio_multiply < ratio<__gcd_n1_n2, _R1::den / __gcd_d1_d2>, ratio < __ll_add < __ll_mul<_R1::num / __gcd_n1_n2, _R2::den / __gcd_d1_d2>::value, __ll_mul<_R2::num / __gcd_n1_n2, _R1::den / __gcd_d1_d2>::value >::value, _R2::den > >::type type; }; template <class _R1, class _R2> using ratio_add = typename __ratio_add<_R1, _R2>::type; template <class _R1, class _R2> struct __ratio_subtract { private: static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value; static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value; public: typedef typename ratio_multiply < ratio<__gcd_n1_n2, _R1::den / __gcd_d1_d2>, ratio < __ll_sub < __ll_mul<_R1::num / __gcd_n1_n2, _R2::den / __gcd_d1_d2>::value, __ll_mul<_R2::num / __gcd_n1_n2, _R1::den / __gcd_d1_d2>::value >::value, _R2::den > >::type type; }; template <class _R1, class _R2> using ratio_subtract = typename __ratio_subtract<_R1, _R2>::type; template <class _R1, class _R2> struct ratio_equal : public integral_constant<bool,((_R1::num == _R2::num && _R1::den == _R2::den))> {}; template <class _R1, class _R2> struct ratio_not_equal : public integral_constant<bool,((!ratio_equal<_R1, _R2>::value))> {}; template <class _R1, class _R2, bool _Odd = false, intmax_t _Q1 = _R1::num / _R1::den, intmax_t _M1 = _R1::num % _R1::den, intmax_t _Q2 = _R2::num / _R2::den, intmax_t _M2 = _R2::num % _R2::den> struct __ratio_less1 { static const bool value = _Odd ? _Q2 < _Q1 : _Q1 < _Q2; }; template <class _R1, class _R2, bool _Odd, intmax_t _Qp> struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, 0> { static const bool value = false; }; template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M2> struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, _M2> { static const bool value = !_Odd; }; template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M1> struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, 0> { static const bool value = _Odd; }; template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M1, intmax_t _M2> struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, _M2> { static const bool value = __ratio_less1<ratio<_R1::den, _M1>, ratio<_R2::den, _M2>, !_Odd>::value; }; template <class _R1, class _R2, intmax_t _S1 = __static_sign<_R1::num>::value, intmax_t _S2 = __static_sign<_R2::num>::value> struct __ratio_less { static const bool value = _S1 < _S2; }; template <class _R1, class _R2> struct __ratio_less<_R1, _R2, 1LL, 1LL> { static const bool value = __ratio_less1<_R1, _R2>::value; }; template <class _R1, class _R2> struct __ratio_less<_R1, _R2, -1LL, -1LL> { static const bool value = __ratio_less1<ratio<-_R2::num, _R2::den>, ratio<-_R1::num, _R1::den> >::value; }; template <class _R1, class _R2> struct ratio_less : public integral_constant<bool,((__ratio_less<_R1, _R2>::value))> {}; template <class _R1, class _R2> struct ratio_less_equal : public integral_constant<bool,((!ratio_less<_R2, _R1>::value))> {}; template <class _R1, class _R2> struct ratio_greater : public integral_constant<bool,((ratio_less<_R2, _R1>::value))> {}; template <class _R1, class _R2> struct ratio_greater_equal : public integral_constant<bool,((!ratio_less<_R1, _R2>::value))> {}; template <class _R1, class _R2> struct __ratio_gcd { typedef ratio<__static_gcd<_R1::num, _R2::num>::value, __static_lcm<_R1::den, _R2::den>::value> type; }; } } namespace std { inline namespace __1 { namespace __fs { namespace filesystem { struct _FilesystemClock; } } } } namespace std { inline namespace __1 { namespace chrono { template <class _Rep, class _Period = ratio<1> > class duration; template <class _Tp> struct __is_duration : false_type {}; template <class _Rep, class _Period> struct __is_duration<duration<_Rep, _Period> > : true_type {}; template <class _Rep, class _Period> struct __is_duration<const duration<_Rep, _Period> > : true_type {}; template <class _Rep, class _Period> struct __is_duration<volatile duration<_Rep, _Period> > : true_type {}; template <class _Rep, class _Period> struct __is_duration<const volatile duration<_Rep, _Period> > : true_type {}; } template <class _Rep1, class _Period1, class _Rep2, class _Period2> struct common_type<chrono::duration<_Rep1, _Period1>, chrono::duration<_Rep2, _Period2> > { typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type, typename __ratio_gcd<_Period1, _Period2>::type> type; }; namespace chrono { template <class _FromDuration, class _ToDuration, class _Period = typename ratio_divide<typename _FromDuration::period, typename _ToDuration::period>::type, bool = _Period::num == 1, bool = _Period::den == 1> struct __duration_cast; template <class _FromDuration, class _ToDuration, class _Period> struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true> { __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _ToDuration operator()(const _FromDuration& __fd) const { return _ToDuration(static_cast<typename _ToDuration::rep>(__fd.count())); } }; template <class _FromDuration, class _ToDuration, class _Period> struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false> { __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _ToDuration operator()(const _FromDuration& __fd) const { typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct; return _ToDuration(static_cast<typename _ToDuration::rep>( static_cast<_Ct>(__fd.count()) / static_cast<_Ct>(_Period::den))); } }; template <class _FromDuration, class _ToDuration, class _Period> struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true> { __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _ToDuration operator()(const _FromDuration& __fd) const { typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct; return _ToDuration(static_cast<typename _ToDuration::rep>( static_cast<_Ct>(__fd.count()) * static_cast<_Ct>(_Period::num))); } }; template <class _FromDuration, class _ToDuration, class _Period> struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false> { __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _ToDuration operator()(const _FromDuration& __fd) const { typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct; return _ToDuration(static_cast<typename _ToDuration::rep>( static_cast<_Ct>(__fd.count()) * static_cast<_Ct>(_Period::num) / static_cast<_Ct>(_Period::den))); } }; template <class _ToDuration, class _Rep, class _Period> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename enable_if < __is_duration<_ToDuration>::value, _ToDuration >::type duration_cast(const duration<_Rep, _Period>& __fd) { return __duration_cast<duration<_Rep, _Period>, _ToDuration>()(__fd); } template <class _Rep> struct treat_as_floating_point : is_floating_point<_Rep> {}; template <class _Rep> struct duration_values { public: __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr _Rep zero() noexcept {return _Rep(0);} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr _Rep max() noexcept {return numeric_limits<_Rep>::max();} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr _Rep min() noexcept {return numeric_limits<_Rep>::lowest();} }; template <class _Rep, class _Period> class duration { static_assert(!__is_duration<_Rep>::value, "A duration representation can not be a duration"); static_assert(__is_ratio<_Period>::value, "Second template parameter of duration must be a std::ratio"); static_assert(_Period::num > 0, "duration period must be positive"); template <class _R1, class _R2> struct __no_overflow { private: static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value; static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value; static const intmax_t __n1 = _R1::num / __gcd_n1_n2; static const intmax_t __d1 = _R1::den / __gcd_d1_d2; static const intmax_t __n2 = _R2::num / __gcd_n1_n2; static const intmax_t __d2 = _R2::den / __gcd_d1_d2; static const intmax_t max = -((intmax_t(1) << (sizeof(intmax_t) * 8 - 1)) + 1); template <intmax_t _Xp, intmax_t _Yp, bool __overflow> struct __mul { static const intmax_t value = _Xp * _Yp; }; template <intmax_t _Xp, intmax_t _Yp> struct __mul<_Xp, _Yp, true> { static const intmax_t value = 1; }; public: static const bool value = (__n1 <= max / __d2) && (__n2 <= max / __d1); typedef ratio<__mul<__n1, __d2, !value>::value, __mul<__n2, __d1, !value>::value> type; }; public: typedef _Rep rep; typedef typename _Period::type period; private: rep __rep_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr duration() = default; template <class _Rep2> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr explicit duration(const _Rep2& __r, typename enable_if < is_convertible<_Rep2, rep>::value && (treat_as_floating_point<rep>::value || !treat_as_floating_point<_Rep2>::value) >::type* = 0) : __rep_(__r) {} template <class _Rep2, class _Period2> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr duration(const duration<_Rep2, _Period2>& __d, typename enable_if < __no_overflow<_Period2, period>::value && ( treat_as_floating_point<rep>::value || (__no_overflow<_Period2, period>::type::den == 1 && !treat_as_floating_point<_Rep2>::value)) >::type* = 0) : __rep_(std::__1::chrono::duration_cast<duration>(__d).count()) {} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr rep count() const {return __rep_;} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename common_type<duration>::type operator+() const {return typename common_type<duration>::type(*this);} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename common_type<duration>::type operator-() const {return typename common_type<duration>::type(-__rep_);} __attribute__ ((__exclude_from_explicit_instantiation__)) duration& operator++() {++__rep_; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) duration operator++(int) {return duration(__rep_++);} __attribute__ ((__exclude_from_explicit_instantiation__)) duration& operator--() {--__rep_; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) duration operator--(int) {return duration(__rep_--);} __attribute__ ((__exclude_from_explicit_instantiation__)) duration& operator+=(const duration& __d) {__rep_ += __d.count(); return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) duration& operator-=(const duration& __d) {__rep_ -= __d.count(); return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) duration& operator*=(const rep& rhs) {__rep_ *= rhs; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) duration& operator/=(const rep& rhs) {__rep_ /= rhs; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) duration& operator%=(const rep& rhs) {__rep_ %= rhs; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) duration& operator%=(const duration& rhs) {__rep_ %= rhs.count(); return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr duration zero() noexcept {return duration(duration_values<rep>::zero());} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr duration min() noexcept {return duration(duration_values<rep>::min());} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr duration max() noexcept {return duration(duration_values<rep>::max());} }; typedef duration<long long, nano> nanoseconds; typedef duration<long long, micro> microseconds; typedef duration<long long, milli> milliseconds; typedef duration<long long > seconds; typedef duration< long, ratio< 60> > minutes; typedef duration< long, ratio<3600> > hours; template <class _LhsDuration, class _RhsDuration> struct __duration_eq { __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const { typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct; return _Ct(__lhs).count() == _Ct(__rhs).count(); } }; template <class _LhsDuration> struct __duration_eq<_LhsDuration, _LhsDuration> { __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const {return __lhs.count() == __rhs.count();} }; template <class _Rep1, class _Period1, class _Rep2, class _Period2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { return __duration_eq<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >()(__lhs, __rhs); } template <class _Rep1, class _Period1, class _Rep2, class _Period2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { return !(__lhs == __rhs); } template <class _LhsDuration, class _RhsDuration> struct __duration_lt { __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const { typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct; return _Ct(__lhs).count() < _Ct(__rhs).count(); } }; template <class _LhsDuration> struct __duration_lt<_LhsDuration, _LhsDuration> { __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const {return __lhs.count() < __rhs.count();} }; template <class _Rep1, class _Period1, class _Rep2, class _Period2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { return __duration_lt<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >()(__lhs, __rhs); } template <class _Rep1, class _Period1, class _Rep2, class _Period2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { return __rhs < __lhs; } template <class _Rep1, class _Period1, class _Rep2, class _Period2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { return !(__rhs < __lhs); } template <class _Rep1, class _Period1, class _Rep2, class _Period2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { return !(__lhs < __rhs); } template <class _Rep1, class _Period1, class _Rep2, class _Period2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd; return _Cd(_Cd(__lhs).count() + _Cd(__rhs).count()); } template <class _Rep1, class _Period1, class _Rep2, class _Period2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd; return _Cd(_Cd(__lhs).count() - _Cd(__rhs).count()); } template <class _Rep1, class _Period, class _Rep2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename enable_if < is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value, duration<typename common_type<_Rep1, _Rep2>::type, _Period> >::type operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s) { typedef typename common_type<_Rep1, _Rep2>::type _Cr; typedef duration<_Cr, _Period> _Cd; return _Cd(_Cd(__d).count() * static_cast<_Cr>(__s)); } template <class _Rep1, class _Period, class _Rep2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename enable_if < is_convertible<_Rep1, typename common_type<_Rep1, _Rep2>::type>::value, duration<typename common_type<_Rep1, _Rep2>::type, _Period> >::type operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d) { return __d * __s; } template <class _Rep1, class _Period, class _Rep2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename enable_if < !__is_duration<_Rep2>::value && is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value, duration<typename common_type<_Rep1, _Rep2>::type, _Period> >::type operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s) { typedef typename common_type<_Rep1, _Rep2>::type _Cr; typedef duration<_Cr, _Period> _Cd; return _Cd(_Cd(__d).count() / static_cast<_Cr>(__s)); } template <class _Rep1, class _Period1, class _Rep2, class _Period2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename common_type<_Rep1, _Rep2>::type operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Ct; return _Ct(__lhs).count() / _Ct(__rhs).count(); } template <class _Rep1, class _Period, class _Rep2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename enable_if < !__is_duration<_Rep2>::value && is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value, duration<typename common_type<_Rep1, _Rep2>::type, _Period> >::type operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s) { typedef typename common_type<_Rep1, _Rep2>::type _Cr; typedef duration<_Cr, _Period> _Cd; return _Cd(_Cd(__d).count() % static_cast<_Cr>(__s)); } template <class _Rep1, class _Period1, class _Rep2, class _Period2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { typedef typename common_type<_Rep1, _Rep2>::type _Cr; typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd; return _Cd(static_cast<_Cr>(_Cd(__lhs).count()) % static_cast<_Cr>(_Cd(__rhs).count())); } template <class _Clock, class _Duration = typename _Clock::duration> class time_point { static_assert(__is_duration<_Duration>::value, "Second template parameter of time_point must be a std::chrono::duration"); public: typedef _Clock clock; typedef _Duration duration; typedef typename duration::rep rep; typedef typename duration::period period; private: duration __d_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr time_point() : __d_(duration::zero()) {} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr explicit time_point(const duration& __d) : __d_(__d) {} template <class _Duration2> __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr time_point(const time_point<clock, _Duration2>& t, typename enable_if < is_convertible<_Duration2, duration>::value >::type* = 0) : __d_(t.time_since_epoch()) {} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr duration time_since_epoch() const {return __d_;} __attribute__ ((__exclude_from_explicit_instantiation__)) time_point& operator+=(const duration& __d) {__d_ += __d; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) time_point& operator-=(const duration& __d) {__d_ -= __d; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr time_point min() noexcept {return time_point(duration::min());} __attribute__ ((__exclude_from_explicit_instantiation__)) static constexpr time_point max() noexcept {return time_point(duration::max());} }; } template <class _Clock, class _Duration1, class _Duration2> struct common_type<chrono::time_point<_Clock, _Duration1>, chrono::time_point<_Clock, _Duration2> > { typedef chrono::time_point<_Clock, typename common_type<_Duration1, _Duration2>::type> type; }; namespace chrono { template <class _ToDuration, class _Clock, class _Duration> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr time_point<_Clock, _ToDuration> time_point_cast(const time_point<_Clock, _Duration>& __t) { return time_point<_Clock, _ToDuration>(std::__1::chrono::duration_cast<_ToDuration>(__t.time_since_epoch())); } template <class _Clock, class _Duration1, class _Duration2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) { return __lhs.time_since_epoch() == __rhs.time_since_epoch(); } template <class _Clock, class _Duration1, class _Duration2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) { return !(__lhs == __rhs); } template <class _Clock, class _Duration1, class _Duration2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator<(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) { return __lhs.time_since_epoch() < __rhs.time_since_epoch(); } template <class _Clock, class _Duration1, class _Duration2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) { return __rhs < __lhs; } template <class _Clock, class _Duration1, class _Duration2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator<=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) { return !(__rhs < __lhs); } template <class _Clock, class _Duration1, class _Duration2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) { return !(__lhs < __rhs); } template <class _Clock, class _Duration1, class _Rep2, class _Period2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> operator+(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Tr; return _Tr (__lhs.time_since_epoch() + __rhs); } template <class _Rep1, class _Period1, class _Clock, class _Duration2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr time_point<_Clock, typename common_type<duration<_Rep1, _Period1>, _Duration2>::type> operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) { return __rhs + __lhs; } template <class _Clock, class _Duration1, class _Rep2, class _Period2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs) { typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Ret; return _Ret(__lhs.time_since_epoch() -__rhs); } template <class _Clock, class _Duration1, class _Duration2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr typename common_type<_Duration1, _Duration2>::type operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) { return __lhs.time_since_epoch() - __rhs.time_since_epoch(); } class system_clock { public: typedef microseconds duration; typedef duration::rep rep; typedef duration::period period; typedef chrono::time_point<system_clock> time_point; static constexpr const bool is_steady = false; static time_point now() noexcept; static time_t to_time_t (const time_point& __t) noexcept; static time_point from_time_t(time_t __t) noexcept; }; class steady_clock { public: typedef nanoseconds duration; typedef duration::rep rep; typedef duration::period period; typedef chrono::time_point<steady_clock, duration> time_point; static constexpr const bool is_steady = true; static time_point now() noexcept; }; typedef steady_clock high_resolution_clock; } inline namespace literals { inline namespace chrono_literals { constexpr chrono::hours operator""h(unsigned long long __h) { return chrono::hours(static_cast<chrono::hours::rep>(__h)); } constexpr chrono::duration<long double, ratio<3600,1>> operator""h(long double __h) { return chrono::duration<long double, ratio<3600,1>>(__h); } constexpr chrono::minutes operator""min(unsigned long long __m) { return chrono::minutes(static_cast<chrono::minutes::rep>(__m)); } constexpr chrono::duration<long double, ratio<60,1>> operator""min(long double __m) { return chrono::duration<long double, ratio<60,1>> (__m); } constexpr chrono::seconds operator""s(unsigned long long __s) { return chrono::seconds(static_cast<chrono::seconds::rep>(__s)); } constexpr chrono::duration<long double> operator""s(long double __s) { return chrono::duration<long double> (__s); } constexpr chrono::milliseconds operator""ms(unsigned long long __ms) { return chrono::milliseconds(static_cast<chrono::milliseconds::rep>(__ms)); } constexpr chrono::duration<long double, milli> operator""ms(long double __ms) { return chrono::duration<long double, milli>(__ms); } constexpr chrono::microseconds operator""us(unsigned long long __us) { return chrono::microseconds(static_cast<chrono::microseconds::rep>(__us)); } constexpr chrono::duration<long double, micro> operator""us(long double __us) { return chrono::duration<long double, micro> (__us); } constexpr chrono::nanoseconds operator""ns(unsigned long long __ns) { return chrono::nanoseconds(static_cast<chrono::nanoseconds::rep>(__ns)); } constexpr chrono::duration<long double, nano> operator""ns(long double __ns) { return chrono::duration<long double, nano> (__ns); } }} namespace chrono { using namespace literals::chrono_literals; } } } namespace std { inline namespace __1 { namespace __fs { namespace filesystem { struct _FilesystemClock { typedef __int128_t rep; typedef nano period; typedef chrono::duration<rep, period> duration; typedef chrono::time_point<_FilesystemClock> time_point; static constexpr const bool is_steady = false; static time_point now() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) static time_t to_time_t(const time_point& __t) noexcept { typedef chrono::duration<rep> __secs; return time_t( chrono::duration_cast<__secs>(__t.time_since_epoch()).count()); } __attribute__ ((__exclude_from_explicit_instantiation__)) static time_point from_time_t(time_t __t) noexcept { typedef chrono::duration<rep> __secs; return time_point(__secs(__t)); } }; } } } } namespace std { inline namespace __1 { 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 }; } } namespace std { inline namespace __1 { template <class _Tp> struct is_error_code_enum : public false_type {}; template <class _Tp> struct is_error_condition_enum : public false_type {}; template <> struct is_error_condition_enum<errc> : true_type { }; class error_condition; class error_code; class __do_message; class error_category { public: virtual ~error_category() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr error_category() noexcept = default; private: error_category(const error_category&); error_category& operator=(const error_category&); public: virtual const char* name() const noexcept = 0; virtual error_condition default_error_condition(int __ev) const noexcept; virtual bool equivalent(int __code, const error_condition& __condition) const noexcept; virtual bool equivalent(const error_code& __code, int __condition) const noexcept; virtual string message(int __ev) const = 0; __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const error_category& __rhs) const noexcept {return this == &__rhs;} __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const error_category& __rhs) const noexcept {return !(*this == __rhs);} __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator< (const error_category& __rhs) const noexcept {return this < &__rhs;} friend class __do_message; }; class __do_message : public error_category { public: virtual string message(int ev) const; }; const error_category& generic_category() noexcept; const error_category& system_category() noexcept; class error_condition { int __val_; const error_category* __cat_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) error_condition() noexcept : __val_(0), __cat_(&generic_category()) {} __attribute__ ((__exclude_from_explicit_instantiation__)) error_condition(int __val, const error_category& __cat) noexcept : __val_(__val), __cat_(&__cat) {} template <class _Ep> __attribute__ ((__exclude_from_explicit_instantiation__)) error_condition(_Ep __e, typename enable_if<is_error_condition_enum<_Ep>::value>::type* = 0 ) noexcept {*this = make_error_condition(__e);} __attribute__ ((__exclude_from_explicit_instantiation__)) void assign(int __val, const error_category& __cat) noexcept { __val_ = __val; __cat_ = &__cat; } template <class _Ep> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_error_condition_enum<_Ep>::value, error_condition& >::type operator=(_Ep __e) noexcept {*this = make_error_condition(__e); return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) void clear() noexcept { __val_ = 0; __cat_ = &generic_category(); } __attribute__ ((__exclude_from_explicit_instantiation__)) int value() const noexcept {return __val_;} __attribute__ ((__exclude_from_explicit_instantiation__)) const error_category& category() const noexcept {return *__cat_;} string message() const; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit operator bool() const noexcept {return __val_ != 0;} }; inline __attribute__ ((__exclude_from_explicit_instantiation__)) error_condition make_error_condition(errc __e) noexcept { return error_condition(static_cast<int>(__e), generic_category()); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<(const error_condition& __x, const error_condition& __y) noexcept { return __x.category() < __y.category() || (__x.category() == __y.category() && __x.value() < __y.value()); } class error_code { int __val_; const error_category* __cat_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) error_code() noexcept : __val_(0), __cat_(&system_category()) {} __attribute__ ((__exclude_from_explicit_instantiation__)) error_code(int __val, const error_category& __cat) noexcept : __val_(__val), __cat_(&__cat) {} template <class _Ep> __attribute__ ((__exclude_from_explicit_instantiation__)) error_code(_Ep __e, typename enable_if<is_error_code_enum<_Ep>::value>::type* = 0 ) noexcept {*this = make_error_code(__e);} __attribute__ ((__exclude_from_explicit_instantiation__)) void assign(int __val, const error_category& __cat) noexcept { __val_ = __val; __cat_ = &__cat; } template <class _Ep> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_error_code_enum<_Ep>::value, error_code& >::type operator=(_Ep __e) noexcept {*this = make_error_code(__e); return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) void clear() noexcept { __val_ = 0; __cat_ = &system_category(); } __attribute__ ((__exclude_from_explicit_instantiation__)) int value() const noexcept {return __val_;} __attribute__ ((__exclude_from_explicit_instantiation__)) const error_category& category() const noexcept {return *__cat_;} __attribute__ ((__exclude_from_explicit_instantiation__)) error_condition default_error_condition() const noexcept {return __cat_->default_error_condition(__val_);} string message() const; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit operator bool() const noexcept {return __val_ != 0;} }; inline __attribute__ ((__exclude_from_explicit_instantiation__)) error_code make_error_code(errc __e) noexcept { return error_code(static_cast<int>(__e), generic_category()); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<(const error_code& __x, const error_code& __y) noexcept { return __x.category() < __y.category() || (__x.category() == __y.category() && __x.value() < __y.value()); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const error_code& __x, const error_code& __y) noexcept { return __x.category() == __y.category() && __x.value() == __y.value(); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const error_code& __x, const error_condition& __y) noexcept { return __x.category().equivalent(__x.value(), __y) || __y.category().equivalent(__x, __y.value()); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const error_condition& __x, const error_code& __y) noexcept { return __y == __x; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const error_condition& __x, const error_condition& __y) noexcept { return __x.category() == __y.category() && __x.value() == __y.value(); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const error_code& __x, const error_code& __y) noexcept {return !(__x == __y);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const error_code& __x, const error_condition& __y) noexcept {return !(__x == __y);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const error_condition& __x, const error_code& __y) noexcept {return !(__x == __y);} inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const error_condition& __x, const error_condition& __y) noexcept {return !(__x == __y);} template <> struct hash<error_code> : public unary_function<error_code, size_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(const error_code& __ec) const noexcept { return static_cast<size_t>(__ec.value()); } }; template <> struct hash<error_condition> : public unary_function<error_condition, size_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(const error_condition& __ec) const noexcept { return static_cast<size_t>(__ec.value()); } }; class system_error : public runtime_error { error_code __ec_; public: system_error(error_code __ec, const string& __what_arg); system_error(error_code __ec, const char* __what_arg); system_error(error_code __ec); system_error(int __ev, const error_category& __ecat, const string& __what_arg); system_error(int __ev, const error_category& __ecat, const char* __what_arg); system_error(int __ev, const error_category& __ecat); ~system_error() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) const error_code& code() const noexcept {return __ec_;} private: static string __init(const error_code&, string); }; [[noreturn]] void __throw_system_error(int ev, const char* what_arg); } } typedef ::timespec __libcpp_timespec_t; namespace std { inline namespace __1 { typedef void* __libcpp_mutex_t; typedef void* __libcpp_recursive_mutex_t[5]; typedef void* __libcpp_condvar_t; typedef void* __libcpp_exec_once_flag; typedef long __libcpp_thread_id; typedef void* __libcpp_thread_t; typedef long __libcpp_tls_key; int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m); int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m); bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m); int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t *__m); int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t *__m); int __libcpp_mutex_lock(__libcpp_mutex_t *__m); bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m); int __libcpp_mutex_unlock(__libcpp_mutex_t *__m); int __libcpp_mutex_destroy(__libcpp_mutex_t *__m); int __libcpp_condvar_signal(__libcpp_condvar_t* __cv); int __libcpp_condvar_broadcast(__libcpp_condvar_t* __cv); int __libcpp_condvar_wait(__libcpp_condvar_t* __cv, __libcpp_mutex_t* __m); int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m, __libcpp_timespec_t *__ts); int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv); int __libcpp_execute_once(__libcpp_exec_once_flag *flag, void (*init_routine)()); bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2); bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2); bool __libcpp_thread_isnull(const __libcpp_thread_t *__t); int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *), void *__arg); __libcpp_thread_id __libcpp_thread_get_current_id(); __libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t); int __libcpp_thread_join(__libcpp_thread_t *__t); int __libcpp_thread_detach(__libcpp_thread_t *__t); void __libcpp_thread_yield(); void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns); int __libcpp_tls_create(__libcpp_tls_key* __key, void(__stdcall* __at_exit)(void*)); void *__libcpp_tls_get(__libcpp_tls_key __key); int __libcpp_tls_set(__libcpp_tls_key __key, void *__p); class thread; class __thread_id; namespace this_thread { __attribute__ ((__exclude_from_explicit_instantiation__)) __thread_id get_id() noexcept; } template<> struct hash<__thread_id>; class __thread_id { __libcpp_thread_id __id_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) __thread_id() noexcept : __id_(0) {} friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(__thread_id __x, __thread_id __y) noexcept { if (__x.__id_ == 0) return __y.__id_ == 0; if (__y.__id_ == 0) return false; return __libcpp_thread_id_equal(__x.__id_, __y.__id_); } friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(__thread_id __x, __thread_id __y) noexcept {return !(__x == __y);} friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator< (__thread_id __x, __thread_id __y) noexcept { if (__x.__id_ == 0) return __y.__id_ != 0; if (__y.__id_ == 0) return false; return __libcpp_thread_id_less(__x.__id_, __y.__id_); } friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(__thread_id __x, __thread_id __y) noexcept {return !(__y < __x);} friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator> (__thread_id __x, __thread_id __y) noexcept {return __y < __x ;} friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(__thread_id __x, __thread_id __y) noexcept {return !(__x < __y);} __attribute__ ((__exclude_from_explicit_instantiation__)) void __reset() { __id_ = 0; } template<class _CharT, class _Traits> friend __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id); private: __attribute__ ((__exclude_from_explicit_instantiation__)) __thread_id(__libcpp_thread_id __id) : __id_(__id) {} friend __thread_id this_thread::get_id() noexcept; friend class thread; friend struct hash<__thread_id>; }; namespace this_thread { inline __attribute__ ((__exclude_from_explicit_instantiation__)) __thread_id get_id() noexcept { return __libcpp_thread_get_current_id(); } } } } namespace std { inline namespace __1 { class mutex { __libcpp_mutex_t __m_ = 0; public: __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr mutex() = default; mutex(const mutex&) = delete; mutex& operator=(const mutex&) = delete; ~mutex() = default; void lock() ; bool try_lock() noexcept ; void unlock() noexcept ; typedef __libcpp_mutex_t* native_handle_type; __attribute__ ((__exclude_from_explicit_instantiation__)) native_handle_type native_handle() {return &__m_;} }; static_assert(is_nothrow_default_constructible<mutex>::value, "the default constructor for std::mutex must be nothrow"); struct defer_lock_t { explicit defer_lock_t() = default; }; struct try_to_lock_t { explicit try_to_lock_t() = default; }; struct adopt_lock_t { explicit adopt_lock_t() = default; }; constexpr defer_lock_t defer_lock = defer_lock_t(); constexpr try_to_lock_t try_to_lock = try_to_lock_t(); constexpr adopt_lock_t adopt_lock = adopt_lock_t(); template <class _Mutex> class lock_guard { public: typedef _Mutex mutex_type; private: mutex_type& __m_; public: [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) explicit lock_guard(mutex_type& __m) : __m_(__m) {__m_.lock();} [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) lock_guard(mutex_type& __m, adopt_lock_t) : __m_(__m) {} __attribute__ ((__exclude_from_explicit_instantiation__)) ~lock_guard() {__m_.unlock();} private: lock_guard(lock_guard const&) = delete; lock_guard& operator=(lock_guard const&) = delete; }; template <class _Mutex> class unique_lock { public: typedef _Mutex mutex_type; private: mutex_type* __m_; bool __owns_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) unique_lock() noexcept : __m_(nullptr), __owns_(false) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit unique_lock(mutex_type& __m) : __m_(std::__1::addressof(__m)), __owns_(true) {__m_->lock();} __attribute__ ((__exclude_from_explicit_instantiation__)) unique_lock(mutex_type& __m, defer_lock_t) noexcept : __m_(std::__1::addressof(__m)), __owns_(false) {} __attribute__ ((__exclude_from_explicit_instantiation__)) unique_lock(mutex_type& __m, try_to_lock_t) : __m_(std::__1::addressof(__m)), __owns_(__m.try_lock()) {} __attribute__ ((__exclude_from_explicit_instantiation__)) unique_lock(mutex_type& __m, adopt_lock_t) : __m_(std::__1::addressof(__m)), __owns_(true) {} template <class _Clock, class _Duration> __attribute__ ((__exclude_from_explicit_instantiation__)) unique_lock(mutex_type& __m, const chrono::time_point<_Clock, _Duration>& __t) : __m_(std::__1::addressof(__m)), __owns_(__m.try_lock_until(__t)) {} template <class _Rep, class _Period> __attribute__ ((__exclude_from_explicit_instantiation__)) unique_lock(mutex_type& __m, const chrono::duration<_Rep, _Period>& __d) : __m_(std::__1::addressof(__m)), __owns_(__m.try_lock_for(__d)) {} __attribute__ ((__exclude_from_explicit_instantiation__)) ~unique_lock() { if (__owns_) __m_->unlock(); } private: unique_lock(unique_lock const&); unique_lock& operator=(unique_lock const&); public: __attribute__ ((__exclude_from_explicit_instantiation__)) unique_lock(unique_lock&& __u) noexcept : __m_(__u.__m_), __owns_(__u.__owns_) {__u.__m_ = nullptr; __u.__owns_ = false;} __attribute__ ((__exclude_from_explicit_instantiation__)) unique_lock& operator=(unique_lock&& __u) noexcept { if (__owns_) __m_->unlock(); __m_ = __u.__m_; __owns_ = __u.__owns_; __u.__m_ = nullptr; __u.__owns_ = false; return *this; } void lock(); bool try_lock(); template <class _Rep, class _Period> bool try_lock_for(const chrono::duration<_Rep, _Period>& __d); template <class _Clock, class _Duration> bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t); void unlock(); __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(unique_lock& __u) noexcept { std::__1::swap(__m_, __u.__m_); std::__1::swap(__owns_, __u.__owns_); } __attribute__ ((__exclude_from_explicit_instantiation__)) mutex_type* release() noexcept { mutex_type* __m = __m_; __m_ = nullptr; __owns_ = false; return __m; } __attribute__ ((__exclude_from_explicit_instantiation__)) bool owns_lock() const noexcept {return __owns_;} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit operator bool () const noexcept {return __owns_;} __attribute__ ((__exclude_from_explicit_instantiation__)) mutex_type* mutex() const noexcept {return __m_;} }; template <class _Mutex> void unique_lock<_Mutex>::lock() { if (__m_ == nullptr) __throw_system_error(1, "unique_lock::lock: references null mutex"); if (__owns_) __throw_system_error(36, "unique_lock::lock: already locked"); __m_->lock(); __owns_ = true; } template <class _Mutex> bool unique_lock<_Mutex>::try_lock() { if (__m_ == nullptr) __throw_system_error(1, "unique_lock::try_lock: references null mutex"); if (__owns_) __throw_system_error(36, "unique_lock::try_lock: already locked"); __owns_ = __m_->try_lock(); return __owns_; } template <class _Mutex> template <class _Rep, class _Period> bool unique_lock<_Mutex>::try_lock_for(const chrono::duration<_Rep, _Period>& __d) { if (__m_ == nullptr) __throw_system_error(1, "unique_lock::try_lock_for: references null mutex"); if (__owns_) __throw_system_error(36, "unique_lock::try_lock_for: already locked"); __owns_ = __m_->try_lock_for(__d); return __owns_; } template <class _Mutex> template <class _Clock, class _Duration> bool unique_lock<_Mutex>::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) { if (__m_ == nullptr) __throw_system_error(1, "unique_lock::try_lock_until: references null mutex"); if (__owns_) __throw_system_error(36, "unique_lock::try_lock_until: already locked"); __owns_ = __m_->try_lock_until(__t); return __owns_; } template <class _Mutex> void unique_lock<_Mutex>::unlock() { if (!__owns_) __throw_system_error(1, "unique_lock::unlock: not locked"); __m_->unlock(); __owns_ = false; } template <class _Mutex> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) noexcept {__x.swap(__y);} enum class cv_status { no_timeout, timeout }; class condition_variable { __libcpp_condvar_t __cv_ = 0; public: __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr condition_variable() noexcept = default; ~condition_variable() = default; condition_variable(const condition_variable&) = delete; condition_variable& operator=(const condition_variable&) = delete; void notify_one() noexcept; void notify_all() noexcept; void wait(unique_lock<mutex>& __lk) noexcept; template <class _Predicate> void wait(unique_lock<mutex>& __lk, _Predicate __pred); template <class _Clock, class _Duration> cv_status wait_until(unique_lock<mutex>& __lk, const chrono::time_point<_Clock, _Duration>& __t); template <class _Clock, class _Duration, class _Predicate> bool wait_until(unique_lock<mutex>& __lk, const chrono::time_point<_Clock, _Duration>& __t, _Predicate __pred); template <class _Rep, class _Period> cv_status wait_for(unique_lock<mutex>& __lk, const chrono::duration<_Rep, _Period>& __d); template <class _Rep, class _Period, class _Predicate> bool __attribute__ ((__exclude_from_explicit_instantiation__)) wait_for(unique_lock<mutex>& __lk, const chrono::duration<_Rep, _Period>& __d, _Predicate __pred); typedef __libcpp_condvar_t* native_handle_type; __attribute__ ((__exclude_from_explicit_instantiation__)) native_handle_type native_handle() {return &__cv_;} private: void __do_timed_wait(unique_lock<mutex>& __lk, chrono::time_point<chrono::system_clock, chrono::nanoseconds>) noexcept; template <class _Clock> void __do_timed_wait(unique_lock<mutex>& __lk, chrono::time_point<_Clock, chrono::nanoseconds>) noexcept; }; template <class _Rep, class _Period> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_floating_point<_Rep>::value, chrono::nanoseconds >::type __safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d) { using namespace chrono; using __ratio = ratio_divide<_Period, nano>; using __ns_rep = nanoseconds::rep; _Rep __result_float = __d.count() * __ratio::num / __ratio::den; _Rep __result_max = numeric_limits<__ns_rep>::max(); if (__result_float >= __result_max) { return nanoseconds::max(); } _Rep __result_min = numeric_limits<__ns_rep>::min(); if (__result_float <= __result_min) { return nanoseconds::min(); } return nanoseconds(static_cast<__ns_rep>(__result_float)); } template <class _Rep, class _Period> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < !is_floating_point<_Rep>::value, chrono::nanoseconds >::type __safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d) { using namespace chrono; if (__d.count() == 0) { return nanoseconds(0); } using __ratio = ratio_divide<_Period, nano>; using __ns_rep = nanoseconds::rep; __ns_rep __result_max = std::numeric_limits<__ns_rep>::max(); if (__d.count() > 0 && __d.count() > __result_max / __ratio::num) { return nanoseconds::max(); } __ns_rep __result_min = std::numeric_limits<__ns_rep>::min(); if (__d.count() < 0 && __d.count() < __result_min / __ratio::num) { return nanoseconds::min(); } __ns_rep __result = __d.count() * __ratio::num / __ratio::den; if (__result == 0) { return nanoseconds(1); } return nanoseconds(__result); } template <class _Predicate> void condition_variable::wait(unique_lock<mutex>& __lk, _Predicate __pred) { while (!__pred()) wait(__lk); } template <class _Clock, class _Duration> cv_status condition_variable::wait_until(unique_lock<mutex>& __lk, const chrono::time_point<_Clock, _Duration>& __t) { using namespace chrono; using __clock_tp_ns = time_point<_Clock, nanoseconds>; typename _Clock::time_point __now = _Clock::now(); if (__t <= __now) return cv_status::timeout; __clock_tp_ns __t_ns = __clock_tp_ns(__safe_nanosecond_cast(__t.time_since_epoch())); __do_timed_wait(__lk, __t_ns); return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout; } template <class _Clock, class _Duration, class _Predicate> bool condition_variable::wait_until(unique_lock<mutex>& __lk, const chrono::time_point<_Clock, _Duration>& __t, _Predicate __pred) { while (!__pred()) { if (wait_until(__lk, __t) == cv_status::timeout) return __pred(); } return true; } template <class _Rep, class _Period> cv_status condition_variable::wait_for(unique_lock<mutex>& __lk, const chrono::duration<_Rep, _Period>& __d) { using namespace chrono; if (__d <= __d.zero()) return cv_status::timeout; using __ns_rep = nanoseconds::rep; steady_clock::time_point __c_now = steady_clock::now(); using __clock_tp_ns = time_point<system_clock, nanoseconds>; __ns_rep __now_count_ns = __safe_nanosecond_cast(system_clock::now().time_since_epoch()).count(); __ns_rep __d_ns_count = __safe_nanosecond_cast(__d).count(); if (__now_count_ns > numeric_limits<__ns_rep>::max() - __d_ns_count) { __do_timed_wait(__lk, __clock_tp_ns::max()); } else { __do_timed_wait(__lk, __clock_tp_ns(nanoseconds(__now_count_ns + __d_ns_count))); } return steady_clock::now() - __c_now < __d ? cv_status::no_timeout : cv_status::timeout; } template <class _Rep, class _Period, class _Predicate> inline bool condition_variable::wait_for(unique_lock<mutex>& __lk, const chrono::duration<_Rep, _Period>& __d, _Predicate __pred) { return wait_until(__lk, chrono::steady_clock::now() + __d, std::__1::move(__pred)); } template <class _Clock> inline void condition_variable::__do_timed_wait(unique_lock<mutex>& __lk, chrono::time_point<_Clock, chrono::nanoseconds> __tp) noexcept { wait_for(__lk, __tp - _Clock::now()); } } } namespace std { inline namespace __1 { class recursive_mutex { __libcpp_recursive_mutex_t __m_; public: recursive_mutex(); ~recursive_mutex(); private: recursive_mutex(const recursive_mutex&); recursive_mutex& operator=(const recursive_mutex&); public: void lock(); bool try_lock() noexcept; void unlock() noexcept; typedef __libcpp_recursive_mutex_t* native_handle_type; __attribute__ ((__exclude_from_explicit_instantiation__)) native_handle_type native_handle() {return &__m_;} }; class timed_mutex { mutex __m_; condition_variable __cv_; bool __locked_; public: timed_mutex(); ~timed_mutex(); private: timed_mutex(const timed_mutex&); timed_mutex& operator=(const timed_mutex&); public: void lock(); bool try_lock() noexcept; template <class _Rep, class _Period> __attribute__ ((__exclude_from_explicit_instantiation__)) bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) {return try_lock_until(chrono::steady_clock::now() + __d);} template <class _Clock, class _Duration> bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t); void unlock() noexcept; }; template <class _Clock, class _Duration> bool timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) { using namespace chrono; unique_lock<mutex> __lk(__m_); bool no_timeout = _Clock::now() < __t; while (no_timeout && __locked_) no_timeout = __cv_.wait_until(__lk, __t) == cv_status::no_timeout; if (!__locked_) { __locked_ = true; return true; } return false; } class recursive_timed_mutex { mutex __m_; condition_variable __cv_; size_t __count_; __thread_id __id_; public: recursive_timed_mutex(); ~recursive_timed_mutex(); private: recursive_timed_mutex(const recursive_timed_mutex&); recursive_timed_mutex& operator=(const recursive_timed_mutex&); public: void lock(); bool try_lock() noexcept; template <class _Rep, class _Period> __attribute__ ((__exclude_from_explicit_instantiation__)) bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) {return try_lock_until(chrono::steady_clock::now() + __d);} template <class _Clock, class _Duration> bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t); void unlock() noexcept; }; template <class _Clock, class _Duration> bool recursive_timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) { using namespace chrono; __thread_id __id = this_thread::get_id(); unique_lock<mutex> lk(__m_); if (__id == __id_) { if (__count_ == numeric_limits<size_t>::max()) return false; ++__count_; return true; } bool no_timeout = _Clock::now() < __t; while (no_timeout && __count_ != 0) no_timeout = __cv_.wait_until(lk, __t) == cv_status::no_timeout; if (__count_ == 0) { __count_ = 1; __id_ = __id; return true; } return false; } template <class _L0, class _L1> int try_lock(_L0& __l0, _L1& __l1) { unique_lock<_L0> __u0(__l0, try_to_lock); if (__u0.owns_lock()) { if (__l1.try_lock()) { __u0.release(); return -1; } else return 1; } return 0; } template <class _L0, class _L1, class _L2, class... _L3> int try_lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) { int __r = 0; unique_lock<_L0> __u0(__l0, try_to_lock); if (__u0.owns_lock()) { __r = try_lock(__l1, __l2, __l3...); if (__r == -1) __u0.release(); else ++__r; } return __r; } template <class _L0, class _L1> void lock(_L0& __l0, _L1& __l1) { while (true) { { unique_lock<_L0> __u0(__l0); if (__l1.try_lock()) { __u0.release(); break; } } __libcpp_thread_yield(); { unique_lock<_L1> __u1(__l1); if (__l0.try_lock()) { __u1.release(); break; } } __libcpp_thread_yield(); } } template <class _L0, class _L1, class _L2, class ..._L3> void __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3) { while (true) { switch (__i) { case 0: { unique_lock<_L0> __u0(__l0); __i = try_lock(__l1, __l2, __l3...); if (__i == -1) { __u0.release(); return; } } ++__i; __libcpp_thread_yield(); break; case 1: { unique_lock<_L1> __u1(__l1); __i = try_lock(__l2, __l3..., __l0); if (__i == -1) { __u1.release(); return; } } if (__i == sizeof...(_L3) + 1) __i = 0; else __i += 2; __libcpp_thread_yield(); break; default: __lock_first(__i - 2, __l2, __l3..., __l0, __l1); return; } } } template <class _L0, class _L1, class _L2, class ..._L3> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3) { __lock_first(0, __l0, __l1, __l2, __l3...); } template <class _L0> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __unlock(_L0& __l0) { __l0.unlock(); } template <class _L0, class _L1> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __unlock(_L0& __l0, _L1& __l1) { __l0.unlock(); __l1.unlock(); } template <class _L0, class _L1, class _L2, class ..._L3> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __unlock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) { __l0.unlock(); __l1.unlock(); std::__1::__unlock(__l2, __l3...); } struct once_flag; template<class _Callable, class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) void call_once(once_flag&, _Callable&&, _Args&&...); struct once_flag { __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr once_flag() noexcept : __state_(0) {} typedef uintptr_t _State_type; private: once_flag(const once_flag&); once_flag& operator=(const once_flag&); _State_type __state_; template<class _Callable, class... _Args> friend void call_once(once_flag&, _Callable&&, _Args&&...); }; template <class _Fp> class __call_once_param { _Fp& __f_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __call_once_param(_Fp& __f) : __f_(__f) {} __attribute__ ((__exclude_from_explicit_instantiation__)) void operator()() { typedef typename __make_tuple_indices<tuple_size<_Fp>::value, 1>::type _Index; __execute(_Index()); } private: template <size_t ..._Indices> __attribute__ ((__exclude_from_explicit_instantiation__)) void __execute(__tuple_indices<_Indices...>) { __invoke(std::__1::get<0>(std::__1::move(__f_)), std::__1::get<_Indices>(std::__1::move(__f_))...); } }; template <class _Fp> void __call_once_proxy(void* __vp) { __call_once_param<_Fp>* __p = static_cast<__call_once_param<_Fp>*>(__vp); (*__p)(); } void __call_once(volatile once_flag::_State_type&, void*, void (*)(void*)); template<class _Callable, class... _Args> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args) { if (__libcpp_acquire_load(&__flag.__state_) != ~once_flag::_State_type(0)) { typedef tuple<_Callable&&, _Args&&...> _Gp; _Gp __f(std::__1::forward<_Callable>(__func), std::__1::forward<_Args>(__args)...); __call_once_param<_Gp> __p(__f); __call_once(__flag.__state_, &__p, &__call_once_proxy<_Gp>); } } } } #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; void __cdecl _lock_locales(void); void __cdecl _unlock_locales(void); int __cdecl _configthreadlocale( int _Flag ); char* __cdecl setlocale( int _Category, char const* _Locale ); struct lconv* __cdecl localeconv(void); _locale_t __cdecl _get_current_locale(void); _locale_t __cdecl _create_locale( int _Category, char const* _Locale ); void __cdecl _free_locale( _locale_t _Locale ); wchar_t* __cdecl _wsetlocale( int _Category, wchar_t const* _Locale ); _locale_t __cdecl _wcreate_locale( int _Category, wchar_t const* _Locale ); wchar_t** __cdecl ___lc_locale_name_func(void); unsigned int __cdecl ___lc_codepage_func (void); unsigned int __cdecl ___lc_collate_cp_func (void); char* __cdecl _Getdays(void); char* __cdecl _Getmonths(void); void* __cdecl _Gettnames(void); wchar_t* __cdecl _W_Getdays(void); wchar_t* __cdecl _W_Getmonths(void); void* __cdecl _W_Gettnames(void); size_t __cdecl _Strftime( char* _Buffer, size_t _Max_size, char const* _Format, struct tm const* _Timeptr, void* _Lc_time_arg); 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 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; } #pragma pack(pop) #pragma pack(push, 8) #pragma warning(push, 3) #pragma warning(disable: 4180 4412 4455 4472 4494 4514 4571 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4702 4793 4820 4988 5026 5027 5045 4984) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wc++17-extensions" #pragma clang diagnostic ignored "-Wuser-defined-literals" #pragma clang diagnostic ignored "-Wunknown-pragmas" #pragma detect_mismatch("_MSC_VER", "1900") #pragma detect_mismatch("_ITERATOR_DEBUG_LEVEL", "0") #pragma detect_mismatch("RuntimeLibrary", "MT_StaticRelease") #pragma comment(lib, "libcpmt" "" "") namespace std { enum _Uninitialized { _Noinit }; class _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 _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 clang diagnostic pop #pragma warning(pop) #pragma pack(pop) #pragma pack(push, 8) #pragma warning(push, 3) #pragma warning(disable: 4180 4412 4455 4472 4494 4514 4571 4574 4582 4583 4587 4588 4619 4623 4625 4626 4643 4702 4793 4820 4988 5026 5027 5045 4984) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wc++17-extensions" #pragma clang diagnostic ignored "-Wuser-defined-literals" #pragma clang diagnostic ignored "-Wunknown-pragmas" 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, 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" { char* __cdecl _Getdays(); char* __cdecl _Getmonths(); void* __cdecl _Gettnames(); size_t __cdecl _Strftime( char*, size_t _Maxsize, const char*, const tm*, void*); wchar_t* __cdecl _W_Getdays(); wchar_t* __cdecl _W_Getmonths(); void* __cdecl _W_Gettnames(); size_t __cdecl _Wcsftime( wchar_t*, size_t _Maxsize, const wchar_t*, const tm*, void*); } _locale_t __cdecl _GetLocaleForCP(unsigned int); #pragma clang diagnostic pop #pragma warning(pop) #pragma pack(pop) class locale_t { public: locale_t() : __locale(nullptr), __locale_str(nullptr) {} locale_t(std::nullptr_t) : __locale(nullptr), __locale_str(nullptr) {} locale_t(_locale_t __xlocale, const char* __xlocale_str) : __locale(__xlocale), __locale_str(__xlocale_str) {} friend bool operator==(const locale_t& __left, const locale_t& __right) { return __left.__locale == __right.__locale; } friend bool operator==(const locale_t& __left, int __right) { return __left.__locale == nullptr && __right == 0; } friend bool operator==(const locale_t& __left, long long __right) { return __left.__locale == nullptr && __right == 0; } friend bool operator==(const locale_t& __left, std::nullptr_t) { return __left.__locale == nullptr; } friend bool operator==(int __left, const locale_t& __right) { return __left == 0 && nullptr == __right.__locale; } friend bool operator==(std::nullptr_t, const locale_t& __right) { return nullptr == __right.__locale; } friend bool operator!=(const locale_t& __left, const locale_t& __right) { return !(__left == __right); } friend bool operator!=(const locale_t& __left, int __right) { return !(__left == __right); } friend bool operator!=(const locale_t& __left, long long __right) { return !(__left == __right); } friend bool operator!=(const locale_t& __left, std::nullptr_t __right) { return !(__left == __right); } friend bool operator!=(int __left, const locale_t& __right) { return !(__left == __right); } friend bool operator!=(std::nullptr_t __left, const locale_t& __right) { return !(__left == __right); } operator bool() const { return __locale != nullptr; } const char* __get_locale() const { return __locale_str; } operator _locale_t() const { return __locale; } private: _locale_t __locale; const char* __locale_str; }; locale_t newlocale( int mask, const char * locale, locale_t base ); lconv *localeconv_l( locale_t loc ); size_t mbrlen_l( const char *__restrict s, size_t n, mbstate_t *__restrict ps, locale_t loc); size_t mbsrtowcs_l( wchar_t *__restrict dst, const char **__restrict src, size_t len, mbstate_t *__restrict ps, locale_t loc ); size_t wcrtomb_l( char *__restrict s, wchar_t wc, mbstate_t *__restrict ps, locale_t loc); size_t mbrtowc_l( wchar_t *__restrict pwc, const char *__restrict s, size_t n, mbstate_t *__restrict ps, locale_t loc); size_t mbsnrtowcs_l( wchar_t *__restrict dst, const char **__restrict src, size_t nms, size_t len, mbstate_t *__restrict ps, locale_t loc); size_t wcsnrtombs_l( char *__restrict dst, const wchar_t **__restrict src, size_t nwc, size_t len, mbstate_t *__restrict ps, locale_t loc); wint_t btowc_l( int c, locale_t loc ); int wctob_l( wint_t c, locale_t loc ); decltype(___mb_cur_max_func()) MB_CUR_MAX_L( locale_t __l ); inline __attribute__ ((__exclude_from_explicit_instantiation__)) int islower_l(int c, _locale_t loc) { return _ischartype_l((int)c, 0x02, loc); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) int isupper_l(int c, _locale_t loc) { return _ischartype_l((int)c, 0x01, loc); } int snprintf_l(char *ret, size_t n, locale_t loc, const char *format, ...); int asprintf_l( char **ret, locale_t loc, const char *format, ... ); int vasprintf_l( char **ret, locale_t loc, const char *format, va_list ap ); inline int isblank_l( int c, locale_t ) { return ( c == ' ' || c == '\t' ); } inline int iswblank_l( wint_t c, locale_t ) { return ( c == L' ' || c == L'\t' ); } namespace std { inline namespace __1 { struct __libcpp_locale_guard { __libcpp_locale_guard(locale_t __l) : __status(_configthreadlocale(0x0001)) { const char* __lc = __setlocale(nullptr); if (strcmp(__l.__get_locale(), __lc) != 0) { __locale_all = _strdup(__lc); if (__locale_all == nullptr) __throw_bad_alloc(); __setlocale(__l.__get_locale()); } } ~__libcpp_locale_guard() { if (__locale_all != nullptr) { __setlocale(__locale_all); free(__locale_all); } _configthreadlocale(__status); } static const char* __setlocale(const char* __locale) { const char* __new_locale = setlocale(0, __locale); if (__new_locale == nullptr) __throw_bad_alloc(); return __new_locale; } int __status; char* __locale_all = nullptr; }; class locale; template <class _Facet> __attribute__ ((__exclude_from_explicit_instantiation__)) bool has_facet(const locale&) noexcept; template <class _Facet> __attribute__ ((__exclude_from_explicit_instantiation__)) const _Facet& use_facet(const locale&); class locale { public: class facet; class id; typedef int category; static const category none = 0, collate = ((1 << (1)) >> 1), ctype = ((1 << (2)) >> 1), monetary = ((1 << (3)) >> 1), numeric = ((1 << (4)) >> 1), time = ((1 << (5)) >> 1), messages = ((1 << (6)) >> 1), all = collate | ctype | monetary | numeric | time | messages; locale() noexcept; locale(const locale&) noexcept; explicit locale(const char*); explicit locale(const string&); locale(const locale&, const char*, category); locale(const locale&, const string&, category); template <class _Facet> __attribute__ ((__exclude_from_explicit_instantiation__)) locale(const locale&, _Facet*); locale(const locale&, const locale&, category); ~locale(); const locale& operator=(const locale&) noexcept; template <class _Facet> locale combine(const locale&) const; string name() const; bool operator==(const locale&) const; bool operator!=(const locale& __y) const {return !(*this == __y);} template <class _CharT, class _Traits, class _Allocator> bool operator()(const basic_string<_CharT, _Traits, _Allocator>&, const basic_string<_CharT, _Traits, _Allocator>&) const; static locale global(const locale&); static const locale& classic(); private: class __imp; __imp* __locale_; void __install_ctor(const locale&, facet*, long); static locale& __global(); bool has_facet(id&) const; const facet* use_facet(id&) const; template <class _Facet> friend bool has_facet(const locale&) noexcept; template <class _Facet> friend const _Facet& use_facet(const locale&); }; class locale::facet : public __shared_count { protected: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit facet(size_t __refs = 0) : __shared_count(static_cast<long>(__refs)-1) {} virtual ~facet(); private: virtual void __on_zero_shared() noexcept; }; class locale::id { once_flag __flag_; int32_t __id_; static int32_t __next_id; public: __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr id() :__id_(0) {} private: void __init(); void operator=(const id&); id(const id&); public: long __get(); friend class locale; friend class locale::__imp; }; template <class _Facet> inline __attribute__ ((__exclude_from_explicit_instantiation__)) locale::locale(const locale& __other, _Facet* __f) { __install_ctor(__other, __f, __f ? __f->id.__get() : 0); } template <class _Facet> locale locale::combine(const locale& __other) const { if (!std::__1::has_facet<_Facet>(__other)) __throw_runtime_error("locale::combine: locale missing facet"); return locale(*this, &const_cast<_Facet&>(std::__1::use_facet<_Facet>(__other))); } template <class _Facet> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool has_facet(const locale& __l) noexcept { return __l.has_facet(_Facet::id); } template <class _Facet> inline __attribute__ ((__exclude_from_explicit_instantiation__)) const _Facet& use_facet(const locale& __l) { return static_cast<const _Facet&>(*__l.use_facet(_Facet::id)); } template <class _CharT> class collate : public locale::facet { public: typedef _CharT char_type; typedef basic_string<char_type> string_type; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit collate(size_t __refs = 0) : locale::facet(__refs) {} __attribute__ ((__exclude_from_explicit_instantiation__)) int compare(const char_type* __lo1, const char_type* __hi1, const char_type* __lo2, const char_type* __hi2) const { return do_compare(__lo1, __hi1, __lo2, __hi2); } __attribute__ ((__exclude_from_explicit_instantiation__)) __attribute__ ((__always_inline__)) string_type transform(const char_type* __lo, const char_type* __hi) const { return do_transform(__lo, __hi); } __attribute__ ((__exclude_from_explicit_instantiation__)) long hash(const char_type* __lo, const char_type* __hi) const { return do_hash(__lo, __hi); } static locale::id id; protected: ~collate(); virtual int do_compare(const char_type* __lo1, const char_type* __hi1, const char_type* __lo2, const char_type* __hi2) const; virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const {return string_type(__lo, __hi);} virtual long do_hash(const char_type* __lo, const char_type* __hi) const; }; template <class _CharT> locale::id collate<_CharT>::id; template <class _CharT> collate<_CharT>::~collate() { } template <class _CharT> int collate<_CharT>::do_compare(const char_type* __lo1, const char_type* __hi1, const char_type* __lo2, const char_type* __hi2) const { for (; __lo2 != __hi2; ++__lo1, ++__lo2) { if (__lo1 == __hi1 || *__lo1 < *__lo2) return -1; if (*__lo2 < *__lo1) return 1; } return __lo1 != __hi1; } template <class _CharT> long collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const { size_t __h = 0; const size_t __sr = 8 * sizeof(size_t) - 8; const size_t __mask = size_t(0xF) << (__sr + 4); for(const char_type* __p = __lo; __p != __hi; ++__p) { __h = (__h << 4) + static_cast<size_t>(*__p); size_t __g = __h & __mask; __h ^= __g | (__g >> __sr); } return static_cast<long>(__h); } extern template class collate<char>; extern template class collate<wchar_t>; template <class _CharT> class collate_byname; template <> class collate_byname<char> : public collate<char> { locale_t __l; public: typedef char char_type; typedef basic_string<char_type> string_type; explicit collate_byname(const char* __n, size_t __refs = 0); explicit collate_byname(const string& __n, size_t __refs = 0); protected: ~collate_byname(); virtual int do_compare(const char_type* __lo1, const char_type* __hi1, const char_type* __lo2, const char_type* __hi2) const; virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const; }; template <> class collate_byname<wchar_t> : public collate<wchar_t> { locale_t __l; public: typedef wchar_t char_type; typedef basic_string<char_type> string_type; explicit collate_byname(const char* __n, size_t __refs = 0); explicit collate_byname(const string& __n, size_t __refs = 0); protected: ~collate_byname(); virtual int do_compare(const char_type* __lo1, const char_type* __hi1, const char_type* __lo2, const char_type* __hi2) const; virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const; }; template <class _CharT, class _Traits, class _Allocator> bool locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x, const basic_string<_CharT, _Traits, _Allocator>& __y) const { return std::__1::use_facet<std::__1::collate<_CharT> >(*this).compare( __x.data(), __x.data() + __x.size(), __y.data(), __y.data() + __y.size()) < 0; } class ctype_base { public: typedef unsigned short mask; static const mask space = 0x08; static const mask print = 0x40|0x10|(0x0100 | 0x01 | 0x02)|0x04; static const mask cntrl = 0x20; static const mask upper = 0x01; static const mask lower = 0x02; static const mask alpha = (0x0100 | 0x01 | 0x02); static const mask digit = 0x04; static const mask punct = 0x10; static const mask xdigit = 0x80; static const mask blank = 0x40; static const mask __regex_word = 0x80; static const mask alnum = alpha | digit; static const mask graph = alnum | punct; __attribute__ ((__exclude_from_explicit_instantiation__)) ctype_base() {} }; template <class _CharT> class ctype; template <> class ctype<wchar_t> : public locale::facet, public ctype_base { public: typedef wchar_t char_type; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit ctype(size_t __refs = 0) : locale::facet(__refs) {} __attribute__ ((__exclude_from_explicit_instantiation__)) bool is(mask __m, char_type __c) const { return do_is(__m, __c); } __attribute__ ((__exclude_from_explicit_instantiation__)) const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const { return do_is(__low, __high, __vec); } __attribute__ ((__exclude_from_explicit_instantiation__)) const char_type* scan_is(mask __m, const char_type* __low, const char_type* __high) const { return do_scan_is(__m, __low, __high); } __attribute__ ((__exclude_from_explicit_instantiation__)) const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const { return do_scan_not(__m, __low, __high); } __attribute__ ((__exclude_from_explicit_instantiation__)) char_type toupper(char_type __c) const { return do_toupper(__c); } __attribute__ ((__exclude_from_explicit_instantiation__)) const char_type* toupper(char_type* __low, const char_type* __high) const { return do_toupper(__low, __high); } __attribute__ ((__exclude_from_explicit_instantiation__)) char_type tolower(char_type __c) const { return do_tolower(__c); } __attribute__ ((__exclude_from_explicit_instantiation__)) const char_type* tolower(char_type* __low, const char_type* __high) const { return do_tolower(__low, __high); } __attribute__ ((__exclude_from_explicit_instantiation__)) char_type widen(char __c) const { return do_widen(__c); } __attribute__ ((__exclude_from_explicit_instantiation__)) const char* widen(const char* __low, const char* __high, char_type* __to) const { return do_widen(__low, __high, __to); } __attribute__ ((__exclude_from_explicit_instantiation__)) char narrow(char_type __c, char __dfault) const { return do_narrow(__c, __dfault); } __attribute__ ((__exclude_from_explicit_instantiation__)) const char_type* narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const { return do_narrow(__low, __high, __dfault, __to); } static locale::id id; protected: ~ctype(); virtual bool do_is(mask __m, char_type __c) const; virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const; virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const; virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const; virtual char_type do_toupper(char_type) const; virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; virtual char_type do_tolower(char_type) const; virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const; virtual char_type do_widen(char) const; virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const; virtual char do_narrow(char_type, char __dfault) const; virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const; }; template <> class ctype<char> : public locale::facet, public ctype_base { const mask* __tab_; bool __del_; public: typedef char char_type; explicit ctype(const mask* __tab = 0, bool __del = false, size_t __refs = 0); __attribute__ ((__exclude_from_explicit_instantiation__)) bool is(mask __m, char_type __c) const { return ((unsigned)(__c) < 0x80) ? (__tab_[static_cast<int>(__c)] & __m) !=0 : false; } __attribute__ ((__exclude_from_explicit_instantiation__)) const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const { for (; __low != __high; ++__low, ++__vec) *__vec = ((unsigned)(*__low) < 0x80) ? __tab_[static_cast<int>(*__low)] : 0; return __low; } __attribute__ ((__exclude_from_explicit_instantiation__)) const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const { for (; __low != __high; ++__low) if (((unsigned)(*__low) < 0x80) && (__tab_[static_cast<int>(*__low)] & __m)) break; return __low; } __attribute__ ((__exclude_from_explicit_instantiation__)) const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const { for (; __low != __high; ++__low) if (!(((unsigned)(*__low) < 0x80) && (__tab_[static_cast<int>(*__low)] & __m))) break; return __low; } __attribute__ ((__exclude_from_explicit_instantiation__)) char_type toupper(char_type __c) const { return do_toupper(__c); } __attribute__ ((__exclude_from_explicit_instantiation__)) const char_type* toupper(char_type* __low, const char_type* __high) const { return do_toupper(__low, __high); } __attribute__ ((__exclude_from_explicit_instantiation__)) char_type tolower(char_type __c) const { return do_tolower(__c); } __attribute__ ((__exclude_from_explicit_instantiation__)) const char_type* tolower(char_type* __low, const char_type* __high) const { return do_tolower(__low, __high); } __attribute__ ((__exclude_from_explicit_instantiation__)) char_type widen(char __c) const { return do_widen(__c); } __attribute__ ((__exclude_from_explicit_instantiation__)) const char* widen(const char* __low, const char* __high, char_type* __to) const { return do_widen(__low, __high, __to); } __attribute__ ((__exclude_from_explicit_instantiation__)) char narrow(char_type __c, char __dfault) const { return do_narrow(__c, __dfault); } __attribute__ ((__exclude_from_explicit_instantiation__)) const char* narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const { return do_narrow(__low, __high, __dfault, __to); } static locale::id id; static const size_t table_size = 256; __attribute__ ((__exclude_from_explicit_instantiation__)) const mask* table() const noexcept {return __tab_;} static const mask* classic_table() noexcept; protected: ~ctype(); virtual char_type do_toupper(char_type __c) const; virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; virtual char_type do_tolower(char_type __c) const; virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const; virtual char_type do_widen(char __c) const; virtual const char* do_widen(const char* __low, const char* __high, char_type* __to) const; virtual char do_narrow(char_type __c, char __dfault) const; virtual const char* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const; }; template <class _CharT> class ctype_byname; template <> class ctype_byname<char> : public ctype<char> { locale_t __l; public: explicit ctype_byname(const char*, size_t = 0); explicit ctype_byname(const string&, size_t = 0); protected: ~ctype_byname(); virtual char_type do_toupper(char_type) const; virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; virtual char_type do_tolower(char_type) const; virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const; }; template <> class ctype_byname<wchar_t> : public ctype<wchar_t> { locale_t __l; public: explicit ctype_byname(const char*, size_t = 0); explicit ctype_byname(const string&, size_t = 0); protected: ~ctype_byname(); virtual bool do_is(mask __m, char_type __c) const; virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const; virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const; virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const; virtual char_type do_toupper(char_type) const; virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; virtual char_type do_tolower(char_type) const; virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const; virtual char_type do_widen(char) const; virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const; virtual char do_narrow(char_type, char __dfault) const; virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const; }; template <class _CharT> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool isspace(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c); } template <class _CharT> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool isprint(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c); } template <class _CharT> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool iscntrl(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c); } template <class _CharT> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool isupper(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c); } template <class _CharT> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool islower(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c); } template <class _CharT> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool isalpha(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c); } template <class _CharT> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool isdigit(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c); } template <class _CharT> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool ispunct(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c); } template <class _CharT> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool isxdigit(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c); } template <class _CharT> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool isalnum(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c); } template <class _CharT> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool isgraph(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c); } template <class _CharT> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _CharT toupper(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).toupper(__c); } template <class _CharT> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _CharT tolower(_CharT __c, const locale& __loc) { return use_facet<ctype<_CharT> >(__loc).tolower(__c); } class codecvt_base { public: __attribute__ ((__exclude_from_explicit_instantiation__)) codecvt_base() {} enum result {ok, partial, error, noconv}; }; template <class _InternT, class _ExternT, class _StateT> class codecvt; template <> class codecvt<char, char, mbstate_t> : public locale::facet, public codecvt_base { public: typedef char intern_type; typedef char extern_type; typedef mbstate_t state_type; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {} __attribute__ ((__exclude_from_explicit_instantiation__)) result out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const { return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); } __attribute__ ((__exclude_from_explicit_instantiation__)) result unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const { return do_unshift(__st, __to, __to_end, __to_nxt); } __attribute__ ((__exclude_from_explicit_instantiation__)) result in(state_type& __st, const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const { return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); } __attribute__ ((__exclude_from_explicit_instantiation__)) int encoding() const noexcept { return do_encoding(); } __attribute__ ((__exclude_from_explicit_instantiation__)) bool always_noconv() const noexcept { return do_always_noconv(); } __attribute__ ((__exclude_from_explicit_instantiation__)) int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const { return do_length(__st, __frm, __end, __mx); } __attribute__ ((__exclude_from_explicit_instantiation__)) int max_length() const noexcept { return do_max_length(); } static locale::id id; protected: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {} ~codecvt(); virtual result do_out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; virtual result do_in(state_type& __st, const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; virtual result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; virtual int do_encoding() const noexcept; virtual bool do_always_noconv() const noexcept; virtual int do_length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const; virtual int do_max_length() const noexcept; }; template <> class codecvt<wchar_t, char, mbstate_t> : public locale::facet, public codecvt_base { locale_t __l; public: typedef wchar_t intern_type; typedef char extern_type; typedef mbstate_t state_type; explicit codecvt(size_t __refs = 0); __attribute__ ((__exclude_from_explicit_instantiation__)) result out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const { return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); } __attribute__ ((__exclude_from_explicit_instantiation__)) result unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const { return do_unshift(__st, __to, __to_end, __to_nxt); } __attribute__ ((__exclude_from_explicit_instantiation__)) result in(state_type& __st, const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const { return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); } __attribute__ ((__exclude_from_explicit_instantiation__)) int encoding() const noexcept { return do_encoding(); } __attribute__ ((__exclude_from_explicit_instantiation__)) bool always_noconv() const noexcept { return do_always_noconv(); } __attribute__ ((__exclude_from_explicit_instantiation__)) int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const { return do_length(__st, __frm, __end, __mx); } __attribute__ ((__exclude_from_explicit_instantiation__)) int max_length() const noexcept { return do_max_length(); } static locale::id id; protected: explicit codecvt(const char*, size_t __refs = 0); ~codecvt(); virtual result do_out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; virtual result do_in(state_type& __st, const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; virtual result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; virtual int do_encoding() const noexcept; virtual bool do_always_noconv() const noexcept; virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const; virtual int do_max_length() const noexcept; }; template <> class codecvt<char16_t, char, mbstate_t> : public locale::facet, public codecvt_base { public: typedef char16_t intern_type; typedef char extern_type; typedef mbstate_t state_type; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {} __attribute__ ((__exclude_from_explicit_instantiation__)) result out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const { return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); } __attribute__ ((__exclude_from_explicit_instantiation__)) result unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const { return do_unshift(__st, __to, __to_end, __to_nxt); } __attribute__ ((__exclude_from_explicit_instantiation__)) result in(state_type& __st, const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const { return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); } __attribute__ ((__exclude_from_explicit_instantiation__)) int encoding() const noexcept { return do_encoding(); } __attribute__ ((__exclude_from_explicit_instantiation__)) bool always_noconv() const noexcept { return do_always_noconv(); } __attribute__ ((__exclude_from_explicit_instantiation__)) int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const { return do_length(__st, __frm, __end, __mx); } __attribute__ ((__exclude_from_explicit_instantiation__)) int max_length() const noexcept { return do_max_length(); } static locale::id id; protected: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {} ~codecvt(); virtual result do_out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; virtual result do_in(state_type& __st, const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; virtual result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; virtual int do_encoding() const noexcept; virtual bool do_always_noconv() const noexcept; virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const; virtual int do_max_length() const noexcept; }; template <> class codecvt<char32_t, char, mbstate_t> : public locale::facet, public codecvt_base { public: typedef char32_t intern_type; typedef char extern_type; typedef mbstate_t state_type; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {} __attribute__ ((__exclude_from_explicit_instantiation__)) result out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const { return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); } __attribute__ ((__exclude_from_explicit_instantiation__)) result unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const { return do_unshift(__st, __to, __to_end, __to_nxt); } __attribute__ ((__exclude_from_explicit_instantiation__)) result in(state_type& __st, const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const { return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); } __attribute__ ((__exclude_from_explicit_instantiation__)) int encoding() const noexcept { return do_encoding(); } __attribute__ ((__exclude_from_explicit_instantiation__)) bool always_noconv() const noexcept { return do_always_noconv(); } __attribute__ ((__exclude_from_explicit_instantiation__)) int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const { return do_length(__st, __frm, __end, __mx); } __attribute__ ((__exclude_from_explicit_instantiation__)) int max_length() const noexcept { return do_max_length(); } static locale::id id; protected: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {} ~codecvt(); virtual result do_out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; virtual result do_in(state_type& __st, const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt, intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; virtual result do_unshift(state_type& __st, extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; virtual int do_encoding() const noexcept; virtual bool do_always_noconv() const noexcept; virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const; virtual int do_max_length() const noexcept; }; template <class _InternT, class _ExternT, class _StateT> class codecvt_byname : public codecvt<_InternT, _ExternT, _StateT> { public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit codecvt_byname(const char* __nm, size_t __refs = 0) : codecvt<_InternT, _ExternT, _StateT>(__nm, __refs) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit codecvt_byname(const string& __nm, size_t __refs = 0) : codecvt<_InternT, _ExternT, _StateT>(__nm.c_str(), __refs) {} protected: ~codecvt_byname(); }; template <class _InternT, class _ExternT, class _StateT> codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname() { } extern template class codecvt_byname<char, char, mbstate_t>; extern template class codecvt_byname<wchar_t, char, mbstate_t>; extern template class codecvt_byname<char16_t, char, mbstate_t>; extern template class codecvt_byname<char32_t, char, mbstate_t>; template <size_t _Np> struct __narrow_to_utf8 { template <class _OutputIterator, class _CharT> _OutputIterator operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const; }; template <> struct __narrow_to_utf8<8> { template <class _OutputIterator, class _CharT> __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const { for (; __wb < __we; ++__wb, ++__s) *__s = *__wb; return __s; } }; template <> struct __narrow_to_utf8<16> : public codecvt<char16_t, char, mbstate_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) __narrow_to_utf8() : codecvt<char16_t, char, mbstate_t>(1) {} ~__narrow_to_utf8(); template <class _OutputIterator, class _CharT> __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const { result __r = ok; mbstate_t __mb; while (__wb < __we && __r != error) { const int __sz = 32; char __buf[__sz]; char* __bn; const char16_t* __wn = (const char16_t*)__wb; __r = do_out(__mb, (const char16_t*)__wb, (const char16_t*)__we, __wn, __buf, __buf+__sz, __bn); if (__r == codecvt_base::error || __wn == (const char16_t*)__wb) __throw_runtime_error("locale not supported"); for (const char* __p = __buf; __p < __bn; ++__p, ++__s) *__s = *__p; __wb = (const _CharT*)__wn; } return __s; } }; template <> struct __narrow_to_utf8<32> : public codecvt<char32_t, char, mbstate_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) __narrow_to_utf8() : codecvt<char32_t, char, mbstate_t>(1) {} ~__narrow_to_utf8(); template <class _OutputIterator, class _CharT> __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const { result __r = ok; mbstate_t __mb; while (__wb < __we && __r != error) { const int __sz = 32; char __buf[__sz]; char* __bn; const char32_t* __wn = (const char32_t*)__wb; __r = do_out(__mb, (const char32_t*)__wb, (const char32_t*)__we, __wn, __buf, __buf+__sz, __bn); if (__r == codecvt_base::error || __wn == (const char32_t*)__wb) __throw_runtime_error("locale not supported"); for (const char* __p = __buf; __p < __bn; ++__p, ++__s) *__s = *__p; __wb = (const _CharT*)__wn; } return __s; } }; template <size_t _Np> struct __widen_from_utf8 { template <class _OutputIterator> _OutputIterator operator()(_OutputIterator __s, const char* __nb, const char* __ne) const; }; template <> struct __widen_from_utf8<8> { template <class _OutputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator operator()(_OutputIterator __s, const char* __nb, const char* __ne) const { for (; __nb < __ne; ++__nb, ++__s) *__s = *__nb; return __s; } }; template <> struct __widen_from_utf8<16> : public codecvt<char16_t, char, mbstate_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) __widen_from_utf8() : codecvt<char16_t, char, mbstate_t>(1) {} ~__widen_from_utf8(); template <class _OutputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator operator()(_OutputIterator __s, const char* __nb, const char* __ne) const { result __r = ok; mbstate_t __mb; while (__nb < __ne && __r != error) { const int __sz = 32; char16_t __buf[__sz]; char16_t* __bn; const char* __nn = __nb; __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb+__sz : __ne, __nn, __buf, __buf+__sz, __bn); if (__r == codecvt_base::error || __nn == __nb) __throw_runtime_error("locale not supported"); for (const char16_t* __p = __buf; __p < __bn; ++__p, ++__s) *__s = (wchar_t)*__p; __nb = __nn; } return __s; } }; template <> struct __widen_from_utf8<32> : public codecvt<char32_t, char, mbstate_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) __widen_from_utf8() : codecvt<char32_t, char, mbstate_t>(1) {} ~__widen_from_utf8(); template <class _OutputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator operator()(_OutputIterator __s, const char* __nb, const char* __ne) const { result __r = ok; mbstate_t __mb; while (__nb < __ne && __r != error) { const int __sz = 32; char32_t __buf[__sz]; char32_t* __bn; const char* __nn = __nb; __r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb+__sz : __ne, __nn, __buf, __buf+__sz, __bn); if (__r == codecvt_base::error || __nn == __nb) __throw_runtime_error("locale not supported"); for (const char32_t* __p = __buf; __p < __bn; ++__p, ++__s) *__s = (wchar_t)*__p; __nb = __nn; } return __s; } }; template <class _CharT> class numpunct; template <> class numpunct<char> : public locale::facet { public: typedef char char_type; typedef basic_string<char_type> string_type; explicit numpunct(size_t __refs = 0); __attribute__ ((__exclude_from_explicit_instantiation__)) char_type decimal_point() const {return do_decimal_point();} __attribute__ ((__exclude_from_explicit_instantiation__)) char_type thousands_sep() const {return do_thousands_sep();} __attribute__ ((__exclude_from_explicit_instantiation__)) string grouping() const {return do_grouping();} __attribute__ ((__exclude_from_explicit_instantiation__)) string_type truename() const {return do_truename();} __attribute__ ((__exclude_from_explicit_instantiation__)) string_type falsename() const {return do_falsename();} static locale::id id; protected: ~numpunct(); virtual char_type do_decimal_point() const; virtual char_type do_thousands_sep() const; virtual string do_grouping() const; virtual string_type do_truename() const; virtual string_type do_falsename() const; char_type __decimal_point_; char_type __thousands_sep_; string __grouping_; }; template <> class numpunct<wchar_t> : public locale::facet { public: typedef wchar_t char_type; typedef basic_string<char_type> string_type; explicit numpunct(size_t __refs = 0); __attribute__ ((__exclude_from_explicit_instantiation__)) char_type decimal_point() const {return do_decimal_point();} __attribute__ ((__exclude_from_explicit_instantiation__)) char_type thousands_sep() const {return do_thousands_sep();} __attribute__ ((__exclude_from_explicit_instantiation__)) string grouping() const {return do_grouping();} __attribute__ ((__exclude_from_explicit_instantiation__)) string_type truename() const {return do_truename();} __attribute__ ((__exclude_from_explicit_instantiation__)) string_type falsename() const {return do_falsename();} static locale::id id; protected: ~numpunct(); virtual char_type do_decimal_point() const; virtual char_type do_thousands_sep() const; virtual string do_grouping() const; virtual string_type do_truename() const; virtual string_type do_falsename() const; char_type __decimal_point_; char_type __thousands_sep_; string __grouping_; }; template <class _CharT> class numpunct_byname; template <> class numpunct_byname<char> : public numpunct<char> { public: typedef char char_type; typedef basic_string<char_type> string_type; explicit numpunct_byname(const char* __nm, size_t __refs = 0); explicit numpunct_byname(const string& __nm, size_t __refs = 0); protected: ~numpunct_byname(); private: void __init(const char*); }; template <> class numpunct_byname<wchar_t> : public numpunct<wchar_t> { public: typedef wchar_t char_type; typedef basic_string<char_type> string_type; explicit numpunct_byname(const char* __nm, size_t __refs = 0); explicit numpunct_byname(const string& __nm, size_t __refs = 0); protected: ~numpunct_byname(); private: void __init(const char*); }; } } namespace std { inline namespace __1 { typedef ptrdiff_t streamsize; class ios_base { public: class failure; typedef unsigned int fmtflags; static const fmtflags boolalpha = 0x0001; static const fmtflags dec = 0x0002; static const fmtflags fixed = 0x0004; static const fmtflags hex = 0x0008; static const fmtflags internal = 0x0010; static const fmtflags left = 0x0020; static const fmtflags oct = 0x0040; static const fmtflags right = 0x0080; static const fmtflags scientific = 0x0100; static const fmtflags showbase = 0x0200; static const fmtflags showpoint = 0x0400; static const fmtflags showpos = 0x0800; static const fmtflags skipws = 0x1000; static const fmtflags unitbuf = 0x2000; static const fmtflags uppercase = 0x4000; static const fmtflags adjustfield = left | right | internal; static const fmtflags basefield = dec | oct | hex; static const fmtflags floatfield = scientific | fixed; typedef unsigned int iostate; static const iostate badbit = 0x1; static const iostate eofbit = 0x2; static const iostate failbit = 0x4; static const iostate goodbit = 0x0; typedef unsigned int openmode; static const openmode app = 0x01; static const openmode ate = 0x02; static const openmode binary = 0x04; static const openmode in = 0x08; static const openmode out = 0x10; static const openmode trunc = 0x20; enum seekdir {beg, cur, end}; typedef iostate io_state; typedef openmode open_mode; typedef seekdir seek_dir; typedef std::__1::streamoff streamoff; typedef std::__1::streampos streampos; class Init; __attribute__ ((__exclude_from_explicit_instantiation__)) fmtflags flags() const; __attribute__ ((__exclude_from_explicit_instantiation__)) fmtflags flags(fmtflags __fmtfl); __attribute__ ((__exclude_from_explicit_instantiation__)) fmtflags setf(fmtflags __fmtfl); __attribute__ ((__exclude_from_explicit_instantiation__)) fmtflags setf(fmtflags __fmtfl, fmtflags __mask); __attribute__ ((__exclude_from_explicit_instantiation__)) void unsetf(fmtflags __mask); __attribute__ ((__exclude_from_explicit_instantiation__)) streamsize precision() const; __attribute__ ((__exclude_from_explicit_instantiation__)) streamsize precision(streamsize __prec); __attribute__ ((__exclude_from_explicit_instantiation__)) streamsize width() const; __attribute__ ((__exclude_from_explicit_instantiation__)) streamsize width(streamsize __wide); locale imbue(const locale& __loc); locale getloc() const; static int xalloc(); long& iword(int __index); void*& pword(int __index); virtual ~ios_base(); enum event { erase_event, imbue_event, copyfmt_event }; typedef void (*event_callback)(event, ios_base&, int __index); void register_callback(event_callback __fn, int __index); private: ios_base(const ios_base&); ios_base& operator=(const ios_base&); public: static bool sync_with_stdio(bool __sync = true); __attribute__ ((__exclude_from_explicit_instantiation__)) iostate rdstate() const; void clear(iostate __state = goodbit); __attribute__ ((__exclude_from_explicit_instantiation__)) void setstate(iostate __state); __attribute__ ((__exclude_from_explicit_instantiation__)) bool good() const; __attribute__ ((__exclude_from_explicit_instantiation__)) bool eof() const; __attribute__ ((__exclude_from_explicit_instantiation__)) bool fail() const; __attribute__ ((__exclude_from_explicit_instantiation__)) bool bad() const; __attribute__ ((__exclude_from_explicit_instantiation__)) iostate exceptions() const; __attribute__ ((__exclude_from_explicit_instantiation__)) void exceptions(iostate __iostate); void __set_badbit_and_consider_rethrow(); void __set_failbit_and_consider_rethrow(); __attribute__ ((__exclude_from_explicit_instantiation__)) void __setstate_nothrow(iostate __state) { if (__rdbuf_) __rdstate_ |= __state; else __rdstate_ |= __state | ios_base::badbit; } protected: __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base() { } void init(void* __sb); __attribute__ ((__exclude_from_explicit_instantiation__)) void* rdbuf() const {return __rdbuf_;} __attribute__ ((__exclude_from_explicit_instantiation__)) void rdbuf(void* __sb) { __rdbuf_ = __sb; clear(); } void __call_callbacks(event); void copyfmt(const ios_base&); void move(ios_base&); void swap(ios_base&) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) void set_rdbuf(void* __sb) { __rdbuf_ = __sb; } private: fmtflags __fmtflags_; streamsize __precision_; streamsize __width_; iostate __rdstate_; iostate __exceptions_; void* __rdbuf_; void* __loc_; event_callback* __fn_; int* __index_; size_t __event_size_; size_t __event_cap_; static atomic<int> __xindex_; long* __iarray_; size_t __iarray_size_; size_t __iarray_cap_; void** __parray_; size_t __parray_size_; size_t __parray_cap_; }; enum class io_errc { stream = 1 }; template <> struct is_error_code_enum<io_errc> : public true_type { }; const error_category& iostream_category() noexcept; inline __attribute__ ((__exclude_from_explicit_instantiation__)) error_code make_error_code(io_errc __e) noexcept { return error_code(static_cast<int>(__e), iostream_category()); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) error_condition make_error_condition(io_errc __e) noexcept { return error_condition(static_cast<int>(__e), iostream_category()); } class ios_base::failure : public system_error { public: explicit failure(const string& __msg, const error_code& __ec = io_errc::stream); explicit failure(const char* __msg, const error_code& __ec = io_errc::stream); virtual ~failure() throw(); }; [[noreturn]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __throw_failure(char const* __msg) { ((void)__msg); std::__1::abort(); } class ios_base::Init { public: Init(); ~Init(); }; inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base::fmtflags ios_base::flags() const { return __fmtflags_; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base::fmtflags ios_base::flags(fmtflags __fmtfl) { fmtflags __r = __fmtflags_; __fmtflags_ = __fmtfl; return __r; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base::fmtflags ios_base::setf(fmtflags __fmtfl) { fmtflags __r = __fmtflags_; __fmtflags_ |= __fmtfl; return __r; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void ios_base::unsetf(fmtflags __mask) { __fmtflags_ &= ~__mask; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base::fmtflags ios_base::setf(fmtflags __fmtfl, fmtflags __mask) { fmtflags __r = __fmtflags_; unsetf(__mask); __fmtflags_ |= __fmtfl & __mask; return __r; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) streamsize ios_base::precision() const { return __precision_; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) streamsize ios_base::precision(streamsize __prec) { streamsize __r = __precision_; __precision_ = __prec; return __r; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) streamsize ios_base::width() const { return __width_; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) streamsize ios_base::width(streamsize __wide) { streamsize __r = __width_; __width_ = __wide; return __r; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base::iostate ios_base::rdstate() const { return __rdstate_; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void ios_base::setstate(iostate __state) { clear(__rdstate_ | __state); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool ios_base::good() const { return __rdstate_ == 0; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool ios_base::eof() const { return (__rdstate_ & eofbit) != 0; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool ios_base::fail() const { return (__rdstate_ & (failbit | badbit)) != 0; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool ios_base::bad() const { return (__rdstate_ & badbit) != 0; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base::iostate ios_base::exceptions() const { return __exceptions_; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void ios_base::exceptions(iostate __iostate) { __exceptions_ = __iostate; clear(__rdstate_); } template <class _CharT, class _Traits> class basic_ios : public ios_base { public: typedef _CharT char_type; typedef _Traits traits_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; static_assert((is_same<_CharT, typename traits_type::char_type>::value), "traits_type::char_type must be the same type as CharT"); __attribute__ ((__exclude_from_explicit_instantiation__)) explicit operator bool() const {return !fail();} __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!() const {return fail();} __attribute__ ((__exclude_from_explicit_instantiation__)) iostate rdstate() const {return ios_base::rdstate();} __attribute__ ((__exclude_from_explicit_instantiation__)) void clear(iostate __state = goodbit) {ios_base::clear(__state);} __attribute__ ((__exclude_from_explicit_instantiation__)) void setstate(iostate __state) {ios_base::setstate(__state);} __attribute__ ((__exclude_from_explicit_instantiation__)) bool good() const {return ios_base::good();} __attribute__ ((__exclude_from_explicit_instantiation__)) bool eof() const {return ios_base::eof();} __attribute__ ((__exclude_from_explicit_instantiation__)) bool fail() const {return ios_base::fail();} __attribute__ ((__exclude_from_explicit_instantiation__)) bool bad() const {return ios_base::bad();} __attribute__ ((__exclude_from_explicit_instantiation__)) iostate exceptions() const {return ios_base::exceptions();} __attribute__ ((__exclude_from_explicit_instantiation__)) void exceptions(iostate __iostate) {ios_base::exceptions(__iostate);} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit basic_ios(basic_streambuf<char_type,traits_type>* __sb); virtual ~basic_ios(); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream<char_type, traits_type>* tie() const; __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_streambuf<char_type, traits_type>* rdbuf() const; __attribute__ ((__exclude_from_explicit_instantiation__)) basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb); basic_ios& copyfmt(const basic_ios& __rhs); __attribute__ ((__exclude_from_explicit_instantiation__)) char_type fill() const; __attribute__ ((__exclude_from_explicit_instantiation__)) char_type fill(char_type __ch); __attribute__ ((__exclude_from_explicit_instantiation__)) locale imbue(const locale& __loc); __attribute__ ((__exclude_from_explicit_instantiation__)) char narrow(char_type __c, char __dfault) const; __attribute__ ((__exclude_from_explicit_instantiation__)) char_type widen(char __c) const; protected: __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ios() { } __attribute__ ((__exclude_from_explicit_instantiation__)) void init(basic_streambuf<char_type, traits_type>* __sb); __attribute__ ((__exclude_from_explicit_instantiation__)) void move(basic_ios& __rhs); __attribute__ ((__exclude_from_explicit_instantiation__)) void move(basic_ios&& __rhs) {move(__rhs);} __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(basic_ios& __rhs) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb); private: basic_ostream<char_type, traits_type>* __tie_; mutable int_type __fill_; }; template <class _CharT, class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ios<_CharT, _Traits>::basic_ios(basic_streambuf<char_type,traits_type>* __sb) { init(__sb); } template <class _CharT, class _Traits> basic_ios<_CharT, _Traits>::~basic_ios() { } template <class _CharT, class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb) { ios_base::init(__sb); __tie_ = 0; __fill_ = traits_type::eof(); } template <class _CharT, class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream<_CharT, _Traits>* basic_ios<_CharT, _Traits>::tie() const { return __tie_; } template <class _CharT, class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream<_CharT, _Traits>* basic_ios<_CharT, _Traits>::tie(basic_ostream<char_type, traits_type>* __tiestr) { basic_ostream<char_type, traits_type>* __r = __tie_; __tie_ = __tiestr; return __r; } template <class _CharT, class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_streambuf<_CharT, _Traits>* basic_ios<_CharT, _Traits>::rdbuf() const { return static_cast<basic_streambuf<char_type, traits_type>*>(ios_base::rdbuf()); } template <class _CharT, class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_streambuf<_CharT, _Traits>* basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<char_type, traits_type>* __sb) { basic_streambuf<char_type, traits_type>* __r = rdbuf(); ios_base::rdbuf(__sb); return __r; } template <class _CharT, class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) locale basic_ios<_CharT, _Traits>::imbue(const locale& __loc) { locale __r = getloc(); ios_base::imbue(__loc); if (rdbuf()) rdbuf()->pubimbue(__loc); return __r; } template <class _CharT, class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) char basic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const { return use_facet<ctype<char_type> >(getloc()).narrow(__c, __dfault); } template <class _CharT, class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _CharT basic_ios<_CharT, _Traits>::widen(char __c) const { return use_facet<ctype<char_type> >(getloc()).widen(__c); } template <class _CharT, class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _CharT basic_ios<_CharT, _Traits>::fill() const { if (traits_type::eq_int_type(traits_type::eof(), __fill_)) __fill_ = widen(' '); return __fill_; } template <class _CharT, class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _CharT basic_ios<_CharT, _Traits>::fill(char_type __ch) { char_type __r = __fill_; __fill_ = __ch; return __r; } template <class _CharT, class _Traits> basic_ios<_CharT, _Traits>& basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs) { if (this != &__rhs) { __call_callbacks(erase_event); ios_base::copyfmt(__rhs); __tie_ = __rhs.__tie_; __fill_ = __rhs.__fill_; __call_callbacks(copyfmt_event); exceptions(__rhs.exceptions()); } return *this; } template <class _CharT, class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void basic_ios<_CharT, _Traits>::move(basic_ios& __rhs) { ios_base::move(__rhs); __tie_ = __rhs.__tie_; __rhs.__tie_ = 0; __fill_ = __rhs.__fill_; } template <class _CharT, class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs) noexcept { ios_base::swap(__rhs); std::__1::swap(__tie_, __rhs.__tie_); std::__1::swap(__fill_, __rhs.__fill_); } template <class _CharT, class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void basic_ios<_CharT, _Traits>::set_rdbuf(basic_streambuf<char_type, traits_type>* __sb) { ios_base::set_rdbuf(__sb); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base& boolalpha(ios_base& __str) { __str.setf(ios_base::boolalpha); return __str; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base& noboolalpha(ios_base& __str) { __str.unsetf(ios_base::boolalpha); return __str; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base& showbase(ios_base& __str) { __str.setf(ios_base::showbase); return __str; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base& noshowbase(ios_base& __str) { __str.unsetf(ios_base::showbase); return __str; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base& showpoint(ios_base& __str) { __str.setf(ios_base::showpoint); return __str; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base& noshowpoint(ios_base& __str) { __str.unsetf(ios_base::showpoint); return __str; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base& showpos(ios_base& __str) { __str.setf(ios_base::showpos); return __str; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base& noshowpos(ios_base& __str) { __str.unsetf(ios_base::showpos); return __str; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base& skipws(ios_base& __str) { __str.setf(ios_base::skipws); return __str; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base& noskipws(ios_base& __str) { __str.unsetf(ios_base::skipws); return __str; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base& uppercase(ios_base& __str) { __str.setf(ios_base::uppercase); return __str; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base& nouppercase(ios_base& __str) { __str.unsetf(ios_base::uppercase); return __str; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base& unitbuf(ios_base& __str) { __str.setf(ios_base::unitbuf); return __str; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base& nounitbuf(ios_base& __str) { __str.unsetf(ios_base::unitbuf); return __str; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base& internal(ios_base& __str) { __str.setf(ios_base::internal, ios_base::adjustfield); return __str; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base& left(ios_base& __str) { __str.setf(ios_base::left, ios_base::adjustfield); return __str; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base& right(ios_base& __str) { __str.setf(ios_base::right, ios_base::adjustfield); return __str; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base& dec(ios_base& __str) { __str.setf(ios_base::dec, ios_base::basefield); return __str; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base& hex(ios_base& __str) { __str.setf(ios_base::hex, ios_base::basefield); return __str; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base& oct(ios_base& __str) { __str.setf(ios_base::oct, ios_base::basefield); return __str; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base& fixed(ios_base& __str) { __str.setf(ios_base::fixed, ios_base::floatfield); return __str; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base& scientific(ios_base& __str) { __str.setf(ios_base::scientific, ios_base::floatfield); return __str; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base& hexfloat(ios_base& __str) { __str.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield); return __str; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) ios_base& defaultfloat(ios_base& __str) { __str.unsetf(ios_base::floatfield); return __str; } template <class _CharT, class _Traits> class __save_flags { typedef basic_ios<_CharT, _Traits> __stream_type; typedef typename __stream_type::fmtflags fmtflags; __stream_type& __stream_; fmtflags __fmtflags_; _CharT __fill_; __save_flags(const __save_flags&); __save_flags& operator=(const __save_flags&); public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __save_flags(__stream_type& __stream) : __stream_(__stream), __fmtflags_(__stream.flags()), __fill_(__stream.fill()) {} __attribute__ ((__exclude_from_explicit_instantiation__)) ~__save_flags() { __stream_.flags(__fmtflags_); __stream_.fill(__fill_); } }; } } namespace std { inline namespace __1 { template <class _CharT, class _Traits> class basic_streambuf { public: typedef _CharT char_type; typedef _Traits traits_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; static_assert((is_same<_CharT, typename traits_type::char_type>::value), "traits_type::char_type must be the same type as CharT"); virtual ~basic_streambuf(); inline __attribute__ ((__exclude_from_explicit_instantiation__)) locale pubimbue(const locale& __loc) { imbue(__loc); locale __r = __loc_; __loc_ = __loc; return __r; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) locale getloc() const { return __loc_; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_streambuf* pubsetbuf(char_type* __s, streamsize __n) { return setbuf(__s, __n); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) pos_type pubseekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __which = ios_base::in | ios_base::out) { return seekoff(__off, __way, __which); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) pos_type pubseekpos(pos_type __sp, ios_base::openmode __which = ios_base::in | ios_base::out) { return seekpos(__sp, __which); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) int pubsync() { return sync(); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) streamsize in_avail() { if (__ninp_ < __einp_) return static_cast<streamsize>(__einp_ - __ninp_); return showmanyc(); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) int_type snextc() { if (sbumpc() == traits_type::eof()) return traits_type::eof(); return sgetc(); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) int_type sbumpc() { if (__ninp_ == __einp_) return uflow(); return traits_type::to_int_type(*__ninp_++); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) int_type sgetc() { if (__ninp_ == __einp_) return underflow(); return traits_type::to_int_type(*__ninp_); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) streamsize sgetn(char_type* __s, streamsize __n) { return xsgetn(__s, __n); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) int_type sputbackc(char_type __c) { if (__binp_ == __ninp_ || !traits_type::eq(__c, __ninp_[-1])) return pbackfail(traits_type::to_int_type(__c)); return traits_type::to_int_type(*--__ninp_); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) int_type sungetc() { if (__binp_ == __ninp_) return pbackfail(); return traits_type::to_int_type(*--__ninp_); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) int_type sputc(char_type __c) { if (__nout_ == __eout_) return overflow(traits_type::to_int_type(__c)); *__nout_++ = __c; return traits_type::to_int_type(__c); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) streamsize sputn(const char_type* __s, streamsize __n) { return xsputn(__s, __n); } protected: basic_streambuf(); basic_streambuf(const basic_streambuf& __rhs); basic_streambuf& operator=(const basic_streambuf& __rhs); void swap(basic_streambuf& __rhs); __attribute__ ((__exclude_from_explicit_instantiation__)) char_type* eback() const {return __binp_;} __attribute__ ((__exclude_from_explicit_instantiation__)) char_type* gptr() const {return __ninp_;} __attribute__ ((__exclude_from_explicit_instantiation__)) char_type* egptr() const {return __einp_;} inline __attribute__ ((__exclude_from_explicit_instantiation__)) void gbump(int __n) { __ninp_ += __n; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void setg(char_type* __gbeg, char_type* __gnext, char_type* __gend) { __binp_ = __gbeg; __ninp_ = __gnext; __einp_ = __gend; } __attribute__ ((__exclude_from_explicit_instantiation__)) char_type* pbase() const {return __bout_;} __attribute__ ((__exclude_from_explicit_instantiation__)) char_type* pptr() const {return __nout_;} __attribute__ ((__exclude_from_explicit_instantiation__)) char_type* epptr() const {return __eout_;} inline __attribute__ ((__exclude_from_explicit_instantiation__)) void pbump(int __n) { __nout_ += __n; } __attribute__ ((__exclude_from_explicit_instantiation__)) void __pbump(streamsize __n) { __nout_ += __n; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void setp(char_type* __pbeg, char_type* __pend) { __bout_ = __nout_ = __pbeg; __eout_ = __pend; } virtual void imbue(const locale& __loc); virtual basic_streambuf* setbuf(char_type* __s, streamsize __n); virtual pos_type seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __which = ios_base::in | ios_base::out); virtual pos_type seekpos(pos_type __sp, ios_base::openmode __which = ios_base::in | ios_base::out); virtual int sync(); virtual streamsize showmanyc(); virtual streamsize xsgetn(char_type* __s, streamsize __n); virtual int_type underflow(); virtual int_type uflow(); virtual int_type pbackfail(int_type __c = traits_type::eof()); virtual streamsize xsputn(const char_type* __s, streamsize __n); virtual int_type overflow(int_type __c = traits_type::eof()); private: locale __loc_; char_type* __binp_; char_type* __ninp_; char_type* __einp_; char_type* __bout_; char_type* __nout_; char_type* __eout_; }; template <class _CharT, class _Traits> basic_streambuf<_CharT, _Traits>::~basic_streambuf() { } template <class _CharT, class _Traits> basic_streambuf<_CharT, _Traits>::basic_streambuf() : __binp_(0), __ninp_(0), __einp_(0), __bout_(0), __nout_(0), __eout_(0) { } template <class _CharT, class _Traits> basic_streambuf<_CharT, _Traits>::basic_streambuf(const basic_streambuf& __sb) : __loc_(__sb.__loc_), __binp_(__sb.__binp_), __ninp_(__sb.__ninp_), __einp_(__sb.__einp_), __bout_(__sb.__bout_), __nout_(__sb.__nout_), __eout_(__sb.__eout_) { } template <class _CharT, class _Traits> basic_streambuf<_CharT, _Traits>& basic_streambuf<_CharT, _Traits>::operator=(const basic_streambuf& __sb) { __loc_ = __sb.__loc_; __binp_ = __sb.__binp_; __ninp_ = __sb.__ninp_; __einp_ = __sb.__einp_; __bout_ = __sb.__bout_; __nout_ = __sb.__nout_; __eout_ = __sb.__eout_; return *this; } template <class _CharT, class _Traits> void basic_streambuf<_CharT, _Traits>::swap(basic_streambuf& __sb) { std::__1::swap(__loc_, __sb.__loc_); std::__1::swap(__binp_, __sb.__binp_); std::__1::swap(__ninp_, __sb.__ninp_); std::__1::swap(__einp_, __sb.__einp_); std::__1::swap(__bout_, __sb.__bout_); std::__1::swap(__nout_, __sb.__nout_); std::__1::swap(__eout_, __sb.__eout_); } template <class _CharT, class _Traits> void basic_streambuf<_CharT, _Traits>::imbue(const locale&) { } template <class _CharT, class _Traits> basic_streambuf<_CharT, _Traits>* basic_streambuf<_CharT, _Traits>::setbuf(char_type*, streamsize) { return this; } template <class _CharT, class _Traits> typename basic_streambuf<_CharT, _Traits>::pos_type basic_streambuf<_CharT, _Traits>::seekoff(off_type, ios_base::seekdir, ios_base::openmode) { return pos_type(off_type(-1)); } template <class _CharT, class _Traits> typename basic_streambuf<_CharT, _Traits>::pos_type basic_streambuf<_CharT, _Traits>::seekpos(pos_type, ios_base::openmode) { return pos_type(off_type(-1)); } template <class _CharT, class _Traits> int basic_streambuf<_CharT, _Traits>::sync() { return 0; } template <class _CharT, class _Traits> streamsize basic_streambuf<_CharT, _Traits>::showmanyc() { return 0; } template <class _CharT, class _Traits> streamsize basic_streambuf<_CharT, _Traits>::xsgetn(char_type* __s, streamsize __n) { const int_type __eof = traits_type::eof(); int_type __c; streamsize __i = 0; while(__i < __n) { if (__ninp_ < __einp_) { const streamsize __len = std::__1::min(static_cast<streamsize>(2147483647), std::__1::min(__einp_ - __ninp_, __n - __i)); traits_type::copy(__s, __ninp_, __len); __s += __len; __i += __len; this->gbump(__len); } else if ((__c = uflow()) != __eof) { *__s = traits_type::to_char_type(__c); ++__s; ++__i; } else break; } return __i; } template <class _CharT, class _Traits> typename basic_streambuf<_CharT, _Traits>::int_type basic_streambuf<_CharT, _Traits>::underflow() { return traits_type::eof(); } template <class _CharT, class _Traits> typename basic_streambuf<_CharT, _Traits>::int_type basic_streambuf<_CharT, _Traits>::uflow() { if (underflow() == traits_type::eof()) return traits_type::eof(); return traits_type::to_int_type(*__ninp_++); } template <class _CharT, class _Traits> typename basic_streambuf<_CharT, _Traits>::int_type basic_streambuf<_CharT, _Traits>::pbackfail(int_type) { return traits_type::eof(); } template <class _CharT, class _Traits> streamsize basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n) { streamsize __i = 0; int_type __eof = traits_type::eof(); while( __i < __n) { if (__nout_ >= __eout_) { if (overflow(traits_type::to_int_type(*__s)) == __eof) break; ++__s; ++__i; } else { streamsize __chunk_size = std::__1::min(__eout_ - __nout_, __n - __i); traits_type::copy(__nout_, __s, __chunk_size); __nout_ += __chunk_size; __s += __chunk_size; __i += __chunk_size; } } return __i; } template <class _CharT, class _Traits> typename basic_streambuf<_CharT, _Traits>::int_type basic_streambuf<_CharT, _Traits>::overflow(int_type) { return traits_type::eof(); } extern template class basic_streambuf<char>; extern template class basic_streambuf<wchar_t>; extern template class basic_ios<char>; extern template class basic_ios<wchar_t>; } } namespace std { inline namespace __1 { using ::va_list; } } namespace std { inline namespace __1 { locale_t __cloc(); template <class _InputIterator, class _ForwardIterator, class _Ctype> _ForwardIterator __scan_keyword(_InputIterator& __b, _InputIterator __e, _ForwardIterator __kb, _ForwardIterator __ke, const _Ctype& __ct, ios_base::iostate& __err, bool __case_sensitive = true) { typedef typename iterator_traits<_InputIterator>::value_type _CharT; size_t __nkw = static_cast<size_t>(std::__1::distance(__kb, __ke)); const unsigned char __doesnt_match = '\0'; const unsigned char __might_match = '\1'; const unsigned char __does_match = '\2'; unsigned char __statbuf[100]; unsigned char* __status = __statbuf; unique_ptr<unsigned char, void(*)(void*)> __stat_hold(0, free); if (__nkw > sizeof(__statbuf)) { __status = (unsigned char*)malloc(__nkw); if (__status == 0) __throw_bad_alloc(); __stat_hold.reset(__status); } size_t __n_might_match = __nkw; size_t __n_does_match = 0; unsigned char* __st = __status; for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void) ++__st) { if (!__ky->empty()) *__st = __might_match; else { *__st = __does_match; --__n_might_match; ++__n_does_match; } } for (size_t __indx = 0; __b != __e && __n_might_match > 0; ++__indx) { _CharT __c = *__b; if (!__case_sensitive) __c = __ct.toupper(__c); bool __consume = false; __st = __status; for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void) ++__st) { if (*__st == __might_match) { _CharT __kc = (*__ky)[__indx]; if (!__case_sensitive) __kc = __ct.toupper(__kc); if (__c == __kc) { __consume = true; if (__ky->size() == __indx+1) { *__st = __does_match; --__n_might_match; ++__n_does_match; } } else { *__st = __doesnt_match; --__n_might_match; } } } if (__consume) { ++__b; if (__n_might_match + __n_does_match > 1) { __st = __status; for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void) ++__st) { if (*__st == __does_match && __ky->size() != __indx+1) { *__st = __doesnt_match; --__n_does_match; } } } } } if (__b == __e) __err |= ios_base::eofbit; for (__st = __status; __kb != __ke; ++__kb, (void) ++__st) if (*__st == __does_match) break; if (__kb == __ke) __err |= ios_base::failbit; return __kb; } struct __num_get_base { static const int __num_get_buf_sz = 40; static int __get_base(ios_base&); static const char __src[33]; }; void __check_grouping(const string& __grouping, unsigned* __g, unsigned* __g_end, ios_base::iostate& __err); template <class _CharT> struct __num_get : protected __num_get_base { static string __stage2_float_prep(ios_base& __iob, _CharT* __atoms, _CharT& __decimal_point, _CharT& __thousands_sep); static int __stage2_float_loop(_CharT __ct, bool& __in_units, char& __exp, char* __a, char*& __a_end, _CharT __decimal_point, _CharT __thousands_sep, const string& __grouping, unsigned* __g, unsigned*& __g_end, unsigned& __dc, _CharT* __atoms); static string __stage2_int_prep(ios_base& __iob, _CharT& __thousands_sep) { locale __loc = __iob.getloc(); const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc); __thousands_sep = __np.thousands_sep(); return __np.grouping(); } const _CharT* __do_widen(ios_base& __iob, _CharT* __atoms) const { return __do_widen_p(__iob, __atoms); } static int __stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end, unsigned& __dc, _CharT __thousands_sep, const string& __grouping, unsigned* __g, unsigned*& __g_end, const _CharT* __atoms); private: template<typename T> const T* __do_widen_p(ios_base& __iob, T* __atoms) const { locale __loc = __iob.getloc(); use_facet<ctype<T> >(__loc).widen(__src, __src + 26, __atoms); return __atoms; } const char* __do_widen_p(ios_base& __iob, char* __atoms) const { (void)__iob; (void)__atoms; return __src; } }; template <class _CharT> string __num_get<_CharT>::__stage2_float_prep(ios_base& __iob, _CharT* __atoms, _CharT& __decimal_point, _CharT& __thousands_sep) { locale __loc = __iob.getloc(); use_facet<ctype<_CharT> >(__loc).widen(__src, __src + 32, __atoms); const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc); __decimal_point = __np.decimal_point(); __thousands_sep = __np.thousands_sep(); return __np.grouping(); } template <class _CharT> int __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end, unsigned& __dc, _CharT __thousands_sep, const string& __grouping, unsigned* __g, unsigned*& __g_end, const _CharT* __atoms) { if (__a_end == __a && (__ct == __atoms[24] || __ct == __atoms[25])) { *__a_end++ = __ct == __atoms[24] ? '+' : '-'; __dc = 0; return 0; } if (__grouping.size() != 0 && __ct == __thousands_sep) { if (__g_end-__g < __num_get_buf_sz) { *__g_end++ = __dc; __dc = 0; } return 0; } ptrdiff_t __f = find(__atoms, __atoms + 26, __ct) - __atoms; if (__f >= 24) return -1; switch (__base) { case 8: case 10: if (__f >= __base) return -1; break; case 16: if (__f < 22) break; if (__a_end != __a && __a_end - __a <= 2 && __a_end[-1] == '0') { __dc = 0; *__a_end++ = __src[__f]; return 0; } return -1; } *__a_end++ = __src[__f]; ++__dc; return 0; } template <class _CharT> int __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __exp, char* __a, char*& __a_end, _CharT __decimal_point, _CharT __thousands_sep, const string& __grouping, unsigned* __g, unsigned*& __g_end, unsigned& __dc, _CharT* __atoms) { if (__ct == __decimal_point) { if (!__in_units) return -1; __in_units = false; *__a_end++ = '.'; if (__grouping.size() != 0 && __g_end-__g < __num_get_buf_sz) *__g_end++ = __dc; return 0; } if (__ct == __thousands_sep && __grouping.size() != 0) { if (!__in_units) return -1; if (__g_end-__g < __num_get_buf_sz) { *__g_end++ = __dc; __dc = 0; } return 0; } ptrdiff_t __f = find(__atoms, __atoms + 32, __ct) - __atoms; if (__f >= 32) return -1; char __x = __src[__f]; if (__x == '-' || __x == '+') { if (__a_end == __a || (__a_end[-1] & 0x5F) == (__exp & 0x7F)) { *__a_end++ = __x; return 0; } return -1; } if (__x == 'x' || __x == 'X') __exp = 'P'; else if ((__x & 0x5F) == __exp) { __exp |= (char) 0x80; if (__in_units) { __in_units = false; if (__grouping.size() != 0 && __g_end-__g < __num_get_buf_sz) *__g_end++ = __dc; } } *__a_end++ = __x; if (__f >= 22) return 0; ++__dc; return 0; } extern template struct __num_get<char>; extern template struct __num_get<wchar_t>; template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> > class num_get : public locale::facet, private __num_get<_CharT> { public: typedef _CharT char_type; typedef _InputIterator iter_type; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit num_get(size_t __refs = 0) : locale::facet(__refs) {} __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, bool& __v) const { return do_get(__b, __e, __iob, __err, __v); } __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, long& __v) const { return do_get(__b, __e, __iob, __err, __v); } __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, long long& __v) const { return do_get(__b, __e, __iob, __err, __v); } __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned short& __v) const { return do_get(__b, __e, __iob, __err, __v); } __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned int& __v) const { return do_get(__b, __e, __iob, __err, __v); } __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned long& __v) const { return do_get(__b, __e, __iob, __err, __v); } __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned long long& __v) const { return do_get(__b, __e, __iob, __err, __v); } __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, float& __v) const { return do_get(__b, __e, __iob, __err, __v); } __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, double& __v) const { return do_get(__b, __e, __iob, __err, __v); } __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, long double& __v) const { return do_get(__b, __e, __iob, __err, __v); } __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, void*& __v) const { return do_get(__b, __e, __iob, __err, __v); } static locale::id id; protected: __attribute__ ((__exclude_from_explicit_instantiation__)) ~num_get() {} template <class _Fp> iter_type __do_get_floating_point (iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, _Fp& __v) const; template <class _Signed> iter_type __do_get_signed (iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, _Signed& __v) const; template <class _Unsigned> iter_type __do_get_unsigned (iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, _Unsigned& __v) const; virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, bool& __v) const; virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, long& __v) const { return this->__do_get_signed ( __b, __e, __iob, __err, __v ); } virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, long long& __v) const { return this->__do_get_signed ( __b, __e, __iob, __err, __v ); } virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned short& __v) const { return this->__do_get_unsigned ( __b, __e, __iob, __err, __v ); } virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned int& __v) const { return this->__do_get_unsigned ( __b, __e, __iob, __err, __v ); } virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned long& __v) const { return this->__do_get_unsigned ( __b, __e, __iob, __err, __v ); } virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, unsigned long long& __v) const { return this->__do_get_unsigned ( __b, __e, __iob, __err, __v ); } virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, float& __v) const { return this->__do_get_floating_point ( __b, __e, __iob, __err, __v ); } virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, double& __v) const { return this->__do_get_floating_point ( __b, __e, __iob, __err, __v ); } virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, long double& __v) const { return this->__do_get_floating_point ( __b, __e, __iob, __err, __v ); } virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, void*& __v) const; }; template <class _CharT, class _InputIterator> locale::id num_get<_CharT, _InputIterator>::id; template <class _Tp> _Tp __num_get_signed_integral(const char* __a, const char* __a_end, ios_base::iostate& __err, int __base) { if (__a != __a_end) { typename remove_reference<decltype((*_errno()))>::type __save_errno = (*_errno()); (*_errno()) = 0; char *__p2; long long __ll = _strtoi64_l(__a, &__p2, __base, __cloc()); typename remove_reference<decltype((*_errno()))>::type __current_errno = (*_errno()); if (__current_errno == 0) (*_errno()) = __save_errno; if (__p2 != __a_end) { __err = ios_base::failbit; return 0; } else if (__current_errno == 34 || __ll < numeric_limits<_Tp>::min() || numeric_limits<_Tp>::max() < __ll) { __err = ios_base::failbit; if (__ll > 0) return numeric_limits<_Tp>::max(); else return numeric_limits<_Tp>::min(); } return static_cast<_Tp>(__ll); } __err = ios_base::failbit; return 0; } template <class _Tp> _Tp __num_get_unsigned_integral(const char* __a, const char* __a_end, ios_base::iostate& __err, int __base) { if (__a != __a_end) { const bool __negate = *__a == '-'; if (__negate && ++__a == __a_end) { __err = ios_base::failbit; return 0; } typename remove_reference<decltype((*_errno()))>::type __save_errno = (*_errno()); (*_errno()) = 0; char *__p2; unsigned long long __ll = _strtoui64_l(__a, &__p2, __base, __cloc()); typename remove_reference<decltype((*_errno()))>::type __current_errno = (*_errno()); if (__current_errno == 0) (*_errno()) = __save_errno; if (__p2 != __a_end) { __err = ios_base::failbit; return 0; } else if (__current_errno == 34 || numeric_limits<_Tp>::max() < __ll) { __err = ios_base::failbit; return numeric_limits<_Tp>::max(); } _Tp __res = static_cast<_Tp>(__ll); if (__negate) __res = -__res; return __res; } __err = ios_base::failbit; return 0; } template <class _Tp> __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp __do_strtod(const char* __a, char** __p2); template <> inline __attribute__ ((__exclude_from_explicit_instantiation__)) float __do_strtod<float>(const char* __a, char** __p2) { return _strtof_l(__a, __p2, __cloc()); } template <> inline __attribute__ ((__exclude_from_explicit_instantiation__)) double __do_strtod<double>(const char* __a, char** __p2) { return _strtod_l(__a, __p2, __cloc()); } template <> inline __attribute__ ((__exclude_from_explicit_instantiation__)) long double __do_strtod<long double>(const char* __a, char** __p2) { return _strtold_l(__a, __p2, __cloc()); } template <class _Tp> _Tp __num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err) { if (__a != __a_end) { typename remove_reference<decltype((*_errno()))>::type __save_errno = (*_errno()); (*_errno()) = 0; char *__p2; _Tp __ld = __do_strtod<_Tp>(__a, &__p2); typename remove_reference<decltype((*_errno()))>::type __current_errno = (*_errno()); if (__current_errno == 0) (*_errno()) = __save_errno; if (__p2 != __a_end) { __err = ios_base::failbit; return 0; } else if (__current_errno == 34) __err = ios_base::failbit; return __ld; } __err = ios_base::failbit; return 0; } template <class _CharT, class _InputIterator> _InputIterator num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, bool& __v) const { if ((__iob.flags() & ios_base::boolalpha) == 0) { long __lv = -1; __b = do_get(__b, __e, __iob, __err, __lv); switch (__lv) { case 0: __v = false; break; case 1: __v = true; break; default: __v = true; __err = ios_base::failbit; break; } return __b; } const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__iob.getloc()); const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__iob.getloc()); typedef typename numpunct<_CharT>::string_type string_type; const string_type __names[2] = {__np.truename(), __np.falsename()}; const string_type* __i = __scan_keyword(__b, __e, __names, __names+2, __ct, __err); __v = __i == __names; return __b; } template <class _CharT, class _InputIterator> template <class _Signed> _InputIterator num_get<_CharT, _InputIterator>::__do_get_signed(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, _Signed& __v) const { int __base = this->__get_base(__iob); char_type __thousands_sep; const int __atoms_size = 26; char_type __atoms1[__atoms_size]; const char_type *__atoms = this->__do_widen(__iob, __atoms1); string __grouping = this->__stage2_int_prep(__iob, __thousands_sep); string __buf; __buf.resize(__buf.capacity()); char* __a = &__buf[0]; char* __a_end = __a; unsigned __g[__num_get_base::__num_get_buf_sz]; unsigned* __g_end = __g; unsigned __dc = 0; for (; __b != __e; ++__b) { if (__a_end == __a + __buf.size()) { size_t __tmp = __buf.size(); __buf.resize(2*__buf.size()); __buf.resize(__buf.capacity()); __a = &__buf[0]; __a_end = __a + __tmp; } if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc, __thousands_sep, __grouping, __g, __g_end, __atoms)) break; } if (__grouping.size() != 0 && __g_end-__g < __num_get_base::__num_get_buf_sz) *__g_end++ = __dc; __v = __num_get_signed_integral<_Signed>(__a, __a_end, __err, __base); __check_grouping(__grouping, __g, __g_end, __err); if (__b == __e) __err |= ios_base::eofbit; return __b; } template <class _CharT, class _InputIterator> template <class _Unsigned> _InputIterator num_get<_CharT, _InputIterator>::__do_get_unsigned(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, _Unsigned& __v) const { int __base = this->__get_base(__iob); char_type __thousands_sep; const int __atoms_size = 26; char_type __atoms1[__atoms_size]; const char_type *__atoms = this->__do_widen(__iob, __atoms1); string __grouping = this->__stage2_int_prep(__iob, __thousands_sep); string __buf; __buf.resize(__buf.capacity()); char* __a = &__buf[0]; char* __a_end = __a; unsigned __g[__num_get_base::__num_get_buf_sz]; unsigned* __g_end = __g; unsigned __dc = 0; for (; __b != __e; ++__b) { if (__a_end == __a + __buf.size()) { size_t __tmp = __buf.size(); __buf.resize(2*__buf.size()); __buf.resize(__buf.capacity()); __a = &__buf[0]; __a_end = __a + __tmp; } if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc, __thousands_sep, __grouping, __g, __g_end, __atoms)) break; } if (__grouping.size() != 0 && __g_end-__g < __num_get_base::__num_get_buf_sz) *__g_end++ = __dc; __v = __num_get_unsigned_integral<_Unsigned>(__a, __a_end, __err, __base); __check_grouping(__grouping, __g, __g_end, __err); if (__b == __e) __err |= ios_base::eofbit; return __b; } template <class _CharT, class _InputIterator> template <class _Fp> _InputIterator num_get<_CharT, _InputIterator>::__do_get_floating_point(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, _Fp& __v) const { char_type __atoms[32]; char_type __decimal_point; char_type __thousands_sep; string __grouping = this->__stage2_float_prep(__iob, __atoms, __decimal_point, __thousands_sep); string __buf; __buf.resize(__buf.capacity()); char* __a = &__buf[0]; char* __a_end = __a; unsigned __g[__num_get_base::__num_get_buf_sz]; unsigned* __g_end = __g; unsigned __dc = 0; bool __in_units = true; char __exp = 'E'; for (; __b != __e; ++__b) { if (__a_end == __a + __buf.size()) { size_t __tmp = __buf.size(); __buf.resize(2*__buf.size()); __buf.resize(__buf.capacity()); __a = &__buf[0]; __a_end = __a + __tmp; } if (this->__stage2_float_loop(*__b, __in_units, __exp, __a, __a_end, __decimal_point, __thousands_sep, __grouping, __g, __g_end, __dc, __atoms)) break; } if (__grouping.size() != 0 && __in_units && __g_end-__g < __num_get_base::__num_get_buf_sz) *__g_end++ = __dc; __v = __num_get_float<_Fp>(__a, __a_end, __err); __check_grouping(__grouping, __g, __g_end, __err); if (__b == __e) __err |= ios_base::eofbit; return __b; } template <class _CharT, class _InputIterator> _InputIterator num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, void*& __v) const { int __base = 16; char_type __atoms[26]; char_type __thousands_sep = 0; string __grouping; use_facet<ctype<_CharT> >(__iob.getloc()).widen(__num_get_base::__src, __num_get_base::__src + 26, __atoms); string __buf; __buf.resize(__buf.capacity()); char* __a = &__buf[0]; char* __a_end = __a; unsigned __g[__num_get_base::__num_get_buf_sz]; unsigned* __g_end = __g; unsigned __dc = 0; for (; __b != __e; ++__b) { if (__a_end == __a + __buf.size()) { size_t __tmp = __buf.size(); __buf.resize(2*__buf.size()); __buf.resize(__buf.capacity()); __a = &__buf[0]; __a_end = __a + __tmp; } if (this->__stage2_int_loop(*__b, __base, __a, __a_end, __dc, __thousands_sep, __grouping, __g, __g_end, __atoms)) break; } __buf.resize(__a_end - __a); if (_sscanf_l( __buf.c_str(), "%p", __cloc(), &__v ) != 1) __err = ios_base::failbit; if (__b == __e) __err |= ios_base::eofbit; return __b; } extern template class num_get<char>; extern template class num_get<wchar_t>; struct __num_put_base { protected: static void __format_int(char* __fmt, const char* __len, bool __signd, ios_base::fmtflags __flags); static bool __format_float(char* __fmt, const char* __len, ios_base::fmtflags __flags); static char* __identify_padding(char* __nb, char* __ne, const ios_base& __iob); }; template <class _CharT> struct __num_put : protected __num_put_base { static void __widen_and_group_int(char* __nb, char* __np, char* __ne, _CharT* __ob, _CharT*& __op, _CharT*& __oe, const locale& __loc); static void __widen_and_group_float(char* __nb, char* __np, char* __ne, _CharT* __ob, _CharT*& __op, _CharT*& __oe, const locale& __loc); }; template <class _CharT> void __num_put<_CharT>::__widen_and_group_int(char* __nb, char* __np, char* __ne, _CharT* __ob, _CharT*& __op, _CharT*& __oe, const locale& __loc) { const ctype<_CharT>& __ct = use_facet<ctype<_CharT> > (__loc); const numpunct<_CharT>& __npt = use_facet<numpunct<_CharT> >(__loc); string __grouping = __npt.grouping(); if (__grouping.empty()) { __ct.widen(__nb, __ne, __ob); __oe = __ob + (__ne - __nb); } else { __oe = __ob; char* __nf = __nb; if (*__nf == '-' || *__nf == '+') *__oe++ = __ct.widen(*__nf++); if (__ne - __nf >= 2 && __nf[0] == '0' && (__nf[1] == 'x' || __nf[1] == 'X')) { *__oe++ = __ct.widen(*__nf++); *__oe++ = __ct.widen(*__nf++); } reverse(__nf, __ne); _CharT __thousands_sep = __npt.thousands_sep(); unsigned __dc = 0; unsigned __dg = 0; for (char* __p = __nf; __p < __ne; ++__p) { if (static_cast<unsigned>(__grouping[__dg]) > 0 && __dc == static_cast<unsigned>(__grouping[__dg])) { *__oe++ = __thousands_sep; __dc = 0; if (__dg < __grouping.size()-1) ++__dg; } *__oe++ = __ct.widen(*__p); ++__dc; } reverse(__ob + (__nf - __nb), __oe); } if (__np == __ne) __op = __oe; else __op = __ob + (__np - __nb); } template <class _CharT> void __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne, _CharT* __ob, _CharT*& __op, _CharT*& __oe, const locale& __loc) { const ctype<_CharT>& __ct = use_facet<ctype<_CharT> > (__loc); const numpunct<_CharT>& __npt = use_facet<numpunct<_CharT> >(__loc); string __grouping = __npt.grouping(); __oe = __ob; char* __nf = __nb; if (*__nf == '-' || *__nf == '+') *__oe++ = __ct.widen(*__nf++); char* __ns; if (__ne - __nf >= 2 && __nf[0] == '0' && (__nf[1] == 'x' || __nf[1] == 'X')) { *__oe++ = __ct.widen(*__nf++); *__oe++ = __ct.widen(*__nf++); for (__ns = __nf; __ns < __ne; ++__ns) if (!_ischartype_l(*__ns, 0x80, __cloc())) break; } else { for (__ns = __nf; __ns < __ne; ++__ns) if (!_ischartype_l(*__ns, 0x04, __cloc())) break; } if (__grouping.empty()) { __ct.widen(__nf, __ns, __oe); __oe += __ns - __nf; } else { reverse(__nf, __ns); _CharT __thousands_sep = __npt.thousands_sep(); unsigned __dc = 0; unsigned __dg = 0; for (char* __p = __nf; __p < __ns; ++__p) { if (__grouping[__dg] > 0 && __dc == static_cast<unsigned>(__grouping[__dg])) { *__oe++ = __thousands_sep; __dc = 0; if (__dg < __grouping.size()-1) ++__dg; } *__oe++ = __ct.widen(*__p); ++__dc; } reverse(__ob + (__nf - __nb), __oe); } for (__nf = __ns; __nf < __ne; ++__nf) { if (*__nf == '.') { *__oe++ = __npt.decimal_point(); ++__nf; break; } else *__oe++ = __ct.widen(*__nf); } __ct.widen(__nf, __ne, __oe); __oe += __ne - __nf; if (__np == __ne) __op = __oe; else __op = __ob + (__np - __nb); } extern template struct __num_put<char>; extern template struct __num_put<wchar_t>; template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> > class num_put : public locale::facet, private __num_put<_CharT> { public: typedef _CharT char_type; typedef _OutputIterator iter_type; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit num_put(size_t __refs = 0) : locale::facet(__refs) {} __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type put(iter_type __s, ios_base& __iob, char_type __fl, bool __v) const { return do_put(__s, __iob, __fl, __v); } __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type put(iter_type __s, ios_base& __iob, char_type __fl, long __v) const { return do_put(__s, __iob, __fl, __v); } __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type put(iter_type __s, ios_base& __iob, char_type __fl, long long __v) const { return do_put(__s, __iob, __fl, __v); } __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type put(iter_type __s, ios_base& __iob, char_type __fl, unsigned long __v) const { return do_put(__s, __iob, __fl, __v); } __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type put(iter_type __s, ios_base& __iob, char_type __fl, unsigned long long __v) const { return do_put(__s, __iob, __fl, __v); } __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type put(iter_type __s, ios_base& __iob, char_type __fl, double __v) const { return do_put(__s, __iob, __fl, __v); } __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type put(iter_type __s, ios_base& __iob, char_type __fl, long double __v) const { return do_put(__s, __iob, __fl, __v); } __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type put(iter_type __s, ios_base& __iob, char_type __fl, const void* __v) const { return do_put(__s, __iob, __fl, __v); } static locale::id id; protected: __attribute__ ((__exclude_from_explicit_instantiation__)) ~num_put() {} virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, bool __v) const; virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, long __v) const; virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, long long __v) const; virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, unsigned long) const; virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, unsigned long long) const; virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, double __v) const; virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, long double __v) const; virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, const void* __v) const; }; template <class _CharT, class _OutputIterator> locale::id num_put<_CharT, _OutputIterator>::id; template <class _CharT, class _OutputIterator> _OutputIterator __pad_and_output(_OutputIterator __s, const _CharT* __ob, const _CharT* __op, const _CharT* __oe, ios_base& __iob, _CharT __fl) { streamsize __sz = __oe - __ob; streamsize __ns = __iob.width(); if (__ns > __sz) __ns -= __sz; else __ns = 0; for (;__ob < __op; ++__ob, ++__s) *__s = *__ob; for (; __ns; --__ns, ++__s) *__s = __fl; for (; __ob < __oe; ++__ob, ++__s) *__s = *__ob; __iob.width(0); return __s; } template <class _CharT, class _Traits> ostreambuf_iterator<_CharT, _Traits> __pad_and_output(ostreambuf_iterator<_CharT, _Traits> __s, const _CharT* __ob, const _CharT* __op, const _CharT* __oe, ios_base& __iob, _CharT __fl) { if (__s.__sbuf_ == nullptr) return __s; streamsize __sz = __oe - __ob; streamsize __ns = __iob.width(); if (__ns > __sz) __ns -= __sz; else __ns = 0; streamsize __np = __op - __ob; if (__np > 0) { if (__s.__sbuf_->sputn(__ob, __np) != __np) { __s.__sbuf_ = nullptr; return __s; } } if (__ns > 0) { basic_string<_CharT, _Traits> __sp(__ns, __fl); if (__s.__sbuf_->sputn(__sp.data(), __ns) != __ns) { __s.__sbuf_ = nullptr; return __s; } } __np = __oe - __op; if (__np > 0) { if (__s.__sbuf_->sputn(__op, __np) != __np) { __s.__sbuf_ = nullptr; return __s; } } __iob.width(0); return __s; } template <class _CharT, class _OutputIterator> _OutputIterator num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, bool __v) const { if ((__iob.flags() & ios_base::boolalpha) == 0) return do_put(__s, __iob, __fl, (unsigned long)__v); const numpunct<char_type>& __np = use_facet<numpunct<char_type> >(__iob.getloc()); typedef typename numpunct<char_type>::string_type string_type; string_type __nm = __v ? __np.truename() : __np.falsename(); for (typename string_type::iterator __i = __nm.begin(); __i != __nm.end(); ++__i, ++__s) *__s = *__i; return __s; } template <class _CharT, class _OutputIterator> _OutputIterator num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, long __v) const { char __fmt[6] = {'%', 0}; const char* __len = "l"; this->__format_int(__fmt+1, __len, true, __iob.flags()); const unsigned __nbuf = (numeric_limits<long>::digits / 3) + ((numeric_limits<long>::digits % 3) != 0) + ((__iob.flags() & ios_base::showbase) != 0) + 2; char __nar[__nbuf]; int __nc = snprintf_l(__nar, sizeof(__nar), __cloc(), __fmt, __v); char* __ne = __nar + __nc; char* __np = this->__identify_padding(__nar, __ne, __iob); char_type __o[2*(__nbuf-1) - 1]; char_type* __op; char_type* __oe; this->__widen_and_group_int(__nar, __np, __ne, __o, __op, __oe, __iob.getloc()); return __pad_and_output(__s, __o, __op, __oe, __iob, __fl); } template <class _CharT, class _OutputIterator> _OutputIterator num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, long long __v) const { char __fmt[8] = {'%', 0}; const char* __len = "ll"; this->__format_int(__fmt+1, __len, true, __iob.flags()); const unsigned __nbuf = (numeric_limits<long long>::digits / 3) + ((numeric_limits<long long>::digits % 3) != 0) + ((__iob.flags() & ios_base::showbase) != 0) + 2; char __nar[__nbuf]; int __nc = snprintf_l(__nar, sizeof(__nar), __cloc(), __fmt, __v); char* __ne = __nar + __nc; char* __np = this->__identify_padding(__nar, __ne, __iob); char_type __o[2*(__nbuf-1) - 1]; char_type* __op; char_type* __oe; this->__widen_and_group_int(__nar, __np, __ne, __o, __op, __oe, __iob.getloc()); return __pad_and_output(__s, __o, __op, __oe, __iob, __fl); } template <class _CharT, class _OutputIterator> _OutputIterator num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, unsigned long __v) const { char __fmt[6] = {'%', 0}; const char* __len = "l"; this->__format_int(__fmt+1, __len, false, __iob.flags()); const unsigned __nbuf = (numeric_limits<unsigned long>::digits / 3) + ((numeric_limits<unsigned long>::digits % 3) != 0) + ((__iob.flags() & ios_base::showbase) != 0) + 1; char __nar[__nbuf]; int __nc = snprintf_l(__nar, sizeof(__nar), __cloc(), __fmt, __v); char* __ne = __nar + __nc; char* __np = this->__identify_padding(__nar, __ne, __iob); char_type __o[2*(__nbuf-1) - 1]; char_type* __op; char_type* __oe; this->__widen_and_group_int(__nar, __np, __ne, __o, __op, __oe, __iob.getloc()); return __pad_and_output(__s, __o, __op, __oe, __iob, __fl); } template <class _CharT, class _OutputIterator> _OutputIterator num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, unsigned long long __v) const { char __fmt[8] = {'%', 0}; const char* __len = "ll"; this->__format_int(__fmt+1, __len, false, __iob.flags()); const unsigned __nbuf = (numeric_limits<unsigned long long>::digits / 3) + ((numeric_limits<unsigned long long>::digits % 3) != 0) + ((__iob.flags() & ios_base::showbase) != 0) + 1; char __nar[__nbuf]; int __nc = snprintf_l(__nar, sizeof(__nar), __cloc(), __fmt, __v); char* __ne = __nar + __nc; char* __np = this->__identify_padding(__nar, __ne, __iob); char_type __o[2*(__nbuf-1) - 1]; char_type* __op; char_type* __oe; this->__widen_and_group_int(__nar, __np, __ne, __o, __op, __oe, __iob.getloc()); return __pad_and_output(__s, __o, __op, __oe, __iob, __fl); } template <class _CharT, class _OutputIterator> _OutputIterator num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, double __v) const { char __fmt[8] = {'%', 0}; const char* __len = ""; bool __specify_precision = this->__format_float(__fmt+1, __len, __iob.flags()); const unsigned __nbuf = 30; char __nar[__nbuf]; char* __nb = __nar; int __nc; if (__specify_precision) __nc = snprintf_l(__nb, __nbuf, __cloc(), __fmt, (int)__iob.precision(), __v); else __nc = snprintf_l(__nb, __nbuf, __cloc(), __fmt, __v); unique_ptr<char, void(*)(void*)> __nbh(0, free); if (__nc > static_cast<int>(__nbuf-1)) { if (__specify_precision) __nc = asprintf_l(&__nb, __cloc(), __fmt, (int)__iob.precision(), __v); else __nc = asprintf_l(&__nb, __cloc(), __fmt, __v); if (__nb == 0) __throw_bad_alloc(); __nbh.reset(__nb); } char* __ne = __nb + __nc; char* __np = this->__identify_padding(__nb, __ne, __iob); char_type __o[2*(__nbuf-1) - 1]; char_type* __ob = __o; unique_ptr<char_type, void(*)(void*)> __obh(0, free); if (__nb != __nar) { __ob = (char_type*)malloc(2*static_cast<size_t>(__nc)*sizeof(char_type)); if (__ob == 0) __throw_bad_alloc(); __obh.reset(__ob); } char_type* __op; char_type* __oe; this->__widen_and_group_float(__nb, __np, __ne, __ob, __op, __oe, __iob.getloc()); __s = __pad_and_output(__s, __ob, __op, __oe, __iob, __fl); return __s; } template <class _CharT, class _OutputIterator> _OutputIterator num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, long double __v) const { char __fmt[8] = {'%', 0}; const char* __len = "L"; bool __specify_precision = this->__format_float(__fmt+1, __len, __iob.flags()); const unsigned __nbuf = 30; char __nar[__nbuf]; char* __nb = __nar; int __nc; if (__specify_precision) __nc = snprintf_l(__nb, __nbuf, __cloc(), __fmt, (int)__iob.precision(), __v); else __nc = snprintf_l(__nb, __nbuf, __cloc(), __fmt, __v); unique_ptr<char, void(*)(void*)> __nbh(0, free); if (__nc > static_cast<int>(__nbuf-1)) { if (__specify_precision) __nc = asprintf_l(&__nb, __cloc(), __fmt, (int)__iob.precision(), __v); else __nc = asprintf_l(&__nb, __cloc(), __fmt, __v); if (__nb == 0) __throw_bad_alloc(); __nbh.reset(__nb); } char* __ne = __nb + __nc; char* __np = this->__identify_padding(__nb, __ne, __iob); char_type __o[2*(__nbuf-1) - 1]; char_type* __ob = __o; unique_ptr<char_type, void(*)(void*)> __obh(0, free); if (__nb != __nar) { __ob = (char_type*)malloc(2*static_cast<size_t>(__nc)*sizeof(char_type)); if (__ob == 0) __throw_bad_alloc(); __obh.reset(__ob); } char_type* __op; char_type* __oe; this->__widen_and_group_float(__nb, __np, __ne, __ob, __op, __oe, __iob.getloc()); __s = __pad_and_output(__s, __ob, __op, __oe, __iob, __fl); return __s; } template <class _CharT, class _OutputIterator> _OutputIterator num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, const void* __v) const { char __fmt[6] = "%p"; const unsigned __nbuf = 20; char __nar[__nbuf]; int __nc = snprintf_l(__nar, sizeof(__nar), __cloc(), __fmt, __v); char* __ne = __nar + __nc; char* __np = this->__identify_padding(__nar, __ne, __iob); char_type __o[2*(__nbuf-1) - 1]; char_type* __op; char_type* __oe; const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc()); __ct.widen(__nar, __ne, __o); __oe = __o + (__ne - __nar); if (__np == __ne) __op = __oe; else __op = __o + (__np - __nar); return __pad_and_output(__s, __o, __op, __oe, __iob, __fl); } extern template class num_put<char>; extern template class num_put<wchar_t>; template <class _CharT, class _InputIterator> int __get_up_to_n_digits(_InputIterator& __b, _InputIterator __e, ios_base::iostate& __err, const ctype<_CharT>& __ct, int __n) { if (__b == __e) { __err |= ios_base::eofbit | ios_base::failbit; return 0; } _CharT __c = *__b; if (!__ct.is(ctype_base::digit, __c)) { __err |= ios_base::failbit; return 0; } int __r = __ct.narrow(__c, 0) - '0'; for (++__b, (void) --__n; __b != __e && __n > 0; ++__b, (void) --__n) { __c = *__b; if (!__ct.is(ctype_base::digit, __c)) return __r; __r = __r * 10 + __ct.narrow(__c, 0) - '0'; } if (__b == __e) __err |= ios_base::eofbit; return __r; } class time_base { public: enum dateorder {no_order, dmy, mdy, ymd, ydm}; }; template <class _CharT> class __time_get_c_storage { protected: typedef basic_string<_CharT> string_type; virtual const string_type* __weeks() const; virtual const string_type* __months() const; virtual const string_type* __am_pm() const; virtual const string_type& __c() const; virtual const string_type& __r() const; virtual const string_type& __x() const; virtual const string_type& __X() const; __attribute__ ((__exclude_from_explicit_instantiation__)) ~__time_get_c_storage() {} }; template <> const string* __time_get_c_storage<char>::__weeks() const; template <> const string* __time_get_c_storage<char>::__months() const; template <> const string* __time_get_c_storage<char>::__am_pm() const; template <> const string& __time_get_c_storage<char>::__c() const; template <> const string& __time_get_c_storage<char>::__r() const; template <> const string& __time_get_c_storage<char>::__x() const; template <> const string& __time_get_c_storage<char>::__X() const; template <> const wstring* __time_get_c_storage<wchar_t>::__weeks() const; template <> const wstring* __time_get_c_storage<wchar_t>::__months() const; template <> const wstring* __time_get_c_storage<wchar_t>::__am_pm() const; template <> const wstring& __time_get_c_storage<wchar_t>::__c() const; template <> const wstring& __time_get_c_storage<wchar_t>::__r() const; template <> const wstring& __time_get_c_storage<wchar_t>::__x() const; template <> const wstring& __time_get_c_storage<wchar_t>::__X() const; template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> > class time_get : public locale::facet, public time_base, private __time_get_c_storage<_CharT> { public: typedef _CharT char_type; typedef _InputIterator iter_type; typedef time_base::dateorder dateorder; typedef basic_string<char_type> string_type; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit time_get(size_t __refs = 0) : locale::facet(__refs) {} __attribute__ ((__exclude_from_explicit_instantiation__)) dateorder date_order() const { return this->do_date_order(); } __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type get_time(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const { return do_get_time(__b, __e, __iob, __err, __tm); } __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type get_date(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const { return do_get_date(__b, __e, __iob, __err, __tm); } __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type get_weekday(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const { return do_get_weekday(__b, __e, __iob, __err, __tm); } __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type get_monthname(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const { return do_get_monthname(__b, __e, __iob, __err, __tm); } __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type get_year(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const { return do_get_year(__b, __e, __iob, __err, __tm); } __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm *__tm, char __fmt, char __mod = 0) const { return do_get(__b, __e, __iob, __err, __tm, __fmt, __mod); } iter_type get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm, const char_type* __fmtb, const char_type* __fmte) const; static locale::id id; protected: __attribute__ ((__exclude_from_explicit_instantiation__)) ~time_get() {} virtual dateorder do_date_order() const; virtual iter_type do_get_time(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const; virtual iter_type do_get_date(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const; virtual iter_type do_get_weekday(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const; virtual iter_type do_get_monthname(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const; virtual iter_type do_get_year(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const; virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm, char __fmt, char __mod) const; private: void __get_white_space(iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const; void __get_percent(iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const; void __get_weekdayname(int& __m, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const; void __get_monthname(int& __m, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const; void __get_day(int& __d, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const; void __get_month(int& __m, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const; void __get_year(int& __y, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const; void __get_year4(int& __y, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const; void __get_hour(int& __d, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const; void __get_12_hour(int& __h, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const; void __get_am_pm(int& __h, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const; void __get_minute(int& __m, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const; void __get_second(int& __s, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const; void __get_weekday(int& __w, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const; void __get_day_year_num(int& __w, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const; }; template <class _CharT, class _InputIterator> locale::id time_get<_CharT, _InputIterator>::id; template <class _CharT, class _InputIterator> void time_get<_CharT, _InputIterator>::__get_weekdayname(int& __w, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const { const string_type* __wk = this->__weeks(); ptrdiff_t __i = __scan_keyword(__b, __e, __wk, __wk+14, __ct, __err, false) - __wk; if (__i < 14) __w = __i % 7; } template <class _CharT, class _InputIterator> void time_get<_CharT, _InputIterator>::__get_monthname(int& __m, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const { const string_type* __month = this->__months(); ptrdiff_t __i = __scan_keyword(__b, __e, __month, __month+24, __ct, __err, false) - __month; if (__i < 24) __m = __i % 12; } template <class _CharT, class _InputIterator> void time_get<_CharT, _InputIterator>::__get_day(int& __d, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const { int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2); if (!(__err & ios_base::failbit) && 1 <= __t && __t <= 31) __d = __t; else __err |= ios_base::failbit; } template <class _CharT, class _InputIterator> void time_get<_CharT, _InputIterator>::__get_month(int& __m, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const { int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2) - 1; if (!(__err & ios_base::failbit) && __t <= 11) __m = __t; else __err |= ios_base::failbit; } template <class _CharT, class _InputIterator> void time_get<_CharT, _InputIterator>::__get_year(int& __y, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const { int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 4); if (!(__err & ios_base::failbit)) { if (__t < 69) __t += 2000; else if (69 <= __t && __t <= 99) __t += 1900; __y = __t - 1900; } } template <class _CharT, class _InputIterator> void time_get<_CharT, _InputIterator>::__get_year4(int& __y, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const { int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 4); if (!(__err & ios_base::failbit)) __y = __t - 1900; } template <class _CharT, class _InputIterator> void time_get<_CharT, _InputIterator>::__get_hour(int& __h, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const { int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2); if (!(__err & ios_base::failbit) && __t <= 23) __h = __t; else __err |= ios_base::failbit; } template <class _CharT, class _InputIterator> void time_get<_CharT, _InputIterator>::__get_12_hour(int& __h, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const { int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2); if (!(__err & ios_base::failbit) && 1 <= __t && __t <= 12) __h = __t; else __err |= ios_base::failbit; } template <class _CharT, class _InputIterator> void time_get<_CharT, _InputIterator>::__get_minute(int& __m, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const { int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2); if (!(__err & ios_base::failbit) && __t <= 59) __m = __t; else __err |= ios_base::failbit; } template <class _CharT, class _InputIterator> void time_get<_CharT, _InputIterator>::__get_second(int& __s, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const { int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2); if (!(__err & ios_base::failbit) && __t <= 60) __s = __t; else __err |= ios_base::failbit; } template <class _CharT, class _InputIterator> void time_get<_CharT, _InputIterator>::__get_weekday(int& __w, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const { int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 1); if (!(__err & ios_base::failbit) && __t <= 6) __w = __t; else __err |= ios_base::failbit; } template <class _CharT, class _InputIterator> void time_get<_CharT, _InputIterator>::__get_day_year_num(int& __d, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const { int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 3); if (!(__err & ios_base::failbit) && __t <= 365) __d = __t; else __err |= ios_base::failbit; } template <class _CharT, class _InputIterator> void time_get<_CharT, _InputIterator>::__get_white_space(iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const { for (; __b != __e && __ct.is(ctype_base::space, *__b); ++__b) ; if (__b == __e) __err |= ios_base::eofbit; } template <class _CharT, class _InputIterator> void time_get<_CharT, _InputIterator>::__get_am_pm(int& __h, iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const { const string_type* __ap = this->__am_pm(); if (__ap[0].size() + __ap[1].size() == 0) { __err |= ios_base::failbit; return; } ptrdiff_t __i = __scan_keyword(__b, __e, __ap, __ap+2, __ct, __err, false) - __ap; if (__i == 0 && __h == 12) __h = 0; else if (__i == 1 && __h < 12) __h += 12; } template <class _CharT, class _InputIterator> void time_get<_CharT, _InputIterator>::__get_percent(iter_type& __b, iter_type __e, ios_base::iostate& __err, const ctype<char_type>& __ct) const { if (__b == __e) { __err |= ios_base::eofbit | ios_base::failbit; return; } if (__ct.narrow(*__b, 0) != '%') __err |= ios_base::failbit; else if(++__b == __e) __err |= ios_base::eofbit; } template <class _CharT, class _InputIterator> _InputIterator time_get<_CharT, _InputIterator>::get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm, const char_type* __fmtb, const char_type* __fmte) const { const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc()); __err = ios_base::goodbit; while (__fmtb != __fmte && __err == ios_base::goodbit) { if (__b == __e) { __err = ios_base::failbit; break; } if (__ct.narrow(*__fmtb, 0) == '%') { if (++__fmtb == __fmte) { __err = ios_base::failbit; break; } char __cmd = __ct.narrow(*__fmtb, 0); char __opt = '\0'; if (__cmd == 'E' || __cmd == '0') { if (++__fmtb == __fmte) { __err = ios_base::failbit; break; } __opt = __cmd; __cmd = __ct.narrow(*__fmtb, 0); } __b = do_get(__b, __e, __iob, __err, __tm, __cmd, __opt); ++__fmtb; } else if (__ct.is(ctype_base::space, *__fmtb)) { for (++__fmtb; __fmtb != __fmte && __ct.is(ctype_base::space, *__fmtb); ++__fmtb) ; for ( ; __b != __e && __ct.is(ctype_base::space, *__b); ++__b) ; } else if (__ct.toupper(*__b) == __ct.toupper(*__fmtb)) { ++__b; ++__fmtb; } else __err = ios_base::failbit; } if (__b == __e) __err |= ios_base::eofbit; return __b; } template <class _CharT, class _InputIterator> typename time_get<_CharT, _InputIterator>::dateorder time_get<_CharT, _InputIterator>::do_date_order() const { return mdy; } template <class _CharT, class _InputIterator> _InputIterator time_get<_CharT, _InputIterator>::do_get_time(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const { const char_type __fmt[] = {'%', 'H', ':', '%', 'M', ':', '%', 'S'}; return get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0])); } template <class _CharT, class _InputIterator> _InputIterator time_get<_CharT, _InputIterator>::do_get_date(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const { const string_type& __fmt = this->__x(); return get(__b, __e, __iob, __err, __tm, __fmt.data(), __fmt.data() + __fmt.size()); } template <class _CharT, class _InputIterator> _InputIterator time_get<_CharT, _InputIterator>::do_get_weekday(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const { const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc()); __get_weekdayname(__tm->tm_wday, __b, __e, __err, __ct); return __b; } template <class _CharT, class _InputIterator> _InputIterator time_get<_CharT, _InputIterator>::do_get_monthname(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const { const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc()); __get_monthname(__tm->tm_mon, __b, __e, __err, __ct); return __b; } template <class _CharT, class _InputIterator> _InputIterator time_get<_CharT, _InputIterator>::do_get_year(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm) const { const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc()); __get_year(__tm->tm_year, __b, __e, __err, __ct); return __b; } template <class _CharT, class _InputIterator> _InputIterator time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, ios_base& __iob, ios_base::iostate& __err, tm* __tm, char __fmt, char) const { __err = ios_base::goodbit; const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc()); switch (__fmt) { case 'a': case 'A': __get_weekdayname(__tm->tm_wday, __b, __e, __err, __ct); break; case 'b': case 'B': case 'h': __get_monthname(__tm->tm_mon, __b, __e, __err, __ct); break; case 'c': { const string_type& __fm = this->__c(); __b = get(__b, __e, __iob, __err, __tm, __fm.data(), __fm.data() + __fm.size()); } break; case 'd': case 'e': __get_day(__tm->tm_mday, __b, __e, __err, __ct); break; case 'D': { const char_type __fm[] = {'%', 'm', '/', '%', 'd', '/', '%', 'y'}; __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0])); } break; case 'F': { const char_type __fm[] = {'%', 'Y', '-', '%', 'm', '-', '%', 'd'}; __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0])); } break; case 'H': __get_hour(__tm->tm_hour, __b, __e, __err, __ct); break; case 'I': __get_12_hour(__tm->tm_hour, __b, __e, __err, __ct); break; case 'j': __get_day_year_num(__tm->tm_yday, __b, __e, __err, __ct); break; case 'm': __get_month(__tm->tm_mon, __b, __e, __err, __ct); break; case 'M': __get_minute(__tm->tm_min, __b, __e, __err, __ct); break; case 'n': case 't': __get_white_space(__b, __e, __err, __ct); break; case 'p': __get_am_pm(__tm->tm_hour, __b, __e, __err, __ct); break; case 'r': { const char_type __fm[] = {'%', 'I', ':', '%', 'M', ':', '%', 'S', ' ', '%', 'p'}; __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0])); } break; case 'R': { const char_type __fm[] = {'%', 'H', ':', '%', 'M'}; __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0])); } break; case 'S': __get_second(__tm->tm_sec, __b, __e, __err, __ct); break; case 'T': { const char_type __fm[] = {'%', 'H', ':', '%', 'M', ':', '%', 'S'}; __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0])); } break; case 'w': __get_weekday(__tm->tm_wday, __b, __e, __err, __ct); break; case 'x': return do_get_date(__b, __e, __iob, __err, __tm); case 'X': { const string_type& __fm = this->__X(); __b = get(__b, __e, __iob, __err, __tm, __fm.data(), __fm.data() + __fm.size()); } break; case 'y': __get_year(__tm->tm_year, __b, __e, __err, __ct); break; case 'Y': __get_year4(__tm->tm_year, __b, __e, __err, __ct); break; case '%': __get_percent(__b, __e, __err, __ct); break; default: __err |= ios_base::failbit; } return __b; } extern template class time_get<char>; extern template class time_get<wchar_t>; class __time_get { protected: locale_t __loc_; __time_get(const char* __nm); __time_get(const string& __nm); ~__time_get(); }; template <class _CharT> class __time_get_storage : public __time_get { protected: typedef basic_string<_CharT> string_type; string_type __weeks_[14]; string_type __months_[24]; string_type __am_pm_[2]; string_type __c_; string_type __r_; string_type __x_; string_type __X_; explicit __time_get_storage(const char* __nm); explicit __time_get_storage(const string& __nm); __attribute__ ((__exclude_from_explicit_instantiation__)) ~__time_get_storage() {} time_base::dateorder __do_date_order() const; private: void init(const ctype<_CharT>&); string_type __analyze(char __fmt, const ctype<_CharT>&); }; template <> time_base::dateorder __time_get_storage<char>::__do_date_order() const; template <> __time_get_storage<char>::__time_get_storage(const char*); template <> __time_get_storage<char>::__time_get_storage(const string&); template <> void __time_get_storage<char>::init(const ctype<char>&); template <> __time_get_storage<char>::string_type __time_get_storage<char>::__analyze(char, const ctype<char>&); extern template time_base::dateorder __time_get_storage<char>::__do_date_order() const; extern template __time_get_storage<char>::__time_get_storage(const char*); extern template __time_get_storage<char>::__time_get_storage(const string&); extern template void __time_get_storage<char>::init(const ctype<char>&); extern template __time_get_storage<char>::string_type __time_get_storage<char>::__analyze(char, const ctype<char>&); template <> time_base::dateorder __time_get_storage<wchar_t>::__do_date_order() const; template <> __time_get_storage<wchar_t>::__time_get_storage(const char*); template <> __time_get_storage<wchar_t>::__time_get_storage(const string&); template <> void __time_get_storage<wchar_t>::init(const ctype<wchar_t>&); template <> __time_get_storage<wchar_t>::string_type __time_get_storage<wchar_t>::__analyze(char, const ctype<wchar_t>&); extern template time_base::dateorder __time_get_storage<wchar_t>::__do_date_order() const; extern template __time_get_storage<wchar_t>::__time_get_storage(const char*); extern template __time_get_storage<wchar_t>::__time_get_storage(const string&); extern template void __time_get_storage<wchar_t>::init(const ctype<wchar_t>&); extern template __time_get_storage<wchar_t>::string_type __time_get_storage<wchar_t>::__analyze(char, const ctype<wchar_t>&); template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> > class time_get_byname : public time_get<_CharT, _InputIterator>, private __time_get_storage<_CharT> { public: typedef time_base::dateorder dateorder; typedef _InputIterator iter_type; typedef _CharT char_type; typedef basic_string<char_type> string_type; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit time_get_byname(const char* __nm, size_t __refs = 0) : time_get<_CharT, _InputIterator>(__refs), __time_get_storage<_CharT>(__nm) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit time_get_byname(const string& __nm, size_t __refs = 0) : time_get<_CharT, _InputIterator>(__refs), __time_get_storage<_CharT>(__nm) {} protected: __attribute__ ((__exclude_from_explicit_instantiation__)) ~time_get_byname() {} __attribute__ ((__exclude_from_explicit_instantiation__)) virtual dateorder do_date_order() const {return this->__do_date_order();} private: __attribute__ ((__exclude_from_explicit_instantiation__)) virtual const string_type* __weeks() const {return this->__weeks_;} __attribute__ ((__exclude_from_explicit_instantiation__)) virtual const string_type* __months() const {return this->__months_;} __attribute__ ((__exclude_from_explicit_instantiation__)) virtual const string_type* __am_pm() const {return this->__am_pm_;} __attribute__ ((__exclude_from_explicit_instantiation__)) virtual const string_type& __c() const {return this->__c_;} __attribute__ ((__exclude_from_explicit_instantiation__)) virtual const string_type& __r() const {return this->__r_;} __attribute__ ((__exclude_from_explicit_instantiation__)) virtual const string_type& __x() const {return this->__x_;} __attribute__ ((__exclude_from_explicit_instantiation__)) virtual const string_type& __X() const {return this->__X_;} }; extern template class time_get_byname<char>; extern template class time_get_byname<wchar_t>; class __time_put { locale_t __loc_; protected: __attribute__ ((__exclude_from_explicit_instantiation__)) __time_put() : __loc_(__cloc()) {} __time_put(const char* __nm); __time_put(const string& __nm); ~__time_put(); void __do_put(char* __nb, char*& __ne, const tm* __tm, char __fmt, char __mod) const; void __do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm, char __fmt, char __mod) const; }; template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> > class time_put : public locale::facet, private __time_put { public: typedef _CharT char_type; typedef _OutputIterator iter_type; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit time_put(size_t __refs = 0) : locale::facet(__refs) {} iter_type put(iter_type __s, ios_base& __iob, char_type __fl, const tm* __tm, const char_type* __pb, const char_type* __pe) const; __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type put(iter_type __s, ios_base& __iob, char_type __fl, const tm* __tm, char __fmt, char __mod = 0) const { return do_put(__s, __iob, __fl, __tm, __fmt, __mod); } static locale::id id; protected: __attribute__ ((__exclude_from_explicit_instantiation__)) ~time_put() {} virtual iter_type do_put(iter_type __s, ios_base&, char_type, const tm* __tm, char __fmt, char __mod) const; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit time_put(const char* __nm, size_t __refs) : locale::facet(__refs), __time_put(__nm) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit time_put(const string& __nm, size_t __refs) : locale::facet(__refs), __time_put(__nm) {} }; template <class _CharT, class _OutputIterator> locale::id time_put<_CharT, _OutputIterator>::id; template <class _CharT, class _OutputIterator> _OutputIterator time_put<_CharT, _OutputIterator>::put(iter_type __s, ios_base& __iob, char_type __fl, const tm* __tm, const char_type* __pb, const char_type* __pe) const { const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc()); for (; __pb != __pe; ++__pb) { if (__ct.narrow(*__pb, 0) == '%') { if (++__pb == __pe) { *__s++ = __pb[-1]; break; } char __mod = 0; char __fmt = __ct.narrow(*__pb, 0); if (__fmt == 'E' || __fmt == 'O') { if (++__pb == __pe) { *__s++ = __pb[-2]; *__s++ = __pb[-1]; break; } __mod = __fmt; __fmt = __ct.narrow(*__pb, 0); } __s = do_put(__s, __iob, __fl, __tm, __fmt, __mod); } else *__s++ = *__pb; } return __s; } template <class _CharT, class _OutputIterator> _OutputIterator time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base&, char_type, const tm* __tm, char __fmt, char __mod) const { char_type __nar[100]; char_type* __nb = __nar; char_type* __ne = __nb + 100; __do_put(__nb, __ne, __tm, __fmt, __mod); return std::__1::copy(__nb, __ne, __s); } extern template class time_put<char>; extern template class time_put<wchar_t>; template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> > class time_put_byname : public time_put<_CharT, _OutputIterator> { public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit time_put_byname(const char* __nm, size_t __refs = 0) : time_put<_CharT, _OutputIterator>(__nm, __refs) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit time_put_byname(const string& __nm, size_t __refs = 0) : time_put<_CharT, _OutputIterator>(__nm, __refs) {} protected: __attribute__ ((__exclude_from_explicit_instantiation__)) ~time_put_byname() {} }; extern template class time_put_byname<char>; extern template class time_put_byname<wchar_t>; class money_base { public: enum part {none, space, symbol, sign, value}; struct pattern {char field[4];}; __attribute__ ((__exclude_from_explicit_instantiation__)) money_base() {} }; template <class _CharT, bool _International = false> class moneypunct : public locale::facet, public money_base { public: typedef _CharT char_type; typedef basic_string<char_type> string_type; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit moneypunct(size_t __refs = 0) : locale::facet(__refs) {} __attribute__ ((__exclude_from_explicit_instantiation__)) char_type decimal_point() const {return do_decimal_point();} __attribute__ ((__exclude_from_explicit_instantiation__)) char_type thousands_sep() const {return do_thousands_sep();} __attribute__ ((__exclude_from_explicit_instantiation__)) string grouping() const {return do_grouping();} __attribute__ ((__exclude_from_explicit_instantiation__)) string_type curr_symbol() const {return do_curr_symbol();} __attribute__ ((__exclude_from_explicit_instantiation__)) string_type positive_sign() const {return do_positive_sign();} __attribute__ ((__exclude_from_explicit_instantiation__)) string_type negative_sign() const {return do_negative_sign();} __attribute__ ((__exclude_from_explicit_instantiation__)) int frac_digits() const {return do_frac_digits();} __attribute__ ((__exclude_from_explicit_instantiation__)) pattern pos_format() const {return do_pos_format();} __attribute__ ((__exclude_from_explicit_instantiation__)) pattern neg_format() const {return do_neg_format();} static locale::id id; static const bool intl = _International; protected: __attribute__ ((__exclude_from_explicit_instantiation__)) ~moneypunct() {} virtual char_type do_decimal_point() const {return numeric_limits<char_type>::max();} virtual char_type do_thousands_sep() const {return numeric_limits<char_type>::max();} virtual string do_grouping() const {return string();} virtual string_type do_curr_symbol() const {return string_type();} virtual string_type do_positive_sign() const {return string_type();} virtual string_type do_negative_sign() const {return string_type(1, '-');} virtual int do_frac_digits() const {return 0;} virtual pattern do_pos_format() const {pattern __p = {{symbol, sign, none, value}}; return __p;} virtual pattern do_neg_format() const {pattern __p = {{symbol, sign, none, value}}; return __p;} }; template <class _CharT, bool _International> locale::id moneypunct<_CharT, _International>::id; template <class _CharT, bool _International> const bool moneypunct<_CharT, _International>::intl; extern template class moneypunct<char, false>; extern template class moneypunct<char, true>; extern template class moneypunct<wchar_t, false>; extern template class moneypunct<wchar_t, true>; template <class _CharT, bool _International = false> class moneypunct_byname : public moneypunct<_CharT, _International> { public: typedef money_base::pattern pattern; typedef _CharT char_type; typedef basic_string<char_type> string_type; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit moneypunct_byname(const char* __nm, size_t __refs = 0) : moneypunct<_CharT, _International>(__refs) {init(__nm);} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit moneypunct_byname(const string& __nm, size_t __refs = 0) : moneypunct<_CharT, _International>(__refs) {init(__nm.c_str());} protected: __attribute__ ((__exclude_from_explicit_instantiation__)) ~moneypunct_byname() {} virtual char_type do_decimal_point() const {return __decimal_point_;} virtual char_type do_thousands_sep() const {return __thousands_sep_;} virtual string do_grouping() const {return __grouping_;} virtual string_type do_curr_symbol() const {return __curr_symbol_;} virtual string_type do_positive_sign() const {return __positive_sign_;} virtual string_type do_negative_sign() const {return __negative_sign_;} virtual int do_frac_digits() const {return __frac_digits_;} virtual pattern do_pos_format() const {return __pos_format_;} virtual pattern do_neg_format() const {return __neg_format_;} private: char_type __decimal_point_; char_type __thousands_sep_; string __grouping_; string_type __curr_symbol_; string_type __positive_sign_; string_type __negative_sign_; int __frac_digits_; pattern __pos_format_; pattern __neg_format_; void init(const char*); }; template<> void moneypunct_byname<char, false>::init(const char*); template<> void moneypunct_byname<char, true>::init(const char*); template<> void moneypunct_byname<wchar_t, false>::init(const char*); template<> void moneypunct_byname<wchar_t, true>::init(const char*); extern template class moneypunct_byname<char, false>; extern template class moneypunct_byname<char, true>; extern template class moneypunct_byname<wchar_t, false>; extern template class moneypunct_byname<wchar_t, true>; template <class _CharT> class __money_get { protected: typedef _CharT char_type; typedef basic_string<char_type> string_type; __attribute__ ((__exclude_from_explicit_instantiation__)) __money_get() {} static void __gather_info(bool __intl, const locale& __loc, money_base::pattern& __pat, char_type& __dp, char_type& __ts, string& __grp, string_type& __sym, string_type& __psn, string_type& __nsn, int& __fd); }; template <class _CharT> void __money_get<_CharT>::__gather_info(bool __intl, const locale& __loc, money_base::pattern& __pat, char_type& __dp, char_type& __ts, string& __grp, string_type& __sym, string_type& __psn, string_type& __nsn, int& __fd) { if (__intl) { const moneypunct<char_type, true>& __mp = use_facet<moneypunct<char_type, true> >(__loc); __pat = __mp.neg_format(); __nsn = __mp.negative_sign(); __psn = __mp.positive_sign(); __dp = __mp.decimal_point(); __ts = __mp.thousands_sep(); __grp = __mp.grouping(); __sym = __mp.curr_symbol(); __fd = __mp.frac_digits(); } else { const moneypunct<char_type, false>& __mp = use_facet<moneypunct<char_type, false> >(__loc); __pat = __mp.neg_format(); __nsn = __mp.negative_sign(); __psn = __mp.positive_sign(); __dp = __mp.decimal_point(); __ts = __mp.thousands_sep(); __grp = __mp.grouping(); __sym = __mp.curr_symbol(); __fd = __mp.frac_digits(); } } extern template class __money_get<char>; extern template class __money_get<wchar_t>; template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> > class money_get : public locale::facet, private __money_get<_CharT> { public: typedef _CharT char_type; typedef _InputIterator iter_type; typedef basic_string<char_type> string_type; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit money_get(size_t __refs = 0) : locale::facet(__refs) {} __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type get(iter_type __b, iter_type __e, bool __intl, ios_base& __iob, ios_base::iostate& __err, long double& __v) const { return do_get(__b, __e, __intl, __iob, __err, __v); } __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type get(iter_type __b, iter_type __e, bool __intl, ios_base& __iob, ios_base::iostate& __err, string_type& __v) const { return do_get(__b, __e, __intl, __iob, __err, __v); } static locale::id id; protected: __attribute__ ((__exclude_from_explicit_instantiation__)) ~money_get() {} virtual iter_type do_get(iter_type __b, iter_type __e, bool __intl, ios_base& __iob, ios_base::iostate& __err, long double& __v) const; virtual iter_type do_get(iter_type __b, iter_type __e, bool __intl, ios_base& __iob, ios_base::iostate& __err, string_type& __v) const; private: static bool __do_get(iter_type& __b, iter_type __e, bool __intl, const locale& __loc, ios_base::fmtflags __flags, ios_base::iostate& __err, bool& __neg, const ctype<char_type>& __ct, unique_ptr<char_type, void(*)(void*)>& __wb, char_type*& __wn, char_type* __we); }; template <class _CharT, class _InputIterator> locale::id money_get<_CharT, _InputIterator>::id; void __do_nothing(void*); template <class _Tp> void __double_or_nothing(unique_ptr<_Tp, void(*)(void*)>& __b, _Tp*& __n, _Tp*& __e) { bool __owns = __b.get_deleter() != __do_nothing; size_t __cur_cap = static_cast<size_t>(__e-__b.get()) * sizeof(_Tp); size_t __new_cap = __cur_cap < numeric_limits<size_t>::max() / 2 ? 2 * __cur_cap : numeric_limits<size_t>::max(); if (__new_cap == 0) __new_cap = sizeof(_Tp); size_t __n_off = static_cast<size_t>(__n - __b.get()); _Tp* __t = (_Tp*)realloc(__owns ? __b.get() : 0, __new_cap); if (__t == 0) __throw_bad_alloc(); if (__owns) __b.release(); __b = unique_ptr<_Tp, void(*)(void*)>(__t, free); __new_cap /= sizeof(_Tp); __n = __b.get() + __n_off; __e = __b.get() + __new_cap; } template <class _CharT, class _InputIterator> bool money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e, bool __intl, const locale& __loc, ios_base::fmtflags __flags, ios_base::iostate& __err, bool& __neg, const ctype<char_type>& __ct, unique_ptr<char_type, void(*)(void*)>& __wb, char_type*& __wn, char_type* __we) { const unsigned __bz = 100; unsigned __gbuf[__bz]; unique_ptr<unsigned, void(*)(void*)> __gb(__gbuf, __do_nothing); unsigned* __gn = __gb.get(); unsigned* __ge = __gn + __bz; money_base::pattern __pat; char_type __dp; char_type __ts; string __grp; string_type __sym; string_type __psn; string_type __nsn; string_type __spaces; int __fd; __money_get<_CharT>::__gather_info(__intl, __loc, __pat, __dp, __ts, __grp, __sym, __psn, __nsn, __fd); const string_type* __trailing_sign = 0; __wn = __wb.get(); for (unsigned __p = 0; __p < 4 && __b != __e; ++__p) { switch (__pat.field[__p]) { case money_base::space: if (__p != 3) { if (__ct.is(ctype_base::space, *__b)) __spaces.push_back(*__b++); else { __err |= ios_base::failbit; return false; } } [[clang::fallthrough]]; case money_base::none: if (__p != 3) { while (__b != __e && __ct.is(ctype_base::space, *__b)) __spaces.push_back(*__b++); } break; case money_base::sign: if (__psn.size() + __nsn.size() > 0) { if (__psn.size() == 0 || __nsn.size() == 0) { if (__psn.size() > 0) { if (*__b == __psn[0]) { ++__b; if (__psn.size() > 1) __trailing_sign = &__psn; } else __neg = true; } else if (*__b == __nsn[0]) { ++__b; __neg = true; if (__nsn.size() > 1) __trailing_sign = &__nsn; } } else { if (*__b == __psn[0]) { ++__b; if (__psn.size() > 1) __trailing_sign = &__psn; } else if (*__b == __nsn[0]) { ++__b; __neg = true; if (__nsn.size() > 1) __trailing_sign = &__nsn; } else { __err |= ios_base::failbit; return false; } } } break; case money_base::symbol: { bool __more_needed = __trailing_sign || (__p < 2) || (__p == 2 && __pat.field[3] != static_cast<char>(money_base::none)); bool __sb = (__flags & ios_base::showbase) != 0; if (__sb || __more_needed) { typename string_type::const_iterator __sym_space_end = __sym.begin(); if (__p > 0 && (__pat.field[__p - 1] == money_base::none || __pat.field[__p - 1] == money_base::space)) { while (__sym_space_end != __sym.end() && __ct.is(ctype_base::space, *__sym_space_end)) ++__sym_space_end; const size_t __num_spaces = __sym_space_end - __sym.begin(); if (__num_spaces > __spaces.size() || !equal(__spaces.end() - __num_spaces, __spaces.end(), __sym.begin())) { __sym_space_end = __sym.begin(); } } typename string_type::const_iterator __sym_curr_char = __sym_space_end; while (__sym_curr_char != __sym.end() && __b != __e && *__b == *__sym_curr_char) { ++__b; ++__sym_curr_char; } if (__sb && __sym_curr_char != __sym.end()) { __err |= ios_base::failbit; return false; } } } break; case money_base::value: { unsigned __ng = 0; for (; __b != __e; ++__b) { char_type __c = *__b; if (__ct.is(ctype_base::digit, __c)) { if (__wn == __we) __double_or_nothing(__wb, __wn, __we); *__wn++ = __c; ++__ng; } else if (__grp.size() > 0 && __ng > 0 && __c == __ts) { if (__gn == __ge) __double_or_nothing(__gb, __gn, __ge); *__gn++ = __ng; __ng = 0; } else break; } if (__gb.get() != __gn && __ng > 0) { if (__gn == __ge) __double_or_nothing(__gb, __gn, __ge); *__gn++ = __ng; } if (__fd > 0) { if (__b == __e || *__b != __dp) { __err |= ios_base::failbit; return false; } for (++__b; __fd > 0; --__fd, ++__b) { if (__b == __e || !__ct.is(ctype_base::digit, *__b)) { __err |= ios_base::failbit; return false; } if (__wn == __we) __double_or_nothing(__wb, __wn, __we); *__wn++ = *__b; } } if (__wn == __wb.get()) { __err |= ios_base::failbit; return false; } } break; } } if (__trailing_sign) { for (unsigned __i = 1; __i < __trailing_sign->size(); ++__i, ++__b) { if (__b == __e || *__b != (*__trailing_sign)[__i]) { __err |= ios_base::failbit; return false; } } } if (__gb.get() != __gn) { ios_base::iostate __et = ios_base::goodbit; __check_grouping(__grp, __gb.get(), __gn, __et); if (__et) { __err |= ios_base::failbit; return false; } } return true; } template <class _CharT, class _InputIterator> _InputIterator money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, bool __intl, ios_base& __iob, ios_base::iostate& __err, long double& __v) const { const int __bz = 100; char_type __wbuf[__bz]; unique_ptr<char_type, void(*)(void*)> __wb(__wbuf, __do_nothing); char_type* __wn; char_type* __we = __wbuf + __bz; locale __loc = __iob.getloc(); const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__loc); bool __neg = false; if (__do_get(__b, __e, __intl, __loc, __iob.flags(), __err, __neg, __ct, __wb, __wn, __we)) { const char __src[] = "0123456789"; char_type __atoms[sizeof(__src)-1]; __ct.widen(__src, __src + (sizeof(__src)-1), __atoms); char __nbuf[__bz]; char* __nc = __nbuf; unique_ptr<char, void(*)(void*)> __h(0, free); if (__wn - __wb.get() > __bz-2) { __h.reset((char*)malloc(static_cast<size_t>(__wn - __wb.get() + 2))); if (__h.get() == 0) __throw_bad_alloc(); __nc = __h.get(); } if (__neg) *__nc++ = '-'; for (const char_type* __w = __wb.get(); __w < __wn; ++__w, ++__nc) *__nc = __src[find(__atoms, std::__1::end(__atoms), *__w) - __atoms]; *__nc = char(); if (sscanf(__nbuf, "%Lf", &__v) != 1) __throw_runtime_error("money_get error"); } if (__b == __e) __err |= ios_base::eofbit; return __b; } template <class _CharT, class _InputIterator> _InputIterator money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, bool __intl, ios_base& __iob, ios_base::iostate& __err, string_type& __v) const { const int __bz = 100; char_type __wbuf[__bz]; unique_ptr<char_type, void(*)(void*)> __wb(__wbuf, __do_nothing); char_type* __wn; char_type* __we = __wbuf + __bz; locale __loc = __iob.getloc(); const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__loc); bool __neg = false; if (__do_get(__b, __e, __intl, __loc, __iob.flags(), __err, __neg, __ct, __wb, __wn, __we)) { __v.clear(); if (__neg) __v.push_back(__ct.widen('-')); char_type __z = __ct.widen('0'); char_type* __w; for (__w = __wb.get(); __w < __wn-1; ++__w) if (*__w != __z) break; __v.append(__w, __wn); } if (__b == __e) __err |= ios_base::eofbit; return __b; } extern template class money_get<char>; extern template class money_get<wchar_t>; template <class _CharT> class __money_put { protected: typedef _CharT char_type; typedef basic_string<char_type> string_type; __attribute__ ((__exclude_from_explicit_instantiation__)) __money_put() {} static void __gather_info(bool __intl, bool __neg, const locale& __loc, money_base::pattern& __pat, char_type& __dp, char_type& __ts, string& __grp, string_type& __sym, string_type& __sn, int& __fd); static void __format(char_type* __mb, char_type*& __mi, char_type*& __me, ios_base::fmtflags __flags, const char_type* __db, const char_type* __de, const ctype<char_type>& __ct, bool __neg, const money_base::pattern& __pat, char_type __dp, char_type __ts, const string& __grp, const string_type& __sym, const string_type& __sn, int __fd); }; template <class _CharT> void __money_put<_CharT>::__gather_info(bool __intl, bool __neg, const locale& __loc, money_base::pattern& __pat, char_type& __dp, char_type& __ts, string& __grp, string_type& __sym, string_type& __sn, int& __fd) { if (__intl) { const moneypunct<char_type, true>& __mp = use_facet<moneypunct<char_type, true> >(__loc); if (__neg) { __pat = __mp.neg_format(); __sn = __mp.negative_sign(); } else { __pat = __mp.pos_format(); __sn = __mp.positive_sign(); } __dp = __mp.decimal_point(); __ts = __mp.thousands_sep(); __grp = __mp.grouping(); __sym = __mp.curr_symbol(); __fd = __mp.frac_digits(); } else { const moneypunct<char_type, false>& __mp = use_facet<moneypunct<char_type, false> >(__loc); if (__neg) { __pat = __mp.neg_format(); __sn = __mp.negative_sign(); } else { __pat = __mp.pos_format(); __sn = __mp.positive_sign(); } __dp = __mp.decimal_point(); __ts = __mp.thousands_sep(); __grp = __mp.grouping(); __sym = __mp.curr_symbol(); __fd = __mp.frac_digits(); } } template <class _CharT> void __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __me, ios_base::fmtflags __flags, const char_type* __db, const char_type* __de, const ctype<char_type>& __ct, bool __neg, const money_base::pattern& __pat, char_type __dp, char_type __ts, const string& __grp, const string_type& __sym, const string_type& __sn, int __fd) { __me = __mb; for (unsigned __p = 0; __p < 4; ++__p) { switch (__pat.field[__p]) { case money_base::none: __mi = __me; break; case money_base::space: __mi = __me; *__me++ = __ct.widen(' '); break; case money_base::sign: if (!__sn.empty()) *__me++ = __sn[0]; break; case money_base::symbol: if (!__sym.empty() && (__flags & ios_base::showbase)) __me = std::__1::copy(__sym.begin(), __sym.end(), __me); break; case money_base::value: { char_type* __t = __me; if (__neg) ++__db; const char_type* __d; for (__d = __db; __d < __de; ++__d) if (!__ct.is(ctype_base::digit, *__d)) break; if (__fd > 0) { int __f; for (__f = __fd; __d > __db && __f > 0; --__f) *__me++ = *--__d; char_type __z = __f > 0 ? __ct.widen('0') : char_type(); for (; __f > 0; --__f) *__me++ = __z; *__me++ = __dp; } if (__d == __db) { *__me++ = __ct.widen('0'); } else { unsigned __ng = 0; unsigned __ig = 0; unsigned __gl = __grp.empty() ? numeric_limits<unsigned>::max() : static_cast<unsigned>(__grp[__ig]); while (__d != __db) { if (__ng == __gl) { *__me++ = __ts; __ng = 0; if (++__ig < __grp.size()) __gl = __grp[__ig] == numeric_limits<char>::max() ? numeric_limits<unsigned>::max() : static_cast<unsigned>(__grp[__ig]); } *__me++ = *--__d; ++__ng; } } reverse(__t, __me); } break; } } if (__sn.size() > 1) __me = std::__1::copy(__sn.begin()+1, __sn.end(), __me); if ((__flags & ios_base::adjustfield) == ios_base::left) __mi = __me; else if ((__flags & ios_base::adjustfield) != ios_base::internal) __mi = __mb; } extern template class __money_put<char>; extern template class __money_put<wchar_t>; template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> > class money_put : public locale::facet, private __money_put<_CharT> { public: typedef _CharT char_type; typedef _OutputIterator iter_type; typedef basic_string<char_type> string_type; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit money_put(size_t __refs = 0) : locale::facet(__refs) {} __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type put(iter_type __s, bool __intl, ios_base& __iob, char_type __fl, long double __units) const { return do_put(__s, __intl, __iob, __fl, __units); } __attribute__ ((__exclude_from_explicit_instantiation__)) iter_type put(iter_type __s, bool __intl, ios_base& __iob, char_type __fl, const string_type& __digits) const { return do_put(__s, __intl, __iob, __fl, __digits); } static locale::id id; protected: __attribute__ ((__exclude_from_explicit_instantiation__)) ~money_put() {} virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __iob, char_type __fl, long double __units) const; virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __iob, char_type __fl, const string_type& __digits) const; }; template <class _CharT, class _OutputIterator> locale::id money_put<_CharT, _OutputIterator>::id; template <class _CharT, class _OutputIterator> _OutputIterator money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl, ios_base& __iob, char_type __fl, long double __units) const { const size_t __bs = 100; char __buf[__bs]; char* __bb = __buf; char_type __digits[__bs]; char_type* __db = __digits; size_t __n = static_cast<size_t>(snprintf(__bb, __bs, "%.0Lf", __units)); unique_ptr<char, void(*)(void*)> __hn(0, free); unique_ptr<char_type, void(*)(void*)> __hd(0, free); if (__n > __bs-1) { __n = static_cast<size_t>(asprintf_l(&__bb, __cloc(), "%.0Lf", __units)); if (__bb == 0) __throw_bad_alloc(); __hn.reset(__bb); __hd.reset((char_type*)malloc(__n * sizeof(char_type))); if (__hd == nullptr) __throw_bad_alloc(); __db = __hd.get(); } locale __loc = __iob.getloc(); const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__loc); __ct.widen(__bb, __bb + __n, __db); bool __neg = __n > 0 && __bb[0] == '-'; money_base::pattern __pat; char_type __dp; char_type __ts; string __grp; string_type __sym; string_type __sn; int __fd; this->__gather_info(__intl, __neg, __loc, __pat, __dp, __ts, __grp, __sym, __sn, __fd); char_type __mbuf[__bs]; char_type* __mb = __mbuf; unique_ptr<char_type, void(*)(void*)> __hw(0, free); size_t __exn = static_cast<int>(__n) > __fd ? (__n - static_cast<size_t>(__fd)) * 2 + __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 1 : __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 2; if (__exn > __bs) { __hw.reset((char_type*)malloc(__exn * sizeof(char_type))); __mb = __hw.get(); if (__mb == 0) __throw_bad_alloc(); } char_type* __mi; char_type* __me; this->__format(__mb, __mi, __me, __iob.flags(), __db, __db + __n, __ct, __neg, __pat, __dp, __ts, __grp, __sym, __sn, __fd); return __pad_and_output(__s, __mb, __mi, __me, __iob, __fl); } template <class _CharT, class _OutputIterator> _OutputIterator money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl, ios_base& __iob, char_type __fl, const string_type& __digits) const { locale __loc = __iob.getloc(); const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__loc); bool __neg = __digits.size() > 0 && __digits[0] == __ct.widen('-'); money_base::pattern __pat; char_type __dp; char_type __ts; string __grp; string_type __sym; string_type __sn; int __fd; this->__gather_info(__intl, __neg, __loc, __pat, __dp, __ts, __grp, __sym, __sn, __fd); char_type __mbuf[100]; char_type* __mb = __mbuf; unique_ptr<char_type, void(*)(void*)> __h(0, free); size_t __exn = static_cast<int>(__digits.size()) > __fd ? (__digits.size() - static_cast<size_t>(__fd)) * 2 + __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 1 : __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 2; if (__exn > 100) { __h.reset((char_type*)malloc(__exn * sizeof(char_type))); __mb = __h.get(); if (__mb == 0) __throw_bad_alloc(); } char_type* __mi; char_type* __me; this->__format(__mb, __mi, __me, __iob.flags(), __digits.data(), __digits.data() + __digits.size(), __ct, __neg, __pat, __dp, __ts, __grp, __sym, __sn, __fd); return __pad_and_output(__s, __mb, __mi, __me, __iob, __fl); } extern template class money_put<char>; extern template class money_put<wchar_t>; class messages_base { public: typedef ptrdiff_t catalog; __attribute__ ((__exclude_from_explicit_instantiation__)) messages_base() {} }; template <class _CharT> class messages : public locale::facet, public messages_base { public: typedef _CharT char_type; typedef basic_string<_CharT> string_type; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit messages(size_t __refs = 0) : locale::facet(__refs) {} __attribute__ ((__exclude_from_explicit_instantiation__)) catalog open(const basic_string<char>& __nm, const locale& __loc) const { return do_open(__nm, __loc); } __attribute__ ((__exclude_from_explicit_instantiation__)) string_type get(catalog __c, int __set, int __msgid, const string_type& __dflt) const { return do_get(__c, __set, __msgid, __dflt); } __attribute__ ((__exclude_from_explicit_instantiation__)) void close(catalog __c) const { do_close(__c); } static locale::id id; protected: __attribute__ ((__exclude_from_explicit_instantiation__)) ~messages() {} virtual catalog do_open(const basic_string<char>&, const locale&) const; virtual string_type do_get(catalog, int __set, int __msgid, const string_type& __dflt) const; virtual void do_close(catalog) const; }; template <class _CharT> locale::id messages<_CharT>::id; template <class _CharT> typename messages<_CharT>::catalog messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const { ((void)(__nm)); return -1; } template <class _CharT> typename messages<_CharT>::string_type messages<_CharT>::do_get(catalog __c, int __set, int __msgid, const string_type& __dflt) const { ((void)(__c)); ((void)(__set)); ((void)(__msgid)); return __dflt; } template <class _CharT> void messages<_CharT>::do_close(catalog __c) const { ((void)(__c)); } extern template class messages<char>; extern template class messages<wchar_t>; template <class _CharT> class messages_byname : public messages<_CharT> { public: typedef messages_base::catalog catalog; typedef basic_string<_CharT> string_type; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit messages_byname(const char*, size_t __refs = 0) : messages<_CharT>(__refs) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit messages_byname(const string&, size_t __refs = 0) : messages<_CharT>(__refs) {} protected: __attribute__ ((__exclude_from_explicit_instantiation__)) ~messages_byname() {} }; extern template class messages_byname<char>; extern template class messages_byname<wchar_t>; template<class _Codecvt, class _Elem = wchar_t, class _Wide_alloc = allocator<_Elem>, class _Byte_alloc = allocator<char> > class wstring_convert { public: typedef basic_string<char, char_traits<char>, _Byte_alloc> byte_string; typedef basic_string<_Elem, char_traits<_Elem>, _Wide_alloc> wide_string; typedef typename _Codecvt::state_type state_type; typedef typename wide_string::traits_type::int_type int_type; private: byte_string __byte_err_string_; wide_string __wide_err_string_; _Codecvt* __cvtptr_; state_type __cvtstate_; size_t __cvtcount_; wstring_convert(const wstring_convert& __wc); wstring_convert& operator=(const wstring_convert& __wc); public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit wstring_convert(_Codecvt* __pcvt = new _Codecvt); __attribute__ ((__exclude_from_explicit_instantiation__)) wstring_convert(_Codecvt* __pcvt, state_type __state); explicit wstring_convert(const byte_string& __byte_err, const wide_string& __wide_err = wide_string()); __attribute__ ((__exclude_from_explicit_instantiation__)) wstring_convert(wstring_convert&& __wc); ~wstring_convert(); __attribute__ ((__exclude_from_explicit_instantiation__)) wide_string from_bytes(char __byte) {return from_bytes(&__byte, &__byte+1);} __attribute__ ((__exclude_from_explicit_instantiation__)) wide_string from_bytes(const char* __ptr) {return from_bytes(__ptr, __ptr + char_traits<char>::length(__ptr));} __attribute__ ((__exclude_from_explicit_instantiation__)) wide_string from_bytes(const byte_string& __str) {return from_bytes(__str.data(), __str.data() + __str.size());} wide_string from_bytes(const char* __first, const char* __last); __attribute__ ((__exclude_from_explicit_instantiation__)) byte_string to_bytes(_Elem __wchar) {return to_bytes(&__wchar, &__wchar+1);} __attribute__ ((__exclude_from_explicit_instantiation__)) byte_string to_bytes(const _Elem* __wptr) {return to_bytes(__wptr, __wptr + char_traits<_Elem>::length(__wptr));} __attribute__ ((__exclude_from_explicit_instantiation__)) byte_string to_bytes(const wide_string& __wstr) {return to_bytes(__wstr.data(), __wstr.data() + __wstr.size());} byte_string to_bytes(const _Elem* __first, const _Elem* __last); __attribute__ ((__exclude_from_explicit_instantiation__)) size_t converted() const noexcept {return __cvtcount_;} __attribute__ ((__exclude_from_explicit_instantiation__)) state_type state() const {return __cvtstate_;} }; template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc> inline wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: wstring_convert(_Codecvt* __pcvt) : __cvtptr_(__pcvt), __cvtstate_(), __cvtcount_(0) { } template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc> inline wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: wstring_convert(_Codecvt* __pcvt, state_type __state) : __cvtptr_(__pcvt), __cvtstate_(__state), __cvtcount_(0) { } template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc> wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: wstring_convert(const byte_string& __byte_err, const wide_string& __wide_err) : __byte_err_string_(__byte_err), __wide_err_string_(__wide_err), __cvtstate_(), __cvtcount_(0) { __cvtptr_ = new _Codecvt; } template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc> inline wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: wstring_convert(wstring_convert&& __wc) : __byte_err_string_(std::__1::move(__wc.__byte_err_string_)), __wide_err_string_(std::__1::move(__wc.__wide_err_string_)), __cvtptr_(__wc.__cvtptr_), __cvtstate_(__wc.__cvtstate_), __cvtcount_(__wc.__cvtcount_) { __wc.__cvtptr_ = nullptr; } template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc> wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::~wstring_convert() { delete __cvtptr_; } template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc> typename wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::wide_string wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: from_bytes(const char* __frm, const char* __frm_end) { __cvtcount_ = 0; if (__cvtptr_ != nullptr) { wide_string __ws(2*(__frm_end - __frm), _Elem()); if (__frm != __frm_end) __ws.resize(__ws.capacity()); codecvt_base::result __r = codecvt_base::ok; state_type __st = __cvtstate_; if (__frm != __frm_end) { _Elem* __to = &__ws[0]; _Elem* __to_end = __to + __ws.size(); const char* __frm_nxt; do { _Elem* __to_nxt; __r = __cvtptr_->in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); __cvtcount_ += __frm_nxt - __frm; if (__frm_nxt == __frm) { __r = codecvt_base::error; } else if (__r == codecvt_base::noconv) { __ws.resize(__to - &__ws[0]); __ws.append((const _Elem*)__frm, (const _Elem*)__frm_end); __frm = __frm_nxt; __r = codecvt_base::ok; } else if (__r == codecvt_base::ok) { __ws.resize(__to_nxt - &__ws[0]); __frm = __frm_nxt; } else if (__r == codecvt_base::partial) { ptrdiff_t __s = __to_nxt - &__ws[0]; __ws.resize(2 * __s); __to = &__ws[0] + __s; __to_end = &__ws[0] + __ws.size(); __frm = __frm_nxt; } } while (__r == codecvt_base::partial && __frm_nxt < __frm_end); } if (__r == codecvt_base::ok) return __ws; } if (__wide_err_string_.empty()) __throw_range_error("wstring_convert: from_bytes error"); return __wide_err_string_; } template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc> typename wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::byte_string wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: to_bytes(const _Elem* __frm, const _Elem* __frm_end) { __cvtcount_ = 0; if (__cvtptr_ != nullptr) { byte_string __bs(2*(__frm_end - __frm), char()); if (__frm != __frm_end) __bs.resize(__bs.capacity()); codecvt_base::result __r = codecvt_base::ok; state_type __st = __cvtstate_; if (__frm != __frm_end) { char* __to = &__bs[0]; char* __to_end = __to + __bs.size(); const _Elem* __frm_nxt; do { char* __to_nxt; __r = __cvtptr_->out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt); __cvtcount_ += __frm_nxt - __frm; if (__frm_nxt == __frm) { __r = codecvt_base::error; } else if (__r == codecvt_base::noconv) { __bs.resize(__to - &__bs[0]); __bs.append((const char*)__frm, (const char*)__frm_end); __frm = __frm_nxt; __r = codecvt_base::ok; } else if (__r == codecvt_base::ok) { __bs.resize(__to_nxt - &__bs[0]); __frm = __frm_nxt; } else if (__r == codecvt_base::partial) { ptrdiff_t __s = __to_nxt - &__bs[0]; __bs.resize(2 * __s); __to = &__bs[0] + __s; __to_end = &__bs[0] + __bs.size(); __frm = __frm_nxt; } } while (__r == codecvt_base::partial && __frm_nxt < __frm_end); } if (__r == codecvt_base::ok) { size_t __s = __bs.size(); __bs.resize(__bs.capacity()); char* __to = &__bs[0] + __s; char* __to_end = __to + __bs.size(); do { char* __to_nxt; __r = __cvtptr_->unshift(__st, __to, __to_end, __to_nxt); if (__r == codecvt_base::noconv) { __bs.resize(__to - &__bs[0]); __r = codecvt_base::ok; } else if (__r == codecvt_base::ok) { __bs.resize(__to_nxt - &__bs[0]); } else if (__r == codecvt_base::partial) { ptrdiff_t __sp = __to_nxt - &__bs[0]; __bs.resize(2 * __sp); __to = &__bs[0] + __sp; __to_end = &__bs[0] + __bs.size(); } } while (__r == codecvt_base::partial); if (__r == codecvt_base::ok) return __bs; } } if (__byte_err_string_.empty()) __throw_range_error("wstring_convert: to_bytes error"); return __byte_err_string_; } template <class _Codecvt, class _Elem = wchar_t, class _Tr = char_traits<_Elem> > class wbuffer_convert : public basic_streambuf<_Elem, _Tr> { public: typedef _Elem char_type; typedef _Tr traits_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; typedef typename _Codecvt::state_type state_type; private: char* __extbuf_; const char* __extbufnext_; const char* __extbufend_; char __extbuf_min_[8]; size_t __ebs_; char_type* __intbuf_; size_t __ibs_; streambuf* __bufptr_; _Codecvt* __cv_; state_type __st_; ios_base::openmode __cm_; bool __owns_eb_; bool __owns_ib_; bool __always_noconv_; wbuffer_convert(const wbuffer_convert&); wbuffer_convert& operator=(const wbuffer_convert&); public: explicit wbuffer_convert(streambuf* __bytebuf = 0, _Codecvt* __pcvt = new _Codecvt, state_type __state = state_type()); ~wbuffer_convert(); __attribute__ ((__exclude_from_explicit_instantiation__)) streambuf* rdbuf() const {return __bufptr_;} __attribute__ ((__exclude_from_explicit_instantiation__)) streambuf* rdbuf(streambuf* __bytebuf) { streambuf* __r = __bufptr_; __bufptr_ = __bytebuf; return __r; } __attribute__ ((__exclude_from_explicit_instantiation__)) state_type state() const {return __st_;} protected: virtual int_type underflow(); virtual int_type pbackfail(int_type __c = traits_type::eof()); virtual int_type overflow (int_type __c = traits_type::eof()); virtual basic_streambuf<char_type, traits_type>* setbuf(char_type* __s, streamsize __n); virtual pos_type seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __wch = ios_base::in | ios_base::out); virtual pos_type seekpos(pos_type __sp, ios_base::openmode __wch = ios_base::in | ios_base::out); virtual int sync(); private: bool __read_mode(); void __write_mode(); wbuffer_convert* __close(); }; template <class _Codecvt, class _Elem, class _Tr> wbuffer_convert<_Codecvt, _Elem, _Tr>:: wbuffer_convert(streambuf* __bytebuf, _Codecvt* __pcvt, state_type __state) : __extbuf_(0), __extbufnext_(0), __extbufend_(0), __ebs_(0), __intbuf_(0), __ibs_(0), __bufptr_(__bytebuf), __cv_(__pcvt), __st_(__state), __cm_(0), __owns_eb_(false), __owns_ib_(false), __always_noconv_(__cv_ ? __cv_->always_noconv() : false) { setbuf(0, 4096); } template <class _Codecvt, class _Elem, class _Tr> wbuffer_convert<_Codecvt, _Elem, _Tr>::~wbuffer_convert() { __close(); delete __cv_; if (__owns_eb_) delete [] __extbuf_; if (__owns_ib_) delete [] __intbuf_; } template <class _Codecvt, class _Elem, class _Tr> typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow() { if (__cv_ == 0 || __bufptr_ == 0) return traits_type::eof(); bool __initial = __read_mode(); char_type __1buf; if (this->gptr() == 0) this->setg(&__1buf, &__1buf+1, &__1buf+1); const size_t __unget_sz = __initial ? 0 : min<size_t>((this->egptr() - this->eback()) / 2, 4); int_type __c = traits_type::eof(); if (this->gptr() == this->egptr()) { memmove(this->eback(), this->egptr() - __unget_sz, __unget_sz * sizeof(char_type)); if (__always_noconv_) { streamsize __nmemb = static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz); __nmemb = __bufptr_->sgetn((char*)this->eback() + __unget_sz, __nmemb); if (__nmemb != 0) { this->setg(this->eback(), this->eback() + __unget_sz, this->eback() + __unget_sz + __nmemb); __c = *this->gptr(); } } else { ((void)0); if (__extbufend_ != __extbufnext_) memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_); __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_); __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_); streamsize __nmemb = std::__1::min(static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz), static_cast<streamsize>(__extbufend_ - __extbufnext_)); codecvt_base::result __r; streamsize __nr = __bufptr_->sgetn(const_cast<char*>(__extbufnext_), __nmemb); if (__nr != 0) { __extbufend_ = __extbufnext_ + __nr; char_type* __inext; __r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_, this->eback() + __unget_sz, this->egptr(), __inext); if (__r == codecvt_base::noconv) { this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*) const_cast<char *>(__extbufend_)); __c = *this->gptr(); } else if (__inext != this->eback() + __unget_sz) { this->setg(this->eback(), this->eback() + __unget_sz, __inext); __c = *this->gptr(); } } } } else __c = *this->gptr(); if (this->eback() == &__1buf) this->setg(0, 0, 0); return __c; } template <class _Codecvt, class _Elem, class _Tr> typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type wbuffer_convert<_Codecvt, _Elem, _Tr>::pbackfail(int_type __c) { if (__cv_ != 0 && __bufptr_ != 0 && this->eback() < this->gptr()) { if (traits_type::eq_int_type(__c, traits_type::eof())) { this->gbump(-1); return traits_type::not_eof(__c); } if (traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1])) { this->gbump(-1); *this->gptr() = traits_type::to_char_type(__c); return __c; } } return traits_type::eof(); } template <class _Codecvt, class _Elem, class _Tr> typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type wbuffer_convert<_Codecvt, _Elem, _Tr>::overflow(int_type __c) { if (__cv_ == 0 || __bufptr_ == 0) return traits_type::eof(); __write_mode(); char_type __1buf; char_type* __pb_save = this->pbase(); char_type* __epb_save = this->epptr(); if (!traits_type::eq_int_type(__c, traits_type::eof())) { if (this->pptr() == 0) this->setp(&__1buf, &__1buf+1); *this->pptr() = traits_type::to_char_type(__c); this->pbump(1); } if (this->pptr() != this->pbase()) { if (__always_noconv_) { streamsize __nmemb = static_cast<streamsize>(this->pptr() - this->pbase()); if (__bufptr_->sputn((const char*)this->pbase(), __nmemb) != __nmemb) return traits_type::eof(); } else { char* __extbe = __extbuf_; codecvt_base::result __r; do { const char_type* __e; __r = __cv_->out(__st_, this->pbase(), this->pptr(), __e, __extbuf_, __extbuf_ + __ebs_, __extbe); if (__e == this->pbase()) return traits_type::eof(); if (__r == codecvt_base::noconv) { streamsize __nmemb = static_cast<size_t>(this->pptr() - this->pbase()); if (__bufptr_->sputn((const char*)this->pbase(), __nmemb) != __nmemb) return traits_type::eof(); } else if (__r == codecvt_base::ok || __r == codecvt_base::partial) { streamsize __nmemb = static_cast<size_t>(__extbe - __extbuf_); if (__bufptr_->sputn(__extbuf_, __nmemb) != __nmemb) return traits_type::eof(); if (__r == codecvt_base::partial) { this->setp(const_cast<char_type *>(__e), this->pptr()); this->__pbump(this->epptr() - this->pbase()); } } else return traits_type::eof(); } while (__r == codecvt_base::partial); } this->setp(__pb_save, __epb_save); } return traits_type::not_eof(__c); } template <class _Codecvt, class _Elem, class _Tr> basic_streambuf<_Elem, _Tr>* wbuffer_convert<_Codecvt, _Elem, _Tr>::setbuf(char_type* __s, streamsize __n) { this->setg(0, 0, 0); this->setp(0, 0); if (__owns_eb_) delete [] __extbuf_; if (__owns_ib_) delete [] __intbuf_; __ebs_ = __n; if (__ebs_ > sizeof(__extbuf_min_)) { if (__always_noconv_ && __s) { __extbuf_ = (char*)__s; __owns_eb_ = false; } else { __extbuf_ = new char[__ebs_]; __owns_eb_ = true; } } else { __extbuf_ = __extbuf_min_; __ebs_ = sizeof(__extbuf_min_); __owns_eb_ = false; } if (!__always_noconv_) { __ibs_ = max<streamsize>(__n, sizeof(__extbuf_min_)); if (__s && __ibs_ >= sizeof(__extbuf_min_)) { __intbuf_ = __s; __owns_ib_ = false; } else { __intbuf_ = new char_type[__ibs_]; __owns_ib_ = true; } } else { __ibs_ = 0; __intbuf_ = 0; __owns_ib_ = false; } return this; } template <class _Codecvt, class _Elem, class _Tr> typename wbuffer_convert<_Codecvt, _Elem, _Tr>::pos_type wbuffer_convert<_Codecvt, _Elem, _Tr>::seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __om) { int __width = __cv_->encoding(); if (__cv_ == 0 || __bufptr_ == 0 || (__width <= 0 && __off != 0) || sync()) return pos_type(off_type(-1)); if (__way != ios_base::beg && __way != ios_base::cur && __way != ios_base::end) return pos_type(off_type(-1)); pos_type __r = __bufptr_->pubseekoff(__width * __off, __way, __om); __r.state(__st_); return __r; } template <class _Codecvt, class _Elem, class _Tr> typename wbuffer_convert<_Codecvt, _Elem, _Tr>::pos_type wbuffer_convert<_Codecvt, _Elem, _Tr>::seekpos(pos_type __sp, ios_base::openmode __wch) { if (__cv_ == 0 || __bufptr_ == 0 || sync()) return pos_type(off_type(-1)); if (__bufptr_->pubseekpos(__sp, __wch) == pos_type(off_type(-1))) return pos_type(off_type(-1)); return __sp; } template <class _Codecvt, class _Elem, class _Tr> int wbuffer_convert<_Codecvt, _Elem, _Tr>::sync() { if (__cv_ == 0 || __bufptr_ == 0) return 0; if (__cm_ & ios_base::out) { if (this->pptr() != this->pbase()) if (overflow() == traits_type::eof()) return -1; codecvt_base::result __r; do { char* __extbe; __r = __cv_->unshift(__st_, __extbuf_, __extbuf_ + __ebs_, __extbe); streamsize __nmemb = static_cast<streamsize>(__extbe - __extbuf_); if (__bufptr_->sputn(__extbuf_, __nmemb) != __nmemb) return -1; } while (__r == codecvt_base::partial); if (__r == codecvt_base::error) return -1; if (__bufptr_->pubsync()) return -1; } else if (__cm_ & ios_base::in) { off_type __c; if (__always_noconv_) __c = this->egptr() - this->gptr(); else { int __width = __cv_->encoding(); __c = __extbufend_ - __extbufnext_; if (__width > 0) __c += __width * (this->egptr() - this->gptr()); else { if (this->gptr() != this->egptr()) { reverse(this->gptr(), this->egptr()); codecvt_base::result __r; const char_type* __e = this->gptr(); char* __extbe; do { __r = __cv_->out(__st_, __e, this->egptr(), __e, __extbuf_, __extbuf_ + __ebs_, __extbe); switch (__r) { case codecvt_base::noconv: __c += this->egptr() - this->gptr(); break; case codecvt_base::ok: case codecvt_base::partial: __c += __extbe - __extbuf_; break; default: return -1; } } while (__r == codecvt_base::partial); } } } if (__bufptr_->pubseekoff(-__c, ios_base::cur, __cm_) == pos_type(off_type(-1))) return -1; this->setg(0, 0, 0); __cm_ = 0; } return 0; } template <class _Codecvt, class _Elem, class _Tr> bool wbuffer_convert<_Codecvt, _Elem, _Tr>::__read_mode() { if (!(__cm_ & ios_base::in)) { this->setp(0, 0); if (__always_noconv_) this->setg((char_type*)__extbuf_, (char_type*)__extbuf_ + __ebs_, (char_type*)__extbuf_ + __ebs_); else this->setg(__intbuf_, __intbuf_ + __ibs_, __intbuf_ + __ibs_); __cm_ = ios_base::in; return true; } return false; } template <class _Codecvt, class _Elem, class _Tr> void wbuffer_convert<_Codecvt, _Elem, _Tr>::__write_mode() { if (!(__cm_ & ios_base::out)) { this->setg(0, 0, 0); if (__ebs_ > sizeof(__extbuf_min_)) { if (__always_noconv_) this->setp((char_type*)__extbuf_, (char_type*)__extbuf_ + (__ebs_ - 1)); else this->setp(__intbuf_, __intbuf_ + (__ibs_ - 1)); } else this->setp(0, 0); __cm_ = ios_base::out; } } template <class _Codecvt, class _Elem, class _Tr> wbuffer_convert<_Codecvt, _Elem, _Tr>* wbuffer_convert<_Codecvt, _Elem, _Tr>::__close() { wbuffer_convert* __rt = 0; if (__cv_ != 0 && __bufptr_ != 0) { __rt = this; if ((__cm_ & ios_base::out) && sync()) __rt = 0; } return __rt; } } } namespace std { inline namespace __1 { template <class _CharT, class _Traits> class basic_ostream : virtual public basic_ios<_CharT, _Traits> { public: typedef _CharT char_type; typedef _Traits traits_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; inline __attribute__ ((__exclude_from_explicit_instantiation__)) explicit basic_ostream(basic_streambuf<char_type, traits_type>* __sb) { this->init(__sb); } virtual ~basic_ostream(); protected: inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream(basic_ostream&& __rhs); inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream& operator=(basic_ostream&& __rhs); inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(basic_ostream& __rhs) { basic_ios<char_type, traits_type>::swap(__rhs); } basic_ostream (const basic_ostream& __rhs) = delete; basic_ostream& operator=(const basic_ostream& __rhs) = delete; public: class sentry; inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&)) { return __pf(*this); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream& operator<<(basic_ios<char_type, traits_type>& (*__pf)(basic_ios<char_type,traits_type>&)) { __pf(*this); return *this; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream& operator<<(ios_base& (*__pf)(ios_base&)) { __pf(*this); return *this; } basic_ostream& operator<<(bool __n); basic_ostream& operator<<(short __n); basic_ostream& operator<<(unsigned short __n); basic_ostream& operator<<(int __n); basic_ostream& operator<<(unsigned int __n); basic_ostream& operator<<(long __n); basic_ostream& operator<<(unsigned long __n); basic_ostream& operator<<(long long __n); basic_ostream& operator<<(unsigned long long __n); basic_ostream& operator<<(float __f); basic_ostream& operator<<(double __f); basic_ostream& operator<<(long double __f); basic_ostream& operator<<(const void* __p); basic_ostream& operator<<(basic_streambuf<char_type, traits_type>* __sb); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream& operator<<(nullptr_t) { return *this << "nullptr"; } basic_ostream& put(char_type __c); basic_ostream& write(const char_type* __s, streamsize __n); basic_ostream& flush(); inline __attribute__ ((__exclude_from_explicit_instantiation__)) pos_type tellp(); inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream& seekp(pos_type __pos); inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream& seekp(off_type __off, ios_base::seekdir __dir); protected: __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream() {} }; template <class _CharT, class _Traits> class basic_ostream<_CharT, _Traits>::sentry { bool __ok_; basic_ostream<_CharT, _Traits>& __os_; sentry(const sentry&); sentry& operator=(const sentry&); public: explicit sentry(basic_ostream<_CharT, _Traits>& __os); ~sentry(); __attribute__ ((__exclude_from_explicit_instantiation__)) explicit operator bool() const {return __ok_;} }; template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>::sentry::sentry(basic_ostream<_CharT, _Traits>& __os) : __ok_(false), __os_(__os) { if (__os.good()) { if (__os.tie()) __os.tie()->flush(); __ok_ = true; } } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>::sentry::~sentry() { if (__os_.rdbuf() && __os_.good() && (__os_.flags() & ios_base::unitbuf) && !uncaught_exception()) { if (__os_.rdbuf()->pubsync() == -1) __os_.setstate(ios_base::badbit); } } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>::basic_ostream(basic_ostream&& __rhs) { this->move(__rhs); } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator=(basic_ostream&& __rhs) { swap(__rhs); return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>::~basic_ostream() { } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_type>* __sb) { sentry __s(*this); if (__s) { if (__sb) { typedef istreambuf_iterator<_CharT, _Traits> _Ip; typedef ostreambuf_iterator<_CharT, _Traits> _Op; _Ip __i(__sb); _Ip __eof; _Op __o(*this); size_t __c = 0; for (; __i != __eof; ++__i, ++__o, ++__c) { *__o = *__i; if (__o.failed()) break; } if (__c == 0) this->setstate(ios_base::failbit); } else this->setstate(ios_base::badbit); } return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(bool __n) { sentry __s(*this); if (__s) { typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(short __n) { sentry __s(*this); if (__s) { ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), __flags == ios_base::oct || __flags == ios_base::hex ? static_cast<long>(static_cast<unsigned short>(__n)) : static_cast<long>(__n)).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n) { sentry __s(*this); if (__s) { typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(int __n) { sentry __s(*this); if (__s) { ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), __flags == ios_base::oct || __flags == ios_base::hex ? static_cast<long>(static_cast<unsigned int>(__n)) : static_cast<long>(__n)).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n) { sentry __s(*this); if (__s) { typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long __n) { sentry __s(*this); if (__s) { typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n) { sentry __s(*this); if (__s) { typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long long __n) { sentry __s(*this); if (__s) { typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n) { sentry __s(*this); if (__s) { typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(float __n) { sentry __s(*this); if (__s) { typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(double __n) { sentry __s(*this); if (__s) { typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long double __n) { sentry __s(*this); if (__s) { typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(const void* __n) { sentry __s(*this); if (__s) { typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; const _Fp& __f = use_facet<_Fp>(this->getloc()); if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } return *this; } template<class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& __put_character_sequence(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str, size_t __len) { typename basic_ostream<_CharT, _Traits>::sentry __s(__os); if (__s) { typedef ostreambuf_iterator<_CharT, _Traits> _Ip; if (__pad_and_output(_Ip(__os), __str, (__os.flags() & ios_base::adjustfield) == ios_base::left ? __str + __len : __str, __str + __len, __os, __os.fill()).failed()) __os.setstate(ios_base::badbit | ios_base::failbit); } return __os; } template<class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c) { return std::__1::__put_character_sequence(__os, &__c, 1); } template<class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn) { typename basic_ostream<_CharT, _Traits>::sentry __s(__os); if (__s) { _CharT __c = __os.widen(__cn); typedef ostreambuf_iterator<_CharT, _Traits> _Ip; if (__pad_and_output(_Ip(__os), &__c, (__os.flags() & ios_base::adjustfield) == ios_base::left ? &__c + 1 : &__c, &__c + 1, __os, __os.fill()).failed()) __os.setstate(ios_base::badbit | ios_base::failbit); } return __os; } template<class _Traits> basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __os, char __c) { return std::__1::__put_character_sequence(__os, &__c, 1); } template<class _Traits> basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __os, signed char __c) { return std::__1::__put_character_sequence(__os, (char *) &__c, 1); } template<class _Traits> basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c) { return std::__1::__put_character_sequence(__os, (char *) &__c, 1); } template<class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str) { return std::__1::__put_character_sequence(__os, __str, _Traits::length(__str)); } template<class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn) { typename basic_ostream<_CharT, _Traits>::sentry __s(__os); if (__s) { typedef ostreambuf_iterator<_CharT, _Traits> _Ip; size_t __len = char_traits<char>::length(__strn); const int __bs = 100; _CharT __wbb[__bs]; _CharT* __wb = __wbb; unique_ptr<_CharT, void(*)(void*)> __h(0, free); if (__len > __bs) { __wb = (_CharT*)malloc(__len*sizeof(_CharT)); if (__wb == 0) __throw_bad_alloc(); __h.reset(__wb); } for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p) *__p = __os.widen(*__strn); if (__pad_and_output(_Ip(__os), __wb, (__os.flags() & ios_base::adjustfield) == ios_base::left ? __wb + __len : __wb, __wb + __len, __os, __os.fill()).failed()) __os.setstate(ios_base::badbit | ios_base::failbit); } return __os; } template<class _Traits> basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __os, const char* __str) { return std::__1::__put_character_sequence(__os, __str, _Traits::length(__str)); } template<class _Traits> basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str) { const char *__s = (const char *) __str; return std::__1::__put_character_sequence(__os, __s, _Traits::length(__s)); } template<class _Traits> basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str) { const char *__s = (const char *) __str; return std::__1::__put_character_sequence(__os, __s, _Traits::length(__s)); } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::put(char_type __c) { sentry __s(*this); if (__s) { typedef ostreambuf_iterator<_CharT, _Traits> _Op; _Op __o(*this); *__o = __c; if (__o.failed()) this->setstate(ios_base::badbit); } return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n) { sentry __sen(*this); if (__sen && __n) { if (this->rdbuf()->sputn(__s, __n) != __n) this->setstate(ios_base::badbit); } return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::flush() { if (this->rdbuf()) { sentry __s(*this); if (__s) { if (this->rdbuf()->pubsync() == -1) this->setstate(ios_base::badbit); } } return *this; } template <class _CharT, class _Traits> typename basic_ostream<_CharT, _Traits>::pos_type basic_ostream<_CharT, _Traits>::tellp() { if (this->fail()) return pos_type(-1); return this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out); } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::seekp(pos_type __pos) { sentry __s(*this); if (!this->fail()) { if (this->rdbuf()->pubseekpos(__pos, ios_base::out) == pos_type(-1)) this->setstate(ios_base::failbit); } return *this; } template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir) { sentry __s(*this); if (!this->fail()) { if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::out) == pos_type(-1)) this->setstate(ios_base::failbit); } return *this; } template <class _CharT, class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream<_CharT, _Traits>& endl(basic_ostream<_CharT, _Traits>& __os) { __os.put(__os.widen('\n')); __os.flush(); return __os; } template <class _CharT, class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream<_CharT, _Traits>& ends(basic_ostream<_CharT, _Traits>& __os) { __os.put(_CharT()); return __os; } template <class _CharT, class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream<_CharT, _Traits>& flush(basic_ostream<_CharT, _Traits>& __os) { __os.flush(); return __os; } template <class _Stream, class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < !is_lvalue_reference<_Stream>::value && is_base_of<ios_base, _Stream>::value, _Stream&& >::type operator<<(_Stream&& __os, const _Tp& __x) { __os << __x; return std::__1::move(__os); } template<class _CharT, class _Traits, class _Allocator> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const basic_string<_CharT, _Traits, _Allocator>& __str) { return std::__1::__put_character_sequence(__os, __str.data(), __str.size()); } template<class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, basic_string_view<_CharT, _Traits> __sv) { return std::__1::__put_character_sequence(__os, __sv.data(), __sv.size()); } template <class _CharT, class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __ec) { return __os << __ec.category().name() << ':' << __ec.value(); } template<class _CharT, class _Traits, class _Yp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p) { return __os << __p.get(); } template<class _CharT, class _Traits, class _Yp, class _Dp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < is_same<void, typename __void_t<decltype((declval<basic_ostream<_CharT, _Traits>&>() << declval<typename unique_ptr<_Yp, _Dp>::pointer>()))>::type>::value, basic_ostream<_CharT, _Traits>& >::type operator<<(basic_ostream<_CharT, _Traits>& __os, unique_ptr<_Yp, _Dp> const& __p) { return __os << __p.get(); } template <class _CharT, class _Traits, size_t _Size> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x) { return __os << __x.template to_string<_CharT, _Traits> (use_facet<ctype<_CharT> >(__os.getloc()).widen('0'), use_facet<ctype<_CharT> >(__os.getloc()).widen('1')); } extern template class basic_ostream<char>; extern template class basic_ostream<wchar_t>; } } namespace std { inline namespace __1 { template <class _CharT, class _Traits> class basic_istream : virtual public basic_ios<_CharT, _Traits> { streamsize __gc_; public: typedef _CharT char_type; typedef _Traits traits_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; inline __attribute__ ((__exclude_from_explicit_instantiation__)) explicit basic_istream(basic_streambuf<char_type, traits_type>* __sb) : __gc_(0) { this->init(__sb); } virtual ~basic_istream(); protected: inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream(basic_istream&& __rhs); inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream& operator=(basic_istream&& __rhs); inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(basic_istream& __rhs) { std::__1::swap(__gc_, __rhs.__gc_); basic_ios<char_type, traits_type>::swap(__rhs); } basic_istream (const basic_istream& __rhs) = delete; basic_istream& operator=(const basic_istream& __rhs) = delete; public: class sentry; inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&)) { return __pf(*this); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream& operator>>(basic_ios<char_type, traits_type>& (*__pf)(basic_ios<char_type, traits_type>&)) { __pf(*this); return *this; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream& operator>>(ios_base& (*__pf)(ios_base&)) { __pf(*this); return *this; } basic_istream& operator>>(basic_streambuf<char_type, traits_type>* __sb); basic_istream& operator>>(bool& __n); basic_istream& operator>>(short& __n); basic_istream& operator>>(unsigned short& __n); basic_istream& operator>>(int& __n); basic_istream& operator>>(unsigned int& __n); basic_istream& operator>>(long& __n); basic_istream& operator>>(unsigned long& __n); basic_istream& operator>>(long long& __n); basic_istream& operator>>(unsigned long long& __n); basic_istream& operator>>(float& __f); basic_istream& operator>>(double& __f); basic_istream& operator>>(long double& __f); basic_istream& operator>>(void*& __p); __attribute__ ((__exclude_from_explicit_instantiation__)) streamsize gcount() const {return __gc_;} int_type get(); inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream& get(char_type& __c) { int_type __ch = get(); if (__ch != traits_type::eof()) __c = traits_type::to_char_type(__ch); return *this; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream& get(char_type* __s, streamsize __n) { return get(__s, __n, this->widen('\n')); } basic_istream& get(char_type* __s, streamsize __n, char_type __dlm); inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream& get(basic_streambuf<char_type, traits_type>& __sb) { return get(__sb, this->widen('\n')); } basic_istream& get(basic_streambuf<char_type, traits_type>& __sb, char_type __dlm); inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream& getline(char_type* __s, streamsize __n) { return getline(__s, __n, this->widen('\n')); } basic_istream& getline(char_type* __s, streamsize __n, char_type __dlm); basic_istream& ignore(streamsize __n = 1, int_type __dlm = traits_type::eof()); int_type peek(); basic_istream& read (char_type* __s, streamsize __n); streamsize readsome(char_type* __s, streamsize __n); basic_istream& putback(char_type __c); basic_istream& unget(); int sync(); pos_type tellg(); basic_istream& seekg(pos_type __pos); basic_istream& seekg(off_type __off, ios_base::seekdir __dir); }; template <class _CharT, class _Traits> class basic_istream<_CharT, _Traits>::sentry { bool __ok_; sentry(const sentry&); sentry& operator=(const sentry&); public: explicit sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false); __attribute__ ((__exclude_from_explicit_instantiation__)) explicit operator bool() const {return __ok_;} }; template <class _CharT, class _Traits> basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws) : __ok_(false) { if (__is.good()) { if (__is.tie()) __is.tie()->flush(); if (!__noskipws && (__is.flags() & ios_base::skipws)) { typedef istreambuf_iterator<_CharT, _Traits> _Ip; const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc()); _Ip __i(__is); _Ip __eof; for (; __i != __eof; ++__i) if (!__ct.is(__ct.space, *__i)) break; if (__i == __eof) __is.setstate(ios_base::failbit | ios_base::eofbit); } __ok_ = __is.good(); } else __is.setstate(ios_base::failbit); } template <class _CharT, class _Traits> basic_istream<_CharT, _Traits>::basic_istream(basic_istream&& __rhs) : __gc_(__rhs.__gc_) { __rhs.__gc_ = 0; this->move(__rhs); } template <class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator=(basic_istream&& __rhs) { swap(__rhs); return *this; } template <class _CharT, class _Traits> basic_istream<_CharT, _Traits>::~basic_istream() { } template <class _Tp, class _CharT, class _Traits> __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream<_CharT, _Traits>& __input_arithmetic(basic_istream<_CharT, _Traits>& __is, _Tp& __n) { ios_base::iostate __state = ios_base::goodbit; typename basic_istream<_CharT, _Traits>::sentry __s(__is); if (__s) { typedef istreambuf_iterator<_CharT, _Traits> _Ip; typedef num_get<_CharT, _Ip> _Fp; use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __n); __is.setstate(__state); } return __is; } template <class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(unsigned short& __n) { return std::__1::__input_arithmetic<unsigned short>(*this, __n); } template <class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(unsigned int& __n) { return std::__1::__input_arithmetic<unsigned int>(*this, __n); } template <class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(long& __n) { return std::__1::__input_arithmetic<long>(*this, __n); } template <class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(unsigned long& __n) { return std::__1::__input_arithmetic<unsigned long>(*this, __n); } template <class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(long long& __n) { return std::__1::__input_arithmetic<long long>(*this, __n); } template <class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(unsigned long long& __n) { return std::__1::__input_arithmetic<unsigned long long>(*this, __n); } template <class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(float& __n) { return std::__1::__input_arithmetic<float>(*this, __n); } template <class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(double& __n) { return std::__1::__input_arithmetic<double>(*this, __n); } template <class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(long double& __n) { return std::__1::__input_arithmetic<long double>(*this, __n); } template <class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(bool& __n) { return std::__1::__input_arithmetic<bool>(*this, __n); } template <class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(void*& __n) { return std::__1::__input_arithmetic<void*>(*this, __n); } template <class _Tp, class _CharT, class _Traits> __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream<_CharT, _Traits>& __input_arithmetic_with_numeric_limits(basic_istream<_CharT, _Traits>& __is, _Tp& __n) { ios_base::iostate __state = ios_base::goodbit; typename basic_istream<_CharT, _Traits>::sentry __s(__is); if (__s) { typedef istreambuf_iterator<_CharT, _Traits> _Ip; typedef num_get<_CharT, _Ip> _Fp; long __temp; use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __temp); if (__temp < numeric_limits<_Tp>::min()) { __state |= ios_base::failbit; __n = numeric_limits<_Tp>::min(); } else if (__temp > numeric_limits<_Tp>::max()) { __state |= ios_base::failbit; __n = numeric_limits<_Tp>::max(); } else { __n = static_cast<_Tp>(__temp); } __is.setstate(__state); } return __is; } template <class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(short& __n) { return std::__1::__input_arithmetic_with_numeric_limits<short>(*this, __n); } template <class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(int& __n) { return std::__1::__input_arithmetic_with_numeric_limits<int>(*this, __n); } template<class _CharT, class _Traits> __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream<_CharT, _Traits>& __input_c_string(basic_istream<_CharT, _Traits>& __is, _CharT* __p, size_t __n) { ios_base::iostate __state = ios_base::goodbit; typename basic_istream<_CharT, _Traits>::sentry __sen(__is); if (__sen) { _CharT* __s = __p; const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc()); while (__s != __p + (__n-1)) { typename _Traits::int_type __i = __is.rdbuf()->sgetc(); if (_Traits::eq_int_type(__i, _Traits::eof())) { __state |= ios_base::eofbit; break; } _CharT __ch = _Traits::to_char_type(__i); if (__ct.is(__ct.space, __ch)) break; *__s++ = __ch; __is.rdbuf()->sbumpc(); } *__s = _CharT(); __is.width(0); if (__s == __p) __state |= ios_base::failbit; __is.setstate(__state); } return __is; } template<class _CharT, class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, _CharT* __s) { streamsize __n = __is.width(); if (__n <= 0) __n = numeric_limits<streamsize>::max() / sizeof(_CharT) - 1; return std::__1::__input_c_string(__is, __s, size_t(__n)); } template<class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream<char, _Traits>& operator>>(basic_istream<char, _Traits>& __is, unsigned char* __s) { return __is >> (char*)__s; } template<class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream<char, _Traits>& operator>>(basic_istream<char, _Traits>& __is, signed char* __s) { return __is >> (char*)__s; } template<class _CharT, class _Traits> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c) { ios_base::iostate __state = ios_base::goodbit; typename basic_istream<_CharT, _Traits>::sentry __sen(__is); if (__sen) { typename _Traits::int_type __i = __is.rdbuf()->sbumpc(); if (_Traits::eq_int_type(__i, _Traits::eof())) __state |= ios_base::eofbit | ios_base::failbit; else __c = _Traits::to_char_type(__i); __is.setstate(__state); } return __is; } template<class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream<char, _Traits>& operator>>(basic_istream<char, _Traits>& __is, unsigned char& __c) { return __is >> (char&)__c; } template<class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream<char, _Traits>& operator>>(basic_istream<char, _Traits>& __is, signed char& __c) { return __is >> (char&)__c; } template<class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_type>* __sb) { ios_base::iostate __state = ios_base::goodbit; __gc_ = 0; sentry __s(*this, true); if (__s) { if (__sb) { while (true) { typename traits_type::int_type __i = this->rdbuf()->sgetc(); if (traits_type::eq_int_type(__i, _Traits::eof())) { __state |= ios_base::eofbit; break; } if (traits_type::eq_int_type( __sb->sputc(traits_type::to_char_type(__i)), traits_type::eof())) break; ++__gc_; this->rdbuf()->sbumpc(); } if (__gc_ == 0) __state |= ios_base::failbit; } else { __state |= ios_base::failbit; } this->setstate(__state); } return *this; } template<class _CharT, class _Traits> typename basic_istream<_CharT, _Traits>::int_type basic_istream<_CharT, _Traits>::get() { ios_base::iostate __state = ios_base::goodbit; __gc_ = 0; int_type __r = traits_type::eof(); sentry __s(*this, true); if (__s) { __r = this->rdbuf()->sbumpc(); if (traits_type::eq_int_type(__r, traits_type::eof())) __state |= ios_base::failbit | ios_base::eofbit; else __gc_ = 1; this->setstate(__state); } return __r; } template<class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __dlm) { ios_base::iostate __state = ios_base::goodbit; __gc_ = 0; sentry __sen(*this, true); if (__sen) { if (__n > 0) { while (__gc_ < __n-1) { int_type __i = this->rdbuf()->sgetc(); if (traits_type::eq_int_type(__i, traits_type::eof())) { __state |= ios_base::eofbit; break; } char_type __ch = traits_type::to_char_type(__i); if (traits_type::eq(__ch, __dlm)) break; *__s++ = __ch; ++__gc_; this->rdbuf()->sbumpc(); } if (__gc_ == 0) __state |= ios_base::failbit; } else { __state |= ios_base::failbit; } if (__n > 0) *__s = char_type(); this->setstate(__state); } if (__n > 0) *__s = char_type(); return *this; } template<class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __sb, char_type __dlm) { ios_base::iostate __state = ios_base::goodbit; __gc_ = 0; sentry __sen(*this, true); if (__sen) { while (true) { typename traits_type::int_type __i = this->rdbuf()->sgetc(); if (traits_type::eq_int_type(__i, traits_type::eof())) { __state |= ios_base::eofbit; break; } char_type __ch = traits_type::to_char_type(__i); if (traits_type::eq(__ch, __dlm)) break; if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof())) break; ++__gc_; this->rdbuf()->sbumpc(); } if (__gc_ == 0) __state |= ios_base::failbit; this->setstate(__state); } return *this; } template<class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_type __dlm) { ios_base::iostate __state = ios_base::goodbit; __gc_ = 0; sentry __sen(*this, true); if (__sen) { while (true) { typename traits_type::int_type __i = this->rdbuf()->sgetc(); if (traits_type::eq_int_type(__i, traits_type::eof())) { __state |= ios_base::eofbit; break; } char_type __ch = traits_type::to_char_type(__i); if (traits_type::eq(__ch, __dlm)) { this->rdbuf()->sbumpc(); ++__gc_; break; } if (__gc_ >= __n-1) { __state |= ios_base::failbit; break; } *__s++ = __ch; this->rdbuf()->sbumpc(); ++__gc_; } } if (__n > 0) *__s = char_type(); if (__gc_ == 0) __state |= ios_base::failbit; this->setstate(__state); return *this; } template<class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm) { ios_base::iostate __state = ios_base::goodbit; __gc_ = 0; sentry __sen(*this, true); if (__sen) { if (__n == numeric_limits<streamsize>::max()) { while (true) { typename traits_type::int_type __i = this->rdbuf()->sbumpc(); if (traits_type::eq_int_type(__i, traits_type::eof())) { __state |= ios_base::eofbit; break; } ++__gc_; if (traits_type::eq_int_type(__i, __dlm)) break; } } else { while (__gc_ < __n) { typename traits_type::int_type __i = this->rdbuf()->sbumpc(); if (traits_type::eq_int_type(__i, traits_type::eof())) { __state |= ios_base::eofbit; break; } ++__gc_; if (traits_type::eq_int_type(__i, __dlm)) break; } } this->setstate(__state); } return *this; } template<class _CharT, class _Traits> typename basic_istream<_CharT, _Traits>::int_type basic_istream<_CharT, _Traits>::peek() { ios_base::iostate __state = ios_base::goodbit; __gc_ = 0; int_type __r = traits_type::eof(); sentry __sen(*this, true); if (__sen) { __r = this->rdbuf()->sgetc(); if (traits_type::eq_int_type(__r, traits_type::eof())) __state |= ios_base::eofbit; this->setstate(__state); } return __r; } template<class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n) { ios_base::iostate __state = ios_base::goodbit; __gc_ = 0; sentry __sen(*this, true); if (__sen) { __gc_ = this->rdbuf()->sgetn(__s, __n); if (__gc_ != __n) __state |= ios_base::failbit | ios_base::eofbit; } else { __state |= ios_base::failbit; } this->setstate(__state); return *this; } template<class _CharT, class _Traits> streamsize basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n) { ios_base::iostate __state = ios_base::goodbit; __gc_ = 0; sentry __sen(*this, true); if (__sen) { streamsize __c = this->rdbuf()->in_avail(); switch (__c) { case -1: __state |= ios_base::eofbit; break; case 0: break; default: __n = std::__1::min(__c, __n); __gc_ = this->rdbuf()->sgetn(__s, __n); if (__gc_ != __n) __state |= ios_base::failbit | ios_base::eofbit; break; } } else { __state |= ios_base::failbit; } this->setstate(__state); return __gc_; } template<class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::putback(char_type __c) { ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit; __gc_ = 0; this->clear(__state); sentry __sen(*this, true); if (__sen) { if (this->rdbuf() == 0 || this->rdbuf()->sputbackc(__c) == traits_type::eof()) __state |= ios_base::badbit; } else { __state |= ios_base::failbit; } this->setstate(__state); return *this; } template<class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::unget() { ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit; __gc_ = 0; this->clear(__state); sentry __sen(*this, true); if (__sen) { if (this->rdbuf() == 0 || this->rdbuf()->sungetc() == traits_type::eof()) __state |= ios_base::badbit; } else { __state |= ios_base::failbit; } this->setstate(__state); return *this; } template<class _CharT, class _Traits> int basic_istream<_CharT, _Traits>::sync() { ios_base::iostate __state = ios_base::goodbit; int __r = 0; sentry __sen(*this, true); if (__sen) { if (this->rdbuf() == 0) return -1; if (this->rdbuf()->pubsync() == -1) { __state |= ios_base::badbit; return -1; } this->setstate(__state); } return __r; } template<class _CharT, class _Traits> typename basic_istream<_CharT, _Traits>::pos_type basic_istream<_CharT, _Traits>::tellg() { ios_base::iostate __state = ios_base::goodbit; pos_type __r(-1); sentry __sen(*this, true); if (__sen) { __r = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in); this->setstate(__state); } return __r; } template<class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::seekg(pos_type __pos) { ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit; this->clear(__state); sentry __sen(*this, true); if (__sen) { if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1)) __state |= ios_base::failbit; this->setstate(__state); } return *this; } template<class _CharT, class _Traits> basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir) { ios_base::iostate __state = this->rdstate() & ~ios_base::eofbit; this->clear(__state); sentry __sen(*this, true); if (__sen) { if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::in) == pos_type(-1)) __state |= ios_base::failbit; this->setstate(__state); } return *this; } template <class _CharT, class _Traits> basic_istream<_CharT, _Traits>& ws(basic_istream<_CharT, _Traits>& __is) { ios_base::iostate __state = ios_base::goodbit; typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true); if (__sen) { const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc()); while (true) { typename _Traits::int_type __i = __is.rdbuf()->sgetc(); if (_Traits::eq_int_type(__i, _Traits::eof())) { __state |= ios_base::eofbit; break; } if (!__ct.is(__ct.space, _Traits::to_char_type(__i))) break; __is.rdbuf()->sbumpc(); } __is.setstate(__state); } return __is; } template <class _CharT, class _Traits, class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp&& __x) { __is >> std::__1::forward<_Tp>(__x); return __is; } template <class _CharT, class _Traits> class basic_iostream : public basic_istream<_CharT, _Traits>, public basic_ostream<_CharT, _Traits> { public: typedef _CharT char_type; typedef _Traits traits_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; inline __attribute__ ((__exclude_from_explicit_instantiation__)) explicit basic_iostream(basic_streambuf<char_type, traits_type>* __sb) : basic_istream<_CharT, _Traits>(__sb) {} virtual ~basic_iostream(); protected: inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_iostream(basic_iostream&& __rhs); inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_iostream& operator=(basic_iostream&& __rhs); inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(basic_iostream& __rhs) { basic_istream<char_type, traits_type>::swap(__rhs); } }; template <class _CharT, class _Traits> basic_iostream<_CharT, _Traits>::basic_iostream(basic_iostream&& __rhs) : basic_istream<_CharT, _Traits>(std::__1::move(__rhs)) { } template <class _CharT, class _Traits> basic_iostream<_CharT, _Traits>& basic_iostream<_CharT, _Traits>::operator=(basic_iostream&& __rhs) { swap(__rhs); return *this; } template <class _CharT, class _Traits> basic_iostream<_CharT, _Traits>::~basic_iostream() { } template<class _CharT, class _Traits, class _Allocator> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Allocator>& __str) { ios_base::iostate __state = ios_base::goodbit; typename basic_istream<_CharT, _Traits>::sentry __sen(__is); if (__sen) { __str.clear(); streamsize __n = __is.width(); if (__n <= 0) __n = __str.max_size(); if (__n <= 0) __n = numeric_limits<streamsize>::max(); streamsize __c = 0; const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc()); while (__c < __n) { typename _Traits::int_type __i = __is.rdbuf()->sgetc(); if (_Traits::eq_int_type(__i, _Traits::eof())) { __state |= ios_base::eofbit; break; } _CharT __ch = _Traits::to_char_type(__i); if (__ct.is(__ct.space, __ch)) break; __str.push_back(__ch); ++__c; __is.rdbuf()->sbumpc(); } __is.width(0); if (__c == 0) __state |= ios_base::failbit; __is.setstate(__state); } return __is; } template<class _CharT, class _Traits, class _Allocator> basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm) { ios_base::iostate __state = ios_base::goodbit; typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true); if (__sen) { __str.clear(); streamsize __extr = 0; while (true) { typename _Traits::int_type __i = __is.rdbuf()->sbumpc(); if (_Traits::eq_int_type(__i, _Traits::eof())) { __state |= ios_base::eofbit; break; } ++__extr; _CharT __ch = _Traits::to_char_type(__i); if (_Traits::eq(__ch, __dlm)) break; __str.push_back(__ch); if (__str.size() == __str.max_size()) { __state |= ios_base::failbit; break; } } if (__extr == 0) __state |= ios_base::failbit; __is.setstate(__state); } return __is; } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Allocator>& __str) { return getline(__is, __str, __is.widen('\n')); } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>&& __is, basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm) { return getline(__is, __str, __dlm); } template<class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>&& __is, basic_string<_CharT, _Traits, _Allocator>& __str) { return getline(__is, __str, __is.widen('\n')); } template <class _CharT, class _Traits, size_t _Size> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x) { ios_base::iostate __state = ios_base::goodbit; typename basic_istream<_CharT, _Traits>::sentry __sen(__is); if (__sen) { basic_string<_CharT, _Traits> __str; const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc()); size_t __c = 0; _CharT __zero = __ct.widen('0'); _CharT __one = __ct.widen('1'); while (__c < _Size) { typename _Traits::int_type __i = __is.rdbuf()->sgetc(); if (_Traits::eq_int_type(__i, _Traits::eof())) { __state |= ios_base::eofbit; break; } _CharT __ch = _Traits::to_char_type(__i); if (!_Traits::eq(__ch, __zero) && !_Traits::eq(__ch, __one)) break; __str.push_back(__ch); ++__c; __is.rdbuf()->sbumpc(); } __x = bitset<_Size>(__str); if (_Size > 0 && __c == 0) __state |= ios_base::failbit; __is.setstate(__state); } return __is; } extern template class basic_istream<char>; extern template class basic_istream<wchar_t>; extern template class basic_iostream<char>; } } namespace std { inline namespace __1 { template <bool> class __split_buffer_common { protected: void __throw_length_error() const; void __throw_out_of_range() const; }; template <class _Tp, class _Allocator = allocator<_Tp> > struct __split_buffer : private __split_buffer_common<true> { private: __split_buffer(const __split_buffer&); __split_buffer& operator=(const __split_buffer&); public: typedef _Tp value_type; typedef _Allocator allocator_type; typedef typename remove_reference<allocator_type>::type __alloc_rr; typedef allocator_traits<__alloc_rr> __alloc_traits; typedef value_type& reference; typedef const value_type& const_reference; typedef typename __alloc_traits::size_type size_type; typedef typename __alloc_traits::difference_type difference_type; typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::const_pointer const_pointer; typedef pointer iterator; typedef const_pointer const_iterator; pointer __first_; pointer __begin_; pointer __end_; __compressed_pair<pointer, allocator_type> __end_cap_; typedef typename add_lvalue_reference<allocator_type>::type __alloc_ref; typedef typename add_lvalue_reference<allocator_type>::type __alloc_const_ref; __attribute__ ((__exclude_from_explicit_instantiation__)) __alloc_rr& __alloc() noexcept {return __end_cap_.second();} __attribute__ ((__exclude_from_explicit_instantiation__)) const __alloc_rr& __alloc() const noexcept {return __end_cap_.second();} __attribute__ ((__exclude_from_explicit_instantiation__)) pointer& __end_cap() noexcept {return __end_cap_.first();} __attribute__ ((__exclude_from_explicit_instantiation__)) const pointer& __end_cap() const noexcept {return __end_cap_.first();} __attribute__ ((__exclude_from_explicit_instantiation__)) __split_buffer() noexcept(is_nothrow_default_constructible<allocator_type>::value); __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __split_buffer(__alloc_rr& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __split_buffer(const __alloc_rr& __a); __split_buffer(size_type __cap, size_type __start, __alloc_rr& __a); ~__split_buffer(); __split_buffer(__split_buffer&& __c) noexcept(is_nothrow_move_constructible<allocator_type>::value); __split_buffer(__split_buffer&& __c, const __alloc_rr& __a); __split_buffer& operator=(__split_buffer&& __c) noexcept((__alloc_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable<allocator_type>::value) || !__alloc_traits::propagate_on_container_move_assignment::value); __attribute__ ((__exclude_from_explicit_instantiation__)) iterator begin() noexcept {return __begin_;} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator begin() const noexcept {return __begin_;} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator end() noexcept {return __end_;} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator end() const noexcept {return __end_;} __attribute__ ((__exclude_from_explicit_instantiation__)) void clear() noexcept {__destruct_at_end(__begin_);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type size() const {return static_cast<size_type>(__end_ - __begin_);} __attribute__ ((__exclude_from_explicit_instantiation__)) bool empty() const {return __end_ == __begin_;} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type capacity() const {return static_cast<size_type>(__end_cap() - __first_);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type __front_spare() const {return static_cast<size_type>(__begin_ - __first_);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type __back_spare() const {return static_cast<size_type>(__end_cap() - __end_);} __attribute__ ((__exclude_from_explicit_instantiation__)) reference front() {return *__begin_;} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference front() const {return *__begin_;} __attribute__ ((__exclude_from_explicit_instantiation__)) reference back() {return *(__end_ - 1);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference back() const {return *(__end_ - 1);} void reserve(size_type __n); void shrink_to_fit() noexcept; void push_front(const_reference __x); __attribute__ ((__exclude_from_explicit_instantiation__)) void push_back(const_reference __x); void push_front(value_type&& __x); void push_back(value_type&& __x); template <class... _Args> void emplace_back(_Args&&... __args); __attribute__ ((__exclude_from_explicit_instantiation__)) void pop_front() {__destruct_at_begin(__begin_+1);} __attribute__ ((__exclude_from_explicit_instantiation__)) void pop_back() {__destruct_at_end(__end_-1);} void __construct_at_end(size_type __n); void __construct_at_end(size_type __n, const_reference __x); template <class _InputIter> typename enable_if < __is_input_iterator<_InputIter>::value && !__is_forward_iterator<_InputIter>::value, void >::type __construct_at_end(_InputIter __first, _InputIter __last); template <class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value, void >::type __construct_at_end(_ForwardIterator __first, _ForwardIterator __last); __attribute__ ((__exclude_from_explicit_instantiation__)) void __destruct_at_begin(pointer __new_begin) {__destruct_at_begin(__new_begin, is_trivially_destructible<value_type>());} __attribute__ ((__exclude_from_explicit_instantiation__)) void __destruct_at_begin(pointer __new_begin, false_type); __attribute__ ((__exclude_from_explicit_instantiation__)) void __destruct_at_begin(pointer __new_begin, true_type); __attribute__ ((__exclude_from_explicit_instantiation__)) void __destruct_at_end(pointer __new_last) noexcept {__destruct_at_end(__new_last, false_type());} __attribute__ ((__exclude_from_explicit_instantiation__)) void __destruct_at_end(pointer __new_last, false_type) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) void __destruct_at_end(pointer __new_last, true_type) noexcept; void swap(__split_buffer& __x) noexcept(!__alloc_traits::propagate_on_container_swap::value|| __is_nothrow_swappable<__alloc_rr>::value); bool __invariants() const; private: __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(__split_buffer& __c, true_type) noexcept(is_nothrow_move_assignable<allocator_type>::value) { __alloc() = std::__1::move(__c.__alloc()); } __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(__split_buffer&, false_type) noexcept {} struct _ConstructTransaction { explicit _ConstructTransaction(pointer* __p, size_type __n) noexcept : __pos_(*__p), __end_(*__p + __n), __dest_(__p) { } ~_ConstructTransaction() { *__dest_ = __pos_; } pointer __pos_; const pointer __end_; private: pointer *__dest_; }; }; template <class _Tp, class _Allocator> bool __split_buffer<_Tp, _Allocator>::__invariants() const { if (__first_ == nullptr) { if (__begin_ != nullptr) return false; if (__end_ != nullptr) return false; if (__end_cap() != nullptr) return false; } else { if (__begin_ < __first_) return false; if (__end_ < __begin_) return false; if (__end_cap() < __end_) return false; } return true; } template <class _Tp, class _Allocator> void __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n) { _ConstructTransaction __tx(&this->__end_, __n); for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) { __alloc_traits::construct(this->__alloc(), std::__1::__to_raw_pointer(__tx.__pos_)); } } template <class _Tp, class _Allocator> void __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) { _ConstructTransaction __tx(&this->__end_, __n); for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) { __alloc_traits::construct(this->__alloc(), std::__1::__to_raw_pointer(__tx.__pos_), __x); } } template <class _Tp, class _Allocator> template <class _InputIter> typename enable_if < __is_input_iterator<_InputIter>::value && !__is_forward_iterator<_InputIter>::value, void >::type __split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIter __last) { __alloc_rr& __a = this->__alloc(); for (; __first != __last; ++__first) { if (__end_ == __end_cap()) { size_type __old_cap = __end_cap() - __first_; size_type __new_cap = std::__1::max<size_type>(2 * __old_cap, 8); __split_buffer __buf(__new_cap, 0, __a); for (pointer __p = __begin_; __p != __end_; ++__p, ++__buf.__end_) __alloc_traits::construct(__buf.__alloc(), std::__1::__to_raw_pointer(__buf.__end_), std::__1::move(*__p)); swap(__buf); } __alloc_traits::construct(__a, std::__1::__to_raw_pointer(this->__end_), *__first); ++this->__end_; } } template <class _Tp, class _Allocator> template <class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value, void >::type __split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last) { _ConstructTransaction __tx(&this->__end_, std::distance(__first, __last)); for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, ++__first) { __alloc_traits::construct(this->__alloc(), std::__1::__to_raw_pointer(__tx.__pos_), *__first); } } template <class _Tp, class _Allocator> inline void __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type) { while (__begin_ != __new_begin) __alloc_traits::destroy(__alloc(), __to_raw_pointer(__begin_++)); } template <class _Tp, class _Allocator> inline void __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type) { __begin_ = __new_begin; } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) noexcept { while (__new_last != __end_) __alloc_traits::destroy(__alloc(), __to_raw_pointer(--__end_)); } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) noexcept { __end_ = __new_last; } template <class _Tp, class _Allocator> __split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a) : __end_cap_(nullptr, __a) { __first_ = __cap != 0 ? __alloc_traits::allocate(__alloc(), __cap) : nullptr; __begin_ = __end_ = __first_ + __start; __end_cap() = __first_ + __cap; } template <class _Tp, class _Allocator> inline __split_buffer<_Tp, _Allocator>::__split_buffer() noexcept(is_nothrow_default_constructible<allocator_type>::value) : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr) { } template <class _Tp, class _Allocator> inline __split_buffer<_Tp, _Allocator>::__split_buffer(__alloc_rr& __a) : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a) { } template <class _Tp, class _Allocator> inline __split_buffer<_Tp, _Allocator>::__split_buffer(const __alloc_rr& __a) : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a) { } template <class _Tp, class _Allocator> __split_buffer<_Tp, _Allocator>::~__split_buffer() { clear(); if (__first_) __alloc_traits::deallocate(__alloc(), __first_, capacity()); } template <class _Tp, class _Allocator> __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c) noexcept(is_nothrow_move_constructible<allocator_type>::value) : __first_(std::__1::move(__c.__first_)), __begin_(std::__1::move(__c.__begin_)), __end_(std::__1::move(__c.__end_)), __end_cap_(std::__1::move(__c.__end_cap_)) { __c.__first_ = nullptr; __c.__begin_ = nullptr; __c.__end_ = nullptr; __c.__end_cap() = nullptr; } template <class _Tp, class _Allocator> __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a) : __end_cap_(__second_tag(), __a) { if (__a == __c.__alloc()) { __first_ = __c.__first_; __begin_ = __c.__begin_; __end_ = __c.__end_; __end_cap() = __c.__end_cap(); __c.__first_ = nullptr; __c.__begin_ = nullptr; __c.__end_ = nullptr; __c.__end_cap() = nullptr; } else { size_type __cap = __c.size(); __first_ = __alloc_traits::allocate(__alloc(), __cap); __begin_ = __end_ = __first_; __end_cap() = __first_ + __cap; typedef move_iterator<iterator> _Ip; __construct_at_end(_Ip(__c.begin()), _Ip(__c.end())); } } template <class _Tp, class _Allocator> __split_buffer<_Tp, _Allocator>& __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c) noexcept((__alloc_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable<allocator_type>::value) || !__alloc_traits::propagate_on_container_move_assignment::value) { clear(); shrink_to_fit(); __first_ = __c.__first_; __begin_ = __c.__begin_; __end_ = __c.__end_; __end_cap() = __c.__end_cap(); __move_assign_alloc(__c, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>()); __c.__first_ = __c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr; return *this; } template <class _Tp, class _Allocator> void __split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x) noexcept(!__alloc_traits::propagate_on_container_swap::value|| __is_nothrow_swappable<__alloc_rr>::value) { std::__1::swap(__first_, __x.__first_); std::__1::swap(__begin_, __x.__begin_); std::__1::swap(__end_, __x.__end_); std::__1::swap(__end_cap(), __x.__end_cap()); __swap_allocator(__alloc(), __x.__alloc()); } template <class _Tp, class _Allocator> void __split_buffer<_Tp, _Allocator>::reserve(size_type __n) { if (__n < capacity()) { __split_buffer<value_type, __alloc_rr&> __t(__n, 0, __alloc()); __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_)); std::__1::swap(__first_, __t.__first_); std::__1::swap(__begin_, __t.__begin_); std::__1::swap(__end_, __t.__end_); std::__1::swap(__end_cap(), __t.__end_cap()); } } template <class _Tp, class _Allocator> void __split_buffer<_Tp, _Allocator>::shrink_to_fit() noexcept { if (capacity() > size()) { __split_buffer<value_type, __alloc_rr&> __t(size(), 0, __alloc()); __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_)); __t.__end_ = __t.__begin_ + (__end_ - __begin_); std::__1::swap(__first_, __t.__first_); std::__1::swap(__begin_, __t.__begin_); std::__1::swap(__end_, __t.__end_); std::__1::swap(__end_cap(), __t.__end_cap()); } } template <class _Tp, class _Allocator> void __split_buffer<_Tp, _Allocator>::push_front(const_reference __x) { if (__begin_ == __first_) { if (__end_ < __end_cap()) { difference_type __d = __end_cap() - __end_; __d = (__d + 1) / 2; __begin_ = std::__1::move_backward(__begin_, __end_, __end_ + __d); __end_ += __d; } else { size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc()); __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_)); std::__1::swap(__first_, __t.__first_); std::__1::swap(__begin_, __t.__begin_); std::__1::swap(__end_, __t.__end_); std::__1::swap(__end_cap(), __t.__end_cap()); } } __alloc_traits::construct(__alloc(), std::__1::__to_raw_pointer(__begin_-1), __x); --__begin_; } template <class _Tp, class _Allocator> void __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x) { if (__begin_ == __first_) { if (__end_ < __end_cap()) { difference_type __d = __end_cap() - __end_; __d = (__d + 1) / 2; __begin_ = std::__1::move_backward(__begin_, __end_, __end_ + __d); __end_ += __d; } else { size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc()); __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_)); std::__1::swap(__first_, __t.__first_); std::__1::swap(__begin_, __t.__begin_); std::__1::swap(__end_, __t.__end_); std::__1::swap(__end_cap(), __t.__end_cap()); } } __alloc_traits::construct(__alloc(), std::__1::__to_raw_pointer(__begin_-1), std::__1::move(__x)); --__begin_; } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __split_buffer<_Tp, _Allocator>::push_back(const_reference __x) { if (__end_ == __end_cap()) { if (__begin_ > __first_) { difference_type __d = __begin_ - __first_; __d = (__d + 1) / 2; __end_ = std::__1::move(__begin_, __end_, __begin_ - __d); __begin_ -= __d; } else { size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc()); __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_)); std::__1::swap(__first_, __t.__first_); std::__1::swap(__begin_, __t.__begin_); std::__1::swap(__end_, __t.__end_); std::__1::swap(__end_cap(), __t.__end_cap()); } } __alloc_traits::construct(__alloc(), std::__1::__to_raw_pointer(__end_), __x); ++__end_; } template <class _Tp, class _Allocator> void __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x) { if (__end_ == __end_cap()) { if (__begin_ > __first_) { difference_type __d = __begin_ - __first_; __d = (__d + 1) / 2; __end_ = std::__1::move(__begin_, __end_, __begin_ - __d); __begin_ -= __d; } else { size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc()); __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_)); std::__1::swap(__first_, __t.__first_); std::__1::swap(__begin_, __t.__begin_); std::__1::swap(__end_, __t.__end_); std::__1::swap(__end_cap(), __t.__end_cap()); } } __alloc_traits::construct(__alloc(), std::__1::__to_raw_pointer(__end_), std::__1::move(__x)); ++__end_; } template <class _Tp, class _Allocator> template <class... _Args> void __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args) { if (__end_ == __end_cap()) { if (__begin_ > __first_) { difference_type __d = __begin_ - __first_; __d = (__d + 1) / 2; __end_ = std::__1::move(__begin_, __end_, __begin_ - __d); __begin_ -= __d; } else { size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc()); __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_)); std::__1::swap(__first_, __t.__first_); std::__1::swap(__begin_, __t.__begin_); std::__1::swap(__end_, __t.__end_); std::__1::swap(__end_cap(), __t.__end_cap()); } } __alloc_traits::construct(__alloc(), std::__1::__to_raw_pointer(__end_), std::__1::forward<_Args>(__args)...); ++__end_; } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } } } namespace std { inline namespace __1 { template <class _Tp, class _Allocator> class __deque_base; template <class _Tp, class _Allocator = allocator<_Tp> > class deque; template <class _ValueType, class _Pointer, class _Reference, class _MapPointer, class _DiffType, _DiffType _BlockSize> class __deque_iterator; template <class _RAIter, class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> copy(_RAIter __f, _RAIter __l, __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0); template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, class _OutputIterator> _OutputIterator copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, _OutputIterator __r); template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r); template <class _RAIter, class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> copy_backward(_RAIter __f, _RAIter __l, __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0); template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, class _OutputIterator> _OutputIterator copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, _OutputIterator __r); template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r); template <class _RAIter, class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> move(_RAIter __f, _RAIter __l, __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0); template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, class _OutputIterator> _OutputIterator move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, _OutputIterator __r); template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r); template <class _RAIter, class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> move_backward(_RAIter __f, _RAIter __l, __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0); template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, class _OutputIterator> _OutputIterator move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, _OutputIterator __r); template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r); template <class _ValueType, class _DiffType> struct __deque_block_size { static const _DiffType value = sizeof(_ValueType) < 256 ? 4096 / sizeof(_ValueType) : 16; }; template <class _ValueType, class _Pointer, class _Reference, class _MapPointer, class _DiffType, _DiffType _BS = 0 > class __deque_iterator { typedef _MapPointer __map_iterator; public: typedef _Pointer pointer; typedef _DiffType difference_type; private: __map_iterator __m_iter_; pointer __ptr_; static const difference_type __block_size; public: typedef _ValueType value_type; typedef random_access_iterator_tag iterator_category; typedef _Reference reference; __attribute__ ((__exclude_from_explicit_instantiation__)) __deque_iterator() noexcept : __m_iter_(nullptr), __ptr_(nullptr) {} template <class _Pp, class _Rp, class _MP> __attribute__ ((__exclude_from_explicit_instantiation__)) __deque_iterator(const __deque_iterator<value_type, _Pp, _Rp, _MP, difference_type, _BS>& __it, typename enable_if<is_convertible<_Pp, pointer>::value>::type* = 0) noexcept : __m_iter_(__it.__m_iter_), __ptr_(__it.__ptr_) {} __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator*() const {return *__ptr_;} __attribute__ ((__exclude_from_explicit_instantiation__)) pointer operator->() const {return __ptr_;} __attribute__ ((__exclude_from_explicit_instantiation__)) __deque_iterator& operator++() { if (++__ptr_ - *__m_iter_ == __block_size) { ++__m_iter_; __ptr_ = *__m_iter_; } return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __deque_iterator operator++(int) { __deque_iterator __tmp = *this; ++(*this); return __tmp; } __attribute__ ((__exclude_from_explicit_instantiation__)) __deque_iterator& operator--() { if (__ptr_ == *__m_iter_) { --__m_iter_; __ptr_ = *__m_iter_ + __block_size; } --__ptr_; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __deque_iterator operator--(int) { __deque_iterator __tmp = *this; --(*this); return __tmp; } __attribute__ ((__exclude_from_explicit_instantiation__)) __deque_iterator& operator+=(difference_type __n) { if (__n != 0) { __n += __ptr_ - *__m_iter_; if (__n > 0) { __m_iter_ += __n / __block_size; __ptr_ = *__m_iter_ + __n % __block_size; } else { difference_type __z = __block_size - 1 - __n; __m_iter_ -= __z / __block_size; __ptr_ = *__m_iter_ + (__block_size - 1 - __z % __block_size); } } return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __deque_iterator& operator-=(difference_type __n) { return *this += -__n; } __attribute__ ((__exclude_from_explicit_instantiation__)) __deque_iterator operator+(difference_type __n) const { __deque_iterator __t(*this); __t += __n; return __t; } __attribute__ ((__exclude_from_explicit_instantiation__)) __deque_iterator operator-(difference_type __n) const { __deque_iterator __t(*this); __t -= __n; return __t; } __attribute__ ((__exclude_from_explicit_instantiation__)) friend __deque_iterator operator+(difference_type __n, const __deque_iterator& __it) {return __it + __n;} __attribute__ ((__exclude_from_explicit_instantiation__)) friend difference_type operator-(const __deque_iterator& __x, const __deque_iterator& __y) { if (__x != __y) return (__x.__m_iter_ - __y.__m_iter_) * __block_size + (__x.__ptr_ - *__x.__m_iter_) - (__y.__ptr_ - *__y.__m_iter_); return 0; } __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator[](difference_type __n) const {return *(*this + __n);} __attribute__ ((__exclude_from_explicit_instantiation__)) friend bool operator==(const __deque_iterator& __x, const __deque_iterator& __y) {return __x.__ptr_ == __y.__ptr_;} __attribute__ ((__exclude_from_explicit_instantiation__)) friend bool operator!=(const __deque_iterator& __x, const __deque_iterator& __y) {return !(__x == __y);} __attribute__ ((__exclude_from_explicit_instantiation__)) friend bool operator<(const __deque_iterator& __x, const __deque_iterator& __y) {return __x.__m_iter_ < __y.__m_iter_ || (__x.__m_iter_ == __y.__m_iter_ && __x.__ptr_ < __y.__ptr_);} __attribute__ ((__exclude_from_explicit_instantiation__)) friend bool operator>(const __deque_iterator& __x, const __deque_iterator& __y) {return __y < __x;} __attribute__ ((__exclude_from_explicit_instantiation__)) friend bool operator<=(const __deque_iterator& __x, const __deque_iterator& __y) {return !(__y < __x);} __attribute__ ((__exclude_from_explicit_instantiation__)) friend bool operator>=(const __deque_iterator& __x, const __deque_iterator& __y) {return !(__x < __y);} private: __attribute__ ((__exclude_from_explicit_instantiation__)) __deque_iterator(__map_iterator __m, pointer __p) noexcept : __m_iter_(__m), __ptr_(__p) {} template <class _Tp, class _Ap> friend class __deque_base; template <class _Tp, class _Ap> friend class deque; template <class _Vp, class _Pp, class _Rp, class _MP, class _Dp, _Dp> friend class __deque_iterator; template <class _RAIter, class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> friend __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> copy(_RAIter __f, _RAIter __l, __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*); template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, class _OutputIterator> friend _OutputIterator copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, _OutputIterator __r); template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> friend __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r); template <class _RAIter, class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> friend __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> copy_backward(_RAIter __f, _RAIter __l, __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*); template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, class _OutputIterator> friend _OutputIterator copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, _OutputIterator __r); template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> friend __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r); template <class _RAIter, class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> friend __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> move(_RAIter __f, _RAIter __l, __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*); template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, class _OutputIterator> friend _OutputIterator move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, _OutputIterator __r); template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> friend __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r); template <class _RAIter, class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> friend __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> move_backward(_RAIter __f, _RAIter __l, __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*); template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, class _OutputIterator> friend _OutputIterator move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, _OutputIterator __r); template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> friend __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r); }; template <class _ValueType, class _Pointer, class _Reference, class _MapPointer, class _DiffType, _DiffType _BlockSize> const _DiffType __deque_iterator<_ValueType, _Pointer, _Reference, _MapPointer, _DiffType, _BlockSize>::__block_size = __deque_block_size<_ValueType, _DiffType>::value; template <class _RAIter, class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> copy(_RAIter __f, _RAIter __l, __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*) { typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type; typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer; const difference_type __block_size = __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::__block_size; while (__f != __l) { pointer __rb = __r.__ptr_; pointer __re = *__r.__m_iter_ + __block_size; difference_type __bs = __re - __rb; difference_type __n = __l - __f; _RAIter __m = __l; if (__n > __bs) { __n = __bs; __m = __f + __n; } std::__1::copy(__f, __m, __rb); __f = __m; __r += __n; } return __r; } template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, class _OutputIterator> _OutputIterator copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, _OutputIterator __r) { typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type; typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer; const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size; difference_type __n = __l - __f; while (__n > 0) { pointer __fb = __f.__ptr_; pointer __fe = *__f.__m_iter_ + __block_size; difference_type __bs = __fe - __fb; if (__bs > __n) { __bs = __n; __fe = __fb + __bs; } __r = std::__1::copy(__fb, __fe, __r); __n -= __bs; __f += __bs; } return __r; } template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r) { typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type; typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer; const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size; difference_type __n = __l - __f; while (__n > 0) { pointer __fb = __f.__ptr_; pointer __fe = *__f.__m_iter_ + __block_size; difference_type __bs = __fe - __fb; if (__bs > __n) { __bs = __n; __fe = __fb + __bs; } __r = std::__1::copy(__fb, __fe, __r); __n -= __bs; __f += __bs; } return __r; } template <class _RAIter, class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> copy_backward(_RAIter __f, _RAIter __l, __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*) { typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type; typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer; while (__f != __l) { __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __rp = std::__1::prev(__r); pointer __rb = *__rp.__m_iter_; pointer __re = __rp.__ptr_ + 1; difference_type __bs = __re - __rb; difference_type __n = __l - __f; _RAIter __m = __f; if (__n > __bs) { __n = __bs; __m = __l - __n; } std::__1::copy_backward(__m, __l, __re); __l = __m; __r -= __n; } return __r; } template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, class _OutputIterator> _OutputIterator copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, _OutputIterator __r) { typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type; typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer; difference_type __n = __l - __f; while (__n > 0) { --__l; pointer __lb = *__l.__m_iter_; pointer __le = __l.__ptr_ + 1; difference_type __bs = __le - __lb; if (__bs > __n) { __bs = __n; __lb = __le - __bs; } __r = std::__1::copy_backward(__lb, __le, __r); __n -= __bs; __l -= __bs - 1; } return __r; } template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r) { typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type; typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer; difference_type __n = __l - __f; while (__n > 0) { --__l; pointer __lb = *__l.__m_iter_; pointer __le = __l.__ptr_ + 1; difference_type __bs = __le - __lb; if (__bs > __n) { __bs = __n; __lb = __le - __bs; } __r = std::__1::copy_backward(__lb, __le, __r); __n -= __bs; __l -= __bs - 1; } return __r; } template <class _RAIter, class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> move(_RAIter __f, _RAIter __l, __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*) { typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type; typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer; const difference_type __block_size = __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::__block_size; while (__f != __l) { pointer __rb = __r.__ptr_; pointer __re = *__r.__m_iter_ + __block_size; difference_type __bs = __re - __rb; difference_type __n = __l - __f; _RAIter __m = __l; if (__n > __bs) { __n = __bs; __m = __f + __n; } std::__1::move(__f, __m, __rb); __f = __m; __r += __n; } return __r; } template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, class _OutputIterator> _OutputIterator move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, _OutputIterator __r) { typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type; typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer; const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size; difference_type __n = __l - __f; while (__n > 0) { pointer __fb = __f.__ptr_; pointer __fe = *__f.__m_iter_ + __block_size; difference_type __bs = __fe - __fb; if (__bs > __n) { __bs = __n; __fe = __fb + __bs; } __r = std::__1::move(__fb, __fe, __r); __n -= __bs; __f += __bs; } return __r; } template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r) { typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type; typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer; const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size; difference_type __n = __l - __f; while (__n > 0) { pointer __fb = __f.__ptr_; pointer __fe = *__f.__m_iter_ + __block_size; difference_type __bs = __fe - __fb; if (__bs > __n) { __bs = __n; __fe = __fb + __bs; } __r = std::__1::move(__fb, __fe, __r); __n -= __bs; __f += __bs; } return __r; } template <class _RAIter, class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> move_backward(_RAIter __f, _RAIter __l, __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r, typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*) { typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type; typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer; while (__f != __l) { __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __rp = std::__1::prev(__r); pointer __rb = *__rp.__m_iter_; pointer __re = __rp.__ptr_ + 1; difference_type __bs = __re - __rb; difference_type __n = __l - __f; _RAIter __m = __f; if (__n > __bs) { __n = __bs; __m = __l - __n; } std::__1::move_backward(__m, __l, __re); __l = __m; __r -= __n; } return __r; } template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, class _OutputIterator> _OutputIterator move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, _OutputIterator __r) { typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type; typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer; difference_type __n = __l - __f; while (__n > 0) { --__l; pointer __lb = *__l.__m_iter_; pointer __le = __l.__ptr_ + 1; difference_type __bs = __le - __lb; if (__bs > __n) { __bs = __n; __lb = __le - __bs; } __r = std::__1::move_backward(__lb, __le, __r); __n -= __bs; __l -= __bs - 1; } return __r; } template <class _V1, class _P1, class _R1, class _M1, class _D1, _D1 _B1, class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f, __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l, __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r) { typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type; typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer; difference_type __n = __l - __f; while (__n > 0) { --__l; pointer __lb = *__l.__m_iter_; pointer __le = __l.__ptr_ + 1; difference_type __bs = __le - __lb; if (__bs > __n) { __bs = __n; __lb = __le - __bs; } __r = std::__1::move_backward(__lb, __le, __r); __n -= __bs; __l -= __bs - 1; } return __r; } template <bool> class __deque_base_common { protected: [[noreturn]] void __throw_length_error() const; [[noreturn]] void __throw_out_of_range() const; }; template <bool __b> void __deque_base_common<__b>::__throw_length_error() const { std::__1::__throw_length_error("deque"); } template <bool __b> void __deque_base_common<__b>::__throw_out_of_range() const { std::__1::__throw_out_of_range("deque"); } template <class _Tp, class _Allocator> class __deque_base : protected __deque_base_common<true> { __deque_base(const __deque_base& __c); __deque_base& operator=(const __deque_base& __c); public: typedef _Allocator allocator_type; typedef allocator_traits<allocator_type> __alloc_traits; typedef typename __alloc_traits::size_type size_type; typedef _Tp value_type; typedef value_type& reference; typedef const value_type& const_reference; typedef typename __alloc_traits::difference_type difference_type; typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::const_pointer const_pointer; static const difference_type __block_size; typedef typename __rebind_alloc_helper<__alloc_traits, pointer>::type __pointer_allocator; typedef allocator_traits<__pointer_allocator> __map_traits; typedef typename __map_traits::pointer __map_pointer; typedef typename __rebind_alloc_helper<__alloc_traits, const_pointer>::type __const_pointer_allocator; typedef typename allocator_traits<__const_pointer_allocator>::const_pointer __map_const_pointer; typedef __split_buffer<pointer, __pointer_allocator> __map; typedef __deque_iterator<value_type, pointer, reference, __map_pointer, difference_type> iterator; typedef __deque_iterator<value_type, const_pointer, const_reference, __map_const_pointer, difference_type> const_iterator; struct __deque_block_range { explicit __deque_block_range(pointer __b, pointer __e) noexcept : __begin_(__b), __end_(__e) {} const pointer __begin_; const pointer __end_; }; struct __deque_range { iterator __pos_; const iterator __end_; __deque_range(iterator __pos, iterator __e) noexcept : __pos_(__pos), __end_(__e) {} explicit operator bool() const noexcept { return __pos_ != __end_; } __deque_range begin() const { return *this; } __deque_range end() const { return __deque_range(__end_, __end_); } __deque_block_range operator*() const noexcept { if (__pos_.__m_iter_ == __end_.__m_iter_) { return __deque_block_range(__pos_.__ptr_, __end_.__ptr_); } return __deque_block_range(__pos_.__ptr_, *__pos_.__m_iter_ + __block_size); } __deque_range& operator++() noexcept { if (__pos_.__m_iter_ == __end_.__m_iter_) { __pos_ = __end_; } else { ++__pos_.__m_iter_; __pos_.__ptr_ = *__pos_.__m_iter_; } return *this; } friend bool operator==(__deque_range const& __lhs, __deque_range const& __rhs) { return __lhs.__pos_ == __rhs.__pos_; } friend bool operator!=(__deque_range const& __lhs, __deque_range const& __rhs) { return !(__lhs == __rhs); } }; struct _ConstructTransaction { _ConstructTransaction(__deque_base* __db, __deque_block_range& __r) : __pos_(__r.__begin_), __end_(__r.__end_), __begin_(__r.__begin_), __base_(__db) {} ~_ConstructTransaction() { __base_->size() += (__pos_ - __begin_); } pointer __pos_; const pointer __end_; private: const pointer __begin_; __deque_base * const __base_; }; protected: __map __map_; size_type __start_; __compressed_pair<size_type, allocator_type> __size_; iterator begin() noexcept; const_iterator begin() const noexcept; iterator end() noexcept; const_iterator end() const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) size_type& size() {return __size_.first();} __attribute__ ((__exclude_from_explicit_instantiation__)) const size_type& size() const noexcept {return __size_.first();} __attribute__ ((__exclude_from_explicit_instantiation__)) allocator_type& __alloc() {return __size_.second();} __attribute__ ((__exclude_from_explicit_instantiation__)) const allocator_type& __alloc() const noexcept {return __size_.second();} __attribute__ ((__exclude_from_explicit_instantiation__)) __deque_base() noexcept(is_nothrow_default_constructible<allocator_type>::value); __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __deque_base(const allocator_type& __a); public: ~__deque_base(); __deque_base(__deque_base&& __c) noexcept(is_nothrow_move_constructible<allocator_type>::value); __deque_base(__deque_base&& __c, const allocator_type& __a); void swap(__deque_base& __c) noexcept; protected: void clear() noexcept; bool __invariants() const; __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign(__deque_base& __c) noexcept(__alloc_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable<allocator_type>::value) { __map_ = std::__1::move(__c.__map_); __start_ = __c.__start_; size() = __c.size(); __move_assign_alloc(__c); __c.__start_ = __c.size() = 0; } __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(__deque_base& __c) noexcept(!__alloc_traits::propagate_on_container_move_assignment::value || is_nothrow_move_assignable<allocator_type>::value) {__move_assign_alloc(__c, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());} private: __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(__deque_base& __c, true_type) noexcept(is_nothrow_move_assignable<allocator_type>::value) { __alloc() = std::__1::move(__c.__alloc()); } __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(__deque_base&, false_type) noexcept {} }; template <class _Tp, class _Allocator> const typename __deque_base<_Tp, _Allocator>::difference_type __deque_base<_Tp, _Allocator>::__block_size = __deque_block_size<value_type, difference_type>::value; template <class _Tp, class _Allocator> bool __deque_base<_Tp, _Allocator>::__invariants() const { if (!__map_.__invariants()) return false; if (__map_.size() >= size_type(-1) / __block_size) return false; for (typename __map::const_iterator __i = __map_.begin(), __e = __map_.end(); __i != __e; ++__i) if (*__i == nullptr) return false; if (__map_.size() != 0) { if (size() >= __map_.size() * __block_size) return false; if (__start_ >= __map_.size() * __block_size - size()) return false; } else { if (size() != 0) return false; if (__start_ != 0) return false; } return true; } template <class _Tp, class _Allocator> typename __deque_base<_Tp, _Allocator>::iterator __deque_base<_Tp, _Allocator>::begin() noexcept { __map_pointer __mp = __map_.begin() + __start_ / __block_size; return iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size); } template <class _Tp, class _Allocator> typename __deque_base<_Tp, _Allocator>::const_iterator __deque_base<_Tp, _Allocator>::begin() const noexcept { __map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __start_ / __block_size); return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size); } template <class _Tp, class _Allocator> typename __deque_base<_Tp, _Allocator>::iterator __deque_base<_Tp, _Allocator>::end() noexcept { size_type __p = size() + __start_; __map_pointer __mp = __map_.begin() + __p / __block_size; return iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size); } template <class _Tp, class _Allocator> typename __deque_base<_Tp, _Allocator>::const_iterator __deque_base<_Tp, _Allocator>::end() const noexcept { size_type __p = size() + __start_; __map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __p / __block_size); return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size); } template <class _Tp, class _Allocator> inline __deque_base<_Tp, _Allocator>::__deque_base() noexcept(is_nothrow_default_constructible<allocator_type>::value) : __start_(0), __size_(0) {} template <class _Tp, class _Allocator> inline __deque_base<_Tp, _Allocator>::__deque_base(const allocator_type& __a) : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {} template <class _Tp, class _Allocator> __deque_base<_Tp, _Allocator>::~__deque_base() { clear(); typename __map::iterator __i = __map_.begin(); typename __map::iterator __e = __map_.end(); for (; __i != __e; ++__i) __alloc_traits::deallocate(__alloc(), *__i, __block_size); } template <class _Tp, class _Allocator> __deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c) noexcept(is_nothrow_move_constructible<allocator_type>::value) : __map_(std::__1::move(__c.__map_)), __start_(std::__1::move(__c.__start_)), __size_(std::__1::move(__c.__size_)) { __c.__start_ = 0; __c.size() = 0; } template <class _Tp, class _Allocator> __deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c, const allocator_type& __a) : __map_(std::__1::move(__c.__map_), __pointer_allocator(__a)), __start_(std::__1::move(__c.__start_)), __size_(std::__1::move(__c.size()), __a) { if (__a == __c.__alloc()) { __c.__start_ = 0; __c.size() = 0; } else { __map_.clear(); __start_ = 0; size() = 0; } } template <class _Tp, class _Allocator> void __deque_base<_Tp, _Allocator>::swap(__deque_base& __c) noexcept { __map_.swap(__c.__map_); std::__1::swap(__start_, __c.__start_); std::__1::swap(size(), __c.size()); __swap_allocator(__alloc(), __c.__alloc()); } template <class _Tp, class _Allocator> void __deque_base<_Tp, _Allocator>::clear() noexcept { allocator_type& __a = __alloc(); for (iterator __i = begin(), __e = end(); __i != __e; ++__i) __alloc_traits::destroy(__a, std::__1::addressof(*__i)); size() = 0; while (__map_.size() > 2) { __alloc_traits::deallocate(__a, __map_.front(), __block_size); __map_.pop_front(); } switch (__map_.size()) { case 1: __start_ = __block_size / 2; break; case 2: __start_ = __block_size; break; } } template <class _Tp, class _Allocator > class deque : private __deque_base<_Tp, _Allocator> { public: typedef _Tp value_type; typedef _Allocator allocator_type; static_assert((is_same<typename allocator_type::value_type, value_type>::value), "Allocator::value_type must be same type as value_type"); typedef __deque_base<value_type, allocator_type> __base; typedef typename __base::__alloc_traits __alloc_traits; typedef typename __base::reference reference; typedef typename __base::const_reference const_reference; typedef typename __base::iterator iterator; typedef typename __base::const_iterator const_iterator; typedef typename __base::size_type size_type; typedef typename __base::difference_type difference_type; typedef typename __base::pointer pointer; typedef typename __base::const_pointer const_pointer; typedef std::__1::reverse_iterator<iterator> reverse_iterator; typedef std::__1::reverse_iterator<const_iterator> const_reverse_iterator; using typename __base::__deque_range; using typename __base::__deque_block_range; using typename __base::_ConstructTransaction; __attribute__ ((__exclude_from_explicit_instantiation__)) deque() noexcept(is_nothrow_default_constructible<allocator_type>::value) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit deque(const allocator_type& __a) : __base(__a) {} explicit deque(size_type __n); explicit deque(size_type __n, const _Allocator& __a); deque(size_type __n, const value_type& __v); deque(size_type __n, const value_type& __v, const allocator_type& __a); template <class _InputIter> deque(_InputIter __f, _InputIter __l, typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0); template <class _InputIter> deque(_InputIter __f, _InputIter __l, const allocator_type& __a, typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0); deque(const deque& __c); deque(const deque& __c, const allocator_type& __a); deque& operator=(const deque& __c); deque(initializer_list<value_type> __il); deque(initializer_list<value_type> __il, const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) deque& operator=(initializer_list<value_type> __il) {assign(__il); return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) deque(deque&& __c) noexcept(is_nothrow_move_constructible<__base>::value); __attribute__ ((__exclude_from_explicit_instantiation__)) deque(deque&& __c, const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) deque& operator=(deque&& __c) noexcept(__alloc_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable<allocator_type>::value); __attribute__ ((__exclude_from_explicit_instantiation__)) void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());} template <class _InputIter> void assign(_InputIter __f, _InputIter __l, typename enable_if<__is_input_iterator<_InputIter>::value && !__is_random_access_iterator<_InputIter>::value>::type* = 0); template <class _RAIter> void assign(_RAIter __f, _RAIter __l, typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0); void assign(size_type __n, const value_type& __v); __attribute__ ((__exclude_from_explicit_instantiation__)) allocator_type get_allocator() const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) iterator begin() noexcept {return __base::begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator begin() const noexcept {return __base::begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator end() noexcept {return __base::end();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator end() const noexcept {return __base::end();} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator rbegin() noexcept {return reverse_iterator(__base::end());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator rbegin() const noexcept {return const_reverse_iterator(__base::end());} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator rend() noexcept {return reverse_iterator(__base::begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator rend() const noexcept {return const_reverse_iterator(__base::begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cbegin() const noexcept {return __base::begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cend() const noexcept {return __base::end();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator crbegin() const noexcept {return const_reverse_iterator(__base::end());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator crend() const noexcept {return const_reverse_iterator(__base::begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type size() const noexcept {return __base::size();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type max_size() const noexcept {return std::min<size_type>( __alloc_traits::max_size(__base::__alloc()), numeric_limits<difference_type>::max());} void resize(size_type __n); void resize(size_type __n, const value_type& __v); void shrink_to_fit() noexcept; [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) bool empty() const noexcept {return __base::size() == 0;} __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator[](size_type __i) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference operator[](size_type __i) const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) reference at(size_type __i); __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference at(size_type __i) const; __attribute__ ((__exclude_from_explicit_instantiation__)) reference front() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference front() const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) reference back() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference back() const noexcept; void push_front(const value_type& __v); void push_back(const value_type& __v); template <class... _Args> void emplace_front(_Args&&... __args); template <class... _Args> void emplace_back (_Args&&... __args); template <class... _Args> iterator emplace(const_iterator __p, _Args&&... __args); void push_front(value_type&& __v); void push_back(value_type&& __v); iterator insert(const_iterator __p, value_type&& __v); __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const_iterator __p, initializer_list<value_type> __il) {return insert(__p, __il.begin(), __il.end());} iterator insert(const_iterator __p, const value_type& __v); iterator insert(const_iterator __p, size_type __n, const value_type& __v); template <class _InputIter> iterator insert(const_iterator __p, _InputIter __f, _InputIter __l, typename enable_if<__is_input_iterator<_InputIter>::value &&!__is_forward_iterator<_InputIter>::value>::type* = 0); template <class _ForwardIterator> iterator insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l, typename enable_if<__is_forward_iterator<_ForwardIterator>::value &&!__is_bidirectional_iterator<_ForwardIterator>::value>::type* = 0); template <class _BiIter> iterator insert(const_iterator __p, _BiIter __f, _BiIter __l, typename enable_if<__is_bidirectional_iterator<_BiIter>::value>::type* = 0); void pop_front(); void pop_back(); iterator erase(const_iterator __p); iterator erase(const_iterator __f, const_iterator __l); __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(deque& __c) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) void clear() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) bool __invariants() const {return __base::__invariants();} typedef typename __base::__map_const_pointer __map_const_pointer; __attribute__ ((__exclude_from_explicit_instantiation__)) static size_type __recommend_blocks(size_type __n) { return __n / __base::__block_size + (__n % __base::__block_size != 0); } __attribute__ ((__exclude_from_explicit_instantiation__)) size_type __capacity() const { return __base::__map_.size() == 0 ? 0 : __base::__map_.size() * __base::__block_size - 1; } __attribute__ ((__exclude_from_explicit_instantiation__)) size_type __block_count() const { return __base::__map_.size(); } __attribute__ ((__exclude_from_explicit_instantiation__)) size_type __front_spare() const { return __base::__start_; } __attribute__ ((__exclude_from_explicit_instantiation__)) size_type __front_spare_blocks() const { return __front_spare() / __base::__block_size; } __attribute__ ((__exclude_from_explicit_instantiation__)) size_type __back_spare() const { return __capacity() - (__base::__start_ + __base::size()); } __attribute__ ((__exclude_from_explicit_instantiation__)) size_type __back_spare_blocks() const { return __back_spare() / __base::__block_size; } private: __attribute__ ((__exclude_from_explicit_instantiation__)) bool __maybe_remove_front_spare(bool __keep_one = true) { if (__front_spare_blocks() >= 2 || (!__keep_one && __front_spare_blocks())) { __alloc_traits::deallocate(__base::__alloc(), __base::__map_.front(), __base::__block_size); __base::__map_.pop_front(); __base::__start_ -= __base::__block_size; return true; } return false; } __attribute__ ((__exclude_from_explicit_instantiation__)) bool __maybe_remove_back_spare(bool __keep_one = true) { if (__back_spare_blocks() >= 2 || (!__keep_one && __back_spare_blocks())) { __alloc_traits::deallocate(__base::__alloc(), __base::__map_.back(), __base::__block_size); __base::__map_.pop_back(); return true; } return false; } template <class _InpIter> void __append(_InpIter __f, _InpIter __l, typename enable_if<__is_input_iterator<_InpIter>::value && !__is_forward_iterator<_InpIter>::value>::type* = 0); template <class _ForIter> void __append(_ForIter __f, _ForIter __l, typename enable_if<__is_forward_iterator<_ForIter>::value>::type* = 0); void __append(size_type __n); void __append(size_type __n, const value_type& __v); void __erase_to_end(const_iterator __f); void __add_front_capacity(); void __add_front_capacity(size_type __n); void __add_back_capacity(); void __add_back_capacity(size_type __n); iterator __move_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt); iterator __move_backward_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt); void __move_construct_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt); void __move_construct_backward_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt); __attribute__ ((__exclude_from_explicit_instantiation__)) void __copy_assign_alloc(const deque& __c) {__copy_assign_alloc(__c, integral_constant<bool, __alloc_traits::propagate_on_container_copy_assignment::value>());} __attribute__ ((__exclude_from_explicit_instantiation__)) void __copy_assign_alloc(const deque& __c, true_type) { if (__base::__alloc() != __c.__alloc()) { clear(); shrink_to_fit(); } __base::__alloc() = __c.__alloc(); __base::__map_.__alloc() = __c.__map_.__alloc(); } __attribute__ ((__exclude_from_explicit_instantiation__)) void __copy_assign_alloc(const deque&, false_type) {} void __move_assign(deque& __c, true_type) noexcept(is_nothrow_move_assignable<allocator_type>::value); void __move_assign(deque& __c, false_type); }; template <class _Tp, class _Allocator> deque<_Tp, _Allocator>::deque(size_type __n) { if (__n > 0) __append(__n); } template <class _Tp, class _Allocator> deque<_Tp, _Allocator>::deque(size_type __n, const _Allocator& __a) : __base(__a) { if (__n > 0) __append(__n); } template <class _Tp, class _Allocator> deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v) { if (__n > 0) __append(__n, __v); } template <class _Tp, class _Allocator> deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v, const allocator_type& __a) : __base(__a) { if (__n > 0) __append(__n, __v); } template <class _Tp, class _Allocator> template <class _InputIter> deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l, typename enable_if<__is_input_iterator<_InputIter>::value>::type*) { __append(__f, __l); } template <class _Tp, class _Allocator> template <class _InputIter> deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l, const allocator_type& __a, typename enable_if<__is_input_iterator<_InputIter>::value>::type*) : __base(__a) { __append(__f, __l); } template <class _Tp, class _Allocator> deque<_Tp, _Allocator>::deque(const deque& __c) : __base(__alloc_traits::select_on_container_copy_construction(__c.__alloc())) { __append(__c.begin(), __c.end()); } template <class _Tp, class _Allocator> deque<_Tp, _Allocator>::deque(const deque& __c, const allocator_type& __a) : __base(__a) { __append(__c.begin(), __c.end()); } template <class _Tp, class _Allocator> deque<_Tp, _Allocator>& deque<_Tp, _Allocator>::operator=(const deque& __c) { if (this != &__c) { __copy_assign_alloc(__c); assign(__c.begin(), __c.end()); } return *this; } template <class _Tp, class _Allocator> deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il) { __append(__il.begin(), __il.end()); } template <class _Tp, class _Allocator> deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il, const allocator_type& __a) : __base(__a) { __append(__il.begin(), __il.end()); } template <class _Tp, class _Allocator> inline deque<_Tp, _Allocator>::deque(deque&& __c) noexcept(is_nothrow_move_constructible<__base>::value) : __base(std::__1::move(__c)) { } template <class _Tp, class _Allocator> inline deque<_Tp, _Allocator>::deque(deque&& __c, const allocator_type& __a) : __base(std::__1::move(__c), __a) { if (__a != __c.__alloc()) { typedef move_iterator<iterator> _Ip; assign(_Ip(__c.begin()), _Ip(__c.end())); } } template <class _Tp, class _Allocator> inline deque<_Tp, _Allocator>& deque<_Tp, _Allocator>::operator=(deque&& __c) noexcept(__alloc_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable<allocator_type>::value) { __move_assign(__c, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>()); return *this; } template <class _Tp, class _Allocator> void deque<_Tp, _Allocator>::__move_assign(deque& __c, false_type) { if (__base::__alloc() != __c.__alloc()) { typedef move_iterator<iterator> _Ip; assign(_Ip(__c.begin()), _Ip(__c.end())); } else __move_assign(__c, true_type()); } template <class _Tp, class _Allocator> void deque<_Tp, _Allocator>::__move_assign(deque& __c, true_type) noexcept(is_nothrow_move_assignable<allocator_type>::value) { clear(); shrink_to_fit(); __base::__move_assign(__c); } template <class _Tp, class _Allocator> template <class _InputIter> void deque<_Tp, _Allocator>::assign(_InputIter __f, _InputIter __l, typename enable_if<__is_input_iterator<_InputIter>::value && !__is_random_access_iterator<_InputIter>::value>::type*) { iterator __i = __base::begin(); iterator __e = __base::end(); for (; __f != __l && __i != __e; ++__f, (void) ++__i) *__i = *__f; if (__f != __l) __append(__f, __l); else __erase_to_end(__i); } template <class _Tp, class _Allocator> template <class _RAIter> void deque<_Tp, _Allocator>::assign(_RAIter __f, _RAIter __l, typename enable_if<__is_random_access_iterator<_RAIter>::value>::type*) { if (static_cast<size_type>(__l - __f) > __base::size()) { _RAIter __m = __f + __base::size(); std::__1::copy(__f, __m, __base::begin()); __append(__m, __l); } else __erase_to_end(std::__1::copy(__f, __l, __base::begin())); } template <class _Tp, class _Allocator> void deque<_Tp, _Allocator>::assign(size_type __n, const value_type& __v) { if (__n > __base::size()) { std::__1::fill_n(__base::begin(), __base::size(), __v); __n -= __base::size(); __append(__n, __v); } else __erase_to_end(std::__1::fill_n(__base::begin(), __n, __v)); } template <class _Tp, class _Allocator> inline _Allocator deque<_Tp, _Allocator>::get_allocator() const noexcept { return __base::__alloc(); } template <class _Tp, class _Allocator> void deque<_Tp, _Allocator>::resize(size_type __n) { if (__n > __base::size()) __append(__n - __base::size()); else if (__n < __base::size()) __erase_to_end(__base::begin() + __n); } template <class _Tp, class _Allocator> void deque<_Tp, _Allocator>::resize(size_type __n, const value_type& __v) { if (__n > __base::size()) __append(__n - __base::size(), __v); else if (__n < __base::size()) __erase_to_end(__base::begin() + __n); } template <class _Tp, class _Allocator> void deque<_Tp, _Allocator>::shrink_to_fit() noexcept { allocator_type& __a = __base::__alloc(); if (empty()) { while (__base::__map_.size() > 0) { __alloc_traits::deallocate(__a, __base::__map_.back(), __base::__block_size); __base::__map_.pop_back(); } __base::__start_ = 0; } else { __maybe_remove_front_spare( false); __maybe_remove_back_spare( false); } __base::__map_.shrink_to_fit(); } template <class _Tp, class _Allocator> inline typename deque<_Tp, _Allocator>::reference deque<_Tp, _Allocator>::operator[](size_type __i) noexcept { size_type __p = __base::__start_ + __i; return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size); } template <class _Tp, class _Allocator> inline typename deque<_Tp, _Allocator>::const_reference deque<_Tp, _Allocator>::operator[](size_type __i) const noexcept { size_type __p = __base::__start_ + __i; return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size); } template <class _Tp, class _Allocator> inline typename deque<_Tp, _Allocator>::reference deque<_Tp, _Allocator>::at(size_type __i) { if (__i >= __base::size()) __base::__throw_out_of_range(); size_type __p = __base::__start_ + __i; return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size); } template <class _Tp, class _Allocator> inline typename deque<_Tp, _Allocator>::const_reference deque<_Tp, _Allocator>::at(size_type __i) const { if (__i >= __base::size()) __base::__throw_out_of_range(); size_type __p = __base::__start_ + __i; return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size); } template <class _Tp, class _Allocator> inline typename deque<_Tp, _Allocator>::reference deque<_Tp, _Allocator>::front() noexcept { return *(*(__base::__map_.begin() + __base::__start_ / __base::__block_size) + __base::__start_ % __base::__block_size); } template <class _Tp, class _Allocator> inline typename deque<_Tp, _Allocator>::const_reference deque<_Tp, _Allocator>::front() const noexcept { return *(*(__base::__map_.begin() + __base::__start_ / __base::__block_size) + __base::__start_ % __base::__block_size); } template <class _Tp, class _Allocator> inline typename deque<_Tp, _Allocator>::reference deque<_Tp, _Allocator>::back() noexcept { size_type __p = __base::size() + __base::__start_ - 1; return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size); } template <class _Tp, class _Allocator> inline typename deque<_Tp, _Allocator>::const_reference deque<_Tp, _Allocator>::back() const noexcept { size_type __p = __base::size() + __base::__start_ - 1; return *(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size); } template <class _Tp, class _Allocator> void deque<_Tp, _Allocator>::push_back(const value_type& __v) { allocator_type& __a = __base::__alloc(); if (__back_spare() == 0) __add_back_capacity(); __alloc_traits::construct(__a, std::__1::addressof(*__base::end()), __v); ++__base::size(); } template <class _Tp, class _Allocator> void deque<_Tp, _Allocator>::push_front(const value_type& __v) { allocator_type& __a = __base::__alloc(); if (__front_spare() == 0) __add_front_capacity(); __alloc_traits::construct(__a, std::__1::addressof(*--__base::begin()), __v); --__base::__start_; ++__base::size(); } template <class _Tp, class _Allocator> void deque<_Tp, _Allocator>::push_back(value_type&& __v) { allocator_type& __a = __base::__alloc(); if (__back_spare() == 0) __add_back_capacity(); __alloc_traits::construct(__a, std::__1::addressof(*__base::end()), std::__1::move(__v)); ++__base::size(); } template <class _Tp, class _Allocator> template <class... _Args> void deque<_Tp, _Allocator>::emplace_back(_Args&&... __args) { allocator_type& __a = __base::__alloc(); if (__back_spare() == 0) __add_back_capacity(); __alloc_traits::construct(__a, std::__1::addressof(*__base::end()), std::__1::forward<_Args>(__args)...); ++__base::size(); } template <class _Tp, class _Allocator> void deque<_Tp, _Allocator>::push_front(value_type&& __v) { allocator_type& __a = __base::__alloc(); if (__front_spare() == 0) __add_front_capacity(); __alloc_traits::construct(__a, std::__1::addressof(*--__base::begin()), std::__1::move(__v)); --__base::__start_; ++__base::size(); } template <class _Tp, class _Allocator> template <class... _Args> void deque<_Tp, _Allocator>::emplace_front(_Args&&... __args) { allocator_type& __a = __base::__alloc(); if (__front_spare() == 0) __add_front_capacity(); __alloc_traits::construct(__a, std::__1::addressof(*--__base::begin()), std::__1::forward<_Args>(__args)...); --__base::__start_; ++__base::size(); } template <class _Tp, class _Allocator> typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v) { size_type __pos = __p - __base::begin(); size_type __to_end = __base::size() - __pos; allocator_type& __a = __base::__alloc(); if (__pos < __to_end) { if (__front_spare() == 0) __add_front_capacity(); if (__pos == 0) { __alloc_traits::construct(__a, std::__1::addressof(*--__base::begin()), std::__1::move(__v)); --__base::__start_; ++__base::size(); } else { iterator __b = __base::begin(); iterator __bm1 = std::__1::prev(__b); __alloc_traits::construct(__a, std::__1::addressof(*__bm1), std::__1::move(*__b)); --__base::__start_; ++__base::size(); if (__pos > 1) __b = std::__1::move(std::__1::next(__b), __b + __pos, __b); *__b = std::__1::move(__v); } } else { if (__back_spare() == 0) __add_back_capacity(); size_type __de = __base::size() - __pos; if (__de == 0) { __alloc_traits::construct(__a, std::__1::addressof(*__base::end()), std::__1::move(__v)); ++__base::size(); } else { iterator __e = __base::end(); iterator __em1 = std::__1::prev(__e); __alloc_traits::construct(__a, std::__1::addressof(*__e), std::__1::move(*__em1)); ++__base::size(); if (__de > 1) __e = std::__1::move_backward(__e - __de, __em1, __e); *--__e = std::__1::move(__v); } } return __base::begin() + __pos; } template <class _Tp, class _Allocator> template <class... _Args> typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args) { size_type __pos = __p - __base::begin(); size_type __to_end = __base::size() - __pos; allocator_type& __a = __base::__alloc(); if (__pos < __to_end) { if (__front_spare() == 0) __add_front_capacity(); if (__pos == 0) { __alloc_traits::construct(__a, std::__1::addressof(*--__base::begin()), std::__1::forward<_Args>(__args)...); --__base::__start_; ++__base::size(); } else { __temp_value<value_type, _Allocator> __tmp(this->__alloc(), std::__1::forward<_Args>(__args)...); iterator __b = __base::begin(); iterator __bm1 = std::__1::prev(__b); __alloc_traits::construct(__a, std::__1::addressof(*__bm1), std::__1::move(*__b)); --__base::__start_; ++__base::size(); if (__pos > 1) __b = std::__1::move(std::__1::next(__b), __b + __pos, __b); *__b = std::__1::move(__tmp.get()); } } else { if (__back_spare() == 0) __add_back_capacity(); size_type __de = __base::size() - __pos; if (__de == 0) { __alloc_traits::construct(__a, std::__1::addressof(*__base::end()), std::__1::forward<_Args>(__args)...); ++__base::size(); } else { __temp_value<value_type, _Allocator> __tmp(this->__alloc(), std::__1::forward<_Args>(__args)...); iterator __e = __base::end(); iterator __em1 = std::__1::prev(__e); __alloc_traits::construct(__a, std::__1::addressof(*__e), std::__1::move(*__em1)); ++__base::size(); if (__de > 1) __e = std::__1::move_backward(__e - __de, __em1, __e); *--__e = std::__1::move(__tmp.get()); } } return __base::begin() + __pos; } template <class _Tp, class _Allocator> typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v) { size_type __pos = __p - __base::begin(); size_type __to_end = __base::size() - __pos; allocator_type& __a = __base::__alloc(); if (__pos < __to_end) { if (__front_spare() == 0) __add_front_capacity(); if (__pos == 0) { __alloc_traits::construct(__a, std::__1::addressof(*--__base::begin()), __v); --__base::__start_; ++__base::size(); } else { const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v); iterator __b = __base::begin(); iterator __bm1 = std::__1::prev(__b); if (__vt == pointer_traits<const_pointer>::pointer_to(*__b)) __vt = pointer_traits<const_pointer>::pointer_to(*__bm1); __alloc_traits::construct(__a, std::__1::addressof(*__bm1), std::__1::move(*__b)); --__base::__start_; ++__base::size(); if (__pos > 1) __b = __move_and_check(std::__1::next(__b), __b + __pos, __b, __vt); *__b = *__vt; } } else { if (__back_spare() == 0) __add_back_capacity(); size_type __de = __base::size() - __pos; if (__de == 0) { __alloc_traits::construct(__a, std::__1::addressof(*__base::end()), __v); ++__base::size(); } else { const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v); iterator __e = __base::end(); iterator __em1 = std::__1::prev(__e); if (__vt == pointer_traits<const_pointer>::pointer_to(*__em1)) __vt = pointer_traits<const_pointer>::pointer_to(*__e); __alloc_traits::construct(__a, std::__1::addressof(*__e), std::__1::move(*__em1)); ++__base::size(); if (__de > 1) __e = __move_backward_and_check(__e - __de, __em1, __e, __vt); *--__e = *__vt; } } return __base::begin() + __pos; } template <class _Tp, class _Allocator> typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_type& __v) { size_type __pos = __p - __base::begin(); size_type __to_end = __base::size() - __pos; allocator_type& __a = __base::__alloc(); if (__pos < __to_end) { if (__n > __front_spare()) __add_front_capacity(__n - __front_spare()); iterator __old_begin = __base::begin(); iterator __i = __old_begin; if (__n > __pos) { for (size_type __m = __n - __pos; __m; --__m, --__base::__start_, ++__base::size()) __alloc_traits::construct(__a, std::__1::addressof(*--__i), __v); __n = __pos; } if (__n > 0) { const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v); iterator __obn = __old_begin + __n; __move_construct_backward_and_check(__old_begin, __obn, __i, __vt); if (__n < __pos) __old_begin = __move_and_check(__obn, __old_begin + __pos, __old_begin, __vt); std::__1::fill_n(__old_begin, __n, *__vt); } } else { size_type __back_capacity = __back_spare(); if (__n > __back_capacity) __add_back_capacity(__n - __back_capacity); iterator __old_end = __base::end(); iterator __i = __old_end; size_type __de = __base::size() - __pos; if (__n > __de) { for (size_type __m = __n - __de; __m; --__m, ++__i, ++__base::size()) __alloc_traits::construct(__a, std::__1::addressof(*__i), __v); __n = __de; } if (__n > 0) { const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v); iterator __oen = __old_end - __n; __move_construct_and_check(__oen, __old_end, __i, __vt); if (__n < __de) __old_end = __move_backward_and_check(__old_end - __de, __oen, __old_end, __vt); std::__1::fill_n(__old_end - __n, __n, *__vt); } } return __base::begin() + __pos; } template <class _Tp, class _Allocator> template <class _InputIter> typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::insert(const_iterator __p, _InputIter __f, _InputIter __l, typename enable_if<__is_input_iterator<_InputIter>::value &&!__is_forward_iterator<_InputIter>::value>::type*) { __split_buffer<value_type, allocator_type&> __buf(__base::__alloc()); __buf.__construct_at_end(__f, __l); typedef typename __split_buffer<value_type, allocator_type&>::iterator __bi; return insert(__p, move_iterator<__bi>(__buf.begin()), move_iterator<__bi>(__buf.end())); } template <class _Tp, class _Allocator> template <class _ForwardIterator> typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l, typename enable_if<__is_forward_iterator<_ForwardIterator>::value &&!__is_bidirectional_iterator<_ForwardIterator>::value>::type*) { size_type __n = std::__1::distance(__f, __l); __split_buffer<value_type, allocator_type&> __buf(__n, 0, __base::__alloc()); __buf.__construct_at_end(__f, __l); typedef typename __split_buffer<value_type, allocator_type&>::iterator __fwd; return insert(__p, move_iterator<__fwd>(__buf.begin()), move_iterator<__fwd>(__buf.end())); } template <class _Tp, class _Allocator> template <class _BiIter> typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l, typename enable_if<__is_bidirectional_iterator<_BiIter>::value>::type*) { size_type __n = std::__1::distance(__f, __l); size_type __pos = __p - __base::begin(); size_type __to_end = __base::size() - __pos; allocator_type& __a = __base::__alloc(); if (__pos < __to_end) { if (__n > __front_spare()) __add_front_capacity(__n - __front_spare()); iterator __old_begin = __base::begin(); iterator __i = __old_begin; _BiIter __m = __f; if (__n > __pos) { __m = __pos < __n / 2 ? std::__1::prev(__l, __pos) : std::__1::next(__f, __n - __pos); for (_BiIter __j = __m; __j != __f; --__base::__start_, ++__base::size()) __alloc_traits::construct(__a, std::__1::addressof(*--__i), *--__j); __n = __pos; } if (__n > 0) { iterator __obn = __old_begin + __n; for (iterator __j = __obn; __j != __old_begin;) { __alloc_traits::construct(__a, std::__1::addressof(*--__i), std::__1::move(*--__j)); --__base::__start_; ++__base::size(); } if (__n < __pos) __old_begin = std::__1::move(__obn, __old_begin + __pos, __old_begin); std::__1::copy(__m, __l, __old_begin); } } else { size_type __back_capacity = __back_spare(); if (__n > __back_capacity) __add_back_capacity(__n - __back_capacity); iterator __old_end = __base::end(); iterator __i = __old_end; _BiIter __m = __l; size_type __de = __base::size() - __pos; if (__n > __de) { __m = __de < __n / 2 ? std::__1::next(__f, __de) : std::__1::prev(__l, __n - __de); for (_BiIter __j = __m; __j != __l; ++__i, (void) ++__j, ++__base::size()) __alloc_traits::construct(__a, std::__1::addressof(*__i), *__j); __n = __de; } if (__n > 0) { iterator __oen = __old_end - __n; for (iterator __j = __oen; __j != __old_end; ++__i, ++__j, ++__base::size()) __alloc_traits::construct(__a, std::__1::addressof(*__i), std::__1::move(*__j)); if (__n < __de) __old_end = std::__1::move_backward(__old_end - __de, __oen, __old_end); std::__1::copy_backward(__f, __m, __old_end); } } return __base::begin() + __pos; } template <class _Tp, class _Allocator> template <class _InpIter> void deque<_Tp, _Allocator>::__append(_InpIter __f, _InpIter __l, typename enable_if<__is_input_iterator<_InpIter>::value && !__is_forward_iterator<_InpIter>::value>::type*) { for (; __f != __l; ++__f) emplace_back(*__f); } template <class _Tp, class _Allocator> template <class _ForIter> void deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l, typename enable_if<__is_forward_iterator<_ForIter>::value>::type*) { size_type __n = std::__1::distance(__f, __l); allocator_type& __a = __base::__alloc(); size_type __back_capacity = __back_spare(); if (__n > __back_capacity) __add_back_capacity(__n - __back_capacity); for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) { _ConstructTransaction __tx(this, __br); for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, (void)++__f) { __alloc_traits::construct(__a, std::__to_raw_pointer(__tx.__pos_), *__f); } } } template <class _Tp, class _Allocator> void deque<_Tp, _Allocator>::__append(size_type __n) { allocator_type& __a = __base::__alloc(); size_type __back_capacity = __back_spare(); if (__n > __back_capacity) __add_back_capacity(__n - __back_capacity); for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) { _ConstructTransaction __tx(this, __br); for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) { __alloc_traits::construct(__a, std::__to_raw_pointer(__tx.__pos_)); } } } template <class _Tp, class _Allocator> void deque<_Tp, _Allocator>::__append(size_type __n, const value_type& __v) { allocator_type& __a = __base::__alloc(); size_type __back_capacity = __back_spare(); if (__n > __back_capacity) __add_back_capacity(__n - __back_capacity); for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) { _ConstructTransaction __tx(this, __br); for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) { __alloc_traits::construct(__a, std::__to_raw_pointer(__tx.__pos_), __v); } } } template <class _Tp, class _Allocator> void deque<_Tp, _Allocator>::__add_front_capacity() { allocator_type& __a = __base::__alloc(); if (__back_spare() >= __base::__block_size) { __base::__start_ += __base::__block_size; pointer __pt = __base::__map_.back(); __base::__map_.pop_back(); __base::__map_.push_front(__pt); } else if (__base::__map_.size() < __base::__map_.capacity()) { if (__base::__map_.__front_spare() > 0) __base::__map_.push_front(__alloc_traits::allocate(__a, __base::__block_size)); else { __base::__map_.push_back(__alloc_traits::allocate(__a, __base::__block_size)); pointer __pt = __base::__map_.back(); __base::__map_.pop_back(); __base::__map_.push_front(__pt); } __base::__start_ = __base::__map_.size() == 1 ? __base::__block_size / 2 : __base::__start_ + __base::__block_size; } else { __split_buffer<pointer, typename __base::__pointer_allocator&> __buf(max<size_type>(2 * __base::__map_.capacity(), 1), 0, __base::__map_.__alloc()); typedef __allocator_destructor<_Allocator> _Dp; unique_ptr<pointer, _Dp> __hold( __alloc_traits::allocate(__a, __base::__block_size), _Dp(__a, __base::__block_size)); __buf.push_back(__hold.get()); __hold.release(); for (typename __base::__map_pointer __i = __base::__map_.begin(); __i != __base::__map_.end(); ++__i) __buf.push_back(*__i); std::__1::swap(__base::__map_.__first_, __buf.__first_); std::__1::swap(__base::__map_.__begin_, __buf.__begin_); std::__1::swap(__base::__map_.__end_, __buf.__end_); std::__1::swap(__base::__map_.__end_cap(), __buf.__end_cap()); __base::__start_ = __base::__map_.size() == 1 ? __base::__block_size / 2 : __base::__start_ + __base::__block_size; } } template <class _Tp, class _Allocator> void deque<_Tp, _Allocator>::__add_front_capacity(size_type __n) { allocator_type& __a = __base::__alloc(); size_type __nb = __recommend_blocks(__n + __base::__map_.empty()); size_type __back_capacity = __back_spare() / __base::__block_size; __back_capacity = std::__1::min(__back_capacity, __nb); __nb -= __back_capacity; if (__nb == 0) { __base::__start_ += __base::__block_size * __back_capacity; for (; __back_capacity > 0; --__back_capacity) { pointer __pt = __base::__map_.back(); __base::__map_.pop_back(); __base::__map_.push_front(__pt); } } else if (__nb <= __base::__map_.capacity() - __base::__map_.size()) { for (; __nb > 0; --__nb, __base::__start_ += __base::__block_size - (__base::__map_.size() == 1)) { if (__base::__map_.__front_spare() == 0) break; __base::__map_.push_front(__alloc_traits::allocate(__a, __base::__block_size)); } for (; __nb > 0; --__nb, ++__back_capacity) __base::__map_.push_back(__alloc_traits::allocate(__a, __base::__block_size)); __base::__start_ += __back_capacity * __base::__block_size; for (; __back_capacity > 0; --__back_capacity) { pointer __pt = __base::__map_.back(); __base::__map_.pop_back(); __base::__map_.push_front(__pt); } } else { size_type __ds = (__nb + __back_capacity) * __base::__block_size - __base::__map_.empty(); __split_buffer<pointer, typename __base::__pointer_allocator&> __buf(max<size_type>(2* __base::__map_.capacity(), __nb + __base::__map_.size()), 0, __base::__map_.__alloc()); for (; __nb > 0; --__nb) __buf.push_back(__alloc_traits::allocate(__a, __base::__block_size)); for (; __back_capacity > 0; --__back_capacity) { __buf.push_back(__base::__map_.back()); __base::__map_.pop_back(); } for (typename __base::__map_pointer __i = __base::__map_.begin(); __i != __base::__map_.end(); ++__i) __buf.push_back(*__i); std::__1::swap(__base::__map_.__first_, __buf.__first_); std::__1::swap(__base::__map_.__begin_, __buf.__begin_); std::__1::swap(__base::__map_.__end_, __buf.__end_); std::__1::swap(__base::__map_.__end_cap(), __buf.__end_cap()); __base::__start_ += __ds; } } template <class _Tp, class _Allocator> void deque<_Tp, _Allocator>::__add_back_capacity() { allocator_type& __a = __base::__alloc(); if (__front_spare() >= __base::__block_size) { __base::__start_ -= __base::__block_size; pointer __pt = __base::__map_.front(); __base::__map_.pop_front(); __base::__map_.push_back(__pt); } else if (__base::__map_.size() < __base::__map_.capacity()) { if (__base::__map_.__back_spare() != 0) __base::__map_.push_back(__alloc_traits::allocate(__a, __base::__block_size)); else { __base::__map_.push_front(__alloc_traits::allocate(__a, __base::__block_size)); pointer __pt = __base::__map_.front(); __base::__map_.pop_front(); __base::__map_.push_back(__pt); } } else { __split_buffer<pointer, typename __base::__pointer_allocator&> __buf(max<size_type>(2* __base::__map_.capacity(), 1), __base::__map_.size(), __base::__map_.__alloc()); typedef __allocator_destructor<_Allocator> _Dp; unique_ptr<pointer, _Dp> __hold( __alloc_traits::allocate(__a, __base::__block_size), _Dp(__a, __base::__block_size)); __buf.push_back(__hold.get()); __hold.release(); for (typename __base::__map_pointer __i = __base::__map_.end(); __i != __base::__map_.begin();) __buf.push_front(*--__i); std::__1::swap(__base::__map_.__first_, __buf.__first_); std::__1::swap(__base::__map_.__begin_, __buf.__begin_); std::__1::swap(__base::__map_.__end_, __buf.__end_); std::__1::swap(__base::__map_.__end_cap(), __buf.__end_cap()); } } template <class _Tp, class _Allocator> void deque<_Tp, _Allocator>::__add_back_capacity(size_type __n) { allocator_type& __a = __base::__alloc(); size_type __nb = __recommend_blocks(__n + __base::__map_.empty()); size_type __front_capacity = __front_spare() / __base::__block_size; __front_capacity = std::__1::min(__front_capacity, __nb); __nb -= __front_capacity; if (__nb == 0) { __base::__start_ -= __base::__block_size * __front_capacity; for (; __front_capacity > 0; --__front_capacity) { pointer __pt = __base::__map_.front(); __base::__map_.pop_front(); __base::__map_.push_back(__pt); } } else if (__nb <= __base::__map_.capacity() - __base::__map_.size()) { for (; __nb > 0; --__nb) { if (__base::__map_.__back_spare() == 0) break; __base::__map_.push_back(__alloc_traits::allocate(__a, __base::__block_size)); } for (; __nb > 0; --__nb, ++__front_capacity, __base::__start_ += __base::__block_size - (__base::__map_.size() == 1)) __base::__map_.push_front(__alloc_traits::allocate(__a, __base::__block_size)); __base::__start_ -= __base::__block_size * __front_capacity; for (; __front_capacity > 0; --__front_capacity) { pointer __pt = __base::__map_.front(); __base::__map_.pop_front(); __base::__map_.push_back(__pt); } } else { size_type __ds = __front_capacity * __base::__block_size; __split_buffer<pointer, typename __base::__pointer_allocator&> __buf(max<size_type>(2* __base::__map_.capacity(), __nb + __base::__map_.size()), __base::__map_.size() - __front_capacity, __base::__map_.__alloc()); for (; __nb > 0; --__nb) __buf.push_back(__alloc_traits::allocate(__a, __base::__block_size)); for (; __front_capacity > 0; --__front_capacity) { __buf.push_back(__base::__map_.front()); __base::__map_.pop_front(); } for (typename __base::__map_pointer __i = __base::__map_.end(); __i != __base::__map_.begin();) __buf.push_front(*--__i); std::__1::swap(__base::__map_.__first_, __buf.__first_); std::__1::swap(__base::__map_.__begin_, __buf.__begin_); std::__1::swap(__base::__map_.__end_, __buf.__end_); std::__1::swap(__base::__map_.__end_cap(), __buf.__end_cap()); __base::__start_ -= __ds; } } template <class _Tp, class _Allocator> void deque<_Tp, _Allocator>::pop_front() { allocator_type& __a = __base::__alloc(); __alloc_traits::destroy(__a, __to_raw_pointer(*(__base::__map_.begin() + __base::__start_ / __base::__block_size) + __base::__start_ % __base::__block_size)); --__base::size(); ++__base::__start_; __maybe_remove_front_spare(); } template <class _Tp, class _Allocator> void deque<_Tp, _Allocator>::pop_back() { ((void)0); allocator_type& __a = __base::__alloc(); size_type __p = __base::size() + __base::__start_ - 1; __alloc_traits::destroy(__a, __to_raw_pointer(*(__base::__map_.begin() + __p / __base::__block_size) + __p % __base::__block_size)); --__base::size(); __maybe_remove_back_spare(); } template <class _Tp, class _Allocator> typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::__move_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt) { difference_type __n = __l - __f; while (__n > 0) { pointer __fb = __f.__ptr_; pointer __fe = *__f.__m_iter_ + __base::__block_size; difference_type __bs = __fe - __fb; if (__bs > __n) { __bs = __n; __fe = __fb + __bs; } if (__fb <= __vt && __vt < __fe) __vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) -= __f - __r).__ptr_; __r = std::__1::move(__fb, __fe, __r); __n -= __bs; __f += __bs; } return __r; } template <class _Tp, class _Allocator> typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::__move_backward_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt) { difference_type __n = __l - __f; while (__n > 0) { --__l; pointer __lb = *__l.__m_iter_; pointer __le = __l.__ptr_ + 1; difference_type __bs = __le - __lb; if (__bs > __n) { __bs = __n; __lb = __le - __bs; } if (__lb <= __vt && __vt < __le) __vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) += __r - __l - 1).__ptr_; __r = std::__1::move_backward(__lb, __le, __r); __n -= __bs; __l -= __bs - 1; } return __r; } template <class _Tp, class _Allocator> void deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt) { allocator_type& __a = __base::__alloc(); difference_type __n = __l - __f; while (__n > 0) { pointer __fb = __f.__ptr_; pointer __fe = *__f.__m_iter_ + __base::__block_size; difference_type __bs = __fe - __fb; if (__bs > __n) { __bs = __n; __fe = __fb + __bs; } if (__fb <= __vt && __vt < __fe) __vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) += __r - __f).__ptr_; for (; __fb != __fe; ++__fb, ++__r, ++__base::size()) __alloc_traits::construct(__a, std::__1::addressof(*__r), std::__1::move(*__fb)); __n -= __bs; __f += __bs; } } template <class _Tp, class _Allocator> void deque<_Tp, _Allocator>::__move_construct_backward_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt) { allocator_type& __a = __base::__alloc(); difference_type __n = __l - __f; while (__n > 0) { --__l; pointer __lb = *__l.__m_iter_; pointer __le = __l.__ptr_ + 1; difference_type __bs = __le - __lb; if (__bs > __n) { __bs = __n; __lb = __le - __bs; } if (__lb <= __vt && __vt < __le) __vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) -= __l - __r + 1).__ptr_; while (__le != __lb) { __alloc_traits::construct(__a, std::__1::addressof(*--__r), std::__1::move(*--__le)); --__base::__start_; ++__base::size(); } __n -= __bs; __l -= __bs - 1; } } template <class _Tp, class _Allocator> typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::erase(const_iterator __f) { iterator __b = __base::begin(); difference_type __pos = __f - __b; iterator __p = __b + __pos; allocator_type& __a = __base::__alloc(); if (static_cast<size_t>(__pos) <= (__base::size() - 1) / 2) { std::__1::move_backward(__b, __p, std::__1::next(__p)); __alloc_traits::destroy(__a, std::__1::addressof(*__b)); --__base::size(); ++__base::__start_; __maybe_remove_front_spare(); } else { iterator __i = std::__1::move(std::__1::next(__p), __base::end(), __p); __alloc_traits::destroy(__a, std::__1::addressof(*__i)); --__base::size(); __maybe_remove_back_spare(); } return __base::begin() + __pos; } template <class _Tp, class _Allocator> typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l) { difference_type __n = __l - __f; iterator __b = __base::begin(); difference_type __pos = __f - __b; iterator __p = __b + __pos; if (__n > 0) { allocator_type& __a = __base::__alloc(); if (static_cast<size_t>(__pos) <= (__base::size() - __n) / 2) { iterator __i = std::__1::move_backward(__b, __p, __p + __n); for (; __b != __i; ++__b) __alloc_traits::destroy(__a, std::__1::addressof(*__b)); __base::size() -= __n; __base::__start_ += __n; while (__maybe_remove_front_spare()) { } } else { iterator __i = std::__1::move(__p + __n, __base::end(), __p); for (iterator __e = __base::end(); __i != __e; ++__i) __alloc_traits::destroy(__a, std::__1::addressof(*__i)); __base::size() -= __n; while (__maybe_remove_back_spare()) { } } } return __base::begin() + __pos; } template <class _Tp, class _Allocator> void deque<_Tp, _Allocator>::__erase_to_end(const_iterator __f) { iterator __e = __base::end(); difference_type __n = __e - __f; if (__n > 0) { allocator_type& __a = __base::__alloc(); iterator __b = __base::begin(); difference_type __pos = __f - __b; for (iterator __p = __b + __pos; __p != __e; ++__p) __alloc_traits::destroy(__a, std::__1::addressof(*__p)); __base::size() -= __n; while (__maybe_remove_back_spare()) { } } } template <class _Tp, class _Allocator> inline void deque<_Tp, _Allocator>::swap(deque& __c) noexcept { __base::swap(__c); } template <class _Tp, class _Allocator> inline void deque<_Tp, _Allocator>::clear() noexcept { __base::clear(); } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) { const typename deque<_Tp, _Allocator>::size_type __sz = __x.size(); return __sz == __y.size() && std::__1::equal(__x.begin(), __x.end(), __y.begin()); } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) { return !(__x == __y); } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator< (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) { return std::__1::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator> (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) { return __y < __x; } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) { return !(__x < __y); } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) { return !(__y < __x); } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } } } namespace std { inline namespace __1 { template <class _Tp, class _Container = deque<_Tp> > class stack; template <class _Tp, class _Container> __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y); template <class _Tp, class _Container> __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y); template <class _Tp, class _Container > class stack { public: typedef _Container container_type; typedef typename container_type::value_type value_type; typedef typename container_type::reference reference; typedef typename container_type::const_reference const_reference; typedef typename container_type::size_type size_type; static_assert((is_same<_Tp, value_type>::value), "" ); protected: container_type c; public: __attribute__ ((__exclude_from_explicit_instantiation__)) stack() noexcept(is_nothrow_default_constructible<container_type>::value) : c() {} __attribute__ ((__exclude_from_explicit_instantiation__)) stack(const stack& __q) : c(__q.c) {} __attribute__ ((__exclude_from_explicit_instantiation__)) stack& operator=(const stack& __q) {c = __q.c; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) stack(stack&& __q) noexcept(is_nothrow_move_constructible<container_type>::value) : c(std::__1::move(__q.c)) {} __attribute__ ((__exclude_from_explicit_instantiation__)) stack& operator=(stack&& __q) noexcept(is_nothrow_move_assignable<container_type>::value) {c = std::__1::move(__q.c); return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit stack(container_type&& __c) : c(std::__1::move(__c)) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit stack(const container_type& __c) : c(__c) {} template <class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) explicit stack(const _Alloc& __a, typename enable_if<uses_allocator<container_type, _Alloc>::value>::type* = 0) : c(__a) {} template <class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) stack(const container_type& __c, const _Alloc& __a, typename enable_if<uses_allocator<container_type, _Alloc>::value>::type* = 0) : c(__c, __a) {} template <class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) stack(const stack& __s, const _Alloc& __a, typename enable_if<uses_allocator<container_type, _Alloc>::value>::type* = 0) : c(__s.c, __a) {} template <class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) stack(container_type&& __c, const _Alloc& __a, typename enable_if<uses_allocator<container_type, _Alloc>::value>::type* = 0) : c(std::__1::move(__c), __a) {} template <class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) stack(stack&& __s, const _Alloc& __a, typename enable_if<uses_allocator<container_type, _Alloc>::value>::type* = 0) : c(std::__1::move(__s.c), __a) {} [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) bool empty() const {return c.empty();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type size() const {return c.size();} __attribute__ ((__exclude_from_explicit_instantiation__)) reference top() {return c.back();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference top() const {return c.back();} __attribute__ ((__exclude_from_explicit_instantiation__)) void push(const value_type& __v) {c.push_back(__v);} __attribute__ ((__exclude_from_explicit_instantiation__)) void push(value_type&& __v) {c.push_back(std::__1::move(__v));} template <class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) void emplace(_Args&&... __args) { c.emplace_back(std::__1::forward<_Args>(__args)...);} __attribute__ ((__exclude_from_explicit_instantiation__)) void pop() {c.pop_back();} __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(stack& __s) noexcept(__is_nothrow_swappable<container_type>::value) { using std::__1::swap; swap(c, __s.c); } template <class T1, class _C1> friend bool operator==(const stack<T1, _C1>& __x, const stack<T1, _C1>& __y); template <class T1, class _C1> friend bool operator< (const stack<T1, _C1>& __x, const stack<T1, _C1>& __y); }; template <class _Tp, class _Container> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) { return __x.c == __y.c; } template <class _Tp, class _Container> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) { return __x.c < __y.c; } template <class _Tp, class _Container> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) { return !(__x == __y); } template <class _Tp, class _Container> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator> (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) { return __y < __x; } template <class _Tp, class _Container> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) { return !(__x < __y); } template <class _Tp, class _Container> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) { return !(__y < __x); } template <class _Tp, class _Container> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if< __is_swappable<_Container>::value, void >::type swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } template <class _Tp, class _Container, class _Alloc> struct uses_allocator<stack<_Tp, _Container>, _Alloc> : public uses_allocator<_Container, _Alloc> { }; } } namespace std { inline namespace __1 { class __iom_t1 { ios_base::fmtflags __mask_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __iom_t1(ios_base::fmtflags __m) : __mask_(__m) {} template <class _CharT, class _Traits> friend __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t1& __x) { __is.unsetf(__x.__mask_); return __is; } template <class _CharT, class _Traits> friend __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t1& __x) { __os.unsetf(__x.__mask_); return __os; } }; inline __attribute__ ((__exclude_from_explicit_instantiation__)) __iom_t1 resetiosflags(ios_base::fmtflags __mask) { return __iom_t1(__mask); } class __iom_t2 { ios_base::fmtflags __mask_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __iom_t2(ios_base::fmtflags __m) : __mask_(__m) {} template <class _CharT, class _Traits> friend __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t2& __x) { __is.setf(__x.__mask_); return __is; } template <class _CharT, class _Traits> friend __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t2& __x) { __os.setf(__x.__mask_); return __os; } }; inline __attribute__ ((__exclude_from_explicit_instantiation__)) __iom_t2 setiosflags(ios_base::fmtflags __mask) { return __iom_t2(__mask); } class __iom_t3 { int __base_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __iom_t3(int __b) : __base_(__b) {} template <class _CharT, class _Traits> friend __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t3& __x) { __is.setf(__x.__base_ == 8 ? ios_base::oct : __x.__base_ == 10 ? ios_base::dec : __x.__base_ == 16 ? ios_base::hex : ios_base::fmtflags(0), ios_base::basefield); return __is; } template <class _CharT, class _Traits> friend __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t3& __x) { __os.setf(__x.__base_ == 8 ? ios_base::oct : __x.__base_ == 10 ? ios_base::dec : __x.__base_ == 16 ? ios_base::hex : ios_base::fmtflags(0), ios_base::basefield); return __os; } }; inline __attribute__ ((__exclude_from_explicit_instantiation__)) __iom_t3 setbase(int __base) { return __iom_t3(__base); } template<class _CharT> class __iom_t4 { _CharT __fill_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __iom_t4(_CharT __c) : __fill_(__c) {} template <class _Traits> friend __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t4& __x) { __os.fill(__x.__fill_); return __os; } }; template<class _CharT> inline __attribute__ ((__exclude_from_explicit_instantiation__)) __iom_t4<_CharT> setfill(_CharT __c) { return __iom_t4<_CharT>(__c); } class __iom_t5 { int __n_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __iom_t5(int __n) : __n_(__n) {} template <class _CharT, class _Traits> friend __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t5& __x) { __is.precision(__x.__n_); return __is; } template <class _CharT, class _Traits> friend __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t5& __x) { __os.precision(__x.__n_); return __os; } }; inline __attribute__ ((__exclude_from_explicit_instantiation__)) __iom_t5 setprecision(int __n) { return __iom_t5(__n); } class __iom_t6 { int __n_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __iom_t6(int __n) : __n_(__n) {} template <class _CharT, class _Traits> friend __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t6& __x) { __is.width(__x.__n_); return __is; } template <class _CharT, class _Traits> friend __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t6& __x) { __os.width(__x.__n_); return __os; } }; inline __attribute__ ((__exclude_from_explicit_instantiation__)) __iom_t6 setw(int __n) { return __iom_t6(__n); } template <class _MoneyT> class __iom_t7; template <class _CharT, class _Traits, class _MoneyT> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x); template <class _MoneyT> class __iom_t7 { _MoneyT& __mon_; bool __intl_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) __iom_t7(_MoneyT& __mon, bool __intl) : __mon_(__mon), __intl_(__intl) {} template <class _CharT, class _Traits, class _Mp> friend basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_Mp>& __x); }; template <class _CharT, class _Traits, class _MoneyT> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x) { typename basic_istream<_CharT, _Traits>::sentry __s(__is); if (__s) { typedef istreambuf_iterator<_CharT, _Traits> _Ip; typedef money_get<_CharT, _Ip> _Fp; ios_base::iostate __err = ios_base::goodbit; const _Fp& __mf = use_facet<_Fp>(__is.getloc()); __mf.get(_Ip(__is), _Ip(), __x.__intl_, __is, __err, __x.__mon_); __is.setstate(__err); } return __is; } template <class _MoneyT> inline __attribute__ ((__exclude_from_explicit_instantiation__)) __iom_t7<_MoneyT> get_money(_MoneyT& __mon, bool __intl = false) { return __iom_t7<_MoneyT>(__mon, __intl); } template <class _MoneyT> class __iom_t8; template <class _CharT, class _Traits, class _MoneyT> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x); template <class _MoneyT> class __iom_t8 { const _MoneyT& __mon_; bool __intl_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) __iom_t8(const _MoneyT& __mon, bool __intl) : __mon_(__mon), __intl_(__intl) {} template <class _CharT, class _Traits, class _Mp> friend basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_Mp>& __x); }; template <class _CharT, class _Traits, class _MoneyT> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x) { typename basic_ostream<_CharT, _Traits>::sentry __s(__os); if (__s) { typedef ostreambuf_iterator<_CharT, _Traits> _Op; typedef money_put<_CharT, _Op> _Fp; const _Fp& __mf = use_facet<_Fp>(__os.getloc()); if (__mf.put(_Op(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed()) __os.setstate(ios_base::badbit); } return __os; } template <class _MoneyT> inline __attribute__ ((__exclude_from_explicit_instantiation__)) __iom_t8<_MoneyT> put_money(const _MoneyT& __mon, bool __intl = false) { return __iom_t8<_MoneyT>(__mon, __intl); } template <class _CharT> class __iom_t9; template <class _CharT, class _Traits> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x); template <class _CharT> class __iom_t9 { tm* __tm_; const _CharT* __fmt_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) __iom_t9(tm* __tm, const _CharT* __fmt) : __tm_(__tm), __fmt_(__fmt) {} template <class _Cp, class _Traits> friend basic_istream<_Cp, _Traits>& operator>>(basic_istream<_Cp, _Traits>& __is, const __iom_t9<_Cp>& __x); }; template <class _CharT, class _Traits> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x) { typename basic_istream<_CharT, _Traits>::sentry __s(__is); if (__s) { typedef istreambuf_iterator<_CharT, _Traits> _Ip; typedef time_get<_CharT, _Ip> _Fp; ios_base::iostate __err = ios_base::goodbit; const _Fp& __tf = use_facet<_Fp>(__is.getloc()); __tf.get(_Ip(__is), _Ip(), __is, __err, __x.__tm_, __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)); __is.setstate(__err); } return __is; } template <class _CharT> inline __attribute__ ((__exclude_from_explicit_instantiation__)) __iom_t9<_CharT> get_time(tm* __tm, const _CharT* __fmt) { return __iom_t9<_CharT>(__tm, __fmt); } template <class _CharT> class __iom_t10; template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x); template <class _CharT> class __iom_t10 { const tm* __tm_; const _CharT* __fmt_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) __iom_t10(const tm* __tm, const _CharT* __fmt) : __tm_(__tm), __fmt_(__fmt) {} template <class _Cp, class _Traits> friend basic_ostream<_Cp, _Traits>& operator<<(basic_ostream<_Cp, _Traits>& __os, const __iom_t10<_Cp>& __x); }; template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x) { typename basic_ostream<_CharT, _Traits>::sentry __s(__os); if (__s) { typedef ostreambuf_iterator<_CharT, _Traits> _Op; typedef time_put<_CharT, _Op> _Fp; const _Fp& __tf = use_facet<_Fp>(__os.getloc()); if (__tf.put(_Op(__os), __os, __os.fill(), __x.__tm_, __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)).failed()) __os.setstate(ios_base::badbit); } return __os; } template <class _CharT> inline __attribute__ ((__exclude_from_explicit_instantiation__)) __iom_t10<_CharT> put_time(const tm* __tm, const _CharT* __fmt) { return __iom_t10<_CharT>(__tm, __fmt); } template <class _CharT, class _Traits, class _ForwardIterator> std::basic_ostream<_CharT, _Traits> & __quoted_output ( basic_ostream<_CharT, _Traits> &__os, _ForwardIterator __first, _ForwardIterator __last, _CharT __delim, _CharT __escape ) { std::__1::basic_string<_CharT, _Traits> __str; __str.push_back(__delim); for ( ; __first != __last; ++ __first ) { if (_Traits::eq (*__first, __escape) || _Traits::eq (*__first, __delim)) __str.push_back(__escape); __str.push_back(*__first); } __str.push_back(__delim); return __put_character_sequence(__os, __str.data(), __str.size()); } template <class _CharT, class _Traits, class _String> basic_istream<_CharT, _Traits> & __quoted_input ( basic_istream<_CharT, _Traits> &__is, _String & __string, _CharT __delim, _CharT __escape ) { __string.clear (); _CharT __c; __is >> __c; if ( __is.fail ()) return __is; if (!_Traits::eq (__c, __delim)) { __is.unget (); __is >> __string; return __is; } __save_flags<_CharT, _Traits> sf(__is); noskipws (__is); while (true) { __is >> __c; if ( __is.fail ()) break; if (_Traits::eq (__c, __escape)) { __is >> __c; if ( __is.fail ()) break; } else if (_Traits::eq (__c, __delim)) break; __string.push_back ( __c ); } return __is; } template <class _CharT, class _Traits, class _Iter> basic_ostream<_CharT, _Traits>& operator<<( basic_ostream<_CharT, _Traits>& __os, const __quoted_output_proxy<_CharT, _Iter, _Traits> & __proxy) { return __quoted_output (__os, __proxy.__first, __proxy.__last, __proxy.__delim, __proxy.__escape); } template <class _CharT, class _Traits, class _Allocator> struct __quoted_proxy { basic_string<_CharT, _Traits, _Allocator> &__string; _CharT __delim; _CharT __escape; __quoted_proxy(basic_string<_CharT, _Traits, _Allocator> &__s, _CharT __d, _CharT __e) : __string(__s), __delim(__d), __escape(__e) {} }; template <class _CharT, class _Traits, class _Allocator> __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostream<_CharT, _Traits>& operator<<( basic_ostream<_CharT, _Traits>& __os, const __quoted_proxy<_CharT, _Traits, _Allocator> & __proxy) { return __quoted_output (__os, __proxy.__string.cbegin (), __proxy.__string.cend (), __proxy.__delim, __proxy.__escape); } template <class _CharT, class _Traits, class _Allocator> __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istream<_CharT, _Traits>& operator>>( basic_istream<_CharT, _Traits>& __is, const __quoted_proxy<_CharT, _Traits, _Allocator> & __proxy) { return __quoted_input ( __is, __proxy.__string, __proxy.__delim, __proxy.__escape ); } template <class _CharT> __attribute__ ((__exclude_from_explicit_instantiation__)) __quoted_output_proxy<_CharT, const _CharT *> quoted ( const _CharT *__s, _CharT __delim = _CharT('"'), _CharT __escape =_CharT('\\')) { const _CharT *__end = __s; while ( *__end ) ++__end; return __quoted_output_proxy<_CharT, const _CharT *> ( __s, __end, __delim, __escape ); } template <class _CharT, class _Traits, class _Allocator> __attribute__ ((__exclude_from_explicit_instantiation__)) __quoted_output_proxy<_CharT, typename basic_string <_CharT, _Traits, _Allocator>::const_iterator> __quoted ( const basic_string <_CharT, _Traits, _Allocator> &__s, _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\')) { return __quoted_output_proxy<_CharT, typename basic_string <_CharT, _Traits, _Allocator>::const_iterator> ( __s.cbegin(), __s.cend (), __delim, __escape ); } template <class _CharT, class _Traits, class _Allocator> __attribute__ ((__exclude_from_explicit_instantiation__)) __quoted_proxy<_CharT, _Traits, _Allocator> __quoted ( basic_string <_CharT, _Traits, _Allocator> &__s, _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\')) { return __quoted_proxy<_CharT, _Traits, _Allocator>( __s, __delim, __escape ); } template <class _CharT, class _Traits, class _Allocator> __attribute__ ((__exclude_from_explicit_instantiation__)) __quoted_output_proxy<_CharT, typename basic_string <_CharT, _Traits, _Allocator>::const_iterator> quoted ( const basic_string <_CharT, _Traits, _Allocator> &__s, _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\')) { return __quoted(__s, __delim, __escape); } template <class _CharT, class _Traits, class _Allocator> __attribute__ ((__exclude_from_explicit_instantiation__)) __quoted_proxy<_CharT, _Traits, _Allocator> quoted ( basic_string <_CharT, _Traits, _Allocator> &__s, _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\')) { return __quoted(__s, __delim, __escape); } template <class _CharT, class _Traits> __quoted_output_proxy<_CharT, const _CharT *, _Traits> quoted (basic_string_view <_CharT, _Traits> __sv, _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\')) { return __quoted_output_proxy<_CharT, const _CharT *, _Traits> ( __sv.data(), __sv.data() + __sv.size(), __delim, __escape ); } } } namespace std { inline namespace __1 { namespace __fs { namespace filesystem { typedef chrono::time_point<_FilesystemClock> file_time_type; struct space_info { uintmax_t capacity; uintmax_t free; uintmax_t available; }; enum class file_type : signed char { none = 0, not_found = -1, regular = 1, directory = 2, symlink = 3, block = 4, character = 5, fifo = 6, socket = 7, unknown = 8 }; enum class perms : unsigned { none = 0, owner_read = 0400, owner_write = 0200, owner_exec = 0100, owner_all = 0700, group_read = 040, group_write = 020, group_exec = 010, group_all = 070, others_read = 04, others_write = 02, others_exec = 01, others_all = 07, all = 0777, set_uid = 04000, set_gid = 02000, sticky_bit = 01000, mask = 07777, unknown = 0xFFFF, }; __attribute__ ((__exclude_from_explicit_instantiation__)) inline constexpr perms operator&(perms _LHS, perms _RHS) { return static_cast<perms>(static_cast<unsigned>(_LHS) & static_cast<unsigned>(_RHS)); } __attribute__ ((__exclude_from_explicit_instantiation__)) inline constexpr perms operator|(perms _LHS, perms _RHS) { return static_cast<perms>(static_cast<unsigned>(_LHS) | static_cast<unsigned>(_RHS)); } __attribute__ ((__exclude_from_explicit_instantiation__)) inline constexpr perms operator^(perms _LHS, perms _RHS) { return static_cast<perms>(static_cast<unsigned>(_LHS) ^ static_cast<unsigned>(_RHS)); } __attribute__ ((__exclude_from_explicit_instantiation__)) inline constexpr perms operator~(perms _LHS) { return static_cast<perms>(~static_cast<unsigned>(_LHS)); } __attribute__ ((__exclude_from_explicit_instantiation__)) inline perms& operator&=(perms& _LHS, perms _RHS) { return _LHS = _LHS & _RHS; } __attribute__ ((__exclude_from_explicit_instantiation__)) inline perms& operator|=(perms& _LHS, perms _RHS) { return _LHS = _LHS | _RHS; } __attribute__ ((__exclude_from_explicit_instantiation__)) inline perms& operator^=(perms& _LHS, perms _RHS) { return _LHS = _LHS ^ _RHS; } enum class perm_options : unsigned char { replace = 1, add = 2, remove = 4, nofollow = 8 }; __attribute__ ((__exclude_from_explicit_instantiation__)) inline constexpr perm_options operator&(perm_options _LHS, perm_options _RHS) { return static_cast<perm_options>(static_cast<unsigned>(_LHS) & static_cast<unsigned>(_RHS)); } __attribute__ ((__exclude_from_explicit_instantiation__)) inline constexpr perm_options operator|(perm_options _LHS, perm_options _RHS) { return static_cast<perm_options>(static_cast<unsigned>(_LHS) | static_cast<unsigned>(_RHS)); } __attribute__ ((__exclude_from_explicit_instantiation__)) inline constexpr perm_options operator^(perm_options _LHS, perm_options _RHS) { return static_cast<perm_options>(static_cast<unsigned>(_LHS) ^ static_cast<unsigned>(_RHS)); } __attribute__ ((__exclude_from_explicit_instantiation__)) inline constexpr perm_options operator~(perm_options _LHS) { return static_cast<perm_options>(~static_cast<unsigned>(_LHS)); } __attribute__ ((__exclude_from_explicit_instantiation__)) inline perm_options& operator&=(perm_options& _LHS, perm_options _RHS) { return _LHS = _LHS & _RHS; } __attribute__ ((__exclude_from_explicit_instantiation__)) inline perm_options& operator|=(perm_options& _LHS, perm_options _RHS) { return _LHS = _LHS | _RHS; } __attribute__ ((__exclude_from_explicit_instantiation__)) inline perm_options& operator^=(perm_options& _LHS, perm_options _RHS) { return _LHS = _LHS ^ _RHS; } enum class copy_options : unsigned short { none = 0, skip_existing = 1, overwrite_existing = 2, update_existing = 4, recursive = 8, copy_symlinks = 16, skip_symlinks = 32, directories_only = 64, create_symlinks = 128, create_hard_links = 256, __in_recursive_copy = 512, }; __attribute__ ((__exclude_from_explicit_instantiation__)) inline constexpr copy_options operator&(copy_options _LHS, copy_options _RHS) { return static_cast<copy_options>(static_cast<unsigned short>(_LHS) & static_cast<unsigned short>(_RHS)); } __attribute__ ((__exclude_from_explicit_instantiation__)) inline constexpr copy_options operator|(copy_options _LHS, copy_options _RHS) { return static_cast<copy_options>(static_cast<unsigned short>(_LHS) | static_cast<unsigned short>(_RHS)); } __attribute__ ((__exclude_from_explicit_instantiation__)) inline constexpr copy_options operator^(copy_options _LHS, copy_options _RHS) { return static_cast<copy_options>(static_cast<unsigned short>(_LHS) ^ static_cast<unsigned short>(_RHS)); } __attribute__ ((__exclude_from_explicit_instantiation__)) inline constexpr copy_options operator~(copy_options _LHS) { return static_cast<copy_options>(~static_cast<unsigned short>(_LHS)); } __attribute__ ((__exclude_from_explicit_instantiation__)) inline copy_options& operator&=(copy_options& _LHS, copy_options _RHS) { return _LHS = _LHS & _RHS; } __attribute__ ((__exclude_from_explicit_instantiation__)) inline copy_options& operator|=(copy_options& _LHS, copy_options _RHS) { return _LHS = _LHS | _RHS; } __attribute__ ((__exclude_from_explicit_instantiation__)) inline copy_options& operator^=(copy_options& _LHS, copy_options _RHS) { return _LHS = _LHS ^ _RHS; } enum class directory_options : unsigned char { none = 0, follow_directory_symlink = 1, skip_permission_denied = 2 }; __attribute__ ((__exclude_from_explicit_instantiation__)) inline constexpr directory_options operator&(directory_options _LHS, directory_options _RHS) { return static_cast<directory_options>(static_cast<unsigned char>(_LHS) & static_cast<unsigned char>(_RHS)); } __attribute__ ((__exclude_from_explicit_instantiation__)) inline constexpr directory_options operator|(directory_options _LHS, directory_options _RHS) { return static_cast<directory_options>(static_cast<unsigned char>(_LHS) | static_cast<unsigned char>(_RHS)); } __attribute__ ((__exclude_from_explicit_instantiation__)) inline constexpr directory_options operator^(directory_options _LHS, directory_options _RHS) { return static_cast<directory_options>(static_cast<unsigned char>(_LHS) ^ static_cast<unsigned char>(_RHS)); } __attribute__ ((__exclude_from_explicit_instantiation__)) inline constexpr directory_options operator~(directory_options _LHS) { return static_cast<directory_options>(~static_cast<unsigned char>(_LHS)); } __attribute__ ((__exclude_from_explicit_instantiation__)) inline directory_options& operator&=(directory_options& _LHS, directory_options _RHS) { return _LHS = _LHS & _RHS; } __attribute__ ((__exclude_from_explicit_instantiation__)) inline directory_options& operator|=(directory_options& _LHS, directory_options _RHS) { return _LHS = _LHS | _RHS; } __attribute__ ((__exclude_from_explicit_instantiation__)) inline directory_options& operator^=(directory_options& _LHS, directory_options _RHS) { return _LHS = _LHS ^ _RHS; } class file_status { public: __attribute__ ((__exclude_from_explicit_instantiation__)) file_status() noexcept : file_status(file_type::none) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit file_status(file_type __ft, perms __prms = perms::unknown) noexcept : __ft_(__ft), __prms_(__prms) {} file_status(const file_status&) noexcept = default; file_status(file_status&&) noexcept = default; __attribute__ ((__exclude_from_explicit_instantiation__)) ~file_status() {} file_status& operator=(const file_status&) noexcept = default; file_status& operator=(file_status&&) noexcept = default; __attribute__ ((__exclude_from_explicit_instantiation__)) file_type type() const noexcept { return __ft_; } __attribute__ ((__exclude_from_explicit_instantiation__)) perms permissions() const noexcept { return __prms_; } __attribute__ ((__exclude_from_explicit_instantiation__)) void type(file_type __ft) noexcept { __ft_ = __ft; } __attribute__ ((__exclude_from_explicit_instantiation__)) void permissions(perms __p) noexcept { __prms_ = __p; } private: file_type __ft_; perms __prms_; }; class directory_entry; template <class _Tp> struct __can_convert_char { static const bool value = false; }; template <class _Tp> struct __can_convert_char<const _Tp> : public __can_convert_char<_Tp> {}; template <> struct __can_convert_char<char> { static const bool value = true; using __char_type = char; }; template <> struct __can_convert_char<wchar_t> { static const bool value = true; using __char_type = wchar_t; }; template <> struct __can_convert_char<char16_t> { static const bool value = true; using __char_type = char16_t; }; template <> struct __can_convert_char<char32_t> { static const bool value = true; using __char_type = char32_t; }; template <class _ECharT> typename enable_if<__can_convert_char<_ECharT>::value, bool>::type __is_separator(_ECharT __e) { return __e == _ECharT('/'); } struct _NullSentinal {}; template <class _Tp> using _Void = void; template <class _Tp, class = void> struct __is_pathable_string : public false_type {}; template <class _ECharT, class _Traits, class _Alloc> struct __is_pathable_string< basic_string<_ECharT, _Traits, _Alloc>, _Void<typename __can_convert_char<_ECharT>::__char_type> > : public __can_convert_char<_ECharT> { using _Str = basic_string<_ECharT, _Traits, _Alloc>; using _Base = __can_convert_char<_ECharT>; static _ECharT const* __range_begin(_Str const& __s) { return __s.data(); } static _ECharT const* __range_end(_Str const& __s) { return __s.data() + __s.length(); } static _ECharT __first_or_null(_Str const& __s) { return __s.empty() ? _ECharT{} : __s[0]; } }; template <class _ECharT, class _Traits> struct __is_pathable_string< basic_string_view<_ECharT, _Traits>, _Void<typename __can_convert_char<_ECharT>::__char_type> > : public __can_convert_char<_ECharT> { using _Str = basic_string_view<_ECharT, _Traits>; using _Base = __can_convert_char<_ECharT>; static _ECharT const* __range_begin(_Str const& __s) { return __s.data(); } static _ECharT const* __range_end(_Str const& __s) { return __s.data() + __s.length(); } static _ECharT __first_or_null(_Str const& __s) { return __s.empty() ? _ECharT{} : __s[0]; } }; template <class _Source, class _DS = typename decay<_Source>::type, class _UnqualPtrType = typename remove_const<typename remove_pointer<_DS>::type>::type, bool _IsCharPtr = is_pointer<_DS>::value&& __can_convert_char<_UnqualPtrType>::value> struct __is_pathable_char_array : false_type {}; template <class _Source, class _ECharT, class _UPtr> struct __is_pathable_char_array<_Source, _ECharT*, _UPtr, true> : __can_convert_char<typename remove_const<_ECharT>::type> { using _Base = __can_convert_char<typename remove_const<_ECharT>::type>; static _ECharT const* __range_begin(const _ECharT* __b) { return __b; } static _ECharT const* __range_end(const _ECharT* __b) { using _Iter = const _ECharT*; const _ECharT __sentinal = _ECharT{}; _Iter __e = __b; for (; *__e != __sentinal; ++__e) ; return __e; } static _ECharT __first_or_null(const _ECharT* __b) { return *__b; } }; template <class _Iter, bool _IsIt = __is_input_iterator<_Iter>::value, class = void> struct __is_pathable_iter : false_type {}; template <class _Iter> struct __is_pathable_iter< _Iter, true, _Void<typename __can_convert_char< typename iterator_traits<_Iter>::value_type>::__char_type> > : __can_convert_char<typename iterator_traits<_Iter>::value_type> { using _ECharT = typename iterator_traits<_Iter>::value_type; using _Base = __can_convert_char<_ECharT>; static _Iter __range_begin(_Iter __b) { return __b; } static _NullSentinal __range_end(_Iter) { return _NullSentinal{}; } static _ECharT __first_or_null(_Iter __b) { return *__b; } }; template <class _Tp, bool _IsStringT = __is_pathable_string<_Tp>::value, bool _IsCharIterT = __is_pathable_char_array<_Tp>::value, bool _IsIterT = !_IsCharIterT && __is_pathable_iter<_Tp>::value> struct __is_pathable : false_type { static_assert(!_IsStringT && !_IsCharIterT && !_IsIterT, "Must all be false"); }; template <class _Tp> struct __is_pathable<_Tp, true, false, false> : __is_pathable_string<_Tp> {}; template <class _Tp> struct __is_pathable<_Tp, false, true, false> : __is_pathable_char_array<_Tp> { }; template <class _Tp> struct __is_pathable<_Tp, false, false, true> : __is_pathable_iter<_Tp> {}; template <class _ECharT> struct _PathCVT { static_assert(__can_convert_char<_ECharT>::value, "Char type not convertible"); typedef __narrow_to_utf8<sizeof(_ECharT) * 8> _Narrower; static void __append_range(string& __dest, _ECharT const* __b, _ECharT const* __e) { _Narrower()(back_inserter(__dest), __b, __e); } template <class _Iter> static void __append_range(string& __dest, _Iter __b, _Iter __e) { static_assert(!is_same<_Iter, _ECharT*>::value, "Call const overload"); if (__b == __e) return; basic_string<_ECharT> __tmp(__b, __e); _Narrower()(back_inserter(__dest), __tmp.data(), __tmp.data() + __tmp.length()); } template <class _Iter> static void __append_range(string& __dest, _Iter __b, _NullSentinal) { static_assert(!is_same<_Iter, _ECharT*>::value, "Call const overload"); const _ECharT __sentinal = _ECharT{}; if (*__b == __sentinal) return; basic_string<_ECharT> __tmp; for (; *__b != __sentinal; ++__b) __tmp.push_back(*__b); _Narrower()(back_inserter(__dest), __tmp.data(), __tmp.data() + __tmp.length()); } template <class _Source> static void __append_source(string& __dest, _Source const& __s) { using _Traits = __is_pathable<_Source>; __append_range(__dest, _Traits::__range_begin(__s), _Traits::__range_end(__s)); } }; template <> struct _PathCVT<char> { template <class _Iter> static typename enable_if<__is_exactly_input_iterator<_Iter>::value>::type __append_range(string& __dest, _Iter __b, _Iter __e) { for (; __b != __e; ++__b) __dest.push_back(*__b); } template <class _Iter> static typename enable_if<__is_forward_iterator<_Iter>::value>::type __append_range(string& __dest, _Iter __b, _Iter __e) { __dest.__append_forward_unsafe(__b, __e); } template <class _Iter> static void __append_range(string& __dest, _Iter __b, _NullSentinal) { const char __sentinal = char{}; for (; *__b != __sentinal; ++__b) __dest.push_back(*__b); } template <class _Source> static void __append_source(string& __dest, _Source const& __s) { using _Traits = __is_pathable<_Source>; __append_range(__dest, _Traits::__range_begin(__s), _Traits::__range_end(__s)); } }; class path { template <class _SourceOrIter, class _Tp = path&> using _EnableIfPathable = typename enable_if<__is_pathable<_SourceOrIter>::value, _Tp>::type; template <class _Tp> using _SourceChar = typename __is_pathable<_Tp>::__char_type; template <class _Tp> using _SourceCVT = _PathCVT<_SourceChar<_Tp> >; public: typedef char value_type; typedef basic_string<value_type> string_type; typedef std::__1::string_view __string_view; static constexpr value_type preferred_separator = '/'; enum class format : unsigned char { auto_format, native_format, generic_format }; __attribute__ ((__exclude_from_explicit_instantiation__)) path() noexcept {} __attribute__ ((__exclude_from_explicit_instantiation__)) path(const path& __p) : __pn_(__p.__pn_) {} __attribute__ ((__exclude_from_explicit_instantiation__)) path(path&& __p) noexcept : __pn_(std::__1::move(__p.__pn_)) {} __attribute__ ((__exclude_from_explicit_instantiation__)) path(string_type&& __s, format = format::auto_format) noexcept : __pn_(std::__1::move(__s)) {} template <class _Source, class = _EnableIfPathable<_Source, void> > path(const _Source& __src, format = format::auto_format) { _SourceCVT<_Source>::__append_source(__pn_, __src); } template <class _InputIt> path(_InputIt __first, _InputIt __last, format = format::auto_format) { typedef typename iterator_traits<_InputIt>::value_type _ItVal; _PathCVT<_ItVal>::__append_range(__pn_, __first, __last); } template <class _Source, class = _EnableIfPathable<_Source, void> > path(const _Source& __src, const locale& __loc, format = format::auto_format); template <class _InputIt> path(_InputIt __first, _InputIt _last, const locale& __loc, format = format::auto_format); __attribute__ ((__exclude_from_explicit_instantiation__)) ~path() = default; __attribute__ ((__exclude_from_explicit_instantiation__)) path& operator=(const path& __p) { __pn_ = __p.__pn_; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) path& operator=(path&& __p) noexcept { __pn_ = std::__1::move(__p.__pn_); return *this; } template <class = void> __attribute__ ((__exclude_from_explicit_instantiation__)) path& operator=(string_type&& __s) noexcept { __pn_ = std::__1::move(__s); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) path& assign(string_type&& __s) noexcept { __pn_ = std::__1::move(__s); return *this; } template <class _Source> __attribute__ ((__exclude_from_explicit_instantiation__)) _EnableIfPathable<_Source> operator=(const _Source& __src) { return this->assign(__src); } template <class _Source> _EnableIfPathable<_Source> assign(const _Source& __src) { __pn_.clear(); _SourceCVT<_Source>::__append_source(__pn_, __src); return *this; } template <class _InputIt> path& assign(_InputIt __first, _InputIt __last) { typedef typename iterator_traits<_InputIt>::value_type _ItVal; __pn_.clear(); _PathCVT<_ItVal>::__append_range(__pn_, __first, __last); return *this; } private: template <class _ECharT> static bool __source_is_absolute(_ECharT __first_or_null) { return __is_separator(__first_or_null); } public: path& operator/=(const path& __p) { if (__p.is_absolute()) { __pn_ = __p.__pn_; return *this; } if (has_filename()) __pn_ += preferred_separator; __pn_ += __p.native(); return *this; } template <class _Source> __attribute__ ((__exclude_from_explicit_instantiation__)) _EnableIfPathable<_Source> operator/=(const _Source& __src) { return this->append(__src); } template <class _Source> _EnableIfPathable<_Source> append(const _Source& __src) { using _Traits = __is_pathable<_Source>; using _CVT = _PathCVT<_SourceChar<_Source> >; if (__source_is_absolute(_Traits::__first_or_null(__src))) __pn_.clear(); else if (has_filename()) __pn_ += preferred_separator; _CVT::__append_source(__pn_, __src); return *this; } template <class _InputIt> path& append(_InputIt __first, _InputIt __last) { typedef typename iterator_traits<_InputIt>::value_type _ItVal; static_assert(__can_convert_char<_ItVal>::value, "Must convertible"); using _CVT = _PathCVT<_ItVal>; if (__first != __last && __source_is_absolute(*__first)) __pn_.clear(); else if (has_filename()) __pn_ += preferred_separator; _CVT::__append_range(__pn_, __first, __last); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) path& operator+=(const path& __x) { __pn_ += __x.__pn_; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) path& operator+=(const string_type& __x) { __pn_ += __x; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) path& operator+=(__string_view __x) { __pn_ += __x; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) path& operator+=(const value_type* __x) { __pn_ += __x; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) path& operator+=(value_type __x) { __pn_ += __x; return *this; } template <class _ECharT> typename enable_if<__can_convert_char<_ECharT>::value, path&>::type operator+=(_ECharT __x) { basic_string<_ECharT> __tmp; __tmp += __x; _PathCVT<_ECharT>::__append_source(__pn_, __tmp); return *this; } template <class _Source> _EnableIfPathable<_Source> operator+=(const _Source& __x) { return this->concat(__x); } template <class _Source> _EnableIfPathable<_Source> concat(const _Source& __x) { _SourceCVT<_Source>::__append_source(__pn_, __x); return *this; } template <class _InputIt> path& concat(_InputIt __first, _InputIt __last) { typedef typename iterator_traits<_InputIt>::value_type _ItVal; _PathCVT<_ItVal>::__append_range(__pn_, __first, __last); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) void clear() noexcept { __pn_.clear(); } path& make_preferred() { return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) path& remove_filename() { auto __fname = __filename(); if (!__fname.empty()) __pn_.erase(__fname.data() - __pn_.data()); return *this; } path& replace_filename(const path& __replacement) { remove_filename(); return (*this /= __replacement); } path& replace_extension(const path& __replacement = path()); __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(path& __rhs) noexcept { __pn_.swap(__rhs.__pn_); } __attribute__ ((__exclude_from_explicit_instantiation__)) void __reserve(size_t __s) { __pn_.reserve(__s); } __attribute__ ((__exclude_from_explicit_instantiation__)) const string_type& native() const noexcept { return __pn_; } __attribute__ ((__exclude_from_explicit_instantiation__)) const value_type* c_str() const noexcept { return __pn_.c_str(); } __attribute__ ((__exclude_from_explicit_instantiation__)) operator string_type() const { return __pn_; } template <class _ECharT, class _Traits = char_traits<_ECharT>, class _Allocator = allocator<_ECharT> > basic_string<_ECharT, _Traits, _Allocator> string(const _Allocator& __a = _Allocator()) const { using _CVT = __widen_from_utf8<sizeof(_ECharT) * 8>; using _Str = basic_string<_ECharT, _Traits, _Allocator>; _Str __s(__a); __s.reserve(__pn_.size()); _CVT()(back_inserter(__s), __pn_.data(), __pn_.data() + __pn_.size()); return __s; } __attribute__ ((__exclude_from_explicit_instantiation__)) std::string string() const { return __pn_; } __attribute__ ((__exclude_from_explicit_instantiation__)) std::wstring wstring() const { return string<wchar_t>(); } __attribute__ ((__exclude_from_explicit_instantiation__)) std::string u8string() const { return __pn_; } __attribute__ ((__exclude_from_explicit_instantiation__)) std::u16string u16string() const { return string<char16_t>(); } __attribute__ ((__exclude_from_explicit_instantiation__)) std::u32string u32string() const { return string<char32_t>(); } template <class _ECharT, class _Traits = char_traits<_ECharT>, class _Allocator = allocator<_ECharT> > basic_string<_ECharT, _Traits, _Allocator> generic_string(const _Allocator& __a = _Allocator()) const { return string<_ECharT, _Traits, _Allocator>(__a); } std::string generic_string() const { return __pn_; } std::wstring generic_wstring() const { return string<wchar_t>(); } std::string generic_u8string() const { return __pn_; } std::u16string generic_u16string() const { return string<char16_t>(); } std::u32string generic_u32string() const { return string<char32_t>(); } private: int __compare(__string_view) const; __string_view __root_name() const; __string_view __root_directory() const; __string_view __root_path_raw() const; __string_view __relative_path() const; __string_view __parent_path() const; __string_view __filename() const; __string_view __stem() const; __string_view __extension() const; public: __attribute__ ((__exclude_from_explicit_instantiation__)) int compare(const path& __p) const noexcept { return __compare(__p.__pn_); } __attribute__ ((__exclude_from_explicit_instantiation__)) int compare(const string_type& __s) const { return __compare(__s); } __attribute__ ((__exclude_from_explicit_instantiation__)) int compare(__string_view __s) const { return __compare(__s); } __attribute__ ((__exclude_from_explicit_instantiation__)) int compare(const value_type* __s) const { return __compare(__s); } __attribute__ ((__exclude_from_explicit_instantiation__)) path root_name() const { return string_type(__root_name()); } __attribute__ ((__exclude_from_explicit_instantiation__)) path root_directory() const { return string_type(__root_directory()); } __attribute__ ((__exclude_from_explicit_instantiation__)) path root_path() const { return root_name().append(string_type(__root_directory())); } __attribute__ ((__exclude_from_explicit_instantiation__)) path relative_path() const { return string_type(__relative_path()); } __attribute__ ((__exclude_from_explicit_instantiation__)) path parent_path() const { return string_type(__parent_path()); } __attribute__ ((__exclude_from_explicit_instantiation__)) path filename() const { return string_type(__filename()); } __attribute__ ((__exclude_from_explicit_instantiation__)) path stem() const { return string_type(__stem()); } __attribute__ ((__exclude_from_explicit_instantiation__)) path extension() const { return string_type(__extension()); } [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) bool empty() const noexcept { return __pn_.empty(); } __attribute__ ((__exclude_from_explicit_instantiation__)) bool has_root_name() const { return !__root_name().empty(); } __attribute__ ((__exclude_from_explicit_instantiation__)) bool has_root_directory() const { return !__root_directory().empty(); } __attribute__ ((__exclude_from_explicit_instantiation__)) bool has_root_path() const { return !__root_path_raw().empty(); } __attribute__ ((__exclude_from_explicit_instantiation__)) bool has_relative_path() const { return !__relative_path().empty(); } __attribute__ ((__exclude_from_explicit_instantiation__)) bool has_parent_path() const { return !__parent_path().empty(); } __attribute__ ((__exclude_from_explicit_instantiation__)) bool has_filename() const { return !__filename().empty(); } __attribute__ ((__exclude_from_explicit_instantiation__)) bool has_stem() const { return !__stem().empty(); } __attribute__ ((__exclude_from_explicit_instantiation__)) bool has_extension() const { return !__extension().empty(); } __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_absolute() const { return has_root_directory(); } __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_relative() const { return !is_absolute(); } path lexically_normal() const; path lexically_relative(const path& __base) const; __attribute__ ((__exclude_from_explicit_instantiation__)) path lexically_proximate(const path& __base) const { path __result = this->lexically_relative(__base); if (__result.native().empty()) return *this; return __result; } class iterator; typedef iterator const_iterator; iterator begin() const; iterator end() const; template <class _CharT, class _Traits> __attribute__ ((__exclude_from_explicit_instantiation__)) friend typename enable_if<is_same<_CharT, char>::value && is_same<_Traits, char_traits<char> >::value, basic_ostream<_CharT, _Traits>&>::type operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) { __os << std::__quoted(__p.native()); return __os; } template <class _CharT, class _Traits> __attribute__ ((__exclude_from_explicit_instantiation__)) friend typename enable_if<!is_same<_CharT, char>::value || !is_same<_Traits, char_traits<char> >::value, basic_ostream<_CharT, _Traits>&>::type operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) { __os << std::__quoted(__p.string<_CharT, _Traits>()); return __os; } template <class _CharT, class _Traits> __attribute__ ((__exclude_from_explicit_instantiation__)) friend basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, path& __p) { basic_string<_CharT, _Traits> __tmp; __is >> __quoted(__tmp); __p = __tmp; return __is; } friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const path& __lhs, const path& __rhs) noexcept { return __lhs.compare(__rhs) == 0; } friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const path& __lhs, const path& __rhs) noexcept { return __lhs.compare(__rhs) != 0; } friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<(const path& __lhs, const path& __rhs) noexcept { return __lhs.compare(__rhs) < 0; } friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(const path& __lhs, const path& __rhs) noexcept { return __lhs.compare(__rhs) <= 0; } friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>(const path& __lhs, const path& __rhs) noexcept { return __lhs.compare(__rhs) > 0; } friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(const path& __lhs, const path& __rhs) noexcept { return __lhs.compare(__rhs) >= 0; } friend __attribute__ ((__exclude_from_explicit_instantiation__)) path operator/(const path& __lhs, const path& __rhs) { path __result(__lhs); __result /= __rhs; return __result; } private: inline __attribute__ ((__exclude_from_explicit_instantiation__)) path& __assign_view(__string_view const& __s) noexcept { __pn_ = string_type(__s); return *this; } string_type __pn_; }; inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(path& __lhs, path& __rhs) noexcept { __lhs.swap(__rhs); } size_t hash_value(const path& __p) noexcept; template <class _Source> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_pathable<_Source>::value, path>::type u8path(const _Source& __s) { static_assert( is_same<typename __is_pathable<_Source>::__char_type, char>::value, "u8path(Source const&) requires Source have a character type of type " "'char'"); return path(__s); } template <class _InputIt> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_pathable<_InputIt>::value, path>::type u8path(_InputIt __f, _InputIt __l) { static_assert( is_same<typename __is_pathable<_InputIt>::__char_type, char>::value, "u8path(Iter, Iter) requires Iter have a value_type of type 'char'"); return path(__f, __l); } class path::iterator { public: enum _ParserState : unsigned char { _Singular, _BeforeBegin, _InRootName, _InRootDir, _InFilenames, _InTrailingSep, _AtEnd }; public: typedef bidirectional_iterator_tag iterator_category; typedef path value_type; typedef std::ptrdiff_t difference_type; typedef const path* pointer; typedef const path& reference; typedef void __stashing_iterator_tag; public: __attribute__ ((__exclude_from_explicit_instantiation__)) iterator() : __stashed_elem_(), __path_ptr_(nullptr), __entry_(), __state_(_Singular) {} iterator(const iterator&) = default; ~iterator() = default; iterator& operator=(const iterator&) = default; __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator*() const { return __stashed_elem_; } __attribute__ ((__exclude_from_explicit_instantiation__)) pointer operator->() const { return &__stashed_elem_; } __attribute__ ((__exclude_from_explicit_instantiation__)) iterator& operator++() { ((void)0); ((void)0); return __increment(); } __attribute__ ((__exclude_from_explicit_instantiation__)) iterator operator++(int) { iterator __it(*this); this->operator++(); return __it; } __attribute__ ((__exclude_from_explicit_instantiation__)) iterator& operator--() { ((void)0); ((void)0); return __decrement(); } __attribute__ ((__exclude_from_explicit_instantiation__)) iterator operator--(int) { iterator __it(*this); this->operator--(); return __it; } private: friend class path; inline __attribute__ ((__exclude_from_explicit_instantiation__)) friend bool operator==(const iterator&, const iterator&); iterator& __increment(); iterator& __decrement(); path __stashed_elem_; const path* __path_ptr_; path::__string_view __entry_; _ParserState __state_; }; inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const path::iterator& __lhs, const path::iterator& __rhs) { return __lhs.__path_ptr_ == __rhs.__path_ptr_ && __lhs.__entry_.data() == __rhs.__entry_.data(); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const path::iterator& __lhs, const path::iterator& __rhs) { return !(__lhs == __rhs); } class filesystem_error : public system_error { public: __attribute__ ((__exclude_from_explicit_instantiation__)) filesystem_error(const string& __what, error_code __ec) : system_error(__ec, __what), __storage_(make_shared<_Storage>(path(), path())) { __create_what(0); } __attribute__ ((__exclude_from_explicit_instantiation__)) filesystem_error(const string& __what, const path& __p1, error_code __ec) : system_error(__ec, __what), __storage_(make_shared<_Storage>(__p1, path())) { __create_what(1); } __attribute__ ((__exclude_from_explicit_instantiation__)) filesystem_error(const string& __what, const path& __p1, const path& __p2, error_code __ec) : system_error(__ec, __what), __storage_(make_shared<_Storage>(__p1, __p2)) { __create_what(2); } __attribute__ ((__exclude_from_explicit_instantiation__)) const path& path1() const noexcept { return __storage_->__p1_; } __attribute__ ((__exclude_from_explicit_instantiation__)) const path& path2() const noexcept { return __storage_->__p2_; } ~filesystem_error() override; __attribute__ ((__exclude_from_explicit_instantiation__)) const char* what() const noexcept override { return __storage_->__what_.c_str(); } void __create_what(int __num_paths); private: struct _Storage { __attribute__ ((__exclude_from_explicit_instantiation__)) _Storage(const path& __p1, const path& __p2) : __p1_(__p1), __p2_(__p2) {} path __p1_; path __p2_; string __what_; }; shared_ptr<_Storage> __storage_; }; template <class... _Args> [[noreturn]] inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __throw_filesystem_error(_Args&&...) { std::__1::abort(); } path __absolute(const path&, error_code* __ec = nullptr); path __canonical(const path&, error_code* __ec = nullptr); void __copy(const path& __from, const path& __to, copy_options __opt, error_code* __ec = nullptr); bool __copy_file(const path& __from, const path& __to, copy_options __opt, error_code* __ec = nullptr); void __copy_symlink(const path& __existing_symlink, const path& __new_symlink, error_code* __ec = nullptr); bool __create_directories(const path& p, error_code* ec = nullptr); bool __create_directory(const path& p, error_code* ec = nullptr); bool __create_directory(const path& p, const path& attributes, error_code* ec = nullptr); void __create_directory_symlink(const path& __to, const path& __new_symlink, error_code* __ec = nullptr); void __create_hard_link(const path& __to, const path& __new_hard_link, error_code* __ec = nullptr); void __create_symlink(const path& __to, const path& __new_symlink, error_code* __ec = nullptr); path __current_path(error_code* __ec = nullptr); void __current_path(const path&, error_code* __ec = nullptr); bool __equivalent(const path&, const path&, error_code* __ec = nullptr); uintmax_t __file_size(const path&, error_code* __ec = nullptr); uintmax_t __hard_link_count(const path&, error_code* __ec = nullptr); bool __fs_is_empty(const path& p, error_code* ec = nullptr); file_time_type __last_write_time(const path& p, error_code* ec = nullptr); void __last_write_time(const path& p, file_time_type new_time, error_code* ec = nullptr); void __permissions(const path&, perms, perm_options, error_code* = nullptr); path __read_symlink(const path& p, error_code* ec = nullptr); bool __remove(const path& p, error_code* ec = nullptr); uintmax_t __remove_all(const path& p, error_code* ec = nullptr); void __rename(const path& from, const path& to, error_code* ec = nullptr); void __resize_file(const path& p, uintmax_t size, error_code* ec = nullptr); space_info __space(const path&, error_code* __ec = nullptr); file_status __status(const path&, error_code* __ec = nullptr); file_status __symlink_status(const path&, error_code* __ec = nullptr); path __system_complete(const path&, error_code* __ec = nullptr); path __temp_directory_path(error_code* __ec = nullptr); path __weakly_canonical(path const& __p, error_code* __ec = nullptr); inline __attribute__ ((__exclude_from_explicit_instantiation__)) path current_path() { return __current_path(); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) path current_path(error_code& __ec) { return __current_path(&__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void current_path(const path& __p) { __current_path(__p); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void current_path(const path& __p, error_code& __ec) noexcept { __current_path(__p, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) path absolute(const path& __p) { return __absolute(__p); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) path absolute(const path& __p, error_code& __ec) { return __absolute(__p, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) path canonical(const path& __p) { return __canonical(__p); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) path canonical(const path& __p, error_code& __ec) { return __canonical(__p, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void copy(const path& __from, const path& __to) { __copy(__from, __to, copy_options::none); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void copy(const path& __from, const path& __to, error_code& __ec) { __copy(__from, __to, copy_options::none, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void copy(const path& __from, const path& __to, copy_options __opt) { __copy(__from, __to, __opt); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void copy(const path& __from, const path& __to, copy_options __opt, error_code& __ec) { __copy(__from, __to, __opt, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool copy_file(const path& __from, const path& __to) { return __copy_file(__from, __to, copy_options::none); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool copy_file(const path& __from, const path& __to, error_code& __ec) { return __copy_file(__from, __to, copy_options::none, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool copy_file(const path& __from, const path& __to, copy_options __opt) { return __copy_file(__from, __to, __opt); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool copy_file(const path& __from, const path& __to, copy_options __opt, error_code& __ec) { return __copy_file(__from, __to, __opt, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void copy_symlink(const path& __existing, const path& __new) { __copy_symlink(__existing, __new); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void copy_symlink(const path& __ext, const path& __new, error_code& __ec) noexcept { __copy_symlink(__ext, __new, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool create_directories(const path& __p) { return __create_directories(__p); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool create_directories(const path& __p, error_code& __ec) { return __create_directories(__p, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool create_directory(const path& __p) { return __create_directory(__p); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool create_directory(const path& __p, error_code& __ec) noexcept { return __create_directory(__p, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool create_directory(const path& __p, const path& __attrs) { return __create_directory(__p, __attrs); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool create_directory(const path& __p, const path& __attrs, error_code& __ec) noexcept { return __create_directory(__p, __attrs, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void create_directory_symlink(const path& __to, const path& __new) { __create_directory_symlink(__to, __new); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void create_directory_symlink(const path& __to, const path& __new, error_code& __ec) noexcept { __create_directory_symlink(__to, __new, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void create_hard_link(const path& __to, const path& __new) { __create_hard_link(__to, __new); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void create_hard_link(const path& __to, const path& __new, error_code& __ec) noexcept { __create_hard_link(__to, __new, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void create_symlink(const path& __to, const path& __new) { __create_symlink(__to, __new); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void create_symlink(const path& __to, const path& __new, error_code& __ec) noexcept { return __create_symlink(__to, __new, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool status_known(file_status __s) noexcept { return __s.type() != file_type::none; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool exists(file_status __s) noexcept { return status_known(__s) && __s.type() != file_type::not_found; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool exists(const path& __p) { return exists(__status(__p)); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool exists(const path& __p, error_code& __ec) noexcept { auto __s = __status(__p, &__ec); if (status_known(__s)) __ec.clear(); return exists(__s); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool equivalent(const path& __p1, const path& __p2) { return __equivalent(__p1, __p2); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept { return __equivalent(__p1, __p2, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) uintmax_t file_size(const path& __p) { return __file_size(__p); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) uintmax_t file_size(const path& __p, error_code& __ec) noexcept { return __file_size(__p, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) uintmax_t hard_link_count(const path& __p) { return __hard_link_count(__p); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) uintmax_t hard_link_count(const path& __p, error_code& __ec) noexcept { return __hard_link_count(__p, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_block_file(file_status __s) noexcept { return __s.type() == file_type::block; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_block_file(const path& __p) { return is_block_file(__status(__p)); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_block_file(const path& __p, error_code& __ec) noexcept { return is_block_file(__status(__p, &__ec)); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_character_file(file_status __s) noexcept { return __s.type() == file_type::character; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_character_file(const path& __p) { return is_character_file(__status(__p)); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_character_file(const path& __p, error_code& __ec) noexcept { return is_character_file(__status(__p, &__ec)); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_directory(file_status __s) noexcept { return __s.type() == file_type::directory; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_directory(const path& __p) { return is_directory(__status(__p)); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_directory(const path& __p, error_code& __ec) noexcept { return is_directory(__status(__p, &__ec)); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_empty(const path& __p) { return __fs_is_empty(__p); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_empty(const path& __p, error_code& __ec) { return __fs_is_empty(__p, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_fifo(file_status __s) noexcept { return __s.type() == file_type::fifo; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_fifo(const path& __p) { return is_fifo(__status(__p)); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_fifo(const path& __p, error_code& __ec) noexcept { return is_fifo(__status(__p, &__ec)); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_regular_file(file_status __s) noexcept { return __s.type() == file_type::regular; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_regular_file(const path& __p) { return is_regular_file(__status(__p)); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_regular_file(const path& __p, error_code& __ec) noexcept { return is_regular_file(__status(__p, &__ec)); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_socket(file_status __s) noexcept { return __s.type() == file_type::socket; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_socket(const path& __p) { return is_socket(__status(__p)); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_socket(const path& __p, error_code& __ec) noexcept { return is_socket(__status(__p, &__ec)); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_symlink(file_status __s) noexcept { return __s.type() == file_type::symlink; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_symlink(const path& __p) { return is_symlink(__symlink_status(__p)); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_symlink(const path& __p, error_code& __ec) noexcept { return is_symlink(__symlink_status(__p, &__ec)); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_other(file_status __s) noexcept { return exists(__s) && !is_regular_file(__s) && !is_directory(__s) && !is_symlink(__s); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_other(const path& __p) { return is_other(__status(__p)); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_other(const path& __p, error_code& __ec) noexcept { return is_other(__status(__p, &__ec)); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) file_time_type last_write_time(const path& __p) { return __last_write_time(__p); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) file_time_type last_write_time(const path& __p, error_code& __ec) noexcept { return __last_write_time(__p, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void last_write_time(const path& __p, file_time_type __t) { __last_write_time(__p, __t); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void last_write_time(const path& __p, file_time_type __t, error_code& __ec) noexcept { __last_write_time(__p, __t, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void permissions(const path& __p, perms __prms, perm_options __opts = perm_options::replace) { __permissions(__p, __prms, __opts); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void permissions(const path& __p, perms __prms, error_code& __ec) noexcept { __permissions(__p, __prms, perm_options::replace, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void permissions(const path& __p, perms __prms, perm_options __opts, error_code& __ec) { __permissions(__p, __prms, __opts, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) path proximate(const path& __p, const path& __base, error_code& __ec) { path __tmp = __weakly_canonical(__p, &__ec); if (__ec) return {}; path __tmp_base = __weakly_canonical(__base, &__ec); if (__ec) return {}; return __tmp.lexically_proximate(__tmp_base); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) path proximate(const path& __p, error_code& __ec) { return proximate(__p, current_path(), __ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) path proximate(const path& __p, const path& __base = current_path()) { return __weakly_canonical(__p).lexically_proximate( __weakly_canonical(__base)); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) path read_symlink(const path& __p) { return __read_symlink(__p); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) path read_symlink(const path& __p, error_code& __ec) { return __read_symlink(__p, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) path relative(const path& __p, const path& __base, error_code& __ec) { path __tmp = __weakly_canonical(__p, &__ec); if (__ec) return path(); path __tmpbase = __weakly_canonical(__base, &__ec); if (__ec) return path(); return __tmp.lexically_relative(__tmpbase); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) path relative(const path& __p, error_code& __ec) { return relative(__p, current_path(), __ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) path relative(const path& __p, const path& __base = current_path()) { return __weakly_canonical(__p).lexically_relative(__weakly_canonical(__base)); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool remove(const path& __p) { return __remove(__p); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool remove(const path& __p, error_code& __ec) noexcept { return __remove(__p, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) uintmax_t remove_all(const path& __p) { return __remove_all(__p); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) uintmax_t remove_all(const path& __p, error_code& __ec) { return __remove_all(__p, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void rename(const path& __from, const path& __to) { return __rename(__from, __to); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void rename(const path& __from, const path& __to, error_code& __ec) noexcept { return __rename(__from, __to, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void resize_file(const path& __p, uintmax_t __ns) { return __resize_file(__p, __ns); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) void resize_file(const path& __p, uintmax_t __ns, error_code& __ec) noexcept { return __resize_file(__p, __ns, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) space_info space(const path& __p) { return __space(__p); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) space_info space(const path& __p, error_code& __ec) noexcept { return __space(__p, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) file_status status(const path& __p) { return __status(__p); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) file_status status(const path& __p, error_code& __ec) noexcept { return __status(__p, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) file_status symlink_status(const path& __p) { return __symlink_status(__p); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) file_status symlink_status(const path& __p, error_code& __ec) noexcept { return __symlink_status(__p, &__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) path temp_directory_path() { return __temp_directory_path(); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) path temp_directory_path(error_code& __ec) { return __temp_directory_path(&__ec); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) path weakly_canonical(path const& __p) { return __weakly_canonical(__p); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) path weakly_canonical(path const& __p, error_code& __ec) { return __weakly_canonical(__p, &__ec); } class directory_iterator; class recursive_directory_iterator; class __dir_stream; class directory_entry { typedef std::__1::__fs::filesystem::path _Path; public: directory_entry() noexcept = default; directory_entry(directory_entry const&) = default; directory_entry(directory_entry&&) noexcept = default; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit directory_entry(_Path const& __p) : __p_(__p) { error_code __ec; __refresh(&__ec); } __attribute__ ((__exclude_from_explicit_instantiation__)) directory_entry(_Path const& __p, error_code& __ec) : __p_(__p) { __refresh(&__ec); } ~directory_entry() {} directory_entry& operator=(directory_entry const&) = default; directory_entry& operator=(directory_entry&&) noexcept = default; __attribute__ ((__exclude_from_explicit_instantiation__)) void assign(_Path const& __p) { __p_ = __p; error_code __ec; __refresh(&__ec); } __attribute__ ((__exclude_from_explicit_instantiation__)) void assign(_Path const& __p, error_code& __ec) { __p_ = __p; __refresh(&__ec); } __attribute__ ((__exclude_from_explicit_instantiation__)) void replace_filename(_Path const& __p) { __p_.replace_filename(__p); error_code __ec; __refresh(&__ec); } __attribute__ ((__exclude_from_explicit_instantiation__)) void replace_filename(_Path const& __p, error_code& __ec) { __p_ = __p_.parent_path() / __p; __refresh(&__ec); } __attribute__ ((__exclude_from_explicit_instantiation__)) void refresh() { __refresh(); } __attribute__ ((__exclude_from_explicit_instantiation__)) void refresh(error_code& __ec) noexcept { __refresh(&__ec); } __attribute__ ((__exclude_from_explicit_instantiation__)) _Path const& path() const noexcept { return __p_; } __attribute__ ((__exclude_from_explicit_instantiation__)) operator const _Path&() const noexcept { return __p_; } __attribute__ ((__exclude_from_explicit_instantiation__)) bool exists() const { return std::__1::__fs::filesystem::exists(file_status{__get_ft()}); } __attribute__ ((__exclude_from_explicit_instantiation__)) bool exists(error_code& __ec) const noexcept { return std::__1::__fs::filesystem::exists(file_status{__get_ft(&__ec)}); } __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_block_file() const { return __get_ft() == file_type::block; } __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_block_file(error_code& __ec) const noexcept { return __get_ft(&__ec) == file_type::block; } __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_character_file() const { return __get_ft() == file_type::character; } __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_character_file(error_code& __ec) const noexcept { return __get_ft(&__ec) == file_type::character; } __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_directory() const { return __get_ft() == file_type::directory; } __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_directory(error_code& __ec) const noexcept { return __get_ft(&__ec) == file_type::directory; } __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_fifo() const { return __get_ft() == file_type::fifo; } __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_fifo(error_code& __ec) const noexcept { return __get_ft(&__ec) == file_type::fifo; } __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_other() const { return std::__1::__fs::filesystem::is_other(file_status{__get_ft()}); } __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_other(error_code& __ec) const noexcept { return std::__1::__fs::filesystem::is_other(file_status{__get_ft(&__ec)}); } __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_regular_file() const { return __get_ft() == file_type::regular; } __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_regular_file(error_code& __ec) const noexcept { return __get_ft(&__ec) == file_type::regular; } __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_socket() const { return __get_ft() == file_type::socket; } __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_socket(error_code& __ec) const noexcept { return __get_ft(&__ec) == file_type::socket; } __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_symlink() const { return __get_sym_ft() == file_type::symlink; } __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_symlink(error_code& __ec) const noexcept { return __get_sym_ft(&__ec) == file_type::symlink; } __attribute__ ((__exclude_from_explicit_instantiation__)) uintmax_t file_size() const { return __get_size(); } __attribute__ ((__exclude_from_explicit_instantiation__)) uintmax_t file_size(error_code& __ec) const noexcept { return __get_size(&__ec); } __attribute__ ((__exclude_from_explicit_instantiation__)) uintmax_t hard_link_count() const { return __get_nlink(); } __attribute__ ((__exclude_from_explicit_instantiation__)) uintmax_t hard_link_count(error_code& __ec) const noexcept { return __get_nlink(&__ec); } __attribute__ ((__exclude_from_explicit_instantiation__)) file_time_type last_write_time() const { return __get_write_time(); } __attribute__ ((__exclude_from_explicit_instantiation__)) file_time_type last_write_time(error_code& __ec) const noexcept { return __get_write_time(&__ec); } __attribute__ ((__exclude_from_explicit_instantiation__)) file_status status() const { return __get_status(); } __attribute__ ((__exclude_from_explicit_instantiation__)) file_status status(error_code& __ec) const noexcept { return __get_status(&__ec); } __attribute__ ((__exclude_from_explicit_instantiation__)) file_status symlink_status() const { return __get_symlink_status(); } __attribute__ ((__exclude_from_explicit_instantiation__)) file_status symlink_status(error_code& __ec) const noexcept { return __get_symlink_status(&__ec); } __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<(directory_entry const& __rhs) const noexcept { return __p_ < __rhs.__p_; } __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(directory_entry const& __rhs) const noexcept { return __p_ == __rhs.__p_; } __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(directory_entry const& __rhs) const noexcept { return __p_ != __rhs.__p_; } __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(directory_entry const& __rhs) const noexcept { return __p_ <= __rhs.__p_; } __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>(directory_entry const& __rhs) const noexcept { return __p_ > __rhs.__p_; } __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(directory_entry const& __rhs) const noexcept { return __p_ >= __rhs.__p_; } private: friend class directory_iterator; friend class recursive_directory_iterator; friend class __dir_stream; enum _CacheType : unsigned char { _Empty, _IterSymlink, _IterNonSymlink, _RefreshSymlink, _RefreshSymlinkUnresolved, _RefreshNonSymlink }; struct __cached_data { uintmax_t __size_; uintmax_t __nlink_; file_time_type __write_time_; perms __sym_perms_; perms __non_sym_perms_; file_type __type_; _CacheType __cache_type_; __attribute__ ((__exclude_from_explicit_instantiation__)) __cached_data() noexcept { __reset(); } __attribute__ ((__exclude_from_explicit_instantiation__)) void __reset() { __cache_type_ = _Empty; __type_ = file_type::none; __sym_perms_ = __non_sym_perms_ = perms::unknown; __size_ = __nlink_ = uintmax_t(-1); __write_time_ = file_time_type::min(); } }; __attribute__ ((__exclude_from_explicit_instantiation__)) static __cached_data __create_iter_result(file_type __ft) { __cached_data __data; __data.__type_ = __ft; __data.__cache_type_ = [&]() { switch (__ft) { case file_type::none: return _Empty; case file_type::symlink: return _IterSymlink; default: return _IterNonSymlink; } }(); return __data; } __attribute__ ((__exclude_from_explicit_instantiation__)) void __assign_iter_entry(_Path&& __p, __cached_data __dt) { __p_ = std::move(__p); __data_ = __dt; } error_code __do_refresh() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) static bool __is_dne_error(error_code const& __ec) { if (!__ec) return true; switch (static_cast<errc>(__ec.value())) { case errc::no_such_file_or_directory: case errc::not_a_directory: return true; default: return false; } } __attribute__ ((__exclude_from_explicit_instantiation__)) void __handle_error(const char* __msg, error_code* __dest_ec, error_code const& __ec, bool __allow_dne = false) const { if (__dest_ec) { *__dest_ec = __ec; return; } if (__ec && (!__allow_dne || !__is_dne_error(__ec))) __throw_filesystem_error(__msg, __p_, __ec); } __attribute__ ((__exclude_from_explicit_instantiation__)) void __refresh(error_code* __ec = nullptr) { __handle_error("in directory_entry::refresh", __ec, __do_refresh(), true); } __attribute__ ((__exclude_from_explicit_instantiation__)) file_type __get_sym_ft(error_code* __ec = nullptr) const { switch (__data_.__cache_type_) { case _Empty: return __symlink_status(__p_, __ec).type(); case _IterSymlink: case _RefreshSymlink: case _RefreshSymlinkUnresolved: if (__ec) __ec->clear(); return file_type::symlink; case _IterNonSymlink: case _RefreshNonSymlink: file_status __st(__data_.__type_); if (__ec && !std::__1::__fs::filesystem::exists(__st)) *__ec = make_error_code(errc::no_such_file_or_directory); else if (__ec) __ec->clear(); return __data_.__type_; } std::__1::abort(); } __attribute__ ((__exclude_from_explicit_instantiation__)) file_type __get_ft(error_code* __ec = nullptr) const { switch (__data_.__cache_type_) { case _Empty: case _IterSymlink: case _RefreshSymlinkUnresolved: return __status(__p_, __ec).type(); case _IterNonSymlink: case _RefreshNonSymlink: case _RefreshSymlink: { file_status __st(__data_.__type_); if (__ec && !std::__1::__fs::filesystem::exists(__st)) *__ec = make_error_code(errc::no_such_file_or_directory); else if (__ec) __ec->clear(); return __data_.__type_; } } std::__1::abort(); } __attribute__ ((__exclude_from_explicit_instantiation__)) file_status __get_status(error_code* __ec = nullptr) const { switch (__data_.__cache_type_) { case _Empty: case _IterNonSymlink: case _IterSymlink: case _RefreshSymlinkUnresolved: return __status(__p_, __ec); case _RefreshNonSymlink: case _RefreshSymlink: return file_status(__get_ft(__ec), __data_.__non_sym_perms_); } std::__1::abort(); } __attribute__ ((__exclude_from_explicit_instantiation__)) file_status __get_symlink_status(error_code* __ec = nullptr) const { switch (__data_.__cache_type_) { case _Empty: case _IterNonSymlink: case _IterSymlink: return __symlink_status(__p_, __ec); case _RefreshNonSymlink: return file_status(__get_sym_ft(__ec), __data_.__non_sym_perms_); case _RefreshSymlink: case _RefreshSymlinkUnresolved: return file_status(__get_sym_ft(__ec), __data_.__sym_perms_); } std::__1::abort(); } __attribute__ ((__exclude_from_explicit_instantiation__)) uintmax_t __get_size(error_code* __ec = nullptr) const { switch (__data_.__cache_type_) { case _Empty: case _IterNonSymlink: case _IterSymlink: case _RefreshSymlinkUnresolved: return std::__1::__fs::filesystem::__file_size(__p_, __ec); case _RefreshSymlink: case _RefreshNonSymlink: { error_code __m_ec; file_status __st(__get_ft(&__m_ec)); __handle_error("in directory_entry::file_size", __ec, __m_ec); if (std::__1::__fs::filesystem::exists(__st) && !std::__1::__fs::filesystem::is_regular_file(__st)) { errc __err_kind = std::__1::__fs::filesystem::is_directory(__st) ? errc::is_a_directory : errc::not_supported; __handle_error("in directory_entry::file_size", __ec, make_error_code(__err_kind)); } return __data_.__size_; } } std::__1::abort(); } __attribute__ ((__exclude_from_explicit_instantiation__)) uintmax_t __get_nlink(error_code* __ec = nullptr) const { switch (__data_.__cache_type_) { case _Empty: case _IterNonSymlink: case _IterSymlink: case _RefreshSymlinkUnresolved: return std::__1::__fs::filesystem::__hard_link_count(__p_, __ec); case _RefreshSymlink: case _RefreshNonSymlink: { error_code __m_ec; (void)__get_ft(&__m_ec); __handle_error("in directory_entry::hard_link_count", __ec, __m_ec); return __data_.__nlink_; } } std::__1::abort(); } __attribute__ ((__exclude_from_explicit_instantiation__)) file_time_type __get_write_time(error_code* __ec = nullptr) const { switch (__data_.__cache_type_) { case _Empty: case _IterNonSymlink: case _IterSymlink: case _RefreshSymlinkUnresolved: return std::__1::__fs::filesystem::__last_write_time(__p_, __ec); case _RefreshSymlink: case _RefreshNonSymlink: { error_code __m_ec; file_status __st(__get_ft(&__m_ec)); __handle_error("in directory_entry::last_write_time", __ec, __m_ec); if (std::__1::__fs::filesystem::exists(__st) && __data_.__write_time_ == file_time_type::min()) __handle_error("in directory_entry::last_write_time", __ec, make_error_code(errc::value_too_large)); return __data_.__write_time_; } } std::__1::abort(); } private: _Path __p_; __cached_data __data_; }; class __dir_element_proxy { public: inline __attribute__ ((__exclude_from_explicit_instantiation__)) directory_entry operator*() { return std::__1::move(__elem_); } private: friend class directory_iterator; friend class recursive_directory_iterator; explicit __dir_element_proxy(directory_entry const& __e) : __elem_(__e) {} __dir_element_proxy(__dir_element_proxy&& __o) : __elem_(std::__1::move(__o.__elem_)) {} directory_entry __elem_; }; class directory_iterator { public: typedef directory_entry value_type; typedef ptrdiff_t difference_type; typedef value_type const* pointer; typedef value_type const& reference; typedef input_iterator_tag iterator_category; public: directory_iterator() noexcept {} explicit directory_iterator(const path& __p) : directory_iterator(__p, nullptr) {} directory_iterator(const path& __p, directory_options __opts) : directory_iterator(__p, nullptr, __opts) {} directory_iterator(const path& __p, error_code& __ec) : directory_iterator(__p, &__ec) {} directory_iterator(const path& __p, directory_options __opts, error_code& __ec) : directory_iterator(__p, &__ec, __opts) {} directory_iterator(const directory_iterator&) = default; directory_iterator(directory_iterator&&) = default; directory_iterator& operator=(const directory_iterator&) = default; directory_iterator& operator=(directory_iterator&& __o) noexcept { if (this != &__o) { __imp_ = std::__1::move(__o.__imp_); } return *this; } ~directory_iterator() = default; const directory_entry& operator*() const { ((void)0); return __dereference(); } const directory_entry* operator->() const { return &**this; } directory_iterator& operator++() { return __increment(); } __dir_element_proxy operator++(int) { __dir_element_proxy __p(**this); __increment(); return __p; } directory_iterator& increment(error_code& __ec) { return __increment(&__ec); } private: inline __attribute__ ((__exclude_from_explicit_instantiation__)) friend bool operator==(const directory_iterator& __lhs, const directory_iterator& __rhs) noexcept; directory_iterator(const path&, error_code*, directory_options = directory_options::none); directory_iterator& __increment(error_code* __ec = nullptr); const directory_entry& __dereference() const; private: shared_ptr<__dir_stream> __imp_; }; inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const directory_iterator& __lhs, const directory_iterator& __rhs) noexcept { return __lhs.__imp_ == __rhs.__imp_; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const directory_iterator& __lhs, const directory_iterator& __rhs) noexcept { return !(__lhs == __rhs); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) directory_iterator begin(directory_iterator __iter) noexcept { return __iter; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) directory_iterator end(const directory_iterator&) noexcept { return directory_iterator(); } class recursive_directory_iterator { public: using value_type = directory_entry; using difference_type = std::ptrdiff_t; using pointer = directory_entry const*; using reference = directory_entry const&; using iterator_category = std::input_iterator_tag; public: __attribute__ ((__exclude_from_explicit_instantiation__)) recursive_directory_iterator() noexcept : __rec_(false) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit recursive_directory_iterator( const path& __p, directory_options __xoptions = directory_options::none) : recursive_directory_iterator(__p, __xoptions, nullptr) {} __attribute__ ((__exclude_from_explicit_instantiation__)) recursive_directory_iterator(const path& __p, directory_options __xoptions, error_code& __ec) : recursive_directory_iterator(__p, __xoptions, &__ec) {} __attribute__ ((__exclude_from_explicit_instantiation__)) recursive_directory_iterator(const path& __p, error_code& __ec) : recursive_directory_iterator(__p, directory_options::none, &__ec) {} recursive_directory_iterator(const recursive_directory_iterator&) = default; recursive_directory_iterator(recursive_directory_iterator&&) = default; recursive_directory_iterator& operator=(const recursive_directory_iterator&) = default; __attribute__ ((__exclude_from_explicit_instantiation__)) recursive_directory_iterator& operator=(recursive_directory_iterator&& __o) noexcept { if (this != &__o) { __imp_ = std::__1::move(__o.__imp_); __rec_ = __o.__rec_; } return *this; } ~recursive_directory_iterator() = default; __attribute__ ((__exclude_from_explicit_instantiation__)) const directory_entry& operator*() const { return __dereference(); } __attribute__ ((__exclude_from_explicit_instantiation__)) const directory_entry* operator->() const { return &__dereference(); } recursive_directory_iterator& operator++() { return __increment(); } __attribute__ ((__exclude_from_explicit_instantiation__)) __dir_element_proxy operator++(int) { __dir_element_proxy __p(**this); __increment(); return __p; } __attribute__ ((__exclude_from_explicit_instantiation__)) recursive_directory_iterator& increment(error_code& __ec) { return __increment(&__ec); } directory_options options() const; int depth() const; __attribute__ ((__exclude_from_explicit_instantiation__)) void pop() { __pop(); } __attribute__ ((__exclude_from_explicit_instantiation__)) void pop(error_code& __ec) { __pop(&__ec); } __attribute__ ((__exclude_from_explicit_instantiation__)) bool recursion_pending() const { return __rec_; } __attribute__ ((__exclude_from_explicit_instantiation__)) void disable_recursion_pending() { __rec_ = false; } private: recursive_directory_iterator(const path& __p, directory_options __opt, error_code* __ec); const directory_entry& __dereference() const; bool __try_recursion(error_code* __ec); void __advance(error_code* __ec = nullptr); recursive_directory_iterator& __increment(error_code* __ec = nullptr); void __pop(error_code* __ec = nullptr); inline __attribute__ ((__exclude_from_explicit_instantiation__)) friend bool operator==(const recursive_directory_iterator&, const recursive_directory_iterator&) noexcept; struct __shared_imp; shared_ptr<__shared_imp> __imp_; bool __rec_; }; inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const recursive_directory_iterator& __lhs, const recursive_directory_iterator& __rhs) noexcept { return __lhs.__imp_ == __rhs.__imp_; } __attribute__ ((__exclude_from_explicit_instantiation__)) inline bool operator!=(const recursive_directory_iterator& __lhs, const recursive_directory_iterator& __rhs) noexcept { return !(__lhs == __rhs); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) recursive_directory_iterator begin(recursive_directory_iterator __iter) noexcept { return __iter; } inline __attribute__ ((__exclude_from_explicit_instantiation__)) recursive_directory_iterator end(const recursive_directory_iterator&) noexcept { return recursive_directory_iterator(); } } } } } namespace std { inline namespace __1 { template <class _CharT, class _Traits> class basic_filebuf : public basic_streambuf<_CharT, _Traits> { public: typedef _CharT char_type; typedef _Traits traits_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; typedef typename traits_type::state_type state_type; basic_filebuf(); basic_filebuf(basic_filebuf&& __rhs); virtual ~basic_filebuf(); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_filebuf& operator=(basic_filebuf&& __rhs); void swap(basic_filebuf& __rhs); __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_open() const; basic_filebuf* open(const char* __s, ios_base::openmode __mode); basic_filebuf* open(const wchar_t* __s, ios_base::openmode __mode); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_filebuf* open(const string& __s, ios_base::openmode __mode); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_filebuf* __open(int __fd, ios_base::openmode __mode); basic_filebuf* close(); __attribute__ ((__exclude_from_explicit_instantiation__)) inline static const char* __make_mdstring(ios_base::openmode __mode) noexcept; protected: virtual int_type underflow(); virtual int_type pbackfail(int_type __c = traits_type::eof()); virtual int_type overflow (int_type __c = traits_type::eof()); virtual basic_streambuf<char_type, traits_type>* setbuf(char_type* __s, streamsize __n); virtual pos_type seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __wch = ios_base::in | ios_base::out); virtual pos_type seekpos(pos_type __sp, ios_base::openmode __wch = ios_base::in | ios_base::out); virtual int sync(); virtual void imbue(const locale& __loc); private: char* __extbuf_; const char* __extbufnext_; const char* __extbufend_; char __extbuf_min_[8]; size_t __ebs_; char_type* __intbuf_; size_t __ibs_; FILE* __file_; const codecvt<char_type, char, state_type>* __cv_; state_type __st_; state_type __st_last_; ios_base::openmode __om_; ios_base::openmode __cm_; bool __owns_eb_; bool __owns_ib_; bool __always_noconv_; bool __read_mode(); void __write_mode(); }; template <class _CharT, class _Traits> basic_filebuf<_CharT, _Traits>::basic_filebuf() : __extbuf_(0), __extbufnext_(0), __extbufend_(0), __ebs_(0), __intbuf_(0), __ibs_(0), __file_(0), __cv_(nullptr), __st_(), __st_last_(), __om_(0), __cm_(0), __owns_eb_(false), __owns_ib_(false), __always_noconv_(false) { if (has_facet<codecvt<char_type, char, state_type> >(this->getloc())) { __cv_ = &use_facet<codecvt<char_type, char, state_type> >(this->getloc()); __always_noconv_ = __cv_->always_noconv(); } setbuf(0, 4096); } template <class _CharT, class _Traits> basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs) : basic_streambuf<_CharT, _Traits>(__rhs) { if (__rhs.__extbuf_ == __rhs.__extbuf_min_) { __extbuf_ = __extbuf_min_; __extbufnext_ = __extbuf_ + (__rhs.__extbufnext_ - __rhs.__extbuf_); __extbufend_ = __extbuf_ + (__rhs.__extbufend_ - __rhs.__extbuf_); } else { __extbuf_ = __rhs.__extbuf_; __extbufnext_ = __rhs.__extbufnext_; __extbufend_ = __rhs.__extbufend_; } __ebs_ = __rhs.__ebs_; __intbuf_ = __rhs.__intbuf_; __ibs_ = __rhs.__ibs_; __file_ = __rhs.__file_; __cv_ = __rhs.__cv_; __st_ = __rhs.__st_; __st_last_ = __rhs.__st_last_; __om_ = __rhs.__om_; __cm_ = __rhs.__cm_; __owns_eb_ = __rhs.__owns_eb_; __owns_ib_ = __rhs.__owns_ib_; __always_noconv_ = __rhs.__always_noconv_; if (__rhs.pbase()) { if (__rhs.pbase() == __rhs.__intbuf_) this->setp(__intbuf_, __intbuf_ + (__rhs. epptr() - __rhs.pbase())); else this->setp((char_type*)__extbuf_, (char_type*)__extbuf_ + (__rhs. epptr() - __rhs.pbase())); this->__pbump(__rhs. pptr() - __rhs.pbase()); } else if (__rhs.eback()) { if (__rhs.eback() == __rhs.__intbuf_) this->setg(__intbuf_, __intbuf_ + (__rhs.gptr() - __rhs.eback()), __intbuf_ + (__rhs.egptr() - __rhs.eback())); else this->setg((char_type*)__extbuf_, (char_type*)__extbuf_ + (__rhs.gptr() - __rhs.eback()), (char_type*)__extbuf_ + (__rhs.egptr() - __rhs.eback())); } __rhs.__extbuf_ = 0; __rhs.__extbufnext_ = 0; __rhs.__extbufend_ = 0; __rhs.__ebs_ = 0; __rhs.__intbuf_ = 0; __rhs.__ibs_ = 0; __rhs.__file_ = 0; __rhs.__st_ = state_type(); __rhs.__st_last_ = state_type(); __rhs.__om_ = 0; __rhs.__cm_ = 0; __rhs.__owns_eb_ = false; __rhs.__owns_ib_ = false; __rhs.setg(0, 0, 0); __rhs.setp(0, 0); } template <class _CharT, class _Traits> inline basic_filebuf<_CharT, _Traits>& basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs) { close(); swap(__rhs); return *this; } template <class _CharT, class _Traits> basic_filebuf<_CharT, _Traits>::~basic_filebuf() { close(); if (__owns_eb_) delete [] __extbuf_; if (__owns_ib_) delete [] __intbuf_; } template <class _CharT, class _Traits> void basic_filebuf<_CharT, _Traits>::swap(basic_filebuf& __rhs) { basic_streambuf<char_type, traits_type>::swap(__rhs); if (__extbuf_ != __extbuf_min_ && __rhs.__extbuf_ != __rhs.__extbuf_min_) { std::__1::swap(__extbuf_, __rhs.__extbuf_); std::__1::swap(__extbufnext_, __rhs.__extbufnext_); std::__1::swap(__extbufend_, __rhs.__extbufend_); } else { ptrdiff_t __ln = __extbufnext_ - __extbuf_; ptrdiff_t __le = __extbufend_ - __extbuf_; ptrdiff_t __rn = __rhs.__extbufnext_ - __rhs.__extbuf_; ptrdiff_t __re = __rhs.__extbufend_ - __rhs.__extbuf_; if (__extbuf_ == __extbuf_min_ && __rhs.__extbuf_ != __rhs.__extbuf_min_) { __extbuf_ = __rhs.__extbuf_; __rhs.__extbuf_ = __rhs.__extbuf_min_; } else if (__extbuf_ != __extbuf_min_ && __rhs.__extbuf_ == __rhs.__extbuf_min_) { __rhs.__extbuf_ = __extbuf_; __extbuf_ = __extbuf_min_; } __extbufnext_ = __extbuf_ + __rn; __extbufend_ = __extbuf_ + __re; __rhs.__extbufnext_ = __rhs.__extbuf_ + __ln; __rhs.__extbufend_ = __rhs.__extbuf_ + __le; } std::__1::swap(__ebs_, __rhs.__ebs_); std::__1::swap(__intbuf_, __rhs.__intbuf_); std::__1::swap(__ibs_, __rhs.__ibs_); std::__1::swap(__file_, __rhs.__file_); std::__1::swap(__cv_, __rhs.__cv_); std::__1::swap(__st_, __rhs.__st_); std::__1::swap(__st_last_, __rhs.__st_last_); std::__1::swap(__om_, __rhs.__om_); std::__1::swap(__cm_, __rhs.__cm_); std::__1::swap(__owns_eb_, __rhs.__owns_eb_); std::__1::swap(__owns_ib_, __rhs.__owns_ib_); std::__1::swap(__always_noconv_, __rhs.__always_noconv_); if (this->eback() == (char_type*)__rhs.__extbuf_min_) { ptrdiff_t __n = this->gptr() - this->eback(); ptrdiff_t __e = this->egptr() - this->eback(); this->setg((char_type*)__extbuf_min_, (char_type*)__extbuf_min_ + __n, (char_type*)__extbuf_min_ + __e); } else if (this->pbase() == (char_type*)__rhs.__extbuf_min_) { ptrdiff_t __n = this->pptr() - this->pbase(); ptrdiff_t __e = this->epptr() - this->pbase(); this->setp((char_type*)__extbuf_min_, (char_type*)__extbuf_min_ + __e); this->__pbump(__n); } if (__rhs.eback() == (char_type*)__extbuf_min_) { ptrdiff_t __n = __rhs.gptr() - __rhs.eback(); ptrdiff_t __e = __rhs.egptr() - __rhs.eback(); __rhs.setg((char_type*)__rhs.__extbuf_min_, (char_type*)__rhs.__extbuf_min_ + __n, (char_type*)__rhs.__extbuf_min_ + __e); } else if (__rhs.pbase() == (char_type*)__extbuf_min_) { ptrdiff_t __n = __rhs.pptr() - __rhs.pbase(); ptrdiff_t __e = __rhs.epptr() - __rhs.pbase(); __rhs.setp((char_type*)__rhs.__extbuf_min_, (char_type*)__rhs.__extbuf_min_ + __e); __rhs.__pbump(__n); } } template <class _CharT, class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(basic_filebuf<_CharT, _Traits>& __x, basic_filebuf<_CharT, _Traits>& __y) { __x.swap(__y); } template <class _CharT, class _Traits> inline bool basic_filebuf<_CharT, _Traits>::is_open() const { return __file_ != 0; } template <class _CharT, class _Traits> const char* basic_filebuf<_CharT, _Traits>::__make_mdstring( ios_base::openmode __mode) noexcept { switch (__mode & ~ios_base::ate) { case ios_base::out: case ios_base::out | ios_base::trunc: return "w" ; case ios_base::out | ios_base::app: case ios_base::app: return "a" ; case ios_base::in: return "r" ; case ios_base::in | ios_base::out: return "r+" ; case ios_base::in | ios_base::out | ios_base::trunc: return "w+" ; case ios_base::in | ios_base::out | ios_base::app: case ios_base::in | ios_base::app: return "a+" ; case ios_base::out | ios_base::binary: case ios_base::out | ios_base::trunc | ios_base::binary: return "wb" ; case ios_base::out | ios_base::app | ios_base::binary: case ios_base::app | ios_base::binary: return "ab" ; case ios_base::in | ios_base::binary: return "rb" ; case ios_base::in | ios_base::out | ios_base::binary: return "r+b" ; case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary: return "w+b" ; case ios_base::in | ios_base::out | ios_base::app | ios_base::binary: case ios_base::in | ios_base::app | ios_base::binary: return "a+b" ; default: return nullptr; } std::__1::abort(); } template <class _CharT, class _Traits> basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode) { basic_filebuf<_CharT, _Traits>* __rt = 0; if (__file_ == 0) { if (const char* __mdstr = __make_mdstring(__mode)) { __rt = this; __file_ = fopen(__s, __mdstr); if (__file_) { __om_ = __mode; if (__mode & ios_base::ate) { if (fseek(__file_, 0, 2)) { fclose(__file_); __file_ = 0; __rt = 0; } } } else __rt = 0; } } return __rt; } template <class _CharT, class _Traits> __attribute__ ((__exclude_from_explicit_instantiation__)) basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) { basic_filebuf<_CharT, _Traits>* __rt = 0; if (__file_ == 0) { if (const char* __mdstr = __make_mdstring(__mode)) { __rt = this; __file_ = fdopen(__fd, __mdstr); if (__file_) { __om_ = __mode; if (__mode & ios_base::ate) { if (fseek(__file_, 0, 2)) { fclose(__file_); __file_ = 0; __rt = 0; } } } else __rt = 0; } } return __rt; } template <class _CharT, class _Traits> basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode) { basic_filebuf<_CharT, _Traits>* __rt = 0; if (__file_ == 0) { __rt = this; const wchar_t* __mdstr; switch (__mode & ~ios_base::ate) { case ios_base::out: case ios_base::out | ios_base::trunc: __mdstr = L"w"; break; case ios_base::out | ios_base::app: case ios_base::app: __mdstr = L"a"; break; case ios_base::in: __mdstr = L"r"; break; case ios_base::in | ios_base::out: __mdstr = L"r+"; break; case ios_base::in | ios_base::out | ios_base::trunc: __mdstr = L"w+"; break; case ios_base::in | ios_base::out | ios_base::app: case ios_base::in | ios_base::app: __mdstr = L"a+"; break; case ios_base::out | ios_base::binary: case ios_base::out | ios_base::trunc | ios_base::binary: __mdstr = L"wb"; break; case ios_base::out | ios_base::app | ios_base::binary: case ios_base::app | ios_base::binary: __mdstr = L"ab"; break; case ios_base::in | ios_base::binary: __mdstr = L"rb"; break; case ios_base::in | ios_base::out | ios_base::binary: __mdstr = L"r+b"; break; case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary: __mdstr = L"w+b"; break; case ios_base::in | ios_base::out | ios_base::app | ios_base::binary: case ios_base::in | ios_base::app | ios_base::binary: __mdstr = L"a+b"; break; default: __rt = 0; break; } if (__rt) { __file_ = _wfopen(__s, __mdstr); if (__file_) { __om_ = __mode; if (__mode & ios_base::ate) { if (fseek(__file_, 0, 2)) { fclose(__file_); __file_ = 0; __rt = 0; } } } else __rt = 0; } } return __rt; } template <class _CharT, class _Traits> inline basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode) { return open(__s.c_str(), __mode); } template <class _CharT, class _Traits> basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::close() { basic_filebuf<_CharT, _Traits>* __rt = 0; if (__file_) { __rt = this; unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose); if (sync()) __rt = 0; if (fclose(__h.release())) __rt = 0; __file_ = 0; setbuf(0, 0); } return __rt; } template <class _CharT, class _Traits> typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>::underflow() { if (__file_ == 0) return traits_type::eof(); bool __initial = __read_mode(); char_type __1buf; if (this->gptr() == 0) this->setg(&__1buf, &__1buf+1, &__1buf+1); const size_t __unget_sz = __initial ? 0 : min<size_t>((this->egptr() - this->eback()) / 2, 4); int_type __c = traits_type::eof(); if (this->gptr() == this->egptr()) { memmove(this->eback(), this->egptr() - __unget_sz, __unget_sz * sizeof(char_type)); if (__always_noconv_) { size_t __nmemb = static_cast<size_t>(this->egptr() - this->eback() - __unget_sz); __nmemb = fread(this->eback() + __unget_sz, 1, __nmemb, __file_); if (__nmemb != 0) { this->setg(this->eback(), this->eback() + __unget_sz, this->eback() + __unget_sz + __nmemb); __c = traits_type::to_int_type(*this->gptr()); } } else { ((void)0); if (__extbufend_ != __extbufnext_) memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_); __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_); __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_); size_t __nmemb = std::__1::min(static_cast<size_t>(__ibs_ - __unget_sz), static_cast<size_t>(__extbufend_ - __extbufnext_)); codecvt_base::result __r; __st_last_ = __st_; size_t __nr = fread((void*) const_cast<char *>(__extbufnext_), 1, __nmemb, __file_); if (__nr != 0) { if (!__cv_) __throw_bad_cast(); __extbufend_ = __extbufnext_ + __nr; char_type* __inext; __r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_, this->eback() + __unget_sz, this->eback() + __ibs_, __inext); if (__r == codecvt_base::noconv) { this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)const_cast<char *>(__extbufend_)); __c = traits_type::to_int_type(*this->gptr()); } else if (__inext != this->eback() + __unget_sz) { this->setg(this->eback(), this->eback() + __unget_sz, __inext); __c = traits_type::to_int_type(*this->gptr()); } } } } else __c = traits_type::to_int_type(*this->gptr()); if (this->eback() == &__1buf) this->setg(0, 0, 0); return __c; } template <class _CharT, class _Traits> typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>::pbackfail(int_type __c) { if (__file_ && this->eback() < this->gptr()) { if (traits_type::eq_int_type(__c, traits_type::eof())) { this->gbump(-1); return traits_type::not_eof(__c); } if ((__om_ & ios_base::out) || traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1])) { this->gbump(-1); *this->gptr() = traits_type::to_char_type(__c); return __c; } } return traits_type::eof(); } template <class _CharT, class _Traits> typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>::overflow(int_type __c) { if (__file_ == 0) return traits_type::eof(); __write_mode(); char_type __1buf; char_type* __pb_save = this->pbase(); char_type* __epb_save = this->epptr(); if (!traits_type::eq_int_type(__c, traits_type::eof())) { if (this->pptr() == 0) this->setp(&__1buf, &__1buf+1); *this->pptr() = traits_type::to_char_type(__c); this->pbump(1); } if (this->pptr() != this->pbase()) { if (__always_noconv_) { size_t __nmemb = static_cast<size_t>(this->pptr() - this->pbase()); if (fwrite(this->pbase(), sizeof(char_type), __nmemb, __file_) != __nmemb) return traits_type::eof(); } else { char* __extbe = __extbuf_; codecvt_base::result __r; do { if (!__cv_) __throw_bad_cast(); const char_type* __e; __r = __cv_->out(__st_, this->pbase(), this->pptr(), __e, __extbuf_, __extbuf_ + __ebs_, __extbe); if (__e == this->pbase()) return traits_type::eof(); if (__r == codecvt_base::noconv) { size_t __nmemb = static_cast<size_t>(this->pptr() - this->pbase()); if (fwrite(this->pbase(), 1, __nmemb, __file_) != __nmemb) return traits_type::eof(); } else if (__r == codecvt_base::ok || __r == codecvt_base::partial) { size_t __nmemb = static_cast<size_t>(__extbe - __extbuf_); if (fwrite(__extbuf_, 1, __nmemb, __file_) != __nmemb) return traits_type::eof(); if (__r == codecvt_base::partial) { this->setp(const_cast<char_type*>(__e), this->pptr()); this->__pbump(this->epptr() - this->pbase()); } } else return traits_type::eof(); } while (__r == codecvt_base::partial); } this->setp(__pb_save, __epb_save); } return traits_type::not_eof(__c); } template <class _CharT, class _Traits> basic_streambuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::setbuf(char_type* __s, streamsize __n) { this->setg(0, 0, 0); this->setp(0, 0); if (__owns_eb_) delete [] __extbuf_; if (__owns_ib_) delete [] __intbuf_; __ebs_ = __n; if (__ebs_ > sizeof(__extbuf_min_)) { if (__always_noconv_ && __s) { __extbuf_ = (char*)__s; __owns_eb_ = false; } else { __extbuf_ = new char[__ebs_]; __owns_eb_ = true; } } else { __extbuf_ = __extbuf_min_; __ebs_ = sizeof(__extbuf_min_); __owns_eb_ = false; } if (!__always_noconv_) { __ibs_ = max<streamsize>(__n, sizeof(__extbuf_min_)); if (__s && __ibs_ >= sizeof(__extbuf_min_)) { __intbuf_ = __s; __owns_ib_ = false; } else { __intbuf_ = new char_type[__ibs_]; __owns_ib_ = true; } } else { __ibs_ = 0; __intbuf_ = 0; __owns_ib_ = false; } return this; } template <class _CharT, class _Traits> typename basic_filebuf<_CharT, _Traits>::pos_type basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode) { if (!__cv_) __throw_bad_cast(); int __width = __cv_->encoding(); if (__file_ == 0 || (__width <= 0 && __off != 0) || sync()) return pos_type(off_type(-1)); int __whence; switch (__way) { case ios_base::beg: __whence = 0; break; case ios_base::cur: __whence = 1; break; case ios_base::end: __whence = 2; break; default: return pos_type(off_type(-1)); } if (fseek(__file_, __width > 0 ? __width * __off : 0, __whence)) return pos_type(off_type(-1)); pos_type __r = ftell(__file_); __r.state(__st_); return __r; } template <class _CharT, class _Traits> typename basic_filebuf<_CharT, _Traits>::pos_type basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode) { if (__file_ == 0 || sync()) return pos_type(off_type(-1)); if (fseek(__file_, __sp, 0)) return pos_type(off_type(-1)); __st_ = __sp.state(); return __sp; } template <class _CharT, class _Traits> int basic_filebuf<_CharT, _Traits>::sync() { if (__file_ == 0) return 0; if (!__cv_) __throw_bad_cast(); if (__cm_ & ios_base::out) { if (this->pptr() != this->pbase()) if (overflow() == traits_type::eof()) return -1; codecvt_base::result __r; do { char* __extbe; __r = __cv_->unshift(__st_, __extbuf_, __extbuf_ + __ebs_, __extbe); size_t __nmemb = static_cast<size_t>(__extbe - __extbuf_); if (fwrite(__extbuf_, 1, __nmemb, __file_) != __nmemb) return -1; } while (__r == codecvt_base::partial); if (__r == codecvt_base::error) return -1; if (fflush(__file_)) return -1; } else if (__cm_ & ios_base::in) { off_type __c; state_type __state = __st_last_; bool __update_st = false; if (__always_noconv_) __c = this->egptr() - this->gptr(); else { int __width = __cv_->encoding(); __c = __extbufend_ - __extbufnext_; if (__width > 0) __c += __width * (this->egptr() - this->gptr()); else { if (this->gptr() != this->egptr()) { const int __off = __cv_->length(__state, __extbuf_, __extbufnext_, this->gptr() - this->eback()); __c += __extbufnext_ - __extbuf_ - __off; __update_st = true; } } } if (fseek(__file_, -__c, 1)) return -1; if (__update_st) __st_ = __state; __extbufnext_ = __extbufend_ = __extbuf_; this->setg(0, 0, 0); __cm_ = 0; } return 0; } template <class _CharT, class _Traits> void basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc) { sync(); __cv_ = &use_facet<codecvt<char_type, char, state_type> >(__loc); bool __old_anc = __always_noconv_; __always_noconv_ = __cv_->always_noconv(); if (__old_anc != __always_noconv_) { this->setg(0, 0, 0); this->setp(0, 0); if (__always_noconv_) { if (__owns_eb_) delete [] __extbuf_; __owns_eb_ = __owns_ib_; __ebs_ = __ibs_; __extbuf_ = (char*)__intbuf_; __ibs_ = 0; __intbuf_ = 0; __owns_ib_ = false; } else { if (!__owns_eb_ && __extbuf_ != __extbuf_min_) { __ibs_ = __ebs_; __intbuf_ = (char_type*)__extbuf_; __owns_ib_ = false; __extbuf_ = new char[__ebs_]; __owns_eb_ = true; } else { __ibs_ = __ebs_; __intbuf_ = new char_type[__ibs_]; __owns_ib_ = true; } } } } template <class _CharT, class _Traits> bool basic_filebuf<_CharT, _Traits>::__read_mode() { if (!(__cm_ & ios_base::in)) { this->setp(0, 0); if (__always_noconv_) this->setg((char_type*)__extbuf_, (char_type*)__extbuf_ + __ebs_, (char_type*)__extbuf_ + __ebs_); else this->setg(__intbuf_, __intbuf_ + __ibs_, __intbuf_ + __ibs_); __cm_ = ios_base::in; return true; } return false; } template <class _CharT, class _Traits> void basic_filebuf<_CharT, _Traits>::__write_mode() { if (!(__cm_ & ios_base::out)) { this->setg(0, 0, 0); if (__ebs_ > sizeof(__extbuf_min_)) { if (__always_noconv_) this->setp((char_type*)__extbuf_, (char_type*)__extbuf_ + (__ebs_ - 1)); else this->setp(__intbuf_, __intbuf_ + (__ibs_ - 1)); } else this->setp(0, 0); __cm_ = ios_base::out; } } template <class _CharT, class _Traits> class basic_ifstream : public basic_istream<_CharT, _Traits> { public: typedef _CharT char_type; typedef _Traits traits_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ifstream(); __attribute__ ((__exclude_from_explicit_instantiation__)) explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in); __attribute__ ((__exclude_from_explicit_instantiation__)) explicit basic_ifstream(const wchar_t* __s, ios_base::openmode __mode = ios_base::in); __attribute__ ((__exclude_from_explicit_instantiation__)) explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ifstream(basic_ifstream&& __rhs); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ifstream& operator=(basic_ifstream&& __rhs); __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(basic_ifstream& __rhs); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_filebuf<char_type, traits_type>* rdbuf() const; __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_open() const; void open(const char* __s, ios_base::openmode __mode = ios_base::in); void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::in); void open(const string& __s, ios_base::openmode __mode = ios_base::in); __attribute__ ((__exclude_from_explicit_instantiation__)) void __open(int __fd, ios_base::openmode __mode); __attribute__ ((__exclude_from_explicit_instantiation__)) void close(); private: basic_filebuf<char_type, traits_type> __sb_; }; template <class _CharT, class _Traits> inline basic_ifstream<_CharT, _Traits>::basic_ifstream() : basic_istream<char_type, traits_type>(&__sb_) { } template <class _CharT, class _Traits> inline basic_ifstream<_CharT, _Traits>::basic_ifstream(const char* __s, ios_base::openmode __mode) : basic_istream<char_type, traits_type>(&__sb_) { if (__sb_.open(__s, __mode | ios_base::in) == 0) this->setstate(ios_base::failbit); } template <class _CharT, class _Traits> inline basic_ifstream<_CharT, _Traits>::basic_ifstream(const wchar_t* __s, ios_base::openmode __mode) : basic_istream<char_type, traits_type>(&__sb_) { if (__sb_.open(__s, __mode | ios_base::in) == 0) this->setstate(ios_base::failbit); } template <class _CharT, class _Traits> inline basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::openmode __mode) : basic_istream<char_type, traits_type>(&__sb_) { if (__sb_.open(__s, __mode | ios_base::in) == 0) this->setstate(ios_base::failbit); } template <class _CharT, class _Traits> inline basic_ifstream<_CharT, _Traits>::basic_ifstream(basic_ifstream&& __rhs) : basic_istream<char_type, traits_type>(std::__1::move(__rhs)), __sb_(std::__1::move(__rhs.__sb_)) { this->set_rdbuf(&__sb_); } template <class _CharT, class _Traits> inline basic_ifstream<_CharT, _Traits>& basic_ifstream<_CharT, _Traits>::operator=(basic_ifstream&& __rhs) { basic_istream<char_type, traits_type>::operator=(std::__1::move(__rhs)); __sb_ = std::__1::move(__rhs.__sb_); return *this; } template <class _CharT, class _Traits> inline void basic_ifstream<_CharT, _Traits>::swap(basic_ifstream& __rhs) { basic_istream<char_type, traits_type>::swap(__rhs); __sb_.swap(__rhs.__sb_); } template <class _CharT, class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(basic_ifstream<_CharT, _Traits>& __x, basic_ifstream<_CharT, _Traits>& __y) { __x.swap(__y); } template <class _CharT, class _Traits> inline basic_filebuf<_CharT, _Traits>* basic_ifstream<_CharT, _Traits>::rdbuf() const { return const_cast<basic_filebuf<char_type, traits_type>*>(&__sb_); } template <class _CharT, class _Traits> inline bool basic_ifstream<_CharT, _Traits>::is_open() const { return __sb_.is_open(); } template <class _CharT, class _Traits> void basic_ifstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode) { if (__sb_.open(__s, __mode | ios_base::in)) this->clear(); else this->setstate(ios_base::failbit); } template <class _CharT, class _Traits> void basic_ifstream<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode) { if (__sb_.open(__s, __mode | ios_base::in)) this->clear(); else this->setstate(ios_base::failbit); } template <class _CharT, class _Traits> void basic_ifstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode) { if (__sb_.open(__s, __mode | ios_base::in)) this->clear(); else this->setstate(ios_base::failbit); } template <class _CharT, class _Traits> void basic_ifstream<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) { if (__sb_.__open(__fd, __mode | ios_base::in)) this->clear(); else this->setstate(ios_base::failbit); } template <class _CharT, class _Traits> inline void basic_ifstream<_CharT, _Traits>::close() { if (__sb_.close() == 0) this->setstate(ios_base::failbit); } template <class _CharT, class _Traits> class basic_ofstream : public basic_ostream<_CharT, _Traits> { public: typedef _CharT char_type; typedef _Traits traits_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ofstream(); __attribute__ ((__exclude_from_explicit_instantiation__)) explicit basic_ofstream(const char* __s, ios_base::openmode __mode = ios_base::out); __attribute__ ((__exclude_from_explicit_instantiation__)) explicit basic_ofstream(const wchar_t* __s, ios_base::openmode __mode = ios_base::out); __attribute__ ((__exclude_from_explicit_instantiation__)) explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ofstream(basic_ofstream&& __rhs); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ofstream& operator=(basic_ofstream&& __rhs); __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(basic_ofstream& __rhs); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_filebuf<char_type, traits_type>* rdbuf() const; __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_open() const; void open(const char* __s, ios_base::openmode __mode = ios_base::out); void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::out); void open(const string& __s, ios_base::openmode __mode = ios_base::out); __attribute__ ((__exclude_from_explicit_instantiation__)) void __open(int __fd, ios_base::openmode __mode); __attribute__ ((__exclude_from_explicit_instantiation__)) void close(); private: basic_filebuf<char_type, traits_type> __sb_; }; template <class _CharT, class _Traits> inline basic_ofstream<_CharT, _Traits>::basic_ofstream() : basic_ostream<char_type, traits_type>(&__sb_) { } template <class _CharT, class _Traits> inline basic_ofstream<_CharT, _Traits>::basic_ofstream(const char* __s, ios_base::openmode __mode) : basic_ostream<char_type, traits_type>(&__sb_) { if (__sb_.open(__s, __mode | ios_base::out) == 0) this->setstate(ios_base::failbit); } template <class _CharT, class _Traits> inline basic_ofstream<_CharT, _Traits>::basic_ofstream(const wchar_t* __s, ios_base::openmode __mode) : basic_ostream<char_type, traits_type>(&__sb_) { if (__sb_.open(__s, __mode | ios_base::out) == 0) this->setstate(ios_base::failbit); } template <class _CharT, class _Traits> inline basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::openmode __mode) : basic_ostream<char_type, traits_type>(&__sb_) { if (__sb_.open(__s, __mode | ios_base::out) == 0) this->setstate(ios_base::failbit); } template <class _CharT, class _Traits> inline basic_ofstream<_CharT, _Traits>::basic_ofstream(basic_ofstream&& __rhs) : basic_ostream<char_type, traits_type>(std::__1::move(__rhs)), __sb_(std::__1::move(__rhs.__sb_)) { this->set_rdbuf(&__sb_); } template <class _CharT, class _Traits> inline basic_ofstream<_CharT, _Traits>& basic_ofstream<_CharT, _Traits>::operator=(basic_ofstream&& __rhs) { basic_ostream<char_type, traits_type>::operator=(std::__1::move(__rhs)); __sb_ = std::__1::move(__rhs.__sb_); return *this; } template <class _CharT, class _Traits> inline void basic_ofstream<_CharT, _Traits>::swap(basic_ofstream& __rhs) { basic_ostream<char_type, traits_type>::swap(__rhs); __sb_.swap(__rhs.__sb_); } template <class _CharT, class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(basic_ofstream<_CharT, _Traits>& __x, basic_ofstream<_CharT, _Traits>& __y) { __x.swap(__y); } template <class _CharT, class _Traits> inline basic_filebuf<_CharT, _Traits>* basic_ofstream<_CharT, _Traits>::rdbuf() const { return const_cast<basic_filebuf<char_type, traits_type>*>(&__sb_); } template <class _CharT, class _Traits> inline bool basic_ofstream<_CharT, _Traits>::is_open() const { return __sb_.is_open(); } template <class _CharT, class _Traits> void basic_ofstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode) { if (__sb_.open(__s, __mode | ios_base::out)) this->clear(); else this->setstate(ios_base::failbit); } template <class _CharT, class _Traits> void basic_ofstream<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode) { if (__sb_.open(__s, __mode | ios_base::out)) this->clear(); else this->setstate(ios_base::failbit); } template <class _CharT, class _Traits> void basic_ofstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode) { if (__sb_.open(__s, __mode | ios_base::out)) this->clear(); else this->setstate(ios_base::failbit); } template <class _CharT, class _Traits> void basic_ofstream<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) { if (__sb_.__open(__fd, __mode | ios_base::out)) this->clear(); else this->setstate(ios_base::failbit); } template <class _CharT, class _Traits> inline void basic_ofstream<_CharT, _Traits>::close() { if (__sb_.close() == 0) this->setstate(ios_base::failbit); } template <class _CharT, class _Traits> class basic_fstream : public basic_iostream<_CharT, _Traits> { public: typedef _CharT char_type; typedef _Traits traits_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; __attribute__ ((__exclude_from_explicit_instantiation__)) basic_fstream(); __attribute__ ((__exclude_from_explicit_instantiation__)) explicit basic_fstream(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out); __attribute__ ((__exclude_from_explicit_instantiation__)) explicit basic_fstream(const wchar_t* __s, ios_base::openmode __mode = ios_base::in | ios_base::out); __attribute__ ((__exclude_from_explicit_instantiation__)) explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_fstream(basic_fstream&& __rhs); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_fstream& operator=(basic_fstream&& __rhs); __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(basic_fstream& __rhs); __attribute__ ((__exclude_from_explicit_instantiation__)) basic_filebuf<char_type, traits_type>* rdbuf() const; __attribute__ ((__exclude_from_explicit_instantiation__)) bool is_open() const; void open(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out); void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::in | ios_base::out); void open(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out); __attribute__ ((__exclude_from_explicit_instantiation__)) void close(); private: basic_filebuf<char_type, traits_type> __sb_; }; template <class _CharT, class _Traits> inline basic_fstream<_CharT, _Traits>::basic_fstream() : basic_iostream<char_type, traits_type>(&__sb_) { } template <class _CharT, class _Traits> inline basic_fstream<_CharT, _Traits>::basic_fstream(const char* __s, ios_base::openmode __mode) : basic_iostream<char_type, traits_type>(&__sb_) { if (__sb_.open(__s, __mode) == 0) this->setstate(ios_base::failbit); } template <class _CharT, class _Traits> inline basic_fstream<_CharT, _Traits>::basic_fstream(const wchar_t* __s, ios_base::openmode __mode) : basic_iostream<char_type, traits_type>(&__sb_) { if (__sb_.open(__s, __mode) == 0) this->setstate(ios_base::failbit); } template <class _CharT, class _Traits> inline basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openmode __mode) : basic_iostream<char_type, traits_type>(&__sb_) { if (__sb_.open(__s, __mode) == 0) this->setstate(ios_base::failbit); } template <class _CharT, class _Traits> inline basic_fstream<_CharT, _Traits>::basic_fstream(basic_fstream&& __rhs) : basic_iostream<char_type, traits_type>(std::__1::move(__rhs)), __sb_(std::__1::move(__rhs.__sb_)) { this->set_rdbuf(&__sb_); } template <class _CharT, class _Traits> inline basic_fstream<_CharT, _Traits>& basic_fstream<_CharT, _Traits>::operator=(basic_fstream&& __rhs) { basic_iostream<char_type, traits_type>::operator=(std::__1::move(__rhs)); __sb_ = std::__1::move(__rhs.__sb_); return *this; } template <class _CharT, class _Traits> inline void basic_fstream<_CharT, _Traits>::swap(basic_fstream& __rhs) { basic_iostream<char_type, traits_type>::swap(__rhs); __sb_.swap(__rhs.__sb_); } template <class _CharT, class _Traits> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(basic_fstream<_CharT, _Traits>& __x, basic_fstream<_CharT, _Traits>& __y) { __x.swap(__y); } template <class _CharT, class _Traits> inline basic_filebuf<_CharT, _Traits>* basic_fstream<_CharT, _Traits>::rdbuf() const { return const_cast<basic_filebuf<char_type, traits_type>*>(&__sb_); } template <class _CharT, class _Traits> inline bool basic_fstream<_CharT, _Traits>::is_open() const { return __sb_.is_open(); } template <class _CharT, class _Traits> void basic_fstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode) { if (__sb_.open(__s, __mode)) this->clear(); else this->setstate(ios_base::failbit); } template <class _CharT, class _Traits> void basic_fstream<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode) { if (__sb_.open(__s, __mode)) this->clear(); else this->setstate(ios_base::failbit); } template <class _CharT, class _Traits> void basic_fstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode) { if (__sb_.open(__s, __mode)) this->clear(); else this->setstate(ios_base::failbit); } template <class _CharT, class _Traits> inline void basic_fstream<_CharT, _Traits>::close() { if (__sb_.close() == 0) this->setstate(ios_base::failbit); } } } namespace std { inline namespace __1 { template <class _Tp, class _VoidPtr> struct __list_node; template <class _Tp, class _VoidPtr> struct __list_node_base; template <class _Tp, class _VoidPtr> struct __list_node_pointer_traits { typedef typename __rebind_pointer<_VoidPtr, __list_node<_Tp, _VoidPtr> >::type __node_pointer; typedef typename __rebind_pointer<_VoidPtr, __list_node_base<_Tp, _VoidPtr> >::type __base_pointer; typedef __base_pointer __link_pointer; typedef typename conditional< is_same<__link_pointer, __node_pointer>::value, __base_pointer, __node_pointer >::type __non_link_pointer; static __attribute__ ((__exclude_from_explicit_instantiation__)) __link_pointer __unsafe_link_pointer_cast(__link_pointer __p) { return __p; } static __attribute__ ((__exclude_from_explicit_instantiation__)) __link_pointer __unsafe_link_pointer_cast(__non_link_pointer __p) { return static_cast<__link_pointer>(static_cast<_VoidPtr>(__p)); } }; template <class _Tp, class _VoidPtr> struct __list_node_base { typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits; typedef typename _NodeTraits::__node_pointer __node_pointer; typedef typename _NodeTraits::__base_pointer __base_pointer; typedef typename _NodeTraits::__link_pointer __link_pointer; __link_pointer __prev_; __link_pointer __next_; __attribute__ ((__exclude_from_explicit_instantiation__)) __list_node_base() : __prev_(_NodeTraits::__unsafe_link_pointer_cast(__self())), __next_(_NodeTraits::__unsafe_link_pointer_cast(__self())) {} __attribute__ ((__exclude_from_explicit_instantiation__)) __base_pointer __self() { return pointer_traits<__base_pointer>::pointer_to(*this); } __attribute__ ((__exclude_from_explicit_instantiation__)) __node_pointer __as_node() { return static_cast<__node_pointer>(__self()); } }; template <class _Tp, class _VoidPtr> struct __list_node : public __list_node_base<_Tp, _VoidPtr> { _Tp __value_; typedef __list_node_base<_Tp, _VoidPtr> __base; typedef typename __base::__link_pointer __link_pointer; __attribute__ ((__exclude_from_explicit_instantiation__)) __link_pointer __as_link() { return static_cast<__link_pointer>(__base::__self()); } }; template <class _Tp, class _Alloc = allocator<_Tp> > class list; template <class _Tp, class _Alloc> class __list_imp; template <class _Tp, class _VoidPtr> class __list_const_iterator; template <class _Tp, class _VoidPtr> class __list_iterator { typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits; typedef typename _NodeTraits::__link_pointer __link_pointer; __link_pointer __ptr_; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __list_iterator(__link_pointer __p) noexcept : __ptr_(__p) {} template<class, class> friend class list; template<class, class> friend class __list_imp; template<class, class> friend class __list_const_iterator; public: typedef bidirectional_iterator_tag iterator_category; typedef _Tp value_type; typedef value_type& reference; typedef typename __rebind_pointer<_VoidPtr, value_type>::type pointer; typedef typename pointer_traits<pointer>::difference_type difference_type; __attribute__ ((__exclude_from_explicit_instantiation__)) __list_iterator() noexcept : __ptr_(nullptr) { } __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator*() const { return __ptr_->__as_node()->__value_; } __attribute__ ((__exclude_from_explicit_instantiation__)) pointer operator->() const { return pointer_traits<pointer>::pointer_to(__ptr_->__as_node()->__value_); } __attribute__ ((__exclude_from_explicit_instantiation__)) __list_iterator& operator++() { __ptr_ = __ptr_->__next_; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __list_iterator operator++(int) {__list_iterator __t(*this); ++(*this); return __t;} __attribute__ ((__exclude_from_explicit_instantiation__)) __list_iterator& operator--() { __ptr_ = __ptr_->__prev_; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __list_iterator operator--(int) {__list_iterator __t(*this); --(*this); return __t;} friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const __list_iterator& __x, const __list_iterator& __y) { return __x.__ptr_ == __y.__ptr_; } friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const __list_iterator& __x, const __list_iterator& __y) {return !(__x == __y);} }; template <class _Tp, class _VoidPtr> class __list_const_iterator { typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits; typedef typename _NodeTraits::__link_pointer __link_pointer; __link_pointer __ptr_; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __list_const_iterator(__link_pointer __p) noexcept : __ptr_(__p) {} template<class, class> friend class list; template<class, class> friend class __list_imp; public: typedef bidirectional_iterator_tag iterator_category; typedef _Tp value_type; typedef const value_type& reference; typedef typename __rebind_pointer<_VoidPtr, const value_type>::type pointer; typedef typename pointer_traits<pointer>::difference_type difference_type; __attribute__ ((__exclude_from_explicit_instantiation__)) __list_const_iterator() noexcept : __ptr_(nullptr) { } __attribute__ ((__exclude_from_explicit_instantiation__)) __list_const_iterator(const __list_iterator<_Tp, _VoidPtr>& __p) noexcept : __ptr_(__p.__ptr_) { } __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator*() const { return __ptr_->__as_node()->__value_; } __attribute__ ((__exclude_from_explicit_instantiation__)) pointer operator->() const { return pointer_traits<pointer>::pointer_to(__ptr_->__as_node()->__value_); } __attribute__ ((__exclude_from_explicit_instantiation__)) __list_const_iterator& operator++() { __ptr_ = __ptr_->__next_; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __list_const_iterator operator++(int) {__list_const_iterator __t(*this); ++(*this); return __t;} __attribute__ ((__exclude_from_explicit_instantiation__)) __list_const_iterator& operator--() { __ptr_ = __ptr_->__prev_; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __list_const_iterator operator--(int) {__list_const_iterator __t(*this); --(*this); return __t;} friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const __list_const_iterator& __x, const __list_const_iterator& __y) { return __x.__ptr_ == __y.__ptr_; } friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const __list_const_iterator& __x, const __list_const_iterator& __y) {return !(__x == __y);} }; template <class _Tp, class _Alloc> class __list_imp { __list_imp(const __list_imp&); __list_imp& operator=(const __list_imp&); public: typedef _Alloc allocator_type; typedef allocator_traits<allocator_type> __alloc_traits; typedef typename __alloc_traits::size_type size_type; protected: typedef _Tp value_type; typedef typename __alloc_traits::void_pointer __void_pointer; typedef __list_iterator<value_type, __void_pointer> iterator; typedef __list_const_iterator<value_type, __void_pointer> const_iterator; typedef __list_node_base<value_type, __void_pointer> __node_base; typedef __list_node<value_type, __void_pointer> __node; typedef typename __rebind_alloc_helper<__alloc_traits, __node>::type __node_allocator; typedef allocator_traits<__node_allocator> __node_alloc_traits; typedef typename __node_alloc_traits::pointer __node_pointer; typedef typename __node_alloc_traits::pointer __node_const_pointer; typedef __list_node_pointer_traits<value_type, __void_pointer> __node_pointer_traits; typedef typename __node_pointer_traits::__link_pointer __link_pointer; typedef __link_pointer __link_const_pointer; typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::const_pointer const_pointer; typedef typename __alloc_traits::difference_type difference_type; typedef typename __rebind_alloc_helper<__alloc_traits, __node_base>::type __node_base_allocator; typedef typename allocator_traits<__node_base_allocator>::pointer __node_base_pointer; static_assert((!is_same<allocator_type, __node_allocator>::value), "internal allocator type must differ from user-specified " "type; otherwise overload resolution breaks"); __node_base __end_; __compressed_pair<size_type, __node_allocator> __size_alloc_; __attribute__ ((__exclude_from_explicit_instantiation__)) __link_pointer __end_as_link() const noexcept { return __node_pointer_traits::__unsafe_link_pointer_cast( const_cast<__node_base&>(__end_).__self()); } __attribute__ ((__exclude_from_explicit_instantiation__)) size_type& __sz() noexcept {return __size_alloc_.first();} __attribute__ ((__exclude_from_explicit_instantiation__)) const size_type& __sz() const noexcept {return __size_alloc_.first();} __attribute__ ((__exclude_from_explicit_instantiation__)) __node_allocator& __node_alloc() noexcept {return __size_alloc_.second();} __attribute__ ((__exclude_from_explicit_instantiation__)) const __node_allocator& __node_alloc() const noexcept {return __size_alloc_.second();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type __node_alloc_max_size() const noexcept { return __node_alloc_traits::max_size(__node_alloc()); } __attribute__ ((__exclude_from_explicit_instantiation__)) static void __unlink_nodes(__link_pointer __f, __link_pointer __l) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) __list_imp() noexcept(is_nothrow_default_constructible<__node_allocator>::value); __attribute__ ((__exclude_from_explicit_instantiation__)) __list_imp(const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) __list_imp(const __node_allocator& __a); __list_imp(__node_allocator&& __a) noexcept; ~__list_imp(); void clear() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) bool empty() const noexcept {return __sz() == 0;} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator begin() noexcept { return iterator(__end_.__next_); } __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator begin() const noexcept { return const_iterator(__end_.__next_); } __attribute__ ((__exclude_from_explicit_instantiation__)) iterator end() noexcept { return iterator(__end_as_link()); } __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator end() const noexcept { return const_iterator(__end_as_link()); } void swap(__list_imp& __c) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) void __copy_assign_alloc(const __list_imp& __c) {__copy_assign_alloc(__c, integral_constant<bool, __node_alloc_traits::propagate_on_container_copy_assignment::value>());} __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(__list_imp& __c) noexcept(!__node_alloc_traits::propagate_on_container_move_assignment::value || is_nothrow_move_assignable<__node_allocator>::value) {__move_assign_alloc(__c, integral_constant<bool, __node_alloc_traits::propagate_on_container_move_assignment::value>());} private: __attribute__ ((__exclude_from_explicit_instantiation__)) void __copy_assign_alloc(const __list_imp& __c, true_type) { if (__node_alloc() != __c.__node_alloc()) clear(); __node_alloc() = __c.__node_alloc(); } __attribute__ ((__exclude_from_explicit_instantiation__)) void __copy_assign_alloc(const __list_imp&, false_type) {} __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(__list_imp& __c, true_type) noexcept(is_nothrow_move_assignable<__node_allocator>::value) { __node_alloc() = std::__1::move(__c.__node_alloc()); } __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(__list_imp&, false_type) noexcept {} __attribute__ ((__exclude_from_explicit_instantiation__)) void __invalidate_all_iterators() { } }; template <class _Tp, class _Alloc> inline void __list_imp<_Tp, _Alloc>::__unlink_nodes(__link_pointer __f, __link_pointer __l) noexcept { __f->__prev_->__next_ = __l->__next_; __l->__next_->__prev_ = __f->__prev_; } template <class _Tp, class _Alloc> inline __list_imp<_Tp, _Alloc>::__list_imp() noexcept(is_nothrow_default_constructible<__node_allocator>::value) : __size_alloc_(0) { } template <class _Tp, class _Alloc> inline __list_imp<_Tp, _Alloc>::__list_imp(const allocator_type& __a) : __size_alloc_(0, __node_allocator(__a)) { } template <class _Tp, class _Alloc> inline __list_imp<_Tp, _Alloc>::__list_imp(const __node_allocator& __a) : __size_alloc_(0, __a) {} template <class _Tp, class _Alloc> inline __list_imp<_Tp, _Alloc>::__list_imp(__node_allocator&& __a) noexcept : __size_alloc_(0, std::move(__a)) {} template <class _Tp, class _Alloc> __list_imp<_Tp, _Alloc>::~__list_imp() { clear(); } template <class _Tp, class _Alloc> void __list_imp<_Tp, _Alloc>::clear() noexcept { if (!empty()) { __node_allocator& __na = __node_alloc(); __link_pointer __f = __end_.__next_; __link_pointer __l = __end_as_link(); __unlink_nodes(__f, __l->__prev_); __sz() = 0; while (__f != __l) { __node_pointer __np = __f->__as_node(); __f = __f->__next_; __node_alloc_traits::destroy(__na, std::__1::addressof(__np->__value_)); __node_alloc_traits::deallocate(__na, __np, 1); } __invalidate_all_iterators(); } } template <class _Tp, class _Alloc> void __list_imp<_Tp, _Alloc>::swap(__list_imp& __c) noexcept { ((void)0); using std::__1::swap; __swap_allocator(__node_alloc(), __c.__node_alloc()); swap(__sz(), __c.__sz()); swap(__end_, __c.__end_); if (__sz() == 0) __end_.__next_ = __end_.__prev_ = __end_as_link(); else __end_.__prev_->__next_ = __end_.__next_->__prev_ = __end_as_link(); if (__c.__sz() == 0) __c.__end_.__next_ = __c.__end_.__prev_ = __c.__end_as_link(); else __c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_ = __c.__end_as_link(); } template <class _Tp, class _Alloc > class list : private __list_imp<_Tp, _Alloc> { typedef __list_imp<_Tp, _Alloc> base; typedef typename base::__node __node; typedef typename base::__node_allocator __node_allocator; typedef typename base::__node_pointer __node_pointer; typedef typename base::__node_alloc_traits __node_alloc_traits; typedef typename base::__node_base __node_base; typedef typename base::__node_base_pointer __node_base_pointer; typedef typename base::__link_pointer __link_pointer; public: typedef _Tp value_type; typedef _Alloc allocator_type; static_assert((is_same<value_type, typename allocator_type::value_type>::value), "Invalid allocator::value_type"); typedef value_type& reference; typedef const value_type& const_reference; typedef typename base::pointer pointer; typedef typename base::const_pointer const_pointer; typedef typename base::size_type size_type; typedef typename base::difference_type difference_type; typedef typename base::iterator iterator; typedef typename base::const_iterator const_iterator; typedef std::__1::reverse_iterator<iterator> reverse_iterator; typedef std::__1::reverse_iterator<const_iterator> const_reverse_iterator; typedef void __remove_return_type; __attribute__ ((__exclude_from_explicit_instantiation__)) list() noexcept(is_nothrow_default_constructible<__node_allocator>::value) { } __attribute__ ((__exclude_from_explicit_instantiation__)) explicit list(const allocator_type& __a) : base(__a) { } explicit list(size_type __n); explicit list(size_type __n, const allocator_type& __a); list(size_type __n, const value_type& __x); list(size_type __n, const value_type& __x, const allocator_type& __a); template <class _InpIter> list(_InpIter __f, _InpIter __l, typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0); template <class _InpIter> list(_InpIter __f, _InpIter __l, const allocator_type& __a, typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0); list(const list& __c); list(const list& __c, const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) list& operator=(const list& __c); list(initializer_list<value_type> __il); list(initializer_list<value_type> __il, const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) list(list&& __c) noexcept(is_nothrow_move_constructible<__node_allocator>::value); __attribute__ ((__exclude_from_explicit_instantiation__)) list(list&& __c, const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) list& operator=(list&& __c) noexcept(__node_alloc_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable<__node_allocator>::value); __attribute__ ((__exclude_from_explicit_instantiation__)) list& operator=(initializer_list<value_type> __il) {assign(__il.begin(), __il.end()); return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());} template <class _InpIter> void assign(_InpIter __f, _InpIter __l, typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0); void assign(size_type __n, const value_type& __x); __attribute__ ((__exclude_from_explicit_instantiation__)) allocator_type get_allocator() const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) size_type size() const noexcept {return base::__sz();} [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) bool empty() const noexcept {return base::empty();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type max_size() const noexcept { return std::min<size_type>( base::__node_alloc_max_size(), numeric_limits<difference_type >::max()); } __attribute__ ((__exclude_from_explicit_instantiation__)) iterator begin() noexcept {return base::begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator begin() const noexcept {return base::begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator end() noexcept {return base::end();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator end() const noexcept {return base::end();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cbegin() const noexcept {return base::begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cend() const noexcept {return base::end();} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator rbegin() noexcept {return reverse_iterator(end());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator rbegin() const noexcept {return const_reverse_iterator(end());} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator rend() noexcept {return reverse_iterator(begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator rend() const noexcept {return const_reverse_iterator(begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator crbegin() const noexcept {return const_reverse_iterator(end());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator crend() const noexcept {return const_reverse_iterator(begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) reference front() { ((void)0); return base::__end_.__next_->__as_node()->__value_; } __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference front() const { ((void)0); return base::__end_.__next_->__as_node()->__value_; } __attribute__ ((__exclude_from_explicit_instantiation__)) reference back() { ((void)0); return base::__end_.__prev_->__as_node()->__value_; } __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference back() const { ((void)0); return base::__end_.__prev_->__as_node()->__value_; } void push_front(value_type&& __x); void push_back(value_type&& __x); template <class... _Args> void emplace_front(_Args&&... __args); template <class... _Args> void emplace_back(_Args&&... __args); template <class... _Args> iterator emplace(const_iterator __p, _Args&&... __args); iterator insert(const_iterator __p, value_type&& __x); __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const_iterator __p, initializer_list<value_type> __il) {return insert(__p, __il.begin(), __il.end());} void push_front(const value_type& __x); void push_back(const value_type& __x); template <class _Arg> __attribute__ ((__exclude_from_explicit_instantiation__)) void __emplace_back(_Arg&& __arg) { emplace_back(std::__1::forward<_Arg>(__arg)); } iterator insert(const_iterator __p, const value_type& __x); iterator insert(const_iterator __p, size_type __n, const value_type& __x); template <class _InpIter> iterator insert(const_iterator __p, _InpIter __f, _InpIter __l, typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0); __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(list& __c) noexcept {base::swap(__c);} __attribute__ ((__exclude_from_explicit_instantiation__)) void clear() noexcept {base::clear();} void pop_front(); void pop_back(); iterator erase(const_iterator __p); iterator erase(const_iterator __f, const_iterator __l); void resize(size_type __n); void resize(size_type __n, const value_type& __x); void splice(const_iterator __p, list& __c); __attribute__ ((__exclude_from_explicit_instantiation__)) void splice(const_iterator __p, list&& __c) {splice(__p, __c);} __attribute__ ((__exclude_from_explicit_instantiation__)) void splice(const_iterator __p, list&& __c, const_iterator __i) {splice(__p, __c, __i);} __attribute__ ((__exclude_from_explicit_instantiation__)) void splice(const_iterator __p, list&& __c, const_iterator __f, const_iterator __l) {splice(__p, __c, __f, __l);} void splice(const_iterator __p, list& __c, const_iterator __i); void splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l); __remove_return_type remove(const value_type& __x); template <class _Pred> __remove_return_type remove_if(_Pred __pred); __attribute__ ((__exclude_from_explicit_instantiation__)) __remove_return_type unique() { return unique(__equal_to<value_type>()); } template <class _BinaryPred> __remove_return_type unique(_BinaryPred __binary_pred); __attribute__ ((__exclude_from_explicit_instantiation__)) void merge(list& __c); __attribute__ ((__exclude_from_explicit_instantiation__)) void merge(list&& __c) {merge(__c);} template <class _Comp> __attribute__ ((__exclude_from_explicit_instantiation__)) void merge(list&& __c, _Comp __comp) {merge(__c, __comp);} template <class _Comp> void merge(list& __c, _Comp __comp); __attribute__ ((__exclude_from_explicit_instantiation__)) void sort(); template <class _Comp> __attribute__ ((__exclude_from_explicit_instantiation__)) void sort(_Comp __comp); void reverse() noexcept; bool __invariants() const; typedef __allocator_destructor<__node_allocator> __node_destructor; typedef unique_ptr<__node, __node_destructor> __hold_pointer; __attribute__ ((__exclude_from_explicit_instantiation__)) __hold_pointer __allocate_node(__node_allocator& __na) { __node_pointer __p = __node_alloc_traits::allocate(__na, 1); __p->__prev_ = nullptr; return __hold_pointer(__p, __node_destructor(__na, 1)); } private: __attribute__ ((__exclude_from_explicit_instantiation__)) static void __link_nodes (__link_pointer __p, __link_pointer __f, __link_pointer __l); __attribute__ ((__exclude_from_explicit_instantiation__)) void __link_nodes_at_front(__link_pointer __f, __link_pointer __l); __attribute__ ((__exclude_from_explicit_instantiation__)) void __link_nodes_at_back (__link_pointer __f, __link_pointer __l); iterator __iterator(size_type __n); template <class _Comp> static iterator __sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp); void __move_assign(list& __c, true_type) noexcept(is_nothrow_move_assignable<__node_allocator>::value); void __move_assign(list& __c, false_type); }; template <class _Tp, class _Alloc> inline void list<_Tp, _Alloc>::__link_nodes(__link_pointer __p, __link_pointer __f, __link_pointer __l) { __p->__prev_->__next_ = __f; __f->__prev_ = __p->__prev_; __p->__prev_ = __l; __l->__next_ = __p; } template <class _Tp, class _Alloc> inline void list<_Tp, _Alloc>::__link_nodes_at_front(__link_pointer __f, __link_pointer __l) { __f->__prev_ = base::__end_as_link(); __l->__next_ = base::__end_.__next_; __l->__next_->__prev_ = __l; base::__end_.__next_ = __f; } template <class _Tp, class _Alloc> inline void list<_Tp, _Alloc>::__link_nodes_at_back(__link_pointer __f, __link_pointer __l) { __l->__next_ = base::__end_as_link(); __f->__prev_ = base::__end_.__prev_; __f->__prev_->__next_ = __f; base::__end_.__prev_ = __l; } template <class _Tp, class _Alloc> inline typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::__iterator(size_type __n) { return __n <= base::__sz() / 2 ? std::__1::next(begin(), __n) : std::__1::prev(end(), base::__sz() - __n); } template <class _Tp, class _Alloc> list<_Tp, _Alloc>::list(size_type __n) { for (; __n > 0; --__n) emplace_back(); } template <class _Tp, class _Alloc> list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a) { for (; __n > 0; --__n) emplace_back(); } template <class _Tp, class _Alloc> list<_Tp, _Alloc>::list(size_type __n, const value_type& __x) { for (; __n > 0; --__n) push_back(__x); } template <class _Tp, class _Alloc> list<_Tp, _Alloc>::list(size_type __n, const value_type& __x, const allocator_type& __a) : base(__a) { for (; __n > 0; --__n) push_back(__x); } template <class _Tp, class _Alloc> template <class _InpIter> list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, typename enable_if<__is_input_iterator<_InpIter>::value>::type*) { for (; __f != __l; ++__f) __emplace_back(*__f); } template <class _Tp, class _Alloc> template <class _InpIter> list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, const allocator_type& __a, typename enable_if<__is_input_iterator<_InpIter>::value>::type*) : base(__a) { for (; __f != __l; ++__f) __emplace_back(*__f); } template <class _Tp, class _Alloc> list<_Tp, _Alloc>::list(const list& __c) : base(__node_alloc_traits::select_on_container_copy_construction( __c.__node_alloc())) { for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i) push_back(*__i); } template <class _Tp, class _Alloc> list<_Tp, _Alloc>::list(const list& __c, const allocator_type& __a) : base(__a) { for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i) push_back(*__i); } template <class _Tp, class _Alloc> list<_Tp, _Alloc>::list(initializer_list<value_type> __il, const allocator_type& __a) : base(__a) { for (typename initializer_list<value_type>::const_iterator __i = __il.begin(), __e = __il.end(); __i != __e; ++__i) push_back(*__i); } template <class _Tp, class _Alloc> list<_Tp, _Alloc>::list(initializer_list<value_type> __il) { for (typename initializer_list<value_type>::const_iterator __i = __il.begin(), __e = __il.end(); __i != __e; ++__i) push_back(*__i); } template <class _Tp, class _Alloc> inline list<_Tp, _Alloc>::list(list&& __c) noexcept(is_nothrow_move_constructible<__node_allocator>::value) : base(std::__1::move(__c.__node_alloc())) { splice(end(), __c); } template <class _Tp, class _Alloc> inline list<_Tp, _Alloc>::list(list&& __c, const allocator_type& __a) : base(__a) { if (__a == __c.get_allocator()) splice(end(), __c); else { typedef move_iterator<iterator> _Ip; assign(_Ip(__c.begin()), _Ip(__c.end())); } } template <class _Tp, class _Alloc> inline list<_Tp, _Alloc>& list<_Tp, _Alloc>::operator=(list&& __c) noexcept(__node_alloc_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable<__node_allocator>::value) { __move_assign(__c, integral_constant<bool, __node_alloc_traits::propagate_on_container_move_assignment::value>()); return *this; } template <class _Tp, class _Alloc> void list<_Tp, _Alloc>::__move_assign(list& __c, false_type) { if (base::__node_alloc() != __c.__node_alloc()) { typedef move_iterator<iterator> _Ip; assign(_Ip(__c.begin()), _Ip(__c.end())); } else __move_assign(__c, true_type()); } template <class _Tp, class _Alloc> void list<_Tp, _Alloc>::__move_assign(list& __c, true_type) noexcept(is_nothrow_move_assignable<__node_allocator>::value) { clear(); base::__move_assign_alloc(__c); splice(end(), __c); } template <class _Tp, class _Alloc> inline list<_Tp, _Alloc>& list<_Tp, _Alloc>::operator=(const list& __c) { if (this != &__c) { base::__copy_assign_alloc(__c); assign(__c.begin(), __c.end()); } return *this; } template <class _Tp, class _Alloc> template <class _InpIter> void list<_Tp, _Alloc>::assign(_InpIter __f, _InpIter __l, typename enable_if<__is_input_iterator<_InpIter>::value>::type*) { iterator __i = begin(); iterator __e = end(); for (; __f != __l && __i != __e; ++__f, ++__i) *__i = *__f; if (__i == __e) insert(__e, __f, __l); else erase(__i, __e); } template <class _Tp, class _Alloc> void list<_Tp, _Alloc>::assign(size_type __n, const value_type& __x) { iterator __i = begin(); iterator __e = end(); for (; __n > 0 && __i != __e; --__n, ++__i) *__i = __x; if (__i == __e) insert(__e, __n, __x); else erase(__i, __e); } template <class _Tp, class _Alloc> inline _Alloc list<_Tp, _Alloc>::get_allocator() const noexcept { return allocator_type(base::__node_alloc()); } template <class _Tp, class _Alloc> typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x) { __node_allocator& __na = base::__node_alloc(); __hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, std::__1::addressof(__hold->__value_), __x); __link_nodes(__p.__ptr_, __hold->__as_link(), __hold->__as_link()); ++base::__sz(); return iterator(__hold.release()->__as_link()); } template <class _Tp, class _Alloc> typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& __x) { iterator __r(__p.__ptr_); if (__n > 0) { size_type __ds = 0; __node_allocator& __na = base::__node_alloc(); __hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, std::__1::addressof(__hold->__value_), __x); ++__ds; __r = iterator(__hold->__as_link()); __hold.release(); iterator __e = __r; for (--__n; __n != 0; --__n, ++__e, ++__ds) { __hold.reset(__node_alloc_traits::allocate(__na, 1)); __node_alloc_traits::construct(__na, std::__1::addressof(__hold->__value_), __x); __e.__ptr_->__next_ = __hold->__as_link(); __hold->__prev_ = __e.__ptr_; __hold.release(); } __link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_); base::__sz() += __ds; } return __r; } template <class _Tp, class _Alloc> template <class _InpIter> typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l, typename enable_if<__is_input_iterator<_InpIter>::value>::type*) { iterator __r(__p.__ptr_); if (__f != __l) { size_type __ds = 0; __node_allocator& __na = base::__node_alloc(); __hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, std::__1::addressof(__hold->__value_), *__f); ++__ds; __r = iterator(__hold.get()->__as_link()); __hold.release(); iterator __e = __r; for (++__f; __f != __l; ++__f, (void) ++__e, (void) ++__ds) { __hold.reset(__node_alloc_traits::allocate(__na, 1)); __node_alloc_traits::construct(__na, std::__1::addressof(__hold->__value_), *__f); __e.__ptr_->__next_ = __hold.get()->__as_link(); __hold->__prev_ = __e.__ptr_; __hold.release(); } __link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_); base::__sz() += __ds; } return __r; } template <class _Tp, class _Alloc> void list<_Tp, _Alloc>::push_front(const value_type& __x) { __node_allocator& __na = base::__node_alloc(); __hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, std::__1::addressof(__hold->__value_), __x); __link_pointer __nl = __hold->__as_link(); __link_nodes_at_front(__nl, __nl); ++base::__sz(); __hold.release(); } template <class _Tp, class _Alloc> void list<_Tp, _Alloc>::push_back(const value_type& __x) { __node_allocator& __na = base::__node_alloc(); __hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, std::__1::addressof(__hold->__value_), __x); __link_nodes_at_back(__hold.get()->__as_link(), __hold.get()->__as_link()); ++base::__sz(); __hold.release(); } template <class _Tp, class _Alloc> void list<_Tp, _Alloc>::push_front(value_type&& __x) { __node_allocator& __na = base::__node_alloc(); __hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, std::__1::addressof(__hold->__value_), std::__1::move(__x)); __link_nodes_at_front(__hold.get()->__as_link(), __hold.get()->__as_link()); ++base::__sz(); __hold.release(); } template <class _Tp, class _Alloc> void list<_Tp, _Alloc>::push_back(value_type&& __x) { __node_allocator& __na = base::__node_alloc(); __hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, std::__1::addressof(__hold->__value_), std::__1::move(__x)); __link_nodes_at_back(__hold.get()->__as_link(), __hold.get()->__as_link()); ++base::__sz(); __hold.release(); } template <class _Tp, class _Alloc> template <class... _Args> void list<_Tp, _Alloc>::emplace_front(_Args&&... __args) { __node_allocator& __na = base::__node_alloc(); __hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, std::__1::addressof(__hold->__value_), std::__1::forward<_Args>(__args)...); __link_nodes_at_front(__hold.get()->__as_link(), __hold.get()->__as_link()); ++base::__sz(); __hold.release(); } template <class _Tp, class _Alloc> template <class... _Args> void list<_Tp, _Alloc>::emplace_back(_Args&&... __args) { __node_allocator& __na = base::__node_alloc(); __hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, std::__1::addressof(__hold->__value_), std::__1::forward<_Args>(__args)...); __link_pointer __nl = __hold->__as_link(); __link_nodes_at_back(__nl, __nl); ++base::__sz(); __hold.release(); } template <class _Tp, class _Alloc> template <class... _Args> typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args) { __node_allocator& __na = base::__node_alloc(); __hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, std::__1::addressof(__hold->__value_), std::__1::forward<_Args>(__args)...); __link_pointer __nl = __hold.get()->__as_link(); __link_nodes(__p.__ptr_, __nl, __nl); ++base::__sz(); __hold.release(); return iterator(__nl); } template <class _Tp, class _Alloc> typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x) { __node_allocator& __na = base::__node_alloc(); __hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, std::__1::addressof(__hold->__value_), std::__1::move(__x)); __link_pointer __nl = __hold->__as_link(); __link_nodes(__p.__ptr_, __nl, __nl); ++base::__sz(); __hold.release(); return iterator(__nl); } template <class _Tp, class _Alloc> void list<_Tp, _Alloc>::pop_front() { ((void)0); __node_allocator& __na = base::__node_alloc(); __link_pointer __n = base::__end_.__next_; base::__unlink_nodes(__n, __n); --base::__sz(); __node_pointer __np = __n->__as_node(); __node_alloc_traits::destroy(__na, std::__1::addressof(__np->__value_)); __node_alloc_traits::deallocate(__na, __np, 1); } template <class _Tp, class _Alloc> void list<_Tp, _Alloc>::pop_back() { ((void)0); __node_allocator& __na = base::__node_alloc(); __link_pointer __n = base::__end_.__prev_; base::__unlink_nodes(__n, __n); --base::__sz(); __node_pointer __np = __n->__as_node(); __node_alloc_traits::destroy(__na, std::__1::addressof(__np->__value_)); __node_alloc_traits::deallocate(__na, __np, 1); } template <class _Tp, class _Alloc> typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::erase(const_iterator __p) { ((void)0); __node_allocator& __na = base::__node_alloc(); __link_pointer __n = __p.__ptr_; __link_pointer __r = __n->__next_; base::__unlink_nodes(__n, __n); --base::__sz(); __node_pointer __np = __n->__as_node(); __node_alloc_traits::destroy(__na, std::__1::addressof(__np->__value_)); __node_alloc_traits::deallocate(__na, __np, 1); return iterator(__r); } template <class _Tp, class _Alloc> typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l) { if (__f != __l) { __node_allocator& __na = base::__node_alloc(); base::__unlink_nodes(__f.__ptr_, __l.__ptr_->__prev_); while (__f != __l) { __link_pointer __n = __f.__ptr_; ++__f; --base::__sz(); __node_pointer __np = __n->__as_node(); __node_alloc_traits::destroy(__na, std::__1::addressof(__np->__value_)); __node_alloc_traits::deallocate(__na, __np, 1); } } return iterator(__l.__ptr_); } template <class _Tp, class _Alloc> void list<_Tp, _Alloc>::resize(size_type __n) { if (__n < base::__sz()) erase(__iterator(__n), end()); else if (__n > base::__sz()) { __n -= base::__sz(); size_type __ds = 0; __node_allocator& __na = base::__node_alloc(); __hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, std::__1::addressof(__hold->__value_)); ++__ds; iterator __r = iterator(__hold.release()->__as_link()); iterator __e = __r; for (--__n; __n != 0; --__n, ++__e, ++__ds) { __hold.reset(__node_alloc_traits::allocate(__na, 1)); __node_alloc_traits::construct(__na, std::__1::addressof(__hold->__value_)); __e.__ptr_->__next_ = __hold.get()->__as_link(); __hold->__prev_ = __e.__ptr_; __hold.release(); } __link_nodes_at_back(__r.__ptr_, __e.__ptr_); base::__sz() += __ds; } } template <class _Tp, class _Alloc> void list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x) { if (__n < base::__sz()) erase(__iterator(__n), end()); else if (__n > base::__sz()) { __n -= base::__sz(); size_type __ds = 0; __node_allocator& __na = base::__node_alloc(); __hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, std::__1::addressof(__hold->__value_), __x); ++__ds; __link_pointer __nl = __hold.release()->__as_link(); iterator __r = iterator(__nl); iterator __e = __r; for (--__n; __n != 0; --__n, ++__e, ++__ds) { __hold.reset(__node_alloc_traits::allocate(__na, 1)); __node_alloc_traits::construct(__na, std::__1::addressof(__hold->__value_), __x); __e.__ptr_->__next_ = __hold.get()->__as_link(); __hold->__prev_ = __e.__ptr_; __hold.release(); } __link_nodes(base::__end_as_link(), __r.__ptr_, __e.__ptr_); base::__sz() += __ds; } } template <class _Tp, class _Alloc> void list<_Tp, _Alloc>::splice(const_iterator __p, list& __c) { ((void)0); if (!__c.empty()) { __link_pointer __f = __c.__end_.__next_; __link_pointer __l = __c.__end_.__prev_; base::__unlink_nodes(__f, __l); __link_nodes(__p.__ptr_, __f, __l); base::__sz() += __c.__sz(); __c.__sz() = 0; } } template <class _Tp, class _Alloc> void list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i) { if (__p.__ptr_ != __i.__ptr_ && __p.__ptr_ != __i.__ptr_->__next_) { __link_pointer __f = __i.__ptr_; base::__unlink_nodes(__f, __f); __link_nodes(__p.__ptr_, __f, __f); --__c.__sz(); ++base::__sz(); } } template <class _Tp, class _Alloc> void list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l) { if (__f != __l) { __link_pointer __first = __f.__ptr_; --__l; __link_pointer __last = __l.__ptr_; if (this != &__c) { size_type __s = std::__1::distance(__f, __l) + 1; __c.__sz() -= __s; base::__sz() += __s; } base::__unlink_nodes(__first, __last); __link_nodes(__p.__ptr_, __first, __last); } } template <class _Tp, class _Alloc> typename list<_Tp, _Alloc>::__remove_return_type list<_Tp, _Alloc>::remove(const value_type& __x) { list<_Tp, _Alloc> __deleted_nodes(get_allocator()); for (const_iterator __i = begin(), __e = end(); __i != __e;) { if (*__i == __x) { const_iterator __j = std::__1::next(__i); for (; __j != __e && *__j == __x; ++__j) ; __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j); __i = __j; if (__i != __e) ++__i; } else ++__i; } return (__remove_return_type) __deleted_nodes.size(); } template <class _Tp, class _Alloc> template <class _Pred> typename list<_Tp, _Alloc>::__remove_return_type list<_Tp, _Alloc>::remove_if(_Pred __pred) { list<_Tp, _Alloc> __deleted_nodes(get_allocator()); for (iterator __i = begin(), __e = end(); __i != __e;) { if (__pred(*__i)) { iterator __j = std::__1::next(__i); for (; __j != __e && __pred(*__j); ++__j) ; __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j); __i = __j; if (__i != __e) ++__i; } else ++__i; } return (__remove_return_type) __deleted_nodes.size(); } template <class _Tp, class _Alloc> template <class _BinaryPred> typename list<_Tp, _Alloc>::__remove_return_type list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred) { list<_Tp, _Alloc> __deleted_nodes(get_allocator()); for (iterator __i = begin(), __e = end(); __i != __e;) { iterator __j = std::__1::next(__i); for (; __j != __e && __binary_pred(*__i, *__j); ++__j) ; if (++__i != __j) { __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j); __i = __j; } } return (__remove_return_type) __deleted_nodes.size(); } template <class _Tp, class _Alloc> inline void list<_Tp, _Alloc>::merge(list& __c) { merge(__c, __less<value_type>()); } template <class _Tp, class _Alloc> template <class _Comp> void list<_Tp, _Alloc>::merge(list& __c, _Comp __comp) { if (this != std::__1::addressof(__c)) { iterator __f1 = begin(); iterator __e1 = end(); iterator __f2 = __c.begin(); iterator __e2 = __c.end(); while (__f1 != __e1 && __f2 != __e2) { if (__comp(*__f2, *__f1)) { size_type __ds = 1; iterator __m2 = std::__1::next(__f2); for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2, ++__ds) ; base::__sz() += __ds; __c.__sz() -= __ds; __link_pointer __f = __f2.__ptr_; __link_pointer __l = __m2.__ptr_->__prev_; __f2 = __m2; base::__unlink_nodes(__f, __l); __m2 = std::__1::next(__f1); __link_nodes(__f1.__ptr_, __f, __l); __f1 = __m2; } else ++__f1; } splice(__e1, __c); } } template <class _Tp, class _Alloc> inline void list<_Tp, _Alloc>::sort() { sort(__less<value_type>()); } template <class _Tp, class _Alloc> template <class _Comp> inline void list<_Tp, _Alloc>::sort(_Comp __comp) { __sort(begin(), end(), base::__sz(), __comp); } template <class _Tp, class _Alloc> template <class _Comp> typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp) { switch (__n) { case 0: case 1: return __f1; case 2: if (__comp(*--__e2, *__f1)) { __link_pointer __f = __e2.__ptr_; base::__unlink_nodes(__f, __f); __link_nodes(__f1.__ptr_, __f, __f); return __e2; } return __f1; } size_type __n2 = __n / 2; iterator __e1 = std::__1::next(__f1, __n2); iterator __r = __f1 = __sort(__f1, __e1, __n2, __comp); iterator __f2 = __e1 = __sort(__e1, __e2, __n - __n2, __comp); if (__comp(*__f2, *__f1)) { iterator __m2 = std::__1::next(__f2); for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2) ; __link_pointer __f = __f2.__ptr_; __link_pointer __l = __m2.__ptr_->__prev_; __r = __f2; __e1 = __f2 = __m2; base::__unlink_nodes(__f, __l); __m2 = std::__1::next(__f1); __link_nodes(__f1.__ptr_, __f, __l); __f1 = __m2; } else ++__f1; while (__f1 != __e1 && __f2 != __e2) { if (__comp(*__f2, *__f1)) { iterator __m2 = std::__1::next(__f2); for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2) ; __link_pointer __f = __f2.__ptr_; __link_pointer __l = __m2.__ptr_->__prev_; if (__e1 == __f2) __e1 = __m2; __f2 = __m2; base::__unlink_nodes(__f, __l); __m2 = std::__1::next(__f1); __link_nodes(__f1.__ptr_, __f, __l); __f1 = __m2; } else ++__f1; } return __r; } template <class _Tp, class _Alloc> void list<_Tp, _Alloc>::reverse() noexcept { if (base::__sz() > 1) { iterator __e = end(); for (iterator __i = begin(); __i.__ptr_ != __e.__ptr_;) { std::__1::swap(__i.__ptr_->__prev_, __i.__ptr_->__next_); __i.__ptr_ = __i.__ptr_->__prev_; } std::__1::swap(__e.__ptr_->__prev_, __e.__ptr_->__next_); } } template <class _Tp, class _Alloc> bool list<_Tp, _Alloc>::__invariants() const { return size() == std::__1::distance(begin(), end()); } template <class _Tp, class _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) { return __x.size() == __y.size() && std::__1::equal(__x.begin(), __x.end(), __y.begin()); } template <class _Tp, class _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator< (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) { return std::__1::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); } template <class _Tp, class _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) { return !(__x == __y); } template <class _Tp, class _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator> (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) { return __y < __x; } template <class _Tp, class _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) { return !(__x < __y); } template <class _Tp, class _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) { return !(__y < __x); } template <class _Tp, class _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } } } namespace std { inline namespace __1 { template <class _Tp, class _Compare, class _Allocator> class __tree; template <class _Tp, class _NodePtr, class _DiffType> class __tree_iterator; template <class _Tp, class _ConstNodePtr, class _DiffType> class __tree_const_iterator; template <class _Pointer> class __tree_end_node; template <class _VoidPtr> class __tree_node_base; template <class _Tp, class _VoidPtr> class __tree_node; template <class _Key, class _Value> struct __value_type; template <class _Allocator> class __map_node_destructor; template <class _TreeIterator> class __map_iterator; template <class _TreeIterator> class __map_const_iterator; template <class _NodePtr> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool __tree_is_left_child(_NodePtr __x) noexcept { return __x == __x->__parent_->__left_; } template <class _NodePtr> unsigned __tree_sub_invariant(_NodePtr __x) { if (__x == nullptr) return 1; if (__x->__left_ != nullptr && __x->__left_->__parent_ != __x) return 0; if (__x->__right_ != nullptr && __x->__right_->__parent_ != __x) return 0; if (__x->__left_ == __x->__right_ && __x->__left_ != nullptr) return 0; if (!__x->__is_black_) { if (__x->__left_ && !__x->__left_->__is_black_) return 0; if (__x->__right_ && !__x->__right_->__is_black_) return 0; } unsigned __h = __tree_sub_invariant(__x->__left_); if (__h == 0) return 0; if (__h != __tree_sub_invariant(__x->__right_)) return 0; return __h + __x->__is_black_; } template <class _NodePtr> bool __tree_invariant(_NodePtr __root) { if (__root == nullptr) return true; if (__root->__parent_ == nullptr) return false; if (!__tree_is_left_child(__root)) return false; if (!__root->__is_black_) return false; return __tree_sub_invariant(__root) != 0; } template <class _NodePtr> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _NodePtr __tree_min(_NodePtr __x) noexcept { while (__x->__left_ != nullptr) __x = __x->__left_; return __x; } template <class _NodePtr> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _NodePtr __tree_max(_NodePtr __x) noexcept { while (__x->__right_ != nullptr) __x = __x->__right_; return __x; } template <class _NodePtr> _NodePtr __tree_next(_NodePtr __x) noexcept { if (__x->__right_ != nullptr) return __tree_min(__x->__right_); while (!__tree_is_left_child(__x)) __x = __x->__parent_unsafe(); return __x->__parent_unsafe(); } template <class _EndNodePtr, class _NodePtr> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _EndNodePtr __tree_next_iter(_NodePtr __x) noexcept { if (__x->__right_ != nullptr) return static_cast<_EndNodePtr>(__tree_min(__x->__right_)); while (!__tree_is_left_child(__x)) __x = __x->__parent_unsafe(); return static_cast<_EndNodePtr>(__x->__parent_); } template <class _NodePtr, class _EndNodePtr> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _NodePtr __tree_prev_iter(_EndNodePtr __x) noexcept { if (__x->__left_ != nullptr) return __tree_max(__x->__left_); _NodePtr __xx = static_cast<_NodePtr>(__x); while (__tree_is_left_child(__xx)) __xx = __xx->__parent_unsafe(); return __xx->__parent_unsafe(); } template <class _NodePtr> _NodePtr __tree_leaf(_NodePtr __x) noexcept { while (true) { if (__x->__left_ != nullptr) { __x = __x->__left_; continue; } if (__x->__right_ != nullptr) { __x = __x->__right_; continue; } break; } return __x; } template <class _NodePtr> void __tree_left_rotate(_NodePtr __x) noexcept { _NodePtr __y = __x->__right_; __x->__right_ = __y->__left_; if (__x->__right_ != nullptr) __x->__right_->__set_parent(__x); __y->__parent_ = __x->__parent_; if (__tree_is_left_child(__x)) __x->__parent_->__left_ = __y; else __x->__parent_unsafe()->__right_ = __y; __y->__left_ = __x; __x->__set_parent(__y); } template <class _NodePtr> void __tree_right_rotate(_NodePtr __x) noexcept { _NodePtr __y = __x->__left_; __x->__left_ = __y->__right_; if (__x->__left_ != nullptr) __x->__left_->__set_parent(__x); __y->__parent_ = __x->__parent_; if (__tree_is_left_child(__x)) __x->__parent_->__left_ = __y; else __x->__parent_unsafe()->__right_ = __y; __y->__right_ = __x; __x->__set_parent(__y); } template <class _NodePtr> void __tree_balance_after_insert(_NodePtr __root, _NodePtr __x) noexcept { __x->__is_black_ = __x == __root; while (__x != __root && !__x->__parent_unsafe()->__is_black_) { if (__tree_is_left_child(__x->__parent_unsafe())) { _NodePtr __y = __x->__parent_unsafe()->__parent_unsafe()->__right_; if (__y != nullptr && !__y->__is_black_) { __x = __x->__parent_unsafe(); __x->__is_black_ = true; __x = __x->__parent_unsafe(); __x->__is_black_ = __x == __root; __y->__is_black_ = true; } else { if (!__tree_is_left_child(__x)) { __x = __x->__parent_unsafe(); __tree_left_rotate(__x); } __x = __x->__parent_unsafe(); __x->__is_black_ = true; __x = __x->__parent_unsafe(); __x->__is_black_ = false; __tree_right_rotate(__x); break; } } else { _NodePtr __y = __x->__parent_unsafe()->__parent_->__left_; if (__y != nullptr && !__y->__is_black_) { __x = __x->__parent_unsafe(); __x->__is_black_ = true; __x = __x->__parent_unsafe(); __x->__is_black_ = __x == __root; __y->__is_black_ = true; } else { if (__tree_is_left_child(__x)) { __x = __x->__parent_unsafe(); __tree_right_rotate(__x); } __x = __x->__parent_unsafe(); __x->__is_black_ = true; __x = __x->__parent_unsafe(); __x->__is_black_ = false; __tree_left_rotate(__x); break; } } } } template <class _NodePtr> void __tree_remove(_NodePtr __root, _NodePtr __z) noexcept { _NodePtr __y = (__z->__left_ == nullptr || __z->__right_ == nullptr) ? __z : __tree_next(__z); _NodePtr __x = __y->__left_ != nullptr ? __y->__left_ : __y->__right_; _NodePtr __w = nullptr; if (__x != nullptr) __x->__parent_ = __y->__parent_; if (__tree_is_left_child(__y)) { __y->__parent_->__left_ = __x; if (__y != __root) __w = __y->__parent_unsafe()->__right_; else __root = __x; } else { __y->__parent_unsafe()->__right_ = __x; __w = __y->__parent_->__left_; } bool __removed_black = __y->__is_black_; if (__y != __z) { __y->__parent_ = __z->__parent_; if (__tree_is_left_child(__z)) __y->__parent_->__left_ = __y; else __y->__parent_unsafe()->__right_ = __y; __y->__left_ = __z->__left_; __y->__left_->__set_parent(__y); __y->__right_ = __z->__right_; if (__y->__right_ != nullptr) __y->__right_->__set_parent(__y); __y->__is_black_ = __z->__is_black_; if (__root == __z) __root = __y; } if (__removed_black && __root != nullptr) { if (__x != nullptr) __x->__is_black_ = true; else { while (true) { if (!__tree_is_left_child(__w)) { if (!__w->__is_black_) { __w->__is_black_ = true; __w->__parent_unsafe()->__is_black_ = false; __tree_left_rotate(__w->__parent_unsafe()); if (__root == __w->__left_) __root = __w; __w = __w->__left_->__right_; } if ((__w->__left_ == nullptr || __w->__left_->__is_black_) && (__w->__right_ == nullptr || __w->__right_->__is_black_)) { __w->__is_black_ = false; __x = __w->__parent_unsafe(); if (__x == __root || !__x->__is_black_) { __x->__is_black_ = true; break; } __w = __tree_is_left_child(__x) ? __x->__parent_unsafe()->__right_ : __x->__parent_->__left_; } else { if (__w->__right_ == nullptr || __w->__right_->__is_black_) { __w->__left_->__is_black_ = true; __w->__is_black_ = false; __tree_right_rotate(__w); __w = __w->__parent_unsafe(); } __w->__is_black_ = __w->__parent_unsafe()->__is_black_; __w->__parent_unsafe()->__is_black_ = true; __w->__right_->__is_black_ = true; __tree_left_rotate(__w->__parent_unsafe()); break; } } else { if (!__w->__is_black_) { __w->__is_black_ = true; __w->__parent_unsafe()->__is_black_ = false; __tree_right_rotate(__w->__parent_unsafe()); if (__root == __w->__right_) __root = __w; __w = __w->__right_->__left_; } if ((__w->__left_ == nullptr || __w->__left_->__is_black_) && (__w->__right_ == nullptr || __w->__right_->__is_black_)) { __w->__is_black_ = false; __x = __w->__parent_unsafe(); if (!__x->__is_black_ || __x == __root) { __x->__is_black_ = true; break; } __w = __tree_is_left_child(__x) ? __x->__parent_unsafe()->__right_ : __x->__parent_->__left_; } else { if (__w->__left_ == nullptr || __w->__left_->__is_black_) { __w->__right_->__is_black_ = true; __w->__is_black_ = false; __tree_left_rotate(__w); __w = __w->__parent_unsafe(); } __w->__is_black_ = __w->__parent_unsafe()->__is_black_; __w->__parent_unsafe()->__is_black_ = true; __w->__left_->__is_black_ = true; __tree_right_rotate(__w->__parent_unsafe()); break; } } } } } } template <class _Tp> struct __is_tree_value_type_imp : false_type {}; template <class _Key, class _Value> struct __is_tree_value_type_imp<__value_type<_Key, _Value>> : true_type {}; template <class ..._Args> struct __is_tree_value_type : false_type {}; template <class _One> struct __is_tree_value_type<_One> : __is_tree_value_type_imp<typename __uncvref<_One>::type> {}; template <class _Tp> struct __tree_key_value_types { typedef _Tp key_type; typedef _Tp __node_value_type; typedef _Tp __container_value_type; static const bool __is_map = false; __attribute__ ((__exclude_from_explicit_instantiation__)) static key_type const& __get_key(_Tp const& __v) { return __v; } __attribute__ ((__exclude_from_explicit_instantiation__)) static __container_value_type const& __get_value(__node_value_type const& __v) { return __v; } __attribute__ ((__exclude_from_explicit_instantiation__)) static __container_value_type* __get_ptr(__node_value_type& __n) { return std::__1::addressof(__n); } __attribute__ ((__exclude_from_explicit_instantiation__)) static __container_value_type&& __move(__node_value_type& __v) { return std::__1::move(__v); } }; template <class _Key, class _Tp> struct __tree_key_value_types<__value_type<_Key, _Tp> > { typedef _Key key_type; typedef _Tp mapped_type; typedef __value_type<_Key, _Tp> __node_value_type; typedef pair<const _Key, _Tp> __container_value_type; typedef __container_value_type __map_value_type; static const bool __is_map = true; __attribute__ ((__exclude_from_explicit_instantiation__)) static key_type const& __get_key(__node_value_type const& __t) { return __t.__get_value().first; } template <class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) static typename enable_if<__is_same_uncvref<_Up, __container_value_type>::value, key_type const&>::type __get_key(_Up& __t) { return __t.first; } __attribute__ ((__exclude_from_explicit_instantiation__)) static __container_value_type const& __get_value(__node_value_type const& __t) { return __t.__get_value(); } template <class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) static typename enable_if<__is_same_uncvref<_Up, __container_value_type>::value, __container_value_type const&>::type __get_value(_Up& __t) { return __t; } __attribute__ ((__exclude_from_explicit_instantiation__)) static __container_value_type* __get_ptr(__node_value_type& __n) { return std::__1::addressof(__n.__get_value()); } __attribute__ ((__exclude_from_explicit_instantiation__)) static pair<key_type&&, mapped_type&&> __move(__node_value_type& __v) { return __v.__move(); } }; template <class _VoidPtr> struct __tree_node_base_types { typedef _VoidPtr __void_pointer; typedef __tree_node_base<__void_pointer> __node_base_type; typedef typename __rebind_pointer<_VoidPtr, __node_base_type>::type __node_base_pointer; typedef __tree_end_node<__node_base_pointer> __end_node_type; typedef typename __rebind_pointer<_VoidPtr, __end_node_type>::type __end_node_pointer; typedef __end_node_pointer __parent_pointer; private: static_assert((is_same<typename pointer_traits<_VoidPtr>::element_type, void>::value), "_VoidPtr does not point to unqualified void type"); }; template <class _Tp, class _AllocPtr, class _KVTypes = __tree_key_value_types<_Tp>, bool = _KVTypes::__is_map> struct __tree_map_pointer_types {}; template <class _Tp, class _AllocPtr, class _KVTypes> struct __tree_map_pointer_types<_Tp, _AllocPtr, _KVTypes, true> { typedef typename _KVTypes::__map_value_type _Mv; typedef typename __rebind_pointer<_AllocPtr, _Mv>::type __map_value_type_pointer; typedef typename __rebind_pointer<_AllocPtr, const _Mv>::type __const_map_value_type_pointer; }; template <class _NodePtr, class _NodeT = typename pointer_traits<_NodePtr>::element_type> struct __tree_node_types; template <class _NodePtr, class _Tp, class _VoidPtr> struct __tree_node_types<_NodePtr, __tree_node<_Tp, _VoidPtr> > : public __tree_node_base_types<_VoidPtr>, __tree_key_value_types<_Tp>, __tree_map_pointer_types<_Tp, _VoidPtr> { typedef __tree_node_base_types<_VoidPtr> __base; typedef __tree_key_value_types<_Tp> __key_base; typedef __tree_map_pointer_types<_Tp, _VoidPtr> __map_pointer_base; public: typedef typename pointer_traits<_NodePtr>::element_type __node_type; typedef _NodePtr __node_pointer; typedef _Tp __node_value_type; typedef typename __rebind_pointer<_VoidPtr, __node_value_type>::type __node_value_type_pointer; typedef typename __rebind_pointer<_VoidPtr, const __node_value_type>::type __const_node_value_type_pointer; typedef typename __base::__end_node_pointer __iter_pointer; private: static_assert(!is_const<__node_type>::value, "_NodePtr should never be a pointer to const"); static_assert((is_same<typename __rebind_pointer<_VoidPtr, __node_type>::type, _NodePtr>::value), "_VoidPtr does not rebind to _NodePtr."); }; template <class _ValueTp, class _VoidPtr> struct __make_tree_node_types { typedef typename __rebind_pointer<_VoidPtr, __tree_node<_ValueTp, _VoidPtr> >::type _NodePtr; typedef __tree_node_types<_NodePtr> type; }; template <class _Pointer> class __tree_end_node { public: typedef _Pointer pointer; pointer __left_; __attribute__ ((__exclude_from_explicit_instantiation__)) __tree_end_node() noexcept : __left_() {} }; template <class _VoidPtr> class __tree_node_base : public __tree_node_base_types<_VoidPtr>::__end_node_type { typedef __tree_node_base_types<_VoidPtr> _NodeBaseTypes; public: typedef typename _NodeBaseTypes::__node_base_pointer pointer; typedef typename _NodeBaseTypes::__parent_pointer __parent_pointer; pointer __right_; __parent_pointer __parent_; bool __is_black_; __attribute__ ((__exclude_from_explicit_instantiation__)) pointer __parent_unsafe() const { return static_cast<pointer>(__parent_);} __attribute__ ((__exclude_from_explicit_instantiation__)) void __set_parent(pointer __p) { __parent_ = static_cast<__parent_pointer>(__p); } private: ~__tree_node_base() = delete; __tree_node_base(__tree_node_base const&) = delete; __tree_node_base& operator=(__tree_node_base const&) = delete; }; template <class _Tp, class _VoidPtr> class __tree_node : public __tree_node_base<_VoidPtr> { public: typedef _Tp __node_value_type; __node_value_type __value_; private: ~__tree_node() = delete; __tree_node(__tree_node const&) = delete; __tree_node& operator=(__tree_node const&) = delete; }; template <class _Allocator> class __tree_node_destructor { typedef _Allocator allocator_type; typedef allocator_traits<allocator_type> __alloc_traits; public: typedef typename __alloc_traits::pointer pointer; private: typedef __tree_node_types<pointer> _NodeTypes; allocator_type& __na_; __tree_node_destructor& operator=(const __tree_node_destructor&); public: bool __value_constructed; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __tree_node_destructor(allocator_type& __na, bool __val = false) noexcept : __na_(__na), __value_constructed(__val) {} __attribute__ ((__exclude_from_explicit_instantiation__)) void operator()(pointer __p) noexcept { if (__value_constructed) __alloc_traits::destroy(__na_, _NodeTypes::__get_ptr(__p->__value_)); if (__p) __alloc_traits::deallocate(__na_, __p, 1); } template <class> friend class __map_node_destructor; }; template <class _Tp, class _NodePtr, class _DiffType> class __tree_iterator { typedef __tree_node_types<_NodePtr> _NodeTypes; typedef _NodePtr __node_pointer; typedef typename _NodeTypes::__node_base_pointer __node_base_pointer; typedef typename _NodeTypes::__end_node_pointer __end_node_pointer; typedef typename _NodeTypes::__iter_pointer __iter_pointer; typedef pointer_traits<__node_pointer> __pointer_traits; __iter_pointer __ptr_; public: typedef bidirectional_iterator_tag iterator_category; typedef _Tp value_type; typedef _DiffType difference_type; typedef value_type& reference; typedef typename _NodeTypes::__node_value_type_pointer pointer; __attribute__ ((__exclude_from_explicit_instantiation__)) __tree_iterator() noexcept : __ptr_(nullptr) {} __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator*() const {return __get_np()->__value_;} __attribute__ ((__exclude_from_explicit_instantiation__)) pointer operator->() const {return pointer_traits<pointer>::pointer_to(__get_np()->__value_);} __attribute__ ((__exclude_from_explicit_instantiation__)) __tree_iterator& operator++() { __ptr_ = static_cast<__iter_pointer>( __tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_))); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __tree_iterator operator++(int) {__tree_iterator __t(*this); ++(*this); return __t;} __attribute__ ((__exclude_from_explicit_instantiation__)) __tree_iterator& operator--() { __ptr_ = static_cast<__iter_pointer>(__tree_prev_iter<__node_base_pointer>( static_cast<__end_node_pointer>(__ptr_))); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __tree_iterator operator--(int) {__tree_iterator __t(*this); --(*this); return __t;} friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const __tree_iterator& __x, const __tree_iterator& __y) {return __x.__ptr_ == __y.__ptr_;} friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const __tree_iterator& __x, const __tree_iterator& __y) {return !(__x == __y);} private: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __tree_iterator(__node_pointer __p) noexcept : __ptr_(__p) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __tree_iterator(__end_node_pointer __p) noexcept : __ptr_(__p) {} __attribute__ ((__exclude_from_explicit_instantiation__)) __node_pointer __get_np() const { return static_cast<__node_pointer>(__ptr_); } template <class, class, class> friend class __tree; template <class, class, class> friend class __tree_const_iterator; template <class> friend class __map_iterator; template <class, class, class, class> friend class map; template <class, class, class, class> friend class multimap; template <class, class, class> friend class set; template <class, class, class> friend class multiset; }; template <class _Tp, class _NodePtr, class _DiffType> class __tree_const_iterator { typedef __tree_node_types<_NodePtr> _NodeTypes; typedef typename _NodeTypes::__node_pointer __node_pointer; typedef typename _NodeTypes::__node_base_pointer __node_base_pointer; typedef typename _NodeTypes::__end_node_pointer __end_node_pointer; typedef typename _NodeTypes::__iter_pointer __iter_pointer; typedef pointer_traits<__node_pointer> __pointer_traits; __iter_pointer __ptr_; public: typedef bidirectional_iterator_tag iterator_category; typedef _Tp value_type; typedef _DiffType difference_type; typedef const value_type& reference; typedef typename _NodeTypes::__const_node_value_type_pointer pointer; __attribute__ ((__exclude_from_explicit_instantiation__)) __tree_const_iterator() noexcept : __ptr_(nullptr) {} private: typedef __tree_iterator<value_type, __node_pointer, difference_type> __non_const_iterator; public: __attribute__ ((__exclude_from_explicit_instantiation__)) __tree_const_iterator(__non_const_iterator __p) noexcept : __ptr_(__p.__ptr_) {} __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator*() const {return __get_np()->__value_;} __attribute__ ((__exclude_from_explicit_instantiation__)) pointer operator->() const {return pointer_traits<pointer>::pointer_to(__get_np()->__value_);} __attribute__ ((__exclude_from_explicit_instantiation__)) __tree_const_iterator& operator++() { __ptr_ = static_cast<__iter_pointer>( __tree_next_iter<__end_node_pointer>(static_cast<__node_base_pointer>(__ptr_))); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __tree_const_iterator operator++(int) {__tree_const_iterator __t(*this); ++(*this); return __t;} __attribute__ ((__exclude_from_explicit_instantiation__)) __tree_const_iterator& operator--() { __ptr_ = static_cast<__iter_pointer>(__tree_prev_iter<__node_base_pointer>( static_cast<__end_node_pointer>(__ptr_))); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __tree_const_iterator operator--(int) {__tree_const_iterator __t(*this); --(*this); return __t;} friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const __tree_const_iterator& __x, const __tree_const_iterator& __y) {return __x.__ptr_ == __y.__ptr_;} friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const __tree_const_iterator& __x, const __tree_const_iterator& __y) {return !(__x == __y);} private: __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __tree_const_iterator(__node_pointer __p) noexcept : __ptr_(__p) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __tree_const_iterator(__end_node_pointer __p) noexcept : __ptr_(__p) {} __attribute__ ((__exclude_from_explicit_instantiation__)) __node_pointer __get_np() const { return static_cast<__node_pointer>(__ptr_); } template <class, class, class> friend class __tree; template <class, class, class, class> friend class map; template <class, class, class, class> friend class multimap; template <class, class, class> friend class set; template <class, class, class> friend class multiset; template <class> friend class __map_const_iterator; }; template<class _Tp, class _Compare> __attribute__((diagnose_if(!std::__invokable<_Compare const&, _Tp const&, _Tp const&>::value, "the specified comparator type does not provide a viable const call operator", "warning"))) int __diagnose_non_const_comparator(); template <class _Tp, class _Compare, class _Allocator> class __tree { public: typedef _Tp value_type; typedef _Compare value_compare; typedef _Allocator allocator_type; private: typedef allocator_traits<allocator_type> __alloc_traits; typedef typename __make_tree_node_types<value_type, typename __alloc_traits::void_pointer>::type _NodeTypes; typedef typename _NodeTypes::key_type key_type; public: typedef typename _NodeTypes::__node_value_type __node_value_type; typedef typename _NodeTypes::__container_value_type __container_value_type; typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::const_pointer const_pointer; typedef typename __alloc_traits::size_type size_type; typedef typename __alloc_traits::difference_type difference_type; public: typedef typename _NodeTypes::__void_pointer __void_pointer; typedef typename _NodeTypes::__node_type __node; typedef typename _NodeTypes::__node_pointer __node_pointer; typedef typename _NodeTypes::__node_base_type __node_base; typedef typename _NodeTypes::__node_base_pointer __node_base_pointer; typedef typename _NodeTypes::__end_node_type __end_node_t; typedef typename _NodeTypes::__end_node_pointer __end_node_ptr; typedef typename _NodeTypes::__parent_pointer __parent_pointer; typedef typename _NodeTypes::__iter_pointer __iter_pointer; typedef typename __rebind_alloc_helper<__alloc_traits, __node>::type __node_allocator; typedef allocator_traits<__node_allocator> __node_traits; private: static_assert((is_same<__node_pointer, typename __node_traits::pointer>::value), "Allocator does not rebind pointers in a sane manner."); typedef typename __rebind_alloc_helper<__node_traits, __node_base>::type __node_base_allocator; typedef allocator_traits<__node_base_allocator> __node_base_traits; static_assert((is_same<__node_base_pointer, typename __node_base_traits::pointer>::value), "Allocator does not rebind pointers in a sane manner."); private: __iter_pointer __begin_node_; __compressed_pair<__end_node_t, __node_allocator> __pair1_; __compressed_pair<size_type, value_compare> __pair3_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) __iter_pointer __end_node() noexcept { return static_cast<__iter_pointer>( pointer_traits<__end_node_ptr>::pointer_to(__pair1_.first()) ); } __attribute__ ((__exclude_from_explicit_instantiation__)) __iter_pointer __end_node() const noexcept { return static_cast<__iter_pointer>( pointer_traits<__end_node_ptr>::pointer_to( const_cast<__end_node_t&>(__pair1_.first()) ) ); } __attribute__ ((__exclude_from_explicit_instantiation__)) __node_allocator& __node_alloc() noexcept {return __pair1_.second();} private: __attribute__ ((__exclude_from_explicit_instantiation__)) const __node_allocator& __node_alloc() const noexcept {return __pair1_.second();} __attribute__ ((__exclude_from_explicit_instantiation__)) __iter_pointer& __begin_node() noexcept {return __begin_node_;} __attribute__ ((__exclude_from_explicit_instantiation__)) const __iter_pointer& __begin_node() const noexcept {return __begin_node_;} public: __attribute__ ((__exclude_from_explicit_instantiation__)) allocator_type __alloc() const noexcept {return allocator_type(__node_alloc());} private: __attribute__ ((__exclude_from_explicit_instantiation__)) size_type& size() noexcept {return __pair3_.first();} public: __attribute__ ((__exclude_from_explicit_instantiation__)) const size_type& size() const noexcept {return __pair3_.first();} __attribute__ ((__exclude_from_explicit_instantiation__)) value_compare& value_comp() noexcept {return __pair3_.second();} __attribute__ ((__exclude_from_explicit_instantiation__)) const value_compare& value_comp() const noexcept {return __pair3_.second();} public: __attribute__ ((__exclude_from_explicit_instantiation__)) __node_pointer __root() const noexcept {return static_cast<__node_pointer>(__end_node()->__left_);} __node_base_pointer* __root_ptr() const noexcept { return std::__1::addressof(__end_node()->__left_); } typedef __tree_iterator<value_type, __node_pointer, difference_type> iterator; typedef __tree_const_iterator<value_type, __node_pointer, difference_type> const_iterator; explicit __tree(const value_compare& __comp) noexcept(is_nothrow_default_constructible<__node_allocator>::value && is_nothrow_copy_constructible<value_compare>::value); explicit __tree(const allocator_type& __a); __tree(const value_compare& __comp, const allocator_type& __a); __tree(const __tree& __t); __tree& operator=(const __tree& __t); template <class _ForwardIterator> void __assign_unique(_ForwardIterator __first, _ForwardIterator __last); template <class _InputIterator> void __assign_multi(_InputIterator __first, _InputIterator __last); __tree(__tree&& __t) noexcept(is_nothrow_move_constructible<__node_allocator>::value && is_nothrow_move_constructible<value_compare>::value); __tree(__tree&& __t, const allocator_type& __a); __tree& operator=(__tree&& __t) noexcept(__node_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable<value_compare>::value && is_nothrow_move_assignable<__node_allocator>::value); ~__tree(); __attribute__ ((__exclude_from_explicit_instantiation__)) iterator begin() noexcept {return iterator(__begin_node());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator begin() const noexcept {return const_iterator(__begin_node());} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator end() noexcept {return iterator(__end_node());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator end() const noexcept {return const_iterator(__end_node());} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type max_size() const noexcept {return std::min<size_type>( __node_traits::max_size(__node_alloc()), numeric_limits<difference_type >::max());} void clear() noexcept; void swap(__tree& __t) noexcept(__is_nothrow_swappable<value_compare>::value); template <class _Key, class ..._Args> pair<iterator, bool> __emplace_unique_key_args(_Key const&, _Args&&... __args); template <class _Key, class ..._Args> iterator __emplace_hint_unique_key_args(const_iterator, _Key const&, _Args&&...); template <class... _Args> pair<iterator, bool> __emplace_unique_impl(_Args&&... __args); template <class... _Args> iterator __emplace_hint_unique_impl(const_iterator __p, _Args&&... __args); template <class... _Args> iterator __emplace_multi(_Args&&... __args); template <class... _Args> iterator __emplace_hint_multi(const_iterator __p, _Args&&... __args); template <class _Pp> __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> __emplace_unique(_Pp&& __x) { return __emplace_unique_extract_key(std::__1::forward<_Pp>(__x), __can_extract_key<_Pp, key_type>()); } template <class _First, class _Second> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if< __can_extract_map_key<_First, key_type, __container_value_type>::value, pair<iterator, bool> >::type __emplace_unique(_First&& __f, _Second&& __s) { return __emplace_unique_key_args(__f, std::__1::forward<_First>(__f), std::__1::forward<_Second>(__s)); } template <class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> __emplace_unique(_Args&&... __args) { return __emplace_unique_impl(std::__1::forward<_Args>(__args)...); } template <class _Pp> __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> __emplace_unique_extract_key(_Pp&& __x, __extract_key_fail_tag) { return __emplace_unique_impl(std::__1::forward<_Pp>(__x)); } template <class _Pp> __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> __emplace_unique_extract_key(_Pp&& __x, __extract_key_self_tag) { return __emplace_unique_key_args(__x, std::__1::forward<_Pp>(__x)); } template <class _Pp> __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> __emplace_unique_extract_key(_Pp&& __x, __extract_key_first_tag) { return __emplace_unique_key_args(__x.first, std::__1::forward<_Pp>(__x)); } template <class _Pp> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __emplace_hint_unique(const_iterator __p, _Pp&& __x) { return __emplace_hint_unique_extract_key(__p, std::__1::forward<_Pp>(__x), __can_extract_key<_Pp, key_type>()); } template <class _First, class _Second> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if< __can_extract_map_key<_First, key_type, __container_value_type>::value, iterator >::type __emplace_hint_unique(const_iterator __p, _First&& __f, _Second&& __s) { return __emplace_hint_unique_key_args(__p, __f, std::__1::forward<_First>(__f), std::__1::forward<_Second>(__s)); } template <class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __emplace_hint_unique(const_iterator __p, _Args&&... __args) { return __emplace_hint_unique_impl(__p, std::__1::forward<_Args>(__args)...); } template <class _Pp> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_fail_tag) { return __emplace_hint_unique_impl(__p, std::__1::forward<_Pp>(__x)); } template <class _Pp> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_self_tag) { return __emplace_hint_unique_key_args(__p, __x, std::__1::forward<_Pp>(__x)); } template <class _Pp> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_first_tag) { return __emplace_hint_unique_key_args(__p, __x.first, std::__1::forward<_Pp>(__x)); } __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> __insert_unique(const __container_value_type& __v) { return __emplace_unique_key_args(_NodeTypes::__get_key(__v), __v); } __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __insert_unique(const_iterator __p, const __container_value_type& __v) { return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), __v); } __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> __insert_unique(__container_value_type&& __v) { return __emplace_unique_key_args(_NodeTypes::__get_key(__v), std::__1::move(__v)); } __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __insert_unique(const_iterator __p, __container_value_type&& __v) { return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), std::__1::move(__v)); } template <class _Vp, class = typename enable_if< !is_same<typename __unconstref<_Vp>::type, __container_value_type >::value >::type> __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> __insert_unique(_Vp&& __v) { return __emplace_unique(std::__1::forward<_Vp>(__v)); } template <class _Vp, class = typename enable_if< !is_same<typename __unconstref<_Vp>::type, __container_value_type >::value >::type> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __insert_unique(const_iterator __p, _Vp&& __v) { return __emplace_hint_unique(__p, std::__1::forward<_Vp>(__v)); } __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __insert_multi(__container_value_type&& __v) { return __emplace_multi(std::__1::move(__v)); } __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __insert_multi(const_iterator __p, __container_value_type&& __v) { return __emplace_hint_multi(__p, std::__1::move(__v)); } template <class _Vp> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __insert_multi(_Vp&& __v) { return __emplace_multi(std::__1::forward<_Vp>(__v)); } template <class _Vp> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __insert_multi(const_iterator __p, _Vp&& __v) { return __emplace_hint_multi(__p, std::__1::forward<_Vp>(__v)); } __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> __node_assign_unique(const __container_value_type& __v, __node_pointer __dest); __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __node_insert_multi(__node_pointer __nd); __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __node_insert_multi(const_iterator __p, __node_pointer __nd); __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __remove_node_pointer(__node_pointer) noexcept; iterator erase(const_iterator __p); iterator erase(const_iterator __f, const_iterator __l); template <class _Key> size_type __erase_unique(const _Key& __k); template <class _Key> size_type __erase_multi(const _Key& __k); void __insert_node_at(__parent_pointer __parent, __node_base_pointer& __child, __node_base_pointer __new_node) noexcept; template <class _Key> iterator find(const _Key& __v); template <class _Key> const_iterator find(const _Key& __v) const; template <class _Key> size_type __count_unique(const _Key& __k) const; template <class _Key> size_type __count_multi(const _Key& __k) const; template <class _Key> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator lower_bound(const _Key& __v) {return __lower_bound(__v, __root(), __end_node());} template <class _Key> iterator __lower_bound(const _Key& __v, __node_pointer __root, __iter_pointer __result); template <class _Key> __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator lower_bound(const _Key& __v) const {return __lower_bound(__v, __root(), __end_node());} template <class _Key> const_iterator __lower_bound(const _Key& __v, __node_pointer __root, __iter_pointer __result) const; template <class _Key> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator upper_bound(const _Key& __v) {return __upper_bound(__v, __root(), __end_node());} template <class _Key> iterator __upper_bound(const _Key& __v, __node_pointer __root, __iter_pointer __result); template <class _Key> __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator upper_bound(const _Key& __v) const {return __upper_bound(__v, __root(), __end_node());} template <class _Key> const_iterator __upper_bound(const _Key& __v, __node_pointer __root, __iter_pointer __result) const; template <class _Key> pair<iterator, iterator> __equal_range_unique(const _Key& __k); template <class _Key> pair<const_iterator, const_iterator> __equal_range_unique(const _Key& __k) const; template <class _Key> pair<iterator, iterator> __equal_range_multi(const _Key& __k); template <class _Key> pair<const_iterator, const_iterator> __equal_range_multi(const _Key& __k) const; typedef __tree_node_destructor<__node_allocator> _Dp; typedef unique_ptr<__node, _Dp> __node_holder; __node_holder remove(const_iterator __p) noexcept; private: __node_base_pointer& __find_leaf_low(__parent_pointer& __parent, const key_type& __v); __node_base_pointer& __find_leaf_high(__parent_pointer& __parent, const key_type& __v); __node_base_pointer& __find_leaf(const_iterator __hint, __parent_pointer& __parent, const key_type& __v); template <class _Key> __node_base_pointer& __find_equal(__parent_pointer& __parent, const _Key& __v); template <class _Key> __attribute__ ((__exclude_from_explicit_instantiation__)) __node_base_pointer& __find_equal(__parent_pointer& __parent, const _Key& __v) const { return const_cast<__tree*>(this)->__find_equal(__parent, __v); } template <class _Key> __node_base_pointer& __find_equal(const_iterator __hint, __parent_pointer& __parent, __node_base_pointer& __dummy, const _Key& __v); template <class ..._Args> __node_holder __construct_node(_Args&& ...__args); void destroy(__node_pointer __nd) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) void __copy_assign_alloc(const __tree& __t) {__copy_assign_alloc(__t, integral_constant<bool, __node_traits::propagate_on_container_copy_assignment::value>());} __attribute__ ((__exclude_from_explicit_instantiation__)) void __copy_assign_alloc(const __tree& __t, true_type) { if (__node_alloc() != __t.__node_alloc()) clear(); __node_alloc() = __t.__node_alloc(); } __attribute__ ((__exclude_from_explicit_instantiation__)) void __copy_assign_alloc(const __tree&, false_type) {} void __move_assign(__tree& __t, false_type); void __move_assign(__tree& __t, true_type) noexcept(is_nothrow_move_assignable<value_compare>::value && is_nothrow_move_assignable<__node_allocator>::value); __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(__tree& __t) noexcept(!__node_traits::propagate_on_container_move_assignment::value || is_nothrow_move_assignable<__node_allocator>::value) {__move_assign_alloc(__t, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>());} __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(__tree& __t, true_type) noexcept(is_nothrow_move_assignable<__node_allocator>::value) {__node_alloc() = std::__1::move(__t.__node_alloc());} __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(__tree&, false_type) noexcept {} struct _DetachedTreeCache { __attribute__ ((__exclude_from_explicit_instantiation__)) explicit _DetachedTreeCache(__tree *__t) noexcept : __t_(__t), __cache_root_(__detach_from_tree(__t)) { __advance(); } __attribute__ ((__exclude_from_explicit_instantiation__)) __node_pointer __get() const noexcept { return __cache_elem_; } __attribute__ ((__exclude_from_explicit_instantiation__)) void __advance() noexcept { __cache_elem_ = __cache_root_; if (__cache_root_) { __cache_root_ = __detach_next(__cache_root_); } } __attribute__ ((__exclude_from_explicit_instantiation__)) ~_DetachedTreeCache() { __t_->destroy(__cache_elem_); if (__cache_root_) { while (__cache_root_->__parent_ != nullptr) __cache_root_ = static_cast<__node_pointer>(__cache_root_->__parent_); __t_->destroy(__cache_root_); } } _DetachedTreeCache(_DetachedTreeCache const&) = delete; _DetachedTreeCache& operator=(_DetachedTreeCache const&) = delete; private: __attribute__ ((__exclude_from_explicit_instantiation__)) static __node_pointer __detach_from_tree(__tree *__t) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) static __node_pointer __detach_next(__node_pointer) noexcept; __tree *__t_; __node_pointer __cache_root_; __node_pointer __cache_elem_; }; template <class, class, class, class> friend class map; template <class, class, class, class> friend class multimap; }; template <class _Tp, class _Compare, class _Allocator> __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp) noexcept(is_nothrow_default_constructible<__node_allocator>::value && is_nothrow_copy_constructible<value_compare>::value) : __pair3_(0, __comp) { __begin_node() = __end_node(); } template <class _Tp, class _Compare, class _Allocator> __tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a) : __begin_node_(__iter_pointer()), __pair1_(__second_tag(), __node_allocator(__a)), __pair3_(0) { __begin_node() = __end_node(); } template <class _Tp, class _Compare, class _Allocator> __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp, const allocator_type& __a) : __begin_node_(__iter_pointer()), __pair1_(__second_tag(), __node_allocator(__a)), __pair3_(0, __comp) { __begin_node() = __end_node(); } template <class _Tp, class _Compare, class _Allocator> typename __tree<_Tp, _Compare, _Allocator>::__node_pointer __tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_from_tree(__tree *__t) noexcept { __node_pointer __cache = static_cast<__node_pointer>(__t->__begin_node()); __t->__begin_node() = __t->__end_node(); __t->__end_node()->__left_->__parent_ = nullptr; __t->__end_node()->__left_ = nullptr; __t->size() = 0; if (__cache->__right_ != nullptr) __cache = static_cast<__node_pointer>(__cache->__right_); return __cache; } template <class _Tp, class _Compare, class _Allocator> typename __tree<_Tp, _Compare, _Allocator>::__node_pointer __tree<_Tp, _Compare, _Allocator>::_DetachedTreeCache::__detach_next(__node_pointer __cache) noexcept { if (__cache->__parent_ == nullptr) return nullptr; if (__tree_is_left_child(static_cast<__node_base_pointer>(__cache))) { __cache->__parent_->__left_ = nullptr; __cache = static_cast<__node_pointer>(__cache->__parent_); if (__cache->__right_ == nullptr) return __cache; return static_cast<__node_pointer>(__tree_leaf(__cache->__right_)); } __cache->__parent_unsafe()->__right_ = nullptr; __cache = static_cast<__node_pointer>(__cache->__parent_); if (__cache->__left_ == nullptr) return __cache; return static_cast<__node_pointer>(__tree_leaf(__cache->__left_)); } template <class _Tp, class _Compare, class _Allocator> __tree<_Tp, _Compare, _Allocator>& __tree<_Tp, _Compare, _Allocator>::operator=(const __tree& __t) { if (this != &__t) { value_comp() = __t.value_comp(); __copy_assign_alloc(__t); __assign_multi(__t.begin(), __t.end()); } return *this; } template <class _Tp, class _Compare, class _Allocator> template <class _ForwardIterator> void __tree<_Tp, _Compare, _Allocator>::__assign_unique(_ForwardIterator __first, _ForwardIterator __last) { typedef iterator_traits<_ForwardIterator> _ITraits; typedef typename _ITraits::value_type _ItValueType; static_assert((is_same<_ItValueType, __container_value_type>::value), "__assign_unique may only be called with the containers value type"); static_assert(__is_forward_iterator<_ForwardIterator>::value, "__assign_unique requires a forward iterator"); if (size() != 0) { _DetachedTreeCache __cache(this); for (; __cache.__get() != nullptr && __first != __last; ++__first) { if (__node_assign_unique(*__first, __cache.__get()).second) __cache.__advance(); } } for (; __first != __last; ++__first) __insert_unique(*__first); } template <class _Tp, class _Compare, class _Allocator> template <class _InputIterator> void __tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _InputIterator __last) { typedef iterator_traits<_InputIterator> _ITraits; typedef typename _ITraits::value_type _ItValueType; static_assert((is_same<_ItValueType, __container_value_type>::value || is_same<_ItValueType, __node_value_type>::value), "__assign_multi may only be called with the containers value type" " or the nodes value type"); if (size() != 0) { _DetachedTreeCache __cache(this); for (; __cache.__get() && __first != __last; ++__first) { __cache.__get()->__value_ = *__first; __node_insert_multi(__cache.__get()); __cache.__advance(); } } for (; __first != __last; ++__first) __insert_multi(_NodeTypes::__get_value(*__first)); } template <class _Tp, class _Compare, class _Allocator> __tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t) : __begin_node_(__iter_pointer()), __pair1_(__second_tag(), __node_traits::select_on_container_copy_construction(__t.__node_alloc())), __pair3_(0, __t.value_comp()) { __begin_node() = __end_node(); } template <class _Tp, class _Compare, class _Allocator> __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) noexcept(is_nothrow_move_constructible<__node_allocator>::value && is_nothrow_move_constructible<value_compare>::value) : __begin_node_(std::__1::move(__t.__begin_node_)), __pair1_(std::__1::move(__t.__pair1_)), __pair3_(std::__1::move(__t.__pair3_)) { if (size() == 0) __begin_node() = __end_node(); else { __end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__end_node()); __t.__begin_node() = __t.__end_node(); __t.__end_node()->__left_ = nullptr; __t.size() = 0; } } template <class _Tp, class _Compare, class _Allocator> __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a) : __pair1_(__second_tag(), __node_allocator(__a)), __pair3_(0, std::__1::move(__t.value_comp())) { if (__a == __t.__alloc()) { if (__t.size() == 0) __begin_node() = __end_node(); else { __begin_node() = __t.__begin_node(); __end_node()->__left_ = __t.__end_node()->__left_; __end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__end_node()); size() = __t.size(); __t.__begin_node() = __t.__end_node(); __t.__end_node()->__left_ = nullptr; __t.size() = 0; } } else { __begin_node() = __end_node(); } } template <class _Tp, class _Compare, class _Allocator> void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type) noexcept(is_nothrow_move_assignable<value_compare>::value && is_nothrow_move_assignable<__node_allocator>::value) { destroy(static_cast<__node_pointer>(__end_node()->__left_)); __begin_node_ = __t.__begin_node_; __pair1_.first() = __t.__pair1_.first(); __move_assign_alloc(__t); __pair3_ = std::__1::move(__t.__pair3_); if (size() == 0) __begin_node() = __end_node(); else { __end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__end_node()); __t.__begin_node() = __t.__end_node(); __t.__end_node()->__left_ = nullptr; __t.size() = 0; } } template <class _Tp, class _Compare, class _Allocator> void __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type) { if (__node_alloc() == __t.__node_alloc()) __move_assign(__t, true_type()); else { value_comp() = std::__1::move(__t.value_comp()); const_iterator __e = end(); if (size() != 0) { _DetachedTreeCache __cache(this); while (__cache.__get() != nullptr && __t.size() != 0) { __cache.__get()->__value_ = std::__1::move(__t.remove(__t.begin())->__value_); __node_insert_multi(__cache.__get()); __cache.__advance(); } } while (__t.size() != 0) __insert_multi(__e, _NodeTypes::__move(__t.remove(__t.begin())->__value_)); } } template <class _Tp, class _Compare, class _Allocator> __tree<_Tp, _Compare, _Allocator>& __tree<_Tp, _Compare, _Allocator>::operator=(__tree&& __t) noexcept(__node_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable<value_compare>::value && is_nothrow_move_assignable<__node_allocator>::value) { __move_assign(__t, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>()); return *this; } template <class _Tp, class _Compare, class _Allocator> __tree<_Tp, _Compare, _Allocator>::~__tree() { static_assert((is_copy_constructible<value_compare>::value), "Comparator must be copy-constructible."); destroy(__root()); } template <class _Tp, class _Compare, class _Allocator> void __tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd) noexcept { if (__nd != nullptr) { destroy(static_cast<__node_pointer>(__nd->__left_)); destroy(static_cast<__node_pointer>(__nd->__right_)); __node_allocator& __na = __node_alloc(); __node_traits::destroy(__na, _NodeTypes::__get_ptr(__nd->__value_)); __node_traits::deallocate(__na, __nd, 1); } } template <class _Tp, class _Compare, class _Allocator> void __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t) noexcept(__is_nothrow_swappable<value_compare>::value) { using std::__1::swap; swap(__begin_node_, __t.__begin_node_); swap(__pair1_.first(), __t.__pair1_.first()); __swap_allocator(__node_alloc(), __t.__node_alloc()); __pair3_.swap(__t.__pair3_); if (size() == 0) __begin_node() = __end_node(); else __end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__end_node()); if (__t.size() == 0) __t.__begin_node() = __t.__end_node(); else __t.__end_node()->__left_->__parent_ = static_cast<__parent_pointer>(__t.__end_node()); } template <class _Tp, class _Compare, class _Allocator> void __tree<_Tp, _Compare, _Allocator>::clear() noexcept { destroy(__root()); size() = 0; __begin_node() = __end_node(); __end_node()->__left_ = nullptr; } template <class _Tp, class _Compare, class _Allocator> typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& __tree<_Tp, _Compare, _Allocator>::__find_leaf_low(__parent_pointer& __parent, const key_type& __v) { __node_pointer __nd = __root(); if (__nd != nullptr) { while (true) { if (value_comp()(__nd->__value_, __v)) { if (__nd->__right_ != nullptr) __nd = static_cast<__node_pointer>(__nd->__right_); else { __parent = static_cast<__parent_pointer>(__nd); return __nd->__right_; } } else { if (__nd->__left_ != nullptr) __nd = static_cast<__node_pointer>(__nd->__left_); else { __parent = static_cast<__parent_pointer>(__nd); return __parent->__left_; } } } } __parent = static_cast<__parent_pointer>(__end_node()); return __parent->__left_; } template <class _Tp, class _Compare, class _Allocator> typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(__parent_pointer& __parent, const key_type& __v) { __node_pointer __nd = __root(); if (__nd != nullptr) { while (true) { if (value_comp()(__v, __nd->__value_)) { if (__nd->__left_ != nullptr) __nd = static_cast<__node_pointer>(__nd->__left_); else { __parent = static_cast<__parent_pointer>(__nd); return __parent->__left_; } } else { if (__nd->__right_ != nullptr) __nd = static_cast<__node_pointer>(__nd->__right_); else { __parent = static_cast<__parent_pointer>(__nd); return __nd->__right_; } } } } __parent = static_cast<__parent_pointer>(__end_node()); return __parent->__left_; } template <class _Tp, class _Compare, class _Allocator> typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& __tree<_Tp, _Compare, _Allocator>::__find_leaf(const_iterator __hint, __parent_pointer& __parent, const key_type& __v) { if (__hint == end() || !value_comp()(*__hint, __v)) { const_iterator __prior = __hint; if (__prior == begin() || !value_comp()(__v, *--__prior)) { if (__hint.__ptr_->__left_ == nullptr) { __parent = static_cast<__parent_pointer>(__hint.__ptr_); return __parent->__left_; } else { __parent = static_cast<__parent_pointer>(__prior.__ptr_); return static_cast<__node_base_pointer>(__prior.__ptr_)->__right_; } } return __find_leaf_high(__parent, __v); } return __find_leaf_low(__parent, __v); } template <class _Tp, class _Compare, class _Allocator> template <class _Key> typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& __tree<_Tp, _Compare, _Allocator>::__find_equal(__parent_pointer& __parent, const _Key& __v) { __node_pointer __nd = __root(); __node_base_pointer* __nd_ptr = __root_ptr(); if (__nd != nullptr) { while (true) { if (value_comp()(__v, __nd->__value_)) { if (__nd->__left_ != nullptr) { __nd_ptr = std::__1::addressof(__nd->__left_); __nd = static_cast<__node_pointer>(__nd->__left_); } else { __parent = static_cast<__parent_pointer>(__nd); return __parent->__left_; } } else if (value_comp()(__nd->__value_, __v)) { if (__nd->__right_ != nullptr) { __nd_ptr = std::__1::addressof(__nd->__right_); __nd = static_cast<__node_pointer>(__nd->__right_); } else { __parent = static_cast<__parent_pointer>(__nd); return __nd->__right_; } } else { __parent = static_cast<__parent_pointer>(__nd); return *__nd_ptr; } } } __parent = static_cast<__parent_pointer>(__end_node()); return __parent->__left_; } template <class _Tp, class _Compare, class _Allocator> template <class _Key> typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint, __parent_pointer& __parent, __node_base_pointer& __dummy, const _Key& __v) { if (__hint == end() || value_comp()(__v, *__hint)) { const_iterator __prior = __hint; if (__prior == begin() || value_comp()(*--__prior, __v)) { if (__hint.__ptr_->__left_ == nullptr) { __parent = static_cast<__parent_pointer>(__hint.__ptr_); return __parent->__left_; } else { __parent = static_cast<__parent_pointer>(__prior.__ptr_); return static_cast<__node_base_pointer>(__prior.__ptr_)->__right_; } } return __find_equal(__parent, __v); } else if (value_comp()(*__hint, __v)) { const_iterator __next = std::__1::next(__hint); if (__next == end() || value_comp()(__v, *__next)) { if (__hint.__get_np()->__right_ == nullptr) { __parent = static_cast<__parent_pointer>(__hint.__ptr_); return static_cast<__node_base_pointer>(__hint.__ptr_)->__right_; } else { __parent = static_cast<__parent_pointer>(__next.__ptr_); return __parent->__left_; } } return __find_equal(__parent, __v); } __parent = static_cast<__parent_pointer>(__hint.__ptr_); __dummy = static_cast<__node_base_pointer>(__hint.__ptr_); return __dummy; } template <class _Tp, class _Compare, class _Allocator> void __tree<_Tp, _Compare, _Allocator>::__insert_node_at( __parent_pointer __parent, __node_base_pointer& __child, __node_base_pointer __new_node) noexcept { __new_node->__left_ = nullptr; __new_node->__right_ = nullptr; __new_node->__parent_ = __parent; __child = __new_node; if (__begin_node()->__left_ != nullptr) __begin_node() = static_cast<__iter_pointer>(__begin_node()->__left_); __tree_balance_after_insert(__end_node()->__left_, __child); ++size(); } template <class _Tp, class _Compare, class _Allocator> template <class _Key, class... _Args> pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool> __tree<_Tp, _Compare, _Allocator>::__emplace_unique_key_args(_Key const& __k, _Args&&... __args) { __parent_pointer __parent; __node_base_pointer& __child = __find_equal(__parent, __k); __node_pointer __r = static_cast<__node_pointer>(__child); bool __inserted = false; if (__child == nullptr) { __node_holder __h = __construct_node(std::__1::forward<_Args>(__args)...); __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get())); __r = __h.release(); __inserted = true; } return pair<iterator, bool>(iterator(__r), __inserted); } template <class _Tp, class _Compare, class _Allocator> template <class _Key, class... _Args> typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique_key_args( const_iterator __p, _Key const& __k, _Args&&... __args) { __parent_pointer __parent; __node_base_pointer __dummy; __node_base_pointer& __child = __find_equal(__p, __parent, __dummy, __k); __node_pointer __r = static_cast<__node_pointer>(__child); if (__child == nullptr) { __node_holder __h = __construct_node(std::__1::forward<_Args>(__args)...); __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get())); __r = __h.release(); } return iterator(__r); } template <class _Tp, class _Compare, class _Allocator> template <class ..._Args> typename __tree<_Tp, _Compare, _Allocator>::__node_holder __tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&& ...__args) { static_assert(!__is_tree_value_type<_Args...>::value, "Cannot construct from __value_type"); __node_allocator& __na = __node_alloc(); __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__value_), std::__1::forward<_Args>(__args)...); __h.get_deleter().__value_constructed = true; return __h; } template <class _Tp, class _Compare, class _Allocator> template <class... _Args> pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool> __tree<_Tp, _Compare, _Allocator>::__emplace_unique_impl(_Args&&... __args) { __node_holder __h = __construct_node(std::__1::forward<_Args>(__args)...); __parent_pointer __parent; __node_base_pointer& __child = __find_equal(__parent, __h->__value_); __node_pointer __r = static_cast<__node_pointer>(__child); bool __inserted = false; if (__child == nullptr) { __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get())); __r = __h.release(); __inserted = true; } return pair<iterator, bool>(iterator(__r), __inserted); } template <class _Tp, class _Compare, class _Allocator> template <class... _Args> typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique_impl(const_iterator __p, _Args&&... __args) { __node_holder __h = __construct_node(std::__1::forward<_Args>(__args)...); __parent_pointer __parent; __node_base_pointer __dummy; __node_base_pointer& __child = __find_equal(__p, __parent, __dummy, __h->__value_); __node_pointer __r = static_cast<__node_pointer>(__child); if (__child == nullptr) { __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get())); __r = __h.release(); } return iterator(__r); } template <class _Tp, class _Compare, class _Allocator> template <class... _Args> typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::__emplace_multi(_Args&&... __args) { __node_holder __h = __construct_node(std::__1::forward<_Args>(__args)...); __parent_pointer __parent; __node_base_pointer& __child = __find_leaf_high(__parent, _NodeTypes::__get_key(__h->__value_)); __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get())); return iterator(static_cast<__node_pointer>(__h.release())); } template <class _Tp, class _Compare, class _Allocator> template <class... _Args> typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p, _Args&&... __args) { __node_holder __h = __construct_node(std::__1::forward<_Args>(__args)...); __parent_pointer __parent; __node_base_pointer& __child = __find_leaf(__p, __parent, _NodeTypes::__get_key(__h->__value_)); __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get())); return iterator(static_cast<__node_pointer>(__h.release())); } template <class _Tp, class _Compare, class _Allocator> pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool> __tree<_Tp, _Compare, _Allocator>::__node_assign_unique(const __container_value_type& __v, __node_pointer __nd) { __parent_pointer __parent; __node_base_pointer& __child = __find_equal(__parent, _NodeTypes::__get_key(__v)); __node_pointer __r = static_cast<__node_pointer>(__child); bool __inserted = false; if (__child == nullptr) { __nd->__value_ = __v; __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd)); __r = __nd; __inserted = true; } return pair<iterator, bool>(iterator(__r), __inserted); } template <class _Tp, class _Compare, class _Allocator> typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::__node_insert_multi(__node_pointer __nd) { __parent_pointer __parent; __node_base_pointer& __child = __find_leaf_high(__parent, _NodeTypes::__get_key(__nd->__value_)); __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd)); return iterator(__nd); } template <class _Tp, class _Compare, class _Allocator> typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::__node_insert_multi(const_iterator __p, __node_pointer __nd) { __parent_pointer __parent; __node_base_pointer& __child = __find_leaf(__p, __parent, _NodeTypes::__get_key(__nd->__value_)); __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd)); return iterator(__nd); } template <class _Tp, class _Compare, class _Allocator> typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::__remove_node_pointer(__node_pointer __ptr) noexcept { iterator __r(__ptr); ++__r; if (__begin_node() == __ptr) __begin_node() = __r.__ptr_; --size(); __tree_remove(__end_node()->__left_, static_cast<__node_base_pointer>(__ptr)); return __r; } template <class _Tp, class _Compare, class _Allocator> typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p) { __node_pointer __np = __p.__get_np(); iterator __r = __remove_node_pointer(__np); __node_allocator& __na = __node_alloc(); __node_traits::destroy(__na, _NodeTypes::__get_ptr( const_cast<__node_value_type&>(*__p))); __node_traits::deallocate(__na, __np, 1); return __r; } template <class _Tp, class _Compare, class _Allocator> typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __f, const_iterator __l) { while (__f != __l) __f = erase(__f); return iterator(__l.__ptr_); } template <class _Tp, class _Compare, class _Allocator> template <class _Key> typename __tree<_Tp, _Compare, _Allocator>::size_type __tree<_Tp, _Compare, _Allocator>::__erase_unique(const _Key& __k) { iterator __i = find(__k); if (__i == end()) return 0; erase(__i); return 1; } template <class _Tp, class _Compare, class _Allocator> template <class _Key> typename __tree<_Tp, _Compare, _Allocator>::size_type __tree<_Tp, _Compare, _Allocator>::__erase_multi(const _Key& __k) { pair<iterator, iterator> __p = __equal_range_multi(__k); size_type __r = 0; for (; __p.first != __p.second; ++__r) __p.first = erase(__p.first); return __r; } template <class _Tp, class _Compare, class _Allocator> template <class _Key> typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::find(const _Key& __v) { iterator __p = __lower_bound(__v, __root(), __end_node()); if (__p != end() && !value_comp()(__v, *__p)) return __p; return end(); } template <class _Tp, class _Compare, class _Allocator> template <class _Key> typename __tree<_Tp, _Compare, _Allocator>::const_iterator __tree<_Tp, _Compare, _Allocator>::find(const _Key& __v) const { const_iterator __p = __lower_bound(__v, __root(), __end_node()); if (__p != end() && !value_comp()(__v, *__p)) return __p; return end(); } template <class _Tp, class _Compare, class _Allocator> template <class _Key> typename __tree<_Tp, _Compare, _Allocator>::size_type __tree<_Tp, _Compare, _Allocator>::__count_unique(const _Key& __k) const { __node_pointer __rt = __root(); while (__rt != nullptr) { if (value_comp()(__k, __rt->__value_)) { __rt = static_cast<__node_pointer>(__rt->__left_); } else if (value_comp()(__rt->__value_, __k)) __rt = static_cast<__node_pointer>(__rt->__right_); else return 1; } return 0; } template <class _Tp, class _Compare, class _Allocator> template <class _Key> typename __tree<_Tp, _Compare, _Allocator>::size_type __tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const { __iter_pointer __result = __end_node(); __node_pointer __rt = __root(); while (__rt != nullptr) { if (value_comp()(__k, __rt->__value_)) { __result = static_cast<__iter_pointer>(__rt); __rt = static_cast<__node_pointer>(__rt->__left_); } else if (value_comp()(__rt->__value_, __k)) __rt = static_cast<__node_pointer>(__rt->__right_); else return std::__1::distance( __lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__iter_pointer>(__rt)), __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result) ); } return 0; } template <class _Tp, class _Compare, class _Allocator> template <class _Key> typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::__lower_bound(const _Key& __v, __node_pointer __root, __iter_pointer __result) { while (__root != nullptr) { if (!value_comp()(__root->__value_, __v)) { __result = static_cast<__iter_pointer>(__root); __root = static_cast<__node_pointer>(__root->__left_); } else __root = static_cast<__node_pointer>(__root->__right_); } return iterator(__result); } template <class _Tp, class _Compare, class _Allocator> template <class _Key> typename __tree<_Tp, _Compare, _Allocator>::const_iterator __tree<_Tp, _Compare, _Allocator>::__lower_bound(const _Key& __v, __node_pointer __root, __iter_pointer __result) const { while (__root != nullptr) { if (!value_comp()(__root->__value_, __v)) { __result = static_cast<__iter_pointer>(__root); __root = static_cast<__node_pointer>(__root->__left_); } else __root = static_cast<__node_pointer>(__root->__right_); } return const_iterator(__result); } template <class _Tp, class _Compare, class _Allocator> template <class _Key> typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::__upper_bound(const _Key& __v, __node_pointer __root, __iter_pointer __result) { while (__root != nullptr) { if (value_comp()(__v, __root->__value_)) { __result = static_cast<__iter_pointer>(__root); __root = static_cast<__node_pointer>(__root->__left_); } else __root = static_cast<__node_pointer>(__root->__right_); } return iterator(__result); } template <class _Tp, class _Compare, class _Allocator> template <class _Key> typename __tree<_Tp, _Compare, _Allocator>::const_iterator __tree<_Tp, _Compare, _Allocator>::__upper_bound(const _Key& __v, __node_pointer __root, __iter_pointer __result) const { while (__root != nullptr) { if (value_comp()(__v, __root->__value_)) { __result = static_cast<__iter_pointer>(__root); __root = static_cast<__node_pointer>(__root->__left_); } else __root = static_cast<__node_pointer>(__root->__right_); } return const_iterator(__result); } template <class _Tp, class _Compare, class _Allocator> template <class _Key> pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, typename __tree<_Tp, _Compare, _Allocator>::iterator> __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) { typedef pair<iterator, iterator> _Pp; __iter_pointer __result = __end_node(); __node_pointer __rt = __root(); while (__rt != nullptr) { if (value_comp()(__k, __rt->__value_)) { __result = static_cast<__iter_pointer>(__rt); __rt = static_cast<__node_pointer>(__rt->__left_); } else if (value_comp()(__rt->__value_, __k)) __rt = static_cast<__node_pointer>(__rt->__right_); else return _Pp(iterator(__rt), iterator( __rt->__right_ != nullptr ? static_cast<__iter_pointer>(__tree_min(__rt->__right_)) : __result)); } return _Pp(iterator(__result), iterator(__result)); } template <class _Tp, class _Compare, class _Allocator> template <class _Key> pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator, typename __tree<_Tp, _Compare, _Allocator>::const_iterator> __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const { typedef pair<const_iterator, const_iterator> _Pp; __iter_pointer __result = __end_node(); __node_pointer __rt = __root(); while (__rt != nullptr) { if (value_comp()(__k, __rt->__value_)) { __result = static_cast<__iter_pointer>(__rt); __rt = static_cast<__node_pointer>(__rt->__left_); } else if (value_comp()(__rt->__value_, __k)) __rt = static_cast<__node_pointer>(__rt->__right_); else return _Pp(const_iterator(__rt), const_iterator( __rt->__right_ != nullptr ? static_cast<__iter_pointer>(__tree_min(__rt->__right_)) : __result)); } return _Pp(const_iterator(__result), const_iterator(__result)); } template <class _Tp, class _Compare, class _Allocator> template <class _Key> pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, typename __tree<_Tp, _Compare, _Allocator>::iterator> __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) { typedef pair<iterator, iterator> _Pp; __iter_pointer __result = __end_node(); __node_pointer __rt = __root(); while (__rt != nullptr) { if (value_comp()(__k, __rt->__value_)) { __result = static_cast<__iter_pointer>(__rt); __rt = static_cast<__node_pointer>(__rt->__left_); } else if (value_comp()(__rt->__value_, __k)) __rt = static_cast<__node_pointer>(__rt->__right_); else return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__iter_pointer>(__rt)), __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result)); } return _Pp(iterator(__result), iterator(__result)); } template <class _Tp, class _Compare, class _Allocator> template <class _Key> pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator, typename __tree<_Tp, _Compare, _Allocator>::const_iterator> __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const { typedef pair<const_iterator, const_iterator> _Pp; __iter_pointer __result = __end_node(); __node_pointer __rt = __root(); while (__rt != nullptr) { if (value_comp()(__k, __rt->__value_)) { __result = static_cast<__iter_pointer>(__rt); __rt = static_cast<__node_pointer>(__rt->__left_); } else if (value_comp()(__rt->__value_, __k)) __rt = static_cast<__node_pointer>(__rt->__right_); else return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), static_cast<__iter_pointer>(__rt)), __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result)); } return _Pp(const_iterator(__result), const_iterator(__result)); } template <class _Tp, class _Compare, class _Allocator> typename __tree<_Tp, _Compare, _Allocator>::__node_holder __tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) noexcept { __node_pointer __np = __p.__get_np(); if (__begin_node() == __p.__ptr_) { if (__np->__right_ != nullptr) __begin_node() = static_cast<__iter_pointer>(__np->__right_); else __begin_node() = static_cast<__iter_pointer>(__np->__parent_); } --size(); __tree_remove(__end_node()->__left_, static_cast<__node_base_pointer>(__np)); return __node_holder(__np, _Dp(__node_alloc(), true)); } template <class _Tp, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(__tree<_Tp, _Compare, _Allocator>& __x, __tree<_Tp, _Compare, _Allocator>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } } } namespace std { class bad_optional_access : public exception { public: virtual ~bad_optional_access() noexcept; virtual const char* what() const noexcept; }; } namespace std { inline namespace __1 { } } namespace std { inline namespace __1 { template <class _Key, class _CP, class _Compare, bool = is_empty<_Compare>::value && !__libcpp_is_final<_Compare>::value> class __map_value_compare : private _Compare { public: __attribute__ ((__exclude_from_explicit_instantiation__)) __map_value_compare() noexcept(is_nothrow_default_constructible<_Compare>::value) : _Compare() {} __attribute__ ((__exclude_from_explicit_instantiation__)) __map_value_compare(_Compare c) noexcept(is_nothrow_copy_constructible<_Compare>::value) : _Compare(c) {} __attribute__ ((__exclude_from_explicit_instantiation__)) const _Compare& key_comp() const noexcept {return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const _CP& __x, const _CP& __y) const {return static_cast<const _Compare&>(*this)(__x.__get_value().first, __y.__get_value().first);} __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const _CP& __x, const _Key& __y) const {return static_cast<const _Compare&>(*this)(__x.__get_value().first, __y);} __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const _Key& __x, const _CP& __y) const {return static_cast<const _Compare&>(*this)(__x, __y.__get_value().first);} void swap(__map_value_compare&__y) noexcept(__is_nothrow_swappable<_Compare>::value) { using std::__1::swap; swap(static_cast<_Compare&>(*this), static_cast<_Compare&>(__y)); } template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type operator () ( const _K2& __x, const _CP& __y ) const {return static_cast<const _Compare&>(*this) (__x, __y.__get_value().first);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type operator () (const _CP& __x, const _K2& __y) const {return static_cast<const _Compare&>(*this) (__x.__get_value().first, __y);} }; template <class _Key, class _CP, class _Compare> class __map_value_compare<_Key, _CP, _Compare, false> { _Compare comp; public: __attribute__ ((__exclude_from_explicit_instantiation__)) __map_value_compare() noexcept(is_nothrow_default_constructible<_Compare>::value) : comp() {} __attribute__ ((__exclude_from_explicit_instantiation__)) __map_value_compare(_Compare c) noexcept(is_nothrow_copy_constructible<_Compare>::value) : comp(c) {} __attribute__ ((__exclude_from_explicit_instantiation__)) const _Compare& key_comp() const noexcept {return comp;} __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const _CP& __x, const _CP& __y) const {return comp(__x.__get_value().first, __y.__get_value().first);} __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const _CP& __x, const _Key& __y) const {return comp(__x.__get_value().first, __y);} __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const _Key& __x, const _CP& __y) const {return comp(__x, __y.__get_value().first);} void swap(__map_value_compare&__y) noexcept(__is_nothrow_swappable<_Compare>::value) { using std::__1::swap; swap(comp, __y.comp); } template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type operator () ( const _K2& __x, const _CP& __y ) const {return comp (__x, __y.__get_value().first);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type operator () (const _CP& __x, const _K2& __y) const {return comp (__x.__get_value().first, __y);} }; template <class _Key, class _CP, class _Compare, bool __b> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(__map_value_compare<_Key, _CP, _Compare, __b>& __x, __map_value_compare<_Key, _CP, _Compare, __b>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } template <class _Allocator> class __map_node_destructor { typedef _Allocator allocator_type; typedef allocator_traits<allocator_type> __alloc_traits; public: typedef typename __alloc_traits::pointer pointer; private: allocator_type& __na_; __map_node_destructor& operator=(const __map_node_destructor&); public: bool __first_constructed; bool __second_constructed; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __map_node_destructor(allocator_type& __na) noexcept : __na_(__na), __first_constructed(false), __second_constructed(false) {} __attribute__ ((__exclude_from_explicit_instantiation__)) __map_node_destructor(__tree_node_destructor<allocator_type>&& __x) noexcept : __na_(__x.__na_), __first_constructed(__x.__value_constructed), __second_constructed(__x.__value_constructed) { __x.__value_constructed = false; } __attribute__ ((__exclude_from_explicit_instantiation__)) void operator()(pointer __p) noexcept { if (__second_constructed) __alloc_traits::destroy(__na_, std::__1::addressof(__p->__value_.__get_value().second)); if (__first_constructed) __alloc_traits::destroy(__na_, std::__1::addressof(__p->__value_.__get_value().first)); if (__p) __alloc_traits::deallocate(__na_, __p, 1); } }; template <class _Key, class _Tp, class _Compare, class _Allocator> class map; template <class _Key, class _Tp, class _Compare, class _Allocator> class multimap; template <class _TreeIterator> class __map_const_iterator; template <class _Key, class _Tp> struct __value_type { typedef _Key key_type; typedef _Tp mapped_type; typedef pair<const key_type, mapped_type> value_type; typedef pair<key_type&, mapped_type&> __nc_ref_pair_type; typedef pair<key_type&&, mapped_type&&> __nc_rref_pair_type; private: value_type __cc; public: __attribute__ ((__exclude_from_explicit_instantiation__)) value_type& __get_value() { return __cc; } __attribute__ ((__exclude_from_explicit_instantiation__)) const value_type& __get_value() const { return __cc; } __attribute__ ((__exclude_from_explicit_instantiation__)) __nc_ref_pair_type __ref() { value_type& __v = __get_value(); return __nc_ref_pair_type(const_cast<key_type&>(__v.first), __v.second); } __attribute__ ((__exclude_from_explicit_instantiation__)) __nc_rref_pair_type __move() { value_type& __v = __get_value(); return __nc_rref_pair_type( std::__1::move(const_cast<key_type&>(__v.first)), std::__1::move(__v.second)); } __attribute__ ((__exclude_from_explicit_instantiation__)) __value_type& operator=(const __value_type& __v) { __ref() = __v.__get_value(); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __value_type& operator=(__value_type&& __v) { __ref() = __v.__move(); return *this; } template <class _ValueTp, class = typename enable_if< __is_same_uncvref<_ValueTp, value_type>::value >::type > __attribute__ ((__exclude_from_explicit_instantiation__)) __value_type& operator=(_ValueTp&& __v) { __ref() = std::__1::forward<_ValueTp>(__v); return *this; } private: __value_type() = delete; ~__value_type() = delete; __value_type(const __value_type& __v) = delete; __value_type(__value_type&& __v) = delete; }; template <class _Tp> struct __extract_key_value_types; template <class _Key, class _Tp> struct __extract_key_value_types<__value_type<_Key, _Tp> > { typedef _Key const __key_type; typedef _Tp __mapped_type; }; template <class _TreeIterator> class __map_iterator { typedef typename _TreeIterator::_NodeTypes _NodeTypes; typedef typename _TreeIterator::__pointer_traits __pointer_traits; _TreeIterator __i_; public: typedef bidirectional_iterator_tag iterator_category; typedef typename _NodeTypes::__map_value_type value_type; typedef typename _TreeIterator::difference_type difference_type; typedef value_type& reference; typedef typename _NodeTypes::__map_value_type_pointer pointer; __attribute__ ((__exclude_from_explicit_instantiation__)) __map_iterator() noexcept {} __attribute__ ((__exclude_from_explicit_instantiation__)) __map_iterator(_TreeIterator __i) noexcept : __i_(__i) {} __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator*() const {return __i_->__get_value();} __attribute__ ((__exclude_from_explicit_instantiation__)) pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__get_value());} __attribute__ ((__exclude_from_explicit_instantiation__)) __map_iterator& operator++() {++__i_; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) __map_iterator operator++(int) { __map_iterator __t(*this); ++(*this); return __t; } __attribute__ ((__exclude_from_explicit_instantiation__)) __map_iterator& operator--() {--__i_; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) __map_iterator operator--(int) { __map_iterator __t(*this); --(*this); return __t; } friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const __map_iterator& __x, const __map_iterator& __y) {return __x.__i_ == __y.__i_;} friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const __map_iterator& __x, const __map_iterator& __y) {return __x.__i_ != __y.__i_;} template <class, class, class, class> friend class map; template <class, class, class, class> friend class multimap; template <class> friend class __map_const_iterator; }; template <class _TreeIterator> class __map_const_iterator { typedef typename _TreeIterator::_NodeTypes _NodeTypes; typedef typename _TreeIterator::__pointer_traits __pointer_traits; _TreeIterator __i_; public: typedef bidirectional_iterator_tag iterator_category; typedef typename _NodeTypes::__map_value_type value_type; typedef typename _TreeIterator::difference_type difference_type; typedef const value_type& reference; typedef typename _NodeTypes::__const_map_value_type_pointer pointer; __attribute__ ((__exclude_from_explicit_instantiation__)) __map_const_iterator() noexcept {} __attribute__ ((__exclude_from_explicit_instantiation__)) __map_const_iterator(_TreeIterator __i) noexcept : __i_(__i) {} __attribute__ ((__exclude_from_explicit_instantiation__)) __map_const_iterator(__map_iterator< typename _TreeIterator::__non_const_iterator> __i) noexcept : __i_(__i.__i_) {} __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator*() const {return __i_->__get_value();} __attribute__ ((__exclude_from_explicit_instantiation__)) pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__get_value());} __attribute__ ((__exclude_from_explicit_instantiation__)) __map_const_iterator& operator++() {++__i_; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) __map_const_iterator operator++(int) { __map_const_iterator __t(*this); ++(*this); return __t; } __attribute__ ((__exclude_from_explicit_instantiation__)) __map_const_iterator& operator--() {--__i_; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) __map_const_iterator operator--(int) { __map_const_iterator __t(*this); --(*this); return __t; } friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const __map_const_iterator& __x, const __map_const_iterator& __y) {return __x.__i_ == __y.__i_;} friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const __map_const_iterator& __x, const __map_const_iterator& __y) {return __x.__i_ != __y.__i_;} template <class, class, class, class> friend class map; template <class, class, class, class> friend class multimap; template <class, class, class> friend class __tree_const_iterator; }; template <class _Key, class _Tp, class _Compare = less<_Key>, class _Allocator = allocator<pair<const _Key, _Tp> > > class map { public: typedef _Key key_type; typedef _Tp mapped_type; typedef pair<const key_type, mapped_type> value_type; typedef typename __identity<_Compare>::type key_compare; typedef typename __identity<_Allocator>::type allocator_type; typedef value_type& reference; typedef const value_type& const_reference; static_assert((is_same<typename allocator_type::value_type, value_type>::value), "Allocator::value_type must be same type as value_type"); class value_compare : public binary_function<value_type, value_type, bool> { friend class map; protected: key_compare comp; __attribute__ ((__exclude_from_explicit_instantiation__)) value_compare(key_compare c) : comp(c) {} public: __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const value_type& __x, const value_type& __y) const {return comp(__x.first, __y.first);} }; private: typedef std::__1::__value_type<key_type, mapped_type> __value_type; typedef __map_value_compare<key_type, __value_type, key_compare> __vc; typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __value_type>::type __allocator_type; typedef __tree<__value_type, __vc, __allocator_type> __base; typedef typename __base::__node_traits __node_traits; typedef allocator_traits<allocator_type> __alloc_traits; __base __tree_; public: typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::const_pointer const_pointer; typedef typename __alloc_traits::size_type size_type; typedef typename __alloc_traits::difference_type difference_type; typedef __map_iterator<typename __base::iterator> iterator; typedef __map_const_iterator<typename __base::const_iterator> const_iterator; typedef std::__1::reverse_iterator<iterator> reverse_iterator; typedef std::__1::reverse_iterator<const_iterator> const_reverse_iterator; template <class _Key2, class _Value2, class _Comp2, class _Alloc2> friend class map; template <class _Key2, class _Value2, class _Comp2, class _Alloc2> friend class multimap; __attribute__ ((__exclude_from_explicit_instantiation__)) map() noexcept(is_nothrow_default_constructible<allocator_type>::value && is_nothrow_default_constructible<key_compare>::value && is_nothrow_copy_constructible<key_compare>::value) : __tree_(__vc(key_compare())) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit map(const key_compare& __comp) noexcept(is_nothrow_default_constructible<allocator_type>::value && is_nothrow_copy_constructible<key_compare>::value) : __tree_(__vc(__comp)) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit map(const key_compare& __comp, const allocator_type& __a) : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {} template <class _InputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) map(_InputIterator __f, _InputIterator __l, const key_compare& __comp = key_compare()) : __tree_(__vc(__comp)) { insert(__f, __l); } template <class _InputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) map(_InputIterator __f, _InputIterator __l, const key_compare& __comp, const allocator_type& __a) : __tree_(__vc(__comp), typename __base::allocator_type(__a)) { insert(__f, __l); } template <class _InputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) map(_InputIterator __f, _InputIterator __l, const allocator_type& __a) : map(__f, __l, key_compare(), __a) {} __attribute__ ((__exclude_from_explicit_instantiation__)) map(const map& __m) : __tree_(__m.__tree_) { insert(__m.begin(), __m.end()); } __attribute__ ((__exclude_from_explicit_instantiation__)) map& operator=(const map& __m) { __tree_ = __m.__tree_; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) map(map&& __m) noexcept(is_nothrow_move_constructible<__base>::value) : __tree_(std::__1::move(__m.__tree_)) { } map(map&& __m, const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) map& operator=(map&& __m) noexcept(is_nothrow_move_assignable<__base>::value) { __tree_ = std::__1::move(__m.__tree_); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) map(initializer_list<value_type> __il, const key_compare& __comp = key_compare()) : __tree_(__vc(__comp)) { insert(__il.begin(), __il.end()); } __attribute__ ((__exclude_from_explicit_instantiation__)) map(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a) : __tree_(__vc(__comp), typename __base::allocator_type(__a)) { insert(__il.begin(), __il.end()); } __attribute__ ((__exclude_from_explicit_instantiation__)) map(initializer_list<value_type> __il, const allocator_type& __a) : map(__il, key_compare(), __a) {} __attribute__ ((__exclude_from_explicit_instantiation__)) map& operator=(initializer_list<value_type> __il) { __tree_.__assign_unique(__il.begin(), __il.end()); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) explicit map(const allocator_type& __a) : __tree_(typename __base::allocator_type(__a)) { } __attribute__ ((__exclude_from_explicit_instantiation__)) map(const map& __m, const allocator_type& __a) : __tree_(__m.__tree_.value_comp(), typename __base::allocator_type(__a)) { insert(__m.begin(), __m.end()); } __attribute__ ((__exclude_from_explicit_instantiation__)) ~map() { static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); } __attribute__ ((__exclude_from_explicit_instantiation__)) iterator begin() noexcept {return __tree_.begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator begin() const noexcept {return __tree_.begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator end() noexcept {return __tree_.end();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator end() const noexcept {return __tree_.end();} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator rbegin() noexcept {return reverse_iterator(end());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator rbegin() const noexcept {return const_reverse_iterator(end());} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator rend() noexcept {return reverse_iterator(begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator rend() const noexcept {return const_reverse_iterator(begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cbegin() const noexcept {return begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cend() const noexcept {return end();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator crbegin() const noexcept {return rbegin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator crend() const noexcept {return rend();} [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) bool empty() const noexcept {return __tree_.size() == 0;} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type size() const noexcept {return __tree_.size();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type max_size() const noexcept {return __tree_.max_size();} mapped_type& operator[](const key_type& __k); mapped_type& operator[](key_type&& __k); mapped_type& at(const key_type& __k); const mapped_type& at(const key_type& __k) const; __attribute__ ((__exclude_from_explicit_instantiation__)) allocator_type get_allocator() const noexcept {return allocator_type(__tree_.__alloc());} __attribute__ ((__exclude_from_explicit_instantiation__)) key_compare key_comp() const {return __tree_.value_comp().key_comp();} __attribute__ ((__exclude_from_explicit_instantiation__)) value_compare value_comp() const {return value_compare(__tree_.value_comp().key_comp());} template <class ..._Args> __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> emplace(_Args&& ...__args) { return __tree_.__emplace_unique(std::__1::forward<_Args>(__args)...); } template <class ..._Args> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator emplace_hint(const_iterator __p, _Args&& ...__args) { return __tree_.__emplace_hint_unique(__p.__i_, std::__1::forward<_Args>(__args)...); } template <class _Pp, class = typename enable_if<is_constructible<value_type, _Pp>::value>::type> __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> insert(_Pp&& __p) {return __tree_.__insert_unique(std::__1::forward<_Pp>(__p));} template <class _Pp, class = typename enable_if<is_constructible<value_type, _Pp>::value>::type> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const_iterator __pos, _Pp&& __p) {return __tree_.__insert_unique(__pos.__i_, std::__1::forward<_Pp>(__p));} __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> insert(const value_type& __v) {return __tree_.__insert_unique(__v);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const_iterator __p, const value_type& __v) {return __tree_.__insert_unique(__p.__i_, __v);} __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> insert(value_type&& __v) {return __tree_.__insert_unique(std::__1::move(__v));} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const_iterator __p, value_type&& __v) {return __tree_.__insert_unique(__p.__i_, std::__1::move(__v));} __attribute__ ((__exclude_from_explicit_instantiation__)) void insert(initializer_list<value_type> __il) {insert(__il.begin(), __il.end());} template <class _InputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) void insert(_InputIterator __f, _InputIterator __l) { for (const_iterator __e = cend(); __f != __l; ++__f) insert(__e.__i_, *__f); } __attribute__ ((__exclude_from_explicit_instantiation__)) iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator erase(iterator __p) {return __tree_.erase(__p.__i_);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type erase(const key_type& __k) {return __tree_.__erase_unique(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator erase(const_iterator __f, const_iterator __l) {return __tree_.erase(__f.__i_, __l.__i_);} __attribute__ ((__exclude_from_explicit_instantiation__)) void clear() noexcept {__tree_.clear();} __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(map& __m) noexcept(__is_nothrow_swappable<__base>::value) {__tree_.swap(__m.__tree_);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator find(const key_type& __k) {return __tree_.find(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator find(const key_type& __k) const {return __tree_.find(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type find(const _K2& __k) {return __tree_.find(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type find(const _K2& __k) const {return __tree_.find(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type count(const key_type& __k) const {return __tree_.__count_unique(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type count(const _K2& __k) const {return __tree_.__count_multi(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator lower_bound(const key_type& __k) {return __tree_.lower_bound(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator lower_bound(const key_type& __k) const {return __tree_.lower_bound(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator upper_bound(const key_type& __k) {return __tree_.upper_bound(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator upper_bound(const key_type& __k) const {return __tree_.upper_bound(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator,iterator> equal_range(const key_type& __k) {return __tree_.__equal_range_unique(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) pair<const_iterator,const_iterator> equal_range(const key_type& __k) const {return __tree_.__equal_range_unique(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);} private: typedef typename __base::__node __node; typedef typename __base::__node_allocator __node_allocator; typedef typename __base::__node_pointer __node_pointer; typedef typename __base::__node_base_pointer __node_base_pointer; typedef typename __base::__parent_pointer __parent_pointer; typedef __map_node_destructor<__node_allocator> _Dp; typedef unique_ptr<__node, _Dp> __node_holder; }; template <class _Key, class _Tp, class _Compare, class _Allocator> map<_Key, _Tp, _Compare, _Allocator>::map(map&& __m, const allocator_type& __a) : __tree_(std::__1::move(__m.__tree_), typename __base::allocator_type(__a)) { if (__a != __m.get_allocator()) { const_iterator __e = cend(); while (!__m.empty()) __tree_.__insert_unique(__e.__i_, __m.__tree_.remove(__m.begin().__i_)->__value_.__move()); } } template <class _Key, class _Tp, class _Compare, class _Allocator> _Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) { return __tree_.__emplace_unique_key_args(__k, std::__1::piecewise_construct, std::__1::forward_as_tuple(__k), std::__1::forward_as_tuple()).first->__get_value().second; } template <class _Key, class _Tp, class _Compare, class _Allocator> _Tp& map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k) { return __tree_.__emplace_unique_key_args(__k, std::__1::piecewise_construct, std::__1::forward_as_tuple(std::__1::move(__k)), std::__1::forward_as_tuple()).first->__get_value().second; } template <class _Key, class _Tp, class _Compare, class _Allocator> _Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) { __parent_pointer __parent; __node_base_pointer& __child = __tree_.__find_equal(__parent, __k); if (__child == nullptr) __throw_out_of_range("map::at: key not found"); return static_cast<__node_pointer>(__child)->__value_.__get_value().second; } template <class _Key, class _Tp, class _Compare, class _Allocator> const _Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const { __parent_pointer __parent; __node_base_pointer __child = __tree_.__find_equal(__parent, __k); if (__child == nullptr) __throw_out_of_range("map::at: key not found"); return static_cast<__node_pointer>(__child)->__value_.__get_value().second; } template <class _Key, class _Tp, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) { return __x.size() == __y.size() && std::__1::equal(__x.begin(), __x.end(), __y.begin()); } template <class _Key, class _Tp, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator< (const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) { return std::__1::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); } template <class _Key, class _Tp, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) { return !(__x == __y); } template <class _Key, class _Tp, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator> (const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) { return __y < __x; } template <class _Key, class _Tp, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) { return !(__x < __y); } template <class _Key, class _Tp, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x, const map<_Key, _Tp, _Compare, _Allocator>& __y) { return !(__y < __x); } template <class _Key, class _Tp, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(map<_Key, _Tp, _Compare, _Allocator>& __x, map<_Key, _Tp, _Compare, _Allocator>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } template <class _Key, class _Tp, class _Compare = less<_Key>, class _Allocator = allocator<pair<const _Key, _Tp> > > class multimap { public: typedef _Key key_type; typedef _Tp mapped_type; typedef pair<const key_type, mapped_type> value_type; typedef typename __identity<_Compare>::type key_compare; typedef typename __identity<_Allocator>::type allocator_type; typedef value_type& reference; typedef const value_type& const_reference; static_assert((is_same<typename allocator_type::value_type, value_type>::value), "Allocator::value_type must be same type as value_type"); class value_compare : public binary_function<value_type, value_type, bool> { friend class multimap; protected: key_compare comp; __attribute__ ((__exclude_from_explicit_instantiation__)) value_compare(key_compare c) : comp(c) {} public: __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const value_type& __x, const value_type& __y) const {return comp(__x.first, __y.first);} }; private: typedef std::__1::__value_type<key_type, mapped_type> __value_type; typedef __map_value_compare<key_type, __value_type, key_compare> __vc; typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __value_type>::type __allocator_type; typedef __tree<__value_type, __vc, __allocator_type> __base; typedef typename __base::__node_traits __node_traits; typedef allocator_traits<allocator_type> __alloc_traits; __base __tree_; public: typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::const_pointer const_pointer; typedef typename __alloc_traits::size_type size_type; typedef typename __alloc_traits::difference_type difference_type; typedef __map_iterator<typename __base::iterator> iterator; typedef __map_const_iterator<typename __base::const_iterator> const_iterator; typedef std::__1::reverse_iterator<iterator> reverse_iterator; typedef std::__1::reverse_iterator<const_iterator> const_reverse_iterator; template <class _Key2, class _Value2, class _Comp2, class _Alloc2> friend class map; template <class _Key2, class _Value2, class _Comp2, class _Alloc2> friend class multimap; __attribute__ ((__exclude_from_explicit_instantiation__)) multimap() noexcept(is_nothrow_default_constructible<allocator_type>::value && is_nothrow_default_constructible<key_compare>::value && is_nothrow_copy_constructible<key_compare>::value) : __tree_(__vc(key_compare())) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit multimap(const key_compare& __comp) noexcept(is_nothrow_default_constructible<allocator_type>::value && is_nothrow_copy_constructible<key_compare>::value) : __tree_(__vc(__comp)) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit multimap(const key_compare& __comp, const allocator_type& __a) : __tree_(__vc(__comp), typename __base::allocator_type(__a)) {} template <class _InputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) multimap(_InputIterator __f, _InputIterator __l, const key_compare& __comp = key_compare()) : __tree_(__vc(__comp)) { insert(__f, __l); } template <class _InputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) multimap(_InputIterator __f, _InputIterator __l, const key_compare& __comp, const allocator_type& __a) : __tree_(__vc(__comp), typename __base::allocator_type(__a)) { insert(__f, __l); } template <class _InputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) multimap(_InputIterator __f, _InputIterator __l, const allocator_type& __a) : multimap(__f, __l, key_compare(), __a) {} __attribute__ ((__exclude_from_explicit_instantiation__)) multimap(const multimap& __m) : __tree_(__m.__tree_.value_comp(), __alloc_traits::select_on_container_copy_construction(__m.__tree_.__alloc())) { insert(__m.begin(), __m.end()); } __attribute__ ((__exclude_from_explicit_instantiation__)) multimap& operator=(const multimap& __m) { __tree_ = __m.__tree_; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) multimap(multimap&& __m) noexcept(is_nothrow_move_constructible<__base>::value) : __tree_(std::__1::move(__m.__tree_)) { } multimap(multimap&& __m, const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) multimap& operator=(multimap&& __m) noexcept(is_nothrow_move_assignable<__base>::value) { __tree_ = std::__1::move(__m.__tree_); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare()) : __tree_(__vc(__comp)) { insert(__il.begin(), __il.end()); } __attribute__ ((__exclude_from_explicit_instantiation__)) multimap(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a) : __tree_(__vc(__comp), typename __base::allocator_type(__a)) { insert(__il.begin(), __il.end()); } __attribute__ ((__exclude_from_explicit_instantiation__)) multimap(initializer_list<value_type> __il, const allocator_type& __a) : multimap(__il, key_compare(), __a) {} __attribute__ ((__exclude_from_explicit_instantiation__)) multimap& operator=(initializer_list<value_type> __il) { __tree_.__assign_multi(__il.begin(), __il.end()); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) explicit multimap(const allocator_type& __a) : __tree_(typename __base::allocator_type(__a)) { } __attribute__ ((__exclude_from_explicit_instantiation__)) multimap(const multimap& __m, const allocator_type& __a) : __tree_(__m.__tree_.value_comp(), typename __base::allocator_type(__a)) { insert(__m.begin(), __m.end()); } __attribute__ ((__exclude_from_explicit_instantiation__)) ~multimap() { static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); } __attribute__ ((__exclude_from_explicit_instantiation__)) iterator begin() noexcept {return __tree_.begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator begin() const noexcept {return __tree_.begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator end() noexcept {return __tree_.end();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator end() const noexcept {return __tree_.end();} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator rbegin() noexcept {return reverse_iterator(end());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator rbegin() const noexcept {return const_reverse_iterator(end());} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator rend() noexcept {return reverse_iterator(begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator rend() const noexcept {return const_reverse_iterator(begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cbegin() const noexcept {return begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cend() const noexcept {return end();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator crbegin() const noexcept {return rbegin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator crend() const noexcept {return rend();} [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) bool empty() const noexcept {return __tree_.size() == 0;} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type size() const noexcept {return __tree_.size();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type max_size() const noexcept {return __tree_.max_size();} __attribute__ ((__exclude_from_explicit_instantiation__)) allocator_type get_allocator() const noexcept {return allocator_type(__tree_.__alloc());} __attribute__ ((__exclude_from_explicit_instantiation__)) key_compare key_comp() const {return __tree_.value_comp().key_comp();} __attribute__ ((__exclude_from_explicit_instantiation__)) value_compare value_comp() const {return value_compare(__tree_.value_comp().key_comp());} template <class ..._Args> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator emplace(_Args&& ...__args) { return __tree_.__emplace_multi(std::__1::forward<_Args>(__args)...); } template <class ..._Args> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator emplace_hint(const_iterator __p, _Args&& ...__args) { return __tree_.__emplace_hint_multi(__p.__i_, std::__1::forward<_Args>(__args)...); } template <class _Pp, class = typename enable_if<is_constructible<value_type, _Pp>::value>::type> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(_Pp&& __p) {return __tree_.__insert_multi(std::__1::forward<_Pp>(__p));} template <class _Pp, class = typename enable_if<is_constructible<value_type, _Pp>::value>::type> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const_iterator __pos, _Pp&& __p) {return __tree_.__insert_multi(__pos.__i_, std::__1::forward<_Pp>(__p));} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(value_type&& __v) {return __tree_.__insert_multi(std::__1::move(__v));} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const_iterator __p, value_type&& __v) {return __tree_.__insert_multi(__p.__i_, std::__1::move(__v));} __attribute__ ((__exclude_from_explicit_instantiation__)) void insert(initializer_list<value_type> __il) {insert(__il.begin(), __il.end());} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const value_type& __v) {return __tree_.__insert_multi(__v);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const_iterator __p, const value_type& __v) {return __tree_.__insert_multi(__p.__i_, __v);} template <class _InputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) void insert(_InputIterator __f, _InputIterator __l) { for (const_iterator __e = cend(); __f != __l; ++__f) __tree_.__insert_multi(__e.__i_, *__f); } __attribute__ ((__exclude_from_explicit_instantiation__)) iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator erase(iterator __p) {return __tree_.erase(__p.__i_);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator erase(const_iterator __f, const_iterator __l) {return __tree_.erase(__f.__i_, __l.__i_);} __attribute__ ((__exclude_from_explicit_instantiation__)) void clear() noexcept {__tree_.clear();} __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(multimap& __m) noexcept(__is_nothrow_swappable<__base>::value) {__tree_.swap(__m.__tree_);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator find(const key_type& __k) {return __tree_.find(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator find(const key_type& __k) const {return __tree_.find(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type find(const _K2& __k) {return __tree_.find(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type find(const _K2& __k) const {return __tree_.find(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type count(const key_type& __k) const {return __tree_.__count_multi(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type count(const _K2& __k) const {return __tree_.__count_multi(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator lower_bound(const key_type& __k) {return __tree_.lower_bound(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator lower_bound(const key_type& __k) const {return __tree_.lower_bound(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator upper_bound(const key_type& __k) {return __tree_.upper_bound(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator upper_bound(const key_type& __k) const {return __tree_.upper_bound(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator,iterator> equal_range(const key_type& __k) {return __tree_.__equal_range_multi(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) pair<const_iterator,const_iterator> equal_range(const key_type& __k) const {return __tree_.__equal_range_multi(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);} private: typedef typename __base::__node __node; typedef typename __base::__node_allocator __node_allocator; typedef typename __base::__node_pointer __node_pointer; typedef __map_node_destructor<__node_allocator> _Dp; typedef unique_ptr<__node, _Dp> __node_holder; }; template <class _Key, class _Tp, class _Compare, class _Allocator> multimap<_Key, _Tp, _Compare, _Allocator>::multimap(multimap&& __m, const allocator_type& __a) : __tree_(std::__1::move(__m.__tree_), typename __base::allocator_type(__a)) { if (__a != __m.get_allocator()) { const_iterator __e = cend(); while (!__m.empty()) __tree_.__insert_multi(__e.__i_, std::__1::move(__m.__tree_.remove(__m.begin().__i_)->__value_.__move())); } } template <class _Key, class _Tp, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) { return __x.size() == __y.size() && std::__1::equal(__x.begin(), __x.end(), __y.begin()); } template <class _Key, class _Tp, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator< (const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) { return std::__1::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); } template <class _Key, class _Tp, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) { return !(__x == __y); } template <class _Key, class _Tp, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator> (const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) { return __y < __x; } template <class _Key, class _Tp, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) { return !(__x < __y); } template <class _Key, class _Tp, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) { return !(__y < __x); } template <class _Key, class _Tp, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(multimap<_Key, _Tp, _Compare, _Allocator>& __x, multimap<_Key, _Tp, _Compare, _Allocator>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } } } namespace std { inline namespace __1 { template <class _InputIterator, class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) { for (; __first != __last; ++__first) __init = __init + *__first; return __init; } template <class _InputIterator, class _Tp, class _BinaryOperation> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op) { for (; __first != __last; ++__first) __init = __binary_op(__init, *__first); return __init; } template <class _InputIterator1, class _InputIterator2, class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init) { for (; __first1 != __last1; ++__first1, (void) ++__first2) __init = __init + *__first1 * *__first2; return __init; } template <class _InputIterator1, class _InputIterator2, class _Tp, class _BinaryOperation1, class _BinaryOperation2> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init, _BinaryOperation1 __binary_op1, _BinaryOperation2 __binary_op2) { for (; __first1 != __last1; ++__first1, (void) ++__first2) __init = __binary_op1(__init, __binary_op2(*__first1, *__first2)); return __init; } template <class _InputIterator, class _OutputIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { if (__first != __last) { typename iterator_traits<_InputIterator>::value_type __t(*__first); *__result = __t; for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) { __t = __t + *__first; *__result = __t; } } return __result; } template <class _InputIterator, class _OutputIterator, class _BinaryOperation> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOperation __binary_op) { if (__first != __last) { typename iterator_traits<_InputIterator>::value_type __t(*__first); *__result = __t; for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) { __t = __binary_op(__t, *__first); *__result = __t; } } return __result; } template <class _InputIterator, class _OutputIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { if (__first != __last) { typename iterator_traits<_InputIterator>::value_type __t1(*__first); *__result = __t1; for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) { typename iterator_traits<_InputIterator>::value_type __t2(*__first); *__result = __t2 - __t1; __t1 = std::__1::move(__t2); } } return __result; } template <class _InputIterator, class _OutputIterator, class _BinaryOperation> inline __attribute__ ((__exclude_from_explicit_instantiation__)) _OutputIterator adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOperation __binary_op) { if (__first != __last) { typename iterator_traits<_InputIterator>::value_type __t1(*__first); *__result = __t1; for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) { typename iterator_traits<_InputIterator>::value_type __t2(*__first); *__result = __binary_op(__t2, __t1); __t1 = std::__1::move(__t2); } } return __result; } template <class _ForwardIterator, class _Tp> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value_) { for (; __first != __last; ++__first, (void) ++__value_) *__first = __value_; } } } namespace std { inline namespace __1 { template <bool> class __vector_base_common { protected: __attribute__ ((__exclude_from_explicit_instantiation__)) __vector_base_common() {} [[noreturn]] void __throw_length_error() const; [[noreturn]] void __throw_out_of_range() const; }; template <bool __b> void __vector_base_common<__b>::__throw_length_error() const { std::__1::__throw_length_error("vector"); } template <bool __b> void __vector_base_common<__b>::__throw_out_of_range() const { std::__1::__throw_out_of_range("vector"); } extern template class __vector_base_common<true>; template <class _Tp, class _Allocator> class __vector_base : protected __vector_base_common<true> { public: typedef _Allocator allocator_type; typedef allocator_traits<allocator_type> __alloc_traits; typedef typename __alloc_traits::size_type size_type; protected: typedef _Tp value_type; typedef value_type& reference; typedef const value_type& const_reference; typedef typename __alloc_traits::difference_type difference_type; typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::const_pointer const_pointer; typedef pointer iterator; typedef const_pointer const_iterator; pointer __begin_; pointer __end_; __compressed_pair<pointer, allocator_type> __end_cap_; __attribute__ ((__exclude_from_explicit_instantiation__)) allocator_type& __alloc() noexcept {return __end_cap_.second();} __attribute__ ((__exclude_from_explicit_instantiation__)) const allocator_type& __alloc() const noexcept {return __end_cap_.second();} __attribute__ ((__exclude_from_explicit_instantiation__)) pointer& __end_cap() noexcept {return __end_cap_.first();} __attribute__ ((__exclude_from_explicit_instantiation__)) const pointer& __end_cap() const noexcept {return __end_cap_.first();} __attribute__ ((__exclude_from_explicit_instantiation__)) __vector_base() noexcept(is_nothrow_default_constructible<allocator_type>::value); __attribute__ ((__exclude_from_explicit_instantiation__)) __vector_base(const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) __vector_base(allocator_type&& __a) noexcept; ~__vector_base(); __attribute__ ((__exclude_from_explicit_instantiation__)) void clear() noexcept {__destruct_at_end(__begin_);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type capacity() const noexcept {return static_cast<size_type>(__end_cap() - __begin_);} __attribute__ ((__exclude_from_explicit_instantiation__)) void __destruct_at_end(pointer __new_last) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) void __copy_assign_alloc(const __vector_base& __c) {__copy_assign_alloc(__c, integral_constant<bool, __alloc_traits::propagate_on_container_copy_assignment::value>());} __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(__vector_base& __c) noexcept(!__alloc_traits::propagate_on_container_move_assignment::value || is_nothrow_move_assignable<allocator_type>::value) {__move_assign_alloc(__c, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());} private: __attribute__ ((__exclude_from_explicit_instantiation__)) void __copy_assign_alloc(const __vector_base& __c, true_type) { if (__alloc() != __c.__alloc()) { clear(); __alloc_traits::deallocate(__alloc(), __begin_, capacity()); __begin_ = __end_ = __end_cap() = nullptr; } __alloc() = __c.__alloc(); } __attribute__ ((__exclude_from_explicit_instantiation__)) void __copy_assign_alloc(const __vector_base&, false_type) {} __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(__vector_base& __c, true_type) noexcept(is_nothrow_move_assignable<allocator_type>::value) { __alloc() = std::__1::move(__c.__alloc()); } __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(__vector_base&, false_type) noexcept {} }; template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void __vector_base<_Tp, _Allocator>::__destruct_at_end(pointer __new_last) noexcept { pointer __soon_to_be_end = __end_; while (__new_last != __soon_to_be_end) __alloc_traits::destroy(__alloc(), std::__1::__to_raw_pointer(--__soon_to_be_end)); __end_ = __new_last; } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) __vector_base<_Tp, _Allocator>::__vector_base() noexcept(is_nothrow_default_constructible<allocator_type>::value) : __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr) { } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) __vector_base<_Tp, _Allocator>::__vector_base(const allocator_type& __a) : __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a) { } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) __vector_base<_Tp, _Allocator>::__vector_base(allocator_type&& __a) noexcept : __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, std::move(__a)) {} template <class _Tp, class _Allocator> __vector_base<_Tp, _Allocator>::~__vector_base() { if (__begin_ != nullptr) { clear(); __alloc_traits::deallocate(__alloc(), __begin_, capacity()); } } template <class _Tp, class _Allocator > class vector : private __vector_base<_Tp, _Allocator> { private: typedef __vector_base<_Tp, _Allocator> __base; typedef allocator<_Tp> __default_allocator_type; public: typedef vector __self; typedef _Tp value_type; typedef _Allocator allocator_type; typedef typename __base::__alloc_traits __alloc_traits; typedef typename __base::reference reference; typedef typename __base::const_reference const_reference; typedef typename __base::size_type size_type; typedef typename __base::difference_type difference_type; typedef typename __base::pointer pointer; typedef typename __base::const_pointer const_pointer; typedef __wrap_iter<pointer> iterator; typedef __wrap_iter<const_pointer> const_iterator; typedef std::__1::reverse_iterator<iterator> reverse_iterator; typedef std::__1::reverse_iterator<const_iterator> const_reverse_iterator; static_assert((is_same<typename allocator_type::value_type, value_type>::value), "Allocator::value_type must be same type as value_type"); __attribute__ ((__exclude_from_explicit_instantiation__)) vector() noexcept(is_nothrow_default_constructible<allocator_type>::value) { } __attribute__ ((__exclude_from_explicit_instantiation__)) explicit vector(const allocator_type& __a) noexcept(is_nothrow_copy_constructible<allocator_type>::value) : __base(__a) { } explicit vector(size_type __n); explicit vector(size_type __n, const allocator_type& __a); vector(size_type __n, const value_type& __x); vector(size_type __n, const value_type& __x, const allocator_type& __a); template <class _InputIterator> vector(_InputIterator __first, typename enable_if<__is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value && is_constructible< value_type, typename iterator_traits<_InputIterator>::reference>::value, _InputIterator>::type __last); template <class _InputIterator> vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a, typename enable_if<__is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value && is_constructible< value_type, typename iterator_traits<_InputIterator>::reference>::value>::type* = 0); template <class _ForwardIterator> vector(_ForwardIterator __first, typename enable_if<__is_forward_iterator<_ForwardIterator>::value && is_constructible< value_type, typename iterator_traits<_ForwardIterator>::reference>::value, _ForwardIterator>::type __last); template <class _ForwardIterator> vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a, typename enable_if<__is_forward_iterator<_ForwardIterator>::value && is_constructible< value_type, typename iterator_traits<_ForwardIterator>::reference>::value>::type* = 0); __attribute__ ((__exclude_from_explicit_instantiation__)) ~vector() { __annotate_delete(); } vector(const vector& __x); vector(const vector& __x, const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) vector& operator=(const vector& __x); __attribute__ ((__exclude_from_explicit_instantiation__)) vector(initializer_list<value_type> __il); __attribute__ ((__exclude_from_explicit_instantiation__)) vector(initializer_list<value_type> __il, const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) vector(vector&& __x) noexcept(is_nothrow_move_constructible<allocator_type>::value); __attribute__ ((__exclude_from_explicit_instantiation__)) vector(vector&& __x, const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) vector& operator=(vector&& __x) noexcept((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); __attribute__ ((__exclude_from_explicit_instantiation__)) vector& operator=(initializer_list<value_type> __il) {assign(__il.begin(), __il.end()); return *this;} template <class _InputIterator> typename enable_if < __is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value && is_constructible< value_type, typename iterator_traits<_InputIterator>::reference>::value, void >::type assign(_InputIterator __first, _InputIterator __last); template <class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value && is_constructible< value_type, typename iterator_traits<_ForwardIterator>::reference>::value, void >::type assign(_ForwardIterator __first, _ForwardIterator __last); void assign(size_type __n, const_reference __u); __attribute__ ((__exclude_from_explicit_instantiation__)) void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());} __attribute__ ((__exclude_from_explicit_instantiation__)) allocator_type get_allocator() const noexcept {return this->__alloc();} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator begin() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator begin() const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) iterator end() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator end() const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator rbegin() noexcept {return reverse_iterator(end());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator rbegin() const noexcept {return const_reverse_iterator(end());} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator rend() noexcept {return reverse_iterator(begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator rend() const noexcept {return const_reverse_iterator(begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cbegin() const noexcept {return begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cend() const noexcept {return end();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator crbegin() const noexcept {return rbegin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator crend() const noexcept {return rend();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type size() const noexcept {return static_cast<size_type>(this->__end_ - this->__begin_);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type capacity() const noexcept {return __base::capacity();} [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) bool empty() const noexcept {return this->__begin_ == this->__end_;} size_type max_size() const noexcept; void reserve(size_type __n); void shrink_to_fit() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator[](size_type __n) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference operator[](size_type __n) const noexcept; reference at(size_type __n); const_reference at(size_type __n) const; __attribute__ ((__exclude_from_explicit_instantiation__)) reference front() noexcept { ((void)0); return *this->__begin_; } __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference front() const noexcept { ((void)0); return *this->__begin_; } __attribute__ ((__exclude_from_explicit_instantiation__)) reference back() noexcept { ((void)0); return *(this->__end_ - 1); } __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference back() const noexcept { ((void)0); return *(this->__end_ - 1); } __attribute__ ((__exclude_from_explicit_instantiation__)) value_type* data() noexcept {return std::__1::__to_raw_pointer(this->__begin_);} __attribute__ ((__exclude_from_explicit_instantiation__)) const value_type* data() const noexcept {return std::__1::__to_raw_pointer(this->__begin_);} template <class _Arg> __attribute__ ((__exclude_from_explicit_instantiation__)) void __emplace_back(_Arg&& __arg) { emplace_back(std::__1::forward<_Arg>(__arg)); } __attribute__ ((__exclude_from_explicit_instantiation__)) void push_back(const_reference __x); __attribute__ ((__exclude_from_explicit_instantiation__)) void push_back(value_type&& __x); template <class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) void emplace_back(_Args&&... __args); __attribute__ ((__exclude_from_explicit_instantiation__)) void pop_back(); iterator insert(const_iterator __position, const_reference __x); iterator insert(const_iterator __position, value_type&& __x); template <class... _Args> iterator emplace(const_iterator __position, _Args&&... __args); iterator insert(const_iterator __position, size_type __n, const_reference __x); template <class _InputIterator> typename enable_if < __is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value && is_constructible< value_type, typename iterator_traits<_InputIterator>::reference>::value, iterator >::type insert(const_iterator __position, _InputIterator __first, _InputIterator __last); template <class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value && is_constructible< value_type, typename iterator_traits<_ForwardIterator>::reference>::value, iterator >::type insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last); __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const_iterator __position, initializer_list<value_type> __il) {return insert(__position, __il.begin(), __il.end());} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator erase(const_iterator __position); iterator erase(const_iterator __first, const_iterator __last); __attribute__ ((__exclude_from_explicit_instantiation__)) void clear() noexcept { size_type __old_size = size(); __base::clear(); __annotate_shrink(__old_size); __invalidate_all_iterators(); } void resize(size_type __sz); void resize(size_type __sz, const_reference __x); void swap(vector&) noexcept; bool __invariants() const; private: __attribute__ ((__exclude_from_explicit_instantiation__)) void __invalidate_all_iterators(); __attribute__ ((__exclude_from_explicit_instantiation__)) void __invalidate_iterators_past(pointer __new_last); void __vallocate(size_type __n); void __vdeallocate() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) size_type __recommend(size_type __new_size) const; void __construct_at_end(size_type __n); __attribute__ ((__exclude_from_explicit_instantiation__)) void __construct_at_end(size_type __n, const_reference __x); template <class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value, void >::type __construct_at_end(_ForwardIterator __first, _ForwardIterator __last, size_type __n); void __append(size_type __n); void __append(size_type __n, const_reference __x); __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __make_iter(pointer __p) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator __make_iter(const_pointer __p) const noexcept; void __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v); pointer __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p); void __move_range(pointer __from_s, pointer __from_e, pointer __to); void __move_assign(vector& __c, true_type) noexcept(is_nothrow_move_assignable<allocator_type>::value); void __move_assign(vector& __c, false_type) noexcept(__alloc_traits::is_always_equal::value); __attribute__ ((__exclude_from_explicit_instantiation__)) void __destruct_at_end(pointer __new_last) noexcept { __invalidate_iterators_past(__new_last); size_type __old_size = size(); __base::__destruct_at_end(__new_last); __annotate_shrink(__old_size); } template <class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) inline void __push_back_slow_path(_Up&& __x); template <class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) inline void __emplace_back_slow_path(_Args&&... __args); __attribute__ ((__exclude_from_explicit_instantiation__)) void __annotate_contiguous_container(const void*, const void*, const void*, const void*) const noexcept {} __attribute__ ((__exclude_from_explicit_instantiation__)) void __annotate_new(size_type __current_size) const noexcept { __annotate_contiguous_container(data(), data() + capacity(), data() + capacity(), data() + __current_size); } __attribute__ ((__exclude_from_explicit_instantiation__)) void __annotate_delete() const noexcept { __annotate_contiguous_container(data(), data() + capacity(), data() + size(), data() + capacity()); } __attribute__ ((__exclude_from_explicit_instantiation__)) void __annotate_increase(size_type __n) const noexcept { __annotate_contiguous_container(data(), data() + capacity(), data() + size(), data() + size() + __n); } __attribute__ ((__exclude_from_explicit_instantiation__)) void __annotate_shrink(size_type __old_size) const noexcept { __annotate_contiguous_container(data(), data() + capacity(), data() + __old_size, data() + size()); } struct _ConstructTransaction { explicit _ConstructTransaction(vector &__v, size_type __n) : __v_(__v), __pos_(__v.__end_), __new_end_(__v.__end_ + __n) { } ~_ConstructTransaction() { __v_.__end_ = __pos_; } vector &__v_; pointer __pos_; const_pointer const __new_end_; private: _ConstructTransaction(_ConstructTransaction const&) = delete; _ConstructTransaction& operator=(_ConstructTransaction const&) = delete; }; template <class ..._Args> __attribute__ ((__exclude_from_explicit_instantiation__)) void __construct_one_at_end(_Args&& ...__args) { _ConstructTransaction __tx(*this, 1); __alloc_traits::construct(this->__alloc(), std::__1::__to_raw_pointer(__tx.__pos_), std::__1::forward<_Args>(__args)...); ++__tx.__pos_; } }; template <class _Tp, class _Allocator> void vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v) { __annotate_delete(); __alloc_traits::__construct_backward_with_exception_guarantees( this->__alloc(), this->__begin_, this->__end_, __v.__begin_); std::__1::swap(this->__begin_, __v.__begin_); std::__1::swap(this->__end_, __v.__end_); std::__1::swap(this->__end_cap(), __v.__end_cap()); __v.__first_ = __v.__begin_; __annotate_new(size()); __invalidate_all_iterators(); } template <class _Tp, class _Allocator> typename vector<_Tp, _Allocator>::pointer vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p) { __annotate_delete(); pointer __r = __v.__begin_; __alloc_traits::__construct_backward_with_exception_guarantees( this->__alloc(), this->__begin_, __p, __v.__begin_); __alloc_traits::__construct_forward_with_exception_guarantees( this->__alloc(), __p, this->__end_, __v.__end_); std::__1::swap(this->__begin_, __v.__begin_); std::__1::swap(this->__end_, __v.__end_); std::__1::swap(this->__end_cap(), __v.__end_cap()); __v.__first_ = __v.__begin_; __annotate_new(size()); __invalidate_all_iterators(); return __r; } template <class _Tp, class _Allocator> void vector<_Tp, _Allocator>::__vallocate(size_type __n) { if (__n > max_size()) this->__throw_length_error(); this->__begin_ = this->__end_ = __alloc_traits::allocate(this->__alloc(), __n); this->__end_cap() = this->__begin_ + __n; __annotate_new(0); } template <class _Tp, class _Allocator> void vector<_Tp, _Allocator>::__vdeallocate() noexcept { if (this->__begin_ != nullptr) { clear(); __alloc_traits::deallocate(this->__alloc(), this->__begin_, capacity()); this->__begin_ = this->__end_ = this->__end_cap() = nullptr; } } template <class _Tp, class _Allocator> typename vector<_Tp, _Allocator>::size_type vector<_Tp, _Allocator>::max_size() const noexcept { return std::__1::min<size_type>(__alloc_traits::max_size(this->__alloc()), numeric_limits<difference_type>::max()); } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename vector<_Tp, _Allocator>::size_type vector<_Tp, _Allocator>::__recommend(size_type __new_size) const { const size_type __ms = max_size(); if (__new_size > __ms) this->__throw_length_error(); const size_type __cap = capacity(); if (__cap >= __ms / 2) return __ms; return std::__1::max<size_type>(2*__cap, __new_size); } template <class _Tp, class _Allocator> void vector<_Tp, _Allocator>::__construct_at_end(size_type __n) { _ConstructTransaction __tx(*this, __n); for (; __tx.__pos_ != __tx.__new_end_; ++__tx.__pos_) { __alloc_traits::construct(this->__alloc(), std::__1::__to_raw_pointer(__tx.__pos_)); } } template <class _Tp, class _Allocator> inline void vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) { _ConstructTransaction __tx(*this, __n); for (; __tx.__pos_ != __tx.__new_end_; ++__tx.__pos_) { __alloc_traits::construct(this->__alloc(), std::__1::__to_raw_pointer(__tx.__pos_), __x); } } template <class _Tp, class _Allocator> template <class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value, void >::type vector<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last, size_type __n) { _ConstructTransaction __tx(*this, __n); __alloc_traits::__construct_range_forward(this->__alloc(), __first, __last, __tx.__pos_); } template <class _Tp, class _Allocator> void vector<_Tp, _Allocator>::__append(size_type __n) { if (static_cast<size_type>(this->__end_cap() - this->__end_) >= __n) this->__construct_at_end(__n); else { allocator_type& __a = this->__alloc(); __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), size(), __a); __v.__construct_at_end(__n); __swap_out_circular_buffer(__v); } } template <class _Tp, class _Allocator> void vector<_Tp, _Allocator>::__append(size_type __n, const_reference __x) { if (static_cast<size_type>(this->__end_cap() - this->__end_) >= __n) this->__construct_at_end(__n, __x); else { allocator_type& __a = this->__alloc(); __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), size(), __a); __v.__construct_at_end(__n, __x); __swap_out_circular_buffer(__v); } } template <class _Tp, class _Allocator> vector<_Tp, _Allocator>::vector(size_type __n) { if (__n > 0) { __vallocate(__n); __construct_at_end(__n); } } template <class _Tp, class _Allocator> vector<_Tp, _Allocator>::vector(size_type __n, const allocator_type& __a) : __base(__a) { if (__n > 0) { __vallocate(__n); __construct_at_end(__n); } } template <class _Tp, class _Allocator> vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x) { if (__n > 0) { __vallocate(__n); __construct_at_end(__n, __x); } } template <class _Tp, class _Allocator> vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x, const allocator_type& __a) : __base(__a) { if (__n > 0) { __vallocate(__n); __construct_at_end(__n, __x); } } template <class _Tp, class _Allocator> template <class _InputIterator> vector<_Tp, _Allocator>::vector(_InputIterator __first, typename enable_if<__is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value && is_constructible< value_type, typename iterator_traits<_InputIterator>::reference>::value, _InputIterator>::type __last) { for (; __first != __last; ++__first) __emplace_back(*__first); } template <class _Tp, class _Allocator> template <class _InputIterator> vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a, typename enable_if<__is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value && is_constructible< value_type, typename iterator_traits<_InputIterator>::reference>::value>::type*) : __base(__a) { for (; __first != __last; ++__first) __emplace_back(*__first); } template <class _Tp, class _Allocator> template <class _ForwardIterator> vector<_Tp, _Allocator>::vector(_ForwardIterator __first, typename enable_if<__is_forward_iterator<_ForwardIterator>::value && is_constructible< value_type, typename iterator_traits<_ForwardIterator>::reference>::value, _ForwardIterator>::type __last) { size_type __n = static_cast<size_type>(std::__1::distance(__first, __last)); if (__n > 0) { __vallocate(__n); __construct_at_end(__first, __last, __n); } } template <class _Tp, class _Allocator> template <class _ForwardIterator> vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a, typename enable_if<__is_forward_iterator<_ForwardIterator>::value && is_constructible< value_type, typename iterator_traits<_ForwardIterator>::reference>::value>::type*) : __base(__a) { size_type __n = static_cast<size_type>(std::__1::distance(__first, __last)); if (__n > 0) { __vallocate(__n); __construct_at_end(__first, __last, __n); } } template <class _Tp, class _Allocator> vector<_Tp, _Allocator>::vector(const vector& __x) : __base(__alloc_traits::select_on_container_copy_construction(__x.__alloc())) { size_type __n = __x.size(); if (__n > 0) { __vallocate(__n); __construct_at_end(__x.__begin_, __x.__end_, __n); } } template <class _Tp, class _Allocator> vector<_Tp, _Allocator>::vector(const vector& __x, const allocator_type& __a) : __base(__a) { size_type __n = __x.size(); if (__n > 0) { __vallocate(__n); __construct_at_end(__x.__begin_, __x.__end_, __n); } } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) vector<_Tp, _Allocator>::vector(vector&& __x) noexcept(is_nothrow_move_constructible<allocator_type>::value) : __base(std::__1::move(__x.__alloc())) { this->__begin_ = __x.__begin_; this->__end_ = __x.__end_; this->__end_cap() = __x.__end_cap(); __x.__begin_ = __x.__end_ = __x.__end_cap() = nullptr; } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) vector<_Tp, _Allocator>::vector(vector&& __x, const allocator_type& __a) : __base(__a) { if (__a == __x.__alloc()) { this->__begin_ = __x.__begin_; this->__end_ = __x.__end_; this->__end_cap() = __x.__end_cap(); __x.__begin_ = __x.__end_ = __x.__end_cap() = nullptr; } else { typedef move_iterator<iterator> _Ip; assign(_Ip(__x.begin()), _Ip(__x.end())); } } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il) { if (__il.size() > 0) { __vallocate(__il.size()); __construct_at_end(__il.begin(), __il.end(), __il.size()); } } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il, const allocator_type& __a) : __base(__a) { if (__il.size() > 0) { __vallocate(__il.size()); __construct_at_end(__il.begin(), __il.end(), __il.size()); } } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) vector<_Tp, _Allocator>& vector<_Tp, _Allocator>::operator=(vector&& __x) noexcept((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) { __move_assign(__x, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>()); return *this; } template <class _Tp, class _Allocator> void vector<_Tp, _Allocator>::__move_assign(vector& __c, false_type) noexcept(__alloc_traits::is_always_equal::value) { if (__base::__alloc() != __c.__alloc()) { typedef move_iterator<iterator> _Ip; assign(_Ip(__c.begin()), _Ip(__c.end())); } else __move_assign(__c, true_type()); } template <class _Tp, class _Allocator> void vector<_Tp, _Allocator>::__move_assign(vector& __c, true_type) noexcept(is_nothrow_move_assignable<allocator_type>::value) { __vdeallocate(); __base::__move_assign_alloc(__c); this->__begin_ = __c.__begin_; this->__end_ = __c.__end_; this->__end_cap() = __c.__end_cap(); __c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr; } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) vector<_Tp, _Allocator>& vector<_Tp, _Allocator>::operator=(const vector& __x) { if (this != &__x) { __base::__copy_assign_alloc(__x); assign(__x.__begin_, __x.__end_); } return *this; } template <class _Tp, class _Allocator> template <class _InputIterator> typename enable_if < __is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value && is_constructible< _Tp, typename iterator_traits<_InputIterator>::reference>::value, void >::type vector<_Tp, _Allocator>::assign(_InputIterator __first, _InputIterator __last) { clear(); for (; __first != __last; ++__first) __emplace_back(*__first); } template <class _Tp, class _Allocator> template <class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value && is_constructible< _Tp, typename iterator_traits<_ForwardIterator>::reference>::value, void >::type vector<_Tp, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last) { size_type __new_size = static_cast<size_type>(std::__1::distance(__first, __last)); if (__new_size <= capacity()) { _ForwardIterator __mid = __last; bool __growing = false; if (__new_size > size()) { __growing = true; __mid = __first; std::__1::advance(__mid, size()); } pointer __m = std::__1::copy(__first, __mid, this->__begin_); if (__growing) __construct_at_end(__mid, __last, __new_size - size()); else this->__destruct_at_end(__m); } else { __vdeallocate(); __vallocate(__recommend(__new_size)); __construct_at_end(__first, __last, __new_size); } __invalidate_all_iterators(); } template <class _Tp, class _Allocator> void vector<_Tp, _Allocator>::assign(size_type __n, const_reference __u) { if (__n <= capacity()) { size_type __s = size(); std::__1::fill_n(this->__begin_, std::__1::min(__n, __s), __u); if (__n > __s) __construct_at_end(__n - __s, __u); else this->__destruct_at_end(this->__begin_ + __n); } else { __vdeallocate(); __vallocate(__recommend(static_cast<size_type>(__n))); __construct_at_end(__n, __u); } __invalidate_all_iterators(); } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::__make_iter(pointer __p) noexcept { return iterator(__p); } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename vector<_Tp, _Allocator>::const_iterator vector<_Tp, _Allocator>::__make_iter(const_pointer __p) const noexcept { return const_iterator(__p); } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::begin() noexcept { return __make_iter(this->__begin_); } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename vector<_Tp, _Allocator>::const_iterator vector<_Tp, _Allocator>::begin() const noexcept { return __make_iter(this->__begin_); } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::end() noexcept { return __make_iter(this->__end_); } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename vector<_Tp, _Allocator>::const_iterator vector<_Tp, _Allocator>::end() const noexcept { return __make_iter(this->__end_); } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename vector<_Tp, _Allocator>::reference vector<_Tp, _Allocator>::operator[](size_type __n) noexcept { ((void)0); return this->__begin_[__n]; } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename vector<_Tp, _Allocator>::const_reference vector<_Tp, _Allocator>::operator[](size_type __n) const noexcept { ((void)0); return this->__begin_[__n]; } template <class _Tp, class _Allocator> typename vector<_Tp, _Allocator>::reference vector<_Tp, _Allocator>::at(size_type __n) { if (__n >= size()) this->__throw_out_of_range(); return this->__begin_[__n]; } template <class _Tp, class _Allocator> typename vector<_Tp, _Allocator>::const_reference vector<_Tp, _Allocator>::at(size_type __n) const { if (__n >= size()) this->__throw_out_of_range(); return this->__begin_[__n]; } template <class _Tp, class _Allocator> void vector<_Tp, _Allocator>::reserve(size_type __n) { if (__n > capacity()) { allocator_type& __a = this->__alloc(); __split_buffer<value_type, allocator_type&> __v(__n, size(), __a); __swap_out_circular_buffer(__v); } } template <class _Tp, class _Allocator> void vector<_Tp, _Allocator>::shrink_to_fit() noexcept { if (capacity() > size()) { allocator_type& __a = this->__alloc(); __split_buffer<value_type, allocator_type&> __v(size(), size(), __a); __swap_out_circular_buffer(__v); } } template <class _Tp, class _Allocator> template <class _Up> void vector<_Tp, _Allocator>::__push_back_slow_path(_Up&& __x) { allocator_type& __a = this->__alloc(); __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a); __alloc_traits::construct(__a, std::__1::__to_raw_pointer(__v.__end_), std::__1::forward<_Up>(__x)); __v.__end_++; __swap_out_circular_buffer(__v); } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void vector<_Tp, _Allocator>::push_back(const_reference __x) { if (this->__end_ != this->__end_cap()) { __construct_one_at_end(__x); } else __push_back_slow_path(__x); } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void vector<_Tp, _Allocator>::push_back(value_type&& __x) { if (this->__end_ < this->__end_cap()) { __construct_one_at_end(std::__1::move(__x)); } else __push_back_slow_path(std::__1::move(__x)); } template <class _Tp, class _Allocator> template <class... _Args> void vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args) { allocator_type& __a = this->__alloc(); __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a); __alloc_traits::construct(__a, std::__1::__to_raw_pointer(__v.__end_), std::__1::forward<_Args>(__args)...); __v.__end_++; __swap_out_circular_buffer(__v); } template <class _Tp, class _Allocator> template <class... _Args> inline void vector<_Tp, _Allocator>::emplace_back(_Args&&... __args) { if (this->__end_ < this->__end_cap()) { __construct_one_at_end(std::__1::forward<_Args>(__args)...); } else __emplace_back_slow_path(std::__1::forward<_Args>(__args)...); } template <class _Tp, class _Allocator> inline void vector<_Tp, _Allocator>::pop_back() { ((void)0); this->__destruct_at_end(this->__end_ - 1); } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::erase(const_iterator __position) { ((void)0); difference_type __ps = __position - cbegin(); pointer __p = this->__begin_ + __ps; this->__destruct_at_end(std::__1::move(__p + 1, this->__end_, __p)); this->__invalidate_iterators_past(__p-1); iterator __r = __make_iter(__p); return __r; } template <class _Tp, class _Allocator> typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::erase(const_iterator __first, const_iterator __last) { ((void)0); pointer __p = this->__begin_ + (__first - begin()); if (__first != __last) { this->__destruct_at_end(std::__1::move(__p + (__last - __first), this->__end_, __p)); this->__invalidate_iterators_past(__p - 1); } iterator __r = __make_iter(__p); return __r; } template <class _Tp, class _Allocator> void vector<_Tp, _Allocator>::__move_range(pointer __from_s, pointer __from_e, pointer __to) { pointer __old_last = this->__end_; difference_type __n = __old_last - __to; { pointer __i = __from_s + __n; _ConstructTransaction __tx(*this, __from_e - __i); for (; __i < __from_e; ++__i, ++__tx.__pos_) { __alloc_traits::construct(this->__alloc(), std::__1::__to_raw_pointer(__tx.__pos_), std::__1::move(*__i)); } } std::__1::move_backward(__from_s, __from_s + __n, __old_last); } template <class _Tp, class _Allocator> typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x) { pointer __p = this->__begin_ + (__position - begin()); if (this->__end_ < this->__end_cap()) { if (__p == this->__end_) { __construct_one_at_end(__x); } else { __move_range(__p, this->__end_, __p + 1); const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x); if (__p <= __xr && __xr < this->__end_) ++__xr; *__p = *__xr; } } else { allocator_type& __a = this->__alloc(); __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, __a); __v.push_back(__x); __p = __swap_out_circular_buffer(__v, __p); } return __make_iter(__p); } template <class _Tp, class _Allocator> typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x) { pointer __p = this->__begin_ + (__position - begin()); if (this->__end_ < this->__end_cap()) { if (__p == this->__end_) { __construct_one_at_end(std::__1::move(__x)); } else { __move_range(__p, this->__end_, __p + 1); *__p = std::__1::move(__x); } } else { allocator_type& __a = this->__alloc(); __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, __a); __v.push_back(std::__1::move(__x)); __p = __swap_out_circular_buffer(__v, __p); } return __make_iter(__p); } template <class _Tp, class _Allocator> template <class... _Args> typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args) { pointer __p = this->__begin_ + (__position - begin()); if (this->__end_ < this->__end_cap()) { if (__p == this->__end_) { __construct_one_at_end(std::__1::forward<_Args>(__args)...); } else { __temp_value<value_type, _Allocator> __tmp(this->__alloc(), std::__1::forward<_Args>(__args)...); __move_range(__p, this->__end_, __p + 1); *__p = std::__1::move(__tmp.get()); } } else { allocator_type& __a = this->__alloc(); __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, __a); __v.emplace_back(std::__1::forward<_Args>(__args)...); __p = __swap_out_circular_buffer(__v, __p); } return __make_iter(__p); } template <class _Tp, class _Allocator> typename vector<_Tp, _Allocator>::iterator vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_reference __x) { pointer __p = this->__begin_ + (__position - begin()); if (__n > 0) { if (__n <= static_cast<size_type>(this->__end_cap() - this->__end_)) { size_type __old_n = __n; pointer __old_last = this->__end_; if (__n > static_cast<size_type>(this->__end_ - __p)) { size_type __cx = __n - (this->__end_ - __p); __construct_at_end(__cx, __x); __n -= __cx; } if (__n > 0) { __move_range(__p, __old_last, __p + __old_n); const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x); if (__p <= __xr && __xr < this->__end_) __xr += __old_n; std::__1::fill_n(__p, __n, *__xr); } } else { allocator_type& __a = this->__alloc(); __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), __p - this->__begin_, __a); __v.__construct_at_end(__n, __x); __p = __swap_out_circular_buffer(__v, __p); } } return __make_iter(__p); } template <class _Tp, class _Allocator> template <class _InputIterator> typename enable_if < __is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value && is_constructible< _Tp, typename iterator_traits<_InputIterator>::reference>::value, typename vector<_Tp, _Allocator>::iterator >::type vector<_Tp, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last) { difference_type __off = __position - begin(); pointer __p = this->__begin_ + __off; allocator_type& __a = this->__alloc(); pointer __old_last = this->__end_; for (; this->__end_ != this->__end_cap() && __first != __last; ++__first) { __construct_one_at_end(*__first); } __split_buffer<value_type, allocator_type&> __v(__a); if (__first != __last) { __v.__construct_at_end(__first, __last); difference_type __old_size = __old_last - this->__begin_; difference_type __old_p = __p - this->__begin_; reserve(__recommend(size() + __v.size())); __p = this->__begin_ + __old_p; __old_last = this->__begin_ + __old_size; } __p = std::__1::rotate(__p, __old_last, this->__end_); insert(__make_iter(__p), make_move_iterator(__v.begin()), make_move_iterator(__v.end())); return begin() + __off; } template <class _Tp, class _Allocator> template <class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value && is_constructible< _Tp, typename iterator_traits<_ForwardIterator>::reference>::value, typename vector<_Tp, _Allocator>::iterator >::type vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last) { pointer __p = this->__begin_ + (__position - begin()); difference_type __n = std::__1::distance(__first, __last); if (__n > 0) { if (__n <= this->__end_cap() - this->__end_) { size_type __old_n = __n; pointer __old_last = this->__end_; _ForwardIterator __m = __last; difference_type __dx = this->__end_ - __p; if (__n > __dx) { __m = __first; difference_type __diff = this->__end_ - __p; std::__1::advance(__m, __diff); __construct_at_end(__m, __last, __n - __diff); __n = __dx; } if (__n > 0) { __move_range(__p, __old_last, __p + __old_n); std::__1::copy(__first, __m, __p); } } else { allocator_type& __a = this->__alloc(); __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), __p - this->__begin_, __a); __v.__construct_at_end(__first, __last); __p = __swap_out_circular_buffer(__v, __p); } } return __make_iter(__p); } template <class _Tp, class _Allocator> void vector<_Tp, _Allocator>::resize(size_type __sz) { size_type __cs = size(); if (__cs < __sz) this->__append(__sz - __cs); else if (__cs > __sz) this->__destruct_at_end(this->__begin_ + __sz); } template <class _Tp, class _Allocator> void vector<_Tp, _Allocator>::resize(size_type __sz, const_reference __x) { size_type __cs = size(); if (__cs < __sz) this->__append(__sz - __cs, __x); else if (__cs > __sz) this->__destruct_at_end(this->__begin_ + __sz); } template <class _Tp, class _Allocator> void vector<_Tp, _Allocator>::swap(vector& __x) noexcept { ((void)0); std::__1::swap(this->__begin_, __x.__begin_); std::__1::swap(this->__end_, __x.__end_); std::__1::swap(this->__end_cap(), __x.__end_cap()); __swap_allocator(this->__alloc(), __x.__alloc(), integral_constant<bool,__alloc_traits::propagate_on_container_swap::value>()); } template <class _Tp, class _Allocator> bool vector<_Tp, _Allocator>::__invariants() const { if (this->__begin_ == nullptr) { if (this->__end_ != nullptr || this->__end_cap() != nullptr) return false; } else { if (this->__begin_ > this->__end_) return false; if (this->__begin_ == this->__end_cap()) return false; if (this->__end_ > this->__end_cap()) return false; } return true; } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void vector<_Tp, _Allocator>::__invalidate_all_iterators() { } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void vector<_Tp, _Allocator>::__invalidate_iterators_past(pointer __new_last) { ((void)__new_last); } template <class _Allocator> class vector<bool, _Allocator>; template <class _Allocator> struct hash<vector<bool, _Allocator> >; template <class _Allocator> struct __has_storage_type<vector<bool, _Allocator> > { static const bool value = true; }; template <class _Allocator> class vector<bool, _Allocator> : private __vector_base_common<true> { public: typedef vector __self; typedef bool value_type; typedef _Allocator allocator_type; typedef allocator_traits<allocator_type> __alloc_traits; typedef typename __alloc_traits::size_type size_type; typedef typename __alloc_traits::difference_type difference_type; typedef size_type __storage_type; typedef __bit_iterator<vector, false> pointer; typedef __bit_iterator<vector, true> const_pointer; typedef pointer iterator; typedef const_pointer const_iterator; typedef std::__1::reverse_iterator<iterator> reverse_iterator; typedef std::__1::reverse_iterator<const_iterator> const_reverse_iterator; private: typedef typename __rebind_alloc_helper<__alloc_traits, __storage_type>::type __storage_allocator; typedef allocator_traits<__storage_allocator> __storage_traits; typedef typename __storage_traits::pointer __storage_pointer; typedef typename __storage_traits::const_pointer __const_storage_pointer; __storage_pointer __begin_; size_type __size_; __compressed_pair<size_type, __storage_allocator> __cap_alloc_; public: typedef __bit_reference<vector> reference; typedef __bit_const_reference<vector> const_reference; private: __attribute__ ((__exclude_from_explicit_instantiation__)) size_type& __cap() noexcept {return __cap_alloc_.first();} __attribute__ ((__exclude_from_explicit_instantiation__)) const size_type& __cap() const noexcept {return __cap_alloc_.first();} __attribute__ ((__exclude_from_explicit_instantiation__)) __storage_allocator& __alloc() noexcept {return __cap_alloc_.second();} __attribute__ ((__exclude_from_explicit_instantiation__)) const __storage_allocator& __alloc() const noexcept {return __cap_alloc_.second();} static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * 8); __attribute__ ((__exclude_from_explicit_instantiation__)) static size_type __internal_cap_to_external(size_type __n) noexcept {return __n * __bits_per_word;} __attribute__ ((__exclude_from_explicit_instantiation__)) static size_type __external_cap_to_internal(size_type __n) noexcept {return (__n - 1) / __bits_per_word + 1;} public: __attribute__ ((__exclude_from_explicit_instantiation__)) vector() noexcept(is_nothrow_default_constructible<allocator_type>::value); __attribute__ ((__exclude_from_explicit_instantiation__)) explicit vector(const allocator_type& __a) noexcept(is_nothrow_copy_constructible<allocator_type>::value); ~vector(); explicit vector(size_type __n); explicit vector(size_type __n, const allocator_type& __a); vector(size_type __n, const value_type& __v); vector(size_type __n, const value_type& __v, const allocator_type& __a); template <class _InputIterator> vector(_InputIterator __first, _InputIterator __last, typename enable_if<__is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value>::type* = 0); template <class _InputIterator> vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a, typename enable_if<__is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value>::type* = 0); template <class _ForwardIterator> vector(_ForwardIterator __first, _ForwardIterator __last, typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type* = 0); template <class _ForwardIterator> vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a, typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type* = 0); vector(const vector& __v); vector(const vector& __v, const allocator_type& __a); vector& operator=(const vector& __v); vector(initializer_list<value_type> __il); vector(initializer_list<value_type> __il, const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) vector(vector&& __v) noexcept(is_nothrow_move_constructible<allocator_type>::value); vector(vector&& __v, const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) vector& operator=(vector&& __v) noexcept((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); __attribute__ ((__exclude_from_explicit_instantiation__)) vector& operator=(initializer_list<value_type> __il) {assign(__il.begin(), __il.end()); return *this;} template <class _InputIterator> typename enable_if < __is_input_iterator<_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value, void >::type assign(_InputIterator __first, _InputIterator __last); template <class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value, void >::type assign(_ForwardIterator __first, _ForwardIterator __last); void assign(size_type __n, const value_type& __x); __attribute__ ((__exclude_from_explicit_instantiation__)) void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());} __attribute__ ((__exclude_from_explicit_instantiation__)) allocator_type get_allocator() const noexcept {return allocator_type(this->__alloc());} size_type max_size() const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) size_type capacity() const noexcept {return __internal_cap_to_external(__cap());} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type size() const noexcept {return __size_;} [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) bool empty() const noexcept {return __size_ == 0;} void reserve(size_type __n); void shrink_to_fit() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) iterator begin() noexcept {return __make_iter(0);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator begin() const noexcept {return __make_iter(0);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator end() noexcept {return __make_iter(__size_);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator end() const noexcept {return __make_iter(__size_);} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator rbegin() noexcept {return reverse_iterator(end());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator rbegin() const noexcept {return const_reverse_iterator(end());} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator rend() noexcept {return reverse_iterator(begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator rend() const noexcept {return const_reverse_iterator(begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cbegin() const noexcept {return __make_iter(0);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cend() const noexcept {return __make_iter(__size_);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator crbegin() const noexcept {return rbegin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator crend() const noexcept {return rend();} __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator[](size_type __n) {return __make_ref(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference operator[](size_type __n) const {return __make_ref(__n);} reference at(size_type __n); const_reference at(size_type __n) const; __attribute__ ((__exclude_from_explicit_instantiation__)) reference front() {return __make_ref(0);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference front() const {return __make_ref(0);} __attribute__ ((__exclude_from_explicit_instantiation__)) reference back() {return __make_ref(__size_ - 1);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference back() const {return __make_ref(__size_ - 1);} void push_back(const value_type& __x); template <class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) void emplace_back(_Args&&... __args) { push_back ( value_type ( std::__1::forward<_Args>(__args)... )); } __attribute__ ((__exclude_from_explicit_instantiation__)) void pop_back() {--__size_;} template <class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator emplace(const_iterator position, _Args&&... __args) { return insert ( position, value_type ( std::__1::forward<_Args>(__args)... )); } iterator insert(const_iterator __position, const value_type& __x); iterator insert(const_iterator __position, size_type __n, const value_type& __x); iterator insert(const_iterator __position, size_type __n, const_reference __x); template <class _InputIterator> typename enable_if < __is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value, iterator >::type insert(const_iterator __position, _InputIterator __first, _InputIterator __last); template <class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value, iterator >::type insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last); __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const_iterator __position, initializer_list<value_type> __il) {return insert(__position, __il.begin(), __il.end());} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator erase(const_iterator __position); iterator erase(const_iterator __first, const_iterator __last); __attribute__ ((__exclude_from_explicit_instantiation__)) void clear() noexcept {__size_ = 0;} void swap(vector&) noexcept; static void swap(reference __x, reference __y) noexcept { std::__1::swap(__x, __y); } void resize(size_type __sz, value_type __x = false); void flip() noexcept; bool __invariants() const; private: __attribute__ ((__exclude_from_explicit_instantiation__)) void __invalidate_all_iterators(); void __vallocate(size_type __n); void __vdeallocate() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) static size_type __align_it(size_type __new_size) noexcept {return __new_size + (__bits_per_word-1) & ~((size_type)__bits_per_word-1);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type __recommend(size_type __new_size) const; __attribute__ ((__exclude_from_explicit_instantiation__)) void __construct_at_end(size_type __n, bool __x); template <class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value, void >::type __construct_at_end(_ForwardIterator __first, _ForwardIterator __last); void __append(size_type __n, const_reference __x); __attribute__ ((__exclude_from_explicit_instantiation__)) reference __make_ref(size_type __pos) noexcept {return reference(__begin_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference __make_ref(size_type __pos) const noexcept {return const_reference(__begin_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __make_iter(size_type __pos) noexcept {return iterator(__begin_ + __pos / __bits_per_word, static_cast<unsigned>(__pos % __bits_per_word));} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator __make_iter(size_type __pos) const noexcept {return const_iterator(__begin_ + __pos / __bits_per_word, static_cast<unsigned>(__pos % __bits_per_word));} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __const_iterator_cast(const_iterator __p) noexcept {return begin() + (__p - cbegin());} __attribute__ ((__exclude_from_explicit_instantiation__)) void __copy_assign_alloc(const vector& __v) {__copy_assign_alloc(__v, integral_constant<bool, __storage_traits::propagate_on_container_copy_assignment::value>());} __attribute__ ((__exclude_from_explicit_instantiation__)) void __copy_assign_alloc(const vector& __c, true_type) { if (__alloc() != __c.__alloc()) __vdeallocate(); __alloc() = __c.__alloc(); } __attribute__ ((__exclude_from_explicit_instantiation__)) void __copy_assign_alloc(const vector&, false_type) {} void __move_assign(vector& __c, false_type); void __move_assign(vector& __c, true_type) noexcept(is_nothrow_move_assignable<allocator_type>::value); __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(vector& __c) noexcept(!__storage_traits::propagate_on_container_move_assignment::value || is_nothrow_move_assignable<allocator_type>::value) {__move_assign_alloc(__c, integral_constant<bool, __storage_traits::propagate_on_container_move_assignment::value>());} __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(vector& __c, true_type) noexcept(is_nothrow_move_assignable<allocator_type>::value) { __alloc() = std::__1::move(__c.__alloc()); } __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(vector&, false_type) noexcept {} size_t __hash_code() const noexcept; friend class __bit_reference<vector>; friend class __bit_const_reference<vector>; friend class __bit_iterator<vector, false>; friend class __bit_iterator<vector, true>; friend struct __bit_array<vector>; friend struct hash<vector>; }; template <class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void vector<bool, _Allocator>::__invalidate_all_iterators() { } template <class _Allocator> void vector<bool, _Allocator>::__vallocate(size_type __n) { if (__n > max_size()) this->__throw_length_error(); __n = __external_cap_to_internal(__n); this->__begin_ = __storage_traits::allocate(this->__alloc(), __n); this->__size_ = 0; this->__cap() = __n; } template <class _Allocator> void vector<bool, _Allocator>::__vdeallocate() noexcept { if (this->__begin_ != nullptr) { __storage_traits::deallocate(this->__alloc(), this->__begin_, __cap()); __invalidate_all_iterators(); this->__begin_ = nullptr; this->__size_ = this->__cap() = 0; } } template <class _Allocator> typename vector<bool, _Allocator>::size_type vector<bool, _Allocator>::max_size() const noexcept { size_type __amax = __storage_traits::max_size(__alloc()); size_type __nmax = numeric_limits<size_type>::max() / 2; if (__nmax / __bits_per_word <= __amax) return __nmax; return __internal_cap_to_external(__amax); } template <class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename vector<bool, _Allocator>::size_type vector<bool, _Allocator>::__recommend(size_type __new_size) const { const size_type __ms = max_size(); if (__new_size > __ms) this->__throw_length_error(); const size_type __cap = capacity(); if (__cap >= __ms / 2) return __ms; return std::__1::max(2*__cap, __align_it(__new_size)); } template <class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void vector<bool, _Allocator>::__construct_at_end(size_type __n, bool __x) { size_type __old_size = this->__size_; this->__size_ += __n; if (__old_size == 0 || ((__old_size - 1) / __bits_per_word) != ((this->__size_ - 1) / __bits_per_word)) { if (this->__size_ <= __bits_per_word) this->__begin_[0] = __storage_type(0); else this->__begin_[(this->__size_ - 1) / __bits_per_word] = __storage_type(0); } std::__1::fill_n(__make_iter(__old_size), __n, __x); } template <class _Allocator> template <class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value, void >::type vector<bool, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last) { size_type __old_size = this->__size_; this->__size_ += std::__1::distance(__first, __last); if (__old_size == 0 || ((__old_size - 1) / __bits_per_word) != ((this->__size_ - 1) / __bits_per_word)) { if (this->__size_ <= __bits_per_word) this->__begin_[0] = __storage_type(0); else this->__begin_[(this->__size_ - 1) / __bits_per_word] = __storage_type(0); } std::__1::copy(__first, __last, __make_iter(__old_size)); } template <class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) vector<bool, _Allocator>::vector() noexcept(is_nothrow_default_constructible<allocator_type>::value) : __begin_(nullptr), __size_(0), __cap_alloc_(0) { } template <class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) vector<bool, _Allocator>::vector(const allocator_type& __a) noexcept(is_nothrow_copy_constructible<allocator_type>::value) : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) { } template <class _Allocator> vector<bool, _Allocator>::vector(size_type __n) : __begin_(nullptr), __size_(0), __cap_alloc_(0) { if (__n > 0) { __vallocate(__n); __construct_at_end(__n, false); } } template <class _Allocator> vector<bool, _Allocator>::vector(size_type __n, const allocator_type& __a) : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) { if (__n > 0) { __vallocate(__n); __construct_at_end(__n, false); } } template <class _Allocator> vector<bool, _Allocator>::vector(size_type __n, const value_type& __x) : __begin_(nullptr), __size_(0), __cap_alloc_(0) { if (__n > 0) { __vallocate(__n); __construct_at_end(__n, __x); } } template <class _Allocator> vector<bool, _Allocator>::vector(size_type __n, const value_type& __x, const allocator_type& __a) : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) { if (__n > 0) { __vallocate(__n); __construct_at_end(__n, __x); } } template <class _Allocator> template <class _InputIterator> vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last, typename enable_if<__is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value>::type*) : __begin_(nullptr), __size_(0), __cap_alloc_(0) { for (; __first != __last; ++__first) push_back(*__first); } template <class _Allocator> template <class _InputIterator> vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a, typename enable_if<__is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value>::type*) : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) { for (; __first != __last; ++__first) push_back(*__first); } template <class _Allocator> template <class _ForwardIterator> vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type*) : __begin_(nullptr), __size_(0), __cap_alloc_(0) { size_type __n = static_cast<size_type>(std::__1::distance(__first, __last)); if (__n > 0) { __vallocate(__n); __construct_at_end(__first, __last); } } template <class _Allocator> template <class _ForwardIterator> vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a, typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type*) : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) { size_type __n = static_cast<size_type>(std::__1::distance(__first, __last)); if (__n > 0) { __vallocate(__n); __construct_at_end(__first, __last); } } template <class _Allocator> vector<bool, _Allocator>::vector(initializer_list<value_type> __il) : __begin_(nullptr), __size_(0), __cap_alloc_(0) { size_type __n = static_cast<size_type>(__il.size()); if (__n > 0) { __vallocate(__n); __construct_at_end(__il.begin(), __il.end()); } } template <class _Allocator> vector<bool, _Allocator>::vector(initializer_list<value_type> __il, const allocator_type& __a) : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) { size_type __n = static_cast<size_type>(__il.size()); if (__n > 0) { __vallocate(__n); __construct_at_end(__il.begin(), __il.end()); } } template <class _Allocator> vector<bool, _Allocator>::~vector() { if (__begin_ != nullptr) __storage_traits::deallocate(__alloc(), __begin_, __cap()); __invalidate_all_iterators(); } template <class _Allocator> vector<bool, _Allocator>::vector(const vector& __v) : __begin_(nullptr), __size_(0), __cap_alloc_(0, __storage_traits::select_on_container_copy_construction(__v.__alloc())) { if (__v.size() > 0) { __vallocate(__v.size()); __construct_at_end(__v.begin(), __v.end()); } } template <class _Allocator> vector<bool, _Allocator>::vector(const vector& __v, const allocator_type& __a) : __begin_(nullptr), __size_(0), __cap_alloc_(0, __a) { if (__v.size() > 0) { __vallocate(__v.size()); __construct_at_end(__v.begin(), __v.end()); } } template <class _Allocator> vector<bool, _Allocator>& vector<bool, _Allocator>::operator=(const vector& __v) { if (this != &__v) { __copy_assign_alloc(__v); if (__v.__size_) { if (__v.__size_ > capacity()) { __vdeallocate(); __vallocate(__v.__size_); } std::__1::copy(__v.__begin_, __v.__begin_ + __external_cap_to_internal(__v.__size_), __begin_); } __size_ = __v.__size_; } return *this; } template <class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) vector<bool, _Allocator>::vector(vector&& __v) noexcept(is_nothrow_move_constructible<allocator_type>::value) : __begin_(__v.__begin_), __size_(__v.__size_), __cap_alloc_(std::move(__v.__cap_alloc_)) { __v.__begin_ = nullptr; __v.__size_ = 0; __v.__cap() = 0; } template <class _Allocator> vector<bool, _Allocator>::vector(vector&& __v, const allocator_type& __a) : __begin_(nullptr), __size_(0), __cap_alloc_(0, __a) { if (__a == allocator_type(__v.__alloc())) { this->__begin_ = __v.__begin_; this->__size_ = __v.__size_; this->__cap() = __v.__cap(); __v.__begin_ = nullptr; __v.__cap() = __v.__size_ = 0; } else if (__v.size() > 0) { __vallocate(__v.size()); __construct_at_end(__v.begin(), __v.end()); } } template <class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) vector<bool, _Allocator>& vector<bool, _Allocator>::operator=(vector&& __v) noexcept((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) { __move_assign(__v, integral_constant<bool, __storage_traits::propagate_on_container_move_assignment::value>()); return *this; } template <class _Allocator> void vector<bool, _Allocator>::__move_assign(vector& __c, false_type) { if (__alloc() != __c.__alloc()) assign(__c.begin(), __c.end()); else __move_assign(__c, true_type()); } template <class _Allocator> void vector<bool, _Allocator>::__move_assign(vector& __c, true_type) noexcept(is_nothrow_move_assignable<allocator_type>::value) { __vdeallocate(); __move_assign_alloc(__c); this->__begin_ = __c.__begin_; this->__size_ = __c.__size_; this->__cap() = __c.__cap(); __c.__begin_ = nullptr; __c.__cap() = __c.__size_ = 0; } template <class _Allocator> void vector<bool, _Allocator>::assign(size_type __n, const value_type& __x) { __size_ = 0; if (__n > 0) { size_type __c = capacity(); if (__n <= __c) __size_ = __n; else { vector __v(__alloc()); __v.reserve(__recommend(__n)); __v.__size_ = __n; swap(__v); } std::__1::fill_n(begin(), __n, __x); } __invalidate_all_iterators(); } template <class _Allocator> template <class _InputIterator> typename enable_if < __is_input_iterator<_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value, void >::type vector<bool, _Allocator>::assign(_InputIterator __first, _InputIterator __last) { clear(); for (; __first != __last; ++__first) push_back(*__first); } template <class _Allocator> template <class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value, void >::type vector<bool, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last) { clear(); difference_type __ns = std::__1::distance(__first, __last); ((void)0); const size_t __n = static_cast<size_type>(__ns); if (__n) { if (__n > capacity()) { __vdeallocate(); __vallocate(__n); } __construct_at_end(__first, __last); } } template <class _Allocator> void vector<bool, _Allocator>::reserve(size_type __n) { if (__n > capacity()) { vector __v(this->__alloc()); __v.__vallocate(__n); __v.__construct_at_end(this->begin(), this->end()); swap(__v); __invalidate_all_iterators(); } } template <class _Allocator> void vector<bool, _Allocator>::shrink_to_fit() noexcept { if (__external_cap_to_internal(size()) > __cap()) { vector(*this, allocator_type(__alloc())).swap(*this); } } template <class _Allocator> typename vector<bool, _Allocator>::reference vector<bool, _Allocator>::at(size_type __n) { if (__n >= size()) this->__throw_out_of_range(); return (*this)[__n]; } template <class _Allocator> typename vector<bool, _Allocator>::const_reference vector<bool, _Allocator>::at(size_type __n) const { if (__n >= size()) this->__throw_out_of_range(); return (*this)[__n]; } template <class _Allocator> void vector<bool, _Allocator>::push_back(const value_type& __x) { if (this->__size_ == this->capacity()) reserve(__recommend(this->__size_ + 1)); ++this->__size_; back() = __x; } template <class _Allocator> typename vector<bool, _Allocator>::iterator vector<bool, _Allocator>::insert(const_iterator __position, const value_type& __x) { iterator __r; if (size() < capacity()) { const_iterator __old_end = end(); ++__size_; std::__1::copy_backward(__position, __old_end, end()); __r = __const_iterator_cast(__position); } else { vector __v(__alloc()); __v.reserve(__recommend(__size_ + 1)); __v.__size_ = __size_ + 1; __r = std::__1::copy(cbegin(), __position, __v.begin()); std::__1::copy_backward(__position, cend(), __v.end()); swap(__v); } *__r = __x; return __r; } template <class _Allocator> typename vector<bool, _Allocator>::iterator vector<bool, _Allocator>::insert(const_iterator __position, size_type __n, const value_type& __x) { iterator __r; size_type __c = capacity(); if (__n <= __c && size() <= __c - __n) { const_iterator __old_end = end(); __size_ += __n; std::__1::copy_backward(__position, __old_end, end()); __r = __const_iterator_cast(__position); } else { vector __v(__alloc()); __v.reserve(__recommend(__size_ + __n)); __v.__size_ = __size_ + __n; __r = std::__1::copy(cbegin(), __position, __v.begin()); std::__1::copy_backward(__position, cend(), __v.end()); swap(__v); } std::__1::fill_n(__r, __n, __x); return __r; } template <class _Allocator> template <class _InputIterator> typename enable_if < __is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value, typename vector<bool, _Allocator>::iterator >::type vector<bool, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last) { difference_type __off = __position - begin(); iterator __p = __const_iterator_cast(__position); iterator __old_end = end(); for (; size() != capacity() && __first != __last; ++__first) { ++this->__size_; back() = *__first; } vector __v(__alloc()); if (__first != __last) { __v.assign(__first, __last); difference_type __old_size = static_cast<difference_type>(__old_end - begin()); difference_type __old_p = __p - begin(); reserve(__recommend(size() + __v.size())); __p = begin() + __old_p; __old_end = begin() + __old_size; } __p = std::__1::rotate(__p, __old_end, end()); insert(__p, __v.begin(), __v.end()); return begin() + __off; } template <class _Allocator> template <class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value, typename vector<bool, _Allocator>::iterator >::type vector<bool, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last) { const difference_type __n_signed = std::__1::distance(__first, __last); ((void)0); const size_type __n = static_cast<size_type>(__n_signed); iterator __r; size_type __c = capacity(); if (__n <= __c && size() <= __c - __n) { const_iterator __old_end = end(); __size_ += __n; std::__1::copy_backward(__position, __old_end, end()); __r = __const_iterator_cast(__position); } else { vector __v(__alloc()); __v.reserve(__recommend(__size_ + __n)); __v.__size_ = __size_ + __n; __r = std::__1::copy(cbegin(), __position, __v.begin()); std::__1::copy_backward(__position, cend(), __v.end()); swap(__v); } std::__1::copy(__first, __last, __r); return __r; } template <class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename vector<bool, _Allocator>::iterator vector<bool, _Allocator>::erase(const_iterator __position) { iterator __r = __const_iterator_cast(__position); std::__1::copy(__position + 1, this->cend(), __r); --__size_; return __r; } template <class _Allocator> typename vector<bool, _Allocator>::iterator vector<bool, _Allocator>::erase(const_iterator __first, const_iterator __last) { iterator __r = __const_iterator_cast(__first); difference_type __d = __last - __first; std::__1::copy(__last, this->cend(), __r); __size_ -= __d; return __r; } template <class _Allocator> void vector<bool, _Allocator>::swap(vector& __x) noexcept { std::__1::swap(this->__begin_, __x.__begin_); std::__1::swap(this->__size_, __x.__size_); std::__1::swap(this->__cap(), __x.__cap()); __swap_allocator(this->__alloc(), __x.__alloc(), integral_constant<bool, __alloc_traits::propagate_on_container_swap::value>()); } template <class _Allocator> void vector<bool, _Allocator>::resize(size_type __sz, value_type __x) { size_type __cs = size(); if (__cs < __sz) { iterator __r; size_type __c = capacity(); size_type __n = __sz - __cs; if (__n <= __c && __cs <= __c - __n) { __r = end(); __size_ += __n; } else { vector __v(__alloc()); __v.reserve(__recommend(__size_ + __n)); __v.__size_ = __size_ + __n; __r = std::__1::copy(cbegin(), cend(), __v.begin()); swap(__v); } std::__1::fill_n(__r, __n, __x); } else __size_ = __sz; } template <class _Allocator> void vector<bool, _Allocator>::flip() noexcept { size_type __n = __size_; __storage_pointer __p = __begin_; for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word) *__p = ~*__p; if (__n > 0) { __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); __storage_type __b = *__p & __m; *__p &= ~__m; *__p |= ~__b & __m; } } template <class _Allocator> bool vector<bool, _Allocator>::__invariants() const { if (this->__begin_ == nullptr) { if (this->__size_ != 0 || this->__cap() != 0) return false; } else { if (this->__cap() == 0) return false; if (this->__size_ > this->capacity()) return false; } return true; } template <class _Allocator> size_t vector<bool, _Allocator>::__hash_code() const noexcept { size_t __h = 0; size_type __n = __size_; __storage_pointer __p = __begin_; for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word) __h ^= *__p; if (__n > 0) { const __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); __h ^= *__p & __m; } return __h; } template <class _Allocator> struct hash<vector<bool, _Allocator> > : public unary_function<vector<bool, _Allocator>, size_t> { __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(const vector<bool, _Allocator>& __vec) const noexcept {return __vec.__hash_code();} }; template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) { const typename vector<_Tp, _Allocator>::size_type __sz = __x.size(); return __sz == __y.size() && std::__1::equal(__x.begin(), __x.end(), __y.begin()); } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) { return !(__x == __y); } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator< (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) { return std::__1::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator> (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) { return __y < __x; } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) { return !(__x < __y); } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) { return !(__y < __x); } template <class _Tp, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(vector<_Tp, _Allocator>& __x, vector<_Tp, _Allocator>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } } } namespace std { inline namespace __1 { template <class _Tp, class _Container = deque<_Tp> > class queue; template <class _Tp, class _Container> __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y); template <class _Tp, class _Container> __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y); template <class _Tp, class _Container > class queue { public: typedef _Container container_type; typedef typename container_type::value_type value_type; typedef typename container_type::reference reference; typedef typename container_type::const_reference const_reference; typedef typename container_type::size_type size_type; static_assert((is_same<_Tp, value_type>::value), "" ); protected: container_type c; public: __attribute__ ((__exclude_from_explicit_instantiation__)) queue() noexcept(is_nothrow_default_constructible<container_type>::value) : c() {} __attribute__ ((__exclude_from_explicit_instantiation__)) queue(const queue& __q) : c(__q.c) {} __attribute__ ((__exclude_from_explicit_instantiation__)) queue& operator=(const queue& __q) {c = __q.c; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) queue(queue&& __q) noexcept(is_nothrow_move_constructible<container_type>::value) : c(std::__1::move(__q.c)) {} __attribute__ ((__exclude_from_explicit_instantiation__)) queue& operator=(queue&& __q) noexcept(is_nothrow_move_assignable<container_type>::value) {c = std::__1::move(__q.c); return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit queue(const container_type& __c) : c(__c) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit queue(container_type&& __c) : c(std::__1::move(__c)) {} template <class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) explicit queue(const _Alloc& __a, typename enable_if<uses_allocator<container_type, _Alloc>::value>::type* = 0) : c(__a) {} template <class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) queue(const queue& __q, const _Alloc& __a, typename enable_if<uses_allocator<container_type, _Alloc>::value>::type* = 0) : c(__q.c, __a) {} template <class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) queue(const container_type& __c, const _Alloc& __a, typename enable_if<uses_allocator<container_type, _Alloc>::value>::type* = 0) : c(__c, __a) {} template <class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) queue(container_type&& __c, const _Alloc& __a, typename enable_if<uses_allocator<container_type, _Alloc>::value>::type* = 0) : c(std::__1::move(__c), __a) {} template <class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) queue(queue&& __q, const _Alloc& __a, typename enable_if<uses_allocator<container_type, _Alloc>::value>::type* = 0) : c(std::__1::move(__q.c), __a) {} [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) bool empty() const {return c.empty();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type size() const {return c.size();} __attribute__ ((__exclude_from_explicit_instantiation__)) reference front() {return c.front();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference front() const {return c.front();} __attribute__ ((__exclude_from_explicit_instantiation__)) reference back() {return c.back();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference back() const {return c.back();} __attribute__ ((__exclude_from_explicit_instantiation__)) void push(const value_type& __v) {c.push_back(__v);} __attribute__ ((__exclude_from_explicit_instantiation__)) void push(value_type&& __v) {c.push_back(std::__1::move(__v));} template <class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) void emplace(_Args&&... __args) { c.emplace_back(std::__1::forward<_Args>(__args)...);} __attribute__ ((__exclude_from_explicit_instantiation__)) void pop() {c.pop_front();} __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(queue& __q) noexcept(__is_nothrow_swappable<container_type>::value) { using std::__1::swap; swap(c, __q.c); } template <class _T1, class _C1> friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y); template <class _T1, class _C1> friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator< (const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y); }; template <class _Tp, class _Container> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) { return __x.c == __y.c; } template <class _Tp, class _Container> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) { return __x.c < __y.c; } template <class _Tp, class _Container> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) { return !(__x == __y); } template <class _Tp, class _Container> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator> (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) { return __y < __x; } template <class _Tp, class _Container> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) { return !(__x < __y); } template <class _Tp, class _Container> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) { return !(__y < __x); } template <class _Tp, class _Container> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if< __is_swappable<_Container>::value, void >::type swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } template <class _Tp, class _Container, class _Alloc> struct uses_allocator<queue<_Tp, _Container>, _Alloc> : public uses_allocator<_Container, _Alloc> { }; template <class _Tp, class _Container = vector<_Tp>, class _Compare = less<typename _Container::value_type> > class priority_queue { public: typedef _Container container_type; typedef _Compare value_compare; typedef typename container_type::value_type value_type; typedef typename container_type::reference reference; typedef typename container_type::const_reference const_reference; typedef typename container_type::size_type size_type; static_assert((is_same<_Tp, value_type>::value), "" ); protected: container_type c; value_compare comp; public: __attribute__ ((__exclude_from_explicit_instantiation__)) priority_queue() noexcept(is_nothrow_default_constructible<container_type>::value && is_nothrow_default_constructible<value_compare>::value) : c(), comp() {} __attribute__ ((__exclude_from_explicit_instantiation__)) priority_queue(const priority_queue& __q) : c(__q.c), comp(__q.comp) {} __attribute__ ((__exclude_from_explicit_instantiation__)) priority_queue& operator=(const priority_queue& __q) {c = __q.c; comp = __q.comp; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) priority_queue(priority_queue&& __q) noexcept(is_nothrow_move_constructible<container_type>::value && is_nothrow_move_constructible<value_compare>::value) : c(std::__1::move(__q.c)), comp(std::__1::move(__q.comp)) {} __attribute__ ((__exclude_from_explicit_instantiation__)) priority_queue& operator=(priority_queue&& __q) noexcept(is_nothrow_move_assignable<container_type>::value && is_nothrow_move_assignable<value_compare>::value) {c = std::__1::move(__q.c); comp = std::__1::move(__q.comp); return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit priority_queue(const value_compare& __comp) : c(), comp(__comp) {} __attribute__ ((__exclude_from_explicit_instantiation__)) priority_queue(const value_compare& __comp, const container_type& __c); __attribute__ ((__exclude_from_explicit_instantiation__)) explicit priority_queue(const value_compare& __comp, container_type&& __c); template <class _InputIter> __attribute__ ((__exclude_from_explicit_instantiation__)) priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp = value_compare()); template <class _InputIter> __attribute__ ((__exclude_from_explicit_instantiation__)) priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, const container_type& __c); template <class _InputIter> __attribute__ ((__exclude_from_explicit_instantiation__)) priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, container_type&& __c); template <class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) explicit priority_queue(const _Alloc& __a, typename enable_if<uses_allocator<container_type, _Alloc>::value>::type* = 0); template <class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) priority_queue(const value_compare& __comp, const _Alloc& __a, typename enable_if<uses_allocator<container_type, _Alloc>::value>::type* = 0); template <class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) priority_queue(const value_compare& __comp, const container_type& __c, const _Alloc& __a, typename enable_if<uses_allocator<container_type, _Alloc>::value>::type* = 0); template <class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) priority_queue(const priority_queue& __q, const _Alloc& __a, typename enable_if<uses_allocator<container_type, _Alloc>::value>::type* = 0); template <class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) priority_queue(const value_compare& __comp, container_type&& __c, const _Alloc& __a, typename enable_if<uses_allocator<container_type, _Alloc>::value>::type* = 0); template <class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) priority_queue(priority_queue&& __q, const _Alloc& __a, typename enable_if<uses_allocator<container_type, _Alloc>::value>::type* = 0); [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) bool empty() const {return c.empty();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type size() const {return c.size();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference top() const {return c.front();} __attribute__ ((__exclude_from_explicit_instantiation__)) void push(const value_type& __v); __attribute__ ((__exclude_from_explicit_instantiation__)) void push(value_type&& __v); template <class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) void emplace(_Args&&... __args); __attribute__ ((__exclude_from_explicit_instantiation__)) void pop(); __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(priority_queue& __q) noexcept(__is_nothrow_swappable<container_type>::value && __is_nothrow_swappable<value_compare>::value); }; template <class _Tp, class _Container, class _Compare> inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp, const container_type& __c) : c(__c), comp(__comp) { std::__1::make_heap(c.begin(), c.end(), comp); } template <class _Tp, class _Container, class _Compare> inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp, container_type&& __c) : c(std::__1::move(__c)), comp(__comp) { std::__1::make_heap(c.begin(), c.end(), comp); } template <class _Tp, class _Container, class _Compare> template <class _InputIter> inline priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp) : c(__f, __l), comp(__comp) { std::__1::make_heap(c.begin(), c.end(), comp); } template <class _Tp, class _Container, class _Compare> template <class _InputIter> inline priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, const container_type& __c) : c(__c), comp(__comp) { c.insert(c.end(), __f, __l); std::__1::make_heap(c.begin(), c.end(), comp); } template <class _Tp, class _Container, class _Compare> template <class _InputIter> inline priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, container_type&& __c) : c(std::__1::move(__c)), comp(__comp) { c.insert(c.end(), __f, __l); std::__1::make_heap(c.begin(), c.end(), comp); } template <class _Tp, class _Container, class _Compare> template <class _Alloc> inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a, typename enable_if<uses_allocator<container_type, _Alloc>::value>::type*) : c(__a) { } template <class _Tp, class _Container, class _Compare> template <class _Alloc> inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp, const _Alloc& __a, typename enable_if<uses_allocator<container_type, _Alloc>::value>::type*) : c(__a), comp(__comp) { } template <class _Tp, class _Container, class _Compare> template <class _Alloc> inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp, const container_type& __c, const _Alloc& __a, typename enable_if<uses_allocator<container_type, _Alloc>::value>::type*) : c(__c, __a), comp(__comp) { std::__1::make_heap(c.begin(), c.end(), comp); } template <class _Tp, class _Container, class _Compare> template <class _Alloc> inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue& __q, const _Alloc& __a, typename enable_if<uses_allocator<container_type, _Alloc>::value>::type*) : c(__q.c, __a), comp(__q.comp) { std::__1::make_heap(c.begin(), c.end(), comp); } template <class _Tp, class _Container, class _Compare> template <class _Alloc> inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp, container_type&& __c, const _Alloc& __a, typename enable_if<uses_allocator<container_type, _Alloc>::value>::type*) : c(std::__1::move(__c), __a), comp(__comp) { std::__1::make_heap(c.begin(), c.end(), comp); } template <class _Tp, class _Container, class _Compare> template <class _Alloc> inline priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q, const _Alloc& __a, typename enable_if<uses_allocator<container_type, _Alloc>::value>::type*) : c(std::__1::move(__q.c), __a), comp(std::__1::move(__q.comp)) { std::__1::make_heap(c.begin(), c.end(), comp); } template <class _Tp, class _Container, class _Compare> inline void priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v) { c.push_back(__v); std::__1::push_heap(c.begin(), c.end(), comp); } template <class _Tp, class _Container, class _Compare> inline void priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v) { c.push_back(std::__1::move(__v)); std::__1::push_heap(c.begin(), c.end(), comp); } template <class _Tp, class _Container, class _Compare> template <class... _Args> inline void priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args) { c.emplace_back(std::__1::forward<_Args>(__args)...); std::__1::push_heap(c.begin(), c.end(), comp); } template <class _Tp, class _Container, class _Compare> inline void priority_queue<_Tp, _Container, _Compare>::pop() { std::__1::pop_heap(c.begin(), c.end(), comp); c.pop_back(); } template <class _Tp, class _Container, class _Compare> inline void priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q) noexcept(__is_nothrow_swappable<container_type>::value && __is_nothrow_swappable<value_compare>::value) { using std::__1::swap; swap(c, __q.c); swap(comp, __q.comp); } template <class _Tp, class _Container, class _Compare> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if< __is_swappable<_Container>::value && __is_swappable<_Compare>::value, void >::type swap(priority_queue<_Tp, _Container, _Compare>& __x, priority_queue<_Tp, _Container, _Compare>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } template <class _Tp, class _Container, class _Compare, class _Alloc> struct uses_allocator<priority_queue<_Tp, _Container, _Compare>, _Alloc> : public uses_allocator<_Container, _Alloc> { }; } } namespace std { inline namespace __1 { template <class _Key, class _Compare, class _Allocator> class multiset; template <class _Key, class _Compare = less<_Key>, class _Allocator = allocator<_Key> > class set { public: typedef _Key key_type; typedef key_type value_type; typedef _Compare key_compare; typedef key_compare value_compare; typedef typename __identity<_Allocator>::type allocator_type; typedef value_type& reference; typedef const value_type& const_reference; static_assert((is_same<typename allocator_type::value_type, value_type>::value), "Allocator::value_type must be same type as value_type"); private: typedef __tree<value_type, value_compare, allocator_type> __base; typedef allocator_traits<allocator_type> __alloc_traits; typedef typename __base::__node_holder __node_holder; __base __tree_; public: typedef typename __base::pointer pointer; typedef typename __base::const_pointer const_pointer; typedef typename __base::size_type size_type; typedef typename __base::difference_type difference_type; typedef typename __base::const_iterator iterator; typedef typename __base::const_iterator const_iterator; typedef std::__1::reverse_iterator<iterator> reverse_iterator; typedef std::__1::reverse_iterator<const_iterator> const_reverse_iterator; template <class _Key2, class _Compare2, class _Alloc2> friend class set; template <class _Key2, class _Compare2, class _Alloc2> friend class multiset; __attribute__ ((__exclude_from_explicit_instantiation__)) set() noexcept(is_nothrow_default_constructible<allocator_type>::value && is_nothrow_default_constructible<key_compare>::value && is_nothrow_copy_constructible<key_compare>::value) : __tree_(value_compare()) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit set(const value_compare& __comp) noexcept(is_nothrow_default_constructible<allocator_type>::value && is_nothrow_copy_constructible<key_compare>::value) : __tree_(__comp) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit set(const value_compare& __comp, const allocator_type& __a) : __tree_(__comp, __a) {} template <class _InputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) set(_InputIterator __f, _InputIterator __l, const value_compare& __comp = value_compare()) : __tree_(__comp) { insert(__f, __l); } template <class _InputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) set(_InputIterator __f, _InputIterator __l, const value_compare& __comp, const allocator_type& __a) : __tree_(__comp, __a) { insert(__f, __l); } template <class _InputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) set(_InputIterator __f, _InputIterator __l, const allocator_type& __a) : set(__f, __l, key_compare(), __a) {} __attribute__ ((__exclude_from_explicit_instantiation__)) set(const set& __s) : __tree_(__s.__tree_) { insert(__s.begin(), __s.end()); } __attribute__ ((__exclude_from_explicit_instantiation__)) set& operator=(const set& __s) { __tree_ = __s.__tree_; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) set(set&& __s) noexcept(is_nothrow_move_constructible<__base>::value) : __tree_(std::__1::move(__s.__tree_)) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit set(const allocator_type& __a) : __tree_(__a) {} __attribute__ ((__exclude_from_explicit_instantiation__)) set(const set& __s, const allocator_type& __a) : __tree_(__s.__tree_.value_comp(), __a) { insert(__s.begin(), __s.end()); } set(set&& __s, const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) set(initializer_list<value_type> __il, const value_compare& __comp = value_compare()) : __tree_(__comp) { insert(__il.begin(), __il.end()); } __attribute__ ((__exclude_from_explicit_instantiation__)) set(initializer_list<value_type> __il, const value_compare& __comp, const allocator_type& __a) : __tree_(__comp, __a) { insert(__il.begin(), __il.end()); } __attribute__ ((__exclude_from_explicit_instantiation__)) set(initializer_list<value_type> __il, const allocator_type& __a) : set(__il, key_compare(), __a) {} __attribute__ ((__exclude_from_explicit_instantiation__)) set& operator=(initializer_list<value_type> __il) { __tree_.__assign_unique(__il.begin(), __il.end()); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) set& operator=(set&& __s) noexcept(is_nothrow_move_assignable<__base>::value) { __tree_ = std::__1::move(__s.__tree_); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) ~set() { static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); } __attribute__ ((__exclude_from_explicit_instantiation__)) iterator begin() noexcept {return __tree_.begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator begin() const noexcept {return __tree_.begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator end() noexcept {return __tree_.end();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator end() const noexcept {return __tree_.end();} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator rbegin() noexcept {return reverse_iterator(end());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator rbegin() const noexcept {return const_reverse_iterator(end());} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator rend() noexcept {return reverse_iterator(begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator rend() const noexcept {return const_reverse_iterator(begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cbegin() const noexcept {return begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cend() const noexcept {return end();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator crbegin() const noexcept {return rbegin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator crend() const noexcept {return rend();} [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) bool empty() const noexcept {return __tree_.size() == 0;} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type size() const noexcept {return __tree_.size();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type max_size() const noexcept {return __tree_.max_size();} template <class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> emplace(_Args&&... __args) {return __tree_.__emplace_unique(std::__1::forward<_Args>(__args)...);} template <class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator emplace_hint(const_iterator __p, _Args&&... __args) {return __tree_.__emplace_hint_unique(__p, std::__1::forward<_Args>(__args)...);} __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator,bool> insert(const value_type& __v) {return __tree_.__insert_unique(__v);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const_iterator __p, const value_type& __v) {return __tree_.__insert_unique(__p, __v);} template <class _InputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) void insert(_InputIterator __f, _InputIterator __l) { for (const_iterator __e = cend(); __f != __l; ++__f) __tree_.__insert_unique(__e, *__f); } __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator,bool> insert(value_type&& __v) {return __tree_.__insert_unique(std::__1::move(__v));} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const_iterator __p, value_type&& __v) {return __tree_.__insert_unique(__p, std::__1::move(__v));} __attribute__ ((__exclude_from_explicit_instantiation__)) void insert(initializer_list<value_type> __il) {insert(__il.begin(), __il.end());} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator erase(const_iterator __p) {return __tree_.erase(__p);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type erase(const key_type& __k) {return __tree_.__erase_unique(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator erase(const_iterator __f, const_iterator __l) {return __tree_.erase(__f, __l);} __attribute__ ((__exclude_from_explicit_instantiation__)) void clear() noexcept {__tree_.clear();} __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(set& __s) noexcept(__is_nothrow_swappable<__base>::value) {__tree_.swap(__s.__tree_);} __attribute__ ((__exclude_from_explicit_instantiation__)) allocator_type get_allocator() const noexcept {return __tree_.__alloc();} __attribute__ ((__exclude_from_explicit_instantiation__)) key_compare key_comp() const {return __tree_.value_comp();} __attribute__ ((__exclude_from_explicit_instantiation__)) value_compare value_comp() const {return __tree_.value_comp();} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator find(const key_type& __k) {return __tree_.find(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator find(const key_type& __k) const {return __tree_.find(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type find(const _K2& __k) {return __tree_.find(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type find(const _K2& __k) const {return __tree_.find(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type count(const key_type& __k) const {return __tree_.__count_unique(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type count(const _K2& __k) const {return __tree_.__count_multi(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator lower_bound(const key_type& __k) {return __tree_.lower_bound(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator lower_bound(const key_type& __k) const {return __tree_.lower_bound(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator upper_bound(const key_type& __k) {return __tree_.upper_bound(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator upper_bound(const key_type& __k) const {return __tree_.upper_bound(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator,iterator> equal_range(const key_type& __k) {return __tree_.__equal_range_unique(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) pair<const_iterator,const_iterator> equal_range(const key_type& __k) const {return __tree_.__equal_range_unique(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);} }; template <class _Key, class _Compare, class _Allocator> set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a) : __tree_(std::__1::move(__s.__tree_), __a) { if (__a != __s.get_allocator()) { const_iterator __e = cend(); while (!__s.empty()) insert(__e, std::__1::move(__s.__tree_.remove(__s.begin())->__value_)); } } template <class _Key, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { return __x.size() == __y.size() && std::__1::equal(__x.begin(), __x.end(), __y.begin()); } template <class _Key, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator< (const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { return std::__1::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); } template <class _Key, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { return !(__x == __y); } template <class _Key, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator> (const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { return __y < __x; } template <class _Key, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { return !(__x < __y); } template <class _Key, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) { return !(__y < __x); } template <class _Key, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(set<_Key, _Compare, _Allocator>& __x, set<_Key, _Compare, _Allocator>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } template <class _Key, class _Compare = less<_Key>, class _Allocator = allocator<_Key> > class multiset { public: typedef _Key key_type; typedef key_type value_type; typedef _Compare key_compare; typedef key_compare value_compare; typedef typename __identity<_Allocator>::type allocator_type; typedef value_type& reference; typedef const value_type& const_reference; static_assert((is_same<typename allocator_type::value_type, value_type>::value), "Allocator::value_type must be same type as value_type"); private: typedef __tree<value_type, value_compare, allocator_type> __base; typedef allocator_traits<allocator_type> __alloc_traits; typedef typename __base::__node_holder __node_holder; __base __tree_; public: typedef typename __base::pointer pointer; typedef typename __base::const_pointer const_pointer; typedef typename __base::size_type size_type; typedef typename __base::difference_type difference_type; typedef typename __base::const_iterator iterator; typedef typename __base::const_iterator const_iterator; typedef std::__1::reverse_iterator<iterator> reverse_iterator; typedef std::__1::reverse_iterator<const_iterator> const_reverse_iterator; template <class _Key2, class _Compare2, class _Alloc2> friend class set; template <class _Key2, class _Compare2, class _Alloc2> friend class multiset; __attribute__ ((__exclude_from_explicit_instantiation__)) multiset() noexcept(is_nothrow_default_constructible<allocator_type>::value && is_nothrow_default_constructible<key_compare>::value && is_nothrow_copy_constructible<key_compare>::value) : __tree_(value_compare()) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit multiset(const value_compare& __comp) noexcept(is_nothrow_default_constructible<allocator_type>::value && is_nothrow_copy_constructible<key_compare>::value) : __tree_(__comp) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit multiset(const value_compare& __comp, const allocator_type& __a) : __tree_(__comp, __a) {} template <class _InputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) multiset(_InputIterator __f, _InputIterator __l, const value_compare& __comp = value_compare()) : __tree_(__comp) { insert(__f, __l); } template <class _InputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a) : multiset(__f, __l, key_compare(), __a) {} template <class _InputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) multiset(_InputIterator __f, _InputIterator __l, const value_compare& __comp, const allocator_type& __a) : __tree_(__comp, __a) { insert(__f, __l); } __attribute__ ((__exclude_from_explicit_instantiation__)) multiset(const multiset& __s) : __tree_(__s.__tree_.value_comp(), __alloc_traits::select_on_container_copy_construction(__s.__tree_.__alloc())) { insert(__s.begin(), __s.end()); } __attribute__ ((__exclude_from_explicit_instantiation__)) multiset& operator=(const multiset& __s) { __tree_ = __s.__tree_; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) multiset(multiset&& __s) noexcept(is_nothrow_move_constructible<__base>::value) : __tree_(std::__1::move(__s.__tree_)) {} multiset(multiset&& __s, const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) explicit multiset(const allocator_type& __a) : __tree_(__a) {} __attribute__ ((__exclude_from_explicit_instantiation__)) multiset(const multiset& __s, const allocator_type& __a) : __tree_(__s.__tree_.value_comp(), __a) { insert(__s.begin(), __s.end()); } __attribute__ ((__exclude_from_explicit_instantiation__)) multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare()) : __tree_(__comp) { insert(__il.begin(), __il.end()); } __attribute__ ((__exclude_from_explicit_instantiation__)) multiset(initializer_list<value_type> __il, const value_compare& __comp, const allocator_type& __a) : __tree_(__comp, __a) { insert(__il.begin(), __il.end()); } __attribute__ ((__exclude_from_explicit_instantiation__)) multiset(initializer_list<value_type> __il, const allocator_type& __a) : multiset(__il, key_compare(), __a) {} __attribute__ ((__exclude_from_explicit_instantiation__)) multiset& operator=(initializer_list<value_type> __il) { __tree_.__assign_multi(__il.begin(), __il.end()); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) multiset& operator=(multiset&& __s) noexcept(is_nothrow_move_assignable<__base>::value) { __tree_ = std::__1::move(__s.__tree_); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) ~multiset() { static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); } __attribute__ ((__exclude_from_explicit_instantiation__)) iterator begin() noexcept {return __tree_.begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator begin() const noexcept {return __tree_.begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator end() noexcept {return __tree_.end();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator end() const noexcept {return __tree_.end();} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator rbegin() noexcept {return reverse_iterator(end());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator rbegin() const noexcept {return const_reverse_iterator(end());} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator rend() noexcept {return reverse_iterator(begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator rend() const noexcept {return const_reverse_iterator(begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cbegin() const noexcept {return begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cend() const noexcept {return end();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator crbegin() const noexcept {return rbegin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator crend() const noexcept {return rend();} [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) bool empty() const noexcept {return __tree_.size() == 0;} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type size() const noexcept {return __tree_.size();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type max_size() const noexcept {return __tree_.max_size();} template <class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator emplace(_Args&&... __args) {return __tree_.__emplace_multi(std::__1::forward<_Args>(__args)...);} template <class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator emplace_hint(const_iterator __p, _Args&&... __args) {return __tree_.__emplace_hint_multi(__p, std::__1::forward<_Args>(__args)...);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const value_type& __v) {return __tree_.__insert_multi(__v);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const_iterator __p, const value_type& __v) {return __tree_.__insert_multi(__p, __v);} template <class _InputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) void insert(_InputIterator __f, _InputIterator __l) { for (const_iterator __e = cend(); __f != __l; ++__f) __tree_.__insert_multi(__e, *__f); } __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(value_type&& __v) {return __tree_.__insert_multi(std::__1::move(__v));} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const_iterator __p, value_type&& __v) {return __tree_.__insert_multi(__p, std::__1::move(__v));} __attribute__ ((__exclude_from_explicit_instantiation__)) void insert(initializer_list<value_type> __il) {insert(__il.begin(), __il.end());} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator erase(const_iterator __p) {return __tree_.erase(__p);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator erase(const_iterator __f, const_iterator __l) {return __tree_.erase(__f, __l);} __attribute__ ((__exclude_from_explicit_instantiation__)) void clear() noexcept {__tree_.clear();} __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(multiset& __s) noexcept(__is_nothrow_swappable<__base>::value) {__tree_.swap(__s.__tree_);} __attribute__ ((__exclude_from_explicit_instantiation__)) allocator_type get_allocator() const noexcept {return __tree_.__alloc();} __attribute__ ((__exclude_from_explicit_instantiation__)) key_compare key_comp() const {return __tree_.value_comp();} __attribute__ ((__exclude_from_explicit_instantiation__)) value_compare value_comp() const {return __tree_.value_comp();} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator find(const key_type& __k) {return __tree_.find(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator find(const key_type& __k) const {return __tree_.find(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::__1::enable_if<std::__1::__is_transparent<_Compare, _K2>::value,iterator>::type find(const _K2& __k) {return __tree_.find(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::__1::enable_if<std::__1::__is_transparent<_Compare, _K2>::value,const_iterator>::type find(const _K2& __k) const {return __tree_.find(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type count(const key_type& __k) const {return __tree_.__count_multi(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type count(const _K2& __k) const {return __tree_.__count_multi(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator lower_bound(const key_type& __k) {return __tree_.lower_bound(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator lower_bound(const key_type& __k) const {return __tree_.lower_bound(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::__1::enable_if<std::__1::__is_transparent<_Compare, _K2>::value,iterator>::type lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::__1::enable_if<std::__1::__is_transparent<_Compare, _K2>::value,const_iterator>::type lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator upper_bound(const key_type& __k) {return __tree_.upper_bound(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator upper_bound(const key_type& __k) const {return __tree_.upper_bound(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::__1::enable_if<std::__1::__is_transparent<_Compare, _K2>::value,iterator>::type upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::__1::enable_if<std::__1::__is_transparent<_Compare, _K2>::value,const_iterator>::type upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator,iterator> equal_range(const key_type& __k) {return __tree_.__equal_range_multi(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) pair<const_iterator,const_iterator> equal_range(const key_type& __k) const {return __tree_.__equal_range_multi(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::__1::enable_if<std::__1::__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);} template <typename _K2> __attribute__ ((__exclude_from_explicit_instantiation__)) typename std::__1::enable_if<std::__1::__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);} }; template <class _Key, class _Compare, class _Allocator> multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a) : __tree_(std::__1::move(__s.__tree_), __a) { if (__a != __s.get_allocator()) { const_iterator __e = cend(); while (!__s.empty()) insert(__e, std::__1::move(__s.__tree_.remove(__s.begin())->__value_)); } } template <class _Key, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { return __x.size() == __y.size() && std::__1::equal(__x.begin(), __x.end(), __y.begin()); } template <class _Key, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator< (const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { return std::__1::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); } template <class _Key, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { return !(__x == __y); } template <class _Key, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator> (const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { return __y < __x; } template <class _Key, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { return !(__x < __y); } template <class _Key, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) { return !(__y < __x); } template <class _Key, class _Compare, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(multiset<_Key, _Compare, _Allocator>& __x, multiset<_Key, _Compare, _Allocator>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } } } namespace std { inline namespace __1 { template <class _CharT, class _Traits, class _Allocator> class basic_stringbuf : public basic_streambuf<_CharT, _Traits> { public: typedef _CharT char_type; typedef _Traits traits_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; typedef _Allocator allocator_type; typedef basic_string<char_type, traits_type, allocator_type> string_type; private: string_type __str_; mutable char_type* __hm_; ios_base::openmode __mode_; public: inline __attribute__ ((__exclude_from_explicit_instantiation__)) explicit basic_stringbuf(ios_base::openmode __wch = ios_base::in | ios_base::out); inline __attribute__ ((__exclude_from_explicit_instantiation__)) explicit basic_stringbuf(const string_type& __s, ios_base::openmode __wch = ios_base::in | ios_base::out); basic_stringbuf(basic_stringbuf&& __rhs); basic_stringbuf& operator=(basic_stringbuf&& __rhs); void swap(basic_stringbuf& __rhs); string_type str() const; void str(const string_type& __s); protected: virtual int_type underflow(); virtual int_type pbackfail(int_type __c = traits_type::eof()); virtual int_type overflow (int_type __c = traits_type::eof()); virtual pos_type seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __wch = ios_base::in | ios_base::out); inline __attribute__ ((__exclude_from_explicit_instantiation__)) virtual pos_type seekpos(pos_type __sp, ios_base::openmode __wch = ios_base::in | ios_base::out); }; template <class _CharT, class _Traits, class _Allocator> basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(ios_base::openmode __wch) : __hm_(0), __mode_(__wch) { } template <class _CharT, class _Traits, class _Allocator> basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(const string_type& __s, ios_base::openmode __wch) : __str_(__s.get_allocator()), __hm_(0), __mode_(__wch) { str(__s); } template <class _CharT, class _Traits, class _Allocator> basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(basic_stringbuf&& __rhs) : __mode_(__rhs.__mode_) { char_type* __p = const_cast<char_type*>(__rhs.__str_.data()); ptrdiff_t __binp = -1; ptrdiff_t __ninp = -1; ptrdiff_t __einp = -1; if (__rhs.eback() != nullptr) { __binp = __rhs.eback() - __p; __ninp = __rhs.gptr() - __p; __einp = __rhs.egptr() - __p; } ptrdiff_t __bout = -1; ptrdiff_t __nout = -1; ptrdiff_t __eout = -1; if (__rhs.pbase() != nullptr) { __bout = __rhs.pbase() - __p; __nout = __rhs.pptr() - __p; __eout = __rhs.epptr() - __p; } ptrdiff_t __hm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p; __str_ = std::__1::move(__rhs.__str_); __p = const_cast<char_type*>(__str_.data()); if (__binp != -1) this->setg(__p + __binp, __p + __ninp, __p + __einp); if (__bout != -1) { this->setp(__p + __bout, __p + __eout); this->__pbump(__nout); } __hm_ = __hm == -1 ? nullptr : __p + __hm; __p = const_cast<char_type*>(__rhs.__str_.data()); __rhs.setg(__p, __p, __p); __rhs.setp(__p, __p); __rhs.__hm_ = __p; this->pubimbue(__rhs.getloc()); } template <class _CharT, class _Traits, class _Allocator> basic_stringbuf<_CharT, _Traits, _Allocator>& basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs) { char_type* __p = const_cast<char_type*>(__rhs.__str_.data()); ptrdiff_t __binp = -1; ptrdiff_t __ninp = -1; ptrdiff_t __einp = -1; if (__rhs.eback() != nullptr) { __binp = __rhs.eback() - __p; __ninp = __rhs.gptr() - __p; __einp = __rhs.egptr() - __p; } ptrdiff_t __bout = -1; ptrdiff_t __nout = -1; ptrdiff_t __eout = -1; if (__rhs.pbase() != nullptr) { __bout = __rhs.pbase() - __p; __nout = __rhs.pptr() - __p; __eout = __rhs.epptr() - __p; } ptrdiff_t __hm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p; __str_ = std::__1::move(__rhs.__str_); __p = const_cast<char_type*>(__str_.data()); if (__binp != -1) this->setg(__p + __binp, __p + __ninp, __p + __einp); else this->setg(nullptr, nullptr, nullptr); if (__bout != -1) { this->setp(__p + __bout, __p + __eout); this->__pbump(__nout); } else this->setp(nullptr, nullptr); __hm_ = __hm == -1 ? nullptr : __p + __hm; __mode_ = __rhs.__mode_; __p = const_cast<char_type*>(__rhs.__str_.data()); __rhs.setg(__p, __p, __p); __rhs.setp(__p, __p); __rhs.__hm_ = __p; this->pubimbue(__rhs.getloc()); return *this; } template <class _CharT, class _Traits, class _Allocator> void basic_stringbuf<_CharT, _Traits, _Allocator>::swap(basic_stringbuf& __rhs) { char_type* __p = const_cast<char_type*>(__rhs.__str_.data()); ptrdiff_t __rbinp = -1; ptrdiff_t __rninp = -1; ptrdiff_t __reinp = -1; if (__rhs.eback() != nullptr) { __rbinp = __rhs.eback() - __p; __rninp = __rhs.gptr() - __p; __reinp = __rhs.egptr() - __p; } ptrdiff_t __rbout = -1; ptrdiff_t __rnout = -1; ptrdiff_t __reout = -1; if (__rhs.pbase() != nullptr) { __rbout = __rhs.pbase() - __p; __rnout = __rhs.pptr() - __p; __reout = __rhs.epptr() - __p; } ptrdiff_t __rhm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p; __p = const_cast<char_type*>(__str_.data()); ptrdiff_t __lbinp = -1; ptrdiff_t __lninp = -1; ptrdiff_t __leinp = -1; if (this->eback() != nullptr) { __lbinp = this->eback() - __p; __lninp = this->gptr() - __p; __leinp = this->egptr() - __p; } ptrdiff_t __lbout = -1; ptrdiff_t __lnout = -1; ptrdiff_t __leout = -1; if (this->pbase() != nullptr) { __lbout = this->pbase() - __p; __lnout = this->pptr() - __p; __leout = this->epptr() - __p; } ptrdiff_t __lhm = __hm_ == nullptr ? -1 : __hm_ - __p; std::__1::swap(__mode_, __rhs.__mode_); __str_.swap(__rhs.__str_); __p = const_cast<char_type*>(__str_.data()); if (__rbinp != -1) this->setg(__p + __rbinp, __p + __rninp, __p + __reinp); else this->setg(nullptr, nullptr, nullptr); if (__rbout != -1) { this->setp(__p + __rbout, __p + __reout); this->__pbump(__rnout); } else this->setp(nullptr, nullptr); __hm_ = __rhm == -1 ? nullptr : __p + __rhm; __p = const_cast<char_type*>(__rhs.__str_.data()); if (__lbinp != -1) __rhs.setg(__p + __lbinp, __p + __lninp, __p + __leinp); else __rhs.setg(nullptr, nullptr, nullptr); if (__lbout != -1) { __rhs.setp(__p + __lbout, __p + __leout); __rhs.__pbump(__lnout); } else __rhs.setp(nullptr, nullptr); __rhs.__hm_ = __lhm == -1 ? nullptr : __p + __lhm; locale __tl = __rhs.getloc(); __rhs.pubimbue(this->getloc()); this->pubimbue(__tl); } template <class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x, basic_stringbuf<_CharT, _Traits, _Allocator>& __y) { __x.swap(__y); } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator> basic_stringbuf<_CharT, _Traits, _Allocator>::str() const { if (__mode_ & ios_base::out) { if (__hm_ < this->pptr()) __hm_ = this->pptr(); return string_type(this->pbase(), __hm_, __str_.get_allocator()); } else if (__mode_ & ios_base::in) return string_type(this->eback(), this->egptr(), __str_.get_allocator()); return string_type(__str_.get_allocator()); } template <class _CharT, class _Traits, class _Allocator> void basic_stringbuf<_CharT, _Traits, _Allocator>::str(const string_type& __s) { __str_ = __s; __hm_ = 0; if (__mode_ & ios_base::in) { __hm_ = const_cast<char_type*>(__str_.data()) + __str_.size(); this->setg(const_cast<char_type*>(__str_.data()), const_cast<char_type*>(__str_.data()), __hm_); } if (__mode_ & ios_base::out) { typename string_type::size_type __sz = __str_.size(); __hm_ = const_cast<char_type*>(__str_.data()) + __sz; __str_.resize(__str_.capacity()); this->setp(const_cast<char_type*>(__str_.data()), const_cast<char_type*>(__str_.data()) + __str_.size()); if (__mode_ & (ios_base::app | ios_base::ate)) { while (__sz > 2147483647) { this->pbump(2147483647); __sz -= 2147483647; } if (__sz > 0) this->pbump(__sz); } } } template <class _CharT, class _Traits, class _Allocator> typename basic_stringbuf<_CharT, _Traits, _Allocator>::int_type basic_stringbuf<_CharT, _Traits, _Allocator>::underflow() { if (__hm_ < this->pptr()) __hm_ = this->pptr(); if (__mode_ & ios_base::in) { if (this->egptr() < __hm_) this->setg(this->eback(), this->gptr(), __hm_); if (this->gptr() < this->egptr()) return traits_type::to_int_type(*this->gptr()); } return traits_type::eof(); } template <class _CharT, class _Traits, class _Allocator> typename basic_stringbuf<_CharT, _Traits, _Allocator>::int_type basic_stringbuf<_CharT, _Traits, _Allocator>::pbackfail(int_type __c) { if (__hm_ < this->pptr()) __hm_ = this->pptr(); if (this->eback() < this->gptr()) { if (traits_type::eq_int_type(__c, traits_type::eof())) { this->setg(this->eback(), this->gptr()-1, __hm_); return traits_type::not_eof(__c); } if ((__mode_ & ios_base::out) || traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1])) { this->setg(this->eback(), this->gptr()-1, __hm_); *this->gptr() = traits_type::to_char_type(__c); return __c; } } return traits_type::eof(); } template <class _CharT, class _Traits, class _Allocator> typename basic_stringbuf<_CharT, _Traits, _Allocator>::int_type basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c) { if (!traits_type::eq_int_type(__c, traits_type::eof())) { ptrdiff_t __ninp = this->gptr() - this->eback(); if (this->pptr() == this->epptr()) { if (!(__mode_ & ios_base::out)) return traits_type::eof(); ptrdiff_t __nout = this->pptr() - this->pbase(); ptrdiff_t __hm = __hm_ - this->pbase(); __str_.push_back(char_type()); __str_.resize(__str_.capacity()); char_type* __p = const_cast<char_type*>(__str_.data()); this->setp(__p, __p + __str_.size()); this->__pbump(__nout); __hm_ = this->pbase() + __hm; } __hm_ = std::__1::max(this->pptr() + 1, __hm_); if (__mode_ & ios_base::in) { char_type* __p = const_cast<char_type*>(__str_.data()); this->setg(__p, __p + __ninp, __hm_); } return this->sputc(traits_type::to_char_type(__c)); } return traits_type::not_eof(__c); } template <class _CharT, class _Traits, class _Allocator> typename basic_stringbuf<_CharT, _Traits, _Allocator>::pos_type basic_stringbuf<_CharT, _Traits, _Allocator>::seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __wch) { if (__hm_ < this->pptr()) __hm_ = this->pptr(); if ((__wch & (ios_base::in | ios_base::out)) == 0) return pos_type(-1); if ((__wch & (ios_base::in | ios_base::out)) == (ios_base::in | ios_base::out) && __way == ios_base::cur) return pos_type(-1); const ptrdiff_t __hm = __hm_ == nullptr ? 0 : __hm_ - __str_.data(); off_type __noff; switch (__way) { case ios_base::beg: __noff = 0; break; case ios_base::cur: if (__wch & ios_base::in) __noff = this->gptr() - this->eback(); else __noff = this->pptr() - this->pbase(); break; case ios_base::end: __noff = __hm; break; default: return pos_type(-1); } __noff += __off; if (__noff < 0 || __hm < __noff) return pos_type(-1); if (__noff != 0) { if ((__wch & ios_base::in) && this->gptr() == 0) return pos_type(-1); if ((__wch & ios_base::out) && this->pptr() == 0) return pos_type(-1); } if (__wch & ios_base::in) this->setg(this->eback(), this->eback() + __noff, __hm_); if (__wch & ios_base::out) { this->setp(this->pbase(), this->epptr()); this->pbump(__noff); } return pos_type(__noff); } template <class _CharT, class _Traits, class _Allocator> typename basic_stringbuf<_CharT, _Traits, _Allocator>::pos_type basic_stringbuf<_CharT, _Traits, _Allocator>::seekpos(pos_type __sp, ios_base::openmode __wch) { return seekoff(__sp, ios_base::beg, __wch); } template <class _CharT, class _Traits, class _Allocator> class basic_istringstream : public basic_istream<_CharT, _Traits> { public: typedef _CharT char_type; typedef _Traits traits_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; typedef _Allocator allocator_type; typedef basic_string<char_type, traits_type, allocator_type> string_type; private: basic_stringbuf<char_type, traits_type, allocator_type> __sb_; public: inline __attribute__ ((__exclude_from_explicit_instantiation__)) explicit basic_istringstream(ios_base::openmode __wch = ios_base::in); inline __attribute__ ((__exclude_from_explicit_instantiation__)) explicit basic_istringstream(const string_type& __s, ios_base::openmode __wch = ios_base::in); inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_istringstream(basic_istringstream&& __rhs); basic_istringstream& operator=(basic_istringstream&& __rhs); inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(basic_istringstream& __rhs); inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const; inline __attribute__ ((__exclude_from_explicit_instantiation__)) string_type str() const; inline __attribute__ ((__exclude_from_explicit_instantiation__)) void str(const string_type& __s); }; template <class _CharT, class _Traits, class _Allocator> basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(ios_base::openmode __wch) : basic_istream<_CharT, _Traits>(&__sb_), __sb_(__wch | ios_base::in) { } template <class _CharT, class _Traits, class _Allocator> basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(const string_type& __s, ios_base::openmode __wch) : basic_istream<_CharT, _Traits>(&__sb_), __sb_(__s, __wch | ios_base::in) { } template <class _CharT, class _Traits, class _Allocator> basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(basic_istringstream&& __rhs) : basic_istream<_CharT, _Traits>(std::__1::move(__rhs)), __sb_(std::__1::move(__rhs.__sb_)) { basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_); } template <class _CharT, class _Traits, class _Allocator> basic_istringstream<_CharT, _Traits, _Allocator>& basic_istringstream<_CharT, _Traits, _Allocator>::operator=(basic_istringstream&& __rhs) { basic_istream<char_type, traits_type>::operator=(std::__1::move(__rhs)); __sb_ = std::__1::move(__rhs.__sb_); return *this; } template <class _CharT, class _Traits, class _Allocator> void basic_istringstream<_CharT, _Traits, _Allocator>::swap(basic_istringstream& __rhs) { basic_istream<char_type, traits_type>::swap(__rhs); __sb_.swap(__rhs.__sb_); } template <class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x, basic_istringstream<_CharT, _Traits, _Allocator>& __y) { __x.swap(__y); } template <class _CharT, class _Traits, class _Allocator> basic_stringbuf<_CharT, _Traits, _Allocator>* basic_istringstream<_CharT, _Traits, _Allocator>::rdbuf() const { return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_); } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator> basic_istringstream<_CharT, _Traits, _Allocator>::str() const { return __sb_.str(); } template <class _CharT, class _Traits, class _Allocator> void basic_istringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s) { __sb_.str(__s); } template <class _CharT, class _Traits, class _Allocator> class basic_ostringstream : public basic_ostream<_CharT, _Traits> { public: typedef _CharT char_type; typedef _Traits traits_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; typedef _Allocator allocator_type; typedef basic_string<char_type, traits_type, allocator_type> string_type; private: basic_stringbuf<char_type, traits_type, allocator_type> __sb_; public: inline __attribute__ ((__exclude_from_explicit_instantiation__)) explicit basic_ostringstream(ios_base::openmode __wch = ios_base::out); inline __attribute__ ((__exclude_from_explicit_instantiation__)) explicit basic_ostringstream(const string_type& __s, ios_base::openmode __wch = ios_base::out); inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_ostringstream(basic_ostringstream&& __rhs); basic_ostringstream& operator=(basic_ostringstream&& __rhs); inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(basic_ostringstream& __rhs); inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const; inline __attribute__ ((__exclude_from_explicit_instantiation__)) string_type str() const; inline __attribute__ ((__exclude_from_explicit_instantiation__)) void str(const string_type& __s); }; template <class _CharT, class _Traits, class _Allocator> basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(ios_base::openmode __wch) : basic_ostream<_CharT, _Traits>(&__sb_), __sb_(__wch | ios_base::out) { } template <class _CharT, class _Traits, class _Allocator> basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(const string_type& __s, ios_base::openmode __wch) : basic_ostream<_CharT, _Traits>(&__sb_), __sb_(__s, __wch | ios_base::out) { } template <class _CharT, class _Traits, class _Allocator> basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(basic_ostringstream&& __rhs) : basic_ostream<_CharT, _Traits>(std::__1::move(__rhs)), __sb_(std::__1::move(__rhs.__sb_)) { basic_ostream<_CharT, _Traits>::set_rdbuf(&__sb_); } template <class _CharT, class _Traits, class _Allocator> basic_ostringstream<_CharT, _Traits, _Allocator>& basic_ostringstream<_CharT, _Traits, _Allocator>::operator=(basic_ostringstream&& __rhs) { basic_ostream<char_type, traits_type>::operator=(std::__1::move(__rhs)); __sb_ = std::__1::move(__rhs.__sb_); return *this; } template <class _CharT, class _Traits, class _Allocator> void basic_ostringstream<_CharT, _Traits, _Allocator>::swap(basic_ostringstream& __rhs) { basic_ostream<char_type, traits_type>::swap(__rhs); __sb_.swap(__rhs.__sb_); } template <class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x, basic_ostringstream<_CharT, _Traits, _Allocator>& __y) { __x.swap(__y); } template <class _CharT, class _Traits, class _Allocator> basic_stringbuf<_CharT, _Traits, _Allocator>* basic_ostringstream<_CharT, _Traits, _Allocator>::rdbuf() const { return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_); } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator> basic_ostringstream<_CharT, _Traits, _Allocator>::str() const { return __sb_.str(); } template <class _CharT, class _Traits, class _Allocator> void basic_ostringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s) { __sb_.str(__s); } template <class _CharT, class _Traits, class _Allocator> class basic_stringstream : public basic_iostream<_CharT, _Traits> { public: typedef _CharT char_type; typedef _Traits traits_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; typedef _Allocator allocator_type; typedef basic_string<char_type, traits_type, allocator_type> string_type; private: basic_stringbuf<char_type, traits_type, allocator_type> __sb_; public: inline __attribute__ ((__exclude_from_explicit_instantiation__)) explicit basic_stringstream(ios_base::openmode __wch = ios_base::in | ios_base::out); inline __attribute__ ((__exclude_from_explicit_instantiation__)) explicit basic_stringstream(const string_type& __s, ios_base::openmode __wch = ios_base::in | ios_base::out); inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_stringstream(basic_stringstream&& __rhs); basic_stringstream& operator=(basic_stringstream&& __rhs); inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(basic_stringstream& __rhs); inline __attribute__ ((__exclude_from_explicit_instantiation__)) basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const; inline __attribute__ ((__exclude_from_explicit_instantiation__)) string_type str() const; inline __attribute__ ((__exclude_from_explicit_instantiation__)) void str(const string_type& __s); }; template <class _CharT, class _Traits, class _Allocator> basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(ios_base::openmode __wch) : basic_iostream<_CharT, _Traits>(&__sb_), __sb_(__wch) { } template <class _CharT, class _Traits, class _Allocator> basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(const string_type& __s, ios_base::openmode __wch) : basic_iostream<_CharT, _Traits>(&__sb_), __sb_(__s, __wch) { } template <class _CharT, class _Traits, class _Allocator> basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(basic_stringstream&& __rhs) : basic_iostream<_CharT, _Traits>(std::__1::move(__rhs)), __sb_(std::__1::move(__rhs.__sb_)) { basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_); } template <class _CharT, class _Traits, class _Allocator> basic_stringstream<_CharT, _Traits, _Allocator>& basic_stringstream<_CharT, _Traits, _Allocator>::operator=(basic_stringstream&& __rhs) { basic_iostream<char_type, traits_type>::operator=(std::__1::move(__rhs)); __sb_ = std::__1::move(__rhs.__sb_); return *this; } template <class _CharT, class _Traits, class _Allocator> void basic_stringstream<_CharT, _Traits, _Allocator>::swap(basic_stringstream& __rhs) { basic_iostream<char_type, traits_type>::swap(__rhs); __sb_.swap(__rhs.__sb_); } template <class _CharT, class _Traits, class _Allocator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x, basic_stringstream<_CharT, _Traits, _Allocator>& __y) { __x.swap(__y); } template <class _CharT, class _Traits, class _Allocator> basic_stringbuf<_CharT, _Traits, _Allocator>* basic_stringstream<_CharT, _Traits, _Allocator>::rdbuf() const { return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_); } template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator> basic_stringstream<_CharT, _Traits, _Allocator>::str() const { return __sb_.str(); } template <class _CharT, class _Traits, class _Allocator> void basic_stringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s) { __sb_.str(__s); } } } #pragma warning(push) #pragma warning(disable: 4668) #pragma warning(disable: 4001) #pragma warning(pop) #pragma warning(disable: 4514) #pragma warning(disable: 4103) #pragma warning(push) #pragma warning(disable: 4001) #pragma warning(disable: 4201) #pragma warning(disable: 4214) #pragma pack(push, 8) extern "C" { typedef enum _EXCEPTION_DISPOSITION { ExceptionContinueExecution, ExceptionContinueSearch, ExceptionNestedException, ExceptionCollidedUnwind } EXCEPTION_DISPOSITION; struct _EXCEPTION_RECORD; struct _CONTEXT; struct _DISPATCHER_CONTEXT; EXCEPTION_DISPOSITION __cdecl __C_specific_handler( struct _EXCEPTION_RECORD* ExceptionRecord, void* EstablisherFrame, struct _CONTEXT* ContextRecord, struct _DISPATCHER_CONTEXT* DispatcherContext ); unsigned long __cdecl _exception_code(void); void * __cdecl _exception_info(void); int __cdecl _abnormal_termination(void); } #pragma pack(pop) extern "C" { #pragma warning(push) #pragma warning(disable: 4668) extern "C" { } extern "C" { } #pragma warning(pop) extern "C" { typedef unsigned long ULONG; typedef ULONG *PULONG; typedef unsigned short USHORT; typedef USHORT *PUSHORT; typedef unsigned char UCHAR; typedef UCHAR *PUCHAR; typedef char *PSZ; typedef unsigned long DWORD; typedef int BOOL; typedef unsigned char BYTE; typedef unsigned short WORD; typedef float FLOAT; typedef FLOAT *PFLOAT; typedef BOOL *PBOOL; typedef BOOL *LPBOOL; typedef BYTE *PBYTE; typedef BYTE *LPBYTE; typedef int *PINT; typedef int *LPINT; typedef WORD *PWORD; typedef WORD *LPWORD; typedef long *LPLONG; typedef DWORD *PDWORD; typedef DWORD *LPDWORD; typedef void *LPVOID; typedef const void *LPCVOID; typedef int INT; typedef unsigned int UINT; typedef unsigned int *PUINT; #pragma warning(push) #pragma warning(disable: 4668) #pragma warning(disable: 4820) #pragma warning(disable: 4200) #pragma warning(disable: 4201) #pragma warning(disable: 4214) extern "C" { #pragma warning(disable: 4845) extern "C" { } #pragma warning(push) #pragma warning(disable: 4668) typedef unsigned __int64 POINTER_64_INT; extern "C" { typedef signed char INT8, *PINT8; typedef signed short INT16, *PINT16; typedef signed int INT32, *PINT32; typedef signed __int64 INT64, *PINT64; typedef unsigned char UINT8, *PUINT8; typedef unsigned short UINT16, *PUINT16; typedef unsigned int UINT32, *PUINT32; typedef unsigned __int64 UINT64, *PUINT64; typedef signed int LONG32, *PLONG32; typedef unsigned int ULONG32, *PULONG32; typedef unsigned int DWORD32, *PDWORD32; typedef __int64 INT_PTR, *PINT_PTR; typedef unsigned __int64 UINT_PTR, *PUINT_PTR; typedef __int64 LONG_PTR, *PLONG_PTR; typedef unsigned __int64 ULONG_PTR, *PULONG_PTR; typedef __int64 SHANDLE_PTR; typedef unsigned __int64 HANDLE_PTR; typedef unsigned int UHALF_PTR, *PUHALF_PTR; typedef int HALF_PTR, *PHALF_PTR; __inline unsigned long HandleToULong( const void *h ) { return((unsigned long) (ULONG_PTR) h ); } __inline long HandleToLong( const void *h ) { return((long) (LONG_PTR) h ); } __inline void * ULongToHandle( const unsigned long h ) { return((void *) (UINT_PTR) h ); } __inline void * LongToHandle( const long h ) { return((void *) (INT_PTR) h ); } __inline unsigned long PtrToUlong( const void *p ) { return((unsigned long) (ULONG_PTR) p ); } __inline unsigned int PtrToUint( const void *p ) { return((unsigned int) (UINT_PTR) p ); } __inline unsigned short PtrToUshort( const void *p ) { return((unsigned short) (unsigned long) (ULONG_PTR) p ); } __inline long PtrToLong( const void *p ) { return((long) (LONG_PTR) p ); } __inline int PtrToInt( const void *p ) { return((int) (INT_PTR) p ); } __inline short PtrToShort( const void *p ) { return((short) (long) (LONG_PTR) p ); } __inline void * IntToPtr( const int i ) { return( (void *)(INT_PTR)i ); } __inline void * UIntToPtr( const unsigned int ui ) { return( (void *)(UINT_PTR)ui ); } __inline void * LongToPtr( const long l ) { return( (void *)(LONG_PTR)l ); } __inline void * ULongToPtr( const unsigned long ul ) { return( (void *)(ULONG_PTR)ul ); } __inline void * Ptr32ToPtr( const void * __ptr32 p ) { return((void *) (ULONG_PTR) (unsigned long) p); } __inline void * Handle32ToHandle( const void * __ptr32 h ) { return((void *) (LONG_PTR) (long) h); } __inline void * __ptr32 PtrToPtr32( const void *p ) { return((void * __ptr32) (unsigned long) (ULONG_PTR) p); } typedef ULONG_PTR SIZE_T, *PSIZE_T; typedef LONG_PTR SSIZE_T, *PSSIZE_T; typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR; typedef __int64 LONG64, *PLONG64; typedef unsigned __int64 ULONG64, *PULONG64; typedef unsigned __int64 DWORD64, *PDWORD64; typedef ULONG_PTR KAFFINITY; typedef KAFFINITY *PKAFFINITY; } #pragma warning(pop) typedef void *PVOID; typedef void * __ptr64 PVOID64; typedef char CHAR; typedef short SHORT; typedef long LONG; typedef int INT; typedef wchar_t WCHAR; typedef WCHAR *PWCHAR, *LPWCH, *PWCH; typedef const WCHAR *LPCWCH, *PCWCH; typedef WCHAR *NWPSTR, *LPWSTR, *PWSTR; typedef PWSTR *PZPWSTR; typedef const PWSTR *PCZPWSTR; typedef WCHAR __unaligned *LPUWSTR, *PUWSTR; typedef const WCHAR *LPCWSTR, *PCWSTR; typedef PCWSTR *PZPCWSTR; typedef const PCWSTR *PCZPCWSTR; typedef const WCHAR __unaligned *LPCUWSTR, *PCUWSTR; typedef WCHAR *PZZWSTR; typedef const WCHAR *PCZZWSTR; typedef WCHAR __unaligned *PUZZWSTR; typedef const WCHAR __unaligned *PCUZZWSTR; typedef WCHAR *PNZWCH; typedef const WCHAR *PCNZWCH; typedef WCHAR __unaligned *PUNZWCH; typedef const WCHAR __unaligned *PCUNZWCH; typedef const WCHAR *LPCWCHAR, *PCWCHAR; typedef const WCHAR __unaligned *LPCUWCHAR, *PCUWCHAR; typedef unsigned long UCSCHAR; typedef UCSCHAR *PUCSCHAR; typedef const UCSCHAR *PCUCSCHAR; typedef UCSCHAR *PUCSSTR; typedef UCSCHAR __unaligned *PUUCSSTR; typedef const UCSCHAR *PCUCSSTR; typedef const UCSCHAR __unaligned *PCUUCSSTR; typedef UCSCHAR __unaligned *PUUCSCHAR; typedef const UCSCHAR __unaligned *PCUUCSCHAR; typedef CHAR *PCHAR, *LPCH, *PCH; typedef const CHAR *LPCCH, *PCCH; typedef CHAR *NPSTR, *LPSTR, *PSTR; typedef PSTR *PZPSTR; typedef const PSTR *PCZPSTR; typedef const CHAR *LPCSTR, *PCSTR; typedef PCSTR *PZPCSTR; typedef const PCSTR *PCZPCSTR; typedef CHAR *PZZSTR; typedef const CHAR *PCZZSTR; typedef CHAR *PNZCH; typedef const CHAR *PCNZCH; typedef WCHAR TCHAR, *PTCHAR; typedef WCHAR TBYTE , *PTBYTE ; typedef LPWCH LPTCH, PTCH; typedef LPCWCH LPCTCH, PCTCH; typedef LPWSTR PTSTR, LPTSTR; typedef LPCWSTR PCTSTR, LPCTSTR; typedef LPUWSTR PUTSTR, LPUTSTR; typedef LPCUWSTR PCUTSTR, LPCUTSTR; typedef LPWSTR LP; typedef PZZWSTR PZZTSTR; typedef PCZZWSTR PCZZTSTR; typedef PUZZWSTR PUZZTSTR; typedef PCUZZWSTR PCUZZTSTR; typedef PZPWSTR PZPTSTR; typedef PNZWCH PNZTCH; typedef PCNZWCH PCNZTCH; typedef PUNZWCH PUNZTCH; typedef PCUNZWCH PCUNZTCH; typedef SHORT *PSHORT; typedef LONG *PLONG; typedef struct _PROCESSOR_NUMBER { WORD Group; BYTE Number; BYTE Reserved; } PROCESSOR_NUMBER, *PPROCESSOR_NUMBER; typedef struct _GROUP_AFFINITY { KAFFINITY Mask; WORD Group; WORD Reserved[3]; } GROUP_AFFINITY, *PGROUP_AFFINITY; typedef void *HANDLE; typedef HANDLE *PHANDLE; typedef BYTE FCHAR; typedef WORD FSHORT; typedef DWORD FLONG; typedef long HRESULT; typedef char CCHAR; typedef DWORD LCID; typedef PDWORD PLCID; typedef WORD LANGID; typedef enum { UNSPECIFIED_COMPARTMENT_ID = 0, DEFAULT_COMPARTMENT_ID } COMPARTMENT_ID, *PCOMPARTMENT_ID; typedef struct _FLOAT128 { __int64 LowPart; __int64 HighPart; } FLOAT128; typedef FLOAT128 *PFLOAT128; typedef __int64 LONGLONG; typedef unsigned __int64 ULONGLONG; typedef LONGLONG *PLONGLONG; typedef ULONGLONG *PULONGLONG; typedef LONGLONG USN; typedef union _LARGE_INTEGER { struct { DWORD LowPart; LONG HighPart; } ; struct { DWORD LowPart; LONG HighPart; } u; LONGLONG QuadPart; } LARGE_INTEGER; typedef LARGE_INTEGER *PLARGE_INTEGER; typedef union _ULARGE_INTEGER { struct { DWORD LowPart; DWORD HighPart; } ; struct { DWORD LowPart; DWORD HighPart; } u; ULONGLONG QuadPart; } ULARGE_INTEGER; typedef ULARGE_INTEGER *PULARGE_INTEGER; typedef LONG_PTR RTL_REFERENCE_COUNT, *PRTL_REFERENCE_COUNT; typedef LONG RTL_REFERENCE_COUNT32, *PRTL_REFERENCE_COUNT32; typedef struct _LUID { DWORD LowPart; LONG HighPart; } LUID, *PLUID; typedef ULONGLONG DWORDLONG; typedef DWORDLONG *PDWORDLONG; extern "C" { unsigned char __cdecl _rotl8 ( unsigned char Value, unsigned char Shift ); unsigned short __cdecl _rotl16 ( unsigned short Value, unsigned char Shift ); unsigned char __cdecl _rotr8 ( unsigned char Value, unsigned char Shift ); unsigned short __cdecl _rotr16 ( unsigned short Value, unsigned char Shift ); #pragma intrinsic(_rotl8) #pragma intrinsic(_rotl16) #pragma intrinsic(_rotr8) #pragma intrinsic(_rotr16) unsigned int __cdecl _rotl ( unsigned int Value, int Shift ); unsigned __int64 __cdecl _rotl64 ( unsigned __int64 Value, int Shift ); unsigned int __cdecl _rotr ( unsigned int Value, int Shift ); unsigned __int64 __cdecl _rotr64 ( unsigned __int64 Value, int Shift ); #pragma intrinsic(_rotl) #pragma intrinsic(_rotl64) #pragma intrinsic(_rotr) #pragma intrinsic(_rotr64) } typedef BYTE BOOLEAN; typedef BOOLEAN *PBOOLEAN; typedef struct _LIST_ENTRY { struct _LIST_ENTRY *Flink; struct _LIST_ENTRY *Blink; } LIST_ENTRY, *PLIST_ENTRY, * PRLIST_ENTRY; typedef struct _SINGLE_LIST_ENTRY { struct _SINGLE_LIST_ENTRY *Next; } SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY; typedef struct LIST_ENTRY32 { DWORD Flink; DWORD Blink; } LIST_ENTRY32; typedef LIST_ENTRY32 *PLIST_ENTRY32; typedef struct LIST_ENTRY64 { ULONGLONG Flink; ULONGLONG Blink; } LIST_ENTRY64; typedef LIST_ENTRY64 *PLIST_ENTRY64; typedef struct _GUID { unsigned long Data1; unsigned short Data2; unsigned short Data3; unsigned char Data4[ 8 ]; } GUID; typedef GUID *LPGUID; typedef const GUID *LPCGUID; typedef GUID IID; typedef IID *LPIID; typedef GUID CLSID; typedef CLSID *LPCLSID; typedef GUID FMTID; typedef FMTID *LPFMTID; __inline int InlineIsEqualGUID(const GUID & rguid1, const GUID & rguid2) { return ( ((unsigned long *) &rguid1)[0] == ((unsigned long *) &rguid2)[0] && ((unsigned long *) &rguid1)[1] == ((unsigned long *) &rguid2)[1] && ((unsigned long *) &rguid1)[2] == ((unsigned long *) &rguid2)[2] && ((unsigned long *) &rguid1)[3] == ((unsigned long *) &rguid2)[3]); } __inline int IsEqualGUID(const GUID & rguid1, const GUID & rguid2) { return !memcmp(&rguid1, &rguid2, sizeof(GUID)); } __inline bool operator==(const GUID & guidOne, const GUID & guidOther) { return !!IsEqualGUID(guidOne,guidOther); } __inline bool operator!=(const GUID & guidOne, const GUID & guidOther) { return !(guidOne == guidOther); } typedef struct _OBJECTID { GUID Lineage; DWORD Uniquifier; } OBJECTID; extern "C++" template <typename T, size_t N> char (*RtlpNumberOf( __unaligned T (&)[N] ))[N]; typedef EXCEPTION_DISPOSITION __stdcall EXCEPTION_ROUTINE ( struct _EXCEPTION_RECORD *ExceptionRecord, PVOID EstablisherFrame, struct _CONTEXT *ContextRecord, PVOID DispatcherContext ); typedef EXCEPTION_ROUTINE *PEXCEPTION_ROUTINE; extern "C++" { template <size_t S> struct _ENUM_FLAG_INTEGER_FOR_SIZE; template <> struct _ENUM_FLAG_INTEGER_FOR_SIZE<1> { typedef INT8 type; }; template <> struct _ENUM_FLAG_INTEGER_FOR_SIZE<2> { typedef INT16 type; }; template <> struct _ENUM_FLAG_INTEGER_FOR_SIZE<4> { typedef INT32 type; }; template <> struct _ENUM_FLAG_INTEGER_FOR_SIZE<8> { typedef INT64 type; }; template <class T> struct _ENUM_FLAG_SIZED_INTEGER { typedef typename _ENUM_FLAG_INTEGER_FOR_SIZE<sizeof(T)>::type type; }; } static_assert(__alignof(LARGE_INTEGER) == 8, "Windows headers require the default packing option. Changing this can lead to memory corruption." " This diagnostic can be disabled by building with WINDOWS_IGNORE_PACKING_MISMATCH defined."); typedef ULONG_PTR KSPIN_LOCK; typedef KSPIN_LOCK *PKSPIN_LOCK; typedef struct __declspec(align(16)) _M128A { ULONGLONG Low; LONGLONG High; } M128A, *PM128A; typedef struct __declspec(align(16)) _XSAVE_FORMAT { WORD ControlWord; WORD StatusWord; BYTE TagWord; BYTE Reserved1; WORD ErrorOpcode; DWORD ErrorOffset; WORD ErrorSelector; WORD Reserved2; DWORD DataOffset; WORD DataSelector; WORD Reserved3; DWORD MxCsr; DWORD MxCsr_Mask; M128A FloatRegisters[8]; M128A XmmRegisters[16]; BYTE Reserved4[96]; } XSAVE_FORMAT, *PXSAVE_FORMAT; typedef struct _XSAVE_CET_U_FORMAT { DWORD64 Ia32CetUMsr; DWORD64 Ia32Pl3SspMsr; } XSAVE_CET_U_FORMAT, *PXSAVE_CET_U_FORMAT; typedef struct __declspec(align(8)) _XSAVE_AREA_HEADER { DWORD64 Mask; DWORD64 CompactionMask; DWORD64 Reserved2[6]; } XSAVE_AREA_HEADER, *PXSAVE_AREA_HEADER; typedef struct __declspec(align(16)) _XSAVE_AREA { XSAVE_FORMAT LegacyState; XSAVE_AREA_HEADER Header; } XSAVE_AREA, *PXSAVE_AREA; typedef struct _XSTATE_CONTEXT { DWORD64 Mask; DWORD Length; DWORD Reserved1; PXSAVE_AREA Area; PVOID Buffer; } XSTATE_CONTEXT, *PXSTATE_CONTEXT; typedef struct _SCOPE_TABLE_AMD64 { DWORD Count; struct { DWORD BeginAddress; DWORD EndAddress; DWORD HandlerAddress; DWORD JumpTarget; } ScopeRecord[1]; } SCOPE_TABLE_AMD64, *PSCOPE_TABLE_AMD64; extern "C" { BOOLEAN _bittest ( LONG const *Base, LONG Offset ); BOOLEAN _bittestandcomplement ( LONG *Base, LONG Offset ); BOOLEAN _bittestandset ( LONG *Base, LONG Offset ); BOOLEAN _bittestandreset ( LONG *Base, LONG Offset ); BOOLEAN _interlockedbittestandset ( LONG volatile *Base, LONG Offset ); BOOLEAN _interlockedbittestandreset ( LONG volatile *Base, LONG Offset ); BOOLEAN _bittest64 ( LONG64 const *Base, LONG64 Offset ); BOOLEAN _bittestandcomplement64 ( LONG64 *Base, LONG64 Offset ); BOOLEAN _bittestandset64 ( LONG64 *Base, LONG64 Offset ); BOOLEAN _bittestandreset64 ( LONG64 *Base, LONG64 Offset ); BOOLEAN _interlockedbittestandset64 ( LONG64 volatile *Base, LONG64 Offset ); BOOLEAN _interlockedbittestandreset64 ( LONG64 volatile *Base, LONG64 Offset ); #pragma intrinsic(_bittest) #pragma intrinsic(_bittestandcomplement) #pragma intrinsic(_bittestandset) #pragma intrinsic(_bittestandreset) #pragma intrinsic(_interlockedbittestandset) #pragma intrinsic(_interlockedbittestandreset) #pragma intrinsic(_bittest64) #pragma intrinsic(_bittestandcomplement64) #pragma intrinsic(_bittestandset64) #pragma intrinsic(_bittestandreset64) #pragma intrinsic(_interlockedbittestandset64) #pragma intrinsic(_interlockedbittestandreset64) BOOLEAN _BitScanForward ( DWORD *Index, DWORD Mask ); BOOLEAN _BitScanReverse ( DWORD *Index, DWORD Mask ); BOOLEAN _BitScanForward64 ( DWORD *Index, DWORD64 Mask ); BOOLEAN _BitScanReverse64 ( DWORD *Index, DWORD64 Mask ); #pragma intrinsic(_BitScanForward) #pragma intrinsic(_BitScanReverse) #pragma intrinsic(_BitScanForward64) #pragma intrinsic(_BitScanReverse64) SHORT _InterlockedIncrement16 ( SHORT volatile *Addend ); SHORT _InterlockedDecrement16 ( SHORT volatile *Addend ); SHORT _InterlockedCompareExchange16 ( SHORT volatile *Destination, SHORT ExChange, SHORT Comperand ); LONG _InterlockedAnd ( LONG volatile *Destination, LONG Value ); LONG _InterlockedOr ( LONG volatile *Destination, LONG Value ); LONG _InterlockedXor ( LONG volatile *Destination, LONG Value ); LONG64 _InterlockedAnd64 ( LONG64 volatile *Destination, LONG64 Value ); LONG64 _InterlockedOr64 ( LONG64 volatile *Destination, LONG64 Value ); LONG64 _InterlockedXor64 ( LONG64 volatile *Destination, LONG64 Value ); LONG _InterlockedIncrement ( LONG volatile *Addend ); LONG _InterlockedDecrement ( LONG volatile *Addend ); LONG _InterlockedExchange ( LONG volatile *Target, LONG Value ); LONG _InterlockedExchangeAdd ( LONG volatile *Addend, LONG Value ); __forceinline LONG _InlineInterlockedAdd ( LONG volatile *Addend, LONG Value ) { return _InterlockedExchangeAdd(Addend, Value) + Value; } LONG _InterlockedCompareExchange ( LONG volatile *Destination, LONG ExChange, LONG Comperand ); LONG64 _InterlockedIncrement64 ( LONG64 volatile *Addend ); LONG64 _InterlockedDecrement64 ( LONG64 volatile *Addend ); LONG64 _InterlockedExchange64 ( LONG64 volatile *Target, LONG64 Value ); LONG64 _InterlockedExchangeAdd64 ( LONG64 volatile *Addend, LONG64 Value ); __forceinline LONG64 _InlineInterlockedAdd64 ( LONG64 volatile *Addend, LONG64 Value ) { return _InterlockedExchangeAdd64(Addend, Value) + Value; } LONG64 _InterlockedCompareExchange64 ( LONG64 volatile *Destination, LONG64 ExChange, LONG64 Comperand ); BOOLEAN _InterlockedCompareExchange128 ( LONG64 volatile *Destination, LONG64 ExchangeHigh, LONG64 ExchangeLow, LONG64 *ComparandResult ); PVOID _InterlockedCompareExchangePointer ( PVOID volatile *Destination, PVOID Exchange, PVOID Comperand ); PVOID _InterlockedExchangePointer( PVOID volatile *Target, PVOID Value ); #pragma intrinsic(_InterlockedIncrement16) #pragma intrinsic(_InterlockedDecrement16) #pragma intrinsic(_InterlockedCompareExchange16) #pragma intrinsic(_InterlockedAnd) #pragma intrinsic(_InterlockedOr) #pragma intrinsic(_InterlockedXor) #pragma intrinsic(_InterlockedIncrement) #pragma intrinsic(_InterlockedDecrement) #pragma intrinsic(_InterlockedExchange) #pragma intrinsic(_InterlockedExchangeAdd) #pragma intrinsic(_InterlockedCompareExchange) #pragma intrinsic(_InterlockedAnd64) #pragma intrinsic(_InterlockedOr64) #pragma intrinsic(_InterlockedXor64) #pragma intrinsic(_InterlockedIncrement64) #pragma intrinsic(_InterlockedDecrement64) #pragma intrinsic(_InterlockedExchange64) #pragma intrinsic(_InterlockedExchangeAdd64) #pragma intrinsic(_InterlockedCompareExchange64) #pragma intrinsic(_InterlockedCompareExchange128) #pragma intrinsic(_InterlockedExchangePointer) #pragma intrinsic(_InterlockedCompareExchangePointer) CHAR _InterlockedExchange8 ( CHAR volatile *Target, CHAR Value ); SHORT _InterlockedExchange16 ( SHORT volatile *Destination, SHORT ExChange ); #pragma intrinsic(_InterlockedExchange8) #pragma intrinsic(_InterlockedExchange16) char _InterlockedExchangeAdd8 ( char volatile * _Addend, char _Value ); char _InterlockedAnd8 ( char volatile *Destination, char Value ); char _InterlockedOr8 ( char volatile *Destination, char Value ); char _InterlockedXor8 ( char volatile *Destination, char Value ); SHORT _InterlockedAnd16( SHORT volatile *Destination, SHORT Value ); SHORT _InterlockedOr16( SHORT volatile *Destination, SHORT Value ); SHORT _InterlockedXor16( SHORT volatile *Destination, SHORT Value ); #pragma intrinsic (_InterlockedExchangeAdd8) #pragma intrinsic (_InterlockedAnd8) #pragma intrinsic (_InterlockedOr8) #pragma intrinsic (_InterlockedXor8) #pragma intrinsic (_InterlockedAnd16) #pragma intrinsic (_InterlockedOr16) #pragma intrinsic (_InterlockedXor16) void __cpuidex ( int CPUInfo[4], int Function, int SubLeaf ); #pragma intrinsic(__cpuidex) void _mm_clflush ( void const *Address ); #pragma intrinsic(_mm_clflush) void _ReadWriteBarrier ( void ); #pragma intrinsic(_ReadWriteBarrier) void __faststorefence ( void ); void _mm_lfence ( void ); void _mm_mfence ( void ); void _mm_sfence ( void ); void _mm_pause ( void ); void _mm_prefetch ( CHAR const *a, int sel ); void _m_prefetchw ( volatile const void *Source ); #pragma intrinsic(__faststorefence) #pragma intrinsic(_mm_pause) #pragma intrinsic(_mm_prefetch) #pragma intrinsic(_mm_lfence) #pragma intrinsic(_mm_mfence) #pragma intrinsic(_mm_sfence) #pragma intrinsic(_m_prefetchw) unsigned int _mm_getcsr ( void ); void _mm_setcsr ( unsigned int MxCsr ); #pragma intrinsic(_mm_getcsr) #pragma intrinsic(_mm_setcsr) unsigned __int32 __getcallerseflags ( void ); #pragma intrinsic(__getcallerseflags) DWORD __segmentlimit ( DWORD Selector ); #pragma intrinsic(__segmentlimit) DWORD64 __readpmc ( DWORD Counter ); #pragma intrinsic(__readpmc) DWORD64 __rdtsc ( void ); #pragma intrinsic(__rdtsc) void __movsb ( PBYTE Destination, BYTE const *Source, SIZE_T Count ); void __movsw ( PWORD Destination, WORD const *Source, SIZE_T Count ); void __movsd ( PDWORD Destination, DWORD const *Source, SIZE_T Count ); void __movsq ( PDWORD64 Destination, DWORD64 const *Source, SIZE_T Count ); #pragma intrinsic(__movsb) #pragma intrinsic(__movsw) #pragma intrinsic(__movsd) #pragma intrinsic(__movsq) void __stosb ( PBYTE Destination, BYTE Value, SIZE_T Count ); void __stosw ( PWORD Destination, WORD Value, SIZE_T Count ); void __stosd ( PDWORD Destination, DWORD Value, SIZE_T Count ); void __stosq ( PDWORD64 Destination, DWORD64 Value, SIZE_T Count ); #pragma intrinsic(__stosb) #pragma intrinsic(__stosw) #pragma intrinsic(__stosd) #pragma intrinsic(__stosq) LONGLONG __mulh ( LONG64 Multiplier, LONG64 Multiplicand ); ULONGLONG __umulh ( DWORD64 Multiplier, DWORD64 Multiplicand ); #pragma intrinsic(__mulh) #pragma intrinsic(__umulh) DWORD64 __popcnt64 ( DWORD64 operand ); #pragma intrinsic(__popcnt64) DWORD64 __shiftleft128 ( DWORD64 LowPart, DWORD64 HighPart, BYTE Shift ); DWORD64 __shiftright128 ( DWORD64 LowPart, DWORD64 HighPart, BYTE Shift ); #pragma intrinsic(__shiftleft128) #pragma intrinsic(__shiftright128) LONG64 _mul128 ( LONG64 Multiplier, LONG64 Multiplicand, LONG64 *HighProduct ); #pragma intrinsic(_mul128) DWORD64 _umul128 ( DWORD64 Multiplier, DWORD64 Multiplicand, DWORD64 *HighProduct ); #pragma intrinsic(_umul128) __forceinline LONG64 MultiplyExtract128 ( LONG64 Multiplier, LONG64 Multiplicand, BYTE Shift ) { LONG64 extractedProduct; LONG64 highProduct; LONG64 lowProduct; BOOLEAN negate; DWORD64 uhighProduct; DWORD64 ulowProduct; lowProduct = _mul128(Multiplier, Multiplicand, &highProduct); negate = 0; uhighProduct = (DWORD64)highProduct; ulowProduct = (DWORD64)lowProduct; if (highProduct < 0) { negate = 1; uhighProduct = (DWORD64)(-highProduct); ulowProduct = (DWORD64)(-lowProduct); if (ulowProduct != 0) { uhighProduct -= 1; } } extractedProduct = (LONG64)__shiftright128(ulowProduct, uhighProduct, Shift); if (negate != 0) { extractedProduct = -extractedProduct; } return extractedProduct; } __forceinline DWORD64 UnsignedMultiplyExtract128 ( DWORD64 Multiplier, DWORD64 Multiplicand, BYTE Shift ) { DWORD64 extractedProduct; DWORD64 highProduct; DWORD64 lowProduct; lowProduct = _umul128(Multiplier, Multiplicand, &highProduct); extractedProduct = __shiftright128(lowProduct, highProduct, Shift); return extractedProduct; } BYTE __readgsbyte ( DWORD Offset ); WORD __readgsword ( DWORD Offset ); DWORD __readgsdword ( DWORD Offset ); DWORD64 __readgsqword ( DWORD Offset ); void __writegsbyte ( DWORD Offset, BYTE Data ); void __writegsword ( DWORD Offset, WORD Data ); void __writegsdword ( DWORD Offset, DWORD Data ); void __writegsqword ( DWORD Offset, DWORD64 Data ); #pragma intrinsic(__readgsbyte) #pragma intrinsic(__readgsword) #pragma intrinsic(__readgsdword) #pragma intrinsic(__readgsqword) #pragma intrinsic(__writegsbyte) #pragma intrinsic(__writegsword) #pragma intrinsic(__writegsdword) #pragma intrinsic(__writegsqword) void __incgsbyte ( DWORD Offset ); void __addgsbyte ( DWORD Offset, BYTE Value ); void __incgsword ( DWORD Offset ); void __addgsword ( DWORD Offset, WORD Value ); void __incgsdword ( DWORD Offset ); void __addgsdword ( DWORD Offset, DWORD Value ); void __incgsqword ( DWORD Offset ); void __addgsqword ( DWORD Offset, DWORD64 Value ); } typedef XSAVE_FORMAT XMM_SAVE_AREA32, *PXMM_SAVE_AREA32; typedef struct __declspec(align(16)) __declspec(no_init_all) _CONTEXT { DWORD64 P1Home; DWORD64 P2Home; DWORD64 P3Home; DWORD64 P4Home; DWORD64 P5Home; DWORD64 P6Home; DWORD ContextFlags; DWORD MxCsr; WORD SegCs; WORD SegDs; WORD SegEs; WORD SegFs; WORD SegGs; WORD SegSs; DWORD EFlags; DWORD64 Dr0; DWORD64 Dr1; DWORD64 Dr2; DWORD64 Dr3; DWORD64 Dr6; DWORD64 Dr7; DWORD64 Rax; DWORD64 Rcx; DWORD64 Rdx; DWORD64 Rbx; DWORD64 Rsp; DWORD64 Rbp; DWORD64 Rsi; DWORD64 Rdi; DWORD64 R8; DWORD64 R9; DWORD64 R10; DWORD64 R11; DWORD64 R12; DWORD64 R13; DWORD64 R14; DWORD64 R15; DWORD64 Rip; union { XMM_SAVE_AREA32 FltSave; struct { M128A Header[2]; M128A Legacy[8]; M128A Xmm0; M128A Xmm1; M128A Xmm2; M128A Xmm3; M128A Xmm4; M128A Xmm5; M128A Xmm6; M128A Xmm7; M128A Xmm8; M128A Xmm9; M128A Xmm10; M128A Xmm11; M128A Xmm12; M128A Xmm13; M128A Xmm14; M128A Xmm15; } ; } ; M128A VectorRegister[26]; DWORD64 VectorControl; DWORD64 DebugControl; DWORD64 LastBranchToRip; DWORD64 LastBranchFromRip; DWORD64 LastExceptionToRip; DWORD64 LastExceptionFromRip; } CONTEXT, *PCONTEXT; typedef struct _IMAGE_RUNTIME_FUNCTION_ENTRY RUNTIME_FUNCTION, *PRUNTIME_FUNCTION; typedef SCOPE_TABLE_AMD64 SCOPE_TABLE, *PSCOPE_TABLE; typedef struct _UNWIND_HISTORY_TABLE_ENTRY { DWORD64 ImageBase; PRUNTIME_FUNCTION FunctionEntry; } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY; typedef struct _UNWIND_HISTORY_TABLE { DWORD Count; BYTE LocalHint; BYTE GlobalHint; BYTE Search; BYTE Once; DWORD64 LowAddress; DWORD64 HighAddress; UNWIND_HISTORY_TABLE_ENTRY Entry[12]; } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE; typedef PRUNTIME_FUNCTION GET_RUNTIME_FUNCTION_CALLBACK ( DWORD64 ControlPc, PVOID Context ); typedef GET_RUNTIME_FUNCTION_CALLBACK *PGET_RUNTIME_FUNCTION_CALLBACK; typedef DWORD OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK ( HANDLE Process, PVOID TableAddress, PDWORD Entries, PRUNTIME_FUNCTION* Functions ); typedef OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK *POUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK; typedef struct _DISPATCHER_CONTEXT { DWORD64 ControlPc; DWORD64 ImageBase; PRUNTIME_FUNCTION FunctionEntry; DWORD64 EstablisherFrame; DWORD64 TargetIp; PCONTEXT ContextRecord; PEXCEPTION_ROUTINE LanguageHandler; PVOID HandlerData; PUNWIND_HISTORY_TABLE HistoryTable; DWORD ScopeIndex; DWORD Fill0; } DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT; struct _EXCEPTION_POINTERS; typedef LONG (*PEXCEPTION_FILTER) ( struct _EXCEPTION_POINTERS *ExceptionPointers, PVOID EstablisherFrame ); typedef void (*PTERMINATION_HANDLER) ( BOOLEAN _abnormal_termination, PVOID EstablisherFrame ); typedef struct _KNONVOLATILE_CONTEXT_POINTERS { union { PM128A FloatingContext[16]; struct { PM128A Xmm0; PM128A Xmm1; PM128A Xmm2; PM128A Xmm3; PM128A Xmm4; PM128A Xmm5; PM128A Xmm6; PM128A Xmm7; PM128A Xmm8; PM128A Xmm9; PM128A Xmm10; PM128A Xmm11; PM128A Xmm12; PM128A Xmm13; PM128A Xmm14; PM128A Xmm15; } ; } ; union { PDWORD64 IntegerContext[16]; struct { PDWORD64 Rax; PDWORD64 Rcx; PDWORD64 Rdx; PDWORD64 Rbx; PDWORD64 Rsp; PDWORD64 Rbp; PDWORD64 Rsi; PDWORD64 Rdi; PDWORD64 R8; PDWORD64 R9; PDWORD64 R10; PDWORD64 R11; PDWORD64 R12; PDWORD64 R13; PDWORD64 R14; PDWORD64 R15; } ; } ; } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS; typedef struct _SCOPE_TABLE_ARM { DWORD Count; struct { DWORD BeginAddress; DWORD EndAddress; DWORD HandlerAddress; DWORD JumpTarget; } ScopeRecord[1]; } SCOPE_TABLE_ARM, *PSCOPE_TABLE_ARM; typedef struct _SCOPE_TABLE_ARM64 { DWORD Count; struct { DWORD BeginAddress; DWORD EndAddress; DWORD HandlerAddress; DWORD JumpTarget; } ScopeRecord[1]; } SCOPE_TABLE_ARM64, *PSCOPE_TABLE_ARM64; typedef struct _KNONVOLATILE_CONTEXT_POINTERS_ARM64 { PDWORD64 X19; PDWORD64 X20; PDWORD64 X21; PDWORD64 X22; PDWORD64 X23; PDWORD64 X24; PDWORD64 X25; PDWORD64 X26; PDWORD64 X27; PDWORD64 X28; PDWORD64 Fp; PDWORD64 Lr; PDWORD64 D8; PDWORD64 D9; PDWORD64 D10; PDWORD64 D11; PDWORD64 D12; PDWORD64 D13; PDWORD64 D14; PDWORD64 D15; } KNONVOLATILE_CONTEXT_POINTERS_ARM64, *PKNONVOLATILE_CONTEXT_POINTERS_ARM64; extern "C" { void __int2c ( void ); #pragma intrinsic(__int2c) } typedef struct _LDT_ENTRY { WORD LimitLow; WORD BaseLow; union { struct { BYTE BaseMid; BYTE Flags1; BYTE Flags2; BYTE BaseHi; } Bytes; struct { DWORD BaseMid : 8; DWORD Type : 5; DWORD Dpl : 2; DWORD Pres : 1; DWORD LimitHi : 4; DWORD Sys : 1; DWORD Reserved_0 : 1; DWORD Default_Big : 1; DWORD Granularity : 1; DWORD BaseHi : 8; } Bits; } HighWord; } LDT_ENTRY, *PLDT_ENTRY; extern "C" { __forceinline CHAR ReadAcquire8 ( CHAR const volatile *Source ) { CHAR Value; Value = *Source; return Value; } __forceinline CHAR ReadNoFence8 ( CHAR const volatile *Source ) { CHAR Value; Value = *Source; return Value; } __forceinline void WriteRelease8 ( CHAR volatile *Destination, CHAR Value ) { *Destination = Value; return; } __forceinline void WriteNoFence8 ( CHAR volatile *Destination, CHAR Value ) { *Destination = Value; return; } __forceinline SHORT ReadAcquire16 ( SHORT const volatile *Source ) { SHORT Value; Value = *Source; return Value; } __forceinline SHORT ReadNoFence16 ( SHORT const volatile *Source ) { SHORT Value; Value = *Source; return Value; } __forceinline void WriteRelease16 ( SHORT volatile *Destination, SHORT Value ) { *Destination = Value; return; } __forceinline void WriteNoFence16 ( SHORT volatile *Destination, SHORT Value ) { *Destination = Value; return; } __forceinline LONG ReadAcquire ( LONG const volatile *Source ) { LONG Value; Value = *Source; return Value; } __forceinline LONG ReadNoFence ( LONG const volatile *Source ) { LONG Value; Value = *Source; return Value; } __forceinline void WriteRelease ( LONG volatile *Destination, LONG Value ) { *Destination = Value; return; } __forceinline void WriteNoFence ( LONG volatile *Destination, LONG Value ) { *Destination = Value; return; } __forceinline LONG64 ReadAcquire64 ( LONG64 const volatile *Source ) { LONG64 Value; Value = *Source; return Value; } __forceinline LONG64 ReadNoFence64 ( LONG64 const volatile *Source ) { LONG64 Value; Value = *Source; return Value; } __forceinline void WriteRelease64 ( LONG64 volatile *Destination, LONG64 Value ) { *Destination = Value; return; } __forceinline void WriteNoFence64 ( LONG64 volatile *Destination, LONG64 Value ) { *Destination = Value; return; } } __forceinline CHAR ReadRaw8 ( CHAR const volatile *Source ) { CHAR Value; Value = *(CHAR *)Source; return Value; } __forceinline void WriteRaw8 ( CHAR volatile *Destination, CHAR Value ) { *(CHAR *)Destination = Value; return; } __forceinline SHORT ReadRaw16 ( SHORT const volatile *Source ) { SHORT Value; Value = *(SHORT *)Source; return Value; } __forceinline void WriteRaw16 ( SHORT volatile *Destination, SHORT Value ) { *(SHORT *)Destination = Value; return; } __forceinline LONG ReadRaw ( LONG const volatile *Source ) { LONG Value; Value = *(LONG *)Source; return Value; } __forceinline void WriteRaw ( LONG volatile *Destination, LONG Value ) { *(LONG *)Destination = Value; return; } __forceinline LONG64 ReadRaw64 ( LONG64 const volatile *Source ) { LONG64 Value; Value = *(LONG64 *)Source; return Value; } __forceinline void WriteRaw64 ( LONG64 volatile *Destination, LONG64 Value ) { *(LONG64 *)Destination = Value; return; } __forceinline BYTE ReadUCharAcquire ( BYTE const volatile *Source ) { return (BYTE )ReadAcquire8((PCHAR)Source); } __forceinline BYTE ReadUCharNoFence ( BYTE const volatile *Source ) { return (BYTE )ReadNoFence8((PCHAR)Source); } __forceinline BYTE ReadBooleanAcquire ( BOOLEAN const volatile *Source ) { return (BOOLEAN)ReadAcquire8((PCHAR)Source); } __forceinline BYTE ReadBooleanNoFence ( BOOLEAN const volatile *Source ) { return (BOOLEAN)ReadNoFence8((PCHAR)Source); } __forceinline BYTE ReadUCharRaw ( BYTE const volatile *Source ) { return (BYTE )ReadRaw8((PCHAR)Source); } __forceinline void WriteUCharRelease ( BYTE volatile *Destination, BYTE Value ) { WriteRelease8((PCHAR)Destination, (CHAR)Value); return; } __forceinline void WriteUCharNoFence ( BYTE volatile *Destination, BYTE Value ) { WriteNoFence8((PCHAR)Destination, (CHAR)Value); return; } __forceinline void WriteBooleanRelease ( BOOLEAN volatile *Destination, BOOLEAN Value ) { WriteRelease8((PCHAR)Destination, (CHAR)Value); return; } __forceinline void WriteBooleanNoFence ( BOOLEAN volatile *Destination, BOOLEAN Value ) { WriteNoFence8((PCHAR)Destination, (CHAR)Value); return; } __forceinline void WriteUCharRaw ( BYTE volatile *Destination, BYTE Value ) { WriteRaw8((PCHAR)Destination, (CHAR)Value); return; } __forceinline WORD ReadUShortAcquire ( WORD const volatile *Source ) { return (WORD )ReadAcquire16((PSHORT)Source); } __forceinline WORD ReadUShortNoFence ( WORD const volatile *Source ) { return (WORD )ReadNoFence16((PSHORT)Source); } __forceinline WORD ReadUShortRaw ( WORD const volatile *Source ) { return (WORD )ReadRaw16((PSHORT)Source); } __forceinline void WriteUShortRelease ( WORD volatile *Destination, WORD Value ) { WriteRelease16((PSHORT)Destination, (SHORT)Value); return; } __forceinline void WriteUShortNoFence ( WORD volatile *Destination, WORD Value ) { WriteNoFence16((PSHORT)Destination, (SHORT)Value); return; } __forceinline void WriteUShortRaw ( WORD volatile *Destination, WORD Value ) { WriteRaw16((PSHORT)Destination, (SHORT)Value); return; } __forceinline DWORD ReadULongAcquire ( DWORD const volatile *Source ) { return (DWORD)ReadAcquire((PLONG)Source); } __forceinline DWORD ReadULongNoFence ( DWORD const volatile *Source ) { return (DWORD)ReadNoFence((PLONG)Source); } __forceinline DWORD ReadULongRaw ( DWORD const volatile *Source ) { return (DWORD)ReadRaw((PLONG)Source); } __forceinline void WriteULongRelease ( DWORD volatile *Destination, DWORD Value ) { WriteRelease((PLONG)Destination, (LONG)Value); return; } __forceinline void WriteULongNoFence ( DWORD volatile *Destination, DWORD Value ) { WriteNoFence((PLONG)Destination, (LONG)Value); return; } __forceinline void WriteULongRaw ( DWORD volatile *Destination, DWORD Value ) { WriteRaw((PLONG)Destination, (LONG)Value); return; } __forceinline DWORD64 ReadULong64Acquire ( DWORD64 const volatile *Source ) { return (DWORD64)ReadAcquire64((PLONG64)Source); } __forceinline DWORD64 ReadULong64NoFence ( DWORD64 const volatile *Source ) { return (DWORD64)ReadNoFence64((PLONG64)Source); } __forceinline DWORD64 ReadULong64Raw ( DWORD64 const volatile *Source ) { return (DWORD64)ReadRaw64((PLONG64)Source); } __forceinline void WriteULong64Release ( DWORD64 volatile *Destination, DWORD64 Value ) { WriteRelease64((PLONG64)Destination, (LONG64)Value); return; } __forceinline void WriteULong64NoFence ( DWORD64 volatile *Destination, DWORD64 Value ) { WriteNoFence64((PLONG64)Destination, (LONG64)Value); return; } __forceinline void WriteULong64Raw ( DWORD64 volatile *Destination, DWORD64 Value ) { WriteRaw64((PLONG64)Destination, (LONG64)Value); return; } __forceinline PVOID ReadPointerAcquire ( PVOID const volatile *Source ) { return (PVOID)ReadAcquire64((PLONG64)Source); } __forceinline PVOID ReadPointerNoFence ( PVOID const volatile *Source ) { return (PVOID)ReadNoFence64((PLONG64)Source); } __forceinline PVOID ReadPointerRaw ( PVOID const volatile *Source ) { return (PVOID)ReadRaw64((PLONG64)Source); } __forceinline void WritePointerRelease ( PVOID volatile *Destination, PVOID Value ) { WriteRelease64((PLONG64)Destination, (LONG64)Value); return; } __forceinline void WritePointerNoFence ( PVOID volatile *Destination, PVOID Value ) { WriteNoFence64((PLONG64)Destination, (LONG64)Value); return; } __forceinline void WritePointerRaw ( PVOID volatile *Destination, PVOID Value ) { WriteRaw64((PLONG64)Destination, (LONG64)Value); return; } typedef struct _WOW64_FLOATING_SAVE_AREA { DWORD ControlWord; DWORD StatusWord; DWORD TagWord; DWORD ErrorOffset; DWORD ErrorSelector; DWORD DataOffset; DWORD DataSelector; BYTE RegisterArea[80]; DWORD Cr0NpxState; } WOW64_FLOATING_SAVE_AREA; typedef WOW64_FLOATING_SAVE_AREA *PWOW64_FLOATING_SAVE_AREA; #pragma warning(disable: 4103) #pragma pack(push,4) typedef struct _WOW64_CONTEXT { DWORD ContextFlags; DWORD Dr0; DWORD Dr1; DWORD Dr2; DWORD Dr3; DWORD Dr6; DWORD Dr7; WOW64_FLOATING_SAVE_AREA FloatSave; DWORD SegGs; DWORD SegFs; DWORD SegEs; DWORD SegDs; DWORD Edi; DWORD Esi; DWORD Ebx; DWORD Edx; DWORD Ecx; DWORD Eax; DWORD Ebp; DWORD Eip; DWORD SegCs; DWORD EFlags; DWORD Esp; DWORD SegSs; BYTE ExtendedRegisters[512]; } WOW64_CONTEXT; typedef WOW64_CONTEXT *PWOW64_CONTEXT; #pragma warning(disable: 4103) #pragma pack(pop) typedef struct _WOW64_LDT_ENTRY { WORD LimitLow; WORD BaseLow; union { struct { BYTE BaseMid; BYTE Flags1; BYTE Flags2; BYTE BaseHi; } Bytes; struct { DWORD BaseMid : 8; DWORD Type : 5; DWORD Dpl : 2; DWORD Pres : 1; DWORD LimitHi : 4; DWORD Sys : 1; DWORD Reserved_0 : 1; DWORD Default_Big : 1; DWORD Granularity : 1; DWORD BaseHi : 8; } Bits; } HighWord; } WOW64_LDT_ENTRY, *PWOW64_LDT_ENTRY; typedef struct _WOW64_DESCRIPTOR_TABLE_ENTRY { DWORD Selector; WOW64_LDT_ENTRY Descriptor; } WOW64_DESCRIPTOR_TABLE_ENTRY, *PWOW64_DESCRIPTOR_TABLE_ENTRY; typedef struct _EXCEPTION_RECORD { DWORD ExceptionCode; DWORD ExceptionFlags; struct _EXCEPTION_RECORD *ExceptionRecord; PVOID ExceptionAddress; DWORD NumberParameters; ULONG_PTR ExceptionInformation[15]; } EXCEPTION_RECORD; typedef EXCEPTION_RECORD *PEXCEPTION_RECORD; typedef struct _EXCEPTION_RECORD32 { DWORD ExceptionCode; DWORD ExceptionFlags; DWORD ExceptionRecord; DWORD ExceptionAddress; DWORD NumberParameters; DWORD ExceptionInformation[15]; } EXCEPTION_RECORD32, *PEXCEPTION_RECORD32; typedef struct _EXCEPTION_RECORD64 { DWORD ExceptionCode; DWORD ExceptionFlags; DWORD64 ExceptionRecord; DWORD64 ExceptionAddress; DWORD NumberParameters; DWORD __unusedAlignment; DWORD64 ExceptionInformation[15]; } EXCEPTION_RECORD64, *PEXCEPTION_RECORD64; typedef struct _EXCEPTION_POINTERS { PEXCEPTION_RECORD ExceptionRecord; PCONTEXT ContextRecord; } EXCEPTION_POINTERS, *PEXCEPTION_POINTERS; typedef PVOID PACCESS_TOKEN; typedef PVOID PSECURITY_DESCRIPTOR; typedef PVOID PSID; typedef PVOID PCLAIMS_BLOB; typedef DWORD ACCESS_MASK; typedef ACCESS_MASK *PACCESS_MASK; typedef struct _GENERIC_MAPPING { ACCESS_MASK GenericRead; ACCESS_MASK GenericWrite; ACCESS_MASK GenericExecute; ACCESS_MASK GenericAll; } GENERIC_MAPPING; typedef GENERIC_MAPPING *PGENERIC_MAPPING; #pragma warning(disable: 4103) #pragma pack(push,4) typedef struct _LUID_AND_ATTRIBUTES { LUID Luid; DWORD Attributes; } LUID_AND_ATTRIBUTES, * PLUID_AND_ATTRIBUTES; typedef LUID_AND_ATTRIBUTES LUID_AND_ATTRIBUTES_ARRAY[1]; typedef LUID_AND_ATTRIBUTES_ARRAY *PLUID_AND_ATTRIBUTES_ARRAY; #pragma warning(disable: 4103) #pragma pack(pop) typedef struct _SID_IDENTIFIER_AUTHORITY { BYTE Value[6]; } SID_IDENTIFIER_AUTHORITY, *PSID_IDENTIFIER_AUTHORITY; typedef struct _SID { BYTE Revision; BYTE SubAuthorityCount; SID_IDENTIFIER_AUTHORITY IdentifierAuthority; DWORD SubAuthority[1]; } SID, *PISID; typedef union _SE_SID { SID Sid; BYTE Buffer[(sizeof(SID) - sizeof(DWORD) + ((15) * sizeof(DWORD)))]; } SE_SID, *PSE_SID; typedef enum _SID_NAME_USE { SidTypeUser = 1, SidTypeGroup, SidTypeDomain, SidTypeAlias, SidTypeWellKnownGroup, SidTypeDeletedAccount, SidTypeInvalid, SidTypeUnknown, SidTypeComputer, SidTypeLabel, SidTypeLogonSession } SID_NAME_USE, *PSID_NAME_USE; typedef struct _SID_AND_ATTRIBUTES { PSID Sid; DWORD Attributes; } SID_AND_ATTRIBUTES, * PSID_AND_ATTRIBUTES; typedef SID_AND_ATTRIBUTES SID_AND_ATTRIBUTES_ARRAY[1]; typedef SID_AND_ATTRIBUTES_ARRAY *PSID_AND_ATTRIBUTES_ARRAY; typedef ULONG_PTR SID_HASH_ENTRY, *PSID_HASH_ENTRY; typedef struct _SID_AND_ATTRIBUTES_HASH { DWORD SidCount; PSID_AND_ATTRIBUTES SidAttr; SID_HASH_ENTRY Hash[32]; } SID_AND_ATTRIBUTES_HASH, *PSID_AND_ATTRIBUTES_HASH; typedef enum { WinNullSid = 0, WinWorldSid = 1, WinLocalSid = 2, WinCreatorOwnerSid = 3, WinCreatorGroupSid = 4, WinCreatorOwnerServerSid = 5, WinCreatorGroupServerSid = 6, WinNtAuthoritySid = 7, WinDialupSid = 8, WinNetworkSid = 9, WinBatchSid = 10, WinInteractiveSid = 11, WinServiceSid = 12, WinAnonymousSid = 13, WinProxySid = 14, WinEnterpriseControllersSid = 15, WinSelfSid = 16, WinAuthenticatedUserSid = 17, WinRestrictedCodeSid = 18, WinTerminalServerSid = 19, WinRemoteLogonIdSid = 20, WinLogonIdsSid = 21, WinLocalSystemSid = 22, WinLocalServiceSid = 23, WinNetworkServiceSid = 24, WinBuiltinDomainSid = 25, WinBuiltinAdministratorsSid = 26, WinBuiltinUsersSid = 27, WinBuiltinGuestsSid = 28, WinBuiltinPowerUsersSid = 29, WinBuiltinAccountOperatorsSid = 30, WinBuiltinSystemOperatorsSid = 31, WinBuiltinPrintOperatorsSid = 32, WinBuiltinBackupOperatorsSid = 33, WinBuiltinReplicatorSid = 34, WinBuiltinPreWindows2000CompatibleAccessSid = 35, WinBuiltinRemoteDesktopUsersSid = 36, WinBuiltinNetworkConfigurationOperatorsSid = 37, WinAccountAdministratorSid = 38, WinAccountGuestSid = 39, WinAccountKrbtgtSid = 40, WinAccountDomainAdminsSid = 41, WinAccountDomainUsersSid = 42, WinAccountDomainGuestsSid = 43, WinAccountComputersSid = 44, WinAccountControllersSid = 45, WinAccountCertAdminsSid = 46, WinAccountSchemaAdminsSid = 47, WinAccountEnterpriseAdminsSid = 48, WinAccountPolicyAdminsSid = 49, WinAccountRasAndIasServersSid = 50, WinNTLMAuthenticationSid = 51, WinDigestAuthenticationSid = 52, WinSChannelAuthenticationSid = 53, WinThisOrganizationSid = 54, WinOtherOrganizationSid = 55, WinBuiltinIncomingForestTrustBuildersSid = 56, WinBuiltinPerfMonitoringUsersSid = 57, WinBuiltinPerfLoggingUsersSid = 58, WinBuiltinAuthorizationAccessSid = 59, WinBuiltinTerminalServerLicenseServersSid = 60, WinBuiltinDCOMUsersSid = 61, WinBuiltinIUsersSid = 62, WinIUserSid = 63, WinBuiltinCryptoOperatorsSid = 64, WinUntrustedLabelSid = 65, WinLowLabelSid = 66, WinMediumLabelSid = 67, WinHighLabelSid = 68, WinSystemLabelSid = 69, WinWriteRestrictedCodeSid = 70, WinCreatorOwnerRightsSid = 71, WinCacheablePrincipalsGroupSid = 72, WinNonCacheablePrincipalsGroupSid = 73, WinEnterpriseReadonlyControllersSid = 74, WinAccountReadonlyControllersSid = 75, WinBuiltinEventLogReadersGroup = 76, WinNewEnterpriseReadonlyControllersSid = 77, WinBuiltinCertSvcDComAccessGroup = 78, WinMediumPlusLabelSid = 79, WinLocalLogonSid = 80, WinConsoleLogonSid = 81, WinThisOrganizationCertificateSid = 82, WinApplicationPackageAuthoritySid = 83, WinBuiltinAnyPackageSid = 84, WinCapabilityInternetClientSid = 85, WinCapabilityInternetClientServerSid = 86, WinCapabilityPrivateNetworkClientServerSid = 87, WinCapabilityPicturesLibrarySid = 88, WinCapabilityVideosLibrarySid = 89, WinCapabilityMusicLibrarySid = 90, WinCapabilityDocumentsLibrarySid = 91, WinCapabilitySharedUserCertificatesSid = 92, WinCapabilityEnterpriseAuthenticationSid = 93, WinCapabilityRemovableStorageSid = 94, WinBuiltinRDSRemoteAccessServersSid = 95, WinBuiltinRDSEndpointServersSid = 96, WinBuiltinRDSManagementServersSid = 97, WinUserModeDriversSid = 98, WinBuiltinHyperVAdminsSid = 99, WinAccountCloneableControllersSid = 100, WinBuiltinAccessControlAssistanceOperatorsSid = 101, WinBuiltinRemoteManagementUsersSid = 102, WinAuthenticationAuthorityAssertedSid = 103, WinAuthenticationServiceAssertedSid = 104, WinLocalAccountSid = 105, WinLocalAccountAndAdministratorSid = 106, WinAccountProtectedUsersSid = 107, WinCapabilityAppointmentsSid = 108, WinCapabilityContactsSid = 109, WinAccountDefaultSystemManagedSid = 110, WinBuiltinDefaultSystemManagedGroupSid = 111, WinBuiltinStorageReplicaAdminsSid = 112, WinAccountKeyAdminsSid = 113, WinAccountEnterpriseKeyAdminsSid = 114, WinAuthenticationKeyTrustSid = 115, WinAuthenticationKeyPropertyMFASid = 116, WinAuthenticationKeyPropertyAttestationSid = 117, WinAuthenticationFreshKeyAuthSid = 118, WinBuiltinDeviceOwnersSid = 119, } WELL_KNOWN_SID_TYPE; typedef struct _ACL { BYTE AclRevision; BYTE Sbz1; WORD AclSize; WORD AceCount; WORD Sbz2; } ACL; typedef ACL *PACL; typedef struct _ACE_HEADER { BYTE AceType; BYTE AceFlags; WORD AceSize; } ACE_HEADER; typedef ACE_HEADER *PACE_HEADER; typedef struct _ACCESS_ALLOWED_ACE { ACE_HEADER Header; ACCESS_MASK Mask; DWORD SidStart; } ACCESS_ALLOWED_ACE; typedef ACCESS_ALLOWED_ACE *PACCESS_ALLOWED_ACE; typedef struct _ACCESS_DENIED_ACE { ACE_HEADER Header; ACCESS_MASK Mask; DWORD SidStart; } ACCESS_DENIED_ACE; typedef ACCESS_DENIED_ACE *PACCESS_DENIED_ACE; typedef struct _SYSTEM_AUDIT_ACE { ACE_HEADER Header; ACCESS_MASK Mask; DWORD SidStart; } SYSTEM_AUDIT_ACE; typedef SYSTEM_AUDIT_ACE *PSYSTEM_AUDIT_ACE; typedef struct _SYSTEM_ALARM_ACE { ACE_HEADER Header; ACCESS_MASK Mask; DWORD SidStart; } SYSTEM_ALARM_ACE; typedef SYSTEM_ALARM_ACE *PSYSTEM_ALARM_ACE; typedef struct _SYSTEM_RESOURCE_ATTRIBUTE_ACE { ACE_HEADER Header; ACCESS_MASK Mask; DWORD SidStart; } SYSTEM_RESOURCE_ATTRIBUTE_ACE, *PSYSTEM_RESOURCE_ATTRIBUTE_ACE; typedef struct _SYSTEM_SCOPED_POLICY_ID_ACE { ACE_HEADER Header; ACCESS_MASK Mask; DWORD SidStart; } SYSTEM_SCOPED_POLICY_ID_ACE, *PSYSTEM_SCOPED_POLICY_ID_ACE; typedef struct _SYSTEM_MANDATORY_LABEL_ACE { ACE_HEADER Header; ACCESS_MASK Mask; DWORD SidStart; } SYSTEM_MANDATORY_LABEL_ACE, *PSYSTEM_MANDATORY_LABEL_ACE; typedef struct _SYSTEM_PROCESS_TRUST_LABEL_ACE { ACE_HEADER Header; ACCESS_MASK Mask; DWORD SidStart; } SYSTEM_PROCESS_TRUST_LABEL_ACE, *PSYSTEM_PROCESS_TRUST_LABEL_ACE; typedef struct _SYSTEM_ACCESS_FILTER_ACE { ACE_HEADER Header; ACCESS_MASK Mask; DWORD SidStart; } SYSTEM_ACCESS_FILTER_ACE, *PSYSTEM_ACCESS_FILTER_ACE; typedef struct _ACCESS_ALLOWED_OBJECT_ACE { ACE_HEADER Header; ACCESS_MASK Mask; DWORD Flags; GUID ObjectType; GUID InheritedObjectType; DWORD SidStart; } ACCESS_ALLOWED_OBJECT_ACE, *PACCESS_ALLOWED_OBJECT_ACE; typedef struct _ACCESS_DENIED_OBJECT_ACE { ACE_HEADER Header; ACCESS_MASK Mask; DWORD Flags; GUID ObjectType; GUID InheritedObjectType; DWORD SidStart; } ACCESS_DENIED_OBJECT_ACE, *PACCESS_DENIED_OBJECT_ACE; typedef struct _SYSTEM_AUDIT_OBJECT_ACE { ACE_HEADER Header; ACCESS_MASK Mask; DWORD Flags; GUID ObjectType; GUID InheritedObjectType; DWORD SidStart; } SYSTEM_AUDIT_OBJECT_ACE, *PSYSTEM_AUDIT_OBJECT_ACE; typedef struct _SYSTEM_ALARM_OBJECT_ACE { ACE_HEADER Header; ACCESS_MASK Mask; DWORD Flags; GUID ObjectType; GUID InheritedObjectType; DWORD SidStart; } SYSTEM_ALARM_OBJECT_ACE, *PSYSTEM_ALARM_OBJECT_ACE; typedef struct _ACCESS_ALLOWED_CALLBACK_ACE { ACE_HEADER Header; ACCESS_MASK Mask; DWORD SidStart; } ACCESS_ALLOWED_CALLBACK_ACE, *PACCESS_ALLOWED_CALLBACK_ACE; typedef struct _ACCESS_DENIED_CALLBACK_ACE { ACE_HEADER Header; ACCESS_MASK Mask; DWORD SidStart; } ACCESS_DENIED_CALLBACK_ACE, *PACCESS_DENIED_CALLBACK_ACE; typedef struct _SYSTEM_AUDIT_CALLBACK_ACE { ACE_HEADER Header; ACCESS_MASK Mask; DWORD SidStart; } SYSTEM_AUDIT_CALLBACK_ACE, *PSYSTEM_AUDIT_CALLBACK_ACE; typedef struct _SYSTEM_ALARM_CALLBACK_ACE { ACE_HEADER Header; ACCESS_MASK Mask; DWORD SidStart; } SYSTEM_ALARM_CALLBACK_ACE, *PSYSTEM_ALARM_CALLBACK_ACE; typedef struct _ACCESS_ALLOWED_CALLBACK_OBJECT_ACE { ACE_HEADER Header; ACCESS_MASK Mask; DWORD Flags; GUID ObjectType; GUID InheritedObjectType; DWORD SidStart; } ACCESS_ALLOWED_CALLBACK_OBJECT_ACE, *PACCESS_ALLOWED_CALLBACK_OBJECT_ACE; typedef struct _ACCESS_DENIED_CALLBACK_OBJECT_ACE { ACE_HEADER Header; ACCESS_MASK Mask; DWORD Flags; GUID ObjectType; GUID InheritedObjectType; DWORD SidStart; } ACCESS_DENIED_CALLBACK_OBJECT_ACE, *PACCESS_DENIED_CALLBACK_OBJECT_ACE; typedef struct _SYSTEM_AUDIT_CALLBACK_OBJECT_ACE { ACE_HEADER Header; ACCESS_MASK Mask; DWORD Flags; GUID ObjectType; GUID InheritedObjectType; DWORD SidStart; } SYSTEM_AUDIT_CALLBACK_OBJECT_ACE, *PSYSTEM_AUDIT_CALLBACK_OBJECT_ACE; typedef struct _SYSTEM_ALARM_CALLBACK_OBJECT_ACE { ACE_HEADER Header; ACCESS_MASK Mask; DWORD Flags; GUID ObjectType; GUID InheritedObjectType; DWORD SidStart; } SYSTEM_ALARM_CALLBACK_OBJECT_ACE, *PSYSTEM_ALARM_CALLBACK_OBJECT_ACE; typedef enum _ACL_INFORMATION_CLASS { AclRevisionInformation = 1, AclSizeInformation } ACL_INFORMATION_CLASS; typedef struct _ACL_REVISION_INFORMATION { DWORD AclRevision; } ACL_REVISION_INFORMATION; typedef ACL_REVISION_INFORMATION *PACL_REVISION_INFORMATION; typedef struct _ACL_SIZE_INFORMATION { DWORD AceCount; DWORD AclBytesInUse; DWORD AclBytesFree; } ACL_SIZE_INFORMATION; typedef ACL_SIZE_INFORMATION *PACL_SIZE_INFORMATION; typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL; typedef struct _SECURITY_DESCRIPTOR_RELATIVE { BYTE Revision; BYTE Sbz1; SECURITY_DESCRIPTOR_CONTROL Control; DWORD Owner; DWORD Group; DWORD Sacl; DWORD Dacl; } SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE; typedef struct _SECURITY_DESCRIPTOR { BYTE Revision; BYTE Sbz1; SECURITY_DESCRIPTOR_CONTROL Control; PSID Owner; PSID Group; PACL Sacl; PACL Dacl; } SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR; typedef struct _SECURITY_OBJECT_AI_PARAMS { DWORD Size; DWORD ConstraintMask; } SECURITY_OBJECT_AI_PARAMS, *PSECURITY_OBJECT_AI_PARAMS; typedef struct _OBJECT_TYPE_LIST { WORD Level; WORD Sbz; GUID *ObjectType; } OBJECT_TYPE_LIST, *POBJECT_TYPE_LIST; typedef enum _AUDIT_EVENT_TYPE { AuditEventObjectAccess, AuditEventDirectoryServiceAccess } AUDIT_EVENT_TYPE, *PAUDIT_EVENT_TYPE; typedef struct _PRIVILEGE_SET { DWORD PrivilegeCount; DWORD Control; LUID_AND_ATTRIBUTES Privilege[1]; } PRIVILEGE_SET, * PPRIVILEGE_SET; typedef enum _ACCESS_REASON_TYPE{ AccessReasonNone = 0x00000000, AccessReasonAllowedAce = 0x00010000, AccessReasonDeniedAce = 0x00020000, AccessReasonAllowedParentAce = 0x00030000, AccessReasonDeniedParentAce = 0x00040000, AccessReasonNotGrantedByCape = 0x00050000, AccessReasonNotGrantedByParentCape = 0x00060000, AccessReasonNotGrantedToAppContainer = 0x00070000, AccessReasonMissingPrivilege = 0x00100000, AccessReasonFromPrivilege = 0x00200000, AccessReasonIntegrityLevel = 0x00300000, AccessReasonOwnership = 0x00400000, AccessReasonNullDacl = 0x00500000, AccessReasonEmptyDacl = 0x00600000, AccessReasonNoSD = 0x00700000, AccessReasonNoGrant = 0x00800000, AccessReasonTrustLabel = 0x00900000, AccessReasonFilterAce = 0x00a00000 } ACCESS_REASON_TYPE; typedef DWORD ACCESS_REASON; typedef struct _ACCESS_REASONS{ ACCESS_REASON Data[32]; } ACCESS_REASONS, *PACCESS_REASONS; typedef struct _SE_SECURITY_DESCRIPTOR { DWORD Size; DWORD Flags; PSECURITY_DESCRIPTOR SecurityDescriptor; } SE_SECURITY_DESCRIPTOR, *PSE_SECURITY_DESCRIPTOR; typedef struct _SE_ACCESS_REQUEST { DWORD Size; PSE_SECURITY_DESCRIPTOR SeSecurityDescriptor; ACCESS_MASK DesiredAccess; ACCESS_MASK PreviouslyGrantedAccess; PSID PrincipalSelfSid; PGENERIC_MAPPING GenericMapping; DWORD ObjectTypeListCount; POBJECT_TYPE_LIST ObjectTypeList; } SE_ACCESS_REQUEST, *PSE_ACCESS_REQUEST; typedef struct _SE_ACCESS_REPLY { DWORD Size; DWORD ResultListCount; PACCESS_MASK GrantedAccess; PDWORD AccessStatus; PACCESS_REASONS AccessReason; PPRIVILEGE_SET* Privileges; } SE_ACCESS_REPLY, *PSE_ACCESS_REPLY; typedef enum _SECURITY_IMPERSONATION_LEVEL { SecurityAnonymous, SecurityIdentification, SecurityImpersonation, SecurityDelegation } SECURITY_IMPERSONATION_LEVEL, * PSECURITY_IMPERSONATION_LEVEL; typedef enum _TOKEN_TYPE { TokenPrimary = 1, TokenImpersonation } TOKEN_TYPE; typedef TOKEN_TYPE *PTOKEN_TYPE; typedef enum _TOKEN_ELEVATION_TYPE { TokenElevationTypeDefault = 1, TokenElevationTypeFull, TokenElevationTypeLimited, } TOKEN_ELEVATION_TYPE, *PTOKEN_ELEVATION_TYPE; typedef enum _TOKEN_INFORMATION_CLASS { TokenUser = 1, TokenGroups, TokenPrivileges, TokenOwner, TokenPrimaryGroup, TokenDefaultDacl, TokenSource, TokenType, TokenImpersonationLevel, TokenStatistics, TokenRestrictedSids, TokenSessionId, TokenGroupsAndPrivileges, TokenSessionReference, TokenSandBoxInert, TokenAuditPolicy, TokenOrigin, TokenElevationType, TokenLinkedToken, TokenElevation, TokenHasRestrictions, TokenAccessInformation, TokenVirtualizationAllowed, TokenVirtualizationEnabled, TokenIntegrityLevel, TokenUIAccess, TokenMandatoryPolicy, TokenLogonSid, TokenIsAppContainer, TokenCapabilities, TokenAppContainerSid, TokenAppContainerNumber, TokenUserClaimAttributes, TokenDeviceClaimAttributes, TokenRestrictedUserClaimAttributes, TokenRestrictedDeviceClaimAttributes, TokenDeviceGroups, TokenRestrictedDeviceGroups, TokenSecurityAttributes, TokenIsRestricted, TokenProcessTrustLevel, TokenPrivateNameSpace, TokenSingletonAttributes, TokenBnoIsolation, TokenChildProcessFlags, TokenIsLessPrivilegedAppContainer, TokenIsSandboxed, TokenOriginatingProcessTrustLevel, MaxTokenInfoClass } TOKEN_INFORMATION_CLASS, *PTOKEN_INFORMATION_CLASS; typedef struct _TOKEN_USER { SID_AND_ATTRIBUTES User; } TOKEN_USER, *PTOKEN_USER; typedef struct _SE_TOKEN_USER { union { TOKEN_USER TokenUser; SID_AND_ATTRIBUTES User; } ; union { SID Sid; BYTE Buffer[(sizeof(SID) - sizeof(DWORD) + ((15) * sizeof(DWORD)))]; } ; } SE_TOKEN_USER , PSE_TOKEN_USER; typedef struct _TOKEN_GROUPS { DWORD GroupCount; SID_AND_ATTRIBUTES Groups[1]; } TOKEN_GROUPS, *PTOKEN_GROUPS; typedef struct _TOKEN_PRIVILEGES { DWORD PrivilegeCount; LUID_AND_ATTRIBUTES Privileges[1]; } TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES; typedef struct _TOKEN_OWNER { PSID Owner; } TOKEN_OWNER, *PTOKEN_OWNER; typedef struct _TOKEN_PRIMARY_GROUP { PSID PrimaryGroup; } TOKEN_PRIMARY_GROUP, *PTOKEN_PRIMARY_GROUP; typedef struct _TOKEN_DEFAULT_DACL { PACL DefaultDacl; } TOKEN_DEFAULT_DACL, *PTOKEN_DEFAULT_DACL; typedef struct _TOKEN_USER_CLAIMS { PCLAIMS_BLOB UserClaims; } TOKEN_USER_CLAIMS, *PTOKEN_USER_CLAIMS; typedef struct _TOKEN_DEVICE_CLAIMS { PCLAIMS_BLOB DeviceClaims; } TOKEN_DEVICE_CLAIMS, *PTOKEN_DEVICE_CLAIMS; typedef struct _TOKEN_GROUPS_AND_PRIVILEGES { DWORD SidCount; DWORD SidLength; PSID_AND_ATTRIBUTES Sids; DWORD RestrictedSidCount; DWORD RestrictedSidLength; PSID_AND_ATTRIBUTES RestrictedSids; DWORD PrivilegeCount; DWORD PrivilegeLength; PLUID_AND_ATTRIBUTES Privileges; LUID AuthenticationId; } TOKEN_GROUPS_AND_PRIVILEGES, *PTOKEN_GROUPS_AND_PRIVILEGES; typedef struct _TOKEN_LINKED_TOKEN { HANDLE LinkedToken; } TOKEN_LINKED_TOKEN, *PTOKEN_LINKED_TOKEN; typedef struct _TOKEN_ELEVATION { DWORD TokenIsElevated; } TOKEN_ELEVATION, *PTOKEN_ELEVATION; typedef struct _TOKEN_MANDATORY_LABEL { SID_AND_ATTRIBUTES Label; } TOKEN_MANDATORY_LABEL, *PTOKEN_MANDATORY_LABEL; typedef struct _TOKEN_MANDATORY_POLICY { DWORD Policy; } TOKEN_MANDATORY_POLICY, *PTOKEN_MANDATORY_POLICY; typedef PVOID PSECURITY_ATTRIBUTES_OPAQUE; typedef struct _TOKEN_ACCESS_INFORMATION { PSID_AND_ATTRIBUTES_HASH SidHash; PSID_AND_ATTRIBUTES_HASH RestrictedSidHash; PTOKEN_PRIVILEGES Privileges; LUID AuthenticationId; TOKEN_TYPE TokenType; SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; TOKEN_MANDATORY_POLICY MandatoryPolicy; DWORD Flags; DWORD AppContainerNumber; PSID PackageSid; PSID_AND_ATTRIBUTES_HASH CapabilitiesHash; PSID TrustLevelSid; PSECURITY_ATTRIBUTES_OPAQUE SecurityAttributes; } TOKEN_ACCESS_INFORMATION, *PTOKEN_ACCESS_INFORMATION; typedef struct _TOKEN_AUDIT_POLICY { BYTE PerUserPolicy[(((59)) >> 1) + 1]; } TOKEN_AUDIT_POLICY, *PTOKEN_AUDIT_POLICY; typedef struct _TOKEN_SOURCE { CHAR SourceName[8]; LUID SourceIdentifier; } TOKEN_SOURCE, *PTOKEN_SOURCE; typedef struct _TOKEN_STATISTICS { LUID TokenId; LUID AuthenticationId; LARGE_INTEGER ExpirationTime; TOKEN_TYPE TokenType; SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; DWORD DynamicCharged; DWORD DynamicAvailable; DWORD GroupCount; DWORD PrivilegeCount; LUID ModifiedId; } TOKEN_STATISTICS, *PTOKEN_STATISTICS; typedef struct _TOKEN_CONTROL { LUID TokenId; LUID AuthenticationId; LUID ModifiedId; TOKEN_SOURCE TokenSource; } TOKEN_CONTROL, *PTOKEN_CONTROL; typedef struct _TOKEN_ORIGIN { LUID OriginatingLogonSession ; } TOKEN_ORIGIN, * PTOKEN_ORIGIN ; typedef enum _MANDATORY_LEVEL { MandatoryLevelUntrusted = 0, MandatoryLevelLow, MandatoryLevelMedium, MandatoryLevelHigh, MandatoryLevelSystem, MandatoryLevelSecureProcess, MandatoryLevelCount } MANDATORY_LEVEL, *PMANDATORY_LEVEL; typedef struct _TOKEN_APPCONTAINER_INFORMATION { PSID TokenAppContainer; } TOKEN_APPCONTAINER_INFORMATION, *PTOKEN_APPCONTAINER_INFORMATION; typedef struct _TOKEN_SID_INFORMATION { PSID Sid; } TOKEN_SID_INFORMATION, *PTOKEN_SID_INFORMATION; typedef struct _TOKEN_BNO_ISOLATION_INFORMATION { PWSTR IsolationPrefix; BOOLEAN IsolationEnabled; } TOKEN_BNO_ISOLATION_INFORMATION, *PTOKEN_BNO_ISOLATION_INFORMATION; typedef struct _CLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE { DWORD64 Version; PWSTR Name; } CLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE, *PCLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE; typedef struct _CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE { PVOID pValue; DWORD ValueLength; } CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE, *PCLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE; typedef struct _CLAIM_SECURITY_ATTRIBUTE_V1 { PWSTR Name; WORD ValueType; WORD Reserved; DWORD Flags; DWORD ValueCount; union { PLONG64 pInt64; PDWORD64 pUint64; PWSTR *ppString; PCLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE pFqbn; PCLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE pOctetString; } Values; } CLAIM_SECURITY_ATTRIBUTE_V1, *PCLAIM_SECURITY_ATTRIBUTE_V1; typedef struct _CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 { DWORD Name; WORD ValueType; WORD Reserved; DWORD Flags; DWORD ValueCount; union { DWORD pInt64[1]; DWORD pUint64[1]; DWORD ppString[1]; DWORD pFqbn[1]; DWORD pOctetString[1]; } Values; } CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1, *PCLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1; typedef struct _CLAIM_SECURITY_ATTRIBUTES_INFORMATION { WORD Version; WORD Reserved; DWORD AttributeCount; union { PCLAIM_SECURITY_ATTRIBUTE_V1 pAttributeV1; } Attribute; } CLAIM_SECURITY_ATTRIBUTES_INFORMATION, *PCLAIM_SECURITY_ATTRIBUTES_INFORMATION; typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE, * PSECURITY_CONTEXT_TRACKING_MODE; typedef struct _SECURITY_QUALITY_OF_SERVICE { DWORD Length; SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode; BOOLEAN EffectiveOnly; } SECURITY_QUALITY_OF_SERVICE, * PSECURITY_QUALITY_OF_SERVICE; typedef struct _SE_IMPERSONATION_STATE { PACCESS_TOKEN Token; BOOLEAN CopyOnOpen; BOOLEAN EffectiveOnly; SECURITY_IMPERSONATION_LEVEL Level; } SE_IMPERSONATION_STATE, *PSE_IMPERSONATION_STATE; typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION; typedef BYTE SE_SIGNING_LEVEL, *PSE_SIGNING_LEVEL; typedef enum _SE_IMAGE_SIGNATURE_TYPE { SeImageSignatureNone = 0, SeImageSignatureEmbedded, SeImageSignatureCache, SeImageSignatureCatalogCached, SeImageSignatureCatalogNotCached, SeImageSignatureCatalogHint, SeImageSignaturePackageCatalog, } SE_IMAGE_SIGNATURE_TYPE, *PSE_IMAGE_SIGNATURE_TYPE; typedef enum _SE_LEARNING_MODE_DATA_TYPE { SeLearningModeInvalidType = 0, SeLearningModeSettings, SeLearningModeMax } SE_LEARNING_MODE_DATA_TYPE; typedef struct _SECURITY_CAPABILITIES { PSID AppContainerSid; PSID_AND_ATTRIBUTES Capabilities; DWORD CapabilityCount; DWORD Reserved; } SECURITY_CAPABILITIES, *PSECURITY_CAPABILITIES, *LPSECURITY_CAPABILITIES; typedef struct _JOB_SET_ARRAY { HANDLE JobHandle; DWORD MemberLevel; DWORD Flags; } JOB_SET_ARRAY, *PJOB_SET_ARRAY; typedef struct _EXCEPTION_REGISTRATION_RECORD { struct _EXCEPTION_REGISTRATION_RECORD *Next; PEXCEPTION_ROUTINE Handler; } EXCEPTION_REGISTRATION_RECORD; typedef EXCEPTION_REGISTRATION_RECORD *PEXCEPTION_REGISTRATION_RECORD; typedef struct _NT_TIB { struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList; PVOID StackBase; PVOID StackLimit; PVOID SubSystemTib; union { PVOID FiberData; DWORD Version; }; PVOID ArbitraryUserPointer; struct _NT_TIB *Self; } NT_TIB; typedef NT_TIB *PNT_TIB; typedef struct _NT_TIB32 { DWORD ExceptionList; DWORD StackBase; DWORD StackLimit; DWORD SubSystemTib; union { DWORD FiberData; DWORD Version; }; DWORD ArbitraryUserPointer; DWORD Self; } NT_TIB32, *PNT_TIB32; typedef struct _NT_TIB64 { DWORD64 ExceptionList; DWORD64 StackBase; DWORD64 StackLimit; DWORD64 SubSystemTib; union { DWORD64 FiberData; DWORD Version; }; DWORD64 ArbitraryUserPointer; DWORD64 Self; } NT_TIB64, *PNT_TIB64; typedef struct _UMS_CREATE_THREAD_ATTRIBUTES { DWORD UmsVersion; PVOID UmsContext; PVOID UmsCompletionList; } UMS_CREATE_THREAD_ATTRIBUTES, *PUMS_CREATE_THREAD_ATTRIBUTES; typedef struct _WOW64_ARCHITECTURE_INFORMATION { DWORD Machine : 16; DWORD KernelMode : 1; DWORD UserMode : 1; DWORD Native : 1; DWORD Process : 1; DWORD ReservedZero0 : 12; } WOW64_ARCHITECTURE_INFORMATION; typedef struct _QUOTA_LIMITS { SIZE_T PagedPoolLimit; SIZE_T NonPagedPoolLimit; SIZE_T MinimumWorkingSetSize; SIZE_T MaximumWorkingSetSize; SIZE_T PagefileLimit; LARGE_INTEGER TimeLimit; } QUOTA_LIMITS, *PQUOTA_LIMITS; typedef union _RATE_QUOTA_LIMIT { DWORD RateData; struct { DWORD RatePercent : 7; DWORD Reserved0 : 25; } ; } RATE_QUOTA_LIMIT, *PRATE_QUOTA_LIMIT; typedef struct _QUOTA_LIMITS_EX { SIZE_T PagedPoolLimit; SIZE_T NonPagedPoolLimit; SIZE_T MinimumWorkingSetSize; SIZE_T MaximumWorkingSetSize; SIZE_T PagefileLimit; LARGE_INTEGER TimeLimit; SIZE_T WorkingSetLimit; SIZE_T Reserved2; SIZE_T Reserved3; SIZE_T Reserved4; DWORD Flags; RATE_QUOTA_LIMIT CpuRateLimit; } QUOTA_LIMITS_EX, *PQUOTA_LIMITS_EX; typedef struct _IO_COUNTERS { ULONGLONG ReadOperationCount; ULONGLONG WriteOperationCount; ULONGLONG OtherOperationCount; ULONGLONG ReadTransferCount; ULONGLONG WriteTransferCount; ULONGLONG OtherTransferCount; } IO_COUNTERS; typedef IO_COUNTERS *PIO_COUNTERS; typedef enum _HARDWARE_COUNTER_TYPE { PMCCounter, MaxHardwareCounterType } HARDWARE_COUNTER_TYPE, *PHARDWARE_COUNTER_TYPE; typedef enum _PROCESS_MITIGATION_POLICY { ProcessDEPPolicy, ProcessASLRPolicy, ProcessDynamicCodePolicy, ProcessStrictHandleCheckPolicy, ProcessSystemCallDisablePolicy, ProcessMitigationOptionsMask, ProcessExtensionPointDisablePolicy, ProcessControlFlowGuardPolicy, ProcessSignaturePolicy, ProcessFontDisablePolicy, ProcessImageLoadPolicy, ProcessSystemCallFilterPolicy, ProcessPayloadRestrictionPolicy, ProcessChildProcessPolicy, ProcessSideChannelIsolationPolicy, MaxProcessMitigationPolicy } PROCESS_MITIGATION_POLICY, *PPROCESS_MITIGATION_POLICY; typedef struct _PROCESS_MITIGATION_ASLR_POLICY { union { DWORD Flags; struct { DWORD EnableBottomUpRandomization : 1; DWORD EnableForceRelocateImages : 1; DWORD EnableHighEntropy : 1; DWORD DisallowStrippedImages : 1; DWORD ReservedFlags : 28; } ; } ; } PROCESS_MITIGATION_ASLR_POLICY, *PPROCESS_MITIGATION_ASLR_POLICY; typedef struct _PROCESS_MITIGATION_DEP_POLICY { union { DWORD Flags; struct { DWORD Enable : 1; DWORD DisableAtlThunkEmulation : 1; DWORD ReservedFlags : 30; } ; } ; BOOLEAN Permanent; } PROCESS_MITIGATION_DEP_POLICY, *PPROCESS_MITIGATION_DEP_POLICY; typedef struct _PROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY { union { DWORD Flags; struct { DWORD RaiseExceptionOnInvalidHandleReference : 1; DWORD HandleExceptionsPermanentlyEnabled : 1; DWORD ReservedFlags : 30; } ; } ; } PROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY, *PPROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY; typedef struct _PROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY { union { DWORD Flags; struct { DWORD DisallowWin32kSystemCalls : 1; DWORD AuditDisallowWin32kSystemCalls : 1; DWORD ReservedFlags : 30; } ; } ; } PROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY, *PPROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY; typedef struct _PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY { union { DWORD Flags; struct { DWORD DisableExtensionPoints : 1; DWORD ReservedFlags : 31; } ; } ; } PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY, *PPROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY; typedef struct _PROCESS_MITIGATION_DYNAMIC_CODE_POLICY { union { DWORD Flags; struct { DWORD ProhibitDynamicCode : 1; DWORD AllowThreadOptOut : 1; DWORD AllowRemoteDowngrade : 1; DWORD AuditProhibitDynamicCode : 1; DWORD ReservedFlags : 28; } ; } ; } PROCESS_MITIGATION_DYNAMIC_CODE_POLICY, *PPROCESS_MITIGATION_DYNAMIC_CODE_POLICY; typedef struct _PROCESS_MITIGATION_CONTROL_FLOW_GUARD_POLICY { union { DWORD Flags; struct { DWORD EnableControlFlowGuard : 1; DWORD EnableExportSuppression : 1; DWORD StrictMode : 1; DWORD ReservedFlags : 29; } ; } ; } PROCESS_MITIGATION_CONTROL_FLOW_GUARD_POLICY, *PPROCESS_MITIGATION_CONTROL_FLOW_GUARD_POLICY; typedef struct _PROCESS_MITIGATION_BINARY_SIGNATURE_POLICY { union { DWORD Flags; struct { DWORD MicrosoftSignedOnly : 1; DWORD StoreSignedOnly : 1; DWORD MitigationOptIn : 1; DWORD AuditMicrosoftSignedOnly : 1; DWORD AuditStoreSignedOnly : 1; DWORD ReservedFlags : 27; } ; } ; } PROCESS_MITIGATION_BINARY_SIGNATURE_POLICY, *PPROCESS_MITIGATION_BINARY_SIGNATURE_POLICY; typedef struct _PROCESS_MITIGATION_FONT_DISABLE_POLICY { union { DWORD Flags; struct { DWORD DisableNonSystemFonts : 1; DWORD AuditNonSystemFontLoading : 1; DWORD ReservedFlags : 30; } ; } ; } PROCESS_MITIGATION_FONT_DISABLE_POLICY, *PPROCESS_MITIGATION_FONT_DISABLE_POLICY; typedef struct _PROCESS_MITIGATION_IMAGE_LOAD_POLICY { union { DWORD Flags; struct { DWORD NoRemoteImages : 1; DWORD NoLowMandatoryLabelImages : 1; DWORD PreferSystem32Images : 1; DWORD AuditNoRemoteImages : 1; DWORD AuditNoLowMandatoryLabelImages : 1; DWORD ReservedFlags : 27; } ; } ; } PROCESS_MITIGATION_IMAGE_LOAD_POLICY, *PPROCESS_MITIGATION_IMAGE_LOAD_POLICY; typedef struct _PROCESS_MITIGATION_SYSTEM_CALL_FILTER_POLICY { union { DWORD Flags; struct { DWORD FilterId: 4; DWORD ReservedFlags : 28; } ; } ; } PROCESS_MITIGATION_SYSTEM_CALL_FILTER_POLICY, *PPROCESS_MITIGATION_SYSTEM_CALL_FILTER_POLICY; typedef struct _PROCESS_MITIGATION_PAYLOAD_RESTRICTION_POLICY { union { DWORD Flags; struct { DWORD EnableExportAddressFilter : 1; DWORD AuditExportAddressFilter : 1; DWORD EnableExportAddressFilterPlus : 1; DWORD AuditExportAddressFilterPlus : 1; DWORD EnableImportAddressFilter : 1; DWORD AuditImportAddressFilter : 1; DWORD EnableRopStackPivot : 1; DWORD AuditRopStackPivot : 1; DWORD EnableRopCallerCheck : 1; DWORD AuditRopCallerCheck : 1; DWORD EnableRopSimExec : 1; DWORD AuditRopSimExec : 1; DWORD ReservedFlags : 20; } ; } ; } PROCESS_MITIGATION_PAYLOAD_RESTRICTION_POLICY, *PPROCESS_MITIGATION_PAYLOAD_RESTRICTION_POLICY; typedef struct _PROCESS_MITIGATION_CHILD_PROCESS_POLICY { union { DWORD Flags; struct { DWORD NoChildProcessCreation : 1; DWORD AuditNoChildProcessCreation : 1; DWORD AllowSecureProcessCreation : 1; DWORD ReservedFlags : 29; } ; } ; } PROCESS_MITIGATION_CHILD_PROCESS_POLICY, *PPROCESS_MITIGATION_CHILD_PROCESS_POLICY; typedef struct _PROCESS_MITIGATION_SIDE_CHANNEL_ISOLATION_POLICY { union { DWORD Flags; struct { DWORD SmtBranchTargetIsolation : 1; DWORD IsolateSecurityDomain : 1; DWORD DisablePageCombine : 1; DWORD SpeculativeStoreBypassDisable : 1; DWORD ReservedFlags : 28; } ; } ; } PROCESS_MITIGATION_SIDE_CHANNEL_ISOLATION_POLICY, *PPROCESS_MITIGATION_SIDE_CHANNEL_ISOLATION_POLICY; typedef struct _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION { LARGE_INTEGER TotalUserTime; LARGE_INTEGER TotalKernelTime; LARGE_INTEGER ThisPeriodTotalUserTime; LARGE_INTEGER ThisPeriodTotalKernelTime; DWORD TotalPageFaultCount; DWORD TotalProcesses; DWORD ActiveProcesses; DWORD TotalTerminatedProcesses; } JOBOBJECT_BASIC_ACCOUNTING_INFORMATION, *PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION; typedef struct _JOBOBJECT_BASIC_LIMIT_INFORMATION { LARGE_INTEGER PerProcessUserTimeLimit; LARGE_INTEGER PerJobUserTimeLimit; DWORD LimitFlags; SIZE_T MinimumWorkingSetSize; SIZE_T MaximumWorkingSetSize; DWORD ActiveProcessLimit; ULONG_PTR Affinity; DWORD PriorityClass; DWORD SchedulingClass; } JOBOBJECT_BASIC_LIMIT_INFORMATION, *PJOBOBJECT_BASIC_LIMIT_INFORMATION; typedef struct _JOBOBJECT_EXTENDED_LIMIT_INFORMATION { JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation; IO_COUNTERS IoInfo; SIZE_T ProcessMemoryLimit; SIZE_T JobMemoryLimit; SIZE_T PeakProcessMemoryUsed; SIZE_T PeakJobMemoryUsed; } JOBOBJECT_EXTENDED_LIMIT_INFORMATION, *PJOBOBJECT_EXTENDED_LIMIT_INFORMATION; typedef struct _JOBOBJECT_BASIC_PROCESS_ID_LIST { DWORD NumberOfAssignedProcesses; DWORD NumberOfProcessIdsInList; ULONG_PTR ProcessIdList[1]; } JOBOBJECT_BASIC_PROCESS_ID_LIST, *PJOBOBJECT_BASIC_PROCESS_ID_LIST; typedef struct _JOBOBJECT_BASIC_UI_RESTRICTIONS { DWORD UIRestrictionsClass; } JOBOBJECT_BASIC_UI_RESTRICTIONS, *PJOBOBJECT_BASIC_UI_RESTRICTIONS; typedef struct _JOBOBJECT_SECURITY_LIMIT_INFORMATION { DWORD SecurityLimitFlags ; HANDLE JobToken ; PTOKEN_GROUPS SidsToDisable ; PTOKEN_PRIVILEGES PrivilegesToDelete ; PTOKEN_GROUPS RestrictedSids ; } JOBOBJECT_SECURITY_LIMIT_INFORMATION, *PJOBOBJECT_SECURITY_LIMIT_INFORMATION ; typedef struct _JOBOBJECT_END_OF_JOB_TIME_INFORMATION { DWORD EndOfJobTimeAction; } JOBOBJECT_END_OF_JOB_TIME_INFORMATION, *PJOBOBJECT_END_OF_JOB_TIME_INFORMATION; typedef struct _JOBOBJECT_ASSOCIATE_COMPLETION_PORT { PVOID CompletionKey; HANDLE CompletionPort; } JOBOBJECT_ASSOCIATE_COMPLETION_PORT, *PJOBOBJECT_ASSOCIATE_COMPLETION_PORT; typedef struct _JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION { JOBOBJECT_BASIC_ACCOUNTING_INFORMATION BasicInfo; IO_COUNTERS IoInfo; } JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION, *PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION; typedef struct _JOBOBJECT_JOBSET_INFORMATION { DWORD MemberLevel; } JOBOBJECT_JOBSET_INFORMATION, *PJOBOBJECT_JOBSET_INFORMATION; typedef enum _JOBOBJECT_RATE_CONTROL_TOLERANCE { ToleranceLow = 1, ToleranceMedium, ToleranceHigh } JOBOBJECT_RATE_CONTROL_TOLERANCE, *PJOBOBJECT_RATE_CONTROL_TOLERANCE; typedef enum _JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL { ToleranceIntervalShort = 1, ToleranceIntervalMedium, ToleranceIntervalLong } JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL, *PJOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL; typedef struct _JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION { DWORD64 IoReadBytesLimit; DWORD64 IoWriteBytesLimit; LARGE_INTEGER PerJobUserTimeLimit; DWORD64 JobMemoryLimit; JOBOBJECT_RATE_CONTROL_TOLERANCE RateControlTolerance; JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL RateControlToleranceInterval; DWORD LimitFlags; } JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION, *PJOBOBJECT_NOTIFICATION_LIMIT_INFORMATION; typedef struct JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION_2 { DWORD64 IoReadBytesLimit; DWORD64 IoWriteBytesLimit; LARGE_INTEGER PerJobUserTimeLimit; union { DWORD64 JobHighMemoryLimit; DWORD64 JobMemoryLimit; } ; union { JOBOBJECT_RATE_CONTROL_TOLERANCE RateControlTolerance; JOBOBJECT_RATE_CONTROL_TOLERANCE CpuRateControlTolerance; } ; union { JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL RateControlToleranceInterval; JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL CpuRateControlToleranceInterval; } ; DWORD LimitFlags; JOBOBJECT_RATE_CONTROL_TOLERANCE IoRateControlTolerance; DWORD64 JobLowMemoryLimit; JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL IoRateControlToleranceInterval; JOBOBJECT_RATE_CONTROL_TOLERANCE NetRateControlTolerance; JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL NetRateControlToleranceInterval; } JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION_2; typedef struct _JOBOBJECT_LIMIT_VIOLATION_INFORMATION { DWORD LimitFlags; DWORD ViolationLimitFlags; DWORD64 IoReadBytes; DWORD64 IoReadBytesLimit; DWORD64 IoWriteBytes; DWORD64 IoWriteBytesLimit; LARGE_INTEGER PerJobUserTime; LARGE_INTEGER PerJobUserTimeLimit; DWORD64 JobMemory; DWORD64 JobMemoryLimit; JOBOBJECT_RATE_CONTROL_TOLERANCE RateControlTolerance; JOBOBJECT_RATE_CONTROL_TOLERANCE RateControlToleranceLimit; } JOBOBJECT_LIMIT_VIOLATION_INFORMATION, *PJOBOBJECT_LIMIT_VIOLATION_INFORMATION; typedef struct JOBOBJECT_LIMIT_VIOLATION_INFORMATION_2 { DWORD LimitFlags; DWORD ViolationLimitFlags; DWORD64 IoReadBytes; DWORD64 IoReadBytesLimit; DWORD64 IoWriteBytes; DWORD64 IoWriteBytesLimit; LARGE_INTEGER PerJobUserTime; LARGE_INTEGER PerJobUserTimeLimit; DWORD64 JobMemory; union { DWORD64 JobHighMemoryLimit; DWORD64 JobMemoryLimit; } ; union { JOBOBJECT_RATE_CONTROL_TOLERANCE RateControlTolerance; JOBOBJECT_RATE_CONTROL_TOLERANCE CpuRateControlTolerance; } ; union { JOBOBJECT_RATE_CONTROL_TOLERANCE RateControlToleranceLimit; JOBOBJECT_RATE_CONTROL_TOLERANCE CpuRateControlToleranceLimit; } ; DWORD64 JobLowMemoryLimit; JOBOBJECT_RATE_CONTROL_TOLERANCE IoRateControlTolerance; JOBOBJECT_RATE_CONTROL_TOLERANCE IoRateControlToleranceLimit; JOBOBJECT_RATE_CONTROL_TOLERANCE NetRateControlTolerance; JOBOBJECT_RATE_CONTROL_TOLERANCE NetRateControlToleranceLimit; } JOBOBJECT_LIMIT_VIOLATION_INFORMATION_2; typedef struct _JOBOBJECT_CPU_RATE_CONTROL_INFORMATION { DWORD ControlFlags; union { DWORD CpuRate; DWORD Weight; struct { WORD MinRate; WORD MaxRate; } ; } ; } JOBOBJECT_CPU_RATE_CONTROL_INFORMATION, *PJOBOBJECT_CPU_RATE_CONTROL_INFORMATION; typedef enum JOB_OBJECT_NET_RATE_CONTROL_FLAGS { JOB_OBJECT_NET_RATE_CONTROL_ENABLE = 0x1, JOB_OBJECT_NET_RATE_CONTROL_MAX_BANDWIDTH = 0x2, JOB_OBJECT_NET_RATE_CONTROL_DSCP_TAG = 0x4, JOB_OBJECT_NET_RATE_CONTROL_VALID_FLAGS = 0x7 } JOB_OBJECT_NET_RATE_CONTROL_FLAGS; extern "C++" { inline constexpr JOB_OBJECT_NET_RATE_CONTROL_FLAGS operator | (JOB_OBJECT_NET_RATE_CONTROL_FLAGS a, JOB_OBJECT_NET_RATE_CONTROL_FLAGS b) throw() { return JOB_OBJECT_NET_RATE_CONTROL_FLAGS(((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_NET_RATE_CONTROL_FLAGS>::type)a) | ((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_NET_RATE_CONTROL_FLAGS>::type)b)); } inline JOB_OBJECT_NET_RATE_CONTROL_FLAGS &operator |= (JOB_OBJECT_NET_RATE_CONTROL_FLAGS &a, JOB_OBJECT_NET_RATE_CONTROL_FLAGS b) throw() { return (JOB_OBJECT_NET_RATE_CONTROL_FLAGS &)(((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_NET_RATE_CONTROL_FLAGS>::type &)a) |= ((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_NET_RATE_CONTROL_FLAGS>::type)b)); } inline constexpr JOB_OBJECT_NET_RATE_CONTROL_FLAGS operator & (JOB_OBJECT_NET_RATE_CONTROL_FLAGS a, JOB_OBJECT_NET_RATE_CONTROL_FLAGS b) throw() { return JOB_OBJECT_NET_RATE_CONTROL_FLAGS(((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_NET_RATE_CONTROL_FLAGS>::type)a) & ((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_NET_RATE_CONTROL_FLAGS>::type)b)); } inline JOB_OBJECT_NET_RATE_CONTROL_FLAGS &operator &= (JOB_OBJECT_NET_RATE_CONTROL_FLAGS &a, JOB_OBJECT_NET_RATE_CONTROL_FLAGS b) throw() { return (JOB_OBJECT_NET_RATE_CONTROL_FLAGS &)(((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_NET_RATE_CONTROL_FLAGS>::type &)a) &= ((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_NET_RATE_CONTROL_FLAGS>::type)b)); } inline constexpr JOB_OBJECT_NET_RATE_CONTROL_FLAGS operator ~ (JOB_OBJECT_NET_RATE_CONTROL_FLAGS a) throw() { return JOB_OBJECT_NET_RATE_CONTROL_FLAGS(~((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_NET_RATE_CONTROL_FLAGS>::type)a)); } inline constexpr JOB_OBJECT_NET_RATE_CONTROL_FLAGS operator ^ (JOB_OBJECT_NET_RATE_CONTROL_FLAGS a, JOB_OBJECT_NET_RATE_CONTROL_FLAGS b) throw() { return JOB_OBJECT_NET_RATE_CONTROL_FLAGS(((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_NET_RATE_CONTROL_FLAGS>::type)a) ^ ((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_NET_RATE_CONTROL_FLAGS>::type)b)); } inline JOB_OBJECT_NET_RATE_CONTROL_FLAGS &operator ^= (JOB_OBJECT_NET_RATE_CONTROL_FLAGS &a, JOB_OBJECT_NET_RATE_CONTROL_FLAGS b) throw() { return (JOB_OBJECT_NET_RATE_CONTROL_FLAGS &)(((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_NET_RATE_CONTROL_FLAGS>::type &)a) ^= ((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_NET_RATE_CONTROL_FLAGS>::type)b)); } } typedef char __C_ASSERT__[(JOB_OBJECT_NET_RATE_CONTROL_VALID_FLAGS == (JOB_OBJECT_NET_RATE_CONTROL_ENABLE + JOB_OBJECT_NET_RATE_CONTROL_MAX_BANDWIDTH + JOB_OBJECT_NET_RATE_CONTROL_DSCP_TAG))?1:-1]; typedef struct JOBOBJECT_NET_RATE_CONTROL_INFORMATION { DWORD64 MaxBandwidth; JOB_OBJECT_NET_RATE_CONTROL_FLAGS ControlFlags; BYTE DscpTag; } JOBOBJECT_NET_RATE_CONTROL_INFORMATION; typedef enum JOB_OBJECT_IO_RATE_CONTROL_FLAGS { JOB_OBJECT_IO_RATE_CONTROL_ENABLE = 0x1, JOB_OBJECT_IO_RATE_CONTROL_STANDALONE_VOLUME = 0x2, JOB_OBJECT_IO_RATE_CONTROL_FORCE_UNIT_ACCESS_ALL = 0x4, JOB_OBJECT_IO_RATE_CONTROL_FORCE_UNIT_ACCESS_ON_SOFT_CAP = 0x8, JOB_OBJECT_IO_RATE_CONTROL_VALID_FLAGS = JOB_OBJECT_IO_RATE_CONTROL_ENABLE | JOB_OBJECT_IO_RATE_CONTROL_STANDALONE_VOLUME | JOB_OBJECT_IO_RATE_CONTROL_FORCE_UNIT_ACCESS_ALL | JOB_OBJECT_IO_RATE_CONTROL_FORCE_UNIT_ACCESS_ON_SOFT_CAP } JOB_OBJECT_IO_RATE_CONTROL_FLAGS; extern "C++" { inline constexpr JOB_OBJECT_IO_RATE_CONTROL_FLAGS operator | (JOB_OBJECT_IO_RATE_CONTROL_FLAGS a, JOB_OBJECT_IO_RATE_CONTROL_FLAGS b) throw() { return JOB_OBJECT_IO_RATE_CONTROL_FLAGS(((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_IO_RATE_CONTROL_FLAGS>::type)a) | ((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_IO_RATE_CONTROL_FLAGS>::type)b)); } inline JOB_OBJECT_IO_RATE_CONTROL_FLAGS &operator |= (JOB_OBJECT_IO_RATE_CONTROL_FLAGS &a, JOB_OBJECT_IO_RATE_CONTROL_FLAGS b) throw() { return (JOB_OBJECT_IO_RATE_CONTROL_FLAGS &)(((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_IO_RATE_CONTROL_FLAGS>::type &)a) |= ((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_IO_RATE_CONTROL_FLAGS>::type)b)); } inline constexpr JOB_OBJECT_IO_RATE_CONTROL_FLAGS operator & (JOB_OBJECT_IO_RATE_CONTROL_FLAGS a, JOB_OBJECT_IO_RATE_CONTROL_FLAGS b) throw() { return JOB_OBJECT_IO_RATE_CONTROL_FLAGS(((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_IO_RATE_CONTROL_FLAGS>::type)a) & ((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_IO_RATE_CONTROL_FLAGS>::type)b)); } inline JOB_OBJECT_IO_RATE_CONTROL_FLAGS &operator &= (JOB_OBJECT_IO_RATE_CONTROL_FLAGS &a, JOB_OBJECT_IO_RATE_CONTROL_FLAGS b) throw() { return (JOB_OBJECT_IO_RATE_CONTROL_FLAGS &)(((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_IO_RATE_CONTROL_FLAGS>::type &)a) &= ((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_IO_RATE_CONTROL_FLAGS>::type)b)); } inline constexpr JOB_OBJECT_IO_RATE_CONTROL_FLAGS operator ~ (JOB_OBJECT_IO_RATE_CONTROL_FLAGS a) throw() { return JOB_OBJECT_IO_RATE_CONTROL_FLAGS(~((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_IO_RATE_CONTROL_FLAGS>::type)a)); } inline constexpr JOB_OBJECT_IO_RATE_CONTROL_FLAGS operator ^ (JOB_OBJECT_IO_RATE_CONTROL_FLAGS a, JOB_OBJECT_IO_RATE_CONTROL_FLAGS b) throw() { return JOB_OBJECT_IO_RATE_CONTROL_FLAGS(((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_IO_RATE_CONTROL_FLAGS>::type)a) ^ ((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_IO_RATE_CONTROL_FLAGS>::type)b)); } inline JOB_OBJECT_IO_RATE_CONTROL_FLAGS &operator ^= (JOB_OBJECT_IO_RATE_CONTROL_FLAGS &a, JOB_OBJECT_IO_RATE_CONTROL_FLAGS b) throw() { return (JOB_OBJECT_IO_RATE_CONTROL_FLAGS &)(((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_IO_RATE_CONTROL_FLAGS>::type &)a) ^= ((_ENUM_FLAG_SIZED_INTEGER<JOB_OBJECT_IO_RATE_CONTROL_FLAGS>::type)b)); } } typedef struct JOBOBJECT_IO_RATE_CONTROL_INFORMATION_NATIVE { LONG64 MaxIops; LONG64 MaxBandwidth; LONG64 ReservationIops; PWSTR VolumeName; DWORD BaseIoSize; JOB_OBJECT_IO_RATE_CONTROL_FLAGS ControlFlags; WORD VolumeNameLength; } JOBOBJECT_IO_RATE_CONTROL_INFORMATION_NATIVE; typedef JOBOBJECT_IO_RATE_CONTROL_INFORMATION_NATIVE JOBOBJECT_IO_RATE_CONTROL_INFORMATION_NATIVE_V1; typedef struct JOBOBJECT_IO_RATE_CONTROL_INFORMATION_NATIVE_V2 { LONG64 MaxIops; LONG64 MaxBandwidth; LONG64 ReservationIops; PWSTR VolumeName; DWORD BaseIoSize; JOB_OBJECT_IO_RATE_CONTROL_FLAGS ControlFlags; WORD VolumeNameLength; LONG64 CriticalReservationIops; LONG64 ReservationBandwidth; LONG64 CriticalReservationBandwidth; LONG64 MaxTimePercent; LONG64 ReservationTimePercent; LONG64 CriticalReservationTimePercent; } JOBOBJECT_IO_RATE_CONTROL_INFORMATION_NATIVE_V2; typedef struct JOBOBJECT_IO_RATE_CONTROL_INFORMATION_NATIVE_V3 { LONG64 MaxIops; LONG64 MaxBandwidth; LONG64 ReservationIops; PWSTR VolumeName; DWORD BaseIoSize; JOB_OBJECT_IO_RATE_CONTROL_FLAGS ControlFlags; WORD VolumeNameLength; LONG64 CriticalReservationIops; LONG64 ReservationBandwidth; LONG64 CriticalReservationBandwidth; LONG64 MaxTimePercent; LONG64 ReservationTimePercent; LONG64 CriticalReservationTimePercent; LONG64 SoftMaxIops; LONG64 SoftMaxBandwidth; LONG64 SoftMaxTimePercent; LONG64 LimitExcessNotifyIops; LONG64 LimitExcessNotifyBandwidth; LONG64 LimitExcessNotifyTimePercent; } JOBOBJECT_IO_RATE_CONTROL_INFORMATION_NATIVE_V3; typedef enum JOBOBJECT_IO_ATTRIBUTION_CONTROL_FLAGS { JOBOBJECT_IO_ATTRIBUTION_CONTROL_ENABLE = 0x1, JOBOBJECT_IO_ATTRIBUTION_CONTROL_DISABLE = 0x2, JOBOBJECT_IO_ATTRIBUTION_CONTROL_VALID_FLAGS = 0x3 } JOBOBJECT_IO_ATTRIBUTION_CONTROL_FLAGS; typedef struct _JOBOBJECT_IO_ATTRIBUTION_STATS { ULONG_PTR IoCount; ULONGLONG TotalNonOverlappedQueueTime; ULONGLONG TotalNonOverlappedServiceTime; ULONGLONG TotalSize; } JOBOBJECT_IO_ATTRIBUTION_STATS, *PJOBOBJECT_IO_ATTRIBUTION_STATS; typedef struct _JOBOBJECT_IO_ATTRIBUTION_INFORMATION { DWORD ControlFlags; JOBOBJECT_IO_ATTRIBUTION_STATS ReadStats; JOBOBJECT_IO_ATTRIBUTION_STATS WriteStats; } JOBOBJECT_IO_ATTRIBUTION_INFORMATION, *PJOBOBJECT_IO_ATTRIBUTION_INFORMATION; typedef enum _JOBOBJECTINFOCLASS { JobObjectBasicAccountingInformation = 1, JobObjectBasicLimitInformation, JobObjectBasicProcessIdList, JobObjectBasicUIRestrictions, JobObjectSecurityLimitInformation, JobObjectEndOfJobTimeInformation, JobObjectAssociateCompletionPortInformation, JobObjectBasicAndIoAccountingInformation, JobObjectExtendedLimitInformation, JobObjectJobSetInformation, JobObjectGroupInformation, JobObjectNotificationLimitInformation, JobObjectLimitViolationInformation, JobObjectGroupInformationEx, JobObjectCpuRateControlInformation, JobObjectCompletionFilter, JobObjectCompletionCounter, JobObjectReserved1Information = 18, JobObjectReserved2Information, JobObjectReserved3Information, JobObjectReserved4Information, JobObjectReserved5Information, JobObjectReserved6Information, JobObjectReserved7Information, JobObjectReserved8Information, JobObjectReserved9Information, JobObjectReserved10Information, JobObjectReserved11Information, JobObjectReserved12Information, JobObjectReserved13Information, JobObjectReserved14Information = 31, JobObjectNetRateControlInformation, JobObjectNotificationLimitInformation2, JobObjectLimitViolationInformation2, JobObjectCreateSilo, JobObjectSiloBasicInformation, JobObjectReserved15Information = 37, JobObjectReserved16Information = 38, JobObjectReserved17Information = 39, JobObjectReserved18Information = 40, JobObjectReserved19Information = 41, JobObjectReserved20Information = 42, JobObjectReserved21Information = 43, JobObjectReserved22Information = 44, JobObjectReserved23Information = 45, JobObjectReserved24Information = 46, JobObjectReserved25Information = 47, MaxJobObjectInfoClass } JOBOBJECTINFOCLASS; typedef struct _SILOOBJECT_BASIC_INFORMATION { DWORD SiloId; DWORD SiloParentId; DWORD NumberOfProcesses; BOOLEAN IsInServerSilo; BYTE Reserved[3]; } SILOOBJECT_BASIC_INFORMATION, *PSILOOBJECT_BASIC_INFORMATION; typedef enum _SERVERSILO_STATE { SERVERSILO_INITING = 0, SERVERSILO_STARTED, SERVERSILO_SHUTTING_DOWN, SERVERSILO_TERMINATING, SERVERSILO_TERMINATED, } SERVERSILO_STATE, *PSERVERSILO_STATE; typedef struct _SERVERSILO_BASIC_INFORMATION { DWORD ServiceSessionId; SERVERSILO_STATE State; DWORD ExitStatus; } SERVERSILO_BASIC_INFORMATION, *PSERVERSILO_BASIC_INFORMATION; typedef enum _FIRMWARE_TYPE { FirmwareTypeUnknown, FirmwareTypeBios, FirmwareTypeUefi, FirmwareTypeMax } FIRMWARE_TYPE, *PFIRMWARE_TYPE; typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP { RelationProcessorCore, RelationNumaNode, RelationCache, RelationProcessorPackage, RelationGroup, RelationAll = 0xffff } LOGICAL_PROCESSOR_RELATIONSHIP; typedef enum _PROCESSOR_CACHE_TYPE { CacheUnified, CacheInstruction, CacheData, CacheTrace } PROCESSOR_CACHE_TYPE; typedef struct _CACHE_DESCRIPTOR { BYTE Level; BYTE Associativity; WORD LineSize; DWORD Size; PROCESSOR_CACHE_TYPE Type; } CACHE_DESCRIPTOR, *PCACHE_DESCRIPTOR; typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION { ULONG_PTR ProcessorMask; LOGICAL_PROCESSOR_RELATIONSHIP Relationship; union { struct { BYTE Flags; } ProcessorCore; struct { DWORD NodeNumber; } NumaNode; CACHE_DESCRIPTOR Cache; ULONGLONG Reserved[2]; } ; } SYSTEM_LOGICAL_PROCESSOR_INFORMATION, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION; typedef struct _PROCESSOR_RELATIONSHIP { BYTE Flags; BYTE EfficiencyClass; BYTE Reserved[20]; WORD GroupCount; GROUP_AFFINITY GroupMask[1]; } PROCESSOR_RELATIONSHIP, *PPROCESSOR_RELATIONSHIP; typedef struct _NUMA_NODE_RELATIONSHIP { DWORD NodeNumber; BYTE Reserved[20]; GROUP_AFFINITY GroupMask; } NUMA_NODE_RELATIONSHIP, *PNUMA_NODE_RELATIONSHIP; typedef struct _CACHE_RELATIONSHIP { BYTE Level; BYTE Associativity; WORD LineSize; DWORD CacheSize; PROCESSOR_CACHE_TYPE Type; BYTE Reserved[20]; GROUP_AFFINITY GroupMask; } CACHE_RELATIONSHIP, *PCACHE_RELATIONSHIP; typedef struct _PROCESSOR_GROUP_INFO { BYTE MaximumProcessorCount; BYTE ActiveProcessorCount; BYTE Reserved[38]; KAFFINITY ActiveProcessorMask; } PROCESSOR_GROUP_INFO, *PPROCESSOR_GROUP_INFO; typedef struct _GROUP_RELATIONSHIP { WORD MaximumGroupCount; WORD ActiveGroupCount; BYTE Reserved[20]; PROCESSOR_GROUP_INFO GroupInfo[1]; } GROUP_RELATIONSHIP, *PGROUP_RELATIONSHIP; struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX { LOGICAL_PROCESSOR_RELATIONSHIP Relationship; DWORD Size; union { PROCESSOR_RELATIONSHIP Processor; NUMA_NODE_RELATIONSHIP NumaNode; CACHE_RELATIONSHIP Cache; GROUP_RELATIONSHIP Group; } ; }; typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX; typedef enum _CPU_SET_INFORMATION_TYPE { CpuSetInformation } CPU_SET_INFORMATION_TYPE, *PCPU_SET_INFORMATION_TYPE; struct _SYSTEM_CPU_SET_INFORMATION { DWORD Size; CPU_SET_INFORMATION_TYPE Type; union { struct { DWORD Id; WORD Group; BYTE LogicalProcessorIndex; BYTE CoreIndex; BYTE LastLevelCacheIndex; BYTE NumaNodeIndex; BYTE EfficiencyClass; union { BYTE AllFlags; struct { BYTE Parked : 1; BYTE Allocated : 1; BYTE AllocatedToTargetProcess : 1; BYTE RealTime : 1; BYTE ReservedFlags : 4; } ; } ; union { DWORD Reserved; BYTE SchedulingClass; }; DWORD64 AllocationTag; } CpuSet; } ; }; typedef struct _SYSTEM_CPU_SET_INFORMATION SYSTEM_CPU_SET_INFORMATION, *PSYSTEM_CPU_SET_INFORMATION; typedef struct _SYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION { DWORD64 CycleTime; } SYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION, *PSYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION; typedef struct _XSTATE_FEATURE { DWORD Offset; DWORD Size; } XSTATE_FEATURE, *PXSTATE_FEATURE; typedef struct _XSTATE_CONFIGURATION { DWORD64 EnabledFeatures; DWORD64 EnabledVolatileFeatures; DWORD Size; union { DWORD ControlFlags; struct { DWORD OptimizedSave : 1; DWORD CompactionEnabled : 1; }; }; XSTATE_FEATURE Features[(64)]; DWORD64 EnabledSupervisorFeatures; DWORD64 AlignedFeatures; DWORD AllFeatureSize; DWORD AllFeatures[(64)]; DWORD64 EnabledUserVisibleSupervisorFeatures; } XSTATE_CONFIGURATION, *PXSTATE_CONFIGURATION; typedef struct _MEMORY_BASIC_INFORMATION { PVOID BaseAddress; PVOID AllocationBase; DWORD AllocationProtect; SIZE_T RegionSize; DWORD State; DWORD Protect; DWORD Type; } MEMORY_BASIC_INFORMATION, *PMEMORY_BASIC_INFORMATION; typedef struct _MEMORY_BASIC_INFORMATION32 { DWORD BaseAddress; DWORD AllocationBase; DWORD AllocationProtect; DWORD RegionSize; DWORD State; DWORD Protect; DWORD Type; } MEMORY_BASIC_INFORMATION32, *PMEMORY_BASIC_INFORMATION32; typedef struct __declspec(align(16)) _MEMORY_BASIC_INFORMATION64 { ULONGLONG BaseAddress; ULONGLONG AllocationBase; DWORD AllocationProtect; DWORD __alignment1; ULONGLONG RegionSize; DWORD State; DWORD Protect; DWORD Type; DWORD __alignment2; } MEMORY_BASIC_INFORMATION64, *PMEMORY_BASIC_INFORMATION64; typedef struct _CFG_CALL_TARGET_INFO { ULONG_PTR Offset; ULONG_PTR Flags; } CFG_CALL_TARGET_INFO, *PCFG_CALL_TARGET_INFO; typedef struct _MEM_ADDRESS_REQUIREMENTS { PVOID LowestStartingAddress; PVOID HighestEndingAddress; SIZE_T Alignment; } MEM_ADDRESS_REQUIREMENTS, *PMEM_ADDRESS_REQUIREMENTS; typedef enum MEM_EXTENDED_PARAMETER_TYPE { MemExtendedParameterInvalidType = 0, MemExtendedParameterAddressRequirements, MemExtendedParameterNumaNode, MemExtendedParameterPartitionHandle, MemExtendedParameterUserPhysicalHandle, MemExtendedParameterAttributeFlags, MemExtendedParameterMax } MEM_EXTENDED_PARAMETER_TYPE, *PMEM_EXTENDED_PARAMETER_TYPE; typedef struct __declspec(align(8)) MEM_EXTENDED_PARAMETER { struct { DWORD64 Type : 8; DWORD64 Reserved : 64 - 8; } ; union { DWORD64 ULong64; PVOID Pointer; SIZE_T Size; HANDLE Handle; DWORD ULong; } ; } MEM_EXTENDED_PARAMETER, *PMEM_EXTENDED_PARAMETER; typedef enum MEM_SECTION_EXTENDED_PARAMETER_TYPE { MemSectionExtendedParameterInvalidType = 0, MemSectionExtendedParameterUserPhysicalFlags, MemSectionExtendedParameterNumaNode, MemSectionExtendedParameterMax } MEM_SECTION_EXTENDED_PARAMETER_TYPE, *PMEM_SECTION_EXTENDED_PARAMETER_TYPE; typedef struct _ENCLAVE_CREATE_INFO_SGX { BYTE Secs[4096]; } ENCLAVE_CREATE_INFO_SGX, *PENCLAVE_CREATE_INFO_SGX; typedef struct _ENCLAVE_INIT_INFO_SGX { BYTE SigStruct[1808]; BYTE Reserved1[240]; BYTE EInitToken[304]; BYTE Reserved2[1744]; } ENCLAVE_INIT_INFO_SGX, *PENCLAVE_INIT_INFO_SGX; typedef struct _ENCLAVE_CREATE_INFO_VBS { DWORD Flags; BYTE OwnerID[32]; } ENCLAVE_CREATE_INFO_VBS, *PENCLAVE_CREATE_INFO_VBS; typedef struct _ENCLAVE_CREATE_INFO_VBS_BASIC { DWORD Flags; BYTE OwnerID[32]; } ENCLAVE_CREATE_INFO_VBS_BASIC, *PENCLAVE_CREATE_INFO_VBS_BASIC; typedef struct _ENCLAVE_LOAD_DATA_VBS_BASIC { DWORD PageType; } ENCLAVE_LOAD_DATA_VBS_BASIC, *PENCLAVE_LOAD_DATA_VBS_BASIC; typedef struct _ENCLAVE_INIT_INFO_VBS_BASIC { BYTE FamilyId[16]; BYTE ImageId[16]; ULONGLONG EnclaveSize; DWORD EnclaveSvn; DWORD Reserved; union { HANDLE SignatureInfoHandle; ULONGLONG Unused; } ; } ENCLAVE_INIT_INFO_VBS_BASIC, *PENCLAVE_INIT_INFO_VBS_BASIC; typedef struct _ENCLAVE_INIT_INFO_VBS { DWORD Length; DWORD ThreadCount; } ENCLAVE_INIT_INFO_VBS, *PENCLAVE_INIT_INFO_VBS; typedef PVOID (ENCLAVE_TARGET_FUNCTION)(PVOID); typedef ENCLAVE_TARGET_FUNCTION (*PENCLAVE_TARGET_FUNCTION); typedef PENCLAVE_TARGET_FUNCTION LPENCLAVE_TARGET_FUNCTION; typedef struct _FILE_ID_128 { BYTE Identifier[16]; } FILE_ID_128, *PFILE_ID_128; typedef struct _FILE_NOTIFY_INFORMATION { DWORD NextEntryOffset; DWORD Action; DWORD FileNameLength; WCHAR FileName[1]; } FILE_NOTIFY_INFORMATION, *PFILE_NOTIFY_INFORMATION; typedef struct _FILE_NOTIFY_EXTENDED_INFORMATION { DWORD NextEntryOffset; DWORD Action; LARGE_INTEGER CreationTime; LARGE_INTEGER LastModificationTime; LARGE_INTEGER LastChangeTime; LARGE_INTEGER LastAccessTime; LARGE_INTEGER AllocatedLength; LARGE_INTEGER FileSize; DWORD FileAttributes; DWORD ReparsePointTag; LARGE_INTEGER FileId; LARGE_INTEGER ParentFileId; DWORD FileNameLength; WCHAR FileName[1]; } FILE_NOTIFY_EXTENDED_INFORMATION, *PFILE_NOTIFY_EXTENDED_INFORMATION; typedef union _FILE_SEGMENT_ELEMENT { PVOID64 Buffer; ULONGLONG Alignment; }FILE_SEGMENT_ELEMENT, *PFILE_SEGMENT_ELEMENT; typedef struct _REPARSE_GUID_DATA_BUFFER { DWORD ReparseTag; WORD ReparseDataLength; WORD Reserved; GUID ReparseGuid; struct { BYTE DataBuffer[1]; } GenericReparseBuffer; } REPARSE_GUID_DATA_BUFFER, *PREPARSE_GUID_DATA_BUFFER; typedef struct _SCRUB_DATA_INPUT { DWORD Size; DWORD Flags; DWORD MaximumIos; DWORD ObjectId[4]; DWORD Reserved[25]; BYTE ResumeContext[816]; } SCRUB_DATA_INPUT, *PSCRUB_DATA_INPUT; typedef struct _SCRUB_PARITY_EXTENT { LONGLONG Offset; ULONGLONG Length; } SCRUB_PARITY_EXTENT, *PSCRUB_PARITY_EXTENT; typedef struct _SCRUB_PARITY_EXTENT_DATA { WORD Size; WORD Flags; WORD NumberOfParityExtents; WORD MaximumNumberOfParityExtents; SCRUB_PARITY_EXTENT ParityExtents[1]; } SCRUB_PARITY_EXTENT_DATA, *PSCRUB_PARITY_EXTENT_DATA; typedef struct _SCRUB_DATA_OUTPUT { DWORD Size; DWORD Flags; DWORD Status; ULONGLONG ErrorFileOffset; ULONGLONG ErrorLength; ULONGLONG NumberOfBytesRepaired; ULONGLONG NumberOfBytesFailed; ULONGLONG InternalFileReference; WORD ResumeContextLength; WORD ParityExtentDataOffset; DWORD Reserved[9]; ULONGLONG NumberOfMetadataBytesProcessed; ULONGLONG NumberOfDataBytesProcessed; ULONGLONG TotalNumberOfMetadataBytesInUse; ULONGLONG TotalNumberOfDataBytesInUse; BYTE ResumeContext[816]; } SCRUB_DATA_OUTPUT, *PSCRUB_DATA_OUTPUT; typedef enum _SharedVirtualDiskSupportType { SharedVirtualDisksUnsupported = 0, SharedVirtualDisksSupported = 1, SharedVirtualDiskSnapshotsSupported = 3, SharedVirtualDiskCDPSnapshotsSupported = 7 } SharedVirtualDiskSupportType; typedef enum _SharedVirtualDiskHandleState { SharedVirtualDiskHandleStateNone = 0, SharedVirtualDiskHandleStateFileShared = 1, SharedVirtualDiskHandleStateHandleShared = 3 } SharedVirtualDiskHandleState; typedef struct _SHARED_VIRTUAL_DISK_SUPPORT { SharedVirtualDiskSupportType SharedVirtualDiskSupport; SharedVirtualDiskHandleState HandleState; } SHARED_VIRTUAL_DISK_SUPPORT, *PSHARED_VIRTUAL_DISK_SUPPORT; typedef struct _REARRANGE_FILE_DATA { ULONGLONG SourceStartingOffset; ULONGLONG TargetOffset; HANDLE SourceFileHandle; DWORD Length; DWORD Flags; } REARRANGE_FILE_DATA, *PREARRANGE_FILE_DATA; typedef struct _REARRANGE_FILE_DATA32 { ULONGLONG SourceStartingOffset; ULONGLONG TargetOffset; UINT32 SourceFileHandle; DWORD Length; DWORD Flags; } REARRANGE_FILE_DATA32, *PREARRANGE_FILE_DATA32; typedef struct _SHUFFLE_FILE_DATA { LONGLONG StartingOffset; LONGLONG Length; DWORD Flags; } SHUFFLE_FILE_DATA, *PSHUFFLE_FILE_DATA; typedef struct _NETWORK_APP_INSTANCE_EA { GUID AppInstanceID; DWORD CsvFlags; } NETWORK_APP_INSTANCE_EA, *PNETWORK_APP_INSTANCE_EA; extern "C" const GUID GUID_MAX_POWER_SAVINGS; extern "C" const GUID GUID_MIN_POWER_SAVINGS; extern "C" const GUID GUID_TYPICAL_POWER_SAVINGS; extern "C" const GUID NO_SUBGROUP_GUID; extern "C" const GUID ALL_POWERSCHEMES_GUID; extern "C" const GUID GUID_POWERSCHEME_PERSONALITY; extern "C" const GUID GUID_ACTIVE_POWERSCHEME; extern "C" const GUID GUID_IDLE_RESILIENCY_SUBGROUP; extern "C" const GUID GUID_IDLE_RESILIENCY_PERIOD; extern "C" const GUID GUID_DEEP_SLEEP_ENABLED; extern "C" const GUID GUID_DEEP_SLEEP_PLATFORM_STATE; extern "C" const GUID GUID_DISK_COALESCING_POWERDOWN_TIMEOUT; extern "C" const GUID GUID_EXECUTION_REQUIRED_REQUEST_TIMEOUT; extern "C" const GUID GUID_VIDEO_SUBGROUP; extern "C" const GUID GUID_VIDEO_POWERDOWN_TIMEOUT; extern "C" const GUID GUID_VIDEO_ANNOYANCE_TIMEOUT; extern "C" const GUID GUID_VIDEO_ADAPTIVE_PERCENT_INCREASE; extern "C" const GUID GUID_VIDEO_DIM_TIMEOUT; extern "C" const GUID GUID_VIDEO_ADAPTIVE_POWERDOWN; extern "C" const GUID GUID_MONITOR_POWER_ON; extern "C" const GUID GUID_DEVICE_POWER_POLICY_VIDEO_BRIGHTNESS; extern "C" const GUID GUID_DEVICE_POWER_POLICY_VIDEO_DIM_BRIGHTNESS; extern "C" const GUID GUID_VIDEO_CURRENT_MONITOR_BRIGHTNESS; extern "C" const GUID GUID_VIDEO_ADAPTIVE_DISPLAY_BRIGHTNESS; extern "C" const GUID GUID_CONSOLE_DISPLAY_STATE; extern "C" const GUID GUID_ALLOW_DISPLAY_REQUIRED; extern "C" const GUID GUID_VIDEO_CONSOLE_LOCK_TIMEOUT; extern "C" const GUID GUID_ADVANCED_COLOR_QUALITY_BIAS; extern "C" const GUID GUID_ADAPTIVE_POWER_BEHAVIOR_SUBGROUP; extern "C" const GUID GUID_NON_ADAPTIVE_INPUT_TIMEOUT; extern "C" const GUID GUID_ADAPTIVE_INPUT_CONTROLLER_STATE; extern "C" const GUID GUID_DISK_SUBGROUP; extern "C" const GUID GUID_DISK_MAX_POWER; extern "C" const GUID GUID_DISK_POWERDOWN_TIMEOUT; extern "C" const GUID GUID_DISK_IDLE_TIMEOUT; extern "C" const GUID GUID_DISK_BURST_IGNORE_THRESHOLD; extern "C" const GUID GUID_DISK_ADAPTIVE_POWERDOWN; extern "C" const GUID GUID_SLEEP_SUBGROUP; extern "C" const GUID GUID_SLEEP_IDLE_THRESHOLD; extern "C" const GUID GUID_STANDBY_TIMEOUT; extern "C" const GUID GUID_UNATTEND_SLEEP_TIMEOUT; extern "C" const GUID GUID_HIBERNATE_TIMEOUT; extern "C" const GUID GUID_HIBERNATE_FASTS4_POLICY; extern "C" const GUID GUID_CRITICAL_POWER_TRANSITION; extern "C" const GUID GUID_SYSTEM_AWAYMODE; extern "C" const GUID GUID_ALLOW_AWAYMODE; extern "C" const GUID GUID_USER_PRESENCE_PREDICTION; extern "C" const GUID GUID_STANDBY_BUDGET_GRACE_PERIOD; extern "C" const GUID GUID_STANDBY_BUDGET_PERCENT; extern "C" const GUID GUID_STANDBY_RESERVE_GRACE_PERIOD; extern "C" const GUID GUID_STANDBY_RESERVE_TIME; extern "C" const GUID GUID_STANDBY_RESET_PERCENT; extern "C" const GUID GUID_ALLOW_STANDBY_STATES; extern "C" const GUID GUID_ALLOW_RTC_WAKE; extern "C" const GUID GUID_LEGACY_RTC_MITIGATION; extern "C" const GUID GUID_ALLOW_SYSTEM_REQUIRED; extern "C" const GUID GUID_POWER_SAVING_STATUS; extern "C" const GUID GUID_ENERGY_SAVER_SUBGROUP; extern "C" const GUID GUID_ENERGY_SAVER_BATTERY_THRESHOLD; extern "C" const GUID GUID_ENERGY_SAVER_BRIGHTNESS; extern "C" const GUID GUID_ENERGY_SAVER_POLICY; extern "C" const GUID GUID_SYSTEM_BUTTON_SUBGROUP; extern "C" const GUID GUID_POWERBUTTON_ACTION; extern "C" const GUID GUID_SLEEPBUTTON_ACTION; extern "C" const GUID GUID_USERINTERFACEBUTTON_ACTION; extern "C" const GUID GUID_LIDCLOSE_ACTION; extern "C" const GUID GUID_LIDOPEN_POWERSTATE; extern "C" const GUID GUID_BATTERY_SUBGROUP; extern "C" const GUID GUID_BATTERY_DISCHARGE_ACTION_0; extern "C" const GUID GUID_BATTERY_DISCHARGE_LEVEL_0; extern "C" const GUID GUID_BATTERY_DISCHARGE_FLAGS_0; extern "C" const GUID GUID_BATTERY_DISCHARGE_ACTION_1; extern "C" const GUID GUID_BATTERY_DISCHARGE_LEVEL_1; extern "C" const GUID GUID_BATTERY_DISCHARGE_FLAGS_1; extern "C" const GUID GUID_BATTERY_DISCHARGE_ACTION_2; extern "C" const GUID GUID_BATTERY_DISCHARGE_LEVEL_2; extern "C" const GUID GUID_BATTERY_DISCHARGE_FLAGS_2; extern "C" const GUID GUID_BATTERY_DISCHARGE_ACTION_3; extern "C" const GUID GUID_BATTERY_DISCHARGE_LEVEL_3; extern "C" const GUID GUID_BATTERY_DISCHARGE_FLAGS_3; extern "C" const GUID GUID_PROCESSOR_SETTINGS_SUBGROUP; extern "C" const GUID GUID_PROCESSOR_THROTTLE_POLICY; extern "C" const GUID GUID_PROCESSOR_THROTTLE_MAXIMUM; extern "C" const GUID GUID_PROCESSOR_THROTTLE_MAXIMUM_1; extern "C" const GUID GUID_PROCESSOR_THROTTLE_MINIMUM; extern "C" const GUID GUID_PROCESSOR_THROTTLE_MINIMUM_1; extern "C" const GUID GUID_PROCESSOR_FREQUENCY_LIMIT; extern "C" const GUID GUID_PROCESSOR_FREQUENCY_LIMIT_1; extern "C" const GUID GUID_PROCESSOR_ALLOW_THROTTLING; extern "C" const GUID GUID_PROCESSOR_IDLESTATE_POLICY; extern "C" const GUID GUID_PROCESSOR_PERFSTATE_POLICY; extern "C" const GUID GUID_PROCESSOR_PERF_INCREASE_THRESHOLD; extern "C" const GUID GUID_PROCESSOR_PERF_INCREASE_THRESHOLD_1; extern "C" const GUID GUID_PROCESSOR_PERF_DECREASE_THRESHOLD; extern "C" const GUID GUID_PROCESSOR_PERF_DECREASE_THRESHOLD_1; extern "C" const GUID GUID_PROCESSOR_PERF_INCREASE_POLICY; extern "C" const GUID GUID_PROCESSOR_PERF_INCREASE_POLICY_1; extern "C" const GUID GUID_PROCESSOR_PERF_DECREASE_POLICY; extern "C" const GUID GUID_PROCESSOR_PERF_DECREASE_POLICY_1; extern "C" const GUID GUID_PROCESSOR_PERF_INCREASE_TIME; extern "C" const GUID GUID_PROCESSOR_PERF_INCREASE_TIME_1; extern "C" const GUID GUID_PROCESSOR_PERF_DECREASE_TIME; extern "C" const GUID GUID_PROCESSOR_PERF_DECREASE_TIME_1; extern "C" const GUID GUID_PROCESSOR_PERF_TIME_CHECK; extern "C" const GUID GUID_PROCESSOR_PERF_BOOST_POLICY; extern "C" const GUID GUID_PROCESSOR_PERF_BOOST_MODE; extern "C" const GUID GUID_PROCESSOR_PERF_AUTONOMOUS_MODE; extern "C" const GUID GUID_PROCESSOR_PERF_ENERGY_PERFORMANCE_PREFERENCE; extern "C" const GUID GUID_PROCESSOR_PERF_ENERGY_PERFORMANCE_PREFERENCE_1; extern "C" const GUID GUID_PROCESSOR_PERF_AUTONOMOUS_ACTIVITY_WINDOW; extern "C" const GUID GUID_PROCESSOR_DUTY_CYCLING; extern "C" const GUID GUID_PROCESSOR_IDLE_ALLOW_SCALING; extern "C" const GUID GUID_PROCESSOR_IDLE_DISABLE; extern "C" const GUID GUID_PROCESSOR_IDLE_STATE_MAXIMUM; extern "C" const GUID GUID_PROCESSOR_IDLE_TIME_CHECK; extern "C" const GUID GUID_PROCESSOR_IDLE_DEMOTE_THRESHOLD; extern "C" const GUID GUID_PROCESSOR_IDLE_PROMOTE_THRESHOLD; extern "C" const GUID GUID_PROCESSOR_CORE_PARKING_INCREASE_THRESHOLD; extern "C" const GUID GUID_PROCESSOR_CORE_PARKING_DECREASE_THRESHOLD; extern "C" const GUID GUID_PROCESSOR_CORE_PARKING_INCREASE_POLICY; extern "C" const GUID GUID_PROCESSOR_CORE_PARKING_DECREASE_POLICY; extern "C" const GUID GUID_PROCESSOR_CORE_PARKING_MAX_CORES; extern "C" const GUID GUID_PROCESSOR_CORE_PARKING_MAX_CORES_1; extern "C" const GUID GUID_PROCESSOR_CORE_PARKING_MIN_CORES; extern "C" const GUID GUID_PROCESSOR_CORE_PARKING_MIN_CORES_1; extern "C" const GUID GUID_PROCESSOR_CORE_PARKING_INCREASE_TIME; extern "C" const GUID GUID_PROCESSOR_CORE_PARKING_DECREASE_TIME; extern "C" const GUID GUID_PROCESSOR_CORE_PARKING_AFFINITY_HISTORY_DECREASE_FACTOR; extern "C" const GUID GUID_PROCESSOR_CORE_PARKING_AFFINITY_HISTORY_THRESHOLD; extern "C" const GUID GUID_PROCESSOR_CORE_PARKING_AFFINITY_WEIGHTING; extern "C" const GUID GUID_PROCESSOR_CORE_PARKING_OVER_UTILIZATION_HISTORY_DECREASE_FACTOR; extern "C" const GUID GUID_PROCESSOR_CORE_PARKING_OVER_UTILIZATION_HISTORY_THRESHOLD; extern "C" const GUID GUID_PROCESSOR_CORE_PARKING_OVER_UTILIZATION_WEIGHTING; extern "C" const GUID GUID_PROCESSOR_CORE_PARKING_OVER_UTILIZATION_THRESHOLD; extern "C" const GUID GUID_PROCESSOR_PARKING_CORE_OVERRIDE; extern "C" const GUID GUID_PROCESSOR_PARKING_PERF_STATE; extern "C" const GUID GUID_PROCESSOR_PARKING_PERF_STATE_1; extern "C" const GUID GUID_PROCESSOR_PARKING_CONCURRENCY_THRESHOLD; extern "C" const GUID GUID_PROCESSOR_PARKING_HEADROOM_THRESHOLD; extern "C" const GUID GUID_PROCESSOR_PARKING_DISTRIBUTION_THRESHOLD; extern "C" const GUID GUID_PROCESSOR_PERF_HISTORY; extern "C" const GUID GUID_PROCESSOR_PERF_HISTORY_1; extern "C" const GUID GUID_PROCESSOR_PERF_INCREASE_HISTORY; extern "C" const GUID GUID_PROCESSOR_PERF_DECREASE_HISTORY; extern "C" const GUID GUID_PROCESSOR_PERF_CORE_PARKING_HISTORY; extern "C" const GUID GUID_PROCESSOR_PERF_LATENCY_HINT; extern "C" const GUID GUID_PROCESSOR_PERF_LATENCY_HINT_PERF; extern "C" const GUID GUID_PROCESSOR_PERF_LATENCY_HINT_PERF_1; extern "C" const GUID GUID_PROCESSOR_LATENCY_HINT_MIN_UNPARK; extern "C" const GUID GUID_PROCESSOR_LATENCY_HINT_MIN_UNPARK_1; extern "C" const GUID GUID_PROCESSOR_DISTRIBUTE_UTILITY; extern "C" const GUID GUID_PROCESSOR_HETEROGENEOUS_POLICY; extern "C" const GUID GUID_PROCESSOR_HETERO_DECREASE_TIME; extern "C" const GUID GUID_PROCESSOR_HETERO_INCREASE_TIME; extern "C" const GUID GUID_PROCESSOR_HETERO_DECREASE_THRESHOLD; extern "C" const GUID GUID_PROCESSOR_HETERO_INCREASE_THRESHOLD; extern "C" const GUID GUID_PROCESSOR_CLASS0_FLOOR_PERF; extern "C" const GUID GUID_PROCESSOR_CLASS1_INITIAL_PERF; extern "C" const GUID GUID_PROCESSOR_THREAD_SCHEDULING_POLICY; extern "C" const GUID GUID_PROCESSOR_SHORT_THREAD_SCHEDULING_POLICY; extern "C" const GUID GUID_SYSTEM_COOLING_POLICY; extern "C" const GUID GUID_PROCESSOR_RESPONSIVENESS_DISABLE_THRESHOLD; extern "C" const GUID GUID_PROCESSOR_RESPONSIVENESS_DISABLE_THRESHOLD_1; extern "C" const GUID GUID_PROCESSOR_RESPONSIVENESS_ENABLE_THRESHOLD; extern "C" const GUID GUID_PROCESSOR_RESPONSIVENESS_ENABLE_THRESHOLD_1; extern "C" const GUID GUID_PROCESSOR_RESPONSIVENESS_DISABLE_TIME; extern "C" const GUID GUID_PROCESSOR_RESPONSIVENESS_DISABLE_TIME_1; extern "C" const GUID GUID_PROCESSOR_RESPONSIVENESS_ENABLE_TIME; extern "C" const GUID GUID_PROCESSOR_RESPONSIVENESS_ENABLE_TIME_1; extern "C" const GUID GUID_PROCESSOR_RESPONSIVENESS_EPP_CEILING; extern "C" const GUID GUID_PROCESSOR_RESPONSIVENESS_EPP_CEILING_1; extern "C" const GUID GUID_PROCESSOR_RESPONSIVENESS_PERF_FLOOR; extern "C" const GUID GUID_PROCESSOR_RESPONSIVENESS_PERF_FLOOR_1; extern "C" const GUID GUID_LOCK_CONSOLE_ON_WAKE; extern "C" const GUID GUID_DEVICE_IDLE_POLICY; extern "C" const GUID GUID_CONNECTIVITY_IN_STANDBY; extern "C" const GUID GUID_DISCONNECTED_STANDBY_MODE; extern "C" const GUID GUID_ACDC_POWER_SOURCE; extern "C" const GUID GUID_LIDSWITCH_STATE_CHANGE; extern "C" const GUID GUID_BATTERY_PERCENTAGE_REMAINING; extern "C" const GUID GUID_BATTERY_COUNT; extern "C" const GUID GUID_GLOBAL_USER_PRESENCE; extern "C" const GUID GUID_SESSION_DISPLAY_STATUS; extern "C" const GUID GUID_SESSION_USER_PRESENCE; extern "C" const GUID GUID_IDLE_BACKGROUND_TASK; extern "C" const GUID GUID_BACKGROUND_TASK_NOTIFICATION; extern "C" const GUID GUID_APPLAUNCH_BUTTON; extern "C" const GUID GUID_PCIEXPRESS_SETTINGS_SUBGROUP; extern "C" const GUID GUID_PCIEXPRESS_ASPM_POLICY; extern "C" const GUID GUID_ENABLE_SWITCH_FORCED_SHUTDOWN; extern "C" const GUID GUID_INTSTEER_SUBGROUP; extern "C" const GUID GUID_INTSTEER_MODE; extern "C" const GUID GUID_INTSTEER_LOAD_PER_PROC_TRIGGER; extern "C" const GUID GUID_INTSTEER_TIME_UNPARK_TRIGGER; extern "C" const GUID GUID_GRAPHICS_SUBGROUP; extern "C" const GUID GUID_GPU_PREFERENCE_POLICY; extern "C" const GUID GUID_MIXED_REALITY_MODE; extern "C" const GUID GUID_SPR_ACTIVE_SESSION_CHANGE; typedef enum _SYSTEM_POWER_STATE { PowerSystemUnspecified = 0, PowerSystemWorking = 1, PowerSystemSleeping1 = 2, PowerSystemSleeping2 = 3, PowerSystemSleeping3 = 4, PowerSystemHibernate = 5, PowerSystemShutdown = 6, PowerSystemMaximum = 7 } SYSTEM_POWER_STATE, *PSYSTEM_POWER_STATE; typedef enum { PowerActionNone = 0, PowerActionReserved, PowerActionSleep, PowerActionHibernate, PowerActionShutdown, PowerActionShutdownReset, PowerActionShutdownOff, PowerActionWarmEject, PowerActionDisplayOff } POWER_ACTION, *PPOWER_ACTION; typedef enum _DEVICE_POWER_STATE { PowerDeviceUnspecified = 0, PowerDeviceD0, PowerDeviceD1, PowerDeviceD2, PowerDeviceD3, PowerDeviceMaximum } DEVICE_POWER_STATE, *PDEVICE_POWER_STATE; typedef enum _MONITOR_DISPLAY_STATE { PowerMonitorOff = 0, PowerMonitorOn, PowerMonitorDim } MONITOR_DISPLAY_STATE, *PMONITOR_DISPLAY_STATE; typedef enum _USER_ACTIVITY_PRESENCE { PowerUserPresent = 0, PowerUserNotPresent, PowerUserInactive, PowerUserMaximum, PowerUserInvalid = PowerUserMaximum } USER_ACTIVITY_PRESENCE, *PUSER_ACTIVITY_PRESENCE; typedef DWORD EXECUTION_STATE, *PEXECUTION_STATE; typedef enum { LT_DONT_CARE, LT_LOWEST_LATENCY } LATENCY_TIME; typedef enum _POWER_REQUEST_TYPE { PowerRequestDisplayRequired, PowerRequestSystemRequired, PowerRequestAwayModeRequired, PowerRequestExecutionRequired } POWER_REQUEST_TYPE, *PPOWER_REQUEST_TYPE; typedef struct CM_Power_Data_s { DWORD PD_Size; DEVICE_POWER_STATE PD_MostRecentPowerState; DWORD PD_Capabilities; DWORD PD_D1Latency; DWORD PD_D2Latency; DWORD PD_D3Latency; DEVICE_POWER_STATE PD_PowerStateMapping[7]; SYSTEM_POWER_STATE PD_DeepestSystemWake; } CM_POWER_DATA, *PCM_POWER_DATA; typedef enum { SystemPowerPolicyAc, SystemPowerPolicyDc, VerifySystemPolicyAc, VerifySystemPolicyDc, SystemPowerCapabilities, SystemBatteryState, SystemPowerStateHandler, ProcessorStateHandler, SystemPowerPolicyCurrent, AdministratorPowerPolicy, SystemReserveHiberFile, ProcessorInformation, SystemPowerInformation, ProcessorStateHandler2, LastWakeTime, LastSleepTime, SystemExecutionState, SystemPowerStateNotifyHandler, ProcessorPowerPolicyAc, ProcessorPowerPolicyDc, VerifyProcessorPowerPolicyAc, VerifyProcessorPowerPolicyDc, ProcessorPowerPolicyCurrent, SystemPowerStateLogging, SystemPowerLoggingEntry, SetPowerSettingValue, NotifyUserPowerSetting, PowerInformationLevelUnused0, SystemMonitorHiberBootPowerOff, SystemVideoState, TraceApplicationPowerMessage, TraceApplicationPowerMessageEnd, ProcessorPerfStates, ProcessorIdleStates, ProcessorCap, SystemWakeSource, SystemHiberFileInformation, TraceServicePowerMessage, ProcessorLoad, PowerShutdownNotification, MonitorCapabilities, SessionPowerInit, SessionDisplayState, PowerRequestCreate, PowerRequestAction, GetPowerRequestList, ProcessorInformationEx, NotifyUserModeLegacyPowerEvent, GroupPark, ProcessorIdleDomains, WakeTimerList, SystemHiberFileSize, ProcessorIdleStatesHv, ProcessorPerfStatesHv, ProcessorPerfCapHv, ProcessorSetIdle, LogicalProcessorIdling, UserPresence, PowerSettingNotificationName, GetPowerSettingValue, IdleResiliency, SessionRITState, SessionConnectNotification, SessionPowerCleanup, SessionLockState, SystemHiberbootState, PlatformInformation, PdcInvocation, MonitorInvocation, FirmwareTableInformationRegistered, SetShutdownSelectedTime, SuspendResumeInvocation, PlmPowerRequestCreate, ScreenOff, CsDeviceNotification, PlatformRole, LastResumePerformance, DisplayBurst, ExitLatencySamplingPercentage, RegisterSpmPowerSettings, PlatformIdleStates, ProcessorIdleVeto, PlatformIdleVeto, SystemBatteryStatePrecise, ThermalEvent, PowerRequestActionInternal, BatteryDeviceState, PowerInformationInternal, ThermalStandby, SystemHiberFileType, PhysicalPowerButtonPress, QueryPotentialDripsConstraint, EnergyTrackerCreate, EnergyTrackerQuery, UpdateBlackBoxRecorder, PowerInformationLevelMaximum } POWER_INFORMATION_LEVEL; typedef enum { UserNotPresent = 0, UserPresent = 1, UserUnknown = 0xff } POWER_USER_PRESENCE_TYPE, *PPOWER_USER_PRESENCE_TYPE; typedef struct _POWER_USER_PRESENCE { POWER_USER_PRESENCE_TYPE UserPresence; } POWER_USER_PRESENCE, *PPOWER_USER_PRESENCE; typedef struct _POWER_SESSION_CONNECT { BOOLEAN Connected; BOOLEAN Console; } POWER_SESSION_CONNECT, *PPOWER_SESSION_CONNECT; typedef struct _POWER_SESSION_TIMEOUTS { DWORD InputTimeout; DWORD DisplayTimeout; } POWER_SESSION_TIMEOUTS, *PPOWER_SESSION_TIMEOUTS; typedef struct _POWER_SESSION_RIT_STATE { BOOLEAN Active; DWORD LastInputTime; } POWER_SESSION_RIT_STATE, *PPOWER_SESSION_RIT_STATE; typedef struct _POWER_SESSION_WINLOGON { DWORD SessionId; BOOLEAN Console; BOOLEAN Locked; } POWER_SESSION_WINLOGON, *PPOWER_SESSION_WINLOGON; typedef struct _POWER_IDLE_RESILIENCY { DWORD CoalescingTimeout; DWORD IdleResiliencyPeriod; } POWER_IDLE_RESILIENCY, *PPOWER_IDLE_RESILIENCY; typedef enum { MonitorRequestReasonUnknown, MonitorRequestReasonPowerButton, MonitorRequestReasonRemoteConnection, MonitorRequestReasonScMonitorpower, MonitorRequestReasonUserInput, MonitorRequestReasonAcDcDisplayBurst, MonitorRequestReasonUserDisplayBurst, MonitorRequestReasonPoSetSystemState, MonitorRequestReasonSetThreadExecutionState, MonitorRequestReasonFullWake, MonitorRequestReasonSessionUnlock, MonitorRequestReasonScreenOffRequest, MonitorRequestReasonIdleTimeout, MonitorRequestReasonPolicyChange, MonitorRequestReasonSleepButton, MonitorRequestReasonLid, MonitorRequestReasonBatteryCountChange, MonitorRequestReasonGracePeriod, MonitorRequestReasonPnP, MonitorRequestReasonDP, MonitorRequestReasonSxTransition, MonitorRequestReasonSystemIdle, MonitorRequestReasonNearProximity, MonitorRequestReasonThermalStandby, MonitorRequestReasonResumePdc, MonitorRequestReasonResumeS4, MonitorRequestReasonTerminal, MonitorRequestReasonPdcSignal, MonitorRequestReasonAcDcDisplayBurstSuppressed, MonitorRequestReasonSystemStateEntered, MonitorRequestReasonWinrt, MonitorRequestReasonUserInputKeyboard, MonitorRequestReasonUserInputMouse, MonitorRequestReasonUserInputTouch, MonitorRequestReasonUserInputPen, MonitorRequestReasonUserInputAccelerometer, MonitorRequestReasonUserInputHid, MonitorRequestReasonUserInputPoUserPresent, MonitorRequestReasonUserInputSessionSwitch, MonitorRequestReasonUserInputInitialization, MonitorRequestReasonPdcSignalWindowsMobilePwrNotif, MonitorRequestReasonPdcSignalWindowsMobileShell, MonitorRequestReasonPdcSignalHeyCortana, MonitorRequestReasonPdcSignalHolographicShell, MonitorRequestReasonPdcSignalFingerprint, MonitorRequestReasonDirectedDrips, MonitorRequestReasonMax } POWER_MONITOR_REQUEST_REASON; typedef enum _POWER_MONITOR_REQUEST_TYPE { MonitorRequestTypeOff, MonitorRequestTypeOnAndPresent, MonitorRequestTypeToggleOn } POWER_MONITOR_REQUEST_TYPE; typedef struct _POWER_MONITOR_INVOCATION { BOOLEAN Console; POWER_MONITOR_REQUEST_REASON RequestReason; } POWER_MONITOR_INVOCATION, *PPOWER_MONITOR_INVOCATION; typedef struct _RESUME_PERFORMANCE { DWORD PostTimeMs; ULONGLONG TotalResumeTimeMs; ULONGLONG ResumeCompleteTimestamp; } RESUME_PERFORMANCE, *PRESUME_PERFORMANCE; typedef enum { PoAc, PoDc, PoHot, PoConditionMaximum } SYSTEM_POWER_CONDITION; typedef struct { DWORD Version; GUID Guid; SYSTEM_POWER_CONDITION PowerCondition; DWORD DataLength; BYTE Data[1]; } SET_POWER_SETTING_VALUE, *PSET_POWER_SETTING_VALUE; typedef struct { GUID Guid; } NOTIFY_USER_POWER_SETTING, *PNOTIFY_USER_POWER_SETTING; typedef struct _APPLICATIONLAUNCH_SETTING_VALUE { LARGE_INTEGER ActivationTime; DWORD Flags; DWORD ButtonInstanceID; } APPLICATIONLAUNCH_SETTING_VALUE, *PAPPLICATIONLAUNCH_SETTING_VALUE; typedef enum _POWER_PLATFORM_ROLE { PlatformRoleUnspecified = 0, PlatformRoleDesktop, PlatformRoleMobile, PlatformRoleWorkstation, PlatformRoleEnterpriseServer, PlatformRoleSOHOServer, PlatformRoleAppliancePC, PlatformRolePerformanceServer, PlatformRoleSlate, PlatformRoleMaximum } POWER_PLATFORM_ROLE, *PPOWER_PLATFORM_ROLE; typedef struct _POWER_PLATFORM_INFORMATION { BOOLEAN AoAc; } POWER_PLATFORM_INFORMATION, *PPOWER_PLATFORM_INFORMATION; typedef struct { DWORD Granularity; DWORD Capacity; } BATTERY_REPORTING_SCALE, *PBATTERY_REPORTING_SCALE; typedef struct { DWORD Frequency; DWORD Flags; DWORD PercentFrequency; } PPM_WMI_LEGACY_PERFSTATE, *PPPM_WMI_LEGACY_PERFSTATE; typedef struct { DWORD Latency; DWORD Power; DWORD TimeCheck; BYTE PromotePercent; BYTE DemotePercent; BYTE StateType; BYTE Reserved; DWORD StateFlags; DWORD Context; DWORD IdleHandler; DWORD Reserved1; } PPM_WMI_IDLE_STATE, *PPPM_WMI_IDLE_STATE; typedef struct { DWORD Type; DWORD Count; DWORD TargetState; DWORD OldState; DWORD64 TargetProcessors; PPM_WMI_IDLE_STATE State[1]; } PPM_WMI_IDLE_STATES, *PPPM_WMI_IDLE_STATES; typedef struct { DWORD Type; DWORD Count; DWORD TargetState; DWORD OldState; PVOID TargetProcessors; PPM_WMI_IDLE_STATE State[1]; } PPM_WMI_IDLE_STATES_EX, *PPPM_WMI_IDLE_STATES_EX; typedef struct { DWORD Frequency; DWORD Power; BYTE PercentFrequency; BYTE IncreaseLevel; BYTE DecreaseLevel; BYTE Type; DWORD IncreaseTime; DWORD DecreaseTime; DWORD64 Control; DWORD64 Status; DWORD HitCount; DWORD Reserved1; DWORD64 Reserved2; DWORD64 Reserved3; } PPM_WMI_PERF_STATE, *PPPM_WMI_PERF_STATE; typedef struct { DWORD Count; DWORD MaxFrequency; DWORD CurrentState; DWORD MaxPerfState; DWORD MinPerfState; DWORD LowestPerfState; DWORD ThermalConstraint; BYTE BusyAdjThreshold; BYTE PolicyType; BYTE Type; BYTE Reserved; DWORD TimerInterval; DWORD64 TargetProcessors; DWORD PStateHandler; DWORD PStateContext; DWORD TStateHandler; DWORD TStateContext; DWORD FeedbackHandler; DWORD Reserved1; DWORD64 Reserved2; PPM_WMI_PERF_STATE State[1]; } PPM_WMI_PERF_STATES, *PPPM_WMI_PERF_STATES; typedef struct { DWORD Count; DWORD MaxFrequency; DWORD CurrentState; DWORD MaxPerfState; DWORD MinPerfState; DWORD LowestPerfState; DWORD ThermalConstraint; BYTE BusyAdjThreshold; BYTE PolicyType; BYTE Type; BYTE Reserved; DWORD TimerInterval; PVOID TargetProcessors; DWORD PStateHandler; DWORD PStateContext; DWORD TStateHandler; DWORD TStateContext; DWORD FeedbackHandler; DWORD Reserved1; DWORD64 Reserved2; PPM_WMI_PERF_STATE State[1]; } PPM_WMI_PERF_STATES_EX, *PPPM_WMI_PERF_STATES_EX; typedef struct { DWORD IdleTransitions; DWORD FailedTransitions; DWORD InvalidBucketIndex; DWORD64 TotalTime; DWORD IdleTimeBuckets[6]; } PPM_IDLE_STATE_ACCOUNTING, *PPPM_IDLE_STATE_ACCOUNTING; typedef struct { DWORD StateCount; DWORD TotalTransitions; DWORD ResetCount; DWORD64 StartTime; PPM_IDLE_STATE_ACCOUNTING State[1]; } PPM_IDLE_ACCOUNTING, *PPPM_IDLE_ACCOUNTING; typedef struct { DWORD64 TotalTimeUs; DWORD MinTimeUs; DWORD MaxTimeUs; DWORD Count; } PPM_IDLE_STATE_BUCKET_EX, *PPPM_IDLE_STATE_BUCKET_EX; typedef struct { DWORD64 TotalTime; DWORD IdleTransitions; DWORD FailedTransitions; DWORD InvalidBucketIndex; DWORD MinTimeUs; DWORD MaxTimeUs; DWORD CancelledTransitions; PPM_IDLE_STATE_BUCKET_EX IdleTimeBuckets[16]; } PPM_IDLE_STATE_ACCOUNTING_EX, *PPPM_IDLE_STATE_ACCOUNTING_EX; typedef struct { DWORD StateCount; DWORD TotalTransitions; DWORD ResetCount; DWORD AbortCount; DWORD64 StartTime; PPM_IDLE_STATE_ACCOUNTING_EX State[1]; } PPM_IDLE_ACCOUNTING_EX, *PPPM_IDLE_ACCOUNTING_EX; extern "C" const GUID PPM_PERFSTATE_CHANGE_GUID; extern "C" const GUID PPM_PERFSTATE_DOMAIN_CHANGE_GUID; extern "C" const GUID PPM_IDLESTATE_CHANGE_GUID; extern "C" const GUID PPM_PERFSTATES_DATA_GUID; extern "C" const GUID PPM_IDLESTATES_DATA_GUID; extern "C" const GUID PPM_IDLE_ACCOUNTING_GUID; extern "C" const GUID PPM_IDLE_ACCOUNTING_EX_GUID; extern "C" const GUID PPM_THERMALCONSTRAINT_GUID; extern "C" const GUID PPM_PERFMON_PERFSTATE_GUID; extern "C" const GUID PPM_THERMAL_POLICY_CHANGE_GUID; typedef struct { DWORD State; DWORD Status; DWORD Latency; DWORD Speed; DWORD Processor; } PPM_PERFSTATE_EVENT, *PPPM_PERFSTATE_EVENT; typedef struct { DWORD State; DWORD Latency; DWORD Speed; DWORD64 Processors; } PPM_PERFSTATE_DOMAIN_EVENT, *PPPM_PERFSTATE_DOMAIN_EVENT; typedef struct { DWORD NewState; DWORD OldState; DWORD64 Processors; } PPM_IDLESTATE_EVENT, *PPPM_IDLESTATE_EVENT; typedef struct { DWORD ThermalConstraint; DWORD64 Processors; } PPM_THERMALCHANGE_EVENT, *PPPM_THERMALCHANGE_EVENT; #pragma warning(push) #pragma warning(disable: 4121) typedef struct { BYTE Mode; DWORD64 Processors; } PPM_THERMAL_POLICY_EVENT, *PPPM_THERMAL_POLICY_EVENT; #pragma warning(pop) typedef struct { POWER_ACTION Action; DWORD Flags; DWORD EventCode; } POWER_ACTION_POLICY, *PPOWER_ACTION_POLICY; typedef struct { BOOLEAN Enable; BYTE Spare[3]; DWORD BatteryLevel; POWER_ACTION_POLICY PowerPolicy; SYSTEM_POWER_STATE MinSystemState; } SYSTEM_POWER_LEVEL, *PSYSTEM_POWER_LEVEL; typedef struct _SYSTEM_POWER_POLICY { DWORD Revision; POWER_ACTION_POLICY PowerButton; POWER_ACTION_POLICY SleepButton; POWER_ACTION_POLICY LidClose; SYSTEM_POWER_STATE LidOpenWake; DWORD Reserved; POWER_ACTION_POLICY Idle; DWORD IdleTimeout; BYTE IdleSensitivity; BYTE DynamicThrottle; BYTE Spare2[2]; SYSTEM_POWER_STATE MinSleep; SYSTEM_POWER_STATE MaxSleep; SYSTEM_POWER_STATE ReducedLatencySleep; DWORD WinLogonFlags; DWORD Spare3; DWORD DozeS4Timeout; DWORD BroadcastCapacityResolution; SYSTEM_POWER_LEVEL DischargePolicy[4]; DWORD VideoTimeout; BOOLEAN VideoDimDisplay; DWORD VideoReserved[3]; DWORD SpindownTimeout; BOOLEAN OptimizeForPower; BYTE FanThrottleTolerance; BYTE ForcedThrottle; BYTE MinThrottle; POWER_ACTION_POLICY OverThrottled; } SYSTEM_POWER_POLICY, *PSYSTEM_POWER_POLICY; typedef struct { DWORD TimeCheck; BYTE DemotePercent; BYTE PromotePercent; BYTE Spare[2]; } PROCESSOR_IDLESTATE_INFO, *PPROCESSOR_IDLESTATE_INFO; typedef struct { WORD Revision; union { WORD AsWORD ; struct { WORD AllowScaling : 1; WORD Disabled : 1; WORD Reserved : 14; } ; } Flags; DWORD PolicyCount; PROCESSOR_IDLESTATE_INFO Policy[0x3]; } PROCESSOR_IDLESTATE_POLICY, *PPROCESSOR_IDLESTATE_POLICY; typedef struct _PROCESSOR_POWER_POLICY_INFO { DWORD TimeCheck; DWORD DemoteLimit; DWORD PromoteLimit; BYTE DemotePercent; BYTE PromotePercent; BYTE Spare[2]; DWORD AllowDemotion:1; DWORD AllowPromotion:1; DWORD Reserved:30; } PROCESSOR_POWER_POLICY_INFO, *PPROCESSOR_POWER_POLICY_INFO; typedef struct _PROCESSOR_POWER_POLICY { DWORD Revision; BYTE DynamicThrottle; BYTE Spare[3]; DWORD DisableCStates:1; DWORD Reserved:31; DWORD PolicyCount; PROCESSOR_POWER_POLICY_INFO Policy[3]; } PROCESSOR_POWER_POLICY, *PPROCESSOR_POWER_POLICY; typedef struct { DWORD Revision; BYTE MaxThrottle; BYTE MinThrottle; BYTE BusyAdjThreshold; union { BYTE Spare; union { BYTE AsBYTE ; struct { BYTE NoDomainAccounting : 1; BYTE IncreasePolicy: 2; BYTE DecreasePolicy: 2; BYTE Reserved : 3; } ; } Flags; } ; DWORD TimeCheck; DWORD IncreaseTime; DWORD DecreaseTime; DWORD IncreasePercent; DWORD DecreasePercent; } PROCESSOR_PERFSTATE_POLICY, *PPROCESSOR_PERFSTATE_POLICY; typedef struct _ADMINISTRATOR_POWER_POLICY { SYSTEM_POWER_STATE MinSleep; SYSTEM_POWER_STATE MaxSleep; DWORD MinVideoTimeout; DWORD MaxVideoTimeout; DWORD MinSpindownTimeout; DWORD MaxSpindownTimeout; } ADMINISTRATOR_POWER_POLICY, *PADMINISTRATOR_POWER_POLICY; typedef enum _HIBERFILE_BUCKET_SIZE { HiberFileBucket1GB = 0, HiberFileBucket2GB, HiberFileBucket4GB, HiberFileBucket8GB, HiberFileBucket16GB, HiberFileBucket32GB, HiberFileBucketUnlimited, HiberFileBucketMax } HIBERFILE_BUCKET_SIZE, *PHIBERFILE_BUCKET_SIZE; typedef struct _HIBERFILE_BUCKET { DWORD64 MaxPhysicalMemory; DWORD PhysicalMemoryPercent[0x03]; } HIBERFILE_BUCKET, *PHIBERFILE_BUCKET; typedef struct { BOOLEAN PowerButtonPresent; BOOLEAN SleepButtonPresent; BOOLEAN LidPresent; BOOLEAN SystemS1; BOOLEAN SystemS2; BOOLEAN SystemS3; BOOLEAN SystemS4; BOOLEAN SystemS5; BOOLEAN HiberFilePresent; BOOLEAN FullWake; BOOLEAN VideoDimPresent; BOOLEAN ApmPresent; BOOLEAN UpsPresent; BOOLEAN ThermalControl; BOOLEAN ProcessorThrottle; BYTE ProcessorMinThrottle; BYTE ProcessorMaxThrottle; BOOLEAN FastSystemS4; BOOLEAN Hiberboot; BOOLEAN WakeAlarmPresent; BOOLEAN AoAc; BOOLEAN DiskSpinDown; BYTE HiberFileType; BOOLEAN AoAcConnectivitySupported; BYTE spare3[6]; BOOLEAN SystemBatteriesPresent; BOOLEAN BatteriesAreShortTerm; BATTERY_REPORTING_SCALE BatteryScale[3]; SYSTEM_POWER_STATE AcOnLineWake; SYSTEM_POWER_STATE SoftLidWake; SYSTEM_POWER_STATE RtcWake; SYSTEM_POWER_STATE MinDeviceWakeState; SYSTEM_POWER_STATE DefaultLowLatencyWake; } SYSTEM_POWER_CAPABILITIES, *PSYSTEM_POWER_CAPABILITIES; typedef struct { BOOLEAN AcOnLine; BOOLEAN BatteryPresent; BOOLEAN Charging; BOOLEAN Discharging; BOOLEAN Spare1[3]; BYTE Tag; DWORD MaxCapacity; DWORD RemainingCapacity; DWORD Rate; DWORD EstimatedTime; DWORD DefaultAlert1; DWORD DefaultAlert2; } SYSTEM_BATTERY_STATE, *PSYSTEM_BATTERY_STATE; #pragma warning(disable: 4103) #pragma pack(push,4) #pragma warning(disable: 4103) #pragma pack(push,2) typedef struct _IMAGE_DOS_HEADER { WORD e_magic; WORD e_cblp; WORD e_cp; WORD e_crlc; WORD e_cparhdr; WORD e_minalloc; WORD e_maxalloc; WORD e_ss; WORD e_sp; WORD e_csum; WORD e_ip; WORD e_cs; WORD e_lfarlc; WORD e_ovno; WORD e_res[4]; WORD e_oemid; WORD e_oeminfo; WORD e_res2[10]; LONG e_lfanew; } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER; typedef struct _IMAGE_OS2_HEADER { WORD ne_magic; CHAR ne_ver; CHAR ne_rev; WORD ne_enttab; WORD ne_cbenttab; LONG ne_crc; WORD ne_flags; WORD ne_autodata; WORD ne_heap; WORD ne_stack; LONG ne_csip; LONG ne_sssp; WORD ne_cseg; WORD ne_cmod; WORD ne_cbnrestab; WORD ne_segtab; WORD ne_rsrctab; WORD ne_restab; WORD ne_modtab; WORD ne_imptab; LONG ne_nrestab; WORD ne_cmovent; WORD ne_align; WORD ne_cres; BYTE ne_exetyp; BYTE ne_flagsothers; WORD ne_pretthunks; WORD ne_psegrefbytes; WORD ne_swaparea; WORD ne_expver; } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER; typedef struct _IMAGE_VXD_HEADER { WORD e32_magic; BYTE e32_border; BYTE e32_worder; DWORD e32_level; WORD e32_cpu; WORD e32_os; DWORD e32_ver; DWORD e32_mflags; DWORD e32_mpages; DWORD e32_startobj; DWORD e32_eip; DWORD e32_stackobj; DWORD e32_esp; DWORD e32_pagesize; DWORD e32_lastpagesize; DWORD e32_fixupsize; DWORD e32_fixupsum; DWORD e32_ldrsize; DWORD e32_ldrsum; DWORD e32_objtab; DWORD e32_objcnt; DWORD e32_objmap; DWORD e32_itermap; DWORD e32_rsrctab; DWORD e32_rsrccnt; DWORD e32_restab; DWORD e32_enttab; DWORD e32_dirtab; DWORD e32_dircnt; DWORD e32_fpagetab; DWORD e32_frectab; DWORD e32_impmod; DWORD e32_impmodcnt; DWORD e32_impproc; DWORD e32_pagesum; DWORD e32_datapage; DWORD e32_preload; DWORD e32_nrestab; DWORD e32_cbnrestab; DWORD e32_nressum; DWORD e32_autodata; DWORD e32_debuginfo; DWORD e32_debuglen; DWORD e32_instpreload; DWORD e32_instdemand; DWORD e32_heapsize; BYTE e32_res3[12]; DWORD e32_winresoff; DWORD e32_winreslen; WORD e32_devid; WORD e32_ddkver; } IMAGE_VXD_HEADER, *PIMAGE_VXD_HEADER; #pragma warning(disable: 4103) #pragma pack(pop) typedef struct _IMAGE_FILE_HEADER { WORD Machine; WORD NumberOfSections; DWORD TimeDateStamp; DWORD PointerToSymbolTable; DWORD NumberOfSymbols; WORD SizeOfOptionalHeader; WORD Characteristics; } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER; typedef struct _IMAGE_DATA_DIRECTORY { DWORD VirtualAddress; DWORD Size; } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY; typedef struct _IMAGE_OPTIONAL_HEADER { WORD Magic; BYTE MajorLinkerVersion; BYTE MinorLinkerVersion; DWORD SizeOfCode; DWORD SizeOfInitializedData; DWORD SizeOfUninitializedData; DWORD AddressOfEntryPoint; DWORD BaseOfCode; DWORD BaseOfData; DWORD ImageBase; DWORD SectionAlignment; DWORD FileAlignment; WORD MajorOperatingSystemVersion; WORD MinorOperatingSystemVersion; WORD MajorImageVersion; WORD MinorImageVersion; WORD MajorSubsystemVersion; WORD MinorSubsystemVersion; DWORD Win32VersionValue; DWORD SizeOfImage; DWORD SizeOfHeaders; DWORD CheckSum; WORD Subsystem; WORD DllCharacteristics; DWORD SizeOfStackReserve; DWORD SizeOfStackCommit; DWORD SizeOfHeapReserve; DWORD SizeOfHeapCommit; DWORD LoaderFlags; DWORD NumberOfRvaAndSizes; IMAGE_DATA_DIRECTORY DataDirectory[16]; } IMAGE_OPTIONAL_HEADER32, *PIMAGE_OPTIONAL_HEADER32; typedef struct _IMAGE_ROM_OPTIONAL_HEADER { WORD Magic; BYTE MajorLinkerVersion; BYTE MinorLinkerVersion; DWORD SizeOfCode; DWORD SizeOfInitializedData; DWORD SizeOfUninitializedData; DWORD AddressOfEntryPoint; DWORD BaseOfCode; DWORD BaseOfData; DWORD BaseOfBss; DWORD GprMask; DWORD CprMask[4]; DWORD GpValue; } IMAGE_ROM_OPTIONAL_HEADER, *PIMAGE_ROM_OPTIONAL_HEADER; typedef struct _IMAGE_OPTIONAL_HEADER64 { WORD Magic; BYTE MajorLinkerVersion; BYTE MinorLinkerVersion; DWORD SizeOfCode; DWORD SizeOfInitializedData; DWORD SizeOfUninitializedData; DWORD AddressOfEntryPoint; DWORD BaseOfCode; ULONGLONG ImageBase; DWORD SectionAlignment; DWORD FileAlignment; WORD MajorOperatingSystemVersion; WORD MinorOperatingSystemVersion; WORD MajorImageVersion; WORD MinorImageVersion; WORD MajorSubsystemVersion; WORD MinorSubsystemVersion; DWORD Win32VersionValue; DWORD SizeOfImage; DWORD SizeOfHeaders; DWORD CheckSum; WORD Subsystem; WORD DllCharacteristics; ULONGLONG SizeOfStackReserve; ULONGLONG SizeOfStackCommit; ULONGLONG SizeOfHeapReserve; ULONGLONG SizeOfHeapCommit; DWORD LoaderFlags; DWORD NumberOfRvaAndSizes; IMAGE_DATA_DIRECTORY DataDirectory[16]; } IMAGE_OPTIONAL_HEADER64, *PIMAGE_OPTIONAL_HEADER64; typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER; typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER; typedef struct _IMAGE_NT_HEADERS64 { DWORD Signature; IMAGE_FILE_HEADER FileHeader; IMAGE_OPTIONAL_HEADER64 OptionalHeader; } IMAGE_NT_HEADERS64, *PIMAGE_NT_HEADERS64; typedef struct _IMAGE_NT_HEADERS { DWORD Signature; IMAGE_FILE_HEADER FileHeader; IMAGE_OPTIONAL_HEADER32 OptionalHeader; } IMAGE_NT_HEADERS32, *PIMAGE_NT_HEADERS32; typedef struct _IMAGE_ROM_HEADERS { IMAGE_FILE_HEADER FileHeader; IMAGE_ROM_OPTIONAL_HEADER OptionalHeader; } IMAGE_ROM_HEADERS, *PIMAGE_ROM_HEADERS; typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS; typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS; typedef struct ANON_OBJECT_HEADER { WORD Sig1; WORD Sig2; WORD Version; WORD Machine; DWORD TimeDateStamp; CLSID ClassID; DWORD SizeOfData; } ANON_OBJECT_HEADER; typedef struct ANON_OBJECT_HEADER_V2 { WORD Sig1; WORD Sig2; WORD Version; WORD Machine; DWORD TimeDateStamp; CLSID ClassID; DWORD SizeOfData; DWORD Flags; DWORD MetaDataSize; DWORD MetaDataOffset; } ANON_OBJECT_HEADER_V2; typedef struct ANON_OBJECT_HEADER_BIGOBJ { WORD Sig1; WORD Sig2; WORD Version; WORD Machine; DWORD TimeDateStamp; CLSID ClassID; DWORD SizeOfData; DWORD Flags; DWORD MetaDataSize; DWORD MetaDataOffset; DWORD NumberOfSections; DWORD PointerToSymbolTable; DWORD NumberOfSymbols; } ANON_OBJECT_HEADER_BIGOBJ; typedef struct _IMAGE_SECTION_HEADER { BYTE Name[8]; union { DWORD PhysicalAddress; DWORD VirtualSize; } Misc; DWORD VirtualAddress; DWORD SizeOfRawData; DWORD PointerToRawData; DWORD PointerToRelocations; DWORD PointerToLinenumbers; WORD NumberOfRelocations; WORD NumberOfLinenumbers; DWORD Characteristics; } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER; #pragma warning(disable: 4103) #pragma pack(push,2) typedef struct _IMAGE_SYMBOL { union { BYTE ShortName[8]; struct { DWORD Short; DWORD Long; } Name; DWORD LongName[2]; } N; DWORD Value; SHORT SectionNumber; WORD Type; BYTE StorageClass; BYTE NumberOfAuxSymbols; } IMAGE_SYMBOL; typedef IMAGE_SYMBOL __unaligned *PIMAGE_SYMBOL; typedef struct _IMAGE_SYMBOL_EX { union { BYTE ShortName[8]; struct { DWORD Short; DWORD Long; } Name; DWORD LongName[2]; } N; DWORD Value; LONG SectionNumber; WORD Type; BYTE StorageClass; BYTE NumberOfAuxSymbols; } IMAGE_SYMBOL_EX; typedef IMAGE_SYMBOL_EX __unaligned *PIMAGE_SYMBOL_EX; #pragma warning(disable: 4103) #pragma pack(push,2) typedef struct IMAGE_AUX_SYMBOL_TOKEN_DEF { BYTE bAuxType; BYTE bReserved; DWORD SymbolTableIndex; BYTE rgbReserved[12]; } IMAGE_AUX_SYMBOL_TOKEN_DEF; typedef IMAGE_AUX_SYMBOL_TOKEN_DEF __unaligned *PIMAGE_AUX_SYMBOL_TOKEN_DEF; #pragma warning(disable: 4103) #pragma pack(pop) typedef union _IMAGE_AUX_SYMBOL { struct { DWORD TagIndex; union { struct { WORD Linenumber; WORD Size; } LnSz; DWORD TotalSize; } Misc; union { struct { DWORD PointerToLinenumber; DWORD PointerToNextFunction; } Function; struct { WORD Dimension[4]; } Array; } FcnAry; WORD TvIndex; } Sym; struct { BYTE Name[18]; } File; struct { DWORD Length; WORD NumberOfRelocations; WORD NumberOfLinenumbers; DWORD CheckSum; SHORT Number; BYTE Selection; BYTE bReserved; SHORT HighNumber; } Section; IMAGE_AUX_SYMBOL_TOKEN_DEF TokenDef; struct { DWORD crc; BYTE rgbReserved[14]; } CRC; } IMAGE_AUX_SYMBOL; typedef IMAGE_AUX_SYMBOL __unaligned *PIMAGE_AUX_SYMBOL; typedef union _IMAGE_AUX_SYMBOL_EX { struct { DWORD WeakDefaultSymIndex; DWORD WeakSearchType; BYTE rgbReserved[12]; } Sym; struct { BYTE Name[sizeof(IMAGE_SYMBOL_EX)]; } File; struct { DWORD Length; WORD NumberOfRelocations; WORD NumberOfLinenumbers; DWORD CheckSum; SHORT Number; BYTE Selection; BYTE bReserved; SHORT HighNumber; BYTE rgbReserved[2]; } Section; struct{ IMAGE_AUX_SYMBOL_TOKEN_DEF TokenDef; BYTE rgbReserved[2]; } ; struct { DWORD crc; BYTE rgbReserved[16]; } CRC; } IMAGE_AUX_SYMBOL_EX; typedef IMAGE_AUX_SYMBOL_EX __unaligned *PIMAGE_AUX_SYMBOL_EX; typedef enum IMAGE_AUX_SYMBOL_TYPE { IMAGE_AUX_SYMBOL_TYPE_TOKEN_DEF = 1, } IMAGE_AUX_SYMBOL_TYPE; typedef struct _IMAGE_RELOCATION { union { DWORD VirtualAddress; DWORD RelocCount; } ; DWORD SymbolTableIndex; WORD Type; } IMAGE_RELOCATION; typedef IMAGE_RELOCATION __unaligned *PIMAGE_RELOCATION; typedef struct _IMAGE_LINENUMBER { union { DWORD SymbolTableIndex; DWORD VirtualAddress; } Type; WORD Linenumber; } IMAGE_LINENUMBER; typedef IMAGE_LINENUMBER __unaligned *PIMAGE_LINENUMBER; #pragma warning(disable: 4103) #pragma pack(pop) typedef struct _IMAGE_BASE_RELOCATION { DWORD VirtualAddress; DWORD SizeOfBlock; } IMAGE_BASE_RELOCATION; typedef IMAGE_BASE_RELOCATION __unaligned * PIMAGE_BASE_RELOCATION; typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER { BYTE Name[16]; BYTE Date[12]; BYTE UserID[6]; BYTE GroupID[6]; BYTE Mode[8]; BYTE Size[10]; BYTE EndHeader[2]; } IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER; typedef struct _IMAGE_EXPORT_DIRECTORY { DWORD Characteristics; DWORD TimeDateStamp; WORD MajorVersion; WORD MinorVersion; DWORD Name; DWORD Base; DWORD NumberOfFunctions; DWORD NumberOfNames; DWORD AddressOfFunctions; DWORD AddressOfNames; DWORD AddressOfNameOrdinals; } IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY; typedef struct _IMAGE_IMPORT_BY_NAME { WORD Hint; CHAR Name[1]; } IMAGE_IMPORT_BY_NAME, *PIMAGE_IMPORT_BY_NAME; #pragma warning(disable: 4103) #pragma pack(push,8) typedef struct _IMAGE_THUNK_DATA64 { union { ULONGLONG ForwarderString; ULONGLONG Function; ULONGLONG Ordinal; ULONGLONG AddressOfData; } u1; } IMAGE_THUNK_DATA64; typedef IMAGE_THUNK_DATA64 * PIMAGE_THUNK_DATA64; #pragma warning(disable: 4103) #pragma pack(pop) typedef struct _IMAGE_THUNK_DATA32 { union { DWORD ForwarderString; DWORD Function; DWORD Ordinal; DWORD AddressOfData; } u1; } IMAGE_THUNK_DATA32; typedef IMAGE_THUNK_DATA32 * PIMAGE_THUNK_DATA32; typedef void (__stdcall *PIMAGE_TLS_CALLBACK) ( PVOID DllHandle, DWORD Reason, PVOID Reserved ); typedef struct _IMAGE_TLS_DIRECTORY64 { ULONGLONG StartAddressOfRawData; ULONGLONG EndAddressOfRawData; ULONGLONG AddressOfIndex; ULONGLONG AddressOfCallBacks; DWORD SizeOfZeroFill; union { DWORD Characteristics; struct { DWORD Reserved0 : 20; DWORD Alignment : 4; DWORD Reserved1 : 8; } ; } ; } IMAGE_TLS_DIRECTORY64; typedef IMAGE_TLS_DIRECTORY64 * PIMAGE_TLS_DIRECTORY64; typedef struct _IMAGE_TLS_DIRECTORY32 { DWORD StartAddressOfRawData; DWORD EndAddressOfRawData; DWORD AddressOfIndex; DWORD AddressOfCallBacks; DWORD SizeOfZeroFill; union { DWORD Characteristics; struct { DWORD Reserved0 : 20; DWORD Alignment : 4; DWORD Reserved1 : 8; } ; } ; } IMAGE_TLS_DIRECTORY32; typedef IMAGE_TLS_DIRECTORY32 * PIMAGE_TLS_DIRECTORY32; typedef IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA; typedef PIMAGE_THUNK_DATA64 PIMAGE_THUNK_DATA; typedef IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY; typedef PIMAGE_TLS_DIRECTORY64 PIMAGE_TLS_DIRECTORY; typedef struct _IMAGE_IMPORT_DESCRIPTOR { union { DWORD Characteristics; DWORD OriginalFirstThunk; } ; DWORD TimeDateStamp; DWORD ForwarderChain; DWORD Name; DWORD FirstThunk; } IMAGE_IMPORT_DESCRIPTOR; typedef IMAGE_IMPORT_DESCRIPTOR __unaligned *PIMAGE_IMPORT_DESCRIPTOR; typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR { DWORD TimeDateStamp; WORD OffsetModuleName; WORD NumberOfModuleForwarderRefs; } IMAGE_BOUND_IMPORT_DESCRIPTOR, *PIMAGE_BOUND_IMPORT_DESCRIPTOR; typedef struct _IMAGE_BOUND_FORWARDER_REF { DWORD TimeDateStamp; WORD OffsetModuleName; WORD Reserved; } IMAGE_BOUND_FORWARDER_REF, *PIMAGE_BOUND_FORWARDER_REF; typedef struct _IMAGE_DELAYLOAD_DESCRIPTOR { union { DWORD AllAttributes; struct { DWORD RvaBased : 1; DWORD ReservedAttributes : 31; } ; } Attributes; DWORD DllNameRVA; DWORD ModuleHandleRVA; DWORD ImportAddressTableRVA; DWORD ImportNameTableRVA; DWORD BoundImportAddressTableRVA; DWORD UnloadInformationTableRVA; DWORD TimeDateStamp; } IMAGE_DELAYLOAD_DESCRIPTOR, *PIMAGE_DELAYLOAD_DESCRIPTOR; typedef const IMAGE_DELAYLOAD_DESCRIPTOR *PCIMAGE_DELAYLOAD_DESCRIPTOR; typedef struct _IMAGE_RESOURCE_DIRECTORY { DWORD Characteristics; DWORD TimeDateStamp; WORD MajorVersion; WORD MinorVersion; WORD NumberOfNamedEntries; WORD NumberOfIdEntries; } IMAGE_RESOURCE_DIRECTORY, *PIMAGE_RESOURCE_DIRECTORY; typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY { union { struct { DWORD NameOffset:31; DWORD NameIsString:1; } ; DWORD Name; WORD Id; } ; union { DWORD OffsetToData; struct { DWORD OffsetToDirectory:31; DWORD DataIsDirectory:1; } ; } ; } IMAGE_RESOURCE_DIRECTORY_ENTRY, *PIMAGE_RESOURCE_DIRECTORY_ENTRY; typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING { WORD Length; CHAR NameString[ 1 ]; } IMAGE_RESOURCE_DIRECTORY_STRING, *PIMAGE_RESOURCE_DIRECTORY_STRING; typedef struct _IMAGE_RESOURCE_DIR_STRING_U { WORD Length; WCHAR NameString[ 1 ]; } IMAGE_RESOURCE_DIR_STRING_U, *PIMAGE_RESOURCE_DIR_STRING_U; typedef struct _IMAGE_RESOURCE_DATA_ENTRY { DWORD OffsetToData; DWORD Size; DWORD CodePage; DWORD Reserved; } IMAGE_RESOURCE_DATA_ENTRY, *PIMAGE_RESOURCE_DATA_ENTRY; typedef struct _IMAGE_LOAD_CONFIG_CODE_INTEGRITY { WORD Flags; WORD Catalog; DWORD CatalogOffset; DWORD Reserved; } IMAGE_LOAD_CONFIG_CODE_INTEGRITY, *PIMAGE_LOAD_CONFIG_CODE_INTEGRITY; typedef struct _IMAGE_DYNAMIC_RELOCATION_TABLE { DWORD Version; DWORD Size; } IMAGE_DYNAMIC_RELOCATION_TABLE, *PIMAGE_DYNAMIC_RELOCATION_TABLE; #pragma warning(disable: 4103) #pragma pack(push,1) typedef struct _IMAGE_DYNAMIC_RELOCATION32 { DWORD Symbol; DWORD BaseRelocSize; } IMAGE_DYNAMIC_RELOCATION32, *PIMAGE_DYNAMIC_RELOCATION32; typedef struct _IMAGE_DYNAMIC_RELOCATION64 { ULONGLONG Symbol; DWORD BaseRelocSize; } IMAGE_DYNAMIC_RELOCATION64, *PIMAGE_DYNAMIC_RELOCATION64; typedef struct _IMAGE_DYNAMIC_RELOCATION32_V2 { DWORD HeaderSize; DWORD FixupInfoSize; DWORD Symbol; DWORD SymbolGroup; DWORD Flags; } IMAGE_DYNAMIC_RELOCATION32_V2, *PIMAGE_DYNAMIC_RELOCATION32_V2; typedef struct _IMAGE_DYNAMIC_RELOCATION64_V2 { DWORD HeaderSize; DWORD FixupInfoSize; ULONGLONG Symbol; DWORD SymbolGroup; DWORD Flags; } IMAGE_DYNAMIC_RELOCATION64_V2, *PIMAGE_DYNAMIC_RELOCATION64_V2; #pragma warning(disable: 4103) #pragma pack(pop) typedef IMAGE_DYNAMIC_RELOCATION64 IMAGE_DYNAMIC_RELOCATION; typedef PIMAGE_DYNAMIC_RELOCATION64 PIMAGE_DYNAMIC_RELOCATION; typedef IMAGE_DYNAMIC_RELOCATION64_V2 IMAGE_DYNAMIC_RELOCATION_V2; typedef PIMAGE_DYNAMIC_RELOCATION64_V2 PIMAGE_DYNAMIC_RELOCATION_V2; #pragma warning(disable: 4103) #pragma pack(push,1) typedef struct _IMAGE_PROLOGUE_DYNAMIC_RELOCATION_HEADER { BYTE PrologueByteCount; } IMAGE_PROLOGUE_DYNAMIC_RELOCATION_HEADER; typedef IMAGE_PROLOGUE_DYNAMIC_RELOCATION_HEADER __unaligned * PIMAGE_PROLOGUE_DYNAMIC_RELOCATION_HEADER; typedef struct _IMAGE_EPILOGUE_DYNAMIC_RELOCATION_HEADER { DWORD EpilogueCount; BYTE EpilogueByteCount; BYTE BranchDescriptorElementSize; WORD BranchDescriptorCount; } IMAGE_EPILOGUE_DYNAMIC_RELOCATION_HEADER; typedef IMAGE_EPILOGUE_DYNAMIC_RELOCATION_HEADER __unaligned * PIMAGE_EPILOGUE_DYNAMIC_RELOCATION_HEADER; typedef struct _IMAGE_IMPORT_CONTROL_TRANSFER_DYNAMIC_RELOCATION { DWORD PageRelativeOffset : 12; DWORD IndirectCall : 1; DWORD IATIndex : 19; } IMAGE_IMPORT_CONTROL_TRANSFER_DYNAMIC_RELOCATION; typedef IMAGE_IMPORT_CONTROL_TRANSFER_DYNAMIC_RELOCATION __unaligned * PIMAGE_IMPORT_CONTROL_TRANSFER_DYNAMIC_RELOCATION; typedef struct _IMAGE_INDIR_CONTROL_TRANSFER_DYNAMIC_RELOCATION { WORD PageRelativeOffset : 12; WORD IndirectCall : 1; WORD RexWPrefix : 1; WORD CfgCheck : 1; WORD Reserved : 1; } IMAGE_INDIR_CONTROL_TRANSFER_DYNAMIC_RELOCATION; typedef IMAGE_INDIR_CONTROL_TRANSFER_DYNAMIC_RELOCATION __unaligned * PIMAGE_INDIR_CONTROL_TRANSFER_DYNAMIC_RELOCATION; typedef struct _IMAGE_SWITCHTABLE_BRANCH_DYNAMIC_RELOCATION { WORD PageRelativeOffset : 12; WORD RegisterNumber : 4; } IMAGE_SWITCHTABLE_BRANCH_DYNAMIC_RELOCATION; typedef IMAGE_SWITCHTABLE_BRANCH_DYNAMIC_RELOCATION __unaligned * PIMAGE_SWITCHTABLE_BRANCH_DYNAMIC_RELOCATION; #pragma warning(disable: 4103) #pragma pack(pop) typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32 { DWORD Size; DWORD TimeDateStamp; WORD MajorVersion; WORD MinorVersion; DWORD GlobalFlagsClear; DWORD GlobalFlagsSet; DWORD CriticalSectionDefaultTimeout; DWORD DeCommitFreeBlockThreshold; DWORD DeCommitTotalFreeThreshold; DWORD LockPrefixTable; DWORD MaximumAllocationSize; DWORD VirtualMemoryThreshold; DWORD ProcessHeapFlags; DWORD ProcessAffinityMask; WORD CSDVersion; WORD DependentLoadFlags; DWORD EditList; DWORD SecurityCookie; DWORD SEHandlerTable; DWORD SEHandlerCount; DWORD GuardCFCheckFunctionPointer; DWORD GuardCFDispatchFunctionPointer; DWORD GuardCFFunctionTable; DWORD GuardCFFunctionCount; DWORD GuardFlags; IMAGE_LOAD_CONFIG_CODE_INTEGRITY CodeIntegrity; DWORD GuardAddressTakenIatEntryTable; DWORD GuardAddressTakenIatEntryCount; DWORD GuardLongJumpTargetTable; DWORD GuardLongJumpTargetCount; DWORD DynamicValueRelocTable; DWORD CHPEMetadataPointer; DWORD GuardRFFailureRoutine; DWORD GuardRFFailureRoutineFunctionPointer; DWORD DynamicValueRelocTableOffset; WORD DynamicValueRelocTableSection; WORD Reserved2; DWORD GuardRFVerifyStackPointerFunctionPointer; DWORD HotPatchTableOffset; DWORD Reserved3; DWORD EnclaveConfigurationPointer; DWORD VolatileMetadataPointer; } IMAGE_LOAD_CONFIG_DIRECTORY32, *PIMAGE_LOAD_CONFIG_DIRECTORY32; typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY64 { DWORD Size; DWORD TimeDateStamp; WORD MajorVersion; WORD MinorVersion; DWORD GlobalFlagsClear; DWORD GlobalFlagsSet; DWORD CriticalSectionDefaultTimeout; ULONGLONG DeCommitFreeBlockThreshold; ULONGLONG DeCommitTotalFreeThreshold; ULONGLONG LockPrefixTable; ULONGLONG MaximumAllocationSize; ULONGLONG VirtualMemoryThreshold; ULONGLONG ProcessAffinityMask; DWORD ProcessHeapFlags; WORD CSDVersion; WORD DependentLoadFlags; ULONGLONG EditList; ULONGLONG SecurityCookie; ULONGLONG SEHandlerTable; ULONGLONG SEHandlerCount; ULONGLONG GuardCFCheckFunctionPointer; ULONGLONG GuardCFDispatchFunctionPointer; ULONGLONG GuardCFFunctionTable; ULONGLONG GuardCFFunctionCount; DWORD GuardFlags; IMAGE_LOAD_CONFIG_CODE_INTEGRITY CodeIntegrity; ULONGLONG GuardAddressTakenIatEntryTable; ULONGLONG GuardAddressTakenIatEntryCount; ULONGLONG GuardLongJumpTargetTable; ULONGLONG GuardLongJumpTargetCount; ULONGLONG DynamicValueRelocTable; ULONGLONG CHPEMetadataPointer; ULONGLONG GuardRFFailureRoutine; ULONGLONG GuardRFFailureRoutineFunctionPointer; DWORD DynamicValueRelocTableOffset; WORD DynamicValueRelocTableSection; WORD Reserved2; ULONGLONG GuardRFVerifyStackPointerFunctionPointer; DWORD HotPatchTableOffset; DWORD Reserved3; ULONGLONG EnclaveConfigurationPointer; ULONGLONG VolatileMetadataPointer; } IMAGE_LOAD_CONFIG_DIRECTORY64, *PIMAGE_LOAD_CONFIG_DIRECTORY64; typedef IMAGE_LOAD_CONFIG_DIRECTORY64 IMAGE_LOAD_CONFIG_DIRECTORY; typedef PIMAGE_LOAD_CONFIG_DIRECTORY64 PIMAGE_LOAD_CONFIG_DIRECTORY; typedef struct _IMAGE_HOT_PATCH_INFO { DWORD Version; DWORD Size; DWORD SequenceNumber; DWORD BaseImageList; DWORD BaseImageCount; DWORD BufferOffset; DWORD ExtraPatchSize; } IMAGE_HOT_PATCH_INFO, *PIMAGE_HOT_PATCH_INFO; typedef struct _IMAGE_HOT_PATCH_BASE { DWORD SequenceNumber; DWORD Flags; DWORD OriginalTimeDateStamp; DWORD OriginalCheckSum; DWORD CodeIntegrityInfo; DWORD CodeIntegritySize; DWORD PatchTable; DWORD BufferOffset; } IMAGE_HOT_PATCH_BASE, *PIMAGE_HOT_PATCH_BASE; typedef struct _IMAGE_HOT_PATCH_HASHES { BYTE SHA256[32]; BYTE SHA1[20]; } IMAGE_HOT_PATCH_HASHES, *PIMAGE_HOT_PATCH_HASHES; typedef struct _IMAGE_CE_RUNTIME_FUNCTION_ENTRY { DWORD FuncStart; DWORD PrologLen : 8; DWORD FuncLen : 22; DWORD ThirtyTwoBit : 1; DWORD ExceptionFlag : 1; } IMAGE_CE_RUNTIME_FUNCTION_ENTRY, * PIMAGE_CE_RUNTIME_FUNCTION_ENTRY; typedef struct _IMAGE_ARM_RUNTIME_FUNCTION_ENTRY { DWORD BeginAddress; union { DWORD UnwindData; struct { DWORD Flag : 2; DWORD FunctionLength : 11; DWORD Ret : 2; DWORD H : 1; DWORD Reg : 3; DWORD R : 1; DWORD L : 1; DWORD C : 1; DWORD StackAdjust : 10; } ; } ; } IMAGE_ARM_RUNTIME_FUNCTION_ENTRY, * PIMAGE_ARM_RUNTIME_FUNCTION_ENTRY; typedef struct _IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY { DWORD BeginAddress; union { DWORD UnwindData; struct { DWORD Flag : 2; DWORD FunctionLength : 11; DWORD RegF : 3; DWORD RegI : 4; DWORD H : 1; DWORD CR : 2; DWORD FrameSize : 9; } ; } ; } IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY, * PIMAGE_ARM64_RUNTIME_FUNCTION_ENTRY; typedef struct _IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY { ULONGLONG BeginAddress; ULONGLONG EndAddress; ULONGLONG ExceptionHandler; ULONGLONG HandlerData; ULONGLONG PrologEndAddress; } IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY, *PIMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY; typedef struct _IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY { DWORD BeginAddress; DWORD EndAddress; DWORD ExceptionHandler; DWORD HandlerData; DWORD PrologEndAddress; } IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY, *PIMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY; typedef struct _IMAGE_RUNTIME_FUNCTION_ENTRY { DWORD BeginAddress; DWORD EndAddress; union { DWORD UnwindInfoAddress; DWORD UnwindData; } ; } _IMAGE_RUNTIME_FUNCTION_ENTRY, *_PIMAGE_RUNTIME_FUNCTION_ENTRY; typedef _IMAGE_RUNTIME_FUNCTION_ENTRY IMAGE_IA64_RUNTIME_FUNCTION_ENTRY; typedef _PIMAGE_RUNTIME_FUNCTION_ENTRY PIMAGE_IA64_RUNTIME_FUNCTION_ENTRY; typedef _IMAGE_RUNTIME_FUNCTION_ENTRY IMAGE_RUNTIME_FUNCTION_ENTRY; typedef _PIMAGE_RUNTIME_FUNCTION_ENTRY PIMAGE_RUNTIME_FUNCTION_ENTRY; typedef struct _IMAGE_ENCLAVE_CONFIG32 { DWORD Size; DWORD MinimumRequiredConfigSize; DWORD PolicyFlags; DWORD NumberOfImports; DWORD ImportList; DWORD ImportEntrySize; BYTE FamilyID[16]; BYTE ImageID[16]; DWORD ImageVersion; DWORD SecurityVersion; DWORD EnclaveSize; DWORD NumberOfThreads; DWORD EnclaveFlags; } IMAGE_ENCLAVE_CONFIG32, *PIMAGE_ENCLAVE_CONFIG32; typedef struct _IMAGE_ENCLAVE_CONFIG64 { DWORD Size; DWORD MinimumRequiredConfigSize; DWORD PolicyFlags; DWORD NumberOfImports; DWORD ImportList; DWORD ImportEntrySize; BYTE FamilyID[16]; BYTE ImageID[16]; DWORD ImageVersion; DWORD SecurityVersion; ULONGLONG EnclaveSize; DWORD NumberOfThreads; DWORD EnclaveFlags; } IMAGE_ENCLAVE_CONFIG64, *PIMAGE_ENCLAVE_CONFIG64; typedef IMAGE_ENCLAVE_CONFIG64 IMAGE_ENCLAVE_CONFIG; typedef PIMAGE_ENCLAVE_CONFIG64 PIMAGE_ENCLAVE_CONFIG; typedef struct _IMAGE_ENCLAVE_IMPORT { DWORD MatchType; DWORD MinimumSecurityVersion; BYTE UniqueOrAuthorID[32]; BYTE FamilyID[16]; BYTE ImageID[16]; DWORD ImportName; DWORD Reserved; } IMAGE_ENCLAVE_IMPORT, *PIMAGE_ENCLAVE_IMPORT; typedef struct _IMAGE_DEBUG_DIRECTORY { DWORD Characteristics; DWORD TimeDateStamp; WORD MajorVersion; WORD MinorVersion; DWORD Type; DWORD SizeOfData; DWORD AddressOfRawData; DWORD PointerToRawData; } IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY; typedef struct _IMAGE_COFF_SYMBOLS_HEADER { DWORD NumberOfSymbols; DWORD LvaToFirstSymbol; DWORD NumberOfLinenumbers; DWORD LvaToFirstLinenumber; DWORD RvaToFirstByteOfCode; DWORD RvaToLastByteOfCode; DWORD RvaToFirstByteOfData; DWORD RvaToLastByteOfData; } IMAGE_COFF_SYMBOLS_HEADER, *PIMAGE_COFF_SYMBOLS_HEADER; typedef struct _FPO_DATA { DWORD ulOffStart; DWORD cbProcSize; DWORD cdwLocals; WORD cdwParams; WORD cbProlog : 8; WORD cbRegs : 3; WORD fHasSEH : 1; WORD fUseBP : 1; WORD reserved : 1; WORD cbFrame : 2; } FPO_DATA, *PFPO_DATA; typedef struct _IMAGE_DEBUG_MISC { DWORD DataType; DWORD Length; BOOLEAN Unicode; BYTE Reserved[ 3 ]; BYTE Data[ 1 ]; } IMAGE_DEBUG_MISC, *PIMAGE_DEBUG_MISC; typedef struct _IMAGE_FUNCTION_ENTRY { DWORD StartingAddress; DWORD EndingAddress; DWORD EndOfPrologue; } IMAGE_FUNCTION_ENTRY, *PIMAGE_FUNCTION_ENTRY; typedef struct _IMAGE_FUNCTION_ENTRY64 { ULONGLONG StartingAddress; ULONGLONG EndingAddress; union { ULONGLONG EndOfPrologue; ULONGLONG UnwindInfoAddress; } ; } IMAGE_FUNCTION_ENTRY64, *PIMAGE_FUNCTION_ENTRY64; typedef struct _IMAGE_SEPARATE_DEBUG_HEADER { WORD Signature; WORD Flags; WORD Machine; WORD Characteristics; DWORD TimeDateStamp; DWORD CheckSum; DWORD ImageBase; DWORD SizeOfImage; DWORD NumberOfSections; DWORD ExportedNamesSize; DWORD DebugDirectorySize; DWORD SectionAlignment; DWORD Reserved[2]; } IMAGE_SEPARATE_DEBUG_HEADER, *PIMAGE_SEPARATE_DEBUG_HEADER; typedef struct _NON_PAGED_DEBUG_INFO { WORD Signature; WORD Flags; DWORD Size; WORD Machine; WORD Characteristics; DWORD TimeDateStamp; DWORD CheckSum; DWORD SizeOfImage; ULONGLONG ImageBase; } NON_PAGED_DEBUG_INFO, *PNON_PAGED_DEBUG_INFO; typedef struct _ImageArchitectureHeader { unsigned int AmaskValue: 1; int :7; unsigned int AmaskShift: 8; int :16; DWORD FirstEntryRVA; } IMAGE_ARCHITECTURE_HEADER, *PIMAGE_ARCHITECTURE_HEADER; typedef struct _ImageArchitectureEntry { DWORD FixupInstRVA; DWORD NewInst; } IMAGE_ARCHITECTURE_ENTRY, *PIMAGE_ARCHITECTURE_ENTRY; #pragma warning(disable: 4103) #pragma pack(pop) typedef struct IMPORT_OBJECT_HEADER { WORD Sig1; WORD Sig2; WORD Version; WORD Machine; DWORD TimeDateStamp; DWORD SizeOfData; union { WORD Ordinal; WORD Hint; } ; WORD Type : 2; WORD NameType : 3; WORD Reserved : 11; } IMPORT_OBJECT_HEADER; typedef enum IMPORT_OBJECT_TYPE { IMPORT_OBJECT_CODE = 0, IMPORT_OBJECT_DATA = 1, IMPORT_OBJECT_CONST = 2, } IMPORT_OBJECT_TYPE; typedef enum IMPORT_OBJECT_NAME_TYPE { IMPORT_OBJECT_ORDINAL = 0, IMPORT_OBJECT_NAME = 1, IMPORT_OBJECT_NAME_NO_PREFIX = 2, IMPORT_OBJECT_NAME_UNDECORATE = 3, IMPORT_OBJECT_NAME_EXPORTAS = 4, } IMPORT_OBJECT_NAME_TYPE; typedef enum ReplacesCorHdrNumericDefines { COMIMAGE_FLAGS_ILONLY =0x00000001, COMIMAGE_FLAGS_32BITREQUIRED =0x00000002, COMIMAGE_FLAGS_IL_LIBRARY =0x00000004, COMIMAGE_FLAGS_STRONGNAMESIGNED =0x00000008, COMIMAGE_FLAGS_NATIVE_ENTRYPOINT =0x00000010, COMIMAGE_FLAGS_TRACKDEBUGDATA =0x00010000, COMIMAGE_FLAGS_32BITPREFERRED =0x00020000, COR_VERSION_MAJOR_V2 =2, COR_VERSION_MAJOR =COR_VERSION_MAJOR_V2, COR_VERSION_MINOR =5, COR_DELETED_NAME_LENGTH =8, COR_VTABLEGAP_NAME_LENGTH =8, NATIVE_TYPE_MAX_CB =1, COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE=0xFF, IMAGE_COR_MIH_METHODRVA =0x01, IMAGE_COR_MIH_EHRVA =0x02, IMAGE_COR_MIH_BASICBLOCK =0x08, COR_VTABLE_32BIT =0x01, COR_VTABLE_64BIT =0x02, COR_VTABLE_FROM_UNMANAGED =0x04, COR_VTABLE_FROM_UNMANAGED_RETAIN_APPDOMAIN =0x08, COR_VTABLE_CALL_MOST_DERIVED =0x10, IMAGE_COR_EATJ_THUNK_SIZE =32, MAX_CLASS_NAME =1024, MAX_PACKAGE_NAME =1024, } ReplacesCorHdrNumericDefines; typedef struct IMAGE_COR20_HEADER { DWORD cb; WORD MajorRuntimeVersion; WORD MinorRuntimeVersion; IMAGE_DATA_DIRECTORY MetaData; DWORD Flags; union { DWORD EntryPointToken; DWORD EntryPointRVA; } ; IMAGE_DATA_DIRECTORY Resources; IMAGE_DATA_DIRECTORY StrongNameSignature; IMAGE_DATA_DIRECTORY CodeManagerTable; IMAGE_DATA_DIRECTORY VTableFixups; IMAGE_DATA_DIRECTORY ExportAddressTableJumps; IMAGE_DATA_DIRECTORY ManagedNativeHeader; } IMAGE_COR20_HEADER, *PIMAGE_COR20_HEADER; __declspec(dllimport) WORD __stdcall RtlCaptureStackBackTrace( DWORD FramesToSkip, DWORD FramesToCapture, PVOID* BackTrace, PDWORD BackTraceHash ); __declspec(dllimport) void __stdcall RtlCaptureContext( PCONTEXT ContextRecord ); __declspec(dllimport) void __stdcall RtlUnwind( PVOID TargetFrame, PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue ); __declspec(dllimport) BOOLEAN __cdecl RtlAddFunctionTable( PRUNTIME_FUNCTION FunctionTable, DWORD EntryCount, DWORD64 BaseAddress ); __declspec(dllimport) BOOLEAN __cdecl RtlDeleteFunctionTable( PRUNTIME_FUNCTION FunctionTable ); __declspec(dllimport) BOOLEAN __cdecl RtlInstallFunctionTableCallback( DWORD64 TableIdentifier, DWORD64 BaseAddress, DWORD Length, PGET_RUNTIME_FUNCTION_CALLBACK Callback, PVOID Context, PCWSTR OutOfProcessCallbackDll ); __declspec(dllimport) DWORD __stdcall RtlAddGrowableFunctionTable( PVOID* DynamicTable, PRUNTIME_FUNCTION FunctionTable, DWORD EntryCount, DWORD MaximumEntryCount, ULONG_PTR RangeBase, ULONG_PTR RangeEnd ); __declspec(dllimport) void __stdcall RtlGrowFunctionTable( PVOID DynamicTable, DWORD NewEntryCount ); __declspec(dllimport) void __stdcall RtlDeleteGrowableFunctionTable( PVOID DynamicTable ); __declspec(dllimport) PRUNTIME_FUNCTION __stdcall RtlLookupFunctionEntry( DWORD64 ControlPc, PDWORD64 ImageBase, PUNWIND_HISTORY_TABLE HistoryTable ); __declspec(dllimport) void __cdecl RtlRestoreContext( PCONTEXT ContextRecord, struct _EXCEPTION_RECORD* ExceptionRecord ); __declspec(dllimport) void __stdcall RtlUnwindEx( PVOID TargetFrame, PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue, PCONTEXT ContextRecord, PUNWIND_HISTORY_TABLE HistoryTable ); __declspec(dllimport) PEXCEPTION_ROUTINE __stdcall RtlVirtualUnwind( DWORD HandlerType, DWORD64 ImageBase, DWORD64 ControlPc, PRUNTIME_FUNCTION FunctionEntry, PCONTEXT ContextRecord, PVOID* HandlerData, PDWORD64 EstablisherFrame, PKNONVOLATILE_CONTEXT_POINTERS ContextPointers ); __declspec(dllimport) void __stdcall RtlRaiseException( PEXCEPTION_RECORD ExceptionRecord ); __declspec(dllimport) PVOID __stdcall RtlPcToFileHeader( PVOID PcValue, PVOID* BaseOfImage ); __declspec(dllimport) SIZE_T __stdcall RtlCompareMemory( const void* Source1, const void* Source2, SIZE_T Length ); #pragma warning(push) #pragma warning(disable: 4324) typedef struct __declspec(align(16)) _SLIST_ENTRY { struct _SLIST_ENTRY *Next; } SLIST_ENTRY, *PSLIST_ENTRY; #pragma warning(pop) typedef union __declspec(align(16)) _SLIST_HEADER { struct { ULONGLONG Alignment; ULONGLONG Region; } ; struct { ULONGLONG Depth:16; ULONGLONG Sequence:48; ULONGLONG Reserved:4; ULONGLONG NextEntry:60; } HeaderX64; } SLIST_HEADER, *PSLIST_HEADER; __declspec(dllimport) void __stdcall RtlInitializeSListHead ( PSLIST_HEADER ListHead ); __declspec(dllimport) PSLIST_ENTRY __stdcall RtlFirstEntrySList ( const SLIST_HEADER *ListHead ); __declspec(dllimport) PSLIST_ENTRY __stdcall RtlInterlockedPopEntrySList ( PSLIST_HEADER ListHead ); __declspec(dllimport) PSLIST_ENTRY __stdcall RtlInterlockedPushEntrySList ( PSLIST_HEADER ListHead, PSLIST_ENTRY ListEntry ); __declspec(dllimport) PSLIST_ENTRY __stdcall RtlInterlockedPushListSListEx ( PSLIST_HEADER ListHead, PSLIST_ENTRY List, PSLIST_ENTRY ListEnd, DWORD Count ); __declspec(dllimport) PSLIST_ENTRY __stdcall RtlInterlockedFlushSList ( PSLIST_HEADER ListHead ); __declspec(dllimport) WORD __stdcall RtlQueryDepthSList ( PSLIST_HEADER ListHead ); typedef union _RTL_RUN_ONCE { PVOID Ptr; } RTL_RUN_ONCE, *PRTL_RUN_ONCE; typedef struct _RTL_BARRIER { DWORD Reserved1; DWORD Reserved2; ULONG_PTR Reserved3[2]; DWORD Reserved4; DWORD Reserved5; } RTL_BARRIER, *PRTL_BARRIER; __declspec(noreturn) void __fastfail( unsigned int Code ); #pragma intrinsic(__fastfail) __forceinline DWORD HEAP_MAKE_TAG_FLAGS ( DWORD TagBase, DWORD Tag ) { return ((DWORD)((TagBase) + ((Tag) << 18))); } __forceinline PVOID RtlSecureZeroMemory( PVOID ptr, SIZE_T cnt ) { volatile char *vptr = (volatile char *)ptr; __stosb((PBYTE )((DWORD64)vptr), 0, cnt); return ptr; } typedef struct _MESSAGE_RESOURCE_ENTRY { WORD Length; WORD Flags; BYTE Text[ 1 ]; } MESSAGE_RESOURCE_ENTRY, *PMESSAGE_RESOURCE_ENTRY; typedef struct _MESSAGE_RESOURCE_BLOCK { DWORD LowId; DWORD HighId; DWORD OffsetToEntries; } MESSAGE_RESOURCE_BLOCK, *PMESSAGE_RESOURCE_BLOCK; typedef struct _MESSAGE_RESOURCE_DATA { DWORD NumberOfBlocks; MESSAGE_RESOURCE_BLOCK Blocks[ 1 ]; } MESSAGE_RESOURCE_DATA, *PMESSAGE_RESOURCE_DATA; typedef struct _OSVERSIONINFOA { DWORD dwOSVersionInfoSize; DWORD dwMajorVersion; DWORD dwMinorVersion; DWORD dwBuildNumber; DWORD dwPlatformId; CHAR szCSDVersion[ 128 ]; } OSVERSIONINFOA, *POSVERSIONINFOA, *LPOSVERSIONINFOA; typedef struct _OSVERSIONINFOW { DWORD dwOSVersionInfoSize; DWORD dwMajorVersion; DWORD dwMinorVersion; DWORD dwBuildNumber; DWORD dwPlatformId; WCHAR szCSDVersion[ 128 ]; } OSVERSIONINFOW, *POSVERSIONINFOW, *LPOSVERSIONINFOW, RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW; typedef OSVERSIONINFOW OSVERSIONINFO; typedef POSVERSIONINFOW POSVERSIONINFO; typedef LPOSVERSIONINFOW LPOSVERSIONINFO; typedef struct _OSVERSIONINFOEXA { DWORD dwOSVersionInfoSize; DWORD dwMajorVersion; DWORD dwMinorVersion; DWORD dwBuildNumber; DWORD dwPlatformId; CHAR szCSDVersion[ 128 ]; WORD wServicePackMajor; WORD wServicePackMinor; WORD wSuiteMask; BYTE wProductType; BYTE wReserved; } OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA; typedef struct _OSVERSIONINFOEXW { DWORD dwOSVersionInfoSize; DWORD dwMajorVersion; DWORD dwMinorVersion; DWORD dwBuildNumber; DWORD dwPlatformId; WCHAR szCSDVersion[ 128 ]; WORD wServicePackMajor; WORD wServicePackMinor; WORD wSuiteMask; BYTE wProductType; BYTE wReserved; } OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW, RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW; typedef OSVERSIONINFOEXW OSVERSIONINFOEX; typedef POSVERSIONINFOEXW POSVERSIONINFOEX; typedef LPOSVERSIONINFOEXW LPOSVERSIONINFOEX; __declspec(dllimport) ULONGLONG __stdcall VerSetConditionMask( ULONGLONG ConditionMask, DWORD TypeMask, BYTE Condition ); __declspec(dllimport) BOOLEAN __stdcall RtlGetProductInfo( DWORD OSMajorVersion, DWORD OSMinorVersion, DWORD SpMajorVersion, DWORD SpMinorVersion, PDWORD ReturnedProductType ); typedef enum _RTL_UMS_THREAD_INFO_CLASS { UmsThreadInvalidInfoClass = 0, UmsThreadUserContext, UmsThreadPriority, UmsThreadAffinity, UmsThreadTeb, UmsThreadIsSuspended, UmsThreadIsTerminated, UmsThreadMaxInfoClass } RTL_UMS_THREAD_INFO_CLASS, *PRTL_UMS_THREAD_INFO_CLASS; typedef enum _RTL_UMS_SCHEDULER_REASON { UmsSchedulerStartup = 0, UmsSchedulerThreadBlocked, UmsSchedulerThreadYield, } RTL_UMS_SCHEDULER_REASON, *PRTL_UMS_SCHEDULER_REASON; typedef void __stdcall RTL_UMS_SCHEDULER_ENTRY_POINT( RTL_UMS_SCHEDULER_REASON Reason, ULONG_PTR ActivationPayload, PVOID SchedulerParam ); typedef RTL_UMS_SCHEDULER_ENTRY_POINT *PRTL_UMS_SCHEDULER_ENTRY_POINT; __declspec(dllimport) DWORD __stdcall RtlCrc32( const void *Buffer, size_t Size, DWORD InitialCrc ); __declspec(dllimport) ULONGLONG __stdcall RtlCrc64( const void *Buffer, size_t Size, ULONGLONG InitialCrc ); typedef enum _OS_DEPLOYEMENT_STATE_VALUES { OS_DEPLOYMENT_STANDARD = 1, OS_DEPLOYMENT_COMPACT } OS_DEPLOYEMENT_STATE_VALUES; __declspec(dllimport) OS_DEPLOYEMENT_STATE_VALUES __stdcall RtlOsDeploymentState( DWORD Flags ); typedef struct _NV_MEMORY_RANGE { void *BaseAddress; SIZE_T Length; } NV_MEMORY_RANGE, *PNV_MEMORY_RANGE; __declspec(dllimport) DWORD __stdcall RtlGetNonVolatileToken ( PVOID NvBuffer, SIZE_T Size, PVOID *NvToken ); __declspec(dllimport) DWORD __stdcall RtlFreeNonVolatileToken ( PVOID NvToken ); __declspec(dllimport) DWORD __stdcall RtlFlushNonVolatileMemory ( PVOID NvToken, PVOID NvBuffer, SIZE_T Size, DWORD Flags ); __declspec(dllimport) DWORD __stdcall RtlDrainNonVolatileFlush ( PVOID NvToken ); __declspec(dllimport) DWORD __stdcall RtlWriteNonVolatileMemory ( PVOID NvToken, void __unaligned *NvDestination, const void __unaligned *Source, SIZE_T Size, DWORD Flags ); __declspec(dllimport) DWORD __stdcall RtlFlushNonVolatileMemoryRanges ( PVOID NvToken, PNV_MEMORY_RANGE NvRanges, SIZE_T NumRanges, DWORD Flags ); typedef struct CORRELATION_VECTOR { CHAR Version; CHAR Vector[129]; } CORRELATION_VECTOR; typedef CORRELATION_VECTOR *PCORRELATION_VECTOR; __declspec(dllimport) DWORD __stdcall RtlInitializeCorrelationVector( PCORRELATION_VECTOR CorrelationVector, int Version, const GUID * Guid ); __declspec(dllimport) DWORD __stdcall RtlIncrementCorrelationVector( PCORRELATION_VECTOR CorrelationVector ); __declspec(dllimport) DWORD __stdcall RtlExtendCorrelationVector( PCORRELATION_VECTOR CorrelationVector ); __declspec(dllimport) DWORD __stdcall RtlValidateCorrelationVector( PCORRELATION_VECTOR Vector ); typedef enum _IMAGE_POLICY_ENTRY_TYPE { ImagePolicyEntryTypeNone = 0, ImagePolicyEntryTypeBool, ImagePolicyEntryTypeInt8, ImagePolicyEntryTypeUInt8, ImagePolicyEntryTypeInt16, ImagePolicyEntryTypeUInt16, ImagePolicyEntryTypeInt32, ImagePolicyEntryTypeUInt32, ImagePolicyEntryTypeInt64, ImagePolicyEntryTypeUInt64, ImagePolicyEntryTypeAnsiString, ImagePolicyEntryTypeUnicodeString, ImagePolicyEntryTypeOverride, ImagePolicyEntryTypeMaximum } IMAGE_POLICY_ENTRY_TYPE; typedef enum _IMAGE_POLICY_ID { ImagePolicyIdNone = 0, ImagePolicyIdEtw, ImagePolicyIdDebug, ImagePolicyIdCrashDump, ImagePolicyIdCrashDumpKey, ImagePolicyIdCrashDumpKeyGuid, ImagePolicyIdParentSd, ImagePolicyIdParentSdRev, ImagePolicyIdSvn, ImagePolicyIdDeviceId, ImagePolicyIdCapability, ImagePolicyIdScenarioId, ImagePolicyIdMaximum } IMAGE_POLICY_ID; typedef struct _IMAGE_POLICY_ENTRY { IMAGE_POLICY_ENTRY_TYPE Type; IMAGE_POLICY_ID PolicyId; union { const void* None; BOOLEAN BoolValue; INT8 Int8Value; UINT8 UInt8Value; INT16 Int16Value; UINT16 UInt16Value; INT32 Int32Value; UINT32 UInt32Value; INT64 Int64Value; UINT64 UInt64Value; PCSTR AnsiStringValue; PCWSTR UnicodeStringValue; } u; } IMAGE_POLICY_ENTRY; typedef const IMAGE_POLICY_ENTRY* PCIMAGE_POLICY_ENTRY; #pragma warning(push) #pragma warning(disable: 4200) typedef struct _IMAGE_POLICY_METADATA { BYTE Version; BYTE Reserved0[7]; ULONGLONG ApplicationId; IMAGE_POLICY_ENTRY Policies[]; } IMAGE_POLICY_METADATA; typedef const IMAGE_POLICY_METADATA* PCIMAGE_POLICY_METADATA; #pragma warning(pop) typedef struct _RTL_CRITICAL_SECTION_DEBUG { WORD Type; WORD CreatorBackTraceIndex; struct _RTL_CRITICAL_SECTION *CriticalSection; LIST_ENTRY ProcessLocksList; DWORD EntryCount; DWORD ContentionCount; DWORD Flags; WORD CreatorBackTraceIndexHigh; WORD SpareWORD ; } RTL_CRITICAL_SECTION_DEBUG, *PRTL_CRITICAL_SECTION_DEBUG, RTL_RESOURCE_DEBUG, *PRTL_RESOURCE_DEBUG; #pragma pack(push, 8) typedef struct _RTL_CRITICAL_SECTION { PRTL_CRITICAL_SECTION_DEBUG DebugInfo; LONG LockCount; LONG RecursionCount; HANDLE OwningThread; HANDLE LockSemaphore; ULONG_PTR SpinCount; } RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION; #pragma pack(pop) typedef struct _RTL_SRWLOCK { PVOID Ptr; } RTL_SRWLOCK, *PRTL_SRWLOCK; typedef struct _RTL_CONDITION_VARIABLE { PVOID Ptr; } RTL_CONDITION_VARIABLE, *PRTL_CONDITION_VARIABLE; typedef void (__stdcall *PAPCFUNC)( ULONG_PTR Parameter ); typedef LONG (__stdcall *PVECTORED_EXCEPTION_HANDLER)( struct _EXCEPTION_POINTERS *ExceptionInfo ); typedef enum _HEAP_INFORMATION_CLASS { HeapCompatibilityInformation = 0, HeapEnableTerminationOnCorruption = 1 , HeapOptimizeResources = 3 } HEAP_INFORMATION_CLASS; typedef struct _HEAP_OPTIMIZE_RESOURCES_INFORMATION { DWORD Version; DWORD Flags; } HEAP_OPTIMIZE_RESOURCES_INFORMATION, *PHEAP_OPTIMIZE_RESOURCES_INFORMATION; typedef void (__stdcall * WAITORTIMERCALLBACKFUNC) (PVOID, BOOLEAN ); typedef void (__stdcall * WORKERCALLBACKFUNC) (PVOID ); typedef void (__stdcall * APC_CALLBACK_FUNCTION) (DWORD , PVOID, PVOID); typedef WAITORTIMERCALLBACKFUNC WAITORTIMERCALLBACK; typedef void (__stdcall *PFLS_CALLBACK_FUNCTION) ( PVOID lpFlsData ); typedef BOOLEAN (__stdcall *PSECURE_MEMORY_CACHE_CALLBACK) ( PVOID Addr, SIZE_T Range ); typedef enum _ACTIVATION_CONTEXT_INFO_CLASS { ActivationContextBasicInformation = 1, ActivationContextDetailedInformation = 2, AssemblyDetailedInformationInActivationContext = 3, FileInformationInAssemblyOfAssemblyInActivationContext = 4, RunlevelInformationInActivationContext = 5, CompatibilityInformationInActivationContext = 6, ActivationContextManifestResourceName = 7, MaxActivationContextInfoClass, AssemblyDetailedInformationInActivationContxt = 3, FileInformationInAssemblyOfAssemblyInActivationContxt = 4 } ACTIVATION_CONTEXT_INFO_CLASS; typedef struct _ACTIVATION_CONTEXT_QUERY_INDEX { DWORD ulAssemblyIndex; DWORD ulFileIndexInAssembly; } ACTIVATION_CONTEXT_QUERY_INDEX, * PACTIVATION_CONTEXT_QUERY_INDEX; typedef const struct _ACTIVATION_CONTEXT_QUERY_INDEX * PCACTIVATION_CONTEXT_QUERY_INDEX; typedef struct _ASSEMBLY_FILE_DETAILED_INFORMATION { DWORD ulFlags; DWORD ulFilenameLength; DWORD ulPathLength; PCWSTR lpFileName; PCWSTR lpFilePath; } ASSEMBLY_FILE_DETAILED_INFORMATION, *PASSEMBLY_FILE_DETAILED_INFORMATION; typedef const ASSEMBLY_FILE_DETAILED_INFORMATION *PCASSEMBLY_FILE_DETAILED_INFORMATION; typedef struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION { DWORD ulFlags; DWORD ulEncodedAssemblyIdentityLength; DWORD ulManifestPathType; DWORD ulManifestPathLength; LARGE_INTEGER liManifestLastWriteTime; DWORD ulPolicyPathType; DWORD ulPolicyPathLength; LARGE_INTEGER liPolicyLastWriteTime; DWORD ulMetadataSatelliteRosterIndex; DWORD ulManifestVersionMajor; DWORD ulManifestVersionMinor; DWORD ulPolicyVersionMajor; DWORD ulPolicyVersionMinor; DWORD ulAssemblyDirectoryNameLength; PCWSTR lpAssemblyEncodedAssemblyIdentity; PCWSTR lpAssemblyManifestPath; PCWSTR lpAssemblyPolicyPath; PCWSTR lpAssemblyDirectoryName; DWORD ulFileCount; } ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION, * PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION; typedef const struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION * PCACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION ; typedef enum { ACTCTX_RUN_LEVEL_UNSPECIFIED = 0, ACTCTX_RUN_LEVEL_AS_INVOKER, ACTCTX_RUN_LEVEL_HIGHEST_AVAILABLE, ACTCTX_RUN_LEVEL_REQUIRE_ADMIN, ACTCTX_RUN_LEVEL_NUMBERS } ACTCTX_REQUESTED_RUN_LEVEL; typedef struct _ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION { DWORD ulFlags; ACTCTX_REQUESTED_RUN_LEVEL RunLevel; DWORD UiAccess; } ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION, * PACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION; typedef const struct _ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION * PCACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION ; typedef enum { ACTCTX_COMPATIBILITY_ELEMENT_TYPE_UNKNOWN = 0, ACTCTX_COMPATIBILITY_ELEMENT_TYPE_OS, ACTCTX_COMPATIBILITY_ELEMENT_TYPE_MITIGATION, ACTCTX_COMPATIBILITY_ELEMENT_TYPE_MAXVERSIONTESTED } ACTCTX_COMPATIBILITY_ELEMENT_TYPE; typedef struct _COMPATIBILITY_CONTEXT_ELEMENT { GUID Id; ACTCTX_COMPATIBILITY_ELEMENT_TYPE Type; ULONGLONG MaxVersionTested; } COMPATIBILITY_CONTEXT_ELEMENT, *PCOMPATIBILITY_CONTEXT_ELEMENT; typedef const struct _COMPATIBILITY_CONTEXT_ELEMENT *PCCOMPATIBILITY_CONTEXT_ELEMENT; #pragma warning(push) #pragma warning(disable: 4200) typedef struct _ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION { DWORD ElementCount; COMPATIBILITY_CONTEXT_ELEMENT Elements[]; } ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION, * PACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION; #pragma warning(pop) typedef const struct _ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION * PCACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION; typedef struct _SUPPORTED_OS_INFO { WORD MajorVersion; WORD MinorVersion; } SUPPORTED_OS_INFO, *PSUPPORTED_OS_INFO; typedef struct _MAXVERSIONTESTED_INFO { ULONGLONG MaxVersionTested; } MAXVERSIONTESTED_INFO, *PMAXVERSIONTESTED_INFO; typedef struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION { DWORD dwFlags; DWORD ulFormatVersion; DWORD ulAssemblyCount; DWORD ulRootManifestPathType; DWORD ulRootManifestPathChars; DWORD ulRootConfigurationPathType; DWORD ulRootConfigurationPathChars; DWORD ulAppDirPathType; DWORD ulAppDirPathChars; PCWSTR lpRootManifestPath; PCWSTR lpRootConfigurationPath; PCWSTR lpAppDirPath; } ACTIVATION_CONTEXT_DETAILED_INFORMATION, *PACTIVATION_CONTEXT_DETAILED_INFORMATION; typedef const struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION *PCACTIVATION_CONTEXT_DETAILED_INFORMATION; typedef struct _HARDWARE_COUNTER_DATA { HARDWARE_COUNTER_TYPE Type; DWORD Reserved; DWORD64 Value; } HARDWARE_COUNTER_DATA, *PHARDWARE_COUNTER_DATA; typedef struct _PERFORMANCE_DATA { WORD Size; BYTE Version; BYTE HwCountersCount; DWORD ContextSwitchCount; DWORD64 WaitReasonBitMap; DWORD64 CycleTime; DWORD RetryCount; DWORD Reserved; HARDWARE_COUNTER_DATA HwCounters[16]; } PERFORMANCE_DATA, *PPERFORMANCE_DATA; void __stdcall RtlGetDeviceFamilyInfoEnum( ULONGLONG *pullUAPInfo, DWORD *pulDeviceFamily, DWORD *pulDeviceForm ); DWORD __stdcall RtlConvertDeviceFamilyInfoToString( PDWORD pulDeviceFamilyBufferSize, PDWORD pulDeviceFormBufferSize, PWSTR DeviceFamily, PWSTR DeviceForm ); DWORD __stdcall RtlSwitchedVVI( PRTL_OSVERSIONINFOEXW VersionInfo, DWORD TypeMask, ULONGLONG ConditionMask ); typedef struct _EVENTLOGRECORD { DWORD Length; DWORD Reserved; DWORD RecordNumber; DWORD TimeGenerated; DWORD TimeWritten; DWORD EventID; WORD EventType; WORD NumStrings; WORD EventCategory; WORD ReservedFlags; DWORD ClosingRecordNumber; DWORD StringOffset; DWORD UserSidLength; DWORD UserSidOffset; DWORD DataLength; DWORD DataOffset; } EVENTLOGRECORD, *PEVENTLOGRECORD; #pragma warning(push) #pragma warning(disable: 4200) struct _EVENTSFORLOGFILE; typedef struct _EVENTSFORLOGFILE EVENTSFORLOGFILE, *PEVENTSFORLOGFILE; struct _PACKEDEVENTINFO; typedef struct _PACKEDEVENTINFO PACKEDEVENTINFO, *PPACKEDEVENTINFO; struct _EVENTSFORLOGFILE { DWORD ulSize; WCHAR szLogicalLogFile[256]; DWORD ulNumRecords; EVENTLOGRECORD pEventLogRecords[]; }; struct _PACKEDEVENTINFO { DWORD ulSize; DWORD ulNumEventsForLogFile; DWORD ulOffsets[]; }; #pragma warning(pop) typedef enum _CM_SERVICE_NODE_TYPE { DriverType = 0x00000001, FileSystemType = 0x00000002, Win32ServiceOwnProcess = 0x00000010, Win32ServiceShareProcess = 0x00000020, AdapterType = 0x00000004, RecognizerType = 0x00000008 } SERVICE_NODE_TYPE; typedef enum _CM_SERVICE_LOAD_TYPE { BootLoad = 0x00000000, SystemLoad = 0x00000001, AutoLoad = 0x00000002, DemandLoad = 0x00000003, DisableLoad = 0x00000004 } SERVICE_LOAD_TYPE; typedef enum _CM_ERROR_CONTROL_TYPE { IgnoreError = 0x00000000, NormalError = 0x00000001, SevereError = 0x00000002, CriticalError = 0x00000003 } SERVICE_ERROR_TYPE; typedef struct _TAPE_ERASE { DWORD Type; BOOLEAN Immediate; } TAPE_ERASE, *PTAPE_ERASE; typedef struct _TAPE_PREPARE { DWORD Operation; BOOLEAN Immediate; } TAPE_PREPARE, *PTAPE_PREPARE; typedef struct _TAPE_WRITE_MARKS { DWORD Type; DWORD Count; BOOLEAN Immediate; } TAPE_WRITE_MARKS, *PTAPE_WRITE_MARKS; typedef struct _TAPE_GET_POSITION { DWORD Type; DWORD Partition; LARGE_INTEGER Offset; } TAPE_GET_POSITION, *PTAPE_GET_POSITION; typedef struct _TAPE_SET_POSITION { DWORD Method; DWORD Partition; LARGE_INTEGER Offset; BOOLEAN Immediate; } TAPE_SET_POSITION, *PTAPE_SET_POSITION; typedef struct _TAPE_GET_DRIVE_PARAMETERS { BOOLEAN ECC; BOOLEAN Compression; BOOLEAN DataPadding; BOOLEAN ReportSetmarks; DWORD DefaultBlockSize; DWORD MaximumBlockSize; DWORD MinimumBlockSize; DWORD MaximumPartitionCount; DWORD FeaturesLow; DWORD FeaturesHigh; DWORD EOTWarningZoneSize; } TAPE_GET_DRIVE_PARAMETERS, *PTAPE_GET_DRIVE_PARAMETERS; typedef struct _TAPE_SET_DRIVE_PARAMETERS { BOOLEAN ECC; BOOLEAN Compression; BOOLEAN DataPadding; BOOLEAN ReportSetmarks; DWORD EOTWarningZoneSize; } TAPE_SET_DRIVE_PARAMETERS, *PTAPE_SET_DRIVE_PARAMETERS; typedef struct _TAPE_GET_MEDIA_PARAMETERS { LARGE_INTEGER Capacity; LARGE_INTEGER Remaining; DWORD BlockSize; DWORD PartitionCount; BOOLEAN WriteProtected; } TAPE_GET_MEDIA_PARAMETERS, *PTAPE_GET_MEDIA_PARAMETERS; typedef struct _TAPE_SET_MEDIA_PARAMETERS { DWORD BlockSize; } TAPE_SET_MEDIA_PARAMETERS, *PTAPE_SET_MEDIA_PARAMETERS; typedef struct _TAPE_CREATE_PARTITION { DWORD Method; DWORD Count; DWORD Size; } TAPE_CREATE_PARTITION, *PTAPE_CREATE_PARTITION; typedef struct _TAPE_WMI_OPERATIONS { DWORD Method; DWORD DataBufferSize; PVOID DataBuffer; } TAPE_WMI_OPERATIONS, *PTAPE_WMI_OPERATIONS; typedef enum _TAPE_DRIVE_PROBLEM_TYPE { TapeDriveProblemNone, TapeDriveReadWriteWarning, TapeDriveReadWriteError, TapeDriveReadWarning, TapeDriveWriteWarning, TapeDriveReadError, TapeDriveWriteError, TapeDriveHardwareError, TapeDriveUnsupportedMedia, TapeDriveScsiConnectionError, TapeDriveTimetoClean, TapeDriveCleanDriveNow, TapeDriveMediaLifeExpired, TapeDriveSnappedTape } TAPE_DRIVE_PROBLEM_TYPE; extern "C" { extern "C" { #pragma warning(push) #pragma warning(disable: 4820) typedef GUID UOW, *PUOW; typedef GUID CRM_PROTOCOL_ID, *PCRM_PROTOCOL_ID; typedef ULONG NOTIFICATION_MASK; typedef struct _TRANSACTION_NOTIFICATION { PVOID TransactionKey; ULONG TransactionNotification; LARGE_INTEGER TmVirtualClock; ULONG ArgumentLength; } TRANSACTION_NOTIFICATION, *PTRANSACTION_NOTIFICATION; typedef struct _TRANSACTION_NOTIFICATION_RECOVERY_ARGUMENT { GUID EnlistmentId; UOW UOW; } TRANSACTION_NOTIFICATION_RECOVERY_ARGUMENT, *PTRANSACTION_NOTIFICATION_RECOVERY_ARGUMENT; typedef struct _TRANSACTION_NOTIFICATION_TM_ONLINE_ARGUMENT { GUID TmIdentity; ULONG Flags; } TRANSACTION_NOTIFICATION_TM_ONLINE_ARGUMENT, *PTRANSACTION_NOTIFICATION_TM_ONLINE_ARGUMENT; typedef ULONG SAVEPOINT_ID, *PSAVEPOINT_ID; typedef struct _TRANSACTION_NOTIFICATION_SAVEPOINT_ARGUMENT { SAVEPOINT_ID SavepointId; } TRANSACTION_NOTIFICATION_SAVEPOINT_ARGUMENT, *PTRANSACTION_NOTIFICATION_SAVEPOINT_ARGUMENT; typedef struct _TRANSACTION_NOTIFICATION_PROPAGATE_ARGUMENT { ULONG PropagationCookie; GUID UOW; GUID TmIdentity; ULONG BufferLength; } TRANSACTION_NOTIFICATION_PROPAGATE_ARGUMENT, *PTRANSACTION_NOTIFICATION_PROPAGATE_ARGUMENT; typedef struct _TRANSACTION_NOTIFICATION_MARSHAL_ARGUMENT { ULONG MarshalCookie; GUID UOW; } TRANSACTION_NOTIFICATION_MARSHAL_ARGUMENT, *PTRANSACTION_NOTIFICATION_MARSHAL_ARGUMENT; typedef TRANSACTION_NOTIFICATION_PROPAGATE_ARGUMENT TRANSACTION_NOTIFICATION_PROMOTE_ARGUMENT, *PTRANSACTION_NOTIFICATION_PROMOTE_ARGUMENT; typedef struct _KCRM_MARSHAL_HEADER { ULONG VersionMajor; ULONG VersionMinor; ULONG NumProtocols; ULONG Unused; } KCRM_MARSHAL_HEADER, *PKCRM_MARSHAL_HEADER, * PRKCRM_MARSHAL_HEADER; typedef struct _KCRM_TRANSACTION_BLOB { UOW UOW; GUID TmIdentity; ULONG IsolationLevel; ULONG IsolationFlags; ULONG Timeout; WCHAR Description[64]; } KCRM_TRANSACTION_BLOB, *PKCRM_TRANSACTION_BLOB, * PRKCRM_TRANSACTION_BLOB; typedef struct _KCRM_PROTOCOL_BLOB { CRM_PROTOCOL_ID ProtocolId; ULONG StaticInfoLength; ULONG TransactionIdInfoLength; ULONG Unused1; ULONG Unused2; } KCRM_PROTOCOL_BLOB, *PKCRM_PROTOCOL_BLOB, * PRKCRM_PROTOCOL_BLOB; #pragma warning(pop) } #pragma warning(push) #pragma warning(disable: 4820) typedef enum _TRANSACTION_OUTCOME { TransactionOutcomeUndetermined = 1, TransactionOutcomeCommitted, TransactionOutcomeAborted, } TRANSACTION_OUTCOME; typedef enum _TRANSACTION_STATE { TransactionStateNormal = 1, TransactionStateIndoubt, TransactionStateCommittedNotify, } TRANSACTION_STATE; typedef struct _TRANSACTION_BASIC_INFORMATION { GUID TransactionId; DWORD State; DWORD Outcome; } TRANSACTION_BASIC_INFORMATION, *PTRANSACTION_BASIC_INFORMATION; typedef struct _TRANSACTIONMANAGER_BASIC_INFORMATION { GUID TmIdentity; LARGE_INTEGER VirtualClock; } TRANSACTIONMANAGER_BASIC_INFORMATION, *PTRANSACTIONMANAGER_BASIC_INFORMATION; typedef struct _TRANSACTIONMANAGER_LOG_INFORMATION { GUID LogIdentity; } TRANSACTIONMANAGER_LOG_INFORMATION, *PTRANSACTIONMANAGER_LOG_INFORMATION; typedef struct _TRANSACTIONMANAGER_LOGPATH_INFORMATION { DWORD LogPathLength; WCHAR LogPath[1]; } TRANSACTIONMANAGER_LOGPATH_INFORMATION, *PTRANSACTIONMANAGER_LOGPATH_INFORMATION; typedef struct _TRANSACTIONMANAGER_RECOVERY_INFORMATION { ULONGLONG LastRecoveredLsn; } TRANSACTIONMANAGER_RECOVERY_INFORMATION, *PTRANSACTIONMANAGER_RECOVERY_INFORMATION; typedef struct _TRANSACTIONMANAGER_OLDEST_INFORMATION { GUID OldestTransactionGuid; } TRANSACTIONMANAGER_OLDEST_INFORMATION, *PTRANSACTIONMANAGER_OLDEST_INFORMATION; typedef struct _TRANSACTION_PROPERTIES_INFORMATION { DWORD IsolationLevel; DWORD IsolationFlags; LARGE_INTEGER Timeout; DWORD Outcome; DWORD DescriptionLength; WCHAR Description[1]; } TRANSACTION_PROPERTIES_INFORMATION, *PTRANSACTION_PROPERTIES_INFORMATION; typedef struct _TRANSACTION_BIND_INFORMATION { HANDLE TmHandle; } TRANSACTION_BIND_INFORMATION, *PTRANSACTION_BIND_INFORMATION; typedef struct _TRANSACTION_ENLISTMENT_PAIR { GUID EnlistmentId; GUID ResourceManagerId; } TRANSACTION_ENLISTMENT_PAIR, *PTRANSACTION_ENLISTMENT_PAIR; typedef struct _TRANSACTION_ENLISTMENTS_INFORMATION { DWORD NumberOfEnlistments; TRANSACTION_ENLISTMENT_PAIR EnlistmentPair[1]; } TRANSACTION_ENLISTMENTS_INFORMATION, *PTRANSACTION_ENLISTMENTS_INFORMATION; typedef struct _TRANSACTION_SUPERIOR_ENLISTMENT_INFORMATION { TRANSACTION_ENLISTMENT_PAIR SuperiorEnlistmentPair; } TRANSACTION_SUPERIOR_ENLISTMENT_INFORMATION, *PTRANSACTION_SUPERIOR_ENLISTMENT_INFORMATION; typedef struct _RESOURCEMANAGER_BASIC_INFORMATION { GUID ResourceManagerId; DWORD DescriptionLength; WCHAR Description[1]; } RESOURCEMANAGER_BASIC_INFORMATION, *PRESOURCEMANAGER_BASIC_INFORMATION; typedef struct _RESOURCEMANAGER_COMPLETION_INFORMATION { HANDLE IoCompletionPortHandle; ULONG_PTR CompletionKey; } RESOURCEMANAGER_COMPLETION_INFORMATION, *PRESOURCEMANAGER_COMPLETION_INFORMATION; typedef enum _TRANSACTION_INFORMATION_CLASS { TransactionBasicInformation, TransactionPropertiesInformation, TransactionEnlistmentInformation, TransactionSuperiorEnlistmentInformation , TransactionBindInformation, TransactionDTCPrivateInformation , } TRANSACTION_INFORMATION_CLASS; typedef enum _TRANSACTIONMANAGER_INFORMATION_CLASS { TransactionManagerBasicInformation, TransactionManagerLogInformation, TransactionManagerLogPathInformation, TransactionManagerRecoveryInformation = 4 , TransactionManagerOnlineProbeInformation = 3, TransactionManagerOldestTransactionInformation = 5 } TRANSACTIONMANAGER_INFORMATION_CLASS; typedef enum _RESOURCEMANAGER_INFORMATION_CLASS { ResourceManagerBasicInformation, ResourceManagerCompletionInformation, } RESOURCEMANAGER_INFORMATION_CLASS; typedef struct _ENLISTMENT_BASIC_INFORMATION { GUID EnlistmentId; GUID TransactionId; GUID ResourceManagerId; } ENLISTMENT_BASIC_INFORMATION, *PENLISTMENT_BASIC_INFORMATION; typedef struct _ENLISTMENT_CRM_INFORMATION { GUID CrmTransactionManagerId; GUID CrmResourceManagerId; GUID CrmEnlistmentId; } ENLISTMENT_CRM_INFORMATION, *PENLISTMENT_CRM_INFORMATION; typedef enum _ENLISTMENT_INFORMATION_CLASS { EnlistmentBasicInformation, EnlistmentRecoveryInformation, EnlistmentCrmInformation } ENLISTMENT_INFORMATION_CLASS; typedef struct _TRANSACTION_LIST_ENTRY { UOW UOW; } TRANSACTION_LIST_ENTRY, *PTRANSACTION_LIST_ENTRY; typedef struct _TRANSACTION_LIST_INFORMATION { DWORD NumberOfTransactions; TRANSACTION_LIST_ENTRY TransactionInformation[1]; } TRANSACTION_LIST_INFORMATION, *PTRANSACTION_LIST_INFORMATION; typedef enum _KTMOBJECT_TYPE { KTMOBJECT_TRANSACTION, KTMOBJECT_TRANSACTION_MANAGER, KTMOBJECT_RESOURCE_MANAGER, KTMOBJECT_ENLISTMENT, KTMOBJECT_INVALID } KTMOBJECT_TYPE, *PKTMOBJECT_TYPE; typedef struct _KTMOBJECT_CURSOR { GUID LastQuery; DWORD ObjectIdCount; GUID ObjectIds[1]; } KTMOBJECT_CURSOR, *PKTMOBJECT_CURSOR; #pragma warning(pop) } typedef DWORD TP_VERSION, *PTP_VERSION; typedef struct _TP_CALLBACK_INSTANCE TP_CALLBACK_INSTANCE, *PTP_CALLBACK_INSTANCE; typedef void (__stdcall *PTP_SIMPLE_CALLBACK)( PTP_CALLBACK_INSTANCE Instance, PVOID Context ); typedef struct _TP_POOL TP_POOL, *PTP_POOL; typedef enum _TP_CALLBACK_PRIORITY { TP_CALLBACK_PRIORITY_HIGH, TP_CALLBACK_PRIORITY_NORMAL, TP_CALLBACK_PRIORITY_LOW, TP_CALLBACK_PRIORITY_INVALID, TP_CALLBACK_PRIORITY_COUNT = TP_CALLBACK_PRIORITY_INVALID } TP_CALLBACK_PRIORITY; typedef struct _TP_POOL_STACK_INFORMATION { SIZE_T StackReserve; SIZE_T StackCommit; }TP_POOL_STACK_INFORMATION, *PTP_POOL_STACK_INFORMATION; typedef struct _TP_CLEANUP_GROUP TP_CLEANUP_GROUP, *PTP_CLEANUP_GROUP; typedef void (__stdcall *PTP_CLEANUP_GROUP_CANCEL_CALLBACK)( PVOID ObjectContext, PVOID CleanupContext ); typedef struct _TP_CALLBACK_ENVIRON_V3 { TP_VERSION Version; PTP_POOL Pool; PTP_CLEANUP_GROUP CleanupGroup; PTP_CLEANUP_GROUP_CANCEL_CALLBACK CleanupGroupCancelCallback; PVOID RaceDll; struct _ACTIVATION_CONTEXT *ActivationContext; PTP_SIMPLE_CALLBACK FinalizationCallback; union { DWORD Flags; struct { DWORD LongFunction : 1; DWORD Persistent : 1; DWORD Private : 30; } s; } u; TP_CALLBACK_PRIORITY CallbackPriority; DWORD Size; } TP_CALLBACK_ENVIRON_V3; typedef TP_CALLBACK_ENVIRON_V3 TP_CALLBACK_ENVIRON, *PTP_CALLBACK_ENVIRON; __forceinline void TpInitializeCallbackEnviron( PTP_CALLBACK_ENVIRON CallbackEnviron ) { CallbackEnviron->Version = 3; CallbackEnviron->Pool = 0; CallbackEnviron->CleanupGroup = 0; CallbackEnviron->CleanupGroupCancelCallback = 0; CallbackEnviron->RaceDll = 0; CallbackEnviron->ActivationContext = 0; CallbackEnviron->FinalizationCallback = 0; CallbackEnviron->u.Flags = 0; CallbackEnviron->CallbackPriority = TP_CALLBACK_PRIORITY_NORMAL; CallbackEnviron->Size = sizeof(TP_CALLBACK_ENVIRON); } __forceinline void TpSetCallbackThreadpool( PTP_CALLBACK_ENVIRON CallbackEnviron, PTP_POOL Pool ) { CallbackEnviron->Pool = Pool; } __forceinline void TpSetCallbackCleanupGroup( PTP_CALLBACK_ENVIRON CallbackEnviron, PTP_CLEANUP_GROUP CleanupGroup, PTP_CLEANUP_GROUP_CANCEL_CALLBACK CleanupGroupCancelCallback ) { CallbackEnviron->CleanupGroup = CleanupGroup; CallbackEnviron->CleanupGroupCancelCallback = CleanupGroupCancelCallback; } __forceinline void TpSetCallbackActivationContext( PTP_CALLBACK_ENVIRON CallbackEnviron, struct _ACTIVATION_CONTEXT *ActivationContext ) { CallbackEnviron->ActivationContext = ActivationContext; } __forceinline void TpSetCallbackNoActivationContext( PTP_CALLBACK_ENVIRON CallbackEnviron ) { CallbackEnviron->ActivationContext = (struct _ACTIVATION_CONTEXT *)(LONG_PTR) -1; } __forceinline void TpSetCallbackLongFunction( PTP_CALLBACK_ENVIRON CallbackEnviron ) { CallbackEnviron->u.s.LongFunction = 1; } __forceinline void TpSetCallbackRaceWithDll( PTP_CALLBACK_ENVIRON CallbackEnviron, PVOID DllHandle ) { CallbackEnviron->RaceDll = DllHandle; } __forceinline void TpSetCallbackFinalizationCallback( PTP_CALLBACK_ENVIRON CallbackEnviron, PTP_SIMPLE_CALLBACK FinalizationCallback ) { CallbackEnviron->FinalizationCallback = FinalizationCallback; } __forceinline void TpSetCallbackPriority( PTP_CALLBACK_ENVIRON CallbackEnviron, TP_CALLBACK_PRIORITY Priority ) { CallbackEnviron->CallbackPriority = Priority; } __forceinline void TpSetCallbackPersistent( PTP_CALLBACK_ENVIRON CallbackEnviron ) { CallbackEnviron->u.s.Persistent = 1; } __forceinline void TpDestroyCallbackEnviron( PTP_CALLBACK_ENVIRON CallbackEnviron ) { (CallbackEnviron); } typedef struct _TP_WORK TP_WORK, *PTP_WORK; typedef void (__stdcall *PTP_WORK_CALLBACK)( PTP_CALLBACK_INSTANCE Instance, PVOID Context, PTP_WORK Work ); typedef struct _TP_TIMER TP_TIMER, *PTP_TIMER; typedef void (__stdcall *PTP_TIMER_CALLBACK)( PTP_CALLBACK_INSTANCE Instance, PVOID Context, PTP_TIMER Timer ); typedef DWORD TP_WAIT_RESULT; typedef struct _TP_WAIT TP_WAIT, *PTP_WAIT; typedef void (__stdcall *PTP_WAIT_CALLBACK)( PTP_CALLBACK_INSTANCE Instance, PVOID Context, PTP_WAIT Wait, TP_WAIT_RESULT WaitResult ); typedef struct _TP_IO TP_IO, *PTP_IO; __forceinline struct _TEB * NtCurrentTeb ( void ) { return (struct _TEB *)__readgsqword(((LONG)(LONG_PTR)&(((NT_TIB *)0)->Self))); } __forceinline PVOID GetCurrentFiber ( void ) { return (PVOID)__readgsqword(((LONG)(LONG_PTR)&(((NT_TIB *)0)->FiberData))); } __forceinline PVOID GetFiberData ( void ) { return *(PVOID *)GetCurrentFiber(); } } #pragma warning(pop) typedef UINT_PTR WPARAM; typedef LONG_PTR LPARAM; typedef LONG_PTR LRESULT; typedef HANDLE *SPHANDLE; typedef HANDLE *LPHANDLE; typedef HANDLE HGLOBAL; typedef HANDLE HLOCAL; typedef HANDLE GLOBALHANDLE; typedef HANDLE LOCALHANDLE; #pragma warning(push) #pragma warning(disable: 4255) typedef INT_PTR ( __stdcall *FARPROC)(); typedef INT_PTR ( __stdcall *NEARPROC)(); typedef INT_PTR (__stdcall *PROC)(); #pragma warning(pop) typedef WORD ATOM; struct HKEY__{int unused;}; typedef struct HKEY__ *HKEY; typedef HKEY *PHKEY; struct HMETAFILE__{int unused;}; typedef struct HMETAFILE__ *HMETAFILE; struct HINSTANCE__{int unused;}; typedef struct HINSTANCE__ *HINSTANCE; typedef HINSTANCE HMODULE; struct HRGN__{int unused;}; typedef struct HRGN__ *HRGN; struct HRSRC__{int unused;}; typedef struct HRSRC__ *HRSRC; struct HSPRITE__{int unused;}; typedef struct HSPRITE__ *HSPRITE; struct HLSURF__{int unused;}; typedef struct HLSURF__ *HLSURF; struct HSTR__{int unused;}; typedef struct HSTR__ *HSTR; struct HTASK__{int unused;}; typedef struct HTASK__ *HTASK; struct HWINSTA__{int unused;}; typedef struct HWINSTA__ *HWINSTA; struct HKL__{int unused;}; typedef struct HKL__ *HKL; typedef int HFILE; typedef struct _FILETIME { DWORD dwLowDateTime; DWORD dwHighDateTime; } FILETIME, *PFILETIME, *LPFILETIME; } struct HWND__{int unused;}; typedef struct HWND__ *HWND; struct HHOOK__{int unused;}; typedef struct HHOOK__ *HHOOK; typedef void * HGDIOBJ; struct HACCEL__{int unused;}; typedef struct HACCEL__ *HACCEL; struct HBITMAP__{int unused;}; typedef struct HBITMAP__ *HBITMAP; struct HBRUSH__{int unused;}; typedef struct HBRUSH__ *HBRUSH; struct HCOLORSPACE__{int unused;}; typedef struct HCOLORSPACE__ *HCOLORSPACE; struct HDC__{int unused;}; typedef struct HDC__ *HDC; struct HGLRC__{int unused;}; typedef struct HGLRC__ *HGLRC; struct HDESK__{int unused;}; typedef struct HDESK__ *HDESK; struct HENHMETAFILE__{int unused;}; typedef struct HENHMETAFILE__ *HENHMETAFILE; struct HFONT__{int unused;}; typedef struct HFONT__ *HFONT; struct HICON__{int unused;}; typedef struct HICON__ *HICON; struct HMENU__{int unused;}; typedef struct HMENU__ *HMENU; struct HPALETTE__{int unused;}; typedef struct HPALETTE__ *HPALETTE; struct HPEN__{int unused;}; typedef struct HPEN__ *HPEN; struct HWINEVENTHOOK__{int unused;}; typedef struct HWINEVENTHOOK__ *HWINEVENTHOOK; struct HMONITOR__{int unused;}; typedef struct HMONITOR__ *HMONITOR; struct HUMPD__{int unused;}; typedef struct HUMPD__ *HUMPD; typedef HICON HCURSOR; typedef DWORD COLORREF; typedef DWORD *LPCOLORREF; typedef struct tagRECT { LONG left; LONG top; LONG right; LONG bottom; } RECT, *PRECT, *NPRECT, *LPRECT; typedef const RECT * LPCRECT; typedef struct _RECTL { LONG left; LONG top; LONG right; LONG bottom; } RECTL, *PRECTL, *LPRECTL; typedef const RECTL * LPCRECTL; typedef struct tagPOINT { LONG x; LONG y; } POINT, *PPOINT, *NPPOINT, *LPPOINT; typedef struct _POINTL { LONG x; LONG y; } POINTL, *PPOINTL; typedef struct tagSIZE { LONG cx; LONG cy; } SIZE, *PSIZE, *LPSIZE; typedef SIZE SIZEL; typedef SIZE *PSIZEL, *LPSIZEL; typedef struct tagPOINTS { SHORT x; SHORT y; } POINTS, *PPOINTS, *LPPOINTS; } struct DPI_AWARENESS_CONTEXT__{int unused;}; typedef struct DPI_AWARENESS_CONTEXT__ *DPI_AWARENESS_CONTEXT; typedef enum DPI_AWARENESS { DPI_AWARENESS_INVALID = -1, DPI_AWARENESS_UNAWARE = 0, DPI_AWARENESS_SYSTEM_AWARE = 1, DPI_AWARENESS_PER_MONITOR_AWARE = 2 } DPI_AWARENESS; typedef enum DPI_HOSTING_BEHAVIOR { DPI_HOSTING_BEHAVIOR_INVALID = -1, DPI_HOSTING_BEHAVIOR_DEFAULT = 0, DPI_HOSTING_BEHAVIOR_MIXED = 1 } DPI_HOSTING_BEHAVIOR; #pragma warning(push) #pragma warning(disable: 4820) #pragma warning(disable: 4668) #pragma warning(disable: 4001) #pragma warning(disable: 4201) #pragma warning(disable: 4214) #pragma warning(disable: 4514) #pragma warning(disable: 4103) #pragma warning(push) #pragma warning(disable: 4820) #pragma warning(disable: 4001) #pragma warning(disable: 4201) #pragma warning(disable: 4214) extern "C" { typedef struct _SECURITY_ATTRIBUTES { DWORD nLength; LPVOID lpSecurityDescriptor; BOOL bInheritHandle; } SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES; typedef struct _OVERLAPPED { ULONG_PTR Internal; ULONG_PTR InternalHigh; union { struct { DWORD Offset; DWORD OffsetHigh; } ; PVOID Pointer; } ; HANDLE hEvent; } OVERLAPPED, *LPOVERLAPPED; typedef struct _OVERLAPPED_ENTRY { ULONG_PTR lpCompletionKey; LPOVERLAPPED lpOverlapped; ULONG_PTR Internal; DWORD dwNumberOfBytesTransferred; } OVERLAPPED_ENTRY, *LPOVERLAPPED_ENTRY; typedef struct _SYSTEMTIME { WORD wYear; WORD wMonth; WORD wDayOfWeek; WORD wDay; WORD wHour; WORD wMinute; WORD wSecond; WORD wMilliseconds; } SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME; typedef struct _WIN32_FIND_DATAA { DWORD dwFileAttributes; FILETIME ftCreationTime; FILETIME ftLastAccessTime; FILETIME ftLastWriteTime; DWORD nFileSizeHigh; DWORD nFileSizeLow; DWORD dwReserved0; DWORD dwReserved1; CHAR cFileName[ 260 ]; CHAR cAlternateFileName[ 14 ]; } WIN32_FIND_DATAA, *PWIN32_FIND_DATAA, *LPWIN32_FIND_DATAA; typedef struct _WIN32_FIND_DATAW { DWORD dwFileAttributes; FILETIME ftCreationTime; FILETIME ftLastAccessTime; FILETIME ftLastWriteTime; DWORD nFileSizeHigh; DWORD nFileSizeLow; DWORD dwReserved0; DWORD dwReserved1; WCHAR cFileName[ 260 ]; WCHAR cAlternateFileName[ 14 ]; } WIN32_FIND_DATAW, *PWIN32_FIND_DATAW, *LPWIN32_FIND_DATAW; typedef WIN32_FIND_DATAW WIN32_FIND_DATA; typedef PWIN32_FIND_DATAW PWIN32_FIND_DATA; typedef LPWIN32_FIND_DATAW LPWIN32_FIND_DATA; typedef enum _FINDEX_INFO_LEVELS { FindExInfoStandard, FindExInfoBasic, FindExInfoMaxInfoLevel } FINDEX_INFO_LEVELS; typedef enum _FINDEX_SEARCH_OPS { FindExSearchNameMatch, FindExSearchLimitToDirectories, FindExSearchLimitToDevices, FindExSearchMaxSearchOp } FINDEX_SEARCH_OPS; typedef enum _GET_FILEEX_INFO_LEVELS { GetFileExInfoStandard, GetFileExMaxInfoLevel } GET_FILEEX_INFO_LEVELS; typedef enum _FILE_INFO_BY_HANDLE_CLASS { FileBasicInfo, FileStandardInfo, FileNameInfo, FileRenameInfo, FileDispositionInfo, FileAllocationInfo, FileEndOfFileInfo, FileStreamInfo, FileCompressionInfo, FileAttributeTagInfo, FileIdBothDirectoryInfo, FileIdBothDirectoryRestartInfo, FileIoPriorityHintInfo, FileRemoteProtocolInfo, FileFullDirectoryInfo, FileFullDirectoryRestartInfo, FileStorageInfo, FileAlignmentInfo, FileIdInfo, FileIdExtdDirectoryInfo, FileIdExtdDirectoryRestartInfo, FileDispositionInfoEx, FileRenameInfoEx, FileCaseSensitiveInfo, FileNormalizedNameInfo, MaximumFileInfoByHandleClass } FILE_INFO_BY_HANDLE_CLASS, *PFILE_INFO_BY_HANDLE_CLASS; typedef RTL_CRITICAL_SECTION CRITICAL_SECTION; typedef PRTL_CRITICAL_SECTION PCRITICAL_SECTION; typedef PRTL_CRITICAL_SECTION LPCRITICAL_SECTION; typedef RTL_CRITICAL_SECTION_DEBUG CRITICAL_SECTION_DEBUG; typedef PRTL_CRITICAL_SECTION_DEBUG PCRITICAL_SECTION_DEBUG; typedef PRTL_CRITICAL_SECTION_DEBUG LPCRITICAL_SECTION_DEBUG; typedef void (__stdcall *LPOVERLAPPED_COMPLETION_ROUTINE)( DWORD dwErrorCode, DWORD dwNumberOfBytesTransfered, LPOVERLAPPED lpOverlapped ); typedef struct _PROCESS_HEAP_ENTRY { PVOID lpData; DWORD cbData; BYTE cbOverhead; BYTE iRegionIndex; WORD wFlags; union { struct { HANDLE hMem; DWORD dwReserved[ 3 ]; } Block; struct { DWORD dwCommittedSize; DWORD dwUnCommittedSize; LPVOID lpFirstBlock; LPVOID lpLastBlock; } Region; } ; } PROCESS_HEAP_ENTRY, *LPPROCESS_HEAP_ENTRY, *PPROCESS_HEAP_ENTRY; typedef struct _REASON_CONTEXT { ULONG Version; DWORD Flags; union { struct { HMODULE LocalizedReasonModule; ULONG LocalizedReasonId; ULONG ReasonStringCount; LPWSTR *ReasonStrings; } Detailed; LPWSTR SimpleReasonString; } Reason; } REASON_CONTEXT, *PREASON_CONTEXT; typedef DWORD (__stdcall *PTHREAD_START_ROUTINE)( LPVOID lpThreadParameter ); typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE; typedef LPVOID (__stdcall *PENCLAVE_ROUTINE)( LPVOID lpThreadParameter ); typedef PENCLAVE_ROUTINE LPENCLAVE_ROUTINE; typedef struct _EXCEPTION_DEBUG_INFO { EXCEPTION_RECORD ExceptionRecord; DWORD dwFirstChance; } EXCEPTION_DEBUG_INFO, *LPEXCEPTION_DEBUG_INFO; typedef struct _CREATE_THREAD_DEBUG_INFO { HANDLE hThread; LPVOID lpThreadLocalBase; LPTHREAD_START_ROUTINE lpStartAddress; } CREATE_THREAD_DEBUG_INFO, *LPCREATE_THREAD_DEBUG_INFO; typedef struct _CREATE_PROCESS_DEBUG_INFO { HANDLE hFile; HANDLE hProcess; HANDLE hThread; LPVOID lpBaseOfImage; DWORD dwDebugInfoFileOffset; DWORD nDebugInfoSize; LPVOID lpThreadLocalBase; LPTHREAD_START_ROUTINE lpStartAddress; LPVOID lpImageName; WORD fUnicode; } CREATE_PROCESS_DEBUG_INFO, *LPCREATE_PROCESS_DEBUG_INFO; typedef struct _EXIT_THREAD_DEBUG_INFO { DWORD dwExitCode; } EXIT_THREAD_DEBUG_INFO, *LPEXIT_THREAD_DEBUG_INFO; typedef struct _EXIT_PROCESS_DEBUG_INFO { DWORD dwExitCode; } EXIT_PROCESS_DEBUG_INFO, *LPEXIT_PROCESS_DEBUG_INFO; typedef struct _LOAD_DLL_DEBUG_INFO { HANDLE hFile; LPVOID lpBaseOfDll; DWORD dwDebugInfoFileOffset; DWORD nDebugInfoSize; LPVOID lpImageName; WORD fUnicode; } LOAD_DLL_DEBUG_INFO, *LPLOAD_DLL_DEBUG_INFO; typedef struct _UNLOAD_DLL_DEBUG_INFO { LPVOID lpBaseOfDll; } UNLOAD_DLL_DEBUG_INFO, *LPUNLOAD_DLL_DEBUG_INFO; typedef struct _OUTPUT_DEBUG_STRING_INFO { LPSTR lpDebugStringData; WORD fUnicode; WORD nDebugStringLength; } OUTPUT_DEBUG_STRING_INFO, *LPOUTPUT_DEBUG_STRING_INFO; typedef struct _RIP_INFO { DWORD dwError; DWORD dwType; } RIP_INFO, *LPRIP_INFO; typedef struct _DEBUG_EVENT { DWORD dwDebugEventCode; DWORD dwProcessId; DWORD dwThreadId; union { EXCEPTION_DEBUG_INFO Exception; CREATE_THREAD_DEBUG_INFO CreateThread; CREATE_PROCESS_DEBUG_INFO CreateProcessInfo; EXIT_THREAD_DEBUG_INFO ExitThread; EXIT_PROCESS_DEBUG_INFO ExitProcess; LOAD_DLL_DEBUG_INFO LoadDll; UNLOAD_DLL_DEBUG_INFO UnloadDll; OUTPUT_DEBUG_STRING_INFO DebugString; RIP_INFO RipInfo; } u; } DEBUG_EVENT, *LPDEBUG_EVENT; typedef PCONTEXT LPCONTEXT; } #pragma warning(pop) extern "C" { BOOL __stdcall IsApiSetImplemented( PCSTR Contract ); } extern "C" { __declspec(dllimport) BOOL __stdcall SetEnvironmentStringsW( LPWCH NewEnvironment ); __declspec(dllimport) HANDLE __stdcall GetStdHandle( DWORD nStdHandle ); __declspec(dllimport) BOOL __stdcall SetStdHandle( DWORD nStdHandle, HANDLE hHandle ); __declspec(dllimport) BOOL __stdcall SetStdHandleEx( DWORD nStdHandle, HANDLE hHandle, PHANDLE phPrevValue ); __declspec(dllimport) LPSTR __stdcall GetCommandLineA( void ); __declspec(dllimport) LPWSTR __stdcall GetCommandLineW( void ); __declspec(dllimport) LPCH __stdcall GetEnvironmentStrings( void ); __declspec(dllimport) LPWCH __stdcall GetEnvironmentStringsW( void ); __declspec(dllimport) BOOL __stdcall FreeEnvironmentStringsA( LPCH penv ); __declspec(dllimport) BOOL __stdcall FreeEnvironmentStringsW( LPWCH penv ); __declspec(dllimport) DWORD __stdcall GetEnvironmentVariableA( LPCSTR lpName, LPSTR lpBuffer, DWORD nSize ); __declspec(dllimport) DWORD __stdcall GetEnvironmentVariableW( LPCWSTR lpName, LPWSTR lpBuffer, DWORD nSize ); __declspec(dllimport) BOOL __stdcall SetEnvironmentVariableA( LPCSTR lpName, LPCSTR lpValue ); __declspec(dllimport) BOOL __stdcall SetEnvironmentVariableW( LPCWSTR lpName, LPCWSTR lpValue ); __declspec(dllimport) DWORD __stdcall ExpandEnvironmentStringsA( LPCSTR lpSrc, LPSTR lpDst, DWORD nSize ); __declspec(dllimport) DWORD __stdcall ExpandEnvironmentStringsW( LPCWSTR lpSrc, LPWSTR lpDst, DWORD nSize ); __declspec(dllimport) BOOL __stdcall SetCurrentDirectoryA( LPCSTR lpPathName ); __declspec(dllimport) BOOL __stdcall SetCurrentDirectoryW( LPCWSTR lpPathName ); __declspec(dllimport) DWORD __stdcall GetCurrentDirectoryA( DWORD nBufferLength, LPSTR lpBuffer ); __declspec(dllimport) DWORD __stdcall GetCurrentDirectoryW( DWORD nBufferLength, LPWSTR lpBuffer ); __declspec(dllimport) DWORD __stdcall SearchPathW( LPCWSTR lpPath, LPCWSTR lpFileName, LPCWSTR lpExtension, DWORD nBufferLength, LPWSTR lpBuffer, LPWSTR* lpFilePart ); __declspec(dllimport) DWORD __stdcall SearchPathA( LPCSTR lpPath, LPCSTR lpFileName, LPCSTR lpExtension, DWORD nBufferLength, LPSTR lpBuffer, LPSTR* lpFilePart ); __declspec(dllimport) BOOL __stdcall NeedCurrentDirectoryForExePathA( LPCSTR ExeName ); __declspec(dllimport) BOOL __stdcall NeedCurrentDirectoryForExePathW( LPCWSTR ExeName ); } extern "C" { __declspec(dllimport) LONG __stdcall CompareFileTime( const FILETIME* lpFileTime1, const FILETIME* lpFileTime2 ); __declspec(dllimport) BOOL __stdcall CreateDirectoryA( LPCSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); __declspec(dllimport) BOOL __stdcall CreateDirectoryW( LPCWSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); __declspec(dllimport) HANDLE __stdcall CreateFileA( LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile ); __declspec(dllimport) HANDLE __stdcall CreateFileW( LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile ); __declspec(dllimport) BOOL __stdcall DefineDosDeviceW( DWORD dwFlags, LPCWSTR lpDeviceName, LPCWSTR lpTargetPath ); __declspec(dllimport) BOOL __stdcall DeleteFileA( LPCSTR lpFileName ); __declspec(dllimport) BOOL __stdcall DeleteFileW( LPCWSTR lpFileName ); __declspec(dllimport) BOOL __stdcall DeleteVolumeMountPointW( LPCWSTR lpszVolumeMountPoint ); __declspec(dllimport) BOOL __stdcall FileTimeToLocalFileTime( const FILETIME* lpFileTime, LPFILETIME lpLocalFileTime ); __declspec(dllimport) BOOL __stdcall FindClose( HANDLE hFindFile ); __declspec(dllimport) BOOL __stdcall FindCloseChangeNotification( HANDLE hChangeHandle ); __declspec(dllimport) HANDLE __stdcall FindFirstChangeNotificationA( LPCSTR lpPathName, BOOL bWatchSubtree, DWORD dwNotifyFilter ); __declspec(dllimport) HANDLE __stdcall FindFirstChangeNotificationW( LPCWSTR lpPathName, BOOL bWatchSubtree, DWORD dwNotifyFilter ); __declspec(dllimport) HANDLE __stdcall FindFirstFileA( LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData ); __declspec(dllimport) HANDLE __stdcall FindFirstFileW( LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData ); __declspec(dllimport) HANDLE __stdcall FindFirstFileExA( LPCSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags ); __declspec(dllimport) HANDLE __stdcall FindFirstFileExW( LPCWSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags ); __declspec(dllimport) HANDLE __stdcall FindFirstVolumeW( LPWSTR lpszVolumeName, DWORD cchBufferLength ); __declspec(dllimport) BOOL __stdcall FindNextChangeNotification( HANDLE hChangeHandle ); __declspec(dllimport) BOOL __stdcall FindNextFileA( HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData ); __declspec(dllimport) BOOL __stdcall FindNextFileW( HANDLE hFindFile, LPWIN32_FIND_DATAW lpFindFileData ); __declspec(dllimport) BOOL __stdcall FindNextVolumeW( HANDLE hFindVolume, LPWSTR lpszVolumeName, DWORD cchBufferLength ); __declspec(dllimport) BOOL __stdcall FindVolumeClose( HANDLE hFindVolume ); __declspec(dllimport) BOOL __stdcall FlushFileBuffers( HANDLE hFile ); __declspec(dllimport) BOOL __stdcall GetDiskFreeSpaceA( LPCSTR lpRootPathName, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters ); __declspec(dllimport) BOOL __stdcall GetDiskFreeSpaceW( LPCWSTR lpRootPathName, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters ); __declspec(dllimport) BOOL __stdcall GetDiskFreeSpaceExA( LPCSTR lpDirectoryName, PULARGE_INTEGER lpFreeBytesAvailableToCaller, PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes ); __declspec(dllimport) BOOL __stdcall GetDiskFreeSpaceExW( LPCWSTR lpDirectoryName, PULARGE_INTEGER lpFreeBytesAvailableToCaller, PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes ); typedef struct DISK_SPACE_INFORMATION { ULONGLONG ActualTotalAllocationUnits; ULONGLONG ActualAvailableAllocationUnits; ULONGLONG ActualPoolUnavailableAllocationUnits; ULONGLONG CallerTotalAllocationUnits; ULONGLONG CallerAvailableAllocationUnits; ULONGLONG CallerPoolUnavailableAllocationUnits; ULONGLONG UsedAllocationUnits; ULONGLONG TotalReservedAllocationUnits; ULONGLONG VolumeStorageReserveAllocationUnits; ULONGLONG AvailableCommittedAllocationUnits; ULONGLONG PoolAvailableAllocationUnits; DWORD SectorsPerAllocationUnit; DWORD BytesPerSector; } DISK_SPACE_INFORMATION; __declspec(dllimport) HRESULT __stdcall GetDiskSpaceInformationA( LPCSTR rootPath, DISK_SPACE_INFORMATION* diskSpaceInfo ); __declspec(dllimport) HRESULT __stdcall GetDiskSpaceInformationW( LPCWSTR rootPath, DISK_SPACE_INFORMATION* diskSpaceInfo ); __declspec(dllimport) UINT __stdcall GetDriveTypeA( LPCSTR lpRootPathName ); __declspec(dllimport) UINT __stdcall GetDriveTypeW( LPCWSTR lpRootPathName ); typedef struct _WIN32_FILE_ATTRIBUTE_DATA { DWORD dwFileAttributes; FILETIME ftCreationTime; FILETIME ftLastAccessTime; FILETIME ftLastWriteTime; DWORD nFileSizeHigh; DWORD nFileSizeLow; } WIN32_FILE_ATTRIBUTE_DATA, *LPWIN32_FILE_ATTRIBUTE_DATA; __declspec(dllimport) DWORD __stdcall GetFileAttributesA( LPCSTR lpFileName ); __declspec(dllimport) DWORD __stdcall GetFileAttributesW( LPCWSTR lpFileName ); __declspec(dllimport) BOOL __stdcall GetFileAttributesExA( LPCSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation ); __declspec(dllimport) BOOL __stdcall GetFileAttributesExW( LPCWSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation ); typedef struct _BY_HANDLE_FILE_INFORMATION { DWORD dwFileAttributes; FILETIME ftCreationTime; FILETIME ftLastAccessTime; FILETIME ftLastWriteTime; DWORD dwVolumeSerialNumber; DWORD nFileSizeHigh; DWORD nFileSizeLow; DWORD nNumberOfLinks; DWORD nFileIndexHigh; DWORD nFileIndexLow; } BY_HANDLE_FILE_INFORMATION, *PBY_HANDLE_FILE_INFORMATION, *LPBY_HANDLE_FILE_INFORMATION; __declspec(dllimport) BOOL __stdcall GetFileInformationByHandle( HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation ); __declspec(dllimport) DWORD __stdcall GetFileSize( HANDLE hFile, LPDWORD lpFileSizeHigh ); __declspec(dllimport) BOOL __stdcall GetFileSizeEx( HANDLE hFile, PLARGE_INTEGER lpFileSize ); __declspec(dllimport) DWORD __stdcall GetFileType( HANDLE hFile ); __declspec(dllimport) DWORD __stdcall GetFinalPathNameByHandleA( HANDLE hFile, LPSTR lpszFilePath, DWORD cchFilePath, DWORD dwFlags ); __declspec(dllimport) DWORD __stdcall GetFinalPathNameByHandleW( HANDLE hFile, LPWSTR lpszFilePath, DWORD cchFilePath, DWORD dwFlags ); __declspec(dllimport) BOOL __stdcall GetFileTime( HANDLE hFile, LPFILETIME lpCreationTime, LPFILETIME lpLastAccessTime, LPFILETIME lpLastWriteTime ); __declspec(dllimport) DWORD __stdcall GetFullPathNameW( LPCWSTR lpFileName, DWORD nBufferLength, LPWSTR lpBuffer, LPWSTR* lpFilePart ); __declspec(dllimport) DWORD __stdcall GetFullPathNameA( LPCSTR lpFileName, DWORD nBufferLength, LPSTR lpBuffer, LPSTR* lpFilePart ); __declspec(dllimport) DWORD __stdcall GetLogicalDrives( void ); __declspec(dllimport) DWORD __stdcall GetLogicalDriveStringsW( DWORD nBufferLength, LPWSTR lpBuffer ); __declspec(dllimport) DWORD __stdcall GetLongPathNameA( LPCSTR lpszShortPath, LPSTR lpszLongPath, DWORD cchBuffer ); __declspec(dllimport) DWORD __stdcall GetLongPathNameW( LPCWSTR lpszShortPath, LPWSTR lpszLongPath, DWORD cchBuffer ); __declspec(dllimport) DWORD __stdcall GetShortPathNameW( LPCWSTR lpszLongPath, LPWSTR lpszShortPath, DWORD cchBuffer ); __declspec(dllimport) UINT __stdcall GetTempFileNameW( LPCWSTR lpPathName, LPCWSTR lpPrefixString, UINT uUnique, LPWSTR lpTempFileName ); __declspec(dllimport) BOOL __stdcall GetVolumeInformationByHandleW( HANDLE hFile, LPWSTR lpVolumeNameBuffer, DWORD nVolumeNameSize, LPDWORD lpVolumeSerialNumber, LPDWORD lpMaximumComponentLength, LPDWORD lpFileSystemFlags, LPWSTR lpFileSystemNameBuffer, DWORD nFileSystemNameSize ); __declspec(dllimport) BOOL __stdcall GetVolumeInformationW( LPCWSTR lpRootPathName, LPWSTR lpVolumeNameBuffer, DWORD nVolumeNameSize, LPDWORD lpVolumeSerialNumber, LPDWORD lpMaximumComponentLength, LPDWORD lpFileSystemFlags, LPWSTR lpFileSystemNameBuffer, DWORD nFileSystemNameSize ); __declspec(dllimport) BOOL __stdcall GetVolumePathNameW( LPCWSTR lpszFileName, LPWSTR lpszVolumePathName, DWORD cchBufferLength ); __declspec(dllimport) BOOL __stdcall LocalFileTimeToFileTime( const FILETIME* lpLocalFileTime, LPFILETIME lpFileTime ); __declspec(dllimport) BOOL __stdcall LockFile( HANDLE hFile, DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh, DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh ); __declspec(dllimport) BOOL __stdcall LockFileEx( HANDLE hFile, DWORD dwFlags, DWORD dwReserved, DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh, LPOVERLAPPED lpOverlapped ); __declspec(dllimport) DWORD __stdcall QueryDosDeviceW( LPCWSTR lpDeviceName, LPWSTR lpTargetPath, DWORD ucchMax ); __declspec(dllimport) BOOL __stdcall ReadFile( HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped ); __declspec(dllimport) BOOL __stdcall ReadFileEx( HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine ); __declspec(dllimport) BOOL __stdcall ReadFileScatter( HANDLE hFile, FILE_SEGMENT_ELEMENT aSegmentArray[], DWORD nNumberOfBytesToRead, LPDWORD lpReserved, LPOVERLAPPED lpOverlapped ); __declspec(dllimport) BOOL __stdcall RemoveDirectoryA( LPCSTR lpPathName ); __declspec(dllimport) BOOL __stdcall RemoveDirectoryW( LPCWSTR lpPathName ); __declspec(dllimport) BOOL __stdcall SetEndOfFile( HANDLE hFile ); __declspec(dllimport) BOOL __stdcall SetFileAttributesA( LPCSTR lpFileName, DWORD dwFileAttributes ); __declspec(dllimport) BOOL __stdcall SetFileAttributesW( LPCWSTR lpFileName, DWORD dwFileAttributes ); __declspec(dllimport) BOOL __stdcall SetFileInformationByHandle( HANDLE hFile, FILE_INFO_BY_HANDLE_CLASS FileInformationClass, LPVOID lpFileInformation, DWORD dwBufferSize ); __declspec(dllimport) DWORD __stdcall SetFilePointer( HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod ); __declspec(dllimport) BOOL __stdcall SetFilePointerEx( HANDLE hFile, LARGE_INTEGER liDistanceToMove, PLARGE_INTEGER lpNewFilePointer, DWORD dwMoveMethod ); __declspec(dllimport) BOOL __stdcall SetFileTime( HANDLE hFile, const FILETIME* lpCreationTime, const FILETIME* lpLastAccessTime, const FILETIME* lpLastWriteTime ); __declspec(dllimport) BOOL __stdcall SetFileValidData( HANDLE hFile, LONGLONG ValidDataLength ); __declspec(dllimport) BOOL __stdcall UnlockFile( HANDLE hFile, DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh, DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh ); __declspec(dllimport) BOOL __stdcall UnlockFileEx( HANDLE hFile, DWORD dwReserved, DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh, LPOVERLAPPED lpOverlapped ); __declspec(dllimport) BOOL __stdcall WriteFile( HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped ); __declspec(dllimport) BOOL __stdcall WriteFileEx( HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine ); __declspec(dllimport) BOOL __stdcall WriteFileGather( HANDLE hFile, FILE_SEGMENT_ELEMENT aSegmentArray[], DWORD nNumberOfBytesToWrite, LPDWORD lpReserved, LPOVERLAPPED lpOverlapped ); __declspec(dllimport) DWORD __stdcall GetTempPathW( DWORD nBufferLength, LPWSTR lpBuffer ); __declspec(dllimport) BOOL __stdcall GetVolumeNameForVolumeMountPointW( LPCWSTR lpszVolumeMountPoint, LPWSTR lpszVolumeName, DWORD cchBufferLength ); __declspec(dllimport) BOOL __stdcall GetVolumePathNamesForVolumeNameW( LPCWSTR lpszVolumeName, LPWCH lpszVolumePathNames, DWORD cchBufferLength, PDWORD lpcchReturnLength ); typedef struct _CREATEFILE2_EXTENDED_PARAMETERS { DWORD dwSize; DWORD dwFileAttributes; DWORD dwFileFlags; DWORD dwSecurityQosFlags; LPSECURITY_ATTRIBUTES lpSecurityAttributes; HANDLE hTemplateFile; } CREATEFILE2_EXTENDED_PARAMETERS, *PCREATEFILE2_EXTENDED_PARAMETERS, *LPCREATEFILE2_EXTENDED_PARAMETERS; __declspec(dllimport) HANDLE __stdcall CreateFile2( LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, DWORD dwCreationDisposition, LPCREATEFILE2_EXTENDED_PARAMETERS pCreateExParams ); __declspec(dllimport) BOOL __stdcall SetFileIoOverlappedRange( HANDLE FileHandle, PUCHAR OverlappedRangeStart, ULONG Length ); __declspec(dllimport) DWORD __stdcall GetCompressedFileSizeA( LPCSTR lpFileName, LPDWORD lpFileSizeHigh ); __declspec(dllimport) DWORD __stdcall GetCompressedFileSizeW( LPCWSTR lpFileName, LPDWORD lpFileSizeHigh ); typedef enum _STREAM_INFO_LEVELS { FindStreamInfoStandard, FindStreamInfoMaxInfoLevel } STREAM_INFO_LEVELS; typedef struct _WIN32_FIND_STREAM_DATA { LARGE_INTEGER StreamSize; WCHAR cStreamName[ 260 + 36 ]; } WIN32_FIND_STREAM_DATA, *PWIN32_FIND_STREAM_DATA; __declspec(dllimport) HANDLE __stdcall FindFirstStreamW( LPCWSTR lpFileName, STREAM_INFO_LEVELS InfoLevel, LPVOID lpFindStreamData, DWORD dwFlags ); __declspec(dllimport) BOOL __stdcall FindNextStreamW( HANDLE hFindStream, LPVOID lpFindStreamData ); __declspec(dllimport) BOOL __stdcall AreFileApisANSI( void ); __declspec(dllimport) DWORD __stdcall GetTempPathA( DWORD nBufferLength, LPSTR lpBuffer ); __declspec(dllimport) HANDLE __stdcall FindFirstFileNameW( LPCWSTR lpFileName, DWORD dwFlags, LPDWORD StringLength, PWSTR LinkName ); __declspec(dllimport) BOOL __stdcall FindNextFileNameW( HANDLE hFindStream, LPDWORD StringLength, PWSTR LinkName ); __declspec(dllimport) BOOL __stdcall GetVolumeInformationA( LPCSTR lpRootPathName, LPSTR lpVolumeNameBuffer, DWORD nVolumeNameSize, LPDWORD lpVolumeSerialNumber, LPDWORD lpMaximumComponentLength, LPDWORD lpFileSystemFlags, LPSTR lpFileSystemNameBuffer, DWORD nFileSystemNameSize ); __declspec(dllimport) UINT __stdcall GetTempFileNameA( LPCSTR lpPathName, LPCSTR lpPrefixString, UINT uUnique, LPSTR lpTempFileName ); __declspec(dllimport) void __stdcall SetFileApisToOEM( void ); __declspec(dllimport) void __stdcall SetFileApisToANSI( void ); } extern "C" { } extern "C" { __declspec(dllimport) BOOL __stdcall IsDebuggerPresent( void ); __declspec(dllimport) void __stdcall DebugBreak( void ); __declspec(dllimport) void __stdcall OutputDebugStringA( LPCSTR lpOutputString ); __declspec(dllimport) void __stdcall OutputDebugStringW( LPCWSTR lpOutputString ); __declspec(dllimport) BOOL __stdcall ContinueDebugEvent( DWORD dwProcessId, DWORD dwThreadId, DWORD dwContinueStatus ); __declspec(dllimport) BOOL __stdcall WaitForDebugEvent( LPDEBUG_EVENT lpDebugEvent, DWORD dwMilliseconds ); __declspec(dllimport) BOOL __stdcall DebugActiveProcess( DWORD dwProcessId ); __declspec(dllimport) BOOL __stdcall DebugActiveProcessStop( DWORD dwProcessId ); __declspec(dllimport) BOOL __stdcall CheckRemoteDebuggerPresent( HANDLE hProcess, PBOOL pbDebuggerPresent ); __declspec(dllimport) BOOL __stdcall WaitForDebugEventEx( LPDEBUG_EVENT lpDebugEvent, DWORD dwMilliseconds ); } extern "C" { __declspec(dllimport) PVOID __stdcall EncodePointer( PVOID Ptr ); __declspec(dllimport) PVOID __stdcall DecodePointer( PVOID Ptr ); __declspec(dllimport) PVOID __stdcall EncodeSystemPointer( PVOID Ptr ); __declspec(dllimport) PVOID __stdcall DecodeSystemPointer( PVOID Ptr ); __declspec(dllimport) HRESULT __stdcall EncodeRemotePointer( HANDLE ProcessHandle, PVOID Ptr, PVOID* EncodedPtr ); __declspec(dllimport) HRESULT __stdcall DecodeRemotePointer( HANDLE ProcessHandle, PVOID Ptr, PVOID* DecodedPtr ); __declspec(dllimport) BOOL __stdcall Beep( DWORD dwFreq, DWORD dwDuration ); } extern "C" { __declspec(dllimport) BOOL __stdcall CloseHandle( HANDLE hObject ); __declspec(dllimport) BOOL __stdcall DuplicateHandle( HANDLE hSourceProcessHandle, HANDLE hSourceHandle, HANDLE hTargetProcessHandle, LPHANDLE lpTargetHandle, DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwOptions ); __declspec(dllimport) BOOL __stdcall CompareObjectHandles( HANDLE hFirstObjectHandle, HANDLE hSecondObjectHandle ); __declspec(dllimport) BOOL __stdcall GetHandleInformation( HANDLE hObject, LPDWORD lpdwFlags ); __declspec(dllimport) BOOL __stdcall SetHandleInformation( HANDLE hObject, DWORD dwMask, DWORD dwFlags ); } extern "C" { typedef LONG (__stdcall *PTOP_LEVEL_EXCEPTION_FILTER)( struct _EXCEPTION_POINTERS *ExceptionInfo ); typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER; __declspec(dllimport) void __stdcall RaiseException( DWORD dwExceptionCode, DWORD dwExceptionFlags, DWORD nNumberOfArguments, const ULONG_PTR* lpArguments ); __declspec(dllimport) LONG __stdcall UnhandledExceptionFilter( struct _EXCEPTION_POINTERS* ExceptionInfo ); __declspec(dllimport) LPTOP_LEVEL_EXCEPTION_FILTER __stdcall SetUnhandledExceptionFilter( LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter ); __declspec(dllimport) DWORD __stdcall GetLastError( void ); __declspec(dllimport) void __stdcall SetLastError( DWORD dwErrCode ); __declspec(dllimport) UINT __stdcall GetErrorMode( void ); __declspec(dllimport) UINT __stdcall SetErrorMode( UINT uMode ); __declspec(dllimport) PVOID __stdcall AddVectoredExceptionHandler( ULONG First, PVECTORED_EXCEPTION_HANDLER Handler ); __declspec(dllimport) ULONG __stdcall RemoveVectoredExceptionHandler( PVOID Handle ); __declspec(dllimport) PVOID __stdcall AddVectoredContinueHandler( ULONG First, PVECTORED_EXCEPTION_HANDLER Handler ); __declspec(dllimport) ULONG __stdcall RemoveVectoredContinueHandler( PVOID Handle ); __declspec(dllimport) void __stdcall RaiseFailFastException( PEXCEPTION_RECORD pExceptionRecord, PCONTEXT pContextRecord, DWORD dwFlags ); __declspec(dllimport) void __stdcall FatalAppExitA( UINT uAction, LPCSTR lpMessageText ); __declspec(dllimport) void __stdcall FatalAppExitW( UINT uAction, LPCWSTR lpMessageText ); __declspec(dllimport) DWORD __stdcall GetThreadErrorMode( void ); __declspec(dllimport) BOOL __stdcall SetThreadErrorMode( DWORD dwNewMode, LPDWORD lpOldMode ); __declspec(dllimport) void __stdcall TerminateProcessOnMemoryExhaustion( SIZE_T FailedAllocationSize ); } extern "C" { __declspec(dllimport) DWORD __stdcall FlsAlloc( PFLS_CALLBACK_FUNCTION lpCallback ); __declspec(dllimport) PVOID __stdcall FlsGetValue( DWORD dwFlsIndex ); __declspec(dllimport) BOOL __stdcall FlsSetValue( DWORD dwFlsIndex, PVOID lpFlsData ); __declspec(dllimport) BOOL __stdcall FlsFree( DWORD dwFlsIndex ); __declspec(dllimport) BOOL __stdcall IsThreadAFiber( void ); } extern "C" { __declspec(dllimport) BOOL __stdcall CreatePipe( PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize ); __declspec(dllimport) BOOL __stdcall ConnectNamedPipe( HANDLE hNamedPipe, LPOVERLAPPED lpOverlapped ); __declspec(dllimport) BOOL __stdcall DisconnectNamedPipe( HANDLE hNamedPipe ); __declspec(dllimport) BOOL __stdcall SetNamedPipeHandleState( HANDLE hNamedPipe, LPDWORD lpMode, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout ); __declspec(dllimport) BOOL __stdcall PeekNamedPipe( HANDLE hNamedPipe, LPVOID lpBuffer, DWORD nBufferSize, LPDWORD lpBytesRead, LPDWORD lpTotalBytesAvail, LPDWORD lpBytesLeftThisMessage ); __declspec(dllimport) BOOL __stdcall TransactNamedPipe( HANDLE hNamedPipe, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead, LPOVERLAPPED lpOverlapped ); __declspec(dllimport) HANDLE __stdcall CreateNamedPipeW( LPCWSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); __declspec(dllimport) BOOL __stdcall WaitNamedPipeW( LPCWSTR lpNamedPipeName, DWORD nTimeOut ); __declspec(dllimport) BOOL __stdcall GetNamedPipeClientComputerNameW( HANDLE Pipe, LPWSTR ClientComputerName, ULONG ClientComputerNameLength ); __declspec(dllimport) BOOL __stdcall ImpersonateNamedPipeClient( HANDLE hNamedPipe ); __declspec(dllimport) BOOL __stdcall GetNamedPipeInfo( HANDLE hNamedPipe, LPDWORD lpFlags, LPDWORD lpOutBufferSize, LPDWORD lpInBufferSize, LPDWORD lpMaxInstances ); __declspec(dllimport) BOOL __stdcall GetNamedPipeHandleStateW( HANDLE hNamedPipe, LPDWORD lpState, LPDWORD lpCurInstances, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout, LPWSTR lpUserName, DWORD nMaxUserNameSize ); __declspec(dllimport) BOOL __stdcall CallNamedPipeW( LPCWSTR lpNamedPipeName, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead, DWORD nTimeOut ); } extern "C" { __declspec(dllimport) BOOL __stdcall QueryPerformanceCounter( LARGE_INTEGER* lpPerformanceCount ); __declspec(dllimport) BOOL __stdcall QueryPerformanceFrequency( LARGE_INTEGER* lpFrequency ); } extern "C" { #pragma warning(push) #pragma warning(disable: 4820) typedef struct _HEAP_SUMMARY { DWORD cb; SIZE_T cbAllocated; SIZE_T cbCommitted; SIZE_T cbReserved; SIZE_T cbMaxReserve; } HEAP_SUMMARY, *PHEAP_SUMMARY; typedef PHEAP_SUMMARY LPHEAP_SUMMARY; __declspec(dllimport) HANDLE __stdcall HeapCreate( DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize ); __declspec(dllimport) BOOL __stdcall HeapDestroy( HANDLE hHeap ); __declspec(dllimport) __declspec(allocator) LPVOID __stdcall HeapAlloc( HANDLE hHeap, DWORD dwFlags, SIZE_T dwBytes ); __declspec(dllimport) __declspec(allocator) LPVOID __stdcall HeapReAlloc( HANDLE hHeap, DWORD dwFlags, LPVOID lpMem, SIZE_T dwBytes ); __declspec(dllimport) BOOL __stdcall HeapFree( HANDLE hHeap, DWORD dwFlags, LPVOID lpMem ); __declspec(dllimport) SIZE_T __stdcall HeapSize( HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem ); __declspec(dllimport) HANDLE __stdcall GetProcessHeap( void ); __declspec(dllimport) SIZE_T __stdcall HeapCompact( HANDLE hHeap, DWORD dwFlags ); __declspec(dllimport) BOOL __stdcall HeapSetInformation( HANDLE HeapHandle, HEAP_INFORMATION_CLASS HeapInformationClass, PVOID HeapInformation, SIZE_T HeapInformationLength ); __declspec(dllimport) BOOL __stdcall HeapValidate( HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem ); BOOL __stdcall HeapSummary( HANDLE hHeap, DWORD dwFlags, LPHEAP_SUMMARY lpSummary ); __declspec(dllimport) DWORD __stdcall GetProcessHeaps( DWORD NumberOfHeaps, PHANDLE ProcessHeaps ); __declspec(dllimport) BOOL __stdcall HeapLock( HANDLE hHeap ); __declspec(dllimport) BOOL __stdcall HeapUnlock( HANDLE hHeap ); __declspec(dllimport) BOOL __stdcall HeapWalk( HANDLE hHeap, LPPROCESS_HEAP_ENTRY lpEntry ); __declspec(dllimport) BOOL __stdcall HeapQueryInformation( HANDLE HeapHandle, HEAP_INFORMATION_CLASS HeapInformationClass, PVOID HeapInformation, SIZE_T HeapInformationLength, PSIZE_T ReturnLength ); #pragma warning(pop) } extern "C" { __declspec(dllimport) HANDLE __stdcall CreateIoCompletionPort( HANDLE FileHandle, HANDLE ExistingCompletionPort, ULONG_PTR CompletionKey, DWORD NumberOfConcurrentThreads ); __declspec(dllimport) BOOL __stdcall GetQueuedCompletionStatus( HANDLE CompletionPort, LPDWORD lpNumberOfBytesTransferred, PULONG_PTR lpCompletionKey, LPOVERLAPPED* lpOverlapped, DWORD dwMilliseconds ); __declspec(dllimport) BOOL __stdcall GetQueuedCompletionStatusEx( HANDLE CompletionPort, LPOVERLAPPED_ENTRY lpCompletionPortEntries, ULONG ulCount, PULONG ulNumEntriesRemoved, DWORD dwMilliseconds, BOOL fAlertable ); __declspec(dllimport) BOOL __stdcall PostQueuedCompletionStatus( HANDLE CompletionPort, DWORD dwNumberOfBytesTransferred, ULONG_PTR dwCompletionKey, LPOVERLAPPED lpOverlapped ); __declspec(dllimport) BOOL __stdcall DeviceIoControl( HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped ); __declspec(dllimport) BOOL __stdcall GetOverlappedResult( HANDLE hFile, LPOVERLAPPED lpOverlapped, LPDWORD lpNumberOfBytesTransferred, BOOL bWait ); __declspec(dllimport) BOOL __stdcall CancelIoEx( HANDLE hFile, LPOVERLAPPED lpOverlapped ); __declspec(dllimport) BOOL __stdcall CancelIo( HANDLE hFile ); __declspec(dllimport) BOOL __stdcall GetOverlappedResultEx( HANDLE hFile, LPOVERLAPPED lpOverlapped, LPDWORD lpNumberOfBytesTransferred, DWORD dwMilliseconds, BOOL bAlertable ); __declspec(dllimport) BOOL __stdcall CancelSynchronousIo( HANDLE hThread ); } extern "C" { typedef RTL_SRWLOCK SRWLOCK, *PSRWLOCK; __declspec(dllimport) void __stdcall InitializeSRWLock( PSRWLOCK SRWLock ); __declspec(dllimport) void __stdcall ReleaseSRWLockExclusive( PSRWLOCK SRWLock ); __declspec(dllimport) void __stdcall ReleaseSRWLockShared( PSRWLOCK SRWLock ); __declspec(dllimport) void __stdcall AcquireSRWLockExclusive( PSRWLOCK SRWLock ); __declspec(dllimport) void __stdcall AcquireSRWLockShared( PSRWLOCK SRWLock ); __declspec(dllimport) BOOLEAN __stdcall TryAcquireSRWLockExclusive( PSRWLOCK SRWLock ); __declspec(dllimport) BOOLEAN __stdcall TryAcquireSRWLockShared( PSRWLOCK SRWLock ); __declspec(dllimport) void __stdcall InitializeCriticalSection( LPCRITICAL_SECTION lpCriticalSection ); __declspec(dllimport) void __stdcall EnterCriticalSection( LPCRITICAL_SECTION lpCriticalSection ); __declspec(dllimport) void __stdcall LeaveCriticalSection( LPCRITICAL_SECTION lpCriticalSection ); __declspec(dllimport) BOOL __stdcall InitializeCriticalSectionAndSpinCount( LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount ); __declspec(dllimport) BOOL __stdcall InitializeCriticalSectionEx( LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount, DWORD Flags ); __declspec(dllimport) DWORD __stdcall SetCriticalSectionSpinCount( LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount ); __declspec(dllimport) BOOL __stdcall TryEnterCriticalSection( LPCRITICAL_SECTION lpCriticalSection ); __declspec(dllimport) void __stdcall DeleteCriticalSection( LPCRITICAL_SECTION lpCriticalSection ); typedef RTL_RUN_ONCE INIT_ONCE; typedef PRTL_RUN_ONCE PINIT_ONCE; typedef PRTL_RUN_ONCE LPINIT_ONCE; typedef BOOL (__stdcall *PINIT_ONCE_FN) ( PINIT_ONCE InitOnce, PVOID Parameter, PVOID *Context ); __declspec(dllimport) void __stdcall InitOnceInitialize( PINIT_ONCE InitOnce ); __declspec(dllimport) BOOL __stdcall InitOnceExecuteOnce( PINIT_ONCE InitOnce, PINIT_ONCE_FN InitFn, PVOID Parameter, LPVOID* Context ); __declspec(dllimport) BOOL __stdcall InitOnceBeginInitialize( LPINIT_ONCE lpInitOnce, DWORD dwFlags, PBOOL fPending, LPVOID* lpContext ); __declspec(dllimport) BOOL __stdcall InitOnceComplete( LPINIT_ONCE lpInitOnce, DWORD dwFlags, LPVOID lpContext ); typedef RTL_CONDITION_VARIABLE CONDITION_VARIABLE, *PCONDITION_VARIABLE; __declspec(dllimport) void __stdcall InitializeConditionVariable( PCONDITION_VARIABLE ConditionVariable ); __declspec(dllimport) void __stdcall WakeConditionVariable( PCONDITION_VARIABLE ConditionVariable ); __declspec(dllimport) void __stdcall WakeAllConditionVariable( PCONDITION_VARIABLE ConditionVariable ); __declspec(dllimport) BOOL __stdcall SleepConditionVariableCS( PCONDITION_VARIABLE ConditionVariable, PCRITICAL_SECTION CriticalSection, DWORD dwMilliseconds ); __declspec(dllimport) BOOL __stdcall SleepConditionVariableSRW( PCONDITION_VARIABLE ConditionVariable, PSRWLOCK SRWLock, DWORD dwMilliseconds, ULONG Flags ); __declspec(dllimport) BOOL __stdcall SetEvent( HANDLE hEvent ); __declspec(dllimport) BOOL __stdcall ResetEvent( HANDLE hEvent ); __declspec(dllimport) BOOL __stdcall ReleaseSemaphore( HANDLE hSemaphore, LONG lReleaseCount, LPLONG lpPreviousCount ); __declspec(dllimport) BOOL __stdcall ReleaseMutex( HANDLE hMutex ); __declspec(dllimport) DWORD __stdcall WaitForSingleObject( HANDLE hHandle, DWORD dwMilliseconds ); __declspec(dllimport) DWORD __stdcall SleepEx( DWORD dwMilliseconds, BOOL bAlertable ); __declspec(dllimport) DWORD __stdcall WaitForSingleObjectEx( HANDLE hHandle, DWORD dwMilliseconds, BOOL bAlertable ); __declspec(dllimport) DWORD __stdcall WaitForMultipleObjectsEx( DWORD nCount, const HANDLE* lpHandles, BOOL bWaitAll, DWORD dwMilliseconds, BOOL bAlertable ); __declspec(dllimport) HANDLE __stdcall CreateMutexA( LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCSTR lpName ); __declspec(dllimport) HANDLE __stdcall CreateMutexW( LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCWSTR lpName ); __declspec(dllimport) HANDLE __stdcall OpenMutexW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName ); __declspec(dllimport) HANDLE __stdcall CreateEventA( LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName ); __declspec(dllimport) HANDLE __stdcall CreateEventW( LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCWSTR lpName ); __declspec(dllimport) HANDLE __stdcall OpenEventA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName ); __declspec(dllimport) HANDLE __stdcall OpenEventW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName ); __declspec(dllimport) HANDLE __stdcall OpenSemaphoreW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName ); typedef void (__stdcall *PTIMERAPCROUTINE)( LPVOID lpArgToCompletionRoutine, DWORD dwTimerLowValue, DWORD dwTimerHighValue ); __declspec(dllimport) HANDLE __stdcall OpenWaitableTimerW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpTimerName ); BOOL __stdcall SetWaitableTimerEx( HANDLE hTimer, const LARGE_INTEGER* lpDueTime, LONG lPeriod, PTIMERAPCROUTINE pfnCompletionRoutine, LPVOID lpArgToCompletionRoutine, PREASON_CONTEXT WakeContext, ULONG TolerableDelay ); __declspec(dllimport) BOOL __stdcall SetWaitableTimer( HANDLE hTimer, const LARGE_INTEGER* lpDueTime, LONG lPeriod, PTIMERAPCROUTINE pfnCompletionRoutine, LPVOID lpArgToCompletionRoutine, BOOL fResume ); __declspec(dllimport) BOOL __stdcall CancelWaitableTimer( HANDLE hTimer ); __declspec(dllimport) HANDLE __stdcall CreateMutexExA( LPSECURITY_ATTRIBUTES lpMutexAttributes, LPCSTR lpName, DWORD dwFlags, DWORD dwDesiredAccess ); __declspec(dllimport) HANDLE __stdcall CreateMutexExW( LPSECURITY_ATTRIBUTES lpMutexAttributes, LPCWSTR lpName, DWORD dwFlags, DWORD dwDesiredAccess ); __declspec(dllimport) HANDLE __stdcall CreateEventExA( LPSECURITY_ATTRIBUTES lpEventAttributes, LPCSTR lpName, DWORD dwFlags, DWORD dwDesiredAccess ); __declspec(dllimport) HANDLE __stdcall CreateEventExW( LPSECURITY_ATTRIBUTES lpEventAttributes, LPCWSTR lpName, DWORD dwFlags, DWORD dwDesiredAccess ); __declspec(dllimport) HANDLE __stdcall CreateSemaphoreExW( LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCWSTR lpName, DWORD dwFlags, DWORD dwDesiredAccess ); __declspec(dllimport) HANDLE __stdcall CreateWaitableTimerExW( LPSECURITY_ATTRIBUTES lpTimerAttributes, LPCWSTR lpTimerName, DWORD dwFlags, DWORD dwDesiredAccess ); typedef RTL_BARRIER SYNCHRONIZATION_BARRIER; typedef PRTL_BARRIER PSYNCHRONIZATION_BARRIER; typedef PRTL_BARRIER LPSYNCHRONIZATION_BARRIER; BOOL __stdcall EnterSynchronizationBarrier( LPSYNCHRONIZATION_BARRIER lpBarrier, DWORD dwFlags ); BOOL __stdcall InitializeSynchronizationBarrier( LPSYNCHRONIZATION_BARRIER lpBarrier, LONG lTotalThreads, LONG lSpinCount ); BOOL __stdcall DeleteSynchronizationBarrier( LPSYNCHRONIZATION_BARRIER lpBarrier ); __declspec(dllimport) void __stdcall Sleep( DWORD dwMilliseconds ); BOOL __stdcall WaitOnAddress( volatile void* Address, PVOID CompareAddress, SIZE_T AddressSize, DWORD dwMilliseconds ); void __stdcall WakeByAddressSingle( PVOID Address ); void __stdcall WakeByAddressAll( PVOID Address ); __declspec(dllimport) DWORD __stdcall SignalObjectAndWait( HANDLE hObjectToSignal, HANDLE hObjectToWaitOn, DWORD dwMilliseconds, BOOL bAlertable ); __declspec(dllimport) DWORD __stdcall WaitForMultipleObjects( DWORD nCount, const HANDLE* lpHandles, BOOL bWaitAll, DWORD dwMilliseconds ); __declspec(dllimport) HANDLE __stdcall CreateSemaphoreW( LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCWSTR lpName ); __declspec(dllimport) HANDLE __stdcall CreateWaitableTimerW( LPSECURITY_ATTRIBUTES lpTimerAttributes, BOOL bManualReset, LPCWSTR lpTimerName ); } extern "C" { __declspec(dllimport) void __stdcall InitializeSListHead( PSLIST_HEADER ListHead ); __declspec(dllimport) PSLIST_ENTRY __stdcall InterlockedPopEntrySList( PSLIST_HEADER ListHead ); __declspec(dllimport) PSLIST_ENTRY __stdcall InterlockedPushEntrySList( PSLIST_HEADER ListHead, PSLIST_ENTRY ListEntry ); __declspec(dllimport) PSLIST_ENTRY __stdcall InterlockedPushListSListEx( PSLIST_HEADER ListHead, PSLIST_ENTRY List, PSLIST_ENTRY ListEnd, ULONG Count ); __declspec(dllimport) PSLIST_ENTRY __stdcall InterlockedFlushSList( PSLIST_HEADER ListHead ); __declspec(dllimport) USHORT __stdcall QueryDepthSList( PSLIST_HEADER ListHead ); } extern "C" { typedef struct _PROCESS_INFORMATION { HANDLE hProcess; HANDLE hThread; DWORD dwProcessId; DWORD dwThreadId; } PROCESS_INFORMATION, *PPROCESS_INFORMATION, *LPPROCESS_INFORMATION; typedef struct _STARTUPINFOA { DWORD cb; LPSTR lpReserved; LPSTR lpDesktop; LPSTR lpTitle; DWORD dwX; DWORD dwY; DWORD dwXSize; DWORD dwYSize; DWORD dwXCountChars; DWORD dwYCountChars; DWORD dwFillAttribute; DWORD dwFlags; WORD wShowWindow; WORD cbReserved2; LPBYTE lpReserved2; HANDLE hStdInput; HANDLE hStdOutput; HANDLE hStdError; } STARTUPINFOA, *LPSTARTUPINFOA; typedef struct _STARTUPINFOW { DWORD cb; LPWSTR lpReserved; LPWSTR lpDesktop; LPWSTR lpTitle; DWORD dwX; DWORD dwY; DWORD dwXSize; DWORD dwYSize; DWORD dwXCountChars; DWORD dwYCountChars; DWORD dwFillAttribute; DWORD dwFlags; WORD wShowWindow; WORD cbReserved2; LPBYTE lpReserved2; HANDLE hStdInput; HANDLE hStdOutput; HANDLE hStdError; } STARTUPINFOW, *LPSTARTUPINFOW; typedef STARTUPINFOW STARTUPINFO; typedef LPSTARTUPINFOW LPSTARTUPINFO; __declspec(dllimport) DWORD __stdcall QueueUserAPC( PAPCFUNC pfnAPC, HANDLE hThread, ULONG_PTR dwData ); __declspec(dllimport) BOOL __stdcall GetProcessTimes( HANDLE hProcess, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime ); __declspec(dllimport) HANDLE __stdcall GetCurrentProcess( void ); __declspec(dllimport) DWORD __stdcall GetCurrentProcessId( void ); __declspec(dllimport) __declspec(noreturn) void __stdcall ExitProcess( UINT uExitCode ); __declspec(dllimport) BOOL __stdcall TerminateProcess( HANDLE hProcess, UINT uExitCode ); __declspec(dllimport) BOOL __stdcall GetExitCodeProcess( HANDLE hProcess, LPDWORD lpExitCode ); __declspec(dllimport) BOOL __stdcall SwitchToThread( void ); __declspec(dllimport) HANDLE __stdcall CreateThread( LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId ); __declspec(dllimport) HANDLE __stdcall CreateRemoteThread( HANDLE hProcess, LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId ); __declspec(dllimport) HANDLE __stdcall GetCurrentThread( void ); __declspec(dllimport) DWORD __stdcall GetCurrentThreadId( void ); __declspec(dllimport) HANDLE __stdcall OpenThread( DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwThreadId ); __declspec(dllimport) BOOL __stdcall SetThreadPriority( HANDLE hThread, int nPriority ); __declspec(dllimport) BOOL __stdcall SetThreadPriorityBoost( HANDLE hThread, BOOL bDisablePriorityBoost ); __declspec(dllimport) BOOL __stdcall GetThreadPriorityBoost( HANDLE hThread, PBOOL pDisablePriorityBoost ); __declspec(dllimport) int __stdcall GetThreadPriority( HANDLE hThread ); __declspec(dllimport) __declspec(noreturn) void __stdcall ExitThread( DWORD dwExitCode ); __declspec(dllimport) BOOL __stdcall TerminateThread( HANDLE hThread, DWORD dwExitCode ); __declspec(dllimport) BOOL __stdcall GetExitCodeThread( HANDLE hThread, LPDWORD lpExitCode ); __declspec(dllimport) DWORD __stdcall SuspendThread( HANDLE hThread ); __declspec(dllimport) DWORD __stdcall ResumeThread( HANDLE hThread ); __declspec(dllimport) DWORD __stdcall TlsAlloc( void ); __declspec(dllimport) LPVOID __stdcall TlsGetValue( DWORD dwTlsIndex ); __declspec(dllimport) BOOL __stdcall TlsSetValue( DWORD dwTlsIndex, LPVOID lpTlsValue ); __declspec(dllimport) BOOL __stdcall TlsFree( DWORD dwTlsIndex ); __declspec(dllimport) BOOL __stdcall CreateProcessA( LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ); __declspec(dllimport) BOOL __stdcall CreateProcessW( LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ); __declspec(dllimport) BOOL __stdcall SetProcessShutdownParameters( DWORD dwLevel, DWORD dwFlags ); __declspec(dllimport) DWORD __stdcall GetProcessVersion( DWORD ProcessId ); __declspec(dllimport) void __stdcall GetStartupInfoW( LPSTARTUPINFOW lpStartupInfo ); __declspec(dllimport) BOOL __stdcall CreateProcessAsUserW( HANDLE hToken, LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ); __forceinline HANDLE GetCurrentProcessToken ( void ) { return (HANDLE)(LONG_PTR) -4; } __forceinline HANDLE GetCurrentThreadToken ( void ) { return (HANDLE)(LONG_PTR) -5; } __forceinline HANDLE GetCurrentThreadEffectiveToken ( void ) { return (HANDLE)(LONG_PTR) -6; } __declspec(dllimport) BOOL __stdcall SetThreadToken( PHANDLE Thread, HANDLE Token ); __declspec(dllimport) BOOL __stdcall OpenProcessToken( HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle ); __declspec(dllimport) BOOL __stdcall OpenThreadToken( HANDLE ThreadHandle, DWORD DesiredAccess, BOOL OpenAsSelf, PHANDLE TokenHandle ); __declspec(dllimport) BOOL __stdcall SetPriorityClass( HANDLE hProcess, DWORD dwPriorityClass ); __declspec(dllimport) DWORD __stdcall GetPriorityClass( HANDLE hProcess ); __declspec(dllimport) BOOL __stdcall SetThreadStackGuarantee( PULONG StackSizeInBytes ); __declspec(dllimport) BOOL __stdcall ProcessIdToSessionId( DWORD dwProcessId, DWORD* pSessionId ); typedef struct _PROC_THREAD_ATTRIBUTE_LIST *PPROC_THREAD_ATTRIBUTE_LIST, *LPPROC_THREAD_ATTRIBUTE_LIST; __declspec(dllimport) DWORD __stdcall GetProcessId( HANDLE Process ); __declspec(dllimport) DWORD __stdcall GetThreadId( HANDLE Thread ); __declspec(dllimport) void __stdcall FlushProcessWriteBuffers( void ); __declspec(dllimport) DWORD __stdcall GetProcessIdOfThread( HANDLE Thread ); __declspec(dllimport) BOOL __stdcall InitializeProcThreadAttributeList( LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList, DWORD dwAttributeCount, DWORD dwFlags, PSIZE_T lpSize ); __declspec(dllimport) void __stdcall DeleteProcThreadAttributeList( LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList ); __declspec(dllimport) BOOL __stdcall SetProcessAffinityUpdateMode( HANDLE hProcess, DWORD dwFlags ); __declspec(dllimport) BOOL __stdcall QueryProcessAffinityUpdateMode( HANDLE hProcess, LPDWORD lpdwFlags ); __declspec(dllimport) BOOL __stdcall UpdateProcThreadAttribute( LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList, DWORD dwFlags, DWORD_PTR Attribute, PVOID lpValue, SIZE_T cbSize, PVOID lpPreviousValue, PSIZE_T lpReturnSize ); __declspec(dllimport) HANDLE __stdcall CreateRemoteThreadEx( HANDLE hProcess, LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList, LPDWORD lpThreadId ); __declspec(dllimport) void __stdcall GetCurrentThreadStackLimits( PULONG_PTR LowLimit, PULONG_PTR HighLimit ); __declspec(dllimport) BOOL __stdcall GetThreadContext( HANDLE hThread, LPCONTEXT lpContext ); __declspec(dllimport) BOOL __stdcall GetProcessMitigationPolicy( HANDLE hProcess, PROCESS_MITIGATION_POLICY MitigationPolicy, PVOID lpBuffer, SIZE_T dwLength ); __declspec(dllimport) BOOL __stdcall SetThreadContext( HANDLE hThread, const CONTEXT* lpContext ); __declspec(dllimport) BOOL __stdcall SetProcessMitigationPolicy( PROCESS_MITIGATION_POLICY MitigationPolicy, PVOID lpBuffer, SIZE_T dwLength ); __declspec(dllimport) BOOL __stdcall FlushInstructionCache( HANDLE hProcess, LPCVOID lpBaseAddress, SIZE_T dwSize ); __declspec(dllimport) BOOL __stdcall GetThreadTimes( HANDLE hThread, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime ); __declspec(dllimport) HANDLE __stdcall OpenProcess( DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId ); __declspec(dllimport) BOOL __stdcall IsProcessorFeaturePresent( DWORD ProcessorFeature ); __declspec(dllimport) BOOL __stdcall GetProcessHandleCount( HANDLE hProcess, PDWORD pdwHandleCount ); __declspec(dllimport) DWORD __stdcall GetCurrentProcessorNumber( void ); __declspec(dllimport) BOOL __stdcall SetThreadIdealProcessorEx( HANDLE hThread, PPROCESSOR_NUMBER lpIdealProcessor, PPROCESSOR_NUMBER lpPreviousIdealProcessor ); __declspec(dllimport) BOOL __stdcall GetThreadIdealProcessorEx( HANDLE hThread, PPROCESSOR_NUMBER lpIdealProcessor ); __declspec(dllimport) void __stdcall GetCurrentProcessorNumberEx( PPROCESSOR_NUMBER ProcNumber ); __declspec(dllimport) BOOL __stdcall GetProcessPriorityBoost( HANDLE hProcess, PBOOL pDisablePriorityBoost ); __declspec(dllimport) BOOL __stdcall SetProcessPriorityBoost( HANDLE hProcess, BOOL bDisablePriorityBoost ); __declspec(dllimport) BOOL __stdcall GetThreadIOPendingFlag( HANDLE hThread, PBOOL lpIOIsPending ); __declspec(dllimport) BOOL __stdcall GetSystemTimes( PFILETIME lpIdleTime, PFILETIME lpKernelTime, PFILETIME lpUserTime ); typedef enum _THREAD_INFORMATION_CLASS { ThreadMemoryPriority, ThreadAbsoluteCpuPriority, ThreadDynamicCodePolicy, ThreadPowerThrottling, ThreadInformationClassMax } THREAD_INFORMATION_CLASS; typedef struct _MEMORY_PRIORITY_INFORMATION { ULONG MemoryPriority; } MEMORY_PRIORITY_INFORMATION, *PMEMORY_PRIORITY_INFORMATION; __declspec(dllimport) BOOL __stdcall GetThreadInformation( HANDLE hThread, THREAD_INFORMATION_CLASS ThreadInformationClass, LPVOID ThreadInformation, DWORD ThreadInformationSize ); __declspec(dllimport) BOOL __stdcall SetThreadInformation( HANDLE hThread, THREAD_INFORMATION_CLASS ThreadInformationClass, LPVOID ThreadInformation, DWORD ThreadInformationSize ); typedef struct _THREAD_POWER_THROTTLING_STATE { ULONG Version; ULONG ControlMask; ULONG StateMask; } THREAD_POWER_THROTTLING_STATE; __declspec(dllimport) BOOL __stdcall IsProcessCritical( HANDLE hProcess, PBOOL Critical ); __declspec(dllimport) BOOL __stdcall SetProtectedPolicy( LPCGUID PolicyGuid, ULONG_PTR PolicyValue, PULONG_PTR OldPolicyValue ); __declspec(dllimport) BOOL __stdcall QueryProtectedPolicy( LPCGUID PolicyGuid, PULONG_PTR PolicyValue ); __declspec(dllimport) DWORD __stdcall SetThreadIdealProcessor( HANDLE hThread, DWORD dwIdealProcessor ); typedef enum _PROCESS_INFORMATION_CLASS { ProcessMemoryPriority, ProcessMemoryExhaustionInfo, ProcessAppMemoryInfo, ProcessInPrivateInfo, ProcessPowerThrottling, ProcessReservedValue1, ProcessTelemetryCoverageInfo, ProcessProtectionLevelInfo, ProcessLeapSecondInfo, ProcessInformationClassMax } PROCESS_INFORMATION_CLASS; typedef struct _APP_MEMORY_INFORMATION { ULONG64 AvailableCommit; ULONG64 PrivateCommitUsage; ULONG64 PeakPrivateCommitUsage; ULONG64 TotalCommitUsage; } APP_MEMORY_INFORMATION, *PAPP_MEMORY_INFORMATION; typedef enum _PROCESS_MEMORY_EXHAUSTION_TYPE { PMETypeFailFastOnCommitFailure, PMETypeMax } PROCESS_MEMORY_EXHAUSTION_TYPE, *PPROCESS_MEMORY_EXHAUSTION_TYPE; typedef struct _PROCESS_MEMORY_EXHAUSTION_INFO { USHORT Version; USHORT Reserved; PROCESS_MEMORY_EXHAUSTION_TYPE Type; ULONG_PTR Value; } PROCESS_MEMORY_EXHAUSTION_INFO, *PPROCESS_MEMORY_EXHAUSTION_INFO; typedef struct _PROCESS_POWER_THROTTLING_STATE { ULONG Version; ULONG ControlMask; ULONG StateMask; } PROCESS_POWER_THROTTLING_STATE, *PPROCESS_POWER_THROTTLING_STATE; typedef struct PROCESS_PROTECTION_LEVEL_INFORMATION { DWORD ProtectionLevel; } PROCESS_PROTECTION_LEVEL_INFORMATION; typedef struct _PROCESS_LEAP_SECOND_INFO { ULONG Flags; ULONG Reserved; } PROCESS_LEAP_SECOND_INFO, *PPROCESS_LEAP_SECOND_INFO; __declspec(dllimport) BOOL __stdcall SetProcessInformation( HANDLE hProcess, PROCESS_INFORMATION_CLASS ProcessInformationClass, LPVOID ProcessInformation, DWORD ProcessInformationSize ); __declspec(dllimport) BOOL __stdcall GetProcessInformation( HANDLE hProcess, PROCESS_INFORMATION_CLASS ProcessInformationClass, LPVOID ProcessInformation, DWORD ProcessInformationSize ); BOOL __stdcall GetSystemCpuSetInformation( PSYSTEM_CPU_SET_INFORMATION Information, ULONG BufferLength, PULONG ReturnedLength, HANDLE Process, ULONG Flags ); BOOL __stdcall GetProcessDefaultCpuSets( HANDLE Process, PULONG CpuSetIds, ULONG CpuSetIdCount, PULONG RequiredIdCount ); BOOL __stdcall SetProcessDefaultCpuSets( HANDLE Process, const ULONG* CpuSetIds, ULONG CpuSetIdCount ); BOOL __stdcall GetThreadSelectedCpuSets( HANDLE Thread, PULONG CpuSetIds, ULONG CpuSetIdCount, PULONG RequiredIdCount ); BOOL __stdcall SetThreadSelectedCpuSets( HANDLE Thread, const ULONG* CpuSetIds, ULONG CpuSetIdCount ); __declspec(dllimport) BOOL __stdcall CreateProcessAsUserA( HANDLE hToken, LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ); __declspec(dllimport) BOOL __stdcall GetProcessShutdownParameters( LPDWORD lpdwLevel, LPDWORD lpdwFlags ); __declspec(dllimport) HRESULT __stdcall SetThreadDescription( HANDLE hThread, PCWSTR lpThreadDescription ); __declspec(dllimport) HRESULT __stdcall GetThreadDescription( HANDLE hThread, PWSTR* ppszThreadDescription ); } #pragma warning(disable: 4514) #pragma warning(disable: 4103) #pragma warning(push) #pragma warning(disable: 4001) #pragma warning(disable: 4201) #pragma warning(disable: 4214) extern "C" { typedef struct _SYSTEM_INFO { union { DWORD dwOemId; struct { WORD wProcessorArchitecture; WORD wReserved; } ; } ; DWORD dwPageSize; LPVOID lpMinimumApplicationAddress; LPVOID lpMaximumApplicationAddress; DWORD_PTR dwActiveProcessorMask; DWORD dwNumberOfProcessors; DWORD dwProcessorType; DWORD dwAllocationGranularity; WORD wProcessorLevel; WORD wProcessorRevision; } SYSTEM_INFO, *LPSYSTEM_INFO; typedef struct _MEMORYSTATUSEX { DWORD dwLength; DWORD dwMemoryLoad; DWORDLONG ullTotalPhys; DWORDLONG ullAvailPhys; DWORDLONG ullTotalPageFile; DWORDLONG ullAvailPageFile; DWORDLONG ullTotalVirtual; DWORDLONG ullAvailVirtual; DWORDLONG ullAvailExtendedVirtual; } MEMORYSTATUSEX, *LPMEMORYSTATUSEX; __declspec(dllimport) BOOL __stdcall GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpBuffer ); __declspec(dllimport) void __stdcall GetSystemInfo( LPSYSTEM_INFO lpSystemInfo ); __declspec(dllimport) void __stdcall GetSystemTime( LPSYSTEMTIME lpSystemTime ); __declspec(dllimport) void __stdcall GetSystemTimeAsFileTime( LPFILETIME lpSystemTimeAsFileTime ); __declspec(dllimport) void __stdcall GetLocalTime( LPSYSTEMTIME lpSystemTime ); __declspec(dllimport) BOOL __stdcall GetSystemLeapSecondInformation( PBOOL Enabled, PDWORD Flags ); __declspec(deprecated) __declspec(dllimport) DWORD __stdcall GetVersion( void ); __declspec(dllimport) BOOL __stdcall SetLocalTime( const SYSTEMTIME* lpSystemTime ); __declspec(dllimport) DWORD __stdcall GetTickCount( void ); __declspec(dllimport) ULONGLONG __stdcall GetTickCount64( void ); __declspec(dllimport) BOOL __stdcall GetSystemTimeAdjustment( PDWORD lpTimeAdjustment, PDWORD lpTimeIncrement, PBOOL lpTimeAdjustmentDisabled ); __declspec(dllimport) BOOL __stdcall GetSystemTimeAdjustmentPrecise( PDWORD64 lpTimeAdjustment, PDWORD64 lpTimeIncrement, PBOOL lpTimeAdjustmentDisabled ); __declspec(dllimport) UINT __stdcall GetSystemDirectoryA( LPSTR lpBuffer, UINT uSize ); __declspec(dllimport) UINT __stdcall GetSystemDirectoryW( LPWSTR lpBuffer, UINT uSize ); __declspec(dllimport) UINT __stdcall GetWindowsDirectoryA( LPSTR lpBuffer, UINT uSize ); __declspec(dllimport) UINT __stdcall GetWindowsDirectoryW( LPWSTR lpBuffer, UINT uSize ); __declspec(dllimport) UINT __stdcall GetSystemWindowsDirectoryA( LPSTR lpBuffer, UINT uSize ); __declspec(dllimport) UINT __stdcall GetSystemWindowsDirectoryW( LPWSTR lpBuffer, UINT uSize ); typedef enum _COMPUTER_NAME_FORMAT { ComputerNameNetBIOS, ComputerNameDnsHostname, ComputerNameDnsDomain, ComputerNameDnsFullyQualified, ComputerNamePhysicalNetBIOS, ComputerNamePhysicalDnsHostname, ComputerNamePhysicalDnsDomain, ComputerNamePhysicalDnsFullyQualified, ComputerNameMax } COMPUTER_NAME_FORMAT ; __declspec(dllimport) BOOL __stdcall GetComputerNameExA( COMPUTER_NAME_FORMAT NameType, LPSTR lpBuffer, LPDWORD nSize ); __declspec(dllimport) BOOL __stdcall GetComputerNameExW( COMPUTER_NAME_FORMAT NameType, LPWSTR lpBuffer, LPDWORD nSize ); __declspec(dllimport) BOOL __stdcall SetComputerNameExW( COMPUTER_NAME_FORMAT NameType, LPCWSTR lpBuffer ); __declspec(dllimport) BOOL __stdcall SetSystemTime( const SYSTEMTIME* lpSystemTime ); __declspec(deprecated) __declspec(dllimport) BOOL __stdcall GetVersionExA( LPOSVERSIONINFOA lpVersionInformation ); __declspec(deprecated) __declspec(dllimport) BOOL __stdcall GetVersionExW( LPOSVERSIONINFOW lpVersionInformation ); __declspec(dllimport) BOOL __stdcall GetLogicalProcessorInformation( PSYSTEM_LOGICAL_PROCESSOR_INFORMATION Buffer, PDWORD ReturnedLength ); __declspec(dllimport) BOOL __stdcall GetLogicalProcessorInformationEx( LOGICAL_PROCESSOR_RELATIONSHIP RelationshipType, PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Buffer, PDWORD ReturnedLength ); __declspec(dllimport) void __stdcall GetNativeSystemInfo( LPSYSTEM_INFO lpSystemInfo ); __declspec(dllimport) void __stdcall GetSystemTimePreciseAsFileTime( LPFILETIME lpSystemTimeAsFileTime ); __declspec(dllimport) BOOL __stdcall GetProductInfo( DWORD dwOSMajorVersion, DWORD dwOSMinorVersion, DWORD dwSpMajorVersion, DWORD dwSpMinorVersion, PDWORD pdwReturnedProductType ); __declspec(dllimport) ULONGLONG __stdcall VerSetConditionMask( ULONGLONG ConditionMask, ULONG TypeMask, UCHAR Condition ); __declspec(dllimport) BOOL __stdcall GetOsSafeBootMode( PDWORD Flags ); __declspec(dllimport) UINT __stdcall EnumSystemFirmwareTables( DWORD FirmwareTableProviderSignature, PVOID pFirmwareTableEnumBuffer, DWORD BufferSize ); __declspec(dllimport) UINT __stdcall GetSystemFirmwareTable( DWORD FirmwareTableProviderSignature, DWORD FirmwareTableID, PVOID pFirmwareTableBuffer, DWORD BufferSize ); __declspec(dllimport) BOOL __stdcall DnsHostnameToComputerNameExW( LPCWSTR Hostname, LPWSTR ComputerName, LPDWORD nSize ); __declspec(dllimport) BOOL __stdcall GetPhysicallyInstalledSystemMemory( PULONGLONG TotalMemoryInKilobytes ); __declspec(dllimport) BOOL __stdcall SetComputerNameEx2W( COMPUTER_NAME_FORMAT NameType, DWORD Flags, LPCWSTR lpBuffer ); __declspec(dllimport) BOOL __stdcall SetSystemTimeAdjustment( DWORD dwTimeAdjustment, BOOL bTimeAdjustmentDisabled ); __declspec(dllimport) BOOL __stdcall SetSystemTimeAdjustmentPrecise( DWORD64 dwTimeAdjustment, BOOL bTimeAdjustmentDisabled ); __declspec(dllimport) BOOL __stdcall InstallELAMCertificateInfo( HANDLE ELAMFile ); __declspec(dllimport) BOOL __stdcall GetProcessorSystemCycleTime( USHORT Group, PSYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION Buffer, PDWORD ReturnedLength ); __declspec(dllimport) BOOL __stdcall GetOsManufacturingMode( PBOOL pbEnabled ); __declspec(dllimport) HRESULT __stdcall GetIntegratedDisplaySize( double* sizeInInches ); __declspec(dllimport) BOOL __stdcall SetComputerNameA( LPCSTR lpComputerName ); __declspec(dllimport) BOOL __stdcall SetComputerNameW( LPCWSTR lpComputerName ); __declspec(dllimport) BOOL __stdcall SetComputerNameExA( COMPUTER_NAME_FORMAT NameType, LPCSTR lpBuffer ); } #pragma warning(pop) extern "C" { #pragma warning(push) #pragma warning(disable: 4668) __declspec(dllimport) LPVOID __stdcall VirtualAlloc( LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect ); __declspec(dllimport) BOOL __stdcall VirtualProtect( LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect ); __declspec(dllimport) BOOL __stdcall VirtualFree( LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType ); __declspec(dllimport) SIZE_T __stdcall VirtualQuery( LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength ); __declspec(dllimport) LPVOID __stdcall VirtualAllocEx( HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect ); __declspec(dllimport) BOOL __stdcall VirtualProtectEx( HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect ); __declspec(dllimport) SIZE_T __stdcall VirtualQueryEx( HANDLE hProcess, LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength ); __declspec(dllimport) BOOL __stdcall ReadProcessMemory( HANDLE hProcess, LPCVOID lpBaseAddress, LPVOID lpBuffer, SIZE_T nSize, SIZE_T* lpNumberOfBytesRead ); __declspec(dllimport) BOOL __stdcall WriteProcessMemory( HANDLE hProcess, LPVOID lpBaseAddress, LPCVOID lpBuffer, SIZE_T nSize, SIZE_T* lpNumberOfBytesWritten ); __declspec(dllimport) HANDLE __stdcall CreateFileMappingW( HANDLE hFile, LPSECURITY_ATTRIBUTES lpFileMappingAttributes, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCWSTR lpName ); __declspec(dllimport) HANDLE __stdcall OpenFileMappingW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName ); __declspec(dllimport) LPVOID __stdcall MapViewOfFile( HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap ); __declspec(dllimport) LPVOID __stdcall MapViewOfFileEx( HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap, LPVOID lpBaseAddress ); __declspec(dllimport) BOOL __stdcall VirtualFreeEx( HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType ); __declspec(dllimport) BOOL __stdcall FlushViewOfFile( LPCVOID lpBaseAddress, SIZE_T dwNumberOfBytesToFlush ); __declspec(dllimport) BOOL __stdcall UnmapViewOfFile( LPCVOID lpBaseAddress ); __declspec(dllimport) SIZE_T __stdcall GetLargePageMinimum( void ); __declspec(dllimport) BOOL __stdcall GetProcessWorkingSetSizeEx( HANDLE hProcess, PSIZE_T lpMinimumWorkingSetSize, PSIZE_T lpMaximumWorkingSetSize, PDWORD Flags ); __declspec(dllimport) BOOL __stdcall SetProcessWorkingSetSizeEx( HANDLE hProcess, SIZE_T dwMinimumWorkingSetSize, SIZE_T dwMaximumWorkingSetSize, DWORD Flags ); __declspec(dllimport) BOOL __stdcall VirtualLock( LPVOID lpAddress, SIZE_T dwSize ); __declspec(dllimport) BOOL __stdcall VirtualUnlock( LPVOID lpAddress, SIZE_T dwSize ); __declspec(dllimport) UINT __stdcall GetWriteWatch( DWORD dwFlags, PVOID lpBaseAddress, SIZE_T dwRegionSize, PVOID* lpAddresses, ULONG_PTR* lpdwCount, LPDWORD lpdwGranularity ); __declspec(dllimport) UINT __stdcall ResetWriteWatch( LPVOID lpBaseAddress, SIZE_T dwRegionSize ); typedef enum _MEMORY_RESOURCE_NOTIFICATION_TYPE { LowMemoryResourceNotification, HighMemoryResourceNotification } MEMORY_RESOURCE_NOTIFICATION_TYPE; __declspec(dllimport) HANDLE __stdcall CreateMemoryResourceNotification( MEMORY_RESOURCE_NOTIFICATION_TYPE NotificationType ); __declspec(dllimport) BOOL __stdcall QueryMemoryResourceNotification( HANDLE ResourceNotificationHandle, PBOOL ResourceState ); __declspec(dllimport) BOOL __stdcall GetSystemFileCacheSize( PSIZE_T lpMinimumFileCacheSize, PSIZE_T lpMaximumFileCacheSize, PDWORD lpFlags ); __declspec(dllimport) BOOL __stdcall SetSystemFileCacheSize( SIZE_T MinimumFileCacheSize, SIZE_T MaximumFileCacheSize, DWORD Flags ); __declspec(dllimport) HANDLE __stdcall CreateFileMappingNumaW( HANDLE hFile, LPSECURITY_ATTRIBUTES lpFileMappingAttributes, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCWSTR lpName, DWORD nndPreferred ); typedef struct _WIN32_MEMORY_RANGE_ENTRY { PVOID VirtualAddress; SIZE_T NumberOfBytes; } WIN32_MEMORY_RANGE_ENTRY, *PWIN32_MEMORY_RANGE_ENTRY; __declspec(dllimport) BOOL __stdcall PrefetchVirtualMemory( HANDLE hProcess, ULONG_PTR NumberOfEntries, PWIN32_MEMORY_RANGE_ENTRY VirtualAddresses, ULONG Flags ); __declspec(dllimport) HANDLE __stdcall CreateFileMappingFromApp( HANDLE hFile, PSECURITY_ATTRIBUTES SecurityAttributes, ULONG PageProtection, ULONG64 MaximumSize, PCWSTR Name ); __declspec(dllimport) PVOID __stdcall MapViewOfFileFromApp( HANDLE hFileMappingObject, ULONG DesiredAccess, ULONG64 FileOffset, SIZE_T NumberOfBytesToMap ); __declspec(dllimport) BOOL __stdcall UnmapViewOfFileEx( PVOID BaseAddress, ULONG UnmapFlags ); __declspec(dllimport) BOOL __stdcall AllocateUserPhysicalPages( HANDLE hProcess, PULONG_PTR NumberOfPages, PULONG_PTR PageArray ); __declspec(dllimport) BOOL __stdcall FreeUserPhysicalPages( HANDLE hProcess, PULONG_PTR NumberOfPages, PULONG_PTR PageArray ); __declspec(dllimport) BOOL __stdcall MapUserPhysicalPages( PVOID VirtualAddress, ULONG_PTR NumberOfPages, PULONG_PTR PageArray ); __declspec(dllimport) BOOL __stdcall AllocateUserPhysicalPagesNuma( HANDLE hProcess, PULONG_PTR NumberOfPages, PULONG_PTR PageArray, DWORD nndPreferred ); __declspec(dllimport) LPVOID __stdcall VirtualAllocExNuma( HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect, DWORD nndPreferred ); __declspec(dllimport) BOOL __stdcall GetMemoryErrorHandlingCapabilities( PULONG Capabilities ); typedef void __stdcall BAD_MEMORY_CALLBACK_ROUTINE( void ); typedef BAD_MEMORY_CALLBACK_ROUTINE *PBAD_MEMORY_CALLBACK_ROUTINE; __declspec(dllimport) PVOID __stdcall RegisterBadMemoryNotification( PBAD_MEMORY_CALLBACK_ROUTINE Callback ); __declspec(dllimport) BOOL __stdcall UnregisterBadMemoryNotification( PVOID RegistrationHandle ); typedef enum OFFER_PRIORITY { VmOfferPriorityVeryLow = 1, VmOfferPriorityLow, VmOfferPriorityBelowNormal, VmOfferPriorityNormal } OFFER_PRIORITY; DWORD __stdcall OfferVirtualMemory( PVOID VirtualAddress, SIZE_T Size, OFFER_PRIORITY Priority ); DWORD __stdcall ReclaimVirtualMemory( void const* VirtualAddress, SIZE_T Size ); DWORD __stdcall DiscardVirtualMemory( PVOID VirtualAddress, SIZE_T Size ); __declspec(dllimport) BOOL __stdcall SetProcessValidCallTargets( HANDLE hProcess, PVOID VirtualAddress, SIZE_T RegionSize, ULONG NumberOfOffsets, PCFG_CALL_TARGET_INFO OffsetInformation ); __declspec(dllimport) BOOL __stdcall SetProcessValidCallTargetsForMappedView( HANDLE Process, PVOID VirtualAddress, SIZE_T RegionSize, ULONG NumberOfOffsets, PCFG_CALL_TARGET_INFO OffsetInformation, HANDLE Section, ULONG64 ExpectedFileOffset ); __declspec(dllimport) PVOID __stdcall VirtualAllocFromApp( PVOID BaseAddress, SIZE_T Size, ULONG AllocationType, ULONG Protection ); __declspec(dllimport) BOOL __stdcall VirtualProtectFromApp( PVOID Address, SIZE_T Size, ULONG NewProtection, PULONG OldProtection ); __declspec(dllimport) HANDLE __stdcall OpenFileMappingFromApp( ULONG DesiredAccess, BOOL InheritHandle, PCWSTR Name ); typedef enum WIN32_MEMORY_INFORMATION_CLASS { MemoryRegionInfo } WIN32_MEMORY_INFORMATION_CLASS; #pragma warning(push) #pragma warning(disable: 4201) #pragma warning(disable: 4214) typedef struct WIN32_MEMORY_REGION_INFORMATION { PVOID AllocationBase; ULONG AllocationProtect; union { ULONG Flags; struct { ULONG Private : 1; ULONG MappedDataFile : 1; ULONG MappedImage : 1; ULONG MappedPageFile : 1; ULONG MappedPhysical : 1; ULONG DirectMapped : 1; ULONG Reserved : 26; } ; } ; SIZE_T RegionSize; SIZE_T CommitSize; } WIN32_MEMORY_REGION_INFORMATION; #pragma warning(pop) __declspec(dllimport) BOOL __stdcall QueryVirtualMemoryInformation( HANDLE Process, const void* VirtualAddress, WIN32_MEMORY_INFORMATION_CLASS MemoryInformationClass, PVOID MemoryInformation, SIZE_T MemoryInformationSize, PSIZE_T ReturnSize ); __declspec(dllimport) PVOID __stdcall MapViewOfFileNuma2( HANDLE FileMappingHandle, HANDLE ProcessHandle, ULONG64 Offset, PVOID BaseAddress, SIZE_T ViewSize, ULONG AllocationType, ULONG PageProtection, ULONG PreferredNode ); __forceinline PVOID MapViewOfFile2( HANDLE FileMappingHandle, HANDLE ProcessHandle, ULONG64 Offset, PVOID BaseAddress, SIZE_T ViewSize, ULONG AllocationType, ULONG PageProtection ) { return MapViewOfFileNuma2(FileMappingHandle, ProcessHandle, Offset, BaseAddress, ViewSize, AllocationType, PageProtection, ((DWORD) -1)); } __declspec(dllimport) BOOL __stdcall UnmapViewOfFile2( HANDLE Process, PVOID BaseAddress, ULONG UnmapFlags ); __declspec(dllimport) BOOL __stdcall VirtualUnlockEx( HANDLE Process, LPVOID Address, SIZE_T Size ); #pragma warning(pop) } extern "C" { __declspec(dllimport) BOOL __stdcall IsEnclaveTypeSupported( DWORD flEnclaveType ); __declspec(dllimport) LPVOID __stdcall CreateEnclave( HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, SIZE_T dwInitialCommitment, DWORD flEnclaveType, LPCVOID lpEnclaveInformation, DWORD dwInfoLength, LPDWORD lpEnclaveError ); __declspec(dllimport) BOOL __stdcall LoadEnclaveData( HANDLE hProcess, LPVOID lpAddress, LPCVOID lpBuffer, SIZE_T nSize, DWORD flProtect, LPCVOID lpPageInformation, DWORD dwInfoLength, PSIZE_T lpNumberOfBytesWritten, LPDWORD lpEnclaveError ); __declspec(dllimport) BOOL __stdcall InitializeEnclave( HANDLE hProcess, LPVOID lpAddress, LPCVOID lpEnclaveInformation, DWORD dwInfoLength, LPDWORD lpEnclaveError ); __declspec(dllimport) BOOL __stdcall LoadEnclaveImageA( LPVOID lpEnclaveAddress, LPCSTR lpImageName ); __declspec(dllimport) BOOL __stdcall LoadEnclaveImageW( LPVOID lpEnclaveAddress, LPCWSTR lpImageName ); __declspec(dllimport) BOOL __stdcall CallEnclave( LPENCLAVE_ROUTINE lpRoutine, LPVOID lpParameter, BOOL fWaitForThread, LPVOID* lpReturnValue ); __declspec(dllimport) BOOL __stdcall TerminateEnclave( LPVOID lpAddress, BOOL fWait ); __declspec(dllimport) BOOL __stdcall DeleteEnclave( LPVOID lpAddress ); } extern "C" { __declspec(dllimport) BOOL __stdcall QueueUserWorkItem( LPTHREAD_START_ROUTINE Function, PVOID Context, ULONG Flags ); __declspec(dllimport) BOOL __stdcall UnregisterWaitEx( HANDLE WaitHandle, HANDLE CompletionEvent ); __declspec(dllimport) HANDLE __stdcall CreateTimerQueue( void ); __declspec(dllimport) BOOL __stdcall CreateTimerQueueTimer( PHANDLE phNewTimer, HANDLE TimerQueue, WAITORTIMERCALLBACK Callback, PVOID Parameter, DWORD DueTime, DWORD Period, ULONG Flags ); __declspec(dllimport) BOOL __stdcall ChangeTimerQueueTimer( HANDLE TimerQueue, HANDLE Timer, ULONG DueTime, ULONG Period ); __declspec(dllimport) BOOL __stdcall DeleteTimerQueueTimer( HANDLE TimerQueue, HANDLE Timer, HANDLE CompletionEvent ); __declspec(dllimport) BOOL __stdcall DeleteTimerQueueEx( HANDLE TimerQueue, HANDLE CompletionEvent ); } extern "C" { typedef void (__stdcall *PTP_WIN32_IO_CALLBACK)( PTP_CALLBACK_INSTANCE Instance, PVOID Context, PVOID Overlapped, ULONG IoResult, ULONG_PTR NumberOfBytesTransferred, PTP_IO Io ); __declspec(dllimport) PTP_POOL __stdcall CreateThreadpool( PVOID reserved ); __declspec(dllimport) void __stdcall SetThreadpoolThreadMaximum( PTP_POOL ptpp, DWORD cthrdMost ); __declspec(dllimport) BOOL __stdcall SetThreadpoolThreadMinimum( PTP_POOL ptpp, DWORD cthrdMic ); __declspec(dllimport) BOOL __stdcall SetThreadpoolStackInformation( PTP_POOL ptpp, PTP_POOL_STACK_INFORMATION ptpsi ); __declspec(dllimport) BOOL __stdcall QueryThreadpoolStackInformation( PTP_POOL ptpp, PTP_POOL_STACK_INFORMATION ptpsi ); __declspec(dllimport) void __stdcall CloseThreadpool( PTP_POOL ptpp ); __declspec(dllimport) PTP_CLEANUP_GROUP __stdcall CreateThreadpoolCleanupGroup( void ); __declspec(dllimport) void __stdcall CloseThreadpoolCleanupGroupMembers( PTP_CLEANUP_GROUP ptpcg, BOOL fCancelPendingCallbacks, PVOID pvCleanupContext ); __declspec(dllimport) void __stdcall CloseThreadpoolCleanupGroup( PTP_CLEANUP_GROUP ptpcg ); __declspec(dllimport) void __stdcall SetEventWhenCallbackReturns( PTP_CALLBACK_INSTANCE pci, HANDLE evt ); __declspec(dllimport) void __stdcall ReleaseSemaphoreWhenCallbackReturns( PTP_CALLBACK_INSTANCE pci, HANDLE sem, DWORD crel ); __declspec(dllimport) void __stdcall ReleaseMutexWhenCallbackReturns( PTP_CALLBACK_INSTANCE pci, HANDLE mut ); __declspec(dllimport) void __stdcall LeaveCriticalSectionWhenCallbackReturns( PTP_CALLBACK_INSTANCE pci, PCRITICAL_SECTION pcs ); __declspec(dllimport) void __stdcall FreeLibraryWhenCallbackReturns( PTP_CALLBACK_INSTANCE pci, HMODULE mod ); __declspec(dllimport) BOOL __stdcall CallbackMayRunLong( PTP_CALLBACK_INSTANCE pci ); __declspec(dllimport) void __stdcall DisassociateCurrentThreadFromCallback( PTP_CALLBACK_INSTANCE pci ); __declspec(dllimport) BOOL __stdcall TrySubmitThreadpoolCallback( PTP_SIMPLE_CALLBACK pfns, PVOID pv, PTP_CALLBACK_ENVIRON pcbe ); __declspec(dllimport) PTP_WORK __stdcall CreateThreadpoolWork( PTP_WORK_CALLBACK pfnwk, PVOID pv, PTP_CALLBACK_ENVIRON pcbe ); __declspec(dllimport) void __stdcall SubmitThreadpoolWork( PTP_WORK pwk ); __declspec(dllimport) void __stdcall WaitForThreadpoolWorkCallbacks( PTP_WORK pwk, BOOL fCancelPendingCallbacks ); __declspec(dllimport) void __stdcall CloseThreadpoolWork( PTP_WORK pwk ); __declspec(dllimport) PTP_TIMER __stdcall CreateThreadpoolTimer( PTP_TIMER_CALLBACK pfnti, PVOID pv, PTP_CALLBACK_ENVIRON pcbe ); __declspec(dllimport) void __stdcall SetThreadpoolTimer( PTP_TIMER pti, PFILETIME pftDueTime, DWORD msPeriod, DWORD msWindowLength ); __declspec(dllimport) BOOL __stdcall IsThreadpoolTimerSet( PTP_TIMER pti ); __declspec(dllimport) void __stdcall WaitForThreadpoolTimerCallbacks( PTP_TIMER pti, BOOL fCancelPendingCallbacks ); __declspec(dllimport) void __stdcall CloseThreadpoolTimer( PTP_TIMER pti ); __declspec(dllimport) PTP_WAIT __stdcall CreateThreadpoolWait( PTP_WAIT_CALLBACK pfnwa, PVOID pv, PTP_CALLBACK_ENVIRON pcbe ); __declspec(dllimport) void __stdcall SetThreadpoolWait( PTP_WAIT pwa, HANDLE h, PFILETIME pftTimeout ); __declspec(dllimport) void __stdcall WaitForThreadpoolWaitCallbacks( PTP_WAIT pwa, BOOL fCancelPendingCallbacks ); __declspec(dllimport) void __stdcall CloseThreadpoolWait( PTP_WAIT pwa ); __declspec(dllimport) PTP_IO __stdcall CreateThreadpoolIo( HANDLE fl, PTP_WIN32_IO_CALLBACK pfnio, PVOID pv, PTP_CALLBACK_ENVIRON pcbe ); __declspec(dllimport) void __stdcall StartThreadpoolIo( PTP_IO pio ); __declspec(dllimport) void __stdcall CancelThreadpoolIo( PTP_IO pio ); __declspec(dllimport) void __stdcall WaitForThreadpoolIoCallbacks( PTP_IO pio, BOOL fCancelPendingCallbacks ); __declspec(dllimport) void __stdcall CloseThreadpoolIo( PTP_IO pio ); __declspec(dllimport) BOOL __stdcall SetThreadpoolTimerEx( PTP_TIMER pti, PFILETIME pftDueTime, DWORD msPeriod, DWORD msWindowLength ); __declspec(dllimport) BOOL __stdcall SetThreadpoolWaitEx( PTP_WAIT pwa, HANDLE h, PFILETIME pftTimeout, PVOID Reserved ); } extern "C" { __declspec(dllimport) BOOL __stdcall IsProcessInJob( HANDLE ProcessHandle, HANDLE JobHandle, PBOOL Result ); } extern "C" { typedef struct JOBOBJECT_IO_RATE_CONTROL_INFORMATION { LONG64 MaxIops; LONG64 MaxBandwidth; LONG64 ReservationIops; PCWSTR VolumeName; ULONG BaseIoSize; ULONG ControlFlags; } JOBOBJECT_IO_RATE_CONTROL_INFORMATION; __declspec(dllimport) HANDLE __stdcall CreateJobObjectW( LPSECURITY_ATTRIBUTES lpJobAttributes, LPCWSTR lpName ); __declspec(dllimport) void __stdcall FreeMemoryJobObject( void* Buffer ); __declspec(dllimport) HANDLE __stdcall OpenJobObjectW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName ); __declspec(dllimport) BOOL __stdcall AssignProcessToJobObject( HANDLE hJob, HANDLE hProcess ); __declspec(dllimport) BOOL __stdcall TerminateJobObject( HANDLE hJob, UINT uExitCode ); __declspec(dllimport) BOOL __stdcall SetInformationJobObject( HANDLE hJob, JOBOBJECTINFOCLASS JobObjectInformationClass, LPVOID lpJobObjectInformation, DWORD cbJobObjectInformationLength ); __declspec(dllimport) DWORD __stdcall SetIoRateControlInformationJobObject( HANDLE hJob, JOBOBJECT_IO_RATE_CONTROL_INFORMATION* IoRateControlInfo ); __declspec(dllimport) BOOL __stdcall QueryInformationJobObject( HANDLE hJob, JOBOBJECTINFOCLASS JobObjectInformationClass, LPVOID lpJobObjectInformation, DWORD cbJobObjectInformationLength, LPDWORD lpReturnLength ); __declspec(dllimport) DWORD __stdcall QueryIoRateControlInformationJobObject( HANDLE hJob, PCWSTR VolumeName, JOBOBJECT_IO_RATE_CONTROL_INFORMATION** InfoBlocks, ULONG* InfoBlockCount ); } extern "C" { __declspec(dllimport) BOOL __stdcall Wow64DisableWow64FsRedirection( PVOID* OldValue ); __declspec(dllimport) BOOL __stdcall Wow64RevertWow64FsRedirection( PVOID OlValue ); __declspec(dllimport) BOOL __stdcall IsWow64Process( HANDLE hProcess, PBOOL Wow64Process ); __declspec(dllimport) UINT __stdcall GetSystemWow64DirectoryA( LPSTR lpBuffer, UINT uSize ); __declspec(dllimport) UINT __stdcall GetSystemWow64DirectoryW( LPWSTR lpBuffer, UINT uSize ); __declspec(dllimport) USHORT __stdcall Wow64SetThreadDefaultGuestMachine( USHORT Machine ); __declspec(dllimport) BOOL __stdcall IsWow64Process2( HANDLE hProcess, USHORT* pProcessMachine, USHORT* pNativeMachine ); __declspec(dllimport) UINT __stdcall GetSystemWow64Directory2A( LPSTR lpBuffer, UINT uSize, WORD ImageFileMachineType ); __declspec(dllimport) UINT __stdcall GetSystemWow64Directory2W( LPWSTR lpBuffer, UINT uSize, WORD ImageFileMachineType ); __declspec(dllimport) HRESULT __stdcall IsWow64GuestMachineSupported( USHORT WowGuestMachine, BOOL* MachineIsSupported ); } extern "C" { typedef struct tagENUMUILANG { ULONG NumOfEnumUILang; ULONG SizeOfEnumUIBuffer; LANGID *pEnumUIBuffer; } ENUMUILANG, *PENUMUILANG; typedef BOOL (__stdcall* ENUMRESLANGPROCA)( HMODULE hModule, LPCSTR lpType, LPCSTR lpName, WORD wLanguage, LONG_PTR lParam); typedef BOOL (__stdcall* ENUMRESLANGPROCW)( HMODULE hModule, LPCWSTR lpType, LPCWSTR lpName, WORD wLanguage, LONG_PTR lParam); typedef BOOL (__stdcall* ENUMRESNAMEPROCA)( HMODULE hModule, LPCSTR lpType, LPSTR lpName, LONG_PTR lParam); typedef BOOL (__stdcall* ENUMRESNAMEPROCW)( HMODULE hModule, LPCWSTR lpType, LPWSTR lpName, LONG_PTR lParam); typedef BOOL (__stdcall* ENUMRESTYPEPROCA)( HMODULE hModule, LPSTR lpType, LONG_PTR lParam ); typedef BOOL (__stdcall* ENUMRESTYPEPROCW)( HMODULE hModule, LPWSTR lpType, LONG_PTR lParam ); __declspec(dllimport) BOOL __stdcall DisableThreadLibraryCalls( HMODULE hLibModule ); __declspec(dllimport) HRSRC __stdcall FindResourceExW( HMODULE hModule, LPCWSTR lpType, LPCWSTR lpName, WORD wLanguage ); __declspec(dllimport) int __stdcall FindStringOrdinal( DWORD dwFindStringOrdinalFlags, LPCWSTR lpStringSource, int cchSource, LPCWSTR lpStringValue, int cchValue, BOOL bIgnoreCase ); __declspec(dllimport) BOOL __stdcall FreeLibrary( HMODULE hLibModule ); __declspec(dllimport) __declspec(noreturn) void __stdcall FreeLibraryAndExitThread( HMODULE hLibModule, DWORD dwExitCode ); __declspec(dllimport) BOOL __stdcall FreeResource( HGLOBAL hResData ); __declspec(dllimport) DWORD __stdcall GetModuleFileNameA( HMODULE hModule, LPSTR lpFilename, DWORD nSize ); __declspec(dllimport) DWORD __stdcall GetModuleFileNameW( HMODULE hModule, LPWSTR lpFilename, DWORD nSize ); __declspec(dllimport) HMODULE __stdcall GetModuleHandleA( LPCSTR lpModuleName ); __declspec(dllimport) HMODULE __stdcall GetModuleHandleW( LPCWSTR lpModuleName ); typedef BOOL (__stdcall* PGET_MODULE_HANDLE_EXA)( DWORD dwFlags, LPCSTR lpModuleName, HMODULE* phModule ); typedef BOOL (__stdcall* PGET_MODULE_HANDLE_EXW)( DWORD dwFlags, LPCWSTR lpModuleName, HMODULE* phModule ); __declspec(dllimport) BOOL __stdcall GetModuleHandleExA( DWORD dwFlags, LPCSTR lpModuleName, HMODULE* phModule ); __declspec(dllimport) BOOL __stdcall GetModuleHandleExW( DWORD dwFlags, LPCWSTR lpModuleName, HMODULE* phModule ); __declspec(dllimport) FARPROC __stdcall GetProcAddress( HMODULE hModule, LPCSTR lpProcName ); typedef struct _REDIRECTION_FUNCTION_DESCRIPTOR { PCSTR DllName; PCSTR FunctionName; PVOID RedirectionTarget; } REDIRECTION_FUNCTION_DESCRIPTOR, *PREDIRECTION_FUNCTION_DESCRIPTOR; typedef const REDIRECTION_FUNCTION_DESCRIPTOR *PCREDIRECTION_FUNCTION_DESCRIPTOR; typedef struct _REDIRECTION_DESCRIPTOR { ULONG Version; ULONG FunctionCount; PCREDIRECTION_FUNCTION_DESCRIPTOR Redirections; } REDIRECTION_DESCRIPTOR, *PREDIRECTION_DESCRIPTOR; typedef const REDIRECTION_DESCRIPTOR *PCREDIRECTION_DESCRIPTOR; __declspec(dllimport) HMODULE __stdcall LoadLibraryExA( LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags ); __declspec(dllimport) HMODULE __stdcall LoadLibraryExW( LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags ); __declspec(dllimport) HGLOBAL __stdcall LoadResource( HMODULE hModule, HRSRC hResInfo ); __declspec(dllimport) int __stdcall LoadStringA( HINSTANCE hInstance, UINT uID, LPSTR lpBuffer, int cchBufferMax ); __declspec(dllimport) int __stdcall LoadStringW( HINSTANCE hInstance, UINT uID, LPWSTR lpBuffer, int cchBufferMax ); __declspec(dllimport) LPVOID __stdcall LockResource( HGLOBAL hResData ); __declspec(dllimport) DWORD __stdcall SizeofResource( HMODULE hModule, HRSRC hResInfo ); typedef PVOID DLL_DIRECTORY_COOKIE, *PDLL_DIRECTORY_COOKIE; __declspec(dllimport) DLL_DIRECTORY_COOKIE __stdcall AddDllDirectory( PCWSTR NewDirectory ); __declspec(dllimport) BOOL __stdcall RemoveDllDirectory( DLL_DIRECTORY_COOKIE Cookie ); __declspec(dllimport) BOOL __stdcall SetDefaultDllDirectories( DWORD DirectoryFlags ); __declspec(dllimport) BOOL __stdcall EnumResourceLanguagesExA( HMODULE hModule, LPCSTR lpType, LPCSTR lpName, ENUMRESLANGPROCA lpEnumFunc, LONG_PTR lParam, DWORD dwFlags, LANGID LangId ); __declspec(dllimport) BOOL __stdcall EnumResourceLanguagesExW( HMODULE hModule, LPCWSTR lpType, LPCWSTR lpName, ENUMRESLANGPROCW lpEnumFunc, LONG_PTR lParam, DWORD dwFlags, LANGID LangId ); __declspec(dllimport) BOOL __stdcall EnumResourceNamesExA( HMODULE hModule, LPCSTR lpType, ENUMRESNAMEPROCA lpEnumFunc, LONG_PTR lParam, DWORD dwFlags, LANGID LangId ); __declspec(dllimport) BOOL __stdcall EnumResourceNamesExW( HMODULE hModule, LPCWSTR lpType, ENUMRESNAMEPROCW lpEnumFunc, LONG_PTR lParam, DWORD dwFlags, LANGID LangId ); __declspec(dllimport) BOOL __stdcall EnumResourceTypesExA( HMODULE hModule, ENUMRESTYPEPROCA lpEnumFunc, LONG_PTR lParam, DWORD dwFlags, LANGID LangId ); __declspec(dllimport) BOOL __stdcall EnumResourceTypesExW( HMODULE hModule, ENUMRESTYPEPROCW lpEnumFunc, LONG_PTR lParam, DWORD dwFlags, LANGID LangId ); __declspec(dllimport) HRSRC __stdcall FindResourceW( HMODULE hModule, LPCWSTR lpName, LPCWSTR lpType ); __declspec(dllimport) HMODULE __stdcall LoadLibraryA( LPCSTR lpLibFileName ); __declspec(dllimport) HMODULE __stdcall LoadLibraryW( LPCWSTR lpLibFileName ); __declspec(dllimport) BOOL __stdcall EnumResourceNamesW( HMODULE hModule, LPCWSTR lpType, ENUMRESNAMEPROCW lpEnumFunc, LONG_PTR lParam ); } extern "C" { __declspec(dllimport) BOOL __stdcall AccessCheck( PSECURITY_DESCRIPTOR pSecurityDescriptor, HANDLE ClientToken, DWORD DesiredAccess, PGENERIC_MAPPING GenericMapping, PPRIVILEGE_SET PrivilegeSet, LPDWORD PrivilegeSetLength, LPDWORD GrantedAccess, LPBOOL AccessStatus ); __declspec(dllimport) BOOL __stdcall AccessCheckAndAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, LPWSTR ObjectTypeName, LPWSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, DWORD DesiredAccess, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPBOOL AccessStatus, LPBOOL pfGenerateOnClose ); __declspec(dllimport) BOOL __stdcall AccessCheckByType( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID PrincipalSelfSid, HANDLE ClientToken, DWORD DesiredAccess, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, PPRIVILEGE_SET PrivilegeSet, LPDWORD PrivilegeSetLength, LPDWORD GrantedAccess, LPBOOL AccessStatus ); __declspec(dllimport) BOOL __stdcall AccessCheckByTypeResultList( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID PrincipalSelfSid, HANDLE ClientToken, DWORD DesiredAccess, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, PPRIVILEGE_SET PrivilegeSet, LPDWORD PrivilegeSetLength, LPDWORD GrantedAccessList, LPDWORD AccessStatusList ); __declspec(dllimport) BOOL __stdcall AccessCheckByTypeAndAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, LPCWSTR ObjectTypeName, LPCWSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPBOOL AccessStatus, LPBOOL pfGenerateOnClose ); __declspec(dllimport) BOOL __stdcall AccessCheckByTypeResultListAndAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, LPCWSTR ObjectTypeName, LPCWSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccessList, LPDWORD AccessStatusList, LPBOOL pfGenerateOnClose ); __declspec(dllimport) BOOL __stdcall AccessCheckByTypeResultListAndAuditAlarmByHandleW( LPCWSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken, LPCWSTR ObjectTypeName, LPCWSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccessList, LPDWORD AccessStatusList, LPBOOL pfGenerateOnClose ); __declspec(dllimport) BOOL __stdcall AddAccessAllowedAce( PACL pAcl, DWORD dwAceRevision, DWORD AccessMask, PSID pSid ); __declspec(dllimport) BOOL __stdcall AddAccessAllowedAceEx( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, PSID pSid ); __declspec(dllimport) BOOL __stdcall AddAccessAllowedObjectAce( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, GUID* ObjectTypeGuid, GUID* InheritedObjectTypeGuid, PSID pSid ); __declspec(dllimport) BOOL __stdcall AddAccessDeniedAce( PACL pAcl, DWORD dwAceRevision, DWORD AccessMask, PSID pSid ); __declspec(dllimport) BOOL __stdcall AddAccessDeniedAceEx( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, PSID pSid ); __declspec(dllimport) BOOL __stdcall AddAccessDeniedObjectAce( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, GUID* ObjectTypeGuid, GUID* InheritedObjectTypeGuid, PSID pSid ); __declspec(dllimport) BOOL __stdcall AddAce( PACL pAcl, DWORD dwAceRevision, DWORD dwStartingAceIndex, LPVOID pAceList, DWORD nAceListLength ); __declspec(dllimport) BOOL __stdcall AddAuditAccessAce( PACL pAcl, DWORD dwAceRevision, DWORD dwAccessMask, PSID pSid, BOOL bAuditSuccess, BOOL bAuditFailure ); __declspec(dllimport) BOOL __stdcall AddAuditAccessAceEx( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD dwAccessMask, PSID pSid, BOOL bAuditSuccess, BOOL bAuditFailure ); __declspec(dllimport) BOOL __stdcall AddAuditAccessObjectAce( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, GUID* ObjectTypeGuid, GUID* InheritedObjectTypeGuid, PSID pSid, BOOL bAuditSuccess, BOOL bAuditFailure ); __declspec(dllimport) BOOL __stdcall AddMandatoryAce( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD MandatoryPolicy, PSID pLabelSid ); __declspec(dllimport) BOOL __stdcall AddResourceAttributeAce( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, PSID pSid, PCLAIM_SECURITY_ATTRIBUTES_INFORMATION pAttributeInfo, PDWORD pReturnLength ); __declspec(dllimport) BOOL __stdcall AddScopedPolicyIDAce( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, PSID pSid ); __declspec(dllimport) BOOL __stdcall AdjustTokenGroups( HANDLE TokenHandle, BOOL ResetToDefault, PTOKEN_GROUPS NewState, DWORD BufferLength, PTOKEN_GROUPS PreviousState, PDWORD ReturnLength ); __declspec(dllimport) BOOL __stdcall AdjustTokenPrivileges( HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength ); __declspec(dllimport) BOOL __stdcall AllocateAndInitializeSid( PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, PSID* pSid ); __declspec(dllimport) BOOL __stdcall AllocateLocallyUniqueId( PLUID Luid ); __declspec(dllimport) BOOL __stdcall AreAllAccessesGranted( DWORD GrantedAccess, DWORD DesiredAccess ); __declspec(dllimport) BOOL __stdcall AreAnyAccessesGranted( DWORD GrantedAccess, DWORD DesiredAccess ); __declspec(dllimport) BOOL __stdcall CheckTokenMembership( HANDLE TokenHandle, PSID SidToCheck, PBOOL IsMember ); __declspec(dllimport) BOOL __stdcall CheckTokenCapability( HANDLE TokenHandle, PSID CapabilitySidToCheck, PBOOL HasCapability ); __declspec(dllimport) BOOL __stdcall GetAppContainerAce( PACL Acl, DWORD StartingAceIndex, PVOID* AppContainerAce, DWORD* AppContainerAceIndex ); __declspec(dllimport) BOOL __stdcall CheckTokenMembershipEx( HANDLE TokenHandle, PSID SidToCheck, DWORD Flags, PBOOL IsMember ); __declspec(dllimport) BOOL __stdcall ConvertToAutoInheritPrivateObjectSecurity( PSECURITY_DESCRIPTOR ParentDescriptor, PSECURITY_DESCRIPTOR CurrentSecurityDescriptor, PSECURITY_DESCRIPTOR* NewSecurityDescriptor, GUID* ObjectType, BOOLEAN IsDirectoryObject, PGENERIC_MAPPING GenericMapping ); __declspec(dllimport) BOOL __stdcall CopySid( DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid ); __declspec(dllimport) BOOL __stdcall CreatePrivateObjectSecurity( PSECURITY_DESCRIPTOR ParentDescriptor, PSECURITY_DESCRIPTOR CreatorDescriptor, PSECURITY_DESCRIPTOR* NewDescriptor, BOOL IsDirectoryObject, HANDLE Token, PGENERIC_MAPPING GenericMapping ); __declspec(dllimport) BOOL __stdcall CreatePrivateObjectSecurityEx( PSECURITY_DESCRIPTOR ParentDescriptor, PSECURITY_DESCRIPTOR CreatorDescriptor, PSECURITY_DESCRIPTOR* NewDescriptor, GUID* ObjectType, BOOL IsContainerObject, ULONG AutoInheritFlags, HANDLE Token, PGENERIC_MAPPING GenericMapping ); __declspec(dllimport) BOOL __stdcall CreatePrivateObjectSecurityWithMultipleInheritance( PSECURITY_DESCRIPTOR ParentDescriptor, PSECURITY_DESCRIPTOR CreatorDescriptor, PSECURITY_DESCRIPTOR* NewDescriptor, GUID** ObjectTypes, ULONG GuidCount, BOOL IsContainerObject, ULONG AutoInheritFlags, HANDLE Token, PGENERIC_MAPPING GenericMapping ); __declspec(dllimport) BOOL __stdcall CreateRestrictedToken( HANDLE ExistingTokenHandle, DWORD Flags, DWORD DisableSidCount, PSID_AND_ATTRIBUTES SidsToDisable, DWORD DeletePrivilegeCount, PLUID_AND_ATTRIBUTES PrivilegesToDelete, DWORD RestrictedSidCount, PSID_AND_ATTRIBUTES SidsToRestrict, PHANDLE NewTokenHandle ); __declspec(dllimport) BOOL __stdcall CreateWellKnownSid( WELL_KNOWN_SID_TYPE WellKnownSidType, PSID DomainSid, PSID pSid, DWORD* cbSid ); __declspec(dllimport) BOOL __stdcall EqualDomainSid( PSID pSid1, PSID pSid2, BOOL* pfEqual ); __declspec(dllimport) BOOL __stdcall DeleteAce( PACL pAcl, DWORD dwAceIndex ); __declspec(dllimport) BOOL __stdcall DestroyPrivateObjectSecurity( PSECURITY_DESCRIPTOR* ObjectDescriptor ); __declspec(dllimport) BOOL __stdcall DuplicateToken( HANDLE ExistingTokenHandle, SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, PHANDLE DuplicateTokenHandle ); __declspec(dllimport) BOOL __stdcall DuplicateTokenEx( HANDLE hExistingToken, DWORD dwDesiredAccess, LPSECURITY_ATTRIBUTES lpTokenAttributes, SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, TOKEN_TYPE TokenType, PHANDLE phNewToken ); __declspec(dllimport) BOOL __stdcall EqualPrefixSid( PSID pSid1, PSID pSid2 ); __declspec(dllimport) BOOL __stdcall EqualSid( PSID pSid1, PSID pSid2 ); __declspec(dllimport) BOOL __stdcall FindFirstFreeAce( PACL pAcl, LPVOID* pAce ); __declspec(dllimport) PVOID __stdcall FreeSid( PSID pSid ); __declspec(dllimport) BOOL __stdcall GetAce( PACL pAcl, DWORD dwAceIndex, LPVOID* pAce ); __declspec(dllimport) BOOL __stdcall GetAclInformation( PACL pAcl, LPVOID pAclInformation, DWORD nAclInformationLength, ACL_INFORMATION_CLASS dwAclInformationClass ); __declspec(dllimport) BOOL __stdcall GetFileSecurityW( LPCWSTR lpFileName, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded ); __declspec(dllimport) BOOL __stdcall GetKernelObjectSecurity( HANDLE Handle, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded ); __declspec(dllimport) DWORD __stdcall GetLengthSid( PSID pSid ); __declspec(dllimport) BOOL __stdcall GetPrivateObjectSecurity( PSECURITY_DESCRIPTOR ObjectDescriptor, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR ResultantDescriptor, DWORD DescriptorLength, PDWORD ReturnLength ); __declspec(dllimport) BOOL __stdcall GetSecurityDescriptorControl( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSECURITY_DESCRIPTOR_CONTROL pControl, LPDWORD lpdwRevision ); __declspec(dllimport) BOOL __stdcall GetSecurityDescriptorDacl( PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbDaclPresent, PACL* pDacl, LPBOOL lpbDaclDefaulted ); __declspec(dllimport) BOOL __stdcall GetSecurityDescriptorGroup( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID* pGroup, LPBOOL lpbGroupDefaulted ); __declspec(dllimport) DWORD __stdcall GetSecurityDescriptorLength( PSECURITY_DESCRIPTOR pSecurityDescriptor ); __declspec(dllimport) BOOL __stdcall GetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID* pOwner, LPBOOL lpbOwnerDefaulted ); __declspec(dllimport) DWORD __stdcall GetSecurityDescriptorRMControl( PSECURITY_DESCRIPTOR SecurityDescriptor, PUCHAR RMControl ); __declspec(dllimport) BOOL __stdcall GetSecurityDescriptorSacl( PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbSaclPresent, PACL* pSacl, LPBOOL lpbSaclDefaulted ); __declspec(dllimport) PSID_IDENTIFIER_AUTHORITY __stdcall GetSidIdentifierAuthority( PSID pSid ); __declspec(dllimport) DWORD __stdcall GetSidLengthRequired( UCHAR nSubAuthorityCount ); __declspec(dllimport) PDWORD __stdcall GetSidSubAuthority( PSID pSid, DWORD nSubAuthority ); __declspec(dllimport) PUCHAR __stdcall GetSidSubAuthorityCount( PSID pSid ); __declspec(dllimport) BOOL __stdcall GetTokenInformation( HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength ); __declspec(dllimport) BOOL __stdcall GetWindowsAccountDomainSid( PSID pSid, PSID pDomainSid, DWORD* cbDomainSid ); __declspec(dllimport) BOOL __stdcall ImpersonateAnonymousToken( HANDLE ThreadHandle ); __declspec(dllimport) BOOL __stdcall ImpersonateLoggedOnUser( HANDLE hToken ); __declspec(dllimport) BOOL __stdcall ImpersonateSelf( SECURITY_IMPERSONATION_LEVEL ImpersonationLevel ); __declspec(dllimport) BOOL __stdcall InitializeAcl( PACL pAcl, DWORD nAclLength, DWORD dwAclRevision ); __declspec(dllimport) BOOL __stdcall InitializeSecurityDescriptor( PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD dwRevision ); __declspec(dllimport) BOOL __stdcall InitializeSid( PSID Sid, PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount ); __declspec(dllimport) BOOL __stdcall IsTokenRestricted( HANDLE TokenHandle ); __declspec(dllimport) BOOL __stdcall IsValidAcl( PACL pAcl ); __declspec(dllimport) BOOL __stdcall IsValidSecurityDescriptor( PSECURITY_DESCRIPTOR pSecurityDescriptor ); __declspec(dllimport) BOOL __stdcall IsValidSid( PSID pSid ); __declspec(dllimport) BOOL __stdcall IsWellKnownSid( PSID pSid, WELL_KNOWN_SID_TYPE WellKnownSidType ); __declspec(dllimport) BOOL __stdcall MakeAbsoluteSD( PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor, LPDWORD lpdwAbsoluteSecurityDescriptorSize, PACL pDacl, LPDWORD lpdwDaclSize, PACL pSacl, LPDWORD lpdwSaclSize, PSID pOwner, LPDWORD lpdwOwnerSize, PSID pPrimaryGroup, LPDWORD lpdwPrimaryGroupSize ); __declspec(dllimport) BOOL __stdcall MakeSelfRelativeSD( PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor, PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, LPDWORD lpdwBufferLength ); __declspec(dllimport) void __stdcall MapGenericMask( PDWORD AccessMask, PGENERIC_MAPPING GenericMapping ); __declspec(dllimport) BOOL __stdcall ObjectCloseAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, BOOL GenerateOnClose ); __declspec(dllimport) BOOL __stdcall ObjectDeleteAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, BOOL GenerateOnClose ); __declspec(dllimport) BOOL __stdcall ObjectOpenAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, LPWSTR ObjectTypeName, LPWSTR ObjectName, PSECURITY_DESCRIPTOR pSecurityDescriptor, HANDLE ClientToken, DWORD DesiredAccess, DWORD GrantedAccess, PPRIVILEGE_SET Privileges, BOOL ObjectCreation, BOOL AccessGranted, LPBOOL GenerateOnClose ); __declspec(dllimport) BOOL __stdcall ObjectPrivilegeAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken, DWORD DesiredAccess, PPRIVILEGE_SET Privileges, BOOL AccessGranted ); __declspec(dllimport) BOOL __stdcall PrivilegeCheck( HANDLE ClientToken, PPRIVILEGE_SET RequiredPrivileges, LPBOOL pfResult ); __declspec(dllimport) BOOL __stdcall PrivilegedServiceAuditAlarmW( LPCWSTR SubsystemName, LPCWSTR ServiceName, HANDLE ClientToken, PPRIVILEGE_SET Privileges, BOOL AccessGranted ); __declspec(dllimport) void __stdcall QuerySecurityAccessMask( SECURITY_INFORMATION SecurityInformation, LPDWORD DesiredAccess ); __declspec(dllimport) BOOL __stdcall RevertToSelf( void ); __declspec(dllimport) BOOL __stdcall SetAclInformation( PACL pAcl, LPVOID pAclInformation, DWORD nAclInformationLength, ACL_INFORMATION_CLASS dwAclInformationClass ); __declspec(dllimport) BOOL __stdcall SetFileSecurityW( LPCWSTR lpFileName, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor ); __declspec(dllimport) BOOL __stdcall SetKernelObjectSecurity( HANDLE Handle, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR SecurityDescriptor ); __declspec(dllimport) BOOL __stdcall SetPrivateObjectSecurity( SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR ModificationDescriptor, PSECURITY_DESCRIPTOR* ObjectsSecurityDescriptor, PGENERIC_MAPPING GenericMapping, HANDLE Token ); __declspec(dllimport) BOOL __stdcall SetPrivateObjectSecurityEx( SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR ModificationDescriptor, PSECURITY_DESCRIPTOR* ObjectsSecurityDescriptor, ULONG AutoInheritFlags, PGENERIC_MAPPING GenericMapping, HANDLE Token ); __declspec(dllimport) void __stdcall SetSecurityAccessMask( SECURITY_INFORMATION SecurityInformation, LPDWORD DesiredAccess ); __declspec(dllimport) BOOL __stdcall SetSecurityDescriptorControl( PSECURITY_DESCRIPTOR pSecurityDescriptor, SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest, SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet ); __declspec(dllimport) BOOL __stdcall SetSecurityDescriptorDacl( PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bDaclPresent, PACL pDacl, BOOL bDaclDefaulted ); __declspec(dllimport) BOOL __stdcall SetSecurityDescriptorGroup( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID pGroup, BOOL bGroupDefaulted ); __declspec(dllimport) BOOL __stdcall SetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID pOwner, BOOL bOwnerDefaulted ); __declspec(dllimport) DWORD __stdcall SetSecurityDescriptorRMControl( PSECURITY_DESCRIPTOR SecurityDescriptor, PUCHAR RMControl ); __declspec(dllimport) BOOL __stdcall SetSecurityDescriptorSacl( PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bSaclPresent, PACL pSacl, BOOL bSaclDefaulted ); __declspec(dllimport) BOOL __stdcall SetTokenInformation( HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength ); __declspec(dllimport) BOOL __stdcall SetCachedSigningLevel( PHANDLE SourceFiles, ULONG SourceFileCount, ULONG Flags, HANDLE TargetFile ); __declspec(dllimport) BOOL __stdcall GetCachedSigningLevel( HANDLE File, PULONG Flags, PULONG SigningLevel, PUCHAR Thumbprint, PULONG ThumbprintSize, PULONG ThumbprintAlgorithm ); __declspec(dllimport) LONG __stdcall CveEventWrite( PCWSTR CveId, PCWSTR AdditionalDetails ); __declspec(dllimport) BOOL __stdcall DeriveCapabilitySidsFromName( LPCWSTR CapName, PSID** CapabilityGroupSids, DWORD* CapabilityGroupSidCount, PSID** CapabilitySids, DWORD* CapabilitySidCount ); } extern "C" { __declspec(dllimport) HANDLE __stdcall CreatePrivateNamespaceW( LPSECURITY_ATTRIBUTES lpPrivateNamespaceAttributes, LPVOID lpBoundaryDescriptor, LPCWSTR lpAliasPrefix ); __declspec(dllimport) HANDLE __stdcall OpenPrivateNamespaceW( LPVOID lpBoundaryDescriptor, LPCWSTR lpAliasPrefix ); __declspec(dllimport) BOOLEAN __stdcall ClosePrivateNamespace( HANDLE Handle, ULONG Flags ); __declspec(dllimport) HANDLE __stdcall CreateBoundaryDescriptorW( LPCWSTR Name, ULONG Flags ); __declspec(dllimport) BOOL __stdcall AddSIDToBoundaryDescriptor( HANDLE* BoundaryDescriptor, PSID RequiredSid ); __declspec(dllimport) void __stdcall DeleteBoundaryDescriptor( HANDLE BoundaryDescriptor ); } extern "C" { __declspec(dllimport) BOOL __stdcall GetNumaHighestNodeNumber( PULONG HighestNodeNumber ); __declspec(dllimport) BOOL __stdcall GetNumaNodeProcessorMaskEx( USHORT Node, PGROUP_AFFINITY ProcessorMask ); __declspec(dllimport) BOOL __stdcall GetNumaProximityNodeEx( ULONG ProximityId, PUSHORT NodeNumber ); } extern "C" { __declspec(dllimport) BOOL __stdcall GetProcessGroupAffinity( HANDLE hProcess, PUSHORT GroupCount, PUSHORT GroupArray ); __declspec(dllimport) BOOL __stdcall GetThreadGroupAffinity( HANDLE hThread, PGROUP_AFFINITY GroupAffinity ); __declspec(dllimport) BOOL __stdcall SetThreadGroupAffinity( HANDLE hThread, const GROUP_AFFINITY* GroupAffinity, PGROUP_AFFINITY PreviousGroupAffinity ); } extern "C" { BOOL __stdcall GetAppContainerNamedObjectPath( HANDLE Token, PSID AppContainerSid, ULONG ObjectPathLength, LPWSTR ObjectPath, PULONG ReturnLength ); } extern "C" { __declspec(dllimport) BOOL __stdcall QueryThreadCycleTime( HANDLE ThreadHandle, PULONG64 CycleTime ); __declspec(dllimport) BOOL __stdcall QueryProcessCycleTime( HANDLE ProcessHandle, PULONG64 CycleTime ); __declspec(dllimport) BOOL __stdcall QueryIdleProcessorCycleTime( PULONG BufferLength, PULONG64 ProcessorIdleCycleTime ); __declspec(dllimport) BOOL __stdcall QueryIdleProcessorCycleTimeEx( USHORT Group, PULONG BufferLength, PULONG64 ProcessorIdleCycleTime ); __declspec(dllimport) void __stdcall QueryInterruptTimePrecise( PULONGLONG lpInterruptTimePrecise ); __declspec(dllimport) void __stdcall QueryUnbiasedInterruptTimePrecise( PULONGLONG lpUnbiasedInterruptTimePrecise ); __declspec(dllimport) void __stdcall QueryInterruptTime( PULONGLONG lpInterruptTime ); __declspec(dllimport) BOOL __stdcall QueryUnbiasedInterruptTime( PULONGLONG UnbiasedTime ); __declspec(dllimport) HRESULT __stdcall QueryAuxiliaryCounterFrequency( PULONGLONG lpAuxiliaryCounterFrequency ); __declspec(dllimport) HRESULT __stdcall ConvertAuxiliaryCounterToPerformanceCounter( ULONGLONG ullAuxiliaryCounterValue, PULONGLONG lpPerformanceCounterValue, PULONGLONG lpConversionError ); __declspec(dllimport) HRESULT __stdcall ConvertPerformanceCounterToAuxiliaryCounter( ULONGLONG ullPerformanceCounterValue, PULONGLONG lpAuxiliaryCounterValue, PULONGLONG lpConversionError ); } extern "C" { typedef void (__stdcall *PFIBER_START_ROUTINE)( LPVOID lpFiberParameter ); typedef PFIBER_START_ROUTINE LPFIBER_START_ROUTINE; typedef LPVOID (__stdcall *PFIBER_CALLOUT_ROUTINE)( LPVOID lpParameter ); typedef LPVOID LPLDT_ENTRY; typedef struct _COMMPROP { WORD wPacketLength; WORD wPacketVersion; DWORD dwServiceMask; DWORD dwReserved1; DWORD dwMaxTxQueue; DWORD dwMaxRxQueue; DWORD dwMaxBaud; DWORD dwProvSubType; DWORD dwProvCapabilities; DWORD dwSettableParams; DWORD dwSettableBaud; WORD wSettableData; WORD wSettableStopParity; DWORD dwCurrentTxQueue; DWORD dwCurrentRxQueue; DWORD dwProvSpec1; DWORD dwProvSpec2; WCHAR wcProvChar[1]; } COMMPROP,*LPCOMMPROP; typedef struct _COMSTAT { DWORD fCtsHold : 1; DWORD fDsrHold : 1; DWORD fRlsdHold : 1; DWORD fXoffHold : 1; DWORD fXoffSent : 1; DWORD fEof : 1; DWORD fTxim : 1; DWORD fReserved : 25; DWORD cbInQue; DWORD cbOutQue; } COMSTAT, *LPCOMSTAT; typedef struct _DCB { DWORD DCBlength; DWORD BaudRate; DWORD fBinary: 1; DWORD fParity: 1; DWORD fOutxCtsFlow:1; DWORD fOutxDsrFlow:1; DWORD fDtrControl:2; DWORD fDsrSensitivity:1; DWORD fTXContinueOnXoff: 1; DWORD fOutX: 1; DWORD fInX: 1; DWORD fErrorChar: 1; DWORD fNull: 1; DWORD fRtsControl:2; DWORD fAbortOnError:1; DWORD fDummy2:17; WORD wReserved; WORD XonLim; WORD XoffLim; BYTE ByteSize; BYTE Parity; BYTE StopBits; char XonChar; char XoffChar; char ErrorChar; char EofChar; char EvtChar; WORD wReserved1; } DCB, *LPDCB; typedef struct _COMMTIMEOUTS { DWORD ReadIntervalTimeout; DWORD ReadTotalTimeoutMultiplier; DWORD ReadTotalTimeoutConstant; DWORD WriteTotalTimeoutMultiplier; DWORD WriteTotalTimeoutConstant; } COMMTIMEOUTS,*LPCOMMTIMEOUTS; typedef struct _COMMCONFIG { DWORD dwSize; WORD wVersion; WORD wReserved; DCB dcb; DWORD dwProviderSubType; DWORD dwProviderOffset; DWORD dwProviderSize; WCHAR wcProviderData[1]; } COMMCONFIG,*LPCOMMCONFIG; typedef struct _MEMORYSTATUS { DWORD dwLength; DWORD dwMemoryLoad; SIZE_T dwTotalPhys; SIZE_T dwAvailPhys; SIZE_T dwTotalPageFile; SIZE_T dwAvailPageFile; SIZE_T dwTotalVirtual; SIZE_T dwAvailVirtual; } MEMORYSTATUS, *LPMEMORYSTATUS; typedef struct _JIT_DEBUG_INFO { DWORD dwSize; DWORD dwProcessorArchitecture; DWORD dwThreadID; DWORD dwReserved0; ULONG64 lpExceptionAddress; ULONG64 lpExceptionRecord; ULONG64 lpContextRecord; } JIT_DEBUG_INFO, *LPJIT_DEBUG_INFO; typedef JIT_DEBUG_INFO JIT_DEBUG_INFO32, *LPJIT_DEBUG_INFO32; typedef JIT_DEBUG_INFO JIT_DEBUG_INFO64, *LPJIT_DEBUG_INFO64; typedef PEXCEPTION_RECORD LPEXCEPTION_RECORD; typedef PEXCEPTION_POINTERS LPEXCEPTION_POINTERS; typedef struct _OFSTRUCT { BYTE cBytes; BYTE fFixedDisk; WORD nErrCode; WORD Reserved1; WORD Reserved2; CHAR szPathName[128]; } OFSTRUCT, *LPOFSTRUCT, *POFSTRUCT; int __stdcall WinMain ( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd ); int __stdcall wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd ); __declspec(dllimport) __declspec(allocator) HGLOBAL __stdcall GlobalAlloc( UINT uFlags, SIZE_T dwBytes ); __declspec(dllimport) __declspec(allocator) HGLOBAL __stdcall GlobalReAlloc ( HGLOBAL hMem, SIZE_T dwBytes, UINT uFlags ); __declspec(dllimport) SIZE_T __stdcall GlobalSize ( HGLOBAL hMem ); __declspec(dllimport) BOOL __stdcall GlobalUnlock( HGLOBAL hMem ); __declspec(dllimport) LPVOID __stdcall GlobalLock ( HGLOBAL hMem ); __declspec(dllimport) UINT __stdcall GlobalFlags ( HGLOBAL hMem ); __declspec(dllimport) HGLOBAL __stdcall GlobalHandle ( LPCVOID pMem ); __declspec(dllimport) HGLOBAL __stdcall GlobalFree( HGLOBAL hMem ); __declspec(dllimport) SIZE_T __stdcall GlobalCompact( DWORD dwMinFree ); __declspec(dllimport) void __stdcall GlobalFix( HGLOBAL hMem ); __declspec(dllimport) void __stdcall GlobalUnfix( HGLOBAL hMem ); __declspec(dllimport) LPVOID __stdcall GlobalWire( HGLOBAL hMem ); __declspec(dllimport) BOOL __stdcall GlobalUnWire( HGLOBAL hMem ); __declspec(dllimport) void __stdcall GlobalMemoryStatus( LPMEMORYSTATUS lpBuffer ); __declspec(dllimport) __declspec(allocator) HLOCAL __stdcall LocalAlloc( UINT uFlags, SIZE_T uBytes ); __declspec(dllimport) __declspec(allocator) HLOCAL __stdcall LocalReAlloc( HLOCAL hMem, SIZE_T uBytes, UINT uFlags ); __declspec(dllimport) LPVOID __stdcall LocalLock( HLOCAL hMem ); __declspec(dllimport) HLOCAL __stdcall LocalHandle( LPCVOID pMem ); __declspec(dllimport) BOOL __stdcall LocalUnlock( HLOCAL hMem ); __declspec(dllimport) SIZE_T __stdcall LocalSize( HLOCAL hMem ); __declspec(dllimport) UINT __stdcall LocalFlags( HLOCAL hMem ); __declspec(dllimport) HLOCAL __stdcall LocalFree( HLOCAL hMem ); __declspec(dllimport) SIZE_T __stdcall LocalShrink( HLOCAL hMem, UINT cbNewSize ); __declspec(dllimport) SIZE_T __stdcall LocalCompact( UINT uMinFree ); __declspec(dllimport) BOOL __stdcall GetBinaryTypeA( LPCSTR lpApplicationName, LPDWORD lpBinaryType ); __declspec(dllimport) BOOL __stdcall GetBinaryTypeW( LPCWSTR lpApplicationName, LPDWORD lpBinaryType ); __declspec(dllimport) DWORD __stdcall GetShortPathNameA( LPCSTR lpszLongPath, LPSTR lpszShortPath, DWORD cchBuffer ); __declspec(dllimport) DWORD __stdcall GetLongPathNameTransactedA( LPCSTR lpszShortPath, LPSTR lpszLongPath, DWORD cchBuffer, HANDLE hTransaction ); __declspec(dllimport) DWORD __stdcall GetLongPathNameTransactedW( LPCWSTR lpszShortPath, LPWSTR lpszLongPath, DWORD cchBuffer, HANDLE hTransaction ); __declspec(dllimport) BOOL __stdcall GetProcessAffinityMask( HANDLE hProcess, PDWORD_PTR lpProcessAffinityMask, PDWORD_PTR lpSystemAffinityMask ); __declspec(dllimport) BOOL __stdcall SetProcessAffinityMask( HANDLE hProcess, DWORD_PTR dwProcessAffinityMask ); __declspec(dllimport) BOOL __stdcall GetProcessIoCounters( HANDLE hProcess, PIO_COUNTERS lpIoCounters ); __declspec(dllimport) BOOL __stdcall GetProcessWorkingSetSize( HANDLE hProcess, PSIZE_T lpMinimumWorkingSetSize, PSIZE_T lpMaximumWorkingSetSize ); __declspec(dllimport) BOOL __stdcall SetProcessWorkingSetSize( HANDLE hProcess, SIZE_T dwMinimumWorkingSetSize, SIZE_T dwMaximumWorkingSetSize ); __declspec(dllimport) void __stdcall FatalExit( int ExitCode ); __declspec(dllimport) BOOL __stdcall SetEnvironmentStringsA( LPCH NewEnvironment ); __declspec(dllimport) void __stdcall SwitchToFiber( LPVOID lpFiber ); __declspec(dllimport) void __stdcall DeleteFiber( LPVOID lpFiber ); __declspec(dllimport) BOOL __stdcall ConvertFiberToThread( void ); __declspec(dllimport) LPVOID __stdcall CreateFiberEx( SIZE_T dwStackCommitSize, SIZE_T dwStackReserveSize, DWORD dwFlags, LPFIBER_START_ROUTINE lpStartAddress, LPVOID lpParameter ); __declspec(dllimport) LPVOID __stdcall ConvertThreadToFiberEx( LPVOID lpParameter, DWORD dwFlags ); __declspec(dllimport) LPVOID __stdcall CreateFiber( SIZE_T dwStackSize, LPFIBER_START_ROUTINE lpStartAddress, LPVOID lpParameter ); __declspec(dllimport) LPVOID __stdcall ConvertThreadToFiber( LPVOID lpParameter ); typedef void *PUMS_CONTEXT; typedef void *PUMS_COMPLETION_LIST; typedef enum _RTL_UMS_THREAD_INFO_CLASS UMS_THREAD_INFO_CLASS, *PUMS_THREAD_INFO_CLASS; typedef enum _RTL_UMS_SCHEDULER_REASON UMS_SCHEDULER_REASON; typedef PRTL_UMS_SCHEDULER_ENTRY_POINT PUMS_SCHEDULER_ENTRY_POINT; typedef struct _UMS_SCHEDULER_STARTUP_INFO { ULONG UmsVersion; PUMS_COMPLETION_LIST CompletionList; PUMS_SCHEDULER_ENTRY_POINT SchedulerProc; PVOID SchedulerParam; } UMS_SCHEDULER_STARTUP_INFO, *PUMS_SCHEDULER_STARTUP_INFO; typedef struct _UMS_SYSTEM_THREAD_INFORMATION { ULONG UmsVersion; union { struct { ULONG IsUmsSchedulerThread : 1; ULONG IsUmsWorkerThread : 1; } ; ULONG ThreadUmsFlags; } ; } UMS_SYSTEM_THREAD_INFORMATION, *PUMS_SYSTEM_THREAD_INFORMATION; __declspec(dllimport) BOOL __stdcall CreateUmsCompletionList( PUMS_COMPLETION_LIST* UmsCompletionList ); __declspec(dllimport) BOOL __stdcall DequeueUmsCompletionListItems( PUMS_COMPLETION_LIST UmsCompletionList, DWORD WaitTimeOut, PUMS_CONTEXT* UmsThreadList ); __declspec(dllimport) BOOL __stdcall GetUmsCompletionListEvent( PUMS_COMPLETION_LIST UmsCompletionList, PHANDLE UmsCompletionEvent ); __declspec(dllimport) BOOL __stdcall ExecuteUmsThread( PUMS_CONTEXT UmsThread ); __declspec(dllimport) BOOL __stdcall UmsThreadYield( PVOID SchedulerParam ); __declspec(dllimport) BOOL __stdcall DeleteUmsCompletionList( PUMS_COMPLETION_LIST UmsCompletionList ); __declspec(dllimport) PUMS_CONTEXT __stdcall GetCurrentUmsThread( void ); __declspec(dllimport) PUMS_CONTEXT __stdcall GetNextUmsListItem( PUMS_CONTEXT UmsContext ); __declspec(dllimport) BOOL __stdcall QueryUmsThreadInformation( PUMS_CONTEXT UmsThread, UMS_THREAD_INFO_CLASS UmsThreadInfoClass, PVOID UmsThreadInformation, ULONG UmsThreadInformationLength, PULONG ReturnLength ); __declspec(dllimport) BOOL __stdcall SetUmsThreadInformation( PUMS_CONTEXT UmsThread, UMS_THREAD_INFO_CLASS UmsThreadInfoClass, PVOID UmsThreadInformation, ULONG UmsThreadInformationLength ); __declspec(dllimport) BOOL __stdcall DeleteUmsThreadContext( PUMS_CONTEXT UmsThread ); __declspec(dllimport) BOOL __stdcall CreateUmsThreadContext( PUMS_CONTEXT *lpUmsThread ); __declspec(dllimport) BOOL __stdcall EnterUmsSchedulingMode( PUMS_SCHEDULER_STARTUP_INFO SchedulerStartupInfo ); __declspec(dllimport) BOOL __stdcall GetUmsSystemThreadInformation( HANDLE ThreadHandle, PUMS_SYSTEM_THREAD_INFORMATION SystemThreadInfo ); __declspec(dllimport) DWORD_PTR __stdcall SetThreadAffinityMask( HANDLE hThread, DWORD_PTR dwThreadAffinityMask ); __declspec(dllimport) BOOL __stdcall SetProcessDEPPolicy( DWORD dwFlags ); __declspec(dllimport) BOOL __stdcall GetProcessDEPPolicy( HANDLE hProcess, LPDWORD lpFlags, PBOOL lpPermanent ); __declspec(dllimport) BOOL __stdcall RequestWakeupLatency( LATENCY_TIME latency ); __declspec(dllimport) BOOL __stdcall IsSystemResumeAutomatic( void ); __declspec(dllimport) BOOL __stdcall GetThreadSelectorEntry( HANDLE hThread, DWORD dwSelector, LPLDT_ENTRY lpSelectorEntry ); __declspec(dllimport) EXECUTION_STATE __stdcall SetThreadExecutionState( EXECUTION_STATE esFlags ); typedef REASON_CONTEXT POWER_REQUEST_CONTEXT, *PPOWER_REQUEST_CONTEXT, *LPPOWER_REQUEST_CONTEXT; __declspec(dllimport) HANDLE __stdcall PowerCreateRequest ( PREASON_CONTEXT Context ); __declspec(dllimport) BOOL __stdcall PowerSetRequest ( HANDLE PowerRequest, POWER_REQUEST_TYPE RequestType ); __declspec(dllimport) BOOL __stdcall PowerClearRequest ( HANDLE PowerRequest, POWER_REQUEST_TYPE RequestType ); __declspec(dllimport) BOOL __stdcall SetFileCompletionNotificationModes( HANDLE FileHandle, UCHAR Flags ); __declspec(dllimport) BOOL __stdcall Wow64GetThreadContext( HANDLE hThread, PWOW64_CONTEXT lpContext ); __declspec(dllimport) BOOL __stdcall Wow64SetThreadContext( HANDLE hThread, const WOW64_CONTEXT *lpContext ); __declspec(dllimport) BOOL __stdcall Wow64GetThreadSelectorEntry( HANDLE hThread, DWORD dwSelector, PWOW64_LDT_ENTRY lpSelectorEntry ); __declspec(dllimport) DWORD __stdcall Wow64SuspendThread( HANDLE hThread ); __declspec(dllimport) BOOL __stdcall DebugSetProcessKillOnExit( BOOL KillOnExit ); __declspec(dllimport) BOOL __stdcall DebugBreakProcess ( HANDLE Process ); __declspec(dllimport) BOOL __stdcall PulseEvent( HANDLE hEvent ); __declspec(dllimport) ATOM __stdcall GlobalDeleteAtom( ATOM nAtom ); __declspec(dllimport) BOOL __stdcall InitAtomTable( DWORD nSize ); __declspec(dllimport) ATOM __stdcall DeleteAtom( ATOM nAtom ); __declspec(dllimport) UINT __stdcall SetHandleCount( UINT uNumber ); __declspec(dllimport) BOOL __stdcall RequestDeviceWakeup( HANDLE hDevice ); __declspec(dllimport) BOOL __stdcall CancelDeviceWakeupRequest( HANDLE hDevice ); __declspec(dllimport) BOOL __stdcall GetDevicePowerState( HANDLE hDevice, BOOL *pfOn ); __declspec(dllimport) BOOL __stdcall SetMessageWaitingIndicator( HANDLE hMsgIndicator, ULONG ulMsgCount ); __declspec(dllimport) BOOL __stdcall SetFileShortNameA( HANDLE hFile, LPCSTR lpShortName ); __declspec(dllimport) BOOL __stdcall SetFileShortNameW( HANDLE hFile, LPCWSTR lpShortName ); __declspec(dllimport) DWORD __stdcall LoadModule( LPCSTR lpModuleName, LPVOID lpParameterBlock ); __declspec(dllimport) UINT __stdcall WinExec( LPCSTR lpCmdLine, UINT uCmdShow ); __declspec(dllimport) BOOL __stdcall ClearCommBreak( HANDLE hFile ); __declspec(dllimport) BOOL __stdcall ClearCommError( HANDLE hFile, LPDWORD lpErrors, LPCOMSTAT lpStat ); __declspec(dllimport) BOOL __stdcall SetupComm( HANDLE hFile, DWORD dwInQueue, DWORD dwOutQueue ); __declspec(dllimport) BOOL __stdcall EscapeCommFunction( HANDLE hFile, DWORD dwFunc ); __declspec(dllimport) BOOL __stdcall GetCommConfig( HANDLE hCommDev, LPCOMMCONFIG lpCC, LPDWORD lpdwSize ); __declspec(dllimport) BOOL __stdcall GetCommMask( HANDLE hFile, LPDWORD lpEvtMask ); __declspec(dllimport) BOOL __stdcall GetCommProperties( HANDLE hFile, LPCOMMPROP lpCommProp ); __declspec(dllimport) BOOL __stdcall GetCommModemStatus( HANDLE hFile, LPDWORD lpModemStat ); __declspec(dllimport) BOOL __stdcall GetCommState( HANDLE hFile, LPDCB lpDCB ); __declspec(dllimport) BOOL __stdcall GetCommTimeouts( HANDLE hFile, LPCOMMTIMEOUTS lpCommTimeouts ); __declspec(dllimport) BOOL __stdcall PurgeComm( HANDLE hFile, DWORD dwFlags ); __declspec(dllimport) BOOL __stdcall SetCommBreak( HANDLE hFile ); __declspec(dllimport) BOOL __stdcall SetCommConfig( HANDLE hCommDev, LPCOMMCONFIG lpCC, DWORD dwSize ); __declspec(dllimport) BOOL __stdcall SetCommMask( HANDLE hFile, DWORD dwEvtMask ); __declspec(dllimport) BOOL __stdcall SetCommState( HANDLE hFile, LPDCB lpDCB ); __declspec(dllimport) BOOL __stdcall SetCommTimeouts( HANDLE hFile, LPCOMMTIMEOUTS lpCommTimeouts ); __declspec(dllimport) BOOL __stdcall TransmitCommChar( HANDLE hFile, char cChar ); __declspec(dllimport) BOOL __stdcall WaitCommEvent( HANDLE hFile, LPDWORD lpEvtMask, LPOVERLAPPED lpOverlapped ); __declspec(dllimport) DWORD __stdcall SetTapePosition( HANDLE hDevice, DWORD dwPositionMethod, DWORD dwPartition, DWORD dwOffsetLow, DWORD dwOffsetHigh, BOOL bImmediate ); __declspec(dllimport) DWORD __stdcall GetTapePosition( HANDLE hDevice, DWORD dwPositionType, LPDWORD lpdwPartition, LPDWORD lpdwOffsetLow, LPDWORD lpdwOffsetHigh ); __declspec(dllimport) DWORD __stdcall PrepareTape( HANDLE hDevice, DWORD dwOperation, BOOL bImmediate ); __declspec(dllimport) DWORD __stdcall EraseTape( HANDLE hDevice, DWORD dwEraseType, BOOL bImmediate ); __declspec(dllimport) DWORD __stdcall CreateTapePartition( HANDLE hDevice, DWORD dwPartitionMethod, DWORD dwCount, DWORD dwSize ); __declspec(dllimport) DWORD __stdcall WriteTapemark( HANDLE hDevice, DWORD dwTapemarkType, DWORD dwTapemarkCount, BOOL bImmediate ); __declspec(dllimport) DWORD __stdcall GetTapeStatus( HANDLE hDevice ); __declspec(dllimport) DWORD __stdcall GetTapeParameters( HANDLE hDevice, DWORD dwOperation, LPDWORD lpdwSize, LPVOID lpTapeInformation ); __declspec(dllimport) DWORD __stdcall SetTapeParameters( HANDLE hDevice, DWORD dwOperation, LPVOID lpTapeInformation ); __declspec(dllimport) int __stdcall MulDiv( int nNumber, int nNumerator, int nDenominator ); typedef enum _DEP_SYSTEM_POLICY_TYPE { DEPPolicyAlwaysOff = 0, DEPPolicyAlwaysOn, DEPPolicyOptIn, DEPPolicyOptOut, DEPTotalPolicyCount } DEP_SYSTEM_POLICY_TYPE; __declspec(dllimport) DEP_SYSTEM_POLICY_TYPE __stdcall GetSystemDEPPolicy( void ); __declspec(dllimport) BOOL __stdcall GetSystemRegistryQuota( PDWORD pdwQuotaAllowed, PDWORD pdwQuotaUsed ); __declspec(dllimport) BOOL __stdcall FileTimeToDosDateTime( const FILETIME *lpFileTime, LPWORD lpFatDate, LPWORD lpFatTime ); __declspec(dllimport) BOOL __stdcall DosDateTimeToFileTime( WORD wFatDate, WORD wFatTime, LPFILETIME lpFileTime ); __declspec(dllimport) DWORD __stdcall FormatMessageA( DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPSTR lpBuffer, DWORD nSize, va_list *Arguments ); __declspec(dllimport) DWORD __stdcall FormatMessageW( DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, va_list *Arguments ); __declspec(dllimport) HANDLE __stdcall CreateMailslotA( LPCSTR lpName, DWORD nMaxMessageSize, DWORD lReadTimeout, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); __declspec(dllimport) HANDLE __stdcall CreateMailslotW( LPCWSTR lpName, DWORD nMaxMessageSize, DWORD lReadTimeout, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); __declspec(dllimport) BOOL __stdcall GetMailslotInfo( HANDLE hMailslot, LPDWORD lpMaxMessageSize, LPDWORD lpNextSize, LPDWORD lpMessageCount, LPDWORD lpReadTimeout ); __declspec(dllimport) BOOL __stdcall SetMailslotInfo( HANDLE hMailslot, DWORD lReadTimeout ); __declspec(dllimport) BOOL __stdcall EncryptFileA( LPCSTR lpFileName ); __declspec(dllimport) BOOL __stdcall EncryptFileW( LPCWSTR lpFileName ); __declspec(dllimport) BOOL __stdcall DecryptFileA( LPCSTR lpFileName, DWORD dwReserved ); __declspec(dllimport) BOOL __stdcall DecryptFileW( LPCWSTR lpFileName, DWORD dwReserved ); __declspec(dllimport) BOOL __stdcall FileEncryptionStatusA( LPCSTR lpFileName, LPDWORD lpStatus ); __declspec(dllimport) BOOL __stdcall FileEncryptionStatusW( LPCWSTR lpFileName, LPDWORD lpStatus ); typedef DWORD (__stdcall *PFE_EXPORT_FUNC)( PBYTE pbData, PVOID pvCallbackContext, ULONG ulLength ); typedef DWORD (__stdcall *PFE_IMPORT_FUNC)( PBYTE pbData, PVOID pvCallbackContext, PULONG ulLength ); __declspec(dllimport) DWORD __stdcall OpenEncryptedFileRawA( LPCSTR lpFileName, ULONG ulFlags, PVOID *pvContext ); __declspec(dllimport) DWORD __stdcall OpenEncryptedFileRawW( LPCWSTR lpFileName, ULONG ulFlags, PVOID *pvContext ); __declspec(dllimport) DWORD __stdcall ReadEncryptedFileRaw( PFE_EXPORT_FUNC pfExportCallback, PVOID pvCallbackContext, PVOID pvContext ); __declspec(dllimport) DWORD __stdcall WriteEncryptedFileRaw( PFE_IMPORT_FUNC pfImportCallback, PVOID pvCallbackContext, PVOID pvContext ); __declspec(dllimport) void __stdcall CloseEncryptedFileRaw( PVOID pvContext ); __declspec(dllimport) int __stdcall lstrcmpA( LPCSTR lpString1, LPCSTR lpString2 ); __declspec(dllimport) int __stdcall lstrcmpW( LPCWSTR lpString1, LPCWSTR lpString2 ); __declspec(dllimport) int __stdcall lstrcmpiA( LPCSTR lpString1, LPCSTR lpString2 ); __declspec(dllimport) int __stdcall lstrcmpiW( LPCWSTR lpString1, LPCWSTR lpString2 ); #pragma warning(push) #pragma warning(disable: 4995) __declspec(dllimport) LPSTR __stdcall lstrcpynA( LPSTR lpString1, LPCSTR lpString2, int iMaxLength ); __declspec(dllimport) LPWSTR __stdcall lstrcpynW( LPWSTR lpString1, LPCWSTR lpString2, int iMaxLength ); __declspec(dllimport) LPSTR __stdcall lstrcpyA( LPSTR lpString1, LPCSTR lpString2 ); __declspec(dllimport) LPWSTR __stdcall lstrcpyW( LPWSTR lpString1, LPCWSTR lpString2 ); __declspec(dllimport) LPSTR __stdcall lstrcatA( LPSTR lpString1, LPCSTR lpString2 ); __declspec(dllimport) LPWSTR __stdcall lstrcatW( LPWSTR lpString1, LPCWSTR lpString2 ); #pragma warning(pop) __declspec(dllimport) int __stdcall lstrlenA( LPCSTR lpString ); __declspec(dllimport) int __stdcall lstrlenW( LPCWSTR lpString ); __declspec(dllimport) HFILE __stdcall OpenFile( LPCSTR lpFileName, LPOFSTRUCT lpReOpenBuff, UINT uStyle ); __declspec(dllimport) HFILE __stdcall _lopen( LPCSTR lpPathName, int iReadWrite ); __declspec(dllimport) HFILE __stdcall _lcreat( LPCSTR lpPathName, int iAttribute ); __declspec(dllimport) UINT __stdcall _lread( HFILE hFile, LPVOID lpBuffer, UINT uBytes ); __declspec(dllimport) UINT __stdcall _lwrite( HFILE hFile, LPCCH lpBuffer, UINT uBytes ); __declspec(dllimport) long __stdcall _hread( HFILE hFile, LPVOID lpBuffer, long lBytes ); __declspec(dllimport) long __stdcall _hwrite( HFILE hFile, LPCCH lpBuffer, long lBytes ); __declspec(dllimport) HFILE __stdcall _lclose( HFILE hFile ); __declspec(dllimport) LONG __stdcall _llseek( HFILE hFile, LONG lOffset, int iOrigin ); __declspec(dllimport) BOOL __stdcall IsTextUnicode( const void* lpv, int iSize, LPINT lpiResult ); __declspec(dllimport) DWORD __stdcall SignalObjectAndWait( HANDLE hObjectToSignal, HANDLE hObjectToWaitOn, DWORD dwMilliseconds, BOOL bAlertable ); __declspec(dllimport) BOOL __stdcall BackupRead( HANDLE hFile, LPBYTE lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, BOOL bAbort, BOOL bProcessSecurity, LPVOID *lpContext ); __declspec(dllimport) BOOL __stdcall BackupSeek( HANDLE hFile, DWORD dwLowBytesToSeek, DWORD dwHighBytesToSeek, LPDWORD lpdwLowByteSeeked, LPDWORD lpdwHighByteSeeked, LPVOID *lpContext ); __declspec(dllimport) BOOL __stdcall BackupWrite( HANDLE hFile, LPBYTE lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, BOOL bAbort, BOOL bProcessSecurity, LPVOID *lpContext ); typedef struct _WIN32_STREAM_ID { DWORD dwStreamId ; DWORD dwStreamAttributes ; LARGE_INTEGER Size ; DWORD dwStreamNameSize ; WCHAR cStreamName[ 1 ] ; } WIN32_STREAM_ID, *LPWIN32_STREAM_ID ; typedef struct _STARTUPINFOEXA { STARTUPINFOA StartupInfo; LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList; } STARTUPINFOEXA, *LPSTARTUPINFOEXA; typedef struct _STARTUPINFOEXW { STARTUPINFOW StartupInfo; LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList; } STARTUPINFOEXW, *LPSTARTUPINFOEXW; typedef STARTUPINFOEXW STARTUPINFOEX; typedef LPSTARTUPINFOEXW LPSTARTUPINFOEX; __declspec(dllimport) HANDLE __stdcall OpenMutexA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName ); __declspec(dllimport) HANDLE __stdcall CreateSemaphoreA( LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCSTR lpName ); __declspec(dllimport) HANDLE __stdcall OpenSemaphoreA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName ); __declspec(dllimport) HANDLE __stdcall CreateWaitableTimerA( LPSECURITY_ATTRIBUTES lpTimerAttributes, BOOL bManualReset, LPCSTR lpTimerName ); __declspec(dllimport) HANDLE __stdcall OpenWaitableTimerA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpTimerName ); __declspec(dllimport) HANDLE __stdcall CreateSemaphoreExA( LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCSTR lpName, DWORD dwFlags, DWORD dwDesiredAccess ); __declspec(dllimport) HANDLE __stdcall CreateWaitableTimerExA( LPSECURITY_ATTRIBUTES lpTimerAttributes, LPCSTR lpTimerName, DWORD dwFlags, DWORD dwDesiredAccess ); __declspec(dllimport) HANDLE __stdcall CreateFileMappingA( HANDLE hFile, LPSECURITY_ATTRIBUTES lpFileMappingAttributes, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCSTR lpName ); __declspec(dllimport) HANDLE __stdcall CreateFileMappingNumaA( HANDLE hFile, LPSECURITY_ATTRIBUTES lpFileMappingAttributes, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCSTR lpName, DWORD nndPreferred ); __declspec(dllimport) HANDLE __stdcall OpenFileMappingA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName ); __declspec(dllimport) DWORD __stdcall GetLogicalDriveStringsA( DWORD nBufferLength, LPSTR lpBuffer ); __declspec(dllimport) HMODULE __stdcall LoadPackagedLibrary ( LPCWSTR lpwLibFileName, DWORD Reserved ); __declspec(dllimport) BOOL __stdcall QueryFullProcessImageNameA( HANDLE hProcess, DWORD dwFlags, LPSTR lpExeName, PDWORD lpdwSize ); __declspec(dllimport) BOOL __stdcall QueryFullProcessImageNameW( HANDLE hProcess, DWORD dwFlags, LPWSTR lpExeName, PDWORD lpdwSize ); typedef enum _PROC_THREAD_ATTRIBUTE_NUM { ProcThreadAttributeParentProcess = 0, ProcThreadAttributeHandleList = 2, ProcThreadAttributeGroupAffinity = 3, ProcThreadAttributePreferredNode = 4, ProcThreadAttributeIdealProcessor = 5, ProcThreadAttributeUmsThread = 6, ProcThreadAttributeMitigationPolicy = 7, ProcThreadAttributeSecurityCapabilities = 9, ProcThreadAttributeProtectionLevel = 11, ProcThreadAttributeJobList = 13, ProcThreadAttributeChildProcessPolicy = 14, ProcThreadAttributeAllApplicationPackagesPolicy = 15, ProcThreadAttributeWin32kFilter = 16, ProcThreadAttributeSafeOpenPromptOriginClaim = 17, ProcThreadAttributeDesktopAppPolicy = 18, } PROC_THREAD_ATTRIBUTE_NUM; __declspec(dllimport) void __stdcall GetStartupInfoA( LPSTARTUPINFOA lpStartupInfo ); __declspec(dllimport) DWORD __stdcall GetFirmwareEnvironmentVariableA( LPCSTR lpName, LPCSTR lpGuid, PVOID pBuffer, DWORD nSize ); __declspec(dllimport) DWORD __stdcall GetFirmwareEnvironmentVariableW( LPCWSTR lpName, LPCWSTR lpGuid, PVOID pBuffer, DWORD nSize ); __declspec(dllimport) DWORD __stdcall GetFirmwareEnvironmentVariableExA( LPCSTR lpName, LPCSTR lpGuid, PVOID pBuffer, DWORD nSize, PDWORD pdwAttribubutes ); __declspec(dllimport) DWORD __stdcall GetFirmwareEnvironmentVariableExW( LPCWSTR lpName, LPCWSTR lpGuid, PVOID pBuffer, DWORD nSize, PDWORD pdwAttribubutes ); __declspec(dllimport) BOOL __stdcall SetFirmwareEnvironmentVariableA( LPCSTR lpName, LPCSTR lpGuid, PVOID pValue, DWORD nSize ); __declspec(dllimport) BOOL __stdcall SetFirmwareEnvironmentVariableW( LPCWSTR lpName, LPCWSTR lpGuid, PVOID pValue, DWORD nSize ); __declspec(dllimport) BOOL __stdcall SetFirmwareEnvironmentVariableExA( LPCSTR lpName, LPCSTR lpGuid, PVOID pValue, DWORD nSize, DWORD dwAttributes ); __declspec(dllimport) BOOL __stdcall SetFirmwareEnvironmentVariableExW( LPCWSTR lpName, LPCWSTR lpGuid, PVOID pValue, DWORD nSize, DWORD dwAttributes ); __declspec(dllimport) BOOL __stdcall GetFirmwareType ( PFIRMWARE_TYPE FirmwareType ); __declspec(dllimport) BOOL __stdcall IsNativeVhdBoot ( PBOOL NativeVhdBoot ); __declspec(dllimport) HRSRC __stdcall FindResourceA( HMODULE hModule, LPCSTR lpName, LPCSTR lpType ); __declspec(dllimport) HRSRC __stdcall FindResourceExA( HMODULE hModule, LPCSTR lpType, LPCSTR lpName, WORD wLanguage ); __declspec(dllimport) BOOL __stdcall EnumResourceTypesA( HMODULE hModule, ENUMRESTYPEPROCA lpEnumFunc, LONG_PTR lParam ); __declspec(dllimport) BOOL __stdcall EnumResourceTypesW( HMODULE hModule, ENUMRESTYPEPROCW lpEnumFunc, LONG_PTR lParam ); __declspec(dllimport) BOOL __stdcall EnumResourceNamesA( HMODULE hModule, LPCSTR lpType, ENUMRESNAMEPROCA lpEnumFunc, LONG_PTR lParam ); __declspec(dllimport) BOOL __stdcall EnumResourceLanguagesA( HMODULE hModule, LPCSTR lpType, LPCSTR lpName, ENUMRESLANGPROCA lpEnumFunc, LONG_PTR lParam ); __declspec(dllimport) BOOL __stdcall EnumResourceLanguagesW( HMODULE hModule, LPCWSTR lpType, LPCWSTR lpName, ENUMRESLANGPROCW lpEnumFunc, LONG_PTR lParam ); __declspec(dllimport) HANDLE __stdcall BeginUpdateResourceA( LPCSTR pFileName, BOOL bDeleteExistingResources ); __declspec(dllimport) HANDLE __stdcall BeginUpdateResourceW( LPCWSTR pFileName, BOOL bDeleteExistingResources ); __declspec(dllimport) BOOL __stdcall UpdateResourceA( HANDLE hUpdate, LPCSTR lpType, LPCSTR lpName, WORD wLanguage, LPVOID lpData, DWORD cb ); __declspec(dllimport) BOOL __stdcall UpdateResourceW( HANDLE hUpdate, LPCWSTR lpType, LPCWSTR lpName, WORD wLanguage, LPVOID lpData, DWORD cb ); __declspec(dllimport) BOOL __stdcall EndUpdateResourceA( HANDLE hUpdate, BOOL fDiscard ); __declspec(dllimport) BOOL __stdcall EndUpdateResourceW( HANDLE hUpdate, BOOL fDiscard ); __declspec(dllimport) ATOM __stdcall GlobalAddAtomA( LPCSTR lpString ); __declspec(dllimport) ATOM __stdcall GlobalAddAtomW( LPCWSTR lpString ); __declspec(dllimport) ATOM __stdcall GlobalAddAtomExA( LPCSTR lpString, DWORD Flags ); __declspec(dllimport) ATOM __stdcall GlobalAddAtomExW( LPCWSTR lpString, DWORD Flags ); __declspec(dllimport) ATOM __stdcall GlobalFindAtomA( LPCSTR lpString ); __declspec(dllimport) ATOM __stdcall GlobalFindAtomW( LPCWSTR lpString ); __declspec(dllimport) UINT __stdcall GlobalGetAtomNameA( ATOM nAtom, LPSTR lpBuffer, int nSize ); __declspec(dllimport) UINT __stdcall GlobalGetAtomNameW( ATOM nAtom, LPWSTR lpBuffer, int nSize ); __declspec(dllimport) ATOM __stdcall AddAtomA( LPCSTR lpString ); __declspec(dllimport) ATOM __stdcall AddAtomW( LPCWSTR lpString ); __declspec(dllimport) ATOM __stdcall FindAtomA( LPCSTR lpString ); __declspec(dllimport) ATOM __stdcall FindAtomW( LPCWSTR lpString ); __declspec(dllimport) UINT __stdcall GetAtomNameA( ATOM nAtom, LPSTR lpBuffer, int nSize ); __declspec(dllimport) UINT __stdcall GetAtomNameW( ATOM nAtom, LPWSTR lpBuffer, int nSize ); __declspec(dllimport) UINT __stdcall GetProfileIntA( LPCSTR lpAppName, LPCSTR lpKeyName, INT nDefault ); __declspec(dllimport) UINT __stdcall GetProfileIntW( LPCWSTR lpAppName, LPCWSTR lpKeyName, INT nDefault ); __declspec(dllimport) DWORD __stdcall GetProfileStringA( LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpDefault, LPSTR lpReturnedString, DWORD nSize ); __declspec(dllimport) DWORD __stdcall GetProfileStringW( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, LPWSTR lpReturnedString, DWORD nSize ); __declspec(dllimport) BOOL __stdcall WriteProfileStringA( LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpString ); __declspec(dllimport) BOOL __stdcall WriteProfileStringW( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpString ); __declspec(dllimport) DWORD __stdcall GetProfileSectionA( LPCSTR lpAppName, LPSTR lpReturnedString, DWORD nSize ); __declspec(dllimport) DWORD __stdcall GetProfileSectionW( LPCWSTR lpAppName, LPWSTR lpReturnedString, DWORD nSize ); __declspec(dllimport) BOOL __stdcall WriteProfileSectionA( LPCSTR lpAppName, LPCSTR lpString ); __declspec(dllimport) BOOL __stdcall WriteProfileSectionW( LPCWSTR lpAppName, LPCWSTR lpString ); __declspec(dllimport) UINT __stdcall GetPrivateProfileIntA( LPCSTR lpAppName, LPCSTR lpKeyName, INT nDefault, LPCSTR lpFileName ); __declspec(dllimport) UINT __stdcall GetPrivateProfileIntW( LPCWSTR lpAppName, LPCWSTR lpKeyName, INT nDefault, LPCWSTR lpFileName ); __declspec(dllimport) DWORD __stdcall GetPrivateProfileStringA( LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpDefault, LPSTR lpReturnedString, DWORD nSize, LPCSTR lpFileName ); __declspec(dllimport) DWORD __stdcall GetPrivateProfileStringW( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName ); __declspec(dllimport) BOOL __stdcall WritePrivateProfileStringA( LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpString, LPCSTR lpFileName ); __declspec(dllimport) BOOL __stdcall WritePrivateProfileStringW( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpString, LPCWSTR lpFileName ); __declspec(dllimport) DWORD __stdcall GetPrivateProfileSectionA( LPCSTR lpAppName, LPSTR lpReturnedString, DWORD nSize, LPCSTR lpFileName ); __declspec(dllimport) DWORD __stdcall GetPrivateProfileSectionW( LPCWSTR lpAppName, LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName ); __declspec(dllimport) BOOL __stdcall WritePrivateProfileSectionA( LPCSTR lpAppName, LPCSTR lpString, LPCSTR lpFileName ); __declspec(dllimport) BOOL __stdcall WritePrivateProfileSectionW( LPCWSTR lpAppName, LPCWSTR lpString, LPCWSTR lpFileName ); __declspec(dllimport) DWORD __stdcall GetPrivateProfileSectionNamesA( LPSTR lpszReturnBuffer, DWORD nSize, LPCSTR lpFileName ); __declspec(dllimport) DWORD __stdcall GetPrivateProfileSectionNamesW( LPWSTR lpszReturnBuffer, DWORD nSize, LPCWSTR lpFileName ); __declspec(dllimport) BOOL __stdcall GetPrivateProfileStructA( LPCSTR lpszSection, LPCSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, LPCSTR szFile ); __declspec(dllimport) BOOL __stdcall GetPrivateProfileStructW( LPCWSTR lpszSection, LPCWSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, LPCWSTR szFile ); __declspec(dllimport) BOOL __stdcall WritePrivateProfileStructA( LPCSTR lpszSection, LPCSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, LPCSTR szFile ); __declspec(dllimport) BOOL __stdcall WritePrivateProfileStructW( LPCWSTR lpszSection, LPCWSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, LPCWSTR szFile ); __declspec(dllimport) BOOLEAN __stdcall Wow64EnableWow64FsRedirection ( BOOLEAN Wow64FsEnableRedirection ); typedef UINT (__stdcall* PGET_SYSTEM_WOW64_DIRECTORY_A)( LPSTR lpBuffer, UINT uSize); typedef UINT (__stdcall* PGET_SYSTEM_WOW64_DIRECTORY_W)( LPWSTR lpBuffer, UINT uSize); __declspec(dllimport) BOOL __stdcall SetDllDirectoryA( LPCSTR lpPathName ); __declspec(dllimport) BOOL __stdcall SetDllDirectoryW( LPCWSTR lpPathName ); __declspec(dllimport) DWORD __stdcall GetDllDirectoryA( DWORD nBufferLength, LPSTR lpBuffer ); __declspec(dllimport) DWORD __stdcall GetDllDirectoryW( DWORD nBufferLength, LPWSTR lpBuffer ); __declspec(dllimport) BOOL __stdcall SetSearchPathMode ( DWORD Flags ); __declspec(dllimport) BOOL __stdcall CreateDirectoryExA( LPCSTR lpTemplateDirectory, LPCSTR lpNewDirectory, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); __declspec(dllimport) BOOL __stdcall CreateDirectoryExW( LPCWSTR lpTemplateDirectory, LPCWSTR lpNewDirectory, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); __declspec(dllimport) BOOL __stdcall CreateDirectoryTransactedA( LPCSTR lpTemplateDirectory, LPCSTR lpNewDirectory, LPSECURITY_ATTRIBUTES lpSecurityAttributes, HANDLE hTransaction ); __declspec(dllimport) BOOL __stdcall CreateDirectoryTransactedW( LPCWSTR lpTemplateDirectory, LPCWSTR lpNewDirectory, LPSECURITY_ATTRIBUTES lpSecurityAttributes, HANDLE hTransaction ); __declspec(dllimport) BOOL __stdcall RemoveDirectoryTransactedA( LPCSTR lpPathName, HANDLE hTransaction ); __declspec(dllimport) BOOL __stdcall RemoveDirectoryTransactedW( LPCWSTR lpPathName, HANDLE hTransaction ); __declspec(dllimport) DWORD __stdcall GetFullPathNameTransactedA( LPCSTR lpFileName, DWORD nBufferLength, LPSTR lpBuffer, LPSTR *lpFilePart, HANDLE hTransaction ); __declspec(dllimport) DWORD __stdcall GetFullPathNameTransactedW( LPCWSTR lpFileName, DWORD nBufferLength, LPWSTR lpBuffer, LPWSTR *lpFilePart, HANDLE hTransaction ); __declspec(dllimport) BOOL __stdcall DefineDosDeviceA( DWORD dwFlags, LPCSTR lpDeviceName, LPCSTR lpTargetPath ); __declspec(dllimport) DWORD __stdcall QueryDosDeviceA( LPCSTR lpDeviceName, LPSTR lpTargetPath, DWORD ucchMax ); __declspec(dllimport) HANDLE __stdcall CreateFileTransactedA( LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile, HANDLE hTransaction, PUSHORT pusMiniVersion, PVOID lpExtendedParameter ); __declspec(dllimport) HANDLE __stdcall CreateFileTransactedW( LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile, HANDLE hTransaction, PUSHORT pusMiniVersion, PVOID lpExtendedParameter ); __declspec(dllimport) HANDLE __stdcall ReOpenFile( HANDLE hOriginalFile, DWORD dwDesiredAccess, DWORD dwShareMode, DWORD dwFlagsAndAttributes ); __declspec(dllimport) BOOL __stdcall SetFileAttributesTransactedA( LPCSTR lpFileName, DWORD dwFileAttributes, HANDLE hTransaction ); __declspec(dllimport) BOOL __stdcall SetFileAttributesTransactedW( LPCWSTR lpFileName, DWORD dwFileAttributes, HANDLE hTransaction ); __declspec(dllimport) BOOL __stdcall GetFileAttributesTransactedA( LPCSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation, HANDLE hTransaction ); __declspec(dllimport) BOOL __stdcall GetFileAttributesTransactedW( LPCWSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation, HANDLE hTransaction ); __declspec(dllimport) DWORD __stdcall GetCompressedFileSizeTransactedA( LPCSTR lpFileName, LPDWORD lpFileSizeHigh, HANDLE hTransaction ); __declspec(dllimport) DWORD __stdcall GetCompressedFileSizeTransactedW( LPCWSTR lpFileName, LPDWORD lpFileSizeHigh, HANDLE hTransaction ); __declspec(dllimport) BOOL __stdcall DeleteFileTransactedA( LPCSTR lpFileName, HANDLE hTransaction ); __declspec(dllimport) BOOL __stdcall DeleteFileTransactedW( LPCWSTR lpFileName, HANDLE hTransaction ); __declspec(dllimport) BOOL __stdcall CheckNameLegalDOS8Dot3A( LPCSTR lpName, LPSTR lpOemName, DWORD OemNameSize, PBOOL pbNameContainsSpaces , PBOOL pbNameLegal ); __declspec(dllimport) BOOL __stdcall CheckNameLegalDOS8Dot3W( LPCWSTR lpName, LPSTR lpOemName, DWORD OemNameSize, PBOOL pbNameContainsSpaces , PBOOL pbNameLegal ); __declspec(dllimport) HANDLE __stdcall FindFirstFileTransactedA( LPCSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags, HANDLE hTransaction ); __declspec(dllimport) HANDLE __stdcall FindFirstFileTransactedW( LPCWSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags, HANDLE hTransaction ); __declspec(dllimport) BOOL __stdcall CopyFileA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName, BOOL bFailIfExists ); __declspec(dllimport) BOOL __stdcall CopyFileW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, BOOL bFailIfExists ); typedef DWORD (__stdcall *LPPROGRESS_ROUTINE)( LARGE_INTEGER TotalFileSize, LARGE_INTEGER TotalBytesTransferred, LARGE_INTEGER StreamSize, LARGE_INTEGER StreamBytesTransferred, DWORD dwStreamNumber, DWORD dwCallbackReason, HANDLE hSourceFile, HANDLE hDestinationFile, LPVOID lpData ); __declspec(dllimport) BOOL __stdcall CopyFileExA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags ); __declspec(dllimport) BOOL __stdcall CopyFileExW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags ); __declspec(dllimport) BOOL __stdcall CopyFileTransactedA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags, HANDLE hTransaction ); __declspec(dllimport) BOOL __stdcall CopyFileTransactedW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags, HANDLE hTransaction ); typedef enum _COPYFILE2_MESSAGE_TYPE { COPYFILE2_CALLBACK_NONE = 0, COPYFILE2_CALLBACK_CHUNK_STARTED, COPYFILE2_CALLBACK_CHUNK_FINISHED, COPYFILE2_CALLBACK_STREAM_STARTED, COPYFILE2_CALLBACK_STREAM_FINISHED, COPYFILE2_CALLBACK_POLL_CONTINUE, COPYFILE2_CALLBACK_ERROR, COPYFILE2_CALLBACK_MAX, } COPYFILE2_MESSAGE_TYPE; typedef enum _COPYFILE2_MESSAGE_ACTION { COPYFILE2_PROGRESS_CONTINUE = 0, COPYFILE2_PROGRESS_CANCEL, COPYFILE2_PROGRESS_STOP, COPYFILE2_PROGRESS_QUIET, COPYFILE2_PROGRESS_PAUSE, } COPYFILE2_MESSAGE_ACTION; typedef enum _COPYFILE2_COPY_PHASE { COPYFILE2_PHASE_NONE = 0, COPYFILE2_PHASE_PREPARE_SOURCE, COPYFILE2_PHASE_PREPARE_DEST, COPYFILE2_PHASE_READ_SOURCE, COPYFILE2_PHASE_WRITE_DESTINATION, COPYFILE2_PHASE_SERVER_COPY, COPYFILE2_PHASE_NAMEGRAFT_COPY, COPYFILE2_PHASE_MAX, } COPYFILE2_COPY_PHASE; typedef struct COPYFILE2_MESSAGE { COPYFILE2_MESSAGE_TYPE Type; DWORD dwPadding; union { struct { DWORD dwStreamNumber; DWORD dwReserved; HANDLE hSourceFile; HANDLE hDestinationFile; ULARGE_INTEGER uliChunkNumber; ULARGE_INTEGER uliChunkSize; ULARGE_INTEGER uliStreamSize; ULARGE_INTEGER uliTotalFileSize; } ChunkStarted; struct { DWORD dwStreamNumber; DWORD dwFlags; HANDLE hSourceFile; HANDLE hDestinationFile; ULARGE_INTEGER uliChunkNumber; ULARGE_INTEGER uliChunkSize; ULARGE_INTEGER uliStreamSize; ULARGE_INTEGER uliStreamBytesTransferred; ULARGE_INTEGER uliTotalFileSize; ULARGE_INTEGER uliTotalBytesTransferred; } ChunkFinished; struct { DWORD dwStreamNumber; DWORD dwReserved; HANDLE hSourceFile; HANDLE hDestinationFile; ULARGE_INTEGER uliStreamSize; ULARGE_INTEGER uliTotalFileSize; } StreamStarted; struct { DWORD dwStreamNumber; DWORD dwReserved; HANDLE hSourceFile; HANDLE hDestinationFile; ULARGE_INTEGER uliStreamSize; ULARGE_INTEGER uliStreamBytesTransferred; ULARGE_INTEGER uliTotalFileSize; ULARGE_INTEGER uliTotalBytesTransferred; } StreamFinished; struct { DWORD dwReserved; } PollContinue; struct { COPYFILE2_COPY_PHASE CopyPhase; DWORD dwStreamNumber; HRESULT hrFailure; DWORD dwReserved; ULARGE_INTEGER uliChunkNumber; ULARGE_INTEGER uliStreamSize; ULARGE_INTEGER uliStreamBytesTransferred; ULARGE_INTEGER uliTotalFileSize; ULARGE_INTEGER uliTotalBytesTransferred; } Error; } Info; } COPYFILE2_MESSAGE; typedef COPYFILE2_MESSAGE_ACTION (__stdcall *PCOPYFILE2_PROGRESS_ROUTINE)( const COPYFILE2_MESSAGE *pMessage, PVOID pvCallbackContext ); typedef struct COPYFILE2_EXTENDED_PARAMETERS { DWORD dwSize; DWORD dwCopyFlags; BOOL *pfCancel; PCOPYFILE2_PROGRESS_ROUTINE pProgressRoutine; PVOID pvCallbackContext; } COPYFILE2_EXTENDED_PARAMETERS; __declspec(dllimport) HRESULT __stdcall CopyFile2( PCWSTR pwszExistingFileName, PCWSTR pwszNewFileName, COPYFILE2_EXTENDED_PARAMETERS *pExtendedParameters ); __declspec(dllimport) BOOL __stdcall MoveFileA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName ); __declspec(dllimport) BOOL __stdcall MoveFileW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName ); __declspec(dllimport) BOOL __stdcall MoveFileExA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName, DWORD dwFlags ); __declspec(dllimport) BOOL __stdcall MoveFileExW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, DWORD dwFlags ); __declspec(dllimport) BOOL __stdcall MoveFileWithProgressA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags ); __declspec(dllimport) BOOL __stdcall MoveFileWithProgressW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags ); __declspec(dllimport) BOOL __stdcall MoveFileTransactedA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags, HANDLE hTransaction ); __declspec(dllimport) BOOL __stdcall MoveFileTransactedW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags, HANDLE hTransaction ); __declspec(dllimport) BOOL __stdcall ReplaceFileA( LPCSTR lpReplacedFileName, LPCSTR lpReplacementFileName, LPCSTR lpBackupFileName, DWORD dwReplaceFlags, LPVOID lpExclude, LPVOID lpReserved ); __declspec(dllimport) BOOL __stdcall ReplaceFileW( LPCWSTR lpReplacedFileName, LPCWSTR lpReplacementFileName, LPCWSTR lpBackupFileName, DWORD dwReplaceFlags, LPVOID lpExclude, LPVOID lpReserved ); __declspec(dllimport) BOOL __stdcall CreateHardLinkA( LPCSTR lpFileName, LPCSTR lpExistingFileName, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); __declspec(dllimport) BOOL __stdcall CreateHardLinkW( LPCWSTR lpFileName, LPCWSTR lpExistingFileName, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); __declspec(dllimport) BOOL __stdcall CreateHardLinkTransactedA( LPCSTR lpFileName, LPCSTR lpExistingFileName, LPSECURITY_ATTRIBUTES lpSecurityAttributes, HANDLE hTransaction ); __declspec(dllimport) BOOL __stdcall CreateHardLinkTransactedW( LPCWSTR lpFileName, LPCWSTR lpExistingFileName, LPSECURITY_ATTRIBUTES lpSecurityAttributes, HANDLE hTransaction ); __declspec(dllimport) HANDLE __stdcall FindFirstStreamTransactedW ( LPCWSTR lpFileName, STREAM_INFO_LEVELS InfoLevel, LPVOID lpFindStreamData, DWORD dwFlags, HANDLE hTransaction ); __declspec(dllimport) HANDLE __stdcall FindFirstFileNameTransactedW ( LPCWSTR lpFileName, DWORD dwFlags, LPDWORD StringLength, PWSTR LinkName, HANDLE hTransaction ); __declspec(dllimport) HANDLE __stdcall CreateNamedPipeA( LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); __declspec(dllimport) BOOL __stdcall GetNamedPipeHandleStateA( HANDLE hNamedPipe, LPDWORD lpState, LPDWORD lpCurInstances, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout, LPSTR lpUserName, DWORD nMaxUserNameSize ); __declspec(dllimport) BOOL __stdcall CallNamedPipeA( LPCSTR lpNamedPipeName, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead, DWORD nTimeOut ); __declspec(dllimport) BOOL __stdcall WaitNamedPipeA( LPCSTR lpNamedPipeName, DWORD nTimeOut ); __declspec(dllimport) BOOL __stdcall GetNamedPipeClientComputerNameA( HANDLE Pipe, LPSTR ClientComputerName, ULONG ClientComputerNameLength ); __declspec(dllimport) BOOL __stdcall GetNamedPipeClientProcessId( HANDLE Pipe, PULONG ClientProcessId ); __declspec(dllimport) BOOL __stdcall GetNamedPipeClientSessionId( HANDLE Pipe, PULONG ClientSessionId ); __declspec(dllimport) BOOL __stdcall GetNamedPipeServerProcessId( HANDLE Pipe, PULONG ServerProcessId ); __declspec(dllimport) BOOL __stdcall GetNamedPipeServerSessionId( HANDLE Pipe, PULONG ServerSessionId ); __declspec(dllimport) BOOL __stdcall SetVolumeLabelA( LPCSTR lpRootPathName, LPCSTR lpVolumeName ); __declspec(dllimport) BOOL __stdcall SetVolumeLabelW( LPCWSTR lpRootPathName, LPCWSTR lpVolumeName ); __declspec(dllimport) BOOL __stdcall SetFileBandwidthReservation( HANDLE hFile, DWORD nPeriodMilliseconds, DWORD nBytesPerPeriod, BOOL bDiscardable, LPDWORD lpTransferSize, LPDWORD lpNumOutstandingRequests ); __declspec(dllimport) BOOL __stdcall GetFileBandwidthReservation( HANDLE hFile, LPDWORD lpPeriodMilliseconds, LPDWORD lpBytesPerPeriod, LPBOOL pDiscardable, LPDWORD lpTransferSize, LPDWORD lpNumOutstandingRequests ); __declspec(dllimport) BOOL __stdcall ClearEventLogA ( HANDLE hEventLog, LPCSTR lpBackupFileName ); __declspec(dllimport) BOOL __stdcall ClearEventLogW ( HANDLE hEventLog, LPCWSTR lpBackupFileName ); __declspec(dllimport) BOOL __stdcall BackupEventLogA ( HANDLE hEventLog, LPCSTR lpBackupFileName ); __declspec(dllimport) BOOL __stdcall BackupEventLogW ( HANDLE hEventLog, LPCWSTR lpBackupFileName ); __declspec(dllimport) BOOL __stdcall CloseEventLog ( HANDLE hEventLog ); __declspec(dllimport) BOOL __stdcall DeregisterEventSource ( HANDLE hEventLog ); __declspec(dllimport) BOOL __stdcall NotifyChangeEventLog( HANDLE hEventLog, HANDLE hEvent ); __declspec(dllimport) BOOL __stdcall GetNumberOfEventLogRecords ( HANDLE hEventLog, PDWORD NumberOfRecords ); __declspec(dllimport) BOOL __stdcall GetOldestEventLogRecord ( HANDLE hEventLog, PDWORD OldestRecord ); __declspec(dllimport) HANDLE __stdcall OpenEventLogA ( LPCSTR lpUNCServerName, LPCSTR lpSourceName ); __declspec(dllimport) HANDLE __stdcall OpenEventLogW ( LPCWSTR lpUNCServerName, LPCWSTR lpSourceName ); __declspec(dllimport) HANDLE __stdcall RegisterEventSourceA ( LPCSTR lpUNCServerName, LPCSTR lpSourceName ); __declspec(dllimport) HANDLE __stdcall RegisterEventSourceW ( LPCWSTR lpUNCServerName, LPCWSTR lpSourceName ); __declspec(dllimport) HANDLE __stdcall OpenBackupEventLogA ( LPCSTR lpUNCServerName, LPCSTR lpFileName ); __declspec(dllimport) HANDLE __stdcall OpenBackupEventLogW ( LPCWSTR lpUNCServerName, LPCWSTR lpFileName ); __declspec(dllimport) BOOL __stdcall ReadEventLogA ( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, DWORD *pnBytesRead, DWORD *pnMinNumberOfBytesNeeded ); __declspec(dllimport) BOOL __stdcall ReadEventLogW ( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, DWORD *pnBytesRead, DWORD *pnMinNumberOfBytesNeeded ); __declspec(dllimport) BOOL __stdcall ReportEventA ( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dwEventID, PSID lpUserSid, WORD wNumStrings, DWORD dwDataSize, LPCSTR *lpStrings, LPVOID lpRawData ); __declspec(dllimport) BOOL __stdcall ReportEventW ( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dwEventID, PSID lpUserSid, WORD wNumStrings, DWORD dwDataSize, LPCWSTR *lpStrings, LPVOID lpRawData ); typedef struct _EVENTLOG_FULL_INFORMATION { DWORD dwFull; } EVENTLOG_FULL_INFORMATION, *LPEVENTLOG_FULL_INFORMATION; __declspec(dllimport) BOOL __stdcall GetEventLogInformation ( HANDLE hEventLog, DWORD dwInfoLevel, LPVOID lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded ); typedef ULONG OPERATION_ID; typedef struct _OPERATION_START_PARAMETERS { ULONG Version; OPERATION_ID OperationId; ULONG Flags; } OPERATION_START_PARAMETERS, *POPERATION_START_PARAMETERS; typedef struct _OPERATION_END_PARAMETERS { ULONG Version; OPERATION_ID OperationId; ULONG Flags; } OPERATION_END_PARAMETERS, *POPERATION_END_PARAMETERS; __declspec(dllimport) BOOL __stdcall OperationStart ( OPERATION_START_PARAMETERS* OperationStartParams ); __declspec(dllimport) BOOL __stdcall OperationEnd ( OPERATION_END_PARAMETERS* OperationEndParams ); __declspec(dllimport) BOOL __stdcall AccessCheckAndAuditAlarmA ( LPCSTR SubsystemName, LPVOID HandleId, LPSTR ObjectTypeName, LPSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, DWORD DesiredAccess, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPBOOL AccessStatus, LPBOOL pfGenerateOnClose ); __declspec(dllimport) BOOL __stdcall AccessCheckByTypeAndAuditAlarmA ( LPCSTR SubsystemName, LPVOID HandleId, LPCSTR ObjectTypeName, LPCSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPBOOL AccessStatus, LPBOOL pfGenerateOnClose ); __declspec(dllimport) BOOL __stdcall AccessCheckByTypeResultListAndAuditAlarmA ( LPCSTR SubsystemName, LPVOID HandleId, LPCSTR ObjectTypeName, LPCSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPDWORD AccessStatusList, LPBOOL pfGenerateOnClose ); __declspec(dllimport) BOOL __stdcall AccessCheckByTypeResultListAndAuditAlarmByHandleA ( LPCSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken, LPCSTR ObjectTypeName, LPCSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPDWORD AccessStatusList, LPBOOL pfGenerateOnClose ); __declspec(dllimport) BOOL __stdcall ObjectOpenAuditAlarmA ( LPCSTR SubsystemName, LPVOID HandleId, LPSTR ObjectTypeName, LPSTR ObjectName, PSECURITY_DESCRIPTOR pSecurityDescriptor, HANDLE ClientToken, DWORD DesiredAccess, DWORD GrantedAccess, PPRIVILEGE_SET Privileges, BOOL ObjectCreation, BOOL AccessGranted, LPBOOL GenerateOnClose ); __declspec(dllimport) BOOL __stdcall ObjectPrivilegeAuditAlarmA ( LPCSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken, DWORD DesiredAccess, PPRIVILEGE_SET Privileges, BOOL AccessGranted ); __declspec(dllimport) BOOL __stdcall ObjectCloseAuditAlarmA ( LPCSTR SubsystemName, LPVOID HandleId, BOOL GenerateOnClose ); __declspec(dllimport) BOOL __stdcall ObjectDeleteAuditAlarmA ( LPCSTR SubsystemName, LPVOID HandleId, BOOL GenerateOnClose ); __declspec(dllimport) BOOL __stdcall PrivilegedServiceAuditAlarmA ( LPCSTR SubsystemName, LPCSTR ServiceName, HANDLE ClientToken, PPRIVILEGE_SET Privileges, BOOL AccessGranted ); __declspec(dllimport) BOOL __stdcall AddConditionalAce ( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, UCHAR AceType, DWORD AccessMask, PSID pSid, PWCHAR ConditionStr, DWORD *ReturnLength ); __declspec(dllimport) BOOL __stdcall SetFileSecurityA ( LPCSTR lpFileName, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor ); __declspec(dllimport) BOOL __stdcall GetFileSecurityA ( LPCSTR lpFileName, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded ); __declspec(dllimport) BOOL __stdcall ReadDirectoryChangesW( HANDLE hDirectory, LPVOID lpBuffer, DWORD nBufferLength, BOOL bWatchSubtree, DWORD dwNotifyFilter, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine ); __declspec(dllimport) LPVOID __stdcall MapViewOfFileExNuma( HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap, LPVOID lpBaseAddress, DWORD nndPreferred ); __declspec(dllimport) BOOL __stdcall IsBadReadPtr( const void *lp, UINT_PTR ucb ); __declspec(dllimport) BOOL __stdcall IsBadWritePtr( LPVOID lp, UINT_PTR ucb ); __declspec(dllimport) BOOL __stdcall IsBadHugeReadPtr( const void *lp, UINT_PTR ucb ); __declspec(dllimport) BOOL __stdcall IsBadHugeWritePtr( LPVOID lp, UINT_PTR ucb ); __declspec(dllimport) BOOL __stdcall IsBadCodePtr( FARPROC lpfn ); __declspec(dllimport) BOOL __stdcall IsBadStringPtrA( LPCSTR lpsz, UINT_PTR ucchMax ); __declspec(dllimport) BOOL __stdcall IsBadStringPtrW( LPCWSTR lpsz, UINT_PTR ucchMax ); __declspec(dllimport) BOOL __stdcall LookupAccountSidA( LPCSTR lpSystemName, PSID Sid, LPSTR Name, LPDWORD cchName, LPSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse ); __declspec(dllimport) BOOL __stdcall LookupAccountSidW( LPCWSTR lpSystemName, PSID Sid, LPWSTR Name, LPDWORD cchName, LPWSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse ); __declspec(dllimport) BOOL __stdcall LookupAccountNameA( LPCSTR lpSystemName, LPCSTR lpAccountName, PSID Sid, LPDWORD cbSid, LPSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse ); __declspec(dllimport) BOOL __stdcall LookupAccountNameW( LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSID Sid, LPDWORD cbSid, LPWSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse ); __declspec(dllimport) BOOL __stdcall LookupAccountNameLocalA( LPCSTR lpAccountName, PSID Sid, LPDWORD cbSid, LPSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse ); __declspec(dllimport) BOOL __stdcall LookupAccountNameLocalW( LPCWSTR lpAccountName, PSID Sid, LPDWORD cbSid, LPWSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse ); __declspec(dllimport) BOOL __stdcall LookupAccountSidLocalA( PSID Sid, LPSTR Name, LPDWORD cchName, LPSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse ); __declspec(dllimport) BOOL __stdcall LookupAccountSidLocalW( PSID Sid, LPWSTR Name, LPDWORD cchName, LPWSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse ); __declspec(dllimport) BOOL __stdcall LookupPrivilegeValueA( LPCSTR lpSystemName, LPCSTR lpName, PLUID lpLuid ); __declspec(dllimport) BOOL __stdcall LookupPrivilegeValueW( LPCWSTR lpSystemName, LPCWSTR lpName, PLUID lpLuid ); __declspec(dllimport) BOOL __stdcall LookupPrivilegeNameA( LPCSTR lpSystemName, PLUID lpLuid, LPSTR lpName, LPDWORD cchName ); __declspec(dllimport) BOOL __stdcall LookupPrivilegeNameW( LPCWSTR lpSystemName, PLUID lpLuid, LPWSTR lpName, LPDWORD cchName ); __declspec(dllimport) BOOL __stdcall LookupPrivilegeDisplayNameA( LPCSTR lpSystemName, LPCSTR lpName, LPSTR lpDisplayName, LPDWORD cchDisplayName, LPDWORD lpLanguageId ); __declspec(dllimport) BOOL __stdcall LookupPrivilegeDisplayNameW( LPCWSTR lpSystemName, LPCWSTR lpName, LPWSTR lpDisplayName, LPDWORD cchDisplayName, LPDWORD lpLanguageId ); __declspec(dllimport) BOOL __stdcall BuildCommDCBA( LPCSTR lpDef, LPDCB lpDCB ); __declspec(dllimport) BOOL __stdcall BuildCommDCBW( LPCWSTR lpDef, LPDCB lpDCB ); __declspec(dllimport) BOOL __stdcall BuildCommDCBAndTimeoutsA( LPCSTR lpDef, LPDCB lpDCB, LPCOMMTIMEOUTS lpCommTimeouts ); __declspec(dllimport) BOOL __stdcall BuildCommDCBAndTimeoutsW( LPCWSTR lpDef, LPDCB lpDCB, LPCOMMTIMEOUTS lpCommTimeouts ); __declspec(dllimport) BOOL __stdcall CommConfigDialogA( LPCSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC ); __declspec(dllimport) BOOL __stdcall CommConfigDialogW( LPCWSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC ); __declspec(dllimport) BOOL __stdcall GetDefaultCommConfigA( LPCSTR lpszName, LPCOMMCONFIG lpCC, LPDWORD lpdwSize ); __declspec(dllimport) BOOL __stdcall GetDefaultCommConfigW( LPCWSTR lpszName, LPCOMMCONFIG lpCC, LPDWORD lpdwSize ); __declspec(dllimport) BOOL __stdcall SetDefaultCommConfigA( LPCSTR lpszName, LPCOMMCONFIG lpCC, DWORD dwSize ); __declspec(dllimport) BOOL __stdcall SetDefaultCommConfigW( LPCWSTR lpszName, LPCOMMCONFIG lpCC, DWORD dwSize ); __declspec(dllimport) BOOL __stdcall GetComputerNameA ( LPSTR lpBuffer, LPDWORD nSize ); __declspec(dllimport) BOOL __stdcall GetComputerNameW ( LPWSTR lpBuffer, LPDWORD nSize ); __declspec(dllimport) BOOL __stdcall DnsHostnameToComputerNameA ( LPCSTR Hostname, LPSTR ComputerName, LPDWORD nSize ); __declspec(dllimport) BOOL __stdcall DnsHostnameToComputerNameW ( LPCWSTR Hostname, LPWSTR ComputerName, LPDWORD nSize ); __declspec(dllimport) BOOL __stdcall GetUserNameA ( LPSTR lpBuffer, LPDWORD pcbBuffer ); __declspec(dllimport) BOOL __stdcall GetUserNameW ( LPWSTR lpBuffer, LPDWORD pcbBuffer ); __declspec(dllimport) BOOL __stdcall LogonUserA ( LPCSTR lpszUsername, LPCSTR lpszDomain, LPCSTR lpszPassword, DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken ); __declspec(dllimport) BOOL __stdcall LogonUserW ( LPCWSTR lpszUsername, LPCWSTR lpszDomain, LPCWSTR lpszPassword, DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken ); __declspec(dllimport) BOOL __stdcall LogonUserExA ( LPCSTR lpszUsername, LPCSTR lpszDomain, LPCSTR lpszPassword, DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken, PSID *ppLogonSid, PVOID *ppProfileBuffer, LPDWORD pdwProfileLength, PQUOTA_LIMITS pQuotaLimits ); __declspec(dllimport) BOOL __stdcall LogonUserExW ( LPCWSTR lpszUsername, LPCWSTR lpszDomain, LPCWSTR lpszPassword, DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken, PSID *ppLogonSid, PVOID *ppProfileBuffer, LPDWORD pdwProfileLength, PQUOTA_LIMITS pQuotaLimits ); __declspec(dllimport) BOOL __stdcall CreateProcessWithLogonW( LPCWSTR lpUsername, LPCWSTR lpDomain, LPCWSTR lpPassword, DWORD dwLogonFlags, LPCWSTR lpApplicationName, LPWSTR lpCommandLine, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ); __declspec(dllimport) BOOL __stdcall CreateProcessWithTokenW( HANDLE hToken, DWORD dwLogonFlags, LPCWSTR lpApplicationName, LPWSTR lpCommandLine, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ); __declspec(dllimport) BOOL __stdcall IsTokenUntrusted( HANDLE TokenHandle ); __declspec(dllimport) BOOL __stdcall RegisterWaitForSingleObject( PHANDLE phNewWaitObject, HANDLE hObject, WAITORTIMERCALLBACK Callback, PVOID Context, ULONG dwMilliseconds, ULONG dwFlags ); __declspec(dllimport) BOOL __stdcall UnregisterWait( HANDLE WaitHandle ); __declspec(dllimport) BOOL __stdcall BindIoCompletionCallback ( HANDLE FileHandle, LPOVERLAPPED_COMPLETION_ROUTINE Function, ULONG Flags ); __declspec(dllimport) HANDLE __stdcall SetTimerQueueTimer( HANDLE TimerQueue, WAITORTIMERCALLBACK Callback, PVOID Parameter, DWORD DueTime, DWORD Period, BOOL PreferIo ); __declspec(dllimport) BOOL __stdcall CancelTimerQueueTimer( HANDLE TimerQueue, HANDLE Timer ); __declspec(dllimport) BOOL __stdcall DeleteTimerQueue( HANDLE TimerQueue ); __forceinline void InitializeThreadpoolEnvironment( PTP_CALLBACK_ENVIRON pcbe ) { TpInitializeCallbackEnviron(pcbe); } __forceinline void SetThreadpoolCallbackPool( PTP_CALLBACK_ENVIRON pcbe, PTP_POOL ptpp ) { TpSetCallbackThreadpool(pcbe, ptpp); } __forceinline void SetThreadpoolCallbackCleanupGroup( PTP_CALLBACK_ENVIRON pcbe, PTP_CLEANUP_GROUP ptpcg, PTP_CLEANUP_GROUP_CANCEL_CALLBACK pfng ) { TpSetCallbackCleanupGroup(pcbe, ptpcg, pfng); } __forceinline void SetThreadpoolCallbackRunsLong( PTP_CALLBACK_ENVIRON pcbe ) { TpSetCallbackLongFunction(pcbe); } __forceinline void SetThreadpoolCallbackLibrary( PTP_CALLBACK_ENVIRON pcbe, PVOID mod ) { TpSetCallbackRaceWithDll(pcbe, mod); } __forceinline void SetThreadpoolCallbackPriority( PTP_CALLBACK_ENVIRON pcbe, TP_CALLBACK_PRIORITY Priority ) { TpSetCallbackPriority(pcbe, Priority); } __forceinline void DestroyThreadpoolEnvironment( PTP_CALLBACK_ENVIRON pcbe ) { TpDestroyCallbackEnviron(pcbe); } __forceinline void SetThreadpoolCallbackPersistent( PTP_CALLBACK_ENVIRON pcbe ) { TpSetCallbackPersistent(pcbe); } __declspec(dllimport) HANDLE __stdcall CreatePrivateNamespaceA( LPSECURITY_ATTRIBUTES lpPrivateNamespaceAttributes, LPVOID lpBoundaryDescriptor, LPCSTR lpAliasPrefix ); __declspec(dllimport) HANDLE __stdcall OpenPrivateNamespaceA( LPVOID lpBoundaryDescriptor, LPCSTR lpAliasPrefix ); __declspec(dllimport) HANDLE __stdcall CreateBoundaryDescriptorA( LPCSTR Name, ULONG Flags ); __declspec(dllimport) BOOL __stdcall AddIntegrityLabelToBoundaryDescriptor( HANDLE * BoundaryDescriptor, PSID IntegrityLabel ); typedef struct tagHW_PROFILE_INFOA { DWORD dwDockInfo; CHAR szHwProfileGuid[39]; CHAR szHwProfileName[80]; } HW_PROFILE_INFOA, *LPHW_PROFILE_INFOA; typedef struct tagHW_PROFILE_INFOW { DWORD dwDockInfo; WCHAR szHwProfileGuid[39]; WCHAR szHwProfileName[80]; } HW_PROFILE_INFOW, *LPHW_PROFILE_INFOW; typedef HW_PROFILE_INFOW HW_PROFILE_INFO; typedef LPHW_PROFILE_INFOW LPHW_PROFILE_INFO; __declspec(dllimport) BOOL __stdcall GetCurrentHwProfileA ( LPHW_PROFILE_INFOA lpHwProfileInfo ); __declspec(dllimport) BOOL __stdcall GetCurrentHwProfileW ( LPHW_PROFILE_INFOW lpHwProfileInfo ); __declspec(dllimport) BOOL __stdcall VerifyVersionInfoA( LPOSVERSIONINFOEXA lpVersionInformation, DWORD dwTypeMask, DWORDLONG dwlConditionMask ); __declspec(dllimport) BOOL __stdcall VerifyVersionInfoW( LPOSVERSIONINFOEXW lpVersionInformation, DWORD dwTypeMask, DWORDLONG dwlConditionMask ); constexpr __forceinline HRESULT HRESULT_FROM_WIN32(unsigned long x) { return (HRESULT)(x) <= 0 ? (HRESULT)(x) : (HRESULT) (((x) & 0x0000FFFF) | (7 << 16) | 0x80000000);} extern "C" { typedef struct _TIME_ZONE_INFORMATION { LONG Bias; WCHAR StandardName[ 32 ]; SYSTEMTIME StandardDate; LONG StandardBias; WCHAR DaylightName[ 32 ]; SYSTEMTIME DaylightDate; LONG DaylightBias; } TIME_ZONE_INFORMATION, *PTIME_ZONE_INFORMATION, *LPTIME_ZONE_INFORMATION; typedef struct _TIME_DYNAMIC_ZONE_INFORMATION { LONG Bias; WCHAR StandardName[ 32 ]; SYSTEMTIME StandardDate; LONG StandardBias; WCHAR DaylightName[ 32 ]; SYSTEMTIME DaylightDate; LONG DaylightBias; WCHAR TimeZoneKeyName[ 128 ]; BOOLEAN DynamicDaylightTimeDisabled; } DYNAMIC_TIME_ZONE_INFORMATION, *PDYNAMIC_TIME_ZONE_INFORMATION; __declspec(dllimport) BOOL __stdcall SystemTimeToTzSpecificLocalTime( const TIME_ZONE_INFORMATION* lpTimeZoneInformation, const SYSTEMTIME* lpUniversalTime, LPSYSTEMTIME lpLocalTime ); __declspec(dllimport) BOOL __stdcall TzSpecificLocalTimeToSystemTime( const TIME_ZONE_INFORMATION* lpTimeZoneInformation, const SYSTEMTIME* lpLocalTime, LPSYSTEMTIME lpUniversalTime ); __declspec(dllimport) BOOL __stdcall FileTimeToSystemTime( const FILETIME* lpFileTime, LPSYSTEMTIME lpSystemTime ); __declspec(dllimport) BOOL __stdcall SystemTimeToFileTime( const SYSTEMTIME* lpSystemTime, LPFILETIME lpFileTime ); __declspec(dllimport) DWORD __stdcall GetTimeZoneInformation( LPTIME_ZONE_INFORMATION lpTimeZoneInformation ); __declspec(dllimport) BOOL __stdcall SetTimeZoneInformation( const TIME_ZONE_INFORMATION* lpTimeZoneInformation ); __declspec(dllimport) BOOL __stdcall SetDynamicTimeZoneInformation( const DYNAMIC_TIME_ZONE_INFORMATION* lpTimeZoneInformation ); __declspec(dllimport) DWORD __stdcall GetDynamicTimeZoneInformation( PDYNAMIC_TIME_ZONE_INFORMATION pTimeZoneInformation ); BOOL __stdcall GetTimeZoneInformationForYear( USHORT wYear, PDYNAMIC_TIME_ZONE_INFORMATION pdtzi, LPTIME_ZONE_INFORMATION ptzi ); __declspec(dllimport) DWORD __stdcall EnumDynamicTimeZoneInformation( const DWORD dwIndex, PDYNAMIC_TIME_ZONE_INFORMATION lpTimeZoneInformation ); __declspec(dllimport) DWORD __stdcall GetDynamicTimeZoneInformationEffectiveYears( const PDYNAMIC_TIME_ZONE_INFORMATION lpTimeZoneInformation, LPDWORD FirstYear, LPDWORD LastYear ); __declspec(dllimport) BOOL __stdcall SystemTimeToTzSpecificLocalTimeEx( const DYNAMIC_TIME_ZONE_INFORMATION* lpTimeZoneInformation, const SYSTEMTIME* lpUniversalTime, LPSYSTEMTIME lpLocalTime ); __declspec(dllimport) BOOL __stdcall TzSpecificLocalTimeToSystemTimeEx( const DYNAMIC_TIME_ZONE_INFORMATION* lpTimeZoneInformation, const SYSTEMTIME* lpLocalTime, LPSYSTEMTIME lpUniversalTime ); } __declspec(dllimport) BOOL __stdcall SetSystemPowerState( BOOL fSuspend, BOOL fForce ); typedef struct _SYSTEM_POWER_STATUS { BYTE ACLineStatus; BYTE BatteryFlag; BYTE BatteryLifePercent; BYTE SystemStatusFlag; DWORD BatteryLifeTime; DWORD BatteryFullLifeTime; } SYSTEM_POWER_STATUS, *LPSYSTEM_POWER_STATUS; __declspec(dllimport) BOOL __stdcall GetSystemPowerStatus( LPSYSTEM_POWER_STATUS lpSystemPowerStatus ); __declspec(dllimport) BOOL __stdcall MapUserPhysicalPagesScatter( PVOID *VirtualAddresses, ULONG_PTR NumberOfPages, PULONG_PTR PageArray ); __declspec(dllimport) HANDLE __stdcall CreateJobObjectA( LPSECURITY_ATTRIBUTES lpJobAttributes, LPCSTR lpName ); __declspec(dllimport) HANDLE __stdcall OpenJobObjectA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName ); __declspec(dllimport) BOOL __stdcall CreateJobSet ( ULONG NumJob, PJOB_SET_ARRAY UserJobSet, ULONG Flags); __declspec(dllimport) HANDLE __stdcall FindFirstVolumeA( LPSTR lpszVolumeName, DWORD cchBufferLength ); __declspec(dllimport) BOOL __stdcall FindNextVolumeA( HANDLE hFindVolume, LPSTR lpszVolumeName, DWORD cchBufferLength ); __declspec(dllimport) HANDLE __stdcall FindFirstVolumeMountPointA( LPCSTR lpszRootPathName, LPSTR lpszVolumeMountPoint, DWORD cchBufferLength ); __declspec(dllimport) HANDLE __stdcall FindFirstVolumeMountPointW( LPCWSTR lpszRootPathName, LPWSTR lpszVolumeMountPoint, DWORD cchBufferLength ); __declspec(dllimport) BOOL __stdcall FindNextVolumeMountPointA( HANDLE hFindVolumeMountPoint, LPSTR lpszVolumeMountPoint, DWORD cchBufferLength ); __declspec(dllimport) BOOL __stdcall FindNextVolumeMountPointW( HANDLE hFindVolumeMountPoint, LPWSTR lpszVolumeMountPoint, DWORD cchBufferLength ); __declspec(dllimport) BOOL __stdcall FindVolumeMountPointClose( HANDLE hFindVolumeMountPoint ); __declspec(dllimport) BOOL __stdcall SetVolumeMountPointA( LPCSTR lpszVolumeMountPoint, LPCSTR lpszVolumeName ); __declspec(dllimport) BOOL __stdcall SetVolumeMountPointW( LPCWSTR lpszVolumeMountPoint, LPCWSTR lpszVolumeName ); __declspec(dllimport) BOOL __stdcall DeleteVolumeMountPointA( LPCSTR lpszVolumeMountPoint ); __declspec(dllimport) BOOL __stdcall GetVolumeNameForVolumeMountPointA( LPCSTR lpszVolumeMountPoint, LPSTR lpszVolumeName, DWORD cchBufferLength ); __declspec(dllimport) BOOL __stdcall GetVolumePathNameA( LPCSTR lpszFileName, LPSTR lpszVolumePathName, DWORD cchBufferLength ); __declspec(dllimport) BOOL __stdcall GetVolumePathNamesForVolumeNameA( LPCSTR lpszVolumeName, LPCH lpszVolumePathNames, DWORD cchBufferLength, PDWORD lpcchReturnLength ); typedef struct tagACTCTXA { ULONG cbSize; DWORD dwFlags; LPCSTR lpSource; USHORT wProcessorArchitecture; LANGID wLangId; LPCSTR lpAssemblyDirectory; LPCSTR lpResourceName; LPCSTR lpApplicationName; HMODULE hModule; } ACTCTXA, *PACTCTXA; typedef struct tagACTCTXW { ULONG cbSize; DWORD dwFlags; LPCWSTR lpSource; USHORT wProcessorArchitecture; LANGID wLangId; LPCWSTR lpAssemblyDirectory; LPCWSTR lpResourceName; LPCWSTR lpApplicationName; HMODULE hModule; } ACTCTXW, *PACTCTXW; typedef ACTCTXW ACTCTX; typedef PACTCTXW PACTCTX; typedef const ACTCTXA *PCACTCTXA; typedef const ACTCTXW *PCACTCTXW; typedef PCACTCTXW PCACTCTX; __declspec(dllimport) HANDLE __stdcall CreateActCtxA( PCACTCTXA pActCtx ); __declspec(dllimport) HANDLE __stdcall CreateActCtxW( PCACTCTXW pActCtx ); __declspec(dllimport) void __stdcall AddRefActCtx( HANDLE hActCtx ); __declspec(dllimport) void __stdcall ReleaseActCtx( HANDLE hActCtx ); __declspec(dllimport) BOOL __stdcall ZombifyActCtx( HANDLE hActCtx ); __declspec(dllimport) BOOL __stdcall ActivateActCtx( HANDLE hActCtx, ULONG_PTR *lpCookie ); __declspec(dllimport) BOOL __stdcall DeactivateActCtx( DWORD dwFlags, ULONG_PTR ulCookie ); __declspec(dllimport) BOOL __stdcall GetCurrentActCtx( HANDLE *lphActCtx); typedef struct tagACTCTX_SECTION_KEYED_DATA_2600 { ULONG cbSize; ULONG ulDataFormatVersion; PVOID lpData; ULONG ulLength; PVOID lpSectionGlobalData; ULONG ulSectionGlobalDataLength; PVOID lpSectionBase; ULONG ulSectionTotalLength; HANDLE hActCtx; ULONG ulAssemblyRosterIndex; } ACTCTX_SECTION_KEYED_DATA_2600, *PACTCTX_SECTION_KEYED_DATA_2600; typedef const ACTCTX_SECTION_KEYED_DATA_2600 * PCACTCTX_SECTION_KEYED_DATA_2600; typedef struct tagACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA { PVOID lpInformation; PVOID lpSectionBase; ULONG ulSectionLength; PVOID lpSectionGlobalDataBase; ULONG ulSectionGlobalDataLength; } ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA, *PACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA; typedef const ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA *PCACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA; typedef struct tagACTCTX_SECTION_KEYED_DATA { ULONG cbSize; ULONG ulDataFormatVersion; PVOID lpData; ULONG ulLength; PVOID lpSectionGlobalData; ULONG ulSectionGlobalDataLength; PVOID lpSectionBase; ULONG ulSectionTotalLength; HANDLE hActCtx; ULONG ulAssemblyRosterIndex; ULONG ulFlags; ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA AssemblyMetadata; } ACTCTX_SECTION_KEYED_DATA, *PACTCTX_SECTION_KEYED_DATA; typedef const ACTCTX_SECTION_KEYED_DATA * PCACTCTX_SECTION_KEYED_DATA; __declspec(dllimport) BOOL __stdcall FindActCtxSectionStringA( DWORD dwFlags, const GUID *lpExtensionGuid, ULONG ulSectionId, LPCSTR lpStringToFind, PACTCTX_SECTION_KEYED_DATA ReturnedData ); __declspec(dllimport) BOOL __stdcall FindActCtxSectionStringW( DWORD dwFlags, const GUID *lpExtensionGuid, ULONG ulSectionId, LPCWSTR lpStringToFind, PACTCTX_SECTION_KEYED_DATA ReturnedData ); __declspec(dllimport) BOOL __stdcall FindActCtxSectionGuid( DWORD dwFlags, const GUID *lpExtensionGuid, ULONG ulSectionId, const GUID *lpGuidToFind, PACTCTX_SECTION_KEYED_DATA ReturnedData ); typedef struct _ACTIVATION_CONTEXT_BASIC_INFORMATION { HANDLE hActCtx; DWORD dwFlags; } ACTIVATION_CONTEXT_BASIC_INFORMATION, *PACTIVATION_CONTEXT_BASIC_INFORMATION; typedef const struct _ACTIVATION_CONTEXT_BASIC_INFORMATION *PCACTIVATION_CONTEXT_BASIC_INFORMATION; __declspec(dllimport) BOOL __stdcall QueryActCtxW( DWORD dwFlags, HANDLE hActCtx, PVOID pvSubInstance, ULONG ulInfoClass, PVOID pvBuffer, SIZE_T cbBuffer, SIZE_T *pcbWrittenOrRequired ); typedef BOOL (__stdcall * PQUERYACTCTXW_FUNC)( DWORD dwFlags, HANDLE hActCtx, PVOID pvSubInstance, ULONG ulInfoClass, PVOID pvBuffer, SIZE_T cbBuffer, SIZE_T *pcbWrittenOrRequired ); __declspec(dllimport) DWORD __stdcall WTSGetActiveConsoleSessionId( void ); __declspec(dllimport) DWORD __stdcall WTSGetServiceSessionId( void ); __declspec(dllimport) BOOLEAN __stdcall WTSIsServerContainer( void ); __declspec(dllimport) WORD __stdcall GetActiveProcessorGroupCount( void ); __declspec(dllimport) WORD __stdcall GetMaximumProcessorGroupCount( void ); __declspec(dllimport) DWORD __stdcall GetActiveProcessorCount( WORD GroupNumber ); __declspec(dllimport) DWORD __stdcall GetMaximumProcessorCount( WORD GroupNumber ); __declspec(dllimport) BOOL __stdcall GetNumaProcessorNode( UCHAR Processor, PUCHAR NodeNumber ); __declspec(dllimport) BOOL __stdcall GetNumaNodeNumberFromHandle( HANDLE hFile, PUSHORT NodeNumber ); __declspec(dllimport) BOOL __stdcall GetNumaProcessorNodeEx( PPROCESSOR_NUMBER Processor, PUSHORT NodeNumber ); __declspec(dllimport) BOOL __stdcall GetNumaNodeProcessorMask( UCHAR Node, PULONGLONG ProcessorMask ); __declspec(dllimport) BOOL __stdcall GetNumaAvailableMemoryNode( UCHAR Node, PULONGLONG AvailableBytes ); __declspec(dllimport) BOOL __stdcall GetNumaAvailableMemoryNodeEx( USHORT Node, PULONGLONG AvailableBytes ); __declspec(dllimport) BOOL __stdcall GetNumaProximityNode( ULONG ProximityId, PUCHAR NodeNumber ); typedef DWORD (__stdcall *APPLICATION_RECOVERY_CALLBACK)(PVOID pvParameter); __declspec(dllimport) HRESULT __stdcall RegisterApplicationRecoveryCallback( APPLICATION_RECOVERY_CALLBACK pRecoveyCallback, PVOID pvParameter, DWORD dwPingInterval, DWORD dwFlags ); __declspec(dllimport) HRESULT __stdcall UnregisterApplicationRecoveryCallback(void); __declspec(dllimport) HRESULT __stdcall RegisterApplicationRestart( PCWSTR pwzCommandline, DWORD dwFlags ); __declspec(dllimport) HRESULT __stdcall UnregisterApplicationRestart(void); __declspec(dllimport) HRESULT __stdcall GetApplicationRecoveryCallback( HANDLE hProcess, APPLICATION_RECOVERY_CALLBACK* pRecoveryCallback, PVOID* ppvParameter, PDWORD pdwPingInterval, PDWORD pdwFlags ); __declspec(dllimport) HRESULT __stdcall GetApplicationRestartSettings( HANDLE hProcess, PWSTR pwzCommandline, PDWORD pcchSize, PDWORD pdwFlags ); __declspec(dllimport) HRESULT __stdcall ApplicationRecoveryInProgress( PBOOL pbCancelled ); __declspec(dllimport) void __stdcall ApplicationRecoveryFinished( BOOL bSuccess ); typedef struct _FILE_BASIC_INFO { LARGE_INTEGER CreationTime; LARGE_INTEGER LastAccessTime; LARGE_INTEGER LastWriteTime; LARGE_INTEGER ChangeTime; DWORD FileAttributes; } FILE_BASIC_INFO, *PFILE_BASIC_INFO; typedef struct _FILE_STANDARD_INFO { LARGE_INTEGER AllocationSize; LARGE_INTEGER EndOfFile; DWORD NumberOfLinks; BOOLEAN DeletePending; BOOLEAN Directory; } FILE_STANDARD_INFO, *PFILE_STANDARD_INFO; typedef struct _FILE_NAME_INFO { DWORD FileNameLength; WCHAR FileName[1]; } FILE_NAME_INFO, *PFILE_NAME_INFO; typedef struct _FILE_CASE_SENSITIVE_INFO { ULONG Flags; } FILE_CASE_SENSITIVE_INFO, *PFILE_CASE_SENSITIVE_INFO; typedef struct _FILE_RENAME_INFO { union { BOOLEAN ReplaceIfExists; DWORD Flags; } ; HANDLE RootDirectory; DWORD FileNameLength; WCHAR FileName[1]; } FILE_RENAME_INFO, *PFILE_RENAME_INFO; typedef struct _FILE_ALLOCATION_INFO { LARGE_INTEGER AllocationSize; } FILE_ALLOCATION_INFO, *PFILE_ALLOCATION_INFO; typedef struct _FILE_END_OF_FILE_INFO { LARGE_INTEGER EndOfFile; } FILE_END_OF_FILE_INFO, *PFILE_END_OF_FILE_INFO; typedef struct _FILE_STREAM_INFO { DWORD NextEntryOffset; DWORD StreamNameLength; LARGE_INTEGER StreamSize; LARGE_INTEGER StreamAllocationSize; WCHAR StreamName[1]; } FILE_STREAM_INFO, *PFILE_STREAM_INFO; typedef struct _FILE_COMPRESSION_INFO { LARGE_INTEGER CompressedFileSize; WORD CompressionFormat; UCHAR CompressionUnitShift; UCHAR ChunkShift; UCHAR ClusterShift; UCHAR Reserved[3]; } FILE_COMPRESSION_INFO, *PFILE_COMPRESSION_INFO; typedef struct _FILE_ATTRIBUTE_TAG_INFO { DWORD FileAttributes; DWORD ReparseTag; } FILE_ATTRIBUTE_TAG_INFO, *PFILE_ATTRIBUTE_TAG_INFO; typedef struct _FILE_DISPOSITION_INFO { BOOLEAN DeleteFileW; } FILE_DISPOSITION_INFO, *PFILE_DISPOSITION_INFO; typedef struct _FILE_DISPOSITION_INFO_EX { DWORD Flags; } FILE_DISPOSITION_INFO_EX, *PFILE_DISPOSITION_INFO_EX; typedef struct _FILE_ID_BOTH_DIR_INFO { DWORD NextEntryOffset; DWORD FileIndex; LARGE_INTEGER CreationTime; LARGE_INTEGER LastAccessTime; LARGE_INTEGER LastWriteTime; LARGE_INTEGER ChangeTime; LARGE_INTEGER EndOfFile; LARGE_INTEGER AllocationSize; DWORD FileAttributes; DWORD FileNameLength; DWORD EaSize; CCHAR ShortNameLength; WCHAR ShortName[12]; LARGE_INTEGER FileId; WCHAR FileName[1]; } FILE_ID_BOTH_DIR_INFO, *PFILE_ID_BOTH_DIR_INFO; typedef struct _FILE_FULL_DIR_INFO { ULONG NextEntryOffset; ULONG FileIndex; LARGE_INTEGER CreationTime; LARGE_INTEGER LastAccessTime; LARGE_INTEGER LastWriteTime; LARGE_INTEGER ChangeTime; LARGE_INTEGER EndOfFile; LARGE_INTEGER AllocationSize; ULONG FileAttributes; ULONG FileNameLength; ULONG EaSize; WCHAR FileName[1]; } FILE_FULL_DIR_INFO, *PFILE_FULL_DIR_INFO; typedef enum _PRIORITY_HINT { IoPriorityHintVeryLow = 0, IoPriorityHintLow, IoPriorityHintNormal, MaximumIoPriorityHintType } PRIORITY_HINT; typedef struct _FILE_IO_PRIORITY_HINT_INFO { PRIORITY_HINT PriorityHint; } FILE_IO_PRIORITY_HINT_INFO, *PFILE_IO_PRIORITY_HINT_INFO; typedef struct _FILE_ALIGNMENT_INFO { ULONG AlignmentRequirement; } FILE_ALIGNMENT_INFO, *PFILE_ALIGNMENT_INFO; typedef struct _FILE_STORAGE_INFO { ULONG LogicalBytesPerSector; ULONG PhysicalBytesPerSectorForAtomicity; ULONG PhysicalBytesPerSectorForPerformance; ULONG FileSystemEffectivePhysicalBytesPerSectorForAtomicity; ULONG Flags; ULONG ByteOffsetForSectorAlignment; ULONG ByteOffsetForPartitionAlignment; } FILE_STORAGE_INFO, *PFILE_STORAGE_INFO; typedef struct _FILE_ID_INFO { ULONGLONG VolumeSerialNumber; FILE_ID_128 FileId; } FILE_ID_INFO, *PFILE_ID_INFO; typedef struct _FILE_ID_EXTD_DIR_INFO { ULONG NextEntryOffset; ULONG FileIndex; LARGE_INTEGER CreationTime; LARGE_INTEGER LastAccessTime; LARGE_INTEGER LastWriteTime; LARGE_INTEGER ChangeTime; LARGE_INTEGER EndOfFile; LARGE_INTEGER AllocationSize; ULONG FileAttributes; ULONG FileNameLength; ULONG EaSize; ULONG ReparsePointTag; FILE_ID_128 FileId; WCHAR FileName[1]; } FILE_ID_EXTD_DIR_INFO, *PFILE_ID_EXTD_DIR_INFO; typedef struct _FILE_REMOTE_PROTOCOL_INFO { USHORT StructureVersion; USHORT StructureSize; ULONG Protocol; USHORT ProtocolMajorVersion; USHORT ProtocolMinorVersion; USHORT ProtocolRevision; USHORT Reserved; ULONG Flags; struct { ULONG Reserved[8]; } GenericReserved; union { struct { struct { ULONG Capabilities; } Server; struct { ULONG Capabilities; ULONG CachingFlags; } Share; } Smb2; ULONG Reserved[16]; } ProtocolSpecific; } FILE_REMOTE_PROTOCOL_INFO, *PFILE_REMOTE_PROTOCOL_INFO; __declspec(dllimport) BOOL __stdcall GetFileInformationByHandleEx( HANDLE hFile, FILE_INFO_BY_HANDLE_CLASS FileInformationClass, LPVOID lpFileInformation, DWORD dwBufferSize ); typedef enum _FILE_ID_TYPE { FileIdType, ObjectIdType, ExtendedFileIdType, MaximumFileIdType } FILE_ID_TYPE, *PFILE_ID_TYPE; typedef struct FILE_ID_DESCRIPTOR { DWORD dwSize; FILE_ID_TYPE Type; union { LARGE_INTEGER FileId; GUID ObjectId; FILE_ID_128 ExtendedFileId; } ; } FILE_ID_DESCRIPTOR, *LPFILE_ID_DESCRIPTOR; __declspec(dllimport) HANDLE __stdcall OpenFileById ( HANDLE hVolumeHint, LPFILE_ID_DESCRIPTOR lpFileId, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwFlagsAndAttributes ); __declspec(dllimport) BOOLEAN __stdcall CreateSymbolicLinkA ( LPCSTR lpSymlinkFileName, LPCSTR lpTargetFileName, DWORD dwFlags ); __declspec(dllimport) BOOLEAN __stdcall CreateSymbolicLinkW ( LPCWSTR lpSymlinkFileName, LPCWSTR lpTargetFileName, DWORD dwFlags ); __declspec(dllimport) BOOL __stdcall QueryActCtxSettingsW( DWORD dwFlags, HANDLE hActCtx, PCWSTR settingsNameSpace, PCWSTR settingName, PWSTR pvBuffer, SIZE_T dwBuffer, SIZE_T *pdwWrittenOrRequired ); __declspec(dllimport) BOOLEAN __stdcall CreateSymbolicLinkTransactedA ( LPCSTR lpSymlinkFileName, LPCSTR lpTargetFileName, DWORD dwFlags, HANDLE hTransaction ); __declspec(dllimport) BOOLEAN __stdcall CreateSymbolicLinkTransactedW ( LPCWSTR lpSymlinkFileName, LPCWSTR lpTargetFileName, DWORD dwFlags, HANDLE hTransaction ); __declspec(dllimport) BOOL __stdcall ReplacePartitionUnit ( PWSTR TargetPartition, PWSTR SparePartition, ULONG Flags ); __declspec(dllimport) BOOL __stdcall AddSecureMemoryCacheCallback( PSECURE_MEMORY_CACHE_CALLBACK pfnCallBack ); __declspec(dllimport) BOOL __stdcall RemoveSecureMemoryCacheCallback( PSECURE_MEMORY_CACHE_CALLBACK pfnCallBack ); __declspec(dllimport) BOOL __stdcall CopyContext( PCONTEXT Destination, DWORD ContextFlags, PCONTEXT Source ); __declspec(dllimport) BOOL __stdcall InitializeContext( PVOID Buffer, DWORD ContextFlags, PCONTEXT* Context, PDWORD ContextLength ); __declspec(dllimport) DWORD64 __stdcall GetEnabledXStateFeatures( void ); __declspec(dllimport) BOOL __stdcall GetXStateFeaturesMask( PCONTEXT Context, PDWORD64 FeatureMask ); __declspec(dllimport) PVOID __stdcall LocateXStateFeature( PCONTEXT Context, DWORD FeatureId, PDWORD Length ); __declspec(dllimport) BOOL __stdcall SetXStateFeaturesMask( PCONTEXT Context, DWORD64 FeatureMask ); __declspec(dllimport) DWORD __stdcall EnableThreadProfiling( HANDLE ThreadHandle, DWORD Flags, DWORD64 HardwareCounters, HANDLE *PerformanceDataHandle ); __declspec(dllimport) DWORD __stdcall DisableThreadProfiling( HANDLE PerformanceDataHandle ); __declspec(dllimport) DWORD __stdcall QueryThreadProfiling( HANDLE ThreadHandle, PBOOLEAN Enabled ); __declspec(dllimport) DWORD __stdcall ReadThreadProfilingData( HANDLE PerformanceDataHandle, DWORD Flags, PPERFORMANCE_DATA PerformanceData ); } #pragma warning(pop) extern "C++" { __forceinline unsigned _InterlockedIncrement( unsigned volatile *Addend ) { return (unsigned) _InterlockedIncrement((volatile long*) Addend); } __forceinline unsigned long _InterlockedIncrement( unsigned long volatile *Addend ) { return (unsigned long) _InterlockedIncrement((volatile long*) Addend); } __forceinline unsigned __int64 _InterlockedIncrement( unsigned __int64 volatile *Addend ) { return (unsigned __int64) (_InterlockedIncrement64)((volatile __int64*) Addend); } __forceinline unsigned _InterlockedDecrement( unsigned volatile *Addend ) { return (unsigned long) _InterlockedDecrement((volatile long*) Addend); } __forceinline unsigned long _InterlockedDecrement( unsigned long volatile *Addend ) { return (unsigned long) _InterlockedDecrement((volatile long*) Addend); } __forceinline unsigned __int64 _InterlockedDecrement( unsigned __int64 volatile *Addend ) { return (unsigned __int64) (_InterlockedDecrement64)((volatile __int64*) Addend); } __forceinline unsigned _InterlockedExchange( unsigned volatile *Target, unsigned Value ) { return (unsigned) _InterlockedExchange((volatile long*) Target, (long) Value); } __forceinline unsigned long _InterlockedExchange( unsigned long volatile *Target, unsigned long Value ) { return (unsigned long) _InterlockedExchange((volatile long*) Target, (long) Value); } __forceinline unsigned __int64 _InterlockedExchange( unsigned __int64 volatile *Target, unsigned __int64 Value ) { return (unsigned __int64) _InterlockedExchange64((volatile __int64*) Target, (__int64) Value); } __forceinline unsigned _InterlockedExchangeAdd( unsigned volatile *Addend, unsigned Value ) { return (unsigned) _InterlockedExchangeAdd((volatile long*) Addend, (long) Value); } __forceinline unsigned InterlockedExchangeSubtract( unsigned volatile *Addend, unsigned Value ) { return (unsigned) _InterlockedExchangeAdd((volatile long*) Addend, - (long) Value); } __forceinline unsigned long _InterlockedExchangeAdd( unsigned long volatile *Addend, unsigned long Value ) { return (unsigned long) _InterlockedExchangeAdd((volatile long*) Addend, (long) Value); } __forceinline unsigned long InterlockedExchangeSubtract( unsigned long volatile *Addend, unsigned long Value ) { return (unsigned long) _InterlockedExchangeAdd((volatile long*) Addend, - (long) Value); } __forceinline unsigned __int64 _InterlockedExchangeAdd( unsigned __int64 volatile *Addend, unsigned __int64 Value ) { return (unsigned __int64) _InterlockedExchangeAdd64((volatile __int64*) Addend, (__int64) Value); } __forceinline unsigned __int64 InterlockedExchangeSubtract( unsigned __int64 volatile *Addend, unsigned __int64 Value ) { return (unsigned __int64) _InterlockedExchangeAdd64((volatile __int64*) Addend, - (__int64) Value); } __forceinline unsigned _InterlockedCompareExchange( unsigned volatile *Destination, unsigned Exchange, unsigned Comperand ) { return (unsigned) _InterlockedCompareExchange((volatile long*) Destination, (long) Exchange, (long) Comperand); } __forceinline unsigned long _InterlockedCompareExchange( unsigned long volatile *Destination, unsigned long Exchange, unsigned long Comperand ) { return (unsigned long) _InterlockedCompareExchange((volatile long*) Destination, (long) Exchange, (long) Comperand); } __forceinline unsigned __int64 _InterlockedCompareExchange( unsigned __int64 volatile *Destination, unsigned __int64 Exchange, unsigned __int64 Comperand ) { return (unsigned __int64) _InterlockedCompareExchange64((volatile __int64*) Destination, (__int64) Exchange, (__int64) Comperand); } __forceinline unsigned __int64 _InterlockedAnd( unsigned __int64 volatile *Destination, unsigned __int64 Value ) { return (unsigned __int64) _InterlockedAnd64((volatile __int64*) Destination, (__int64) Value); } __forceinline unsigned __int64 _InterlockedOr( unsigned __int64 volatile *Destination, unsigned __int64 Value ) { return (unsigned __int64) _InterlockedOr64((volatile __int64*) Destination, (__int64) Value); } __forceinline unsigned __int64 _InterlockedXor( unsigned __int64 volatile *Destination, unsigned __int64 Value ) { return (unsigned __int64) _InterlockedXor64((volatile __int64*) Destination, (__int64) Value); } } #pragma warning(push) #pragma warning(disable: 4201) #pragma warning(disable: 4820) extern "C" { typedef struct _DRAWPATRECT { POINT ptPosition; POINT ptSize; WORD wStyle; WORD wPattern; } DRAWPATRECT, *PDRAWPATRECT; typedef struct _PSINJECTDATA { DWORD DataBytes; WORD InjectionPoint; WORD PageNumber; } PSINJECTDATA, *PPSINJECTDATA; typedef struct _PSFEATURE_OUTPUT { BOOL bPageIndependent; BOOL bSetPageDevice; } PSFEATURE_OUTPUT, *PPSFEATURE_OUTPUT; typedef struct _PSFEATURE_CUSTPAPER { LONG lOrientation; LONG lWidth; LONG lHeight; LONG lWidthOffset; LONG lHeightOffset; } PSFEATURE_CUSTPAPER, *PPSFEATURE_CUSTPAPER; typedef struct tagXFORM { FLOAT eM11; FLOAT eM12; FLOAT eM21; FLOAT eM22; FLOAT eDx; FLOAT eDy; } XFORM, *PXFORM, *LPXFORM; typedef struct tagBITMAP { LONG bmType; LONG bmWidth; LONG bmHeight; LONG bmWidthBytes; WORD bmPlanes; WORD bmBitsPixel; LPVOID bmBits; } BITMAP, *PBITMAP, *NPBITMAP, *LPBITMAP; #pragma warning(disable: 4103) #pragma pack(push,1) typedef struct tagRGBTRIPLE { BYTE rgbtBlue; BYTE rgbtGreen; BYTE rgbtRed; } RGBTRIPLE, *PRGBTRIPLE, *NPRGBTRIPLE, *LPRGBTRIPLE; #pragma warning(disable: 4103) #pragma pack(pop) typedef struct tagRGBQUAD { BYTE rgbBlue; BYTE rgbGreen; BYTE rgbRed; BYTE rgbReserved; } RGBQUAD; typedef RGBQUAD * LPRGBQUAD; typedef LONG LCSCSTYPE; typedef LONG LCSGAMUTMATCH; typedef long FXPT16DOT16, *LPFXPT16DOT16; typedef long FXPT2DOT30, *LPFXPT2DOT30; typedef struct tagCIEXYZ { FXPT2DOT30 ciexyzX; FXPT2DOT30 ciexyzY; FXPT2DOT30 ciexyzZ; } CIEXYZ; typedef CIEXYZ *LPCIEXYZ; typedef struct tagICEXYZTRIPLE { CIEXYZ ciexyzRed; CIEXYZ ciexyzGreen; CIEXYZ ciexyzBlue; } CIEXYZTRIPLE; typedef CIEXYZTRIPLE *LPCIEXYZTRIPLE; typedef struct tagLOGCOLORSPACEA { DWORD lcsSignature; DWORD lcsVersion; DWORD lcsSize; LCSCSTYPE lcsCSType; LCSGAMUTMATCH lcsIntent; CIEXYZTRIPLE lcsEndpoints; DWORD lcsGammaRed; DWORD lcsGammaGreen; DWORD lcsGammaBlue; CHAR lcsFilename[260]; } LOGCOLORSPACEA, *LPLOGCOLORSPACEA; typedef struct tagLOGCOLORSPACEW { DWORD lcsSignature; DWORD lcsVersion; DWORD lcsSize; LCSCSTYPE lcsCSType; LCSGAMUTMATCH lcsIntent; CIEXYZTRIPLE lcsEndpoints; DWORD lcsGammaRed; DWORD lcsGammaGreen; DWORD lcsGammaBlue; WCHAR lcsFilename[260]; } LOGCOLORSPACEW, *LPLOGCOLORSPACEW; typedef LOGCOLORSPACEW LOGCOLORSPACE; typedef LPLOGCOLORSPACEW LPLOGCOLORSPACE; typedef struct tagBITMAPCOREHEADER { DWORD bcSize; WORD bcWidth; WORD bcHeight; WORD bcPlanes; WORD bcBitCount; } BITMAPCOREHEADER, *LPBITMAPCOREHEADER, *PBITMAPCOREHEADER; typedef struct tagBITMAPINFOHEADER{ DWORD biSize; LONG biWidth; LONG biHeight; WORD biPlanes; WORD biBitCount; DWORD biCompression; DWORD biSizeImage; LONG biXPelsPerMeter; LONG biYPelsPerMeter; DWORD biClrUsed; DWORD biClrImportant; } BITMAPINFOHEADER, *LPBITMAPINFOHEADER, *PBITMAPINFOHEADER; typedef struct { DWORD bV4Size; LONG bV4Width; LONG bV4Height; WORD bV4Planes; WORD bV4BitCount; DWORD bV4V4Compression; DWORD bV4SizeImage; LONG bV4XPelsPerMeter; LONG bV4YPelsPerMeter; DWORD bV4ClrUsed; DWORD bV4ClrImportant; DWORD bV4RedMask; DWORD bV4GreenMask; DWORD bV4BlueMask; DWORD bV4AlphaMask; DWORD bV4CSType; CIEXYZTRIPLE bV4Endpoints; DWORD bV4GammaRed; DWORD bV4GammaGreen; DWORD bV4GammaBlue; } BITMAPV4HEADER, *LPBITMAPV4HEADER, *PBITMAPV4HEADER; typedef struct { DWORD bV5Size; LONG bV5Width; LONG bV5Height; WORD bV5Planes; WORD bV5BitCount; DWORD bV5Compression; DWORD bV5SizeImage; LONG bV5XPelsPerMeter; LONG bV5YPelsPerMeter; DWORD bV5ClrUsed; DWORD bV5ClrImportant; DWORD bV5RedMask; DWORD bV5GreenMask; DWORD bV5BlueMask; DWORD bV5AlphaMask; DWORD bV5CSType; CIEXYZTRIPLE bV5Endpoints; DWORD bV5GammaRed; DWORD bV5GammaGreen; DWORD bV5GammaBlue; DWORD bV5Intent; DWORD bV5ProfileData; DWORD bV5ProfileSize; DWORD bV5Reserved; } BITMAPV5HEADER, *LPBITMAPV5HEADER, *PBITMAPV5HEADER; typedef struct tagBITMAPINFO { BITMAPINFOHEADER bmiHeader; RGBQUAD bmiColors[1]; } BITMAPINFO, *LPBITMAPINFO, *PBITMAPINFO; typedef struct tagBITMAPCOREINFO { BITMAPCOREHEADER bmciHeader; RGBTRIPLE bmciColors[1]; } BITMAPCOREINFO, *LPBITMAPCOREINFO, *PBITMAPCOREINFO; #pragma warning(disable: 4103) #pragma pack(push,2) typedef struct tagBITMAPFILEHEADER { WORD bfType; DWORD bfSize; WORD bfReserved1; WORD bfReserved2; DWORD bfOffBits; } BITMAPFILEHEADER, *LPBITMAPFILEHEADER, *PBITMAPFILEHEADER; #pragma warning(disable: 4103) #pragma pack(pop) typedef struct tagFONTSIGNATURE { DWORD fsUsb[4]; DWORD fsCsb[2]; } FONTSIGNATURE, *PFONTSIGNATURE, *LPFONTSIGNATURE; typedef struct tagCHARSETINFO { UINT ciCharset; UINT ciACP; FONTSIGNATURE fs; } CHARSETINFO, *PCHARSETINFO, *NPCHARSETINFO, *LPCHARSETINFO; typedef struct tagLOCALESIGNATURE { DWORD lsUsb[4]; DWORD lsCsbDefault[2]; DWORD lsCsbSupported[2]; } LOCALESIGNATURE, *PLOCALESIGNATURE, *LPLOCALESIGNATURE; typedef struct tagHANDLETABLE { HGDIOBJ objectHandle[1]; } HANDLETABLE, *PHANDLETABLE, *LPHANDLETABLE; typedef struct tagMETARECORD { DWORD rdSize; WORD rdFunction; WORD rdParm[1]; } METARECORD; typedef struct tagMETARECORD __unaligned *PMETARECORD; typedef struct tagMETARECORD __unaligned *LPMETARECORD; typedef struct tagMETAFILEPICT { LONG mm; LONG xExt; LONG yExt; HMETAFILE hMF; } METAFILEPICT, *LPMETAFILEPICT; #pragma warning(disable: 4103) #pragma pack(push,2) typedef struct tagMETAHEADER { WORD mtType; WORD mtHeaderSize; WORD mtVersion; DWORD mtSize; WORD mtNoObjects; DWORD mtMaxRecord; WORD mtNoParameters; } METAHEADER; typedef struct tagMETAHEADER __unaligned *PMETAHEADER; typedef struct tagMETAHEADER __unaligned *LPMETAHEADER; #pragma warning(disable: 4103) #pragma pack(pop) typedef struct tagENHMETARECORD { DWORD iType; DWORD nSize; DWORD dParm[1]; } ENHMETARECORD, *PENHMETARECORD, *LPENHMETARECORD; typedef struct tagENHMETAHEADER { DWORD iType; DWORD nSize; RECTL rclBounds; RECTL rclFrame; DWORD dSignature; DWORD nVersion; DWORD nBytes; DWORD nRecords; WORD nHandles; WORD sReserved; DWORD nDescription; DWORD offDescription; DWORD nPalEntries; SIZEL szlDevice; SIZEL szlMillimeters; DWORD cbPixelFormat; DWORD offPixelFormat; DWORD bOpenGL; SIZEL szlMicrometers; } ENHMETAHEADER, *PENHMETAHEADER, *LPENHMETAHEADER; typedef WCHAR BCHAR; #pragma warning(disable: 4103) #pragma pack(push,4) typedef struct tagTEXTMETRICA { LONG tmHeight; LONG tmAscent; LONG tmDescent; LONG tmInternalLeading; LONG tmExternalLeading; LONG tmAveCharWidth; LONG tmMaxCharWidth; LONG tmWeight; LONG tmOverhang; LONG tmDigitizedAspectX; LONG tmDigitizedAspectY; BYTE tmFirstChar; BYTE tmLastChar; BYTE tmDefaultChar; BYTE tmBreakChar; BYTE tmItalic; BYTE tmUnderlined; BYTE tmStruckOut; BYTE tmPitchAndFamily; BYTE tmCharSet; } TEXTMETRICA, *PTEXTMETRICA, *NPTEXTMETRICA, *LPTEXTMETRICA; typedef struct tagTEXTMETRICW { LONG tmHeight; LONG tmAscent; LONG tmDescent; LONG tmInternalLeading; LONG tmExternalLeading; LONG tmAveCharWidth; LONG tmMaxCharWidth; LONG tmWeight; LONG tmOverhang; LONG tmDigitizedAspectX; LONG tmDigitizedAspectY; WCHAR tmFirstChar; WCHAR tmLastChar; WCHAR tmDefaultChar; WCHAR tmBreakChar; BYTE tmItalic; BYTE tmUnderlined; BYTE tmStruckOut; BYTE tmPitchAndFamily; BYTE tmCharSet; } TEXTMETRICW, *PTEXTMETRICW, *NPTEXTMETRICW, *LPTEXTMETRICW; typedef TEXTMETRICW TEXTMETRIC; typedef PTEXTMETRICW PTEXTMETRIC; typedef NPTEXTMETRICW NPTEXTMETRIC; typedef LPTEXTMETRICW LPTEXTMETRIC; #pragma warning(disable: 4103) #pragma pack(pop) #pragma warning(disable: 4103) #pragma pack(push,4) typedef struct tagNEWTEXTMETRICA { LONG tmHeight; LONG tmAscent; LONG tmDescent; LONG tmInternalLeading; LONG tmExternalLeading; LONG tmAveCharWidth; LONG tmMaxCharWidth; LONG tmWeight; LONG tmOverhang; LONG tmDigitizedAspectX; LONG tmDigitizedAspectY; BYTE tmFirstChar; BYTE tmLastChar; BYTE tmDefaultChar; BYTE tmBreakChar; BYTE tmItalic; BYTE tmUnderlined; BYTE tmStruckOut; BYTE tmPitchAndFamily; BYTE tmCharSet; DWORD ntmFlags; UINT ntmSizeEM; UINT ntmCellHeight; UINT ntmAvgWidth; } NEWTEXTMETRICA, *PNEWTEXTMETRICA, *NPNEWTEXTMETRICA, *LPNEWTEXTMETRICA; typedef struct tagNEWTEXTMETRICW { LONG tmHeight; LONG tmAscent; LONG tmDescent; LONG tmInternalLeading; LONG tmExternalLeading; LONG tmAveCharWidth; LONG tmMaxCharWidth; LONG tmWeight; LONG tmOverhang; LONG tmDigitizedAspectX; LONG tmDigitizedAspectY; WCHAR tmFirstChar; WCHAR tmLastChar; WCHAR tmDefaultChar; WCHAR tmBreakChar; BYTE tmItalic; BYTE tmUnderlined; BYTE tmStruckOut; BYTE tmPitchAndFamily; BYTE tmCharSet; DWORD ntmFlags; UINT ntmSizeEM; UINT ntmCellHeight; UINT ntmAvgWidth; } NEWTEXTMETRICW, *PNEWTEXTMETRICW, *NPNEWTEXTMETRICW, *LPNEWTEXTMETRICW; typedef NEWTEXTMETRICW NEWTEXTMETRIC; typedef PNEWTEXTMETRICW PNEWTEXTMETRIC; typedef NPNEWTEXTMETRICW NPNEWTEXTMETRIC; typedef LPNEWTEXTMETRICW LPNEWTEXTMETRIC; #pragma warning(disable: 4103) #pragma pack(pop) typedef struct tagNEWTEXTMETRICEXA { NEWTEXTMETRICA ntmTm; FONTSIGNATURE ntmFontSig; }NEWTEXTMETRICEXA; typedef struct tagNEWTEXTMETRICEXW { NEWTEXTMETRICW ntmTm; FONTSIGNATURE ntmFontSig; }NEWTEXTMETRICEXW; typedef NEWTEXTMETRICEXW NEWTEXTMETRICEX; typedef struct tagPELARRAY { LONG paXCount; LONG paYCount; LONG paXExt; LONG paYExt; BYTE paRGBs; } PELARRAY, *PPELARRAY, *NPPELARRAY, *LPPELARRAY; typedef struct tagLOGBRUSH { UINT lbStyle; COLORREF lbColor; ULONG_PTR lbHatch; } LOGBRUSH, *PLOGBRUSH, *NPLOGBRUSH, *LPLOGBRUSH; typedef struct tagLOGBRUSH32 { UINT lbStyle; COLORREF lbColor; ULONG lbHatch; } LOGBRUSH32, *PLOGBRUSH32, *NPLOGBRUSH32, *LPLOGBRUSH32; typedef LOGBRUSH PATTERN; typedef PATTERN *PPATTERN; typedef PATTERN *NPPATTERN; typedef PATTERN *LPPATTERN; typedef struct tagLOGPEN { UINT lopnStyle; POINT lopnWidth; COLORREF lopnColor; } LOGPEN, *PLOGPEN, *NPLOGPEN, *LPLOGPEN; typedef struct tagEXTLOGPEN { DWORD elpPenStyle; DWORD elpWidth; UINT elpBrushStyle; COLORREF elpColor; ULONG_PTR elpHatch; DWORD elpNumEntries; DWORD elpStyleEntry[1]; } EXTLOGPEN, *PEXTLOGPEN, *NPEXTLOGPEN, *LPEXTLOGPEN; typedef struct tagEXTLOGPEN32 { DWORD elpPenStyle; DWORD elpWidth; UINT elpBrushStyle; COLORREF elpColor; ULONG elpHatch; DWORD elpNumEntries; DWORD elpStyleEntry[1]; } EXTLOGPEN32, *PEXTLOGPEN32, *NPEXTLOGPEN32, *LPEXTLOGPEN32; typedef struct tagPALETTEENTRY { BYTE peRed; BYTE peGreen; BYTE peBlue; BYTE peFlags; } PALETTEENTRY, *PPALETTEENTRY, *LPPALETTEENTRY; typedef struct tagLOGPALETTE { WORD palVersion; WORD palNumEntries; PALETTEENTRY palPalEntry[1]; } LOGPALETTE, *PLOGPALETTE, *NPLOGPALETTE, *LPLOGPALETTE; typedef struct tagLOGFONTA { LONG lfHeight; LONG lfWidth; LONG lfEscapement; LONG lfOrientation; LONG lfWeight; BYTE lfItalic; BYTE lfUnderline; BYTE lfStrikeOut; BYTE lfCharSet; BYTE lfOutPrecision; BYTE lfClipPrecision; BYTE lfQuality; BYTE lfPitchAndFamily; CHAR lfFaceName[32]; } LOGFONTA, *PLOGFONTA, *NPLOGFONTA, *LPLOGFONTA; typedef struct tagLOGFONTW { LONG lfHeight; LONG lfWidth; LONG lfEscapement; LONG lfOrientation; LONG lfWeight; BYTE lfItalic; BYTE lfUnderline; BYTE lfStrikeOut; BYTE lfCharSet; BYTE lfOutPrecision; BYTE lfClipPrecision; BYTE lfQuality; BYTE lfPitchAndFamily; WCHAR lfFaceName[32]; } LOGFONTW, *PLOGFONTW, *NPLOGFONTW, *LPLOGFONTW; typedef LOGFONTW LOGFONT; typedef PLOGFONTW PLOGFONT; typedef NPLOGFONTW NPLOGFONT; typedef LPLOGFONTW LPLOGFONT; typedef struct tagENUMLOGFONTA { LOGFONTA elfLogFont; BYTE elfFullName[64]; BYTE elfStyle[32]; } ENUMLOGFONTA, * LPENUMLOGFONTA; typedef struct tagENUMLOGFONTW { LOGFONTW elfLogFont; WCHAR elfFullName[64]; WCHAR elfStyle[32]; } ENUMLOGFONTW, * LPENUMLOGFONTW; typedef ENUMLOGFONTW ENUMLOGFONT; typedef LPENUMLOGFONTW LPENUMLOGFONT; typedef struct tagENUMLOGFONTEXA { LOGFONTA elfLogFont; BYTE elfFullName[64]; BYTE elfStyle[32]; BYTE elfScript[32]; } ENUMLOGFONTEXA, *LPENUMLOGFONTEXA; typedef struct tagENUMLOGFONTEXW { LOGFONTW elfLogFont; WCHAR elfFullName[64]; WCHAR elfStyle[32]; WCHAR elfScript[32]; } ENUMLOGFONTEXW, *LPENUMLOGFONTEXW; typedef ENUMLOGFONTEXW ENUMLOGFONTEX; typedef LPENUMLOGFONTEXW LPENUMLOGFONTEX; typedef struct tagPANOSE { BYTE bFamilyType; BYTE bSerifStyle; BYTE bWeight; BYTE bProportion; BYTE bContrast; BYTE bStrokeVariation; BYTE bArmStyle; BYTE bLetterform; BYTE bMidline; BYTE bXHeight; } PANOSE, * LPPANOSE; typedef struct tagEXTLOGFONTA { LOGFONTA elfLogFont; BYTE elfFullName[64]; BYTE elfStyle[32]; DWORD elfVersion; DWORD elfStyleSize; DWORD elfMatch; DWORD elfReserved; BYTE elfVendorId[4]; DWORD elfCulture; PANOSE elfPanose; } EXTLOGFONTA, *PEXTLOGFONTA, *NPEXTLOGFONTA, *LPEXTLOGFONTA; typedef struct tagEXTLOGFONTW { LOGFONTW elfLogFont; WCHAR elfFullName[64]; WCHAR elfStyle[32]; DWORD elfVersion; DWORD elfStyleSize; DWORD elfMatch; DWORD elfReserved; BYTE elfVendorId[4]; DWORD elfCulture; PANOSE elfPanose; } EXTLOGFONTW, *PEXTLOGFONTW, *NPEXTLOGFONTW, *LPEXTLOGFONTW; typedef EXTLOGFONTW EXTLOGFONT; typedef PEXTLOGFONTW PEXTLOGFONT; typedef NPEXTLOGFONTW NPEXTLOGFONT; typedef LPEXTLOGFONTW LPEXTLOGFONT; typedef struct _devicemodeA { BYTE dmDeviceName[32]; WORD dmSpecVersion; WORD dmDriverVersion; WORD dmSize; WORD dmDriverExtra; DWORD dmFields; union { struct { short dmOrientation; short dmPaperSize; short dmPaperLength; short dmPaperWidth; short dmScale; short dmCopies; short dmDefaultSource; short dmPrintQuality; } ; struct { POINTL dmPosition; DWORD dmDisplayOrientation; DWORD dmDisplayFixedOutput; } ; } ; short dmColor; short dmDuplex; short dmYResolution; short dmTTOption; short dmCollate; BYTE dmFormName[32]; WORD dmLogPixels; DWORD dmBitsPerPel; DWORD dmPelsWidth; DWORD dmPelsHeight; union { DWORD dmDisplayFlags; DWORD dmNup; } ; DWORD dmDisplayFrequency; DWORD dmICMMethod; DWORD dmICMIntent; DWORD dmMediaType; DWORD dmDitherType; DWORD dmReserved1; DWORD dmReserved2; DWORD dmPanningWidth; DWORD dmPanningHeight; } DEVMODEA, *PDEVMODEA, *NPDEVMODEA, *LPDEVMODEA; typedef struct _devicemodeW { WCHAR dmDeviceName[32]; WORD dmSpecVersion; WORD dmDriverVersion; WORD dmSize; WORD dmDriverExtra; DWORD dmFields; union { struct { short dmOrientation; short dmPaperSize; short dmPaperLength; short dmPaperWidth; short dmScale; short dmCopies; short dmDefaultSource; short dmPrintQuality; } ; struct { POINTL dmPosition; DWORD dmDisplayOrientation; DWORD dmDisplayFixedOutput; } ; } ; short dmColor; short dmDuplex; short dmYResolution; short dmTTOption; short dmCollate; WCHAR dmFormName[32]; WORD dmLogPixels; DWORD dmBitsPerPel; DWORD dmPelsWidth; DWORD dmPelsHeight; union { DWORD dmDisplayFlags; DWORD dmNup; } ; DWORD dmDisplayFrequency; DWORD dmICMMethod; DWORD dmICMIntent; DWORD dmMediaType; DWORD dmDitherType; DWORD dmReserved1; DWORD dmReserved2; DWORD dmPanningWidth; DWORD dmPanningHeight; } DEVMODEW, *PDEVMODEW, *NPDEVMODEW, *LPDEVMODEW; typedef DEVMODEW DEVMODE; typedef PDEVMODEW PDEVMODE; typedef NPDEVMODEW NPDEVMODE; typedef LPDEVMODEW LPDEVMODE; typedef struct _DISPLAY_DEVICEA { DWORD cb; CHAR DeviceName[32]; CHAR DeviceString[128]; DWORD StateFlags; CHAR DeviceID[128]; CHAR DeviceKey[128]; } DISPLAY_DEVICEA, *PDISPLAY_DEVICEA, *LPDISPLAY_DEVICEA; typedef struct _DISPLAY_DEVICEW { DWORD cb; WCHAR DeviceName[32]; WCHAR DeviceString[128]; DWORD StateFlags; WCHAR DeviceID[128]; WCHAR DeviceKey[128]; } DISPLAY_DEVICEW, *PDISPLAY_DEVICEW, *LPDISPLAY_DEVICEW; typedef DISPLAY_DEVICEW DISPLAY_DEVICE; typedef PDISPLAY_DEVICEW PDISPLAY_DEVICE; typedef LPDISPLAY_DEVICEW LPDISPLAY_DEVICE; typedef struct DISPLAYCONFIG_RATIONAL { UINT32 Numerator; UINT32 Denominator; } DISPLAYCONFIG_RATIONAL; typedef enum { DISPLAYCONFIG_OUTPUT_TECHNOLOGY_OTHER = -1, DISPLAYCONFIG_OUTPUT_TECHNOLOGY_HD15 = 0, DISPLAYCONFIG_OUTPUT_TECHNOLOGY_SVIDEO = 1, DISPLAYCONFIG_OUTPUT_TECHNOLOGY_COMPOSITE_VIDEO = 2, DISPLAYCONFIG_OUTPUT_TECHNOLOGY_COMPONENT_VIDEO = 3, DISPLAYCONFIG_OUTPUT_TECHNOLOGY_DVI = 4, DISPLAYCONFIG_OUTPUT_TECHNOLOGY_HDMI = 5, DISPLAYCONFIG_OUTPUT_TECHNOLOGY_LVDS = 6, DISPLAYCONFIG_OUTPUT_TECHNOLOGY_D_JPN = 8, DISPLAYCONFIG_OUTPUT_TECHNOLOGY_SDI = 9, DISPLAYCONFIG_OUTPUT_TECHNOLOGY_DISPLAYPORT_EXTERNAL = 10, DISPLAYCONFIG_OUTPUT_TECHNOLOGY_DISPLAYPORT_EMBEDDED = 11, DISPLAYCONFIG_OUTPUT_TECHNOLOGY_UDI_EXTERNAL = 12, DISPLAYCONFIG_OUTPUT_TECHNOLOGY_UDI_EMBEDDED = 13, DISPLAYCONFIG_OUTPUT_TECHNOLOGY_SDTVDONGLE = 14, DISPLAYCONFIG_OUTPUT_TECHNOLOGY_MIRACAST = 15, DISPLAYCONFIG_OUTPUT_TECHNOLOGY_INDIRECT_WIRED = 16, DISPLAYCONFIG_OUTPUT_TECHNOLOGY_INDIRECT_VIRTUAL = 17, DISPLAYCONFIG_OUTPUT_TECHNOLOGY_INTERNAL = 0x80000000, DISPLAYCONFIG_OUTPUT_TECHNOLOGY_FORCE_UINT32 = 0xFFFFFFFF } DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY; typedef enum { DISPLAYCONFIG_SCANLINE_ORDERING_UNSPECIFIED = 0, DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE = 1, DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED = 2, DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED_UPPERFIELDFIRST = DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED, DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED_LOWERFIELDFIRST = 3, DISPLAYCONFIG_SCANLINE_ORDERING_FORCE_UINT32 = 0xFFFFFFFF } DISPLAYCONFIG_SCANLINE_ORDERING; typedef struct DISPLAYCONFIG_2DREGION { UINT32 cx; UINT32 cy; } DISPLAYCONFIG_2DREGION; typedef struct DISPLAYCONFIG_VIDEO_SIGNAL_INFO { UINT64 pixelRate; DISPLAYCONFIG_RATIONAL hSyncFreq; DISPLAYCONFIG_RATIONAL vSyncFreq; DISPLAYCONFIG_2DREGION activeSize; DISPLAYCONFIG_2DREGION totalSize; union { struct { UINT32 videoStandard : 16; UINT32 vSyncFreqDivider : 6; UINT32 reserved : 10; } AdditionalSignalInfo; UINT32 videoStandard; } ; DISPLAYCONFIG_SCANLINE_ORDERING scanLineOrdering; } DISPLAYCONFIG_VIDEO_SIGNAL_INFO; typedef enum { DISPLAYCONFIG_SCALING_IDENTITY = 1, DISPLAYCONFIG_SCALING_CENTERED = 2, DISPLAYCONFIG_SCALING_STRETCHED = 3, DISPLAYCONFIG_SCALING_ASPECTRATIOCENTEREDMAX = 4, DISPLAYCONFIG_SCALING_CUSTOM = 5, DISPLAYCONFIG_SCALING_PREFERRED = 128, DISPLAYCONFIG_SCALING_FORCE_UINT32 = 0xFFFFFFFF } DISPLAYCONFIG_SCALING; typedef enum { DISPLAYCONFIG_ROTATION_IDENTITY = 1, DISPLAYCONFIG_ROTATION_ROTATE90 = 2, DISPLAYCONFIG_ROTATION_ROTATE180 = 3, DISPLAYCONFIG_ROTATION_ROTATE270 = 4, DISPLAYCONFIG_ROTATION_FORCE_UINT32 = 0xFFFFFFFF } DISPLAYCONFIG_ROTATION; typedef enum { DISPLAYCONFIG_MODE_INFO_TYPE_SOURCE = 1, DISPLAYCONFIG_MODE_INFO_TYPE_TARGET = 2, DISPLAYCONFIG_MODE_INFO_TYPE_DESKTOP_IMAGE = 3, DISPLAYCONFIG_MODE_INFO_TYPE_FORCE_UINT32 = 0xFFFFFFFF } DISPLAYCONFIG_MODE_INFO_TYPE; typedef enum { DISPLAYCONFIG_PIXELFORMAT_8BPP = 1, DISPLAYCONFIG_PIXELFORMAT_16BPP = 2, DISPLAYCONFIG_PIXELFORMAT_24BPP = 3, DISPLAYCONFIG_PIXELFORMAT_32BPP = 4, DISPLAYCONFIG_PIXELFORMAT_NONGDI = 5, DISPLAYCONFIG_PIXELFORMAT_FORCE_UINT32 = 0xffffffff } DISPLAYCONFIG_PIXELFORMAT; typedef struct DISPLAYCONFIG_SOURCE_MODE { UINT32 width; UINT32 height; DISPLAYCONFIG_PIXELFORMAT pixelFormat; POINTL position; } DISPLAYCONFIG_SOURCE_MODE; typedef struct DISPLAYCONFIG_TARGET_MODE { DISPLAYCONFIG_VIDEO_SIGNAL_INFO targetVideoSignalInfo; } DISPLAYCONFIG_TARGET_MODE; typedef struct DISPLAYCONFIG_DESKTOP_IMAGE_INFO { POINTL PathSourceSize; RECTL DesktopImageRegion; RECTL DesktopImageClip; } DISPLAYCONFIG_DESKTOP_IMAGE_INFO; typedef struct DISPLAYCONFIG_MODE_INFO { DISPLAYCONFIG_MODE_INFO_TYPE infoType; UINT32 id; LUID adapterId; union { DISPLAYCONFIG_TARGET_MODE targetMode; DISPLAYCONFIG_SOURCE_MODE sourceMode; DISPLAYCONFIG_DESKTOP_IMAGE_INFO desktopImageInfo; } ; } DISPLAYCONFIG_MODE_INFO; typedef struct DISPLAYCONFIG_PATH_SOURCE_INFO { LUID adapterId; UINT32 id; union { UINT32 modeInfoIdx; struct { UINT32 cloneGroupId : 16; UINT32 sourceModeInfoIdx : 16; } ; } ; UINT32 statusFlags; } DISPLAYCONFIG_PATH_SOURCE_INFO; typedef struct DISPLAYCONFIG_PATH_TARGET_INFO { LUID adapterId; UINT32 id; union { UINT32 modeInfoIdx; struct { UINT32 desktopModeInfoIdx : 16; UINT32 targetModeInfoIdx : 16; } ; } ; DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY outputTechnology; DISPLAYCONFIG_ROTATION rotation; DISPLAYCONFIG_SCALING scaling; DISPLAYCONFIG_RATIONAL refreshRate; DISPLAYCONFIG_SCANLINE_ORDERING scanLineOrdering; BOOL targetAvailable; UINT32 statusFlags; } DISPLAYCONFIG_PATH_TARGET_INFO; typedef struct DISPLAYCONFIG_PATH_INFO { DISPLAYCONFIG_PATH_SOURCE_INFO sourceInfo; DISPLAYCONFIG_PATH_TARGET_INFO targetInfo; UINT32 flags; } DISPLAYCONFIG_PATH_INFO; typedef enum DISPLAYCONFIG_TOPOLOGY_ID { DISPLAYCONFIG_TOPOLOGY_INTERNAL = 0x00000001, DISPLAYCONFIG_TOPOLOGY_CLONE = 0x00000002, DISPLAYCONFIG_TOPOLOGY_EXTEND = 0x00000004, DISPLAYCONFIG_TOPOLOGY_EXTERNAL = 0x00000008, DISPLAYCONFIG_TOPOLOGY_FORCE_UINT32 = 0xFFFFFFFF } DISPLAYCONFIG_TOPOLOGY_ID; typedef enum { DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME = 1, DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME = 2, DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE = 3, DISPLAYCONFIG_DEVICE_INFO_GET_ADAPTER_NAME = 4, DISPLAYCONFIG_DEVICE_INFO_SET_TARGET_PERSISTENCE = 5, DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_BASE_TYPE = 6, DISPLAYCONFIG_DEVICE_INFO_GET_SUPPORT_VIRTUAL_RESOLUTION = 7, DISPLAYCONFIG_DEVICE_INFO_SET_SUPPORT_VIRTUAL_RESOLUTION = 8, DISPLAYCONFIG_DEVICE_INFO_GET_ADVANCED_COLOR_INFO = 9, DISPLAYCONFIG_DEVICE_INFO_SET_ADVANCED_COLOR_STATE = 10, DISPLAYCONFIG_DEVICE_INFO_GET_SDR_WHITE_LEVEL = 11, DISPLAYCONFIG_DEVICE_INFO_FORCE_UINT32 = 0xFFFFFFFF } DISPLAYCONFIG_DEVICE_INFO_TYPE; typedef struct DISPLAYCONFIG_DEVICE_INFO_HEADER { DISPLAYCONFIG_DEVICE_INFO_TYPE type; UINT32 size; LUID adapterId; UINT32 id; } DISPLAYCONFIG_DEVICE_INFO_HEADER; typedef struct DISPLAYCONFIG_SOURCE_DEVICE_NAME { DISPLAYCONFIG_DEVICE_INFO_HEADER header; WCHAR viewGdiDeviceName[32]; } DISPLAYCONFIG_SOURCE_DEVICE_NAME; typedef struct DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS { union { struct { UINT32 friendlyNameFromEdid : 1; UINT32 friendlyNameForced : 1; UINT32 edidIdsValid : 1; UINT32 reserved : 29; } ; UINT32 value; } ; } DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS; typedef struct DISPLAYCONFIG_TARGET_DEVICE_NAME { DISPLAYCONFIG_DEVICE_INFO_HEADER header; DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS flags; DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY outputTechnology; UINT16 edidManufactureId; UINT16 edidProductCodeId; UINT32 connectorInstance; WCHAR monitorFriendlyDeviceName[64]; WCHAR monitorDevicePath[128]; } DISPLAYCONFIG_TARGET_DEVICE_NAME; typedef struct DISPLAYCONFIG_TARGET_PREFERRED_MODE { DISPLAYCONFIG_DEVICE_INFO_HEADER header; UINT32 width; UINT32 height; DISPLAYCONFIG_TARGET_MODE targetMode; } DISPLAYCONFIG_TARGET_PREFERRED_MODE; typedef struct DISPLAYCONFIG_ADAPTER_NAME { DISPLAYCONFIG_DEVICE_INFO_HEADER header; WCHAR adapterDevicePath[128]; } DISPLAYCONFIG_ADAPTER_NAME; typedef struct DISPLAYCONFIG_TARGET_BASE_TYPE { DISPLAYCONFIG_DEVICE_INFO_HEADER header; DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY baseOutputTechnology; } DISPLAYCONFIG_TARGET_BASE_TYPE; typedef struct DISPLAYCONFIG_SET_TARGET_PERSISTENCE { DISPLAYCONFIG_DEVICE_INFO_HEADER header; union { struct { UINT32 bootPersistenceOn : 1; UINT32 reserved : 31; } ; UINT32 value; } ; } DISPLAYCONFIG_SET_TARGET_PERSISTENCE; typedef struct DISPLAYCONFIG_SUPPORT_VIRTUAL_RESOLUTION { DISPLAYCONFIG_DEVICE_INFO_HEADER header; union { struct { UINT32 disableMonitorVirtualResolution : 1; UINT32 reserved : 31; } ; UINT32 value; } ; } DISPLAYCONFIG_SUPPORT_VIRTUAL_RESOLUTION; typedef enum _DISPLAYCONFIG_COLOR_ENCODING { DISPLAYCONFIG_COLOR_ENCODING_RGB = 0, DISPLAYCONFIG_COLOR_ENCODING_YCBCR444 = 1, DISPLAYCONFIG_COLOR_ENCODING_YCBCR422 = 2, DISPLAYCONFIG_COLOR_ENCODING_YCBCR420 = 3, DISPLAYCONFIG_COLOR_ENCODING_INTENSITY = 4, DISPLAYCONFIG_COLOR_ENCODING_FORCE_UINT32 = 0xFFFFFFFF } DISPLAYCONFIG_COLOR_ENCODING; typedef struct _DISPLAYCONFIG_GET_ADVANCED_COLOR_INFO { DISPLAYCONFIG_DEVICE_INFO_HEADER header; union { struct { UINT32 advancedColorSupported :1; UINT32 advancedColorEnabled :1; UINT32 wideColorEnforced :1; UINT32 advancedColorForceDisabled :1; UINT32 reserved :28; } ; UINT32 value; } ; DISPLAYCONFIG_COLOR_ENCODING colorEncoding; UINT32 bitsPerColorChannel; } DISPLAYCONFIG_GET_ADVANCED_COLOR_INFO; typedef struct _DISPLAYCONFIG_SET_ADVANCED_COLOR_STATE { DISPLAYCONFIG_DEVICE_INFO_HEADER header; union { struct { UINT32 enableAdvancedColor :1; UINT32 reserved :31; } ; UINT32 value; }; } DISPLAYCONFIG_SET_ADVANCED_COLOR_STATE; typedef struct _DISPLAYCONFIG_SDR_WHITE_LEVEL { DISPLAYCONFIG_DEVICE_INFO_HEADER header; ULONG SDRWhiteLevel; } DISPLAYCONFIG_SDR_WHITE_LEVEL; typedef struct _RGNDATAHEADER { DWORD dwSize; DWORD iType; DWORD nCount; DWORD nRgnSize; RECT rcBound; } RGNDATAHEADER, *PRGNDATAHEADER; typedef struct _RGNDATA { RGNDATAHEADER rdh; char Buffer[1]; } RGNDATA, *PRGNDATA, *NPRGNDATA, *LPRGNDATA; typedef struct _ABC { int abcA; UINT abcB; int abcC; } ABC, *PABC, *NPABC, *LPABC; typedef struct _ABCFLOAT { FLOAT abcfA; FLOAT abcfB; FLOAT abcfC; } ABCFLOAT, *PABCFLOAT, *NPABCFLOAT, *LPABCFLOAT; typedef struct _OUTLINETEXTMETRICA { UINT otmSize; TEXTMETRICA otmTextMetrics; BYTE otmFiller; PANOSE otmPanoseNumber; UINT otmfsSelection; UINT otmfsType; int otmsCharSlopeRise; int otmsCharSlopeRun; int otmItalicAngle; UINT otmEMSquare; int otmAscent; int otmDescent; UINT otmLineGap; UINT otmsCapEmHeight; UINT otmsXHeight; RECT otmrcFontBox; int otmMacAscent; int otmMacDescent; UINT otmMacLineGap; UINT otmusMinimumPPEM; POINT otmptSubscriptSize; POINT otmptSubscriptOffset; POINT otmptSuperscriptSize; POINT otmptSuperscriptOffset; UINT otmsStrikeoutSize; int otmsStrikeoutPosition; int otmsUnderscoreSize; int otmsUnderscorePosition; PSTR otmpFamilyName; PSTR otmpFaceName; PSTR otmpStyleName; PSTR otmpFullName; } OUTLINETEXTMETRICA, *POUTLINETEXTMETRICA, *NPOUTLINETEXTMETRICA, *LPOUTLINETEXTMETRICA; typedef struct _OUTLINETEXTMETRICW { UINT otmSize; TEXTMETRICW otmTextMetrics; BYTE otmFiller; PANOSE otmPanoseNumber; UINT otmfsSelection; UINT otmfsType; int otmsCharSlopeRise; int otmsCharSlopeRun; int otmItalicAngle; UINT otmEMSquare; int otmAscent; int otmDescent; UINT otmLineGap; UINT otmsCapEmHeight; UINT otmsXHeight; RECT otmrcFontBox; int otmMacAscent; int otmMacDescent; UINT otmMacLineGap; UINT otmusMinimumPPEM; POINT otmptSubscriptSize; POINT otmptSubscriptOffset; POINT otmptSuperscriptSize; POINT otmptSuperscriptOffset; UINT otmsStrikeoutSize; int otmsStrikeoutPosition; int otmsUnderscoreSize; int otmsUnderscorePosition; PSTR otmpFamilyName; PSTR otmpFaceName; PSTR otmpStyleName; PSTR otmpFullName; } OUTLINETEXTMETRICW, *POUTLINETEXTMETRICW, *NPOUTLINETEXTMETRICW, *LPOUTLINETEXTMETRICW; typedef OUTLINETEXTMETRICW OUTLINETEXTMETRIC; typedef POUTLINETEXTMETRICW POUTLINETEXTMETRIC; typedef NPOUTLINETEXTMETRICW NPOUTLINETEXTMETRIC; typedef LPOUTLINETEXTMETRICW LPOUTLINETEXTMETRIC; typedef struct tagPOLYTEXTA { int x; int y; UINT n; LPCSTR lpstr; UINT uiFlags; RECT rcl; int *pdx; } POLYTEXTA, *PPOLYTEXTA, *NPPOLYTEXTA, *LPPOLYTEXTA; typedef struct tagPOLYTEXTW { int x; int y; UINT n; LPCWSTR lpstr; UINT uiFlags; RECT rcl; int *pdx; } POLYTEXTW, *PPOLYTEXTW, *NPPOLYTEXTW, *LPPOLYTEXTW; typedef POLYTEXTW POLYTEXT; typedef PPOLYTEXTW PPOLYTEXT; typedef NPPOLYTEXTW NPPOLYTEXT; typedef LPPOLYTEXTW LPPOLYTEXT; typedef struct _FIXED { WORD fract; short value; } FIXED; typedef struct _MAT2 { FIXED eM11; FIXED eM12; FIXED eM21; FIXED eM22; } MAT2, *LPMAT2; typedef struct _GLYPHMETRICS { UINT gmBlackBoxX; UINT gmBlackBoxY; POINT gmptGlyphOrigin; short gmCellIncX; short gmCellIncY; } GLYPHMETRICS, *LPGLYPHMETRICS; typedef struct tagPOINTFX { FIXED x; FIXED y; } POINTFX, * LPPOINTFX; typedef struct tagTTPOLYCURVE { WORD wType; WORD cpfx; POINTFX apfx[1]; } TTPOLYCURVE, * LPTTPOLYCURVE; typedef struct tagTTPOLYGONHEADER { DWORD cb; DWORD dwType; POINTFX pfxStart; } TTPOLYGONHEADER, * LPTTPOLYGONHEADER; typedef struct tagGCP_RESULTSA { DWORD lStructSize; LPSTR lpOutString; UINT *lpOrder; int *lpDx; int *lpCaretPos; LPSTR lpClass; LPWSTR lpGlyphs; UINT nGlyphs; int nMaxFit; } GCP_RESULTSA, * LPGCP_RESULTSA; typedef struct tagGCP_RESULTSW { DWORD lStructSize; LPWSTR lpOutString; UINT *lpOrder; int *lpDx; int *lpCaretPos; LPSTR lpClass; LPWSTR lpGlyphs; UINT nGlyphs; int nMaxFit; } GCP_RESULTSW, * LPGCP_RESULTSW; typedef GCP_RESULTSW GCP_RESULTS; typedef LPGCP_RESULTSW LPGCP_RESULTS; typedef struct _RASTERIZER_STATUS { short nSize; short wFlags; short nLanguageID; } RASTERIZER_STATUS, *LPRASTERIZER_STATUS; typedef struct tagPIXELFORMATDESCRIPTOR { WORD nSize; WORD nVersion; DWORD dwFlags; BYTE iPixelType; BYTE cColorBits; BYTE cRedBits; BYTE cRedShift; BYTE cGreenBits; BYTE cGreenShift; BYTE cBlueBits; BYTE cBlueShift; BYTE cAlphaBits; BYTE cAlphaShift; BYTE cAccumBits; BYTE cAccumRedBits; BYTE cAccumGreenBits; BYTE cAccumBlueBits; BYTE cAccumAlphaBits; BYTE cDepthBits; BYTE cStencilBits; BYTE cAuxBuffers; BYTE iLayerType; BYTE bReserved; DWORD dwLayerMask; DWORD dwVisibleMask; DWORD dwDamageMask; } PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR; typedef int (__stdcall* OLDFONTENUMPROCA)(const LOGFONTA *, const TEXTMETRICA *, DWORD, LPARAM); typedef int (__stdcall* OLDFONTENUMPROCW)(const LOGFONTW *, const TEXTMETRICW *, DWORD, LPARAM); typedef OLDFONTENUMPROCA FONTENUMPROCA; typedef OLDFONTENUMPROCW FONTENUMPROCW; typedef FONTENUMPROCW FONTENUMPROC; typedef int (__stdcall* GOBJENUMPROC)(LPVOID, LPARAM); typedef void (__stdcall* LINEDDAPROC)(int, int, LPARAM); __declspec(dllimport) int __stdcall AddFontResourceA( LPCSTR); __declspec(dllimport) int __stdcall AddFontResourceW( LPCWSTR); __declspec(dllimport) BOOL __stdcall AnimatePalette( HPALETTE hPal, UINT iStartIndex, UINT cEntries, const PALETTEENTRY * ppe); __declspec(dllimport) BOOL __stdcall Arc( HDC hdc, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4); __declspec(dllimport) BOOL __stdcall BitBlt( HDC hdc, int x, int y, int cx, int cy, HDC hdcSrc, int x1, int y1, DWORD rop); __declspec(dllimport) BOOL __stdcall CancelDC( HDC hdc); __declspec(dllimport) BOOL __stdcall Chord( HDC hdc, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4); __declspec(dllimport) int __stdcall ChoosePixelFormat( HDC hdc, const PIXELFORMATDESCRIPTOR *ppfd); __declspec(dllimport) HMETAFILE __stdcall CloseMetaFile( HDC hdc); __declspec(dllimport) int __stdcall CombineRgn( HRGN hrgnDst, HRGN hrgnSrc1, HRGN hrgnSrc2, int iMode); __declspec(dllimport) HMETAFILE __stdcall CopyMetaFileA( HMETAFILE, LPCSTR); __declspec(dllimport) HMETAFILE __stdcall CopyMetaFileW( HMETAFILE, LPCWSTR); __declspec(dllimport) HBITMAP __stdcall CreateBitmap( int nWidth, int nHeight, UINT nPlanes, UINT nBitCount, const void *lpBits); __declspec(dllimport) HBITMAP __stdcall CreateBitmapIndirect( const BITMAP *pbm); __declspec(dllimport) HBRUSH __stdcall CreateBrushIndirect( const LOGBRUSH *plbrush); __declspec(dllimport) HBITMAP __stdcall CreateCompatibleBitmap( HDC hdc, int cx, int cy); __declspec(dllimport) HBITMAP __stdcall CreateDiscardableBitmap( HDC hdc, int cx, int cy); __declspec(dllimport) HDC __stdcall CreateCompatibleDC( HDC hdc); __declspec(dllimport) HDC __stdcall CreateDCA( LPCSTR pwszDriver, LPCSTR pwszDevice, LPCSTR pszPort, const DEVMODEA * pdm); __declspec(dllimport) HDC __stdcall CreateDCW( LPCWSTR pwszDriver, LPCWSTR pwszDevice, LPCWSTR pszPort, const DEVMODEW * pdm); __declspec(dllimport) HBITMAP __stdcall CreateDIBitmap( HDC hdc, const BITMAPINFOHEADER *pbmih, DWORD flInit, const void *pjBits, const BITMAPINFO *pbmi, UINT iUsage); __declspec(dllimport) HBRUSH __stdcall CreateDIBPatternBrush( HGLOBAL h, UINT iUsage); __declspec(dllimport) HBRUSH __stdcall CreateDIBPatternBrushPt( const void *lpPackedDIB, UINT iUsage); __declspec(dllimport) HRGN __stdcall CreateEllipticRgn( int x1, int y1, int x2, int y2); __declspec(dllimport) HRGN __stdcall CreateEllipticRgnIndirect( const RECT *lprect); __declspec(dllimport) HFONT __stdcall CreateFontIndirectA( const LOGFONTA *lplf); __declspec(dllimport) HFONT __stdcall CreateFontIndirectW( const LOGFONTW *lplf); __declspec(dllimport) HFONT __stdcall CreateFontA( int cHeight, int cWidth, int cEscapement, int cOrientation, int cWeight, DWORD bItalic, DWORD bUnderline, DWORD bStrikeOut, DWORD iCharSet, DWORD iOutPrecision, DWORD iClipPrecision, DWORD iQuality, DWORD iPitchAndFamily, LPCSTR pszFaceName); __declspec(dllimport) HFONT __stdcall CreateFontW( int cHeight, int cWidth, int cEscapement, int cOrientation, int cWeight, DWORD bItalic, DWORD bUnderline, DWORD bStrikeOut, DWORD iCharSet, DWORD iOutPrecision, DWORD iClipPrecision, DWORD iQuality, DWORD iPitchAndFamily, LPCWSTR pszFaceName); __declspec(dllimport) HBRUSH __stdcall CreateHatchBrush( int iHatch, COLORREF color); __declspec(dllimport) HDC __stdcall CreateICA( LPCSTR pszDriver, LPCSTR pszDevice, LPCSTR pszPort, const DEVMODEA * pdm); __declspec(dllimport) HDC __stdcall CreateICW( LPCWSTR pszDriver, LPCWSTR pszDevice, LPCWSTR pszPort, const DEVMODEW * pdm); __declspec(dllimport) HDC __stdcall CreateMetaFileA( LPCSTR pszFile); __declspec(dllimport) HDC __stdcall CreateMetaFileW( LPCWSTR pszFile); __declspec(dllimport) HPALETTE __stdcall CreatePalette( const LOGPALETTE * plpal); __declspec(dllimport) HPEN __stdcall CreatePen( int iStyle, int cWidth, COLORREF color); __declspec(dllimport) HPEN __stdcall CreatePenIndirect( const LOGPEN *plpen); __declspec(dllimport) HRGN __stdcall CreatePolyPolygonRgn( const POINT *pptl, const INT *pc, int cPoly, int iMode); __declspec(dllimport) HBRUSH __stdcall CreatePatternBrush( HBITMAP hbm); __declspec(dllimport) HRGN __stdcall CreateRectRgn( int x1, int y1, int x2, int y2); __declspec(dllimport) HRGN __stdcall CreateRectRgnIndirect( const RECT *lprect); __declspec(dllimport) HRGN __stdcall CreateRoundRectRgn( int x1, int y1, int x2, int y2, int w, int h); __declspec(dllimport) BOOL __stdcall CreateScalableFontResourceA( DWORD fdwHidden, LPCSTR lpszFont, LPCSTR lpszFile, LPCSTR lpszPath); __declspec(dllimport) BOOL __stdcall CreateScalableFontResourceW( DWORD fdwHidden, LPCWSTR lpszFont, LPCWSTR lpszFile, LPCWSTR lpszPath); __declspec(dllimport) HBRUSH __stdcall CreateSolidBrush( COLORREF color); __declspec(dllimport) BOOL __stdcall DeleteDC( HDC hdc); __declspec(dllimport) BOOL __stdcall DeleteMetaFile( HMETAFILE hmf); __declspec(dllimport) BOOL __stdcall DeleteObject( HGDIOBJ ho); __declspec(dllimport) int __stdcall DescribePixelFormat( HDC hdc, int iPixelFormat, UINT nBytes, LPPIXELFORMATDESCRIPTOR ppfd); typedef UINT (__stdcall* LPFNDEVMODE)(HWND, HMODULE, LPDEVMODE, LPSTR, LPSTR, LPDEVMODE, LPSTR, UINT); typedef DWORD (__stdcall* LPFNDEVCAPS)(LPSTR, LPSTR, UINT, LPSTR, LPDEVMODE); __declspec(dllimport) int __stdcall DeviceCapabilitiesA( LPCSTR pDevice, LPCSTR pPort, WORD fwCapability, LPSTR pOutput, const DEVMODEA *pDevMode ); __declspec(dllimport) int __stdcall DeviceCapabilitiesW( LPCWSTR pDevice, LPCWSTR pPort, WORD fwCapability, LPWSTR pOutput, const DEVMODEW *pDevMode ); __declspec(dllimport) int __stdcall DrawEscape( HDC hdc, int iEscape, int cjIn, LPCSTR lpIn); __declspec(dllimport) BOOL __stdcall Ellipse( HDC hdc, int left, int top, int right, int bottom); __declspec(dllimport) int __stdcall EnumFontFamiliesExA( HDC hdc, LPLOGFONTA lpLogfont, FONTENUMPROCA lpProc, LPARAM lParam, DWORD dwFlags); __declspec(dllimport) int __stdcall EnumFontFamiliesExW( HDC hdc, LPLOGFONTW lpLogfont, FONTENUMPROCW lpProc, LPARAM lParam, DWORD dwFlags); __declspec(dllimport) int __stdcall EnumFontFamiliesA( HDC hdc, LPCSTR lpLogfont, FONTENUMPROCA lpProc, LPARAM lParam); __declspec(dllimport) int __stdcall EnumFontFamiliesW( HDC hdc, LPCWSTR lpLogfont, FONTENUMPROCW lpProc, LPARAM lParam); __declspec(dllimport) int __stdcall EnumFontsA( HDC hdc, LPCSTR lpLogfont, FONTENUMPROCA lpProc, LPARAM lParam); __declspec(dllimport) int __stdcall EnumFontsW( HDC hdc, LPCWSTR lpLogfont, FONTENUMPROCW lpProc, LPARAM lParam); __declspec(dllimport) int __stdcall EnumObjects( HDC hdc, int nType, GOBJENUMPROC lpFunc, LPARAM lParam); __declspec(dllimport) BOOL __stdcall EqualRgn( HRGN hrgn1, HRGN hrgn2); __declspec(dllimport) int __stdcall Escape( HDC hdc, int iEscape, int cjIn, LPCSTR pvIn, LPVOID pvOut); __declspec(dllimport) int __stdcall ExtEscape( HDC hdc, int iEscape, int cjInput, LPCSTR lpInData, int cjOutput, LPSTR lpOutData); __declspec(dllimport) int __stdcall ExcludeClipRect( HDC hdc, int left, int top, int right, int bottom); __declspec(dllimport) HRGN __stdcall ExtCreateRegion( const XFORM * lpx, DWORD nCount, const RGNDATA * lpData); __declspec(dllimport) BOOL __stdcall ExtFloodFill( HDC hdc, int x, int y, COLORREF color, UINT type); __declspec(dllimport) BOOL __stdcall FillRgn( HDC hdc, HRGN hrgn, HBRUSH hbr); __declspec(dllimport) BOOL __stdcall FloodFill( HDC hdc, int x, int y, COLORREF color); __declspec(dllimport) BOOL __stdcall FrameRgn( HDC hdc, HRGN hrgn, HBRUSH hbr, int w, int h); __declspec(dllimport) int __stdcall GetROP2( HDC hdc); __declspec(dllimport) BOOL __stdcall GetAspectRatioFilterEx( HDC hdc, LPSIZE lpsize); __declspec(dllimport) COLORREF __stdcall GetBkColor( HDC hdc); __declspec(dllimport) COLORREF __stdcall GetDCBrushColor( HDC hdc); __declspec(dllimport) COLORREF __stdcall GetDCPenColor( HDC hdc); __declspec(dllimport) int __stdcall GetBkMode( HDC hdc ); __declspec(dllimport) LONG __stdcall GetBitmapBits( HBITMAP hbit, LONG cb, LPVOID lpvBits ); __declspec(dllimport) BOOL __stdcall GetBitmapDimensionEx( HBITMAP hbit, LPSIZE lpsize); __declspec(dllimport) UINT __stdcall GetBoundsRect( HDC hdc, LPRECT lprect, UINT flags); __declspec(dllimport) BOOL __stdcall GetBrushOrgEx( HDC hdc, LPPOINT lppt); __declspec(dllimport) BOOL __stdcall GetCharWidthA( HDC hdc, UINT iFirst, UINT iLast, LPINT lpBuffer); __declspec(dllimport) BOOL __stdcall GetCharWidthW( HDC hdc, UINT iFirst, UINT iLast, LPINT lpBuffer); __declspec(dllimport) BOOL __stdcall GetCharWidth32A( HDC hdc, UINT iFirst, UINT iLast, LPINT lpBuffer); __declspec(dllimport) BOOL __stdcall GetCharWidth32W( HDC hdc, UINT iFirst, UINT iLast, LPINT lpBuffer); __declspec(dllimport) BOOL __stdcall GetCharWidthFloatA( HDC hdc, UINT iFirst, UINT iLast, PFLOAT lpBuffer); __declspec(dllimport) BOOL __stdcall GetCharWidthFloatW( HDC hdc, UINT iFirst, UINT iLast, PFLOAT lpBuffer); __declspec(dllimport) BOOL __stdcall GetCharABCWidthsA( HDC hdc, UINT wFirst, UINT wLast, LPABC lpABC); __declspec(dllimport) BOOL __stdcall GetCharABCWidthsW( HDC hdc, UINT wFirst, UINT wLast, LPABC lpABC); __declspec(dllimport) BOOL __stdcall GetCharABCWidthsFloatA( HDC hdc, UINT iFirst, UINT iLast, LPABCFLOAT lpABC); __declspec(dllimport) BOOL __stdcall GetCharABCWidthsFloatW( HDC hdc, UINT iFirst, UINT iLast, LPABCFLOAT lpABC); __declspec(dllimport) int __stdcall GetClipBox( HDC hdc, LPRECT lprect); __declspec(dllimport) int __stdcall GetClipRgn( HDC hdc, HRGN hrgn); __declspec(dllimport) int __stdcall GetMetaRgn( HDC hdc, HRGN hrgn); __declspec(dllimport) HGDIOBJ __stdcall GetCurrentObject( HDC hdc, UINT type); __declspec(dllimport) BOOL __stdcall GetCurrentPositionEx( HDC hdc, LPPOINT lppt); __declspec(dllimport) int __stdcall GetDeviceCaps( HDC hdc, int index); __declspec(dllimport) int __stdcall GetDIBits( HDC hdc, HBITMAP hbm, UINT start, UINT cLines, LPVOID lpvBits, LPBITMAPINFO lpbmi, UINT usage); __declspec(dllimport) DWORD __stdcall GetFontData ( HDC hdc, DWORD dwTable, DWORD dwOffset, PVOID pvBuffer, DWORD cjBuffer ); __declspec(dllimport) DWORD __stdcall GetGlyphOutlineA( HDC hdc, UINT uChar, UINT fuFormat, LPGLYPHMETRICS lpgm, DWORD cjBuffer, LPVOID pvBuffer, const MAT2 *lpmat2 ); __declspec(dllimport) DWORD __stdcall GetGlyphOutlineW( HDC hdc, UINT uChar, UINT fuFormat, LPGLYPHMETRICS lpgm, DWORD cjBuffer, LPVOID pvBuffer, const MAT2 *lpmat2 ); __declspec(dllimport) int __stdcall GetGraphicsMode( HDC hdc); __declspec(dllimport) int __stdcall GetMapMode( HDC hdc); __declspec(dllimport) UINT __stdcall GetMetaFileBitsEx( HMETAFILE hMF, UINT cbBuffer, LPVOID lpData); __declspec(dllimport) HMETAFILE __stdcall GetMetaFileA( LPCSTR lpName); __declspec(dllimport) HMETAFILE __stdcall GetMetaFileW( LPCWSTR lpName); __declspec(dllimport) COLORREF __stdcall GetNearestColor( HDC hdc, COLORREF color); __declspec(dllimport) UINT __stdcall GetNearestPaletteIndex( HPALETTE h, COLORREF color); __declspec(dllimport) DWORD __stdcall GetObjectType( HGDIOBJ h); __declspec(dllimport) UINT __stdcall GetOutlineTextMetricsA( HDC hdc, UINT cjCopy, LPOUTLINETEXTMETRICA potm); __declspec(dllimport) UINT __stdcall GetOutlineTextMetricsW( HDC hdc, UINT cjCopy, LPOUTLINETEXTMETRICW potm); __declspec(dllimport) UINT __stdcall GetPaletteEntries( HPALETTE hpal, UINT iStart, UINT cEntries, LPPALETTEENTRY pPalEntries); __declspec(dllimport) COLORREF __stdcall GetPixel( HDC hdc, int x, int y); __declspec(dllimport) int __stdcall GetPixelFormat( HDC hdc); __declspec(dllimport) int __stdcall GetPolyFillMode( HDC hdc); __declspec(dllimport) BOOL __stdcall GetRasterizerCaps( LPRASTERIZER_STATUS lpraststat, UINT cjBytes); __declspec(dllimport) int __stdcall GetRandomRgn ( HDC hdc, HRGN hrgn, INT i); __declspec(dllimport) DWORD __stdcall GetRegionData( HRGN hrgn, DWORD nCount, LPRGNDATA lpRgnData); __declspec(dllimport) int __stdcall GetRgnBox( HRGN hrgn, LPRECT lprc); __declspec(dllimport) HGDIOBJ __stdcall GetStockObject( int i); __declspec(dllimport) int __stdcall GetStretchBltMode( HDC hdc); __declspec(dllimport) UINT __stdcall GetSystemPaletteEntries( HDC hdc, UINT iStart, UINT cEntries, LPPALETTEENTRY pPalEntries ); __declspec(dllimport) UINT __stdcall GetSystemPaletteUse( HDC hdc); __declspec(dllimport) int __stdcall GetTextCharacterExtra( HDC hdc); __declspec(dllimport) UINT __stdcall GetTextAlign( HDC hdc); __declspec(dllimport) COLORREF __stdcall GetTextColor( HDC hdc); __declspec(dllimport) BOOL __stdcall GetTextExtentPointA( HDC hdc, LPCSTR lpString, int c, LPSIZE lpsz ); __declspec(dllimport) BOOL __stdcall GetTextExtentPointW( HDC hdc, LPCWSTR lpString, int c, LPSIZE lpsz ); __declspec(dllimport) BOOL __stdcall GetTextExtentPoint32A( HDC hdc, LPCSTR lpString, int c, LPSIZE psizl ); __declspec(dllimport) BOOL __stdcall GetTextExtentPoint32W( HDC hdc, LPCWSTR lpString, int c, LPSIZE psizl ); __declspec(dllimport) BOOL __stdcall GetTextExtentExPointA( HDC hdc, LPCSTR lpszString, int cchString, int nMaxExtent, LPINT lpnFit, LPINT lpnDx, LPSIZE lpSize ); __declspec(dllimport) BOOL __stdcall GetTextExtentExPointW( HDC hdc, LPCWSTR lpszString, int cchString, int nMaxExtent, LPINT lpnFit, LPINT lpnDx, LPSIZE lpSize ); __declspec(dllimport) int __stdcall GetTextCharset( HDC hdc); __declspec(dllimport) int __stdcall GetTextCharsetInfo( HDC hdc, LPFONTSIGNATURE lpSig, DWORD dwFlags); __declspec(dllimport) BOOL __stdcall TranslateCharsetInfo( DWORD *lpSrc, LPCHARSETINFO lpCs, DWORD dwFlags); __declspec(dllimport) DWORD __stdcall GetFontLanguageInfo( HDC hdc); __declspec(dllimport) DWORD __stdcall GetCharacterPlacementA( HDC hdc, LPCSTR lpString, int nCount, int nMexExtent, LPGCP_RESULTSA lpResults, DWORD dwFlags); __declspec(dllimport) DWORD __stdcall GetCharacterPlacementW( HDC hdc, LPCWSTR lpString, int nCount, int nMexExtent, LPGCP_RESULTSW lpResults, DWORD dwFlags); typedef struct tagWCRANGE { WCHAR wcLow; USHORT cGlyphs; } WCRANGE, *PWCRANGE, *LPWCRANGE; typedef struct tagGLYPHSET { DWORD cbThis; DWORD flAccel; DWORD cGlyphsSupported; DWORD cRanges; WCRANGE ranges[1]; } GLYPHSET, *PGLYPHSET, *LPGLYPHSET; __declspec(dllimport) DWORD __stdcall GetFontUnicodeRanges( HDC hdc, LPGLYPHSET lpgs); __declspec(dllimport) DWORD __stdcall GetGlyphIndicesA( HDC hdc, LPCSTR lpstr, int c, LPWORD pgi, DWORD fl); __declspec(dllimport) DWORD __stdcall GetGlyphIndicesW( HDC hdc, LPCWSTR lpstr, int c, LPWORD pgi, DWORD fl); __declspec(dllimport) BOOL __stdcall GetTextExtentPointI( HDC hdc, LPWORD pgiIn, int cgi, LPSIZE psize); __declspec(dllimport) BOOL __stdcall GetTextExtentExPointI ( HDC hdc, LPWORD lpwszString, int cwchString, int nMaxExtent, LPINT lpnFit, LPINT lpnDx, LPSIZE lpSize ); __declspec(dllimport) BOOL __stdcall GetCharWidthI( HDC hdc, UINT giFirst, UINT cgi, LPWORD pgi, LPINT piWidths ); __declspec(dllimport) BOOL __stdcall GetCharABCWidthsI( HDC hdc, UINT giFirst, UINT cgi, LPWORD pgi, LPABC pabc ); typedef struct tagDESIGNVECTOR { DWORD dvReserved; DWORD dvNumAxes; LONG dvValues[16]; } DESIGNVECTOR, *PDESIGNVECTOR, *LPDESIGNVECTOR; __declspec(dllimport) int __stdcall AddFontResourceExA( LPCSTR name, DWORD fl, PVOID res); __declspec(dllimport) int __stdcall AddFontResourceExW( LPCWSTR name, DWORD fl, PVOID res); __declspec(dllimport) BOOL __stdcall RemoveFontResourceExA( LPCSTR name, DWORD fl, PVOID pdv); __declspec(dllimport) BOOL __stdcall RemoveFontResourceExW( LPCWSTR name, DWORD fl, PVOID pdv); __declspec(dllimport) HANDLE __stdcall AddFontMemResourceEx( PVOID pFileView, DWORD cjSize, PVOID pvResrved, DWORD* pNumFonts); __declspec(dllimport) BOOL __stdcall RemoveFontMemResourceEx( HANDLE h); typedef struct tagAXISINFOA { LONG axMinValue; LONG axMaxValue; BYTE axAxisName[16]; } AXISINFOA, *PAXISINFOA, *LPAXISINFOA; typedef struct tagAXISINFOW { LONG axMinValue; LONG axMaxValue; WCHAR axAxisName[16]; } AXISINFOW, *PAXISINFOW, *LPAXISINFOW; typedef AXISINFOW AXISINFO; typedef PAXISINFOW PAXISINFO; typedef LPAXISINFOW LPAXISINFO; typedef struct tagAXESLISTA { DWORD axlReserved; DWORD axlNumAxes; AXISINFOA axlAxisInfo[16]; } AXESLISTA, *PAXESLISTA, *LPAXESLISTA; typedef struct tagAXESLISTW { DWORD axlReserved; DWORD axlNumAxes; AXISINFOW axlAxisInfo[16]; } AXESLISTW, *PAXESLISTW, *LPAXESLISTW; typedef AXESLISTW AXESLIST; typedef PAXESLISTW PAXESLIST; typedef LPAXESLISTW LPAXESLIST; typedef struct tagENUMLOGFONTEXDVA { ENUMLOGFONTEXA elfEnumLogfontEx; DESIGNVECTOR elfDesignVector; } ENUMLOGFONTEXDVA, *PENUMLOGFONTEXDVA, *LPENUMLOGFONTEXDVA; typedef struct tagENUMLOGFONTEXDVW { ENUMLOGFONTEXW elfEnumLogfontEx; DESIGNVECTOR elfDesignVector; } ENUMLOGFONTEXDVW, *PENUMLOGFONTEXDVW, *LPENUMLOGFONTEXDVW; typedef ENUMLOGFONTEXDVW ENUMLOGFONTEXDV; typedef PENUMLOGFONTEXDVW PENUMLOGFONTEXDV; typedef LPENUMLOGFONTEXDVW LPENUMLOGFONTEXDV; __declspec(dllimport) HFONT __stdcall CreateFontIndirectExA( const ENUMLOGFONTEXDVA *); __declspec(dllimport) HFONT __stdcall CreateFontIndirectExW( const ENUMLOGFONTEXDVW *); typedef struct tagENUMTEXTMETRICA { NEWTEXTMETRICEXA etmNewTextMetricEx; AXESLISTA etmAxesList; } ENUMTEXTMETRICA, *PENUMTEXTMETRICA, *LPENUMTEXTMETRICA; typedef struct tagENUMTEXTMETRICW { NEWTEXTMETRICEXW etmNewTextMetricEx; AXESLISTW etmAxesList; } ENUMTEXTMETRICW, *PENUMTEXTMETRICW, *LPENUMTEXTMETRICW; typedef ENUMTEXTMETRICW ENUMTEXTMETRIC; typedef PENUMTEXTMETRICW PENUMTEXTMETRIC; typedef LPENUMTEXTMETRICW LPENUMTEXTMETRIC; __declspec(dllimport) BOOL __stdcall GetViewportExtEx( HDC hdc, LPSIZE lpsize); __declspec(dllimport) BOOL __stdcall GetViewportOrgEx( HDC hdc, LPPOINT lppoint); __declspec(dllimport) BOOL __stdcall GetWindowExtEx( HDC hdc, LPSIZE lpsize); __declspec(dllimport) BOOL __stdcall GetWindowOrgEx( HDC hdc, LPPOINT lppoint); __declspec(dllimport) int __stdcall IntersectClipRect( HDC hdc, int left, int top, int right, int bottom); __declspec(dllimport) BOOL __stdcall InvertRgn( HDC hdc, HRGN hrgn); __declspec(dllimport) BOOL __stdcall LineDDA( int xStart, int yStart, int xEnd, int yEnd, LINEDDAPROC lpProc, LPARAM data); __declspec(dllimport) BOOL __stdcall LineTo( HDC hdc, int x, int y); __declspec(dllimport) BOOL __stdcall MaskBlt( HDC hdcDest, int xDest, int yDest, int width, int height, HDC hdcSrc, int xSrc, int ySrc, HBITMAP hbmMask, int xMask, int yMask, DWORD rop); __declspec(dllimport) BOOL __stdcall PlgBlt( HDC hdcDest, const POINT * lpPoint, HDC hdcSrc, int xSrc, int ySrc, int width, int height, HBITMAP hbmMask, int xMask, int yMask); __declspec(dllimport) int __stdcall OffsetClipRgn( HDC hdc, int x, int y); __declspec(dllimport) int __stdcall OffsetRgn( HRGN hrgn, int x, int y); __declspec(dllimport) BOOL __stdcall PatBlt( HDC hdc, int x, int y, int w, int h, DWORD rop); __declspec(dllimport) BOOL __stdcall Pie( HDC hdc, int left, int top, int right, int bottom, int xr1, int yr1, int xr2, int yr2); __declspec(dllimport) BOOL __stdcall PlayMetaFile( HDC hdc, HMETAFILE hmf); __declspec(dllimport) BOOL __stdcall PaintRgn( HDC hdc, HRGN hrgn); __declspec(dllimport) BOOL __stdcall PolyPolygon( HDC hdc, const POINT *apt, const INT *asz, int csz); __declspec(dllimport) BOOL __stdcall PtInRegion( HRGN hrgn, int x, int y); __declspec(dllimport) BOOL __stdcall PtVisible( HDC hdc, int x, int y); __declspec(dllimport) BOOL __stdcall RectInRegion( HRGN hrgn, const RECT * lprect); __declspec(dllimport) BOOL __stdcall RectVisible( HDC hdc, const RECT * lprect); __declspec(dllimport) BOOL __stdcall Rectangle( HDC hdc, int left, int top, int right, int bottom); __declspec(dllimport) BOOL __stdcall RestoreDC( HDC hdc, int nSavedDC); __declspec(dllimport) HDC __stdcall ResetDCA( HDC hdc, const DEVMODEA * lpdm); __declspec(dllimport) HDC __stdcall ResetDCW( HDC hdc, const DEVMODEW * lpdm); __declspec(dllimport) UINT __stdcall RealizePalette( HDC hdc); __declspec(dllimport) BOOL __stdcall RemoveFontResourceA( LPCSTR lpFileName); __declspec(dllimport) BOOL __stdcall RemoveFontResourceW( LPCWSTR lpFileName); __declspec(dllimport) BOOL __stdcall RoundRect( HDC hdc, int left, int top, int right, int bottom, int width, int height); __declspec(dllimport) BOOL __stdcall ResizePalette( HPALETTE hpal, UINT n); __declspec(dllimport) int __stdcall SaveDC( HDC hdc); __declspec(dllimport) int __stdcall SelectClipRgn( HDC hdc, HRGN hrgn); __declspec(dllimport) int __stdcall ExtSelectClipRgn( HDC hdc, HRGN hrgn, int mode); __declspec(dllimport) int __stdcall SetMetaRgn( HDC hdc); __declspec(dllimport) HGDIOBJ __stdcall SelectObject( HDC hdc, HGDIOBJ h); __declspec(dllimport) HPALETTE __stdcall SelectPalette( HDC hdc, HPALETTE hPal, BOOL bForceBkgd); __declspec(dllimport) COLORREF __stdcall SetBkColor( HDC hdc, COLORREF color); __declspec(dllimport) COLORREF __stdcall SetDCBrushColor( HDC hdc, COLORREF color); __declspec(dllimport) COLORREF __stdcall SetDCPenColor( HDC hdc, COLORREF color); __declspec(dllimport) int __stdcall SetBkMode( HDC hdc, int mode); __declspec(dllimport) LONG __stdcall SetBitmapBits( HBITMAP hbm, DWORD cb, const void *pvBits); __declspec(dllimport) UINT __stdcall SetBoundsRect( HDC hdc, const RECT * lprect, UINT flags); __declspec(dllimport) int __stdcall SetDIBits( HDC hdc, HBITMAP hbm, UINT start, UINT cLines, const void *lpBits, const BITMAPINFO * lpbmi, UINT ColorUse); __declspec(dllimport) int __stdcall SetDIBitsToDevice( HDC hdc, int xDest, int yDest, DWORD w, DWORD h, int xSrc, int ySrc, UINT StartScan, UINT cLines, const void * lpvBits, const BITMAPINFO * lpbmi, UINT ColorUse); __declspec(dllimport) DWORD __stdcall SetMapperFlags( HDC hdc, DWORD flags); __declspec(dllimport) int __stdcall SetGraphicsMode( HDC hdc, int iMode); __declspec(dllimport) int __stdcall SetMapMode( HDC hdc, int iMode); __declspec(dllimport) DWORD __stdcall SetLayout( HDC hdc, DWORD l); __declspec(dllimport) DWORD __stdcall GetLayout( HDC hdc); __declspec(dllimport) HMETAFILE __stdcall SetMetaFileBitsEx( UINT cbBuffer, const BYTE *lpData); __declspec(dllimport) UINT __stdcall SetPaletteEntries( HPALETTE hpal, UINT iStart, UINT cEntries, const PALETTEENTRY *pPalEntries); __declspec(dllimport) COLORREF __stdcall SetPixel( HDC hdc, int x, int y, COLORREF color); __declspec(dllimport) BOOL __stdcall SetPixelV( HDC hdc, int x, int y, COLORREF color); __declspec(dllimport) BOOL __stdcall SetPixelFormat( HDC hdc, int format, const PIXELFORMATDESCRIPTOR * ppfd); __declspec(dllimport) int __stdcall SetPolyFillMode( HDC hdc, int mode); __declspec(dllimport) BOOL __stdcall StretchBlt( HDC hdcDest, int xDest, int yDest, int wDest, int hDest, HDC hdcSrc, int xSrc, int ySrc, int wSrc, int hSrc, DWORD rop); __declspec(dllimport) BOOL __stdcall SetRectRgn( HRGN hrgn, int left, int top, int right, int bottom); __declspec(dllimport) int __stdcall StretchDIBits( HDC hdc, int xDest, int yDest, int DestWidth, int DestHeight, int xSrc, int ySrc, int SrcWidth, int SrcHeight, const void * lpBits, const BITMAPINFO * lpbmi, UINT iUsage, DWORD rop); __declspec(dllimport) int __stdcall SetROP2( HDC hdc, int rop2); __declspec(dllimport) int __stdcall SetStretchBltMode( HDC hdc, int mode); __declspec(dllimport) UINT __stdcall SetSystemPaletteUse( HDC hdc, UINT use); __declspec(dllimport) int __stdcall SetTextCharacterExtra( HDC hdc, int extra); __declspec(dllimport) COLORREF __stdcall SetTextColor( HDC hdc, COLORREF color); __declspec(dllimport) UINT __stdcall SetTextAlign( HDC hdc, UINT align); __declspec(dllimport) BOOL __stdcall SetTextJustification( HDC hdc, int extra, int count); __declspec(dllimport) BOOL __stdcall UpdateColors( HDC hdc); typedef USHORT COLOR16; typedef struct _TRIVERTEX { LONG x; LONG y; COLOR16 Red; COLOR16 Green; COLOR16 Blue; COLOR16 Alpha; }TRIVERTEX,*PTRIVERTEX,*LPTRIVERTEX; typedef struct _GRADIENT_TRIANGLE { ULONG Vertex1; ULONG Vertex2; ULONG Vertex3; } GRADIENT_TRIANGLE,*PGRADIENT_TRIANGLE,*LPGRADIENT_TRIANGLE; typedef struct _GRADIENT_RECT { ULONG UpperLeft; ULONG LowerRight; }GRADIENT_RECT,*PGRADIENT_RECT,*LPGRADIENT_RECT; typedef struct _BLENDFUNCTION { BYTE BlendOp; BYTE BlendFlags; BYTE SourceConstantAlpha; BYTE AlphaFormat; }BLENDFUNCTION,*PBLENDFUNCTION; __declspec(dllimport) BOOL __stdcall AlphaBlend( HDC hdcDest, int xoriginDest, int yoriginDest, int wDest, int hDest, HDC hdcSrc, int xoriginSrc, int yoriginSrc, int wSrc, int hSrc, BLENDFUNCTION ftn); __declspec(dllimport) BOOL __stdcall TransparentBlt( HDC hdcDest, int xoriginDest, int yoriginDest, int wDest, int hDest, HDC hdcSrc, int xoriginSrc, int yoriginSrc, int wSrc, int hSrc, UINT crTransparent); __declspec(dllimport) BOOL __stdcall GradientFill( HDC hdc, PTRIVERTEX pVertex, ULONG nVertex, PVOID pMesh, ULONG nMesh, ULONG ulMode ); __declspec(dllimport) BOOL __stdcall GdiAlphaBlend( HDC hdcDest, int xoriginDest, int yoriginDest, int wDest, int hDest, HDC hdcSrc, int xoriginSrc, int yoriginSrc, int wSrc, int hSrc, BLENDFUNCTION ftn); __declspec(dllimport) BOOL __stdcall GdiTransparentBlt( HDC hdcDest, int xoriginDest, int yoriginDest, int wDest, int hDest, HDC hdcSrc, int xoriginSrc, int yoriginSrc, int wSrc, int hSrc, UINT crTransparent); __declspec(dllimport) BOOL __stdcall GdiGradientFill( HDC hdc, PTRIVERTEX pVertex, ULONG nVertex, PVOID pMesh, ULONG nCount, ULONG ulMode); __declspec(dllimport) BOOL __stdcall PlayMetaFileRecord( HDC hdc, LPHANDLETABLE lpHandleTable, LPMETARECORD lpMR, UINT noObjs); typedef int (__stdcall* MFENUMPROC)( HDC hdc, HANDLETABLE * lpht, METARECORD * lpMR, int nObj, LPARAM param); __declspec(dllimport) BOOL __stdcall EnumMetaFile( HDC hdc, HMETAFILE hmf, MFENUMPROC proc, LPARAM param); typedef int (__stdcall* ENHMFENUMPROC)( HDC hdc, HANDLETABLE * lpht, const ENHMETARECORD * lpmr, int nHandles, LPARAM data); __declspec(dllimport) HENHMETAFILE __stdcall CloseEnhMetaFile( HDC hdc); __declspec(dllimport) HENHMETAFILE __stdcall CopyEnhMetaFileA( HENHMETAFILE hEnh, LPCSTR lpFileName); __declspec(dllimport) HENHMETAFILE __stdcall CopyEnhMetaFileW( HENHMETAFILE hEnh, LPCWSTR lpFileName); __declspec(dllimport) HDC __stdcall CreateEnhMetaFileA( HDC hdc, LPCSTR lpFilename, const RECT *lprc, LPCSTR lpDesc); __declspec(dllimport) HDC __stdcall CreateEnhMetaFileW( HDC hdc, LPCWSTR lpFilename, const RECT *lprc, LPCWSTR lpDesc); __declspec(dllimport) BOOL __stdcall DeleteEnhMetaFile( HENHMETAFILE hmf); __declspec(dllimport) BOOL __stdcall EnumEnhMetaFile( HDC hdc, HENHMETAFILE hmf, ENHMFENUMPROC proc, LPVOID param, const RECT * lpRect); __declspec(dllimport) HENHMETAFILE __stdcall GetEnhMetaFileA( LPCSTR lpName); __declspec(dllimport) HENHMETAFILE __stdcall GetEnhMetaFileW( LPCWSTR lpName); __declspec(dllimport) UINT __stdcall GetEnhMetaFileBits( HENHMETAFILE hEMF, UINT nSize, LPBYTE lpData); __declspec(dllimport) UINT __stdcall GetEnhMetaFileDescriptionA( HENHMETAFILE hemf, UINT cchBuffer, LPSTR lpDescription); __declspec(dllimport) UINT __stdcall GetEnhMetaFileDescriptionW( HENHMETAFILE hemf, UINT cchBuffer, LPWSTR lpDescription); __declspec(dllimport) UINT __stdcall GetEnhMetaFileHeader( HENHMETAFILE hemf, UINT nSize, LPENHMETAHEADER lpEnhMetaHeader); __declspec(dllimport) UINT __stdcall GetEnhMetaFilePaletteEntries( HENHMETAFILE hemf, UINT nNumEntries, LPPALETTEENTRY lpPaletteEntries); __declspec(dllimport) UINT __stdcall GetEnhMetaFilePixelFormat( HENHMETAFILE hemf, UINT cbBuffer, PIXELFORMATDESCRIPTOR *ppfd); __declspec(dllimport) UINT __stdcall GetWinMetaFileBits( HENHMETAFILE hemf, UINT cbData16, LPBYTE pData16, INT iMapMode, HDC hdcRef); __declspec(dllimport) BOOL __stdcall PlayEnhMetaFile( HDC hdc, HENHMETAFILE hmf, const RECT * lprect); __declspec(dllimport) BOOL __stdcall PlayEnhMetaFileRecord( HDC hdc, LPHANDLETABLE pht, const ENHMETARECORD *pmr, UINT cht); __declspec(dllimport) HENHMETAFILE __stdcall SetEnhMetaFileBits( UINT nSize, const BYTE * pb); __declspec(dllimport) HENHMETAFILE __stdcall SetWinMetaFileBits( UINT nSize, const BYTE *lpMeta16Data, HDC hdcRef, const METAFILEPICT *lpMFP); __declspec(dllimport) BOOL __stdcall GdiComment( HDC hdc, UINT nSize, const BYTE *lpData); __declspec(dllimport) BOOL __stdcall GetTextMetricsA( HDC hdc, LPTEXTMETRICA lptm); __declspec(dllimport) BOOL __stdcall GetTextMetricsW( HDC hdc, LPTEXTMETRICW lptm); typedef struct tagDIBSECTION { BITMAP dsBm; BITMAPINFOHEADER dsBmih; DWORD dsBitfields[3]; HANDLE dshSection; DWORD dsOffset; } DIBSECTION, *LPDIBSECTION, *PDIBSECTION; __declspec(dllimport) BOOL __stdcall AngleArc( HDC hdc, int x, int y, DWORD r, FLOAT StartAngle, FLOAT SweepAngle); __declspec(dllimport) BOOL __stdcall PolyPolyline( HDC hdc, const POINT *apt, const DWORD *asz, DWORD csz); __declspec(dllimport) BOOL __stdcall GetWorldTransform( HDC hdc, LPXFORM lpxf); __declspec(dllimport) BOOL __stdcall SetWorldTransform( HDC hdc, const XFORM * lpxf); __declspec(dllimport) BOOL __stdcall ModifyWorldTransform( HDC hdc, const XFORM * lpxf, DWORD mode); __declspec(dllimport) BOOL __stdcall CombineTransform( LPXFORM lpxfOut, const XFORM *lpxf1, const XFORM *lpxf2); __declspec(dllimport) HBITMAP __stdcall CreateDIBSection( HDC hdc, const BITMAPINFO *pbmi, UINT usage, void **ppvBits, HANDLE hSection, DWORD offset); __declspec(dllimport) UINT __stdcall GetDIBColorTable( HDC hdc, UINT iStart, UINT cEntries, RGBQUAD *prgbq); __declspec(dllimport) UINT __stdcall SetDIBColorTable( HDC hdc, UINT iStart, UINT cEntries, const RGBQUAD *prgbq); typedef struct tagCOLORADJUSTMENT { WORD caSize; WORD caFlags; WORD caIlluminantIndex; WORD caRedGamma; WORD caGreenGamma; WORD caBlueGamma; WORD caReferenceBlack; WORD caReferenceWhite; SHORT caContrast; SHORT caBrightness; SHORT caColorfulness; SHORT caRedGreenTint; } COLORADJUSTMENT, *PCOLORADJUSTMENT, *LPCOLORADJUSTMENT; __declspec(dllimport) BOOL __stdcall SetColorAdjustment( HDC hdc, const COLORADJUSTMENT *lpca); __declspec(dllimport) BOOL __stdcall GetColorAdjustment( HDC hdc, LPCOLORADJUSTMENT lpca); __declspec(dllimport) HPALETTE __stdcall CreateHalftonePalette( HDC hdc); typedef BOOL (__stdcall* ABORTPROC)( HDC, int); typedef struct _DOCINFOA { int cbSize; LPCSTR lpszDocName; LPCSTR lpszOutput; LPCSTR lpszDatatype; DWORD fwType; } DOCINFOA, *LPDOCINFOA; typedef struct _DOCINFOW { int cbSize; LPCWSTR lpszDocName; LPCWSTR lpszOutput; LPCWSTR lpszDatatype; DWORD fwType; } DOCINFOW, *LPDOCINFOW; typedef DOCINFOW DOCINFO; typedef LPDOCINFOW LPDOCINFO; __declspec(dllimport) int __stdcall StartDocA( HDC hdc, const DOCINFOA *lpdi); __declspec(dllimport) int __stdcall StartDocW( HDC hdc, const DOCINFOW *lpdi); __declspec(dllimport) int __stdcall EndDoc( HDC hdc); __declspec(dllimport) int __stdcall StartPage( HDC hdc); __declspec(dllimport) int __stdcall EndPage( HDC hdc); __declspec(dllimport) int __stdcall AbortDoc( HDC hdc); __declspec(dllimport) int __stdcall SetAbortProc( HDC hdc, ABORTPROC proc); __declspec(dllimport) BOOL __stdcall AbortPath( HDC hdc); __declspec(dllimport) BOOL __stdcall ArcTo( HDC hdc, int left, int top, int right, int bottom, int xr1, int yr1, int xr2, int yr2); __declspec(dllimport) BOOL __stdcall BeginPath( HDC hdc); __declspec(dllimport) BOOL __stdcall CloseFigure( HDC hdc); __declspec(dllimport) BOOL __stdcall EndPath( HDC hdc); __declspec(dllimport) BOOL __stdcall FillPath( HDC hdc); __declspec(dllimport) BOOL __stdcall FlattenPath( HDC hdc); __declspec(dllimport) int __stdcall GetPath( HDC hdc, LPPOINT apt, LPBYTE aj, int cpt); __declspec(dllimport) HRGN __stdcall PathToRegion( HDC hdc); __declspec(dllimport) BOOL __stdcall PolyDraw( HDC hdc, const POINT * apt, const BYTE * aj, int cpt); __declspec(dllimport) BOOL __stdcall SelectClipPath( HDC hdc, int mode); __declspec(dllimport) int __stdcall SetArcDirection( HDC hdc, int dir); __declspec(dllimport) BOOL __stdcall SetMiterLimit( HDC hdc, FLOAT limit, PFLOAT old); __declspec(dllimport) BOOL __stdcall StrokeAndFillPath( HDC hdc); __declspec(dllimport) BOOL __stdcall StrokePath( HDC hdc); __declspec(dllimport) BOOL __stdcall WidenPath( HDC hdc); __declspec(dllimport) HPEN __stdcall ExtCreatePen( DWORD iPenStyle, DWORD cWidth, const LOGBRUSH *plbrush, DWORD cStyle, const DWORD *pstyle); __declspec(dllimport) BOOL __stdcall GetMiterLimit( HDC hdc, PFLOAT plimit); __declspec(dllimport) int __stdcall GetArcDirection( HDC hdc); __declspec(dllimport) int __stdcall GetObjectA( HANDLE h, int c, LPVOID pv); __declspec(dllimport) int __stdcall GetObjectW( HANDLE h, int c, LPVOID pv); __declspec(dllimport) BOOL __stdcall MoveToEx( HDC hdc, int x, int y, LPPOINT lppt); __declspec(dllimport) BOOL __stdcall TextOutA( HDC hdc, int x, int y, LPCSTR lpString, int c); __declspec(dllimport) BOOL __stdcall TextOutW( HDC hdc, int x, int y, LPCWSTR lpString, int c); __declspec(dllimport) BOOL __stdcall ExtTextOutA( HDC hdc, int x, int y, UINT options, const RECT * lprect, LPCSTR lpString, UINT c, const INT * lpDx); __declspec(dllimport) BOOL __stdcall ExtTextOutW( HDC hdc, int x, int y, UINT options, const RECT * lprect, LPCWSTR lpString, UINT c, const INT * lpDx); __declspec(dllimport) BOOL __stdcall PolyTextOutA( HDC hdc, const POLYTEXTA * ppt, int nstrings); __declspec(dllimport) BOOL __stdcall PolyTextOutW( HDC hdc, const POLYTEXTW * ppt, int nstrings); __declspec(dllimport) HRGN __stdcall CreatePolygonRgn( const POINT *pptl, int cPoint, int iMode); __declspec(dllimport) BOOL __stdcall DPtoLP( HDC hdc, LPPOINT lppt, int c); __declspec(dllimport) BOOL __stdcall LPtoDP( HDC hdc, LPPOINT lppt, int c); __declspec(dllimport) BOOL __stdcall Polygon( HDC hdc, const POINT *apt, int cpt); __declspec(dllimport) BOOL __stdcall Polyline( HDC hdc, const POINT *apt, int cpt); __declspec(dllimport) BOOL __stdcall PolyBezier( HDC hdc, const POINT * apt, DWORD cpt); __declspec(dllimport) BOOL __stdcall PolyBezierTo( HDC hdc, const POINT * apt, DWORD cpt); __declspec(dllimport) BOOL __stdcall PolylineTo( HDC hdc, const POINT * apt, DWORD cpt); __declspec(dllimport) BOOL __stdcall SetViewportExtEx( HDC hdc, int x, int y, LPSIZE lpsz); __declspec(dllimport) BOOL __stdcall SetViewportOrgEx( HDC hdc, int x, int y, LPPOINT lppt); __declspec(dllimport) BOOL __stdcall SetWindowExtEx( HDC hdc, int x, int y, LPSIZE lpsz); __declspec(dllimport) BOOL __stdcall SetWindowOrgEx( HDC hdc, int x, int y, LPPOINT lppt); __declspec(dllimport) BOOL __stdcall OffsetViewportOrgEx( HDC hdc, int x, int y, LPPOINT lppt); __declspec(dllimport) BOOL __stdcall OffsetWindowOrgEx( HDC hdc, int x, int y, LPPOINT lppt); __declspec(dllimport) BOOL __stdcall ScaleViewportExtEx( HDC hdc, int xn, int dx, int yn, int yd, LPSIZE lpsz); __declspec(dllimport) BOOL __stdcall ScaleWindowExtEx( HDC hdc, int xn, int xd, int yn, int yd, LPSIZE lpsz); __declspec(dllimport) BOOL __stdcall SetBitmapDimensionEx( HBITMAP hbm, int w, int h, LPSIZE lpsz); __declspec(dllimport) BOOL __stdcall SetBrushOrgEx( HDC hdc, int x, int y, LPPOINT lppt); __declspec(dllimport) int __stdcall GetTextFaceA( HDC hdc, int c, LPSTR lpName); __declspec(dllimport) int __stdcall GetTextFaceW( HDC hdc, int c, LPWSTR lpName); typedef struct tagKERNINGPAIR { WORD wFirst; WORD wSecond; int iKernAmount; } KERNINGPAIR, *LPKERNINGPAIR; __declspec(dllimport) DWORD __stdcall GetKerningPairsA( HDC hdc, DWORD nPairs, LPKERNINGPAIR lpKernPair); __declspec(dllimport) DWORD __stdcall GetKerningPairsW( HDC hdc, DWORD nPairs, LPKERNINGPAIR lpKernPair); __declspec(dllimport) BOOL __stdcall GetDCOrgEx( HDC hdc, LPPOINT lppt); __declspec(dllimport) BOOL __stdcall FixBrushOrgEx( HDC hdc, int x, int y, LPPOINT ptl); __declspec(dllimport) BOOL __stdcall UnrealizeObject( HGDIOBJ h); __declspec(dllimport) BOOL __stdcall GdiFlush(void); __declspec(dllimport) DWORD __stdcall GdiSetBatchLimit( DWORD dw); __declspec(dllimport) DWORD __stdcall GdiGetBatchLimit(void); typedef int (__stdcall* ICMENUMPROCA)(LPSTR, LPARAM); typedef int (__stdcall* ICMENUMPROCW)(LPWSTR, LPARAM); __declspec(dllimport) int __stdcall SetICMMode( HDC hdc, int mode); __declspec(dllimport) BOOL __stdcall CheckColorsInGamut( HDC hdc, LPRGBTRIPLE lpRGBTriple, LPVOID dlpBuffer, DWORD nCount); __declspec(dllimport) HCOLORSPACE __stdcall GetColorSpace( HDC hdc); __declspec(dllimport) BOOL __stdcall GetLogColorSpaceA( HCOLORSPACE hColorSpace, LPLOGCOLORSPACEA lpBuffer, DWORD nSize); __declspec(dllimport) BOOL __stdcall GetLogColorSpaceW( HCOLORSPACE hColorSpace, LPLOGCOLORSPACEW lpBuffer, DWORD nSize); __declspec(dllimport) HCOLORSPACE __stdcall CreateColorSpaceA( LPLOGCOLORSPACEA lplcs); __declspec(dllimport) HCOLORSPACE __stdcall CreateColorSpaceW( LPLOGCOLORSPACEW lplcs); __declspec(dllimport) HCOLORSPACE __stdcall SetColorSpace( HDC hdc, HCOLORSPACE hcs); __declspec(dllimport) BOOL __stdcall DeleteColorSpace( HCOLORSPACE hcs); __declspec(dllimport) BOOL __stdcall GetICMProfileA( HDC hdc, LPDWORD pBufSize, LPSTR pszFilename); __declspec(dllimport) BOOL __stdcall GetICMProfileW( HDC hdc, LPDWORD pBufSize, LPWSTR pszFilename); __declspec(dllimport) BOOL __stdcall SetICMProfileA( HDC hdc, LPSTR lpFileName); __declspec(dllimport) BOOL __stdcall SetICMProfileW( HDC hdc, LPWSTR lpFileName); __declspec(dllimport) BOOL __stdcall GetDeviceGammaRamp( HDC hdc, LPVOID lpRamp); __declspec(dllimport) BOOL __stdcall SetDeviceGammaRamp( HDC hdc, LPVOID lpRamp); __declspec(dllimport) BOOL __stdcall ColorMatchToTarget( HDC hdc, HDC hdcTarget, DWORD action); __declspec(dllimport) int __stdcall EnumICMProfilesA( HDC hdc, ICMENUMPROCA proc, LPARAM param); __declspec(dllimport) int __stdcall EnumICMProfilesW( HDC hdc, ICMENUMPROCW proc, LPARAM param); __declspec(dllimport) BOOL __stdcall UpdateICMRegKeyA( DWORD reserved, LPSTR lpszCMID, LPSTR lpszFileName, UINT command); __declspec(dllimport) BOOL __stdcall UpdateICMRegKeyW( DWORD reserved, LPWSTR lpszCMID, LPWSTR lpszFileName, UINT command); #pragma deprecated (UpdateICMRegKeyW) #pragma deprecated (UpdateICMRegKeyA) __declspec(dllimport) BOOL __stdcall ColorCorrectPalette( HDC hdc, HPALETTE hPal, DWORD deFirst, DWORD num); typedef struct tagEMR { DWORD iType; DWORD nSize; } EMR, *PEMR; typedef struct tagEMRTEXT { POINTL ptlReference; DWORD nChars; DWORD offString; DWORD fOptions; RECTL rcl; DWORD offDx; } EMRTEXT, *PEMRTEXT; typedef struct tagABORTPATH { EMR emr; } EMRABORTPATH, *PEMRABORTPATH, EMRBEGINPATH, *PEMRBEGINPATH, EMRENDPATH, *PEMRENDPATH, EMRCLOSEFIGURE, *PEMRCLOSEFIGURE, EMRFLATTENPATH, *PEMRFLATTENPATH, EMRWIDENPATH, *PEMRWIDENPATH, EMRSETMETARGN, *PEMRSETMETARGN, EMRSAVEDC, *PEMRSAVEDC, EMRREALIZEPALETTE, *PEMRREALIZEPALETTE; typedef struct tagEMRSELECTCLIPPATH { EMR emr; DWORD iMode; } EMRSELECTCLIPPATH, *PEMRSELECTCLIPPATH, EMRSETBKMODE, *PEMRSETBKMODE, EMRSETMAPMODE, *PEMRSETMAPMODE, EMRSETLAYOUT, *PEMRSETLAYOUT, EMRSETPOLYFILLMODE, *PEMRSETPOLYFILLMODE, EMRSETROP2, *PEMRSETROP2, EMRSETSTRETCHBLTMODE, *PEMRSETSTRETCHBLTMODE, EMRSETICMMODE, *PEMRSETICMMODE, EMRSETTEXTALIGN, *PEMRSETTEXTALIGN; typedef struct tagEMRSETMITERLIMIT { EMR emr; FLOAT eMiterLimit; } EMRSETMITERLIMIT, *PEMRSETMITERLIMIT; typedef struct tagEMRRESTOREDC { EMR emr; LONG iRelative; } EMRRESTOREDC, *PEMRRESTOREDC; typedef struct tagEMRSETARCDIRECTION { EMR emr; DWORD iArcDirection; } EMRSETARCDIRECTION, *PEMRSETARCDIRECTION; typedef struct tagEMRSETMAPPERFLAGS { EMR emr; DWORD dwFlags; } EMRSETMAPPERFLAGS, *PEMRSETMAPPERFLAGS; typedef struct tagEMRSETTEXTCOLOR { EMR emr; COLORREF crColor; } EMRSETBKCOLOR, *PEMRSETBKCOLOR, EMRSETTEXTCOLOR, *PEMRSETTEXTCOLOR; typedef struct tagEMRSELECTOBJECT { EMR emr; DWORD ihObject; } EMRSELECTOBJECT, *PEMRSELECTOBJECT, EMRDELETEOBJECT, *PEMRDELETEOBJECT; typedef struct tagEMRSELECTPALETTE { EMR emr; DWORD ihPal; } EMRSELECTPALETTE, *PEMRSELECTPALETTE; typedef struct tagEMRRESIZEPALETTE { EMR emr; DWORD ihPal; DWORD cEntries; } EMRRESIZEPALETTE, *PEMRRESIZEPALETTE; typedef struct tagEMRSETPALETTEENTRIES { EMR emr; DWORD ihPal; DWORD iStart; DWORD cEntries; PALETTEENTRY aPalEntries[1]; } EMRSETPALETTEENTRIES, *PEMRSETPALETTEENTRIES; typedef struct tagEMRSETCOLORADJUSTMENT { EMR emr; COLORADJUSTMENT ColorAdjustment; } EMRSETCOLORADJUSTMENT, *PEMRSETCOLORADJUSTMENT; typedef struct tagEMRGDICOMMENT { EMR emr; DWORD cbData; BYTE Data[1]; } EMRGDICOMMENT, *PEMRGDICOMMENT; typedef struct tagEMREOF { EMR emr; DWORD nPalEntries; DWORD offPalEntries; DWORD nSizeLast; } EMREOF, *PEMREOF; typedef struct tagEMRLINETO { EMR emr; POINTL ptl; } EMRLINETO, *PEMRLINETO, EMRMOVETOEX, *PEMRMOVETOEX; typedef struct tagEMROFFSETCLIPRGN { EMR emr; POINTL ptlOffset; } EMROFFSETCLIPRGN, *PEMROFFSETCLIPRGN; typedef struct tagEMRFILLPATH { EMR emr; RECTL rclBounds; } EMRFILLPATH, *PEMRFILLPATH, EMRSTROKEANDFILLPATH, *PEMRSTROKEANDFILLPATH, EMRSTROKEPATH, *PEMRSTROKEPATH; typedef struct tagEMREXCLUDECLIPRECT { EMR emr; RECTL rclClip; } EMREXCLUDECLIPRECT, *PEMREXCLUDECLIPRECT, EMRINTERSECTCLIPRECT, *PEMRINTERSECTCLIPRECT; typedef struct tagEMRSETVIEWPORTORGEX { EMR emr; POINTL ptlOrigin; } EMRSETVIEWPORTORGEX, *PEMRSETVIEWPORTORGEX, EMRSETWINDOWORGEX, *PEMRSETWINDOWORGEX, EMRSETBRUSHORGEX, *PEMRSETBRUSHORGEX; typedef struct tagEMRSETVIEWPORTEXTEX { EMR emr; SIZEL szlExtent; } EMRSETVIEWPORTEXTEX, *PEMRSETVIEWPORTEXTEX, EMRSETWINDOWEXTEX, *PEMRSETWINDOWEXTEX; typedef struct tagEMRSCALEVIEWPORTEXTEX { EMR emr; LONG xNum; LONG xDenom; LONG yNum; LONG yDenom; } EMRSCALEVIEWPORTEXTEX, *PEMRSCALEVIEWPORTEXTEX, EMRSCALEWINDOWEXTEX, *PEMRSCALEWINDOWEXTEX; typedef struct tagEMRSETWORLDTRANSFORM { EMR emr; XFORM xform; } EMRSETWORLDTRANSFORM, *PEMRSETWORLDTRANSFORM; typedef struct tagEMRMODIFYWORLDTRANSFORM { EMR emr; XFORM xform; DWORD iMode; } EMRMODIFYWORLDTRANSFORM, *PEMRMODIFYWORLDTRANSFORM; typedef struct tagEMRSETPIXELV { EMR emr; POINTL ptlPixel; COLORREF crColor; } EMRSETPIXELV, *PEMRSETPIXELV; typedef struct tagEMREXTFLOODFILL { EMR emr; POINTL ptlStart; COLORREF crColor; DWORD iMode; } EMREXTFLOODFILL, *PEMREXTFLOODFILL; typedef struct tagEMRELLIPSE { EMR emr; RECTL rclBox; } EMRELLIPSE, *PEMRELLIPSE, EMRRECTANGLE, *PEMRRECTANGLE; typedef struct tagEMRROUNDRECT { EMR emr; RECTL rclBox; SIZEL szlCorner; } EMRROUNDRECT, *PEMRROUNDRECT; typedef struct tagEMRARC { EMR emr; RECTL rclBox; POINTL ptlStart; POINTL ptlEnd; } EMRARC, *PEMRARC, EMRARCTO, *PEMRARCTO, EMRCHORD, *PEMRCHORD, EMRPIE, *PEMRPIE; typedef struct tagEMRANGLEARC { EMR emr; POINTL ptlCenter; DWORD nRadius; FLOAT eStartAngle; FLOAT eSweepAngle; } EMRANGLEARC, *PEMRANGLEARC; typedef struct tagEMRPOLYLINE { EMR emr; RECTL rclBounds; DWORD cptl; POINTL aptl[1]; } EMRPOLYLINE, *PEMRPOLYLINE, EMRPOLYBEZIER, *PEMRPOLYBEZIER, EMRPOLYGON, *PEMRPOLYGON, EMRPOLYBEZIERTO, *PEMRPOLYBEZIERTO, EMRPOLYLINETO, *PEMRPOLYLINETO; typedef struct tagEMRPOLYLINE16 { EMR emr; RECTL rclBounds; DWORD cpts; POINTS apts[1]; } EMRPOLYLINE16, *PEMRPOLYLINE16, EMRPOLYBEZIER16, *PEMRPOLYBEZIER16, EMRPOLYGON16, *PEMRPOLYGON16, EMRPOLYBEZIERTO16, *PEMRPOLYBEZIERTO16, EMRPOLYLINETO16, *PEMRPOLYLINETO16; typedef struct tagEMRPOLYDRAW { EMR emr; RECTL rclBounds; DWORD cptl; POINTL aptl[1]; BYTE abTypes[1]; } EMRPOLYDRAW, *PEMRPOLYDRAW; typedef struct tagEMRPOLYDRAW16 { EMR emr; RECTL rclBounds; DWORD cpts; POINTS apts[1]; BYTE abTypes[1]; } EMRPOLYDRAW16, *PEMRPOLYDRAW16; typedef struct tagEMRPOLYPOLYLINE { EMR emr; RECTL rclBounds; DWORD nPolys; DWORD cptl; DWORD aPolyCounts[1]; POINTL aptl[1]; } EMRPOLYPOLYLINE, *PEMRPOLYPOLYLINE, EMRPOLYPOLYGON, *PEMRPOLYPOLYGON; typedef struct tagEMRPOLYPOLYLINE16 { EMR emr; RECTL rclBounds; DWORD nPolys; DWORD cpts; DWORD aPolyCounts[1]; POINTS apts[1]; } EMRPOLYPOLYLINE16, *PEMRPOLYPOLYLINE16, EMRPOLYPOLYGON16, *PEMRPOLYPOLYGON16; typedef struct tagEMRINVERTRGN { EMR emr; RECTL rclBounds; DWORD cbRgnData; BYTE RgnData[1]; } EMRINVERTRGN, *PEMRINVERTRGN, EMRPAINTRGN, *PEMRPAINTRGN; typedef struct tagEMRFILLRGN { EMR emr; RECTL rclBounds; DWORD cbRgnData; DWORD ihBrush; BYTE RgnData[1]; } EMRFILLRGN, *PEMRFILLRGN; typedef struct tagEMRFRAMERGN { EMR emr; RECTL rclBounds; DWORD cbRgnData; DWORD ihBrush; SIZEL szlStroke; BYTE RgnData[1]; } EMRFRAMERGN, *PEMRFRAMERGN; typedef struct tagEMREXTSELECTCLIPRGN { EMR emr; DWORD cbRgnData; DWORD iMode; BYTE RgnData[1]; } EMREXTSELECTCLIPRGN, *PEMREXTSELECTCLIPRGN; typedef struct tagEMREXTTEXTOUTA { EMR emr; RECTL rclBounds; DWORD iGraphicsMode; FLOAT exScale; FLOAT eyScale; EMRTEXT emrtext; } EMREXTTEXTOUTA, *PEMREXTTEXTOUTA, EMREXTTEXTOUTW, *PEMREXTTEXTOUTW; typedef struct tagEMRPOLYTEXTOUTA { EMR emr; RECTL rclBounds; DWORD iGraphicsMode; FLOAT exScale; FLOAT eyScale; LONG cStrings; EMRTEXT aemrtext[1]; } EMRPOLYTEXTOUTA, *PEMRPOLYTEXTOUTA, EMRPOLYTEXTOUTW, *PEMRPOLYTEXTOUTW; typedef struct tagEMRBITBLT { EMR emr; RECTL rclBounds; LONG xDest; LONG yDest; LONG cxDest; LONG cyDest; DWORD dwRop; LONG xSrc; LONG ySrc; XFORM xformSrc; COLORREF crBkColorSrc; DWORD iUsageSrc; DWORD offBmiSrc; DWORD cbBmiSrc; DWORD offBitsSrc; DWORD cbBitsSrc; } EMRBITBLT, *PEMRBITBLT; typedef struct tagEMRSTRETCHBLT { EMR emr; RECTL rclBounds; LONG xDest; LONG yDest; LONG cxDest; LONG cyDest; DWORD dwRop; LONG xSrc; LONG ySrc; XFORM xformSrc; COLORREF crBkColorSrc; DWORD iUsageSrc; DWORD offBmiSrc; DWORD cbBmiSrc; DWORD offBitsSrc; DWORD cbBitsSrc; LONG cxSrc; LONG cySrc; } EMRSTRETCHBLT, *PEMRSTRETCHBLT; typedef struct tagEMRMASKBLT { EMR emr; RECTL rclBounds; LONG xDest; LONG yDest; LONG cxDest; LONG cyDest; DWORD dwRop; LONG xSrc; LONG ySrc; XFORM xformSrc; COLORREF crBkColorSrc; DWORD iUsageSrc; DWORD offBmiSrc; DWORD cbBmiSrc; DWORD offBitsSrc; DWORD cbBitsSrc; LONG xMask; LONG yMask; DWORD iUsageMask; DWORD offBmiMask; DWORD cbBmiMask; DWORD offBitsMask; DWORD cbBitsMask; } EMRMASKBLT, *PEMRMASKBLT; typedef struct tagEMRPLGBLT { EMR emr; RECTL rclBounds; POINTL aptlDest[3]; LONG xSrc; LONG ySrc; LONG cxSrc; LONG cySrc; XFORM xformSrc; COLORREF crBkColorSrc; DWORD iUsageSrc; DWORD offBmiSrc; DWORD cbBmiSrc; DWORD offBitsSrc; DWORD cbBitsSrc; LONG xMask; LONG yMask; DWORD iUsageMask; DWORD offBmiMask; DWORD cbBmiMask; DWORD offBitsMask; DWORD cbBitsMask; } EMRPLGBLT, *PEMRPLGBLT; typedef struct tagEMRSETDIBITSTODEVICE { EMR emr; RECTL rclBounds; LONG xDest; LONG yDest; LONG xSrc; LONG ySrc; LONG cxSrc; LONG cySrc; DWORD offBmiSrc; DWORD cbBmiSrc; DWORD offBitsSrc; DWORD cbBitsSrc; DWORD iUsageSrc; DWORD iStartScan; DWORD cScans; } EMRSETDIBITSTODEVICE, *PEMRSETDIBITSTODEVICE; typedef struct tagEMRSTRETCHDIBITS { EMR emr; RECTL rclBounds; LONG xDest; LONG yDest; LONG xSrc; LONG ySrc; LONG cxSrc; LONG cySrc; DWORD offBmiSrc; DWORD cbBmiSrc; DWORD offBitsSrc; DWORD cbBitsSrc; DWORD iUsageSrc; DWORD dwRop; LONG cxDest; LONG cyDest; } EMRSTRETCHDIBITS, *PEMRSTRETCHDIBITS; typedef struct tagEMREXTCREATEFONTINDIRECTW { EMR emr; DWORD ihFont; EXTLOGFONTW elfw; } EMREXTCREATEFONTINDIRECTW, *PEMREXTCREATEFONTINDIRECTW; typedef struct tagEMRCREATEPALETTE { EMR emr; DWORD ihPal; LOGPALETTE lgpl; } EMRCREATEPALETTE, *PEMRCREATEPALETTE; typedef struct tagEMRCREATEPEN { EMR emr; DWORD ihPen; LOGPEN lopn; } EMRCREATEPEN, *PEMRCREATEPEN; typedef struct tagEMREXTCREATEPEN { EMR emr; DWORD ihPen; DWORD offBmi; DWORD cbBmi; DWORD offBits; DWORD cbBits; EXTLOGPEN32 elp; } EMREXTCREATEPEN, *PEMREXTCREATEPEN; typedef struct tagEMRCREATEBRUSHINDIRECT { EMR emr; DWORD ihBrush; LOGBRUSH32 lb; } EMRCREATEBRUSHINDIRECT, *PEMRCREATEBRUSHINDIRECT; typedef struct tagEMRCREATEMONOBRUSH { EMR emr; DWORD ihBrush; DWORD iUsage; DWORD offBmi; DWORD cbBmi; DWORD offBits; DWORD cbBits; } EMRCREATEMONOBRUSH, *PEMRCREATEMONOBRUSH; typedef struct tagEMRCREATEDIBPATTERNBRUSHPT { EMR emr; DWORD ihBrush; DWORD iUsage; DWORD offBmi; DWORD cbBmi; DWORD offBits; DWORD cbBits; } EMRCREATEDIBPATTERNBRUSHPT, *PEMRCREATEDIBPATTERNBRUSHPT; typedef struct tagEMRFORMAT { DWORD dSignature; DWORD nVersion; DWORD cbData; DWORD offData; } EMRFORMAT, *PEMRFORMAT; typedef struct tagEMRGLSRECORD { EMR emr; DWORD cbData; BYTE Data[1]; } EMRGLSRECORD, *PEMRGLSRECORD; typedef struct tagEMRGLSBOUNDEDRECORD { EMR emr; RECTL rclBounds; DWORD cbData; BYTE Data[1]; } EMRGLSBOUNDEDRECORD, *PEMRGLSBOUNDEDRECORD; typedef struct tagEMRPIXELFORMAT { EMR emr; PIXELFORMATDESCRIPTOR pfd; } EMRPIXELFORMAT, *PEMRPIXELFORMAT; typedef struct tagEMRCREATECOLORSPACE { EMR emr; DWORD ihCS; LOGCOLORSPACEA lcs; } EMRCREATECOLORSPACE, *PEMRCREATECOLORSPACE; typedef struct tagEMRSETCOLORSPACE { EMR emr; DWORD ihCS; } EMRSETCOLORSPACE, *PEMRSETCOLORSPACE, EMRSELECTCOLORSPACE, *PEMRSELECTCOLORSPACE, EMRDELETECOLORSPACE, *PEMRDELETECOLORSPACE; typedef struct tagEMREXTESCAPE { EMR emr; INT iEscape; INT cbEscData; BYTE EscData[1]; } EMREXTESCAPE, *PEMREXTESCAPE, EMRDRAWESCAPE, *PEMRDRAWESCAPE; typedef struct tagEMRNAMEDESCAPE { EMR emr; INT iEscape; INT cbDriver; INT cbEscData; BYTE EscData[1]; } EMRNAMEDESCAPE, *PEMRNAMEDESCAPE; typedef struct tagEMRSETICMPROFILE { EMR emr; DWORD dwFlags; DWORD cbName; DWORD cbData; BYTE Data[1]; } EMRSETICMPROFILE, *PEMRSETICMPROFILE, EMRSETICMPROFILEA, *PEMRSETICMPROFILEA, EMRSETICMPROFILEW, *PEMRSETICMPROFILEW; typedef struct tagEMRCREATECOLORSPACEW { EMR emr; DWORD ihCS; LOGCOLORSPACEW lcs; DWORD dwFlags; DWORD cbData; BYTE Data[1]; } EMRCREATECOLORSPACEW, *PEMRCREATECOLORSPACEW; typedef struct tagCOLORMATCHTOTARGET { EMR emr; DWORD dwAction; DWORD dwFlags; DWORD cbName; DWORD cbData; BYTE Data[1]; } EMRCOLORMATCHTOTARGET, *PEMRCOLORMATCHTOTARGET; typedef struct tagCOLORCORRECTPALETTE { EMR emr; DWORD ihPalette; DWORD nFirstEntry; DWORD nPalEntries; DWORD nReserved; } EMRCOLORCORRECTPALETTE, *PEMRCOLORCORRECTPALETTE; typedef struct tagEMRALPHABLEND { EMR emr; RECTL rclBounds; LONG xDest; LONG yDest; LONG cxDest; LONG cyDest; DWORD dwRop; LONG xSrc; LONG ySrc; XFORM xformSrc; COLORREF crBkColorSrc; DWORD iUsageSrc; DWORD offBmiSrc; DWORD cbBmiSrc; DWORD offBitsSrc; DWORD cbBitsSrc; LONG cxSrc; LONG cySrc; } EMRALPHABLEND, *PEMRALPHABLEND; typedef struct tagEMRGRADIENTFILL { EMR emr; RECTL rclBounds; DWORD nVer; DWORD nTri; ULONG ulMode; TRIVERTEX Ver[1]; }EMRGRADIENTFILL,*PEMRGRADIENTFILL; typedef struct tagEMRTRANSPARENTBLT { EMR emr; RECTL rclBounds; LONG xDest; LONG yDest; LONG cxDest; LONG cyDest; DWORD dwRop; LONG xSrc; LONG ySrc; XFORM xformSrc; COLORREF crBkColorSrc; DWORD iUsageSrc; DWORD offBmiSrc; DWORD cbBmiSrc; DWORD offBitsSrc; DWORD cbBitsSrc; LONG cxSrc; LONG cySrc; } EMRTRANSPARENTBLT, *PEMRTRANSPARENTBLT; __declspec(dllimport) BOOL __stdcall wglCopyContext(HGLRC, HGLRC, UINT); __declspec(dllimport) HGLRC __stdcall wglCreateContext(HDC); __declspec(dllimport) HGLRC __stdcall wglCreateLayerContext(HDC, int); __declspec(dllimport) BOOL __stdcall wglDeleteContext(HGLRC); __declspec(dllimport) HGLRC __stdcall wglGetCurrentContext(void); __declspec(dllimport) HDC __stdcall wglGetCurrentDC(void); __declspec(dllimport) PROC __stdcall wglGetProcAddress(LPCSTR); __declspec(dllimport) BOOL __stdcall wglMakeCurrent(HDC, HGLRC); __declspec(dllimport) BOOL __stdcall wglShareLists(HGLRC, HGLRC); __declspec(dllimport) BOOL __stdcall wglUseFontBitmapsA(HDC, DWORD, DWORD, DWORD); __declspec(dllimport) BOOL __stdcall wglUseFontBitmapsW(HDC, DWORD, DWORD, DWORD); __declspec(dllimport) BOOL __stdcall SwapBuffers(HDC); typedef struct _POINTFLOAT { FLOAT x; FLOAT y; } POINTFLOAT, *PPOINTFLOAT; typedef struct _GLYPHMETRICSFLOAT { FLOAT gmfBlackBoxX; FLOAT gmfBlackBoxY; POINTFLOAT gmfptGlyphOrigin; FLOAT gmfCellIncX; FLOAT gmfCellIncY; } GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT; __declspec(dllimport) BOOL __stdcall wglUseFontOutlinesA(HDC, DWORD, DWORD, DWORD, FLOAT, FLOAT, int, LPGLYPHMETRICSFLOAT); __declspec(dllimport) BOOL __stdcall wglUseFontOutlinesW(HDC, DWORD, DWORD, DWORD, FLOAT, FLOAT, int, LPGLYPHMETRICSFLOAT); typedef struct tagLAYERPLANEDESCRIPTOR { WORD nSize; WORD nVersion; DWORD dwFlags; BYTE iPixelType; BYTE cColorBits; BYTE cRedBits; BYTE cRedShift; BYTE cGreenBits; BYTE cGreenShift; BYTE cBlueBits; BYTE cBlueShift; BYTE cAlphaBits; BYTE cAlphaShift; BYTE cAccumBits; BYTE cAccumRedBits; BYTE cAccumGreenBits; BYTE cAccumBlueBits; BYTE cAccumAlphaBits; BYTE cDepthBits; BYTE cStencilBits; BYTE cAuxBuffers; BYTE iLayerPlane; BYTE bReserved; COLORREF crTransparent; } LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR; __declspec(dllimport) BOOL __stdcall wglDescribeLayerPlane(HDC, int, int, UINT, LPLAYERPLANEDESCRIPTOR); __declspec(dllimport) int __stdcall wglSetLayerPaletteEntries(HDC, int, int, int, const COLORREF *); __declspec(dllimport) int __stdcall wglGetLayerPaletteEntries(HDC, int, int, int, COLORREF *); __declspec(dllimport) BOOL __stdcall wglRealizeLayerPalette(HDC, int, BOOL); __declspec(dllimport) BOOL __stdcall wglSwapLayerBuffers(HDC, UINT); typedef struct _WGLSWAP { HDC hdc; UINT uiFlags; } WGLSWAP, *PWGLSWAP, *LPWGLSWAP; __declspec(dllimport) DWORD __stdcall wglSwapMultipleBuffers(UINT, const WGLSWAP *); } #pragma warning(pop) extern "C" { #pragma warning(push) #pragma warning(disable: 4820) typedef HANDLE HDWP; typedef void MENUTEMPLATEA; typedef void MENUTEMPLATEW; typedef MENUTEMPLATEW MENUTEMPLATE; typedef PVOID LPMENUTEMPLATEA; typedef PVOID LPMENUTEMPLATEW; typedef LPMENUTEMPLATEW LPMENUTEMPLATE; typedef LRESULT (__stdcall* WNDPROC)(HWND, UINT, WPARAM, LPARAM); typedef INT_PTR (__stdcall* DLGPROC)(HWND, UINT, WPARAM, LPARAM); typedef void (__stdcall* TIMERPROC)(HWND, UINT, UINT_PTR, DWORD); typedef BOOL (__stdcall* GRAYSTRINGPROC)(HDC, LPARAM, int); typedef BOOL (__stdcall* WNDENUMPROC)(HWND, LPARAM); typedef LRESULT (__stdcall* HOOKPROC)(int code, WPARAM wParam, LPARAM lParam); typedef void (__stdcall* SENDASYNCPROC)(HWND, UINT, ULONG_PTR, LRESULT); typedef BOOL (__stdcall* PROPENUMPROCA)(HWND, LPCSTR, HANDLE); typedef BOOL (__stdcall* PROPENUMPROCW)(HWND, LPCWSTR, HANDLE); typedef BOOL (__stdcall* PROPENUMPROCEXA)(HWND, LPSTR, HANDLE, ULONG_PTR); typedef BOOL (__stdcall* PROPENUMPROCEXW)(HWND, LPWSTR, HANDLE, ULONG_PTR); typedef int (__stdcall* EDITWORDBREAKPROCA)(LPSTR lpch, int ichCurrent, int cch, int code); typedef int (__stdcall* EDITWORDBREAKPROCW)(LPWSTR lpch, int ichCurrent, int cch, int code); typedef BOOL (__stdcall* DRAWSTATEPROC)(HDC hdc, LPARAM lData, WPARAM wData, int cx, int cy); typedef PROPENUMPROCW PROPENUMPROC; typedef PROPENUMPROCEXW PROPENUMPROCEX; typedef EDITWORDBREAKPROCW EDITWORDBREAKPROC; typedef BOOL (__stdcall* NAMEENUMPROCA)(LPSTR, LPARAM); typedef BOOL (__stdcall* NAMEENUMPROCW)(LPWSTR, LPARAM); typedef NAMEENUMPROCA WINSTAENUMPROCA; typedef NAMEENUMPROCA DESKTOPENUMPROCA; typedef NAMEENUMPROCW WINSTAENUMPROCW; typedef NAMEENUMPROCW DESKTOPENUMPROCW; typedef WINSTAENUMPROCW WINSTAENUMPROC; typedef DESKTOPENUMPROCW DESKTOPENUMPROC; #pragma warning(push) #pragma warning(disable: 4995) __declspec(dllimport) int __stdcall wvsprintfA( LPSTR, LPCSTR, va_list arglist); __declspec(dllimport) int __stdcall wvsprintfW( LPWSTR, LPCWSTR, va_list arglist); __declspec(dllimport) int __cdecl wsprintfA( LPSTR, LPCSTR, ...); __declspec(dllimport) int __cdecl wsprintfW( LPWSTR, LPCWSTR, ...); #pragma warning(pop) typedef struct tagCBT_CREATEWNDA { struct tagCREATESTRUCTA *lpcs; HWND hwndInsertAfter; } CBT_CREATEWNDA, *LPCBT_CREATEWNDA; typedef struct tagCBT_CREATEWNDW { struct tagCREATESTRUCTW *lpcs; HWND hwndInsertAfter; } CBT_CREATEWNDW, *LPCBT_CREATEWNDW; typedef CBT_CREATEWNDW CBT_CREATEWND; typedef LPCBT_CREATEWNDW LPCBT_CREATEWND; typedef struct tagCBTACTIVATESTRUCT { BOOL fMouse; HWND hWndActive; } CBTACTIVATESTRUCT, *LPCBTACTIVATESTRUCT; typedef struct tagWTSSESSION_NOTIFICATION { DWORD cbSize; DWORD dwSessionId; } WTSSESSION_NOTIFICATION, *PWTSSESSION_NOTIFICATION; typedef struct { HWND hwnd; RECT rc; } SHELLHOOKINFO, *LPSHELLHOOKINFO; typedef struct tagEVENTMSG { UINT message; UINT paramL; UINT paramH; DWORD time; HWND hwnd; } EVENTMSG, *PEVENTMSGMSG, *NPEVENTMSGMSG, *LPEVENTMSGMSG; typedef struct tagEVENTMSG *PEVENTMSG, *NPEVENTMSG, *LPEVENTMSG; typedef struct tagCWPSTRUCT { LPARAM lParam; WPARAM wParam; UINT message; HWND hwnd; } CWPSTRUCT, *PCWPSTRUCT, *NPCWPSTRUCT, *LPCWPSTRUCT; typedef struct tagCWPRETSTRUCT { LRESULT lResult; LPARAM lParam; WPARAM wParam; UINT message; HWND hwnd; } CWPRETSTRUCT, *PCWPRETSTRUCT, *NPCWPRETSTRUCT, *LPCWPRETSTRUCT; typedef struct tagKBDLLHOOKSTRUCT { DWORD vkCode; DWORD scanCode; DWORD flags; DWORD time; ULONG_PTR dwExtraInfo; } KBDLLHOOKSTRUCT, *LPKBDLLHOOKSTRUCT, *PKBDLLHOOKSTRUCT; typedef struct tagMSLLHOOKSTRUCT { POINT pt; DWORD mouseData; DWORD flags; DWORD time; ULONG_PTR dwExtraInfo; } MSLLHOOKSTRUCT, *LPMSLLHOOKSTRUCT, *PMSLLHOOKSTRUCT; typedef struct tagDEBUGHOOKINFO { DWORD idThread; DWORD idThreadInstaller; LPARAM lParam; WPARAM wParam; int code; } DEBUGHOOKINFO, *PDEBUGHOOKINFO, *NPDEBUGHOOKINFO, * LPDEBUGHOOKINFO; typedef struct tagMOUSEHOOKSTRUCT { POINT pt; HWND hwnd; UINT wHitTestCode; ULONG_PTR dwExtraInfo; } MOUSEHOOKSTRUCT, *LPMOUSEHOOKSTRUCT, *PMOUSEHOOKSTRUCT; typedef struct tagMOUSEHOOKSTRUCTEX : public tagMOUSEHOOKSTRUCT { DWORD mouseData; } MOUSEHOOKSTRUCTEX, *LPMOUSEHOOKSTRUCTEX, *PMOUSEHOOKSTRUCTEX; typedef struct tagHARDWAREHOOKSTRUCT { HWND hwnd; UINT message; WPARAM wParam; LPARAM lParam; } HARDWAREHOOKSTRUCT, *LPHARDWAREHOOKSTRUCT, *PHARDWAREHOOKSTRUCT; __declspec(dllimport) HKL __stdcall LoadKeyboardLayoutA( LPCSTR pwszKLID, UINT Flags); __declspec(dllimport) HKL __stdcall LoadKeyboardLayoutW( LPCWSTR pwszKLID, UINT Flags); __declspec(dllimport) HKL __stdcall ActivateKeyboardLayout( HKL hkl, UINT Flags); __declspec(dllimport) int __stdcall ToUnicodeEx( UINT wVirtKey, UINT wScanCode, const BYTE *lpKeyState, LPWSTR pwszBuff, int cchBuff, UINT wFlags, HKL dwhkl); __declspec(dllimport) BOOL __stdcall UnloadKeyboardLayout( HKL hkl); __declspec(dllimport) BOOL __stdcall GetKeyboardLayoutNameA( LPSTR pwszKLID); __declspec(dllimport) BOOL __stdcall GetKeyboardLayoutNameW( LPWSTR pwszKLID); __declspec(dllimport) int __stdcall GetKeyboardLayoutList( int nBuff, HKL *lpList); __declspec(dllimport) HKL __stdcall GetKeyboardLayout( DWORD idThread); typedef struct tagMOUSEMOVEPOINT { int x; int y; DWORD time; ULONG_PTR dwExtraInfo; } MOUSEMOVEPOINT, *PMOUSEMOVEPOINT, * LPMOUSEMOVEPOINT; __declspec(dllimport) int __stdcall GetMouseMovePointsEx( UINT cbSize, LPMOUSEMOVEPOINT lppt, LPMOUSEMOVEPOINT lpptBuf, int nBufPoints, DWORD resolution); __declspec(dllimport) HDESK __stdcall CreateDesktopA( LPCSTR lpszDesktop, LPCSTR lpszDevice, DEVMODEA* pDevmode, DWORD dwFlags, ACCESS_MASK dwDesiredAccess, LPSECURITY_ATTRIBUTES lpsa); __declspec(dllimport) HDESK __stdcall CreateDesktopW( LPCWSTR lpszDesktop, LPCWSTR lpszDevice, DEVMODEW* pDevmode, DWORD dwFlags, ACCESS_MASK dwDesiredAccess, LPSECURITY_ATTRIBUTES lpsa); __declspec(dllimport) HDESK __stdcall CreateDesktopExA( LPCSTR lpszDesktop, LPCSTR lpszDevice, DEVMODEA* pDevmode, DWORD dwFlags, ACCESS_MASK dwDesiredAccess, LPSECURITY_ATTRIBUTES lpsa, ULONG ulHeapSize, PVOID pvoid); __declspec(dllimport) HDESK __stdcall CreateDesktopExW( LPCWSTR lpszDesktop, LPCWSTR lpszDevice, DEVMODEW* pDevmode, DWORD dwFlags, ACCESS_MASK dwDesiredAccess, LPSECURITY_ATTRIBUTES lpsa, ULONG ulHeapSize, PVOID pvoid); __declspec(dllimport) HDESK __stdcall OpenDesktopA( LPCSTR lpszDesktop, DWORD dwFlags, BOOL fInherit, ACCESS_MASK dwDesiredAccess); __declspec(dllimport) HDESK __stdcall OpenDesktopW( LPCWSTR lpszDesktop, DWORD dwFlags, BOOL fInherit, ACCESS_MASK dwDesiredAccess); __declspec(dllimport) HDESK __stdcall OpenInputDesktop( DWORD dwFlags, BOOL fInherit, ACCESS_MASK dwDesiredAccess); __declspec(dllimport) BOOL __stdcall EnumDesktopsA( HWINSTA hwinsta, DESKTOPENUMPROCA lpEnumFunc, LPARAM lParam); __declspec(dllimport) BOOL __stdcall EnumDesktopsW( HWINSTA hwinsta, DESKTOPENUMPROCW lpEnumFunc, LPARAM lParam); __declspec(dllimport) BOOL __stdcall EnumDesktopWindows( HDESK hDesktop, WNDENUMPROC lpfn, LPARAM lParam); __declspec(dllimport) BOOL __stdcall SwitchDesktop( HDESK hDesktop); __declspec(dllimport) BOOL __stdcall SetThreadDesktop( HDESK hDesktop); __declspec(dllimport) BOOL __stdcall CloseDesktop( HDESK hDesktop); __declspec(dllimport) HDESK __stdcall GetThreadDesktop( DWORD dwThreadId); __declspec(dllimport) HWINSTA __stdcall CreateWindowStationA( LPCSTR lpwinsta, DWORD dwFlags, ACCESS_MASK dwDesiredAccess, LPSECURITY_ATTRIBUTES lpsa); __declspec(dllimport) HWINSTA __stdcall CreateWindowStationW( LPCWSTR lpwinsta, DWORD dwFlags, ACCESS_MASK dwDesiredAccess, LPSECURITY_ATTRIBUTES lpsa); __declspec(dllimport) HWINSTA __stdcall OpenWindowStationA( LPCSTR lpszWinSta, BOOL fInherit, ACCESS_MASK dwDesiredAccess); __declspec(dllimport) HWINSTA __stdcall OpenWindowStationW( LPCWSTR lpszWinSta, BOOL fInherit, ACCESS_MASK dwDesiredAccess); __declspec(dllimport) BOOL __stdcall EnumWindowStationsA( WINSTAENUMPROCA lpEnumFunc, LPARAM lParam); __declspec(dllimport) BOOL __stdcall EnumWindowStationsW( WINSTAENUMPROCW lpEnumFunc, LPARAM lParam); __declspec(dllimport) BOOL __stdcall CloseWindowStation( HWINSTA hWinSta); __declspec(dllimport) BOOL __stdcall SetProcessWindowStation( HWINSTA hWinSta); __declspec(dllimport) HWINSTA __stdcall GetProcessWindowStation( void); __declspec(dllimport) BOOL __stdcall SetUserObjectSecurity( HANDLE hObj, PSECURITY_INFORMATION pSIRequested, PSECURITY_DESCRIPTOR pSID); __declspec(dllimport) BOOL __stdcall GetUserObjectSecurity( HANDLE hObj, PSECURITY_INFORMATION pSIRequested, PSECURITY_DESCRIPTOR pSID, DWORD nLength, LPDWORD lpnLengthNeeded); typedef struct tagUSEROBJECTFLAGS { BOOL fInherit; BOOL fReserved; DWORD dwFlags; } USEROBJECTFLAGS, *PUSEROBJECTFLAGS; __declspec(dllimport) BOOL __stdcall GetUserObjectInformationA( HANDLE hObj, int nIndex, PVOID pvInfo, DWORD nLength, LPDWORD lpnLengthNeeded); __declspec(dllimport) BOOL __stdcall GetUserObjectInformationW( HANDLE hObj, int nIndex, PVOID pvInfo, DWORD nLength, LPDWORD lpnLengthNeeded); __declspec(dllimport) BOOL __stdcall SetUserObjectInformationA( HANDLE hObj, int nIndex, PVOID pvInfo, DWORD nLength); __declspec(dllimport) BOOL __stdcall SetUserObjectInformationW( HANDLE hObj, int nIndex, PVOID pvInfo, DWORD nLength); typedef struct tagWNDCLASSEXA { UINT cbSize; UINT style; WNDPROC lpfnWndProc; int cbClsExtra; int cbWndExtra; HINSTANCE hInstance; HICON hIcon; HCURSOR hCursor; HBRUSH hbrBackground; LPCSTR lpszMenuName; LPCSTR lpszClassName; HICON hIconSm; } WNDCLASSEXA, *PWNDCLASSEXA, *NPWNDCLASSEXA, *LPWNDCLASSEXA; typedef struct tagWNDCLASSEXW { UINT cbSize; UINT style; WNDPROC lpfnWndProc; int cbClsExtra; int cbWndExtra; HINSTANCE hInstance; HICON hIcon; HCURSOR hCursor; HBRUSH hbrBackground; LPCWSTR lpszMenuName; LPCWSTR lpszClassName; HICON hIconSm; } WNDCLASSEXW, *PWNDCLASSEXW, *NPWNDCLASSEXW, *LPWNDCLASSEXW; typedef WNDCLASSEXW WNDCLASSEX; typedef PWNDCLASSEXW PWNDCLASSEX; typedef NPWNDCLASSEXW NPWNDCLASSEX; typedef LPWNDCLASSEXW LPWNDCLASSEX; typedef struct tagWNDCLASSA { UINT style; WNDPROC lpfnWndProc; int cbClsExtra; int cbWndExtra; HINSTANCE hInstance; HICON hIcon; HCURSOR hCursor; HBRUSH hbrBackground; LPCSTR lpszMenuName; LPCSTR lpszClassName; } WNDCLASSA, *PWNDCLASSA, *NPWNDCLASSA, *LPWNDCLASSA; typedef struct tagWNDCLASSW { UINT style; WNDPROC lpfnWndProc; int cbClsExtra; int cbWndExtra; HINSTANCE hInstance; HICON hIcon; HCURSOR hCursor; HBRUSH hbrBackground; LPCWSTR lpszMenuName; LPCWSTR lpszClassName; } WNDCLASSW, *PWNDCLASSW, *NPWNDCLASSW, *LPWNDCLASSW; typedef WNDCLASSW WNDCLASS; typedef PWNDCLASSW PWNDCLASS; typedef NPWNDCLASSW NPWNDCLASS; typedef LPWNDCLASSW LPWNDCLASS; __declspec(dllimport) BOOL __stdcall IsHungAppWindow( HWND hwnd); __declspec(dllimport) void __stdcall DisableProcessWindowsGhosting( void); typedef struct tagMSG { HWND hwnd; UINT message; WPARAM wParam; LPARAM lParam; DWORD time; POINT pt; } MSG, *PMSG, *NPMSG, *LPMSG; typedef struct tagMINMAXINFO { POINT ptReserved; POINT ptMaxSize; POINT ptMaxPosition; POINT ptMinTrackSize; POINT ptMaxTrackSize; } MINMAXINFO, *PMINMAXINFO, *LPMINMAXINFO; typedef struct tagCOPYDATASTRUCT { ULONG_PTR dwData; DWORD cbData; PVOID lpData; } COPYDATASTRUCT, *PCOPYDATASTRUCT; typedef struct tagMDINEXTMENU { HMENU hmenuIn; HMENU hmenuNext; HWND hwndNext; } MDINEXTMENU, * PMDINEXTMENU, * LPMDINEXTMENU; typedef struct { GUID PowerSetting; DWORD DataLength; UCHAR Data[1]; } POWERBROADCAST_SETTING, *PPOWERBROADCAST_SETTING; __declspec(dllimport) UINT __stdcall RegisterWindowMessageA( LPCSTR lpString); __declspec(dllimport) UINT __stdcall RegisterWindowMessageW( LPCWSTR lpString); typedef struct tagWINDOWPOS { HWND hwnd; HWND hwndInsertAfter; int x; int y; int cx; int cy; UINT flags; } WINDOWPOS, *LPWINDOWPOS, *PWINDOWPOS; typedef struct tagNCCALCSIZE_PARAMS { RECT rgrc[3]; PWINDOWPOS lppos; } NCCALCSIZE_PARAMS, *LPNCCALCSIZE_PARAMS; typedef struct tagTRACKMOUSEEVENT { DWORD cbSize; DWORD dwFlags; HWND hwndTrack; DWORD dwHoverTime; } TRACKMOUSEEVENT, *LPTRACKMOUSEEVENT; __declspec(dllimport) BOOL __stdcall TrackMouseEvent( LPTRACKMOUSEEVENT lpEventTrack); __declspec(dllimport) BOOL __stdcall DrawEdge( HDC hdc, LPRECT qrc, UINT edge, UINT grfFlags); __declspec(dllimport) BOOL __stdcall DrawFrameControl( HDC, LPRECT, UINT, UINT); __declspec(dllimport) BOOL __stdcall DrawCaption( HWND hwnd, HDC hdc, const RECT * lprect, UINT flags); __declspec(dllimport) BOOL __stdcall DrawAnimatedRects( HWND hwnd, int idAni, const RECT *lprcFrom, const RECT *lprcTo); typedef struct tagACCEL { BYTE fVirt; WORD key; WORD cmd; } ACCEL, *LPACCEL; typedef struct tagPAINTSTRUCT { HDC hdc; BOOL fErase; RECT rcPaint; BOOL fRestore; BOOL fIncUpdate; BYTE rgbReserved[32]; } PAINTSTRUCT, *PPAINTSTRUCT, *NPPAINTSTRUCT, *LPPAINTSTRUCT; typedef struct tagCREATESTRUCTA { LPVOID lpCreateParams; HINSTANCE hInstance; HMENU hMenu; HWND hwndParent; int cy; int cx; int y; int x; LONG style; LPCSTR lpszName; LPCSTR lpszClass; DWORD dwExStyle; } CREATESTRUCTA, *LPCREATESTRUCTA; typedef struct tagCREATESTRUCTW { LPVOID lpCreateParams; HINSTANCE hInstance; HMENU hMenu; HWND hwndParent; int cy; int cx; int y; int x; LONG style; LPCWSTR lpszName; LPCWSTR lpszClass; DWORD dwExStyle; } CREATESTRUCTW, *LPCREATESTRUCTW; typedef CREATESTRUCTW CREATESTRUCT; typedef LPCREATESTRUCTW LPCREATESTRUCT; typedef struct tagWINDOWPLACEMENT { UINT length; UINT flags; UINT showCmd; POINT ptMinPosition; POINT ptMaxPosition; RECT rcNormalPosition; } WINDOWPLACEMENT; typedef WINDOWPLACEMENT *PWINDOWPLACEMENT, *LPWINDOWPLACEMENT; typedef struct tagNMHDR { HWND hwndFrom; UINT_PTR idFrom; UINT code; } NMHDR; typedef NMHDR * LPNMHDR; typedef struct tagSTYLESTRUCT { DWORD styleOld; DWORD styleNew; } STYLESTRUCT, * LPSTYLESTRUCT; typedef struct tagMEASUREITEMSTRUCT { UINT CtlType; UINT CtlID; UINT itemID; UINT itemWidth; UINT itemHeight; ULONG_PTR itemData; } MEASUREITEMSTRUCT, *PMEASUREITEMSTRUCT, *LPMEASUREITEMSTRUCT; typedef struct tagDRAWITEMSTRUCT { UINT CtlType; UINT CtlID; UINT itemID; UINT itemAction; UINT itemState; HWND hwndItem; HDC hDC; RECT rcItem; ULONG_PTR itemData; } DRAWITEMSTRUCT, *PDRAWITEMSTRUCT, *LPDRAWITEMSTRUCT; typedef struct tagDELETEITEMSTRUCT { UINT CtlType; UINT CtlID; UINT itemID; HWND hwndItem; ULONG_PTR itemData; } DELETEITEMSTRUCT, *PDELETEITEMSTRUCT, *LPDELETEITEMSTRUCT; typedef struct tagCOMPAREITEMSTRUCT { UINT CtlType; UINT CtlID; HWND hwndItem; UINT itemID1; ULONG_PTR itemData1; UINT itemID2; ULONG_PTR itemData2; DWORD dwLocaleId; } COMPAREITEMSTRUCT, *PCOMPAREITEMSTRUCT, *LPCOMPAREITEMSTRUCT; __declspec(dllimport) BOOL __stdcall GetMessageA( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax); __declspec(dllimport) BOOL __stdcall GetMessageW( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax); __declspec(dllimport) BOOL __stdcall TranslateMessage( const MSG *lpMsg); __declspec(dllimport) LRESULT __stdcall DispatchMessageA( const MSG *lpMsg); __declspec(dllimport) LRESULT __stdcall DispatchMessageW( const MSG *lpMsg); __declspec(dllimport) BOOL __stdcall SetMessageQueue( int cMessagesMax); __declspec(dllimport) BOOL __stdcall PeekMessageA( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg); __declspec(dllimport) BOOL __stdcall PeekMessageW( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg); __declspec(dllimport) BOOL __stdcall RegisterHotKey( HWND hWnd, int id, UINT fsModifiers, UINT vk); __declspec(dllimport) BOOL __stdcall UnregisterHotKey( HWND hWnd, int id); __declspec(dllimport) BOOL __stdcall ExitWindowsEx( UINT uFlags, DWORD dwReason); __declspec(dllimport) BOOL __stdcall SwapMouseButton( BOOL fSwap); __declspec(dllimport) DWORD __stdcall GetMessagePos( void); __declspec(dllimport) LONG __stdcall GetMessageTime( void); __declspec(dllimport) LPARAM __stdcall GetMessageExtraInfo( void); __declspec(dllimport) DWORD __stdcall GetUnpredictedMessagePos( void); __declspec(dllimport) BOOL __stdcall IsWow64Message( void); __declspec(dllimport) LPARAM __stdcall SetMessageExtraInfo( LPARAM lParam); __declspec(dllimport) LRESULT __stdcall SendMessageA( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); __declspec(dllimport) LRESULT __stdcall SendMessageW( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); __declspec(dllimport) LRESULT __stdcall SendMessageTimeoutA( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, UINT fuFlags, UINT uTimeout, PDWORD_PTR lpdwResult); __declspec(dllimport) LRESULT __stdcall SendMessageTimeoutW( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, UINT fuFlags, UINT uTimeout, PDWORD_PTR lpdwResult); __declspec(dllimport) BOOL __stdcall SendNotifyMessageA( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); __declspec(dllimport) BOOL __stdcall SendNotifyMessageW( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); __declspec(dllimport) BOOL __stdcall SendMessageCallbackA( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, SENDASYNCPROC lpResultCallBack, ULONG_PTR dwData); __declspec(dllimport) BOOL __stdcall SendMessageCallbackW( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, SENDASYNCPROC lpResultCallBack, ULONG_PTR dwData); typedef struct { UINT cbSize; HDESK hdesk; HWND hwnd; LUID luid; } BSMINFO, *PBSMINFO; __declspec(dllimport) long __stdcall BroadcastSystemMessageExA( DWORD flags, LPDWORD lpInfo, UINT Msg, WPARAM wParam, LPARAM lParam, PBSMINFO pbsmInfo); __declspec(dllimport) long __stdcall BroadcastSystemMessageExW( DWORD flags, LPDWORD lpInfo, UINT Msg, WPARAM wParam, LPARAM lParam, PBSMINFO pbsmInfo); __declspec(dllimport) long __stdcall BroadcastSystemMessageA( DWORD flags, LPDWORD lpInfo, UINT Msg, WPARAM wParam, LPARAM lParam); __declspec(dllimport) long __stdcall BroadcastSystemMessageW( DWORD flags, LPDWORD lpInfo, UINT Msg, WPARAM wParam, LPARAM lParam); typedef PVOID HDEVNOTIFY; typedef HDEVNOTIFY *PHDEVNOTIFY; __declspec(dllimport) HDEVNOTIFY __stdcall RegisterDeviceNotificationA( HANDLE hRecipient, LPVOID NotificationFilter, DWORD Flags); __declspec(dllimport) HDEVNOTIFY __stdcall RegisterDeviceNotificationW( HANDLE hRecipient, LPVOID NotificationFilter, DWORD Flags); __declspec(dllimport) BOOL __stdcall UnregisterDeviceNotification( HDEVNOTIFY Handle ); typedef PVOID HPOWERNOTIFY; typedef HPOWERNOTIFY *PHPOWERNOTIFY; __declspec(dllimport) HPOWERNOTIFY __stdcall RegisterPowerSettingNotification( HANDLE hRecipient, LPCGUID PowerSettingGuid, DWORD Flags ); __declspec(dllimport) BOOL __stdcall UnregisterPowerSettingNotification( HPOWERNOTIFY Handle ); __declspec(dllimport) HPOWERNOTIFY __stdcall RegisterSuspendResumeNotification ( HANDLE hRecipient, DWORD Flags ); __declspec(dllimport) BOOL __stdcall UnregisterSuspendResumeNotification ( HPOWERNOTIFY Handle ); __declspec(dllimport) BOOL __stdcall PostMessageA( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); __declspec(dllimport) BOOL __stdcall PostMessageW( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); __declspec(dllimport) BOOL __stdcall PostThreadMessageA( DWORD idThread, UINT Msg, WPARAM wParam, LPARAM lParam); __declspec(dllimport) BOOL __stdcall PostThreadMessageW( DWORD idThread, UINT Msg, WPARAM wParam, LPARAM lParam); __declspec(dllimport) BOOL __stdcall AttachThreadInput( DWORD idAttach, DWORD idAttachTo, BOOL fAttach); __declspec(dllimport) BOOL __stdcall ReplyMessage( LRESULT lResult); __declspec(dllimport) BOOL __stdcall WaitMessage( void); __declspec(dllimport) DWORD __stdcall WaitForInputIdle( HANDLE hProcess, DWORD dwMilliseconds); __declspec(dllimport) LRESULT __stdcall DefWindowProcA( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); __declspec(dllimport) LRESULT __stdcall DefWindowProcW( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); __declspec(dllimport) void __stdcall PostQuitMessage( int nExitCode); __declspec(dllimport) LRESULT __stdcall CallWindowProcA( WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); __declspec(dllimport) LRESULT __stdcall CallWindowProcW( WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); __declspec(dllimport) BOOL __stdcall InSendMessage( void); __declspec(dllimport) DWORD __stdcall InSendMessageEx( LPVOID lpReserved); __declspec(dllimport) UINT __stdcall GetDoubleClickTime( void); __declspec(dllimport) BOOL __stdcall SetDoubleClickTime( UINT); __declspec(dllimport) ATOM __stdcall RegisterClassA( const WNDCLASSA *lpWndClass); __declspec(dllimport) ATOM __stdcall RegisterClassW( const WNDCLASSW *lpWndClass); __declspec(dllimport) BOOL __stdcall UnregisterClassA( LPCSTR lpClassName, HINSTANCE hInstance); __declspec(dllimport) BOOL __stdcall UnregisterClassW( LPCWSTR lpClassName, HINSTANCE hInstance); __declspec(dllimport) BOOL __stdcall GetClassInfoA( HINSTANCE hInstance, LPCSTR lpClassName, LPWNDCLASSA lpWndClass); __declspec(dllimport) BOOL __stdcall GetClassInfoW( HINSTANCE hInstance, LPCWSTR lpClassName, LPWNDCLASSW lpWndClass); __declspec(dllimport) ATOM __stdcall RegisterClassExA( const WNDCLASSEXA *); __declspec(dllimport) ATOM __stdcall RegisterClassExW( const WNDCLASSEXW *); __declspec(dllimport) BOOL __stdcall GetClassInfoExA( HINSTANCE hInstance, LPCSTR lpszClass, LPWNDCLASSEXA lpwcx); __declspec(dllimport) BOOL __stdcall GetClassInfoExW( HINSTANCE hInstance, LPCWSTR lpszClass, LPWNDCLASSEXW lpwcx); typedef BOOLEAN (__stdcall * PREGISTERCLASSNAMEW)(LPCWSTR); __declspec(dllimport) HWND __stdcall CreateWindowExA( DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam); __declspec(dllimport) HWND __stdcall CreateWindowExW( DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam); __declspec(dllimport) BOOL __stdcall IsWindow( HWND hWnd); __declspec(dllimport) BOOL __stdcall IsMenu( HMENU hMenu); __declspec(dllimport) BOOL __stdcall IsChild( HWND hWndParent, HWND hWnd); __declspec(dllimport) BOOL __stdcall DestroyWindow( HWND hWnd); __declspec(dllimport) BOOL __stdcall ShowWindow( HWND hWnd, int nCmdShow); __declspec(dllimport) BOOL __stdcall AnimateWindow( HWND hWnd, DWORD dwTime, DWORD dwFlags); __declspec(dllimport) BOOL __stdcall UpdateLayeredWindow( HWND hWnd, HDC hdcDst, POINT* pptDst, SIZE* psize, HDC hdcSrc, POINT* pptSrc, COLORREF crKey, BLENDFUNCTION* pblend, DWORD dwFlags); typedef struct tagUPDATELAYEREDWINDOWINFO { DWORD cbSize; HDC hdcDst; const POINT* pptDst; const SIZE* psize; HDC hdcSrc; const POINT* pptSrc; COLORREF crKey; const BLENDFUNCTION* pblend; DWORD dwFlags; const RECT* prcDirty; } UPDATELAYEREDWINDOWINFO, *PUPDATELAYEREDWINDOWINFO; __declspec(dllimport) BOOL __stdcall UpdateLayeredWindowIndirect( HWND hWnd, const UPDATELAYEREDWINDOWINFO* pULWInfo); __declspec(dllimport) BOOL __stdcall GetLayeredWindowAttributes( HWND hwnd, COLORREF* pcrKey, BYTE* pbAlpha, DWORD* pdwFlags); __declspec(dllimport) BOOL __stdcall PrintWindow( HWND hwnd, HDC hdcBlt, UINT nFlags); __declspec(dllimport) BOOL __stdcall SetLayeredWindowAttributes( HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags); __declspec(dllimport) BOOL __stdcall ShowWindowAsync( HWND hWnd, int nCmdShow); __declspec(dllimport) BOOL __stdcall FlashWindow( HWND hWnd, BOOL bInvert); typedef struct { UINT cbSize; HWND hwnd; DWORD dwFlags; UINT uCount; DWORD dwTimeout; } FLASHWINFO, *PFLASHWINFO; __declspec(dllimport) BOOL __stdcall FlashWindowEx( PFLASHWINFO pfwi); __declspec(dllimport) BOOL __stdcall ShowOwnedPopups( HWND hWnd, BOOL fShow); __declspec(dllimport) BOOL __stdcall OpenIcon( HWND hWnd); __declspec(dllimport) BOOL __stdcall CloseWindow( HWND hWnd); __declspec(dllimport) BOOL __stdcall MoveWindow( HWND hWnd, int X, int Y, int nWidth, int nHeight, BOOL bRepaint); __declspec(dllimport) BOOL __stdcall SetWindowPos( HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags); __declspec(dllimport) BOOL __stdcall GetWindowPlacement( HWND hWnd, WINDOWPLACEMENT *lpwndpl); __declspec(dllimport) BOOL __stdcall SetWindowPlacement( HWND hWnd, const WINDOWPLACEMENT *lpwndpl); __declspec(dllimport) BOOL __stdcall GetWindowDisplayAffinity( HWND hWnd, DWORD* pdwAffinity); __declspec(dllimport) BOOL __stdcall SetWindowDisplayAffinity( HWND hWnd, DWORD dwAffinity); __declspec(dllimport) HDWP __stdcall BeginDeferWindowPos( int nNumWindows); __declspec(dllimport) HDWP __stdcall DeferWindowPos( HDWP hWinPosInfo, HWND hWnd, HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT uFlags); __declspec(dllimport) BOOL __stdcall EndDeferWindowPos( HDWP hWinPosInfo); __declspec(dllimport) BOOL __stdcall IsWindowVisible( HWND hWnd); __declspec(dllimport) BOOL __stdcall IsIconic( HWND hWnd); __declspec(dllimport) BOOL __stdcall AnyPopup( void); __declspec(dllimport) BOOL __stdcall BringWindowToTop( HWND hWnd); __declspec(dllimport) BOOL __stdcall IsZoomed( HWND hWnd); #pragma warning(disable: 4103) #pragma pack(push,2) typedef struct { DWORD style; DWORD dwExtendedStyle; WORD cdit; short x; short y; short cx; short cy; } DLGTEMPLATE; typedef DLGTEMPLATE *LPDLGTEMPLATEA; typedef DLGTEMPLATE *LPDLGTEMPLATEW; typedef LPDLGTEMPLATEW LPDLGTEMPLATE; typedef const DLGTEMPLATE *LPCDLGTEMPLATEA; typedef const DLGTEMPLATE *LPCDLGTEMPLATEW; typedef LPCDLGTEMPLATEW LPCDLGTEMPLATE; typedef struct { DWORD style; DWORD dwExtendedStyle; short x; short y; short cx; short cy; WORD id; } DLGITEMTEMPLATE; typedef DLGITEMTEMPLATE *PDLGITEMTEMPLATEA; typedef DLGITEMTEMPLATE *PDLGITEMTEMPLATEW; typedef PDLGITEMTEMPLATEW PDLGITEMTEMPLATE; typedef DLGITEMTEMPLATE *LPDLGITEMTEMPLATEA; typedef DLGITEMTEMPLATE *LPDLGITEMTEMPLATEW; typedef LPDLGITEMTEMPLATEW LPDLGITEMTEMPLATE; #pragma warning(disable: 4103) #pragma pack(pop) __declspec(dllimport) HWND __stdcall CreateDialogParamA( HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam); __declspec(dllimport) HWND __stdcall CreateDialogParamW( HINSTANCE hInstance, LPCWSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam); __declspec(dllimport) HWND __stdcall CreateDialogIndirectParamA( HINSTANCE hInstance, LPCDLGTEMPLATEA lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam); __declspec(dllimport) HWND __stdcall CreateDialogIndirectParamW( HINSTANCE hInstance, LPCDLGTEMPLATEW lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam); __declspec(dllimport) INT_PTR __stdcall DialogBoxParamA( HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam); __declspec(dllimport) INT_PTR __stdcall DialogBoxParamW( HINSTANCE hInstance, LPCWSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam); __declspec(dllimport) INT_PTR __stdcall DialogBoxIndirectParamA( HINSTANCE hInstance, LPCDLGTEMPLATEA hDialogTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam); __declspec(dllimport) INT_PTR __stdcall DialogBoxIndirectParamW( HINSTANCE hInstance, LPCDLGTEMPLATEW hDialogTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam); __declspec(dllimport) BOOL __stdcall EndDialog( HWND hDlg, INT_PTR nResult); __declspec(dllimport) HWND __stdcall GetDlgItem( HWND hDlg, int nIDDlgItem); __declspec(dllimport) BOOL __stdcall SetDlgItemInt( HWND hDlg, int nIDDlgItem, UINT uValue, BOOL bSigned); __declspec(dllimport) UINT __stdcall GetDlgItemInt( HWND hDlg, int nIDDlgItem, BOOL *lpTranslated, BOOL bSigned); __declspec(dllimport) BOOL __stdcall SetDlgItemTextA( HWND hDlg, int nIDDlgItem, LPCSTR lpString); __declspec(dllimport) BOOL __stdcall SetDlgItemTextW( HWND hDlg, int nIDDlgItem, LPCWSTR lpString); __declspec(dllimport) UINT __stdcall GetDlgItemTextA( HWND hDlg, int nIDDlgItem, LPSTR lpString, int cchMax); __declspec(dllimport) UINT __stdcall GetDlgItemTextW( HWND hDlg, int nIDDlgItem, LPWSTR lpString, int cchMax); __declspec(dllimport) BOOL __stdcall CheckDlgButton( HWND hDlg, int nIDButton, UINT uCheck); __declspec(dllimport) BOOL __stdcall CheckRadioButton( HWND hDlg, int nIDFirstButton, int nIDLastButton, int nIDCheckButton); __declspec(dllimport) UINT __stdcall IsDlgButtonChecked( HWND hDlg, int nIDButton); __declspec(dllimport) LRESULT __stdcall SendDlgItemMessageA( HWND hDlg, int nIDDlgItem, UINT Msg, WPARAM wParam, LPARAM lParam); __declspec(dllimport) LRESULT __stdcall SendDlgItemMessageW( HWND hDlg, int nIDDlgItem, UINT Msg, WPARAM wParam, LPARAM lParam); __declspec(dllimport) HWND __stdcall GetNextDlgGroupItem( HWND hDlg, HWND hCtl, BOOL bPrevious); __declspec(dllimport) HWND __stdcall GetNextDlgTabItem( HWND hDlg, HWND hCtl, BOOL bPrevious); __declspec(dllimport) int __stdcall GetDlgCtrlID( HWND hWnd); __declspec(dllimport) long __stdcall GetDialogBaseUnits(void); __declspec(dllimport) LRESULT __stdcall DefDlgProcA( HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam); __declspec(dllimport) LRESULT __stdcall DefDlgProcW( HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam); typedef enum DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS { DCDC_DEFAULT = 0x0000, DCDC_DISABLE_FONT_UPDATE = 0x0001, DCDC_DISABLE_RELAYOUT = 0x0002, } DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS; extern "C++" { inline constexpr DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS operator | (DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS a, DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS b) throw() { return DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS(((_ENUM_FLAG_SIZED_INTEGER<DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS>::type)a) | ((_ENUM_FLAG_SIZED_INTEGER<DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS>::type)b)); } inline DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS &operator |= (DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS &a, DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS b) throw() { return (DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS &)(((_ENUM_FLAG_SIZED_INTEGER<DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS>::type &)a) |= ((_ENUM_FLAG_SIZED_INTEGER<DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS>::type)b)); } inline constexpr DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS operator & (DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS a, DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS b) throw() { return DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS(((_ENUM_FLAG_SIZED_INTEGER<DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS>::type)a) & ((_ENUM_FLAG_SIZED_INTEGER<DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS>::type)b)); } inline DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS &operator &= (DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS &a, DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS b) throw() { return (DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS &)(((_ENUM_FLAG_SIZED_INTEGER<DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS>::type &)a) &= ((_ENUM_FLAG_SIZED_INTEGER<DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS>::type)b)); } inline constexpr DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS operator ~ (DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS a) throw() { return DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS(~((_ENUM_FLAG_SIZED_INTEGER<DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS>::type)a)); } inline constexpr DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS operator ^ (DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS a, DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS b) throw() { return DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS(((_ENUM_FLAG_SIZED_INTEGER<DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS>::type)a) ^ ((_ENUM_FLAG_SIZED_INTEGER<DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS>::type)b)); } inline DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS &operator ^= (DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS &a, DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS b) throw() { return (DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS &)(((_ENUM_FLAG_SIZED_INTEGER<DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS>::type &)a) ^= ((_ENUM_FLAG_SIZED_INTEGER<DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS>::type)b)); } }; BOOL __stdcall SetDialogControlDpiChangeBehavior( HWND hWnd, DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS mask, DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS values); DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS __stdcall GetDialogControlDpiChangeBehavior( HWND hWnd); typedef enum DIALOG_DPI_CHANGE_BEHAVIORS { DDC_DEFAULT = 0x0000, DDC_DISABLE_ALL = 0x0001, DDC_DISABLE_RESIZE = 0x0002, DDC_DISABLE_CONTROL_RELAYOUT = 0x0004, } DIALOG_DPI_CHANGE_BEHAVIORS; extern "C++" { inline constexpr DIALOG_DPI_CHANGE_BEHAVIORS operator | (DIALOG_DPI_CHANGE_BEHAVIORS a, DIALOG_DPI_CHANGE_BEHAVIORS b) throw() { return DIALOG_DPI_CHANGE_BEHAVIORS(((_ENUM_FLAG_SIZED_INTEGER<DIALOG_DPI_CHANGE_BEHAVIORS>::type)a) | ((_ENUM_FLAG_SIZED_INTEGER<DIALOG_DPI_CHANGE_BEHAVIORS>::type)b)); } inline DIALOG_DPI_CHANGE_BEHAVIORS &operator |= (DIALOG_DPI_CHANGE_BEHAVIORS &a, DIALOG_DPI_CHANGE_BEHAVIORS b) throw() { return (DIALOG_DPI_CHANGE_BEHAVIORS &)(((_ENUM_FLAG_SIZED_INTEGER<DIALOG_DPI_CHANGE_BEHAVIORS>::type &)a) |= ((_ENUM_FLAG_SIZED_INTEGER<DIALOG_DPI_CHANGE_BEHAVIORS>::type)b)); } inline constexpr DIALOG_DPI_CHANGE_BEHAVIORS operator & (DIALOG_DPI_CHANGE_BEHAVIORS a, DIALOG_DPI_CHANGE_BEHAVIORS b) throw() { return DIALOG_DPI_CHANGE_BEHAVIORS(((_ENUM_FLAG_SIZED_INTEGER<DIALOG_DPI_CHANGE_BEHAVIORS>::type)a) & ((_ENUM_FLAG_SIZED_INTEGER<DIALOG_DPI_CHANGE_BEHAVIORS>::type)b)); } inline DIALOG_DPI_CHANGE_BEHAVIORS &operator &= (DIALOG_DPI_CHANGE_BEHAVIORS &a, DIALOG_DPI_CHANGE_BEHAVIORS b) throw() { return (DIALOG_DPI_CHANGE_BEHAVIORS &)(((_ENUM_FLAG_SIZED_INTEGER<DIALOG_DPI_CHANGE_BEHAVIORS>::type &)a) &= ((_ENUM_FLAG_SIZED_INTEGER<DIALOG_DPI_CHANGE_BEHAVIORS>::type)b)); } inline constexpr DIALOG_DPI_CHANGE_BEHAVIORS operator ~ (DIALOG_DPI_CHANGE_BEHAVIORS a) throw() { return DIALOG_DPI_CHANGE_BEHAVIORS(~((_ENUM_FLAG_SIZED_INTEGER<DIALOG_DPI_CHANGE_BEHAVIORS>::type)a)); } inline constexpr DIALOG_DPI_CHANGE_BEHAVIORS operator ^ (DIALOG_DPI_CHANGE_BEHAVIORS a, DIALOG_DPI_CHANGE_BEHAVIORS b) throw() { return DIALOG_DPI_CHANGE_BEHAVIORS(((_ENUM_FLAG_SIZED_INTEGER<DIALOG_DPI_CHANGE_BEHAVIORS>::type)a) ^ ((_ENUM_FLAG_SIZED_INTEGER<DIALOG_DPI_CHANGE_BEHAVIORS>::type)b)); } inline DIALOG_DPI_CHANGE_BEHAVIORS &operator ^= (DIALOG_DPI_CHANGE_BEHAVIORS &a, DIALOG_DPI_CHANGE_BEHAVIORS b) throw() { return (DIALOG_DPI_CHANGE_BEHAVIORS &)(((_ENUM_FLAG_SIZED_INTEGER<DIALOG_DPI_CHANGE_BEHAVIORS>::type &)a) ^= ((_ENUM_FLAG_SIZED_INTEGER<DIALOG_DPI_CHANGE_BEHAVIORS>::type)b)); } }; BOOL __stdcall SetDialogDpiChangeBehavior( HWND hDlg, DIALOG_DPI_CHANGE_BEHAVIORS mask, DIALOG_DPI_CHANGE_BEHAVIORS values); DIALOG_DPI_CHANGE_BEHAVIORS __stdcall GetDialogDpiChangeBehavior( HWND hDlg); __declspec(dllimport) BOOL __stdcall CallMsgFilterA( LPMSG lpMsg, int nCode); __declspec(dllimport) BOOL __stdcall CallMsgFilterW( LPMSG lpMsg, int nCode); __declspec(dllimport) BOOL __stdcall OpenClipboard( HWND hWndNewOwner); __declspec(dllimport) BOOL __stdcall CloseClipboard( void); __declspec(dllimport) DWORD __stdcall GetClipboardSequenceNumber( void); __declspec(dllimport) HWND __stdcall GetClipboardOwner( void); __declspec(dllimport) HWND __stdcall SetClipboardViewer( HWND hWndNewViewer); __declspec(dllimport) HWND __stdcall GetClipboardViewer( void); __declspec(dllimport) BOOL __stdcall ChangeClipboardChain( HWND hWndRemove, HWND hWndNewNext); __declspec(dllimport) HANDLE __stdcall SetClipboardData( UINT uFormat, HANDLE hMem); __declspec(dllimport) HANDLE __stdcall GetClipboardData( UINT uFormat); __declspec(dllimport) UINT __stdcall RegisterClipboardFormatA( LPCSTR lpszFormat); __declspec(dllimport) UINT __stdcall RegisterClipboardFormatW( LPCWSTR lpszFormat); __declspec(dllimport) int __stdcall CountClipboardFormats( void); __declspec(dllimport) UINT __stdcall EnumClipboardFormats( UINT format); __declspec(dllimport) int __stdcall GetClipboardFormatNameA( UINT format, LPSTR lpszFormatName, int cchMaxCount); __declspec(dllimport) int __stdcall GetClipboardFormatNameW( UINT format, LPWSTR lpszFormatName, int cchMaxCount); __declspec(dllimport) BOOL __stdcall EmptyClipboard( void); __declspec(dllimport) BOOL __stdcall IsClipboardFormatAvailable( UINT format); __declspec(dllimport) int __stdcall GetPriorityClipboardFormat( UINT *paFormatPriorityList, int cFormats); __declspec(dllimport) HWND __stdcall GetOpenClipboardWindow( void); __declspec(dllimport) BOOL __stdcall AddClipboardFormatListener( HWND hwnd); __declspec(dllimport) BOOL __stdcall RemoveClipboardFormatListener( HWND hwnd); __declspec(dllimport) BOOL __stdcall GetUpdatedClipboardFormats( PUINT lpuiFormats, UINT cFormats, PUINT pcFormatsOut); __declspec(dllimport) BOOL __stdcall CharToOemA( LPCSTR pSrc, LPSTR pDst); __declspec(dllimport) BOOL __stdcall CharToOemW( LPCWSTR pSrc, LPSTR pDst); __declspec(dllimport) BOOL __stdcall OemToCharA( LPCSTR pSrc, LPSTR pDst); __declspec(dllimport) BOOL __stdcall OemToCharW( LPCSTR pSrc, LPWSTR pDst); __declspec(dllimport) BOOL __stdcall CharToOemBuffA( LPCSTR lpszSrc, LPSTR lpszDst, DWORD cchDstLength); __declspec(dllimport) BOOL __stdcall CharToOemBuffW( LPCWSTR lpszSrc, LPSTR lpszDst, DWORD cchDstLength); __declspec(dllimport) BOOL __stdcall OemToCharBuffA( LPCSTR lpszSrc, LPSTR lpszDst, DWORD cchDstLength); __declspec(dllimport) BOOL __stdcall OemToCharBuffW( LPCSTR lpszSrc, LPWSTR lpszDst, DWORD cchDstLength); __declspec(dllimport) LPSTR __stdcall CharUpperA( LPSTR lpsz); __declspec(dllimport) LPWSTR __stdcall CharUpperW( LPWSTR lpsz); __declspec(dllimport) DWORD __stdcall CharUpperBuffA( LPSTR lpsz, DWORD cchLength); __declspec(dllimport) DWORD __stdcall CharUpperBuffW( LPWSTR lpsz, DWORD cchLength); __declspec(dllimport) LPSTR __stdcall CharLowerA( LPSTR lpsz); __declspec(dllimport) LPWSTR __stdcall CharLowerW( LPWSTR lpsz); __declspec(dllimport) DWORD __stdcall CharLowerBuffA( LPSTR lpsz, DWORD cchLength); __declspec(dllimport) DWORD __stdcall CharLowerBuffW( LPWSTR lpsz, DWORD cchLength); __declspec(dllimport) LPSTR __stdcall CharNextA( LPCSTR lpsz); __declspec(dllimport) LPWSTR __stdcall CharNextW( LPCWSTR lpsz); __declspec(dllimport) LPSTR __stdcall CharPrevA( LPCSTR lpszStart, LPCSTR lpszCurrent); __declspec(dllimport) LPWSTR __stdcall CharPrevW( LPCWSTR lpszStart, LPCWSTR lpszCurrent); __declspec(dllimport) LPSTR __stdcall CharNextExA( WORD CodePage, LPCSTR lpCurrentChar, DWORD dwFlags); __declspec(dllimport) LPSTR __stdcall CharPrevExA( WORD CodePage, LPCSTR lpStart, LPCSTR lpCurrentChar, DWORD dwFlags); __declspec(dllimport) BOOL __stdcall IsCharAlphaA( CHAR ch); __declspec(dllimport) BOOL __stdcall IsCharAlphaW( WCHAR ch); __declspec(dllimport) BOOL __stdcall IsCharAlphaNumericA( CHAR ch); __declspec(dllimport) BOOL __stdcall IsCharAlphaNumericW( WCHAR ch); __declspec(dllimport) BOOL __stdcall IsCharUpperA( CHAR ch); __declspec(dllimport) BOOL __stdcall IsCharUpperW( WCHAR ch); __declspec(dllimport) BOOL __stdcall IsCharLowerA( CHAR ch); __declspec(dllimport) BOOL __stdcall IsCharLowerW( WCHAR ch); __declspec(dllimport) HWND __stdcall SetFocus( HWND hWnd); __declspec(dllimport) HWND __stdcall GetActiveWindow( void); __declspec(dllimport) HWND __stdcall GetFocus( void); __declspec(dllimport) UINT __stdcall GetKBCodePage( void); __declspec(dllimport) SHORT __stdcall GetKeyState( int nVirtKey); __declspec(dllimport) SHORT __stdcall GetAsyncKeyState( int vKey); __declspec(dllimport) BOOL __stdcall GetKeyboardState( PBYTE lpKeyState); __declspec(dllimport) BOOL __stdcall SetKeyboardState( LPBYTE lpKeyState); __declspec(dllimport) int __stdcall GetKeyNameTextA( LONG lParam, LPSTR lpString, int cchSize); __declspec(dllimport) int __stdcall GetKeyNameTextW( LONG lParam, LPWSTR lpString, int cchSize); __declspec(dllimport) int __stdcall GetKeyboardType( int nTypeFlag); __declspec(dllimport) int __stdcall ToAscii( UINT uVirtKey, UINT uScanCode, const BYTE *lpKeyState, LPWORD lpChar, UINT uFlags); __declspec(dllimport) int __stdcall ToAsciiEx( UINT uVirtKey, UINT uScanCode, const BYTE *lpKeyState, LPWORD lpChar, UINT uFlags, HKL dwhkl); __declspec(dllimport) int __stdcall ToUnicode( UINT wVirtKey, UINT wScanCode, const BYTE *lpKeyState, LPWSTR pwszBuff, int cchBuff, UINT wFlags); __declspec(dllimport) DWORD __stdcall OemKeyScan( WORD wOemChar); __declspec(dllimport) SHORT __stdcall VkKeyScanA( CHAR ch); __declspec(dllimport) SHORT __stdcall VkKeyScanW( WCHAR ch); __declspec(dllimport) SHORT __stdcall VkKeyScanExA( CHAR ch, HKL dwhkl); __declspec(dllimport) SHORT __stdcall VkKeyScanExW( WCHAR ch, HKL dwhkl); __declspec(dllimport) void __stdcall keybd_event( BYTE bVk, BYTE bScan, DWORD dwFlags, ULONG_PTR dwExtraInfo); __declspec(dllimport) void __stdcall mouse_event( DWORD dwFlags, DWORD dx, DWORD dy, DWORD dwData, ULONG_PTR dwExtraInfo); typedef struct tagMOUSEINPUT { LONG dx; LONG dy; DWORD mouseData; DWORD dwFlags; DWORD time; ULONG_PTR dwExtraInfo; } MOUSEINPUT, *PMOUSEINPUT, * LPMOUSEINPUT; typedef struct tagKEYBDINPUT { WORD wVk; WORD wScan; DWORD dwFlags; DWORD time; ULONG_PTR dwExtraInfo; } KEYBDINPUT, *PKEYBDINPUT, * LPKEYBDINPUT; typedef struct tagHARDWAREINPUT { DWORD uMsg; WORD wParamL; WORD wParamH; } HARDWAREINPUT, *PHARDWAREINPUT, * LPHARDWAREINPUT; typedef struct tagINPUT { DWORD type; union { MOUSEINPUT mi; KEYBDINPUT ki; HARDWAREINPUT hi; } ; } INPUT, *PINPUT, * LPINPUT; __declspec(dllimport) UINT __stdcall SendInput( UINT cInputs, LPINPUT pInputs, int cbSize); struct HTOUCHINPUT__{int unused;}; typedef struct HTOUCHINPUT__ *HTOUCHINPUT; typedef struct tagTOUCHINPUT { LONG x; LONG y; HANDLE hSource; DWORD dwID; DWORD dwFlags; DWORD dwMask; DWORD dwTime; ULONG_PTR dwExtraInfo; DWORD cxContact; DWORD cyContact; } TOUCHINPUT, *PTOUCHINPUT; typedef TOUCHINPUT const * PCTOUCHINPUT; __declspec(dllimport) BOOL __stdcall GetTouchInputInfo( HTOUCHINPUT hTouchInput, UINT cInputs, PTOUCHINPUT pInputs, int cbSize); __declspec(dllimport) BOOL __stdcall CloseTouchInputHandle( HTOUCHINPUT hTouchInput); __declspec(dllimport) BOOL __stdcall RegisterTouchWindow( HWND hwnd, ULONG ulFlags); __declspec(dllimport) BOOL __stdcall UnregisterTouchWindow( HWND hwnd); __declspec(dllimport) BOOL __stdcall IsTouchWindow( HWND hwnd, PULONG pulFlags); enum tagPOINTER_INPUT_TYPE { PT_POINTER = 1, PT_TOUCH = 2, PT_PEN = 3, PT_MOUSE = 4, PT_TOUCHPAD = 5, }; typedef DWORD POINTER_INPUT_TYPE; typedef UINT32 POINTER_FLAGS; typedef enum tagPOINTER_BUTTON_CHANGE_TYPE { POINTER_CHANGE_NONE, POINTER_CHANGE_FIRSTBUTTON_DOWN, POINTER_CHANGE_FIRSTBUTTON_UP, POINTER_CHANGE_SECONDBUTTON_DOWN, POINTER_CHANGE_SECONDBUTTON_UP, POINTER_CHANGE_THIRDBUTTON_DOWN, POINTER_CHANGE_THIRDBUTTON_UP, POINTER_CHANGE_FOURTHBUTTON_DOWN, POINTER_CHANGE_FOURTHBUTTON_UP, POINTER_CHANGE_FIFTHBUTTON_DOWN, POINTER_CHANGE_FIFTHBUTTON_UP, } POINTER_BUTTON_CHANGE_TYPE; typedef struct tagPOINTER_INFO { POINTER_INPUT_TYPE pointerType; UINT32 pointerId; UINT32 frameId; POINTER_FLAGS pointerFlags; HANDLE sourceDevice; HWND hwndTarget; POINT ptPixelLocation; POINT ptHimetricLocation; POINT ptPixelLocationRaw; POINT ptHimetricLocationRaw; DWORD dwTime; UINT32 historyCount; INT32 InputData; DWORD dwKeyStates; UINT64 PerformanceCount; POINTER_BUTTON_CHANGE_TYPE ButtonChangeType; } POINTER_INFO; typedef UINT32 TOUCH_FLAGS; typedef UINT32 TOUCH_MASK; typedef struct tagPOINTER_TOUCH_INFO { POINTER_INFO pointerInfo; TOUCH_FLAGS touchFlags; TOUCH_MASK touchMask; RECT rcContact; RECT rcContactRaw; UINT32 orientation; UINT32 pressure; } POINTER_TOUCH_INFO; typedef UINT32 PEN_FLAGS; typedef UINT32 PEN_MASK; typedef struct tagPOINTER_PEN_INFO { POINTER_INFO pointerInfo; PEN_FLAGS penFlags; PEN_MASK penMask; UINT32 pressure; UINT32 rotation; INT32 tiltX; INT32 tiltY; } POINTER_PEN_INFO; typedef enum { POINTER_FEEDBACK_DEFAULT = 1, POINTER_FEEDBACK_INDIRECT = 2, POINTER_FEEDBACK_NONE = 3, } POINTER_FEEDBACK_MODE; __declspec(dllimport) BOOL __stdcall InitializeTouchInjection( UINT32 maxCount, DWORD dwMode); __declspec(dllimport) BOOL __stdcall InjectTouchInput( UINT32 count, const POINTER_TOUCH_INFO *contacts); typedef struct tagUSAGE_PROPERTIES { USHORT level; USHORT page; USHORT usage; INT32 logicalMinimum; INT32 logicalMaximum; USHORT unit; USHORT exponent; BYTE count; INT32 physicalMinimum; INT32 physicalMaximum; }USAGE_PROPERTIES, *PUSAGE_PROPERTIES; typedef struct tagPOINTER_TYPE_INFO { POINTER_INPUT_TYPE type; union{ POINTER_TOUCH_INFO touchInfo; POINTER_PEN_INFO penInfo; } ; }POINTER_TYPE_INFO, *PPOINTER_TYPE_INFO; typedef struct tagINPUT_INJECTION_VALUE { USHORT page; USHORT usage; INT32 value; USHORT index; }INPUT_INJECTION_VALUE, *PINPUT_INJECTION_VALUE; __declspec(dllimport) BOOL __stdcall GetPointerType( UINT32 pointerId, POINTER_INPUT_TYPE *pointerType); __declspec(dllimport) BOOL __stdcall GetPointerCursorId( UINT32 pointerId, UINT32 *cursorId); __declspec(dllimport) BOOL __stdcall GetPointerInfo( UINT32 pointerId, POINTER_INFO *pointerInfo); __declspec(dllimport) BOOL __stdcall GetPointerInfoHistory( UINT32 pointerId, UINT32 *entriesCount, POINTER_INFO *pointerInfo); __declspec(dllimport) BOOL __stdcall GetPointerFrameInfo( UINT32 pointerId, UINT32 *pointerCount, POINTER_INFO *pointerInfo); __declspec(dllimport) BOOL __stdcall GetPointerFrameInfoHistory( UINT32 pointerId, UINT32 *entriesCount, UINT32 *pointerCount, POINTER_INFO *pointerInfo); __declspec(dllimport) BOOL __stdcall GetPointerTouchInfo( UINT32 pointerId, POINTER_TOUCH_INFO *touchInfo); __declspec(dllimport) BOOL __stdcall GetPointerTouchInfoHistory( UINT32 pointerId, UINT32 *entriesCount, POINTER_TOUCH_INFO *touchInfo); __declspec(dllimport) BOOL __stdcall GetPointerFrameTouchInfo( UINT32 pointerId, UINT32 *pointerCount, POINTER_TOUCH_INFO *touchInfo); __declspec(dllimport) BOOL __stdcall GetPointerFrameTouchInfoHistory( UINT32 pointerId, UINT32 *entriesCount, UINT32 *pointerCount, POINTER_TOUCH_INFO *touchInfo); __declspec(dllimport) BOOL __stdcall GetPointerPenInfo( UINT32 pointerId, POINTER_PEN_INFO *penInfo); __declspec(dllimport) BOOL __stdcall GetPointerPenInfoHistory( UINT32 pointerId, UINT32 *entriesCount, POINTER_PEN_INFO *penInfo); __declspec(dllimport) BOOL __stdcall GetPointerFramePenInfo( UINT32 pointerId, UINT32 *pointerCount, POINTER_PEN_INFO *penInfo); __declspec(dllimport) BOOL __stdcall GetPointerFramePenInfoHistory( UINT32 pointerId, UINT32 *entriesCount, UINT32 *pointerCount, POINTER_PEN_INFO *penInfo); __declspec(dllimport) BOOL __stdcall SkipPointerFrameMessages( UINT32 pointerId); __declspec(dllimport) BOOL __stdcall RegisterPointerInputTarget( HWND hwnd, POINTER_INPUT_TYPE pointerType); __declspec(dllimport) BOOL __stdcall UnregisterPointerInputTarget( HWND hwnd, POINTER_INPUT_TYPE pointerType); __declspec(dllimport) BOOL __stdcall RegisterPointerInputTargetEx( HWND hwnd, POINTER_INPUT_TYPE pointerType, BOOL fObserve); __declspec(dllimport) BOOL __stdcall UnregisterPointerInputTargetEx( HWND hwnd, POINTER_INPUT_TYPE pointerType); __declspec(dllimport) BOOL __stdcall EnableMouseInPointer( BOOL fEnable); __declspec(dllimport) BOOL __stdcall IsMouseInPointerEnabled( void); __declspec(dllimport) BOOL __stdcall EnableMouseInPointerForThread(); __declspec(dllimport) BOOL __stdcall RegisterTouchHitTestingWindow( HWND hwnd, ULONG value); typedef struct tagTOUCH_HIT_TESTING_PROXIMITY_EVALUATION { UINT16 score; POINT adjustedPoint; } TOUCH_HIT_TESTING_PROXIMITY_EVALUATION, *PTOUCH_HIT_TESTING_PROXIMITY_EVALUATION; typedef struct tagTOUCH_HIT_TESTING_INPUT { UINT32 pointerId; POINT point; RECT boundingBox; RECT nonOccludedBoundingBox; UINT32 orientation; } TOUCH_HIT_TESTING_INPUT, *PTOUCH_HIT_TESTING_INPUT; __declspec(dllimport) BOOL __stdcall EvaluateProximityToRect( const RECT *controlBoundingBox, const TOUCH_HIT_TESTING_INPUT *pHitTestingInput, TOUCH_HIT_TESTING_PROXIMITY_EVALUATION *pProximityEval); __declspec(dllimport) BOOL __stdcall EvaluateProximityToPolygon( UINT32 numVertices, const POINT *controlPolygon, const TOUCH_HIT_TESTING_INPUT *pHitTestingInput, TOUCH_HIT_TESTING_PROXIMITY_EVALUATION *pProximityEval); __declspec(dllimport) LRESULT __stdcall PackTouchHitTestingProximityEvaluation( const TOUCH_HIT_TESTING_INPUT *pHitTestingInput, const TOUCH_HIT_TESTING_PROXIMITY_EVALUATION *pProximityEval); typedef enum tagFEEDBACK_TYPE { FEEDBACK_TOUCH_CONTACTVISUALIZATION = 1, FEEDBACK_PEN_BARRELVISUALIZATION = 2, FEEDBACK_PEN_TAP = 3, FEEDBACK_PEN_DOUBLETAP = 4, FEEDBACK_PEN_PRESSANDHOLD = 5, FEEDBACK_PEN_RIGHTTAP = 6, FEEDBACK_TOUCH_TAP = 7, FEEDBACK_TOUCH_DOUBLETAP = 8, FEEDBACK_TOUCH_PRESSANDHOLD = 9, FEEDBACK_TOUCH_RIGHTTAP = 10, FEEDBACK_GESTURE_PRESSANDTAP = 11, FEEDBACK_MAX = 0xFFFFFFFF } FEEDBACK_TYPE; __declspec(dllimport) BOOL __stdcall GetWindowFeedbackSetting( HWND hwnd, FEEDBACK_TYPE feedback, DWORD dwFlags, UINT32* pSize, void* config); __declspec(dllimport) BOOL __stdcall SetWindowFeedbackSetting( HWND hwnd, FEEDBACK_TYPE feedback, DWORD dwFlags, UINT32 size, const void* configuration); #pragma warning(push) #pragma warning(disable: 4201) typedef struct tagINPUT_TRANSFORM { union { struct { float _11, _12, _13, _14; float _21, _22, _23, _24; float _31, _32, _33, _34; float _41, _42, _43, _44; } ; float m[4][4]; } ; } INPUT_TRANSFORM; #pragma warning(pop) __declspec(dllimport) BOOL __stdcall GetPointerInputTransform( UINT32 pointerId, UINT32 historyCount, INPUT_TRANSFORM *inputTransform); typedef struct tagLASTINPUTINFO { UINT cbSize; DWORD dwTime; } LASTINPUTINFO, * PLASTINPUTINFO; __declspec(dllimport) BOOL __stdcall GetLastInputInfo( PLASTINPUTINFO plii); __declspec(dllimport) UINT __stdcall MapVirtualKeyA( UINT uCode, UINT uMapType); __declspec(dllimport) UINT __stdcall MapVirtualKeyW( UINT uCode, UINT uMapType); __declspec(dllimport) UINT __stdcall MapVirtualKeyExA( UINT uCode, UINT uMapType, HKL dwhkl); __declspec(dllimport) UINT __stdcall MapVirtualKeyExW( UINT uCode, UINT uMapType, HKL dwhkl); __declspec(dllimport) BOOL __stdcall GetInputState( void); __declspec(dllimport) DWORD __stdcall GetQueueStatus( UINT flags); __declspec(dllimport) HWND __stdcall GetCapture( void); __declspec(dllimport) HWND __stdcall SetCapture( HWND hWnd); __declspec(dllimport) BOOL __stdcall ReleaseCapture( void); __declspec(dllimport) DWORD __stdcall MsgWaitForMultipleObjects( DWORD nCount, const HANDLE *pHandles, BOOL fWaitAll, DWORD dwMilliseconds, DWORD dwWakeMask); __declspec(dllimport) DWORD __stdcall MsgWaitForMultipleObjectsEx( DWORD nCount, const HANDLE *pHandles, DWORD dwMilliseconds, DWORD dwWakeMask, DWORD dwFlags); __declspec(dllimport) UINT_PTR __stdcall SetTimer( HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc); __declspec(dllimport) UINT_PTR __stdcall SetCoalescableTimer( HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc, ULONG uToleranceDelay); __declspec(dllimport) BOOL __stdcall KillTimer( HWND hWnd, UINT_PTR uIDEvent); __declspec(dllimport) BOOL __stdcall IsWindowUnicode( HWND hWnd); __declspec(dllimport) BOOL __stdcall EnableWindow( HWND hWnd, BOOL bEnable); __declspec(dllimport) BOOL __stdcall IsWindowEnabled( HWND hWnd); __declspec(dllimport) HACCEL __stdcall LoadAcceleratorsA( HINSTANCE hInstance, LPCSTR lpTableName); __declspec(dllimport) HACCEL __stdcall LoadAcceleratorsW( HINSTANCE hInstance, LPCWSTR lpTableName); __declspec(dllimport) HACCEL __stdcall CreateAcceleratorTableA( LPACCEL paccel, int cAccel); __declspec(dllimport) HACCEL __stdcall CreateAcceleratorTableW( LPACCEL paccel, int cAccel); __declspec(dllimport) BOOL __stdcall DestroyAcceleratorTable( HACCEL hAccel); __declspec(dllimport) int __stdcall CopyAcceleratorTableA( HACCEL hAccelSrc, LPACCEL lpAccelDst, int cAccelEntries); __declspec(dllimport) int __stdcall CopyAcceleratorTableW( HACCEL hAccelSrc, LPACCEL lpAccelDst, int cAccelEntries); __declspec(dllimport) int __stdcall TranslateAcceleratorA( HWND hWnd, HACCEL hAccTable, LPMSG lpMsg); __declspec(dllimport) int __stdcall TranslateAcceleratorW( HWND hWnd, HACCEL hAccTable, LPMSG lpMsg); __declspec(dllimport) int __stdcall GetSystemMetrics( int nIndex); __declspec(dllimport) int __stdcall GetSystemMetricsForDpi( int nIndex, UINT dpi); __declspec(dllimport) HMENU __stdcall LoadMenuA( HINSTANCE hInstance, LPCSTR lpMenuName); __declspec(dllimport) HMENU __stdcall LoadMenuW( HINSTANCE hInstance, LPCWSTR lpMenuName); __declspec(dllimport) HMENU __stdcall LoadMenuIndirectA( const MENUTEMPLATEA *lpMenuTemplate); __declspec(dllimport) HMENU __stdcall LoadMenuIndirectW( const MENUTEMPLATEW *lpMenuTemplate); __declspec(dllimport) HMENU __stdcall GetMenu( HWND hWnd); __declspec(dllimport) BOOL __stdcall SetMenu( HWND hWnd, HMENU hMenu); __declspec(dllimport) BOOL __stdcall ChangeMenuA( HMENU hMenu, UINT cmd, LPCSTR lpszNewItem, UINT cmdInsert, UINT flags); __declspec(dllimport) BOOL __stdcall ChangeMenuW( HMENU hMenu, UINT cmd, LPCWSTR lpszNewItem, UINT cmdInsert, UINT flags); __declspec(dllimport) BOOL __stdcall HiliteMenuItem( HWND hWnd, HMENU hMenu, UINT uIDHiliteItem, UINT uHilite); __declspec(dllimport) int __stdcall GetMenuStringA( HMENU hMenu, UINT uIDItem, LPSTR lpString, int cchMax, UINT flags); __declspec(dllimport) int __stdcall GetMenuStringW( HMENU hMenu, UINT uIDItem, LPWSTR lpString, int cchMax, UINT flags); __declspec(dllimport) UINT __stdcall GetMenuState( HMENU hMenu, UINT uId, UINT uFlags); __declspec(dllimport) BOOL __stdcall DrawMenuBar( HWND hWnd); __declspec(dllimport) HMENU __stdcall GetSystemMenu( HWND hWnd, BOOL bRevert); __declspec(dllimport) HMENU __stdcall CreateMenu( void); __declspec(dllimport) HMENU __stdcall CreatePopupMenu( void); __declspec(dllimport) BOOL __stdcall DestroyMenu( HMENU hMenu); __declspec(dllimport) DWORD __stdcall CheckMenuItem( HMENU hMenu, UINT uIDCheckItem, UINT uCheck); __declspec(dllimport) BOOL __stdcall EnableMenuItem( HMENU hMenu, UINT uIDEnableItem, UINT uEnable); __declspec(dllimport) HMENU __stdcall GetSubMenu( HMENU hMenu, int nPos); __declspec(dllimport) UINT __stdcall GetMenuItemID( HMENU hMenu, int nPos); __declspec(dllimport) int __stdcall GetMenuItemCount( HMENU hMenu); __declspec(dllimport) BOOL __stdcall InsertMenuA( HMENU hMenu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCSTR lpNewItem); __declspec(dllimport) BOOL __stdcall InsertMenuW( HMENU hMenu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem); __declspec(dllimport) BOOL __stdcall AppendMenuA( HMENU hMenu, UINT uFlags, UINT_PTR uIDNewItem, LPCSTR lpNewItem); __declspec(dllimport) BOOL __stdcall AppendMenuW( HMENU hMenu, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem); __declspec(dllimport) BOOL __stdcall ModifyMenuA( HMENU hMnu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCSTR lpNewItem); __declspec(dllimport) BOOL __stdcall ModifyMenuW( HMENU hMnu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem); __declspec(dllimport) BOOL __stdcall RemoveMenu( HMENU hMenu, UINT uPosition, UINT uFlags); __declspec(dllimport) BOOL __stdcall DeleteMenu( HMENU hMenu, UINT uPosition, UINT uFlags); __declspec(dllimport) BOOL __stdcall SetMenuItemBitmaps( HMENU hMenu, UINT uPosition, UINT uFlags, HBITMAP hBitmapUnchecked, HBITMAP hBitmapChecked); __declspec(dllimport) LONG __stdcall GetMenuCheckMarkDimensions( void); __declspec(dllimport) BOOL __stdcall TrackPopupMenu( HMENU hMenu, UINT uFlags, int x, int y, int nReserved, HWND hWnd, const RECT *prcRect); typedef struct tagTPMPARAMS { UINT cbSize; RECT rcExclude; } TPMPARAMS; typedef TPMPARAMS *LPTPMPARAMS; __declspec(dllimport) BOOL __stdcall TrackPopupMenuEx( HMENU hMenu, UINT uFlags, int x, int y, HWND hwnd, LPTPMPARAMS lptpm); __declspec(dllimport) BOOL __stdcall CalculatePopupWindowPosition( const POINT *anchorPoint, const SIZE *windowSize, UINT flags, RECT *excludeRect, RECT *popupWindowPosition); typedef struct tagMENUINFO { DWORD cbSize; DWORD fMask; DWORD dwStyle; UINT cyMax; HBRUSH hbrBack; DWORD dwContextHelpID; ULONG_PTR dwMenuData; } MENUINFO, *LPMENUINFO; typedef MENUINFO const *LPCMENUINFO; __declspec(dllimport) BOOL __stdcall GetMenuInfo( HMENU, LPMENUINFO); __declspec(dllimport) BOOL __stdcall SetMenuInfo( HMENU, LPCMENUINFO); __declspec(dllimport) BOOL __stdcall EndMenu( void); typedef struct tagMENUGETOBJECTINFO { DWORD dwFlags; UINT uPos; HMENU hmenu; PVOID riid; PVOID pvObj; } MENUGETOBJECTINFO, * PMENUGETOBJECTINFO; typedef struct tagMENUITEMINFOA { UINT cbSize; UINT fMask; UINT fType; UINT fState; UINT wID; HMENU hSubMenu; HBITMAP hbmpChecked; HBITMAP hbmpUnchecked; ULONG_PTR dwItemData; LPSTR dwTypeData; UINT cch; HBITMAP hbmpItem; } MENUITEMINFOA, *LPMENUITEMINFOA; typedef struct tagMENUITEMINFOW { UINT cbSize; UINT fMask; UINT fType; UINT fState; UINT wID; HMENU hSubMenu; HBITMAP hbmpChecked; HBITMAP hbmpUnchecked; ULONG_PTR dwItemData; LPWSTR dwTypeData; UINT cch; HBITMAP hbmpItem; } MENUITEMINFOW, *LPMENUITEMINFOW; typedef MENUITEMINFOW MENUITEMINFO; typedef LPMENUITEMINFOW LPMENUITEMINFO; typedef MENUITEMINFOA const *LPCMENUITEMINFOA; typedef MENUITEMINFOW const *LPCMENUITEMINFOW; typedef LPCMENUITEMINFOW LPCMENUITEMINFO; __declspec(dllimport) BOOL __stdcall InsertMenuItemA( HMENU hmenu, UINT item, BOOL fByPosition, LPCMENUITEMINFOA lpmi); __declspec(dllimport) BOOL __stdcall InsertMenuItemW( HMENU hmenu, UINT item, BOOL fByPosition, LPCMENUITEMINFOW lpmi); __declspec(dllimport) BOOL __stdcall GetMenuItemInfoA( HMENU hmenu, UINT item, BOOL fByPosition, LPMENUITEMINFOA lpmii); __declspec(dllimport) BOOL __stdcall GetMenuItemInfoW( HMENU hmenu, UINT item, BOOL fByPosition, LPMENUITEMINFOW lpmii); __declspec(dllimport) BOOL __stdcall SetMenuItemInfoA( HMENU hmenu, UINT item, BOOL fByPositon, LPCMENUITEMINFOA lpmii); __declspec(dllimport) BOOL __stdcall SetMenuItemInfoW( HMENU hmenu, UINT item, BOOL fByPositon, LPCMENUITEMINFOW lpmii); __declspec(dllimport) UINT __stdcall GetMenuDefaultItem( HMENU hMenu, UINT fByPos, UINT gmdiFlags); __declspec(dllimport) BOOL __stdcall SetMenuDefaultItem( HMENU hMenu, UINT uItem, UINT fByPos); __declspec(dllimport) BOOL __stdcall GetMenuItemRect( HWND hWnd, HMENU hMenu, UINT uItem, LPRECT lprcItem); __declspec(dllimport) int __stdcall MenuItemFromPoint( HWND hWnd, HMENU hMenu, POINT ptScreen); typedef struct tagDROPSTRUCT { HWND hwndSource; HWND hwndSink; DWORD wFmt; ULONG_PTR dwData; POINT ptDrop; DWORD dwControlData; } DROPSTRUCT, *PDROPSTRUCT, *LPDROPSTRUCT; __declspec(dllimport) DWORD __stdcall DragObject( HWND hwndParent, HWND hwndFrom, UINT fmt, ULONG_PTR data, HCURSOR hcur); __declspec(dllimport) BOOL __stdcall DragDetect( HWND hwnd, POINT pt); __declspec(dllimport) BOOL __stdcall DrawIcon( HDC hDC, int X, int Y, HICON hIcon); typedef struct tagDRAWTEXTPARAMS { UINT cbSize; int iTabLength; int iLeftMargin; int iRightMargin; UINT uiLengthDrawn; } DRAWTEXTPARAMS, *LPDRAWTEXTPARAMS; __declspec(dllimport) int __stdcall DrawTextA( HDC hdc, LPCSTR lpchText, int cchText, LPRECT lprc, UINT format); __declspec(dllimport) int __stdcall DrawTextW( HDC hdc, LPCWSTR lpchText, int cchText, LPRECT lprc, UINT format); __declspec(dllimport) int __stdcall DrawTextExA( HDC hdc, LPSTR lpchText, int cchText, LPRECT lprc, UINT format, LPDRAWTEXTPARAMS lpdtp); __declspec(dllimport) int __stdcall DrawTextExW( HDC hdc, LPWSTR lpchText, int cchText, LPRECT lprc, UINT format, LPDRAWTEXTPARAMS lpdtp); __declspec(dllimport) BOOL __stdcall GrayStringA( HDC hDC, HBRUSH hBrush, GRAYSTRINGPROC lpOutputFunc, LPARAM lpData, int nCount, int X, int Y, int nWidth, int nHeight); __declspec(dllimport) BOOL __stdcall GrayStringW( HDC hDC, HBRUSH hBrush, GRAYSTRINGPROC lpOutputFunc, LPARAM lpData, int nCount, int X, int Y, int nWidth, int nHeight); __declspec(dllimport) BOOL __stdcall DrawStateA( HDC hdc, HBRUSH hbrFore, DRAWSTATEPROC qfnCallBack, LPARAM lData, WPARAM wData, int x, int y, int cx, int cy, UINT uFlags); __declspec(dllimport) BOOL __stdcall DrawStateW( HDC hdc, HBRUSH hbrFore, DRAWSTATEPROC qfnCallBack, LPARAM lData, WPARAM wData, int x, int y, int cx, int cy, UINT uFlags); __declspec(dllimport) LONG __stdcall TabbedTextOutA( HDC hdc, int x, int y, LPCSTR lpString, int chCount, int nTabPositions, const INT *lpnTabStopPositions, int nTabOrigin); __declspec(dllimport) LONG __stdcall TabbedTextOutW( HDC hdc, int x, int y, LPCWSTR lpString, int chCount, int nTabPositions, const INT *lpnTabStopPositions, int nTabOrigin); __declspec(dllimport) DWORD __stdcall GetTabbedTextExtentA( HDC hdc, LPCSTR lpString, int chCount, int nTabPositions, const INT *lpnTabStopPositions); __declspec(dllimport) DWORD __stdcall GetTabbedTextExtentW( HDC hdc, LPCWSTR lpString, int chCount, int nTabPositions, const INT *lpnTabStopPositions); __declspec(dllimport) BOOL __stdcall UpdateWindow( HWND hWnd); __declspec(dllimport) HWND __stdcall SetActiveWindow( HWND hWnd); __declspec(dllimport) HWND __stdcall GetForegroundWindow( void); __declspec(dllimport) BOOL __stdcall PaintDesktop( HDC hdc); __declspec(dllimport) void __stdcall SwitchToThisWindow( HWND hwnd, BOOL fUnknown); __declspec(dllimport) BOOL __stdcall SetForegroundWindow( HWND hWnd); __declspec(dllimport) BOOL __stdcall AllowSetForegroundWindow( DWORD dwProcessId); __declspec(dllimport) BOOL __stdcall LockSetForegroundWindow( UINT uLockCode); __declspec(dllimport) HWND __stdcall WindowFromDC( HDC hDC); __declspec(dllimport) HDC __stdcall GetDC( HWND hWnd); __declspec(dllimport) HDC __stdcall GetDCEx( HWND hWnd, HRGN hrgnClip, DWORD flags); __declspec(dllimport) HDC __stdcall GetWindowDC( HWND hWnd); __declspec(dllimport) int __stdcall ReleaseDC( HWND hWnd, HDC hDC); __declspec(dllimport) HDC __stdcall BeginPaint( HWND hWnd, LPPAINTSTRUCT lpPaint); __declspec(dllimport) BOOL __stdcall EndPaint( HWND hWnd, const PAINTSTRUCT *lpPaint); __declspec(dllimport) BOOL __stdcall GetUpdateRect( HWND hWnd, LPRECT lpRect, BOOL bErase); __declspec(dllimport) int __stdcall GetUpdateRgn( HWND hWnd, HRGN hRgn, BOOL bErase); __declspec(dllimport) int __stdcall SetWindowRgn( HWND hWnd, HRGN hRgn, BOOL bRedraw); __declspec(dllimport) int __stdcall GetWindowRgn( HWND hWnd, HRGN hRgn); __declspec(dllimport) int __stdcall GetWindowRgnBox( HWND hWnd, LPRECT lprc); __declspec(dllimport) int __stdcall ExcludeUpdateRgn( HDC hDC, HWND hWnd); __declspec(dllimport) BOOL __stdcall InvalidateRect( HWND hWnd, const RECT *lpRect, BOOL bErase); __declspec(dllimport) BOOL __stdcall ValidateRect( HWND hWnd, const RECT *lpRect); __declspec(dllimport) BOOL __stdcall InvalidateRgn( HWND hWnd, HRGN hRgn, BOOL bErase); __declspec(dllimport) BOOL __stdcall ValidateRgn( HWND hWnd, HRGN hRgn); __declspec(dllimport) BOOL __stdcall RedrawWindow( HWND hWnd, const RECT *lprcUpdate, HRGN hrgnUpdate, UINT flags); __declspec(dllimport) BOOL __stdcall LockWindowUpdate( HWND hWndLock); __declspec(dllimport) BOOL __stdcall ScrollWindow( HWND hWnd, int XAmount, int YAmount, const RECT *lpRect, const RECT *lpClipRect); __declspec(dllimport) BOOL __stdcall ScrollDC( HDC hDC, int dx, int dy, const RECT *lprcScroll, const RECT *lprcClip, HRGN hrgnUpdate, LPRECT lprcUpdate); __declspec(dllimport) int __stdcall ScrollWindowEx( HWND hWnd, int dx, int dy, const RECT *prcScroll, const RECT *prcClip, HRGN hrgnUpdate, LPRECT prcUpdate, UINT flags); __declspec(dllimport) int __stdcall SetScrollPos( HWND hWnd, int nBar, int nPos, BOOL bRedraw); __declspec(dllimport) int __stdcall GetScrollPos( HWND hWnd, int nBar); __declspec(dllimport) BOOL __stdcall SetScrollRange( HWND hWnd, int nBar, int nMinPos, int nMaxPos, BOOL bRedraw); __declspec(dllimport) BOOL __stdcall GetScrollRange( HWND hWnd, int nBar, LPINT lpMinPos, LPINT lpMaxPos); __declspec(dllimport) BOOL __stdcall ShowScrollBar( HWND hWnd, int wBar, BOOL bShow); __declspec(dllimport) BOOL __stdcall EnableScrollBar( HWND hWnd, UINT wSBflags, UINT wArrows); __declspec(dllimport) BOOL __stdcall SetPropA( HWND hWnd, LPCSTR lpString, HANDLE hData); __declspec(dllimport) BOOL __stdcall SetPropW( HWND hWnd, LPCWSTR lpString, HANDLE hData); __declspec(dllimport) HANDLE __stdcall GetPropA( HWND hWnd, LPCSTR lpString); __declspec(dllimport) HANDLE __stdcall GetPropW( HWND hWnd, LPCWSTR lpString); __declspec(dllimport) HANDLE __stdcall RemovePropA( HWND hWnd, LPCSTR lpString); __declspec(dllimport) HANDLE __stdcall RemovePropW( HWND hWnd, LPCWSTR lpString); __declspec(dllimport) int __stdcall EnumPropsExA( HWND hWnd, PROPENUMPROCEXA lpEnumFunc, LPARAM lParam); __declspec(dllimport) int __stdcall EnumPropsExW( HWND hWnd, PROPENUMPROCEXW lpEnumFunc, LPARAM lParam); __declspec(dllimport) int __stdcall EnumPropsA( HWND hWnd, PROPENUMPROCA lpEnumFunc); __declspec(dllimport) int __stdcall EnumPropsW( HWND hWnd, PROPENUMPROCW lpEnumFunc); __declspec(dllimport) BOOL __stdcall SetWindowTextA( HWND hWnd, LPCSTR lpString); __declspec(dllimport) BOOL __stdcall SetWindowTextW( HWND hWnd, LPCWSTR lpString); __declspec(dllimport) int __stdcall GetWindowTextA( HWND hWnd, LPSTR lpString, int nMaxCount); __declspec(dllimport) int __stdcall GetWindowTextW( HWND hWnd, LPWSTR lpString, int nMaxCount); __declspec(dllimport) int __stdcall GetWindowTextLengthA( HWND hWnd); __declspec(dllimport) int __stdcall GetWindowTextLengthW( HWND hWnd); __declspec(dllimport) BOOL __stdcall GetClientRect( HWND hWnd, LPRECT lpRect); __declspec(dllimport) BOOL __stdcall GetWindowRect( HWND hWnd, LPRECT lpRect); __declspec(dllimport) BOOL __stdcall AdjustWindowRect( LPRECT lpRect, DWORD dwStyle, BOOL bMenu); __declspec(dllimport) BOOL __stdcall AdjustWindowRectEx( LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle); __declspec(dllimport) BOOL __stdcall AdjustWindowRectExForDpi( LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle, UINT dpi); typedef struct tagHELPINFO { UINT cbSize; int iContextType; int iCtrlId; HANDLE hItemHandle; DWORD_PTR dwContextId; POINT MousePos; } HELPINFO, *LPHELPINFO; __declspec(dllimport) BOOL __stdcall SetWindowContextHelpId( HWND, DWORD); __declspec(dllimport) DWORD __stdcall GetWindowContextHelpId( HWND); __declspec(dllimport) BOOL __stdcall SetMenuContextHelpId( HMENU, DWORD); __declspec(dllimport) DWORD __stdcall GetMenuContextHelpId( HMENU); __declspec(dllimport) int __stdcall MessageBoxA( HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType); __declspec(dllimport) int __stdcall MessageBoxW( HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType); __declspec(dllimport) int __stdcall MessageBoxExA( HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType, WORD wLanguageId); __declspec(dllimport) int __stdcall MessageBoxExW( HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType, WORD wLanguageId); typedef void (__stdcall *MSGBOXCALLBACK)(LPHELPINFO lpHelpInfo); typedef struct tagMSGBOXPARAMSA { UINT cbSize; HWND hwndOwner; HINSTANCE hInstance; LPCSTR lpszText; LPCSTR lpszCaption; DWORD dwStyle; LPCSTR lpszIcon; DWORD_PTR dwContextHelpId; MSGBOXCALLBACK lpfnMsgBoxCallback; DWORD dwLanguageId; } MSGBOXPARAMSA, *PMSGBOXPARAMSA, *LPMSGBOXPARAMSA; typedef struct tagMSGBOXPARAMSW { UINT cbSize; HWND hwndOwner; HINSTANCE hInstance; LPCWSTR lpszText; LPCWSTR lpszCaption; DWORD dwStyle; LPCWSTR lpszIcon; DWORD_PTR dwContextHelpId; MSGBOXCALLBACK lpfnMsgBoxCallback; DWORD dwLanguageId; } MSGBOXPARAMSW, *PMSGBOXPARAMSW, *LPMSGBOXPARAMSW; typedef MSGBOXPARAMSW MSGBOXPARAMS; typedef PMSGBOXPARAMSW PMSGBOXPARAMS; typedef LPMSGBOXPARAMSW LPMSGBOXPARAMS; __declspec(dllimport) int __stdcall MessageBoxIndirectA( const MSGBOXPARAMSA * lpmbp); __declspec(dllimport) int __stdcall MessageBoxIndirectW( const MSGBOXPARAMSW * lpmbp); __declspec(dllimport) BOOL __stdcall MessageBeep( UINT uType); __declspec(dllimport) int __stdcall ShowCursor( BOOL bShow); __declspec(dllimport) BOOL __stdcall SetCursorPos( int X, int Y); __declspec(dllimport) BOOL __stdcall SetPhysicalCursorPos( int X, int Y); __declspec(dllimport) HCURSOR __stdcall SetCursor( HCURSOR hCursor); __declspec(dllimport) BOOL __stdcall GetCursorPos( LPPOINT lpPoint); __declspec(dllimport) BOOL __stdcall GetPhysicalCursorPos( LPPOINT lpPoint); __declspec(dllimport) BOOL __stdcall GetClipCursor( LPRECT lpRect); __declspec(dllimport) HCURSOR __stdcall GetCursor( void); __declspec(dllimport) BOOL __stdcall CreateCaret( HWND hWnd, HBITMAP hBitmap, int nWidth, int nHeight); __declspec(dllimport) UINT __stdcall GetCaretBlinkTime( void); __declspec(dllimport) BOOL __stdcall SetCaretBlinkTime( UINT uMSeconds); __declspec(dllimport) BOOL __stdcall DestroyCaret( void); __declspec(dllimport) BOOL __stdcall HideCaret( HWND hWnd); __declspec(dllimport) BOOL __stdcall ShowCaret( HWND hWnd); __declspec(dllimport) BOOL __stdcall SetCaretPos( int X, int Y); __declspec(dllimport) BOOL __stdcall GetCaretPos( LPPOINT lpPoint); __declspec(dllimport) BOOL __stdcall ClientToScreen( HWND hWnd, LPPOINT lpPoint); __declspec(dllimport) BOOL __stdcall ScreenToClient( HWND hWnd, LPPOINT lpPoint); __declspec(dllimport) BOOL __stdcall LogicalToPhysicalPoint( HWND hWnd, LPPOINT lpPoint); __declspec(dllimport) BOOL __stdcall PhysicalToLogicalPoint( HWND hWnd, LPPOINT lpPoint); __declspec(dllimport) BOOL __stdcall LogicalToPhysicalPointForPerMonitorDPI( HWND hWnd, LPPOINT lpPoint); __declspec(dllimport) BOOL __stdcall PhysicalToLogicalPointForPerMonitorDPI( HWND hWnd, LPPOINT lpPoint); __declspec(dllimport) int __stdcall MapWindowPoints( HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT cPoints); __declspec(dllimport) HWND __stdcall WindowFromPoint( POINT Point); __declspec(dllimport) HWND __stdcall WindowFromPhysicalPoint( POINT Point); __declspec(dllimport) HWND __stdcall ChildWindowFromPoint( HWND hWndParent, POINT Point); __declspec(dllimport) BOOL __stdcall ClipCursor( const RECT *lpRect); __declspec(dllimport) HWND __stdcall ChildWindowFromPointEx( HWND hwnd, POINT pt, UINT flags); __declspec(dllimport) DWORD __stdcall GetSysColor( int nIndex); __declspec(dllimport) HBRUSH __stdcall GetSysColorBrush( int nIndex); __declspec(dllimport) BOOL __stdcall SetSysColors( int cElements, const INT * lpaElements, const COLORREF * lpaRgbValues); __declspec(dllimport) BOOL __stdcall DrawFocusRect( HDC hDC, const RECT * lprc); __declspec(dllimport) int __stdcall FillRect( HDC hDC, const RECT *lprc, HBRUSH hbr); __declspec(dllimport) int __stdcall FrameRect( HDC hDC, const RECT *lprc, HBRUSH hbr); __declspec(dllimport) BOOL __stdcall InvertRect( HDC hDC, const RECT *lprc); __declspec(dllimport) BOOL __stdcall SetRect( LPRECT lprc, int xLeft, int yTop, int xRight, int yBottom); __declspec(dllimport) BOOL __stdcall SetRectEmpty( LPRECT lprc); __declspec(dllimport) BOOL __stdcall CopyRect( LPRECT lprcDst, const RECT *lprcSrc); __declspec(dllimport) BOOL __stdcall InflateRect( LPRECT lprc, int dx, int dy); __declspec(dllimport) BOOL __stdcall IntersectRect( LPRECT lprcDst, const RECT *lprcSrc1, const RECT *lprcSrc2); __declspec(dllimport) BOOL __stdcall UnionRect( LPRECT lprcDst, const RECT *lprcSrc1, const RECT *lprcSrc2); __declspec(dllimport) BOOL __stdcall SubtractRect( LPRECT lprcDst, const RECT *lprcSrc1, const RECT *lprcSrc2); __declspec(dllimport) BOOL __stdcall OffsetRect( LPRECT lprc, int dx, int dy); __declspec(dllimport) BOOL __stdcall IsRectEmpty( const RECT *lprc); __declspec(dllimport) BOOL __stdcall EqualRect( const RECT *lprc1, const RECT *lprc2); __declspec(dllimport) BOOL __stdcall PtInRect( const RECT *lprc, POINT pt); __declspec(dllimport) WORD __stdcall GetWindowWord( HWND hWnd, int nIndex); __declspec(dllimport) WORD __stdcall SetWindowWord( HWND hWnd, int nIndex, WORD wNewWord); __declspec(dllimport) LONG __stdcall GetWindowLongA( HWND hWnd, int nIndex); __declspec(dllimport) LONG __stdcall GetWindowLongW( HWND hWnd, int nIndex); __declspec(dllimport) LONG __stdcall SetWindowLongA( HWND hWnd, int nIndex, LONG dwNewLong); __declspec(dllimport) LONG __stdcall SetWindowLongW( HWND hWnd, int nIndex, LONG dwNewLong); __declspec(dllimport) LONG_PTR __stdcall GetWindowLongPtrA( HWND hWnd, int nIndex); __declspec(dllimport) LONG_PTR __stdcall GetWindowLongPtrW( HWND hWnd, int nIndex); __declspec(dllimport) LONG_PTR __stdcall SetWindowLongPtrA( HWND hWnd, int nIndex, LONG_PTR dwNewLong); __declspec(dllimport) LONG_PTR __stdcall SetWindowLongPtrW( HWND hWnd, int nIndex, LONG_PTR dwNewLong); __declspec(dllimport) WORD __stdcall GetClassWord( HWND hWnd, int nIndex); __declspec(dllimport) WORD __stdcall SetClassWord( HWND hWnd, int nIndex, WORD wNewWord); __declspec(dllimport) DWORD __stdcall GetClassLongA( HWND hWnd, int nIndex); __declspec(dllimport) DWORD __stdcall GetClassLongW( HWND hWnd, int nIndex); __declspec(dllimport) DWORD __stdcall SetClassLongA( HWND hWnd, int nIndex, LONG dwNewLong); __declspec(dllimport) DWORD __stdcall SetClassLongW( HWND hWnd, int nIndex, LONG dwNewLong); __declspec(dllimport) ULONG_PTR __stdcall GetClassLongPtrA( HWND hWnd, int nIndex); __declspec(dllimport) ULONG_PTR __stdcall GetClassLongPtrW( HWND hWnd, int nIndex); __declspec(dllimport) ULONG_PTR __stdcall SetClassLongPtrA( HWND hWnd, int nIndex, LONG_PTR dwNewLong); __declspec(dllimport) ULONG_PTR __stdcall SetClassLongPtrW( HWND hWnd, int nIndex, LONG_PTR dwNewLong); __declspec(dllimport) BOOL __stdcall GetProcessDefaultLayout( DWORD *pdwDefaultLayout); __declspec(dllimport) BOOL __stdcall SetProcessDefaultLayout( DWORD dwDefaultLayout); __declspec(dllimport) HWND __stdcall GetDesktopWindow( void); __declspec(dllimport) HWND __stdcall GetParent( HWND hWnd); __declspec(dllimport) HWND __stdcall SetParent( HWND hWndChild, HWND hWndNewParent); __declspec(dllimport) BOOL __stdcall EnumChildWindows( HWND hWndParent, WNDENUMPROC lpEnumFunc, LPARAM lParam); __declspec(dllimport) HWND __stdcall FindWindowA( LPCSTR lpClassName, LPCSTR lpWindowName); __declspec(dllimport) HWND __stdcall FindWindowW( LPCWSTR lpClassName, LPCWSTR lpWindowName); __declspec(dllimport) HWND __stdcall FindWindowExA( HWND hWndParent, HWND hWndChildAfter, LPCSTR lpszClass, LPCSTR lpszWindow); __declspec(dllimport) HWND __stdcall FindWindowExW( HWND hWndParent, HWND hWndChildAfter, LPCWSTR lpszClass, LPCWSTR lpszWindow); __declspec(dllimport) HWND __stdcall GetShellWindow( void); __declspec(dllimport) BOOL __stdcall RegisterShellHookWindow( HWND hwnd); __declspec(dllimport) BOOL __stdcall DeregisterShellHookWindow( HWND hwnd); __declspec(dllimport) BOOL __stdcall EnumWindows( WNDENUMPROC lpEnumFunc, LPARAM lParam); __declspec(dllimport) BOOL __stdcall EnumThreadWindows( DWORD dwThreadId, WNDENUMPROC lpfn, LPARAM lParam); __declspec(dllimport) int __stdcall GetClassNameA( HWND hWnd, LPSTR lpClassName, int nMaxCount ); __declspec(dllimport) int __stdcall GetClassNameW( HWND hWnd, LPWSTR lpClassName, int nMaxCount ); __declspec(dllimport) HWND __stdcall GetTopWindow( HWND hWnd); __declspec(dllimport) DWORD __stdcall GetWindowThreadProcessId( HWND hWnd, LPDWORD lpdwProcessId); __declspec(dllimport) BOOL __stdcall IsGUIThread( BOOL bConvert); __declspec(dllimport) HWND __stdcall GetLastActivePopup( HWND hWnd); __declspec(dllimport) HWND __stdcall GetWindow( HWND hWnd, UINT uCmd); __declspec(dllimport) HHOOK __stdcall SetWindowsHookA( int nFilterType, HOOKPROC pfnFilterProc); __declspec(dllimport) HHOOK __stdcall SetWindowsHookW( int nFilterType, HOOKPROC pfnFilterProc); __declspec(dllimport) BOOL __stdcall UnhookWindowsHook( int nCode, HOOKPROC pfnFilterProc); __declspec(dllimport) HHOOK __stdcall SetWindowsHookExA( int idHook, HOOKPROC lpfn, HINSTANCE hmod, DWORD dwThreadId); __declspec(dllimport) HHOOK __stdcall SetWindowsHookExW( int idHook, HOOKPROC lpfn, HINSTANCE hmod, DWORD dwThreadId); __declspec(dllimport) BOOL __stdcall UnhookWindowsHookEx( HHOOK hhk); __declspec(dllimport) LRESULT __stdcall CallNextHookEx( HHOOK hhk, int nCode, WPARAM wParam, LPARAM lParam); __declspec(dllimport) BOOL __stdcall CheckMenuRadioItem( HMENU hmenu, UINT first, UINT last, UINT check, UINT flags); typedef struct { WORD versionNumber; WORD offset; } MENUITEMTEMPLATEHEADER, *PMENUITEMTEMPLATEHEADER; typedef struct { WORD mtOption; WORD mtID; WCHAR mtString[1]; } MENUITEMTEMPLATE, *PMENUITEMTEMPLATE; __declspec(dllimport) HBITMAP __stdcall LoadBitmapA( HINSTANCE hInstance, LPCSTR lpBitmapName); __declspec(dllimport) HBITMAP __stdcall LoadBitmapW( HINSTANCE hInstance, LPCWSTR lpBitmapName); __declspec(dllimport) HCURSOR __stdcall LoadCursorA( HINSTANCE hInstance, LPCSTR lpCursorName); __declspec(dllimport) HCURSOR __stdcall LoadCursorW( HINSTANCE hInstance, LPCWSTR lpCursorName); __declspec(dllimport) HCURSOR __stdcall LoadCursorFromFileA( LPCSTR lpFileName); __declspec(dllimport) HCURSOR __stdcall LoadCursorFromFileW( LPCWSTR lpFileName); __declspec(dllimport) HCURSOR __stdcall CreateCursor( HINSTANCE hInst, int xHotSpot, int yHotSpot, int nWidth, int nHeight, const void *pvANDPlane, const void *pvXORPlane); __declspec(dllimport) BOOL __stdcall DestroyCursor( HCURSOR hCursor); __declspec(dllimport) BOOL __stdcall SetSystemCursor( HCURSOR hcur, DWORD id); typedef struct _ICONINFO { BOOL fIcon; DWORD xHotspot; DWORD yHotspot; HBITMAP hbmMask; HBITMAP hbmColor; } ICONINFO; typedef ICONINFO *PICONINFO; __declspec(dllimport) HICON __stdcall LoadIconA( HINSTANCE hInstance, LPCSTR lpIconName); __declspec(dllimport) HICON __stdcall LoadIconW( HINSTANCE hInstance, LPCWSTR lpIconName); __declspec(dllimport) UINT __stdcall PrivateExtractIconsA( LPCSTR szFileName, int nIconIndex, int cxIcon, int cyIcon, HICON *phicon, UINT *piconid, UINT nIcons, UINT flags); __declspec(dllimport) UINT __stdcall PrivateExtractIconsW( LPCWSTR szFileName, int nIconIndex, int cxIcon, int cyIcon, HICON *phicon, UINT *piconid, UINT nIcons, UINT flags); __declspec(dllimport) HICON __stdcall CreateIcon( HINSTANCE hInstance, int nWidth, int nHeight, BYTE cPlanes, BYTE cBitsPixel, const BYTE *lpbANDbits, const BYTE *lpbXORbits); __declspec(dllimport) BOOL __stdcall DestroyIcon( HICON hIcon); __declspec(dllimport) int __stdcall LookupIconIdFromDirectory( PBYTE presbits, BOOL fIcon); __declspec(dllimport) int __stdcall LookupIconIdFromDirectoryEx( PBYTE presbits, BOOL fIcon, int cxDesired, int cyDesired, UINT Flags); __declspec(dllimport) HICON __stdcall CreateIconFromResource( PBYTE presbits, DWORD dwResSize, BOOL fIcon, DWORD dwVer); __declspec(dllimport) HICON __stdcall CreateIconFromResourceEx( PBYTE presbits, DWORD dwResSize, BOOL fIcon, DWORD dwVer, int cxDesired, int cyDesired, UINT Flags); typedef struct tagCURSORSHAPE { int xHotSpot; int yHotSpot; int cx; int cy; int cbWidth; BYTE Planes; BYTE BitsPixel; } CURSORSHAPE, *LPCURSORSHAPE; __declspec(dllimport) HANDLE __stdcall LoadImageA( HINSTANCE hInst, LPCSTR name, UINT type, int cx, int cy, UINT fuLoad); __declspec(dllimport) HANDLE __stdcall LoadImageW( HINSTANCE hInst, LPCWSTR name, UINT type, int cx, int cy, UINT fuLoad); __declspec(dllimport) HANDLE __stdcall CopyImage( HANDLE h, UINT type, int cx, int cy, UINT flags); __declspec(dllimport) BOOL __stdcall DrawIconEx( HDC hdc, int xLeft, int yTop, HICON hIcon, int cxWidth, int cyWidth, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags); __declspec(dllimport) HICON __stdcall CreateIconIndirect( PICONINFO piconinfo); __declspec(dllimport) HICON __stdcall CopyIcon( HICON hIcon); __declspec(dllimport) BOOL __stdcall GetIconInfo( HICON hIcon, PICONINFO piconinfo); typedef struct _ICONINFOEXA { DWORD cbSize; BOOL fIcon; DWORD xHotspot; DWORD yHotspot; HBITMAP hbmMask; HBITMAP hbmColor; WORD wResID; CHAR szModName[260]; CHAR szResName[260]; } ICONINFOEXA, *PICONINFOEXA; typedef struct _ICONINFOEXW { DWORD cbSize; BOOL fIcon; DWORD xHotspot; DWORD yHotspot; HBITMAP hbmMask; HBITMAP hbmColor; WORD wResID; WCHAR szModName[260]; WCHAR szResName[260]; } ICONINFOEXW, *PICONINFOEXW; typedef ICONINFOEXW ICONINFOEX; typedef PICONINFOEXW PICONINFOEX; __declspec(dllimport) BOOL __stdcall GetIconInfoExA( HICON hicon, PICONINFOEXA piconinfo); __declspec(dllimport) BOOL __stdcall GetIconInfoExW( HICON hicon, PICONINFOEXW piconinfo); typedef enum { EDIT_CONTROL_FEATURE_ENTERPRISE_DATA_PROTECTION_PASTE_SUPPORT = 0, EDIT_CONTROL_FEATURE_PASTE_NOTIFICATIONS = 1, } EDIT_CONTROL_FEATURE; __declspec(dllimport) BOOL __stdcall IsDialogMessageA( HWND hDlg, LPMSG lpMsg); __declspec(dllimport) BOOL __stdcall IsDialogMessageW( HWND hDlg, LPMSG lpMsg); __declspec(dllimport) BOOL __stdcall MapDialogRect( HWND hDlg, LPRECT lpRect); __declspec(dllimport) int __stdcall DlgDirListA( HWND hDlg, LPSTR lpPathSpec, int nIDListBox, int nIDStaticPath, UINT uFileType); __declspec(dllimport) int __stdcall DlgDirListW( HWND hDlg, LPWSTR lpPathSpec, int nIDListBox, int nIDStaticPath, UINT uFileType); __declspec(dllimport) BOOL __stdcall DlgDirSelectExA( HWND hwndDlg, LPSTR lpString, int chCount, int idListBox); __declspec(dllimport) BOOL __stdcall DlgDirSelectExW( HWND hwndDlg, LPWSTR lpString, int chCount, int idListBox); __declspec(dllimport) int __stdcall DlgDirListComboBoxA( HWND hDlg, LPSTR lpPathSpec, int nIDComboBox, int nIDStaticPath, UINT uFiletype); __declspec(dllimport) int __stdcall DlgDirListComboBoxW( HWND hDlg, LPWSTR lpPathSpec, int nIDComboBox, int nIDStaticPath, UINT uFiletype); __declspec(dllimport) BOOL __stdcall DlgDirSelectComboBoxExA( HWND hwndDlg, LPSTR lpString, int cchOut, int idComboBox); __declspec(dllimport) BOOL __stdcall DlgDirSelectComboBoxExW( HWND hwndDlg, LPWSTR lpString, int cchOut, int idComboBox); typedef struct tagSCROLLINFO { UINT cbSize; UINT fMask; int nMin; int nMax; UINT nPage; int nPos; int nTrackPos; } SCROLLINFO, *LPSCROLLINFO; typedef SCROLLINFO const *LPCSCROLLINFO; __declspec(dllimport) int __stdcall SetScrollInfo( HWND hwnd, int nBar, LPCSCROLLINFO lpsi, BOOL redraw); __declspec(dllimport) BOOL __stdcall GetScrollInfo( HWND hwnd, int nBar, LPSCROLLINFO lpsi); typedef struct tagMDICREATESTRUCTA { LPCSTR szClass; LPCSTR szTitle; HANDLE hOwner; int x; int y; int cx; int cy; DWORD style; LPARAM lParam; } MDICREATESTRUCTA, *LPMDICREATESTRUCTA; typedef struct tagMDICREATESTRUCTW { LPCWSTR szClass; LPCWSTR szTitle; HANDLE hOwner; int x; int y; int cx; int cy; DWORD style; LPARAM lParam; } MDICREATESTRUCTW, *LPMDICREATESTRUCTW; typedef MDICREATESTRUCTW MDICREATESTRUCT; typedef LPMDICREATESTRUCTW LPMDICREATESTRUCT; typedef struct tagCLIENTCREATESTRUCT { HANDLE hWindowMenu; UINT idFirstChild; } CLIENTCREATESTRUCT, *LPCLIENTCREATESTRUCT; __declspec(dllimport) LRESULT __stdcall DefFrameProcA( HWND hWnd, HWND hWndMDIClient, UINT uMsg, WPARAM wParam, LPARAM lParam); __declspec(dllimport) LRESULT __stdcall DefFrameProcW( HWND hWnd, HWND hWndMDIClient, UINT uMsg, WPARAM wParam, LPARAM lParam); __declspec(dllimport) LRESULT __stdcall DefMDIChildProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); __declspec(dllimport) LRESULT __stdcall DefMDIChildProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); __declspec(dllimport) BOOL __stdcall TranslateMDISysAccel( HWND hWndClient, LPMSG lpMsg); __declspec(dllimport) UINT __stdcall ArrangeIconicWindows( HWND hWnd); __declspec(dllimport) HWND __stdcall CreateMDIWindowA( LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HINSTANCE hInstance, LPARAM lParam); __declspec(dllimport) HWND __stdcall CreateMDIWindowW( LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HINSTANCE hInstance, LPARAM lParam); __declspec(dllimport) WORD __stdcall TileWindows( HWND hwndParent, UINT wHow, const RECT * lpRect, UINT cKids, const HWND * lpKids); __declspec(dllimport) WORD __stdcall CascadeWindows( HWND hwndParent, UINT wHow, const RECT * lpRect, UINT cKids, const HWND * lpKids); typedef DWORD HELPPOLY; typedef struct tagMULTIKEYHELPA { DWORD mkSize; CHAR mkKeylist; CHAR szKeyphrase[1]; } MULTIKEYHELPA, *PMULTIKEYHELPA, *LPMULTIKEYHELPA; typedef struct tagMULTIKEYHELPW { DWORD mkSize; WCHAR mkKeylist; WCHAR szKeyphrase[1]; } MULTIKEYHELPW, *PMULTIKEYHELPW, *LPMULTIKEYHELPW; typedef MULTIKEYHELPW MULTIKEYHELP; typedef PMULTIKEYHELPW PMULTIKEYHELP; typedef LPMULTIKEYHELPW LPMULTIKEYHELP; typedef struct tagHELPWININFOA { int wStructSize; int x; int y; int dx; int dy; int wMax; CHAR rgchMember[2]; } HELPWININFOA, *PHELPWININFOA, *LPHELPWININFOA; typedef struct tagHELPWININFOW { int wStructSize; int x; int y; int dx; int dy; int wMax; WCHAR rgchMember[2]; } HELPWININFOW, *PHELPWININFOW, *LPHELPWININFOW; typedef HELPWININFOW HELPWININFO; typedef PHELPWININFOW PHELPWININFO; typedef LPHELPWININFOW LPHELPWININFO; __declspec(dllimport) BOOL __stdcall WinHelpA( HWND hWndMain, LPCSTR lpszHelp, UINT uCommand, ULONG_PTR dwData); __declspec(dllimport) BOOL __stdcall WinHelpW( HWND hWndMain, LPCWSTR lpszHelp, UINT uCommand, ULONG_PTR dwData); __declspec(dllimport) DWORD __stdcall GetGuiResources( HANDLE hProcess, DWORD uiFlags); typedef struct tagTouchPredictionParameters { UINT cbSize; UINT dwLatency; UINT dwSampleTime; UINT bUseHWTimeStamp; } TOUCHPREDICTIONPARAMETERS, *PTOUCHPREDICTIONPARAMETERS; typedef struct tagNONCLIENTMETRICSA { UINT cbSize; int iBorderWidth; int iScrollWidth; int iScrollHeight; int iCaptionWidth; int iCaptionHeight; LOGFONTA lfCaptionFont; int iSmCaptionWidth; int iSmCaptionHeight; LOGFONTA lfSmCaptionFont; int iMenuWidth; int iMenuHeight; LOGFONTA lfMenuFont; LOGFONTA lfStatusFont; LOGFONTA lfMessageFont; int iPaddedBorderWidth; } NONCLIENTMETRICSA, *PNONCLIENTMETRICSA, * LPNONCLIENTMETRICSA; typedef struct tagNONCLIENTMETRICSW { UINT cbSize; int iBorderWidth; int iScrollWidth; int iScrollHeight; int iCaptionWidth; int iCaptionHeight; LOGFONTW lfCaptionFont; int iSmCaptionWidth; int iSmCaptionHeight; LOGFONTW lfSmCaptionFont; int iMenuWidth; int iMenuHeight; LOGFONTW lfMenuFont; LOGFONTW lfStatusFont; LOGFONTW lfMessageFont; int iPaddedBorderWidth; } NONCLIENTMETRICSW, *PNONCLIENTMETRICSW, * LPNONCLIENTMETRICSW; typedef NONCLIENTMETRICSW NONCLIENTMETRICS; typedef PNONCLIENTMETRICSW PNONCLIENTMETRICS; typedef LPNONCLIENTMETRICSW LPNONCLIENTMETRICS; typedef struct tagMINIMIZEDMETRICS { UINT cbSize; int iWidth; int iHorzGap; int iVertGap; int iArrange; } MINIMIZEDMETRICS, *PMINIMIZEDMETRICS, *LPMINIMIZEDMETRICS; typedef struct tagICONMETRICSA { UINT cbSize; int iHorzSpacing; int iVertSpacing; int iTitleWrap; LOGFONTA lfFont; } ICONMETRICSA, *PICONMETRICSA, *LPICONMETRICSA; typedef struct tagICONMETRICSW { UINT cbSize; int iHorzSpacing; int iVertSpacing; int iTitleWrap; LOGFONTW lfFont; } ICONMETRICSW, *PICONMETRICSW, *LPICONMETRICSW; typedef ICONMETRICSW ICONMETRICS; typedef PICONMETRICSW PICONMETRICS; typedef LPICONMETRICSW LPICONMETRICS; typedef struct tagANIMATIONINFO { UINT cbSize; int iMinAnimate; } ANIMATIONINFO, *LPANIMATIONINFO; typedef struct tagSERIALKEYSA { UINT cbSize; DWORD dwFlags; LPSTR lpszActivePort; LPSTR lpszPort; UINT iBaudRate; UINT iPortState; UINT iActive; } SERIALKEYSA, *LPSERIALKEYSA; typedef struct tagSERIALKEYSW { UINT cbSize; DWORD dwFlags; LPWSTR lpszActivePort; LPWSTR lpszPort; UINT iBaudRate; UINT iPortState; UINT iActive; } SERIALKEYSW, *LPSERIALKEYSW; typedef SERIALKEYSW SERIALKEYS; typedef LPSERIALKEYSW LPSERIALKEYS; typedef struct tagHIGHCONTRASTA { UINT cbSize; DWORD dwFlags; LPSTR lpszDefaultScheme; } HIGHCONTRASTA, *LPHIGHCONTRASTA; typedef struct tagHIGHCONTRASTW { UINT cbSize; DWORD dwFlags; LPWSTR lpszDefaultScheme; } HIGHCONTRASTW, *LPHIGHCONTRASTW; typedef HIGHCONTRASTW HIGHCONTRAST; typedef LPHIGHCONTRASTW LPHIGHCONTRAST; typedef struct _VIDEOPARAMETERS { GUID Guid; ULONG dwOffset; ULONG dwCommand; ULONG dwFlags; ULONG dwMode; ULONG dwTVStandard; ULONG dwAvailableModes; ULONG dwAvailableTVStandard; ULONG dwFlickerFilter; ULONG dwOverScanX; ULONG dwOverScanY; ULONG dwMaxUnscaledX; ULONG dwMaxUnscaledY; ULONG dwPositionX; ULONG dwPositionY; ULONG dwBrightness; ULONG dwContrast; ULONG dwCPType; ULONG dwCPCommand; ULONG dwCPStandard; ULONG dwCPKey; ULONG bCP_APSTriggerBits; UCHAR bOEMCopyProtection[256]; } VIDEOPARAMETERS, *PVIDEOPARAMETERS, *LPVIDEOPARAMETERS; __declspec(dllimport) LONG __stdcall ChangeDisplaySettingsA( DEVMODEA* lpDevMode, DWORD dwFlags); __declspec(dllimport) LONG __stdcall ChangeDisplaySettingsW( DEVMODEW* lpDevMode, DWORD dwFlags); __declspec(dllimport) LONG __stdcall ChangeDisplaySettingsExA( LPCSTR lpszDeviceName, DEVMODEA* lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam); __declspec(dllimport) LONG __stdcall ChangeDisplaySettingsExW( LPCWSTR lpszDeviceName, DEVMODEW* lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam); __declspec(dllimport) BOOL __stdcall EnumDisplaySettingsA( LPCSTR lpszDeviceName, DWORD iModeNum, DEVMODEA* lpDevMode); __declspec(dllimport) BOOL __stdcall EnumDisplaySettingsW( LPCWSTR lpszDeviceName, DWORD iModeNum, DEVMODEW* lpDevMode); __declspec(dllimport) BOOL __stdcall EnumDisplaySettingsExA( LPCSTR lpszDeviceName, DWORD iModeNum, DEVMODEA* lpDevMode, DWORD dwFlags); __declspec(dllimport) BOOL __stdcall EnumDisplaySettingsExW( LPCWSTR lpszDeviceName, DWORD iModeNum, DEVMODEW* lpDevMode, DWORD dwFlags); __declspec(dllimport) BOOL __stdcall EnumDisplayDevicesA( LPCSTR lpDevice, DWORD iDevNum, PDISPLAY_DEVICEA lpDisplayDevice, DWORD dwFlags); __declspec(dllimport) BOOL __stdcall EnumDisplayDevicesW( LPCWSTR lpDevice, DWORD iDevNum, PDISPLAY_DEVICEW lpDisplayDevice, DWORD dwFlags); __declspec(dllimport) LONG __stdcall GetDisplayConfigBufferSizes( UINT32 flags, UINT32* numPathArrayElements, UINT32* numModeInfoArrayElements); __declspec(dllimport) LONG __stdcall SetDisplayConfig( UINT32 numPathArrayElements, DISPLAYCONFIG_PATH_INFO* pathArray, UINT32 numModeInfoArrayElements, DISPLAYCONFIG_MODE_INFO* modeInfoArray, UINT32 flags); __declspec(dllimport) LONG __stdcall QueryDisplayConfig( UINT32 flags, UINT32* numPathArrayElements, DISPLAYCONFIG_PATH_INFO* pathArray, UINT32* numModeInfoArrayElements, DISPLAYCONFIG_MODE_INFO* modeInfoArray, DISPLAYCONFIG_TOPOLOGY_ID* currentTopologyId); __declspec(dllimport) LONG __stdcall DisplayConfigGetDeviceInfo( DISPLAYCONFIG_DEVICE_INFO_HEADER* requestPacket); __declspec(dllimport) LONG __stdcall DisplayConfigSetDeviceInfo( DISPLAYCONFIG_DEVICE_INFO_HEADER* setPacket); __declspec(dllimport) BOOL __stdcall SystemParametersInfoA( UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni); __declspec(dllimport) BOOL __stdcall SystemParametersInfoW( UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni); __declspec(dllimport) BOOL __stdcall SystemParametersInfoForDpi( UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni, UINT dpi); typedef struct tagFILTERKEYS { UINT cbSize; DWORD dwFlags; DWORD iWaitMSec; DWORD iDelayMSec; DWORD iRepeatMSec; DWORD iBounceMSec; } FILTERKEYS, *LPFILTERKEYS; typedef struct tagSTICKYKEYS { UINT cbSize; DWORD dwFlags; } STICKYKEYS, *LPSTICKYKEYS; typedef struct tagMOUSEKEYS { UINT cbSize; DWORD dwFlags; DWORD iMaxSpeed; DWORD iTimeToMaxSpeed; DWORD iCtrlSpeed; DWORD dwReserved1; DWORD dwReserved2; } MOUSEKEYS, *LPMOUSEKEYS; typedef struct tagACCESSTIMEOUT { UINT cbSize; DWORD dwFlags; DWORD iTimeOutMSec; } ACCESSTIMEOUT, *LPACCESSTIMEOUT; typedef struct tagSOUNDSENTRYA { UINT cbSize; DWORD dwFlags; DWORD iFSTextEffect; DWORD iFSTextEffectMSec; DWORD iFSTextEffectColorBits; DWORD iFSGrafEffect; DWORD iFSGrafEffectMSec; DWORD iFSGrafEffectColor; DWORD iWindowsEffect; DWORD iWindowsEffectMSec; LPSTR lpszWindowsEffectDLL; DWORD iWindowsEffectOrdinal; } SOUNDSENTRYA, *LPSOUNDSENTRYA; typedef struct tagSOUNDSENTRYW { UINT cbSize; DWORD dwFlags; DWORD iFSTextEffect; DWORD iFSTextEffectMSec; DWORD iFSTextEffectColorBits; DWORD iFSGrafEffect; DWORD iFSGrafEffectMSec; DWORD iFSGrafEffectColor; DWORD iWindowsEffect; DWORD iWindowsEffectMSec; LPWSTR lpszWindowsEffectDLL; DWORD iWindowsEffectOrdinal; } SOUNDSENTRYW, *LPSOUNDSENTRYW; typedef SOUNDSENTRYW SOUNDSENTRY; typedef LPSOUNDSENTRYW LPSOUNDSENTRY; __declspec(dllimport) BOOL __stdcall SoundSentry(void); typedef struct tagTOGGLEKEYS { UINT cbSize; DWORD dwFlags; } TOGGLEKEYS, *LPTOGGLEKEYS; typedef struct tagAUDIODESCRIPTION { UINT cbSize; BOOL Enabled; LCID Locale; } AUDIODESCRIPTION, *LPAUDIODESCRIPTION; __declspec(dllimport) void __stdcall SetDebugErrorLevel( DWORD dwLevel); __declspec(dllimport) void __stdcall SetLastErrorEx( DWORD dwErrCode, DWORD dwType); __declspec(dllimport) int __stdcall InternalGetWindowText( HWND hWnd, LPWSTR pString, int cchMaxCount); __declspec(dllimport) BOOL __stdcall CancelShutdown( void); __declspec(dllimport) HMONITOR __stdcall MonitorFromPoint( POINT pt, DWORD dwFlags); __declspec(dllimport) HMONITOR __stdcall MonitorFromRect( LPCRECT lprc, DWORD dwFlags); __declspec(dllimport) HMONITOR __stdcall MonitorFromWindow( HWND hwnd, DWORD dwFlags); typedef struct tagMONITORINFO { DWORD cbSize; RECT rcMonitor; RECT rcWork; DWORD dwFlags; } MONITORINFO, *LPMONITORINFO; typedef struct tagMONITORINFOEXA : public tagMONITORINFO { CHAR szDevice[32]; } MONITORINFOEXA, *LPMONITORINFOEXA; typedef struct tagMONITORINFOEXW : public tagMONITORINFO { WCHAR szDevice[32]; } MONITORINFOEXW, *LPMONITORINFOEXW; typedef MONITORINFOEXW MONITORINFOEX; typedef LPMONITORINFOEXW LPMONITORINFOEX; __declspec(dllimport) BOOL __stdcall GetMonitorInfoA( HMONITOR hMonitor, LPMONITORINFO lpmi); __declspec(dllimport) BOOL __stdcall GetMonitorInfoW( HMONITOR hMonitor, LPMONITORINFO lpmi); typedef BOOL (__stdcall* MONITORENUMPROC)(HMONITOR, HDC, LPRECT, LPARAM); __declspec(dllimport) BOOL __stdcall EnumDisplayMonitors( HDC hdc, LPCRECT lprcClip, MONITORENUMPROC lpfnEnum, LPARAM dwData); __declspec(dllimport) void __stdcall NotifyWinEvent( DWORD event, HWND hwnd, LONG idObject, LONG idChild); typedef void (__stdcall* WINEVENTPROC)( HWINEVENTHOOK hWinEventHook, DWORD event, HWND hwnd, LONG idObject, LONG idChild, DWORD idEventThread, DWORD dwmsEventTime); __declspec(dllimport) HWINEVENTHOOK __stdcall SetWinEventHook( DWORD eventMin, DWORD eventMax, HMODULE hmodWinEventProc, WINEVENTPROC pfnWinEventProc, DWORD idProcess, DWORD idThread, DWORD dwFlags); __declspec(dllimport) BOOL __stdcall IsWinEventHookInstalled( DWORD event); __declspec(dllimport) BOOL __stdcall UnhookWinEvent( HWINEVENTHOOK hWinEventHook); typedef struct tagGUITHREADINFO { DWORD cbSize; DWORD flags; HWND hwndActive; HWND hwndFocus; HWND hwndCapture; HWND hwndMenuOwner; HWND hwndMoveSize; HWND hwndCaret; RECT rcCaret; } GUITHREADINFO, *PGUITHREADINFO, * LPGUITHREADINFO; __declspec(dllimport) BOOL __stdcall GetGUIThreadInfo( DWORD idThread, PGUITHREADINFO pgui); __declspec(dllimport) BOOL __stdcall BlockInput( BOOL fBlockIt); __declspec(dllimport) BOOL __stdcall SetProcessDPIAware( void); __declspec(dllimport) BOOL __stdcall IsProcessDPIAware( void); __declspec(dllimport) DPI_AWARENESS_CONTEXT __stdcall SetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT dpiContext); __declspec(dllimport) DPI_AWARENESS_CONTEXT __stdcall GetThreadDpiAwarenessContext( void); __declspec(dllimport) DPI_AWARENESS_CONTEXT __stdcall GetWindowDpiAwarenessContext( HWND hwnd); __declspec(dllimport) DPI_AWARENESS __stdcall GetAwarenessFromDpiAwarenessContext( DPI_AWARENESS_CONTEXT value); __declspec(dllimport) UINT __stdcall GetDpiFromDpiAwarenessContext( DPI_AWARENESS_CONTEXT value); __declspec(dllimport) BOOL __stdcall AreDpiAwarenessContextsEqual( DPI_AWARENESS_CONTEXT dpiContextA, DPI_AWARENESS_CONTEXT dpiContextB); __declspec(dllimport) BOOL __stdcall IsValidDpiAwarenessContext( DPI_AWARENESS_CONTEXT value); __declspec(dllimport) UINT __stdcall GetDpiForWindow( HWND hwnd); __declspec(dllimport) UINT __stdcall GetDpiForSystem( void); __declspec(dllimport) UINT __stdcall GetSystemDpiForProcess( HANDLE hProcess); __declspec(dllimport) BOOL __stdcall EnableNonClientDpiScaling( HWND hwnd); __declspec(dllimport) BOOL __stdcall InheritWindowMonitor( HWND hwnd, HWND hwndInherit); __declspec(dllimport) BOOL __stdcall SetProcessDpiAwarenessContext( DPI_AWARENESS_CONTEXT value); __declspec(dllimport) DPI_HOSTING_BEHAVIOR __stdcall SetThreadDpiHostingBehavior( DPI_HOSTING_BEHAVIOR value); __declspec(dllimport) DPI_HOSTING_BEHAVIOR __stdcall GetThreadDpiHostingBehavior(); __declspec(dllimport) DPI_HOSTING_BEHAVIOR __stdcall GetWindowDpiHostingBehavior( HWND hwnd); __declspec(dllimport) UINT __stdcall GetWindowModuleFileNameA( HWND hwnd, LPSTR pszFileName, UINT cchFileNameMax); __declspec(dllimport) UINT __stdcall GetWindowModuleFileNameW( HWND hwnd, LPWSTR pszFileName, UINT cchFileNameMax); typedef struct tagCURSORINFO { DWORD cbSize; DWORD flags; HCURSOR hCursor; POINT ptScreenPos; } CURSORINFO, *PCURSORINFO, *LPCURSORINFO; __declspec(dllimport) BOOL __stdcall GetCursorInfo( PCURSORINFO pci); typedef struct tagWINDOWINFO { DWORD cbSize; RECT rcWindow; RECT rcClient; DWORD dwStyle; DWORD dwExStyle; DWORD dwWindowStatus; UINT cxWindowBorders; UINT cyWindowBorders; ATOM atomWindowType; WORD wCreatorVersion; } WINDOWINFO, *PWINDOWINFO, *LPWINDOWINFO; __declspec(dllimport) BOOL __stdcall GetWindowInfo( HWND hwnd, PWINDOWINFO pwi); typedef struct tagTITLEBARINFO { DWORD cbSize; RECT rcTitleBar; DWORD rgstate[5 + 1]; } TITLEBARINFO, *PTITLEBARINFO, *LPTITLEBARINFO; __declspec(dllimport) BOOL __stdcall GetTitleBarInfo( HWND hwnd, PTITLEBARINFO pti); typedef struct tagTITLEBARINFOEX { DWORD cbSize; RECT rcTitleBar; DWORD rgstate[5 + 1]; RECT rgrect[5 + 1]; } TITLEBARINFOEX, *PTITLEBARINFOEX, *LPTITLEBARINFOEX; typedef struct tagMENUBARINFO { DWORD cbSize; RECT rcBar; HMENU hMenu; HWND hwndMenu; BOOL fBarFocused:1; BOOL fFocused:1; } MENUBARINFO, *PMENUBARINFO, *LPMENUBARINFO; __declspec(dllimport) BOOL __stdcall GetMenuBarInfo( HWND hwnd, LONG idObject, LONG idItem, PMENUBARINFO pmbi); typedef struct tagSCROLLBARINFO { DWORD cbSize; RECT rcScrollBar; int dxyLineButton; int xyThumbTop; int xyThumbBottom; int reserved; DWORD rgstate[5 + 1]; } SCROLLBARINFO, *PSCROLLBARINFO, *LPSCROLLBARINFO; __declspec(dllimport) BOOL __stdcall GetScrollBarInfo( HWND hwnd, LONG idObject, PSCROLLBARINFO psbi); typedef struct tagCOMBOBOXINFO { DWORD cbSize; RECT rcItem; RECT rcButton; DWORD stateButton; HWND hwndCombo; HWND hwndItem; HWND hwndList; } COMBOBOXINFO, *PCOMBOBOXINFO, *LPCOMBOBOXINFO; __declspec(dllimport) BOOL __stdcall GetComboBoxInfo( HWND hwndCombo, PCOMBOBOXINFO pcbi); __declspec(dllimport) HWND __stdcall GetAncestor( HWND hwnd, UINT gaFlags); __declspec(dllimport) HWND __stdcall RealChildWindowFromPoint( HWND hwndParent, POINT ptParentClientCoords); __declspec(dllimport) UINT __stdcall RealGetWindowClassA( HWND hwnd, LPSTR ptszClassName, UINT cchClassNameMax); __declspec(dllimport) UINT __stdcall RealGetWindowClassW( HWND hwnd, LPWSTR ptszClassName, UINT cchClassNameMax); typedef struct tagALTTABINFO { DWORD cbSize; int cItems; int cColumns; int cRows; int iColFocus; int iRowFocus; int cxItem; int cyItem; POINT ptStart; } ALTTABINFO, *PALTTABINFO, *LPALTTABINFO; __declspec(dllimport) BOOL __stdcall GetAltTabInfoA( HWND hwnd, int iItem, PALTTABINFO pati, LPSTR pszItemText, UINT cchItemText); __declspec(dllimport) BOOL __stdcall GetAltTabInfoW( HWND hwnd, int iItem, PALTTABINFO pati, LPWSTR pszItemText, UINT cchItemText); __declspec(dllimport) DWORD __stdcall GetListBoxInfo( HWND hwnd); __declspec(dllimport) BOOL __stdcall LockWorkStation( void); __declspec(dllimport) BOOL __stdcall UserHandleGrantAccess( HANDLE hUserHandle, HANDLE hJob, BOOL bGrant); struct HRAWINPUT__{int unused;}; typedef struct HRAWINPUT__ *HRAWINPUT; typedef struct tagRAWINPUTHEADER { DWORD dwType; DWORD dwSize; HANDLE hDevice; WPARAM wParam; } RAWINPUTHEADER, *PRAWINPUTHEADER, *LPRAWINPUTHEADER; #pragma warning(push) #pragma warning(disable: 4201) typedef struct tagRAWMOUSE { USHORT usFlags; union { ULONG ulButtons; struct { USHORT usButtonFlags; USHORT usButtonData; } ; } ; ULONG ulRawButtons; LONG lLastX; LONG lLastY; ULONG ulExtraInformation; } RAWMOUSE, *PRAWMOUSE, *LPRAWMOUSE; #pragma warning(pop) typedef struct tagRAWKEYBOARD { USHORT MakeCode; USHORT Flags; USHORT Reserved; USHORT VKey; UINT Message; ULONG ExtraInformation; } RAWKEYBOARD, *PRAWKEYBOARD, *LPRAWKEYBOARD; typedef struct tagRAWHID { DWORD dwSizeHid; DWORD dwCount; BYTE bRawData[1]; } RAWHID, *PRAWHID, *LPRAWHID; typedef struct tagRAWINPUT { RAWINPUTHEADER header; union { RAWMOUSE mouse; RAWKEYBOARD keyboard; RAWHID hid; } data; } RAWINPUT, *PRAWINPUT, *LPRAWINPUT; __declspec(dllimport) UINT __stdcall GetRawInputData( HRAWINPUT hRawInput, UINT uiCommand, LPVOID pData, PUINT pcbSize, UINT cbSizeHeader); typedef struct tagRID_DEVICE_INFO_MOUSE { DWORD dwId; DWORD dwNumberOfButtons; DWORD dwSampleRate; BOOL fHasHorizontalWheel; } RID_DEVICE_INFO_MOUSE, *PRID_DEVICE_INFO_MOUSE; typedef struct tagRID_DEVICE_INFO_KEYBOARD { DWORD dwType; DWORD dwSubType; DWORD dwKeyboardMode; DWORD dwNumberOfFunctionKeys; DWORD dwNumberOfIndicators; DWORD dwNumberOfKeysTotal; } RID_DEVICE_INFO_KEYBOARD, *PRID_DEVICE_INFO_KEYBOARD; typedef struct tagRID_DEVICE_INFO_HID { DWORD dwVendorId; DWORD dwProductId; DWORD dwVersionNumber; USHORT usUsagePage; USHORT usUsage; } RID_DEVICE_INFO_HID, *PRID_DEVICE_INFO_HID; typedef struct tagRID_DEVICE_INFO { DWORD cbSize; DWORD dwType; union { RID_DEVICE_INFO_MOUSE mouse; RID_DEVICE_INFO_KEYBOARD keyboard; RID_DEVICE_INFO_HID hid; } ; } RID_DEVICE_INFO, *PRID_DEVICE_INFO, *LPRID_DEVICE_INFO; __declspec(dllimport) UINT __stdcall GetRawInputDeviceInfoA( HANDLE hDevice, UINT uiCommand, LPVOID pData, PUINT pcbSize); __declspec(dllimport) UINT __stdcall GetRawInputDeviceInfoW( HANDLE hDevice, UINT uiCommand, LPVOID pData, PUINT pcbSize); __declspec(dllimport) UINT __stdcall GetRawInputBuffer( PRAWINPUT pData, PUINT pcbSize, UINT cbSizeHeader); typedef struct tagRAWINPUTDEVICE { USHORT usUsagePage; USHORT usUsage; DWORD dwFlags; HWND hwndTarget; } RAWINPUTDEVICE, *PRAWINPUTDEVICE, *LPRAWINPUTDEVICE; typedef const RAWINPUTDEVICE* PCRAWINPUTDEVICE; __declspec(dllimport) BOOL __stdcall RegisterRawInputDevices( PCRAWINPUTDEVICE pRawInputDevices, UINT uiNumDevices, UINT cbSize); __declspec(dllimport) UINT __stdcall GetRegisteredRawInputDevices( PRAWINPUTDEVICE pRawInputDevices, PUINT puiNumDevices, UINT cbSize); typedef struct tagRAWINPUTDEVICELIST { HANDLE hDevice; DWORD dwType; } RAWINPUTDEVICELIST, *PRAWINPUTDEVICELIST; __declspec(dllimport) UINT __stdcall GetRawInputDeviceList( PRAWINPUTDEVICELIST pRawInputDeviceList, PUINT puiNumDevices, UINT cbSize); __declspec(dllimport) LRESULT __stdcall DefRawInputProc( PRAWINPUT* paRawInput, INT nInput, UINT cbSizeHeader); typedef enum tagPOINTER_DEVICE_TYPE { POINTER_DEVICE_TYPE_INTEGRATED_PEN = 0x00000001, POINTER_DEVICE_TYPE_EXTERNAL_PEN = 0x00000002, POINTER_DEVICE_TYPE_TOUCH = 0x00000003, POINTER_DEVICE_TYPE_TOUCH_PAD = 0x00000004, POINTER_DEVICE_TYPE_MAX = 0xFFFFFFFF } POINTER_DEVICE_TYPE; typedef struct tagPOINTER_DEVICE_INFO { DWORD displayOrientation; HANDLE device; POINTER_DEVICE_TYPE pointerDeviceType; HMONITOR monitor; ULONG startingCursorId; USHORT maxActiveContacts; WCHAR productString[520]; } POINTER_DEVICE_INFO; typedef struct tagPOINTER_DEVICE_PROPERTY { INT32 logicalMin; INT32 logicalMax; INT32 physicalMin; INT32 physicalMax; UINT32 unit; UINT32 unitExponent; USHORT usagePageId; USHORT usageId; } POINTER_DEVICE_PROPERTY; typedef enum tagPOINTER_DEVICE_CURSOR_TYPE { POINTER_DEVICE_CURSOR_TYPE_UNKNOWN = 0x00000000, POINTER_DEVICE_CURSOR_TYPE_TIP = 0x00000001, POINTER_DEVICE_CURSOR_TYPE_ERASER = 0x00000002, POINTER_DEVICE_CURSOR_TYPE_MAX = 0xFFFFFFFF } POINTER_DEVICE_CURSOR_TYPE; typedef struct tagPOINTER_DEVICE_CURSOR_INFO { UINT32 cursorId; POINTER_DEVICE_CURSOR_TYPE cursor; } POINTER_DEVICE_CURSOR_INFO; __declspec(dllimport) BOOL __stdcall GetPointerDevices( UINT32* deviceCount, POINTER_DEVICE_INFO *pointerDevices); __declspec(dllimport) BOOL __stdcall GetPointerDevice( HANDLE device, POINTER_DEVICE_INFO *pointerDevice); __declspec(dllimport) BOOL __stdcall GetPointerDeviceProperties( HANDLE device, UINT32* propertyCount, POINTER_DEVICE_PROPERTY *pointerProperties); __declspec(dllimport) BOOL __stdcall RegisterPointerDeviceNotifications( HWND window, BOOL notifyRange); __declspec(dllimport) BOOL __stdcall GetPointerDeviceRects( HANDLE device, RECT* pointerDeviceRect, RECT* displayRect); __declspec(dllimport) BOOL __stdcall GetPointerDeviceCursors( HANDLE device, UINT32* cursorCount, POINTER_DEVICE_CURSOR_INFO *deviceCursors); __declspec(dllimport) BOOL __stdcall GetRawPointerDeviceData( UINT32 pointerId, UINT32 historyCount, UINT32 propertiesCount, POINTER_DEVICE_PROPERTY* pProperties, LONG* pValues); __declspec(dllimport) BOOL __stdcall ChangeWindowMessageFilter( UINT message, DWORD dwFlag); typedef struct tagCHANGEFILTERSTRUCT { DWORD cbSize; DWORD ExtStatus; } CHANGEFILTERSTRUCT, *PCHANGEFILTERSTRUCT; __declspec(dllimport) BOOL __stdcall ChangeWindowMessageFilterEx( HWND hwnd, UINT message, DWORD action, PCHANGEFILTERSTRUCT pChangeFilterStruct); struct HGESTUREINFO__{int unused;}; typedef struct HGESTUREINFO__ *HGESTUREINFO; typedef struct tagGESTUREINFO { UINT cbSize; DWORD dwFlags; DWORD dwID; HWND hwndTarget; POINTS ptsLocation; DWORD dwInstanceID; DWORD dwSequenceID; ULONGLONG ullArguments; UINT cbExtraArgs; } GESTUREINFO, *PGESTUREINFO; typedef GESTUREINFO const * PCGESTUREINFO; typedef struct tagGESTURENOTIFYSTRUCT { UINT cbSize; DWORD dwFlags; HWND hwndTarget; POINTS ptsLocation; DWORD dwInstanceID; } GESTURENOTIFYSTRUCT, *PGESTURENOTIFYSTRUCT; __declspec(dllimport) BOOL __stdcall GetGestureInfo( HGESTUREINFO hGestureInfo, PGESTUREINFO pGestureInfo); __declspec(dllimport) BOOL __stdcall GetGestureExtraArgs( HGESTUREINFO hGestureInfo, UINT cbExtraArgs, PBYTE pExtraArgs); __declspec(dllimport) BOOL __stdcall CloseGestureInfoHandle( HGESTUREINFO hGestureInfo); typedef struct tagGESTURECONFIG { DWORD dwID; DWORD dwWant; DWORD dwBlock; } GESTURECONFIG, *PGESTURECONFIG; __declspec(dllimport) BOOL __stdcall SetGestureConfig( HWND hwnd, DWORD dwReserved, UINT cIDs, PGESTURECONFIG pGestureConfig, UINT cbSize); __declspec(dllimport) BOOL __stdcall GetGestureConfig( HWND hwnd, DWORD dwReserved, DWORD dwFlags, PUINT pcIDs, PGESTURECONFIG pGestureConfig, UINT cbSize); __declspec(dllimport) BOOL __stdcall ShutdownBlockReasonCreate( HWND hWnd, LPCWSTR pwszReason); __declspec(dllimport) BOOL __stdcall ShutdownBlockReasonQuery( HWND hWnd, LPWSTR pwszBuff, DWORD *pcchBuff); __declspec(dllimport) BOOL __stdcall ShutdownBlockReasonDestroy( HWND hWnd); typedef enum tagINPUT_MESSAGE_DEVICE_TYPE { IMDT_UNAVAILABLE = 0x00000000, IMDT_KEYBOARD = 0x00000001, IMDT_MOUSE = 0x00000002, IMDT_TOUCH = 0x00000004, IMDT_PEN = 0x00000008, IMDT_TOUCHPAD = 0x00000010, } INPUT_MESSAGE_DEVICE_TYPE; typedef enum tagINPUT_MESSAGE_ORIGIN_ID { IMO_UNAVAILABLE = 0x00000000, IMO_HARDWARE = 0x00000001, IMO_INJECTED = 0x00000002, IMO_SYSTEM = 0x00000004, } INPUT_MESSAGE_ORIGIN_ID; typedef struct tagINPUT_MESSAGE_SOURCE { INPUT_MESSAGE_DEVICE_TYPE deviceType; INPUT_MESSAGE_ORIGIN_ID originId; } INPUT_MESSAGE_SOURCE; __declspec(dllimport) BOOL __stdcall GetCurrentInputMessageSource( INPUT_MESSAGE_SOURCE *inputMessageSource); __declspec(dllimport) BOOL __stdcall GetCIMSSM( INPUT_MESSAGE_SOURCE *inputMessageSource); typedef enum tagAR_STATE { AR_ENABLED = 0x0, AR_DISABLED = 0x1, AR_SUPPRESSED = 0x2, AR_REMOTESESSION = 0x4, AR_MULTIMON = 0x8, AR_NOSENSOR = 0x10, AR_NOT_SUPPORTED = 0x20, AR_DOCKED = 0x40, AR_LAPTOP = 0x80 } AR_STATE, *PAR_STATE; extern "C++" { inline constexpr AR_STATE operator | (AR_STATE a, AR_STATE b) throw() { return AR_STATE(((_ENUM_FLAG_SIZED_INTEGER<AR_STATE>::type)a) | ((_ENUM_FLAG_SIZED_INTEGER<AR_STATE>::type)b)); } inline AR_STATE &operator |= (AR_STATE &a, AR_STATE b) throw() { return (AR_STATE &)(((_ENUM_FLAG_SIZED_INTEGER<AR_STATE>::type &)a) |= ((_ENUM_FLAG_SIZED_INTEGER<AR_STATE>::type)b)); } inline constexpr AR_STATE operator & (AR_STATE a, AR_STATE b) throw() { return AR_STATE(((_ENUM_FLAG_SIZED_INTEGER<AR_STATE>::type)a) & ((_ENUM_FLAG_SIZED_INTEGER<AR_STATE>::type)b)); } inline AR_STATE &operator &= (AR_STATE &a, AR_STATE b) throw() { return (AR_STATE &)(((_ENUM_FLAG_SIZED_INTEGER<AR_STATE>::type &)a) &= ((_ENUM_FLAG_SIZED_INTEGER<AR_STATE>::type)b)); } inline constexpr AR_STATE operator ~ (AR_STATE a) throw() { return AR_STATE(~((_ENUM_FLAG_SIZED_INTEGER<AR_STATE>::type)a)); } inline constexpr AR_STATE operator ^ (AR_STATE a, AR_STATE b) throw() { return AR_STATE(((_ENUM_FLAG_SIZED_INTEGER<AR_STATE>::type)a) ^ ((_ENUM_FLAG_SIZED_INTEGER<AR_STATE>::type)b)); } inline AR_STATE &operator ^= (AR_STATE &a, AR_STATE b) throw() { return (AR_STATE &)(((_ENUM_FLAG_SIZED_INTEGER<AR_STATE>::type &)a) ^= ((_ENUM_FLAG_SIZED_INTEGER<AR_STATE>::type)b)); } } typedef enum ORIENTATION_PREFERENCE { ORIENTATION_PREFERENCE_NONE = 0x0, ORIENTATION_PREFERENCE_LANDSCAPE = 0x1, ORIENTATION_PREFERENCE_PORTRAIT = 0x2, ORIENTATION_PREFERENCE_LANDSCAPE_FLIPPED = 0x4, ORIENTATION_PREFERENCE_PORTRAIT_FLIPPED = 0x8 } ORIENTATION_PREFERENCE; extern "C++" { inline constexpr ORIENTATION_PREFERENCE operator | (ORIENTATION_PREFERENCE a, ORIENTATION_PREFERENCE b) throw() { return ORIENTATION_PREFERENCE(((_ENUM_FLAG_SIZED_INTEGER<ORIENTATION_PREFERENCE>::type)a) | ((_ENUM_FLAG_SIZED_INTEGER<ORIENTATION_PREFERENCE>::type)b)); } inline ORIENTATION_PREFERENCE &operator |= (ORIENTATION_PREFERENCE &a, ORIENTATION_PREFERENCE b) throw() { return (ORIENTATION_PREFERENCE &)(((_ENUM_FLAG_SIZED_INTEGER<ORIENTATION_PREFERENCE>::type &)a) |= ((_ENUM_FLAG_SIZED_INTEGER<ORIENTATION_PREFERENCE>::type)b)); } inline constexpr ORIENTATION_PREFERENCE operator & (ORIENTATION_PREFERENCE a, ORIENTATION_PREFERENCE b) throw() { return ORIENTATION_PREFERENCE(((_ENUM_FLAG_SIZED_INTEGER<ORIENTATION_PREFERENCE>::type)a) & ((_ENUM_FLAG_SIZED_INTEGER<ORIENTATION_PREFERENCE>::type)b)); } inline ORIENTATION_PREFERENCE &operator &= (ORIENTATION_PREFERENCE &a, ORIENTATION_PREFERENCE b) throw() { return (ORIENTATION_PREFERENCE &)(((_ENUM_FLAG_SIZED_INTEGER<ORIENTATION_PREFERENCE>::type &)a) &= ((_ENUM_FLAG_SIZED_INTEGER<ORIENTATION_PREFERENCE>::type)b)); } inline constexpr ORIENTATION_PREFERENCE operator ~ (ORIENTATION_PREFERENCE a) throw() { return ORIENTATION_PREFERENCE(~((_ENUM_FLAG_SIZED_INTEGER<ORIENTATION_PREFERENCE>::type)a)); } inline constexpr ORIENTATION_PREFERENCE operator ^ (ORIENTATION_PREFERENCE a, ORIENTATION_PREFERENCE b) throw() { return ORIENTATION_PREFERENCE(((_ENUM_FLAG_SIZED_INTEGER<ORIENTATION_PREFERENCE>::type)a) ^ ((_ENUM_FLAG_SIZED_INTEGER<ORIENTATION_PREFERENCE>::type)b)); } inline ORIENTATION_PREFERENCE &operator ^= (ORIENTATION_PREFERENCE &a, ORIENTATION_PREFERENCE b) throw() { return (ORIENTATION_PREFERENCE &)(((_ENUM_FLAG_SIZED_INTEGER<ORIENTATION_PREFERENCE>::type &)a) ^= ((_ENUM_FLAG_SIZED_INTEGER<ORIENTATION_PREFERENCE>::type)b)); } } __declspec(dllimport) BOOL __stdcall GetAutoRotationState( PAR_STATE pState); __declspec(dllimport) BOOL __stdcall GetDisplayAutoRotationPreferences( ORIENTATION_PREFERENCE *pOrientation); __declspec(dllimport) BOOL __stdcall GetDisplayAutoRotationPreferencesByProcessId( DWORD dwProcessId, ORIENTATION_PREFERENCE *pOrientation, BOOL *fRotateScreen); __declspec(dllimport) BOOL __stdcall SetDisplayAutoRotationPreferences( ORIENTATION_PREFERENCE orientation); __declspec(dllimport) BOOL __stdcall IsImmersiveProcess( HANDLE hProcess); __declspec(dllimport) BOOL __stdcall SetProcessRestrictionExemption( BOOL fEnableExemption); #pragma warning(pop) } extern "C" { extern "C" { __declspec(dllimport) int __stdcall GetDateFormatA( LCID Locale, DWORD dwFlags, const SYSTEMTIME* lpDate, LPCSTR lpFormat, LPSTR lpDateStr, int cchDate ); __declspec(dllimport) int __stdcall GetDateFormatW( LCID Locale, DWORD dwFlags, const SYSTEMTIME* lpDate, LPCWSTR lpFormat, LPWSTR lpDateStr, int cchDate ); __declspec(dllimport) int __stdcall GetTimeFormatA( LCID Locale, DWORD dwFlags, const SYSTEMTIME* lpTime, LPCSTR lpFormat, LPSTR lpTimeStr, int cchTime ); __declspec(dllimport) int __stdcall GetTimeFormatW( LCID Locale, DWORD dwFlags, const SYSTEMTIME* lpTime, LPCWSTR lpFormat, LPWSTR lpTimeStr, int cchTime ); __declspec(dllimport) int __stdcall GetTimeFormatEx( LPCWSTR lpLocaleName, DWORD dwFlags, const SYSTEMTIME* lpTime, LPCWSTR lpFormat, LPWSTR lpTimeStr, int cchTime ); __declspec(dllimport) int __stdcall GetDateFormatEx( LPCWSTR lpLocaleName, DWORD dwFlags, const SYSTEMTIME* lpDate, LPCWSTR lpFormat, LPWSTR lpDateStr, int cchDate, LPCWSTR lpCalendar ); __declspec(dllimport) int __stdcall GetDurationFormatEx( LPCWSTR lpLocaleName, DWORD dwFlags, const SYSTEMTIME* lpDuration, ULONGLONG ullDuration, LPCWSTR lpFormat, LPWSTR lpDurationStr, int cchDuration ); } #pragma warning(push) #pragma warning(disable: 4820) typedef DWORD LGRPID; typedef DWORD LCTYPE; typedef DWORD CALTYPE; typedef DWORD CALID; typedef struct _cpinfo { UINT MaxCharSize; BYTE DefaultChar[2]; BYTE LeadByte[12]; } CPINFO, *LPCPINFO; typedef DWORD GEOTYPE; typedef DWORD GEOCLASS; typedef LONG GEOID; typedef struct _cpinfoexA { UINT MaxCharSize; BYTE DefaultChar[2]; BYTE LeadByte[12]; WCHAR UnicodeDefaultChar; UINT CodePage; CHAR CodePageName[260]; } CPINFOEXA, *LPCPINFOEXA; typedef struct _cpinfoexW { UINT MaxCharSize; BYTE DefaultChar[2]; BYTE LeadByte[12]; WCHAR UnicodeDefaultChar; UINT CodePage; WCHAR CodePageName[260]; } CPINFOEXW, *LPCPINFOEXW; typedef CPINFOEXW CPINFOEX; typedef LPCPINFOEXW LPCPINFOEX; typedef struct _numberfmtA { UINT NumDigits; UINT LeadingZero; UINT Grouping; LPSTR lpDecimalSep; LPSTR lpThousandSep; UINT NegativeOrder; } NUMBERFMTA, *LPNUMBERFMTA; typedef struct _numberfmtW { UINT NumDigits; UINT LeadingZero; UINT Grouping; LPWSTR lpDecimalSep; LPWSTR lpThousandSep; UINT NegativeOrder; } NUMBERFMTW, *LPNUMBERFMTW; typedef NUMBERFMTW NUMBERFMT; typedef LPNUMBERFMTW LPNUMBERFMT; typedef struct _currencyfmtA { UINT NumDigits; UINT LeadingZero; UINT Grouping; LPSTR lpDecimalSep; LPSTR lpThousandSep; UINT NegativeOrder; UINT PositiveOrder; LPSTR lpCurrencySymbol; } CURRENCYFMTA, *LPCURRENCYFMTA; typedef struct _currencyfmtW { UINT NumDigits; UINT LeadingZero; UINT Grouping; LPWSTR lpDecimalSep; LPWSTR lpThousandSep; UINT NegativeOrder; UINT PositiveOrder; LPWSTR lpCurrencySymbol; } CURRENCYFMTW, *LPCURRENCYFMTW; typedef CURRENCYFMTW CURRENCYFMT; typedef LPCURRENCYFMTW LPCURRENCYFMT; enum SYSNLS_FUNCTION{ COMPARE_STRING = 0x0001, }; typedef DWORD NLS_FUNCTION; typedef struct _nlsversioninfo{ DWORD dwNLSVersionInfoSize; DWORD dwNLSVersion; DWORD dwDefinedVersion; DWORD dwEffectiveId; GUID guidCustomVersion; } NLSVERSIONINFO, *LPNLSVERSIONINFO; typedef struct _nlsversioninfoex{ DWORD dwNLSVersionInfoSize; DWORD dwNLSVersion; DWORD dwDefinedVersion; DWORD dwEffectiveId; GUID guidCustomVersion; } NLSVERSIONINFOEX, *LPNLSVERSIONINFOEX; enum SYSGEOTYPE { GEO_NATION = 0x0001, GEO_LATITUDE = 0x0002, GEO_LONGITUDE = 0x0003, GEO_ISO2 = 0x0004, GEO_ISO3 = 0x0005, GEO_RFC1766 = 0x0006, GEO_LCID = 0x0007, GEO_FRIENDLYNAME= 0x0008, GEO_OFFICIALNAME= 0x0009, GEO_TIMEZONES = 0x000A, GEO_OFFICIALLANGUAGES = 0x000B, GEO_ISO_UN_NUMBER = 0x000C, GEO_PARENT = 0x000D, GEO_DIALINGCODE = 0x000E, GEO_CURRENCYCODE= 0x000F, GEO_CURRENCYSYMBOL= 0x0010, }; enum SYSGEOCLASS { GEOCLASS_NATION = 16, GEOCLASS_REGION = 14, GEOCLASS_ALL = 0 }; typedef enum _NORM_FORM { NormalizationOther = 0, NormalizationC = 0x1, NormalizationD = 0x2, NormalizationKC = 0x5, NormalizationKD = 0x6 } NORM_FORM; typedef BOOL (__stdcall* LANGUAGEGROUP_ENUMPROCA)(LGRPID, LPSTR, LPSTR, DWORD, LONG_PTR); typedef BOOL (__stdcall* LANGGROUPLOCALE_ENUMPROCA)(LGRPID, LCID, LPSTR, LONG_PTR); typedef BOOL (__stdcall* UILANGUAGE_ENUMPROCA)(LPSTR, LONG_PTR); typedef BOOL (__stdcall* CODEPAGE_ENUMPROCA)(LPSTR); typedef BOOL (__stdcall* DATEFMT_ENUMPROCA)(LPSTR); typedef BOOL (__stdcall* DATEFMT_ENUMPROCEXA)(LPSTR, CALID); typedef BOOL (__stdcall* TIMEFMT_ENUMPROCA)(LPSTR); typedef BOOL (__stdcall* CALINFO_ENUMPROCA)(LPSTR); typedef BOOL (__stdcall* CALINFO_ENUMPROCEXA)(LPSTR, CALID); typedef BOOL (__stdcall* LOCALE_ENUMPROCA)(LPSTR); typedef BOOL (__stdcall* LOCALE_ENUMPROCW)(LPWSTR); typedef BOOL (__stdcall* LANGUAGEGROUP_ENUMPROCW)(LGRPID, LPWSTR, LPWSTR, DWORD, LONG_PTR); typedef BOOL (__stdcall* LANGGROUPLOCALE_ENUMPROCW)(LGRPID, LCID, LPWSTR, LONG_PTR); typedef BOOL (__stdcall* UILANGUAGE_ENUMPROCW)(LPWSTR, LONG_PTR); typedef BOOL (__stdcall* CODEPAGE_ENUMPROCW)(LPWSTR); typedef BOOL (__stdcall* DATEFMT_ENUMPROCW)(LPWSTR); typedef BOOL (__stdcall* DATEFMT_ENUMPROCEXW)(LPWSTR, CALID); typedef BOOL (__stdcall* TIMEFMT_ENUMPROCW)(LPWSTR); typedef BOOL (__stdcall* CALINFO_ENUMPROCW)(LPWSTR); typedef BOOL (__stdcall* CALINFO_ENUMPROCEXW)(LPWSTR, CALID); typedef BOOL (__stdcall* GEO_ENUMPROC)(GEOID); typedef struct _FILEMUIINFO { DWORD dwSize; DWORD dwVersion; DWORD dwFileType; BYTE pChecksum[16]; BYTE pServiceChecksum[16]; DWORD dwLanguageNameOffset; DWORD dwTypeIDMainSize; DWORD dwTypeIDMainOffset; DWORD dwTypeNameMainOffset; DWORD dwTypeIDMUISize; DWORD dwTypeIDMUIOffset; DWORD dwTypeNameMUIOffset; BYTE abBuffer[8]; } FILEMUIINFO, *PFILEMUIINFO; extern "C" { __declspec(dllimport) int __stdcall CompareStringEx( LPCWSTR lpLocaleName, DWORD dwCmpFlags, LPCWCH lpString1, int cchCount1, LPCWCH lpString2, int cchCount2, LPNLSVERSIONINFO lpVersionInformation, LPVOID lpReserved, LPARAM lParam ); __declspec(dllimport) int __stdcall CompareStringOrdinal( LPCWCH lpString1, int cchCount1, LPCWCH lpString2, int cchCount2, BOOL bIgnoreCase ); __declspec(dllimport) int __stdcall CompareStringW( LCID Locale, DWORD dwCmpFlags, PCNZWCH lpString1, int cchCount1, PCNZWCH lpString2, int cchCount2 ); __declspec(dllimport) int __stdcall FoldStringW( DWORD dwMapFlags, LPCWCH lpSrcStr, int cchSrc, LPWSTR lpDestStr, int cchDest ); __declspec(dllimport) BOOL __stdcall GetStringTypeExW( LCID Locale, DWORD dwInfoType, LPCWCH lpSrcStr, int cchSrc, LPWORD lpCharType ); __declspec(dllimport) BOOL __stdcall GetStringTypeW( DWORD dwInfoType, LPCWCH lpSrcStr, int cchSrc, LPWORD lpCharType ); __declspec(dllimport) int __stdcall MultiByteToWideChar( UINT CodePage, DWORD dwFlags, LPCCH lpMultiByteStr, int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar ); __declspec(dllimport) int __stdcall WideCharToMultiByte( UINT CodePage, DWORD dwFlags, LPCWCH lpWideCharStr, int cchWideChar, LPSTR lpMultiByteStr, int cbMultiByte, LPCCH lpDefaultChar, LPBOOL lpUsedDefaultChar ); } __declspec(dllimport) BOOL __stdcall IsValidCodePage( UINT CodePage); __declspec(dllimport) UINT __stdcall GetACP(void); __declspec(dllimport) UINT __stdcall GetOEMCP(void); __declspec(dllimport) BOOL __stdcall GetCPInfo( UINT CodePage, LPCPINFO lpCPInfo); __declspec(dllimport) BOOL __stdcall GetCPInfoExA( UINT CodePage, DWORD dwFlags, LPCPINFOEXA lpCPInfoEx); __declspec(dllimport) BOOL __stdcall GetCPInfoExW( UINT CodePage, DWORD dwFlags, LPCPINFOEXW lpCPInfoEx); __declspec(dllimport) int __stdcall CompareStringA( LCID Locale, DWORD dwCmpFlags, PCNZCH lpString1, int cchCount1, PCNZCH lpString2, int cchCount2); __declspec(dllimport) int __stdcall FindNLSString( LCID Locale, DWORD dwFindNLSStringFlags, LPCWSTR lpStringSource, int cchSource, LPCWSTR lpStringValue, int cchValue, LPINT pcchFound); __declspec(dllimport) int __stdcall LCMapStringW( LCID Locale, DWORD dwMapFlags, LPCWSTR lpSrcStr, int cchSrc, LPWSTR lpDestStr, int cchDest); __declspec(dllimport) int __stdcall LCMapStringA( LCID Locale, DWORD dwMapFlags, LPCSTR lpSrcStr, int cchSrc, LPSTR lpDestStr, int cchDest); __declspec(dllimport) int __stdcall GetLocaleInfoW( LCID Locale, LCTYPE LCType, LPWSTR lpLCData, int cchData); __declspec(dllimport) int __stdcall GetLocaleInfoA( LCID Locale, LCTYPE LCType, LPSTR lpLCData, int cchData ); __declspec(dllimport) BOOL __stdcall SetLocaleInfoA( LCID Locale, LCTYPE LCType, LPCSTR lpLCData); __declspec(dllimport) BOOL __stdcall SetLocaleInfoW( LCID Locale, LCTYPE LCType, LPCWSTR lpLCData); __declspec(dllimport) int __stdcall GetCalendarInfoA( LCID Locale, CALID Calendar, CALTYPE CalType, LPSTR lpCalData, int cchData, LPDWORD lpValue); __declspec(dllimport) int __stdcall GetCalendarInfoW( LCID Locale, CALID Calendar, CALTYPE CalType, LPWSTR lpCalData, int cchData, LPDWORD lpValue); __declspec(dllimport) BOOL __stdcall SetCalendarInfoA( LCID Locale, CALID Calendar, CALTYPE CalType, LPCSTR lpCalData); __declspec(dllimport) BOOL __stdcall SetCalendarInfoW( LCID Locale, CALID Calendar, CALTYPE CalType, LPCWSTR lpCalData); __declspec(dllimport) BOOL __stdcall LoadStringByReference( DWORD Flags, PCWSTR Language, PCWSTR SourceString, PWSTR Buffer, ULONG cchBuffer, PCWSTR Directory, PULONG pcchBufferOut ); __declspec(dllimport) BOOL __stdcall IsDBCSLeadByte( BYTE TestChar ); __declspec(dllimport) BOOL __stdcall IsDBCSLeadByteEx( UINT CodePage, BYTE TestChar ); __declspec(dllimport) LCID __stdcall LocaleNameToLCID( LPCWSTR lpName, DWORD dwFlags); __declspec(dllimport) int __stdcall LCIDToLocaleName( LCID Locale, LPWSTR lpName, int cchName, DWORD dwFlags); __declspec(dllimport) int __stdcall GetDurationFormat( LCID Locale, DWORD dwFlags, const SYSTEMTIME *lpDuration, ULONGLONG ullDuration, LPCWSTR lpFormat, LPWSTR lpDurationStr, int cchDuration); __declspec(dllimport) int __stdcall GetNumberFormatA( LCID Locale, DWORD dwFlags, LPCSTR lpValue, const NUMBERFMTA *lpFormat, LPSTR lpNumberStr, int cchNumber); __declspec(dllimport) int __stdcall GetNumberFormatW( LCID Locale, DWORD dwFlags, LPCWSTR lpValue, const NUMBERFMTW *lpFormat, LPWSTR lpNumberStr, int cchNumber); __declspec(dllimport) int __stdcall GetCurrencyFormatA( LCID Locale, DWORD dwFlags, LPCSTR lpValue, const CURRENCYFMTA *lpFormat, LPSTR lpCurrencyStr, int cchCurrency); __declspec(dllimport) int __stdcall GetCurrencyFormatW( LCID Locale, DWORD dwFlags, LPCWSTR lpValue, const CURRENCYFMTW *lpFormat, LPWSTR lpCurrencyStr, int cchCurrency); __declspec(dllimport) BOOL __stdcall EnumCalendarInfoA( CALINFO_ENUMPROCA lpCalInfoEnumProc, LCID Locale, CALID Calendar, CALTYPE CalType); __declspec(dllimport) BOOL __stdcall EnumCalendarInfoW( CALINFO_ENUMPROCW lpCalInfoEnumProc, LCID Locale, CALID Calendar, CALTYPE CalType); __declspec(dllimport) BOOL __stdcall EnumCalendarInfoExA( CALINFO_ENUMPROCEXA lpCalInfoEnumProcEx, LCID Locale, CALID Calendar, CALTYPE CalType); __declspec(dllimport) BOOL __stdcall EnumCalendarInfoExW( CALINFO_ENUMPROCEXW lpCalInfoEnumProcEx, LCID Locale, CALID Calendar, CALTYPE CalType); __declspec(dllimport) BOOL __stdcall EnumTimeFormatsA( TIMEFMT_ENUMPROCA lpTimeFmtEnumProc, LCID Locale, DWORD dwFlags); __declspec(dllimport) BOOL __stdcall EnumTimeFormatsW( TIMEFMT_ENUMPROCW lpTimeFmtEnumProc, LCID Locale, DWORD dwFlags); __declspec(dllimport) BOOL __stdcall EnumDateFormatsA( DATEFMT_ENUMPROCA lpDateFmtEnumProc, LCID Locale, DWORD dwFlags); __declspec(dllimport) BOOL __stdcall EnumDateFormatsW( DATEFMT_ENUMPROCW lpDateFmtEnumProc, LCID Locale, DWORD dwFlags); __declspec(dllimport) BOOL __stdcall EnumDateFormatsExA( DATEFMT_ENUMPROCEXA lpDateFmtEnumProcEx, LCID Locale, DWORD dwFlags); __declspec(dllimport) BOOL __stdcall EnumDateFormatsExW( DATEFMT_ENUMPROCEXW lpDateFmtEnumProcEx, LCID Locale, DWORD dwFlags); __declspec(dllimport) BOOL __stdcall IsValidLanguageGroup( LGRPID LanguageGroup, DWORD dwFlags); __declspec(dllimport) BOOL __stdcall GetNLSVersion( NLS_FUNCTION Function, LCID Locale, LPNLSVERSIONINFO lpVersionInformation); __declspec(dllimport) BOOL __stdcall IsValidLocale( LCID Locale, DWORD dwFlags); __declspec(dllimport) int __stdcall GetGeoInfoA( GEOID Location, GEOTYPE GeoType, LPSTR lpGeoData, int cchData, LANGID LangId); __declspec(dllimport) int __stdcall GetGeoInfoW( GEOID Location, GEOTYPE GeoType, LPWSTR lpGeoData, int cchData, LANGID LangId); __declspec(dllimport) BOOL __stdcall EnumSystemGeoID( GEOCLASS GeoClass, GEOID ParentGeoId, GEO_ENUMPROC lpGeoEnumProc); __declspec(dllimport) GEOID __stdcall GetUserGeoID( GEOCLASS GeoClass); __declspec(dllimport) int __stdcall GetUserDefaultGeoName( LPWSTR geoName, int geoNameCount ); __declspec(dllimport) BOOL __stdcall SetUserGeoID( GEOID GeoId); __declspec(dllimport) LCID __stdcall ConvertDefaultLocale( LCID Locale); __declspec(dllimport) LANGID __stdcall GetSystemDefaultUILanguage(void); __declspec(dllimport) LCID __stdcall GetThreadLocale(void); __declspec(dllimport) BOOL __stdcall SetThreadLocale( LCID Locale ); __declspec(dllimport) LANGID __stdcall GetUserDefaultUILanguage(void); __declspec(dllimport) LANGID __stdcall GetUserDefaultLangID(void); __declspec(dllimport) LANGID __stdcall GetSystemDefaultLangID(void); __declspec(dllimport) LCID __stdcall GetSystemDefaultLCID(void); __declspec(dllimport) LCID __stdcall GetUserDefaultLCID(void); __declspec(dllimport) LANGID __stdcall SetThreadUILanguage( LANGID LangId); __declspec(dllimport) LANGID __stdcall GetThreadUILanguage(void); __declspec(dllimport) BOOL __stdcall GetProcessPreferredUILanguages( DWORD dwFlags, PULONG pulNumLanguages, PZZWSTR pwszLanguagesBuffer, PULONG pcchLanguagesBuffer ); __declspec(dllimport) BOOL __stdcall SetProcessPreferredUILanguages( DWORD dwFlags, PCZZWSTR pwszLanguagesBuffer, PULONG pulNumLanguages ); __declspec(dllimport) BOOL __stdcall GetUserPreferredUILanguages ( DWORD dwFlags, PULONG pulNumLanguages, PZZWSTR pwszLanguagesBuffer, PULONG pcchLanguagesBuffer ); __declspec(dllimport) BOOL __stdcall GetSystemPreferredUILanguages ( DWORD dwFlags, PULONG pulNumLanguages, PZZWSTR pwszLanguagesBuffer, PULONG pcchLanguagesBuffer ); __declspec(dllimport) BOOL __stdcall GetThreadPreferredUILanguages( DWORD dwFlags, PULONG pulNumLanguages, PZZWSTR pwszLanguagesBuffer, PULONG pcchLanguagesBuffer ); __declspec(dllimport) BOOL __stdcall SetThreadPreferredUILanguages( DWORD dwFlags, PCZZWSTR pwszLanguagesBuffer, PULONG pulNumLanguages ); __declspec(dllimport) BOOL __stdcall GetFileMUIInfo( DWORD dwFlags, PCWSTR pcwszFilePath, PFILEMUIINFO pFileMUIInfo, DWORD* pcbFileMUIInfo); __declspec(dllimport) BOOL __stdcall GetFileMUIPath( DWORD dwFlags, PCWSTR pcwszFilePath , PWSTR pwszLanguage, PULONG pcchLanguage, PWSTR pwszFileMUIPath, PULONG pcchFileMUIPath, PULONGLONG pululEnumerator ); __declspec(dllimport) BOOL __stdcall GetUILanguageInfo( DWORD dwFlags, PCZZWSTR pwmszLanguage, PZZWSTR pwszFallbackLanguages, PDWORD pcchFallbackLanguages, PDWORD pAttributes ); __declspec(dllimport) BOOL __stdcall NotifyUILanguageChange( DWORD dwFlags, PCWSTR pcwstrNewLanguage, PCWSTR pcwstrPreviousLanguage, DWORD dwReserved, PDWORD pdwStatusRtrn ); __declspec(dllimport) BOOL __stdcall GetStringTypeExA( LCID Locale, DWORD dwInfoType, LPCSTR lpSrcStr, int cchSrc, LPWORD lpCharType); __declspec(dllimport) BOOL __stdcall GetStringTypeA( LCID Locale, DWORD dwInfoType, LPCSTR lpSrcStr, int cchSrc, LPWORD lpCharType); __declspec(dllimport) int __stdcall FoldStringA( DWORD dwMapFlags, LPCSTR lpSrcStr, int cchSrc, LPSTR lpDestStr, int cchDest); __declspec(dllimport) BOOL __stdcall EnumSystemLocalesA( LOCALE_ENUMPROCA lpLocaleEnumProc, DWORD dwFlags); __declspec(dllimport) BOOL __stdcall EnumSystemLocalesW( LOCALE_ENUMPROCW lpLocaleEnumProc, DWORD dwFlags); __declspec(dllimport) BOOL __stdcall EnumSystemLanguageGroupsA( LANGUAGEGROUP_ENUMPROCA lpLanguageGroupEnumProc, DWORD dwFlags, LONG_PTR lParam); __declspec(dllimport) BOOL __stdcall EnumSystemLanguageGroupsW( LANGUAGEGROUP_ENUMPROCW lpLanguageGroupEnumProc, DWORD dwFlags, LONG_PTR lParam); __declspec(dllimport) BOOL __stdcall EnumLanguageGroupLocalesA( LANGGROUPLOCALE_ENUMPROCA lpLangGroupLocaleEnumProc, LGRPID LanguageGroup, DWORD dwFlags, LONG_PTR lParam); __declspec(dllimport) BOOL __stdcall EnumLanguageGroupLocalesW( LANGGROUPLOCALE_ENUMPROCW lpLangGroupLocaleEnumProc, LGRPID LanguageGroup, DWORD dwFlags, LONG_PTR lParam); __declspec(dllimport) BOOL __stdcall EnumUILanguagesA( UILANGUAGE_ENUMPROCA lpUILanguageEnumProc, DWORD dwFlags, LONG_PTR lParam); __declspec(dllimport) BOOL __stdcall EnumUILanguagesW( UILANGUAGE_ENUMPROCW lpUILanguageEnumProc, DWORD dwFlags, LONG_PTR lParam); __declspec(dllimport) BOOL __stdcall EnumSystemCodePagesA( CODEPAGE_ENUMPROCA lpCodePageEnumProc, DWORD dwFlags); __declspec(dllimport) BOOL __stdcall EnumSystemCodePagesW( CODEPAGE_ENUMPROCW lpCodePageEnumProc, DWORD dwFlags); __declspec(dllimport) int __stdcall IdnToAscii( DWORD dwFlags, LPCWSTR lpUnicodeCharStr, int cchUnicodeChar, LPWSTR lpASCIICharStr, int cchASCIIChar); __declspec(dllimport) int __stdcall IdnToUnicode( DWORD dwFlags, LPCWSTR lpASCIICharStr, int cchASCIIChar, LPWSTR lpUnicodeCharStr, int cchUnicodeChar); __declspec(dllimport) int __stdcall IdnToNameprepUnicode( DWORD dwFlags, LPCWSTR lpUnicodeCharStr, int cchUnicodeChar, LPWSTR lpNameprepCharStr, int cchNameprepChar); __declspec(dllimport) int __stdcall NormalizeString( NORM_FORM NormForm, LPCWSTR lpSrcString, int cwSrcLength, LPWSTR lpDstString, int cwDstLength ); __declspec(dllimport) BOOL __stdcall IsNormalizedString( NORM_FORM NormForm, LPCWSTR lpString, int cwLength ); __declspec(dllimport) BOOL __stdcall VerifyScripts( DWORD dwFlags, LPCWSTR lpLocaleScripts, int cchLocaleScripts, LPCWSTR lpTestScripts, int cchTestScripts); __declspec(dllimport) int __stdcall GetStringScripts( DWORD dwFlags, LPCWSTR lpString, int cchString, LPWSTR lpScripts, int cchScripts); __declspec(dllimport) int __stdcall GetLocaleInfoEx( LPCWSTR lpLocaleName, LCTYPE LCType, LPWSTR lpLCData, int cchData ); __declspec(dllimport) int __stdcall GetCalendarInfoEx( LPCWSTR lpLocaleName, CALID Calendar, LPCWSTR lpReserved, CALTYPE CalType, LPWSTR lpCalData, int cchData, LPDWORD lpValue ); __declspec(dllimport) int __stdcall GetNumberFormatEx( LPCWSTR lpLocaleName, DWORD dwFlags, LPCWSTR lpValue, const NUMBERFMTW *lpFormat, LPWSTR lpNumberStr, int cchNumber ); __declspec(dllimport) int __stdcall GetCurrencyFormatEx( LPCWSTR lpLocaleName, DWORD dwFlags, LPCWSTR lpValue, const CURRENCYFMTW *lpFormat, LPWSTR lpCurrencyStr, int cchCurrency ); __declspec(dllimport) int __stdcall GetUserDefaultLocaleName( LPWSTR lpLocaleName, int cchLocaleName ); __declspec(dllimport) int __stdcall GetSystemDefaultLocaleName( LPWSTR lpLocaleName, int cchLocaleName ); __declspec(dllimport) BOOL __stdcall IsNLSDefinedString( NLS_FUNCTION Function, DWORD dwFlags, LPNLSVERSIONINFO lpVersionInformation, LPCWSTR lpString, INT cchStr); __declspec(dllimport) BOOL __stdcall GetNLSVersionEx( NLS_FUNCTION function, LPCWSTR lpLocaleName, LPNLSVERSIONINFOEX lpVersionInformation ); __declspec(dllimport) DWORD __stdcall IsValidNLSVersion( NLS_FUNCTION function, LPCWSTR lpLocaleName, LPNLSVERSIONINFOEX lpVersionInformation ); __declspec(dllimport) int __stdcall FindNLSStringEx( LPCWSTR lpLocaleName, DWORD dwFindNLSStringFlags, LPCWSTR lpStringSource, int cchSource, LPCWSTR lpStringValue, int cchValue, LPINT pcchFound, LPNLSVERSIONINFO lpVersionInformation, LPVOID lpReserved, LPARAM sortHandle ); __declspec(dllimport) int __stdcall LCMapStringEx( LPCWSTR lpLocaleName, DWORD dwMapFlags, LPCWSTR lpSrcStr, int cchSrc, LPWSTR lpDestStr, int cchDest, LPNLSVERSIONINFO lpVersionInformation, LPVOID lpReserved, LPARAM sortHandle ); __declspec(dllimport) BOOL __stdcall IsValidLocaleName( LPCWSTR lpLocaleName ); typedef BOOL (__stdcall* CALINFO_ENUMPROCEXEX)(LPWSTR, CALID, LPWSTR, LPARAM); __declspec(dllimport) BOOL __stdcall EnumCalendarInfoExEx( CALINFO_ENUMPROCEXEX pCalInfoEnumProcExEx, LPCWSTR lpLocaleName, CALID Calendar, LPCWSTR lpReserved, CALTYPE CalType, LPARAM lParam ); typedef BOOL (__stdcall* DATEFMT_ENUMPROCEXEX)(LPWSTR, CALID, LPARAM); __declspec(dllimport) BOOL __stdcall EnumDateFormatsExEx( DATEFMT_ENUMPROCEXEX lpDateFmtEnumProcExEx, LPCWSTR lpLocaleName, DWORD dwFlags, LPARAM lParam ); typedef BOOL (__stdcall* TIMEFMT_ENUMPROCEX)(LPWSTR, LPARAM); __declspec(dllimport) BOOL __stdcall EnumTimeFormatsEx( TIMEFMT_ENUMPROCEX lpTimeFmtEnumProcEx, LPCWSTR lpLocaleName, DWORD dwFlags, LPARAM lParam ); typedef BOOL (__stdcall* LOCALE_ENUMPROCEX)(LPWSTR, DWORD, LPARAM); __declspec(dllimport) BOOL __stdcall EnumSystemLocalesEx( LOCALE_ENUMPROCEX lpLocaleEnumProcEx, DWORD dwFlags, LPARAM lParam, LPVOID lpReserved ); __declspec(dllimport) int __stdcall ResolveLocaleName( LPCWSTR lpNameToResolve, LPWSTR lpLocaleName, int cchLocaleName ); #pragma warning(pop) } extern "C" { #pragma warning(push) #pragma warning(disable: 4820) extern "C" { typedef struct _COORD { SHORT X; SHORT Y; } COORD, *PCOORD; typedef struct _SMALL_RECT { SHORT Left; SHORT Top; SHORT Right; SHORT Bottom; } SMALL_RECT, *PSMALL_RECT; typedef struct _KEY_EVENT_RECORD { BOOL bKeyDown; WORD wRepeatCount; WORD wVirtualKeyCode; WORD wVirtualScanCode; union { WCHAR UnicodeChar; CHAR AsciiChar; } uChar; DWORD dwControlKeyState; } KEY_EVENT_RECORD, *PKEY_EVENT_RECORD; typedef struct _MOUSE_EVENT_RECORD { COORD dwMousePosition; DWORD dwButtonState; DWORD dwControlKeyState; DWORD dwEventFlags; } MOUSE_EVENT_RECORD, *PMOUSE_EVENT_RECORD; typedef struct _WINDOW_BUFFER_SIZE_RECORD { COORD dwSize; } WINDOW_BUFFER_SIZE_RECORD, *PWINDOW_BUFFER_SIZE_RECORD; typedef struct _MENU_EVENT_RECORD { UINT dwCommandId; } MENU_EVENT_RECORD, *PMENU_EVENT_RECORD; typedef struct _FOCUS_EVENT_RECORD { BOOL bSetFocus; } FOCUS_EVENT_RECORD, *PFOCUS_EVENT_RECORD; typedef struct _INPUT_RECORD { WORD EventType; union { KEY_EVENT_RECORD KeyEvent; MOUSE_EVENT_RECORD MouseEvent; WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent; MENU_EVENT_RECORD MenuEvent; FOCUS_EVENT_RECORD FocusEvent; } Event; } INPUT_RECORD, *PINPUT_RECORD; typedef struct _CHAR_INFO { union { WCHAR UnicodeChar; CHAR AsciiChar; } Char; WORD Attributes; } CHAR_INFO, *PCHAR_INFO; typedef struct _CONSOLE_FONT_INFO { DWORD nFont; COORD dwFontSize; } CONSOLE_FONT_INFO, *PCONSOLE_FONT_INFO; typedef void* HPCON; } extern "C" { __declspec(dllimport) BOOL __stdcall AllocConsole( void ); __declspec(dllimport) BOOL __stdcall FreeConsole( void ); __declspec(dllimport) BOOL __stdcall AttachConsole( DWORD dwProcessId ); __declspec(dllimport) UINT __stdcall GetConsoleCP( void ); __declspec(dllimport) UINT __stdcall GetConsoleOutputCP( void ); __declspec(dllimport) BOOL __stdcall GetConsoleMode( HANDLE hConsoleHandle, LPDWORD lpMode ); __declspec(dllimport) BOOL __stdcall SetConsoleMode( HANDLE hConsoleHandle, DWORD dwMode ); __declspec(dllimport) BOOL __stdcall GetNumberOfConsoleInputEvents( HANDLE hConsoleInput, LPDWORD lpNumberOfEvents ); __declspec(dllimport) BOOL __stdcall ReadConsoleInputA( HANDLE hConsoleInput, PINPUT_RECORD lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsRead ); __declspec(dllimport) BOOL __stdcall ReadConsoleInputW( HANDLE hConsoleInput, PINPUT_RECORD lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsRead ); __declspec(dllimport) BOOL __stdcall PeekConsoleInputA( HANDLE hConsoleInput, PINPUT_RECORD lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsRead ); __declspec(dllimport) BOOL __stdcall PeekConsoleInputW( HANDLE hConsoleInput, PINPUT_RECORD lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsRead ); typedef struct _CONSOLE_READCONSOLE_CONTROL { ULONG nLength; ULONG nInitialChars; ULONG dwCtrlWakeupMask; ULONG dwControlKeyState; } CONSOLE_READCONSOLE_CONTROL, *PCONSOLE_READCONSOLE_CONTROL; __declspec(dllimport) BOOL __stdcall ReadConsoleA( HANDLE hConsoleInput, LPVOID lpBuffer, DWORD nNumberOfCharsToRead, LPDWORD lpNumberOfCharsRead, PCONSOLE_READCONSOLE_CONTROL pInputControl ); __declspec(dllimport) BOOL __stdcall ReadConsoleW( HANDLE hConsoleInput, LPVOID lpBuffer, DWORD nNumberOfCharsToRead, LPDWORD lpNumberOfCharsRead, PCONSOLE_READCONSOLE_CONTROL pInputControl ); __declspec(dllimport) BOOL __stdcall WriteConsoleA( HANDLE hConsoleOutput, const void* lpBuffer, DWORD nNumberOfCharsToWrite, LPDWORD lpNumberOfCharsWritten, LPVOID lpReserved ); __declspec(dllimport) BOOL __stdcall WriteConsoleW( HANDLE hConsoleOutput, const void* lpBuffer, DWORD nNumberOfCharsToWrite, LPDWORD lpNumberOfCharsWritten, LPVOID lpReserved ); typedef BOOL (__stdcall *PHANDLER_ROUTINE)( DWORD CtrlType ); __declspec(dllimport) BOOL __stdcall SetConsoleCtrlHandler( PHANDLER_ROUTINE HandlerRoutine, BOOL Add ); } extern "C" { __declspec(dllimport) BOOL __stdcall FillConsoleOutputCharacterA( HANDLE hConsoleOutput, CHAR cCharacter, DWORD nLength, COORD dwWriteCoord, LPDWORD lpNumberOfCharsWritten ); __declspec(dllimport) BOOL __stdcall FillConsoleOutputCharacterW( HANDLE hConsoleOutput, WCHAR cCharacter, DWORD nLength, COORD dwWriteCoord, LPDWORD lpNumberOfCharsWritten ); __declspec(dllimport) BOOL __stdcall FillConsoleOutputAttribute( HANDLE hConsoleOutput, WORD wAttribute, DWORD nLength, COORD dwWriteCoord, LPDWORD lpNumberOfAttrsWritten ); __declspec(dllimport) BOOL __stdcall GenerateConsoleCtrlEvent( DWORD dwCtrlEvent, DWORD dwProcessGroupId ); __declspec(dllimport) HANDLE __stdcall CreateConsoleScreenBuffer( DWORD dwDesiredAccess, DWORD dwShareMode, const SECURITY_ATTRIBUTES* lpSecurityAttributes, DWORD dwFlags, LPVOID lpScreenBufferData ); __declspec(dllimport) BOOL __stdcall SetConsoleActiveScreenBuffer( HANDLE hConsoleOutput ); __declspec(dllimport) BOOL __stdcall FlushConsoleInputBuffer( HANDLE hConsoleInput ); __declspec(dllimport) BOOL __stdcall SetConsoleCP( UINT wCodePageID ); __declspec(dllimport) BOOL __stdcall SetConsoleOutputCP( UINT wCodePageID ); typedef struct _CONSOLE_CURSOR_INFO { DWORD dwSize; BOOL bVisible; } CONSOLE_CURSOR_INFO, *PCONSOLE_CURSOR_INFO; __declspec(dllimport) BOOL __stdcall GetConsoleCursorInfo( HANDLE hConsoleOutput, PCONSOLE_CURSOR_INFO lpConsoleCursorInfo ); __declspec(dllimport) BOOL __stdcall SetConsoleCursorInfo( HANDLE hConsoleOutput, const CONSOLE_CURSOR_INFO* lpConsoleCursorInfo ); typedef struct _CONSOLE_SCREEN_BUFFER_INFO { COORD dwSize; COORD dwCursorPosition; WORD wAttributes; SMALL_RECT srWindow; COORD dwMaximumWindowSize; } CONSOLE_SCREEN_BUFFER_INFO, *PCONSOLE_SCREEN_BUFFER_INFO; __declspec(dllimport) BOOL __stdcall GetConsoleScreenBufferInfo( HANDLE hConsoleOutput, PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo ); typedef struct _CONSOLE_SCREEN_BUFFER_INFOEX { ULONG cbSize; COORD dwSize; COORD dwCursorPosition; WORD wAttributes; SMALL_RECT srWindow; COORD dwMaximumWindowSize; WORD wPopupAttributes; BOOL bFullscreenSupported; COLORREF ColorTable[16]; } CONSOLE_SCREEN_BUFFER_INFOEX, *PCONSOLE_SCREEN_BUFFER_INFOEX; __declspec(dllimport) BOOL __stdcall GetConsoleScreenBufferInfoEx( HANDLE hConsoleOutput, PCONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx ); __declspec(dllimport) BOOL __stdcall SetConsoleScreenBufferInfoEx( HANDLE hConsoleOutput, PCONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx ); __declspec(dllimport) BOOL __stdcall SetConsoleScreenBufferSize( HANDLE hConsoleOutput, COORD dwSize ); __declspec(dllimport) BOOL __stdcall SetConsoleCursorPosition( HANDLE hConsoleOutput, COORD dwCursorPosition ); __declspec(dllimport) COORD __stdcall GetLargestConsoleWindowSize( HANDLE hConsoleOutput ); __declspec(dllimport) BOOL __stdcall SetConsoleTextAttribute( HANDLE hConsoleOutput, WORD wAttributes ); __declspec(dllimport) BOOL __stdcall SetConsoleWindowInfo( HANDLE hConsoleOutput, BOOL bAbsolute, const SMALL_RECT* lpConsoleWindow ); __declspec(dllimport) BOOL __stdcall WriteConsoleOutputCharacterA( HANDLE hConsoleOutput, LPCSTR lpCharacter, DWORD nLength, COORD dwWriteCoord, LPDWORD lpNumberOfCharsWritten ); __declspec(dllimport) BOOL __stdcall WriteConsoleOutputCharacterW( HANDLE hConsoleOutput, LPCWSTR lpCharacter, DWORD nLength, COORD dwWriteCoord, LPDWORD lpNumberOfCharsWritten ); __declspec(dllimport) BOOL __stdcall WriteConsoleOutputAttribute( HANDLE hConsoleOutput, const WORD* lpAttribute, DWORD nLength, COORD dwWriteCoord, LPDWORD lpNumberOfAttrsWritten ); __declspec(dllimport) BOOL __stdcall ReadConsoleOutputCharacterA( HANDLE hConsoleOutput, LPSTR lpCharacter, DWORD nLength, COORD dwReadCoord, LPDWORD lpNumberOfCharsRead ); __declspec(dllimport) BOOL __stdcall ReadConsoleOutputCharacterW( HANDLE hConsoleOutput, LPWSTR lpCharacter, DWORD nLength, COORD dwReadCoord, LPDWORD lpNumberOfCharsRead ); __declspec(dllimport) BOOL __stdcall ReadConsoleOutputAttribute( HANDLE hConsoleOutput, LPWORD lpAttribute, DWORD nLength, COORD dwReadCoord, LPDWORD lpNumberOfAttrsRead ); __declspec(dllimport) BOOL __stdcall WriteConsoleInputA( HANDLE hConsoleInput, const INPUT_RECORD* lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsWritten ); __declspec(dllimport) BOOL __stdcall WriteConsoleInputW( HANDLE hConsoleInput, const INPUT_RECORD* lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsWritten ); __declspec(dllimport) BOOL __stdcall ScrollConsoleScreenBufferA( HANDLE hConsoleOutput, const SMALL_RECT* lpScrollRectangle, const SMALL_RECT* lpClipRectangle, COORD dwDestinationOrigin, const CHAR_INFO* lpFill ); __declspec(dllimport) BOOL __stdcall ScrollConsoleScreenBufferW( HANDLE hConsoleOutput, const SMALL_RECT* lpScrollRectangle, const SMALL_RECT* lpClipRectangle, COORD dwDestinationOrigin, const CHAR_INFO* lpFill ); __declspec(dllimport) BOOL __stdcall WriteConsoleOutputA( HANDLE hConsoleOutput, const CHAR_INFO* lpBuffer, COORD dwBufferSize, COORD dwBufferCoord, PSMALL_RECT lpWriteRegion ); __declspec(dllimport) BOOL __stdcall WriteConsoleOutputW( HANDLE hConsoleOutput, const CHAR_INFO* lpBuffer, COORD dwBufferSize, COORD dwBufferCoord, PSMALL_RECT lpWriteRegion ); __declspec(dllimport) BOOL __stdcall ReadConsoleOutputA( HANDLE hConsoleOutput, PCHAR_INFO lpBuffer, COORD dwBufferSize, COORD dwBufferCoord, PSMALL_RECT lpReadRegion ); __declspec(dllimport) BOOL __stdcall ReadConsoleOutputW( HANDLE hConsoleOutput, PCHAR_INFO lpBuffer, COORD dwBufferSize, COORD dwBufferCoord, PSMALL_RECT lpReadRegion ); __declspec(dllimport) DWORD __stdcall GetConsoleTitleA( LPSTR lpConsoleTitle, DWORD nSize ); __declspec(dllimport) DWORD __stdcall GetConsoleTitleW( LPWSTR lpConsoleTitle, DWORD nSize ); __declspec(dllimport) DWORD __stdcall GetConsoleOriginalTitleA( LPSTR lpConsoleTitle, DWORD nSize ); __declspec(dllimport) DWORD __stdcall GetConsoleOriginalTitleW( LPWSTR lpConsoleTitle, DWORD nSize ); __declspec(dllimport) BOOL __stdcall SetConsoleTitleA( LPCSTR lpConsoleTitle ); __declspec(dllimport) BOOL __stdcall SetConsoleTitleW( LPCWSTR lpConsoleTitle ); } extern "C" { __declspec(dllimport) BOOL __stdcall GetNumberOfConsoleMouseButtons( LPDWORD lpNumberOfMouseButtons ); __declspec(dllimport) COORD __stdcall GetConsoleFontSize( HANDLE hConsoleOutput, DWORD nFont ); __declspec(dllimport) BOOL __stdcall GetCurrentConsoleFont( HANDLE hConsoleOutput, BOOL bMaximumWindow, PCONSOLE_FONT_INFO lpConsoleCurrentFont ); typedef struct _CONSOLE_FONT_INFOEX { ULONG cbSize; DWORD nFont; COORD dwFontSize; UINT FontFamily; UINT FontWeight; WCHAR FaceName[32]; } CONSOLE_FONT_INFOEX, *PCONSOLE_FONT_INFOEX; __declspec(dllimport) BOOL __stdcall GetCurrentConsoleFontEx( HANDLE hConsoleOutput, BOOL bMaximumWindow, PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx ); __declspec(dllimport) BOOL __stdcall SetCurrentConsoleFontEx( HANDLE hConsoleOutput, BOOL bMaximumWindow, PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx ); typedef struct _CONSOLE_SELECTION_INFO { DWORD dwFlags; COORD dwSelectionAnchor; SMALL_RECT srSelection; } CONSOLE_SELECTION_INFO, *PCONSOLE_SELECTION_INFO; __declspec(dllimport) BOOL __stdcall GetConsoleSelectionInfo( PCONSOLE_SELECTION_INFO lpConsoleSelectionInfo ); typedef struct _CONSOLE_HISTORY_INFO { UINT cbSize; UINT HistoryBufferSize; UINT NumberOfHistoryBuffers; DWORD dwFlags; } CONSOLE_HISTORY_INFO, *PCONSOLE_HISTORY_INFO; __declspec(dllimport) BOOL __stdcall GetConsoleHistoryInfo( PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo ); __declspec(dllimport) BOOL __stdcall SetConsoleHistoryInfo( PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo ); __declspec(dllimport) BOOL __stdcall GetConsoleDisplayMode( LPDWORD lpModeFlags ); __declspec(dllimport) BOOL __stdcall SetConsoleDisplayMode( HANDLE hConsoleOutput, DWORD dwFlags, PCOORD lpNewScreenBufferDimensions ); __declspec(dllimport) HWND __stdcall GetConsoleWindow( void ); __declspec(dllimport) BOOL __stdcall AddConsoleAliasA( LPSTR Source, LPSTR Target, LPSTR ExeName ); __declspec(dllimport) BOOL __stdcall AddConsoleAliasW( LPWSTR Source, LPWSTR Target, LPWSTR ExeName ); __declspec(dllimport) DWORD __stdcall GetConsoleAliasA( LPSTR Source, LPSTR TargetBuffer, DWORD TargetBufferLength, LPSTR ExeName ); __declspec(dllimport) DWORD __stdcall GetConsoleAliasW( LPWSTR Source, LPWSTR TargetBuffer, DWORD TargetBufferLength, LPWSTR ExeName ); __declspec(dllimport) DWORD __stdcall GetConsoleAliasesLengthA( LPSTR ExeName ); __declspec(dllimport) DWORD __stdcall GetConsoleAliasesLengthW( LPWSTR ExeName ); __declspec(dllimport) DWORD __stdcall GetConsoleAliasExesLengthA( void ); __declspec(dllimport) DWORD __stdcall GetConsoleAliasExesLengthW( void ); __declspec(dllimport) DWORD __stdcall GetConsoleAliasesA( LPSTR AliasBuffer, DWORD AliasBufferLength, LPSTR ExeName ); __declspec(dllimport) DWORD __stdcall GetConsoleAliasesW( LPWSTR AliasBuffer, DWORD AliasBufferLength, LPWSTR ExeName ); __declspec(dllimport) DWORD __stdcall GetConsoleAliasExesA( LPSTR ExeNameBuffer, DWORD ExeNameBufferLength ); __declspec(dllimport) DWORD __stdcall GetConsoleAliasExesW( LPWSTR ExeNameBuffer, DWORD ExeNameBufferLength ); __declspec(dllimport) void __stdcall ExpungeConsoleCommandHistoryA( LPSTR ExeName ); __declspec(dllimport) void __stdcall ExpungeConsoleCommandHistoryW( LPWSTR ExeName ); __declspec(dllimport) BOOL __stdcall SetConsoleNumberOfCommandsA( DWORD Number, LPSTR ExeName ); __declspec(dllimport) BOOL __stdcall SetConsoleNumberOfCommandsW( DWORD Number, LPWSTR ExeName ); __declspec(dllimport) DWORD __stdcall GetConsoleCommandHistoryLengthA( LPSTR ExeName ); __declspec(dllimport) DWORD __stdcall GetConsoleCommandHistoryLengthW( LPWSTR ExeName ); __declspec(dllimport) DWORD __stdcall GetConsoleCommandHistoryA( LPSTR Commands, DWORD CommandBufferLength, LPSTR ExeName ); __declspec(dllimport) DWORD __stdcall GetConsoleCommandHistoryW( LPWSTR Commands, DWORD CommandBufferLength, LPWSTR ExeName ); __declspec(dllimport) DWORD __stdcall GetConsoleProcessList( LPDWORD lpdwProcessList, DWORD dwProcessCount ); } #pragma warning(pop) } extern "C" { typedef struct tagVS_FIXEDFILEINFO { DWORD dwSignature; DWORD dwStrucVersion; DWORD dwFileVersionMS; DWORD dwFileVersionLS; DWORD dwProductVersionMS; DWORD dwProductVersionLS; DWORD dwFileFlagsMask; DWORD dwFileFlags; DWORD dwFileOS; DWORD dwFileType; DWORD dwFileSubtype; DWORD dwFileDateMS; DWORD dwFileDateLS; } VS_FIXEDFILEINFO; } extern "C" { DWORD __stdcall VerFindFileA( DWORD uFlags, LPCSTR szFileName, LPCSTR szWinDir, LPCSTR szAppDir, LPSTR szCurDir, PUINT puCurDirLen, LPSTR szDestDir, PUINT puDestDirLen ); DWORD __stdcall VerFindFileW( DWORD uFlags, LPCWSTR szFileName, LPCWSTR szWinDir, LPCWSTR szAppDir, LPWSTR szCurDir, PUINT puCurDirLen, LPWSTR szDestDir, PUINT puDestDirLen ); DWORD __stdcall VerInstallFileA( DWORD uFlags, LPCSTR szSrcFileName, LPCSTR szDestFileName, LPCSTR szSrcDir, LPCSTR szDestDir, LPCSTR szCurDir, LPSTR szTmpFile, PUINT puTmpFileLen ); DWORD __stdcall VerInstallFileW( DWORD uFlags, LPCWSTR szSrcFileName, LPCWSTR szDestFileName, LPCWSTR szSrcDir, LPCWSTR szDestDir, LPCWSTR szCurDir, LPWSTR szTmpFile, PUINT puTmpFileLen ); DWORD __stdcall GetFileVersionInfoSizeA( LPCSTR lptstrFilename, LPDWORD lpdwHandle ); DWORD __stdcall GetFileVersionInfoSizeW( LPCWSTR lptstrFilename, LPDWORD lpdwHandle ); BOOL __stdcall GetFileVersionInfoA( LPCSTR lptstrFilename, DWORD dwHandle, DWORD dwLen, LPVOID lpData ); BOOL __stdcall GetFileVersionInfoW( LPCWSTR lptstrFilename, DWORD dwHandle, DWORD dwLen, LPVOID lpData ); DWORD __stdcall GetFileVersionInfoSizeExA( DWORD dwFlags, LPCSTR lpwstrFilename, LPDWORD lpdwHandle); DWORD __stdcall GetFileVersionInfoSizeExW( DWORD dwFlags, LPCWSTR lpwstrFilename, LPDWORD lpdwHandle); BOOL __stdcall GetFileVersionInfoExA( DWORD dwFlags, LPCSTR lpwstrFilename, DWORD dwHandle, DWORD dwLen, LPVOID lpData); BOOL __stdcall GetFileVersionInfoExW( DWORD dwFlags, LPCWSTR lpwstrFilename, DWORD dwHandle, DWORD dwLen, LPVOID lpData); DWORD __stdcall VerLanguageNameA( DWORD wLang, LPSTR szLang, DWORD cchLang ); DWORD __stdcall VerLanguageNameW( DWORD wLang, LPWSTR szLang, DWORD cchLang ); BOOL __stdcall VerQueryValueA( LPCVOID pBlock, LPCSTR lpSubBlock, LPVOID * lplpBuffer, PUINT puLen ); BOOL __stdcall VerQueryValueW( LPCVOID pBlock, LPCWSTR lpSubBlock, LPVOID * lplpBuffer, PUINT puLen ); } extern "C" { #pragma warning(push) #pragma warning(disable: 4820) typedef LONG LSTATUS; typedef ACCESS_MASK REGSAM; struct val_context { int valuelen; LPVOID value_context; LPVOID val_buff_ptr; }; typedef struct val_context *PVALCONTEXT; typedef struct pvalueA { LPSTR pv_valuename; int pv_valuelen; LPVOID pv_value_context; DWORD pv_type; }PVALUEA, *PPVALUEA; typedef struct pvalueW { LPWSTR pv_valuename; int pv_valuelen; LPVOID pv_value_context; DWORD pv_type; }PVALUEW, *PPVALUEW; typedef PVALUEW PVALUE; typedef PPVALUEW PPVALUE; typedef DWORD __cdecl QUERYHANDLER (LPVOID keycontext, PVALCONTEXT val_list, DWORD num_vals, LPVOID outputbuffer, DWORD *total_outlen, DWORD input_blen); typedef QUERYHANDLER *PQUERYHANDLER; typedef struct provider_info { PQUERYHANDLER pi_R0_1val; PQUERYHANDLER pi_R0_allvals; PQUERYHANDLER pi_R3_1val; PQUERYHANDLER pi_R3_allvals; DWORD pi_flags; LPVOID pi_key_context; }REG_PROVIDER; typedef struct provider_info *PPROVIDER; typedef struct value_entA { LPSTR ve_valuename; DWORD ve_valuelen; DWORD_PTR ve_valueptr; DWORD ve_type; }VALENTA, *PVALENTA; typedef struct value_entW { LPWSTR ve_valuename; DWORD ve_valuelen; DWORD_PTR ve_valueptr; DWORD ve_type; }VALENTW, *PVALENTW; typedef VALENTW VALENT; typedef PVALENTW PVALENT; __declspec(dllimport) LSTATUS __stdcall RegCloseKey( HKEY hKey ); __declspec(dllimport) LSTATUS __stdcall RegOverridePredefKey ( HKEY hKey, HKEY hNewHKey ); __declspec(dllimport) LSTATUS __stdcall RegOpenUserClassesRoot( HANDLE hToken, DWORD dwOptions, REGSAM samDesired, PHKEY phkResult ); __declspec(dllimport) LSTATUS __stdcall RegOpenCurrentUser( REGSAM samDesired, PHKEY phkResult ); __declspec(dllimport) LSTATUS __stdcall RegDisablePredefinedCache( void ); __declspec(dllimport) LSTATUS __stdcall RegDisablePredefinedCacheEx( void ); __declspec(dllimport) LSTATUS __stdcall RegConnectRegistryA ( LPCSTR lpMachineName, HKEY hKey, PHKEY phkResult ); __declspec(dllimport) LSTATUS __stdcall RegConnectRegistryW ( LPCWSTR lpMachineName, HKEY hKey, PHKEY phkResult ); __declspec(dllimport) LSTATUS __stdcall RegConnectRegistryExA ( LPCSTR lpMachineName, HKEY hKey, ULONG Flags, PHKEY phkResult ); __declspec(dllimport) LSTATUS __stdcall RegConnectRegistryExW ( LPCWSTR lpMachineName, HKEY hKey, ULONG Flags, PHKEY phkResult ); __declspec(dllimport) LSTATUS __stdcall RegCreateKeyA ( HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult ); __declspec(dllimport) LSTATUS __stdcall RegCreateKeyW ( HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult ); __declspec(dllimport) LSTATUS __stdcall RegCreateKeyExA( HKEY hKey, LPCSTR lpSubKey, DWORD Reserved, LPSTR lpClass, DWORD dwOptions, REGSAM samDesired, const LPSECURITY_ATTRIBUTES lpSecurityAttributes, PHKEY phkResult, LPDWORD lpdwDisposition ); __declspec(dllimport) LSTATUS __stdcall RegCreateKeyExW( HKEY hKey, LPCWSTR lpSubKey, DWORD Reserved, LPWSTR lpClass, DWORD dwOptions, REGSAM samDesired, const LPSECURITY_ATTRIBUTES lpSecurityAttributes, PHKEY phkResult, LPDWORD lpdwDisposition ); __declspec(dllimport) LSTATUS __stdcall RegCreateKeyTransactedA ( HKEY hKey, LPCSTR lpSubKey, DWORD Reserved, LPSTR lpClass, DWORD dwOptions, REGSAM samDesired, const LPSECURITY_ATTRIBUTES lpSecurityAttributes, PHKEY phkResult, LPDWORD lpdwDisposition, HANDLE hTransaction, PVOID pExtendedParemeter ); __declspec(dllimport) LSTATUS __stdcall RegCreateKeyTransactedW ( HKEY hKey, LPCWSTR lpSubKey, DWORD Reserved, LPWSTR lpClass, DWORD dwOptions, REGSAM samDesired, const LPSECURITY_ATTRIBUTES lpSecurityAttributes, PHKEY phkResult, LPDWORD lpdwDisposition, HANDLE hTransaction, PVOID pExtendedParemeter ); __declspec(dllimport) LSTATUS __stdcall RegDeleteKeyA ( HKEY hKey, LPCSTR lpSubKey ); __declspec(dllimport) LSTATUS __stdcall RegDeleteKeyW ( HKEY hKey, LPCWSTR lpSubKey ); __declspec(dllimport) LSTATUS __stdcall RegDeleteKeyExA( HKEY hKey, LPCSTR lpSubKey, REGSAM samDesired, DWORD Reserved ); __declspec(dllimport) LSTATUS __stdcall RegDeleteKeyExW( HKEY hKey, LPCWSTR lpSubKey, REGSAM samDesired, DWORD Reserved ); __declspec(dllimport) LSTATUS __stdcall RegDeleteKeyTransactedA ( HKEY hKey, LPCSTR lpSubKey, REGSAM samDesired, DWORD Reserved, HANDLE hTransaction, PVOID pExtendedParameter ); __declspec(dllimport) LSTATUS __stdcall RegDeleteKeyTransactedW ( HKEY hKey, LPCWSTR lpSubKey, REGSAM samDesired, DWORD Reserved, HANDLE hTransaction, PVOID pExtendedParameter ); __declspec(dllimport) LONG __stdcall RegDisableReflectionKey ( HKEY hBase ); __declspec(dllimport) LONG __stdcall RegEnableReflectionKey ( HKEY hBase ); __declspec(dllimport) LONG __stdcall RegQueryReflectionKey ( HKEY hBase, BOOL *bIsReflectionDisabled ); __declspec(dllimport) LSTATUS __stdcall RegDeleteValueA( HKEY hKey, LPCSTR lpValueName ); __declspec(dllimport) LSTATUS __stdcall RegDeleteValueW( HKEY hKey, LPCWSTR lpValueName ); __declspec(dllimport) LSTATUS __stdcall RegEnumKeyA ( HKEY hKey, DWORD dwIndex, LPSTR lpName, DWORD cchName ); __declspec(dllimport) LSTATUS __stdcall RegEnumKeyW ( HKEY hKey, DWORD dwIndex, LPWSTR lpName, DWORD cchName ); __declspec(dllimport) LSTATUS __stdcall RegEnumKeyExA( HKEY hKey, DWORD dwIndex, LPSTR lpName, LPDWORD lpcchName, LPDWORD lpReserved, LPSTR lpClass, LPDWORD lpcchClass, PFILETIME lpftLastWriteTime ); __declspec(dllimport) LSTATUS __stdcall RegEnumKeyExW( HKEY hKey, DWORD dwIndex, LPWSTR lpName, LPDWORD lpcchName, LPDWORD lpReserved, LPWSTR lpClass, LPDWORD lpcchClass, PFILETIME lpftLastWriteTime ); __declspec(dllimport) LSTATUS __stdcall RegEnumValueA( HKEY hKey, DWORD dwIndex, LPSTR lpValueName, LPDWORD lpcchValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData ); __declspec(dllimport) LSTATUS __stdcall RegEnumValueW( HKEY hKey, DWORD dwIndex, LPWSTR lpValueName, LPDWORD lpcchValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData ); __declspec(dllimport) LSTATUS __stdcall RegFlushKey( HKEY hKey ); __declspec(dllimport) LSTATUS __stdcall RegGetKeySecurity( HKEY hKey, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, LPDWORD lpcbSecurityDescriptor ); __declspec(dllimport) LSTATUS __stdcall RegLoadKeyA( HKEY hKey, LPCSTR lpSubKey, LPCSTR lpFile ); __declspec(dllimport) LSTATUS __stdcall RegLoadKeyW( HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpFile ); __declspec(dllimport) LSTATUS __stdcall RegNotifyChangeKeyValue( HKEY hKey, BOOL bWatchSubtree, DWORD dwNotifyFilter, HANDLE hEvent, BOOL fAsynchronous ); __declspec(dllimport) LSTATUS __stdcall RegOpenKeyA ( HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult ); __declspec(dllimport) LSTATUS __stdcall RegOpenKeyW ( HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult ); __declspec(dllimport) LSTATUS __stdcall RegOpenKeyExA( HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult ); __declspec(dllimport) LSTATUS __stdcall RegOpenKeyExW( HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult ); __declspec(dllimport) LSTATUS __stdcall RegOpenKeyTransactedA ( HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult, HANDLE hTransaction, PVOID pExtendedParemeter ); __declspec(dllimport) LSTATUS __stdcall RegOpenKeyTransactedW ( HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult, HANDLE hTransaction, PVOID pExtendedParemeter ); __declspec(dllimport) LSTATUS __stdcall RegQueryInfoKeyA( HKEY hKey, LPSTR lpClass, LPDWORD lpcchClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcbMaxSubKeyLen, LPDWORD lpcbMaxClassLen, LPDWORD lpcValues, LPDWORD lpcbMaxValueNameLen, LPDWORD lpcbMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime ); __declspec(dllimport) LSTATUS __stdcall RegQueryInfoKeyW( HKEY hKey, LPWSTR lpClass, LPDWORD lpcchClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcbMaxSubKeyLen, LPDWORD lpcbMaxClassLen, LPDWORD lpcValues, LPDWORD lpcbMaxValueNameLen, LPDWORD lpcbMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime ); __declspec(dllimport) LSTATUS __stdcall RegQueryValueA ( HKEY hKey, LPCSTR lpSubKey, LPSTR lpData, PLONG lpcbData ); __declspec(dllimport) LSTATUS __stdcall RegQueryValueW ( HKEY hKey, LPCWSTR lpSubKey, LPWSTR lpData, PLONG lpcbData ); __declspec(dllimport) LSTATUS __stdcall RegQueryMultipleValuesA( HKEY hKey, PVALENTA val_list, DWORD num_vals, LPSTR lpValueBuf, LPDWORD ldwTotsize ); __declspec(dllimport) LSTATUS __stdcall RegQueryMultipleValuesW( HKEY hKey, PVALENTW val_list, DWORD num_vals, LPWSTR lpValueBuf, LPDWORD ldwTotsize ); __declspec(dllimport) LSTATUS __stdcall RegQueryValueExA( HKEY hKey, LPCSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData ); __declspec(dllimport) LSTATUS __stdcall RegQueryValueExW( HKEY hKey, LPCWSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData ); __declspec(dllimport) LSTATUS __stdcall RegReplaceKeyA ( HKEY hKey, LPCSTR lpSubKey, LPCSTR lpNewFile, LPCSTR lpOldFile ); __declspec(dllimport) LSTATUS __stdcall RegReplaceKeyW ( HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpNewFile, LPCWSTR lpOldFile ); __declspec(dllimport) LSTATUS __stdcall RegRestoreKeyA( HKEY hKey, LPCSTR lpFile, DWORD dwFlags ); __declspec(dllimport) LSTATUS __stdcall RegRestoreKeyW( HKEY hKey, LPCWSTR lpFile, DWORD dwFlags ); __declspec(dllimport) LSTATUS __stdcall RegRenameKey( HKEY hKey, LPCWSTR lpSubKeyName, LPCWSTR lpNewKeyName ); __declspec(dllimport) LSTATUS __stdcall RegSaveKeyA ( HKEY hKey, LPCSTR lpFile, const LPSECURITY_ATTRIBUTES lpSecurityAttributes ); __declspec(dllimport) LSTATUS __stdcall RegSaveKeyW ( HKEY hKey, LPCWSTR lpFile, const LPSECURITY_ATTRIBUTES lpSecurityAttributes ); __declspec(dllimport) LSTATUS __stdcall RegSetKeySecurity( HKEY hKey, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor ); __declspec(dllimport) LSTATUS __stdcall RegSetValueA ( HKEY hKey, LPCSTR lpSubKey, DWORD dwType, LPCSTR lpData, DWORD cbData ); __declspec(dllimport) LSTATUS __stdcall RegSetValueW ( HKEY hKey, LPCWSTR lpSubKey, DWORD dwType, LPCWSTR lpData, DWORD cbData ); __declspec(dllimport) LSTATUS __stdcall RegSetValueExA( HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, const BYTE* lpData, DWORD cbData ); __declspec(dllimport) LSTATUS __stdcall RegSetValueExW( HKEY hKey, LPCWSTR lpValueName, DWORD Reserved, DWORD dwType, const BYTE* lpData, DWORD cbData ); __declspec(dllimport) LSTATUS __stdcall RegUnLoadKeyA( HKEY hKey, LPCSTR lpSubKey ); __declspec(dllimport) LSTATUS __stdcall RegUnLoadKeyW( HKEY hKey, LPCWSTR lpSubKey ); __declspec(dllimport) LSTATUS __stdcall RegDeleteKeyValueA( HKEY hKey, LPCSTR lpSubKey, LPCSTR lpValueName ); __declspec(dllimport) LSTATUS __stdcall RegDeleteKeyValueW( HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpValueName ); __declspec(dllimport) LSTATUS __stdcall RegSetKeyValueA( HKEY hKey, LPCSTR lpSubKey, LPCSTR lpValueName, DWORD dwType, LPCVOID lpData, DWORD cbData ); __declspec(dllimport) LSTATUS __stdcall RegSetKeyValueW( HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpValueName, DWORD dwType, LPCVOID lpData, DWORD cbData ); __declspec(dllimport) LSTATUS __stdcall RegDeleteTreeA( HKEY hKey, LPCSTR lpSubKey ); __declspec(dllimport) LSTATUS __stdcall RegDeleteTreeW( HKEY hKey, LPCWSTR lpSubKey ); __declspec(dllimport) LSTATUS __stdcall RegCopyTreeA ( HKEY hKeySrc, LPCSTR lpSubKey, HKEY hKeyDest ); __declspec(dllimport) LSTATUS __stdcall RegGetValueA( HKEY hkey, LPCSTR lpSubKey, LPCSTR lpValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData ); __declspec(dllimport) LSTATUS __stdcall RegGetValueW( HKEY hkey, LPCWSTR lpSubKey, LPCWSTR lpValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData ); __declspec(dllimport) LSTATUS __stdcall RegCopyTreeW( HKEY hKeySrc, LPCWSTR lpSubKey, HKEY hKeyDest ); __declspec(dllimport) LSTATUS __stdcall RegLoadMUIStringA( HKEY hKey, LPCSTR pszValue, LPSTR pszOutBuf, DWORD cbOutBuf, LPDWORD pcbData, DWORD Flags, LPCSTR pszDirectory ); __declspec(dllimport) LSTATUS __stdcall RegLoadMUIStringW( HKEY hKey, LPCWSTR pszValue, LPWSTR pszOutBuf, DWORD cbOutBuf, LPDWORD pcbData, DWORD Flags, LPCWSTR pszDirectory ); __declspec(dllimport) LSTATUS __stdcall RegLoadAppKeyA( LPCSTR lpFile, PHKEY phkResult, REGSAM samDesired, DWORD dwOptions, DWORD Reserved ); __declspec(dllimport) LSTATUS __stdcall RegLoadAppKeyW( LPCWSTR lpFile, PHKEY phkResult, REGSAM samDesired, DWORD dwOptions, DWORD Reserved ); __declspec(dllimport) BOOL __stdcall InitiateSystemShutdownA( LPSTR lpMachineName, LPSTR lpMessage, DWORD dwTimeout, BOOL bForceAppsClosed, BOOL bRebootAfterShutdown ); __declspec(dllimport) BOOL __stdcall InitiateSystemShutdownW( LPWSTR lpMachineName, LPWSTR lpMessage, DWORD dwTimeout, BOOL bForceAppsClosed, BOOL bRebootAfterShutdown ); __declspec(dllimport) BOOL __stdcall AbortSystemShutdownA( LPSTR lpMachineName ); __declspec(dllimport) BOOL __stdcall AbortSystemShutdownW( LPWSTR lpMachineName ); __declspec(dllimport) BOOL __stdcall InitiateSystemShutdownExA( LPSTR lpMachineName, LPSTR lpMessage, DWORD dwTimeout, BOOL bForceAppsClosed, BOOL bRebootAfterShutdown, DWORD dwReason ); __declspec(dllimport) BOOL __stdcall InitiateSystemShutdownExW( LPWSTR lpMachineName, LPWSTR lpMessage, DWORD dwTimeout, BOOL bForceAppsClosed, BOOL bRebootAfterShutdown, DWORD dwReason ); __declspec(dllimport) DWORD __stdcall InitiateShutdownA( LPSTR lpMachineName, LPSTR lpMessage, DWORD dwGracePeriod, DWORD dwShutdownFlags, DWORD dwReason ); __declspec(dllimport) DWORD __stdcall InitiateShutdownW( LPWSTR lpMachineName, LPWSTR lpMessage, DWORD dwGracePeriod, DWORD dwShutdownFlags, DWORD dwReason ); __declspec(dllimport) DWORD __stdcall CheckForHiberboot( PBOOLEAN pHiberboot, BOOLEAN bClearFlag ); __declspec(dllimport) LSTATUS __stdcall RegSaveKeyExA( HKEY hKey, LPCSTR lpFile, const LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD Flags ); __declspec(dllimport) LSTATUS __stdcall RegSaveKeyExW( HKEY hKey, LPCWSTR lpFile, const LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD Flags ); #pragma warning(pop) } extern "C" { #pragma warning(push) #pragma warning(disable: 4820) typedef struct _NETRESOURCEA { DWORD dwScope; DWORD dwType; DWORD dwDisplayType; DWORD dwUsage; LPSTR lpLocalName; LPSTR lpRemoteName; LPSTR lpComment ; LPSTR lpProvider; }NETRESOURCEA, *LPNETRESOURCEA; typedef struct _NETRESOURCEW { DWORD dwScope; DWORD dwType; DWORD dwDisplayType; DWORD dwUsage; LPWSTR lpLocalName; LPWSTR lpRemoteName; LPWSTR lpComment ; LPWSTR lpProvider; }NETRESOURCEW, *LPNETRESOURCEW; typedef NETRESOURCEW NETRESOURCE; typedef LPNETRESOURCEW LPNETRESOURCE; DWORD __stdcall WNetAddConnectionA( LPCSTR lpRemoteName, LPCSTR lpPassword, LPCSTR lpLocalName ); DWORD __stdcall WNetAddConnectionW( LPCWSTR lpRemoteName, LPCWSTR lpPassword, LPCWSTR lpLocalName ); DWORD __stdcall WNetAddConnection2A( LPNETRESOURCEA lpNetResource, LPCSTR lpPassword, LPCSTR lpUserName, DWORD dwFlags ); DWORD __stdcall WNetAddConnection2W( LPNETRESOURCEW lpNetResource, LPCWSTR lpPassword, LPCWSTR lpUserName, DWORD dwFlags ); DWORD __stdcall WNetAddConnection3A( HWND hwndOwner, LPNETRESOURCEA lpNetResource, LPCSTR lpPassword, LPCSTR lpUserName, DWORD dwFlags ); DWORD __stdcall WNetAddConnection3W( HWND hwndOwner, LPNETRESOURCEW lpNetResource, LPCWSTR lpPassword, LPCWSTR lpUserName, DWORD dwFlags ); DWORD __stdcall WNetCancelConnectionA( LPCSTR lpName, BOOL fForce ); DWORD __stdcall WNetCancelConnectionW( LPCWSTR lpName, BOOL fForce ); DWORD __stdcall WNetCancelConnection2A( LPCSTR lpName, DWORD dwFlags, BOOL fForce ); DWORD __stdcall WNetCancelConnection2W( LPCWSTR lpName, DWORD dwFlags, BOOL fForce ); DWORD __stdcall WNetGetConnectionA( LPCSTR lpLocalName, LPSTR lpRemoteName, LPDWORD lpnLength ); DWORD __stdcall WNetGetConnectionW( LPCWSTR lpLocalName, LPWSTR lpRemoteName, LPDWORD lpnLength ); DWORD __stdcall WNetRestoreSingleConnectionW( HWND hwndParent, LPCWSTR lpDevice, BOOL fUseUI ); DWORD __stdcall WNetUseConnectionA( HWND hwndOwner, LPNETRESOURCEA lpNetResource, LPCSTR lpPassword, LPCSTR lpUserId, DWORD dwFlags, LPSTR lpAccessName, LPDWORD lpBufferSize, LPDWORD lpResult ); DWORD __stdcall WNetUseConnectionW( HWND hwndOwner, LPNETRESOURCEW lpNetResource, LPCWSTR lpPassword, LPCWSTR lpUserId, DWORD dwFlags, LPWSTR lpAccessName, LPDWORD lpBufferSize, LPDWORD lpResult ); DWORD __stdcall WNetConnectionDialog( HWND hwnd, DWORD dwType ); DWORD __stdcall WNetDisconnectDialog( HWND hwnd, DWORD dwType ); typedef struct _CONNECTDLGSTRUCTA{ DWORD cbStructure; HWND hwndOwner; LPNETRESOURCEA lpConnRes; DWORD dwFlags; DWORD dwDevNum; } CONNECTDLGSTRUCTA, *LPCONNECTDLGSTRUCTA; typedef struct _CONNECTDLGSTRUCTW{ DWORD cbStructure; HWND hwndOwner; LPNETRESOURCEW lpConnRes; DWORD dwFlags; DWORD dwDevNum; } CONNECTDLGSTRUCTW, *LPCONNECTDLGSTRUCTW; typedef CONNECTDLGSTRUCTW CONNECTDLGSTRUCT; typedef LPCONNECTDLGSTRUCTW LPCONNECTDLGSTRUCT; DWORD __stdcall WNetConnectionDialog1A( LPCONNECTDLGSTRUCTA lpConnDlgStruct ); DWORD __stdcall WNetConnectionDialog1W( LPCONNECTDLGSTRUCTW lpConnDlgStruct ); typedef struct _DISCDLGSTRUCTA{ DWORD cbStructure; HWND hwndOwner; LPSTR lpLocalName; LPSTR lpRemoteName; DWORD dwFlags; } DISCDLGSTRUCTA, *LPDISCDLGSTRUCTA; typedef struct _DISCDLGSTRUCTW{ DWORD cbStructure; HWND hwndOwner; LPWSTR lpLocalName; LPWSTR lpRemoteName; DWORD dwFlags; } DISCDLGSTRUCTW, *LPDISCDLGSTRUCTW; typedef DISCDLGSTRUCTW DISCDLGSTRUCT; typedef LPDISCDLGSTRUCTW LPDISCDLGSTRUCT; DWORD __stdcall WNetDisconnectDialog1A( LPDISCDLGSTRUCTA lpConnDlgStruct ); DWORD __stdcall WNetDisconnectDialog1W( LPDISCDLGSTRUCTW lpConnDlgStruct ); DWORD __stdcall WNetOpenEnumA( DWORD dwScope, DWORD dwType, DWORD dwUsage, LPNETRESOURCEA lpNetResource, LPHANDLE lphEnum ); DWORD __stdcall WNetOpenEnumW( DWORD dwScope, DWORD dwType, DWORD dwUsage, LPNETRESOURCEW lpNetResource, LPHANDLE lphEnum ); DWORD __stdcall WNetEnumResourceA( HANDLE hEnum, LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize ); DWORD __stdcall WNetEnumResourceW( HANDLE hEnum, LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize ); DWORD __stdcall WNetCloseEnum( HANDLE hEnum ); DWORD __stdcall WNetGetResourceParentA( LPNETRESOURCEA lpNetResource, LPVOID lpBuffer, LPDWORD lpcbBuffer ); DWORD __stdcall WNetGetResourceParentW( LPNETRESOURCEW lpNetResource, LPVOID lpBuffer, LPDWORD lpcbBuffer ); DWORD __stdcall WNetGetResourceInformationA( LPNETRESOURCEA lpNetResource, LPVOID lpBuffer, LPDWORD lpcbBuffer, LPSTR *lplpSystem ); DWORD __stdcall WNetGetResourceInformationW( LPNETRESOURCEW lpNetResource, LPVOID lpBuffer, LPDWORD lpcbBuffer, LPWSTR *lplpSystem ); typedef struct _UNIVERSAL_NAME_INFOA { LPSTR lpUniversalName; }UNIVERSAL_NAME_INFOA, *LPUNIVERSAL_NAME_INFOA; typedef struct _UNIVERSAL_NAME_INFOW { LPWSTR lpUniversalName; }UNIVERSAL_NAME_INFOW, *LPUNIVERSAL_NAME_INFOW; typedef UNIVERSAL_NAME_INFOW UNIVERSAL_NAME_INFO; typedef LPUNIVERSAL_NAME_INFOW LPUNIVERSAL_NAME_INFO; typedef struct _REMOTE_NAME_INFOA { LPSTR lpUniversalName; LPSTR lpConnectionName; LPSTR lpRemainingPath; }REMOTE_NAME_INFOA, *LPREMOTE_NAME_INFOA; typedef struct _REMOTE_NAME_INFOW { LPWSTR lpUniversalName; LPWSTR lpConnectionName; LPWSTR lpRemainingPath; }REMOTE_NAME_INFOW, *LPREMOTE_NAME_INFOW; typedef REMOTE_NAME_INFOW REMOTE_NAME_INFO; typedef LPREMOTE_NAME_INFOW LPREMOTE_NAME_INFO; DWORD __stdcall WNetGetUniversalNameA( LPCSTR lpLocalPath, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpBufferSize ); DWORD __stdcall WNetGetUniversalNameW( LPCWSTR lpLocalPath, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpBufferSize ); DWORD __stdcall WNetGetUserA( LPCSTR lpName, LPSTR lpUserName, LPDWORD lpnLength ); DWORD __stdcall WNetGetUserW( LPCWSTR lpName, LPWSTR lpUserName, LPDWORD lpnLength ); DWORD __stdcall WNetGetProviderNameA( DWORD dwNetType, LPSTR lpProviderName, LPDWORD lpBufferSize ); DWORD __stdcall WNetGetProviderNameW( DWORD dwNetType, LPWSTR lpProviderName, LPDWORD lpBufferSize ); typedef struct _NETINFOSTRUCT{ DWORD cbStructure; DWORD dwProviderVersion; DWORD dwStatus; DWORD dwCharacteristics; ULONG_PTR dwHandle; WORD wNetType; DWORD dwPrinters; DWORD dwDrives; } NETINFOSTRUCT, *LPNETINFOSTRUCT; DWORD __stdcall WNetGetNetworkInformationA( LPCSTR lpProvider, LPNETINFOSTRUCT lpNetInfoStruct ); DWORD __stdcall WNetGetNetworkInformationW( LPCWSTR lpProvider, LPNETINFOSTRUCT lpNetInfoStruct ); DWORD __stdcall WNetGetLastErrorA( LPDWORD lpError, LPSTR lpErrorBuf, DWORD nErrorBufSize, LPSTR lpNameBuf, DWORD nNameBufSize ); DWORD __stdcall WNetGetLastErrorW( LPDWORD lpError, LPWSTR lpErrorBuf, DWORD nErrorBufSize, LPWSTR lpNameBuf, DWORD nNameBufSize ); typedef struct _NETCONNECTINFOSTRUCT{ DWORD cbStructure; DWORD dwFlags; DWORD dwSpeed; DWORD dwDelay; DWORD dwOptDataSize; } NETCONNECTINFOSTRUCT, *LPNETCONNECTINFOSTRUCT; DWORD __stdcall MultinetGetConnectionPerformanceA( LPNETRESOURCEA lpNetResource, LPNETCONNECTINFOSTRUCT lpNetConnectInfoStruct ); DWORD __stdcall MultinetGetConnectionPerformanceW( LPNETRESOURCEW lpNetResource, LPNETCONNECTINFOSTRUCT lpNetConnectInfoStruct ); #pragma warning(pop) } extern "C" { #pragma warning(push) #pragma warning(disable: 4127) LPUWSTR __stdcall uaw_CharUpperW( LPUWSTR String ); int __stdcall uaw_lstrcmpW( PCUWSTR String1, PCUWSTR String2 ); int __stdcall uaw_lstrcmpiW( PCUWSTR String1, PCUWSTR String2 ); int __stdcall uaw_lstrlenW( LPCUWSTR String ); PUWSTR __cdecl uaw_wcschr( PCUWSTR String, WCHAR Character ); PUWSTR __cdecl uaw_wcscpy( PUWSTR Destination, PCUWSTR Source ); int __cdecl uaw_wcsicmp( PCUWSTR String1, PCUWSTR String2 ); size_t __cdecl uaw_wcslen( PCUWSTR String ); PUWSTR __cdecl uaw_wcsrchr( PCUWSTR String, WCHAR Character ); __inline LPUWSTR static ua_CharUpperW( LPUWSTR String ) { if (1) { return CharUpperW( (PWSTR)String ); } else { return uaw_CharUpperW( String ); } } __inline int static ua_lstrcmpW( LPCUWSTR String1, LPCUWSTR String2 ) { if (1 && 1) { return lstrcmpW( (LPCWSTR)String1, (LPCWSTR)String2); } else { return uaw_lstrcmpW( String1, String2 ); } } __inline int static ua_lstrcmpiW( LPCUWSTR String1, LPCUWSTR String2 ) { if (1 && 1) { return lstrcmpiW( (LPCWSTR)String1, (LPCWSTR)String2 ); } else { return uaw_lstrcmpiW( String1, String2 ); } } __inline int static ua_lstrlenW( LPCUWSTR String ) { if (1) { #pragma warning(suppress: 28750) return lstrlenW( (PCWSTR)String ); } else { return uaw_lstrlenW( String ); } } typedef const WCHAR __unaligned *PUWSTR_C; __inline PUWSTR_C static ua_wcschr( PCUWSTR String, WCHAR Character ) { if (1) { return wcschr((PCWSTR)String, Character); } else { return (PUWSTR_C)uaw_wcschr(String, Character); } } __inline PUWSTR_C static ua_wcsrchr( PCUWSTR String, WCHAR Character ) { if (1) { return wcsrchr((PCWSTR)String, Character); } else { return (PUWSTR_C)uaw_wcsrchr(String, Character); } } __inline PUWSTR static __declspec(deprecated) ua_wcscpy( PUWSTR Destination, PCUWSTR Source ) { if (1 && 1) { #pragma warning(push) #pragma warning(disable: 4995) #pragma warning(disable: 4996) return wcscpy( (PWSTR)Destination, (PCWSTR)Source ); #pragma warning(pop) } else { return uaw_wcscpy( Destination, Source ); } } __inline PUWSTR static ua_wcscpy_s( PUWSTR Destination, size_t DestinationSize, PCUWSTR Source ) { if (1 && 1) { return (wcscpy_s( (PWSTR)Destination, DestinationSize, (PCWSTR)Source ) == 0 ? Destination : 0); } else { return uaw_wcscpy( Destination, Source ); } } __inline size_t static ua_wcslen( PCUWSTR String ) { if (1) { return wcslen( (PCWSTR)String ); } else { return uaw_wcslen( String ); } } __inline int static ua_wcsicmp( PCUWSTR String1, PCUWSTR String2 ) { if (1 && 1) { return _wcsicmp( (LPCWSTR)String1, (LPCWSTR)String2 ); } else { return uaw_wcsicmp( String1, String2 ); } } #pragma warning(pop) } #pragma warning(push) #pragma warning(disable: 4820) extern "C" { extern "C" const GUID NETWORK_MANAGER_FIRST_IP_ADDRESS_ARRIVAL_GUID; extern "C" const GUID NETWORK_MANAGER_LAST_IP_ADDRESS_REMOVAL_GUID; extern "C" const GUID DOMAIN_JOIN_GUID; extern "C" const GUID DOMAIN_LEAVE_GUID; extern "C" const GUID FIREWALL_PORT_OPEN_GUID; extern "C" const GUID FIREWALL_PORT_CLOSE_GUID; extern "C" const GUID MACHINE_POLICY_PRESENT_GUID; extern "C" const GUID USER_POLICY_PRESENT_GUID; extern "C" const GUID RPC_INTERFACE_EVENT_GUID; extern "C" const GUID NAMED_PIPE_EVENT_GUID; extern "C" const GUID CUSTOM_SYSTEM_STATE_CHANGE_EVENT_GUID; typedef struct { DWORD Data[2]; } SERVICE_TRIGGER_CUSTOM_STATE_ID; typedef struct _SERVICE_CUSTOM_SYSTEM_STATE_CHANGE_DATA_ITEM { union { SERVICE_TRIGGER_CUSTOM_STATE_ID CustomStateId; struct { DWORD DataOffset; BYTE Data[1]; } s; } u; } SERVICE_CUSTOM_SYSTEM_STATE_CHANGE_DATA_ITEM, *LPSERVICE_CUSTOM_SYSTEM_STATE_CHANGE_DATA_ITEM; typedef struct _SERVICE_DESCRIPTIONA { LPSTR lpDescription; } SERVICE_DESCRIPTIONA, *LPSERVICE_DESCRIPTIONA; typedef struct _SERVICE_DESCRIPTIONW { LPWSTR lpDescription; } SERVICE_DESCRIPTIONW, *LPSERVICE_DESCRIPTIONW; typedef SERVICE_DESCRIPTIONW SERVICE_DESCRIPTION; typedef LPSERVICE_DESCRIPTIONW LPSERVICE_DESCRIPTION; typedef enum _SC_ACTION_TYPE { SC_ACTION_NONE = 0, SC_ACTION_RESTART = 1, SC_ACTION_REBOOT = 2, SC_ACTION_RUN_COMMAND = 3, SC_ACTION_OWN_RESTART = 4 } SC_ACTION_TYPE; typedef struct _SC_ACTION { SC_ACTION_TYPE Type; DWORD Delay; } SC_ACTION, *LPSC_ACTION; typedef struct _SERVICE_FAILURE_ACTIONSA { DWORD dwResetPeriod; LPSTR lpRebootMsg; LPSTR lpCommand; DWORD cActions; SC_ACTION * lpsaActions; } SERVICE_FAILURE_ACTIONSA, *LPSERVICE_FAILURE_ACTIONSA; typedef struct _SERVICE_FAILURE_ACTIONSW { DWORD dwResetPeriod; LPWSTR lpRebootMsg; LPWSTR lpCommand; DWORD cActions; SC_ACTION * lpsaActions; } SERVICE_FAILURE_ACTIONSW, *LPSERVICE_FAILURE_ACTIONSW; typedef SERVICE_FAILURE_ACTIONSW SERVICE_FAILURE_ACTIONS; typedef LPSERVICE_FAILURE_ACTIONSW LPSERVICE_FAILURE_ACTIONS; typedef struct _SERVICE_DELAYED_AUTO_START_INFO { BOOL fDelayedAutostart; } SERVICE_DELAYED_AUTO_START_INFO, *LPSERVICE_DELAYED_AUTO_START_INFO; typedef struct _SERVICE_FAILURE_ACTIONS_FLAG { BOOL fFailureActionsOnNonCrashFailures; } SERVICE_FAILURE_ACTIONS_FLAG, *LPSERVICE_FAILURE_ACTIONS_FLAG; typedef struct _SERVICE_SID_INFO { DWORD dwServiceSidType; } SERVICE_SID_INFO, *LPSERVICE_SID_INFO; typedef struct _SERVICE_REQUIRED_PRIVILEGES_INFOA { LPSTR pmszRequiredPrivileges; } SERVICE_REQUIRED_PRIVILEGES_INFOA, *LPSERVICE_REQUIRED_PRIVILEGES_INFOA; typedef struct _SERVICE_REQUIRED_PRIVILEGES_INFOW { LPWSTR pmszRequiredPrivileges; } SERVICE_REQUIRED_PRIVILEGES_INFOW, *LPSERVICE_REQUIRED_PRIVILEGES_INFOW; typedef SERVICE_REQUIRED_PRIVILEGES_INFOW SERVICE_REQUIRED_PRIVILEGES_INFO; typedef LPSERVICE_REQUIRED_PRIVILEGES_INFOW LPSERVICE_REQUIRED_PRIVILEGES_INFO; typedef struct _SERVICE_PRESHUTDOWN_INFO { DWORD dwPreshutdownTimeout; } SERVICE_PRESHUTDOWN_INFO, *LPSERVICE_PRESHUTDOWN_INFO; typedef struct _SERVICE_TRIGGER_SPECIFIC_DATA_ITEM { DWORD dwDataType; DWORD cbData; PBYTE pData; } SERVICE_TRIGGER_SPECIFIC_DATA_ITEM, *PSERVICE_TRIGGER_SPECIFIC_DATA_ITEM; typedef struct _SERVICE_TRIGGER { DWORD dwTriggerType; DWORD dwAction; GUID * pTriggerSubtype; DWORD cDataItems; PSERVICE_TRIGGER_SPECIFIC_DATA_ITEM pDataItems; } SERVICE_TRIGGER, *PSERVICE_TRIGGER; typedef struct _SERVICE_TRIGGER_INFO { DWORD cTriggers; PSERVICE_TRIGGER pTriggers; PBYTE pReserved; } SERVICE_TRIGGER_INFO, *PSERVICE_TRIGGER_INFO; typedef struct _SERVICE_PREFERRED_NODE_INFO { USHORT usPreferredNode; BOOLEAN fDelete; } SERVICE_PREFERRED_NODE_INFO, *LPSERVICE_PREFERRED_NODE_INFO; typedef struct _SERVICE_TIMECHANGE_INFO { LARGE_INTEGER liNewTime; LARGE_INTEGER liOldTime; } SERVICE_TIMECHANGE_INFO, *PSERVICE_TIMECHANGE_INFO; typedef struct _SERVICE_LAUNCH_PROTECTED_INFO { DWORD dwLaunchProtected; } SERVICE_LAUNCH_PROTECTED_INFO, *PSERVICE_LAUNCH_PROTECTED_INFO; struct SC_HANDLE__{int unused;}; typedef struct SC_HANDLE__ *SC_HANDLE; typedef SC_HANDLE *LPSC_HANDLE; struct SERVICE_STATUS_HANDLE__{int unused;}; typedef struct SERVICE_STATUS_HANDLE__ *SERVICE_STATUS_HANDLE; typedef enum _SC_STATUS_TYPE { SC_STATUS_PROCESS_INFO = 0 } SC_STATUS_TYPE; typedef enum _SC_ENUM_TYPE { SC_ENUM_PROCESS_INFO = 0 } SC_ENUM_TYPE; typedef struct _SERVICE_STATUS { DWORD dwServiceType; DWORD dwCurrentState; DWORD dwControlsAccepted; DWORD dwWin32ExitCode; DWORD dwServiceSpecificExitCode; DWORD dwCheckPoint; DWORD dwWaitHint; } SERVICE_STATUS, *LPSERVICE_STATUS; typedef struct _SERVICE_STATUS_PROCESS { DWORD dwServiceType; DWORD dwCurrentState; DWORD dwControlsAccepted; DWORD dwWin32ExitCode; DWORD dwServiceSpecificExitCode; DWORD dwCheckPoint; DWORD dwWaitHint; DWORD dwProcessId; DWORD dwServiceFlags; } SERVICE_STATUS_PROCESS, *LPSERVICE_STATUS_PROCESS; typedef struct _ENUM_SERVICE_STATUSA { LPSTR lpServiceName; LPSTR lpDisplayName; SERVICE_STATUS ServiceStatus; } ENUM_SERVICE_STATUSA, *LPENUM_SERVICE_STATUSA; typedef struct _ENUM_SERVICE_STATUSW { LPWSTR lpServiceName; LPWSTR lpDisplayName; SERVICE_STATUS ServiceStatus; } ENUM_SERVICE_STATUSW, *LPENUM_SERVICE_STATUSW; typedef ENUM_SERVICE_STATUSW ENUM_SERVICE_STATUS; typedef LPENUM_SERVICE_STATUSW LPENUM_SERVICE_STATUS; typedef struct _ENUM_SERVICE_STATUS_PROCESSA { LPSTR lpServiceName; LPSTR lpDisplayName; SERVICE_STATUS_PROCESS ServiceStatusProcess; } ENUM_SERVICE_STATUS_PROCESSA, *LPENUM_SERVICE_STATUS_PROCESSA; typedef struct _ENUM_SERVICE_STATUS_PROCESSW { LPWSTR lpServiceName; LPWSTR lpDisplayName; SERVICE_STATUS_PROCESS ServiceStatusProcess; } ENUM_SERVICE_STATUS_PROCESSW, *LPENUM_SERVICE_STATUS_PROCESSW; typedef ENUM_SERVICE_STATUS_PROCESSW ENUM_SERVICE_STATUS_PROCESS; typedef LPENUM_SERVICE_STATUS_PROCESSW LPENUM_SERVICE_STATUS_PROCESS; typedef LPVOID SC_LOCK; typedef struct _QUERY_SERVICE_LOCK_STATUSA { DWORD fIsLocked; LPSTR lpLockOwner; DWORD dwLockDuration; } QUERY_SERVICE_LOCK_STATUSA, *LPQUERY_SERVICE_LOCK_STATUSA; typedef struct _QUERY_SERVICE_LOCK_STATUSW { DWORD fIsLocked; LPWSTR lpLockOwner; DWORD dwLockDuration; } QUERY_SERVICE_LOCK_STATUSW, *LPQUERY_SERVICE_LOCK_STATUSW; typedef QUERY_SERVICE_LOCK_STATUSW QUERY_SERVICE_LOCK_STATUS; typedef LPQUERY_SERVICE_LOCK_STATUSW LPQUERY_SERVICE_LOCK_STATUS; typedef struct _QUERY_SERVICE_CONFIGA { DWORD dwServiceType; DWORD dwStartType; DWORD dwErrorControl; LPSTR lpBinaryPathName; LPSTR lpLoadOrderGroup; DWORD dwTagId; LPSTR lpDependencies; LPSTR lpServiceStartName; LPSTR lpDisplayName; } QUERY_SERVICE_CONFIGA, *LPQUERY_SERVICE_CONFIGA; typedef struct _QUERY_SERVICE_CONFIGW { DWORD dwServiceType; DWORD dwStartType; DWORD dwErrorControl; LPWSTR lpBinaryPathName; LPWSTR lpLoadOrderGroup; DWORD dwTagId; LPWSTR lpDependencies; LPWSTR lpServiceStartName; LPWSTR lpDisplayName; } QUERY_SERVICE_CONFIGW, *LPQUERY_SERVICE_CONFIGW; typedef QUERY_SERVICE_CONFIGW QUERY_SERVICE_CONFIG; typedef LPQUERY_SERVICE_CONFIGW LPQUERY_SERVICE_CONFIG; typedef void __stdcall SERVICE_MAIN_FUNCTIONW ( DWORD dwNumServicesArgs, LPWSTR *lpServiceArgVectors ); typedef void __stdcall SERVICE_MAIN_FUNCTIONA ( DWORD dwNumServicesArgs, LPTSTR *lpServiceArgVectors ); typedef void (__stdcall *LPSERVICE_MAIN_FUNCTIONW)( DWORD dwNumServicesArgs, LPWSTR *lpServiceArgVectors ); typedef void (__stdcall *LPSERVICE_MAIN_FUNCTIONA)( DWORD dwNumServicesArgs, LPSTR *lpServiceArgVectors ); typedef struct _SERVICE_TABLE_ENTRYA { LPSTR lpServiceName; LPSERVICE_MAIN_FUNCTIONA lpServiceProc; }SERVICE_TABLE_ENTRYA, *LPSERVICE_TABLE_ENTRYA; typedef struct _SERVICE_TABLE_ENTRYW { LPWSTR lpServiceName; LPSERVICE_MAIN_FUNCTIONW lpServiceProc; }SERVICE_TABLE_ENTRYW, *LPSERVICE_TABLE_ENTRYW; typedef SERVICE_TABLE_ENTRYW SERVICE_TABLE_ENTRY; typedef LPSERVICE_TABLE_ENTRYW LPSERVICE_TABLE_ENTRY; typedef void __stdcall HANDLER_FUNCTION ( DWORD dwControl ); typedef DWORD __stdcall HANDLER_FUNCTION_EX ( DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext ); typedef void (__stdcall *LPHANDLER_FUNCTION)( DWORD dwControl ); typedef DWORD (__stdcall *LPHANDLER_FUNCTION_EX)( DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext ); typedef void ( __stdcall * PFN_SC_NOTIFY_CALLBACK ) ( PVOID pParameter ); typedef struct _SERVICE_NOTIFY_1 { DWORD dwVersion; PFN_SC_NOTIFY_CALLBACK pfnNotifyCallback; PVOID pContext; DWORD dwNotificationStatus; SERVICE_STATUS_PROCESS ServiceStatus; } SERVICE_NOTIFY_1, *PSERVICE_NOTIFY_1; typedef struct _SERVICE_NOTIFY_2A { DWORD dwVersion; PFN_SC_NOTIFY_CALLBACK pfnNotifyCallback; PVOID pContext; DWORD dwNotificationStatus; SERVICE_STATUS_PROCESS ServiceStatus; DWORD dwNotificationTriggered; LPSTR pszServiceNames; } SERVICE_NOTIFY_2A, *PSERVICE_NOTIFY_2A; typedef struct _SERVICE_NOTIFY_2W { DWORD dwVersion; PFN_SC_NOTIFY_CALLBACK pfnNotifyCallback; PVOID pContext; DWORD dwNotificationStatus; SERVICE_STATUS_PROCESS ServiceStatus; DWORD dwNotificationTriggered; LPWSTR pszServiceNames; } SERVICE_NOTIFY_2W, *PSERVICE_NOTIFY_2W; typedef SERVICE_NOTIFY_2W SERVICE_NOTIFY_2; typedef PSERVICE_NOTIFY_2W PSERVICE_NOTIFY_2; typedef SERVICE_NOTIFY_2A SERVICE_NOTIFYA, *PSERVICE_NOTIFYA; typedef SERVICE_NOTIFY_2W SERVICE_NOTIFYW, *PSERVICE_NOTIFYW; typedef SERVICE_NOTIFYW SERVICE_NOTIFY; typedef PSERVICE_NOTIFYW PSERVICE_NOTIFY; typedef struct _SERVICE_CONTROL_STATUS_REASON_PARAMSA { DWORD dwReason; LPSTR pszComment; SERVICE_STATUS_PROCESS ServiceStatus; } SERVICE_CONTROL_STATUS_REASON_PARAMSA, *PSERVICE_CONTROL_STATUS_REASON_PARAMSA; typedef struct _SERVICE_CONTROL_STATUS_REASON_PARAMSW { DWORD dwReason; LPWSTR pszComment; SERVICE_STATUS_PROCESS ServiceStatus; } SERVICE_CONTROL_STATUS_REASON_PARAMSW, *PSERVICE_CONTROL_STATUS_REASON_PARAMSW; typedef SERVICE_CONTROL_STATUS_REASON_PARAMSW SERVICE_CONTROL_STATUS_REASON_PARAMS; typedef PSERVICE_CONTROL_STATUS_REASON_PARAMSW PSERVICE_CONTROL_STATUS_REASON_PARAMS; typedef struct _SERVICE_START_REASON { DWORD dwReason; } SERVICE_START_REASON, *PSERVICE_START_REASON; __declspec(dllimport) BOOL __stdcall ChangeServiceConfigA( SC_HANDLE hService, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPCSTR lpBinaryPathName, LPCSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPCSTR lpDependencies, LPCSTR lpServiceStartName, LPCSTR lpPassword, LPCSTR lpDisplayName ); __declspec(dllimport) BOOL __stdcall ChangeServiceConfigW( SC_HANDLE hService, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPCWSTR lpBinaryPathName, LPCWSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPCWSTR lpDependencies, LPCWSTR lpServiceStartName, LPCWSTR lpPassword, LPCWSTR lpDisplayName ); __declspec(dllimport) BOOL __stdcall ChangeServiceConfig2A( SC_HANDLE hService, DWORD dwInfoLevel, LPVOID lpInfo ); __declspec(dllimport) BOOL __stdcall ChangeServiceConfig2W( SC_HANDLE hService, DWORD dwInfoLevel, LPVOID lpInfo ); __declspec(dllimport) BOOL __stdcall CloseServiceHandle( SC_HANDLE hSCObject ); __declspec(dllimport) BOOL __stdcall ControlService( SC_HANDLE hService, DWORD dwControl, LPSERVICE_STATUS lpServiceStatus ); __declspec(dllimport) SC_HANDLE __stdcall CreateServiceA( SC_HANDLE hSCManager, LPCSTR lpServiceName, LPCSTR lpDisplayName, DWORD dwDesiredAccess, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPCSTR lpBinaryPathName, LPCSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPCSTR lpDependencies, LPCSTR lpServiceStartName, LPCSTR lpPassword ); __declspec(dllimport) SC_HANDLE __stdcall CreateServiceW( SC_HANDLE hSCManager, LPCWSTR lpServiceName, LPCWSTR lpDisplayName, DWORD dwDesiredAccess, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPCWSTR lpBinaryPathName, LPCWSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPCWSTR lpDependencies, LPCWSTR lpServiceStartName, LPCWSTR lpPassword ); __declspec(dllimport) BOOL __stdcall DeleteService( SC_HANDLE hService ); __declspec(dllimport) BOOL __stdcall EnumDependentServicesA( SC_HANDLE hService, DWORD dwServiceState, LPENUM_SERVICE_STATUSA lpServices, DWORD cbBufSize, LPDWORD pcbBytesNeeded, LPDWORD lpServicesReturned ); __declspec(dllimport) BOOL __stdcall EnumDependentServicesW( SC_HANDLE hService, DWORD dwServiceState, LPENUM_SERVICE_STATUSW lpServices, DWORD cbBufSize, LPDWORD pcbBytesNeeded, LPDWORD lpServicesReturned ); __declspec(dllimport) BOOL __stdcall EnumServicesStatusA( SC_HANDLE hSCManager, DWORD dwServiceType, DWORD dwServiceState, LPENUM_SERVICE_STATUSA lpServices, DWORD cbBufSize, LPDWORD pcbBytesNeeded, LPDWORD lpServicesReturned, LPDWORD lpResumeHandle ); __declspec(dllimport) BOOL __stdcall EnumServicesStatusW( SC_HANDLE hSCManager, DWORD dwServiceType, DWORD dwServiceState, LPENUM_SERVICE_STATUSW lpServices, DWORD cbBufSize, LPDWORD pcbBytesNeeded, LPDWORD lpServicesReturned, LPDWORD lpResumeHandle ); __declspec(dllimport) BOOL __stdcall EnumServicesStatusExA( SC_HANDLE hSCManager, SC_ENUM_TYPE InfoLevel, DWORD dwServiceType, DWORD dwServiceState, LPBYTE lpServices, DWORD cbBufSize, LPDWORD pcbBytesNeeded, LPDWORD lpServicesReturned, LPDWORD lpResumeHandle, LPCSTR pszGroupName ); __declspec(dllimport) BOOL __stdcall EnumServicesStatusExW( SC_HANDLE hSCManager, SC_ENUM_TYPE InfoLevel, DWORD dwServiceType, DWORD dwServiceState, LPBYTE lpServices, DWORD cbBufSize, LPDWORD pcbBytesNeeded, LPDWORD lpServicesReturned, LPDWORD lpResumeHandle, LPCWSTR pszGroupName ); __declspec(dllimport) BOOL __stdcall GetServiceKeyNameA( SC_HANDLE hSCManager, LPCSTR lpDisplayName, LPSTR lpServiceName, LPDWORD lpcchBuffer ); __declspec(dllimport) BOOL __stdcall GetServiceKeyNameW( SC_HANDLE hSCManager, LPCWSTR lpDisplayName, LPWSTR lpServiceName, LPDWORD lpcchBuffer ); __declspec(dllimport) BOOL __stdcall GetServiceDisplayNameA( SC_HANDLE hSCManager, LPCSTR lpServiceName, LPSTR lpDisplayName, LPDWORD lpcchBuffer ); __declspec(dllimport) BOOL __stdcall GetServiceDisplayNameW( SC_HANDLE hSCManager, LPCWSTR lpServiceName, LPWSTR lpDisplayName, LPDWORD lpcchBuffer ); __declspec(dllimport) SC_LOCK __stdcall LockServiceDatabase( SC_HANDLE hSCManager ); __declspec(dllimport) BOOL __stdcall NotifyBootConfigStatus( BOOL BootAcceptable ); __declspec(dllimport) SC_HANDLE __stdcall OpenSCManagerA( LPCSTR lpMachineName, LPCSTR lpDatabaseName, DWORD dwDesiredAccess ); __declspec(dllimport) SC_HANDLE __stdcall OpenSCManagerW( LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess ); __declspec(dllimport) SC_HANDLE __stdcall OpenServiceA( SC_HANDLE hSCManager, LPCSTR lpServiceName, DWORD dwDesiredAccess ); __declspec(dllimport) SC_HANDLE __stdcall OpenServiceW( SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess ); __declspec(dllimport) BOOL __stdcall QueryServiceConfigA( SC_HANDLE hService, LPQUERY_SERVICE_CONFIGA lpServiceConfig, DWORD cbBufSize, LPDWORD pcbBytesNeeded ); __declspec(dllimport) BOOL __stdcall QueryServiceConfigW( SC_HANDLE hService, LPQUERY_SERVICE_CONFIGW lpServiceConfig, DWORD cbBufSize, LPDWORD pcbBytesNeeded ); __declspec(dllimport) BOOL __stdcall QueryServiceConfig2A( SC_HANDLE hService, DWORD dwInfoLevel, LPBYTE lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded ); __declspec(dllimport) BOOL __stdcall QueryServiceConfig2W( SC_HANDLE hService, DWORD dwInfoLevel, LPBYTE lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded ); __declspec(dllimport) BOOL __stdcall QueryServiceLockStatusA( SC_HANDLE hSCManager, LPQUERY_SERVICE_LOCK_STATUSA lpLockStatus, DWORD cbBufSize, LPDWORD pcbBytesNeeded ); __declspec(dllimport) BOOL __stdcall QueryServiceLockStatusW( SC_HANDLE hSCManager, LPQUERY_SERVICE_LOCK_STATUSW lpLockStatus, DWORD cbBufSize, LPDWORD pcbBytesNeeded ); __declspec(dllimport) BOOL __stdcall QueryServiceObjectSecurity( SC_HANDLE hService, SECURITY_INFORMATION dwSecurityInformation, PSECURITY_DESCRIPTOR lpSecurityDescriptor, DWORD cbBufSize, LPDWORD pcbBytesNeeded ); __declspec(dllimport) BOOL __stdcall QueryServiceStatus( SC_HANDLE hService, LPSERVICE_STATUS lpServiceStatus ); __declspec(dllimport) BOOL __stdcall QueryServiceStatusEx( SC_HANDLE hService, SC_STATUS_TYPE InfoLevel, LPBYTE lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded ); __declspec(dllimport) SERVICE_STATUS_HANDLE __stdcall RegisterServiceCtrlHandlerA( LPCSTR lpServiceName, LPHANDLER_FUNCTION lpHandlerProc ); __declspec(dllimport) SERVICE_STATUS_HANDLE __stdcall RegisterServiceCtrlHandlerW( LPCWSTR lpServiceName, LPHANDLER_FUNCTION lpHandlerProc ); __declspec(dllimport) SERVICE_STATUS_HANDLE __stdcall RegisterServiceCtrlHandlerExA( LPCSTR lpServiceName, LPHANDLER_FUNCTION_EX lpHandlerProc, LPVOID lpContext ); __declspec(dllimport) SERVICE_STATUS_HANDLE __stdcall RegisterServiceCtrlHandlerExW( LPCWSTR lpServiceName, LPHANDLER_FUNCTION_EX lpHandlerProc, LPVOID lpContext ); __declspec(dllimport) BOOL __stdcall SetServiceObjectSecurity( SC_HANDLE hService, SECURITY_INFORMATION dwSecurityInformation, PSECURITY_DESCRIPTOR lpSecurityDescriptor ); __declspec(dllimport) BOOL __stdcall SetServiceStatus( SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus ); __declspec(dllimport) BOOL __stdcall StartServiceCtrlDispatcherA( const SERVICE_TABLE_ENTRYA *lpServiceStartTable ); __declspec(dllimport) BOOL __stdcall StartServiceCtrlDispatcherW( const SERVICE_TABLE_ENTRYW *lpServiceStartTable ); __declspec(dllimport) BOOL __stdcall StartServiceA( SC_HANDLE hService, DWORD dwNumServiceArgs, LPCSTR *lpServiceArgVectors ); __declspec(dllimport) BOOL __stdcall StartServiceW( SC_HANDLE hService, DWORD dwNumServiceArgs, LPCWSTR *lpServiceArgVectors ); __declspec(dllimport) BOOL __stdcall UnlockServiceDatabase( SC_LOCK ScLock ); __declspec(dllimport) DWORD __stdcall NotifyServiceStatusChangeA ( SC_HANDLE hService, DWORD dwNotifyMask, PSERVICE_NOTIFYA pNotifyBuffer ); __declspec(dllimport) DWORD __stdcall NotifyServiceStatusChangeW ( SC_HANDLE hService, DWORD dwNotifyMask, PSERVICE_NOTIFYW pNotifyBuffer ); __declspec(dllimport) BOOL __stdcall ControlServiceExA( SC_HANDLE hService, DWORD dwControl, DWORD dwInfoLevel, PVOID pControlParams ); __declspec(dllimport) BOOL __stdcall ControlServiceExW( SC_HANDLE hService, DWORD dwControl, DWORD dwInfoLevel, PVOID pControlParams ); __declspec(dllimport) BOOL __stdcall QueryServiceDynamicInformation ( SERVICE_STATUS_HANDLE hServiceStatus, DWORD dwInfoLevel, PVOID * ppDynamicInfo ); typedef enum _SC_EVENT_TYPE { SC_EVENT_DATABASE_CHANGE, SC_EVENT_PROPERTY_CHANGE, SC_EVENT_STATUS_CHANGE } SC_EVENT_TYPE, *PSC_EVENT_TYPE; typedef void __stdcall SC_NOTIFICATION_CALLBACK ( DWORD dwNotify, PVOID pCallbackContext ); typedef SC_NOTIFICATION_CALLBACK* PSC_NOTIFICATION_CALLBACK; typedef struct _SC_NOTIFICATION_REGISTRATION* PSC_NOTIFICATION_REGISTRATION; __declspec(dllimport) DWORD __stdcall SubscribeServiceChangeNotifications ( SC_HANDLE hService, SC_EVENT_TYPE eEventType, PSC_NOTIFICATION_CALLBACK pCallback, PVOID pCallbackContext, PSC_NOTIFICATION_REGISTRATION* pSubscription ); __declspec(dllimport) void __stdcall UnsubscribeServiceChangeNotifications ( PSC_NOTIFICATION_REGISTRATION pSubscription ); __declspec(dllimport) DWORD __stdcall WaitServiceState ( SC_HANDLE hService, DWORD dwNotify, DWORD dwTimeout, HANDLE hCancelEvent ); } #pragma warning(pop) #pragma warning(push) #pragma warning(disable: 4820) typedef struct _MODEMDEVCAPS { DWORD dwActualSize; DWORD dwRequiredSize; DWORD dwDevSpecificOffset; DWORD dwDevSpecificSize; DWORD dwModemProviderVersion; DWORD dwModemManufacturerOffset; DWORD dwModemManufacturerSize; DWORD dwModemModelOffset; DWORD dwModemModelSize; DWORD dwModemVersionOffset; DWORD dwModemVersionSize; DWORD dwDialOptions; DWORD dwCallSetupFailTimer; DWORD dwInactivityTimeout; DWORD dwSpeakerVolume; DWORD dwSpeakerMode; DWORD dwModemOptions; DWORD dwMaxDTERate; DWORD dwMaxDCERate; BYTE abVariablePortion [1]; } MODEMDEVCAPS, *PMODEMDEVCAPS, *LPMODEMDEVCAPS; typedef struct _MODEMSETTINGS { DWORD dwActualSize; DWORD dwRequiredSize; DWORD dwDevSpecificOffset; DWORD dwDevSpecificSize; DWORD dwCallSetupFailTimer; DWORD dwInactivityTimeout; DWORD dwSpeakerVolume; DWORD dwSpeakerMode; DWORD dwPreferredModemOptions; DWORD dwNegotiatedModemOptions; DWORD dwNegotiatedDCERate; BYTE abVariablePortion [1]; } MODEMSETTINGS, *PMODEMSETTINGS, *LPMODEMSETTINGS; #pragma warning(pop) extern "C" { #pragma warning(push) #pragma warning(disable: 4820) struct HIMC__{int unused;}; typedef struct HIMC__ *HIMC; struct HIMCC__{int unused;}; typedef struct HIMCC__ *HIMCC; typedef HKL *LPHKL; typedef UINT *LPUINT; typedef struct tagCOMPOSITIONFORM { DWORD dwStyle; POINT ptCurrentPos; RECT rcArea; } COMPOSITIONFORM, *PCOMPOSITIONFORM, *NPCOMPOSITIONFORM, *LPCOMPOSITIONFORM; typedef struct tagCANDIDATEFORM { DWORD dwIndex; DWORD dwStyle; POINT ptCurrentPos; RECT rcArea; } CANDIDATEFORM, *PCANDIDATEFORM, *NPCANDIDATEFORM, *LPCANDIDATEFORM; typedef struct tagCANDIDATELIST { DWORD dwSize; DWORD dwStyle; DWORD dwCount; DWORD dwSelection; DWORD dwPageStart; DWORD dwPageSize; DWORD dwOffset[1]; } CANDIDATELIST, *PCANDIDATELIST, *NPCANDIDATELIST, *LPCANDIDATELIST; typedef struct tagREGISTERWORDA { LPSTR lpReading; LPSTR lpWord; } REGISTERWORDA, *PREGISTERWORDA, *NPREGISTERWORDA, *LPREGISTERWORDA; typedef struct tagREGISTERWORDW { LPWSTR lpReading; LPWSTR lpWord; } REGISTERWORDW, *PREGISTERWORDW, *NPREGISTERWORDW, *LPREGISTERWORDW; typedef REGISTERWORDW REGISTERWORD; typedef PREGISTERWORDW PREGISTERWORD; typedef NPREGISTERWORDW NPREGISTERWORD; typedef LPREGISTERWORDW LPREGISTERWORD; typedef struct tagRECONVERTSTRING { DWORD dwSize; DWORD dwVersion; DWORD dwStrLen; DWORD dwStrOffset; DWORD dwCompStrLen; DWORD dwCompStrOffset; DWORD dwTargetStrLen; DWORD dwTargetStrOffset; } RECONVERTSTRING, *PRECONVERTSTRING, *NPRECONVERTSTRING, *LPRECONVERTSTRING; typedef struct tagSTYLEBUFA { DWORD dwStyle; CHAR szDescription[32]; } STYLEBUFA, *PSTYLEBUFA, *NPSTYLEBUFA, *LPSTYLEBUFA; typedef struct tagSTYLEBUFW { DWORD dwStyle; WCHAR szDescription[32]; } STYLEBUFW, *PSTYLEBUFW, *NPSTYLEBUFW, *LPSTYLEBUFW; typedef STYLEBUFW STYLEBUF; typedef PSTYLEBUFW PSTYLEBUF; typedef NPSTYLEBUFW NPSTYLEBUF; typedef LPSTYLEBUFW LPSTYLEBUF; typedef struct tagIMEMENUITEMINFOA { UINT cbSize; UINT fType; UINT fState; UINT wID; HBITMAP hbmpChecked; HBITMAP hbmpUnchecked; DWORD dwItemData; CHAR szString[80]; HBITMAP hbmpItem; } IMEMENUITEMINFOA, *PIMEMENUITEMINFOA, *NPIMEMENUITEMINFOA, *LPIMEMENUITEMINFOA; typedef struct tagIMEMENUITEMINFOW { UINT cbSize; UINT fType; UINT fState; UINT wID; HBITMAP hbmpChecked; HBITMAP hbmpUnchecked; DWORD dwItemData; WCHAR szString[80]; HBITMAP hbmpItem; } IMEMENUITEMINFOW, *PIMEMENUITEMINFOW, *NPIMEMENUITEMINFOW, *LPIMEMENUITEMINFOW; typedef IMEMENUITEMINFOW IMEMENUITEMINFO; typedef PIMEMENUITEMINFOW PIMEMENUITEMINFO; typedef NPIMEMENUITEMINFOW NPIMEMENUITEMINFO; typedef LPIMEMENUITEMINFOW LPIMEMENUITEMINFO; typedef struct tagIMECHARPOSITION { DWORD dwSize; DWORD dwCharPos; POINT pt; UINT cLineHeight; RECT rcDocument; } IMECHARPOSITION, *PIMECHARPOSITION, *NPIMECHARPOSITION, *LPIMECHARPOSITION; typedef BOOL (__stdcall* IMCENUMPROC)(HIMC, LPARAM); HKL __stdcall ImmInstallIMEA( LPCSTR lpszIMEFileName, LPCSTR lpszLayoutText); HKL __stdcall ImmInstallIMEW( LPCWSTR lpszIMEFileName, LPCWSTR lpszLayoutText); HWND __stdcall ImmGetDefaultIMEWnd( HWND); UINT __stdcall ImmGetDescriptionA( HKL, LPSTR lpszDescription, UINT uBufLen); UINT __stdcall ImmGetDescriptionW( HKL, LPWSTR lpszDescription, UINT uBufLen); UINT __stdcall ImmGetIMEFileNameA( HKL, LPSTR lpszFileName, UINT uBufLen); UINT __stdcall ImmGetIMEFileNameW( HKL, LPWSTR lpszFileName, UINT uBufLen); DWORD __stdcall ImmGetProperty( HKL, DWORD); BOOL __stdcall ImmIsIME( HKL); BOOL __stdcall ImmSimulateHotKey( HWND, DWORD); HIMC __stdcall ImmCreateContext(void); BOOL __stdcall ImmDestroyContext( HIMC); HIMC __stdcall ImmGetContext( HWND); BOOL __stdcall ImmReleaseContext( HWND, HIMC); HIMC __stdcall ImmAssociateContext( HWND, HIMC); BOOL __stdcall ImmAssociateContextEx( HWND, HIMC, DWORD); LONG __stdcall ImmGetCompositionStringA( HIMC, DWORD, LPVOID lpBuf, DWORD dwBufLen); LONG __stdcall ImmGetCompositionStringW( HIMC, DWORD, LPVOID lpBuf, DWORD dwBufLen); BOOL __stdcall ImmSetCompositionStringA( HIMC, DWORD dwIndex, LPVOID lpComp, DWORD dwCompLen, LPVOID lpRead, DWORD dwReadLen); BOOL __stdcall ImmSetCompositionStringW( HIMC, DWORD dwIndex, LPVOID lpComp, DWORD dwCompLen, LPVOID lpRead, DWORD dwReadLen); DWORD __stdcall ImmGetCandidateListCountA( HIMC, LPDWORD lpdwListCount); DWORD __stdcall ImmGetCandidateListCountW( HIMC, LPDWORD lpdwListCount); DWORD __stdcall ImmGetCandidateListA( HIMC, DWORD deIndex, LPCANDIDATELIST lpCandList, DWORD dwBufLen); DWORD __stdcall ImmGetCandidateListW( HIMC, DWORD deIndex, LPCANDIDATELIST lpCandList, DWORD dwBufLen); DWORD __stdcall ImmGetGuideLineA( HIMC, DWORD dwIndex, LPSTR lpBuf, DWORD dwBufLen); DWORD __stdcall ImmGetGuideLineW( HIMC, DWORD dwIndex, LPWSTR lpBuf, DWORD dwBufLen); BOOL __stdcall ImmGetConversionStatus( HIMC, LPDWORD lpfdwConversion, LPDWORD lpfdwSentence); BOOL __stdcall ImmSetConversionStatus( HIMC, DWORD, DWORD); BOOL __stdcall ImmGetOpenStatus( HIMC); BOOL __stdcall ImmSetOpenStatus( HIMC, BOOL); BOOL __stdcall ImmGetCompositionFontA( HIMC, LPLOGFONTA lplf); BOOL __stdcall ImmGetCompositionFontW( HIMC, LPLOGFONTW lplf); BOOL __stdcall ImmSetCompositionFontA( HIMC, LPLOGFONTA lplf); BOOL __stdcall ImmSetCompositionFontW( HIMC, LPLOGFONTW lplf); BOOL __stdcall ImmConfigureIMEA( HKL, HWND, DWORD, LPVOID); BOOL __stdcall ImmConfigureIMEW( HKL, HWND, DWORD, LPVOID); LRESULT __stdcall ImmEscapeA( HKL, HIMC, UINT, LPVOID); LRESULT __stdcall ImmEscapeW( HKL, HIMC, UINT, LPVOID); DWORD __stdcall ImmGetConversionListA( HKL, HIMC, LPCSTR lpSrc, LPCANDIDATELIST lpDst, DWORD dwBufLen, UINT uFlag); DWORD __stdcall ImmGetConversionListW( HKL, HIMC, LPCWSTR lpSrc, LPCANDIDATELIST lpDst, DWORD dwBufLen, UINT uFlag); BOOL __stdcall ImmNotifyIME( HIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue); BOOL __stdcall ImmGetStatusWindowPos( HIMC, LPPOINT lpptPos); BOOL __stdcall ImmSetStatusWindowPos( HIMC, LPPOINT lpptPos); BOOL __stdcall ImmGetCompositionWindow( HIMC, LPCOMPOSITIONFORM lpCompForm); BOOL __stdcall ImmSetCompositionWindow( HIMC, LPCOMPOSITIONFORM lpCompForm); BOOL __stdcall ImmGetCandidateWindow( HIMC, DWORD, LPCANDIDATEFORM lpCandidate); BOOL __stdcall ImmSetCandidateWindow( HIMC, LPCANDIDATEFORM lpCandidate); BOOL __stdcall ImmIsUIMessageA( HWND, UINT, WPARAM, LPARAM); BOOL __stdcall ImmIsUIMessageW( HWND, UINT, WPARAM, LPARAM); UINT __stdcall ImmGetVirtualKey( HWND); typedef int (__stdcall *REGISTERWORDENUMPROCA)( LPCSTR lpszReading, DWORD, LPCSTR lpszString, LPVOID); typedef int (__stdcall *REGISTERWORDENUMPROCW)( LPCWSTR lpszReading, DWORD, LPCWSTR lpszString, LPVOID); BOOL __stdcall ImmRegisterWordA( HKL, LPCSTR lpszReading, DWORD, LPCSTR lpszRegister); BOOL __stdcall ImmRegisterWordW( HKL, LPCWSTR lpszReading, DWORD, LPCWSTR lpszRegister); BOOL __stdcall ImmUnregisterWordA( HKL, LPCSTR lpszReading, DWORD, LPCSTR lpszUnregister); BOOL __stdcall ImmUnregisterWordW( HKL, LPCWSTR lpszReading, DWORD, LPCWSTR lpszUnregister); UINT __stdcall ImmGetRegisterWordStyleA( HKL, UINT nItem, LPSTYLEBUFA lpStyleBuf); UINT __stdcall ImmGetRegisterWordStyleW( HKL, UINT nItem, LPSTYLEBUFW lpStyleBuf); UINT __stdcall ImmEnumRegisterWordA( HKL, REGISTERWORDENUMPROCA, LPCSTR lpszReading, DWORD, LPCSTR lpszRegister, LPVOID); UINT __stdcall ImmEnumRegisterWordW( HKL, REGISTERWORDENUMPROCW, LPCWSTR lpszReading, DWORD, LPCWSTR lpszRegister, LPVOID); BOOL __stdcall ImmDisableIME( DWORD); BOOL __stdcall ImmEnumInputContext(DWORD idThread, IMCENUMPROC lpfn, LPARAM lParam); DWORD __stdcall ImmGetImeMenuItemsA( HIMC, DWORD, DWORD, LPIMEMENUITEMINFOA lpImeParentMenu, LPIMEMENUITEMINFOA lpImeMenu, DWORD dwSize); DWORD __stdcall ImmGetImeMenuItemsW( HIMC, DWORD, DWORD, LPIMEMENUITEMINFOW lpImeParentMenu, LPIMEMENUITEMINFOW lpImeMenu, DWORD dwSize); BOOL __stdcall ImmDisableTextFrameService(DWORD idThread); BOOL __stdcall ImmDisableLegacyIME(void); #pragma warning(pop) } #pragma warning(pop) typedef LONG NTSTATUS; typedef struct _UNICODE_STRING { USHORT Length; USHORT MaximumLength; PWSTR Buffer; } UNICODE_STRING; typedef UNICODE_STRING* PUNICODE_STRING; typedef const UNICODE_STRING* PCUNICODE_STRING; typedef struct _STRING { USHORT Length; USHORT MaximumLength; PCHAR Buffer; } STRING; typedef STRING* PSTRING; typedef STRING ANSI_STRING; typedef PSTRING PANSI_STRING; typedef const PSTRING PCANSI_STRING; typedef STRING OEM_STRING; typedef PSTRING POEM_STRING; typedef const STRING* PCOEM_STRING; typedef struct _OBJECT_ATTRIBUTES { ULONG Length; HANDLE RootDirectory; PUNICODE_STRING ObjectName; ULONG Attributes; PVOID SecurityDescriptor; PVOID SecurityQualityOfService; } OBJECT_ATTRIBUTES; typedef OBJECT_ATTRIBUTES* POBJECT_ATTRIBUTES; typedef struct _IO_STATUS_BLOCK { union { NTSTATUS Status; PVOID Pointer; }; ULONG_PTR Information; } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK; typedef NTSTATUS(__stdcall* NtCreateFileFunction)( PHANDLE FileHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes, PIO_STATUS_BLOCK IoStatusBlock, PLARGE_INTEGER AllocationSize , ULONG FileAttributes, ULONG ShareAccess, ULONG CreateDisposition, ULONG CreateOptions, PVOID EaBuffer , ULONG EaLength); typedef NTSTATUS(__stdcall* NtOpenFileFunction)( PHANDLE FileHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes, PIO_STATUS_BLOCK IoStatusBlock, ULONG ShareAccess, ULONG OpenOptions); typedef NTSTATUS(__stdcall* NtCloseFunction)( HANDLE Handle); typedef enum _FILE_INFORMATION_CLASS { FileRenameInformation = 10 } FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS; typedef struct _FILE_RENAME_INFORMATION { BOOLEAN ReplaceIfExists; HANDLE RootDirectory; ULONG FileNameLength; WCHAR FileName[1]; } FILE_RENAME_INFORMATION, *PFILE_RENAME_INFORMATION; typedef NTSTATUS(__stdcall* NtSetInformationFileFunction)( HANDLE FileHandle, PIO_STATUS_BLOCK IoStatusBlock, PVOID FileInformation, ULONG Length, FILE_INFORMATION_CLASS FileInformationClass); typedef struct FILE_BASIC_INFORMATION { LARGE_INTEGER CreationTime; LARGE_INTEGER LastAccessTime; LARGE_INTEGER LastWriteTime; LARGE_INTEGER ChangeTime; ULONG FileAttributes; } FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION; typedef NTSTATUS(__stdcall* NtQueryAttributesFileFunction)( POBJECT_ATTRIBUTES ObjectAttributes, PFILE_BASIC_INFORMATION FileAttributes); typedef struct _FILE_NETWORK_OPEN_INFORMATION { LARGE_INTEGER CreationTime; LARGE_INTEGER LastAccessTime; LARGE_INTEGER LastWriteTime; LARGE_INTEGER ChangeTime; LARGE_INTEGER AllocationSize; LARGE_INTEGER EndOfFile; ULONG FileAttributes; } FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION; typedef NTSTATUS(__stdcall* NtQueryFullAttributesFileFunction)( POBJECT_ATTRIBUTES ObjectAttributes, PFILE_NETWORK_OPEN_INFORMATION FileAttributes); typedef NTSTATUS(__stdcall* NtCreateSectionFunction)( PHANDLE SectionHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes , PLARGE_INTEGER MaximumSize , ULONG SectionPageProtection, ULONG AllocationAttributes, HANDLE FileHandle ); typedef ULONG SECTION_INHERIT; typedef NTSTATUS(__stdcall* NtMapViewOfSectionFunction)( HANDLE SectionHandle, HANDLE ProcessHandle, PVOID* BaseAddress, ULONG_PTR ZeroBits, SIZE_T CommitSize, PLARGE_INTEGER SectionOffset , PSIZE_T ViewSize, SECTION_INHERIT InheritDisposition, ULONG AllocationType, ULONG Win32Protect); typedef NTSTATUS(__stdcall* NtUnmapViewOfSectionFunction)( HANDLE ProcessHandle, PVOID BaseAddress); typedef enum _SECTION_INFORMATION_CLASS { SectionBasicInformation = 0, SectionImageInformation } SECTION_INFORMATION_CLASS; typedef struct _SECTION_BASIC_INFORMATION { PVOID BaseAddress; ULONG Attributes; LARGE_INTEGER Size; } SECTION_BASIC_INFORMATION, *PSECTION_BASIC_INFORMATION; typedef NTSTATUS(__stdcall* NtQuerySectionFunction)( HANDLE SectionHandle, SECTION_INFORMATION_CLASS SectionInformationClass, PVOID SectionInformation, SIZE_T SectionInformationLength, PSIZE_T ReturnLength ); typedef struct _CLIENT_ID { PVOID UniqueProcess; PVOID UniqueThread; } CLIENT_ID, *PCLIENT_ID; typedef NTSTATUS(__stdcall* NtOpenThreadFunction)( PHANDLE ThreadHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes, PCLIENT_ID ClientId); typedef NTSTATUS(__stdcall* NtOpenProcessFunction)( PHANDLE ProcessHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes, PCLIENT_ID ClientId); typedef enum _NT_THREAD_INFORMATION_CLASS { ThreadBasicInformation, ThreadTimes, ThreadPriority, ThreadBasePriority, ThreadAffinityMask, ThreadImpersonationToken, ThreadDescriptorTableEntry, ThreadEnableAlignmentFaultFixup, ThreadEventPair, ThreadQuerySetWin32StartAddress, ThreadZeroTlsCell, ThreadPerformanceCount, ThreadAmILastThread, ThreadIdealProcessor, ThreadPriorityBoost, ThreadSetTlsArrayAddress, ThreadIsIoPending, ThreadHideFromDebugger } NT_THREAD_INFORMATION_CLASS, *PNT_THREAD_INFORMATION_CLASS; typedef NTSTATUS(__stdcall* NtSetInformationThreadFunction)( HANDLE ThreadHandle, NT_THREAD_INFORMATION_CLASS ThreadInformationClass, PVOID ThreadInformation, ULONG ThreadInformationLength); typedef enum _PROCESSINFOCLASS { ProcessBasicInformation = 0, ProcessExecuteFlags = 0x22 } PROCESSINFOCLASS; typedef struct _RTL_USER_PROCESS_PARAMETERS { BYTE Reserved1[16]; PVOID Reserved2[10]; UNICODE_STRING ImagePathName; UNICODE_STRING CommandLine; } RTL_USER_PROCESS_PARAMETERS, *PRTL_USER_PROCESS_PARAMETERS; typedef struct _PEB { BYTE InheritedAddressSpace; BYTE ReadImageFileExecOptions; BYTE BeingDebugged; BYTE SpareBool; PVOID Mutant; PVOID ImageBaseAddress; PVOID Ldr; PRTL_USER_PROCESS_PARAMETERS ProcessParameters; } PEB, *PPEB; typedef LONG KPRIORITY; typedef struct _PROCESS_BASIC_INFORMATION { union { NTSTATUS ExitStatus; PVOID padding_for_x64_0; }; PPEB PebBaseAddress; KAFFINITY AffinityMask; union { KPRIORITY BasePriority; PVOID padding_for_x64_1; }; union { DWORD UniqueProcessId; PVOID padding_for_x64_2; }; union { DWORD InheritedFromUniqueProcessId; PVOID padding_for_x64_3; }; } PROCESS_BASIC_INFORMATION, *PPROCESS_BASIC_INFORMATION; typedef NTSTATUS(__stdcall* NtQueryInformationProcessFunction)( HANDLE ProcessHandle, PROCESSINFOCLASS ProcessInformationClass, PVOID ProcessInformation, ULONG ProcessInformationLength, PULONG ReturnLength ); typedef NTSTATUS(__stdcall* NtSetInformationProcessFunction)( HANDLE ProcessHandle, PROCESSINFOCLASS ProcessInformationClass, PVOID ProcessInformation, ULONG ProcessInformationLength); typedef NTSTATUS(__stdcall* NtOpenThreadTokenFunction)( HANDLE ThreadHandle, ACCESS_MASK DesiredAccess, BOOLEAN OpenAsSelf, PHANDLE TokenHandle); typedef NTSTATUS(__stdcall* NtOpenThreadTokenExFunction)( HANDLE ThreadHandle, ACCESS_MASK DesiredAccess, BOOLEAN OpenAsSelf, ULONG HandleAttributes, PHANDLE TokenHandle); typedef NTSTATUS(__stdcall* NtOpenProcessTokenFunction)( HANDLE ProcessHandle, ACCESS_MASK DesiredAccess, PHANDLE TokenHandle); typedef NTSTATUS(__stdcall* NtOpenProcessTokenExFunction)( HANDLE ProcessHandle, ACCESS_MASK DesiredAccess, ULONG HandleAttributes, PHANDLE TokenHandle); typedef NTSTATUS(__stdcall* NtQueryInformationTokenFunction)( HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, PVOID TokenInformation, ULONG TokenInformationLength, PULONG ReturnLength); typedef NTSTATUS(__stdcall* RtlCreateUserThreadFunction)( HANDLE Process, PSECURITY_DESCRIPTOR ThreadSecurityDescriptor, BOOLEAN CreateSuspended, ULONG ZeroBits, SIZE_T MaximumStackSize, SIZE_T CommittedStackSize, LPTHREAD_START_ROUTINE StartAddress, PVOID Parameter, PHANDLE Thread, PCLIENT_ID ClientId); typedef NTSTATUS(__stdcall* RtlConvertSidToUnicodeStringFunction)( PUNICODE_STRING UnicodeString, PSID Sid, BOOLEAN AllocateDestinationString); typedef void(__stdcall* RtlFreeUnicodeStringFunction)( PUNICODE_STRING UnicodeString); typedef enum _KEY_INFORMATION_CLASS { KeyBasicInformation = 0, KeyFullInformation = 2 } KEY_INFORMATION_CLASS, *PKEY_INFORMATION_CLASS; typedef struct _KEY_BASIC_INFORMATION { LARGE_INTEGER LastWriteTime; ULONG TitleIndex; ULONG NameLength; WCHAR Name[1]; } KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION; typedef struct _KEY_FULL_INFORMATION { LARGE_INTEGER LastWriteTime; ULONG TitleIndex; ULONG ClassOffset; ULONG ClassLength; ULONG SubKeys; ULONG MaxNameLen; ULONG MaxClassLen; ULONG Values; ULONG MaxValueNameLen; ULONG MaxValueDataLen; WCHAR Class[1]; } KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION; typedef enum _KEY_VALUE_INFORMATION_CLASS { KeyValueFullInformation = 1 } KEY_VALUE_INFORMATION_CLASS, *PKEY_VALUE_INFORMATION_CLASS; typedef struct _KEY_VALUE_FULL_INFORMATION { ULONG TitleIndex; ULONG Type; ULONG DataOffset; ULONG DataLength; ULONG NameLength; WCHAR Name[1]; } KEY_VALUE_FULL_INFORMATION, *PKEY_VALUE_FULL_INFORMATION; typedef NTSTATUS(__stdcall* NtCreateKeyFunction)( PHANDLE KeyHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes, ULONG TitleIndex, PUNICODE_STRING Class , ULONG CreateOptions, PULONG Disposition ); typedef NTSTATUS(__stdcall* NtOpenKeyFunction)( PHANDLE KeyHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes); typedef NTSTATUS(__stdcall* NtOpenKeyExFunction)( PHANDLE KeyHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes, DWORD open_options); typedef NTSTATUS(__stdcall* NtDeleteKeyFunction)( HANDLE KeyHandle); typedef NTSTATUS(__stdcall* RtlFormatCurrentUserKeyPathFunction)( PUNICODE_STRING RegistryPath); typedef NTSTATUS(__stdcall* NtQueryKeyFunction)( HANDLE KeyHandle, KEY_INFORMATION_CLASS KeyInformationClass, PVOID KeyInformation, ULONG Length, PULONG ResultLength); typedef NTSTATUS(__stdcall* NtEnumerateKeyFunction)( HANDLE KeyHandle, ULONG Index, KEY_INFORMATION_CLASS KeyInformationClass, PVOID KeyInformation, ULONG Length, PULONG ResultLength); typedef NTSTATUS(__stdcall* NtQueryValueKeyFunction)( HANDLE KeyHandle, PUNICODE_STRING ValueName, KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, PVOID KeyValueInformation, ULONG Length, PULONG ResultLength); typedef NTSTATUS(__stdcall* NtSetValueKeyFunction)( HANDLE KeyHandle, PUNICODE_STRING ValueName, ULONG TitleIndex , ULONG Type, PVOID Data, ULONG DataSize); typedef PVOID PRTL_HEAP_PARAMETERS; typedef PVOID(__stdcall* RtlCreateHeapFunction)( ULONG Flags, PVOID HeapBase , SIZE_T ReserveSize , SIZE_T CommitSize , PVOID Lock , PRTL_HEAP_PARAMETERS Parameters ); typedef PVOID(__stdcall* RtlDestroyHeapFunction)( PVOID HeapHandle); typedef PVOID(__stdcall* RtlAllocateHeapFunction)( PVOID HeapHandle, ULONG Flags, SIZE_T Size); typedef BOOLEAN(__stdcall* RtlFreeHeapFunction)( PVOID HeapHandle, ULONG Flags, PVOID HeapBase); typedef NTSTATUS(__stdcall* NtAllocateVirtualMemoryFunction)( HANDLE ProcessHandle, PVOID* BaseAddress, ULONG_PTR ZeroBits, PSIZE_T RegionSize, ULONG AllocationType, ULONG Protect); typedef NTSTATUS(__stdcall* NtFreeVirtualMemoryFunction)( HANDLE ProcessHandle, PVOID* BaseAddress, PSIZE_T RegionSize, ULONG FreeType); typedef enum _MEMORY_INFORMATION_CLASS { MemoryBasicInformation = 0, MemoryWorkingSetList, MemorySectionName, MemoryBasicVlmInformation } MEMORY_INFORMATION_CLASS; typedef struct _MEMORY_SECTION_NAME { UNICODE_STRING SectionFileName; } MEMORY_SECTION_NAME, *PMEMORY_SECTION_NAME; typedef NTSTATUS(__stdcall* NtQueryVirtualMemoryFunction)( HANDLE ProcessHandle, PVOID BaseAddress, MEMORY_INFORMATION_CLASS MemoryInformationClass, PVOID MemoryInformation, SIZE_T MemoryInformationLength, PSIZE_T ReturnLength ); typedef NTSTATUS(__stdcall* NtProtectVirtualMemoryFunction)( HANDLE ProcessHandle, PVOID* BaseAddress, PSIZE_T ProtectSize, ULONG NewProtect, PULONG OldProtect); typedef enum _OBJECT_INFORMATION_CLASS { ObjectBasicInformation, ObjectNameInformation, ObjectTypeInformation, ObjectAllInformation, ObjectDataInformation } OBJECT_INFORMATION_CLASS, *POBJECT_INFORMATION_CLASS; typedef struct _OBJDIR_INFORMATION { UNICODE_STRING ObjectName; UNICODE_STRING ObjectTypeName; BYTE Data[1]; } OBJDIR_INFORMATION; typedef struct _PUBLIC_OBJECT_BASIC_INFORMATION { ULONG Attributes; ACCESS_MASK GrantedAccess; ULONG HandleCount; ULONG PointerCount; ULONG Reserved[10]; } PUBLIC_OBJECT_BASIC_INFORMATION, *PPUBLIC_OBJECT_BASIC_INFORMATION; typedef struct __PUBLIC_OBJECT_TYPE_INFORMATION { UNICODE_STRING TypeName; ULONG Reserved[22]; } PUBLIC_OBJECT_TYPE_INFORMATION, *PPUBLIC_OBJECT_TYPE_INFORMATION; typedef enum _POOL_TYPE { NonPagedPool, PagedPool, NonPagedPoolMustSucceed, ReservedType, NonPagedPoolCacheAligned, PagedPoolCacheAligned, NonPagedPoolCacheAlignedMustS } POOL_TYPE; typedef struct _OBJECT_BASIC_INFORMATION { ULONG Attributes; ACCESS_MASK GrantedAccess; ULONG HandleCount; ULONG PointerCount; ULONG PagedPoolUsage; ULONG NonPagedPoolUsage; ULONG Reserved[3]; ULONG NameInformationLength; ULONG TypeInformationLength; ULONG SecurityDescriptorLength; LARGE_INTEGER CreateTime; } OBJECT_BASIC_INFORMATION, *POBJECT_BASIC_INFORMATION; typedef struct _OBJECT_TYPE_INFORMATION { UNICODE_STRING Name; ULONG TotalNumberOfObjects; ULONG TotalNumberOfHandles; ULONG TotalPagedPoolUsage; ULONG TotalNonPagedPoolUsage; ULONG TotalNamePoolUsage; ULONG TotalHandleTableUsage; ULONG HighWaterNumberOfObjects; ULONG HighWaterNumberOfHandles; ULONG HighWaterPagedPoolUsage; ULONG HighWaterNonPagedPoolUsage; ULONG HighWaterNamePoolUsage; ULONG HighWaterHandleTableUsage; ULONG InvalidAttributes; GENERIC_MAPPING GenericMapping; ULONG ValidAccess; BOOLEAN SecurityRequired; BOOLEAN MaintainHandleCount; USHORT MaintainTypeList; POOL_TYPE PoolType; ULONG PagedPoolUsage; ULONG NonPagedPoolUsage; } OBJECT_TYPE_INFORMATION, *POBJECT_TYPE_INFORMATION; typedef enum _SYSTEM_INFORMATION_CLASS { SystemHandleInformation = 16 } SYSTEM_INFORMATION_CLASS; typedef struct _SYSTEM_HANDLE_INFORMATION { USHORT ProcessId; USHORT CreatorBackTraceIndex; UCHAR ObjectTypeNumber; UCHAR Flags; USHORT Handle; PVOID Object; ACCESS_MASK GrantedAccess; } SYSTEM_HANDLE_INFORMATION, *PSYSTEM_HANDLE_INFORMATION; typedef struct _SYSTEM_HANDLE_INFORMATION_EX { ULONG NumberOfHandles; SYSTEM_HANDLE_INFORMATION Information[1]; } SYSTEM_HANDLE_INFORMATION_EX, *PSYSTEM_HANDLE_INFORMATION_EX; typedef struct _OBJECT_NAME_INFORMATION { UNICODE_STRING ObjectName; } OBJECT_NAME_INFORMATION, *POBJECT_NAME_INFORMATION; typedef NTSTATUS(__stdcall* NtQueryObjectFunction)( HANDLE Handle, OBJECT_INFORMATION_CLASS ObjectInformationClass, PVOID ObjectInformation , ULONG ObjectInformationLength, PULONG ReturnLength ); typedef NTSTATUS(__stdcall* NtDuplicateObjectFunction)( HANDLE SourceProcess, HANDLE SourceHandle, HANDLE TargetProcess, PHANDLE TargetHandle, ACCESS_MASK DesiredAccess, ULONG Attributes, ULONG Options); typedef NTSTATUS(__stdcall* NtSignalAndWaitForSingleObjectFunction)( HANDLE HandleToSignal, HANDLE HandleToWait, BOOLEAN Alertable, PLARGE_INTEGER Timeout ); typedef NTSTATUS(__stdcall* NtWaitForSingleObjectFunction)( HANDLE ObjectHandle, BOOLEAN Alertable, PLARGE_INTEGER TimeOut ); typedef NTSTATUS(__stdcall* NtQuerySystemInformation)( SYSTEM_INFORMATION_CLASS SystemInformationClass, PVOID SystemInformation, ULONG SystemInformationLength, PULONG ReturnLength); typedef NTSTATUS(__stdcall* NtQueryObject)( HANDLE Handle, OBJECT_INFORMATION_CLASS ObjectInformationClass, PVOID ObjectInformation, ULONG ObjectInformationLength, PULONG ReturnLength); typedef int(__cdecl* _strnicmpFunction)( const char* _Str1, const char* _Str2, size_t _MaxCount); typedef size_t(__cdecl* strlenFunction)( const char* _Str); typedef size_t(__cdecl* wcslenFunction)( const wchar_t* _Str); typedef void*(__cdecl* memcpyFunction)( void* dest, const void* src, size_t count); typedef NTSTATUS(__stdcall* RtlAnsiStringToUnicodeStringFunction)( PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString); typedef LONG(__stdcall* RtlCompareUnicodeStringFunction)( PCUNICODE_STRING String1, PCUNICODE_STRING String2, BOOLEAN CaseInSensitive); typedef void(__stdcall* RtlInitUnicodeStringFunction)( PUNICODE_STRING DestinationString, PCWSTR SourceString); typedef ULONG(__stdcall* RtlNtStatusToDosErrorFunction)(NTSTATUS status); typedef enum _EVENT_TYPE { NotificationEvent, SynchronizationEvent } EVENT_TYPE, *PEVENT_TYPE; typedef NTSTATUS(__stdcall* NtCreateDirectoryObjectFunction)( PHANDLE DirectoryHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes); typedef NTSTATUS(__stdcall* NtOpenDirectoryObjectFunction)( PHANDLE DirectoryHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes); typedef NTSTATUS(__stdcall* NtQuerySymbolicLinkObjectFunction)( HANDLE LinkHandle, PUNICODE_STRING LinkTarget, PULONG ReturnedLength); typedef NTSTATUS(__stdcall* NtOpenSymbolicLinkObjectFunction)( PHANDLE LinkHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes); typedef NTSTATUS(__stdcall* NtCreateLowBoxToken)( PHANDLE token, HANDLE original_handle, ACCESS_MASK access, POBJECT_ATTRIBUTES object_attribute, PSID appcontainer_sid, DWORD capabilityCount, PSID_AND_ATTRIBUTES capabilities, DWORD handle_count, PHANDLE handles); typedef NTSTATUS(__stdcall* NtSetInformationProcess)( HANDLE process_handle, ULONG info_class, PVOID process_information, ULONG information_length); struct PROCESS_ACCESS_TOKEN { HANDLE token; HANDLE thread; }; const unsigned int NtProcessInformationAccessToken = 9; typedef NTSTATUS(__stdcall* RtlDeriveCapabilitySidsFromNameFunction)( PCUNICODE_STRING SourceString, PSID CapabilityGroupSid, PSID CapabilitySid); enum DXGKMDT_CERTIFICATE_TYPE { DXGKMDT_OPM_CERTIFICATE = 0, DXGKMDT_COPP_CERTIFICATE = 1, DXGKMDT_UAB_CERTIFICATE = 2, DXGKMDT_FORCE_ULONG = 0xFFFFFFFF }; enum DXGKMDT_OPM_VIDEO_OUTPUT_SEMANTICS { DXGKMDT_OPM_VOS_COPP_SEMANTICS = 0, DXGKMDT_OPM_VOS_OPM_SEMANTICS = 1 }; enum DXGKMDT_DPCP_PROTECTION_LEVEL { DXGKMDT_OPM_DPCP_OFF = 0, DXGKMDT_OPM_DPCP_ON = 1, DXGKMDT_OPM_DPCP_FORCE_ULONG = 0x7fffffff }; enum DXGKMDT_OPM_HDCP_PROTECTION_LEVEL { DXGKMDT_OPM_HDCP_OFF = 0, DXGKMDT_OPM_HDCP_ON = 1, DXGKMDT_OPM_HDCP_FORCE_ULONG = 0x7fffffff }; enum DXGKMDT_OPM_HDCP_FLAG { DXGKMDT_OPM_HDCP_FLAG_NONE = 0x00, DXGKMDT_OPM_HDCP_FLAG_REPEATER = 0x01 }; enum DXGKMDT_OPM_PROTECTION_TYPE { DXGKMDT_OPM_PROTECTION_TYPE_OTHER = 0x80000000, DXGKMDT_OPM_PROTECTION_TYPE_NONE = 0x00000000, DXGKMDT_OPM_PROTECTION_TYPE_COPP_COMPATIBLE_HDCP = 0x00000001, DXGKMDT_OPM_PROTECTION_TYPE_ACP = 0x00000002, DXGKMDT_OPM_PROTECTION_TYPE_CGMSA = 0x00000004, DXGKMDT_OPM_PROTECTION_TYPE_HDCP = 0x00000008, DXGKMDT_OPM_PROTECTION_TYPE_DPCP = 0x00000010, DXGKMDT_OPM_PROTECTION_TYPE_MASK = 0x8000001F }; typedef void* OPM_PROTECTED_OUTPUT_HANDLE; struct DXGKMDT_OPM_ENCRYPTED_PARAMETERS { BYTE abEncryptedParameters[256]; }; struct DXGKMDT_OPM_OMAC { BYTE abOMAC[16]; }; struct DXGKMDT_OPM_CONFIGURE_PARAMETERS { DXGKMDT_OPM_OMAC omac; GUID guidSetting; ULONG ulSequenceNumber; ULONG cbParametersSize; BYTE abParameters[4056]; }; struct DXGKMDT_OPM_RANDOM_NUMBER { BYTE abRandomNumber[16]; }; struct DXGKMDT_OPM_GET_INFO_PARAMETERS { DXGKMDT_OPM_OMAC omac; DXGKMDT_OPM_RANDOM_NUMBER rnRandomNumber; GUID guidInformation; ULONG ulSequenceNumber; ULONG cbParametersSize; BYTE abParameters[4056]; }; struct DXGKMDT_OPM_REQUESTED_INFORMATION { DXGKMDT_OPM_OMAC omac; ULONG cbRequestedInformationSize; BYTE abRequestedInformation[4076]; }; struct DXGKMDT_OPM_SET_PROTECTION_LEVEL_PARAMETERS { ULONG ulProtectionType; ULONG ulProtectionLevel; ULONG Reserved; ULONG Reserved2; }; struct DXGKMDT_OPM_STANDARD_INFORMATION { DXGKMDT_OPM_RANDOM_NUMBER rnRandomNumber; ULONG ulStatusFlags; ULONG ulInformation; ULONG ulReserved; ULONG ulReserved2; }; typedef NTSTATUS(__stdcall* GetSuggestedOPMProtectedOutputArraySizeFunction)( PUNICODE_STRING device_name, DWORD* suggested_output_array_size); typedef NTSTATUS(__stdcall* CreateOPMProtectedOutputsFunction)( PUNICODE_STRING device_name, DXGKMDT_OPM_VIDEO_OUTPUT_SEMANTICS vos, DWORD output_array_size, DWORD* num_in_output_array, OPM_PROTECTED_OUTPUT_HANDLE* output_array); typedef NTSTATUS(__stdcall* GetCertificateFunction)( PUNICODE_STRING device_name, DXGKMDT_CERTIFICATE_TYPE certificate_type, BYTE* certificate, ULONG certificate_length); typedef NTSTATUS(__stdcall* GetCertificateSizeFunction)( PUNICODE_STRING device_name, DXGKMDT_CERTIFICATE_TYPE certificate_type, ULONG* certificate_length); typedef NTSTATUS(__stdcall* GetCertificateByHandleFunction)( OPM_PROTECTED_OUTPUT_HANDLE protected_output, DXGKMDT_CERTIFICATE_TYPE certificate_type, BYTE* certificate, ULONG certificate_length); typedef NTSTATUS(__stdcall* GetCertificateSizeByHandleFunction)( OPM_PROTECTED_OUTPUT_HANDLE protected_output, DXGKMDT_CERTIFICATE_TYPE certificate_type, ULONG* certificate_length); typedef NTSTATUS(__stdcall* DestroyOPMProtectedOutputFunction)( OPM_PROTECTED_OUTPUT_HANDLE protected_output); typedef NTSTATUS(__stdcall* ConfigureOPMProtectedOutputFunction)( OPM_PROTECTED_OUTPUT_HANDLE protected_output, const DXGKMDT_OPM_CONFIGURE_PARAMETERS* parameters, ULONG additional_parameters_size, const BYTE* additional_parameters); typedef NTSTATUS(__stdcall* GetOPMInformationFunction)( OPM_PROTECTED_OUTPUT_HANDLE protected_output, const DXGKMDT_OPM_GET_INFO_PARAMETERS* parameters, DXGKMDT_OPM_REQUESTED_INFORMATION* requested_information); typedef NTSTATUS(__stdcall* GetOPMRandomNumberFunction)( OPM_PROTECTED_OUTPUT_HANDLE protected_output, DXGKMDT_OPM_RANDOM_NUMBER* random_number); typedef NTSTATUS(__stdcall* SetOPMSigningKeyAndSequenceNumbersFunction)( OPM_PROTECTED_OUTPUT_HANDLE protected_output, const DXGKMDT_OPM_ENCRYPTED_PARAMETERS* parameters); namespace std { inline namespace __1 { template <class _Tp, class _VoidPtr> struct __forward_list_node; template <class _NodePtr> struct __forward_begin_node; template <class> struct __forward_list_node_value_type; template <class _Tp, class _VoidPtr> struct __forward_list_node_value_type<__forward_list_node<_Tp, _VoidPtr> > { typedef _Tp type; }; template <class _NodePtr> struct __forward_node_traits { typedef typename remove_cv< typename pointer_traits<_NodePtr>::element_type>::type __node; typedef typename __forward_list_node_value_type<__node>::type __node_value_type; typedef _NodePtr __node_pointer; typedef __forward_begin_node<_NodePtr> __begin_node; typedef typename __rebind_pointer<_NodePtr, __begin_node>::type __begin_node_pointer; typedef typename __rebind_pointer<_NodePtr, void>::type __void_pointer; typedef __begin_node_pointer __iter_node_pointer; typedef typename conditional< is_same<__iter_node_pointer, __node_pointer>::value, __begin_node_pointer, __node_pointer >::type __non_iter_node_pointer; __attribute__ ((__exclude_from_explicit_instantiation__)) static __iter_node_pointer __as_iter_node(__iter_node_pointer __p) { return __p; } __attribute__ ((__exclude_from_explicit_instantiation__)) static __iter_node_pointer __as_iter_node(__non_iter_node_pointer __p) { return static_cast<__iter_node_pointer>(static_cast<__void_pointer>(__p)); } }; template <class _NodePtr> struct __forward_begin_node { typedef _NodePtr pointer; typedef typename __rebind_pointer<_NodePtr, __forward_begin_node>::type __begin_node_pointer; pointer __next_; __attribute__ ((__exclude_from_explicit_instantiation__)) __forward_begin_node() : __next_(nullptr) {} __attribute__ ((__exclude_from_explicit_instantiation__)) __begin_node_pointer __next_as_begin() const { return static_cast<__begin_node_pointer>(__next_); } }; template <class _Tp, class _VoidPtr> struct __begin_node_of { typedef __forward_begin_node< typename __rebind_pointer<_VoidPtr, __forward_list_node<_Tp, _VoidPtr> >::type > type; }; template <class _Tp, class _VoidPtr> struct __forward_list_node : public __begin_node_of<_Tp, _VoidPtr>::type { typedef _Tp value_type; value_type __value_; }; template <class _Tp, class _Alloc = allocator<_Tp> > class forward_list; template<class _NodeConstPtr> class __forward_list_const_iterator; template <class _NodePtr> class __forward_list_iterator { typedef __forward_node_traits<_NodePtr> __traits; typedef typename __traits::__node_pointer __node_pointer; typedef typename __traits::__begin_node_pointer __begin_node_pointer; typedef typename __traits::__iter_node_pointer __iter_node_pointer; typedef typename __traits::__void_pointer __void_pointer; __iter_node_pointer __ptr_; __attribute__ ((__exclude_from_explicit_instantiation__)) __begin_node_pointer __get_begin() const { return static_cast<__begin_node_pointer>( static_cast<__void_pointer>(__ptr_)); } __attribute__ ((__exclude_from_explicit_instantiation__)) __node_pointer __get_unsafe_node_pointer() const { return static_cast<__node_pointer>( static_cast<__void_pointer>(__ptr_)); } __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __forward_list_iterator(nullptr_t) noexcept : __ptr_(nullptr) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __forward_list_iterator(__begin_node_pointer __p) noexcept : __ptr_(__traits::__as_iter_node(__p)) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __forward_list_iterator(__node_pointer __p) noexcept : __ptr_(__traits::__as_iter_node(__p)) {} template<class, class> friend class forward_list; template<class> friend class __forward_list_const_iterator; public: typedef forward_iterator_tag iterator_category; typedef typename __traits::__node_value_type value_type; typedef value_type& reference; typedef typename pointer_traits<__node_pointer>::difference_type difference_type; typedef typename __rebind_pointer<__node_pointer, value_type>::type pointer; __attribute__ ((__exclude_from_explicit_instantiation__)) __forward_list_iterator() noexcept : __ptr_(nullptr) {} __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator*() const {return __get_unsafe_node_pointer()->__value_;} __attribute__ ((__exclude_from_explicit_instantiation__)) pointer operator->() const { return pointer_traits<pointer>::pointer_to(__get_unsafe_node_pointer()->__value_); } __attribute__ ((__exclude_from_explicit_instantiation__)) __forward_list_iterator& operator++() { __ptr_ = __traits::__as_iter_node(__ptr_->__next_); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __forward_list_iterator operator++(int) { __forward_list_iterator __t(*this); ++(*this); return __t; } friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const __forward_list_iterator& __x, const __forward_list_iterator& __y) {return __x.__ptr_ == __y.__ptr_;} friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const __forward_list_iterator& __x, const __forward_list_iterator& __y) {return !(__x == __y);} }; template <class _NodeConstPtr> class __forward_list_const_iterator { static_assert((!is_const<typename pointer_traits<_NodeConstPtr>::element_type>::value), ""); typedef _NodeConstPtr _NodePtr; typedef __forward_node_traits<_NodePtr> __traits; typedef typename __traits::__node __node; typedef typename __traits::__node_pointer __node_pointer; typedef typename __traits::__begin_node_pointer __begin_node_pointer; typedef typename __traits::__iter_node_pointer __iter_node_pointer; typedef typename __traits::__void_pointer __void_pointer; __iter_node_pointer __ptr_; __begin_node_pointer __get_begin() const { return static_cast<__begin_node_pointer>( static_cast<__void_pointer>(__ptr_)); } __node_pointer __get_unsafe_node_pointer() const { return static_cast<__node_pointer>( static_cast<__void_pointer>(__ptr_)); } __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __forward_list_const_iterator(nullptr_t) noexcept : __ptr_(nullptr) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __forward_list_const_iterator(__begin_node_pointer __p) noexcept : __ptr_(__traits::__as_iter_node(__p)) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __forward_list_const_iterator(__node_pointer __p) noexcept : __ptr_(__traits::__as_iter_node(__p)) {} template<class, class> friend class forward_list; public: typedef forward_iterator_tag iterator_category; typedef typename __traits::__node_value_type value_type; typedef const value_type& reference; typedef typename pointer_traits<__node_pointer>::difference_type difference_type; typedef typename __rebind_pointer<__node_pointer, const value_type>::type pointer; __attribute__ ((__exclude_from_explicit_instantiation__)) __forward_list_const_iterator() noexcept : __ptr_(nullptr) {} __attribute__ ((__exclude_from_explicit_instantiation__)) __forward_list_const_iterator(__forward_list_iterator<__node_pointer> __p) noexcept : __ptr_(__p.__ptr_) {} __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator*() const {return __get_unsafe_node_pointer()->__value_;} __attribute__ ((__exclude_from_explicit_instantiation__)) pointer operator->() const {return pointer_traits<pointer>::pointer_to( __get_unsafe_node_pointer()->__value_);} __attribute__ ((__exclude_from_explicit_instantiation__)) __forward_list_const_iterator& operator++() { __ptr_ = __traits::__as_iter_node(__ptr_->__next_); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __forward_list_const_iterator operator++(int) { __forward_list_const_iterator __t(*this); ++(*this); return __t; } friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const __forward_list_const_iterator& __x, const __forward_list_const_iterator& __y) {return __x.__ptr_ == __y.__ptr_;} friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const __forward_list_const_iterator& __x, const __forward_list_const_iterator& __y) {return !(__x == __y);} }; template <class _Tp, class _Alloc> class __forward_list_base { protected: typedef _Tp value_type; typedef _Alloc allocator_type; typedef typename allocator_traits<allocator_type>::void_pointer void_pointer; typedef __forward_list_node<value_type, void_pointer> __node; typedef typename __begin_node_of<value_type, void_pointer>::type __begin_node; typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __node>::type __node_allocator; typedef allocator_traits<__node_allocator> __node_traits; typedef typename __node_traits::pointer __node_pointer; typedef typename __rebind_alloc_helper< allocator_traits<allocator_type>, __begin_node >::type __begin_node_allocator; typedef typename allocator_traits<__begin_node_allocator>::pointer __begin_node_pointer; static_assert((!is_same<allocator_type, __node_allocator>::value), "internal allocator type must differ from user-specified " "type; otherwise overload resolution breaks"); __compressed_pair<__begin_node, __node_allocator> __before_begin_; __attribute__ ((__exclude_from_explicit_instantiation__)) __begin_node_pointer __before_begin() noexcept {return pointer_traits<__begin_node_pointer>::pointer_to(__before_begin_.first());} __attribute__ ((__exclude_from_explicit_instantiation__)) __begin_node_pointer __before_begin() const noexcept {return pointer_traits<__begin_node_pointer>::pointer_to(const_cast<__begin_node&>(__before_begin_.first()));} __attribute__ ((__exclude_from_explicit_instantiation__)) __node_allocator& __alloc() noexcept {return __before_begin_.second();} __attribute__ ((__exclude_from_explicit_instantiation__)) const __node_allocator& __alloc() const noexcept {return __before_begin_.second();} typedef __forward_list_iterator<__node_pointer> iterator; typedef __forward_list_const_iterator<__node_pointer> const_iterator; __attribute__ ((__exclude_from_explicit_instantiation__)) __forward_list_base() noexcept(is_nothrow_default_constructible<__node_allocator>::value) : __before_begin_(__begin_node()) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __forward_list_base(const allocator_type& __a) : __before_begin_(__begin_node(), __node_allocator(__a)) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __forward_list_base(const __node_allocator& __a) : __before_begin_(__begin_node(), __a) {} public: __attribute__ ((__exclude_from_explicit_instantiation__)) __forward_list_base(__forward_list_base&& __x) noexcept(is_nothrow_move_constructible<__node_allocator>::value); __attribute__ ((__exclude_from_explicit_instantiation__)) __forward_list_base(__forward_list_base&& __x, const allocator_type& __a); private: __forward_list_base(const __forward_list_base&); __forward_list_base& operator=(const __forward_list_base&); public: ~__forward_list_base(); protected: __attribute__ ((__exclude_from_explicit_instantiation__)) void __copy_assign_alloc(const __forward_list_base& __x) {__copy_assign_alloc(__x, integral_constant<bool, __node_traits::propagate_on_container_copy_assignment::value>());} __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(__forward_list_base& __x) noexcept(!__node_traits::propagate_on_container_move_assignment::value || is_nothrow_move_assignable<__node_allocator>::value) {__move_assign_alloc(__x, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>());} public: __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(__forward_list_base& __x) noexcept; protected: void clear() noexcept; private: __attribute__ ((__exclude_from_explicit_instantiation__)) void __copy_assign_alloc(const __forward_list_base&, false_type) {} __attribute__ ((__exclude_from_explicit_instantiation__)) void __copy_assign_alloc(const __forward_list_base& __x, true_type) { if (__alloc() != __x.__alloc()) clear(); __alloc() = __x.__alloc(); } __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(__forward_list_base&, false_type) noexcept {} __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(__forward_list_base& __x, true_type) noexcept(is_nothrow_move_assignable<__node_allocator>::value) {__alloc() = std::__1::move(__x.__alloc());} }; template <class _Tp, class _Alloc> inline __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x) noexcept(is_nothrow_move_constructible<__node_allocator>::value) : __before_begin_(std::__1::move(__x.__before_begin_)) { __x.__before_begin()->__next_ = nullptr; } template <class _Tp, class _Alloc> inline __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x, const allocator_type& __a) : __before_begin_(__begin_node(), __node_allocator(__a)) { if (__alloc() == __x.__alloc()) { __before_begin()->__next_ = __x.__before_begin()->__next_; __x.__before_begin()->__next_ = nullptr; } } template <class _Tp, class _Alloc> __forward_list_base<_Tp, _Alloc>::~__forward_list_base() { clear(); } template <class _Tp, class _Alloc> inline void __forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x) noexcept { __swap_allocator(__alloc(), __x.__alloc(), integral_constant<bool, __node_traits::propagate_on_container_swap::value>()); using std::__1::swap; swap(__before_begin()->__next_, __x.__before_begin()->__next_); } template <class _Tp, class _Alloc> void __forward_list_base<_Tp, _Alloc>::clear() noexcept { __node_allocator& __a = __alloc(); for (__node_pointer __p = __before_begin()->__next_; __p != nullptr;) { __node_pointer __next = __p->__next_; __node_traits::destroy(__a, std::__1::addressof(__p->__value_)); __node_traits::deallocate(__a, __p, 1); __p = __next; } __before_begin()->__next_ = nullptr; } template <class _Tp, class _Alloc > class forward_list : private __forward_list_base<_Tp, _Alloc> { typedef __forward_list_base<_Tp, _Alloc> base; typedef typename base::__node_allocator __node_allocator; typedef typename base::__node __node; typedef typename base::__node_traits __node_traits; typedef typename base::__node_pointer __node_pointer; typedef typename base::__begin_node_pointer __begin_node_pointer; public: typedef _Tp value_type; typedef _Alloc allocator_type; static_assert((is_same<typename allocator_type::value_type, value_type>::value), "Allocator::value_type must be same type as value_type"); typedef value_type& reference; typedef const value_type& const_reference; typedef typename allocator_traits<allocator_type>::pointer pointer; typedef typename allocator_traits<allocator_type>::const_pointer const_pointer; typedef typename allocator_traits<allocator_type>::size_type size_type; typedef typename allocator_traits<allocator_type>::difference_type difference_type; typedef typename base::iterator iterator; typedef typename base::const_iterator const_iterator; typedef void __remove_return_type; __attribute__ ((__exclude_from_explicit_instantiation__)) forward_list() noexcept(is_nothrow_default_constructible<__node_allocator>::value) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit forward_list(const allocator_type& __a); explicit forward_list(size_type __n); explicit forward_list(size_type __n, const allocator_type& __a); forward_list(size_type __n, const value_type& __v); forward_list(size_type __n, const value_type& __v, const allocator_type& __a); template <class _InputIterator> forward_list(_InputIterator __f, _InputIterator __l, typename enable_if< __is_input_iterator<_InputIterator>::value >::type* = nullptr); template <class _InputIterator> forward_list(_InputIterator __f, _InputIterator __l, const allocator_type& __a, typename enable_if< __is_input_iterator<_InputIterator>::value >::type* = nullptr); forward_list(const forward_list& __x); forward_list(const forward_list& __x, const allocator_type& __a); forward_list& operator=(const forward_list& __x); __attribute__ ((__exclude_from_explicit_instantiation__)) forward_list(forward_list&& __x) noexcept(is_nothrow_move_constructible<base>::value) : base(std::__1::move(__x)) {} forward_list(forward_list&& __x, const allocator_type& __a); forward_list(initializer_list<value_type> __il); forward_list(initializer_list<value_type> __il, const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) forward_list& operator=(forward_list&& __x) noexcept(__node_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable<allocator_type>::value); __attribute__ ((__exclude_from_explicit_instantiation__)) forward_list& operator=(initializer_list<value_type> __il); __attribute__ ((__exclude_from_explicit_instantiation__)) void assign(initializer_list<value_type> __il); template <class _InputIterator> typename enable_if < __is_input_iterator<_InputIterator>::value, void >::type assign(_InputIterator __f, _InputIterator __l); void assign(size_type __n, const value_type& __v); __attribute__ ((__exclude_from_explicit_instantiation__)) allocator_type get_allocator() const noexcept {return allocator_type(base::__alloc());} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator begin() noexcept {return iterator(base::__before_begin()->__next_);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator begin() const noexcept {return const_iterator(base::__before_begin()->__next_);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator end() noexcept {return iterator(nullptr);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator end() const noexcept {return const_iterator(nullptr);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cbegin() const noexcept {return const_iterator(base::__before_begin()->__next_);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cend() const noexcept {return const_iterator(nullptr);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator before_begin() noexcept {return iterator(base::__before_begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator before_begin() const noexcept {return const_iterator(base::__before_begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cbefore_begin() const noexcept {return const_iterator(base::__before_begin());} [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) bool empty() const noexcept {return base::__before_begin()->__next_ == nullptr;} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type max_size() const noexcept { return std::min<size_type>( __node_traits::max_size(base::__alloc()), numeric_limits<difference_type>::max()); } __attribute__ ((__exclude_from_explicit_instantiation__)) reference front() {return base::__before_begin()->__next_->__value_;} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference front() const {return base::__before_begin()->__next_->__value_;} template <class... _Args> void emplace_front(_Args&&... __args); void push_front(value_type&& __v); void push_front(const value_type& __v); void pop_front(); template <class... _Args> iterator emplace_after(const_iterator __p, _Args&&... __args); iterator insert_after(const_iterator __p, value_type&& __v); iterator insert_after(const_iterator __p, initializer_list<value_type> __il) {return insert_after(__p, __il.begin(), __il.end());} iterator insert_after(const_iterator __p, const value_type& __v); iterator insert_after(const_iterator __p, size_type __n, const value_type& __v); template <class _InputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < __is_input_iterator<_InputIterator>::value, iterator >::type insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l); iterator erase_after(const_iterator __p); iterator erase_after(const_iterator __f, const_iterator __l); __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(forward_list& __x) noexcept {base::swap(__x);} void resize(size_type __n); void resize(size_type __n, const value_type& __v); __attribute__ ((__exclude_from_explicit_instantiation__)) void clear() noexcept {base::clear();} __attribute__ ((__exclude_from_explicit_instantiation__)) void splice_after(const_iterator __p, forward_list&& __x); __attribute__ ((__exclude_from_explicit_instantiation__)) void splice_after(const_iterator __p, forward_list&& __x, const_iterator __i); __attribute__ ((__exclude_from_explicit_instantiation__)) void splice_after(const_iterator __p, forward_list&& __x, const_iterator __f, const_iterator __l); void splice_after(const_iterator __p, forward_list& __x); void splice_after(const_iterator __p, forward_list& __x, const_iterator __i); void splice_after(const_iterator __p, forward_list& __x, const_iterator __f, const_iterator __l); __remove_return_type remove(const value_type& __v); template <class _Predicate> __remove_return_type remove_if(_Predicate __pred); __attribute__ ((__exclude_from_explicit_instantiation__)) __remove_return_type unique() {return unique(__equal_to<value_type>());} template <class _BinaryPredicate> __remove_return_type unique(_BinaryPredicate __binary_pred); __attribute__ ((__exclude_from_explicit_instantiation__)) void merge(forward_list&& __x) {merge(__x, __less<value_type>());} template <class _Compare> __attribute__ ((__exclude_from_explicit_instantiation__)) void merge(forward_list&& __x, _Compare __comp) {merge(__x, std::__1::move(__comp));} __attribute__ ((__exclude_from_explicit_instantiation__)) void merge(forward_list& __x) {merge(__x, __less<value_type>());} template <class _Compare> void merge(forward_list& __x, _Compare __comp); __attribute__ ((__exclude_from_explicit_instantiation__)) void sort() {sort(__less<value_type>());} template <class _Compare> __attribute__ ((__exclude_from_explicit_instantiation__)) void sort(_Compare __comp); void reverse() noexcept; private: void __move_assign(forward_list& __x, true_type) noexcept(is_nothrow_move_assignable<allocator_type>::value); void __move_assign(forward_list& __x, false_type); template <class _Compare> static __node_pointer __merge(__node_pointer __f1, __node_pointer __f2, _Compare& __comp); template <class _Compare> static __node_pointer __sort(__node_pointer __f, difference_type __sz, _Compare& __comp); }; template <class _Tp, class _Alloc> inline forward_list<_Tp, _Alloc>::forward_list(const allocator_type& __a) : base(__a) { } template <class _Tp, class _Alloc> forward_list<_Tp, _Alloc>::forward_list(size_type __n) { if (__n > 0) { __node_allocator& __a = base::__alloc(); typedef __allocator_destructor<__node_allocator> _Dp; unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1)); for (__begin_node_pointer __p = base::__before_begin(); __n > 0; --__n, __p = __p->__next_as_begin()) { __h.reset(__node_traits::allocate(__a, 1)); __node_traits::construct(__a, std::__1::addressof(__h->__value_)); __h->__next_ = nullptr; __p->__next_ = __h.release(); } } } template <class _Tp, class _Alloc> forward_list<_Tp, _Alloc>::forward_list(size_type __n, const allocator_type& __base_alloc) : base ( __base_alloc ) { if (__n > 0) { __node_allocator& __a = base::__alloc(); typedef __allocator_destructor<__node_allocator> _Dp; unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1)); for (__begin_node_pointer __p = base::__before_begin(); __n > 0; --__n, __p = __p->__next_as_begin()) { __h.reset(__node_traits::allocate(__a, 1)); __node_traits::construct(__a, std::__1::addressof(__h->__value_)); __h->__next_ = nullptr; __p->__next_ = __h.release(); } } } template <class _Tp, class _Alloc> forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v) { insert_after(cbefore_begin(), __n, __v); } template <class _Tp, class _Alloc> forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v, const allocator_type& __a) : base(__a) { insert_after(cbefore_begin(), __n, __v); } template <class _Tp, class _Alloc> template <class _InputIterator> forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l, typename enable_if< __is_input_iterator<_InputIterator>::value >::type*) { insert_after(cbefore_begin(), __f, __l); } template <class _Tp, class _Alloc> template <class _InputIterator> forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l, const allocator_type& __a, typename enable_if< __is_input_iterator<_InputIterator>::value >::type*) : base(__a) { insert_after(cbefore_begin(), __f, __l); } template <class _Tp, class _Alloc> forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x) : base( __node_traits::select_on_container_copy_construction(__x.__alloc())) { insert_after(cbefore_begin(), __x.begin(), __x.end()); } template <class _Tp, class _Alloc> forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x, const allocator_type& __a) : base(__a) { insert_after(cbefore_begin(), __x.begin(), __x.end()); } template <class _Tp, class _Alloc> forward_list<_Tp, _Alloc>& forward_list<_Tp, _Alloc>::operator=(const forward_list& __x) { if (this != &__x) { base::__copy_assign_alloc(__x); assign(__x.begin(), __x.end()); } return *this; } template <class _Tp, class _Alloc> forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x, const allocator_type& __a) : base(std::__1::move(__x), __a) { if (base::__alloc() != __x.__alloc()) { typedef move_iterator<iterator> _Ip; insert_after(cbefore_begin(), _Ip(__x.begin()), _Ip(__x.end())); } } template <class _Tp, class _Alloc> forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il) { insert_after(cbefore_begin(), __il.begin(), __il.end()); } template <class _Tp, class _Alloc> forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il, const allocator_type& __a) : base(__a) { insert_after(cbefore_begin(), __il.begin(), __il.end()); } template <class _Tp, class _Alloc> void forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, true_type) noexcept(is_nothrow_move_assignable<allocator_type>::value) { clear(); base::__move_assign_alloc(__x); base::__before_begin()->__next_ = __x.__before_begin()->__next_; __x.__before_begin()->__next_ = nullptr; } template <class _Tp, class _Alloc> void forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, false_type) { if (base::__alloc() == __x.__alloc()) __move_assign(__x, true_type()); else { typedef move_iterator<iterator> _Ip; assign(_Ip(__x.begin()), _Ip(__x.end())); } } template <class _Tp, class _Alloc> inline forward_list<_Tp, _Alloc>& forward_list<_Tp, _Alloc>::operator=(forward_list&& __x) noexcept(__node_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable<allocator_type>::value) { __move_assign(__x, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>()); return *this; } template <class _Tp, class _Alloc> inline forward_list<_Tp, _Alloc>& forward_list<_Tp, _Alloc>::operator=(initializer_list<value_type> __il) { assign(__il.begin(), __il.end()); return *this; } template <class _Tp, class _Alloc> template <class _InputIterator> typename enable_if < __is_input_iterator<_InputIterator>::value, void >::type forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l) { iterator __i = before_begin(); iterator __j = std::__1::next(__i); iterator __e = end(); for (; __j != __e && __f != __l; ++__i, (void) ++__j, ++__f) *__j = *__f; if (__j == __e) insert_after(__i, __f, __l); else erase_after(__i, __e); } template <class _Tp, class _Alloc> void forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v) { iterator __i = before_begin(); iterator __j = std::__1::next(__i); iterator __e = end(); for (; __j != __e && __n > 0; --__n, ++__i, ++__j) *__j = __v; if (__j == __e) insert_after(__i, __n, __v); else erase_after(__i, __e); } template <class _Tp, class _Alloc> inline void forward_list<_Tp, _Alloc>::assign(initializer_list<value_type> __il) { assign(__il.begin(), __il.end()); } template <class _Tp, class _Alloc> template <class... _Args> void forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args) { __node_allocator& __a = base::__alloc(); typedef __allocator_destructor<__node_allocator> _Dp; unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); __node_traits::construct(__a, std::__1::addressof(__h->__value_), std::__1::forward<_Args>(__args)...); __h->__next_ = base::__before_begin()->__next_; base::__before_begin()->__next_ = __h.release(); } template <class _Tp, class _Alloc> void forward_list<_Tp, _Alloc>::push_front(value_type&& __v) { __node_allocator& __a = base::__alloc(); typedef __allocator_destructor<__node_allocator> _Dp; unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); __node_traits::construct(__a, std::__1::addressof(__h->__value_), std::__1::move(__v)); __h->__next_ = base::__before_begin()->__next_; base::__before_begin()->__next_ = __h.release(); } template <class _Tp, class _Alloc> void forward_list<_Tp, _Alloc>::push_front(const value_type& __v) { __node_allocator& __a = base::__alloc(); typedef __allocator_destructor<__node_allocator> _Dp; unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); __node_traits::construct(__a, std::__1::addressof(__h->__value_), __v); __h->__next_ = base::__before_begin()->__next_; base::__before_begin()->__next_ = __h.release(); } template <class _Tp, class _Alloc> void forward_list<_Tp, _Alloc>::pop_front() { __node_allocator& __a = base::__alloc(); __node_pointer __p = base::__before_begin()->__next_; base::__before_begin()->__next_ = __p->__next_; __node_traits::destroy(__a, std::__1::addressof(__p->__value_)); __node_traits::deallocate(__a, __p, 1); } template <class _Tp, class _Alloc> template <class... _Args> typename forward_list<_Tp, _Alloc>::iterator forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args) { __begin_node_pointer const __r = __p.__get_begin(); __node_allocator& __a = base::__alloc(); typedef __allocator_destructor<__node_allocator> _Dp; unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); __node_traits::construct(__a, std::__1::addressof(__h->__value_), std::__1::forward<_Args>(__args)...); __h->__next_ = __r->__next_; __r->__next_ = __h.release(); return iterator(__r->__next_); } template <class _Tp, class _Alloc> typename forward_list<_Tp, _Alloc>::iterator forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v) { __begin_node_pointer const __r = __p.__get_begin(); __node_allocator& __a = base::__alloc(); typedef __allocator_destructor<__node_allocator> _Dp; unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); __node_traits::construct(__a, std::__1::addressof(__h->__value_), std::__1::move(__v)); __h->__next_ = __r->__next_; __r->__next_ = __h.release(); return iterator(__r->__next_); } template <class _Tp, class _Alloc> typename forward_list<_Tp, _Alloc>::iterator forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __v) { __begin_node_pointer const __r = __p.__get_begin(); __node_allocator& __a = base::__alloc(); typedef __allocator_destructor<__node_allocator> _Dp; unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); __node_traits::construct(__a, std::__1::addressof(__h->__value_), __v); __h->__next_ = __r->__next_; __r->__next_ = __h.release(); return iterator(__r->__next_); } template <class _Tp, class _Alloc> typename forward_list<_Tp, _Alloc>::iterator forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n, const value_type& __v) { __begin_node_pointer __r = __p.__get_begin(); if (__n > 0) { __node_allocator& __a = base::__alloc(); typedef __allocator_destructor<__node_allocator> _Dp; unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); __node_traits::construct(__a, std::__1::addressof(__h->__value_), __v); __node_pointer __first = __h.release(); __node_pointer __last = __first; for (--__n; __n != 0; --__n, __last = __last->__next_) { __h.reset(__node_traits::allocate(__a, 1)); __node_traits::construct(__a, std::__1::addressof(__h->__value_), __v); __last->__next_ = __h.release(); } __last->__next_ = __r->__next_; __r->__next_ = __first; __r = static_cast<__begin_node_pointer>(__last); } return iterator(__r); } template <class _Tp, class _Alloc> template <class _InputIterator> typename enable_if < __is_input_iterator<_InputIterator>::value, typename forward_list<_Tp, _Alloc>::iterator >::type forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l) { __begin_node_pointer __r = __p.__get_begin(); if (__f != __l) { __node_allocator& __a = base::__alloc(); typedef __allocator_destructor<__node_allocator> _Dp; unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); __node_traits::construct(__a, std::__1::addressof(__h->__value_), *__f); __node_pointer __first = __h.release(); __node_pointer __last = __first; for (++__f; __f != __l; ++__f, ((void)(__last = __last->__next_))) { __h.reset(__node_traits::allocate(__a, 1)); __node_traits::construct(__a, std::__1::addressof(__h->__value_), *__f); __last->__next_ = __h.release(); } __last->__next_ = __r->__next_; __r->__next_ = __first; __r = static_cast<__begin_node_pointer>(__last); } return iterator(__r); } template <class _Tp, class _Alloc> typename forward_list<_Tp, _Alloc>::iterator forward_list<_Tp, _Alloc>::erase_after(const_iterator __f) { __begin_node_pointer __p = __f.__get_begin(); __node_pointer __n = __p->__next_; __p->__next_ = __n->__next_; __node_allocator& __a = base::__alloc(); __node_traits::destroy(__a, std::__1::addressof(__n->__value_)); __node_traits::deallocate(__a, __n, 1); return iterator(__p->__next_); } template <class _Tp, class _Alloc> typename forward_list<_Tp, _Alloc>::iterator forward_list<_Tp, _Alloc>::erase_after(const_iterator __f, const_iterator __l) { __node_pointer __e = __l.__get_unsafe_node_pointer(); if (__f != __l) { __begin_node_pointer __bp = __f.__get_begin(); __node_pointer __n = __bp->__next_; if (__n != __e) { __bp->__next_ = __e; __node_allocator& __a = base::__alloc(); do { __node_pointer __tmp = __n->__next_; __node_traits::destroy(__a, std::__1::addressof(__n->__value_)); __node_traits::deallocate(__a, __n, 1); __n = __tmp; } while (__n != __e); } } return iterator(__e); } template <class _Tp, class _Alloc> void forward_list<_Tp, _Alloc>::resize(size_type __n) { size_type __sz = 0; iterator __p = before_begin(); iterator __i = begin(); iterator __e = end(); for (; __i != __e && __sz < __n; ++__p, ++__i, ++__sz) ; if (__i != __e) erase_after(__p, __e); else { __n -= __sz; if (__n > 0) { __node_allocator& __a = base::__alloc(); typedef __allocator_destructor<__node_allocator> _Dp; unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1)); for (__begin_node_pointer __ptr = __p.__get_begin(); __n > 0; --__n, __ptr = __ptr->__next_as_begin()) { __h.reset(__node_traits::allocate(__a, 1)); __node_traits::construct(__a, std::__1::addressof(__h->__value_)); __h->__next_ = nullptr; __ptr->__next_ = __h.release(); } } } } template <class _Tp, class _Alloc> void forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v) { size_type __sz = 0; iterator __p = before_begin(); iterator __i = begin(); iterator __e = end(); for (; __i != __e && __sz < __n; ++__p, ++__i, ++__sz) ; if (__i != __e) erase_after(__p, __e); else { __n -= __sz; if (__n > 0) { __node_allocator& __a = base::__alloc(); typedef __allocator_destructor<__node_allocator> _Dp; unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1)); for (__begin_node_pointer __ptr = __p.__get_begin(); __n > 0; --__n, __ptr = __ptr->__next_as_begin()) { __h.reset(__node_traits::allocate(__a, 1)); __node_traits::construct(__a, std::__1::addressof(__h->__value_), __v); __h->__next_ = nullptr; __ptr->__next_ = __h.release(); } } } } template <class _Tp, class _Alloc> void forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, forward_list& __x) { if (!__x.empty()) { if (__p.__get_begin()->__next_ != nullptr) { const_iterator __lm1 = __x.before_begin(); while (__lm1.__get_begin()->__next_ != nullptr) ++__lm1; __lm1.__get_begin()->__next_ = __p.__get_begin()->__next_; } __p.__get_begin()->__next_ = __x.__before_begin()->__next_; __x.__before_begin()->__next_ = nullptr; } } template <class _Tp, class _Alloc> void forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, forward_list& , const_iterator __i) { const_iterator __lm1 = std::__1::next(__i); if (__p != __i && __p != __lm1) { __i.__get_begin()->__next_ = __lm1.__get_begin()->__next_; __lm1.__get_begin()->__next_ = __p.__get_begin()->__next_; __p.__get_begin()->__next_ = __lm1.__get_unsafe_node_pointer(); } } template <class _Tp, class _Alloc> void forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, forward_list& , const_iterator __f, const_iterator __l) { if (__f != __l && __p != __f) { const_iterator __lm1 = __f; while (__lm1.__get_begin()->__next_ != __l.__get_begin()) ++__lm1; if (__f != __lm1) { __lm1.__get_begin()->__next_ = __p.__get_begin()->__next_; __p.__get_begin()->__next_ = __f.__get_begin()->__next_; __f.__get_begin()->__next_ = __l.__get_unsafe_node_pointer(); } } } template <class _Tp, class _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, forward_list&& __x) { splice_after(__p, __x); } template <class _Tp, class _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, forward_list&& __x, const_iterator __i) { splice_after(__p, __x, __i); } template <class _Tp, class _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, forward_list&& __x, const_iterator __f, const_iterator __l) { splice_after(__p, __x, __f, __l); } template <class _Tp, class _Alloc> typename forward_list<_Tp, _Alloc>::__remove_return_type forward_list<_Tp, _Alloc>::remove(const value_type& __v) { forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0; const iterator __e = end(); for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;) { if (__i.__get_begin()->__next_->__value_ == __v) { ++__count_removed; iterator __j = std::__1::next(__i, 2); for (; __j != __e && *__j == __v; ++__j) ++__count_removed; __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j); if (__j == __e) break; __i = __j; } else ++__i; } return (__remove_return_type) __count_removed; } template <class _Tp, class _Alloc> template <class _Predicate> typename forward_list<_Tp, _Alloc>::__remove_return_type forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred) { forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0; const iterator __e = end(); for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;) { if (__pred(__i.__get_begin()->__next_->__value_)) { ++__count_removed; iterator __j = std::__1::next(__i, 2); for (; __j != __e && __pred(*__j); ++__j) ++__count_removed; __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j); if (__j == __e) break; __i = __j; } else ++__i; } return (__remove_return_type) __count_removed; } template <class _Tp, class _Alloc> template <class _BinaryPredicate> typename forward_list<_Tp, _Alloc>::__remove_return_type forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred) { forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); typename forward_list<_Tp, _Alloc>::size_type __count_removed = 0; for (iterator __i = begin(), __e = end(); __i != __e;) { iterator __j = std::__1::next(__i); for (; __j != __e && __binary_pred(*__i, *__j); ++__j) ++__count_removed; if (__i.__get_begin()->__next_ != __j.__get_unsafe_node_pointer()) __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j); __i = __j; } return (__remove_return_type) __count_removed; } template <class _Tp, class _Alloc> template <class _Compare> void forward_list<_Tp, _Alloc>::merge(forward_list& __x, _Compare __comp) { if (this != &__x) { base::__before_begin()->__next_ = __merge(base::__before_begin()->__next_, __x.__before_begin()->__next_, __comp); __x.__before_begin()->__next_ = nullptr; } } template <class _Tp, class _Alloc> template <class _Compare> typename forward_list<_Tp, _Alloc>::__node_pointer forward_list<_Tp, _Alloc>::__merge(__node_pointer __f1, __node_pointer __f2, _Compare& __comp) { if (__f1 == nullptr) return __f2; if (__f2 == nullptr) return __f1; __node_pointer __r; if (__comp(__f2->__value_, __f1->__value_)) { __node_pointer __t = __f2; while (__t->__next_ != nullptr && __comp(__t->__next_->__value_, __f1->__value_)) __t = __t->__next_; __r = __f2; __f2 = __t->__next_; __t->__next_ = __f1; } else __r = __f1; __node_pointer __p = __f1; __f1 = __f1->__next_; while (__f1 != nullptr && __f2 != nullptr) { if (__comp(__f2->__value_, __f1->__value_)) { __node_pointer __t = __f2; while (__t->__next_ != nullptr && __comp(__t->__next_->__value_, __f1->__value_)) __t = __t->__next_; __p->__next_ = __f2; __f2 = __t->__next_; __t->__next_ = __f1; } __p = __f1; __f1 = __f1->__next_; } if (__f2 != nullptr) __p->__next_ = __f2; return __r; } template <class _Tp, class _Alloc> template <class _Compare> inline void forward_list<_Tp, _Alloc>::sort(_Compare __comp) { base::__before_begin()->__next_ = __sort(base::__before_begin()->__next_, std::__1::distance(begin(), end()), __comp); } template <class _Tp, class _Alloc> template <class _Compare> typename forward_list<_Tp, _Alloc>::__node_pointer forward_list<_Tp, _Alloc>::__sort(__node_pointer __f1, difference_type __sz, _Compare& __comp) { switch (__sz) { case 0: case 1: return __f1; case 2: if (__comp(__f1->__next_->__value_, __f1->__value_)) { __node_pointer __t = __f1->__next_; __t->__next_ = __f1; __f1->__next_ = nullptr; __f1 = __t; } return __f1; } difference_type __sz1 = __sz / 2; difference_type __sz2 = __sz - __sz1; __node_pointer __t = std::__1::next(iterator(__f1), __sz1 - 1).__get_unsafe_node_pointer(); __node_pointer __f2 = __t->__next_; __t->__next_ = nullptr; return __merge(__sort(__f1, __sz1, __comp), __sort(__f2, __sz2, __comp), __comp); } template <class _Tp, class _Alloc> void forward_list<_Tp, _Alloc>::reverse() noexcept { __node_pointer __p = base::__before_begin()->__next_; if (__p != nullptr) { __node_pointer __f = __p->__next_; __p->__next_ = nullptr; while (__f != nullptr) { __node_pointer __t = __f->__next_; __f->__next_ = __p; __p = __f; __f = __t; } base::__before_begin()->__next_ = __p; } } template <class _Tp, class _Alloc> bool operator==(const forward_list<_Tp, _Alloc>& __x, const forward_list<_Tp, _Alloc>& __y) { typedef forward_list<_Tp, _Alloc> _Cp; typedef typename _Cp::const_iterator _Ip; _Ip __ix = __x.begin(); _Ip __ex = __x.end(); _Ip __iy = __y.begin(); _Ip __ey = __y.end(); for (; __ix != __ex && __iy != __ey; ++__ix, ++__iy) if (!(*__ix == *__iy)) return false; return (__ix == __ex) == (__iy == __ey); } template <class _Tp, class _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const forward_list<_Tp, _Alloc>& __x, const forward_list<_Tp, _Alloc>& __y) { return !(__x == __y); } template <class _Tp, class _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator< (const forward_list<_Tp, _Alloc>& __x, const forward_list<_Tp, _Alloc>& __y) { return std::__1::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); } template <class _Tp, class _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator> (const forward_list<_Tp, _Alloc>& __x, const forward_list<_Tp, _Alloc>& __y) { return __y < __x; } template <class _Tp, class _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(const forward_list<_Tp, _Alloc>& __x, const forward_list<_Tp, _Alloc>& __y) { return !(__x < __y); } template <class _Tp, class _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(const forward_list<_Tp, _Alloc>& __x, const forward_list<_Tp, _Alloc>& __y) { return !(__y < __x); } template <class _Tp, class _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(forward_list<_Tp, _Alloc>& __x, forward_list<_Tp, _Alloc>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } } } namespace std { inline namespace __1 { template <class _Key, class _Tp> struct __hash_value_type; template <class _Tp> struct __is_hash_value_type_imp : false_type {}; template <class _Key, class _Value> struct __is_hash_value_type_imp<__hash_value_type<_Key, _Value>> : true_type {}; template <class ..._Args> struct __is_hash_value_type : false_type {}; template <class _One> struct __is_hash_value_type<_One> : __is_hash_value_type_imp<typename __uncvref<_One>::type> {}; size_t __next_prime(size_t __n); template <class _NodePtr> struct __hash_node_base { typedef typename pointer_traits<_NodePtr>::element_type __node_type; typedef __hash_node_base __first_node; typedef typename __rebind_pointer<_NodePtr, __first_node>::type __node_base_pointer; typedef _NodePtr __node_pointer; typedef __node_base_pointer __next_pointer; __next_pointer __next_; __attribute__ ((__exclude_from_explicit_instantiation__)) __next_pointer __ptr() noexcept { return static_cast<__next_pointer>( pointer_traits<__node_base_pointer>::pointer_to(*this)); } __attribute__ ((__exclude_from_explicit_instantiation__)) __node_pointer __upcast() noexcept { return static_cast<__node_pointer>( pointer_traits<__node_base_pointer>::pointer_to(*this)); } __attribute__ ((__exclude_from_explicit_instantiation__)) size_t __hash() const noexcept { return static_cast<__node_type const&>(*this).__hash_; } __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_node_base() noexcept : __next_(nullptr) {} }; template <class _Tp, class _VoidPtr> struct __hash_node : public __hash_node_base < typename __rebind_pointer<_VoidPtr, __hash_node<_Tp, _VoidPtr> >::type > { typedef _Tp __node_value_type; size_t __hash_; __node_value_type __value_; }; inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool __is_hash_power2(size_t __bc) { return __bc > 2 && !(__bc & (__bc - 1)); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) size_t __constrain_hash(size_t __h, size_t __bc) { return !(__bc & (__bc - 1)) ? __h & (__bc - 1) : (__h < __bc ? __h : __h % __bc); } inline __attribute__ ((__exclude_from_explicit_instantiation__)) size_t __next_hash_pow2(size_t __n) { return __n < 2 ? __n : (size_t(1) << (std::numeric_limits<size_t>::digits - __libcpp_clz(__n-1))); } template <class _Tp, class _Hash, class _Equal, class _Alloc> class __hash_table; template <class _NodePtr> class __hash_iterator; template <class _ConstNodePtr> class __hash_const_iterator; template <class _NodePtr> class __hash_local_iterator; template <class _ConstNodePtr> class __hash_const_local_iterator; template <class _HashIterator> class __hash_map_iterator; template <class _HashIterator> class __hash_map_const_iterator; template <class _Tp> struct __hash_key_value_types { static_assert(!is_reference<_Tp>::value && !is_const<_Tp>::value, ""); typedef _Tp key_type; typedef _Tp __node_value_type; typedef _Tp __container_value_type; static const bool __is_map = false; __attribute__ ((__exclude_from_explicit_instantiation__)) static key_type const& __get_key(_Tp const& __v) { return __v; } __attribute__ ((__exclude_from_explicit_instantiation__)) static __container_value_type const& __get_value(__node_value_type const& __v) { return __v; } __attribute__ ((__exclude_from_explicit_instantiation__)) static __container_value_type* __get_ptr(__node_value_type& __n) { return std::__1::addressof(__n); } __attribute__ ((__exclude_from_explicit_instantiation__)) static __container_value_type&& __move(__node_value_type& __v) { return std::__1::move(__v); } }; template <class _Key, class _Tp> struct __hash_key_value_types<__hash_value_type<_Key, _Tp> > { typedef _Key key_type; typedef _Tp mapped_type; typedef __hash_value_type<_Key, _Tp> __node_value_type; typedef pair<const _Key, _Tp> __container_value_type; typedef __container_value_type __map_value_type; static const bool __is_map = true; __attribute__ ((__exclude_from_explicit_instantiation__)) static key_type const& __get_key(__container_value_type const& __v) { return __v.first; } template <class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) static typename enable_if<__is_same_uncvref<_Up, __node_value_type>::value, __container_value_type const&>::type __get_value(_Up& __t) { return __t.__get_value(); } template <class _Up> __attribute__ ((__exclude_from_explicit_instantiation__)) static typename enable_if<__is_same_uncvref<_Up, __container_value_type>::value, __container_value_type const&>::type __get_value(_Up& __t) { return __t; } __attribute__ ((__exclude_from_explicit_instantiation__)) static __container_value_type* __get_ptr(__node_value_type& __n) { return std::__1::addressof(__n.__get_value()); } __attribute__ ((__exclude_from_explicit_instantiation__)) static pair<key_type&&, mapped_type&&> __move(__node_value_type& __v) { return __v.__move(); } }; template <class _Tp, class _AllocPtr, class _KVTypes = __hash_key_value_types<_Tp>, bool = _KVTypes::__is_map> struct __hash_map_pointer_types {}; template <class _Tp, class _AllocPtr, class _KVTypes> struct __hash_map_pointer_types<_Tp, _AllocPtr, _KVTypes, true> { typedef typename _KVTypes::__map_value_type _Mv; typedef typename __rebind_pointer<_AllocPtr, _Mv>::type __map_value_type_pointer; typedef typename __rebind_pointer<_AllocPtr, const _Mv>::type __const_map_value_type_pointer; }; template <class _NodePtr, class _NodeT = typename pointer_traits<_NodePtr>::element_type> struct __hash_node_types; template <class _NodePtr, class _Tp, class _VoidPtr> struct __hash_node_types<_NodePtr, __hash_node<_Tp, _VoidPtr> > : public __hash_key_value_types<_Tp>, __hash_map_pointer_types<_Tp, _VoidPtr> { typedef __hash_key_value_types<_Tp> __base; public: typedef ptrdiff_t difference_type; typedef size_t size_type; typedef typename __rebind_pointer<_NodePtr, void>::type __void_pointer; typedef typename pointer_traits<_NodePtr>::element_type __node_type; typedef _NodePtr __node_pointer; typedef __hash_node_base<__node_pointer> __node_base_type; typedef typename __rebind_pointer<_NodePtr, __node_base_type>::type __node_base_pointer; typedef typename __node_base_type::__next_pointer __next_pointer; typedef _Tp __node_value_type; typedef typename __rebind_pointer<_VoidPtr, __node_value_type>::type __node_value_type_pointer; typedef typename __rebind_pointer<_VoidPtr, const __node_value_type>::type __const_node_value_type_pointer; private: static_assert(!is_const<__node_type>::value, "_NodePtr should never be a pointer to const"); static_assert((is_same<typename pointer_traits<_VoidPtr>::element_type, void>::value), "_VoidPtr does not point to unqualified void type"); static_assert((is_same<typename __rebind_pointer<_VoidPtr, __node_type>::type, _NodePtr>::value), "_VoidPtr does not rebind to _NodePtr."); }; template <class _HashIterator> struct __hash_node_types_from_iterator; template <class _NodePtr> struct __hash_node_types_from_iterator<__hash_iterator<_NodePtr> > : __hash_node_types<_NodePtr> {}; template <class _NodePtr> struct __hash_node_types_from_iterator<__hash_const_iterator<_NodePtr> > : __hash_node_types<_NodePtr> {}; template <class _NodePtr> struct __hash_node_types_from_iterator<__hash_local_iterator<_NodePtr> > : __hash_node_types<_NodePtr> {}; template <class _NodePtr> struct __hash_node_types_from_iterator<__hash_const_local_iterator<_NodePtr> > : __hash_node_types<_NodePtr> {}; template <class _NodeValueTp, class _VoidPtr> struct __make_hash_node_types { typedef __hash_node<_NodeValueTp, _VoidPtr> _NodeTp; typedef typename __rebind_pointer<_VoidPtr, _NodeTp>::type _NodePtr; typedef __hash_node_types<_NodePtr> type; }; template <class _NodePtr> class __hash_iterator { typedef __hash_node_types<_NodePtr> _NodeTypes; typedef _NodePtr __node_pointer; typedef typename _NodeTypes::__next_pointer __next_pointer; __next_pointer __node_; public: typedef forward_iterator_tag iterator_category; typedef typename _NodeTypes::__node_value_type value_type; typedef typename _NodeTypes::difference_type difference_type; typedef value_type& reference; typedef typename _NodeTypes::__node_value_type_pointer pointer; __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_iterator() noexcept : __node_(nullptr) { ((void)0); } __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator*() const { ((void)0); return __node_->__upcast()->__value_; } __attribute__ ((__exclude_from_explicit_instantiation__)) pointer operator->() const { ((void)0); return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__value_); } __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_iterator& operator++() { ((void)0); __node_ = __node_->__next_; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_iterator operator++(int) { __hash_iterator __t(*this); ++(*this); return __t; } friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const __hash_iterator& __x, const __hash_iterator& __y) { return __x.__node_ == __y.__node_; } friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const __hash_iterator& __x, const __hash_iterator& __y) {return !(__x == __y);} private: __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_iterator(__next_pointer __node) noexcept : __node_(__node) {} template <class, class, class, class> friend class __hash_table; template <class> friend class __hash_const_iterator; template <class> friend class __hash_map_iterator; template <class, class, class, class, class> friend class unordered_map; template <class, class, class, class, class> friend class unordered_multimap; }; template <class _NodePtr> class __hash_const_iterator { static_assert(!is_const<typename pointer_traits<_NodePtr>::element_type>::value, ""); typedef __hash_node_types<_NodePtr> _NodeTypes; typedef _NodePtr __node_pointer; typedef typename _NodeTypes::__next_pointer __next_pointer; __next_pointer __node_; public: typedef __hash_iterator<_NodePtr> __non_const_iterator; typedef forward_iterator_tag iterator_category; typedef typename _NodeTypes::__node_value_type value_type; typedef typename _NodeTypes::difference_type difference_type; typedef const value_type& reference; typedef typename _NodeTypes::__const_node_value_type_pointer pointer; __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_const_iterator() noexcept : __node_(nullptr) { ((void)0); } __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_const_iterator(const __non_const_iterator& __x) noexcept : __node_(__x.__node_) { ((void)0); } __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator*() const { ((void)0); return __node_->__upcast()->__value_; } __attribute__ ((__exclude_from_explicit_instantiation__)) pointer operator->() const { ((void)0); return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__value_); } __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_const_iterator& operator++() { ((void)0); __node_ = __node_->__next_; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_const_iterator operator++(int) { __hash_const_iterator __t(*this); ++(*this); return __t; } friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const __hash_const_iterator& __x, const __hash_const_iterator& __y) { return __x.__node_ == __y.__node_; } friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const __hash_const_iterator& __x, const __hash_const_iterator& __y) {return !(__x == __y);} private: __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_const_iterator(__next_pointer __node) noexcept : __node_(__node) {} template <class, class, class, class> friend class __hash_table; template <class> friend class __hash_map_const_iterator; template <class, class, class, class, class> friend class unordered_map; template <class, class, class, class, class> friend class unordered_multimap; }; template <class _NodePtr> class __hash_local_iterator { typedef __hash_node_types<_NodePtr> _NodeTypes; typedef _NodePtr __node_pointer; typedef typename _NodeTypes::__next_pointer __next_pointer; __next_pointer __node_; size_t __bucket_; size_t __bucket_count_; public: typedef forward_iterator_tag iterator_category; typedef typename _NodeTypes::__node_value_type value_type; typedef typename _NodeTypes::difference_type difference_type; typedef value_type& reference; typedef typename _NodeTypes::__node_value_type_pointer pointer; __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_local_iterator() noexcept : __node_(nullptr) { ((void)0); } __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator*() const { ((void)0); return __node_->__upcast()->__value_; } __attribute__ ((__exclude_from_explicit_instantiation__)) pointer operator->() const { ((void)0); return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__value_); } __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_local_iterator& operator++() { ((void)0); __node_ = __node_->__next_; if (__node_ != nullptr && __constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_) __node_ = nullptr; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_local_iterator operator++(int) { __hash_local_iterator __t(*this); ++(*this); return __t; } friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const __hash_local_iterator& __x, const __hash_local_iterator& __y) { return __x.__node_ == __y.__node_; } friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const __hash_local_iterator& __x, const __hash_local_iterator& __y) {return !(__x == __y);} private: __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_local_iterator(__next_pointer __node, size_t __bucket, size_t __bucket_count) noexcept : __node_(__node), __bucket_(__bucket), __bucket_count_(__bucket_count) { if (__node_ != nullptr) __node_ = __node_->__next_; } template <class, class, class, class> friend class __hash_table; template <class> friend class __hash_const_local_iterator; template <class> friend class __hash_map_iterator; }; template <class _ConstNodePtr> class __hash_const_local_iterator { typedef __hash_node_types<_ConstNodePtr> _NodeTypes; typedef _ConstNodePtr __node_pointer; typedef typename _NodeTypes::__next_pointer __next_pointer; __next_pointer __node_; size_t __bucket_; size_t __bucket_count_; typedef pointer_traits<__node_pointer> __pointer_traits; typedef typename __pointer_traits::element_type __node; typedef typename remove_const<__node>::type __non_const_node; typedef typename __rebind_pointer<__node_pointer, __non_const_node>::type __non_const_node_pointer; public: typedef __hash_local_iterator<__non_const_node_pointer> __non_const_iterator; typedef forward_iterator_tag iterator_category; typedef typename _NodeTypes::__node_value_type value_type; typedef typename _NodeTypes::difference_type difference_type; typedef const value_type& reference; typedef typename _NodeTypes::__const_node_value_type_pointer pointer; __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_const_local_iterator() noexcept : __node_(nullptr) { ((void)0); } __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_const_local_iterator(const __non_const_iterator& __x) noexcept : __node_(__x.__node_), __bucket_(__x.__bucket_), __bucket_count_(__x.__bucket_count_) { ((void)0); } __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator*() const { ((void)0); return __node_->__upcast()->__value_; } __attribute__ ((__exclude_from_explicit_instantiation__)) pointer operator->() const { ((void)0); return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__value_); } __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_const_local_iterator& operator++() { ((void)0); __node_ = __node_->__next_; if (__node_ != nullptr && __constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_) __node_ = nullptr; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_const_local_iterator operator++(int) { __hash_const_local_iterator __t(*this); ++(*this); return __t; } friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y) { return __x.__node_ == __y.__node_; } friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y) {return !(__x == __y);} private: __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_const_local_iterator(__next_pointer __node, size_t __bucket, size_t __bucket_count) noexcept : __node_(__node), __bucket_(__bucket), __bucket_count_(__bucket_count) { if (__node_ != nullptr) __node_ = __node_->__next_; } template <class, class, class, class> friend class __hash_table; template <class> friend class __hash_map_const_iterator; }; template <class _Alloc> class __bucket_list_deallocator { typedef _Alloc allocator_type; typedef allocator_traits<allocator_type> __alloc_traits; typedef typename __alloc_traits::size_type size_type; __compressed_pair<size_type, allocator_type> __data_; public: typedef typename __alloc_traits::pointer pointer; __attribute__ ((__exclude_from_explicit_instantiation__)) __bucket_list_deallocator() noexcept(is_nothrow_default_constructible<allocator_type>::value) : __data_(0) {} __attribute__ ((__exclude_from_explicit_instantiation__)) __bucket_list_deallocator(const allocator_type& __a, size_type __size) noexcept(is_nothrow_copy_constructible<allocator_type>::value) : __data_(__size, __a) {} __attribute__ ((__exclude_from_explicit_instantiation__)) __bucket_list_deallocator(__bucket_list_deallocator&& __x) noexcept(is_nothrow_move_constructible<allocator_type>::value) : __data_(std::__1::move(__x.__data_)) { __x.size() = 0; } __attribute__ ((__exclude_from_explicit_instantiation__)) size_type& size() noexcept {return __data_.first();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type size() const noexcept {return __data_.first();} __attribute__ ((__exclude_from_explicit_instantiation__)) allocator_type& __alloc() noexcept {return __data_.second();} __attribute__ ((__exclude_from_explicit_instantiation__)) const allocator_type& __alloc() const noexcept {return __data_.second();} __attribute__ ((__exclude_from_explicit_instantiation__)) void operator()(pointer __p) noexcept { __alloc_traits::deallocate(__alloc(), __p, size()); } }; template <class _Alloc> class __hash_map_node_destructor; template <class _Alloc> class __hash_node_destructor { typedef _Alloc allocator_type; typedef allocator_traits<allocator_type> __alloc_traits; public: typedef typename __alloc_traits::pointer pointer; private: typedef __hash_node_types<pointer> _NodeTypes; allocator_type& __na_; __hash_node_destructor& operator=(const __hash_node_destructor&); public: bool __value_constructed; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __hash_node_destructor(allocator_type& __na, bool __constructed = false) noexcept : __na_(__na), __value_constructed(__constructed) {} __attribute__ ((__exclude_from_explicit_instantiation__)) void operator()(pointer __p) noexcept { if (__value_constructed) __alloc_traits::destroy(__na_, _NodeTypes::__get_ptr(__p->__value_)); if (__p) __alloc_traits::deallocate(__na_, __p, 1); } template <class> friend class __hash_map_node_destructor; }; template <class _Key, class _Hash, class _Equal> struct __enforce_unordered_container_requirements { static_assert(__check_hash_requirements<_Key, _Hash>::value, "the specified hash does not meet the Hash requirements"); static_assert(is_copy_constructible<_Equal>::value, "the specified comparator is required to be copy constructible"); typedef int type; }; template <class _Key, class _Hash, class _Equal> __attribute__((diagnose_if(!__invokable<_Equal const&, _Key const&, _Key const&>::value, "the specified comparator type does not provide a viable const call operator", "warning"))) __attribute__((diagnose_if(!__invokable<_Hash const&, _Key const&>::value, "the specified hash functor does not provide a viable const call operator", "warning"))) typename __enforce_unordered_container_requirements<_Key, _Hash, _Equal>::type __diagnose_unordered_container_requirements(int); template <class _Key, class _Hash, class _Equal> int __diagnose_unordered_container_requirements(void*); template <class _Tp, class _Hash, class _Equal, class _Alloc> class __hash_table { public: typedef _Tp value_type; typedef _Hash hasher; typedef _Equal key_equal; typedef _Alloc allocator_type; private: typedef allocator_traits<allocator_type> __alloc_traits; typedef typename __make_hash_node_types<value_type, typename __alloc_traits::void_pointer>::type _NodeTypes; public: typedef typename _NodeTypes::__node_value_type __node_value_type; typedef typename _NodeTypes::__container_value_type __container_value_type; typedef typename _NodeTypes::key_type key_type; typedef value_type& reference; typedef const value_type& const_reference; typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::const_pointer const_pointer; typedef typename _NodeTypes::size_type size_type; typedef typename _NodeTypes::difference_type difference_type; public: typedef typename _NodeTypes::__node_type __node; typedef typename __rebind_alloc_helper<__alloc_traits, __node>::type __node_allocator; typedef allocator_traits<__node_allocator> __node_traits; typedef typename _NodeTypes::__void_pointer __void_pointer; typedef typename _NodeTypes::__node_pointer __node_pointer; typedef typename _NodeTypes::__node_pointer __node_const_pointer; typedef typename _NodeTypes::__node_base_type __first_node; typedef typename _NodeTypes::__node_base_pointer __node_base_pointer; typedef typename _NodeTypes::__next_pointer __next_pointer; private: static_assert((is_same<__node_pointer, typename __node_traits::pointer>::value), "Allocator does not rebind pointers in a sane manner."); typedef typename __rebind_alloc_helper<__node_traits, __first_node>::type __node_base_allocator; typedef allocator_traits<__node_base_allocator> __node_base_traits; static_assert((is_same<__node_base_pointer, typename __node_base_traits::pointer>::value), "Allocator does not rebind pointers in a sane manner."); private: typedef typename __rebind_alloc_helper<__node_traits, __next_pointer>::type __pointer_allocator; typedef __bucket_list_deallocator<__pointer_allocator> __bucket_list_deleter; typedef unique_ptr<__next_pointer[], __bucket_list_deleter> __bucket_list; typedef allocator_traits<__pointer_allocator> __pointer_alloc_traits; typedef typename __bucket_list_deleter::pointer __node_pointer_pointer; __bucket_list __bucket_list_; __compressed_pair<__first_node, __node_allocator> __p1_; __compressed_pair<size_type, hasher> __p2_; __compressed_pair<float, key_equal> __p3_; __attribute__ ((__exclude_from_explicit_instantiation__)) size_type& size() noexcept {return __p2_.first();} public: __attribute__ ((__exclude_from_explicit_instantiation__)) size_type size() const noexcept {return __p2_.first();} __attribute__ ((__exclude_from_explicit_instantiation__)) hasher& hash_function() noexcept {return __p2_.second();} __attribute__ ((__exclude_from_explicit_instantiation__)) const hasher& hash_function() const noexcept {return __p2_.second();} __attribute__ ((__exclude_from_explicit_instantiation__)) float& max_load_factor() noexcept {return __p3_.first();} __attribute__ ((__exclude_from_explicit_instantiation__)) float max_load_factor() const noexcept {return __p3_.first();} __attribute__ ((__exclude_from_explicit_instantiation__)) key_equal& key_eq() noexcept {return __p3_.second();} __attribute__ ((__exclude_from_explicit_instantiation__)) const key_equal& key_eq() const noexcept {return __p3_.second();} __attribute__ ((__exclude_from_explicit_instantiation__)) __node_allocator& __node_alloc() noexcept {return __p1_.second();} __attribute__ ((__exclude_from_explicit_instantiation__)) const __node_allocator& __node_alloc() const noexcept {return __p1_.second();} public: typedef __hash_iterator<__node_pointer> iterator; typedef __hash_const_iterator<__node_pointer> const_iterator; typedef __hash_local_iterator<__node_pointer> local_iterator; typedef __hash_const_local_iterator<__node_pointer> const_local_iterator; __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_table() noexcept(is_nothrow_default_constructible<__bucket_list>::value && is_nothrow_default_constructible<__first_node>::value && is_nothrow_default_constructible<__node_allocator>::value && is_nothrow_default_constructible<hasher>::value && is_nothrow_default_constructible<key_equal>::value); __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_table(const hasher& __hf, const key_equal& __eql); __hash_table(const hasher& __hf, const key_equal& __eql, const allocator_type& __a); explicit __hash_table(const allocator_type& __a); __hash_table(const __hash_table& __u); __hash_table(const __hash_table& __u, const allocator_type& __a); __hash_table(__hash_table&& __u) noexcept(is_nothrow_move_constructible<__bucket_list>::value && is_nothrow_move_constructible<__first_node>::value && is_nothrow_move_constructible<__node_allocator>::value && is_nothrow_move_constructible<hasher>::value && is_nothrow_move_constructible<key_equal>::value); __hash_table(__hash_table&& __u, const allocator_type& __a); ~__hash_table(); __hash_table& operator=(const __hash_table& __u); __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_table& operator=(__hash_table&& __u) noexcept(__node_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable<__node_allocator>::value && is_nothrow_move_assignable<hasher>::value && is_nothrow_move_assignable<key_equal>::value); template <class _InputIterator> void __assign_unique(_InputIterator __first, _InputIterator __last); template <class _InputIterator> void __assign_multi(_InputIterator __first, _InputIterator __last); __attribute__ ((__exclude_from_explicit_instantiation__)) size_type max_size() const noexcept { return std::min<size_type>( __node_traits::max_size(__node_alloc()), numeric_limits<difference_type >::max() ); } private: __attribute__ ((__exclude_from_explicit_instantiation__)) __next_pointer __node_insert_multi_prepare(size_t __cp_hash, value_type& __cp_val); __attribute__ ((__exclude_from_explicit_instantiation__)) void __node_insert_multi_perform(__node_pointer __cp, __next_pointer __pn) noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) __next_pointer __node_insert_unique_prepare(size_t __nd_hash, value_type& __nd_val); __attribute__ ((__exclude_from_explicit_instantiation__)) void __node_insert_unique_perform(__node_pointer __ptr) noexcept; public: __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> __node_insert_unique(__node_pointer __nd); __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __node_insert_multi(__node_pointer __nd); __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __node_insert_multi(const_iterator __p, __node_pointer __nd); template <class _Key, class ..._Args> __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> __emplace_unique_key_args(_Key const& __k, _Args&&... __args); template <class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> __emplace_unique_impl(_Args&&... __args); template <class _Pp> __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> __emplace_unique(_Pp&& __x) { return __emplace_unique_extract_key(std::__1::forward<_Pp>(__x), __can_extract_key<_Pp, key_type>()); } template <class _First, class _Second> __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if< __can_extract_map_key<_First, key_type, __container_value_type>::value, pair<iterator, bool> >::type __emplace_unique(_First&& __f, _Second&& __s) { return __emplace_unique_key_args(__f, std::__1::forward<_First>(__f), std::__1::forward<_Second>(__s)); } template <class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> __emplace_unique(_Args&&... __args) { return __emplace_unique_impl(std::__1::forward<_Args>(__args)...); } template <class _Pp> __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> __emplace_unique_extract_key(_Pp&& __x, __extract_key_fail_tag) { return __emplace_unique_impl(std::__1::forward<_Pp>(__x)); } template <class _Pp> __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> __emplace_unique_extract_key(_Pp&& __x, __extract_key_self_tag) { return __emplace_unique_key_args(__x, std::__1::forward<_Pp>(__x)); } template <class _Pp> __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> __emplace_unique_extract_key(_Pp&& __x, __extract_key_first_tag) { return __emplace_unique_key_args(__x.first, std::__1::forward<_Pp>(__x)); } template <class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __emplace_multi(_Args&&... __args); template <class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __emplace_hint_multi(const_iterator __p, _Args&&... __args); __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> __insert_unique(__container_value_type&& __x) { return __emplace_unique_key_args(_NodeTypes::__get_key(__x), std::__1::move(__x)); } template <class _Pp, class = typename enable_if< !__is_same_uncvref<_Pp, __container_value_type>::value >::type> __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> __insert_unique(_Pp&& __x) { return __emplace_unique(std::__1::forward<_Pp>(__x)); } template <class _Pp> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __insert_multi(_Pp&& __x) { return __emplace_multi(std::__1::forward<_Pp>(__x)); } template <class _Pp> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator __insert_multi(const_iterator __p, _Pp&& __x) { return __emplace_hint_multi(__p, std::__1::forward<_Pp>(__x)); } __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> __insert_unique(const __container_value_type& __x) { return __emplace_unique_key_args(_NodeTypes::__get_key(__x), __x); } void clear() noexcept; void rehash(size_type __n); __attribute__ ((__exclude_from_explicit_instantiation__)) void reserve(size_type __n) {rehash(static_cast<size_type>(ceil(__n / max_load_factor())));} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type bucket_count() const noexcept { return __bucket_list_.get_deleter().size(); } __attribute__ ((__exclude_from_explicit_instantiation__)) iterator begin() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) iterator end() noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator begin() const noexcept; __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator end() const noexcept; template <class _Key> __attribute__ ((__exclude_from_explicit_instantiation__)) size_type bucket(const _Key& __k) const { ((void)0); return __constrain_hash(hash_function()(__k), bucket_count()); } template <class _Key> iterator find(const _Key& __x); template <class _Key> const_iterator find(const _Key& __x) const; typedef __hash_node_destructor<__node_allocator> _Dp; typedef unique_ptr<__node, _Dp> __node_holder; iterator erase(const_iterator __p); iterator erase(const_iterator __first, const_iterator __last); template <class _Key> size_type __erase_unique(const _Key& __k); template <class _Key> size_type __erase_multi(const _Key& __k); __node_holder remove(const_iterator __p) noexcept; template <class _Key> __attribute__ ((__exclude_from_explicit_instantiation__)) size_type __count_unique(const _Key& __k) const; template <class _Key> size_type __count_multi(const _Key& __k) const; template <class _Key> pair<iterator, iterator> __equal_range_unique(const _Key& __k); template <class _Key> pair<const_iterator, const_iterator> __equal_range_unique(const _Key& __k) const; template <class _Key> pair<iterator, iterator> __equal_range_multi(const _Key& __k); template <class _Key> pair<const_iterator, const_iterator> __equal_range_multi(const _Key& __k) const; void swap(__hash_table& __u) noexcept(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value); __attribute__ ((__exclude_from_explicit_instantiation__)) size_type max_bucket_count() const noexcept {return max_size(); } size_type bucket_size(size_type __n) const; __attribute__ ((__exclude_from_explicit_instantiation__)) float load_factor() const noexcept { size_type __bc = bucket_count(); return __bc != 0 ? (float)size() / __bc : 0.f; } __attribute__ ((__exclude_from_explicit_instantiation__)) void max_load_factor(float __mlf) noexcept { ((void)0); max_load_factor() = std::__1::max(__mlf, load_factor()); } __attribute__ ((__exclude_from_explicit_instantiation__)) local_iterator begin(size_type __n) { ((void)0); return local_iterator(__bucket_list_[__n], __n, bucket_count()); } __attribute__ ((__exclude_from_explicit_instantiation__)) local_iterator end(size_type __n) { ((void)0); return local_iterator(nullptr, __n, bucket_count()); } __attribute__ ((__exclude_from_explicit_instantiation__)) const_local_iterator cbegin(size_type __n) const { ((void)0); return const_local_iterator(__bucket_list_[__n], __n, bucket_count()); } __attribute__ ((__exclude_from_explicit_instantiation__)) const_local_iterator cend(size_type __n) const { ((void)0); return const_local_iterator(nullptr, __n, bucket_count()); } private: void __rehash(size_type __n); template <class ..._Args> __node_holder __construct_node(_Args&& ...__args); template <class _First, class ..._Rest> __node_holder __construct_node_hash(size_t __hash, _First&& __f, _Rest&&... __rest); __attribute__ ((__exclude_from_explicit_instantiation__)) void __copy_assign_alloc(const __hash_table& __u) {__copy_assign_alloc(__u, integral_constant<bool, __node_traits::propagate_on_container_copy_assignment::value>());} void __copy_assign_alloc(const __hash_table& __u, true_type); __attribute__ ((__exclude_from_explicit_instantiation__)) void __copy_assign_alloc(const __hash_table&, false_type) {} void __move_assign(__hash_table& __u, false_type); void __move_assign(__hash_table& __u, true_type) noexcept(is_nothrow_move_assignable<__node_allocator>::value && is_nothrow_move_assignable<hasher>::value && is_nothrow_move_assignable<key_equal>::value); __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(__hash_table& __u) noexcept(!__node_traits::propagate_on_container_move_assignment::value || (is_nothrow_move_assignable<__pointer_allocator>::value && is_nothrow_move_assignable<__node_allocator>::value)) {__move_assign_alloc(__u, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>());} __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(__hash_table& __u, true_type) noexcept(is_nothrow_move_assignable<__pointer_allocator>::value && is_nothrow_move_assignable<__node_allocator>::value) { __bucket_list_.get_deleter().__alloc() = std::__1::move(__u.__bucket_list_.get_deleter().__alloc()); __node_alloc() = std::__1::move(__u.__node_alloc()); } __attribute__ ((__exclude_from_explicit_instantiation__)) void __move_assign_alloc(__hash_table&, false_type) noexcept {} void __deallocate_node(__next_pointer __np) noexcept; __next_pointer __detach() noexcept; template <class, class, class, class, class> friend class unordered_map; template <class, class, class, class, class> friend class unordered_multimap; }; template <class _Tp, class _Hash, class _Equal, class _Alloc> inline __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table() noexcept(is_nothrow_default_constructible<__bucket_list>::value && is_nothrow_default_constructible<__first_node>::value && is_nothrow_default_constructible<__node_allocator>::value && is_nothrow_default_constructible<hasher>::value && is_nothrow_default_constructible<key_equal>::value) : __p2_(0), __p3_(1.0f) { } template <class _Tp, class _Hash, class _Equal, class _Alloc> inline __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf, const key_equal& __eql) : __bucket_list_(nullptr, __bucket_list_deleter()), __p1_(), __p2_(0, __hf), __p3_(1.0f, __eql) { } template <class _Tp, class _Hash, class _Equal, class _Alloc> __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf, const key_equal& __eql, const allocator_type& __a) : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)), __p1_(__second_tag(), __node_allocator(__a)), __p2_(0, __hf), __p3_(1.0f, __eql) { } template <class _Tp, class _Hash, class _Equal, class _Alloc> __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const allocator_type& __a) : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)), __p1_(__second_tag(), __node_allocator(__a)), __p2_(0), __p3_(1.0f) { } template <class _Tp, class _Hash, class _Equal, class _Alloc> __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u) : __bucket_list_(nullptr, __bucket_list_deleter(allocator_traits<__pointer_allocator>:: select_on_container_copy_construction( __u.__bucket_list_.get_deleter().__alloc()), 0)), __p1_(__second_tag(), allocator_traits<__node_allocator>:: select_on_container_copy_construction(__u.__node_alloc())), __p2_(0, __u.hash_function()), __p3_(__u.__p3_) { } template <class _Tp, class _Hash, class _Equal, class _Alloc> __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u, const allocator_type& __a) : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)), __p1_(__second_tag(), __node_allocator(__a)), __p2_(0, __u.hash_function()), __p3_(__u.__p3_) { } template <class _Tp, class _Hash, class _Equal, class _Alloc> __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u) noexcept(is_nothrow_move_constructible<__bucket_list>::value && is_nothrow_move_constructible<__first_node>::value && is_nothrow_move_constructible<__node_allocator>::value && is_nothrow_move_constructible<hasher>::value && is_nothrow_move_constructible<key_equal>::value) : __bucket_list_(std::__1::move(__u.__bucket_list_)), __p1_(std::__1::move(__u.__p1_)), __p2_(std::__1::move(__u.__p2_)), __p3_(std::__1::move(__u.__p3_)) { if (size() > 0) { __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = __p1_.first().__ptr(); __u.__p1_.first().__next_ = nullptr; __u.size() = 0; } } template <class _Tp, class _Hash, class _Equal, class _Alloc> __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u, const allocator_type& __a) : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)), __p1_(__second_tag(), __node_allocator(__a)), __p2_(0, std::__1::move(__u.hash_function())), __p3_(std::__1::move(__u.__p3_)) { if (__a == allocator_type(__u.__node_alloc())) { __bucket_list_.reset(__u.__bucket_list_.release()); __bucket_list_.get_deleter().size() = __u.__bucket_list_.get_deleter().size(); __u.__bucket_list_.get_deleter().size() = 0; if (__u.size() > 0) { __p1_.first().__next_ = __u.__p1_.first().__next_; __u.__p1_.first().__next_ = nullptr; __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = __p1_.first().__ptr(); size() = __u.size(); __u.size() = 0; } } } template <class _Tp, class _Hash, class _Equal, class _Alloc> __hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table() { __deallocate_node(__p1_.first().__next_); } template <class _Tp, class _Hash, class _Equal, class _Alloc> void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__copy_assign_alloc( const __hash_table& __u, true_type) { if (__node_alloc() != __u.__node_alloc()) { clear(); __bucket_list_.reset(); __bucket_list_.get_deleter().size() = 0; } __bucket_list_.get_deleter().__alloc() = __u.__bucket_list_.get_deleter().__alloc(); __node_alloc() = __u.__node_alloc(); } template <class _Tp, class _Hash, class _Equal, class _Alloc> __hash_table<_Tp, _Hash, _Equal, _Alloc>& __hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(const __hash_table& __u) { if (this != &__u) { __copy_assign_alloc(__u); hash_function() = __u.hash_function(); key_eq() = __u.key_eq(); max_load_factor() = __u.max_load_factor(); __assign_multi(__u.begin(), __u.end()); } return *this; } template <class _Tp, class _Hash, class _Equal, class _Alloc> void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate_node(__next_pointer __np) noexcept { __node_allocator& __na = __node_alloc(); while (__np != nullptr) { __next_pointer __next = __np->__next_; __node_pointer __real_np = __np->__upcast(); __node_traits::destroy(__na, _NodeTypes::__get_ptr(__real_np->__value_)); __node_traits::deallocate(__na, __real_np, 1); __np = __next; } } template <class _Tp, class _Hash, class _Equal, class _Alloc> typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__next_pointer __hash_table<_Tp, _Hash, _Equal, _Alloc>::__detach() noexcept { size_type __bc = bucket_count(); for (size_type __i = 0; __i < __bc; ++__i) __bucket_list_[__i] = nullptr; size() = 0; __next_pointer __cache = __p1_.first().__next_; __p1_.first().__next_ = nullptr; return __cache; } template <class _Tp, class _Hash, class _Equal, class _Alloc> void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign( __hash_table& __u, true_type) noexcept(is_nothrow_move_assignable<__node_allocator>::value && is_nothrow_move_assignable<hasher>::value && is_nothrow_move_assignable<key_equal>::value) { clear(); __bucket_list_.reset(__u.__bucket_list_.release()); __bucket_list_.get_deleter().size() = __u.__bucket_list_.get_deleter().size(); __u.__bucket_list_.get_deleter().size() = 0; __move_assign_alloc(__u); size() = __u.size(); hash_function() = std::__1::move(__u.hash_function()); max_load_factor() = __u.max_load_factor(); key_eq() = std::__1::move(__u.key_eq()); __p1_.first().__next_ = __u.__p1_.first().__next_; if (size() > 0) { __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = __p1_.first().__ptr(); __u.__p1_.first().__next_ = nullptr; __u.size() = 0; } } template <class _Tp, class _Hash, class _Equal, class _Alloc> void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign( __hash_table& __u, false_type) { if (__node_alloc() == __u.__node_alloc()) __move_assign(__u, true_type()); else { hash_function() = std::__1::move(__u.hash_function()); key_eq() = std::__1::move(__u.key_eq()); max_load_factor() = __u.max_load_factor(); if (bucket_count() != 0) { __next_pointer __cache = __detach(); const_iterator __i = __u.begin(); while (__cache != nullptr && __u.size() != 0) { __cache->__upcast()->__value_ = std::__1::move(__u.remove(__i++)->__value_); __next_pointer __next = __cache->__next_; __node_insert_multi(__cache->__upcast()); __cache = __next; } __deallocate_node(__cache); } const_iterator __i = __u.begin(); while (__u.size() != 0) { __node_holder __h = __construct_node(_NodeTypes::__move(__u.remove(__i++)->__value_)); __node_insert_multi(__h.get()); __h.release(); } } } template <class _Tp, class _Hash, class _Equal, class _Alloc> inline __hash_table<_Tp, _Hash, _Equal, _Alloc>& __hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(__hash_table&& __u) noexcept(__node_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable<__node_allocator>::value && is_nothrow_move_assignable<hasher>::value && is_nothrow_move_assignable<key_equal>::value) { __move_assign(__u, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>()); return *this; } template <class _Tp, class _Hash, class _Equal, class _Alloc> template <class _InputIterator> void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_unique(_InputIterator __first, _InputIterator __last) { typedef iterator_traits<_InputIterator> _ITraits; typedef typename _ITraits::value_type _ItValueType; static_assert((is_same<_ItValueType, __container_value_type>::value), "__assign_unique may only be called with the containers value type"); if (bucket_count() != 0) { __next_pointer __cache = __detach(); for (; __cache != nullptr && __first != __last; ++__first) { __cache->__upcast()->__value_ = *__first; __next_pointer __next = __cache->__next_; __node_insert_unique(__cache->__upcast()); __cache = __next; } __deallocate_node(__cache); } for (; __first != __last; ++__first) __insert_unique(*__first); } template <class _Tp, class _Hash, class _Equal, class _Alloc> template <class _InputIterator> void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_multi(_InputIterator __first, _InputIterator __last) { typedef iterator_traits<_InputIterator> _ITraits; typedef typename _ITraits::value_type _ItValueType; static_assert((is_same<_ItValueType, __container_value_type>::value || is_same<_ItValueType, __node_value_type>::value), "__assign_multi may only be called with the containers value type" " or the nodes value type"); if (bucket_count() != 0) { __next_pointer __cache = __detach(); for (; __cache != nullptr && __first != __last; ++__first) { __cache->__upcast()->__value_ = *__first; __next_pointer __next = __cache->__next_; __node_insert_multi(__cache->__upcast()); __cache = __next; } __deallocate_node(__cache); } for (; __first != __last; ++__first) __insert_multi(_NodeTypes::__get_value(*__first)); } template <class _Tp, class _Hash, class _Equal, class _Alloc> inline typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() noexcept { return iterator(__p1_.first().__next_); } template <class _Tp, class _Hash, class _Equal, class _Alloc> inline typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::end() noexcept { return iterator(nullptr); } template <class _Tp, class _Hash, class _Equal, class _Alloc> inline typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const noexcept { return const_iterator(__p1_.first().__next_); } template <class _Tp, class _Hash, class _Equal, class _Alloc> inline typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const noexcept { return const_iterator(nullptr); } template <class _Tp, class _Hash, class _Equal, class _Alloc> void __hash_table<_Tp, _Hash, _Equal, _Alloc>::clear() noexcept { if (size() > 0) { __deallocate_node(__p1_.first().__next_); __p1_.first().__next_ = nullptr; size_type __bc = bucket_count(); for (size_type __i = 0; __i < __bc; ++__i) __bucket_list_[__i] = nullptr; size() = 0; } } template <class _Tp, class _Hash, class _Equal, class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__next_pointer __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_prepare( size_t __hash, value_type& __value) { size_type __bc = bucket_count(); if (__bc != 0) { size_t __chash = __constrain_hash(__hash, __bc); __next_pointer __ndptr = __bucket_list_[__chash]; if (__ndptr != nullptr) { for (__ndptr = __ndptr->__next_; __ndptr != nullptr && __constrain_hash(__ndptr->__hash(), __bc) == __chash; __ndptr = __ndptr->__next_) { if (key_eq()(__ndptr->__upcast()->__value_, __value)) return __ndptr; } } } if (size()+1 > __bc * max_load_factor() || __bc == 0) { rehash(std::__1::max<size_type>(2 * __bc + !__is_hash_power2(__bc), size_type(ceil(float(size() + 1) / max_load_factor())))); } return nullptr; } template <class _Tp, class _Hash, class _Equal, class _Alloc> __attribute__ ((__exclude_from_explicit_instantiation__)) void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_perform( __node_pointer __nd) noexcept { size_type __bc = bucket_count(); size_t __chash = __constrain_hash(__nd->__hash(), __bc); __next_pointer __pn = __bucket_list_[__chash]; if (__pn == nullptr) { __pn =__p1_.first().__ptr(); __nd->__next_ = __pn->__next_; __pn->__next_ = __nd->__ptr(); __bucket_list_[__chash] = __pn; if (__nd->__next_ != nullptr) __bucket_list_[__constrain_hash(__nd->__next_->__hash(), __bc)] = __nd->__ptr(); } else { __nd->__next_ = __pn->__next_; __pn->__next_ = __nd->__ptr(); } ++size(); } template <class _Tp, class _Hash, class _Equal, class _Alloc> pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool> __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __nd) { __nd->__hash_ = hash_function()(__nd->__value_); __next_pointer __existing_node = __node_insert_unique_prepare(__nd->__hash(), __nd->__value_); bool __inserted = false; if (__existing_node == nullptr) { __node_insert_unique_perform(__nd); __existing_node = __nd->__ptr(); __inserted = true; } return pair<iterator, bool>(iterator(__existing_node), __inserted); } template <class _Tp, class _Hash, class _Equal, class _Alloc> typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__next_pointer __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_prepare( size_t __cp_hash, value_type& __cp_val) { size_type __bc = bucket_count(); if (size()+1 > __bc * max_load_factor() || __bc == 0) { rehash(std::__1::max<size_type>(2 * __bc + !__is_hash_power2(__bc), size_type(ceil(float(size() + 1) / max_load_factor())))); __bc = bucket_count(); } size_t __chash = __constrain_hash(__cp_hash, __bc); __next_pointer __pn = __bucket_list_[__chash]; if (__pn != nullptr) { for (bool __found = false; __pn->__next_ != nullptr && __constrain_hash(__pn->__next_->__hash(), __bc) == __chash; __pn = __pn->__next_) { if (__found != (__pn->__next_->__hash() == __cp_hash && key_eq()(__pn->__next_->__upcast()->__value_, __cp_val))) { if (!__found) __found = true; else break; } } } return __pn; } template <class _Tp, class _Hash, class _Equal, class _Alloc> void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_perform( __node_pointer __cp, __next_pointer __pn) noexcept { size_type __bc = bucket_count(); size_t __chash = __constrain_hash(__cp->__hash_, __bc); if (__pn == nullptr) { __pn =__p1_.first().__ptr(); __cp->__next_ = __pn->__next_; __pn->__next_ = __cp->__ptr(); __bucket_list_[__chash] = __pn; if (__cp->__next_ != nullptr) __bucket_list_[__constrain_hash(__cp->__next_->__hash(), __bc)] = __cp->__ptr(); } else { __cp->__next_ = __pn->__next_; __pn->__next_ = __cp->__ptr(); if (__cp->__next_ != nullptr) { size_t __nhash = __constrain_hash(__cp->__next_->__hash(), __bc); if (__nhash != __chash) __bucket_list_[__nhash] = __cp->__ptr(); } } ++size(); } template <class _Tp, class _Hash, class _Equal, class _Alloc> typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __cp) { __cp->__hash_ = hash_function()(__cp->__value_); __next_pointer __pn = __node_insert_multi_prepare(__cp->__hash(), __cp->__value_); __node_insert_multi_perform(__cp, __pn); return iterator(__cp->__ptr()); } template <class _Tp, class _Hash, class _Equal, class _Alloc> typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi( const_iterator __p, __node_pointer __cp) { if (__p != end() && key_eq()(*__p, __cp->__value_)) { __next_pointer __np = __p.__node_; __cp->__hash_ = __np->__hash(); size_type __bc = bucket_count(); if (size()+1 > __bc * max_load_factor() || __bc == 0) { rehash(std::__1::max<size_type>(2 * __bc + !__is_hash_power2(__bc), size_type(ceil(float(size() + 1) / max_load_factor())))); __bc = bucket_count(); } size_t __chash = __constrain_hash(__cp->__hash_, __bc); __next_pointer __pp = __bucket_list_[__chash]; while (__pp->__next_ != __np) __pp = __pp->__next_; __cp->__next_ = __np; __pp->__next_ = static_cast<__next_pointer>(__cp); ++size(); return iterator(static_cast<__next_pointer>(__cp)); } return __node_insert_multi(__cp); } template <class _Tp, class _Hash, class _Equal, class _Alloc> template <class _Key, class ..._Args> pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool> __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const& __k, _Args&&... __args) { size_t __hash = hash_function()(__k); size_type __bc = bucket_count(); bool __inserted = false; __next_pointer __nd; size_t __chash; if (__bc != 0) { __chash = __constrain_hash(__hash, __bc); __nd = __bucket_list_[__chash]; if (__nd != nullptr) { for (__nd = __nd->__next_; __nd != nullptr && (__nd->__hash() == __hash || __constrain_hash(__nd->__hash(), __bc) == __chash); __nd = __nd->__next_) { if (key_eq()(__nd->__upcast()->__value_, __k)) goto __done; } } } { __node_holder __h = __construct_node_hash(__hash, std::__1::forward<_Args>(__args)...); if (size()+1 > __bc * max_load_factor() || __bc == 0) { rehash(std::__1::max<size_type>(2 * __bc + !__is_hash_power2(__bc), size_type(ceil(float(size() + 1) / max_load_factor())))); __bc = bucket_count(); __chash = __constrain_hash(__hash, __bc); } __next_pointer __pn = __bucket_list_[__chash]; if (__pn == nullptr) { __pn = __p1_.first().__ptr(); __h->__next_ = __pn->__next_; __pn->__next_ = __h.get()->__ptr(); __bucket_list_[__chash] = __pn; if (__h->__next_ != nullptr) __bucket_list_[__constrain_hash(__h->__next_->__hash(), __bc)] = __h.get()->__ptr(); } else { __h->__next_ = __pn->__next_; __pn->__next_ = static_cast<__next_pointer>(__h.get()); } __nd = static_cast<__next_pointer>(__h.release()); ++size(); __inserted = true; } __done: return pair<iterator, bool>(iterator(__nd), __inserted); } template <class _Tp, class _Hash, class _Equal, class _Alloc> template <class... _Args> pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool> __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_impl(_Args&&... __args) { __node_holder __h = __construct_node(std::__1::forward<_Args>(__args)...); pair<iterator, bool> __r = __node_insert_unique(__h.get()); if (__r.second) __h.release(); return __r; } template <class _Tp, class _Hash, class _Equal, class _Alloc> template <class... _Args> typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_multi(_Args&&... __args) { __node_holder __h = __construct_node(std::__1::forward<_Args>(__args)...); iterator __r = __node_insert_multi(__h.get()); __h.release(); return __r; } template <class _Tp, class _Hash, class _Equal, class _Alloc> template <class... _Args> typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi( const_iterator __p, _Args&&... __args) { __node_holder __h = __construct_node(std::__1::forward<_Args>(__args)...); iterator __r = __node_insert_multi(__p, __h.get()); __h.release(); return __r; } template <class _Tp, class _Hash, class _Equal, class _Alloc> void __hash_table<_Tp, _Hash, _Equal, _Alloc>::rehash(size_type __n) __attribute__((__no_sanitize__("unsigned-integer-overflow"))) { if (__n == 1) __n = 2; else if (__n & (__n - 1)) __n = __next_prime(__n); size_type __bc = bucket_count(); if (__n > __bc) __rehash(__n); else if (__n < __bc) { __n = std::__1::max<size_type> ( __n, __is_hash_power2(__bc) ? __next_hash_pow2(size_t(ceil(float(size()) / max_load_factor()))) : __next_prime(size_t(ceil(float(size()) / max_load_factor()))) ); if (__n < __bc) __rehash(__n); } } template <class _Tp, class _Hash, class _Equal, class _Alloc> void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __nbc) { __pointer_allocator& __npa = __bucket_list_.get_deleter().__alloc(); __bucket_list_.reset(__nbc > 0 ? __pointer_alloc_traits::allocate(__npa, __nbc) : nullptr); __bucket_list_.get_deleter().size() = __nbc; if (__nbc > 0) { for (size_type __i = 0; __i < __nbc; ++__i) __bucket_list_[__i] = nullptr; __next_pointer __pp = __p1_.first().__ptr(); __next_pointer __cp = __pp->__next_; if (__cp != nullptr) { size_type __chash = __constrain_hash(__cp->__hash(), __nbc); __bucket_list_[__chash] = __pp; size_type __phash = __chash; for (__pp = __cp, __cp = __cp->__next_; __cp != nullptr; __cp = __pp->__next_) { __chash = __constrain_hash(__cp->__hash(), __nbc); if (__chash == __phash) __pp = __cp; else { if (__bucket_list_[__chash] == nullptr) { __bucket_list_[__chash] = __pp; __pp = __cp; __phash = __chash; } else { __next_pointer __np = __cp; for (; __np->__next_ != nullptr && key_eq()(__cp->__upcast()->__value_, __np->__next_->__upcast()->__value_); __np = __np->__next_) ; __pp->__next_ = __np->__next_; __np->__next_ = __bucket_list_[__chash]->__next_; __bucket_list_[__chash]->__next_ = __cp; } } } } } } template <class _Tp, class _Hash, class _Equal, class _Alloc> template <class _Key> typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) { size_t __hash = hash_function()(__k); size_type __bc = bucket_count(); if (__bc != 0) { size_t __chash = __constrain_hash(__hash, __bc); __next_pointer __nd = __bucket_list_[__chash]; if (__nd != nullptr) { for (__nd = __nd->__next_; __nd != nullptr && (__nd->__hash() == __hash || __constrain_hash(__nd->__hash(), __bc) == __chash); __nd = __nd->__next_) { if ((__nd->__hash() == __hash) && key_eq()(__nd->__upcast()->__value_, __k)) return iterator(__nd); } } } return end(); } template <class _Tp, class _Hash, class _Equal, class _Alloc> template <class _Key> typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) const { size_t __hash = hash_function()(__k); size_type __bc = bucket_count(); if (__bc != 0) { size_t __chash = __constrain_hash(__hash, __bc); __next_pointer __nd = __bucket_list_[__chash]; if (__nd != nullptr) { for (__nd = __nd->__next_; __nd != nullptr && (__hash == __nd->__hash() || __constrain_hash(__nd->__hash(), __bc) == __chash); __nd = __nd->__next_) { if ((__nd->__hash() == __hash) && key_eq()(__nd->__upcast()->__value_, __k)) return const_iterator(__nd); } } } return end(); } template <class _Tp, class _Hash, class _Equal, class _Alloc> template <class ..._Args> typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(_Args&& ...__args) { static_assert(!__is_hash_value_type<_Args...>::value, "Construct cannot be called with a hash value type"); __node_allocator& __na = __node_alloc(); __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__value_), std::__1::forward<_Args>(__args)...); __h.get_deleter().__value_constructed = true; __h->__hash_ = hash_function()(__h->__value_); __h->__next_ = nullptr; return __h; } template <class _Tp, class _Hash, class _Equal, class _Alloc> template <class _First, class ..._Rest> typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node_hash( size_t __hash, _First&& __f, _Rest&& ...__rest) { static_assert(!__is_hash_value_type<_First, _Rest...>::value, "Construct cannot be called with a hash value type"); __node_allocator& __na = __node_alloc(); __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__value_), std::__1::forward<_First>(__f), std::__1::forward<_Rest>(__rest)...); __h.get_deleter().__value_constructed = true; __h->__hash_ = __hash; __h->__next_ = nullptr; return __h; } template <class _Tp, class _Hash, class _Equal, class _Alloc> typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __p) { __next_pointer __np = __p.__node_; iterator __r(__np); ++__r; remove(__p); return __r; } template <class _Tp, class _Hash, class _Equal, class _Alloc> typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator __hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __first, const_iterator __last) { for (const_iterator __p = __first; __first != __last; __p = __first) { ++__first; erase(__p); } __next_pointer __np = __last.__node_; return iterator (__np); } template <class _Tp, class _Hash, class _Equal, class _Alloc> template <class _Key> typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type __hash_table<_Tp, _Hash, _Equal, _Alloc>::__erase_unique(const _Key& __k) { iterator __i = find(__k); if (__i == end()) return 0; erase(__i); return 1; } template <class _Tp, class _Hash, class _Equal, class _Alloc> template <class _Key> typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type __hash_table<_Tp, _Hash, _Equal, _Alloc>::__erase_multi(const _Key& __k) { size_type __r = 0; iterator __i = find(__k); if (__i != end()) { iterator __e = end(); do { erase(__i++); ++__r; } while (__i != __e && key_eq()(*__i, __k)); } return __r; } template <class _Tp, class _Hash, class _Equal, class _Alloc> typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) noexcept { __next_pointer __cn = __p.__node_; size_type __bc = bucket_count(); size_t __chash = __constrain_hash(__cn->__hash(), __bc); __next_pointer __pn = __bucket_list_[__chash]; for (; __pn->__next_ != __cn; __pn = __pn->__next_) ; if (__pn == __p1_.first().__ptr() || __constrain_hash(__pn->__hash(), __bc) != __chash) { if (__cn->__next_ == nullptr || __constrain_hash(__cn->__next_->__hash(), __bc) != __chash) __bucket_list_[__chash] = nullptr; } if (__cn->__next_ != nullptr) { size_t __nhash = __constrain_hash(__cn->__next_->__hash(), __bc); if (__nhash != __chash) __bucket_list_[__nhash] = __pn; } __pn->__next_ = __cn->__next_; __cn->__next_ = nullptr; --size(); return __node_holder(__cn->__upcast(), _Dp(__node_alloc(), true)); } template <class _Tp, class _Hash, class _Equal, class _Alloc> template <class _Key> inline typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type __hash_table<_Tp, _Hash, _Equal, _Alloc>::__count_unique(const _Key& __k) const { return static_cast<size_type>(find(__k) != end()); } template <class _Tp, class _Hash, class _Equal, class _Alloc> template <class _Key> typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type __hash_table<_Tp, _Hash, _Equal, _Alloc>::__count_multi(const _Key& __k) const { size_type __r = 0; const_iterator __i = find(__k); if (__i != end()) { const_iterator __e = end(); do { ++__i; ++__r; } while (__i != __e && key_eq()(*__i, __k)); } return __r; } template <class _Tp, class _Hash, class _Equal, class _Alloc> template <class _Key> pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator> __hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_unique( const _Key& __k) { iterator __i = find(__k); iterator __j = __i; if (__i != end()) ++__j; return pair<iterator, iterator>(__i, __j); } template <class _Tp, class _Hash, class _Equal, class _Alloc> template <class _Key> pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator, typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator> __hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_unique( const _Key& __k) const { const_iterator __i = find(__k); const_iterator __j = __i; if (__i != end()) ++__j; return pair<const_iterator, const_iterator>(__i, __j); } template <class _Tp, class _Hash, class _Equal, class _Alloc> template <class _Key> pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator> __hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_multi( const _Key& __k) { iterator __i = find(__k); iterator __j = __i; if (__i != end()) { iterator __e = end(); do { ++__j; } while (__j != __e && key_eq()(*__j, __k)); } return pair<iterator, iterator>(__i, __j); } template <class _Tp, class _Hash, class _Equal, class _Alloc> template <class _Key> pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator, typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator> __hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_multi( const _Key& __k) const { const_iterator __i = find(__k); const_iterator __j = __i; if (__i != end()) { const_iterator __e = end(); do { ++__j; } while (__j != __e && key_eq()(*__j, __k)); } return pair<const_iterator, const_iterator>(__i, __j); } template <class _Tp, class _Hash, class _Equal, class _Alloc> void __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u) noexcept(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value) { ((void)0); { __node_pointer_pointer __npp = __bucket_list_.release(); __bucket_list_.reset(__u.__bucket_list_.release()); __u.__bucket_list_.reset(__npp); } std::__1::swap(__bucket_list_.get_deleter().size(), __u.__bucket_list_.get_deleter().size()); __swap_allocator(__bucket_list_.get_deleter().__alloc(), __u.__bucket_list_.get_deleter().__alloc()); __swap_allocator(__node_alloc(), __u.__node_alloc()); std::__1::swap(__p1_.first().__next_, __u.__p1_.first().__next_); __p2_.swap(__u.__p2_); __p3_.swap(__u.__p3_); if (size() > 0) __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash(), bucket_count())] = __p1_.first().__ptr(); if (__u.size() > 0) __u.__bucket_list_[__constrain_hash(__u.__p1_.first().__next_->__hash(), __u.bucket_count())] = __u.__p1_.first().__ptr(); } template <class _Tp, class _Hash, class _Equal, class _Alloc> typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type __hash_table<_Tp, _Hash, _Equal, _Alloc>::bucket_size(size_type __n) const { ((void)0); __next_pointer __np = __bucket_list_[__n]; size_type __bc = bucket_count(); size_type __r = 0; if (__np != nullptr) { for (__np = __np->__next_; __np != nullptr && __constrain_hash(__np->__hash(), __bc) == __n; __np = __np->__next_, ++__r) ; } return __r; } template <class _Tp, class _Hash, class _Equal, class _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(__hash_table<_Tp, _Hash, _Equal, _Alloc>& __x, __hash_table<_Tp, _Hash, _Equal, _Alloc>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } } } namespace std { inline namespace __1 { template <class _Key, class _Cp, class _Hash, bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value> class __unordered_map_hasher : private _Hash { public: __attribute__ ((__exclude_from_explicit_instantiation__)) __unordered_map_hasher() noexcept(is_nothrow_default_constructible<_Hash>::value) : _Hash() {} __attribute__ ((__exclude_from_explicit_instantiation__)) __unordered_map_hasher(const _Hash& __h) noexcept(is_nothrow_copy_constructible<_Hash>::value) : _Hash(__h) {} __attribute__ ((__exclude_from_explicit_instantiation__)) const _Hash& hash_function() const noexcept {return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(const _Cp& __x) const {return static_cast<const _Hash&>(*this)(__x.__get_value().first);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(const _Key& __x) const {return static_cast<const _Hash&>(*this)(__x);} void swap(__unordered_map_hasher&__y) noexcept(__is_nothrow_swappable<_Hash>::value) { using std::__1::swap; swap(static_cast<_Hash&>(*this), static_cast<_Hash&>(__y)); } }; template <class _Key, class _Cp, class _Hash> class __unordered_map_hasher<_Key, _Cp, _Hash, false> { _Hash __hash_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) __unordered_map_hasher() noexcept(is_nothrow_default_constructible<_Hash>::value) : __hash_() {} __attribute__ ((__exclude_from_explicit_instantiation__)) __unordered_map_hasher(const _Hash& __h) noexcept(is_nothrow_copy_constructible<_Hash>::value) : __hash_(__h) {} __attribute__ ((__exclude_from_explicit_instantiation__)) const _Hash& hash_function() const noexcept {return __hash_;} __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(const _Cp& __x) const {return __hash_(__x.__get_value().first);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_t operator()(const _Key& __x) const {return __hash_(__x);} void swap(__unordered_map_hasher&__y) noexcept(__is_nothrow_swappable<_Hash>::value) { using std::__1::swap; swap(__hash_, __y.__hash_); } }; template <class _Key, class _Cp, class _Hash, bool __b> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(__unordered_map_hasher<_Key, _Cp, _Hash, __b>& __x, __unordered_map_hasher<_Key, _Cp, _Hash, __b>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } template <class _Key, class _Cp, class _Pred, bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value> class __unordered_map_equal : private _Pred { public: __attribute__ ((__exclude_from_explicit_instantiation__)) __unordered_map_equal() noexcept(is_nothrow_default_constructible<_Pred>::value) : _Pred() {} __attribute__ ((__exclude_from_explicit_instantiation__)) __unordered_map_equal(const _Pred& __p) noexcept(is_nothrow_copy_constructible<_Pred>::value) : _Pred(__p) {} __attribute__ ((__exclude_from_explicit_instantiation__)) const _Pred& key_eq() const noexcept {return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const _Cp& __x, const _Cp& __y) const {return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y.__get_value().first);} __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const _Cp& __x, const _Key& __y) const {return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y);} __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const _Key& __x, const _Cp& __y) const {return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);} void swap(__unordered_map_equal&__y) noexcept(__is_nothrow_swappable<_Pred>::value) { using std::__1::swap; swap(static_cast<_Pred&>(*this), static_cast<_Pred&>(__y)); } }; template <class _Key, class _Cp, class _Pred> class __unordered_map_equal<_Key, _Cp, _Pred, false> { _Pred __pred_; public: __attribute__ ((__exclude_from_explicit_instantiation__)) __unordered_map_equal() noexcept(is_nothrow_default_constructible<_Pred>::value) : __pred_() {} __attribute__ ((__exclude_from_explicit_instantiation__)) __unordered_map_equal(const _Pred& __p) noexcept(is_nothrow_copy_constructible<_Pred>::value) : __pred_(__p) {} __attribute__ ((__exclude_from_explicit_instantiation__)) const _Pred& key_eq() const noexcept {return __pred_;} __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const _Cp& __x, const _Cp& __y) const {return __pred_(__x.__get_value().first, __y.__get_value().first);} __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const _Cp& __x, const _Key& __y) const {return __pred_(__x.__get_value().first, __y);} __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator()(const _Key& __x, const _Cp& __y) const {return __pred_(__x, __y.__get_value().first);} void swap(__unordered_map_equal&__y) noexcept(__is_nothrow_swappable<_Pred>::value) { using std::__1::swap; swap(__pred_, __y.__pred_); } }; template <class _Key, class _Cp, class _Pred, bool __b> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(__unordered_map_equal<_Key, _Cp, _Pred, __b>& __x, __unordered_map_equal<_Key, _Cp, _Pred, __b>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } template <class _Alloc> class __hash_map_node_destructor { typedef _Alloc allocator_type; typedef allocator_traits<allocator_type> __alloc_traits; public: typedef typename __alloc_traits::pointer pointer; private: allocator_type& __na_; __hash_map_node_destructor& operator=(const __hash_map_node_destructor&); public: bool __first_constructed; bool __second_constructed; __attribute__ ((__exclude_from_explicit_instantiation__)) explicit __hash_map_node_destructor(allocator_type& __na) noexcept : __na_(__na), __first_constructed(false), __second_constructed(false) {} __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x) noexcept : __na_(__x.__na_), __first_constructed(__x.__value_constructed), __second_constructed(__x.__value_constructed) { __x.__value_constructed = false; } __attribute__ ((__exclude_from_explicit_instantiation__)) void operator()(pointer __p) noexcept { if (__second_constructed) __alloc_traits::destroy(__na_, std::__1::addressof(__p->__value_.__get_value().second)); if (__first_constructed) __alloc_traits::destroy(__na_, std::__1::addressof(__p->__value_.__get_value().first)); if (__p) __alloc_traits::deallocate(__na_, __p, 1); } }; template <class _Key, class _Tp> struct __hash_value_type { typedef _Key key_type; typedef _Tp mapped_type; typedef pair<const key_type, mapped_type> value_type; typedef pair<key_type&, mapped_type&> __nc_ref_pair_type; typedef pair<key_type&&, mapped_type&&> __nc_rref_pair_type; private: value_type __cc; public: __attribute__ ((__exclude_from_explicit_instantiation__)) value_type& __get_value() { return __cc; } __attribute__ ((__exclude_from_explicit_instantiation__)) const value_type& __get_value() const { return __cc; } __attribute__ ((__exclude_from_explicit_instantiation__)) __nc_ref_pair_type __ref() { value_type& __v = __get_value(); return __nc_ref_pair_type(const_cast<key_type&>(__v.first), __v.second); } __attribute__ ((__exclude_from_explicit_instantiation__)) __nc_rref_pair_type __move() { value_type& __v = __get_value(); return __nc_rref_pair_type( std::__1::move(const_cast<key_type&>(__v.first)), std::__1::move(__v.second)); } __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_value_type& operator=(const __hash_value_type& __v) { __ref() = __v.__get_value(); return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_value_type& operator=(__hash_value_type&& __v) { __ref() = __v.__move(); return *this; } template <class _ValueTp, class = typename enable_if< __is_same_uncvref<_ValueTp, value_type>::value >::type > __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_value_type& operator=(_ValueTp&& __v) { __ref() = std::__1::forward<_ValueTp>(__v); return *this; } private: __hash_value_type(const __hash_value_type& __v) = delete; __hash_value_type(__hash_value_type&& __v) = delete; template <class ..._Args> explicit __hash_value_type(_Args&& ...__args) = delete; ~__hash_value_type() = delete; }; template <class _HashIterator> class __hash_map_iterator { _HashIterator __i_; typedef __hash_node_types_from_iterator<_HashIterator> _NodeTypes; public: typedef forward_iterator_tag iterator_category; typedef typename _NodeTypes::__map_value_type value_type; typedef typename _NodeTypes::difference_type difference_type; typedef value_type& reference; typedef typename _NodeTypes::__map_value_type_pointer pointer; __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_map_iterator() noexcept {} __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_map_iterator(_HashIterator __i) noexcept : __i_(__i) {} __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator*() const {return __i_->__get_value();} __attribute__ ((__exclude_from_explicit_instantiation__)) pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__get_value());} __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_map_iterator& operator++() {++__i_; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_map_iterator operator++(int) { __hash_map_iterator __t(*this); ++(*this); return __t; } friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y) {return __x.__i_ == __y.__i_;} friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y) {return __x.__i_ != __y.__i_;} template <class, class, class, class, class> friend class unordered_map; template <class, class, class, class, class> friend class unordered_multimap; template <class> friend class __hash_const_iterator; template <class> friend class __hash_const_local_iterator; template <class> friend class __hash_map_const_iterator; }; template <class _HashIterator> class __hash_map_const_iterator { _HashIterator __i_; typedef __hash_node_types_from_iterator<_HashIterator> _NodeTypes; public: typedef forward_iterator_tag iterator_category; typedef typename _NodeTypes::__map_value_type value_type; typedef typename _NodeTypes::difference_type difference_type; typedef const value_type& reference; typedef typename _NodeTypes::__const_map_value_type_pointer pointer; __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_map_const_iterator() noexcept {} __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_map_const_iterator(_HashIterator __i) noexcept : __i_(__i) {} __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_map_const_iterator( __hash_map_iterator<typename _HashIterator::__non_const_iterator> __i) noexcept : __i_(__i.__i_) {} __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator*() const {return __i_->__get_value();} __attribute__ ((__exclude_from_explicit_instantiation__)) pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__get_value());} __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_map_const_iterator& operator++() {++__i_; return *this;} __attribute__ ((__exclude_from_explicit_instantiation__)) __hash_map_const_iterator operator++(int) { __hash_map_const_iterator __t(*this); ++(*this); return __t; } friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y) {return __x.__i_ == __y.__i_;} friend __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y) {return __x.__i_ != __y.__i_;} template <class, class, class, class, class> friend class unordered_map; template <class, class, class, class, class> friend class unordered_multimap; template <class> friend class __hash_const_iterator; template <class> friend class __hash_const_local_iterator; }; template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> class unordered_multimap; template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>, class _Alloc = allocator<pair<const _Key, _Tp> > > class unordered_map { public: typedef _Key key_type; typedef _Tp mapped_type; typedef typename __identity<_Hash>::type hasher; typedef typename __identity<_Pred>::type key_equal; typedef typename __identity<_Alloc>::type allocator_type; typedef pair<const key_type, mapped_type> value_type; typedef value_type& reference; typedef const value_type& const_reference; static_assert((is_same<value_type, typename allocator_type::value_type>::value), "Invalid allocator::value_type"); private: typedef __hash_value_type<key_type, mapped_type> __value_type; typedef __unordered_map_hasher<key_type, __value_type, hasher> __hasher; typedef __unordered_map_equal<key_type, __value_type, key_equal> __key_equal; typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __value_type>::type __allocator_type; typedef __hash_table<__value_type, __hasher, __key_equal, __allocator_type> __table; __table __table_; typedef typename __table::_NodeTypes _NodeTypes; typedef typename __table::__node_pointer __node_pointer; typedef typename __table::__node_const_pointer __node_const_pointer; typedef typename __table::__node_traits __node_traits; typedef typename __table::__node_allocator __node_allocator; typedef typename __table::__node __node; typedef __hash_map_node_destructor<__node_allocator> _Dp; typedef unique_ptr<__node, _Dp> __node_holder; typedef allocator_traits<allocator_type> __alloc_traits; static_assert((is_same<typename __table::__container_value_type, value_type>::value), ""); static_assert((is_same<typename __table::__node_value_type, __value_type>::value), ""); public: typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::const_pointer const_pointer; typedef typename __table::size_type size_type; typedef typename __table::difference_type difference_type; typedef __hash_map_iterator<typename __table::iterator> iterator; typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator; typedef __hash_map_iterator<typename __table::local_iterator> local_iterator; typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator; template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2> friend class unordered_map; template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2> friend class unordered_multimap; __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_map() noexcept(is_nothrow_default_constructible<__table>::value) { } explicit unordered_map(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); unordered_map(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); template <class _InputIterator> unordered_map(_InputIterator __first, _InputIterator __last); template <class _InputIterator> unordered_map(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); template <class _InputIterator> unordered_map(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) explicit unordered_map(const allocator_type& __a); unordered_map(const unordered_map& __u); unordered_map(const unordered_map& __u, const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_map(unordered_map&& __u) noexcept(is_nothrow_move_constructible<__table>::value); unordered_map(unordered_map&& __u, const allocator_type& __a); unordered_map(initializer_list<value_type> __il); unordered_map(initializer_list<value_type> __il, size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); unordered_map(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_map(size_type __n, const allocator_type& __a) : unordered_map(__n, hasher(), key_equal(), __a) {} __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_map(size_type __n, const hasher& __hf, const allocator_type& __a) : unordered_map(__n, __hf, key_equal(), __a) {} template <class _InputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_map(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a) : unordered_map(__first, __last, __n, hasher(), key_equal(), __a) {} template <class _InputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_map(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a) : unordered_map(__first, __last, __n, __hf, key_equal(), __a) {} __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_map(initializer_list<value_type> __il, size_type __n, const allocator_type& __a) : unordered_map(__il, __n, hasher(), key_equal(), __a) {} __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_map(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a) : unordered_map(__il, __n, __hf, key_equal(), __a) {} __attribute__ ((__exclude_from_explicit_instantiation__)) ~unordered_map() { static_assert(sizeof(__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), ""); } __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_map& operator=(const unordered_map& __u) { __table_ = __u.__table_; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_map& operator=(unordered_map&& __u) noexcept(is_nothrow_move_assignable<__table>::value); __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_map& operator=(initializer_list<value_type> __il); __attribute__ ((__exclude_from_explicit_instantiation__)) allocator_type get_allocator() const noexcept {return allocator_type(__table_.__node_alloc());} [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) bool empty() const noexcept {return __table_.size() == 0;} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type size() const noexcept {return __table_.size();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type max_size() const noexcept {return __table_.max_size();} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator begin() noexcept {return __table_.begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator end() noexcept {return __table_.end();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator begin() const noexcept {return __table_.begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator end() const noexcept {return __table_.end();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cbegin() const noexcept {return __table_.begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cend() const noexcept {return __table_.end();} __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> insert(const value_type& __x) {return __table_.__insert_unique(__x);} iterator insert(const_iterator __p, const value_type& __x) { ((void)__p); return insert(__x).first; } template <class _InputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) void insert(_InputIterator __first, _InputIterator __last); __attribute__ ((__exclude_from_explicit_instantiation__)) void insert(initializer_list<value_type> __il) {insert(__il.begin(), __il.end());} __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> insert(value_type&& __x) {return __table_.__insert_unique(std::__1::move(__x));} iterator insert(const_iterator __p, value_type&& __x) { ((void)__p); return __table_.__insert_unique(std::__1::move(__x)).first; } template <class _Pp, class = typename enable_if<is_constructible<value_type, _Pp>::value>::type> __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> insert(_Pp&& __x) {return __table_.__insert_unique(std::__1::forward<_Pp>(__x));} template <class _Pp, class = typename enable_if<is_constructible<value_type, _Pp>::value>::type> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const_iterator __p, _Pp&& __x) { ((void)__p); return insert(std::__1::forward<_Pp>(__x)).first; } template <class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> emplace(_Args&&... __args) { return __table_.__emplace_unique(std::__1::forward<_Args>(__args)...); } template <class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator emplace_hint(const_iterator __p, _Args&&... __args) { ((void)__p); return __table_.__emplace_unique(std::__1::forward<_Args>(__args)...).first; } __attribute__ ((__exclude_from_explicit_instantiation__)) iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator erase(iterator __p) {return __table_.erase(__p.__i_);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator erase(const_iterator __first, const_iterator __last) {return __table_.erase(__first.__i_, __last.__i_);} __attribute__ ((__exclude_from_explicit_instantiation__)) void clear() noexcept {__table_.clear();} __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(unordered_map& __u) noexcept(__is_nothrow_swappable<__table>::value) { __table_.swap(__u.__table_);} __attribute__ ((__exclude_from_explicit_instantiation__)) hasher hash_function() const {return __table_.hash_function().hash_function();} __attribute__ ((__exclude_from_explicit_instantiation__)) key_equal key_eq() const {return __table_.key_eq().key_eq();} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator find(const key_type& __k) {return __table_.find(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator find(const key_type& __k) const {return __table_.find(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type count(const key_type& __k) const {return __table_.__count_unique(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, iterator> equal_range(const key_type& __k) {return __table_.__equal_range_unique(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {return __table_.__equal_range_unique(__k);} mapped_type& operator[](const key_type& __k); mapped_type& operator[](key_type&& __k); mapped_type& at(const key_type& __k); const mapped_type& at(const key_type& __k) const; __attribute__ ((__exclude_from_explicit_instantiation__)) size_type bucket_count() const noexcept {return __table_.bucket_count();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type max_bucket_count() const noexcept {return __table_.max_bucket_count();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type bucket(const key_type& __k) const {return __table_.bucket(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) local_iterator begin(size_type __n) {return __table_.begin(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) local_iterator end(size_type __n) {return __table_.end(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_local_iterator end(size_type __n) const {return __table_.cend(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_local_iterator cend(size_type __n) const {return __table_.cend(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) float load_factor() const noexcept {return __table_.load_factor();} __attribute__ ((__exclude_from_explicit_instantiation__)) float max_load_factor() const noexcept {return __table_.max_load_factor();} __attribute__ ((__exclude_from_explicit_instantiation__)) void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);} __attribute__ ((__exclude_from_explicit_instantiation__)) void rehash(size_type __n) {__table_.rehash(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) void reserve(size_type __n) {__table_.reserve(__n);} private: }; template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( size_type __n, const hasher& __hf, const key_equal& __eql) : __table_(__hf, __eql) { __table_.rehash(__n); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a) : __table_(__hf, __eql, typename __table::allocator_type(__a)) { __table_.rehash(__n); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( const allocator_type& __a) : __table_(typename __table::allocator_type(__a)) { } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> template <class _InputIterator> unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( _InputIterator __first, _InputIterator __last) { insert(__first, __last); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> template <class _InputIterator> unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql) : __table_(__hf, __eql) { __table_.rehash(__n); insert(__first, __last); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> template <class _InputIterator> unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a) : __table_(__hf, __eql, typename __table::allocator_type(__a)) { __table_.rehash(__n); insert(__first, __last); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( const unordered_map& __u) : __table_(__u.__table_) { __table_.rehash(__u.bucket_count()); insert(__u.begin(), __u.end()); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( const unordered_map& __u, const allocator_type& __a) : __table_(__u.__table_, typename __table::allocator_type(__a)) { __table_.rehash(__u.bucket_count()); insert(__u.begin(), __u.end()); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( unordered_map&& __u) noexcept(is_nothrow_move_constructible<__table>::value) : __table_(std::__1::move(__u.__table_)) { } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( unordered_map&& __u, const allocator_type& __a) : __table_(std::__1::move(__u.__table_), typename __table::allocator_type(__a)) { if (__a != __u.get_allocator()) { iterator __i = __u.begin(); while (__u.size() != 0) { __table_.__emplace_unique( __u.__table_.remove((__i++).__i_)->__value_.__move()); } } } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( initializer_list<value_type> __il, size_type __n, const hasher& __hf, const key_equal& __eql) : __table_(__hf, __eql) { __table_.rehash(__n); insert(__il.begin(), __il.end()); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( initializer_list<value_type> __il, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a) : __table_(__hf, __eql, typename __table::allocator_type(__a)) { __table_.rehash(__n); insert(__il.begin(), __il.end()); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_map&& __u) noexcept(is_nothrow_move_assignable<__table>::value) { __table_ = std::__1::move(__u.__table_); return *this; } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=( initializer_list<value_type> __il) { __table_.__assign_unique(__il.begin(), __il.end()); return *this; } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> template <class _InputIterator> inline void unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) { for (; __first != __last; ++__first) __table_.__insert_unique(*__first); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> _Tp& unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k) { return __table_.__emplace_unique_key_args(__k, std::piecewise_construct, std::forward_as_tuple(__k), std::forward_as_tuple()).first->__get_value().second; } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> _Tp& unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](key_type&& __k) { return __table_.__emplace_unique_key_args(__k, std::piecewise_construct, std::forward_as_tuple(std::move(__k)), std::forward_as_tuple()).first->__get_value().second; } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> _Tp& unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k) { iterator __i = find(__k); if (__i == end()) __throw_out_of_range("unordered_map::at: key not found"); return __i->second; } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> const _Tp& unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k) const { const_iterator __i = find(__k); if (__i == end()) __throw_out_of_range("unordered_map::at: key not found"); return __i->second; } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> bool operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { if (__x.size() != __y.size()) return false; typedef typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator const_iterator; for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end(); __i != __ex; ++__i) { const_iterator __j = __y.find(__i->first); if (__j == __ey || !(*__i == *__j)) return false; } return true; } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { return !(__x == __y); } template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>, class _Alloc = allocator<pair<const _Key, _Tp> > > class unordered_multimap { public: typedef _Key key_type; typedef _Tp mapped_type; typedef typename __identity<_Hash>::type hasher; typedef typename __identity<_Pred>::type key_equal; typedef typename __identity<_Alloc>::type allocator_type; typedef pair<const key_type, mapped_type> value_type; typedef value_type& reference; typedef const value_type& const_reference; static_assert((is_same<value_type, typename allocator_type::value_type>::value), "Invalid allocator::value_type"); private: typedef __hash_value_type<key_type, mapped_type> __value_type; typedef __unordered_map_hasher<key_type, __value_type, hasher> __hasher; typedef __unordered_map_equal<key_type, __value_type, key_equal> __key_equal; typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __value_type>::type __allocator_type; typedef __hash_table<__value_type, __hasher, __key_equal, __allocator_type> __table; __table __table_; typedef typename __table::_NodeTypes _NodeTypes; typedef typename __table::__node_traits __node_traits; typedef typename __table::__node_allocator __node_allocator; typedef typename __table::__node __node; typedef __hash_map_node_destructor<__node_allocator> _Dp; typedef unique_ptr<__node, _Dp> __node_holder; typedef allocator_traits<allocator_type> __alloc_traits; static_assert((is_same<typename __node_traits::size_type, typename __alloc_traits::size_type>::value), "Allocator uses different size_type for different types"); public: typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::const_pointer const_pointer; typedef typename __table::size_type size_type; typedef typename __table::difference_type difference_type; typedef __hash_map_iterator<typename __table::iterator> iterator; typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator; typedef __hash_map_iterator<typename __table::local_iterator> local_iterator; typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator; template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2> friend class unordered_map; template <class _Key2, class _Tp2, class _Hash2, class _Pred2, class _Alloc2> friend class unordered_multimap; __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_multimap() noexcept(is_nothrow_default_constructible<__table>::value) { } explicit unordered_multimap(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); unordered_multimap(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); template <class _InputIterator> unordered_multimap(_InputIterator __first, _InputIterator __last); template <class _InputIterator> unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); template <class _InputIterator> unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) explicit unordered_multimap(const allocator_type& __a); unordered_multimap(const unordered_multimap& __u); unordered_multimap(const unordered_multimap& __u, const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_multimap(unordered_multimap&& __u) noexcept(is_nothrow_move_constructible<__table>::value); unordered_multimap(unordered_multimap&& __u, const allocator_type& __a); unordered_multimap(initializer_list<value_type> __il); unordered_multimap(initializer_list<value_type> __il, size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); unordered_multimap(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_multimap(size_type __n, const allocator_type& __a) : unordered_multimap(__n, hasher(), key_equal(), __a) {} __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_multimap(size_type __n, const hasher& __hf, const allocator_type& __a) : unordered_multimap(__n, __hf, key_equal(), __a) {} template <class _InputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a) : unordered_multimap(__first, __last, __n, hasher(), key_equal(), __a) {} template <class _InputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a) : unordered_multimap(__first, __last, __n, __hf, key_equal(), __a) {} __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_multimap(initializer_list<value_type> __il, size_type __n, const allocator_type& __a) : unordered_multimap(__il, __n, hasher(), key_equal(), __a) {} __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_multimap(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a) : unordered_multimap(__il, __n, __hf, key_equal(), __a) {} __attribute__ ((__exclude_from_explicit_instantiation__)) ~unordered_multimap() { static_assert(sizeof(__diagnose_unordered_container_requirements<_Key, _Hash, _Pred>(0)), ""); } __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_multimap& operator=(const unordered_multimap& __u) { __table_ = __u.__table_; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_multimap& operator=(unordered_multimap&& __u) noexcept(is_nothrow_move_assignable<__table>::value); __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_multimap& operator=(initializer_list<value_type> __il); __attribute__ ((__exclude_from_explicit_instantiation__)) allocator_type get_allocator() const noexcept {return allocator_type(__table_.__node_alloc());} [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) bool empty() const noexcept {return __table_.size() == 0;} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type size() const noexcept {return __table_.size();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type max_size() const noexcept {return __table_.max_size();} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator begin() noexcept {return __table_.begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator end() noexcept {return __table_.end();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator begin() const noexcept {return __table_.begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator end() const noexcept {return __table_.end();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cbegin() const noexcept {return __table_.begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cend() const noexcept {return __table_.end();} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const_iterator __p, const value_type& __x) {return __table_.__insert_multi(__p.__i_, __x);} template <class _InputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) void insert(_InputIterator __first, _InputIterator __last); __attribute__ ((__exclude_from_explicit_instantiation__)) void insert(initializer_list<value_type> __il) {insert(__il.begin(), __il.end());} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(value_type&& __x) {return __table_.__insert_multi(std::__1::move(__x));} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const_iterator __p, value_type&& __x) {return __table_.__insert_multi(__p.__i_, std::__1::move(__x));} template <class _Pp, class = typename enable_if<is_constructible<value_type, _Pp>::value>::type> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(_Pp&& __x) {return __table_.__insert_multi(std::__1::forward<_Pp>(__x));} template <class _Pp, class = typename enable_if<is_constructible<value_type, _Pp>::value>::type> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const_iterator __p, _Pp&& __x) {return __table_.__insert_multi(__p.__i_, std::__1::forward<_Pp>(__x));} template <class... _Args> iterator emplace(_Args&&... __args) { return __table_.__emplace_multi(std::__1::forward<_Args>(__args)...); } template <class... _Args> iterator emplace_hint(const_iterator __p, _Args&&... __args) { return __table_.__emplace_hint_multi(__p.__i_, std::__1::forward<_Args>(__args)...); } __attribute__ ((__exclude_from_explicit_instantiation__)) iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator erase(iterator __p) {return __table_.erase(__p.__i_);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator erase(const_iterator __first, const_iterator __last) {return __table_.erase(__first.__i_, __last.__i_);} __attribute__ ((__exclude_from_explicit_instantiation__)) void clear() noexcept {__table_.clear();} __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(unordered_multimap& __u) noexcept(__is_nothrow_swappable<__table>::value) {__table_.swap(__u.__table_);} __attribute__ ((__exclude_from_explicit_instantiation__)) hasher hash_function() const {return __table_.hash_function().hash_function();} __attribute__ ((__exclude_from_explicit_instantiation__)) key_equal key_eq() const {return __table_.key_eq().key_eq();} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator find(const key_type& __k) {return __table_.find(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator find(const key_type& __k) const {return __table_.find(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type count(const key_type& __k) const {return __table_.__count_multi(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, iterator> equal_range(const key_type& __k) {return __table_.__equal_range_multi(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {return __table_.__equal_range_multi(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type bucket_count() const noexcept {return __table_.bucket_count();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type max_bucket_count() const noexcept {return __table_.max_bucket_count();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type bucket(const key_type& __k) const {return __table_.bucket(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) local_iterator begin(size_type __n) {return __table_.begin(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) local_iterator end(size_type __n) {return __table_.end(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_local_iterator end(size_type __n) const {return __table_.cend(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_local_iterator cend(size_type __n) const {return __table_.cend(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) float load_factor() const noexcept {return __table_.load_factor();} __attribute__ ((__exclude_from_explicit_instantiation__)) float max_load_factor() const noexcept {return __table_.max_load_factor();} __attribute__ ((__exclude_from_explicit_instantiation__)) void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);} __attribute__ ((__exclude_from_explicit_instantiation__)) void rehash(size_type __n) {__table_.rehash(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) void reserve(size_type __n) {__table_.reserve(__n);} }; template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( size_type __n, const hasher& __hf, const key_equal& __eql) : __table_(__hf, __eql) { __table_.rehash(__n); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a) : __table_(__hf, __eql, typename __table::allocator_type(__a)) { __table_.rehash(__n); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> template <class _InputIterator> unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( _InputIterator __first, _InputIterator __last) { insert(__first, __last); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> template <class _InputIterator> unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql) : __table_(__hf, __eql) { __table_.rehash(__n); insert(__first, __last); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> template <class _InputIterator> unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a) : __table_(__hf, __eql, typename __table::allocator_type(__a)) { __table_.rehash(__n); insert(__first, __last); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( const allocator_type& __a) : __table_(typename __table::allocator_type(__a)) { } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( const unordered_multimap& __u) : __table_(__u.__table_) { __table_.rehash(__u.bucket_count()); insert(__u.begin(), __u.end()); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( const unordered_multimap& __u, const allocator_type& __a) : __table_(__u.__table_, typename __table::allocator_type(__a)) { __table_.rehash(__u.bucket_count()); insert(__u.begin(), __u.end()); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( unordered_multimap&& __u) noexcept(is_nothrow_move_constructible<__table>::value) : __table_(std::__1::move(__u.__table_)) { } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( unordered_multimap&& __u, const allocator_type& __a) : __table_(std::__1::move(__u.__table_), typename __table::allocator_type(__a)) { if (__a != __u.get_allocator()) { iterator __i = __u.begin(); while (__u.size() != 0) { __table_.__insert_multi( __u.__table_.remove((__i++).__i_)->__value_.__move()); } } } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( initializer_list<value_type> __il, size_type __n, const hasher& __hf, const key_equal& __eql) : __table_(__hf, __eql) { __table_.rehash(__n); insert(__il.begin(), __il.end()); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( initializer_list<value_type> __il, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a) : __table_(__hf, __eql, typename __table::allocator_type(__a)) { __table_.rehash(__n); insert(__il.begin(), __il.end()); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_multimap&& __u) noexcept(is_nothrow_move_assignable<__table>::value) { __table_ = std::__1::move(__u.__table_); return *this; } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=( initializer_list<value_type> __il) { __table_.__assign_multi(__il.begin(), __il.end()); return *this; } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> template <class _InputIterator> inline void unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) { for (; __first != __last; ++__first) __table_.__insert_multi(*__first); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> bool operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { if (__x.size() != __y.size()) return false; typedef typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator const_iterator; typedef pair<const_iterator, const_iterator> _EqRng; for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;) { _EqRng __xeq = __x.equal_range(__i->first); _EqRng __yeq = __y.equal_range(__i->first); if (std::__1::distance(__xeq.first, __xeq.second) != std::__1::distance(__yeq.first, __yeq.second) || !std::__1::is_permutation(__xeq.first, __xeq.second, __yeq.first)) return false; __i = __xeq.second; } return true; } template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) { return !(__x == __y); } } } namespace std { inline namespace __1 { template <class _Value, class _Hash, class _Pred, class _Alloc> class unordered_multiset; template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>, class _Alloc = allocator<_Value> > class unordered_set { public: typedef _Value key_type; typedef key_type value_type; typedef typename __identity<_Hash>::type hasher; typedef typename __identity<_Pred>::type key_equal; typedef typename __identity<_Alloc>::type allocator_type; typedef value_type& reference; typedef const value_type& const_reference; static_assert((is_same<value_type, typename allocator_type::value_type>::value), "Invalid allocator::value_type"); private: typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table; __table __table_; public: typedef typename __table::pointer pointer; typedef typename __table::const_pointer const_pointer; typedef typename __table::size_type size_type; typedef typename __table::difference_type difference_type; typedef typename __table::const_iterator iterator; typedef typename __table::const_iterator const_iterator; typedef typename __table::const_local_iterator local_iterator; typedef typename __table::const_local_iterator const_local_iterator; template <class _Value2, class _Hash2, class _Pred2, class _Alloc2> friend class unordered_set; template <class _Value2, class _Hash2, class _Pred2, class _Alloc2> friend class unordered_multiset; __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_set() noexcept(is_nothrow_default_constructible<__table>::value) { } explicit unordered_set(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); inline __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_set(size_type __n, const allocator_type& __a) : unordered_set(__n, hasher(), key_equal(), __a) {} inline __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_set(size_type __n, const hasher& __hf, const allocator_type& __a) : unordered_set(__n, __hf, key_equal(), __a) {} unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); template <class _InputIterator> unordered_set(_InputIterator __first, _InputIterator __last); template <class _InputIterator> unordered_set(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); template <class _InputIterator> unordered_set(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); template <class _InputIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_set(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a) : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) {} template <class _InputIterator> unordered_set(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a) : unordered_set(__first, __last, __n, __hf, key_equal(), __a) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit unordered_set(const allocator_type& __a); unordered_set(const unordered_set& __u); unordered_set(const unordered_set& __u, const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_set(unordered_set&& __u) noexcept(is_nothrow_move_constructible<__table>::value); unordered_set(unordered_set&& __u, const allocator_type& __a); unordered_set(initializer_list<value_type> __il); unordered_set(initializer_list<value_type> __il, size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); unordered_set(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); inline __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_set(initializer_list<value_type> __il, size_type __n, const allocator_type& __a) : unordered_set(__il, __n, hasher(), key_equal(), __a) {} inline __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_set(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a) : unordered_set(__il, __n, __hf, key_equal(), __a) {} __attribute__ ((__exclude_from_explicit_instantiation__)) ~unordered_set() { static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), ""); } __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_set& operator=(const unordered_set& __u) { __table_ = __u.__table_; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_set& operator=(unordered_set&& __u) noexcept(is_nothrow_move_assignable<__table>::value); __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_set& operator=(initializer_list<value_type> __il); __attribute__ ((__exclude_from_explicit_instantiation__)) allocator_type get_allocator() const noexcept {return allocator_type(__table_.__node_alloc());} [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) bool empty() const noexcept {return __table_.size() == 0;} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type size() const noexcept {return __table_.size();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type max_size() const noexcept {return __table_.max_size();} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator begin() noexcept {return __table_.begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator end() noexcept {return __table_.end();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator begin() const noexcept {return __table_.begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator end() const noexcept {return __table_.end();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cbegin() const noexcept {return __table_.begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cend() const noexcept {return __table_.end();} template <class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> emplace(_Args&&... __args) {return __table_.__emplace_unique(std::__1::forward<_Args>(__args)...);} template <class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator emplace_hint(const_iterator, _Args&&... __args) {return __table_.__emplace_unique(std::__1::forward<_Args>(__args)...).first;} __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> insert(value_type&& __x) {return __table_.__insert_unique(std::__1::move(__x));} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const_iterator, value_type&& __x) {return insert(std::__1::move(__x)).first;} __attribute__ ((__exclude_from_explicit_instantiation__)) void insert(initializer_list<value_type> __il) {insert(__il.begin(), __il.end());} __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, bool> insert(const value_type& __x) {return __table_.__insert_unique(__x);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;} template <class _InputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) void insert(_InputIterator __first, _InputIterator __last); __attribute__ ((__exclude_from_explicit_instantiation__)) iterator erase(const_iterator __p) {return __table_.erase(__p);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator erase(const_iterator __first, const_iterator __last) {return __table_.erase(__first, __last);} __attribute__ ((__exclude_from_explicit_instantiation__)) void clear() noexcept {__table_.clear();} __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(unordered_set& __u) noexcept(__is_nothrow_swappable<__table>::value) {__table_.swap(__u.__table_);} __attribute__ ((__exclude_from_explicit_instantiation__)) hasher hash_function() const {return __table_.hash_function();} __attribute__ ((__exclude_from_explicit_instantiation__)) key_equal key_eq() const {return __table_.key_eq();} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator find(const key_type& __k) {return __table_.find(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator find(const key_type& __k) const {return __table_.find(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type count(const key_type& __k) const {return __table_.__count_unique(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, iterator> equal_range(const key_type& __k) {return __table_.__equal_range_unique(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {return __table_.__equal_range_unique(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type bucket_count() const noexcept {return __table_.bucket_count();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type max_bucket_count() const noexcept {return __table_.max_bucket_count();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type bucket(const key_type& __k) const {return __table_.bucket(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) local_iterator begin(size_type __n) {return __table_.begin(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) local_iterator end(size_type __n) {return __table_.end(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_local_iterator end(size_type __n) const {return __table_.cend(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_local_iterator cend(size_type __n) const {return __table_.cend(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) float load_factor() const noexcept {return __table_.load_factor();} __attribute__ ((__exclude_from_explicit_instantiation__)) float max_load_factor() const noexcept {return __table_.max_load_factor();} __attribute__ ((__exclude_from_explicit_instantiation__)) void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);} __attribute__ ((__exclude_from_explicit_instantiation__)) void rehash(size_type __n) {__table_.rehash(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) void reserve(size_type __n) {__table_.reserve(__n);} }; template <class _Value, class _Hash, class _Pred, class _Alloc> unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql) : __table_(__hf, __eql) { __table_.rehash(__n); } template <class _Value, class _Hash, class _Pred, class _Alloc> unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a) : __table_(__hf, __eql, __a) { __table_.rehash(__n); } template <class _Value, class _Hash, class _Pred, class _Alloc> template <class _InputIterator> unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( _InputIterator __first, _InputIterator __last) { insert(__first, __last); } template <class _Value, class _Hash, class _Pred, class _Alloc> template <class _InputIterator> unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql) : __table_(__hf, __eql) { __table_.rehash(__n); insert(__first, __last); } template <class _Value, class _Hash, class _Pred, class _Alloc> template <class _InputIterator> unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a) : __table_(__hf, __eql, __a) { __table_.rehash(__n); insert(__first, __last); } template <class _Value, class _Hash, class _Pred, class _Alloc> inline unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( const allocator_type& __a) : __table_(__a) { } template <class _Value, class _Hash, class _Pred, class _Alloc> unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( const unordered_set& __u) : __table_(__u.__table_) { __table_.rehash(__u.bucket_count()); insert(__u.begin(), __u.end()); } template <class _Value, class _Hash, class _Pred, class _Alloc> unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( const unordered_set& __u, const allocator_type& __a) : __table_(__u.__table_, __a) { __table_.rehash(__u.bucket_count()); insert(__u.begin(), __u.end()); } template <class _Value, class _Hash, class _Pred, class _Alloc> inline unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( unordered_set&& __u) noexcept(is_nothrow_move_constructible<__table>::value) : __table_(std::__1::move(__u.__table_)) { } template <class _Value, class _Hash, class _Pred, class _Alloc> unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( unordered_set&& __u, const allocator_type& __a) : __table_(std::__1::move(__u.__table_), __a) { if (__a != __u.get_allocator()) { iterator __i = __u.begin(); while (__u.size() != 0) __table_.__insert_unique(std::__1::move(__u.__table_.remove(__i++)->__value_)); } } template <class _Value, class _Hash, class _Pred, class _Alloc> unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); } template <class _Value, class _Hash, class _Pred, class _Alloc> unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( initializer_list<value_type> __il, size_type __n, const hasher& __hf, const key_equal& __eql) : __table_(__hf, __eql) { __table_.rehash(__n); insert(__il.begin(), __il.end()); } template <class _Value, class _Hash, class _Pred, class _Alloc> unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( initializer_list<value_type> __il, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a) : __table_(__hf, __eql, __a) { __table_.rehash(__n); insert(__il.begin(), __il.end()); } template <class _Value, class _Hash, class _Pred, class _Alloc> inline unordered_set<_Value, _Hash, _Pred, _Alloc>& unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_set&& __u) noexcept(is_nothrow_move_assignable<__table>::value) { __table_ = std::__1::move(__u.__table_); return *this; } template <class _Value, class _Hash, class _Pred, class _Alloc> inline unordered_set<_Value, _Hash, _Pred, _Alloc>& unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=( initializer_list<value_type> __il) { __table_.__assign_unique(__il.begin(), __il.end()); return *this; } template <class _Value, class _Hash, class _Pred, class _Alloc> template <class _InputIterator> inline void unordered_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) { for (; __first != __last; ++__first) __table_.__insert_unique(*__first); } template <class _Value, class _Hash, class _Pred, class _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } template <class _Value, class _Hash, class _Pred, class _Alloc> bool operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) { if (__x.size() != __y.size()) return false; typedef typename unordered_set<_Value, _Hash, _Pred, _Alloc>::const_iterator const_iterator; for (const_iterator __i = __x.begin(), __ex = __x.end(), __ey = __y.end(); __i != __ex; ++__i) { const_iterator __j = __y.find(*__i); if (__j == __ey || !(*__i == *__j)) return false; } return true; } template <class _Value, class _Hash, class _Pred, class _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) { return !(__x == __y); } template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>, class _Alloc = allocator<_Value> > class unordered_multiset { public: typedef _Value key_type; typedef key_type value_type; typedef typename __identity<_Hash>::type hasher; typedef typename __identity<_Pred>::type key_equal; typedef typename __identity<_Alloc>::type allocator_type; typedef value_type& reference; typedef const value_type& const_reference; static_assert((is_same<value_type, typename allocator_type::value_type>::value), "Invalid allocator::value_type"); private: typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table; __table __table_; public: typedef typename __table::pointer pointer; typedef typename __table::const_pointer const_pointer; typedef typename __table::size_type size_type; typedef typename __table::difference_type difference_type; typedef typename __table::const_iterator iterator; typedef typename __table::const_iterator const_iterator; typedef typename __table::const_local_iterator local_iterator; typedef typename __table::const_local_iterator const_local_iterator; template <class _Value2, class _Hash2, class _Pred2, class _Alloc2> friend class unordered_set; template <class _Value2, class _Hash2, class _Pred2, class _Alloc2> friend class unordered_multiset; __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_multiset() noexcept(is_nothrow_default_constructible<__table>::value) { } explicit unordered_multiset(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); unordered_multiset(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); inline __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_multiset(size_type __n, const allocator_type& __a) : unordered_multiset(__n, hasher(), key_equal(), __a) {} inline __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_multiset(size_type __n, const hasher& __hf, const allocator_type& __a) : unordered_multiset(__n, __hf, key_equal(), __a) {} template <class _InputIterator> unordered_multiset(_InputIterator __first, _InputIterator __last); template <class _InputIterator> unordered_multiset(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); template <class _InputIterator> unordered_multiset(_InputIterator __first, _InputIterator __last, size_type __n , const hasher& __hf, const key_equal& __eql, const allocator_type& __a); template <class _InputIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_multiset(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a) : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) {} template <class _InputIterator> inline __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_multiset(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a) : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) {} __attribute__ ((__exclude_from_explicit_instantiation__)) explicit unordered_multiset(const allocator_type& __a); unordered_multiset(const unordered_multiset& __u); unordered_multiset(const unordered_multiset& __u, const allocator_type& __a); __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_multiset(unordered_multiset&& __u) noexcept(is_nothrow_move_constructible<__table>::value); unordered_multiset(unordered_multiset&& __u, const allocator_type& __a); unordered_multiset(initializer_list<value_type> __il); unordered_multiset(initializer_list<value_type> __il, size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); unordered_multiset(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); inline __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_multiset(initializer_list<value_type> __il, size_type __n, const allocator_type& __a) : unordered_multiset(__il, __n, hasher(), key_equal(), __a) {} inline __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_multiset(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a) : unordered_multiset(__il, __n, __hf, key_equal(), __a) {} __attribute__ ((__exclude_from_explicit_instantiation__)) ~unordered_multiset() { static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), ""); } __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_multiset& operator=(const unordered_multiset& __u) { __table_ = __u.__table_; return *this; } __attribute__ ((__exclude_from_explicit_instantiation__)) unordered_multiset& operator=(unordered_multiset&& __u) noexcept(is_nothrow_move_assignable<__table>::value); unordered_multiset& operator=(initializer_list<value_type> __il); __attribute__ ((__exclude_from_explicit_instantiation__)) allocator_type get_allocator() const noexcept {return allocator_type(__table_.__node_alloc());} [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) bool empty() const noexcept {return __table_.size() == 0;} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type size() const noexcept {return __table_.size();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type max_size() const noexcept {return __table_.max_size();} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator begin() noexcept {return __table_.begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator end() noexcept {return __table_.end();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator begin() const noexcept {return __table_.begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator end() const noexcept {return __table_.end();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cbegin() const noexcept {return __table_.begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cend() const noexcept {return __table_.end();} template <class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator emplace(_Args&&... __args) {return __table_.__emplace_multi(std::__1::forward<_Args>(__args)...);} template <class... _Args> __attribute__ ((__exclude_from_explicit_instantiation__)) iterator emplace_hint(const_iterator __p, _Args&&... __args) {return __table_.__emplace_hint_multi(__p, std::__1::forward<_Args>(__args)...);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(value_type&& __x) {return __table_.__insert_multi(std::__1::move(__x));} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const_iterator __p, value_type&& __x) {return __table_.__insert_multi(__p, std::__1::move(__x));} __attribute__ ((__exclude_from_explicit_instantiation__)) void insert(initializer_list<value_type> __il) {insert(__il.begin(), __il.end());} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator insert(const_iterator __p, const value_type& __x) {return __table_.__insert_multi(__p, __x);} template <class _InputIterator> __attribute__ ((__exclude_from_explicit_instantiation__)) void insert(_InputIterator __first, _InputIterator __last); __attribute__ ((__exclude_from_explicit_instantiation__)) iterator erase(const_iterator __p) {return __table_.erase(__p);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator erase(const_iterator __first, const_iterator __last) {return __table_.erase(__first, __last);} __attribute__ ((__exclude_from_explicit_instantiation__)) void clear() noexcept {__table_.clear();} __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(unordered_multiset& __u) noexcept(__is_nothrow_swappable<__table>::value) {__table_.swap(__u.__table_);} __attribute__ ((__exclude_from_explicit_instantiation__)) hasher hash_function() const {return __table_.hash_function();} __attribute__ ((__exclude_from_explicit_instantiation__)) key_equal key_eq() const {return __table_.key_eq();} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator find(const key_type& __k) {return __table_.find(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator find(const key_type& __k) const {return __table_.find(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type count(const key_type& __k) const {return __table_.__count_multi(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) pair<iterator, iterator> equal_range(const key_type& __k) {return __table_.__equal_range_multi(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {return __table_.__equal_range_multi(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type bucket_count() const noexcept {return __table_.bucket_count();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type max_bucket_count() const noexcept {return __table_.max_bucket_count();} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) size_type bucket(const key_type& __k) const {return __table_.bucket(__k);} __attribute__ ((__exclude_from_explicit_instantiation__)) local_iterator begin(size_type __n) {return __table_.begin(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) local_iterator end(size_type __n) {return __table_.end(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_local_iterator end(size_type __n) const {return __table_.cend(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_local_iterator cend(size_type __n) const {return __table_.cend(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) float load_factor() const noexcept {return __table_.load_factor();} __attribute__ ((__exclude_from_explicit_instantiation__)) float max_load_factor() const noexcept {return __table_.max_load_factor();} __attribute__ ((__exclude_from_explicit_instantiation__)) void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);} __attribute__ ((__exclude_from_explicit_instantiation__)) void rehash(size_type __n) {__table_.rehash(__n);} __attribute__ ((__exclude_from_explicit_instantiation__)) void reserve(size_type __n) {__table_.reserve(__n);} }; template <class _Value, class _Hash, class _Pred, class _Alloc> unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( size_type __n, const hasher& __hf, const key_equal& __eql) : __table_(__hf, __eql) { __table_.rehash(__n); } template <class _Value, class _Hash, class _Pred, class _Alloc> unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a) : __table_(__hf, __eql, __a) { __table_.rehash(__n); } template <class _Value, class _Hash, class _Pred, class _Alloc> template <class _InputIterator> unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( _InputIterator __first, _InputIterator __last) { insert(__first, __last); } template <class _Value, class _Hash, class _Pred, class _Alloc> template <class _InputIterator> unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql) : __table_(__hf, __eql) { __table_.rehash(__n); insert(__first, __last); } template <class _Value, class _Hash, class _Pred, class _Alloc> template <class _InputIterator> unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( _InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a) : __table_(__hf, __eql, __a) { __table_.rehash(__n); insert(__first, __last); } template <class _Value, class _Hash, class _Pred, class _Alloc> inline unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( const allocator_type& __a) : __table_(__a) { } template <class _Value, class _Hash, class _Pred, class _Alloc> unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( const unordered_multiset& __u) : __table_(__u.__table_) { __table_.rehash(__u.bucket_count()); insert(__u.begin(), __u.end()); } template <class _Value, class _Hash, class _Pred, class _Alloc> unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( const unordered_multiset& __u, const allocator_type& __a) : __table_(__u.__table_, __a) { __table_.rehash(__u.bucket_count()); insert(__u.begin(), __u.end()); } template <class _Value, class _Hash, class _Pred, class _Alloc> inline unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( unordered_multiset&& __u) noexcept(is_nothrow_move_constructible<__table>::value) : __table_(std::__1::move(__u.__table_)) { } template <class _Value, class _Hash, class _Pred, class _Alloc> unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( unordered_multiset&& __u, const allocator_type& __a) : __table_(std::__1::move(__u.__table_), __a) { if (__a != __u.get_allocator()) { iterator __i = __u.begin(); while (__u.size() != 0) __table_.__insert_multi(std::__1::move(__u.__table_.remove(__i++)->__value_)); } } template <class _Value, class _Hash, class _Pred, class _Alloc> unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); } template <class _Value, class _Hash, class _Pred, class _Alloc> unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( initializer_list<value_type> __il, size_type __n, const hasher& __hf, const key_equal& __eql) : __table_(__hf, __eql) { __table_.rehash(__n); insert(__il.begin(), __il.end()); } template <class _Value, class _Hash, class _Pred, class _Alloc> unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( initializer_list<value_type> __il, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a) : __table_(__hf, __eql, __a) { __table_.rehash(__n); insert(__il.begin(), __il.end()); } template <class _Value, class _Hash, class _Pred, class _Alloc> inline unordered_multiset<_Value, _Hash, _Pred, _Alloc>& unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=( unordered_multiset&& __u) noexcept(is_nothrow_move_assignable<__table>::value) { __table_ = std::__1::move(__u.__table_); return *this; } template <class _Value, class _Hash, class _Pred, class _Alloc> inline unordered_multiset<_Value, _Hash, _Pred, _Alloc>& unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=( initializer_list<value_type> __il) { __table_.__assign_multi(__il.begin(), __il.end()); return *this; } template <class _Value, class _Hash, class _Pred, class _Alloc> template <class _InputIterator> inline void unordered_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) { for (; __first != __last; ++__first) __table_.__insert_multi(*__first); } template <class _Value, class _Hash, class _Pred, class _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } template <class _Value, class _Hash, class _Pred, class _Alloc> bool operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) { if (__x.size() != __y.size()) return false; typedef typename unordered_multiset<_Value, _Hash, _Pred, _Alloc>::const_iterator const_iterator; typedef pair<const_iterator, const_iterator> _EqRng; for (const_iterator __i = __x.begin(), __ex = __x.end(); __i != __ex;) { _EqRng __xeq = __x.equal_range(*__i); _EqRng __yeq = __y.equal_range(*__i); if (std::__1::distance(__xeq.first, __xeq.second) != std::__1::distance(__yeq.first, __yeq.second) || !std::__1::is_permutation(__xeq.first, __xeq.second, __yeq.first)) return false; __i = __xeq.second; } return true; } template <class _Value, class _Hash, class _Pred, class _Alloc> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) { return !(__x == __y); } } } #pragma pack(push, 8) extern "C" { } #pragma pack(pop) namespace base { template <typename Signature> class OnceCallback; template <typename Signature> class RepeatingCallback; template <typename Signature> using Callback = RepeatingCallback<Signature>; using OnceClosure = OnceCallback<void()>; using RepeatingClosure = RepeatingCallback<void()>; using Closure = Callback<void()>; } template<typename T> inline void ignore_result(const T&) { } namespace base { namespace internal { class ScopedClearLastErrorBase { public: ScopedClearLastErrorBase() : last_errno_((*_errno())) { (*_errno()) = 0; } ~ScopedClearLastErrorBase() { (*_errno()) = last_errno_; } private: const int last_errno_; ScopedClearLastErrorBase(const ScopedClearLastErrorBase&) = delete; ScopedClearLastErrorBase& operator=(const ScopedClearLastErrorBase&) = delete; }; class ScopedClearLastError : public ScopedClearLastErrorBase { public: ScopedClearLastError(); ~ScopedClearLastError(); private: unsigned int last_system_error_; ScopedClearLastError(const ScopedClearLastError&) = delete; ScopedClearLastError& operator=(const ScopedClearLastError&) = delete; }; } } namespace base { typedef wchar_t char16; typedef std::wstring string16; } namespace base { template <typename STRING_TYPE> class BasicStringPiece; typedef BasicStringPiece<std::string> StringPiece; typedef BasicStringPiece<string16> StringPiece16; typedef BasicStringPiece<std::wstring> WStringPiece; } namespace base { template <class T> struct is_non_const_reference : std::false_type {}; template <class T> struct is_non_const_reference<T&> : std::true_type {}; template <class T> struct is_non_const_reference<const T&> : std::false_type {}; namespace internal { template <typename...> struct make_void { using type = void; }; } template <typename... Ts> using void_t = typename ::base::internal::make_void<Ts...>::type; namespace internal { template <typename T, typename = void> struct SupportsOstreamOperator : std::false_type {}; template <typename T> struct SupportsOstreamOperator<T, decltype(void(std::declval<std::ostream&>() << std::declval<T>()))> : std::true_type {}; template <typename T, typename = void> struct SupportsToString : std::false_type {}; template <typename T> struct SupportsToString<T, decltype(void(std::declval<T>().ToString()))> : std::true_type {}; template <typename T, typename = void> struct is_iterator : std::false_type {}; template <typename T> struct is_iterator<T, void_t<typename std::iterator_traits<T>::iterator_category>> : std::true_type {}; } template <class T> using is_trivially_copyable = std::is_trivially_copyable<T>; template <typename T> using is_trivially_copy_constructible = std::is_trivially_copy_constructible<T>; struct in_place_t {}; constexpr in_place_t in_place = {}; template <typename T> struct in_place_type_t {}; template <typename T> struct is_in_place_type_t { static constexpr bool value = false; }; template <typename... Ts> struct is_in_place_type_t<in_place_type_t<Ts...>> { static constexpr bool value = true; }; } namespace logging { typedef wchar_t PathChar; using LoggingDestination = uint32_t; enum : uint32_t { LOG_NONE = 0, LOG_TO_FILE = 1 << 0, LOG_TO_SYSTEM_DEBUG_LOG = 1 << 1, LOG_TO_STDERR = 1 << 2, LOG_TO_ALL = LOG_TO_FILE | LOG_TO_SYSTEM_DEBUG_LOG | LOG_TO_STDERR, LOG_DEFAULT = LOG_TO_FILE, }; enum LogLockingState { LOCK_LOG_FILE, DONT_LOCK_LOG_FILE }; enum OldFileDeletionState { DELETE_OLD_LOG_FILE, APPEND_TO_OLD_LOG_FILE }; struct LoggingSettings { uint32_t logging_dest = LOG_DEFAULT; const PathChar* log_file_path = nullptr; LogLockingState lock_log = LOCK_LOG_FILE; OldFileDeletionState delete_old = APPEND_TO_OLD_LOG_FILE; }; bool BaseInitLoggingImpl_built_with_NDEBUG(const LoggingSettings& settings); inline bool InitLogging(const LoggingSettings& settings) { return BaseInitLoggingImpl_built_with_NDEBUG(settings); } void SetMinLogLevel(int level); int GetMinLogLevel(); bool ShouldCreateLogMessage(int severity); int GetVlogVerbosity(); int GetVlogLevelHelper(const char* file_start, size_t N); template <size_t N> int GetVlogLevel(const char (&file)[N]) { return GetVlogLevelHelper(file, N); } void SetLogItems(bool enable_process_id, bool enable_thread_id, bool enable_timestamp, bool enable_tickcount); void SetLogPrefix(const char* prefix); void SetShowErrorDialogs(bool enable_dialogs); using LogAssertHandlerFunction = base::RepeatingCallback<void(const char* file, int line, const base::StringPiece message, const base::StringPiece stack_trace)>; class ScopedLogAssertHandler { public: explicit ScopedLogAssertHandler(LogAssertHandlerFunction handler); ~ScopedLogAssertHandler(); private: ScopedLogAssertHandler(const ScopedLogAssertHandler&) = delete; ScopedLogAssertHandler& operator=(const ScopedLogAssertHandler&) = delete; }; typedef bool (*LogMessageHandlerFunction)(int severity, const char* file, int line, size_t message_start, const std::string& str); void SetLogMessageHandler(LogMessageHandlerFunction handler); LogMessageHandlerFunction GetLogMessageHandler(); typedef int LogSeverity; const LogSeverity LOG_VERBOSE = -1; const LogSeverity LOG_INFO = 0; const LogSeverity LOG_WARNING = 1; const LogSeverity LOG_ERROR = 2; const LogSeverity LOG_FATAL = 3; const LogSeverity LOG_NUM_SEVERITIES = 4; const LogSeverity LOG_DFATAL = LOG_ERROR; const LogSeverity LOG_0 = LOG_ERROR; extern std::ostream* g_swallow_stream; class CheckOpResult { public: constexpr CheckOpResult(std::string* message) : message_(message) {} constexpr operator bool() const { return !message_; } std::string* message() { return message_; } private: std::string* message_; }; template <typename T> inline typename std::enable_if< base::internal::SupportsOstreamOperator<const T&>::value && !std::is_function<typename std::remove_pointer<T>::type>::value, void>::type MakeCheckOpValueString(std::ostream* os, const T& v) { (*os) << v; } template <typename T> inline typename std::enable_if< !base::internal::SupportsOstreamOperator<const T&>::value && base::internal::SupportsToString<const T&>::value, void>::type MakeCheckOpValueString(std::ostream* os, const T& v) { (*os) << v.ToString(); } template <typename T> inline typename std::enable_if< std::is_function<typename std::remove_pointer<T>::type>::value, void>::type MakeCheckOpValueString(std::ostream* os, const T& v) { (*os) << reinterpret_cast<const void*>(v); } template <typename T> inline typename std::enable_if< !base::internal::SupportsOstreamOperator<const T&>::value && std::is_enum<T>::value, void>::type MakeCheckOpValueString(std::ostream* os, const T& v) { (*os) << static_cast<typename std::underlying_type<T>::type>(v); } void MakeCheckOpValueString(std::ostream* os, std::nullptr_t p); template<class t1, class t2> std::string* MakeCheckOpString(const t1& v1, const t2& v2, const char* names) { std::ostringstream ss; ss << names << " ("; MakeCheckOpValueString(&ss, v1); ss << " vs. "; MakeCheckOpValueString(&ss, v2); ss << ")"; std::string* msg = new std::string(ss.str()); return msg; } extern template std::string* MakeCheckOpString<int, int>( const int&, const int&, const char* names); extern template std::string* MakeCheckOpString<unsigned long, unsigned long>( const unsigned long&, const unsigned long&, const char* names); extern template std::string* MakeCheckOpString<unsigned long, unsigned int>( const unsigned long&, const unsigned int&, const char* names); extern template std::string* MakeCheckOpString<unsigned int, unsigned long>( const unsigned int&, const unsigned long&, const char* names); extern template std::string* MakeCheckOpString<std::string, std::string>( const std::string&, const std::string&, const char* name); template <class t1, class t2> constexpr std::string* CheckEQImpl(const t1& v1, const t2& v2, const char* names) { if ((v1 == v2)) return nullptr; else return ::logging::MakeCheckOpString(v1, v2, names); } constexpr std::string* CheckEQImpl(int v1, int v2, const char* names) { if ((v1 == v2)) return nullptr; else return ::logging::MakeCheckOpString(v1, v2, names); } template <class t1, class t2> constexpr std::string* CheckNEImpl(const t1& v1, const t2& v2, const char* names) { if ((v1 != v2)) return nullptr; else return ::logging::MakeCheckOpString(v1, v2, names); } constexpr std::string* CheckNEImpl(int v1, int v2, const char* names) { if ((v1 != v2)) return nullptr; else return ::logging::MakeCheckOpString(v1, v2, names); } template <class t1, class t2> constexpr std::string* CheckLEImpl(const t1& v1, const t2& v2, const char* names) { if ((v1 <= v2)) return nullptr; else return ::logging::MakeCheckOpString(v1, v2, names); } constexpr std::string* CheckLEImpl(int v1, int v2, const char* names) { if ((v1 <= v2)) return nullptr; else return ::logging::MakeCheckOpString(v1, v2, names); } template <class t1, class t2> constexpr std::string* CheckLTImpl(const t1& v1, const t2& v2, const char* names) { if ((v1 < v2)) return nullptr; else return ::logging::MakeCheckOpString(v1, v2, names); } constexpr std::string* CheckLTImpl(int v1, int v2, const char* names) { if ((v1 < v2)) return nullptr; else return ::logging::MakeCheckOpString(v1, v2, names); } template <class t1, class t2> constexpr std::string* CheckGEImpl(const t1& v1, const t2& v2, const char* names) { if ((v1 >= v2)) return nullptr; else return ::logging::MakeCheckOpString(v1, v2, names); } constexpr std::string* CheckGEImpl(int v1, int v2, const char* names) { if ((v1 >= v2)) return nullptr; else return ::logging::MakeCheckOpString(v1, v2, names); } template <class t1, class t2> constexpr std::string* CheckGTImpl(const t1& v1, const t2& v2, const char* names) { if ((v1 > v2)) return nullptr; else return ::logging::MakeCheckOpString(v1, v2, names); } constexpr std::string* CheckGTImpl(int v1, int v2, const char* names) { if ((v1 > v2)) return nullptr; else return ::logging::MakeCheckOpString(v1, v2, names); } const LogSeverity LOG_DCHECK = LOG_FATAL; class LogMessage { public: LogMessage(const char* file, int line, LogSeverity severity); LogMessage(const char* file, int line, const char* condition); LogMessage(const char* file, int line, std::string* result); LogMessage(const char* file, int line, LogSeverity severity, std::string* result); ~LogMessage(); std::ostream& stream() { return stream_; } LogSeverity severity() { return severity_; } std::string str() { return stream_.str(); } private: void Init(const char* file, int line); LogSeverity severity_; std::ostringstream stream_; size_t message_start_; const char* file_; const int line_; const char* file_basename_; base::internal::ScopedClearLastError last_error_; LogMessage(const LogMessage&) = delete; LogMessage& operator=(const LogMessage&) = delete; }; class LogMessageVoidify { public: LogMessageVoidify() = default; void operator&(std::ostream&) { } }; typedef unsigned long SystemErrorCode; SystemErrorCode GetLastSystemErrorCode(); std::string SystemErrorCodeToString(SystemErrorCode error_code); class Win32ErrorLogMessage { public: Win32ErrorLogMessage(const char* file, int line, LogSeverity severity, SystemErrorCode err); ~Win32ErrorLogMessage(); std::ostream& stream() { return log_message_.stream(); } private: SystemErrorCode err_; LogMessage log_message_; Win32ErrorLogMessage(const Win32ErrorLogMessage&) = delete; Win32ErrorLogMessage& operator=(const Win32ErrorLogMessage&) = delete; }; void CloseLogFile(); void RawLog(int level, const char* message); bool IsLoggingToFileEnabled(); std::wstring GetLogFileFullPath(); } namespace std { std::ostream& operator<<(std::ostream& out, const wchar_t* wstr); inline std::ostream& operator<<(std::ostream& out, const std::wstring& wstr) { return out << wstr.c_str(); } } namespace base { struct nullopt_t { constexpr explicit nullopt_t(int) {} }; constexpr nullopt_t nullopt(0); template <typename T> class Optional; namespace internal { template <typename T, bool = std::is_trivially_destructible<T>::value> struct OptionalStorageBase { constexpr OptionalStorageBase() : empty_('\0') {} template <class... Args> constexpr explicit OptionalStorageBase(in_place_t, Args&&... args) : is_populated_(true), value_(std::forward<Args>(args)...) {} ~OptionalStorageBase() { if (is_populated_) value_.~T(); } template <class... Args> void Init(Args&&... args) { true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << !(!is_populated_); ::new (&value_) T(std::forward<Args>(args)...); is_populated_ = true; } bool is_populated_ = false; union { char empty_; T value_; }; }; template <typename T> struct OptionalStorageBase<T, true > { constexpr OptionalStorageBase() : empty_('\0') {} template <class... Args> constexpr explicit OptionalStorageBase(in_place_t, Args&&... args) : is_populated_(true), value_(std::forward<Args>(args)...) {} template <class... Args> void Init(Args&&... args) { true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << !(!is_populated_); ::new (&value_) T(std::forward<Args>(args)...); is_populated_ = true; } bool is_populated_ = false; union { char empty_; T value_; }; }; template <typename T, bool = is_trivially_copy_constructible<T>::value, bool = std::is_trivially_move_constructible<T>::value> struct OptionalStorage : OptionalStorageBase<T> { using OptionalStorageBase<T>::is_populated_; using OptionalStorageBase<T>::value_; using OptionalStorageBase<T>::Init; using OptionalStorageBase<T>::OptionalStorageBase; OptionalStorage() = default; OptionalStorage(const OptionalStorage& other) { if (other.is_populated_) Init(other.value_); } OptionalStorage(OptionalStorage&& other) noexcept( std::is_nothrow_move_constructible<T>::value) { if (other.is_populated_) Init(std::move(other.value_)); } }; template <typename T> struct OptionalStorage<T, true , false > : OptionalStorageBase<T> { using OptionalStorageBase<T>::is_populated_; using OptionalStorageBase<T>::value_; using OptionalStorageBase<T>::Init; using OptionalStorageBase<T>::OptionalStorageBase; OptionalStorage() = default; OptionalStorage(const OptionalStorage& other) = default; OptionalStorage(OptionalStorage&& other) noexcept( std::is_nothrow_move_constructible<T>::value) { if (other.is_populated_) Init(std::move(other.value_)); } }; template <typename T> struct OptionalStorage<T, false , true > : OptionalStorageBase<T> { using OptionalStorageBase<T>::is_populated_; using OptionalStorageBase<T>::value_; using OptionalStorageBase<T>::Init; using OptionalStorageBase<T>::OptionalStorageBase; OptionalStorage() = default; OptionalStorage(OptionalStorage&& other) = default; OptionalStorage(const OptionalStorage& other) { if (other.is_populated_) Init(other.value_); } }; template <typename T> struct OptionalStorage<T, true , true > : OptionalStorageBase<T> { using OptionalStorageBase<T>::OptionalStorageBase; }; template <typename T> class OptionalBase { protected: constexpr OptionalBase() = default; constexpr OptionalBase(const OptionalBase& other) = default; constexpr OptionalBase(OptionalBase&& other) = default; template <class... Args> constexpr explicit OptionalBase(in_place_t, Args&&... args) : storage_(in_place, std::forward<Args>(args)...) {} template <typename U> explicit OptionalBase(const OptionalBase<U>& other) { if (other.storage_.is_populated_) storage_.Init(other.storage_.value_); } template <typename U> explicit OptionalBase(OptionalBase<U>&& other) { if (other.storage_.is_populated_) storage_.Init(std::move(other.storage_.value_)); } ~OptionalBase() = default; OptionalBase& operator=(const OptionalBase& other) { CopyAssign(other); return *this; } OptionalBase& operator=(OptionalBase&& other) noexcept( std::is_nothrow_move_assignable<T>::value&& std::is_nothrow_move_constructible<T>::value) { MoveAssign(std::move(other)); return *this; } template <typename U> void CopyAssign(const OptionalBase<U>& other) { if (other.storage_.is_populated_) InitOrAssign(other.storage_.value_); else FreeIfNeeded(); } template <typename U> void MoveAssign(OptionalBase<U>&& other) { if (other.storage_.is_populated_) InitOrAssign(std::move(other.storage_.value_)); else FreeIfNeeded(); } template <typename U> void InitOrAssign(U&& value) { if (storage_.is_populated_) storage_.value_ = std::forward<U>(value); else storage_.Init(std::forward<U>(value)); } void FreeIfNeeded() { if (!storage_.is_populated_) return; storage_.value_.~T(); storage_.is_populated_ = false; } template <typename U> friend class OptionalBase; OptionalStorage<T> storage_; }; template <bool is_copy_constructible> struct CopyConstructible {}; template <> struct CopyConstructible<false> { constexpr CopyConstructible() = default; constexpr CopyConstructible(const CopyConstructible&) = delete; constexpr CopyConstructible(CopyConstructible&&) = default; CopyConstructible& operator=(const CopyConstructible&) = default; CopyConstructible& operator=(CopyConstructible&&) = default; }; template <bool is_move_constructible> struct MoveConstructible {}; template <> struct MoveConstructible<false> { constexpr MoveConstructible() = default; constexpr MoveConstructible(const MoveConstructible&) = default; constexpr MoveConstructible(MoveConstructible&&) = delete; MoveConstructible& operator=(const MoveConstructible&) = default; MoveConstructible& operator=(MoveConstructible&&) = default; }; template <bool is_copy_assignable> struct CopyAssignable {}; template <> struct CopyAssignable<false> { constexpr CopyAssignable() = default; constexpr CopyAssignable(const CopyAssignable&) = default; constexpr CopyAssignable(CopyAssignable&&) = default; CopyAssignable& operator=(const CopyAssignable&) = delete; CopyAssignable& operator=(CopyAssignable&&) = default; }; template <bool is_move_assignable> struct MoveAssignable {}; template <> struct MoveAssignable<false> { constexpr MoveAssignable() = default; constexpr MoveAssignable(const MoveAssignable&) = default; constexpr MoveAssignable(MoveAssignable&&) = default; MoveAssignable& operator=(const MoveAssignable&) = default; MoveAssignable& operator=(MoveAssignable&&) = delete; }; template <typename T, typename U> struct IsConvertibleFromOptional : std::integral_constant< bool, std::is_constructible<T, Optional<U>&>::value || std::is_constructible<T, const Optional<U>&>::value || std::is_constructible<T, Optional<U>&&>::value || std::is_constructible<T, const Optional<U>&&>::value || std::is_convertible<Optional<U>&, T>::value || std::is_convertible<const Optional<U>&, T>::value || std::is_convertible<Optional<U>&&, T>::value || std::is_convertible<const Optional<U>&&, T>::value> {}; template <typename T, typename U> struct IsAssignableFromOptional : std::integral_constant< bool, IsConvertibleFromOptional<T, U>::value || std::is_assignable<T&, Optional<U>&>::value || std::is_assignable<T&, const Optional<U>&>::value || std::is_assignable<T&, Optional<U>&&>::value || std::is_assignable<T&, const Optional<U>&&>::value> {}; namespace swappable_impl { using std::swap; struct IsSwappableImpl { template <typename T> static auto Check(int) -> decltype(swap(std::declval<T>(), std::declval<T>()), std::true_type()); template <typename T> static std::false_type Check(...); }; } template <typename T> struct IsSwappable : decltype(swappable_impl::IsSwappableImpl::Check<T&>(0)) {}; template <typename T> using RemoveCvRefT = std::remove_cv_t<std::remove_reference_t<T>>; } template <typename T> class __declspec(empty_bases) Optional : public internal::OptionalBase<T>, public internal::CopyConstructible<std::is_copy_constructible<T>::value>, public internal::MoveConstructible<std::is_move_constructible<T>::value>, public internal::CopyAssignable<std::is_copy_constructible<T>::value && std::is_copy_assignable<T>::value>, public internal::MoveAssignable<std::is_move_constructible<T>::value && std::is_move_assignable<T>::value> { private: static_assert( !std::is_same<internal::RemoveCvRefT<T>, in_place_t>::value, "instantiation of base::Optional with in_place_t is ill-formed"); static_assert(!std::is_same<internal::RemoveCvRefT<T>, nullopt_t>::value, "instantiation of base::Optional with nullopt_t is ill-formed"); static_assert( !std::is_reference<T>::value, "instantiation of base::Optional with a reference type is ill-formed"); static_assert(std::is_destructible<T>::value, "instantiation of base::Optional with a non-destructible type " "is ill-formed"); static_assert( !std::is_array<T>::value, "instantiation of base::Optional with an array type is ill-formed"); public: using value_type = T; constexpr Optional() = default; constexpr Optional(const Optional& other) = default; constexpr Optional(Optional&& other) noexcept( std::is_nothrow_move_constructible<T>::value) = default; constexpr Optional(nullopt_t) {} template < typename U, std::enable_if_t<std::is_constructible<T, const U&>::value && !internal::IsConvertibleFromOptional<T, U>::value && std::is_convertible<const U&, T>::value, bool> = false> Optional(const Optional<U>& other) : internal::OptionalBase<T>(other) {} template < typename U, std::enable_if_t<std::is_constructible<T, const U&>::value && !internal::IsConvertibleFromOptional<T, U>::value && !std::is_convertible<const U&, T>::value, bool> = false> explicit Optional(const Optional<U>& other) : internal::OptionalBase<T>(other) {} template < typename U, std::enable_if_t<std::is_constructible<T, U&&>::value && !internal::IsConvertibleFromOptional<T, U>::value && std::is_convertible<U&&, T>::value, bool> = false> Optional(Optional<U>&& other) : internal::OptionalBase<T>(std::move(other)) {} template < typename U, std::enable_if_t<std::is_constructible<T, U&&>::value && !internal::IsConvertibleFromOptional<T, U>::value && !std::is_convertible<U&&, T>::value, bool> = false> explicit Optional(Optional<U>&& other) : internal::OptionalBase<T>(std::move(other)) {} template <class... Args> constexpr explicit Optional(in_place_t, Args&&... args) : internal::OptionalBase<T>(in_place, std::forward<Args>(args)...) {} template < class U, class... Args, class = std::enable_if_t<std::is_constructible<value_type, std::initializer_list<U>&, Args...>::value>> constexpr explicit Optional(in_place_t, std::initializer_list<U> il, Args&&... args) : internal::OptionalBase<T>(in_place, il, std::forward<Args>(args)...) {} template < typename U = value_type, std::enable_if_t< std::is_constructible<T, U&&>::value && !std::is_same<internal::RemoveCvRefT<U>, in_place_t>::value && !std::is_same<internal::RemoveCvRefT<U>, Optional<T>>::value && std::is_convertible<U&&, T>::value, bool> = false> constexpr Optional(U&& value) : internal::OptionalBase<T>(in_place, std::forward<U>(value)) {} template < typename U = value_type, std::enable_if_t< std::is_constructible<T, U&&>::value && !std::is_same<internal::RemoveCvRefT<U>, in_place_t>::value && !std::is_same<internal::RemoveCvRefT<U>, Optional<T>>::value && !std::is_convertible<U&&, T>::value, bool> = false> constexpr explicit Optional(U&& value) : internal::OptionalBase<T>(in_place, std::forward<U>(value)) {} ~Optional() = default; Optional& operator=(const Optional& other) = default; Optional& operator=(Optional&& other) noexcept( std::is_nothrow_move_assignable<T>::value&& std::is_nothrow_move_constructible<T>::value) = default; Optional& operator=(nullopt_t) { FreeIfNeeded(); return *this; } template <typename U> std::enable_if_t< !std::is_same<internal::RemoveCvRefT<U>, Optional<T>>::value && std::is_constructible<T, U>::value && std::is_assignable<T&, U>::value && (!std::is_scalar<T>::value || !std::is_same<std::decay_t<U>, T>::value), Optional&> operator=(U&& value) { InitOrAssign(std::forward<U>(value)); return *this; } template <typename U> std::enable_if_t<!internal::IsAssignableFromOptional<T, U>::value && std::is_constructible<T, const U&>::value && std::is_assignable<T&, const U&>::value, Optional&> operator=(const Optional<U>& other) { CopyAssign(other); return *this; } template <typename U> std::enable_if_t<!internal::IsAssignableFromOptional<T, U>::value && std::is_constructible<T, U>::value && std::is_assignable<T&, U>::value, Optional&> operator=(Optional<U>&& other) { MoveAssign(std::move(other)); return *this; } constexpr const T* operator->() const { !(!(storage_.is_populated_)) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/optional.h", 593, "storage_.is_populated_").stream()); return &storage_.value_; } constexpr T* operator->() { !(!(storage_.is_populated_)) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/optional.h", 598, "storage_.is_populated_").stream()); return &storage_.value_; } constexpr const T& operator*() const & { !(!(storage_.is_populated_)) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/optional.h", 603, "storage_.is_populated_").stream()); return storage_.value_; } constexpr T& operator*() & { !(!(storage_.is_populated_)) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/optional.h", 608, "storage_.is_populated_").stream()); return storage_.value_; } constexpr const T&& operator*() const && { !(!(storage_.is_populated_)) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/optional.h", 613, "storage_.is_populated_").stream()); return std::move(storage_.value_); } constexpr T&& operator*() && { !(!(storage_.is_populated_)) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/optional.h", 618, "storage_.is_populated_").stream()); return std::move(storage_.value_); } constexpr explicit operator bool() const { return storage_.is_populated_; } constexpr bool has_value() const { return storage_.is_populated_; } constexpr T& value() & { !(!(storage_.is_populated_)) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/optional.h", 627, "storage_.is_populated_").stream()); return storage_.value_; } constexpr const T& value() const & { !(!(storage_.is_populated_)) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/optional.h", 632, "storage_.is_populated_").stream()); return storage_.value_; } constexpr T&& value() && { !(!(storage_.is_populated_)) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/optional.h", 637, "storage_.is_populated_").stream()); return std::move(storage_.value_); } constexpr const T&& value() const && { !(!(storage_.is_populated_)) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/optional.h", 642, "storage_.is_populated_").stream()); return std::move(storage_.value_); } template <class U> constexpr T value_or(U&& default_value) const& { static_assert(std::is_convertible<U, T>::value, "U must be convertible to T"); return storage_.is_populated_ ? storage_.value_ : static_cast<T>(std::forward<U>(default_value)); } template <class U> constexpr T value_or(U&& default_value) && { static_assert(std::is_convertible<U, T>::value, "U must be convertible to T"); return storage_.is_populated_ ? std::move(storage_.value_) : static_cast<T>(std::forward<U>(default_value)); } void swap(Optional& other) { if (!storage_.is_populated_ && !other.storage_.is_populated_) return; if (storage_.is_populated_ != other.storage_.is_populated_) { if (storage_.is_populated_) { other.storage_.Init(std::move(storage_.value_)); FreeIfNeeded(); } else { storage_.Init(std::move(other.storage_.value_)); other.FreeIfNeeded(); } return; } true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << !(storage_.is_populated_ && other.storage_.is_populated_); using std::swap; swap(**this, *other); } void reset() { FreeIfNeeded(); } template <class... Args> T& emplace(Args&&... args) { FreeIfNeeded(); storage_.Init(std::forward<Args>(args)...); return storage_.value_; } template <class U, class... Args> std::enable_if_t< std::is_constructible<T, std::initializer_list<U>&, Args&&...>::value, T&> emplace(std::initializer_list<U> il, Args&&... args) { FreeIfNeeded(); storage_.Init(il, std::forward<Args>(args)...); return storage_.value_; } private: using internal::OptionalBase<T>::CopyAssign; using internal::OptionalBase<T>::FreeIfNeeded; using internal::OptionalBase<T>::InitOrAssign; using internal::OptionalBase<T>::MoveAssign; using internal::OptionalBase<T>::storage_; }; template <class T, class U> constexpr bool operator==(const Optional<T>& lhs, const Optional<U>& rhs) { if (lhs.has_value() != rhs.has_value()) return false; if (!lhs.has_value()) return true; return *lhs == *rhs; } template <class T, class U> constexpr bool operator!=(const Optional<T>& lhs, const Optional<U>& rhs) { if (lhs.has_value() != rhs.has_value()) return true; if (!lhs.has_value()) return false; return *lhs != *rhs; } template <class T, class U> constexpr bool operator<(const Optional<T>& lhs, const Optional<U>& rhs) { if (!rhs.has_value()) return false; if (!lhs.has_value()) return true; return *lhs < *rhs; } template <class T, class U> constexpr bool operator<=(const Optional<T>& lhs, const Optional<U>& rhs) { if (!lhs.has_value()) return true; if (!rhs.has_value()) return false; return *lhs <= *rhs; } template <class T, class U> constexpr bool operator>(const Optional<T>& lhs, const Optional<U>& rhs) { if (!lhs.has_value()) return false; if (!rhs.has_value()) return true; return *lhs > *rhs; } template <class T, class U> constexpr bool operator>=(const Optional<T>& lhs, const Optional<U>& rhs) { if (!rhs.has_value()) return true; if (!lhs.has_value()) return false; return *lhs >= *rhs; } template <class T> constexpr bool operator==(const Optional<T>& opt, nullopt_t) { return !opt; } template <class T> constexpr bool operator==(nullopt_t, const Optional<T>& opt) { return !opt; } template <class T> constexpr bool operator!=(const Optional<T>& opt, nullopt_t) { return opt.has_value(); } template <class T> constexpr bool operator!=(nullopt_t, const Optional<T>& opt) { return opt.has_value(); } template <class T> constexpr bool operator<(const Optional<T>& opt, nullopt_t) { return false; } template <class T> constexpr bool operator<(nullopt_t, const Optional<T>& opt) { return opt.has_value(); } template <class T> constexpr bool operator<=(const Optional<T>& opt, nullopt_t) { return !opt; } template <class T> constexpr bool operator<=(nullopt_t, const Optional<T>& opt) { return true; } template <class T> constexpr bool operator>(const Optional<T>& opt, nullopt_t) { return opt.has_value(); } template <class T> constexpr bool operator>(nullopt_t, const Optional<T>& opt) { return false; } template <class T> constexpr bool operator>=(const Optional<T>& opt, nullopt_t) { return true; } template <class T> constexpr bool operator>=(nullopt_t, const Optional<T>& opt) { return !opt; } template <class T, class U> constexpr bool operator==(const Optional<T>& opt, const U& value) { return opt.has_value() ? *opt == value : false; } template <class T, class U> constexpr bool operator==(const U& value, const Optional<T>& opt) { return opt.has_value() ? value == *opt : false; } template <class T, class U> constexpr bool operator!=(const Optional<T>& opt, const U& value) { return opt.has_value() ? *opt != value : true; } template <class T, class U> constexpr bool operator!=(const U& value, const Optional<T>& opt) { return opt.has_value() ? value != *opt : true; } template <class T, class U> constexpr bool operator<(const Optional<T>& opt, const U& value) { return opt.has_value() ? *opt < value : true; } template <class T, class U> constexpr bool operator<(const U& value, const Optional<T>& opt) { return opt.has_value() ? value < *opt : false; } template <class T, class U> constexpr bool operator<=(const Optional<T>& opt, const U& value) { return opt.has_value() ? *opt <= value : true; } template <class T, class U> constexpr bool operator<=(const U& value, const Optional<T>& opt) { return opt.has_value() ? value <= *opt : false; } template <class T, class U> constexpr bool operator>(const Optional<T>& opt, const U& value) { return opt.has_value() ? *opt > value : false; } template <class T, class U> constexpr bool operator>(const U& value, const Optional<T>& opt) { return opt.has_value() ? value > *opt : true; } template <class T, class U> constexpr bool operator>=(const Optional<T>& opt, const U& value) { return opt.has_value() ? *opt >= value : false; } template <class T, class U> constexpr bool operator>=(const U& value, const Optional<T>& opt) { return opt.has_value() ? value >= *opt : true; } template <class T> constexpr Optional<std::decay_t<T>> make_optional(T&& value) { return Optional<std::decay_t<T>>(std::forward<T>(value)); } template <class T, class... Args> constexpr Optional<T> make_optional(Args&&... args) { return Optional<T>(in_place, std::forward<Args>(args)...); } template <class T, class U, class... Args> constexpr Optional<T> make_optional(std::initializer_list<U> il, Args&&... args) { return Optional<T>(in_place, il, std::forward<Args>(args)...); } template <class T> std::enable_if_t<std::is_move_constructible<T>::value && internal::IsSwappable<T>::value> swap(Optional<T>& lhs, Optional<T>& rhs) { lhs.swap(rhs); } } namespace std { template <class T> struct hash<base::Optional<T>> { size_t operator()(const base::Optional<T>& opt) const { return opt == base::nullopt ? 0 : std::hash<T>()(*opt); } }; } namespace base { namespace internal { template <typename Container, typename Predicate> void IterateAndEraseIf(Container& container, Predicate pred) { for (auto it = container.begin(); it != container.end();) { if (pred(*it)) it = container.erase(it); else ++it; } } template <typename Iter> constexpr bool IsRandomAccessIter = std::is_same<typename std::iterator_traits<Iter>::iterator_category, std::random_access_iterator_tag>::value; template <typename Container, typename Element, typename = void> struct HasFindWithNpos : std::false_type {}; template <typename Container, typename Element> struct HasFindWithNpos< Container, Element, void_t<decltype(std::declval<const Container&>().find( std::declval<const Element&>()) != Container::npos)>> : std::true_type {}; template <typename Container, typename Element, typename = void> struct HasFindWithEnd : std::false_type {}; template <typename Container, typename Element> struct HasFindWithEnd<Container, Element, void_t<decltype(std::declval<const Container&>().find( std::declval<const Element&>()) != std::declval<const Container&>().end())>> : std::true_type {}; template <typename Container, typename Element, typename = void> struct HasContains : std::false_type {}; template <typename Container, typename Element> struct HasContains<Container, Element, void_t<decltype(std::declval<const Container&>().contains( std::declval<const Element&>()))>> : std::true_type {}; } template <typename Container> constexpr auto size(const Container& c) -> decltype(c.size()) { return c.size(); } template <typename T, size_t N> constexpr size_t size(const T (&array)[N]) noexcept { return N; } template <typename Container> constexpr auto empty(const Container& c) -> decltype(c.empty()) { return c.empty(); } template <typename T, size_t N> constexpr bool empty(const T (&array)[N]) noexcept { return false; } template <typename T> constexpr bool empty(std::initializer_list<T> il) noexcept { return il.size() == 0; } template <typename Container> constexpr auto data(Container& c) -> decltype(c.data()) { return c.data(); } template <typename CharT, typename Traits, typename Allocator> CharT* data(std::basic_string<CharT, Traits, Allocator>& str) { return std::addressof(str[0]); } template <typename Container> constexpr auto data(const Container& c) -> decltype(c.data()) { return c.data(); } template <typename T, size_t N> constexpr T* data(T (&array)[N]) noexcept { return array; } template <typename T> constexpr const T* data(std::initializer_list<T> il) noexcept { return il.begin(); } template <typename T, size_t N> constexpr T* data(std::array<T, N>& array) noexcept { return !array.empty() ? &array[0] : nullptr; } template <typename T, size_t N> constexpr const T* data(const std::array<T, N>& array) noexcept { return !array.empty() ? &array[0] : nullptr; } template <typename T> constexpr std::add_const_t<T>& as_const(T& t) noexcept { return t; } template <typename T> void as_const(const T&& t) = delete; template <class A> const typename A::container_type& GetUnderlyingContainer(const A& adapter) { struct ExposedAdapter : A { using A::c; }; return adapter.*&ExposedAdapter::c; } template<class T> void STLClearObject(T* obj) { T tmp; tmp.swap(*obj); obj->reserve(0); } template <typename Container, typename T> typename std::iterator_traits< typename Container::const_iterator>::difference_type STLCount(const Container& container, const T& val) { return std::count(container.begin(), container.end(), val); } template <typename Container, typename Value, std::enable_if_t< !internal::HasFindWithNpos<Container, Value>::value && !internal::HasFindWithEnd<Container, Value>::value && !internal::HasContains<Container, Value>::value>* = nullptr> bool Contains(const Container& container, const Value& value) { using std::begin; using std::end; return std::find(begin(container), end(container), value) != end(container); } template <typename Container, typename Value, std::enable_if_t<internal::HasFindWithNpos<Container, Value>::value && !internal::HasContains<Container, Value>::value>* = nullptr> bool Contains(const Container& container, const Value& value) { return container.find(value) != Container::npos; } template <typename Container, typename Value, std::enable_if_t<internal::HasFindWithEnd<Container, Value>::value && !internal::HasContains<Container, Value>::value>* = nullptr> bool Contains(const Container& container, const Value& value) { return container.find(value) != container.end(); } template < typename Container, typename Value, std::enable_if_t<internal::HasContains<Container, Value>::value>* = nullptr> bool Contains(const Container& container, const Value& value) { return container.contains(value); } template <typename Container, typename ConstIter, std::enable_if_t<!internal::IsRandomAccessIter<ConstIter>>* = nullptr> constexpr auto ConstCastIterator(Container& c, ConstIter it) { return c.erase(it, it); } template <typename T, typename Allocator> constexpr auto ConstCastIterator( std::forward_list<T, Allocator>& c, typename std::forward_list<T, Allocator>::const_iterator it) { return c.erase_after(it, it); } template <typename Container, typename ConstIter, std::enable_if_t<internal::IsRandomAccessIter<ConstIter>>* = nullptr> constexpr auto ConstCastIterator(Container& c, ConstIter it) { using std::begin; using std::cbegin; return begin(c) + (it - cbegin(c)); } namespace internal { template <typename Map, typename Key, typename Value> std::pair<typename Map::iterator, bool> InsertOrAssignImpl(Map& map, Key&& key, Value&& value) { auto lower = map.lower_bound(key); if (lower != map.end() && !map.key_comp()(key, lower->first)) { lower->second = std::forward<Value>(value); return {lower, false}; } return {map.emplace_hint(lower, std::forward<Key>(key), std::forward<Value>(value)), true}; } template <typename Map, typename Key, typename Value> typename Map::iterator InsertOrAssignImpl(Map& map, typename Map::const_iterator hint, Key&& key, Value&& value) { auto&& key_comp = map.key_comp(); if ((hint == map.begin() || key_comp(std::prev(hint)->first, key))) { if (hint == map.end() || key_comp(key, hint->first)) { return map.emplace_hint(hint, std::forward<Key>(key), std::forward<Value>(value)); } if (!key_comp(hint->first, key)) { auto mutable_hint = ConstCastIterator(map, hint); mutable_hint->second = std::forward<Value>(value); return mutable_hint; } } return InsertOrAssignImpl(map, std::forward<Key>(key), std::forward<Value>(value)) .first; } template <typename Map, typename Key, typename... Args> std::pair<typename Map::iterator, bool> TryEmplaceImpl(Map& map, Key&& key, Args&&... args) { auto lower = map.lower_bound(key); if (lower != map.end() && !map.key_comp()(key, lower->first)) { return {lower, false}; } return {map.emplace_hint(lower, std::piecewise_construct, std::forward_as_tuple(std::forward<Key>(key)), std::forward_as_tuple(std::forward<Args>(args)...)), true}; } template <typename Map, typename Key, typename... Args> typename Map::iterator TryEmplaceImpl(Map& map, typename Map::const_iterator hint, Key&& key, Args&&... args) { auto&& key_comp = map.key_comp(); if ((hint == map.begin() || key_comp(std::prev(hint)->first, key))) { if (hint == map.end() || key_comp(key, hint->first)) { return map.emplace_hint( hint, std::piecewise_construct, std::forward_as_tuple(std::forward<Key>(key)), std::forward_as_tuple(std::forward<Args>(args)...)); } if (!key_comp(hint->first, key)) { return ConstCastIterator(map, hint); } } return TryEmplaceImpl(map, std::forward<Key>(key), std::forward<Args>(args)...) .first; } } template <typename Map, typename Value> std::pair<typename Map::iterator, bool> InsertOrAssign(Map& map, const typename Map::key_type& key, Value&& value) { return internal::InsertOrAssignImpl(map, key, std::forward<Value>(value)); } template <typename Map, typename Value> std::pair<typename Map::iterator, bool> InsertOrAssign(Map& map, typename Map::key_type&& key, Value&& value) { return internal::InsertOrAssignImpl(map, std::move(key), std::forward<Value>(value)); } template <typename Map, typename Value> typename Map::iterator InsertOrAssign(Map& map, typename Map::const_iterator hint, const typename Map::key_type& key, Value&& value) { return internal::InsertOrAssignImpl(map, hint, key, std::forward<Value>(value)); } template <typename Map, typename Value> typename Map::iterator InsertOrAssign(Map& map, typename Map::const_iterator hint, typename Map::key_type&& key, Value&& value) { return internal::InsertOrAssignImpl(map, hint, std::move(key), std::forward<Value>(value)); } template <typename Map, typename... Args> std::pair<typename Map::iterator, bool> TryEmplace(Map& map, const typename Map::key_type& key, Args&&... args) { return internal::TryEmplaceImpl(map, key, std::forward<Args>(args)...); } template <typename Map, typename... Args> std::pair<typename Map::iterator, bool> TryEmplace(Map& map, typename Map::key_type&& key, Args&&... args) { return internal::TryEmplaceImpl(map, std::move(key), std::forward<Args>(args)...); } template <typename Map, typename... Args> typename Map::iterator TryEmplace(Map& map, typename Map::const_iterator hint, const typename Map::key_type& key, Args&&... args) { return internal::TryEmplaceImpl(map, hint, key, std::forward<Args>(args)...); } template <typename Map, typename... Args> typename Map::iterator TryEmplace(Map& map, typename Map::const_iterator hint, typename Map::key_type&& key, Args&&... args) { return internal::TryEmplaceImpl(map, hint, std::move(key), std::forward<Args>(args)...); } template <typename Container> bool STLIsSorted(const Container& cont) { return std::is_sorted(std::begin(cont), std::end(cont)); } template <typename ResultType, typename Arg1, typename Arg2> ResultType STLSetDifference(const Arg1& a1, const Arg2& a2) { true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << !(STLIsSorted(a1)); true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << !(STLIsSorted(a2)); ResultType difference; std::set_difference(a1.begin(), a1.end(), a2.begin(), a2.end(), std::inserter(difference, difference.end())); return difference; } template <typename ResultType, typename Arg1, typename Arg2> ResultType STLSetUnion(const Arg1& a1, const Arg2& a2) { true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << !(STLIsSorted(a1)); true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << !(STLIsSorted(a2)); ResultType result; std::set_union(a1.begin(), a1.end(), a2.begin(), a2.end(), std::inserter(result, result.end())); return result; } template <typename ResultType, typename Arg1, typename Arg2> ResultType STLSetIntersection(const Arg1& a1, const Arg2& a2) { true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << !(STLIsSorted(a1)); true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << !(STLIsSorted(a2)); ResultType result; std::set_intersection(a1.begin(), a1.end(), a2.begin(), a2.end(), std::inserter(result, result.end())); return result; } template <typename Arg1, typename Arg2> bool STLIncludes(const Arg1& a1, const Arg2& a2) { true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << !(STLIsSorted(a1)); true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << !(STLIsSorted(a2)); return std::includes(a1.begin(), a1.end(), a2.begin(), a2.end()); } template <typename CharT, typename Traits, typename Allocator, typename Value> void Erase(std::basic_string<CharT, Traits, Allocator>& container, const Value& value) { container.erase(std::remove(container.begin(), container.end(), value), container.end()); } template <typename CharT, typename Traits, typename Allocator, class Predicate> void EraseIf(std::basic_string<CharT, Traits, Allocator>& container, Predicate pred) { container.erase(std::remove_if(container.begin(), container.end(), pred), container.end()); } template <class T, class Allocator, class Value> void Erase(std::deque<T, Allocator>& container, const Value& value) { container.erase(std::remove(container.begin(), container.end(), value), container.end()); } template <class T, class Allocator, class Predicate> void EraseIf(std::deque<T, Allocator>& container, Predicate pred) { container.erase(std::remove_if(container.begin(), container.end(), pred), container.end()); } template <class T, class Allocator, class Value> void Erase(std::vector<T, Allocator>& container, const Value& value) { container.erase(std::remove(container.begin(), container.end(), value), container.end()); } template <class T, class Allocator, class Predicate> void EraseIf(std::vector<T, Allocator>& container, Predicate pred) { container.erase(std::remove_if(container.begin(), container.end(), pred), container.end()); } template <class T, class Allocator, class Value> void Erase(std::forward_list<T, Allocator>& container, const Value& value) { container.remove_if([&](const T& cur) { return cur == value; }); } template <class T, class Allocator, class Predicate> void EraseIf(std::forward_list<T, Allocator>& container, Predicate pred) { container.remove_if(pred); } template <class T, class Allocator, class Value> void Erase(std::list<T, Allocator>& container, const Value& value) { container.remove_if([&](const T& cur) { return cur == value; }); } template <class T, class Allocator, class Predicate> void EraseIf(std::list<T, Allocator>& container, Predicate pred) { container.remove_if(pred); } template <class Key, class T, class Compare, class Allocator, class Predicate> void EraseIf(std::map<Key, T, Compare, Allocator>& container, Predicate pred) { internal::IterateAndEraseIf(container, pred); } template <class Key, class T, class Compare, class Allocator, class Predicate> void EraseIf(std::multimap<Key, T, Compare, Allocator>& container, Predicate pred) { internal::IterateAndEraseIf(container, pred); } template <class Key, class Compare, class Allocator, class Predicate> void EraseIf(std::set<Key, Compare, Allocator>& container, Predicate pred) { internal::IterateAndEraseIf(container, pred); } template <class Key, class Compare, class Allocator, class Predicate> void EraseIf(std::multiset<Key, Compare, Allocator>& container, Predicate pred) { internal::IterateAndEraseIf(container, pred); } template <class Key, class T, class Hash, class KeyEqual, class Allocator, class Predicate> void EraseIf(std::unordered_map<Key, T, Hash, KeyEqual, Allocator>& container, Predicate pred) { internal::IterateAndEraseIf(container, pred); } template <class Key, class T, class Hash, class KeyEqual, class Allocator, class Predicate> void EraseIf( std::unordered_multimap<Key, T, Hash, KeyEqual, Allocator>& container, Predicate pred) { internal::IterateAndEraseIf(container, pred); } template <class Key, class Hash, class KeyEqual, class Allocator, class Predicate> void EraseIf(std::unordered_set<Key, Hash, KeyEqual, Allocator>& container, Predicate pred) { internal::IterateAndEraseIf(container, pred); } template <class Key, class Hash, class KeyEqual, class Allocator, class Predicate> void EraseIf(std::unordered_multiset<Key, Hash, KeyEqual, Allocator>& container, Predicate pred) { internal::IterateAndEraseIf(container, pred); } template <class Collection> class IsNotIn { public: explicit IsNotIn(const Collection& collection) : i_(collection.begin()), end_(collection.end()) {} bool operator()(const typename Collection::value_type& x) { while (i_ != end_ && *i_ < x) ++i_; if (i_ == end_) return true; if (*i_ == x) { ++i_; return false; } return true; } private: typename Collection::const_iterator i_; const typename Collection::const_iterator end_; }; template <class T> T* OptionalOrNullptr(base::Optional<T>& optional) { return optional.has_value() ? &optional.value() : nullptr; } template <class T> const T* OptionalOrNullptr(const base::Optional<T>& optional) { return optional.has_value() ? &optional.value() : nullptr; } } namespace base { template <typename T> struct CharTraits { static constexpr int compare(const T* s1, const T* s2, size_t n) noexcept; static constexpr size_t length(const T* s) noexcept; }; template <typename T> constexpr int CharTraits<T>::compare(const T* s1, const T* s2, size_t n) noexcept { for (; n; --n, ++s1, ++s2) { if (*s1 < *s2) return -1; if (*s1 > *s2) return 1; } return 0; } template <typename T> constexpr size_t CharTraits<T>::length(const T* s) noexcept { size_t i = 0; for (; *s; ++s) ++i; return i; } template <> struct CharTraits<char> { static constexpr int compare(const char* s1, const char* s2, size_t n) noexcept; static constexpr size_t length(const char* s) noexcept; }; constexpr int CharTraits<char>::compare(const char* s1, const char* s2, size_t n) noexcept { return __builtin_memcmp(s1, s2, n); } constexpr size_t CharTraits<char>::length(const char* s) noexcept { return __builtin_strlen(s); } } namespace base { namespace internal { void AppendToString(const StringPiece& self, std::string* target); void AppendToString(const StringPiece16& self, string16* target); size_t copy(const StringPiece& self, char* buf, size_t n, size_t pos); size_t copy(const StringPiece16& self, char16* buf, size_t n, size_t pos); size_t find(const StringPiece& self, const StringPiece& s, size_t pos); size_t find(const StringPiece16& self, const StringPiece16& s, size_t pos); size_t find(const StringPiece& self, char c, size_t pos); size_t find(const StringPiece16& self, char16 c, size_t pos); size_t rfind(const StringPiece& self, const StringPiece& s, size_t pos); size_t rfind(const StringPiece16& self, const StringPiece16& s, size_t pos); size_t rfind(const StringPiece& self, char c, size_t pos); size_t rfind(const StringPiece16& self, char16 c, size_t pos); size_t find_first_of(const StringPiece& self, const StringPiece& s, size_t pos); size_t find_first_of(const StringPiece16& self, const StringPiece16& s, size_t pos); size_t find_first_not_of(const StringPiece& self, const StringPiece& s, size_t pos); size_t find_first_not_of(const StringPiece16& self, const StringPiece16& s, size_t pos); size_t find_first_not_of(const StringPiece& self, char c, size_t pos); size_t find_first_not_of(const StringPiece16& self, char16 c, size_t pos); size_t find_last_of(const StringPiece& self, const StringPiece& s, size_t pos); size_t find_last_of(const StringPiece16& self, const StringPiece16& s, size_t pos); size_t find_last_of(const StringPiece& self, char c, size_t pos); size_t find_last_of(const StringPiece16& self, char16 c, size_t pos); size_t find_last_not_of(const StringPiece& self, const StringPiece& s, size_t pos); size_t find_last_not_of(const StringPiece16& self, const StringPiece16& s, size_t pos); size_t find_last_not_of(const StringPiece16& self, char16 c, size_t pos); size_t find_last_not_of(const StringPiece& self, char c, size_t pos); StringPiece substr(const StringPiece& self, size_t pos, size_t n); StringPiece16 substr(const StringPiece16& self, size_t pos, size_t n); } template <typename STRING_TYPE> class BasicStringPiece { public: typedef size_t size_type; typedef typename STRING_TYPE::value_type value_type; typedef const value_type* pointer; typedef const value_type& reference; typedef const value_type& const_reference; typedef ptrdiff_t difference_type; typedef const value_type* const_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; static const size_type npos; public: constexpr BasicStringPiece() : ptr_(0), length_(0) {} constexpr BasicStringPiece(const value_type* str) : ptr_(str), length_(!str ? 0 : CharTraits<value_type>::length(str)) {} BasicStringPiece(const STRING_TYPE& str) : ptr_(str.data()), length_(str.size()) {} constexpr BasicStringPiece(const value_type* offset, size_type len) : ptr_(offset), length_(len) {} BasicStringPiece(const typename STRING_TYPE::const_iterator& begin, const typename STRING_TYPE::const_iterator& end) { true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << !(begin <= end) << "StringPiece iterators swapped or invalid."; length_ = static_cast<size_t>(std::distance(begin, end)); ptr_ = length_ > 0 ? &*begin : nullptr; } constexpr const value_type* data() const { return ptr_; } constexpr size_type size() const noexcept { return length_; } constexpr size_type length() const noexcept { return length_; } bool empty() const { return length_ == 0; } constexpr value_type operator[](size_type i) const { !(!(i < length_)) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/strings/string_piece.h", 199, "i < length_").stream()); return ptr_[i]; } value_type front() const { switch (0) case 0: default: if (::logging::CheckOpResult true_if_passed = ::logging::CheckNEImpl((0UL), (length_), "0UL" " " "!=" " " "length_")) ; else ::logging::LogMessage("../..\\base/strings/string_piece.h", 204, true_if_passed.message()).stream(); return ptr_[0]; } value_type back() const { switch (0) case 0: default: if (::logging::CheckOpResult true_if_passed = ::logging::CheckNEImpl((0UL), (length_), "0UL" " " "!=" " " "length_")) ; else ::logging::LogMessage("../..\\base/strings/string_piece.h", 209, true_if_passed.message()).stream(); return ptr_[length_ - 1]; } constexpr void remove_prefix(size_type n) { !(!(n <= length_)) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/strings/string_piece.h", 214, "n <= length_").stream()); ptr_ += n; length_ -= n; } constexpr void remove_suffix(size_type n) { !(!(n <= length_)) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/strings/string_piece.h", 220, "n <= length_").stream()); length_ -= n; } constexpr int compare(BasicStringPiece x) const noexcept { int r = CharTraits<value_type>::compare( ptr_, x.ptr_, (length_ < x.length_ ? length_ : x.length_)); if (r == 0) { if (length_ < x.length_) r = -1; else if (length_ > x.length_) r = +1; } return r; } explicit operator STRING_TYPE() const { return as_string(); } STRING_TYPE as_string() const { return empty() ? STRING_TYPE() : STRING_TYPE(data(), size()); } const_iterator begin() const { return ptr_; } const_iterator end() const { return ptr_ + length_; } const_reverse_iterator rbegin() const { return const_reverse_iterator(ptr_ + length_); } const_reverse_iterator rend() const { return const_reverse_iterator(ptr_); } size_type max_size() const { return length_; } size_type capacity() const { return length_; } void AppendToString(STRING_TYPE* target) const { internal::AppendToString(*this, target); } size_type copy(value_type* buf, size_type n, size_type pos = 0) const { return internal::copy(*this, buf, n, pos); } constexpr bool starts_with(BasicStringPiece x) const noexcept { return ( (this->length_ >= x.length_) && (CharTraits<value_type>::compare(this->ptr_, x.ptr_, x.length_) == 0)); } constexpr bool ends_with(BasicStringPiece x) const noexcept { return ((this->length_ >= x.length_) && (CharTraits<value_type>::compare( this->ptr_ + (this->length_ - x.length_), x.ptr_, x.length_) == 0)); } size_type find(const BasicStringPiece<STRING_TYPE>& s, size_type pos = 0) const { return internal::find(*this, s, pos); } size_type find(value_type c, size_type pos = 0) const { return internal::find(*this, c, pos); } size_type rfind(const BasicStringPiece& s, size_type pos = BasicStringPiece::npos) const { return internal::rfind(*this, s, pos); } size_type rfind(value_type c, size_type pos = BasicStringPiece::npos) const { return internal::rfind(*this, c, pos); } size_type find_first_of(const BasicStringPiece& s, size_type pos = 0) const { return internal::find_first_of(*this, s, pos); } size_type find_first_of(value_type c, size_type pos = 0) const { return find(c, pos); } size_type find_first_not_of(const BasicStringPiece& s, size_type pos = 0) const { return internal::find_first_not_of(*this, s, pos); } size_type find_first_not_of(value_type c, size_type pos = 0) const { return internal::find_first_not_of(*this, c, pos); } size_type find_last_of(const BasicStringPiece& s, size_type pos = BasicStringPiece::npos) const { return internal::find_last_of(*this, s, pos); } size_type find_last_of(value_type c, size_type pos = BasicStringPiece::npos) const { return rfind(c, pos); } size_type find_last_not_of(const BasicStringPiece& s, size_type pos = BasicStringPiece::npos) const { return internal::find_last_not_of(*this, s, pos); } size_type find_last_not_of(value_type c, size_type pos = BasicStringPiece::npos) const { return internal::find_last_not_of(*this, c, pos); } BasicStringPiece substr(size_type pos, size_type n = BasicStringPiece::npos) const { return internal::substr(*this, pos, n); } protected: const value_type* ptr_; size_type length_; }; template <typename STRING_TYPE> const typename BasicStringPiece<STRING_TYPE>::size_type BasicStringPiece<STRING_TYPE>::npos = typename BasicStringPiece<STRING_TYPE>::size_type(-1); template <typename StringT> constexpr bool operator==(BasicStringPiece<StringT> lhs, BasicStringPiece<StringT> rhs) noexcept { return lhs.size() == rhs.size() && lhs.compare(rhs) == 0; } template <typename StringT, int = 1> constexpr bool operator==( BasicStringPiece<StringT> lhs, std::common_type_t<BasicStringPiece<StringT>> rhs) noexcept { return lhs.size() == rhs.size() && lhs.compare(rhs) == 0; } template <typename StringT, int = 2> constexpr bool operator==(std::common_type_t<BasicStringPiece<StringT>> lhs, BasicStringPiece<StringT> rhs) noexcept { return lhs.size() == rhs.size() && lhs.compare(rhs) == 0; } template <typename StringT> constexpr bool operator!=(BasicStringPiece<StringT> lhs, BasicStringPiece<StringT> rhs) noexcept { return !(lhs == rhs); } template <typename StringT, int = 1> constexpr bool operator!=( BasicStringPiece<StringT> lhs, std::common_type_t<BasicStringPiece<StringT>> rhs) noexcept { return !(lhs == rhs); } template <typename StringT, int = 2> constexpr bool operator!=(std::common_type_t<BasicStringPiece<StringT>> lhs, BasicStringPiece<StringT> rhs) noexcept { return !(lhs == rhs); } template <typename StringT> constexpr bool operator<(BasicStringPiece<StringT> lhs, BasicStringPiece<StringT> rhs) noexcept { return lhs.compare(rhs) < 0; } template <typename StringT, int = 1> constexpr bool operator<( BasicStringPiece<StringT> lhs, std::common_type_t<BasicStringPiece<StringT>> rhs) noexcept { return lhs.compare(rhs) < 0; } template <typename StringT, int = 2> constexpr bool operator<(std::common_type_t<BasicStringPiece<StringT>> lhs, BasicStringPiece<StringT> rhs) noexcept { return lhs.compare(rhs) < 0; } template <typename StringT> constexpr bool operator>(BasicStringPiece<StringT> lhs, BasicStringPiece<StringT> rhs) noexcept { return rhs < lhs; } template <typename StringT, int = 1> constexpr bool operator>( BasicStringPiece<StringT> lhs, std::common_type_t<BasicStringPiece<StringT>> rhs) noexcept { return rhs < lhs; } template <typename StringT, int = 2> constexpr bool operator>(std::common_type_t<BasicStringPiece<StringT>> lhs, BasicStringPiece<StringT> rhs) noexcept { return rhs < lhs; } template <typename StringT> constexpr bool operator<=(BasicStringPiece<StringT> lhs, BasicStringPiece<StringT> rhs) noexcept { return !(rhs < lhs); } template <typename StringT, int = 1> constexpr bool operator<=( BasicStringPiece<StringT> lhs, std::common_type_t<BasicStringPiece<StringT>> rhs) noexcept { return !(rhs < lhs); } template <typename StringT, int = 2> constexpr bool operator<=(std::common_type_t<BasicStringPiece<StringT>> lhs, BasicStringPiece<StringT> rhs) noexcept { return !(rhs < lhs); } template <typename StringT> constexpr bool operator>=(BasicStringPiece<StringT> lhs, BasicStringPiece<StringT> rhs) noexcept { return !(lhs < rhs); } template <typename StringT, int = 1> constexpr bool operator>=( BasicStringPiece<StringT> lhs, std::common_type_t<BasicStringPiece<StringT>> rhs) noexcept { return !(lhs < rhs); } template <typename StringT, int = 2> constexpr bool operator>=(std::common_type_t<BasicStringPiece<StringT>> lhs, BasicStringPiece<StringT> rhs) noexcept { return !(lhs < rhs); } std::ostream& operator<<(std::ostream& o, const StringPiece& piece); std::ostream& operator<<(std::ostream& o, const StringPiece16& piece); template <typename StringPieceType> struct StringPieceHashImpl { std::size_t operator()(StringPieceType sp) const { std::size_t result = 0; for (auto c : sp) result = (result * 131) + c; return result; } }; using StringPieceHash = StringPieceHashImpl<StringPiece>; using StringPiece16Hash = StringPieceHashImpl<StringPiece16>; using WStringPieceHash = StringPieceHashImpl<WStringPiece>; } namespace base { class Pickle; class PickleIterator; class FilePath { public: typedef std::wstring StringType; typedef BasicStringPiece<StringType> StringPieceType; typedef StringType::value_type CharType; static const CharType kSeparators[]; static const size_t kSeparatorsLength; static const CharType kCurrentDirectory[]; static const CharType kParentDirectory[]; static const CharType kExtensionSeparator; FilePath(); FilePath(const FilePath& that); explicit FilePath(StringPieceType path); ~FilePath(); FilePath& operator=(const FilePath& that); FilePath(FilePath&& that) noexcept; FilePath& operator=(FilePath&& that); bool operator==(const FilePath& that) const; bool operator!=(const FilePath& that) const; bool operator<(const FilePath& that) const { return path_ < that.path_; } const StringType& value() const { return path_; } bool empty() const { return path_.empty(); } void clear() { path_.clear(); } static bool IsSeparator(CharType character); void GetComponents(std::vector<FilePath::StringType>* components) const; bool IsParent(const FilePath& child) const; bool AppendRelativePath(const FilePath& child, FilePath* path) const; FilePath DirName() const __attribute__((warn_unused_result)); FilePath BaseName() const __attribute__((warn_unused_result)); StringType Extension() const __attribute__((warn_unused_result)); StringType FinalExtension() const __attribute__((warn_unused_result)); FilePath RemoveExtension() const __attribute__((warn_unused_result)); FilePath RemoveFinalExtension() const __attribute__((warn_unused_result)); FilePath InsertBeforeExtension( StringPieceType suffix) const __attribute__((warn_unused_result)); FilePath InsertBeforeExtensionASCII( StringPiece suffix) const __attribute__((warn_unused_result)); FilePath AddExtension(StringPieceType extension) const __attribute__((warn_unused_result)); FilePath AddExtensionASCII(StringPiece extension) const __attribute__((warn_unused_result)); FilePath ReplaceExtension(StringPieceType extension) const __attribute__((warn_unused_result)); bool MatchesExtension(StringPieceType extension) const; FilePath Append(StringPieceType component) const __attribute__((warn_unused_result)); FilePath Append(const FilePath& component) const __attribute__((warn_unused_result)); FilePath AppendASCII(StringPiece component) const __attribute__((warn_unused_result)); bool IsAbsolute() const; bool EndsWithSeparator() const __attribute__((warn_unused_result)); FilePath AsEndingWithSeparator() const __attribute__((warn_unused_result)); FilePath StripTrailingSeparators() const __attribute__((warn_unused_result)); bool ReferencesParent() const; string16 LossyDisplayName() const; std::string MaybeAsASCII() const; std::string AsUTF8Unsafe() const; string16 AsUTF16Unsafe() const; static FilePath FromUTF8Unsafe(StringPiece utf8); static FilePath FromUTF16Unsafe(StringPiece16 utf16); void WriteToPickle(Pickle* pickle) const; bool ReadFromPickle(PickleIterator* iter); FilePath NormalizePathSeparators() const; FilePath NormalizePathSeparatorsTo(CharType separator) const; static int CompareIgnoreCase(StringPieceType string1, StringPieceType string2); static bool CompareEqualIgnoreCase(StringPieceType string1, StringPieceType string2) { return CompareIgnoreCase(string1, string2) == 0; } static bool CompareLessIgnoreCase(StringPieceType string1, StringPieceType string2) { return CompareIgnoreCase(string1, string2) < 0; } private: void StripTrailingSeparatorsInternal(); StringType path_; }; std::ostream& operator<<(std::ostream& out, const FilePath& file_path); } namespace std { template <> struct hash<base::FilePath> { typedef base::FilePath argument_type; typedef std::size_t result_type; result_type operator()(argument_type const& f) const { return hash<base::FilePath::StringType>()(f.value()); } }; } extern "C" { typedef unsigned long DWORD; typedef long LONG; typedef __int64 LONGLONG; typedef unsigned __int64 ULONGLONG; typedef char CHAR; typedef short SHORT; typedef long LONG; typedef int INT; typedef unsigned int UINT; typedef unsigned int* PUINT; typedef void* LPVOID; typedef void* PVOID; typedef void* HANDLE; typedef int BOOL; typedef unsigned char BYTE; typedef BYTE BOOLEAN; typedef DWORD ULONG; typedef unsigned short WORD; typedef WORD UWORD; typedef WORD ATOM; typedef __int64 INT_PTR, *PINT_PTR; typedef unsigned __int64 UINT_PTR, *PUINT_PTR; typedef __int64 LONG_PTR, *PLONG_PTR; typedef unsigned __int64 ULONG_PTR, *PULONG_PTR; typedef UINT_PTR WPARAM; typedef LONG_PTR LPARAM; typedef LONG_PTR LRESULT; typedef long HRESULT; typedef ULONG_PTR SIZE_T, *PSIZE_T; typedef LONG_PTR SSIZE_T, *PSSIZE_T; typedef DWORD ACCESS_MASK; typedef ACCESS_MASK REGSAM; struct HDESK__; typedef struct HDESK__* HDESK; struct HGLRC__; typedef struct HGLRC__* HGLRC; struct HICON__; typedef struct HICON__* HICON; struct HINSTANCE__; typedef struct HINSTANCE__* HINSTANCE; struct HKEY__; typedef struct HKEY__* HKEY; struct HKL__; typedef struct HKL__* HKL; struct HMENU__; typedef struct HMENU__* HMENU; struct HWINSTA__; typedef struct HWINSTA__* HWINSTA; struct HWND__; typedef struct HWND__* HWND; typedef LPVOID HINTERNET; typedef HINSTANCE HMODULE; typedef PVOID LSA_HANDLE; typedef struct _OVERLAPPED OVERLAPPED; typedef struct tagMSG MSG, *PMSG, *NPMSG, *LPMSG; typedef struct _RTL_SRWLOCK RTL_SRWLOCK; typedef RTL_SRWLOCK SRWLOCK, *PSRWLOCK; typedef struct _GUID GUID; typedef GUID CLSID; typedef struct tagLOGFONTW LOGFONTW, *PLOGFONTW, *NPLOGFONTW, *LPLOGFONTW; typedef LOGFONTW LOGFONT; typedef struct _FILETIME FILETIME; typedef struct tagMENUITEMINFOW MENUITEMINFOW, MENUITEMINFO; typedef struct tagNMHDR NMHDR; typedef PVOID PSID; struct CHROME_SRWLOCK { PVOID Ptr; }; struct CHROME_CONDITION_VARIABLE { PVOID Ptr; }; __declspec(dllimport) void __stdcall ReleaseSRWLockExclusive( PSRWLOCK SRWLock); __declspec(dllimport) BOOL __stdcall GetMessageW( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax); __declspec(dllimport) LPVOID __stdcall TlsGetValue( DWORD dwTlsIndex); __declspec(dllimport) DWORD __stdcall GetLastError(void); __declspec(dllimport) void __stdcall SetLastError( DWORD dwErrCode); } namespace base { typedef HANDLE ProcessHandle; typedef DWORD ProcessId; typedef HANDLE UserTokenHandle; const ProcessHandle kNullProcessHandle = 0; const ProcessId kNullProcessId = 0; class UniqueProcId { public: explicit UniqueProcId(ProcessId value) : value_(value) {} UniqueProcId(const UniqueProcId& other) = default; UniqueProcId& operator=(const UniqueProcId& other) = default; ProcessId GetUnsafeValue() const { return value_; } bool operator==(const UniqueProcId& other) const { return value_ == other.value_; } bool operator!=(const UniqueProcId& other) const { return value_ != other.value_; } bool operator<(const UniqueProcId& other) const { return value_ < other.value_; } bool operator<=(const UniqueProcId& other) const { return value_ <= other.value_; } bool operator>(const UniqueProcId& other) const { return value_ > other.value_; } bool operator>=(const UniqueProcId& other) const { return value_ >= other.value_; } private: ProcessId value_; }; std::ostream& operator<<(std::ostream& os, const UniqueProcId& obj); ProcessId GetCurrentProcId(); UniqueProcId GetUniqueIdForProcess(); ProcessHandle GetCurrentProcessHandle(); ProcessId GetProcId(ProcessHandle process); ProcessId GetParentProcessId(ProcessHandle process); } namespace base { namespace internal { template <typename NumericType> struct MaxExponent { static const int value = std::is_floating_point<NumericType>::value ? std::numeric_limits<NumericType>::max_exponent : std::numeric_limits<NumericType>::digits + 1; }; template <typename NumericType> struct IntegerBitsPlusSign { static const int value = std::numeric_limits<NumericType>::digits + std::is_signed<NumericType>::value; }; template <typename Integer> struct PositionOfSignBit { static const size_t value = IntegerBitsPlusSign<Integer>::value - 1; }; template <typename T, typename std::enable_if<std::is_signed<T>::value>::type* = nullptr> constexpr bool IsValueNegative(T value) { static_assert(std::is_arithmetic<T>::value, "Argument must be numeric."); return value < 0; } template <typename T, typename std::enable_if<!std::is_signed<T>::value>::type* = nullptr> constexpr bool IsValueNegative(T) { static_assert(std::is_arithmetic<T>::value, "Argument must be numeric."); return false; } template <typename T> constexpr typename std::make_signed<T>::type ConditionalNegate( T x, bool is_negative) { static_assert(std::is_integral<T>::value, "Type must be integral"); using SignedT = typename std::make_signed<T>::type; using UnsignedT = typename std::make_unsigned<T>::type; return static_cast<SignedT>( (static_cast<UnsignedT>(x) ^ -SignedT(is_negative)) + is_negative); } template <typename T> constexpr typename std::make_unsigned<T>::type SafeUnsignedAbs(T value) { static_assert(std::is_integral<T>::value, "Type must be integral"); using UnsignedT = typename std::make_unsigned<T>::type; return IsValueNegative(value) ? static_cast<UnsignedT>(0u - static_cast<UnsignedT>(value)) : static_cast<UnsignedT>(value); } constexpr bool CanDetectCompileTimeConstant() { return true; } template <typename T> constexpr bool IsCompileTimeConstant(const T v) { return __builtin_constant_p(v); } template <typename T> constexpr bool MustTreatAsConstexpr(const T v) { return !CanDetectCompileTimeConstant() || IsCompileTimeConstant(v); } struct CheckOnFailure { template <typename T> static T HandleFailure() { __debugbreak(); return T(); } }; enum IntegerRepresentation { INTEGER_REPRESENTATION_UNSIGNED, INTEGER_REPRESENTATION_SIGNED }; enum NumericRangeRepresentation { NUMERIC_RANGE_NOT_CONTAINED, NUMERIC_RANGE_CONTAINED }; template <typename Dst, typename Src, IntegerRepresentation DstSign = std::is_signed<Dst>::value ? INTEGER_REPRESENTATION_SIGNED : INTEGER_REPRESENTATION_UNSIGNED, IntegerRepresentation SrcSign = std::is_signed<Src>::value ? INTEGER_REPRESENTATION_SIGNED : INTEGER_REPRESENTATION_UNSIGNED> struct StaticDstRangeRelationToSrcRange; template <typename Dst, typename Src, IntegerRepresentation Sign> struct StaticDstRangeRelationToSrcRange<Dst, Src, Sign, Sign> { static const NumericRangeRepresentation value = MaxExponent<Dst>::value >= MaxExponent<Src>::value ? NUMERIC_RANGE_CONTAINED : NUMERIC_RANGE_NOT_CONTAINED; }; template <typename Dst, typename Src> struct StaticDstRangeRelationToSrcRange<Dst, Src, INTEGER_REPRESENTATION_SIGNED, INTEGER_REPRESENTATION_UNSIGNED> { static const NumericRangeRepresentation value = MaxExponent<Dst>::value > MaxExponent<Src>::value ? NUMERIC_RANGE_CONTAINED : NUMERIC_RANGE_NOT_CONTAINED; }; template <typename Dst, typename Src> struct StaticDstRangeRelationToSrcRange<Dst, Src, INTEGER_REPRESENTATION_UNSIGNED, INTEGER_REPRESENTATION_SIGNED> { static const NumericRangeRepresentation value = NUMERIC_RANGE_NOT_CONTAINED; }; class RangeCheck { public: constexpr RangeCheck(bool is_in_lower_bound, bool is_in_upper_bound) : is_underflow_(!is_in_lower_bound), is_overflow_(!is_in_upper_bound) {} constexpr RangeCheck() : is_underflow_(0), is_overflow_(0) {} constexpr bool IsValid() const { return !is_overflow_ && !is_underflow_; } constexpr bool IsInvalid() const { return is_overflow_ && is_underflow_; } constexpr bool IsOverflow() const { return is_overflow_ && !is_underflow_; } constexpr bool IsUnderflow() const { return !is_overflow_ && is_underflow_; } constexpr bool IsOverflowFlagSet() const { return is_overflow_; } constexpr bool IsUnderflowFlagSet() const { return is_underflow_; } constexpr bool operator==(const RangeCheck rhs) const { return is_underflow_ == rhs.is_underflow_ && is_overflow_ == rhs.is_overflow_; } constexpr bool operator!=(const RangeCheck rhs) const { return !(*this == rhs); } private: const bool is_underflow_; const bool is_overflow_; }; template <typename Dst, typename Src, template <typename> class Bounds> struct NarrowingRange { using SrcLimits = std::numeric_limits<Src>; using DstLimits = typename std::numeric_limits<Dst>; static const int kShift = (MaxExponent<Src>::value > MaxExponent<Dst>::value && SrcLimits::digits < DstLimits::digits) ? (DstLimits::digits - SrcLimits::digits) : 0; template < typename T, typename std::enable_if<std::is_integral<T>::value>::type* = nullptr> static constexpr T Adjust(T value) { static_assert(std::is_same<T, Dst>::value, ""); static_assert(kShift < DstLimits::digits, ""); return static_cast<T>( ConditionalNegate(SafeUnsignedAbs(value) & ~((T(1) << kShift) - T(1)), IsValueNegative(value))); } template <typename T, typename std::enable_if<std::is_floating_point<T>::value>::type* = nullptr> static constexpr T Adjust(T value) { static_assert(std::is_same<T, Dst>::value, ""); static_assert(kShift == 0, ""); return value; } static constexpr Dst max() { return Adjust(Bounds<Dst>::max()); } static constexpr Dst lowest() { return Adjust(Bounds<Dst>::lowest()); } }; template <typename Dst, typename Src, template <typename> class Bounds, IntegerRepresentation DstSign = std::is_signed<Dst>::value ? INTEGER_REPRESENTATION_SIGNED : INTEGER_REPRESENTATION_UNSIGNED, IntegerRepresentation SrcSign = std::is_signed<Src>::value ? INTEGER_REPRESENTATION_SIGNED : INTEGER_REPRESENTATION_UNSIGNED, NumericRangeRepresentation DstRange = StaticDstRangeRelationToSrcRange<Dst, Src>::value> struct DstRangeRelationToSrcRangeImpl; template <typename Dst, typename Src, template <typename> class Bounds, IntegerRepresentation DstSign, IntegerRepresentation SrcSign> struct DstRangeRelationToSrcRangeImpl<Dst, Src, Bounds, DstSign, SrcSign, NUMERIC_RANGE_CONTAINED> { static constexpr RangeCheck Check(Src value) { using SrcLimits = std::numeric_limits<Src>; using DstLimits = NarrowingRange<Dst, Src, Bounds>; return RangeCheck( static_cast<Dst>(SrcLimits::lowest()) >= DstLimits::lowest() || static_cast<Dst>(value) >= DstLimits::lowest(), static_cast<Dst>(SrcLimits::max()) <= DstLimits::max() || static_cast<Dst>(value) <= DstLimits::max()); } }; template <typename Dst, typename Src, template <typename> class Bounds> struct DstRangeRelationToSrcRangeImpl<Dst, Src, Bounds, INTEGER_REPRESENTATION_SIGNED, INTEGER_REPRESENTATION_SIGNED, NUMERIC_RANGE_NOT_CONTAINED> { static constexpr RangeCheck Check(Src value) { using DstLimits = NarrowingRange<Dst, Src, Bounds>; return RangeCheck(value >= DstLimits::lowest(), value <= DstLimits::max()); } }; template <typename Dst, typename Src, template <typename> class Bounds> struct DstRangeRelationToSrcRangeImpl<Dst, Src, Bounds, INTEGER_REPRESENTATION_UNSIGNED, INTEGER_REPRESENTATION_UNSIGNED, NUMERIC_RANGE_NOT_CONTAINED> { static constexpr RangeCheck Check(Src value) { using DstLimits = NarrowingRange<Dst, Src, Bounds>; return RangeCheck( DstLimits::lowest() == Dst(0) || value >= DstLimits::lowest(), value <= DstLimits::max()); } }; template <typename Dst, typename Src, template <typename> class Bounds> struct DstRangeRelationToSrcRangeImpl<Dst, Src, Bounds, INTEGER_REPRESENTATION_SIGNED, INTEGER_REPRESENTATION_UNSIGNED, NUMERIC_RANGE_NOT_CONTAINED> { static constexpr RangeCheck Check(Src value) { using DstLimits = NarrowingRange<Dst, Src, Bounds>; using Promotion = decltype(Src() + Dst()); return RangeCheck(DstLimits::lowest() <= Dst(0) || static_cast<Promotion>(value) >= static_cast<Promotion>(DstLimits::lowest()), static_cast<Promotion>(value) <= static_cast<Promotion>(DstLimits::max())); } }; template <typename Dst, typename Src, template <typename> class Bounds> struct DstRangeRelationToSrcRangeImpl<Dst, Src, Bounds, INTEGER_REPRESENTATION_UNSIGNED, INTEGER_REPRESENTATION_SIGNED, NUMERIC_RANGE_NOT_CONTAINED> { static constexpr RangeCheck Check(Src value) { using SrcLimits = std::numeric_limits<Src>; using DstLimits = NarrowingRange<Dst, Src, Bounds>; using Promotion = decltype(Src() + Dst()); return RangeCheck( value >= Src(0) && (DstLimits::lowest() == 0 || static_cast<Dst>(value) >= DstLimits::lowest()), static_cast<Promotion>(SrcLimits::max()) <= static_cast<Promotion>(DstLimits::max()) || static_cast<Promotion>(value) <= static_cast<Promotion>(DstLimits::max())); } }; template <typename Dst, typename Src> struct IsTypeInRangeForNumericType { static const bool value = StaticDstRangeRelationToSrcRange<Dst, Src>::value == NUMERIC_RANGE_CONTAINED; }; template <typename Dst, template <typename> class Bounds = std::numeric_limits, typename Src> constexpr RangeCheck DstRangeRelationToSrcRange(Src value) { static_assert(std::is_arithmetic<Src>::value, "Argument must be numeric."); static_assert(std::is_arithmetic<Dst>::value, "Result must be numeric."); static_assert(Bounds<Dst>::lowest() < Bounds<Dst>::max(), ""); return DstRangeRelationToSrcRangeImpl<Dst, Src, Bounds>::Check(value); } template <size_t Size, bool IsSigned> struct IntegerForDigitsAndSign; template <> struct IntegerForDigitsAndSign<IntegerBitsPlusSign<int8_t>::value, std::is_signed<int8_t>::value> { using type = int8_t; }; template <> struct IntegerForDigitsAndSign<IntegerBitsPlusSign<uint8_t>::value, std::is_signed<uint8_t>::value> { using type = uint8_t; }; template <> struct IntegerForDigitsAndSign<IntegerBitsPlusSign<int16_t>::value, std::is_signed<int16_t>::value> { using type = int16_t; }; template <> struct IntegerForDigitsAndSign<IntegerBitsPlusSign<uint16_t>::value, std::is_signed<uint16_t>::value> { using type = uint16_t; }; template <> struct IntegerForDigitsAndSign<IntegerBitsPlusSign<int32_t>::value, std::is_signed<int32_t>::value> { using type = int32_t; }; template <> struct IntegerForDigitsAndSign<IntegerBitsPlusSign<uint32_t>::value, std::is_signed<uint32_t>::value> { using type = uint32_t; }; template <> struct IntegerForDigitsAndSign<IntegerBitsPlusSign<int64_t>::value, std::is_signed<int64_t>::value> { using type = int64_t; }; template <> struct IntegerForDigitsAndSign<IntegerBitsPlusSign<uint64_t>::value, std::is_signed<uint64_t>::value> { using type = uint64_t; }; static_assert(IntegerBitsPlusSign<intmax_t>::value == 64, "Max integer size not supported for this toolchain."); template <typename Integer, bool IsSigned = std::is_signed<Integer>::value> struct TwiceWiderInteger { using type = typename IntegerForDigitsAndSign<IntegerBitsPlusSign<Integer>::value * 2, IsSigned>::type; }; enum ArithmeticPromotionCategory { LEFT_PROMOTION, RIGHT_PROMOTION }; template <typename Lhs, typename Rhs, ArithmeticPromotionCategory Promotion = (MaxExponent<Lhs>::value > MaxExponent<Rhs>::value) ? LEFT_PROMOTION : RIGHT_PROMOTION> struct MaxExponentPromotion; template <typename Lhs, typename Rhs> struct MaxExponentPromotion<Lhs, Rhs, LEFT_PROMOTION> { using type = Lhs; }; template <typename Lhs, typename Rhs> struct MaxExponentPromotion<Lhs, Rhs, RIGHT_PROMOTION> { using type = Rhs; }; template <typename Lhs, typename Rhs, ArithmeticPromotionCategory Promotion = std::is_signed<Lhs>::value ? (std::is_signed<Rhs>::value ? (MaxExponent<Lhs>::value > MaxExponent<Rhs>::value ? LEFT_PROMOTION : RIGHT_PROMOTION) : LEFT_PROMOTION) : (std::is_signed<Rhs>::value ? RIGHT_PROMOTION : (MaxExponent<Lhs>::value < MaxExponent<Rhs>::value ? LEFT_PROMOTION : RIGHT_PROMOTION))> struct LowestValuePromotion; template <typename Lhs, typename Rhs> struct LowestValuePromotion<Lhs, Rhs, LEFT_PROMOTION> { using type = Lhs; }; template <typename Lhs, typename Rhs> struct LowestValuePromotion<Lhs, Rhs, RIGHT_PROMOTION> { using type = Rhs; }; template < typename Lhs, typename Rhs = Lhs, bool is_intmax_type = std::is_integral<typename MaxExponentPromotion<Lhs, Rhs>::type>::value&& IntegerBitsPlusSign<typename MaxExponentPromotion<Lhs, Rhs>::type>:: value == IntegerBitsPlusSign<intmax_t>::value, bool is_max_exponent = StaticDstRangeRelationToSrcRange< typename MaxExponentPromotion<Lhs, Rhs>::type, Lhs>::value == NUMERIC_RANGE_CONTAINED&& StaticDstRangeRelationToSrcRange< typename MaxExponentPromotion<Lhs, Rhs>::type, Rhs>::value == NUMERIC_RANGE_CONTAINED> struct BigEnoughPromotion; template <typename Lhs, typename Rhs, bool is_intmax_type> struct BigEnoughPromotion<Lhs, Rhs, is_intmax_type, true> { using type = typename MaxExponentPromotion<Lhs, Rhs>::type; static const bool is_contained = true; }; template <typename Lhs, typename Rhs> struct BigEnoughPromotion<Lhs, Rhs, false, false> { using type = typename TwiceWiderInteger<typename MaxExponentPromotion<Lhs, Rhs>::type, std::is_signed<Lhs>::value || std::is_signed<Rhs>::value>::type; static const bool is_contained = true; }; template <typename Lhs, typename Rhs> struct BigEnoughPromotion<Lhs, Rhs, true, false> { using type = typename MaxExponentPromotion<Lhs, Rhs>::type; static const bool is_contained = false; }; template <typename T, typename Lhs, typename Rhs = Lhs> struct IsIntegerArithmeticSafe { static const bool value = !std::is_floating_point<T>::value && !std::is_floating_point<Lhs>::value && !std::is_floating_point<Rhs>::value && std::is_signed<T>::value >= std::is_signed<Lhs>::value && IntegerBitsPlusSign<T>::value >= (2 * IntegerBitsPlusSign<Lhs>::value) && std::is_signed<T>::value >= std::is_signed<Rhs>::value && IntegerBitsPlusSign<T>::value >= (2 * IntegerBitsPlusSign<Rhs>::value); }; template <typename Lhs, typename Rhs, bool is_promotion_possible = IsIntegerArithmeticSafe< typename std::conditional<std::is_signed<Lhs>::value || std::is_signed<Rhs>::value, intmax_t, uintmax_t>::type, typename MaxExponentPromotion<Lhs, Rhs>::type>::value> struct FastIntegerArithmeticPromotion; template <typename Lhs, typename Rhs> struct FastIntegerArithmeticPromotion<Lhs, Rhs, true> { using type = typename TwiceWiderInteger<typename MaxExponentPromotion<Lhs, Rhs>::type, std::is_signed<Lhs>::value || std::is_signed<Rhs>::value>::type; static_assert(IsIntegerArithmeticSafe<type, Lhs, Rhs>::value, ""); static const bool is_contained = true; }; template <typename Lhs, typename Rhs> struct FastIntegerArithmeticPromotion<Lhs, Rhs, false> { using type = typename BigEnoughPromotion<Lhs, Rhs>::type; static const bool is_contained = false; }; template <typename T, bool is_enum = std::is_enum<T>::value> struct ArithmeticOrUnderlyingEnum; template <typename T> struct ArithmeticOrUnderlyingEnum<T, true> { using type = typename std::underlying_type<T>::type; static const bool value = std::is_arithmetic<type>::value; }; template <typename T> struct ArithmeticOrUnderlyingEnum<T, false> { using type = T; static const bool value = std::is_arithmetic<type>::value; }; template <typename T> class CheckedNumeric; template <typename T> class ClampedNumeric; template <typename T> class StrictNumeric; template <typename T> struct UnderlyingType { using type = typename ArithmeticOrUnderlyingEnum<T>::type; static const bool is_numeric = std::is_arithmetic<type>::value; static const bool is_checked = false; static const bool is_clamped = false; static const bool is_strict = false; }; template <typename T> struct UnderlyingType<CheckedNumeric<T>> { using type = T; static const bool is_numeric = true; static const bool is_checked = true; static const bool is_clamped = false; static const bool is_strict = false; }; template <typename T> struct UnderlyingType<ClampedNumeric<T>> { using type = T; static const bool is_numeric = true; static const bool is_checked = false; static const bool is_clamped = true; static const bool is_strict = false; }; template <typename T> struct UnderlyingType<StrictNumeric<T>> { using type = T; static const bool is_numeric = true; static const bool is_checked = false; static const bool is_clamped = false; static const bool is_strict = true; }; template <typename L, typename R> struct IsCheckedOp { static const bool value = UnderlyingType<L>::is_numeric && UnderlyingType<R>::is_numeric && (UnderlyingType<L>::is_checked || UnderlyingType<R>::is_checked); }; template <typename L, typename R> struct IsClampedOp { static const bool value = UnderlyingType<L>::is_numeric && UnderlyingType<R>::is_numeric && (UnderlyingType<L>::is_clamped || UnderlyingType<R>::is_clamped) && !(UnderlyingType<L>::is_checked || UnderlyingType<R>::is_checked); }; template <typename L, typename R> struct IsStrictOp { static const bool value = UnderlyingType<L>::is_numeric && UnderlyingType<R>::is_numeric && (UnderlyingType<L>::is_strict || UnderlyingType<R>::is_strict) && !(UnderlyingType<L>::is_checked || UnderlyingType<R>::is_checked) && !(UnderlyingType<L>::is_clamped || UnderlyingType<R>::is_clamped); }; template <typename Src> constexpr typename std::make_signed< typename base::internal::UnderlyingType<Src>::type>::type as_signed(const Src value) { static_assert(std::is_integral<decltype(as_signed(value))>::value, "Argument must be a signed or unsigned integer type."); return static_cast<decltype(as_signed(value))>(value); } template <typename Src> constexpr typename std::make_unsigned< typename base::internal::UnderlyingType<Src>::type>::type as_unsigned(const Src value) { static_assert(std::is_integral<decltype(as_unsigned(value))>::value, "Argument must be a signed or unsigned integer type."); return static_cast<decltype(as_unsigned(value))>(value); } template <typename L, typename R> constexpr bool IsLessImpl(const L lhs, const R rhs, const RangeCheck l_range, const RangeCheck r_range) { return l_range.IsUnderflow() || r_range.IsOverflow() || (l_range == r_range && static_cast<decltype(lhs + rhs)>(lhs) < static_cast<decltype(lhs + rhs)>(rhs)); } template <typename L, typename R> struct IsLess { static_assert(std::is_arithmetic<L>::value && std::is_arithmetic<R>::value, "Types must be numeric."); static constexpr bool Test(const L lhs, const R rhs) { return IsLessImpl(lhs, rhs, DstRangeRelationToSrcRange<R>(lhs), DstRangeRelationToSrcRange<L>(rhs)); } }; template <typename L, typename R> constexpr bool IsLessOrEqualImpl(const L lhs, const R rhs, const RangeCheck l_range, const RangeCheck r_range) { return l_range.IsUnderflow() || r_range.IsOverflow() || (l_range == r_range && static_cast<decltype(lhs + rhs)>(lhs) <= static_cast<decltype(lhs + rhs)>(rhs)); } template <typename L, typename R> struct IsLessOrEqual { static_assert(std::is_arithmetic<L>::value && std::is_arithmetic<R>::value, "Types must be numeric."); static constexpr bool Test(const L lhs, const R rhs) { return IsLessOrEqualImpl(lhs, rhs, DstRangeRelationToSrcRange<R>(lhs), DstRangeRelationToSrcRange<L>(rhs)); } }; template <typename L, typename R> constexpr bool IsGreaterImpl(const L lhs, const R rhs, const RangeCheck l_range, const RangeCheck r_range) { return l_range.IsOverflow() || r_range.IsUnderflow() || (l_range == r_range && static_cast<decltype(lhs + rhs)>(lhs) > static_cast<decltype(lhs + rhs)>(rhs)); } template <typename L, typename R> struct IsGreater { static_assert(std::is_arithmetic<L>::value && std::is_arithmetic<R>::value, "Types must be numeric."); static constexpr bool Test(const L lhs, const R rhs) { return IsGreaterImpl(lhs, rhs, DstRangeRelationToSrcRange<R>(lhs), DstRangeRelationToSrcRange<L>(rhs)); } }; template <typename L, typename R> constexpr bool IsGreaterOrEqualImpl(const L lhs, const R rhs, const RangeCheck l_range, const RangeCheck r_range) { return l_range.IsOverflow() || r_range.IsUnderflow() || (l_range == r_range && static_cast<decltype(lhs + rhs)>(lhs) >= static_cast<decltype(lhs + rhs)>(rhs)); } template <typename L, typename R> struct IsGreaterOrEqual { static_assert(std::is_arithmetic<L>::value && std::is_arithmetic<R>::value, "Types must be numeric."); static constexpr bool Test(const L lhs, const R rhs) { return IsGreaterOrEqualImpl(lhs, rhs, DstRangeRelationToSrcRange<R>(lhs), DstRangeRelationToSrcRange<L>(rhs)); } }; template <typename L, typename R> struct IsEqual { static_assert(std::is_arithmetic<L>::value && std::is_arithmetic<R>::value, "Types must be numeric."); static constexpr bool Test(const L lhs, const R rhs) { return DstRangeRelationToSrcRange<R>(lhs) == DstRangeRelationToSrcRange<L>(rhs) && static_cast<decltype(lhs + rhs)>(lhs) == static_cast<decltype(lhs + rhs)>(rhs); } }; template <typename L, typename R> struct IsNotEqual { static_assert(std::is_arithmetic<L>::value && std::is_arithmetic<R>::value, "Types must be numeric."); static constexpr bool Test(const L lhs, const R rhs) { return DstRangeRelationToSrcRange<R>(lhs) != DstRangeRelationToSrcRange<L>(rhs) || static_cast<decltype(lhs + rhs)>(lhs) != static_cast<decltype(lhs + rhs)>(rhs); } }; template <template <typename, typename> class C, typename L, typename R> constexpr bool SafeCompare(const L lhs, const R rhs) { static_assert(std::is_arithmetic<L>::value && std::is_arithmetic<R>::value, "Types must be numeric."); using Promotion = BigEnoughPromotion<L, R>; using BigType = typename Promotion::type; return Promotion::is_contained ? C<BigType, BigType>::Test( static_cast<BigType>(static_cast<L>(lhs)), static_cast<BigType>(static_cast<R>(rhs))) : C<L, R>::Test(lhs, rhs); } template <typename Dst, typename Src> constexpr bool IsMaxInRangeForNumericType() { return IsGreaterOrEqual<Dst, Src>::Test(std::numeric_limits<Dst>::max(), std::numeric_limits<Src>::max()); } template <typename Dst, typename Src> constexpr bool IsMinInRangeForNumericType() { return IsLessOrEqual<Dst, Src>::Test(std::numeric_limits<Dst>::lowest(), std::numeric_limits<Src>::lowest()); } template <typename Dst, typename Src> constexpr Dst CommonMax() { return !IsMaxInRangeForNumericType<Dst, Src>() ? Dst(std::numeric_limits<Dst>::max()) : Dst(std::numeric_limits<Src>::max()); } template <typename Dst, typename Src> constexpr Dst CommonMin() { return !IsMinInRangeForNumericType<Dst, Src>() ? Dst(std::numeric_limits<Dst>::lowest()) : Dst(std::numeric_limits<Src>::lowest()); } template <typename Dst, typename Src = Dst> constexpr Dst CommonMaxOrMin(bool is_min) { return is_min ? CommonMin<Dst, Src>() : CommonMax<Dst, Src>(); } } } namespace base { namespace internal { template <typename Dst, typename Src> struct SaturateFastAsmOp { static const bool is_supported = false; static constexpr Dst Do(Src) { return CheckOnFailure::template HandleFailure<Dst>(); } }; template <typename Dst, typename Src, typename Enable = void> struct IsValueInRangeFastOp { static const bool is_supported = false; static constexpr bool Do(Src value) { return CheckOnFailure::template HandleFailure<bool>(); } }; template <typename Dst, typename Src> struct IsValueInRangeFastOp< Dst, Src, typename std::enable_if< std::is_integral<Dst>::value && std::is_integral<Src>::value && std::is_signed<Dst>::value && std::is_signed<Src>::value && !IsTypeInRangeForNumericType<Dst, Src>::value>::type> { static const bool is_supported = true; static constexpr bool Do(Src value) { return value == static_cast<Dst>(value); } }; template <typename Dst, typename Src> struct IsValueInRangeFastOp< Dst, Src, typename std::enable_if< std::is_integral<Dst>::value && std::is_integral<Src>::value && !std::is_signed<Dst>::value && std::is_signed<Src>::value && !IsTypeInRangeForNumericType<Dst, Src>::value>::type> { static const bool is_supported = true; static constexpr bool Do(Src value) { return as_unsigned(value) <= as_unsigned(CommonMax<Src, Dst>()); } }; template <typename Dst, typename Src> constexpr bool IsValueInRangeForNumericType(Src value) { using SrcType = typename internal::UnderlyingType<Src>::type; return internal::IsValueInRangeFastOp<Dst, SrcType>::is_supported ? internal::IsValueInRangeFastOp<Dst, SrcType>::Do( static_cast<SrcType>(value)) : internal::DstRangeRelationToSrcRange<Dst>( static_cast<SrcType>(value)) .IsValid(); } template <typename Dst, class CheckHandler = internal::CheckOnFailure, typename Src> constexpr Dst checked_cast(Src value) { using SrcType = typename internal::UnderlyingType<Src>::type; return __builtin_expect(!!((IsValueInRangeForNumericType<Dst>(value))), 1) ? static_cast<Dst>(static_cast<SrcType>(value)) : CheckHandler::template HandleFailure<Dst>(); } template <typename T> struct SaturationDefaultLimits : public std::numeric_limits<T> { static constexpr T NaN() { return std::numeric_limits<T>::has_quiet_NaN ? std::numeric_limits<T>::quiet_NaN() : T(); } using std::numeric_limits<T>::max; static constexpr T Overflow() { return std::numeric_limits<T>::has_infinity ? std::numeric_limits<T>::infinity() : std::numeric_limits<T>::max(); } using std::numeric_limits<T>::lowest; static constexpr T Underflow() { return std::numeric_limits<T>::has_infinity ? std::numeric_limits<T>::infinity() * -1 : std::numeric_limits<T>::lowest(); } }; template <typename Dst, template <typename> class S, typename Src> constexpr Dst saturated_cast_impl(Src value, RangeCheck constraint) { return !constraint.IsOverflowFlagSet() ? (!constraint.IsUnderflowFlagSet() ? static_cast<Dst>(value) : S<Dst>::Underflow()) : (std::is_integral<Src>::value || !constraint.IsUnderflowFlagSet() ? S<Dst>::Overflow() : S<Dst>::NaN()); } template <typename Dst, typename Src, typename Enable = void> struct SaturateFastOp { static const bool is_supported = false; static constexpr Dst Do(Src value) { return CheckOnFailure::template HandleFailure<Dst>(); } }; template <typename Dst, typename Src> struct SaturateFastOp< Dst, Src, typename std::enable_if<std::is_integral<Src>::value && std::is_integral<Dst>::value && SaturateFastAsmOp<Dst, Src>::is_supported>::type> { static const bool is_supported = true; static Dst Do(Src value) { return SaturateFastAsmOp<Dst, Src>::Do(value); } }; template <typename Dst, typename Src> struct SaturateFastOp< Dst, Src, typename std::enable_if<std::is_integral<Src>::value && std::is_integral<Dst>::value && !SaturateFastAsmOp<Dst, Src>::is_supported>::type> { static const bool is_supported = true; static Dst Do(Src value) { Dst saturated = CommonMaxOrMin<Dst, Src>( IsMaxInRangeForNumericType<Dst, Src>() || (!IsMinInRangeForNumericType<Dst, Src>() && IsValueNegative(value))); return __builtin_expect(!!(IsValueInRangeForNumericType<Dst>(value)), 1) ? static_cast<Dst>(value) : saturated; } }; template <typename Dst, template <typename> class SaturationHandler = SaturationDefaultLimits, typename Src> constexpr Dst saturated_cast(Src value) { using SrcType = typename UnderlyingType<Src>::type; return !IsCompileTimeConstant(value) && SaturateFastOp<Dst, SrcType>::is_supported && std::is_same<SaturationHandler<Dst>, SaturationDefaultLimits<Dst>>::value ? SaturateFastOp<Dst, SrcType>::Do(static_cast<SrcType>(value)) : saturated_cast_impl<Dst, SaturationHandler, SrcType>( static_cast<SrcType>(value), DstRangeRelationToSrcRange<Dst, SaturationHandler, SrcType>( static_cast<SrcType>(value))); } template <typename Dst, typename Src> constexpr Dst strict_cast(Src value) { using SrcType = typename UnderlyingType<Src>::type; static_assert(UnderlyingType<Src>::is_numeric, "Argument must be numeric."); static_assert(std::is_arithmetic<Dst>::value, "Result must be numeric."); static_assert(StaticDstRangeRelationToSrcRange<Dst, SrcType>::value == NUMERIC_RANGE_CONTAINED, "The source type is out of range for the destination type. " "Please see strict_cast<> comments for more information."); return static_cast<Dst>(static_cast<SrcType>(value)); } template <typename Dst, typename Src, class Enable = void> struct IsNumericRangeContained { static const bool value = false; }; template <typename Dst, typename Src> struct IsNumericRangeContained< Dst, Src, typename std::enable_if<ArithmeticOrUnderlyingEnum<Dst>::value && ArithmeticOrUnderlyingEnum<Src>::value>::type> { static const bool value = StaticDstRangeRelationToSrcRange<Dst, Src>::value == NUMERIC_RANGE_CONTAINED; }; template <typename T> class StrictNumeric { public: using type = T; constexpr StrictNumeric() : value_(0) {} template <typename Src> constexpr StrictNumeric(const StrictNumeric<Src>& rhs) : value_(strict_cast<T>(rhs.value_)) {} template <typename Src> constexpr StrictNumeric(Src value) : value_(strict_cast<T>(value)) {} template <typename Dst, typename std::enable_if< IsNumericRangeContained<Dst, T>::value>::type* = nullptr> constexpr operator Dst() const { return static_cast<typename ArithmeticOrUnderlyingEnum<Dst>::type>(value_); } private: const T value_; }; template <typename T> constexpr StrictNumeric<typename UnderlyingType<T>::type> MakeStrictNum( const T value) { return value; } template <typename T> std::ostream& operator<<(std::ostream& os, const StrictNumeric<T>& value) { os << static_cast<T>(value); return os; } template <typename L, typename R, typename std::enable_if< internal::IsStrictOp<L, R>::value>::type* = nullptr> constexpr bool operator <(const L lhs, const R rhs) { return SafeCompare<IsLess, typename UnderlyingType<L>::type, typename UnderlyingType<R>::type>(lhs, rhs); } template <typename L, typename R, typename std::enable_if< internal::IsStrictOp<L, R>::value>::type* = nullptr> constexpr bool operator <=(const L lhs, const R rhs) { return SafeCompare<IsLessOrEqual, typename UnderlyingType<L>::type, typename UnderlyingType<R>::type>(lhs, rhs); } template <typename L, typename R, typename std::enable_if< internal::IsStrictOp<L, R>::value>::type* = nullptr> constexpr bool operator >(const L lhs, const R rhs) { return SafeCompare<IsGreater, typename UnderlyingType<L>::type, typename UnderlyingType<R>::type>(lhs, rhs); } template <typename L, typename R, typename std::enable_if< internal::IsStrictOp<L, R>::value>::type* = nullptr> constexpr bool operator >=(const L lhs, const R rhs) { return SafeCompare<IsGreaterOrEqual, typename UnderlyingType<L>::type, typename UnderlyingType<R>::type>(lhs, rhs); } template <typename L, typename R, typename std::enable_if< internal::IsStrictOp<L, R>::value>::type* = nullptr> constexpr bool operator ==(const L lhs, const R rhs) { return SafeCompare<IsEqual, typename UnderlyingType<L>::type, typename UnderlyingType<R>::type>(lhs, rhs); } template <typename L, typename R, typename std::enable_if< internal::IsStrictOp<L, R>::value>::type* = nullptr> constexpr bool operator !=(const L lhs, const R rhs) { return SafeCompare<IsNotEqual, typename UnderlyingType<L>::type, typename UnderlyingType<R>::type>(lhs, rhs); } } using internal::as_signed; using internal::as_unsigned; using internal::checked_cast; using internal::strict_cast; using internal::saturated_cast; using internal::SafeUnsignedAbs; using internal::StrictNumeric; using internal::MakeStrictNum; using internal::IsValueInRangeForNumericType; using internal::IsTypeInRangeForNumericType; using internal::IsValueNegative; using SizeT = StrictNumeric<size_t>; } #pragma pack(push, 8) extern "C" { } #pragma pack(pop) #pragma pack(push, 8) extern "C" { } #pragma pack(pop) namespace base { namespace internal { template <typename T, typename U> struct CheckedMulFastAsmOp { static const bool is_supported = false; template <typename V> static constexpr bool Do(T, U, V*) { return CheckOnFailure::template HandleFailure<bool>(); } }; template <typename T, typename U> struct ClampedAddFastAsmOp { static const bool is_supported = false; template <typename V> static constexpr V Do(T, U) { return CheckOnFailure::template HandleFailure<V>(); } }; template <typename T, typename U> struct ClampedSubFastAsmOp { static const bool is_supported = false; template <typename V> static constexpr V Do(T, U) { return CheckOnFailure::template HandleFailure<V>(); } }; template <typename T, typename U> struct ClampedMulFastAsmOp { static const bool is_supported = false; template <typename V> static constexpr V Do(T, U) { return CheckOnFailure::template HandleFailure<V>(); } }; template <typename T, typename U> struct CheckedAddFastOp { static const bool is_supported = true; template <typename V> __attribute__((always_inline)) static constexpr bool Do(T x, U y, V* result) { return !__builtin_add_overflow(x, y, result); } }; template <typename T, typename U> struct CheckedSubFastOp { static const bool is_supported = true; template <typename V> __attribute__((always_inline)) static constexpr bool Do(T x, U y, V* result) { return !__builtin_sub_overflow(x, y, result); } }; template <typename T, typename U> struct CheckedMulFastOp { static const bool is_supported = (IsTypeInRangeForNumericType<intptr_t, T>::value && IsTypeInRangeForNumericType<intptr_t, U>::value) || (IsTypeInRangeForNumericType<uintptr_t, T>::value && IsTypeInRangeForNumericType<uintptr_t, U>::value); template <typename V> __attribute__((always_inline)) static constexpr bool Do(T x, U y, V* result) { return CheckedMulFastAsmOp<T, U>::is_supported ? CheckedMulFastAsmOp<T, U>::Do(x, y, result) : !__builtin_mul_overflow(x, y, result); } }; template <typename T, typename U> struct ClampedAddFastOp { static const bool is_supported = ClampedAddFastAsmOp<T, U>::is_supported; template <typename V> __attribute__((always_inline)) static V Do(T x, U y) { return ClampedAddFastAsmOp<T, U>::template Do<V>(x, y); } }; template <typename T, typename U> struct ClampedSubFastOp { static const bool is_supported = ClampedSubFastAsmOp<T, U>::is_supported; template <typename V> __attribute__((always_inline)) static V Do(T x, U y) { return ClampedSubFastAsmOp<T, U>::template Do<V>(x, y); } }; template <typename T, typename U> struct ClampedMulFastOp { static const bool is_supported = ClampedMulFastAsmOp<T, U>::is_supported; template <typename V> __attribute__((always_inline)) static V Do(T x, U y) { return ClampedMulFastAsmOp<T, U>::template Do<V>(x, y); } }; template <typename T> struct ClampedNegFastOp { static const bool is_supported = std::is_signed<T>::value; __attribute__((always_inline)) static T Do(T value) { if (!ClampedSubFastAsmOp<T, T>::is_supported) { T result; return !__builtin_sub_overflow(T(0), value, &result) ? result : std::numeric_limits<T>::max(); } return ClampedSubFastOp<T, T>::template Do<T>(T(0), value); } }; } } namespace base { namespace internal { template <typename Numeric, bool IsInteger = std::is_integral<Numeric>::value, bool IsFloat = std::is_floating_point<Numeric>::value> struct UnsignedOrFloatForSize; template <typename Numeric> struct UnsignedOrFloatForSize<Numeric, true, false> { using type = typename std::make_unsigned<Numeric>::type; }; template <typename Numeric> struct UnsignedOrFloatForSize<Numeric, false, true> { using type = Numeric; }; template <typename T, typename std::enable_if<std::is_integral<T>::value>::type* = nullptr> constexpr T NegateWrapper(T value) { using UnsignedT = typename std::make_unsigned<T>::type; return static_cast<T>(UnsignedT(0) - static_cast<UnsignedT>(value)); } template < typename T, typename std::enable_if<std::is_floating_point<T>::value>::type* = nullptr> constexpr T NegateWrapper(T value) { return -value; } template <typename T, typename std::enable_if<std::is_integral<T>::value>::type* = nullptr> constexpr typename std::make_unsigned<T>::type InvertWrapper(T value) { return ~value; } template <typename T, typename std::enable_if<std::is_integral<T>::value>::type* = nullptr> constexpr T AbsWrapper(T value) { return static_cast<T>(SafeUnsignedAbs(value)); } template < typename T, typename std::enable_if<std::is_floating_point<T>::value>::type* = nullptr> constexpr T AbsWrapper(T value) { return value < 0 ? -value : value; } template <template <typename, typename, typename> class M, typename L, typename R> struct MathWrapper { using math = M<typename UnderlyingType<L>::type, typename UnderlyingType<R>::type, void>; using type = typename math::result_type; }; template <template <typename, typename, typename> class M, typename L, typename R, typename... Args> struct ResultType; template <template <typename, typename, typename> class M, typename L, typename R> struct ResultType<M, L, R> { using type = typename MathWrapper<M, L, R>::type; }; template <template <typename, typename, typename> class M, typename L, typename R, typename... Args> struct ResultType { using type = typename ResultType<M, typename ResultType<M, L, R>::type, Args...>::type; }; } } namespace base { namespace internal { template <typename T> constexpr bool CheckedAddImpl(T x, T y, T* result) { static_assert(std::is_integral<T>::value, "Type must be integral"); using UnsignedDst = typename std::make_unsigned<T>::type; using SignedDst = typename std::make_signed<T>::type; UnsignedDst ux = static_cast<UnsignedDst>(x); UnsignedDst uy = static_cast<UnsignedDst>(y); UnsignedDst uresult = static_cast<UnsignedDst>(ux + uy); *result = static_cast<T>(uresult); return (std::is_signed<T>::value) ? static_cast<SignedDst>((uresult ^ ux) & (uresult ^ uy)) >= 0 : uresult >= uy; } template <typename T, typename U, class Enable = void> struct CheckedAddOp {}; template <typename T, typename U> struct CheckedAddOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type> { using result_type = typename MaxExponentPromotion<T, U>::type; template <typename V> static constexpr bool Do(T x, U y, V* result) { if (CheckedAddFastOp<T, U>::is_supported) return CheckedAddFastOp<T, U>::Do(x, y, result); using FastPromotion = typename FastIntegerArithmeticPromotion<T, U>::type; using Promotion = typename std::conditional<(IntegerBitsPlusSign<FastPromotion>::value > IntegerBitsPlusSign<intptr_t>::value), typename BigEnoughPromotion<T, U>::type, FastPromotion>::type; if (__builtin_expect(!!(!IsValueInRangeForNumericType<Promotion>(x) || !IsValueInRangeForNumericType<Promotion>(y)), 0)) { return false; } Promotion presult = {}; bool is_valid = true; if (IsIntegerArithmeticSafe<Promotion, T, U>::value) { presult = static_cast<Promotion>(x) + static_cast<Promotion>(y); } else { is_valid = CheckedAddImpl(static_cast<Promotion>(x), static_cast<Promotion>(y), &presult); } *result = static_cast<V>(presult); return is_valid && IsValueInRangeForNumericType<V>(presult); } }; template <typename T> constexpr bool CheckedSubImpl(T x, T y, T* result) { static_assert(std::is_integral<T>::value, "Type must be integral"); using UnsignedDst = typename std::make_unsigned<T>::type; using SignedDst = typename std::make_signed<T>::type; UnsignedDst ux = static_cast<UnsignedDst>(x); UnsignedDst uy = static_cast<UnsignedDst>(y); UnsignedDst uresult = static_cast<UnsignedDst>(ux - uy); *result = static_cast<T>(uresult); return (std::is_signed<T>::value) ? static_cast<SignedDst>((uresult ^ ux) & (ux ^ uy)) >= 0 : x >= y; } template <typename T, typename U, class Enable = void> struct CheckedSubOp {}; template <typename T, typename U> struct CheckedSubOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type> { using result_type = typename MaxExponentPromotion<T, U>::type; template <typename V> static constexpr bool Do(T x, U y, V* result) { if (CheckedSubFastOp<T, U>::is_supported) return CheckedSubFastOp<T, U>::Do(x, y, result); using FastPromotion = typename FastIntegerArithmeticPromotion<T, U>::type; using Promotion = typename std::conditional<(IntegerBitsPlusSign<FastPromotion>::value > IntegerBitsPlusSign<intptr_t>::value), typename BigEnoughPromotion<T, U>::type, FastPromotion>::type; if (__builtin_expect(!!(!IsValueInRangeForNumericType<Promotion>(x) || !IsValueInRangeForNumericType<Promotion>(y)), 0)) { return false; } Promotion presult = {}; bool is_valid = true; if (IsIntegerArithmeticSafe<Promotion, T, U>::value) { presult = static_cast<Promotion>(x) - static_cast<Promotion>(y); } else { is_valid = CheckedSubImpl(static_cast<Promotion>(x), static_cast<Promotion>(y), &presult); } *result = static_cast<V>(presult); return is_valid && IsValueInRangeForNumericType<V>(presult); } }; template <typename T> constexpr bool CheckedMulImpl(T x, T y, T* result) { static_assert(std::is_integral<T>::value, "Type must be integral"); using UnsignedDst = typename std::make_unsigned<T>::type; using SignedDst = typename std::make_signed<T>::type; const UnsignedDst ux = SafeUnsignedAbs(x); const UnsignedDst uy = SafeUnsignedAbs(y); UnsignedDst uresult = static_cast<UnsignedDst>(ux * uy); const bool is_negative = std::is_signed<T>::value && static_cast<SignedDst>(x ^ y) < 0; *result = is_negative ? 0 - uresult : uresult; return uy <= UnsignedDst(!std::is_signed<T>::value || is_negative) || ux <= (std::numeric_limits<T>::max() + UnsignedDst(is_negative)) / uy; } template <typename T, typename U, class Enable = void> struct CheckedMulOp {}; template <typename T, typename U> struct CheckedMulOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type> { using result_type = typename MaxExponentPromotion<T, U>::type; template <typename V> static constexpr bool Do(T x, U y, V* result) { if (CheckedMulFastOp<T, U>::is_supported) return CheckedMulFastOp<T, U>::Do(x, y, result); using Promotion = typename FastIntegerArithmeticPromotion<T, U>::type; if (__builtin_expect(!!((!IsValueInRangeForNumericType<Promotion>(x) || !IsValueInRangeForNumericType<Promotion>(y)) && x && y), 0)) { return false; } Promotion presult = {}; bool is_valid = true; if (CheckedMulFastOp<Promotion, Promotion>::is_supported) { is_valid = CheckedMulFastOp<Promotion, Promotion>::Do(x, y, &presult); } else if (IsIntegerArithmeticSafe<Promotion, T, U>::value) { presult = static_cast<Promotion>(x) * static_cast<Promotion>(y); } else { is_valid = CheckedMulImpl(static_cast<Promotion>(x), static_cast<Promotion>(y), &presult); } *result = static_cast<V>(presult); return is_valid && IsValueInRangeForNumericType<V>(presult); } }; template <typename T, typename U, class Enable = void> struct CheckedDivOp {}; template <typename T, typename U> struct CheckedDivOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type> { using result_type = typename MaxExponentPromotion<T, U>::type; template <typename V> static constexpr bool Do(T x, U y, V* result) { if (__builtin_expect(!!(!y), 0)) return false; using Promotion = typename BigEnoughPromotion<T, U>::type; if (__builtin_expect(!!((std::is_signed<T>::value && std::is_signed<U>::value && IsTypeInRangeForNumericType<T, Promotion>::value && static_cast<Promotion>(x) == std::numeric_limits<Promotion>::lowest() && y == static_cast<U>(-1))), 0)) { return false; } if (__builtin_expect(!!((!IsValueInRangeForNumericType<Promotion>(x) || !IsValueInRangeForNumericType<Promotion>(y)) && x), 0)) { return false; } Promotion presult = Promotion(x) / Promotion(y); *result = static_cast<V>(presult); return IsValueInRangeForNumericType<V>(presult); } }; template <typename T, typename U, class Enable = void> struct CheckedModOp {}; template <typename T, typename U> struct CheckedModOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type> { using result_type = typename MaxExponentPromotion<T, U>::type; template <typename V> static constexpr bool Do(T x, U y, V* result) { using Promotion = typename BigEnoughPromotion<T, U>::type; if (__builtin_expect(!!(y), 1)) { Promotion presult = static_cast<Promotion>(x) % static_cast<Promotion>(y); *result = static_cast<Promotion>(presult); return IsValueInRangeForNumericType<V>(presult); } return false; } }; template <typename T, typename U, class Enable = void> struct CheckedLshOp {}; template <typename T, typename U> struct CheckedLshOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type> { using result_type = T; template <typename V> static constexpr bool Do(T x, U shift, V* result) { if (__builtin_expect(!!(!IsValueNegative(x) && as_unsigned(shift) < as_unsigned(std::numeric_limits<T>::digits)), 1)) { *result = static_cast<V>(as_unsigned(x) << shift); return *result >> shift == x; } return std::is_signed<T>::value && !x && as_unsigned(shift) == as_unsigned(std::numeric_limits<T>::digits); } }; template <typename T, typename U, class Enable = void> struct CheckedRshOp {}; template <typename T, typename U> struct CheckedRshOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type> { using result_type = T; template <typename V> static bool Do(T x, U shift, V* result) { if (__builtin_expect(!!(as_unsigned(shift) < IntegerBitsPlusSign<T>::value), 1)) { T tmp = x >> shift; *result = static_cast<V>(tmp); return IsValueInRangeForNumericType<V>(tmp); } return false; } }; template <typename T, typename U, class Enable = void> struct CheckedAndOp {}; template <typename T, typename U> struct CheckedAndOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type> { using result_type = typename std::make_unsigned< typename MaxExponentPromotion<T, U>::type>::type; template <typename V> static constexpr bool Do(T x, U y, V* result) { result_type tmp = static_cast<result_type>(x) & static_cast<result_type>(y); *result = static_cast<V>(tmp); return IsValueInRangeForNumericType<V>(tmp); } }; template <typename T, typename U, class Enable = void> struct CheckedOrOp {}; template <typename T, typename U> struct CheckedOrOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type> { using result_type = typename std::make_unsigned< typename MaxExponentPromotion<T, U>::type>::type; template <typename V> static constexpr bool Do(T x, U y, V* result) { result_type tmp = static_cast<result_type>(x) | static_cast<result_type>(y); *result = static_cast<V>(tmp); return IsValueInRangeForNumericType<V>(tmp); } }; template <typename T, typename U, class Enable = void> struct CheckedXorOp {}; template <typename T, typename U> struct CheckedXorOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type> { using result_type = typename std::make_unsigned< typename MaxExponentPromotion<T, U>::type>::type; template <typename V> static constexpr bool Do(T x, U y, V* result) { result_type tmp = static_cast<result_type>(x) ^ static_cast<result_type>(y); *result = static_cast<V>(tmp); return IsValueInRangeForNumericType<V>(tmp); } }; template <typename T, typename U, class Enable = void> struct CheckedMaxOp {}; template <typename T, typename U> struct CheckedMaxOp< T, U, typename std::enable_if<std::is_arithmetic<T>::value && std::is_arithmetic<U>::value>::type> { using result_type = typename MaxExponentPromotion<T, U>::type; template <typename V> static constexpr bool Do(T x, U y, V* result) { result_type tmp = IsGreater<T, U>::Test(x, y) ? static_cast<result_type>(x) : static_cast<result_type>(y); *result = static_cast<V>(tmp); return IsValueInRangeForNumericType<V>(tmp); } }; template <typename T, typename U, class Enable = void> struct CheckedMinOp {}; template <typename T, typename U> struct CheckedMinOp< T, U, typename std::enable_if<std::is_arithmetic<T>::value && std::is_arithmetic<U>::value>::type> { using result_type = typename LowestValuePromotion<T, U>::type; template <typename V> static constexpr bool Do(T x, U y, V* result) { result_type tmp = IsLess<T, U>::Test(x, y) ? static_cast<result_type>(x) : static_cast<result_type>(y); *result = static_cast<V>(tmp); return IsValueInRangeForNumericType<V>(tmp); } }; template <typename T, typename U> struct CheckedAddOp< T, U, typename std::enable_if<std::is_floating_point<T>::value || std::is_floating_point<U>::value>::type> { using result_type = typename MaxExponentPromotion<T, U>::type; template <typename V> static constexpr bool Do(T x, U y, V* result) { using Promotion = typename MaxExponentPromotion<T, U>::type; Promotion presult = x + y; *result = static_cast<V>(presult); return IsValueInRangeForNumericType<V>(presult); } }; template <typename T, typename U> struct CheckedSubOp< T, U, typename std::enable_if<std::is_floating_point<T>::value || std::is_floating_point<U>::value>::type> { using result_type = typename MaxExponentPromotion<T, U>::type; template <typename V> static constexpr bool Do(T x, U y, V* result) { using Promotion = typename MaxExponentPromotion<T, U>::type; Promotion presult = x - y; *result = static_cast<V>(presult); return IsValueInRangeForNumericType<V>(presult); } }; template <typename T, typename U> struct CheckedMulOp< T, U, typename std::enable_if<std::is_floating_point<T>::value || std::is_floating_point<U>::value>::type> { using result_type = typename MaxExponentPromotion<T, U>::type; template <typename V> static constexpr bool Do(T x, U y, V* result) { using Promotion = typename MaxExponentPromotion<T, U>::type; Promotion presult = x * y; *result = static_cast<V>(presult); return IsValueInRangeForNumericType<V>(presult); } }; template <typename T, typename U> struct CheckedDivOp< T, U, typename std::enable_if<std::is_floating_point<T>::value || std::is_floating_point<U>::value>::type> { using result_type = typename MaxExponentPromotion<T, U>::type; template <typename V> static constexpr bool Do(T x, U y, V* result) { using Promotion = typename MaxExponentPromotion<T, U>::type; Promotion presult = x / y; *result = static_cast<V>(presult); return IsValueInRangeForNumericType<V>(presult); } }; enum NumericRepresentation { NUMERIC_INTEGER, NUMERIC_FLOATING, NUMERIC_UNKNOWN }; template <typename NumericType> struct GetNumericRepresentation { static const NumericRepresentation value = std::is_integral<NumericType>::value ? NUMERIC_INTEGER : (std::is_floating_point<NumericType>::value ? NUMERIC_FLOATING : NUMERIC_UNKNOWN); }; template <typename T, NumericRepresentation type = GetNumericRepresentation<T>::value> class CheckedNumericState {}; template <typename T> class CheckedNumericState<T, NUMERIC_INTEGER> { private: bool is_valid_; T value_; template <typename Src> static constexpr T WellDefinedConversionOrZero(const Src value, const bool is_valid) { using SrcType = typename internal::UnderlyingType<Src>::type; return (std::is_integral<SrcType>::value || is_valid) ? static_cast<T>(value) : static_cast<T>(0); } public: template <typename Src, NumericRepresentation type> friend class CheckedNumericState; constexpr CheckedNumericState() : is_valid_(true), value_(0) {} template <typename Src> constexpr CheckedNumericState(Src value, bool is_valid) : is_valid_(is_valid && IsValueInRangeForNumericType<T>(value)), value_(WellDefinedConversionOrZero(value, is_valid_)) { static_assert(std::is_arithmetic<Src>::value, "Argument must be numeric."); } template <typename Src> constexpr CheckedNumericState(const CheckedNumericState<Src>& rhs) : is_valid_(rhs.IsValid()), value_(WellDefinedConversionOrZero(rhs.value(), is_valid_)) {} template <typename Src> constexpr explicit CheckedNumericState(Src value) : is_valid_(IsValueInRangeForNumericType<T>(value)), value_(WellDefinedConversionOrZero(value, is_valid_)) {} constexpr bool is_valid() const { return is_valid_; } constexpr T value() const { return value_; } }; template <typename T> class CheckedNumericState<T, NUMERIC_FLOATING> { private: T value_; template <typename Src> static constexpr T WellDefinedConversionOrNaN(const Src value, const bool is_valid) { using SrcType = typename internal::UnderlyingType<Src>::type; return (StaticDstRangeRelationToSrcRange<T, SrcType>::value == NUMERIC_RANGE_CONTAINED || is_valid) ? static_cast<T>(value) : std::numeric_limits<T>::quiet_NaN(); } public: template <typename Src, NumericRepresentation type> friend class CheckedNumericState; constexpr CheckedNumericState() : value_(0.0) {} template <typename Src> constexpr CheckedNumericState(Src value, bool is_valid) : value_(WellDefinedConversionOrNaN(value, is_valid)) {} template <typename Src> constexpr explicit CheckedNumericState(Src value) : value_(WellDefinedConversionOrNaN( value, IsValueInRangeForNumericType<T>(value))) {} template <typename Src> constexpr CheckedNumericState(const CheckedNumericState<Src>& rhs) : value_(WellDefinedConversionOrNaN( rhs.value(), rhs.is_valid() && IsValueInRangeForNumericType<T>(rhs.value()))) {} constexpr bool is_valid() const { return MustTreatAsConstexpr(value_) ? value_ <= std::numeric_limits<T>::max() && value_ >= std::numeric_limits<T>::lowest() : std::isfinite(value_); } constexpr T value() const { return value_; } }; } } namespace base { namespace internal { template <typename T> class CheckedNumeric { static_assert(std::is_arithmetic<T>::value, "CheckedNumeric<T>: T must be a numeric type."); public: using type = T; constexpr CheckedNumeric() = default; template <typename Src> constexpr CheckedNumeric(const CheckedNumeric<Src>& rhs) : state_(rhs.state_.value(), rhs.IsValid()) {} template <typename Src> friend class CheckedNumeric; template <typename Src> constexpr CheckedNumeric(Src value) : state_(value) { static_assert(std::is_arithmetic<Src>::value, "Argument must be numeric."); } template <typename Src> constexpr CheckedNumeric( StrictNumeric<Src> value) : state_(static_cast<Src>(value)) {} template <typename Dst = T> constexpr bool IsValid() const { return state_.is_valid() && IsValueInRangeForNumericType<Dst>(state_.value()); } template <typename Dst> __attribute__((warn_unused_result)) constexpr bool AssignIfValid(Dst* result) const { return __builtin_expect(!!(IsValid<Dst>()), 1) ? ((*result = static_cast<Dst>(state_.value())), true) : false; } template <typename Dst = T, class CheckHandler = CheckOnFailure> constexpr StrictNumeric<Dst> ValueOrDie() const { return __builtin_expect(!!(IsValid<Dst>()), 1) ? static_cast<Dst>(state_.value()) : CheckHandler::template HandleFailure<Dst>(); } template <typename Dst = T, typename Src> constexpr StrictNumeric<Dst> ValueOrDefault(const Src default_value) const { return __builtin_expect(!!(IsValid<Dst>()), 1) ? static_cast<Dst>(state_.value()) : checked_cast<Dst>(default_value); } template <typename Dst> constexpr CheckedNumeric<typename UnderlyingType<Dst>::type> Cast() const { return *this; } template <typename U> friend U GetNumericValueForTest(const CheckedNumeric<U>& src); template <typename Src> constexpr CheckedNumeric& operator+=(const Src rhs); template <typename Src> constexpr CheckedNumeric& operator-=(const Src rhs); template <typename Src> constexpr CheckedNumeric& operator*=(const Src rhs); template <typename Src> constexpr CheckedNumeric& operator/=(const Src rhs); template <typename Src> constexpr CheckedNumeric& operator%=(const Src rhs); template <typename Src> constexpr CheckedNumeric& operator<<=(const Src rhs); template <typename Src> constexpr CheckedNumeric& operator>>=(const Src rhs); template <typename Src> constexpr CheckedNumeric& operator&=(const Src rhs); template <typename Src> constexpr CheckedNumeric& operator|=(const Src rhs); template <typename Src> constexpr CheckedNumeric& operator^=(const Src rhs); constexpr CheckedNumeric operator-() const { return MustTreatAsConstexpr(state_.value()) || !std::is_signed<T>::value || std::is_floating_point<T>::value ? CheckedNumeric<T>( NegateWrapper(state_.value()), IsValid() && (!std::is_signed<T>::value || std::is_floating_point<T>::value || NegateWrapper(state_.value()) != std::numeric_limits<T>::lowest())) : FastRuntimeNegate(); } constexpr CheckedNumeric operator~() const { return CheckedNumeric<decltype(InvertWrapper(T()))>( InvertWrapper(state_.value()), IsValid()); } constexpr CheckedNumeric Abs() const { return !IsValueNegative(state_.value()) ? *this : -*this; } template <typename U> constexpr CheckedNumeric<typename MathWrapper<CheckedMaxOp, T, U>::type> Max( const U rhs) const { using R = typename UnderlyingType<U>::type; using result_type = typename MathWrapper<CheckedMaxOp, T, U>::type; return CheckedNumeric<result_type>( static_cast<result_type>( IsGreater<T, R>::Test(state_.value(), Wrapper<U>::value(rhs)) ? state_.value() : Wrapper<U>::value(rhs)), state_.is_valid() && Wrapper<U>::is_valid(rhs)); } template <typename U> constexpr CheckedNumeric<typename MathWrapper<CheckedMinOp, T, U>::type> Min( const U rhs) const { using R = typename UnderlyingType<U>::type; using result_type = typename MathWrapper<CheckedMinOp, T, U>::type; return CheckedNumeric<result_type>( static_cast<result_type>( IsLess<T, R>::Test(state_.value(), Wrapper<U>::value(rhs)) ? state_.value() : Wrapper<U>::value(rhs)), state_.is_valid() && Wrapper<U>::is_valid(rhs)); } constexpr CheckedNumeric<typename UnsignedOrFloatForSize<T>::type> UnsignedAbs() const { return CheckedNumeric<typename UnsignedOrFloatForSize<T>::type>( SafeUnsignedAbs(state_.value()), state_.is_valid()); } constexpr CheckedNumeric& operator++() { *this += 1; return *this; } constexpr CheckedNumeric operator++(int) { CheckedNumeric value = *this; *this += 1; return value; } constexpr CheckedNumeric& operator--() { *this -= 1; return *this; } constexpr CheckedNumeric operator--(int) { CheckedNumeric value = *this; *this -= 1; return value; } template <template <typename, typename, typename> class M, typename L, typename R> static constexpr CheckedNumeric MathOp(const L lhs, const R rhs) { using Math = typename MathWrapper<M, L, R>::math; T result = 0; bool is_valid = Wrapper<L>::is_valid(lhs) && Wrapper<R>::is_valid(rhs) && Math::Do(Wrapper<L>::value(lhs), Wrapper<R>::value(rhs), &result); return CheckedNumeric<T>(result, is_valid); } template <template <typename, typename, typename> class M, typename R> constexpr CheckedNumeric& MathOp(const R rhs) { using Math = typename MathWrapper<M, T, R>::math; T result = 0; bool is_valid = state_.is_valid() && Wrapper<R>::is_valid(rhs) && Math::Do(state_.value(), Wrapper<R>::value(rhs), &result); *this = CheckedNumeric<T>(result, is_valid); return *this; } private: CheckedNumericState<T> state_; CheckedNumeric FastRuntimeNegate() const { T result; bool success = CheckedSubOp<T, T>::Do(T(0), state_.value(), &result); return CheckedNumeric<T>(result, IsValid() && success); } template <typename Src> constexpr CheckedNumeric(Src value, bool is_valid) : state_(value, is_valid) {} template <typename Src> struct Wrapper { static constexpr bool is_valid(Src) { return true; } static constexpr Src value(Src value) { return value; } }; template <typename Src> struct Wrapper<CheckedNumeric<Src>> { static constexpr bool is_valid(const CheckedNumeric<Src> v) { return v.IsValid(); } static constexpr Src value(const CheckedNumeric<Src> v) { return v.state_.value(); } }; template <typename Src> struct Wrapper<StrictNumeric<Src>> { static constexpr bool is_valid(const StrictNumeric<Src>) { return true; } static constexpr Src value(const StrictNumeric<Src> v) { return static_cast<Src>(v); } }; }; template <typename Dst, typename Src> constexpr bool IsValidForType(const CheckedNumeric<Src> value) { return value.template IsValid<Dst>(); } template <typename Dst, typename Src> constexpr StrictNumeric<Dst> ValueOrDieForType( const CheckedNumeric<Src> value) { return value.template ValueOrDie<Dst>(); } template <typename Dst, typename Src, typename Default> constexpr StrictNumeric<Dst> ValueOrDefaultForType( const CheckedNumeric<Src> value, const Default default_value) { return value.template ValueOrDefault<Dst>(default_value); } template <typename T> constexpr CheckedNumeric<typename UnderlyingType<T>::type> MakeCheckedNum( const T value) { return value; } template <template <typename, typename, typename> class M, typename L, typename R> constexpr CheckedNumeric<typename MathWrapper<M, L, R>::type> CheckMathOp( const L lhs, const R rhs) { using Math = typename MathWrapper<M, L, R>::math; return CheckedNumeric<typename Math::result_type>::template MathOp<M>(lhs, rhs); } template <template <typename, typename, typename> class M, typename L, typename R, typename... Args> constexpr CheckedNumeric<typename ResultType<M, L, R, Args...>::type> CheckMathOp(const L lhs, const R rhs, const Args... args) { return CheckMathOp<M>(CheckMathOp<M>(lhs, rhs), args...); } template <typename L, typename R, typename std::enable_if<IsCheckedOp<L, R>::value>::type* = nullptr> constexpr CheckedNumeric< typename MathWrapper<CheckedAddOp, L, R>::type> operator +(const L lhs, const R rhs) { return decltype(lhs + rhs)::template MathOp<CheckedAddOp>(lhs, rhs); } template <typename L> template <typename R> constexpr CheckedNumeric<L>& CheckedNumeric<L>::operator +=( const R rhs) { return MathOp<CheckedAddOp>(rhs); } template <typename L, typename R, typename... Args> constexpr CheckedNumeric< typename ResultType<CheckedAddOp, L, R, Args...>::type> CheckAdd(const L lhs, const R rhs, const Args... args) { return CheckMathOp<CheckedAddOp, L, R, Args...>(lhs, rhs, args...); } template <typename L, typename R, typename std::enable_if<IsCheckedOp<L, R>::value>::type* = nullptr> constexpr CheckedNumeric< typename MathWrapper<CheckedSubOp, L, R>::type> operator -(const L lhs, const R rhs) { return decltype(lhs - rhs)::template MathOp<CheckedSubOp>(lhs, rhs); } template <typename L> template <typename R> constexpr CheckedNumeric<L>& CheckedNumeric<L>::operator -=( const R rhs) { return MathOp<CheckedSubOp>(rhs); } template <typename L, typename R, typename... Args> constexpr CheckedNumeric< typename ResultType<CheckedSubOp, L, R, Args...>::type> CheckSub(const L lhs, const R rhs, const Args... args) { return CheckMathOp<CheckedSubOp, L, R, Args...>(lhs, rhs, args...); } template <typename L, typename R, typename std::enable_if<IsCheckedOp<L, R>::value>::type* = nullptr> constexpr CheckedNumeric< typename MathWrapper<CheckedMulOp, L, R>::type> operator *(const L lhs, const R rhs) { return decltype(lhs * rhs)::template MathOp<CheckedMulOp>(lhs, rhs); } template <typename L> template <typename R> constexpr CheckedNumeric<L>& CheckedNumeric<L>::operator *=( const R rhs) { return MathOp<CheckedMulOp>(rhs); } template <typename L, typename R, typename... Args> constexpr CheckedNumeric< typename ResultType<CheckedMulOp, L, R, Args...>::type> CheckMul(const L lhs, const R rhs, const Args... args) { return CheckMathOp<CheckedMulOp, L, R, Args...>(lhs, rhs, args...); } template <typename L, typename R, typename std::enable_if<IsCheckedOp<L, R>::value>::type* = nullptr> constexpr CheckedNumeric< typename MathWrapper<CheckedDivOp, L, R>::type> operator /(const L lhs, const R rhs) { return decltype(lhs / rhs)::template MathOp<CheckedDivOp>(lhs, rhs); } template <typename L> template <typename R> constexpr CheckedNumeric<L>& CheckedNumeric<L>::operator /=( const R rhs) { return MathOp<CheckedDivOp>(rhs); } template <typename L, typename R, typename... Args> constexpr CheckedNumeric< typename ResultType<CheckedDivOp, L, R, Args...>::type> CheckDiv(const L lhs, const R rhs, const Args... args) { return CheckMathOp<CheckedDivOp, L, R, Args...>(lhs, rhs, args...); } template <typename L, typename R, typename std::enable_if<IsCheckedOp<L, R>::value>::type* = nullptr> constexpr CheckedNumeric< typename MathWrapper<CheckedModOp, L, R>::type> operator %(const L lhs, const R rhs) { return decltype(lhs % rhs)::template MathOp<CheckedModOp>(lhs, rhs); } template <typename L> template <typename R> constexpr CheckedNumeric<L>& CheckedNumeric<L>::operator %=( const R rhs) { return MathOp<CheckedModOp>(rhs); } template <typename L, typename R, typename... Args> constexpr CheckedNumeric< typename ResultType<CheckedModOp, L, R, Args...>::type> CheckMod(const L lhs, const R rhs, const Args... args) { return CheckMathOp<CheckedModOp, L, R, Args...>(lhs, rhs, args...); } template <typename L, typename R, typename std::enable_if<IsCheckedOp<L, R>::value>::type* = nullptr> constexpr CheckedNumeric< typename MathWrapper<CheckedLshOp, L, R>::type> operator <<(const L lhs, const R rhs) { return decltype(lhs << rhs)::template MathOp<CheckedLshOp>(lhs, rhs); } template <typename L> template <typename R> constexpr CheckedNumeric<L>& CheckedNumeric<L>::operator <<=( const R rhs) { return MathOp<CheckedLshOp>(rhs); } template <typename L, typename R, typename... Args> constexpr CheckedNumeric< typename ResultType<CheckedLshOp, L, R, Args...>::type> CheckLsh(const L lhs, const R rhs, const Args... args) { return CheckMathOp<CheckedLshOp, L, R, Args...>(lhs, rhs, args...); } template <typename L, typename R, typename std::enable_if<IsCheckedOp<L, R>::value>::type* = nullptr> constexpr CheckedNumeric< typename MathWrapper<CheckedRshOp, L, R>::type> operator >>(const L lhs, const R rhs) { return decltype(lhs >> rhs)::template MathOp<CheckedRshOp>(lhs, rhs); } template <typename L> template <typename R> constexpr CheckedNumeric<L>& CheckedNumeric<L>::operator >>=( const R rhs) { return MathOp<CheckedRshOp>(rhs); } template <typename L, typename R, typename... Args> constexpr CheckedNumeric< typename ResultType<CheckedRshOp, L, R, Args...>::type> CheckRsh(const L lhs, const R rhs, const Args... args) { return CheckMathOp<CheckedRshOp, L, R, Args...>(lhs, rhs, args...); } template <typename L, typename R, typename std::enable_if<IsCheckedOp<L, R>::value>::type* = nullptr> constexpr CheckedNumeric< typename MathWrapper<CheckedAndOp, L, R>::type> operator &(const L lhs, const R rhs) { return decltype(lhs & rhs)::template MathOp<CheckedAndOp>(lhs, rhs); } template <typename L> template <typename R> constexpr CheckedNumeric<L>& CheckedNumeric<L>::operator &=( const R rhs) { return MathOp<CheckedAndOp>(rhs); } template <typename L, typename R, typename... Args> constexpr CheckedNumeric< typename ResultType<CheckedAndOp, L, R, Args...>::type> CheckAnd(const L lhs, const R rhs, const Args... args) { return CheckMathOp<CheckedAndOp, L, R, Args...>(lhs, rhs, args...); } template <typename L, typename R, typename std::enable_if<IsCheckedOp<L, R>::value>::type* = nullptr> constexpr CheckedNumeric< typename MathWrapper<CheckedOrOp, L, R>::type> operator |(const L lhs, const R rhs) { return decltype(lhs | rhs)::template MathOp<CheckedOrOp>(lhs, rhs); } template <typename L> template <typename R> constexpr CheckedNumeric<L>& CheckedNumeric<L>::operator |=( const R rhs) { return MathOp<CheckedOrOp>(rhs); } template <typename L, typename R, typename... Args> constexpr CheckedNumeric< typename ResultType<CheckedOrOp, L, R, Args...>::type> CheckOr(const L lhs, const R rhs, const Args... args) { return CheckMathOp<CheckedOrOp, L, R, Args...>(lhs, rhs, args...); } template <typename L, typename R, typename std::enable_if<IsCheckedOp<L, R>::value>::type* = nullptr> constexpr CheckedNumeric< typename MathWrapper<CheckedXorOp, L, R>::type> operator ^(const L lhs, const R rhs) { return decltype(lhs ^ rhs)::template MathOp<CheckedXorOp>(lhs, rhs); } template <typename L> template <typename R> constexpr CheckedNumeric<L>& CheckedNumeric<L>::operator ^=( const R rhs) { return MathOp<CheckedXorOp>(rhs); } template <typename L, typename R, typename... Args> constexpr CheckedNumeric< typename ResultType<CheckedXorOp, L, R, Args...>::type> CheckXor(const L lhs, const R rhs, const Args... args) { return CheckMathOp<CheckedXorOp, L, R, Args...>(lhs, rhs, args...); } template <typename L, typename R, typename... Args> constexpr CheckedNumeric< typename ResultType<CheckedMaxOp, L, R, Args...>::type> CheckMax(const L lhs, const R rhs, const Args... args) { return CheckMathOp<CheckedMaxOp, L, R, Args...>(lhs, rhs, args...); } template <typename L, typename R, typename... Args> constexpr CheckedNumeric< typename ResultType<CheckedMinOp, L, R, Args...>::type> CheckMin(const L lhs, const R rhs, const Args... args) { return CheckMathOp<CheckedMinOp, L, R, Args...>(lhs, rhs, args...); } template <typename L, typename R> L* operator+(L* lhs, const StrictNumeric<R> rhs) { uintptr_t result = CheckAdd(reinterpret_cast<uintptr_t>(lhs), CheckMul(sizeof(L), static_cast<R>(rhs))) .template ValueOrDie<uintptr_t>(); return reinterpret_cast<L*>(result); } template <typename L, typename R> L* operator-(L* lhs, const StrictNumeric<R> rhs) { uintptr_t result = CheckSub(reinterpret_cast<uintptr_t>(lhs), CheckMul(sizeof(L), static_cast<R>(rhs))) .template ValueOrDie<uintptr_t>(); return reinterpret_cast<L*>(result); } } using internal::CheckedNumeric; using internal::IsValidForType; using internal::ValueOrDieForType; using internal::ValueOrDefaultForType; using internal::MakeCheckedNum; using internal::CheckMax; using internal::CheckMin; using internal::CheckAdd; using internal::CheckSub; using internal::CheckMul; using internal::CheckDiv; using internal::CheckMod; using internal::CheckLsh; using internal::CheckRsh; using internal::CheckAnd; using internal::CheckOr; using internal::CheckXor; } namespace base { namespace internal { template <typename T, typename std::enable_if<std::is_integral<T>::value && std::is_signed<T>::value>::type* = nullptr> constexpr T SaturatedNegWrapper(T value) { return MustTreatAsConstexpr(value) || !ClampedNegFastOp<T>::is_supported ? (NegateWrapper(value) != std::numeric_limits<T>::lowest() ? NegateWrapper(value) : std::numeric_limits<T>::max()) : ClampedNegFastOp<T>::Do(value); } template <typename T, typename std::enable_if<std::is_integral<T>::value && !std::is_signed<T>::value>::type* = nullptr> constexpr T SaturatedNegWrapper(T value) { return T(0); } template < typename T, typename std::enable_if<std::is_floating_point<T>::value>::type* = nullptr> constexpr T SaturatedNegWrapper(T value) { return -value; } template <typename T, typename std::enable_if<std::is_integral<T>::value>::type* = nullptr> constexpr T SaturatedAbsWrapper(T value) { return static_cast<T>(SafeUnsignedAbs(value) - IsValueNegative<T>(SafeUnsignedAbs(value))); } template < typename T, typename std::enable_if<std::is_floating_point<T>::value>::type* = nullptr> constexpr T SaturatedAbsWrapper(T value) { return value < 0 ? -value : value; } template <typename T, typename U, class Enable = void> struct ClampedAddOp {}; template <typename T, typename U> struct ClampedAddOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type> { using result_type = typename MaxExponentPromotion<T, U>::type; template <typename V = result_type> static constexpr V Do(T x, U y) { if (ClampedAddFastOp<T, U>::is_supported) return ClampedAddFastOp<T, U>::template Do<V>(x, y); static_assert(std::is_same<V, result_type>::value || IsTypeInRangeForNumericType<U, V>::value, "The saturation result cannot be determined from the " "provided types."); const V saturated = CommonMaxOrMin<V>(IsValueNegative(y)); V result = {}; return __builtin_expect(!!((CheckedAddOp<T, U>::Do(x, y, &result))), 1) ? result : saturated; } }; template <typename T, typename U, class Enable = void> struct ClampedSubOp {}; template <typename T, typename U> struct ClampedSubOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type> { using result_type = typename MaxExponentPromotion<T, U>::type; template <typename V = result_type> static constexpr V Do(T x, U y) { if (ClampedSubFastOp<T, U>::is_supported) return ClampedSubFastOp<T, U>::template Do<V>(x, y); static_assert(std::is_same<V, result_type>::value || IsTypeInRangeForNumericType<U, V>::value, "The saturation result cannot be determined from the " "provided types."); const V saturated = CommonMaxOrMin<V>(!IsValueNegative(y)); V result = {}; return __builtin_expect(!!((CheckedSubOp<T, U>::Do(x, y, &result))), 1) ? result : saturated; } }; template <typename T, typename U, class Enable = void> struct ClampedMulOp {}; template <typename T, typename U> struct ClampedMulOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type> { using result_type = typename MaxExponentPromotion<T, U>::type; template <typename V = result_type> static constexpr V Do(T x, U y) { if (ClampedMulFastOp<T, U>::is_supported) return ClampedMulFastOp<T, U>::template Do<V>(x, y); V result = {}; const V saturated = CommonMaxOrMin<V>(IsValueNegative(x) ^ IsValueNegative(y)); return __builtin_expect(!!((CheckedMulOp<T, U>::Do(x, y, &result))), 1) ? result : saturated; } }; template <typename T, typename U, class Enable = void> struct ClampedDivOp {}; template <typename T, typename U> struct ClampedDivOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type> { using result_type = typename MaxExponentPromotion<T, U>::type; template <typename V = result_type> static constexpr V Do(T x, U y) { V result = {}; if (__builtin_expect(!!((CheckedDivOp<T, U>::Do(x, y, &result))), 1)) return result; return x ? CommonMaxOrMin<V>(IsValueNegative(x) ^ IsValueNegative(y)) : SaturationDefaultLimits<V>::NaN(); } }; template <typename T, typename U, class Enable = void> struct ClampedModOp {}; template <typename T, typename U> struct ClampedModOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type> { using result_type = typename MaxExponentPromotion<T, U>::type; template <typename V = result_type> static constexpr V Do(T x, U y) { V result = {}; return __builtin_expect(!!((CheckedModOp<T, U>::Do(x, y, &result))), 1) ? result : x; } }; template <typename T, typename U, class Enable = void> struct ClampedLshOp {}; template <typename T, typename U> struct ClampedLshOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type> { using result_type = T; template <typename V = result_type> static constexpr V Do(T x, U shift) { static_assert(!std::is_signed<U>::value, "Shift value must be unsigned."); if (__builtin_expect(!!(shift < std::numeric_limits<T>::digits), 1)) { V result = static_cast<V>(as_unsigned(x) << shift); if (__builtin_expect(!!(result >> shift == x), 1)) return result; } return x ? CommonMaxOrMin<V>(IsValueNegative(x)) : 0; } }; template <typename T, typename U, class Enable = void> struct ClampedRshOp {}; template <typename T, typename U> struct ClampedRshOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type> { using result_type = T; template <typename V = result_type> static constexpr V Do(T x, U shift) { static_assert(!std::is_signed<U>::value, "Shift value must be unsigned."); const V saturated = as_unsigned(V(0)) - IsValueNegative(x); return __builtin_expect(!!(shift < IntegerBitsPlusSign<T>::value), 1) ? saturated_cast<V>(x >> shift) : saturated; } }; template <typename T, typename U, class Enable = void> struct ClampedAndOp {}; template <typename T, typename U> struct ClampedAndOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type> { using result_type = typename std::make_unsigned< typename MaxExponentPromotion<T, U>::type>::type; template <typename V> static constexpr V Do(T x, U y) { return static_cast<result_type>(x) & static_cast<result_type>(y); } }; template <typename T, typename U, class Enable = void> struct ClampedOrOp {}; template <typename T, typename U> struct ClampedOrOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type> { using result_type = typename std::make_unsigned< typename MaxExponentPromotion<T, U>::type>::type; template <typename V> static constexpr V Do(T x, U y) { return static_cast<result_type>(x) | static_cast<result_type>(y); } }; template <typename T, typename U, class Enable = void> struct ClampedXorOp {}; template <typename T, typename U> struct ClampedXorOp<T, U, typename std::enable_if<std::is_integral<T>::value && std::is_integral<U>::value>::type> { using result_type = typename std::make_unsigned< typename MaxExponentPromotion<T, U>::type>::type; template <typename V> static constexpr V Do(T x, U y) { return static_cast<result_type>(x) ^ static_cast<result_type>(y); } }; template <typename T, typename U, class Enable = void> struct ClampedMaxOp {}; template <typename T, typename U> struct ClampedMaxOp< T, U, typename std::enable_if<std::is_arithmetic<T>::value && std::is_arithmetic<U>::value>::type> { using result_type = typename MaxExponentPromotion<T, U>::type; template <typename V = result_type> static constexpr V Do(T x, U y) { return IsGreater<T, U>::Test(x, y) ? saturated_cast<V>(x) : saturated_cast<V>(y); } }; template <typename T, typename U, class Enable = void> struct ClampedMinOp {}; template <typename T, typename U> struct ClampedMinOp< T, U, typename std::enable_if<std::is_arithmetic<T>::value && std::is_arithmetic<U>::value>::type> { using result_type = typename LowestValuePromotion<T, U>::type; template <typename V = result_type> static constexpr V Do(T x, U y) { return IsLess<T, U>::Test(x, y) ? saturated_cast<V>(x) : saturated_cast<V>(y); } }; template <typename T, typename U> struct ClampedAddOp< T, U, typename std::enable_if<std::is_floating_point<T>::value || std::is_floating_point<U>::value>::type> { using result_type = typename MaxExponentPromotion<T, U>::type; template <typename V = result_type> static constexpr V Do(T x, U y) { return saturated_cast<V>(x + y); } }; template <typename T, typename U> struct ClampedSubOp< T, U, typename std::enable_if<std::is_floating_point<T>::value || std::is_floating_point<U>::value>::type> { using result_type = typename MaxExponentPromotion<T, U>::type; template <typename V = result_type> static constexpr V Do(T x, U y) { return saturated_cast<V>(x - y); } }; template <typename T, typename U> struct ClampedMulOp< T, U, typename std::enable_if<std::is_floating_point<T>::value || std::is_floating_point<U>::value>::type> { using result_type = typename MaxExponentPromotion<T, U>::type; template <typename V = result_type> static constexpr V Do(T x, U y) { return saturated_cast<V>(x * y); } }; template <typename T, typename U> struct ClampedDivOp< T, U, typename std::enable_if<std::is_floating_point<T>::value || std::is_floating_point<U>::value>::type> { using result_type = typename MaxExponentPromotion<T, U>::type; template <typename V = result_type> static constexpr V Do(T x, U y) { return saturated_cast<V>(x / y); } }; } } namespace base { namespace internal { template <typename T> class ClampedNumeric { static_assert(std::is_arithmetic<T>::value, "ClampedNumeric<T>: T must be a numeric type."); public: using type = T; constexpr ClampedNumeric() : value_(0) {} template <typename Src> constexpr ClampedNumeric(const ClampedNumeric<Src>& rhs) : value_(saturated_cast<T>(rhs.value_)) {} template <typename Src> friend class ClampedNumeric; template <typename Src> constexpr ClampedNumeric(Src value) : value_(saturated_cast<T>(value)) { static_assert(std::is_arithmetic<Src>::value, "Argument must be numeric."); } template <typename Src> constexpr ClampedNumeric( StrictNumeric<Src> value) : value_(saturated_cast<T>(static_cast<Src>(value))) {} template <typename Dst> constexpr ClampedNumeric<typename UnderlyingType<Dst>::type> Cast() const { return *this; } template <typename Src> constexpr ClampedNumeric& operator+=(const Src rhs); template <typename Src> constexpr ClampedNumeric& operator-=(const Src rhs); template <typename Src> constexpr ClampedNumeric& operator*=(const Src rhs); template <typename Src> constexpr ClampedNumeric& operator/=(const Src rhs); template <typename Src> constexpr ClampedNumeric& operator%=(const Src rhs); template <typename Src> constexpr ClampedNumeric& operator<<=(const Src rhs); template <typename Src> constexpr ClampedNumeric& operator>>=(const Src rhs); template <typename Src> constexpr ClampedNumeric& operator&=(const Src rhs); template <typename Src> constexpr ClampedNumeric& operator|=(const Src rhs); template <typename Src> constexpr ClampedNumeric& operator^=(const Src rhs); constexpr ClampedNumeric operator-() const { return ClampedNumeric<T>(SaturatedNegWrapper(value_)); } constexpr ClampedNumeric operator~() const { return ClampedNumeric<decltype(InvertWrapper(T()))>(InvertWrapper(value_)); } constexpr ClampedNumeric Abs() const { return ClampedNumeric<T>(SaturatedAbsWrapper(value_)); } template <typename U> constexpr ClampedNumeric<typename MathWrapper<ClampedMaxOp, T, U>::type> Max( const U rhs) const { using result_type = typename MathWrapper<ClampedMaxOp, T, U>::type; return ClampedNumeric<result_type>( ClampedMaxOp<T, U>::Do(value_, Wrapper<U>::value(rhs))); } template <typename U> constexpr ClampedNumeric<typename MathWrapper<ClampedMinOp, T, U>::type> Min( const U rhs) const { using result_type = typename MathWrapper<ClampedMinOp, T, U>::type; return ClampedNumeric<result_type>( ClampedMinOp<T, U>::Do(value_, Wrapper<U>::value(rhs))); } constexpr ClampedNumeric<typename UnsignedOrFloatForSize<T>::type> UnsignedAbs() const { return ClampedNumeric<typename UnsignedOrFloatForSize<T>::type>( SafeUnsignedAbs(value_)); } constexpr ClampedNumeric& operator++() { *this += 1; return *this; } constexpr ClampedNumeric operator++(int) { ClampedNumeric value = *this; *this += 1; return value; } constexpr ClampedNumeric& operator--() { *this -= 1; return *this; } constexpr ClampedNumeric operator--(int) { ClampedNumeric value = *this; *this -= 1; return value; } template <template <typename, typename, typename> class M, typename L, typename R> static constexpr ClampedNumeric MathOp(const L lhs, const R rhs) { using Math = typename MathWrapper<M, L, R>::math; return ClampedNumeric<T>( Math::template Do<T>(Wrapper<L>::value(lhs), Wrapper<R>::value(rhs))); } template <template <typename, typename, typename> class M, typename R> constexpr ClampedNumeric& MathOp(const R rhs) { using Math = typename MathWrapper<M, T, R>::math; *this = ClampedNumeric<T>(Math::template Do<T>(value_, Wrapper<R>::value(rhs))); return *this; } template <typename Dst> constexpr operator Dst() const { return saturated_cast<typename ArithmeticOrUnderlyingEnum<Dst>::type>( value_); } constexpr T RawValue() const { return value_; } private: T value_; template <typename Src> struct Wrapper { static constexpr Src value(Src value) { return static_cast<typename UnderlyingType<Src>::type>(value); } }; }; template <typename T> constexpr ClampedNumeric<typename UnderlyingType<T>::type> MakeClampedNum( const T value) { return value; } template <typename T> std::ostream& operator<<(std::ostream& os, const ClampedNumeric<T>& value) { os << static_cast<T>(value); return os; } template <template <typename, typename, typename> class M, typename L, typename R> constexpr ClampedNumeric<typename MathWrapper<M, L, R>::type> ClampMathOp( const L lhs, const R rhs) { using Math = typename MathWrapper<M, L, R>::math; return ClampedNumeric<typename Math::result_type>::template MathOp<M>(lhs, rhs); } template <template <typename, typename, typename> class M, typename L, typename R, typename... Args> constexpr ClampedNumeric<typename ResultType<M, L, R, Args...>::type> ClampMathOp(const L lhs, const R rhs, const Args... args) { return ClampMathOp<M>(ClampMathOp<M>(lhs, rhs), args...); } template <typename L, typename R, typename std::enable_if<IsClampedOp<L, R>::value>::type* = nullptr> constexpr ClampedNumeric< typename MathWrapper<ClampedAddOp, L, R>::type> operator +(const L lhs, const R rhs) { return decltype(lhs + rhs)::template MathOp<ClampedAddOp>(lhs, rhs); } template <typename L> template <typename R> constexpr ClampedNumeric<L>& ClampedNumeric<L>::operator +=( const R rhs) { return MathOp<ClampedAddOp>(rhs); } template <typename L, typename R, typename... Args> constexpr ClampedNumeric< typename ResultType<ClampedAddOp, L, R, Args...>::type> ClampAdd(const L lhs, const R rhs, const Args... args) { return ClampMathOp<ClampedAddOp, L, R, Args...>(lhs, rhs, args...); } template <typename L, typename R, typename std::enable_if<IsClampedOp<L, R>::value>::type* = nullptr> constexpr ClampedNumeric< typename MathWrapper<ClampedSubOp, L, R>::type> operator -(const L lhs, const R rhs) { return decltype(lhs - rhs)::template MathOp<ClampedSubOp>(lhs, rhs); } template <typename L> template <typename R> constexpr ClampedNumeric<L>& ClampedNumeric<L>::operator -=( const R rhs) { return MathOp<ClampedSubOp>(rhs); } template <typename L, typename R, typename... Args> constexpr ClampedNumeric< typename ResultType<ClampedSubOp, L, R, Args...>::type> ClampSub(const L lhs, const R rhs, const Args... args) { return ClampMathOp<ClampedSubOp, L, R, Args...>(lhs, rhs, args...); } template <typename L, typename R, typename std::enable_if<IsClampedOp<L, R>::value>::type* = nullptr> constexpr ClampedNumeric< typename MathWrapper<ClampedMulOp, L, R>::type> operator *(const L lhs, const R rhs) { return decltype(lhs * rhs)::template MathOp<ClampedMulOp>(lhs, rhs); } template <typename L> template <typename R> constexpr ClampedNumeric<L>& ClampedNumeric<L>::operator *=( const R rhs) { return MathOp<ClampedMulOp>(rhs); } template <typename L, typename R, typename... Args> constexpr ClampedNumeric< typename ResultType<ClampedMulOp, L, R, Args...>::type> ClampMul(const L lhs, const R rhs, const Args... args) { return ClampMathOp<ClampedMulOp, L, R, Args...>(lhs, rhs, args...); } template <typename L, typename R, typename std::enable_if<IsClampedOp<L, R>::value>::type* = nullptr> constexpr ClampedNumeric< typename MathWrapper<ClampedDivOp, L, R>::type> operator /(const L lhs, const R rhs) { return decltype(lhs / rhs)::template MathOp<ClampedDivOp>(lhs, rhs); } template <typename L> template <typename R> constexpr ClampedNumeric<L>& ClampedNumeric<L>::operator /=( const R rhs) { return MathOp<ClampedDivOp>(rhs); } template <typename L, typename R, typename... Args> constexpr ClampedNumeric< typename ResultType<ClampedDivOp, L, R, Args...>::type> ClampDiv(const L lhs, const R rhs, const Args... args) { return ClampMathOp<ClampedDivOp, L, R, Args...>(lhs, rhs, args...); } template <typename L, typename R, typename std::enable_if<IsClampedOp<L, R>::value>::type* = nullptr> constexpr ClampedNumeric< typename MathWrapper<ClampedModOp, L, R>::type> operator %(const L lhs, const R rhs) { return decltype(lhs % rhs)::template MathOp<ClampedModOp>(lhs, rhs); } template <typename L> template <typename R> constexpr ClampedNumeric<L>& ClampedNumeric<L>::operator %=( const R rhs) { return MathOp<ClampedModOp>(rhs); } template <typename L, typename R, typename... Args> constexpr ClampedNumeric< typename ResultType<ClampedModOp, L, R, Args...>::type> ClampMod(const L lhs, const R rhs, const Args... args) { return ClampMathOp<ClampedModOp, L, R, Args...>(lhs, rhs, args...); } template <typename L, typename R, typename std::enable_if<IsClampedOp<L, R>::value>::type* = nullptr> constexpr ClampedNumeric< typename MathWrapper<ClampedLshOp, L, R>::type> operator <<(const L lhs, const R rhs) { return decltype(lhs << rhs)::template MathOp<ClampedLshOp>(lhs, rhs); } template <typename L> template <typename R> constexpr ClampedNumeric<L>& ClampedNumeric<L>::operator <<=( const R rhs) { return MathOp<ClampedLshOp>(rhs); } template <typename L, typename R, typename... Args> constexpr ClampedNumeric< typename ResultType<ClampedLshOp, L, R, Args...>::type> ClampLsh(const L lhs, const R rhs, const Args... args) { return ClampMathOp<ClampedLshOp, L, R, Args...>(lhs, rhs, args...); } template <typename L, typename R, typename std::enable_if<IsClampedOp<L, R>::value>::type* = nullptr> constexpr ClampedNumeric< typename MathWrapper<ClampedRshOp, L, R>::type> operator >>(const L lhs, const R rhs) { return decltype(lhs >> rhs)::template MathOp<ClampedRshOp>(lhs, rhs); } template <typename L> template <typename R> constexpr ClampedNumeric<L>& ClampedNumeric<L>::operator >>=( const R rhs) { return MathOp<ClampedRshOp>(rhs); } template <typename L, typename R, typename... Args> constexpr ClampedNumeric< typename ResultType<ClampedRshOp, L, R, Args...>::type> ClampRsh(const L lhs, const R rhs, const Args... args) { return ClampMathOp<ClampedRshOp, L, R, Args...>(lhs, rhs, args...); } template <typename L, typename R, typename std::enable_if<IsClampedOp<L, R>::value>::type* = nullptr> constexpr ClampedNumeric< typename MathWrapper<ClampedAndOp, L, R>::type> operator &(const L lhs, const R rhs) { return decltype(lhs & rhs)::template MathOp<ClampedAndOp>(lhs, rhs); } template <typename L> template <typename R> constexpr ClampedNumeric<L>& ClampedNumeric<L>::operator &=( const R rhs) { return MathOp<ClampedAndOp>(rhs); } template <typename L, typename R, typename... Args> constexpr ClampedNumeric< typename ResultType<ClampedAndOp, L, R, Args...>::type> ClampAnd(const L lhs, const R rhs, const Args... args) { return ClampMathOp<ClampedAndOp, L, R, Args...>(lhs, rhs, args...); } template <typename L, typename R, typename std::enable_if<IsClampedOp<L, R>::value>::type* = nullptr> constexpr ClampedNumeric< typename MathWrapper<ClampedOrOp, L, R>::type> operator |(const L lhs, const R rhs) { return decltype(lhs | rhs)::template MathOp<ClampedOrOp>(lhs, rhs); } template <typename L> template <typename R> constexpr ClampedNumeric<L>& ClampedNumeric<L>::operator |=( const R rhs) { return MathOp<ClampedOrOp>(rhs); } template <typename L, typename R, typename... Args> constexpr ClampedNumeric< typename ResultType<ClampedOrOp, L, R, Args...>::type> ClampOr(const L lhs, const R rhs, const Args... args) { return ClampMathOp<ClampedOrOp, L, R, Args...>(lhs, rhs, args...); } template <typename L, typename R, typename std::enable_if<IsClampedOp<L, R>::value>::type* = nullptr> constexpr ClampedNumeric< typename MathWrapper<ClampedXorOp, L, R>::type> operator ^(const L lhs, const R rhs) { return decltype(lhs ^ rhs)::template MathOp<ClampedXorOp>(lhs, rhs); } template <typename L> template <typename R> constexpr ClampedNumeric<L>& ClampedNumeric<L>::operator ^=( const R rhs) { return MathOp<ClampedXorOp>(rhs); } template <typename L, typename R, typename... Args> constexpr ClampedNumeric< typename ResultType<ClampedXorOp, L, R, Args...>::type> ClampXor(const L lhs, const R rhs, const Args... args) { return ClampMathOp<ClampedXorOp, L, R, Args...>(lhs, rhs, args...); } template <typename L, typename R, typename... Args> constexpr ClampedNumeric< typename ResultType<ClampedMaxOp, L, R, Args...>::type> ClampMax(const L lhs, const R rhs, const Args... args) { return ClampMathOp<ClampedMaxOp, L, R, Args...>(lhs, rhs, args...); } template <typename L, typename R, typename... Args> constexpr ClampedNumeric< typename ResultType<ClampedMinOp, L, R, Args...>::type> ClampMin(const L lhs, const R rhs, const Args... args) { return ClampMathOp<ClampedMinOp, L, R, Args...>(lhs, rhs, args...); } template <typename L, typename R, typename std::enable_if< internal::IsClampedOp<L, R>::value>::type* = nullptr> constexpr bool operator <(const L lhs, const R rhs) { return SafeCompare<IsLess, typename UnderlyingType<L>::type, typename UnderlyingType<R>::type>(lhs, rhs); } template <typename L, typename R, typename std::enable_if< internal::IsClampedOp<L, R>::value>::type* = nullptr> constexpr bool operator <=(const L lhs, const R rhs) { return SafeCompare<IsLessOrEqual, typename UnderlyingType<L>::type, typename UnderlyingType<R>::type>(lhs, rhs); } template <typename L, typename R, typename std::enable_if< internal::IsClampedOp<L, R>::value>::type* = nullptr> constexpr bool operator >(const L lhs, const R rhs) { return SafeCompare<IsGreater, typename UnderlyingType<L>::type, typename UnderlyingType<R>::type>(lhs, rhs); } template <typename L, typename R, typename std::enable_if< internal::IsClampedOp<L, R>::value>::type* = nullptr> constexpr bool operator >=(const L lhs, const R rhs) { return SafeCompare<IsGreaterOrEqual, typename UnderlyingType<L>::type, typename UnderlyingType<R>::type>(lhs, rhs); } template <typename L, typename R, typename std::enable_if< internal::IsClampedOp<L, R>::value>::type* = nullptr> constexpr bool operator ==(const L lhs, const R rhs) { return SafeCompare<IsEqual, typename UnderlyingType<L>::type, typename UnderlyingType<R>::type>(lhs, rhs); } template <typename L, typename R, typename std::enable_if< internal::IsClampedOp<L, R>::value>::type* = nullptr> constexpr bool operator !=(const L lhs, const R rhs) { return SafeCompare<IsNotEqual, typename UnderlyingType<L>::type, typename UnderlyingType<R>::type>(lhs, rhs); } } using internal::ClampedNumeric; using internal::MakeClampedNum; using internal::ClampMax; using internal::ClampMin; using internal::ClampAdd; using internal::ClampSub; using internal::ClampMul; using internal::ClampDiv; using internal::ClampMod; using internal::ClampLsh; using internal::ClampRsh; using internal::ClampAnd; using internal::ClampOr; using internal::ClampXor; } namespace ABI { namespace Windows { namespace Foundation { struct DateTime; } } } namespace base { class PlatformThreadHandle; class TimeDelta; namespace time_internal { constexpr int64_t SaturatedAdd(int64_t value, TimeDelta delta); constexpr int64_t SaturatedSub(int64_t value, TimeDelta delta); } class TimeDelta { public: constexpr TimeDelta() : delta_(0) {} static constexpr TimeDelta FromDays(int days); static constexpr TimeDelta FromHours(int hours); static constexpr TimeDelta FromMinutes(int minutes); static constexpr TimeDelta FromSeconds(int64_t secs); static constexpr TimeDelta FromMilliseconds(int64_t ms); static constexpr TimeDelta FromMicroseconds(int64_t us); static constexpr TimeDelta FromNanoseconds(int64_t ns); static constexpr TimeDelta FromSecondsD(double secs); static constexpr TimeDelta FromMillisecondsD(double ms); static constexpr TimeDelta FromMicrosecondsD(double us); static constexpr TimeDelta FromNanosecondsD(double ns); static TimeDelta FromQPCValue(LONGLONG qpc_value); static TimeDelta FromFileTime(FILETIME ft); static TimeDelta FromWinrtDateTime(ABI::Windows::Foundation::DateTime dt); static constexpr TimeDelta FromInternalValue(int64_t delta) { return TimeDelta(delta); } static constexpr TimeDelta Max(); static constexpr TimeDelta Min(); constexpr int64_t ToInternalValue() const { return delta_; } constexpr TimeDelta magnitude() const { const int64_t mask = delta_ >> (sizeof(delta_) * 8 - 1); return TimeDelta((delta_ + mask) ^ mask); } constexpr bool is_zero() const { return delta_ == 0; } constexpr bool is_max() const { return delta_ == std::numeric_limits<int64_t>::max(); } constexpr bool is_min() const { return delta_ == std::numeric_limits<int64_t>::min(); } ABI::Windows::Foundation::DateTime ToWinrtDateTime() const; int InDays() const; int InDaysFloored() const; int InHours() const; int InMinutes() const; double InSecondsF() const; int64_t InSeconds() const; double InMillisecondsF() const; int64_t InMilliseconds() const; int64_t InMillisecondsRoundedUp() const; constexpr int64_t InMicroseconds() const { return delta_; } double InMicrosecondsF() const; int64_t InNanoseconds() const; constexpr TimeDelta operator+(TimeDelta other) const { return TimeDelta(time_internal::SaturatedAdd(delta_, other)); } constexpr TimeDelta operator-(TimeDelta other) const { return TimeDelta(time_internal::SaturatedSub(delta_, other)); } constexpr TimeDelta& operator+=(TimeDelta other) { return *this = (*this + other); } constexpr TimeDelta& operator-=(TimeDelta other) { return *this = (*this - other); } constexpr TimeDelta operator-() const { return TimeDelta(-delta_); } template <typename T> constexpr TimeDelta operator*(T a) const { CheckedNumeric<int64_t> rv(delta_); rv *= a; if (rv.IsValid()) return TimeDelta(rv.ValueOrDie()); if ((delta_ < 0) ^ (a < 0)) return TimeDelta(std::numeric_limits<int64_t>::min()); return TimeDelta(std::numeric_limits<int64_t>::max()); } template <typename T> constexpr TimeDelta operator/(T a) const { CheckedNumeric<int64_t> rv(delta_); rv /= a; if (rv.IsValid()) return TimeDelta(rv.ValueOrDie()); if ((delta_ < 0) ^ (a <= 0)) return TimeDelta(std::numeric_limits<int64_t>::min()); return TimeDelta(std::numeric_limits<int64_t>::max()); } template <typename T> constexpr TimeDelta& operator*=(T a) { return *this = (*this * a); } template <typename T> constexpr TimeDelta& operator/=(T a) { return *this = (*this / a); } constexpr int64_t operator/(TimeDelta a) const { return delta_ / a.delta_; } constexpr TimeDelta operator%(TimeDelta a) const { return TimeDelta(delta_ % a.delta_); } TimeDelta& operator%=(TimeDelta other) { return *this = (*this % other); } constexpr bool operator==(TimeDelta other) const { return delta_ == other.delta_; } constexpr bool operator!=(TimeDelta other) const { return delta_ != other.delta_; } constexpr bool operator<(TimeDelta other) const { return delta_ < other.delta_; } constexpr bool operator<=(TimeDelta other) const { return delta_ <= other.delta_; } constexpr bool operator>(TimeDelta other) const { return delta_ > other.delta_; } constexpr bool operator>=(TimeDelta other) const { return delta_ >= other.delta_; } private: friend constexpr int64_t time_internal::SaturatedAdd(int64_t value, TimeDelta delta); friend constexpr int64_t time_internal::SaturatedSub(int64_t value, TimeDelta delta); constexpr explicit TimeDelta(int64_t delta_us) : delta_(delta_us) {} static constexpr TimeDelta FromDouble(double value); static constexpr TimeDelta FromProduct(int64_t value, int64_t positive_value); int64_t delta_; }; template <typename T> constexpr TimeDelta operator*(T a, TimeDelta td) { return td * a; } std::ostream& operator<<(std::ostream& os, TimeDelta time_delta); namespace time_internal { constexpr int64_t SaturatedAdd(int64_t value, TimeDelta delta) { if (delta.is_max()) { switch (0) case 0: default: if (::logging::CheckOpResult true_if_passed = ::logging::CheckGTImpl((value), (std::numeric_limits<int64_t>::min()), "value" " " ">" " " "std::numeric_limits<int64_t>::min()")) ; else ::logging::LogMessage("../..\\base/time/time.h", 345, true_if_passed.message()).stream(); return std::numeric_limits<int64_t>::max(); } else if (delta.is_min()) { switch (0) case 0: default: if (::logging::CheckOpResult true_if_passed = ::logging::CheckLTImpl((value), (std::numeric_limits<int64_t>::max()), "value" " " "<" " " "std::numeric_limits<int64_t>::max()")) ; else ::logging::LogMessage("../..\\base/time/time.h", 348, true_if_passed.message()).stream(); return std::numeric_limits<int64_t>::min(); } return base::ClampAdd(value, delta.delta_); } constexpr int64_t SaturatedSub(int64_t value, TimeDelta delta) { if (delta.is_max()) { switch (0) case 0: default: if (::logging::CheckOpResult true_if_passed = ::logging::CheckLTImpl((value), (std::numeric_limits<int64_t>::max()), "value" " " "<" " " "std::numeric_limits<int64_t>::max()")) ; else ::logging::LogMessage("../..\\base/time/time.h", 359, true_if_passed.message()).stream(); return std::numeric_limits<int64_t>::min(); } else if (delta.is_min()) { switch (0) case 0: default: if (::logging::CheckOpResult true_if_passed = ::logging::CheckGTImpl((value), (std::numeric_limits<int64_t>::min()), "value" " " ">" " " "std::numeric_limits<int64_t>::min()")) ; else ::logging::LogMessage("../..\\base/time/time.h", 362, true_if_passed.message()).stream(); return std::numeric_limits<int64_t>::max(); } return base::ClampSub(value, delta.delta_); } template<class TimeClass> class TimeBase { public: static constexpr int64_t kHoursPerDay = 24; static constexpr int64_t kSecondsPerMinute = 60; static constexpr int64_t kSecondsPerHour = 60 * kSecondsPerMinute; static constexpr int64_t kMillisecondsPerSecond = 1000; static constexpr int64_t kMillisecondsPerDay = kMillisecondsPerSecond * 60 * 60 * kHoursPerDay; static constexpr int64_t kMicrosecondsPerMillisecond = 1000; static constexpr int64_t kMicrosecondsPerSecond = kMicrosecondsPerMillisecond * kMillisecondsPerSecond; static constexpr int64_t kMicrosecondsPerMinute = kMicrosecondsPerSecond * 60; static constexpr int64_t kMicrosecondsPerHour = kMicrosecondsPerMinute * 60; static constexpr int64_t kMicrosecondsPerDay = kMicrosecondsPerHour * kHoursPerDay; static constexpr int64_t kMicrosecondsPerWeek = kMicrosecondsPerDay * 7; static constexpr int64_t kNanosecondsPerMicrosecond = 1000; static constexpr int64_t kNanosecondsPerSecond = kNanosecondsPerMicrosecond * kMicrosecondsPerSecond; constexpr bool is_null() const { return us_ == 0; } constexpr bool is_max() const { return us_ == std::numeric_limits<int64_t>::max(); } constexpr bool is_min() const { return us_ == std::numeric_limits<int64_t>::min(); } static constexpr TimeClass Max() { return TimeClass(std::numeric_limits<int64_t>::max()); } static constexpr TimeClass Min() { return TimeClass(std::numeric_limits<int64_t>::min()); } constexpr int64_t ToInternalValue() const { return us_; } constexpr TimeDelta since_origin() const { return TimeDelta::FromMicroseconds(us_); } constexpr TimeClass& operator=(TimeClass other) { us_ = other.us_; return *(static_cast<TimeClass*>(this)); } constexpr TimeDelta operator-(TimeClass other) const { return TimeDelta::FromMicroseconds(us_ - other.us_); } constexpr TimeClass operator+(TimeDelta delta) const { return TimeClass(time_internal::SaturatedAdd(us_, delta)); } constexpr TimeClass operator-(TimeDelta delta) const { return TimeClass(time_internal::SaturatedSub(us_, delta)); } constexpr TimeClass& operator+=(TimeDelta delta) { return static_cast<TimeClass&>(*this = (*this + delta)); } constexpr TimeClass& operator-=(TimeDelta delta) { return static_cast<TimeClass&>(*this = (*this - delta)); } constexpr bool operator==(TimeClass other) const { return us_ == other.us_; } constexpr bool operator!=(TimeClass other) const { return us_ != other.us_; } constexpr bool operator<(TimeClass other) const { return us_ < other.us_; } constexpr bool operator<=(TimeClass other) const { return us_ <= other.us_; } constexpr bool operator>(TimeClass other) const { return us_ > other.us_; } constexpr bool operator>=(TimeClass other) const { return us_ >= other.us_; } protected: constexpr explicit TimeBase(int64_t us) : us_(us) {} int64_t us_; }; } template <class TimeClass> inline constexpr TimeClass operator+(TimeDelta delta, TimeClass t) { return t + delta; } class Time : public time_internal::TimeBase<Time> { public: static constexpr int64_t kTimeTToMicrosecondsOffset = (11644473600000000LL); static constexpr int64_t kQPCOverflowThreshold = (0x8637BD05AF7LL); static constexpr int kExplodedMinYear = 1601; static constexpr int kExplodedMaxYear = 30827; struct Exploded { int year; int month; int day_of_week; int day_of_month; int hour; int minute; int second; int millisecond; bool HasValidValues() const; }; constexpr Time() : TimeBase(0) {} static Time UnixEpoch(); static Time Now(); static Time NowFromSystemTime(); static Time FromDeltaSinceWindowsEpoch(TimeDelta delta); TimeDelta ToDeltaSinceWindowsEpoch() const; static Time FromTimeT(time_t tt); time_t ToTimeT() const; static Time FromDoubleT(double dt); double ToDoubleT() const; static Time FromJsTime(double ms_since_epoch); double ToJsTime() const; double ToJsTimeIgnoringNull() const; static Time FromJavaTime(int64_t ms_since_epoch); int64_t ToJavaTime() const; static Time FromFileTime(FILETIME ft); FILETIME ToFileTime() const; static const int kMinLowResolutionThresholdMs = 16; static void EnableHighResolutionTimer(bool enable); static void ReadMinTimerIntervalLowResMs(); static bool ActivateHighResolutionTimer(bool activate); static bool IsHighResolutionTimerInUse(); static void ResetHighResolutionTimerUsage(); static double GetHighResolutionTimerUsage(); static bool FromUTCExploded(const Exploded& exploded, Time* time) __attribute__((warn_unused_result)) { return FromExploded(false, exploded, time); } static bool FromLocalExploded(const Exploded& exploded, Time* time) __attribute__((warn_unused_result)) { return FromExploded(true, exploded, time); } static bool FromString(const char* time_string, Time* parsed_time) __attribute__((warn_unused_result)) { return FromStringInternal(time_string, true, parsed_time); } static bool FromUTCString(const char* time_string, Time* parsed_time) __attribute__((warn_unused_result)) { return FromStringInternal(time_string, false, parsed_time); } void UTCExplode(Exploded* exploded) const { return Explode(false, exploded); } void LocalExplode(Exploded* exploded) const { return Explode(true, exploded); } Time UTCMidnight() const { return Midnight(false); } Time LocalMidnight() const { return Midnight(true); } static constexpr Time FromInternalValue(int64_t us) { return Time(us); } private: friend class time_internal::TimeBase<Time>; constexpr explicit Time(int64_t microseconds_since_win_epoch) : TimeBase(microseconds_since_win_epoch) {} void Explode(bool is_local, Exploded* exploded) const; static bool FromExploded(bool is_local, const Exploded& exploded, Time* time) __attribute__((warn_unused_result)); Time Midnight(bool is_local) const; static bool FromStringInternal(const char* time_string, bool is_local, Time* parsed_time) __attribute__((warn_unused_result)); static bool ExplodedMostlyEquals(const Exploded& lhs, const Exploded& rhs) __attribute__((warn_unused_result)); static bool FromMillisecondsSinceUnixEpoch(int64_t unix_milliseconds, Time* time) __attribute__((warn_unused_result)); int64_t ToRoundedDownMillisecondsSinceUnixEpoch() const; }; constexpr TimeDelta TimeDelta::FromDays(int days) { return days == std::numeric_limits<int>::max() ? Max() : TimeDelta(days * Time::kMicrosecondsPerDay); } constexpr TimeDelta TimeDelta::FromHours(int hours) { return hours == std::numeric_limits<int>::max() ? Max() : TimeDelta(hours * Time::kMicrosecondsPerHour); } constexpr TimeDelta TimeDelta::FromMinutes(int minutes) { return minutes == std::numeric_limits<int>::max() ? Max() : TimeDelta(minutes * Time::kMicrosecondsPerMinute); } constexpr TimeDelta TimeDelta::FromSeconds(int64_t secs) { return FromProduct(secs, Time::kMicrosecondsPerSecond); } constexpr TimeDelta TimeDelta::FromMilliseconds(int64_t ms) { return FromProduct(ms, Time::kMicrosecondsPerMillisecond); } constexpr TimeDelta TimeDelta::FromMicroseconds(int64_t us) { return TimeDelta(us); } constexpr TimeDelta TimeDelta::FromNanoseconds(int64_t ns) { return TimeDelta(ns / Time::kNanosecondsPerMicrosecond); } constexpr TimeDelta TimeDelta::FromSecondsD(double secs) { return FromDouble(secs * Time::kMicrosecondsPerSecond); } constexpr TimeDelta TimeDelta::FromMillisecondsD(double ms) { return FromDouble(ms * Time::kMicrosecondsPerMillisecond); } constexpr TimeDelta TimeDelta::FromMicrosecondsD(double us) { return FromDouble(us); } constexpr TimeDelta TimeDelta::FromNanosecondsD(double ns) { return FromDouble(ns / Time::kNanosecondsPerMicrosecond); } constexpr TimeDelta TimeDelta::Max() { return TimeDelta(std::numeric_limits<int64_t>::max()); } constexpr TimeDelta TimeDelta::Min() { return TimeDelta(std::numeric_limits<int64_t>::min()); } constexpr TimeDelta TimeDelta::FromDouble(double value) { return TimeDelta(saturated_cast<int64_t>(value)); } constexpr TimeDelta TimeDelta::FromProduct(int64_t value, int64_t positive_value) { true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << !(positive_value > 0); return value > std::numeric_limits<int64_t>::max() / positive_value ? Max() : value < std::numeric_limits<int64_t>::min() / positive_value ? Min() : TimeDelta(value * positive_value); } std::ostream& operator<<(std::ostream& os, Time time); class TimeTicks : public time_internal::TimeBase<TimeTicks> { public: enum class Clock { FUCHSIA_ZX_CLOCK_MONOTONIC, LINUX_CLOCK_MONOTONIC, IOS_CF_ABSOLUTE_TIME_MINUS_KERN_BOOTTIME, MAC_MACH_ABSOLUTE_TIME, WIN_QPC, WIN_ROLLOVER_PROTECTED_TIME_GET_TIME }; constexpr TimeTicks() : TimeBase(0) {} static TimeTicks Now(); static bool IsHighResolution() __attribute__((warn_unused_result)); static bool IsConsistentAcrossProcesses() __attribute__((warn_unused_result)); static TimeTicks FromQPCValue(LONGLONG qpc_value); static TimeTicks UnixEpoch(); TimeTicks SnappedToNextTick(TimeTicks tick_phase, TimeDelta tick_interval) const; static Clock GetClock(); static constexpr TimeTicks FromInternalValue(int64_t us) { return TimeTicks(us); } protected: typedef DWORD (*TickFunctionType)(void); static TickFunctionType SetMockTickFunction(TickFunctionType ticker); private: friend class time_internal::TimeBase<TimeTicks>; constexpr explicit TimeTicks(int64_t us) : TimeBase(us) {} }; std::ostream& operator<<(std::ostream& os, TimeTicks time_ticks); class ThreadTicks : public time_internal::TimeBase<ThreadTicks> { public: constexpr ThreadTicks() : TimeBase(0) {} static bool IsSupported() __attribute__((warn_unused_result)) { return IsSupportedWin(); } static void WaitUntilInitialized() { WaitUntilInitializedWin(); } static ThreadTicks Now(); static ThreadTicks GetForThread(const PlatformThreadHandle& thread_handle); static constexpr ThreadTicks FromInternalValue(int64_t us) { return ThreadTicks(us); } private: friend class time_internal::TimeBase<ThreadTicks>; constexpr explicit ThreadTicks(int64_t us) : TimeBase(us) {} friend class TimeTicks_TSCTicksPerSecond_Test; friend class TimeTicks_DISABLED_TSCTicksPerSecond_Test; friend class TimeTicks_FLAKY_TSCTicksPerSecond_Test; static double TSCTicksPerSecond(); static bool IsSupportedWin() __attribute__((warn_unused_result)); static void WaitUntilInitializedWin(); }; std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); } #pragma pack(push, 8) extern "C" { } #pragma pack(pop) namespace std { inline namespace __1 { template <class _Tp, size_t _Size> struct array { typedef array __self; typedef _Tp value_type; typedef value_type& reference; typedef const value_type& const_reference; typedef value_type* iterator; typedef const value_type* const_iterator; typedef value_type* pointer; typedef const value_type* const_pointer; typedef size_t size_type; typedef ptrdiff_t difference_type; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; _Tp __elems_[_Size]; __attribute__ ((__exclude_from_explicit_instantiation__)) void fill(const value_type& __u) { std::__1::fill_n(__elems_, _Size, __u); } __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(array& __a) noexcept(__is_nothrow_swappable<_Tp>::value) { std::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_); } __attribute__ ((__exclude_from_explicit_instantiation__)) iterator begin() noexcept {return iterator(data());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator begin() const noexcept {return const_iterator(data());} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator end() noexcept {return iterator(data() + _Size);} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator end() const noexcept {return const_iterator(data() + _Size);} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator rbegin() noexcept {return reverse_iterator(end());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator rbegin() const noexcept {return const_reverse_iterator(end());} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator rend() noexcept {return reverse_iterator(begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator rend() const noexcept {return const_reverse_iterator(begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cbegin() const noexcept {return begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cend() const noexcept {return end();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator crbegin() const noexcept {return rbegin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator crend() const noexcept {return rend();} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr size_type size() const noexcept {return _Size;} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr size_type max_size() const noexcept {return _Size;} [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool empty() const noexcept {return false; } __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator[](size_type __n) noexcept {return __elems_[__n];} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const_reference operator[](size_type __n) const noexcept {return __elems_[__n];} reference at(size_type __n); constexpr const_reference at(size_type __n) const; __attribute__ ((__exclude_from_explicit_instantiation__)) reference front() noexcept {return __elems_[0];} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const_reference front() const noexcept {return __elems_[0];} __attribute__ ((__exclude_from_explicit_instantiation__)) reference back() noexcept {return __elems_[_Size - 1];} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const_reference back() const noexcept {return __elems_[_Size - 1];} __attribute__ ((__exclude_from_explicit_instantiation__)) value_type* data() noexcept {return __elems_;} __attribute__ ((__exclude_from_explicit_instantiation__)) const value_type* data() const noexcept {return __elems_;} }; template <class _Tp, size_t _Size> typename array<_Tp, _Size>::reference array<_Tp, _Size>::at(size_type __n) { if (__n >= _Size) __throw_out_of_range("array::at"); return __elems_[__n]; } template <class _Tp, size_t _Size> constexpr typename array<_Tp, _Size>::const_reference array<_Tp, _Size>::at(size_type __n) const { if (__n >= _Size) __throw_out_of_range("array::at"); return __elems_[__n]; } template <class _Tp> struct array<_Tp, 0> { typedef array __self; typedef _Tp value_type; typedef value_type& reference; typedef const value_type& const_reference; typedef value_type* iterator; typedef const value_type* const_iterator; typedef value_type* pointer; typedef const value_type* const_pointer; typedef size_t size_type; typedef ptrdiff_t difference_type; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; typedef typename conditional<is_const<_Tp>::value, const char, char>::type _CharType; struct _ArrayInStructT { _Tp __data_[1]; }; alignas(_ArrayInStructT) _CharType __elems_[sizeof(_ArrayInStructT)]; __attribute__ ((__exclude_from_explicit_instantiation__)) void fill(const value_type&) { static_assert(!is_const<_Tp>::value, "cannot fill zero-sized array of type 'const T'"); } __attribute__ ((__exclude_from_explicit_instantiation__)) void swap(array&) noexcept { static_assert(!is_const<_Tp>::value, "cannot swap zero-sized array of type 'const T'"); } __attribute__ ((__exclude_from_explicit_instantiation__)) iterator begin() noexcept {return iterator(data());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator begin() const noexcept {return const_iterator(data());} __attribute__ ((__exclude_from_explicit_instantiation__)) iterator end() noexcept {return iterator(data());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator end() const noexcept {return const_iterator(data());} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator rbegin() noexcept {return reverse_iterator(end());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator rbegin() const noexcept {return const_reverse_iterator(end());} __attribute__ ((__exclude_from_explicit_instantiation__)) reverse_iterator rend() noexcept {return reverse_iterator(begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator rend() const noexcept {return const_reverse_iterator(begin());} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cbegin() const noexcept {return begin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_iterator cend() const noexcept {return end();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator crbegin() const noexcept {return rbegin();} __attribute__ ((__exclude_from_explicit_instantiation__)) const_reverse_iterator crend() const noexcept {return rend();} __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr size_type size() const noexcept {return 0; } __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr size_type max_size() const noexcept {return 0;} [[nodiscard]] __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr bool empty() const noexcept {return true;} __attribute__ ((__exclude_from_explicit_instantiation__)) reference operator[](size_type) noexcept { ((void)0); std::__1::abort(); } __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const_reference operator[](size_type) const noexcept { ((void)0); std::__1::abort(); } __attribute__ ((__exclude_from_explicit_instantiation__)) reference at(size_type) { __throw_out_of_range("array<T, 0>::at"); std::__1::abort(); } __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference at(size_type) const { __throw_out_of_range("array<T, 0>::at"); std::__1::abort(); } __attribute__ ((__exclude_from_explicit_instantiation__)) reference front() noexcept { ((void)0); std::__1::abort(); } __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference front() const noexcept { ((void)0); std::__1::abort(); } __attribute__ ((__exclude_from_explicit_instantiation__)) reference back() noexcept { ((void)0); std::__1::abort(); } __attribute__ ((__exclude_from_explicit_instantiation__)) const_reference back() const noexcept { ((void)0); std::__1::abort(); } __attribute__ ((__exclude_from_explicit_instantiation__)) value_type* data() noexcept {return reinterpret_cast<value_type*>(__elems_);} __attribute__ ((__exclude_from_explicit_instantiation__)) const value_type* data() const noexcept {return reinterpret_cast<const value_type*>(__elems_);} }; template <class _Tp, size_t _Size> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) { return std::__1::equal(__x.begin(), __x.end(), __y.begin()); } template <class _Tp, size_t _Size> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) { return !(__x == __y); } template <class _Tp, size_t _Size> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) { return std::__1::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); } template <class _Tp, size_t _Size> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) { return __y < __x; } template <class _Tp, size_t _Size> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) { return !(__y < __x); } template <class _Tp, size_t _Size> inline __attribute__ ((__exclude_from_explicit_instantiation__)) bool operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) { return !(__x < __y); } template <class _Tp, size_t _Size> inline __attribute__ ((__exclude_from_explicit_instantiation__)) typename enable_if < _Size == 0 || __is_swappable<_Tp>::value, void >::type swap(array<_Tp, _Size>& __x, array<_Tp, _Size>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } template <class _Tp, size_t _Size> struct tuple_size<array<_Tp, _Size> > : public integral_constant<size_t, _Size> {}; template <size_t _Ip, class _Tp, size_t _Size> struct tuple_element<_Ip, array<_Tp, _Size> > { static_assert(_Ip < _Size, "Index out of bounds in std::tuple_element<> (std::array)"); typedef _Tp type; }; template <size_t _Ip, class _Tp, size_t _Size> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _Tp& get(array<_Tp, _Size>& __a) noexcept { static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array)"); return __a.__elems_[_Ip]; } template <size_t _Ip, class _Tp, size_t _Size> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const _Tp& get(const array<_Tp, _Size>& __a) noexcept { static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array)"); return __a.__elems_[_Ip]; } template <size_t _Ip, class _Tp, size_t _Size> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr _Tp&& get(array<_Tp, _Size>&& __a) noexcept { static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array &&)"); return std::__1::move(__a.__elems_[_Ip]); } template <size_t _Ip, class _Tp, size_t _Size> inline __attribute__ ((__exclude_from_explicit_instantiation__)) constexpr const _Tp&& get(const array<_Tp, _Size>&& __a) noexcept { static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array &&)"); return std::__1::move(__a.__elems_[_Ip]); } } } namespace base { template <typename T> static inline uintptr_t get_uintptr(const T* t) { return reinterpret_cast<uintptr_t>(t); } } namespace base { template <typename T> class CheckedContiguousIterator { public: using difference_type = std::ptrdiff_t; using value_type = std::remove_cv_t<T>; using pointer = T*; using reference = T&; using iterator_category = std::random_access_iterator_tag; template <typename U> friend class CheckedContiguousIterator; constexpr CheckedContiguousIterator() = default; constexpr CheckedContiguousIterator(T* start, const T* end) : CheckedContiguousIterator(start, start, end) {} constexpr CheckedContiguousIterator(const T* start, T* current, const T* end) : start_(start), current_(current), end_(end) { switch (0) case 0: default: if (::logging::CheckOpResult true_if_passed = ::logging::CheckLEImpl((start), (current), "start" " " "<=" " " "current")) ; else ::logging::LogMessage("../..\\base/containers/checked_iterators.h", 35, true_if_passed.message()).stream(); switch (0) case 0: default: if (::logging::CheckOpResult true_if_passed = ::logging::CheckLEImpl((current), (end), "current" " " "<=" " " "end")) ; else ::logging::LogMessage("../..\\base/containers/checked_iterators.h", 36, true_if_passed.message()).stream(); } constexpr CheckedContiguousIterator(const CheckedContiguousIterator& other) = default; template < typename U, std::enable_if_t<std::is_convertible<U (*)[], T (*)[]>::value>* = nullptr> constexpr CheckedContiguousIterator(const CheckedContiguousIterator<U>& other) : start_(other.start_), current_(other.current_), end_(other.end_) { true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << (::logging::MakeCheckOpValueString( ::logging::g_swallow_stream, other.start_), ::logging::MakeCheckOpValueString( ::logging::g_swallow_stream, other.current_), (other.start_)<=(other.current_)); true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << (::logging::MakeCheckOpValueString( ::logging::g_swallow_stream, other.current_), ::logging::MakeCheckOpValueString( ::logging::g_swallow_stream, other.end_), (other.current_)<=(other.end_)); } ~CheckedContiguousIterator() = default; constexpr CheckedContiguousIterator& operator=( const CheckedContiguousIterator& other) = default; constexpr bool operator==(const CheckedContiguousIterator& other) const { CheckComparable(other); return current_ == other.current_; } constexpr bool operator!=(const CheckedContiguousIterator& other) const { CheckComparable(other); return current_ != other.current_; } constexpr bool operator<(const CheckedContiguousIterator& other) const { CheckComparable(other); return current_ < other.current_; } constexpr bool operator<=(const CheckedContiguousIterator& other) const { CheckComparable(other); return current_ <= other.current_; } constexpr bool operator>(const CheckedContiguousIterator& other) const { CheckComparable(other); return current_ > other.current_; } constexpr bool operator>=(const CheckedContiguousIterator& other) const { CheckComparable(other); return current_ >= other.current_; } constexpr CheckedContiguousIterator& operator++() { switch (0) case 0: default: if (::logging::CheckOpResult true_if_passed = ::logging::CheckNEImpl((current_), (end_), "current_" " " "!=" " " "end_")) ; else ::logging::LogMessage("../..\\base/containers/checked_iterators.h", 94, true_if_passed.message()).stream(); ++current_; return *this; } constexpr CheckedContiguousIterator operator++(int) { CheckedContiguousIterator old = *this; ++*this; return old; } constexpr CheckedContiguousIterator& operator--() { switch (0) case 0: default: if (::logging::CheckOpResult true_if_passed = ::logging::CheckNEImpl((current_), (start_), "current_" " " "!=" " " "start_")) ; else ::logging::LogMessage("../..\\base/containers/checked_iterators.h", 106, true_if_passed.message()).stream(); --current_; return *this; } constexpr CheckedContiguousIterator operator--(int) { CheckedContiguousIterator old = *this; --*this; return old; } constexpr CheckedContiguousIterator& operator+=(difference_type rhs) { if (rhs > 0) { switch (0) case 0: default: if (::logging::CheckOpResult true_if_passed = ::logging::CheckLEImpl((rhs), (end_ - current_), "rhs" " " "<=" " " "end_ - current_")) ; else ::logging::LogMessage("../..\\base/containers/checked_iterators.h", 119, true_if_passed.message()).stream(); } else { switch (0) case 0: default: if (::logging::CheckOpResult true_if_passed = ::logging::CheckLEImpl((-rhs), (current_ - start_), "-rhs" " " "<=" " " "current_ - start_")) ; else ::logging::LogMessage("../..\\base/containers/checked_iterators.h", 121, true_if_passed.message()).stream(); } current_ += rhs; return *this; } constexpr CheckedContiguousIterator operator+(difference_type rhs) const { CheckedContiguousIterator it = *this; it += rhs; return it; } constexpr CheckedContiguousIterator& operator-=(difference_type rhs) { if (rhs < 0) { switch (0) case 0: default: if (::logging::CheckOpResult true_if_passed = ::logging::CheckLEImpl((-rhs), (end_ - current_), "-rhs" " " "<=" " " "end_ - current_")) ; else ::logging::LogMessage("../..\\base/containers/checked_iterators.h", 135, true_if_passed.message()).stream(); } else { switch (0) case 0: default: if (::logging::CheckOpResult true_if_passed = ::logging::CheckLEImpl((rhs), (current_ - start_), "rhs" " " "<=" " " "current_ - start_")) ; else ::logging::LogMessage("../..\\base/containers/checked_iterators.h", 137, true_if_passed.message()).stream(); } current_ -= rhs; return *this; } constexpr CheckedContiguousIterator operator-(difference_type rhs) const { CheckedContiguousIterator it = *this; it -= rhs; return it; } constexpr friend difference_type operator-( const CheckedContiguousIterator& lhs, const CheckedContiguousIterator& rhs) { switch (0) case 0: default: if (::logging::CheckOpResult true_if_passed = ::logging::CheckEQImpl((lhs.start_), (rhs.start_), "lhs.start_" " " "==" " " "rhs.start_")) ; else ::logging::LogMessage("../..\\base/containers/checked_iterators.h", 152, true_if_passed.message()).stream(); switch (0) case 0: default: if (::logging::CheckOpResult true_if_passed = ::logging::CheckEQImpl((lhs.end_), (rhs.end_), "lhs.end_" " " "==" " " "rhs.end_")) ; else ::logging::LogMessage("../..\\base/containers/checked_iterators.h", 153, true_if_passed.message()).stream(); return lhs.current_ - rhs.current_; } constexpr reference operator*() const { switch (0) case 0: default: if (::logging::CheckOpResult true_if_passed = ::logging::CheckNEImpl((current_), (end_), "current_" " " "!=" " " "end_")) ; else ::logging::LogMessage("../..\\base/containers/checked_iterators.h", 158, true_if_passed.message()).stream(); return *current_; } constexpr pointer operator->() const { switch (0) case 0: default: if (::logging::CheckOpResult true_if_passed = ::logging::CheckNEImpl((current_), (end_), "current_" " " "!=" " " "end_")) ; else ::logging::LogMessage("../..\\base/containers/checked_iterators.h", 163, true_if_passed.message()).stream(); return current_; } constexpr reference operator[](difference_type rhs) const { switch (0) case 0: default: if (::logging::CheckOpResult true_if_passed = ::logging::CheckGEImpl((rhs), (0), "rhs" " " ">=" " " "0")) ; else ::logging::LogMessage("../..\\base/containers/checked_iterators.h", 168, true_if_passed.message()).stream(); switch (0) case 0: default: if (::logging::CheckOpResult true_if_passed = ::logging::CheckLTImpl((rhs), (end_ - current_), "rhs" " " "<" " " "end_ - current_")) ; else ::logging::LogMessage("../..\\base/containers/checked_iterators.h", 169, true_if_passed.message()).stream(); return current_[rhs]; } static bool IsRangeMoveSafe(const CheckedContiguousIterator& from_begin, const CheckedContiguousIterator& from_end, const CheckedContiguousIterator& to) __attribute__((warn_unused_result)) { if (from_end < from_begin) return false; const auto from_begin_uintptr = get_uintptr(from_begin.current_); const auto from_end_uintptr = get_uintptr(from_end.current_); const auto to_begin_uintptr = get_uintptr(to.current_); const auto to_end_uintptr = get_uintptr((to + std::distance(from_begin, from_end)).current_); return to_begin_uintptr >= from_end_uintptr || to_end_uintptr <= from_begin_uintptr; } private: constexpr void CheckComparable(const CheckedContiguousIterator& other) const { switch (0) case 0: default: if (::logging::CheckOpResult true_if_passed = ::logging::CheckEQImpl((start_), (other.start_), "start_" " " "==" " " "other.start_")) ; else ::logging::LogMessage("../..\\base/containers/checked_iterators.h", 191, true_if_passed.message()).stream(); switch (0) case 0: default: if (::logging::CheckOpResult true_if_passed = ::logging::CheckEQImpl((end_), (other.end_), "end_" " " "==" " " "other.end_")) ; else ::logging::LogMessage("../..\\base/containers/checked_iterators.h", 192, true_if_passed.message()).stream(); } const T* start_ = nullptr; T* current_ = nullptr; const T* end_ = nullptr; }; template <typename T> using CheckedContiguousConstIterator = CheckedContiguousIterator<const T>; } namespace base { constexpr size_t dynamic_extent = std::numeric_limits<size_t>::max(); template <typename T, size_t Extent = dynamic_extent> class span; namespace internal { template <typename T> struct ExtentImpl : std::integral_constant<size_t, dynamic_extent> {}; template <typename T, size_t N> struct ExtentImpl<T[N]> : std::integral_constant<size_t, N> {}; template <typename T, size_t N> struct ExtentImpl<std::array<T, N>> : std::integral_constant<size_t, N> {}; template <typename T, size_t N> struct ExtentImpl<base::span<T, N>> : std::integral_constant<size_t, N> {}; template <typename T> using Extent = ExtentImpl<std::remove_cv_t<std::remove_reference_t<T>>>; template <typename T> struct IsSpanImpl : std::false_type {}; template <typename T, size_t Extent> struct IsSpanImpl<span<T, Extent>> : std::true_type {}; template <typename T> using IsSpan = IsSpanImpl<std::decay_t<T>>; template <typename T> struct IsStdArrayImpl : std::false_type {}; template <typename T, size_t N> struct IsStdArrayImpl<std::array<T, N>> : std::true_type {}; template <typename T> using IsStdArray = IsStdArrayImpl<std::decay_t<T>>; template <typename T> using IsCArray = std::is_array<std::remove_reference_t<T>>; template <typename From, typename To> using IsLegalDataConversion = std::is_convertible<From (*)[], To (*)[]>; template <typename Container, typename T> using ContainerHasConvertibleData = IsLegalDataConversion< std::remove_pointer_t<decltype(base::data(std::declval<Container>()))>, T>; template <typename Container> using ContainerHasIntegralSize = std::is_integral<decltype(base::size(std::declval<Container>()))>; template <typename From, size_t FromExtent, typename To, size_t ToExtent> using EnableIfLegalSpanConversion = std::enable_if_t<(ToExtent == dynamic_extent || ToExtent == FromExtent) && IsLegalDataConversion<From, To>::value>; template <typename Array, typename T, size_t Extent> using EnableIfSpanCompatibleArray = std::enable_if_t<(Extent == dynamic_extent || Extent == internal::Extent<Array>::value) && ContainerHasConvertibleData<Array, T>::value>; template <typename Container, typename T> using IsSpanCompatibleContainer = std::conditional_t<!IsSpan<Container>::value && !IsStdArray<Container>::value && !IsCArray<Container>::value && ContainerHasConvertibleData<Container, T>::value && ContainerHasIntegralSize<Container>::value, std::true_type, std::false_type>; template <typename Container, typename T> using EnableIfSpanCompatibleContainer = std::enable_if_t<IsSpanCompatibleContainer<Container, T>::value>; template <typename Container, typename T, size_t Extent> using EnableIfSpanCompatibleContainerAndSpanIsDynamic = std::enable_if_t<IsSpanCompatibleContainer<Container, T>::value && Extent == dynamic_extent>; template <size_t Extent> class ExtentStorage { public: constexpr explicit ExtentStorage(size_t size) noexcept {} constexpr size_t size() const noexcept { return Extent; } }; template <> struct ExtentStorage<dynamic_extent> { constexpr explicit ExtentStorage(size_t size) noexcept : size_(size) {} constexpr size_t size() const noexcept { return size_; } private: size_t size_; }; } template <typename T, size_t Extent> class span : public internal::ExtentStorage<Extent> { private: using ExtentStorage = internal::ExtentStorage<Extent>; public: using element_type = T; using value_type = std::remove_cv_t<T>; using size_type = size_t; using difference_type = ptrdiff_t; using pointer = T*; using reference = T&; using iterator = CheckedContiguousIterator<T>; using const_iterator = CheckedContiguousConstIterator<T>; using reverse_iterator = std::reverse_iterator<iterator>; using const_reverse_iterator = std::reverse_iterator<const_iterator>; static constexpr size_t extent = Extent; constexpr span() noexcept : ExtentStorage(0), data_(nullptr) { static_assert(Extent == dynamic_extent || Extent == 0, "Invalid Extent"); } constexpr span(T* data, size_t size) noexcept : ExtentStorage(size), data_(data) { !(!(Extent == dynamic_extent || Extent == size)) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/containers/span.h", 242, "Extent == dynamic_extent || Extent == size").stream()); } template <typename = void> constexpr span(T* begin, T* end) noexcept : span(begin, end - begin) { !(!(begin <= end)) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/containers/span.h", 249, "begin <= end").stream()); } template < size_t N, typename = internal::EnableIfSpanCompatibleArray<T (&)[N], T, Extent>> constexpr span(T (&array)[N]) noexcept : span(base::data(array), N) {} template < size_t N, typename = internal:: EnableIfSpanCompatibleArray<std::array<value_type, N>&, T, Extent>> constexpr span(std::array<value_type, N>& array) noexcept : span(base::data(array), N) {} template <size_t N, typename = internal::EnableIfSpanCompatibleArray< const std::array<value_type, N>&, T, Extent>> constexpr span(const std::array<value_type, N>& array) noexcept : span(base::data(array), N) {} template < typename Container, typename = internal::EnableIfSpanCompatibleContainerAndSpanIsDynamic<Container&, T, Extent>> constexpr span(Container& container) noexcept : span(base::data(container), base::size(container)) {} template < typename Container, typename = internal::EnableIfSpanCompatibleContainerAndSpanIsDynamic< const Container&, T, Extent>> constexpr span(const Container& container) noexcept : span(base::data(container), base::size(container)) {} constexpr span(const span& other) noexcept = default; template < typename U, size_t OtherExtent, typename = internal::EnableIfLegalSpanConversion<U, OtherExtent, T, Extent>> constexpr span(const span<U, OtherExtent>& other) : span(other.data(), other.size()) {} constexpr span& operator=(const span& other) noexcept = default; ~span() noexcept = default; template <size_t Count> constexpr span<T, Count> first() const noexcept { static_assert(Extent == dynamic_extent || Count <= Extent, "Count must not exceed Extent"); !(!(Extent != dynamic_extent || Count <= size())) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/containers/span.h", 313, "Extent != dynamic_extent || Count <= size()").stream()); return {data(), Count}; } template <size_t Count> constexpr span<T, Count> last() const noexcept { static_assert(Extent == dynamic_extent || Count <= Extent, "Count must not exceed Extent"); !(!(Extent != dynamic_extent || Count <= size())) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/containers/span.h", 321, "Extent != dynamic_extent || Count <= size()").stream()); return {data() + (size() - Count), Count}; } template <size_t Offset, size_t Count = dynamic_extent> constexpr span<T, (Count != dynamic_extent ? Count : (Extent != dynamic_extent ? Extent - Offset : dynamic_extent))> subspan() const noexcept { static_assert(Extent == dynamic_extent || Offset <= Extent, "Offset must not exceed Extent"); static_assert(Extent == dynamic_extent || Count == dynamic_extent || Count <= Extent - Offset, "Count must not exceed Extent - Offset"); !(!(Extent != dynamic_extent || Offset <= size())) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/containers/span.h", 337, "Extent != dynamic_extent || Offset <= size()").stream()); !(!(Extent != dynamic_extent || Count == dynamic_extent || Count <= size() - Offset)) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/containers/span.h", 339, "Extent != dynamic_extent || Count == dynamic_extent || Count <= size() - Offset").stream()); return {data() + Offset, Count != dynamic_extent ? Count : size() - Offset}; } constexpr span<T, dynamic_extent> first(size_t count) const noexcept { !(!(count <= size())) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/containers/span.h", 345, "count <= size()").stream()); return {data(), count}; } constexpr span<T, dynamic_extent> last(size_t count) const noexcept { !(!(count <= size())) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/containers/span.h", 351, "count <= size()").stream()); return {data() + (size() - count), count}; } constexpr span<T, dynamic_extent> subspan(size_t offset, size_t count = dynamic_extent) const noexcept { !(!(offset <= size())) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/containers/span.h", 359, "offset <= size()").stream()); !(!(count == dynamic_extent || count <= size() - offset)) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/containers/span.h", 360, "count == dynamic_extent || count <= size() - offset").stream()); return {data() + offset, count != dynamic_extent ? count : size() - offset}; } constexpr size_t size() const noexcept { return ExtentStorage::size(); } constexpr size_t size_bytes() const noexcept { return size() * sizeof(T); } constexpr bool empty() const noexcept __attribute__((warn_unused_result)) { return size() == 0; } constexpr T& operator[](size_t idx) const noexcept { !(!(idx < size())) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/containers/span.h", 374, "idx < size()").stream()); return *(data() + idx); } constexpr T& front() const noexcept { static_assert(Extent == dynamic_extent || Extent > 0, "Extent must not be 0"); !(!(Extent != dynamic_extent || !empty())) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/containers/span.h", 381, "Extent != dynamic_extent || !empty()").stream()); return *data(); } constexpr T& back() const noexcept { static_assert(Extent == dynamic_extent || Extent > 0, "Extent must not be 0"); !(!(Extent != dynamic_extent || !empty())) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/containers/span.h", 388, "Extent != dynamic_extent || !empty()").stream()); return *(data() + size() - 1); } constexpr T* data() const noexcept { return data_; } constexpr iterator begin() const noexcept { return iterator(data_, data_ + size()); } constexpr iterator end() const noexcept { return iterator(data_, data_ + size(), data_ + size()); } constexpr const_iterator cbegin() const noexcept { return begin(); } constexpr const_iterator cend() const noexcept { return end(); } constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); } constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); } constexpr const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(cend()); } constexpr const_reverse_iterator crend() const noexcept { return const_reverse_iterator(cbegin()); } private: T* data_; }; template <class T, size_t Extent> constexpr size_t span<T, Extent>::extent; template <typename T, size_t X> span<const uint8_t, (X == dynamic_extent ? dynamic_extent : sizeof(T) * X)> as_bytes(span<T, X> s) noexcept { return {reinterpret_cast<const uint8_t*>(s.data()), s.size_bytes()}; } template <typename T, size_t X, typename = std::enable_if_t<!std::is_const<T>::value>> span<uint8_t, (X == dynamic_extent ? dynamic_extent : sizeof(T) * X)> as_writable_bytes(span<T, X> s) noexcept { return {reinterpret_cast<uint8_t*>(s.data()), s.size_bytes()}; } template <int&... ExplicitArgumentBarrier, typename T> constexpr span<T> make_span(T* data, size_t size) noexcept { return {data, size}; } template <int&... ExplicitArgumentBarrier, typename T> constexpr span<T> make_span(T* begin, T* end) noexcept { return {begin, end}; } template <int&... ExplicitArgumentBarrier, typename Container> constexpr auto make_span(Container&& container) noexcept { using T = std::remove_pointer_t<decltype(base::data(std::declval<Container>()))>; using Extent = internal::Extent<Container>; return span<T, Extent::value>(std::forward<Container>(container)); } template <size_t N, int&... ExplicitArgumentBarrier, typename Container> constexpr auto make_span(Container&& container) noexcept { using T = std::remove_pointer_t<decltype(base::data(std::declval<Container>()))>; return span<T, N>(base::data(container), base::size(container)); } } namespace std { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wmismatched-tags" template <typename T, size_t X> struct tuple_size<base::span<T, X>> : public integral_constant<size_t, X> {}; template <typename T> struct tuple_size<base::span<T, base::dynamic_extent>>; template <size_t I, typename T, size_t X> struct tuple_element<I, base::span<T, X>> { static_assert( base::dynamic_extent != X, "std::tuple_element<> not supported for base::span<T, dynamic_extent>"); static_assert(I < X, "Index out of bounds in std::tuple_element<> (base::span)"); using type = T; }; #pragma clang diagnostic pop template <size_t I, typename T, size_t X> constexpr T& get(base::span<T, X> s) noexcept { static_assert(base::dynamic_extent != X, "std::get<> not supported for base::span<T, dynamic_extent>"); static_assert(I < X, "Index out of bounds in std::get<> (base::span)"); return s[I]; } } namespace base { uint32_t Hash(const void* data, size_t length); uint32_t Hash(const std::string& str); uint32_t Hash(const string16& str); size_t FastHash(base::span<const uint8_t> data); inline size_t FastHash(StringPiece str) { return FastHash(as_bytes(make_span(str))); } uint32_t PersistentHash(base::span<const uint8_t> data); uint32_t PersistentHash(const void* data, size_t length); uint32_t PersistentHash(const std::string& str); size_t HashInts32(uint32_t value1, uint32_t value2); size_t HashInts64(uint64_t value1, uint64_t value2); template <typename T1, typename T2> inline size_t HashInts(T1 value1, T2 value2) { if (sizeof(T1) > sizeof(uint32_t) || (sizeof(T2) > sizeof(uint32_t))) return HashInts64(value1, value2); return HashInts32(static_cast<uint32_t>(value1), static_cast<uint32_t>(value2)); } template <typename T> struct IntPairHash; template <typename Type1, typename Type2> struct IntPairHash<std::pair<Type1, Type2>> { size_t operator()(std::pair<Type1, Type2> value) const { return HashInts(value.first, value.second); } }; } namespace base { class Location { public: Location(); Location(const Location& other); Location(const char* file_name, const void* program_counter); Location(const char* function_name, const char* file_name, int line_number, const void* program_counter); bool operator==(const Location& other) const { return program_counter_ == other.program_counter_; } bool has_source_info() const { return function_name_ && file_name_; } const char* function_name() const { return function_name_; } const char* file_name() const { return file_name_; } int line_number() const { return line_number_; } const void* program_counter() const { return program_counter_; } std::string ToString() const; static Location CreateFromHere(const char* file_name); static Location CreateFromHere(const char* function_name, const char* file_name, int line_number); static Location Current(const char* function_name = __builtin_FUNCTION(), const char* file_name = __builtin_FILE(), int line_number = __builtin_LINE()); private: const char* function_name_ = nullptr; const char* file_name_ = nullptr; int line_number_ = -1; const void* program_counter_ = nullptr; }; const void* GetProgramCounter(); } namespace std { template <> struct hash<::base::Location> { std::size_t operator()(const ::base::Location& loc) const { const void* program_counter = loc.program_counter(); return base::FastHash(base::as_bytes(base::make_span(&program_counter, 1))); } }; } static __inline__ int __attribute__((__always_inline__, __nodebug__)) __bsfd(int __A) { return __builtin_ctz(__A); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) __bsrd(int __A) { return 31 - __builtin_clz(__A); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) __bswapd(int __A) { return __builtin_bswap32(__A); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _bswap(int __A) { return __builtin_bswap32(__A); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) __bsfq(long long __A) { return __builtin_ctzll(__A); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) __bsrq(long long __A) { return 63 - __builtin_clzll(__A); } static __inline__ long long __attribute__((__always_inline__, __nodebug__)) __bswapq(long long __A) { return __builtin_bswap64(__A); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) __popcntd(unsigned int __A) { return __builtin_popcount(__A); } static __inline__ long long __attribute__((__always_inline__, __nodebug__)) __popcntq(unsigned long long __A) { return __builtin_popcountll(__A); } static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__)) __readeflags(void) { return __builtin_ia32_readeflags_u64(); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) __writeeflags(unsigned long long __f) { __builtin_ia32_writeeflags_u64(__f); } static __inline__ unsigned int __attribute__((__always_inline__)) _castf32_u32(float __A) { unsigned int D; __builtin_memcpy(&D, &__A, sizeof(__A)); return D; } static __inline__ unsigned long long __attribute__((__always_inline__)) _castf64_u64(double __A) { unsigned long long D; __builtin_memcpy(&D, &__A, sizeof(__A)); return D; } static __inline__ float __attribute__((__always_inline__)) _castu32_f32(unsigned int __A) { float D; __builtin_memcpy(&D, &__A, sizeof(__A)); return D; } static __inline__ double __attribute__((__always_inline__)) _castu64_f64(unsigned long long __A) { double D; __builtin_memcpy(&D, &__A, sizeof(__A)); return D; } static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("sse4.2"))) __crc32b(unsigned int __C, unsigned char __D) { return __builtin_ia32_crc32qi(__C, __D); } static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("sse4.2"))) __crc32w(unsigned int __C, unsigned short __D) { return __builtin_ia32_crc32hi(__C, __D); } static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("sse4.2"))) __crc32d(unsigned int __C, unsigned int __D) { return __builtin_ia32_crc32si(__C, __D); } static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__, __target__("sse4.2"))) __crc32q(unsigned long long __C, unsigned long long __D) { return __builtin_ia32_crc32di(__C, __D); } static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__)) __rdpmc(int __A) { return __builtin_ia32_rdpmc(__A); } static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__)) __rdtscp(unsigned int *__A) { return __builtin_ia32_rdtscp(__A); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _wbinvd(void) { __builtin_ia32_wbinvd(); } static __inline__ unsigned char __attribute__((__always_inline__, __nodebug__)) __rolb(unsigned char __X, int __C) { return __builtin_rotateleft8(__X, __C); } static __inline__ unsigned char __attribute__((__always_inline__, __nodebug__)) __rorb(unsigned char __X, int __C) { return __builtin_rotateright8(__X, __C); } static __inline__ unsigned short __attribute__((__always_inline__, __nodebug__)) __rolw(unsigned short __X, int __C) { return __builtin_rotateleft16(__X, __C); } static __inline__ unsigned short __attribute__((__always_inline__, __nodebug__)) __rorw(unsigned short __X, int __C) { return __builtin_rotateright16(__X, __C); } static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__)) __rold(unsigned int __X, int __C) { return __builtin_rotateleft32(__X, __C); } static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__)) __rord(unsigned int __X, int __C) { return __builtin_rotateright32(__X, __C); } static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__)) __rolq(unsigned long long __X, int __C) { return __builtin_rotateleft64(__X, __C); } static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__)) __rorq(unsigned long long __X, int __C) { return __builtin_rotateright64(__X, __C); } typedef long long __m64 __attribute__((__vector_size__(8), __aligned__(8))); typedef long long __v1di __attribute__((__vector_size__(8))); typedef int __v2si __attribute__((__vector_size__(8))); typedef short __v4hi __attribute__((__vector_size__(8))); typedef char __v8qi __attribute__((__vector_size__(8))); static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("mmx"))) _mm_empty(void) { __builtin_ia32_emms(); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_cvtsi32_si64(int __i) { return (__m64)__builtin_ia32_vec_init_v2si(__i, 0); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_cvtsi64_si32(__m64 __m) { return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_cvtsi64_m64(long long __i) { return (__m64)__i; } static __inline__ long long __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_cvtm64_si64(__m64 __m) { return (long long)__m; } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_packs_pi16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_packs_pi32(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_packs_pu16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_unpackhi_pi8(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_unpackhi_pi16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_unpackhi_pi32(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_unpacklo_pi8(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_unpacklo_pi16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_unpacklo_pi32(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_add_pi8(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_add_pi16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_add_pi32(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_adds_pi8(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_paddsb((__v8qi)__m1, (__v8qi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_adds_pi16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_paddsw((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_adds_pu8(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_paddusb((__v8qi)__m1, (__v8qi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_adds_pu16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_paddusw((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_sub_pi8(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_psubb((__v8qi)__m1, (__v8qi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_sub_pi16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_psubw((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_sub_pi32(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_psubd((__v2si)__m1, (__v2si)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_subs_pi8(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_psubsb((__v8qi)__m1, (__v8qi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_subs_pi16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_psubsw((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_subs_pu8(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_psubusb((__v8qi)__m1, (__v8qi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_subs_pu16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_psubusw((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_madd_pi16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_pmaddwd((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_mulhi_pi16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_pmulhw((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_mullo_pi16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_pmullw((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_sll_pi16(__m64 __m, __m64 __count) { return (__m64)__builtin_ia32_psllw((__v4hi)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_slli_pi16(__m64 __m, int __count) { return (__m64)__builtin_ia32_psllwi((__v4hi)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_sll_pi32(__m64 __m, __m64 __count) { return (__m64)__builtin_ia32_pslld((__v2si)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_slli_pi32(__m64 __m, int __count) { return (__m64)__builtin_ia32_pslldi((__v2si)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_sll_si64(__m64 __m, __m64 __count) { return (__m64)__builtin_ia32_psllq((__v1di)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_slli_si64(__m64 __m, int __count) { return (__m64)__builtin_ia32_psllqi((__v1di)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_sra_pi16(__m64 __m, __m64 __count) { return (__m64)__builtin_ia32_psraw((__v4hi)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_srai_pi16(__m64 __m, int __count) { return (__m64)__builtin_ia32_psrawi((__v4hi)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_sra_pi32(__m64 __m, __m64 __count) { return (__m64)__builtin_ia32_psrad((__v2si)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_srai_pi32(__m64 __m, int __count) { return (__m64)__builtin_ia32_psradi((__v2si)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_srl_pi16(__m64 __m, __m64 __count) { return (__m64)__builtin_ia32_psrlw((__v4hi)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_srli_pi16(__m64 __m, int __count) { return (__m64)__builtin_ia32_psrlwi((__v4hi)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_srl_pi32(__m64 __m, __m64 __count) { return (__m64)__builtin_ia32_psrld((__v2si)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_srli_pi32(__m64 __m, int __count) { return (__m64)__builtin_ia32_psrldi((__v2si)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_srl_si64(__m64 __m, __m64 __count) { return (__m64)__builtin_ia32_psrlq((__v1di)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_srli_si64(__m64 __m, int __count) { return (__m64)__builtin_ia32_psrlqi((__v1di)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_and_si64(__m64 __m1, __m64 __m2) { return __builtin_ia32_pand((__v1di)__m1, (__v1di)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_andnot_si64(__m64 __m1, __m64 __m2) { return __builtin_ia32_pandn((__v1di)__m1, (__v1di)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_or_si64(__m64 __m1, __m64 __m2) { return __builtin_ia32_por((__v1di)__m1, (__v1di)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_xor_si64(__m64 __m1, __m64 __m2) { return __builtin_ia32_pxor((__v1di)__m1, (__v1di)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_cmpeq_pi8(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_pcmpeqb((__v8qi)__m1, (__v8qi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_cmpeq_pi16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_pcmpeqw((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_cmpeq_pi32(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_pcmpeqd((__v2si)__m1, (__v2si)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_cmpgt_pi8(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_pcmpgtb((__v8qi)__m1, (__v8qi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_cmpgt_pi16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_pcmpgtw((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_cmpgt_pi32(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_pcmpgtd((__v2si)__m1, (__v2si)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_setzero_si64(void) { return __extension__ (__m64){ 0LL }; } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_set_pi32(int __i1, int __i0) { return (__m64)__builtin_ia32_vec_init_v2si(__i0, __i1); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_set_pi16(short __s3, short __s2, short __s1, short __s0) { return (__m64)__builtin_ia32_vec_init_v4hi(__s0, __s1, __s2, __s3); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_set_pi8(char __b7, char __b6, char __b5, char __b4, char __b3, char __b2, char __b1, char __b0) { return (__m64)__builtin_ia32_vec_init_v8qi(__b0, __b1, __b2, __b3, __b4, __b5, __b6, __b7); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_set1_pi32(int __i) { return _mm_set_pi32(__i, __i); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_set1_pi16(short __w) { return _mm_set_pi16(__w, __w, __w, __w); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_set1_pi8(char __b) { return _mm_set_pi8(__b, __b, __b, __b, __b, __b, __b, __b); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_setr_pi32(int __i0, int __i1) { return _mm_set_pi32(__i1, __i0); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_setr_pi16(short __w0, short __w1, short __w2, short __w3) { return _mm_set_pi16(__w3, __w2, __w1, __w0); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64))) _mm_setr_pi8(char __b0, char __b1, char __b2, char __b3, char __b4, char __b5, char __b6, char __b7) { return _mm_set_pi8(__b7, __b6, __b5, __b4, __b3, __b2, __b1, __b0); } typedef int __v4si __attribute__((__vector_size__(16))); typedef float __v4sf __attribute__((__vector_size__(16))); typedef float __m128 __attribute__((__vector_size__(16), __aligned__(16))); typedef float __m128_u __attribute__((__vector_size__(16), __aligned__(1))); typedef unsigned int __v4su __attribute__((__vector_size__(16))); #pragma pack(push, 8) extern "C" { typedef struct _heapinfo { int* _pentry; size_t _size; int _useflag; } _HEAPINFO; void* __cdecl _alloca( size_t _Size); intptr_t __cdecl _get_heap_handle(void); int __cdecl _heapmin(void); int __cdecl _heapwalk( _HEAPINFO* _EntryInfo); int __cdecl _heapchk(void); int __cdecl _resetstkoflw(void); typedef char __static_assert_t[(sizeof(unsigned int) <= 16) != 0]; #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)0); } } } #pragma warning(pop) } #pragma pack(pop) static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_add_ss(__m128 __a, __m128 __b) { __a[0] += __b[0]; return __a; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_add_ps(__m128 __a, __m128 __b) { return (__m128)((__v4sf)__a + (__v4sf)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_sub_ss(__m128 __a, __m128 __b) { __a[0] -= __b[0]; return __a; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_sub_ps(__m128 __a, __m128 __b) { return (__m128)((__v4sf)__a - (__v4sf)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_mul_ss(__m128 __a, __m128 __b) { __a[0] *= __b[0]; return __a; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_mul_ps(__m128 __a, __m128 __b) { return (__m128)((__v4sf)__a * (__v4sf)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_div_ss(__m128 __a, __m128 __b) { __a[0] /= __b[0]; return __a; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_div_ps(__m128 __a, __m128 __b) { return (__m128)((__v4sf)__a / (__v4sf)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_sqrt_ss(__m128 __a) { return (__m128)__builtin_ia32_sqrtss((__v4sf)__a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_sqrt_ps(__m128 __a) { return __builtin_ia32_sqrtps((__v4sf)__a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_rcp_ss(__m128 __a) { return (__m128)__builtin_ia32_rcpss((__v4sf)__a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_rcp_ps(__m128 __a) { return (__m128)__builtin_ia32_rcpps((__v4sf)__a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_rsqrt_ss(__m128 __a) { return __builtin_ia32_rsqrtss((__v4sf)__a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_rsqrt_ps(__m128 __a) { return __builtin_ia32_rsqrtps((__v4sf)__a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_min_ss(__m128 __a, __m128 __b) { return __builtin_ia32_minss((__v4sf)__a, (__v4sf)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_min_ps(__m128 __a, __m128 __b) { return __builtin_ia32_minps((__v4sf)__a, (__v4sf)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_max_ss(__m128 __a, __m128 __b) { return __builtin_ia32_maxss((__v4sf)__a, (__v4sf)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_max_ps(__m128 __a, __m128 __b) { return __builtin_ia32_maxps((__v4sf)__a, (__v4sf)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_and_ps(__m128 __a, __m128 __b) { return (__m128)((__v4su)__a & (__v4su)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_andnot_ps(__m128 __a, __m128 __b) { return (__m128)(~(__v4su)__a & (__v4su)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_or_ps(__m128 __a, __m128 __b) { return (__m128)((__v4su)__a | (__v4su)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_xor_ps(__m128 __a, __m128 __b) { return (__m128)((__v4su)__a ^ (__v4su)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cmpeq_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpeqss((__v4sf)__a, (__v4sf)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cmpeq_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpeqps((__v4sf)__a, (__v4sf)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cmplt_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpltss((__v4sf)__a, (__v4sf)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cmplt_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpltps((__v4sf)__a, (__v4sf)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cmple_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpless((__v4sf)__a, (__v4sf)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cmple_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpleps((__v4sf)__a, (__v4sf)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cmpgt_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_shufflevector((__v4sf)__a, (__v4sf)__builtin_ia32_cmpltss((__v4sf)__b, (__v4sf)__a), 4, 1, 2, 3); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cmpgt_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpltps((__v4sf)__b, (__v4sf)__a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cmpge_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_shufflevector((__v4sf)__a, (__v4sf)__builtin_ia32_cmpless((__v4sf)__b, (__v4sf)__a), 4, 1, 2, 3); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cmpge_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpleps((__v4sf)__b, (__v4sf)__a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cmpneq_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpneqss((__v4sf)__a, (__v4sf)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cmpneq_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpneqps((__v4sf)__a, (__v4sf)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cmpnlt_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpnltss((__v4sf)__a, (__v4sf)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cmpnlt_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpnltps((__v4sf)__a, (__v4sf)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cmpnle_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpnless((__v4sf)__a, (__v4sf)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cmpnle_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpnleps((__v4sf)__a, (__v4sf)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cmpngt_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_shufflevector((__v4sf)__a, (__v4sf)__builtin_ia32_cmpnltss((__v4sf)__b, (__v4sf)__a), 4, 1, 2, 3); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cmpngt_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpnltps((__v4sf)__b, (__v4sf)__a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cmpnge_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_shufflevector((__v4sf)__a, (__v4sf)__builtin_ia32_cmpnless((__v4sf)__b, (__v4sf)__a), 4, 1, 2, 3); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cmpnge_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpnleps((__v4sf)__b, (__v4sf)__a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cmpord_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpordss((__v4sf)__a, (__v4sf)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cmpord_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpordps((__v4sf)__a, (__v4sf)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cmpunord_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpunordss((__v4sf)__a, (__v4sf)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cmpunord_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpunordps((__v4sf)__a, (__v4sf)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_comieq_ss(__m128 __a, __m128 __b) { return __builtin_ia32_comieq((__v4sf)__a, (__v4sf)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_comilt_ss(__m128 __a, __m128 __b) { return __builtin_ia32_comilt((__v4sf)__a, (__v4sf)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_comile_ss(__m128 __a, __m128 __b) { return __builtin_ia32_comile((__v4sf)__a, (__v4sf)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_comigt_ss(__m128 __a, __m128 __b) { return __builtin_ia32_comigt((__v4sf)__a, (__v4sf)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_comige_ss(__m128 __a, __m128 __b) { return __builtin_ia32_comige((__v4sf)__a, (__v4sf)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_comineq_ss(__m128 __a, __m128 __b) { return __builtin_ia32_comineq((__v4sf)__a, (__v4sf)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_ucomieq_ss(__m128 __a, __m128 __b) { return __builtin_ia32_ucomieq((__v4sf)__a, (__v4sf)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_ucomilt_ss(__m128 __a, __m128 __b) { return __builtin_ia32_ucomilt((__v4sf)__a, (__v4sf)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_ucomile_ss(__m128 __a, __m128 __b) { return __builtin_ia32_ucomile((__v4sf)__a, (__v4sf)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_ucomigt_ss(__m128 __a, __m128 __b) { return __builtin_ia32_ucomigt((__v4sf)__a, (__v4sf)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_ucomige_ss(__m128 __a, __m128 __b) { return __builtin_ia32_ucomige((__v4sf)__a, (__v4sf)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_ucomineq_ss(__m128 __a, __m128 __b) { return __builtin_ia32_ucomineq((__v4sf)__a, (__v4sf)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cvtss_si32(__m128 __a) { return __builtin_ia32_cvtss2si((__v4sf)__a); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cvt_ss2si(__m128 __a) { return _mm_cvtss_si32(__a); } static __inline__ long long __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cvtss_si64(__m128 __a) { return __builtin_ia32_cvtss2si64((__v4sf)__a); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse"), __min_vector_width__(64))) _mm_cvtps_pi32(__m128 __a) { return (__m64)__builtin_ia32_cvtps2pi((__v4sf)__a); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse"), __min_vector_width__(64))) _mm_cvt_ps2pi(__m128 __a) { return _mm_cvtps_pi32(__a); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cvttss_si32(__m128 __a) { return __builtin_ia32_cvttss2si((__v4sf)__a); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cvtt_ss2si(__m128 __a) { return _mm_cvttss_si32(__a); } static __inline__ long long __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cvttss_si64(__m128 __a) { return __builtin_ia32_cvttss2si64((__v4sf)__a); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse"), __min_vector_width__(64))) _mm_cvttps_pi32(__m128 __a) { return (__m64)__builtin_ia32_cvttps2pi((__v4sf)__a); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse"), __min_vector_width__(64))) _mm_cvtt_ps2pi(__m128 __a) { return _mm_cvttps_pi32(__a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cvtsi32_ss(__m128 __a, int __b) { __a[0] = __b; return __a; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cvt_si2ss(__m128 __a, int __b) { return _mm_cvtsi32_ss(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cvtsi64_ss(__m128 __a, long long __b) { __a[0] = __b; return __a; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse"), __min_vector_width__(64))) _mm_cvtpi32_ps(__m128 __a, __m64 __b) { return __builtin_ia32_cvtpi2ps((__v4sf)__a, (__v2si)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse"), __min_vector_width__(64))) _mm_cvt_pi2ps(__m128 __a, __m64 __b) { return _mm_cvtpi32_ps(__a, __b); } static __inline__ float __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_cvtss_f32(__m128 __a) { return __a[0]; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_loadh_pi(__m128 __a, const __m64 *__p) { typedef float __mm_loadh_pi_v2f32 __attribute__((__vector_size__(8))); struct __mm_loadh_pi_struct { __mm_loadh_pi_v2f32 __u; } __attribute__((__packed__, __may_alias__)); __mm_loadh_pi_v2f32 __b = ((const struct __mm_loadh_pi_struct*)__p)->__u; __m128 __bb = __builtin_shufflevector(__b, __b, 0, 1, 0, 1); return __builtin_shufflevector(__a, __bb, 0, 1, 4, 5); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_loadl_pi(__m128 __a, const __m64 *__p) { typedef float __mm_loadl_pi_v2f32 __attribute__((__vector_size__(8))); struct __mm_loadl_pi_struct { __mm_loadl_pi_v2f32 __u; } __attribute__((__packed__, __may_alias__)); __mm_loadl_pi_v2f32 __b = ((const struct __mm_loadl_pi_struct*)__p)->__u; __m128 __bb = __builtin_shufflevector(__b, __b, 0, 1, 0, 1); return __builtin_shufflevector(__a, __bb, 4, 5, 2, 3); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_load_ss(const float *__p) { struct __mm_load_ss_struct { float __u; } __attribute__((__packed__, __may_alias__)); float __u = ((const struct __mm_load_ss_struct*)__p)->__u; return __extension__ (__m128){ __u, 0, 0, 0 }; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_load1_ps(const float *__p) { struct __mm_load1_ps_struct { float __u; } __attribute__((__packed__, __may_alias__)); float __u = ((const struct __mm_load1_ps_struct*)__p)->__u; return __extension__ (__m128){ __u, __u, __u, __u }; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_load_ps(const float *__p) { return *(const __m128*)__p; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_loadu_ps(const float *__p) { struct __loadu_ps { __m128_u __v; } __attribute__((__packed__, __may_alias__)); return ((const struct __loadu_ps*)__p)->__v; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_loadr_ps(const float *__p) { __m128 __a = _mm_load_ps(__p); return __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 3, 2, 1, 0); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_undefined_ps(void) { return (__m128)__builtin_ia32_undef128(); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_set_ss(float __w) { return __extension__ (__m128){ __w, 0, 0, 0 }; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_set1_ps(float __w) { return __extension__ (__m128){ __w, __w, __w, __w }; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_set_ps1(float __w) { return _mm_set1_ps(__w); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_set_ps(float __z, float __y, float __x, float __w) { return __extension__ (__m128){ __w, __x, __y, __z }; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_setr_ps(float __z, float __y, float __x, float __w) { return __extension__ (__m128){ __z, __y, __x, __w }; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_setzero_ps(void) { return __extension__ (__m128){ 0, 0, 0, 0 }; } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_storeh_pi(__m64 *__p, __m128 __a) { typedef float __mm_storeh_pi_v2f32 __attribute__((__vector_size__(8))); struct __mm_storeh_pi_struct { __mm_storeh_pi_v2f32 __u; } __attribute__((__packed__, __may_alias__)); ((struct __mm_storeh_pi_struct*)__p)->__u = __builtin_shufflevector(__a, __a, 2, 3); } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_storel_pi(__m64 *__p, __m128 __a) { typedef float __mm_storeh_pi_v2f32 __attribute__((__vector_size__(8))); struct __mm_storeh_pi_struct { __mm_storeh_pi_v2f32 __u; } __attribute__((__packed__, __may_alias__)); ((struct __mm_storeh_pi_struct*)__p)->__u = __builtin_shufflevector(__a, __a, 0, 1); } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_store_ss(float *__p, __m128 __a) { struct __mm_store_ss_struct { float __u; } __attribute__((__packed__, __may_alias__)); ((struct __mm_store_ss_struct*)__p)->__u = __a[0]; } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_storeu_ps(float *__p, __m128 __a) { struct __storeu_ps { __m128_u __v; } __attribute__((__packed__, __may_alias__)); ((struct __storeu_ps*)__p)->__v = __a; } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_store_ps(float *__p, __m128 __a) { *(__m128*)__p = __a; } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_store1_ps(float *__p, __m128 __a) { __a = __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 0, 0, 0, 0); _mm_store_ps(__p, __a); } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_store_ps1(float *__p, __m128 __a) { _mm_store1_ps(__p, __a); } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_storer_ps(float *__p, __m128 __a) { __a = __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 3, 2, 1, 0); _mm_store_ps(__p, __a); } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse"), __min_vector_width__(64))) _mm_stream_pi(__m64 *__p, __m64 __a) { __builtin_ia32_movntq(__p, __a); } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_stream_ps(float *__p, __m128 __a) { __builtin_nontemporal_store((__v4sf)__a, (__v4sf*)__p); } extern "C" { void _mm_sfence(void); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse"), __min_vector_width__(64))) _mm_max_pi16(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_pmaxsw((__v4hi)__a, (__v4hi)__b); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse"), __min_vector_width__(64))) _mm_max_pu8(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_pmaxub((__v8qi)__a, (__v8qi)__b); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse"), __min_vector_width__(64))) _mm_min_pi16(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_pminsw((__v4hi)__a, (__v4hi)__b); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse"), __min_vector_width__(64))) _mm_min_pu8(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_pminub((__v8qi)__a, (__v8qi)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse"), __min_vector_width__(64))) _mm_movemask_pi8(__m64 __a) { return __builtin_ia32_pmovmskb((__v8qi)__a); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse"), __min_vector_width__(64))) _mm_mulhi_pu16(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_pmulhuw((__v4hi)__a, (__v4hi)__b); } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse"), __min_vector_width__(64))) _mm_maskmove_si64(__m64 __d, __m64 __n, char *__p) { __builtin_ia32_maskmovq((__v8qi)__d, (__v8qi)__n, __p); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse"), __min_vector_width__(64))) _mm_avg_pu8(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_pavgb((__v8qi)__a, (__v8qi)__b); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse"), __min_vector_width__(64))) _mm_avg_pu16(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_pavgw((__v4hi)__a, (__v4hi)__b); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse"), __min_vector_width__(64))) _mm_sad_pu8(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_psadbw((__v8qi)__a, (__v8qi)__b); } extern "C" { unsigned int _mm_getcsr(void); void _mm_setcsr(unsigned int __i); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_unpackhi_ps(__m128 __a, __m128 __b) { return __builtin_shufflevector((__v4sf)__a, (__v4sf)__b, 2, 6, 3, 7); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_unpacklo_ps(__m128 __a, __m128 __b) { return __builtin_shufflevector((__v4sf)__a, (__v4sf)__b, 0, 4, 1, 5); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_move_ss(__m128 __a, __m128 __b) { __a[0] = __b[0]; return __a; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_movehl_ps(__m128 __a, __m128 __b) { return __builtin_shufflevector((__v4sf)__a, (__v4sf)__b, 6, 7, 2, 3); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_movelh_ps(__m128 __a, __m128 __b) { return __builtin_shufflevector((__v4sf)__a, (__v4sf)__b, 0, 1, 4, 5); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse"), __min_vector_width__(64))) _mm_cvtpi16_ps(__m64 __a) { __m64 __b, __c; __m128 __r; __b = _mm_setzero_si64(); __b = _mm_cmpgt_pi16(__b, __a); __c = _mm_unpackhi_pi16(__a, __b); __r = _mm_setzero_ps(); __r = _mm_cvtpi32_ps(__r, __c); __r = _mm_movelh_ps(__r, __r); __c = _mm_unpacklo_pi16(__a, __b); __r = _mm_cvtpi32_ps(__r, __c); return __r; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse"), __min_vector_width__(64))) _mm_cvtpu16_ps(__m64 __a) { __m64 __b, __c; __m128 __r; __b = _mm_setzero_si64(); __c = _mm_unpackhi_pi16(__a, __b); __r = _mm_setzero_ps(); __r = _mm_cvtpi32_ps(__r, __c); __r = _mm_movelh_ps(__r, __r); __c = _mm_unpacklo_pi16(__a, __b); __r = _mm_cvtpi32_ps(__r, __c); return __r; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse"), __min_vector_width__(64))) _mm_cvtpi8_ps(__m64 __a) { __m64 __b; __b = _mm_setzero_si64(); __b = _mm_cmpgt_pi8(__b, __a); __b = _mm_unpacklo_pi8(__a, __b); return _mm_cvtpi16_ps(__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse"), __min_vector_width__(64))) _mm_cvtpu8_ps(__m64 __a) { __m64 __b; __b = _mm_setzero_si64(); __b = _mm_unpacklo_pi8(__a, __b); return _mm_cvtpi16_ps(__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse"), __min_vector_width__(64))) _mm_cvtpi32x2_ps(__m64 __a, __m64 __b) { __m128 __c; __c = _mm_setzero_ps(); __c = _mm_cvtpi32_ps(__c, __b); __c = _mm_movelh_ps(__c, __c); return _mm_cvtpi32_ps(__c, __a); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse"), __min_vector_width__(64))) _mm_cvtps_pi16(__m128 __a) { __m64 __b, __c; __b = _mm_cvtps_pi32(__a); __a = _mm_movehl_ps(__a, __a); __c = _mm_cvtps_pi32(__a); return _mm_packs_pi32(__b, __c); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse"), __min_vector_width__(64))) _mm_cvtps_pi8(__m128 __a) { __m64 __b, __c; __b = _mm_cvtps_pi16(__a); __c = _mm_setzero_si64(); return _mm_packs_pi16(__b, __c); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse"), __min_vector_width__(128))) _mm_movemask_ps(__m128 __a) { return __builtin_ia32_movmskps((__v4sf)__a); } typedef double __m128d __attribute__((__vector_size__(16), __aligned__(16))); typedef long long __m128i __attribute__((__vector_size__(16), __aligned__(16))); typedef double __m128d_u __attribute__((__vector_size__(16), __aligned__(1))); typedef long long __m128i_u __attribute__((__vector_size__(16), __aligned__(1))); typedef double __v2df __attribute__ ((__vector_size__ (16))); typedef long long __v2di __attribute__ ((__vector_size__ (16))); typedef short __v8hi __attribute__((__vector_size__(16))); typedef char __v16qi __attribute__((__vector_size__(16))); typedef unsigned long long __v2du __attribute__ ((__vector_size__ (16))); typedef unsigned short __v8hu __attribute__((__vector_size__(16))); typedef unsigned char __v16qu __attribute__((__vector_size__(16))); typedef signed char __v16qs __attribute__((__vector_size__(16))); static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_add_sd(__m128d __a, __m128d __b) { __a[0] += __b[0]; return __a; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_add_pd(__m128d __a, __m128d __b) { return (__m128d)((__v2df)__a + (__v2df)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_sub_sd(__m128d __a, __m128d __b) { __a[0] -= __b[0]; return __a; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_sub_pd(__m128d __a, __m128d __b) { return (__m128d)((__v2df)__a - (__v2df)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_mul_sd(__m128d __a, __m128d __b) { __a[0] *= __b[0]; return __a; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_mul_pd(__m128d __a, __m128d __b) { return (__m128d)((__v2df)__a * (__v2df)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_div_sd(__m128d __a, __m128d __b) { __a[0] /= __b[0]; return __a; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_div_pd(__m128d __a, __m128d __b) { return (__m128d)((__v2df)__a / (__v2df)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_sqrt_sd(__m128d __a, __m128d __b) { __m128d __c = __builtin_ia32_sqrtsd((__v2df)__b); return __extension__ (__m128d) { __c[0], __a[1] }; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_sqrt_pd(__m128d __a) { return __builtin_ia32_sqrtpd((__v2df)__a); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_min_sd(__m128d __a, __m128d __b) { return __builtin_ia32_minsd((__v2df)__a, (__v2df)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_min_pd(__m128d __a, __m128d __b) { return __builtin_ia32_minpd((__v2df)__a, (__v2df)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_max_sd(__m128d __a, __m128d __b) { return __builtin_ia32_maxsd((__v2df)__a, (__v2df)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_max_pd(__m128d __a, __m128d __b) { return __builtin_ia32_maxpd((__v2df)__a, (__v2df)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_and_pd(__m128d __a, __m128d __b) { return (__m128d)((__v2du)__a & (__v2du)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_andnot_pd(__m128d __a, __m128d __b) { return (__m128d)(~(__v2du)__a & (__v2du)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_or_pd(__m128d __a, __m128d __b) { return (__m128d)((__v2du)__a | (__v2du)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_xor_pd(__m128d __a, __m128d __b) { return (__m128d)((__v2du)__a ^ (__v2du)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpeq_pd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpeqpd((__v2df)__a, (__v2df)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmplt_pd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpltpd((__v2df)__a, (__v2df)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmple_pd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmplepd((__v2df)__a, (__v2df)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpgt_pd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpltpd((__v2df)__b, (__v2df)__a); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpge_pd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmplepd((__v2df)__b, (__v2df)__a); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpord_pd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpordpd((__v2df)__a, (__v2df)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpunord_pd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpunordpd((__v2df)__a, (__v2df)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpneq_pd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpneqpd((__v2df)__a, (__v2df)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpnlt_pd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpnltpd((__v2df)__a, (__v2df)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpnle_pd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpnlepd((__v2df)__a, (__v2df)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpngt_pd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpnltpd((__v2df)__b, (__v2df)__a); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpnge_pd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpnlepd((__v2df)__b, (__v2df)__a); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpeq_sd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpeqsd((__v2df)__a, (__v2df)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmplt_sd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpltsd((__v2df)__a, (__v2df)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmple_sd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmplesd((__v2df)__a, (__v2df)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpgt_sd(__m128d __a, __m128d __b) { __m128d __c = __builtin_ia32_cmpltsd((__v2df)__b, (__v2df)__a); return __extension__ (__m128d) { __c[0], __a[1] }; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpge_sd(__m128d __a, __m128d __b) { __m128d __c = __builtin_ia32_cmplesd((__v2df)__b, (__v2df)__a); return __extension__ (__m128d) { __c[0], __a[1] }; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpord_sd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpordsd((__v2df)__a, (__v2df)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpunord_sd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpunordsd((__v2df)__a, (__v2df)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpneq_sd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpneqsd((__v2df)__a, (__v2df)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpnlt_sd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpnltsd((__v2df)__a, (__v2df)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpnle_sd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpnlesd((__v2df)__a, (__v2df)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpngt_sd(__m128d __a, __m128d __b) { __m128d __c = __builtin_ia32_cmpnltsd((__v2df)__b, (__v2df)__a); return __extension__ (__m128d) { __c[0], __a[1] }; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpnge_sd(__m128d __a, __m128d __b) { __m128d __c = __builtin_ia32_cmpnlesd((__v2df)__b, (__v2df)__a); return __extension__ (__m128d) { __c[0], __a[1] }; } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_comieq_sd(__m128d __a, __m128d __b) { return __builtin_ia32_comisdeq((__v2df)__a, (__v2df)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_comilt_sd(__m128d __a, __m128d __b) { return __builtin_ia32_comisdlt((__v2df)__a, (__v2df)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_comile_sd(__m128d __a, __m128d __b) { return __builtin_ia32_comisdle((__v2df)__a, (__v2df)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_comigt_sd(__m128d __a, __m128d __b) { return __builtin_ia32_comisdgt((__v2df)__a, (__v2df)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_comige_sd(__m128d __a, __m128d __b) { return __builtin_ia32_comisdge((__v2df)__a, (__v2df)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_comineq_sd(__m128d __a, __m128d __b) { return __builtin_ia32_comisdneq((__v2df)__a, (__v2df)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_ucomieq_sd(__m128d __a, __m128d __b) { return __builtin_ia32_ucomisdeq((__v2df)__a, (__v2df)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_ucomilt_sd(__m128d __a, __m128d __b) { return __builtin_ia32_ucomisdlt((__v2df)__a, (__v2df)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_ucomile_sd(__m128d __a, __m128d __b) { return __builtin_ia32_ucomisdle((__v2df)__a, (__v2df)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_ucomigt_sd(__m128d __a, __m128d __b) { return __builtin_ia32_ucomisdgt((__v2df)__a, (__v2df)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_ucomige_sd(__m128d __a, __m128d __b) { return __builtin_ia32_ucomisdge((__v2df)__a, (__v2df)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_ucomineq_sd(__m128d __a, __m128d __b) { return __builtin_ia32_ucomisdneq((__v2df)__a, (__v2df)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cvtpd_ps(__m128d __a) { return __builtin_ia32_cvtpd2ps((__v2df)__a); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cvtps_pd(__m128 __a) { return (__m128d) __builtin_convertvector( __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 0, 1), __v2df); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cvtepi32_pd(__m128i __a) { return (__m128d) __builtin_convertvector( __builtin_shufflevector((__v4si)__a, (__v4si)__a, 0, 1), __v2df); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cvtpd_epi32(__m128d __a) { return __builtin_ia32_cvtpd2dq((__v2df)__a); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cvtsd_si32(__m128d __a) { return __builtin_ia32_cvtsd2si((__v2df)__a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cvtsd_ss(__m128 __a, __m128d __b) { return (__m128)__builtin_ia32_cvtsd2ss((__v4sf)__a, (__v2df)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cvtsi32_sd(__m128d __a, int __b) { __a[0] = __b; return __a; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cvtss_sd(__m128d __a, __m128 __b) { __a[0] = __b[0]; return __a; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cvttpd_epi32(__m128d __a) { return (__m128i)__builtin_ia32_cvttpd2dq((__v2df)__a); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cvttsd_si32(__m128d __a) { return __builtin_ia32_cvttsd2si((__v2df)__a); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse2"), __min_vector_width__(64))) _mm_cvtpd_pi32(__m128d __a) { return (__m64)__builtin_ia32_cvtpd2pi((__v2df)__a); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse2"), __min_vector_width__(64))) _mm_cvttpd_pi32(__m128d __a) { return (__m64)__builtin_ia32_cvttpd2pi((__v2df)__a); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse2"), __min_vector_width__(64))) _mm_cvtpi32_pd(__m64 __a) { return __builtin_ia32_cvtpi2pd((__v2si)__a); } static __inline__ double __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cvtsd_f64(__m128d __a) { return __a[0]; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_load_pd(double const *__dp) { return *(const __m128d*)__dp; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_load1_pd(double const *__dp) { struct __mm_load1_pd_struct { double __u; } __attribute__((__packed__, __may_alias__)); double __u = ((const struct __mm_load1_pd_struct*)__dp)->__u; return __extension__ (__m128d){ __u, __u }; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_loadr_pd(double const *__dp) { __m128d __u = *(const __m128d*)__dp; return __builtin_shufflevector((__v2df)__u, (__v2df)__u, 1, 0); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_loadu_pd(double const *__dp) { struct __loadu_pd { __m128d_u __v; } __attribute__((__packed__, __may_alias__)); return ((const struct __loadu_pd*)__dp)->__v; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_loadu_si64(void const *__a) { struct __loadu_si64 { long long __v; } __attribute__((__packed__, __may_alias__)); long long __u = ((const struct __loadu_si64*)__a)->__v; return __extension__ (__m128i)(__v2di){__u, 0LL}; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_loadu_si32(void const *__a) { struct __loadu_si32 { int __v; } __attribute__((__packed__, __may_alias__)); int __u = ((const struct __loadu_si32*)__a)->__v; return __extension__ (__m128i)(__v4si){__u, 0, 0, 0}; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_loadu_si16(void const *__a) { struct __loadu_si16 { short __v; } __attribute__((__packed__, __may_alias__)); short __u = ((const struct __loadu_si16*)__a)->__v; return __extension__ (__m128i)(__v8hi){__u, 0, 0, 0, 0, 0, 0, 0}; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_load_sd(double const *__dp) { struct __mm_load_sd_struct { double __u; } __attribute__((__packed__, __may_alias__)); double __u = ((const struct __mm_load_sd_struct*)__dp)->__u; return __extension__ (__m128d){ __u, 0 }; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_loadh_pd(__m128d __a, double const *__dp) { struct __mm_loadh_pd_struct { double __u; } __attribute__((__packed__, __may_alias__)); double __u = ((const struct __mm_loadh_pd_struct*)__dp)->__u; return __extension__ (__m128d){ __a[0], __u }; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_loadl_pd(__m128d __a, double const *__dp) { struct __mm_loadl_pd_struct { double __u; } __attribute__((__packed__, __may_alias__)); double __u = ((const struct __mm_loadl_pd_struct*)__dp)->__u; return __extension__ (__m128d){ __u, __a[1] }; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_undefined_pd(void) { return (__m128d)__builtin_ia32_undef128(); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_set_sd(double __w) { return __extension__ (__m128d){ __w, 0 }; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_set1_pd(double __w) { return __extension__ (__m128d){ __w, __w }; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_set_pd1(double __w) { return _mm_set1_pd(__w); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_set_pd(double __w, double __x) { return __extension__ (__m128d){ __x, __w }; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_setr_pd(double __w, double __x) { return __extension__ (__m128d){ __w, __x }; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_setzero_pd(void) { return __extension__ (__m128d){ 0, 0 }; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_move_sd(__m128d __a, __m128d __b) { __a[0] = __b[0]; return __a; } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_store_sd(double *__dp, __m128d __a) { struct __mm_store_sd_struct { double __u; } __attribute__((__packed__, __may_alias__)); ((struct __mm_store_sd_struct*)__dp)->__u = __a[0]; } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_store_pd(double *__dp, __m128d __a) { *(__m128d*)__dp = __a; } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_store1_pd(double *__dp, __m128d __a) { __a = __builtin_shufflevector((__v2df)__a, (__v2df)__a, 0, 0); _mm_store_pd(__dp, __a); } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_store_pd1(double *__dp, __m128d __a) { _mm_store1_pd(__dp, __a); } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_storeu_pd(double *__dp, __m128d __a) { struct __storeu_pd { __m128d_u __v; } __attribute__((__packed__, __may_alias__)); ((struct __storeu_pd*)__dp)->__v = __a; } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_storer_pd(double *__dp, __m128d __a) { __a = __builtin_shufflevector((__v2df)__a, (__v2df)__a, 1, 0); *(__m128d *)__dp = __a; } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_storeh_pd(double *__dp, __m128d __a) { struct __mm_storeh_pd_struct { double __u; } __attribute__((__packed__, __may_alias__)); ((struct __mm_storeh_pd_struct*)__dp)->__u = __a[1]; } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_storel_pd(double *__dp, __m128d __a) { struct __mm_storeh_pd_struct { double __u; } __attribute__((__packed__, __may_alias__)); ((struct __mm_storeh_pd_struct*)__dp)->__u = __a[0]; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_add_epi8(__m128i __a, __m128i __b) { return (__m128i)((__v16qu)__a + (__v16qu)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_add_epi16(__m128i __a, __m128i __b) { return (__m128i)((__v8hu)__a + (__v8hu)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_add_epi32(__m128i __a, __m128i __b) { return (__m128i)((__v4su)__a + (__v4su)__b); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse2"), __min_vector_width__(64))) _mm_add_si64(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_paddq((__v1di)__a, (__v1di)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_add_epi64(__m128i __a, __m128i __b) { return (__m128i)((__v2du)__a + (__v2du)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_adds_epi8(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_paddsb128((__v16qi)__a, (__v16qi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_adds_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_paddsw128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_adds_epu8(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_paddusb128((__v16qi)__a, (__v16qi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_adds_epu16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_paddusw128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_avg_epu8(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_pavgb128((__v16qi)__a, (__v16qi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_avg_epu16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_pavgw128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_madd_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_pmaddwd128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_max_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_pmaxsw128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_max_epu8(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_pmaxub128((__v16qi)__a, (__v16qi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_min_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_pminsw128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_min_epu8(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_pminub128((__v16qi)__a, (__v16qi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_mulhi_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_pmulhw128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_mulhi_epu16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_pmulhuw128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_mullo_epi16(__m128i __a, __m128i __b) { return (__m128i)((__v8hu)__a * (__v8hu)__b); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse2"), __min_vector_width__(64))) _mm_mul_su32(__m64 __a, __m64 __b) { return __builtin_ia32_pmuludq((__v2si)__a, (__v2si)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_mul_epu32(__m128i __a, __m128i __b) { return __builtin_ia32_pmuludq128((__v4si)__a, (__v4si)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_sad_epu8(__m128i __a, __m128i __b) { return __builtin_ia32_psadbw128((__v16qi)__a, (__v16qi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_sub_epi8(__m128i __a, __m128i __b) { return (__m128i)((__v16qu)__a - (__v16qu)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_sub_epi16(__m128i __a, __m128i __b) { return (__m128i)((__v8hu)__a - (__v8hu)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_sub_epi32(__m128i __a, __m128i __b) { return (__m128i)((__v4su)__a - (__v4su)__b); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("mmx,sse2"), __min_vector_width__(64))) _mm_sub_si64(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_psubq((__v1di)__a, (__v1di)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_sub_epi64(__m128i __a, __m128i __b) { return (__m128i)((__v2du)__a - (__v2du)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_subs_epi8(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_psubsb128((__v16qi)__a, (__v16qi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_subs_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_psubsw128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_subs_epu8(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_psubusb128((__v16qi)__a, (__v16qi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_subs_epu16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_psubusw128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_and_si128(__m128i __a, __m128i __b) { return (__m128i)((__v2du)__a & (__v2du)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_andnot_si128(__m128i __a, __m128i __b) { return (__m128i)(~(__v2du)__a & (__v2du)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_or_si128(__m128i __a, __m128i __b) { return (__m128i)((__v2du)__a | (__v2du)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_xor_si128(__m128i __a, __m128i __b) { return (__m128i)((__v2du)__a ^ (__v2du)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_slli_epi16(__m128i __a, int __count) { return (__m128i)__builtin_ia32_psllwi128((__v8hi)__a, __count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_sll_epi16(__m128i __a, __m128i __count) { return (__m128i)__builtin_ia32_psllw128((__v8hi)__a, (__v8hi)__count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_slli_epi32(__m128i __a, int __count) { return (__m128i)__builtin_ia32_pslldi128((__v4si)__a, __count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_sll_epi32(__m128i __a, __m128i __count) { return (__m128i)__builtin_ia32_pslld128((__v4si)__a, (__v4si)__count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_slli_epi64(__m128i __a, int __count) { return __builtin_ia32_psllqi128((__v2di)__a, __count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_sll_epi64(__m128i __a, __m128i __count) { return __builtin_ia32_psllq128((__v2di)__a, (__v2di)__count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_srai_epi16(__m128i __a, int __count) { return (__m128i)__builtin_ia32_psrawi128((__v8hi)__a, __count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_sra_epi16(__m128i __a, __m128i __count) { return (__m128i)__builtin_ia32_psraw128((__v8hi)__a, (__v8hi)__count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_srai_epi32(__m128i __a, int __count) { return (__m128i)__builtin_ia32_psradi128((__v4si)__a, __count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_sra_epi32(__m128i __a, __m128i __count) { return (__m128i)__builtin_ia32_psrad128((__v4si)__a, (__v4si)__count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_srli_epi16(__m128i __a, int __count) { return (__m128i)__builtin_ia32_psrlwi128((__v8hi)__a, __count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_srl_epi16(__m128i __a, __m128i __count) { return (__m128i)__builtin_ia32_psrlw128((__v8hi)__a, (__v8hi)__count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_srli_epi32(__m128i __a, int __count) { return (__m128i)__builtin_ia32_psrldi128((__v4si)__a, __count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_srl_epi32(__m128i __a, __m128i __count) { return (__m128i)__builtin_ia32_psrld128((__v4si)__a, (__v4si)__count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_srli_epi64(__m128i __a, int __count) { return __builtin_ia32_psrlqi128((__v2di)__a, __count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_srl_epi64(__m128i __a, __m128i __count) { return __builtin_ia32_psrlq128((__v2di)__a, (__v2di)__count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpeq_epi8(__m128i __a, __m128i __b) { return (__m128i)((__v16qi)__a == (__v16qi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpeq_epi16(__m128i __a, __m128i __b) { return (__m128i)((__v8hi)__a == (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpeq_epi32(__m128i __a, __m128i __b) { return (__m128i)((__v4si)__a == (__v4si)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpgt_epi8(__m128i __a, __m128i __b) { return (__m128i)((__v16qs)__a > (__v16qs)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpgt_epi16(__m128i __a, __m128i __b) { return (__m128i)((__v8hi)__a > (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmpgt_epi32(__m128i __a, __m128i __b) { return (__m128i)((__v4si)__a > (__v4si)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmplt_epi8(__m128i __a, __m128i __b) { return _mm_cmpgt_epi8(__b, __a); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmplt_epi16(__m128i __a, __m128i __b) { return _mm_cmpgt_epi16(__b, __a); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cmplt_epi32(__m128i __a, __m128i __b) { return _mm_cmpgt_epi32(__b, __a); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cvtsi64_sd(__m128d __a, long long __b) { __a[0] = __b; return __a; } static __inline__ long long __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cvtsd_si64(__m128d __a) { return __builtin_ia32_cvtsd2si64((__v2df)__a); } static __inline__ long long __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cvttsd_si64(__m128d __a) { return __builtin_ia32_cvttsd2si64((__v2df)__a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cvtepi32_ps(__m128i __a) { return (__m128)__builtin_convertvector((__v4si)__a, __v4sf); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cvtps_epi32(__m128 __a) { return (__m128i)__builtin_ia32_cvtps2dq((__v4sf)__a); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cvttps_epi32(__m128 __a) { return (__m128i)__builtin_ia32_cvttps2dq((__v4sf)__a); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cvtsi32_si128(int __a) { return __extension__ (__m128i)(__v4si){ __a, 0, 0, 0 }; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cvtsi64_si128(long long __a) { return __extension__ (__m128i)(__v2di){ __a, 0 }; } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cvtsi128_si32(__m128i __a) { __v4si __b = (__v4si)__a; return __b[0]; } static __inline__ long long __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_cvtsi128_si64(__m128i __a) { return __a[0]; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_load_si128(__m128i const *__p) { return *__p; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_loadu_si128(__m128i_u const *__p) { struct __loadu_si128 { __m128i_u __v; } __attribute__((__packed__, __may_alias__)); return ((const struct __loadu_si128*)__p)->__v; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_loadl_epi64(__m128i_u const *__p) { struct __mm_loadl_epi64_struct { long long __u; } __attribute__((__packed__, __may_alias__)); return __extension__ (__m128i) { ((const struct __mm_loadl_epi64_struct*)__p)->__u, 0}; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_undefined_si128(void) { return (__m128i)__builtin_ia32_undef128(); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_set_epi64x(long long __q1, long long __q0) { return __extension__ (__m128i)(__v2di){ __q0, __q1 }; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_set_epi64(__m64 __q1, __m64 __q0) { return _mm_set_epi64x((long long)__q1, (long long)__q0); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_set_epi32(int __i3, int __i2, int __i1, int __i0) { return __extension__ (__m128i)(__v4si){ __i0, __i1, __i2, __i3}; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_set_epi16(short __w7, short __w6, short __w5, short __w4, short __w3, short __w2, short __w1, short __w0) { return __extension__ (__m128i)(__v8hi){ __w0, __w1, __w2, __w3, __w4, __w5, __w6, __w7 }; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_set_epi8(char __b15, char __b14, char __b13, char __b12, char __b11, char __b10, char __b9, char __b8, char __b7, char __b6, char __b5, char __b4, char __b3, char __b2, char __b1, char __b0) { return __extension__ (__m128i)(__v16qi){ __b0, __b1, __b2, __b3, __b4, __b5, __b6, __b7, __b8, __b9, __b10, __b11, __b12, __b13, __b14, __b15 }; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_set1_epi64x(long long __q) { return _mm_set_epi64x(__q, __q); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_set1_epi64(__m64 __q) { return _mm_set_epi64(__q, __q); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_set1_epi32(int __i) { return _mm_set_epi32(__i, __i, __i, __i); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_set1_epi16(short __w) { return _mm_set_epi16(__w, __w, __w, __w, __w, __w, __w, __w); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_set1_epi8(char __b) { return _mm_set_epi8(__b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_setr_epi64(__m64 __q0, __m64 __q1) { return _mm_set_epi64(__q1, __q0); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_setr_epi32(int __i0, int __i1, int __i2, int __i3) { return _mm_set_epi32(__i3, __i2, __i1, __i0); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_setr_epi16(short __w0, short __w1, short __w2, short __w3, short __w4, short __w5, short __w6, short __w7) { return _mm_set_epi16(__w7, __w6, __w5, __w4, __w3, __w2, __w1, __w0); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_setr_epi8(char __b0, char __b1, char __b2, char __b3, char __b4, char __b5, char __b6, char __b7, char __b8, char __b9, char __b10, char __b11, char __b12, char __b13, char __b14, char __b15) { return _mm_set_epi8(__b15, __b14, __b13, __b12, __b11, __b10, __b9, __b8, __b7, __b6, __b5, __b4, __b3, __b2, __b1, __b0); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_setzero_si128(void) { return __extension__ (__m128i)(__v2di){ 0LL, 0LL }; } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_store_si128(__m128i *__p, __m128i __b) { *__p = __b; } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_storeu_si128(__m128i_u *__p, __m128i __b) { struct __storeu_si128 { __m128i_u __v; } __attribute__((__packed__, __may_alias__)); ((struct __storeu_si128*)__p)->__v = __b; } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_storeu_si64(void *__p, __m128i __b) { struct __storeu_si64 { long long __v; } __attribute__((__packed__, __may_alias__)); ((struct __storeu_si64*)__p)->__v = ((__v2di)__b)[0]; } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_storeu_si32(void *__p, __m128i __b) { struct __storeu_si32 { int __v; } __attribute__((__packed__, __may_alias__)); ((struct __storeu_si32*)__p)->__v = ((__v4si)__b)[0]; } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_storeu_si16(void *__p, __m128i __b) { struct __storeu_si16 { short __v; } __attribute__((__packed__, __may_alias__)); ((struct __storeu_si16*)__p)->__v = ((__v8hi)__b)[0]; } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_maskmoveu_si128(__m128i __d, __m128i __n, char *__p) { __builtin_ia32_maskmovdqu((__v16qi)__d, (__v16qi)__n, __p); } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_storel_epi64(__m128i_u *__p, __m128i __a) { struct __mm_storel_epi64_struct { long long __u; } __attribute__((__packed__, __may_alias__)); ((struct __mm_storel_epi64_struct*)__p)->__u = __a[0]; } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_stream_pd(double *__p, __m128d __a) { __builtin_nontemporal_store((__v2df)__a, (__v2df*)__p); } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_stream_si128(__m128i *__p, __m128i __a) { __builtin_nontemporal_store((__v2di)__a, (__v2di*)__p); } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse2"))) _mm_stream_si32(int *__p, int __a) { __builtin_ia32_movnti(__p, __a); } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("sse2"))) _mm_stream_si64(long long *__p, long long __a) { __builtin_ia32_movnti64(__p, __a); } extern "C" { void _mm_clflush(void const * __p); void _mm_lfence(void); void _mm_mfence(void); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_packs_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_packsswb128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_packs_epi32(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_packssdw128((__v4si)__a, (__v4si)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_packus_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_packuswb128((__v8hi)__a, (__v8hi)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_movemask_epi8(__m128i __a) { return __builtin_ia32_pmovmskb128((__v16qi)__a); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_unpackhi_epi8(__m128i __a, __m128i __b) { return (__m128i)__builtin_shufflevector((__v16qi)__a, (__v16qi)__b, 8, 16+8, 9, 16+9, 10, 16+10, 11, 16+11, 12, 16+12, 13, 16+13, 14, 16+14, 15, 16+15); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_unpackhi_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_shufflevector((__v8hi)__a, (__v8hi)__b, 4, 8+4, 5, 8+5, 6, 8+6, 7, 8+7); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_unpackhi_epi32(__m128i __a, __m128i __b) { return (__m128i)__builtin_shufflevector((__v4si)__a, (__v4si)__b, 2, 4+2, 3, 4+3); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_unpackhi_epi64(__m128i __a, __m128i __b) { return (__m128i)__builtin_shufflevector((__v2di)__a, (__v2di)__b, 1, 2+1); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_unpacklo_epi8(__m128i __a, __m128i __b) { return (__m128i)__builtin_shufflevector((__v16qi)__a, (__v16qi)__b, 0, 16+0, 1, 16+1, 2, 16+2, 3, 16+3, 4, 16+4, 5, 16+5, 6, 16+6, 7, 16+7); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_unpacklo_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_shufflevector((__v8hi)__a, (__v8hi)__b, 0, 8+0, 1, 8+1, 2, 8+2, 3, 8+3); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_unpacklo_epi32(__m128i __a, __m128i __b) { return (__m128i)__builtin_shufflevector((__v4si)__a, (__v4si)__b, 0, 4+0, 1, 4+1); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_unpacklo_epi64(__m128i __a, __m128i __b) { return (__m128i)__builtin_shufflevector((__v2di)__a, (__v2di)__b, 0, 2+0); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_movepi64_pi64(__m128i __a) { return (__m64)__a[0]; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_movpi64_epi64(__m64 __a) { return __extension__ (__m128i)(__v2di){ (long long)__a, 0 }; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_move_epi64(__m128i __a) { return __builtin_shufflevector((__v2di)__a, _mm_setzero_si128(), 0, 2); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_unpackhi_pd(__m128d __a, __m128d __b) { return __builtin_shufflevector((__v2df)__a, (__v2df)__b, 1, 2+1); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_unpacklo_pd(__m128d __a, __m128d __b) { return __builtin_shufflevector((__v2df)__a, (__v2df)__b, 0, 2+0); } static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_movemask_pd(__m128d __a) { return __builtin_ia32_movmskpd((__v2df)__a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_castpd_ps(__m128d __a) { return (__m128)__a; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_castpd_si128(__m128d __a) { return (__m128i)__a; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_castps_pd(__m128 __a) { return (__m128d)__a; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_castps_si128(__m128 __a) { return (__m128i)__a; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_castsi128_ps(__m128i __a) { return (__m128)__a; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__, __target__("sse2"), __min_vector_width__(128))) _mm_castsi128_pd(__m128i __a) { return (__m128d)__a; } extern "C" { void _mm_pause(void); } static __inline__ unsigned short __attribute__((__always_inline__, __nodebug__)) __tzcnt_u16(unsigned short __X) { return __builtin_ia32_tzcnt_u16(__X); } static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__)) __tzcnt_u32(unsigned int __X) { return __builtin_ia32_tzcnt_u32(__X); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_tzcnt_32(unsigned int __X) { return __builtin_ia32_tzcnt_u32(__X); } static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__)) __tzcnt_u64(unsigned long long __X) { return __builtin_ia32_tzcnt_u64(__X); } static __inline__ long long __attribute__((__always_inline__, __nodebug__)) _mm_tzcnt_64(unsigned long long __X) { return __builtin_ia32_tzcnt_u64(__X); } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fxsr"))) _fxsave(void *__p) { __builtin_ia32_fxsave(__p); } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fxsr"))) _fxrstor(void *__p) { __builtin_ia32_fxrstor(__p); } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fxsr"))) _fxsave64(void *__p) { __builtin_ia32_fxsave64(__p); } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fxsr"))) _fxrstor64(void *__p) { __builtin_ia32_fxrstor64(__p); } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("xsave"))) _xsave(void *__p, unsigned long long __m) { __builtin_ia32_xsave(__p, __m); } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("xsave"))) _xrstor(void *__p, unsigned long long __m) { __builtin_ia32_xrstor(__p, __m); } extern "C" { unsigned __int64 __cdecl _xgetbv(unsigned int); void __cdecl _xsetbv(unsigned int, unsigned __int64); } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("xsave"))) _xsave64(void *__p, unsigned long long __m) { __builtin_ia32_xsave64(__p, __m); } static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("xsave"))) _xrstor64(void *__p, unsigned long long __m) { __builtin_ia32_xrstor64(__p, __m); } static __inline unsigned char __attribute__((__always_inline__, __nodebug__, __target__("adx"))) _addcarryx_u32(unsigned char __cf, unsigned int __x, unsigned int __y, unsigned int *__p) { return __builtin_ia32_addcarryx_u32(__cf, __x, __y, __p); } static __inline unsigned char __attribute__((__always_inline__, __nodebug__, __target__("adx"))) _addcarryx_u64(unsigned char __cf, unsigned long long __x, unsigned long long __y, unsigned long long *__p) { return __builtin_ia32_addcarryx_u64(__cf, __x, __y, __p); } static __inline unsigned char __attribute__((__always_inline__, __nodebug__)) _addcarry_u32(unsigned char __cf, unsigned int __x, unsigned int __y, unsigned int *__p) { return __builtin_ia32_addcarryx_u32(__cf, __x, __y, __p); } static __inline unsigned char __attribute__((__always_inline__, __nodebug__)) _addcarry_u64(unsigned char __cf, unsigned long long __x, unsigned long long __y, unsigned long long *__p) { return __builtin_ia32_addcarryx_u64(__cf, __x, __y, __p); } static __inline unsigned char __attribute__((__always_inline__, __nodebug__)) _subborrow_u32(unsigned char __cf, unsigned int __x, unsigned int __y, unsigned int *__p) { return __builtin_ia32_subborrow_u32(__cf, __x, __y, __p); } static __inline unsigned char __attribute__((__always_inline__, __nodebug__)) _subborrow_u64(unsigned char __cf, unsigned long long __x, unsigned long long __y, unsigned long long *__p) { return __builtin_ia32_subborrow_u64(__cf, __x, __y, __p); } extern "C" { static __inline__ long __attribute__((__always_inline__, __nodebug__)) _InterlockedExchange_HLEAcquire(long volatile *_Target, long _Value) { __asm__ __volatile__(".byte 0xf2 ; lock ; xchg %0, %1" : "+r" (_Value), "+m" (*_Target) :: "memory"); return _Value; } static __inline__ long __attribute__((__always_inline__, __nodebug__)) _InterlockedExchange_HLERelease(long volatile *_Target, long _Value) { __asm__ __volatile__(".byte 0xf3 ; lock ; xchg %0, %1" : "+r" (_Value), "+m" (*_Target) :: "memory"); return _Value; } static __inline__ __int64 __attribute__((__always_inline__, __nodebug__)) _InterlockedExchange64_HLEAcquire(__int64 volatile *_Target, __int64 _Value) { __asm__ __volatile__(".byte 0xf2 ; lock ; xchg %0, %1" : "+r" (_Value), "+m" (*_Target) :: "memory"); return _Value; } static __inline__ __int64 __attribute__((__always_inline__, __nodebug__)) _InterlockedExchange64_HLERelease(__int64 volatile *_Target, __int64 _Value) { __asm__ __volatile__(".byte 0xf3 ; lock ; xchg %0, %1" : "+r" (_Value), "+m" (*_Target) :: "memory"); return _Value; } static __inline__ long __attribute__((__always_inline__, __nodebug__)) _InterlockedCompareExchange_HLEAcquire(long volatile *_Destination, long _Exchange, long _Comparand) { __asm__ __volatile__(".byte 0xf2 ; lock ; cmpxchg %2, %1" : "+a" (_Comparand), "+m" (*_Destination) : "r" (_Exchange) : "memory"); return _Comparand; } static __inline__ long __attribute__((__always_inline__, __nodebug__)) _InterlockedCompareExchange_HLERelease(long volatile *_Destination, long _Exchange, long _Comparand) { __asm__ __volatile__(".byte 0xf3 ; lock ; cmpxchg %2, %1" : "+a" (_Comparand), "+m" (*_Destination) : "r" (_Exchange) : "memory"); return _Comparand; } static __inline__ __int64 __attribute__((__always_inline__, __nodebug__)) _InterlockedCompareExchange64_HLEAcquire(__int64 volatile *_Destination, __int64 _Exchange, __int64 _Comparand) { __asm__ __volatile__(".byte 0xf2 ; lock ; cmpxchg %2, %1" : "+a" (_Comparand), "+m" (*_Destination) : "r" (_Exchange) : "memory"); return _Comparand; } static __inline__ __int64 __attribute__((__always_inline__, __nodebug__)) _InterlockedCompareExchange64_HLERelease(__int64 volatile *_Destination, __int64 _Exchange, __int64 _Comparand) { __asm__ __volatile__(".byte 0xf3 ; lock ; cmpxchg %2, %1" : "+a" (_Comparand), "+m" (*_Destination) : "r" (_Exchange) : "memory"); return _Comparand; } } #pragma pack(push, 8) extern "C" { typedef struct __declspec(align(16)) _SETJMP_FLOAT128 { unsigned __int64 Part[2]; } SETJMP_FLOAT128; typedef SETJMP_FLOAT128 _JBTYPE; typedef struct _JUMP_BUFFER { unsigned __int64 Frame; unsigned __int64 Rbx; unsigned __int64 Rsp; unsigned __int64 Rbp; unsigned __int64 Rsi; unsigned __int64 Rdi; unsigned __int64 R12; unsigned __int64 R13; unsigned __int64 R14; unsigned __int64 R15; unsigned __int64 Rip; unsigned long MxCsr; unsigned short FpCsr; unsigned short Spare; SETJMP_FLOAT128 Xmm6; SETJMP_FLOAT128 Xmm7; SETJMP_FLOAT128 Xmm8; SETJMP_FLOAT128 Xmm9; SETJMP_FLOAT128 Xmm10; SETJMP_FLOAT128 Xmm11; SETJMP_FLOAT128 Xmm12; SETJMP_FLOAT128 Xmm13; SETJMP_FLOAT128 Xmm14; SETJMP_FLOAT128 Xmm15; } _JUMP_BUFFER; typedef _JBTYPE jmp_buf[16]; int __cdecl _setjmp( jmp_buf _Buf ); __declspec(noreturn) void __cdecl longjmp( jmp_buf _Buf, int _Value ) noexcept(false); } #pragma pack(pop) extern "C" { __m64 _m_from_float(float); float _m_to_float(__m64); void __addfsbyte(unsigned long, unsigned char); void __addfsdword(unsigned long, unsigned long); void __addfsword(unsigned long, unsigned short); void __code_seg(const char *); static __inline__ void __cpuid(int[4], int); static __inline__ void __cpuidex(int[4], int, int); static __inline__ __int64 __emul(int, int); static __inline__ unsigned __int64 __emulu(unsigned int, unsigned int); unsigned int __getcallerseflags(void); static __inline__ void __halt(void); unsigned char __inbyte(unsigned short); void __inbytestring(unsigned short, unsigned char *, unsigned long); void __incfsbyte(unsigned long); void __incfsdword(unsigned long); void __incfsword(unsigned long); unsigned long __indword(unsigned short); void __indwordstring(unsigned short, unsigned long *, unsigned long); void __int2c(void); void __invlpg(void *); unsigned short __inword(unsigned short); void __inwordstring(unsigned short, unsigned short *, unsigned long); void __lidt(void *); unsigned __int64 __ll_lshift(unsigned __int64, int); __int64 __ll_rshift(__int64, int); static __inline__ void __movsb(unsigned char *, unsigned char const *, size_t); static __inline__ void __movsd(unsigned long *, unsigned long const *, size_t); static __inline__ void __movsw(unsigned short *, unsigned short const *, size_t); static __inline__ void __nop(void); void __nvreg_restore_fence(void); void __nvreg_save_fence(void); void __outbyte(unsigned short, unsigned char); void __outbytestring(unsigned short, unsigned char *, unsigned long); void __outdword(unsigned short, unsigned long); void __outdwordstring(unsigned short, unsigned long *, unsigned long); void __outword(unsigned short, unsigned short); void __outwordstring(unsigned short, unsigned short *, unsigned long); unsigned long __readcr0(void); unsigned long __readcr2(void); unsigned __int64 __readcr3(void); unsigned long __readcr4(void); unsigned long __readcr8(void); unsigned int __readdr(unsigned int); static __inline__ unsigned __int64 __readmsr(unsigned long); unsigned __int64 __readpmc(unsigned long); unsigned long __segmentlimit(unsigned long); void __sidt(void *); static __inline__ void __stosb(unsigned char *, unsigned char, size_t); static __inline__ void __stosd(unsigned long *, unsigned long, size_t); static __inline__ void __stosw(unsigned short *, unsigned short, size_t); void __svm_clgi(void); void __svm_invlpga(void *, int); void __svm_skinit(int); void __svm_stgi(void); void __svm_vmload(size_t); void __svm_vmrun(size_t); void __svm_vmsave(size_t); void __ud2(void); unsigned __int64 __ull_rshift(unsigned __int64, int); void __vmx_off(void); void __vmx_vmptrst(unsigned __int64 *); void __wbinvd(void); void __writecr0(unsigned int); static __inline__ void __writecr3(unsigned long long int); void __writecr4(unsigned int); void __writecr8(unsigned int); void __writedr(unsigned int, unsigned int); void __writefsbyte(unsigned long, unsigned char); void __writefsdword(unsigned long, unsigned long); void __writefsqword(unsigned long, unsigned __int64); void __writefsword(unsigned long, unsigned short); void __writemsr(unsigned long, unsigned __int64); static __inline__ void *_AddressOfReturnAddress(void); static __inline__ unsigned char _BitScanForward(unsigned long *_Index, unsigned long _Mask); static __inline__ unsigned char _BitScanReverse(unsigned long *_Index, unsigned long _Mask); unsigned char _bittest(long const *, long); unsigned char _bittestandcomplement(long *, long); unsigned char _bittestandreset(long *, long); unsigned char _bittestandset(long *, long); void __cdecl _disable(void); void __cdecl _enable(void); long _InterlockedAddLargeStatistic(__int64 volatile *_Addend, long _Value); unsigned char _interlockedbittestandreset(long volatile *, long); unsigned char _interlockedbittestandset(long volatile *, long); void *_InterlockedCompareExchangePointer_HLEAcquire(void *volatile *, void *, void *); void *_InterlockedCompareExchangePointer_HLERelease(void *volatile *, void *, void *); long _InterlockedExchangeAdd_HLEAcquire(long volatile *, long); long _InterlockedExchangeAdd_HLERelease(long volatile *, long); __int64 _InterlockedExchangeAdd64_HLEAcquire(__int64 volatile *, __int64); __int64 _InterlockedExchangeAdd64_HLERelease(__int64 volatile *, __int64); static __inline__ void __attribute__((__deprecated__("use other intrinsics or C++11 atomics instead"))) _ReadBarrier(void); static __inline__ void __attribute__((__deprecated__("use other intrinsics or C++11 atomics instead"))) _ReadWriteBarrier(void); unsigned int _rorx_u32(unsigned int, const unsigned int); int _sarx_i32(int, unsigned int); int __cdecl _setjmp(jmp_buf); unsigned int _shlx_u32(unsigned int, unsigned int); unsigned int _shrx_u32(unsigned int, unsigned int); void _Store_HLERelease(long volatile *, long); void _Store64_HLERelease(__int64 volatile *, __int64); void _StorePointer_HLERelease(void *volatile *, void *); static __inline__ void __attribute__((__deprecated__("use other intrinsics or C++11 atomics instead"))) _WriteBarrier(void); unsigned __int32 xbegin(void); void _xend(void); void __addgsbyte(unsigned long, unsigned char); void __addgsdword(unsigned long, unsigned long); void __addgsqword(unsigned long, unsigned __int64); void __addgsword(unsigned long, unsigned short); static __inline__ void __faststorefence(void); void __incgsbyte(unsigned long); void __incgsdword(unsigned long); void __incgsqword(unsigned long); void __incgsword(unsigned long); static __inline__ void __movsq(unsigned long long *, unsigned long long const *, size_t); static __inline__ unsigned char __readgsbyte(unsigned long); static __inline__ unsigned long __readgsdword(unsigned long); static __inline__ unsigned __int64 __readgsqword(unsigned long); unsigned short __readgsword(unsigned long); unsigned __int64 __shiftleft128(unsigned __int64 _LowPart, unsigned __int64 _HighPart, unsigned char _Shift); unsigned __int64 __shiftright128(unsigned __int64 _LowPart, unsigned __int64 _HighPart, unsigned char _Shift); static __inline__ void __stosq(unsigned __int64 *, unsigned __int64, size_t); unsigned char __vmx_on(unsigned __int64 *); unsigned char __vmx_vmclear(unsigned __int64 *); unsigned char __vmx_vmlaunch(void); unsigned char __vmx_vmptrld(unsigned __int64 *); unsigned char __vmx_vmread(size_t, size_t *); unsigned char __vmx_vmresume(void); unsigned char __vmx_vmwrite(size_t, size_t); void __writegsbyte(unsigned long, unsigned char); void __writegsdword(unsigned long, unsigned long); void __writegsqword(unsigned long, unsigned __int64); void __writegsword(unsigned long, unsigned short); unsigned char _bittest64(__int64 const *, __int64); unsigned char _bittestandcomplement64(__int64 *, __int64); unsigned char _bittestandreset64(__int64 *, __int64); unsigned char _bittestandset64(__int64 *, __int64); long _InterlockedAnd_np(long volatile *_Value, long _Mask); short _InterlockedAnd16_np(short volatile *_Value, short _Mask); __int64 _InterlockedAnd64_np(__int64 volatile *_Value, __int64 _Mask); char _InterlockedAnd8_np(char volatile *_Value, char _Mask); unsigned char _interlockedbittestandreset64(__int64 volatile *, __int64); unsigned char _interlockedbittestandset64(__int64 volatile *, __int64); long _InterlockedCompareExchange_np(long volatile *_Destination, long _Exchange, long _Comparand); unsigned char _InterlockedCompareExchange128(__int64 volatile *_Destination, __int64 _ExchangeHigh, __int64 _ExchangeLow, __int64 *_CompareandResult); unsigned char _InterlockedCompareExchange128_np(__int64 volatile *_Destination, __int64 _ExchangeHigh, __int64 _ExchangeLow, __int64 *_ComparandResult); short _InterlockedCompareExchange16_np(short volatile *_Destination, short _Exchange, short _Comparand); __int64 _InterlockedCompareExchange64_np(__int64 volatile *_Destination, __int64 _Exchange, __int64 _Comparand); void *_InterlockedCompareExchangePointer_np(void *volatile *_Destination, void *_Exchange, void *_Comparand); long _InterlockedOr_np(long volatile *_Value, long _Mask); short _InterlockedOr16_np(short volatile *_Value, short _Mask); __int64 _InterlockedOr64_np(__int64 volatile *_Value, __int64 _Mask); char _InterlockedOr8_np(char volatile *_Value, char _Mask); long _InterlockedXor_np(long volatile *_Value, long _Mask); short _InterlockedXor16_np(short volatile *_Value, short _Mask); __int64 _InterlockedXor64_np(__int64 volatile *_Value, __int64 _Mask); char _InterlockedXor8_np(char volatile *_Value, char _Mask); unsigned __int64 _rorx_u64(unsigned __int64, const unsigned int); __int64 _sarx_i64(__int64, unsigned int); unsigned __int64 _shlx_u64(unsigned __int64, unsigned int); unsigned __int64 _shrx_u64(unsigned __int64, unsigned int); static __inline__ __int64 __mulh(__int64, __int64); static __inline__ unsigned __int64 __umulh(unsigned __int64, unsigned __int64); static __inline__ __int64 _mul128(__int64, __int64, __int64*); static __inline__ unsigned __int64 _umul128(unsigned __int64, unsigned __int64, unsigned __int64*); static __inline__ unsigned char _BitScanForward64(unsigned long *_Index, unsigned __int64 _Mask); static __inline__ unsigned char _BitScanReverse64(unsigned long *_Index, unsigned __int64 _Mask); static __inline__ __int64 _InterlockedDecrement64(__int64 volatile *_Addend); static __inline__ __int64 _InterlockedExchange64(__int64 volatile *_Target, __int64 _Value); static __inline__ __int64 _InterlockedExchangeAdd64(__int64 volatile *_Addend, __int64 _Value); static __inline__ __int64 _InterlockedExchangeSub64(__int64 volatile *_Subend, __int64 _Value); static __inline__ __int64 _InterlockedIncrement64(__int64 volatile *_Addend); static __inline__ __int64 _InterlockedOr64(__int64 volatile *_Value, __int64 _Mask); static __inline__ __int64 _InterlockedXor64(__int64 volatile *_Value, __int64 _Mask); static __inline__ __int64 _InterlockedAnd64(__int64 volatile *_Value, __int64 _Mask); static __inline__ void __attribute__((__always_inline__, __nodebug__)) __movsb(unsigned char *__dst, unsigned char const *__src, size_t __n) { __asm__ __volatile__("rep movsb" : "+D"(__dst), "+S"(__src), "+c"(__n) : : "memory"); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) __movsd(unsigned long *__dst, unsigned long const *__src, size_t __n) { __asm__ __volatile__("rep movsl" : "+D"(__dst), "+S"(__src), "+c"(__n) : : "memory"); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) __movsw(unsigned short *__dst, unsigned short const *__src, size_t __n) { __asm__ __volatile__("rep movsw" : "+D"(__dst), "+S"(__src), "+c"(__n) : : "memory"); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) __stosd(unsigned long *__dst, unsigned long __x, size_t __n) { __asm__ __volatile__("rep stosl" : "+D"(__dst), "+c"(__n) : "a"(__x) : "memory"); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) __stosw(unsigned short *__dst, unsigned short __x, size_t __n) { __asm__ __volatile__("rep stosw" : "+D"(__dst), "+c"(__n) : "a"(__x) : "memory"); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) __movsq(unsigned long long *__dst, unsigned long long const *__src, size_t __n) { __asm__ __volatile__("rep movsq" : "+D"(__dst), "+S"(__src), "+c"(__n) : : "memory"); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) __stosq(unsigned __int64 *__dst, unsigned __int64 __x, size_t __n) { __asm__ __volatile__("rep stosq" : "+D"(__dst), "+c"(__n) : "a"(__x) : "memory"); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) __cpuid(int __info[4], int __level) { __asm__ ("cpuid" : "=a"(__info[0]), "=b" (__info[1]), "=c"(__info[2]), "=d"(__info[3]) : "a"(__level), "c"(0)); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) __cpuidex(int __info[4], int __level, int __ecx) { __asm__ ("cpuid" : "=a"(__info[0]), "=b" (__info[1]), "=c"(__info[2]), "=d"(__info[3]) : "a"(__level), "c"(__ecx)); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) __halt(void) { __asm__ volatile ("hlt"); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) __nop(void) { __asm__ volatile ("nop"); } static __inline__ unsigned __int64 __attribute__((__always_inline__, __nodebug__)) __readmsr(unsigned long __register) { unsigned long __edx; unsigned long __eax; __asm__ ("rdmsr" : "=d"(__edx), "=a"(__eax) : "c"(__register)); return (((unsigned __int64)__edx) << 32) | (unsigned __int64)__eax; } static __inline__ unsigned __int64 __attribute__((__always_inline__, __nodebug__)) __readcr3(void) { unsigned __int64 __cr3_val; __asm__ __volatile__ ("mov %%cr3, %0" : "=r"(__cr3_val) : : "memory"); return __cr3_val; } static __inline__ void __attribute__((__always_inline__, __nodebug__)) __writecr3(unsigned long long int __cr3_val) { __asm__ ("mov %0, %%cr3" : : "r"(__cr3_val) : "memory"); } } namespace base { namespace win { template <class Traits, class Verifier> class GenericScopedHandle { public: using Handle = typename Traits::Handle; GenericScopedHandle() : handle_(Traits::NullHandle()) {} explicit GenericScopedHandle(Handle handle) : handle_(Traits::NullHandle()) { Set(handle); } GenericScopedHandle(GenericScopedHandle&& other) : handle_(Traits::NullHandle()) { Set(other.Take()); } ~GenericScopedHandle() { Close(); } bool IsValid() const { return Traits::IsHandleValid(handle_); } GenericScopedHandle& operator=(GenericScopedHandle&& other) { true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << (::logging::MakeCheckOpValueString( ::logging::g_swallow_stream, this), ::logging::MakeCheckOpValueString( ::logging::g_swallow_stream, &other), (this)!=(&other)); Set(other.Take()); return *this; } void Set(Handle handle) { if (handle_ != handle) { auto last_error = ::GetLastError(); Close(); if (Traits::IsHandleValid(handle)) { handle_ = handle; Verifier::StartTracking(handle, this, _ReturnAddress(), GetProgramCounter()); } ::SetLastError(last_error); } } Handle Get() const { return handle_; } Handle Take() __attribute__((warn_unused_result)) { Handle temp = handle_; handle_ = Traits::NullHandle(); if (Traits::IsHandleValid(temp)) { Verifier::StopTracking(temp, this, _ReturnAddress(), GetProgramCounter()); } return temp; } void Close() { if (Traits::IsHandleValid(handle_)) { Verifier::StopTracking(handle_, this, _ReturnAddress(), GetProgramCounter()); Traits::CloseHandle(handle_); handle_ = Traits::NullHandle(); } } private: friend class ScopedHandleTest_ActiveVerifierWrongOwner_Test; friend class ScopedHandleTest_DISABLED_ActiveVerifierWrongOwner_Test; friend class ScopedHandleTest_FLAKY_ActiveVerifierWrongOwner_Test; friend class ScopedHandleTest_ActiveVerifierUntrackedHandle_Test; friend class ScopedHandleTest_DISABLED_ActiveVerifierUntrackedHandle_Test; friend class ScopedHandleTest_FLAKY_ActiveVerifierUntrackedHandle_Test; Handle handle_; GenericScopedHandle(const GenericScopedHandle&) = delete; GenericScopedHandle& operator=(const GenericScopedHandle&) = delete; }; class HandleTraits { public: using Handle = HANDLE; static bool CloseHandle(HANDLE handle); static bool IsHandleValid(HANDLE handle) { return handle != nullptr && handle != ((HANDLE)(LONG_PTR)-1); } static HANDLE NullHandle() { return nullptr; } private: HandleTraits() = delete; HandleTraits(const HandleTraits&) = delete; HandleTraits& operator=(const HandleTraits&) = delete; }; class DummyVerifierTraits { public: using Handle = HANDLE; static void StartTracking(HANDLE handle, const void* owner, const void* pc1, const void* pc2) {} static void StopTracking(HANDLE handle, const void* owner, const void* pc1, const void* pc2) {} private: DummyVerifierTraits() = delete; DummyVerifierTraits(const DummyVerifierTraits&) = delete; DummyVerifierTraits& operator=(const DummyVerifierTraits&) = delete; }; class VerifierTraits { public: using Handle = HANDLE; static void StartTracking(HANDLE handle, const void* owner, const void* pc1, const void* pc2); static void StopTracking(HANDLE handle, const void* owner, const void* pc1, const void* pc2); private: VerifierTraits() = delete; VerifierTraits(const VerifierTraits&) = delete; VerifierTraits& operator=(const VerifierTraits&) = delete; }; using ScopedHandle = GenericScopedHandle<HandleTraits, VerifierTraits>; void DisableHandleVerifier(); void OnHandleBeingClosed(HANDLE handle); } } namespace base { class Process { public: explicit Process(ProcessHandle handle = kNullProcessHandle); Process(Process&& other); ~Process(); Process& operator=(Process&& other); static Process Current(); static Process Open(ProcessId pid); static Process OpenWithExtraPrivileges(ProcessId pid); static Process OpenWithAccess(ProcessId pid, DWORD desired_access); static Process DeprecatedGetProcessFromHandle(ProcessHandle handle); static bool CanBackgroundProcesses(); [[noreturn]] static void TerminateCurrentProcessImmediately(int exit_code); bool IsValid() const; ProcessHandle Handle() const; Process Duplicate() const; ProcessId Pid() const; Time CreationTime() const; bool is_current() const; void Close(); bool IsRunning() const { return !WaitForExitWithTimeout(base::TimeDelta(), nullptr); } bool Terminate(int exit_code, bool wait) const; bool WaitForExit(int* exit_code) const; bool WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) const; void Exited(int exit_code) const; bool IsProcessBackgrounded() const; bool SetProcessBackgrounded(bool value); int GetPriority() const; private: win::ScopedHandle process_; bool is_current_process_; Process(const Process&) = delete; Process& operator=(const Process&) = delete; }; } namespace base { class ProcessFilter; namespace win { const DWORD kSandboxFatalMemoryExceeded = 7012; const DWORD kNormalTerminationExitCode = 0; const DWORD kDebuggerInactiveExitCode = 0xC0000354; const DWORD kKeyboardInterruptExitCode = 0xC000013A; const DWORD kDebuggerTerminatedExitCode = 0x40010004; const DWORD kStatusInvalidImageHashExitCode = 0xC0000428; const DWORD kProcessKilledExitCode = 1; } enum TerminationStatus { TERMINATION_STATUS_NORMAL_TERMINATION, TERMINATION_STATUS_ABNORMAL_TERMINATION, TERMINATION_STATUS_PROCESS_WAS_KILLED, TERMINATION_STATUS_PROCESS_CRASHED, TERMINATION_STATUS_STILL_RUNNING, TERMINATION_STATUS_LAUNCH_FAILED, TERMINATION_STATUS_OOM, TERMINATION_STATUS_INTEGRITY_FAILURE, TERMINATION_STATUS_MAX_ENUM }; bool KillProcesses(const FilePath::StringType& executable_name, int exit_code, const ProcessFilter* filter); TerminationStatus GetTerminationStatus(ProcessHandle handle, int* exit_code); void EnsureProcessTerminated(Process process); bool WaitForProcessesToExit( const FilePath::StringType& executable_name, base::TimeDelta wait, const ProcessFilter* filter); bool CleanupProcesses(const FilePath::StringType& executable_name, base::TimeDelta wait, int exit_code, const ProcessFilter* filter); } namespace base { class FilePath; class CommandLine { public: using StringType = std::wstring; using StringPieceType = base::BasicStringPiece<StringType>; using CharType = StringType::value_type; using StringVector = std::vector<StringType>; using SwitchMap = std::map<std::string, StringType, std::less<>>; enum NoProgram { NO_PROGRAM }; explicit CommandLine(NoProgram no_program); explicit CommandLine(const FilePath& program); CommandLine(int argc, const CharType* const* argv); explicit CommandLine(const StringVector& argv); CommandLine(const CommandLine& other); CommandLine& operator=(const CommandLine& other); ~CommandLine(); static void set_slash_is_not_a_switch(); static void InitUsingArgvForTesting(int argc, const char* const* argv); static bool Init(int argc, const char* const* argv); static void Reset(); static CommandLine* ForCurrentProcess(); static bool InitializedForCurrentProcess(); static CommandLine FromString(StringPieceType command_line); void InitFromArgv(int argc, const CharType* const* argv); void InitFromArgv(const StringVector& argv); StringType GetCommandLineString() const { return GetCommandLineStringInternal(false); } StringType GetCommandLineStringWithPlaceholders() const { return GetCommandLineStringInternal(true); } StringType GetArgumentsString() const { return GetArgumentsStringInternal(false); } StringType GetArgumentsStringWithPlaceholders() const { return GetArgumentsStringInternal(true); } const StringVector& argv() const { return argv_; } FilePath GetProgram() const; void SetProgram(const FilePath& program); bool HasSwitch(const StringPiece& switch_string) const; bool HasSwitch(const char switch_constant[]) const; std::string GetSwitchValueASCII(const StringPiece& switch_string) const; FilePath GetSwitchValuePath(const StringPiece& switch_string) const; StringType GetSwitchValueNative(const StringPiece& switch_string) const; const SwitchMap& GetSwitches() const { return switches_; } void AppendSwitch(const std::string& switch_string); void AppendSwitchPath(const std::string& switch_string, const FilePath& path); void AppendSwitchNative(const std::string& switch_string, const StringType& value); void AppendSwitchASCII(const std::string& switch_string, const std::string& value); void RemoveSwitch(const base::StringPiece switch_key_without_prefix); void CopySwitchesFrom(const CommandLine& source, const char* const switches[], size_t count); StringVector GetArgs() const; void AppendArg(const std::string& value); void AppendArgPath(const FilePath& value); void AppendArgNative(const StringType& value); void AppendArguments(const CommandLine& other, bool include_program); void PrependWrapper(const StringType& wrapper); void ParseFromString(StringPieceType command_line); private: CommandLine() = delete; StringType GetCommandLineStringInternal(bool quote_placeholders) const; StringType GetArgumentsStringInternal(bool quote_placeholders) const; static CommandLine* current_process_commandline_; StringVector argv_; SwitchMap switches_; size_t begin_args_; }; } namespace base { namespace env_vars { } class Environment { public: virtual ~Environment(); static std::unique_ptr<Environment> Create(); virtual bool GetVar(StringPiece variable_name, std::string* result) = 0; virtual bool HasVar(StringPiece variable_name); virtual bool SetVar(StringPiece variable_name, const std::string& new_value) = 0; virtual bool UnSetVar(StringPiece variable_name) = 0; }; using NativeEnvironmentString = std::wstring; using EnvironmentMap = std::map<NativeEnvironmentString, NativeEnvironmentString>; } namespace base { typedef std::vector<HANDLE> HandlesToInheritVector; struct LaunchOptions { LaunchOptions(); LaunchOptions(const LaunchOptions&); ~LaunchOptions(); bool wait = false; base::FilePath current_directory; bool start_hidden = false; bool feedback_cursor_off = false; enum class Inherit { kSpecific, kAll }; Inherit inherit_mode = Inherit::kSpecific; HandlesToInheritVector handles_to_inherit; UserTokenHandle as_user = nullptr; bool empty_desktop_name = false; HANDLE job_handle = nullptr; HANDLE stdin_handle = nullptr; HANDLE stdout_handle = nullptr; HANDLE stderr_handle = nullptr; bool force_breakaway_from_job_ = false; bool grant_foreground_privilege = false; EnvironmentMap environment; bool clear_environment = false; }; Process LaunchProcess(const CommandLine& cmdline, const LaunchOptions& options); Process LaunchProcess(const CommandLine::StringType& cmdline, const LaunchOptions& options); Process LaunchElevatedProcess(const CommandLine& cmdline, const LaunchOptions& options); bool SetJobObjectLimitFlags(HANDLE job_object, DWORD limit_flags); void RouteStdioToConsole(bool create_console_if_not_found); bool GetAppOutput(const CommandLine& cl, std::string* output); bool GetAppOutputAndError(const CommandLine& cl, std::string* output); bool GetAppOutputWithExitCode(const CommandLine& cl, std::string* output, int* exit_code); bool GetAppOutput(CommandLine::StringPieceType cl, std::string* output); void RaiseProcessToHighPriority(); LaunchOptions LaunchOptionsForTest(); } namespace sandbox { enum ResultCode : int { SBOX_ALL_OK = 0, SBOX_ERROR_GENERIC = 1, SBOX_ERROR_BAD_PARAMS = 2, SBOX_ERROR_UNSUPPORTED = 3, SBOX_ERROR_NO_SPACE = 4, SBOX_ERROR_INVALID_IPC = 5, SBOX_ERROR_FAILED_IPC = 6, SBOX_ERROR_NO_HANDLE = 7, SBOX_ERROR_UNEXPECTED_CALL = 8, SBOX_ERROR_WAIT_ALREADY_CALLED = 9, SBOX_ERROR_CHANNEL_ERROR = 10, SBOX_ERROR_CANNOT_CREATE_DESKTOP = 11, SBOX_ERROR_CANNOT_CREATE_WINSTATION = 12, SBOX_ERROR_FAILED_TO_SWITCH_BACK_WINSTATION = 13, SBOX_ERROR_INVALID_APP_CONTAINER = 14, SBOX_ERROR_INVALID_CAPABILITY = 15, SBOX_ERROR_CANNOT_INIT_APPCONTAINER = 16, SBOX_ERROR_PROC_THREAD_ATTRIBUTES = 17, SBOX_ERROR_CREATE_PROCESS = 18, SBOX_ERROR_DELEGATE_PRE_SPAWN = 19, SBOX_ERROR_ASSIGN_PROCESS_TO_JOB_OBJECT = 20, SBOX_ERROR_SET_THREAD_TOKEN = 21, SBOX_ERROR_GET_THREAD_CONTEXT = 22, SBOX_ERROR_DUPLICATE_TARGET_INFO = 23, SBOX_ERROR_SET_LOW_BOX_TOKEN = 24, SBOX_ERROR_CREATE_FILE_MAPPING = 25, SBOX_ERROR_DUPLICATE_SHARED_SECTION = 26, SBOX_ERROR_MAP_VIEW_OF_SHARED_SECTION = 27, SBOX_ERROR_APPLY_ASLR_MITIGATIONS = 28, SBOX_ERROR_SETUP_BASIC_INTERCEPTIONS = 29, SBOX_ERROR_SETUP_INTERCEPTION_SERVICE = 30, SBOX_ERROR_INITIALIZE_INTERCEPTIONS = 31, SBOX_ERROR_SETUP_NTDLL_IMPORTS = 32, SBOX_ERROR_SETUP_HANDLE_CLOSER = 33, SBOX_ERROR_CANNOT_GET_WINSTATION = 34, SBOX_ERROR_CANNOT_QUERY_WINSTATION_SECURITY = 35, SBOX_ERROR_CANNOT_GET_DESKTOP = 36, SBOX_ERROR_CANNOT_QUERY_DESKTOP_SECURITY = 37, SBOX_ERROR_CANNOT_SETUP_INTERCEPTION_CONFIG_BUFFER = 38, SBOX_ERROR_CANNOT_COPY_DATA_TO_CHILD = 39, SBOX_ERROR_CANNOT_SETUP_INTERCEPTION_THUNK = 40, SBOX_ERROR_CANNOT_RESOLVE_INTERCEPTION_THUNK = 41, SBOX_ERROR_CANNOT_WRITE_INTERCEPTION_THUNK = 42, SBOX_ERROR_CANNOT_FIND_BASE_ADDRESS = 43, SBOX_ERROR_CREATE_APPCONTAINER_PROFILE = 44, SBOX_ERROR_CREATE_APPCONTAINER_PROFILE_ACCESS_CHECK = 45, SBOX_ERROR_CREATE_APPCONTAINER_PROFILE_CAPABILITY = 46, SBOX_ERROR_CANNOT_INIT_JOB = 47, SBOX_ERROR_INVALID_LOWBOX_SID = 48, SBOX_ERROR_CANNOT_CREATE_RESTRICTED_TOKEN = 49, SBOX_ERROR_CANNOT_SET_DESKTOP_INTEGRITY = 50, SBOX_ERROR_CANNOT_CREATE_LOWBOX_TOKEN = 51, SBOX_ERROR_CANNOT_MODIFY_LOWBOX_TOKEN_DACL = 52, SBOX_ERROR_CANNOT_CREATE_RESTRICTED_IMP_TOKEN = 53, SBOX_ERROR_CANNOT_DUPLICATE_PROCESS_HANDLE = 54, SBOX_ERROR_CANNOT_LOADLIBRARY_EXECUTABLE = 55, SBOX_ERROR_CANNOT_FIND_VARIABLE_ADDRESS = 56, SBOX_ERROR_CANNOT_WRITE_VARIABLE_VALUE = 57, SBOX_ERROR_INVALID_WRITE_VARIABLE_SIZE = 58, SBOX_ERROR_CANNOT_INIT_BROKERSERVICES = 59, SBOX_ERROR_LAST }; enum TerminationCodes { SBOX_FATAL_INTEGRITY = 7006, SBOX_FATAL_DROPTOKEN = 7007, SBOX_FATAL_FLUSHANDLES = 7008, SBOX_FATAL_CACHEDISABLE = 7009, SBOX_FATAL_CLOSEHANDLES = 7010, SBOX_FATAL_MITIGATION = 7011, SBOX_FATAL_MEMORY_EXCEEDED = 7012, SBOX_FATAL_WARMUP = 7013, SBOX_FATAL_LAST }; static_assert(SBOX_FATAL_MEMORY_EXCEEDED == base::win::kSandboxFatalMemoryExceeded, "Value for SBOX_FATAL_MEMORY_EXCEEDED must match base."); class BrokerServices; class TargetServices; struct SandboxInterfaceInfo { BrokerServices* broker_services; TargetServices* target_services; }; enum InterceptionType { INTERCEPTION_INVALID = 0, INTERCEPTION_SERVICE_CALL, INTERCEPTION_EAT, INTERCEPTION_SIDESTEP, INTERCEPTION_SMART_SIDESTEP, INTERCEPTION_UNLOAD_MODULE, INTERCEPTION_LAST }; } namespace sandbox { extern "C" { extern "C" NTSTATUS __stdcall TargetNtCreateFile(NtCreateFileFunction orig_CreateFile, PHANDLE file, ACCESS_MASK desired_access, POBJECT_ATTRIBUTES object_attributes, PIO_STATUS_BLOCK io_status, PLARGE_INTEGER allocation_size, ULONG file_attributes, ULONG sharing, ULONG disposition, ULONG options, PVOID ea_buffer, ULONG ea_length); extern "C" NTSTATUS __stdcall TargetNtOpenFile(NtOpenFileFunction orig_OpenFile, PHANDLE file, ACCESS_MASK desired_access, POBJECT_ATTRIBUTES object_attributes, PIO_STATUS_BLOCK io_status, ULONG sharing, ULONG options); extern "C" NTSTATUS __stdcall TargetNtQueryAttributesFile(NtQueryAttributesFileFunction orig_QueryAttributes, POBJECT_ATTRIBUTES object_attributes, PFILE_BASIC_INFORMATION file_attributes); extern "C" NTSTATUS __stdcall TargetNtQueryFullAttributesFile( NtQueryFullAttributesFileFunction orig_QueryAttributes, POBJECT_ATTRIBUTES object_attributes, PFILE_NETWORK_OPEN_INFORMATION file_attributes); extern "C" NTSTATUS __stdcall TargetNtSetInformationFile(NtSetInformationFileFunction orig_SetInformationFile, HANDLE file, PIO_STATUS_BLOCK io_status, PVOID file_information, ULONG length, FILE_INFORMATION_CLASS file_information_class); } } extern "C" { DWORD __stdcall NetUserAdd ( LPCWSTR servername , DWORD level, LPBYTE buf, LPDWORD parm_err ); DWORD __stdcall NetUserEnum ( LPCWSTR servername , DWORD level, DWORD filter, LPBYTE *bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries, PDWORD resume_handle ); DWORD __stdcall NetUserGetInfo ( LPCWSTR servername , LPCWSTR username, DWORD level, LPBYTE *bufptr ); DWORD __stdcall NetUserSetInfo ( LPCWSTR servername , LPCWSTR username, DWORD level, LPBYTE buf, LPDWORD parm_err ); DWORD __stdcall NetUserDel ( LPCWSTR servername , LPCWSTR username ); DWORD __stdcall NetUserGetGroups ( LPCWSTR servername , LPCWSTR username, DWORD level, LPBYTE *bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries ); DWORD __stdcall NetUserSetGroups ( LPCWSTR servername , LPCWSTR username, DWORD level, LPBYTE buf, DWORD num_entries ); DWORD __stdcall NetUserGetLocalGroups ( LPCWSTR servername , LPCWSTR username, DWORD level, DWORD flags, LPBYTE *bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries ); DWORD __stdcall NetUserModalsGet ( LPCWSTR servername , DWORD level, LPBYTE *bufptr ); DWORD __stdcall NetUserModalsSet ( LPCWSTR servername , DWORD level, LPBYTE buf, LPDWORD parm_err ); DWORD __stdcall NetUserChangePassword ( LPCWSTR domainname , LPCWSTR username , LPCWSTR oldpassword, LPCWSTR newpassword ); typedef struct _USER_INFO_0 { LPWSTR usri0_name; }USER_INFO_0, *PUSER_INFO_0, *LPUSER_INFO_0; typedef struct _USER_INFO_1 { LPWSTR usri1_name; LPWSTR usri1_password; DWORD usri1_password_age; DWORD usri1_priv; LPWSTR usri1_home_dir; LPWSTR usri1_comment; DWORD usri1_flags; LPWSTR usri1_script_path; }USER_INFO_1, *PUSER_INFO_1, *LPUSER_INFO_1; typedef struct _USER_INFO_2 { LPWSTR usri2_name; LPWSTR usri2_password; DWORD usri2_password_age; DWORD usri2_priv; LPWSTR usri2_home_dir; LPWSTR usri2_comment; DWORD usri2_flags; LPWSTR usri2_script_path; DWORD usri2_auth_flags; LPWSTR usri2_full_name; LPWSTR usri2_usr_comment; LPWSTR usri2_parms; LPWSTR usri2_workstations; DWORD usri2_last_logon; DWORD usri2_last_logoff; DWORD usri2_acct_expires; DWORD usri2_max_storage; DWORD usri2_units_per_week; PBYTE usri2_logon_hours; DWORD usri2_bad_pw_count; DWORD usri2_num_logons; LPWSTR usri2_logon_server; DWORD usri2_country_code; DWORD usri2_code_page; }USER_INFO_2, *PUSER_INFO_2, *LPUSER_INFO_2; typedef struct _USER_INFO_3 { LPWSTR usri3_name; LPWSTR usri3_password; DWORD usri3_password_age; DWORD usri3_priv; LPWSTR usri3_home_dir; LPWSTR usri3_comment; DWORD usri3_flags; LPWSTR usri3_script_path; DWORD usri3_auth_flags; LPWSTR usri3_full_name; LPWSTR usri3_usr_comment; LPWSTR usri3_parms; LPWSTR usri3_workstations; DWORD usri3_last_logon; DWORD usri3_last_logoff; DWORD usri3_acct_expires; DWORD usri3_max_storage; DWORD usri3_units_per_week; PBYTE usri3_logon_hours; DWORD usri3_bad_pw_count; DWORD usri3_num_logons; LPWSTR usri3_logon_server; DWORD usri3_country_code; DWORD usri3_code_page; DWORD usri3_user_id; DWORD usri3_primary_group_id; LPWSTR usri3_profile; LPWSTR usri3_home_dir_drive; DWORD usri3_password_expired; }USER_INFO_3, *PUSER_INFO_3, *LPUSER_INFO_3; typedef struct _USER_INFO_4 { LPWSTR usri4_name; LPWSTR usri4_password; DWORD usri4_password_age; DWORD usri4_priv; LPWSTR usri4_home_dir; LPWSTR usri4_comment; DWORD usri4_flags; LPWSTR usri4_script_path; DWORD usri4_auth_flags; LPWSTR usri4_full_name; LPWSTR usri4_usr_comment; LPWSTR usri4_parms; LPWSTR usri4_workstations; DWORD usri4_last_logon; DWORD usri4_last_logoff; DWORD usri4_acct_expires; DWORD usri4_max_storage; DWORD usri4_units_per_week; PBYTE usri4_logon_hours; DWORD usri4_bad_pw_count; DWORD usri4_num_logons; LPWSTR usri4_logon_server; DWORD usri4_country_code; DWORD usri4_code_page; PSID usri4_user_sid; DWORD usri4_primary_group_id; LPWSTR usri4_profile; LPWSTR usri4_home_dir_drive; DWORD usri4_password_expired; }USER_INFO_4, *PUSER_INFO_4, *LPUSER_INFO_4; typedef struct _USER_INFO_10 { LPWSTR usri10_name; LPWSTR usri10_comment; LPWSTR usri10_usr_comment; LPWSTR usri10_full_name; }USER_INFO_10, *PUSER_INFO_10, *LPUSER_INFO_10; typedef struct _USER_INFO_11 { LPWSTR usri11_name; LPWSTR usri11_comment; LPWSTR usri11_usr_comment; LPWSTR usri11_full_name; DWORD usri11_priv; DWORD usri11_auth_flags; DWORD usri11_password_age; LPWSTR usri11_home_dir; LPWSTR usri11_parms; DWORD usri11_last_logon; DWORD usri11_last_logoff; DWORD usri11_bad_pw_count; DWORD usri11_num_logons; LPWSTR usri11_logon_server; DWORD usri11_country_code; LPWSTR usri11_workstations; DWORD usri11_max_storage; DWORD usri11_units_per_week; PBYTE usri11_logon_hours; DWORD usri11_code_page; }USER_INFO_11, *PUSER_INFO_11, *LPUSER_INFO_11; typedef struct _USER_INFO_20 { LPWSTR usri20_name; LPWSTR usri20_full_name; LPWSTR usri20_comment; DWORD usri20_flags; DWORD usri20_user_id; }USER_INFO_20, *PUSER_INFO_20, *LPUSER_INFO_20; typedef struct _USER_INFO_21 { BYTE usri21_password[16]; }USER_INFO_21, *PUSER_INFO_21, *LPUSER_INFO_21; typedef struct _USER_INFO_22 { LPWSTR usri22_name; BYTE usri22_password[16]; DWORD usri22_password_age; DWORD usri22_priv; LPWSTR usri22_home_dir; LPWSTR usri22_comment; DWORD usri22_flags; LPWSTR usri22_script_path; DWORD usri22_auth_flags; LPWSTR usri22_full_name; LPWSTR usri22_usr_comment; LPWSTR usri22_parms; LPWSTR usri22_workstations; DWORD usri22_last_logon; DWORD usri22_last_logoff; DWORD usri22_acct_expires; DWORD usri22_max_storage; DWORD usri22_units_per_week; PBYTE usri22_logon_hours; DWORD usri22_bad_pw_count; DWORD usri22_num_logons; LPWSTR usri22_logon_server; DWORD usri22_country_code; DWORD usri22_code_page; }USER_INFO_22, *PUSER_INFO_22, *LPUSER_INFO_22; typedef struct _USER_INFO_23 { LPWSTR usri23_name; LPWSTR usri23_full_name; LPWSTR usri23_comment; DWORD usri23_flags; PSID usri23_user_sid; }USER_INFO_23, *PUSER_INFO_23, *LPUSER_INFO_23; typedef struct _USER_INFO_24 { BOOL usri24_internet_identity; DWORD usri24_flags; LPWSTR usri24_internet_provider_name; LPWSTR usri24_internet_principal_name; PSID usri24_user_sid; } USER_INFO_24, *PUSER_INFO_24, *LPUSER_INFO_24; typedef struct _USER_INFO_1003 { LPWSTR usri1003_password; } USER_INFO_1003, *PUSER_INFO_1003, *LPUSER_INFO_1003; typedef struct _USER_INFO_1005 { DWORD usri1005_priv; } USER_INFO_1005, *PUSER_INFO_1005, *LPUSER_INFO_1005; typedef struct _USER_INFO_1006 { LPWSTR usri1006_home_dir; } USER_INFO_1006, *PUSER_INFO_1006, *LPUSER_INFO_1006; typedef struct _USER_INFO_1007 { LPWSTR usri1007_comment; } USER_INFO_1007, *PUSER_INFO_1007, *LPUSER_INFO_1007; typedef struct _USER_INFO_1008 { DWORD usri1008_flags; } USER_INFO_1008, *PUSER_INFO_1008, *LPUSER_INFO_1008; typedef struct _USER_INFO_1009 { LPWSTR usri1009_script_path; } USER_INFO_1009, *PUSER_INFO_1009, *LPUSER_INFO_1009; typedef struct _USER_INFO_1010 { DWORD usri1010_auth_flags; } USER_INFO_1010, *PUSER_INFO_1010, *LPUSER_INFO_1010; typedef struct _USER_INFO_1011 { LPWSTR usri1011_full_name; } USER_INFO_1011, *PUSER_INFO_1011, *LPUSER_INFO_1011; typedef struct _USER_INFO_1012 { LPWSTR usri1012_usr_comment; } USER_INFO_1012, *PUSER_INFO_1012, *LPUSER_INFO_1012; typedef struct _USER_INFO_1013 { LPWSTR usri1013_parms; } USER_INFO_1013, *PUSER_INFO_1013, *LPUSER_INFO_1013; typedef struct _USER_INFO_1014 { LPWSTR usri1014_workstations; } USER_INFO_1014, *PUSER_INFO_1014, *LPUSER_INFO_1014; typedef struct _USER_INFO_1017 { DWORD usri1017_acct_expires; } USER_INFO_1017, *PUSER_INFO_1017, *LPUSER_INFO_1017; typedef struct _USER_INFO_1018 { DWORD usri1018_max_storage; } USER_INFO_1018, *PUSER_INFO_1018, *LPUSER_INFO_1018; typedef struct _USER_INFO_1020 { DWORD usri1020_units_per_week; LPBYTE usri1020_logon_hours; } USER_INFO_1020, *PUSER_INFO_1020, *LPUSER_INFO_1020; typedef struct _USER_INFO_1023 { LPWSTR usri1023_logon_server; } USER_INFO_1023, *PUSER_INFO_1023, *LPUSER_INFO_1023; typedef struct _USER_INFO_1024 { DWORD usri1024_country_code; } USER_INFO_1024, *PUSER_INFO_1024, *LPUSER_INFO_1024; typedef struct _USER_INFO_1025 { DWORD usri1025_code_page; } USER_INFO_1025, *PUSER_INFO_1025, *LPUSER_INFO_1025; typedef struct _USER_INFO_1051 { DWORD usri1051_primary_group_id; } USER_INFO_1051, *PUSER_INFO_1051, *LPUSER_INFO_1051; typedef struct _USER_INFO_1052 { LPWSTR usri1052_profile; } USER_INFO_1052, *PUSER_INFO_1052, *LPUSER_INFO_1052; typedef struct _USER_INFO_1053 { LPWSTR usri1053_home_dir_drive; } USER_INFO_1053, *PUSER_INFO_1053, *LPUSER_INFO_1053; typedef struct _USER_MODALS_INFO_0 { DWORD usrmod0_min_passwd_len; DWORD usrmod0_max_passwd_age; DWORD usrmod0_min_passwd_age; DWORD usrmod0_force_logoff; DWORD usrmod0_password_hist_len; }USER_MODALS_INFO_0, *PUSER_MODALS_INFO_0, *LPUSER_MODALS_INFO_0; typedef struct _USER_MODALS_INFO_1 { DWORD usrmod1_role; LPWSTR usrmod1_primary; }USER_MODALS_INFO_1, *PUSER_MODALS_INFO_1, *LPUSER_MODALS_INFO_1; typedef struct _USER_MODALS_INFO_2 { LPWSTR usrmod2_domain_name; PSID usrmod2_domain_id; }USER_MODALS_INFO_2, *PUSER_MODALS_INFO_2, *LPUSER_MODALS_INFO_2; typedef struct _USER_MODALS_INFO_3 { DWORD usrmod3_lockout_duration; DWORD usrmod3_lockout_observation_window; DWORD usrmod3_lockout_threshold; }USER_MODALS_INFO_3, *PUSER_MODALS_INFO_3, *LPUSER_MODALS_INFO_3; typedef struct _USER_MODALS_INFO_1001 { DWORD usrmod1001_min_passwd_len; } USER_MODALS_INFO_1001, *PUSER_MODALS_INFO_1001, *LPUSER_MODALS_INFO_1001; typedef struct _USER_MODALS_INFO_1002 { DWORD usrmod1002_max_passwd_age; } USER_MODALS_INFO_1002, *PUSER_MODALS_INFO_1002, *LPUSER_MODALS_INFO_1002; typedef struct _USER_MODALS_INFO_1003 { DWORD usrmod1003_min_passwd_age; } USER_MODALS_INFO_1003, *PUSER_MODALS_INFO_1003, *LPUSER_MODALS_INFO_1003; typedef struct _USER_MODALS_INFO_1004 { DWORD usrmod1004_force_logoff; } USER_MODALS_INFO_1004, *PUSER_MODALS_INFO_1004, *LPUSER_MODALS_INFO_1004; typedef struct _USER_MODALS_INFO_1005 { DWORD usrmod1005_password_hist_len; } USER_MODALS_INFO_1005, *PUSER_MODALS_INFO_1005, *LPUSER_MODALS_INFO_1005; typedef struct _USER_MODALS_INFO_1006 { DWORD usrmod1006_role; } USER_MODALS_INFO_1006, *PUSER_MODALS_INFO_1006, *LPUSER_MODALS_INFO_1006; typedef struct _USER_MODALS_INFO_1007 { LPWSTR usrmod1007_primary; } USER_MODALS_INFO_1007, *PUSER_MODALS_INFO_1007, *LPUSER_MODALS_INFO_1007; DWORD __stdcall NetGroupAdd ( LPCWSTR servername , DWORD level, LPBYTE buf, LPDWORD parm_err ); DWORD __stdcall NetGroupAddUser ( LPCWSTR servername , LPCWSTR GroupName, LPCWSTR username ); DWORD __stdcall NetGroupEnum ( LPCWSTR servername , DWORD level, LPBYTE *bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries, PDWORD_PTR resume_handle ); DWORD __stdcall NetGroupGetInfo ( LPCWSTR servername , LPCWSTR groupname, DWORD level, LPBYTE *bufptr ); DWORD __stdcall NetGroupSetInfo ( LPCWSTR servername , LPCWSTR groupname, DWORD level, LPBYTE buf, LPDWORD parm_err ); DWORD __stdcall NetGroupDel ( LPCWSTR servername , LPCWSTR groupname ); DWORD __stdcall NetGroupDelUser ( LPCWSTR servername , LPCWSTR GroupName, LPCWSTR Username ); DWORD __stdcall NetGroupGetUsers ( LPCWSTR servername , LPCWSTR groupname, DWORD level, LPBYTE *bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries, PDWORD_PTR ResumeHandle ); DWORD __stdcall NetGroupSetUsers ( LPCWSTR servername , LPCWSTR groupname, DWORD level, LPBYTE buf, DWORD totalentries ); typedef struct _GROUP_INFO_0 { LPWSTR grpi0_name; }GROUP_INFO_0, *PGROUP_INFO_0, *LPGROUP_INFO_0; typedef struct _GROUP_INFO_1 { LPWSTR grpi1_name; LPWSTR grpi1_comment; }GROUP_INFO_1, *PGROUP_INFO_1, *LPGROUP_INFO_1; typedef struct _GROUP_INFO_2 { LPWSTR grpi2_name; LPWSTR grpi2_comment; DWORD grpi2_group_id; DWORD grpi2_attributes; }GROUP_INFO_2, *PGROUP_INFO_2; typedef struct _GROUP_INFO_3 { LPWSTR grpi3_name; LPWSTR grpi3_comment; PSID grpi3_group_sid; DWORD grpi3_attributes; }GROUP_INFO_3, *PGROUP_INFO_3; typedef struct _GROUP_INFO_1002 { LPWSTR grpi1002_comment; } GROUP_INFO_1002, *PGROUP_INFO_1002, *LPGROUP_INFO_1002; typedef struct _GROUP_INFO_1005 { DWORD grpi1005_attributes; } GROUP_INFO_1005, *PGROUP_INFO_1005, *LPGROUP_INFO_1005; typedef struct _GROUP_USERS_INFO_0 { LPWSTR grui0_name; } GROUP_USERS_INFO_0, *PGROUP_USERS_INFO_0, *LPGROUP_USERS_INFO_0; typedef struct _GROUP_USERS_INFO_1 { LPWSTR grui1_name; DWORD grui1_attributes; } GROUP_USERS_INFO_1, *PGROUP_USERS_INFO_1, *LPGROUP_USERS_INFO_1; DWORD __stdcall NetLocalGroupAdd ( LPCWSTR servername , DWORD level, LPBYTE buf, LPDWORD parm_err ); DWORD __stdcall NetLocalGroupAddMember ( LPCWSTR servername , LPCWSTR groupname, PSID membersid ); DWORD __stdcall NetLocalGroupEnum ( LPCWSTR servername , DWORD level, LPBYTE *bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries, PDWORD_PTR resumehandle ); DWORD __stdcall NetLocalGroupGetInfo ( LPCWSTR servername , LPCWSTR groupname, DWORD level, LPBYTE *bufptr ); DWORD __stdcall NetLocalGroupSetInfo ( LPCWSTR servername , LPCWSTR groupname, DWORD level, LPBYTE buf, LPDWORD parm_err ); DWORD __stdcall NetLocalGroupDel ( LPCWSTR servername , LPCWSTR groupname ); DWORD __stdcall NetLocalGroupDelMember ( LPCWSTR servername , LPCWSTR groupname, PSID membersid ); DWORD __stdcall NetLocalGroupGetMembers ( LPCWSTR servername , LPCWSTR localgroupname, DWORD level, LPBYTE *bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries, PDWORD_PTR resumehandle ); DWORD __stdcall NetLocalGroupSetMembers ( LPCWSTR servername , LPCWSTR groupname, DWORD level, LPBYTE buf, DWORD totalentries ); DWORD __stdcall NetLocalGroupAddMembers ( LPCWSTR servername , LPCWSTR groupname, DWORD level, LPBYTE buf, DWORD totalentries ); DWORD __stdcall NetLocalGroupDelMembers ( LPCWSTR servername , LPCWSTR groupname, DWORD level, LPBYTE buf, DWORD totalentries ); typedef struct _LOCALGROUP_INFO_0 { LPWSTR lgrpi0_name; }LOCALGROUP_INFO_0, *PLOCALGROUP_INFO_0, *LPLOCALGROUP_INFO_0; typedef struct _LOCALGROUP_INFO_1 { LPWSTR lgrpi1_name; LPWSTR lgrpi1_comment; }LOCALGROUP_INFO_1, *PLOCALGROUP_INFO_1, *LPLOCALGROUP_INFO_1; typedef struct _LOCALGROUP_INFO_1002 { LPWSTR lgrpi1002_comment; }LOCALGROUP_INFO_1002, *PLOCALGROUP_INFO_1002, *LPLOCALGROUP_INFO_1002; typedef struct _LOCALGROUP_MEMBERS_INFO_0 { PSID lgrmi0_sid; } LOCALGROUP_MEMBERS_INFO_0, *PLOCALGROUP_MEMBERS_INFO_0, *LPLOCALGROUP_MEMBERS_INFO_0; typedef struct _LOCALGROUP_MEMBERS_INFO_1 { PSID lgrmi1_sid; SID_NAME_USE lgrmi1_sidusage; LPWSTR lgrmi1_name; } LOCALGROUP_MEMBERS_INFO_1, *PLOCALGROUP_MEMBERS_INFO_1, *LPLOCALGROUP_MEMBERS_INFO_1; typedef struct _LOCALGROUP_MEMBERS_INFO_2 { PSID lgrmi2_sid; SID_NAME_USE lgrmi2_sidusage; LPWSTR lgrmi2_domainandname; } LOCALGROUP_MEMBERS_INFO_2, *PLOCALGROUP_MEMBERS_INFO_2, *LPLOCALGROUP_MEMBERS_INFO_2; typedef struct _LOCALGROUP_MEMBERS_INFO_3 { LPWSTR lgrmi3_domainandname; } LOCALGROUP_MEMBERS_INFO_3, *PLOCALGROUP_MEMBERS_INFO_3, *LPLOCALGROUP_MEMBERS_INFO_3; typedef struct _LOCALGROUP_USERS_INFO_0 { LPWSTR lgrui0_name; } LOCALGROUP_USERS_INFO_0, *PLOCALGROUP_USERS_INFO_0, *LPLOCALGROUP_USERS_INFO_0; DWORD __stdcall NetQueryDisplayInformation( LPCWSTR ServerName , DWORD Level, DWORD Index, DWORD EntriesRequested, DWORD PreferredMaximumLength, LPDWORD ReturnedEntryCount, PVOID *SortedBuffer ); DWORD __stdcall NetGetDisplayInformationIndex( LPCWSTR ServerName , DWORD Level, LPCWSTR Prefix, LPDWORD Index ); typedef struct _NET_DISPLAY_USER { LPWSTR usri1_name; LPWSTR usri1_comment; DWORD usri1_flags; LPWSTR usri1_full_name; DWORD usri1_user_id; DWORD usri1_next_index; } NET_DISPLAY_USER, *PNET_DISPLAY_USER; typedef struct _NET_DISPLAY_MACHINE { LPWSTR usri2_name; LPWSTR usri2_comment; DWORD usri2_flags; DWORD usri2_user_id; DWORD usri2_next_index; } NET_DISPLAY_MACHINE, *PNET_DISPLAY_MACHINE; typedef struct _NET_DISPLAY_GROUP { LPWSTR grpi3_name; LPWSTR grpi3_comment; DWORD grpi3_group_id; DWORD grpi3_attributes; DWORD grpi3_next_index; } NET_DISPLAY_GROUP, *PNET_DISPLAY_GROUP; DWORD __stdcall NetAccessAdd ( LPCWSTR servername , DWORD level, LPBYTE buf, LPDWORD parm_err ); DWORD __stdcall NetAccessEnum ( LPCWSTR servername , LPCWSTR BasePath, DWORD Recursive, DWORD level, LPBYTE *bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries, LPDWORD resume_handle ); DWORD __stdcall NetAccessGetInfo ( LPCWSTR servername , LPCWSTR resource, DWORD level, LPBYTE *bufptr ); DWORD __stdcall NetAccessSetInfo ( LPCWSTR servername , LPCWSTR resource, DWORD level, LPBYTE buf, LPDWORD parm_err ); DWORD __stdcall NetAccessDel ( LPCWSTR servername , LPCWSTR resource ); DWORD __stdcall NetAccessGetUserPerms ( LPCWSTR servername , LPCWSTR UGname, LPCWSTR resource, LPDWORD Perms ); typedef struct _ACCESS_INFO_0 { LPWSTR acc0_resource_name; }ACCESS_INFO_0, *PACCESS_INFO_0, *LPACCESS_INFO_0; typedef struct _ACCESS_INFO_1 { LPWSTR acc1_resource_name; DWORD acc1_attr; DWORD acc1_count; }ACCESS_INFO_1, *PACCESS_INFO_1, *LPACCESS_INFO_1; typedef struct _ACCESS_INFO_1002 { DWORD acc1002_attr; } ACCESS_INFO_1002, *PACCESS_INFO_1002, *LPACCESS_INFO_1002; typedef struct _ACCESS_LIST { LPWSTR acl_ugname; DWORD acl_access; }ACCESS_LIST, *PACCESS_LIST, *LPACCESS_LIST; typedef enum _NET_VALIDATE_PASSWORD_TYPE{ NetValidateAuthentication = 1, NetValidatePasswordChange, NetValidatePasswordReset } NET_VALIDATE_PASSWORD_TYPE, *PNET_VALIDATE_PASSWORD_TYPE; typedef struct _NET_VALIDATE_PASSWORD_HASH{ ULONG Length; LPBYTE Hash; } NET_VALIDATE_PASSWORD_HASH, *PNET_VALIDATE_PASSWORD_HASH; typedef struct _NET_VALIDATE_PERSISTED_FIELDS{ ULONG PresentFields; FILETIME PasswordLastSet; FILETIME BadPasswordTime; FILETIME LockoutTime; ULONG BadPasswordCount; ULONG PasswordHistoryLength; PNET_VALIDATE_PASSWORD_HASH PasswordHistory; } NET_VALIDATE_PERSISTED_FIELDS, *PNET_VALIDATE_PERSISTED_FIELDS; typedef struct _NET_VALIDATE_OUTPUT_ARG{ NET_VALIDATE_PERSISTED_FIELDS ChangedPersistedFields; DWORD ValidationStatus; } NET_VALIDATE_OUTPUT_ARG, *PNET_VALIDATE_OUTPUT_ARG; typedef struct _NET_VALIDATE_AUTHENTICATION_INPUT_ARG{ NET_VALIDATE_PERSISTED_FIELDS InputPersistedFields; BOOLEAN PasswordMatched; } NET_VALIDATE_AUTHENTICATION_INPUT_ARG, *PNET_VALIDATE_AUTHENTICATION_INPUT_ARG; typedef struct _NET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG{ NET_VALIDATE_PERSISTED_FIELDS InputPersistedFields; LPWSTR ClearPassword; LPWSTR UserAccountName; NET_VALIDATE_PASSWORD_HASH HashedPassword; BOOLEAN PasswordMatch; } NET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG, *PNET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG; typedef struct _NET_VALIDATE_PASSWORD_RESET_INPUT_ARG{ NET_VALIDATE_PERSISTED_FIELDS InputPersistedFields; LPWSTR ClearPassword; LPWSTR UserAccountName; NET_VALIDATE_PASSWORD_HASH HashedPassword; BOOLEAN PasswordMustChangeAtNextLogon; BOOLEAN ClearLockout; } NET_VALIDATE_PASSWORD_RESET_INPUT_ARG, *PNET_VALIDATE_PASSWORD_RESET_INPUT_ARG; DWORD __stdcall NetValidatePasswordPolicy( LPCWSTR ServerName, LPVOID Qualifier, NET_VALIDATE_PASSWORD_TYPE ValidationType, LPVOID InputArg, LPVOID *OutputArg ); DWORD __stdcall NetValidatePasswordPolicyFree( LPVOID *OutputArg ); DWORD __stdcall NetGetDCName ( LPCWSTR ServerName, LPCWSTR DomainName, LPBYTE *Buffer ); DWORD __stdcall NetGetAnyDCName ( LPCWSTR ServerName, LPCWSTR DomainName, LPBYTE *Buffer ); DWORD __stdcall I_NetLogonControl( LPCWSTR ServerName , DWORD FunctionCode, DWORD QueryLevel, LPBYTE *Buffer ); DWORD __stdcall I_NetLogonControl2( LPCWSTR ServerName , DWORD FunctionCode, DWORD QueryLevel, LPBYTE Data, LPBYTE *Buffer ); typedef LONG NTSTATUS, *PNTSTATUS; NTSTATUS __stdcall NetEnumerateTrustedDomains ( LPWSTR ServerName , LPWSTR *DomainNames ); typedef struct _NETLOGON_INFO_1 { DWORD netlog1_flags; DWORD netlog1_pdc_connection_status; } NETLOGON_INFO_1, *PNETLOGON_INFO_1; typedef struct _NETLOGON_INFO_2 { DWORD netlog2_flags; DWORD netlog2_pdc_connection_status; LPWSTR netlog2_trusted_dc_name; DWORD netlog2_tc_connection_status; } NETLOGON_INFO_2, *PNETLOGON_INFO_2; typedef struct _NETLOGON_INFO_3 { DWORD netlog3_flags; DWORD netlog3_logon_attempts; DWORD netlog3_reserved1; DWORD netlog3_reserved2; DWORD netlog3_reserved3; DWORD netlog3_reserved4; DWORD netlog3_reserved5; } NETLOGON_INFO_3, *PNETLOGON_INFO_3; typedef struct _NETLOGON_INFO_4 { LPWSTR netlog4_trusted_dc_name; LPWSTR netlog4_trusted_domain_name; } NETLOGON_INFO_4, *PNETLOGON_INFO_4; extern "C" const GUID ServiceAccountPasswordGUID; NTSTATUS NetAddServiceAccount( LPWSTR ServerName, LPWSTR AccountName, LPWSTR Password, DWORD Flags); NTSTATUS NetRemoveServiceAccount( LPWSTR ServerName, LPWSTR AccountName, DWORD Flags); NTSTATUS NetEnumerateServiceAccounts( LPWSTR ServerName, DWORD Flags, DWORD* AccountsCount, PZPWSTR* Accounts); NTSTATUS NetIsServiceAccount( LPWSTR ServerName, LPWSTR AccountName, BOOL *IsService); NTSTATUS NetQueryServiceAccount( LPWSTR ServerName, LPWSTR AccountName, DWORD InfoLevel, PBYTE* Buffer); typedef enum _MSA_INFO_LEVEL { MsaInfoLevel0 = 0, MsaInfoLevelMax } MSA_INFO_LEVEL, *PMSA_INFO_LEVEL; typedef enum _MSA_INFO_STATE { MsaInfoNotExist = 1, MsaInfoNotService, MsaInfoCannotInstall, MsaInfoCanInstall, MsaInfoInstalled }MSA_INFO_STATE, *PMSA_INFO_STATE; typedef struct _MSA_INFO_0 { MSA_INFO_STATE State; }MSA_INFO_0, *PMSA_INFO_0, *LPMSA_INFO_0; } namespace sandbox { const wchar_t kNtdllName[] = L"ntdll.dll"; const wchar_t kKerneldllName[] = L"kernel32.dll"; const wchar_t kKernelBasedllName[] = L"kernelbase.dll"; enum ArgType { INVALID_TYPE = 0, WCHAR_TYPE, UINT32_TYPE, UNISTR_TYPE, VOIDPTR_TYPE, INPTR_TYPE, INOUTPTR_TYPE, LAST_TYPE }; class CountedBuffer { public: CountedBuffer(void* buffer, uint32_t size) : size_(size), buffer_(buffer) {} uint32_t Size() const { return size_; } void* Buffer() const { return buffer_; } private: uint32_t size_; void* buffer_; }; class IPCInt { public: explicit IPCInt(void* buffer) { buffer_.vp = buffer; } explicit IPCInt(uint32_t i32) { buffer_.vp = nullptr; buffer_.i32 = i32; } uint32_t As32Bit() const { return buffer_.i32; } void* AsVoidPtr() const { return buffer_.vp; } private: union U { void* vp; uint32_t i32; } buffer_; }; } namespace sandbox { struct NtExports { NtAllocateVirtualMemoryFunction AllocateVirtualMemory; NtCloseFunction Close; NtDuplicateObjectFunction DuplicateObject; NtFreeVirtualMemoryFunction FreeVirtualMemory; NtMapViewOfSectionFunction MapViewOfSection; NtProtectVirtualMemoryFunction ProtectVirtualMemory; NtQueryInformationProcessFunction QueryInformationProcess; NtQueryObjectFunction QueryObject; NtQuerySectionFunction QuerySection; NtQueryVirtualMemoryFunction QueryVirtualMemory; NtUnmapViewOfSectionFunction UnmapViewOfSection; NtSignalAndWaitForSingleObjectFunction SignalAndWaitForSingleObject; NtWaitForSingleObjectFunction WaitForSingleObject; RtlAllocateHeapFunction RtlAllocateHeap; RtlAnsiStringToUnicodeStringFunction RtlAnsiStringToUnicodeString; RtlCompareUnicodeStringFunction RtlCompareUnicodeString; RtlCreateHeapFunction RtlCreateHeap; RtlCreateUserThreadFunction RtlCreateUserThread; RtlDestroyHeapFunction RtlDestroyHeap; RtlFreeHeapFunction RtlFreeHeap; _strnicmpFunction _strnicmp; strlenFunction strlen; wcslenFunction wcslen; memcpyFunction memcpy; }; enum AllocationType { NT_ALLOC, NT_PAGE }; } namespace sandbox { enum class IpcTag { UNUSED = 0, PING1, PING2, NTCREATEFILE, NTOPENFILE, NTQUERYATTRIBUTESFILE, NTQUERYFULLATTRIBUTESFILE, NTSETINFO_RENAME, CREATENAMEDPIPEW, NTOPENTHREAD, NTOPENPROCESS, NTOPENPROCESSTOKEN, NTOPENPROCESSTOKENEX, CREATEPROCESSW, CREATEEVENT, OPENEVENT, NTCREATEKEY, NTOPENKEY, GDI_GDIDLLINITIALIZE, GDI_GETSTOCKOBJECT, USER_REGISTERCLASSW, CREATETHREAD, USER_ENUMDISPLAYMONITORS, USER_ENUMDISPLAYDEVICES, USER_GETMONITORINFO, GDI_CREATEOPMPROTECTEDOUTPUTS, GDI_GETCERTIFICATE, GDI_GETCERTIFICATESIZE, GDI_DESTROYOPMPROTECTEDOUTPUT, GDI_CONFIGUREOPMPROTECTEDOUTPUT, GDI_GETOPMINFORMATION, GDI_GETOPMRANDOMNUMBER, GDI_GETSUGGESTEDOPMPROTECTEDOUTPUTARRAYSIZE, GDI_SETOPMSIGNINGKEYANDSEQUENCENUMBERS, NTCREATESECTION, LAST }; constexpr size_t kMaxServiceCount = 64; constexpr size_t kMaxIpcTag = static_cast<size_t>(IpcTag::LAST); static_assert(kMaxIpcTag <= kMaxServiceCount, "kMaxServiceCount is too low"); } namespace sandbox { extern "C" NtExports g_nt; namespace { inline uint32_t Align(uint32_t value) { uint32_t alignment = sizeof(int64_t); return ((value + alignment - 1) / alignment) * alignment; } inline void* memcpy_wrapper(void* dest, const void* src, size_t count) { if (g_nt.memcpy) return g_nt.memcpy(dest, src, count); return memcpy(dest, src, count); } } const size_t kExtendedReturnCount = 8; union MultiType { uint32_t unsigned_int; void* pointer; HANDLE handle; ULONG_PTR ulong_ptr; }; const int kMaxIpcParams = 9; struct ParamInfo { ArgType type_; uint32_t offset_; uint32_t size_; }; struct CrossCallReturn { uint32_t tag; ResultCode call_outcome; union { NTSTATUS nt_status; DWORD win32_result; }; uint32_t extended_count; HANDLE handle; MultiType extended[kExtendedReturnCount]; }; class CrossCallParams { public: IpcTag GetTag() const { return tag_; } const void* GetBuffer() const { return this; } uint32_t GetParamsCount() const { return params_count_; } CrossCallReturn* GetCallReturn() { return &call_return; } bool IsInOut() const { return (1 == is_in_out_); } void SetIsInOut(bool value) { if (value) is_in_out_ = 1; else is_in_out_ = 0; } protected: CrossCallParams(IpcTag tag, uint32_t params_count) : tag_(tag), is_in_out_(0), params_count_(params_count) {} private: IpcTag tag_; uint32_t is_in_out_; CrossCallReturn call_return; const uint32_t params_count_; CrossCallParams(const CrossCallParams&) = delete; CrossCallParams& operator=(const CrossCallParams&) = delete; }; template <size_t NUMBER_PARAMS, size_t BLOCK_SIZE> class ActualCallParams : public CrossCallParams { public: explicit ActualCallParams(IpcTag tag) : CrossCallParams(tag, NUMBER_PARAMS) { param_info_[0].offset_ = static_cast<uint32_t>(parameters_ - reinterpret_cast<char*>(this)); } ActualCallParams(IpcTag tag, uint32_t number_params) : CrossCallParams(tag, number_params) { param_info_[0].offset_ = static_cast<uint32_t>(parameters_ - reinterpret_cast<char*>(this)); } uint32_t OverrideSize(uint32_t new_size) { uint32_t previous_size = param_info_[NUMBER_PARAMS].offset_; param_info_[NUMBER_PARAMS].offset_ = new_size; return previous_size; } bool CopyParamIn(uint32_t index, const void* parameter_address, uint32_t size, bool is_in_out, ArgType type) { if (index >= NUMBER_PARAMS) { return false; } if (0xffffffffui32 == size) { return false; } if (size && !parameter_address) { return false; } if ((size > sizeof(*this)) || (param_info_[index].offset_ > (sizeof(*this) - size))) { return false; } char* dest = reinterpret_cast<char*>(this) + param_info_[index].offset_; __try { memcpy_wrapper(dest, parameter_address, size); } __except (1) { return false; } if (is_in_out) SetIsInOut(true); param_info_[index + 1].offset_ = Align(param_info_[index].offset_ + size); param_info_[index].size_ = size; param_info_[index].type_ = type; return true; } void* GetParamPtr(size_t index) { return reinterpret_cast<char*>(this) + param_info_[index].offset_; } uint32_t GetSize() const { return param_info_[NUMBER_PARAMS].offset_; } protected: ActualCallParams() : CrossCallParams(IpcTag::UNUSED, NUMBER_PARAMS) {} private: ParamInfo param_info_[NUMBER_PARAMS + 1]; char parameters_[BLOCK_SIZE - sizeof(CrossCallParams) - sizeof(ParamInfo) * (NUMBER_PARAMS + 1)]; ActualCallParams(const ActualCallParams&) = delete; ActualCallParams& operator=(const ActualCallParams&) = delete; }; static_assert(sizeof(ActualCallParams<1, 1024>) == 1024, "bad size buffer"); static_assert(sizeof(ActualCallParams<2, 1024>) == 1024, "bad size buffer"); static_assert(sizeof(ActualCallParams<3, 1024>) == 1024, "bad size buffer"); } namespace base { class AtomicRefCount { public: constexpr AtomicRefCount() : ref_count_(0) {} explicit constexpr AtomicRefCount(int initial_value) : ref_count_(initial_value) {} int Increment() { return Increment(1); } int Increment(int increment) { return ref_count_.fetch_add(increment, std::memory_order_relaxed); } bool Decrement() { return ref_count_.fetch_sub(1, std::memory_order_acq_rel) != 1; } bool IsOne() const { return ref_count_.load(std::memory_order_acquire) == 1; } bool IsZero() const { return ref_count_.load(std::memory_order_acquire) == 0; } int SubtleRefCountForDebug() const { return ref_count_.load(std::memory_order_relaxed); } private: std::atomic_int ref_count_; }; } template <class T> class scoped_refptr; namespace base { template <class, typename> class RefCounted; template <class, typename> class RefCountedThreadSafe; class SequencedTaskRunner; class WrappedPromise; template <typename T> scoped_refptr<T> AdoptRef(T* t); namespace internal { class BasePromise; } namespace subtle { enum AdoptRefTag { kAdoptRefTag }; enum StartRefCountFromZeroTag { kStartRefCountFromZeroTag }; enum StartRefCountFromOneTag { kStartRefCountFromOneTag }; template <typename T, typename U, typename V> constexpr bool IsRefCountPreferenceOverridden(const T*, const RefCounted<U, V>*) { return !std::is_same<std::decay_t<decltype(T::kRefCountPreference)>, std::decay_t<decltype(U::kRefCountPreference)>>::value; } template <typename T, typename U, typename V> constexpr bool IsRefCountPreferenceOverridden( const T*, const RefCountedThreadSafe<U, V>*) { return !std::is_same<std::decay_t<decltype(T::kRefCountPreference)>, std::decay_t<decltype(U::kRefCountPreference)>>::value; } constexpr bool IsRefCountPreferenceOverridden(...) { return false; } } template <typename T> scoped_refptr<T> AdoptRef(T* obj) { using Tag = std::decay_t<decltype(T::kRefCountPreference)>; static_assert(std::is_same<subtle::StartRefCountFromOneTag, Tag>::value, "Use AdoptRef only if the reference count starts from one."); true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << !(obj); true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << !(obj->HasOneRef()); obj->Adopted(); return scoped_refptr<T>(obj, subtle::kAdoptRefTag); } namespace subtle { template <typename T> scoped_refptr<T> AdoptRefIfNeeded(T* obj, StartRefCountFromZeroTag) { return scoped_refptr<T>(obj); } template <typename T> scoped_refptr<T> AdoptRefIfNeeded(T* obj, StartRefCountFromOneTag) { return AdoptRef(obj); } } template <typename T, typename... Args> scoped_refptr<T> MakeRefCounted(Args&&... args) { T* obj = new T(std::forward<Args>(args)...); return subtle::AdoptRefIfNeeded(obj, T::kRefCountPreference); } template <typename T> scoped_refptr<T> WrapRefCounted(T* t) { return scoped_refptr<T>(t); } } template <class T> class scoped_refptr { public: typedef T element_type; constexpr scoped_refptr() = default; constexpr scoped_refptr(std::nullptr_t) {} scoped_refptr(T* p) : ptr_(p) { if (ptr_) AddRef(ptr_); } scoped_refptr(const scoped_refptr& r) : scoped_refptr(r.ptr_) {} template <typename U, typename = typename std::enable_if< std::is_convertible<U*, T*>::value>::type> scoped_refptr(const scoped_refptr<U>& r) : scoped_refptr(r.ptr_) {} scoped_refptr(scoped_refptr&& r) noexcept : ptr_(r.ptr_) { r.ptr_ = nullptr; } template <typename U, typename = typename std::enable_if< std::is_convertible<U*, T*>::value>::type> scoped_refptr(scoped_refptr<U>&& r) noexcept : ptr_(r.ptr_) { r.ptr_ = nullptr; } ~scoped_refptr() { static_assert(!base::subtle::IsRefCountPreferenceOverridden( static_cast<T*>(nullptr), static_cast<T*>(nullptr)), "It's unsafe to override the ref count preference." " Please remove REQUIRE_ADOPTION_FOR_REFCOUNTED_TYPE" " from subclasses."); if (ptr_) Release(ptr_); } T* get() const { return ptr_; } T& operator*() const { true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << !(ptr_); return *ptr_; } T* operator->() const { true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << !(ptr_); return ptr_; } scoped_refptr& operator=(std::nullptr_t) { reset(); return *this; } scoped_refptr& operator=(T* p) { return *this = scoped_refptr(p); } scoped_refptr& operator=(scoped_refptr r) noexcept { swap(r); return *this; } void reset() { scoped_refptr().swap(*this); } void swap(scoped_refptr& r) noexcept { std::swap(ptr_, r.ptr_); } explicit operator bool() const { return ptr_ != nullptr; } template <typename U> bool operator==(const scoped_refptr<U>& rhs) const { return ptr_ == rhs.get(); } template <typename U> bool operator!=(const scoped_refptr<U>& rhs) const { return !operator==(rhs); } template <typename U> bool operator<(const scoped_refptr<U>& rhs) const { return ptr_ < rhs.get(); } protected: T* ptr_ = nullptr; private: template <typename U> friend scoped_refptr<U> base::AdoptRef(U*); friend class ::base::SequencedTaskRunner; friend class ::base::internal::BasePromise; friend class ::base::WrappedPromise; T* release(); scoped_refptr(T* p, base::subtle::AdoptRefTag) : ptr_(p) {} template <typename U> friend class scoped_refptr; static void AddRef(T* ptr); static void Release(T* ptr); }; template <typename T> T* scoped_refptr<T>::release() { T* ptr = ptr_; ptr_ = nullptr; return ptr; } template <typename T> void scoped_refptr<T>::AddRef(T* ptr) { ptr->AddRef(); } template <typename T> void scoped_refptr<T>::Release(T* ptr) { ptr->Release(); } template <typename T, typename U> bool operator==(const scoped_refptr<T>& lhs, const U* rhs) { return lhs.get() == rhs; } template <typename T, typename U> bool operator==(const T* lhs, const scoped_refptr<U>& rhs) { return lhs == rhs.get(); } template <typename T> bool operator==(const scoped_refptr<T>& lhs, std::nullptr_t null) { return !static_cast<bool>(lhs); } template <typename T> bool operator==(std::nullptr_t null, const scoped_refptr<T>& rhs) { return !static_cast<bool>(rhs); } template <typename T, typename U> bool operator!=(const scoped_refptr<T>& lhs, const U* rhs) { return !operator==(lhs, rhs); } template <typename T, typename U> bool operator!=(const T* lhs, const scoped_refptr<U>& rhs) { return !operator==(lhs, rhs); } template <typename T> bool operator!=(const scoped_refptr<T>& lhs, std::nullptr_t null) { return !operator==(lhs, null); } template <typename T> bool operator!=(std::nullptr_t null, const scoped_refptr<T>& rhs) { return !operator==(null, rhs); } template <typename T> std::ostream& operator<<(std::ostream& out, const scoped_refptr<T>& p) { return out << p.get(); } template <typename T> void swap(scoped_refptr<T>& lhs, scoped_refptr<T>& rhs) noexcept { lhs.swap(rhs); } namespace thread_safety_analysis { template <typename T> inline const T& ts_unchecked_read(const T& v) __attribute__((no_thread_safety_analysis)) { return v; } template <typename T> inline T& ts_unchecked_read(T& v) __attribute__((no_thread_safety_analysis)) { return v; } } namespace base { namespace internal { class LockImpl { public: using NativeHandle = CHROME_SRWLOCK; LockImpl(); ~LockImpl(); bool Try(); void Lock(); inline void Unlock(); NativeHandle* native_handle() { return &native_handle_; } private: NativeHandle native_handle_; LockImpl(const LockImpl&) = delete; LockImpl& operator=(const LockImpl&) = delete; }; void LockImpl::Unlock() { ::ReleaseSRWLockExclusive(reinterpret_cast<PSRWLOCK>(&native_handle_)); } template <class LockType> class __attribute__((scoped_lockable)) BasicAutoLock { public: struct AlreadyAcquired {}; explicit BasicAutoLock(LockType& lock) __attribute__((exclusive_lock_function(lock))) : lock_(lock) { lock_.Acquire(); } BasicAutoLock(LockType& lock, const AlreadyAcquired&) __attribute__((exclusive_locks_required(lock))) : lock_(lock) { lock_.AssertAcquired(); } ~BasicAutoLock() __attribute__((unlock_function())) { lock_.AssertAcquired(); lock_.Release(); } private: LockType& lock_; BasicAutoLock(const BasicAutoLock&) = delete; BasicAutoLock& operator=(const BasicAutoLock&) = delete; }; template <class LockType> class BasicAutoUnlock { public: explicit BasicAutoUnlock(LockType& lock) : lock_(lock) { lock_.AssertAcquired(); lock_.Release(); } ~BasicAutoUnlock() { lock_.Acquire(); } private: LockType& lock_; BasicAutoUnlock(const BasicAutoUnlock&) = delete; BasicAutoUnlock& operator=(const BasicAutoUnlock&) = delete; }; template <class LockType> class __attribute__((scoped_lockable)) BasicAutoLockMaybe { public: explicit BasicAutoLockMaybe(LockType* lock) __attribute__((exclusive_lock_function(lock))) : lock_(lock) { if (lock_) lock_->Acquire(); } ~BasicAutoLockMaybe() __attribute__((unlock_function())) { if (lock_) { lock_->AssertAcquired(); lock_->Release(); } } private: LockType* const lock_; BasicAutoLockMaybe(const BasicAutoLockMaybe&) = delete; BasicAutoLockMaybe& operator=(const BasicAutoLockMaybe&) = delete; }; template <class LockType> class __attribute__((scoped_lockable)) BasicReleasableAutoLock { public: explicit BasicReleasableAutoLock(LockType* lock) __attribute__((exclusive_lock_function(lock))) : lock_(lock) { true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << !(lock_); lock_->Acquire(); } ~BasicReleasableAutoLock() __attribute__((unlock_function())) { if (lock_) { lock_->AssertAcquired(); lock_->Release(); } } void Release() __attribute__((unlock_function())) { true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << !(lock_); lock_->AssertAcquired(); lock_->Release(); lock_ = nullptr; } private: LockType* lock_; BasicReleasableAutoLock(const BasicReleasableAutoLock&) = delete; BasicReleasableAutoLock& operator=(const BasicReleasableAutoLock&) = delete; }; } } namespace base { typedef DWORD PlatformThreadId; class PlatformThreadRef { public: typedef DWORD RefType; constexpr PlatformThreadRef() : id_(0) {} explicit constexpr PlatformThreadRef(RefType id) : id_(id) {} bool operator==(PlatformThreadRef other) const { return id_ == other.id_; } bool operator!=(PlatformThreadRef other) const { return id_ != other.id_; } bool is_null() const { return id_ == 0; } private: RefType id_; }; class PlatformThreadHandle { public: typedef void* Handle; constexpr PlatformThreadHandle() : handle_(0) {} explicit constexpr PlatformThreadHandle(Handle handle) : handle_(handle) {} bool is_equal(const PlatformThreadHandle& other) const { return handle_ == other.handle_; } bool is_null() const { return !handle_; } Handle platform_handle() const { return handle_; } private: Handle handle_; }; const PlatformThreadId kInvalidThreadId(0); enum class ThreadPriority : int { BACKGROUND, NORMAL, DISPLAY, REALTIME_AUDIO, }; class PlatformThread { public: class Delegate { public: virtual void ThreadMain() = 0; protected: virtual ~Delegate() = default; }; static PlatformThreadId CurrentId(); static PlatformThreadRef CurrentRef(); static PlatformThreadHandle CurrentHandle(); static void YieldCurrentThread(); static void Sleep(base::TimeDelta duration); static void SetName(const std::string& name); static const char* GetName(); static bool Create(size_t stack_size, Delegate* delegate, PlatformThreadHandle* thread_handle) { return CreateWithPriority(stack_size, delegate, thread_handle, ThreadPriority::NORMAL); } static bool CreateWithPriority(size_t stack_size, Delegate* delegate, PlatformThreadHandle* thread_handle, ThreadPriority priority); static bool CreateNonJoinable(size_t stack_size, Delegate* delegate); static bool CreateNonJoinableWithPriority(size_t stack_size, Delegate* delegate, ThreadPriority priority); static void Join(PlatformThreadHandle thread_handle); static void Detach(PlatformThreadHandle thread_handle); static bool CanIncreaseThreadPriority(ThreadPriority priority); static void SetCurrentThreadPriority(ThreadPriority priority); static ThreadPriority GetCurrentThreadPriority(); static size_t GetDefaultThreadStackSize(); private: static void SetCurrentThreadPriorityImpl(ThreadPriority priority); PlatformThread() = delete; PlatformThread(const PlatformThread&) = delete; PlatformThread& operator=(const PlatformThread&) = delete; }; namespace internal { void InitializeThreadPrioritiesFeature(); } } namespace base { class __attribute__((lockable)) Lock { public: Lock() : lock_() {} ~Lock() {} void Acquire() { lock_.Lock(); } void Release() { lock_.Unlock(); } bool Try() { return lock_.Try(); } void AssertAcquired() const __attribute__((assert_exclusive_lock())) {} static bool HandlesMultipleThreadPriorities() { return true; } friend class ConditionVariable; private: internal::LockImpl lock_; Lock(const Lock&) = delete; Lock& operator=(const Lock&) = delete; }; using AutoLock = internal::BasicAutoLock<Lock>; using AutoUnlock = internal::BasicAutoUnlock<Lock>; using AutoLockMaybe = internal::BasicAutoLockMaybe<Lock>; using ReleasableAutoLock = internal::BasicReleasableAutoLock<Lock>; } namespace base { class __attribute__((lockable)) SequenceCheckerImpl { public: SequenceCheckerImpl(); ~SequenceCheckerImpl(); SequenceCheckerImpl(SequenceCheckerImpl&& other); SequenceCheckerImpl& operator=(SequenceCheckerImpl&& other); bool CalledOnValidSequence() const __attribute__((warn_unused_result)); void DetachFromSequence(); private: class Core; static bool HasThreadLocalStorageBeenDestroyed(); mutable Lock lock_; mutable std::unique_ptr<Core> core_ __attribute__((guarded_by(lock_))); SequenceCheckerImpl(const SequenceCheckerImpl&) = delete; SequenceCheckerImpl& operator=(const SequenceCheckerImpl&) = delete; }; } namespace base { class __attribute__((lockable)) SequenceCheckerDoNothing { public: SequenceCheckerDoNothing() = default; SequenceCheckerDoNothing(SequenceCheckerDoNothing&& other) = default; SequenceCheckerDoNothing& operator=(SequenceCheckerDoNothing&& other) = default; bool CalledOnValidSequence() const __attribute__((warn_unused_result)) { return true; } void DetachFromSequence() {} private: SequenceCheckerDoNothing(const SequenceCheckerDoNothing&) = delete; SequenceCheckerDoNothing& operator=(const SequenceCheckerDoNothing&) = delete; }; class SequenceChecker : public SequenceCheckerDoNothing { }; class __attribute__((scoped_lockable)) ScopedValidateSequenceChecker { public: explicit ScopedValidateSequenceChecker(const SequenceChecker& checker) __attribute__((exclusive_lock_function(checker))) { true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << !(checker.CalledOnValidSequence()); } explicit ScopedValidateSequenceChecker(const SequenceChecker& checker, const StringPiece& msg) __attribute__((exclusive_lock_function(checker))) { true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << !(checker.CalledOnValidSequence()) << msg; } ~ScopedValidateSequenceChecker() __attribute__((unlock_function())) {} private: }; } namespace base { namespace subtle { typedef int32_t Atomic32; typedef intptr_t Atomic64; typedef intptr_t AtomicWord; Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr, Atomic32 old_value, Atomic32 new_value); Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, Atomic32 new_value); Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, Atomic32 increment); Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr, Atomic32 increment); Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr, Atomic32 old_value, Atomic32 new_value); Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, Atomic32 old_value, Atomic32 new_value); void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value); void Acquire_Store(volatile Atomic32* ptr, Atomic32 value); void Release_Store(volatile Atomic32* ptr, Atomic32 value); Atomic32 NoBarrier_Load(volatile const Atomic32* ptr); Atomic32 Acquire_Load(volatile const Atomic32* ptr); Atomic32 Release_Load(volatile const Atomic32* ptr); Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, Atomic64 old_value, Atomic64 new_value); Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, Atomic64 new_value); Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment); Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment); Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr, Atomic64 old_value, Atomic64 new_value); Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr, Atomic64 old_value, Atomic64 new_value); void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value); void Acquire_Store(volatile Atomic64* ptr, Atomic64 value); void Release_Store(volatile Atomic64* ptr, Atomic64 value); Atomic64 NoBarrier_Load(volatile const Atomic64* ptr); Atomic64 Acquire_Load(volatile const Atomic64* ptr); Atomic64 Release_Load(volatile const Atomic64* ptr); } } namespace base { namespace subtle { inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr, Atomic32 old_value, Atomic32 new_value) { LONG result = _InterlockedCompareExchange( reinterpret_cast<volatile LONG*>(ptr), static_cast<LONG>(new_value), static_cast<LONG>(old_value)); return static_cast<Atomic32>(result); } inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, Atomic32 new_value) { LONG result = _InterlockedExchange( reinterpret_cast<volatile LONG*>(ptr), static_cast<LONG>(new_value)); return static_cast<Atomic32>(result); } inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr, Atomic32 increment) { return _InterlockedExchangeAdd( reinterpret_cast<volatile LONG*>(ptr), static_cast<LONG>(increment)) + increment; } inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, Atomic32 increment) { return Barrier_AtomicIncrement(ptr, increment); } inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr, Atomic32 old_value, Atomic32 new_value) { return NoBarrier_CompareAndSwap(ptr, old_value, new_value); } inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, Atomic32 old_value, Atomic32 new_value) { return NoBarrier_CompareAndSwap(ptr, old_value, new_value); } inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) { *ptr = value; } inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) { NoBarrier_AtomicExchange(ptr, value); } inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) { *ptr = value; } inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) { return *ptr; } inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) { Atomic32 value = *ptr; return value; } inline Atomic32 Release_Load(volatile const Atomic32* ptr) { std::atomic_thread_fence(std::memory_order_seq_cst); return *ptr; } static_assert(sizeof(Atomic64) == sizeof(PVOID), "atomic word is atomic"); inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, Atomic64 old_value, Atomic64 new_value) { PVOID result = _InterlockedCompareExchangePointer( reinterpret_cast<volatile PVOID*>(ptr), reinterpret_cast<PVOID>(new_value), reinterpret_cast<PVOID>(old_value)); return reinterpret_cast<Atomic64>(result); } inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, Atomic64 new_value) { PVOID result = _InterlockedExchangePointer(reinterpret_cast<volatile PVOID*>(ptr), reinterpret_cast<PVOID>(new_value)); return reinterpret_cast<Atomic64>(result); } inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment) { return _InterlockedExchangeAdd64(reinterpret_cast<volatile LONGLONG*>(ptr), static_cast<LONGLONG>(increment)) + increment; } inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment) { return Barrier_AtomicIncrement(ptr, increment); } inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) { *ptr = value; } inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) { NoBarrier_AtomicExchange(ptr, value); } inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) { *ptr = value; } inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) { return *ptr; } inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) { Atomic64 value = *ptr; return value; } inline Atomic64 Release_Load(volatile const Atomic64* ptr) { std::atomic_thread_fence(std::memory_order_seq_cst); return *ptr; } inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr, Atomic64 old_value, Atomic64 new_value) { return NoBarrier_CompareAndSwap(ptr, old_value, new_value); } inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr, Atomic64 old_value, Atomic64 new_value) { return NoBarrier_CompareAndSwap(ptr, old_value, new_value); } } } namespace base { struct AsserterBase { virtual ~AsserterBase() = default; virtual void warn() = 0; }; struct DCheckAsserter : public AsserterBase { ~DCheckAsserter() override = default; void warn() override; }; class ThreadCollisionWarner { public: explicit ThreadCollisionWarner(AsserterBase* asserter = new DCheckAsserter()) : valid_thread_id_(0), counter_(0), asserter_(asserter) {} ~ThreadCollisionWarner() { delete asserter_; } class Check { public: explicit Check(ThreadCollisionWarner* warner) : warner_(warner) { warner_->EnterSelf(); } ~Check() = default; private: ThreadCollisionWarner* warner_; Check(const Check&) = delete; Check& operator=(const Check&) = delete; }; class ScopedCheck { public: explicit ScopedCheck(ThreadCollisionWarner* warner) : warner_(warner) { warner_->Enter(); } ~ScopedCheck() { warner_->Leave(); } private: ThreadCollisionWarner* warner_; ScopedCheck(const ScopedCheck&) = delete; ScopedCheck& operator=(const ScopedCheck&) = delete; }; class ScopedRecursiveCheck { public: explicit ScopedRecursiveCheck(ThreadCollisionWarner* warner) : warner_(warner) { warner_->EnterSelf(); } ~ScopedRecursiveCheck() { warner_->Leave(); } private: ThreadCollisionWarner* warner_; ScopedRecursiveCheck(const ScopedRecursiveCheck&) = delete; ScopedRecursiveCheck& operator=(const ScopedRecursiveCheck&) = delete; }; private: void EnterSelf(); void Enter(); void Leave(); volatile subtle::Atomic32 valid_thread_id_; volatile subtle::Atomic32 counter_; AsserterBase* asserter_; ThreadCollisionWarner(const ThreadCollisionWarner&) = delete; ThreadCollisionWarner& operator=(const ThreadCollisionWarner&) = delete; }; } namespace base { namespace subtle { class RefCountedBase { public: bool HasOneRef() const { return ref_count_ == 1; } bool HasAtLeastOneRef() const { return ref_count_ >= 1; } protected: explicit RefCountedBase(StartRefCountFromZeroTag) { } explicit RefCountedBase(StartRefCountFromOneTag) : ref_count_(1) { } ~RefCountedBase() { } void AddRef() const { AddRefImpl(); } bool Release() const { ReleaseImpl(); return ref_count_ == 0; } bool IsOnValidSequence() const { return true; } private: template <typename U> friend scoped_refptr<U> base::AdoptRef(U*); friend class RefCountedDeathTest_TestOverflowCheck_Test; friend class RefCountedDeathTest_DISABLED_TestOverflowCheck_Test; friend class RefCountedDeathTest_FLAKY_TestOverflowCheck_Test; void Adopted() const { } void AddRefImpl() const; void ReleaseImpl() const; mutable uint32_t ref_count_ = 0; static_assert(std::is_unsigned<decltype(ref_count_)>::value, "ref_count_ must be an unsigned type."); typedef void InternalFakeMutexTypeadd_release_; RefCountedBase(const RefCountedBase&) = delete; RefCountedBase& operator=(const RefCountedBase&) = delete; }; class RefCountedThreadSafeBase { public: bool HasOneRef() const; bool HasAtLeastOneRef() const; protected: explicit constexpr RefCountedThreadSafeBase(StartRefCountFromZeroTag) {} explicit constexpr RefCountedThreadSafeBase(StartRefCountFromOneTag) : ref_count_(1) { } ~RefCountedThreadSafeBase() = default; bool Release() const { return ReleaseImpl(); } void AddRef() const { AddRefImpl(); } void AddRefWithCheck() const { AddRefWithCheckImpl(); } private: template <typename U> friend scoped_refptr<U> base::AdoptRef(U*); void Adopted() const { } __forceinline void AddRefImpl() const { ref_count_.Increment(); } __forceinline void AddRefWithCheckImpl() const { !(!(ref_count_.Increment() > 0)) ? (void) 0 : ::logging::LogMessageVoidify() & (::logging::LogMessage("../..\\base/memory/ref_counted.h", 219, "ref_count_.Increment() > 0").stream()); } __forceinline bool ReleaseImpl() const { if (!ref_count_.Decrement()) { return true; } return false; } mutable AtomicRefCount ref_count_{0}; RefCountedThreadSafeBase(const RefCountedThreadSafeBase&) = delete; RefCountedThreadSafeBase& operator=(const RefCountedThreadSafeBase&) = delete; }; } class ScopedAllowCrossThreadRefCountAccess final { public: ScopedAllowCrossThreadRefCountAccess() {} ~ScopedAllowCrossThreadRefCountAccess() {} }; template <class T, typename Traits> class RefCounted; template <typename T> struct DefaultRefCountedTraits { static void Destruct(const T* x) { RefCounted<T, DefaultRefCountedTraits>::DeleteInternal(x); } }; template <class T, typename Traits = DefaultRefCountedTraits<T>> class RefCounted : public subtle::RefCountedBase { public: static constexpr subtle::StartRefCountFromZeroTag kRefCountPreference = subtle::kStartRefCountFromZeroTag; RefCounted() : subtle::RefCountedBase(T::kRefCountPreference) {} void AddRef() const { subtle::RefCountedBase::AddRef(); } void Release() const { if (subtle::RefCountedBase::Release()) { ; Traits::Destruct(static_cast<const T*>(this)); } } protected: ~RefCounted() = default; private: friend struct DefaultRefCountedTraits<T>; template <typename U> static void DeleteInternal(const U* x) { delete x; } RefCounted(const RefCounted&) = delete; RefCounted& operator=(const RefCounted&) = delete; }; template <class T, typename Traits> class RefCountedThreadSafe; template<typename T> struct DefaultRefCountedThreadSafeTraits { static void Destruct(const T* x) { RefCountedThreadSafe<T, DefaultRefCountedThreadSafeTraits>::DeleteInternal(x); } }; template <class T, typename Traits = DefaultRefCountedThreadSafeTraits<T> > class RefCountedThreadSafe : public subtle::RefCountedThreadSafeBase { public: static constexpr subtle::StartRefCountFromZeroTag kRefCountPreference = subtle::kStartRefCountFromZeroTag; explicit RefCountedThreadSafe() : subtle::RefCountedThreadSafeBase(T::kRefCountPreference) {} void AddRef() const { AddRefImpl(T::kRefCountPreference); } void Release() const { if (subtle::RefCountedThreadSafeBase::Release()) { ; Traits::Destruct(static_cast<const T*>(this)); } } protected: ~RefCountedThreadSafe() = default; private: friend struct DefaultRefCountedThreadSafeTraits<T>; template <typename U> static void DeleteInternal(const U* x) { delete x; } void AddRefImpl(subtle::StartRefCountFromZeroTag) const { subtle::RefCountedThreadSafeBase::AddRef(); } void AddRefImpl(subtle::StartRefCountFromOneTag) const { subtle::RefCountedThreadSafeBase::AddRefWithCheck(); } RefCountedThreadSafe(const RefCountedThreadSafe&) = delete; RefCountedThreadSafe& operator=(const RefCountedThreadSafe&) = delete; }; template<typename T> class RefCountedData : public base::RefCountedThreadSafe< base::RefCountedData<T> > { public: RefCountedData() : data() {} RefCountedData(const T& in_value) : data(in_value) {} RefCountedData(T&& in_value) : data(std::move(in_value)) {} T data; private: friend class base::RefCountedThreadSafe<base::RefCountedData<T> >; ~RefCountedData() = default; }; template <typename T> bool operator==(const RefCountedData<T>& lhs, const RefCountedData<T>& rhs) { return lhs.data == rhs.data; } template <typename T> bool operator!=(const RefCountedData<T>& lhs, const RefCountedData<T>& rhs) { return !(lhs == rhs); } } namespace sandbox { enum IntegrityLevel { INTEGRITY_LEVEL_SYSTEM, INTEGRITY_LEVEL_HIGH, INTEGRITY_LEVEL_MEDIUM, INTEGRITY_LEVEL_MEDIUM_LOW, INTEGRITY_LEVEL_LOW, INTEGRITY_LEVEL_BELOW_LOW, INTEGRITY_LEVEL_UNTRUSTED, INTEGRITY_LEVEL_LAST }; enum TokenLevel { USER_LOCKDOWN = 0, USER_RESTRICTED, USER_LIMITED, USER_INTERACTIVE, USER_RESTRICTED_NON_ADMIN, USER_NON_ADMIN, USER_RESTRICTED_SAME_ACCESS, USER_UNPROTECTED, USER_LAST }; enum JobLevel { JOB_LOCKDOWN = 0, JOB_RESTRICTED, JOB_LIMITED_USER, JOB_INTERACTIVE, JOB_UNPROTECTED, JOB_NONE }; typedef uint64_t MitigationFlags; const MitigationFlags MITIGATION_DEP = 0x00000001; const MitigationFlags MITIGATION_DEP_NO_ATL_THUNK = 0x00000002; const MitigationFlags MITIGATION_SEHOP = 0x00000004; const MitigationFlags MITIGATION_RELOCATE_IMAGE = 0x00000008; const MitigationFlags MITIGATION_RELOCATE_IMAGE_REQUIRED = 0x00000010; const MitigationFlags MITIGATION_HEAP_TERMINATE = 0x00000020; const MitigationFlags MITIGATION_BOTTOM_UP_ASLR = 0x00000040; const MitigationFlags MITIGATION_HIGH_ENTROPY_ASLR = 0x00000080; const MitigationFlags MITIGATION_STRICT_HANDLE_CHECKS = 0x00000100; const MitigationFlags MITIGATION_DLL_SEARCH_ORDER = 0x00000200; const MitigationFlags MITIGATION_HARDEN_TOKEN_IL_POLICY = 0x00000400; const MitigationFlags MITIGATION_WIN32K_DISABLE = 0x00000800; const MitigationFlags MITIGATION_EXTENSION_POINT_DISABLE = 0x00001000; const MitigationFlags MITIGATION_DYNAMIC_CODE_DISABLE = 0x00002000; const MitigationFlags MITIGATION_DYNAMIC_CODE_DISABLE_WITH_OPT_OUT = 0x00004000; const MitigationFlags MITIGATION_DYNAMIC_CODE_OPT_OUT_THIS_THREAD = 0x00008000; const MitigationFlags MITIGATION_NONSYSTEM_FONT_DISABLE = 0x00010000; const MitigationFlags MITIGATION_FORCE_MS_SIGNED_BINS = 0x00020000; const MitigationFlags MITIGATION_IMAGE_LOAD_NO_REMOTE = 0x00040000; const MitigationFlags MITIGATION_IMAGE_LOAD_NO_LOW_LABEL = 0x00080000; const MitigationFlags MITIGATION_IMAGE_LOAD_PREFER_SYS32 = 0x00100000; const MitigationFlags MITIGATION_RESTRICT_INDIRECT_BRANCH_PREDICTION = 0x00200000; } namespace sandbox { class AppContainerProfile; class TargetPolicy { public: enum SubSystem { SUBSYS_FILES, SUBSYS_NAMED_PIPES, SUBSYS_PROCESS, SUBSYS_REGISTRY, SUBSYS_SYNC, SUBSYS_WIN32K_LOCKDOWN, SUBSYS_SIGNED_BINARY }; enum Semantics { FILES_ALLOW_ANY, FILES_ALLOW_READONLY, FILES_ALLOW_QUERY, FILES_ALLOW_DIR_ANY, NAMEDPIPES_ALLOW_ANY, PROCESS_MIN_EXEC, PROCESS_ALL_EXEC, EVENTS_ALLOW_ANY, EVENTS_ALLOW_READONLY, REG_ALLOW_READONLY, REG_ALLOW_ANY, FAKE_USER_GDI_INIT, IMPLEMENT_OPM_APIS, SIGNED_ALLOW_LOAD }; virtual void AddRef() = 0; virtual void Release() = 0; virtual ResultCode SetTokenLevel(TokenLevel initial, TokenLevel lockdown) = 0; virtual TokenLevel GetInitialTokenLevel() const = 0; virtual TokenLevel GetLockdownTokenLevel() const = 0; virtual ResultCode SetJobLevel(JobLevel job_level, uint32_t ui_exceptions) = 0; virtual JobLevel GetJobLevel() const = 0; virtual ResultCode SetJobMemoryLimit(size_t memory_limit) = 0; virtual ResultCode SetAlternateDesktop(bool alternate_winstation) = 0; virtual std::wstring GetAlternateDesktop() const = 0; virtual ResultCode CreateAlternateDesktop(bool alternate_winstation) = 0; virtual void DestroyAlternateDesktop() = 0; virtual ResultCode SetIntegrityLevel(IntegrityLevel level) = 0; virtual IntegrityLevel GetIntegrityLevel() const = 0; virtual ResultCode SetDelayedIntegrityLevel(IntegrityLevel level) = 0; virtual ResultCode SetLowBox(const wchar_t* sid) = 0; virtual ResultCode SetProcessMitigations(MitigationFlags flags) = 0; virtual MitigationFlags GetProcessMitigations() = 0; virtual ResultCode SetDelayedProcessMitigations(MitigationFlags flags) = 0; virtual MitigationFlags GetDelayedProcessMitigations() const = 0; virtual ResultCode SetDisconnectCsrss() = 0; virtual void SetStrictInterceptions() = 0; virtual ResultCode SetStdoutHandle(HANDLE handle) = 0; virtual ResultCode SetStderrHandle(HANDLE handle) = 0; virtual ResultCode AddRule(SubSystem subsystem, Semantics semantics, const wchar_t* pattern) = 0; virtual ResultCode AddDllToUnload(const wchar_t* dll_name) = 0; virtual ResultCode AddKernelObjectToClose(const wchar_t* handle_type, const wchar_t* handle_name) = 0; virtual void AddHandleToShare(HANDLE handle) = 0; virtual void SetLockdownDefaultDacl() = 0; virtual void SetEnableOPMRedirection() = 0; virtual bool GetEnableOPMRedirection() = 0; virtual ResultCode AddAppContainerProfile(const wchar_t* package_name, bool create_profile) = 0; virtual scoped_refptr<AppContainerProfile> GetAppContainerProfile() = 0; virtual void SetEffectiveToken(HANDLE token) = 0; protected: ~TargetPolicy() {} }; } namespace sandbox { class BrokerServices; class PolicyDiagnosticsReceiver; class ProcessState; class TargetPolicy; class TargetServices; class BrokerServices { public: virtual ResultCode Init() = 0; virtual scoped_refptr<TargetPolicy> CreatePolicy() = 0; virtual ResultCode SpawnTarget(const wchar_t* exe_path, const wchar_t* command_line, scoped_refptr<TargetPolicy> policy, ResultCode* last_warning, DWORD* last_error, PROCESS_INFORMATION* target) = 0; virtual ResultCode WaitForAllTargets() = 0; virtual ResultCode GetPolicyDiagnostics( std::unique_ptr<PolicyDiagnosticsReceiver> receiver) = 0; protected: ~BrokerServices() {} }; class TargetServices { public: virtual ResultCode Init() = 0; virtual void LowerToken() = 0; virtual ProcessState* GetState() = 0; protected: ~TargetServices() {} }; class PolicyInfo { public: virtual const char* JsonString() = 0; virtual ~PolicyInfo() {} }; class PolicyList { public: virtual std::vector<std::unique_ptr<PolicyInfo>>::iterator begin() = 0; virtual std::vector<std::unique_ptr<PolicyInfo>>::iterator end() = 0; virtual size_t size() const = 0; virtual ~PolicyList() {} }; class PolicyDiagnosticsReceiver { public: virtual void ReceiveDiagnostics(std::unique_ptr<PolicyList> policies) = 0; virtual void OnError(ResultCode code) = 0; virtual ~PolicyDiagnosticsReceiver() {} }; } namespace sandbox { enum class IpcTag; const uint32_t kIPCChannelSize = 1024; template <typename T> class CopyHelper { public: CopyHelper(const T& t) : t_(t) {} const void* GetStart() const { return &t_; } bool Update(void* buffer) { return true; } uint32_t GetSize() const { return sizeof(T); } bool IsInOut() { return false; } ArgType GetType() { static_assert(sizeof(T) == sizeof(uint32_t), "specialization needed"); return UINT32_TYPE; } private: const T& t_; }; template <> class CopyHelper<void*> { public: CopyHelper(void* t) : t_(t) {} const void* GetStart() const { return &t_; } bool Update(void* buffer) { return true; } uint32_t GetSize() const { return sizeof(t_); } bool IsInOut() { return false; } ArgType GetType() { return VOIDPTR_TYPE; } private: const void* t_; }; template <> class CopyHelper<const wchar_t*> { public: CopyHelper(const wchar_t* t) : t_(t) {} const void* GetStart() const { return t_; } bool Update(void* buffer) { return true; } uint32_t GetSize() const { __try { return (!t_) ? 0 : static_cast<uint32_t>(StringLength(t_) * sizeof(t_[0])); } __except (1) { return 0xffffffffui32; } } bool IsInOut() { return false; } ArgType GetType() { return WCHAR_TYPE; } private: static size_t StringLength(const wchar_t* wcs) { const wchar_t* eos = wcs; while (*eos++) ; return static_cast<size_t>(eos - wcs - 1); } const wchar_t* t_; }; template <> class CopyHelper<wchar_t*> : public CopyHelper<const wchar_t*> { public: typedef CopyHelper<const wchar_t*> Base; CopyHelper(wchar_t* t) : Base(t) {} const void* GetStart() const { return Base::GetStart(); } bool Update(void* buffer) { return Base::Update(buffer); } uint32_t GetSize() const { return Base::GetSize(); } bool IsInOut() { return Base::IsInOut(); } ArgType GetType() { return Base::GetType(); } }; template <size_t n> class CopyHelper<const wchar_t[n]> : public CopyHelper<const wchar_t*> { public: typedef const wchar_t array[n]; typedef CopyHelper<const wchar_t*> Base; CopyHelper(array t) : Base(t) {} const void* GetStart() const { return Base::GetStart(); } bool Update(void* buffer) { return Base::Update(buffer); } uint32_t GetSize() const { return Base::GetSize(); } bool IsInOut() { return Base::IsInOut(); } ArgType GetType() { return Base::GetType(); } }; class InOutCountedBuffer : public CountedBuffer { public: InOutCountedBuffer(void* buffer, uint32_t size) : CountedBuffer(buffer, size) {} }; template <> class CopyHelper<InOutCountedBuffer> { public: CopyHelper(const InOutCountedBuffer t) : t_(t) {} const void* GetStart() const { return t_.Buffer(); } bool Update(void* buffer) { __try { memcpy_wrapper(t_.Buffer(), buffer, t_.Size()); } __except (1) { return false; } return true; } uint32_t GetSize() const { return t_.Size(); } bool IsInOut() { return true; } ArgType GetType() { return INOUTPTR_TYPE; } private: const InOutCountedBuffer t_; }; template <typename IPCProvider, typename Par1, typename Par2, typename Par3, typename Par4, typename Par5, typename Par6, typename Par7> ResultCode CrossCall(IPCProvider& ipc_provider, IpcTag tag, const Par1& p1, const Par2& p2, const Par3& p3, const Par4& p4, const Par5& p5, const Par6& p6, const Par7& p7, CrossCallReturn* answer) { typedef ActualCallParams<7, kIPCChannelSize> ActualParams; void* raw_mem = ipc_provider.GetBuffer(); if (!raw_mem) return SBOX_ERROR_NO_SPACE; ActualParams* call_params = new (raw_mem) ActualParams(tag);; static_assert(kMaxIpcParams >= 1, "too many parameters"); CopyHelper<Par1> ch1(p1); if (!call_params->CopyParamIn(1 - 1, ch1.GetStart(), ch1.GetSize(), ch1.IsInOut(), ch1.GetType())) return SBOX_ERROR_NO_SPACE;; static_assert(kMaxIpcParams >= 2, "too many parameters"); CopyHelper<Par2> ch2(p2); if (!call_params->CopyParamIn(2 - 1, ch2.GetStart(), ch2.GetSize(), ch2.IsInOut(), ch2.GetType())) return SBOX_ERROR_NO_SPACE;; static_assert(kMaxIpcParams >= 3, "too many parameters"); CopyHelper<Par3> ch3(p3); if (!call_params->CopyParamIn(3 - 1, ch3.GetStart(), ch3.GetSize(), ch3.IsInOut(), ch3.GetType())) return SBOX_ERROR_NO_SPACE;; static_assert(kMaxIpcParams >= 4, "too many parameters"); CopyHelper<Par4> ch4(p4); if (!call_params->CopyParamIn(4 - 1, ch4.GetStart(), ch4.GetSize(), ch4.IsInOut(), ch4.GetType())) return SBOX_ERROR_NO_SPACE;; static_assert(kMaxIpcParams >= 5, "too many parameters"); CopyHelper<Par5> ch5(p5); if (!call_params->CopyParamIn(5 - 1, ch5.GetStart(), ch5.GetSize(), ch5.IsInOut(), ch5.GetType())) return SBOX_ERROR_NO_SPACE;; static_assert(kMaxIpcParams >= 6, "too many parameters"); CopyHelper<Par6> ch6(p6); if (!call_params->CopyParamIn(6 - 1, ch6.GetStart(), ch6.GetSize(), ch6.IsInOut(), ch6.GetType())) return SBOX_ERROR_NO_SPACE;; static_assert(kMaxIpcParams >= 7, "too many parameters"); CopyHelper<Par7> ch7(p7); if (!call_params->CopyParamIn(7 - 1, ch7.GetStart(), ch7.GetSize(), ch7.IsInOut(), ch7.GetType())) return SBOX_ERROR_NO_SPACE;; ResultCode result = ipc_provider.DoCall(call_params, answer); if (SBOX_ERROR_CHANNEL_ERROR != result) { if (!ch1.Update(call_params->GetParamPtr(1 - 1))) { ipc_provider.FreeBuffer(raw_mem); return SBOX_ERROR_BAD_PARAMS; }; if (!ch2.Update(call_params->GetParamPtr(2 - 1))) { ipc_provider.FreeBuffer(raw_mem); return SBOX_ERROR_BAD_PARAMS; }; if (!ch3.Update(call_params->GetParamPtr(3 - 1))) { ipc_provider.FreeBuffer(raw_mem); return SBOX_ERROR_BAD_PARAMS; }; if (!ch4.Update(call_params->GetParamPtr(4 - 1))) { ipc_provider.FreeBuffer(raw_mem); return SBOX_ERROR_BAD_PARAMS; }; if (!ch5.Update(call_params->GetParamPtr(5 - 1))) { ipc_provider.FreeBuffer(raw_mem); return SBOX_ERROR_BAD_PARAMS; }; if (!ch6.Update(call_params->GetParamPtr(6 - 1))) { ipc_provider.FreeBuffer(raw_mem); return SBOX_ERROR_BAD_PARAMS; }; if (!ch7.Update(call_params->GetParamPtr(7 - 1))) { ipc_provider.FreeBuffer(raw_mem); return SBOX_ERROR_BAD_PARAMS; }; ipc_provider.FreeBuffer(raw_mem);; } return result; } } namespace base { struct FakeBindState; namespace internal { class BindStateBase; class FinallyExecutorCommon; class ThenAndCatchExecutorCommon; template <typename ReturnType> class PostTaskExecutor; template <typename Functor, typename... BoundArgs> struct BindState; class CallbackBase; class CallbackBaseCopyable; struct BindStateBaseRefCountTraits { static void Destruct(const BindStateBase*); }; template <typename T> using PassingType = std::conditional_t<std::is_scalar<T>::value, T, T&&>; class BindStateBase : public RefCountedThreadSafe<BindStateBase, BindStateBaseRefCountTraits> { public: static constexpr ::base::subtle::StartRefCountFromOneTag kRefCountPreference = ::base::subtle::kStartRefCountFromOneTag; enum CancellationQueryMode { IS_CANCELLED, MAYBE_VALID, }; using InvokeFuncStorage = void(*)(); private: BindStateBase(InvokeFuncStorage polymorphic_invoke, void (*destructor)(const BindStateBase*)); BindStateBase(InvokeFuncStorage polymorphic_invoke, void (*destructor)(const BindStateBase*), bool (*query_cancellation_traits)(const BindStateBase*, CancellationQueryMode mode)); ~BindStateBase() = default; friend struct BindStateBaseRefCountTraits; friend class RefCountedThreadSafe<BindStateBase, BindStateBaseRefCountTraits>; friend class CallbackBase; friend class CallbackBaseCopyable; template <typename Functor, typename... BoundArgs> friend struct BindState; friend struct ::base::FakeBindState; bool IsCancelled() const { return query_cancellation_traits_(this, IS_CANCELLED); } bool MaybeValid() const { return query_cancellation_traits_(this, MAYBE_VALID); } InvokeFuncStorage polymorphic_invoke_; void (*destructor_)(const BindStateBase*); bool (*query_cancellation_traits_)(const BindStateBase*, CancellationQueryMode mode); BindStateBase(const BindStateBase&) = delete; BindStateBase& operator=(const BindStateBase&) = delete; }; class CallbackBase { public: inline CallbackBase(CallbackBase&& c) noexcept; CallbackBase& operator=(CallbackBase&& c) noexcept; explicit CallbackBase(const CallbackBaseCopyable& c); CallbackBase& operator=(const CallbackBaseCopyable& c); explicit CallbackBase(CallbackBaseCopyable&& c) noexcept; CallbackBase& operator=(CallbackBaseCopyable&& c) noexcept; bool is_null() const { return !bind_state_; } explicit operator bool() const { return !is_null(); } bool IsCancelled() const; bool MaybeValid() const; void Reset(); protected: friend class FinallyExecutorCommon; friend class ThenAndCatchExecutorCommon; template <typename ReturnType> friend class PostTaskExecutor; using InvokeFuncStorage = BindStateBase::InvokeFuncStorage; bool EqualsInternal(const CallbackBase& other) const; constexpr inline CallbackBase(); explicit inline CallbackBase(BindStateBase* bind_state); InvokeFuncStorage polymorphic_invoke() const { return bind_state_->polymorphic_invoke_; } ~CallbackBase(); scoped_refptr<BindStateBase> bind_state_; }; constexpr CallbackBase::CallbackBase() = default; CallbackBase::CallbackBase(CallbackBase&&) noexcept = default; CallbackBase::CallbackBase(BindStateBase* bind_state) : bind_state_(AdoptRef(bind_state)) {} class CallbackBaseCopyable : public CallbackBase { public: CallbackBaseCopyable(const CallbackBaseCopyable& c); CallbackBaseCopyable(CallbackBaseCopyable&& c) noexcept = default; CallbackBaseCopyable& operator=(const CallbackBaseCopyable& c); CallbackBaseCopyable& operator=(CallbackBaseCopyable&& c) noexcept; protected: constexpr CallbackBaseCopyable() = default; explicit CallbackBaseCopyable(BindStateBase* bind_state) : CallbackBase(bind_state) {} ~CallbackBaseCopyable() = default; }; } } namespace base { template <typename R, typename... Args> class OnceCallback<R(Args...)> : public internal::CallbackBase { public: using RunType = R(Args...); using PolymorphicInvoke = R (*)(internal::BindStateBase*, internal::PassingType<Args>...); constexpr OnceCallback() = default; OnceCallback(std::nullptr_t) = delete; explicit OnceCallback(internal::BindStateBase* bind_state) : internal::CallbackBase(bind_state) {} OnceCallback(const OnceCallback&) = delete; OnceCallback& operator=(const OnceCallback&) = delete; OnceCallback(OnceCallback&&) noexcept = default; OnceCallback& operator=(OnceCallback&&) noexcept = default; OnceCallback(RepeatingCallback<RunType> other) : internal::CallbackBase(std::move(other)) {} OnceCallback& operator=(RepeatingCallback<RunType> other) { static_cast<internal::CallbackBase&>(*this) = std::move(other); return *this; } R Run(Args... args) const & { static_assert(!sizeof(*this), "OnceCallback::Run() may only be invoked on a non-const " "rvalue, i.e. std::move(callback).Run()."); true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << !(false); } R Run(Args... args) && { OnceCallback cb = std::move(*this); PolymorphicInvoke f = reinterpret_cast<PolymorphicInvoke>(cb.polymorphic_invoke()); return f(cb.bind_state_.get(), std::forward<Args>(args)...); } }; template <typename R, typename... Args> class RepeatingCallback<R(Args...)> : public internal::CallbackBaseCopyable { public: using RunType = R(Args...); using PolymorphicInvoke = R (*)(internal::BindStateBase*, internal::PassingType<Args>...); constexpr RepeatingCallback() = default; RepeatingCallback(std::nullptr_t) = delete; explicit RepeatingCallback(internal::BindStateBase* bind_state) : internal::CallbackBaseCopyable(bind_state) {} RepeatingCallback(const RepeatingCallback&) = default; RepeatingCallback& operator=(const RepeatingCallback&) = default; RepeatingCallback(RepeatingCallback&&) noexcept = default; RepeatingCallback& operator=(RepeatingCallback&&) noexcept = default; bool operator==(const RepeatingCallback& other) const { return EqualsInternal(other); } bool operator!=(const RepeatingCallback& other) const { return !operator==(other); } R Run(Args... args) const & { PolymorphicInvoke f = reinterpret_cast<PolymorphicInvoke>(this->polymorphic_invoke()); return f(this->bind_state_.get(), std::forward<Args>(args)...); } R Run(Args... args) && { RepeatingCallback cb = std::move(*this); PolymorphicInvoke f = reinterpret_cast<PolymorphicInvoke>(cb.polymorphic_invoke()); return f(std::move(cb).bind_state_.get(), std::forward<Args>(args)...); } }; } namespace sandbox { class InterceptionManager; typedef void(__stdcall* CrossCallIPCCallback)(void* context, unsigned char reason); class ThreadProvider { public: virtual bool RegisterWait(const void* client, HANDLE waitable_object, CrossCallIPCCallback callback, void* context) = 0; virtual bool UnRegisterWaits(void* cookie) = 0; virtual ~ThreadProvider() {} }; class CrossCallParamsEx : public CrossCallParams { public: static CrossCallParamsEx* CreateFromBuffer(void* buffer_base, uint32_t buffer_size, uint32_t* output_size); void* GetRawParameter(uint32_t index, uint32_t* size, ArgType* type); bool GetParameter32(uint32_t index, uint32_t* param); bool GetParameterVoidPtr(uint32_t index, void** param); bool GetParameterStr(uint32_t index, std::wstring* string); bool GetParameterPtr(uint32_t index, uint32_t expected_size, void** pointer); static void operator delete(void* raw_memory) throw(); private: CrossCallParamsEx(); ParamInfo param_info_[1]; CrossCallParamsEx(const CrossCallParamsEx&) = delete; CrossCallParamsEx& operator=(const CrossCallParamsEx&) = delete; }; void SetCallError(ResultCode error, CrossCallReturn* call_return); void SetCallSuccess(CrossCallReturn* call_return); struct ClientInfo { HANDLE process; DWORD process_id; }; struct IPCInfo { IpcTag ipc_tag; const ClientInfo* client_info; CrossCallReturn return_info; }; struct IPCParams { IpcTag ipc_tag; ArgType args[kMaxIpcParams]; bool Matches(IPCParams* other) const { return !memcmp(this, other, sizeof(*other)); } }; class Dispatcher { public: typedef bool (Dispatcher::*CallbackGeneric)(); typedef bool (Dispatcher::*Callback0)(IPCInfo* ipc); typedef bool (Dispatcher::*Callback1)(IPCInfo* ipc, void* p1); typedef bool (Dispatcher::*Callback2)(IPCInfo* ipc, void* p1, void* p2); typedef bool (Dispatcher::*Callback3)(IPCInfo* ipc, void* p1, void* p2, void* p3); typedef bool (Dispatcher::*Callback4)(IPCInfo* ipc, void* p1, void* p2, void* p3, void* p4); typedef bool (Dispatcher::*Callback5)(IPCInfo* ipc, void* p1, void* p2, void* p3, void* p4, void* p5); typedef bool (Dispatcher::*Callback6)(IPCInfo* ipc, void* p1, void* p2, void* p3, void* p4, void* p5, void* p6); typedef bool (Dispatcher::*Callback7)(IPCInfo* ipc, void* p1, void* p2, void* p3, void* p4, void* p5, void* p6, void* p7); typedef bool (Dispatcher::*Callback8)(IPCInfo* ipc, void* p1, void* p2, void* p3, void* p4, void* p5, void* p6, void* p7, void* p8); typedef bool (Dispatcher::*Callback9)(IPCInfo* ipc, void* p1, void* p2, void* p3, void* p4, void* p5, void* p6, void* p7, void* p8, void* p9); virtual Dispatcher* OnMessageReady(IPCParams* ipc, CallbackGeneric* callback); virtual bool SetupService(InterceptionManager* manager, IpcTag service) = 0; Dispatcher(); virtual ~Dispatcher(); protected: struct IPCCall { IPCParams params; CallbackGeneric callback; }; std::vector<IPCCall> ipc_calls_; }; } void* __cdecl operator new(size_t size, sandbox::AllocationType type, void* near_to = nullptr); void __cdecl operator delete(void* memory, sandbox::AllocationType type); void __cdecl operator delete(void* memory, sandbox::AllocationType type, void* near_to); void* __cdecl operator new(size_t size, void* buffer, sandbox::AllocationType type); void __cdecl operator delete(void* memory, void* buffer, sandbox::AllocationType type); namespace sandbox { #pragma intrinsic(_InterlockedCompareExchange) #pragma intrinsic(_InterlockedCompareExchangePointer) struct NtAllocDeleter { inline void operator()(void* ptr) const { operator delete(ptr, AllocationType::NT_ALLOC); } }; void* GetGlobalIPCMemory(); void* GetGlobalPolicyMemory(); enum RequiredAccess { READ, WRITE }; bool ValidParameter(void* buffer, size_t size, RequiredAccess intent); NTSTATUS CopyData(void* destination, const void* source, size_t bytes); NTSTATUS AllocAndCopyName(const OBJECT_ATTRIBUTES* in_object, std::unique_ptr<wchar_t, NtAllocDeleter>* out_name, uint32_t* attributes, HANDLE* root); NTSTATUS AllocAndGetFullPath( HANDLE root, const wchar_t* path, std::unique_ptr<wchar_t, NtAllocDeleter>* full_path); bool InitHeap(); bool IsSameProcess(HANDLE process); enum MappedModuleFlags { MODULE_IS_PE_IMAGE = 1, MODULE_HAS_ENTRY_POINT = 2, MODULE_HAS_CODE = 4 }; UNICODE_STRING* GetImageInfoFromModule(HMODULE module, uint32_t* flags); const char* GetAnsiImageInfoFromModule(HMODULE module); UNICODE_STRING* GetBackingFilePath(PVOID address); UNICODE_STRING* ExtractModuleName(const UNICODE_STRING* module_path); bool IsValidImageSection(HANDLE section, PVOID* base, PLARGE_INTEGER offset, PSIZE_T view_size); UNICODE_STRING* AnsiToUnicode(const char* string); bool NtGetPathFromHandle(HANDLE handle, std::unique_ptr<wchar_t, NtAllocDeleter>* path); class AutoProtectMemory { public: AutoProtectMemory() : changed_(false), address_(nullptr), bytes_(0), old_protect_(0) {} ~AutoProtectMemory() { RevertProtection(); } NTSTATUS ChangeProtection(void* address, size_t bytes, ULONG protect); NTSTATUS RevertProtection(); private: bool changed_; void* address_; size_t bytes_; ULONG old_protect_; AutoProtectMemory(const AutoProtectMemory&) = delete; AutoProtectMemory& operator=(const AutoProtectMemory&) = delete; }; bool IsSupportedRenameCall(FILE_RENAME_INFORMATION* file_info, DWORD length, uint32_t file_info_class); } namespace sandbox { class ParameterSet { public: ParameterSet() : real_type_(INVALID_TYPE), address_(nullptr) {} bool Get(uint32_t* destination) const { if (real_type_ != UINT32_TYPE) { return false; } *destination = Void2TypePointerCopy<uint32_t>(); return true; } bool Get(const void** destination) const { if (real_type_ != VOIDPTR_TYPE) { return false; } *destination = Void2TypePointerCopy<void*>(); return true; } bool Get(const wchar_t** destination) const { if (real_type_ != WCHAR_TYPE) { return false; } *destination = Void2TypePointerCopy<const wchar_t*>(); return true; } bool IsValid() const { return real_type_ != INVALID_TYPE; } protected: ParameterSet(ArgType real_type, const void* address) : real_type_(real_type), address_(address) {} private: template <typename T> T Void2TypePointerCopy() const { return *(reinterpret_cast<const T*>(address_)); } ArgType real_type_; const void* address_; }; template <typename T> class ParameterSetEx : public ParameterSet { public: ParameterSetEx(const void* address); }; template <> class ParameterSetEx<void const*> : public ParameterSet { public: ParameterSetEx(const void* address) : ParameterSet(VOIDPTR_TYPE, address) {} }; template <> class ParameterSetEx<void*> : public ParameterSet { public: ParameterSetEx(const void* address) : ParameterSet(VOIDPTR_TYPE, address) {} }; template <> class ParameterSetEx<wchar_t*> : public ParameterSet { public: ParameterSetEx(const void* address) : ParameterSet(WCHAR_TYPE, address) {} }; template <> class ParameterSetEx<wchar_t const*> : public ParameterSet { public: ParameterSetEx(const void* address) : ParameterSet(WCHAR_TYPE, address) {} }; template <> class ParameterSetEx<uint32_t> : public ParameterSet { public: ParameterSetEx(const void* address) : ParameterSet(UINT32_TYPE, address) {} }; template <> class ParameterSetEx<UNICODE_STRING> : public ParameterSet { public: ParameterSetEx(const void* address) : ParameterSet(UNISTR_TYPE, address) {} }; template <typename T> ParameterSet ParamPickerMake(T& parameter) { return ParameterSetEx<T>(¶meter); } struct CountedParameterSetBase { size_t count; ParameterSet parameters[1]; }; template <typename T> struct CountedParameterSet { CountedParameterSet() : count(T::PolParamLast) {} ParameterSet& operator[](typename T::Args n) { return parameters[n]; } CountedParameterSetBase* GetBase() { return reinterpret_cast<CountedParameterSetBase*>(this); } size_t count; ParameterSet parameters[T::PolParamLast]; }; } namespace sandbox { enum EvalResult { EVAL_TRUE, EVAL_FALSE, EVAL_ERROR, ASK_BROKER, DENY_ACCESS, GIVE_READONLY, GIVE_ALLACCESS, GIVE_CACHED, GIVE_FIRST, SIGNAL_ALARM, FAKE_SUCCESS, FAKE_ACCESS_DENIED, TERMINATE_PROCESS, }; enum OpcodeID { OP_ALWAYS_FALSE, OP_ALWAYS_TRUE, OP_NUMBER_MATCH, OP_NUMBER_MATCH_RANGE, OP_NUMBER_AND_MATCH, OP_WSTRING_MATCH, OP_ACTION }; const uint32_t kPolNone = 0; const uint32_t kPolNegateEval = 1; const uint32_t kPolClearContext = 2; const uint32_t kPolUseOREval = 4; struct MatchContext { size_t position; uint32_t options; MatchContext() { Clear(); } void Clear() { position = 0; options = 0; } }; class PolicyOpcode { friend class OpcodeFactory; public: EvalResult Evaluate(const ParameterSet* parameters, size_t count, MatchContext* match); template <typename T> void GetArgument(size_t index, T* argument) const { static_assert(sizeof(T) <= sizeof(arguments_[0]), "invalid size"); *argument = *reinterpret_cast<const T*>(&arguments_[index].mem); } template <typename T> void SetArgument(size_t index, const T& argument) { static_assert(sizeof(T) <= sizeof(arguments_[0]), "invalid size"); *reinterpret_cast<T*>(&arguments_[index].mem) = argument; } const wchar_t* GetRelativeString(size_t index) const { ptrdiff_t str_delta = 0; GetArgument(index, &str_delta); const char* delta = reinterpret_cast<const char*>(this) + str_delta; return reinterpret_cast<const wchar_t*>(delta); } bool IsAction() const { return (OP_ACTION == opcode_id_); } OpcodeID GetID() const { return opcode_id_; } uint32_t GetOptions() const { return options_; } void SetOptions(uint32_t options) { options_ = options; } uint16_t GetParameter() const { return parameter_; } private: static const size_t kArgumentCount = 4; struct OpcodeArgument { UINT_PTR mem; }; void* operator new(size_t, void* location) { return location; } EvalResult EvaluateHelper(const ParameterSet* parameters, MatchContext* match); OpcodeID opcode_id_; int16_t parameter_; uint32_t options_; OpcodeArgument arguments_[PolicyOpcode::kArgumentCount]; }; enum StringMatchOptions { CASE_SENSITIVE = 0, CASE_INSENSITIVE = 1, EXACT_LENGTH = 2 }; const int kSeekForward = -1; const int kSeekToEnd = 0xfffff; struct PolicyBuffer { size_t opcode_count; PolicyOpcode opcodes[1]; }; class OpcodeFactory { public: OpcodeFactory(char* memory, size_t memory_size) : memory_top_(memory) { memory_bottom_ = &memory_top_[memory_size]; } OpcodeFactory(PolicyBuffer* policy, size_t memory_size) { memory_top_ = reinterpret_cast<char*>(&policy->opcodes[0]); memory_bottom_ = &memory_top_[memory_size]; } size_t memory_size() const { true ? (void)0 : ::logging::LogMessageVoidify() & (*::logging::g_swallow_stream) << (::logging::MakeCheckOpValueString( ::logging::g_swallow_stream, memory_bottom_), ::logging::MakeCheckOpValueString( ::logging::g_swallow_stream, memory_top_), (memory_bottom_)>=(memory_top_)); return memory_bottom_ - memory_top_; } PolicyOpcode* MakeOpAlwaysFalse(uint32_t options); PolicyOpcode* MakeOpAlwaysTrue(uint32_t options); PolicyOpcode* MakeOpAction(EvalResult action, uint32_t options); PolicyOpcode* MakeOpNumberMatch(int16_t selected_param, uint32_t match, uint32_t options); PolicyOpcode* MakeOpVoidPtrMatch(int16_t selected_param, const void* match, uint32_t options); PolicyOpcode* MakeOpNumberMatchRange(int16_t selected_param, uint32_t lower_bound, uint32_t upper_bound, uint32_t options); PolicyOpcode* MakeOpWStringMatch(int16_t selected_param, const wchar_t* match_str, int start_position, StringMatchOptions match_opts, uint32_t options); PolicyOpcode* MakeOpNumberAndMatch(int16_t selected_param, uint32_t match, uint32_t options); private: PolicyOpcode* MakeBase(OpcodeID opcode_id, uint32_t options, int16_t selected_param); ptrdiff_t AllocRelative(void* start, const wchar_t* str, size_t length); char* memory_top_; char* memory_bottom_; OpcodeFactory(const OpcodeFactory&) = delete; OpcodeFactory& operator=(const OpcodeFactory&) = delete; }; } namespace sandbox { struct PolicyGlobal { PolicyBuffer* entry[kMaxServiceCount]; size_t data_size; PolicyBuffer data[1]; }; class PolicyRule; class LowLevelPolicy { public: explicit LowLevelPolicy(PolicyGlobal* policy_store); ~LowLevelPolicy(); bool AddRule(IpcTag service, PolicyRule* rule); bool Done(); private: struct RuleNode { const PolicyRule* rule; IpcTag service; }; std::list<RuleNode> rules_; PolicyGlobal* policy_store_; LowLevelPolicy() = delete; LowLevelPolicy(const LowLevelPolicy&) = delete; LowLevelPolicy& operator=(const LowLevelPolicy&) = delete; }; enum RuleType { IF = 0, IF_NOT = 1, }; enum RuleOp { EQUAL, AND, RANGE }; class PolicyRule { friend class LowLevelPolicy; public: explicit PolicyRule(EvalResult action); PolicyRule(const PolicyRule& other); ~PolicyRule(); bool AddStringMatch(RuleType rule_type, int16_t parameter, const wchar_t* string, StringMatchOptions match_opts); bool AddNumberMatch(RuleType rule_type, int16_t parameter, uint32_t number, RuleOp comparison_op); size_t GetOpcodeCount() const { return buffer_->opcode_count; } bool Done(); private: void operator=(const PolicyRule&); bool GenStringOpcode(RuleType rule_type, StringMatchOptions match_opts, uint16_t parameter, int state, bool last_call, int* skip_count, std::wstring* fragment); bool RebindCopy(PolicyOpcode* opcode_start, size_t opcode_size, char* data_start, size_t* data_size) const; PolicyBuffer* buffer_; OpcodeFactory* opcode_factory_; EvalResult action_; bool done_; }; } namespace sandbox { enum IsBroker { BROKER_FALSE, BROKER_TRUE }; class FileSystemPolicy { public: static bool GenerateRules(const wchar_t* name, TargetPolicy::Semantics semantics, LowLevelPolicy* policy); static bool SetInitialRules(LowLevelPolicy* policy); static bool CreateFileAction(EvalResult eval_result, const ClientInfo& client_info, const std::wstring& file, uint32_t attributes, uint32_t desired_access, uint32_t file_attributes, uint32_t share_access, uint32_t create_disposition, uint32_t create_options, HANDLE* handle, NTSTATUS* nt_status, ULONG_PTR* io_information); static bool OpenFileAction(EvalResult eval_result, const ClientInfo& client_info, const std::wstring& file, uint32_t attributes, uint32_t desired_access, uint32_t share_access, uint32_t open_options, HANDLE* handle, NTSTATUS* nt_status, ULONG_PTR* io_information); static bool QueryAttributesFileAction(EvalResult eval_result, const ClientInfo& client_info, const std::wstring& file, uint32_t attributes, FILE_BASIC_INFORMATION* file_info, NTSTATUS* nt_status); static bool QueryFullAttributesFileAction( EvalResult eval_result, const ClientInfo& client_info, const std::wstring& file, uint32_t attributes, FILE_NETWORK_OPEN_INFORMATION* file_info, NTSTATUS* nt_status); static bool SetInformationFileAction(EvalResult eval_result, const ClientInfo& client_info, HANDLE target_file_handle, void* file_info, uint32_t length, uint32_t info_class, IO_STATUS_BLOCK* io_block, NTSTATUS* nt_status); }; bool PreProcessName(std::wstring* path); std::wstring FixNTPrefixForMatch(const std::wstring& name); } namespace sandbox { class SharedMemIPCClient { public: explicit SharedMemIPCClient(void* shared_mem); void* GetBuffer(); void FreeBuffer(void* buffer); ResultCode DoCall(CrossCallParams* params, CrossCallReturn* answer); private: size_t LockFreeChannel(bool* severe_failure); size_t ChannelIndexFromBuffer(const void* buffer); char* first_base_; }; NTSTATUS __stdcall TargetNtCreateFile(NtCreateFileFunction orig_CreateFile, PHANDLE file, ACCESS_MASK desired_access, POBJECT_ATTRIBUTES object_attributes, PIO_STATUS_BLOCK io_status, PLARGE_INTEGER allocation_size, ULONG file_attributes, ULONG sharing, ULONG disposition, ULONG options, PVOID ea_buffer, ULONG ea_length) { wchar_t* name = nullptr; SharedMemIPCClient ipc(nullptr); CrossCallReturn answer = {0}; CrossCall(ipc, IpcTag::NTCREATEFILE, name, 0, 0, 0, 0, 0, 0, &answer); return 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