Vendor import of libc++ trunk r300422:
https://llvm.org/svn/llvm-project/libcxx/trunk@300422
This commit is contained in:
parent
868847c690
commit
0dc0969cd0
@ -2,13 +2,9 @@ BasedOnStyle: LLVM
|
||||
|
||||
---
|
||||
Language: Cpp
|
||||
Standard: Cpp03
|
||||
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
BreakBeforeBraces: Custom
|
||||
BraceWrapping:
|
||||
AfterClass: true
|
||||
AfterFunction: true
|
||||
PointerAlignment: Left
|
||||
|
||||
# Disable formatting options which may break tests.
|
||||
|
100
CMakeLists.txt
100
CMakeLists.txt
@ -19,12 +19,11 @@ set(CMAKE_MODULE_PATH
|
||||
${CMAKE_MODULE_PATH}
|
||||
)
|
||||
|
||||
|
||||
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
project(libcxx CXX C)
|
||||
|
||||
set(PACKAGE_NAME libcxx)
|
||||
set(PACKAGE_VERSION 4.0.0)
|
||||
set(PACKAGE_VERSION 5.0.0svn)
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
set(PACKAGE_BUGREPORT "llvm-bugs@lists.llvm.org")
|
||||
|
||||
@ -32,6 +31,15 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
include(HandleOutOfTreeLLVM)
|
||||
endif()
|
||||
|
||||
if (LIBCXX_STANDALONE_BUILD)
|
||||
include(FindPythonInterp)
|
||||
if( NOT PYTHONINTERP_FOUND )
|
||||
message(WARNING "Failed to find python interpreter. "
|
||||
"The libc++ test suite will be disabled.")
|
||||
set(LLVM_INCLUDE_TESTS OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Require out of source build.
|
||||
include(MacroEnsureOutOfSourceBuild)
|
||||
MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
|
||||
@ -39,13 +47,20 @@ MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
|
||||
build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there."
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
set(LIBCXX_TARGETING_MSVC ON)
|
||||
else()
|
||||
set(LIBCXX_TARGETING_MSVC OFF)
|
||||
endif()
|
||||
|
||||
#===============================================================================
|
||||
# Setup CMake Options
|
||||
#===============================================================================
|
||||
include(CMakeDependentOption)
|
||||
include(HandleCompilerRT)
|
||||
|
||||
# Basic options ---------------------------------------------------------------
|
||||
option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
|
||||
option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." OFF)
|
||||
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
|
||||
option(LIBCXX_ENABLE_STATIC "Build libc++ as a static library." ON)
|
||||
option(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY "Build libc++experimental.a" ON)
|
||||
@ -89,18 +104,9 @@ endif()
|
||||
# ABI Library options ---------------------------------------------------------
|
||||
set(LIBCXX_CXX_ABI "default" CACHE STRING
|
||||
"Specify C++ ABI library to use.")
|
||||
set(CXXABIS none default libcxxabi libcxxrt libstdc++ libsupc++)
|
||||
set(CXXABIS none default libcxxabi libcxxrt libstdc++ libsupc++ vcruntime)
|
||||
set_property(CACHE LIBCXX_CXX_ABI PROPERTY STRINGS ;${CXXABIS})
|
||||
|
||||
# FIXME: This is a temporary hack to force LLVM buildbots to store
|
||||
# the fixed cache entry instead of the previous cache entry. This is needed
|
||||
# because some LLVM buildbots don't clear their cache. It will be removed
|
||||
# once all LLVM bots have been run.
|
||||
if (LIBCXX_CXX_ABI STREQUAL "")
|
||||
set(LIBCXX_CXX_ABI "default" CACHE STRING
|
||||
"Specify the C++ ABI library to use." FORCE)
|
||||
endif()
|
||||
|
||||
# Setup the default options if LIBCXX_CXX_ABI is not specified.
|
||||
if (LIBCXX_CXX_ABI STREQUAL "default")
|
||||
find_path(
|
||||
@ -110,15 +116,18 @@ if (LIBCXX_CXX_ABI STREQUAL "default")
|
||||
${LLVM_MAIN_SRC_DIR}/runtimes/libcxxabi/include
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
if (NOT DEFINED LIBCXX_STANDALONE_BUILD AND
|
||||
if ((NOT LIBCXX_STANDALONE_BUILD OR HAVE_LIBCXXABI) AND
|
||||
IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
|
||||
set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
|
||||
set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}")
|
||||
set(LIBCXX_CXX_ABI_INTREE 1)
|
||||
else()
|
||||
if (WIN32 AND NOT MINGW)
|
||||
if (LIBCXX_TARGETING_MSVC)
|
||||
# FIXME: Figure out how to configure the ABI library on Windows.
|
||||
set(LIBCXX_CXX_ABI_LIBNAME "none")
|
||||
set(LIBCXX_CXX_ABI_LIBNAME "vcruntime")
|
||||
elseif(APPLE)
|
||||
set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
|
||||
set(LIBCXX_CXX_ABI_SYSTEM 1)
|
||||
else()
|
||||
set(LIBCXX_CXX_ABI_LIBNAME "default")
|
||||
endif()
|
||||
@ -133,7 +142,7 @@ option(LIBCXX_ENABLE_STATIC_ABI_LIBRARY "Statically link the ABI library" 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'
|
||||
# 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)
|
||||
@ -149,9 +158,25 @@ option(LIBCXX_ENABLE_ABI_LINKER_SCRIPT
|
||||
"Use and install a linker script for the given ABI library"
|
||||
${ENABLE_LINKER_SCRIPT_DEFAULT_VALUE})
|
||||
|
||||
set(ENABLE_NEW_DELETE_DEFAULT ON)
|
||||
if (LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS)
|
||||
# FIXME: This option should default to off. Unfortunatly GCC 4.9 fails to link
|
||||
# programs due to undefined references to new/delete in libc++abi so to work
|
||||
# around this libc++abi currently defaults LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS
|
||||
# to ON. Once the GCC bug has been worked around this option should be changed
|
||||
# back to OFF.
|
||||
set(ENABLE_NEW_DELETE_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
option(LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS
|
||||
"Build libc++ with definitions for operator new/delete. This option can
|
||||
be used to disable the definitions when libc++abi is expected to provide
|
||||
them" ${ENABLE_NEW_DELETE_DEFAULT})
|
||||
|
||||
# Build libc++abi with libunwind. We need this option to determine whether to
|
||||
# link with libunwind or libgcc_s while running the test cases.
|
||||
option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF)
|
||||
option(LIBCXXABI_ENABLE_STATIC_UNWINDER "Statically link the LLVM unwinder." OFF)
|
||||
|
||||
# Target options --------------------------------------------------------------
|
||||
option(LIBCXX_BUILD_32_BITS "Build 32 bit libc++." ${LLVM_BUILD_32_BITS})
|
||||
@ -316,10 +341,13 @@ endif()
|
||||
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")
|
||||
set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
|
||||
file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}")
|
||||
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR})
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR})
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR})
|
||||
|
||||
# Declare libc++ configuration variables.
|
||||
# They are intended for use as follows:
|
||||
@ -342,9 +370,9 @@ include(HandleLibcxxFlags)
|
||||
# 'config-ix' use them during feature checks. It also adds them to both
|
||||
# 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS'
|
||||
add_target_flags_if(LIBCXX_BUILD_32_BITS "-m32")
|
||||
add_target_flags_if(LIBCXX_TARGET_TRIPLE "-target ${LIBCXX_TARGET_TRIPLE}")
|
||||
add_target_flags_if(LIBCXX_TARGET_TRIPLE "--target=${LIBCXX_TARGET_TRIPLE}")
|
||||
add_target_flags_if(LIBCXX_SYSROOT "--sysroot=${LIBCXX_SYSROOT}")
|
||||
add_target_flags_if(LIBCXX_GCC_TOOLCHAIN "-gcc-toolchain ${LIBCXX_GCC_TOOLCHAIN}")
|
||||
add_target_flags_if(LIBCXX_GCC_TOOLCHAIN "--gcc-toolchain=${LIBCXX_GCC_TOOLCHAIN}")
|
||||
if (LIBCXX_TARGET_TRIPLE)
|
||||
set(TARGET_TRIPLE "${LIBCXX_TARGET_TRIPLE}")
|
||||
endif()
|
||||
@ -363,6 +391,11 @@ if (LIBCXX_GENERATE_COVERAGE)
|
||||
endif()
|
||||
|
||||
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
|
||||
if (uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
|
||||
set(LIBCXX_DEBUG_BUILD ON)
|
||||
else()
|
||||
set(LIBCXX_DEBUG_BUILD OFF)
|
||||
endif()
|
||||
|
||||
#===============================================================================
|
||||
# Setup Compiler Flags
|
||||
@ -373,13 +406,18 @@ include(HandleLibCXXABI) # Setup the ABI library flags
|
||||
if (NOT LIBCXX_STANDALONE_BUILD)
|
||||
# Remove flags that may have snuck in.
|
||||
remove_flags(-DNDEBUG -UNDEBUG -D_DEBUG
|
||||
-lc++abi -m32)
|
||||
-lc++abi)
|
||||
endif()
|
||||
remove_flags(-stdlib=libc++ -stdlib=libstdc++)
|
||||
|
||||
# FIXME: Remove all debug flags and flags that change which Windows
|
||||
# default libraries are linked. Currently we only support linking the
|
||||
# non-debug DLLs
|
||||
remove_flags("/D_DEBUG" "/MTd" "/MDd" "/MT" "/Md")
|
||||
|
||||
# FIXME(EricWF): See the FIXME on LIBCXX_ENABLE_PEDANTIC.
|
||||
# Remove the -pedantic flag and -Wno-pedantic and -pedantic-errors
|
||||
# so they don't get transformed into -Wno and -errors respectivly.
|
||||
# so they don't get transformed into -Wno and -errors respectively.
|
||||
remove_flags(-Wno-pedantic -pedantic-errors -pedantic)
|
||||
|
||||
# Required flags ==============================================================
|
||||
@ -412,6 +450,10 @@ add_compile_flags_if_supported(-fvisibility-inlines-hidden)
|
||||
# library.
|
||||
add_definitions(-D_LIBCPP_BUILDING_LIBRARY)
|
||||
|
||||
if (NOT LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS)
|
||||
add_definitions(-D_LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS)
|
||||
endif()
|
||||
|
||||
# Warning flags ===============================================================
|
||||
add_definitions(-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
add_compile_flags_if_supported(
|
||||
@ -425,7 +467,8 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
|
||||
add_compile_flags_if_supported(
|
||||
-Wno-literal-suffix
|
||||
-Wno-c++14-compat)
|
||||
-Wno-c++14-compat
|
||||
-Wno-noexcept-type)
|
||||
endif()
|
||||
if (LIBCXX_ENABLE_WERROR)
|
||||
add_compile_flags_if_supported(-Werror)
|
||||
@ -474,9 +517,11 @@ endif()
|
||||
# Assertion flags =============================================================
|
||||
define_if(LIBCXX_ENABLE_ASSERTIONS -UNDEBUG)
|
||||
define_if_not(LIBCXX_ENABLE_ASSERTIONS -DNDEBUG)
|
||||
if (LIBCXX_ENABLE_ASSERTIONS)
|
||||
define_if(LIBCXX_ENABLE_ASSERTIONS -D_LIBCPP_DEBUG=0)
|
||||
define_if(LIBCXX_DEBUG_BUILD -D_DEBUG)
|
||||
if (LIBCXX_ENABLE_ASSERTIONS AND NOT LIBCXX_DEBUG_BUILD)
|
||||
# MSVC doesn't like _DEBUG on release builds. See PR 4379.
|
||||
define_if_not(MSVC -D_DEBUG)
|
||||
define_if_not(LIBCXX_TARGETING_MSVC -D_DEBUG)
|
||||
endif()
|
||||
|
||||
# Modules flags ===============================================================
|
||||
@ -576,10 +621,15 @@ add_subdirectory(lib)
|
||||
if (LIBCXX_INCLUDE_BENCHMARKS)
|
||||
add_subdirectory(benchmarks)
|
||||
endif()
|
||||
|
||||
# Create the lit.site.cfg file even when LIBCXX_INCLUDE_TESTS is OFF or
|
||||
# LLVM_FOUND is OFF. This allows users to run the tests manually using
|
||||
# LIT without requiring a full LLVM checkout.
|
||||
add_subdirectory(test)
|
||||
if (LIBCXX_INCLUDE_TESTS)
|
||||
add_subdirectory(test)
|
||||
add_subdirectory(lib/abi)
|
||||
endif()
|
||||
|
||||
if (LIBCXX_INCLUDE_DOCS)
|
||||
add_subdirectory(docs)
|
||||
endif()
|
||||
|
@ -81,7 +81,7 @@ E: andrew.c.morrow@gmail.com
|
||||
D: Minor patches and Linux fixes.
|
||||
|
||||
N: Michael Park
|
||||
E: mpark@apache.org
|
||||
E: mcypark@gmail.com
|
||||
D: Implementation of <variant>.
|
||||
|
||||
N: Arvid Picciani
|
||||
|
50
TODO.TXT
50
TODO.TXT
@ -17,6 +17,56 @@ Test Suite Tasks
|
||||
* Improve the quality and portability of the locale test data.
|
||||
* Convert failure tests to use Clang Verify.
|
||||
|
||||
Filesystem Tasks
|
||||
================
|
||||
* P0492r2 - Implement National body comments for Filesystem
|
||||
* INCOMPLETE - US 25: has_filename() is equivalent to just !empty()
|
||||
* INCOMPLETE - US 31: Everything is defined in terms of one implicit host system
|
||||
* INCOMPLETE - US 32: Meaning of 27.10.2.1 unclear
|
||||
* INCOMPLETE - US 33: Definition of canonical path problematic
|
||||
* INCOMPLETE - US 34: Are there attributes of a file that are not an aspect of the file system?
|
||||
* INCOMPLETE - US 35: What synchronization is required to avoid a file system race?
|
||||
* INCOMPLETE - US 36: Symbolic links themselves are attached to a directory via (hard) links
|
||||
* INCOMPLETE - US 37: The term “redundant current directory (dot) elements” is not defined
|
||||
* INCOMPLETE - US 38: Duplicates §17.3.16
|
||||
* INCOMPLETE - US 39: Remove note: Dot and dot-dot are not directories
|
||||
* INCOMPLETE - US 40: Not all directories have a parent.
|
||||
* INCOMPLETE - US 41: The term “parent directory” for a (non-directory) file is unusual
|
||||
* INCOMPLETE - US 42: Pathname resolution does not always resolve a symlink
|
||||
* INCOMPLETE - US 43: Concerns about encoded character types
|
||||
* INCOMPLETE - US 44: Definition of path in terms of a string requires leaky abstraction
|
||||
* INCOMPLETE - US 45: Generic format portability compromised by unspecified root-name
|
||||
* INCOMPLETE - US 46: filename can be empty so productions for relative-path are redundant
|
||||
* INCOMPLETE - US 47: “.” and “..” already match the name production
|
||||
* INCOMPLETE - US 48: Multiple separators are often meaningful in a root-name
|
||||
* INCOMPLETE - US 49: What does “method of conversion method” mean?
|
||||
* INCOMPLETE - US 50: 27.10.8.1 ¶ 1.4 largely redundant with ¶ 1.3
|
||||
* INCOMPLETE - US 51: Failing to add / when appending empty string prevents useful apps
|
||||
* INCOMPLETE - US 52: remove_filename() postcondition is not by itself a definition
|
||||
* INCOMPLETE - US 53: remove_filename()'s name does not correspond to its behavior
|
||||
* INCOMPLETE - US 54: remove_filename() is broken
|
||||
* INCOMPLETE - US 55: replace_extension()'s use of path as parameter is inappropriate
|
||||
* INCOMPLETE - US 56: Remove replace_extension()'s conditional addition of period
|
||||
* INCOMPLETE - US 57: On Windows, absolute paths will sort in among relative paths
|
||||
* INCOMPLETE - US 58: parent_path() behavior for root paths is useless
|
||||
* INCOMPLETE - US 59: filename() returning path for single path components is bizarre
|
||||
* INCOMPLETE - US 60: path("/foo/").filename()==path(".") is surprising
|
||||
* INCOMPLETE - US 61: Leading dots in filename() should not begin an extension
|
||||
* INCOMPLETE - US 62: It is important that stem()+extension()==filename()
|
||||
* INCOMPLETE - US 63: lexically_normal() inconsistently treats trailing "/" but not "/.." as directory
|
||||
* INCOMPLETE - US 73, CA 2: root-name is effectively implementation defined
|
||||
* INCOMPLETE - US 74, CA 3: The term “pathname” is ambiguous in some contexts
|
||||
* INCOMPLETE - US 75, CA 4: Extra flag in path constructors is needed
|
||||
* INCOMPLETE - US 76, CA 5: root-name definition is over-specified.
|
||||
* INCOMPLETE - US 77, CA 6: operator/ and other appends not useful if arg has root-name
|
||||
* INCOMPLETE - US 78, CA 7: Member absolute() in 27.10.4.1 is overspecified for non-POSIX-like O/S
|
||||
* INCOMPLETE - US 79, CA 8: Some operation functions are overspecified for implementation-defined file types
|
||||
* INCOMPLETE - US 185: Fold error_code and non-error_code signatures into one signature
|
||||
* INCOMPLETE - FI 14: directory_entry comparisons are members
|
||||
* INCOMPLETE - Late 36: permissions() error_code overload should be noexcept
|
||||
* INCOMPLETE - Late 37: permissions() actions should be separate parameter
|
||||
* INCOMPLETE - Late 42: resize_file() Postcondition missing argument
|
||||
|
||||
Misc Tasks
|
||||
==========
|
||||
* Find all sequences of >2 underscores and eradicate them.
|
||||
|
@ -3,6 +3,11 @@ if (NOT CODE_COVERAGE_LCOV)
|
||||
message(FATAL_ERROR "Cannot find lcov...")
|
||||
endif()
|
||||
|
||||
find_program(CODE_COVERAGE_LLVM_COV llvm-cov)
|
||||
if (NOT CODE_COVERAGE_LLVM_COV)
|
||||
message(FATAL_ERROR "Cannot find llvm-cov...")
|
||||
endif()
|
||||
|
||||
find_program(CODE_COVERAGE_GENHTML genhtml)
|
||||
if (NOT CODE_COVERAGE_GENHTML)
|
||||
message(FATAL_ERROR "Cannot find genhtml...")
|
||||
@ -11,6 +16,14 @@ endif()
|
||||
set(CMAKE_CXX_FLAGS_COVERAGE "-g -O0 --coverage")
|
||||
|
||||
function(setup_lcov_test_target_coverage target_name output_dir capture_dirs source_dirs)
|
||||
if (NOT DEFINED LIBCXX_BINARY_DIR)
|
||||
message(FATAL_ERROR "Variable must be set")
|
||||
endif()
|
||||
|
||||
set(GCOV_TOOL "${LIBCXX_BINARY_DIR}/llvm-cov-wrapper")
|
||||
file(GENERATE OUTPUT ${GCOV_TOOL}
|
||||
CONTENT "#!/usr/bin/env bash\n${CODE_COVERAGE_LLVM_COV} gcov \"$@\"\n")
|
||||
|
||||
file(MAKE_DIRECTORY ${output_dir})
|
||||
|
||||
set(CAPTURE_DIRS "")
|
||||
@ -27,8 +40,9 @@ function(setup_lcov_test_target_coverage target_name output_dir capture_dirs sou
|
||||
message(STATUS "Extract Directories: ${EXTRACT_DIRS}")
|
||||
|
||||
add_custom_target(generate-lib${target_name}-coverage
|
||||
COMMAND ${CODE_COVERAGE_LCOV} --capture ${CAPTURE_DIRS} -o test_coverage.info
|
||||
COMMAND ${CODE_COVERAGE_LCOV} --extract test_coverage.info ${EXTRACT_DIRS} -o test_coverage.info
|
||||
COMMAND chmod +x ${GCOV_TOOL}
|
||||
COMMAND ${CODE_COVERAGE_LCOV} --gcov-tool ${GCOV_TOOL} --capture ${CAPTURE_DIRS} -o test_coverage.info
|
||||
COMMAND ${CODE_COVERAGE_LCOV} --gcov-tool ${GCOV_TOOL} --extract test_coverage.info ${EXTRACT_DIRS} -o test_coverage.info
|
||||
COMMAND ${CODE_COVERAGE_GENHTML} --demangle-cpp test_coverage.info -o test_coverage
|
||||
COMMAND ${CMAKE_COMMAND} -E remove test_coverage.info
|
||||
WORKING_DIRECTORY ${output_dir}
|
||||
|
58
cmake/Modules/HandleCompilerRT.cmake
Normal file
58
cmake/Modules/HandleCompilerRT.cmake
Normal file
@ -0,0 +1,58 @@
|
||||
function(find_compiler_rt_library name dest)
|
||||
if (NOT DEFINED LIBCXX_COMPILE_FLAGS)
|
||||
message(FATAL_ERROR "LIBCXX_COMPILE_FLAGS must be defined when using this function")
|
||||
endif()
|
||||
set(dest "" PARENT_SCOPE)
|
||||
set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXX_COMPILE_FLAGS}
|
||||
"--rtlib=compiler-rt" "--print-libgcc-file-name")
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES Clang AND CMAKE_CXX_COMPILER_TARGET)
|
||||
list(APPEND CLANG_COMMAND "--target=${CMAKE_CXX_COMPILER_TARGET}")
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND ${CLANG_COMMAND}
|
||||
RESULT_VARIABLE HAD_ERROR
|
||||
OUTPUT_VARIABLE LIBRARY_FILE
|
||||
)
|
||||
string(STRIP "${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}")
|
||||
set(${dest} "${LIBRARY_FILE}" PARENT_SCOPE)
|
||||
else()
|
||||
message(STATUS "Failed to find compiler-rt library")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(find_compiler_rt_dir dest)
|
||||
if (NOT DEFINED LIBCXX_COMPILE_FLAGS)
|
||||
message(FATAL_ERROR "LIBCXX_COMPILE_FLAGS must be defined when using this function")
|
||||
endif()
|
||||
set(dest "" PARENT_SCOPE)
|
||||
if (APPLE)
|
||||
set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXX_COMPILE_FLAGS}
|
||||
"-print-file-name=lib")
|
||||
execute_process(
|
||||
COMMAND ${CLANG_COMMAND}
|
||||
RESULT_VARIABLE HAD_ERROR
|
||||
OUTPUT_VARIABLE LIBRARY_DIR
|
||||
)
|
||||
string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR)
|
||||
set(LIBRARY_DIR "${LIBRARY_DIR}/darwin")
|
||||
else()
|
||||
set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXX_COMPILE_FLAGS}
|
||||
"--rtlib=compiler-rt" "--print-libgcc-file-name")
|
||||
execute_process(
|
||||
COMMAND ${CLANG_COMMAND}
|
||||
RESULT_VARIABLE HAD_ERROR
|
||||
OUTPUT_VARIABLE LIBRARY_FILE
|
||||
)
|
||||
string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE)
|
||||
get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY)
|
||||
endif()
|
||||
if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}")
|
||||
message(STATUS "Found compiler-rt directory: ${LIBRARY_DIR}")
|
||||
set(${dest} "${LIBRARY_DIR}" PARENT_SCOPE)
|
||||
else()
|
||||
message(STATUS "Failed to find compiler-rt directory")
|
||||
endif()
|
||||
endfunction()
|
@ -18,6 +18,7 @@
|
||||
# abidirs : A list of relative paths to create under an include directory
|
||||
# in the libc++ build directory.
|
||||
#
|
||||
|
||||
macro(setup_abi_lib abidefines abilib abifiles abidirs)
|
||||
list(APPEND LIBCXX_COMPILE_FLAGS ${abidefines})
|
||||
set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${LIBCXX_CXX_ABI_INCLUDE_PATHS}"
|
||||
@ -32,11 +33,10 @@ macro(setup_abi_lib abidefines abilib abifiles abidirs)
|
||||
set(LIBCXX_ABILIB_FILES ${abifiles})
|
||||
|
||||
# The place in the build tree where we store out-of-source headers.
|
||||
set(LIBCXX_BUILD_HEADERS_ROOT "${CMAKE_BINARY_DIR}/include/c++-build")
|
||||
file(MAKE_DIRECTORY "${LIBCXX_BUILD_HEADERS_ROOT}")
|
||||
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/c++/v1")
|
||||
foreach(_d ${abidirs})
|
||||
file(MAKE_DIRECTORY "${LIBCXX_BUILD_HEADERS_ROOT}/${_d}")
|
||||
file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}/${_d}")
|
||||
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/c++/v1/${_d}")
|
||||
endforeach()
|
||||
|
||||
@ -48,19 +48,19 @@ macro(setup_abi_lib abidefines abilib abifiles abidirs)
|
||||
get_filename_component(dstdir ${fpath} PATH)
|
||||
get_filename_component(ifile ${fpath} NAME)
|
||||
file(COPY "${incpath}/${fpath}"
|
||||
DESTINATION "${LIBCXX_BUILD_HEADERS_ROOT}/${dstdir}"
|
||||
DESTINATION "${LIBCXX_BINARY_INCLUDE_DIR}/${dstdir}"
|
||||
)
|
||||
file(COPY "${incpath}/${fpath}"
|
||||
DESTINATION "${CMAKE_BINARY_DIR}/include/c++/v1/${dstdir}"
|
||||
)
|
||||
if (LIBCXX_INSTALL_HEADERS)
|
||||
install(FILES "${LIBCXX_BUILD_HEADERS_ROOT}/${fpath}"
|
||||
install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
|
||||
DESTINATION include/c++/v1/${dstdir}
|
||||
COMPONENT libcxx
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
)
|
||||
endif()
|
||||
list(APPEND abilib_headers "${LIBCXX_BUILD_HEADERS_ROOT}/${fpath}")
|
||||
list(APPEND abilib_headers "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}")
|
||||
endif()
|
||||
endforeach()
|
||||
if (NOT found)
|
||||
@ -68,7 +68,7 @@ macro(setup_abi_lib abidefines abilib abifiles abidirs)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
include_directories("${LIBCXX_BUILD_HEADERS_ROOT}")
|
||||
include_directories("${LIBCXX_BINARY_INCLUDE_DIR}")
|
||||
endmacro()
|
||||
|
||||
|
||||
@ -103,13 +103,17 @@ elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxabi")
|
||||
# Assume c++abi is installed in the system, rely on -lc++abi link flag.
|
||||
set(CXXABI_LIBNAME "c++abi")
|
||||
endif()
|
||||
setup_abi_lib("-DLIBCXX_BUILDING_LIBCXXABI"
|
||||
${CXXABI_LIBNAME} "cxxabi.h;__cxxabi_config.h" ""
|
||||
)
|
||||
set(HEADERS "cxxabi.h;__cxxabi_config.h")
|
||||
if (LIBCXX_CXX_ABI_SYSTEM)
|
||||
set(HEADERS "")
|
||||
endif()
|
||||
setup_abi_lib("-DLIBCXX_BUILDING_LIBCXXABI" ${CXXABI_LIBNAME} "${HEADERS}" "")
|
||||
elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxrt")
|
||||
setup_abi_lib("-DLIBCXXRT"
|
||||
"cxxrt" "cxxabi.h;unwind.h;unwind-arm.h;unwind-itanium.h" ""
|
||||
)
|
||||
elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "vcruntime")
|
||||
# Nothing TODO
|
||||
elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "none")
|
||||
list(APPEND LIBCXX_COMPILE_FLAGS "-D_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY")
|
||||
elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "default")
|
||||
|
@ -26,6 +26,10 @@ endmacro()
|
||||
# or added in other parts of LLVM's cmake configuration.
|
||||
macro(remove_flags)
|
||||
foreach(var ${ARGN})
|
||||
string(REPLACE "${var}" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
string(REPLACE "${var}" "" CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}")
|
||||
string(REPLACE "${var}" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
string(REPLACE "${var}" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||
string(REPLACE "${var}" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string(REPLACE "${var}" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
string(REPLACE "${var}" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
|
||||
|
@ -43,7 +43,8 @@ macro(find_llvm_parts)
|
||||
execute_process(
|
||||
COMMAND ${LLVM_CONFIG_PATH} --cmakedir
|
||||
RESULT_VARIABLE HAD_ERROR
|
||||
OUTPUT_VARIABLE CONFIG_OUTPUT)
|
||||
OUTPUT_VARIABLE CONFIG_OUTPUT
|
||||
ERROR_QUIET)
|
||||
if(NOT HAD_ERROR)
|
||||
string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH)
|
||||
else()
|
||||
@ -95,13 +96,6 @@ macro(configure_out_of_tree_llvm)
|
||||
endif()
|
||||
|
||||
# LLVM Options --------------------------------------------------------------
|
||||
include(FindPythonInterp)
|
||||
if( NOT PYTHONINTERP_FOUND )
|
||||
message(WARNING "Failed to find python interpreter. "
|
||||
"The libc++ test suite will be disabled.")
|
||||
set(LLVM_INCLUDE_TESTS OFF)
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED LLVM_INCLUDE_TESTS)
|
||||
set(LLVM_INCLUDE_TESTS ${LLVM_FOUND})
|
||||
endif()
|
||||
|
@ -1,4 +1,5 @@
|
||||
include(CheckLibraryExists)
|
||||
include(CheckCCompilerFlag)
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
if(WIN32 AND NOT MINGW)
|
||||
@ -24,17 +25,24 @@ endif()
|
||||
# required during compilation (which has the -nodefaultlibs). libc is
|
||||
# required for the link to go through. We remove sanitizers from the
|
||||
# configuration checks to avoid spurious link errors.
|
||||
check_cxx_compiler_flag(-nodefaultlibs LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
|
||||
check_c_compiler_flag(-nodefaultlibs LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
|
||||
if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs")
|
||||
if (LIBCXX_HAS_C_LIB)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES c)
|
||||
endif ()
|
||||
if (LIBCXX_USE_COMPILER_RT)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES -rtlib=compiler-rt)
|
||||
list(APPEND CMAKE_REQUIRED_FLAGS -rtlib=compiler-rt)
|
||||
find_compiler_rt_library(builtins LIBCXX_BUILTINS_LIBRARY)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES "${LIBCXX_BUILTINS_LIBRARY}")
|
||||
elseif (LIBCXX_HAS_GCC_S_LIB)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s)
|
||||
endif ()
|
||||
if (MINGW)
|
||||
# Mingw64 requires quite a few "C" runtime libraries in order for basic
|
||||
# programs to link successfully with -nodefaultlibs.
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES mingw32 gcc gcc_eh mingwex msvcrt gcc)
|
||||
endif()
|
||||
if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize)
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize=all")
|
||||
endif ()
|
||||
|
@ -92,6 +92,57 @@ build would look like this:
|
||||
$ make check-libcxx # optional
|
||||
|
||||
|
||||
Experimental Support for Windows
|
||||
--------------------------------
|
||||
|
||||
The Windows support requires building with clang-cl as cl does not support one
|
||||
required extension: `#include_next`. Furthermore, VS 2015 or newer (19.00) is
|
||||
required. In the case of clang-cl, we need to specify the "MS Compatibility
|
||||
Version" as it defaults to 2014 (18.00).
|
||||
|
||||
CMake + Visual Studio
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Building with Visual Studio currently does not permit running tests. However,
|
||||
it is the simplest way to build.
|
||||
|
||||
.. code-block:: batch
|
||||
|
||||
> cmake -G "Visual Studio 14 2015" ^
|
||||
-T "LLVM-vs2014" ^
|
||||
-DLIBCXX_ENABLE_SHARED=YES ^
|
||||
-DLIBCXX_ENABLE_STATIC=NO ^
|
||||
-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=NO ^
|
||||
\path\to\libcxx
|
||||
> cmake --build .
|
||||
|
||||
CMake + ninja
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
Building with ninja is required for development to enable tests.
|
||||
Unfortunately, doing so requires additional configuration as we cannot
|
||||
just specify a toolset.
|
||||
|
||||
.. code-block:: batch
|
||||
|
||||
> cmake -G Ninja ^
|
||||
-DCMAKE_MAKE_PROGRAM=/path/to/ninja ^
|
||||
-DCMAKE_SYSTEM_NAME=Windows ^
|
||||
-DCMAKE_C_COMPILER=clang-cl ^
|
||||
-DCMAKE_C_FLAGS="-fms-compatibility-version=19.00 --target=i686--windows" ^
|
||||
-DCMAKE_CXX_COMPILER=clang-c ^
|
||||
-DCMAKE_CXX_FLAGS="-fms-compatibility-version=19.00 --target=i686--windows" ^
|
||||
-DLLVM_PATH=/path/to/llvm/tree ^
|
||||
-DLIBCXX_ENABLE_SHARED=YES ^
|
||||
-DLIBCXX_ENABLE_STATIC=NO ^
|
||||
-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=NO ^
|
||||
\path\to\libcxx
|
||||
> /path/to/ninja cxx
|
||||
> /path/to/ninja check-cxx
|
||||
|
||||
Note that the paths specified with backward slashes must use the `\\` as the
|
||||
directory separator as clang-cl may otherwise parse the path as an argument.
|
||||
|
||||
.. _`libc++abi`: http://libcxxabi.llvm.org/
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@ Debug Mode
|
||||
==========
|
||||
|
||||
.. contents::
|
||||
:local
|
||||
:local:
|
||||
|
||||
.. _using-debug-mode:
|
||||
|
||||
|
@ -33,13 +33,22 @@ interface normally provided by ``<__threading_support>``.
|
||||
External Threading Library
|
||||
==========================
|
||||
|
||||
Normally ``<__threading_support>`` provides inline definitions to each internal
|
||||
threading API function it declares. However libc++ also supports using an
|
||||
external library to provide the definitions.
|
||||
libc++ can be compiled with its internal threading API delegating to an external
|
||||
library. Such a configuration is useful for library vendors who wish to
|
||||
distribute a thread-agnostic libc++ library, where the users of the library are
|
||||
expected to provide the implementation of the libc++ internal threading API.
|
||||
|
||||
When ``_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL`` libc++ does not provide inline
|
||||
definitions for the internal API, instead assuming the definitions will be
|
||||
provided by an external library.
|
||||
On a production setting, this would be achieved through a custom
|
||||
``<__external_threading>`` header, which declares the libc++ internal threading
|
||||
API but leaves out the implementation.
|
||||
|
||||
The ``-DLIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY`` option allows building libc++ in
|
||||
such a configuration while allowing it to be tested on a platform that supports
|
||||
any of the threading systems (e.g. pthread) supported in ``__threading_support``
|
||||
header. Therefore, the main purpose of this option is to allow testing of this
|
||||
particular configuration of the library without being tied to a vendor-specific
|
||||
threading system. This option is only meant to be used by libc++ library
|
||||
developers.
|
||||
|
||||
Threading Configuration Macros
|
||||
==============================
|
||||
|
@ -22,6 +22,12 @@ Visibility Macros
|
||||
Mark a symbol as being exported by the libc++ library. This attribute must
|
||||
be applied to the declaration of all functions exported by the libc++ dylib.
|
||||
|
||||
**_LIBCPP_EXTERN_VIS**
|
||||
Mark a symbol as being exported by the libc++ library. This attribute may
|
||||
only be applied to objects defined in the libc++ library. On Windows this
|
||||
macro applies `dllimport`/`dllexport` to the symbol. On all other platforms
|
||||
this macro has no effect.
|
||||
|
||||
**_LIBCPP_OVERRIDABLE_FUNC_VIS**
|
||||
Mark a symbol as being exported by the libc++ library, but allow it to be
|
||||
overridden locally. On non-Windows, this is equivalent to `_LIBCPP_FUNC_VIS`.
|
||||
@ -41,18 +47,17 @@ Visibility Macros
|
||||
A synonym for `_LIBCPP_INLINE_VISIBILITY`
|
||||
|
||||
**_LIBCPP_TYPE_VIS**
|
||||
Mark a type's typeinfo, vtable and members as having default visibility.
|
||||
This attribute cannot be used on class templates.
|
||||
|
||||
**_LIBCPP_TEMPLATE_VIS**
|
||||
Mark a type's typeinfo and vtable as having default visibility.
|
||||
`_LIBCPP_TYPE_VIS`. This macro has no effect on the visibility of the
|
||||
type's member functions. This attribute cannot be used on class templates.
|
||||
This macro has no effect on the visibility of the type's member functions.
|
||||
|
||||
**GCC Behavior**: GCC does not support Clang's `type_visibility(...)`
|
||||
attribute. With GCC the `visibility(...)` attribute is used and member
|
||||
functions are affected.
|
||||
|
||||
**_LIBCPP_TEMPLATE_VIS**
|
||||
The same as `_LIBCPP_TYPE_VIS` except that it may be applied to class
|
||||
templates.
|
||||
|
||||
**Windows Behavior**: DLLs do not support dllimport/export on class templates.
|
||||
The macro has an empty definition on this platform.
|
||||
|
||||
@ -104,6 +109,35 @@ Visibility Macros
|
||||
the extern template declaration) as exported on Windows, as discussed above.
|
||||
On all other platforms, this macro has an empty definition.
|
||||
|
||||
**_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS**
|
||||
Mark a symbol as hidden so it will not be exported from shared libraries. This
|
||||
is intended specifically for method templates of either classes marked with
|
||||
`_LIBCPP_TYPE_VIS` or classes with an extern template instantiation
|
||||
declaration marked with `_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS`.
|
||||
|
||||
When building libc++ with hidden visibility, we want explicit template
|
||||
instantiations to export members, which is consistent with existing Windows
|
||||
behavior. We also want classes annotated with `_LIBCPP_TYPE_VIS` to export
|
||||
their members, which is again consistent with existing Windows behavior.
|
||||
Both these changes are necessary for clients to be able to link against a
|
||||
libc++ DSO built with hidden visibility without encountering missing symbols.
|
||||
|
||||
An unfortunate side effect, however, is that method templates of classes
|
||||
either marked `_LIBCPP_TYPE_VIS` or with extern template instantiation
|
||||
declarations marked with `_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS` also get default
|
||||
visibility when instantiated. These methods are often implicitly instantiated
|
||||
inside other libraries which use the libc++ headers, and will therefore end up
|
||||
being exported from those libraries, since those implicit instantiations will
|
||||
receive default visibility. This is not acceptable for libraries that wish to
|
||||
control their visibility, and led to PR30642.
|
||||
|
||||
Consequently, all such problematic method templates are explicitly marked
|
||||
either hidden (via this macro) or inline, so that they don't leak into client
|
||||
libraries. The problematic methods were found by running
|
||||
`bad-visibility-finder <https://github.com/smeenai/bad-visibility-finder>`_
|
||||
against the libc++ headers after making `_LIBCPP_TYPE_VIS` and
|
||||
`_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS` expand to default visibility.
|
||||
|
||||
**_LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY**
|
||||
Mark a member function of a class template as visible and always inline. This
|
||||
macro should only be applied to member functions of class templates that are
|
||||
|
@ -146,6 +146,11 @@ thread safety annotations.
|
||||
build of libc++ which does not export any symbols, which can be useful when
|
||||
building statically for inclusion into another library.
|
||||
|
||||
**_LIBCPP_DISABLE_EXTERN_TEMPLATE**:
|
||||
This macro is used to disable extern template declarations in the libc++
|
||||
headers. The intended use case is for clients who wish to use the libc++
|
||||
headers without taking a dependency on the libc++ library itself.
|
||||
|
||||
**_LIBCPP_ENABLE_TUPLE_IMPLICIT_REDUCED_ARITY_EXTENSION**:
|
||||
This macro is used to re-enable an extension in `std::tuple` which allowed
|
||||
it to be implicitly constructed from fewer initializers than contained
|
||||
@ -173,3 +178,22 @@ thread safety annotations.
|
||||
return Tup{"hello world", 42}; // explicit constructor called. OK.
|
||||
}
|
||||
|
||||
**_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS**:
|
||||
This macro disables the additional diagnostics generated by libc++ using the
|
||||
`diagnose_if` attribute. These additional diagnostics include checks for:
|
||||
|
||||
* Giving `set`, `map`, `multiset`, `multimap` a comparator which is not
|
||||
const callable.
|
||||
|
||||
C++17 Specific Configuration Macros
|
||||
-----------------------------------
|
||||
**_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES**:
|
||||
This macro is used to re-enable all the features removed in C++17. The effect
|
||||
is equivalent to manually defining each macro listed below.
|
||||
|
||||
**_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS**:
|
||||
This macro is used to re-enable the `set_unexpected`, `get_unexpected`, and
|
||||
`unexpected` functions, which were removed in C++17.
|
||||
|
||||
**_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR**:
|
||||
This macro is used to re-enable `std::auto_ptr` in C++17.
|
||||
|
@ -47,9 +47,9 @@ copyright = u'2011-2017, LLVM Project'
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '4'
|
||||
version = '5.0'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '4'
|
||||
release = '5.0'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
@ -7,7 +7,8 @@
|
||||
Overview
|
||||
========
|
||||
|
||||
libc++ is a new implementation of the C++ standard library, targeting C++11.
|
||||
libc++ is a new implementation of the C++ standard library, targeting C++11 and
|
||||
above.
|
||||
|
||||
* Features and Goals
|
||||
|
||||
@ -119,7 +120,7 @@ This list contains known issues with libc++
|
||||
|
||||
A full list of currently open libc++ bugs can be `found here`__.
|
||||
|
||||
.. __: https://llvm.org/bugs/buglist.cgi?component=All%20Bugs&product=libc%2B%2B&query_format=advanced&resolution=---&order=changeddate%20DESC%2Cassigned_to%20DESC%2Cbug_status%2Cpriority%2Cbug_id&list_id=74184
|
||||
.. __: https://bugs.llvm.org/buglist.cgi?component=All%20Bugs&product=libc%2B%2B&query_format=advanced&resolution=---&order=changeddate%20DESC%2Cassigned_to%20DESC%2Cbug_status%2Cpriority%2Cbug_id&list_id=74184
|
||||
|
||||
Design Documents
|
||||
----------------
|
||||
@ -179,7 +180,7 @@ Quick Links
|
||||
===========
|
||||
* `LLVM Homepage <http://llvm.org/>`_
|
||||
* `libc++abi Homepage <http://libcxxabi.llvm.org/>`_
|
||||
* `LLVM Bugzilla <http://llvm.org/bugs/>`_
|
||||
* `LLVM Bugzilla <https://bugs.llvm.org/>`_
|
||||
* `cfe-commits Mailing List`_
|
||||
* `cfe-dev Mailing List`_
|
||||
* `Browse libc++ -- SVN <http://llvm.org/svn/llvm-project/libcxx/trunk/>`_
|
||||
|
171
include/__config
171
include/__config
@ -12,8 +12,10 @@
|
||||
#define _LIBCPP_CONFIG
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
|
||||
#pragma GCC system_header
|
||||
@ -23,16 +25,30 @@
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
|
||||
// The _GNUC_VER_NEW macro better represents the new GCC versioning scheme
|
||||
// introduced in GCC 5.0.
|
||||
#define _GNUC_VER_NEW (_GNUC_VER * 10 + __GNUC_PATCHLEVEL__)
|
||||
#else
|
||||
#define _GNUC_VER 0
|
||||
#define _GNUC_VER_NEW 0
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_VERSION 4000
|
||||
#define _LIBCPP_VERSION 5000
|
||||
|
||||
#ifndef _LIBCPP_ABI_VERSION
|
||||
#define _LIBCPP_ABI_VERSION 1
|
||||
#endif
|
||||
|
||||
#if defined(__ELF__)
|
||||
#define _LIBCPP_OBJECT_FORMAT_ELF 1
|
||||
#elif defined(__MACH__)
|
||||
#define _LIBCPP_OBJECT_FORMAT_MACHO 1
|
||||
#elif defined(_WIN32)
|
||||
#define _LIBCPP_OBJECT_FORMAT_COFF 1
|
||||
#else
|
||||
#error Unknown object file format
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
|
||||
// Change short string representation so that string data starts at offset 0,
|
||||
// improving its alignment in some cases.
|
||||
@ -47,7 +63,6 @@
|
||||
#define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB
|
||||
#define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
|
||||
#define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
|
||||
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
|
||||
// Don't use a nullptr_t simulation type in C++03 instead using C++11 nullptr
|
||||
// provided under the alternate keyword __nullptr, which changes the mangling
|
||||
// of nullptr_t. This option is ABI incompatible with GCC in C++03 mode.
|
||||
@ -57,10 +72,18 @@
|
||||
// `pointer_safety` and `get_pointer_safety()` will no longer be available
|
||||
// in C++03.
|
||||
#define _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE
|
||||
// Define a key function for `bad_function_call` in the library, to centralize
|
||||
// its vtable and typeinfo to libc++ rather than having all other libraries
|
||||
// using that class define their own copies.
|
||||
#define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
|
||||
#elif _LIBCPP_ABI_VERSION == 1
|
||||
#if !defined(_WIN32)
|
||||
// Enable compiling a definition of error_category() into the libc++ dylib.
|
||||
#define _LIBCPP_DEPRECATED_ABI_EXTERNAL_ERROR_CATEGORY_CONSTRUCTOR
|
||||
#if !defined(_LIBCPP_OBJECT_FORMAT_COFF)
|
||||
// Enable compiling copies of now inline methods into the dylib to support
|
||||
// applications compiled against older libraries. This is unnecessary with
|
||||
// COFF dllexport semantics, since dllexport forces a non-inline definition
|
||||
// of inline functions to be emitted anyway. Our own non-inline copy would
|
||||
// conflict with the dllexport-emitted copy, so we disable it.
|
||||
#define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS
|
||||
#endif
|
||||
// Feature macros for disabling pre ABI v1 features. All of these options
|
||||
// are deprecated.
|
||||
@ -100,6 +123,11 @@
|
||||
#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))
|
||||
|
||||
#if defined(__clang__)
|
||||
#define _LIBCPP_COMPILER_CLANG
|
||||
@ -115,7 +143,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CLANG_VER
|
||||
# define _LIBCPP_CLANG_VER 0
|
||||
#define _LIBCPP_CLANG_VER 0
|
||||
#endif
|
||||
|
||||
// FIXME: ABI detection should be done via compiler builtin macros. This
|
||||
@ -190,7 +218,6 @@
|
||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN 0
|
||||
# define _LIBCPP_SHORT_WCHAR 1
|
||||
|
||||
// If mingw not explicitly detected, assume using MS C runtime only.
|
||||
# ifndef __MINGW32__
|
||||
# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
|
||||
@ -198,6 +225,19 @@
|
||||
# if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__))
|
||||
# define _LIBCPP_HAS_BITSCAN64
|
||||
# endif
|
||||
# if defined(_LIBCPP_MSVCRT)
|
||||
# define _LIBCPP_HAS_QUICK_EXIT
|
||||
# endif
|
||||
|
||||
// Some CRT APIs are unavailable to store apps
|
||||
#if defined(WINAPI_FAMILY)
|
||||
#include <winapifamily.h>
|
||||
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && \
|
||||
(!defined(WINAPI_PARTITION_SYSTEM) || \
|
||||
!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_SYSTEM))
|
||||
#define _LIBCPP_WINDOWS_STORE_APP
|
||||
#endif
|
||||
#endif
|
||||
#endif // defined(_WIN32)
|
||||
|
||||
#ifdef __sun__
|
||||
@ -252,7 +292,7 @@
|
||||
// _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for
|
||||
// _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility.
|
||||
#if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \
|
||||
!defined(__arm__)) || \
|
||||
(!defined(__arm__) || __ARM_ARCH_7K__ >= 2)) || \
|
||||
defined(_LIBCPP_ALTERNATE_STRING_LAYOUT)
|
||||
#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
|
||||
#endif
|
||||
@ -297,7 +337,7 @@ typedef __char32_t char32_t;
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_nullptr))
|
||||
# if __has_extension(cxx_nullptr) && defined(_LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR)
|
||||
# if (__has_extension(cxx_nullptr) || __has_keyword(__nullptr)) && defined(_LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR)
|
||||
# define nullptr __nullptr
|
||||
# else
|
||||
# define _LIBCPP_HAS_NO_NULLPTR
|
||||
@ -335,7 +375,6 @@ typedef __char32_t char32_t;
|
||||
|
||||
#if __has_feature(objc_arc_weak)
|
||||
#define _LIBCPP_HAS_OBJC_ARC_WEAK
|
||||
#define _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_constexpr))
|
||||
@ -472,14 +511,13 @@ namespace std {
|
||||
|
||||
#endif // __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { inline namespace _LIBCPP_NAMESPACE {
|
||||
#define _LIBCPP_END_NAMESPACE_STD } }
|
||||
#define _VSTD std::_LIBCPP_NAMESPACE
|
||||
|
||||
namespace std {
|
||||
namespace _LIBCPP_NAMESPACE {
|
||||
}
|
||||
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
|
||||
inline namespace _LIBCPP_NAMESPACE {
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
|
||||
@ -551,14 +589,6 @@ namespace std {
|
||||
|
||||
#endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM]
|
||||
|
||||
#if defined(__ELF__)
|
||||
#define _LIBCPP_OBJECT_FORMAT_ELF 1
|
||||
#elif defined(__MACH__)
|
||||
#define _LIBCPP_OBJECT_FORMAT_MACHO 1
|
||||
#else
|
||||
#define _LIBCPP_OBJECT_FORMAT_COFF 1
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_OBJECT_FORMAT_COFF)
|
||||
#if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
|
||||
# define _LIBCPP_DLL_VIS
|
||||
@ -579,8 +609,10 @@ namespace std {
|
||||
|
||||
#define _LIBCPP_TYPE_VIS _LIBCPP_DLL_VIS
|
||||
#define _LIBCPP_FUNC_VIS _LIBCPP_DLL_VIS
|
||||
#define _LIBCPP_EXTERN_VIS _LIBCPP_DLL_VIS
|
||||
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_DLL_VIS
|
||||
#define _LIBCPP_HIDDEN
|
||||
#define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
#define _LIBCPP_TEMPLATE_VIS
|
||||
#define _LIBCPP_FUNC_VIS_ONLY
|
||||
#define _LIBCPP_ENUM_VIS
|
||||
@ -604,6 +636,15 @@ namespace std {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
|
||||
// The inline should be removed once PR32114 is resolved
|
||||
#define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCPP_HIDDEN
|
||||
#else
|
||||
#define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_FUNC_VIS
|
||||
#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
|
||||
#define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
|
||||
@ -614,24 +655,32 @@ namespace std {
|
||||
|
||||
#ifndef _LIBCPP_TYPE_VIS
|
||||
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
|
||||
# if __has_attribute(__type_visibility__)
|
||||
# define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default")))
|
||||
# else
|
||||
# define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
|
||||
# endif
|
||||
# define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
|
||||
# else
|
||||
# define _LIBCPP_TYPE_VIS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_TEMPLATE_VIS
|
||||
# define _LIBCPP_TEMPLATE_VIS _LIBCPP_TYPE_VIS
|
||||
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
|
||||
# if __has_attribute(__type_visibility__)
|
||||
# define _LIBCPP_TEMPLATE_VIS __attribute__ ((__type_visibility__("default")))
|
||||
# else
|
||||
# define _LIBCPP_TEMPLATE_VIS __attribute__ ((__visibility__("default")))
|
||||
# endif
|
||||
# else
|
||||
# define _LIBCPP_TEMPLATE_VIS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_FUNC_VIS_ONLY
|
||||
# define _LIBCPP_FUNC_VIS_ONLY _LIBCPP_FUNC_VIS
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_EXTERN_VIS
|
||||
# define _LIBCPP_EXTERN_VIS
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS
|
||||
# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_FUNC_VIS
|
||||
#endif
|
||||
@ -654,7 +703,7 @@ namespace std {
|
||||
|
||||
#ifndef _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
|
||||
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
|
||||
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__type_visibility__("default")))
|
||||
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__visibility__("default")))
|
||||
# else
|
||||
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
|
||||
# endif
|
||||
@ -739,7 +788,7 @@ template <unsigned> struct __static_assert_check {};
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_DECLTYPE
|
||||
// GCC 4.6 provides __decltype in all standard modes.
|
||||
#if !__is_identifier(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406
|
||||
#if __has_keyword(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406
|
||||
# define decltype(__x) __decltype(__x)
|
||||
#else
|
||||
# define decltype(__x) __typeof__(__x)
|
||||
@ -802,7 +851,14 @@ template <unsigned> struct __static_assert_check {};
|
||||
# else
|
||||
# error Supported values for _LIBCPP_DEBUG are 0 and 1
|
||||
# endif
|
||||
# if !defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
# define _LIBCPP_EXTERN_TEMPLATE(...)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE
|
||||
#define _LIBCPP_EXTERN_TEMPLATE(...)
|
||||
#define _LIBCPP_EXTERN_TEMPLATE2(...)
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_EXTERN_TEMPLATE
|
||||
@ -912,7 +968,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
# if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \
|
||||
(__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI)
|
||||
# define _LIBCPP_NO_RTTI
|
||||
# elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI)
|
||||
# elif defined(_LIBCPP_MSVC) && !defined(_CPPRTTI)
|
||||
# define _LIBCPP_NO_RTTI
|
||||
# endif
|
||||
#endif
|
||||
@ -923,7 +979,8 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
|
||||
// Thread API
|
||||
#if !defined(_LIBCPP_HAS_NO_THREADS) && \
|
||||
!defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
|
||||
!defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \
|
||||
!defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
|
||||
# if defined(__FreeBSD__) || \
|
||||
defined(__Fuchsia__) || \
|
||||
defined(__NetBSD__) || \
|
||||
@ -945,7 +1002,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
|
||||
# error _LIBCPP_HAS_EXTERNAL_THREAD_API may not be defined when \
|
||||
# error _LIBCPP_HAS_THREAD_API_EXTERNAL may not be defined when \
|
||||
_LIBCPP_HAS_NO_THREADS is defined.
|
||||
#endif
|
||||
|
||||
@ -970,7 +1027,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
#endif
|
||||
|
||||
#if defined(__BIONIC__) || defined(__CloudABI__) || \
|
||||
defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
defined(__Fuchsia__) || defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
|
||||
#endif
|
||||
|
||||
@ -980,7 +1037,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
#define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
|
||||
#endif
|
||||
|
||||
#if __has_feature(cxx_atomic) || __has_extension(c_atomic)
|
||||
#if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic)
|
||||
#define _LIBCPP_HAS_C_ATOMIC_IMP
|
||||
#elif _GNUC_VER > 407
|
||||
#define _LIBCPP_HAS_GCC_ATOMIC_IMP
|
||||
@ -995,10 +1052,16 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
|
||||
#endif
|
||||
|
||||
#if (defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS) && defined(__clang__) \
|
||||
&& __has_attribute(acquire_capability))
|
||||
#if defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS)
|
||||
#if defined(__clang__) && __has_attribute(acquire_capability)
|
||||
// Work around the attribute handling in clang. When both __declspec and
|
||||
// __attribute__ are present, the processing goes awry preventing the definition
|
||||
// of the types.
|
||||
#if !defined(_LIBCPP_OBJECT_FORMAT_COFF)
|
||||
#define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if __has_attribute(require_constant_initialization)
|
||||
#define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__))
|
||||
@ -1007,7 +1070,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
#endif
|
||||
|
||||
#if !__has_builtin(__builtin_addressof) && _GNUC_VER < 700
|
||||
#define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
|
||||
# define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
|
||||
@ -1016,6 +1079,38 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if __has_attribute(diagnose_if) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS)
|
||||
# define _LIBCPP_DIAGNOSE_WARNING(...) \
|
||||
__attribute__((diagnose_if(__VA_ARGS__, "warning")))
|
||||
# define _LIBCPP_DIAGNOSE_ERROR(...) \
|
||||
__attribute__((diagnose_if(__VA_ARGS__, "error")))
|
||||
#else
|
||||
# define _LIBCPP_DIAGNOSE_WARNING(...)
|
||||
# define _LIBCPP_DIAGNOSE_ERROR(...)
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_ABI_MICROSOFT) && \
|
||||
(defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases))
|
||||
# define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases)
|
||||
#else
|
||||
# define _LIBCPP_DECLSPEC_EMPTY_BASES
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES)
|
||||
# define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
|
||||
# define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
|
||||
# define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
|
||||
# define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
|
||||
#endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES
|
||||
|
||||
#if !defined(__cpp_deduction_guides) || __cpp_deduction_guides < 201611
|
||||
# define _LIBCPP_HAS_NO_DEDUCTION_GUIDES
|
||||
#endif
|
||||
|
||||
#if !__has_keyword(__is_aggregate) && (_GNUC_VER_NEW < 7001)
|
||||
# define _LIBCPP_HAS_NO_IS_AGGREGATE
|
||||
#endif
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // _LIBCPP_CONFIG
|
||||
|
@ -74,7 +74,7 @@ typedef void(*__libcpp_debug_function_type)(__libcpp_debug_info const&);
|
||||
|
||||
/// __libcpp_debug_function - The handler function called when a _LIBCPP_ASSERT
|
||||
/// fails.
|
||||
extern __libcpp_debug_function_type __libcpp_debug_function;
|
||||
extern _LIBCPP_EXTERN_VIS __libcpp_debug_function_type __libcpp_debug_function;
|
||||
|
||||
/// __libcpp_abort_debug_function - A debug handler that aborts when called.
|
||||
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <typeinfo>
|
||||
#include <exception>
|
||||
#include <new>
|
||||
#include <utility>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
@ -23,13 +24,6 @@
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Arg, class _Result>
|
||||
struct _LIBCPP_TEMPLATE_VIS unary_function
|
||||
{
|
||||
typedef _Arg argument_type;
|
||||
typedef _Result result_type;
|
||||
};
|
||||
|
||||
template <class _Arg1, class _Arg2, class _Result>
|
||||
struct _LIBCPP_TEMPLATE_VIS binary_function
|
||||
{
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <utility>
|
||||
#include <type_traits>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
@ -38,6 +39,15 @@ 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>
|
||||
class __unordered_map_hasher;
|
||||
|
||||
template <class _Key, class _Cp, class _Pred,
|
||||
bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value
|
||||
>
|
||||
class __unordered_map_equal;
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp>
|
||||
struct __is_hash_value_type_imp : false_type {};
|
||||
@ -856,6 +866,37 @@ public:
|
||||
template <class> friend class __hash_map_node_destructor;
|
||||
};
|
||||
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Key, class _Hash, class _Equal, class _Alloc>
|
||||
struct __diagnose_hash_table_helper {
|
||||
static constexpr bool __trigger_diagnostics()
|
||||
_LIBCPP_DIAGNOSE_WARNING(__check_hash_requirements<_Key, _Hash>::value
|
||||
&& !__invokable<_Hash const&, _Key const&>::value,
|
||||
"the specified hash functor does not provide a const call operator")
|
||||
_LIBCPP_DIAGNOSE_WARNING(is_copy_constructible<_Equal>::value
|
||||
&& !__invokable<_Equal const&, _Key const&, _Key const&>::value,
|
||||
"the specified comparator type does not provide a const call operator")
|
||||
{
|
||||
static_assert(__check_hash_requirements<_Key, _Hash>::value,
|
||||
"the specified hash does not meet the Hash requirements");
|
||||
static_assert(is_copy_constructible<_Equal>::value,
|
||||
"the specified comparator is required to be copy constructible");
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Key, class _Value, class _Hash, class _Equal, class _Alloc>
|
||||
struct __diagnose_hash_table_helper<
|
||||
__hash_value_type<_Key, _Value>,
|
||||
__unordered_map_hasher<_Key, __hash_value_type<_Key, _Value>, _Hash>,
|
||||
__unordered_map_equal<_Key, __hash_value_type<_Key, _Value>, _Equal>,
|
||||
_Alloc>
|
||||
: __diagnose_hash_table_helper<_Key, _Hash, _Equal, _Alloc>
|
||||
{
|
||||
};
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
class __hash_table
|
||||
{
|
||||
@ -918,6 +959,10 @@ private:
|
||||
typedef allocator_traits<__pointer_allocator> __pointer_alloc_traits;
|
||||
typedef typename __bucket_list_deleter::pointer __node_pointer_pointer;
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
static_assert(__diagnose_hash_table_helper<_Tp, _Hash, _Equal, _Alloc>::__trigger_diagnostics(), "");
|
||||
#endif
|
||||
|
||||
// --- Member data begin ---
|
||||
__bucket_list __bucket_list_;
|
||||
__compressed_pair<__first_node, __node_allocator> __p1_;
|
||||
@ -1357,7 +1402,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
|
||||
const key_equal& __eql,
|
||||
const allocator_type& __a)
|
||||
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
|
||||
__p1_(__node_allocator(__a)),
|
||||
__p1_(__second_tag(), __node_allocator(__a)),
|
||||
__p2_(0, __hf),
|
||||
__p3_(1.0f, __eql)
|
||||
{
|
||||
@ -1366,7 +1411,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const allocator_type& __a)
|
||||
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
|
||||
__p1_(__node_allocator(__a)),
|
||||
__p1_(__second_tag(), __node_allocator(__a)),
|
||||
__p2_(0),
|
||||
__p3_(1.0f)
|
||||
{
|
||||
@ -1378,7 +1423,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u)
|
||||
__bucket_list_deleter(allocator_traits<__pointer_allocator>::
|
||||
select_on_container_copy_construction(
|
||||
__u.__bucket_list_.get_deleter().__alloc()), 0)),
|
||||
__p1_(allocator_traits<__node_allocator>::
|
||||
__p1_(__second_tag(), allocator_traits<__node_allocator>::
|
||||
select_on_container_copy_construction(__u.__node_alloc())),
|
||||
__p2_(0, __u.hash_function()),
|
||||
__p3_(__u.__p3_)
|
||||
@ -1389,7 +1434,7 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u,
|
||||
const allocator_type& __a)
|
||||
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
|
||||
__p1_(__node_allocator(__a)),
|
||||
__p1_(__second_tag(), __node_allocator(__a)),
|
||||
__p2_(0, __u.hash_function()),
|
||||
__p3_(__u.__p3_)
|
||||
{
|
||||
@ -1423,7 +1468,7 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
|
||||
const allocator_type& __a)
|
||||
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
|
||||
__p1_(__node_allocator(__a)),
|
||||
__p1_(__second_tag(), __node_allocator(__a)),
|
||||
__p2_(0, _VSTD::move(__u.hash_function())),
|
||||
__p3_(_VSTD::move(__u.__p3_))
|
||||
{
|
||||
@ -1449,10 +1494,13 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table()
|
||||
{
|
||||
#if defined(_LIBCPP_CXX03_LANG)
|
||||
static_assert((is_copy_constructible<key_equal>::value),
|
||||
"Predicate must be copy-constructible.");
|
||||
static_assert((is_copy_constructible<hasher>::value),
|
||||
"Hasher must be copy-constructible.");
|
||||
#endif
|
||||
|
||||
__deallocate_node(__p1_.first().__next_);
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
__get_db()->__erase_c(this);
|
||||
|
@ -1 +1 @@
|
||||
4000
|
||||
5000
|
||||
|
@ -37,9 +37,11 @@
|
||||
#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) \
|
||||
|| defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
|
||||
# include <xlocale.h>
|
||||
#elif defined(__Fuchsia__)
|
||||
# include <support/fuchsia/xlocale.h>
|
||||
#elif defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
# include <support/musl/xlocale.h>
|
||||
#endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
@ -92,13 +94,16 @@ public:
|
||||
|
||||
const locale& operator=(const locale&) _NOEXCEPT;
|
||||
|
||||
template <class _Facet> locale combine(const locale&) const;
|
||||
template <class _Facet>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
locale combine(const locale&) const;
|
||||
|
||||
// locale operations:
|
||||
string name() const;
|
||||
bool operator==(const locale&) const;
|
||||
bool operator!=(const locale& __y) const {return !(*this == __y);}
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
bool operator()(const basic_string<_CharT, _Traits, _Allocator>&,
|
||||
const basic_string<_CharT, _Traits, _Allocator>&) const;
|
||||
|
||||
|
@ -80,21 +80,9 @@ constexpr adopt_lock_t adopt_lock = adopt_lock_t();
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// Forward declare lock_guard as a variadic template even in C++03 to keep
|
||||
// the mangling consistent between dialects.
|
||||
#if defined(_LIBCPP_ABI_VARIADIC_LOCK_GUARD)
|
||||
template <class ..._Mutexes>
|
||||
class _LIBCPP_TEMPLATE_VIS lock_guard;
|
||||
#endif
|
||||
|
||||
template <class _Mutex>
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(scoped_lockable)
|
||||
#if !defined(_LIBCPP_ABI_VARIADIC_LOCK_GUARD)
|
||||
lock_guard
|
||||
#else
|
||||
lock_guard<_Mutex>
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
typedef _Mutex mutex_type;
|
||||
@ -316,20 +304,24 @@ public:
|
||||
|
||||
void wait(unique_lock<mutex>& __lk) _NOEXCEPT;
|
||||
template <class _Predicate>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
void wait(unique_lock<mutex>& __lk, _Predicate __pred);
|
||||
|
||||
template <class _Clock, class _Duration>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
cv_status
|
||||
wait_until(unique_lock<mutex>& __lk,
|
||||
const chrono::time_point<_Clock, _Duration>& __t);
|
||||
|
||||
template <class _Clock, class _Duration, class _Predicate>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
bool
|
||||
wait_until(unique_lock<mutex>& __lk,
|
||||
const chrono::time_point<_Clock, _Duration>& __t,
|
||||
_Predicate __pred);
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
cv_status
|
||||
wait_for(unique_lock<mutex>& __lk,
|
||||
const chrono::duration<_Rep, _Period>& __d);
|
||||
|
@ -361,7 +361,7 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a)
|
||||
: __end_cap_(__a)
|
||||
: __end_cap_(__second_tag(), __a)
|
||||
{
|
||||
if (__a == __c.__alloc())
|
||||
{
|
||||
|
@ -12,6 +12,8 @@
|
||||
#define _LIBCPP_THREADING_SUPPORT
|
||||
|
||||
#include <__config>
|
||||
#include <chrono>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
|
||||
#pragma GCC system_header
|
||||
@ -25,12 +27,9 @@
|
||||
# include <pthread.h>
|
||||
# include <sched.h>
|
||||
#elif defined(_LIBCPP_HAS_THREAD_API_WIN32)
|
||||
#include <assert.h>
|
||||
#include <Windows.h>
|
||||
#include <process.h>
|
||||
#include <fibersapi.h>
|
||||
|
||||
#include <chrono>
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
|
||||
@ -67,6 +66,8 @@ typedef pthread_once_t __libcpp_exec_once_flag;
|
||||
typedef pthread_t __libcpp_thread_id;
|
||||
|
||||
// Thread
|
||||
#define _LIBCPP_NULL_THREAD 0U
|
||||
|
||||
typedef pthread_t __libcpp_thread_t;
|
||||
|
||||
// Thrad Local Storage
|
||||
@ -92,6 +93,8 @@ typedef INIT_ONCE __libcpp_exec_once_flag;
|
||||
typedef DWORD __libcpp_thread_id;
|
||||
|
||||
// Thread
|
||||
#define _LIBCPP_NULL_THREAD 0U
|
||||
|
||||
typedef HANDLE __libcpp_thread_t;
|
||||
|
||||
// Thread Local Storage
|
||||
@ -108,7 +111,7 @@ _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
int __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m);
|
||||
bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t *__m);
|
||||
@ -120,7 +123,7 @@ _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
int __libcpp_mutex_lock(__libcpp_mutex_t *__m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
int __libcpp_mutex_trylock(__libcpp_mutex_t *__m);
|
||||
bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
int __libcpp_mutex_unlock(__libcpp_mutex_t *__m);
|
||||
@ -151,11 +154,6 @@ int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
|
||||
void (*init_routine)(void));
|
||||
|
||||
// Thread id
|
||||
#if defined(__APPLE__) && !defined(__arm__)
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
mach_port_t __libcpp_thread_get_port();
|
||||
#endif
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2);
|
||||
|
||||
@ -163,6 +161,9 @@ _LIBCPP_THREAD_ABI_VISIBILITY
|
||||
bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2);
|
||||
|
||||
// Thread
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
bool __libcpp_thread_isnull(const __libcpp_thread_t *__t);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
|
||||
void *__arg);
|
||||
@ -182,6 +183,9 @@ int __libcpp_thread_detach(__libcpp_thread_t *__t);
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
void __libcpp_thread_yield();
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns);
|
||||
|
||||
// Thread local storage
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
int __libcpp_tls_create(__libcpp_tls_key* __key,
|
||||
@ -227,9 +231,9 @@ int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m)
|
||||
return pthread_mutex_lock(__m);
|
||||
}
|
||||
|
||||
int __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m)
|
||||
bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m)
|
||||
{
|
||||
return pthread_mutex_trylock(__m);
|
||||
return pthread_mutex_trylock(__m) == 0;
|
||||
}
|
||||
|
||||
int __libcpp_recursive_mutex_unlock(__libcpp_mutex_t *__m)
|
||||
@ -247,9 +251,9 @@ int __libcpp_mutex_lock(__libcpp_mutex_t *__m)
|
||||
return pthread_mutex_lock(__m);
|
||||
}
|
||||
|
||||
int __libcpp_mutex_trylock(__libcpp_mutex_t *__m)
|
||||
bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m)
|
||||
{
|
||||
return pthread_mutex_trylock(__m);
|
||||
return pthread_mutex_trylock(__m) == 0;
|
||||
}
|
||||
|
||||
int __libcpp_mutex_unlock(__libcpp_mutex_t *__m)
|
||||
@ -296,12 +300,6 @@ int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
|
||||
}
|
||||
|
||||
// Thread id
|
||||
#if defined(__APPLE__) && !defined(__arm__)
|
||||
mach_port_t __libcpp_thread_get_port() {
|
||||
return pthread_mach_thread_np(pthread_self());
|
||||
}
|
||||
#endif
|
||||
|
||||
// Returns non-zero if the thread ids are equal, otherwise 0
|
||||
bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2)
|
||||
{
|
||||
@ -315,6 +313,10 @@ bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2)
|
||||
}
|
||||
|
||||
// Thread
|
||||
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)
|
||||
{
|
||||
@ -346,6 +348,28 @@ void __libcpp_thread_yield()
|
||||
sched_yield();
|
||||
}
|
||||
|
||||
void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns)
|
||||
{
|
||||
using namespace chrono;
|
||||
seconds __s = duration_cast<seconds>(__ns);
|
||||
timespec __ts;
|
||||
typedef decltype(__ts.tv_sec) ts_sec;
|
||||
_LIBCPP_CONSTEXPR ts_sec __ts_sec_max = numeric_limits<ts_sec>::max();
|
||||
|
||||
if (__s.count() < __ts_sec_max)
|
||||
{
|
||||
__ts.tv_sec = static_cast<ts_sec>(__s.count());
|
||||
__ts.tv_nsec = static_cast<decltype(__ts.tv_nsec)>((__ns - __s).count());
|
||||
}
|
||||
else
|
||||
{
|
||||
__ts.tv_sec = __ts_sec_max;
|
||||
__ts.tv_nsec = 999999999; // (10^9 - 1)
|
||||
}
|
||||
|
||||
while (nanosleep(&__ts, &__ts) == -1 && errno == EINTR);
|
||||
}
|
||||
|
||||
// Thread local storage
|
||||
int __libcpp_tls_create(__libcpp_tls_key *__key, void (*__at_exit)(void *))
|
||||
{
|
||||
@ -377,10 +401,9 @@ int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m)
|
||||
bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m)
|
||||
{
|
||||
TryEnterCriticalSection(__m);
|
||||
return 0;
|
||||
return TryEnterCriticalSection(__m) != 0;
|
||||
}
|
||||
|
||||
int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t *__m)
|
||||
@ -401,10 +424,9 @@ int __libcpp_mutex_lock(__libcpp_mutex_t *__m)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_mutex_trylock(__libcpp_mutex_t *__m)
|
||||
bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m)
|
||||
{
|
||||
TryAcquireSRWLockExclusive(__m);
|
||||
return 0;
|
||||
return TryAcquireSRWLockExclusive(__m) != 0;
|
||||
}
|
||||
|
||||
int __libcpp_mutex_unlock(__libcpp_mutex_t *__m)
|
||||
@ -503,25 +525,32 @@ struct __libcpp_beginthreadex_thunk_data
|
||||
void *__arg;
|
||||
};
|
||||
|
||||
static inline _LIBCPP_ALWAYS_INLINE unsigned int WINAPI
|
||||
__libcpp_beginthreadex_thunk(void *__data)
|
||||
static inline _LIBCPP_ALWAYS_INLINE unsigned WINAPI
|
||||
__libcpp_beginthreadex_thunk(void *__raw_data)
|
||||
{
|
||||
__libcpp_beginthreadex_thunk_data data =
|
||||
*reinterpret_cast<__libcpp_beginthreadex_thunk_data *>(__data);
|
||||
delete reinterpret_cast<__libcpp_beginthreadex_thunk_data *>(__data);
|
||||
return reinterpret_cast<unsigned int>(data.__func(data.__arg));
|
||||
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;
|
||||
auto *__data = new __libcpp_beginthreadex_thunk_data;
|
||||
__data->__func = __func;
|
||||
__data->__arg = __arg;
|
||||
|
||||
*__t = reinterpret_cast<HANDLE>(_beginthreadex(NULL, 0,
|
||||
*__t = reinterpret_cast<HANDLE>(_beginthreadex(nullptr, 0,
|
||||
__libcpp_beginthreadex_thunk,
|
||||
data, 0, NULL));
|
||||
__data, 0, nullptr));
|
||||
|
||||
if (*__t)
|
||||
return 0;
|
||||
return GetLastError();
|
||||
@ -558,6 +587,16 @@ 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*))
|
||||
|
@ -43,6 +43,10 @@ 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>
|
||||
class __map_value_compare;
|
||||
|
||||
template <class _Allocator> class __map_node_destructor;
|
||||
template <class _TreeIterator> class _LIBCPP_TEMPLATE_VIS __map_iterator;
|
||||
template <class _TreeIterator> class _LIBCPP_TEMPLATE_VIS __map_const_iterator;
|
||||
@ -957,6 +961,25 @@ private:
|
||||
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
struct __diagnose_tree_helper {
|
||||
static constexpr bool __trigger_diagnostics()
|
||||
_LIBCPP_DIAGNOSE_WARNING(!__invokable<_Compare const&, _Tp const&, _Tp const&>::value,
|
||||
"the specified comparator type does not provide a const call operator")
|
||||
{ return true; }
|
||||
};
|
||||
|
||||
template <class _Key, class _Value, class _KeyComp, class _Alloc>
|
||||
struct __diagnose_tree_helper<
|
||||
__value_type<_Key, _Value>,
|
||||
__map_value_compare<_Key, __value_type<_Key, _Value>, _KeyComp>,
|
||||
_Alloc
|
||||
> : __diagnose_tree_helper<_Key, _KeyComp, _Alloc>
|
||||
{
|
||||
};
|
||||
#endif // !_LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
class __tree
|
||||
{
|
||||
@ -1479,7 +1502,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp)
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
__tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a)
|
||||
: __begin_node_(__iter_pointer()),
|
||||
__pair1_(__node_allocator(__a)),
|
||||
__pair1_(__second_tag(), __node_allocator(__a)),
|
||||
__pair3_(0)
|
||||
{
|
||||
__begin_node() = __end_node();
|
||||
@ -1489,7 +1512,7 @@ template <class _Tp, class _Compare, class _Allocator>
|
||||
__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp,
|
||||
const allocator_type& __a)
|
||||
: __begin_node_(__iter_pointer()),
|
||||
__pair1_(__node_allocator(__a)),
|
||||
__pair1_(__second_tag(), __node_allocator(__a)),
|
||||
__pair3_(0, __comp)
|
||||
{
|
||||
__begin_node() = __end_node();
|
||||
@ -1646,7 +1669,7 @@ __tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _Input
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
__tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
|
||||
: __begin_node_(__iter_pointer()),
|
||||
__pair1_(__node_traits::select_on_container_copy_construction(__t.__node_alloc())),
|
||||
__pair1_(__second_tag(), __node_traits::select_on_container_copy_construction(__t.__node_alloc())),
|
||||
__pair3_(0, __t.value_comp())
|
||||
{
|
||||
__begin_node() = __end_node();
|
||||
@ -1676,7 +1699,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a)
|
||||
: __pair1_(__node_allocator(__a)),
|
||||
: __pair1_(__second_tag(), __node_allocator(__a)),
|
||||
__pair3_(0, _VSTD::move(__t.value_comp()))
|
||||
{
|
||||
if (__a == __t.__alloc())
|
||||
@ -1789,7 +1812,11 @@ __tree<_Tp, _Compare, _Allocator>::~__tree()
|
||||
{
|
||||
static_assert((is_copy_constructible<value_compare>::value),
|
||||
"Comparator must be copy-constructible.");
|
||||
destroy(__root());
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
static_assert((__diagnose_tree_helper<_Tp, _Compare, _Allocator>::
|
||||
__trigger_diagnostics()), "");
|
||||
#endif
|
||||
destroy(__root());
|
||||
}
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#ifdef min
|
||||
#if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS)
|
||||
#if defined(_MSC_VER) && ! defined(__clang__)
|
||||
#if defined(_LIBCPP_MSVC)
|
||||
_LIBCPP_WARNING("macro min is incompatible with C++. Try #define NOMINMAX "
|
||||
"before any Windows header. #undefing min")
|
||||
#else
|
||||
@ -22,7 +22,7 @@ _LIBCPP_WARNING("macro min is incompatible with C++. Try #define NOMINMAX "
|
||||
|
||||
#ifdef max
|
||||
#if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS)
|
||||
#if defined(_MSC_VER) && ! defined(__clang__)
|
||||
#if defined(_LIBCPP_MSVC)
|
||||
_LIBCPP_WARNING("macro max is incompatible with C++. Try #define NOMINMAX "
|
||||
"before any Windows header. #undefing max")
|
||||
#else
|
||||
|
@ -281,12 +281,12 @@ template <class ForwardIterator, class OutputIterator>
|
||||
|
||||
template <class RandomAccessIterator>
|
||||
void
|
||||
random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14
|
||||
random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17
|
||||
|
||||
template <class RandomAccessIterator, class RandomNumberGenerator>
|
||||
void
|
||||
random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
|
||||
RandomNumberGenerator& rand); // deprecated in C++14
|
||||
RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17
|
||||
|
||||
template<class PopulationIterator, class SampleIterator,
|
||||
class Distance, class UniformRandomBitGenerator>
|
||||
@ -3026,6 +3026,8 @@ uniform_int_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p
|
||||
return static_cast<result_type>(__u + __p.a());
|
||||
}
|
||||
|
||||
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE) \
|
||||
|| defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
class _LIBCPP_TYPE_VIS __rs_default;
|
||||
|
||||
_LIBCPP_FUNC_VIS __rs_default __rs_get();
|
||||
@ -3095,6 +3097,7 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class _PopulationIterator, class _SampleIterator, class _Distance,
|
||||
class _UniformRandomNumberGenerator>
|
||||
|
28
include/any
28
include/any
@ -45,6 +45,10 @@ namespace std {
|
||||
any& operator=(ValueType&& rhs);
|
||||
|
||||
// 6.3.3 any modifiers
|
||||
template <class ValueType, class... Args>
|
||||
decay_t<ValueType>& emplace(Args&&... args);
|
||||
template <class ValueType, class U, class... Args>
|
||||
decay_t<ValueType>& emplace(initializer_list<U>, Args&&...);
|
||||
void reset() noexcept;
|
||||
void swap(any& rhs) noexcept;
|
||||
|
||||
@ -73,8 +77,6 @@ namespace std {
|
||||
template<class ValueType>
|
||||
ValueType* any_cast(any* operand) noexcept;
|
||||
|
||||
} // namespace fundamentals_v1
|
||||
} // namespace experimental
|
||||
} // namespace std
|
||||
|
||||
*/
|
||||
@ -258,7 +260,7 @@ public:
|
||||
is_copy_constructible<_Tp>::value>
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void emplace(_Args&&... args);
|
||||
_Tp& emplace(_Args&&... args);
|
||||
|
||||
template <class _ValueType, class _Up, class ..._Args,
|
||||
class _Tp = decay_t<_ValueType>,
|
||||
@ -267,7 +269,7 @@ public:
|
||||
is_copy_constructible<_Tp>::value>
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void emplace(initializer_list<_Up>, _Args&&...);
|
||||
_Tp& emplace(initializer_list<_Up>, _Args&&...);
|
||||
|
||||
// 6.3.3 any modifiers
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -364,9 +366,10 @@ namespace __any_imp
|
||||
|
||||
template <class ..._Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __create(any & __dest, _Args&&... __args) {
|
||||
::new (static_cast<void*>(&__dest.__s.__buf)) _Tp(_VSTD::forward<_Args>(__args)...);
|
||||
static _Tp& __create(any & __dest, _Args&&... __args) {
|
||||
_Tp* __ret = ::new (static_cast<void*>(&__dest.__s.__buf)) _Tp(_VSTD::forward<_Args>(__args)...);
|
||||
__dest.__h = &_SmallHandler::__handle;
|
||||
return *__ret;
|
||||
}
|
||||
|
||||
private:
|
||||
@ -439,14 +442,15 @@ namespace __any_imp
|
||||
|
||||
template <class ..._Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __create(any & __dest, _Args&&... __args) {
|
||||
static _Tp& __create(any & __dest, _Args&&... __args) {
|
||||
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<_Args>(__args)...);
|
||||
_Tp* __ret = ::new ((void*)__hold.get()) _Tp(_VSTD::forward<_Args>(__args)...);
|
||||
__dest.__s.__ptr = __hold.release();
|
||||
__dest.__h = &_LargeHandler::__handle;
|
||||
return *__ret;
|
||||
}
|
||||
|
||||
private:
|
||||
@ -519,16 +523,16 @@ any & any::operator=(_ValueType && __v)
|
||||
|
||||
template <class _ValueType, class ..._Args, class _Tp, class>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void any::emplace(_Args&&... __args) {
|
||||
_Tp& any::emplace(_Args&&... __args) {
|
||||
reset();
|
||||
__any_imp::_Handler<_Tp>::__create(*this, _VSTD::forward<_Args>(__args)...);
|
||||
return __any_imp::_Handler<_Tp>::__create(*this, _VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class _ValueType, class _Up, class ..._Args, class _Tp, class>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void any::emplace(initializer_list<_Up> __il, _Args&&... __args) {
|
||||
_Tp& any::emplace(initializer_list<_Up> __il, _Args&&... __args) {
|
||||
reset();
|
||||
__any_imp::_Handler<_Tp>::__create(*this, __il, _VSTD::forward<_Args>(__args)...);
|
||||
return __any_imp::_Handler<_Tp>::__create(*this, __il, _VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
|
@ -316,7 +316,7 @@ get(const array<_Tp, _Size>& __a) _NOEXCEPT
|
||||
return __a.__elems_[_Ip];
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
@ -336,7 +336,7 @@ get(const array<_Tp, _Size>&& __a) _NOEXCEPT
|
||||
return _VSTD::move(__a.__elems_[_Ip]);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // !_LIBCPP_CXX03_LANG
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
@ -560,6 +560,22 @@ void atomic_signal_fence(memory_order m) noexcept;
|
||||
# define __cpp_lib_atomic_is_always_lock_free 201603L
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) \
|
||||
_LIBCPP_DIAGNOSE_WARNING(__m == memory_order_consume || \
|
||||
__m == memory_order_acquire || \
|
||||
__m == memory_order_acq_rel, \
|
||||
"memory order argument to atomic operation is invalid")
|
||||
|
||||
#define _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) \
|
||||
_LIBCPP_DIAGNOSE_WARNING(__m == memory_order_release || \
|
||||
__m == memory_order_acq_rel, \
|
||||
"memory order argument to atomic operation is invalid")
|
||||
|
||||
#define _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__m, __f) \
|
||||
_LIBCPP_DIAGNOSE_WARNING(__f == memory_order_release || \
|
||||
__f == memory_order_acq_rel, \
|
||||
"memory order argument to atomic operation is invalid")
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
typedef enum memory_order
|
||||
@ -881,15 +897,19 @@ struct __atomic_base // false
|
||||
{return static_cast<__atomic_base const volatile*>(this)->is_lock_free();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
|
||||
_LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
|
||||
{__c11_atomic_store(&__a_, __d, __m);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void store(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT
|
||||
_LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
|
||||
{__c11_atomic_store(&__a_, __d, __m);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp load(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT
|
||||
_LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
|
||||
{return __c11_atomic_load(&__a_, __m);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp load(memory_order __m = memory_order_seq_cst) const _NOEXCEPT
|
||||
_LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
|
||||
{return __c11_atomic_load(&__a_, __m);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
operator _Tp() const volatile _NOEXCEPT {return load();}
|
||||
@ -904,18 +924,22 @@ struct __atomic_base // false
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool compare_exchange_weak(_Tp& __e, _Tp __d,
|
||||
memory_order __s, memory_order __f) volatile _NOEXCEPT
|
||||
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
|
||||
{return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool compare_exchange_weak(_Tp& __e, _Tp __d,
|
||||
memory_order __s, memory_order __f) _NOEXCEPT
|
||||
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
|
||||
{return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool compare_exchange_strong(_Tp& __e, _Tp __d,
|
||||
memory_order __s, memory_order __f) volatile _NOEXCEPT
|
||||
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
|
||||
{return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool compare_exchange_strong(_Tp& __e, _Tp __d,
|
||||
memory_order __s, memory_order __f) _NOEXCEPT
|
||||
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
|
||||
{return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool compare_exchange_weak(_Tp& __e, _Tp __d,
|
||||
@ -1181,6 +1205,7 @@ template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
|
||||
_LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
|
||||
{
|
||||
__o->store(__d, __m);
|
||||
}
|
||||
@ -1189,6 +1214,7 @@ template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
atomic_store_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
|
||||
_LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
|
||||
{
|
||||
__o->store(__d, __m);
|
||||
}
|
||||
@ -1217,6 +1243,7 @@ template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_Tp
|
||||
atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
|
||||
_LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
|
||||
{
|
||||
return __o->load(__m);
|
||||
}
|
||||
@ -1225,6 +1252,7 @@ template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_Tp
|
||||
atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
|
||||
_LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
|
||||
{
|
||||
return __o->load(__m);
|
||||
}
|
||||
@ -1309,6 +1337,7 @@ bool
|
||||
atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e,
|
||||
_Tp __d,
|
||||
memory_order __s, memory_order __f) _NOEXCEPT
|
||||
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
|
||||
{
|
||||
return __o->compare_exchange_weak(*__e, __d, __s, __f);
|
||||
}
|
||||
@ -1318,6 +1347,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, _Tp* __e, _Tp __d,
|
||||
memory_order __s, memory_order __f) _NOEXCEPT
|
||||
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
|
||||
{
|
||||
return __o->compare_exchange_weak(*__e, __d, __s, __f);
|
||||
}
|
||||
@ -1330,6 +1360,7 @@ bool
|
||||
atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o,
|
||||
_Tp* __e, _Tp __d,
|
||||
memory_order __s, memory_order __f) _NOEXCEPT
|
||||
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
|
||||
{
|
||||
return __o->compare_exchange_strong(*__e, __d, __s, __f);
|
||||
}
|
||||
@ -1340,6 +1371,7 @@ bool
|
||||
atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, _Tp* __e,
|
||||
_Tp __d,
|
||||
memory_order __s, memory_order __f) _NOEXCEPT
|
||||
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
|
||||
{
|
||||
return __o->compare_exchange_strong(*__e, __d, __s, __f);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class duration
|
||||
static_assert(Period::num > 0, "duration period must be positive");
|
||||
public:
|
||||
typedef Rep rep;
|
||||
typedef Period period;
|
||||
typedef typename _Period::type period;
|
||||
|
||||
constexpr duration() = default;
|
||||
template <class Rep2>
|
||||
@ -75,8 +75,8 @@ public:
|
||||
|
||||
// arithmetic
|
||||
|
||||
constexpr duration operator+() const;
|
||||
constexpr duration operator-() const;
|
||||
constexpr common_type<duration>::type operator+() const;
|
||||
constexpr common_type<duration>::type operator-() const;
|
||||
constexpr duration& operator++();
|
||||
constexpr duration operator++(int);
|
||||
constexpr duration& operator--();
|
||||
@ -523,7 +523,7 @@ class _LIBCPP_TEMPLATE_VIS duration
|
||||
|
||||
public:
|
||||
typedef _Rep rep;
|
||||
typedef _Period period;
|
||||
typedef typename _Period::type period;
|
||||
private:
|
||||
rep __rep_;
|
||||
public:
|
||||
@ -565,8 +565,8 @@ public:
|
||||
|
||||
// arithmetic
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator+() const {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator-() const {return duration(-__rep_);}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename common_type<duration>::type operator+() const {return typename common_type<duration>::type(*this);}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename common_type<duration>::type operator-() const {return typename common_type<duration>::type(-__rep_);}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator++() {++__rep_; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration operator++(int) {return duration(__rep_++);}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator--() {--__rep_; return *this;}
|
||||
|
@ -398,7 +398,6 @@ using ::cbrtf;
|
||||
using ::copysign;
|
||||
using ::copysignf;
|
||||
|
||||
#ifndef _LIBCPP_MSVCRT
|
||||
using ::erf;
|
||||
using ::erff;
|
||||
using ::erfc;
|
||||
@ -435,12 +434,10 @@ using ::lrint;
|
||||
using ::lrintf;
|
||||
using ::lround;
|
||||
using ::lroundf;
|
||||
#endif // _LIBCPP_MSVCRT
|
||||
|
||||
using ::nan;
|
||||
using ::nanf;
|
||||
|
||||
#ifndef _LIBCPP_MSVCRT
|
||||
using ::nearbyint;
|
||||
using ::nearbyintf;
|
||||
using ::nextafter;
|
||||
@ -463,7 +460,6 @@ using ::tgamma;
|
||||
using ::tgammaf;
|
||||
using ::trunc;
|
||||
using ::truncf;
|
||||
#endif // !_LIBCPP_MSVCRT
|
||||
|
||||
using ::acosl;
|
||||
using ::asinl;
|
||||
@ -495,7 +491,6 @@ using ::cbrtl;
|
||||
|
||||
using ::copysignl;
|
||||
|
||||
#ifndef _LIBCPP_MSVCRT
|
||||
using ::erfl;
|
||||
using ::erfcl;
|
||||
using ::exp2l;
|
||||
@ -526,7 +521,6 @@ using ::scalblnl;
|
||||
using ::scalbnl;
|
||||
using ::tgammal;
|
||||
using ::truncl;
|
||||
#endif // !_LIBCPP_MSVCRT
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
inline _LIBCPP_INLINE_VISIBILITY float hypot( float x, float y, float z ) { return sqrt(x*x + y*y + z*z); }
|
||||
|
@ -133,12 +133,14 @@ public:
|
||||
void notify_all() _NOEXCEPT;
|
||||
|
||||
template <class _Lock>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
void wait(_Lock& __lock);
|
||||
template <class _Lock, class _Predicate>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void wait(_Lock& __lock, _Predicate __pred);
|
||||
|
||||
template <class _Lock, class _Clock, class _Duration>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
cv_status
|
||||
wait_until(_Lock& __lock,
|
||||
const chrono::time_point<_Clock, _Duration>& __t);
|
||||
|
@ -28,6 +28,7 @@ Types:
|
||||
size_t
|
||||
max_align_t
|
||||
nullptr_t
|
||||
byte // C++17
|
||||
|
||||
} // std
|
||||
|
||||
@ -48,7 +49,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
using ::ptrdiff_t;
|
||||
using ::size_t;
|
||||
|
||||
#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T)
|
||||
#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) || \
|
||||
defined(__DEFINED_max_align_t)
|
||||
// Re-use the compiler's <stddef.h> max_align_t where possible.
|
||||
using ::max_align_t;
|
||||
#else
|
||||
@ -57,4 +59,32 @@ typedef long double max_align_t;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
namespace std // purposefully not versioned
|
||||
{
|
||||
enum class byte : unsigned char {};
|
||||
|
||||
constexpr byte& operator|=(byte& __lhs, byte __rhs) noexcept
|
||||
{ return __lhs = byte(static_cast<unsigned char>(__lhs) | static_cast<unsigned char>(__rhs)); }
|
||||
constexpr byte operator| (byte __lhs, byte __rhs) noexcept
|
||||
{ return byte(static_cast<unsigned char>(__lhs) | static_cast<unsigned char>(__rhs)); }
|
||||
|
||||
constexpr byte& operator&=(byte& __lhs, byte __rhs) noexcept
|
||||
{ return __lhs = byte(static_cast<unsigned char>(__lhs) & static_cast<unsigned char>(__rhs)); }
|
||||
constexpr byte operator& (byte __lhs, byte __rhs) noexcept
|
||||
{ return byte(static_cast<unsigned char>(__lhs) & static_cast<unsigned char>(__rhs)); }
|
||||
|
||||
constexpr byte& operator^=(byte& __lhs, byte __rhs) noexcept
|
||||
{ return __lhs = byte(static_cast<unsigned char>(__lhs) ^ static_cast<unsigned char>(__rhs)); }
|
||||
constexpr byte operator^ (byte __lhs, byte __rhs) noexcept
|
||||
{ return byte(static_cast<unsigned char>(__lhs) ^ static_cast<unsigned char>(__rhs)); }
|
||||
|
||||
constexpr byte operator~ (byte __b) noexcept
|
||||
{ return byte(~static_cast<unsigned char>(__b)); }
|
||||
|
||||
}
|
||||
|
||||
#include <type_traits> // rest of byte
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CSTDDEF
|
||||
|
@ -98,9 +98,6 @@ void perror(const char* s);
|
||||
|
||||
#include <__config>
|
||||
#include <stdio.h>
|
||||
#if defined(_LIBCPP_MSVCRT)
|
||||
#include <crtversion.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
@ -156,8 +153,7 @@ using ::tmpnam;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_STDIN
|
||||
using ::getchar;
|
||||
#if _LIBCPP_STD_VER <= 11 && \
|
||||
(!defined(_VC_CRT_MAJOR_VERSION) || _VC_CRT_MAJOR_VERSION < 14)
|
||||
#if _LIBCPP_STD_VER <= 11 && !defined(_LIBCPP_MSVCRT)
|
||||
using ::gets;
|
||||
#endif
|
||||
using ::scanf;
|
||||
|
@ -130,8 +130,10 @@ using ::abort;
|
||||
using ::atexit;
|
||||
using ::exit;
|
||||
using ::_Exit;
|
||||
#ifndef _LIBCPP_WINDOWS_STORE_APP
|
||||
using ::getenv;
|
||||
using ::system;
|
||||
#endif
|
||||
using ::bsearch;
|
||||
using ::qsort;
|
||||
using ::abs;
|
||||
|
352
include/deque
352
include/deque
@ -968,13 +968,12 @@ protected:
|
||||
public:
|
||||
~__deque_base();
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__deque_base(__deque_base&& __c)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
|
||||
__deque_base(__deque_base&& __c, const allocator_type& __a);
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void swap(__deque_base& __c)
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
_NOEXCEPT;
|
||||
@ -1108,7 +1107,7 @@ __deque_base<_Tp, _Allocator>::~__deque_base()
|
||||
__alloc_traits::deallocate(__alloc(), *__i, __block_size);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c)
|
||||
@ -1140,7 +1139,7 @@ __deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c, const allocator_
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
@ -1230,18 +1229,16 @@ public:
|
||||
typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0);
|
||||
deque(const deque& __c);
|
||||
deque(const deque& __c, const allocator_type& __a);
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
deque(initializer_list<value_type> __il);
|
||||
deque(initializer_list<value_type> __il, const allocator_type& __a);
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
deque& operator=(const deque& __c);
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
deque(initializer_list<value_type> __il);
|
||||
deque(initializer_list<value_type> __il, const allocator_type& __a);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
deque& operator=(initializer_list<value_type> __il) {assign(__il); return *this;}
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -1250,7 +1247,10 @@ public:
|
||||
deque& operator=(deque&& __c)
|
||||
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());}
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _InputIter>
|
||||
void assign(_InputIter __f, _InputIter __l,
|
||||
@ -1260,10 +1260,6 @@ public:
|
||||
void assign(_RAIter __f, _RAIter __l,
|
||||
typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0);
|
||||
void assign(size_type __n, const value_type& __v);
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());}
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const _NOEXCEPT;
|
||||
@ -1340,8 +1336,7 @@ public:
|
||||
// 23.2.2.3 modifiers:
|
||||
void push_front(const value_type& __v);
|
||||
void push_back(const value_type& __v);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
template <class... _Args> reference emplace_front(_Args&&... __args);
|
||||
template <class... _Args> reference emplace_back (_Args&&... __args);
|
||||
@ -1350,11 +1345,16 @@ public:
|
||||
template <class... _Args> void emplace_back (_Args&&... __args);
|
||||
#endif
|
||||
template <class... _Args> iterator emplace(const_iterator __p, _Args&&... __args);
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
void push_front(value_type&& __v);
|
||||
void push_back(value_type&& __v);
|
||||
iterator insert(const_iterator __p, value_type&& __v);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __p, initializer_list<value_type> __il)
|
||||
{return insert(__p, __il.begin(), __il.end());}
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
iterator insert(const_iterator __p, const value_type& __v);
|
||||
iterator insert(const_iterator __p, size_type __n, const value_type& __v);
|
||||
template <class _InputIter>
|
||||
@ -1368,11 +1368,7 @@ public:
|
||||
template <class _BiIter>
|
||||
iterator insert(const_iterator __p, _BiIter __f, _BiIter __l,
|
||||
typename enable_if<__is_bidirectional_iterator<_BiIter>::value>::type* = 0);
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __p, initializer_list<value_type> __il)
|
||||
{return insert(__p, __il.begin(), __il.end());}
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
void pop_front();
|
||||
void pop_back();
|
||||
iterator erase(const_iterator __p);
|
||||
@ -1527,7 +1523,19 @@ deque<_Tp, _Allocator>::deque(const deque& __c, const allocator_type& __a)
|
||||
__append(__c.begin(), __c.end());
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
template <class _Tp, class _Allocator>
|
||||
deque<_Tp, _Allocator>&
|
||||
deque<_Tp, _Allocator>::operator=(const deque& __c)
|
||||
{
|
||||
if (this != &__c)
|
||||
{
|
||||
__copy_assign_alloc(__c);
|
||||
assign(__c.begin(), __c.end());
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il)
|
||||
@ -1542,22 +1550,6 @@ deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il, const allocator
|
||||
__append(__il.begin(), __il.end());
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
deque<_Tp, _Allocator>&
|
||||
deque<_Tp, _Allocator>::operator=(const deque& __c)
|
||||
{
|
||||
if (this != &__c)
|
||||
{
|
||||
__copy_assign_alloc(__c);
|
||||
assign(__c.begin(), __c.end());
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline
|
||||
deque<_Tp, _Allocator>::deque(deque&& __c)
|
||||
@ -1613,7 +1605,7 @@ deque<_Tp, _Allocator>::__move_assign(deque& __c, true_type)
|
||||
__base::__move_assign(__c);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class _InputIter>
|
||||
@ -1809,8 +1801,20 @@ deque<_Tp, _Allocator>::push_back(const value_type& __v)
|
||||
++__base::size();
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
deque<_Tp, _Allocator>::push_front(const value_type& __v)
|
||||
{
|
||||
allocator_type& __a = __base::__alloc();
|
||||
if (__front_spare() == 0)
|
||||
__add_front_capacity();
|
||||
// __front_spare() >= 1
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), __v);
|
||||
--__base::__start_;
|
||||
++__base::size();
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
deque<_Tp, _Allocator>::push_back(value_type&& __v)
|
||||
@ -1823,8 +1827,6 @@ deque<_Tp, _Allocator>::push_back(value_type&& __v)
|
||||
++__base::size();
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class... _Args>
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
@ -1846,24 +1848,6 @@ deque<_Tp, _Allocator>::emplace_back(_Args&&... __args)
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
deque<_Tp, _Allocator>::push_front(const value_type& __v)
|
||||
{
|
||||
allocator_type& __a = __base::__alloc();
|
||||
if (__front_spare() == 0)
|
||||
__add_front_capacity();
|
||||
// __front_spare() >= 1
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), __v);
|
||||
--__base::__start_;
|
||||
++__base::size();
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
deque<_Tp, _Allocator>::push_front(value_type&& __v)
|
||||
@ -1877,7 +1861,6 @@ deque<_Tp, _Allocator>::push_front(value_type&& __v)
|
||||
++__base::size();
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class... _Args>
|
||||
@ -1900,8 +1883,121 @@ deque<_Tp, _Allocator>::emplace_front(_Args&&... __args)
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Tp, class _Allocator>
|
||||
typename deque<_Tp, _Allocator>::iterator
|
||||
deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v)
|
||||
{
|
||||
size_type __pos = __p - __base::begin();
|
||||
size_type __to_end = __base::size() - __pos;
|
||||
allocator_type& __a = __base::__alloc();
|
||||
if (__pos < __to_end)
|
||||
{ // insert by shifting things backward
|
||||
if (__front_spare() == 0)
|
||||
__add_front_capacity();
|
||||
// __front_spare() >= 1
|
||||
if (__pos == 0)
|
||||
{
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::move(__v));
|
||||
--__base::__start_;
|
||||
++__base::size();
|
||||
}
|
||||
else
|
||||
{
|
||||
iterator __b = __base::begin();
|
||||
iterator __bm1 = _VSTD::prev(__b);
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b));
|
||||
--__base::__start_;
|
||||
++__base::size();
|
||||
if (__pos > 1)
|
||||
__b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b);
|
||||
*__b = _VSTD::move(__v);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // insert by shifting things forward
|
||||
if (__back_spare() == 0)
|
||||
__add_back_capacity();
|
||||
// __back_capacity >= 1
|
||||
size_type __de = __base::size() - __pos;
|
||||
if (__de == 0)
|
||||
{
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::move(__v));
|
||||
++__base::size();
|
||||
}
|
||||
else
|
||||
{
|
||||
iterator __e = __base::end();
|
||||
iterator __em1 = _VSTD::prev(__e);
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1));
|
||||
++__base::size();
|
||||
if (__de > 1)
|
||||
__e = _VSTD::move_backward(__e - __de, __em1, __e);
|
||||
*--__e = _VSTD::move(__v);
|
||||
}
|
||||
}
|
||||
return __base::begin() + __pos;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class... _Args>
|
||||
typename deque<_Tp, _Allocator>::iterator
|
||||
deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
|
||||
{
|
||||
size_type __pos = __p - __base::begin();
|
||||
size_type __to_end = __base::size() - __pos;
|
||||
allocator_type& __a = __base::__alloc();
|
||||
if (__pos < __to_end)
|
||||
{ // insert by shifting things backward
|
||||
if (__front_spare() == 0)
|
||||
__add_front_capacity();
|
||||
// __front_spare() >= 1
|
||||
if (__pos == 0)
|
||||
{
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::forward<_Args>(__args)...);
|
||||
--__base::__start_;
|
||||
++__base::size();
|
||||
}
|
||||
else
|
||||
{
|
||||
__temp_value<value_type, _Allocator> __tmp(this->__alloc(), _VSTD::forward<_Args>(__args)...);
|
||||
iterator __b = __base::begin();
|
||||
iterator __bm1 = _VSTD::prev(__b);
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b));
|
||||
--__base::__start_;
|
||||
++__base::size();
|
||||
if (__pos > 1)
|
||||
__b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b);
|
||||
*__b = _VSTD::move(__tmp.get());
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // insert by shifting things forward
|
||||
if (__back_spare() == 0)
|
||||
__add_back_capacity();
|
||||
// __back_capacity >= 1
|
||||
size_type __de = __base::size() - __pos;
|
||||
if (__de == 0)
|
||||
{
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::forward<_Args>(__args)...);
|
||||
++__base::size();
|
||||
}
|
||||
else
|
||||
{
|
||||
__temp_value<value_type, _Allocator> __tmp(this->__alloc(), _VSTD::forward<_Args>(__args)...);
|
||||
iterator __e = __base::end();
|
||||
iterator __em1 = _VSTD::prev(__e);
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1));
|
||||
++__base::size();
|
||||
if (__de > 1)
|
||||
__e = _VSTD::move_backward(__e - __de, __em1, __e);
|
||||
*--__e = _VSTD::move(__tmp.get());
|
||||
}
|
||||
}
|
||||
return __base::begin() + __pos;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
typename deque<_Tp, _Allocator>::iterator
|
||||
@ -1964,126 +2060,6 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v)
|
||||
return __base::begin() + __pos;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
typename deque<_Tp, _Allocator>::iterator
|
||||
deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v)
|
||||
{
|
||||
size_type __pos = __p - __base::begin();
|
||||
size_type __to_end = __base::size() - __pos;
|
||||
allocator_type& __a = __base::__alloc();
|
||||
if (__pos < __to_end)
|
||||
{ // insert by shifting things backward
|
||||
if (__front_spare() == 0)
|
||||
__add_front_capacity();
|
||||
// __front_spare() >= 1
|
||||
if (__pos == 0)
|
||||
{
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::move(__v));
|
||||
--__base::__start_;
|
||||
++__base::size();
|
||||
}
|
||||
else
|
||||
{
|
||||
iterator __b = __base::begin();
|
||||
iterator __bm1 = _VSTD::prev(__b);
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b));
|
||||
--__base::__start_;
|
||||
++__base::size();
|
||||
if (__pos > 1)
|
||||
__b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b);
|
||||
*__b = _VSTD::move(__v);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // insert by shifting things forward
|
||||
if (__back_spare() == 0)
|
||||
__add_back_capacity();
|
||||
// __back_capacity >= 1
|
||||
size_type __de = __base::size() - __pos;
|
||||
if (__de == 0)
|
||||
{
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::move(__v));
|
||||
++__base::size();
|
||||
}
|
||||
else
|
||||
{
|
||||
iterator __e = __base::end();
|
||||
iterator __em1 = _VSTD::prev(__e);
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1));
|
||||
++__base::size();
|
||||
if (__de > 1)
|
||||
__e = _VSTD::move_backward(__e - __de, __em1, __e);
|
||||
*--__e = _VSTD::move(__v);
|
||||
}
|
||||
}
|
||||
return __base::begin() + __pos;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class... _Args>
|
||||
typename deque<_Tp, _Allocator>::iterator
|
||||
deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
|
||||
{
|
||||
size_type __pos = __p - __base::begin();
|
||||
size_type __to_end = __base::size() - __pos;
|
||||
allocator_type& __a = __base::__alloc();
|
||||
if (__pos < __to_end)
|
||||
{ // insert by shifting things backward
|
||||
if (__front_spare() == 0)
|
||||
__add_front_capacity();
|
||||
// __front_spare() >= 1
|
||||
if (__pos == 0)
|
||||
{
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::forward<_Args>(__args)...);
|
||||
--__base::__start_;
|
||||
++__base::size();
|
||||
}
|
||||
else
|
||||
{
|
||||
__temp_value<value_type, _Allocator> __tmp(this->__alloc(), _VSTD::forward<_Args>(__args)...);
|
||||
iterator __b = __base::begin();
|
||||
iterator __bm1 = _VSTD::prev(__b);
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b));
|
||||
--__base::__start_;
|
||||
++__base::size();
|
||||
if (__pos > 1)
|
||||
__b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b);
|
||||
*__b = _VSTD::move(__tmp.get());
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // insert by shifting things forward
|
||||
if (__back_spare() == 0)
|
||||
__add_back_capacity();
|
||||
// __back_capacity >= 1
|
||||
size_type __de = __base::size() - __pos;
|
||||
if (__de == 0)
|
||||
{
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::forward<_Args>(__args)...);
|
||||
++__base::size();
|
||||
}
|
||||
else
|
||||
{
|
||||
__temp_value<value_type, _Allocator> __tmp(this->__alloc(), _VSTD::forward<_Args>(__args)...);
|
||||
iterator __e = __base::end();
|
||||
iterator __em1 = _VSTD::prev(__e);
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1));
|
||||
++__base::size();
|
||||
if (__de > 1)
|
||||
__e = _VSTD::move_backward(__e - __de, __em1, __e);
|
||||
*--__e = _VSTD::move(__tmp.get());
|
||||
}
|
||||
}
|
||||
return __base::begin() + __pos;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
typename deque<_Tp, _Allocator>::iterator
|
||||
deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_type& __v)
|
||||
|
@ -82,6 +82,10 @@ template <class E> void rethrow_if_nested(const E& e);
|
||||
#include <cstdlib>
|
||||
#include <type_traits>
|
||||
|
||||
#if defined(_LIBCPP_ABI_MICROSOFT)
|
||||
#include <vcruntime_exception.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
@ -89,6 +93,7 @@ template <class E> void rethrow_if_nested(const E& e);
|
||||
namespace std // purposefully not using versioning namespace
|
||||
{
|
||||
|
||||
#if !defined(_LIBCPP_ABI_MICROSOFT)
|
||||
class _LIBCPP_EXCEPTION_ABI exception
|
||||
{
|
||||
public:
|
||||
@ -105,11 +110,16 @@ public:
|
||||
virtual ~bad_exception() _NOEXCEPT;
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
#endif // !_LIBCPP_ABI_MICROSOFT
|
||||
|
||||
#if _LIBCPP_STD_VER <= 14 \
|
||||
|| defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS) \
|
||||
|| defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
typedef void (*unexpected_handler)();
|
||||
_LIBCPP_FUNC_VIS unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
|
||||
_LIBCPP_FUNC_VIS unexpected_handler get_unexpected() _NOEXCEPT;
|
||||
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void unexpected();
|
||||
#endif
|
||||
|
||||
typedef void (*terminate_handler)();
|
||||
_LIBCPP_FUNC_VIS terminate_handler set_terminate(terminate_handler) _NOEXCEPT;
|
||||
@ -192,58 +202,71 @@ struct __nested
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __nested(const _Tp& __t) : _Tp(__t) {}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_NORETURN
|
||||
void
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested(_Tp&& __t, typename enable_if<
|
||||
is_class<typename remove_reference<_Tp>::type>::value &&
|
||||
!is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
|
||||
&& !__libcpp_is_final<typename remove_reference<_Tp>::type>::value
|
||||
>::type* = 0)
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested (_Tp& __t, typename enable_if<
|
||||
is_class<_Tp>::value && !is_base_of<nested_exception, _Tp>::value
|
||||
>::type* = 0)
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw __nested<typename remove_reference<_Tp>::type>(_VSTD::forward<_Tp>(__t));
|
||||
#else
|
||||
((void)__t);
|
||||
// FIXME: Make this abort.
|
||||
template <class _Tp, class _Up, bool>
|
||||
struct __throw_with_nested;
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __throw_with_nested<_Tp, _Up, true> {
|
||||
_LIBCPP_NORETURN static inline _LIBCPP_ALWAYS_INLINE void
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__do_throw(_Tp&& __t)
|
||||
#else
|
||||
__do_throw (_Tp& __t)
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
throw __nested<_Up>(_VSTD::forward<_Tp>(__t));
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __throw_with_nested<_Tp, _Up, false> {
|
||||
_LIBCPP_NORETURN static inline _LIBCPP_ALWAYS_INLINE void
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__do_throw(_Tp&& __t)
|
||||
#else
|
||||
__do_throw (_Tp& __t)
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
throw _VSTD::forward<_Tp>(__t);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_NORETURN
|
||||
void
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested(_Tp&& __t, typename enable_if<
|
||||
!is_class<typename remove_reference<_Tp>::type>::value ||
|
||||
is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
|
||||
|| __libcpp_is_final<typename remove_reference<_Tp>::type>::value
|
||||
>::type* = 0)
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested (_Tp& __t, typename enable_if<
|
||||
!is_class<_Tp>::value || is_base_of<nested_exception, _Tp>::value
|
||||
>::type* = 0)
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested(_Tp&& __t)
|
||||
#else
|
||||
throw_with_nested (_Tp& __t)
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw _VSTD::forward<_Tp>(__t);
|
||||
typedef typename decay<_Tp>::type _Up;
|
||||
static_assert( is_copy_constructible<_Up>::value, "type thrown must be CopyConstructible");
|
||||
__throw_with_nested<_Tp, _Up,
|
||||
is_class<_Up>::value &&
|
||||
!is_base_of<nested_exception, _Up>::value &&
|
||||
!__libcpp_is_final<_Up>::value>::
|
||||
__do_throw(_VSTD::forward<_Tp>(__t));
|
||||
#else
|
||||
((void)__t);
|
||||
// FIXME: Make this abort
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _From, class _To>
|
||||
struct __can_dynamic_cast : public _LIBCPP_BOOL_CONSTANT(
|
||||
is_polymorphic<_From>::value &&
|
||||
(!is_base_of<_To, _From>::value ||
|
||||
is_convertible<const _From*, const _To*>::value)) {};
|
||||
|
||||
template <class _Ep>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
rethrow_if_nested(const _Ep& __e, typename enable_if<
|
||||
is_polymorphic<_Ep>::value
|
||||
>::type* = 0)
|
||||
rethrow_if_nested(const _Ep& __e,
|
||||
typename enable_if< __can_dynamic_cast<_Ep, nested_exception>::value>::type* = 0)
|
||||
{
|
||||
const nested_exception* __nep = dynamic_cast<const nested_exception*>(_VSTD::addressof(__e));
|
||||
if (__nep)
|
||||
@ -253,9 +276,8 @@ rethrow_if_nested(const _Ep& __e, typename enable_if<
|
||||
template <class _Ep>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
rethrow_if_nested(const _Ep&, typename enable_if<
|
||||
!is_polymorphic<_Ep>::value
|
||||
>::type* = 0)
|
||||
rethrow_if_nested(const _Ep&,
|
||||
typename enable_if<!__can_dynamic_cast<_Ep, nested_exception>::value>::type* = 0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -408,8 +408,10 @@ class _LIBCPP_TYPE_VIS file_status
|
||||
public:
|
||||
// constructors
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit file_status(file_type __ft = file_type::none,
|
||||
perms __prms = perms::unknown) _NOEXCEPT
|
||||
file_status() _NOEXCEPT : file_status(file_type::none) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit file_status(file_type __ft,
|
||||
perms __prms = perms::unknown) _NOEXCEPT
|
||||
: __ft_(__ft), __prms_(__prms)
|
||||
{}
|
||||
|
||||
@ -720,6 +722,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class = void>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
path& operator=(string_type&& __s) _NOEXCEPT {
|
||||
__pn_ = _VSTD::move(__s);
|
||||
@ -941,15 +944,15 @@ public:
|
||||
std::u32string generic_u32string() const { return string<char32_t>(); }
|
||||
|
||||
private:
|
||||
_LIBCPP_FUNC_VIS int __compare(__string_view) const;
|
||||
_LIBCPP_FUNC_VIS __string_view __root_name() const;
|
||||
_LIBCPP_FUNC_VIS __string_view __root_directory() const;
|
||||
_LIBCPP_FUNC_VIS __string_view __root_path_raw() const;
|
||||
_LIBCPP_FUNC_VIS __string_view __relative_path() const;
|
||||
_LIBCPP_FUNC_VIS __string_view __parent_path() const;
|
||||
_LIBCPP_FUNC_VIS __string_view __filename() const;
|
||||
_LIBCPP_FUNC_VIS __string_view __stem() const;
|
||||
_LIBCPP_FUNC_VIS __string_view __extension() const;
|
||||
int __compare(__string_view) const;
|
||||
__string_view __root_name() const;
|
||||
__string_view __root_directory() const;
|
||||
__string_view __root_path_raw() const;
|
||||
__string_view __relative_path() const;
|
||||
__string_view __parent_path() const;
|
||||
__string_view __filename() const;
|
||||
__string_view __stem() const;
|
||||
__string_view __extension() const;
|
||||
|
||||
public:
|
||||
// compare
|
||||
@ -987,8 +990,8 @@ public:
|
||||
class _LIBCPP_TYPE_VIS iterator;
|
||||
typedef iterator const_iterator;
|
||||
|
||||
_LIBCPP_FUNC_VIS iterator begin() const;
|
||||
_LIBCPP_FUNC_VIS iterator end() const;
|
||||
iterator begin() const;
|
||||
iterator end() const;
|
||||
|
||||
private:
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@ -1088,10 +1091,13 @@ class _LIBCPP_TYPE_VIS path::iterator
|
||||
{
|
||||
public:
|
||||
typedef bidirectional_iterator_tag iterator_category;
|
||||
|
||||
typedef path value_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef const path* pointer;
|
||||
typedef const path& reference;
|
||||
|
||||
typedef void __stashing_iterator_tag; // See reverse_iterator and __is_stashing_iterator
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator() : __stashed_elem_(), __path_ptr_(nullptr),
|
||||
@ -1153,8 +1159,8 @@ private:
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
friend bool operator==(const iterator&, const iterator&);
|
||||
|
||||
_LIBCPP_FUNC_VIS iterator& __increment();
|
||||
_LIBCPP_FUNC_VIS iterator& __decrement();
|
||||
iterator& __increment();
|
||||
iterator& __decrement();
|
||||
|
||||
path __stashed_elem_;
|
||||
const path* __path_ptr_;
|
||||
@ -1205,7 +1211,6 @@ public:
|
||||
return __paths_->second;
|
||||
}
|
||||
|
||||
_LIBCPP_FUNC_VIS
|
||||
~filesystem_error() override; // key function
|
||||
|
||||
// TODO(ericwf): Create a custom error message.
|
||||
@ -1923,7 +1928,7 @@ public:
|
||||
|
||||
const directory_entry& operator*() const {
|
||||
_LIBCPP_ASSERT(__imp_, "The end iterator cannot be dereferenced");
|
||||
return __deref();
|
||||
return __dereference();
|
||||
}
|
||||
|
||||
const directory_entry* operator->() const
|
||||
@ -1948,11 +1953,14 @@ private:
|
||||
|
||||
// construct the dir_stream
|
||||
_LIBCPP_FUNC_VIS
|
||||
directory_iterator(const path&, error_code *, directory_options = directory_options::none);
|
||||
directory_iterator(const path&, error_code *,
|
||||
directory_options = directory_options::none);
|
||||
|
||||
_LIBCPP_FUNC_VIS
|
||||
directory_iterator& __increment(error_code * __ec = nullptr);
|
||||
|
||||
_LIBCPP_FUNC_VIS
|
||||
const directory_entry& __deref() const;
|
||||
const directory_entry& __dereference() const;
|
||||
|
||||
private:
|
||||
shared_ptr<__dir_stream> __imp_;
|
||||
@ -2035,11 +2043,11 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const directory_entry& operator*() const
|
||||
{ return __deref(); }
|
||||
{ return __dereference(); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const directory_entry* operator->() const
|
||||
{ return &__deref(); }
|
||||
{ return &__dereference(); }
|
||||
|
||||
recursive_directory_iterator& operator++()
|
||||
{ return __increment(); }
|
||||
@ -2078,7 +2086,7 @@ private:
|
||||
error_code *__ec);
|
||||
|
||||
_LIBCPP_FUNC_VIS
|
||||
const directory_entry& __deref() const;
|
||||
const directory_entry& __dereference() const;
|
||||
|
||||
_LIBCPP_FUNC_VIS
|
||||
bool __try_recursion(error_code* __ec);
|
||||
|
@ -181,7 +181,7 @@ public:
|
||||
// 8.6.3, memory.polymorphic.allocator.mem
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_ValueType* allocate(size_t __n) {
|
||||
if (__n > max_size()) {
|
||||
if (__n > __max_size()) {
|
||||
__throw_length_error(
|
||||
"std::experimental::pmr::polymorphic_allocator<T>::allocate(size_t n)"
|
||||
" 'n' exceeds maximum supported size");
|
||||
@ -193,7 +193,7 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void deallocate(_ValueType * __p, size_t __n) _NOEXCEPT {
|
||||
_LIBCPP_ASSERT(__n <= max_size(),
|
||||
_LIBCPP_ASSERT(__n <= __max_size(),
|
||||
"deallocate called for size which exceeds max_size()");
|
||||
__res_->deallocate(__p, __n * sizeof(_ValueType), alignof(_ValueType));
|
||||
}
|
||||
@ -265,10 +265,6 @@ public:
|
||||
void destroy(_Tp * __p) _NOEXCEPT
|
||||
{ __p->~_Tp(); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t max_size() const _NOEXCEPT
|
||||
{ return numeric_limits<size_t>::max() / sizeof(value_type); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
polymorphic_allocator
|
||||
select_on_container_copy_construction() const _NOEXCEPT
|
||||
@ -309,6 +305,10 @@ private:
|
||||
return _Tup(_VSTD::get<_Idx>(_VSTD::move(__t))..., resource());
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t __max_size() const _NOEXCEPT
|
||||
{ return numeric_limits<size_t>::max() / sizeof(value_type); }
|
||||
|
||||
memory_resource * __res_;
|
||||
};
|
||||
|
||||
|
@ -45,18 +45,23 @@ inline namespace fundamentals_v2 {
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_LFTS_V2
|
||||
|
||||
template <typename _Tp, bool _IsSigned = is_signed<_Tp>::value> struct __abs;
|
||||
template <typename _Result, typename _Source, bool _IsSigned = is_signed<_Source>::value> struct __abs;
|
||||
|
||||
template <typename _Tp>
|
||||
struct __abs<_Tp, true> {
|
||||
template <typename _Result, typename _Source>
|
||||
struct __abs<_Result, _Source, true> {
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
_Tp operator()(_Tp __t) const noexcept { return __t >= 0 ? __t : -__t; }
|
||||
_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 _Tp>
|
||||
struct __abs<_Tp, false> {
|
||||
template <typename _Result, typename _Source>
|
||||
struct __abs<_Result, _Source, false> {
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
_Tp operator()(_Tp __t) const noexcept { return __t; }
|
||||
_Result operator()(_Source __t) const noexcept { return __t; }
|
||||
};
|
||||
|
||||
|
||||
@ -75,10 +80,12 @@ 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>(__gcd(static_cast<_Wp>(__abs<_Tp>()(__m)),
|
||||
static_cast<_Wp>(__abs<_Up>()(__n))));
|
||||
return static_cast<_Rp>(__gcd(static_cast<_Wp>(__abs<_Rp, _Tp>()(__m)),
|
||||
static_cast<_Wp>(__abs<_Rp, _Up>()(__n))));
|
||||
}
|
||||
|
||||
template<class _Tp, class _Up>
|
||||
@ -87,12 +94,14 @@ 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<_Tp>()(__m) / gcd(__m,__n);
|
||||
_Up __val2 = __abs<_Up>()(__n);
|
||||
_Rp __val1 = __abs<_Rp, _Tp>()(__m) / gcd(__m, __n);
|
||||
_Rp __val2 = __abs<_Rp, _Up>()(__n);
|
||||
_LIBCPP_ASSERT((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm");
|
||||
return __val1 * __val2;
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
|
||||
#include <ext/__hash>
|
||||
|
||||
#if __DEPRECATED
|
||||
#if defined(_MSC_VER) && ! defined(__clang__)
|
||||
#if defined(_LIBCPP_MSVC)
|
||||
_LIBCPP_WARNING("Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>")
|
||||
#else
|
||||
# warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
|
||||
|
@ -199,7 +199,7 @@ template <class Value, class Hash, class Pred, class Alloc>
|
||||
#include <ext/__hash>
|
||||
|
||||
#if __DEPRECATED
|
||||
#if defined(_MSC_VER) && ! defined(__clang__)
|
||||
#if defined(_LIBCPP_MSVC)
|
||||
_LIBCPP_WARNING("Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>")
|
||||
#else
|
||||
# warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>
|
||||
|
@ -478,14 +478,14 @@ protected:
|
||||
__forward_list_base(const allocator_type& __a)
|
||||
: __before_begin_(__begin_node(), __node_allocator(__a)) {}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__forward_list_base(__forward_list_base&& __x)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__forward_list_base(__forward_list_base&& __x, const allocator_type& __a);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
private:
|
||||
__forward_list_base(const __forward_list_base&);
|
||||
@ -539,7 +539,7 @@ private:
|
||||
{__alloc() = _VSTD::move(__x.__alloc());}
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
inline
|
||||
@ -563,7 +563,7 @@ __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x,
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
__forward_list_base<_Tp, _Alloc>::~__forward_list_base()
|
||||
@ -656,32 +656,33 @@ public:
|
||||
>::type* = nullptr);
|
||||
forward_list(const forward_list& __x);
|
||||
forward_list(const forward_list& __x, const allocator_type& __a);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
forward_list& operator=(const forward_list& __x);
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
forward_list(forward_list&& __x)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<base>::value)
|
||||
: base(_VSTD::move(__x)) {}
|
||||
forward_list(forward_list&& __x, const allocator_type& __a);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
forward_list(initializer_list<value_type> __il);
|
||||
forward_list(initializer_list<value_type> __il, const allocator_type& __a);
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
// ~forward_list() = default;
|
||||
|
||||
forward_list& operator=(const forward_list& __x);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
forward_list& operator=(forward_list&& __x)
|
||||
_NOEXCEPT_(
|
||||
__node_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value);
|
||||
#endif
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
forward_list& operator=(initializer_list<value_type> __il);
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void assign(initializer_list<value_type> __il);
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
// ~forward_list() = default;
|
||||
|
||||
template <class _InputIterator>
|
||||
typename enable_if
|
||||
@ -691,10 +692,6 @@ public:
|
||||
>::type
|
||||
assign(_InputIterator __f, _InputIterator __l);
|
||||
void assign(size_type __n, const value_type& __v);
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void assign(initializer_list<value_type> __il);
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const _NOEXCEPT
|
||||
@ -745,27 +742,26 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reference front() const {return base::__before_begin()->__next_->__value_;}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
template <class... _Args> reference emplace_front(_Args&&... __args);
|
||||
#else
|
||||
template <class... _Args> void emplace_front(_Args&&... __args);
|
||||
#endif
|
||||
#endif
|
||||
void push_front(value_type&& __v);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
void push_front(const value_type& __v);
|
||||
|
||||
void pop_front();
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class... _Args>
|
||||
iterator emplace_after(const_iterator __p, _Args&&... __args);
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
iterator insert_after(const_iterator __p, value_type&& __v);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
iterator insert_after(const_iterator __p, initializer_list<value_type> __il)
|
||||
{return insert_after(__p, __il.begin(), __il.end());}
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
iterator insert_after(const_iterator __p, const value_type& __v);
|
||||
iterator insert_after(const_iterator __p, size_type __n, const value_type& __v);
|
||||
template <class _InputIterator>
|
||||
@ -776,10 +772,6 @@ public:
|
||||
iterator
|
||||
>::type
|
||||
insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l);
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
iterator insert_after(const_iterator __p, initializer_list<value_type> __il)
|
||||
{return insert_after(__p, __il.begin(), __il.end());}
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
iterator erase_after(const_iterator __p);
|
||||
iterator erase_after(const_iterator __f, const_iterator __l);
|
||||
@ -799,7 +791,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() _NOEXCEPT {base::clear();}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void splice_after(const_iterator __p, forward_list&& __x);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -807,7 +799,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void splice_after(const_iterator __p, forward_list&& __x,
|
||||
const_iterator __f, const_iterator __l);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
void splice_after(const_iterator __p, forward_list& __x);
|
||||
void splice_after(const_iterator __p, forward_list& __x, const_iterator __i);
|
||||
void splice_after(const_iterator __p, forward_list& __x,
|
||||
@ -817,14 +809,14 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void unique() {unique(__equal_to<value_type>());}
|
||||
template <class _BinaryPredicate> void unique(_BinaryPredicate __binary_pred);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void merge(forward_list&& __x) {merge(__x, __less<value_type>());}
|
||||
template <class _Compare>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void merge(forward_list&& __x, _Compare __comp)
|
||||
{merge(__x, _VSTD::move(__comp));}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void merge(forward_list& __x) {merge(__x, __less<value_type>());}
|
||||
template <class _Compare> void merge(forward_list& __x, _Compare __comp);
|
||||
@ -835,11 +827,11 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
void __move_assign(forward_list& __x, true_type)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
|
||||
void __move_assign(forward_list& __x, false_type);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Compare>
|
||||
static
|
||||
@ -955,8 +947,19 @@ forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x,
|
||||
insert_after(cbefore_begin(), __x.begin(), __x.end());
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Tp, class _Alloc>
|
||||
forward_list<_Tp, _Alloc>&
|
||||
forward_list<_Tp, _Alloc>::operator=(const forward_list& __x)
|
||||
{
|
||||
if (this != &__x)
|
||||
{
|
||||
base::__copy_assign_alloc(__x);
|
||||
assign(__x.begin(), __x.end());
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp, class _Alloc>
|
||||
forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x,
|
||||
const allocator_type& __a)
|
||||
@ -969,10 +972,6 @@ forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x,
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il)
|
||||
{
|
||||
@ -987,22 +986,6 @@ forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il,
|
||||
insert_after(cbefore_begin(), __il.begin(), __il.end());
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
forward_list<_Tp, _Alloc>&
|
||||
forward_list<_Tp, _Alloc>::operator=(const forward_list& __x)
|
||||
{
|
||||
if (this != &__x)
|
||||
{
|
||||
base::__copy_assign_alloc(__x);
|
||||
assign(__x.begin(), __x.end());
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
void
|
||||
forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, true_type)
|
||||
@ -1040,10 +1023,6 @@ forward_list<_Tp, _Alloc>::operator=(forward_list&& __x)
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
inline
|
||||
forward_list<_Tp, _Alloc>&
|
||||
@ -1053,7 +1032,7 @@ forward_list<_Tp, _Alloc>::operator=(initializer_list<value_type> __il)
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
@ -1090,7 +1069,7 @@ forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v)
|
||||
erase_after(__i, __e);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
inline
|
||||
@ -1100,11 +1079,6 @@ forward_list<_Tp, _Alloc>::assign(initializer_list<value_type> __il)
|
||||
assign(__il.begin(), __il.end());
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
template <class... _Args>
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
@ -1126,8 +1100,6 @@ forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
void
|
||||
forward_list<_Tp, _Alloc>::push_front(value_type&& __v)
|
||||
@ -1140,7 +1112,7 @@ forward_list<_Tp, _Alloc>::push_front(value_type&& __v)
|
||||
base::__before_begin()->__next_ = __h.release();
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
void
|
||||
@ -1165,8 +1137,7 @@ forward_list<_Tp, _Alloc>::pop_front()
|
||||
__node_traits::deallocate(__a, __p, 1);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
template <class... _Args>
|
||||
@ -1184,8 +1155,6 @@ forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args)
|
||||
return iterator(__r->__next_);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
typename forward_list<_Tp, _Alloc>::iterator
|
||||
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
|
||||
@ -1200,7 +1169,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
|
||||
return iterator(__r->__next_);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
typename forward_list<_Tp, _Alloc>::iterator
|
||||
@ -1468,7 +1437,7 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@ -1499,7 +1468,7 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
|
||||
splice_after(__p, __x, __f, __l);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
void
|
||||
|
@ -235,7 +235,7 @@ namespace placeholders {
|
||||
}
|
||||
|
||||
template <class Operation>
|
||||
class binder1st
|
||||
class binder1st // deprecated in C++11, removed in C++17
|
||||
: public unary_function<typename Operation::second_argument_type,
|
||||
typename Operation::result_type>
|
||||
{
|
||||
@ -249,10 +249,10 @@ public:
|
||||
};
|
||||
|
||||
template <class Operation, class T>
|
||||
binder1st<Operation> bind1st(const Operation& op, const T& x);
|
||||
binder1st<Operation> bind1st(const Operation& op, const T& x); // deprecated in C++11, removed in C++17
|
||||
|
||||
template <class Operation>
|
||||
class binder2nd
|
||||
class binder2nd // deprecated in C++11, removed in C++17
|
||||
: public unary_function<typename Operation::first_argument_type,
|
||||
typename Operation::result_type>
|
||||
{
|
||||
@ -266,9 +266,9 @@ public:
|
||||
};
|
||||
|
||||
template <class Operation, class T>
|
||||
binder2nd<Operation> bind2nd(const Operation& op, const T& x);
|
||||
binder2nd<Operation> bind2nd(const Operation& op, const T& x); // deprecated in C++11, removed in C++17
|
||||
|
||||
template <class Arg, class Result>
|
||||
template <class Arg, class Result> // deprecated in C++11, removed in C++17
|
||||
class pointer_to_unary_function : public unary_function<Arg, Result>
|
||||
{
|
||||
public:
|
||||
@ -277,9 +277,9 @@ public:
|
||||
};
|
||||
|
||||
template <class Arg, class Result>
|
||||
pointer_to_unary_function<Arg,Result> ptr_fun(Result (*f)(Arg));
|
||||
pointer_to_unary_function<Arg,Result> ptr_fun(Result (*f)(Arg)); // deprecated in C++11, removed in C++17
|
||||
|
||||
template <class Arg1, class Arg2, class Result>
|
||||
template <class Arg1, class Arg2, class Result> // deprecated in C++11, removed in C++17
|
||||
class pointer_to_binary_function : public binary_function<Arg1, Arg2, Result>
|
||||
{
|
||||
public:
|
||||
@ -288,9 +288,9 @@ public:
|
||||
};
|
||||
|
||||
template <class Arg1, class Arg2, class Result>
|
||||
pointer_to_binary_function<Arg1,Arg2,Result> ptr_fun(Result (*f)(Arg1,Arg2));
|
||||
pointer_to_binary_function<Arg1,Arg2,Result> ptr_fun(Result (*f)(Arg1,Arg2)); // deprecated in C++11, removed in C++17
|
||||
|
||||
template<class S, class T>
|
||||
template<class S, class T> // deprecated in C++11, removed in C++17
|
||||
class mem_fun_t : public unary_function<T*, S>
|
||||
{
|
||||
public:
|
||||
@ -299,18 +299,18 @@ public:
|
||||
};
|
||||
|
||||
template<class S, class T, class A>
|
||||
class mem_fun1_t : public binary_function<T*, A, S>
|
||||
class mem_fun1_t : public binary_function<T*, A, S> // deprecated in C++11, removed in C++17
|
||||
{
|
||||
public:
|
||||
explicit mem_fun1_t(S (T::*p)(A));
|
||||
S operator()(T* p, A x) const;
|
||||
};
|
||||
|
||||
template<class S, class T> mem_fun_t<S,T> mem_fun(S (T::*f)());
|
||||
template<class S, class T, class A> mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A));
|
||||
template<class S, class T> mem_fun_t<S,T> mem_fun(S (T::*f)()); // deprecated in C++11, removed in C++17
|
||||
template<class S, class T, class A> mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A)); // deprecated in C++11, removed in C++17
|
||||
|
||||
template<class S, class T>
|
||||
class mem_fun_ref_t : public unary_function<T, S>
|
||||
class mem_fun_ref_t : public unary_function<T, S> // deprecated in C++11, removed in C++17
|
||||
{
|
||||
public:
|
||||
explicit mem_fun_ref_t(S (T::*p)());
|
||||
@ -318,18 +318,18 @@ public:
|
||||
};
|
||||
|
||||
template<class S, class T, class A>
|
||||
class mem_fun1_ref_t : public binary_function<T, A, S>
|
||||
class mem_fun1_ref_t : public binary_function<T, A, S> // deprecated in C++11, removed in C++17
|
||||
{
|
||||
public:
|
||||
explicit mem_fun1_ref_t(S (T::*p)(A));
|
||||
S operator()(T& p, A x) const;
|
||||
};
|
||||
|
||||
template<class S, class T> mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)());
|
||||
template<class S, class T, class A> mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A));
|
||||
template<class S, class T> mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)()); // deprecated in C++11, removed in C++17
|
||||
template<class S, class T, class A> mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A)); // deprecated in C++11, removed in C++17
|
||||
|
||||
template <class S, class T>
|
||||
class const_mem_fun_t : public unary_function<const T*, S>
|
||||
class const_mem_fun_t : public unary_function<const T*, S> // deprecated in C++11, removed in C++17
|
||||
{
|
||||
public:
|
||||
explicit const_mem_fun_t(S (T::*p)() const);
|
||||
@ -337,18 +337,18 @@ public:
|
||||
};
|
||||
|
||||
template <class S, class T, class A>
|
||||
class const_mem_fun1_t : public binary_function<const T*, A, S>
|
||||
class const_mem_fun1_t : public binary_function<const T*, A, S> // deprecated in C++11, removed in C++17
|
||||
{
|
||||
public:
|
||||
explicit const_mem_fun1_t(S (T::*p)(A) const);
|
||||
S operator()(const T* p, A x) const;
|
||||
};
|
||||
|
||||
template <class S, class T> const_mem_fun_t<S,T> mem_fun(S (T::*f)() const);
|
||||
template <class S, class T, class A> const_mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A) const);
|
||||
template <class S, class T> const_mem_fun_t<S,T> mem_fun(S (T::*f)() const); // deprecated in C++11, removed in C++17
|
||||
template <class S, class T, class A> const_mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A) const); // deprecated in C++11, removed in C++17
|
||||
|
||||
template <class S, class T>
|
||||
class const_mem_fun_ref_t : public unary_function<T, S>
|
||||
class const_mem_fun_ref_t : public unary_function<T, S> // deprecated in C++11, removed in C++17
|
||||
{
|
||||
public:
|
||||
explicit const_mem_fun_ref_t(S (T::*p)() const);
|
||||
@ -356,15 +356,15 @@ public:
|
||||
};
|
||||
|
||||
template <class S, class T, class A>
|
||||
class const_mem_fun1_ref_t : public binary_function<T, A, S>
|
||||
class const_mem_fun1_ref_t : public binary_function<T, A, S> // deprecated in C++11, removed in C++17
|
||||
{
|
||||
public:
|
||||
explicit const_mem_fun1_ref_t(S (T::*p)(A) const);
|
||||
S operator()(const T& p, A x) const;
|
||||
};
|
||||
|
||||
template <class S, class T> const_mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)() const);
|
||||
template <class S, class T, class A> const_mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A) const);
|
||||
template <class S, class T> const_mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)() const); // deprecated in C++11, removed in C++17
|
||||
template <class S, class T, class A> const_mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A) const); // deprecated in C++11, removed in C++17
|
||||
|
||||
template<class R, class T> unspecified mem_fn(R T::*);
|
||||
|
||||
@ -470,6 +470,7 @@ template <> struct hash<double>;
|
||||
template <> struct hash<long double>;
|
||||
|
||||
template<class T> struct hash<T*>;
|
||||
template <> struct hash<nullptr_t>; // C++17
|
||||
|
||||
} // std
|
||||
|
||||
@ -485,6 +486,7 @@ POLICY: For non-variadic implementations, the number of arguments is limited
|
||||
#include <exception>
|
||||
#include <memory>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
|
||||
#include <__functional_base>
|
||||
|
||||
@ -1018,6 +1020,7 @@ inline _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
binary_negate<_Predicate>
|
||||
not2(const _Predicate& __pred) {return binary_negate<_Predicate>(__pred);}
|
||||
|
||||
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
|
||||
template <class __Operation>
|
||||
class _LIBCPP_TEMPLATE_VIS binder1st
|
||||
: public unary_function<typename __Operation::second_argument_type,
|
||||
@ -1242,6 +1245,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
const_mem_fun1_ref_t<_Sp,_Tp,_Ap>
|
||||
mem_fun_ref(_Sp (_Tp::*__f)(_Ap) const)
|
||||
{return const_mem_fun1_ref_t<_Sp,_Tp,_Ap>(__f);}
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// MEMFUN
|
||||
@ -1387,6 +1391,12 @@ mem_fn(_Rp _Tp::* __pm) _NOEXCEPT
|
||||
class _LIBCPP_EXCEPTION_ABI bad_function_call
|
||||
: public exception
|
||||
{
|
||||
#ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
|
||||
public:
|
||||
virtual ~bad_function_call() _NOEXCEPT;
|
||||
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
#endif
|
||||
};
|
||||
|
||||
_LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE
|
||||
@ -2339,247 +2349,6 @@ bind(_Fp&& __f, _BoundArgs&&... __bound_args)
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<bool>
|
||||
: public unary_function<bool, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(bool __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<char>
|
||||
: public unary_function<char, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<signed char>
|
||||
: public unary_function<signed char, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(signed char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<unsigned char>
|
||||
: public unary_function<unsigned char, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(unsigned char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<char16_t>
|
||||
: public unary_function<char16_t, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(char16_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<char32_t>
|
||||
: public unary_function<char32_t, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(char32_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<wchar_t>
|
||||
: public unary_function<wchar_t, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(wchar_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<short>
|
||||
: public unary_function<short, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(short __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<unsigned short>
|
||||
: public unary_function<unsigned short, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(unsigned short __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<int>
|
||||
: public unary_function<int, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(int __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<unsigned int>
|
||||
: public unary_function<unsigned int, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(unsigned int __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<long>
|
||||
: public unary_function<long, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(long __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<unsigned long>
|
||||
: public unary_function<unsigned long, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(unsigned long __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<long long>
|
||||
: public __scalar_hash<long long>
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<unsigned long long>
|
||||
: public __scalar_hash<unsigned long long>
|
||||
{
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_INT128
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<__int128_t>
|
||||
: public __scalar_hash<__int128_t>
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<__uint128_t>
|
||||
: public __scalar_hash<__uint128_t>
|
||||
{
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<float>
|
||||
: public __scalar_hash<float>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(float __v) const _NOEXCEPT
|
||||
{
|
||||
// -0.0 and 0.0 should return same hash
|
||||
if (__v == 0)
|
||||
return 0;
|
||||
return __scalar_hash<float>::operator()(__v);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<double>
|
||||
: public __scalar_hash<double>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(double __v) const _NOEXCEPT
|
||||
{
|
||||
// -0.0 and 0.0 should return same hash
|
||||
if (__v == 0)
|
||||
return 0;
|
||||
return __scalar_hash<double>::operator()(__v);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<long double>
|
||||
: public __scalar_hash<long double>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(long double __v) const _NOEXCEPT
|
||||
{
|
||||
// -0.0 and 0.0 should return same hash
|
||||
if (__v == 0)
|
||||
return 0;
|
||||
#if defined(__i386__)
|
||||
// Zero out padding bits
|
||||
union
|
||||
{
|
||||
long double __t;
|
||||
struct
|
||||
{
|
||||
size_t __a;
|
||||
size_t __b;
|
||||
size_t __c;
|
||||
size_t __d;
|
||||
} __s;
|
||||
} __u;
|
||||
__u.__s.__a = 0;
|
||||
__u.__s.__b = 0;
|
||||
__u.__s.__c = 0;
|
||||
__u.__s.__d = 0;
|
||||
__u.__t = __v;
|
||||
return __u.__s.__a ^ __u.__s.__b ^ __u.__s.__c ^ __u.__s.__d;
|
||||
#elif defined(__x86_64__)
|
||||
// Zero out padding bits
|
||||
union
|
||||
{
|
||||
long double __t;
|
||||
struct
|
||||
{
|
||||
size_t __a;
|
||||
size_t __b;
|
||||
} __s;
|
||||
} __u;
|
||||
__u.__s.__a = 0;
|
||||
__u.__s.__b = 0;
|
||||
__u.__t = __v;
|
||||
return __u.__s.__a ^ __u.__s.__b;
|
||||
#else
|
||||
return __scalar_hash<long double>::operator()(__v);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
||||
template <class _Tp, bool = is_enum<_Tp>::value>
|
||||
struct _LIBCPP_TEMPLATE_VIS __enum_hash
|
||||
: public unary_function<_Tp, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(_Tp __v) const _NOEXCEPT
|
||||
{
|
||||
typedef typename underlying_type<_Tp>::type type;
|
||||
return hash<type>{}(static_cast<type>(__v));
|
||||
}
|
||||
};
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TEMPLATE_VIS __enum_hash<_Tp, false> {
|
||||
__enum_hash() = delete;
|
||||
__enum_hash(__enum_hash const&) = delete;
|
||||
__enum_hash& operator=(__enum_hash const&) = delete;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash : public __enum_hash<_Tp>
|
||||
{
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
|
||||
#define __cpp_lib_invoke 201411
|
||||
|
@ -156,7 +156,7 @@ public:
|
||||
~future();
|
||||
future& operator=(const future& rhs) = delete;
|
||||
future& operator=(future&&) noexcept;
|
||||
shared_future<R> share();
|
||||
shared_future<R> share() noexcept;
|
||||
|
||||
// retrieving the value
|
||||
R get();
|
||||
@ -183,7 +183,7 @@ public:
|
||||
~future();
|
||||
future& operator=(const future& rhs) = delete;
|
||||
future& operator=(future&&) noexcept;
|
||||
shared_future<R&> share();
|
||||
shared_future<R&> share() noexcept;
|
||||
|
||||
// retrieving the value
|
||||
R& get();
|
||||
@ -210,7 +210,7 @@ public:
|
||||
~future();
|
||||
future& operator=(const future& rhs) = delete;
|
||||
future& operator=(future&&) noexcept;
|
||||
shared_future<void> share();
|
||||
shared_future<void> share() noexcept;
|
||||
|
||||
// retrieving the value
|
||||
void get();
|
||||
@ -582,6 +582,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const;
|
||||
template <class _Clock, class _Duration>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
future_status
|
||||
wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const;
|
||||
|
||||
@ -1119,7 +1120,7 @@ public:
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
~future();
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
shared_future<_Rp> share();
|
||||
shared_future<_Rp> share() _NOEXCEPT;
|
||||
|
||||
// retrieving the value
|
||||
_Rp get();
|
||||
@ -1222,7 +1223,7 @@ public:
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
~future();
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
shared_future<_Rp&> share();
|
||||
shared_future<_Rp&> share() _NOEXCEPT;
|
||||
|
||||
// retrieving the value
|
||||
_Rp& get();
|
||||
@ -1320,7 +1321,7 @@ public:
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
~future();
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
shared_future<void> share();
|
||||
shared_future<void> share() _NOEXCEPT;
|
||||
|
||||
// retrieving the value
|
||||
void get();
|
||||
@ -1674,6 +1675,7 @@ class _LIBCPP_TYPE_VIS promise<void>
|
||||
public:
|
||||
promise();
|
||||
template <class _Allocator>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
promise(allocator_arg_t, const _Allocator& __a);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -2580,7 +2582,7 @@ swap(shared_future<_Rp>& __x, shared_future<_Rp>& __y) _NOEXCEPT
|
||||
template <class _Rp>
|
||||
inline
|
||||
shared_future<_Rp>
|
||||
future<_Rp>::share()
|
||||
future<_Rp>::share() _NOEXCEPT
|
||||
{
|
||||
return shared_future<_Rp>(_VSTD::move(*this));
|
||||
}
|
||||
@ -2588,7 +2590,7 @@ future<_Rp>::share()
|
||||
template <class _Rp>
|
||||
inline
|
||||
shared_future<_Rp&>
|
||||
future<_Rp&>::share()
|
||||
future<_Rp&>::share() _NOEXCEPT
|
||||
{
|
||||
return shared_future<_Rp&>(_VSTD::move(*this));
|
||||
}
|
||||
@ -2597,7 +2599,7 @@ future<_Rp&>::share()
|
||||
|
||||
inline
|
||||
shared_future<void>
|
||||
future<void>::share()
|
||||
future<void>::share() _NOEXCEPT
|
||||
{
|
||||
return shared_future<void>(_VSTD::move(*this));
|
||||
}
|
||||
|
@ -592,6 +592,9 @@ public:
|
||||
typedef typename traits_type::pos_type pos_type;
|
||||
typedef typename traits_type::off_type off_type;
|
||||
|
||||
// __true_value will generate undefined references when linking unless
|
||||
// we give it internal linkage.
|
||||
|
||||
#if defined(_LIBCPP_CXX03_LANG)
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
operator __cxx03_bool::__bool_type() const {
|
||||
|
@ -615,6 +615,14 @@ prev(_BidiretionalIter __x,
|
||||
return __x;
|
||||
}
|
||||
|
||||
|
||||
template <class _Tp, class = void>
|
||||
struct __is_stashing_iterator : false_type {};
|
||||
|
||||
template <class _Tp>
|
||||
struct __is_stashing_iterator<_Tp, typename __void_t<typename _Tp::__stashing_iterator_tag>::type>
|
||||
: true_type {};
|
||||
|
||||
template <class _Iter>
|
||||
class _LIBCPP_TEMPLATE_VIS reverse_iterator
|
||||
: public iterator<typename iterator_traits<_Iter>::iterator_category,
|
||||
@ -625,6 +633,11 @@ class _LIBCPP_TEMPLATE_VIS reverse_iterator
|
||||
{
|
||||
private:
|
||||
/*mutable*/ _Iter __t; // no longer used as of LWG #2360, not removed due to ABI break
|
||||
|
||||
static_assert(!__is_stashing_iterator<_Iter>::value,
|
||||
"The specified iterator type cannot be used with reverse_iterator; "
|
||||
"Using stashing iterators with reverse_iterator causes undefined behavior");
|
||||
|
||||
protected:
|
||||
_Iter current;
|
||||
public:
|
||||
|
@ -101,12 +101,12 @@ template<> class numeric_limits<cv long double>;
|
||||
} // std
|
||||
|
||||
*/
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include <__config>
|
||||
#include <type_traits>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
108
include/list
108
include/list
@ -860,11 +860,10 @@ public:
|
||||
list(const list& __c, const allocator_type& __a);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
list& operator=(const list& __c);
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
list(initializer_list<value_type> __il);
|
||||
list(initializer_list<value_type> __il, const allocator_type& __a);
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
list(list&& __c)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
|
||||
@ -875,22 +874,20 @@ public:
|
||||
_NOEXCEPT_(
|
||||
__node_alloc_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<__node_allocator>::value);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
list& operator=(initializer_list<value_type> __il)
|
||||
{assign(__il.begin(), __il.end()); return *this;}
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void assign(initializer_list<value_type> __il)
|
||||
{assign(__il.begin(), __il.end());}
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _InpIter>
|
||||
void assign(_InpIter __f, _InpIter __l,
|
||||
typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0);
|
||||
void assign(size_type __n, const value_type& __x);
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void assign(initializer_list<value_type> __il)
|
||||
{assign(__il.begin(), __il.end());}
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const _NOEXCEPT;
|
||||
@ -964,10 +961,10 @@ public:
|
||||
return base::__end_.__prev_->__as_node()->__value_;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
void push_front(value_type&& __x);
|
||||
void push_back(value_type&& __x);
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class... _Args>
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
reference emplace_front(_Args&&... __args);
|
||||
@ -982,9 +979,13 @@ public:
|
||||
#endif
|
||||
template <class... _Args>
|
||||
iterator emplace(const_iterator __p, _Args&&... __args);
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
iterator insert(const_iterator __p, value_type&& __x);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __p, initializer_list<value_type> __il)
|
||||
{return insert(__p, __il.begin(), __il.end());}
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
void push_front(const value_type& __x);
|
||||
void push_back(const value_type& __x);
|
||||
@ -994,11 +995,6 @@ public:
|
||||
template <class _InpIter>
|
||||
iterator insert(const_iterator __p, _InpIter __f, _InpIter __l,
|
||||
typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0);
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __p, initializer_list<value_type> __il)
|
||||
{return insert(__p, __il.begin(), __il.end());}
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(list& __c)
|
||||
@ -1022,22 +1018,18 @@ public:
|
||||
void resize(size_type __n, const value_type& __x);
|
||||
|
||||
void splice(const_iterator __p, list& __c);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void splice(const_iterator __p, list&& __c) {splice(__p, __c);}
|
||||
#endif
|
||||
void splice(const_iterator __p, list& __c, const_iterator __i);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void splice(const_iterator __p, list&& __c, const_iterator __i)
|
||||
{splice(__p, __c, __i);}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void splice(const_iterator __p, list&& __c, const_iterator __f, const_iterator __l)
|
||||
{splice(__p, __c, __f, __l);}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif
|
||||
void splice(const_iterator __p, list& __c, const_iterator __i);
|
||||
void splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l);
|
||||
|
||||
void remove(const value_type& __x);
|
||||
template <class _Pred> void remove_if(_Pred __pred);
|
||||
@ -1047,17 +1039,17 @@ public:
|
||||
void unique(_BinaryPred __binary_pred);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void merge(list& __c);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void merge(list&& __c) {merge(__c);}
|
||||
#endif
|
||||
template <class _Comp>
|
||||
void merge(list& __c, _Comp __comp);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Comp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void merge(list&& __c, _Comp __comp) {merge(__c, __comp);}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif
|
||||
template <class _Comp>
|
||||
void merge(list& __c, _Comp __comp);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void sort();
|
||||
template <class _Comp>
|
||||
@ -1146,7 +1138,7 @@ list<_Tp, _Alloc>::list(size_type __n)
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
for (; __n > 0; --__n)
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
emplace_back();
|
||||
#else
|
||||
push_back(value_type());
|
||||
@ -1161,11 +1153,7 @@ list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a)
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
for (; __n > 0; --__n)
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
emplace_back();
|
||||
#else
|
||||
push_back(value_type());
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1239,7 +1227,7 @@ list<_Tp, _Alloc>::list(const list& __c, const allocator_type& __a)
|
||||
push_back(*__i);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
list<_Tp, _Alloc>::list(initializer_list<value_type> __il, const allocator_type& __a)
|
||||
@ -1264,23 +1252,6 @@ list<_Tp, _Alloc>::list(initializer_list<value_type> __il)
|
||||
push_back(*__i);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
inline
|
||||
list<_Tp, _Alloc>&
|
||||
list<_Tp, _Alloc>::operator=(const list& __c)
|
||||
{
|
||||
if (this != &__c)
|
||||
{
|
||||
base::__copy_assign_alloc(__c);
|
||||
assign(__c.begin(), __c.end());
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
inline
|
||||
list<_Tp, _Alloc>::list(list&& __c)
|
||||
@ -1346,7 +1317,20 @@ list<_Tp, _Alloc>::__move_assign(list& __c, true_type)
|
||||
splice(end(), __c);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
inline
|
||||
list<_Tp, _Alloc>&
|
||||
list<_Tp, _Alloc>::operator=(const list& __c)
|
||||
{
|
||||
if (this != &__c)
|
||||
{
|
||||
base::__copy_assign_alloc(__c);
|
||||
assign(__c.begin(), __c.end());
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
template <class _InpIter>
|
||||
@ -1576,7 +1560,7 @@ list<_Tp, _Alloc>::push_back(const value_type& __x)
|
||||
__hold.release();
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
void
|
||||
@ -1604,8 +1588,6 @@ list<_Tp, _Alloc>::push_back(value_type&& __x)
|
||||
__hold.release();
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
template <class... _Args>
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
@ -1677,8 +1659,6 @@ list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args)
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
typename list<_Tp, _Alloc>::iterator
|
||||
list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x)
|
||||
@ -1704,7 +1684,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x)
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
void
|
||||
|
@ -623,16 +623,19 @@ protected:
|
||||
~num_get() {}
|
||||
|
||||
template <class _Fp>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
iter_type __do_get_floating_point
|
||||
(iter_type __b, iter_type __e, ios_base& __iob,
|
||||
ios_base::iostate& __err, _Fp& __v) const;
|
||||
|
||||
template <class _Signed>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
iter_type __do_get_signed
|
||||
(iter_type __b, iter_type __e, ios_base& __iob,
|
||||
ios_base::iostate& __err, _Signed& __v) const;
|
||||
|
||||
template <class _Unsigned>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
iter_type __do_get_unsigned
|
||||
(iter_type __b, iter_type __e, ios_base& __iob,
|
||||
ios_base::iostate& __err, _Unsigned& __v) const;
|
||||
@ -2628,10 +2631,10 @@ private:
|
||||
void init(const char*);
|
||||
};
|
||||
|
||||
template<> void moneypunct_byname<char, false>::init(const char*);
|
||||
template<> void moneypunct_byname<char, true>::init(const char*);
|
||||
template<> void moneypunct_byname<wchar_t, false>::init(const char*);
|
||||
template<> void moneypunct_byname<wchar_t, true>::init(const char*);
|
||||
template<> _LIBCPP_FUNC_VIS void moneypunct_byname<char, false>::init(const char*);
|
||||
template<> _LIBCPP_FUNC_VIS void moneypunct_byname<char, true>::init(const char*);
|
||||
template<> _LIBCPP_FUNC_VIS void moneypunct_byname<wchar_t, false>::init(const char*);
|
||||
template<> _LIBCPP_FUNC_VIS void moneypunct_byname<wchar_t, true>::init(const char*);
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, false>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, true>)
|
||||
|
@ -453,9 +453,7 @@ swap(multimap<Key, T, Compare, Allocator>& x,
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Key, class _CP, class _Compare,
|
||||
bool = is_empty<_Compare>::value && !__libcpp_is_final<_Compare>::value
|
||||
>
|
||||
template <class _Key, class _CP, class _Compare, bool _IsSmall>
|
||||
class __map_value_compare
|
||||
: private _Compare
|
||||
{
|
||||
@ -482,8 +480,8 @@ public:
|
||||
void swap(__map_value_compare&__y)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_Compare>::value)
|
||||
{
|
||||
using _VSTD::swap;
|
||||
swap(static_cast<const _Compare&>(*this), static_cast<const _Compare&>(__y));
|
||||
using _VSTD::swap;
|
||||
swap(static_cast<_Compare&>(*this), static_cast<_Compare&>(__y));
|
||||
}
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
418
include/math.h
418
include/math.h
@ -330,6 +330,16 @@ signbit(_A1 __lcpp_x) _NOEXCEPT
|
||||
return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x);
|
||||
}
|
||||
|
||||
#elif defined(_LIBCPP_MSVCRT)
|
||||
|
||||
template <typename _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
|
||||
signbit(_A1 __lcpp_x) _NOEXCEPT
|
||||
{
|
||||
return ::signbit(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
|
||||
}
|
||||
|
||||
#endif // signbit
|
||||
|
||||
// fpclassify
|
||||
@ -354,6 +364,16 @@ fpclassify(_A1 __lcpp_x) _NOEXCEPT
|
||||
return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x);
|
||||
}
|
||||
|
||||
#elif defined(_LIBCPP_MSVCRT)
|
||||
|
||||
template <typename _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_arithmetic<_A1>::value, int>::type
|
||||
fpclassify(_A1 __lcpp_x) _NOEXCEPT
|
||||
{
|
||||
return ::fpclassify(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
|
||||
}
|
||||
|
||||
#endif // fpclassify
|
||||
|
||||
// isfinite
|
||||
@ -637,58 +657,58 @@ isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
|
||||
#if !(defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
float
|
||||
abs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);}
|
||||
abs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
double
|
||||
abs(double __lcpp_x) _NOEXCEPT {return fabs(__lcpp_x);}
|
||||
abs(double __lcpp_x) _NOEXCEPT {return ::fabs(__lcpp_x);}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
long double
|
||||
abs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);}
|
||||
abs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
|
||||
#endif // !(defined(_AIX) || defined(__sun__))
|
||||
|
||||
// acos
|
||||
|
||||
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return acosf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return acosl(__lcpp_x);}
|
||||
#if !(defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return ::acosf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);}
|
||||
#endif
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
acos(_A1 __lcpp_x) _NOEXCEPT {return acos((double)__lcpp_x);}
|
||||
acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);}
|
||||
|
||||
// asin
|
||||
|
||||
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return asinf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return asinl(__lcpp_x);}
|
||||
#if !(defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return ::asinf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return ::asinl(__lcpp_x);}
|
||||
#endif
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
asin(_A1 __lcpp_x) _NOEXCEPT {return asin((double)__lcpp_x);}
|
||||
asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);}
|
||||
|
||||
// atan
|
||||
|
||||
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return atanf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return atanl(__lcpp_x);}
|
||||
#if !(defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return ::atanf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return ::atanl(__lcpp_x);}
|
||||
#endif
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
atan(_A1 __lcpp_x) _NOEXCEPT {return atan((double)__lcpp_x);}
|
||||
atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);}
|
||||
|
||||
// atan2
|
||||
|
||||
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return atan2f(__lcpp_y, __lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return atan2l(__lcpp_y, __lcpp_x);}
|
||||
#if !(defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return ::atan2f(__lcpp_y, __lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return ::atan2l(__lcpp_y, __lcpp_x);}
|
||||
#endif
|
||||
|
||||
template <class _A1, class _A2>
|
||||
@ -704,86 +724,86 @@ atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
|
||||
typedef typename std::__promote<_A1, _A2>::type __result_type;
|
||||
static_assert((!(std::is_same<_A1, __result_type>::value &&
|
||||
std::is_same<_A2, __result_type>::value)), "");
|
||||
return atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
|
||||
return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
|
||||
}
|
||||
|
||||
// ceil
|
||||
|
||||
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ceilf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ceill(__lcpp_x);}
|
||||
#if !(defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ::ceilf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ::ceill(__lcpp_x);}
|
||||
#endif
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
ceil(_A1 __lcpp_x) _NOEXCEPT {return ceil((double)__lcpp_x);}
|
||||
ceil(_A1 __lcpp_x) _NOEXCEPT {return ::ceil((double)__lcpp_x);}
|
||||
|
||||
// cos
|
||||
|
||||
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return cosf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return cosl(__lcpp_x);}
|
||||
#if !(defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return ::cosf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return ::cosl(__lcpp_x);}
|
||||
#endif
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
cos(_A1 __lcpp_x) _NOEXCEPT {return cos((double)__lcpp_x);}
|
||||
cos(_A1 __lcpp_x) _NOEXCEPT {return ::cos((double)__lcpp_x);}
|
||||
|
||||
// cosh
|
||||
|
||||
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return coshf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return coshl(__lcpp_x);}
|
||||
#if !(defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return ::coshf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return ::coshl(__lcpp_x);}
|
||||
#endif
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
cosh(_A1 __lcpp_x) _NOEXCEPT {return cosh((double)__lcpp_x);}
|
||||
cosh(_A1 __lcpp_x) _NOEXCEPT {return ::cosh((double)__lcpp_x);}
|
||||
|
||||
// exp
|
||||
|
||||
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return expf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return expl(__lcpp_x);}
|
||||
#if !(defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return ::expf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return ::expl(__lcpp_x);}
|
||||
#endif
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
exp(_A1 __lcpp_x) _NOEXCEPT {return exp((double)__lcpp_x);}
|
||||
exp(_A1 __lcpp_x) _NOEXCEPT {return ::exp((double)__lcpp_x);}
|
||||
|
||||
// fabs
|
||||
|
||||
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);}
|
||||
#if !(defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
|
||||
#endif
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
fabs(_A1 __lcpp_x) _NOEXCEPT {return fabs((double)__lcpp_x);}
|
||||
fabs(_A1 __lcpp_x) _NOEXCEPT {return ::fabs((double)__lcpp_x);}
|
||||
|
||||
// floor
|
||||
|
||||
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return floorf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return floorl(__lcpp_x);}
|
||||
#if !(defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return ::floorf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return ::floorl(__lcpp_x);}
|
||||
#endif
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
floor(_A1 __lcpp_x) _NOEXCEPT {return floor((double)__lcpp_x);}
|
||||
floor(_A1 __lcpp_x) _NOEXCEPT {return ::floor((double)__lcpp_x);}
|
||||
|
||||
// fmod
|
||||
|
||||
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return fmodf(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fmodl(__lcpp_x, __lcpp_y);}
|
||||
#if !(defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmodf(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmodl(__lcpp_x, __lcpp_y);}
|
||||
#endif
|
||||
|
||||
template <class _A1, class _A2>
|
||||
@ -799,69 +819,69 @@ fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
|
||||
typedef typename std::__promote<_A1, _A2>::type __result_type;
|
||||
static_assert((!(std::is_same<_A1, __result_type>::value &&
|
||||
std::is_same<_A2, __result_type>::value)), "");
|
||||
return fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);
|
||||
return ::fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);
|
||||
}
|
||||
|
||||
// frexp
|
||||
|
||||
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return frexpf(__lcpp_x, __lcpp_e);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return frexpl(__lcpp_x, __lcpp_e);}
|
||||
#if !(defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpf(__lcpp_x, __lcpp_e);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpl(__lcpp_x, __lcpp_e);}
|
||||
#endif
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return frexp((double)__lcpp_x, __lcpp_e);}
|
||||
frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexp((double)__lcpp_x, __lcpp_e);}
|
||||
|
||||
// ldexp
|
||||
|
||||
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ldexpf(__lcpp_x, __lcpp_e);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ldexpl(__lcpp_x, __lcpp_e);}
|
||||
#if !(defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpf(__lcpp_x, __lcpp_e);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpl(__lcpp_x, __lcpp_e);}
|
||||
#endif
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ldexp((double)__lcpp_x, __lcpp_e);}
|
||||
ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexp((double)__lcpp_x, __lcpp_e);}
|
||||
|
||||
// log
|
||||
|
||||
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return logf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return logl(__lcpp_x);}
|
||||
#if !(defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return ::logf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return ::logl(__lcpp_x);}
|
||||
#endif
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
log(_A1 __lcpp_x) _NOEXCEPT {return log((double)__lcpp_x);}
|
||||
log(_A1 __lcpp_x) _NOEXCEPT {return ::log((double)__lcpp_x);}
|
||||
|
||||
// log10
|
||||
|
||||
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return log10f(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return log10l(__lcpp_x);}
|
||||
#if !(defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return ::log10f(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return ::log10l(__lcpp_x);}
|
||||
#endif
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
log10(_A1 __lcpp_x) _NOEXCEPT {return log10((double)__lcpp_x);}
|
||||
log10(_A1 __lcpp_x) _NOEXCEPT {return ::log10((double)__lcpp_x);}
|
||||
|
||||
// modf
|
||||
|
||||
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return modff(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return modfl(__lcpp_x, __lcpp_y);}
|
||||
#if !(defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return ::modff(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return ::modfl(__lcpp_x, __lcpp_y);}
|
||||
#endif
|
||||
|
||||
// pow
|
||||
|
||||
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return powf(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return powl(__lcpp_x, __lcpp_y);}
|
||||
#if !(defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::powf(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::powl(__lcpp_x, __lcpp_y);}
|
||||
#endif
|
||||
|
||||
template <class _A1, class _A2>
|
||||
@ -877,129 +897,119 @@ pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
|
||||
typedef typename std::__promote<_A1, _A2>::type __result_type;
|
||||
static_assert((!(std::is_same<_A1, __result_type>::value &&
|
||||
std::is_same<_A2, __result_type>::value)), "");
|
||||
return pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);
|
||||
return ::pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);
|
||||
}
|
||||
|
||||
// sin
|
||||
|
||||
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT {return sinf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return sinl(__lcpp_x);}
|
||||
#if !(defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT {return ::sinf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return ::sinl(__lcpp_x);}
|
||||
#endif
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
sin(_A1 __lcpp_x) _NOEXCEPT {return sin((double)__lcpp_x);}
|
||||
sin(_A1 __lcpp_x) _NOEXCEPT {return ::sin((double)__lcpp_x);}
|
||||
|
||||
// sinh
|
||||
|
||||
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return sinhf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return sinhl(__lcpp_x);}
|
||||
#if !(defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return ::sinhf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return ::sinhl(__lcpp_x);}
|
||||
#endif
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
sinh(_A1 __lcpp_x) _NOEXCEPT {return sinh((double)__lcpp_x);}
|
||||
sinh(_A1 __lcpp_x) _NOEXCEPT {return ::sinh((double)__lcpp_x);}
|
||||
|
||||
// sqrt
|
||||
|
||||
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return sqrtf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return sqrtl(__lcpp_x);}
|
||||
#if !(defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return ::sqrtf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return ::sqrtl(__lcpp_x);}
|
||||
#endif
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
sqrt(_A1 __lcpp_x) _NOEXCEPT {return sqrt((double)__lcpp_x);}
|
||||
sqrt(_A1 __lcpp_x) _NOEXCEPT {return ::sqrt((double)__lcpp_x);}
|
||||
|
||||
// tan
|
||||
|
||||
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return tanf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return tanl(__lcpp_x);}
|
||||
#if !(defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return ::tanf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return ::tanl(__lcpp_x);}
|
||||
#endif
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
tan(_A1 __lcpp_x) _NOEXCEPT {return tan((double)__lcpp_x);}
|
||||
tan(_A1 __lcpp_x) _NOEXCEPT {return ::tan((double)__lcpp_x);}
|
||||
|
||||
// tanh
|
||||
|
||||
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return tanhf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return tanhl(__lcpp_x);}
|
||||
#if !(defined(_AIX) || defined(__sun__))
|
||||
inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return ::tanhf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return ::tanhl(__lcpp_x);}
|
||||
#endif
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
tanh(_A1 __lcpp_x) _NOEXCEPT {return tanh((double)__lcpp_x);}
|
||||
tanh(_A1 __lcpp_x) _NOEXCEPT {return ::tanh((double)__lcpp_x);}
|
||||
|
||||
// acosh
|
||||
|
||||
#ifndef _LIBCPP_MSVCRT
|
||||
inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return acoshf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return acoshl(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return ::acoshf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return ::acoshl(__lcpp_x);}
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
acosh(_A1 __lcpp_x) _NOEXCEPT {return acosh((double)__lcpp_x);}
|
||||
#endif
|
||||
acosh(_A1 __lcpp_x) _NOEXCEPT {return ::acosh((double)__lcpp_x);}
|
||||
|
||||
// asinh
|
||||
|
||||
#ifndef _LIBCPP_MSVCRT
|
||||
inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return asinhf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return asinhl(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return ::asinhf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return ::asinhl(__lcpp_x);}
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
asinh(_A1 __lcpp_x) _NOEXCEPT {return asinh((double)__lcpp_x);}
|
||||
#endif
|
||||
asinh(_A1 __lcpp_x) _NOEXCEPT {return ::asinh((double)__lcpp_x);}
|
||||
|
||||
// atanh
|
||||
|
||||
#ifndef _LIBCPP_MSVCRT
|
||||
inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return atanhf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return atanhl(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return ::atanhf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return ::atanhl(__lcpp_x);}
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
atanh(_A1 __lcpp_x) _NOEXCEPT {return atanh((double)__lcpp_x);}
|
||||
#endif
|
||||
atanh(_A1 __lcpp_x) _NOEXCEPT {return ::atanh((double)__lcpp_x);}
|
||||
|
||||
// cbrt
|
||||
|
||||
#ifndef _LIBCPP_MSVCRT
|
||||
inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return cbrtf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return cbrtl(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return ::cbrtf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return ::cbrtl(__lcpp_x);}
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
cbrt(_A1 __lcpp_x) _NOEXCEPT {return cbrt((double)__lcpp_x);}
|
||||
#endif
|
||||
cbrt(_A1 __lcpp_x) _NOEXCEPT {return ::cbrt((double)__lcpp_x);}
|
||||
|
||||
// copysign
|
||||
|
||||
#if !defined(_VC_CRT_MAJOR_VERSION) || (_VC_CRT_MAJOR_VERSION < 12)
|
||||
inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x,
|
||||
float __lcpp_y) _NOEXCEPT {
|
||||
return copysignf(__lcpp_x, __lcpp_y);
|
||||
return ::copysignf(__lcpp_x, __lcpp_y);
|
||||
}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double
|
||||
copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {
|
||||
return copysignl(__lcpp_x, __lcpp_y);
|
||||
return ::copysignl(__lcpp_x, __lcpp_y);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class _A1, class _A2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@ -1014,55 +1024,53 @@ copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
|
||||
typedef typename std::__promote<_A1, _A2>::type __result_type;
|
||||
static_assert((!(std::is_same<_A1, __result_type>::value &&
|
||||
std::is_same<_A2, __result_type>::value)), "");
|
||||
return copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
|
||||
return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_MSVCRT
|
||||
|
||||
// erf
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return erff(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return erfl(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return ::erff(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return ::erfl(__lcpp_x);}
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
erf(_A1 __lcpp_x) _NOEXCEPT {return erf((double)__lcpp_x);}
|
||||
erf(_A1 __lcpp_x) _NOEXCEPT {return ::erf((double)__lcpp_x);}
|
||||
|
||||
// erfc
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY float erfc(float __lcpp_x) _NOEXCEPT {return erfcf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return erfcl(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float erfc(float __lcpp_x) _NOEXCEPT {return ::erfcf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return ::erfcl(__lcpp_x);}
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
erfc(_A1 __lcpp_x) _NOEXCEPT {return erfc((double)__lcpp_x);}
|
||||
erfc(_A1 __lcpp_x) _NOEXCEPT {return ::erfc((double)__lcpp_x);}
|
||||
|
||||
// exp2
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY float exp2(float __lcpp_x) _NOEXCEPT {return exp2f(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return exp2l(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float exp2(float __lcpp_x) _NOEXCEPT {return ::exp2f(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return ::exp2l(__lcpp_x);}
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
exp2(_A1 __lcpp_x) _NOEXCEPT {return exp2((double)__lcpp_x);}
|
||||
exp2(_A1 __lcpp_x) _NOEXCEPT {return ::exp2((double)__lcpp_x);}
|
||||
|
||||
// expm1
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY float expm1(float __lcpp_x) _NOEXCEPT {return expm1f(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return expm1l(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float expm1(float __lcpp_x) _NOEXCEPT {return ::expm1f(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return ::expm1l(__lcpp_x);}
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
expm1(_A1 __lcpp_x) _NOEXCEPT {return expm1((double)__lcpp_x);}
|
||||
expm1(_A1 __lcpp_x) _NOEXCEPT {return ::expm1((double)__lcpp_x);}
|
||||
|
||||
// fdim
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return fdimf(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fdiml(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fdimf(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fdiml(__lcpp_x, __lcpp_y);}
|
||||
|
||||
template <class _A1, class _A2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@ -1077,13 +1085,13 @@ fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
|
||||
typedef typename std::__promote<_A1, _A2>::type __result_type;
|
||||
static_assert((!(std::is_same<_A1, __result_type>::value &&
|
||||
std::is_same<_A2, __result_type>::value)), "");
|
||||
return fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);
|
||||
return ::fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);
|
||||
}
|
||||
|
||||
// fma
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT {return fmaf(__lcpp_x, __lcpp_y, __lcpp_z);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __lcpp_x, long double __lcpp_y, long double __lcpp_z) _NOEXCEPT {return fmal(__lcpp_x, __lcpp_y, __lcpp_z);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT {return ::fmaf(__lcpp_x, __lcpp_y, __lcpp_z);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __lcpp_x, long double __lcpp_y, long double __lcpp_z) _NOEXCEPT {return ::fmal(__lcpp_x, __lcpp_y, __lcpp_z);}
|
||||
|
||||
template <class _A1, class _A2, class _A3>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@ -1100,13 +1108,13 @@ fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
|
||||
static_assert((!(std::is_same<_A1, __result_type>::value &&
|
||||
std::is_same<_A2, __result_type>::value &&
|
||||
std::is_same<_A3, __result_type>::value)), "");
|
||||
return fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
|
||||
return ::fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
|
||||
}
|
||||
|
||||
// fmax
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return fmaxf(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fmaxl(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmaxf(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmaxl(__lcpp_x, __lcpp_y);}
|
||||
|
||||
template <class _A1, class _A2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@ -1121,13 +1129,13 @@ fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
|
||||
typedef typename std::__promote<_A1, _A2>::type __result_type;
|
||||
static_assert((!(std::is_same<_A1, __result_type>::value &&
|
||||
std::is_same<_A2, __result_type>::value)), "");
|
||||
return fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);
|
||||
return ::fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);
|
||||
}
|
||||
|
||||
// fmin
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return fminf(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fminl(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fminf(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fminl(__lcpp_x, __lcpp_y);}
|
||||
|
||||
template <class _A1, class _A2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@ -1142,13 +1150,13 @@ fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
|
||||
typedef typename std::__promote<_A1, _A2>::type __result_type;
|
||||
static_assert((!(std::is_same<_A1, __result_type>::value &&
|
||||
std::is_same<_A2, __result_type>::value)), "");
|
||||
return fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);
|
||||
return ::fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);
|
||||
}
|
||||
|
||||
// hypot
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return hypotf(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return hypotl(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::hypotf(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::hypotl(__lcpp_x, __lcpp_y);}
|
||||
|
||||
template <class _A1, class _A2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@ -1163,115 +1171,115 @@ hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
|
||||
typedef typename std::__promote<_A1, _A2>::type __result_type;
|
||||
static_assert((!(std::is_same<_A1, __result_type>::value &&
|
||||
std::is_same<_A2, __result_type>::value)), "");
|
||||
return hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);
|
||||
return ::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);
|
||||
}
|
||||
|
||||
// ilogb
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT {return ilogbf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ilogbl(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT {return ::ilogbf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ::ilogbl(__lcpp_x);}
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, int>::type
|
||||
ilogb(_A1 __lcpp_x) _NOEXCEPT {return ilogb((double)__lcpp_x);}
|
||||
ilogb(_A1 __lcpp_x) _NOEXCEPT {return ::ilogb((double)__lcpp_x);}
|
||||
|
||||
// lgamma
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __lcpp_x) _NOEXCEPT {return lgammaf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return lgammal(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __lcpp_x) _NOEXCEPT {return ::lgammaf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return ::lgammal(__lcpp_x);}
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
lgamma(_A1 __lcpp_x) _NOEXCEPT {return lgamma((double)__lcpp_x);}
|
||||
lgamma(_A1 __lcpp_x) _NOEXCEPT {return ::lgamma((double)__lcpp_x);}
|
||||
|
||||
// llrint
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT {return llrintf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT {return llrintl(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT {return ::llrintf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT {return ::llrintl(__lcpp_x);}
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, long long>::type
|
||||
llrint(_A1 __lcpp_x) _NOEXCEPT {return llrint((double)__lcpp_x);}
|
||||
llrint(_A1 __lcpp_x) _NOEXCEPT {return ::llrint((double)__lcpp_x);}
|
||||
|
||||
// llround
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT {return llroundf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT {return llroundl(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT {return ::llroundf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT {return ::llroundl(__lcpp_x);}
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, long long>::type
|
||||
llround(_A1 __lcpp_x) _NOEXCEPT {return llround((double)__lcpp_x);}
|
||||
llround(_A1 __lcpp_x) _NOEXCEPT {return ::llround((double)__lcpp_x);}
|
||||
|
||||
// log1p
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY float log1p(float __lcpp_x) _NOEXCEPT {return log1pf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return log1pl(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float log1p(float __lcpp_x) _NOEXCEPT {return ::log1pf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return ::log1pl(__lcpp_x);}
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
log1p(_A1 __lcpp_x) _NOEXCEPT {return log1p((double)__lcpp_x);}
|
||||
log1p(_A1 __lcpp_x) _NOEXCEPT {return ::log1p((double)__lcpp_x);}
|
||||
|
||||
// log2
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return log2f(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return log2l(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return ::log2f(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);}
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
log2(_A1 __lcpp_x) _NOEXCEPT {return log2((double)__lcpp_x);}
|
||||
log2(_A1 __lcpp_x) _NOEXCEPT {return ::log2((double)__lcpp_x);}
|
||||
|
||||
// logb
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY float logb(float __lcpp_x) _NOEXCEPT {return logbf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return logbl(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float logb(float __lcpp_x) _NOEXCEPT {return ::logbf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return ::logbl(__lcpp_x);}
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
logb(_A1 __lcpp_x) _NOEXCEPT {return logb((double)__lcpp_x);}
|
||||
logb(_A1 __lcpp_x) _NOEXCEPT {return ::logb((double)__lcpp_x);}
|
||||
|
||||
// lrint
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT {return lrintf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT {return lrintl(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT {return ::lrintf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT {return ::lrintl(__lcpp_x);}
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, long>::type
|
||||
lrint(_A1 __lcpp_x) _NOEXCEPT {return lrint((double)__lcpp_x);}
|
||||
lrint(_A1 __lcpp_x) _NOEXCEPT {return ::lrint((double)__lcpp_x);}
|
||||
|
||||
// lround
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT {return lroundf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT {return lroundl(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT {return ::lroundf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT {return ::lroundl(__lcpp_x);}
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, long>::type
|
||||
lround(_A1 __lcpp_x) _NOEXCEPT {return lround((double)__lcpp_x);}
|
||||
lround(_A1 __lcpp_x) _NOEXCEPT {return ::lround((double)__lcpp_x);}
|
||||
|
||||
// nan
|
||||
|
||||
// nearbyint
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __lcpp_x) _NOEXCEPT {return nearbyintf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return nearbyintl(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __lcpp_x) _NOEXCEPT {return ::nearbyintf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return ::nearbyintl(__lcpp_x);}
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
nearbyint(_A1 __lcpp_x) _NOEXCEPT {return nearbyint((double)__lcpp_x);}
|
||||
nearbyint(_A1 __lcpp_x) _NOEXCEPT {return ::nearbyint((double)__lcpp_x);}
|
||||
|
||||
// nextafter
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return nextafterf(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nextafterl(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::nextafterf(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nextafterl(__lcpp_x, __lcpp_y);}
|
||||
|
||||
template <class _A1, class _A2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@ -1286,23 +1294,23 @@ nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
|
||||
typedef typename std::__promote<_A1, _A2>::type __result_type;
|
||||
static_assert((!(std::is_same<_A1, __result_type>::value &&
|
||||
std::is_same<_A2, __result_type>::value)), "");
|
||||
return nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);
|
||||
return ::nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);
|
||||
}
|
||||
|
||||
// nexttoward
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nexttowardf(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nexttowardl(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardf(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardl(__lcpp_x, __lcpp_y);}
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nexttoward((double)__lcpp_x, __lcpp_y);}
|
||||
nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttoward((double)__lcpp_x, __lcpp_y);}
|
||||
|
||||
// remainder
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return remainderf(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return remainderl(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::remainderf(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::remainderl(__lcpp_x, __lcpp_y);}
|
||||
|
||||
template <class _A1, class _A2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@ -1317,13 +1325,13 @@ remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
|
||||
typedef typename std::__promote<_A1, _A2>::type __result_type;
|
||||
static_assert((!(std::is_same<_A1, __result_type>::value &&
|
||||
std::is_same<_A2, __result_type>::value)), "");
|
||||
return remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);
|
||||
return ::remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);
|
||||
}
|
||||
|
||||
// remquo
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT {return remquof(__lcpp_x, __lcpp_y, __lcpp_z);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __lcpp_x, long double __lcpp_y, int* __lcpp_z) _NOEXCEPT {return remquol(__lcpp_x, __lcpp_y, __lcpp_z);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquof(__lcpp_x, __lcpp_y, __lcpp_z);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __lcpp_x, long double __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquol(__lcpp_x, __lcpp_y, __lcpp_z);}
|
||||
|
||||
template <class _A1, class _A2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@ -1338,70 +1346,68 @@ remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT
|
||||
typedef typename std::__promote<_A1, _A2>::type __result_type;
|
||||
static_assert((!(std::is_same<_A1, __result_type>::value &&
|
||||
std::is_same<_A2, __result_type>::value)), "");
|
||||
return remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);
|
||||
return ::remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);
|
||||
}
|
||||
|
||||
// rint
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY float rint(float __lcpp_x) _NOEXCEPT {return rintf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT {return rintl(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float rint(float __lcpp_x) _NOEXCEPT {return ::rintf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT {return ::rintl(__lcpp_x);}
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
rint(_A1 __lcpp_x) _NOEXCEPT {return rint((double)__lcpp_x);}
|
||||
rint(_A1 __lcpp_x) _NOEXCEPT {return ::rint((double)__lcpp_x);}
|
||||
|
||||
// round
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT {return roundf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT {return roundl(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT {return ::roundf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT {return ::roundl(__lcpp_x);}
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
round(_A1 __lcpp_x) _NOEXCEPT {return round((double)__lcpp_x);}
|
||||
round(_A1 __lcpp_x) _NOEXCEPT {return ::round((double)__lcpp_x);}
|
||||
|
||||
// scalbln
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT {return scalblnf(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) _NOEXCEPT {return scalblnl(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnf(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnl(__lcpp_x, __lcpp_y);}
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return scalbln((double)__lcpp_x, __lcpp_y);}
|
||||
scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalbln((double)__lcpp_x, __lcpp_y);}
|
||||
|
||||
// scalbn
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return scalbnf(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return scalbnl(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnf(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnl(__lcpp_x, __lcpp_y);}
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return scalbn((double)__lcpp_x, __lcpp_y);}
|
||||
scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);}
|
||||
|
||||
// tgamma
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __lcpp_x) _NOEXCEPT {return tgammaf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return tgammal(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __lcpp_x) _NOEXCEPT {return ::tgammaf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return ::tgammal(__lcpp_x);}
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
tgamma(_A1 __lcpp_x) _NOEXCEPT {return tgamma((double)__lcpp_x);}
|
||||
tgamma(_A1 __lcpp_x) _NOEXCEPT {return ::tgamma((double)__lcpp_x);}
|
||||
|
||||
// trunc
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT {return truncf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT {return truncl(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT {return ::truncf(__lcpp_x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT {return ::truncl(__lcpp_x);}
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_integral<_A1>::value, double>::type
|
||||
trunc(_A1 __lcpp_x) _NOEXCEPT {return trunc((double)__lcpp_x);}
|
||||
|
||||
#endif // !_LIBCPP_MSVCRT
|
||||
trunc(_A1 __lcpp_x) _NOEXCEPT {return ::trunc((double)__lcpp_x);}
|
||||
|
||||
} // extern "C++"
|
||||
|
||||
|
1907
include/memory
1907
include/memory
File diff suppressed because it is too large
Load Diff
153
include/mutex
153
include/mutex
@ -109,15 +109,17 @@ public:
|
||||
lock_guard& operator=(lock_guard const&) = delete;
|
||||
};
|
||||
|
||||
template <class... MutexTypes> // Variadic lock_guard only provided in ABI V2.
|
||||
class lock_guard
|
||||
template <class... MutexTypes>
|
||||
class scoped_lock // C++17
|
||||
{
|
||||
public:
|
||||
explicit lock_guard(MutexTypes&... m);
|
||||
lock_guard(MutexTypes&... m, adopt_lock_t);
|
||||
~lock_guard();
|
||||
lock_guard(lock_guard const&) = delete;
|
||||
lock_guard& operator=(lock_guard const&) = delete;
|
||||
using mutex_type = Mutex; // If MutexTypes... consists of the single type Mutex
|
||||
|
||||
explicit scoped_lock(MutexTypes&... m);
|
||||
scoped_lock(MutexTypes&... m, adopt_lock_t);
|
||||
~scoped_lock();
|
||||
scoped_lock(scoped_lock const&) = delete;
|
||||
scoped_lock& operator=(scoped_lock const&) = delete;
|
||||
private:
|
||||
tuple<MutexTypes&...> pm; // exposition only
|
||||
};
|
||||
@ -248,6 +250,7 @@ public:
|
||||
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
|
||||
{return try_lock_until(chrono::steady_clock::now() + __d);}
|
||||
template <class _Clock, class _Duration>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
|
||||
void unlock() _NOEXCEPT;
|
||||
};
|
||||
@ -291,6 +294,7 @@ public:
|
||||
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
|
||||
{return try_lock_until(chrono::steady_clock::now() + __d);}
|
||||
template <class _Clock, class _Duration>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
|
||||
void unlock() _NOEXCEPT;
|
||||
};
|
||||
@ -464,6 +468,84 @@ void __unlock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) {
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
template <class ..._Mutexes>
|
||||
class _LIBCPP_TEMPLATE_VIS scoped_lock;
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TEMPLATE_VIS scoped_lock<> {
|
||||
public:
|
||||
explicit scoped_lock() {}
|
||||
~scoped_lock() = default;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit scoped_lock(adopt_lock_t) {}
|
||||
|
||||
scoped_lock(scoped_lock const&) = delete;
|
||||
scoped_lock& operator=(scoped_lock const&) = delete;
|
||||
};
|
||||
|
||||
template <class _Mutex>
|
||||
class _LIBCPP_TEMPLATE_VIS scoped_lock<_Mutex> {
|
||||
public:
|
||||
typedef _Mutex mutex_type;
|
||||
private:
|
||||
mutex_type& __m_;
|
||||
public:
|
||||
explicit scoped_lock(mutex_type & __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability(__m))
|
||||
: __m_(__m) {__m_.lock();}
|
||||
|
||||
~scoped_lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability()) {__m_.unlock();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit scoped_lock(mutex_type& __m, adopt_lock_t) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m))
|
||||
: __m_(__m) {}
|
||||
|
||||
|
||||
scoped_lock(scoped_lock const&) = delete;
|
||||
scoped_lock& operator=(scoped_lock const&) = delete;
|
||||
};
|
||||
|
||||
template <class ..._MArgs>
|
||||
class _LIBCPP_TEMPLATE_VIS scoped_lock
|
||||
{
|
||||
static_assert(sizeof...(_MArgs) > 1, "At least 2 lock types required");
|
||||
typedef tuple<_MArgs&...> _MutexTuple;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit scoped_lock(_MArgs&... __margs)
|
||||
: __t_(__margs...)
|
||||
{
|
||||
_VSTD::lock(__margs...);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
scoped_lock(_MArgs&... __margs, adopt_lock_t)
|
||||
: __t_(__margs...)
|
||||
{
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~scoped_lock() {
|
||||
typedef typename __make_tuple_indices<sizeof...(_MArgs)>::type _Indices;
|
||||
__unlock_unpack(_Indices{}, __t_);
|
||||
}
|
||||
|
||||
scoped_lock(scoped_lock const&) = delete;
|
||||
scoped_lock& operator=(scoped_lock const&) = delete;
|
||||
|
||||
private:
|
||||
template <size_t ..._Indx>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __unlock_unpack(__tuple_indices<_Indx...>, _MutexTuple& __mt) {
|
||||
_VSTD::__unlock(_VSTD::get<_Indx>(__mt)...);
|
||||
}
|
||||
|
||||
_MutexTuple __t_;
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 14
|
||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
struct _LIBCPP_TEMPLATE_VIS once_flag;
|
||||
@ -612,63 +694,6 @@ call_once(once_flag& __flag, const _Callable& __func)
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
|
||||
#if defined(_LIBCPP_ABI_VARIADIC_LOCK_GUARD) \
|
||||
&& !defined(_LIBCPP_CXX03_LANG)
|
||||
template <>
|
||||
class _LIBCPP_TEMPLATE_VIS lock_guard<> {
|
||||
public:
|
||||
explicit lock_guard() {}
|
||||
~lock_guard() = default;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit lock_guard(adopt_lock_t) {}
|
||||
|
||||
lock_guard(lock_guard const&) = delete;
|
||||
lock_guard& operator=(lock_guard const&) = delete;
|
||||
};
|
||||
|
||||
template <class ..._MArgs>
|
||||
class _LIBCPP_TEMPLATE_VIS lock_guard
|
||||
{
|
||||
static_assert(sizeof...(_MArgs) >= 2, "At least 2 lock types required");
|
||||
typedef tuple<_MArgs&...> _MutexTuple;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit lock_guard(_MArgs&... __margs)
|
||||
: __t_(__margs...)
|
||||
{
|
||||
_VSTD::lock(__margs...);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
lock_guard(_MArgs&... __margs, adopt_lock_t)
|
||||
: __t_(__margs...)
|
||||
{
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~lock_guard() {
|
||||
typedef typename __make_tuple_indices<sizeof...(_MArgs)>::type _Indices;
|
||||
__unlock_unpack(_Indices{}, __t_);
|
||||
}
|
||||
|
||||
lock_guard(lock_guard const&) = delete;
|
||||
lock_guard& operator=(lock_guard const&) = delete;
|
||||
|
||||
private:
|
||||
template <size_t ..._Indx>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __unlock_unpack(__tuple_indices<_Indx...>, _MutexTuple& __mt) {
|
||||
_VSTD::__unlock(_VSTD::get<_Indx>(__mt)...);
|
||||
}
|
||||
|
||||
_MutexTuple __t_;
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_ABI_VARIADIC_LOCK_GUARD
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_MUTEX
|
||||
|
26
include/new
26
include/new
@ -92,6 +92,10 @@ void operator delete[](void* ptr, void*) noexcept;
|
||||
#include <cstdlib>
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_ABI_MICROSOFT)
|
||||
#include <new.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
@ -110,6 +114,10 @@ void operator delete[](void* ptr, void*) noexcept;
|
||||
namespace std // purposefully not using versioning namespace
|
||||
{
|
||||
|
||||
#if !defined(_LIBCPP_ABI_MICROSOFT)
|
||||
struct _LIBCPP_TYPE_VIS nothrow_t {};
|
||||
extern _LIBCPP_FUNC_VIS const nothrow_t nothrow;
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI bad_alloc
|
||||
: public exception
|
||||
{
|
||||
@ -128,9 +136,15 @@ public:
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
typedef void (*new_handler)();
|
||||
_LIBCPP_FUNC_VIS new_handler set_new_handler(new_handler) _NOEXCEPT;
|
||||
_LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT;
|
||||
|
||||
#endif // !_LIBCPP_ABI_MICROSOFT
|
||||
|
||||
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_bad_alloc(); // not in C++ spec
|
||||
|
||||
#if defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11)
|
||||
#if defined(_LIBCPP_BUILDING_LIBRARY) || (_LIBCPP_STD_VER > 11)
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI bad_array_length
|
||||
: public bad_alloc
|
||||
@ -153,12 +167,6 @@ enum align_val_t { __zero = 0, __max = (size_t)-1 };
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct _LIBCPP_TYPE_VIS nothrow_t {};
|
||||
extern _LIBCPP_FUNC_VIS const nothrow_t nothrow;
|
||||
typedef void (*new_handler)();
|
||||
_LIBCPP_FUNC_VIS new_handler set_new_handler(new_handler) _NOEXCEPT;
|
||||
_LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT;
|
||||
|
||||
} // std
|
||||
|
||||
#if defined(_LIBCPP_CXX03_LANG)
|
||||
@ -167,6 +175,8 @@ _LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT;
|
||||
#define _THROW_BAD_ALLOC
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_ABI_MICROSOFT)
|
||||
|
||||
_LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz) _THROW_BAD_ALLOC;
|
||||
_LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
|
||||
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;
|
||||
@ -206,6 +216,8 @@ inline _LIBCPP_INLINE_VISIBILITY void* operator new[](std::size_t, void* __p) _N
|
||||
inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {}
|
||||
inline _LIBCPP_INLINE_VISIBILITY void operator delete[](void*, void*) _NOEXCEPT {}
|
||||
|
||||
#endif // !_LIBCPP_ABI_MICROSOFT
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY void *__allocate(size_t __size) {
|
||||
|
@ -65,6 +65,7 @@ template <class M, class N>
|
||||
|
||||
#include <__config>
|
||||
#include <iterator>
|
||||
#include <limits> // for numeric_limits
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
@ -200,18 +201,23 @@ iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value_)
|
||||
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
template <typename _Tp, bool _IsSigned = is_signed<_Tp>::value> struct __abs;
|
||||
template <typename _Result, typename _Source, bool _IsSigned = is_signed<_Source>::value> struct __abs;
|
||||
|
||||
template <typename _Tp>
|
||||
struct __abs<_Tp, true> {
|
||||
template <typename _Result, typename _Source>
|
||||
struct __abs<_Result, _Source, true> {
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
_Tp operator()(_Tp __t) const noexcept { return __t >= 0 ? __t : -__t; }
|
||||
_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 _Tp>
|
||||
struct __abs<_Tp, false> {
|
||||
template <typename _Result, typename _Source>
|
||||
struct __abs<_Result, _Source, false> {
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
_Tp operator()(_Tp __t) const noexcept { return __t; }
|
||||
_Result operator()(_Source __t) const noexcept { return __t; }
|
||||
};
|
||||
|
||||
|
||||
@ -219,7 +225,7 @@ template<class _Tp>
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
_Tp __gcd(_Tp __m, _Tp __n)
|
||||
{
|
||||
static_assert((!is_signed<_Tp>::value), "" );
|
||||
static_assert((!is_signed<_Tp>::value), "");
|
||||
return __n == 0 ? __m : __gcd<_Tp>(__n, __m % __n);
|
||||
}
|
||||
|
||||
@ -234,8 +240,8 @@ gcd(_Tp __m, _Up __n)
|
||||
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>(__gcd(static_cast<_Wp>(__abs<_Tp>()(__m)),
|
||||
static_cast<_Wp>(__abs<_Up>()(__n))));
|
||||
return static_cast<_Rp>(__gcd(static_cast<_Wp>(__abs<_Rp, _Tp>()(__m)),
|
||||
static_cast<_Wp>(__abs<_Rp, _Up>()(__n))));
|
||||
}
|
||||
|
||||
template<class _Tp, class _Up>
|
||||
@ -250,8 +256,8 @@ lcm(_Tp __m, _Up __n)
|
||||
return 0;
|
||||
|
||||
using _Rp = common_type_t<_Tp,_Up>;
|
||||
_Rp __val1 = __abs<_Tp>()(__m) / gcd(__m,__n);
|
||||
_Up __val2 = __abs<_Up>()(__n);
|
||||
_Rp __val1 = __abs<_Rp, _Tp>()(__m) / gcd(__m, __n);
|
||||
_Rp __val2 = __abs<_Rp, _Up>()(__n);
|
||||
_LIBCPP_ASSERT((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm");
|
||||
return __val1 * __val2;
|
||||
}
|
||||
|
130
include/optional
130
include/optional
@ -87,7 +87,7 @@ namespace std {
|
||||
constexpr optional() noexcept;
|
||||
constexpr optional(nullopt_t) noexcept;
|
||||
optional(const optional &);
|
||||
optional(optional &&) noexcept(see below );
|
||||
optional(optional &&) noexcept(see below);
|
||||
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 &&...);
|
||||
@ -108,9 +108,9 @@ namespace std {
|
||||
template <class U = T> optional &operator=(U &&);
|
||||
template <class U> optional &operator=(const optional<U> &);
|
||||
template <class U> optional &operator=(optional<U> &&);
|
||||
template <class... Args> void emplace(Args &&...);
|
||||
template <class... Args> T& emplace(Args &&...);
|
||||
template <class U, class... Args>
|
||||
void emplace(initializer_list<U>, Args &&...);
|
||||
T& emplace(initializer_list<U>, Args &&...);
|
||||
|
||||
// 20.6.3.4, swap
|
||||
void swap(optional &) noexcept(see below );
|
||||
@ -531,7 +531,7 @@ private:
|
||||
};
|
||||
template <class _Up>
|
||||
using _CheckOptionalArgsCtor = conditional_t<
|
||||
!is_same_v<in_place_t, _Up> &&
|
||||
!is_same_v<decay_t<_Up>, in_place_t> &&
|
||||
!is_same_v<decay_t<_Up>, optional>,
|
||||
_CheckOptionalArgsConstructor,
|
||||
__check_tuple_constructor_fail
|
||||
@ -729,11 +729,12 @@ public:
|
||||
>
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
_Tp &
|
||||
emplace(_Args&&... __args)
|
||||
{
|
||||
reset();
|
||||
this->__construct(_VSTD::forward<_Args>(__args)...);
|
||||
return this->__get();
|
||||
}
|
||||
|
||||
template <class _Up, class... _Args,
|
||||
@ -743,11 +744,12 @@ public:
|
||||
>
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
_Tp &
|
||||
emplace(initializer_list<_Up> __il, _Args&&... __args)
|
||||
{
|
||||
reset();
|
||||
this->__construct(__il, _VSTD::forward<_Args>(__args)...);
|
||||
return this->__get();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -921,14 +923,14 @@ private:
|
||||
};
|
||||
|
||||
// Comparisons between optionals
|
||||
template <class _Tp>
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<
|
||||
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() ==
|
||||
_VSTD::declval<const _Tp&>()), bool>,
|
||||
_VSTD::declval<const _Up&>()), bool>,
|
||||
bool
|
||||
>
|
||||
operator==(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||
operator==(const optional<_Tp>& __x, const optional<_Up>& __y)
|
||||
{
|
||||
if (static_cast<bool>(__x) != static_cast<bool>(__y))
|
||||
return false;
|
||||
@ -937,14 +939,14 @@ operator==(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||
return *__x == *__y;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<
|
||||
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() !=
|
||||
_VSTD::declval<const _Tp&>()), bool>,
|
||||
_VSTD::declval<const _Up&>()), bool>,
|
||||
bool
|
||||
>
|
||||
operator!=(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||
operator!=(const optional<_Tp>& __x, const optional<_Up>& __y)
|
||||
{
|
||||
if (static_cast<bool>(__x) != static_cast<bool>(__y))
|
||||
return true;
|
||||
@ -953,14 +955,14 @@ operator!=(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||
return *__x != *__y;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<
|
||||
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <
|
||||
_VSTD::declval<const _Tp&>()), bool>,
|
||||
_VSTD::declval<const _Up&>()), bool>,
|
||||
bool
|
||||
>
|
||||
operator<(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||
operator<(const optional<_Tp>& __x, const optional<_Up>& __y)
|
||||
{
|
||||
if (!static_cast<bool>(__y))
|
||||
return false;
|
||||
@ -969,14 +971,14 @@ operator<(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||
return *__x < *__y;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<
|
||||
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >
|
||||
_VSTD::declval<const _Tp&>()), bool>,
|
||||
_VSTD::declval<const _Up&>()), bool>,
|
||||
bool
|
||||
>
|
||||
operator>(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||
operator>(const optional<_Tp>& __x, const optional<_Up>& __y)
|
||||
{
|
||||
if (!static_cast<bool>(__x))
|
||||
return false;
|
||||
@ -985,14 +987,14 @@ operator>(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||
return *__x > *__y;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<
|
||||
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <=
|
||||
_VSTD::declval<const _Tp&>()), bool>,
|
||||
_VSTD::declval<const _Up&>()), bool>,
|
||||
bool
|
||||
>
|
||||
operator<=(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||
operator<=(const optional<_Tp>& __x, const optional<_Up>& __y)
|
||||
{
|
||||
if (!static_cast<bool>(__x))
|
||||
return true;
|
||||
@ -1001,14 +1003,14 @@ operator<=(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||
return *__x <= *__y;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<
|
||||
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >=
|
||||
_VSTD::declval<const _Tp&>()), bool>,
|
||||
_VSTD::declval<const _Up&>()), bool>,
|
||||
bool
|
||||
>
|
||||
operator>=(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
||||
operator>=(const optional<_Tp>& __x, const optional<_Up>& __y)
|
||||
{
|
||||
if (!static_cast<bool>(__y))
|
||||
return true;
|
||||
@ -1115,146 +1117,146 @@ operator>=(nullopt_t, const optional<_Tp>& __x) noexcept
|
||||
}
|
||||
|
||||
// Comparisons with T
|
||||
template <class _Tp>
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<
|
||||
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() ==
|
||||
_VSTD::declval<const _Tp&>()), bool>,
|
||||
_VSTD::declval<const _Up&>()), bool>,
|
||||
bool
|
||||
>
|
||||
operator==(const optional<_Tp>& __x, const _Tp& __v)
|
||||
operator==(const optional<_Tp>& __x, const _Up& __v)
|
||||
{
|
||||
return static_cast<bool>(__x) ? *__x == __v : false;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<
|
||||
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() ==
|
||||
_VSTD::declval<const _Tp&>()), bool>,
|
||||
_VSTD::declval<const _Up&>()), bool>,
|
||||
bool
|
||||
>
|
||||
operator==(const _Tp& __v, const optional<_Tp>& __x)
|
||||
operator==(const _Tp& __v, const optional<_Up>& __x)
|
||||
{
|
||||
return static_cast<bool>(__x) ? __v == *__x : false;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<
|
||||
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() !=
|
||||
_VSTD::declval<const _Tp&>()), bool>,
|
||||
_VSTD::declval<const _Up&>()), bool>,
|
||||
bool
|
||||
>
|
||||
operator!=(const optional<_Tp>& __x, const _Tp& __v)
|
||||
operator!=(const optional<_Tp>& __x, const _Up& __v)
|
||||
{
|
||||
return static_cast<bool>(__x) ? *__x != __v : true;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<
|
||||
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() !=
|
||||
_VSTD::declval<const _Tp&>()), bool>,
|
||||
_VSTD::declval<const _Up&>()), bool>,
|
||||
bool
|
||||
>
|
||||
operator!=(const _Tp& __v, const optional<_Tp>& __x)
|
||||
operator!=(const _Tp& __v, const optional<_Up>& __x)
|
||||
{
|
||||
return static_cast<bool>(__x) ? __v != *__x : true;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<
|
||||
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <
|
||||
_VSTD::declval<const _Tp&>()), bool>,
|
||||
_VSTD::declval<const _Up&>()), bool>,
|
||||
bool
|
||||
>
|
||||
operator<(const optional<_Tp>& __x, const _Tp& __v)
|
||||
operator<(const optional<_Tp>& __x, const _Up& __v)
|
||||
{
|
||||
return static_cast<bool>(__x) ? *__x < __v : true;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<
|
||||
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <
|
||||
_VSTD::declval<const _Tp&>()), bool>,
|
||||
_VSTD::declval<const _Up&>()), bool>,
|
||||
bool
|
||||
>
|
||||
operator<(const _Tp& __v, const optional<_Tp>& __x)
|
||||
operator<(const _Tp& __v, const optional<_Up>& __x)
|
||||
{
|
||||
return static_cast<bool>(__x) ? __v < *__x : false;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<
|
||||
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <=
|
||||
_VSTD::declval<const _Tp&>()), bool>,
|
||||
_VSTD::declval<const _Up&>()), bool>,
|
||||
bool
|
||||
>
|
||||
operator<=(const optional<_Tp>& __x, const _Tp& __v)
|
||||
operator<=(const optional<_Tp>& __x, const _Up& __v)
|
||||
{
|
||||
return static_cast<bool>(__x) ? *__x <= __v : true;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<
|
||||
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <=
|
||||
_VSTD::declval<const _Tp&>()), bool>,
|
||||
_VSTD::declval<const _Up&>()), bool>,
|
||||
bool
|
||||
>
|
||||
operator<=(const _Tp& __v, const optional<_Tp>& __x)
|
||||
operator<=(const _Tp& __v, const optional<_Up>& __x)
|
||||
{
|
||||
return static_cast<bool>(__x) ? __v <= *__x : false;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<
|
||||
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >
|
||||
_VSTD::declval<const _Tp&>()), bool>,
|
||||
_VSTD::declval<const _Up&>()), bool>,
|
||||
bool
|
||||
>
|
||||
operator>(const optional<_Tp>& __x, const _Tp& __v)
|
||||
operator>(const optional<_Tp>& __x, const _Up& __v)
|
||||
{
|
||||
return static_cast<bool>(__x) ? *__x > __v : false;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<
|
||||
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >
|
||||
_VSTD::declval<const _Tp&>()), bool>,
|
||||
_VSTD::declval<const _Up&>()), bool>,
|
||||
bool
|
||||
>
|
||||
operator>(const _Tp& __v, const optional<_Tp>& __x)
|
||||
operator>(const _Tp& __v, const optional<_Up>& __x)
|
||||
{
|
||||
return static_cast<bool>(__x) ? __v > *__x : true;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<
|
||||
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >=
|
||||
_VSTD::declval<const _Tp&>()), bool>,
|
||||
_VSTD::declval<const _Up&>()), bool>,
|
||||
bool
|
||||
>
|
||||
operator>=(const optional<_Tp>& __x, const _Tp& __v)
|
||||
operator>=(const optional<_Tp>& __x, const _Up& __v)
|
||||
{
|
||||
return static_cast<bool>(__x) ? *__x >= __v : false;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<
|
||||
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >=
|
||||
_VSTD::declval<const _Tp&>()), bool>,
|
||||
_VSTD::declval<const _Up&>()), bool>,
|
||||
bool
|
||||
>
|
||||
operator>=(const _Tp& __v, const optional<_Tp>& __x)
|
||||
operator>=(const _Tp& __v, const optional<_Up>& __x)
|
||||
{
|
||||
return static_cast<bool>(__x) ? __v >= *__x : true;
|
||||
}
|
||||
@ -1293,15 +1295,17 @@ optional<_Tp> make_optional(initializer_list<_Up> __il, _Args&&... __args)
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<optional<_Tp> >
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<
|
||||
__enable_hash_helper<optional<_Tp>, remove_const_t<_Tp>>
|
||||
>
|
||||
{
|
||||
typedef optional<_Tp> argument_type;
|
||||
typedef size_t result_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
result_type operator()(const argument_type& __opt) const _NOEXCEPT
|
||||
result_type operator()(const argument_type& __opt) const
|
||||
{
|
||||
return static_cast<bool>(__opt) ? hash<_Tp>()(*__opt) : 0;
|
||||
return static_cast<bool>(__opt) ? hash<remove_const_t<_Tp>>()(*__opt) : 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -3957,7 +3957,6 @@ basic_regex<_CharT, _Traits>::__parse_equivalence_class(_ForwardIterator __first
|
||||
if (__temp == __last)
|
||||
__throw_regex_error<regex_constants::error_brack>();
|
||||
// [__first, __temp) contains all text in [= ... =]
|
||||
typedef typename _Traits::string_type string_type;
|
||||
string_type __collate_name =
|
||||
__traits_.lookup_collatename(__first, __temp);
|
||||
if (__collate_name.empty())
|
||||
|
@ -175,7 +175,7 @@ struct _LIBCPP_TYPE_VIS __shared_mutex_base
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
class _LIBCPP_TYPE_VIS shared_mutex
|
||||
{
|
||||
__shared_mutex_base __base;
|
||||
__shared_mutex_base __base;
|
||||
public:
|
||||
shared_mutex() : __base() {}
|
||||
_LIBCPP_INLINE_VISIBILITY ~shared_mutex() = default;
|
||||
@ -201,7 +201,7 @@ public:
|
||||
|
||||
class _LIBCPP_TYPE_VIS shared_timed_mutex
|
||||
{
|
||||
__shared_mutex_base __base;
|
||||
__shared_mutex_base __base;
|
||||
public:
|
||||
shared_timed_mutex();
|
||||
_LIBCPP_INLINE_VISIBILITY ~shared_timed_mutex() = default;
|
||||
@ -220,6 +220,7 @@ public:
|
||||
return try_lock_until(chrono::steady_clock::now() + __rel_time);
|
||||
}
|
||||
template <class _Clock, class _Duration>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
bool
|
||||
try_lock_until(const chrono::time_point<_Clock, _Duration>& __abs_time);
|
||||
void unlock();
|
||||
@ -235,6 +236,7 @@ public:
|
||||
return try_lock_shared_until(chrono::steady_clock::now() + __rel_time);
|
||||
}
|
||||
template <class _Clock, class _Duration>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
bool
|
||||
try_lock_shared_until(const chrono::time_point<_Clock, _Duration>& __abs_time);
|
||||
void unlock_shared();
|
||||
|
@ -53,7 +53,8 @@ using std::nullptr_t;
|
||||
}
|
||||
|
||||
// Re-use the compiler's <stddef.h> max_align_t where possible.
|
||||
#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T)
|
||||
#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T) && \
|
||||
!defined(__DEFINED_max_align_t)
|
||||
typedef long double max_align_t;
|
||||
#endif
|
||||
|
||||
|
170
include/string
170
include/string
@ -637,7 +637,7 @@ public:
|
||||
typedef basic_string __self;
|
||||
typedef basic_string_view<_CharT, _Traits> __self_view;
|
||||
typedef _Traits traits_type;
|
||||
typedef typename traits_type::char_type value_type;
|
||||
typedef _CharT value_type;
|
||||
typedef _Allocator allocator_type;
|
||||
typedef allocator_traits<allocator_type> __alloc_traits;
|
||||
typedef typename __alloc_traits::size_type size_type;
|
||||
@ -648,7 +648,7 @@ public:
|
||||
typedef typename __alloc_traits::const_pointer const_pointer;
|
||||
|
||||
static_assert(is_pod<value_type>::value, "Character type of basic_string must be a POD");
|
||||
static_assert((is_same<_CharT, value_type>::value),
|
||||
static_assert((is_same<_CharT, typename traits_type::char_type>::value),
|
||||
"traits_type::char_type must be the same type as CharT");
|
||||
static_assert((is_same<typename allocator_type::value_type, value_type>::value),
|
||||
"Allocator::value_type must be same type as value_type");
|
||||
@ -775,30 +775,31 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(basic_string&& __str, const allocator_type& __a);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY basic_string(const value_type* __s);
|
||||
_LIBCPP_INLINE_VISIBILITY basic_string(const _CharT* __s);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(const value_type* __s, const allocator_type& __a);
|
||||
basic_string(const _CharT* __s, const _Allocator& __a);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(const value_type* __s, size_type __n);
|
||||
basic_string(const _CharT* __s, size_type __n);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(const value_type* __s, size_type __n, const allocator_type& __a);
|
||||
basic_string(const _CharT* __s, size_type __n, const _Allocator& __a);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(size_type __n, value_type __c);
|
||||
basic_string(size_type __n, _CharT __c);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(size_type __n, value_type __c, const allocator_type& __a);
|
||||
basic_string(size_type __n, _CharT __c, const _Allocator& __a);
|
||||
basic_string(const basic_string& __str, size_type __pos, size_type __n,
|
||||
const allocator_type& __a = allocator_type());
|
||||
const _Allocator& __a = _Allocator());
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(const basic_string& __str, size_type __pos,
|
||||
const allocator_type& __a = allocator_type());
|
||||
const _Allocator& __a = _Allocator());
|
||||
template<class _Tp>
|
||||
basic_string(const _Tp& __t, size_type __pos, size_type __n,
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
basic_string(const _Tp& __t, size_type __pos, size_type __n,
|
||||
const allocator_type& __a = allocator_type(),
|
||||
typename enable_if<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, void>::type* = 0);
|
||||
_LIBCPP_INLINE_VISIBILITY explicit
|
||||
basic_string(__self_view __sv);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(__self_view __sv, const allocator_type& __a);
|
||||
basic_string(__self_view __sv, const _Allocator& __a);
|
||||
template<class _InputIterator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(_InputIterator __first, _InputIterator __last);
|
||||
@ -807,9 +808,9 @@ public:
|
||||
basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a);
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(initializer_list<value_type> __il);
|
||||
basic_string(initializer_list<_CharT> __il);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(initializer_list<value_type> __il, const allocator_type& __a);
|
||||
basic_string(initializer_list<_CharT> __il, const _Allocator& __a);
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
inline ~basic_string();
|
||||
@ -927,7 +928,8 @@ public:
|
||||
basic_string& append(__self_view __sv) { return append(__sv.data(), __sv.size()); }
|
||||
basic_string& append(const basic_string& __str, size_type __pos, size_type __n=npos);
|
||||
template <class _Tp>
|
||||
typename enable_if
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
typename enable_if
|
||||
<
|
||||
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||
basic_string&
|
||||
@ -937,9 +939,11 @@ public:
|
||||
basic_string& append(const value_type* __s);
|
||||
basic_string& append(size_type __n, value_type __c);
|
||||
template <class _ForwardIterator>
|
||||
inline basic_string& __append_forward_unsafe(_ForwardIterator, _ForwardIterator);
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
basic_string& __append_forward_unsafe(_ForwardIterator, _ForwardIterator);
|
||||
template<class _InputIterator>
|
||||
typename enable_if
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
typename enable_if
|
||||
<
|
||||
__is_exactly_input_iterator<_InputIterator>::value
|
||||
|| !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
|
||||
@ -952,7 +956,8 @@ public:
|
||||
return *this;
|
||||
}
|
||||
template<class _ForwardIterator>
|
||||
typename enable_if
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
typename enable_if
|
||||
<
|
||||
__is_forward_iterator<_ForwardIterator>::value
|
||||
&& __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
|
||||
@ -988,7 +993,8 @@ public:
|
||||
#endif
|
||||
basic_string& assign(const basic_string& __str, size_type __pos, size_type __n=npos);
|
||||
template <class _Tp>
|
||||
typename enable_if
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
typename enable_if
|
||||
<
|
||||
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||
basic_string&
|
||||
@ -998,7 +1004,8 @@ public:
|
||||
basic_string& assign(const value_type* __s);
|
||||
basic_string& assign(size_type __n, value_type __c);
|
||||
template<class _InputIterator>
|
||||
typename enable_if
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
typename enable_if
|
||||
<
|
||||
__is_exactly_input_iterator<_InputIterator>::value
|
||||
|| !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
|
||||
@ -1006,7 +1013,8 @@ public:
|
||||
>::type
|
||||
assign(_InputIterator __first, _InputIterator __last);
|
||||
template<class _ForwardIterator>
|
||||
typename enable_if
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
typename enable_if
|
||||
<
|
||||
__is_forward_iterator<_ForwardIterator>::value
|
||||
&& __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
|
||||
@ -1023,7 +1031,8 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string& insert(size_type __pos1, __self_view __sv) { return insert(__pos1, __sv.data(), __sv.size()); }
|
||||
template <class _Tp>
|
||||
typename enable_if
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
typename enable_if
|
||||
<
|
||||
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||
basic_string&
|
||||
@ -1037,7 +1046,8 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __pos, size_type __n, value_type __c);
|
||||
template<class _InputIterator>
|
||||
typename enable_if
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
typename enable_if
|
||||
<
|
||||
__is_exactly_input_iterator<_InputIterator>::value
|
||||
|| !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
|
||||
@ -1045,7 +1055,8 @@ public:
|
||||
>::type
|
||||
insert(const_iterator __pos, _InputIterator __first, _InputIterator __last);
|
||||
template<class _ForwardIterator>
|
||||
typename enable_if
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
typename enable_if
|
||||
<
|
||||
__is_forward_iterator<_ForwardIterator>::value
|
||||
&& __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
|
||||
@ -1070,7 +1081,8 @@ public:
|
||||
basic_string& replace(size_type __pos1, size_type __n1, __self_view __sv) { return replace(__pos1, __n1, __sv.data(), __sv.size()); }
|
||||
basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2=npos);
|
||||
template <class _Tp>
|
||||
typename enable_if
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
typename enable_if
|
||||
<
|
||||
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
|
||||
basic_string&
|
||||
@ -1090,7 +1102,8 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string& replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c);
|
||||
template<class _InputIterator>
|
||||
typename enable_if
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
typename enable_if
|
||||
<
|
||||
__is_input_iterator<_InputIterator>::value,
|
||||
basic_string&
|
||||
@ -1325,15 +1338,15 @@ private:
|
||||
__align_it<sizeof(value_type) < __alignment ?
|
||||
__alignment/sizeof(value_type) : 1 > (__s+1)) - 1;}
|
||||
|
||||
inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
|
||||
inline
|
||||
void __init(const value_type* __s, size_type __sz, size_type __reserve);
|
||||
inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
|
||||
inline
|
||||
void __init(const value_type* __s, size_type __sz);
|
||||
inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
|
||||
inline
|
||||
void __init(size_type __n, value_type __c);
|
||||
|
||||
template <class _InputIterator>
|
||||
inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
|
||||
inline
|
||||
typename enable_if
|
||||
<
|
||||
__is_exactly_input_iterator<_InputIterator>::value,
|
||||
@ -1342,7 +1355,7 @@ private:
|
||||
__init(_InputIterator __first, _InputIterator __last);
|
||||
|
||||
template <class _ForwardIterator>
|
||||
inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
|
||||
inline
|
||||
typename enable_if
|
||||
<
|
||||
__is_forward_iterator<_ForwardIterator>::value,
|
||||
@ -1367,12 +1380,28 @@ private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __copy_assign_alloc(const basic_string& __str, true_type)
|
||||
{
|
||||
if (__alloc() != __str.__alloc())
|
||||
if (__alloc() == __str.__alloc())
|
||||
__alloc() = __str.__alloc();
|
||||
else
|
||||
{
|
||||
clear();
|
||||
shrink_to_fit();
|
||||
if (!__str.__is_long())
|
||||
{
|
||||
clear();
|
||||
shrink_to_fit();
|
||||
__alloc() = __str.__alloc();
|
||||
}
|
||||
else
|
||||
{
|
||||
allocator_type __a = __str.__alloc();
|
||||
pointer __p = __alloc_traits::allocate(__a, __str.__get_long_cap());
|
||||
clear();
|
||||
shrink_to_fit();
|
||||
__alloc() = _VSTD::move(__a);
|
||||
__set_long_pointer(__p);
|
||||
__set_long_cap(__str.__get_long_cap());
|
||||
__set_long_size(__str.size());
|
||||
}
|
||||
}
|
||||
__alloc() = __str.__alloc();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -1482,7 +1511,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __
|
||||
#else
|
||||
_NOEXCEPT
|
||||
#endif
|
||||
: __r_(__a)
|
||||
: __r_(__second_tag(), __a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
__get_db()->__insert_c(this);
|
||||
@ -1541,7 +1570,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_ty
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s)
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s)
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr");
|
||||
__init(__s, traits_type::length(__s));
|
||||
@ -1552,8 +1581,8 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s)
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, const allocator_type& __a)
|
||||
: __r_(__a)
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const _Allocator& __a)
|
||||
: __r_(__second_tag(), __a)
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*, allocator) detected nullptr");
|
||||
__init(__s, traits_type::length(__s));
|
||||
@ -1564,7 +1593,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, c
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, size_type __n)
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n)
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr");
|
||||
__init(__s, __n);
|
||||
@ -1575,8 +1604,8 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, s
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, size_type __n, const allocator_type& __a)
|
||||
: __r_(__a)
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n, const _Allocator& __a)
|
||||
: __r_(__second_tag(), __a)
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr");
|
||||
__init(__s, __n);
|
||||
@ -1587,7 +1616,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, s
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str)
|
||||
: __r_(__alloc_traits::select_on_container_copy_construction(__str.__alloc()))
|
||||
: __r_(__second_tag(), __alloc_traits::select_on_container_copy_construction(__str.__alloc()))
|
||||
{
|
||||
if (!__str.__is_long())
|
||||
__r_.first().__r = __str.__r_.first().__r;
|
||||
@ -1599,8 +1628,9 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, const allocator_type& __a)
|
||||
: __r_(__a)
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(
|
||||
const basic_string& __str, const allocator_type& __a)
|
||||
: __r_(__second_tag(), __a)
|
||||
{
|
||||
if (!__str.__is_long())
|
||||
__r_.first().__r = __str.__r_.first().__r;
|
||||
@ -1634,7 +1664,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str)
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, const allocator_type& __a)
|
||||
: __r_(__a)
|
||||
: __r_(__second_tag(), __a)
|
||||
{
|
||||
if (__str.__is_long() && __a != __str.__alloc()) // copy, not move
|
||||
__init(_VSTD::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size());
|
||||
@ -1678,7 +1708,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c)
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, value_type __c)
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c)
|
||||
{
|
||||
__init(__n, __c);
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
@ -1688,8 +1718,8 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, value_typ
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, value_type __c, const allocator_type& __a)
|
||||
: __r_(__a)
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c, const _Allocator& __a)
|
||||
: __r_(__second_tag(), __a)
|
||||
{
|
||||
__init(__n, __c);
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
@ -1698,9 +1728,10 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, value_typ
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos, size_type __n,
|
||||
const allocator_type& __a)
|
||||
: __r_(__a)
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str,
|
||||
size_type __pos, size_type __n,
|
||||
const _Allocator& __a)
|
||||
: __r_(__second_tag(), __a)
|
||||
{
|
||||
size_type __str_sz = __str.size();
|
||||
if (__pos > __str_sz)
|
||||
@ -1714,8 +1745,8 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos,
|
||||
const allocator_type& __a)
|
||||
: __r_(__a)
|
||||
const _Allocator& __a)
|
||||
: __r_(__second_tag(), __a)
|
||||
{
|
||||
size_type __str_sz = __str.size();
|
||||
if (__pos > __str_sz)
|
||||
@ -1731,13 +1762,13 @@ template <class _Tp>
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(
|
||||
const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a,
|
||||
typename enable_if<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, void>::type *)
|
||||
: __r_(__a)
|
||||
: __r_(__second_tag(), __a)
|
||||
{
|
||||
__self_view __sv = __self_view(__t).substr(__pos, __n);
|
||||
__init(__sv.data(), __sv.size());
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
@ -1752,8 +1783,8 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(__self_view __sv)
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(__self_view __sv, const allocator_type& __a)
|
||||
: __r_(__a)
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(__self_view __sv, const _Allocator& __a)
|
||||
: __r_(__second_tag(), __a)
|
||||
{
|
||||
__init(__sv.data(), __sv.size());
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
@ -1835,7 +1866,7 @@ template<class _InputIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last,
|
||||
const allocator_type& __a)
|
||||
: __r_(__a)
|
||||
: __r_(__second_tag(), __a)
|
||||
{
|
||||
__init(__first, __last);
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
@ -1847,7 +1878,8 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first,
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(initializer_list<value_type> __il)
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(
|
||||
initializer_list<_CharT> __il)
|
||||
{
|
||||
__init(__il.begin(), __il.end());
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
@ -1857,8 +1889,10 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(initializer_list<value_t
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(initializer_list<value_type> __il, const allocator_type& __a)
|
||||
: __r_(__a)
|
||||
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(
|
||||
initializer_list<_CharT> __il, const _Allocator& __a)
|
||||
: __r_(__second_tag(), __a)
|
||||
{
|
||||
__init(__il.begin(), __il.end());
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
@ -2242,7 +2276,9 @@ basic_string<_CharT, _Traits, _Allocator>::__append_forward_unsafe(
|
||||
size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
|
||||
if (__n)
|
||||
{
|
||||
if ( __ptr_in_range(&*__first, data(), data() + size()))
|
||||
typedef typename iterator_traits<_ForwardIterator>::reference _CharRef;
|
||||
_CharRef __tmp_ref = *__first;
|
||||
if (__ptr_in_range(_VSTD::addressof(__tmp_ref), data(), data() + size()))
|
||||
{
|
||||
const basic_string __temp (__first, __last, __alloc());
|
||||
append(__temp.data(), __temp.size());
|
||||
@ -2406,7 +2442,9 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _Forward
|
||||
size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
|
||||
if (__n)
|
||||
{
|
||||
if ( __ptr_in_range(&*__first, data(), data() + size()))
|
||||
typedef typename iterator_traits<_ForwardIterator>::reference _CharRef;
|
||||
_CharRef __tmp_char = *__first;
|
||||
if (__ptr_in_range(_VSTD::addressof(__tmp_char), data(), data() + size()))
|
||||
{
|
||||
const basic_string __temp(__first, __last, __alloc());
|
||||
return insert(__pos, __temp.data(), __temp.data() + __temp.size());
|
||||
@ -2526,6 +2564,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, size_typ
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator>&
|
||||
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2)
|
||||
_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
|
||||
{
|
||||
_LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::replace received nullptr");
|
||||
size_type __sz = size();
|
||||
@ -2565,6 +2604,8 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
|
||||
}
|
||||
traits_type::move(__p + __pos, __s, __n2);
|
||||
__finish:
|
||||
// __sz += __n2 - __n1; in this and the below function below can cause unsigned integer overflow,
|
||||
// but this is a safe operation, so we disable the check.
|
||||
__sz += __n2 - __n1;
|
||||
__set_size(__sz);
|
||||
__invalidate_iterators_past(__sz);
|
||||
@ -2578,6 +2619,7 @@ __finish:
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator>&
|
||||
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, size_type __n2, value_type __c)
|
||||
_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
|
||||
{
|
||||
size_type __sz = size();
|
||||
if (__pos > __sz)
|
||||
|
@ -199,6 +199,10 @@ public:
|
||||
typedef ptrdiff_t difference_type;
|
||||
static _LIBCPP_CONSTEXPR const size_type npos = -1; // size_type(-1);
|
||||
|
||||
static_assert(is_pod<value_type>::value, "Character type of basic_string_view must be a POD");
|
||||
static_assert((is_same<_CharT, typename traits_type::char_type>::value),
|
||||
"traits_type::char_type must be the same type as CharT");
|
||||
|
||||
// [string.view.cons], construct/copy
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string_view() _NOEXCEPT : __data (nullptr), __size(0) {}
|
||||
@ -206,7 +210,7 @@ public:
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string_view(const basic_string_view&) _NOEXCEPT = default;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string_view& operator=(const basic_string_view&) _NOEXCEPT = default;
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
@ -235,16 +239,16 @@ public:
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cend() const _NOEXCEPT { return __data + __size; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX14 _LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX14 _LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(cbegin()); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX14 _LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX14 _LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crend() const _NOEXCEPT { return const_reverse_iterator(cbegin()); }
|
||||
|
||||
// [string.view.capacity], capacity
|
||||
|
23
include/support/fuchsia/xlocale.h
Normal file
23
include/support/fuchsia/xlocale.h
Normal file
@ -0,0 +1,23 @@
|
||||
// -*- C++ -*-
|
||||
//===------------------- support/fuchsia/xlocale.h ------------------------===//
|
||||
//
|
||||
// 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_SUPPORT_FUCHSIA_XLOCALE_H
|
||||
#define _LIBCPP_SUPPORT_FUCHSIA_XLOCALE_H
|
||||
|
||||
#if defined(__Fuchsia__)
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cwchar>
|
||||
#include <support/xlocale/__posix_l_fallback.h>
|
||||
#include <support/xlocale/__strtonum_fallback.h>
|
||||
|
||||
#endif // defined(__Fuchsia__)
|
||||
|
||||
#endif // _LIBCPP_SUPPORT_FUCHSIA_XLOCALE_H
|
@ -11,13 +11,6 @@
|
||||
#ifndef _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
|
||||
#define _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
|
||||
|
||||
#include <crtversion.h>
|
||||
|
||||
#if _VC_CRT_MAJOR_VERSION < 14
|
||||
// ctype mask table defined in msvcrt.dll
|
||||
extern "C" unsigned short __declspec(dllimport) _ctype[];
|
||||
#endif
|
||||
|
||||
#include "support/win32/support.h"
|
||||
#include "support/win32/locale_mgmt_win32.h"
|
||||
#include <stdio.h>
|
||||
|
@ -21,9 +21,6 @@
|
||||
#if defined(_LIBCPP_COMPILER_MSVC)
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
#if defined(_LIBCPP_MSVCRT)
|
||||
#include <crtversion.h>
|
||||
#endif
|
||||
#define swprintf _snwprintf
|
||||
#define vswprintf _vsnwprintf
|
||||
|
||||
@ -44,11 +41,6 @@ size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src,
|
||||
}
|
||||
#endif // __MINGW32__
|
||||
|
||||
#if defined(_VC_CRT_MAJOR_VERSION) && _VC_CRT_MAJOR_VERSION < 14
|
||||
#define snprintf _snprintf
|
||||
#define _Exit _exit
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_COMPILER_MSVC)
|
||||
|
||||
// Bit builtin's make these assumptions when calling _BitScanForward/Reverse
|
||||
|
@ -385,7 +385,7 @@ public:
|
||||
virtual ~error_category() _NOEXCEPT;
|
||||
|
||||
#if defined(_LIBCPP_BUILDING_SYSTEM_ERROR) && \
|
||||
defined(_LIBCPP_DEPRECATED_ABI_EXTERNAL_ERROR_CATEGORY_CONSTRUCTOR)
|
||||
defined(_LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS)
|
||||
error_category() _NOEXCEPT;
|
||||
#else
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
|
@ -261,7 +261,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<__thread_id>
|
||||
: public unary_function<__thread_id, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(__thread_id __v) const
|
||||
size_t operator()(__thread_id __v) const _NOEXCEPT
|
||||
{
|
||||
return hash<__libcpp_thread_id>()(__v.__id_);
|
||||
}
|
||||
@ -290,7 +290,7 @@ public:
|
||||
typedef __libcpp_thread_t native_handle_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
thread() _NOEXCEPT : __t_(0) {}
|
||||
thread() _NOEXCEPT : __t_(_LIBCPP_NULL_THREAD) {}
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class _Fp, class ..._Args,
|
||||
class = typename enable_if
|
||||
@ -298,15 +298,18 @@ public:
|
||||
!is_same<typename decay<_Fp>::type, thread>::value
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
explicit thread(_Fp&& __f, _Args&&... __args);
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class _Fp> explicit thread(_Fp __f);
|
||||
template <class _Fp>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
explicit thread(_Fp __f);
|
||||
#endif
|
||||
~thread();
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) {__t.__t_ = 0;}
|
||||
thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) {__t.__t_ = _LIBCPP_NULL_THREAD;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
thread& operator=(thread&& __t) _NOEXCEPT;
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@ -315,7 +318,7 @@ public:
|
||||
void swap(thread& __t) _NOEXCEPT {_VSTD::swap(__t_, __t.__t_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool joinable() const _NOEXCEPT {return __t_ != 0;}
|
||||
bool joinable() const _NOEXCEPT {return !__libcpp_thread_isnull(&__t_);}
|
||||
void join();
|
||||
void detach();
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -409,10 +412,10 @@ inline
|
||||
thread&
|
||||
thread::operator=(thread&& __t) _NOEXCEPT
|
||||
{
|
||||
if (__t_ != 0)
|
||||
if (!__libcpp_thread_isnull(&__t_))
|
||||
terminate();
|
||||
__t_ = __t.__t_;
|
||||
__t.__t_ = 0;
|
||||
__t.__t_ = _LIBCPP_NULL_THREAD;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -424,7 +427,7 @@ void swap(thread& __x, thread& __y) _NOEXCEPT {__x.swap(__y);}
|
||||
namespace this_thread
|
||||
{
|
||||
|
||||
_LIBCPP_FUNC_VIS void sleep_for(const chrono::nanoseconds& ns);
|
||||
_LIBCPP_FUNC_VIS void sleep_for(const chrono::nanoseconds& __ns);
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
void
|
||||
|
@ -366,7 +366,7 @@ struct __all_default_constructible<__tuple_types<_Tp...>>
|
||||
template<class _Indx, class ..._Tp> struct __tuple_impl;
|
||||
|
||||
template<size_t ..._Indx, class ..._Tp>
|
||||
struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
|
||||
struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
|
||||
: public __tuple_leaf<_Indx, _Tp>...
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -751,7 +751,7 @@ public:
|
||||
_CheckArgsConstructor<
|
||||
!_EnableImplicitReducedArityExtension
|
||||
&& sizeof...(_Up) < sizeof...(_Tp)
|
||||
&& !_PackExpandsToThisTuple<_Up...>()
|
||||
&& !_PackExpandsToThisTuple<_Up...>::value
|
||||
>::template __enable_implicit<_Up...>(),
|
||||
bool
|
||||
>::type = false
|
||||
@ -1064,11 +1064,13 @@ template <class _Up>
|
||||
struct __ignore_t
|
||||
{
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const __ignore_t& operator=(_Tp&&) const {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
const __ignore_t& operator=(_Tp&&) const {return *this;}
|
||||
};
|
||||
|
||||
namespace { const __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>(); }
|
||||
namespace {
|
||||
constexpr __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>();
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
struct __make_tuple_return_impl
|
||||
|
@ -97,6 +97,7 @@ namespace std
|
||||
template <class T> struct is_polymorphic;
|
||||
template <class T> struct is_abstract;
|
||||
template <class T> struct is_final; // C++14
|
||||
template <class T> struct is_aggregate; // C++17
|
||||
|
||||
template <class T, class... Args> struct is_constructible;
|
||||
template <class T> struct is_default_constructible;
|
||||
@ -286,6 +287,8 @@ namespace std
|
||||
= is_abstract<T>::value; // C++17
|
||||
template <class T> constexpr bool is_final_v
|
||||
= is_final<T>::value; // C++17
|
||||
template <class T> constexpr bool is_aggregate_v
|
||||
= is_aggregate<T>::value; // C++17
|
||||
template <class T> constexpr bool is_signed_v
|
||||
= is_signed<T>::value; // C++17
|
||||
template <class T> constexpr bool is_unsigned_v
|
||||
@ -1272,11 +1275,13 @@ template <class _Tp> using remove_all_extents_t = typename remove_all_extents<_T
|
||||
|
||||
// decay
|
||||
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TEMPLATE_VIS decay
|
||||
{
|
||||
private:
|
||||
typedef typename remove_reference<_Tp>::type _Up;
|
||||
template <class _Up, bool>
|
||||
struct __decay {
|
||||
typedef typename remove_cv<_Up>::type type;
|
||||
};
|
||||
|
||||
template <class _Up>
|
||||
struct __decay<_Up, true> {
|
||||
public:
|
||||
typedef typename conditional
|
||||
<
|
||||
@ -1291,24 +1296,23 @@ public:
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TEMPLATE_VIS decay
|
||||
{
|
||||
private:
|
||||
typedef typename remove_reference<_Tp>::type _Up;
|
||||
public:
|
||||
typedef typename __decay<_Up, __is_referenceable<_Up>::value>::type type;
|
||||
};
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
template <class _Tp> using decay_t = typename decay<_Tp>::type;
|
||||
#endif
|
||||
|
||||
// is_abstract
|
||||
|
||||
namespace __is_abstract_imp
|
||||
{
|
||||
template <class _Tp> char __test(_Tp (*)[1]);
|
||||
template <class _Tp> __two __test(...);
|
||||
}
|
||||
|
||||
template <class _Tp, bool = is_class<_Tp>::value>
|
||||
struct __libcpp_abstract : public integral_constant<bool, sizeof(__is_abstract_imp::__test<_Tp>(0)) != 1> {};
|
||||
|
||||
template <class _Tp> struct __libcpp_abstract<_Tp, false> : public false_type {};
|
||||
|
||||
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_abstract : public __libcpp_abstract<_Tp> {};
|
||||
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_abstract
|
||||
: public integral_constant<bool, __is_abstract(_Tp)> {};
|
||||
|
||||
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
|
||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_abstract_v
|
||||
@ -1335,6 +1339,19 @@ template <class _Tp> _LIBCPP_CONSTEXPR bool is_final_v
|
||||
= is_final<_Tp>::value;
|
||||
#endif
|
||||
|
||||
// is_aggregate
|
||||
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_IS_AGGREGATE)
|
||||
|
||||
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS
|
||||
is_aggregate : public integral_constant<bool, __is_aggregate(_Tp)> {};
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
|
||||
template <class _Tp>
|
||||
constexpr bool is_aggregate_v = is_aggregate<_Tp>::value;
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_IS_AGGREGATE)
|
||||
|
||||
// is_base_of
|
||||
|
||||
#ifdef _LIBCPP_HAS_IS_BASE_OF
|
||||
@ -1964,11 +1981,18 @@ public:
|
||||
typedef typename common_type<typename common_type<_Tp, _Up>::type, _Vp>::type type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS common_type<void, void, void>
|
||||
{
|
||||
public:
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TEMPLATE_VIS common_type<_Tp, void, void>
|
||||
{
|
||||
public:
|
||||
typedef typename decay<_Tp>::type type;
|
||||
typedef typename common_type<_Tp, _Tp>::type type;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
@ -1990,9 +2014,7 @@ struct _LIBCPP_TEMPLATE_VIS common_type {};
|
||||
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TEMPLATE_VIS common_type<_Tp>
|
||||
{
|
||||
typedef typename decay<_Tp>::type type;
|
||||
};
|
||||
: public common_type<_Tp, _Tp> {};
|
||||
|
||||
// bullet 3 - sizeof...(Tp) == 2
|
||||
|
||||
@ -4717,4 +4739,35 @@ struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy>
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
// std::byte
|
||||
namespace std // purposefully not versioned
|
||||
{
|
||||
template <class _Integer>
|
||||
constexpr typename enable_if<is_integral_v<_Integer>, byte>::type &
|
||||
operator<<=(byte& __lhs, _Integer __shift) noexcept
|
||||
{ return __lhs = byte(static_cast<unsigned char>(__lhs) << __shift); }
|
||||
|
||||
template <class _Integer>
|
||||
constexpr typename enable_if<is_integral_v<_Integer>, byte>::type
|
||||
operator<< (byte __lhs, _Integer __shift) noexcept
|
||||
{ return byte(static_cast<unsigned char>(__lhs) << __shift); }
|
||||
|
||||
template <class _Integer>
|
||||
constexpr typename enable_if<is_integral_v<_Integer>, byte>::type &
|
||||
operator>>=(byte& __lhs, _Integer __shift) noexcept
|
||||
{ return __lhs = byte(static_cast<unsigned char>(__lhs) >> __shift); }
|
||||
|
||||
template <class _Integer>
|
||||
constexpr typename enable_if<is_integral_v<_Integer>, byte>::type
|
||||
operator>> (byte __lhs, _Integer __shift) noexcept
|
||||
{ return byte(static_cast<unsigned char>(__lhs) >> __shift); }
|
||||
|
||||
template <class _Integer>
|
||||
constexpr typename enable_if<is_integral_v<_Integer>, _Integer>::type
|
||||
to_integer(byte __b) noexcept { return _Integer(__b); }
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_TYPE_TRAITS
|
||||
|
@ -69,7 +69,9 @@ public:
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_NONUNIQUE_RTTI_BIT)
|
||||
#if defined(_LIBCPP_ABI_MICROSOFT)
|
||||
#include <vcruntime_typeinfo.h>
|
||||
#elif defined(_LIBCPP_NONUNIQUE_RTTI_BIT)
|
||||
#define _LIBCPP_HAS_NONUNIQUE_TYPEINFO
|
||||
#else
|
||||
#define _LIBCPP_HAS_UNIQUE_TYPEINFO
|
||||
@ -78,6 +80,7 @@ public:
|
||||
namespace std // purposefully not using versioning namespace
|
||||
{
|
||||
|
||||
#if !defined(_LIBCPP_ABI_MICROSOFT)
|
||||
class _LIBCPP_EXCEPTION_ABI type_info
|
||||
{
|
||||
type_info& operator=(const type_info&);
|
||||
@ -187,6 +190,8 @@ public:
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
#endif // !_LIBCPP_ABI_MICROSOFT
|
||||
|
||||
} // std
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
@ -379,9 +379,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Key, class _Cp, class _Hash,
|
||||
bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value
|
||||
>
|
||||
template <class _Key, class _Cp, class _Hash, bool _IsEmpty>
|
||||
class __unordered_map_hasher
|
||||
: private _Hash
|
||||
{
|
||||
@ -406,7 +404,7 @@ public:
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_Hash>::value)
|
||||
{
|
||||
using _VSTD::swap;
|
||||
swap(static_cast<const _Hash&>(*this), static_cast<const _Hash&>(__y));
|
||||
swap(static_cast<_Hash&>(*this), static_cast<_Hash&>(__y));
|
||||
}
|
||||
};
|
||||
|
||||
@ -449,9 +447,7 @@ swap(__unordered_map_hasher<_Key, _Cp, _Hash, __b>& __x,
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Key, class _Cp, class _Pred,
|
||||
bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value
|
||||
>
|
||||
template <class _Key, class _Cp, class _Pred, bool _IsEmpty>
|
||||
class __unordered_map_equal
|
||||
: private _Pred
|
||||
{
|
||||
@ -479,7 +475,7 @@ public:
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_Pred>::value)
|
||||
{
|
||||
using _VSTD::swap;
|
||||
swap(static_cast<const _Pred&>(*this), static_cast<const _Pred&>(__y));
|
||||
swap(static_cast<_Pred&>(*this), static_cast<_Pred&>(__y));
|
||||
}
|
||||
};
|
||||
|
||||
|
658
include/utility
658
include/utility
@ -198,6 +198,9 @@ template <size_t I>
|
||||
#include <__tuple>
|
||||
#include <type_traits>
|
||||
#include <initializer_list>
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
#include <cstdint>
|
||||
#include <__debug>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
@ -930,6 +933,661 @@ using __is_inplace_type = __is_inplace_type_imp<__uncvref_t<_Tp>>;
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 14
|
||||
|
||||
template <class _Arg, class _Result>
|
||||
struct _LIBCPP_TEMPLATE_VIS unary_function
|
||||
{
|
||||
typedef _Arg argument_type;
|
||||
typedef _Result result_type;
|
||||
};
|
||||
|
||||
template <class _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_Size
|
||||
__loadword(const void* __p)
|
||||
{
|
||||
_Size __r;
|
||||
std::memcpy(&__r, __p, sizeof(__r));
|
||||
return __r;
|
||||
}
|
||||
|
||||
// We use murmur2 when size_t is 32 bits, and cityhash64 when size_t
|
||||
// is 64 bits. This is because cityhash64 uses 64bit x 64bit
|
||||
// multiplication, which can be very slow on 32-bit systems.
|
||||
template <class _Size, size_t = sizeof(_Size)*__CHAR_BIT__>
|
||||
struct __murmur2_or_cityhash;
|
||||
|
||||
template <class _Size>
|
||||
struct __murmur2_or_cityhash<_Size, 32>
|
||||
{
|
||||
inline _Size operator()(const void* __key, _Size __len)
|
||||
_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK;
|
||||
};
|
||||
|
||||
// murmur2
|
||||
template <class _Size>
|
||||
_Size
|
||||
__murmur2_or_cityhash<_Size, 32>::operator()(const void* __key, _Size __len)
|
||||
{
|
||||
const _Size __m = 0x5bd1e995;
|
||||
const _Size __r = 24;
|
||||
_Size __h = __len;
|
||||
const unsigned char* __data = static_cast<const unsigned char*>(__key);
|
||||
for (; __len >= 4; __data += 4, __len -= 4)
|
||||
{
|
||||
_Size __k = __loadword<_Size>(__data);
|
||||
__k *= __m;
|
||||
__k ^= __k >> __r;
|
||||
__k *= __m;
|
||||
__h *= __m;
|
||||
__h ^= __k;
|
||||
}
|
||||
switch (__len)
|
||||
{
|
||||
case 3:
|
||||
__h ^= __data[2] << 16;
|
||||
case 2:
|
||||
__h ^= __data[1] << 8;
|
||||
case 1:
|
||||
__h ^= __data[0];
|
||||
__h *= __m;
|
||||
}
|
||||
__h ^= __h >> 13;
|
||||
__h *= __m;
|
||||
__h ^= __h >> 15;
|
||||
return __h;
|
||||
}
|
||||
|
||||
template <class _Size>
|
||||
struct __murmur2_or_cityhash<_Size, 64>
|
||||
{
|
||||
inline _Size operator()(const void* __key, _Size __len) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK;
|
||||
|
||||
private:
|
||||
// Some primes between 2^63 and 2^64.
|
||||
static const _Size __k0 = 0xc3a5c85c97cb3127ULL;
|
||||
static const _Size __k1 = 0xb492b66fbe98f273ULL;
|
||||
static const _Size __k2 = 0x9ae16a3b2f90404fULL;
|
||||
static const _Size __k3 = 0xc949d7c7509e6557ULL;
|
||||
|
||||
static _Size __rotate(_Size __val, int __shift) {
|
||||
return __shift == 0 ? __val : ((__val >> __shift) | (__val << (64 - __shift)));
|
||||
}
|
||||
|
||||
static _Size __rotate_by_at_least_1(_Size __val, int __shift) {
|
||||
return (__val >> __shift) | (__val << (64 - __shift));
|
||||
}
|
||||
|
||||
static _Size __shift_mix(_Size __val) {
|
||||
return __val ^ (__val >> 47);
|
||||
}
|
||||
|
||||
static _Size __hash_len_16(_Size __u, _Size __v)
|
||||
_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
|
||||
{
|
||||
const _Size __mul = 0x9ddfea08eb382d69ULL;
|
||||
_Size __a = (__u ^ __v) * __mul;
|
||||
__a ^= (__a >> 47);
|
||||
_Size __b = (__v ^ __a) * __mul;
|
||||
__b ^= (__b >> 47);
|
||||
__b *= __mul;
|
||||
return __b;
|
||||
}
|
||||
|
||||
static _Size __hash_len_0_to_16(const char* __s, _Size __len)
|
||||
_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
|
||||
{
|
||||
if (__len > 8) {
|
||||
const _Size __a = __loadword<_Size>(__s);
|
||||
const _Size __b = __loadword<_Size>(__s + __len - 8);
|
||||
return __hash_len_16(__a, __rotate_by_at_least_1(__b + __len, __len)) ^ __b;
|
||||
}
|
||||
if (__len >= 4) {
|
||||
const uint32_t __a = __loadword<uint32_t>(__s);
|
||||
const uint32_t __b = __loadword<uint32_t>(__s + __len - 4);
|
||||
return __hash_len_16(__len + (__a << 3), __b);
|
||||
}
|
||||
if (__len > 0) {
|
||||
const unsigned char __a = __s[0];
|
||||
const unsigned char __b = __s[__len >> 1];
|
||||
const unsigned char __c = __s[__len - 1];
|
||||
const uint32_t __y = static_cast<uint32_t>(__a) +
|
||||
(static_cast<uint32_t>(__b) << 8);
|
||||
const uint32_t __z = __len + (static_cast<uint32_t>(__c) << 2);
|
||||
return __shift_mix(__y * __k2 ^ __z * __k3) * __k2;
|
||||
}
|
||||
return __k2;
|
||||
}
|
||||
|
||||
static _Size __hash_len_17_to_32(const char *__s, _Size __len)
|
||||
_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
|
||||
{
|
||||
const _Size __a = __loadword<_Size>(__s) * __k1;
|
||||
const _Size __b = __loadword<_Size>(__s + 8);
|
||||
const _Size __c = __loadword<_Size>(__s + __len - 8) * __k2;
|
||||
const _Size __d = __loadword<_Size>(__s + __len - 16) * __k0;
|
||||
return __hash_len_16(__rotate(__a - __b, 43) + __rotate(__c, 30) + __d,
|
||||
__a + __rotate(__b ^ __k3, 20) - __c + __len);
|
||||
}
|
||||
|
||||
// Return a 16-byte hash for 48 bytes. Quick and dirty.
|
||||
// Callers do best to use "random-looking" values for a and b.
|
||||
static pair<_Size, _Size> __weak_hash_len_32_with_seeds(
|
||||
_Size __w, _Size __x, _Size __y, _Size __z, _Size __a, _Size __b)
|
||||
_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
|
||||
{
|
||||
__a += __w;
|
||||
__b = __rotate(__b + __a + __z, 21);
|
||||
const _Size __c = __a;
|
||||
__a += __x;
|
||||
__a += __y;
|
||||
__b += __rotate(__a, 44);
|
||||
return pair<_Size, _Size>(__a + __z, __b + __c);
|
||||
}
|
||||
|
||||
// Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty.
|
||||
static pair<_Size, _Size> __weak_hash_len_32_with_seeds(
|
||||
const char* __s, _Size __a, _Size __b)
|
||||
_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
|
||||
{
|
||||
return __weak_hash_len_32_with_seeds(__loadword<_Size>(__s),
|
||||
__loadword<_Size>(__s + 8),
|
||||
__loadword<_Size>(__s + 16),
|
||||
__loadword<_Size>(__s + 24),
|
||||
__a,
|
||||
__b);
|
||||
}
|
||||
|
||||
// Return an 8-byte hash for 33 to 64 bytes.
|
||||
static _Size __hash_len_33_to_64(const char *__s, size_t __len)
|
||||
_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
|
||||
{
|
||||
_Size __z = __loadword<_Size>(__s + 24);
|
||||
_Size __a = __loadword<_Size>(__s) +
|
||||
(__len + __loadword<_Size>(__s + __len - 16)) * __k0;
|
||||
_Size __b = __rotate(__a + __z, 52);
|
||||
_Size __c = __rotate(__a, 37);
|
||||
__a += __loadword<_Size>(__s + 8);
|
||||
__c += __rotate(__a, 7);
|
||||
__a += __loadword<_Size>(__s + 16);
|
||||
_Size __vf = __a + __z;
|
||||
_Size __vs = __b + __rotate(__a, 31) + __c;
|
||||
__a = __loadword<_Size>(__s + 16) + __loadword<_Size>(__s + __len - 32);
|
||||
__z += __loadword<_Size>(__s + __len - 8);
|
||||
__b = __rotate(__a + __z, 52);
|
||||
__c = __rotate(__a, 37);
|
||||
__a += __loadword<_Size>(__s + __len - 24);
|
||||
__c += __rotate(__a, 7);
|
||||
__a += __loadword<_Size>(__s + __len - 16);
|
||||
_Size __wf = __a + __z;
|
||||
_Size __ws = __b + __rotate(__a, 31) + __c;
|
||||
_Size __r = __shift_mix((__vf + __ws) * __k2 + (__wf + __vs) * __k0);
|
||||
return __shift_mix(__r * __k0 + __vs) * __k2;
|
||||
}
|
||||
};
|
||||
|
||||
// cityhash64
|
||||
template <class _Size>
|
||||
_Size
|
||||
__murmur2_or_cityhash<_Size, 64>::operator()(const void* __key, _Size __len)
|
||||
{
|
||||
const char* __s = static_cast<const char*>(__key);
|
||||
if (__len <= 32) {
|
||||
if (__len <= 16) {
|
||||
return __hash_len_0_to_16(__s, __len);
|
||||
} else {
|
||||
return __hash_len_17_to_32(__s, __len);
|
||||
}
|
||||
} else if (__len <= 64) {
|
||||
return __hash_len_33_to_64(__s, __len);
|
||||
}
|
||||
|
||||
// For strings over 64 bytes we hash the end first, and then as we
|
||||
// loop we keep 56 bytes of state: v, w, x, y, and z.
|
||||
_Size __x = __loadword<_Size>(__s + __len - 40);
|
||||
_Size __y = __loadword<_Size>(__s + __len - 16) +
|
||||
__loadword<_Size>(__s + __len - 56);
|
||||
_Size __z = __hash_len_16(__loadword<_Size>(__s + __len - 48) + __len,
|
||||
__loadword<_Size>(__s + __len - 24));
|
||||
pair<_Size, _Size> __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z);
|
||||
pair<_Size, _Size> __w = __weak_hash_len_32_with_seeds(__s + __len - 32, __y + __k1, __x);
|
||||
__x = __x * __k1 + __loadword<_Size>(__s);
|
||||
|
||||
// Decrease len to the nearest multiple of 64, and operate on 64-byte chunks.
|
||||
__len = (__len - 1) & ~static_cast<_Size>(63);
|
||||
do {
|
||||
__x = __rotate(__x + __y + __v.first + __loadword<_Size>(__s + 8), 37) * __k1;
|
||||
__y = __rotate(__y + __v.second + __loadword<_Size>(__s + 48), 42) * __k1;
|
||||
__x ^= __w.second;
|
||||
__y += __v.first + __loadword<_Size>(__s + 40);
|
||||
__z = __rotate(__z + __w.first, 33) * __k1;
|
||||
__v = __weak_hash_len_32_with_seeds(__s, __v.second * __k1, __x + __w.first);
|
||||
__w = __weak_hash_len_32_with_seeds(__s + 32, __z + __w.second,
|
||||
__y + __loadword<_Size>(__s + 16));
|
||||
std::swap(__z, __x);
|
||||
__s += 64;
|
||||
__len -= 64;
|
||||
} while (__len != 0);
|
||||
return __hash_len_16(
|
||||
__hash_len_16(__v.first, __w.first) + __shift_mix(__y) * __k1 + __z,
|
||||
__hash_len_16(__v.second, __w.second) + __x);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t = sizeof(_Tp) / sizeof(size_t)>
|
||||
struct __scalar_hash;
|
||||
|
||||
template <class _Tp>
|
||||
struct __scalar_hash<_Tp, 0>
|
||||
: public unary_function<_Tp, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(_Tp __v) const _NOEXCEPT
|
||||
{
|
||||
union
|
||||
{
|
||||
_Tp __t;
|
||||
size_t __a;
|
||||
} __u;
|
||||
__u.__a = 0;
|
||||
__u.__t = __v;
|
||||
return __u.__a;
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __scalar_hash<_Tp, 1>
|
||||
: public unary_function<_Tp, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(_Tp __v) const _NOEXCEPT
|
||||
{
|
||||
union
|
||||
{
|
||||
_Tp __t;
|
||||
size_t __a;
|
||||
} __u;
|
||||
__u.__t = __v;
|
||||
return __u.__a;
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __scalar_hash<_Tp, 2>
|
||||
: public unary_function<_Tp, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(_Tp __v) const _NOEXCEPT
|
||||
{
|
||||
union
|
||||
{
|
||||
_Tp __t;
|
||||
struct
|
||||
{
|
||||
size_t __a;
|
||||
size_t __b;
|
||||
} __s;
|
||||
} __u;
|
||||
__u.__t = __v;
|
||||
return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __scalar_hash<_Tp, 3>
|
||||
: public unary_function<_Tp, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(_Tp __v) const _NOEXCEPT
|
||||
{
|
||||
union
|
||||
{
|
||||
_Tp __t;
|
||||
struct
|
||||
{
|
||||
size_t __a;
|
||||
size_t __b;
|
||||
size_t __c;
|
||||
} __s;
|
||||
} __u;
|
||||
__u.__t = __v;
|
||||
return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __scalar_hash<_Tp, 4>
|
||||
: public unary_function<_Tp, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(_Tp __v) const _NOEXCEPT
|
||||
{
|
||||
union
|
||||
{
|
||||
_Tp __t;
|
||||
struct
|
||||
{
|
||||
size_t __a;
|
||||
size_t __b;
|
||||
size_t __c;
|
||||
size_t __d;
|
||||
} __s;
|
||||
} __u;
|
||||
__u.__t = __v;
|
||||
return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
|
||||
}
|
||||
};
|
||||
|
||||
struct _PairT {
|
||||
size_t first;
|
||||
size_t second;
|
||||
};
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline size_t __hash_combine(size_t __lhs, size_t __rhs) _NOEXCEPT {
|
||||
typedef __scalar_hash<_PairT> _HashT;
|
||||
const _PairT __p = {__lhs, __rhs};
|
||||
return _HashT()(__p);
|
||||
}
|
||||
|
||||
template<class _Tp>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<_Tp*>
|
||||
: public unary_function<_Tp*, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(_Tp* __v) const _NOEXCEPT
|
||||
{
|
||||
union
|
||||
{
|
||||
_Tp* __t;
|
||||
size_t __a;
|
||||
} __u;
|
||||
__u.__t = __v;
|
||||
return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<bool>
|
||||
: public unary_function<bool, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(bool __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<char>
|
||||
: public unary_function<char, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<signed char>
|
||||
: public unary_function<signed char, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(signed char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<unsigned char>
|
||||
: public unary_function<unsigned char, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(unsigned char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<char16_t>
|
||||
: public unary_function<char16_t, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(char16_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<char32_t>
|
||||
: public unary_function<char32_t, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(char32_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<wchar_t>
|
||||
: public unary_function<wchar_t, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(wchar_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<short>
|
||||
: public unary_function<short, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(short __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<unsigned short>
|
||||
: public unary_function<unsigned short, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(unsigned short __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<int>
|
||||
: public unary_function<int, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(int __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<unsigned int>
|
||||
: public unary_function<unsigned int, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(unsigned int __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<long>
|
||||
: public unary_function<long, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(long __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<unsigned long>
|
||||
: public unary_function<unsigned long, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(unsigned long __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<long long>
|
||||
: public __scalar_hash<long long>
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<unsigned long long>
|
||||
: public __scalar_hash<unsigned long long>
|
||||
{
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_INT128
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<__int128_t>
|
||||
: public __scalar_hash<__int128_t>
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<__uint128_t>
|
||||
: public __scalar_hash<__uint128_t>
|
||||
{
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<float>
|
||||
: public __scalar_hash<float>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(float __v) const _NOEXCEPT
|
||||
{
|
||||
// -0.0 and 0.0 should return same hash
|
||||
if (__v == 0)
|
||||
return 0;
|
||||
return __scalar_hash<float>::operator()(__v);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<double>
|
||||
: public __scalar_hash<double>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(double __v) const _NOEXCEPT
|
||||
{
|
||||
// -0.0 and 0.0 should return same hash
|
||||
if (__v == 0)
|
||||
return 0;
|
||||
return __scalar_hash<double>::operator()(__v);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<long double>
|
||||
: public __scalar_hash<long double>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(long double __v) const _NOEXCEPT
|
||||
{
|
||||
// -0.0 and 0.0 should return same hash
|
||||
if (__v == 0)
|
||||
return 0;
|
||||
#if defined(__i386__)
|
||||
// Zero out padding bits
|
||||
union
|
||||
{
|
||||
long double __t;
|
||||
struct
|
||||
{
|
||||
size_t __a;
|
||||
size_t __b;
|
||||
size_t __c;
|
||||
size_t __d;
|
||||
} __s;
|
||||
} __u;
|
||||
__u.__s.__a = 0;
|
||||
__u.__s.__b = 0;
|
||||
__u.__s.__c = 0;
|
||||
__u.__s.__d = 0;
|
||||
__u.__t = __v;
|
||||
return __u.__s.__a ^ __u.__s.__b ^ __u.__s.__c ^ __u.__s.__d;
|
||||
#elif defined(__x86_64__)
|
||||
// Zero out padding bits
|
||||
union
|
||||
{
|
||||
long double __t;
|
||||
struct
|
||||
{
|
||||
size_t __a;
|
||||
size_t __b;
|
||||
} __s;
|
||||
} __u;
|
||||
__u.__s.__a = 0;
|
||||
__u.__s.__b = 0;
|
||||
__u.__t = __v;
|
||||
return __u.__s.__a ^ __u.__s.__b;
|
||||
#else
|
||||
return __scalar_hash<long double>::operator()(__v);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
||||
template <class _Tp, bool = is_enum<_Tp>::value>
|
||||
struct _LIBCPP_TEMPLATE_VIS __enum_hash
|
||||
: public unary_function<_Tp, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(_Tp __v) const _NOEXCEPT
|
||||
{
|
||||
typedef typename underlying_type<_Tp>::type type;
|
||||
return hash<type>{}(static_cast<type>(__v));
|
||||
}
|
||||
};
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TEMPLATE_VIS __enum_hash<_Tp, false> {
|
||||
__enum_hash() = delete;
|
||||
__enum_hash(__enum_hash const&) = delete;
|
||||
__enum_hash& operator=(__enum_hash const&) = delete;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash : public __enum_hash<_Tp>
|
||||
{
|
||||
};
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<nullptr_t>
|
||||
: public unary_function<nullptr_t, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(nullptr_t) const _NOEXCEPT {
|
||||
return 662607004ull;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Key, class _Hash>
|
||||
using __check_hash_requirements = integral_constant<bool,
|
||||
is_copy_constructible<_Hash>::value &&
|
||||
is_move_constructible<_Hash>::value &&
|
||||
__invokable_r<size_t, _Hash, _Key const&>::value
|
||||
>;
|
||||
|
||||
template <class _Key, class _Hash = std::hash<_Key> >
|
||||
using __has_enabled_hash = integral_constant<bool,
|
||||
__check_hash_requirements<_Key, _Hash>::value &&
|
||||
is_default_constructible<_Hash>::value
|
||||
>;
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
template <class _Type, class>
|
||||
using __enable_hash_helper_imp = _Type;
|
||||
|
||||
template <class _Type, class ..._Keys>
|
||||
using __enable_hash_helper = __enable_hash_helper_imp<_Type,
|
||||
typename enable_if<__all<__has_enabled_hash<_Keys>::value...>::value>::type
|
||||
>;
|
||||
#else
|
||||
template <class _Type, class ...>
|
||||
using __enable_hash_helper = _Type;
|
||||
#endif
|
||||
|
||||
#endif // !_LIBCPP_CXX03_LANG
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_UTILITY
|
||||
|
@ -53,16 +53,16 @@ namespace std {
|
||||
|
||||
// 20.7.2.4, modifiers
|
||||
template <class T, class... Args>
|
||||
void emplace(Args&&...);
|
||||
T& emplace(Args&&...);
|
||||
|
||||
template <class T, class U, class... Args>
|
||||
void emplace(initializer_list<U>, Args&&...);
|
||||
T& emplace(initializer_list<U>, Args&&...);
|
||||
|
||||
template <size_t I, class... Args>
|
||||
void emplace(Args&&...);
|
||||
variant_alternative_t<I, variant>& emplace(Args&&...);
|
||||
|
||||
template <size_t I, class U, class... Args>
|
||||
void emplace(initializer_list<U>, Args&&...);
|
||||
variant_alternative_t<I, variant>& emplace(initializer_list<U>, Args&&...);
|
||||
|
||||
// 20.7.2.5, value status
|
||||
constexpr bool valueless_by_exception() const noexcept;
|
||||
@ -466,17 +466,21 @@ private:
|
||||
return __result{{_VSTD::forward<_Fs>(__fs)...}};
|
||||
}
|
||||
|
||||
template <class _Fp, class... _Vs, size_t... _Is>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
static constexpr auto __make_dispatch(index_sequence<_Is...>) {
|
||||
struct __dispatcher {
|
||||
static constexpr decltype(auto) __dispatch(_Fp __f, _Vs... __vs) {
|
||||
template <std::size_t... _Is>
|
||||
struct __dispatcher {
|
||||
template <class _Fp, class... _Vs>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
static constexpr decltype(auto) __dispatch(_Fp __f, _Vs... __vs) {
|
||||
return __invoke_constexpr(
|
||||
static_cast<_Fp>(__f),
|
||||
__access::__base::__get_alt<_Is>(static_cast<_Vs>(__vs))...);
|
||||
}
|
||||
};
|
||||
return _VSTD::addressof(__dispatcher::__dispatch);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Fp, class... _Vs, size_t... _Is>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
static constexpr auto __make_dispatch(index_sequence<_Is...>) {
|
||||
return __dispatcher<_Is...>::template __dispatch<_Fp, _Vs...>;
|
||||
}
|
||||
|
||||
template <size_t _Ip, class _Fp, class... _Vs>
|
||||
@ -760,9 +764,10 @@ public:
|
||||
protected:
|
||||
template <size_t _Ip, class _Tp, class... _Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
static void __construct_alt(__alt<_Ip, _Tp>& __a, _Args&&... __args) {
|
||||
::new (_VSTD::addressof(__a))
|
||||
static _Tp& __construct_alt(__alt<_Ip, _Tp>& __a, _Args&&... __args) {
|
||||
::new ((void*)_VSTD::addressof(__a))
|
||||
__alt<_Ip, _Tp>(in_place, _VSTD::forward<_Args>(__args)...);
|
||||
return __a.__value;
|
||||
}
|
||||
|
||||
template <class _Rhs>
|
||||
@ -872,11 +877,12 @@ public:
|
||||
|
||||
template <size_t _Ip, class... _Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void __emplace(_Args&&... __args) {
|
||||
auto& __emplace(_Args&&... __args) {
|
||||
this->__destroy();
|
||||
this->__construct_alt(__access::__base::__get_alt<_Ip>(*this),
|
||||
auto& __res = this->__construct_alt(__access::__base::__get_alt<_Ip>(*this),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
this->__index = _Ip;
|
||||
return __res;
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -1214,8 +1220,8 @@ public:
|
||||
class _Tp = variant_alternative_t<_Ip, variant<_Types...>>,
|
||||
enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void emplace(_Args&&... __args) {
|
||||
__impl.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...);
|
||||
_Tp& emplace(_Args&&... __args) {
|
||||
return __impl.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <
|
||||
@ -1227,8 +1233,8 @@ public:
|
||||
enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>,
|
||||
int> = 0>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void emplace(initializer_list<_Up> __il, _Args&&... __args) {
|
||||
__impl.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...);
|
||||
_Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) {
|
||||
return __impl.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <
|
||||
@ -1238,8 +1244,8 @@ public:
|
||||
__find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
|
||||
enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void emplace(_Args&&... __args) {
|
||||
__impl.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...);
|
||||
_Tp& emplace(_Args&&... __args) {
|
||||
return __impl.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <
|
||||
@ -1251,8 +1257,8 @@ public:
|
||||
enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>,
|
||||
int> = 0>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void emplace(initializer_list<_Up> __il, _Args&&... __args) {
|
||||
__impl.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...);
|
||||
_Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) {
|
||||
return __impl.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@ -1529,7 +1535,8 @@ auto swap(variant<_Types...>& __lhs,
|
||||
}
|
||||
|
||||
template <class... _Types>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<variant<_Types...>> {
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<
|
||||
__enable_hash_helper<variant<_Types...>, remove_const_t<_Types>...>> {
|
||||
using argument_type = variant<_Types...>;
|
||||
using result_type = size_t;
|
||||
|
||||
@ -1542,7 +1549,8 @@ struct _LIBCPP_TEMPLATE_VIS hash<variant<_Types...>> {
|
||||
: __variant::__visit_alt(
|
||||
[](const auto& __alt) {
|
||||
using __alt_type = decay_t<decltype(__alt)>;
|
||||
using __value_type = typename __alt_type::__value_type;
|
||||
using __value_type = remove_const_t<
|
||||
typename __alt_type::__value_type>;
|
||||
return hash<__value_type>{}(__alt.__value);
|
||||
},
|
||||
__v);
|
||||
@ -1556,7 +1564,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<monostate> {
|
||||
using result_type = size_t;
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
result_type operator()(const argument_type&) const {
|
||||
result_type operator()(const argument_type&) const _NOEXCEPT {
|
||||
return 66740831; // return a fundamentally attractive random value.
|
||||
}
|
||||
};
|
||||
|
131
include/vector
131
include/vector
@ -413,8 +413,10 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__vector_base<_Tp, _Allocator>::__destruct_at_end(pointer __new_last) _NOEXCEPT
|
||||
{
|
||||
while (__new_last != __end_)
|
||||
__alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__end_));
|
||||
pointer __soon_to_be_end = __end_;
|
||||
while (__new_last != __soon_to_be_end)
|
||||
__alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__soon_to_be_end));
|
||||
__end_ = __new_last;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
@ -525,12 +527,7 @@ public:
|
||||
is_constructible<
|
||||
value_type,
|
||||
typename iterator_traits<_ForwardIterator>::reference>::value>::type* = 0);
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector(initializer_list<value_type> __il);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector(initializer_list<value_type> __il, const allocator_type& __a);
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~vector()
|
||||
@ -543,7 +540,14 @@ public:
|
||||
vector(const vector& __x, const allocator_type& __a);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector& operator=(const vector& __x);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector(initializer_list<value_type> __il);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector(initializer_list<value_type> __il, const allocator_type& __a);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector(vector&& __x)
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
@ -551,17 +555,18 @@ public:
|
||||
#else
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector(vector&& __x, const allocator_type& __a);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector& operator=(vector&& __x)
|
||||
_NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector& operator=(initializer_list<value_type> __il)
|
||||
{assign(__il.begin(), __il.end()); return *this;}
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
#endif // !_LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _InputIterator>
|
||||
typename enable_if
|
||||
@ -586,11 +591,12 @@ public:
|
||||
assign(_ForwardIterator __first, _ForwardIterator __last);
|
||||
|
||||
void assign(size_type __n, const_reference __u);
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void assign(initializer_list<value_type> __il)
|
||||
{assign(__il.begin(), __il.end());}
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const _NOEXCEPT
|
||||
@ -674,9 +680,10 @@ public:
|
||||
{return _VSTD::__to_raw_pointer(this->__begin_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY void push_back(value_type&& __x);
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
@ -684,19 +691,19 @@ public:
|
||||
#else
|
||||
void emplace_back(_Args&&... __args);
|
||||
#endif
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // !_LIBCPP_CXX03_LANG
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void pop_back();
|
||||
|
||||
iterator insert(const_iterator __position, const_reference __x);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
iterator insert(const_iterator __position, value_type&& __x);
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class... _Args>
|
||||
iterator emplace(const_iterator __position, _Args&&... __args);
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // !_LIBCPP_CXX03_LANG
|
||||
|
||||
iterator insert(const_iterator __position, size_type __n, const_reference __x);
|
||||
template <class _InputIterator>
|
||||
typename enable_if
|
||||
@ -719,11 +726,12 @@ public:
|
||||
iterator
|
||||
>::type
|
||||
insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last);
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __position, initializer_list<value_type> __il)
|
||||
{return insert(__position, __il.begin(), __il.end());}
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position);
|
||||
iterator erase(const_iterator __first, const_iterator __last);
|
||||
@ -796,18 +804,16 @@ private:
|
||||
__base::__destruct_at_end(__new_last);
|
||||
__annotate_shrink(__old_size);
|
||||
}
|
||||
template <class _Up>
|
||||
void
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__push_back_slow_path(_Up&& __x);
|
||||
#else
|
||||
__push_back_slow_path(_Up& __x);
|
||||
#endif
|
||||
#if !defined(_LIBCPP_HAS_NO_VARIADICS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Up> void __push_back_slow_path(_Up&& __x);
|
||||
|
||||
template <class... _Args>
|
||||
void
|
||||
__emplace_back_slow_path(_Args&&... __args);
|
||||
void __emplace_back_slow_path(_Args&&... __args);
|
||||
#else
|
||||
template <class _Up> void __push_back_slow_path(_Up& __x);
|
||||
#endif
|
||||
|
||||
// The following functions are no-ops outside of AddressSanitizer mode.
|
||||
// We call annotatations only for the default Allocator because other allocators
|
||||
// may not meet the AddressSanitizer alignment constraints.
|
||||
@ -1217,7 +1223,7 @@ vector<_Tp, _Allocator>::vector(const vector& __x, const allocator_type& __a)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@ -1264,8 +1270,6 @@ vector<_Tp, _Allocator>::vector(vector&& __x, const allocator_type& __a)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il)
|
||||
@ -1295,8 +1299,6 @@ vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il, const allocat
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
vector<_Tp, _Allocator>&
|
||||
@ -1338,7 +1340,7 @@ vector<_Tp, _Allocator>::__move_assign(vector& __c, true_type)
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // !_LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@ -1560,7 +1562,7 @@ vector<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class _Up>
|
||||
void
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
vector<_Tp, _Allocator>::__push_back_slow_path(_Up&& __x)
|
||||
#else
|
||||
vector<_Tp, _Allocator>::__push_back_slow_path(_Up& __x)
|
||||
@ -1591,7 +1593,7 @@ vector<_Tp, _Allocator>::push_back(const_reference __x)
|
||||
__push_back_slow_path(__x);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@ -1611,8 +1613,6 @@ vector<_Tp, _Allocator>::push_back(value_type&& __x)
|
||||
__push_back_slow_path(_VSTD::move(__x));
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class... _Args>
|
||||
void
|
||||
@ -1652,8 +1652,7 @@ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args)
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // !_LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline
|
||||
@ -1758,7 +1757,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x)
|
||||
return __make_iter(__p);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
typename vector<_Tp, _Allocator>::iterator
|
||||
@ -1797,8 +1796,6 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x)
|
||||
return __make_iter(__p);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class... _Args>
|
||||
typename vector<_Tp, _Allocator>::iterator
|
||||
@ -1838,8 +1835,7 @@ vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args)
|
||||
return __make_iter(__p);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // !_LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
typename vector<_Tp, _Allocator>::iterator
|
||||
@ -2036,7 +2032,7 @@ vector<_Tp, _Allocator>::swap(vector& __x)
|
||||
_VSTD::swap(this->__begin_, __x.__begin_);
|
||||
_VSTD::swap(this->__end_, __x.__end_);
|
||||
_VSTD::swap(this->__end_cap(), __x.__end_cap());
|
||||
__swap_allocator(this->__alloc(), __x.__alloc(),
|
||||
__swap_allocator(this->__alloc(), __x.__alloc(),
|
||||
integral_constant<bool,__alloc_traits::propagate_on_container_swap::value>());
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
__get_db()->swap(this, &__x);
|
||||
@ -2231,12 +2227,11 @@ public:
|
||||
vector(const vector& __v);
|
||||
vector(const vector& __v, const allocator_type& __a);
|
||||
vector& operator=(const vector& __v);
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
vector(initializer_list<value_type> __il);
|
||||
vector(initializer_list<value_type> __il, const allocator_type& __a);
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector(vector&& __v)
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
@ -2248,12 +2243,12 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector& operator=(vector&& __v)
|
||||
_NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector& operator=(initializer_list<value_type> __il)
|
||||
{assign(__il.begin(), __il.end()); return *this;}
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
#endif // !_LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _InputIterator>
|
||||
typename enable_if
|
||||
@ -2272,11 +2267,12 @@ public:
|
||||
assign(_ForwardIterator __first, _ForwardIterator __last);
|
||||
|
||||
void assign(size_type __n, const value_type& __x);
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void assign(initializer_list<value_type> __il)
|
||||
{assign(__il.begin(), __il.end());}
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT
|
||||
{return allocator_type(this->__alloc());}
|
||||
@ -2385,11 +2381,12 @@ public:
|
||||
iterator
|
||||
>::type
|
||||
insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last);
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __position, initializer_list<value_type> __il)
|
||||
{return insert(__position, __il.begin(), __il.end());}
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position);
|
||||
iterator erase(const_iterator __first, const_iterator __last);
|
||||
@ -2749,7 +2746,7 @@ vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __la
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Allocator>
|
||||
vector<bool, _Allocator>::vector(initializer_list<value_type> __il)
|
||||
@ -2779,7 +2776,7 @@ vector<bool, _Allocator>::vector(initializer_list<value_type> __il, const alloca
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Allocator>
|
||||
vector<bool, _Allocator>::~vector()
|
||||
@ -2836,7 +2833,7 @@ vector<bool, _Allocator>::operator=(const vector& __v)
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@ -2911,7 +2908,7 @@ vector<bool, _Allocator>::__move_assign(vector& __c, true_type)
|
||||
__c.__cap() = __c.__size_ = 0;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // !_LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Allocator>
|
||||
void
|
||||
@ -3201,7 +3198,7 @@ vector<bool, _Allocator>::swap(vector& __x)
|
||||
_VSTD::swap(this->__begin_, __x.__begin_);
|
||||
_VSTD::swap(this->__size_, __x.__size_);
|
||||
_VSTD::swap(this->__cap(), __x.__cap());
|
||||
__swap_allocator(this->__alloc(), __x.__alloc(),
|
||||
__swap_allocator(this->__alloc(), __x.__alloc(),
|
||||
integral_constant<bool, __alloc_traits::propagate_on_container_swap::value>());
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,10 @@ endif()
|
||||
add_link_flags_if(LIBCXX_CXX_ABI_LIBRARY_PATH
|
||||
"${CMAKE_LIBRARY_PATH_FLAG}${LIBCXX_CXX_ABI_LIBRARY_PATH}")
|
||||
|
||||
|
||||
if (LIBCXX_GENERATE_COVERAGE AND NOT LIBCXX_COVERAGE_LIBRARY)
|
||||
find_compiler_rt_library(profile LIBCXX_COVERAGE_LIBRARY)
|
||||
endif()
|
||||
add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}")
|
||||
|
||||
if (APPLE AND (LIBCXX_CXX_ABI_LIBNAME STREQUAL "libcxxabi" OR
|
||||
@ -62,12 +66,7 @@ if (APPLE AND LLVM_USE_SANITIZER)
|
||||
message(WARNING "LLVM_USE_SANITIZER=${LLVM_USE_SANITIZER} is not supported on OS X")
|
||||
endif()
|
||||
if (LIBFILE)
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=lib OUTPUT_VARIABLE LIBDIR RESULT_VARIABLE Result)
|
||||
if (NOT ${Result} EQUAL "0")
|
||||
message(FATAL "Failed to find library resource directory")
|
||||
endif()
|
||||
string(STRIP "${LIBDIR}" LIBDIR)
|
||||
set(LIBDIR "${LIBDIR}/darwin/")
|
||||
find_compiler_rt_dir(LIBDIR)
|
||||
if (NOT IS_DIRECTORY "${LIBDIR}")
|
||||
message(FATAL_ERROR "Cannot find compiler-rt directory on OS X required for LLVM_USE_SANITIZER")
|
||||
endif()
|
||||
@ -84,14 +83,19 @@ add_library_flags_if(LIBCXX_HAS_PTHREAD_LIB pthread)
|
||||
add_library_flags_if(LIBCXX_HAS_C_LIB c)
|
||||
add_library_flags_if(LIBCXX_HAS_M_LIB m)
|
||||
add_library_flags_if(LIBCXX_HAS_RT_LIB rt)
|
||||
add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s)
|
||||
if (LIBCXX_USE_COMPILER_RT)
|
||||
find_compiler_rt_library(builtins LIBCXX_BUILTINS_LIBRARY)
|
||||
add_library_flags_if(LIBCXX_BUILTINS_LIBRARY "${LIBCXX_BUILTINS_LIBRARY}")
|
||||
else()
|
||||
add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s)
|
||||
endif()
|
||||
add_library_flags_if(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB atomic)
|
||||
|
||||
# Add the unwinder library.
|
||||
if (LIBCXXABI_USE_LLVM_UNWINDER)
|
||||
if (TARGET unwind_shared)
|
||||
if (NOT LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_shared OR HAVE_LIBUNWIND))
|
||||
add_interface_library(unwind_shared)
|
||||
elseif (TARGET unwind_static)
|
||||
elseif (LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_static OR HAVE_LIBUNWIND))
|
||||
add_interface_library(unwind_static)
|
||||
else()
|
||||
add_interface_library(unwind)
|
||||
@ -102,8 +106,26 @@ endif()
|
||||
if (NOT WIN32)
|
||||
add_flags_if_supported(-fPIC)
|
||||
endif()
|
||||
|
||||
add_link_flags_if_supported(-nodefaultlibs)
|
||||
|
||||
if (LIBCXX_TARGETING_MSVC)
|
||||
if (LIBCXX_DEBUG_BUILD)
|
||||
set(LIB_SUFFIX "d")
|
||||
else()
|
||||
set(LIB_SUFFIX "")
|
||||
endif()
|
||||
add_compile_flags(/Zl)
|
||||
add_link_flags(/nodefaultlib)
|
||||
|
||||
add_library_flags(ucrt${LIB_SUFFIX}) # Universal C runtime
|
||||
add_library_flags(vcruntime${LIB_SUFFIX}) # C++ runtime
|
||||
add_library_flags(msvcrt${LIB_SUFFIX}) # C runtime startup files
|
||||
# Required for standards-complaint wide character formatting functions
|
||||
# (e.g. `printfw`/`scanfw`)
|
||||
add_library_flags(iso_stdio_wide_specifiers)
|
||||
endif()
|
||||
|
||||
if (LIBCXX_OSX_REEXPORT_SYSTEM_ABI_LIBRARY)
|
||||
if (NOT DEFINED LIBCXX_LIBCPPABI_VERSION)
|
||||
set(LIBCXX_LIBCPPABI_VERSION "2") # Default value
|
||||
@ -133,7 +155,7 @@ if (LIBCXX_OSX_REEXPORT_SYSTEM_ABI_LIBRARY)
|
||||
"-Wl,-unexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++unexp.exp"
|
||||
"/usr/lib/libSystem.B.dylib")
|
||||
else()
|
||||
if (DEFINED CMAKE_OSX_SYSROOT AND NOT CMAKE_OSX_SYSROOT STREQUAL "")
|
||||
if (DEFINED CMAKE_OSX_SYSROOT AND NOT CMAKE_OSX_SYSROOT STREQUAL "")
|
||||
list(FIND CMAKE_OSX_ARCHITECTURES "armv7" OSX_HAS_ARMV7)
|
||||
if (NOT OSX_HAS_ARMV7 EQUAL -1)
|
||||
set(OSX_RE_EXPORT_LINE
|
||||
@ -145,8 +167,10 @@ if (LIBCXX_OSX_REEXPORT_SYSTEM_ABI_LIBRARY)
|
||||
endif()
|
||||
else()
|
||||
set(OSX_RE_EXPORT_LINE "/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++abi${LIBCXX_LIBCPPABI_VERSION}.exp")
|
||||
if (NOT LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS)
|
||||
add_link_flags("/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++abi-new-delete.exp")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_link_flags(
|
||||
"-compatibility_version 1"
|
||||
"-install_name /usr/lib/libc++.1.dylib"
|
||||
@ -160,7 +184,7 @@ endif()
|
||||
split_list(LIBCXX_COMPILE_FLAGS)
|
||||
split_list(LIBCXX_LINK_FLAGS)
|
||||
|
||||
# Add a object library that contains the compiled source files.
|
||||
# Add an object library that contains the compiled source files.
|
||||
add_library(cxx_objects OBJECT ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
|
||||
if(WIN32 AND NOT MINGW)
|
||||
target_compile_definitions(cxx_objects
|
||||
@ -229,7 +253,8 @@ if (LIBCXX_ENABLE_STATIC)
|
||||
if (LIBCXX_CXX_ABI_LIBRARY_PATH)
|
||||
set(MERGE_ARCHIVES_SEARCH_PATHS "-L${LIBCXX_CXX_ABI_LIBRARY_PATH}")
|
||||
endif()
|
||||
if (TARGET ${LIBCXX_CXX_ABI_LIBRARY})
|
||||
if ((TARGET ${LIBCXX_CXX_ABI_LIBRARY}) OR
|
||||
(${LIBCXX_CXX_ABI_LIBRARY} STREQUAL "cxxabi(_static|_shared)?" AND HAVE_LIBCXXABI))
|
||||
set(MERGE_ARCHIVES_ABI_TARGET "$<TARGET_LINKER_FILE:${LIBCXX_CXX_ABI_LIBRARY}>")
|
||||
else()
|
||||
set(MERGE_ARCHIVES_ABI_TARGET
|
||||
@ -300,7 +325,9 @@ if (LIBCXX_ENABLE_SHARED AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
|
||||
set(LIBCXX_INTERFACE_LIBRARY_NAMES)
|
||||
foreach(lib ${LIBCXX_INTERFACE_LIBRARIES})
|
||||
# FIXME: Handle cxxabi_static and unwind_static.
|
||||
if (TARGET ${lib})
|
||||
if (TARGET ${lib} OR
|
||||
(${lib} MATCHES "cxxabi(_static|_shared)?" AND HAVE_LIBCXXABI) OR
|
||||
(${lib} MATCHES "unwind(_static|_shared)?" AND HAVE_LIBUNWIND))
|
||||
list(APPEND LIBCXX_INTERFACE_LIBRARY_NAMES "$<TARGET_PROPERTY:${lib},OUTPUT_NAME>")
|
||||
else()
|
||||
list(APPEND LIBCXX_INTERFACE_LIBRARY_NAMES "${lib}")
|
||||
@ -311,7 +338,7 @@ if (LIBCXX_ENABLE_SHARED AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
|
||||
# after cxx builds.
|
||||
add_custom_command(TARGET cxx_shared POST_BUILD
|
||||
COMMAND
|
||||
${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/gen_link_script/gen_link_script.py
|
||||
${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/gen_link_script.py
|
||||
ARGS
|
||||
"$<TARGET_LINKER_FILE:cxx_shared>"
|
||||
${LIBCXX_INTERFACE_LIBRARY_NAMES}
|
||||
|
@ -12,6 +12,42 @@ Afterwards the ABI list should be updated to include the new changes.
|
||||
|
||||
New entries should be added directly below the "Version" header.
|
||||
|
||||
-----------
|
||||
Version 5.0
|
||||
-----------
|
||||
|
||||
* r296729 - Remove std::num_get template methods which should be inline
|
||||
|
||||
These functions should never have had visible definitions in the dylib but
|
||||
since they were previously not specified with 'inline' they accidentally
|
||||
got emitted. This change is non-ABI breaking because every "linkage unit"
|
||||
must contain its own definition.
|
||||
|
||||
x86_64-linux-gnu
|
||||
----------------
|
||||
SYMBOL REMOVED: _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE15__do_get_signedIlEES4_S4_S4_RNS_8ios_baseERjRT_
|
||||
SYMBOL REMOVED: _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE15__do_get_signedIxEES4_S4_S4_RNS_8ios_baseERjRT_
|
||||
SYMBOL REMOVED: _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE17__do_get_unsignedIjEES4_S4_S4_RNS_8ios_baseERjRT_
|
||||
SYMBOL REMOVED: _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE17__do_get_unsignedImEES4_S4_S4_RNS_8ios_baseERjRT_
|
||||
SYMBOL REMOVED: _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE17__do_get_unsignedItEES4_S4_S4_RNS_8ios_baseERjRT_
|
||||
SYMBOL REMOVED: _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE17__do_get_unsignedIyEES4_S4_S4_RNS_8ios_baseERjRT_
|
||||
SYMBOL REMOVED: _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE23__do_get_floating_pointIdEES4_S4_S4_RNS_8ios_baseERjRT_
|
||||
SYMBOL REMOVED: _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE23__do_get_floating_pointIeEES4_S4_S4_RNS_8ios_baseERjRT_
|
||||
SYMBOL REMOVED: _ZNKSt3__17num_getIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE23__do_get_floating_pointIfEES4_S4_S4_RNS_8ios_baseERjRT_
|
||||
SYMBOL REMOVED: _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE15__do_get_signedIlEES4_S4_S4_RNS_8ios_baseERjRT_
|
||||
SYMBOL REMOVED: _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE15__do_get_signedIxEES4_S4_S4_RNS_8ios_baseERjRT_
|
||||
SYMBOL REMOVED: _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE17__do_get_unsignedIjEES4_S4_S4_RNS_8ios_baseERjRT_
|
||||
SYMBOL REMOVED: _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE17__do_get_unsignedImEES4_S4_S4_RNS_8ios_baseERjRT_
|
||||
SYMBOL REMOVED: _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE17__do_get_unsignedItEES4_S4_S4_RNS_8ios_baseERjRT_
|
||||
SYMBOL REMOVED: _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE17__do_get_unsignedIyEES4_S4_S4_RNS_8ios_baseERjRT_
|
||||
SYMBOL REMOVED: _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE23__do_get_floating_pointIdEES4_S4_S4_RNS_8ios_baseERjRT_
|
||||
SYMBOL REMOVED: _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE23__do_get_floating_pointIeEES4_S4_S4_RNS_8ios_baseERjRT_
|
||||
SYMBOL REMOVED: _ZNKSt3__17num_getIwNS_19istreambuf_iteratorIwNS_11char_traitsIwEEEEE23__do_get_floating_pointIfEES4_S4_S4_RNS_8ios_baseERjRT_
|
||||
|
||||
x86_64-apple-darwin16.0
|
||||
-----------------------
|
||||
No changes
|
||||
|
||||
-----------
|
||||
Version 4.0
|
||||
-----------
|
||||
@ -134,4 +170,17 @@ Version 4.0
|
||||
Symbol added: _ZTSSt12bad_any_cast
|
||||
Symbol added: _ZTVSt12bad_any_cast
|
||||
|
||||
|
||||
* r295398 - Remove basic_string::insert and basic_string::replace template methods
|
||||
which should be inline.
|
||||
|
||||
These functions should never have had visible definitions in the dylib but
|
||||
since they were previously not specified with 'inline' they accidentally
|
||||
got emitted. This change is non-ABI breaking because every "linkage unit"
|
||||
must contain its own definition.
|
||||
|
||||
x86_64-linux-gnu
|
||||
----------------
|
||||
SYMBOL REMOVED: _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6insertIPKcEENS_9enable_ifIXaasr21__is_forward_iteratorIT_EE5valuesr38__libcpp_string_gets_noexcept_iteratorISA_EE5valueENS_11__wrap_iterIPcEEE4typeENSB_IS8_EESA_SA_
|
||||
SYMBOL REMOVED: _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceIPKcEENS_9enable_ifIXsr19__is_input_iteratorIT_EE5valueERS5_E4typeENS_11__wrap_iterIS8_EESF_SA_SA_
|
||||
SYMBOL REMOVED: _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6insertIPKwEENS_9enable_ifIXaasr21__is_forward_iteratorIT_EE5valuesr38__libcpp_string_gets_noexcept_iteratorISA_EE5valueENS_11__wrap_iterIPwEEE4typeENSB_IS8_EESA_SA_
|
||||
SYMBOL REMOVED: _ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE7replaceIPKwEENS_9enable_ifIXsr19__is_input_iteratorIT_EE5valueERS5_E4typeENS_11__wrap_iterIS8_EESF_SA_SA_
|
||||
|
@ -1,8 +1,15 @@
|
||||
|
||||
if (DEFINED TARGET_TRIPLE)
|
||||
# Ignore the minor and patchlevel versions of the darwin
|
||||
# target.
|
||||
string(REGEX REPLACE "darwin16\\.[0-9]\\.[0-9]" "darwin16"
|
||||
GENERIC_TARGET_TRIPLE "${TARGET_TRIPLE}")
|
||||
endif()
|
||||
|
||||
# Detect if we are building in the same configuration used to generate
|
||||
# the abilist files.
|
||||
if (DEFINED TARGET_TRIPLE
|
||||
AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/${TARGET_TRIPLE}.abilist"
|
||||
if (DEFINED GENERIC_TARGET_TRIPLE
|
||||
AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/${GENERIC_TARGET_TRIPLE}.abilist"
|
||||
AND TARGET cxx_shared
|
||||
AND ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxabi" OR
|
||||
(APPLE AND "${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "default"))
|
||||
@ -19,10 +26,11 @@ endif()
|
||||
|
||||
|
||||
if (LIBCXX_HAS_ABILIST_CONFIGURATION)
|
||||
set(ABILIST_FILE "${CMAKE_CURRENT_LIST_DIR}/${TARGET_TRIPLE}.abilist")
|
||||
set(SYMDIFF_EXE "${LIBCXX_SOURCE_DIR}/utils/sym_check/sym_diff.py")
|
||||
set(ABILIST_FILE "${CMAKE_CURRENT_LIST_DIR}/${GENERIC_TARGET_TRIPLE}.abilist")
|
||||
set(SYMDIFF_EXE "${LIBCXX_SOURCE_DIR}/utils/sym_diff.py")
|
||||
add_custom_target(check-cxx-abilist
|
||||
${SYMDIFF_EXE} --only-stdlib-symbols ${ABILIST_FILE} $<TARGET_SONAME_FILE:cxx_shared>
|
||||
${SYMDIFF_EXE} --only-stdlib-symbols --strict ${ABILIST_FILE}
|
||||
$<TARGET_SONAME_FILE:cxx_shared>
|
||||
DEPENDS cxx_shared
|
||||
COMMENT "Testing ABI compatibility...")
|
||||
endif()
|
||||
|
File diff suppressed because it is too large
Load Diff
179
lib/buildit
179
lib/buildit
@ -1,179 +0,0 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Set the $TRIPLE environment variable to your system's triple before
|
||||
# running this script. If you set $CXX, that will be used to compile
|
||||
# the library. Otherwise we'll use clang++.
|
||||
|
||||
set -e
|
||||
|
||||
if [ `basename $(pwd)` != "lib" ]
|
||||
then
|
||||
echo "current directory must be lib"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$CXX" ]
|
||||
then
|
||||
CXX=clang++
|
||||
fi
|
||||
|
||||
if [ -z "$CXX_LANG" ]
|
||||
then
|
||||
CXX_LANG=c++11
|
||||
fi
|
||||
|
||||
if [ -z "$CC" ]
|
||||
then
|
||||
CC=clang
|
||||
fi
|
||||
|
||||
if [ -z "$MACOSX_DEPLOYMENT_TARGET" ]
|
||||
then
|
||||
if [ -z "$IPHONEOS_DEPLOYMENT_TARGET" ]
|
||||
then
|
||||
MACOSX_DEPLOYMENT_TARGET=10.7
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$RC_ProjectSourceVersion" ]
|
||||
then
|
||||
RC_ProjectSourceVersion=1
|
||||
fi
|
||||
|
||||
EXTRA_FLAGS="-nostdinc++ -std=${CXX_LANG} -fstrict-aliasing -Wall -Wextra -Wshadow -Wconversion \
|
||||
-Wstrict-aliasing=2 -Wstrict-overflow=4 -D_LIBCPP_BUILDING_LIBRARY "
|
||||
|
||||
case $TRIPLE in
|
||||
*-apple-*)
|
||||
if [ -z $RC_XBS ]
|
||||
then
|
||||
RC_CFLAGS="-arch i386 -arch x86_64"
|
||||
fi
|
||||
SOEXT=dylib
|
||||
if [ "$MACOSX_DEPLOYMENT_TARGET" = "10.6" ]
|
||||
then
|
||||
EXTRA_FLAGS="-nostdinc++ -std=c++11 -U__STRICT_ANSI__"
|
||||
LDSHARED_FLAGS="-o libc++.1.dylib \
|
||||
-dynamiclib -nodefaultlibs -current_version 1 \
|
||||
-compatibility_version 1 \
|
||||
-install_name /usr/lib/libc++.1.dylib \
|
||||
-Wl,-reexport_library,/usr/lib/libc++abi.dylib \
|
||||
-Wl,-unexported_symbols_list,libc++unexp.exp \
|
||||
/usr/lib/libSystem.B.dylib"
|
||||
else
|
||||
if [ -n "$SDKROOT" ]
|
||||
then
|
||||
EXTRA_FLAGS+="-isysroot ${SDKROOT} "
|
||||
if echo "${RC_ARCHS}" | grep -q "armv7"
|
||||
then
|
||||
RE_EXPORT_LINE="${SDKROOT}/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,libc++sjlj-abi.exp"
|
||||
else
|
||||
RE_EXPORT_LINE="-Wl,-reexport_library,${SDKROOT}/usr/lib/libc++abi.dylib"
|
||||
fi
|
||||
CXX=`xcrun -sdk "${SDKROOT}" -find clang++`
|
||||
CC=`xcrun -sdk "${SDKROOT}" -find clang`
|
||||
else
|
||||
# Check if we have _LIBCPPABI_VERSION, to determine the reexport list to use.
|
||||
if (echo "#include <cxxabi.h>" | $CXX -E -dM -x c++ - | \
|
||||
grep _LIBCPPABI_VERSION > /dev/null)
|
||||
then
|
||||
RE_EXPORT_LINE="/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,libc++abi2.exp"
|
||||
else
|
||||
RE_EXPORT_LINE="/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,libc++abi.exp"
|
||||
fi
|
||||
fi
|
||||
LDSHARED_FLAGS="-o libc++.1.dylib \
|
||||
-dynamiclib -nodefaultlibs \
|
||||
-current_version ${RC_ProjectSourceVersion} \
|
||||
-compatibility_version 1 \
|
||||
-install_name /usr/lib/libc++.1.dylib \
|
||||
-lSystem \
|
||||
-Wl,-unexported_symbols_list,libc++unexp.exp \
|
||||
${RE_EXPORT_LINE} \
|
||||
-Wl,-force_symbols_not_weak_list,notweak.exp \
|
||||
-Wl,-force_symbols_weak_list,weak.exp"
|
||||
fi
|
||||
;;
|
||||
*-*-mingw*)
|
||||
# FIXME: removing libgcc and libsupc++ dependencies means porting libcxxrt and LLVM/compiler-rt
|
||||
SOEXT=dll
|
||||
LDSHARED_FLAGS="-o libc++.dll \
|
||||
-shared -nodefaultlibs -Wl,--export-all-symbols -Wl,--allow-multiple-definition -Wl,--out-implib,libc++.dll.a \
|
||||
-lsupc++ -lpthread -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcr100 -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt"
|
||||
;;
|
||||
*-ibm-*)
|
||||
hostOS=`uname`
|
||||
hostOS=`echo $hostOS | sed -e "s/\s+$//"`
|
||||
hostOS=`echo $hostOS | tr '[A-Z]' '[a-z]'`
|
||||
|
||||
if [ $hostOS = "linux" ]
|
||||
then
|
||||
LDSHARED_FLAGS="-o libc++.so.1 \
|
||||
-qmkshrobj -Wl,-soname,libc++.so.1 \
|
||||
-lpthread -lrt -lc -lstdc++"
|
||||
EXTRA_FLAGS="-qlanglvl=extended0x -D__GLIBCXX__=1"
|
||||
else
|
||||
LDSHARED_FLAGS="-o shr.o -qmkshrobj -lpthread -bnoquiet"
|
||||
EXTRA_FLAGS="-qlanglvl=extended0x"
|
||||
fi
|
||||
RC_CFLAGS="-qpic=large"
|
||||
;;
|
||||
*)
|
||||
RC_CFLAGS="-fPIC"
|
||||
SOEXT=so
|
||||
LDSHARED_FLAGS="-o libc++.so.1.0 \
|
||||
-shared -nodefaultlibs -Wl,-soname,libc++.so.1 \
|
||||
-lpthread -lrt -lc -lstdc++"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$RC_XBS" ]
|
||||
then
|
||||
rm -f libc++.1.$SOEXT*
|
||||
fi
|
||||
|
||||
set -x
|
||||
|
||||
for FILE in ../src/*.cpp; do
|
||||
$CXX -c -g -Os $RC_CFLAGS $EXTRA_FLAGS -I../include $FILE
|
||||
done
|
||||
case $TRIPLE in
|
||||
*-*-mingw*)
|
||||
for FILE in ../src/support/win32/*.cpp; do
|
||||
$CXX -c -g -Os $RC_CFLAGS $EXTRA_FLAGS -I../include $FILE
|
||||
done
|
||||
;;
|
||||
esac
|
||||
$CC *.o $RC_CFLAGS $LDSHARED_FLAGS $EXTRA_FLAGS
|
||||
|
||||
#libtool -static -o libc++.a *.o
|
||||
|
||||
# Create the link for the final library name, so that we can use this directory
|
||||
# as a link target for the tests.
|
||||
case $TRIPLE in
|
||||
*-apple-*)
|
||||
rm -f libc++.dylib
|
||||
ln -s libc++.1.dylib libc++.dylib
|
||||
;;
|
||||
*-*-mingw*)
|
||||
;;
|
||||
*-ibm-*)
|
||||
if [ $hostOS = "linux" ]
|
||||
then
|
||||
rm -f libc++.so
|
||||
ln -s libc++.so.1 libc++.so
|
||||
else #AIX
|
||||
rm -f libc++.a
|
||||
ar r libc++.a shr.o
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
rm -f libc++.so
|
||||
ln -s libc++.so.1 libc++.so
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$RC_XBS" ]
|
||||
then
|
||||
rm *.o
|
||||
fi
|
8
lib/libc++abi-new-delete.exp
Normal file
8
lib/libc++abi-new-delete.exp
Normal file
@ -0,0 +1,8 @@
|
||||
__ZdaPv
|
||||
__ZdlPv
|
||||
__ZdlPvRKSt9nothrow_t
|
||||
__Znam
|
||||
__ZdaPvRKSt9nothrow_t
|
||||
__Znwm
|
||||
__ZnwmRKSt9nothrow_t
|
||||
__ZnamRKSt9nothrow_t
|
@ -209,14 +209,6 @@ __ZNSt20bad_array_new_lengthC2Ev
|
||||
__ZNSt20bad_array_new_lengthD0Ev
|
||||
__ZNSt20bad_array_new_lengthD2Ev
|
||||
__ZSt10unexpectedv
|
||||
# __ZdaPv
|
||||
# __ZdlPv
|
||||
# __ZdlPvRKSt9nothrow_t
|
||||
# __Znam
|
||||
# __ZdaPvRKSt9nothrow_t
|
||||
# __Znwm
|
||||
# __ZnwmRKSt9nothrow_t
|
||||
# __ZnamRKSt9nothrow_t
|
||||
__ZTISt10bad_typeid
|
||||
__ZTISt8bad_cast
|
||||
___cxa_bad_typeid
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "condition_variable"
|
||||
#include "thread"
|
||||
#include "system_error"
|
||||
#include "cassert"
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
@ -6,328 +6,31 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "exception"
|
||||
#include "new"
|
||||
#include "typeinfo"
|
||||
|
||||
#if defined(_LIBCPP_ABI_MICROSOFT)
|
||||
#include <eh.h>
|
||||
#include <corecrt_terminate.h>
|
||||
#elif defined(__APPLE__) && !defined(LIBCXXRT) && \
|
||||
!defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY)
|
||||
#if defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI) || \
|
||||
(defined(__APPLE__) && !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY))
|
||||
#include <cxxabi.h>
|
||||
|
||||
using namespace __cxxabiv1;
|
||||
#define HAVE_DEPENDENT_EH_ABI 1
|
||||
#ifndef _LIBCPPABI_VERSION
|
||||
using namespace __cxxabiapple;
|
||||
// On Darwin, there are two STL shared libraries and a lower level ABI
|
||||
// shared library. The globals holding the current terminate handler and
|
||||
// current unexpected handler are in the ABI library.
|
||||
#define __terminate_handler __cxxabiapple::__cxa_terminate_handler
|
||||
#define __unexpected_handler __cxxabiapple::__cxa_unexpected_handler
|
||||
#endif // _LIBCPPABI_VERSION
|
||||
#elif defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI)
|
||||
#include <cxxabi.h>
|
||||
using namespace __cxxabiv1;
|
||||
#if defined(LIBCXXRT) || defined(_LIBCPPABI_VERSION)
|
||||
#define HAVE_DEPENDENT_EH_ABI 1
|
||||
#endif
|
||||
#elif !defined(__GLIBCXX__) // defined(LIBCXX_BUILDING_LIBCXXABI)
|
||||
_LIBCPP_SAFE_STATIC static std::terminate_handler __terminate_handler;
|
||||
_LIBCPP_SAFE_STATIC static std::unexpected_handler __unexpected_handler;
|
||||
#endif // defined(LIBCXX_BUILDING_LIBCXXABI)
|
||||
#endif
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
#if !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION) && !defined(__GLIBCXX__)
|
||||
|
||||
// libcxxrt provides implementations of these functions itself.
|
||||
unexpected_handler
|
||||
set_unexpected(unexpected_handler func) _NOEXCEPT
|
||||
{
|
||||
#if defined(_LIBCPP_ABI_MICROSOFT)
|
||||
return ::set_unexpected(func);
|
||||
#else
|
||||
return __sync_lock_test_and_set(&__unexpected_handler, func);
|
||||
#endif
|
||||
}
|
||||
|
||||
unexpected_handler
|
||||
get_unexpected() _NOEXCEPT
|
||||
{
|
||||
#if defined(_LIBCPP_ABI_MICROSOFT)
|
||||
return ::_get_unexpected();
|
||||
#else
|
||||
return __sync_fetch_and_add(&__unexpected_handler, (unexpected_handler)0);
|
||||
#endif
|
||||
}
|
||||
|
||||
_LIBCPP_NORETURN
|
||||
void
|
||||
unexpected()
|
||||
{
|
||||
(*get_unexpected())();
|
||||
// unexpected handler should not return
|
||||
terminate();
|
||||
}
|
||||
|
||||
terminate_handler
|
||||
set_terminate(terminate_handler func) _NOEXCEPT
|
||||
{
|
||||
#if defined(_LIBCPP_ABI_MICROSOFT)
|
||||
return ::set_terminate(func);
|
||||
#else
|
||||
return __sync_lock_test_and_set(&__terminate_handler, func);
|
||||
#endif
|
||||
}
|
||||
|
||||
terminate_handler
|
||||
get_terminate() _NOEXCEPT
|
||||
{
|
||||
#if defined(_LIBCPP_ABI_MICROSOFT)
|
||||
return ::_get_terminate();
|
||||
#else
|
||||
return __sync_fetch_and_add(&__terminate_handler, (terminate_handler)0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef __EMSCRIPTEN__ // We provide this in JS
|
||||
_LIBCPP_NORETURN
|
||||
void
|
||||
terminate() _NOEXCEPT
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
(*get_terminate())();
|
||||
// handler should not return
|
||||
fprintf(stderr, "terminate_handler unexpectedly returned\n");
|
||||
::abort();
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// handler should not throw exception
|
||||
fprintf(stderr, "terminate_handler unexpectedly threw an exception\n");
|
||||
::abort();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
#endif // !__EMSCRIPTEN__
|
||||
#endif // !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION)
|
||||
|
||||
#if !defined(LIBCXXRT) && !defined(__GLIBCXX__) && !defined(__EMSCRIPTEN__)
|
||||
|
||||
bool uncaught_exception() _NOEXCEPT { return uncaught_exceptions() > 0; }
|
||||
|
||||
int uncaught_exceptions() _NOEXCEPT
|
||||
{
|
||||
#if !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) && \
|
||||
(defined(__APPLE__) || defined(_LIBCPPABI_VERSION))
|
||||
// on Darwin, there is a helper function so __cxa_get_globals is private
|
||||
# if _LIBCPPABI_VERSION > 1101
|
||||
return __cxa_uncaught_exceptions();
|
||||
# else
|
||||
return __cxa_uncaught_exception() ? 1 : 0;
|
||||
# endif
|
||||
#elif defined(_LIBCPP_ABI_MICROSOFT)
|
||||
return __uncaught_exceptions();
|
||||
#else
|
||||
# if defined(_MSC_VER) && ! defined(__clang__)
|
||||
_LIBCPP_WARNING("uncaught_exceptions not yet implemented")
|
||||
# else
|
||||
# warning uncaught_exception not yet implemented
|
||||
# endif
|
||||
fprintf(stderr, "uncaught_exceptions not yet implemented\n");
|
||||
::abort();
|
||||
#endif // __APPLE__
|
||||
}
|
||||
|
||||
|
||||
#ifndef _LIBCPPABI_VERSION
|
||||
|
||||
exception::~exception() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
const char* exception::what() const _NOEXCEPT
|
||||
{
|
||||
return "std::exception";
|
||||
}
|
||||
|
||||
#endif // _LIBCPPABI_VERSION
|
||||
#endif //LIBCXXRT
|
||||
#if !defined(_LIBCPPABI_VERSION) && !defined(__GLIBCXX__)
|
||||
|
||||
bad_exception::~bad_exception() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
const char* bad_exception::what() const _NOEXCEPT
|
||||
{
|
||||
return "std::bad_exception";
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__GLIBCXX__)
|
||||
|
||||
// libsupc++ does not implement the dependent EH ABI and the functionality
|
||||
// it uses to implement std::exception_ptr (which it declares as an alias of
|
||||
// std::__exception_ptr::exception_ptr) is not directly exported to clients. So
|
||||
// we have little choice but to hijack std::__exception_ptr::exception_ptr's
|
||||
// (which fortunately has the same layout as our std::exception_ptr) copy
|
||||
// constructor, assignment operator and destructor (which are part of its
|
||||
// stable ABI), and its rethrow_exception(std::__exception_ptr::exception_ptr)
|
||||
// function.
|
||||
|
||||
namespace __exception_ptr
|
||||
{
|
||||
|
||||
struct exception_ptr
|
||||
{
|
||||
void* __ptr_;
|
||||
|
||||
exception_ptr(const exception_ptr&) _NOEXCEPT;
|
||||
exception_ptr& operator=(const exception_ptr&) _NOEXCEPT;
|
||||
~exception_ptr() _NOEXCEPT;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
_LIBCPP_NORETURN void rethrow_exception(__exception_ptr::exception_ptr);
|
||||
|
||||
#endif
|
||||
|
||||
exception_ptr::~exception_ptr() _NOEXCEPT
|
||||
{
|
||||
#if HAVE_DEPENDENT_EH_ABI
|
||||
__cxa_decrement_exception_refcount(__ptr_);
|
||||
#include "support/runtime/exception_msvc.ipp"
|
||||
#include "support/runtime/exception_pointer_unimplemented.ipp"
|
||||
#elif defined(_LIBCPPABI_VERSION)
|
||||
#include "support/runtime/exception_libcxxabi.ipp"
|
||||
#include "support/runtime/exception_pointer_cxxabi.ipp"
|
||||
#elif defined(LIBCXXRT)
|
||||
#include "support/runtime/exception_libcxxrt.ipp"
|
||||
#include "support/runtime/exception_pointer_cxxabi.ipp"
|
||||
#elif defined(__GLIBCXX__)
|
||||
reinterpret_cast<__exception_ptr::exception_ptr*>(this)->~exception_ptr();
|
||||
#include "support/runtime/exception_glibcxx.ipp"
|
||||
#include "support/runtime/exception_pointer_glibcxx.ipp"
|
||||
#else
|
||||
# if defined(_MSC_VER) && ! defined(__clang__)
|
||||
_LIBCPP_WARNING("exception_ptr not yet implemented")
|
||||
# else
|
||||
# warning exception_ptr not yet implemented
|
||||
# endif
|
||||
fprintf(stderr, "exception_ptr not yet implemented\n");
|
||||
::abort();
|
||||
#include "support/runtime/exception_fallback.ipp"
|
||||
#include "support/runtime/exception_pointer_unimplemented.ipp"
|
||||
#endif
|
||||
}
|
||||
|
||||
exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT
|
||||
: __ptr_(other.__ptr_)
|
||||
{
|
||||
#if HAVE_DEPENDENT_EH_ABI
|
||||
__cxa_increment_exception_refcount(__ptr_);
|
||||
#elif defined(__GLIBCXX__)
|
||||
new (reinterpret_cast<void*>(this)) __exception_ptr::exception_ptr(
|
||||
reinterpret_cast<const __exception_ptr::exception_ptr&>(other));
|
||||
#else
|
||||
# if defined(_MSC_VER) && ! defined(__clang__)
|
||||
_LIBCPP_WARNING("exception_ptr not yet implemented")
|
||||
# else
|
||||
# warning exception_ptr not yet implemented
|
||||
# endif
|
||||
fprintf(stderr, "exception_ptr not yet implemented\n");
|
||||
::abort();
|
||||
#endif
|
||||
}
|
||||
|
||||
exception_ptr& exception_ptr::operator=(const exception_ptr& other) _NOEXCEPT
|
||||
{
|
||||
#if HAVE_DEPENDENT_EH_ABI
|
||||
if (__ptr_ != other.__ptr_)
|
||||
{
|
||||
__cxa_increment_exception_refcount(other.__ptr_);
|
||||
__cxa_decrement_exception_refcount(__ptr_);
|
||||
__ptr_ = other.__ptr_;
|
||||
}
|
||||
return *this;
|
||||
#elif defined(__GLIBCXX__)
|
||||
*reinterpret_cast<__exception_ptr::exception_ptr*>(this) =
|
||||
reinterpret_cast<const __exception_ptr::exception_ptr&>(other);
|
||||
return *this;
|
||||
#else
|
||||
# if defined(_MSC_VER) && ! defined(__clang__)
|
||||
_LIBCPP_WARNING("exception_ptr not yet implemented")
|
||||
# else
|
||||
# warning exception_ptr not yet implemented
|
||||
# endif
|
||||
fprintf(stderr, "exception_ptr not yet implemented\n");
|
||||
::abort();
|
||||
#endif
|
||||
}
|
||||
|
||||
nested_exception::nested_exception() _NOEXCEPT
|
||||
: __ptr_(current_exception())
|
||||
{
|
||||
}
|
||||
|
||||
#if !defined(__GLIBCXX__)
|
||||
|
||||
nested_exception::~nested_exception() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
_LIBCPP_NORETURN
|
||||
void
|
||||
nested_exception::rethrow_nested() const
|
||||
{
|
||||
if (__ptr_ == nullptr)
|
||||
terminate();
|
||||
rethrow_exception(__ptr_);
|
||||
}
|
||||
|
||||
#if !defined(__GLIBCXX__)
|
||||
|
||||
exception_ptr current_exception() _NOEXCEPT
|
||||
{
|
||||
#if HAVE_DEPENDENT_EH_ABI
|
||||
// be nicer if there was a constructor that took a ptr, then
|
||||
// this whole function would be just:
|
||||
// return exception_ptr(__cxa_current_primary_exception());
|
||||
exception_ptr ptr;
|
||||
ptr.__ptr_ = __cxa_current_primary_exception();
|
||||
return ptr;
|
||||
#else
|
||||
# if defined(_MSC_VER) && ! defined(__clang__)
|
||||
_LIBCPP_WARNING( "exception_ptr not yet implemented" )
|
||||
# else
|
||||
# warning exception_ptr not yet implemented
|
||||
# endif
|
||||
fprintf(stderr, "exception_ptr not yet implemented\n");
|
||||
::abort();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // !__GLIBCXX__
|
||||
|
||||
_LIBCPP_NORETURN
|
||||
void rethrow_exception(exception_ptr p)
|
||||
{
|
||||
#if HAVE_DEPENDENT_EH_ABI
|
||||
__cxa_rethrow_primary_exception(p.__ptr_);
|
||||
// if p.__ptr_ is NULL, above returns so we terminate
|
||||
terminate();
|
||||
#elif defined(__GLIBCXX__)
|
||||
rethrow_exception(reinterpret_cast<__exception_ptr::exception_ptr&>(p));
|
||||
#else
|
||||
# if defined(_MSC_VER) && ! defined(__clang__)
|
||||
_LIBCPP_WARNING("exception_ptr not yet implemented")
|
||||
# else
|
||||
# warning exception_ptr not yet implemented
|
||||
# endif
|
||||
fprintf(stderr, "exception_ptr not yet implemented\n");
|
||||
::abort();
|
||||
#endif
|
||||
}
|
||||
} // std
|
||||
|
@ -1,28 +1,32 @@
|
||||
//===------------------ directory_iterator.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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "experimental/filesystem"
|
||||
#include "__config"
|
||||
#if defined(_LIBCPP_WIN32API)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM
|
||||
|
||||
namespace { namespace detail {
|
||||
|
||||
#if !defined(_LIBCPP_WIN32API)
|
||||
inline error_code capture_errno() {
|
||||
_LIBCPP_ASSERT(errno, "Expected errno to be non-zero");
|
||||
return error_code{errno, std::generic_category()};
|
||||
}
|
||||
|
||||
template <class ...Args>
|
||||
inline bool capture_error_or_throw(std::error_code* user_ec,
|
||||
const char* msg, Args&&... args)
|
||||
{
|
||||
std::error_code my_ec = capture_errno();
|
||||
if (user_ec) {
|
||||
*user_ec = my_ec;
|
||||
return true;
|
||||
}
|
||||
__throw_filesystem_error(msg, std::forward<Args>(args)..., my_ec);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class ...Args>
|
||||
inline bool set_or_throw(std::error_code& my_ec,
|
||||
@ -37,25 +41,87 @@ inline bool set_or_throw(std::error_code& my_ec,
|
||||
return false;
|
||||
}
|
||||
|
||||
typedef path::string_type string_type;
|
||||
|
||||
|
||||
inline string_type posix_readdir(DIR *dir_stream, error_code& ec) {
|
||||
#if !defined(_LIBCPP_WIN32API)
|
||||
inline path::string_type posix_readdir(DIR *dir_stream, error_code& ec) {
|
||||
struct dirent* dir_entry_ptr = nullptr;
|
||||
errno = 0; // zero errno in order to detect errors
|
||||
ec.clear();
|
||||
if ((dir_entry_ptr = ::readdir(dir_stream)) == nullptr) {
|
||||
ec = capture_errno();
|
||||
if (errno)
|
||||
ec = capture_errno();
|
||||
return {};
|
||||
} else {
|
||||
ec.clear();
|
||||
return dir_entry_ptr->d_name;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}} // namespace detail
|
||||
|
||||
using detail::set_or_throw;
|
||||
|
||||
#if defined(_LIBCPP_WIN32API)
|
||||
class __dir_stream {
|
||||
public:
|
||||
__dir_stream() = delete;
|
||||
__dir_stream& operator=(const __dir_stream&) = delete;
|
||||
|
||||
__dir_stream(__dir_stream&& __ds) noexcept
|
||||
: __stream_(__ds.__stream_), __root_(std::move(__ds.__root_)),
|
||||
__entry_(std::move(__ds.__entry_)) {
|
||||
__ds.__stream_ = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
__dir_stream(const path& root, directory_options opts, error_code& ec)
|
||||
: __stream_(INVALID_HANDLE_VALUE), __root_(root) {
|
||||
__stream_ = ::FindFirstFile(root.c_str(), &__data_);
|
||||
if (__stream_ == INVALID_HANDLE_VALUE) {
|
||||
ec = error_code(::GetLastError(), std::generic_category());
|
||||
const bool ignore_permission_denied =
|
||||
bool(opts & directory_options::skip_permission_denied);
|
||||
if (ignore_permission_denied && ec.value() == ERROR_ACCESS_DENIED)
|
||||
ec.clear();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
~__dir_stream() noexcept {
|
||||
if (__stream_ == INVALID_HANDLE_VALUE)
|
||||
return;
|
||||
close();
|
||||
}
|
||||
|
||||
bool good() const noexcept { return __stream_ != INVALID_HANDLE_VALUE; }
|
||||
|
||||
bool advance(error_code& ec) {
|
||||
while (::FindNextFile(__stream_, &__data_)) {
|
||||
if (!strcmp(__data_.cFileName, ".") || strcmp(__data_.cFileName, ".."))
|
||||
continue;
|
||||
__entry_.assign(__root_ / __data_.cFileName);
|
||||
return true;
|
||||
}
|
||||
ec = error_code(::GetLastError(), std::generic_category());
|
||||
close();
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
std::error_code close() noexcept {
|
||||
std::error_code ec;
|
||||
if (!::FindClose(__stream_))
|
||||
ec = error_code(::GetLastError(), std::generic_category());
|
||||
__stream_ = INVALID_HANDLE_VALUE;
|
||||
return ec;
|
||||
}
|
||||
|
||||
HANDLE __stream_{INVALID_HANDLE_VALUE};
|
||||
WIN32_FIND_DATA __data_;
|
||||
|
||||
public:
|
||||
path __root_;
|
||||
directory_entry __entry_;
|
||||
};
|
||||
#else
|
||||
class __dir_stream {
|
||||
public:
|
||||
__dir_stream() = delete;
|
||||
@ -117,6 +183,7 @@ public:
|
||||
path __root_;
|
||||
directory_entry __entry_;
|
||||
};
|
||||
#endif
|
||||
|
||||
// directory_iterator
|
||||
|
||||
@ -149,7 +216,7 @@ directory_iterator& directory_iterator::__increment(error_code *ec)
|
||||
|
||||
}
|
||||
|
||||
directory_entry const& directory_iterator::__deref() const {
|
||||
directory_entry const& directory_iterator::__dereference() const {
|
||||
_LIBCPP_ASSERT(__imp_, "Attempting to dereference an invalid iterator");
|
||||
return __imp_->__entry_;
|
||||
}
|
||||
@ -195,7 +262,7 @@ int recursive_directory_iterator::depth() const {
|
||||
return __imp_->__stack_.size() - 1;
|
||||
}
|
||||
|
||||
const directory_entry& recursive_directory_iterator::__deref() const {
|
||||
const directory_entry& recursive_directory_iterator::__dereference() const {
|
||||
return __imp_->__stack_.top().__entry_;
|
||||
}
|
||||
|
||||
|
@ -35,12 +35,9 @@ namespace detail { namespace {
|
||||
using value_type = path::value_type;
|
||||
using string_type = path::string_type;
|
||||
|
||||
|
||||
|
||||
inline std::error_code capture_errno() {
|
||||
_LIBCPP_ASSERT(errno, "Expected errno to be non-zero");
|
||||
std::error_code m_ec(errno, std::generic_category());
|
||||
return m_ec;
|
||||
_LIBCPP_ASSERT(errno, "Expected errno to be non-zero");
|
||||
return std::error_code(errno, std::generic_category());
|
||||
}
|
||||
|
||||
void set_or_throw(std::error_code const& m_ec, std::error_code* ec,
|
||||
@ -886,23 +883,28 @@ path __system_complete(const path& p, std::error_code *ec) {
|
||||
return absolute(p, current_path());
|
||||
}
|
||||
|
||||
path __temp_directory_path(std::error_code *ec) {
|
||||
const char* env_paths[] = {"TMPDIR", "TMP", "TEMP", "TEMPDIR"};
|
||||
const char* ret = nullptr;
|
||||
for (auto & ep : env_paths) {
|
||||
if ((ret = std::getenv(ep)))
|
||||
break;
|
||||
}
|
||||
path p(ret ? ret : "/tmp");
|
||||
std::error_code m_ec;
|
||||
if (is_directory(p, m_ec)) {
|
||||
if (ec) ec->clear();
|
||||
return p;
|
||||
}
|
||||
path __temp_directory_path(std::error_code* ec) {
|
||||
const char* env_paths[] = {"TMPDIR", "TMP", "TEMP", "TEMPDIR"};
|
||||
const char* ret = nullptr;
|
||||
|
||||
for (auto& ep : env_paths)
|
||||
if ((ret = std::getenv(ep)))
|
||||
break;
|
||||
if (ret == nullptr)
|
||||
ret = "/tmp";
|
||||
|
||||
path p(ret);
|
||||
std::error_code m_ec;
|
||||
if (!exists(p, m_ec) || !is_directory(p, m_ec)) {
|
||||
if (!m_ec || m_ec == make_error_code(errc::no_such_file_or_directory))
|
||||
m_ec = make_error_code(errc::not_a_directory);
|
||||
m_ec = make_error_code(errc::not_a_directory);
|
||||
set_or_throw(m_ec, ec, "temp_directory_path");
|
||||
return {};
|
||||
}
|
||||
|
||||
if (ec)
|
||||
ec->clear();
|
||||
return p;
|
||||
}
|
||||
|
||||
// An absolute path is composed according to the table in [fs.op.absolute].
|
||||
|
@ -6,11 +6,9 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
#undef NDEBUG
|
||||
#include "experimental/filesystem"
|
||||
#include "string_view"
|
||||
#include "utility"
|
||||
#include "cassert"
|
||||
|
||||
namespace { namespace parser
|
||||
{
|
||||
@ -58,13 +56,13 @@ public:
|
||||
}
|
||||
|
||||
PosPtr peek() const noexcept {
|
||||
auto End = &Path.back() + 1;
|
||||
auto TkEnd = getNextTokenStartPos();
|
||||
auto End = getAfterBack();
|
||||
return TkEnd == End ? nullptr : TkEnd;
|
||||
}
|
||||
|
||||
void increment() noexcept {
|
||||
const PosPtr End = &Path.back() + 1;
|
||||
const PosPtr End = getAfterBack();
|
||||
const PosPtr Start = getNextTokenStartPos();
|
||||
if (Start == End)
|
||||
return makeState(PS_AtEnd);
|
||||
@ -111,9 +109,8 @@ public:
|
||||
}
|
||||
|
||||
void decrement() noexcept {
|
||||
const PosPtr REnd = &Path.front() - 1;
|
||||
const PosPtr REnd = getBeforeFront();
|
||||
const PosPtr RStart = getCurrentTokenStartPos() - 1;
|
||||
assert(RStart != REnd);
|
||||
|
||||
switch (State) {
|
||||
case PS_AtEnd: {
|
||||
@ -198,19 +195,27 @@ private:
|
||||
RawEntry = {};
|
||||
}
|
||||
|
||||
PosPtr getAfterBack() const noexcept {
|
||||
return Path.data() + Path.size();
|
||||
}
|
||||
|
||||
PosPtr getBeforeFront() const noexcept {
|
||||
return Path.data() - 1;
|
||||
}
|
||||
|
||||
/// \brief Return a pointer to the first character after the currently
|
||||
/// lexed element.
|
||||
PosPtr getNextTokenStartPos() const noexcept {
|
||||
switch (State) {
|
||||
case PS_BeforeBegin:
|
||||
return &Path.front();
|
||||
return Path.data();
|
||||
case PS_InRootName:
|
||||
case PS_InRootDir:
|
||||
case PS_InFilenames:
|
||||
return &RawEntry.back() + 1;
|
||||
case PS_InTrailingSep:
|
||||
case PS_AtEnd:
|
||||
return &Path.back() + 1;
|
||||
return getAfterBack();
|
||||
}
|
||||
_LIBCPP_UNREACHABLE();
|
||||
}
|
||||
@ -322,7 +327,6 @@ string_view_t path::__root_path_raw() const
|
||||
auto NextCh = PP.peek();
|
||||
if (NextCh && *NextCh == '/') {
|
||||
++PP;
|
||||
assert(PP.State == PathParser::PS_InRootDir);
|
||||
return createView(__pn_.data(), &PP.RawEntry.back());
|
||||
}
|
||||
return PP.RawEntry;
|
||||
|
26
src/functional.cpp
Normal file
26
src/functional.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
//===----------------------- functional.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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "functional"
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
|
||||
bad_function_call::~bad_function_call() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
const char*
|
||||
bad_function_call::what() const _NOEXCEPT
|
||||
{
|
||||
return "std::bad_function_call";
|
||||
}
|
||||
#endif
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
@ -29,7 +29,7 @@
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && !defined(_LIBCPP_HAS_NO_THREADS)
|
||||
# if defined(_MSC_VER) && !defined(__clang__)
|
||||
# if defined(_LIBCPP_MSVC)
|
||||
_LIBCPP_WARNING("Building libc++ without __atomic builtins is unsupported")
|
||||
# else
|
||||
# warning Building libc++ without __atomic builtins is unsupported
|
||||
|
@ -579,10 +579,8 @@ locale::global(const locale& loc)
|
||||
locale& g = __global();
|
||||
locale r = g;
|
||||
g = loc;
|
||||
#ifndef __CloudABI__
|
||||
if (g.name() != "*")
|
||||
setlocale(LC_ALL, g.name().c_str());
|
||||
#endif
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -1111,13 +1109,7 @@ ctype<char>::classic_table() _NOEXCEPT
|
||||
#elif __sun__
|
||||
return __ctype_mask;
|
||||
#elif defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
|
||||
#if _VC_CRT_MAJOR_VERSION < 14
|
||||
// This is assumed to be safe, which is a nonsense assumption because we're
|
||||
// going to end up dereferencing it later...
|
||||
return _ctype+1; // internal ctype mask table defined in msvcrt.dll
|
||||
#else
|
||||
return __pctype_func();
|
||||
#endif
|
||||
#elif defined(__EMSCRIPTEN__)
|
||||
return *__ctype_b_loc();
|
||||
#elif defined(_NEWLIB_VERSION)
|
||||
|
@ -17,28 +17,6 @@
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
// NOTE: Relaxed and acq/rel atomics (for increment and decrement respectively)
|
||||
// should be sufficient for thread safety.
|
||||
// See https://llvm.org/bugs/show_bug.cgi?id=22803
|
||||
template <class T>
|
||||
inline T
|
||||
increment(T& t) _NOEXCEPT
|
||||
{
|
||||
return __libcpp_atomic_add(&t, 1, _AO_Relaxed);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T
|
||||
decrement(T& t) _NOEXCEPT
|
||||
{
|
||||
return __libcpp_atomic_add(&t, -1, _AO_Acq_Rel);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
const allocator_arg_t allocator_arg = allocator_arg_t();
|
||||
|
||||
bad_weak_ptr::~bad_weak_ptr() _NOEXCEPT {}
|
||||
@ -53,16 +31,21 @@ __shared_count::~__shared_count()
|
||||
{
|
||||
}
|
||||
|
||||
__shared_weak_count::~__shared_weak_count()
|
||||
{
|
||||
}
|
||||
|
||||
#if defined(_LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS)
|
||||
void
|
||||
__shared_count::__add_shared() _NOEXCEPT
|
||||
{
|
||||
increment(__shared_owners_);
|
||||
__libcpp_atomic_refcount_increment(__shared_owners_);
|
||||
}
|
||||
|
||||
bool
|
||||
__shared_count::__release_shared() _NOEXCEPT
|
||||
{
|
||||
if (decrement(__shared_owners_) == -1)
|
||||
if (__libcpp_atomic_refcount_decrement(__shared_owners_) == -1)
|
||||
{
|
||||
__on_zero_shared();
|
||||
return true;
|
||||
@ -70,10 +53,6 @@ __shared_count::__release_shared() _NOEXCEPT
|
||||
return false;
|
||||
}
|
||||
|
||||
__shared_weak_count::~__shared_weak_count()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
__shared_weak_count::__add_shared() _NOEXCEPT
|
||||
{
|
||||
@ -83,7 +62,7 @@ __shared_weak_count::__add_shared() _NOEXCEPT
|
||||
void
|
||||
__shared_weak_count::__add_weak() _NOEXCEPT
|
||||
{
|
||||
increment(__shared_weak_owners_);
|
||||
__libcpp_atomic_refcount_increment(__shared_weak_owners_);
|
||||
}
|
||||
|
||||
void
|
||||
@ -93,6 +72,8 @@ __shared_weak_count::__release_shared() _NOEXCEPT
|
||||
__release_weak();
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS
|
||||
|
||||
void
|
||||
__shared_weak_count::__release_weak() _NOEXCEPT
|
||||
{
|
||||
@ -124,7 +105,7 @@ __shared_weak_count::__release_weak() _NOEXCEPT
|
||||
//__libcpp_atomic_store(&__shared_weak_owners_, -1, _AO_Release);
|
||||
__on_zero_shared_weak();
|
||||
}
|
||||
else if (decrement(__shared_weak_owners_) == -1)
|
||||
else if (__libcpp_atomic_refcount_decrement(__shared_weak_owners_) == -1)
|
||||
__on_zero_shared_weak();
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "mutex"
|
||||
#include "limits"
|
||||
#include "system_error"
|
||||
#include "cassert"
|
||||
#include "include/atomic_support.h"
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
@ -37,7 +36,7 @@ mutex::lock()
|
||||
bool
|
||||
mutex::try_lock() _NOEXCEPT
|
||||
{
|
||||
return __libcpp_mutex_trylock(&__m_) == 0;
|
||||
return __libcpp_mutex_trylock(&__m_);
|
||||
}
|
||||
|
||||
void
|
||||
@ -45,7 +44,7 @@ mutex::unlock() _NOEXCEPT
|
||||
{
|
||||
int ec = __libcpp_mutex_unlock(&__m_);
|
||||
(void)ec;
|
||||
assert(ec == 0);
|
||||
_LIBCPP_ASSERT(ec == 0, "call to mutex::unlock failed");
|
||||
}
|
||||
|
||||
// recursive_mutex
|
||||
@ -61,7 +60,7 @@ recursive_mutex::~recursive_mutex()
|
||||
{
|
||||
int e = __libcpp_recursive_mutex_destroy(&__m_);
|
||||
(void)e;
|
||||
assert(e == 0);
|
||||
_LIBCPP_ASSERT(e == 0, "call to ~recursive_mutex() failed");
|
||||
}
|
||||
|
||||
void
|
||||
@ -77,13 +76,13 @@ recursive_mutex::unlock() _NOEXCEPT
|
||||
{
|
||||
int e = __libcpp_recursive_mutex_unlock(&__m_);
|
||||
(void)e;
|
||||
assert(e == 0);
|
||||
_LIBCPP_ASSERT(e == 0, "call to recursive_mutex::unlock() failed");
|
||||
}
|
||||
|
||||
bool
|
||||
recursive_mutex::try_lock() _NOEXCEPT
|
||||
{
|
||||
return __libcpp_recursive_mutex_trylock(&__m_) == 0;
|
||||
return __libcpp_recursive_mutex_trylock(&__m_);
|
||||
}
|
||||
|
||||
// timed_mutex
|
||||
|
163
src/new.cpp
163
src/new.cpp
@ -13,27 +13,48 @@
|
||||
|
||||
#include "new"
|
||||
|
||||
#if defined(__APPLE__) && !defined(LIBCXXRT) && \
|
||||
!defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY)
|
||||
#include <cxxabi.h>
|
||||
|
||||
#ifndef _LIBCPPABI_VERSION
|
||||
// On Darwin, there are two STL shared libraries and a lower level ABI
|
||||
// shared library. The global holding the current new handler is
|
||||
// in the ABI library and named __cxa_new_handler.
|
||||
#define __new_handler __cxxabiapple::__cxa_new_handler
|
||||
#endif
|
||||
#else // __APPLE__
|
||||
#if defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI)
|
||||
#include <cxxabi.h>
|
||||
#endif // defined(LIBCXX_BUILDING_LIBCXXABI)
|
||||
#if defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) || \
|
||||
(!defined(_LIBCPPABI_VERSION) && !defined(__GLIBCXX__))
|
||||
static std::new_handler __new_handler;
|
||||
#endif // _LIBCPPABI_VERSION
|
||||
#if defined(_LIBCPP_ABI_MICROSOFT)
|
||||
// nothing todo
|
||||
#elif defined(LIBCXX_BUILDING_LIBCXXABI)
|
||||
#include <cxxabi.h>
|
||||
#elif defined(LIBCXXRT)
|
||||
#include <cxxabi.h>
|
||||
#include "support/runtime/new_handler_fallback.ipp"
|
||||
#elif defined(__GLIBCXX__)
|
||||
// nothing todo
|
||||
#else
|
||||
# if defined(__APPLE__) && !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY)
|
||||
# include <cxxabi.h> // FIXME: remove this once buildit is gone.
|
||||
# else
|
||||
# include "support/runtime/new_handler_fallback.ipp"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
#ifndef __GLIBCXX__
|
||||
const nothrow_t nothrow = {};
|
||||
#endif
|
||||
|
||||
#ifndef LIBSTDCXX
|
||||
|
||||
void
|
||||
__throw_bad_alloc()
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw bad_alloc();
|
||||
#else
|
||||
_VSTD::abort();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // !LIBSTDCXX
|
||||
|
||||
} // std
|
||||
|
||||
#if !defined(__GLIBCXX__) && !defined(_LIBCPP_ABI_MICROSOFT) && \
|
||||
!defined(_LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS)
|
||||
|
||||
// Implement all new and delete operators as weak definitions
|
||||
// in this shared library, so that they can be overridden by programs
|
||||
@ -277,107 +298,5 @@ operator delete[] (void* ptr, size_t, std::align_val_t alignment) _NOEXCEPT
|
||||
::operator delete[](ptr, alignment);
|
||||
}
|
||||
|
||||
#endif // !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
|
||||
|
||||
#endif // !__GLIBCXX__
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
#ifndef __GLIBCXX__
|
||||
const nothrow_t nothrow = {};
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPPABI_VERSION
|
||||
|
||||
#ifndef __GLIBCXX__
|
||||
|
||||
new_handler
|
||||
set_new_handler(new_handler handler) _NOEXCEPT
|
||||
{
|
||||
return __sync_lock_test_and_set(&__new_handler, handler);
|
||||
}
|
||||
|
||||
new_handler
|
||||
get_new_handler() _NOEXCEPT
|
||||
{
|
||||
return __sync_fetch_and_add(&__new_handler, nullptr);
|
||||
}
|
||||
|
||||
#endif // !__GLIBCXX__
|
||||
|
||||
#ifndef LIBCXXRT
|
||||
|
||||
bad_alloc::bad_alloc() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
#ifndef __GLIBCXX__
|
||||
|
||||
bad_alloc::~bad_alloc() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
const char*
|
||||
bad_alloc::what() const _NOEXCEPT
|
||||
{
|
||||
return "std::bad_alloc";
|
||||
}
|
||||
|
||||
#endif // !__GLIBCXX__
|
||||
|
||||
bad_array_new_length::bad_array_new_length() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
#ifndef __GLIBCXX__
|
||||
|
||||
bad_array_new_length::~bad_array_new_length() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
const char*
|
||||
bad_array_new_length::what() const _NOEXCEPT
|
||||
{
|
||||
return "bad_array_new_length";
|
||||
}
|
||||
|
||||
#endif // !__GLIBCXX__
|
||||
|
||||
#endif //LIBCXXRT
|
||||
|
||||
bad_array_length::bad_array_length() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
#ifndef __GLIBCXX__
|
||||
|
||||
bad_array_length::~bad_array_length() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
const char*
|
||||
bad_array_length::what() const _NOEXCEPT
|
||||
{
|
||||
return "bad_array_length";
|
||||
}
|
||||
|
||||
#endif // !__GLIBCXX__
|
||||
|
||||
#endif // _LIBCPPABI_VERSION
|
||||
|
||||
#ifndef LIBSTDCXX
|
||||
|
||||
void
|
||||
__throw_bad_alloc()
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw bad_alloc();
|
||||
#else
|
||||
_VSTD::abort();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // !LIBSTDCXX
|
||||
|
||||
} // std
|
||||
#endif // !_LIBCPP_HAS_NO_ALIGNED_ALLOCATION
|
||||
#endif // !__GLIBCXX__ && !_LIBCPP_ABI_MICROSOFT && !_LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS
|
||||
|
182
src/support/runtime/exception_fallback.ipp
Normal file
182
src/support/runtime/exception_fallback.ipp
Normal file
@ -0,0 +1,182 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
namespace std {
|
||||
|
||||
_LIBCPP_SAFE_STATIC static std::terminate_handler __terminate_handler;
|
||||
_LIBCPP_SAFE_STATIC static std::unexpected_handler __unexpected_handler;
|
||||
|
||||
|
||||
// libcxxrt provides implementations of these functions itself.
|
||||
unexpected_handler
|
||||
set_unexpected(unexpected_handler func) _NOEXCEPT
|
||||
{
|
||||
return __sync_lock_test_and_set(&__unexpected_handler, func);
|
||||
}
|
||||
|
||||
unexpected_handler
|
||||
get_unexpected() _NOEXCEPT
|
||||
{
|
||||
return __sync_fetch_and_add(&__unexpected_handler, (unexpected_handler)0);
|
||||
|
||||
}
|
||||
|
||||
_LIBCPP_NORETURN
|
||||
void unexpected()
|
||||
{
|
||||
(*get_unexpected())();
|
||||
// unexpected handler should not return
|
||||
terminate();
|
||||
}
|
||||
|
||||
terminate_handler
|
||||
set_terminate(terminate_handler func) _NOEXCEPT
|
||||
{
|
||||
return __sync_lock_test_and_set(&__terminate_handler, func);
|
||||
}
|
||||
|
||||
terminate_handler
|
||||
get_terminate() _NOEXCEPT
|
||||
{
|
||||
return __sync_fetch_and_add(&__terminate_handler, (terminate_handler)0);
|
||||
|
||||
}
|
||||
|
||||
#ifndef __EMSCRIPTEN__ // We provide this in JS
|
||||
_LIBCPP_NORETURN
|
||||
void
|
||||
terminate() _NOEXCEPT
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
(*get_terminate())();
|
||||
// handler should not return
|
||||
fprintf(stderr, "terminate_handler unexpectedly returned\n");
|
||||
::abort();
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// handler should not throw exception
|
||||
fprintf(stderr, "terminate_handler unexpectedly threw an exception\n");
|
||||
::abort();
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
#endif // !__EMSCRIPTEN__
|
||||
|
||||
#if !defined(__EMSCRIPTEN__)
|
||||
bool uncaught_exception() _NOEXCEPT { return uncaught_exceptions() > 0; }
|
||||
|
||||
int uncaught_exceptions() _NOEXCEPT
|
||||
{
|
||||
#warning uncaught_exception not yet implemented
|
||||
fprintf(stderr, "uncaught_exceptions not yet implemented\n");
|
||||
::abort();
|
||||
}
|
||||
#endif // !__EMSCRIPTEN__
|
||||
|
||||
|
||||
exception::~exception() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
const char* exception::what() const _NOEXCEPT
|
||||
{
|
||||
return "std::exception";
|
||||
}
|
||||
|
||||
bad_exception::~bad_exception() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
const char* bad_exception::what() const _NOEXCEPT
|
||||
{
|
||||
return "std::bad_exception";
|
||||
}
|
||||
|
||||
|
||||
bad_alloc::bad_alloc() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
bad_alloc::~bad_alloc() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
const char*
|
||||
bad_alloc::what() const _NOEXCEPT
|
||||
{
|
||||
return "std::bad_alloc";
|
||||
}
|
||||
|
||||
bad_array_new_length::bad_array_new_length() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
bad_array_new_length::~bad_array_new_length() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
const char*
|
||||
bad_array_new_length::what() const _NOEXCEPT
|
||||
{
|
||||
return "bad_array_new_length";
|
||||
}
|
||||
|
||||
|
||||
bad_array_length::bad_array_length() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
bad_array_length::~bad_array_length() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
const char*
|
||||
bad_array_length::what() const _NOEXCEPT
|
||||
{
|
||||
return "bad_array_length";
|
||||
}
|
||||
|
||||
|
||||
bad_cast::bad_cast() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
bad_typeid::bad_typeid() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
bad_cast::~bad_cast() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
const char*
|
||||
bad_cast::what() const _NOEXCEPT
|
||||
{
|
||||
return "std::bad_cast";
|
||||
}
|
||||
|
||||
bad_typeid::~bad_typeid() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
const char*
|
||||
bad_typeid::what() const _NOEXCEPT
|
||||
{
|
||||
return "std::bad_typeid";
|
||||
}
|
||||
|
||||
} // namespace std
|
@ -1,3 +1,4 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
@ -7,29 +8,31 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <memory>
|
||||
#ifndef __GLIBCXX__
|
||||
#error header can only be used when targeting libstdc++ or libsupc++
|
||||
#endif
|
||||
|
||||
// unique_ptr
|
||||
namespace std {
|
||||
|
||||
// Test unique_ptr(pointer) ctor
|
||||
|
||||
#include <memory>
|
||||
|
||||
// unique_ptr(pointer) ctor should require default Deleter ctor
|
||||
class Deleter
|
||||
bad_alloc::bad_alloc() _NOEXCEPT
|
||||
{
|
||||
|
||||
Deleter() {}
|
||||
|
||||
public:
|
||||
|
||||
Deleter(Deleter&) {}
|
||||
Deleter& operator=(Deleter&) {}
|
||||
|
||||
void operator()(void*) const {}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
std::unique_ptr<int, Deleter> p(new int);
|
||||
}
|
||||
|
||||
bad_array_new_length::bad_array_new_length() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
bad_array_length::bad_array_length() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bad_cast::bad_cast() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
bad_typeid::bad_typeid() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace std
|
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