Vendor import of libc++ trunk r338150:
https://llvm.org/svn/llvm-project/libcxx/trunk@338150
This commit is contained in:
parent
0294ba5648
commit
f36202620b
@ -11,6 +11,10 @@ endif()
|
||||
if(POLICY CMP0022)
|
||||
cmake_policy(SET CMP0022 NEW) # Required when interacting with LLVM and Clang
|
||||
endif()
|
||||
if(POLICY CMP0068)
|
||||
cmake_policy(SET CMP0068 NEW)
|
||||
set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
|
||||
endif()
|
||||
|
||||
# Add path for custom modules
|
||||
set(CMAKE_MODULE_PATH
|
||||
@ -23,7 +27,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
project(libcxx CXX C)
|
||||
|
||||
set(PACKAGE_NAME libcxx)
|
||||
set(PACKAGE_VERSION 6.0.0svn)
|
||||
set(PACKAGE_VERSION 7.0.0svn)
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
set(PACKAGE_BUGREPORT "llvm-bugs@lists.llvm.org")
|
||||
|
||||
@ -68,7 +72,7 @@ set(ENABLE_FILESYSTEM_DEFAULT ${LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY})
|
||||
if (WIN32)
|
||||
set(ENABLE_FILESYSTEM_DEFAULT OFF)
|
||||
endif()
|
||||
option(LIBCXX_ENABLE_FILESYSTEM "Build filesystem as part of libc++experimental.a"
|
||||
option(LIBCXX_ENABLE_FILESYSTEM "Build filesystem as part of libc++fs.a"
|
||||
${ENABLE_FILESYSTEM_DEFAULT})
|
||||
option(LIBCXX_INCLUDE_TESTS "Build the libc++ tests." ${LLVM_INCLUDE_TESTS})
|
||||
|
||||
@ -93,11 +97,26 @@ set(LIBCXX_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
|
||||
"Define suffix of library directory name (32/64)")
|
||||
option(LIBCXX_INSTALL_HEADERS "Install the libc++ headers." ON)
|
||||
option(LIBCXX_INSTALL_LIBRARY "Install the libc++ library." ON)
|
||||
cmake_dependent_option(LIBCXX_INSTALL_STATIC_LIBRARY
|
||||
"Install the static libc++ library." ON
|
||||
"LIBCXX_ENABLE_STATIC;LIBCXX_INSTALL_LIBRARY" OFF)
|
||||
cmake_dependent_option(LIBCXX_INSTALL_SHARED_LIBRARY
|
||||
"Install the shared libc++ library." ON
|
||||
"LIBCXX_ENABLE_SHARED;LIBCXX_INSTALL_LIBRARY" OFF)
|
||||
option(LIBCXX_INSTALL_SUPPORT_HEADERS "Install libc++ support headers." ON)
|
||||
cmake_dependent_option(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY
|
||||
"Install libc++experimental.a" ON
|
||||
"LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY;LIBCXX_INSTALL_LIBRARY" OFF)
|
||||
set(LIBCXX_ABI_VERSION 1 CACHE STRING "ABI version of libc++.")
|
||||
cmake_dependent_option(LIBCXX_INSTALL_FILESYSTEM_LIBRARY
|
||||
"Install libc++fs.a" ON
|
||||
"LIBCXX_ENABLE_FILESYSTEM;LIBCXX_INSTALL_LIBRARY" OFF)
|
||||
|
||||
if (FUCHSIA)
|
||||
set(DEFAULT_ABI_VERSION 2)
|
||||
else()
|
||||
set(DEFAULT_ABI_VERSION 1)
|
||||
endif()
|
||||
set(LIBCXX_ABI_VERSION ${DEFAULT_ABI_VERSION} CACHE STRING "ABI version of libc++.")
|
||||
option(LIBCXX_ABI_UNSTABLE "Unstable ABI of libc++." OFF)
|
||||
option(LIBCXX_ABI_FORCE_ITANIUM "Ignore auto-detection and force use of the Itanium ABI.")
|
||||
option(LIBCXX_ABI_FORCE_MICROSOFT "Ignore auto-detection and force use of the Microsoft ABI.")
|
||||
@ -123,6 +142,7 @@ if (LIBCXX_CXX_ABI STREQUAL "default")
|
||||
${LLVM_MAIN_SRC_DIR}/runtimes/libcxxabi/include
|
||||
${LLVM_MAIN_SRC_DIR}/../libcxxabi/include
|
||||
NO_DEFAULT_PATH
|
||||
NO_CMAKE_FIND_ROOT_PATH
|
||||
)
|
||||
if (LIBCXX_TARGETING_MSVC)
|
||||
# FIXME: Figure out how to configure the ABI library on Windows.
|
||||
@ -135,6 +155,9 @@ if (LIBCXX_CXX_ABI STREQUAL "default")
|
||||
elseif (APPLE)
|
||||
set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
|
||||
set(LIBCXX_CXX_ABI_SYSTEM 1)
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
set(LIBCXX_CXX_ABI_LIBNAME "libcxxrt")
|
||||
set(LIBCXX_CXX_ABI_INCLUDE_PATHS "/usr/include/c++/v1")
|
||||
else()
|
||||
set(LIBCXX_CXX_ABI_LIBNAME "default")
|
||||
endif()
|
||||
@ -146,13 +169,21 @@ endif()
|
||||
# cannot be used with LIBCXX_ENABLE_ABI_LINKER_SCRIPT.
|
||||
option(LIBCXX_ENABLE_STATIC_ABI_LIBRARY "Statically link the ABI library" OFF)
|
||||
|
||||
cmake_dependent_option(LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY
|
||||
"Statically link the ABI library to static library" ON
|
||||
"LIBCXX_ENABLE_STATIC_ABI_LIBRARY;LIBCXX_ENABLE_STATIC" OFF)
|
||||
|
||||
cmake_dependent_option(LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY
|
||||
"Statically link the ABI library to shared library" ON
|
||||
"LIBCXX_ENABLE_STATIC_ABI_LIBRARY;LIBCXX_ENABLE_STATIC" OFF)
|
||||
|
||||
# Generate and install a linker script inplace of libc++.so. The linker script
|
||||
# will link libc++ to the correct ABI library. This option is on by default
|
||||
# on UNIX platforms other than Apple unless 'LIBCXX_ENABLE_STATIC_ABI_LIBRARY'
|
||||
# is on. This option is also disabled when the ABI library is not specified
|
||||
# or is specified to be "none".
|
||||
set(ENABLE_LINKER_SCRIPT_DEFAULT_VALUE OFF)
|
||||
if (LLVM_HAVE_LINK_VERSION_SCRIPT AND NOT LIBCXX_ENABLE_STATIC_ABI_LIBRARY
|
||||
if (LLVM_HAVE_LINK_VERSION_SCRIPT AND NOT LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY
|
||||
AND NOT LIBCXX_CXX_ABI_LIBNAME STREQUAL "none"
|
||||
AND NOT LIBCXX_CXX_ABI_LIBNAME STREQUAL "default"
|
||||
AND PYTHONINTERP_FOUND
|
||||
@ -202,6 +233,7 @@ option(LIBCXX_ENABLE_MONOTONIC_CLOCK
|
||||
This option may only be set to OFF when LIBCXX_ENABLE_THREADS=OFF." ON)
|
||||
option(LIBCXX_HAS_MUSL_LIBC "Build libc++ with support for the Musl C library" OFF)
|
||||
option(LIBCXX_HAS_PTHREAD_API "Ignore auto-detection and force use of pthread API" OFF)
|
||||
option(LIBCXX_HAS_WIN32_THREAD_API "Ignore auto-detection and force use of win32 thread API" OFF)
|
||||
option(LIBCXX_HAS_EXTERNAL_THREAD_API
|
||||
"Build libc++ with an externalized threading API.
|
||||
This option may only be set to ON when LIBCXX_ENABLE_THREADS=ON." OFF)
|
||||
@ -273,6 +305,10 @@ if(NOT LIBCXX_ENABLE_THREADS)
|
||||
message(FATAL_ERROR "LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY can only be set "
|
||||
"to ON when LIBCXX_ENABLE_THREADS is also set to ON.")
|
||||
endif()
|
||||
if (LIBCXX_HAS_WIN32_THREAD_API)
|
||||
message(FATAL_ERROR "LIBCXX_HAS_WIN32_THREAD_API can only be set to ON"
|
||||
" when LIBCXX_ENABLE_THREADS is also set to ON.")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
@ -287,6 +323,19 @@ if (LIBCXX_HAS_EXTERNAL_THREAD_API)
|
||||
"and LIBCXX_HAS_PTHREAD_API cannot be both"
|
||||
"set to ON at the same time.")
|
||||
endif()
|
||||
if (LIBCXX_HAS_WIN32_THREAD_API)
|
||||
message(FATAL_ERROR "The options LIBCXX_HAS_EXTERNAL_THREAD_API"
|
||||
"and LIBCXX_HAS_WIN32_THREAD_API cannot be both"
|
||||
"set to ON at the same time.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (LIBCXX_HAS_PTHREAD_API)
|
||||
if (LIBCXX_HAS_WIN32_THREAD_API)
|
||||
message(FATAL_ERROR "The options LIBCXX_HAS_PTHREAD_API"
|
||||
"and LIBCXX_HAS_WIN32_THREAD_API cannot be both"
|
||||
"set to ON at the same time.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Ensure LLVM_USE_SANITIZER is not specified when LIBCXX_GENERATE_COVERAGE
|
||||
@ -329,7 +378,7 @@ if (LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
|
||||
if (LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
|
||||
message(FATAL_ERROR "Conflicting options given.
|
||||
LIBCXX_ENABLE_STATIC_ABI_LIBRARY cannot be specified with
|
||||
LIBCXX_ENABLE_ABI_LINKER_SCRIPT")
|
||||
@ -352,19 +401,29 @@ set(LIBCXX_COMPILER ${CMAKE_CXX_COMPILER})
|
||||
set(LIBCXX_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(LIBCXX_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build")
|
||||
if (LLVM_LIBRARY_OUTPUT_INTDIR)
|
||||
|
||||
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
|
||||
${PACKAGE_VERSION})
|
||||
|
||||
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
|
||||
set(DEFAULT_INSTALL_PREFIX lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}/)
|
||||
set(DEFAULT_INSTALL_HEADER_PREFIX lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/)
|
||||
set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/${LLVM_DEFAULT_TARGET_TRIPLE}/lib${LIBCXX_LIBDIR_SUFFIX})
|
||||
set(LIBCXX_HEADER_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION})
|
||||
elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
|
||||
set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
|
||||
set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR})
|
||||
else()
|
||||
set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
|
||||
endif()
|
||||
|
||||
file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}")
|
||||
|
||||
set(LIBCXX_INSTALL_PREFIX "" CACHE STRING
|
||||
set(LIBCXX_INSTALL_PREFIX ${DEFAULT_INSTALL_PREFIX} CACHE STRING
|
||||
"Define libc++ destination prefix.")
|
||||
|
||||
if (NOT LIBCXX_INSTALL_PREFIX MATCHES "^$|.*/")
|
||||
message(FATAL_ERROR "LIBCXX_INSTALL_PREFIX has to end with \"/\".")
|
||||
endif()
|
||||
set(LIBCXX_INSTALL_HEADER_PREFIX ${DEFAULT_INSTALL_HEADER_PREFIX} CACHE STRING
|
||||
"Define libc++ header destination prefix.")
|
||||
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR})
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR})
|
||||
@ -597,7 +656,7 @@ if (LIBCXX_STANDALONE_BUILD)
|
||||
endif()
|
||||
|
||||
# Configuration file flags =====================================================
|
||||
if (NOT LIBCXX_ABI_VERSION EQUAL "1")
|
||||
if (NOT LIBCXX_ABI_VERSION EQUAL DEFAULT_ABI_VERSION)
|
||||
config_define(${LIBCXX_ABI_VERSION} _LIBCPP_ABI_VERSION)
|
||||
endif()
|
||||
config_define_if(LIBCXX_ABI_UNSTABLE _LIBCPP_ABI_UNSTABLE)
|
||||
@ -613,6 +672,7 @@ config_define_if_not(LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS _LIBCPP_HAS_NO_THRE
|
||||
|
||||
config_define_if(LIBCXX_HAS_PTHREAD_API _LIBCPP_HAS_THREAD_API_PTHREAD)
|
||||
config_define_if(LIBCXX_HAS_EXTERNAL_THREAD_API _LIBCPP_HAS_THREAD_API_EXTERNAL)
|
||||
config_define_if(LIBCXX_HAS_WIN32_THREAD_API _LIBCPP_HAS_THREAD_API_WIN32)
|
||||
config_define_if(LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL)
|
||||
config_define_if(LIBCXX_HAS_MUSL_LIBC _LIBCPP_HAS_MUSL_LIBC)
|
||||
config_define_if(LIBCXX_NO_VCRUNTIME _LIBCPP_NO_VCRUNTIME)
|
||||
|
@ -101,7 +101,7 @@ E: nico.rieck@gmail.com
|
||||
D: Windows fixes
|
||||
|
||||
N: Jon Roelofs
|
||||
E: jonathan@codesourcery.com
|
||||
E: jroelofS@jroelofs.com
|
||||
D: Remote testing, Newlib port, baremetal/single-threaded support.
|
||||
|
||||
N: Jonathan Sauer
|
||||
|
@ -26,3 +26,4 @@ to libc++.
|
||||
1. Add a test under `test/libcxx` that the header defines `_LIBCPP_VERSION`.
|
||||
2. Update `test/libcxx/double_include.sh.cpp` to include the new header.
|
||||
3. Create a submodule in `include/module.modulemap` for the new header.
|
||||
4. Update the include/CMakeLists.txt file to include the new header.
|
||||
|
@ -9,7 +9,7 @@ cd C:\projects\deps
|
||||
:: Setup Compiler
|
||||
::###########################################################################
|
||||
if NOT EXIST llvm-installer.exe (
|
||||
appveyor DownloadFile http://prereleases.llvm.org/win-snapshots/LLVM-6.0.0-r316086-win32.exe -FileName llvm-installer.exe
|
||||
appveyor DownloadFile http://prereleases.llvm.org/win-snapshots/LLVM-7.0.0-r325576-win32.exe -FileName llvm-installer.exe
|
||||
)
|
||||
if "%CLANG_VERSION%"=="ToT" (
|
||||
START /WAIT llvm-installer.exe /S /D=C:\"Program Files\LLVM"
|
||||
|
@ -59,6 +59,7 @@ if (LIBCXX_BENCHMARK_NATIVE_STDLIB)
|
||||
-DBENCHMARK_ENABLE_TESTING:BOOL=OFF)
|
||||
endif()
|
||||
|
||||
|
||||
#==============================================================================
|
||||
# Benchmark tests configuration
|
||||
#==============================================================================
|
||||
@ -67,7 +68,7 @@ set(BENCHMARK_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(BENCHMARK_LIBCXX_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/benchmark-libcxx)
|
||||
set(BENCHMARK_NATIVE_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/benchmark-native)
|
||||
set(BENCHMARK_TEST_COMPILE_FLAGS
|
||||
-std=c++14 -O2
|
||||
-std=c++17 -O2
|
||||
-I${BENCHMARK_LIBCXX_INSTALL}/include
|
||||
-I${LIBCXX_SOURCE_DIR}/test/support
|
||||
)
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "benchmark/benchmark_api.h"
|
||||
#include "benchmark/benchmark.h"
|
||||
|
||||
namespace ContainerBenchmarks {
|
||||
|
||||
|
@ -29,14 +29,16 @@ inline std::default_random_engine& getRandomEngine() {
|
||||
return RandEngine;
|
||||
}
|
||||
|
||||
|
||||
inline char getRandomChar() {
|
||||
std::uniform_int_distribution<> LettersDist(0, LettersSize-1);
|
||||
return Letters[LettersDist(getRandomEngine())];
|
||||
}
|
||||
|
||||
template <class IntT>
|
||||
inline IntT getRandomInteger() {
|
||||
std::uniform_int_distribution<IntT> dist;
|
||||
inline IntT getRandomInteger(IntT Min = 0,
|
||||
IntT Max = std::numeric_limits<IntT>::max()) {
|
||||
std::uniform_int_distribution<IntT> dist(Min, Max);
|
||||
return dist(getRandomEngine());
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
|
||||
#include "benchmark/benchmark_api.h"
|
||||
#include "benchmark/benchmark.h"
|
||||
#include "GenerateInput.hpp"
|
||||
|
||||
constexpr std::size_t TestNumInputs = 1024;
|
||||
@ -59,4 +59,4 @@ BENCHMARK_CAPTURE(BM_Sort, single_element_strings,
|
||||
getDuplicateStringInputs)->Arg(TestNumInputs);
|
||||
|
||||
|
||||
BENCHMARK_MAIN()
|
||||
BENCHMARK_MAIN();
|
||||
|
@ -1,17 +1,14 @@
|
||||
#include <experimental/filesystem>
|
||||
|
||||
#include "benchmark/benchmark_api.h"
|
||||
#include "benchmark/benchmark.h"
|
||||
#include "GenerateInput.hpp"
|
||||
#include "test_iterators.h"
|
||||
|
||||
namespace fs = std::experimental::filesystem;
|
||||
#include "filesystem_include.hpp"
|
||||
|
||||
static const size_t TestNumInputs = 1024;
|
||||
|
||||
|
||||
template <class GenInputs>
|
||||
void BM_PathConstructString(benchmark::State &st, GenInputs gen) {
|
||||
using namespace fs;
|
||||
using fs::path;
|
||||
const auto in = gen(st.range(0));
|
||||
path PP;
|
||||
for (auto& Part : in)
|
||||
@ -21,14 +18,15 @@ void BM_PathConstructString(benchmark::State &st, GenInputs gen) {
|
||||
const path P(PP.native());
|
||||
benchmark::DoNotOptimize(P.native().data());
|
||||
}
|
||||
st.SetComplexityN(st.range(0));
|
||||
}
|
||||
BENCHMARK_CAPTURE(BM_PathConstructString, large_string,
|
||||
getRandomStringInputs)->Arg(TestNumInputs);
|
||||
getRandomStringInputs)->Range(8, TestNumInputs)->Complexity();
|
||||
|
||||
|
||||
template <class GenInputs>
|
||||
void BM_PathConstructCStr(benchmark::State &st, GenInputs gen) {
|
||||
using namespace fs;
|
||||
using fs::path;
|
||||
const auto in = gen(st.range(0));
|
||||
path PP;
|
||||
for (auto& Part : in)
|
||||
@ -45,7 +43,7 @@ BENCHMARK_CAPTURE(BM_PathConstructCStr, large_string,
|
||||
|
||||
template <template <class...> class ItType, class GenInputs>
|
||||
void BM_PathConstructIter(benchmark::State &st, GenInputs gen) {
|
||||
using namespace fs;
|
||||
using fs::path;
|
||||
using Iter = ItType<std::string::const_iterator>;
|
||||
const auto in = gen(st.range(0));
|
||||
path PP;
|
||||
@ -60,6 +58,7 @@ void BM_PathConstructIter(benchmark::State &st, GenInputs gen) {
|
||||
const path P(Start, End);
|
||||
benchmark::DoNotOptimize(P.native().data());
|
||||
}
|
||||
st.SetComplexityN(st.range(0));
|
||||
}
|
||||
template <class GenInputs>
|
||||
void BM_PathConstructInputIter(benchmark::State &st, GenInputs gen) {
|
||||
@ -70,14 +69,14 @@ void BM_PathConstructForwardIter(benchmark::State &st, GenInputs gen) {
|
||||
BM_PathConstructIter<forward_iterator>(st, gen);
|
||||
}
|
||||
BENCHMARK_CAPTURE(BM_PathConstructInputIter, large_string,
|
||||
getRandomStringInputs)->Arg(TestNumInputs);
|
||||
getRandomStringInputs)->Range(8, TestNumInputs)->Complexity();
|
||||
BENCHMARK_CAPTURE(BM_PathConstructForwardIter, large_string,
|
||||
getRandomStringInputs)->Arg(TestNumInputs);
|
||||
getRandomStringInputs)->Range(8, TestNumInputs)->Complexity();
|
||||
|
||||
|
||||
template <class GenInputs>
|
||||
void BM_PathIterateMultipleTimes(benchmark::State &st, GenInputs gen) {
|
||||
using namespace fs;
|
||||
using fs::path;
|
||||
const auto in = gen(st.range(0));
|
||||
path PP;
|
||||
for (auto& Part : in)
|
||||
@ -89,14 +88,15 @@ void BM_PathIterateMultipleTimes(benchmark::State &st, GenInputs gen) {
|
||||
}
|
||||
benchmark::ClobberMemory();
|
||||
}
|
||||
st.SetComplexityN(st.range(0));
|
||||
}
|
||||
BENCHMARK_CAPTURE(BM_PathIterateMultipleTimes, iterate_elements,
|
||||
getRandomStringInputs)->Arg(TestNumInputs);
|
||||
getRandomStringInputs)->Range(8, TestNumInputs)->Complexity();
|
||||
|
||||
|
||||
template <class GenInputs>
|
||||
void BM_PathIterateOnce(benchmark::State &st, GenInputs gen) {
|
||||
using namespace fs;
|
||||
using fs::path;
|
||||
const auto in = gen(st.range(0));
|
||||
path PP;
|
||||
for (auto& Part : in)
|
||||
@ -109,13 +109,14 @@ void BM_PathIterateOnce(benchmark::State &st, GenInputs gen) {
|
||||
}
|
||||
benchmark::ClobberMemory();
|
||||
}
|
||||
st.SetComplexityN(st.range(0));
|
||||
}
|
||||
BENCHMARK_CAPTURE(BM_PathIterateOnce, iterate_elements,
|
||||
getRandomStringInputs)->Arg(TestNumInputs);
|
||||
getRandomStringInputs)->Range(8, TestNumInputs)->Complexity();
|
||||
|
||||
template <class GenInputs>
|
||||
void BM_PathIterateOnceBackwards(benchmark::State &st, GenInputs gen) {
|
||||
using namespace fs;
|
||||
using fs::path;
|
||||
const auto in = gen(st.range(0));
|
||||
path PP;
|
||||
for (auto& Part : in)
|
||||
@ -135,4 +136,28 @@ void BM_PathIterateOnceBackwards(benchmark::State &st, GenInputs gen) {
|
||||
BENCHMARK_CAPTURE(BM_PathIterateOnceBackwards, iterate_elements,
|
||||
getRandomStringInputs)->Arg(TestNumInputs);
|
||||
|
||||
BENCHMARK_MAIN()
|
||||
static fs::path getRandomPaths(int NumParts, int PathLen) {
|
||||
fs::path Result;
|
||||
while (NumParts--) {
|
||||
std::string Part = getRandomString(PathLen);
|
||||
Result /= Part;
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <class GenInput>
|
||||
void BM_LexicallyNormal(benchmark::State &st, GenInput gen, size_t PathLen) {
|
||||
using fs::path;
|
||||
auto In = gen(st.range(0), PathLen);
|
||||
benchmark::DoNotOptimize(&In);
|
||||
while (st.KeepRunning()) {
|
||||
benchmark::DoNotOptimize(In.lexically_normal());
|
||||
}
|
||||
st.SetComplexityN(st.range(0));
|
||||
}
|
||||
BENCHMARK_CAPTURE(BM_LexicallyNormal, small_path,
|
||||
getRandomPaths, /*PathLen*/5)->RangeMultiplier(2)->Range(2, 256)->Complexity();
|
||||
BENCHMARK_CAPTURE(BM_LexicallyNormal, large_path,
|
||||
getRandomPaths, /*PathLen*/32)->RangeMultiplier(2)->Range(2, 256)->Complexity();
|
||||
|
||||
BENCHMARK_MAIN();
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
|
||||
#include "benchmark/benchmark_api.h"
|
||||
#include "benchmark/benchmark.h"
|
||||
#include "GenerateInput.hpp"
|
||||
|
||||
constexpr std::size_t MAX_STRING_LEN = 8 << 14;
|
||||
@ -46,4 +46,25 @@ static void BM_StringFindMatch2(benchmark::State &state) {
|
||||
}
|
||||
BENCHMARK(BM_StringFindMatch2)->Range(1, MAX_STRING_LEN / 4);
|
||||
|
||||
BENCHMARK_MAIN()
|
||||
static void BM_StringCtorDefault(benchmark::State &state) {
|
||||
while (state.KeepRunning()) {
|
||||
for (unsigned I=0; I < 1000; ++I) {
|
||||
std::string Default;
|
||||
benchmark::DoNotOptimize(Default.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
BENCHMARK(BM_StringCtorDefault);
|
||||
|
||||
static void BM_StringCtorCStr(benchmark::State &state) {
|
||||
std::string Input = getRandomString(state.range(0));
|
||||
const char *Str = Input.c_str();
|
||||
benchmark::DoNotOptimize(Str);
|
||||
while (state.KeepRunning()) {
|
||||
std::string Tmp(Str);
|
||||
benchmark::DoNotOptimize(Tmp.c_str());
|
||||
}
|
||||
}
|
||||
BENCHMARK(BM_StringCtorCStr)->Arg(1)->Arg(8)->Range(16, MAX_STRING_LEN / 4);
|
||||
|
||||
BENCHMARK_MAIN();
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "benchmark/benchmark_api.h"
|
||||
#include "benchmark/benchmark.h"
|
||||
|
||||
#include <sstream>
|
||||
double __attribute__((noinline)) istream_numbers();
|
||||
@ -35,4 +35,4 @@ static void BM_Istream_numbers(benchmark::State &state) {
|
||||
}
|
||||
|
||||
BENCHMARK(BM_Istream_numbers)->RangeMultiplier(2)->Range(1024, 4096);
|
||||
BENCHMARK_MAIN()
|
||||
BENCHMARK_MAIN();
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "benchmark/benchmark_api.h"
|
||||
#include "benchmark/benchmark.h"
|
||||
|
||||
#include "ContainerBenchmarks.hpp"
|
||||
#include "GenerateInput.hpp"
|
||||
@ -303,4 +303,4 @@ BENCHMARK_CAPTURE(BM_EmplaceDuplicate,
|
||||
std::unordered_set<std::string>{},
|
||||
getRandomCStringInputs)->Arg(TestNumInputs);
|
||||
|
||||
BENCHMARK_MAIN()
|
||||
BENCHMARK_MAIN();
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "benchmark/benchmark_api.h"
|
||||
#include "benchmark/benchmark.h"
|
||||
|
||||
static void BM_SharedPtrCreateDestroy(benchmark::State& st) {
|
||||
while (st.KeepRunning()) {
|
||||
@ -39,4 +39,4 @@ static void BM_WeakPtrIncDecRef(benchmark::State& st) {
|
||||
}
|
||||
BENCHMARK(BM_WeakPtrIncDecRef);
|
||||
|
||||
BENCHMARK_MAIN()
|
||||
BENCHMARK_MAIN();
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "benchmark/benchmark_api.h"
|
||||
#include "benchmark/benchmark.h"
|
||||
|
||||
#include "ContainerBenchmarks.hpp"
|
||||
#include "GenerateInput.hpp"
|
||||
@ -29,4 +29,4 @@ BENCHMARK_CAPTURE(BM_ConstructIterIter,
|
||||
getRandomStringInputs)->Arg(TestNumInputs);
|
||||
|
||||
|
||||
BENCHMARK_MAIN()
|
||||
BENCHMARK_MAIN();
|
||||
|
@ -9,7 +9,7 @@ INCLUDE(CheckCXXSourceCompiles)
|
||||
|
||||
function(check_cxx_atomics varname)
|
||||
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||
set(CMAKE_REQUIRED_FLAGS "-nodefaultlibs -std=c++11 -nostdinc++ -isystem ${LIBCXX_SOURCE_DIR}/include")
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs -std=c++11 -nostdinc++ -isystem ${LIBCXX_SOURCE_DIR}/include")
|
||||
if (${LIBCXX_GCC_TOOLCHAIN})
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} --gcc-toolchain=${LIBCXX_GCC_TOOLCHAIN}")
|
||||
endif()
|
||||
@ -31,7 +31,14 @@ int main() {
|
||||
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
|
||||
endfunction(check_cxx_atomics)
|
||||
|
||||
# Perform the check for 64bit atomics without libatomic. It may have been
|
||||
# added to the required libraries during in the configuration of LLVM, which
|
||||
# would cause the check for CXX atomics without libatomic to incorrectly pass.
|
||||
set(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
|
||||
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "atomic")
|
||||
check_cxx_atomics(LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${OLD_CMAKE_REQUIRED_LIBRARIES})
|
||||
|
||||
check_library_exists(atomic __atomic_fetch_add_8 "" LIBCXX_HAS_ATOMIC_LIB)
|
||||
# If not, check if the library exists, and atomics work with it.
|
||||
if(NOT LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB)
|
||||
|
@ -14,6 +14,7 @@ function(find_compiler_rt_library name dest)
|
||||
OUTPUT_VARIABLE LIBRARY_FILE
|
||||
)
|
||||
string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE)
|
||||
file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE)
|
||||
string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}")
|
||||
if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}")
|
||||
message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}")
|
||||
@ -37,6 +38,7 @@ function(find_compiler_rt_dir dest)
|
||||
OUTPUT_VARIABLE LIBRARY_DIR
|
||||
)
|
||||
string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR)
|
||||
file(TO_CMAKE_PATH "${LIBRARY_DIR}" LIBRARY_DIR)
|
||||
set(LIBRARY_DIR "${LIBRARY_DIR}/darwin")
|
||||
else()
|
||||
set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXX_COMPILE_FLAGS}
|
||||
@ -47,6 +49,7 @@ function(find_compiler_rt_dir dest)
|
||||
OUTPUT_VARIABLE LIBRARY_FILE
|
||||
)
|
||||
string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE)
|
||||
file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE)
|
||||
get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY)
|
||||
endif()
|
||||
if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}")
|
||||
|
@ -32,14 +32,6 @@ macro(setup_abi_lib abidefines abilib abifiles abidirs)
|
||||
set(LIBCXX_CXX_ABI_LIBRARY ${abilib})
|
||||
set(LIBCXX_ABILIB_FILES ${abifiles})
|
||||
|
||||
# The place in the build tree where we store out-of-source headers.
|
||||
file(MAKE_DIRECTORY "${LIBCXX_BUILD_HEADERS_ROOT}")
|
||||
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/c++/v1")
|
||||
foreach(_d ${abidirs})
|
||||
file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}/${_d}")
|
||||
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/c++/v1/${_d}")
|
||||
endforeach()
|
||||
|
||||
foreach(fpath ${LIBCXX_ABILIB_FILES})
|
||||
set(found FALSE)
|
||||
foreach(incpath ${LIBCXX_CXX_ABI_INCLUDE_PATHS})
|
||||
@ -47,20 +39,31 @@ macro(setup_abi_lib abidefines abilib abifiles abidirs)
|
||||
set(found TRUE)
|
||||
get_filename_component(dstdir ${fpath} PATH)
|
||||
get_filename_component(ifile ${fpath} NAME)
|
||||
file(COPY "${incpath}/${fpath}"
|
||||
DESTINATION "${LIBCXX_BINARY_INCLUDE_DIR}/${dstdir}"
|
||||
)
|
||||
file(COPY "${incpath}/${fpath}"
|
||||
DESTINATION "${CMAKE_BINARY_DIR}/include/c++/v1/${dstdir}"
|
||||
)
|
||||
set(src ${incpath}/${fpath})
|
||||
|
||||
set(dst ${LIBCXX_BINARY_INCLUDE_DIR}/${dstdir}/${fpath})
|
||||
add_custom_command(OUTPUT ${dst}
|
||||
DEPENDS ${src}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
|
||||
COMMENT "Copying C++ ABI header ${fpath}...")
|
||||
list(APPEND abilib_headers "${dst}")
|
||||
|
||||
if (NOT LIBCXX_USING_INSTALLED_LLVM AND LIBCXX_HEADER_DIR)
|
||||
set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
|
||||
add_custom_command(OUTPUT ${dst}
|
||||
DEPENDS ${src}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
|
||||
COMMENT "Copying C++ ABI header ${fpath}...")
|
||||
list(APPEND abilib_headers "${dst}")
|
||||
endif()
|
||||
|
||||
if (LIBCXX_INSTALL_HEADERS)
|
||||
install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
|
||||
DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1/${dstdir}
|
||||
DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dstdir}
|
||||
COMPONENT cxx-headers
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
)
|
||||
endif()
|
||||
list(APPEND abilib_headers "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}")
|
||||
endif()
|
||||
endforeach()
|
||||
if (NOT found)
|
||||
@ -69,6 +72,8 @@ macro(setup_abi_lib abidefines abilib abifiles abidirs)
|
||||
endforeach()
|
||||
|
||||
include_directories("${LIBCXX_BINARY_INCLUDE_DIR}")
|
||||
add_custom_target(cxx_abi_headers ALL DEPENDS ${abilib_headers})
|
||||
set(LIBCXX_CXX_ABI_HEADER_TARGET "cxx_abi_headers")
|
||||
endmacro()
|
||||
|
||||
|
||||
@ -93,7 +98,7 @@ if ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libstdc++" OR
|
||||
elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxabi")
|
||||
if (LIBCXX_CXX_ABI_INTREE)
|
||||
# Link against just-built "cxxabi" target.
|
||||
if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY)
|
||||
if (LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY)
|
||||
set(CXXABI_LIBNAME cxxabi_static)
|
||||
else()
|
||||
set(CXXABI_LIBNAME cxxabi_shared)
|
||||
|
@ -46,10 +46,11 @@ macro(find_llvm_parts)
|
||||
OUTPUT_VARIABLE CONFIG_OUTPUT
|
||||
ERROR_QUIET)
|
||||
if(NOT HAD_ERROR)
|
||||
string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH)
|
||||
string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG)
|
||||
file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG}" LLVM_CMAKE_PATH)
|
||||
else()
|
||||
set(LLVM_CMAKE_PATH
|
||||
"${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
|
||||
file(TO_CMAKE_PATH "${LLVM_BINARY_DIR}" LLVM_BINARY_DIR_CMAKE_STYLE)
|
||||
set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
|
||||
endif()
|
||||
else()
|
||||
set(LLVM_FOUND OFF)
|
||||
|
@ -242,11 +242,15 @@ libc++experimental Specific Options
|
||||
|
||||
.. option:: LIBCXX_ENABLE_FILESYSTEM:BOOL
|
||||
|
||||
**Default**: ``LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY``
|
||||
**Default**: ``ON``
|
||||
|
||||
Build filesystem as part of libc++experimental.a. This allows filesystem
|
||||
to be disabled without turning off the entire experimental library.
|
||||
Build filesystem as a standalone library libc++fs.a.
|
||||
|
||||
.. option:: LIBCXX_INSTALL_FILESYSTEM_LIBRARY:BOOL
|
||||
|
||||
**Default**: ``LIBCXX_ENABLE_FILESYSTEM AND LIBCXX_INSTALL_LIBRARY``
|
||||
|
||||
Install libc++fs.a alongside libc++.
|
||||
|
||||
.. _ABI Library Specific Options:
|
||||
|
||||
|
@ -58,7 +58,7 @@ Testing
|
||||
Some parameters can be passed to lit to run the test-suite and exercising the
|
||||
availability.
|
||||
|
||||
* The `platform` parameter controls the deployement target. For example lit can
|
||||
* The `platform` parameter controls the deployment target. For example lit can
|
||||
be invoked with `--param=platform=macosx10.8`. Default is the current host.
|
||||
* The `use_system_cxx_lib` parameter indicates to use another library than the
|
||||
just built one. Invoking lit with `--param=use_system_cxx_lib=true` will run
|
||||
|
@ -46,7 +46,7 @@ we do NOTHING.
|
||||
|
||||
Otherwise we create a custom installation rule that modifies the installed __config
|
||||
header. The rule first generates a dummy "__config_site" header containing the required
|
||||
#defines. The contents of the dummy header are then prependend to the installed
|
||||
#defines. The contents of the dummy header are then prepended to the installed
|
||||
__config header. By manually prepending the files we avoid the cost of an
|
||||
extra #include and we allow the __config header to be ignorant of the extra
|
||||
configuration all together. An example "__config" header generated when
|
||||
|
494
docs/DesignDocs/FileTimeType.rst
Normal file
494
docs/DesignDocs/FileTimeType.rst
Normal file
@ -0,0 +1,494 @@
|
||||
==============
|
||||
File Time Type
|
||||
==============
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
.. _file-time-type-motivation:
|
||||
|
||||
Motivation
|
||||
==========
|
||||
|
||||
The filesystem library provides interfaces for getting and setting the last
|
||||
write time of a file or directory. The interfaces use the ``file_time_type``
|
||||
type, which is a specialization of ``chrono::time_point`` for the
|
||||
"filesystem clock". According to [fs.filesystem.syn]
|
||||
|
||||
trivial-clock is an implementation-defined type that satisfies the
|
||||
Cpp17TrivialClock requirements ([time.clock.req]) and that is capable of
|
||||
representing and measuring file time values. Implementations should ensure
|
||||
that the resolution and range of file_time_type reflect the operating
|
||||
system dependent resolution and range of file time values.
|
||||
|
||||
|
||||
On POSIX systems, file times are represented using the ``timespec`` struct,
|
||||
which is defined as follows:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
struct timespec {
|
||||
time_t tv_sec;
|
||||
long tv_nsec;
|
||||
};
|
||||
|
||||
To represent the range and resolution of ``timespec``, we need to (A) have
|
||||
nanosecond resolution, and (B) use more than 64 bits (assuming a 64 bit ``time_t``).
|
||||
|
||||
As the standard requires us to use the ``chrono`` interface, we have to define
|
||||
our own filesystem clock which specifies the period and representation of
|
||||
the time points and duration it provides. It will look like this:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
struct _FilesystemClock {
|
||||
using period = nano;
|
||||
using rep = TBD; // What is this?
|
||||
|
||||
using duration = chrono::duration<rep, period>;
|
||||
using time_point = chrono::time_point<_FilesystemClock>;
|
||||
|
||||
// ... //
|
||||
};
|
||||
|
||||
using file_time_type = _FilesystemClock::time_point;
|
||||
|
||||
|
||||
To get nanosecond resolution, we simply define ``period`` to be ``std::nano``.
|
||||
But what type can we use as the arithmetic representation that is capable
|
||||
of representing the range of the ``timespec`` struct?
|
||||
|
||||
Problems To Consider
|
||||
====================
|
||||
|
||||
Before considering solutions, let's consider the problems they should solve,
|
||||
and how important solving those problems are:
|
||||
|
||||
|
||||
Having a Smaller Range than ``timespec``
|
||||
----------------------------------------
|
||||
|
||||
One solution to the range problem is to simply reduce the resolution of
|
||||
``file_time_type`` to be less than that of nanoseconds. This is what libc++'s
|
||||
initial implementation of ``file_time_type`` did; it's also what
|
||||
``std::system_clock`` does. As a result, it can represent time points about
|
||||
292 thousand years on either side of the epoch, as opposed to only 292 years
|
||||
at nanosecond resolution.
|
||||
|
||||
``timespec`` can represent time points +/- 292 billion years from the epoch
|
||||
(just in case you needed a time point 200 billion years before the big bang,
|
||||
and with nanosecond resolution).
|
||||
|
||||
To get the same range, we would need to drop our resolution to that of seconds
|
||||
to come close to having the same range.
|
||||
|
||||
This begs the question, is the range problem "really a problem"? Sane usages
|
||||
of file time stamps shouldn't exceed +/- 300 years, so should we care to support it?
|
||||
|
||||
I believe the answer is yes. We're not designing the filesystem time API, we're
|
||||
providing glorified C++ wrappers for it. If the underlying API supports
|
||||
a value, then we should too. Our wrappers should not place artificial restrictions
|
||||
on users that are not present in the underlying filesystem.
|
||||
|
||||
Having a smaller range that the underlying filesystem forces the
|
||||
implementation to report ``value_too_large`` errors when it encounters a time
|
||||
point that it can't represent. This can cause the call to ``last_write_time``
|
||||
to throw in cases where the user was confident the call should succeed. (See below)
|
||||
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
#include <filesystem>
|
||||
using namespace std::filesystem;
|
||||
|
||||
// Set the times using the system interface.
|
||||
void set_file_times(const char* path, struct timespec ts) {
|
||||
timespec both_times[2];
|
||||
both_times[0] = ts;
|
||||
both_times[1] = ts;
|
||||
int result = ::utimensat(AT_FDCWD, path, both_times, 0);
|
||||
assert(result != -1);
|
||||
}
|
||||
|
||||
// Called elsewhere to set the file time to something insane, and way
|
||||
// out of the 300 year range we might expect.
|
||||
void some_bad_persons_code() {
|
||||
struct timespec new_times;
|
||||
new_times.tv_sec = numeric_limits<time_t>::max();
|
||||
new_times.tv_nsec = 0;
|
||||
set_file_times("/tmp/foo", new_times); // OK, supported by most FSes
|
||||
}
|
||||
|
||||
int main() {
|
||||
path p = "/tmp/foo";
|
||||
file_status st = status(p);
|
||||
if (!exists(st) || !is_regular_file(st))
|
||||
return 1;
|
||||
if ((st.permissions() & perms::others_read) == perms::none)
|
||||
return 1;
|
||||
// It seems reasonable to assume this call should succeed.
|
||||
file_time_type tp = last_write_time(p); // BAD! Throws value_too_large.
|
||||
}
|
||||
|
||||
|
||||
Having a Smaller Resolution than ``timespec``
|
||||
---------------------------------------------
|
||||
|
||||
As mentioned in the previous section, one way to solve the range problem
|
||||
is by reducing the resolution. But matching the range of ``timespec`` using a
|
||||
64 bit representation requires limiting the resolution to seconds.
|
||||
|
||||
So we might ask: Do users "need" nanosecond precision? Is seconds not good enough?
|
||||
I limit my consideration of the point to this: Why was it not good enough for
|
||||
the underlying system interfaces? If it wasn't good enough for them, then it
|
||||
isn't good enough for us. Our job is to match the filesystems range and
|
||||
representation, not design it.
|
||||
|
||||
|
||||
Having a Larger Range than ``timespec``
|
||||
----------------------------------------
|
||||
|
||||
We should also consider the opposite problem of having a ``file_time_type``
|
||||
that is able to represent a larger range than ``timespec``. At least in
|
||||
this case ``last_write_time`` can be used to get and set all possible values
|
||||
supported by the underlying filesystem; meaning ``last_write_time(p)`` will
|
||||
never throw a overflow error when retrieving a value.
|
||||
|
||||
However, this introduces a new problem, where users are allowed to attempt to
|
||||
create a time point beyond what the filesystem can represent. Two particular
|
||||
values which cause this are ``file_time_type::min()`` and
|
||||
``file_time_type::max()``. As a result, the following code would throw:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
void test() {
|
||||
last_write_time("/tmp/foo", file_time_type::max()); // Throws
|
||||
last_write_time("/tmp/foo", file_time_type::min()); // Throws.
|
||||
}
|
||||
|
||||
Apart from cases explicitly using ``min`` and ``max``, I don't see users taking
|
||||
a valid time point, adding a couple hundred billions of years in error,
|
||||
and then trying to update a file's write time to that value very often.
|
||||
|
||||
Compared to having a smaller range, this problem seems preferable. At least
|
||||
now we can represent any time point the filesystem can, so users won't be forced
|
||||
to revert back to system interfaces to avoid limitations in the C++ STL.
|
||||
|
||||
I posit that we should only consider this concern *after* we have something
|
||||
with at least the same range and resolution of the underlying filesystem. The
|
||||
latter two problems are much more important to solve.
|
||||
|
||||
Potential Solutions And Their Complications
|
||||
===========================================
|
||||
|
||||
Source Code Portability Across Implementations
|
||||
-----------------------------------------------
|
||||
|
||||
As we've discussed, ``file_time_type`` needs a representation that uses more
|
||||
than 64 bits. The possible solutions include using ``__int128_t``, emulating a
|
||||
128 bit integer using a class, or potentially defining a ``timespec`` like
|
||||
arithmetic type. All three will allow us to, at minimum, match the range
|
||||
and resolution, and the last one might even allow us to match them exactly.
|
||||
|
||||
But when considering these potential solutions we need to consider more than
|
||||
just the values they can represent. We need to consider the effects they will
|
||||
have on users and their code. For example, each of them breaks the following
|
||||
code in some way:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
// Bug caused by an unexpected 'rep' type returned by count.
|
||||
void print_time(path p) {
|
||||
// __int128_t doesn't have streaming operators, and neither would our
|
||||
// custom arithmetic types.
|
||||
cout << last_write_time(p).time_since_epoch().count() << endl;
|
||||
}
|
||||
|
||||
// Overflow during creation bug.
|
||||
file_time_type timespec_to_file_time_type(struct timespec ts) {
|
||||
// woops! chrono::seconds and chrono::nanoseconds use a 64 bit representation
|
||||
// this may overflow before it's converted to a file_time_type.
|
||||
auto dur = seconds(ts.tv_sec) + nanoseconds(ts.tv_nsec);
|
||||
return file_time_type(dur);
|
||||
}
|
||||
|
||||
file_time_type correct_timespec_to_file_time_type(struct timespec ts) {
|
||||
// This is the correct version of the above example, where we
|
||||
// avoid using the chrono typedefs as they're not sufficient.
|
||||
// Can we expect users to avoid this bug?
|
||||
using fs_seconds = chrono::duration<file_time_type::rep>;
|
||||
using fs_nanoseconds = chrono::duration<file_time_type::rep, nano>;
|
||||
auto dur = fs_seconds(ts.tv_sec) + fs_nanoseconds(tv.tv_nsec);
|
||||
return file_time_type(dur);
|
||||
}
|
||||
|
||||
// Implicit truncation during conversion bug.
|
||||
intmax_t get_time_in_seconds(path p) {
|
||||
using fs_seconds = duration<file_time_type::rep, ratio<1, 1> >;
|
||||
auto tp = last_write_time(p);
|
||||
|
||||
// This works with truncation for __int128_t, but what does it do for
|
||||
// our custom arithmetic types.
|
||||
return duration_cast<fs_seconds>().count();
|
||||
}
|
||||
|
||||
|
||||
Each of the above examples would require a user to adjust their filesystem code
|
||||
to the particular eccentricities of the representation, hopefully only in such
|
||||
a way that the code is still portable across implementations.
|
||||
|
||||
At least some of the above issues are unavoidable, no matter what
|
||||
representation we choose. But some representations may be quirkier than others,
|
||||
and, as I'll argue later, using an actual arithmetic type (``__int128_t``)
|
||||
provides the least aberrant behavior.
|
||||
|
||||
|
||||
Chrono and ``timespec`` Emulation.
|
||||
----------------------------------
|
||||
|
||||
One of the options we've considered is using something akin to ``timespec``
|
||||
to represent the ``file_time_type``. It only seems natural seeing as that's
|
||||
what the underlying system uses, and because it might allow us to match
|
||||
the range and resolution exactly. But would it work with chrono? And could
|
||||
it still act at all like a ``timespec`` struct?
|
||||
|
||||
For ease of consideration, let's consider what the implementation might
|
||||
look like.
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
struct fs_timespec_rep {
|
||||
fs_timespec_rep(long long v)
|
||||
: tv_sec(v / nano::den), tv_nsec(v % nano::den)
|
||||
{ }
|
||||
private:
|
||||
time_t tv_sec;
|
||||
long tv_nsec;
|
||||
};
|
||||
bool operator==(fs_timespec_rep, fs_timespec_rep);
|
||||
fs_int128_rep operator+(fs_timespec_rep, fs_timespec_rep);
|
||||
// ... arithmetic operators ... //
|
||||
|
||||
The first thing to notice is that we can't construct ``fs_timespec_rep`` like
|
||||
a ``timespec`` by passing ``{secs, nsecs}``. Instead we're limited to
|
||||
constructing it from a single 64 bit integer.
|
||||
|
||||
We also can't allow the user to inspect the ``tv_sec`` or ``tv_nsec`` values
|
||||
directly. A ``chrono::duration`` represents its value as a tick period and a
|
||||
number of ticks stored using ``rep``. The representation is unaware of the
|
||||
tick period it is being used to represent, but ``timespec`` is setup to assume
|
||||
a nanosecond tick period; which is the only case where the names ``tv_sec``
|
||||
and ``tv_nsec`` match the values they store.
|
||||
|
||||
When we convert a nanosecond duration to seconds, ``fs_timespec_rep`` will
|
||||
use ``tv_sec`` to represent the number of giga seconds, and ``tv_nsec`` the
|
||||
remaining seconds. Let's consider how this might cause a bug were users allowed
|
||||
to manipulate the fields directly.
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
template <class Period>
|
||||
timespec convert_to_timespec(duration<fs_time_rep, Period> dur) {
|
||||
fs_timespec_rep rep = dur.count();
|
||||
return {rep.tv_sec, rep.tv_nsec}; // Oops! Period may not be nanoseconds.
|
||||
}
|
||||
|
||||
template <class Duration>
|
||||
Duration convert_to_duration(timespec ts) {
|
||||
Duration dur({ts.tv_sec, ts.tv_nsec}); // Oops! Period may not be nanoseconds.
|
||||
return file_time_type(dur);
|
||||
file_time_type tp = last_write_time(p);
|
||||
auto dur =
|
||||
}
|
||||
|
||||
time_t extract_seconds(file_time_type tp) {
|
||||
// Converting to seconds is a silly bug, but I could see it happening.
|
||||
using SecsT = chrono::duration<file_time_type::rep, ratio<1, 1>>;
|
||||
auto secs = duration_cast<Secs>(tp.time_since_epoch());
|
||||
// tv_sec is now representing gigaseconds.
|
||||
return secs.count().tv_sec; // Oops!
|
||||
}
|
||||
|
||||
Despite ``fs_timespec_rep`` not being usable in any manner resembling
|
||||
``timespec``, it still might buy us our goal of matching its range exactly,
|
||||
right?
|
||||
|
||||
Sort of. Chrono provides a specialization point which specifies the minimum
|
||||
and maximum values for a custom representation. It looks like this:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
template <>
|
||||
struct duration_values<fs_timespec_rep> {
|
||||
static fs_timespec_rep zero();
|
||||
static fs_timespec_rep min();
|
||||
static fs_timespec_rep max() { // assume friendship.
|
||||
fs_timespec_rep val;
|
||||
val.tv_sec = numeric_limits<time_t>::max();
|
||||
val.tv_nsec = nano::den - 1;
|
||||
return val;
|
||||
}
|
||||
};
|
||||
|
||||
Notice that ``duration_values`` doesn't tell the representation what tick
|
||||
period it's actually representing. This would indeed correctly limit the range
|
||||
of ``duration<fs_timespec_rep, nano>`` to exactly that of ``timespec``. But
|
||||
nanoseconds isn't the only tick period it will be used to represent. For
|
||||
example:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
void test() {
|
||||
using rep = file_time_type::rep;
|
||||
using fs_nsec = duration<rep, nano>;
|
||||
using fs_sec = duration<rep>;
|
||||
fs_nsec nsecs(fs_seconds::max()); // Truncates
|
||||
}
|
||||
|
||||
Though the above example may appear silly, I think it follows from the incorrect
|
||||
notion that using a ``timespec`` rep in chrono actually makes it act as if it
|
||||
were an actual ``timespec``.
|
||||
|
||||
Interactions with 32 bit ``time_t``
|
||||
-----------------------------------
|
||||
|
||||
Up until now we've only be considering cases where ``time_t`` is 64 bits, but what
|
||||
about 32 bit systems/builds where ``time_t`` is 32 bits? (this is the common case
|
||||
for 32 bit builds).
|
||||
|
||||
When ``time_t`` is 32 bits, we can implement ``file_time_type`` simply using 64-bit
|
||||
``long long``. There is no need to get either ``__int128_t`` or ``timespec`` emulation
|
||||
involved. And nor should we, as it would suffer from the numerous complications
|
||||
described by this paper.
|
||||
|
||||
Obviously our implementation for 32-bit builds should act as similarly to the
|
||||
64-bit build as possible. Code which compiles in one, should compile in the other.
|
||||
This consideration is important when choosing between ``__int128_t`` and
|
||||
emulating ``timespec``. The solution which provides the most uniformity with
|
||||
the least eccentricity is the preferable one.
|
||||
|
||||
Summary
|
||||
=======
|
||||
|
||||
The ``file_time_type`` time point is used to represent the write times for files.
|
||||
Its job is to act as part of a C++ wrapper for less ideal system interfaces. The
|
||||
underlying filesystem uses the ``timespec`` struct for the same purpose.
|
||||
|
||||
However, the initial implementation of ``file_time_type`` could not represent
|
||||
either the range or resolution of ``timespec``, making it unsuitable. Fixing
|
||||
this requires an implementation which uses more than 64 bits to store the
|
||||
time point.
|
||||
|
||||
We primarily considered two solutions: Using ``__int128_t`` and using a
|
||||
arithmetic emulation of ``timespec``. Each has its pros and cons, and both
|
||||
come with more than one complication.
|
||||
|
||||
The Potential Solutions
|
||||
-----------------------
|
||||
|
||||
``long long`` - The Status Quo
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Pros:
|
||||
|
||||
* As a type ``long long`` plays the nicest with others:
|
||||
|
||||
* It works with streaming operators and other library entities which support
|
||||
builtin integer types, but don't support ``__int128_t``.
|
||||
* Its the representation used by chrono's ``nanosecond`` and ``second`` typedefs.
|
||||
|
||||
Cons:
|
||||
|
||||
* It cannot provide the same resolution as ``timespec`` unless we limit it
|
||||
to a range of +/- 300 years from the epoch.
|
||||
* It cannot provide the same range as ``timespec`` unless we limit its resolution
|
||||
to seconds.
|
||||
* ``last_write_time`` has to report an error when the time reported by the filesystem
|
||||
is unrepresentable.
|
||||
|
||||
__int128_t
|
||||
~~~~~~~~~~~
|
||||
|
||||
Pros:
|
||||
|
||||
* It is an integer type.
|
||||
* It makes the implementation simple and efficient.
|
||||
* Acts exactly like other arithmetic types.
|
||||
* Can be implicitly converted to a builtin integer type by the user.
|
||||
|
||||
* This is important for doing things like:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
void c_interface_using_time_t(const char* p, time_t);
|
||||
|
||||
void foo(path p) {
|
||||
file_time_type tp = last_write_time(p);
|
||||
time_t secs = duration_cast<seconds>(tp.time_since_epoch()).count();
|
||||
c_interface_using_time_t(p.c_str(), secs);
|
||||
}
|
||||
|
||||
Cons:
|
||||
|
||||
* It isn't always available (but on 64 bit machines, it normally is).
|
||||
* It causes ``file_time_type`` to have a larger range than ``timespec``.
|
||||
* It doesn't always act the same as other builtin integer types. For example
|
||||
with ``cout`` or ``to_string``.
|
||||
* Allows implicit truncation to 64 bit integers.
|
||||
* It can be implicitly converted to a builtin integer type by the user,
|
||||
truncating its value.
|
||||
|
||||
Arithmetic ``timespec`` Emulation
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Pros:
|
||||
|
||||
* It has the exact same range and resolution of ``timespec`` when representing
|
||||
a nanosecond tick period.
|
||||
* It's always available, unlike ``__int128_t``.
|
||||
|
||||
Cons:
|
||||
|
||||
* It has a larger range when representing any period longer than a nanosecond.
|
||||
* Doesn't actually allow users to use it like a ``timespec``.
|
||||
* The required representation of using ``tv_sec`` to store the giga tick count
|
||||
and ``tv_nsec`` to store the remainder adds nothing over a 128 bit integer,
|
||||
but complicates a lot.
|
||||
* It isn't a builtin integer type, and can't be used anything like one.
|
||||
* Chrono can be made to work with it, but not nicely.
|
||||
* Emulating arithmetic classes come with their own host of problems regarding
|
||||
overload resolution (Each operator needs three SFINAE constrained versions of
|
||||
it in order to act like builtin integer types).
|
||||
* It offers little over simply using ``__int128_t``.
|
||||
* It acts the most differently than implementations using an actual integer type,
|
||||
which has a high chance of breaking source compatibility.
|
||||
|
||||
|
||||
Selected Solution - Using ``__int128_t``
|
||||
=========================================
|
||||
|
||||
The solution I selected for libc++ is using ``__int128_t`` when available,
|
||||
and otherwise falling back to using ``long long`` with nanosecond precision.
|
||||
|
||||
When ``__int128_t`` is available, or when ``time_t`` is 32-bits, the implementation
|
||||
provides same resolution and a greater range than ``timespec``. Otherwise
|
||||
it still provides the same resolution, but is limited to a range of +/- 300
|
||||
years. This final case should be rather rare, as ``__int128_t``
|
||||
is normally available in 64-bit builds, and ``time_t`` is normally 32-bits
|
||||
during 32-bit builds.
|
||||
|
||||
Although falling back to ``long long`` and nanosecond precision is less than
|
||||
ideal, it also happens to be the implementation provided by both libstdc++
|
||||
and MSVC. (So that makes it better, right?)
|
||||
|
||||
Although the ``timespec`` emulation solution is feasible and would largely
|
||||
do what we want, it comes with too many complications, potential problems
|
||||
and discrepancies when compared to "normal" chrono time points and durations.
|
||||
|
||||
An emulation of a builtin arithmetic type using a class is never going to act
|
||||
exactly the same, and the difference will be felt by users. It's not reasonable
|
||||
to expect them to tolerate and work around these differences. And once
|
||||
we commit to an ABI it will be too late to change. Committing to this seems
|
||||
risky.
|
||||
|
||||
Therefore, ``__int128_t`` seems like the better solution.
|
@ -66,6 +66,10 @@ Threading Configuration Macros
|
||||
This macro is defined when libc++ should use POSIX threads to implement the
|
||||
internal threading API.
|
||||
|
||||
**_LIBCPP_HAS_THREAD_API_WIN32**
|
||||
This macro is defined when libc++ should use Win32 threads to implement the
|
||||
internal threading API.
|
||||
|
||||
**_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL**
|
||||
This macro is defined when libc++ expects the definitions of the internal
|
||||
threading API to be provided by an external library. When defined
|
||||
|
@ -40,11 +40,11 @@ Visibility Macros
|
||||
this macro therefore expands to `__declspec(dllexport)` when building the
|
||||
library and has an empty definition otherwise.
|
||||
|
||||
**_LIBCPP_INLINE_VISIBILITY**
|
||||
Mark a function as hidden and force inlining whenever possible.
|
||||
|
||||
**_LIBCPP_ALWAYS_INLINE**
|
||||
A synonym for `_LIBCPP_INLINE_VISIBILITY`
|
||||
**_LIBCPP_HIDE_FROM_ABI**
|
||||
Mark a function as not being part of the ABI of any final linked image that
|
||||
uses it, and also as being internal to each TU that uses that function. In
|
||||
other words, the address of a function marked with this attribute is not
|
||||
guaranteed to be the same across translation units.
|
||||
|
||||
**_LIBCPP_TYPE_VIS**
|
||||
Mark a type's typeinfo, vtable and members as having default visibility.
|
||||
@ -155,6 +155,22 @@ Visibility Macros
|
||||
versioning namespace. This allows throwing and catching some exception types
|
||||
between libc++ and libstdc++.
|
||||
|
||||
**_LIBCPP_INTERNAL_LINKAGE**
|
||||
Mark the affected entity as having internal linkage (i.e. the `static`
|
||||
keyword in C). This is only a best effort: when the `internal_linkage`
|
||||
attribute is not available, we fall back to forcing the function to be
|
||||
inlined, which approximates internal linkage since an externally visible
|
||||
symbol is never generated for that function. This is an internal macro
|
||||
used as an implementation detail by other visibility macros. Never mark
|
||||
a function or a class with this macro directly.
|
||||
|
||||
**_LIBCPP_ALWAYS_INLINE**
|
||||
Forces inlining of the function it is applied to. For visibility purposes,
|
||||
this macro is used to make sure that an externally visible symbol is never
|
||||
generated in an object file when the `internal_linkage` attribute is not
|
||||
available. This is an internal macro used by other visibility macros, and
|
||||
it should not be used directly.
|
||||
|
||||
Links
|
||||
=====
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
# out-of-tree builds.
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS = -n -W
|
||||
SPHINXOPTS = -n -W -v
|
||||
SPHINXBUILD = sphinx-build
|
||||
PAPER =
|
||||
BUILDDIR = _build
|
||||
|
@ -49,6 +49,24 @@ An example of using ``LD_LIBRARY_PATH``:
|
||||
$ export LD_LIBRARY_PATH=<libcxx-install-prefix>/lib
|
||||
$ ./a.out # Searches for libc++ along LD_LIBRARY_PATH
|
||||
|
||||
|
||||
Using ``<filesystem>`` and libc++fs
|
||||
====================================
|
||||
|
||||
Libc++ provides the implementation of the filesystem library in a separate
|
||||
library. Users of ``<filesystem>`` and ``<experimental/filesystem>`` are
|
||||
required to link ``-lc++fs``.
|
||||
|
||||
.. note::
|
||||
Prior to libc++ 7.0, users of ``<experimental/filesystem>`` were required
|
||||
to link libc++experimental.
|
||||
|
||||
.. warning::
|
||||
The Filesystem library is still experimental in nature. As such normal
|
||||
guarantees about ABI stability and backwards compatibility do not yet apply
|
||||
to it. In the future, this restriction will be removed.
|
||||
|
||||
|
||||
Using libc++experimental and ``<experimental/...>``
|
||||
=====================================================
|
||||
|
||||
@ -65,6 +83,9 @@ installed. For information on building libc++experimental from source see
|
||||
:ref:`Building Libc++ <build instructions>` and
|
||||
:ref:`libc++experimental CMake Options <libc++experimental options>`.
|
||||
|
||||
Note that as of libc++ 7.0 using the ``<experimental/filesystem>`` requires linking
|
||||
libc++fs instead of libc++experimental.
|
||||
|
||||
Also see the `Experimental Library Implementation Status <http://libcxx.llvm.org/ts1z_status.html>`__
|
||||
page.
|
||||
|
||||
|
@ -47,9 +47,9 @@ copyright = u'2011-2017, LLVM Project'
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '6.0'
|
||||
version = '7.0'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '6.0'
|
||||
release = '7.0'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
@ -134,6 +134,7 @@ Design Documents
|
||||
DesignDocs/ABIVersioning
|
||||
DesignDocs/VisibilityMacros
|
||||
DesignDocs/ThreadingSupportAPI
|
||||
DesignDocs/FileTimeType
|
||||
|
||||
* `<atomic> design <http://libcxx.llvm.org/atomic_design.html>`_
|
||||
* `<type_traits> design <http://libcxx.llvm.org/type_traits_design.html>`_
|
||||
|
195
fuzzing/fuzz_test.cpp
Normal file
195
fuzzing/fuzz_test.cpp
Normal file
@ -0,0 +1,195 @@
|
||||
// -*- C++ -*-
|
||||
//===------------------------- fuzz_test.cpp ------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// A simple program for running regressions on the fuzzing routines.
|
||||
// This code is not part of any shipping product.
|
||||
//
|
||||
// To build:
|
||||
// clang++ -std=c++11 fuzz_test.cpp fuzzing.cpp
|
||||
//
|
||||
// To use:
|
||||
// fuzz_test -r partial_sort [-v] files...
|
||||
//
|
||||
// Each file should contain a test case.
|
||||
|
||||
// TODO: should add some memory tracking, too.
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <chrono>
|
||||
|
||||
#include "fuzzing.h"
|
||||
|
||||
// ==== Count memory allocations ====
|
||||
|
||||
struct MemoryCounters {
|
||||
size_t totalAllocationCount;
|
||||
size_t netAllocationCount;
|
||||
size_t totalBytesAllocated;
|
||||
};
|
||||
|
||||
MemoryCounters gMemoryCounters;
|
||||
|
||||
void ZeroMemoryCounters() {
|
||||
gMemoryCounters.totalAllocationCount = 0;
|
||||
gMemoryCounters.netAllocationCount = 0;
|
||||
gMemoryCounters.totalBytesAllocated = 0;
|
||||
}
|
||||
|
||||
void* operator new(std::size_t size)
|
||||
{
|
||||
if (size == 0) size = 1;
|
||||
void *p = ::malloc(size);
|
||||
if (p == NULL)
|
||||
throw std::bad_alloc();
|
||||
gMemoryCounters.totalAllocationCount += 1;
|
||||
gMemoryCounters.netAllocationCount += 1;
|
||||
gMemoryCounters.totalBytesAllocated += size;
|
||||
return p;
|
||||
}
|
||||
|
||||
void* operator new(std::size_t size, const std::nothrow_t&) noexcept
|
||||
{
|
||||
try { return operator new(size); }
|
||||
catch (const std::bad_alloc &) {}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void* operator new[](std::size_t size)
|
||||
{
|
||||
return ::operator new(size);
|
||||
}
|
||||
|
||||
void* operator new[](std::size_t size, const std::nothrow_t&) noexcept
|
||||
{
|
||||
try { return operator new(size); }
|
||||
catch (const std::bad_alloc &) {}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void operator delete(void* ptr) noexcept
|
||||
{
|
||||
if (ptr)
|
||||
::free(ptr);
|
||||
gMemoryCounters.netAllocationCount -= 1;
|
||||
}
|
||||
|
||||
void operator delete(void* ptr, const std::nothrow_t&) noexcept
|
||||
{
|
||||
::operator delete(ptr);
|
||||
}
|
||||
|
||||
void operator delete[](void* ptr) noexcept
|
||||
{
|
||||
::operator delete(ptr);
|
||||
}
|
||||
|
||||
void operator delete[](void* ptr, const std::nothrow_t&) noexcept
|
||||
{
|
||||
::operator delete(ptr);
|
||||
}
|
||||
|
||||
// ==== End count memory allocations ====
|
||||
|
||||
|
||||
typedef int (*FuzzProc) (const uint8_t *data, size_t size);
|
||||
|
||||
const std::map<std::string, FuzzProc> procs = {
|
||||
{"sort", fuzzing::sort},
|
||||
{"stable_sort", fuzzing::stable_sort},
|
||||
{"partition", fuzzing::partition},
|
||||
{"partition_copy", fuzzing::partition_copy},
|
||||
{"stable_partition", fuzzing::stable_partition},
|
||||
{"unique", fuzzing::unique},
|
||||
{"unique_copy", fuzzing::unique_copy},
|
||||
{"nth_element", fuzzing::nth_element},
|
||||
{"partial_sort", fuzzing::partial_sort},
|
||||
{"partial_sort_copy", fuzzing::partial_sort_copy},
|
||||
{"make_heap", fuzzing::make_heap},
|
||||
{"push_heap", fuzzing::push_heap},
|
||||
{"pop_heap", fuzzing::pop_heap},
|
||||
{"regex_ECMAScript", fuzzing::regex_ECMAScript},
|
||||
{"regex_POSIX", fuzzing::regex_POSIX},
|
||||
{"regex_extended", fuzzing::regex_extended},
|
||||
{"regex_awk", fuzzing::regex_awk},
|
||||
{"regex_grep", fuzzing::regex_grep},
|
||||
{"regex_egrep", fuzzing::regex_egrep},
|
||||
{"search", fuzzing::search}
|
||||
};
|
||||
|
||||
|
||||
|
||||
bool verbose = false;
|
||||
|
||||
void test_one(const char *filename, FuzzProc fp)
|
||||
{
|
||||
std::vector<uint8_t> v;
|
||||
std::ifstream f (filename, std::ios::binary);
|
||||
if (!f.is_open())
|
||||
std::cerr << "## Can't open '" << filename << "'" << std::endl;
|
||||
else
|
||||
{
|
||||
typedef std::istream_iterator<uint8_t> Iter;
|
||||
std::copy(Iter(f), Iter(), std::back_inserter(v));
|
||||
if (verbose)
|
||||
std::cout << "File '" << filename << "' contains " << v.size() << " entries" << std::endl;
|
||||
ZeroMemoryCounters();
|
||||
const auto start_time = std::chrono::high_resolution_clock::now();
|
||||
int ret = fp (v.data(), v.size());
|
||||
const auto finish_time = std::chrono::high_resolution_clock::now();
|
||||
MemoryCounters mc = gMemoryCounters;
|
||||
if (ret != 0)
|
||||
std::cerr << "## Failure code: " << ret << std::endl;
|
||||
if (verbose)
|
||||
{
|
||||
std::cout << "Execution time: "
|
||||
<< std::chrono::duration_cast<std::chrono::milliseconds>(finish_time - start_time).count()
|
||||
<< " milliseconds" << std::endl;
|
||||
std::cout << "Memory: "
|
||||
<< mc.totalBytesAllocated << " bytes allocated ("
|
||||
<< mc.totalAllocationCount << " allocations); "
|
||||
<< mc.netAllocationCount << " allocations remain" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void usage (const char *name)
|
||||
{
|
||||
std::cout << "Usage: " << name << " -r proc [-v] files..." << std::endl;
|
||||
std::cout << "Supported routines:" << std::endl;
|
||||
for (const auto &p : procs)
|
||||
std::cout << " " << p.first << std::endl;
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
// Poor man's command-line options
|
||||
const std::string dashR("-r");
|
||||
const std::string dashV("-v");
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (argc < 4 || dashR != argv[1] || procs.find(argv[2]) == procs.end())
|
||||
usage(argv[0]);
|
||||
else {
|
||||
FuzzProc fp = procs.find(argv[2])->second;
|
||||
int firstFile = 3;
|
||||
if (dashV == argv[firstFile])
|
||||
{
|
||||
verbose = true;
|
||||
++firstFile;
|
||||
}
|
||||
for (int i = firstFile; i < argc; ++i)
|
||||
test_one(argv[i], fp);
|
||||
}
|
||||
}
|
@ -105,6 +105,60 @@ struct is_even<stable_test>
|
||||
|
||||
typedef std::vector<uint8_t> Vec;
|
||||
typedef std::vector<stable_test> StableVec;
|
||||
typedef StableVec::const_iterator SVIter;
|
||||
|
||||
// Cheap version of is_permutation
|
||||
// Builds a set of buckets for each of the key values.
|
||||
// Sums all the payloads.
|
||||
// Not 100% perfect, but _way_ faster
|
||||
bool is_permutation(SVIter first1, SVIter last1, SVIter first2)
|
||||
{
|
||||
size_t xBuckets[256] = {0};
|
||||
size_t xPayloads[256] = {0};
|
||||
size_t yBuckets[256] = {0};
|
||||
size_t yPayloads[256] = {0};
|
||||
|
||||
for (; first1 != last1; ++first1, ++first2)
|
||||
{
|
||||
xBuckets [first1->key]++;
|
||||
xPayloads[first1->key] += first1->payload;
|
||||
|
||||
yBuckets [first2->key]++;
|
||||
yPayloads[first2->key] += first2->payload;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < 256; ++i)
|
||||
{
|
||||
if (xBuckets[i] != yBuckets[i])
|
||||
return false;
|
||||
if (xPayloads[i] != yPayloads[i])
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename Iter1, typename Iter2>
|
||||
bool is_permutation(Iter1 first1, Iter1 last1, Iter2 first2)
|
||||
{
|
||||
static_assert((std::is_same<typename std::iterator_traits<Iter1>::value_type, uint8_t>::value), "");
|
||||
static_assert((std::is_same<typename std::iterator_traits<Iter2>::value_type, uint8_t>::value), "");
|
||||
|
||||
size_t xBuckets[256] = {0};
|
||||
size_t yBuckets[256] = {0};
|
||||
|
||||
for (; first1 != last1; ++first1, ++first2)
|
||||
{
|
||||
xBuckets [*first1]++;
|
||||
yBuckets [*first2]++;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < 256; ++i)
|
||||
if (xBuckets[i] != yBuckets[i])
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// == sort ==
|
||||
int sort(const uint8_t *data, size_t size)
|
||||
@ -113,7 +167,7 @@ int sort(const uint8_t *data, size_t size)
|
||||
std::sort(working.begin(), working.end());
|
||||
|
||||
if (!std::is_sorted(working.begin(), working.end())) return 1;
|
||||
if (!std::is_permutation(data, data + size, working.begin())) return 99;
|
||||
if (!fuzzing::is_permutation(data, data + size, working.cbegin())) return 99;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -135,7 +189,7 @@ int stable_sort(const uint8_t *data, size_t size)
|
||||
if (!std::is_sorted(range.first, range.second, total_less())) return 2;
|
||||
iter = range.second;
|
||||
}
|
||||
if (!std::is_permutation(input.begin(), input.end(), working.begin())) return 99;
|
||||
if (!fuzzing::is_permutation(input.cbegin(), input.cend(), working.cbegin())) return 99;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -147,7 +201,7 @@ int partition(const uint8_t *data, size_t size)
|
||||
|
||||
if (!std::all_of (working.begin(), iter, is_even<uint8_t>())) return 1;
|
||||
if (!std::none_of(iter, working.end(), is_even<uint8_t>())) return 2;
|
||||
if (!std::is_permutation(data, data + size, working.begin())) return 99;
|
||||
if (!fuzzing::is_permutation(data, data + size, working.cbegin())) return 99;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -190,7 +244,7 @@ int stable_partition (const uint8_t *data, size_t size)
|
||||
if (!std::none_of(iter, working.end(), is_even<stable_test>())) return 2;
|
||||
if (!std::is_sorted(working.begin(), iter, payload_less())) return 3;
|
||||
if (!std::is_sorted(iter, working.end(), payload_less())) return 4;
|
||||
if (!std::is_permutation(input.begin(), input.end(), working.begin())) return 99;
|
||||
if (!fuzzing::is_permutation(input.cbegin(), input.cend(), working.cbegin())) return 99;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -216,7 +270,7 @@ int nth_element (const uint8_t *data, size_t size)
|
||||
return 1;
|
||||
if (!std::all_of(partition_iter, working.end(), [=](uint8_t v) { return v >= nth; }))
|
||||
return 2;
|
||||
if (!std::is_permutation(data + 1, data + size, working.begin())) return 99;
|
||||
if (!fuzzing::is_permutation(data + 1, data + size, working.cbegin())) return 99;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -241,7 +295,7 @@ int partial_sort (const uint8_t *data, size_t size)
|
||||
return 2;
|
||||
}
|
||||
if (!std::is_sorted(working.begin(), sort_iter)) return 3;
|
||||
if (!std::is_permutation(data + 1, data + size, working.begin())) return 99;
|
||||
if (!fuzzing::is_permutation(data + 1, data + size, working.cbegin())) return 99;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -440,7 +494,7 @@ int make_heap (const uint8_t *data, size_t size)
|
||||
std::make_heap(working.begin(), working.end());
|
||||
|
||||
if (!std::is_heap(working.begin(), working.end())) return 1;
|
||||
if (!std::is_permutation(data, data + size, working.begin())) return 99;
|
||||
if (!fuzzing::is_permutation(data, data + size, working.cbegin())) return 99;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -461,7 +515,7 @@ int push_heap (const uint8_t *data, size_t size)
|
||||
if (!std::is_heap(working.begin(), iter)) return 2;
|
||||
}
|
||||
|
||||
if (!std::is_permutation(data, data + size, working.begin())) return 99;
|
||||
if (!fuzzing::is_permutation(data, data + size, working.cbegin())) return 99;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,34 +1,191 @@
|
||||
if (NOT LIBCXX_INSTALL_SUPPORT_HEADERS)
|
||||
set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE)
|
||||
endif()
|
||||
|
||||
set(LIBCXX_HEADER_PATTERN
|
||||
PATTERN "*"
|
||||
PATTERN "CMakeLists.txt" EXCLUDE
|
||||
PATTERN ".svn" EXCLUDE
|
||||
PATTERN "__config_site.in" EXCLUDE
|
||||
${LIBCXX_SUPPORT_HEADER_PATTERN}
|
||||
set(files
|
||||
__bit_reference
|
||||
__bsd_locale_defaults.h
|
||||
__bsd_locale_fallbacks.h
|
||||
__errc
|
||||
__debug
|
||||
__functional_03
|
||||
__functional_base
|
||||
__functional_base_03
|
||||
__hash_table
|
||||
__libcpp_version
|
||||
__locale
|
||||
__mutex_base
|
||||
__nullptr
|
||||
__split_buffer
|
||||
__sso_allocator
|
||||
__std_stream
|
||||
__string
|
||||
__threading_support
|
||||
__tree
|
||||
__tuple
|
||||
__undef_macros
|
||||
algorithm
|
||||
any
|
||||
array
|
||||
atomic
|
||||
bitset
|
||||
cassert
|
||||
ccomplex
|
||||
cctype
|
||||
cerrno
|
||||
cfenv
|
||||
cfloat
|
||||
chrono
|
||||
cinttypes
|
||||
ciso646
|
||||
climits
|
||||
clocale
|
||||
cmath
|
||||
codecvt
|
||||
compare
|
||||
complex
|
||||
complex.h
|
||||
condition_variable
|
||||
csetjmp
|
||||
csignal
|
||||
cstdarg
|
||||
cstdbool
|
||||
cstddef
|
||||
cstdint
|
||||
cstdio
|
||||
cstdlib
|
||||
cstring
|
||||
ctgmath
|
||||
ctime
|
||||
ctype.h
|
||||
cwchar
|
||||
cwctype
|
||||
deque
|
||||
errno.h
|
||||
exception
|
||||
experimental/__config
|
||||
experimental/__memory
|
||||
experimental/algorithm
|
||||
experimental/any
|
||||
experimental/chrono
|
||||
experimental/coroutine
|
||||
experimental/deque
|
||||
experimental/dynarray
|
||||
experimental/filesystem
|
||||
experimental/forward_list
|
||||
experimental/functional
|
||||
experimental/iterator
|
||||
experimental/list
|
||||
experimental/map
|
||||
experimental/memory_resource
|
||||
experimental/numeric
|
||||
experimental/optional
|
||||
experimental/propagate_const
|
||||
experimental/ratio
|
||||
experimental/regex
|
||||
experimental/set
|
||||
experimental/simd
|
||||
experimental/string
|
||||
experimental/string_view
|
||||
experimental/system_error
|
||||
experimental/tuple
|
||||
experimental/type_traits
|
||||
experimental/unordered_map
|
||||
experimental/unordered_set
|
||||
experimental/utility
|
||||
experimental/vector
|
||||
ext/__hash
|
||||
ext/hash_map
|
||||
ext/hash_set
|
||||
filesystem
|
||||
float.h
|
||||
forward_list
|
||||
fstream
|
||||
functional
|
||||
future
|
||||
initializer_list
|
||||
inttypes.h
|
||||
iomanip
|
||||
ios
|
||||
iosfwd
|
||||
iostream
|
||||
istream
|
||||
iterator
|
||||
limits
|
||||
limits.h
|
||||
list
|
||||
locale
|
||||
locale.h
|
||||
map
|
||||
math.h
|
||||
memory
|
||||
module.modulemap
|
||||
mutex
|
||||
new
|
||||
numeric
|
||||
optional
|
||||
ostream
|
||||
queue
|
||||
random
|
||||
ratio
|
||||
regex
|
||||
scoped_allocator
|
||||
set
|
||||
setjmp.h
|
||||
shared_mutex
|
||||
span
|
||||
sstream
|
||||
stack
|
||||
stdbool.h
|
||||
stddef.h
|
||||
stdexcept
|
||||
stdint.h
|
||||
stdio.h
|
||||
stdlib.h
|
||||
streambuf
|
||||
string
|
||||
string.h
|
||||
string_view
|
||||
strstream
|
||||
system_error
|
||||
tgmath.h
|
||||
thread
|
||||
tuple
|
||||
type_traits
|
||||
typeindex
|
||||
typeinfo
|
||||
unordered_map
|
||||
unordered_set
|
||||
utility
|
||||
valarray
|
||||
variant
|
||||
vector
|
||||
version
|
||||
wchar.h
|
||||
wctype.h
|
||||
)
|
||||
|
||||
if(NOT LIBCXX_USING_INSTALLED_LLVM AND LLVM_BINARY_DIR)
|
||||
file(COPY .
|
||||
DESTINATION "${LLVM_BINARY_DIR}/include/c++/v1"
|
||||
FILES_MATCHING
|
||||
${LIBCXX_HEADER_PATTERN}
|
||||
if(LIBCXX_INSTALL_SUPPORT_HEADERS)
|
||||
set(files
|
||||
${files}
|
||||
support/android/locale_bionic.h
|
||||
support/fuchsia/xlocale.h
|
||||
support/ibm/limits.h
|
||||
support/ibm/locale_mgmt_aix.h
|
||||
support/ibm/support.h
|
||||
support/ibm/xlocale.h
|
||||
support/musl/xlocale.h
|
||||
support/newlib/xlocale.h
|
||||
support/solaris/floatingpoint.h
|
||||
support/solaris/wchar.h
|
||||
support/solaris/xlocale.h
|
||||
support/win32/limits_msvc_win32.h
|
||||
support/win32/locale_win32.h
|
||||
support/xlocale/__nop_locale_mgmt.h
|
||||
support/xlocale/__posix_l_fallback.h
|
||||
support/xlocale/__strtonum_fallback.h
|
||||
support/xlocale/xlocale.h
|
||||
)
|
||||
endif()
|
||||
|
||||
if (LIBCXX_INSTALL_HEADERS)
|
||||
install(DIRECTORY .
|
||||
DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1
|
||||
COMPONENT cxx-headers
|
||||
FILES_MATCHING
|
||||
${LIBCXX_HEADER_PATTERN}
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
)
|
||||
|
||||
if (LIBCXX_NEEDS_SITE_CONFIG)
|
||||
# Generate and install a custom __config header. The new header is created
|
||||
# Generate a custom __config header. The new header is created
|
||||
# by prepending __config_site to the current __config header.
|
||||
add_custom_command(OUTPUT ${LIBCXX_BINARY_DIR}/__generated_config
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/cat_files.py
|
||||
@ -39,20 +196,67 @@ if (LIBCXX_INSTALL_HEADERS)
|
||||
${LIBCXX_BINARY_DIR}/__config_site
|
||||
)
|
||||
# Add a target that executes the generation commands.
|
||||
add_custom_target(generate_config_header ALL
|
||||
add_custom_target(cxx-generated-config ALL
|
||||
DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config)
|
||||
set(generated_config_deps generate_config_header)
|
||||
set(generated_config_deps cxx-generated-config)
|
||||
else()
|
||||
set(files
|
||||
${files}
|
||||
__config
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT LIBCXX_USING_INSTALLED_LLVM AND LIBCXX_HEADER_DIR)
|
||||
set(output_dir ${LIBCXX_HEADER_DIR}/include/c++/v1)
|
||||
|
||||
set(out_files)
|
||||
foreach(f ${files})
|
||||
set(src ${CMAKE_CURRENT_SOURCE_DIR}/${f})
|
||||
set(dst ${output_dir}/${f})
|
||||
add_custom_command(OUTPUT ${dst}
|
||||
DEPENDS ${src}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
|
||||
COMMENT "Copying CXX header ${f}")
|
||||
list(APPEND out_files ${dst})
|
||||
endforeach()
|
||||
|
||||
if (LIBCXX_NEEDS_SITE_CONFIG)
|
||||
# Copy the generated header as __config into build directory.
|
||||
set(src ${LIBCXX_BINARY_DIR}/__generated_config)
|
||||
set(dst ${output_dir}/__config)
|
||||
add_custom_command(OUTPUT ${dst}
|
||||
DEPENDS ${src} ${generated_config_deps}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
|
||||
COMMENT "Copying CXX __config")
|
||||
list(APPEND out_files ${dst})
|
||||
endif()
|
||||
|
||||
add_custom_target(cxx-headers ALL DEPENDS ${out_files} ${LIBCXX_CXX_ABI_HEADER_TARGET})
|
||||
else()
|
||||
add_custom_target(cxx-headers)
|
||||
endif()
|
||||
set_target_properties(cxx-headers PROPERTIES FOLDER "Misc")
|
||||
|
||||
if (LIBCXX_INSTALL_HEADERS)
|
||||
foreach(file ${files})
|
||||
get_filename_component(dir ${file} DIRECTORY)
|
||||
install(FILES ${file}
|
||||
DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dir}
|
||||
COMPONENT cxx-headers
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
)
|
||||
endforeach()
|
||||
|
||||
if (LIBCXX_NEEDS_SITE_CONFIG)
|
||||
# Install the generated header as __config.
|
||||
install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
|
||||
DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1
|
||||
DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
RENAME __config
|
||||
COMPONENT cxx-headers)
|
||||
endif()
|
||||
|
||||
if (NOT CMAKE_CONFIGURATION_TYPES)
|
||||
# this target is just needed as a placeholder for the distribution target
|
||||
add_custom_target(cxx-headers)
|
||||
add_custom_target(install-cxx-headers
|
||||
DEPENDS cxx-headers ${generated_config_deps}
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
@ -61,9 +265,7 @@ if (LIBCXX_INSTALL_HEADERS)
|
||||
# Stripping is a no-op for headers
|
||||
add_custom_target(install-cxx-headers-stripped DEPENDS install-cxx-headers)
|
||||
|
||||
add_custom_target(libcxx-headers)
|
||||
add_custom_target(install-libcxx-headers DEPENDS install-cxx-headers)
|
||||
add_custom_target(install-libcxx-headers-stripped DEPENDS install-cxx-headers-stripped)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
@ -24,28 +24,28 @@
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
decltype(MB_CUR_MAX) __libcpp_mb_cur_max_l(locale_t __l)
|
||||
{
|
||||
__libcpp_locale_guard __current(__l);
|
||||
return MB_CUR_MAX;
|
||||
}
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
wint_t __libcpp_btowc_l(int __c, locale_t __l)
|
||||
{
|
||||
__libcpp_locale_guard __current(__l);
|
||||
return btowc(__c);
|
||||
}
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int __libcpp_wctob_l(wint_t __c, locale_t __l)
|
||||
{
|
||||
__libcpp_locale_guard __current(__l);
|
||||
return wctob(__c);
|
||||
}
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
size_t __libcpp_wcsnrtombs_l(char *__dest, const wchar_t **__src, size_t __nwc,
|
||||
size_t __len, mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
@ -53,14 +53,14 @@ size_t __libcpp_wcsnrtombs_l(char *__dest, const wchar_t **__src, size_t __nwc,
|
||||
return wcsnrtombs(__dest, __src, __nwc, __len, __ps);
|
||||
}
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
size_t __libcpp_wcrtomb_l(char *__s, wchar_t __wc, mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
__libcpp_locale_guard __current(__l);
|
||||
return wcrtomb(__s, __wc, __ps);
|
||||
}
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
size_t __libcpp_mbsnrtowcs_l(wchar_t * __dest, const char **__src, size_t __nms,
|
||||
size_t __len, mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
@ -68,7 +68,7 @@ size_t __libcpp_mbsnrtowcs_l(wchar_t * __dest, const char **__src, size_t __nms,
|
||||
return mbsnrtowcs(__dest, __src, __nms, __len, __ps);
|
||||
}
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
size_t __libcpp_mbrtowc_l(wchar_t *__pwc, const char *__s, size_t __n,
|
||||
mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
@ -76,28 +76,28 @@ size_t __libcpp_mbrtowc_l(wchar_t *__pwc, const char *__s, size_t __n,
|
||||
return mbrtowc(__pwc, __s, __n, __ps);
|
||||
}
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int __libcpp_mbtowc_l(wchar_t *__pwc, const char *__pmb, size_t __max, locale_t __l)
|
||||
{
|
||||
__libcpp_locale_guard __current(__l);
|
||||
return mbtowc(__pwc, __pmb, __max);
|
||||
}
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
size_t __libcpp_mbrlen_l(const char *__s, size_t __n, mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
__libcpp_locale_guard __current(__l);
|
||||
return mbrlen(__s, __n, __ps);
|
||||
}
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
lconv *__libcpp_localeconv_l(locale_t __l)
|
||||
{
|
||||
__libcpp_locale_guard __current(__l);
|
||||
return localeconv();
|
||||
}
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
size_t __libcpp_mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len,
|
||||
mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
|
176
include/__config
176
include/__config
@ -33,11 +33,27 @@
|
||||
# define _GNUC_VER_NEW 0
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_VERSION 6000
|
||||
#define _LIBCPP_VERSION 7000
|
||||
|
||||
#ifndef _LIBCPP_ABI_VERSION
|
||||
# ifdef __Fuchsia__
|
||||
# define _LIBCPP_ABI_VERSION 2
|
||||
# else
|
||||
# define _LIBCPP_ABI_VERSION 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_STD_VER
|
||||
# if __cplusplus <= 201103L
|
||||
# define _LIBCPP_STD_VER 11
|
||||
# elif __cplusplus <= 201402L
|
||||
# define _LIBCPP_STD_VER 14
|
||||
# elif __cplusplus <= 201703L
|
||||
# define _LIBCPP_STD_VER 17
|
||||
# else
|
||||
# define _LIBCPP_STD_VER 18 // current year, or date of c++2a ratification
|
||||
# endif
|
||||
#endif // _LIBCPP_STD_VER
|
||||
|
||||
#if defined(__ELF__)
|
||||
# define _LIBCPP_OBJECT_FORMAT_ELF 1
|
||||
@ -116,33 +132,37 @@
|
||||
#ifndef __has_attribute
|
||||
#define __has_attribute(__x) 0
|
||||
#endif
|
||||
|
||||
#ifndef __has_builtin
|
||||
#define __has_builtin(__x) 0
|
||||
#endif
|
||||
|
||||
#ifndef __has_extension
|
||||
#define __has_extension(__x) 0
|
||||
#endif
|
||||
|
||||
#ifndef __has_feature
|
||||
#define __has_feature(__x) 0
|
||||
#endif
|
||||
|
||||
#ifndef __has_cpp_attribute
|
||||
#define __has_cpp_attribute(__x) 0
|
||||
#endif
|
||||
|
||||
// '__is_identifier' returns '0' if '__x' is a reserved identifier provided by
|
||||
// the compiler and '1' otherwise.
|
||||
#ifndef __is_identifier
|
||||
#define __is_identifier(__x) 1
|
||||
#endif
|
||||
|
||||
#ifndef __has_declspec_attribute
|
||||
#define __has_declspec_attribute(__x) 0
|
||||
#endif
|
||||
|
||||
#define __has_keyword(__x) !(__is_identifier(__x))
|
||||
|
||||
#ifdef __has_include
|
||||
#define __libcpp_has_include(__x) __has_include(__x)
|
||||
#else
|
||||
#define __libcpp_has_include(__x) 0
|
||||
#ifndef __has_include
|
||||
#define __has_include(...) 0
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
@ -184,9 +204,11 @@
|
||||
// Need to detect which libc we're using if we're on Linux.
|
||||
#if defined(__linux__)
|
||||
# include <features.h>
|
||||
#if !defined(__GLIBC_PREREQ)
|
||||
#define __GLIBC_PREREQ(a, b) 0
|
||||
#endif // !defined(__GLIBC_PREREQ)
|
||||
# if defined(__GLIBC_PREREQ)
|
||||
# define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b)
|
||||
# else
|
||||
# define _LIBCPP_GLIBC_PREREQ(a, b) 0
|
||||
# endif // defined(__GLIBC_PREREQ)
|
||||
#endif // defined(__linux__)
|
||||
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
@ -245,6 +267,7 @@
|
||||
# if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__))
|
||||
# define _LIBCPP_HAS_BITSCAN64
|
||||
# endif
|
||||
# define _LIBCPP_HAS_OPEN_WITH_WCHAR
|
||||
# if defined(_LIBCPP_MSVCRT)
|
||||
# define _LIBCPP_HAS_QUICK_EXIT
|
||||
# endif
|
||||
@ -416,10 +439,10 @@ typedef __char32_t char32_t;
|
||||
# define _LIBCPP_HAS_C11_FEATURES
|
||||
# elif defined(__linux__)
|
||||
# if !defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
#if __GLIBC_PREREQ(2, 15) || defined(__BIONIC__)
|
||||
# if _LIBCPP_GLIBC_PREREQ(2, 15) || defined(__BIONIC__)
|
||||
# define _LIBCPP_HAS_QUICK_EXIT
|
||||
# endif
|
||||
#if __GLIBC_PREREQ(2, 17)
|
||||
# if _LIBCPP_GLIBC_PREREQ(2, 17)
|
||||
# define _LIBCPP_HAS_C11_FEATURES
|
||||
# endif
|
||||
# else // defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
@ -464,6 +487,12 @@ namespace std {
|
||||
#define _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER
|
||||
#endif
|
||||
|
||||
#if !__is_identifier(__has_unique_object_representations)
|
||||
#define _LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
|
||||
|
||||
#elif defined(_LIBCPP_COMPILER_GCC)
|
||||
|
||||
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
|
||||
@ -504,6 +533,7 @@ namespace std {
|
||||
#endif
|
||||
|
||||
#ifndef __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
@ -550,6 +580,12 @@ namespace std {
|
||||
#define _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER
|
||||
#endif
|
||||
|
||||
#if _GNUC_VER >= 700
|
||||
#define _LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
|
||||
|
||||
#elif defined(_LIBCPP_COMPILER_MSVC)
|
||||
|
||||
#define _LIBCPP_TOSTRING2(x) #x
|
||||
@ -564,25 +600,26 @@ namespace std {
|
||||
#define _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
|
||||
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
||||
#if _MSC_VER <= 1800
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#endif
|
||||
#define _LIBCPP_HAS_NO_NOEXCEPT
|
||||
#define __alignof__ __alignof
|
||||
#define _LIBCPP_NORETURN __declspec(noreturn)
|
||||
#define _ALIGNAS(x) __declspec(align(x))
|
||||
#define _ALIGNAS_TYPE(x) alignas(x)
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
|
||||
#define _LIBCPP_END_NAMESPACE_STD }
|
||||
#define _VSTD std
|
||||
|
||||
# define _LIBCPP_WEAK
|
||||
namespace std {
|
||||
}
|
||||
|
||||
#define _LIBCPP_WEAK
|
||||
|
||||
#define _LIBCPP_HAS_NO_ASAN
|
||||
|
||||
#define _LIBCPP_ALWAYS_INLINE __forceinline
|
||||
|
||||
#elif defined(_LIBCPP_COMPILER_IBM)
|
||||
|
||||
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
|
||||
@ -613,9 +650,32 @@ namespace std {
|
||||
|
||||
#define _LIBCPP_HAS_NO_ASAN
|
||||
|
||||
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
|
||||
|
||||
#endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM]
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD inline namespace __fs { namespace filesystem {
|
||||
#else
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD namespace __fs { namespace filesystem {
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_END_NAMESPACE_FILESYSTEM \
|
||||
_LIBCPP_END_NAMESPACE_STD } }
|
||||
|
||||
#define _VSTD_FS _VSTD::__fs::filesystem
|
||||
|
||||
|
||||
#if defined(_LIBCPP_OBJECT_FORMAT_COFF)
|
||||
|
||||
#ifdef _DLL
|
||||
# define _LIBCPP_CRT_FUNC __declspec(dllimport)
|
||||
#else
|
||||
# define _LIBCPP_CRT_FUNC
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
|
||||
# define _LIBCPP_DLL_VIS
|
||||
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
|
||||
@ -643,14 +703,11 @@ namespace std {
|
||||
#define _LIBCPP_ENUM_VIS
|
||||
|
||||
#if defined(_LIBCPP_COMPILER_MSVC)
|
||||
# define _LIBCPP_INLINE_VISIBILITY __forceinline
|
||||
# define _LIBCPP_ALWAYS_INLINE __forceinline
|
||||
# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __forceinline
|
||||
#else
|
||||
# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
|
||||
# define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
|
||||
# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__ ((__always_inline__))
|
||||
#endif
|
||||
|
||||
#endif // defined(_LIBCPP_OBJECT_FORMAT_COFF)
|
||||
|
||||
#ifndef _LIBCPP_HIDDEN
|
||||
@ -734,22 +791,19 @@ namespace std {
|
||||
#define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_INLINE_VISIBILITY
|
||||
#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
|
||||
#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
|
||||
#if __has_attribute(internal_linkage)
|
||||
# define _LIBCPP_INTERNAL_LINKAGE __attribute__ ((internal_linkage))
|
||||
#else
|
||||
#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
|
||||
#endif
|
||||
# define _LIBCPP_INTERNAL_LINKAGE _LIBCPP_ALWAYS_INLINE
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_ALWAYS_INLINE
|
||||
#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
|
||||
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
|
||||
#else
|
||||
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
|
||||
#endif
|
||||
#ifndef _LIBCPP_HIDE_FROM_ABI
|
||||
# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE
|
||||
#endif
|
||||
|
||||
// Just so we can migrate to _LIBCPP_HIDE_FROM_ABI gradually.
|
||||
#define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI
|
||||
|
||||
#ifndef _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
|
||||
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
|
||||
# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__visibility__("default"), __always_inline__))
|
||||
@ -776,8 +830,13 @@ namespace std {
|
||||
# if !defined(_LIBCPP_DEBUG)
|
||||
# error cannot use _LIBCPP_DEBUG_USE_EXCEPTIONS unless _LIBCPP_DEBUG is defined
|
||||
# endif
|
||||
# ifdef _LIBCPP_HAS_NO_NOEXCEPT
|
||||
# define _NOEXCEPT_DEBUG
|
||||
# define _NOEXCEPT_DEBUG_(x)
|
||||
# else
|
||||
# define _NOEXCEPT_DEBUG noexcept(false)
|
||||
# define _NOEXCEPT_DEBUG_(x) noexcept(false)
|
||||
# endif
|
||||
#else
|
||||
# define _NOEXCEPT_DEBUG _NOEXCEPT
|
||||
# define _NOEXCEPT_DEBUG_(x) _NOEXCEPT_(x)
|
||||
@ -855,9 +914,9 @@ template <unsigned> struct __static_assert_check {};
|
||||
# define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
|
||||
# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
|
||||
__lx __v_; \
|
||||
_LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \
|
||||
_LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
|
||||
_LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
|
||||
_LIBCPP_INLINE_VISIBILITY x(__lx __v) : __v_(__v) {} \
|
||||
_LIBCPP_INLINE_VISIBILITY explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
|
||||
_LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;} \
|
||||
};
|
||||
#else // _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
# define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_ENUM_VIS x
|
||||
@ -910,6 +969,12 @@ template <unsigned> struct __static_assert_check {};
|
||||
#define _DECLARE_C99_LDBL_MATH 1
|
||||
#endif
|
||||
|
||||
// If we are getting operator new from the MSVC CRT, then allocation overloads
|
||||
// for align_val_t were added in 19.12, aka VS 2017 version 15.3.
|
||||
#if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912
|
||||
#define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
|
||||
defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
|
||||
@ -922,6 +987,7 @@ template <unsigned> struct __static_assert_check {};
|
||||
# endif
|
||||
#endif // defined(__APPLE__)
|
||||
|
||||
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||
#define _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||
#endif
|
||||
@ -930,18 +996,6 @@ template <unsigned> struct __static_assert_check {};
|
||||
#define _LIBCPP_WCTYPE_IS_MASK
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_STD_VER
|
||||
# if __cplusplus <= 201103L
|
||||
# define _LIBCPP_STD_VER 11
|
||||
# elif __cplusplus <= 201402L
|
||||
# define _LIBCPP_STD_VER 14
|
||||
# elif __cplusplus <= 201703L
|
||||
# define _LIBCPP_STD_VER 17
|
||||
# else
|
||||
# define _LIBCPP_STD_VER 18 // current year, or date of c++2a ratification
|
||||
# endif
|
||||
#endif // _LIBCPP_STD_VER
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
# define _LIBCPP_DEPRECATED [[deprecated]]
|
||||
#else
|
||||
@ -980,9 +1034,10 @@ template <unsigned> struct __static_assert_check {};
|
||||
# define _LIBCPP_NODISCARD_AFTER_CXX17
|
||||
#endif
|
||||
|
||||
// FIXME: Remove all usages of this macro once compilers catch up.
|
||||
#if !defined(__cpp_inline_variables) || (__cpp_inline_variables < 201606L)
|
||||
# define _LIBCPP_HAS_NO_INLINE_VARIABLES
|
||||
#if _LIBCPP_STD_VER > 14 && defined(__cpp_inline_variables) && (__cpp_inline_variables >= 201606L)
|
||||
# define _LIBCPP_INLINE_VAR inline
|
||||
#else
|
||||
# define _LIBCPP_INLINE_VAR
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@ -991,6 +1046,14 @@ template <unsigned> struct __static_assert_check {};
|
||||
# define _LIBCPP_EXPLICIT_MOVE(x) (x)
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
#if defined(_LIBCPP_DEBUG) || defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
|
||||
#define _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
#else
|
||||
#define _LIBCPP_CONSTEXPR_IF_NODEBUG constexpr
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_ASAN
|
||||
_LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
const void *, const void *, const void *, const void *);
|
||||
@ -1000,8 +1063,10 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
// g++ and cl.exe have RTTI on by default and define a macro when it is.
|
||||
// g++ only defines the macro in 4.3.2 and onwards.
|
||||
#if !defined(_LIBCPP_NO_RTTI)
|
||||
# if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \
|
||||
(__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI)
|
||||
# if defined(__GNUC__) && \
|
||||
((__GNUC__ >= 5) || \
|
||||
(__GNUC__ == 4 && (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && \
|
||||
!defined(__GXX_RTTI)
|
||||
# define _LIBCPP_NO_RTTI
|
||||
# elif defined(_LIBCPP_COMPILER_MSVC) && !defined(_CPPRTTI)
|
||||
# define _LIBCPP_NO_RTTI
|
||||
@ -1024,7 +1089,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
defined(__APPLE__) || \
|
||||
defined(__CloudABI__) || \
|
||||
defined(__sun__) || \
|
||||
(defined(__MINGW32__) && __libcpp_has_include(<pthread.h>))
|
||||
(defined(__MINGW32__) && __has_include(<pthread.h>))
|
||||
# define _LIBCPP_HAS_THREAD_API_PTHREAD
|
||||
# elif defined(_LIBCPP_WIN32API)
|
||||
# define _LIBCPP_HAS_THREAD_API_WIN32
|
||||
@ -1159,6 +1224,11 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
#define _LIBCPP_HAS_NO_COROUTINES
|
||||
#endif
|
||||
|
||||
// FIXME: Correct this macro when either (A) a feature test macro for the
|
||||
// spaceship operator is provided, or (B) a compiler provides a complete
|
||||
// implementation.
|
||||
#define _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
|
||||
|
||||
// Decide whether to use availability macros.
|
||||
#if !defined(_LIBCPP_BUILDING_LIBRARY) && \
|
||||
!defined(_LIBCPP_DISABLE_AVAILABILITY) && \
|
||||
@ -1267,13 +1337,15 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
# endif
|
||||
#endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO)
|
||||
|
||||
#ifndef _LIBCPP_NO_AUTO_LINK
|
||||
# if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
# if defined(_DLL)
|
||||
# pragma(lib, "c++.lib")
|
||||
# pragma comment(lib, "c++.lib")
|
||||
# else
|
||||
# pragma(lib, "libc++.lib")
|
||||
# pragma comment(lib, "libc++.lib")
|
||||
# endif
|
||||
# endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
#endif // _LIBCPP_NO_AUTO_LINK
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#cmakedefine _LIBCPP_HAS_MUSL_LIBC
|
||||
#cmakedefine _LIBCPP_HAS_THREAD_API_PTHREAD
|
||||
#cmakedefine _LIBCPP_HAS_THREAD_API_EXTERNAL
|
||||
#cmakedefine _LIBCPP_HAS_THREAD_API_WIN32
|
||||
#cmakedefine _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL
|
||||
#cmakedefine _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
|
||||
#cmakedefine _LIBCPP_NO_VCRUNTIME
|
||||
|
218
include/__errc
Normal file
218
include/__errc
Normal file
@ -0,0 +1,218 @@
|
||||
// -*- C++ -*-
|
||||
//===---------------------------- __errc ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___ERRC
|
||||
#define _LIBCPP___ERRC
|
||||
|
||||
/*
|
||||
system_error synopsis
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
enum class errc
|
||||
{
|
||||
address_family_not_supported, // EAFNOSUPPORT
|
||||
address_in_use, // EADDRINUSE
|
||||
address_not_available, // EADDRNOTAVAIL
|
||||
already_connected, // EISCONN
|
||||
argument_list_too_long, // E2BIG
|
||||
argument_out_of_domain, // EDOM
|
||||
bad_address, // EFAULT
|
||||
bad_file_descriptor, // EBADF
|
||||
bad_message, // EBADMSG
|
||||
broken_pipe, // EPIPE
|
||||
connection_aborted, // ECONNABORTED
|
||||
connection_already_in_progress, // EALREADY
|
||||
connection_refused, // ECONNREFUSED
|
||||
connection_reset, // ECONNRESET
|
||||
cross_device_link, // EXDEV
|
||||
destination_address_required, // EDESTADDRREQ
|
||||
device_or_resource_busy, // EBUSY
|
||||
directory_not_empty, // ENOTEMPTY
|
||||
executable_format_error, // ENOEXEC
|
||||
file_exists, // EEXIST
|
||||
file_too_large, // EFBIG
|
||||
filename_too_long, // ENAMETOOLONG
|
||||
function_not_supported, // ENOSYS
|
||||
host_unreachable, // EHOSTUNREACH
|
||||
identifier_removed, // EIDRM
|
||||
illegal_byte_sequence, // EILSEQ
|
||||
inappropriate_io_control_operation, // ENOTTY
|
||||
interrupted, // EINTR
|
||||
invalid_argument, // EINVAL
|
||||
invalid_seek, // ESPIPE
|
||||
io_error, // EIO
|
||||
is_a_directory, // EISDIR
|
||||
message_size, // EMSGSIZE
|
||||
network_down, // ENETDOWN
|
||||
network_reset, // ENETRESET
|
||||
network_unreachable, // ENETUNREACH
|
||||
no_buffer_space, // ENOBUFS
|
||||
no_child_process, // ECHILD
|
||||
no_link, // ENOLINK
|
||||
no_lock_available, // ENOLCK
|
||||
no_message_available, // ENODATA
|
||||
no_message, // ENOMSG
|
||||
no_protocol_option, // ENOPROTOOPT
|
||||
no_space_on_device, // ENOSPC
|
||||
no_stream_resources, // ENOSR
|
||||
no_such_device_or_address, // ENXIO
|
||||
no_such_device, // ENODEV
|
||||
no_such_file_or_directory, // ENOENT
|
||||
no_such_process, // ESRCH
|
||||
not_a_directory, // ENOTDIR
|
||||
not_a_socket, // ENOTSOCK
|
||||
not_a_stream, // ENOSTR
|
||||
not_connected, // ENOTCONN
|
||||
not_enough_memory, // ENOMEM
|
||||
not_supported, // ENOTSUP
|
||||
operation_canceled, // ECANCELED
|
||||
operation_in_progress, // EINPROGRESS
|
||||
operation_not_permitted, // EPERM
|
||||
operation_not_supported, // EOPNOTSUPP
|
||||
operation_would_block, // EWOULDBLOCK
|
||||
owner_dead, // EOWNERDEAD
|
||||
permission_denied, // EACCES
|
||||
protocol_error, // EPROTO
|
||||
protocol_not_supported, // EPROTONOSUPPORT
|
||||
read_only_file_system, // EROFS
|
||||
resource_deadlock_would_occur, // EDEADLK
|
||||
resource_unavailable_try_again, // EAGAIN
|
||||
result_out_of_range, // ERANGE
|
||||
state_not_recoverable, // ENOTRECOVERABLE
|
||||
stream_timeout, // ETIME
|
||||
text_file_busy, // ETXTBSY
|
||||
timed_out, // ETIMEDOUT
|
||||
too_many_files_open_in_system, // ENFILE
|
||||
too_many_files_open, // EMFILE
|
||||
too_many_links, // EMLINK
|
||||
too_many_symbolic_link_levels, // ELOOP
|
||||
value_too_large, // EOVERFLOW
|
||||
wrong_protocol_type // EPROTOTYPE
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <cerrno>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// Some error codes are not present on all platforms, so we provide equivalents
|
||||
// for them:
|
||||
|
||||
//enum class errc
|
||||
_LIBCPP_DECLARE_STRONG_ENUM(errc)
|
||||
{
|
||||
address_family_not_supported = EAFNOSUPPORT,
|
||||
address_in_use = EADDRINUSE,
|
||||
address_not_available = EADDRNOTAVAIL,
|
||||
already_connected = EISCONN,
|
||||
argument_list_too_long = E2BIG,
|
||||
argument_out_of_domain = EDOM,
|
||||
bad_address = EFAULT,
|
||||
bad_file_descriptor = EBADF,
|
||||
bad_message = EBADMSG,
|
||||
broken_pipe = EPIPE,
|
||||
connection_aborted = ECONNABORTED,
|
||||
connection_already_in_progress = EALREADY,
|
||||
connection_refused = ECONNREFUSED,
|
||||
connection_reset = ECONNRESET,
|
||||
cross_device_link = EXDEV,
|
||||
destination_address_required = EDESTADDRREQ,
|
||||
device_or_resource_busy = EBUSY,
|
||||
directory_not_empty = ENOTEMPTY,
|
||||
executable_format_error = ENOEXEC,
|
||||
file_exists = EEXIST,
|
||||
file_too_large = EFBIG,
|
||||
filename_too_long = ENAMETOOLONG,
|
||||
function_not_supported = ENOSYS,
|
||||
host_unreachable = EHOSTUNREACH,
|
||||
identifier_removed = EIDRM,
|
||||
illegal_byte_sequence = EILSEQ,
|
||||
inappropriate_io_control_operation = ENOTTY,
|
||||
interrupted = EINTR,
|
||||
invalid_argument = EINVAL,
|
||||
invalid_seek = ESPIPE,
|
||||
io_error = EIO,
|
||||
is_a_directory = EISDIR,
|
||||
message_size = EMSGSIZE,
|
||||
network_down = ENETDOWN,
|
||||
network_reset = ENETRESET,
|
||||
network_unreachable = ENETUNREACH,
|
||||
no_buffer_space = ENOBUFS,
|
||||
no_child_process = ECHILD,
|
||||
no_link = ENOLINK,
|
||||
no_lock_available = ENOLCK,
|
||||
#ifdef ENODATA
|
||||
no_message_available = ENODATA,
|
||||
#else
|
||||
no_message_available = ENOMSG,
|
||||
#endif
|
||||
no_message = ENOMSG,
|
||||
no_protocol_option = ENOPROTOOPT,
|
||||
no_space_on_device = ENOSPC,
|
||||
#ifdef ENOSR
|
||||
no_stream_resources = ENOSR,
|
||||
#else
|
||||
no_stream_resources = ENOMEM,
|
||||
#endif
|
||||
no_such_device_or_address = ENXIO,
|
||||
no_such_device = ENODEV,
|
||||
no_such_file_or_directory = ENOENT,
|
||||
no_such_process = ESRCH,
|
||||
not_a_directory = ENOTDIR,
|
||||
not_a_socket = ENOTSOCK,
|
||||
#ifdef ENOSTR
|
||||
not_a_stream = ENOSTR,
|
||||
#else
|
||||
not_a_stream = EINVAL,
|
||||
#endif
|
||||
not_connected = ENOTCONN,
|
||||
not_enough_memory = ENOMEM,
|
||||
not_supported = ENOTSUP,
|
||||
operation_canceled = ECANCELED,
|
||||
operation_in_progress = EINPROGRESS,
|
||||
operation_not_permitted = EPERM,
|
||||
operation_not_supported = EOPNOTSUPP,
|
||||
operation_would_block = EWOULDBLOCK,
|
||||
owner_dead = EOWNERDEAD,
|
||||
permission_denied = EACCES,
|
||||
protocol_error = EPROTO,
|
||||
protocol_not_supported = EPROTONOSUPPORT,
|
||||
read_only_file_system = EROFS,
|
||||
resource_deadlock_would_occur = EDEADLK,
|
||||
resource_unavailable_try_again = EAGAIN,
|
||||
result_out_of_range = ERANGE,
|
||||
state_not_recoverable = ENOTRECOVERABLE,
|
||||
#ifdef ETIME
|
||||
stream_timeout = ETIME,
|
||||
#else
|
||||
stream_timeout = ETIMEDOUT,
|
||||
#endif
|
||||
text_file_busy = ETXTBSY,
|
||||
timed_out = ETIMEDOUT,
|
||||
too_many_files_open_in_system = ENFILE,
|
||||
too_many_files_open = EMFILE,
|
||||
too_many_links = EMLINK,
|
||||
too_many_symbolic_link_levels = ELOOP,
|
||||
value_too_large = EOVERFLOW,
|
||||
wrong_protocol_type = EPROTOTYPE
|
||||
};
|
||||
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(errc)
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___ERRC
|
@ -600,7 +600,10 @@ template<class _Rp>
|
||||
function<_Rp()>&
|
||||
function<_Rp()>::operator=(const function& __f)
|
||||
{
|
||||
if (__f)
|
||||
function(__f).swap(*this);
|
||||
else
|
||||
*this = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -608,11 +611,12 @@ template<class _Rp>
|
||||
function<_Rp()>&
|
||||
function<_Rp()>::operator=(nullptr_t)
|
||||
{
|
||||
if (__f_ == (__base*)&__buf_)
|
||||
__f_->destroy();
|
||||
else if (__f_)
|
||||
__f_->destroy_deallocate();
|
||||
__base* __t = __f_;
|
||||
__f_ = 0;
|
||||
if (__t == (__base*)&__buf_)
|
||||
__t->destroy();
|
||||
else if (__t)
|
||||
__t->destroy_deallocate();
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -876,7 +880,10 @@ template<class _Rp, class _A0>
|
||||
function<_Rp(_A0)>&
|
||||
function<_Rp(_A0)>::operator=(const function& __f)
|
||||
{
|
||||
if (__f)
|
||||
function(__f).swap(*this);
|
||||
else
|
||||
*this = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -884,11 +891,12 @@ template<class _Rp, class _A0>
|
||||
function<_Rp(_A0)>&
|
||||
function<_Rp(_A0)>::operator=(nullptr_t)
|
||||
{
|
||||
if (__f_ == (__base*)&__buf_)
|
||||
__f_->destroy();
|
||||
else if (__f_)
|
||||
__f_->destroy_deallocate();
|
||||
__base* __t = __f_;
|
||||
__f_ = 0;
|
||||
if (__t == (__base*)&__buf_)
|
||||
__t->destroy();
|
||||
else if (__t)
|
||||
__t->destroy_deallocate();
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -1152,7 +1160,10 @@ template<class _Rp, class _A0, class _A1>
|
||||
function<_Rp(_A0, _A1)>&
|
||||
function<_Rp(_A0, _A1)>::operator=(const function& __f)
|
||||
{
|
||||
if (__f)
|
||||
function(__f).swap(*this);
|
||||
else
|
||||
*this = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -1160,11 +1171,12 @@ template<class _Rp, class _A0, class _A1>
|
||||
function<_Rp(_A0, _A1)>&
|
||||
function<_Rp(_A0, _A1)>::operator=(nullptr_t)
|
||||
{
|
||||
if (__f_ == (__base*)&__buf_)
|
||||
__f_->destroy();
|
||||
else if (__f_)
|
||||
__f_->destroy_deallocate();
|
||||
__base* __t = __f_;
|
||||
__f_ = 0;
|
||||
if (__t == (__base*)&__buf_)
|
||||
__t->destroy();
|
||||
else if (__t)
|
||||
__t->destroy_deallocate();
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -1428,7 +1440,10 @@ template<class _Rp, class _A0, class _A1, class _A2>
|
||||
function<_Rp(_A0, _A1, _A2)>&
|
||||
function<_Rp(_A0, _A1, _A2)>::operator=(const function& __f)
|
||||
{
|
||||
if (__f)
|
||||
function(__f).swap(*this);
|
||||
else
|
||||
*this = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -1436,11 +1451,12 @@ template<class _Rp, class _A0, class _A1, class _A2>
|
||||
function<_Rp(_A0, _A1, _A2)>&
|
||||
function<_Rp(_A0, _A1, _A2)>::operator=(nullptr_t)
|
||||
{
|
||||
if (__f_ == (__base*)&__buf_)
|
||||
__f_->destroy();
|
||||
else if (__f_)
|
||||
__f_->destroy_deallocate();
|
||||
__base* __t = __f_;
|
||||
__f_ = 0;
|
||||
if (__t == (__base*)&__buf_)
|
||||
__t->destroy();
|
||||
else if (__t)
|
||||
__t->destroy_deallocate();
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -564,7 +564,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { };
|
||||
#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_MEMORY)
|
||||
extern const allocator_arg_t allocator_arg;
|
||||
#else
|
||||
constexpr allocator_arg_t allocator_arg = allocator_arg_t();
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr allocator_arg_t allocator_arg = allocator_arg_t();
|
||||
#endif
|
||||
|
||||
// uses_allocator
|
||||
@ -601,7 +601,7 @@ struct _LIBCPP_TEMPLATE_VIS uses_allocator
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
template <class _Tp, class _Alloc>
|
||||
constexpr size_t uses_allocator_v = uses_allocator<_Tp, _Alloc>::value;
|
||||
_LIBCPP_INLINE_VAR constexpr size_t uses_allocator_v = uses_allocator<_Tp, _Alloc>::value;
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
@ -646,16 +646,6 @@ void __user_alloc_construct_impl (integral_constant<int, 2>, _Tp *__storage, con
|
||||
new (__storage) _Tp (_VSTD::forward<_Args>(__args)..., __a);
|
||||
}
|
||||
|
||||
// FIXME: Theis should have a version which takes a non-const alloc.
|
||||
template <class _Tp, class _Allocator, class... _Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void __user_alloc_construct (_Tp *__storage, const _Allocator &__a, _Args &&... __args)
|
||||
{
|
||||
__user_alloc_construct_impl(
|
||||
__uses_alloc_ctor<_Tp, _Allocator>(),
|
||||
__storage, __a, _VSTD::forward<_Args>(__args)...
|
||||
);
|
||||
}
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
@ -32,13 +32,8 @@ _LIBCPP_PUSH_MACROS
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Key, class _Tp>
|
||||
union __hash_value_type;
|
||||
#else
|
||||
template <class _Key, class _Tp>
|
||||
struct __hash_value_type;
|
||||
#endif
|
||||
|
||||
template <class _Key, class _Cp, class _Hash,
|
||||
bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value>
|
||||
@ -184,7 +179,6 @@ struct __hash_key_value_types<__hash_value_type<_Key, _Tp> > {
|
||||
typedef _Tp mapped_type;
|
||||
typedef __hash_value_type<_Key, _Tp> __node_value_type;
|
||||
typedef pair<const _Key, _Tp> __container_value_type;
|
||||
typedef pair<_Key, _Tp> __nc_value_type;
|
||||
typedef __container_value_type __map_value_type;
|
||||
static const bool __is_map = true;
|
||||
|
||||
@ -198,7 +192,7 @@ struct __hash_key_value_types<__hash_value_type<_Key, _Tp> > {
|
||||
static typename enable_if<__is_same_uncvref<_Up, __node_value_type>::value,
|
||||
__container_value_type const&>::type
|
||||
__get_value(_Up& __t) {
|
||||
return __t.__cc;
|
||||
return __t.__get_value();
|
||||
}
|
||||
|
||||
template <class _Up>
|
||||
@ -211,12 +205,12 @@ struct __hash_key_value_types<__hash_value_type<_Key, _Tp> > {
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static __container_value_type* __get_ptr(__node_value_type& __n) {
|
||||
return _VSTD::addressof(__n.__cc);
|
||||
return _VSTD::addressof(__n.__get_value());
|
||||
}
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static __nc_value_type&& __move(__node_value_type& __v) {
|
||||
return _VSTD::move(__v.__nc);
|
||||
static pair<key_type&&, mapped_type&&> __move(__node_value_type& __v) {
|
||||
return __v.__move();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1 +1 @@
|
||||
6000
|
||||
7000
|
||||
|
172
include/__locale
172
include/__locale
@ -24,11 +24,7 @@
|
||||
#elif defined(_AIX)
|
||||
# include <support/ibm/xlocale.h>
|
||||
#elif defined(__ANDROID__)
|
||||
// Android gained the locale aware functions in L (API level 21)
|
||||
# include <android/api-level.h>
|
||||
# if __ANDROID_API__ <= 20
|
||||
# include <support/android/locale_bionic.h>
|
||||
# endif
|
||||
#elif defined(__sun__)
|
||||
# include <xlocale.h>
|
||||
# include <support/solaris/xlocale.h>
|
||||
@ -473,7 +469,7 @@ public:
|
||||
static const mask alnum = alpha | digit;
|
||||
static const mask graph = alnum | punct;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE ctype_base() {}
|
||||
_LIBCPP_INLINE_VISIBILITY ctype_base() {}
|
||||
};
|
||||
|
||||
template <class _CharT> class _LIBCPP_TEMPLATE_VIS ctype;
|
||||
@ -486,77 +482,77 @@ class _LIBCPP_TYPE_VIS ctype<wchar_t>
|
||||
public:
|
||||
typedef wchar_t char_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit ctype(size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is(mask __m, char_type __c) const
|
||||
{
|
||||
return do_is(__m, __c);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
|
||||
{
|
||||
return do_is(__low, __high, __vec);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const char_type* scan_is(mask __m, const char_type* __low, const char_type* __high) const
|
||||
{
|
||||
return do_scan_is(__m, __low, __high);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
|
||||
{
|
||||
return do_scan_not(__m, __low, __high);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char_type toupper(char_type __c) const
|
||||
{
|
||||
return do_toupper(__c);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const char_type* toupper(char_type* __low, const char_type* __high) const
|
||||
{
|
||||
return do_toupper(__low, __high);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char_type tolower(char_type __c) const
|
||||
{
|
||||
return do_tolower(__c);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const char_type* tolower(char_type* __low, const char_type* __high) const
|
||||
{
|
||||
return do_tolower(__low, __high);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char_type widen(char __c) const
|
||||
{
|
||||
return do_widen(__c);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const char* widen(const char* __low, const char* __high, char_type* __to) const
|
||||
{
|
||||
return do_widen(__low, __high, __to);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char narrow(char_type __c, char __dfault) const
|
||||
{
|
||||
return do_narrow(__c, __dfault);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const char_type* narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const
|
||||
{
|
||||
return do_narrow(__low, __high, __dfault, __to);
|
||||
@ -591,13 +587,13 @@ public:
|
||||
|
||||
explicit ctype(const mask* __tab = 0, bool __del = false, size_t __refs = 0);
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is(mask __m, char_type __c) const
|
||||
{
|
||||
return isascii(__c) ? (__tab_[static_cast<int>(__c)] & __m) !=0 : false;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
|
||||
{
|
||||
for (; __low != __high; ++__low, ++__vec)
|
||||
@ -605,7 +601,7 @@ public:
|
||||
return __low;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const
|
||||
{
|
||||
for (; __low != __high; ++__low)
|
||||
@ -614,7 +610,7 @@ public:
|
||||
return __low;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
|
||||
{
|
||||
for (; __low != __high; ++__low)
|
||||
@ -623,49 +619,49 @@ public:
|
||||
return __low;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char_type toupper(char_type __c) const
|
||||
{
|
||||
return do_toupper(__c);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const char_type* toupper(char_type* __low, const char_type* __high) const
|
||||
{
|
||||
return do_toupper(__low, __high);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char_type tolower(char_type __c) const
|
||||
{
|
||||
return do_tolower(__c);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const char_type* tolower(char_type* __low, const char_type* __high) const
|
||||
{
|
||||
return do_tolower(__low, __high);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char_type widen(char __c) const
|
||||
{
|
||||
return do_widen(__c);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const char* widen(const char* __low, const char* __high, char_type* __to) const
|
||||
{
|
||||
return do_widen(__low, __high, __to);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char narrow(char_type __c, char __dfault) const
|
||||
{
|
||||
return do_narrow(__c, __dfault);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const char* narrow(const char_type* __low, const char_type* __high, char __dfault, char* __to) const
|
||||
{
|
||||
return do_narrow(__low, __high, __dfault, __to);
|
||||
@ -678,7 +674,7 @@ public:
|
||||
#else
|
||||
static const size_t table_size = 256; // FIXME: Don't hardcode this.
|
||||
#endif
|
||||
_LIBCPP_ALWAYS_INLINE const mask* table() const _NOEXCEPT {return __tab_;}
|
||||
_LIBCPP_INLINE_VISIBILITY const mask* table() const _NOEXCEPT {return __tab_;}
|
||||
static const mask* classic_table() _NOEXCEPT;
|
||||
#if defined(__GLIBC__) || defined(__EMSCRIPTEN__)
|
||||
static const int* __classic_upper_table() _NOEXCEPT;
|
||||
@ -858,7 +854,7 @@ tolower(_CharT __c, const locale& __loc)
|
||||
class _LIBCPP_TYPE_VIS codecvt_base
|
||||
{
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE codecvt_base() {}
|
||||
_LIBCPP_INLINE_VISIBILITY codecvt_base() {}
|
||||
enum result {ok, partial, error, noconv};
|
||||
};
|
||||
|
||||
@ -878,11 +874,11 @@ public:
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit codecvt(size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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
|
||||
@ -890,14 +886,14 @@ public:
|
||||
return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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
|
||||
@ -905,25 +901,25 @@ public:
|
||||
return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int encoding() const _NOEXCEPT
|
||||
{
|
||||
return do_encoding();
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool always_noconv() const _NOEXCEPT
|
||||
{
|
||||
return do_always_noconv();
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
|
||||
{
|
||||
return do_length(__st, __frm, __end, __mx);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int max_length() const _NOEXCEPT
|
||||
{
|
||||
return do_max_length();
|
||||
@ -932,7 +928,7 @@ public:
|
||||
static locale::id id;
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit codecvt(const char*, size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
|
||||
@ -967,7 +963,7 @@ public:
|
||||
|
||||
explicit codecvt(size_t __refs = 0);
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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
|
||||
@ -975,14 +971,14 @@ public:
|
||||
return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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
|
||||
@ -990,25 +986,25 @@ public:
|
||||
return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int encoding() const _NOEXCEPT
|
||||
{
|
||||
return do_encoding();
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool always_noconv() const _NOEXCEPT
|
||||
{
|
||||
return do_always_noconv();
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
|
||||
{
|
||||
return do_length(__st, __frm, __end, __mx);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int max_length() const _NOEXCEPT
|
||||
{
|
||||
return do_max_length();
|
||||
@ -1047,11 +1043,11 @@ public:
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit codecvt(size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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
|
||||
@ -1059,14 +1055,14 @@ public:
|
||||
return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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
|
||||
@ -1074,25 +1070,25 @@ public:
|
||||
return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int encoding() const _NOEXCEPT
|
||||
{
|
||||
return do_encoding();
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool always_noconv() const _NOEXCEPT
|
||||
{
|
||||
return do_always_noconv();
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
|
||||
{
|
||||
return do_length(__st, __frm, __end, __mx);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int max_length() const _NOEXCEPT
|
||||
{
|
||||
return do_max_length();
|
||||
@ -1101,7 +1097,7 @@ public:
|
||||
static locale::id id;
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit codecvt(const char*, size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
|
||||
@ -1133,11 +1129,11 @@ public:
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit codecvt(size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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
|
||||
@ -1145,14 +1141,14 @@ public:
|
||||
return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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
|
||||
@ -1160,25 +1156,25 @@ public:
|
||||
return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int encoding() const _NOEXCEPT
|
||||
{
|
||||
return do_encoding();
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool always_noconv() const _NOEXCEPT
|
||||
{
|
||||
return do_always_noconv();
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
|
||||
{
|
||||
return do_length(__st, __frm, __end, __mx);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int max_length() const _NOEXCEPT
|
||||
{
|
||||
return do_max_length();
|
||||
@ -1187,7 +1183,7 @@ public:
|
||||
static locale::id id;
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit codecvt(const char*, size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
|
||||
@ -1214,10 +1210,10 @@ class _LIBCPP_TEMPLATE_VIS codecvt_byname
|
||||
: public codecvt<_InternT, _ExternT, _StateT>
|
||||
{
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit codecvt_byname(const char* __nm, size_t __refs = 0)
|
||||
: codecvt<_InternT, _ExternT, _StateT>(__nm, __refs) {}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit codecvt_byname(const string& __nm, size_t __refs = 0)
|
||||
: codecvt<_InternT, _ExternT, _StateT>(__nm.c_str(), __refs) {}
|
||||
protected:
|
||||
@ -1248,7 +1244,7 @@ template <>
|
||||
struct __narrow_to_utf8<8>
|
||||
{
|
||||
template <class _OutputIterator, class _CharT>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_OutputIterator
|
||||
operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const
|
||||
{
|
||||
@ -1262,13 +1258,13 @@ template <>
|
||||
struct __narrow_to_utf8<16>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
{
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__narrow_to_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
|
||||
|
||||
~__narrow_to_utf8();
|
||||
|
||||
template <class _OutputIterator, class _CharT>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_OutputIterator
|
||||
operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const
|
||||
{
|
||||
@ -1296,13 +1292,13 @@ template <>
|
||||
struct __narrow_to_utf8<32>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
{
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__narrow_to_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
|
||||
|
||||
~__narrow_to_utf8();
|
||||
|
||||
template <class _OutputIterator, class _CharT>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_OutputIterator
|
||||
operator()(_OutputIterator __s, const _CharT* __wb, const _CharT* __we) const
|
||||
{
|
||||
@ -1338,7 +1334,7 @@ template <>
|
||||
struct __widen_from_utf8<8>
|
||||
{
|
||||
template <class _OutputIterator>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_OutputIterator
|
||||
operator()(_OutputIterator __s, const char* __nb, const char* __ne) const
|
||||
{
|
||||
@ -1352,13 +1348,13 @@ template <>
|
||||
struct __widen_from_utf8<16>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
{
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__widen_from_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
|
||||
|
||||
~__widen_from_utf8();
|
||||
|
||||
template <class _OutputIterator>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_OutputIterator
|
||||
operator()(_OutputIterator __s, const char* __nb, const char* __ne) const
|
||||
{
|
||||
@ -1386,13 +1382,13 @@ template <>
|
||||
struct __widen_from_utf8<32>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
{
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__widen_from_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
|
||||
|
||||
~__widen_from_utf8();
|
||||
|
||||
template <class _OutputIterator>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_OutputIterator
|
||||
operator()(_OutputIterator __s, const char* __nb, const char* __ne) const
|
||||
{
|
||||
@ -1430,11 +1426,11 @@ public:
|
||||
|
||||
explicit numpunct(size_t __refs = 0);
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE char_type decimal_point() const {return do_decimal_point();}
|
||||
_LIBCPP_ALWAYS_INLINE char_type thousands_sep() const {return do_thousands_sep();}
|
||||
_LIBCPP_ALWAYS_INLINE string grouping() const {return do_grouping();}
|
||||
_LIBCPP_ALWAYS_INLINE string_type truename() const {return do_truename();}
|
||||
_LIBCPP_ALWAYS_INLINE string_type falsename() const {return do_falsename();}
|
||||
_LIBCPP_INLINE_VISIBILITY char_type decimal_point() const {return do_decimal_point();}
|
||||
_LIBCPP_INLINE_VISIBILITY char_type thousands_sep() const {return do_thousands_sep();}
|
||||
_LIBCPP_INLINE_VISIBILITY string grouping() const {return do_grouping();}
|
||||
_LIBCPP_INLINE_VISIBILITY string_type truename() const {return do_truename();}
|
||||
_LIBCPP_INLINE_VISIBILITY string_type falsename() const {return do_falsename();}
|
||||
|
||||
static locale::id id;
|
||||
|
||||
@ -1461,11 +1457,11 @@ public:
|
||||
|
||||
explicit numpunct(size_t __refs = 0);
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE char_type decimal_point() const {return do_decimal_point();}
|
||||
_LIBCPP_ALWAYS_INLINE char_type thousands_sep() const {return do_thousands_sep();}
|
||||
_LIBCPP_ALWAYS_INLINE string grouping() const {return do_grouping();}
|
||||
_LIBCPP_ALWAYS_INLINE string_type truename() const {return do_truename();}
|
||||
_LIBCPP_ALWAYS_INLINE string_type falsename() const {return do_falsename();}
|
||||
_LIBCPP_INLINE_VISIBILITY char_type decimal_point() const {return do_decimal_point();}
|
||||
_LIBCPP_INLINE_VISIBILITY char_type thousands_sep() const {return do_thousands_sep();}
|
||||
_LIBCPP_INLINE_VISIBILITY string grouping() const {return do_grouping();}
|
||||
_LIBCPP_INLINE_VISIBILITY string_type truename() const {return do_truename();}
|
||||
_LIBCPP_INLINE_VISIBILITY string_type falsename() const {return do_falsename();}
|
||||
|
||||
static locale::id id;
|
||||
|
||||
|
@ -82,9 +82,9 @@ extern const adopt_lock_t adopt_lock;
|
||||
|
||||
#else
|
||||
|
||||
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();
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr defer_lock_t defer_lock = defer_lock_t();
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr try_to_lock_t try_to_lock = try_to_lock_t();
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr adopt_lock_t adopt_lock = adopt_lock_t();
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -27,24 +27,24 @@ struct _LIBCPP_TEMPLATE_VIS nullptr_t
|
||||
|
||||
struct __nat {int __for_bool_;};
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {}
|
||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
operator _Tp* () const {return 0;}
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
operator _Tp _Up::* () const {return 0;}
|
||||
|
||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;}
|
||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;}
|
||||
friend _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;}
|
||||
friend _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;}
|
||||
};
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);}
|
||||
|
||||
#define nullptr _VSTD::__get_nullptr_t()
|
||||
|
||||
|
@ -55,14 +55,14 @@ public:
|
||||
__allocated_ = true;
|
||||
return (pointer)&buf_;
|
||||
}
|
||||
return static_cast<pointer>(_VSTD::__allocate(__n * sizeof(_Tp)));
|
||||
return static_cast<pointer>(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), __alignof(_Tp)));
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type)
|
||||
{
|
||||
if (__p == (pointer)&buf_)
|
||||
__allocated_ = false;
|
||||
else
|
||||
_VSTD::__libcpp_deallocate(__p);
|
||||
_VSTD::__libcpp_deallocate(__p, __alignof(_Tp));
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);}
|
||||
|
||||
|
@ -266,7 +266,7 @@ const char*
|
||||
char_traits<char>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT
|
||||
{
|
||||
if (__n == 0)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#if __has_feature(cxx_constexpr_string_builtins)
|
||||
return __builtin_char_memchr(__s, to_int_type(__a), __n);
|
||||
#elif _LIBCPP_STD_VER <= 14
|
||||
@ -278,7 +278,7 @@ char_traits<char>::find(const char_type* __s, size_t __n, const char_type& __a)
|
||||
return __s;
|
||||
++__s;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -372,7 +372,7 @@ const wchar_t*
|
||||
char_traits<wchar_t>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT
|
||||
{
|
||||
if (__n == 0)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#if __has_feature(cxx_constexpr_string_builtins)
|
||||
return __builtin_wmemchr(__s, __a, __n);
|
||||
#elif _LIBCPP_STD_VER <= 14
|
||||
@ -384,7 +384,7 @@ char_traits<wchar_t>::find(const char_type* __s, size_t __n, const char_type& __
|
||||
return __s;
|
||||
++__s;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -26,18 +26,14 @@
|
||||
#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
|
||||
# include <pthread.h>
|
||||
# include <sched.h>
|
||||
#elif defined(_LIBCPP_HAS_THREAD_API_WIN32)
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
#include <fibersapi.h>
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
|
||||
#if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
|
||||
defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL)
|
||||
defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL) || \
|
||||
defined(_LIBCPP_HAS_THREAD_API_WIN32)
|
||||
#define _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_FUNC_VIS
|
||||
#else
|
||||
#define _LIBCPP_THREAD_ABI_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
|
||||
@ -80,31 +76,37 @@ typedef pthread_key_t __libcpp_tls_key;
|
||||
#define _LIBCPP_TLS_DESTRUCTOR_CC
|
||||
#else
|
||||
// Mutex
|
||||
typedef SRWLOCK __libcpp_mutex_t;
|
||||
#define _LIBCPP_MUTEX_INITIALIZER SRWLOCK_INIT
|
||||
typedef void* __libcpp_mutex_t;
|
||||
#define _LIBCPP_MUTEX_INITIALIZER 0
|
||||
|
||||
typedef CRITICAL_SECTION __libcpp_recursive_mutex_t;
|
||||
#if defined(_M_IX86) || defined(__i386__) || defined(_M_ARM) || defined(__arm__)
|
||||
typedef void* __libcpp_recursive_mutex_t[6];
|
||||
#elif defined(_M_AMD64) || defined(__x86_64__) || defined(_M_ARM64) || defined(__aarch64__)
|
||||
typedef void* __libcpp_recursive_mutex_t[5];
|
||||
#else
|
||||
# error Unsupported architecture
|
||||
#endif
|
||||
|
||||
// Condition Variable
|
||||
typedef CONDITION_VARIABLE __libcpp_condvar_t;
|
||||
#define _LIBCPP_CONDVAR_INITIALIZER CONDITION_VARIABLE_INIT
|
||||
typedef void* __libcpp_condvar_t;
|
||||
#define _LIBCPP_CONDVAR_INITIALIZER 0
|
||||
|
||||
// Execute Once
|
||||
typedef INIT_ONCE __libcpp_exec_once_flag;
|
||||
#define _LIBCPP_EXEC_ONCE_INITIALIZER INIT_ONCE_STATIC_INIT
|
||||
typedef void* __libcpp_exec_once_flag;
|
||||
#define _LIBCPP_EXEC_ONCE_INITIALIZER 0
|
||||
|
||||
// Thread ID
|
||||
typedef DWORD __libcpp_thread_id;
|
||||
typedef long __libcpp_thread_id;
|
||||
|
||||
// Thread
|
||||
#define _LIBCPP_NULL_THREAD 0U
|
||||
|
||||
typedef HANDLE __libcpp_thread_t;
|
||||
typedef void* __libcpp_thread_t;
|
||||
|
||||
// Thread Local Storage
|
||||
typedef DWORD __libcpp_tls_key;
|
||||
typedef long __libcpp_tls_key;
|
||||
|
||||
#define _LIBCPP_TLS_DESTRUCTOR_CC WINAPI
|
||||
#define _LIBCPP_TLS_DESTRUCTOR_CC __stdcall
|
||||
#endif
|
||||
|
||||
// Mutex
|
||||
@ -201,10 +203,9 @@ void *__libcpp_tls_get(__libcpp_tls_key __key);
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
int __libcpp_tls_set(__libcpp_tls_key __key, void *__p);
|
||||
|
||||
#if !defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
|
||||
defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL)
|
||||
|
||||
#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
|
||||
#if (!defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
|
||||
defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL)) && \
|
||||
defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
|
||||
|
||||
int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m)
|
||||
{
|
||||
@ -390,244 +391,6 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p)
|
||||
return pthread_setspecific(__key, __p);
|
||||
}
|
||||
|
||||
#elif defined(_LIBCPP_HAS_THREAD_API_WIN32)
|
||||
|
||||
// Mutex
|
||||
int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m)
|
||||
{
|
||||
InitializeCriticalSection(__m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m)
|
||||
{
|
||||
EnterCriticalSection(__m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m)
|
||||
{
|
||||
return TryEnterCriticalSection(__m) != 0;
|
||||
}
|
||||
|
||||
int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t *__m)
|
||||
{
|
||||
LeaveCriticalSection(__m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t *__m)
|
||||
{
|
||||
DeleteCriticalSection(__m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_mutex_lock(__libcpp_mutex_t *__m)
|
||||
{
|
||||
AcquireSRWLockExclusive(__m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m)
|
||||
{
|
||||
return TryAcquireSRWLockExclusive(__m) != 0;
|
||||
}
|
||||
|
||||
int __libcpp_mutex_unlock(__libcpp_mutex_t *__m)
|
||||
{
|
||||
ReleaseSRWLockExclusive(__m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_mutex_destroy(__libcpp_mutex_t *__m)
|
||||
{
|
||||
static_cast<void>(__m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Condition Variable
|
||||
int __libcpp_condvar_signal(__libcpp_condvar_t *__cv)
|
||||
{
|
||||
WakeConditionVariable(__cv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_condvar_broadcast(__libcpp_condvar_t *__cv)
|
||||
{
|
||||
WakeAllConditionVariable(__cv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_condvar_wait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m)
|
||||
{
|
||||
SleepConditionVariableSRW(__cv, __m, INFINITE, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,
|
||||
timespec *__ts)
|
||||
{
|
||||
using namespace _VSTD::chrono;
|
||||
|
||||
auto duration = seconds(__ts->tv_sec) + nanoseconds(__ts->tv_nsec);
|
||||
auto abstime =
|
||||
system_clock::time_point(duration_cast<system_clock::duration>(duration));
|
||||
auto timeout_ms = duration_cast<milliseconds>(abstime - system_clock::now());
|
||||
|
||||
if (!SleepConditionVariableSRW(__cv, __m,
|
||||
timeout_ms.count() > 0 ? timeout_ms.count()
|
||||
: 0,
|
||||
0))
|
||||
{
|
||||
auto __ec = GetLastError();
|
||||
return __ec == ERROR_TIMEOUT ? ETIMEDOUT : __ec;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_condvar_destroy(__libcpp_condvar_t *__cv)
|
||||
{
|
||||
static_cast<void>(__cv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Execute Once
|
||||
static inline _LIBCPP_ALWAYS_INLINE BOOL CALLBACK
|
||||
__libcpp_init_once_execute_once_thunk(PINIT_ONCE __init_once, PVOID __parameter,
|
||||
PVOID *__context)
|
||||
{
|
||||
static_cast<void>(__init_once);
|
||||
static_cast<void>(__context);
|
||||
|
||||
void (*init_routine)(void) = reinterpret_cast<void (*)(void)>(__parameter);
|
||||
init_routine();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int __libcpp_execute_once(__libcpp_exec_once_flag *__flag,
|
||||
void (*__init_routine)(void))
|
||||
{
|
||||
if (!InitOnceExecuteOnce(__flag, __libcpp_init_once_execute_once_thunk,
|
||||
reinterpret_cast<void *>(__init_routine), NULL))
|
||||
return GetLastError();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Thread ID
|
||||
bool __libcpp_thread_id_equal(__libcpp_thread_id __lhs,
|
||||
__libcpp_thread_id __rhs)
|
||||
{
|
||||
return __lhs == __rhs;
|
||||
}
|
||||
|
||||
bool __libcpp_thread_id_less(__libcpp_thread_id __lhs, __libcpp_thread_id __rhs)
|
||||
{
|
||||
return __lhs < __rhs;
|
||||
}
|
||||
|
||||
// Thread
|
||||
struct __libcpp_beginthreadex_thunk_data
|
||||
{
|
||||
void *(*__func)(void *);
|
||||
void *__arg;
|
||||
};
|
||||
|
||||
static inline _LIBCPP_ALWAYS_INLINE unsigned WINAPI
|
||||
__libcpp_beginthreadex_thunk(void *__raw_data)
|
||||
{
|
||||
auto *__data =
|
||||
static_cast<__libcpp_beginthreadex_thunk_data *>(__raw_data);
|
||||
auto *__func = __data->__func;
|
||||
void *__arg = __data->__arg;
|
||||
delete __data;
|
||||
return static_cast<unsigned>(reinterpret_cast<uintptr_t>(__func(__arg)));
|
||||
}
|
||||
|
||||
bool __libcpp_thread_isnull(const __libcpp_thread_t *__t) {
|
||||
return *__t == 0;
|
||||
}
|
||||
|
||||
int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
|
||||
void *__arg)
|
||||
{
|
||||
auto *__data = new __libcpp_beginthreadex_thunk_data;
|
||||
__data->__func = __func;
|
||||
__data->__arg = __arg;
|
||||
|
||||
*__t = reinterpret_cast<HANDLE>(_beginthreadex(nullptr, 0,
|
||||
__libcpp_beginthreadex_thunk,
|
||||
__data, 0, nullptr));
|
||||
|
||||
if (*__t)
|
||||
return 0;
|
||||
return GetLastError();
|
||||
}
|
||||
|
||||
__libcpp_thread_id __libcpp_thread_get_current_id()
|
||||
{
|
||||
return GetCurrentThreadId();
|
||||
}
|
||||
|
||||
__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t)
|
||||
{
|
||||
return GetThreadId(*__t);
|
||||
}
|
||||
|
||||
int __libcpp_thread_join(__libcpp_thread_t *__t)
|
||||
{
|
||||
if (WaitForSingleObjectEx(*__t, INFINITE, FALSE) == WAIT_FAILED)
|
||||
return GetLastError();
|
||||
if (!CloseHandle(*__t))
|
||||
return GetLastError();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_thread_detach(__libcpp_thread_t *__t)
|
||||
{
|
||||
if (!CloseHandle(*__t))
|
||||
return GetLastError();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __libcpp_thread_yield()
|
||||
{
|
||||
SwitchToThread();
|
||||
}
|
||||
|
||||
void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns)
|
||||
{
|
||||
using namespace chrono;
|
||||
// round-up to the nearest milisecond
|
||||
milliseconds __ms =
|
||||
duration_cast<milliseconds>(__ns + chrono::nanoseconds(999999));
|
||||
// FIXME(compnerd) this should be an alertable sleep (WFSO or SleepEx)
|
||||
Sleep(__ms.count());
|
||||
}
|
||||
|
||||
// Thread Local Storage
|
||||
int __libcpp_tls_create(__libcpp_tls_key* __key,
|
||||
void(_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void*))
|
||||
{
|
||||
*__key = FlsAlloc(__at_exit);
|
||||
if (*__key == FLS_OUT_OF_INDEXES)
|
||||
return GetLastError();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *__libcpp_tls_get(__libcpp_tls_key __key)
|
||||
{
|
||||
return FlsGetValue(__key);
|
||||
}
|
||||
|
||||
int __libcpp_tls_set(__libcpp_tls_key __key, void *__p)
|
||||
{
|
||||
if (!FlsSetValue(__key, __p))
|
||||
return GetLastError();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_THREAD_API_PTHREAD
|
||||
|
||||
#endif // !_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL || _LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
@ -37,13 +37,8 @@ template <class _Pointer> class __tree_end_node;
|
||||
template <class _VoidPtr> class __tree_node_base;
|
||||
template <class _Tp, class _VoidPtr> class __tree_node;
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Key, class _Value>
|
||||
union __value_type;
|
||||
#else
|
||||
template <class _Key, class _Value>
|
||||
struct __value_type;
|
||||
#endif
|
||||
|
||||
template <class _Key, class _CP, class _Compare,
|
||||
bool = is_empty<_Compare>::value && !__libcpp_is_final<_Compare>::value>
|
||||
@ -569,7 +564,6 @@ struct __tree_key_value_types {
|
||||
static __container_value_type* __get_ptr(__node_value_type& __n) {
|
||||
return _VSTD::addressof(__n);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static __container_value_type&& __move(__node_value_type& __v) {
|
||||
@ -584,14 +578,13 @@ struct __tree_key_value_types<__value_type<_Key, _Tp> > {
|
||||
typedef _Tp mapped_type;
|
||||
typedef __value_type<_Key, _Tp> __node_value_type;
|
||||
typedef pair<const _Key, _Tp> __container_value_type;
|
||||
typedef pair<_Key, _Tp> __nc_value_type;
|
||||
typedef __container_value_type __map_value_type;
|
||||
static const bool __is_map = true;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static key_type const&
|
||||
__get_key(__node_value_type const& __t) {
|
||||
return __t.__cc.first;
|
||||
return __t.__get_value().first;
|
||||
}
|
||||
|
||||
template <class _Up>
|
||||
@ -605,7 +598,7 @@ struct __tree_key_value_types<__value_type<_Key, _Tp> > {
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static __container_value_type const&
|
||||
__get_value(__node_value_type const& __t) {
|
||||
return __t.__cc;
|
||||
return __t.__get_value();
|
||||
}
|
||||
|
||||
template <class _Up>
|
||||
@ -618,13 +611,13 @@ struct __tree_key_value_types<__value_type<_Key, _Tp> > {
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static __container_value_type* __get_ptr(__node_value_type& __n) {
|
||||
return _VSTD::addressof(__n.__cc);
|
||||
return _VSTD::addressof(__n.__get_value());
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static __nc_value_type&& __move(__node_value_type& __v) {
|
||||
return _VSTD::move(__v.__nc);
|
||||
static pair<key_type&&, mapped_type&&> __move(__node_value_type& __v) {
|
||||
return __v.__move();
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -104,7 +104,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
|
||||
_LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
|
||||
void __throw_bad_any_cast()
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@ -304,7 +304,7 @@ private:
|
||||
__any_imp::_Buffer __buf;
|
||||
};
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void * __call(_Action __a, any * __other = nullptr,
|
||||
type_info const * __info = nullptr,
|
||||
const void* __fallback_info = nullptr) const
|
||||
@ -312,7 +312,7 @@ private:
|
||||
return __h(__a, this, __other, __info, __fallback_info);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void * __call(_Action __a, any * __other = nullptr,
|
||||
type_info const * __info = nullptr,
|
||||
const void* __fallback_info = nullptr)
|
||||
|
181
include/array
181
include/array
@ -72,6 +72,9 @@ struct array
|
||||
const T* data() const noexcept;
|
||||
};
|
||||
|
||||
template <class T, class... U>
|
||||
array(T, U...) -> array<T, 1 + sizeof...(U)>;
|
||||
|
||||
template <class T, size_t N>
|
||||
bool operator==(const array<T,N>& x, const array<T,N>& y);
|
||||
template <class T, size_t N>
|
||||
@ -86,7 +89,7 @@ template <class T, size_t N>
|
||||
bool operator>=(const array<T,N>& x, const array<T,N>& y);
|
||||
|
||||
template <class T, size_t N >
|
||||
void swap(array<T,N>& x, array<T,N>& y) noexcept(noexcept(x.swap(y)));
|
||||
void swap(array<T,N>& x, array<T,N>& y) noexcept(noexcept(x.swap(y))); // C++17
|
||||
|
||||
template <class T> class tuple_size;
|
||||
template <size_t I, class T> class tuple_element;
|
||||
@ -108,6 +111,8 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
#include <cstdlib> // for _LIBCPP_UNREACHABLE
|
||||
#include <__debug>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
@ -117,6 +122,7 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
struct _LIBCPP_TEMPLATE_VIS array
|
||||
{
|
||||
@ -134,31 +140,27 @@ struct _LIBCPP_TEMPLATE_VIS array
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
value_type __elems_[_Size > 0 ? _Size : 1];
|
||||
_Tp __elems_[_Size];
|
||||
|
||||
// No explicit construct/copy/destroy for aggregate type
|
||||
_LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u)
|
||||
{_VSTD::fill_n(__elems_, _Size, __u);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(array& __a) _NOEXCEPT_(_Size == 0 || __is_nothrow_swappable<_Tp>::value)
|
||||
{ __swap_dispatch((std::integral_constant<bool, _Size == 0>()), __a); }
|
||||
_LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u) {
|
||||
_VSTD::fill_n(__elems_, _Size, __u);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __swap_dispatch(std::true_type, array&) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __swap_dispatch(std::false_type, array& __a)
|
||||
{ _VSTD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);}
|
||||
void swap(array& __a) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) {
|
||||
std::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);
|
||||
}
|
||||
|
||||
// iterators:
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
iterator begin() _NOEXCEPT {return iterator(__elems_);}
|
||||
iterator begin() _NOEXCEPT {return iterator(data());}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
const_iterator begin() const _NOEXCEPT {return const_iterator(__elems_);}
|
||||
const_iterator begin() const _NOEXCEPT {return const_iterator(data());}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
iterator end() _NOEXCEPT {return iterator(__elems_ + _Size);}
|
||||
iterator end() _NOEXCEPT {return iterator(data() + _Size);}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
const_iterator end() const _NOEXCEPT {return const_iterator(__elems_ + _Size);}
|
||||
const_iterator end() const _NOEXCEPT {return const_iterator(data() + _Size);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
|
||||
@ -184,7 +186,7 @@ struct _LIBCPP_TEMPLATE_VIS array
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return _Size;}
|
||||
_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;}
|
||||
_LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return false; }
|
||||
|
||||
// element access:
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
@ -197,8 +199,8 @@ struct _LIBCPP_TEMPLATE_VIS array
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference front() {return __elems_[0];}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference front() const {return __elems_[0];}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference back() {return __elems_[_Size > 0 ? _Size-1 : 0];}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference back() {return __elems_[_Size - 1];}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference back() const {return __elems_[_Size - 1];}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
value_type* data() _NOEXCEPT {return __elems_;}
|
||||
@ -206,6 +208,7 @@ struct _LIBCPP_TEMPLATE_VIS array
|
||||
const value_type* data() const _NOEXCEPT {return __elems_;}
|
||||
};
|
||||
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
typename array<_Tp, _Size>::reference
|
||||
@ -227,12 +230,147 @@ array<_Tp, _Size>::at(size_type __n) const
|
||||
return __elems_[__n];
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0>
|
||||
{
|
||||
// types:
|
||||
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_TYPE(_ArrayInStructT) _CharType __elems_[sizeof(_ArrayInStructT)];
|
||||
|
||||
// No explicit construct/copy/destroy for aggregate type
|
||||
_LIBCPP_INLINE_VISIBILITY void fill(const value_type&) {
|
||||
static_assert(!is_const<_Tp>::value,
|
||||
"cannot fill zero-sized array of type 'const T'");
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(array&) _NOEXCEPT {
|
||||
static_assert(!is_const<_Tp>::value,
|
||||
"cannot swap zero-sized array of type 'const T'");
|
||||
}
|
||||
|
||||
// iterators:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() _NOEXCEPT {return iterator(data());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const _NOEXCEPT {return const_iterator(data());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() _NOEXCEPT {return iterator(data());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const _NOEXCEPT {return const_iterator(data());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rbegin() const _NOEXCEPT {return const_reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rend() const _NOEXCEPT {return const_reverse_iterator(begin());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cbegin() const _NOEXCEPT {return begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cend() const _NOEXCEPT {return end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crend() const _NOEXCEPT {return rend();}
|
||||
|
||||
// capacity:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT {return 0; }
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return 0;}
|
||||
_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return true;}
|
||||
|
||||
// element access:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator[](size_type) {
|
||||
_LIBCPP_ASSERT(false, "cannot call array<T, 0>::operator[] on a zero-sized array");
|
||||
_LIBCPP_UNREACHABLE();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
const_reference operator[](size_type) const {
|
||||
_LIBCPP_ASSERT(false, "cannot call array<T, 0>::operator[] on a zero-sized array");
|
||||
_LIBCPP_UNREACHABLE();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference at(size_type) {
|
||||
__throw_out_of_range("array<T, 0>::at");
|
||||
_LIBCPP_UNREACHABLE();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reference at(size_type) const {
|
||||
__throw_out_of_range("array<T, 0>::at");
|
||||
_LIBCPP_UNREACHABLE();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference front() {
|
||||
_LIBCPP_ASSERT(false, "cannot call array<T, 0>::front() on a zero-sized array");
|
||||
_LIBCPP_UNREACHABLE();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reference front() const {
|
||||
_LIBCPP_ASSERT(false, "cannot call array<T, 0>::front() on a zero-sized array");
|
||||
_LIBCPP_UNREACHABLE();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference back() {
|
||||
_LIBCPP_ASSERT(false, "cannot call array<T, 0>::back() on a zero-sized array");
|
||||
_LIBCPP_UNREACHABLE();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reference back() const {
|
||||
_LIBCPP_ASSERT(false, "cannot call array<T, 0>::back() on a zero-sized array");
|
||||
_LIBCPP_UNREACHABLE();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_type* data() _NOEXCEPT {return reinterpret_cast<value_type*>(__elems_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const value_type* data() const _NOEXCEPT {return reinterpret_cast<const value_type*>(__elems_);}
|
||||
};
|
||||
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
|
||||
template<class _Tp, class... _Args,
|
||||
class = typename enable_if<(is_same_v<_Tp, _Args> && ...), void>::type
|
||||
>
|
||||
array(_Tp, _Args...)
|
||||
-> array<_Tp, 1 + sizeof...(_Args)>;
|
||||
#endif
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return _VSTD::equal(__x.__elems_, __x.__elems_ + _Size, __y.__elems_);
|
||||
return _VSTD::equal(__x.begin(), __x.end(), __y.begin());
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
@ -248,7 +386,8 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return _VSTD::lexicographical_compare(__x.__elems_, __x.__elems_ + _Size, __y.__elems_, __y.__elems_ + _Size);
|
||||
return _VSTD::lexicographical_compare(__x.begin(), __x.end(),
|
||||
__y.begin(), __y.end());
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
|
@ -555,6 +555,9 @@ void atomic_signal_fence(memory_order m) noexcept;
|
||||
#if !defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)
|
||||
#error <atomic> is not implemented
|
||||
#endif
|
||||
#ifdef kill_dependency
|
||||
#error C++ standard library is incompatible with <stdatomic.h>
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
# define __cpp_lib_atomic_is_always_lock_free 201603L
|
||||
@ -695,7 +698,7 @@ static inline void __c11_atomic_store(_Atomic(_Tp)* __a, _Tp __val,
|
||||
}
|
||||
|
||||
template <typename _Tp>
|
||||
static inline _Tp __c11_atomic_load(volatile _Atomic(_Tp)* __a,
|
||||
static inline _Tp __c11_atomic_load(const volatile _Atomic(_Tp)* __a,
|
||||
memory_order __order) {
|
||||
_Tp __ret;
|
||||
__atomic_load(&__a->__a_value, &__ret,
|
||||
@ -704,7 +707,7 @@ static inline _Tp __c11_atomic_load(volatile _Atomic(_Tp)* __a,
|
||||
}
|
||||
|
||||
template <typename _Tp>
|
||||
static inline _Tp __c11_atomic_load(_Atomic(_Tp)* __a, memory_order __order) {
|
||||
static inline _Tp __c11_atomic_load(const _Atomic(_Tp)* __a, memory_order __order) {
|
||||
_Tp __ret;
|
||||
__atomic_load(&__a->__a_value, &__ret,
|
||||
__gcc_atomic::__to_gcc_order(__order));
|
||||
@ -1741,7 +1744,7 @@ typedef struct atomic_flag
|
||||
atomic_flag() _NOEXCEPT : __a_() {}
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
atomic_flag(bool __b) _NOEXCEPT : __a_(__b) {} // EXTENSION
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
497
include/chrono
497
include/chrono
@ -26,7 +26,7 @@ duration_cast(const duration<Rep, Period>& fd);
|
||||
|
||||
template <class Rep> struct treat_as_floating_point : is_floating_point<Rep> {};
|
||||
|
||||
template <class Rep> constexpr bool treat_as_floating_point_v
|
||||
template <class Rep> inline constexpr bool treat_as_floating_point_v
|
||||
= treat_as_floating_point<Rep>::value; // C++17
|
||||
|
||||
template <class Rep>
|
||||
@ -147,6 +147,11 @@ template <class Clock, class Duration1, class Duration2>
|
||||
|
||||
namespace chrono {
|
||||
|
||||
|
||||
template<class T> struct is_clock; // C++20
|
||||
template<class T> inline constexpr bool is_clock_v = is_clock<T>::value; // C++20
|
||||
|
||||
|
||||
// duration arithmetic
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
constexpr
|
||||
@ -204,6 +209,8 @@ template <class ToDuration, class Rep, class Period>
|
||||
template <class ToDuration, class Rep, class Period>
|
||||
constexpr ToDuration round(const duration<Rep, Period>& d); // C++17
|
||||
|
||||
// duration I/O is elsewhere
|
||||
|
||||
// time_point arithmetic (all constexpr in C++14)
|
||||
template <class Clock, class Duration1, class Rep2, class Period2>
|
||||
time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
|
||||
@ -251,6 +258,7 @@ template <class ToDuration, class Clock, class Duration>
|
||||
|
||||
template <class Rep, class Period>
|
||||
constexpr duration<Rep, Period> abs(duration<Rep, Period> d); // C++17
|
||||
|
||||
// Clocks
|
||||
|
||||
class system_clock
|
||||
@ -267,6 +275,28 @@ public:
|
||||
static time_point from_time_t(time_t __t) noexcept;
|
||||
};
|
||||
|
||||
template <class Duration>
|
||||
using sys_time = time_point<system_clock, Duration>; // C++20
|
||||
using sys_seconds = sys_time<seconds>; // C++20
|
||||
using sys_days = sys_time<days>; // C++20
|
||||
|
||||
class utc_clock; // C++20
|
||||
|
||||
template <class Duration>
|
||||
using utc_time = time_point<utc_clock, Duration>; // C++20
|
||||
using utc_seconds = utc_time<seconds>; // C++20
|
||||
|
||||
class tai_clock; // C++20
|
||||
|
||||
template <class Duration>
|
||||
using tai_time = time_point<tai_clock, Duration>; // C++20
|
||||
using tai_seconds = tai_time<seconds>; // C++20
|
||||
|
||||
class file_clock; // C++20
|
||||
|
||||
template<class Duration>
|
||||
using file_time = time_point<file_clock, Duration>; // C++20
|
||||
|
||||
class steady_clock
|
||||
{
|
||||
public:
|
||||
@ -281,8 +311,466 @@ public:
|
||||
|
||||
typedef steady_clock high_resolution_clock;
|
||||
|
||||
// 25.7.8, local time // C++20
|
||||
struct local_t {};
|
||||
template<class Duration>
|
||||
using local_time = time_point<local_t, Duration>;
|
||||
using local_seconds = local_time<seconds>;
|
||||
using local_days = local_time<days>;
|
||||
|
||||
// 25.7.9, time_point conversions template<class DestClock, class SourceClock> // C++20
|
||||
struct clock_time_conversion;
|
||||
|
||||
template<class DestClock, class SourceClock, class Duration>
|
||||
auto clock_cast(const time_point<SourceClock, Duration>& t);
|
||||
|
||||
// 25.8.2, class last_spec // C++20
|
||||
struct last_spec;
|
||||
|
||||
// 25.8.3, class day // C++20
|
||||
|
||||
class day;
|
||||
constexpr bool operator==(const day& x, const day& y) noexcept;
|
||||
constexpr bool operator!=(const day& x, const day& y) noexcept;
|
||||
constexpr bool operator< (const day& x, const day& y) noexcept;
|
||||
constexpr bool operator> (const day& x, const day& y) noexcept;
|
||||
constexpr bool operator<=(const day& x, const day& y) noexcept;
|
||||
constexpr bool operator>=(const day& x, const day& y) noexcept;
|
||||
constexpr day operator+(const day& x, const days& y) noexcept;
|
||||
constexpr day operator+(const days& x, const day& y) noexcept;
|
||||
constexpr day operator-(const day& x, const days& y) noexcept;
|
||||
constexpr days operator-(const day& x, const day& y) noexcept;
|
||||
|
||||
// 25.8.4, class month // C++20
|
||||
class month;
|
||||
constexpr bool operator==(const month& x, const month& y) noexcept;
|
||||
constexpr bool operator!=(const month& x, const month& y) noexcept;
|
||||
constexpr bool operator< (const month& x, const month& y) noexcept;
|
||||
constexpr bool operator> (const month& x, const month& y) noexcept;
|
||||
constexpr bool operator<=(const month& x, const month& y) noexcept;
|
||||
constexpr bool operator>=(const month& x, const month& y) noexcept;
|
||||
constexpr month operator+(const month& x, const months& y) noexcept;
|
||||
constexpr month operator+(const months& x, const month& y) noexcept;
|
||||
constexpr month operator-(const month& x, const months& y) noexcept;
|
||||
constexpr months operator-(const month& x, const month& y) noexcept;
|
||||
|
||||
// 25.8.5, class year // C++20
|
||||
class year;
|
||||
constexpr bool operator==(const year& x, const year& y) noexcept;
|
||||
constexpr bool operator!=(const year& x, const year& y) noexcept;
|
||||
constexpr bool operator< (const year& x, const year& y) noexcept;
|
||||
constexpr bool operator> (const year& x, const year& y) noexcept;
|
||||
constexpr bool operator<=(const year& x, const year& y) noexcept;
|
||||
constexpr bool operator>=(const year& x, const year& y) noexcept;
|
||||
constexpr year operator+(const year& x, const years& y) noexcept;
|
||||
constexpr year operator+(const years& x, const year& y) noexcept;
|
||||
constexpr year operator-(const year& x, const years& y) noexcept;
|
||||
constexpr years operator-(const year& x, const year& y) noexcept;
|
||||
|
||||
// 25.8.6, class weekday // C++20
|
||||
class weekday;
|
||||
|
||||
constexpr bool operator==(const weekday& x, const weekday& y) noexcept;
|
||||
constexpr bool operator!=(const weekday& x, const weekday& y) noexcept;
|
||||
constexpr weekday operator+(const weekday& x, const days& y) noexcept;
|
||||
constexpr weekday operator+(const days& x, const weekday& y) noexcept;
|
||||
constexpr weekday operator-(const weekday& x, const days& y) noexcept;
|
||||
constexpr days operator-(const weekday& x, const weekday& y) noexcept;
|
||||
|
||||
// 25.8.7, class weekday_indexed // C++20
|
||||
|
||||
class weekday_indexed;
|
||||
constexpr bool operator==(const weekday_indexed& x, const weekday_indexed& y) noexcept;
|
||||
constexpr bool operator!=(const weekday_indexed& x, const weekday_indexed& y) noexcept;
|
||||
|
||||
// 25.8.8, class weekday_last // C++20
|
||||
class weekday_last;
|
||||
|
||||
constexpr bool operator==(const weekday_last& x, const weekday_last& y) noexcept;
|
||||
constexpr bool operator!=(const weekday_last& x, const weekday_last& y) noexcept;
|
||||
|
||||
// 25.8.9, class month_day // C++20
|
||||
class month_day;
|
||||
|
||||
constexpr bool operator==(const month_day& x, const month_day& y) noexcept;
|
||||
constexpr bool operator!=(const month_day& x, const month_day& y) noexcept;
|
||||
constexpr bool operator< (const month_day& x, const month_day& y) noexcept;
|
||||
constexpr bool operator> (const month_day& x, const month_day& y) noexcept;
|
||||
constexpr bool operator<=(const month_day& x, const month_day& y) noexcept;
|
||||
constexpr bool operator>=(const month_day& x, const month_day& y) noexcept;
|
||||
|
||||
|
||||
// 25.8.10, class month_day_last // C++20
|
||||
class month_day_last;
|
||||
|
||||
constexpr bool operator==(const month_day_last& x, const month_day_last& y) noexcept;
|
||||
constexpr bool operator!=(const month_day_last& x, const month_day_last& y) noexcept;
|
||||
constexpr bool operator< (const month_day_last& x, const month_day_last& y) noexcept;
|
||||
constexpr bool operator> (const month_day_last& x, const month_day_last& y) noexcept;
|
||||
constexpr bool operator<=(const month_day_last& x, const month_day_last& y) noexcept;
|
||||
constexpr bool operator>=(const month_day_last& x, const month_day_last& y) noexcept;
|
||||
|
||||
// 25.8.11, class month_weekday // C++20
|
||||
class month_weekday;
|
||||
|
||||
constexpr bool operator==(const month_weekday& x, const month_weekday& y) noexcept;
|
||||
constexpr bool operator!=(const month_weekday& x, const month_weekday& y) noexcept;
|
||||
|
||||
// 25.8.12, class month_weekday_last // C++20
|
||||
class month_weekday_last;
|
||||
|
||||
constexpr bool operator==(const month_weekday_last& x, const month_weekday_last& y) noexcept;
|
||||
constexpr bool operator!=(const month_weekday_last& x, const month_weekday_last& y) noexcept;
|
||||
|
||||
|
||||
// 25.8.13, class year_month // C++20
|
||||
class year_month;
|
||||
|
||||
constexpr bool operator==(const year_month& x, const year_month& y) noexcept;
|
||||
constexpr bool operator!=(const year_month& x, const year_month& y) noexcept;
|
||||
constexpr bool operator< (const year_month& x, const year_month& y) noexcept;
|
||||
constexpr bool operator> (const year_month& x, const year_month& y) noexcept;
|
||||
constexpr bool operator<=(const year_month& x, const year_month& y) noexcept;
|
||||
constexpr bool operator>=(const year_month& x, const year_month& y) noexcept;
|
||||
|
||||
constexpr year_month operator+(const year_month& ym, const months& dm) noexcept;
|
||||
constexpr year_month operator+(const months& dm, const year_month& ym) noexcept;
|
||||
constexpr year_month operator-(const year_month& ym, const months& dm) noexcept;
|
||||
constexpr months operator-(const year_month& x, const year_month& y) noexcept;
|
||||
constexpr year_month operator+(const year_month& ym, const years& dy) noexcept;
|
||||
constexpr year_month operator+(const years& dy, const year_month& ym) noexcept;
|
||||
constexpr year_month operator-(const year_month& ym, const years& dy) noexcept;
|
||||
|
||||
// 25.8.14, class year_month_day class // C++20
|
||||
year_month_day;
|
||||
|
||||
constexpr bool operator==(const year_month_day& x, const year_month_day& y) noexcept;
|
||||
constexpr bool operator!=(const year_month_day& x, const year_month_day& y) noexcept;
|
||||
constexpr bool operator< (const year_month_day& x, const year_month_day& y) noexcept;
|
||||
constexpr bool operator> (const year_month_day& x, const year_month_day& y) noexcept;
|
||||
constexpr bool operator<=(const year_month_day& x, const year_month_day& y) noexcept;
|
||||
constexpr bool operator>=(const year_month_day& x, const year_month_day& y) noexcept;
|
||||
|
||||
constexpr year_month_day operator+(const year_month_day& ymd, const months& dm) noexcept;
|
||||
constexpr year_month_day operator+(const months& dm, const year_month_day& ymd) noexcept;
|
||||
constexpr year_month_day operator+(const year_month_day& ymd, const years& dy) noexcept;
|
||||
constexpr year_month_day operator+(const years& dy, const year_month_day& ymd) noexcept;
|
||||
constexpr year_month_day operator-(const year_month_day& ymd, const months& dm) noexcept;
|
||||
constexpr year_month_day operator-(const year_month_day& ymd, const years& dy) noexcept;
|
||||
|
||||
|
||||
// 25.8.15, class year_month_day_last // C++20
|
||||
class year_month_day_last;
|
||||
|
||||
constexpr bool operator==(const year_month_day_last& x,
|
||||
const year_month_day_last& y) noexcept;
|
||||
constexpr bool operator!=(const year_month_day_last& x,
|
||||
const year_month_day_last& y) noexcept;
|
||||
constexpr bool operator< (const year_month_day_last& x,
|
||||
const year_month_day_last& y) noexcept;
|
||||
constexpr bool operator> (const year_month_day_last& x,
|
||||
const year_month_day_last& y) noexcept;
|
||||
constexpr bool operator<=(const year_month_day_last& x,
|
||||
const year_month_day_last& y) noexcept;
|
||||
constexpr bool operator>=(const year_month_day_last& x,
|
||||
const year_month_day_last& y) noexcept;
|
||||
|
||||
constexpr year_month_day_last
|
||||
operator+(const year_month_day_last& ymdl, const months& dm) noexcept;
|
||||
constexpr year_month_day_last
|
||||
operator+(const months& dm, const year_month_day_last& ymdl) noexcept;
|
||||
constexpr year_month_day_last
|
||||
operator+(const year_month_day_last& ymdl, const years& dy) noexcept;
|
||||
constexpr year_month_day_last
|
||||
operator+(const years& dy, const year_month_day_last& ymdl) noexcept;
|
||||
constexpr year_month_day_last
|
||||
operator-(const year_month_day_last& ymdl, const months& dm) noexcept;
|
||||
constexpr year_month_day_last
|
||||
operator-(const year_month_day_last& ymdl, const years& dy) noexcept;
|
||||
|
||||
// 25.8.16, class year_month_weekday // C++20
|
||||
class year_month_weekday;
|
||||
|
||||
constexpr bool operator==(const year_month_weekday& x,
|
||||
const year_month_weekday& y) noexcept;
|
||||
constexpr bool operator!=(const year_month_weekday& x,
|
||||
const year_month_weekday& y) noexcept;
|
||||
|
||||
constexpr year_month_weekday
|
||||
operator+(const year_month_weekday& ymwd, const months& dm) noexcept;
|
||||
constexpr year_month_weekday
|
||||
operator+(const months& dm, const year_month_weekday& ymwd) noexcept;
|
||||
constexpr year_month_weekday
|
||||
operator+(const year_month_weekday& ymwd, const years& dy) noexcept;
|
||||
constexpr year_month_weekday
|
||||
operator+(const years& dy, const year_month_weekday& ymwd) noexcept;
|
||||
constexpr year_month_weekday
|
||||
operator-(const year_month_weekday& ymwd, const months& dm) noexcept;
|
||||
constexpr year_month_weekday
|
||||
operator-(const year_month_weekday& ymwd, const years& dy) noexcept;
|
||||
|
||||
// 25.8.17, class year_month_weekday_last // C++20
|
||||
class year_month_weekday_last;
|
||||
|
||||
constexpr bool operator==(const year_month_weekday_last& x,
|
||||
const year_month_weekday_last& y) noexcept;
|
||||
constexpr bool operator!=(const year_month_weekday_last& x,
|
||||
const year_month_weekday_last& y) noexcept;
|
||||
constexpr year_month_weekday_last
|
||||
operator+(const year_month_weekday_last& ymwdl, const months& dm) noexcept;
|
||||
constexpr year_month_weekday_last
|
||||
operator+(const months& dm, const year_month_weekday_last& ymwdl) noexcept;
|
||||
constexpr year_month_weekday_last
|
||||
operator+(const year_month_weekday_last& ymwdl, const years& dy) noexcept;
|
||||
constexpr year_month_weekday_last
|
||||
operator+(const years& dy, const year_month_weekday_last& ymwdl) noexcept;
|
||||
constexpr year_month_weekday_last
|
||||
operator-(const year_month_weekday_last& ymwdl, const months& dm) noexcept;
|
||||
constexpr year_month_weekday_last
|
||||
operator-(const year_month_weekday_last& ymwdl, const years& dy) noexcept;
|
||||
|
||||
// 25.8.18, civil calendar conventional syntax operators // C++20
|
||||
constexpr year_month
|
||||
operator/(const year& y, const month& m) noexcept;
|
||||
constexpr year_month
|
||||
operator/(const year& y, int m) noexcept;
|
||||
constexpr month_day
|
||||
operator/(const month& m, const day& d) noexcept;
|
||||
constexpr month_day
|
||||
operator/(const month& m, int d) noexcept;
|
||||
constexpr month_day
|
||||
operator/(int m, const day& d) noexcept;
|
||||
constexpr month_day
|
||||
operator/(const day& d, const month& m) noexcept;
|
||||
constexpr month_day
|
||||
operator/(const day& d, int m) noexcept;
|
||||
constexpr month_day_last
|
||||
operator/(const month& m, last_spec) noexcept;
|
||||
constexpr month_day_last
|
||||
operator/(int m, last_spec) noexcept;
|
||||
constexpr month_day_last
|
||||
operator/(last_spec, const month& m) noexcept;
|
||||
constexpr month_day_last
|
||||
operator/(last_spec, int m) noexcept;
|
||||
constexpr month_weekday
|
||||
operator/(const month& m, const weekday_indexed& wdi) noexcept;
|
||||
constexpr month_weekday
|
||||
operator/(int m, const weekday_indexed& wdi) noexcept;
|
||||
constexpr month_weekday
|
||||
operator/(const weekday_indexed& wdi, const month& m) noexcept;
|
||||
constexpr month_weekday
|
||||
operator/(const weekday_indexed& wdi, int m) noexcept;
|
||||
constexpr month_weekday_last
|
||||
operator/(const month& m, const weekday_last& wdl) noexcept;
|
||||
constexpr month_weekday_last
|
||||
operator/(int m, const weekday_last& wdl) noexcept;
|
||||
constexpr month_weekday_last
|
||||
operator/(const weekday_last& wdl, const month& m) noexcept;
|
||||
constexpr month_weekday_last
|
||||
operator/(const weekday_last& wdl, int m) noexcept;
|
||||
constexpr year_month_day
|
||||
operator/(const year_month& ym, const day& d) noexcept;
|
||||
constexpr year_month_day
|
||||
operator/(const year_month& ym, int d) noexcept;
|
||||
constexpr year_month_day
|
||||
operator/(const year& y, const month_day& md) noexcept;
|
||||
constexpr year_month_day
|
||||
operator/(int y, const month_day& md) noexcept;
|
||||
constexpr year_month_day
|
||||
operator/(const month_day& md, const year& y) noexcept;
|
||||
constexpr year_month_day
|
||||
operator/(const month_day& md, int y) noexcept;
|
||||
constexpr year_month_day_last
|
||||
operator/(const year_month& ym, last_spec) noexcept;
|
||||
constexpr year_month_day_last
|
||||
operator/(const year& y, const month_day_last& mdl) noexcept;
|
||||
constexpr year_month_day_last
|
||||
operator/(int y, const month_day_last& mdl) noexcept;
|
||||
constexpr year_month_day_last
|
||||
operator/(const month_day_last& mdl, const year& y) noexcept;
|
||||
constexpr year_month_day_last
|
||||
operator/(const month_day_last& mdl, int y) noexcept;
|
||||
constexpr year_month_weekday
|
||||
operator/(const year_month& ym, const weekday_indexed& wdi) noexcept;
|
||||
constexpr year_month_weekday
|
||||
operator/(const year& y, const month_weekday& mwd) noexcept;
|
||||
constexpr year_month_weekday
|
||||
operator/(int y, const month_weekday& mwd) noexcept;
|
||||
constexpr year_month_weekday
|
||||
operator/(const month_weekday& mwd, const year& y) noexcept;
|
||||
constexpr year_month_weekday
|
||||
operator/(const month_weekday& mwd, int y) noexcept;
|
||||
constexpr year_month_weekday_last
|
||||
operator/(const year_month& ym, const weekday_last& wdl) noexcept;
|
||||
constexpr year_month_weekday_last
|
||||
operator/(const year& y, const month_weekday_last& mwdl) noexcept;
|
||||
constexpr year_month_weekday_last
|
||||
operator/(int y, const month_weekday_last& mwdl) noexcept;
|
||||
constexpr year_month_weekday_last
|
||||
operator/(const month_weekday_last& mwdl, const year& y) noexcept;
|
||||
constexpr year_month_weekday_last
|
||||
operator/(const month_weekday_last& mwdl, int y) noexcept;
|
||||
|
||||
// 25.9, class template time_of_day // C++20
|
||||
template<class Duration> class time_of_day;
|
||||
|
||||
template<> class time_of_day<hours>;
|
||||
template<> class time_of_day<minutes>;
|
||||
template<> class time_of_day<seconds>;
|
||||
template<class Rep, class Period> class time_of_day<duration<Rep, Period>>;
|
||||
|
||||
// 25.10.2, time zone database // C++20
|
||||
struct tzdb;
|
||||
class tzdb_list;
|
||||
|
||||
// 25.10.2.3, time zone database access // C++20
|
||||
const tzdb& get_tzdb();
|
||||
tzdb_list& get_tzdb_list();
|
||||
const time_zone* locate_zone(string_view tz_name);
|
||||
const time_zone* current_zone();
|
||||
|
||||
// 25.10.2.4, remote time zone database support // C++20
|
||||
const tzdb& reload_tzdb();
|
||||
string remote_version();
|
||||
|
||||
// 25.10.3, exception classes // C++20
|
||||
class nonexistent_local_time;
|
||||
class ambiguous_local_time;
|
||||
|
||||
// 25.10.4, information classes // C++20
|
||||
struct sys_info;
|
||||
struct local_info;
|
||||
|
||||
// 25.10.5, class time_zone // C++20
|
||||
enum class choose {earliest, latest};
|
||||
class time_zone;
|
||||
bool operator==(const time_zone& x, const time_zone& y) noexcept;
|
||||
bool operator!=(const time_zone& x, const time_zone& y) noexcept;
|
||||
bool operator<(const time_zone& x, const time_zone& y) noexcept;
|
||||
bool operator>(const time_zone& x, const time_zone& y) noexcept;
|
||||
bool operator<=(const time_zone& x, const time_zone& y) noexcept;
|
||||
bool operator>=(const time_zone& x, const time_zone& y) noexcept;
|
||||
|
||||
// 25.10.6, class template zoned_traits // C++20
|
||||
template<class T> struct zoned_traits;
|
||||
|
||||
// 25.10.7, class template zoned_time // C++20
|
||||
template<class Duration, class TimeZonePtr = const time_zone*> class zoned_time;
|
||||
using zoned_seconds = zoned_time<seconds>;
|
||||
|
||||
template<class Duration1, class Duration2, class TimeZonePtr>
|
||||
bool operator==(const zoned_time<Duration1, TimeZonePtr>& x,
|
||||
const zoned_time<Duration2, TimeZonePtr>& y);
|
||||
template<class Duration1, class Duration2, class TimeZonePtr>
|
||||
bool operator!=(const zoned_time<Duration1, TimeZonePtr>& x,
|
||||
const zoned_time<Duration2, TimeZonePtr>& y);
|
||||
|
||||
// 25.10.8, leap second support // C++20
|
||||
class leap;
|
||||
|
||||
bool operator==(const leap& x, const leap& y);
|
||||
bool operator!=(const leap& x, const leap& y);
|
||||
bool operator< (const leap& x, const leap& y);
|
||||
bool operator> (const leap& x, const leap& y);
|
||||
bool operator<=(const leap& x, const leap& y);
|
||||
bool operator>=(const leap& x, const leap& y);
|
||||
template<class Duration>
|
||||
bool operator==(const leap& x, const sys_time<Duration>& y);
|
||||
template<class Duration>
|
||||
bool operator==(const sys_time<Duration>& x, const leap& y);
|
||||
template<class Duration>
|
||||
bool operator!=(const leap& x, const sys_time<Duration>& y);
|
||||
template<class Duration>
|
||||
bool operator!=(const sys_time<Duration>& x, const leap& y);
|
||||
template<class Duration>
|
||||
bool operator< (const leap& x, const sys_time<Duration>& y);
|
||||
template<class Duration>
|
||||
bool operator< (const sys_time<Duration>& x, const leap& y);
|
||||
template<class Duration>
|
||||
bool operator> (const leap& x, const sys_time<Duration>& y);
|
||||
template<class Duration>
|
||||
bool operator> (const sys_time<Duration>& x, const leap& y);
|
||||
template<class Duration>
|
||||
bool operator<=(const leap& x, const sys_time<Duration>& y);
|
||||
template<class Duration>
|
||||
bool operator<=(const sys_time<Duration>& x, const leap& y);
|
||||
template<class Duration>
|
||||
bool operator>=(const leap& x, const sys_time<Duration>& y);
|
||||
template<class Duration>
|
||||
bool operator>=(const sys_time<Duration>& x, const leap& y);
|
||||
|
||||
// 25.10.9, class link // C++20
|
||||
class link;
|
||||
bool operator==(const link& x, const link& y);
|
||||
bool operator!=(const link& x, const link& y);
|
||||
bool operator< (const link& x, const link& y);
|
||||
bool operator> (const link& x, const link& y);
|
||||
bool operator<=(const link& x, const link& y);
|
||||
bool operator>=(const link& x, const link& y);
|
||||
|
||||
// 25.11, formatting // C++20
|
||||
template<class charT, class Streamable>
|
||||
basic_string<charT>
|
||||
format(const charT* fmt, const Streamable& s);
|
||||
|
||||
template<class charT, class Streamable>
|
||||
basic_string<charT>
|
||||
format(const locale& loc, const charT* fmt, const Streamable& s);
|
||||
|
||||
template<class charT, class traits, class Alloc, class Streamable>
|
||||
basic_string<charT, traits, Alloc>
|
||||
format(const basic_string<charT, traits, Alloc>& fmt, const Streamable& s);
|
||||
|
||||
template<class charT, class traits, class Alloc, class Streamable>
|
||||
basic_string<charT, traits, Alloc>
|
||||
format(const locale& loc, const basic_string<charT, traits, Alloc>& fmt,
|
||||
const Streamable& s);
|
||||
|
||||
// 25.12, parsing // C++20
|
||||
template<class charT, class traits, class Alloc, class Parsable>
|
||||
unspecified
|
||||
parse(const basic_string<charT, traits, Alloc>& format, Parsable& tp);
|
||||
|
||||
template<class charT, class traits, class Alloc, class Parsable>
|
||||
unspecified
|
||||
parse(const basic_string<charT, traits, Alloc>& format, Parsable& tp,
|
||||
basic_string<charT, traits, Alloc>& abbrev);
|
||||
|
||||
template<class charT, class traits, class Alloc, class Parsable>
|
||||
unspecified
|
||||
parse(const basic_string<charT, traits, Alloc>& format, Parsable& tp,
|
||||
minutes& offset);
|
||||
|
||||
template<class charT, class traits, class Alloc, class Parsable>
|
||||
unspecified
|
||||
parse(const basic_string<charT, traits, Alloc>& format, Parsable& tp,
|
||||
basic_string<charT, traits, Alloc>& abbrev, minutes& offset);
|
||||
|
||||
inline constexpr last_spec last{}; // C++20
|
||||
inline constexpr chrono::weekday Sunday{0}; // C++20
|
||||
inline constexpr chrono::weekday Monday{1}; // C++20
|
||||
inline constexpr chrono::weekday Tuesday{2}; // C++20
|
||||
inline constexpr chrono::weekday Wednesday{3}; // C++20
|
||||
inline constexpr chrono::weekday Thursday{4}; // C++20
|
||||
inline constexpr chrono::weekday Friday{5}; // C++20
|
||||
inline constexpr chrono::weekday Saturday{6}; // C++20
|
||||
|
||||
inline constexpr chrono::month January{1}; // C++20
|
||||
inline constexpr chrono::month February{2}; // C++20
|
||||
inline constexpr chrono::month March{3}; // C++20
|
||||
inline constexpr chrono::month April{4}; // C++20
|
||||
inline constexpr chrono::month May{5}; // C++20
|
||||
inline constexpr chrono::month June{6}; // C++20
|
||||
inline constexpr chrono::month July{7}; // C++20
|
||||
inline constexpr chrono::month August{8}; // C++20
|
||||
inline constexpr chrono::month September{9}; // C++20
|
||||
inline constexpr chrono::month October{10}; // C++20
|
||||
inline constexpr chrono::month November{11}; // C++20
|
||||
inline constexpr chrono::month December{12}; // C++20
|
||||
} // chrono
|
||||
|
||||
inline namespace literals {
|
||||
inline namespace chrono_literals {
|
||||
constexpr chrono::hours operator ""h(unsigned long long); // C++14
|
||||
constexpr chrono::duration<unspecified , ratio<3600,1>> operator ""h(long double); // C++14
|
||||
constexpr chrono::minutes operator ""min(unsigned long long); // C++14
|
||||
@ -295,6 +783,10 @@ constexpr chrono::microseconds operator ""us(unsigned l
|
||||
constexpr chrono::duration<unspecified , micro> operator ""us(long double); // C++14
|
||||
constexpr chrono::nanoseconds operator ""ns(unsigned long long); // C++14
|
||||
constexpr chrono::duration<unspecified , nano> operator ""ns(long double); // C++14
|
||||
constexpr chrono::day operator ""d(unsigned long long d) noexcept; // C++20
|
||||
constexpr chrono::year operator ""y(unsigned long long y) noexcept; // C++20
|
||||
} // chrono_literals
|
||||
} // literals
|
||||
|
||||
} // std
|
||||
*/
|
||||
@ -419,7 +911,8 @@ template <class _Rep>
|
||||
struct _LIBCPP_TEMPLATE_VIS treat_as_floating_point : is_floating_point<_Rep> {};
|
||||
|
||||
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
|
||||
template <class _Rep> _LIBCPP_CONSTEXPR bool treat_as_floating_point_v
|
||||
template <class _Rep>
|
||||
_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool treat_as_floating_point_v
|
||||
= treat_as_floating_point<_Rep>::value;
|
||||
#endif
|
||||
|
||||
|
@ -547,7 +547,7 @@ hypot(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
|
||||
#endif
|
||||
|
||||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
|
||||
__libcpp_isnan_or_builtin(_A1 __lcpp_x) _NOEXCEPT
|
||||
{
|
||||
@ -559,7 +559,7 @@ __libcpp_isnan_or_builtin(_A1 __lcpp_x) _NOEXCEPT
|
||||
}
|
||||
|
||||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
|
||||
__libcpp_isnan_or_builtin(_A1 __lcpp_x) _NOEXCEPT
|
||||
{
|
||||
@ -567,7 +567,7 @@ __libcpp_isnan_or_builtin(_A1 __lcpp_x) _NOEXCEPT
|
||||
}
|
||||
|
||||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
|
||||
__libcpp_isinf_or_builtin(_A1 __lcpp_x) _NOEXCEPT
|
||||
{
|
||||
@ -579,7 +579,7 @@ __libcpp_isinf_or_builtin(_A1 __lcpp_x) _NOEXCEPT
|
||||
}
|
||||
|
||||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
|
||||
__libcpp_isinf_or_builtin(_A1 __lcpp_x) _NOEXCEPT
|
||||
{
|
||||
@ -587,7 +587,7 @@ __libcpp_isinf_or_builtin(_A1 __lcpp_x) _NOEXCEPT
|
||||
}
|
||||
|
||||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
|
||||
__libcpp_isfinite_or_builtin(_A1 __lcpp_x) _NOEXCEPT
|
||||
{
|
||||
@ -599,7 +599,7 @@ __libcpp_isfinite_or_builtin(_A1 __lcpp_x) _NOEXCEPT
|
||||
}
|
||||
|
||||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
|
||||
__libcpp_isfinite_or_builtin(_A1 __lcpp_x) _NOEXCEPT
|
||||
{
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
@ -121,7 +121,7 @@ public:
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
@ -156,7 +156,7 @@ public:
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __codecvt_utf8(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
@ -186,11 +186,11 @@ class _LIBCPP_TEMPLATE_VIS codecvt_utf8
|
||||
: public __codecvt_utf8<_Elem>
|
||||
{
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit codecvt_utf8(size_t __refs = 0)
|
||||
: __codecvt_utf8<_Elem>(__refs, _Maxcode, _Mode) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~codecvt_utf8() {}
|
||||
};
|
||||
|
||||
@ -209,7 +209,7 @@ public:
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
@ -244,7 +244,7 @@ public:
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
@ -279,7 +279,7 @@ public:
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
@ -314,7 +314,7 @@ public:
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
@ -349,7 +349,7 @@ public:
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
@ -384,7 +384,7 @@ public:
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __codecvt_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
@ -414,11 +414,11 @@ class _LIBCPP_TEMPLATE_VIS codecvt_utf16
|
||||
: public __codecvt_utf16<_Elem, _Mode & little_endian>
|
||||
{
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit codecvt_utf16(size_t __refs = 0)
|
||||
: __codecvt_utf16<_Elem, _Mode & little_endian>(__refs, _Maxcode, _Mode) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~codecvt_utf16() {}
|
||||
};
|
||||
|
||||
@ -437,7 +437,7 @@ public:
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<wchar_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
@ -472,7 +472,7 @@ public:
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
@ -507,7 +507,7 @@ public:
|
||||
typedef char extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __codecvt_utf8_utf16(size_t __refs, unsigned long _Maxcode,
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
@ -537,11 +537,11 @@ class _LIBCPP_TEMPLATE_VIS codecvt_utf8_utf16
|
||||
: public __codecvt_utf8_utf16<_Elem>
|
||||
{
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit codecvt_utf8_utf16(size_t __refs = 0)
|
||||
: __codecvt_utf8_utf16<_Elem>(__refs, _Maxcode, _Mode) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~codecvt_utf8_utf16() {}
|
||||
};
|
||||
|
||||
|
679
include/compare
Normal file
679
include/compare
Normal file
@ -0,0 +1,679 @@
|
||||
// -*- C++ -*-
|
||||
//===-------------------------- compare -----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_COMPARE
|
||||
#define _LIBCPP_COMPARE
|
||||
|
||||
/*
|
||||
compare synopsis
|
||||
|
||||
namespace std {
|
||||
// [cmp.categories], comparison category types
|
||||
class weak_equality;
|
||||
class strong_equality;
|
||||
class partial_ordering;
|
||||
class weak_ordering;
|
||||
class strong_ordering;
|
||||
|
||||
// named comparison functions
|
||||
constexpr bool is_eq (weak_equality cmp) noexcept { return cmp == 0; }
|
||||
constexpr bool is_neq (weak_equality cmp) noexcept { return cmp != 0; }
|
||||
constexpr bool is_lt (partial_ordering cmp) noexcept { return cmp < 0; }
|
||||
constexpr bool is_lteq(partial_ordering cmp) noexcept { return cmp <= 0; }
|
||||
constexpr bool is_gt (partial_ordering cmp) noexcept { return cmp > 0; }
|
||||
constexpr bool is_gteq(partial_ordering cmp) noexcept { return cmp >= 0; }
|
||||
|
||||
// [cmp.common], common comparison category type
|
||||
template<class... Ts>
|
||||
struct common_comparison_category {
|
||||
using type = see below;
|
||||
};
|
||||
template<class... Ts>
|
||||
using common_comparison_category_t = typename common_comparison_category<Ts...>::type;
|
||||
|
||||
// [cmp.alg], comparison algorithms
|
||||
template<class T> constexpr strong_ordering strong_order(const T& a, const T& b);
|
||||
template<class T> constexpr weak_ordering weak_order(const T& a, const T& b);
|
||||
template<class T> constexpr partial_ordering partial_order(const T& a, const T& b);
|
||||
template<class T> constexpr strong_equality strong_equal(const T& a, const T& b);
|
||||
template<class T> constexpr weak_equality weak_equal(const T& a, const T& b);
|
||||
}
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <type_traits>
|
||||
#include <array>
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
// exposition only
|
||||
enum class _LIBCPP_ENUM_VIS _EqResult : unsigned char {
|
||||
__zero = 0,
|
||||
__equal = __zero,
|
||||
__equiv = __equal,
|
||||
__nonequal = 1,
|
||||
__nonequiv = __nonequal
|
||||
};
|
||||
|
||||
enum class _LIBCPP_ENUM_VIS _OrdResult : signed char {
|
||||
__less = -1,
|
||||
__greater = 1
|
||||
};
|
||||
|
||||
enum class _LIBCPP_ENUM_VIS _NCmpResult : signed char {
|
||||
__unordered = -127
|
||||
};
|
||||
|
||||
struct _CmpUnspecifiedType;
|
||||
using _CmpUnspecifiedParam = void (_CmpUnspecifiedType::*)();
|
||||
|
||||
class weak_equality {
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr explicit weak_equality(_EqResult __val) noexcept : __value_(__val) {}
|
||||
|
||||
public:
|
||||
static const weak_equality equivalent;
|
||||
static const weak_equality nonequivalent;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator==(weak_equality __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator==(_CmpUnspecifiedParam, weak_equality __v) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator!=(weak_equality __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator!=(_CmpUnspecifiedParam, weak_equality __v) noexcept;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr weak_equality operator<=>(weak_equality __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr weak_equality operator<=>(_CmpUnspecifiedParam, weak_equality __v) noexcept;
|
||||
#endif
|
||||
|
||||
private:
|
||||
_EqResult __value_;
|
||||
};
|
||||
|
||||
_LIBCPP_INLINE_VAR constexpr weak_equality weak_equality::equivalent(_EqResult::__equiv);
|
||||
_LIBCPP_INLINE_VAR constexpr weak_equality weak_equality::nonequivalent(_EqResult::__nonequiv);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline constexpr bool operator==(weak_equality __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v.__value_ == _EqResult::__zero;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline constexpr bool operator==(_CmpUnspecifiedParam, weak_equality __v) noexcept {
|
||||
return __v.__value_ == _EqResult::__zero;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline constexpr bool operator!=(weak_equality __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v.__value_ != _EqResult::__zero;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline constexpr bool operator!=(_CmpUnspecifiedParam, weak_equality __v) noexcept {
|
||||
return __v.__value_ != _EqResult::__zero;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline constexpr weak_equality operator<=>(weak_equality __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline constexpr weak_equality operator<=>(_CmpUnspecifiedParam, weak_equality __v) noexcept {
|
||||
return __v;
|
||||
}
|
||||
#endif
|
||||
|
||||
class strong_equality {
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit constexpr strong_equality(_EqResult __val) noexcept : __value_(__val) {}
|
||||
|
||||
public:
|
||||
static const strong_equality equal;
|
||||
static const strong_equality nonequal;
|
||||
static const strong_equality equivalent;
|
||||
static const strong_equality nonequivalent;
|
||||
|
||||
// conversion
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr operator weak_equality() const noexcept {
|
||||
return __value_ == _EqResult::__zero ? weak_equality::equivalent
|
||||
: weak_equality::nonequivalent;
|
||||
}
|
||||
|
||||
// comparisons
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator==(strong_equality __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator!=(strong_equality __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator==(_CmpUnspecifiedParam, strong_equality __v) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator!=(_CmpUnspecifiedParam, strong_equality __v) noexcept;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr strong_equality operator<=>(strong_equality __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr strong_equality operator<=>(_CmpUnspecifiedParam, strong_equality __v) noexcept;
|
||||
#endif
|
||||
private:
|
||||
_EqResult __value_;
|
||||
};
|
||||
|
||||
_LIBCPP_INLINE_VAR constexpr strong_equality strong_equality::equal(_EqResult::__equal);
|
||||
_LIBCPP_INLINE_VAR constexpr strong_equality strong_equality::nonequal(_EqResult::__nonequal);
|
||||
_LIBCPP_INLINE_VAR constexpr strong_equality strong_equality::equivalent(_EqResult::__equiv);
|
||||
_LIBCPP_INLINE_VAR constexpr strong_equality strong_equality::nonequivalent(_EqResult::__nonequiv);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator==(strong_equality __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v.__value_ == _EqResult::__zero;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator==(_CmpUnspecifiedParam, strong_equality __v) noexcept {
|
||||
return __v.__value_ == _EqResult::__zero;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator!=(strong_equality __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v.__value_ != _EqResult::__zero;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator!=(_CmpUnspecifiedParam, strong_equality __v) noexcept {
|
||||
return __v.__value_ != _EqResult::__zero;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr strong_equality operator<=>(strong_equality __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr strong_equality operator<=>(_CmpUnspecifiedParam, strong_equality __v) noexcept {
|
||||
return __v;
|
||||
}
|
||||
#endif // _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
|
||||
|
||||
class partial_ordering {
|
||||
using _ValueT = signed char;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit constexpr partial_ordering(_EqResult __v) noexcept
|
||||
: __value_(_ValueT(__v)) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit constexpr partial_ordering(_OrdResult __v) noexcept
|
||||
: __value_(_ValueT(__v)) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit constexpr partial_ordering(_NCmpResult __v) noexcept
|
||||
: __value_(_ValueT(__v)) {}
|
||||
|
||||
constexpr bool __is_ordered() const noexcept {
|
||||
return __value_ != _ValueT(_NCmpResult::__unordered);
|
||||
}
|
||||
public:
|
||||
// valid values
|
||||
static const partial_ordering less;
|
||||
static const partial_ordering equivalent;
|
||||
static const partial_ordering greater;
|
||||
static const partial_ordering unordered;
|
||||
|
||||
// conversion
|
||||
constexpr operator weak_equality() const noexcept {
|
||||
return __value_ == 0 ? weak_equality::equivalent : weak_equality::nonequivalent;
|
||||
}
|
||||
|
||||
// comparisons
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator==(partial_ordering __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator!=(partial_ordering __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator< (partial_ordering __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator<=(partial_ordering __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator> (partial_ordering __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator>=(partial_ordering __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator==(_CmpUnspecifiedParam, partial_ordering __v) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator!=(_CmpUnspecifiedParam, partial_ordering __v) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator< (_CmpUnspecifiedParam, partial_ordering __v) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator<=(_CmpUnspecifiedParam, partial_ordering __v) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator> (_CmpUnspecifiedParam, partial_ordering __v) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator>=(_CmpUnspecifiedParam, partial_ordering __v) noexcept;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr partial_ordering operator<=>(partial_ordering __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr partial_ordering operator<=>(_CmpUnspecifiedParam, partial_ordering __v) noexcept;
|
||||
#endif
|
||||
|
||||
private:
|
||||
_ValueT __value_;
|
||||
};
|
||||
|
||||
_LIBCPP_INLINE_VAR constexpr partial_ordering partial_ordering::less(_OrdResult::__less);
|
||||
_LIBCPP_INLINE_VAR constexpr partial_ordering partial_ordering::equivalent(_EqResult::__equiv);
|
||||
_LIBCPP_INLINE_VAR constexpr partial_ordering partial_ordering::greater(_OrdResult::__greater);
|
||||
_LIBCPP_INLINE_VAR constexpr partial_ordering partial_ordering::unordered(_NCmpResult ::__unordered);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator==(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v.__is_ordered() && __v.__value_ == 0;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator< (partial_ordering __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v.__is_ordered() && __v.__value_ < 0;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator<=(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v.__is_ordered() && __v.__value_ <= 0;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator> (partial_ordering __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v.__is_ordered() && __v.__value_ > 0;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator>=(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v.__is_ordered() && __v.__value_ >= 0;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator==(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
|
||||
return __v.__is_ordered() && 0 == __v.__value_;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator< (_CmpUnspecifiedParam, partial_ordering __v) noexcept {
|
||||
return __v.__is_ordered() && 0 < __v.__value_;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator<=(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
|
||||
return __v.__is_ordered() && 0 <= __v.__value_;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator> (_CmpUnspecifiedParam, partial_ordering __v) noexcept {
|
||||
return __v.__is_ordered() && 0 > __v.__value_;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator>=(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
|
||||
return __v.__is_ordered() && 0 >= __v.__value_;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator!=(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
|
||||
return !__v.__is_ordered() || __v.__value_ != 0;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator!=(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
|
||||
return !__v.__is_ordered() || __v.__value_ != 0;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr partial_ordering operator<=>(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr partial_ordering operator<=>(_CmpUnspecifiedParam, partial_ordering __v) noexcept {
|
||||
return __v < 0 ? partial_ordering::greater : (__v > 0 ? partial_ordering::less : __v);
|
||||
}
|
||||
#endif // _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
|
||||
|
||||
class weak_ordering {
|
||||
using _ValueT = signed char;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit constexpr weak_ordering(_EqResult __v) noexcept : __value_(_ValueT(__v)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit constexpr weak_ordering(_OrdResult __v) noexcept : __value_(_ValueT(__v)) {}
|
||||
|
||||
public:
|
||||
static const weak_ordering less;
|
||||
static const weak_ordering equivalent;
|
||||
static const weak_ordering greater;
|
||||
|
||||
// conversions
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr operator weak_equality() const noexcept {
|
||||
return __value_ == 0 ? weak_equality::equivalent
|
||||
: weak_equality::nonequivalent;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr operator partial_ordering() const noexcept {
|
||||
return __value_ == 0 ? partial_ordering::equivalent
|
||||
: (__value_ < 0 ? partial_ordering::less : partial_ordering::greater);
|
||||
}
|
||||
|
||||
// comparisons
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator==(weak_ordering __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator!=(weak_ordering __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator< (weak_ordering __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator<=(weak_ordering __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator> (weak_ordering __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator>=(weak_ordering __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator==(_CmpUnspecifiedParam, weak_ordering __v) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator!=(_CmpUnspecifiedParam, weak_ordering __v) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator< (_CmpUnspecifiedParam, weak_ordering __v) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator<=(_CmpUnspecifiedParam, weak_ordering __v) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator> (_CmpUnspecifiedParam, weak_ordering __v) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator>=(_CmpUnspecifiedParam, weak_ordering __v) noexcept;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr weak_ordering operator<=>(weak_ordering __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr weak_ordering operator<=>(_CmpUnspecifiedParam, weak_ordering __v) noexcept;
|
||||
#endif
|
||||
|
||||
private:
|
||||
_ValueT __value_;
|
||||
};
|
||||
|
||||
_LIBCPP_INLINE_VAR constexpr weak_ordering weak_ordering::less(_OrdResult::__less);
|
||||
_LIBCPP_INLINE_VAR constexpr weak_ordering weak_ordering::equivalent(_EqResult::__equiv);
|
||||
_LIBCPP_INLINE_VAR constexpr weak_ordering weak_ordering::greater(_OrdResult::__greater);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator==(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v.__value_ == 0;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator!=(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v.__value_ != 0;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator< (weak_ordering __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v.__value_ < 0;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator<=(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v.__value_ <= 0;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator> (weak_ordering __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v.__value_ > 0;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator>=(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v.__value_ >= 0;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator==(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
|
||||
return 0 == __v.__value_;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator!=(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
|
||||
return 0 != __v.__value_;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator< (_CmpUnspecifiedParam, weak_ordering __v) noexcept {
|
||||
return 0 < __v.__value_;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator<=(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
|
||||
return 0 <= __v.__value_;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator> (_CmpUnspecifiedParam, weak_ordering __v) noexcept {
|
||||
return 0 > __v.__value_;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator>=(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
|
||||
return 0 >= __v.__value_;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr weak_ordering operator<=>(weak_ordering __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr weak_ordering operator<=>(_CmpUnspecifiedParam, weak_ordering __v) noexcept {
|
||||
return __v < 0 ? weak_ordering::greater : (__v > 0 ? weak_ordering::less : __v);
|
||||
}
|
||||
#endif // _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
|
||||
|
||||
class strong_ordering {
|
||||
using _ValueT = signed char;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit constexpr strong_ordering(_EqResult __v) noexcept : __value_(_ValueT(__v)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit constexpr strong_ordering(_OrdResult __v) noexcept : __value_(_ValueT(__v)) {}
|
||||
|
||||
public:
|
||||
static const strong_ordering less;
|
||||
static const strong_ordering equal;
|
||||
static const strong_ordering equivalent;
|
||||
static const strong_ordering greater;
|
||||
|
||||
// conversions
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr operator weak_equality() const noexcept {
|
||||
return __value_ == 0 ? weak_equality::equivalent
|
||||
: weak_equality::nonequivalent;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr operator strong_equality() const noexcept {
|
||||
return __value_ == 0 ? strong_equality::equal
|
||||
: strong_equality::nonequal;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr operator partial_ordering() const noexcept {
|
||||
return __value_ == 0 ? partial_ordering::equivalent
|
||||
: (__value_ < 0 ? partial_ordering::less : partial_ordering::greater);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr operator weak_ordering() const noexcept {
|
||||
return __value_ == 0 ? weak_ordering::equivalent
|
||||
: (__value_ < 0 ? weak_ordering::less : weak_ordering::greater);
|
||||
}
|
||||
|
||||
// comparisons
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator==(strong_ordering __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator!=(strong_ordering __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator< (strong_ordering __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator<=(strong_ordering __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator> (strong_ordering __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator>=(strong_ordering __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator==(_CmpUnspecifiedParam, strong_ordering __v) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator!=(_CmpUnspecifiedParam, strong_ordering __v) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator< (_CmpUnspecifiedParam, strong_ordering __v) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator<=(_CmpUnspecifiedParam, strong_ordering __v) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator> (_CmpUnspecifiedParam, strong_ordering __v) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr bool operator>=(_CmpUnspecifiedParam, strong_ordering __v) noexcept;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr strong_ordering operator<=>(strong_ordering __v, _CmpUnspecifiedParam) noexcept;
|
||||
_LIBCPP_INLINE_VISIBILITY friend constexpr strong_ordering operator<=>(_CmpUnspecifiedParam, strong_ordering __v) noexcept;
|
||||
#endif
|
||||
|
||||
private:
|
||||
_ValueT __value_;
|
||||
};
|
||||
|
||||
_LIBCPP_INLINE_VAR constexpr strong_ordering strong_ordering::less(_OrdResult::__less);
|
||||
_LIBCPP_INLINE_VAR constexpr strong_ordering strong_ordering::equal(_EqResult::__equal);
|
||||
_LIBCPP_INLINE_VAR constexpr strong_ordering strong_ordering::equivalent(_EqResult::__equiv);
|
||||
_LIBCPP_INLINE_VAR constexpr strong_ordering strong_ordering::greater(_OrdResult::__greater);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator==(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v.__value_ == 0;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator!=(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v.__value_ != 0;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator< (strong_ordering __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v.__value_ < 0;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator<=(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v.__value_ <= 0;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator> (strong_ordering __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v.__value_ > 0;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator>=(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v.__value_ >= 0;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator==(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
|
||||
return 0 == __v.__value_;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator!=(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
|
||||
return 0 != __v.__value_;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator< (_CmpUnspecifiedParam, strong_ordering __v) noexcept {
|
||||
return 0 < __v.__value_;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator<=(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
|
||||
return 0 <= __v.__value_;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator> (_CmpUnspecifiedParam, strong_ordering __v) noexcept {
|
||||
return 0 > __v.__value_;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool operator>=(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
|
||||
return 0 >= __v.__value_;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr strong_ordering operator<=>(strong_ordering __v, _CmpUnspecifiedParam) noexcept {
|
||||
return __v;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr strong_ordering operator<=>(_CmpUnspecifiedParam, strong_ordering __v) noexcept {
|
||||
return __v < 0 ? strong_ordering::greater : (__v > 0 ? strong_ordering::less : __v);
|
||||
}
|
||||
#endif // _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
|
||||
|
||||
// named comparison functions
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool is_eq(weak_equality __cmp) noexcept { return __cmp == 0; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool is_neq(weak_equality __cmp) noexcept { return __cmp != 0; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool is_lt(partial_ordering __cmp) noexcept { return __cmp < 0; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool is_lteq(partial_ordering __cmp) noexcept { return __cmp <= 0; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool is_gt(partial_ordering __cmp) noexcept { return __cmp > 0; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr bool is_gteq(partial_ordering __cmp) noexcept { return __cmp >= 0; }
|
||||
|
||||
namespace __comp_detail {
|
||||
|
||||
enum _ClassifyCompCategory : unsigned{
|
||||
_None,
|
||||
_WeakEq,
|
||||
_StrongEq,
|
||||
_PartialOrd,
|
||||
_WeakOrd,
|
||||
_StrongOrd,
|
||||
_CCC_Size
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr _ClassifyCompCategory __type_to_enum() noexcept {
|
||||
if (is_same_v<_Tp, weak_equality>)
|
||||
return _WeakEq;
|
||||
if (is_same_v<_Tp, strong_equality>)
|
||||
return _StrongEq;
|
||||
if (is_same_v<_Tp, partial_ordering>)
|
||||
return _PartialOrd;
|
||||
if (is_same_v<_Tp, weak_ordering>)
|
||||
return _WeakOrd;
|
||||
if (is_same_v<_Tp, strong_ordering>)
|
||||
return _StrongOrd;
|
||||
return _None;
|
||||
}
|
||||
|
||||
template <size_t _Size>
|
||||
constexpr _ClassifyCompCategory
|
||||
__compute_comp_type(std::array<_ClassifyCompCategory, _Size> __types) {
|
||||
std::array<int, _CCC_Size> __seen = {};
|
||||
for (auto __type : __types)
|
||||
++__seen[__type];
|
||||
if (__seen[_None])
|
||||
return _None;
|
||||
if (__seen[_WeakEq])
|
||||
return _WeakEq;
|
||||
if (__seen[_StrongEq] && (__seen[_PartialOrd] || __seen[_WeakOrd]))
|
||||
return _WeakEq;
|
||||
if (__seen[_StrongEq])
|
||||
return _StrongEq;
|
||||
if (__seen[_PartialOrd])
|
||||
return _PartialOrd;
|
||||
if (__seen[_WeakOrd])
|
||||
return _WeakOrd;
|
||||
return _StrongOrd;
|
||||
}
|
||||
|
||||
template <class ..._Ts>
|
||||
constexpr auto __get_comp_type() {
|
||||
using _CCC = _ClassifyCompCategory;
|
||||
constexpr array<_CCC, sizeof...(_Ts)> __type_kinds{{__comp_detail::__type_to_enum<_Ts>()...}};
|
||||
constexpr _CCC _Cat = sizeof...(_Ts) == 0 ? _StrongOrd
|
||||
: __compute_comp_type(__type_kinds);
|
||||
if constexpr (_Cat == _None)
|
||||
return void();
|
||||
else if constexpr (_Cat == _WeakEq)
|
||||
return weak_equality::equivalent;
|
||||
else if constexpr (_Cat == _StrongEq)
|
||||
return strong_equality::equivalent;
|
||||
else if constexpr (_Cat == _PartialOrd)
|
||||
return partial_ordering::equivalent;
|
||||
else if constexpr (_Cat == _WeakOrd)
|
||||
return weak_ordering::equivalent;
|
||||
else if constexpr (_Cat == _StrongOrd)
|
||||
return strong_ordering::equivalent;
|
||||
else
|
||||
static_assert(_Cat != _Cat, "unhandled case");
|
||||
}
|
||||
} // namespace __comp_detail
|
||||
|
||||
// [cmp.common], common comparison category type
|
||||
template<class... _Ts>
|
||||
struct _LIBCPP_TEMPLATE_VIS common_comparison_category {
|
||||
using type = decltype(__comp_detail::__get_comp_type<_Ts...>());
|
||||
};
|
||||
|
||||
template<class... _Ts>
|
||||
using common_comparison_category_t = typename common_comparison_category<_Ts...>::type;
|
||||
|
||||
// [cmp.alg], comparison algorithms
|
||||
// TODO: unimplemented
|
||||
template<class _Tp> constexpr strong_ordering strong_order(const _Tp& __lhs, const _Tp& __rhs);
|
||||
template<class _Tp> constexpr weak_ordering weak_order(const _Tp& __lhs, const _Tp& __rhs);
|
||||
template<class _Tp> constexpr partial_ordering partial_order(const _Tp& __lhs, const _Tp& __rhs);
|
||||
template<class _Tp> constexpr strong_equality strong_equal(const _Tp& __lhs, const _Tp& __rhs);
|
||||
template<class _Tp> constexpr weak_equality weak_equal(const _Tp& __lhs, const _Tp& __rhs);
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_COMPARE
|
@ -203,7 +203,7 @@ template<class T> complex<T> proj(const complex<T>&);
|
||||
template<Integral T> complex<double> proj(T);
|
||||
complex<float> proj(float);
|
||||
|
||||
template<class T> complex<T> polar(const T&, const T& = 0);
|
||||
template<class T> complex<T> polar(const T&, const T& = T());
|
||||
|
||||
// 26.3.8 transcendentals:
|
||||
template<class T> complex<T> acos(const complex<T>&);
|
||||
@ -991,7 +991,7 @@ proj(_Tp __re)
|
||||
|
||||
template<class _Tp>
|
||||
complex<_Tp>
|
||||
polar(const _Tp& __rho, const _Tp& __theta = _Tp(0))
|
||||
polar(const _Tp& __rho, const _Tp& __theta = _Tp())
|
||||
{
|
||||
if (__libcpp_isnan_or_builtin(__rho) || signbit(__rho))
|
||||
return complex<_Tp>(_Tp(NAN), _Tp(NAN));
|
||||
@ -1125,6 +1125,17 @@ pow(const _Tp& __x, const complex<_Up>& __y)
|
||||
return _VSTD::pow(result_type(__x), result_type(__y));
|
||||
}
|
||||
|
||||
// __sqr, computes pow(x, 2)
|
||||
|
||||
template<class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
complex<_Tp>
|
||||
__sqr(const complex<_Tp>& __x)
|
||||
{
|
||||
return complex<_Tp>((__x.real() - __x.imag()) * (__x.real() + __x.imag()),
|
||||
_Tp(2) * __x.real() * __x.imag());
|
||||
}
|
||||
|
||||
// asinh
|
||||
|
||||
template<class _Tp>
|
||||
@ -1150,7 +1161,7 @@ asinh(const complex<_Tp>& __x)
|
||||
}
|
||||
if (__libcpp_isinf_or_builtin(__x.imag()))
|
||||
return complex<_Tp>(copysign(__x.imag(), __x.real()), copysign(__pi/_Tp(2), __x.imag()));
|
||||
complex<_Tp> __z = log(__x + sqrt(pow(__x, _Tp(2)) + _Tp(1)));
|
||||
complex<_Tp> __z = log(__x + sqrt(__sqr(__x) + _Tp(1)));
|
||||
return complex<_Tp>(copysign(__z.real(), __x.real()), copysign(__z.imag(), __x.imag()));
|
||||
}
|
||||
|
||||
@ -1184,7 +1195,7 @@ acosh(const complex<_Tp>& __x)
|
||||
}
|
||||
if (__libcpp_isinf_or_builtin(__x.imag()))
|
||||
return complex<_Tp>(abs(__x.imag()), copysign(__pi/_Tp(2), __x.imag()));
|
||||
complex<_Tp> __z = log(__x + sqrt(pow(__x, _Tp(2)) - _Tp(1)));
|
||||
complex<_Tp> __z = log(__x + sqrt(__sqr(__x) - _Tp(1)));
|
||||
return complex<_Tp>(copysign(__z.real(), _Tp(0)), copysign(__z.imag(), __x.imag()));
|
||||
}
|
||||
|
||||
@ -1318,7 +1329,7 @@ acos(const complex<_Tp>& __x)
|
||||
return complex<_Tp>(__pi/_Tp(2), -__x.imag());
|
||||
if (__x.real() == 0 && (__x.imag() == 0 || isnan(__x.imag())))
|
||||
return complex<_Tp>(__pi/_Tp(2), -__x.imag());
|
||||
complex<_Tp> __z = log(__x + sqrt(pow(__x, _Tp(2)) - _Tp(1)));
|
||||
complex<_Tp> __z = log(__x + sqrt(__sqr(__x) - _Tp(1)));
|
||||
if (signbit(__x.imag()))
|
||||
return complex<_Tp>(abs(__z.imag()), abs(__z.real()));
|
||||
return complex<_Tp>(abs(__z.imag()), -abs(__z.real()));
|
||||
|
@ -128,6 +128,10 @@ public:
|
||||
void clear() noexcept;
|
||||
};
|
||||
|
||||
template <class InputIterator, class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
|
||||
deque(InputIterator, InputIterator, Allocator = Allocator())
|
||||
-> deque<typename iterator_traits<InputIterator>::value_type, Allocator>;
|
||||
|
||||
template <class T, class Allocator>
|
||||
bool operator==(const deque<T,Allocator>& x, const deque<T,Allocator>& y);
|
||||
template <class T, class Allocator>
|
||||
@ -921,13 +925,14 @@ class __deque_base
|
||||
{
|
||||
__deque_base(const __deque_base& __c);
|
||||
__deque_base& operator=(const __deque_base& __c);
|
||||
protected:
|
||||
typedef _Tp value_type;
|
||||
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::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;
|
||||
@ -946,6 +951,7 @@ protected:
|
||||
typedef __deque_iterator<value_type, const_pointer, const_reference, __map_const_pointer,
|
||||
difference_type> const_iterator;
|
||||
|
||||
protected:
|
||||
__map __map_;
|
||||
size_type __start_;
|
||||
__compressed_pair<size_type, allocator_type> __size_;
|
||||
@ -1461,6 +1467,23 @@ private:
|
||||
void __move_assign(deque& __c, false_type);
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
|
||||
template<class _InputIterator,
|
||||
class _Alloc = typename std::allocator<typename iterator_traits<_InputIterator>::value_type>,
|
||||
class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
|
||||
>
|
||||
deque(_InputIterator, _InputIterator)
|
||||
-> deque<typename iterator_traits<_InputIterator>::value_type, _Alloc>;
|
||||
|
||||
template<class _InputIterator,
|
||||
class _Alloc,
|
||||
class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
|
||||
>
|
||||
deque(_InputIterator, _InputIterator, _Alloc)
|
||||
-> deque<typename iterator_traits<_InputIterator>::value_type, _Alloc>;
|
||||
#endif
|
||||
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
deque<_Tp, _Allocator>::deque(size_type __n)
|
||||
{
|
||||
|
@ -259,7 +259,7 @@ struct __throw_with_nested;
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __throw_with_nested<_Tp, _Up, true> {
|
||||
_LIBCPP_NORETURN static inline _LIBCPP_ALWAYS_INLINE void
|
||||
_LIBCPP_NORETURN static inline _LIBCPP_INLINE_VISIBILITY void
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__do_throw(_Tp&& __t)
|
||||
#else
|
||||
@ -272,7 +272,7 @@ struct __throw_with_nested<_Tp, _Up, true> {
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __throw_with_nested<_Tp, _Up, false> {
|
||||
_LIBCPP_NORETURN static inline _LIBCPP_ALWAYS_INLINE void
|
||||
_LIBCPP_NORETURN static inline _LIBCPP_INLINE_VISIBILITY void
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__do_throw(_Tp&& __t)
|
||||
#else
|
||||
|
@ -52,6 +52,16 @@
|
||||
|
||||
#define _VSTD_CORO _VSTD_EXPERIMENTAL::coroutines_v1
|
||||
|
||||
#define _VSTD_FS ::std::experimental::filesystem::v1
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_SIMD \
|
||||
_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace parallelism_v2 {
|
||||
|
||||
#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL_SIMD \
|
||||
} _LIBCPP_END_NAMESPACE_EXPERIMENTAL
|
||||
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_SIMD_ABI \
|
||||
_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_SIMD namespace simd_abi {
|
||||
|
||||
#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL_SIMD_ABI \
|
||||
} _LIBCPP_END_NAMESPACE_EXPERIMENTAL_SIMD
|
||||
|
||||
#endif
|
||||
|
@ -23,11 +23,8 @@ inline namespace fundamentals_v1 {
|
||||
template <class ForwardIterator, class Searcher>
|
||||
ForwardIterator search(ForwardIterator first, ForwardIterator last,
|
||||
const Searcher &searcher);
|
||||
template <class PopulationIterator, class SampleIterator, class Distance,
|
||||
class UniformRandomNumberGenerator>
|
||||
SampleIterator sample(PopulationIterator first, PopulationIterator last,
|
||||
SampleIterator out, Distance n,
|
||||
UniformRandomNumberGenerator &&g);
|
||||
|
||||
// sample removed because it's now part of C++17
|
||||
|
||||
} // namespace fundamentals_v1
|
||||
} // namespace experimental
|
||||
@ -56,16 +53,6 @@ _LIBCPP_INLINE_VISIBILITY
|
||||
_ForwardIterator search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher &__s)
|
||||
{ return __s(__f, __l).first; }
|
||||
|
||||
|
||||
template <class _PopulationIterator, class _SampleIterator, class _Distance,
|
||||
class _UniformRandomNumberGenerator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_SampleIterator sample(_PopulationIterator __first, _PopulationIterator __last,
|
||||
_SampleIterator __output_iter, _Distance __n,
|
||||
_UniformRandomNumberGenerator &&__g) {
|
||||
return _VSTD::__sample(__first, __last, __output_iter, __n, __g);
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_LFTS
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
@ -8,585 +8,4 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_EXPERIMENTAL_ANY
|
||||
#define _LIBCPP_EXPERIMENTAL_ANY
|
||||
|
||||
/*
|
||||
experimental/any synopsis
|
||||
|
||||
namespace std {
|
||||
namespace experimental {
|
||||
inline namespace fundamentals_v1 {
|
||||
|
||||
class bad_any_cast : public bad_cast
|
||||
{
|
||||
public:
|
||||
virtual const char* what() const noexcept;
|
||||
};
|
||||
|
||||
class any
|
||||
{
|
||||
public:
|
||||
|
||||
// 6.3.1 any construct/destruct
|
||||
any() noexcept;
|
||||
|
||||
any(const any& other);
|
||||
any(any&& other) noexcept;
|
||||
|
||||
template <class ValueType>
|
||||
any(ValueType&& value);
|
||||
|
||||
~any();
|
||||
|
||||
// 6.3.2 any assignments
|
||||
any& operator=(const any& rhs);
|
||||
any& operator=(any&& rhs) noexcept;
|
||||
|
||||
template <class ValueType>
|
||||
any& operator=(ValueType&& rhs);
|
||||
|
||||
// 6.3.3 any modifiers
|
||||
void clear() noexcept;
|
||||
void swap(any& rhs) noexcept;
|
||||
|
||||
// 6.3.4 any observers
|
||||
bool empty() const noexcept;
|
||||
const type_info& type() const noexcept;
|
||||
};
|
||||
|
||||
// 6.4 Non-member functions
|
||||
void swap(any& x, any& y) noexcept;
|
||||
|
||||
template<class ValueType>
|
||||
ValueType any_cast(const any& operand);
|
||||
template<class ValueType>
|
||||
ValueType any_cast(any& operand);
|
||||
template<class ValueType>
|
||||
ValueType any_cast(any&& operand);
|
||||
|
||||
template<class ValueType>
|
||||
const ValueType* any_cast(const any* operand) noexcept;
|
||||
template<class ValueType>
|
||||
ValueType* any_cast(any* operand) noexcept;
|
||||
|
||||
} // namespace fundamentals_v1
|
||||
} // namespace experimental
|
||||
} // namespace std
|
||||
|
||||
*/
|
||||
|
||||
#include <experimental/__config>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
#include <typeinfo>
|
||||
#include <type_traits>
|
||||
#include <cstdlib>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_ANY_CAST bad_any_cast : public bad_cast
|
||||
{
|
||||
public:
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
#if _LIBCPP_STD_VER > 11 // C++ > 11
|
||||
|
||||
_LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
|
||||
void __throw_bad_any_cast()
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw bad_any_cast();
|
||||
#else
|
||||
_VSTD::abort();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Forward declarations
|
||||
class any;
|
||||
|
||||
template <class _ValueType>
|
||||
typename add_pointer<typename add_const<_ValueType>::type>::type
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
any_cast(any const *) _NOEXCEPT;
|
||||
|
||||
template <class _ValueType>
|
||||
typename add_pointer<_ValueType>::type
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
any_cast(any *) _NOEXCEPT;
|
||||
|
||||
namespace __any_imp
|
||||
{
|
||||
typedef typename aligned_storage<3*sizeof(void*), alignment_of<void*>::value>::type
|
||||
_Buffer;
|
||||
|
||||
template <class _Tp>
|
||||
struct _IsSmallObject
|
||||
: public integral_constant<bool
|
||||
, sizeof(_Tp) <= sizeof(_Buffer)
|
||||
&& alignment_of<_Buffer>::value
|
||||
% alignment_of<_Tp>::value == 0
|
||||
&& is_nothrow_move_constructible<_Tp>::value
|
||||
>
|
||||
{};
|
||||
|
||||
enum class _Action
|
||||
{
|
||||
_Destroy,
|
||||
_Copy,
|
||||
_Move,
|
||||
_Get,
|
||||
_TypeInfo
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct _SmallHandler;
|
||||
|
||||
template <class _Tp>
|
||||
struct _LargeHandler;
|
||||
|
||||
template <class _Tp>
|
||||
using _Handler = typename conditional<_IsSmallObject<_Tp>::value
|
||||
, _SmallHandler<_Tp>
|
||||
, _LargeHandler<_Tp>
|
||||
>::type;
|
||||
template <class _ValueType>
|
||||
using _EnableIfNotAny = typename
|
||||
enable_if<
|
||||
!is_same<typename decay<_ValueType>::type, any>::value
|
||||
>::type;
|
||||
|
||||
} // namespace __any_imp
|
||||
|
||||
class any
|
||||
{
|
||||
public:
|
||||
// 6.3.1 any construct/destruct
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
any() _NOEXCEPT : __h(nullptr) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
any(any const & __other) : __h(nullptr)
|
||||
{
|
||||
if (__other.__h) __other.__call(_Action::_Copy, this);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
any(any && __other) _NOEXCEPT : __h(nullptr)
|
||||
{
|
||||
if (__other.__h) __other.__call(_Action::_Move, this);
|
||||
}
|
||||
|
||||
template <
|
||||
class _ValueType
|
||||
, class = __any_imp::_EnableIfNotAny<_ValueType>
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
any(_ValueType && __value);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~any()
|
||||
{
|
||||
this->clear();
|
||||
}
|
||||
|
||||
// 6.3.2 any assignments
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
any & operator=(any const & __rhs)
|
||||
{
|
||||
any(__rhs).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
any & operator=(any && __rhs) _NOEXCEPT
|
||||
{
|
||||
any(_VSTD::move(__rhs)).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <
|
||||
class _ValueType
|
||||
, class = __any_imp::_EnableIfNotAny<_ValueType>
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
any & operator=(_ValueType && __rhs);
|
||||
|
||||
// 6.3.3 any modifiers
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() _NOEXCEPT
|
||||
{
|
||||
if (__h) this->__call(_Action::_Destroy);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(any & __rhs) _NOEXCEPT;
|
||||
|
||||
// 6.3.4 any observers
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const _NOEXCEPT
|
||||
{
|
||||
return __h == nullptr;
|
||||
}
|
||||
|
||||
#if !defined(_LIBCPP_NO_RTTI)
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const type_info & type() const _NOEXCEPT
|
||||
{
|
||||
if (__h) {
|
||||
return *static_cast<type_info const *>(this->__call(_Action::_TypeInfo));
|
||||
} else {
|
||||
return typeid(void);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
typedef __any_imp::_Action _Action;
|
||||
|
||||
typedef void* (*_HandleFuncPtr)(_Action, any const *, any *, const type_info *);
|
||||
|
||||
union _Storage
|
||||
{
|
||||
void * __ptr;
|
||||
__any_imp::_Buffer __buf;
|
||||
};
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
void * __call(_Action __a, any * __other = nullptr,
|
||||
type_info const * __info = nullptr) const
|
||||
{
|
||||
return __h(__a, this, __other, __info);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
void * __call(_Action __a, any * __other = nullptr,
|
||||
type_info const * __info = nullptr)
|
||||
{
|
||||
return __h(__a, this, __other, __info);
|
||||
}
|
||||
|
||||
template <class>
|
||||
friend struct __any_imp::_SmallHandler;
|
||||
template <class>
|
||||
friend struct __any_imp::_LargeHandler;
|
||||
|
||||
template <class _ValueType>
|
||||
friend typename add_pointer<typename add_const<_ValueType>::type>::type
|
||||
any_cast(any const *) _NOEXCEPT;
|
||||
|
||||
template <class _ValueType>
|
||||
friend typename add_pointer<_ValueType>::type
|
||||
any_cast(any *) _NOEXCEPT;
|
||||
|
||||
_HandleFuncPtr __h;
|
||||
_Storage __s;
|
||||
};
|
||||
|
||||
namespace __any_imp
|
||||
{
|
||||
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TEMPLATE_VIS _SmallHandler
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void* __handle(_Action __act, any const * __this, any * __other,
|
||||
type_info const * __info)
|
||||
{
|
||||
switch (__act)
|
||||
{
|
||||
case _Action::_Destroy:
|
||||
__destroy(const_cast<any &>(*__this));
|
||||
return nullptr;
|
||||
case _Action::_Copy:
|
||||
__copy(*__this, *__other);
|
||||
return nullptr;
|
||||
case _Action::_Move:
|
||||
__move(const_cast<any &>(*__this), *__other);
|
||||
return nullptr;
|
||||
case _Action::_Get:
|
||||
return __get(const_cast<any &>(*__this), __info);
|
||||
case _Action::_TypeInfo:
|
||||
return __type_info();
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __create(any & __dest, _Up && __v)
|
||||
{
|
||||
::new (static_cast<void*>(&__dest.__s.__buf)) _Tp(_VSTD::forward<_Up>(__v));
|
||||
__dest.__h = &_SmallHandler::__handle;
|
||||
}
|
||||
|
||||
private:
|
||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
||||
static void __destroy(any & __this)
|
||||
{
|
||||
_Tp & __value = *static_cast<_Tp *>(static_cast<void*>(&__this.__s.__buf));
|
||||
__value.~_Tp();
|
||||
__this.__h = nullptr;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
||||
static void __copy(any const & __this, any & __dest)
|
||||
{
|
||||
_SmallHandler::__create(__dest, *static_cast<_Tp const *>(
|
||||
static_cast<void const *>(&__this.__s.__buf)));
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
||||
static void __move(any & __this, any & __dest)
|
||||
{
|
||||
_SmallHandler::__create(__dest, _VSTD::move(
|
||||
*static_cast<_Tp*>(static_cast<void*>(&__this.__s.__buf))));
|
||||
__destroy(__this);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
||||
static void* __get(any & __this, type_info const * __info)
|
||||
{
|
||||
#if !defined(_LIBCPP_NO_RTTI)
|
||||
if (typeid(_Tp) == *__info) {
|
||||
return static_cast<void*>(&__this.__s.__buf);
|
||||
}
|
||||
return nullptr;
|
||||
#else
|
||||
return static_cast<void*>(&__this.__s.__buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
||||
static void* __type_info()
|
||||
{
|
||||
#if !defined(_LIBCPP_NO_RTTI)
|
||||
return const_cast<void*>(static_cast<void const *>(&typeid(_Tp)));
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TEMPLATE_VIS _LargeHandler
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void* __handle(_Action __act, any const * __this, any * __other,
|
||||
type_info const * __info)
|
||||
{
|
||||
switch (__act)
|
||||
{
|
||||
case _Action::_Destroy:
|
||||
__destroy(const_cast<any &>(*__this));
|
||||
return nullptr;
|
||||
case _Action::_Copy:
|
||||
__copy(*__this, *__other);
|
||||
return nullptr;
|
||||
case _Action::_Move:
|
||||
__move(const_cast<any &>(*__this), *__other);
|
||||
return nullptr;
|
||||
case _Action::_Get:
|
||||
return __get(const_cast<any &>(*__this), __info);
|
||||
case _Action::_TypeInfo:
|
||||
return __type_info();
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __create(any & __dest, _Up && __v)
|
||||
{
|
||||
typedef allocator<_Tp> _Alloc;
|
||||
typedef __allocator_destructor<_Alloc> _Dp;
|
||||
_Alloc __a;
|
||||
unique_ptr<_Tp, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new ((void*)__hold.get()) _Tp(_VSTD::forward<_Up>(__v));
|
||||
__dest.__s.__ptr = __hold.release();
|
||||
__dest.__h = &_LargeHandler::__handle;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
||||
static void __destroy(any & __this)
|
||||
{
|
||||
delete static_cast<_Tp*>(__this.__s.__ptr);
|
||||
__this.__h = nullptr;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
||||
static void __copy(any const & __this, any & __dest)
|
||||
{
|
||||
_LargeHandler::__create(__dest, *static_cast<_Tp const *>(__this.__s.__ptr));
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
||||
static void __move(any & __this, any & __dest)
|
||||
{
|
||||
__dest.__s.__ptr = __this.__s.__ptr;
|
||||
__dest.__h = &_LargeHandler::__handle;
|
||||
__this.__h = nullptr;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
||||
static void* __get(any & __this, type_info const * __info)
|
||||
{
|
||||
#if !defined(_LIBCPP_NO_RTTI)
|
||||
if (typeid(_Tp) == *__info) {
|
||||
return static_cast<void*>(__this.__s.__ptr);
|
||||
}
|
||||
return nullptr;
|
||||
#else
|
||||
return static_cast<void*>(__this.__s.__ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
||||
static void* __type_info()
|
||||
{
|
||||
#if !defined(_LIBCPP_NO_RTTI)
|
||||
return const_cast<void*>(static_cast<void const *>(&typeid(_Tp)));
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace __any_imp
|
||||
|
||||
|
||||
template <class _ValueType, class>
|
||||
any::any(_ValueType && __v) : __h(nullptr)
|
||||
{
|
||||
typedef typename decay<_ValueType>::type _Tp;
|
||||
static_assert(is_copy_constructible<_Tp>::value,
|
||||
"_ValueType must be CopyConstructible.");
|
||||
typedef __any_imp::_Handler<_Tp> _HandlerType;
|
||||
_HandlerType::__create(*this, _VSTD::forward<_ValueType>(__v));
|
||||
}
|
||||
|
||||
template <class _ValueType, class>
|
||||
any & any::operator=(_ValueType && __v)
|
||||
{
|
||||
typedef typename decay<_ValueType>::type _Tp;
|
||||
static_assert(is_copy_constructible<_Tp>::value,
|
||||
"_ValueType must be CopyConstructible.");
|
||||
any(_VSTD::forward<_ValueType>(__v)).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
void any::swap(any & __rhs) _NOEXCEPT
|
||||
{
|
||||
if (__h && __rhs.__h) {
|
||||
any __tmp;
|
||||
__rhs.__call(_Action::_Move, &__tmp);
|
||||
this->__call(_Action::_Move, &__rhs);
|
||||
__tmp.__call(_Action::_Move, this);
|
||||
}
|
||||
else if (__h) {
|
||||
this->__call(_Action::_Move, &__rhs);
|
||||
}
|
||||
else if (__rhs.__h) {
|
||||
__rhs.__call(_Action::_Move, this);
|
||||
}
|
||||
}
|
||||
|
||||
// 6.4 Non-member functions
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void swap(any & __lhs, any & __rhs) _NOEXCEPT
|
||||
{
|
||||
__lhs.swap(__rhs);
|
||||
}
|
||||
|
||||
template <class _ValueType>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
|
||||
_ValueType any_cast(any const & __v)
|
||||
{
|
||||
static_assert(
|
||||
is_reference<_ValueType>::value
|
||||
|| is_copy_constructible<_ValueType>::value,
|
||||
"_ValueType is required to be a reference or a CopyConstructible type.");
|
||||
typedef typename add_const<typename remove_reference<_ValueType>::type>::type
|
||||
_Tp;
|
||||
_Tp * __tmp = any_cast<_Tp>(&__v);
|
||||
if (__tmp == nullptr)
|
||||
__throw_bad_any_cast();
|
||||
return *__tmp;
|
||||
}
|
||||
|
||||
template <class _ValueType>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
|
||||
_ValueType any_cast(any & __v)
|
||||
{
|
||||
static_assert(
|
||||
is_reference<_ValueType>::value
|
||||
|| is_copy_constructible<_ValueType>::value,
|
||||
"_ValueType is required to be a reference or a CopyConstructible type.");
|
||||
typedef typename remove_reference<_ValueType>::type _Tp;
|
||||
_Tp * __tmp = any_cast<_Tp>(&__v);
|
||||
if (__tmp == nullptr)
|
||||
__throw_bad_any_cast();
|
||||
return *__tmp;
|
||||
}
|
||||
|
||||
template <class _ValueType>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
|
||||
_ValueType any_cast(any && __v)
|
||||
{
|
||||
static_assert(
|
||||
is_reference<_ValueType>::value
|
||||
|| is_copy_constructible<_ValueType>::value,
|
||||
"_ValueType is required to be a reference or a CopyConstructible type.");
|
||||
typedef typename remove_reference<_ValueType>::type _Tp;
|
||||
_Tp * __tmp = any_cast<_Tp>(&__v);
|
||||
if (__tmp == nullptr)
|
||||
__throw_bad_any_cast();
|
||||
return *__tmp;
|
||||
}
|
||||
|
||||
template <class _ValueType>
|
||||
inline
|
||||
typename add_pointer<typename add_const<_ValueType>::type>::type
|
||||
any_cast(any const * __any) _NOEXCEPT
|
||||
{
|
||||
static_assert(!is_reference<_ValueType>::value,
|
||||
"_ValueType may not be a reference.");
|
||||
return any_cast<_ValueType>(const_cast<any *>(__any));
|
||||
}
|
||||
|
||||
template <class _ValueType>
|
||||
typename add_pointer<_ValueType>::type
|
||||
any_cast(any * __any) _NOEXCEPT
|
||||
{
|
||||
using __any_imp::_Action;
|
||||
static_assert(!is_reference<_ValueType>::value,
|
||||
"_ValueType may not be a reference.");
|
||||
typedef typename add_pointer<_ValueType>::type _ReturnType;
|
||||
if (__any && __any->__h) {
|
||||
|
||||
return static_cast<_ReturnType>(
|
||||
__any->__call(_Action::_Get, nullptr,
|
||||
#if !defined(_LIBCPP_NO_RTTI)
|
||||
&typeid(_ValueType)
|
||||
#else
|
||||
nullptr
|
||||
#endif
|
||||
));
|
||||
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 11
|
||||
|
||||
_LIBCPP_END_NAMESPACE_LFTS
|
||||
|
||||
#endif // _LIBCPP_EXPERIMENTAL_ANY
|
||||
#error "<experimental/any> has been removed. Use <any> instead."
|
||||
|
@ -8,52 +8,4 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_EXPERIMENTAL_CHRONO
|
||||
#define _LIBCPP_EXPERIMENTAL_CHRONO
|
||||
|
||||
/**
|
||||
experimental/chrono synopsis
|
||||
|
||||
// C++1y
|
||||
|
||||
#include <chrono>
|
||||
|
||||
namespace std {
|
||||
namespace chrono {
|
||||
namespace experimental {
|
||||
inline namespace fundamentals_v1 {
|
||||
|
||||
// See C++14 20.12.4, customization traits
|
||||
template <class Rep> constexpr bool treat_as_floating_point_v
|
||||
= treat_as_floating_point<Rep>::value;
|
||||
|
||||
} // namespace fundamentals_v1
|
||||
} // namespace experimental
|
||||
} // namespace chrono
|
||||
} // namespace std
|
||||
|
||||
*/
|
||||
|
||||
#include <experimental/__config>
|
||||
#include <chrono>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_CHRONO_LFTS
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
||||
|
||||
template <class _Rep> _LIBCPP_CONSTEXPR bool treat_as_floating_point_v
|
||||
= treat_as_floating_point<_Rep>::value;
|
||||
|
||||
#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */
|
||||
|
||||
_LIBCPP_END_NAMESPACE_CHRONO_LFTS
|
||||
|
||||
#endif /* _LIBCPP_STD_VER > 11 */
|
||||
|
||||
#endif /* _LIBCPP_EXPERIMENTAL_CHRONO */
|
||||
#error "<experimental/chrono> has been removed. Use <chrono> instead."
|
||||
|
@ -93,28 +93,28 @@ class _LIBCPP_TEMPLATE_VIS coroutine_handle;
|
||||
template <>
|
||||
class _LIBCPP_TEMPLATE_VIS coroutine_handle<void> {
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR coroutine_handle() _NOEXCEPT : __handle_(nullptr) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR coroutine_handle(nullptr_t) _NOEXCEPT : __handle_(nullptr) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
coroutine_handle& operator=(nullptr_t) _NOEXCEPT {
|
||||
__handle_ = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR void* address() const _NOEXCEPT { return __handle_; }
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR explicit operator bool() const _NOEXCEPT { return __handle_; }
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void operator()() { resume(); }
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void resume() {
|
||||
_LIBCPP_ASSERT(__is_suspended(),
|
||||
"resume() can only be called on suspended coroutines");
|
||||
@ -123,14 +123,14 @@ public:
|
||||
__builtin_coro_resume(__handle_);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void destroy() {
|
||||
_LIBCPP_ASSERT(__is_suspended(),
|
||||
"destroy() can only be called on suspended coroutines");
|
||||
__builtin_coro_destroy(__handle_);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool done() const {
|
||||
_LIBCPP_ASSERT(__is_suspended(),
|
||||
"done() can only be called on suspended coroutines");
|
||||
@ -138,7 +138,7 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static coroutine_handle from_address(void* __addr) _NOEXCEPT {
|
||||
coroutine_handle __tmp;
|
||||
__tmp.__handle_ = __addr;
|
||||
@ -146,7 +146,7 @@ public:
|
||||
}
|
||||
|
||||
// FIXME: Should from_address(nullptr) be allowed?
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static coroutine_handle from_address(nullptr_t) _NOEXCEPT {
|
||||
return coroutine_handle(nullptr);
|
||||
}
|
||||
@ -169,27 +169,27 @@ private:
|
||||
};
|
||||
|
||||
// 18.11.2.7 comparison operators:
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
|
||||
return __x.address() == __y.address();
|
||||
}
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
|
||||
return !(__x == __y);
|
||||
}
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator<(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
|
||||
return less<void*>()(__x.address(), __y.address());
|
||||
}
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator>(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
|
||||
return __y < __x;
|
||||
}
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator<=(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
|
||||
return !(__x > __y);
|
||||
}
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator>=(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
|
||||
return !(__x < __y);
|
||||
}
|
||||
@ -202,8 +202,8 @@ public:
|
||||
// 18.11.2.1 construct/reset
|
||||
using coroutine_handle<>::coroutine_handle;
|
||||
#else
|
||||
_LIBCPP_ALWAYS_INLINE coroutine_handle() _NOEXCEPT : _Base() {}
|
||||
_LIBCPP_ALWAYS_INLINE coroutine_handle(nullptr_t) _NOEXCEPT : _Base(nullptr) {}
|
||||
_LIBCPP_INLINE_VISIBILITY coroutine_handle() _NOEXCEPT : _Base() {}
|
||||
_LIBCPP_INLINE_VISIBILITY coroutine_handle(nullptr_t) _NOEXCEPT : _Base(nullptr) {}
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
coroutine_handle& operator=(nullptr_t) _NOEXCEPT {
|
||||
@ -213,12 +213,12 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Promise& promise() const {
|
||||
return *reinterpret_cast<_Promise*>(
|
||||
return *static_cast<_Promise*>(
|
||||
__builtin_coro_promise(this->__handle_, __alignof(_Promise), false));
|
||||
}
|
||||
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static coroutine_handle from_address(void* __addr) _NOEXCEPT {
|
||||
coroutine_handle __tmp;
|
||||
__tmp.__handle_ = __addr;
|
||||
@ -229,7 +229,7 @@ public:
|
||||
// the deleted _Promise* overload doesn't make from_address(nullptr)
|
||||
// ambiguous.
|
||||
// FIXME: should from_address work with nullptr?
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static coroutine_handle from_address(nullptr_t) _NOEXCEPT {
|
||||
return coroutine_handle(nullptr);
|
||||
}
|
||||
@ -248,7 +248,7 @@ public:
|
||||
"pointers to the coroutine's promise type; use 'from_promise' instead");
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static coroutine_handle from_promise(_Promise& __promise) _NOEXCEPT {
|
||||
typedef typename remove_cv<_Promise>::type _RawPromise;
|
||||
coroutine_handle __tmp;
|
||||
@ -259,21 +259,61 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#if __has_builtin(__builtin_coro_noop)
|
||||
struct noop_coroutine_promise {};
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TEMPLATE_VIS coroutine_handle<noop_coroutine_promise>
|
||||
: public coroutine_handle<> {
|
||||
using _Base = coroutine_handle<>;
|
||||
using _Promise = noop_coroutine_promise;
|
||||
public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Promise& promise() const {
|
||||
return *static_cast<_Promise*>(
|
||||
__builtin_coro_promise(this->__handle_, __alignof(_Promise), false));
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR explicit operator bool() const _NOEXCEPT { return true; }
|
||||
_LIBCPP_CONSTEXPR bool done() const _NOEXCEPT { return false; }
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX17 void operator()() const _NOEXCEPT {}
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX17 void resume() const _NOEXCEPT {}
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX17 void destroy() const _NOEXCEPT {}
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
friend coroutine_handle<noop_coroutine_promise> noop_coroutine() _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY coroutine_handle() _NOEXCEPT {
|
||||
this->__handle_ = __builtin_coro_noop();
|
||||
}
|
||||
};
|
||||
|
||||
using noop_coroutine_handle = coroutine_handle<noop_coroutine_promise>;
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
noop_coroutine_handle noop_coroutine() _NOEXCEPT {
|
||||
return noop_coroutine_handle();
|
||||
}
|
||||
#endif // __has_builtin(__builtin_coro_noop)
|
||||
|
||||
struct _LIBCPP_TYPE_VIS suspend_never {
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool await_ready() const _NOEXCEPT { return true; }
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void await_suspend(coroutine_handle<>) const _NOEXCEPT {}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void await_resume() const _NOEXCEPT {}
|
||||
};
|
||||
|
||||
struct _LIBCPP_TYPE_VIS suspend_always {
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool await_ready() const _NOEXCEPT { return false; }
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void await_suspend(coroutine_handle<>) const _NOEXCEPT {}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void await_resume() const _NOEXCEPT {}
|
||||
};
|
||||
|
||||
|
@ -133,19 +133,20 @@ public:
|
||||
private:
|
||||
size_t __size_;
|
||||
value_type * __base_;
|
||||
_LIBCPP_ALWAYS_INLINE dynarray () noexcept : __size_(0), __base_(nullptr) {}
|
||||
_LIBCPP_INLINE_VISIBILITY dynarray () noexcept : __size_(0), __base_(nullptr) {}
|
||||
|
||||
static inline _LIBCPP_INLINE_VISIBILITY value_type* __allocate ( size_t count )
|
||||
{
|
||||
if ( numeric_limits<size_t>::max() / sizeof (value_type) <= count )
|
||||
static inline _LIBCPP_INLINE_VISIBILITY
|
||||
value_type* __allocate(size_t __count) {
|
||||
if (numeric_limits<size_t>::max() / sizeof (value_type) <= __count)
|
||||
__throw_bad_array_length();
|
||||
|
||||
return static_cast<value_type *> (_VSTD::__allocate (sizeof(value_type) * count));
|
||||
return static_cast<value_type *>(
|
||||
_VSTD::__libcpp_allocate(sizeof(value_type) * __count, __alignof(value_type)));
|
||||
}
|
||||
|
||||
static inline _LIBCPP_INLINE_VISIBILITY void __deallocate_value( value_type* __ptr ) noexcept
|
||||
{
|
||||
_VSTD::__libcpp_deallocate (static_cast<void *> (__ptr));
|
||||
static inline _LIBCPP_INLINE_VISIBILITY
|
||||
void __deallocate_value(value_type* __ptr ) noexcept {
|
||||
_VSTD::__libcpp_deallocate(static_cast<void *>(__ptr), __alignof(value_type));
|
||||
}
|
||||
|
||||
public:
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -241,8 +241,8 @@ public:
|
||||
operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const
|
||||
{
|
||||
static_assert ( std::is_same<
|
||||
typename std::decay<typename std::iterator_traits<_RandomAccessIterator1>::value_type>::type,
|
||||
typename std::decay<typename std::iterator_traits<_RandomAccessIterator2>::value_type>::type
|
||||
typename std::__uncvref<typename std::iterator_traits<_RandomAccessIterator1>::value_type>::type,
|
||||
typename std::__uncvref<typename std::iterator_traits<_RandomAccessIterator2>::value_type>::type
|
||||
>::value,
|
||||
"Corpus and Pattern iterators must point to the same type" );
|
||||
|
||||
@ -394,8 +394,8 @@ public:
|
||||
operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const
|
||||
{
|
||||
static_assert ( std::is_same<
|
||||
typename std::decay<typename std::iterator_traits<_RandomAccessIterator1>::value_type>::type,
|
||||
typename std::decay<typename std::iterator_traits<_RandomAccessIterator2>::value_type>::type
|
||||
typename std::__uncvref<typename std::iterator_traits<_RandomAccessIterator1>::value_type>::type,
|
||||
typename std::__uncvref<typename std::iterator_traits<_RandomAccessIterator2>::value_type>::type
|
||||
>::value,
|
||||
"Corpus and Pattern iterators must point to the same type" );
|
||||
|
||||
|
@ -71,7 +71,7 @@ namespace pmr {
|
||||
#include <memory>
|
||||
#include <new>
|
||||
#include <stdexcept>
|
||||
#include <tuple>
|
||||
#include <__tuple>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <cstddef>
|
||||
@ -96,7 +96,7 @@ size_t __aligned_allocation_size(size_t __s, size_t __a) _NOEXCEPT
|
||||
}
|
||||
|
||||
// 8.5, memory.resource
|
||||
class _LIBCPP_TEMPLATE_VIS memory_resource
|
||||
class _LIBCPP_TYPE_VIS memory_resource
|
||||
{
|
||||
static const size_t __max_align = alignof(max_align_t);
|
||||
|
||||
@ -206,7 +206,7 @@ public:
|
||||
void construct(_Tp* __p, _Ts &&... __args)
|
||||
{
|
||||
_VSTD_LFTS::__lfts_user_alloc_construct(
|
||||
__p, resource(), _VSTD::forward<_Ts>(__args)...
|
||||
__p, *this, _VSTD::forward<_Ts>(__args)...
|
||||
);
|
||||
}
|
||||
|
||||
@ -218,14 +218,14 @@ public:
|
||||
::new ((void*)__p) pair<_T1, _T2>(piecewise_construct
|
||||
, __transform_tuple(
|
||||
typename __lfts_uses_alloc_ctor<
|
||||
_T1, memory_resource*, _Args1...
|
||||
_T1, polymorphic_allocator&, _Args1...
|
||||
>::type()
|
||||
, _VSTD::move(__x)
|
||||
, typename __make_tuple_indices<sizeof...(_Args1)>::type{}
|
||||
)
|
||||
, __transform_tuple(
|
||||
typename __lfts_uses_alloc_ctor<
|
||||
_T2, memory_resource*, _Args2...
|
||||
_T2, polymorphic_allocator&, _Args2...
|
||||
>::type()
|
||||
, _VSTD::move(__y)
|
||||
, typename __make_tuple_indices<sizeof...(_Args2)>::type{}
|
||||
@ -289,23 +289,23 @@ private:
|
||||
|
||||
template <class ..._Args, size_t ..._Idx>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple<allocator_arg_t const&, memory_resource*, _Args&&...>
|
||||
tuple<allocator_arg_t const&, polymorphic_allocator&, _Args&&...>
|
||||
__transform_tuple(integral_constant<int, 1>, tuple<_Args...> && __t,
|
||||
__tuple_indices<_Idx...>) const
|
||||
__tuple_indices<_Idx...>)
|
||||
{
|
||||
using _Tup = tuple<allocator_arg_t const&, memory_resource*, _Args&&...>;
|
||||
return _Tup(allocator_arg, resource(),
|
||||
using _Tup = tuple<allocator_arg_t const&, polymorphic_allocator&, _Args&&...>;
|
||||
return _Tup(allocator_arg, *this,
|
||||
_VSTD::get<_Idx>(_VSTD::move(__t))...);
|
||||
}
|
||||
|
||||
template <class ..._Args, size_t ..._Idx>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple<_Args&&..., memory_resource*>
|
||||
tuple<_Args&&..., polymorphic_allocator&>
|
||||
__transform_tuple(integral_constant<int, 2>, tuple<_Args...> && __t,
|
||||
__tuple_indices<_Idx...>) const
|
||||
__tuple_indices<_Idx...>)
|
||||
{
|
||||
using _Tup = tuple<_Args&&..., memory_resource*>;
|
||||
return _Tup(_VSTD::get<_Idx>(_VSTD::move(__t))..., resource());
|
||||
using _Tup = tuple<_Args&&..., polymorphic_allocator&>;
|
||||
return _Tup(_VSTD::get<_Idx>(_VSTD::move(__t))..., *this);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
|
@ -8,112 +8,4 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_EXPERIMENTAL_NUMERIC
|
||||
#define _LIBCPP_EXPERIMENTAL_NUMERIC
|
||||
/*
|
||||
experimental/numeric synopsis
|
||||
|
||||
// C++1z
|
||||
namespace std {
|
||||
namespace experimental {
|
||||
inline namespace fundamentals_v2 {
|
||||
|
||||
// 13.1.2, Greatest common divisor
|
||||
template<class M, class N>
|
||||
constexpr common_type_t<M,N> gcd(M m, N n);
|
||||
|
||||
// 13.1.3, Least common multiple
|
||||
template<class M, class N>
|
||||
constexpr common_type_t<M,N> lcm(M m, N n);
|
||||
|
||||
} // namespace fundamentals_v2
|
||||
} // namespace experimental
|
||||
} // namespace std
|
||||
|
||||
*/
|
||||
|
||||
#include <experimental/__config>
|
||||
#include <numeric>
|
||||
#include <type_traits> // is_integral
|
||||
#include <limits> // numeric_limits
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_LFTS_V2
|
||||
|
||||
template <typename _Result, typename _Source, bool _IsSigned = is_signed<_Source>::value> struct __abs;
|
||||
|
||||
template <typename _Result, typename _Source>
|
||||
struct __abs<_Result, _Source, true> {
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
_Result operator()(_Source __t) const noexcept
|
||||
{
|
||||
if (__t >= 0) return __t;
|
||||
if (__t == numeric_limits<_Source>::min()) return -static_cast<_Result>(__t);
|
||||
return -__t;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename _Result, typename _Source>
|
||||
struct __abs<_Result, _Source, false> {
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
_Result operator()(_Source __t) const noexcept { return __t; }
|
||||
};
|
||||
|
||||
|
||||
template<class _Tp>
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_HIDDEN
|
||||
inline _Tp __gcd(_Tp __m, _Tp __n)
|
||||
{
|
||||
static_assert((!is_signed<_Tp>::value), "" );
|
||||
return __n == 0 ? __m : _VSTD_LFTS_V2::__gcd<_Tp>(__n, __m % __n);
|
||||
}
|
||||
|
||||
|
||||
template<class _Tp, class _Up>
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
common_type_t<_Tp,_Up>
|
||||
gcd(_Tp __m, _Up __n)
|
||||
{
|
||||
static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to gcd must be integer types");
|
||||
static_assert((!is_same<typename remove_cv<_Tp>::type, bool>::value), "First argument to gcd cannot be bool" );
|
||||
static_assert((!is_same<typename remove_cv<_Up>::type, bool>::value), "Second argument to gcd cannot be bool" );
|
||||
using _Rp = common_type_t<_Tp,_Up>;
|
||||
using _Wp = make_unsigned_t<_Rp>;
|
||||
return static_cast<_Rp>(_VSTD_LFTS_V2::__gcd(
|
||||
static_cast<_Wp>(__abs<_Rp, _Tp>()(__m)),
|
||||
static_cast<_Wp>(__abs<_Rp, _Up>()(__n))));
|
||||
}
|
||||
|
||||
template<class _Tp, class _Up>
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
common_type_t<_Tp,_Up>
|
||||
lcm(_Tp __m, _Up __n)
|
||||
{
|
||||
static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to lcm must be integer types");
|
||||
static_assert((!is_same<typename remove_cv<_Tp>::type, bool>::value), "First argument to lcm cannot be bool" );
|
||||
static_assert((!is_same<typename remove_cv<_Up>::type, bool>::value), "Second argument to lcm cannot be bool" );
|
||||
if (__m == 0 || __n == 0)
|
||||
return 0;
|
||||
|
||||
using _Rp = common_type_t<_Tp,_Up>;
|
||||
_Rp __val1 = __abs<_Rp, _Tp>()(__m) / _VSTD_LFTS_V2::gcd(__m, __n);
|
||||
_Rp __val2 = __abs<_Rp, _Up>()(__n);
|
||||
_LIBCPP_ASSERT((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm");
|
||||
return __val1 * __val2;
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_LFTS_V2
|
||||
|
||||
#endif /* _LIBCPP_STD_VER > 11 */
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif /* _LIBCPP_EXPERIMENTAL_NUMERIC */
|
||||
#error "<experimental/numeric> has been removed. Use <numeric> instead."
|
||||
|
@ -8,915 +8,4 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_EXPERIMENTAL_OPTIONAL
|
||||
#define _LIBCPP_EXPERIMENTAL_OPTIONAL
|
||||
|
||||
/*
|
||||
optional synopsis
|
||||
|
||||
// C++1y
|
||||
|
||||
namespace std { namespace experimental { inline namespace fundamentals_v1 {
|
||||
|
||||
// 5.3, optional for object types
|
||||
template <class T> class optional;
|
||||
|
||||
// 5.4, In-place construction
|
||||
struct in_place_t{};
|
||||
constexpr in_place_t in_place{};
|
||||
|
||||
// 5.5, No-value state indicator
|
||||
struct nullopt_t{see below};
|
||||
constexpr nullopt_t nullopt(unspecified);
|
||||
|
||||
// 5.6, Class bad_optional_access
|
||||
class bad_optional_access;
|
||||
|
||||
// 5.7, Relational operators
|
||||
template <class T>
|
||||
constexpr bool operator==(const optional<T>&, const optional<T>&);
|
||||
template <class T>
|
||||
constexpr bool operator!=(const optional<T>&, const optional<T>&);
|
||||
template <class T>
|
||||
constexpr bool operator<(const optional<T>&, const optional<T>&);
|
||||
template <class T>
|
||||
constexpr bool operator>(const optional<T>&, const optional<T>&);
|
||||
template <class T>
|
||||
constexpr bool operator<=(const optional<T>&, const optional<T>&);
|
||||
template <class T>
|
||||
constexpr bool operator>=(const optional<T>&, const optional<T>&);
|
||||
|
||||
// 5.8, Comparison with nullopt
|
||||
template <class T> constexpr bool operator==(const optional<T>&, nullopt_t) noexcept;
|
||||
template <class T> constexpr bool operator==(nullopt_t, const optional<T>&) noexcept;
|
||||
template <class T> constexpr bool operator!=(const optional<T>&, nullopt_t) noexcept;
|
||||
template <class T> constexpr bool operator!=(nullopt_t, const optional<T>&) noexcept;
|
||||
template <class T> constexpr bool operator<(const optional<T>&, nullopt_t) noexcept;
|
||||
template <class T> constexpr bool operator<(nullopt_t, const optional<T>&) noexcept;
|
||||
template <class T> constexpr bool operator<=(const optional<T>&, nullopt_t) noexcept;
|
||||
template <class T> constexpr bool operator<=(nullopt_t, const optional<T>&) noexcept;
|
||||
template <class T> constexpr bool operator>(const optional<T>&, nullopt_t) noexcept;
|
||||
template <class T> constexpr bool operator>(nullopt_t, const optional<T>&) noexcept;
|
||||
template <class T> constexpr bool operator>=(const optional<T>&, nullopt_t) noexcept;
|
||||
template <class T> constexpr bool operator>=(nullopt_t, const optional<T>&) noexcept;
|
||||
|
||||
// 5.9, Comparison with T
|
||||
template <class T> constexpr bool operator==(const optional<T>&, const T&);
|
||||
template <class T> constexpr bool operator==(const T&, const optional<T>&);
|
||||
template <class T> constexpr bool operator!=(const optional<T>&, const T&);
|
||||
template <class T> constexpr bool operator!=(const T&, const optional<T>&);
|
||||
template <class T> constexpr bool operator<(const optional<T>&, const T&);
|
||||
template <class T> constexpr bool operator<(const T&, const optional<T>&);
|
||||
template <class T> constexpr bool operator<=(const optional<T>&, const T&);
|
||||
template <class T> constexpr bool operator<=(const T&, const optional<T>&);
|
||||
template <class T> constexpr bool operator>(const optional<T>&, const T&);
|
||||
template <class T> constexpr bool operator>(const T&, const optional<T>&);
|
||||
template <class T> constexpr bool operator>=(const optional<T>&, const T&);
|
||||
template <class T> constexpr bool operator>=(const T&, const optional<T>&);
|
||||
|
||||
// 5.10, Specialized algorithms
|
||||
template <class T> void swap(optional<T>&, optional<T>&) noexcept(see below);
|
||||
template <class T> constexpr optional<see below> make_optional(T&&);
|
||||
|
||||
template <class T>
|
||||
class optional
|
||||
{
|
||||
public:
|
||||
typedef T value_type;
|
||||
|
||||
// 5.3.1, Constructors
|
||||
constexpr optional() noexcept;
|
||||
constexpr optional(nullopt_t) noexcept;
|
||||
optional(const optional&);
|
||||
optional(optional&&) noexcept(see below);
|
||||
constexpr optional(const T&);
|
||||
constexpr optional(T&&);
|
||||
template <class... Args> constexpr explicit optional(in_place_t, Args&&...);
|
||||
template <class U, class... Args>
|
||||
constexpr explicit optional(in_place_t, initializer_list<U>, Args&&...);
|
||||
|
||||
// 5.3.2, Destructor
|
||||
~optional();
|
||||
|
||||
// 5.3.3, Assignment
|
||||
optional& operator=(nullopt_t) noexcept;
|
||||
optional& operator=(const optional&);
|
||||
optional& operator=(optional&&) noexcept(see below);
|
||||
template <class U> optional& operator=(U&&);
|
||||
template <class... Args> void emplace(Args&&...);
|
||||
template <class U, class... Args>
|
||||
void emplace(initializer_list<U>, Args&&...);
|
||||
|
||||
// 5.3.4, Swap
|
||||
void swap(optional&) noexcept(see below);
|
||||
|
||||
// 5.3.5, Observers
|
||||
constexpr T const* operator ->() const;
|
||||
constexpr T* operator ->();
|
||||
constexpr T const& operator *() const &;
|
||||
constexpr T& operator *() &;
|
||||
constexpr T&& operator *() &&;
|
||||
constexpr const T&& operator *() const &&;
|
||||
constexpr explicit operator bool() const noexcept;
|
||||
constexpr T const& value() const &;
|
||||
constexpr T& value() &;
|
||||
constexpr T&& value() &&;
|
||||
constexpr const T&& value() const &&;
|
||||
template <class U> constexpr T value_or(U&&) const &;
|
||||
template <class U> constexpr T value_or(U&&) &&;
|
||||
|
||||
private:
|
||||
T* val; // exposition only
|
||||
};
|
||||
|
||||
} // namespace fundamentals_v1
|
||||
} // namespace experimental
|
||||
|
||||
// 5.11, Hash support
|
||||
template <class T> struct hash;
|
||||
template <class T> struct hash<experimental::optional<T>>;
|
||||
|
||||
} // namespace std
|
||||
|
||||
*/
|
||||
|
||||
#include <experimental/__config>
|
||||
#include <functional>
|
||||
#include <stdexcept>
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
#include <initializer_list>
|
||||
#include <type_traits>
|
||||
#include <new>
|
||||
#include <__functional_base>
|
||||
#include <__debug>
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
|
||||
class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS bad_optional_access
|
||||
: public std::logic_error
|
||||
{
|
||||
public:
|
||||
bad_optional_access() : std::logic_error("Bad optional Access") {}
|
||||
|
||||
// Get the key function ~bad_optional_access() into the dylib
|
||||
virtual ~bad_optional_access() _NOEXCEPT;
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_EXPERIMENTAL
|
||||
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||
|
||||
struct in_place_t {};
|
||||
constexpr in_place_t in_place{};
|
||||
|
||||
struct nullopt_t
|
||||
{
|
||||
explicit constexpr nullopt_t(int) noexcept {}
|
||||
};
|
||||
|
||||
constexpr nullopt_t nullopt{0};
|
||||
|
||||
template <class _Tp, bool = is_trivially_destructible<_Tp>::value>
|
||||
class __optional_storage
|
||||
{
|
||||
protected:
|
||||
typedef _Tp value_type;
|
||||
union
|
||||
{
|
||||
char __null_state_;
|
||||
value_type __val_;
|
||||
};
|
||||
bool __engaged_ = false;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~__optional_storage()
|
||||
{
|
||||
if (__engaged_)
|
||||
__val_.~value_type();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr __optional_storage() noexcept
|
||||
: __null_state_('\0') {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__optional_storage(const __optional_storage& __x)
|
||||
: __engaged_(__x.__engaged_)
|
||||
{
|
||||
if (__engaged_)
|
||||
::new((void*)_VSTD::addressof(__val_)) value_type(__x.__val_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__optional_storage(__optional_storage&& __x)
|
||||
noexcept(is_nothrow_move_constructible<value_type>::value)
|
||||
: __engaged_(__x.__engaged_)
|
||||
{
|
||||
if (__engaged_)
|
||||
::new((void*)_VSTD::addressof(__val_)) value_type(_VSTD::move(__x.__val_));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr __optional_storage(const value_type& __v)
|
||||
: __val_(__v),
|
||||
__engaged_(true) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr __optional_storage(value_type&& __v)
|
||||
: __val_(_VSTD::move(__v)),
|
||||
__engaged_(true) {}
|
||||
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
explicit __optional_storage(in_place_t, _Args&&... __args)
|
||||
: __val_(_VSTD::forward<_Args>(__args)...),
|
||||
__engaged_(true) {}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
class __optional_storage<_Tp, true>
|
||||
{
|
||||
protected:
|
||||
typedef _Tp value_type;
|
||||
union
|
||||
{
|
||||
char __null_state_;
|
||||
value_type __val_;
|
||||
};
|
||||
bool __engaged_ = false;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr __optional_storage() noexcept
|
||||
: __null_state_('\0') {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__optional_storage(const __optional_storage& __x)
|
||||
: __engaged_(__x.__engaged_)
|
||||
{
|
||||
if (__engaged_)
|
||||
::new((void*)_VSTD::addressof(__val_)) value_type(__x.__val_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__optional_storage(__optional_storage&& __x)
|
||||
noexcept(is_nothrow_move_constructible<value_type>::value)
|
||||
: __engaged_(__x.__engaged_)
|
||||
{
|
||||
if (__engaged_)
|
||||
::new((void*)_VSTD::addressof(__val_)) value_type(_VSTD::move(__x.__val_));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr __optional_storage(const value_type& __v)
|
||||
: __val_(__v),
|
||||
__engaged_(true) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr __optional_storage(value_type&& __v)
|
||||
: __val_(_VSTD::move(__v)),
|
||||
__engaged_(true) {}
|
||||
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
explicit __optional_storage(in_place_t, _Args&&... __args)
|
||||
: __val_(_VSTD::forward<_Args>(__args)...),
|
||||
__engaged_(true) {}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
class optional
|
||||
: private __optional_storage<_Tp>
|
||||
{
|
||||
typedef __optional_storage<_Tp> __base;
|
||||
public:
|
||||
typedef _Tp value_type;
|
||||
|
||||
static_assert(!is_reference<value_type>::value,
|
||||
"Instantiation of optional with a reference type is ill-formed.");
|
||||
static_assert(!is_same<typename remove_cv<value_type>::type, in_place_t>::value,
|
||||
"Instantiation of optional with a in_place_t type is ill-formed.");
|
||||
static_assert(!is_same<typename remove_cv<value_type>::type, nullopt_t>::value,
|
||||
"Instantiation of optional with a nullopt_t type is ill-formed.");
|
||||
static_assert(is_object<value_type>::value,
|
||||
"Instantiation of optional with a non-object type is undefined behavior.");
|
||||
static_assert(is_nothrow_destructible<value_type>::value,
|
||||
"Instantiation of optional with an object type that is not noexcept destructible is undefined behavior.");
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr optional() noexcept {}
|
||||
_LIBCPP_INLINE_VISIBILITY optional(const optional&) = default;
|
||||
_LIBCPP_INLINE_VISIBILITY optional(optional&&) = default;
|
||||
_LIBCPP_INLINE_VISIBILITY ~optional() = default;
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr optional(nullopt_t) noexcept {}
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr optional(const value_type& __v)
|
||||
: __base(__v) {}
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr optional(value_type&& __v)
|
||||
: __base(_VSTD::move(__v)) {}
|
||||
|
||||
template <class... _Args,
|
||||
class = typename enable_if
|
||||
<
|
||||
is_constructible<value_type, _Args...>::value
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
explicit optional(in_place_t, _Args&&... __args)
|
||||
: __base(in_place, _VSTD::forward<_Args>(__args)...) {}
|
||||
|
||||
template <class _Up, class... _Args,
|
||||
class = typename enable_if
|
||||
<
|
||||
is_constructible<value_type, initializer_list<_Up>&, _Args...>::value
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args)
|
||||
: __base(in_place, __il, _VSTD::forward<_Args>(__args)...) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
optional& operator=(nullopt_t) noexcept
|
||||
{
|
||||
if (this->__engaged_)
|
||||
{
|
||||
this->__val_.~value_type();
|
||||
this->__engaged_ = false;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
optional&
|
||||
operator=(const optional& __opt)
|
||||
{
|
||||
if (this->__engaged_ == __opt.__engaged_)
|
||||
{
|
||||
if (this->__engaged_)
|
||||
this->__val_ = __opt.__val_;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this->__engaged_)
|
||||
this->__val_.~value_type();
|
||||
else
|
||||
::new((void*)_VSTD::addressof(this->__val_)) value_type(__opt.__val_);
|
||||
this->__engaged_ = __opt.__engaged_;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
optional&
|
||||
operator=(optional&& __opt)
|
||||
noexcept(is_nothrow_move_assignable<value_type>::value &&
|
||||
is_nothrow_move_constructible<value_type>::value)
|
||||
{
|
||||
if (this->__engaged_ == __opt.__engaged_)
|
||||
{
|
||||
if (this->__engaged_)
|
||||
this->__val_ = _VSTD::move(__opt.__val_);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this->__engaged_)
|
||||
this->__val_.~value_type();
|
||||
else
|
||||
::new((void*)_VSTD::addressof(this->__val_))
|
||||
value_type(_VSTD::move(__opt.__val_));
|
||||
this->__engaged_ = __opt.__engaged_;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class _Up,
|
||||
class = typename enable_if
|
||||
<
|
||||
is_same<typename remove_reference<_Up>::type, value_type>::value &&
|
||||
is_constructible<value_type, _Up>::value &&
|
||||
is_assignable<value_type&, _Up>::value
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
optional&
|
||||
operator=(_Up&& __v)
|
||||
{
|
||||
if (this->__engaged_)
|
||||
this->__val_ = _VSTD::forward<_Up>(__v);
|
||||
else
|
||||
{
|
||||
::new((void*)_VSTD::addressof(this->__val_)) value_type(_VSTD::forward<_Up>(__v));
|
||||
this->__engaged_ = true;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class... _Args,
|
||||
class = typename enable_if
|
||||
<
|
||||
is_constructible<value_type, _Args...>::value
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
emplace(_Args&&... __args)
|
||||
{
|
||||
*this = nullopt;
|
||||
::new((void*)_VSTD::addressof(this->__val_))
|
||||
value_type(_VSTD::forward<_Args>(__args)...);
|
||||
this->__engaged_ = true;
|
||||
}
|
||||
|
||||
template <class _Up, class... _Args,
|
||||
class = typename enable_if
|
||||
<
|
||||
is_constructible<value_type, initializer_list<_Up>&, _Args...>::value
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
emplace(initializer_list<_Up> __il, _Args&&... __args)
|
||||
{
|
||||
*this = nullopt;
|
||||
::new((void*)_VSTD::addressof(this->__val_))
|
||||
value_type(__il, _VSTD::forward<_Args>(__args)...);
|
||||
this->__engaged_ = true;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(optional& __opt)
|
||||
noexcept(is_nothrow_move_constructible<value_type>::value &&
|
||||
__is_nothrow_swappable<value_type>::value)
|
||||
{
|
||||
using _VSTD::swap;
|
||||
if (this->__engaged_ == __opt.__engaged_)
|
||||
{
|
||||
if (this->__engaged_)
|
||||
swap(this->__val_, __opt.__val_);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this->__engaged_)
|
||||
{
|
||||
::new((void*)_VSTD::addressof(__opt.__val_))
|
||||
value_type(_VSTD::move(this->__val_));
|
||||
this->__val_.~value_type();
|
||||
}
|
||||
else
|
||||
{
|
||||
::new((void*)_VSTD::addressof(this->__val_))
|
||||
value_type(_VSTD::move(__opt.__val_));
|
||||
__opt.__val_.~value_type();
|
||||
}
|
||||
swap(this->__engaged_, __opt.__engaged_);
|
||||
}
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
value_type const*
|
||||
operator->() const
|
||||
{
|
||||
_LIBCPP_ASSERT(this->__engaged_, "optional operator-> called for disengaged value");
|
||||
#ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
|
||||
return __builtin_addressof(this->__val_);
|
||||
#else
|
||||
return __operator_arrow(__has_operator_addressof<value_type>{});
|
||||
#endif
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_type*
|
||||
operator->()
|
||||
{
|
||||
_LIBCPP_ASSERT(this->__engaged_, "optional operator-> called for disengaged value");
|
||||
return _VSTD::addressof(this->__val_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
const value_type&
|
||||
operator*() const
|
||||
{
|
||||
_LIBCPP_ASSERT(this->__engaged_, "optional operator* called for disengaged value");
|
||||
return this->__val_;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_type&
|
||||
operator*()
|
||||
{
|
||||
_LIBCPP_ASSERT(this->__engaged_, "optional operator* called for disengaged value");
|
||||
return this->__val_;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr explicit operator bool() const noexcept {return this->__engaged_;}
|
||||
|
||||
_LIBCPP_NORETURN _LIBCPP_INLINE_VISIBILITY
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
|
||||
#endif
|
||||
constexpr void __throw_bad_optional_access() const
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw bad_optional_access();
|
||||
#else
|
||||
_VSTD::abort();
|
||||
#endif
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
|
||||
constexpr value_type const& value() const
|
||||
{
|
||||
if (!this->__engaged_)
|
||||
__throw_bad_optional_access();
|
||||
return this->__val_;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
|
||||
value_type& value()
|
||||
{
|
||||
if (!this->__engaged_)
|
||||
__throw_bad_optional_access();
|
||||
return this->__val_;
|
||||
}
|
||||
|
||||
template <class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr value_type value_or(_Up&& __v) const&
|
||||
{
|
||||
static_assert(is_copy_constructible<value_type>::value,
|
||||
"optional<T>::value_or: T must be copy constructible");
|
||||
static_assert(is_convertible<_Up, value_type>::value,
|
||||
"optional<T>::value_or: U must be convertible to T");
|
||||
return this->__engaged_ ? this->__val_ :
|
||||
static_cast<value_type>(_VSTD::forward<_Up>(__v));
|
||||
}
|
||||
|
||||
template <class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_type value_or(_Up&& __v) &&
|
||||
{
|
||||
static_assert(is_move_constructible<value_type>::value,
|
||||
"optional<T>::value_or: T must be move constructible");
|
||||
static_assert(is_convertible<_Up, value_type>::value,
|
||||
"optional<T>::value_or: U must be convertible to T");
|
||||
return this->__engaged_ ? _VSTD::move(this->__val_) :
|
||||
static_cast<value_type>(_VSTD::forward<_Up>(__v));
|
||||
}
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_type const*
|
||||
__operator_arrow(true_type) const
|
||||
{
|
||||
return _VSTD::addressof(this->__val_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
value_type const*
|
||||
__operator_arrow(false_type) const
|
||||
{
|
||||
return &this->__val_;
|
||||
}
|
||||
};
|
||||
|
||||
// Comparisons between optionals
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator==(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||
{
|
||||
if (static_cast<bool>(__x) != static_cast<bool>(__y))
|
||||
return false;
|
||||
if (!static_cast<bool>(__x))
|
||||
return true;
|
||||
return *__x == *__y;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator!=(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||
{
|
||||
return !(__x == __y);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator<(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||
{
|
||||
if (!static_cast<bool>(__y))
|
||||
return false;
|
||||
if (!static_cast<bool>(__x))
|
||||
return true;
|
||||
return *__x < *__y;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator>(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||
{
|
||||
return __y < __x;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator<=(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||
{
|
||||
return !(__y < __x);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator>=(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||
{
|
||||
return !(__x < __y);
|
||||
}
|
||||
|
||||
|
||||
// Comparisons with nullopt
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator==(const optional<_Tp>& __x, nullopt_t) noexcept
|
||||
{
|
||||
return !static_cast<bool>(__x);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator==(nullopt_t, const optional<_Tp>& __x) noexcept
|
||||
{
|
||||
return !static_cast<bool>(__x);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator!=(const optional<_Tp>& __x, nullopt_t) noexcept
|
||||
{
|
||||
return static_cast<bool>(__x);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator!=(nullopt_t, const optional<_Tp>& __x) noexcept
|
||||
{
|
||||
return static_cast<bool>(__x);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator<(const optional<_Tp>&, nullopt_t) noexcept
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator<(nullopt_t, const optional<_Tp>& __x) noexcept
|
||||
{
|
||||
return static_cast<bool>(__x);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator<=(const optional<_Tp>& __x, nullopt_t) noexcept
|
||||
{
|
||||
return !static_cast<bool>(__x);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator<=(nullopt_t, const optional<_Tp>&) noexcept
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator>(const optional<_Tp>& __x, nullopt_t) noexcept
|
||||
{
|
||||
return static_cast<bool>(__x);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator>(nullopt_t, const optional<_Tp>&) noexcept
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator>=(const optional<_Tp>&, nullopt_t) noexcept
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator>=(nullopt_t, const optional<_Tp>& __x) noexcept
|
||||
{
|
||||
return !static_cast<bool>(__x);
|
||||
}
|
||||
|
||||
// Comparisons with T
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator==(const optional<_Tp>& __x, const _Tp& __v)
|
||||
{
|
||||
return static_cast<bool>(__x) ? *__x == __v : false;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator==(const _Tp& __v, const optional<_Tp>& __x)
|
||||
{
|
||||
return static_cast<bool>(__x) ? *__x == __v : false;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator!=(const optional<_Tp>& __x, const _Tp& __v)
|
||||
{
|
||||
return static_cast<bool>(__x) ? !(*__x == __v) : true;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator!=(const _Tp& __v, const optional<_Tp>& __x)
|
||||
{
|
||||
return static_cast<bool>(__x) ? !(*__x == __v) : true;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator<(const optional<_Tp>& __x, const _Tp& __v)
|
||||
{
|
||||
return static_cast<bool>(__x) ? less<_Tp>{}(*__x, __v) : true;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator<(const _Tp& __v, const optional<_Tp>& __x)
|
||||
{
|
||||
return static_cast<bool>(__x) ? less<_Tp>{}(__v, *__x) : false;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator<=(const optional<_Tp>& __x, const _Tp& __v)
|
||||
{
|
||||
return !(__x > __v);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator<=(const _Tp& __v, const optional<_Tp>& __x)
|
||||
{
|
||||
return !(__v > __x);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator>(const optional<_Tp>& __x, const _Tp& __v)
|
||||
{
|
||||
return static_cast<bool>(__x) ? __v < __x : false;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator>(const _Tp& __v, const optional<_Tp>& __x)
|
||||
{
|
||||
return static_cast<bool>(__x) ? __x < __v : true;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator>=(const optional<_Tp>& __x, const _Tp& __v)
|
||||
{
|
||||
return !(__x < __v);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
bool
|
||||
operator>=(const _Tp& __v, const optional<_Tp>& __x)
|
||||
{
|
||||
return !(__v < __x);
|
||||
}
|
||||
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
optional<typename decay<_Tp>::type>
|
||||
make_optional(_Tp&& __v)
|
||||
{
|
||||
return optional<typename decay<_Tp>::type>(_VSTD::forward<_Tp>(__v));
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_LFTS
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<std::experimental::optional<_Tp> >
|
||||
{
|
||||
typedef std::experimental::optional<_Tp> argument_type;
|
||||
typedef size_t result_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
result_type operator()(const argument_type& __opt) const _NOEXCEPT
|
||||
{
|
||||
return static_cast<bool>(__opt) ? hash<_Tp>()(*__opt) : 0;
|
||||
}
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 11
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP_EXPERIMENTAL_OPTIONAL
|
||||
#error "<experimental/optional> has been removed. Use <optional> instead."
|
||||
|
@ -463,8 +463,7 @@ template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR void swap(propagate_const<_Tp>& __pc1, propagate_const<_Tp>& __pc2) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
|
||||
{
|
||||
using _VSTD::swap;
|
||||
swap(_VSTD_LFTS_V2::get_underlying(__pc1), _VSTD_LFTS_V2::get_underlying(__pc2));
|
||||
__pc1.swap(__pc2);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
|
@ -8,70 +8,4 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_EXPERIMENTAL_RATIO
|
||||
#define _LIBCPP_EXPERIMENTAL_RATIO
|
||||
|
||||
/**
|
||||
experimental/ratio synopsis
|
||||
C++1y
|
||||
#include <ratio>
|
||||
|
||||
namespace std {
|
||||
namespace experimental {
|
||||
inline namespace fundamentals_v1 {
|
||||
|
||||
// See C++14 20.11.5, ratio comparison
|
||||
template <class R1, class R2> constexpr bool ratio_equal_v
|
||||
= ratio_equal<R1, R2>::value;
|
||||
template <class R1, class R2> constexpr bool ratio_not_equal_v
|
||||
= ratio_not_equal<R1, R2>::value;
|
||||
template <class R1, class R2> constexpr bool ratio_less_v
|
||||
= ratio_less<R1, R2>::value;
|
||||
template <class R1, class R2> constexpr bool ratio_less_equal_v
|
||||
= ratio_less_equal<R1, R2>::value;
|
||||
template <class R1, class R2> constexpr bool ratio_greater_v
|
||||
= ratio_greater<R1, R2>::value;
|
||||
template <class R1, class R2> constexpr bool ratio_greater_equal_v
|
||||
= ratio_greater_equal<R1, R2>::value;
|
||||
|
||||
} // namespace fundamentals_v1
|
||||
} // namespace experimental
|
||||
} // namespace std
|
||||
|
||||
*/
|
||||
|
||||
#include <experimental/__config>
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
||||
#include <ratio>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
||||
|
||||
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_equal_v
|
||||
= ratio_equal<_R1, _R2>::value;
|
||||
|
||||
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_not_equal_v
|
||||
= ratio_not_equal<_R1, _R2>::value;
|
||||
|
||||
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_less_v
|
||||
= ratio_less<_R1, _R2>::value;
|
||||
|
||||
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_less_equal_v
|
||||
= ratio_less_equal<_R1, _R2>::value;
|
||||
|
||||
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_greater_v
|
||||
= ratio_greater<_R1, _R2>::value;
|
||||
|
||||
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_greater_equal_v
|
||||
= ratio_greater_equal<_R1, _R2>::value;
|
||||
|
||||
#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */
|
||||
|
||||
_LIBCPP_END_NAMESPACE_LFTS
|
||||
|
||||
#endif /* _LIBCPP_STD_VER > 11 */
|
||||
|
||||
#endif // _LIBCPP_EXPERIMENTAL_RATIO
|
||||
#error "<experimental/ratio> has been removed. Use <ratio> instead."
|
||||
|
1285
include/experimental/simd
Normal file
1285
include/experimental/simd
Normal file
File diff suppressed because it is too large
Load Diff
@ -8,811 +8,4 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_LFTS_STRING_VIEW
|
||||
#define _LIBCPP_LFTS_STRING_VIEW
|
||||
|
||||
/*
|
||||
string_view synopsis
|
||||
|
||||
namespace std {
|
||||
namespace experimental {
|
||||
inline namespace library_fundamentals_v1 {
|
||||
|
||||
// 7.2, Class template basic_string_view
|
||||
template<class charT, class traits = char_traits<charT>>
|
||||
class basic_string_view;
|
||||
|
||||
// 7.9, basic_string_view non-member comparison functions
|
||||
template<class charT, class traits>
|
||||
constexpr bool operator==(basic_string_view<charT, traits> x,
|
||||
basic_string_view<charT, traits> y) noexcept;
|
||||
template<class charT, class traits>
|
||||
constexpr bool operator!=(basic_string_view<charT, traits> x,
|
||||
basic_string_view<charT, traits> y) noexcept;
|
||||
template<class charT, class traits>
|
||||
constexpr bool operator< (basic_string_view<charT, traits> x,
|
||||
basic_string_view<charT, traits> y) noexcept;
|
||||
template<class charT, class traits>
|
||||
constexpr bool operator> (basic_string_view<charT, traits> x,
|
||||
basic_string_view<charT, traits> y) noexcept;
|
||||
template<class charT, class traits>
|
||||
constexpr bool operator<=(basic_string_view<charT, traits> x,
|
||||
basic_string_view<charT, traits> y) noexcept;
|
||||
template<class charT, class traits>
|
||||
constexpr bool operator>=(basic_string_view<charT, traits> x,
|
||||
basic_string_view<charT, traits> y) noexcept;
|
||||
// see below, sufficient additional overloads of comparison functions
|
||||
|
||||
// 7.10, Inserters and extractors
|
||||
template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os,
|
||||
basic_string_view<charT, traits> str);
|
||||
|
||||
// basic_string_view typedef names
|
||||
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, class traits = char_traits<charT>>
|
||||
class basic_string_view {
|
||||
public:
|
||||
// types
|
||||
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 implementation-defined const_iterator;
|
||||
typedef const_iterator iterator;
|
||||
typedef 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 size_type npos = size_type(-1);
|
||||
|
||||
// 7.3, basic_string_view constructors and assignment operators
|
||||
constexpr basic_string_view() noexcept;
|
||||
constexpr basic_string_view(const basic_string_view&) noexcept = default;
|
||||
basic_string_view& operator=(const basic_string_view&) noexcept = default;
|
||||
template<class Allocator>
|
||||
basic_string_view(const basic_string<charT, traits, Allocator>& str) noexcept;
|
||||
constexpr basic_string_view(const charT* str);
|
||||
constexpr basic_string_view(const charT* str, size_type len);
|
||||
|
||||
// 7.4, basic_string_view iterator support
|
||||
constexpr const_iterator begin() const noexcept;
|
||||
constexpr const_iterator end() const noexcept;
|
||||
constexpr const_iterator cbegin() const noexcept;
|
||||
constexpr const_iterator cend() const noexcept;
|
||||
const_reverse_iterator rbegin() const noexcept;
|
||||
const_reverse_iterator rend() const noexcept;
|
||||
const_reverse_iterator crbegin() const noexcept;
|
||||
const_reverse_iterator crend() const noexcept;
|
||||
|
||||
// 7.5, basic_string_view capacity
|
||||
constexpr size_type size() const noexcept;
|
||||
constexpr size_type length() const noexcept;
|
||||
constexpr size_type max_size() const noexcept;
|
||||
constexpr bool empty() const noexcept;
|
||||
|
||||
// 7.6, basic_string_view element access
|
||||
constexpr const_reference operator[](size_type pos) const;
|
||||
constexpr const_reference at(size_type pos) const;
|
||||
constexpr const_reference front() const;
|
||||
constexpr const_reference back() const;
|
||||
constexpr const_pointer data() const noexcept;
|
||||
|
||||
// 7.7, basic_string_view modifiers
|
||||
constexpr void clear() noexcept;
|
||||
constexpr void remove_prefix(size_type n);
|
||||
constexpr void remove_suffix(size_type n);
|
||||
constexpr void swap(basic_string_view& s) noexcept;
|
||||
|
||||
// 7.8, basic_string_view string operations
|
||||
template<class Allocator>
|
||||
explicit operator basic_string<charT, traits, Allocator>() const;
|
||||
template<class Allocator = allocator<charT>>
|
||||
basic_string<charT, traits, Allocator> to_string(
|
||||
const Allocator& a = Allocator()) const;
|
||||
|
||||
size_type copy(charT* s, size_type n, size_type pos = 0) const;
|
||||
|
||||
constexpr basic_string_view substr(size_type pos = 0, size_type n = npos) const;
|
||||
constexpr int compare(basic_string_view s) const noexcept;
|
||||
constexpr int compare(size_type pos1, size_type n1, basic_string_view s) const;
|
||||
constexpr int compare(size_type pos1, size_type n1,
|
||||
basic_string_view s, size_type pos2, size_type n2) const;
|
||||
constexpr int compare(const charT* s) const;
|
||||
constexpr int compare(size_type pos1, size_type n1, const charT* s) const;
|
||||
constexpr int compare(size_type pos1, size_type n1,
|
||||
const charT* s, size_type n2) const;
|
||||
constexpr size_type find(basic_string_view s, size_type pos = 0) const noexcept;
|
||||
constexpr size_type find(charT c, size_type pos = 0) const noexcept;
|
||||
constexpr size_type find(const charT* s, size_type pos, size_type n) const;
|
||||
constexpr size_type find(const charT* s, size_type pos = 0) const;
|
||||
constexpr size_type rfind(basic_string_view s, size_type pos = npos) const noexcept;
|
||||
constexpr size_type rfind(charT c, size_type pos = npos) const noexcept;
|
||||
constexpr size_type rfind(const charT* s, size_type pos, size_type n) const;
|
||||
constexpr size_type rfind(const charT* s, size_type pos = npos) const;
|
||||
constexpr size_type find_first_of(basic_string_view s, size_type pos = 0) const noexcept;
|
||||
constexpr size_type find_first_of(charT c, size_type pos = 0) const noexcept;
|
||||
constexpr size_type find_first_of(const charT* s, size_type pos, size_type n) const;
|
||||
constexpr size_type find_first_of(const charT* s, size_type pos = 0) const;
|
||||
constexpr size_type find_last_of(basic_string_view s, size_type pos = npos) const noexcept;
|
||||
constexpr size_type find_last_of(charT c, size_type pos = npos) const noexcept;
|
||||
constexpr size_type find_last_of(const charT* s, size_type pos, size_type n) const;
|
||||
constexpr size_type find_last_of(const charT* s, size_type pos = npos) const;
|
||||
constexpr size_type find_first_not_of(basic_string_view s, size_type pos = 0) const noexcept;
|
||||
constexpr size_type find_first_not_of(charT c, size_type pos = 0) const noexcept;
|
||||
constexpr size_type find_first_not_of(const charT* s, size_type pos, size_type n) const;
|
||||
constexpr size_type find_first_not_of(const charT* s, size_type pos = 0) const;
|
||||
constexpr size_type find_last_not_of(basic_string_view s, size_type pos = npos) const noexcept;
|
||||
constexpr size_type find_last_not_of(charT c, size_type pos = npos) const noexcept;
|
||||
constexpr size_type find_last_not_of(const charT* s, size_type pos, size_type n) const;
|
||||
constexpr size_type find_last_not_of(const charT* s, size_type pos = npos) const;
|
||||
|
||||
private:
|
||||
const_pointer data_; // exposition only
|
||||
size_type size_; // exposition only
|
||||
};
|
||||
|
||||
} // namespace fundamentals_v1
|
||||
} // namespace experimental
|
||||
|
||||
// 7.11, Hash support
|
||||
template <class T> struct hash;
|
||||
template <> struct hash<experimental::string_view>;
|
||||
template <> struct hash<experimental::u16string_view>;
|
||||
template <> struct hash<experimental::u32string_view>;
|
||||
template <> struct hash<experimental::wstring_view>;
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include <experimental/__config>
|
||||
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <ostream>
|
||||
#include <stdexcept>
|
||||
#include <iomanip>
|
||||
|
||||
#include <__debug>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||
|
||||
template<class _CharT, class _Traits = _VSTD::char_traits<_CharT> >
|
||||
class _LIBCPP_TEMPLATE_VIS basic_string_view {
|
||||
public:
|
||||
// types
|
||||
typedef _Traits traits_type;
|
||||
typedef _CharT value_type;
|
||||
typedef const _CharT* pointer;
|
||||
typedef const _CharT* const_pointer;
|
||||
typedef const _CharT& reference;
|
||||
typedef const _CharT& const_reference;
|
||||
typedef const_pointer const_iterator; // See [string.view.iterators]
|
||||
typedef const_iterator iterator;
|
||||
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef const_reverse_iterator reverse_iterator;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
static _LIBCPP_CONSTEXPR const size_type npos = -1; // size_type(-1);
|
||||
|
||||
// [string.view.cons], construct/copy
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string_view() _NOEXCEPT : __data (nullptr), __size(0) {}
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string_view(const basic_string_view&) _NOEXCEPT = default;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string_view& operator=(const basic_string_view&) _NOEXCEPT = default;
|
||||
|
||||
template<class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string_view(const basic_string<_CharT, _Traits, _Allocator>& __str) _NOEXCEPT
|
||||
: __data (__str.data()), __size(__str.size()) {}
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string_view(const _CharT* __s, size_type __len)
|
||||
: __data(__s), __size(__len)
|
||||
{
|
||||
// _LIBCPP_ASSERT(__len == 0 || __s != nullptr, "string_view::string_view(_CharT *, size_t): received nullptr");
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string_view(const _CharT* __s)
|
||||
: __data(__s), __size(_Traits::length(__s)) {}
|
||||
|
||||
// [string.view.iterators], iterators
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const _NOEXCEPT { return cbegin(); }
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const _NOEXCEPT { return cend(); }
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cbegin() const _NOEXCEPT { return __data; }
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cend() const _NOEXCEPT { return __data + __size; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(cbegin()); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crend() const _NOEXCEPT { return const_reverse_iterator(cbegin()); }
|
||||
|
||||
// [string.view.capacity], capacity
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const _NOEXCEPT { return __size; }
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
size_type length() const _NOEXCEPT { return __size; }
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const _NOEXCEPT { return _VSTD::numeric_limits<size_type>::max(); }
|
||||
|
||||
_LIBCPP_CONSTEXPR bool _LIBCPP_INLINE_VISIBILITY
|
||||
empty() const _NOEXCEPT { return __size == 0; }
|
||||
|
||||
// [string.view.access], element access
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
const_reference operator[](size_type __pos) const { return __data[__pos]; }
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
const_reference at(size_type __pos) const
|
||||
{
|
||||
return __pos >= size()
|
||||
? (__throw_out_of_range("string_view::at"), __data[0])
|
||||
: __data[__pos];
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
const_reference front() const
|
||||
{
|
||||
return _LIBCPP_ASSERT(!empty(), "string_view::front(): string is empty"), __data[0];
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
const_reference back() const
|
||||
{
|
||||
return _LIBCPP_ASSERT(!empty(), "string_view::back(): string is empty"), __data[__size-1];
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
const_pointer data() const _NOEXCEPT { return __data; }
|
||||
|
||||
// [string.view.modifiers], modifiers:
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
void clear() _NOEXCEPT
|
||||
{
|
||||
__data = nullptr;
|
||||
__size = 0;
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
void remove_prefix(size_type __n) _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__n <= size(), "remove_prefix() can't remove more than size()");
|
||||
__data += __n;
|
||||
__size -= __n;
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
void remove_suffix(size_type __n) _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__n <= size(), "remove_suffix() can't remove more than size()");
|
||||
__size -= __n;
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
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;
|
||||
// _VSTD::swap( __data, __other.__data );
|
||||
// _VSTD::swap( __size, __other.__size );
|
||||
}
|
||||
|
||||
// [string.view.ops], string operations:
|
||||
template<class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_EXPLICIT operator basic_string<_CharT, _Traits, _Allocator>() const
|
||||
{ return basic_string<_CharT, _Traits, _Allocator>( begin(), end()); }
|
||||
|
||||
template<class _Allocator = allocator<_CharT> >
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string<_CharT, _Traits, _Allocator>
|
||||
to_string( const _Allocator& __a = _Allocator()) const
|
||||
{ return basic_string<_CharT, _Traits, _Allocator> ( begin(), end(), __a ); }
|
||||
|
||||
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 = _VSTD::min( __n, size() - __pos );
|
||||
_VSTD::copy_n(begin() + __pos, __rlen, __s );
|
||||
return __rlen;
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR
|
||||
basic_string_view substr(size_type __pos = 0, size_type __n = npos) const
|
||||
{
|
||||
// if (__pos > size())
|
||||
// __throw_out_of_range("string_view::substr");
|
||||
// size_type __rlen = _VSTD::min( __n, size() - __pos );
|
||||
// return basic_string_view(data() + __pos, __rlen);
|
||||
return __pos > size()
|
||||
? (__throw_out_of_range("string_view::substr"), basic_string_view())
|
||||
: basic_string_view(data() + __pos, _VSTD::min(__n, size() - __pos));
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 int compare(basic_string_view __sv) const _NOEXCEPT
|
||||
{
|
||||
size_type __rlen = _VSTD::min( size(), __sv.size());
|
||||
int __retval = _Traits::compare(data(), __sv.data(), __rlen);
|
||||
if ( __retval == 0 ) // first __rlen chars matched
|
||||
__retval = size() == __sv.size() ? 0 : ( size() < __sv.size() ? -1 : 1 );
|
||||
return __retval;
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
int compare(size_type __pos1, size_type __n1, basic_string_view __sv) const
|
||||
{
|
||||
return substr(__pos1, __n1).compare(__sv);
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
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));
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
int compare(const _CharT* __s) const
|
||||
{
|
||||
return compare(basic_string_view(__s));
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
int compare(size_type __pos1, size_type __n1, const _CharT* __s) const
|
||||
{
|
||||
return substr(__pos1, __n1).compare(basic_string_view(__s));
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
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));
|
||||
}
|
||||
|
||||
// find
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): received nullptr");
|
||||
return _VSTD::__str_find<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s.data(), __pos, __s.size());
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find(_CharT __c, size_type __pos = 0) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__str_find<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __c, __pos);
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find(const _CharT* __s, size_type __pos, size_type __n) const
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find(): received nullptr");
|
||||
return _VSTD::__str_find<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, __n);
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find(const _CharT* __s, size_type __pos = 0) const
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "string_view::find(): received nullptr");
|
||||
return _VSTD::__str_find<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||
}
|
||||
|
||||
// rfind
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type rfind(basic_string_view __s, size_type __pos = npos) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): received nullptr");
|
||||
return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s.data(), __pos, __s.size());
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type rfind(_CharT __c, size_type __pos = npos) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __c, __pos);
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::rfind(): received nullptr");
|
||||
return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, __n);
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type rfind(const _CharT* __s, size_type __pos=npos) const
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "string_view::rfind(): received nullptr");
|
||||
return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||
}
|
||||
|
||||
// find_first_of
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_of(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_of(): received nullptr");
|
||||
return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s.data(), __pos, __s.size());
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_of(_CharT __c, size_type __pos = 0) const _NOEXCEPT
|
||||
{ return find(__c, __pos); }
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_of(): received nullptr");
|
||||
return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, __n);
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_of(const _CharT* __s, size_type __pos=0) const
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_of(): received nullptr");
|
||||
return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||
}
|
||||
|
||||
// find_last_of
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_of(): received nullptr");
|
||||
return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s.data(), __pos, __s.size());
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_of(_CharT __c, size_type __pos = npos) const _NOEXCEPT
|
||||
{ return rfind(__c, __pos); }
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_of(): received nullptr");
|
||||
return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, __n);
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_of(const _CharT* __s, size_type __pos=npos) const
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_of(): received nullptr");
|
||||
return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||
}
|
||||
|
||||
// find_first_not_of
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_not_of(basic_string_view __s, size_type __pos=0) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_not_of(): received nullptr");
|
||||
return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s.data(), __pos, __s.size());
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_not_of(_CharT __c, size_type __pos=0) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __c, __pos);
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_not_of(): received nullptr");
|
||||
return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, __n);
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_not_of(const _CharT* __s, size_type __pos=0) const
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_not_of(): received nullptr");
|
||||
return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||
}
|
||||
|
||||
// find_last_not_of
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_not_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_not_of(): received nullptr");
|
||||
return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s.data(), __pos, __s.size());
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_not_of(_CharT __c, size_type __pos=npos) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __c, __pos);
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_not_of(): received nullptr");
|
||||
return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, __n);
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_not_of(const _CharT* __s, size_type __pos=npos) const
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_not_of(): received nullptr");
|
||||
return _VSTD::__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;
|
||||
};
|
||||
|
||||
|
||||
// [string.view.comparison]
|
||||
// operator ==
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
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>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(basic_string_view<_CharT, _Traits> __lhs,
|
||||
typename _VSTD::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>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(typename _VSTD::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;
|
||||
}
|
||||
|
||||
|
||||
// operator !=
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
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>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(basic_string_view<_CharT, _Traits> __lhs,
|
||||
typename _VSTD::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>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(typename _VSTD::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;
|
||||
}
|
||||
|
||||
|
||||
// operator <
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
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>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator<(basic_string_view<_CharT, _Traits> __lhs,
|
||||
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
|
||||
{
|
||||
return __lhs.compare(__rhs) < 0;
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator<(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
|
||||
basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||
{
|
||||
return __lhs.compare(__rhs) < 0;
|
||||
}
|
||||
|
||||
|
||||
// operator >
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
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>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator>(basic_string_view<_CharT, _Traits> __lhs,
|
||||
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
|
||||
{
|
||||
return __lhs.compare(__rhs) > 0;
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator>(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
|
||||
basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||
{
|
||||
return __lhs.compare(__rhs) > 0;
|
||||
}
|
||||
|
||||
|
||||
// operator <=
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
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>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator<=(basic_string_view<_CharT, _Traits> __lhs,
|
||||
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
|
||||
{
|
||||
return __lhs.compare(__rhs) <= 0;
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator<=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
|
||||
basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||
{
|
||||
return __lhs.compare(__rhs) <= 0;
|
||||
}
|
||||
|
||||
|
||||
// operator >=
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
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>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator>=(basic_string_view<_CharT, _Traits> __lhs,
|
||||
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
|
||||
{
|
||||
return __lhs.compare(__rhs) >= 0;
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator>=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
|
||||
basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||
{
|
||||
return __lhs.compare(__rhs) >= 0;
|
||||
}
|
||||
|
||||
|
||||
// [string.view.io]
|
||||
template<class _CharT, class _Traits>
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, basic_string_view<_CharT, _Traits> __sv)
|
||||
{
|
||||
return _VSTD::__put_character_sequence(__os, __sv.data(), __sv.size());
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_LFTS
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// [string.view.hash]
|
||||
// Shamelessly stolen from <string>
|
||||
template<class _CharT, class _Traits>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<std::experimental::basic_string_view<_CharT, _Traits> >
|
||||
: public unary_function<std::experimental::basic_string_view<_CharT, _Traits>, size_t>
|
||||
{
|
||||
size_t operator()(const std::experimental::basic_string_view<_CharT, _Traits>& __val) const _NOEXCEPT;
|
||||
};
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
size_t
|
||||
hash<std::experimental::basic_string_view<_CharT, _Traits> >::operator()(
|
||||
const std::experimental::basic_string_view<_CharT, _Traits>& __val) const _NOEXCEPT
|
||||
{
|
||||
return __do_string_hash(__val.data(), __val.data() + __val.size());
|
||||
}
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
template <class _CharT, class _Traits>
|
||||
__quoted_output_proxy<_CharT, const _CharT *, _Traits>
|
||||
quoted ( std::experimental::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 );
|
||||
}
|
||||
#endif
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP_LFTS_STRING_VIEW
|
||||
#error "<experimental/string_view> has been removed. Use <string_view> instead."
|
||||
|
@ -8,56 +8,4 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR
|
||||
#define _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR
|
||||
|
||||
/**
|
||||
experimental/system_error synopsis
|
||||
|
||||
// C++1y
|
||||
|
||||
#include <system_error>
|
||||
|
||||
namespace std {
|
||||
namespace experimental {
|
||||
inline namespace fundamentals_v1 {
|
||||
|
||||
// See C++14 19.5, System error support
|
||||
template <class T> constexpr bool is_error_code_enum_v
|
||||
= is_error_code_enum<T>::value;
|
||||
template <class T> constexpr bool is_error_condition_enum_v
|
||||
= is_error_condition_enum<T>::value;
|
||||
|
||||
} // namespace fundamentals_v1
|
||||
} // namespace experimental
|
||||
} // namespace std
|
||||
|
||||
*/
|
||||
|
||||
#include <experimental/__config>
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
||||
#include <system_error>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_error_code_enum_v
|
||||
= is_error_code_enum<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_error_condition_enum_v
|
||||
= is_error_condition_enum<_Tp>::value;
|
||||
|
||||
#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */
|
||||
|
||||
_LIBCPP_END_NAMESPACE_LFTS
|
||||
|
||||
#endif /* _LIBCPP_STD_VER > 11 */
|
||||
|
||||
#endif /* _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR */
|
||||
#error "<experimental/system_error> has been removed. Use <system_error> instead."
|
||||
|
@ -8,75 +8,4 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_EXPERIMENTAL_TUPLE
|
||||
#define _LIBCPP_EXPERIMENTAL_TUPLE
|
||||
|
||||
/*
|
||||
experimental/tuple synopsis
|
||||
|
||||
// C++1y
|
||||
|
||||
#include <tuple>
|
||||
|
||||
namespace std {
|
||||
namespace experimental {
|
||||
inline namespace fundamentals_v1 {
|
||||
|
||||
// See C++14 20.4.2.5, tuple helper classes
|
||||
template <class T> constexpr size_t tuple_size_v
|
||||
= tuple_size<T>::value;
|
||||
|
||||
// 3.2.2, Calling a function with a tuple of arguments
|
||||
template <class F, class Tuple>
|
||||
constexpr decltype(auto) apply(F&& f, Tuple&& t);
|
||||
|
||||
} // namespace fundamentals_v1
|
||||
} // namespace experimental
|
||||
} // namespace std
|
||||
|
||||
*/
|
||||
|
||||
# include <experimental/__config>
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
||||
# include <tuple>
|
||||
# include <utility>
|
||||
# include <__functional_base>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR size_t tuple_size_v = tuple_size<_Tp>::value;
|
||||
#endif
|
||||
|
||||
template <class _Fn, class _Tuple, size_t ..._Id>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
decltype(auto) __apply_tuple_impl(_Fn && __f, _Tuple && __t,
|
||||
integer_sequence<size_t, _Id...>) {
|
||||
return _VSTD::__invoke_constexpr(
|
||||
_VSTD::forward<_Fn>(__f),
|
||||
_VSTD::get<_Id>(_VSTD::forward<_Tuple>(__t))...
|
||||
);
|
||||
}
|
||||
|
||||
template <class _Fn, class _Tuple>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
decltype(auto) apply(_Fn && __f, _Tuple && __t) {
|
||||
return _VSTD_LFTS::__apply_tuple_impl(
|
||||
_VSTD::forward<_Fn>(__f), _VSTD::forward<_Tuple>(__t),
|
||||
make_index_sequence<tuple_size<typename decay<_Tuple>::type>::value>()
|
||||
);
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_LFTS
|
||||
|
||||
#endif /* _LIBCPP_STD_VER > 11 */
|
||||
|
||||
#endif /* _LIBCPP_EXPERIMENTAL_TUPLE */
|
||||
#error "<experimental/tuple> has been removed. Use <tuple> instead."
|
||||
|
@ -21,146 +21,6 @@ namespace std {
|
||||
namespace experimental {
|
||||
inline namespace fundamentals_v1 {
|
||||
|
||||
// See C++14 20.10.4.1, primary type categories
|
||||
template <class T> constexpr bool is_void_v
|
||||
= is_void<T>::value;
|
||||
template <class T> constexpr bool is_null_pointer_v
|
||||
= is_null_pointer<T>::value;
|
||||
template <class T> constexpr bool is_integral_v
|
||||
= is_integral<T>::value;
|
||||
template <class T> constexpr bool is_floating_point_v
|
||||
= is_floating_point<T>::value;
|
||||
template <class T> constexpr bool is_array_v
|
||||
= is_array<T>::value;
|
||||
template <class T> constexpr bool is_pointer_v
|
||||
= is_pointer<T>::value;
|
||||
template <class T> constexpr bool is_lvalue_reference_v
|
||||
= is_lvalue_reference<T>::value;
|
||||
template <class T> constexpr bool is_rvalue_reference_v
|
||||
= is_rvalue_reference<T>::value;
|
||||
template <class T> constexpr bool is_member_object_pointer_v
|
||||
= is_member_object_pointer<T>::value;
|
||||
template <class T> constexpr bool is_member_function_pointer_v
|
||||
= is_member_function_pointer<T>::value;
|
||||
template <class T> constexpr bool is_enum_v
|
||||
= is_enum<T>::value;
|
||||
template <class T> constexpr bool is_union_v
|
||||
= is_union<T>::value;
|
||||
template <class T> constexpr bool is_class_v
|
||||
= is_class<T>::value;
|
||||
template <class T> constexpr bool is_function_v
|
||||
= is_function<T>::value;
|
||||
|
||||
// See C++14 20.10.4.2, composite type categories
|
||||
template <class T> constexpr bool is_reference_v
|
||||
= is_reference<T>::value;
|
||||
template <class T> constexpr bool is_arithmetic_v
|
||||
= is_arithmetic<T>::value;
|
||||
template <class T> constexpr bool is_fundamental_v
|
||||
= is_fundamental<T>::value;
|
||||
template <class T> constexpr bool is_object_v
|
||||
= is_object<T>::value;
|
||||
template <class T> constexpr bool is_scalar_v
|
||||
= is_scalar<T>::value;
|
||||
template <class T> constexpr bool is_compound_v
|
||||
= is_compound<T>::value;
|
||||
template <class T> constexpr bool is_member_pointer_v
|
||||
= is_member_pointer<T>::value;
|
||||
|
||||
// See C++14 20.10.4.3, type properties
|
||||
template <class T> constexpr bool is_const_v
|
||||
= is_const<T>::value;
|
||||
template <class T> constexpr bool is_volatile_v
|
||||
= is_volatile<T>::value;
|
||||
template <class T> constexpr bool is_trivial_v
|
||||
= is_trivial<T>::value;
|
||||
template <class T> constexpr bool is_trivially_copyable_v
|
||||
= is_trivially_copyable<T>::value;
|
||||
template <class T> constexpr bool is_standard_layout_v
|
||||
= is_standard_layout<T>::value;
|
||||
template <class T> constexpr bool is_pod_v
|
||||
= is_pod<T>::value;
|
||||
template <class T> constexpr bool is_literal_type_v
|
||||
= is_literal_type<T>::value;
|
||||
template <class T> constexpr bool is_empty_v
|
||||
= is_empty<T>::value;
|
||||
template <class T> constexpr bool is_polymorphic_v
|
||||
= is_polymorphic<T>::value;
|
||||
template <class T> constexpr bool is_abstract_v
|
||||
= is_abstract<T>::value;
|
||||
template <class T> constexpr bool is_final_v
|
||||
= is_final<T>::value;
|
||||
template <class T> constexpr bool is_signed_v
|
||||
= is_signed<T>::value;
|
||||
template <class T> constexpr bool is_unsigned_v
|
||||
= is_unsigned<T>::value;
|
||||
template <class T, class... Args> constexpr bool is_constructible_v
|
||||
= is_constructible<T, Args...>::value;
|
||||
template <class T> constexpr bool is_default_constructible_v
|
||||
= is_default_constructible<T>::value;
|
||||
template <class T> constexpr bool is_copy_constructible_v
|
||||
= is_copy_constructible<T>::value;
|
||||
template <class T> constexpr bool is_move_constructible_v
|
||||
= is_move_constructible<T>::value;
|
||||
template <class T, class U> constexpr bool is_assignable_v
|
||||
= is_assignable<T, U>::value;
|
||||
template <class T> constexpr bool is_copy_assignable_v
|
||||
= is_copy_assignable<T>::value;
|
||||
template <class T> constexpr bool is_move_assignable_v
|
||||
= is_move_assignable<T>::value;
|
||||
template <class T> constexpr bool is_destructible_v
|
||||
= is_destructible<T>::value;
|
||||
template <class T, class... Args> constexpr bool is_trivially_constructible_v
|
||||
= is_trivially_constructible<T, Args...>::value;
|
||||
template <class T> constexpr bool is_trivially_default_constructible_v
|
||||
= is_trivially_default_constructible<T>::value;
|
||||
template <class T> constexpr bool is_trivially_copy_constructible_v
|
||||
= is_trivially_copy_constructible<T>::value;
|
||||
template <class T> constexpr bool is_trivially_move_constructible_v
|
||||
= is_trivially_move_constructible<T>::value;
|
||||
template <class T, class U> constexpr bool is_trivially_assignable_v
|
||||
= is_trivially_assignable<T, U>::value;
|
||||
template <class T> constexpr bool is_trivially_copy_assignable_v
|
||||
= is_trivially_copy_assignable<T>::value;
|
||||
template <class T> constexpr bool is_trivially_move_assignable_v
|
||||
= is_trivially_move_assignable<T>::value;
|
||||
template <class T> constexpr bool is_trivially_destructible_v
|
||||
= is_trivially_destructible<T>::value;
|
||||
template <class T, class... Args> constexpr bool is_nothrow_constructible_v
|
||||
= is_nothrow_constructible<T, Args...>::value;
|
||||
template <class T> constexpr bool is_nothrow_default_constructible_v
|
||||
= is_nothrow_default_constructible<T>::value;
|
||||
template <class T> constexpr bool is_nothrow_copy_constructible_v
|
||||
= is_nothrow_copy_constructible<T>::value;
|
||||
template <class T> constexpr bool is_nothrow_move_constructible_v
|
||||
= is_nothrow_move_constructible<T>::value;
|
||||
template <class T, class U> constexpr bool is_nothrow_assignable_v
|
||||
= is_nothrow_assignable<T, U>::value;
|
||||
template <class T> constexpr bool is_nothrow_copy_assignable_v
|
||||
= is_nothrow_copy_assignable<T>::value;
|
||||
template <class T> constexpr bool is_nothrow_move_assignable_v
|
||||
= is_nothrow_move_assignable<T>::value;
|
||||
template <class T> constexpr bool is_nothrow_destructible_v
|
||||
= is_nothrow_destructible<T>::value;
|
||||
template <class T> constexpr bool has_virtual_destructor_v
|
||||
= has_virtual_destructor<T>::value;
|
||||
|
||||
// See C++14 20.10.5, type property queries
|
||||
template <class T> constexpr size_t alignment_of_v
|
||||
= alignment_of<T>::value;
|
||||
template <class T> constexpr size_t rank_v
|
||||
= rank<T>::value;
|
||||
template <class T, unsigned I = 0> constexpr size_t extent_v
|
||||
= extent<T, I>::value;
|
||||
|
||||
// See C++14 20.10.6, type relations
|
||||
template <class T, class U> constexpr bool is_same_v
|
||||
= is_same<T, U>::value;
|
||||
template <class Base, class Derived> constexpr bool is_base_of_v
|
||||
= is_base_of<Base, Derived>::value;
|
||||
template <class From, class To> constexpr bool is_convertible_v
|
||||
= is_convertible<From, To>::value;
|
||||
|
||||
// 3.3.2, Other type transformations
|
||||
template <class> class invocation_type; // not defined
|
||||
template <class F, class... ArgTypes> class invocation_type<F(ArgTypes...)>;
|
||||
@ -172,14 +32,6 @@ inline namespace fundamentals_v1 {
|
||||
template <class T>
|
||||
using raw_invocation_type_t = typename raw_invocation_type<T>::type;
|
||||
|
||||
// 3.3.3, Logical operator traits
|
||||
template<class... B> struct conjunction;
|
||||
template<class... B> constexpr bool conjunction_v = conjunction<B...>::value;
|
||||
template<class... B> struct disjunction;
|
||||
template<class... B> constexpr bool disjunction_v = disjunction<B...>::value;
|
||||
template<class B> struct negation;
|
||||
template<class B> constexpr bool negation_v = negation<B>::value;
|
||||
|
||||
// 3.3.4, Detection idiom
|
||||
template <class...> using void_t = void;
|
||||
|
||||
@ -229,215 +81,6 @@ inline namespace fundamentals_v1 {
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
||||
|
||||
// C++14 20.10.4.1, primary type categories
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_void_v
|
||||
= is_void<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_null_pointer_v
|
||||
= is_null_pointer<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_integral_v
|
||||
= is_integral<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_floating_point_v
|
||||
= is_floating_point<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_array_v
|
||||
= is_array<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_pointer_v
|
||||
= is_pointer<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_lvalue_reference_v
|
||||
= is_lvalue_reference<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_rvalue_reference_v
|
||||
= is_rvalue_reference<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_object_pointer_v
|
||||
= is_member_object_pointer<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_function_pointer_v
|
||||
= is_member_function_pointer<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_enum_v
|
||||
= is_enum<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_union_v
|
||||
= is_union<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_class_v
|
||||
= is_class<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_function_v
|
||||
= is_function<_Tp>::value;
|
||||
|
||||
// C++14 20.10.4.2, composite type categories
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_reference_v
|
||||
= is_reference<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_arithmetic_v
|
||||
= is_arithmetic<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_fundamental_v
|
||||
= is_fundamental<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_object_v
|
||||
= is_object<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_scalar_v
|
||||
= is_scalar<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_compound_v
|
||||
= is_compound<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_pointer_v
|
||||
= is_member_pointer<_Tp>::value;
|
||||
|
||||
// C++14 20.10.4.3, type properties
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_const_v
|
||||
= is_const<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_volatile_v
|
||||
= is_volatile<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivial_v
|
||||
= is_trivial<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copyable_v
|
||||
= is_trivially_copyable<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_standard_layout_v
|
||||
= is_standard_layout<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_pod_v
|
||||
= is_pod<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_literal_type_v
|
||||
= is_literal_type<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_empty_v
|
||||
= is_empty<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_polymorphic_v
|
||||
= is_polymorphic<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_abstract_v
|
||||
= is_abstract<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_final_v
|
||||
= is_final<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_signed_v
|
||||
= is_signed<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_unsigned_v
|
||||
= is_unsigned<_Tp>::value;
|
||||
|
||||
template <class _Tp, class ..._Ts> _LIBCPP_CONSTEXPR bool is_constructible_v
|
||||
= is_constructible<_Tp, _Ts...>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_default_constructible_v
|
||||
= is_default_constructible<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_copy_constructible_v
|
||||
= is_copy_constructible<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_move_constructible_v
|
||||
= is_move_constructible<_Tp>::value;
|
||||
|
||||
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_assignable_v
|
||||
= is_assignable<_Tp, _Up>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_copy_assignable_v
|
||||
= is_copy_assignable<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_move_assignable_v
|
||||
= is_move_assignable<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_destructible_v
|
||||
= is_destructible<_Tp>::value;
|
||||
|
||||
template <class _Tp, class ..._Ts> _LIBCPP_CONSTEXPR bool is_trivially_constructible_v
|
||||
= is_trivially_constructible<_Tp, _Ts...>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_default_constructible_v
|
||||
= is_trivially_default_constructible<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copy_constructible_v
|
||||
= is_trivially_copy_constructible<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_move_constructible_v
|
||||
= is_trivially_move_constructible<_Tp>::value;
|
||||
|
||||
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_trivially_assignable_v
|
||||
= is_trivially_assignable<_Tp, _Up>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copy_assignable_v
|
||||
= is_trivially_copy_assignable<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_move_assignable_v
|
||||
= is_trivially_move_assignable<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_destructible_v
|
||||
= is_trivially_destructible<_Tp>::value;
|
||||
|
||||
template <class _Tp, class ..._Ts> _LIBCPP_CONSTEXPR bool is_nothrow_constructible_v
|
||||
= is_nothrow_constructible<_Tp, _Ts...>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_default_constructible_v
|
||||
= is_nothrow_default_constructible<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_constructible_v
|
||||
= is_nothrow_copy_constructible<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_move_constructible_v
|
||||
= is_nothrow_move_constructible<_Tp>::value;
|
||||
|
||||
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_nothrow_assignable_v
|
||||
= is_nothrow_assignable<_Tp, _Up>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_assignable_v
|
||||
= is_nothrow_copy_assignable<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_move_assignable_v
|
||||
= is_nothrow_move_assignable<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_destructible_v
|
||||
= is_nothrow_destructible<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool has_virtual_destructor_v
|
||||
= has_virtual_destructor<_Tp>::value;
|
||||
|
||||
// C++14 20.10.5, type properties queries
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR size_t alignment_of_v
|
||||
= alignment_of<_Tp>::value;
|
||||
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR size_t rank_v
|
||||
= rank<_Tp>::value;
|
||||
|
||||
template <class _Tp, unsigned _Id = 0> _LIBCPP_CONSTEXPR size_t extent_v
|
||||
= extent<_Tp, _Id>::value;
|
||||
|
||||
// C++14 20.10.6, type relations
|
||||
|
||||
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_same_v
|
||||
= is_same<_Tp, _Up>::value;
|
||||
|
||||
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_base_of_v
|
||||
= is_base_of<_Tp, _Up>::value;
|
||||
|
||||
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_convertible_v
|
||||
= is_convertible<_Tp, _Up>::value;
|
||||
|
||||
#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */
|
||||
|
||||
// 3.3.2, Other type transformations
|
||||
/*
|
||||
template <class>
|
||||
@ -459,24 +102,6 @@ template <class _Tp>
|
||||
using raw_invocation_type_t = typename raw_invocation_type<_Tp>::type;
|
||||
*/
|
||||
|
||||
// 3.3.3, Logical operator traits
|
||||
template <class...> using void_t = void;
|
||||
|
||||
template <class... _Args>
|
||||
struct conjunction : _VSTD::__and_<_Args...> {};
|
||||
template <class... _Args>
|
||||
_LIBCPP_CONSTEXPR bool conjunction_v = conjunction<_Args...>::value;
|
||||
|
||||
template <class... _Args>
|
||||
struct disjunction : _VSTD::__or_<_Args...> {};
|
||||
template <class... _Args>
|
||||
_LIBCPP_CONSTEXPR bool disjunction_v = disjunction<_Args...>::value;
|
||||
|
||||
template <class _Tp>
|
||||
struct negation : _VSTD::__not_<_Tp> {};
|
||||
template<class _Tp>
|
||||
_LIBCPP_CONSTEXPR bool negation_v = negation<_Tp>::value;
|
||||
|
||||
// 3.3.4, Detection idiom
|
||||
template <class...> using void_t = void;
|
||||
|
||||
|
2682
include/filesystem
Normal file
2682
include/filesystem
Normal file
File diff suppressed because it is too large
Load Diff
@ -134,6 +134,11 @@ public:
|
||||
void reverse() noexcept;
|
||||
};
|
||||
|
||||
|
||||
template <class InputIterator, class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
|
||||
forward_list(InputIterator, InputIterator, Allocator = Allocator())
|
||||
-> forward_list<typename iterator_traits<InputIterator>::value_type, Allocator>; // C++17
|
||||
|
||||
template <class T, class Allocator>
|
||||
bool operator==(const forward_list<T, Allocator>& x,
|
||||
const forward_list<T, Allocator>& y);
|
||||
@ -452,6 +457,10 @@ protected:
|
||||
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_;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -476,9 +485,11 @@ protected:
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
|
||||
: __before_begin_(__begin_node()) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__forward_list_base(const allocator_type& __a)
|
||||
explicit __forward_list_base(const allocator_type& __a)
|
||||
: __before_begin_(__begin_node(), __node_allocator(__a)) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __forward_list_base(const __node_allocator& __a)
|
||||
: __before_begin_(__begin_node(), __a) {}
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -845,6 +856,23 @@ private:
|
||||
__sort(__node_pointer __f, difference_type __sz, _Compare& __comp);
|
||||
};
|
||||
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
|
||||
template<class _InputIterator,
|
||||
class _Alloc = typename std::allocator<typename iterator_traits<_InputIterator>::value_type>,
|
||||
class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
|
||||
>
|
||||
forward_list(_InputIterator, _InputIterator)
|
||||
-> forward_list<typename iterator_traits<_InputIterator>::value_type, _Alloc>;
|
||||
|
||||
template<class _InputIterator,
|
||||
class _Alloc,
|
||||
class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
|
||||
>
|
||||
forward_list(_InputIterator, _InputIterator, _Alloc)
|
||||
-> forward_list<typename iterator_traits<_InputIterator>::value_type, _Alloc>;
|
||||
#endif
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
inline
|
||||
forward_list<_Tp, _Alloc>::forward_list(const allocator_type& __a)
|
||||
@ -932,11 +960,8 @@ forward_list<_Tp, _Alloc>::forward_list(_InputIterator __f, _InputIterator __l,
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x)
|
||||
: base(allocator_type(
|
||||
__node_traits::select_on_container_copy_construction(__x.__alloc())
|
||||
)
|
||||
)
|
||||
{
|
||||
: base(
|
||||
__node_traits::select_on_container_copy_construction(__x.__alloc())) {
|
||||
insert_after(cbefore_begin(), __x.begin(), __x.end());
|
||||
}
|
||||
|
||||
|
308
include/fstream
308
include/fstream
@ -38,6 +38,7 @@ public:
|
||||
bool is_open() const;
|
||||
basic_filebuf* open(const char* s, ios_base::openmode mode);
|
||||
basic_filebuf* open(const string& s, ios_base::openmode mode);
|
||||
basic_filebuf* open(const filesystem::path& p, ios_base::openmode mode); // C++17
|
||||
basic_filebuf* close();
|
||||
|
||||
protected:
|
||||
@ -77,6 +78,8 @@ public:
|
||||
basic_ifstream();
|
||||
explicit basic_ifstream(const char* s, ios_base::openmode mode = ios_base::in);
|
||||
explicit basic_ifstream(const string& s, ios_base::openmode mode = ios_base::in);
|
||||
explicit basic_ifstream(const filesystem::path& p,
|
||||
ios_base::openmode mode = ios_base::in); // C++17
|
||||
basic_ifstream(basic_ifstream&& rhs);
|
||||
|
||||
basic_ifstream& operator=(basic_ifstream&& rhs);
|
||||
@ -86,6 +89,8 @@ public:
|
||||
bool is_open() const;
|
||||
void open(const char* s, ios_base::openmode mode = ios_base::in);
|
||||
void open(const string& s, ios_base::openmode mode = ios_base::in);
|
||||
void open(const filesystem::path& s, ios_base::openmode mode = ios_base::in); // C++17
|
||||
|
||||
void close();
|
||||
};
|
||||
|
||||
@ -110,6 +115,8 @@ public:
|
||||
basic_ofstream();
|
||||
explicit basic_ofstream(const char* s, ios_base::openmode mode = ios_base::out);
|
||||
explicit basic_ofstream(const string& s, ios_base::openmode mode = ios_base::out);
|
||||
explicit basic_ofstream(const filesystem::path& p,
|
||||
ios_base::openmode mode = ios_base::out); // C++17
|
||||
basic_ofstream(basic_ofstream&& rhs);
|
||||
|
||||
basic_ofstream& operator=(basic_ofstream&& rhs);
|
||||
@ -119,6 +126,9 @@ public:
|
||||
bool is_open() const;
|
||||
void open(const char* s, ios_base::openmode mode = ios_base::out);
|
||||
void open(const string& s, ios_base::openmode mode = ios_base::out);
|
||||
void open(const filesystem::path& p,
|
||||
ios_base::openmode mode = ios_base::out); // C++17
|
||||
|
||||
void close();
|
||||
};
|
||||
|
||||
@ -143,6 +153,8 @@ public:
|
||||
basic_fstream();
|
||||
explicit basic_fstream(const char* s, ios_base::openmode mode = ios_base::in|ios_base::out);
|
||||
explicit basic_fstream(const string& s, ios_base::openmode mode = ios_base::in|ios_base::out);
|
||||
explicit basic_fstream(const filesystem::path& p,
|
||||
ios_base::openmode mode = ios_base::in|ios_base::out); C++17
|
||||
basic_fstream(basic_fstream&& rhs);
|
||||
|
||||
basic_fstream& operator=(basic_fstream&& rhs);
|
||||
@ -152,6 +164,9 @@ public:
|
||||
bool is_open() const;
|
||||
void open(const char* 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);
|
||||
void open(const filesystem::path& s,
|
||||
ios_base::openmode mode = ios_base::in|ios_base::out); // C++17
|
||||
|
||||
void close();
|
||||
};
|
||||
|
||||
@ -170,6 +185,8 @@ typedef basic_fstream<wchar_t> wfstream;
|
||||
#include <istream>
|
||||
#include <__locale>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <filesystem>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
@ -212,11 +229,27 @@ public:
|
||||
bool is_open() const;
|
||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||
basic_filebuf* open(const char* __s, ios_base::openmode __mode);
|
||||
#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
|
||||
basic_filebuf* open(const wchar_t* __s, ios_base::openmode __mode);
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_filebuf* open(const string& __s, ios_base::openmode __mode);
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_filebuf* open(const _VSTD_FS::path& __p, ios_base::openmode __mode) {
|
||||
return open(__p.c_str(), __mode);
|
||||
}
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_filebuf* __open(int __fd, ios_base::openmode __mode);
|
||||
#endif
|
||||
basic_filebuf* close();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline static const char*
|
||||
__make_mdstring(ios_base::openmode __mode) _NOEXCEPT;
|
||||
|
||||
protected:
|
||||
// 27.9.1.5 Overridden virtual functions:
|
||||
virtual int_type underflow();
|
||||
@ -470,6 +503,46 @@ 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;
|
||||
}
|
||||
_LIBCPP_UNREACHABLE();
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||
template <class _CharT, class _Traits>
|
||||
basic_filebuf<_CharT, _Traits>*
|
||||
@ -478,51 +551,104 @@ 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;
|
||||
const char* __mdstr;
|
||||
__file_ = fopen(__s, __mdstr);
|
||||
if (__file_) {
|
||||
__om_ = __mode;
|
||||
if (__mode & ios_base::ate) {
|
||||
if (fseek(__file_, 0, SEEK_END)) {
|
||||
fclose(__file_);
|
||||
__file_ = 0;
|
||||
__rt = 0;
|
||||
}
|
||||
}
|
||||
} else
|
||||
__rt = 0;
|
||||
}
|
||||
}
|
||||
return __rt;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
_LIBCPP_INLINE_VISIBILITY 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, SEEK_END)) {
|
||||
fclose(__file_);
|
||||
__file_ = 0;
|
||||
__rt = 0;
|
||||
}
|
||||
}
|
||||
} else
|
||||
__rt = 0;
|
||||
}
|
||||
}
|
||||
return __rt;
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
|
||||
// This is basically the same as the char* overload except that it uses _wfopen
|
||||
// and long mode strings.
|
||||
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 = "w";
|
||||
__mdstr = L"w";
|
||||
break;
|
||||
case ios_base::out | ios_base::app:
|
||||
case ios_base::app:
|
||||
__mdstr = "a";
|
||||
__mdstr = L"a";
|
||||
break;
|
||||
case ios_base::in:
|
||||
__mdstr = "r";
|
||||
__mdstr = L"r";
|
||||
break;
|
||||
case ios_base::in | ios_base::out:
|
||||
__mdstr = "r+";
|
||||
__mdstr = L"r+";
|
||||
break;
|
||||
case ios_base::in | ios_base::out | ios_base::trunc:
|
||||
__mdstr = "w+";
|
||||
__mdstr = L"w+";
|
||||
break;
|
||||
case ios_base::in | ios_base::out | ios_base::app:
|
||||
case ios_base::in | ios_base::app:
|
||||
__mdstr = "a+";
|
||||
__mdstr = L"a+";
|
||||
break;
|
||||
case ios_base::out | ios_base::binary:
|
||||
case ios_base::out | ios_base::trunc | ios_base::binary:
|
||||
__mdstr = "wb";
|
||||
__mdstr = L"wb";
|
||||
break;
|
||||
case ios_base::out | ios_base::app | ios_base::binary:
|
||||
case ios_base::app | ios_base::binary:
|
||||
__mdstr = "ab";
|
||||
__mdstr = L"ab";
|
||||
break;
|
||||
case ios_base::in | ios_base::binary:
|
||||
__mdstr = "rb";
|
||||
__mdstr = L"rb";
|
||||
break;
|
||||
case ios_base::in | ios_base::out | ios_base::binary:
|
||||
__mdstr = "r+b";
|
||||
__mdstr = L"r+b";
|
||||
break;
|
||||
case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary:
|
||||
__mdstr = "w+b";
|
||||
__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 = "a+b";
|
||||
__mdstr = L"a+b";
|
||||
break;
|
||||
default:
|
||||
__rt = 0;
|
||||
@ -530,7 +656,7 @@ basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
|
||||
}
|
||||
if (__rt)
|
||||
{
|
||||
__file_ = fopen(__s, __mdstr);
|
||||
__file_ = _wfopen(__s, __mdstr);
|
||||
if (__file_)
|
||||
{
|
||||
__om_ = __mode;
|
||||
@ -550,6 +676,7 @@ basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
|
||||
}
|
||||
return __rt;
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline
|
||||
@ -1017,8 +1144,17 @@ public:
|
||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in);
|
||||
#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_ifstream(const wchar_t* __s, ios_base::openmode __mode = ios_base::in);
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in);
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_ifstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in)
|
||||
: basic_ifstream(__p.c_str(), __mode) {}
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
#endif
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -1036,7 +1172,20 @@ public:
|
||||
bool is_open() const;
|
||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||
void open(const char* __s, ios_base::openmode __mode = ios_base::in);
|
||||
#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
|
||||
void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::in);
|
||||
#endif
|
||||
void open(const string& __s, ios_base::openmode __mode = ios_base::in);
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void open(const filesystem::path& __p,
|
||||
ios_base::openmode __mode = ios_base::in) {
|
||||
return open(__p.c_str(), __mode);
|
||||
}
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __open(int __fd, ios_base::openmode __mode);
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void close();
|
||||
@ -1062,6 +1211,17 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream(const char* __s, ios_base::openm
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline
|
||||
basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::openmode __mode)
|
||||
@ -1139,6 +1299,18 @@ basic_ifstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
void
|
||||
basic_ifstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode)
|
||||
@ -1148,6 +1320,15 @@ basic_ifstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mo
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
@ -1176,8 +1357,19 @@ public:
|
||||
basic_ofstream();
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_ofstream(const char* __s, ios_base::openmode __mode = ios_base::out);
|
||||
#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_ofstream(const wchar_t* __s, ios_base::openmode __mode = ios_base::out);
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out);
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_ofstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out)
|
||||
: basic_ofstream(__p.c_str(), __mode) {}
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ofstream(basic_ofstream&& __rhs);
|
||||
@ -1194,7 +1386,19 @@ public:
|
||||
bool is_open() const;
|
||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||
void open(const char* __s, ios_base::openmode __mode = ios_base::out);
|
||||
#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
|
||||
void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::out);
|
||||
#endif
|
||||
void open(const string& __s, ios_base::openmode __mode = ios_base::out);
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out)
|
||||
{ return open(__p.c_str(), __mode); }
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __open(int __fd, ios_base::openmode __mode);
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void close();
|
||||
@ -1220,6 +1424,17 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream(const char* __s, ios_base::openm
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline
|
||||
basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::openmode __mode)
|
||||
@ -1297,6 +1512,18 @@ basic_ofstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
void
|
||||
basic_ofstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode)
|
||||
@ -1306,6 +1533,15 @@ basic_ofstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mo
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
@ -1335,8 +1571,19 @@ public:
|
||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_fstream(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||
#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_fstream(const wchar_t* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_fstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in | ios_base::out)
|
||||
: basic_fstream(__p.c_str(), __mode) {}
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
#endif
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -1354,7 +1601,17 @@ public:
|
||||
bool is_open() const;
|
||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||
void open(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||
#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
|
||||
void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||
#endif
|
||||
void open(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in|ios_base::out)
|
||||
{ return open(__p.c_str(), __mode); }
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void close();
|
||||
@ -1380,6 +1637,17 @@ basic_fstream<_CharT, _Traits>::basic_fstream(const char* __s, ios_base::openmod
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline
|
||||
basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openmode __mode)
|
||||
@ -1457,6 +1725,18 @@ basic_fstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
void
|
||||
basic_fstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode)
|
||||
|
@ -213,9 +213,9 @@ template<class T> struct is_bind_expression;
|
||||
template<class T> struct is_placeholder;
|
||||
|
||||
// See C++14 20.9.9, Function object binders
|
||||
template <class T> constexpr bool is_bind_expression_v
|
||||
template <class T> inline constexpr bool is_bind_expression_v
|
||||
= is_bind_expression<T>::value; // C++17
|
||||
template <class T> constexpr int is_placeholder_v
|
||||
template <class T> inline constexpr int is_placeholder_v
|
||||
= is_placeholder<T>::value; // C++17
|
||||
|
||||
|
||||
@ -1399,7 +1399,7 @@ public:
|
||||
#endif
|
||||
};
|
||||
|
||||
_LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
|
||||
void __throw_bad_function_call()
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@ -1818,11 +1818,7 @@ template<class _Rp, class ..._ArgTypes>
|
||||
function<_Rp(_ArgTypes...)>&
|
||||
function<_Rp(_ArgTypes...)>::operator=(function&& __f) _NOEXCEPT
|
||||
{
|
||||
if ((void *)__f_ == &__buf_)
|
||||
__f_->destroy();
|
||||
else if (__f_)
|
||||
__f_->destroy_deallocate();
|
||||
__f_ = 0;
|
||||
*this = nullptr;
|
||||
if (__f.__f_ == 0)
|
||||
__f_ = 0;
|
||||
else if ((void *)__f.__f_ == &__f.__buf_)
|
||||
@ -1842,11 +1838,12 @@ template<class _Rp, class ..._ArgTypes>
|
||||
function<_Rp(_ArgTypes...)>&
|
||||
function<_Rp(_ArgTypes...)>::operator=(nullptr_t) _NOEXCEPT
|
||||
{
|
||||
if ((void *)__f_ == &__buf_)
|
||||
__f_->destroy();
|
||||
else if (__f_)
|
||||
__f_->destroy_deallocate();
|
||||
__base* __t = __f_;
|
||||
__f_ = 0;
|
||||
if ((void *)__t == &__buf_)
|
||||
__t->destroy();
|
||||
else if (__t)
|
||||
__t->destroy_deallocate();
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -1991,7 +1988,7 @@ template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_bind_expression
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
template <class _Tp>
|
||||
constexpr size_t is_bind_expression_v = is_bind_expression<_Tp>::value;
|
||||
_LIBCPP_INLINE_VAR constexpr size_t is_bind_expression_v = is_bind_expression<_Tp>::value;
|
||||
#endif
|
||||
|
||||
template<class _Tp> struct __is_placeholder : public integral_constant<int, 0> {};
|
||||
@ -2000,7 +1997,7 @@ template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_placeholder
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
template <class _Tp>
|
||||
constexpr size_t is_placeholder_v = is_placeholder<_Tp>::value;
|
||||
_LIBCPP_INLINE_VAR constexpr size_t is_placeholder_v = is_placeholder<_Tp>::value;
|
||||
#endif
|
||||
|
||||
namespace placeholders
|
||||
@ -2020,16 +2017,16 @@ _LIBCPP_FUNC_VIS extern const __ph<8> _8;
|
||||
_LIBCPP_FUNC_VIS extern const __ph<9> _9;
|
||||
_LIBCPP_FUNC_VIS extern const __ph<10> _10;
|
||||
#else
|
||||
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{};
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr __ph<1> _1{};
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr __ph<2> _2{};
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr __ph<3> _3{};
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr __ph<4> _4{};
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr __ph<5> _5{};
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr __ph<6> _6{};
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr __ph<7> _7{};
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr __ph<8> _8{};
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr __ph<9> _9{};
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr __ph<10> _10{};
|
||||
#endif // defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_BIND)
|
||||
|
||||
} // placeholders
|
||||
@ -2411,6 +2408,117 @@ __not_fn_imp<decay_t<_RawFunc>> not_fn(_RawFunc&& __fn) {
|
||||
|
||||
// struct hash<T*> in <memory>
|
||||
|
||||
template <class _BinaryPredicate, class _ForwardIterator1, class _ForwardIterator2>
|
||||
pair<_ForwardIterator1, _ForwardIterator1> _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
__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); // Everything matches an empty sequence
|
||||
while (true)
|
||||
{
|
||||
// Find first element in sequence 1 that matchs *__first2, with a mininum of loop checks
|
||||
while (true)
|
||||
{
|
||||
if (__first1 == __last1) // return __last1 if no element matches *__first2
|
||||
return make_pair(__last1, __last1);
|
||||
if (__pred(*__first1, *__first2))
|
||||
break;
|
||||
++__first1;
|
||||
}
|
||||
// *__first1 matches *__first2, now match elements after here
|
||||
_ForwardIterator1 __m1 = __first1;
|
||||
_ForwardIterator2 __m2 = __first2;
|
||||
while (true)
|
||||
{
|
||||
if (++__m2 == __last2) // If pattern exhausted, __first1 is the answer (works for 1 element pattern)
|
||||
return make_pair(__first1, __m1);
|
||||
if (++__m1 == __last1) // Otherwise if source exhaused, pattern not found
|
||||
return make_pair(__last1, __last1);
|
||||
if (!__pred(*__m1, *__m2)) // if there is a mismatch, restart with a new __first1
|
||||
{
|
||||
++__first1;
|
||||
break;
|
||||
} // else there is a match, check next elements
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class _BinaryPredicate, class _RandomAccessIterator1, class _RandomAccessIterator2>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
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;
|
||||
// Take advantage of knowing source and pattern lengths. Stop short when source is smaller than pattern
|
||||
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); // Start of pattern match can't go beyond here
|
||||
|
||||
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; // no need to check range on __m1 because __s guarantees we have enough source
|
||||
if (!__pred(*__m1, *__m2))
|
||||
{
|
||||
++__first1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
|
||||
// default searcher
|
||||
template<class _ForwardIterator, class _BinaryPredicate = equal_to<>>
|
||||
class _LIBCPP_TYPE_VIS default_searcher {
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
default_searcher(_ForwardIterator __f, _ForwardIterator __l,
|
||||
_BinaryPredicate __p = _BinaryPredicate())
|
||||
: __first_(__f), __last_(__l), __pred_(__p) {}
|
||||
|
||||
template <typename _ForwardIterator2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<_ForwardIterator2, _ForwardIterator2>
|
||||
operator () (_ForwardIterator2 __f, _ForwardIterator2 __l) const
|
||||
{
|
||||
return _VSTD::__search(__f, __l, __first_, __last_, __pred_,
|
||||
typename _VSTD::iterator_traits<_ForwardIterator>::iterator_category(),
|
||||
typename _VSTD::iterator_traits<_ForwardIterator2>::iterator_category());
|
||||
}
|
||||
|
||||
private:
|
||||
_ForwardIterator __first_;
|
||||
_ForwardIterator __last_;
|
||||
_BinaryPredicate __pred_;
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 14
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_FUNCTIONAL
|
||||
|
@ -409,7 +409,7 @@ _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(launch)
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
|
||||
#ifdef _LIBCXX_UNDERLYING_TYPE
|
||||
#ifdef _LIBCPP_UNDERLYING_TYPE
|
||||
typedef underlying_type<launch>::type __launch_underlying_type;
|
||||
#else
|
||||
typedef int __launch_underlying_type;
|
||||
@ -514,7 +514,7 @@ public:
|
||||
virtual ~future_error() _NOEXCEPT;
|
||||
};
|
||||
|
||||
_LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
_LIBCPP_AVAILABILITY_FUTURE_ERROR
|
||||
#endif
|
||||
@ -2021,7 +2021,7 @@ public:
|
||||
class = typename enable_if
|
||||
<
|
||||
!is_same<
|
||||
typename decay<_Fp>::type,
|
||||
typename __uncvref<_Fp>::type,
|
||||
packaged_task
|
||||
>::value
|
||||
>::type
|
||||
@ -2032,7 +2032,7 @@ public:
|
||||
class = typename enable_if
|
||||
<
|
||||
!is_same<
|
||||
typename decay<_Fp>::type,
|
||||
typename __uncvref<_Fp>::type,
|
||||
packaged_task
|
||||
>::value
|
||||
>::type
|
||||
@ -2150,7 +2150,7 @@ public:
|
||||
class = typename enable_if
|
||||
<
|
||||
!is_same<
|
||||
typename decay<_Fp>::type,
|
||||
typename __uncvref<_Fp>::type,
|
||||
packaged_task
|
||||
>::value
|
||||
>::type
|
||||
@ -2161,7 +2161,7 @@ public:
|
||||
class = typename enable_if
|
||||
<
|
||||
!is_same<
|
||||
typename decay<_Fp>::type,
|
||||
typename __uncvref<_Fp>::type,
|
||||
packaged_task
|
||||
>::value
|
||||
>::type
|
||||
|
@ -61,7 +61,7 @@ class _LIBCPP_TEMPLATE_VIS initializer_list
|
||||
const _Ep* __begin_;
|
||||
size_t __size_;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT
|
||||
: __begin_(__b),
|
||||
@ -76,19 +76,19 @@ public:
|
||||
typedef const _Ep* iterator;
|
||||
typedef const _Ep* const_iterator;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
size_t size() const _NOEXCEPT {return __size_;}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
const _Ep* begin() const _NOEXCEPT {return __begin_;}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
const _Ep* end() const _NOEXCEPT {return __begin_ + __size_;}
|
||||
};
|
||||
|
37
include/ios
37
include/ios
@ -337,9 +337,9 @@ protected:
|
||||
}
|
||||
|
||||
void init(void* __sb);
|
||||
_LIBCPP_ALWAYS_INLINE void* rdbuf() const {return __rdbuf_;}
|
||||
_LIBCPP_INLINE_VISIBILITY void* rdbuf() const {return __rdbuf_;}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void rdbuf(void* __sb)
|
||||
{
|
||||
__rdbuf_ = __sb;
|
||||
@ -351,7 +351,7 @@ protected:
|
||||
void move(ios_base&);
|
||||
void swap(ios_base&) _NOEXCEPT;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void set_rdbuf(void* __sb)
|
||||
{
|
||||
__rdbuf_ = __sb;
|
||||
@ -592,30 +592,33 @@ public:
|
||||
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");
|
||||
|
||||
// __true_value will generate undefined references when linking unless
|
||||
// we give it internal linkage.
|
||||
|
||||
#if defined(_LIBCPP_CXX03_LANG)
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
operator __cxx03_bool::__bool_type() const {
|
||||
return !fail() ? &__cxx03_bool::__true_value : nullptr;
|
||||
}
|
||||
#else
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_EXPLICIT operator bool() const {return !fail();}
|
||||
#endif
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE bool operator!() const {return fail();}
|
||||
_LIBCPP_ALWAYS_INLINE iostate rdstate() const {return ios_base::rdstate();}
|
||||
_LIBCPP_ALWAYS_INLINE void clear(iostate __state = goodbit) {ios_base::clear(__state);}
|
||||
_LIBCPP_ALWAYS_INLINE void setstate(iostate __state) {ios_base::setstate(__state);}
|
||||
_LIBCPP_ALWAYS_INLINE bool good() const {return ios_base::good();}
|
||||
_LIBCPP_ALWAYS_INLINE bool eof() const {return ios_base::eof();}
|
||||
_LIBCPP_ALWAYS_INLINE bool fail() const {return ios_base::fail();}
|
||||
_LIBCPP_ALWAYS_INLINE bool bad() const {return ios_base::bad();}
|
||||
_LIBCPP_INLINE_VISIBILITY bool operator!() const {return fail();}
|
||||
_LIBCPP_INLINE_VISIBILITY iostate rdstate() const {return ios_base::rdstate();}
|
||||
_LIBCPP_INLINE_VISIBILITY void clear(iostate __state = goodbit) {ios_base::clear(__state);}
|
||||
_LIBCPP_INLINE_VISIBILITY void setstate(iostate __state) {ios_base::setstate(__state);}
|
||||
_LIBCPP_INLINE_VISIBILITY bool good() const {return ios_base::good();}
|
||||
_LIBCPP_INLINE_VISIBILITY bool eof() const {return ios_base::eof();}
|
||||
_LIBCPP_INLINE_VISIBILITY bool fail() const {return ios_base::fail();}
|
||||
_LIBCPP_INLINE_VISIBILITY bool bad() const {return ios_base::bad();}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE iostate exceptions() const {return ios_base::exceptions();}
|
||||
_LIBCPP_ALWAYS_INLINE void exceptions(iostate __iostate) {ios_base::exceptions(__iostate);}
|
||||
_LIBCPP_INLINE_VISIBILITY iostate exceptions() const {return ios_base::exceptions();}
|
||||
_LIBCPP_INLINE_VISIBILITY void exceptions(iostate __iostate) {ios_base::exceptions(__iostate);}
|
||||
|
||||
// 27.5.4.1 Constructor/destructor:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -649,7 +652,7 @@ public:
|
||||
char_type widen(char __c) const;
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ios() {// purposefully does no initialization
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -658,7 +661,7 @@ protected:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void move(basic_ios& __rhs);
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void move(basic_ios&& __rhs) {move(__rhs);}
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
|
334
include/istream
334
include/istream
@ -358,381 +358,162 @@ basic_istream<_CharT, _Traits>::~basic_istream()
|
||||
{
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
template <class _Tp, class _CharT, class _Traits>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::operator>>(unsigned short& __n)
|
||||
{
|
||||
__input_arithmetic(basic_istream<_CharT, _Traits>& __is, _Tp& __n) {
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
|
||||
typedef num_get<_CharT, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||
this->setstate(__err);
|
||||
use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __err, __n);
|
||||
__is.setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
__is.__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
return __is;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::operator>>(unsigned short& __n)
|
||||
{
|
||||
return _VSTD::__input_arithmetic<unsigned short>(*this, __n);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::operator>>(unsigned int& __n)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||
this->setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
return _VSTD::__input_arithmetic<unsigned int>(*this, __n);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::operator>>(long& __n)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||
this->setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
return _VSTD::__input_arithmetic<long>(*this, __n);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::operator>>(unsigned long& __n)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||
this->setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
return _VSTD::__input_arithmetic<unsigned long>(*this, __n);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::operator>>(long long& __n)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||
this->setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
return _VSTD::__input_arithmetic<long long>(*this, __n);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::operator>>(unsigned long long& __n)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||
this->setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
return _VSTD::__input_arithmetic<unsigned long long>(*this, __n);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::operator>>(float& __n)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||
this->setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
return _VSTD::__input_arithmetic<float>(*this, __n);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::operator>>(double& __n)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||
this->setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
return _VSTD::__input_arithmetic<double>(*this, __n);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::operator>>(long double& __n)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||
this->setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
return _VSTD::__input_arithmetic<long double>(*this, __n);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::operator>>(bool& __n)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||
this->setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
return _VSTD::__input_arithmetic<bool>(*this, __n);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::operator>>(void*& __n)
|
||||
{
|
||||
return _VSTD::__input_arithmetic<void*>(*this, __n);
|
||||
}
|
||||
|
||||
template <class _Tp, class _CharT, class _Traits>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
__input_arithmetic_with_numeric_limits(basic_istream<_CharT, _Traits>& __is, _Tp& __n) {
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
|
||||
typedef num_get<_CharT, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||
this->setstate(__err);
|
||||
long __temp;
|
||||
use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __err, __temp);
|
||||
if (__temp < numeric_limits<_Tp>::min())
|
||||
{
|
||||
__err |= ios_base::failbit;
|
||||
__n = numeric_limits<_Tp>::min();
|
||||
}
|
||||
else if (__temp > numeric_limits<_Tp>::max())
|
||||
{
|
||||
__err |= ios_base::failbit;
|
||||
__n = numeric_limits<_Tp>::max();
|
||||
}
|
||||
else
|
||||
__n = static_cast<_Tp>(__temp);
|
||||
__is.setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
__is.__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
return __is;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::operator>>(short& __n)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
long __temp;
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __temp);
|
||||
if (__temp < numeric_limits<short>::min())
|
||||
{
|
||||
__err |= ios_base::failbit;
|
||||
__n = numeric_limits<short>::min();
|
||||
}
|
||||
else if (__temp > numeric_limits<short>::max())
|
||||
{
|
||||
__err |= ios_base::failbit;
|
||||
__n = numeric_limits<short>::max();
|
||||
}
|
||||
else
|
||||
__n = static_cast<short>(__temp);
|
||||
this->setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
return _VSTD::__input_arithmetic_with_numeric_limits<short>(*this, __n);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
basic_istream<_CharT, _Traits>::operator>>(int& __n)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
long __temp;
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __temp);
|
||||
if (__temp < numeric_limits<int>::min())
|
||||
{
|
||||
__err |= ios_base::failbit;
|
||||
__n = numeric_limits<int>::min();
|
||||
}
|
||||
else if (__temp > numeric_limits<int>::max())
|
||||
{
|
||||
__err |= ios_base::failbit;
|
||||
__n = numeric_limits<int>::max();
|
||||
}
|
||||
else
|
||||
__n = static_cast<int>(__temp);
|
||||
this->setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return *this;
|
||||
return _VSTD::__input_arithmetic_with_numeric_limits<int>(*this, __n);
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
@ -960,7 +741,6 @@ basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __
|
||||
++__gc_;
|
||||
this->rdbuf()->sbumpc();
|
||||
}
|
||||
*__s = char_type();
|
||||
if (__gc_ == 0)
|
||||
__err |= ios_base::failbit;
|
||||
this->setstate(__err);
|
||||
@ -968,10 +748,14 @@ basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __
|
||||
else
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
if (__n > 0)
|
||||
*__s = char_type();
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
if (__n > 0)
|
||||
*__s = char_type();
|
||||
this->__set_badbit_and_consider_rethrow();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
|
109
include/iterator
109
include/iterator
@ -1217,38 +1217,38 @@ make_move_iterator(_Iter __i)
|
||||
template <class _Iter> class __wrap_iter;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
bool
|
||||
operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
bool
|
||||
operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
bool
|
||||
operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
bool
|
||||
operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
bool
|
||||
operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
bool
|
||||
operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Iter1, class _Iter2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
auto
|
||||
operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
|
||||
-> decltype(__x.base() - __y.base());
|
||||
@ -1260,7 +1260,7 @@ operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBU
|
||||
#endif
|
||||
|
||||
template <class _Iter>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
__wrap_iter<_Iter>
|
||||
operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT_DEBUG;
|
||||
|
||||
@ -1272,7 +1272,7 @@ template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY move_backward(_B1,
|
||||
#if _LIBCPP_DEBUG_LEVEL < 2
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
typename enable_if
|
||||
<
|
||||
is_trivially_copy_assignable<_Tp>::value,
|
||||
@ -1283,7 +1283,7 @@ __unwrap_iter(__wrap_iter<_Tp*>);
|
||||
#else
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
typename enable_if
|
||||
<
|
||||
is_trivially_copy_assignable<_Tp>::value,
|
||||
@ -1306,7 +1306,7 @@ public:
|
||||
private:
|
||||
iterator_type __i;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter() _NOEXCEPT_DEBUG
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter() _NOEXCEPT_DEBUG
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
: __i{}
|
||||
#endif
|
||||
@ -1315,7 +1315,8 @@ public:
|
||||
__get_db()->__insert_i(this);
|
||||
#endif
|
||||
}
|
||||
template <class _Up> _LIBCPP_INLINE_VISIBILITY __wrap_iter(const __wrap_iter<_Up>& __u,
|
||||
template <class _Up> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
__wrap_iter(const __wrap_iter<_Up>& __u,
|
||||
typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0) _NOEXCEPT_DEBUG
|
||||
: __i(__u.base())
|
||||
{
|
||||
@ -1324,13 +1325,13 @@ public:
|
||||
#endif
|
||||
}
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
__wrap_iter(const __wrap_iter& __x)
|
||||
: __i(__x.base())
|
||||
{
|
||||
__get_db()->__iterator_copy(this, &__x);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
__wrap_iter& operator=(const __wrap_iter& __x)
|
||||
{
|
||||
if (this != &__x)
|
||||
@ -1340,13 +1341,13 @@ public:
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
~__wrap_iter()
|
||||
{
|
||||
__get_db()->__erase_i(this);
|
||||
}
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT_DEBUG
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG reference operator*() const _NOEXCEPT_DEBUG
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
@ -1354,7 +1355,7 @@ public:
|
||||
#endif
|
||||
return *__i;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY pointer operator->() const _NOEXCEPT_DEBUG
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG pointer operator->() const _NOEXCEPT_DEBUG
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
@ -1362,7 +1363,7 @@ public:
|
||||
#endif
|
||||
return (pointer)_VSTD::addressof(*__i);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator++() _NOEXCEPT_DEBUG
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator++() _NOEXCEPT_DEBUG
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
@ -1371,9 +1372,10 @@ public:
|
||||
++__i;
|
||||
return *this;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator++(int) _NOEXCEPT_DEBUG
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter operator++(int) _NOEXCEPT_DEBUG
|
||||
{__wrap_iter __tmp(*this); ++(*this); return __tmp;}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator--() _NOEXCEPT_DEBUG
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator--() _NOEXCEPT_DEBUG
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__decrementable(this),
|
||||
@ -1382,11 +1384,11 @@ public:
|
||||
--__i;
|
||||
return *this;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator--(int) _NOEXCEPT_DEBUG
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter operator--(int) _NOEXCEPT_DEBUG
|
||||
{__wrap_iter __tmp(*this); --(*this); return __tmp;}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator+ (difference_type __n) const _NOEXCEPT_DEBUG
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter operator+ (difference_type __n) const _NOEXCEPT_DEBUG
|
||||
{__wrap_iter __w(*this); __w += __n; return __w;}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator+=(difference_type __n) _NOEXCEPT_DEBUG
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator+=(difference_type __n) _NOEXCEPT_DEBUG
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__addable(this, __n),
|
||||
@ -1395,11 +1397,11 @@ public:
|
||||
__i += __n;
|
||||
return *this;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator- (difference_type __n) const _NOEXCEPT_DEBUG
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter operator- (difference_type __n) const _NOEXCEPT_DEBUG
|
||||
{return *this + (-__n);}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator-=(difference_type __n) _NOEXCEPT_DEBUG
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator-=(difference_type __n) _NOEXCEPT_DEBUG
|
||||
{*this += -__n; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const _NOEXCEPT_DEBUG
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG reference operator[](difference_type __n) const _NOEXCEPT_DEBUG
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__subscriptable(this, __n),
|
||||
@ -1408,67 +1410,68 @@ public:
|
||||
return __i[__n];
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY iterator_type base() const _NOEXCEPT_DEBUG {return __i;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG iterator_type base() const _NOEXCEPT_DEBUG {return __i;}
|
||||
|
||||
private:
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter(const void* __p, iterator_type __x) : __i(__x)
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter(const void* __p, iterator_type __x) : __i(__x)
|
||||
{
|
||||
__get_db()->__insert_ic(this, __p);
|
||||
}
|
||||
#else
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) _NOEXCEPT_DEBUG : __i(__x) {}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter(iterator_type __x) _NOEXCEPT_DEBUG : __i(__x) {}
|
||||
#endif
|
||||
|
||||
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 _LIBCPP_TEMPLATE_VIS vector;
|
||||
template <class _Tp, ptrdiff_t> friend class _LIBCPP_TEMPLATE_VIS span;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
friend
|
||||
_LIBCPP_CONSTEXPR_IF_NODEBUG friend
|
||||
bool
|
||||
operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
friend
|
||||
_LIBCPP_CONSTEXPR_IF_NODEBUG friend
|
||||
bool
|
||||
operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
friend
|
||||
_LIBCPP_CONSTEXPR_IF_NODEBUG friend
|
||||
bool
|
||||
operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
friend
|
||||
_LIBCPP_CONSTEXPR_IF_NODEBUG friend
|
||||
bool
|
||||
operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
friend
|
||||
_LIBCPP_CONSTEXPR_IF_NODEBUG friend
|
||||
bool
|
||||
operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
friend
|
||||
_LIBCPP_CONSTEXPR_IF_NODEBUG friend
|
||||
bool
|
||||
operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Iter1, class _Iter2>
|
||||
friend
|
||||
_LIBCPP_CONSTEXPR_IF_NODEBUG friend
|
||||
auto
|
||||
operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
|
||||
-> decltype(__x.base() - __y.base());
|
||||
#else
|
||||
template <class _Iter1, class _Iter2>
|
||||
friend
|
||||
_LIBCPP_CONSTEXPR_IF_NODEBUG friend
|
||||
typename __wrap_iter<_Iter1>::difference_type
|
||||
operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG;
|
||||
#endif
|
||||
|
||||
template <class _Iter1>
|
||||
friend
|
||||
_LIBCPP_CONSTEXPR_IF_NODEBUG friend
|
||||
__wrap_iter<_Iter1>
|
||||
operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) _NOEXCEPT_DEBUG;
|
||||
|
||||
@ -1479,7 +1482,7 @@ private:
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL < 2
|
||||
template <class _Tp>
|
||||
friend
|
||||
_LIBCPP_CONSTEXPR_IF_NODEBUG friend
|
||||
typename enable_if
|
||||
<
|
||||
is_trivially_copy_assignable<_Tp>::value,
|
||||
@ -1488,7 +1491,7 @@ private:
|
||||
__unwrap_iter(__wrap_iter<_Tp*>);
|
||||
#else
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
typename enable_if
|
||||
<
|
||||
is_trivially_copy_assignable<_Tp>::value,
|
||||
@ -1499,7 +1502,7 @@ private:
|
||||
};
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
bool
|
||||
operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
|
||||
{
|
||||
@ -1507,7 +1510,7 @@ operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX
|
||||
}
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
bool
|
||||
operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
|
||||
{
|
||||
@ -1519,7 +1522,7 @@ operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXC
|
||||
}
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
bool
|
||||
operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
|
||||
{
|
||||
@ -1527,7 +1530,7 @@ operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX
|
||||
}
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
bool
|
||||
operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
|
||||
{
|
||||
@ -1535,7 +1538,7 @@ operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXC
|
||||
}
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
bool
|
||||
operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
|
||||
{
|
||||
@ -1543,7 +1546,7 @@ operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX
|
||||
}
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
bool
|
||||
operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
|
||||
{
|
||||
@ -1551,7 +1554,7 @@ operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX
|
||||
}
|
||||
|
||||
template <class _Iter1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
bool
|
||||
operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT_DEBUG
|
||||
{
|
||||
@ -1559,7 +1562,7 @@ operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEX
|
||||
}
|
||||
|
||||
template <class _Iter1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
bool
|
||||
operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT_DEBUG
|
||||
{
|
||||
@ -1567,7 +1570,7 @@ operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXC
|
||||
}
|
||||
|
||||
template <class _Iter1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
bool
|
||||
operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT_DEBUG
|
||||
{
|
||||
@ -1575,7 +1578,7 @@ operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEX
|
||||
}
|
||||
|
||||
template <class _Iter1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
bool
|
||||
operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT_DEBUG
|
||||
{
|
||||
@ -1584,7 +1587,7 @@ operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEX
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Iter1, class _Iter2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
auto
|
||||
operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
|
||||
-> decltype(__x.base() - __y.base())
|
||||
@ -1597,7 +1600,7 @@ operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXC
|
||||
}
|
||||
#else
|
||||
template <class _Iter1, class _Iter2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
typename __wrap_iter<_Iter1>::difference_type
|
||||
operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG
|
||||
{
|
||||
@ -1610,7 +1613,7 @@ operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXC
|
||||
#endif
|
||||
|
||||
template <class _Iter>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
__wrap_iter<_Iter>
|
||||
operator+(typename __wrap_iter<_Iter>::difference_type __n,
|
||||
__wrap_iter<_Iter> __x) _NOEXCEPT_DEBUG
|
||||
|
71
include/list
71
include/list
@ -147,6 +147,11 @@ public:
|
||||
void reverse() noexcept;
|
||||
};
|
||||
|
||||
|
||||
template <class InputIterator, class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
|
||||
list(InputIterator, InputIterator, Allocator = Allocator())
|
||||
-> list<typename iterator_traits<InputIterator>::value_type, Allocator>; // C++17
|
||||
|
||||
template <class T, class Alloc>
|
||||
bool operator==(const list<T,Alloc>& x, const list<T,Alloc>& y);
|
||||
template <class T, class Alloc>
|
||||
@ -527,11 +532,12 @@ class __list_imp
|
||||
{
|
||||
__list_imp(const __list_imp&);
|
||||
__list_imp& operator=(const __list_imp&);
|
||||
protected:
|
||||
typedef _Tp value_type;
|
||||
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;
|
||||
@ -550,6 +556,9 @@ protected:
|
||||
|
||||
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_;
|
||||
@ -584,6 +593,11 @@ protected:
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__list_imp(const allocator_type& __a);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__list_imp(const __node_allocator& __a);
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__list_imp(__node_allocator&& __a) _NOEXCEPT;
|
||||
#endif
|
||||
~__list_imp();
|
||||
void clear() _NOEXCEPT;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -707,8 +721,17 @@ __list_imp<_Tp, _Alloc>::__list_imp(const allocator_type& __a)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
__list_imp<_Tp, _Alloc>::~__list_imp()
|
||||
{
|
||||
inline __list_imp<_Tp, _Alloc>::__list_imp(const __node_allocator& __a)
|
||||
: __size_alloc_(0, __a) {}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp, class _Alloc>
|
||||
inline __list_imp<_Tp, _Alloc>::__list_imp(__node_allocator&& __a) _NOEXCEPT
|
||||
: __size_alloc_(0, std::move(__a)) {}
|
||||
#endif
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
__list_imp<_Tp, _Alloc>::~__list_imp() {
|
||||
clear();
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
__get_db()->__erase_c(this);
|
||||
@ -1106,6 +1129,22 @@ private:
|
||||
void __move_assign(list& __c, false_type);
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
|
||||
template<class _InputIterator,
|
||||
class _Alloc = typename std::allocator<typename iterator_traits<_InputIterator>::value_type>,
|
||||
class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
|
||||
>
|
||||
list(_InputIterator, _InputIterator)
|
||||
-> list<typename iterator_traits<_InputIterator>::value_type, _Alloc>;
|
||||
|
||||
template<class _InputIterator,
|
||||
class _Alloc,
|
||||
class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
|
||||
>
|
||||
list(_InputIterator, _InputIterator, _Alloc)
|
||||
-> list<typename iterator_traits<_InputIterator>::value_type, _Alloc>;
|
||||
#endif
|
||||
|
||||
// Link in nodes [__f, __l] just prior to __p
|
||||
template <class _Tp, class _Alloc>
|
||||
inline
|
||||
@ -1226,10 +1265,8 @@ list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, const allocator_type& __a,
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
list<_Tp, _Alloc>::list(const list& __c)
|
||||
: base(allocator_type(
|
||||
__node_alloc_traits::select_on_container_copy_construction(
|
||||
__c.__node_alloc())))
|
||||
{
|
||||
: base(__node_alloc_traits::select_on_container_copy_construction(
|
||||
__c.__node_alloc())) {
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
@ -1274,11 +1311,9 @@ list<_Tp, _Alloc>::list(initializer_list<value_type> __il)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
inline
|
||||
list<_Tp, _Alloc>::list(list&& __c)
|
||||
inline list<_Tp, _Alloc>::list(list&& __c)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value)
|
||||
: base(allocator_type(_VSTD::move(__c.__node_alloc())))
|
||||
{
|
||||
: base(_VSTD::move(__c.__node_alloc())) {
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
@ -2058,15 +2093,15 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, con
|
||||
#endif
|
||||
if (__f != __l)
|
||||
{
|
||||
if (this != &__c)
|
||||
{
|
||||
size_type __s = _VSTD::distance(__f, __l);
|
||||
__c.__sz() -= __s;
|
||||
base::__sz() += __s;
|
||||
}
|
||||
__link_pointer __first = __f.__ptr_;
|
||||
--__l;
|
||||
__link_pointer __last = __l.__ptr_;
|
||||
if (this != &__c)
|
||||
{
|
||||
size_type __s = _VSTD::distance(__f, __l) + 1;
|
||||
__c.__sz() -= __s;
|
||||
base::__sz() += __s;
|
||||
}
|
||||
base::__unlink_nodes(__first, __last);
|
||||
__link_nodes(__p.__ptr_, __first, __last);
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
|
187
include/locale
187
include/locale
@ -573,81 +573,81 @@ public:
|
||||
typedef _CharT char_type;
|
||||
typedef _InputIterator iter_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit num_get(size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
|
||||
ios_base::iostate& __err, void*& __v) const
|
||||
{
|
||||
@ -657,7 +657,7 @@ public:
|
||||
static locale::id id;
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~num_get() {}
|
||||
|
||||
template <class _Fp>
|
||||
@ -768,8 +768,8 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
|
||||
{
|
||||
if (__a != __a_end)
|
||||
{
|
||||
if (*__a == '-')
|
||||
{
|
||||
const bool __negate = *__a == '-';
|
||||
if (__negate && ++__a == __a_end) {
|
||||
__err = ios_base::failbit;
|
||||
return 0;
|
||||
}
|
||||
@ -785,13 +785,14 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
|
||||
__err = ios_base::failbit;
|
||||
return 0;
|
||||
}
|
||||
else if (__current_errno == ERANGE ||
|
||||
numeric_limits<_Tp>::max() < __ll)
|
||||
else if (__current_errno == ERANGE || numeric_limits<_Tp>::max() < __ll)
|
||||
{
|
||||
__err = ios_base::failbit;
|
||||
return numeric_limits<_Tp>::max();
|
||||
}
|
||||
return static_cast<_Tp>(__ll);
|
||||
_Tp __res = static_cast<_Tp>(__ll);
|
||||
if (__negate) __res = -__res;
|
||||
return __res;
|
||||
}
|
||||
__err = ios_base::failbit;
|
||||
return 0;
|
||||
@ -1260,60 +1261,60 @@ public:
|
||||
typedef _CharT char_type;
|
||||
typedef _OutputIterator iter_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit num_put(size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
|
||||
bool __v) const
|
||||
{
|
||||
return do_put(__s, __iob, __fl, __v);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
|
||||
long __v) const
|
||||
{
|
||||
return do_put(__s, __iob, __fl, __v);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
|
||||
long long __v) const
|
||||
{
|
||||
return do_put(__s, __iob, __fl, __v);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
|
||||
unsigned long __v) const
|
||||
{
|
||||
return do_put(__s, __iob, __fl, __v);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
|
||||
unsigned long long __v) const
|
||||
{
|
||||
return do_put(__s, __iob, __fl, __v);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
|
||||
double __v) const
|
||||
{
|
||||
return do_put(__s, __iob, __fl, __v);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
|
||||
long double __v) const
|
||||
{
|
||||
return do_put(__s, __iob, __fl, __v);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
|
||||
const void* __v) const
|
||||
{
|
||||
@ -1323,7 +1324,7 @@ public:
|
||||
static locale::id id;
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~num_put() {}
|
||||
|
||||
virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
|
||||
@ -1737,7 +1738,7 @@ protected:
|
||||
virtual const string_type& __x() const;
|
||||
virtual const string_type& __X() const;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~__time_get_c_storage() {}
|
||||
};
|
||||
|
||||
@ -1769,52 +1770,52 @@ public:
|
||||
typedef time_base::dateorder dateorder;
|
||||
typedef basic_string<char_type> string_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit time_get(size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
dateorder date_order() const
|
||||
{
|
||||
return this->do_date_order();
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iter_type get(iter_type __b, iter_type __e, ios_base& __iob,
|
||||
ios_base::iostate& __err, tm *__tm,
|
||||
char __fmt, char __mod = 0) const
|
||||
@ -1829,7 +1830,7 @@ public:
|
||||
static locale::id id;
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~time_get() {}
|
||||
|
||||
virtual dateorder do_date_order() const;
|
||||
@ -2398,7 +2399,7 @@ protected:
|
||||
explicit __time_get_storage(const char* __nm);
|
||||
explicit __time_get_storage(const string& __nm);
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE ~__time_get_storage() {}
|
||||
_LIBCPP_INLINE_VISIBILITY ~__time_get_storage() {}
|
||||
|
||||
time_base::dateorder __do_date_order() const;
|
||||
|
||||
@ -2457,7 +2458,7 @@ class _LIBCPP_TYPE_VIS __time_put
|
||||
{
|
||||
locale_t __loc_;
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE __time_put() : __loc_(_LIBCPP_GET_C_LOCALE) {}
|
||||
_LIBCPP_INLINE_VISIBILITY __time_put() : __loc_(_LIBCPP_GET_C_LOCALE) {}
|
||||
__time_put(const char* __nm);
|
||||
__time_put(const string& __nm);
|
||||
~__time_put();
|
||||
@ -2476,14 +2477,14 @@ public:
|
||||
typedef _CharT char_type;
|
||||
typedef _OutputIterator iter_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iter_type put(iter_type __s, ios_base& __iob, char_type __fl,
|
||||
const tm* __tm, char __fmt, char __mod = 0) const
|
||||
{
|
||||
@ -2493,16 +2494,16 @@ public:
|
||||
static locale::id id;
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~time_put() {}
|
||||
virtual iter_type do_put(iter_type __s, ios_base&, char_type, const tm* __tm,
|
||||
char __fmt, char __mod) const;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit time_put(const char* __nm, size_t __refs)
|
||||
: locale::facet(__refs),
|
||||
__time_put(__nm) {}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit time_put(const string& __nm, size_t __refs)
|
||||
: locale::facet(__refs),
|
||||
__time_put(__nm) {}
|
||||
@ -2571,16 +2572,16 @@ class _LIBCPP_TEMPLATE_VIS time_put_byname
|
||||
: public time_put<_CharT, _OutputIterator>
|
||||
{
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit time_put_byname(const char* __nm, size_t __refs = 0)
|
||||
: time_put<_CharT, _OutputIterator>(__nm, __refs) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit time_put_byname(const string& __nm, size_t __refs = 0)
|
||||
: time_put<_CharT, _OutputIterator>(__nm, __refs) {}
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~time_put_byname() {}
|
||||
};
|
||||
|
||||
@ -2595,7 +2596,7 @@ public:
|
||||
enum part {none, space, symbol, sign, value};
|
||||
struct pattern {char field[4];};
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE money_base() {}
|
||||
_LIBCPP_INLINE_VISIBILITY money_base() {}
|
||||
};
|
||||
|
||||
// moneypunct
|
||||
@ -2609,25 +2610,25 @@ public:
|
||||
typedef _CharT char_type;
|
||||
typedef basic_string<char_type> string_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit moneypunct(size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE char_type decimal_point() const {return do_decimal_point();}
|
||||
_LIBCPP_ALWAYS_INLINE char_type thousands_sep() const {return do_thousands_sep();}
|
||||
_LIBCPP_ALWAYS_INLINE string grouping() const {return do_grouping();}
|
||||
_LIBCPP_ALWAYS_INLINE string_type curr_symbol() const {return do_curr_symbol();}
|
||||
_LIBCPP_ALWAYS_INLINE string_type positive_sign() const {return do_positive_sign();}
|
||||
_LIBCPP_ALWAYS_INLINE string_type negative_sign() const {return do_negative_sign();}
|
||||
_LIBCPP_ALWAYS_INLINE int frac_digits() const {return do_frac_digits();}
|
||||
_LIBCPP_ALWAYS_INLINE pattern pos_format() const {return do_pos_format();}
|
||||
_LIBCPP_ALWAYS_INLINE pattern neg_format() const {return do_neg_format();}
|
||||
_LIBCPP_INLINE_VISIBILITY char_type decimal_point() const {return do_decimal_point();}
|
||||
_LIBCPP_INLINE_VISIBILITY char_type thousands_sep() const {return do_thousands_sep();}
|
||||
_LIBCPP_INLINE_VISIBILITY string grouping() const {return do_grouping();}
|
||||
_LIBCPP_INLINE_VISIBILITY string_type curr_symbol() const {return do_curr_symbol();}
|
||||
_LIBCPP_INLINE_VISIBILITY string_type positive_sign() const {return do_positive_sign();}
|
||||
_LIBCPP_INLINE_VISIBILITY string_type negative_sign() const {return do_negative_sign();}
|
||||
_LIBCPP_INLINE_VISIBILITY int frac_digits() const {return do_frac_digits();}
|
||||
_LIBCPP_INLINE_VISIBILITY pattern pos_format() const {return do_pos_format();}
|
||||
_LIBCPP_INLINE_VISIBILITY pattern neg_format() const {return do_neg_format();}
|
||||
|
||||
static locale::id id;
|
||||
static const bool intl = _International;
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~moneypunct() {}
|
||||
|
||||
virtual char_type do_decimal_point() const {return numeric_limits<char_type>::max();}
|
||||
@ -2667,16 +2668,16 @@ public:
|
||||
typedef _CharT char_type;
|
||||
typedef basic_string<char_type> string_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit moneypunct_byname(const char* __nm, size_t __refs = 0)
|
||||
: moneypunct<_CharT, _International>(__refs) {init(__nm);}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit moneypunct_byname(const string& __nm, size_t __refs = 0)
|
||||
: moneypunct<_CharT, _International>(__refs) {init(__nm.c_str());}
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~moneypunct_byname() {}
|
||||
|
||||
virtual char_type do_decimal_point() const {return __decimal_point_;}
|
||||
@ -2722,7 +2723,7 @@ protected:
|
||||
typedef _CharT char_type;
|
||||
typedef basic_string<char_type> string_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE __money_get() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __money_get() {}
|
||||
|
||||
static void __gather_info(bool __intl, const locale& __loc,
|
||||
money_base::pattern& __pat, char_type& __dp,
|
||||
@ -2780,18 +2781,18 @@ public:
|
||||
typedef _InputIterator iter_type;
|
||||
typedef basic_string<char_type> string_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit money_get(size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iter_type get(iter_type __b, iter_type __e, bool __intl, ios_base& __iob,
|
||||
ios_base::iostate& __err, string_type& __v) const
|
||||
{
|
||||
@ -2802,7 +2803,7 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~money_get() {}
|
||||
|
||||
virtual iter_type do_get(iter_type __b, iter_type __e, bool __intl,
|
||||
@ -3162,7 +3163,7 @@ protected:
|
||||
typedef _CharT char_type;
|
||||
typedef basic_string<char_type> string_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE __money_put() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __money_put() {}
|
||||
|
||||
static void __gather_info(bool __intl, bool __neg, const locale& __loc,
|
||||
money_base::pattern& __pat, char_type& __dp,
|
||||
@ -3338,18 +3339,18 @@ public:
|
||||
typedef _OutputIterator iter_type;
|
||||
typedef basic_string<char_type> string_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit money_put(size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iter_type put(iter_type __s, bool __intl, ios_base& __iob, char_type __fl,
|
||||
const string_type& __digits) const
|
||||
{
|
||||
@ -3359,7 +3360,7 @@ public:
|
||||
static locale::id id;
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~money_put() {}
|
||||
|
||||
virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __iob,
|
||||
@ -3488,7 +3489,7 @@ class _LIBCPP_TYPE_VIS messages_base
|
||||
public:
|
||||
typedef ptrdiff_t catalog;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE messages_base() {}
|
||||
_LIBCPP_INLINE_VISIBILITY messages_base() {}
|
||||
};
|
||||
|
||||
template <class _CharT>
|
||||
@ -3500,24 +3501,24 @@ public:
|
||||
typedef _CharT char_type;
|
||||
typedef basic_string<_CharT> string_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit messages(size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
catalog open(const basic_string<char>& __nm, const locale& __loc) const
|
||||
{
|
||||
return do_open(__nm, __loc);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
string_type get(catalog __c, int __set, int __msgid,
|
||||
const string_type& __dflt) const
|
||||
{
|
||||
return do_get(__c, __set, __msgid, __dflt);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void close(catalog __c) const
|
||||
{
|
||||
do_close(__c);
|
||||
@ -3526,7 +3527,7 @@ public:
|
||||
static locale::id id;
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~messages() {}
|
||||
|
||||
virtual catalog do_open(const basic_string<char>&, const locale&) const;
|
||||
@ -3599,16 +3600,16 @@ public:
|
||||
typedef messages_base::catalog catalog;
|
||||
typedef basic_string<_CharT> string_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit messages_byname(const char*, size_t __refs = 0)
|
||||
: messages<_CharT>(__refs) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit messages_byname(const string&, size_t __refs = 0)
|
||||
: messages<_CharT>(__refs) {}
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~messages_byname() {}
|
||||
};
|
||||
|
||||
@ -3636,43 +3637,43 @@ private:
|
||||
wstring_convert(const wstring_convert& __wc);
|
||||
wstring_convert& operator=(const wstring_convert& __wc);
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_EXPLICIT_AFTER_CXX11 wstring_convert(_Codecvt* __pcvt = new _Codecvt);
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
wstring_convert(_Codecvt* __pcvt, state_type __state);
|
||||
_LIBCPP_EXPLICIT_AFTER_CXX11 wstring_convert(const byte_string& __byte_err,
|
||||
const wide_string& __wide_err = wide_string());
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
wstring_convert(wstring_convert&& __wc);
|
||||
#endif
|
||||
~wstring_convert();
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
wide_string from_bytes(char __byte)
|
||||
{return from_bytes(&__byte, &__byte+1);}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
wide_string from_bytes(const char* __ptr)
|
||||
{return from_bytes(__ptr, __ptr + char_traits<char>::length(__ptr));}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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);
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
byte_string to_bytes(_Elem __wchar)
|
||||
{return to_bytes(&__wchar, &__wchar+1);}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
byte_string to_bytes(const _Elem* __wptr)
|
||||
{return to_bytes(__wptr, __wptr + char_traits<_Elem>::length(__wptr));}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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);
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t converted() const _NOEXCEPT {return __cvtcount_;}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
state_type state() const {return __cvtstate_;}
|
||||
};
|
||||
|
||||
|
125
include/map
125
include/map
@ -470,13 +470,13 @@ public:
|
||||
const _Compare& key_comp() const _NOEXCEPT {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _CP& __x, const _CP& __y) const
|
||||
{return static_cast<const _Compare&>(*this)(__x.__cc.first, __y.__cc.first);}
|
||||
{return static_cast<const _Compare&>(*this)(__x.__get_value().first, __y.__get_value().first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _CP& __x, const _Key& __y) const
|
||||
{return static_cast<const _Compare&>(*this)(__x.__cc.first, __y);}
|
||||
{return static_cast<const _Compare&>(*this)(__x.__get_value().first, __y);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Key& __x, const _CP& __y) const
|
||||
{return static_cast<const _Compare&>(*this)(__x, __y.__cc.first);}
|
||||
{return static_cast<const _Compare&>(*this)(__x, __y.__get_value().first);}
|
||||
void swap(__map_value_compare&__y)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_Compare>::value)
|
||||
{
|
||||
@ -489,13 +489,13 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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.__cc.first);}
|
||||
{return static_cast<const _Compare&>(*this) (__x, __y.__get_value().first);}
|
||||
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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.__cc.first, __y);}
|
||||
{return static_cast<const _Compare&>(*this) (__x.__get_value().first, __y);}
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -518,13 +518,13 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _CP& __x, const _CP& __y) const
|
||||
{return comp(__x.__cc.first, __y.__cc.first);}
|
||||
{return comp(__x.__get_value().first, __y.__get_value().first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _CP& __x, const _Key& __y) const
|
||||
{return comp(__x.__cc.first, __y);}
|
||||
{return comp(__x.__get_value().first, __y);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Key& __x, const _CP& __y) const
|
||||
{return comp(__x, __y.__cc.first);}
|
||||
{return comp(__x, __y.__get_value().first);}
|
||||
void swap(__map_value_compare&__y)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_Compare>::value)
|
||||
{
|
||||
@ -537,13 +537,13 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type
|
||||
operator () ( const _K2& __x, const _CP& __y ) const
|
||||
{return comp (__x, __y.__cc.first);}
|
||||
{return comp (__x, __y.__get_value().first);}
|
||||
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type
|
||||
operator () (const _CP& __x, const _K2& __y) const
|
||||
{return comp (__x.__cc.first, __y);}
|
||||
{return comp (__x.__get_value().first, __y);}
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -597,9 +597,9 @@ public:
|
||||
void operator()(pointer __p) _NOEXCEPT
|
||||
{
|
||||
if (__second_constructed)
|
||||
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.__cc.second));
|
||||
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.__get_value().second));
|
||||
if (__first_constructed)
|
||||
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.__cc.first));
|
||||
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.__get_value().first));
|
||||
if (__p)
|
||||
__alloc_traits::deallocate(__na_, __p, 1);
|
||||
}
|
||||
@ -614,23 +614,67 @@ template <class _TreeIterator> class __map_const_iterator;
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Key, class _Tp>
|
||||
union __value_type
|
||||
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_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;
|
||||
__nc_value_type __nc;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_type& __get_value()
|
||||
{
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
return *_VSTD::launder(_VSTD::addressof(__cc));
|
||||
#else
|
||||
return __cc;
|
||||
#endif
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const value_type& __get_value() const
|
||||
{
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
return *_VSTD::launder(_VSTD::addressof(__cc));
|
||||
#else
|
||||
return __cc;
|
||||
#endif
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__nc_ref_pair_type __ref()
|
||||
{
|
||||
value_type& __v = __get_value();
|
||||
return __nc_ref_pair_type(const_cast<key_type&>(__v.first), __v.second);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__nc_rref_pair_type __move()
|
||||
{
|
||||
value_type& __v = __get_value();
|
||||
return __nc_rref_pair_type(
|
||||
_VSTD::move(const_cast<key_type&>(__v.first)),
|
||||
_VSTD::move(__v.second));
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__value_type& operator=(const __value_type& __v)
|
||||
{__nc = __v.__cc; return *this;}
|
||||
{
|
||||
__ref() = __v.__get_value();
|
||||
return *this;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__value_type& operator=(__value_type&& __v)
|
||||
{__nc = _VSTD::move(__v.__nc); return *this;}
|
||||
{
|
||||
__ref() = __v.__move();
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class _ValueTp,
|
||||
class = typename enable_if<
|
||||
@ -638,8 +682,10 @@ union __value_type
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__value_type& operator=(_ValueTp&& __v) {
|
||||
__nc = _VSTD::forward<_ValueTp>(__v); return *this;
|
||||
__value_type& operator=(_ValueTp&& __v)
|
||||
{
|
||||
__ref() = _VSTD::forward<_ValueTp>(__v);
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
@ -658,8 +704,15 @@ struct __value_type
|
||||
typedef _Tp mapped_type;
|
||||
typedef pair<const key_type, mapped_type> value_type;
|
||||
|
||||
private:
|
||||
value_type __cc;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_type& __get_value() { return __cc; }
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const value_type& __get_value() const { return __cc; }
|
||||
|
||||
private:
|
||||
__value_type();
|
||||
__value_type(__value_type const&);
|
||||
@ -701,9 +754,9 @@ public:
|
||||
__map_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {return __i_->__cc;}
|
||||
reference operator*() const {return __i_->__get_value();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__cc);}
|
||||
pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__get_value());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__map_iterator& operator++() {++__i_; return *this;}
|
||||
@ -764,9 +817,9 @@ public:
|
||||
: __i_(__i.__i_) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {return __i_->__cc;}
|
||||
reference operator*() const {return __i_->__get_value();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__cc);}
|
||||
pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__get_value());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__map_const_iterator& operator++() {++__i_; return *this;}
|
||||
@ -809,7 +862,6 @@ public:
|
||||
typedef _Key key_type;
|
||||
typedef _Tp mapped_type;
|
||||
typedef pair<const key_type, mapped_type> value_type;
|
||||
typedef pair<key_type, mapped_type> __nc_value_type;
|
||||
typedef _Compare key_compare;
|
||||
typedef _Allocator allocator_type;
|
||||
typedef value_type& reference;
|
||||
@ -1228,7 +1280,7 @@ public:
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
|
||||
count(const _K2& __k) const {return __tree_.__count_unique(__k);}
|
||||
count(const _K2& __k) const {return __tree_.__count_multi(__k);}
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator lower_bound(const key_type& __k)
|
||||
@ -1275,11 +1327,11 @@ public:
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
|
||||
equal_range(const _K2& __k) {return __tree_.__equal_range_unique(__k);}
|
||||
equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);}
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
|
||||
equal_range(const _K2& __k) const {return __tree_.__equal_range_unique(__k);}
|
||||
equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
|
||||
#endif
|
||||
|
||||
private:
|
||||
@ -1308,7 +1360,7 @@ map<_Key, _Tp, _Compare, _Allocator>::map(map&& __m, const allocator_type& __a)
|
||||
const_iterator __e = cend();
|
||||
while (!__m.empty())
|
||||
__tree_.__insert_unique(__e.__i_,
|
||||
_VSTD::move(__m.__tree_.remove(__m.begin().__i_)->__value_.__nc));
|
||||
__m.__tree_.remove(__m.begin().__i_)->__value_.__move());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1319,7 +1371,7 @@ map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k)
|
||||
return __tree_.__emplace_unique_key_args(__k,
|
||||
_VSTD::piecewise_construct,
|
||||
_VSTD::forward_as_tuple(__k),
|
||||
_VSTD::forward_as_tuple()).first->__cc.second;
|
||||
_VSTD::forward_as_tuple()).first->__get_value().second;
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
@ -1329,7 +1381,7 @@ map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k)
|
||||
return __tree_.__emplace_unique_key_args(__k,
|
||||
_VSTD::piecewise_construct,
|
||||
_VSTD::forward_as_tuple(_VSTD::move(__k)),
|
||||
_VSTD::forward_as_tuple()).first->__cc.second;
|
||||
_VSTD::forward_as_tuple()).first->__get_value().second;
|
||||
}
|
||||
|
||||
#else // _LIBCPP_CXX03_LANG
|
||||
@ -1340,9 +1392,9 @@ map<_Key, _Tp, _Compare, _Allocator>::__construct_node_with_key(const key_type&
|
||||
{
|
||||
__node_allocator& __na = __tree_.__node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first), __k);
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.__get_value().first), __k);
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.__get_value().second));
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
|
||||
}
|
||||
@ -1360,7 +1412,7 @@ map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k)
|
||||
__tree_.__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
||||
__r = __h.release();
|
||||
}
|
||||
return __r->__value_.__cc.second;
|
||||
return __r->__value_.__get_value().second;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
@ -1375,7 +1427,7 @@ map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k)
|
||||
if (__child == nullptr)
|
||||
throw out_of_range("map::at: key not found");
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return static_cast<__node_pointer>(__child)->__value_.__cc.second;
|
||||
return static_cast<__node_pointer>(__child)->__value_.__get_value().second;
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
@ -1388,7 +1440,7 @@ map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const
|
||||
if (__child == nullptr)
|
||||
throw out_of_range("map::at: key not found");
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return static_cast<__node_pointer>(__child)->__value_.__cc.second;
|
||||
return static_cast<__node_pointer>(__child)->__value_.__get_value().second;
|
||||
}
|
||||
|
||||
|
||||
@ -1465,7 +1517,6 @@ public:
|
||||
typedef _Key key_type;
|
||||
typedef _Tp mapped_type;
|
||||
typedef pair<const key_type, mapped_type> value_type;
|
||||
typedef pair<key_type, mapped_type> __nc_value_type;
|
||||
typedef _Compare key_compare;
|
||||
typedef _Allocator allocator_type;
|
||||
typedef value_type& reference;
|
||||
@ -1852,7 +1903,7 @@ multimap<_Key, _Tp, _Compare, _Allocator>::multimap(multimap&& __m, const alloca
|
||||
const_iterator __e = cend();
|
||||
while (!__m.empty())
|
||||
__tree_.__insert_multi(__e.__i_,
|
||||
_VSTD::move(__m.__tree_.remove(__m.begin().__i_)->__value_.__nc));
|
||||
_VSTD::move(__m.__tree_.remove(__m.begin().__i_)->__value_.__move()));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -314,7 +314,7 @@ extern "C++" {
|
||||
#ifdef signbit
|
||||
|
||||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
__libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT
|
||||
{
|
||||
@ -376,7 +376,7 @@ signbit(_A1) _NOEXCEPT
|
||||
#ifdef fpclassify
|
||||
|
||||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT
|
||||
{
|
||||
@ -422,7 +422,7 @@ fpclassify(_A1 __lcpp_x) _NOEXCEPT
|
||||
#ifdef isfinite
|
||||
|
||||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
|
||||
{
|
||||
@ -456,7 +456,7 @@ isfinite(_A1) _NOEXCEPT
|
||||
#ifdef isinf
|
||||
|
||||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
__libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
|
||||
{
|
||||
@ -483,6 +483,20 @@ typename std::enable_if<
|
||||
isinf(_A1) _NOEXCEPT
|
||||
{ return false; }
|
||||
|
||||
#ifdef _LIBCPP_PREFERRED_OVERLOAD
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
isinf(float __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
|
||||
bool
|
||||
isinf(double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
isinf(long double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); }
|
||||
#endif
|
||||
|
||||
#endif // isinf
|
||||
|
||||
// isnan
|
||||
@ -490,7 +504,7 @@ isinf(_A1) _NOEXCEPT
|
||||
#ifdef isnan
|
||||
|
||||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
|
||||
{
|
||||
@ -513,6 +527,20 @@ typename std::enable_if<std::is_integral<_A1>::value, bool>::type
|
||||
isnan(_A1) _NOEXCEPT
|
||||
{ return false; }
|
||||
|
||||
#ifdef _LIBCPP_PREFERRED_OVERLOAD
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
isnan(float __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
|
||||
bool
|
||||
isnan(double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
isnan(long double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
|
||||
#endif
|
||||
|
||||
#endif // isnan
|
||||
|
||||
// isnormal
|
||||
@ -520,7 +548,7 @@ isnan(_A1) _NOEXCEPT
|
||||
#ifdef isnormal
|
||||
|
||||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
__libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT
|
||||
{
|
||||
@ -550,7 +578,7 @@ isnormal(_A1 __lcpp_x) _NOEXCEPT
|
||||
#ifdef isgreater
|
||||
|
||||
template <class _A1, class _A2>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
__libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
|
||||
{
|
||||
@ -580,7 +608,7 @@ isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
|
||||
#ifdef isgreaterequal
|
||||
|
||||
template <class _A1, class _A2>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
__libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
|
||||
{
|
||||
@ -610,7 +638,7 @@ isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
|
||||
#ifdef isless
|
||||
|
||||
template <class _A1, class _A2>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
__libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
|
||||
{
|
||||
@ -640,7 +668,7 @@ isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
|
||||
#ifdef islessequal
|
||||
|
||||
template <class _A1, class _A2>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
__libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
|
||||
{
|
||||
@ -670,7 +698,7 @@ islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
|
||||
#ifdef islessgreater
|
||||
|
||||
template <class _A1, class _A2>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
__libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
|
||||
{
|
||||
@ -700,7 +728,7 @@ islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
|
||||
#ifdef isunordered
|
||||
|
||||
template <class _A1, class _A2>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
__libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
|
||||
{
|
||||
@ -1486,4 +1514,18 @@ trunc(_A1 __lcpp_x) _NOEXCEPT {return ::trunc((double)__lcpp_x);}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#else // _LIBCPP_MATH_H
|
||||
|
||||
// This include lives outside the header guard in order to support an MSVC
|
||||
// extension which allows users to do:
|
||||
//
|
||||
// #define _USE_MATH_DEFINES
|
||||
// #include <math.h>
|
||||
//
|
||||
// and receive the definitions of mathematical constants, even if <math.h>
|
||||
// has previously been included.
|
||||
#if defined(_LIBCPP_MSVCRT) && defined(_USE_MATH_DEFINES)
|
||||
#include_next <math.h>
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_MATH_H
|
||||
|
@ -18,7 +18,7 @@ namespace std
|
||||
{
|
||||
|
||||
struct allocator_arg_t { };
|
||||
constexpr allocator_arg_t allocator_arg = allocator_arg_t();
|
||||
inline constexpr allocator_arg_t allocator_arg = allocator_arg_t();
|
||||
|
||||
template <class T, class Alloc> struct uses_allocator;
|
||||
|
||||
@ -126,9 +126,10 @@ public:
|
||||
|
||||
template <class U> struct rebind {typedef allocator<U> other;};
|
||||
|
||||
allocator() noexcept;
|
||||
allocator(const allocator&) noexcept;
|
||||
template <class U> allocator(const allocator<U>&) noexcept;
|
||||
constexpr allocator() noexcept; // constexpr in C++20
|
||||
constexpr allocator(const allocator&) noexcept; // constexpr in C++20
|
||||
template <class U>
|
||||
constexpr allocator(const allocator<U>&) noexcept; // constexpr in C++20
|
||||
~allocator();
|
||||
pointer address(reference x) const noexcept;
|
||||
const_pointer address(const_reference x) const noexcept;
|
||||
@ -631,6 +632,9 @@ template <class T> struct hash;
|
||||
template <class T, class D> struct hash<unique_ptr<T, D> >;
|
||||
template <class T> struct hash<shared_ptr<T> >;
|
||||
|
||||
template <class T, class Alloc>
|
||||
inline constexpr bool uses_allocator_v = uses_allocator<T, Alloc>::value;
|
||||
|
||||
// Pointer safety
|
||||
enum class pointer_safety { relaxed, preferred, strict };
|
||||
void declare_reachable(void *p);
|
||||
@ -675,7 +679,7 @@ _LIBCPP_PUSH_MACROS
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _ValueType>
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_ValueType __libcpp_relaxed_load(_ValueType const* __value) {
|
||||
#if !defined(_LIBCPP_HAS_NO_THREADS) && \
|
||||
defined(__ATOMIC_RELAXED) && \
|
||||
@ -687,7 +691,7 @@ _ValueType __libcpp_relaxed_load(_ValueType const* __value) {
|
||||
}
|
||||
|
||||
template <class _ValueType>
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_ValueType __libcpp_acquire_load(_ValueType const* __value) {
|
||||
#if !defined(_LIBCPP_HAS_NO_THREADS) && \
|
||||
defined(__ATOMIC_ACQUIRE) && \
|
||||
@ -1775,8 +1779,13 @@ public:
|
||||
|
||||
template <class _Up> struct rebind {typedef allocator<_Up> other;};
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY allocator() _NOEXCEPT {}
|
||||
template <class _Up> _LIBCPP_INLINE_VISIBILITY allocator(const allocator<_Up>&) _NOEXCEPT {}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
allocator() _NOEXCEPT {}
|
||||
|
||||
template <class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
allocator(const allocator<_Up>&) _NOEXCEPT {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY pointer address(reference __x) const _NOEXCEPT
|
||||
{return _VSTD::addressof(__x);}
|
||||
_LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const _NOEXCEPT
|
||||
@ -1787,10 +1796,10 @@ public:
|
||||
if (__n > max_size())
|
||||
__throw_length_error("allocator<T>::allocate(size_t n)"
|
||||
" 'n' exceeds maximum supported size");
|
||||
return static_cast<pointer>(_VSTD::__allocate(__n * sizeof(_Tp)));
|
||||
return static_cast<pointer>(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), __alignof(_Tp)));
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) _NOEXCEPT
|
||||
{_VSTD::__libcpp_deallocate((void*)__p);}
|
||||
{_VSTD::__libcpp_deallocate((void*)__p, __alignof(_Tp));}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT
|
||||
{return size_type(~0) / sizeof(_Tp);}
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
@ -1874,8 +1883,13 @@ public:
|
||||
|
||||
template <class _Up> struct rebind {typedef allocator<_Up> other;};
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY allocator() _NOEXCEPT {}
|
||||
template <class _Up> _LIBCPP_INLINE_VISIBILITY allocator(const allocator<_Up>&) _NOEXCEPT {}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
allocator() _NOEXCEPT {}
|
||||
|
||||
template <class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
allocator(const allocator<_Up>&) _NOEXCEPT {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const _NOEXCEPT
|
||||
{return _VSTD::addressof(__x);}
|
||||
_LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, allocator<void>::const_pointer = 0)
|
||||
@ -1883,10 +1897,10 @@ public:
|
||||
if (__n > max_size())
|
||||
__throw_length_error("allocator<const T>::allocate(size_t n)"
|
||||
" 'n' exceeds maximum supported size");
|
||||
return static_cast<pointer>(_VSTD::__allocate(__n * sizeof(_Tp)));
|
||||
return static_cast<pointer>(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), __alignof(_Tp)));
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) _NOEXCEPT
|
||||
{_VSTD::__libcpp_deallocate((void*) const_cast<_Tp *>(__p));}
|
||||
{_VSTD::__libcpp_deallocate((void*) const_cast<_Tp *>(__p), __alignof(_Tp));}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT
|
||||
{return size_type(~0) / sizeof(_Tp);}
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
@ -1989,6 +2003,7 @@ public:
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_NO_CFI
|
||||
pair<_Tp*, ptrdiff_t>
|
||||
get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT
|
||||
{
|
||||
@ -2000,7 +2015,28 @@ get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT
|
||||
__n = __m;
|
||||
while (__n > 0)
|
||||
{
|
||||
#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
|
||||
if (__is_overaligned_for_new(__alignof(_Tp)))
|
||||
{
|
||||
std::align_val_t __al =
|
||||
std::align_val_t(std::alignment_of<_Tp>::value);
|
||||
__r.first = static_cast<_Tp*>(::operator new(
|
||||
__n * sizeof(_Tp), __al, nothrow));
|
||||
} else {
|
||||
__r.first = static_cast<_Tp*>(::operator new(
|
||||
__n * sizeof(_Tp), nothrow));
|
||||
}
|
||||
#else
|
||||
if (__is_overaligned_for_new(__alignof(_Tp)))
|
||||
{
|
||||
// Since aligned operator new is unavailable, return an empty
|
||||
// buffer rather than one with invalid alignment.
|
||||
return __r;
|
||||
}
|
||||
|
||||
__r.first = static_cast<_Tp*>(::operator new(__n * sizeof(_Tp), nothrow));
|
||||
#endif
|
||||
|
||||
if (__r.first)
|
||||
{
|
||||
__r.second = __n;
|
||||
@ -2013,7 +2049,10 @@ get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void return_temporary_buffer(_Tp* __p) _NOEXCEPT {::operator delete(__p);}
|
||||
void return_temporary_buffer(_Tp* __p) _NOEXCEPT
|
||||
{
|
||||
_VSTD::__libcpp_deallocate((void*)__p, __alignof(_Tp));
|
||||
}
|
||||
|
||||
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
|
||||
template <class _Tp>
|
||||
@ -3444,7 +3483,7 @@ public:
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
_LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
|
||||
void __throw_bad_weak_ptr()
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@ -4754,8 +4793,13 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
|
||||
{
|
||||
#if _LIBCPP_STD_VER <= 11
|
||||
typedef typename common_type<_Tp*, _Up*>::type _Vp;
|
||||
return less<_Vp>()(__x.get(), __y.get());
|
||||
#else
|
||||
return less<>()(__x.get(), __y.get());
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
template<class _Tp, class _Up>
|
||||
@ -5594,6 +5638,16 @@ struct __temp_value {
|
||||
};
|
||||
#endif
|
||||
|
||||
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(_VSTD::declval<_Alloc&>().allocate(size_t(0)))>::type
|
||||
>
|
||||
: true_type {};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
@ -243,6 +243,10 @@ module std [system] {
|
||||
header "codecvt"
|
||||
export *
|
||||
}
|
||||
module compare {
|
||||
header "compare"
|
||||
export *
|
||||
}
|
||||
module complex {
|
||||
header "complex"
|
||||
export *
|
||||
@ -260,6 +264,10 @@ module std [system] {
|
||||
header "exception"
|
||||
export *
|
||||
}
|
||||
module filesystem {
|
||||
header "filesystem"
|
||||
export *
|
||||
}
|
||||
module forward_list {
|
||||
header "forward_list"
|
||||
export initializer_list
|
||||
@ -470,10 +478,15 @@ module std [system] {
|
||||
export initializer_list
|
||||
export *
|
||||
}
|
||||
module version {
|
||||
header "version"
|
||||
export *
|
||||
}
|
||||
|
||||
// FIXME: These should be private.
|
||||
module __bit_reference { header "__bit_reference" export * }
|
||||
module __debug { header "__debug" export * }
|
||||
module __errc { header "__errc" export * }
|
||||
module __functional_base { header "__functional_base" export * }
|
||||
module __hash_table { header "__hash_table" export * }
|
||||
module __locale { header "__locale" export * }
|
||||
@ -492,14 +505,6 @@ module std [system] {
|
||||
module algorithm {
|
||||
header "experimental/algorithm"
|
||||
export *
|
||||
}
|
||||
module any {
|
||||
header "experimental/any"
|
||||
export *
|
||||
}
|
||||
module chrono {
|
||||
header "experimental/chrono"
|
||||
export *
|
||||
}
|
||||
module coroutine {
|
||||
requires coroutines
|
||||
@ -542,46 +547,30 @@ module std [system] {
|
||||
header "experimental/memory_resource"
|
||||
export *
|
||||
}
|
||||
module numeric {
|
||||
header "experimental/numeric"
|
||||
export *
|
||||
}
|
||||
module optional {
|
||||
header "experimental/optional"
|
||||
export *
|
||||
}
|
||||
module propagate_const {
|
||||
header "experimental/propagate_const"
|
||||
export *
|
||||
}
|
||||
module ratio {
|
||||
header "experimental/ratio"
|
||||
export *
|
||||
}
|
||||
module regex {
|
||||
header "experimental/regex"
|
||||
export *
|
||||
}
|
||||
module simd {
|
||||
header "experimental/simd"
|
||||
export *
|
||||
}
|
||||
module set {
|
||||
header "experimental/set"
|
||||
export *
|
||||
}
|
||||
module span {
|
||||
header "span"
|
||||
export *
|
||||
}
|
||||
module string {
|
||||
header "experimental/string"
|
||||
export *
|
||||
}
|
||||
module string_view {
|
||||
header "experimental/string_view"
|
||||
export *
|
||||
}
|
||||
module system_error {
|
||||
header "experimental/system_error"
|
||||
export *
|
||||
}
|
||||
module tuple {
|
||||
header "experimental/tuple"
|
||||
export *
|
||||
}
|
||||
module type_traits {
|
||||
header "experimental/type_traits"
|
||||
export *
|
||||
|
@ -91,9 +91,9 @@ struct defer_lock_t {};
|
||||
struct try_to_lock_t {};
|
||||
struct adopt_lock_t {};
|
||||
|
||||
constexpr defer_lock_t defer_lock{};
|
||||
constexpr try_to_lock_t try_to_lock{};
|
||||
constexpr adopt_lock_t adopt_lock{};
|
||||
inline constexpr defer_lock_t defer_lock{};
|
||||
inline constexpr try_to_lock_t try_to_lock{};
|
||||
inline constexpr adopt_lock_t adopt_lock{};
|
||||
|
||||
template <class Mutex>
|
||||
class lock_guard
|
||||
|
55
include/new
55
include/new
@ -89,6 +89,7 @@ void operator delete[](void* ptr, void*) noexcept;
|
||||
|
||||
#include <__config>
|
||||
#include <exception>
|
||||
#include <type_traits>
|
||||
#include <cstddef>
|
||||
#ifdef _LIBCPP_NO_EXCEPTIONS
|
||||
#include <cstdlib>
|
||||
@ -113,6 +114,14 @@ void operator delete[](void* ptr, void*) noexcept;
|
||||
# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
|
||||
#endif
|
||||
|
||||
|
||||
#if !__has_builtin(__builtin_operator_new) || \
|
||||
__has_builtin(__builtin_operator_new) < 201802L || \
|
||||
defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || \
|
||||
!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606
|
||||
#define _LIBCPP_HAS_NO_BUILTIN_ALIGNED_OPERATOR_NEW_DELETE
|
||||
#endif
|
||||
|
||||
namespace std // purposefully not using versioning namespace
|
||||
{
|
||||
|
||||
@ -160,6 +169,7 @@ public:
|
||||
|
||||
#endif // defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11)
|
||||
|
||||
#if !defined(_LIBCPP_ABI_MICROSOFT) || defined(_LIBCPP_NO_VCRUNTIME)
|
||||
#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || _LIBCPP_STD_VER > 14
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
enum class _LIBCPP_ENUM_VIS align_val_t : size_t { };
|
||||
@ -167,6 +177,7 @@ enum class _LIBCPP_ENUM_VIS align_val_t : size_t { };
|
||||
enum align_val_t { __zero = 0, __max = (size_t)-1 };
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // std
|
||||
|
||||
@ -221,7 +232,27 @@ inline _LIBCPP_INLINE_VISIBILITY void operator delete[](void*, void*) _NOEXCEPT
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY void *__allocate(size_t __size) {
|
||||
_LIBCPP_CONSTEXPR inline _LIBCPP_INLINE_VISIBILITY bool __is_overaligned_for_new(size_t __align) _NOEXCEPT {
|
||||
#ifdef __STDCPP_DEFAULT_NEW_ALIGNMENT__
|
||||
return __align > __STDCPP_DEFAULT_NEW_ALIGNMENT__;
|
||||
#else
|
||||
return __align > alignment_of<max_align_t>::value;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY void *__libcpp_allocate(size_t __size, size_t __align) {
|
||||
#ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
|
||||
if (__is_overaligned_for_new(__align)) {
|
||||
const align_val_t __align_val = static_cast<align_val_t>(__align);
|
||||
# ifdef _LIBCPP_HAS_NO_BUILTIN_ALIGNED_OPERATOR_NEW_DELETE
|
||||
return ::operator new(__size, __align_val);
|
||||
# else
|
||||
return __builtin_operator_new(__size, __align_val);
|
||||
# endif
|
||||
}
|
||||
#else
|
||||
((void)__align);
|
||||
#endif
|
||||
#ifdef _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
|
||||
return ::operator new(__size);
|
||||
#else
|
||||
@ -229,16 +260,28 @@ inline _LIBCPP_INLINE_VISIBILITY void *__allocate(size_t __size) {
|
||||
#endif
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY void __libcpp_deallocate(void *__ptr) {
|
||||
#ifdef _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
|
||||
::operator delete(__ptr);
|
||||
inline _LIBCPP_INLINE_VISIBILITY void __libcpp_deallocate(void* __ptr, size_t __align) {
|
||||
#ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
|
||||
if (__is_overaligned_for_new(__align)) {
|
||||
const align_val_t __align_val = static_cast<align_val_t>(__align);
|
||||
# ifdef _LIBCPP_HAS_NO_BUILTIN_ALIGNED_OPERATOR_NEW_DELETE
|
||||
return ::operator delete(__ptr, __align_val);
|
||||
# else
|
||||
__builtin_operator_delete(__ptr);
|
||||
return __builtin_operator_delete(__ptr, __align_val);
|
||||
# endif
|
||||
}
|
||||
#else
|
||||
((void)__align);
|
||||
#endif
|
||||
#ifdef _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
|
||||
return ::operator delete(__ptr);
|
||||
#else
|
||||
return __builtin_operator_delete(__ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_BAD_ARRAY_LENGTH_DEFINED
|
||||
_LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
_LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH
|
||||
#endif
|
||||
|
@ -252,7 +252,7 @@ _Tp
|
||||
transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1,
|
||||
_InputIterator2 __first2, _Tp __init)
|
||||
{
|
||||
return _VSTD::transform_reduce(__first1, __last1, __first2, __init,
|
||||
return _VSTD::transform_reduce(__first1, __last1, __first2, _VSTD::move(__init),
|
||||
_VSTD::plus<>(), _VSTD::multiplies<>());
|
||||
}
|
||||
#endif
|
||||
|
@ -22,7 +22,7 @@ namespace std {
|
||||
|
||||
// 23.6.4, no-value state indicator
|
||||
struct nullopt_t{see below };
|
||||
constexpr nullopt_t nullopt(unspecified );
|
||||
inline constexpr nullopt_t nullopt(unspecified );
|
||||
|
||||
// 23.6.5, class bad_optional_access
|
||||
class bad_optional_access;
|
||||
@ -139,6 +139,10 @@ namespace std {
|
||||
private:
|
||||
T *val; // exposition only
|
||||
};
|
||||
|
||||
template<class T>
|
||||
optional(T) -> optional<T>;
|
||||
|
||||
} // namespace std
|
||||
|
||||
*/
|
||||
@ -195,7 +199,7 @@ struct nullopt_t
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr explicit nullopt_t(__secret_tag, __secret_tag) noexcept {}
|
||||
};
|
||||
|
||||
/* inline */ constexpr nullopt_t nullopt{nullopt_t::__secret_tag{}, nullopt_t::__secret_tag{}};
|
||||
_LIBCPP_INLINE_VAR constexpr nullopt_t nullopt{nullopt_t::__secret_tag{}, nullopt_t::__secret_tag{}};
|
||||
|
||||
template <class _Tp, bool = is_trivially_destructible<_Tp>::value>
|
||||
struct __optional_destruct_base;
|
||||
@ -612,8 +616,8 @@ private:
|
||||
};
|
||||
template <class _Up>
|
||||
using _CheckOptionalArgsCtor = conditional_t<
|
||||
!is_same_v<decay_t<_Up>, in_place_t> &&
|
||||
!is_same_v<decay_t<_Up>, optional>,
|
||||
!is_same_v<__uncvref_t<_Up>, in_place_t> &&
|
||||
!is_same_v<__uncvref_t<_Up>, optional>,
|
||||
_CheckOptionalArgsConstructor,
|
||||
__check_tuple_constructor_fail
|
||||
>;
|
||||
@ -761,7 +765,7 @@ public:
|
||||
class = enable_if_t
|
||||
<__lazy_and<
|
||||
integral_constant<bool,
|
||||
!is_same_v<decay_t<_Up>, optional> &&
|
||||
!is_same_v<__uncvref_t<_Up>, optional> &&
|
||||
!(is_same_v<_Up, value_type> && is_scalar_v<value_type>)
|
||||
>,
|
||||
is_constructible<value_type, _Up>,
|
||||
@ -1003,6 +1007,11 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
|
||||
template<class T>
|
||||
optional(T) -> optional<T>;
|
||||
#endif
|
||||
|
||||
// Comparisons between optionals
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
|
@ -232,7 +232,7 @@ public:
|
||||
basic_ostream& seekp(off_type __off, ios_base::seekdir __dir);
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream() {} // extension, intentially does not initialize
|
||||
};
|
||||
|
||||
@ -249,7 +249,7 @@ public:
|
||||
explicit sentry(basic_ostream<_CharT, _Traits>& __os);
|
||||
~sentry();
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_EXPLICIT
|
||||
operator bool() const {return __ok_;}
|
||||
};
|
||||
@ -1071,19 +1071,17 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p)
|
||||
return __os << __p.get();
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DECLTYPE
|
||||
template<class _CharT, class _Traits, class _Yp, class _Dp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_same<void, typename __void_t<decltype(declval<basic_ostream<_CharT, _Traits>&>() << declval<_Yp>())>::type>::value,
|
||||
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();
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class _CharT, class _Traits, size_t _Size>
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
|
@ -69,6 +69,12 @@ public:
|
||||
void swap(queue& q) noexcept(is_nothrow_swappable_v<Container>)
|
||||
};
|
||||
|
||||
template<class Container>
|
||||
queue(Container) -> queue<typename Container::value_type, Container>; // C++17
|
||||
|
||||
template<class Container, class Allocator>
|
||||
queue(Container, Allocator) -> queue<typename Container::value_type, Container>; // C++17
|
||||
|
||||
template <class T, class Container>
|
||||
bool operator==(const queue<T, Container>& x,const queue<T, Container>& y);
|
||||
|
||||
@ -157,6 +163,20 @@ public:
|
||||
is_nothrow_swappable_v<Comp>)
|
||||
};
|
||||
|
||||
template <class Compare, class Container>
|
||||
priority_queue(Compare, Container)
|
||||
-> priority_queue<typename Container::value_type, Container, Compare>; // C++17
|
||||
|
||||
template<class InputIterator,
|
||||
class Compare = less<typename iterator_traits<InputIterator>::value_type>,
|
||||
class Container = vector<typename iterator_traits<InputIterator>::value_type>>
|
||||
priority_queue(InputIterator, InputIterator, Compare = Compare(), Container = Container())
|
||||
-> priority_queue<typename iterator_traits<InputIterator>::value_type, Container, Compare>; // C++17
|
||||
|
||||
template<class Compare, class Container, class Allocator>
|
||||
priority_queue(Compare, Container, Allocator)
|
||||
-> priority_queue<typename Container::value_type, Container, Compare>; // C++17
|
||||
|
||||
template <class T, class Container, class Compare>
|
||||
void swap(priority_queue<T, Container, Compare>& x,
|
||||
priority_queue<T, Container, Compare>& y)
|
||||
@ -290,7 +310,7 @@ public:
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
reference emplace(_Args&&... __args)
|
||||
decltype(auto) emplace(_Args&&... __args)
|
||||
{ return c.emplace_back(_VSTD::forward<_Args>(__args)...);}
|
||||
#else
|
||||
void emplace(_Args&&... __args)
|
||||
@ -321,6 +341,22 @@ public:
|
||||
operator< (const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y);
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
|
||||
template<class _Container,
|
||||
class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type
|
||||
>
|
||||
queue(_Container)
|
||||
-> queue<typename _Container::value_type, _Container>;
|
||||
|
||||
template<class _Container,
|
||||
class _Alloc,
|
||||
class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type,
|
||||
class = typename enable_if< __is_allocator<_Alloc>::value, nullptr_t>::type
|
||||
>
|
||||
queue(_Container, _Alloc)
|
||||
-> queue<typename _Container::value_type, _Container>;
|
||||
#endif
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
@ -515,6 +551,36 @@ public:
|
||||
__is_nothrow_swappable<value_compare>::value);
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
|
||||
template <class _Compare,
|
||||
class _Container,
|
||||
class = typename enable_if<!__is_allocator<_Compare>::value, nullptr_t>::type,
|
||||
class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type
|
||||
>
|
||||
priority_queue(_Compare, _Container)
|
||||
-> priority_queue<typename _Container::value_type, _Container, _Compare>;
|
||||
|
||||
template<class _InputIterator,
|
||||
class _Compare = less<typename iterator_traits<_InputIterator>::value_type>,
|
||||
class _Container = vector<typename iterator_traits<_InputIterator>::value_type>,
|
||||
class = typename enable_if< __is_input_iterator<_InputIterator>::value, nullptr_t>::type,
|
||||
class = typename enable_if<!__is_allocator<_Compare>::value, nullptr_t>::type,
|
||||
class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type
|
||||
>
|
||||
priority_queue(_InputIterator, _InputIterator, _Compare = _Compare(), _Container = _Container())
|
||||
-> priority_queue<typename iterator_traits<_InputIterator>::value_type, _Container, _Compare>;
|
||||
|
||||
template<class _Compare,
|
||||
class _Container,
|
||||
class _Alloc,
|
||||
class = typename enable_if<!__is_allocator<_Compare>::value, nullptr_t>::type,
|
||||
class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type,
|
||||
class = typename enable_if< __is_allocator<_Alloc>::value, nullptr_t>::type
|
||||
>
|
||||
priority_queue(_Compare, _Container, _Alloc)
|
||||
-> priority_queue<typename _Container::value_type, _Container, _Compare>;
|
||||
#endif
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp,
|
||||
|
@ -4673,7 +4673,7 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr
|
||||
double __py;
|
||||
if (__x < 10)
|
||||
{
|
||||
const result_type __fac[] = {1, 1, 2, 6, 24, 120, 720, 5040,
|
||||
const double __fac[] = {1, 1, 2, 6, 24, 120, 720, 5040,
|
||||
40320, 362880};
|
||||
__px = -__pr.__mean_;
|
||||
__py = _VSTD::pow(__pr.__mean_, (double)__x) / __fac[__x];
|
||||
|
@ -63,17 +63,17 @@ typedef ratio< 1000000000000000000000, 1> zetta; // not supported
|
||||
typedef ratio<1000000000000000000000000, 1> yotta; // not supported
|
||||
|
||||
// 20.11.5, ratio comparison
|
||||
template <class R1, class R2> constexpr bool ratio_equal_v
|
||||
template <class R1, class R2> inline constexpr bool ratio_equal_v
|
||||
= ratio_equal<R1, R2>::value; // C++17
|
||||
template <class R1, class R2> constexpr bool ratio_not_equal_v
|
||||
template <class R1, class R2> inline constexpr bool ratio_not_equal_v
|
||||
= ratio_not_equal<R1, R2>::value; // C++17
|
||||
template <class R1, class R2> constexpr bool ratio_less_v
|
||||
template <class R1, class R2> inline constexpr bool ratio_less_v
|
||||
= ratio_less<R1, R2>::value; // C++17
|
||||
template <class R1, class R2> constexpr bool ratio_less_equal_v
|
||||
template <class R1, class R2> inline constexpr bool ratio_less_equal_v
|
||||
= ratio_less_equal<R1, R2>::value; // C++17
|
||||
template <class R1, class R2> constexpr bool ratio_greater_v
|
||||
template <class R1, class R2> inline constexpr bool ratio_greater_v
|
||||
= ratio_greater<R1, R2>::value; // C++17
|
||||
template <class R1, class R2> constexpr bool ratio_greater_equal_v
|
||||
template <class R1, class R2> inline constexpr bool ratio_greater_equal_v
|
||||
= ratio_greater_equal<R1, R2>::value; // C++17
|
||||
}
|
||||
*/
|
||||
@ -501,22 +501,28 @@ struct __ratio_gcd
|
||||
};
|
||||
|
||||
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
|
||||
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_equal_v
|
||||
template <class _R1, class _R2>
|
||||
_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool ratio_equal_v
|
||||
= ratio_equal<_R1, _R2>::value;
|
||||
|
||||
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_not_equal_v
|
||||
template <class _R1, class _R2>
|
||||
_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool ratio_not_equal_v
|
||||
= ratio_not_equal<_R1, _R2>::value;
|
||||
|
||||
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_less_v
|
||||
template <class _R1, class _R2>
|
||||
_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool ratio_less_v
|
||||
= ratio_less<_R1, _R2>::value;
|
||||
|
||||
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_less_equal_v
|
||||
template <class _R1, class _R2>
|
||||
_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool ratio_less_equal_v
|
||||
= ratio_less_equal<_R1, _R2>::value;
|
||||
|
||||
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_greater_v
|
||||
template <class _R1, class _R2>
|
||||
_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool ratio_greater_v
|
||||
= ratio_greater<_R1, _R2>::value;
|
||||
|
||||
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_greater_equal_v
|
||||
template <class _R1, class _R2>
|
||||
_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool ratio_greater_equal_v
|
||||
= ratio_greater_equal<_R1, _R2>::value;
|
||||
#endif
|
||||
|
||||
|
@ -192,6 +192,11 @@ public:
|
||||
void swap(basic_regex&);
|
||||
};
|
||||
|
||||
template<class ForwardIterator>
|
||||
basic_regex(ForwardIterator, ForwardIterator,
|
||||
regex_constants::syntax_option_type = regex_constants::ECMAScript)
|
||||
-> basic_regex<typename iterator_traits<ForwardIterator>::value_type>; // C++17
|
||||
|
||||
typedef basic_regex<char> regex;
|
||||
typedef basic_regex<wchar_t> wregex;
|
||||
|
||||
@ -963,7 +968,7 @@ public:
|
||||
};
|
||||
|
||||
template <regex_constants::error_type _Ev>
|
||||
_LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
|
||||
void __throw_regex_error()
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@ -2922,6 +2927,15 @@ private:
|
||||
template <class, class> friend class __lookahead;
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
|
||||
template <class _ForwardIterator,
|
||||
class = typename enable_if<__is_forward_iterator<_ForwardIterator>::value, nullptr_t>::type
|
||||
>
|
||||
basic_regex(_ForwardIterator, _ForwardIterator,
|
||||
regex_constants::syntax_option_type = regex_constants::ECMAScript)
|
||||
-> basic_regex<typename iterator_traits<_ForwardIterator>::value_type>;
|
||||
#endif
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::icase;
|
||||
template <class _CharT, class _Traits>
|
||||
@ -4013,7 +4027,7 @@ basic_regex<_CharT, _Traits>::__parse_character_class(_ForwardIterator __first,
|
||||
char_class_type __class_type =
|
||||
__traits_.lookup_classname(__first, __temp, __flags_ & icase);
|
||||
if (__class_type == 0)
|
||||
__throw_regex_error<regex_constants::error_brack>();
|
||||
__throw_regex_error<regex_constants::error_ctype>();
|
||||
__ml->__add_class(__class_type);
|
||||
__first = _VSTD::next(__temp, 2);
|
||||
return __first;
|
||||
|
@ -668,7 +668,7 @@ public:
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
|
||||
count(const _K2& __k) const {return __tree_.__count_unique(__k);}
|
||||
count(const _K2& __k) const {return __tree_.__count_multi(__k);}
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator lower_bound(const key_type& __k)
|
||||
@ -715,11 +715,11 @@ public:
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
|
||||
equal_range(const _K2& __k) {return __tree_.__equal_range_unique(__k);}
|
||||
equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);}
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
|
||||
equal_range(const _K2& __k) const {return __tree_.__equal_range_unique(__k);}
|
||||
equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -1077,7 +1077,7 @@ public:
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
|
||||
count(const _K2& __k) {return __tree_.__count_multi(__k);}
|
||||
count(const _K2& __k) const {return __tree_.__count_multi(__k);}
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user