Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
828c2bb86d | ||
|
|
1d41df08d3 | ||
|
|
85c01426ad | ||
|
|
3006f595eb | ||
|
|
84fd172cd6 | ||
|
|
9b3829cb5b | ||
|
|
da9c0f1fba | ||
|
|
a9ad2ca8bd | ||
|
|
8ffa5d58e0 | ||
|
|
791e11cf33 | ||
|
|
4d933b2b44 |
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"project_id" : "libcxx",
|
|
||||||
"conduit_uri" : "http://reviews.llvm.org/"
|
|
||||||
}
|
|
||||||
54
.gitignore
vendored
54
.gitignore
vendored
@@ -1,54 +0,0 @@
|
|||||||
# Byte-compiled / optimized / DLL files
|
|
||||||
__pycache__/
|
|
||||||
*.py[cod]
|
|
||||||
|
|
||||||
# C extensions
|
|
||||||
*.so
|
|
||||||
|
|
||||||
# Distribution / packaging
|
|
||||||
.Python
|
|
||||||
env/
|
|
||||||
build/
|
|
||||||
develop-eggs/
|
|
||||||
dist/
|
|
||||||
downloads/
|
|
||||||
eggs/
|
|
||||||
#lib/ # We actually have things checked in to lib/
|
|
||||||
lib64/
|
|
||||||
parts/
|
|
||||||
sdist/
|
|
||||||
var/
|
|
||||||
*.egg-info/
|
|
||||||
.installed.cfg
|
|
||||||
*.egg
|
|
||||||
|
|
||||||
# PyInstaller
|
|
||||||
# Usually these files are written by a python script from a template
|
|
||||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
||||||
*.manifest
|
|
||||||
*.spec
|
|
||||||
|
|
||||||
# Installer logs
|
|
||||||
pip-log.txt
|
|
||||||
pip-delete-this-directory.txt
|
|
||||||
|
|
||||||
# Unit test / coverage reports
|
|
||||||
htmlcov/
|
|
||||||
.tox/
|
|
||||||
.coverage
|
|
||||||
.cache
|
|
||||||
nosetests.xml
|
|
||||||
coverage.xml
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
*.mo
|
|
||||||
*.pot
|
|
||||||
|
|
||||||
# Django stuff:
|
|
||||||
*.log
|
|
||||||
|
|
||||||
# Sphinx documentation
|
|
||||||
docs/_build/
|
|
||||||
|
|
||||||
# PyBuilder
|
|
||||||
target/
|
|
||||||
446
CMakeLists.txt
446
CMakeLists.txt
@@ -3,27 +3,20 @@
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Setup Project
|
# Setup Project
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
cmake_minimum_required(VERSION 2.8)
|
|
||||||
|
|
||||||
if(POLICY CMP0042)
|
|
||||||
cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default
|
|
||||||
endif()
|
|
||||||
if(POLICY CMP0022)
|
|
||||||
cmake_policy(SET CMP0022 NEW) # Required when interacting with LLVM and Clang
|
|
||||||
endif()
|
|
||||||
|
|
||||||
project(libcxx CXX C)
|
project(libcxx CXX C)
|
||||||
|
cmake_minimum_required(VERSION 2.8)
|
||||||
|
|
||||||
set(PACKAGE_NAME libcxx)
|
set(PACKAGE_NAME libcxx)
|
||||||
set(PACKAGE_VERSION trunk-svn)
|
set(PACKAGE_VERSION trunk-svn)
|
||||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||||
set(PACKAGE_BUGREPORT "llvm-bugs@lists.llvm.org")
|
set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")
|
||||||
|
|
||||||
# Add path for custom modules
|
# Add path for custom modules
|
||||||
set(CMAKE_MODULE_PATH
|
set(CMAKE_MODULE_PATH
|
||||||
|
${CMAKE_MODULE_PATH}
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
|
||||||
${CMAKE_MODULE_PATH}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Require out of source build.
|
# Require out of source build.
|
||||||
@@ -33,371 +26,134 @@ MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
|
|||||||
build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there."
|
build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there."
|
||||||
)
|
)
|
||||||
|
|
||||||
# Find the LLVM sources and simulate LLVM CMake options.
|
|
||||||
include(HandleOutOfTreeLLVM)
|
|
||||||
if (LIBCXX_BUILT_STANDALONE AND NOT LLVM_FOUND)
|
|
||||||
message(WARNING "UNSUPPORTED LIBCXX CONFIGURATION DETECTED: "
|
|
||||||
"llvm-config not found and LLVM_PATH not defined.\n"
|
|
||||||
"Reconfigure with -DLLVM_CONFIG=path/to/llvm-config "
|
|
||||||
"or -DLLVM_PATH=path/to/llvm-source-root.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Setup CMake Options
|
# Setup CMake Options
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
|
||||||
# Basic options ---------------------------------------------------------------
|
# Define options.
|
||||||
option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
|
|
||||||
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
|
|
||||||
|
|
||||||
option(LIBCXX_INCLUDE_TESTS "Build the libc++ tests." ${LLVM_INCLUDE_TESTS})
|
|
||||||
option(LIBCXX_INCLUDE_DOCS "Build the libc++ documentation." ${LLVM_INCLUDE_DOCS})
|
|
||||||
set(LIBCXX_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
|
|
||||||
"Define suffix of library directory name (32/64)")
|
|
||||||
option(LIBCXX_INSTALL_HEADERS "Install the libc++ headers." ON)
|
|
||||||
option(LIBCXX_INSTALL_LIBRARY "Install the libc++ library." ON)
|
|
||||||
option(LIBCXX_INSTALL_SUPPORT_HEADERS "Install libc++ support headers." ON)
|
|
||||||
set(LIBCXX_ABI_VERSION 1 CACHE STRING "ABI version of libc++.")
|
|
||||||
option(LIBCXX_ABI_UNSTABLE "Unstable ABI of libc++." OFF)
|
|
||||||
|
|
||||||
# ABI Library options ---------------------------------------------------------
|
|
||||||
set(LIBCXX_CXX_ABI "${LIBCXX_CXX_ABI}" CACHE STRING
|
|
||||||
"Specify C++ ABI library to use." FORCE)
|
|
||||||
set(CXXABIS none libcxxabi libcxxrt libstdc++ libsupc++)
|
|
||||||
set_property(CACHE LIBCXX_CXX_ABI PROPERTY STRINGS ;${CXXABIS})
|
|
||||||
|
|
||||||
# Setup the default options if LIBCXX_CXX_ABI is not specified.
|
|
||||||
if (NOT LIBCXX_CXX_ABI)
|
|
||||||
if (NOT DEFINED LIBCXX_BUILT_STANDALONE AND
|
|
||||||
IS_DIRECTORY "${CMAKE_SOURCE_DIR}/projects/libcxxabi")
|
|
||||||
set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
|
|
||||||
set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${CMAKE_SOURCE_DIR}/projects/libcxxabi/include")
|
|
||||||
set(LIBCXX_CXX_ABI_INTREE 1)
|
|
||||||
else ()
|
|
||||||
set(LIBCXX_CXX_ABI_LIBNAME "none")
|
|
||||||
endif ()
|
|
||||||
else ()
|
|
||||||
set(LIBCXX_CXX_ABI_LIBNAME "${LIBCXX_CXX_ABI}")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# Use a static copy of the ABI library when linking libc++. This option
|
|
||||||
# cannot be used with LIBCXX_ENABLE_ABI_LINKER_SCRIPT.
|
|
||||||
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'
|
|
||||||
# is on. This option is also disabled when the ABI library is not specified
|
|
||||||
# or is specified to be "none".
|
|
||||||
set(ENABLE_LINKER_SCRIPT_DEFAULT_VALUE OFF)
|
|
||||||
if (LLVM_HAVE_LINK_VERSION_SCRIPT AND NOT LIBCXX_ENABLE_STATIC_ABI_LIBRARY
|
|
||||||
AND NOT LIBCXX_CXX_ABI_LIBNAME STREQUAL "none"
|
|
||||||
AND PYTHONINTERP_FOUND)
|
|
||||||
set(ENABLE_LINKER_SCRIPT_DEFAULT_VALUE ON)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
option(LIBCXX_ENABLE_ABI_LINKER_SCRIPT
|
|
||||||
"Use and install a linker script for the given ABI library"
|
|
||||||
${ENABLE_LINKER_SCRIPT_DEFAULT_VALUE})
|
|
||||||
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
# Target options --------------------------------------------------------------
|
|
||||||
option(LIBCXX_BUILD_32_BITS "Build 32 bit libc++." ${LLVM_BUILD_32_BITS})
|
|
||||||
set(LIBCXX_SYSROOT "" CACHE STRING "Use alternate sysroot.")
|
|
||||||
set(LIBCXX_GCC_TOOLCHAIN "" CACHE STRING "Use alternate GCC toolchain.")
|
|
||||||
|
|
||||||
# Feature options -------------------------------------------------------------
|
|
||||||
option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON)
|
option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON)
|
||||||
option(LIBCXX_ENABLE_RTTI "Use run time type information." ON)
|
option(LIBCXX_ENABLE_RTTI "Use run time type information." ON)
|
||||||
option(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE "Build libc++ with support for the global filesystem namespace." ON)
|
option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
|
||||||
option(LIBCXX_ENABLE_STDIN "Build libc++ with support for stdin/std::cin." ON)
|
option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
|
||||||
option(LIBCXX_ENABLE_STDOUT "Build libc++ with support for stdout/std::cout." ON)
|
|
||||||
option(LIBCXX_ENABLE_THREADS "Build libc++ with support for threads." ON)
|
|
||||||
option(LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS "Build libc++ with support for thread-unsafe C functions" ON)
|
|
||||||
option(LIBCXX_ENABLE_MONOTONIC_CLOCK
|
|
||||||
"Build libc++ with support for a monotonic clock.
|
|
||||||
This option may only be set to OFF when LIBCXX_ENABLE_THREADS=OFF." ON)
|
|
||||||
option(LIBCXX_HAS_MUSL_LIBC "Build libc++ with support for the Musl C library" OFF)
|
|
||||||
|
|
||||||
# Misc options ----------------------------------------------------------------
|
|
||||||
# FIXME: Turn -pedantic back ON. It is currently off because it warns
|
|
||||||
# about #include_next which is used everywhere.
|
|
||||||
option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." OFF)
|
|
||||||
option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
|
option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
|
||||||
|
option(LIBCXX_ENABLE_CXX0X "Enable -std=c++0x and use of c++0x language features if the compiler supports it." ON)
|
||||||
option(LIBCXX_GENERATE_COVERAGE "Enable generating code coverage." OFF)
|
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
|
||||||
set(LIBCXX_COVERAGE_LIBRARY "" CACHE STRING
|
|
||||||
"The Profile-rt library used to build with code coverage")
|
|
||||||
|
|
||||||
# Don't allow a user to accidentally overwrite the system libc++ installation on Darwin.
|
|
||||||
# If the user specifies -DCMAKE_INSTALL_PREFIX=/usr the install rules for libc++
|
|
||||||
# will not be generated and a warning will be issued.
|
|
||||||
option(LIBCXX_OVERRIDE_DARWIN_INSTALL "Enable overwriting darwins libc++ installation." OFF)
|
|
||||||
mark_as_advanced(LIBCXX_OVERRIDE_DARWIN_INSTALL) # Don't show this option by default.
|
|
||||||
|
|
||||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT LIBCXX_OVERRIDE_DARWIN_INSTALL)
|
|
||||||
if ("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr")
|
|
||||||
message(WARNING "Disabling libc++ install rules because installation would "
|
|
||||||
"overwrite the systems installation. Configure with "
|
|
||||||
"-DLIBCXX_OVERRIDE_DARWIN_INSTALL=ON to suppress this behaviour.")
|
|
||||||
mark_as_advanced(CLEAR LIBCXX_OVERRIDE_DARWIN_INSTALL) # Show the override option.
|
|
||||||
set(LIBCXX_INSTALL_HEADERS OFF)
|
|
||||||
set(LIBCXX_INSTALL_LIBRARY OFF)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(LIBCXX_CONFIGURE_IDE_DEFAULT OFF)
|
|
||||||
if (XCODE OR MSVC_IDE)
|
|
||||||
set(LIBCXX_CONFIGURE_IDE_DEFAULT ON)
|
|
||||||
endif()
|
|
||||||
option(LIBCXX_CONFIGURE_IDE "Configure libcxx for use within an IDE"
|
|
||||||
${LIBCXX_CONFIGURE_IDE_DEFAULT})
|
|
||||||
|
|
||||||
#===============================================================================
|
|
||||||
# Check option configurations
|
|
||||||
#===============================================================================
|
|
||||||
|
|
||||||
# Ensure LIBCXX_ENABLE_MONOTONIC_CLOCK is set to ON only when
|
|
||||||
# LIBCXX_ENABLE_THREADS is on.
|
|
||||||
if(LIBCXX_ENABLE_THREADS AND NOT LIBCXX_ENABLE_MONOTONIC_CLOCK)
|
|
||||||
message(FATAL_ERROR "LIBCXX_ENABLE_MONOTONIC_CLOCK can only be set to OFF"
|
|
||||||
" when LIBCXX_ENABLE_THREADS is also set to OFF.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Ensure LLVM_USE_SANITIZER is not specified when LIBCXX_GENERATE_COVERAGE
|
|
||||||
# is ON.
|
|
||||||
if (LLVM_USE_SANITIZER AND LIBCXX_GENERATE_COVERAGE)
|
|
||||||
message(FATAL_ERROR "LLVM_USE_SANITIZER cannot be used with LIBCXX_GENERATE_COVERAGE")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Set LIBCXX_BUILD_32_BITS to (LIBCXX_BUILD_32_BITS OR LLVM_BUILD_32_BITS)
|
|
||||||
# and check that we can build with 32 bits if requested.
|
|
||||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32)
|
|
||||||
if (LIBCXX_BUILD_32_BITS AND NOT LLVM_BUILD_32_BITS) # Don't duplicate the output from LLVM
|
|
||||||
message(STATUS "Building 32 bits executables and libraries.")
|
|
||||||
endif()
|
|
||||||
elseif(LIBCXX_BUILD_32_BITS)
|
|
||||||
message(FATAL_ERROR "LIBCXX_BUILD_32_BITS=ON is not supported on this platform.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Check that this option is not enabled on Apple and emit a usage warning.
|
|
||||||
if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY)
|
|
||||||
if (APPLE)
|
|
||||||
message(FATAL_ERROR "LIBCXX_ENABLE_STATIC_ABI_LIBRARY is not supported on OS X")
|
|
||||||
else()
|
|
||||||
message(WARNING "LIBCXX_ENABLE_STATIC_ABI_LIBRARY is an experimental option")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
|
|
||||||
if (APPLE)
|
|
||||||
message(FATAL_ERROR "LIBCXX_ENABLE_ABI_LINKER_SCRIPT cannot be used on APPLE targets")
|
|
||||||
endif()
|
|
||||||
if (NOT PYTHONINTERP_FOUND)
|
|
||||||
message(FATAL_ERROR "LIBCXX_ENABLE_ABI_LINKER_SCRIPT requires python but it was not found.")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
|
|
||||||
message(FATAL_ERROR "Conflicting options given.
|
|
||||||
LIBCXX_ENABLE_STATIC_ABI_LIBRARY cannot be specified with
|
|
||||||
LIBCXX_ENABLE_ABI_LINKER_SCRIPT")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (LIBCXX_HAS_MUSL_LIBC AND NOT LIBCXX_INSTALL_SUPPORT_HEADERS)
|
|
||||||
message(FATAL_ERROR "LIBCXX_INSTALL_SUPPORT_HEADERS can not be turned off"
|
|
||||||
"when building for Musl with LIBCXX_HAS_MUSL_LIBC.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Configure System
|
# Configure System
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
|
||||||
set(LIBCXX_COMPILER ${CMAKE_CXX_COMPILER})
|
# Get triples.
|
||||||
set(LIBCXX_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
include(GetTriple)
|
||||||
set(LIBCXX_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
get_host_triple(LIBCXX_HOST_TRIPLE
|
||||||
set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
|
LIBCXX_HOST_ARCH
|
||||||
|
LIBCXX_HOST_VENDOR
|
||||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR})
|
LIBCXX_HOST_OS
|
||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR})
|
)
|
||||||
|
set(LIBCXX_HOST_TRIPLE ${LIBCXX_HOST_TRIPLE} CACHE STRING "Host triple.")
|
||||||
# Declare libc++ configuration variables.
|
get_target_triple(LIBCXX_TARGET_TRIPLE
|
||||||
# They are intended for use as follows:
|
LIBCXX_TARGET_ARCH
|
||||||
# LIBCXX_CXX_FLAGS: General flags for both the compiler and linker.
|
LIBCXX_TARGET_VENDOR
|
||||||
# LIBCXX_COMPILE_FLAGS: Compile only flags.
|
LIBCXX_TARGET_OS
|
||||||
# LIBCXX_LINK_FLAGS: Linker only flags.
|
)
|
||||||
set(LIBCXX_COMPILE_FLAGS "")
|
set(LIBCXX_TARGET_TRIPLE ${LIBCXX_TARGET_TRIPLE} CACHE STRING "Target triple.")
|
||||||
set(LIBCXX_LINK_FLAGS "")
|
|
||||||
set(LIBCXX_LIBRARIES "")
|
|
||||||
|
|
||||||
# Configure compiler.
|
# Configure compiler.
|
||||||
include(config-ix)
|
include(config-ix)
|
||||||
|
|
||||||
# Configure coverage options.
|
|
||||||
if (LIBCXX_GENERATE_COVERAGE)
|
|
||||||
include(CodeCoverage)
|
|
||||||
set(CMAKE_BUILD_TYPE "COVERAGE" CACHE STRING "" FORCE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
|
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Setup Compiler Flags
|
# Setup Compiler Flags
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
|
||||||
include(HandleLibCXXABI) # Steup the ABI library flags
|
# Get required flags.
|
||||||
|
|
||||||
# Include macros for adding and removing libc++ flags.
|
|
||||||
include(HandleLibcxxFlags)
|
|
||||||
|
|
||||||
# Remove flags that may have snuck in.
|
|
||||||
remove_flags(-DNDEBUG -UNDEBUG -D_DEBUG
|
|
||||||
-stdlib=libc++ -stdlib=libstdc++ -lc++abi -m32)
|
|
||||||
|
|
||||||
# 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.
|
|
||||||
remove_flags(-Wno-pedantic -pedantic-errors -pedantic)
|
|
||||||
|
|
||||||
# Required flags ==============================================================
|
|
||||||
add_compile_flags_if_supported(-std=c++11)
|
|
||||||
if (NOT MSVC AND NOT LIBCXX_SUPPORTS_STD_EQ_CXX11_FLAG)
|
|
||||||
message(FATAL_ERROR "C++11 is required but the compiler does not support -std=c++11")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# On all systems the system c++ standard library headers need to be excluded.
|
# On all systems the system c++ standard library headers need to be excluded.
|
||||||
# MSVC only has -X, which disables all default includes; including the crt.
|
if (MSVC)
|
||||||
# Thus, we do nothing and hope we don't accidentally include any of the C++
|
# MSVC only has -X, which disables all default includes; including the crt.
|
||||||
# headers
|
# Thus, we do nothing and hope we don't accidentally include any of the C++
|
||||||
add_compile_flags_if_supported(-nostdinc++)
|
# headers.
|
||||||
|
|
||||||
# Target flags ================================================================
|
|
||||||
add_flags_if(LIBCXX_BUILD_32_BITS -m32)
|
|
||||||
add_flags_if(LIBCXX_TARGET_TRIPLE "-target ${LIBCXX_TARGET_TRIPLE}")
|
|
||||||
add_flags_if(LIBCXX_SYSROOT "--sysroot ${LIBCXX_SYSROOT}")
|
|
||||||
add_flags_if(LIBCXX_GCC_TOOLCHAIN "-gcc-toolchain ${LIBCXX_GCC_TOOLCHAIN}")
|
|
||||||
|
|
||||||
# Warning flags ===============================================================
|
|
||||||
add_definitions(-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
add_compile_flags_if_supported(
|
|
||||||
-Wall -W -Wwrite-strings
|
|
||||||
-Wno-unused-parameter -Wno-long-long
|
|
||||||
-Werror=return-type)
|
|
||||||
if (LIBCXX_ENABLE_WERROR)
|
|
||||||
add_compile_flags_if_supported(-Werror)
|
|
||||||
add_compile_flags_if_supported(-WX)
|
|
||||||
else()
|
else()
|
||||||
# TODO(EricWF) Remove this. We shouldn't be suppressing errors when -Werror is
|
if (LIBCXX_HAS_NOSTDINCXX_FLAG)
|
||||||
# added elsewhere.
|
set(LIBCXX_CXX_REQUIRED_FLAGS -nostdinc++)
|
||||||
add_compile_flags_if_supported(-Wno-error)
|
endif()
|
||||||
endif()
|
if (LIBCXX_ENABLE_CXX0X AND LIBCXX_HAS_STDCXX0X_FLAG)
|
||||||
if (LIBCXX_ENABLE_PEDANTIC)
|
list(APPEND LIBCXX_CXX_REQUIRED_FLAGS -std=c++0x)
|
||||||
add_compile_flags_if_supported(-pedantic)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Exception flags =============================================================
|
|
||||||
if (LIBCXX_ENABLE_EXCEPTIONS)
|
|
||||||
# Catches C++ exceptions only and tells the compiler to assume that extern C
|
|
||||||
# functions never throw a C++ exception.
|
|
||||||
add_compile_flags_if_supported(-EHsc)
|
|
||||||
else()
|
|
||||||
add_definitions(-D_LIBCPP_NO_EXCEPTIONS)
|
|
||||||
add_compile_flags_if_supported(-EHs- -EHa-)
|
|
||||||
add_compile_flags_if_supported(-fno-exceptions)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# RTTI flags ==================================================================
|
|
||||||
if (NOT LIBCXX_ENABLE_RTTI)
|
|
||||||
add_definitions(-D_LIBCPP_NO_RTTI)
|
|
||||||
add_compile_flags_if_supported(-GR-)
|
|
||||||
add_compile_flags_if_supported(-fno-rtti)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Assertion flags =============================================================
|
|
||||||
define_if(LIBCXX_ENABLE_ASSERTIONS -UNDEBUG)
|
|
||||||
define_if_not(LIBCXX_ENABLE_ASSERTIONS -DNDEBUG)
|
|
||||||
if (LIBCXX_ENABLE_ASSERTIONS)
|
|
||||||
# MSVC doesn't like _DEBUG on release builds. See PR 4379.
|
|
||||||
define_if_not(MSVC -D_DEBUG)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Feature flags ===============================================================
|
|
||||||
define_if(MSVC -D_CRT_SECURE_NO_WARNINGS)
|
|
||||||
|
|
||||||
# Sanitizer flags =============================================================
|
|
||||||
|
|
||||||
# Configure for sanitizers. If LIBCXX_BUILT_STANDALONE then we have to do
|
|
||||||
# the flag translation ourselves. Othewise LLVM's CMakeList.txt will handle it.
|
|
||||||
if (LIBCXX_BUILT_STANDALONE)
|
|
||||||
set(LLVM_USE_SANITIZER "" CACHE STRING
|
|
||||||
"Define the sanitizer used to build the library and tests")
|
|
||||||
# NOTE: LLVM_USE_SANITIZER checks for a UNIX like system instead of MSVC.
|
|
||||||
# But we don't have LLVM_ON_UNIX so checking for MSVC is the best we can do.
|
|
||||||
if (LLVM_USE_SANITIZER AND NOT MSVC)
|
|
||||||
add_flags_if_supported("-fno-omit-frame-pointer")
|
|
||||||
add_flags_if_supported("-gline-tables-only")
|
|
||||||
|
|
||||||
if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" AND
|
|
||||||
NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
|
|
||||||
add_flags_if_supported("-gline-tables-only")
|
|
||||||
endif()
|
|
||||||
if (LLVM_USE_SANITIZER STREQUAL "Address")
|
|
||||||
add_flags("-fsanitize=address")
|
|
||||||
elseif (LLVM_USE_SANITIZER MATCHES "Memory(WithOrigins)?")
|
|
||||||
add_flags(-fsanitize=memory)
|
|
||||||
if (LLVM_USE_SANITIZER STREQUAL "MemoryWithOrigins")
|
|
||||||
add_flags("-fsanitize-memory-track-origins")
|
|
||||||
endif()
|
|
||||||
elseif (LLVM_USE_SANITIZER STREQUAL "Undefined")
|
|
||||||
add_flags("-fsanitize=undefined -fno-sanitize=vptr,function -fno-sanitize-recover=all")
|
|
||||||
elseif (LLVM_USE_SANITIZER STREQUAL "Thread")
|
|
||||||
add_flags(-fsanitize=thread)
|
|
||||||
else()
|
|
||||||
message(WARNING "Unsupported value of LLVM_USE_SANITIZER: ${LLVM_USE_SANITIZER}")
|
|
||||||
endif()
|
|
||||||
elseif(LLVM_USE_SANITIZER AND MSVC)
|
|
||||||
message(WARNING "LLVM_USE_SANITIZER is not supported on this platform.")
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Configuration file flags =====================================================
|
macro(append_if list condition var)
|
||||||
if (NOT LIBCXX_ABI_VERSION EQUAL "1")
|
if (${condition})
|
||||||
config_define(${LIBCXX_ABI_VERSION} _LIBCPP_ABI_VERSION)
|
list(APPEND ${list} ${var})
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# Get warning flags
|
||||||
|
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
|
||||||
|
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_W_FLAG -W)
|
||||||
|
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG -Wno-unused-parameter)
|
||||||
|
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings)
|
||||||
|
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WNO_LONG_LONG_FLAG -Wno-long-long)
|
||||||
|
if (LIBCXX_ENABLE_WERROR)
|
||||||
|
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror)
|
||||||
|
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WX_FLAG -WX)
|
||||||
endif()
|
endif()
|
||||||
config_define_if(LIBCXX_ABI_UNSTABLE _LIBCPP_ABI_UNSTABLE)
|
if (LIBCXX_ENABLE_PEDANTIC)
|
||||||
|
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
|
||||||
config_define_if_not(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE)
|
|
||||||
config_define_if_not(LIBCXX_ENABLE_STDIN _LIBCPP_HAS_NO_STDIN)
|
|
||||||
config_define_if_not(LIBCXX_ENABLE_STDOUT _LIBCPP_HAS_NO_STDOUT)
|
|
||||||
config_define_if_not(LIBCXX_ENABLE_THREADS _LIBCPP_HAS_NO_THREADS)
|
|
||||||
config_define_if_not(LIBCXX_ENABLE_MONOTONIC_CLOCK _LIBCPP_HAS_NO_MONOTONIC_CLOCK)
|
|
||||||
config_define_if_not(LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS)
|
|
||||||
|
|
||||||
config_define_if(LIBCXX_HAS_MUSL_LIBC _LIBCPP_HAS_MUSL_LIBC)
|
|
||||||
|
|
||||||
if (LIBCXX_NEEDS_SITE_CONFIG)
|
|
||||||
configure_file(
|
|
||||||
include/__config_site.in
|
|
||||||
${LIBCXX_BINARY_DIR}/__config_site
|
|
||||||
@ONLY)
|
|
||||||
# Provide the config definitions by included the generated __config_site
|
|
||||||
# file at compile time.
|
|
||||||
add_compile_flags("-include ${LIBCXX_BINARY_DIR}/__config_site")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Get feature flags.
|
||||||
|
# Exceptions
|
||||||
|
if (LIBCXX_ENABLE_EXCEPTIONS)
|
||||||
|
# Catches C++ exceptions only and tells the compiler to assume that extern C
|
||||||
|
# functions never throw a C++ exception.
|
||||||
|
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_EHSC_FLAG -EHsc)
|
||||||
|
else()
|
||||||
|
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_NO_EXCEPTIONS)
|
||||||
|
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_EHS_FLAG -EHs-)
|
||||||
|
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_EHA_FLAG -EHa-)
|
||||||
|
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_EXCEPTIONS_FLAG -fno-exceptions)
|
||||||
|
endif()
|
||||||
|
# RTTI
|
||||||
|
if (NOT LIBCXX_ENABLE_RTTI)
|
||||||
|
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_NO_RTTI)
|
||||||
|
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_GR_FLAG -GR-)
|
||||||
|
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti)
|
||||||
|
endif()
|
||||||
|
# Assert
|
||||||
|
if (LLVM_ENABLE_ASSERTIONS)
|
||||||
|
# MSVC doesn't like _DEBUG on release builds. See PR 4379.
|
||||||
|
if (NOT MSVC)
|
||||||
|
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_DEBUG)
|
||||||
|
endif()
|
||||||
|
# On Release builds cmake automatically defines NDEBUG, so we
|
||||||
|
# explicitly undefine it:
|
||||||
|
if (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
|
||||||
|
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -UNDEBUG)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
|
||||||
|
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -DNDEBUG)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# This is the _ONLY_ place where add_definitions is called.
|
||||||
|
add_definitions(
|
||||||
|
${LIBCXX_CXX_REQUIRED_FLAGS}
|
||||||
|
${LIBCXX_CXX_WARNING_FLAGS}
|
||||||
|
${LIBCXX_CXX_FEATURE_FLAGS}
|
||||||
|
)
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Setup Source Code And Tests
|
# Setup Source Code
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
|
||||||
include_directories(include)
|
include_directories(include)
|
||||||
add_subdirectory(include)
|
|
||||||
|
# Add source code. This also contains all of the logic for deciding linker flags
|
||||||
|
# soname, etc...
|
||||||
add_subdirectory(lib)
|
add_subdirectory(lib)
|
||||||
|
|
||||||
if (LIBCXX_INCLUDE_TESTS)
|
#===============================================================================
|
||||||
add_subdirectory(test)
|
# Setup Tests
|
||||||
endif()
|
#===============================================================================
|
||||||
if (LIBCXX_INCLUDE_DOCS)
|
|
||||||
add_subdirectory(docs)
|
add_subdirectory(test)
|
||||||
endif()
|
|
||||||
|
|||||||
121
CREDITS.TXT
121
CREDITS.TXT
@@ -8,131 +8,16 @@ beautification by scripts. The fields are: name (N), email (E), web-address
|
|||||||
(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
|
(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
|
||||||
(S).
|
(S).
|
||||||
|
|
||||||
N: Saleem Abdulrasool
|
|
||||||
E: compnerd@compnerd.org
|
|
||||||
D: Minor patches and Linux fixes.
|
|
||||||
|
|
||||||
N: Dan Albert
|
|
||||||
E: danalbert@google.com
|
|
||||||
D: Android support and test runner improvements.
|
|
||||||
|
|
||||||
N: Dimitry Andric
|
|
||||||
E: dimitry@andric.com
|
|
||||||
D: Visibility fixes, minor FreeBSD portability patches.
|
|
||||||
|
|
||||||
N: Holger Arnold
|
|
||||||
E: holgerar@gmail.com
|
|
||||||
D: Minor fix.
|
|
||||||
|
|
||||||
N: Ruben Van Boxem
|
|
||||||
E: vanboxem dot ruben at gmail dot com
|
|
||||||
D: Initial Windows patches.
|
|
||||||
|
|
||||||
N: David Chisnall
|
|
||||||
E: theraven at theravensnest dot org
|
|
||||||
D: FreeBSD and Solaris ports, libcxxrt support, some atomics work.
|
|
||||||
|
|
||||||
N: Marshall Clow
|
|
||||||
E: mclow.lists@gmail.com
|
|
||||||
E: marshall@idio.com
|
|
||||||
D: C++14 support, patches and bug fixes.
|
|
||||||
|
|
||||||
N: Eric Fiselier
|
|
||||||
E: eric@efcs.ca
|
|
||||||
D: LFTS support, patches and bug fixes.
|
|
||||||
|
|
||||||
N: Bill Fisher
|
|
||||||
E: william.w.fisher@gmail.com
|
|
||||||
D: Regex bug fixes.
|
|
||||||
|
|
||||||
N: Matthew Dempsky
|
|
||||||
E: matthew@dempsky.org
|
|
||||||
D: Minor patches and bug fixes.
|
|
||||||
|
|
||||||
N: Google Inc.
|
|
||||||
D: Copyright owner and contributor of the CityHash algorithm
|
|
||||||
|
|
||||||
N: Howard Hinnant
|
N: Howard Hinnant
|
||||||
E: hhinnant@apple.com
|
E: hhinnant@apple.com
|
||||||
D: Architect and primary author of libc++
|
D: Architect and primary author of libc++
|
||||||
|
|
||||||
N: Hyeon-bin Jeong
|
N: Marshall Clow
|
||||||
E: tuhertz@gmail.com
|
E: marshall@idio.com
|
||||||
|
E: mclow@qualcomm.com
|
||||||
D: Minor patches and bug fixes.
|
D: Minor patches and bug fixes.
|
||||||
|
|
||||||
N: Argyrios Kyrtzidis
|
|
||||||
E: kyrtzidis@apple.com
|
|
||||||
D: Bug fixes.
|
|
||||||
|
|
||||||
N: Bruce Mitchener, Jr.
|
|
||||||
E: bruce.mitchener@gmail.com
|
|
||||||
D: Emscripten-related changes.
|
|
||||||
|
|
||||||
N: Michel Morin
|
|
||||||
E: mimomorin@gmail.com
|
|
||||||
D: Minor patches to is_convertible.
|
|
||||||
|
|
||||||
N: Andrew Morrow
|
|
||||||
E: andrew.c.morrow@gmail.com
|
|
||||||
D: Minor patches and Linux fixes.
|
|
||||||
|
|
||||||
N: Arvid Picciani
|
|
||||||
E: aep at exys dot org
|
|
||||||
D: Minor patches and musl port.
|
|
||||||
|
|
||||||
N: Bjorn Reese
|
N: Bjorn Reese
|
||||||
E: breese@users.sourceforge.net
|
E: breese@users.sourceforge.net
|
||||||
D: Initial regex prototype
|
D: Initial regex prototype
|
||||||
|
|
||||||
N: Nico Rieck
|
|
||||||
E: nico.rieck@gmail.com
|
|
||||||
D: Windows fixes
|
|
||||||
|
|
||||||
N: Jon Roelofs
|
|
||||||
E: jonathan@codesourcery.com
|
|
||||||
D: Remote testing, Newlib port, baremetal/single-threaded support.
|
|
||||||
|
|
||||||
N: Jonathan Sauer
|
|
||||||
D: Minor patches, mostly related to constexpr
|
|
||||||
|
|
||||||
N: Craig Silverstein
|
|
||||||
E: csilvers@google.com
|
|
||||||
D: Implemented Cityhash as the string hash function on 64-bit machines
|
|
||||||
|
|
||||||
N: Richard Smith
|
|
||||||
D: Minor patches.
|
|
||||||
|
|
||||||
N: Joerg Sonnenberger
|
|
||||||
E: joerg@NetBSD.org
|
|
||||||
D: NetBSD port.
|
|
||||||
|
|
||||||
N: Stephan Tolksdorf
|
|
||||||
E: st@quanttec.com
|
|
||||||
D: Minor <atomic> fix
|
|
||||||
|
|
||||||
N: Michael van der Westhuizen
|
|
||||||
E: r1mikey at gmail dot com
|
|
||||||
|
|
||||||
N: Larisse Voufo
|
|
||||||
D: Minor patches.
|
|
||||||
|
|
||||||
N: Klaas de Vries
|
|
||||||
E: klaas at klaasgaaf dot nl
|
|
||||||
D: Minor bug fix.
|
|
||||||
|
|
||||||
N: Zhang Xiongpang
|
|
||||||
E: zhangxiongpang@gmail.com
|
|
||||||
D: Minor patches and bug fixes.
|
|
||||||
|
|
||||||
N: Xing Xue
|
|
||||||
E: xingxue@ca.ibm.com
|
|
||||||
D: AIX port
|
|
||||||
|
|
||||||
N: Zhihao Yuan
|
|
||||||
E: lichray@gmail.com
|
|
||||||
D: Standard compatibility fixes.
|
|
||||||
|
|
||||||
N: Jeffrey Yasskin
|
|
||||||
E: jyasskin@gmail.com
|
|
||||||
E: jyasskin@google.com
|
|
||||||
D: Linux fixes.
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ Full text of the relevant licenses is included below.
|
|||||||
University of Illinois/NCSA
|
University of Illinois/NCSA
|
||||||
Open Source License
|
Open Source License
|
||||||
|
|
||||||
Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT
|
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ SOFTWARE.
|
|||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT
|
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
69
Makefile
69
Makefile
@@ -1,5 +1,5 @@
|
|||||||
##
|
##
|
||||||
# libc++ Makefile
|
# libcpp Makefile
|
||||||
##
|
##
|
||||||
|
|
||||||
SRCDIRS = .
|
SRCDIRS = .
|
||||||
@@ -14,12 +14,9 @@ ifeq (,$(RC_INDIGO))
|
|||||||
else
|
else
|
||||||
INSTALL_PREFIX="$(SDKROOT)"
|
INSTALL_PREFIX="$(SDKROOT)"
|
||||||
endif
|
endif
|
||||||
INSTALL_DIR=$(DSTROOT)/$(INSTALL_PREFIX)
|
|
||||||
|
|
||||||
.PHONY: help installsrc clean installheaders install
|
|
||||||
|
|
||||||
help::
|
help::
|
||||||
@echo "Use make install DSTROOT=<destination>"
|
echo Use make install DSTROOT=<destination>
|
||||||
|
|
||||||
installsrc:: $(SRCROOT)
|
installsrc:: $(SRCROOT)
|
||||||
|
|
||||||
@@ -30,27 +27,49 @@ installsrc:: $(SRCROOT)
|
|||||||
|
|
||||||
clean::
|
clean::
|
||||||
|
|
||||||
# The installheaders target is used by clang's runtime/libcxx makefile.
|
installhdrs::
|
||||||
installheaders::
|
|
||||||
mkdir -p $(HEADER_DIR)/c++/v1/ext
|
|
||||||
(cd $(SRCDIRS)/include && \
|
|
||||||
tar cf - --exclude=".*" --exclude=support \
|
|
||||||
--exclude=CMakeLists.txt *) | \
|
|
||||||
(cd $(HEADER_DIR)/c++/v1 && tar xf -)
|
|
||||||
chmod 755 $(HEADER_DIR)/c++/v1
|
|
||||||
chmod 644 $(HEADER_DIR)/c++/v1/*
|
|
||||||
chmod 755 $(HEADER_DIR)/c++/v1/ext
|
|
||||||
chmod 644 $(HEADER_DIR)/c++/v1/ext/*
|
|
||||||
chmod 755 $(HEADER_DIR)/c++/v1/experimental
|
|
||||||
chmod 644 $(HEADER_DIR)/c++/v1/experimental/*
|
|
||||||
|
|
||||||
install::
|
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext
|
||||||
|
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/clang-ide/lib/c++/v1/ext
|
||||||
|
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext
|
||||||
|
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext
|
||||||
|
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/c++/v1/ext
|
||||||
|
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/
|
||||||
|
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/clang-ide/lib/c++/v1/
|
||||||
|
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/
|
||||||
|
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/
|
||||||
|
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/c++/v1/
|
||||||
|
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++
|
||||||
|
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/clang-ide/lib/c++
|
||||||
|
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++
|
||||||
|
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++
|
||||||
|
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/c++
|
||||||
|
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1
|
||||||
|
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/clang-ide/lib/c++/v1
|
||||||
|
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1
|
||||||
|
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1
|
||||||
|
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/c++/v1
|
||||||
|
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/*
|
||||||
|
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/clang-ide/lib/c++/v1/*
|
||||||
|
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/*
|
||||||
|
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/*
|
||||||
|
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/c++/v1/*
|
||||||
|
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext
|
||||||
|
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/clang-ide/lib/c++/v1/ext
|
||||||
|
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext
|
||||||
|
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext
|
||||||
|
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/c++/v1/ext
|
||||||
|
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext/*
|
||||||
|
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/clang-ide/lib/c++/v1/ext/*
|
||||||
|
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext/*
|
||||||
|
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext/*
|
||||||
|
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/c++/v1/ext/*
|
||||||
|
|
||||||
|
install:: installhdrs $(DESTDIR)
|
||||||
|
|
||||||
cd lib && ./buildit
|
cd lib && ./buildit
|
||||||
ditto lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
|
ditto lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
|
||||||
cd lib && dsymutil -o $(SYMROOT)/libc++.1.dylib.dSYM \
|
cd lib && dsymutil -o $(SYMROOT)/libc++.1.dylib.dSYM $(SYMROOT)/usr/lib/libc++.1.dylib
|
||||||
$(SYMROOT)/usr/lib/libc++.1.dylib
|
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib
|
||||||
mkdir -p $(INSTALL_DIR)/usr/lib
|
strip -S -o $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
|
||||||
strip -S -o $(INSTALL_DIR)/usr/lib/libc++.1.dylib \
|
cd $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib && ln -s libc++.1.dylib libc++.dylib
|
||||||
$(SYMROOT)/usr/lib/libc++.1.dylib
|
|
||||||
cd $(INSTALL_DIR)/usr/lib && ln -s libc++.1.dylib libc++.dylib
|
|
||||||
|
|||||||
56
TODO.TXT
56
TODO.TXT
@@ -1,56 +0,0 @@
|
|||||||
This is meant to be a general place to list things that should be done "someday"
|
|
||||||
|
|
||||||
3.8 Release Goals
|
|
||||||
=================
|
|
||||||
* LFTS v1 (EricWF, MClow)
|
|
||||||
* Filesystem TS (EricWF)
|
|
||||||
* ASIO TS (MClow)
|
|
||||||
* <regex> Improvements (MClow)
|
|
||||||
* Setup ABI Versioning policy (EricWF)
|
|
||||||
* Fix PR19302 - Fix UB in list and __tree.
|
|
||||||
|
|
||||||
|
|
||||||
ABI Related Tasks
|
|
||||||
=================
|
|
||||||
* Explicitly manage and verify symbols exported from the dylib.
|
|
||||||
* Explore using namespaces for managing symbol visibility.
|
|
||||||
* Introduce and document ABI versioning/evolution policy.
|
|
||||||
|
|
||||||
CXX Runtime Library Tasks
|
|
||||||
=========================
|
|
||||||
* Cleanup #ifdef hell in sources files that supports the different ABI libraries.
|
|
||||||
* Fix that CMake always link to /usr/lib/libc++abi.dylib on OS X.
|
|
||||||
* Fix selection of ABI symbol list on OS X.
|
|
||||||
* Have CMake generate linker scripts for libc++.so that it properly links the
|
|
||||||
runtime library.
|
|
||||||
* Look into mirroring libsupc++'s typeinfo vtable layout when libsupc++/libstdc++
|
|
||||||
is used as the runtime library.
|
|
||||||
* Audit libraries that CMake links into libc++. Are they all required?
|
|
||||||
* Investigate and document interoperability between libc++ and libstdc++ on
|
|
||||||
linux. Do this for every supported c++ runtime library.
|
|
||||||
|
|
||||||
Atomic Related Tasks
|
|
||||||
====================
|
|
||||||
* Enable mixing of clang and GCC atomics internally. Currently some
|
|
||||||
parts of libc++ use atomics only when clang provides them.
|
|
||||||
(see memory@5380 for an example)
|
|
||||||
* Audit use of libatomic builtins in <atomic> with GCC.
|
|
||||||
* future should use <atomic> for synchronization.
|
|
||||||
|
|
||||||
Test Suite Tasks
|
|
||||||
================
|
|
||||||
* Move all libc++ specific tests from test/std into test/libcxx.
|
|
||||||
* Improve how LIT handles compiler warnings.
|
|
||||||
* Improve the quality and portability of the locale test data.
|
|
||||||
* Convert failure tests to use Clang Verify.
|
|
||||||
|
|
||||||
Misc Tasks
|
|
||||||
==========
|
|
||||||
* Find all sequences of >2 underscores and eradicate them.
|
|
||||||
* run clang-tidy on libc++
|
|
||||||
* Document the "conditionally-supported" bits of libc++
|
|
||||||
* Look at basic_string's move assignment operator, re LWG 2063 and POCMA
|
|
||||||
* libc++ is missing try_emplace
|
|
||||||
* Put a static_assert in std::allocator to deny const/volatile types (LWG 2447)
|
|
||||||
* Document support (or lack of) for C++11 libraries in C++03.
|
|
||||||
* Document supported compilers.
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
find_program(CODE_COVERAGE_LCOV lcov)
|
|
||||||
if (NOT CODE_COVERAGE_LCOV)
|
|
||||||
message(FATAL_ERROR "Cannot find lcov...")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_program(CODE_COVERAGE_GENHTML genhtml)
|
|
||||||
if (NOT CODE_COVERAGE_GENHTML)
|
|
||||||
message(FATAL_ERROR "Cannot find genhtml...")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS_COVERAGE "-g -O0 --coverage")
|
|
||||||
|
|
||||||
function(setup_lcov_test_target_coverage target_name output_dir capture_dirs source_dirs)
|
|
||||||
file(MAKE_DIRECTORY ${output_dir})
|
|
||||||
|
|
||||||
set(CAPTURE_DIRS "")
|
|
||||||
foreach(cdir ${capture_dirs})
|
|
||||||
list(APPEND CAPTURE_DIRS "-d;${cdir}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
set(EXTRACT_DIRS "")
|
|
||||||
foreach(sdir ${source_dirs})
|
|
||||||
list(APPEND EXTRACT_DIRS "'${sdir}/*'")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
message(STATUS "Capture Directories: ${CAPTURE_DIRS}")
|
|
||||||
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 ${CODE_COVERAGE_GENHTML} --demangle-cpp test_coverage.info -o test_coverage
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E remove test_coverage.info
|
|
||||||
WORKING_DIRECTORY ${output_dir}
|
|
||||||
COMMENT "Generating coverage results")
|
|
||||||
endfunction()
|
|
||||||
53
cmake/Modules/GetTriple.cmake
Normal file
53
cmake/Modules/GetTriple.cmake
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
# Define functions to get the host and target triple.
|
||||||
|
|
||||||
|
function(get_host_triple out out_arch out_vendor out_os)
|
||||||
|
# Get the architecture.
|
||||||
|
set(arch ${CMAKE_HOST_SYSTEM_PROCESSOR})
|
||||||
|
if (arch STREQUAL "x86")
|
||||||
|
set(arch "i686")
|
||||||
|
endif()
|
||||||
|
# Get the vendor.
|
||||||
|
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
|
||||||
|
set(vendor "apple")
|
||||||
|
else()
|
||||||
|
set(vendor "pc")
|
||||||
|
endif()
|
||||||
|
# Get os.
|
||||||
|
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
|
||||||
|
set(os "win32")
|
||||||
|
else()
|
||||||
|
string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} os)
|
||||||
|
endif()
|
||||||
|
set(triple "${arch}-${vendor}-${os}")
|
||||||
|
set(${out} ${triple} PARENT_SCOPE)
|
||||||
|
set(${out_arch} ${arch} PARENT_SCOPE)
|
||||||
|
set(${out_vendor} ${vendor} PARENT_SCOPE)
|
||||||
|
set(${out_os} ${os} PARENT_SCOPE)
|
||||||
|
message(STATUS "Host triple: ${triple}")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(get_target_triple out out_arch out_vendor out_os)
|
||||||
|
# Get the architecture.
|
||||||
|
set(arch ${CMAKE_SYSTEM_PROCESSOR})
|
||||||
|
if (arch STREQUAL "x86")
|
||||||
|
set(arch "i686")
|
||||||
|
endif()
|
||||||
|
# Get the vendor.
|
||||||
|
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||||
|
set(vendor "apple")
|
||||||
|
else()
|
||||||
|
set(vendor "pc")
|
||||||
|
endif()
|
||||||
|
# Get os.
|
||||||
|
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||||
|
set(os "win32")
|
||||||
|
else()
|
||||||
|
string(TOLOWER ${CMAKE_SYSTEM_NAME} os)
|
||||||
|
endif()
|
||||||
|
set(triple "${arch}-${vendor}-${os}")
|
||||||
|
set(${out} ${triple} PARENT_SCOPE)
|
||||||
|
set(${out_arch} ${arch} PARENT_SCOPE)
|
||||||
|
set(${out_vendor} ${vendor} PARENT_SCOPE)
|
||||||
|
set(${out_os} ${os} PARENT_SCOPE)
|
||||||
|
message(STATUS "Target triple: ${triple}")
|
||||||
|
endfunction()
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
|
|
||||||
#===============================================================================
|
|
||||||
# Add an ABI library if appropriate
|
|
||||||
#===============================================================================
|
|
||||||
|
|
||||||
#
|
|
||||||
# _setup_abi: Set up the build to use an ABI library
|
|
||||||
#
|
|
||||||
# Parameters:
|
|
||||||
# abidefines: A list of defines needed to compile libc++ with the ABI library
|
|
||||||
# abilib : The ABI library to link against.
|
|
||||||
# abifiles : A list of files (which may be relative paths) to copy into the
|
|
||||||
# libc++ build tree for the build. These files will also be
|
|
||||||
# installed alongside the libc++ headers.
|
|
||||||
# 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}"
|
|
||||||
CACHE PATH
|
|
||||||
"Paths to C++ ABI header directories separated by ';'." FORCE
|
|
||||||
)
|
|
||||||
|
|
||||||
set(LIBCXX_CXX_ABI_LIBRARY ${abilib})
|
|
||||||
|
|
||||||
set(LIBCXX_ABILIB_FILES ${abifiles})
|
|
||||||
|
|
||||||
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include")
|
|
||||||
foreach(_d ${abidirs})
|
|
||||||
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/${_d}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
foreach(fpath ${LIBCXX_ABILIB_FILES})
|
|
||||||
set(found FALSE)
|
|
||||||
foreach(incpath ${LIBCXX_CXX_ABI_INCLUDE_PATHS})
|
|
||||||
if (EXISTS "${incpath}/${fpath}")
|
|
||||||
set(found TRUE)
|
|
||||||
get_filename_component(dstdir ${fpath} PATH)
|
|
||||||
get_filename_component(ifile ${fpath} NAME)
|
|
||||||
file(COPY "${incpath}/${fpath}"
|
|
||||||
DESTINATION "${CMAKE_BINARY_DIR}/include/${dstdir}"
|
|
||||||
)
|
|
||||||
if (LIBCXX_INSTALL_HEADERS)
|
|
||||||
install(FILES "${CMAKE_BINARY_DIR}/include/${fpath}"
|
|
||||||
DESTINATION include/c++/v1/${dstdir}
|
|
||||||
COMPONENT libcxx
|
|
||||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
list(APPEND abilib_headers "${CMAKE_BINARY_DIR}/include/${fpath}")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
if (NOT found)
|
|
||||||
message(WARNING "Failed to find ${fpath}")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_custom_target(LIBCXX_CXX_ABI_DEPS DEPENDS ${abilib_headers})
|
|
||||||
include_directories("${CMAKE_BINARY_DIR}/include")
|
|
||||||
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
|
|
||||||
# Configure based on the selected ABI library.
|
|
||||||
if ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libstdc++" OR
|
|
||||||
"${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libsupc++")
|
|
||||||
set(_LIBSUPCXX_INCLUDE_FILES
|
|
||||||
cxxabi.h bits/c++config.h bits/os_defines.h bits/cpu_defines.h
|
|
||||||
bits/cxxabi_tweaks.h bits/cxxabi_forced.h
|
|
||||||
)
|
|
||||||
if ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libstdc++")
|
|
||||||
set(_LIBSUPCXX_DEFINES "-DLIBSTDCXX")
|
|
||||||
set(_LIBSUPCXX_LIBNAME stdc++)
|
|
||||||
else()
|
|
||||||
set(_LIBSUPCXX_DEFINES "")
|
|
||||||
set(_LIBSUPCXX_LIBNAME supc++)
|
|
||||||
endif()
|
|
||||||
setup_abi_lib(
|
|
||||||
"-D__GLIBCXX__ ${_LIBSUPCXX_DEFINES}"
|
|
||||||
"${_LIBSUPCXX_LIBNAME}" "${_LIBSUPCXX_INCLUDE_FILES}" "bits"
|
|
||||||
)
|
|
||||||
elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxabi")
|
|
||||||
if (LIBCXX_CXX_ABI_INTREE)
|
|
||||||
# Link against just-built "cxxabi" target.
|
|
||||||
if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY)
|
|
||||||
set(CXXABI_LIBNAME cxxabi_static)
|
|
||||||
else()
|
|
||||||
set(CXXABI_LIBNAME cxxabi_shared)
|
|
||||||
endif()
|
|
||||||
set(LIBCXX_LIBCPPABI_VERSION "2" PARENT_SCOPE)
|
|
||||||
else()
|
|
||||||
# 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" ""
|
|
||||||
)
|
|
||||||
elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxrt")
|
|
||||||
setup_abi_lib("-DLIBCXXRT"
|
|
||||||
"cxxrt" "cxxabi.h;unwind.h;unwind-arm.h;unwind-itanium.h" ""
|
|
||||||
)
|
|
||||||
elseif (NOT "${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "none")
|
|
||||||
message(FATAL_ERROR
|
|
||||||
"Currently libstdc++, libsupc++, libcxxabi, libcxxrt and none are "
|
|
||||||
"supported for c++ abi."
|
|
||||||
)
|
|
||||||
endif ()
|
|
||||||
@@ -1,169 +0,0 @@
|
|||||||
# HandleLibcxxFlags - A set of macros used to setup the flags used to compile
|
|
||||||
# and link libc++. These macros add flags to the following CMake variables.
|
|
||||||
# - LIBCXX_COMPILE_FLAGS: flags used to compile libc++
|
|
||||||
# - LIBCXX_LINK_FLAGS: flags used to link libc++
|
|
||||||
# - LIBCXX_LIBRARIES: libraries to link libc++ to.
|
|
||||||
|
|
||||||
include(CheckCXXCompilerFlag)
|
|
||||||
|
|
||||||
unset(add_flag_if_supported)
|
|
||||||
|
|
||||||
# Mangle the name of a compiler flag into a valid CMake identifier.
|
|
||||||
# Ex: --std=c++11 -> STD_EQ_CXX11
|
|
||||||
macro(mangle_name str output)
|
|
||||||
string(STRIP "${str}" strippedStr)
|
|
||||||
string(REGEX REPLACE "^/" "" strippedStr "${strippedStr}")
|
|
||||||
string(REGEX REPLACE "^-+" "" strippedStr "${strippedStr}")
|
|
||||||
string(REGEX REPLACE "-+$" "" strippedStr "${strippedStr}")
|
|
||||||
string(REPLACE "-" "_" strippedStr "${strippedStr}")
|
|
||||||
string(REPLACE "=" "_EQ_" strippedStr "${strippedStr}")
|
|
||||||
string(REPLACE "+" "X" strippedStr "${strippedStr}")
|
|
||||||
string(TOUPPER "${strippedStr}" ${output})
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
# Remove a list of flags from all CMake variables that affect compile flags.
|
|
||||||
# This can be used to remove unwanted flags specified on the command line
|
|
||||||
# or added in other parts of LLVM's cmake configuration.
|
|
||||||
macro(remove_flags)
|
|
||||||
foreach(var ${ARGN})
|
|
||||||
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}")
|
|
||||||
string(REPLACE "${var}" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
|
|
||||||
string(REPLACE "${var}" "" CMAKE_SHARED_MODULE_FLAGS "${CMAKE_SHARED_MODULE_FLAGS}")
|
|
||||||
remove_definitions(${var})
|
|
||||||
endforeach()
|
|
||||||
endmacro(remove_flags)
|
|
||||||
|
|
||||||
# Add a macro definition if condition is true.
|
|
||||||
macro(define_if condition def)
|
|
||||||
if (${condition})
|
|
||||||
add_definitions(${def})
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
# Add a macro definition if condition is not true.
|
|
||||||
macro(define_if_not condition def)
|
|
||||||
if (NOT ${condition})
|
|
||||||
add_definitions(${def})
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
# Add a macro definition to the __config_site file if the specified condition
|
|
||||||
# is 'true'. Note that '-D${def}' is not added. Instead it is expected that
|
|
||||||
# the build include the '__config_site' header.
|
|
||||||
macro(config_define_if condition def)
|
|
||||||
if (${condition})
|
|
||||||
set(${def} ON)
|
|
||||||
set(LIBCXX_NEEDS_SITE_CONFIG ON)
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
macro(config_define_if_not condition def)
|
|
||||||
if (NOT ${condition})
|
|
||||||
set(${def} ON)
|
|
||||||
set(LIBCXX_NEEDS_SITE_CONFIG ON)
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
macro(config_define value def)
|
|
||||||
set(${def} ${value})
|
|
||||||
set(LIBCXX_NEEDS_SITE_CONFIG ON)
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
# Add a specified list of flags to both 'LIBCXX_COMPILE_FLAGS' and
|
|
||||||
# 'LIBCXX_LINK_FLAGS'.
|
|
||||||
macro(add_flags)
|
|
||||||
foreach(value ${ARGN})
|
|
||||||
list(APPEND LIBCXX_COMPILE_FLAGS ${value})
|
|
||||||
list(APPEND LIBCXX_LINK_FLAGS ${value})
|
|
||||||
endforeach()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
# If the specified 'condition' is true then add a list of flags to both
|
|
||||||
# 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS'.
|
|
||||||
macro(add_flags_if condition)
|
|
||||||
if (${condition})
|
|
||||||
add_flags(${ARGN})
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
# Add each flag in the list to LIBCXX_COMPILE_FLAGS and LIBCXX_LINK_FLAGS
|
|
||||||
# if that flag is supported by the current compiler.
|
|
||||||
macro(add_flags_if_supported)
|
|
||||||
foreach(flag ${ARGN})
|
|
||||||
mangle_name("${flag}" flagname)
|
|
||||||
check_cxx_compiler_flag("${flag}" "LIBCXX_SUPPORTS_${flagname}_FLAG")
|
|
||||||
add_flags_if(LIBCXX_SUPPORTS_${flagname}_FLAG ${flag})
|
|
||||||
endforeach()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
# Add a list of flags to 'LIBCXX_COMPILE_FLAGS'.
|
|
||||||
macro(add_compile_flags)
|
|
||||||
foreach(f ${ARGN})
|
|
||||||
list(APPEND LIBCXX_COMPILE_FLAGS ${f})
|
|
||||||
endforeach()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
# If 'condition' is true then add the specified list of flags to
|
|
||||||
# 'LIBCXX_COMPILE_FLAGS'
|
|
||||||
macro(add_compile_flags_if condition)
|
|
||||||
if (${condition})
|
|
||||||
add_compile_flags(${ARGN})
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
# For each specified flag, add that flag to 'LIBCXX_COMPILE_FLAGS' if the
|
|
||||||
# flag is supported by the C++ compiler.
|
|
||||||
macro(add_compile_flags_if_supported)
|
|
||||||
foreach(flag ${ARGN})
|
|
||||||
mangle_name("${flag}" flagname)
|
|
||||||
check_cxx_compiler_flag("${flag}" "LIBCXX_SUPPORTS_${flagname}_FLAG")
|
|
||||||
add_compile_flags_if(LIBCXX_SUPPORTS_${flagname}_FLAG ${flag})
|
|
||||||
endforeach()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
# Add a list of flags to 'LIBCXX_LINK_FLAGS'.
|
|
||||||
macro(add_link_flags)
|
|
||||||
foreach(f ${ARGN})
|
|
||||||
list(APPEND LIBCXX_LINK_FLAGS ${f})
|
|
||||||
endforeach()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
# If 'condition' is true then add the specified list of flags to
|
|
||||||
# 'LIBCXX_LINK_FLAGS'
|
|
||||||
macro(add_link_flags_if condition)
|
|
||||||
if (${condition})
|
|
||||||
add_link_flags(${ARGN})
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
# For each specified flag, add that flag to 'LIBCXX_LINK_FLAGS' if the
|
|
||||||
# flag is supported by the C++ compiler.
|
|
||||||
macro(add_link_flags_if_supported)
|
|
||||||
foreach(flag ${ARGN})
|
|
||||||
mangle_name("${flag}" flagname)
|
|
||||||
check_cxx_compiler_flag("${flag}" "LIBCXX_SUPPORTS_${flagname}_FLAG")
|
|
||||||
add_link_flags_if(LIBCXX_SUPPORTS_${flagname}_FLAG ${flag})
|
|
||||||
endforeach()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
# Add a list of libraries or link flags to 'LIBCXX_LIBRARIES'.
|
|
||||||
macro(add_library_flags)
|
|
||||||
foreach(lib ${ARGN})
|
|
||||||
list(APPEND LIBCXX_LIBRARIES ${lib})
|
|
||||||
endforeach()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
# if 'condition' is true then add the specified list of libraries and flags
|
|
||||||
# to 'LIBCXX_LIBRARIES'.
|
|
||||||
macro(add_library_flags_if condition)
|
|
||||||
if(${condition})
|
|
||||||
add_library_flags(${ARGN})
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
# Turn a comma separated CMake list into a space separated string.
|
|
||||||
macro(split_list listname)
|
|
||||||
string(REPLACE ";" " " ${listname} "${${listname}}")
|
|
||||||
endmacro()
|
|
||||||
@@ -1,138 +0,0 @@
|
|||||||
macro(find_llvm_parts)
|
|
||||||
# Rely on llvm-config.
|
|
||||||
set(CONFIG_OUTPUT)
|
|
||||||
find_program(LLVM_CONFIG "llvm-config")
|
|
||||||
if(DEFINED LLVM_PATH)
|
|
||||||
set(LLVM_INCLUDE_DIR ${LLVM_INCLUDE_DIR} CACHE PATH "Path to llvm/include")
|
|
||||||
set(LLVM_PATH ${LLVM_PATH} CACHE PATH "Path to LLVM source tree")
|
|
||||||
set(LLVM_MAIN_SRC_DIR ${LLVM_PATH})
|
|
||||||
set(LLVM_CMAKE_PATH "${LLVM_PATH}/cmake/modules")
|
|
||||||
elseif(LLVM_CONFIG)
|
|
||||||
message(STATUS "Found LLVM_CONFIG as ${LLVM_CONFIG}")
|
|
||||||
set(CONFIG_COMMAND ${LLVM_CONFIG}
|
|
||||||
"--includedir"
|
|
||||||
"--prefix"
|
|
||||||
"--src-root")
|
|
||||||
execute_process(
|
|
||||||
COMMAND ${CONFIG_COMMAND}
|
|
||||||
RESULT_VARIABLE HAD_ERROR
|
|
||||||
OUTPUT_VARIABLE CONFIG_OUTPUT
|
|
||||||
)
|
|
||||||
if(NOT HAD_ERROR)
|
|
||||||
string(REGEX REPLACE
|
|
||||||
"[ \t]*[\r\n]+[ \t]*" ";"
|
|
||||||
CONFIG_OUTPUT ${CONFIG_OUTPUT})
|
|
||||||
else()
|
|
||||||
string(REPLACE ";" " " CONFIG_COMMAND_STR "${CONFIG_COMMAND}")
|
|
||||||
message(STATUS "${CONFIG_COMMAND_STR}")
|
|
||||||
message(FATAL_ERROR "llvm-config failed with status ${HAD_ERROR}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(GET CONFIG_OUTPUT 0 INCLUDE_DIR)
|
|
||||||
list(GET CONFIG_OUTPUT 1 LLVM_OBJ_ROOT)
|
|
||||||
list(GET CONFIG_OUTPUT 2 MAIN_SRC_DIR)
|
|
||||||
|
|
||||||
set(LLVM_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include")
|
|
||||||
set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree")
|
|
||||||
set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
|
|
||||||
set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/share/llvm/cmake")
|
|
||||||
else()
|
|
||||||
set(LLVM_FOUND OFF)
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT EXISTS ${LLVM_MAIN_SRC_DIR})
|
|
||||||
set(LLVM_FOUND OFF)
|
|
||||||
message(WARNING "Not found: ${LLVM_MAIN_SRC_DIR}")
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT EXISTS ${LLVM_CMAKE_PATH})
|
|
||||||
set(LLVM_FOUND OFF)
|
|
||||||
message(WARNING "Not found: ${LLVM_CMAKE_PATH}")
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules")
|
|
||||||
|
|
||||||
set(LLVM_FOUND ON)
|
|
||||||
endmacro(find_llvm_parts)
|
|
||||||
|
|
||||||
|
|
||||||
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
|
||||||
set(LIBCXX_BUILT_STANDALONE 1)
|
|
||||||
message(STATUS "Configuring for standalone build.")
|
|
||||||
|
|
||||||
find_llvm_parts()
|
|
||||||
|
|
||||||
# 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()
|
|
||||||
if (NOT DEFINED LLVM_INCLUDE_DOCS)
|
|
||||||
set(LLVM_INCLUDE_DOCS ${LLVM_FOUND})
|
|
||||||
endif()
|
|
||||||
if (NOT DEFINED LLVM_ENABLE_SPHINX)
|
|
||||||
set(LLVM_ENABLE_SPHINX OFF)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Required LIT Configuration ------------------------------------------------
|
|
||||||
# Define the default arguments to use with 'lit', and an option for the user
|
|
||||||
# to override.
|
|
||||||
set(LIT_ARGS_DEFAULT "-sv --show-xfail --show-unsupported")
|
|
||||||
if (MSVC OR XCODE)
|
|
||||||
set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
|
|
||||||
endif()
|
|
||||||
set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
|
|
||||||
|
|
||||||
# Make sure we can use the console pool for recent cmake and ninja > 1.5
|
|
||||||
# Needed for add_lit_testsuite
|
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.1.20141117)
|
|
||||||
set(cmake_3_2_USES_TERMINAL)
|
|
||||||
else()
|
|
||||||
set(cmake_3_2_USES_TERMINAL USES_TERMINAL)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Required doc configuration
|
|
||||||
if (LLVM_ENABLE_SPHINX)
|
|
||||||
message(STATUS "Sphinx enabled.")
|
|
||||||
find_package(Sphinx REQUIRED)
|
|
||||||
else()
|
|
||||||
message(STATUS "Sphinx disabled.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# FIXME - This is cribbed from HandleLLVMOptions.cmake.
|
|
||||||
if(WIN32)
|
|
||||||
set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)
|
|
||||||
if(CYGWIN)
|
|
||||||
set(LLVM_ON_WIN32 0)
|
|
||||||
set(LLVM_ON_UNIX 1)
|
|
||||||
else(CYGWIN)
|
|
||||||
set(LLVM_ON_WIN32 1)
|
|
||||||
set(LLVM_ON_UNIX 0)
|
|
||||||
endif(CYGWIN)
|
|
||||||
else(WIN32)
|
|
||||||
if(UNIX)
|
|
||||||
set(LLVM_ON_WIN32 0)
|
|
||||||
set(LLVM_ON_UNIX 1)
|
|
||||||
if(APPLE)
|
|
||||||
set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)
|
|
||||||
else(APPLE)
|
|
||||||
set(LLVM_HAVE_LINK_VERSION_SCRIPT 1)
|
|
||||||
endif(APPLE)
|
|
||||||
else(UNIX)
|
|
||||||
MESSAGE(SEND_ERROR "Unable to determine platform")
|
|
||||||
endif(UNIX)
|
|
||||||
endif(WIN32)
|
|
||||||
|
|
||||||
# Add LLVM Functions --------------------------------------------------------
|
|
||||||
include(AddLLVM OPTIONAL)
|
|
||||||
endif()
|
|
||||||
@@ -2,18 +2,37 @@ include(CheckLibraryExists)
|
|||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
|
|
||||||
# Check compiler flags
|
# Check compiler flags
|
||||||
|
check_cxx_compiler_flag(-std=c++0x LIBCXX_HAS_STDCXX0X_FLAG)
|
||||||
check_cxx_compiler_flag(/WX LIBCXX_HAS_WX_FLAG)
|
check_cxx_compiler_flag(-fPIC LIBCXX_HAS_FPIC_FLAG)
|
||||||
check_cxx_compiler_flag(/WX- LIBCXX_HAS_NO_WX_FLAG)
|
check_cxx_compiler_flag(-nodefaultlibs LIBCXX_HAS_NODEFAULTLIBS_FLAG)
|
||||||
check_cxx_compiler_flag(/EHsc LIBCXX_HAS_EHSC_FLAG)
|
check_cxx_compiler_flag(-nostdinc++ LIBCXX_HAS_NOSTDINCXX_FLAG)
|
||||||
check_cxx_compiler_flag(/EHs- LIBCXX_HAS_NO_EHS_FLAG)
|
check_cxx_compiler_flag(-Wall LIBCXX_HAS_WALL_FLAG)
|
||||||
check_cxx_compiler_flag(/EHa- LIBCXX_HAS_NO_EHA_FLAG)
|
check_cxx_compiler_flag(-W LIBCXX_HAS_W_FLAG)
|
||||||
check_cxx_compiler_flag(/GR- LIBCXX_HAS_NO_GR_FLAG)
|
check_cxx_compiler_flag(-Wno-unused-parameter LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG)
|
||||||
|
check_cxx_compiler_flag(-Wwrite-strings LIBCXX_HAS_WWRITE_STRINGS_FLAG)
|
||||||
|
check_cxx_compiler_flag(-Wno-long-long LIBCXX_HAS_WNO_LONG_LONG_FLAG)
|
||||||
|
check_cxx_compiler_flag(-pedantic LIBCXX_HAS_PEDANTIC_FLAG)
|
||||||
|
check_cxx_compiler_flag(-Werror LIBCXX_HAS_WERROR_FLAG)
|
||||||
|
check_cxx_compiler_flag(-fno-exceptions LIBCXX_HAS_FNO_EXCEPTIONS_FLAG)
|
||||||
|
check_cxx_compiler_flag(-fno-rtti LIBCXX_HAS_FNO_RTTI_FLAG)
|
||||||
|
check_cxx_compiler_flag(/WX LIBCXX_HAS_WX_FLAG)
|
||||||
|
check_cxx_compiler_flag(/EHsc LIBCXX_HAS_EHSC_FLAG)
|
||||||
|
check_cxx_compiler_flag(/EHs- LIBCXX_HAS_NO_EHS_FLAG)
|
||||||
|
check_cxx_compiler_flag(/EHa- LIBCXX_HAS_NO_EHA_FLAG)
|
||||||
|
check_cxx_compiler_flag(/GR- LIBCXX_HAS_NO_GR_FLAG)
|
||||||
|
|
||||||
# Check libraries
|
# Check libraries
|
||||||
check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
|
check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
|
||||||
check_library_exists(c fopen "" LIBCXX_HAS_C_LIB)
|
check_library_exists(c printf "" LIBCXX_HAS_C_LIB)
|
||||||
check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
|
check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
|
||||||
check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
|
check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
|
||||||
check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
|
check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
|
||||||
|
|
||||||
|
# Check C++0x features
|
||||||
|
if (LIBCXX_ENABLE_CXX0X)
|
||||||
|
if (LIBCXX_HAS_STDCXX0X_FLAG)
|
||||||
|
set(CMAKE_REQUIRED_DEFINITIONS -std=c++0x)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(LIBCXX_HAS_STDCXX0X_FLAG FALSE)
|
||||||
|
endif()
|
||||||
|
|||||||
@@ -1,306 +0,0 @@
|
|||||||
|
|
||||||
===============
|
|
||||||
Building libc++
|
|
||||||
===============
|
|
||||||
|
|
||||||
.. contents::
|
|
||||||
:local:
|
|
||||||
|
|
||||||
Getting Started
|
|
||||||
===============
|
|
||||||
|
|
||||||
On Mac OS 10.7 (Lion) and later, the easiest way to get this library is to install
|
|
||||||
Xcode 4.2 or later. However if you want to install tip-of-trunk from here
|
|
||||||
(getting the bleeding edge), read on.
|
|
||||||
|
|
||||||
The basic steps needed to build libc++ are:
|
|
||||||
|
|
||||||
#. Checkout LLVM:
|
|
||||||
|
|
||||||
* ``cd where-you-want-llvm-to-live``
|
|
||||||
* ``svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm``
|
|
||||||
|
|
||||||
#. Checkout libc++:
|
|
||||||
|
|
||||||
* ``cd where-you-want-llvm-to-live``
|
|
||||||
* ``cd llvm/projects``
|
|
||||||
* ``svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx``
|
|
||||||
|
|
||||||
#. Checkout libc++abi:
|
|
||||||
|
|
||||||
* ``cd where-you-want-llvm-to-live``
|
|
||||||
* ``cd llvm/projects``
|
|
||||||
* ``svn co http://llvm.org/svn/llvm-project/libcxxabi/trunk libcxxabi``
|
|
||||||
|
|
||||||
#. Configure and build libc++ with libc++abi:
|
|
||||||
|
|
||||||
CMake is the only supported configuration system. Unlike other LLVM
|
|
||||||
projects autotools is not supported for either libc++ or libc++abi.
|
|
||||||
|
|
||||||
Clang is the preferred compiler when building and using libc++.
|
|
||||||
|
|
||||||
* ``cd where you want to build llvm``
|
|
||||||
* ``mkdir build``
|
|
||||||
* ``cd build``
|
|
||||||
* ``cmake -G <generator> [options] <path to llvm sources>``
|
|
||||||
|
|
||||||
For more information about configuring libc++ see :ref:`CMake Options`.
|
|
||||||
|
|
||||||
* ``make cxx`` --- will build libc++ and libc++abi.
|
|
||||||
* ``make check-libcxx check-libcxxabi`` --- will run the test suites.
|
|
||||||
|
|
||||||
Shared libraries for libc++ and libc++ abi should now be present in llvm/build/lib.
|
|
||||||
See :ref:`using an alternate libc++ installation <alternate libcxx>`
|
|
||||||
|
|
||||||
#. **Optional**: Install libc++ and libc++abi
|
|
||||||
|
|
||||||
If your system already provides a libc++ installation it is important to be
|
|
||||||
careful not to replace it. Remember Use the CMake option ``CMAKE_INSTALL_PREFIX`` to
|
|
||||||
select a safe place to install libc++.
|
|
||||||
|
|
||||||
* ``make install-libcxx install-libcxxabi`` --- Will install the libraries and the headers
|
|
||||||
|
|
||||||
.. warning::
|
|
||||||
* Replacing your systems libc++ installation could render the system non-functional.
|
|
||||||
* Mac OS X will not boot without a valid copy of ``libc++.1.dylib`` in ``/usr/lib``.
|
|
||||||
|
|
||||||
|
|
||||||
The instructions are for building libc++ on
|
|
||||||
FreeBSD, Linux, or Mac using `libc++abi`_ as the C++ ABI library.
|
|
||||||
On Linux, it is also possible to use :ref:`libsupc++ <libsupcxx>` or libcxxrt.
|
|
||||||
|
|
||||||
It is sometimes beneficial to build outside of the LLVM tree. An out-of-tree
|
|
||||||
build would look like this:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ cd where-you-want-libcxx-to-live
|
|
||||||
$ # Check out llvm, libc++ and libc++abi.
|
|
||||||
$ ``svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm``
|
|
||||||
$ ``svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx``
|
|
||||||
$ ``svn co http://llvm.org/svn/llvm-project/libcxxabi/trunk libcxxabi``
|
|
||||||
$ cd where-you-want-to-build
|
|
||||||
$ mkdir build && cd build
|
|
||||||
$ export CC=clang CXX=clang++
|
|
||||||
$ cmake -DLLVM_PATH=path/to/llvm \
|
|
||||||
-DLIBCXX_CXX_ABI=libcxxabi \
|
|
||||||
-DLIBCXX_CXX_ABI_INCLUDE_PATHS=path/to/libcxxabi/include \
|
|
||||||
path/to/libcxx
|
|
||||||
$ make
|
|
||||||
$ make check-libcxx # optional
|
|
||||||
|
|
||||||
|
|
||||||
.. _`libc++abi`: http://libcxxabi.llvm.org/
|
|
||||||
|
|
||||||
|
|
||||||
.. _CMake Options:
|
|
||||||
|
|
||||||
CMake Options
|
|
||||||
=============
|
|
||||||
|
|
||||||
Here are some of the CMake variables that are used often, along with a
|
|
||||||
brief explanation and LLVM-specific notes. For full documentation, check the
|
|
||||||
CMake docs or execute ``cmake --help-variable VARIABLE_NAME``.
|
|
||||||
|
|
||||||
**CMAKE_BUILD_TYPE**:STRING
|
|
||||||
Sets the build type for ``make`` based generators. Possible values are
|
|
||||||
Release, Debug, RelWithDebInfo and MinSizeRel. On systems like Visual Studio
|
|
||||||
the user sets the build type with the IDE settings.
|
|
||||||
|
|
||||||
**CMAKE_INSTALL_PREFIX**:PATH
|
|
||||||
Path where LLVM will be installed if "make install" is invoked or the
|
|
||||||
"INSTALL" target is built.
|
|
||||||
|
|
||||||
**CMAKE_CXX_COMPILER**:STRING
|
|
||||||
The C++ compiler to use when building and testing libc++.
|
|
||||||
|
|
||||||
|
|
||||||
.. _libcxx-specific options:
|
|
||||||
|
|
||||||
libc++ specific options
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
.. option:: LIBCXX_ENABLE_ASSERTIONS:BOOL
|
|
||||||
|
|
||||||
**Default**: ``ON``
|
|
||||||
|
|
||||||
Build libc++ with assertions enabled.
|
|
||||||
|
|
||||||
.. option:: LIBCXX_BUILD_32_BITS:BOOL
|
|
||||||
|
|
||||||
**Default**: ``OFF``
|
|
||||||
|
|
||||||
Build libc++ as a 32 bit library. Also see :option:`LLVM_BUILD_32_BITS`.
|
|
||||||
|
|
||||||
.. option:: LIBCXX_ENABLE_SHARED:BOOL
|
|
||||||
|
|
||||||
**Default**: ``ON``
|
|
||||||
|
|
||||||
Build libc++ as a shared library. If ``OFF`` is specified then libc++ is
|
|
||||||
built as a static library.
|
|
||||||
|
|
||||||
.. option:: LIBCXX_LIBDIR_SUFFIX:STRING
|
|
||||||
|
|
||||||
Extra suffix to append to the directory where libraries are to be installed.
|
|
||||||
This option overrides :option:`LLVM_LIBDIR_SUFFIX`.
|
|
||||||
|
|
||||||
.. _ABI Library Specific Options:
|
|
||||||
|
|
||||||
ABI Library Specific Options
|
|
||||||
----------------------------
|
|
||||||
|
|
||||||
.. option:: LIBCXX_CXX_ABI:STRING
|
|
||||||
|
|
||||||
**Values**: ``none``, ``libcxxabi``, ``libcxxrt``, ``libstdc++``, ``libsupc++``.
|
|
||||||
|
|
||||||
Select the ABI library to build libc++ against.
|
|
||||||
|
|
||||||
.. option:: LIBCXX_CXX_ABI_INCLUDE_PATHS:PATHS
|
|
||||||
|
|
||||||
Provide additional search paths for the ABI library headers.
|
|
||||||
|
|
||||||
.. option:: LIBCXX_CXX_ABI_LIBRARY_PATH:PATH
|
|
||||||
|
|
||||||
Provide the path to the ABI library that libc++ should link against.
|
|
||||||
|
|
||||||
.. option:: LIBCXX_ENABLE_STATIC_ABI_LIBRARY:BOOL
|
|
||||||
|
|
||||||
**Default**: ``OFF``
|
|
||||||
|
|
||||||
If this option is enabled, libc++ will try and link the selected ABI library
|
|
||||||
statically.
|
|
||||||
|
|
||||||
.. option:: LIBCXX_ENABLE_ABI_LINKER_SCRIPT:BOOL
|
|
||||||
|
|
||||||
**Default**: ``ON`` by default on UNIX platforms other than Apple unless
|
|
||||||
'LIBCXX_ENABLE_STATIC_ABI_LIBRARY' is ON. Otherwise the default value is ``OFF``.
|
|
||||||
|
|
||||||
This option generate and installs a linker script as ``libc++.so`` which
|
|
||||||
links the correct ABI library.
|
|
||||||
|
|
||||||
.. option:: LIBCXXABI_USE_LLVM_UNWINDER:BOOL
|
|
||||||
|
|
||||||
**Default**: ``OFF``
|
|
||||||
|
|
||||||
Build and use the LLVM unwinder. Note: This option can only be used when
|
|
||||||
libc++abi is the C++ ABI library used.
|
|
||||||
|
|
||||||
|
|
||||||
libc++ Feature options
|
|
||||||
----------------------
|
|
||||||
|
|
||||||
.. option:: LIBCXX_ENABLE_EXCEPTIONS:BOOL
|
|
||||||
|
|
||||||
**Default**: ``ON``
|
|
||||||
|
|
||||||
Build libc++ with exception support.
|
|
||||||
|
|
||||||
.. option:: LIBCXX_ENABLE_RTTI:BOOL
|
|
||||||
|
|
||||||
**Default**: ``ON``
|
|
||||||
|
|
||||||
Build libc++ with run time type information.
|
|
||||||
|
|
||||||
|
|
||||||
libc++ Feature options
|
|
||||||
----------------------
|
|
||||||
|
|
||||||
The following options allow building libc++ for a different ABI version.
|
|
||||||
|
|
||||||
.. option:: LIBCXX_ABI_VERSION:STRING
|
|
||||||
|
|
||||||
**Default**: ``1``
|
|
||||||
|
|
||||||
Defines the target ABI version of libc++.
|
|
||||||
|
|
||||||
.. option:: LIBCXX_ABI_UNSTABLE:BOOL
|
|
||||||
|
|
||||||
**Default**: ``OFF``
|
|
||||||
|
|
||||||
Build the "unstable" ABI version of libc++. Includes all ABI changing features
|
|
||||||
on top of the current stable version.
|
|
||||||
|
|
||||||
.. _LLVM-specific variables:
|
|
||||||
|
|
||||||
LLVM-specific options
|
|
||||||
---------------------
|
|
||||||
|
|
||||||
.. option:: LLVM_LIBDIR_SUFFIX:STRING
|
|
||||||
|
|
||||||
Extra suffix to append to the directory where libraries are to be
|
|
||||||
installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
|
|
||||||
to install libraries to ``/usr/lib64``.
|
|
||||||
|
|
||||||
.. option:: LLVM_BUILD_32_BITS:BOOL
|
|
||||||
|
|
||||||
Build 32-bits executables and libraries on 64-bits systems. This option is
|
|
||||||
available only on some 64-bits unix systems. Defaults to OFF.
|
|
||||||
|
|
||||||
.. option:: LLVM_LIT_ARGS:STRING
|
|
||||||
|
|
||||||
Arguments given to lit. ``make check`` and ``make clang-test`` are affected.
|
|
||||||
By default, ``'-sv --no-progress-bar'`` on Visual C++ and Xcode, ``'-sv'`` on
|
|
||||||
others.
|
|
||||||
|
|
||||||
|
|
||||||
Using Alternate ABI libraries
|
|
||||||
=============================
|
|
||||||
|
|
||||||
|
|
||||||
.. _libsupcxx:
|
|
||||||
|
|
||||||
Using libsupc++ on Linux
|
|
||||||
------------------------
|
|
||||||
|
|
||||||
You will need libstdc++ in order to provide libsupc++.
|
|
||||||
|
|
||||||
Figure out where the libsupc++ headers are on your system. On Ubuntu this
|
|
||||||
is ``/usr/include/c++/<version>`` and ``/usr/include/c++/<version>/<target-triple>``
|
|
||||||
|
|
||||||
You can also figure this out by running
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ echo | g++ -Wp,-v -x c++ - -fsyntax-only
|
|
||||||
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
|
|
||||||
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../x86_64-linux-gnu/include"
|
|
||||||
#include "..." search starts here:
|
|
||||||
#include <...> search starts here:
|
|
||||||
/usr/include/c++/4.7
|
|
||||||
/usr/include/c++/4.7/x86_64-linux-gnu
|
|
||||||
/usr/include/c++/4.7/backward
|
|
||||||
/usr/lib/gcc/x86_64-linux-gnu/4.7/include
|
|
||||||
/usr/local/include
|
|
||||||
/usr/lib/gcc/x86_64-linux-gnu/4.7/include-fixed
|
|
||||||
/usr/include/x86_64-linux-gnu
|
|
||||||
/usr/include
|
|
||||||
End of search list.
|
|
||||||
|
|
||||||
Note that the first two entries happen to be what we are looking for. This
|
|
||||||
may not be correct on other platforms.
|
|
||||||
|
|
||||||
We can now run CMake:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ CC=clang CXX=clang++ cmake -G "Unix Makefiles" \
|
|
||||||
-DLIBCXX_CXX_ABI=libstdc++ \
|
|
||||||
-DLIBCXX_CXX_ABI_INCLUDE_PATHS="/usr/include/c++/4.7/;/usr/include/c++/4.7/x86_64-linux-gnu/" \
|
|
||||||
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \
|
|
||||||
<libc++-source-dir>
|
|
||||||
|
|
||||||
|
|
||||||
You can also substitute ``-DLIBCXX_CXX_ABI=libsupc++``
|
|
||||||
above, which will cause the library to be linked to libsupc++ instead
|
|
||||||
of libstdc++, but this is only recommended if you know that you will
|
|
||||||
never need to link against libstdc++ in the same executable as libc++.
|
|
||||||
GCC ships libsupc++ separately but only as a static library. If a
|
|
||||||
program also needs to link against libstdc++, it will provide its
|
|
||||||
own copy of libsupc++ and this can lead to subtle problems.
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ make cxx
|
|
||||||
$ make install
|
|
||||||
|
|
||||||
You can now run clang with -stdlib=libc++.
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
|
|
||||||
if (LLVM_ENABLE_SPHINX)
|
|
||||||
if (SPHINX_FOUND)
|
|
||||||
include(AddSphinxTarget)
|
|
||||||
if (${SPHINX_OUTPUT_HTML})
|
|
||||||
add_sphinx_target(html libcxx)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
|
|
||||||
====================
|
|
||||||
Libc++ ABI stability
|
|
||||||
====================
|
|
||||||
|
|
||||||
Libc++ aims to preserve stable ABI to avoid subtle bugs when code built to the old ABI
|
|
||||||
is linked with the code build to the new ABI. At the same time, libc++ allows ABI-breaking
|
|
||||||
improvements and bugfixes for the scenarios when ABI change is not a issue.
|
|
||||||
|
|
||||||
To support both cases, libc++ allows specifying the ABI version at the
|
|
||||||
build time. The version is defined with a cmake option
|
|
||||||
LIBCXX_ABI_VERSION. Another option LIBCXX_ABI_UNSTABLE can be used to
|
|
||||||
include all present ABI breaking features. These options translate
|
|
||||||
into C++ macro definitions _LIBCPP_ABI_VERSION, _LIBCPP_ABI_UNSTABLE.
|
|
||||||
|
|
||||||
Any ABI-changing feature is placed under it's own macro, _LIBCPP_ABI_XXX, which is enabled
|
|
||||||
based on the value of _LIBCPP_ABI_VERSION. _LIBCPP_ABI_UNSTABLE, if set, enables all features at once.
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
=======================================================
|
|
||||||
Capturing configuration information during installation
|
|
||||||
=======================================================
|
|
||||||
|
|
||||||
.. contents::
|
|
||||||
:local:
|
|
||||||
|
|
||||||
The Problem
|
|
||||||
===========
|
|
||||||
|
|
||||||
Currently the libc++ supports building the library with a number of different
|
|
||||||
configuration options. Unfortunately all of that configuration information is
|
|
||||||
lost when libc++ is installed. In order to support "persistent"
|
|
||||||
configurations libc++ needs a mechanism to capture the configuration options
|
|
||||||
in the INSTALLED headers.
|
|
||||||
|
|
||||||
|
|
||||||
Design Goals
|
|
||||||
============
|
|
||||||
|
|
||||||
* The solution should not INSTALL any additional headers. We don't want an extra
|
|
||||||
#include slowing everybody down.
|
|
||||||
|
|
||||||
* The solution should not unduly affect libc++ developers. The problem is limited
|
|
||||||
to installed versions of libc++ and the solution should be as well.
|
|
||||||
|
|
||||||
* The solution should not modify any existing headers EXCEPT during installation.
|
|
||||||
It makes developers lives harder if they have to regenerate the libc++ headers
|
|
||||||
every time they are modified.
|
|
||||||
|
|
||||||
* The solution should not make any of the libc++ headers dependant on
|
|
||||||
files generated by the build system. The headers should be able to compile
|
|
||||||
out of the box without any modification.
|
|
||||||
|
|
||||||
* The solution should not have ANY effect on users who don't need special
|
|
||||||
configuration options. The vast majority of users will never need this so it
|
|
||||||
shouldn't cost them.
|
|
||||||
|
|
||||||
|
|
||||||
The Solution
|
|
||||||
============
|
|
||||||
|
|
||||||
When you first configure libc++ using CMake we check to see if we need to
|
|
||||||
capture any options. If we haven't been given any "persistent" options then
|
|
||||||
we do NOTHING.
|
|
||||||
|
|
||||||
Otherwise we create a custom installation rule that modifies the installed __config
|
|
||||||
header. The rule first generates a dummy "__config_site" header containing the required
|
|
||||||
#defines. The contents of the dummy header are then prependend to the installed
|
|
||||||
__config header. By manually prepending the files we avoid the cost of an
|
|
||||||
extra #include and we allow the __config header to be ignorant of the extra
|
|
||||||
configuration all together. An example "__config" header generated when
|
|
||||||
-DLIBCXX_ENABLE_THREADS=OFF is given to CMake would look something like:
|
|
||||||
|
|
||||||
.. code-block:: 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.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_CONFIG_SITE
|
|
||||||
#define _LIBCPP_CONFIG_SITE
|
|
||||||
|
|
||||||
/* #undef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE */
|
|
||||||
/* #undef _LIBCPP_HAS_NO_STDIN */
|
|
||||||
/* #undef _LIBCPP_HAS_NO_STDOUT */
|
|
||||||
#define _LIBCPP_HAS_NO_THREADS
|
|
||||||
/* #undef _LIBCPP_HAS_NO_MONOTONIC_CLOCK */
|
|
||||||
/* #undef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS */
|
|
||||||
|
|
||||||
#endif
|
|
||||||
// -*- C++ -*-
|
|
||||||
//===--------------------------- __config ---------------------------------===//
|
|
||||||
//
|
|
||||||
// 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_CONFIG
|
|
||||||
#define _LIBCPP_CONFIG
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
# Makefile for Sphinx documentation
|
|
||||||
#
|
|
||||||
# FIXME: This hack is only in place to allow the libcxx.llvm.org/docs builder
|
|
||||||
# to work with libcxx. This should be removed when that builder supports
|
|
||||||
# out-of-tree builds.
|
|
||||||
|
|
||||||
# You can set these variables from the command line.
|
|
||||||
SPHINXOPTS =
|
|
||||||
SPHINXBUILD = sphinx-build
|
|
||||||
PAPER =
|
|
||||||
BUILDDIR = _build
|
|
||||||
|
|
||||||
# Internal variables.
|
|
||||||
PAPEROPT_a4 = -D latex_paper_size=a4
|
|
||||||
PAPEROPT_letter = -D latex_paper_size=letter
|
|
||||||
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
|
||||||
# the i18n builder cannot share the environment and doctrees with the others
|
|
||||||
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
|
||||||
|
|
||||||
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext default
|
|
||||||
|
|
||||||
default: html
|
|
||||||
|
|
||||||
help:
|
|
||||||
@echo "Please use \`make <target>' where <target> is one of"
|
|
||||||
@echo " html to make standalone HTML files"
|
|
||||||
|
|
||||||
clean:
|
|
||||||
-rm -rf $(BUILDDIR)/*
|
|
||||||
|
|
||||||
html:
|
|
||||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
|
||||||
@echo
|
|
||||||
@# FIXME: Remove this `cp` once HTML->Sphinx transition is completed.
|
|
||||||
@# Kind of a hack, but HTML-formatted docs are on the way out anyway.
|
|
||||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
|
||||||
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
libc++ Documentation
|
|
||||||
====================
|
|
||||||
|
|
||||||
The libc++ documentation is written using the Sphinx documentation generator. It is
|
|
||||||
currently tested with Sphinx 1.1.3.
|
|
||||||
|
|
||||||
To build the documents into html configure libc++ with the following cmake options:
|
|
||||||
|
|
||||||
* -DLLVM_ENABLE_SPHINX=ON
|
|
||||||
* -DLIBCXX_INCLUDE_DOCS=ON
|
|
||||||
|
|
||||||
After configuring libc++ with these options the make rule `docs-libcxx-html`
|
|
||||||
should be available.
|
|
||||||
@@ -1,191 +0,0 @@
|
|||||||
==============
|
|
||||||
Testing libc++
|
|
||||||
==============
|
|
||||||
|
|
||||||
.. contents::
|
|
||||||
:local:
|
|
||||||
|
|
||||||
Getting Started
|
|
||||||
===============
|
|
||||||
|
|
||||||
libc++ uses LIT to configure and run its tests. The primary way to run the
|
|
||||||
libc++ tests is by using make check-libcxx. However since libc++ can be used
|
|
||||||
in any number of possible configurations it is important to customize the way
|
|
||||||
LIT builds and runs the tests. This guide provides information on how to use
|
|
||||||
LIT directly to test libc++.
|
|
||||||
|
|
||||||
Please see the `Lit Command Guide`_ for more information about LIT.
|
|
||||||
|
|
||||||
.. _LIT Command Guide: http://llvm.org/docs/CommandGuide/lit.html
|
|
||||||
|
|
||||||
Setting up the Environment
|
|
||||||
--------------------------
|
|
||||||
|
|
||||||
After building libc++ you must setup your environment to test libc++ using
|
|
||||||
LIT.
|
|
||||||
|
|
||||||
#. Create a shortcut to the actual lit executable so that you can invoke it
|
|
||||||
easily from the command line.
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ alias lit='python path/to/llvm/utils/lit/lit.py'
|
|
||||||
|
|
||||||
#. Tell LIT where to find your build configuration.
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ export LIBCXX_SITE_CONFIG=path/to/build-libcxx/test/lit.site.cfg
|
|
||||||
|
|
||||||
Example Usage
|
|
||||||
-------------
|
|
||||||
|
|
||||||
Once you have your environment set up and you have built libc++ you can run
|
|
||||||
parts of the libc++ test suite by simply running `lit` on a specified test or
|
|
||||||
directory. For example:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ cd path/to/src/libcxx
|
|
||||||
$ lit -sv test/std/re # Run all of the std::regex tests
|
|
||||||
$ lit -sv test/std/depr/depr.c.headers/stdlib_h.pass.cpp # Run a single test
|
|
||||||
$ lit -sv test/std/atomics test/std/threads # Test std::thread and std::atomic
|
|
||||||
|
|
||||||
Sometimes you'll want to change the way LIT is running the tests. Custom options
|
|
||||||
can be specified using the `--param=<name>=<val>` flag. The most common option
|
|
||||||
you'll want to change is the standard dialect (ie -std=c++XX). By default the
|
|
||||||
test suite will select the newest C++ dialect supported by the compiler and use
|
|
||||||
that. However if you want to manually specify the option like so:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ lit -sv test/std/containers # Run the tests with the newest -std
|
|
||||||
$ lit -sv --param=std=c++03 test/std/containers # Run the tests in C++03
|
|
||||||
|
|
||||||
Occasionally you'll want to add extra compile or link flags when testing.
|
|
||||||
You can do this as follows:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ lit -sv --param=compile_flags='-Wcustom-warning'
|
|
||||||
$ lit -sv --param=link_flags='-L/custom/library/path'
|
|
||||||
|
|
||||||
Some other common examples include:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
# Specify a custom compiler.
|
|
||||||
$ lit -sv --param=cxx_under_test=/opt/bin/g++ test/std
|
|
||||||
|
|
||||||
# Enable warnings in the test suite
|
|
||||||
$ lit -sv --param=enable_warnings=true test/std
|
|
||||||
|
|
||||||
# Use UBSAN when running the tests.
|
|
||||||
$ lit -sv --param=use_sanitizer=Undefined
|
|
||||||
|
|
||||||
|
|
||||||
LIT Options
|
|
||||||
===========
|
|
||||||
|
|
||||||
:program:`lit` [*options*...] [*filenames*...]
|
|
||||||
|
|
||||||
Command Line Options
|
|
||||||
--------------------
|
|
||||||
|
|
||||||
To use these options you pass them on the LIT command line as --param NAME or
|
|
||||||
--param NAME=VALUE. Some options have default values specified during CMake's
|
|
||||||
configuration. Passing the option on the command line will override the default.
|
|
||||||
|
|
||||||
.. program:: lit
|
|
||||||
|
|
||||||
.. option:: cxx_under_test=<path/to/compiler>
|
|
||||||
|
|
||||||
Specify the compiler used to build the tests.
|
|
||||||
|
|
||||||
.. option:: std=<standard version>
|
|
||||||
|
|
||||||
**Values**: c++98, c++03, c++11, c++14, c++1z
|
|
||||||
|
|
||||||
Change the standard version used when building the tests.
|
|
||||||
|
|
||||||
.. option:: libcxx_site_config=<path/to/lit.site.cfg>
|
|
||||||
|
|
||||||
Specify the site configuration to use when running the tests. This option
|
|
||||||
overrides the enviroment variable LIBCXX_SITE_CONFIG.
|
|
||||||
|
|
||||||
.. option:: libcxx_headers=<path/to/headers>
|
|
||||||
|
|
||||||
Specify the libc++ headers that are tested. By default the headers in the
|
|
||||||
source tree are used.
|
|
||||||
|
|
||||||
.. option:: libcxx_library=<path/to/libc++.so>
|
|
||||||
|
|
||||||
Specify the libc++ library that is tested. By default the library in the
|
|
||||||
build directory is used. This option cannot be used when use_system_lib is
|
|
||||||
provided.
|
|
||||||
|
|
||||||
.. option:: use_system_lib=<bool>
|
|
||||||
|
|
||||||
**Default**: False
|
|
||||||
|
|
||||||
Enable or disable testing against the installed version of libc++ library.
|
|
||||||
Note: This does not use the installed headers.
|
|
||||||
|
|
||||||
.. option:: use_lit_shell=<bool>
|
|
||||||
|
|
||||||
Enable or disable the use of LIT's internal shell in ShTests. If the
|
|
||||||
environment variable LIT_USE_INTERNAL_SHELL is present then that is used as
|
|
||||||
the default value. Otherwise the default value is True on Windows and False
|
|
||||||
on every other platform.
|
|
||||||
|
|
||||||
.. option:: no_default_flags=<bool>
|
|
||||||
|
|
||||||
**Default**: False
|
|
||||||
|
|
||||||
Disable all default compile and link flags from being added. When this
|
|
||||||
option is used only flags specified using the compile_flags and link_flags
|
|
||||||
will be used.
|
|
||||||
|
|
||||||
.. option:: compile_flags="<list-of-args>"
|
|
||||||
|
|
||||||
Specify additional compile flags as a space delimited string.
|
|
||||||
Note: This options should not be used to change the standard version used.
|
|
||||||
|
|
||||||
.. option:: link_flags="<list-of-args>"
|
|
||||||
|
|
||||||
Specify additional link flags as a space delimited string.
|
|
||||||
|
|
||||||
.. option:: debug_level=<level>
|
|
||||||
|
|
||||||
**Values**: 0, 1
|
|
||||||
|
|
||||||
Enable the use of debug mode. Level 0 enables assertions and level 1 enables
|
|
||||||
assertions and debugging of iterator misuse.
|
|
||||||
|
|
||||||
.. option:: use_sanitizer=<sanitizer name>
|
|
||||||
|
|
||||||
**Values**: Memory, MemoryWithOrigins, Address, Undefined
|
|
||||||
|
|
||||||
Run the tests using the given sanitizer. If LLVM_USE_SANITIZER was given when
|
|
||||||
building libc++ then that sanitizer will be used by default.
|
|
||||||
|
|
||||||
.. option:: color_diagnostics
|
|
||||||
|
|
||||||
Enable the use of colorized compile diagnostics. If the color_diagnostics
|
|
||||||
option is specified or the environment variable LIBCXX_COLOR_DIAGNOSTICS is
|
|
||||||
present then color diagnostics will be enabled.
|
|
||||||
|
|
||||||
|
|
||||||
Environment Variables
|
|
||||||
---------------------
|
|
||||||
|
|
||||||
.. envvar:: LIBCXX_SITE_CONFIG=<path/to/lit.site.cfg>
|
|
||||||
|
|
||||||
Specify the site configuration to use when running the tests.
|
|
||||||
Also see :option:`libcxx_site_config`.
|
|
||||||
|
|
||||||
.. envvar:: LIBCXX_COLOR_DIAGNOSTICS
|
|
||||||
|
|
||||||
If ``LIBCXX_COLOR_DIAGNOSTICS`` is defined then the test suite will attempt
|
|
||||||
to use color diagnostic outputs from the compiler.
|
|
||||||
Also see :option:`color_diagnostics`.
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
============
|
|
||||||
Using libc++
|
|
||||||
============
|
|
||||||
|
|
||||||
.. contents::
|
|
||||||
:local:
|
|
||||||
|
|
||||||
Getting Started
|
|
||||||
===============
|
|
||||||
|
|
||||||
If you already have libc++ installed you can use it with clang.
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ clang++ -stdlib=libc++ test.cpp
|
|
||||||
$ clang++ -std=c++11 -stdlib=libc++ test.cpp
|
|
||||||
|
|
||||||
On OS X and FreeBSD libc++ is the default standard library
|
|
||||||
and the ``-stdlib=libc++`` is not required.
|
|
||||||
|
|
||||||
.. _alternate libcxx:
|
|
||||||
|
|
||||||
If you want to select an alternate installation of libc++ you
|
|
||||||
can use the following options.
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ clang++ -std=c++11 -stdlib=libc++ -nostdinc++ \
|
|
||||||
-I<libcxx-install-prefix>/include/c++/v1 \
|
|
||||||
-L<libcxx-install-prefix>/lib \
|
|
||||||
-Wl,-rpath,<libcxx-install-prefix>/lib \
|
|
||||||
test.cpp
|
|
||||||
|
|
||||||
The option ``-Wl,-rpath,<libcxx-install-prefix>/lib`` adds a runtime library
|
|
||||||
search path. Meaning that the systems dynamic linker will look for libc++ in
|
|
||||||
``<libcxx-install-prefix>/lib`` whenever the program is run. Alternatively the
|
|
||||||
environment variable ``LD_LIBRARY_PATH`` (``DYLD_LIBRARY_PATH`` on OS X) can
|
|
||||||
be used to change the dynamic linkers search paths after a program is compiled.
|
|
||||||
|
|
||||||
An example of using ``LD_LIBRARY_PATH``:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ clang++ -stdlib=libc++ -nostdinc++ \
|
|
||||||
-I<libcxx-install-prefix>/include/c++/v1
|
|
||||||
-L<libcxx-install-prefix>/lib \
|
|
||||||
test.cpp -o
|
|
||||||
$ ./a.out # Searches for libc++ in the systems library paths.
|
|
||||||
$ export LD_LIBRARY_PATH=<libcxx-install-prefix>/lib
|
|
||||||
$ ./a.out # Searches for libc++ along LD_LIBRARY_PATH
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Using libc++ on Linux
|
|
||||||
=====================
|
|
||||||
|
|
||||||
On Linux libc++ can typically be used with only '-stdlib=libc++'. However
|
|
||||||
some libc++ installations require the user manually link libc++abi themselves.
|
|
||||||
If you are running into linker errors when using libc++ try adding '-lc++abi'
|
|
||||||
to the link line. For example:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ clang++ -stdlib=libc++ test.cpp -lc++ -lc++abi -lm -lc -lgcc_s -lgcc
|
|
||||||
|
|
||||||
Alternately, you could just add libc++abi to your libraries list, which in
|
|
||||||
most situations will give the same result:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ clang++ -stdlib=libc++ test.cpp -lc++abi
|
|
||||||
|
|
||||||
|
|
||||||
Using libc++ with GCC
|
|
||||||
---------------------
|
|
||||||
|
|
||||||
GCC does not provide a way to switch from libstdc++ to libc++. You must manually
|
|
||||||
configure the compile and link commands.
|
|
||||||
|
|
||||||
In particular you must tell GCC to remove the libstdc++ include directories
|
|
||||||
using ``-nostdinc++`` and to not link libstdc++.so using ``-nodefaultlibs``.
|
|
||||||
|
|
||||||
Note that ``-nodefaultlibs`` removes all of the standard system libraries and
|
|
||||||
not just libstdc++ so they must be manually linked. For example:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ g++ -nostdinc++ -I<libcxx-install-prefix>/include/c++/v1 \
|
|
||||||
test.cpp -nodefaultlibs -lc++ -lc++abi -lm -lc -lgcc_s -lgcc
|
|
||||||
251
docs/conf.py
251
docs/conf.py
@@ -1,251 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# libc++ documentation build configuration file.
|
|
||||||
#
|
|
||||||
# This file is execfile()d with the current directory set to its containing dir.
|
|
||||||
#
|
|
||||||
# Note that not all possible configuration values are present in this
|
|
||||||
# autogenerated file.
|
|
||||||
#
|
|
||||||
# All configuration values have a default; values that are commented out
|
|
||||||
# serve to show the default.
|
|
||||||
|
|
||||||
import sys, os
|
|
||||||
|
|
||||||
# If extensions (or modules to document with autodoc) are in another directory,
|
|
||||||
# add these directories to sys.path here. If the directory is relative to the
|
|
||||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
|
||||||
#sys.path.insert(0, os.path.abspath('.'))
|
|
||||||
|
|
||||||
# -- General configuration -----------------------------------------------------
|
|
||||||
|
|
||||||
# If your documentation needs a minimal Sphinx version, state it here.
|
|
||||||
#needs_sphinx = '1.0'
|
|
||||||
|
|
||||||
# Add any Sphinx extension module names here, as strings. They can be extensions
|
|
||||||
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
|
||||||
extensions = ['sphinx.ext.intersphinx', 'sphinx.ext.todo']
|
|
||||||
|
|
||||||
# Add any paths that contain templates here, relative to this directory.
|
|
||||||
templates_path = ['_templates']
|
|
||||||
|
|
||||||
# The suffix of source filenames.
|
|
||||||
source_suffix = '.rst'
|
|
||||||
|
|
||||||
# The encoding of source files.
|
|
||||||
#source_encoding = 'utf-8-sig'
|
|
||||||
|
|
||||||
# The master toctree document.
|
|
||||||
master_doc = 'index'
|
|
||||||
|
|
||||||
# General information about the project.
|
|
||||||
project = u'libc++'
|
|
||||||
copyright = u'2011-2015, LLVM Project'
|
|
||||||
|
|
||||||
# The version info for the project you're documenting, acts as replacement for
|
|
||||||
# |version| and |release|, also used in various other places throughout the
|
|
||||||
# built documents.
|
|
||||||
#
|
|
||||||
# The short X.Y version.
|
|
||||||
version = '3.8'
|
|
||||||
# The full version, including alpha/beta/rc tags.
|
|
||||||
release = '3.8'
|
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
|
||||||
# for a list of supported languages.
|
|
||||||
#language = None
|
|
||||||
|
|
||||||
# There are two options for replacing |today|: either, you set today to some
|
|
||||||
# non-false value, then it is used:
|
|
||||||
#today = ''
|
|
||||||
# Else, today_fmt is used as the format for a strftime call.
|
|
||||||
today_fmt = '%Y-%m-%d'
|
|
||||||
|
|
||||||
# List of patterns, relative to source directory, that match files and
|
|
||||||
# directories to ignore when looking for source files.
|
|
||||||
exclude_patterns = ['_build']
|
|
||||||
|
|
||||||
# The reST default role (used for this markup: `text`) to use for all documents.
|
|
||||||
#default_role = None
|
|
||||||
|
|
||||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
|
||||||
#add_function_parentheses = True
|
|
||||||
|
|
||||||
# If true, the current module name will be prepended to all description
|
|
||||||
# unit titles (such as .. function::).
|
|
||||||
#add_module_names = True
|
|
||||||
|
|
||||||
# If true, sectionauthor and moduleauthor directives will be shown in the
|
|
||||||
# output. They are ignored by default.
|
|
||||||
show_authors = True
|
|
||||||
|
|
||||||
# The name of the Pygments (syntax highlighting) style to use.
|
|
||||||
pygments_style = 'friendly'
|
|
||||||
|
|
||||||
# A list of ignored prefixes for module index sorting.
|
|
||||||
#modindex_common_prefix = []
|
|
||||||
|
|
||||||
|
|
||||||
# -- Options for HTML output ---------------------------------------------------
|
|
||||||
|
|
||||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
|
||||||
# a list of builtin themes.
|
|
||||||
html_theme = 'haiku'
|
|
||||||
|
|
||||||
# Theme options are theme-specific and customize the look and feel of a theme
|
|
||||||
# further. For a list of options available for each theme, see the
|
|
||||||
# documentation.
|
|
||||||
#html_theme_options = {}
|
|
||||||
|
|
||||||
# Add any paths that contain custom themes here, relative to this directory.
|
|
||||||
#html_theme_path = []
|
|
||||||
|
|
||||||
# The name for this set of Sphinx documents. If None, it defaults to
|
|
||||||
# "<project> v<release> documentation".
|
|
||||||
#html_title = None
|
|
||||||
|
|
||||||
# A shorter title for the navigation bar. Default is the same as html_title.
|
|
||||||
#html_short_title = None
|
|
||||||
|
|
||||||
# The name of an image file (relative to this directory) to place at the top
|
|
||||||
# of the sidebar.
|
|
||||||
#html_logo = None
|
|
||||||
|
|
||||||
# The name of an image file (within the static path) to use as favicon of the
|
|
||||||
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
|
||||||
# pixels large.
|
|
||||||
#html_favicon = None
|
|
||||||
|
|
||||||
# Add any paths that contain custom static files (such as style sheets) here,
|
|
||||||
# relative to this directory. They are copied after the builtin static files,
|
|
||||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
|
||||||
html_static_path = []
|
|
||||||
|
|
||||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
|
||||||
# using the given strftime format.
|
|
||||||
#html_last_updated_fmt = '%b %d, %Y'
|
|
||||||
|
|
||||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
|
||||||
# typographically correct entities.
|
|
||||||
#html_use_smartypants = True
|
|
||||||
|
|
||||||
# Custom sidebar templates, maps document names to template names.
|
|
||||||
#html_sidebars = {}
|
|
||||||
|
|
||||||
# Additional templates that should be rendered to pages, maps page names to
|
|
||||||
# template names.
|
|
||||||
#html_additional_pages = {}
|
|
||||||
|
|
||||||
# If false, no module index is generated.
|
|
||||||
#html_domain_indices = True
|
|
||||||
|
|
||||||
# If false, no index is generated.
|
|
||||||
#html_use_index = True
|
|
||||||
|
|
||||||
# If true, the index is split into individual pages for each letter.
|
|
||||||
#html_split_index = False
|
|
||||||
|
|
||||||
# If true, links to the reST sources are added to the pages.
|
|
||||||
#html_show_sourcelink = True
|
|
||||||
|
|
||||||
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
|
||||||
#html_show_sphinx = True
|
|
||||||
|
|
||||||
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
|
||||||
#html_show_copyright = True
|
|
||||||
|
|
||||||
# If true, an OpenSearch description file will be output, and all pages will
|
|
||||||
# contain a <link> tag referring to it. The value of this option must be the
|
|
||||||
# base URL from which the finished HTML is served.
|
|
||||||
#html_use_opensearch = ''
|
|
||||||
|
|
||||||
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
|
||||||
#html_file_suffix = None
|
|
||||||
|
|
||||||
# Output file base name for HTML help builder.
|
|
||||||
htmlhelp_basename = 'libcxxdoc'
|
|
||||||
|
|
||||||
|
|
||||||
# -- Options for LaTeX output --------------------------------------------------
|
|
||||||
|
|
||||||
latex_elements = {
|
|
||||||
# The paper size ('letterpaper' or 'a4paper').
|
|
||||||
#'papersize': 'letterpaper',
|
|
||||||
|
|
||||||
# The font size ('10pt', '11pt' or '12pt').
|
|
||||||
#'pointsize': '10pt',
|
|
||||||
|
|
||||||
# Additional stuff for the LaTeX preamble.
|
|
||||||
#'preamble': '',
|
|
||||||
}
|
|
||||||
|
|
||||||
# Grouping the document tree into LaTeX files. List of tuples
|
|
||||||
# (source start file, target name, title, author, documentclass [howto/manual]).
|
|
||||||
latex_documents = [
|
|
||||||
('contents', 'libcxx.tex', u'libcxx Documentation',
|
|
||||||
u'LLVM project', 'manual'),
|
|
||||||
]
|
|
||||||
|
|
||||||
# The name of an image file (relative to this directory) to place at the top of
|
|
||||||
# the title page.
|
|
||||||
#latex_logo = None
|
|
||||||
|
|
||||||
# For "manual" documents, if this is true, then toplevel headings are parts,
|
|
||||||
# not chapters.
|
|
||||||
#latex_use_parts = False
|
|
||||||
|
|
||||||
# If true, show page references after internal links.
|
|
||||||
#latex_show_pagerefs = False
|
|
||||||
|
|
||||||
# If true, show URL addresses after external links.
|
|
||||||
#latex_show_urls = False
|
|
||||||
|
|
||||||
# Documents to append as an appendix to all manuals.
|
|
||||||
#latex_appendices = []
|
|
||||||
|
|
||||||
# If false, no module index is generated.
|
|
||||||
#latex_domain_indices = True
|
|
||||||
|
|
||||||
|
|
||||||
# -- Options for manual page output --------------------------------------------
|
|
||||||
|
|
||||||
# One entry per manual page. List of tuples
|
|
||||||
# (source start file, name, description, authors, manual section).
|
|
||||||
man_pages = [
|
|
||||||
('contents', 'libc++', u'libc++ Documentation',
|
|
||||||
[u'LLVM project'], 1)
|
|
||||||
]
|
|
||||||
|
|
||||||
# If true, show URL addresses after external links.
|
|
||||||
#man_show_urls = False
|
|
||||||
|
|
||||||
|
|
||||||
# -- Options for Texinfo output ------------------------------------------------
|
|
||||||
|
|
||||||
# Grouping the document tree into Texinfo files. List of tuples
|
|
||||||
# (source start file, target name, title, author,
|
|
||||||
# dir menu entry, description, category)
|
|
||||||
texinfo_documents = [
|
|
||||||
('contents', 'libc++', u'libc++ Documentation',
|
|
||||||
u'LLVM project', 'libc++', 'One line description of project.',
|
|
||||||
'Miscellaneous'),
|
|
||||||
]
|
|
||||||
|
|
||||||
# Documents to append as an appendix to all manuals.
|
|
||||||
#texinfo_appendices = []
|
|
||||||
|
|
||||||
# If false, no module index is generated.
|
|
||||||
#texinfo_domain_indices = True
|
|
||||||
|
|
||||||
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
|
||||||
#texinfo_show_urls = 'footnote'
|
|
||||||
|
|
||||||
|
|
||||||
# FIXME: Define intersphinx configration.
|
|
||||||
intersphinx_mapping = {}
|
|
||||||
|
|
||||||
|
|
||||||
# -- Options for extensions ----------------------------------------------------
|
|
||||||
|
|
||||||
# Enable this if you want TODOs to show up in the generated documentation.
|
|
||||||
todo_include_todos = True
|
|
||||||
185
docs/index.rst
185
docs/index.rst
@@ -1,185 +0,0 @@
|
|||||||
.. _index:
|
|
||||||
|
|
||||||
=============================
|
|
||||||
"libc++" C++ Standard Library
|
|
||||||
=============================
|
|
||||||
|
|
||||||
Overview
|
|
||||||
========
|
|
||||||
|
|
||||||
libc++ is a new implementation of the C++ standard library, targeting C++11.
|
|
||||||
|
|
||||||
* Features and Goals
|
|
||||||
|
|
||||||
* Correctness as defined by the C++11 standard.
|
|
||||||
* Fast execution.
|
|
||||||
* Minimal memory use.
|
|
||||||
* Fast compile times.
|
|
||||||
* ABI compatibility with gcc's libstdc++ for some low-level features
|
|
||||||
such as exception objects, rtti and memory allocation.
|
|
||||||
* Extensive unit tests.
|
|
||||||
|
|
||||||
* Design and Implementation:
|
|
||||||
|
|
||||||
* Extensive unit tests
|
|
||||||
* Internal linker model can be dumped/read to textual format
|
|
||||||
* Additional linking features can be plugged in as "passes"
|
|
||||||
* OS specific and CPU specific code factored out
|
|
||||||
|
|
||||||
|
|
||||||
Getting Started with libc++
|
|
||||||
---------------------------
|
|
||||||
|
|
||||||
.. toctree::
|
|
||||||
:maxdepth: 2
|
|
||||||
|
|
||||||
UsingLibcxx
|
|
||||||
BuildingLibcxx
|
|
||||||
TestingLibcxx
|
|
||||||
|
|
||||||
|
|
||||||
Current Status
|
|
||||||
--------------
|
|
||||||
|
|
||||||
After its initial introduction, many people have asked "why start a new
|
|
||||||
library instead of contributing to an existing library?" (like Apache's
|
|
||||||
libstdcxx, GNU's libstdc++, STLport, etc). There are many contributing
|
|
||||||
reasons, but some of the major ones are:
|
|
||||||
|
|
||||||
* From years of experience (including having implemented the standard
|
|
||||||
library before), we've learned many things about implementing
|
|
||||||
the standard containers which require ABI breakage and fundamental changes
|
|
||||||
to how they are implemented. For example, it is generally accepted that
|
|
||||||
building std::string using the "short string optimization" instead of
|
|
||||||
using Copy On Write (COW) is a superior approach for multicore
|
|
||||||
machines (particularly in C++11, which has rvalue references). Breaking
|
|
||||||
ABI compatibility with old versions of the library was
|
|
||||||
determined to be critical to achieving the performance goals of
|
|
||||||
libc++.
|
|
||||||
|
|
||||||
* Mainline libstdc++ has switched to GPL3, a license which the developers
|
|
||||||
of libc++ cannot use. libstdc++ 4.2 (the last GPL2 version) could be
|
|
||||||
independently extended to support C++11, but this would be a fork of the
|
|
||||||
codebase (which is often seen as worse for a project than starting a new
|
|
||||||
independent one). Another problem with libstdc++ is that it is tightly
|
|
||||||
integrated with G++ development, tending to be tied fairly closely to the
|
|
||||||
matching version of G++.
|
|
||||||
|
|
||||||
* STLport and the Apache libstdcxx library are two other popular
|
|
||||||
candidates, but both lack C++11 support. Our experience (and the
|
|
||||||
experience of libstdc++ developers) is that adding support for C++11 (in
|
|
||||||
particular rvalue references and move-only types) requires changes to
|
|
||||||
almost every class and function, essentially amounting to a rewrite.
|
|
||||||
Faced with a rewrite, we decided to start from scratch and evaluate every
|
|
||||||
design decision from first principles based on experience.
|
|
||||||
Further, both projects are apparently abandoned: STLport 5.2.1 was
|
|
||||||
released in Oct'08, and STDCXX 4.2.1 in May'08.
|
|
||||||
|
|
||||||
Platform and Compiler Support
|
|
||||||
-----------------------------
|
|
||||||
|
|
||||||
libc++ is known to work on the following platforms, using gcc-4.2 and
|
|
||||||
clang (lack of C++11 language support disables some functionality).
|
|
||||||
Note that functionality provided by ``<atomic>`` is only functional with clang
|
|
||||||
and GCC.
|
|
||||||
|
|
||||||
============ ==================== ============ ========================
|
|
||||||
OS Arch Compilers ABI Library
|
|
||||||
============ ==================== ============ ========================
|
|
||||||
Mac OS X i386, x86_64 Clang, GCC libc++abi
|
|
||||||
FreeBSD 10+ i386, x86_64, ARM Clang, GCC libcxxrt, libc++abi
|
|
||||||
Linux i386, x86_64 Clang, GCC libc++abi
|
|
||||||
============ ==================== ============ ========================
|
|
||||||
|
|
||||||
The following minimum compiler versions are strongly recommended.
|
|
||||||
|
|
||||||
* Clang 3.5 and above
|
|
||||||
* GCC 4.7 and above.
|
|
||||||
|
|
||||||
Anything older *may* work.
|
|
||||||
|
|
||||||
C++ Dialect Support
|
|
||||||
---------------------
|
|
||||||
|
|
||||||
* C++11 - Complete
|
|
||||||
* `C++14 - Complete <http://libcxx.llvm.org/cxx1y_status.html>`__
|
|
||||||
* `C++1z - In Progress <http://libcxx.llvm.org/cxx1z_status.html>`__
|
|
||||||
* `Post C++14 Technical Specifications - In Progress <http://libcxx.llvm.org/ts1z_status.html>`__
|
|
||||||
|
|
||||||
Notes and Known Issues
|
|
||||||
----------------------
|
|
||||||
|
|
||||||
This list contains known issues with libc++
|
|
||||||
|
|
||||||
* Building libc++ with ``-fno-rtti`` is not supported. However
|
|
||||||
linking against it with ``-fno-rtti`` is supported.
|
|
||||||
* On OS X v10.8 and older the CMake option ``-DLIBCXX_LIBCPPABI_VERSION=""``
|
|
||||||
must be used during configuration.
|
|
||||||
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
Design Documents
|
|
||||||
----------------
|
|
||||||
|
|
||||||
.. toctree::
|
|
||||||
:maxdepth: 1
|
|
||||||
|
|
||||||
DesignDocs/CapturingConfigInfo
|
|
||||||
DesignDocs/ABIVersioning
|
|
||||||
|
|
||||||
|
|
||||||
* `<atomic> design <http://libcxx.llvm.org/atomic_design.html>`_
|
|
||||||
* `<type_traits> design <http://libcxx.llvm.org/type_traits_design.html>`_
|
|
||||||
* `Status of debug mode <http://libcxx.llvm.org/debug_mode.html>`_
|
|
||||||
* `Notes by Marshall Clow`__
|
|
||||||
|
|
||||||
.. __: https://cplusplusmusings.wordpress.com/2012/07/05/clang-and-standard-libraries-on-mac-os-x/
|
|
||||||
|
|
||||||
Build Bots and Test Coverage
|
|
||||||
----------------------------
|
|
||||||
|
|
||||||
* `LLVM Buildbot Builders <http://lab.llvm.org:8011/console>`_
|
|
||||||
* `Apple Jenkins Builders <http://lab.llvm.org:8080/green/view/Libcxx/>`_
|
|
||||||
* `EricWF's Nightly Builders <http://ds2.efcs.ca:8080/console>`_
|
|
||||||
* `Code Coverage Results <http://efcs.ca/libcxx-coverage>`_
|
|
||||||
|
|
||||||
Getting Involved
|
|
||||||
================
|
|
||||||
|
|
||||||
First please review our `Developer's Policy <http://llvm.org/docs/DeveloperPolicy.html>`__
|
|
||||||
and `Getting started with LLVM <http://llvm.org/docs/GettingStarted.html>`__.
|
|
||||||
|
|
||||||
**Bug Reports**
|
|
||||||
|
|
||||||
If you think you've found a bug in libc++, please report it using
|
|
||||||
the `LLVM Bugzilla`_. If you're not sure, you
|
|
||||||
can post a message to the `cfe-dev mailing list`_ or on IRC.
|
|
||||||
Please include "libc++" in your subject.
|
|
||||||
|
|
||||||
**Patches**
|
|
||||||
|
|
||||||
If you want to contribute a patch to libc++, the best place for that is
|
|
||||||
`Phabricator <http://llvm.org/docs/Phabricator.html>`_. Please include [libcxx] in the subject and
|
|
||||||
add `cfe-commits` as a subscriber. Also make sure you are subscribed to the
|
|
||||||
`cfe-commits mailing list <http://lists.llvm.org/mailman/listinfo/cfe-commits>`_.
|
|
||||||
|
|
||||||
**Discussion and Questions**
|
|
||||||
|
|
||||||
Send discussions and questions to the
|
|
||||||
`cfe-dev mailing list <http://lists.llvm.org/mailman/listinfo/cfe-dev>`_.
|
|
||||||
Please include [libcxx] in the subject.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Quick Links
|
|
||||||
===========
|
|
||||||
* `LLVM Homepage <http://llvm.org/>`_
|
|
||||||
* `libc++abi Homepage <http://libcxxabi.llvm.org/>`_
|
|
||||||
* `LLVM Bugzilla <http://llvm.org/bugs/>`_
|
|
||||||
* `cfe-commits Mailing List`_
|
|
||||||
* `cfe-dev Mailing List`_
|
|
||||||
* `Browse libc++ -- SVN <http://llvm.org/svn/llvm-project/libcxx/trunk/>`_
|
|
||||||
* `Browse libc++ -- ViewVC <http://llvm.org/viewvc/llvm-project/libcxx/trunk/>`_
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
if (NOT LIBCXX_INSTALL_SUPPORT_HEADERS)
|
|
||||||
set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(LIBCXX_HEADER_PATTERN
|
|
||||||
PATTERN "*"
|
|
||||||
PATTERN "CMakeLists.txt" EXCLUDE
|
|
||||||
PATTERN ".svn" EXCLUDE
|
|
||||||
PATTERN "__config_site.in" EXCLUDE
|
|
||||||
${LIBCXX_SUPPORT_HEADER_PATTERN}
|
|
||||||
)
|
|
||||||
|
|
||||||
file(COPY .
|
|
||||||
DESTINATION "${CMAKE_BINARY_DIR}/include/c++/v1"
|
|
||||||
FILES_MATCHING
|
|
||||||
${LIBCXX_HEADER_PATTERN}
|
|
||||||
)
|
|
||||||
|
|
||||||
if (LIBCXX_INSTALL_HEADERS)
|
|
||||||
install(DIRECTORY .
|
|
||||||
DESTINATION include/c++/v1
|
|
||||||
COMPONENT libcxx
|
|
||||||
FILES_MATCHING
|
|
||||||
${LIBCXX_HEADER_PATTERN}
|
|
||||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
|
||||||
)
|
|
||||||
|
|
||||||
if (LIBCXX_NEEDS_SITE_CONFIG)
|
|
||||||
set(UNIX_CAT cat)
|
|
||||||
if (WIN32)
|
|
||||||
set(UNIX_CAT type)
|
|
||||||
endif()
|
|
||||||
# Generate and install a custom __config header. The new header is created
|
|
||||||
# by prepending __config_site to the current __config header.
|
|
||||||
add_custom_command(OUTPUT ${LIBCXX_BINARY_DIR}/__generated_config
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBCXX_BINARY_DIR}/__config_site ${LIBCXX_BINARY_DIR}/__generated_config
|
|
||||||
COMMAND ${UNIX_CAT} ${LIBCXX_SOURCE_DIR}/include/__config >> ${LIBCXX_BINARY_DIR}/__generated_config
|
|
||||||
DEPENDS ${LIBCXX_SOURCE_DIR}/include/__config
|
|
||||||
${LIBCXX_BINARY_DIR}/__config_site
|
|
||||||
)
|
|
||||||
# Add a target that executes the generation commands.
|
|
||||||
add_custom_target(generate_config_header ALL
|
|
||||||
DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config)
|
|
||||||
# Install the generated header as __config.
|
|
||||||
install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
|
|
||||||
DESTINATION include/c++/v1
|
|
||||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
|
||||||
RENAME __config
|
|
||||||
COMPONENT libcxx)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
endif()
|
|
||||||
@@ -14,16 +14,12 @@
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <__undef_min_max>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
template <class _Cp, bool _IsConst, typename _Cp::__storage_type = 0> class __bit_iterator;
|
template <class _C, bool _IsConst> class __bit_iterator;
|
||||||
template <class _Cp> class __bit_const_reference;
|
template <class _C> class __bit_const_reference;
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
struct __has_storage_type
|
struct __has_storage_type
|
||||||
@@ -31,22 +27,22 @@ struct __has_storage_type
|
|||||||
static const bool value = false;
|
static const bool value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Cp, bool = __has_storage_type<_Cp>::value>
|
template <class _C, bool = __has_storage_type<_C>::value>
|
||||||
class __bit_reference
|
class __bit_reference
|
||||||
{
|
{
|
||||||
typedef typename _Cp::__storage_type __storage_type;
|
typedef typename _C::__storage_type __storage_type;
|
||||||
typedef typename _Cp::__storage_pointer __storage_pointer;
|
typedef typename _C::__storage_pointer __storage_pointer;
|
||||||
|
|
||||||
__storage_pointer __seg_;
|
__storage_pointer __seg_;
|
||||||
__storage_type __mask_;
|
__storage_type __mask_;
|
||||||
|
|
||||||
#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC)
|
#if defined(__clang__)
|
||||||
friend typename _Cp::__self;
|
friend typename _C::__self;
|
||||||
#else
|
#else
|
||||||
friend class _Cp::__self;
|
friend class _C::__self;
|
||||||
#endif
|
#endif
|
||||||
friend class __bit_const_reference<_Cp>;
|
friend class __bit_const_reference<_C>;
|
||||||
friend class __bit_iterator<_Cp, false>;
|
friend class __bit_iterator<_C, false>;
|
||||||
public:
|
public:
|
||||||
_LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
|
||||||
{return static_cast<bool>(*__seg_ & __mask_);}
|
{return static_cast<bool>(*__seg_ & __mask_);}
|
||||||
@@ -68,87 +64,76 @@ public:
|
|||||||
{return operator=(static_cast<bool>(__x));}
|
{return operator=(static_cast<bool>(__x));}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {*__seg_ ^= __mask_;}
|
_LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {*__seg_ ^= __mask_;}
|
||||||
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, false> operator&() const _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, false> operator&() const _NOEXCEPT
|
||||||
{return __bit_iterator<_Cp, false>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
|
{return __bit_iterator<_C, false>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
|
||||||
private:
|
private:
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__bit_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
|
__bit_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
|
||||||
: __seg_(__s), __mask_(__m) {}
|
: __seg_(__s), __mask_(__m) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Cp>
|
template <class _C>
|
||||||
class __bit_reference<_Cp, false>
|
class __bit_reference<_C, false>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Cp>
|
template <class _C, class _D>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
void
|
void
|
||||||
swap(__bit_reference<_Cp> __x, __bit_reference<_Cp> __y) _NOEXCEPT
|
swap(__bit_reference<_C> __x, __bit_reference<_D> __y) _NOEXCEPT
|
||||||
{
|
{
|
||||||
bool __t = __x;
|
bool __t = __x;
|
||||||
__x = __y;
|
__x = __y;
|
||||||
__y = __t;
|
__y = __t;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Cp, class _Dp>
|
template <class _C>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
void
|
void
|
||||||
swap(__bit_reference<_Cp> __x, __bit_reference<_Dp> __y) _NOEXCEPT
|
swap(__bit_reference<_C> __x, bool& __y) _NOEXCEPT
|
||||||
{
|
{
|
||||||
bool __t = __x;
|
bool __t = __x;
|
||||||
__x = __y;
|
__x = __y;
|
||||||
__y = __t;
|
__y = __t;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Cp>
|
template <class _C>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
void
|
void
|
||||||
swap(__bit_reference<_Cp> __x, bool& __y) _NOEXCEPT
|
swap(bool& __x, __bit_reference<_C> __y) _NOEXCEPT
|
||||||
{
|
{
|
||||||
bool __t = __x;
|
bool __t = __x;
|
||||||
__x = __y;
|
__x = __y;
|
||||||
__y = __t;
|
__y = __t;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Cp>
|
template <class _C>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
void
|
|
||||||
swap(bool& __x, __bit_reference<_Cp> __y) _NOEXCEPT
|
|
||||||
{
|
|
||||||
bool __t = __x;
|
|
||||||
__x = __y;
|
|
||||||
__y = __t;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Cp>
|
|
||||||
class __bit_const_reference
|
class __bit_const_reference
|
||||||
{
|
{
|
||||||
typedef typename _Cp::__storage_type __storage_type;
|
typedef typename _C::__storage_type __storage_type;
|
||||||
typedef typename _Cp::__const_storage_pointer __storage_pointer;
|
typedef typename _C::__const_storage_pointer __storage_pointer;
|
||||||
|
|
||||||
__storage_pointer __seg_;
|
__storage_pointer __seg_;
|
||||||
__storage_type __mask_;
|
__storage_type __mask_;
|
||||||
|
|
||||||
#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC)
|
#if defined(__clang__)
|
||||||
friend typename _Cp::__self;
|
friend typename _C::__self;
|
||||||
#else
|
#else
|
||||||
friend class _Cp::__self;
|
friend class _C::__self;
|
||||||
#endif
|
#endif
|
||||||
friend class __bit_iterator<_Cp, true>;
|
friend class __bit_iterator<_C, true>;
|
||||||
public:
|
public:
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__bit_const_reference(const __bit_reference<_Cp>& __x) _NOEXCEPT
|
__bit_const_reference(const __bit_reference<_C>& __x) _NOEXCEPT
|
||||||
: __seg_(__x.__seg_), __mask_(__x.__mask_) {}
|
: __seg_(__x.__seg_), __mask_(__x.__mask_) {}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR operator bool() const _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
|
||||||
{return static_cast<bool>(*__seg_ & __mask_);}
|
{return static_cast<bool>(*__seg_ & __mask_);}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, true> operator&() const _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, true> operator&() const _NOEXCEPT
|
||||||
{return __bit_iterator<_Cp, true>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
|
{return __bit_iterator<_C, true>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
|
||||||
private:
|
private:
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
__bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
|
__bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
|
||||||
: __seg_(__s), __mask_(__m) {}
|
: __seg_(__s), __mask_(__m) {}
|
||||||
|
|
||||||
@@ -157,11 +142,11 @@ private:
|
|||||||
|
|
||||||
// find
|
// find
|
||||||
|
|
||||||
template <class _Cp, bool _IsConst>
|
template <class _C>
|
||||||
__bit_iterator<_Cp, _IsConst>
|
__bit_iterator<_C, false>
|
||||||
__find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
|
__find_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_Cp, _IsConst> _It;
|
typedef __bit_iterator<_C, false> _It;
|
||||||
typedef typename _It::__storage_type __storage_type;
|
typedef typename _It::__storage_type __storage_type;
|
||||||
static const unsigned __bits_per_word = _It::__bits_per_word;
|
static const unsigned __bits_per_word = _It::__bits_per_word;
|
||||||
// do first partial word
|
// do first partial word
|
||||||
@@ -173,8 +158,6 @@ __find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
|
|||||||
__storage_type __b = *__first.__seg_ & __m;
|
__storage_type __b = *__first.__seg_ & __m;
|
||||||
if (__b)
|
if (__b)
|
||||||
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
|
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
|
||||||
if (__n == __dn)
|
|
||||||
return __first + __n;
|
|
||||||
__n -= __dn;
|
__n -= __dn;
|
||||||
++__first.__seg_;
|
++__first.__seg_;
|
||||||
}
|
}
|
||||||
@@ -193,11 +176,11 @@ __find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
|
|||||||
return _It(__first.__seg_, static_cast<unsigned>(__n));
|
return _It(__first.__seg_, static_cast<unsigned>(__n));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Cp, bool _IsConst>
|
template <class _C>
|
||||||
__bit_iterator<_Cp, _IsConst>
|
__bit_iterator<_C, false>
|
||||||
__find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
|
__find_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_Cp, _IsConst> _It;
|
typedef __bit_iterator<_C, false> _It;
|
||||||
typedef typename _It::__storage_type __storage_type;
|
typedef typename _It::__storage_type __storage_type;
|
||||||
static const unsigned __bits_per_word = _It::__bits_per_word;
|
static const unsigned __bits_per_word = _It::__bits_per_word;
|
||||||
// do first partial word
|
// do first partial word
|
||||||
@@ -206,11 +189,9 @@ __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
|
|||||||
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
|
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
|
||||||
__storage_type __dn = _VSTD::min(__clz_f, __n);
|
__storage_type __dn = _VSTD::min(__clz_f, __n);
|
||||||
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
|
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
|
||||||
__storage_type __b = ~*__first.__seg_ & __m;
|
__storage_type __b = ~(*__first.__seg_ & __m);
|
||||||
if (__b)
|
if (__b)
|
||||||
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
|
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
|
||||||
if (__n == __dn)
|
|
||||||
return __first + __n;
|
|
||||||
__n -= __dn;
|
__n -= __dn;
|
||||||
++__first.__seg_;
|
++__first.__seg_;
|
||||||
}
|
}
|
||||||
@@ -225,30 +206,30 @@ __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
|
|||||||
if (__n > 0)
|
if (__n > 0)
|
||||||
{
|
{
|
||||||
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
|
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
|
||||||
__storage_type __b = ~*__first.__seg_ & __m;
|
__storage_type __b = ~(*__first.__seg_ & __m);
|
||||||
if (__b)
|
if (__b)
|
||||||
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
|
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
|
||||||
}
|
}
|
||||||
return _It(__first.__seg_, static_cast<unsigned>(__n));
|
return _It(__first.__seg_, static_cast<unsigned>(__n));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Cp, bool _IsConst, class _Tp>
|
template <class _C, class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
__bit_iterator<_Cp, _IsConst>
|
__bit_iterator<_C, false>
|
||||||
find(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_)
|
find(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, const _Tp& __value)
|
||||||
{
|
{
|
||||||
if (static_cast<bool>(__value_))
|
if (static_cast<bool>(__value))
|
||||||
return __find_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
|
return __find_bool_true(__first, static_cast<typename _C::size_type>(__last - __first));
|
||||||
return __find_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first));
|
return __find_bool_false(__first, static_cast<typename _C::size_type>(__last - __first));
|
||||||
}
|
}
|
||||||
|
|
||||||
// count
|
// count
|
||||||
|
|
||||||
template <class _Cp, bool _IsConst>
|
template <class _C>
|
||||||
typename __bit_iterator<_Cp, _IsConst>::difference_type
|
typename __bit_iterator<_C, false>::difference_type
|
||||||
__count_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
|
__count_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_Cp, _IsConst> _It;
|
typedef __bit_iterator<_C, false> _It;
|
||||||
typedef typename _It::__storage_type __storage_type;
|
typedef typename _It::__storage_type __storage_type;
|
||||||
typedef typename _It::difference_type difference_type;
|
typedef typename _It::difference_type difference_type;
|
||||||
static const unsigned __bits_per_word = _It::__bits_per_word;
|
static const unsigned __bits_per_word = _It::__bits_per_word;
|
||||||
@@ -275,11 +256,11 @@ __count_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
|
|||||||
return __r;
|
return __r;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Cp, bool _IsConst>
|
template <class _C>
|
||||||
typename __bit_iterator<_Cp, _IsConst>::difference_type
|
typename __bit_iterator<_C, false>::difference_type
|
||||||
__count_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
|
__count_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_Cp, _IsConst> _It;
|
typedef __bit_iterator<_C, false> _It;
|
||||||
typedef typename _It::__storage_type __storage_type;
|
typedef typename _It::__storage_type __storage_type;
|
||||||
typedef typename _It::difference_type difference_type;
|
typedef typename _It::difference_type difference_type;
|
||||||
static const unsigned __bits_per_word = _It::__bits_per_word;
|
static const unsigned __bits_per_word = _It::__bits_per_word;
|
||||||
@@ -290,7 +271,7 @@ __count_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_typ
|
|||||||
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
|
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
|
||||||
__storage_type __dn = _VSTD::min(__clz_f, __n);
|
__storage_type __dn = _VSTD::min(__clz_f, __n);
|
||||||
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
|
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
|
||||||
__r = _VSTD::__pop_count(~*__first.__seg_ & __m);
|
__r = _VSTD::__pop_count(~(*__first.__seg_ & __m));
|
||||||
__n -= __dn;
|
__n -= __dn;
|
||||||
++__first.__seg_;
|
++__first.__seg_;
|
||||||
}
|
}
|
||||||
@@ -301,28 +282,28 @@ __count_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_typ
|
|||||||
if (__n > 0)
|
if (__n > 0)
|
||||||
{
|
{
|
||||||
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
|
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
|
||||||
__r += _VSTD::__pop_count(~*__first.__seg_ & __m);
|
__r += _VSTD::__pop_count(~(*__first.__seg_ & __m));
|
||||||
}
|
}
|
||||||
return __r;
|
return __r;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Cp, bool _IsConst, class _Tp>
|
template <class _C, class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
typename __bit_iterator<_Cp, _IsConst>::difference_type
|
typename __bit_iterator<_C, false>::difference_type
|
||||||
count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_)
|
count(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, const _Tp& __value)
|
||||||
{
|
{
|
||||||
if (static_cast<bool>(__value_))
|
if (static_cast<bool>(__value))
|
||||||
return __count_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
|
return __count_bool_true(__first, static_cast<typename _C::size_type>(__last - __first));
|
||||||
return __count_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first));
|
return __count_bool_false(__first, static_cast<typename _C::size_type>(__last - __first));
|
||||||
}
|
}
|
||||||
|
|
||||||
// fill_n
|
// fill_n
|
||||||
|
|
||||||
template <class _Cp>
|
template <class _C>
|
||||||
void
|
void
|
||||||
__fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
|
__fill_n_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_Cp, false> _It;
|
typedef __bit_iterator<_C, false> _It;
|
||||||
typedef typename _It::__storage_type __storage_type;
|
typedef typename _It::__storage_type __storage_type;
|
||||||
static const unsigned __bits_per_word = _It::__bits_per_word;
|
static const unsigned __bits_per_word = _It::__bits_per_word;
|
||||||
// do first partial word
|
// do first partial word
|
||||||
@@ -337,7 +318,7 @@ __fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
|
|||||||
}
|
}
|
||||||
// do middle whole words
|
// do middle whole words
|
||||||
__storage_type __nw = __n / __bits_per_word;
|
__storage_type __nw = __n / __bits_per_word;
|
||||||
_VSTD::memset(_VSTD::__to_raw_pointer(__first.__seg_), 0, __nw * sizeof(__storage_type));
|
_VSTD::memset(__first.__seg_, 0, __nw * sizeof(__storage_type));
|
||||||
__n -= __nw * __bits_per_word;
|
__n -= __nw * __bits_per_word;
|
||||||
// do last partial word
|
// do last partial word
|
||||||
if (__n > 0)
|
if (__n > 0)
|
||||||
@@ -348,11 +329,11 @@ __fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Cp>
|
template <class _C>
|
||||||
void
|
void
|
||||||
__fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
|
__fill_n_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_Cp, false> _It;
|
typedef __bit_iterator<_C, false> _It;
|
||||||
typedef typename _It::__storage_type __storage_type;
|
typedef typename _It::__storage_type __storage_type;
|
||||||
static const unsigned __bits_per_word = _It::__bits_per_word;
|
static const unsigned __bits_per_word = _It::__bits_per_word;
|
||||||
// do first partial word
|
// do first partial word
|
||||||
@@ -367,7 +348,7 @@ __fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
|
|||||||
}
|
}
|
||||||
// do middle whole words
|
// do middle whole words
|
||||||
__storage_type __nw = __n / __bits_per_word;
|
__storage_type __nw = __n / __bits_per_word;
|
||||||
_VSTD::memset(_VSTD::__to_raw_pointer(__first.__seg_), -1, __nw * sizeof(__storage_type));
|
_VSTD::memset(__first.__seg_, -1, __nw * sizeof(__storage_type));
|
||||||
__n -= __nw * __bits_per_word;
|
__n -= __nw * __bits_per_word;
|
||||||
// do last partial word
|
// do last partial word
|
||||||
if (__n > 0)
|
if (__n > 0)
|
||||||
@@ -378,14 +359,14 @@ __fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Cp>
|
template <class _C>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
void
|
void
|
||||||
fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n, bool __value_)
|
fill_n(__bit_iterator<_C, false> __first, typename _C::size_type __n, bool __value)
|
||||||
{
|
{
|
||||||
if (__n > 0)
|
if (__n > 0)
|
||||||
{
|
{
|
||||||
if (__value_)
|
if (__value)
|
||||||
__fill_n_true(__first, __n);
|
__fill_n_true(__first, __n);
|
||||||
else
|
else
|
||||||
__fill_n_false(__first, __n);
|
__fill_n_false(__first, __n);
|
||||||
@@ -394,22 +375,22 @@ fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n, bool __v
|
|||||||
|
|
||||||
// fill
|
// fill
|
||||||
|
|
||||||
template <class _Cp>
|
template <class _C>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
fill(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, bool __value_)
|
fill(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, bool __value)
|
||||||
{
|
{
|
||||||
_VSTD::fill_n(__first, static_cast<typename _Cp::size_type>(__last - __first), __value_);
|
_VSTD::fill_n(__first, static_cast<typename _C::size_type>(__last - __first), __value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy
|
// copy
|
||||||
|
|
||||||
template <class _Cp, bool _IsConst>
|
template <class _C, bool _IsConst>
|
||||||
__bit_iterator<_Cp, false>
|
__bit_iterator<_C, false>
|
||||||
__copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
|
__copy_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
|
||||||
__bit_iterator<_Cp, false> __result)
|
__bit_iterator<_C, false> __result)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_Cp, _IsConst> _In;
|
typedef __bit_iterator<_C, _IsConst> _In;
|
||||||
typedef typename _In::difference_type difference_type;
|
typedef typename _In::difference_type difference_type;
|
||||||
typedef typename _In::__storage_type __storage_type;
|
typedef typename _In::__storage_type __storage_type;
|
||||||
static const unsigned __bits_per_word = _In::__bits_per_word;
|
static const unsigned __bits_per_word = _In::__bits_per_word;
|
||||||
@@ -434,9 +415,7 @@ __copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsCon
|
|||||||
// __first.__ctz_ == 0;
|
// __first.__ctz_ == 0;
|
||||||
// do middle words
|
// do middle words
|
||||||
__storage_type __nw = __n / __bits_per_word;
|
__storage_type __nw = __n / __bits_per_word;
|
||||||
_VSTD::memmove(_VSTD::__to_raw_pointer(__result.__seg_),
|
_VSTD::memmove(__result.__seg_, __first.__seg_, __nw * sizeof(__storage_type));
|
||||||
_VSTD::__to_raw_pointer(__first.__seg_),
|
|
||||||
__nw * sizeof(__storage_type));
|
|
||||||
__n -= __nw * __bits_per_word;
|
__n -= __nw * __bits_per_word;
|
||||||
__result.__seg_ += __nw;
|
__result.__seg_ += __nw;
|
||||||
// do last word
|
// do last word
|
||||||
@@ -453,12 +432,12 @@ __copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsCon
|
|||||||
return __result;
|
return __result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Cp, bool _IsConst>
|
template <class _C, bool _IsConst>
|
||||||
__bit_iterator<_Cp, false>
|
__bit_iterator<_C, false>
|
||||||
__copy_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
|
__copy_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
|
||||||
__bit_iterator<_Cp, false> __result)
|
__bit_iterator<_C, false> __result)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_Cp, _IsConst> _In;
|
typedef __bit_iterator<_C, _IsConst> _In;
|
||||||
typedef typename _In::difference_type difference_type;
|
typedef typename _In::difference_type difference_type;
|
||||||
typedef typename _In::__storage_type __storage_type;
|
typedef typename _In::__storage_type __storage_type;
|
||||||
static const unsigned __bits_per_word = _In::__bits_per_word;
|
static const unsigned __bits_per_word = _In::__bits_per_word;
|
||||||
@@ -531,10 +510,10 @@ __copy_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsC
|
|||||||
return __result;
|
return __result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Cp, bool _IsConst>
|
template <class _C, bool _IsConst>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
__bit_iterator<_Cp, false>
|
__bit_iterator<_C, false>
|
||||||
copy(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
|
copy(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
|
||||||
{
|
{
|
||||||
if (__first.__ctz_ == __result.__ctz_)
|
if (__first.__ctz_ == __result.__ctz_)
|
||||||
return __copy_aligned(__first, __last, __result);
|
return __copy_aligned(__first, __last, __result);
|
||||||
@@ -543,12 +522,12 @@ copy(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last
|
|||||||
|
|
||||||
// copy_backward
|
// copy_backward
|
||||||
|
|
||||||
template <class _Cp, bool _IsConst>
|
template <class _C, bool _IsConst>
|
||||||
__bit_iterator<_Cp, false>
|
__bit_iterator<_C, false>
|
||||||
__copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
|
__copy_backward_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
|
||||||
__bit_iterator<_Cp, false> __result)
|
__bit_iterator<_C, false> __result)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_Cp, _IsConst> _In;
|
typedef __bit_iterator<_C, _IsConst> _In;
|
||||||
typedef typename _In::difference_type difference_type;
|
typedef typename _In::difference_type difference_type;
|
||||||
typedef typename _In::__storage_type __storage_type;
|
typedef typename _In::__storage_type __storage_type;
|
||||||
static const unsigned __bits_per_word = _In::__bits_per_word;
|
static const unsigned __bits_per_word = _In::__bits_per_word;
|
||||||
@@ -575,9 +554,7 @@ __copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_C
|
|||||||
__storage_type __nw = __n / __bits_per_word;
|
__storage_type __nw = __n / __bits_per_word;
|
||||||
__result.__seg_ -= __nw;
|
__result.__seg_ -= __nw;
|
||||||
__last.__seg_ -= __nw;
|
__last.__seg_ -= __nw;
|
||||||
_VSTD::memmove(_VSTD::__to_raw_pointer(__result.__seg_),
|
_VSTD::memmove(__result.__seg_, __last.__seg_, __nw * sizeof(__storage_type));
|
||||||
_VSTD::__to_raw_pointer(__last.__seg_),
|
|
||||||
__nw * sizeof(__storage_type));
|
|
||||||
__n -= __nw * __bits_per_word;
|
__n -= __nw * __bits_per_word;
|
||||||
// do last word
|
// do last word
|
||||||
if (__n > 0)
|
if (__n > 0)
|
||||||
@@ -592,12 +569,12 @@ __copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_C
|
|||||||
return __result;
|
return __result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Cp, bool _IsConst>
|
template <class _C, bool _IsConst>
|
||||||
__bit_iterator<_Cp, false>
|
__bit_iterator<_C, false>
|
||||||
__copy_backward_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
|
__copy_backward_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
|
||||||
__bit_iterator<_Cp, false> __result)
|
__bit_iterator<_C, false> __result)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_Cp, _IsConst> _In;
|
typedef __bit_iterator<_C, _IsConst> _In;
|
||||||
typedef typename _In::difference_type difference_type;
|
typedef typename _In::difference_type difference_type;
|
||||||
typedef typename _In::__storage_type __storage_type;
|
typedef typename _In::__storage_type __storage_type;
|
||||||
static const unsigned __bits_per_word = _In::__bits_per_word;
|
static const unsigned __bits_per_word = _In::__bits_per_word;
|
||||||
@@ -656,7 +633,7 @@ __copy_backward_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<
|
|||||||
{
|
{
|
||||||
__m = ~__storage_type(0) << (__bits_per_word - __n);
|
__m = ~__storage_type(0) << (__bits_per_word - __n);
|
||||||
__storage_type __b = *--__last.__seg_ & __m;
|
__storage_type __b = *--__last.__seg_ & __m;
|
||||||
__clz_r = __bits_per_word - __result.__ctz_;
|
unsigned __clz_r = __bits_per_word - __result.__ctz_;
|
||||||
__storage_type __dn = _VSTD::min(__n, static_cast<difference_type>(__result.__ctz_));
|
__storage_type __dn = _VSTD::min(__n, static_cast<difference_type>(__result.__ctz_));
|
||||||
__m = (~__storage_type(0) << (__result.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_r);
|
__m = (~__storage_type(0) << (__result.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_r);
|
||||||
*__result.__seg_ &= ~__m;
|
*__result.__seg_ &= ~__m;
|
||||||
@@ -678,10 +655,10 @@ __copy_backward_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<
|
|||||||
return __result;
|
return __result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Cp, bool _IsConst>
|
template <class _C, bool _IsConst>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
__bit_iterator<_Cp, false>
|
__bit_iterator<_C, false>
|
||||||
copy_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
|
copy_backward(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
|
||||||
{
|
{
|
||||||
if (__last.__ctz_ == __result.__ctz_)
|
if (__last.__ctz_ == __result.__ctz_)
|
||||||
return __copy_backward_aligned(__first, __last, __result);
|
return __copy_backward_aligned(__first, __last, __result);
|
||||||
@@ -690,32 +667,32 @@ copy_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsCons
|
|||||||
|
|
||||||
// move
|
// move
|
||||||
|
|
||||||
template <class _Cp, bool _IsConst>
|
template <class _C, bool _IsConst>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
__bit_iterator<_Cp, false>
|
__bit_iterator<_C, false>
|
||||||
move(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
|
move(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
|
||||||
{
|
{
|
||||||
return _VSTD::copy(__first, __last, __result);
|
return _VSTD::copy(__first, __last, __result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// move_backward
|
// move_backward
|
||||||
|
|
||||||
template <class _Cp, bool _IsConst>
|
template <class _C, bool _IsConst>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
__bit_iterator<_Cp, false>
|
__bit_iterator<_C, false>
|
||||||
move_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
|
move_backward(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
|
||||||
{
|
{
|
||||||
return _VSTD::copy_backward(__first, __last, __result);
|
return _VSTD::copy(__first, __last, __result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// swap_ranges
|
// swap_ranges
|
||||||
|
|
||||||
template <class __C1, class __C2>
|
template <class _C1, class _C2>
|
||||||
__bit_iterator<__C2, false>
|
__bit_iterator<_C2, false>
|
||||||
__swap_ranges_aligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last,
|
__swap_ranges_aligned(__bit_iterator<_C1, false> __first, __bit_iterator<_C1, false> __last,
|
||||||
__bit_iterator<__C2, false> __result)
|
__bit_iterator<_C2, false> __result)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<__C1, false> _I1;
|
typedef __bit_iterator<_C1, false> _I1;
|
||||||
typedef typename _I1::difference_type difference_type;
|
typedef typename _I1::difference_type difference_type;
|
||||||
typedef typename _I1::__storage_type __storage_type;
|
typedef typename _I1::__storage_type __storage_type;
|
||||||
static const unsigned __bits_per_word = _I1::__bits_per_word;
|
static const unsigned __bits_per_word = _I1::__bits_per_word;
|
||||||
@@ -760,12 +737,12 @@ __swap_ranges_aligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1,
|
|||||||
return __result;
|
return __result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class __C1, class __C2>
|
template <class _C1, class _C2>
|
||||||
__bit_iterator<__C2, false>
|
__bit_iterator<_C2, false>
|
||||||
__swap_ranges_unaligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last,
|
__swap_ranges_unaligned(__bit_iterator<_C1, false> __first, __bit_iterator<_C1, false> __last,
|
||||||
__bit_iterator<__C2, false> __result)
|
__bit_iterator<_C2, false> __result)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<__C1, false> _I1;
|
typedef __bit_iterator<_C1, false> _I1;
|
||||||
typedef typename _I1::difference_type difference_type;
|
typedef typename _I1::difference_type difference_type;
|
||||||
typedef typename _I1::__storage_type __storage_type;
|
typedef typename _I1::__storage_type __storage_type;
|
||||||
static const unsigned __bits_per_word = _I1::__bits_per_word;
|
static const unsigned __bits_per_word = _I1::__bits_per_word;
|
||||||
@@ -860,11 +837,11 @@ __swap_ranges_unaligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1
|
|||||||
return __result;
|
return __result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class __C1, class __C2>
|
template <class _C1, class _C2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
__bit_iterator<__C2, false>
|
__bit_iterator<_C2, false>
|
||||||
swap_ranges(__bit_iterator<__C1, false> __first1, __bit_iterator<__C1, false> __last1,
|
swap_ranges(__bit_iterator<_C1, false> __first1, __bit_iterator<_C1, false> __last1,
|
||||||
__bit_iterator<__C2, false> __first2)
|
__bit_iterator<_C2, false> __first2)
|
||||||
{
|
{
|
||||||
if (__first1.__ctz_ == __first2.__ctz_)
|
if (__first1.__ctz_ == __first2.__ctz_)
|
||||||
return __swap_ranges_aligned(__first1, __last1, __first2);
|
return __swap_ranges_aligned(__first1, __last1, __first2);
|
||||||
@@ -873,39 +850,34 @@ swap_ranges(__bit_iterator<__C1, false> __first1, __bit_iterator<__C1, false> __
|
|||||||
|
|
||||||
// rotate
|
// rotate
|
||||||
|
|
||||||
template <class _Cp>
|
template <class _C>
|
||||||
struct __bit_array
|
struct __bit_array
|
||||||
{
|
{
|
||||||
typedef typename _Cp::difference_type difference_type;
|
typedef typename _C::difference_type difference_type;
|
||||||
typedef typename _Cp::__storage_type __storage_type;
|
typedef typename _C::__storage_type __storage_type;
|
||||||
typedef typename _Cp::__storage_pointer __storage_pointer;
|
typedef typename _C::iterator iterator;
|
||||||
typedef typename _Cp::iterator iterator;
|
static const unsigned __bits_per_word = _C::__bits_per_word;
|
||||||
static const unsigned __bits_per_word = _Cp::__bits_per_word;
|
static const unsigned _N = 4;
|
||||||
static const unsigned _Np = 4;
|
|
||||||
|
|
||||||
difference_type __size_;
|
difference_type __size_;
|
||||||
__storage_type __word_[_Np];
|
__storage_type __word_[_N];
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY static difference_type capacity()
|
_LIBCPP_INLINE_VISIBILITY static difference_type capacity()
|
||||||
{return static_cast<difference_type>(_Np * __bits_per_word);}
|
{return static_cast<difference_type>(_N * __bits_per_word);}
|
||||||
_LIBCPP_INLINE_VISIBILITY explicit __bit_array(difference_type __s) : __size_(__s) {}
|
_LIBCPP_INLINE_VISIBILITY explicit __bit_array(difference_type __s) : __size_(__s) {}
|
||||||
_LIBCPP_INLINE_VISIBILITY iterator begin()
|
_LIBCPP_INLINE_VISIBILITY iterator begin() {return iterator(__word_, 0);}
|
||||||
{
|
_LIBCPP_INLINE_VISIBILITY iterator end() {return iterator(__word_ + __size_ / __bits_per_word,
|
||||||
return iterator(pointer_traits<__storage_pointer>::pointer_to(__word_[0]), 0);
|
static_cast<unsigned>(__size_ % __bits_per_word));}
|
||||||
}
|
|
||||||
_LIBCPP_INLINE_VISIBILITY iterator end()
|
|
||||||
{
|
|
||||||
return iterator(pointer_traits<__storage_pointer>::pointer_to(__word_[0]) + __size_ / __bits_per_word,
|
|
||||||
static_cast<unsigned>(__size_ % __bits_per_word));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Cp>
|
template <class _C>
|
||||||
__bit_iterator<_Cp, false>
|
__bit_iterator<_C, false>
|
||||||
rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle, __bit_iterator<_Cp, false> __last)
|
rotate(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __middle, __bit_iterator<_C, false> __last)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_Cp, false> _I1;
|
typedef __bit_iterator<_C, false> _I1;
|
||||||
typedef typename _I1::difference_type difference_type;
|
typedef typename _I1::difference_type difference_type;
|
||||||
|
typedef typename _I1::__storage_type __storage_type;
|
||||||
|
static const unsigned __bits_per_word = _I1::__bits_per_word;
|
||||||
difference_type __d1 = __middle - __first;
|
difference_type __d1 = __middle - __first;
|
||||||
difference_type __d2 = __last - __middle;
|
difference_type __d2 = __last - __middle;
|
||||||
_I1 __r = __first + __d2;
|
_I1 __r = __first + __d2;
|
||||||
@@ -913,16 +885,16 @@ rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle,
|
|||||||
{
|
{
|
||||||
if (__d1 <= __d2)
|
if (__d1 <= __d2)
|
||||||
{
|
{
|
||||||
if (__d1 <= __bit_array<_Cp>::capacity())
|
if (__d1 <= __bit_array<_C>::capacity())
|
||||||
{
|
{
|
||||||
__bit_array<_Cp> __b(__d1);
|
__bit_array<_C> __b(__d1);
|
||||||
_VSTD::copy(__first, __middle, __b.begin());
|
_VSTD::copy(__first, __middle, __b.begin());
|
||||||
_VSTD::copy(__b.begin(), __b.end(), _VSTD::copy(__middle, __last, __first));
|
_VSTD::copy(__b.begin(), __b.end(), _VSTD::copy(__middle, __last, __first));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__bit_iterator<_Cp, false> __mp = _VSTD::swap_ranges(__first, __middle, __middle);
|
__bit_iterator<_C, false> __mp = _VSTD::swap_ranges(__first, __middle, __middle);
|
||||||
__first = __middle;
|
__first = __middle;
|
||||||
__middle = __mp;
|
__middle = __mp;
|
||||||
__d2 -= __d1;
|
__d2 -= __d1;
|
||||||
@@ -930,16 +902,16 @@ rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (__d2 <= __bit_array<_Cp>::capacity())
|
if (__d2 <= __bit_array<_C>::capacity())
|
||||||
{
|
{
|
||||||
__bit_array<_Cp> __b(__d2);
|
__bit_array<_C> __b(__d2);
|
||||||
_VSTD::copy(__middle, __last, __b.begin());
|
_VSTD::copy(__middle, __last, __b.begin());
|
||||||
_VSTD::copy_backward(__b.begin(), __b.end(), _VSTD::copy_backward(__first, __middle, __last));
|
_VSTD::copy_backward(__b.begin(), __b.end(), _VSTD::copy_backward(__first, __middle, __last));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__bit_iterator<_Cp, false> __mp = __first + __d2;
|
__bit_iterator<_C, false> __mp = __first + __d2;
|
||||||
_VSTD::swap_ranges(__first, __mp, __middle);
|
_VSTD::swap_ranges(__first, __mp, __middle);
|
||||||
__first = __mp;
|
__first = __mp;
|
||||||
__d1 -= __d2;
|
__d1 -= __d2;
|
||||||
@@ -951,12 +923,12 @@ rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle,
|
|||||||
|
|
||||||
// equal
|
// equal
|
||||||
|
|
||||||
template <class _Cp, bool _IC1, bool _IC2>
|
template <class _C>
|
||||||
bool
|
bool
|
||||||
__equal_unaligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1,
|
__equal_unaligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __last1,
|
||||||
__bit_iterator<_Cp, _IC2> __first2)
|
__bit_iterator<_C, true> __first2)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_Cp, _IC1> _It;
|
typedef __bit_iterator<_C, true> _It;
|
||||||
typedef typename _It::difference_type difference_type;
|
typedef typename _It::difference_type difference_type;
|
||||||
typedef typename _It::__storage_type __storage_type;
|
typedef typename _It::__storage_type __storage_type;
|
||||||
static const unsigned __bits_per_word = _It::__bits_per_word;
|
static const unsigned __bits_per_word = _It::__bits_per_word;
|
||||||
@@ -975,15 +947,11 @@ __equal_unaligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1>
|
|||||||
__storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r);
|
__storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r);
|
||||||
__m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn));
|
__m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn));
|
||||||
if (__first2.__ctz_ > __first1.__ctz_)
|
if (__first2.__ctz_ > __first1.__ctz_)
|
||||||
{
|
|
||||||
if ((*__first2.__seg_ & __m) != (__b << (__first2.__ctz_ - __first1.__ctz_)))
|
if ((*__first2.__seg_ & __m) != (__b << (__first2.__ctz_ - __first1.__ctz_)))
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
if ((*__first2.__seg_ & __m) != (__b >> (__first1.__ctz_ - __first2.__ctz_)))
|
if ((*__first2.__seg_ & __m) != (__b >> (__first1.__ctz_ - __first2.__ctz_)))
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
__first2.__seg_ += (__ddn + __first2.__ctz_) / __bits_per_word;
|
__first2.__seg_ += (__ddn + __first2.__ctz_) / __bits_per_word;
|
||||||
__first2.__ctz_ = static_cast<unsigned>((__ddn + __first2.__ctz_) % __bits_per_word);
|
__first2.__ctz_ = static_cast<unsigned>((__ddn + __first2.__ctz_) % __bits_per_word);
|
||||||
__dn -= __ddn;
|
__dn -= __ddn;
|
||||||
@@ -1033,12 +1001,12 @@ __equal_unaligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1>
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Cp, bool _IC1, bool _IC2>
|
template <class _C>
|
||||||
bool
|
bool
|
||||||
__equal_aligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1,
|
__equal_aligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __last1,
|
||||||
__bit_iterator<_Cp, _IC2> __first2)
|
__bit_iterator<_C, true> __first2)
|
||||||
{
|
{
|
||||||
typedef __bit_iterator<_Cp, _IC1> _It;
|
typedef __bit_iterator<_C, true> _It;
|
||||||
typedef typename _It::difference_type difference_type;
|
typedef typename _It::difference_type difference_type;
|
||||||
typedef typename _It::__storage_type __storage_type;
|
typedef typename _It::__storage_type __storage_type;
|
||||||
static const unsigned __bits_per_word = _It::__bits_per_word;
|
static const unsigned __bits_per_word = _It::__bits_per_word;
|
||||||
@@ -1076,45 +1044,40 @@ __equal_aligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Cp, bool _IC1, bool _IC2>
|
template <class _C, bool _IC1, bool _IC2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
equal(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, __bit_iterator<_Cp, _IC2> __first2)
|
equal(__bit_iterator<_C, _IC1> __first1, __bit_iterator<_C, _IC1> __last1, __bit_iterator<_C, _IC2> __first2)
|
||||||
{
|
{
|
||||||
if (__first1.__ctz_ == __first2.__ctz_)
|
if (__first1.__ctz_ == __first2.__ctz_)
|
||||||
return __equal_aligned(__first1, __last1, __first2);
|
return __equal_aligned(__first1, __last1, __first2);
|
||||||
return __equal_unaligned(__first1, __last1, __first2);
|
return __equal_unaligned(__first1, __last1, __first2);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Cp, bool _IsConst,
|
template <class _C, bool _IsConst>
|
||||||
typename _Cp::__storage_type>
|
|
||||||
class __bit_iterator
|
class __bit_iterator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename _Cp::difference_type difference_type;
|
typedef typename _C::difference_type difference_type;
|
||||||
typedef bool value_type;
|
typedef bool value_type;
|
||||||
typedef __bit_iterator pointer;
|
typedef __bit_iterator pointer;
|
||||||
typedef typename conditional<_IsConst, __bit_const_reference<_Cp>, __bit_reference<_Cp> >::type reference;
|
typedef typename conditional<_IsConst, __bit_const_reference<_C>, __bit_reference<_C> >::type reference;
|
||||||
typedef random_access_iterator_tag iterator_category;
|
typedef random_access_iterator_tag iterator_category;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef typename _Cp::__storage_type __storage_type;
|
typedef typename _C::__storage_type __storage_type;
|
||||||
typedef typename conditional<_IsConst, typename _Cp::__const_storage_pointer,
|
typedef typename conditional<_IsConst, typename _C::__const_storage_pointer,
|
||||||
typename _Cp::__storage_pointer>::type __storage_pointer;
|
typename _C::__storage_pointer>::type __storage_pointer;
|
||||||
static const unsigned __bits_per_word = _Cp::__bits_per_word;
|
static const unsigned __bits_per_word = _C::__bits_per_word;
|
||||||
|
|
||||||
__storage_pointer __seg_;
|
__storage_pointer __seg_;
|
||||||
unsigned __ctz_;
|
unsigned __ctz_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
_LIBCPP_INLINE_VISIBILITY __bit_iterator() _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY __bit_iterator() _NOEXCEPT {}
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
: __seg_(nullptr), __ctz_(0)
|
|
||||||
#endif
|
|
||||||
{}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__bit_iterator(const __bit_iterator<_Cp, false>& __it) _NOEXCEPT
|
__bit_iterator(const __bit_iterator<_C, false>& __it) _NOEXCEPT
|
||||||
: __seg_(__it.__seg_), __ctz_(__it.__ctz_) {}
|
: __seg_(__it.__seg_), __ctz_(__it.__ctz_) {}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT
|
||||||
@@ -1221,64 +1184,60 @@ private:
|
|||||||
__bit_iterator(__storage_pointer __s, unsigned __ctz) _NOEXCEPT
|
__bit_iterator(__storage_pointer __s, unsigned __ctz) _NOEXCEPT
|
||||||
: __seg_(__s), __ctz_(__ctz) {}
|
: __seg_(__s), __ctz_(__ctz) {}
|
||||||
|
|
||||||
#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC)
|
#if defined(__clang__)
|
||||||
friend typename _Cp::__self;
|
friend typename _C::__self;
|
||||||
#else
|
#else
|
||||||
friend class _Cp::__self;
|
friend class _C::__self;
|
||||||
#endif
|
#endif
|
||||||
friend class __bit_reference<_Cp>;
|
friend class __bit_reference<_C>;
|
||||||
friend class __bit_const_reference<_Cp>;
|
friend class __bit_const_reference<_C>;
|
||||||
friend class __bit_iterator<_Cp, true>;
|
friend class __bit_iterator<_C, true>;
|
||||||
template <class _Dp> friend struct __bit_array;
|
template <class _D> friend struct __bit_array;
|
||||||
template <class _Dp> friend void __fill_n_false(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n);
|
template <class _D> friend void __fill_n_false(__bit_iterator<_D, false> __first, typename _D::size_type __n);
|
||||||
template <class _Dp> friend void __fill_n_true(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n);
|
template <class _D> friend void __fill_n_true(__bit_iterator<_D, false> __first, typename _D::size_type __n);
|
||||||
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_aligned(__bit_iterator<_Dp, _IC> __first,
|
template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_aligned(__bit_iterator<_D, _IC> __first,
|
||||||
__bit_iterator<_Dp, _IC> __last,
|
__bit_iterator<_D, _IC> __last,
|
||||||
__bit_iterator<_Dp, false> __result);
|
__bit_iterator<_D, false> __result);
|
||||||
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_unaligned(__bit_iterator<_Dp, _IC> __first,
|
template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_unaligned(__bit_iterator<_D, _IC> __first,
|
||||||
__bit_iterator<_Dp, _IC> __last,
|
__bit_iterator<_D, _IC> __last,
|
||||||
__bit_iterator<_Dp, false> __result);
|
__bit_iterator<_D, false> __result);
|
||||||
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> copy(__bit_iterator<_Dp, _IC> __first,
|
template <class _D, bool _IC> friend __bit_iterator<_D, false> copy(__bit_iterator<_D, _IC> __first,
|
||||||
__bit_iterator<_Dp, _IC> __last,
|
__bit_iterator<_D, _IC> __last,
|
||||||
__bit_iterator<_Dp, false> __result);
|
__bit_iterator<_D, false> __result);
|
||||||
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_backward_aligned(__bit_iterator<_Dp, _IC> __first,
|
template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_backward_aligned(__bit_iterator<_D, _IC> __first,
|
||||||
__bit_iterator<_Dp, _IC> __last,
|
__bit_iterator<_D, _IC> __last,
|
||||||
__bit_iterator<_Dp, false> __result);
|
__bit_iterator<_D, false> __result);
|
||||||
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_backward_unaligned(__bit_iterator<_Dp, _IC> __first,
|
template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_backward_unaligned(__bit_iterator<_D, _IC> __first,
|
||||||
__bit_iterator<_Dp, _IC> __last,
|
__bit_iterator<_D, _IC> __last,
|
||||||
__bit_iterator<_Dp, false> __result);
|
__bit_iterator<_D, false> __result);
|
||||||
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> copy_backward(__bit_iterator<_Dp, _IC> __first,
|
template <class _D, bool _IC> friend __bit_iterator<_D, false> copy_backward(__bit_iterator<_D, _IC> __first,
|
||||||
__bit_iterator<_Dp, _IC> __last,
|
__bit_iterator<_D, _IC> __last,
|
||||||
__bit_iterator<_Dp, false> __result);
|
__bit_iterator<_D, false> __result);
|
||||||
template <class __C1, class __C2>friend __bit_iterator<__C2, false> __swap_ranges_aligned(__bit_iterator<__C1, false>,
|
template <class _C1, class _C2>friend __bit_iterator<_C2, false> __swap_ranges_aligned(__bit_iterator<_C1, false>,
|
||||||
__bit_iterator<__C1, false>,
|
__bit_iterator<_C1, false>,
|
||||||
__bit_iterator<__C2, false>);
|
__bit_iterator<_C2, false>);
|
||||||
template <class __C1, class __C2>friend __bit_iterator<__C2, false> __swap_ranges_unaligned(__bit_iterator<__C1, false>,
|
template <class _C1, class _C2>friend __bit_iterator<_C2, false> __swap_ranges_unaligned(__bit_iterator<_C1, false>,
|
||||||
__bit_iterator<__C1, false>,
|
__bit_iterator<_C1, false>,
|
||||||
__bit_iterator<__C2, false>);
|
__bit_iterator<_C2, false>);
|
||||||
template <class __C1, class __C2>friend __bit_iterator<__C2, false> swap_ranges(__bit_iterator<__C1, false>,
|
template <class _C1, class _C2>friend __bit_iterator<_C2, false> swap_ranges(__bit_iterator<_C1, false>,
|
||||||
__bit_iterator<__C1, false>,
|
__bit_iterator<_C1, false>,
|
||||||
__bit_iterator<__C2, false>);
|
__bit_iterator<_C2, false>);
|
||||||
template <class _Dp> friend __bit_iterator<_Dp, false> rotate(__bit_iterator<_Dp, false>,
|
template <class _D> friend __bit_iterator<_D, false> rotate(__bit_iterator<_D, false>,
|
||||||
__bit_iterator<_Dp, false>,
|
__bit_iterator<_D, false>,
|
||||||
__bit_iterator<_Dp, false>);
|
__bit_iterator<_D, false>);
|
||||||
template <class _Dp, bool _IC1, bool _IC2> friend bool __equal_aligned(__bit_iterator<_Dp, _IC1>,
|
template <class _D> friend bool __equal_aligned(__bit_iterator<_D, true>,
|
||||||
__bit_iterator<_Dp, _IC1>,
|
__bit_iterator<_D, true>,
|
||||||
__bit_iterator<_Dp, _IC2>);
|
__bit_iterator<_D, true>);
|
||||||
template <class _Dp, bool _IC1, bool _IC2> friend bool __equal_unaligned(__bit_iterator<_Dp, _IC1>,
|
template <class _D> friend bool __equal_unaligned(__bit_iterator<_D, true>,
|
||||||
__bit_iterator<_Dp, _IC1>,
|
__bit_iterator<_D, true>,
|
||||||
__bit_iterator<_Dp, _IC2>);
|
__bit_iterator<_D, true>);
|
||||||
template <class _Dp, bool _IC1, bool _IC2> friend bool equal(__bit_iterator<_Dp, _IC1>,
|
template <class _D, bool _IC1, bool _IC2> friend bool equal(__bit_iterator<_D, _IC1>,
|
||||||
__bit_iterator<_Dp, _IC1>,
|
__bit_iterator<_D, _IC1>,
|
||||||
__bit_iterator<_Dp, _IC2>);
|
__bit_iterator<_D, _IC2>);
|
||||||
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, _IC> __find_bool_true(__bit_iterator<_Dp, _IC>,
|
template <class _D> friend __bit_iterator<_D, false> __find_bool_true(__bit_iterator<_D, false>,
|
||||||
typename _Dp::size_type);
|
typename _D::size_type);
|
||||||
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, _IC> __find_bool_false(__bit_iterator<_Dp, _IC>,
|
template <class _D> friend __bit_iterator<_D, false> __find_bool_false(__bit_iterator<_D, false>,
|
||||||
typename _Dp::size_type);
|
typename _D::size_type);
|
||||||
template <class _Dp, bool _IC> friend typename __bit_iterator<_Dp, _IC>::difference_type
|
|
||||||
__count_bool_true(__bit_iterator<_Dp, _IC>, typename _Dp::size_type);
|
|
||||||
template <class _Dp, bool _IC> friend typename __bit_iterator<_Dp, _IC>::difference_type
|
|
||||||
__count_bool_false(__bit_iterator<_Dp, _IC>, typename _Dp::size_type);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|||||||
633
include/__config
633
include/__config
@@ -11,61 +11,17 @@
|
|||||||
#ifndef _LIBCPP_CONFIG
|
#ifndef _LIBCPP_CONFIG
|
||||||
#define _LIBCPP_CONFIG
|
#define _LIBCPP_CONFIG
|
||||||
|
|
||||||
#if defined(_MSC_VER) && !defined(__clang__)
|
|
||||||
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#define _LIBCPP_VERSION 1000
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
|
|
||||||
#else
|
|
||||||
#define _GNUC_VER 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define _LIBCPP_VERSION 3800
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_ABI_VERSION
|
|
||||||
#define _LIBCPP_ABI_VERSION 1
|
#define _LIBCPP_ABI_VERSION 1
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
|
|
||||||
// Change short string represention so that string data starts at offset 0,
|
|
||||||
// improving its alignment in some cases.
|
|
||||||
#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
|
|
||||||
// Fix deque iterator type in order to support incomplete types.
|
|
||||||
#define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
|
#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
|
||||||
#define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y)
|
#define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y)
|
||||||
|
|
||||||
#define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION)
|
#define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION)
|
||||||
|
|
||||||
|
|
||||||
#ifndef __has_attribute
|
|
||||||
#define __has_attribute(__x) 0
|
|
||||||
#endif
|
|
||||||
#ifndef __has_builtin
|
|
||||||
#define __has_builtin(__x) 0
|
|
||||||
#endif
|
|
||||||
#ifndef __has_extension
|
|
||||||
#define __has_extension(__x) 0
|
|
||||||
#endif
|
|
||||||
#ifndef __has_feature
|
|
||||||
#define __has_feature(__x) 0
|
|
||||||
#endif
|
|
||||||
// '__is_identifier' returns '0' if '__x' is a reserved identifier provided by
|
|
||||||
// the compiler and '1' otherwise.
|
|
||||||
#ifndef __is_identifier
|
|
||||||
#define __is_identifier(__x) 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __LITTLE_ENDIAN__
|
#ifdef __LITTLE_ENDIAN__
|
||||||
#if __LITTLE_ENDIAN__
|
#if __LITTLE_ENDIAN__
|
||||||
#define _LIBCPP_LITTLE_ENDIAN 1
|
#define _LIBCPP_LITTLE_ENDIAN 1
|
||||||
@@ -80,16 +36,6 @@
|
|||||||
#endif // __BIG_ENDIAN__
|
#endif // __BIG_ENDIAN__
|
||||||
#endif // __BIG_ENDIAN__
|
#endif // __BIG_ENDIAN__
|
||||||
|
|
||||||
#ifdef __BYTE_ORDER__
|
|
||||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
|
||||||
#define _LIBCPP_LITTLE_ENDIAN 1
|
|
||||||
#define _LIBCPP_BIG_ENDIAN 0
|
|
||||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
|
||||||
#define _LIBCPP_LITTLE_ENDIAN 0
|
|
||||||
#define _LIBCPP_BIG_ENDIAN 1
|
|
||||||
#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
|
||||||
#endif // __BYTE_ORDER__
|
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
# include <sys/endian.h>
|
# include <sys/endian.h>
|
||||||
# if _BYTE_ORDER == _LITTLE_ENDIAN
|
# if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||||
@@ -99,70 +45,13 @@
|
|||||||
# define _LIBCPP_LITTLE_ENDIAN 0
|
# define _LIBCPP_LITTLE_ENDIAN 0
|
||||||
# define _LIBCPP_BIG_ENDIAN 1
|
# define _LIBCPP_BIG_ENDIAN 1
|
||||||
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
|
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
|
||||||
# ifndef __LONG_LONG_SUPPORTED
|
|
||||||
# define _LIBCPP_HAS_NO_LONG_LONG
|
|
||||||
# endif // __LONG_LONG_SUPPORTED
|
|
||||||
#endif // __FreeBSD__
|
#endif // __FreeBSD__
|
||||||
|
|
||||||
#ifdef __NetBSD__
|
|
||||||
# include <sys/endian.h>
|
|
||||||
# if _BYTE_ORDER == _LITTLE_ENDIAN
|
|
||||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
|
||||||
# define _LIBCPP_BIG_ENDIAN 0
|
|
||||||
# else // _BYTE_ORDER == _LITTLE_ENDIAN
|
|
||||||
# define _LIBCPP_LITTLE_ENDIAN 0
|
|
||||||
# define _LIBCPP_BIG_ENDIAN 1
|
|
||||||
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
|
|
||||||
# define _LIBCPP_HAS_QUICK_EXIT
|
|
||||||
#endif // __NetBSD__
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||||
# define _LIBCPP_BIG_ENDIAN 0
|
# define _LIBCPP_BIG_ENDIAN 0
|
||||||
// Compiler intrinsics (MSVC)
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
|
||||||
# define _LIBCPP_HAS_IS_BASE_OF
|
|
||||||
# endif
|
|
||||||
# if defined(_MSC_VER) && !defined(__clang__)
|
|
||||||
# define _LIBCPP_MSVC // Using Microsoft Visual C++ compiler
|
|
||||||
# define _LIBCPP_TOSTRING2(x) #x
|
|
||||||
# define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
|
|
||||||
# define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x))
|
|
||||||
# endif
|
|
||||||
# // If mingw not explicitly detected, assume using MS C runtime only.
|
|
||||||
# ifndef __MINGW32__
|
|
||||||
# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
|
|
||||||
# endif
|
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
#ifdef __sun__
|
|
||||||
# include <sys/isa_defs.h>
|
|
||||||
# ifdef _LITTLE_ENDIAN
|
|
||||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
|
||||||
# define _LIBCPP_BIG_ENDIAN 0
|
|
||||||
# else
|
|
||||||
# define _LIBCPP_LITTLE_ENDIAN 0
|
|
||||||
# define _LIBCPP_BIG_ENDIAN 1
|
|
||||||
# endif
|
|
||||||
#endif // __sun__
|
|
||||||
|
|
||||||
#if defined(__CloudABI__)
|
|
||||||
// Certain architectures provide arc4random(). Prefer using
|
|
||||||
// arc4random() over /dev/{u,}random to make it possible to obtain
|
|
||||||
// random data even when using sandboxing mechanisms such as chroots,
|
|
||||||
// Capsicum, etc.
|
|
||||||
# define _LIBCPP_USING_ARC4_RANDOM
|
|
||||||
#elif defined(__native_client__)
|
|
||||||
// NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,
|
|
||||||
// including accesses to the special files under /dev. C++11's
|
|
||||||
// std::random_device is instead exposed through a NaCl syscall.
|
|
||||||
# define _LIBCPP_USING_NACL_RANDOM
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
# define _LIBCPP_USING_WIN32_RANDOM
|
|
||||||
#else
|
|
||||||
# define _LIBCPP_USING_DEV_RANDOM
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
|
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
|
||||||
# include <endian.h>
|
# include <endian.h>
|
||||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||||
@@ -176,71 +65,17 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
|
#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifndef _LIBCPP_VISIBILITY_TAG
|
||||||
|
#define _LIBCPP_VISIBILITY_TAG 1
|
||||||
// only really useful for a DLL
|
|
||||||
#ifdef _LIBCPP_DLL // this should be a compiler builtin define ideally...
|
|
||||||
# ifdef cxx_EXPORTS
|
|
||||||
# define _LIBCPP_HIDDEN
|
|
||||||
# define _LIBCPP_FUNC_VIS __declspec(dllexport)
|
|
||||||
# define _LIBCPP_TYPE_VIS __declspec(dllexport)
|
|
||||||
# else
|
|
||||||
# define _LIBCPP_HIDDEN
|
|
||||||
# define _LIBCPP_FUNC_VIS __declspec(dllimport)
|
|
||||||
# define _LIBCPP_TYPE_VIS __declspec(dllimport)
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
# define _LIBCPP_HIDDEN
|
|
||||||
# define _LIBCPP_FUNC_VIS
|
|
||||||
# define _LIBCPP_TYPE_VIS
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define _LIBCPP_TYPE_VIS_ONLY
|
#if _LIBCPP_VISIBILITY_TAG
|
||||||
#define _LIBCPP_FUNC_VIS_ONLY
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_INLINE_VISIBILITY
|
|
||||||
# ifdef _LIBCPP_MSVC
|
|
||||||
# define _LIBCPP_INLINE_VISIBILITY __forceinline
|
|
||||||
# else // MinGW GCC and Clang
|
|
||||||
# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_EXCEPTION_ABI
|
|
||||||
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_TYPE_VIS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_ALWAYS_INLINE
|
|
||||||
# ifdef _LIBCPP_MSVC
|
|
||||||
# define _LIBCPP_ALWAYS_INLINE __forceinline
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // _WIN32
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_HIDDEN
|
|
||||||
#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
|
#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
|
||||||
#endif
|
#define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default")))
|
||||||
|
#else // _LIBCPP_VISIBILITY_TAG
|
||||||
#ifndef _LIBCPP_FUNC_VIS
|
#define _LIBCPP_HIDDEN
|
||||||
#define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
|
#define _LIBCPP_VISIBLE
|
||||||
#endif
|
#endif // _LIBCPP_VISIBILITY_TAG
|
||||||
|
|
||||||
#ifndef _LIBCPP_TYPE_VIS
|
|
||||||
# if __has_attribute(__type_visibility__)
|
|
||||||
# define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default")))
|
|
||||||
# else
|
|
||||||
# define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_TYPE_VIS_ONLY
|
|
||||||
# define _LIBCPP_TYPE_VIS_ONLY _LIBCPP_TYPE_VIS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_FUNC_VIS_ONLY
|
|
||||||
# define _LIBCPP_FUNC_VIS_ONLY _LIBCPP_FUNC_VIS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_INLINE_VISIBILITY
|
#ifndef _LIBCPP_INLINE_VISIBILITY
|
||||||
#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
|
#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
|
||||||
@@ -250,36 +85,24 @@
|
|||||||
#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
|
#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _LIBCPP_ALWAYS_INLINE
|
#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
|
||||||
|
|
||||||
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
|
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
|
|
||||||
// _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(_LIBCPP_ALTERNATE_STRING_LAYOUT)
|
|
||||||
#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if __has_feature(cxx_alignas)
|
|
||||||
# define _ALIGNAS_TYPE(x) alignas(x)
|
|
||||||
# define _ALIGNAS(x) alignas(x)
|
|
||||||
#else
|
|
||||||
# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
|
|
||||||
# define _ALIGNAS(x) __attribute__((__aligned__(x)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !__has_feature(cxx_alias_templates)
|
#if !__has_feature(cxx_alias_templates)
|
||||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __cplusplus < 201103L
|
#ifndef __GXX_EXPERIMENTAL_CXX0X__
|
||||||
|
#ifdef __linux__
|
||||||
|
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||||
|
#else
|
||||||
typedef __char16_t char16_t;
|
typedef __char16_t char16_t;
|
||||||
typedef __char32_t char32_t;
|
typedef __char32_t char32_t;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !(__has_feature(cxx_exceptions))
|
#if !(__has_feature(cxx_exceptions))
|
||||||
#define _LIBCPP_NO_EXCEPTIONS
|
#define _LIBCPP_NO_EXCEPTIONS
|
||||||
@@ -289,25 +112,17 @@ typedef __char32_t char32_t;
|
|||||||
#define _LIBCPP_NO_RTTI
|
#define _LIBCPP_NO_RTTI
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(__has_feature(cxx_strong_enums))
|
|
||||||
#define _LIBCPP_HAS_NO_STRONG_ENUMS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !(__has_feature(cxx_decltype))
|
#if !(__has_feature(cxx_decltype))
|
||||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __has_feature(cxx_attributes)
|
#if __has_feature(cxx_attributes)
|
||||||
# define _LIBCPP_NORETURN [[noreturn]]
|
# define _ATTRIBUTE(x) [[x]]
|
||||||
#else
|
#else
|
||||||
# define _LIBCPP_NORETURN __attribute__ ((noreturn))
|
# define _ATTRIBUTE(x) __attribute__ ((x))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define _LIBCPP_UNUSED __attribute__((__unused__))
|
|
||||||
|
|
||||||
#if !(__has_feature(cxx_defaulted_functions))
|
|
||||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||||
#endif // !(__has_feature(cxx_defaulted_functions))
|
|
||||||
|
|
||||||
#if !(__has_feature(cxx_deleted_functions))
|
#if !(__has_feature(cxx_deleted_functions))
|
||||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||||
@@ -345,18 +160,6 @@ typedef __char32_t char32_t;
|
|||||||
#define _LIBCPP_HAS_NO_TRAILING_RETURN
|
#define _LIBCPP_HAS_NO_TRAILING_RETURN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(__has_feature(cxx_generalized_initializers))
|
|
||||||
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if __has_feature(is_base_of)
|
|
||||||
# define _LIBCPP_HAS_IS_BASE_OF
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if __has_feature(is_final)
|
|
||||||
# define _LIBCPP_HAS_IS_FINAL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Objective-C++ features (opt-in)
|
// Objective-C++ features (opt-in)
|
||||||
#if __has_feature(objc_arc)
|
#if __has_feature(objc_arc)
|
||||||
#define _LIBCPP_HAS_OBJC_ARC
|
#define _LIBCPP_HAS_OBJC_ARC
|
||||||
@@ -364,53 +167,6 @@ typedef __char32_t char32_t;
|
|||||||
|
|
||||||
#if __has_feature(objc_arc_weak)
|
#if __has_feature(objc_arc_weak)
|
||||||
#define _LIBCPP_HAS_OBJC_ARC_WEAK
|
#define _LIBCPP_HAS_OBJC_ARC_WEAK
|
||||||
#define _LIBCPP_HAS_NO_STRONG_ENUMS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !(__has_feature(cxx_constexpr))
|
|
||||||
#define _LIBCPP_HAS_NO_CONSTEXPR
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !(__has_feature(cxx_relaxed_constexpr))
|
|
||||||
#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !(__has_feature(cxx_variable_templates))
|
|
||||||
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
|
|
||||||
#if defined(__FreeBSD__)
|
|
||||||
#define _LIBCPP_HAS_QUICK_EXIT
|
|
||||||
#define _LIBCPP_HAS_C11_FEATURES
|
|
||||||
#elif defined(__ANDROID__)
|
|
||||||
#define _LIBCPP_HAS_QUICK_EXIT
|
|
||||||
#elif defined(__linux__)
|
|
||||||
#if !defined(_LIBCPP_HAS_MUSL_LIBC)
|
|
||||||
# include <features.h>
|
|
||||||
#if __GLIBC_PREREQ(2, 15)
|
|
||||||
#define _LIBCPP_HAS_QUICK_EXIT
|
|
||||||
#endif
|
|
||||||
#if __GLIBC_PREREQ(2, 17)
|
|
||||||
#define _LIBCPP_HAS_C11_FEATURES
|
|
||||||
#endif
|
|
||||||
#else // defined(_LIBCPP_HAS_MUSL_LIBC)
|
|
||||||
#define _LIBCPP_HAS_QUICK_EXIT
|
|
||||||
#define _LIBCPP_HAS_C11_FEATURES
|
|
||||||
#endif
|
|
||||||
#endif // __linux__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !(__has_feature(cxx_noexcept))
|
|
||||||
#define _LIBCPP_HAS_NO_NOEXCEPT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if __has_feature(underlying_type)
|
|
||||||
# define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if __has_feature(is_literal)
|
|
||||||
# define _LIBCPP_IS_LITERAL(T) __is_literal(T)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Inline namespaces are available in Clang regardless of C++ dialect.
|
// Inline namespaces are available in Clang regardless of C++ dialect.
|
||||||
@@ -423,52 +179,37 @@ namespace std {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer)
|
#if !(__has_feature(cxx_constexpr))
|
||||||
#define _LIBCPP_HAS_NO_ASAN
|
#define _LIBCPP_HAS_NO_CONSTEXPR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if (__has_feature(cxx_noexcept))
|
||||||
|
# define _NOEXCEPT noexcept
|
||||||
|
# define _NOEXCEPT_(x) noexcept(x)
|
||||||
|
#else
|
||||||
|
# define _NOEXCEPT throw()
|
||||||
|
# define _NOEXCEPT_(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __has_feature(underlying_type)
|
||||||
|
# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// end defined(__clang__)
|
||||||
|
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
|
|
||||||
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
|
#define _ATTRIBUTE(x) __attribute__((x))
|
||||||
#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
|
|
||||||
|
|
||||||
#define _LIBCPP_NORETURN __attribute__((noreturn))
|
|
||||||
|
|
||||||
#define _LIBCPP_UNUSED __attribute__((__unused__))
|
|
||||||
|
|
||||||
#if _GNUC_VER >= 407
|
|
||||||
#define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
|
|
||||||
#define _LIBCPP_IS_LITERAL(T) __is_literal_type(T)
|
|
||||||
#define _LIBCPP_HAS_IS_FINAL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__GNUC__) && _GNUC_VER >= 403
|
|
||||||
# define _LIBCPP_HAS_IS_BASE_OF
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !__EXCEPTIONS
|
#if !__EXCEPTIONS
|
||||||
#define _LIBCPP_NO_EXCEPTIONS
|
#define _LIBCPP_NO_EXCEPTIONS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
|
|
||||||
// constexpr was added to GCC in 4.6.
|
|
||||||
#if _GNUC_VER < 406
|
|
||||||
#define _LIBCPP_HAS_NO_CONSTEXPR
|
#define _LIBCPP_HAS_NO_CONSTEXPR
|
||||||
// Can only use constexpr in c++11 mode.
|
|
||||||
#elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
|
|
||||||
#define _LIBCPP_HAS_NO_CONSTEXPR
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Determine if GCC supports relaxed constexpr
|
#define _NOEXCEPT throw()
|
||||||
#if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
|
#define _NOEXCEPT_(x)
|
||||||
#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// GCC 5 will support variable templates
|
|
||||||
#if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L
|
|
||||||
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __GXX_EXPERIMENTAL_CXX0X__
|
#ifndef __GXX_EXPERIMENTAL_CXX0X__
|
||||||
|
|
||||||
@@ -481,38 +222,34 @@ namespace std {
|
|||||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||||
#define _LIBCPP_HAS_NO_VARIADICS
|
#define _LIBCPP_HAS_NO_VARIADICS
|
||||||
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
#define _LIBCPP_HAS_NO_STRONG_ENUMS
|
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||||
#define _LIBCPP_HAS_NO_NOEXCEPT
|
|
||||||
|
|
||||||
#else // __GXX_EXPERIMENTAL_CXX0X__
|
#else // __GXX_EXPERIMENTAL_CXX0X__
|
||||||
|
|
||||||
#if _GNUC_VER < 403
|
#define _LIBCPP_HAS_NO_TRAILING_RETURN
|
||||||
|
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||||
|
|
||||||
|
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
|
||||||
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _GNUC_VER < 403
|
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
|
||||||
#define _LIBCPP_HAS_NO_STATIC_ASSERT
|
#define _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _GNUC_VER < 404
|
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
|
||||||
|
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||||
|
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||||
#define _LIBCPP_HAS_NO_TRAILING_RETURN
|
|
||||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||||
#define _LIBCPP_HAS_NO_VARIADICS
|
#define _LIBCPP_HAS_NO_VARIADICS
|
||||||
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
#endif // !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
|
||||||
#endif // _GNUC_VER < 404
|
|
||||||
|
|
||||||
#if _GNUC_VER < 406
|
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
|
||||||
#define _LIBCPP_HAS_NO_NOEXCEPT
|
|
||||||
#define _LIBCPP_HAS_NO_NULLPTR
|
#define _LIBCPP_HAS_NO_NULLPTR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _GNUC_VER < 407
|
|
||||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
|
||||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __GXX_EXPERIMENTAL_CXX0X__
|
#endif // __GXX_EXPERIMENTAL_CXX0X__
|
||||||
|
|
||||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
|
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
|
||||||
@@ -525,97 +262,18 @@ namespace _LIBCPP_NAMESPACE {
|
|||||||
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
|
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
|
#endif // defined(__GNUC__)
|
||||||
#define _LIBCPP_HAS_NO_ASAN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(_LIBCPP_MSVC)
|
|
||||||
|
|
||||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
|
||||||
#define _LIBCPP_HAS_NO_CONSTEXPR
|
|
||||||
#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
|
|
||||||
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
|
||||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
|
||||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
|
||||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
|
||||||
#define _LIBCPP_HAS_NO_NOEXCEPT
|
|
||||||
#define __alignof__ __alignof
|
|
||||||
#define _LIBCPP_NORETURN __declspec(noreturn)
|
|
||||||
#define _LIBCPP_UNUSED
|
|
||||||
#define _ALIGNAS(x) __declspec(align(x))
|
|
||||||
#define _LIBCPP_HAS_NO_VARIADICS
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
|
|
||||||
#define _LIBCPP_END_NAMESPACE_STD }
|
|
||||||
#define _VSTD std
|
|
||||||
|
|
||||||
# define _LIBCPP_WEAK
|
|
||||||
namespace std {
|
|
||||||
}
|
|
||||||
|
|
||||||
#define _LIBCPP_HAS_NO_ASAN
|
|
||||||
|
|
||||||
#elif defined(__IBMCPP__)
|
|
||||||
|
|
||||||
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
|
|
||||||
#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
|
|
||||||
#define _ATTRIBUTE(x) __attribute__((x))
|
|
||||||
#define _LIBCPP_NORETURN __attribute__((noreturn))
|
|
||||||
#define _LIBCPP_UNUSED
|
|
||||||
|
|
||||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
|
||||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
|
||||||
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
#define _LIBCPP_HAS_NO_NOEXCEPT
|
|
||||||
#define _LIBCPP_HAS_NO_NULLPTR
|
|
||||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
|
||||||
#define _LIBCPP_HAS_IS_BASE_OF
|
|
||||||
#define _LIBCPP_HAS_IS_FINAL
|
|
||||||
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
|
||||||
|
|
||||||
#if defined(_AIX)
|
|
||||||
#define __MULTILOCALE_API
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
|
|
||||||
#define _LIBCPP_END_NAMESPACE_STD } }
|
|
||||||
#define _VSTD std::_LIBCPP_NAMESPACE
|
|
||||||
|
|
||||||
namespace std {
|
|
||||||
inline namespace _LIBCPP_NAMESPACE {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define _LIBCPP_HAS_NO_ASAN
|
|
||||||
|
|
||||||
#endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_NOEXCEPT
|
|
||||||
# define _NOEXCEPT noexcept
|
|
||||||
# define _NOEXCEPT_(x) noexcept(x)
|
|
||||||
#else
|
|
||||||
# define _NOEXCEPT throw()
|
|
||||||
# define _NOEXCEPT_(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
|
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||||
typedef unsigned short char16_t;
|
typedef unsigned short char16_t;
|
||||||
typedef unsigned int char32_t;
|
typedef unsigned int char32_t;
|
||||||
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
|
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||||
|
|
||||||
#ifndef __SIZEOF_INT128__
|
|
||||||
#define _LIBCPP_HAS_NO_INT128
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
|
#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||||
|
|
||||||
extern "C++" {
|
|
||||||
template <bool> struct __static_assert_test;
|
template <bool> struct __static_assert_test;
|
||||||
template <> struct __static_assert_test<true> {};
|
template <> struct __static_assert_test<true> {};
|
||||||
template <unsigned> struct __static_assert_check {};
|
template <unsigned> struct __static_assert_check {};
|
||||||
}
|
|
||||||
#define static_assert(__b, __m) \
|
#define static_assert(__b, __m) \
|
||||||
typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
|
typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
|
||||||
_LIBCPP_CONCAT(__t, __LINE__)
|
_LIBCPP_CONCAT(__t, __LINE__)
|
||||||
@@ -623,202 +281,27 @@ template <unsigned> struct __static_assert_check {};
|
|||||||
#endif // _LIBCPP_HAS_NO_STATIC_ASSERT
|
#endif // _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||||
|
|
||||||
#ifdef _LIBCPP_HAS_NO_DECLTYPE
|
#ifdef _LIBCPP_HAS_NO_DECLTYPE
|
||||||
// GCC 4.6 provides __decltype in all standard modes.
|
#define decltype(x) __typeof__(x)
|
||||||
#if !__is_identifier(__decltype) || _GNUC_VER >= 406
|
|
||||||
# define decltype(__x) __decltype(__x)
|
|
||||||
#else
|
|
||||||
# define decltype(__x) __typeof__(__x)
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||||
#define _LIBCPP_CONSTEXPR
|
#define constexpr const
|
||||||
#else
|
|
||||||
#define _LIBCPP_CONSTEXPR constexpr
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
#ifndef __has_feature
|
||||||
#define _LIBCPP_DEFAULT {}
|
#define __has_feature(__x) 0
|
||||||
#else
|
|
||||||
#define _LIBCPP_DEFAULT = default;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __APPLE__
|
||||||
#define _NOALIAS __attribute__((__malloc__))
|
|
||||||
#else
|
|
||||||
#define _NOALIAS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__)
|
|
||||||
# define _LIBCPP_EXPLICIT explicit
|
|
||||||
#else
|
|
||||||
# define _LIBCPP_EXPLICIT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete)
|
|
||||||
# define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
|
|
||||||
#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
|
|
||||||
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
|
|
||||||
__lx __v_; \
|
|
||||||
_LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \
|
|
||||||
_LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
|
|
||||||
_LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
|
|
||||||
};
|
|
||||||
#else // _LIBCPP_HAS_NO_STRONG_ENUMS
|
|
||||||
#define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_TYPE_VIS x
|
|
||||||
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
|
|
||||||
#endif // _LIBCPP_HAS_NO_STRONG_ENUMS
|
|
||||||
|
|
||||||
#ifdef _LIBCPP_DEBUG
|
|
||||||
# if _LIBCPP_DEBUG == 0
|
|
||||||
# define _LIBCPP_DEBUG_LEVEL 1
|
|
||||||
# elif _LIBCPP_DEBUG == 1
|
|
||||||
# define _LIBCPP_DEBUG_LEVEL 2
|
|
||||||
# else
|
|
||||||
# error Supported values for _LIBCPP_DEBUG are 0 and 1
|
|
||||||
# endif
|
|
||||||
# define _LIBCPP_EXTERN_TEMPLATE(...)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_EXTERN_TEMPLATE
|
|
||||||
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_EXTERN_TEMPLATE2
|
|
||||||
#define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
|
|
||||||
#define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || \
|
|
||||||
defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__)
|
|
||||||
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
|
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(_NEWLIB_VERSION) && \
|
#ifdef __APPLE__
|
||||||
!defined(__CloudABI__)
|
#define _LIBCPP_STABLE_APPLE_ABI
|
||||||
#define _LIBCPP_HAS_CATOPEN 1
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
#ifdef __APPLE__
|
||||||
#define _DECLARE_C99_LDBL_MATH 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
|
||||||
#define _LIBCPP_HAS_DEFAULTRUNELOCALE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)
|
|
||||||
#define _LIBCPP_WCTYPE_IS_MASK
|
#define _LIBCPP_WCTYPE_IS_MASK
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
|
#endif // _LIBCPP_CONFIG
|
||||||
# define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_STD_VER
|
|
||||||
# if __cplusplus <= 201103L
|
|
||||||
# define _LIBCPP_STD_VER 11
|
|
||||||
# elif __cplusplus <= 201402L
|
|
||||||
# define _LIBCPP_STD_VER 14
|
|
||||||
# else
|
|
||||||
# define _LIBCPP_STD_VER 15 // current year, or date of c++17 ratification
|
|
||||||
# endif
|
|
||||||
#endif // _LIBCPP_STD_VER
|
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
#define _LIBCPP_DEPRECATED [[deprecated]]
|
|
||||||
#else
|
|
||||||
#define _LIBCPP_DEPRECATED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER <= 11
|
|
||||||
#define _LIBCPP_EXPLICIT_AFTER_CXX11
|
|
||||||
#define _LIBCPP_DEPRECATED_AFTER_CXX11
|
|
||||||
#else
|
|
||||||
#define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
|
|
||||||
#define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
|
|
||||||
#define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
|
|
||||||
#else
|
|
||||||
#define _LIBCPP_CONSTEXPR_AFTER_CXX11
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
|
||||||
# define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x)
|
|
||||||
#else
|
|
||||||
# define _LIBCPP_EXPLICIT_MOVE(x) (x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_ASAN
|
|
||||||
extern "C" void __sanitizer_annotate_contiguous_container(
|
|
||||||
const void *, const void *, const void *, const void *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Try to find out if RTTI is disabled.
|
|
||||||
// g++ and cl.exe have RTTI on by default and define a macro when it is.
|
|
||||||
// g++ only defines the macro in 4.3.2 and onwards.
|
|
||||||
#if !defined(_LIBCPP_NO_RTTI)
|
|
||||||
# if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \
|
|
||||||
(__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI)
|
|
||||||
# define _LIBCPP_NO_RTTI
|
|
||||||
# elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI)
|
|
||||||
# define _LIBCPP_NO_RTTI
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_WEAK
|
|
||||||
# define _LIBCPP_WEAK __attribute__((__weak__))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS)
|
|
||||||
# error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \
|
|
||||||
_LIBCPP_HAS_NO_THREADS is defined.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Systems that use capability-based security (FreeBSD with Capsicum,
|
|
||||||
// Nuxi CloudABI) may only provide local filesystem access (using *at()).
|
|
||||||
// Functions like open(), rename(), unlink() and stat() should not be
|
|
||||||
// used, as they attempt to access the global filesystem namespace.
|
|
||||||
#ifdef __CloudABI__
|
|
||||||
#define _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// CloudABI is intended for running networked services. Processes do not
|
|
||||||
// have standard input and output channels.
|
|
||||||
#ifdef __CloudABI__
|
|
||||||
#define _LIBCPP_HAS_NO_STDIN
|
|
||||||
#define _LIBCPP_HAS_NO_STDOUT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__ANDROID__) || defined(__CloudABI__) || defined(_LIBCPP_HAS_MUSL_LIBC)
|
|
||||||
#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Thread-unsafe functions such as strtok(), mbtowc() and localtime()
|
|
||||||
// are not available.
|
|
||||||
#ifdef __CloudABI__
|
|
||||||
#define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if __has_feature(cxx_atomic) || __has_extension(c_atomic)
|
|
||||||
#define _LIBCPP_HAS_C_ATOMIC_IMP
|
|
||||||
#elif _GNUC_VER > 407
|
|
||||||
#define _LIBCPP_HAS_GCC_ATOMIC_IMP
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \
|
|
||||||
|| defined(_LIBCPP_HAS_NO_THREADS)
|
|
||||||
#define _LIBCPP_HAS_NO_ATOMIC_HEADER
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __cplusplus
|
|
||||||
|
|
||||||
#endif // _LIBCPP_CONFIG
|
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// 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_CONFIG_SITE
|
|
||||||
#define _LIBCPP_CONFIG_SITE
|
|
||||||
|
|
||||||
#cmakedefine _LIBCPP_ABI_VERSION @_LIBCPP_ABI_VERSION@
|
|
||||||
#cmakedefine _LIBCPP_ABI_UNSTABLE
|
|
||||||
#cmakedefine _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
|
||||||
#cmakedefine _LIBCPP_HAS_NO_STDIN
|
|
||||||
#cmakedefine _LIBCPP_HAS_NO_STDOUT
|
|
||||||
#cmakedefine _LIBCPP_HAS_NO_THREADS
|
|
||||||
#cmakedefine _LIBCPP_HAS_NO_MONOTONIC_CLOCK
|
|
||||||
#cmakedefine _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
|
|
||||||
#cmakedefine _LIBCPP_HAS_MUSL_LIBC
|
|
||||||
|
|
||||||
#endif // _LIBCPP_CONFIG_SITE
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -15,67 +15,44 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <new>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
template <class _Arg, class _Result>
|
template <class _Arg, class _Result>
|
||||||
struct _LIBCPP_TYPE_VIS_ONLY unary_function
|
struct _LIBCPP_VISIBLE unary_function
|
||||||
{
|
{
|
||||||
typedef _Arg argument_type;
|
typedef _Arg argument_type;
|
||||||
typedef _Result result_type;
|
typedef _Result result_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Arg1, class _Arg2, class _Result>
|
template <class _Arg1, class _Arg2, class _Result>
|
||||||
struct _LIBCPP_TYPE_VIS_ONLY binary_function
|
struct _LIBCPP_VISIBLE binary_function
|
||||||
{
|
{
|
||||||
typedef _Arg1 first_argument_type;
|
typedef _Arg1 first_argument_type;
|
||||||
typedef _Arg2 second_argument_type;
|
typedef _Arg2 second_argument_type;
|
||||||
typedef _Result result_type;
|
typedef _Result result_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY hash;
|
template <class _Tp> struct _LIBCPP_VISIBLE hash;
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
struct __has_result_type
|
struct __has_result_type
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
struct __two {char __lx; char __lxx;};
|
struct __two {char _; char __;};
|
||||||
template <class _Up> static __two __test(...);
|
template <class _Up> static __two __test(...);
|
||||||
template <class _Up> static char __test(typename _Up::result_type* = 0);
|
template <class _Up> static char __test(typename _Up::result_type* = 0);
|
||||||
public:
|
public:
|
||||||
static const bool value = sizeof(__test<_Tp>(0)) == 1;
|
static const bool value = sizeof(__test<_Tp>(0)) == 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 11
|
#ifdef _LIBCPP_HAS_NO_VARIADICS
|
||||||
template <class _Tp = void>
|
|
||||||
#else
|
|
||||||
template <class _Tp>
|
|
||||||
#endif
|
|
||||||
struct _LIBCPP_TYPE_VIS_ONLY less : binary_function<_Tp, _Tp, bool>
|
|
||||||
{
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool operator()(const _Tp& __x, const _Tp& __y) const
|
|
||||||
{return __x < __y;}
|
|
||||||
};
|
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 11
|
#include <__functional_base_03>
|
||||||
template <>
|
|
||||||
struct _LIBCPP_TYPE_VIS_ONLY less<void>
|
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||||
{
|
|
||||||
template <class _T1, class _T2>
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
auto operator()(_T1&& __t, _T2&& __u) const
|
|
||||||
_NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u)))
|
|
||||||
-> decltype (_VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u))
|
|
||||||
{ return _VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u); }
|
|
||||||
typedef void is_transparent;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// __weak_result_type
|
// __weak_result_type
|
||||||
|
|
||||||
@@ -83,11 +60,11 @@ template <class _Tp>
|
|||||||
struct __derives_from_unary_function
|
struct __derives_from_unary_function
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
struct __two {char __lx; char __lxx;};
|
struct __two {char _; char __;};
|
||||||
static __two __test(...);
|
static __two __test(...);
|
||||||
template <class _Ap, class _Rp>
|
template <class _A, class _R>
|
||||||
static unary_function<_Ap, _Rp>
|
static unary_function<_A, _R>
|
||||||
__test(const volatile unary_function<_Ap, _Rp>*);
|
__test(const volatile unary_function<_A, _R>*);
|
||||||
public:
|
public:
|
||||||
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
|
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
|
||||||
typedef decltype(__test((_Tp*)0)) type;
|
typedef decltype(__test((_Tp*)0)) type;
|
||||||
@@ -97,11 +74,11 @@ template <class _Tp>
|
|||||||
struct __derives_from_binary_function
|
struct __derives_from_binary_function
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
struct __two {char __lx; char __lxx;};
|
struct __two {char _; char __;};
|
||||||
static __two __test(...);
|
static __two __test(...);
|
||||||
template <class _A1, class _A2, class _Rp>
|
template <class _A1, class _A2, class _R>
|
||||||
static binary_function<_A1, _A2, _Rp>
|
static binary_function<_A1, _A2, _R>
|
||||||
__test(const volatile binary_function<_A1, _A2, _Rp>*);
|
__test(const volatile binary_function<_A1, _A2, _R>*);
|
||||||
public:
|
public:
|
||||||
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
|
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
|
||||||
typedef decltype(__test((_Tp*)0)) type;
|
typedef decltype(__test((_Tp*)0)) type;
|
||||||
@@ -152,181 +129,173 @@ struct __weak_result_type
|
|||||||
|
|
||||||
// 0 argument case
|
// 0 argument case
|
||||||
|
|
||||||
template <class _Rp>
|
template <class _R>
|
||||||
struct __weak_result_type<_Rp ()>
|
struct __weak_result_type<_R ()>
|
||||||
{
|
{
|
||||||
typedef _Rp result_type;
|
typedef _R result_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Rp>
|
template <class _R>
|
||||||
struct __weak_result_type<_Rp (&)()>
|
struct __weak_result_type<_R (&)()>
|
||||||
{
|
{
|
||||||
typedef _Rp result_type;
|
typedef _R result_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Rp>
|
template <class _R>
|
||||||
struct __weak_result_type<_Rp (*)()>
|
struct __weak_result_type<_R (*)()>
|
||||||
{
|
{
|
||||||
typedef _Rp result_type;
|
typedef _R result_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 1 argument case
|
// 1 argument case
|
||||||
|
|
||||||
template <class _Rp, class _A1>
|
template <class _R, class _A1>
|
||||||
struct __weak_result_type<_Rp (_A1)>
|
struct __weak_result_type<_R (_A1)>
|
||||||
: public unary_function<_A1, _Rp>
|
: public unary_function<_A1, _R>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Rp, class _A1>
|
template <class _R, class _A1>
|
||||||
struct __weak_result_type<_Rp (&)(_A1)>
|
struct __weak_result_type<_R (&)(_A1)>
|
||||||
: public unary_function<_A1, _Rp>
|
: public unary_function<_A1, _R>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Rp, class _A1>
|
template <class _R, class _A1>
|
||||||
struct __weak_result_type<_Rp (*)(_A1)>
|
struct __weak_result_type<_R (*)(_A1)>
|
||||||
: public unary_function<_A1, _Rp>
|
: public unary_function<_A1, _R>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Rp, class _Cp>
|
template <class _R, class _C>
|
||||||
struct __weak_result_type<_Rp (_Cp::*)()>
|
struct __weak_result_type<_R (_C::*)()>
|
||||||
: public unary_function<_Cp*, _Rp>
|
: public unary_function<_C*, _R>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Rp, class _Cp>
|
template <class _R, class _C>
|
||||||
struct __weak_result_type<_Rp (_Cp::*)() const>
|
struct __weak_result_type<_R (_C::*)() const>
|
||||||
: public unary_function<const _Cp*, _Rp>
|
: public unary_function<const _C*, _R>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Rp, class _Cp>
|
template <class _R, class _C>
|
||||||
struct __weak_result_type<_Rp (_Cp::*)() volatile>
|
struct __weak_result_type<_R (_C::*)() volatile>
|
||||||
: public unary_function<volatile _Cp*, _Rp>
|
: public unary_function<volatile _C*, _R>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Rp, class _Cp>
|
template <class _R, class _C>
|
||||||
struct __weak_result_type<_Rp (_Cp::*)() const volatile>
|
struct __weak_result_type<_R (_C::*)() const volatile>
|
||||||
: public unary_function<const volatile _Cp*, _Rp>
|
: public unary_function<const volatile _C*, _R>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
// 2 argument case
|
// 2 argument case
|
||||||
|
|
||||||
template <class _Rp, class _A1, class _A2>
|
template <class _R, class _A1, class _A2>
|
||||||
struct __weak_result_type<_Rp (_A1, _A2)>
|
struct __weak_result_type<_R (_A1, _A2)>
|
||||||
: public binary_function<_A1, _A2, _Rp>
|
: public binary_function<_A1, _A2, _R>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Rp, class _A1, class _A2>
|
template <class _R, class _A1, class _A2>
|
||||||
struct __weak_result_type<_Rp (*)(_A1, _A2)>
|
struct __weak_result_type<_R (*)(_A1, _A2)>
|
||||||
: public binary_function<_A1, _A2, _Rp>
|
: public binary_function<_A1, _A2, _R>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Rp, class _A1, class _A2>
|
template <class _R, class _A1, class _A2>
|
||||||
struct __weak_result_type<_Rp (&)(_A1, _A2)>
|
struct __weak_result_type<_R (&)(_A1, _A2)>
|
||||||
: public binary_function<_A1, _A2, _Rp>
|
: public binary_function<_A1, _A2, _R>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Rp, class _Cp, class _A1>
|
template <class _R, class _C, class _A1>
|
||||||
struct __weak_result_type<_Rp (_Cp::*)(_A1)>
|
struct __weak_result_type<_R (_C::*)(_A1)>
|
||||||
: public binary_function<_Cp*, _A1, _Rp>
|
: public binary_function<_C*, _A1, _R>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Rp, class _Cp, class _A1>
|
template <class _R, class _C, class _A1>
|
||||||
struct __weak_result_type<_Rp (_Cp::*)(_A1) const>
|
struct __weak_result_type<_R (_C::*)(_A1) const>
|
||||||
: public binary_function<const _Cp*, _A1, _Rp>
|
: public binary_function<const _C*, _A1, _R>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Rp, class _Cp, class _A1>
|
template <class _R, class _C, class _A1>
|
||||||
struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile>
|
struct __weak_result_type<_R (_C::*)(_A1) volatile>
|
||||||
: public binary_function<volatile _Cp*, _A1, _Rp>
|
: public binary_function<volatile _C*, _A1, _R>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Rp, class _Cp, class _A1>
|
template <class _R, class _C, class _A1>
|
||||||
struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile>
|
struct __weak_result_type<_R (_C::*)(_A1) const volatile>
|
||||||
: public binary_function<const volatile _Cp*, _A1, _Rp>
|
: public binary_function<const volatile _C*, _A1, _R>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
|
||||||
// 3 or more arguments
|
// 3 or more arguments
|
||||||
|
|
||||||
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
|
template <class _R, class _A1, class _A2, class _A3, class ..._A4>
|
||||||
struct __weak_result_type<_Rp (_A1, _A2, _A3, _A4...)>
|
struct __weak_result_type<_R (_A1, _A2, _A3, _A4...)>
|
||||||
{
|
{
|
||||||
typedef _Rp result_type;
|
typedef _R result_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
|
template <class _R, class _A1, class _A2, class _A3, class ..._A4>
|
||||||
struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)>
|
struct __weak_result_type<_R (&)(_A1, _A2, _A3, _A4...)>
|
||||||
{
|
{
|
||||||
typedef _Rp result_type;
|
typedef _R result_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
|
template <class _R, class _A1, class _A2, class _A3, class ..._A4>
|
||||||
struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)>
|
struct __weak_result_type<_R (*)(_A1, _A2, _A3, _A4...)>
|
||||||
{
|
{
|
||||||
typedef _Rp result_type;
|
typedef _R result_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
template <class _R, class _C, class _A1, class _A2, class ..._A3>
|
||||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)>
|
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...)>
|
||||||
{
|
{
|
||||||
typedef _Rp result_type;
|
typedef _R result_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
template <class _R, class _C, class _A1, class _A2, class ..._A3>
|
||||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const>
|
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const>
|
||||||
{
|
{
|
||||||
typedef _Rp result_type;
|
typedef _R result_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
template <class _R, class _C, class _A1, class _A2, class ..._A3>
|
||||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile>
|
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) volatile>
|
||||||
{
|
{
|
||||||
typedef _Rp result_type;
|
typedef _R result_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
template <class _R, class _C, class _A1, class _A2, class ..._A3>
|
||||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
|
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const volatile>
|
||||||
{
|
{
|
||||||
typedef _Rp result_type;
|
typedef _R result_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
|
||||||
|
|
||||||
// __invoke
|
// __invoke
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
|
||||||
|
|
||||||
// bullets 1 and 2
|
// bullets 1 and 2
|
||||||
|
|
||||||
template <class _Fp, class _A0, class ..._Args,
|
template <class _F, class _A0, class ..._Args>
|
||||||
class>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
auto
|
auto
|
||||||
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
|
__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
|
||||||
-> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...))
|
-> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...))
|
||||||
{
|
{
|
||||||
return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...);
|
return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Fp, class _A0, class ..._Args,
|
template <class _F, class _A0, class ..._Args>
|
||||||
class>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
auto
|
auto
|
||||||
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
|
__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
|
||||||
-> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...))
|
-> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...))
|
||||||
{
|
{
|
||||||
return ((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...);
|
return ((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...);
|
||||||
@@ -334,21 +303,19 @@ __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
|
|||||||
|
|
||||||
// bullets 3 and 4
|
// bullets 3 and 4
|
||||||
|
|
||||||
template <class _Fp, class _A0,
|
template <class _F, class _A0>
|
||||||
class>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
auto
|
auto
|
||||||
__invoke(_Fp&& __f, _A0&& __a0)
|
__invoke(_F&& __f, _A0&& __a0)
|
||||||
-> decltype(_VSTD::forward<_A0>(__a0).*__f)
|
-> decltype(_VSTD::forward<_A0>(__a0).*__f)
|
||||||
{
|
{
|
||||||
return _VSTD::forward<_A0>(__a0).*__f;
|
return _VSTD::forward<_A0>(__a0).*__f;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Fp, class _A0,
|
template <class _F, class _A0>
|
||||||
class>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
auto
|
auto
|
||||||
__invoke(_Fp&& __f, _A0&& __a0)
|
__invoke(_F&& __f, _A0&& __a0)
|
||||||
-> decltype((*_VSTD::forward<_A0>(__a0)).*__f)
|
-> decltype((*_VSTD::forward<_A0>(__a0)).*__f)
|
||||||
{
|
{
|
||||||
return (*_VSTD::forward<_A0>(__a0)).*__f;
|
return (*_VSTD::forward<_A0>(__a0)).*__f;
|
||||||
@@ -356,91 +323,23 @@ __invoke(_Fp&& __f, _A0&& __a0)
|
|||||||
|
|
||||||
// bullet 5
|
// bullet 5
|
||||||
|
|
||||||
template <class _Fp, class ..._Args>
|
template <class _F, class ..._Args>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
auto
|
auto
|
||||||
__invoke(_Fp&& __f, _Args&& ...__args)
|
__invoke(_F&& __f, _Args&& ...__args)
|
||||||
-> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...))
|
-> decltype(_VSTD::forward<_F>(__f)(_VSTD::forward<_Args>(__args)...))
|
||||||
{
|
{
|
||||||
return _VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...);
|
return _VSTD::forward<_F>(__f)(_VSTD::forward<_Args>(__args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class ..._Args>
|
template <class _Tp, class ..._Args>
|
||||||
struct __invoke_return
|
struct __invoke_return
|
||||||
{
|
{
|
||||||
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type;
|
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type;
|
||||||
};
|
};
|
||||||
|
|
||||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
|
||||||
|
|
||||||
#include <__functional_base_03>
|
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
|
||||||
|
|
||||||
|
|
||||||
template <class _Ret>
|
|
||||||
struct __invoke_void_return_wrapper
|
|
||||||
{
|
|
||||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
|
||||||
template <class ..._Args>
|
|
||||||
static _Ret __call(_Args&&... __args) {
|
|
||||||
return __invoke(_VSTD::forward<_Args>(__args)...);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
template <class _Fn>
|
|
||||||
static _Ret __call(_Fn __f) {
|
|
||||||
return __invoke(__f);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Fn, class _A0>
|
|
||||||
static _Ret __call(_Fn __f, _A0& __a0) {
|
|
||||||
return __invoke(__f, __a0);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Fn, class _A0, class _A1>
|
|
||||||
static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1) {
|
|
||||||
return __invoke(__f, __a0, __a1);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Fn, class _A0, class _A1, class _A2>
|
|
||||||
static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2){
|
|
||||||
return __invoke(__f, __a0, __a1, __a2);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct __invoke_void_return_wrapper<void>
|
|
||||||
{
|
|
||||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
|
||||||
template <class ..._Args>
|
|
||||||
static void __call(_Args&&... __args) {
|
|
||||||
__invoke(_VSTD::forward<_Args>(__args)...);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
template <class _Fn>
|
|
||||||
static void __call(_Fn __f) {
|
|
||||||
__invoke(__f);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Fn, class _A0>
|
|
||||||
static void __call(_Fn __f, _A0& __a0) {
|
|
||||||
__invoke(__f, __a0);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Fn, class _A0, class _A1>
|
|
||||||
static void __call(_Fn __f, _A0& __a0, _A1& __a1) {
|
|
||||||
__invoke(__f, __a0, __a1);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Fn, class _A0, class _A1, class _A2>
|
|
||||||
static void __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2) {
|
|
||||||
__invoke(__f, __a0, __a1, __a2);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY reference_wrapper
|
class _LIBCPP_VISIBLE reference_wrapper
|
||||||
: public __weak_result_type<_Tp>
|
: public __weak_result_type<_Tp>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -451,8 +350,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// construct/copy/destroy
|
// construct/copy/destroy
|
||||||
_LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT : __f_(&__f) {}
|
||||||
: __f_(_VSTD::addressof(__f)) {}
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
private: reference_wrapper(type&&); public: // = delete; // do not bind to temps
|
private: reference_wrapper(type&&); public: // = delete; // do not bind to temps
|
||||||
#endif
|
#endif
|
||||||
@@ -461,126 +359,20 @@ public:
|
|||||||
_LIBCPP_INLINE_VISIBILITY operator type& () const _NOEXCEPT {return *__f_;}
|
_LIBCPP_INLINE_VISIBILITY operator type& () const _NOEXCEPT {return *__f_;}
|
||||||
_LIBCPP_INLINE_VISIBILITY type& get() const _NOEXCEPT {return *__f_;}
|
_LIBCPP_INLINE_VISIBILITY type& get() const _NOEXCEPT {return *__f_;}
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
|
||||||
// invoke
|
// invoke
|
||||||
template <class... _ArgTypes>
|
template <class... _ArgTypes>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
typename __invoke_of<type&, _ArgTypes...>::type
|
typename __invoke_of<type&, _ArgTypes...>::type
|
||||||
operator() (_ArgTypes&&... __args) const {
|
operator() (_ArgTypes&&... __args) const
|
||||||
return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
|
{
|
||||||
}
|
return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
|
||||||
#else
|
}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
typename __invoke_return<type>::type
|
|
||||||
operator() () const {
|
|
||||||
return __invoke(get());
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _A0>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
typename __invoke_return0<type, _A0>::type
|
|
||||||
operator() (_A0& __a0) const {
|
|
||||||
return __invoke(get(), __a0);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _A0>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
typename __invoke_return0<type, _A0 const>::type
|
|
||||||
operator() (_A0 const& __a0) const {
|
|
||||||
return __invoke(get(), __a0);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _A0, class _A1>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
typename __invoke_return1<type, _A0, _A1>::type
|
|
||||||
operator() (_A0& __a0, _A1& __a1) const {
|
|
||||||
return __invoke(get(), __a0, __a1);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _A0, class _A1>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
typename __invoke_return1<type, _A0 const, _A1>::type
|
|
||||||
operator() (_A0 const& __a0, _A1& __a1) const {
|
|
||||||
return __invoke(get(), __a0, __a1);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _A0, class _A1>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
typename __invoke_return1<type, _A0, _A1 const>::type
|
|
||||||
operator() (_A0& __a0, _A1 const& __a1) const {
|
|
||||||
return __invoke(get(), __a0, __a1);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _A0, class _A1>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
typename __invoke_return1<type, _A0 const, _A1 const>::type
|
|
||||||
operator() (_A0 const& __a0, _A1 const& __a1) const {
|
|
||||||
return __invoke(get(), __a0, __a1);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _A0, class _A1, class _A2>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
typename __invoke_return2<type, _A0, _A1, _A2>::type
|
|
||||||
operator() (_A0& __a0, _A1& __a1, _A2& __a2) const {
|
|
||||||
return __invoke(get(), __a0, __a1, __a2);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _A0, class _A1, class _A2>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
typename __invoke_return2<type, _A0 const, _A1, _A2>::type
|
|
||||||
operator() (_A0 const& __a0, _A1& __a1, _A2& __a2) const {
|
|
||||||
return __invoke(get(), __a0, __a1, __a2);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _A0, class _A1, class _A2>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
typename __invoke_return2<type, _A0, _A1 const, _A2>::type
|
|
||||||
operator() (_A0& __a0, _A1 const& __a1, _A2& __a2) const {
|
|
||||||
return __invoke(get(), __a0, __a1, __a2);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _A0, class _A1, class _A2>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
typename __invoke_return2<type, _A0, _A1, _A2 const>::type
|
|
||||||
operator() (_A0& __a0, _A1& __a1, _A2 const& __a2) const {
|
|
||||||
return __invoke(get(), __a0, __a1, __a2);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _A0, class _A1, class _A2>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
typename __invoke_return2<type, _A0 const, _A1 const, _A2>::type
|
|
||||||
operator() (_A0 const& __a0, _A1 const& __a1, _A2& __a2) const {
|
|
||||||
return __invoke(get(), __a0, __a1, __a2);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _A0, class _A1, class _A2>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
typename __invoke_return2<type, _A0 const, _A1, _A2 const>::type
|
|
||||||
operator() (_A0 const& __a0, _A1& __a1, _A2 const& __a2) const {
|
|
||||||
return __invoke(get(), __a0, __a1, __a2);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _A0, class _A1, class _A2>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
typename __invoke_return2<type, _A0, _A1 const, _A2 const>::type
|
|
||||||
operator() (_A0& __a0, _A1 const& __a1, _A2 const& __a2) const {
|
|
||||||
return __invoke(get(), __a0, __a1, __a2);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _A0, class _A1, class _A2>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
typename __invoke_return2<type, _A0 const, _A1 const, _A2 const>::type
|
|
||||||
operator() (_A0 const& __a0, _A1 const& __a1, _A2 const& __a2) const {
|
|
||||||
return __invoke(get(), __a0, __a1, __a2);
|
|
||||||
}
|
|
||||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp> struct __is_reference_wrapper_impl : public false_type {};
|
template <class _Tp> struct ____is_reference_wrapper : public false_type {};
|
||||||
template <class _Tp> struct __is_reference_wrapper_impl<reference_wrapper<_Tp> > : public true_type {};
|
template <class _Tp> struct ____is_reference_wrapper<reference_wrapper<_Tp> > : public true_type {};
|
||||||
template <class _Tp> struct __is_reference_wrapper
|
template <class _Tp> struct __is_reference_wrapper
|
||||||
: public __is_reference_wrapper_impl<typename remove_cv<_Tp>::type> {};
|
: public ____is_reference_wrapper<typename remove_cv<_Tp>::type> {};
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
@@ -614,17 +406,16 @@ cref(reference_wrapper<_Tp> __t) _NOEXCEPT
|
|||||||
return cref(__t.get());
|
return cref(__t.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||||
|
|
||||||
template <class _Tp> void ref(const _Tp&&) = delete;
|
template <class _Tp> void ref(const _Tp&& __t) = delete;
|
||||||
template <class _Tp> void cref(const _Tp&&) = delete;
|
template <class _Tp> void cref(const _Tp&& __t) = delete;
|
||||||
|
|
||||||
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||||
|
|
||||||
template <class _Tp> void ref(const _Tp&&);// = delete;
|
template <class _Tp> void ref(const _Tp&& __t);// = delete;
|
||||||
template <class _Tp> void cref(const _Tp&&);// = delete;
|
template <class _Tp> void cref(const _Tp&& __t);// = delete;
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||||
|
|
||||||
@@ -632,111 +423,6 @@ template <class _Tp> void cref(const _Tp&&);// = delete;
|
|||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
template <class _Tp1, class _Tp2 = void>
|
|
||||||
struct __is_transparent
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
struct __two {char __lx; char __lxx;};
|
|
||||||
template <class _Up> static __two __test(...);
|
|
||||||
template <class _Up> static char __test(typename _Up::is_transparent* = 0);
|
|
||||||
public:
|
|
||||||
static const bool value = sizeof(__test<_Tp1>(0)) == 1;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// allocator_arg_t
|
|
||||||
|
|
||||||
struct _LIBCPP_TYPE_VIS_ONLY allocator_arg_t { };
|
|
||||||
|
|
||||||
#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MEMORY)
|
|
||||||
extern const allocator_arg_t allocator_arg;
|
|
||||||
#else
|
|
||||||
constexpr allocator_arg_t allocator_arg = allocator_arg_t();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// uses_allocator
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
struct __has_allocator_type
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
struct __two {char __lx; char __lxx;};
|
|
||||||
template <class _Up> static __two __test(...);
|
|
||||||
template <class _Up> static char __test(typename _Up::allocator_type* = 0);
|
|
||||||
public:
|
|
||||||
static const bool value = sizeof(__test<_Tp>(0)) == 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class _Tp, class _Alloc, bool = __has_allocator_type<_Tp>::value>
|
|
||||||
struct __uses_allocator
|
|
||||||
: public integral_constant<bool,
|
|
||||||
is_convertible<_Alloc, typename _Tp::allocator_type>::value>
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class _Tp, class _Alloc>
|
|
||||||
struct __uses_allocator<_Tp, _Alloc, false>
|
|
||||||
: public false_type
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class _Tp, class _Alloc>
|
|
||||||
struct _LIBCPP_TYPE_VIS_ONLY uses_allocator
|
|
||||||
: public __uses_allocator<_Tp, _Alloc>
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
|
||||||
|
|
||||||
// allocator construction
|
|
||||||
|
|
||||||
template <class _Tp, class _Alloc, class ..._Args>
|
|
||||||
struct __uses_alloc_ctor_imp
|
|
||||||
{
|
|
||||||
static const bool __ua = uses_allocator<_Tp, _Alloc>::value;
|
|
||||||
static const bool __ic =
|
|
||||||
is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
|
|
||||||
static const int value = __ua ? 2 - __ic : 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class _Tp, class _Alloc, class ..._Args>
|
|
||||||
struct __uses_alloc_ctor
|
|
||||||
: integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value>
|
|
||||||
{};
|
|
||||||
|
|
||||||
template <class _Tp, class _Allocator, class... _Args>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
void __user_alloc_construct_impl (integral_constant<int, 0>, _Tp *__storage, const _Allocator &, _Args &&... __args )
|
|
||||||
{
|
|
||||||
new (__storage) _Tp (_VSTD::forward<_Args>(__args)...);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp, class _Allocator, class... _Args>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
void __user_alloc_construct_impl (integral_constant<int, 1>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
|
|
||||||
{
|
|
||||||
new (__storage) _Tp (allocator_arg, __a, _VSTD::forward<_Args>(__args)...);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp, class _Allocator, class... _Args>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
void __user_alloc_construct_impl (integral_constant<int, 2>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
|
|
||||||
{
|
|
||||||
new (__storage) _Tp (_VSTD::forward<_Args>(__args)..., __a);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp, class _Allocator, class... _Args>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
void __user_alloc_construct (_Tp *__storage, const _Allocator &__a, _Args &&... __args)
|
|
||||||
{
|
|
||||||
__user_alloc_construct_impl(
|
|
||||||
__uses_alloc_ctor<_Tp, _Allocator>(),
|
|
||||||
__storage, __a, _VSTD::forward<_Args>(__args)...
|
|
||||||
);
|
|
||||||
}
|
|
||||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
#endif // _LIBCPP_FUNCTIONAL_BASE
|
#endif // _LIBCPP_FUNCTIONAL_BASE
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
243
include/__locale
243
include/__locale
@@ -19,52 +19,23 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
|
#include <xlocale.h>
|
||||||
# include <support/win32/locale_win32.h>
|
|
||||||
#elif defined(_AIX)
|
|
||||||
# include <support/ibm/xlocale.h>
|
|
||||||
#elif defined(__ANDROID__)
|
|
||||||
// Android gained the locale aware functions in L (API level 21)
|
|
||||||
# include <android/api-level.h>
|
|
||||||
# if __ANDROID_API__ <= 20
|
|
||||||
# include <support/android/locale_bionic.h>
|
|
||||||
# endif
|
|
||||||
#elif defined(__sun__)
|
|
||||||
# include <xlocale.h>
|
|
||||||
# include <support/solaris/xlocale.h>
|
|
||||||
#elif defined(_NEWLIB_VERSION)
|
|
||||||
# include <support/newlib/xlocale.h>
|
|
||||||
#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) \
|
|
||||||
|| defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
|
|
||||||
# include <xlocale.h>
|
|
||||||
#elif defined(_LIBCPP_HAS_MUSL_LIBC)
|
|
||||||
# include <support/musl/xlocale.h>
|
|
||||||
#endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
class _LIBCPP_TYPE_VIS locale;
|
class locale;
|
||||||
|
|
||||||
template <class _Facet>
|
template <class _Facet> bool has_facet(const locale&) _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
template <class _Facet> const _Facet& use_facet(const locale&);
|
||||||
bool
|
|
||||||
has_facet(const locale&) _NOEXCEPT;
|
|
||||||
|
|
||||||
template <class _Facet>
|
class _LIBCPP_VISIBLE locale
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
const _Facet&
|
|
||||||
use_facet(const locale&);
|
|
||||||
|
|
||||||
class _LIBCPP_TYPE_VIS locale
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// types:
|
// types:
|
||||||
class _LIBCPP_TYPE_VIS facet;
|
class facet;
|
||||||
class _LIBCPP_TYPE_VIS id;
|
class id;
|
||||||
|
|
||||||
typedef int category;
|
typedef int category;
|
||||||
static const category // values assigned here are for exposition only
|
static const category // values assigned here are for exposition only
|
||||||
@@ -119,7 +90,7 @@ private:
|
|||||||
template <class _Facet> friend const _Facet& use_facet(const locale&);
|
template <class _Facet> friend const _Facet& use_facet(const locale&);
|
||||||
};
|
};
|
||||||
|
|
||||||
class _LIBCPP_TYPE_VIS locale::facet
|
class _LIBCPP_VISIBLE locale::facet
|
||||||
: public __shared_count
|
: public __shared_count
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
@@ -135,14 +106,14 @@ private:
|
|||||||
virtual void __on_zero_shared() _NOEXCEPT;
|
virtual void __on_zero_shared() _NOEXCEPT;
|
||||||
};
|
};
|
||||||
|
|
||||||
class _LIBCPP_TYPE_VIS locale::id
|
class _LIBCPP_VISIBLE locale::id
|
||||||
{
|
{
|
||||||
once_flag __flag_;
|
once_flag __flag_;
|
||||||
int32_t __id_;
|
int32_t __id_;
|
||||||
|
|
||||||
static int32_t __next_id;
|
static int32_t __next_id;
|
||||||
public:
|
public:
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR id() :__id_(0) {}
|
_LIBCPP_INLINE_VISIBILITY id() {}
|
||||||
private:
|
private:
|
||||||
void __init();
|
void __init();
|
||||||
void operator=(const id&); // = delete;
|
void operator=(const id&); // = delete;
|
||||||
@@ -191,7 +162,7 @@ use_facet(const locale& __l)
|
|||||||
// template <class _CharT> class collate;
|
// template <class _CharT> class collate;
|
||||||
|
|
||||||
template <class _CharT>
|
template <class _CharT>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY collate
|
class _LIBCPP_VISIBLE collate
|
||||||
: public locale::facet
|
: public locale::facet
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -256,29 +227,29 @@ collate<_CharT>::do_compare(const char_type* __lo1, const char_type* __hi1,
|
|||||||
|
|
||||||
template <class _CharT>
|
template <class _CharT>
|
||||||
long
|
long
|
||||||
collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const
|
collate<_CharT>::do_hash(const char_type* lo, const char_type* hi) const
|
||||||
{
|
{
|
||||||
size_t __h = 0;
|
size_t h = 0;
|
||||||
const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8;
|
const size_t sr = __CHAR_BIT__ * sizeof(size_t) - 8;
|
||||||
const size_t __mask = size_t(0xF) << (__sr + 4);
|
const size_t mask = size_t(0xF) << (sr + 4);
|
||||||
for(const char_type* __p = __lo; __p != __hi; ++__p)
|
for(const char_type* p = lo; p != hi; ++p)
|
||||||
{
|
{
|
||||||
__h = (__h << 4) + static_cast<size_t>(*__p);
|
h = (h << 4) + *p;
|
||||||
size_t __g = __h & __mask;
|
size_t g = h & mask;
|
||||||
__h ^= __g | (__g >> __sr);
|
h ^= g | (g >> sr);
|
||||||
}
|
}
|
||||||
return static_cast<long>(__h);
|
return static_cast<long>(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS collate<char>)
|
extern template class _LIBCPP_VISIBLE collate<char>;
|
||||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS collate<wchar_t>)
|
extern template class _LIBCPP_VISIBLE collate<wchar_t>;
|
||||||
|
|
||||||
// template <class CharT> class collate_byname;
|
// template <class CharT> class collate_byname;
|
||||||
|
|
||||||
template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY collate_byname;
|
template <class _CharT> class _LIBCPP_VISIBLE collate_byname;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS collate_byname<char>
|
class _LIBCPP_VISIBLE collate_byname<char>
|
||||||
: public collate<char>
|
: public collate<char>
|
||||||
{
|
{
|
||||||
locale_t __l;
|
locale_t __l;
|
||||||
@@ -297,7 +268,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS collate_byname<wchar_t>
|
class _LIBCPP_VISIBLE collate_byname<wchar_t>
|
||||||
: public collate<wchar_t>
|
: public collate<wchar_t>
|
||||||
{
|
{
|
||||||
locale_t __l;
|
locale_t __l;
|
||||||
@@ -328,11 +299,27 @@ locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
|
|||||||
|
|
||||||
// template <class charT> class ctype
|
// template <class charT> class ctype
|
||||||
|
|
||||||
class _LIBCPP_TYPE_VIS ctype_base
|
class _LIBCPP_VISIBLE ctype_base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#if defined(__GLIBC__)
|
#ifdef __GLIBC__
|
||||||
typedef unsigned short mask;
|
typedef unsigned short mask;
|
||||||
|
#else
|
||||||
|
typedef __uint32_t mask;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __APPLE__
|
||||||
|
static const mask space = _CTYPE_S;
|
||||||
|
static const mask print = _CTYPE_R;
|
||||||
|
static const mask cntrl = _CTYPE_C;
|
||||||
|
static const mask upper = _CTYPE_U;
|
||||||
|
static const mask lower = _CTYPE_L;
|
||||||
|
static const mask alpha = _CTYPE_A;
|
||||||
|
static const mask digit = _CTYPE_D;
|
||||||
|
static const mask punct = _CTYPE_P;
|
||||||
|
static const mask xdigit = _CTYPE_X;
|
||||||
|
static const mask blank = _CTYPE_B;
|
||||||
|
#else // __APPLE__
|
||||||
static const mask space = _ISspace;
|
static const mask space = _ISspace;
|
||||||
static const mask print = _ISprint;
|
static const mask print = _ISprint;
|
||||||
static const mask cntrl = _IScntrl;
|
static const mask cntrl = _IScntrl;
|
||||||
@@ -343,93 +330,17 @@ public:
|
|||||||
static const mask punct = _ISpunct;
|
static const mask punct = _ISpunct;
|
||||||
static const mask xdigit = _ISxdigit;
|
static const mask xdigit = _ISxdigit;
|
||||||
static const mask blank = _ISblank;
|
static const mask blank = _ISblank;
|
||||||
#elif defined(_WIN32)
|
#endif // __APPLE__
|
||||||
typedef unsigned short mask;
|
|
||||||
static const mask space = _SPACE;
|
|
||||||
static const mask print = _BLANK|_PUNCT|_ALPHA|_DIGIT;
|
|
||||||
static const mask cntrl = _CONTROL;
|
|
||||||
static const mask upper = _UPPER;
|
|
||||||
static const mask lower = _LOWER;
|
|
||||||
static const mask alpha = _ALPHA;
|
|
||||||
static const mask digit = _DIGIT;
|
|
||||||
static const mask punct = _PUNCT;
|
|
||||||
static const mask xdigit = _HEX;
|
|
||||||
static const mask blank = _BLANK;
|
|
||||||
# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
|
|
||||||
#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
|
|
||||||
# ifdef __APPLE__
|
|
||||||
typedef __uint32_t mask;
|
|
||||||
# elif defined(__FreeBSD__)
|
|
||||||
typedef unsigned long mask;
|
|
||||||
# elif defined(__EMSCRIPTEN__) || defined(__NetBSD__)
|
|
||||||
typedef unsigned short mask;
|
|
||||||
# endif
|
|
||||||
static const mask space = _CTYPE_S;
|
|
||||||
static const mask print = _CTYPE_R;
|
|
||||||
static const mask cntrl = _CTYPE_C;
|
|
||||||
static const mask upper = _CTYPE_U;
|
|
||||||
static const mask lower = _CTYPE_L;
|
|
||||||
static const mask alpha = _CTYPE_A;
|
|
||||||
static const mask digit = _CTYPE_D;
|
|
||||||
static const mask punct = _CTYPE_P;
|
|
||||||
static const mask xdigit = _CTYPE_X;
|
|
||||||
|
|
||||||
# if defined(__NetBSD__)
|
|
||||||
static const mask blank = _CTYPE_BL;
|
|
||||||
# else
|
|
||||||
static const mask blank = _CTYPE_B;
|
|
||||||
# endif
|
|
||||||
#elif defined(__sun__) || defined(_AIX)
|
|
||||||
typedef unsigned int mask;
|
|
||||||
static const mask space = _ISSPACE;
|
|
||||||
static const mask print = _ISPRINT;
|
|
||||||
static const mask cntrl = _ISCNTRL;
|
|
||||||
static const mask upper = _ISUPPER;
|
|
||||||
static const mask lower = _ISLOWER;
|
|
||||||
static const mask alpha = _ISALPHA;
|
|
||||||
static const mask digit = _ISDIGIT;
|
|
||||||
static const mask punct = _ISPUNCT;
|
|
||||||
static const mask xdigit = _ISXDIGIT;
|
|
||||||
static const mask blank = _ISBLANK;
|
|
||||||
#elif defined(_NEWLIB_VERSION)
|
|
||||||
// Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h.
|
|
||||||
typedef char mask;
|
|
||||||
static const mask space = _S;
|
|
||||||
static const mask print = _P | _U | _L | _N | _B;
|
|
||||||
static const mask cntrl = _C;
|
|
||||||
static const mask upper = _U;
|
|
||||||
static const mask lower = _L;
|
|
||||||
static const mask alpha = _U | _L;
|
|
||||||
static const mask digit = _N;
|
|
||||||
static const mask punct = _P;
|
|
||||||
static const mask xdigit = _X | _N;
|
|
||||||
static const mask blank = _B;
|
|
||||||
# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
|
|
||||||
# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
|
|
||||||
# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT
|
|
||||||
#else
|
|
||||||
typedef unsigned long mask;
|
|
||||||
static const mask space = 1<<0;
|
|
||||||
static const mask print = 1<<1;
|
|
||||||
static const mask cntrl = 1<<2;
|
|
||||||
static const mask upper = 1<<3;
|
|
||||||
static const mask lower = 1<<4;
|
|
||||||
static const mask alpha = 1<<5;
|
|
||||||
static const mask digit = 1<<6;
|
|
||||||
static const mask punct = 1<<7;
|
|
||||||
static const mask xdigit = 1<<8;
|
|
||||||
static const mask blank = 1<<9;
|
|
||||||
#endif
|
|
||||||
static const mask alnum = alpha | digit;
|
static const mask alnum = alpha | digit;
|
||||||
static const mask graph = alnum | punct;
|
static const mask graph = alnum | punct;
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE ctype_base() {}
|
_LIBCPP_ALWAYS_INLINE ctype_base() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY ctype;
|
template <class _CharT> class _LIBCPP_VISIBLE ctype;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS ctype<wchar_t>
|
class _LIBCPP_VISIBLE ctype<wchar_t>
|
||||||
: public locale::facet,
|
: public locale::facet,
|
||||||
public ctype_base
|
public ctype_base
|
||||||
{
|
{
|
||||||
@@ -531,7 +442,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS ctype<char>
|
class _LIBCPP_VISIBLE ctype<char>
|
||||||
: public locale::facet, public ctype_base
|
: public locale::facet, public ctype_base
|
||||||
{
|
{
|
||||||
const mask* __tab_;
|
const mask* __tab_;
|
||||||
@@ -544,14 +455,14 @@ public:
|
|||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
bool is(mask __m, char_type __c) const
|
bool is(mask __m, char_type __c) const
|
||||||
{
|
{
|
||||||
return isascii(__c) ? (__tab_[static_cast<int>(__c)] & __m) !=0 : false;
|
return isascii(__c) ? __tab_[__c] & __m : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
_LIBCPP_ALWAYS_INLINE
|
||||||
const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
|
const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
|
||||||
{
|
{
|
||||||
for (; __low != __high; ++__low, ++__vec)
|
for (; __low != __high; ++__low, ++__vec)
|
||||||
*__vec = isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0;
|
*__vec = isascii(*__low) ? __tab_[*__low] : 0;
|
||||||
return __low;
|
return __low;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -559,7 +470,7 @@ public:
|
|||||||
const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const
|
const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const
|
||||||
{
|
{
|
||||||
for (; __low != __high; ++__low)
|
for (; __low != __high; ++__low)
|
||||||
if (isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))
|
if (isascii(*__low) && (__tab_[*__low] & __m))
|
||||||
break;
|
break;
|
||||||
return __low;
|
return __low;
|
||||||
}
|
}
|
||||||
@@ -568,7 +479,7 @@ public:
|
|||||||
const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
|
const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
|
||||||
{
|
{
|
||||||
for (; __low != __high; ++__low)
|
for (; __low != __high; ++__low)
|
||||||
if (!(isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m)))
|
if (!(isascii(*__low) && (__tab_[*__low] & __m)))
|
||||||
break;
|
break;
|
||||||
return __low;
|
return __low;
|
||||||
}
|
}
|
||||||
@@ -630,14 +541,10 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
_LIBCPP_ALWAYS_INLINE const mask* table() const _NOEXCEPT {return __tab_;}
|
_LIBCPP_ALWAYS_INLINE const mask* table() const _NOEXCEPT {return __tab_;}
|
||||||
static const mask* classic_table() _NOEXCEPT;
|
static const mask* classic_table() _NOEXCEPT;
|
||||||
#if defined(__GLIBC__) || defined(__EMSCRIPTEN__)
|
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||||
static const int* __classic_upper_table() _NOEXCEPT;
|
static const int* __classic_upper_table() _NOEXCEPT;
|
||||||
static const int* __classic_lower_table() _NOEXCEPT;
|
static const int* __classic_lower_table() _NOEXCEPT;
|
||||||
#endif
|
#endif
|
||||||
#if defined(__NetBSD__)
|
|
||||||
static const short* __classic_upper_table() _NOEXCEPT;
|
|
||||||
static const short* __classic_lower_table() _NOEXCEPT;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~ctype();
|
~ctype();
|
||||||
@@ -653,10 +560,10 @@ protected:
|
|||||||
|
|
||||||
// template <class CharT> class ctype_byname;
|
// template <class CharT> class ctype_byname;
|
||||||
|
|
||||||
template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY ctype_byname;
|
template <class _CharT> class _LIBCPP_VISIBLE ctype_byname;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS ctype_byname<char>
|
class _LIBCPP_VISIBLE ctype_byname<char>
|
||||||
: public ctype<char>
|
: public ctype<char>
|
||||||
{
|
{
|
||||||
locale_t __l;
|
locale_t __l;
|
||||||
@@ -674,7 +581,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS ctype_byname<wchar_t>
|
class _LIBCPP_VISIBLE ctype_byname<wchar_t>
|
||||||
: public ctype<wchar_t>
|
: public ctype<wchar_t>
|
||||||
{
|
{
|
||||||
locale_t __l;
|
locale_t __l;
|
||||||
@@ -805,7 +712,7 @@ tolower(_CharT __c, const locale& __loc)
|
|||||||
|
|
||||||
// codecvt_base
|
// codecvt_base
|
||||||
|
|
||||||
class _LIBCPP_TYPE_VIS codecvt_base
|
class _LIBCPP_VISIBLE codecvt_base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
_LIBCPP_ALWAYS_INLINE codecvt_base() {}
|
_LIBCPP_ALWAYS_INLINE codecvt_base() {}
|
||||||
@@ -814,12 +721,12 @@ public:
|
|||||||
|
|
||||||
// template <class internT, class externT, class stateT> class codecvt;
|
// template <class internT, class externT, class stateT> class codecvt;
|
||||||
|
|
||||||
template <class _InternT, class _ExternT, class _StateT> class _LIBCPP_TYPE_VIS_ONLY codecvt;
|
template <class _InternT, class _ExternT, class _StateT> class _LIBCPP_VISIBLE codecvt;
|
||||||
|
|
||||||
// template <> class codecvt<char, char, mbstate_t>
|
// template <> class codecvt<char, char, mbstate_t>
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS codecvt<char, char, mbstate_t>
|
class _LIBCPP_VISIBLE codecvt<char, char, mbstate_t>
|
||||||
: public locale::facet,
|
: public locale::facet,
|
||||||
public codecvt_base
|
public codecvt_base
|
||||||
{
|
{
|
||||||
@@ -905,7 +812,7 @@ protected:
|
|||||||
// template <> class codecvt<wchar_t, char, mbstate_t>
|
// template <> class codecvt<wchar_t, char, mbstate_t>
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS codecvt<wchar_t, char, mbstate_t>
|
class _LIBCPP_VISIBLE codecvt<wchar_t, char, mbstate_t>
|
||||||
: public locale::facet,
|
: public locale::facet,
|
||||||
public codecvt_base
|
public codecvt_base
|
||||||
{
|
{
|
||||||
@@ -988,7 +895,7 @@ protected:
|
|||||||
// template <> class codecvt<char16_t, char, mbstate_t>
|
// template <> class codecvt<char16_t, char, mbstate_t>
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS codecvt<char16_t, char, mbstate_t>
|
class _LIBCPP_VISIBLE codecvt<char16_t, char, mbstate_t>
|
||||||
: public locale::facet,
|
: public locale::facet,
|
||||||
public codecvt_base
|
public codecvt_base
|
||||||
{
|
{
|
||||||
@@ -1074,7 +981,7 @@ protected:
|
|||||||
// template <> class codecvt<char32_t, char, mbstate_t>
|
// template <> class codecvt<char32_t, char, mbstate_t>
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS codecvt<char32_t, char, mbstate_t>
|
class _LIBCPP_VISIBLE codecvt<char32_t, char, mbstate_t>
|
||||||
: public locale::facet,
|
: public locale::facet,
|
||||||
public codecvt_base
|
public codecvt_base
|
||||||
{
|
{
|
||||||
@@ -1160,7 +1067,7 @@ protected:
|
|||||||
// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
|
// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
|
||||||
|
|
||||||
template <class _InternT, class _ExternT, class _StateT>
|
template <class _InternT, class _ExternT, class _StateT>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY codecvt_byname
|
class _LIBCPP_VISIBLE codecvt_byname
|
||||||
: public codecvt<_InternT, _ExternT, _StateT>
|
: public codecvt<_InternT, _ExternT, _StateT>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -1179,14 +1086,14 @@ codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<char, char, mbstate_t>)
|
extern template class codecvt_byname<char, char, mbstate_t>;
|
||||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>)
|
extern template class codecvt_byname<wchar_t, char, mbstate_t>;
|
||||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>)
|
extern template class codecvt_byname<char16_t, char, mbstate_t>;
|
||||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>)
|
extern template class codecvt_byname<char32_t, char, mbstate_t>;
|
||||||
|
|
||||||
_LIBCPP_FUNC_VIS void __throw_runtime_error(const char*);
|
_LIBCPP_VISIBLE void __throw_runtime_error(const char*);
|
||||||
|
|
||||||
template <size_t _Np>
|
template <size_t _N>
|
||||||
struct __narrow_to_utf8
|
struct __narrow_to_utf8
|
||||||
{
|
{
|
||||||
template <class _OutputIterator, class _CharT>
|
template <class _OutputIterator, class _CharT>
|
||||||
@@ -1276,7 +1183,7 @@ struct __narrow_to_utf8<32>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <size_t _Np>
|
template <size_t _N>
|
||||||
struct __widen_from_utf8
|
struct __widen_from_utf8
|
||||||
{
|
{
|
||||||
template <class _OutputIterator>
|
template <class _OutputIterator>
|
||||||
@@ -1368,10 +1275,10 @@ struct __widen_from_utf8<32>
|
|||||||
|
|
||||||
// template <class charT> class numpunct
|
// template <class charT> class numpunct
|
||||||
|
|
||||||
template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY numpunct;
|
template <class _CharT> class _LIBCPP_VISIBLE numpunct;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS numpunct<char>
|
class _LIBCPP_VISIBLE numpunct<char>
|
||||||
: public locale::facet
|
: public locale::facet
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -1402,7 +1309,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS numpunct<wchar_t>
|
class _LIBCPP_VISIBLE numpunct<wchar_t>
|
||||||
: public locale::facet
|
: public locale::facet
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -1434,10 +1341,10 @@ protected:
|
|||||||
|
|
||||||
// template <class charT> class numpunct_byname
|
// template <class charT> class numpunct_byname
|
||||||
|
|
||||||
template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY numpunct_byname;
|
template <class charT> class _LIBCPP_VISIBLE numpunct_byname;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS numpunct_byname<char>
|
class _LIBCPP_VISIBLE numpunct_byname<char>
|
||||||
: public numpunct<char>
|
: public numpunct<char>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -1455,7 +1362,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS numpunct_byname<wchar_t>
|
class _LIBCPP_VISIBLE numpunct_byname<wchar_t>
|
||||||
: public numpunct<wchar_t>
|
: public numpunct<wchar_t>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -14,29 +14,29 @@
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
#ifdef _LIBCPP_SHARED_LOCK
|
||||||
|
|
||||||
|
namespace ting {
|
||||||
|
template <class _Mutex> class shared_lock;
|
||||||
|
template <class _Mutex> class upgrade_lock;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // _LIBCPP_SHARED_LOCK
|
||||||
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
class _LIBCPP_VISIBLE mutex
|
||||||
|
|
||||||
class _LIBCPP_TYPE_VIS mutex
|
|
||||||
{
|
{
|
||||||
pthread_mutex_t __m_;
|
pthread_mutex_t __m_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
mutex() {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}
|
||||||
constexpr mutex() _NOEXCEPT : __m_(PTHREAD_MUTEX_INITIALIZER) {}
|
|
||||||
#else
|
|
||||||
mutex() _NOEXCEPT {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}
|
|
||||||
#endif
|
|
||||||
~mutex();
|
~mutex();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -45,33 +45,31 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
void lock();
|
void lock();
|
||||||
bool try_lock() _NOEXCEPT;
|
bool try_lock();
|
||||||
void unlock() _NOEXCEPT;
|
void unlock();
|
||||||
|
|
||||||
typedef pthread_mutex_t* native_handle_type;
|
typedef pthread_mutex_t* native_handle_type;
|
||||||
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;}
|
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _LIBCPP_TYPE_VIS defer_lock_t {};
|
struct _LIBCPP_VISIBLE defer_lock_t {};
|
||||||
struct _LIBCPP_TYPE_VIS try_to_lock_t {};
|
struct _LIBCPP_VISIBLE try_to_lock_t {};
|
||||||
struct _LIBCPP_TYPE_VIS adopt_lock_t {};
|
struct _LIBCPP_VISIBLE adopt_lock_t {};
|
||||||
|
|
||||||
#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MUTEX)
|
//constexpr
|
||||||
|
extern const
|
||||||
|
defer_lock_t defer_lock;
|
||||||
|
|
||||||
extern const defer_lock_t defer_lock;
|
//constexpr
|
||||||
extern const try_to_lock_t try_to_lock;
|
extern const
|
||||||
extern const adopt_lock_t adopt_lock;
|
try_to_lock_t try_to_lock;
|
||||||
|
|
||||||
#else
|
//constexpr
|
||||||
|
extern const
|
||||||
constexpr defer_lock_t defer_lock = defer_lock_t();
|
adopt_lock_t adopt_lock;
|
||||||
constexpr try_to_lock_t try_to_lock = try_to_lock_t();
|
|
||||||
constexpr adopt_lock_t adopt_lock = adopt_lock_t();
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <class _Mutex>
|
template <class _Mutex>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY lock_guard
|
class _LIBCPP_VISIBLE lock_guard
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef _Mutex mutex_type;
|
typedef _Mutex mutex_type;
|
||||||
@@ -95,7 +93,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class _Mutex>
|
template <class _Mutex>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY unique_lock
|
class _LIBCPP_VISIBLE unique_lock
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef _Mutex mutex_type;
|
typedef _Mutex mutex_type;
|
||||||
@@ -106,12 +104,12 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
unique_lock() _NOEXCEPT : __m_(nullptr), __owns_(false) {}
|
unique_lock() : __m_(nullptr), __owns_(false) {}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
explicit unique_lock(mutex_type& __m)
|
explicit unique_lock(mutex_type& __m)
|
||||||
: __m_(&__m), __owns_(true) {__m_->lock();}
|
: __m_(&__m), __owns_(true) {__m_->lock();}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
unique_lock(mutex_type& __m, defer_lock_t) _NOEXCEPT
|
unique_lock(mutex_type& __m, defer_lock_t)
|
||||||
: __m_(&__m), __owns_(false) {}
|
: __m_(&__m), __owns_(false) {}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
unique_lock(mutex_type& __m, try_to_lock_t)
|
unique_lock(mutex_type& __m, try_to_lock_t)
|
||||||
@@ -141,11 +139,11 @@ private:
|
|||||||
public:
|
public:
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
unique_lock(unique_lock&& __u) _NOEXCEPT
|
unique_lock(unique_lock&& __u)
|
||||||
: __m_(__u.__m_), __owns_(__u.__owns_)
|
: __m_(__u.__m_), __owns_(__u.__owns_)
|
||||||
{__u.__m_ = nullptr; __u.__owns_ = false;}
|
{__u.__m_ = nullptr; __u.__owns_ = false;}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
unique_lock& operator=(unique_lock&& __u) _NOEXCEPT
|
unique_lock& operator=(unique_lock&& __u)
|
||||||
{
|
{
|
||||||
if (__owns_)
|
if (__owns_)
|
||||||
__m_->unlock();
|
__m_->unlock();
|
||||||
@@ -156,6 +154,27 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _LIBCPP_SHARED_LOCK
|
||||||
|
|
||||||
|
unique_lock(ting::shared_lock<mutex_type>&&, try_to_lock_t);
|
||||||
|
template <class _Clock, class _Duration>
|
||||||
|
unique_lock(ting::shared_lock<mutex_type>&&,
|
||||||
|
const chrono::time_point<_Clock, _Duration>&);
|
||||||
|
template <class _Rep, class _Period>
|
||||||
|
unique_lock(ting::shared_lock<mutex_type>&&,
|
||||||
|
const chrono::duration<_Rep, _Period>&);
|
||||||
|
|
||||||
|
explicit unique_lock(ting::upgrade_lock<mutex_type>&&);
|
||||||
|
unique_lock(ting::upgrade_lock<mutex_type>&&, try_to_lock_t);
|
||||||
|
template <class _Clock, class _Duration>
|
||||||
|
unique_lock(ting::upgrade_lock<mutex_type>&&,
|
||||||
|
const chrono::time_point<_Clock, _Duration>&);
|
||||||
|
template <class _Rep, class _Period>
|
||||||
|
unique_lock(ting::upgrade_lock<mutex_type>&&,
|
||||||
|
const chrono::duration<_Rep, _Period>&);
|
||||||
|
|
||||||
|
#endif // _LIBCPP_SHARED_LOCK
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
void lock();
|
void lock();
|
||||||
@@ -169,13 +188,13 @@ public:
|
|||||||
void unlock();
|
void unlock();
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void swap(unique_lock& __u) _NOEXCEPT
|
void swap(unique_lock& __u)
|
||||||
{
|
{
|
||||||
_VSTD::swap(__m_, __u.__m_);
|
_VSTD::swap(__m_, __u.__m_);
|
||||||
_VSTD::swap(__owns_, __u.__owns_);
|
_VSTD::swap(__owns_, __u.__owns_);
|
||||||
}
|
}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
mutex_type* release() _NOEXCEPT
|
mutex_type* release()
|
||||||
{
|
{
|
||||||
mutex_type* __m = __m_;
|
mutex_type* __m = __m_;
|
||||||
__m_ = nullptr;
|
__m_ = nullptr;
|
||||||
@@ -184,12 +203,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool owns_lock() const _NOEXCEPT {return __owns_;}
|
bool owns_lock() const {return __owns_;}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_EXPLICIT
|
// explicit
|
||||||
operator bool () const _NOEXCEPT {return __owns_;}
|
operator bool () const {return __owns_;}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
mutex_type* mutex() const _NOEXCEPT {return __m_;}
|
mutex_type* mutex() const {return __m_;}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Mutex>
|
template <class _Mutex>
|
||||||
@@ -255,27 +274,28 @@ unique_lock<_Mutex>::unlock()
|
|||||||
template <class _Mutex>
|
template <class _Mutex>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) _NOEXCEPT
|
swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) {__x.swap(__y);}
|
||||||
{__x.swap(__y);}
|
|
||||||
|
|
||||||
//enum class cv_status
|
struct _LIBCPP_VISIBLE cv_status
|
||||||
_LIBCPP_DECLARE_STRONG_ENUM(cv_status)
|
|
||||||
{
|
{
|
||||||
no_timeout,
|
enum _ {
|
||||||
timeout
|
no_timeout,
|
||||||
};
|
timeout
|
||||||
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(cv_status)
|
};
|
||||||
|
|
||||||
class _LIBCPP_TYPE_VIS condition_variable
|
_ __v_;
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY cv_status(_ __v) : __v_(__v) {}
|
||||||
|
_LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class _LIBCPP_VISIBLE condition_variable
|
||||||
{
|
{
|
||||||
pthread_cond_t __cv_;
|
pthread_cond_t __cv_;
|
||||||
public:
|
public:
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
|
||||||
constexpr condition_variable() : __cv_(PTHREAD_COND_INITIALIZER) {}
|
|
||||||
#else
|
|
||||||
condition_variable() {__cv_ = (pthread_cond_t)PTHREAD_COND_INITIALIZER;}
|
condition_variable() {__cv_ = (pthread_cond_t)PTHREAD_COND_INITIALIZER;}
|
||||||
#endif
|
|
||||||
~condition_variable();
|
~condition_variable();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -283,13 +303,18 @@ private:
|
|||||||
condition_variable& operator=(const condition_variable&); // = delete;
|
condition_variable& operator=(const condition_variable&); // = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void notify_one() _NOEXCEPT;
|
void notify_one();
|
||||||
void notify_all() _NOEXCEPT;
|
void notify_all();
|
||||||
|
|
||||||
void wait(unique_lock<mutex>& __lk) _NOEXCEPT;
|
void wait(unique_lock<mutex>& __lk);
|
||||||
template <class _Predicate>
|
template <class _Predicate>
|
||||||
void wait(unique_lock<mutex>& __lk, _Predicate __pred);
|
void wait(unique_lock<mutex>& __lk, _Predicate __pred);
|
||||||
|
|
||||||
|
template <class _Duration>
|
||||||
|
cv_status
|
||||||
|
wait_until(unique_lock<mutex>& __lk,
|
||||||
|
const chrono::time_point<chrono::system_clock, _Duration>& __t);
|
||||||
|
|
||||||
template <class _Clock, class _Duration>
|
template <class _Clock, class _Duration>
|
||||||
cv_status
|
cv_status
|
||||||
wait_until(unique_lock<mutex>& __lk,
|
wait_until(unique_lock<mutex>& __lk,
|
||||||
@@ -308,7 +333,6 @@ public:
|
|||||||
|
|
||||||
template <class _Rep, class _Period, class _Predicate>
|
template <class _Rep, class _Period, class _Predicate>
|
||||||
bool
|
bool
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
wait_for(unique_lock<mutex>& __lk,
|
wait_for(unique_lock<mutex>& __lk,
|
||||||
const chrono::duration<_Rep, _Period>& __d,
|
const chrono::duration<_Rep, _Period>& __d,
|
||||||
_Predicate __pred);
|
_Predicate __pred);
|
||||||
@@ -318,9 +342,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void __do_timed_wait(unique_lock<mutex>& __lk,
|
void __do_timed_wait(unique_lock<mutex>& __lk,
|
||||||
chrono::time_point<chrono::system_clock, chrono::nanoseconds>) _NOEXCEPT;
|
chrono::time_point<chrono::system_clock, chrono::nanoseconds>);
|
||||||
};
|
};
|
||||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
|
||||||
|
|
||||||
template <class _To, class _Rep, class _Period>
|
template <class _To, class _Rep, class _Period>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
@@ -338,7 +361,6 @@ __ceil(chrono::duration<_Rep, _Period> __d)
|
|||||||
return __r;
|
return __r;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
|
||||||
template <class _Predicate>
|
template <class _Predicate>
|
||||||
void
|
void
|
||||||
condition_variable::wait(unique_lock<mutex>& __lk, _Predicate __pred)
|
condition_variable::wait(unique_lock<mutex>& __lk, _Predicate __pred)
|
||||||
@@ -347,13 +369,28 @@ condition_variable::wait(unique_lock<mutex>& __lk, _Predicate __pred)
|
|||||||
wait(__lk);
|
wait(__lk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class _Duration>
|
||||||
|
cv_status
|
||||||
|
condition_variable::wait_until(unique_lock<mutex>& __lk,
|
||||||
|
const chrono::time_point<chrono::system_clock, _Duration>& __t)
|
||||||
|
{
|
||||||
|
using namespace chrono;
|
||||||
|
typedef time_point<system_clock, nanoseconds> __nano_sys_tmpt;
|
||||||
|
__do_timed_wait(__lk,
|
||||||
|
__nano_sys_tmpt(__ceil<nanoseconds>(__t.time_since_epoch())));
|
||||||
|
return system_clock::now() < __t ? cv_status::no_timeout :
|
||||||
|
cv_status::timeout;
|
||||||
|
}
|
||||||
|
|
||||||
template <class _Clock, class _Duration>
|
template <class _Clock, class _Duration>
|
||||||
cv_status
|
cv_status
|
||||||
condition_variable::wait_until(unique_lock<mutex>& __lk,
|
condition_variable::wait_until(unique_lock<mutex>& __lk,
|
||||||
const chrono::time_point<_Clock, _Duration>& __t)
|
const chrono::time_point<_Clock, _Duration>& __t)
|
||||||
{
|
{
|
||||||
using namespace chrono;
|
using namespace chrono;
|
||||||
wait_for(__lk, __t - _Clock::now());
|
system_clock::time_point __s_now = system_clock::now();
|
||||||
|
typename _Clock::time_point __c_now = _Clock::now();
|
||||||
|
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__t - __c_now));
|
||||||
return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout;
|
return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,23 +414,15 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
|
|||||||
const chrono::duration<_Rep, _Period>& __d)
|
const chrono::duration<_Rep, _Period>& __d)
|
||||||
{
|
{
|
||||||
using namespace chrono;
|
using namespace chrono;
|
||||||
if (__d <= __d.zero())
|
|
||||||
return cv_status::timeout;
|
|
||||||
typedef time_point<system_clock, duration<long double, nano> > __sys_tpf;
|
|
||||||
typedef time_point<system_clock, nanoseconds> __sys_tpi;
|
|
||||||
__sys_tpf _Max = __sys_tpi::max();
|
|
||||||
system_clock::time_point __s_now = system_clock::now();
|
system_clock::time_point __s_now = system_clock::now();
|
||||||
steady_clock::time_point __c_now = steady_clock::now();
|
steady_clock::time_point __c_now = steady_clock::now();
|
||||||
if (_Max - __d > __s_now)
|
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d));
|
||||||
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d));
|
|
||||||
else
|
|
||||||
__do_timed_wait(__lk, __sys_tpi::max());
|
|
||||||
return steady_clock::now() - __c_now < __d ? cv_status::no_timeout :
|
return steady_clock::now() - __c_now < __d ? cv_status::no_timeout :
|
||||||
cv_status::timeout;
|
cv_status::timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Rep, class _Period, class _Predicate>
|
template <class _Rep, class _Period, class _Predicate>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
condition_variable::wait_for(unique_lock<mutex>& __lk,
|
condition_variable::wait_for(unique_lock<mutex>& __lk,
|
||||||
const chrono::duration<_Rep, _Period>& __d,
|
const chrono::duration<_Rep, _Period>& __d,
|
||||||
@@ -403,8 +432,6 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
|
|||||||
_VSTD::move(__pred));
|
_VSTD::move(__pred));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
#endif // _LIBCPP___MUTEX_BASE
|
#endif // _LIBCPP___MUTEX_BASE
|
||||||
|
|||||||
@@ -1,66 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
//===--------------------------- __nullptr --------------------------------===//
|
|
||||||
//
|
|
||||||
// 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_NULLPTR
|
|
||||||
#define _LIBCPP_NULLPTR
|
|
||||||
|
|
||||||
#include <__config>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _LIBCPP_HAS_NO_NULLPTR
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
|
||||||
|
|
||||||
struct _LIBCPP_TYPE_VIS_ONLY nullptr_t
|
|
||||||
{
|
|
||||||
void* __lx;
|
|
||||||
|
|
||||||
struct __nat {int __for_bool_;};
|
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {}
|
|
||||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {}
|
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR
|
|
||||||
operator _Tp* () const {return 0;}
|
|
||||||
|
|
||||||
template <class _Tp, class _Up>
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
|
||||||
operator _Tp _Up::* () const {return 0;}
|
|
||||||
|
|
||||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;}
|
|
||||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;}
|
|
||||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<(nullptr_t, nullptr_t) {return false;}
|
|
||||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<=(nullptr_t, nullptr_t) {return true;}
|
|
||||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>(nullptr_t, nullptr_t) {return false;}
|
|
||||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>=(nullptr_t, nullptr_t) {return true;}
|
|
||||||
};
|
|
||||||
|
|
||||||
inline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);}
|
|
||||||
|
|
||||||
#define nullptr _VSTD::__get_nullptr_t()
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
|
||||||
|
|
||||||
#else // _LIBCPP_HAS_NO_NULLPTR
|
|
||||||
|
|
||||||
namespace std
|
|
||||||
{
|
|
||||||
typedef decltype(nullptr) nullptr_t;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_NULLPTR
|
|
||||||
|
|
||||||
#endif // _LIBCPP_NULLPTR
|
|
||||||
@@ -1,139 +0,0 @@
|
|||||||
//===------------------------ __refstring ---------------------------------===//
|
|
||||||
//
|
|
||||||
// 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___REFSTRING
|
|
||||||
#define _LIBCPP___REFSTRING
|
|
||||||
|
|
||||||
#include <__config>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <cstring>
|
|
||||||
#ifdef __APPLE__
|
|
||||||
#include <dlfcn.h>
|
|
||||||
#include <mach-o/dyld.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
|
||||||
|
|
||||||
class _LIBCPP_HIDDEN __libcpp_refstring
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
const char* str_;
|
|
||||||
|
|
||||||
typedef int count_t;
|
|
||||||
|
|
||||||
struct _Rep_base
|
|
||||||
{
|
|
||||||
std::size_t len;
|
|
||||||
std::size_t cap;
|
|
||||||
count_t count;
|
|
||||||
};
|
|
||||||
|
|
||||||
static
|
|
||||||
_Rep_base*
|
|
||||||
rep_from_data(const char *data_) _NOEXCEPT
|
|
||||||
{
|
|
||||||
char *data = const_cast<char *>(data_);
|
|
||||||
return reinterpret_cast<_Rep_base *>(data - sizeof(_Rep_base));
|
|
||||||
}
|
|
||||||
static
|
|
||||||
char *
|
|
||||||
data_from_rep(_Rep_base *rep) _NOEXCEPT
|
|
||||||
{
|
|
||||||
char *data = reinterpret_cast<char *>(rep);
|
|
||||||
return data + sizeof(*rep);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __APPLE__
|
|
||||||
static
|
|
||||||
const char*
|
|
||||||
compute_gcc_empty_string_storage() _NOEXCEPT
|
|
||||||
{
|
|
||||||
void* handle = dlopen("/usr/lib/libstdc++.6.dylib", RTLD_NOLOAD);
|
|
||||||
if (handle == nullptr)
|
|
||||||
return nullptr;
|
|
||||||
void* sym = dlsym(handle, "_ZNSs4_Rep20_S_empty_rep_storageE");
|
|
||||||
if (sym == nullptr)
|
|
||||||
return nullptr;
|
|
||||||
return data_from_rep(reinterpret_cast<_Rep_base *>(sym));
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
|
||||||
const char*
|
|
||||||
get_gcc_empty_string_storage() _NOEXCEPT
|
|
||||||
{
|
|
||||||
static const char* p = compute_gcc_empty_string_storage();
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
uses_refcount() const
|
|
||||||
{
|
|
||||||
return str_ != get_gcc_empty_string_storage();
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
bool
|
|
||||||
uses_refcount() const
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit __libcpp_refstring(const char* msg) {
|
|
||||||
std::size_t len = strlen(msg);
|
|
||||||
_Rep_base* rep = static_cast<_Rep_base *>(::operator new(sizeof(*rep) + len + 1));
|
|
||||||
rep->len = len;
|
|
||||||
rep->cap = len;
|
|
||||||
rep->count = 0;
|
|
||||||
char *data = data_from_rep(rep);
|
|
||||||
std::memcpy(data, msg, len + 1);
|
|
||||||
str_ = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
__libcpp_refstring(const __libcpp_refstring& s) _NOEXCEPT : str_(s.str_)
|
|
||||||
{
|
|
||||||
if (uses_refcount())
|
|
||||||
__sync_add_and_fetch(&rep_from_data(str_)->count, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
__libcpp_refstring& operator=(const __libcpp_refstring& s) _NOEXCEPT
|
|
||||||
{
|
|
||||||
bool adjust_old_count = uses_refcount();
|
|
||||||
struct _Rep_base *old_rep = rep_from_data(str_);
|
|
||||||
str_ = s.str_;
|
|
||||||
if (uses_refcount())
|
|
||||||
__sync_add_and_fetch(&rep_from_data(str_)->count, 1);
|
|
||||||
if (adjust_old_count)
|
|
||||||
{
|
|
||||||
if (__sync_add_and_fetch(&old_rep->count, count_t(-1)) < 0)
|
|
||||||
{
|
|
||||||
::operator delete(old_rep);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
~__libcpp_refstring()
|
|
||||||
{
|
|
||||||
if (uses_refcount())
|
|
||||||
{
|
|
||||||
_Rep_base* rep = rep_from_data(str_);
|
|
||||||
if (__sync_add_and_fetch(&rep->count, count_t(-1)) < 0)
|
|
||||||
{
|
|
||||||
::operator delete(rep);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* c_str() const _NOEXCEPT {return str_;}
|
|
||||||
};
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
|
||||||
|
|
||||||
#endif //_LIBCPP___REFSTRING
|
|
||||||
@@ -6,11 +6,7 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <__undef_min_max>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
@@ -56,12 +52,9 @@ public:
|
|||||||
_LIBCPP_INLINE_VISIBILITY pointer& __end_cap() _NOEXCEPT {return __end_cap_.first();}
|
_LIBCPP_INLINE_VISIBILITY pointer& __end_cap() _NOEXCEPT {return __end_cap_.first();}
|
||||||
_LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const _NOEXCEPT {return __end_cap_.first();}
|
_LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const _NOEXCEPT {return __end_cap_.first();}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
__split_buffer()
|
__split_buffer()
|
||||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
|
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
explicit __split_buffer(__alloc_rr& __a);
|
explicit __split_buffer(__alloc_rr& __a);
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
explicit __split_buffer(const __alloc_rr& __a);
|
explicit __split_buffer(const __alloc_rr& __a);
|
||||||
__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);
|
__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);
|
||||||
~__split_buffer();
|
~__split_buffer();
|
||||||
@@ -98,7 +91,7 @@ public:
|
|||||||
void reserve(size_type __n);
|
void reserve(size_type __n);
|
||||||
void shrink_to_fit() _NOEXCEPT;
|
void shrink_to_fit() _NOEXCEPT;
|
||||||
void push_front(const_reference __x);
|
void push_front(const_reference __x);
|
||||||
_LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x);
|
void push_back(const_reference __x);
|
||||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||||
void push_front(value_type&& __x);
|
void push_front(value_type&& __x);
|
||||||
void push_back(value_type&& __x);
|
void push_back(value_type&& __x);
|
||||||
@@ -131,17 +124,13 @@ public:
|
|||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin)
|
_LIBCPP_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin)
|
||||||
{__destruct_at_begin(__new_begin, is_trivially_destructible<value_type>());}
|
{__destruct_at_begin(__new_begin, is_trivially_destructible<value_type>());}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
void __destruct_at_begin(pointer __new_begin, false_type);
|
void __destruct_at_begin(pointer __new_begin, false_type);
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
void __destruct_at_begin(pointer __new_begin, true_type);
|
void __destruct_at_begin(pointer __new_begin, true_type);
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void __destruct_at_end(pointer __new_last) _NOEXCEPT
|
void __destruct_at_end(pointer __new_last) _NOEXCEPT
|
||||||
{__destruct_at_end(__new_last, false_type());}
|
{__destruct_at_end(__new_last, is_trivially_destructible<value_type>());}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
void __destruct_at_end(pointer __new_last, false_type) _NOEXCEPT;
|
void __destruct_at_end(pointer __new_last, false_type) _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT;
|
void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT;
|
||||||
|
|
||||||
void swap(__split_buffer& __x)
|
void swap(__split_buffer& __x)
|
||||||
@@ -152,14 +141,33 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void __move_assign_alloc(__split_buffer& __c, true_type)
|
void __move_assign_alloc(const __split_buffer& __c, true_type)
|
||||||
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
|
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
|
||||||
{
|
{
|
||||||
__alloc() = _VSTD::move(__c.__alloc());
|
__alloc() = _VSTD::move(__c.__alloc());
|
||||||
}
|
}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT
|
void __move_assign_alloc(const __split_buffer& __c, false_type) _NOEXCEPT
|
||||||
|
{}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y)
|
||||||
|
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
|
||||||
|
__is_nothrow_swappable<__alloc_rr>::value)
|
||||||
|
{__swap_alloc(__x, __y, integral_constant<bool,
|
||||||
|
__alloc_traits::propagate_on_container_swap::value>());}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, true_type)
|
||||||
|
_NOEXCEPT_(__is_nothrow_swappable<__alloc_rr>::value)
|
||||||
|
{
|
||||||
|
using _VSTD::swap;
|
||||||
|
swap(__x, __y);
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, false_type) _NOEXCEPT
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -200,7 +208,7 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
|
|||||||
__alloc_rr& __a = this->__alloc();
|
__alloc_rr& __a = this->__alloc();
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_));
|
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), value_type());
|
||||||
++this->__end_;
|
++this->__end_;
|
||||||
--__n;
|
--__n;
|
||||||
} while (__n > 0);
|
} while (__n > 0);
|
||||||
@@ -271,16 +279,16 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _F
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
void
|
void
|
||||||
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
|
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
|
||||||
{
|
{
|
||||||
while (__begin_ != __new_begin)
|
while (__begin_ < __new_begin)
|
||||||
__alloc_traits::destroy(__alloc(), __to_raw_pointer(__begin_++));
|
__alloc_traits::destroy(__alloc(), __begin_++);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
void
|
void
|
||||||
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type)
|
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type)
|
||||||
{
|
{
|
||||||
@@ -288,16 +296,16 @@ __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
void
|
void
|
||||||
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
|
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
|
||||||
{
|
{
|
||||||
while (__new_last != __end_)
|
while (__new_last < __end_)
|
||||||
__alloc_traits::destroy(__alloc(), __to_raw_pointer(--__end_));
|
__alloc_traits::destroy(__alloc(), --__end_);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
void
|
void
|
||||||
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) _NOEXCEPT
|
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -306,7 +314,7 @@ __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type
|
|||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
__split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a)
|
__split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a)
|
||||||
: __end_cap_(nullptr, __a)
|
: __end_cap_(0, __a)
|
||||||
{
|
{
|
||||||
__first_ = __cap != 0 ? __alloc_traits::allocate(__alloc(), __cap) : nullptr;
|
__first_ = __cap != 0 ? __alloc_traits::allocate(__alloc(), __cap) : nullptr;
|
||||||
__begin_ = __end_ = __first_ + __start;
|
__begin_ = __end_ = __first_ + __start;
|
||||||
@@ -314,24 +322,24 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __sta
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
__split_buffer<_Tp, _Allocator>::__split_buffer()
|
__split_buffer<_Tp, _Allocator>::__split_buffer()
|
||||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
||||||
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr)
|
: __first_(0), __begin_(0), __end_(0), __end_cap_(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
__split_buffer<_Tp, _Allocator>::__split_buffer(__alloc_rr& __a)
|
__split_buffer<_Tp, _Allocator>::__split_buffer(__alloc_rr& __a)
|
||||||
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a)
|
: __first_(0), __begin_(0), __end_(0), __end_cap_(0, __a)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
__split_buffer<_Tp, _Allocator>::__split_buffer(const __alloc_rr& __a)
|
__split_buffer<_Tp, _Allocator>::__split_buffer(const __alloc_rr& __a)
|
||||||
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a)
|
: __first_(0), __begin_(0), __end_(0), __end_cap_(0, __a)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,8 +388,8 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __al
|
|||||||
__first_ = __alloc_traits::allocate(__alloc(), __cap);
|
__first_ = __alloc_traits::allocate(__alloc(), __cap);
|
||||||
__begin_ = __end_ = __first_;
|
__begin_ = __end_ = __first_;
|
||||||
__end_cap() = __first_ + __cap;
|
__end_cap() = __first_ + __cap;
|
||||||
typedef move_iterator<iterator> _Ip;
|
typedef move_iterator<iterator> _I;
|
||||||
__construct_at_end(_Ip(__c.begin()), _Ip(__c.end()));
|
__construct_at_end(_I(__c.begin()), _I(__c.end()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -417,7 +425,7 @@ __split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
|
|||||||
_VSTD::swap(__begin_, __x.__begin_);
|
_VSTD::swap(__begin_, __x.__begin_);
|
||||||
_VSTD::swap(__end_, __x.__end_);
|
_VSTD::swap(__end_, __x.__end_);
|
||||||
_VSTD::swap(__end_cap(), __x.__end_cap());
|
_VSTD::swap(__end_cap(), __x.__end_cap());
|
||||||
__swap_allocator(__alloc(), __x.__alloc());
|
__swap_alloc(__alloc(), __x.__alloc());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
@@ -478,7 +486,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
|
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
|
||||||
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
|
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
|
||||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||||
move_iterator<pointer>(__end_));
|
move_iterator<pointer>(__end_));
|
||||||
@@ -509,7 +517,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
|
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
|
||||||
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
|
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
|
||||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||||
move_iterator<pointer>(__end_));
|
move_iterator<pointer>(__end_));
|
||||||
@@ -527,7 +535,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
|
|||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
void
|
void
|
||||||
__split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
|
__split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
|
||||||
{
|
{
|
||||||
@@ -542,7 +550,7 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
|
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
|
||||||
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
||||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||||
move_iterator<pointer>(__end_));
|
move_iterator<pointer>(__end_));
|
||||||
@@ -573,7 +581,7 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
|
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
|
||||||
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
||||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||||
move_iterator<pointer>(__end_));
|
move_iterator<pointer>(__end_));
|
||||||
@@ -606,7 +614,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
|
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
|
||||||
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
||||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||||
move_iterator<pointer>(__end_));
|
move_iterator<pointer>(__end_));
|
||||||
@@ -626,7 +634,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
|
|||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
void
|
void
|
||||||
swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y)
|
swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y)
|
||||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||||
|
|||||||
@@ -15,28 +15,24 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
#include <__undef___deallocate>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
template <class _Tp, size_t _Np> class _LIBCPP_HIDDEN __sso_allocator;
|
template <class _Tp, size_t _N> class _LIBCPP_HIDDEN __sso_allocator;
|
||||||
|
|
||||||
template <size_t _Np>
|
template <size_t _N>
|
||||||
class _LIBCPP_HIDDEN __sso_allocator<void, _Np>
|
class _LIBCPP_HIDDEN __sso_allocator<void, _N>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef const void* const_pointer;
|
typedef const void* const_pointer;
|
||||||
typedef void value_type;
|
typedef void value_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp, size_t _Np>
|
template <class _Tp, size_t _N>
|
||||||
class _LIBCPP_HIDDEN __sso_allocator
|
class _LIBCPP_HIDDEN __sso_allocator
|
||||||
{
|
{
|
||||||
typename aligned_storage<sizeof(_Tp) * _Np>::type buf_;
|
typename aligned_storage<sizeof(_Tp) * _N>::type buf_;
|
||||||
bool __allocated_;
|
bool __allocated_;
|
||||||
public:
|
public:
|
||||||
typedef size_t size_type;
|
typedef size_t size_type;
|
||||||
@@ -45,26 +41,26 @@ public:
|
|||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY __sso_allocator() throw() : __allocated_(false) {}
|
_LIBCPP_INLINE_VISIBILITY __sso_allocator() throw() : __allocated_(false) {}
|
||||||
_LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator&) throw() : __allocated_(false) {}
|
_LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator&) throw() : __allocated_(false) {}
|
||||||
template <class _Up> _LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator<_Up, _Np>&) throw()
|
template <class _Up> _LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator<_Up, _N>&) throw()
|
||||||
: __allocated_(false) {}
|
: __allocated_(false) {}
|
||||||
private:
|
private:
|
||||||
__sso_allocator& operator=(const __sso_allocator&);
|
__sso_allocator& operator=(const __sso_allocator&);
|
||||||
public:
|
public:
|
||||||
_LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, typename __sso_allocator<void, _Np>::const_pointer = 0)
|
_LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, typename __sso_allocator<void, _N>::const_pointer = 0)
|
||||||
{
|
{
|
||||||
if (!__allocated_ && __n <= _Np)
|
if (!__allocated_ && __n <= _N)
|
||||||
{
|
{
|
||||||
__allocated_ = true;
|
__allocated_ = true;
|
||||||
return (pointer)&buf_;
|
return (pointer)&buf_;
|
||||||
}
|
}
|
||||||
return static_cast<pointer>(_VSTD::__allocate(__n * sizeof(_Tp)));
|
return static_cast<pointer>(::operator new(__n * sizeof(_Tp)));
|
||||||
}
|
}
|
||||||
_LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type)
|
_LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type)
|
||||||
{
|
{
|
||||||
if (__p == (pointer)&buf_)
|
if (__p == (pointer)&buf_)
|
||||||
__allocated_ = false;
|
__allocated_ = false;
|
||||||
else
|
else
|
||||||
_VSTD::__deallocate(__p);
|
::operator delete(__p);
|
||||||
}
|
}
|
||||||
_LIBCPP_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);}
|
_LIBCPP_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);}
|
||||||
|
|
||||||
|
|||||||
@@ -17,15 +17,11 @@
|
|||||||
#include <__locale>
|
#include <__locale>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
#include <__undef_min_max>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
static const int __limit = 8;
|
static const unsigned __limit = 8;
|
||||||
|
|
||||||
// __stdinbuf
|
// __stdinbuf
|
||||||
|
|
||||||
@@ -41,7 +37,7 @@ public:
|
|||||||
typedef typename traits_type::off_type off_type;
|
typedef typename traits_type::off_type off_type;
|
||||||
typedef typename traits_type::state_type state_type;
|
typedef typename traits_type::state_type state_type;
|
||||||
|
|
||||||
__stdinbuf(FILE* __fp, state_type* __st);
|
explicit __stdinbuf(FILE* __fp);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int_type underflow();
|
virtual int_type underflow();
|
||||||
@@ -53,10 +49,8 @@ private:
|
|||||||
|
|
||||||
FILE* __file_;
|
FILE* __file_;
|
||||||
const codecvt<char_type, char, state_type>* __cv_;
|
const codecvt<char_type, char, state_type>* __cv_;
|
||||||
state_type* __st_;
|
state_type __st_;
|
||||||
int __encoding_;
|
int __encoding_;
|
||||||
int_type __last_consumed_;
|
|
||||||
bool __last_consumed_is_next_;
|
|
||||||
bool __always_noconv_;
|
bool __always_noconv_;
|
||||||
|
|
||||||
__stdinbuf(const __stdinbuf&);
|
__stdinbuf(const __stdinbuf&);
|
||||||
@@ -66,11 +60,9 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class _CharT>
|
template <class _CharT>
|
||||||
__stdinbuf<_CharT>::__stdinbuf(FILE* __fp, state_type* __st)
|
__stdinbuf<_CharT>::__stdinbuf(FILE* __fp)
|
||||||
: __file_(__fp),
|
: __file_(__fp),
|
||||||
__st_(__st),
|
__st_()
|
||||||
__last_consumed_(traits_type::eof()),
|
|
||||||
__last_consumed_is_next_(false)
|
|
||||||
{
|
{
|
||||||
imbue(this->getloc());
|
imbue(this->getloc());
|
||||||
}
|
}
|
||||||
@@ -104,21 +96,11 @@ template <class _CharT>
|
|||||||
typename __stdinbuf<_CharT>::int_type
|
typename __stdinbuf<_CharT>::int_type
|
||||||
__stdinbuf<_CharT>::__getchar(bool __consume)
|
__stdinbuf<_CharT>::__getchar(bool __consume)
|
||||||
{
|
{
|
||||||
if (__last_consumed_is_next_)
|
|
||||||
{
|
|
||||||
int_type __result = __last_consumed_;
|
|
||||||
if (__consume)
|
|
||||||
{
|
|
||||||
__last_consumed_ = traits_type::eof();
|
|
||||||
__last_consumed_is_next_ = false;
|
|
||||||
}
|
|
||||||
return __result;
|
|
||||||
}
|
|
||||||
char __extbuf[__limit];
|
char __extbuf[__limit];
|
||||||
int __nread = _VSTD::max(1, __encoding_);
|
int __nread = _VSTD::max(1, __encoding_);
|
||||||
for (int __i = 0; __i < __nread; ++__i)
|
for (int __i = 0; __i < __nread; ++__i)
|
||||||
{
|
{
|
||||||
int __c = getc(__file_);
|
char __c = getc(__file_);
|
||||||
if (__c == EOF)
|
if (__c == EOF)
|
||||||
return traits_type::eof();
|
return traits_type::eof();
|
||||||
__extbuf[__i] = static_cast<char>(__c);
|
__extbuf[__i] = static_cast<char>(__c);
|
||||||
@@ -133,19 +115,19 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
|
|||||||
codecvt_base::result __r;
|
codecvt_base::result __r;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
state_type __sv_st = *__st_;
|
state_type __sv_st = __st_;
|
||||||
__r = __cv_->in(*__st_, __extbuf, __extbuf + __nread, __enxt,
|
__r = __cv_->in(__st_, __extbuf, __extbuf + __nread, __enxt,
|
||||||
&__1buf, &__1buf + 1, __inxt);
|
&__1buf, &__1buf + 1, __inxt);
|
||||||
switch (__r)
|
switch (__r)
|
||||||
{
|
{
|
||||||
case _VSTD::codecvt_base::ok:
|
case _VSTD::codecvt_base::ok:
|
||||||
break;
|
break;
|
||||||
case codecvt_base::partial:
|
case codecvt_base::partial:
|
||||||
*__st_ = __sv_st;
|
__st_ = __sv_st;
|
||||||
if (__nread == sizeof(__extbuf))
|
if (__nread == sizeof(__extbuf))
|
||||||
return traits_type::eof();
|
return traits_type::eof();
|
||||||
{
|
{
|
||||||
int __c = getc(__file_);
|
char __c = getc(__file_);
|
||||||
if (__c == EOF)
|
if (__c == EOF)
|
||||||
return traits_type::eof();
|
return traits_type::eof();
|
||||||
__extbuf[__nread] = static_cast<char>(__c);
|
__extbuf[__nread] = static_cast<char>(__c);
|
||||||
@@ -164,12 +146,10 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
|
|||||||
{
|
{
|
||||||
for (int __i = __nread; __i > 0;)
|
for (int __i = __nread; __i > 0;)
|
||||||
{
|
{
|
||||||
if (ungetc(traits_type::to_int_type(__extbuf[--__i]), __file_) == EOF)
|
if (ungetc(__extbuf[--__i], __file_) == EOF)
|
||||||
return traits_type::eof();
|
return traits_type::eof();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
__last_consumed_ = traits_type::to_int_type(__1buf);
|
|
||||||
return traits_type::to_int_type(__1buf);
|
return traits_type::to_int_type(__1buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,41 +158,28 @@ typename __stdinbuf<_CharT>::int_type
|
|||||||
__stdinbuf<_CharT>::pbackfail(int_type __c)
|
__stdinbuf<_CharT>::pbackfail(int_type __c)
|
||||||
{
|
{
|
||||||
if (traits_type::eq_int_type(__c, traits_type::eof()))
|
if (traits_type::eq_int_type(__c, traits_type::eof()))
|
||||||
{
|
|
||||||
if (!__last_consumed_is_next_)
|
|
||||||
{
|
|
||||||
__c = __last_consumed_;
|
|
||||||
__last_consumed_is_next_ = !traits_type::eq_int_type(__last_consumed_,
|
|
||||||
traits_type::eof());
|
|
||||||
}
|
|
||||||
return __c;
|
return __c;
|
||||||
}
|
char __extbuf[__limit];
|
||||||
if (__last_consumed_is_next_)
|
char* __enxt;
|
||||||
|
const char_type __ci = traits_type::to_char_type(__c);
|
||||||
|
const char_type* __inxt;
|
||||||
|
switch (__cv_->out(__st_, &__ci, &__ci + 1, __inxt,
|
||||||
|
__extbuf, __extbuf + sizeof(__extbuf), __enxt))
|
||||||
{
|
{
|
||||||
char __extbuf[__limit];
|
case _VSTD::codecvt_base::ok:
|
||||||
char* __enxt;
|
break;
|
||||||
const char_type __ci = traits_type::to_char_type(__last_consumed_);
|
case _VSTD::codecvt_base::noconv:
|
||||||
const char_type* __inxt;
|
__extbuf[0] = static_cast<char>(__c);
|
||||||
switch (__cv_->out(*__st_, &__ci, &__ci + 1, __inxt,
|
__enxt = __extbuf + 1;
|
||||||
__extbuf, __extbuf + sizeof(__extbuf), __enxt))
|
break;
|
||||||
{
|
case codecvt_base::partial:
|
||||||
case _VSTD::codecvt_base::ok:
|
case codecvt_base::error:
|
||||||
break;
|
return traits_type::eof();
|
||||||
case _VSTD::codecvt_base::noconv:
|
|
||||||
__extbuf[0] = static_cast<char>(__last_consumed_);
|
|
||||||
__enxt = __extbuf + 1;
|
|
||||||
break;
|
|
||||||
case codecvt_base::partial:
|
|
||||||
case codecvt_base::error:
|
|
||||||
return traits_type::eof();
|
|
||||||
}
|
|
||||||
while (__enxt > __extbuf)
|
|
||||||
if (ungetc(*--__enxt, __file_) == EOF)
|
|
||||||
return traits_type::eof();
|
|
||||||
}
|
}
|
||||||
__last_consumed_ = __c;
|
while (__enxt > __extbuf)
|
||||||
__last_consumed_is_next_ = true;
|
if (ungetc(*--__enxt, __file_) == EOF)
|
||||||
return __c;
|
return traits_type::eof();
|
||||||
|
return traits_type::not_eof(__c);
|
||||||
}
|
}
|
||||||
|
|
||||||
// __stdoutbuf
|
// __stdoutbuf
|
||||||
@@ -229,18 +196,17 @@ public:
|
|||||||
typedef typename traits_type::off_type off_type;
|
typedef typename traits_type::off_type off_type;
|
||||||
typedef typename traits_type::state_type state_type;
|
typedef typename traits_type::state_type state_type;
|
||||||
|
|
||||||
__stdoutbuf(FILE* __fp, state_type* __st);
|
explicit __stdoutbuf(FILE* __fp);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int_type overflow (int_type __c = traits_type::eof());
|
virtual int_type overflow (int_type __c = traits_type::eof());
|
||||||
virtual streamsize xsputn(const char_type* __s, streamsize __n);
|
|
||||||
virtual int sync();
|
virtual int sync();
|
||||||
virtual void imbue(const locale& __loc);
|
virtual void imbue(const locale& __loc);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FILE* __file_;
|
FILE* __file_;
|
||||||
const codecvt<char_type, char, state_type>* __cv_;
|
const codecvt<char_type, char, state_type>* __cv_;
|
||||||
state_type* __st_;
|
state_type __st_;
|
||||||
bool __always_noconv_;
|
bool __always_noconv_;
|
||||||
|
|
||||||
__stdoutbuf(const __stdoutbuf&);
|
__stdoutbuf(const __stdoutbuf&);
|
||||||
@@ -248,10 +214,10 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class _CharT>
|
template <class _CharT>
|
||||||
__stdoutbuf<_CharT>::__stdoutbuf(FILE* __fp, state_type* __st)
|
__stdoutbuf<_CharT>::__stdoutbuf(FILE* __fp)
|
||||||
: __file_(__fp),
|
: __file_(__fp),
|
||||||
__cv_(&use_facet<codecvt<char_type, char, state_type> >(this->getloc())),
|
__cv_(&use_facet<codecvt<char_type, char, state_type> >(this->getloc())),
|
||||||
__st_(__st),
|
__st_(),
|
||||||
__always_noconv_(__cv_->always_noconv())
|
__always_noconv_(__cv_->always_noconv())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -264,30 +230,30 @@ __stdoutbuf<_CharT>::overflow(int_type __c)
|
|||||||
char_type __1buf;
|
char_type __1buf;
|
||||||
if (!traits_type::eq_int_type(__c, traits_type::eof()))
|
if (!traits_type::eq_int_type(__c, traits_type::eof()))
|
||||||
{
|
{
|
||||||
__1buf = traits_type::to_char_type(__c);
|
this->setp(&__1buf, &__1buf+1);
|
||||||
|
*this->pptr() = traits_type::to_char_type(__c);
|
||||||
|
this->pbump(1);
|
||||||
if (__always_noconv_)
|
if (__always_noconv_)
|
||||||
{
|
{
|
||||||
if (fwrite(&__1buf, sizeof(char_type), 1, __file_) != 1)
|
if (fwrite(this->pbase(), sizeof(char_type), 1, __file_) != 1)
|
||||||
return traits_type::eof();
|
return traits_type::eof();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char* __extbe = __extbuf;
|
char* __extbe = __extbuf;
|
||||||
codecvt_base::result __r;
|
codecvt_base::result __r;
|
||||||
char_type* pbase = &__1buf;
|
|
||||||
char_type* pptr = pbase + 1;
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
const char_type* __e;
|
const char_type* __e;
|
||||||
__r = __cv_->out(*__st_, pbase, pptr, __e,
|
__r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
|
||||||
__extbuf,
|
__extbuf,
|
||||||
__extbuf + sizeof(__extbuf),
|
__extbuf + sizeof(__extbuf),
|
||||||
__extbe);
|
__extbe);
|
||||||
if (__e == pbase)
|
if (__e == this->pbase())
|
||||||
return traits_type::eof();
|
return traits_type::eof();
|
||||||
if (__r == codecvt_base::noconv)
|
if (__r == codecvt_base::noconv)
|
||||||
{
|
{
|
||||||
if (fwrite(pbase, 1, 1, __file_) != 1)
|
if (fwrite(this->pbase(), 1, 1, __file_) != 1)
|
||||||
return traits_type::eof();
|
return traits_type::eof();
|
||||||
}
|
}
|
||||||
else if (__r == codecvt_base::ok || __r == codecvt_base::partial)
|
else if (__r == codecvt_base::ok || __r == codecvt_base::partial)
|
||||||
@@ -297,30 +263,19 @@ __stdoutbuf<_CharT>::overflow(int_type __c)
|
|||||||
return traits_type::eof();
|
return traits_type::eof();
|
||||||
if (__r == codecvt_base::partial)
|
if (__r == codecvt_base::partial)
|
||||||
{
|
{
|
||||||
pbase = (char_type*)__e;
|
this->setp((char_type*)__e, this->pptr());
|
||||||
|
this->pbump(this->epptr() - this->pbase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return traits_type::eof();
|
return traits_type::eof();
|
||||||
} while (__r == codecvt_base::partial);
|
} while (__r == codecvt_base::partial);
|
||||||
}
|
}
|
||||||
|
this->setp(0, 0);
|
||||||
}
|
}
|
||||||
return traits_type::not_eof(__c);
|
return traits_type::not_eof(__c);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _CharT>
|
|
||||||
streamsize
|
|
||||||
__stdoutbuf<_CharT>::xsputn(const char_type* __s, streamsize __n)
|
|
||||||
{
|
|
||||||
if (__always_noconv_)
|
|
||||||
return fwrite(__s, sizeof(char_type), __n, __file_);
|
|
||||||
streamsize __i = 0;
|
|
||||||
for (; __i < __n; ++__i, ++__s)
|
|
||||||
if (overflow(traits_type::to_int_type(*__s)) == traits_type::eof())
|
|
||||||
break;
|
|
||||||
return __i;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _CharT>
|
template <class _CharT>
|
||||||
int
|
int
|
||||||
__stdoutbuf<_CharT>::sync()
|
__stdoutbuf<_CharT>::sync()
|
||||||
@@ -330,7 +285,7 @@ __stdoutbuf<_CharT>::sync()
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
char* __extbe;
|
char* __extbe;
|
||||||
__r = __cv_->unshift(*__st_, __extbuf,
|
__r = __cv_->unshift(__st_, __extbuf,
|
||||||
__extbuf + sizeof(__extbuf),
|
__extbuf + sizeof(__extbuf),
|
||||||
__extbe);
|
__extbe);
|
||||||
size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);
|
size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);
|
||||||
|
|||||||
364
include/__tree
364
include/__tree
@@ -17,17 +17,23 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator> class __tree;
|
template <class _Tp, class _Compare, class _Allocator> class __tree;
|
||||||
template <class _Tp, class _NodePtr, class _DiffType>
|
template <class _Tp, class _NodePtr, class _DiffType>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY __tree_iterator;
|
class _LIBCPP_VISIBLE __tree_iterator;
|
||||||
template <class _Tp, class _ConstNodePtr, class _DiffType>
|
template <class _Tp, class _ConstNodePtr, class _DiffType>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY __tree_const_iterator;
|
class _LIBCPP_VISIBLE __tree_const_iterator;
|
||||||
|
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||||
|
class _LIBCPP_VISIBLE map;
|
||||||
|
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||||
|
class _LIBCPP_VISIBLE multimap;
|
||||||
|
template <class _Key, class _Compare, class _Allocator>
|
||||||
|
class _LIBCPP_VISIBLE set;
|
||||||
|
template <class _Key, class _Compare, class _Allocator>
|
||||||
|
class _LIBCPP_VISIBLE multiset;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@@ -514,9 +520,9 @@ public:
|
|||||||
bool __value_constructed;
|
bool __value_constructed;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
explicit __tree_node_destructor(allocator_type& __na, bool __val = false) _NOEXCEPT
|
explicit __tree_node_destructor(allocator_type& __na) _NOEXCEPT
|
||||||
: __na_(__na),
|
: __na_(__na),
|
||||||
__value_constructed(__val)
|
__value_constructed(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
@@ -606,14 +612,16 @@ public:
|
|||||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _TreeIterator> class _LIBCPP_TYPE_VIS_ONLY __map_iterator;
|
template <class _TreeIterator> class __map_iterator;
|
||||||
template <class _TreeIterator> class _LIBCPP_TYPE_VIS_ONLY __map_const_iterator;
|
template <class _TreeIterator> class __map_const_iterator;
|
||||||
|
|
||||||
template <class _Tp, class _NodePtr, class _DiffType>
|
template <class _Tp, class _NodePtr, class _DiffType>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY __tree_iterator
|
class _LIBCPP_VISIBLE __tree_iterator
|
||||||
{
|
{
|
||||||
typedef _NodePtr __node_pointer;
|
typedef _NodePtr __node_pointer;
|
||||||
typedef typename pointer_traits<__node_pointer>::element_type __node;
|
typedef typename pointer_traits<__node_pointer>::element_type __node;
|
||||||
|
typedef typename __node::base __node_base;
|
||||||
|
typedef typename __node_base::pointer __node_base_pointer;
|
||||||
|
|
||||||
__node_pointer __ptr_;
|
__node_pointer __ptr_;
|
||||||
|
|
||||||
@@ -631,32 +639,23 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
pointer;
|
pointer;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY __tree_iterator() _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY __tree_iterator() _NOEXCEPT {}
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
: __ptr_(nullptr)
|
|
||||||
#endif
|
|
||||||
{}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
|
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
|
||||||
_LIBCPP_INLINE_VISIBILITY pointer operator->() const
|
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;}
|
||||||
{return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__tree_iterator& operator++() {
|
__tree_iterator& operator++()
|
||||||
__ptr_ = static_cast<__node_pointer>(
|
{__ptr_ = static_cast<__node_pointer>(__tree_next(static_cast<__node_base_pointer>(__ptr_)));
|
||||||
__tree_next(static_cast<typename __node::base::pointer>(__ptr_)));
|
return *this;}
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__tree_iterator operator++(int)
|
__tree_iterator operator++(int)
|
||||||
{__tree_iterator __t(*this); ++(*this); return __t;}
|
{__tree_iterator __t(*this); ++(*this); return __t;}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__tree_iterator& operator--() {
|
__tree_iterator& operator--()
|
||||||
__ptr_ = static_cast<__node_pointer>(
|
{__ptr_ = static_cast<__node_pointer>(__tree_prev(static_cast<__node_base_pointer>(__ptr_)));
|
||||||
__tree_prev(static_cast<typename __node::base::pointer>(__ptr_)));
|
return *this;}
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__tree_iterator operator--(int)
|
__tree_iterator operator--(int)
|
||||||
{__tree_iterator __t(*this); --(*this); return __t;}
|
{__tree_iterator __t(*this); --(*this); return __t;}
|
||||||
@@ -672,19 +671,27 @@ private:
|
|||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
explicit __tree_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
|
explicit __tree_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
|
||||||
template <class, class, class> friend class __tree;
|
template <class, class, class> friend class __tree;
|
||||||
template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY __tree_const_iterator;
|
template <class, class, class> friend class _LIBCPP_VISIBLE __tree_const_iterator;
|
||||||
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __map_iterator;
|
template <class> friend class _LIBCPP_VISIBLE __map_iterator;
|
||||||
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY map;
|
template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
|
||||||
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multimap;
|
template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
|
||||||
template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY set;
|
template <class, class, class> friend class _LIBCPP_VISIBLE set;
|
||||||
template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multiset;
|
template <class, class, class> friend class _LIBCPP_VISIBLE multiset;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp, class _ConstNodePtr, class _DiffType>
|
template <class _Tp, class _ConstNodePtr, class _DiffType>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY __tree_const_iterator
|
class _LIBCPP_VISIBLE __tree_const_iterator
|
||||||
{
|
{
|
||||||
typedef _ConstNodePtr __node_pointer;
|
typedef _ConstNodePtr __node_pointer;
|
||||||
typedef typename pointer_traits<__node_pointer>::element_type __node;
|
typedef typename pointer_traits<__node_pointer>::element_type __node;
|
||||||
|
typedef const typename __node::base __node_base;
|
||||||
|
typedef typename pointer_traits<__node_pointer>::template
|
||||||
|
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
|
rebind<__node_base>
|
||||||
|
#else
|
||||||
|
rebind<__node_base>::other
|
||||||
|
#endif
|
||||||
|
__node_base_pointer;
|
||||||
|
|
||||||
__node_pointer __ptr_;
|
__node_pointer __ptr_;
|
||||||
|
|
||||||
@@ -702,12 +709,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
pointer;
|
pointer;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY __tree_const_iterator() _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY __tree_const_iterator() {}
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
: __ptr_(nullptr)
|
|
||||||
#endif
|
|
||||||
{}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef typename remove_const<__node>::type __non_const_node;
|
typedef typename remove_const<__node>::type __non_const_node;
|
||||||
typedef typename pointer_traits<__node_pointer>::template
|
typedef typename pointer_traits<__node_pointer>::template
|
||||||
@@ -725,43 +727,20 @@ public:
|
|||||||
: __ptr_(__p.__ptr_) {}
|
: __ptr_(__p.__ptr_) {}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
|
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
|
||||||
_LIBCPP_INLINE_VISIBILITY pointer operator->() const
|
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;}
|
||||||
{return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__tree_const_iterator& operator++() {
|
__tree_const_iterator& operator++()
|
||||||
typedef typename pointer_traits<__node_pointer>::template
|
{__ptr_ = static_cast<__node_pointer>(__tree_next(static_cast<__node_base_pointer>(__ptr_)));
|
||||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
return *this;}
|
||||||
rebind<typename __node::base>
|
|
||||||
#else
|
|
||||||
rebind<typename __node::base>::other
|
|
||||||
#endif
|
|
||||||
__node_base_pointer;
|
|
||||||
|
|
||||||
__ptr_ = static_cast<__node_pointer>(
|
|
||||||
__tree_next(static_cast<__node_base_pointer>(__ptr_)));
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__tree_const_iterator operator++(int)
|
__tree_const_iterator operator++(int)
|
||||||
{__tree_const_iterator __t(*this); ++(*this); return __t;}
|
{__tree_const_iterator __t(*this); ++(*this); return __t;}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__tree_const_iterator& operator--() {
|
__tree_const_iterator& operator--()
|
||||||
typedef typename pointer_traits<__node_pointer>::template
|
{__ptr_ = static_cast<__node_pointer>(__tree_prev(static_cast<__node_base_pointer>(__ptr_)));
|
||||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
return *this;}
|
||||||
rebind<typename __node::base>
|
|
||||||
#else
|
|
||||||
rebind<typename __node::base>::other
|
|
||||||
#endif
|
|
||||||
__node_base_pointer;
|
|
||||||
|
|
||||||
__ptr_ = static_cast<__node_pointer>(
|
|
||||||
__tree_prev(static_cast<__node_base_pointer>(__ptr_)));
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__tree_const_iterator operator--(int)
|
__tree_const_iterator operator--(int)
|
||||||
{__tree_const_iterator __t(*this); --(*this); return __t;}
|
{__tree_const_iterator __t(*this); --(*this); return __t;}
|
||||||
@@ -778,11 +757,11 @@ private:
|
|||||||
explicit __tree_const_iterator(__node_pointer __p) _NOEXCEPT
|
explicit __tree_const_iterator(__node_pointer __p) _NOEXCEPT
|
||||||
: __ptr_(__p) {}
|
: __ptr_(__p) {}
|
||||||
template <class, class, class> friend class __tree;
|
template <class, class, class> friend class __tree;
|
||||||
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY map;
|
template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
|
||||||
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multimap;
|
template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
|
||||||
template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY set;
|
template <class, class, class> friend class _LIBCPP_VISIBLE set;
|
||||||
template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multiset;
|
template <class, class, class> friend class _LIBCPP_VISIBLE multiset;
|
||||||
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __map_const_iterator;
|
template <class> friend class _LIBCPP_VISIBLE __map_const_iterator;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
@@ -798,16 +777,20 @@ public:
|
|||||||
typedef typename __alloc_traits::size_type size_type;
|
typedef typename __alloc_traits::size_type size_type;
|
||||||
typedef typename __alloc_traits::difference_type difference_type;
|
typedef typename __alloc_traits::difference_type difference_type;
|
||||||
|
|
||||||
typedef typename __alloc_traits::void_pointer __void_pointer;
|
typedef __tree_node<value_type, typename __alloc_traits::void_pointer> __node;
|
||||||
|
typedef __tree_node_base<typename __alloc_traits::void_pointer> __node_base;
|
||||||
typedef __tree_node<value_type, __void_pointer> __node;
|
typedef typename __alloc_traits::template
|
||||||
typedef __tree_node_base<__void_pointer> __node_base;
|
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
typedef typename __rebind_alloc_helper<__alloc_traits, __node>::type __node_allocator;
|
rebind_alloc<__node>
|
||||||
|
#else
|
||||||
|
rebind_alloc<__node>::other
|
||||||
|
#endif
|
||||||
|
__node_allocator;
|
||||||
typedef allocator_traits<__node_allocator> __node_traits;
|
typedef allocator_traits<__node_allocator> __node_traits;
|
||||||
typedef typename __node_traits::pointer __node_pointer;
|
typedef typename __node_traits::pointer __node_pointer;
|
||||||
typedef typename __node_traits::pointer __node_const_pointer;
|
typedef typename __node_traits::const_pointer __node_const_pointer;
|
||||||
typedef typename __node_base::pointer __node_base_pointer;
|
typedef typename __node_base::pointer __node_base_pointer;
|
||||||
typedef typename __node_base::pointer __node_base_const_pointer;
|
typedef typename __node_base::const_pointer __node_base_const_pointer;
|
||||||
private:
|
private:
|
||||||
typedef typename __node_base::base __end_node_t;
|
typedef typename __node_base::base __end_node_t;
|
||||||
typedef typename pointer_traits<__node_pointer>::template
|
typedef typename pointer_traits<__node_pointer>::template
|
||||||
@@ -819,9 +802,9 @@ private:
|
|||||||
__end_node_ptr;
|
__end_node_ptr;
|
||||||
typedef typename pointer_traits<__node_pointer>::template
|
typedef typename pointer_traits<__node_pointer>::template
|
||||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
rebind<__end_node_t>
|
rebind<const __end_node_t>
|
||||||
#else
|
#else
|
||||||
rebind<__end_node_t>::other
|
rebind<const __end_node_t>::other
|
||||||
#endif
|
#endif
|
||||||
__end_node_const_ptr;
|
__end_node_const_ptr;
|
||||||
|
|
||||||
@@ -843,7 +826,7 @@ public:
|
|||||||
{
|
{
|
||||||
return static_cast<__node_const_pointer>
|
return static_cast<__node_const_pointer>
|
||||||
(
|
(
|
||||||
pointer_traits<__end_node_const_ptr>::pointer_to(const_cast<__end_node_t&>(__pair1_.first()))
|
pointer_traits<__end_node_const_ptr>::pointer_to(__pair1_.first())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
@@ -880,7 +863,7 @@ public:
|
|||||||
{return static_cast<__node_const_pointer>(__end_node()->__left_);}
|
{return static_cast<__node_const_pointer>(__end_node()->__left_);}
|
||||||
|
|
||||||
typedef __tree_iterator<value_type, __node_pointer, difference_type> iterator;
|
typedef __tree_iterator<value_type, __node_pointer, difference_type> iterator;
|
||||||
typedef __tree_const_iterator<value_type, __node_pointer, difference_type> const_iterator;
|
typedef __tree_const_iterator<value_type, __node_const_pointer, difference_type> const_iterator;
|
||||||
|
|
||||||
explicit __tree(const value_compare& __comp)
|
explicit __tree(const value_compare& __comp)
|
||||||
_NOEXCEPT_(
|
_NOEXCEPT_(
|
||||||
@@ -926,12 +909,9 @@ public:
|
|||||||
|
|
||||||
void swap(__tree& __t)
|
void swap(__tree& __t)
|
||||||
_NOEXCEPT_(
|
_NOEXCEPT_(
|
||||||
__is_nothrow_swappable<value_compare>::value
|
__is_nothrow_swappable<value_compare>::value &&
|
||||||
#if _LIBCPP_STD_VER <= 11
|
(!__node_traits::propagate_on_container_swap::value ||
|
||||||
&& (!__node_traits::propagate_on_container_swap::value ||
|
__is_nothrow_swappable<__node_allocator>::value));
|
||||||
__is_nothrow_swappable<__node_allocator>::value)
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||||
@@ -950,14 +930,14 @@ public:
|
|||||||
__emplace_hint_multi(const_iterator __p, _Args&&... __args);
|
__emplace_hint_multi(const_iterator __p, _Args&&... __args);
|
||||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
template <class _Vp>
|
template <class _V>
|
||||||
pair<iterator, bool> __insert_unique(_Vp&& __v);
|
pair<iterator, bool> __insert_unique(_V&& __v);
|
||||||
template <class _Vp>
|
template <class _V>
|
||||||
iterator __insert_unique(const_iterator __p, _Vp&& __v);
|
iterator __insert_unique(const_iterator __p, _V&& __v);
|
||||||
template <class _Vp>
|
template <class _V>
|
||||||
iterator __insert_multi(_Vp&& __v);
|
iterator __insert_multi(_V&& __v);
|
||||||
template <class _Vp>
|
template <class _V>
|
||||||
iterator __insert_multi(const_iterator __p, _Vp&& __v);
|
iterator __insert_multi(const_iterator __p, _V&& __v);
|
||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
pair<iterator, bool> __insert_unique(const value_type& __v);
|
pair<iterator, bool> __insert_unique(const value_type& __v);
|
||||||
@@ -1039,8 +1019,8 @@ public:
|
|||||||
pair<const_iterator, const_iterator>
|
pair<const_iterator, const_iterator>
|
||||||
__equal_range_multi(const _Key& __k) const;
|
__equal_range_multi(const _Key& __k) const;
|
||||||
|
|
||||||
typedef __tree_node_destructor<__node_allocator> _Dp;
|
typedef __tree_node_destructor<__node_allocator> _D;
|
||||||
typedef unique_ptr<__node, _Dp> __node_holder;
|
typedef unique_ptr<__node, _D> __node_holder;
|
||||||
|
|
||||||
__node_holder remove(const_iterator __p) _NOEXCEPT;
|
__node_holder remove(const_iterator __p) _NOEXCEPT;
|
||||||
private:
|
private:
|
||||||
@@ -1099,11 +1079,27 @@ private:
|
|||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void __move_assign_alloc(__tree& __t, false_type) _NOEXCEPT {}
|
void __move_assign_alloc(__tree& __t, false_type) _NOEXCEPT {}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y)
|
||||||
|
_NOEXCEPT_(
|
||||||
|
!__node_traits::propagate_on_container_swap::value ||
|
||||||
|
__is_nothrow_swappable<__node_allocator>::value)
|
||||||
|
{__swap_alloc(__x, __y, integral_constant<bool,
|
||||||
|
__node_traits::propagate_on_container_swap::value>());}
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, true_type)
|
||||||
|
_NOEXCEPT_(__is_nothrow_swappable<__node_allocator>::value)
|
||||||
|
{
|
||||||
|
using _VSTD::swap;
|
||||||
|
swap(__x, __y);
|
||||||
|
}
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, false_type)
|
||||||
|
_NOEXCEPT
|
||||||
|
{}
|
||||||
|
|
||||||
__node_pointer __detach();
|
__node_pointer __detach();
|
||||||
static __node_pointer __detach(__node_pointer);
|
static __node_pointer __detach(__node_pointer);
|
||||||
|
|
||||||
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY map;
|
|
||||||
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multimap;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
@@ -1118,8 +1114,8 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp)
|
|||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
__tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a)
|
__tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a)
|
||||||
: __begin_node_(__node_pointer()),
|
: __pair1_(__node_allocator(__a)),
|
||||||
__pair1_(__node_allocator(__a)),
|
__begin_node_(__node_pointer()),
|
||||||
__pair3_(0)
|
__pair3_(0)
|
||||||
{
|
{
|
||||||
__begin_node() = __end_node();
|
__begin_node() = __end_node();
|
||||||
@@ -1128,8 +1124,8 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a)
|
|||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp,
|
__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp,
|
||||||
const allocator_type& __a)
|
const allocator_type& __a)
|
||||||
: __begin_node_(__node_pointer()),
|
: __pair1_(__node_allocator(__a)),
|
||||||
__pair1_(__node_allocator(__a)),
|
__begin_node_(__node_pointer()),
|
||||||
__pair3_(0, __comp)
|
__pair3_(0, __comp)
|
||||||
{
|
{
|
||||||
__begin_node() = __end_node();
|
__begin_node() = __end_node();
|
||||||
@@ -1163,7 +1159,7 @@ __tree<_Tp, _Compare, _Allocator>::__detach(__node_pointer __cache)
|
|||||||
{
|
{
|
||||||
if (__cache->__parent_ == nullptr)
|
if (__cache->__parent_ == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
if (__tree_is_left_child(static_cast<__node_base_pointer>(__cache)))
|
if (__tree_is_left_child(__cache))
|
||||||
{
|
{
|
||||||
__cache->__parent_->__left_ = nullptr;
|
__cache->__parent_->__left_ = nullptr;
|
||||||
__cache = static_cast<__node_pointer>(__cache->__parent_);
|
__cache = static_cast<__node_pointer>(__cache->__parent_);
|
||||||
@@ -1296,7 +1292,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
|
|||||||
__begin_node() = __end_node();
|
__begin_node() = __end_node();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__end_node());
|
__end_node()->__left_->__parent_ = __end_node();
|
||||||
__t.__begin_node() = __t.__end_node();
|
__t.__begin_node() = __t.__end_node();
|
||||||
__t.__end_node()->__left_ = nullptr;
|
__t.__end_node()->__left_ = nullptr;
|
||||||
__t.size() = 0;
|
__t.size() = 0;
|
||||||
@@ -1316,7 +1312,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __
|
|||||||
{
|
{
|
||||||
__begin_node() = __t.__begin_node();
|
__begin_node() = __t.__begin_node();
|
||||||
__end_node()->__left_ = __t.__end_node()->__left_;
|
__end_node()->__left_ = __t.__end_node()->__left_;
|
||||||
__end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__end_node());
|
__end_node()->__left_->__parent_ = __end_node();
|
||||||
size() = __t.size();
|
size() = __t.size();
|
||||||
__t.__begin_node() = __t.__end_node();
|
__t.__begin_node() = __t.__end_node();
|
||||||
__t.__end_node()->__left_ = nullptr;
|
__t.__end_node()->__left_ = nullptr;
|
||||||
@@ -1344,7 +1340,7 @@ __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type)
|
|||||||
__begin_node() = __end_node();
|
__begin_node() = __end_node();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__end_node());
|
__end_node()->__left_->__parent_ = __end_node();
|
||||||
__t.__begin_node() = __t.__end_node();
|
__t.__begin_node() = __t.__end_node();
|
||||||
__t.__end_node()->__left_ = nullptr;
|
__t.__end_node()->__left_ = nullptr;
|
||||||
__t.size() = 0;
|
__t.size() = 0;
|
||||||
@@ -1436,27 +1432,24 @@ __tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd) _NOEXCEPT
|
|||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
void
|
void
|
||||||
__tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
|
__tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
|
||||||
_NOEXCEPT_(
|
_NOEXCEPT_(
|
||||||
__is_nothrow_swappable<value_compare>::value
|
__is_nothrow_swappable<value_compare>::value &&
|
||||||
#if _LIBCPP_STD_VER <= 11
|
(!__node_traits::propagate_on_container_swap::value ||
|
||||||
&& (!__node_traits::propagate_on_container_swap::value ||
|
__is_nothrow_swappable<__node_allocator>::value))
|
||||||
__is_nothrow_swappable<__node_allocator>::value)
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
using _VSTD::swap;
|
using _VSTD::swap;
|
||||||
swap(__begin_node_, __t.__begin_node_);
|
swap(__begin_node_, __t.__begin_node_);
|
||||||
swap(__pair1_.first(), __t.__pair1_.first());
|
swap(__pair1_.first(), __t.__pair1_.first());
|
||||||
__swap_allocator(__node_alloc(), __t.__node_alloc());
|
__swap_alloc(__node_alloc(), __t.__node_alloc());
|
||||||
__pair3_.swap(__t.__pair3_);
|
__pair3_.swap(__t.__pair3_);
|
||||||
if (size() == 0)
|
if (size() == 0)
|
||||||
__begin_node() = __end_node();
|
__begin_node() = __end_node();
|
||||||
else
|
else
|
||||||
__end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__end_node());
|
__end_node()->__left_->__parent_ = __end_node();
|
||||||
if (__t.size() == 0)
|
if (__t.size() == 0)
|
||||||
__t.__begin_node() = __t.__end_node();
|
__t.__begin_node() = __t.__end_node();
|
||||||
else
|
else
|
||||||
__t.__end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__t.__end_node());
|
__t.__end_node()->__left_->__parent_ = __t.__end_node();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
@@ -1488,7 +1481,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node_base::pointer
|
|||||||
__nd = static_cast<__node_pointer>(__nd->__right_);
|
__nd = static_cast<__node_pointer>(__nd->__right_);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__parent = static_cast<__node_base_pointer>(__nd);
|
__parent = __nd;
|
||||||
return __parent->__right_;
|
return __parent->__right_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1498,13 +1491,13 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node_base::pointer
|
|||||||
__nd = static_cast<__node_pointer>(__nd->__left_);
|
__nd = static_cast<__node_pointer>(__nd->__left_);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__parent = static_cast<__node_base_pointer>(__nd);
|
__parent = __nd;
|
||||||
return __parent->__left_;
|
return __parent->__left_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
__parent = static_cast<__node_base_pointer>(__end_node());
|
__parent = __end_node();
|
||||||
return __parent->__left_;
|
return __parent->__left_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1527,7 +1520,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node_base::pointe
|
|||||||
__nd = static_cast<__node_pointer>(__nd->__left_);
|
__nd = static_cast<__node_pointer>(__nd->__left_);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__parent = static_cast<__node_base_pointer>(__nd);
|
__parent = __nd;
|
||||||
return __parent->__left_;
|
return __parent->__left_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1537,13 +1530,13 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node_base::pointe
|
|||||||
__nd = static_cast<__node_pointer>(__nd->__right_);
|
__nd = static_cast<__node_pointer>(__nd->__right_);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__parent = static_cast<__node_base_pointer>(__nd);
|
__parent = __nd;
|
||||||
return __parent->__right_;
|
return __parent->__right_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
__parent = static_cast<__node_base_pointer>(__end_node());
|
__parent = __end_node();
|
||||||
return __parent->__left_;
|
return __parent->__left_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1568,12 +1561,12 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf(const_iterator __hint,
|
|||||||
// *prev(__hint) <= __v <= *__hint
|
// *prev(__hint) <= __v <= *__hint
|
||||||
if (__hint.__ptr_->__left_ == nullptr)
|
if (__hint.__ptr_->__left_ == nullptr)
|
||||||
{
|
{
|
||||||
__parent = static_cast<__node_base_pointer>(__hint.__ptr_);
|
__parent = const_cast<__node_pointer&>(__hint.__ptr_);
|
||||||
return __parent->__left_;
|
return __parent->__left_;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__parent = static_cast<__node_base_pointer>(__prior.__ptr_);
|
__parent = const_cast<__node_pointer&>(__prior.__ptr_);
|
||||||
return __parent->__right_;
|
return __parent->__right_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1605,7 +1598,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node_base::pointer& _
|
|||||||
__nd = static_cast<__node_pointer>(__nd->__left_);
|
__nd = static_cast<__node_pointer>(__nd->__left_);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__parent = static_cast<__node_base_pointer>(__nd);
|
__parent = __nd;
|
||||||
return __parent->__left_;
|
return __parent->__left_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1615,18 +1608,18 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node_base::pointer& _
|
|||||||
__nd = static_cast<__node_pointer>(__nd->__right_);
|
__nd = static_cast<__node_pointer>(__nd->__right_);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__parent = static_cast<__node_base_pointer>(__nd);
|
__parent = __nd;
|
||||||
return __parent->__right_;
|
return __parent->__right_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__parent = static_cast<__node_base_pointer>(__nd);
|
__parent = __nd;
|
||||||
return __parent;
|
return __parent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
__parent = static_cast<__node_base_pointer>(__end_node());
|
__parent = __end_node();
|
||||||
return __parent->__left_;
|
return __parent->__left_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1653,12 +1646,12 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
|
|||||||
// *prev(__hint) < __v < *__hint
|
// *prev(__hint) < __v < *__hint
|
||||||
if (__hint.__ptr_->__left_ == nullptr)
|
if (__hint.__ptr_->__left_ == nullptr)
|
||||||
{
|
{
|
||||||
__parent = static_cast<__node_base_pointer>(__hint.__ptr_);
|
__parent = const_cast<__node_pointer&>(__hint.__ptr_);
|
||||||
return __parent->__left_;
|
return __parent->__left_;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__parent = static_cast<__node_base_pointer>(__prior.__ptr_);
|
__parent = const_cast<__node_pointer&>(__prior.__ptr_);
|
||||||
return __parent->__right_;
|
return __parent->__right_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1674,12 +1667,12 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
|
|||||||
// *__hint < __v < *_VSTD::next(__hint)
|
// *__hint < __v < *_VSTD::next(__hint)
|
||||||
if (__hint.__ptr_->__right_ == nullptr)
|
if (__hint.__ptr_->__right_ == nullptr)
|
||||||
{
|
{
|
||||||
__parent = static_cast<__node_base_pointer>(__hint.__ptr_);
|
__parent = const_cast<__node_pointer&>(__hint.__ptr_);
|
||||||
return __parent->__right_;
|
return __parent->__right_;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__parent = static_cast<__node_base_pointer>(__next.__ptr_);
|
__parent = const_cast<__node_pointer&>(__next.__ptr_);
|
||||||
return __parent->__left_;
|
return __parent->__left_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1687,7 +1680,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
|
|||||||
return __find_equal(__parent, __v);
|
return __find_equal(__parent, __v);
|
||||||
}
|
}
|
||||||
// else __v == *__hint
|
// else __v == *__hint
|
||||||
__parent = static_cast<__node_base_pointer>(__hint.__ptr_);
|
__parent = const_cast<__node_pointer&>(__hint.__ptr_);
|
||||||
return __parent;
|
return __parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1716,7 +1709,7 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_holder
|
|||||||
__tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&& ...__args)
|
__tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&& ...__args)
|
||||||
{
|
{
|
||||||
__node_allocator& __na = __node_alloc();
|
__node_allocator& __na = __node_alloc();
|
||||||
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...);
|
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...);
|
||||||
__h.get_deleter().__value_constructed = true;
|
__h.get_deleter().__value_constructed = true;
|
||||||
return __h;
|
return __h;
|
||||||
@@ -1734,7 +1727,7 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_unique(_Args&&... __args)
|
|||||||
bool __inserted = false;
|
bool __inserted = false;
|
||||||
if (__child == nullptr)
|
if (__child == nullptr)
|
||||||
{
|
{
|
||||||
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
__insert_node_at(__parent, __child, __h.get());
|
||||||
__r = __h.release();
|
__r = __h.release();
|
||||||
__inserted = true;
|
__inserted = true;
|
||||||
}
|
}
|
||||||
@@ -1752,7 +1745,7 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique(const_iterator __p, _Ar
|
|||||||
__node_pointer __r = static_cast<__node_pointer>(__child);
|
__node_pointer __r = static_cast<__node_pointer>(__child);
|
||||||
if (__child == nullptr)
|
if (__child == nullptr)
|
||||||
{
|
{
|
||||||
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
__insert_node_at(__parent, __child, __h.get());
|
||||||
__r = __h.release();
|
__r = __h.release();
|
||||||
}
|
}
|
||||||
return iterator(__r);
|
return iterator(__r);
|
||||||
@@ -1766,7 +1759,7 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_multi(_Args&&... __args)
|
|||||||
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
|
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
|
||||||
__node_base_pointer __parent;
|
__node_base_pointer __parent;
|
||||||
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
|
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
|
||||||
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
__insert_node_at(__parent, __child, __h.get());
|
||||||
return iterator(static_cast<__node_pointer>(__h.release()));
|
return iterator(static_cast<__node_pointer>(__h.release()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1779,18 +1772,18 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p,
|
|||||||
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
|
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
|
||||||
__node_base_pointer __parent;
|
__node_base_pointer __parent;
|
||||||
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
|
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
|
||||||
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
__insert_node_at(__parent, __child, __h.get());
|
||||||
return iterator(static_cast<__node_pointer>(__h.release()));
|
return iterator(static_cast<__node_pointer>(__h.release()));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
template <class _Vp>
|
template <class _V>
|
||||||
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
|
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
|
||||||
__tree<_Tp, _Compare, _Allocator>::__insert_unique(_Vp&& __v)
|
__tree<_Tp, _Compare, _Allocator>::__insert_unique(_V&& __v)
|
||||||
{
|
{
|
||||||
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
|
__node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
|
||||||
pair<iterator, bool> __r = __node_insert_unique(__h.get());
|
pair<iterator, bool> __r = __node_insert_unique(__h.get());
|
||||||
if (__r.second)
|
if (__r.second)
|
||||||
__h.release();
|
__h.release();
|
||||||
@@ -1798,11 +1791,11 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(_Vp&& __v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
template <class _Vp>
|
template <class _V>
|
||||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||||
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _Vp&& __v)
|
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _V&& __v)
|
||||||
{
|
{
|
||||||
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
|
__node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
|
||||||
iterator __r = __node_insert_unique(__p, __h.get());
|
iterator __r = __node_insert_unique(__p, __h.get());
|
||||||
if (__r.__ptr_ == __h.get())
|
if (__r.__ptr_ == __h.get())
|
||||||
__h.release();
|
__h.release();
|
||||||
@@ -1810,26 +1803,26 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _Vp&& __v
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
template <class _Vp>
|
template <class _V>
|
||||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||||
__tree<_Tp, _Compare, _Allocator>::__insert_multi(_Vp&& __v)
|
__tree<_Tp, _Compare, _Allocator>::__insert_multi(_V&& __v)
|
||||||
{
|
{
|
||||||
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
|
__node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
|
||||||
__node_base_pointer __parent;
|
__node_base_pointer __parent;
|
||||||
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
|
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
|
||||||
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
__insert_node_at(__parent, __child, __h.get());
|
||||||
return iterator(__h.release());
|
return iterator(__h.release());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
template <class _Vp>
|
template <class _V>
|
||||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||||
__tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, _Vp&& __v)
|
__tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, _V&& __v)
|
||||||
{
|
{
|
||||||
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
|
__node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
|
||||||
__node_base_pointer __parent;
|
__node_base_pointer __parent;
|
||||||
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
|
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
|
||||||
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
__insert_node_at(__parent, __child, __h.get());
|
||||||
return iterator(__h.release());
|
return iterator(__h.release());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1840,10 +1833,10 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_holder
|
|||||||
__tree<_Tp, _Compare, _Allocator>::__construct_node(const value_type& __v)
|
__tree<_Tp, _Compare, _Allocator>::__construct_node(const value_type& __v)
|
||||||
{
|
{
|
||||||
__node_allocator& __na = __node_alloc();
|
__node_allocator& __na = __node_alloc();
|
||||||
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
|
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
|
||||||
__h.get_deleter().__value_constructed = true;
|
__h.get_deleter().__value_constructed = true;
|
||||||
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
|
return _VSTD::move(__h);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
@@ -1859,7 +1852,7 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(const value_type& __v)
|
|||||||
if (__child == nullptr)
|
if (__child == nullptr)
|
||||||
{
|
{
|
||||||
__node_holder __h = __construct_node(__v);
|
__node_holder __h = __construct_node(__v);
|
||||||
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
__insert_node_at(__parent, __child, __h.get());
|
||||||
__r = __h.release();
|
__r = __h.release();
|
||||||
__inserted = true;
|
__inserted = true;
|
||||||
}
|
}
|
||||||
@@ -1876,7 +1869,7 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, const val
|
|||||||
if (__child == nullptr)
|
if (__child == nullptr)
|
||||||
{
|
{
|
||||||
__node_holder __h = __construct_node(__v);
|
__node_holder __h = __construct_node(__v);
|
||||||
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
__insert_node_at(__parent, __child, __h.get());
|
||||||
__r = __h.release();
|
__r = __h.release();
|
||||||
}
|
}
|
||||||
return iterator(__r);
|
return iterator(__r);
|
||||||
@@ -1889,7 +1882,7 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(const value_type& __v)
|
|||||||
__node_base_pointer __parent;
|
__node_base_pointer __parent;
|
||||||
__node_base_pointer& __child = __find_leaf_high(__parent, __v);
|
__node_base_pointer& __child = __find_leaf_high(__parent, __v);
|
||||||
__node_holder __h = __construct_node(__v);
|
__node_holder __h = __construct_node(__v);
|
||||||
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
__insert_node_at(__parent, __child, __h.get());
|
||||||
return iterator(__h.release());
|
return iterator(__h.release());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1900,7 +1893,7 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, const valu
|
|||||||
__node_base_pointer __parent;
|
__node_base_pointer __parent;
|
||||||
__node_base_pointer& __child = __find_leaf(__p, __parent, __v);
|
__node_base_pointer& __child = __find_leaf(__p, __parent, __v);
|
||||||
__node_holder __h = __construct_node(__v);
|
__node_holder __h = __construct_node(__v);
|
||||||
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
__insert_node_at(__parent, __child, __h.get());
|
||||||
return iterator(__h.release());
|
return iterator(__h.release());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1914,7 +1907,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_insert_unique(__node_pointer __nd)
|
|||||||
bool __inserted = false;
|
bool __inserted = false;
|
||||||
if (__child == nullptr)
|
if (__child == nullptr)
|
||||||
{
|
{
|
||||||
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
|
__insert_node_at(__parent, __child, __nd);
|
||||||
__r = __nd;
|
__r = __nd;
|
||||||
__inserted = true;
|
__inserted = true;
|
||||||
}
|
}
|
||||||
@@ -1931,7 +1924,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_insert_unique(const_iterator __p,
|
|||||||
__node_pointer __r = static_cast<__node_pointer>(__child);
|
__node_pointer __r = static_cast<__node_pointer>(__child);
|
||||||
if (__child == nullptr)
|
if (__child == nullptr)
|
||||||
{
|
{
|
||||||
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
|
__insert_node_at(__parent, __child, __nd);
|
||||||
__r = __nd;
|
__r = __nd;
|
||||||
}
|
}
|
||||||
return iterator(__r);
|
return iterator(__r);
|
||||||
@@ -1943,7 +1936,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_insert_multi(__node_pointer __nd)
|
|||||||
{
|
{
|
||||||
__node_base_pointer __parent;
|
__node_base_pointer __parent;
|
||||||
__node_base_pointer& __child = __find_leaf_high(__parent, __nd->__value_);
|
__node_base_pointer& __child = __find_leaf_high(__parent, __nd->__value_);
|
||||||
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
|
__insert_node_at(__parent, __child, __nd);
|
||||||
return iterator(__nd);
|
return iterator(__nd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1954,7 +1947,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_insert_multi(const_iterator __p,
|
|||||||
{
|
{
|
||||||
__node_base_pointer __parent;
|
__node_base_pointer __parent;
|
||||||
__node_base_pointer& __child = __find_leaf(__p, __parent, __nd->__value_);
|
__node_base_pointer& __child = __find_leaf(__p, __parent, __nd->__value_);
|
||||||
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
|
__insert_node_at(__parent, __child, __nd);
|
||||||
return iterator(__nd);
|
return iterator(__nd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1962,16 +1955,16 @@ template <class _Tp, class _Compare, class _Allocator>
|
|||||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||||
__tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p)
|
__tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p)
|
||||||
{
|
{
|
||||||
__node_pointer __np = __p.__ptr_;
|
__node_pointer __np = const_cast<__node_pointer>(__p.__ptr_);
|
||||||
iterator __r(__np);
|
iterator __r(__np);
|
||||||
++__r;
|
++__r;
|
||||||
if (__begin_node() == __np)
|
if (__begin_node() == __np)
|
||||||
__begin_node() = __r.__ptr_;
|
__begin_node() = __r.__ptr_;
|
||||||
--size();
|
--size();
|
||||||
__node_allocator& __na = __node_alloc();
|
__node_allocator& __na = __node_alloc();
|
||||||
|
__node_traits::destroy(__na, const_cast<value_type*>(_VSTD::addressof(*__p)));
|
||||||
__tree_remove(__end_node()->__left_,
|
__tree_remove(__end_node()->__left_,
|
||||||
static_cast<__node_base_pointer>(__np));
|
static_cast<__node_base_pointer>(__np));
|
||||||
__node_traits::destroy(__na, const_cast<value_type*>(_VSTD::addressof(*__p)));
|
|
||||||
__node_traits::deallocate(__na, __np, 1);
|
__node_traits::deallocate(__na, __np, 1);
|
||||||
return __r;
|
return __r;
|
||||||
}
|
}
|
||||||
@@ -1982,7 +1975,7 @@ __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __f, const_iterator __l)
|
|||||||
{
|
{
|
||||||
while (__f != __l)
|
while (__f != __l)
|
||||||
__f = erase(__f);
|
__f = erase(__f);
|
||||||
return iterator(__l.__ptr_);
|
return iterator(const_cast<__node_pointer>(__l.__ptr_));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
@@ -2058,6 +2051,7 @@ template <class _Key>
|
|||||||
typename __tree<_Tp, _Compare, _Allocator>::size_type
|
typename __tree<_Tp, _Compare, _Allocator>::size_type
|
||||||
__tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const
|
__tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const
|
||||||
{
|
{
|
||||||
|
typedef pair<const_iterator, const_iterator> _P;
|
||||||
__node_const_pointer __result = __end_node();
|
__node_const_pointer __result = __end_node();
|
||||||
__node_const_pointer __rt = __root();
|
__node_const_pointer __rt = __root();
|
||||||
while (__rt != nullptr)
|
while (__rt != nullptr)
|
||||||
@@ -2164,7 +2158,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::iterator,
|
|||||||
typename __tree<_Tp, _Compare, _Allocator>::iterator>
|
typename __tree<_Tp, _Compare, _Allocator>::iterator>
|
||||||
__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k)
|
__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k)
|
||||||
{
|
{
|
||||||
typedef pair<iterator, iterator> _Pp;
|
typedef pair<iterator, iterator> _P;
|
||||||
__node_pointer __result = __end_node();
|
__node_pointer __result = __end_node();
|
||||||
__node_pointer __rt = __root();
|
__node_pointer __rt = __root();
|
||||||
while (__rt != nullptr)
|
while (__rt != nullptr)
|
||||||
@@ -2177,13 +2171,13 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k)
|
|||||||
else if (value_comp()(__rt->__value_, __k))
|
else if (value_comp()(__rt->__value_, __k))
|
||||||
__rt = static_cast<__node_pointer>(__rt->__right_);
|
__rt = static_cast<__node_pointer>(__rt->__right_);
|
||||||
else
|
else
|
||||||
return _Pp(iterator(__rt),
|
return _P(iterator(__rt),
|
||||||
iterator(
|
iterator(
|
||||||
__rt->__right_ != nullptr ?
|
__rt->__right_ != nullptr ?
|
||||||
static_cast<__node_pointer>(__tree_min(__rt->__right_))
|
static_cast<__node_pointer>(__tree_min(__rt->__right_))
|
||||||
: __result));
|
: __result));
|
||||||
}
|
}
|
||||||
return _Pp(iterator(__result), iterator(__result));
|
return _P(iterator(__result), iterator(__result));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
@@ -2192,7 +2186,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
|
|||||||
typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
|
typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
|
||||||
__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const
|
__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const
|
||||||
{
|
{
|
||||||
typedef pair<const_iterator, const_iterator> _Pp;
|
typedef pair<const_iterator, const_iterator> _P;
|
||||||
__node_const_pointer __result = __end_node();
|
__node_const_pointer __result = __end_node();
|
||||||
__node_const_pointer __rt = __root();
|
__node_const_pointer __rt = __root();
|
||||||
while (__rt != nullptr)
|
while (__rt != nullptr)
|
||||||
@@ -2205,13 +2199,13 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const
|
|||||||
else if (value_comp()(__rt->__value_, __k))
|
else if (value_comp()(__rt->__value_, __k))
|
||||||
__rt = static_cast<__node_const_pointer>(__rt->__right_);
|
__rt = static_cast<__node_const_pointer>(__rt->__right_);
|
||||||
else
|
else
|
||||||
return _Pp(const_iterator(__rt),
|
return _P(const_iterator(__rt),
|
||||||
const_iterator(
|
const_iterator(
|
||||||
__rt->__right_ != nullptr ?
|
__rt->__right_ != nullptr ?
|
||||||
static_cast<__node_const_pointer>(__tree_min(__rt->__right_))
|
static_cast<__node_const_pointer>(__tree_min(__rt->__right_))
|
||||||
: __result));
|
: __result));
|
||||||
}
|
}
|
||||||
return _Pp(const_iterator(__result), const_iterator(__result));
|
return _P(const_iterator(__result), const_iterator(__result));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
@@ -2220,7 +2214,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::iterator,
|
|||||||
typename __tree<_Tp, _Compare, _Allocator>::iterator>
|
typename __tree<_Tp, _Compare, _Allocator>::iterator>
|
||||||
__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k)
|
__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k)
|
||||||
{
|
{
|
||||||
typedef pair<iterator, iterator> _Pp;
|
typedef pair<iterator, iterator> _P;
|
||||||
__node_pointer __result = __end_node();
|
__node_pointer __result = __end_node();
|
||||||
__node_pointer __rt = __root();
|
__node_pointer __rt = __root();
|
||||||
while (__rt != nullptr)
|
while (__rt != nullptr)
|
||||||
@@ -2233,10 +2227,10 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k)
|
|||||||
else if (value_comp()(__rt->__value_, __k))
|
else if (value_comp()(__rt->__value_, __k))
|
||||||
__rt = static_cast<__node_pointer>(__rt->__right_);
|
__rt = static_cast<__node_pointer>(__rt->__right_);
|
||||||
else
|
else
|
||||||
return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), __rt),
|
return _P(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), __rt),
|
||||||
__upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
|
__upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
|
||||||
}
|
}
|
||||||
return _Pp(iterator(__result), iterator(__result));
|
return _P(iterator(__result), iterator(__result));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
@@ -2245,7 +2239,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
|
|||||||
typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
|
typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
|
||||||
__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const
|
__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const
|
||||||
{
|
{
|
||||||
typedef pair<const_iterator, const_iterator> _Pp;
|
typedef pair<const_iterator, const_iterator> _P;
|
||||||
__node_const_pointer __result = __end_node();
|
__node_const_pointer __result = __end_node();
|
||||||
__node_const_pointer __rt = __root();
|
__node_const_pointer __rt = __root();
|
||||||
while (__rt != nullptr)
|
while (__rt != nullptr)
|
||||||
@@ -2258,17 +2252,17 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const
|
|||||||
else if (value_comp()(__rt->__value_, __k))
|
else if (value_comp()(__rt->__value_, __k))
|
||||||
__rt = static_cast<__node_const_pointer>(__rt->__right_);
|
__rt = static_cast<__node_const_pointer>(__rt->__right_);
|
||||||
else
|
else
|
||||||
return _Pp(__lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt),
|
return _P(__lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt),
|
||||||
__upper_bound(__k, static_cast<__node_const_pointer>(__rt->__right_), __result));
|
__upper_bound(__k, static_cast<__node_const_pointer>(__rt->__right_), __result));
|
||||||
}
|
}
|
||||||
return _Pp(const_iterator(__result), const_iterator(__result));
|
return _P(const_iterator(__result), const_iterator(__result));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
typename __tree<_Tp, _Compare, _Allocator>::__node_holder
|
typename __tree<_Tp, _Compare, _Allocator>::__node_holder
|
||||||
__tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT
|
__tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT
|
||||||
{
|
{
|
||||||
__node_pointer __np = __p.__ptr_;
|
__node_pointer __np = const_cast<__node_pointer>(__p.__ptr_);
|
||||||
if (__begin_node() == __np)
|
if (__begin_node() == __np)
|
||||||
{
|
{
|
||||||
if (__np->__right_ != nullptr)
|
if (__np->__right_ != nullptr)
|
||||||
@@ -2279,7 +2273,7 @@ __tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT
|
|||||||
--size();
|
--size();
|
||||||
__tree_remove(__end_node()->__left_,
|
__tree_remove(__end_node()->__left_,
|
||||||
static_cast<__node_base_pointer>(__np));
|
static_cast<__node_base_pointer>(__np));
|
||||||
return __node_holder(__np, _Dp(__node_alloc(), true));
|
return __node_holder(__np, _D(__node_alloc()));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Compare, class _Allocator>
|
template <class _Tp, class _Compare, class _Allocator>
|
||||||
|
|||||||
176
include/__tuple
176
include/__tuple
@@ -15,142 +15,103 @@
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#ifdef _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
|
#include <__tuple_03>
|
||||||
|
|
||||||
|
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY tuple_size;
|
template <class _Tp> class _LIBCPP_VISIBLE tuple_size;
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY tuple_size<const _Tp>
|
class _LIBCPP_VISIBLE tuple_size<const _Tp>
|
||||||
: public tuple_size<_Tp> {};
|
: public tuple_size<_Tp> {};
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY tuple_size<volatile _Tp>
|
class _LIBCPP_VISIBLE tuple_size<volatile _Tp>
|
||||||
: public tuple_size<_Tp> {};
|
: public tuple_size<_Tp> {};
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY tuple_size<const volatile _Tp>
|
class _LIBCPP_VISIBLE tuple_size<const volatile _Tp>
|
||||||
: public tuple_size<_Tp> {};
|
: public tuple_size<_Tp> {};
|
||||||
|
|
||||||
template <size_t _Ip, class _Tp> class _LIBCPP_TYPE_VIS_ONLY tuple_element;
|
template <size_t _Ip, class _Tp> class _LIBCPP_VISIBLE tuple_element;
|
||||||
|
|
||||||
template <size_t _Ip, class _Tp>
|
template <size_t _Ip, class _Tp>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, const _Tp>
|
class _LIBCPP_VISIBLE tuple_element<_Ip, const _Tp>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type;
|
typedef typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <size_t _Ip, class _Tp>
|
template <size_t _Ip, class _Tp>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, volatile _Tp>
|
class _LIBCPP_VISIBLE tuple_element<_Ip, volatile _Tp>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type;
|
typedef typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <size_t _Ip, class _Tp>
|
template <size_t _Ip, class _Tp>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, const volatile _Tp>
|
class _LIBCPP_VISIBLE tuple_element<_Ip, const volatile _Tp>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
|
typedef typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class ..._Tp> class _LIBCPP_VISIBLE tuple;
|
||||||
|
template <class _T1, class _T2> class _LIBCPP_VISIBLE pair;
|
||||||
|
template <class _Tp, size_t _Size> struct _LIBCPP_VISIBLE array;
|
||||||
|
|
||||||
template <class _Tp> struct __tuple_like : false_type {};
|
template <class _Tp> struct __tuple_like : false_type {};
|
||||||
|
|
||||||
template <class _Tp> struct __tuple_like<const _Tp> : public __tuple_like<_Tp> {};
|
template <class _Tp> struct __tuple_like<const _Tp> : public __tuple_like<_Tp> {};
|
||||||
template <class _Tp> struct __tuple_like<volatile _Tp> : public __tuple_like<_Tp> {};
|
template <class _Tp> struct __tuple_like<volatile _Tp> : public __tuple_like<_Tp> {};
|
||||||
template <class _Tp> struct __tuple_like<const volatile _Tp> : public __tuple_like<_Tp> {};
|
template <class _Tp> struct __tuple_like<const volatile _Tp> : public __tuple_like<_Tp> {};
|
||||||
|
|
||||||
// tuple specializations
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_VARIADICS)
|
|
||||||
template <class ..._Tp> class _LIBCPP_TYPE_VIS_ONLY tuple;
|
|
||||||
|
|
||||||
template <class... _Tp> struct __tuple_like<tuple<_Tp...> > : true_type {};
|
template <class... _Tp> struct __tuple_like<tuple<_Tp...> > : true_type {};
|
||||||
|
template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type {};
|
||||||
|
template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {};
|
||||||
|
|
||||||
template <size_t _Ip, class ..._Tp>
|
template <size_t _Ip, class ..._Tp>
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
|
||||||
typename tuple_element<_Ip, tuple<_Tp...> >::type&
|
typename tuple_element<_Ip, tuple<_Tp...> >::type&
|
||||||
get(tuple<_Tp...>&) _NOEXCEPT;
|
get(tuple<_Tp...>&) _NOEXCEPT;
|
||||||
|
|
||||||
template <size_t _Ip, class ..._Tp>
|
template <size_t _Ip, class ..._Tp>
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
|
||||||
const typename tuple_element<_Ip, tuple<_Tp...> >::type&
|
const typename tuple_element<_Ip, tuple<_Tp...> >::type&
|
||||||
get(const tuple<_Tp...>&) _NOEXCEPT;
|
get(const tuple<_Tp...>&) _NOEXCEPT;
|
||||||
|
|
||||||
template <size_t _Ip, class ..._Tp>
|
template <size_t _Ip, class ..._Tp>
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
|
||||||
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
|
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
|
||||||
get(tuple<_Tp...>&&) _NOEXCEPT;
|
get(tuple<_Tp...>&&) _NOEXCEPT;
|
||||||
|
|
||||||
template <size_t _Ip, class ..._Tp>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
|
||||||
const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
|
|
||||||
get(const tuple<_Tp...>&&) _NOEXCEPT;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// pair specializations
|
|
||||||
|
|
||||||
template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY pair;
|
|
||||||
|
|
||||||
template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type {};
|
|
||||||
|
|
||||||
template <size_t _Ip, class _T1, class _T2>
|
template <size_t _Ip, class _T1, class _T2>
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
|
||||||
typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
||||||
get(pair<_T1, _T2>&) _NOEXCEPT;
|
get(pair<_T1, _T2>&) _NOEXCEPT;
|
||||||
|
|
||||||
template <size_t _Ip, class _T1, class _T2>
|
template <size_t _Ip, class _T1, class _T2>
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
|
||||||
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
||||||
get(const pair<_T1, _T2>&) _NOEXCEPT;
|
get(const pair<_T1, _T2>&) _NOEXCEPT;
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
|
||||||
template <size_t _Ip, class _T1, class _T2>
|
template <size_t _Ip, class _T1, class _T2>
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
|
||||||
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
|
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
|
||||||
get(pair<_T1, _T2>&&) _NOEXCEPT;
|
get(pair<_T1, _T2>&&) _NOEXCEPT;
|
||||||
|
|
||||||
template <size_t _Ip, class _T1, class _T2>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
|
||||||
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
|
|
||||||
get(const pair<_T1, _T2>&&) _NOEXCEPT;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// array specializations
|
|
||||||
|
|
||||||
template <class _Tp, size_t _Size> struct _LIBCPP_TYPE_VIS_ONLY array;
|
|
||||||
|
|
||||||
template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {};
|
|
||||||
|
|
||||||
template <size_t _Ip, class _Tp, size_t _Size>
|
template <size_t _Ip, class _Tp, size_t _Size>
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
|
||||||
_Tp&
|
_Tp&
|
||||||
get(array<_Tp, _Size>&) _NOEXCEPT;
|
get(array<_Tp, _Size>&) _NOEXCEPT;
|
||||||
|
|
||||||
template <size_t _Ip, class _Tp, size_t _Size>
|
template <size_t _Ip, class _Tp, size_t _Size>
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
|
||||||
const _Tp&
|
const _Tp&
|
||||||
get(const array<_Tp, _Size>&) _NOEXCEPT;
|
get(const array<_Tp, _Size>&) _NOEXCEPT;
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
|
||||||
template <size_t _Ip, class _Tp, size_t _Size>
|
template <size_t _Ip, class _Tp, size_t _Size>
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
|
||||||
_Tp&&
|
_Tp&&
|
||||||
get(array<_Tp, _Size>&&) _NOEXCEPT;
|
get(array<_Tp, _Size>&&) _NOEXCEPT;
|
||||||
|
|
||||||
template <size_t _Ip, class _Tp, size_t _Size>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
|
||||||
const _Tp&&
|
|
||||||
get(const array<_Tp, _Size>&&) _NOEXCEPT;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_VARIADICS)
|
|
||||||
|
|
||||||
// __make_tuple_indices
|
// __make_tuple_indices
|
||||||
|
|
||||||
template <size_t...> struct __tuple_indices {};
|
template <size_t...> struct __tuple_indices {};
|
||||||
@@ -182,7 +143,7 @@ struct __make_tuple_indices
|
|||||||
template <class ..._Tp> struct __tuple_types {};
|
template <class ..._Tp> struct __tuple_types {};
|
||||||
|
|
||||||
template <size_t _Ip>
|
template <size_t _Ip>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, __tuple_types<> >
|
class _LIBCPP_VISIBLE tuple_element<_Ip, __tuple_types<> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static_assert(_Ip == 0, "tuple_element index out of range");
|
static_assert(_Ip == 0, "tuple_element index out of range");
|
||||||
@@ -190,21 +151,21 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class _Hp, class ..._Tp>
|
template <class _Hp, class ..._Tp>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY tuple_element<0, __tuple_types<_Hp, _Tp...> >
|
class _LIBCPP_VISIBLE tuple_element<0, __tuple_types<_Hp, _Tp...> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef _Hp type;
|
typedef _Hp type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <size_t _Ip, class _Hp, class ..._Tp>
|
template <size_t _Ip, class _Hp, class ..._Tp>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, __tuple_types<_Hp, _Tp...> >
|
class _LIBCPP_VISIBLE tuple_element<_Ip, __tuple_types<_Hp, _Tp...> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename tuple_element<_Ip-1, __tuple_types<_Tp...> >::type type;
|
typedef typename tuple_element<_Ip-1, __tuple_types<_Tp...> >::type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class ..._Tp>
|
template <class ..._Tp>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY tuple_size<__tuple_types<_Tp...> >
|
class _LIBCPP_VISIBLE tuple_size<__tuple_types<_Tp...> >
|
||||||
: public integral_constant<size_t, sizeof...(_Tp)>
|
: public integral_constant<size_t, sizeof...(_Tp)>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
@@ -247,30 +208,19 @@ struct __make_tuple_types
|
|||||||
|
|
||||||
// __tuple_convertible
|
// __tuple_convertible
|
||||||
|
|
||||||
template <class, class>
|
template <bool, class _Tp, class _Up>
|
||||||
struct __tuple_convertible_imp : public false_type {};
|
struct __tuple_convertible_imp : public false_type {};
|
||||||
|
|
||||||
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
|
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
|
||||||
struct __tuple_convertible_imp<__tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
struct __tuple_convertible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
||||||
: public integral_constant<bool,
|
: public integral_constant<bool,
|
||||||
is_convertible<_Tp0, _Up0>::value &&
|
is_constructible<_Up0, _Tp0>::value &&
|
||||||
__tuple_convertible_imp<__tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
__tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct __tuple_convertible_imp<__tuple_types<>, __tuple_types<> >
|
struct __tuple_convertible_imp<true, __tuple_types<>, __tuple_types<> >
|
||||||
: public true_type {};
|
: public true_type {};
|
||||||
|
|
||||||
template <bool, class, class>
|
|
||||||
struct __tuple_convertible_apply : public false_type {};
|
|
||||||
|
|
||||||
template <class _Tp, class _Up>
|
|
||||||
struct __tuple_convertible_apply<true, _Tp, _Up>
|
|
||||||
: public __tuple_convertible_imp<
|
|
||||||
typename __make_tuple_types<_Tp>::type
|
|
||||||
, typename __make_tuple_types<_Up>::type
|
|
||||||
>
|
|
||||||
{};
|
|
||||||
|
|
||||||
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
|
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
|
||||||
bool = __tuple_like<_Up>::value>
|
bool = __tuple_like<_Up>::value>
|
||||||
struct __tuple_convertible
|
struct __tuple_convertible
|
||||||
@@ -278,73 +228,26 @@ struct __tuple_convertible
|
|||||||
|
|
||||||
template <class _Tp, class _Up>
|
template <class _Tp, class _Up>
|
||||||
struct __tuple_convertible<_Tp, _Up, true, true>
|
struct __tuple_convertible<_Tp, _Up, true, true>
|
||||||
: public __tuple_convertible_apply<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
: public __tuple_convertible_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
||||||
tuple_size<_Up>::value, _Tp, _Up>
|
tuple_size<_Up>::value,
|
||||||
{};
|
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
|
||||||
|
|
||||||
// __tuple_constructible
|
|
||||||
|
|
||||||
template <class, class>
|
|
||||||
struct __tuple_constructible_imp : public false_type {};
|
|
||||||
|
|
||||||
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
|
|
||||||
struct __tuple_constructible_imp<__tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
|
||||||
: public integral_constant<bool,
|
|
||||||
is_constructible<_Up0, _Tp0>::value &&
|
|
||||||
__tuple_constructible_imp<__tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct __tuple_constructible_imp<__tuple_types<>, __tuple_types<> >
|
|
||||||
: public true_type {};
|
|
||||||
|
|
||||||
template <bool _SameSize, class, class>
|
|
||||||
struct __tuple_constructible_apply : public false_type {};
|
|
||||||
|
|
||||||
template <class _Tp, class _Up>
|
|
||||||
struct __tuple_constructible_apply<true, _Tp, _Up>
|
|
||||||
: public __tuple_constructible_imp<
|
|
||||||
typename __make_tuple_types<_Tp>::type
|
|
||||||
, typename __make_tuple_types<_Up>::type
|
|
||||||
>
|
|
||||||
{};
|
|
||||||
|
|
||||||
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
|
|
||||||
bool = __tuple_like<_Up>::value>
|
|
||||||
struct __tuple_constructible
|
|
||||||
: public false_type {};
|
|
||||||
|
|
||||||
template <class _Tp, class _Up>
|
|
||||||
struct __tuple_constructible<_Tp, _Up, true, true>
|
|
||||||
: public __tuple_constructible_apply<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
|
||||||
tuple_size<_Up>::value, _Tp, _Up>
|
|
||||||
{};
|
{};
|
||||||
|
|
||||||
// __tuple_assignable
|
// __tuple_assignable
|
||||||
|
|
||||||
template <class, class>
|
template <bool, class _Tp, class _Up>
|
||||||
struct __tuple_assignable_imp : public false_type {};
|
struct __tuple_assignable_imp : public false_type {};
|
||||||
|
|
||||||
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
|
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
|
||||||
struct __tuple_assignable_imp<__tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
struct __tuple_assignable_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
||||||
: public integral_constant<bool,
|
: public integral_constant<bool,
|
||||||
is_assignable<_Up0&, _Tp0>::value &&
|
is_assignable<_Up0&, _Tp0>::value &&
|
||||||
__tuple_assignable_imp<__tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
__tuple_assignable_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct __tuple_assignable_imp<__tuple_types<>, __tuple_types<> >
|
struct __tuple_assignable_imp<true, __tuple_types<>, __tuple_types<> >
|
||||||
: public true_type {};
|
: public true_type {};
|
||||||
|
|
||||||
template <bool, class, class>
|
|
||||||
struct __tuple_assignable_apply : public false_type {};
|
|
||||||
|
|
||||||
template <class _Tp, class _Up>
|
|
||||||
struct __tuple_assignable_apply<true, _Tp, _Up>
|
|
||||||
: __tuple_assignable_imp<
|
|
||||||
typename __make_tuple_types<_Tp>::type
|
|
||||||
, typename __make_tuple_types<_Up>::type
|
|
||||||
>
|
|
||||||
{};
|
|
||||||
|
|
||||||
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
|
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
|
||||||
bool = __tuple_like<_Up>::value>
|
bool = __tuple_like<_Up>::value>
|
||||||
struct __tuple_assignable
|
struct __tuple_assignable
|
||||||
@@ -352,12 +255,13 @@ struct __tuple_assignable
|
|||||||
|
|
||||||
template <class _Tp, class _Up>
|
template <class _Tp, class _Up>
|
||||||
struct __tuple_assignable<_Tp, _Up, true, true>
|
struct __tuple_assignable<_Tp, _Up, true, true>
|
||||||
: public __tuple_assignable_apply<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
: public __tuple_assignable_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
||||||
tuple_size<_Up>::value, _Tp, _Up>
|
tuple_size<_Up>::value,
|
||||||
|
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
|
||||||
{};
|
{};
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
|
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
#endif // _LIBCPP___TUPLE
|
#endif // _LIBCPP___TUPLE
|
||||||
|
|||||||
25
include/__tuple_03
Normal file
25
include/__tuple_03
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
// -*- 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.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef _LIBCPP___TUPLE_03
|
||||||
|
#define _LIBCPP___TUPLE_03
|
||||||
|
|
||||||
|
#include <__config>
|
||||||
|
|
||||||
|
#pragma GCC system_header
|
||||||
|
|
||||||
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
|
template <class _Tp> class _LIBCPP_VISIBLE tuple_size;
|
||||||
|
template <size_t _Ip, class _Tp> class _LIBCPP_VISIBLE tuple_element;
|
||||||
|
|
||||||
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
|
#endif // _LIBCPP___TUPLE_03
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
// -*- 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.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
#ifdef __deallocate
|
|
||||||
#if defined(_MSC_VER) && !defined(__clang__)
|
|
||||||
_LIBCPP_WARNING("macro __deallocate is incompatible with C++. #undefining __deallocate")
|
|
||||||
#else
|
|
||||||
#warning: macro __deallocate is incompatible with C++. #undefining __deallocate
|
|
||||||
#endif
|
|
||||||
#undef __deallocate
|
|
||||||
#endif
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
// -*- 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.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
#ifdef min
|
|
||||||
#if defined(_MSC_VER) && ! defined(__clang__)
|
|
||||||
_LIBCPP_WARNING("macro min is incompatible with C++. Try #define NOMINMAX "
|
|
||||||
"before any Windows header. #undefing min")
|
|
||||||
#else
|
|
||||||
#warning: macro min is incompatible with C++. #undefing min
|
|
||||||
#endif
|
|
||||||
#undef min
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef max
|
|
||||||
#if defined(_MSC_VER) && ! defined(__clang__)
|
|
||||||
_LIBCPP_WARNING("macro max is incompatible with C++. Try #define NOMINMAX "
|
|
||||||
"before any Windows header. #undefing max")
|
|
||||||
#else
|
|
||||||
#warning: macro max is incompatible with C++. #undefing max
|
|
||||||
#endif
|
|
||||||
#undef max
|
|
||||||
#endif
|
|
||||||
1199
include/algorithm
1199
include/algorithm
File diff suppressed because it is too large
Load Diff
@@ -55,18 +55,18 @@ struct array
|
|||||||
// capacity:
|
// capacity:
|
||||||
constexpr size_type size() const noexcept;
|
constexpr size_type size() const noexcept;
|
||||||
constexpr size_type max_size() const noexcept;
|
constexpr size_type max_size() const noexcept;
|
||||||
constexpr bool empty() const noexcept;
|
bool empty() const noexcept;
|
||||||
|
|
||||||
// element access:
|
// element access:
|
||||||
reference operator[](size_type n);
|
reference operator[](size_type n);
|
||||||
const_reference operator[](size_type n) const; // constexpr in C++14
|
const_reference operator[](size_type n) const;
|
||||||
const_reference at(size_type n) const; // constexpr in C++14
|
const_reference at(size_type n) const;
|
||||||
reference at(size_type n);
|
reference at(size_type n);
|
||||||
|
|
||||||
reference front();
|
reference front();
|
||||||
const_reference front() const; // constexpr in C++14
|
const_reference front() const;
|
||||||
reference back();
|
reference back();
|
||||||
const_reference back() const; // constexpr in C++14
|
const_reference back() const;
|
||||||
|
|
||||||
T* data() noexcept;
|
T* data() noexcept;
|
||||||
const T* data() const noexcept;
|
const T* data() const noexcept;
|
||||||
@@ -89,13 +89,12 @@ template <class T, size_t N >
|
|||||||
void swap(array<T,N>& x, array<T,N>& y) noexcept(noexcept(x.swap(y)));
|
void swap(array<T,N>& x, array<T,N>& y) noexcept(noexcept(x.swap(y)));
|
||||||
|
|
||||||
template <class T> class tuple_size;
|
template <class T> class tuple_size;
|
||||||
template <size_t I, class T> class tuple_element;
|
template <int I, class T> class tuple_element;
|
||||||
template <class T, size_t N> struct tuple_size<array<T, N>>;
|
template <class T, size_t N> struct tuple_size<array<T, N>>;
|
||||||
template <size_t I, class T, size_t N> struct tuple_element<I, array<T, N>>;
|
template <int I, class T, size_t N> struct tuple_element<I, array<T, N>>;
|
||||||
template <size_t I, class T, size_t N> T& get(array<T, N>&) noexcept; // constexpr in C++14
|
template <int I, class T, size_t N> T& get(array<T, N>&) noexcept;
|
||||||
template <size_t I, class T, size_t N> const T& get(const array<T, N>&) noexcept; // constexpr in C++14
|
template <int I, class T, size_t N> const T& get(const array<T, N>&) noexcept;
|
||||||
template <size_t I, class T, size_t N> T&& get(array<T, N>&&) noexcept; // constexpr in C++14
|
template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept;
|
||||||
template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexcept; // constexpr in C++14
|
|
||||||
|
|
||||||
} // std
|
} // std
|
||||||
|
|
||||||
@@ -112,14 +111,12 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
template <class _Tp, size_t _Size>
|
template <class _Tp, size_t _Size>
|
||||||
struct _LIBCPP_TYPE_VIS_ONLY array
|
struct _LIBCPP_VISIBLE array
|
||||||
{
|
{
|
||||||
// types:
|
// types:
|
||||||
typedef array __self;
|
typedef array __self;
|
||||||
@@ -174,22 +171,22 @@ struct _LIBCPP_TYPE_VIS_ONLY array
|
|||||||
|
|
||||||
// capacity:
|
// capacity:
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT {return _Size;}
|
/*constexpr*/ size_type size() const _NOEXCEPT {return _Size;}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return _Size;}
|
/*constexpr*/ size_type max_size() const _NOEXCEPT {return _Size;}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;}
|
bool empty() const _NOEXCEPT {return _Size == 0;}
|
||||||
|
|
||||||
// element access:
|
// element access:
|
||||||
_LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];}
|
_LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];}
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference operator[](size_type __n) const {return __elems_[__n];}
|
_LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const {return __elems_[__n];}
|
||||||
reference at(size_type __n);
|
reference at(size_type __n);
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference at(size_type __n) const;
|
const_reference at(size_type __n) const;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY reference front() {return __elems_[0];}
|
_LIBCPP_INLINE_VISIBILITY reference front() {return __elems_[0];}
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference front() const {return __elems_[0];}
|
_LIBCPP_INLINE_VISIBILITY const_reference front() const {return __elems_[0];}
|
||||||
_LIBCPP_INLINE_VISIBILITY reference back() {return __elems_[_Size > 0 ? _Size-1 : 0];}
|
_LIBCPP_INLINE_VISIBILITY reference back() {return __elems_[_Size > 0 ? _Size-1 : 0];}
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];}
|
_LIBCPP_INLINE_VISIBILITY const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
value_type* data() _NOEXCEPT {return __elems_;}
|
value_type* data() _NOEXCEPT {return __elems_;}
|
||||||
@@ -211,7 +208,6 @@ array<_Tp, _Size>::at(size_type __n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, size_t _Size>
|
template <class _Tp, size_t _Size>
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
|
||||||
typename array<_Tp, _Size>::const_reference
|
typename array<_Tp, _Size>::const_reference
|
||||||
array<_Tp, _Size>::at(size_type __n) const
|
array<_Tp, _Size>::at(size_type __n) const
|
||||||
{
|
{
|
||||||
@@ -225,7 +221,7 @@ array<_Tp, _Size>::at(size_type __n) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, size_t _Size>
|
template <class _Tp, size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
bool
|
bool
|
||||||
operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||||
{
|
{
|
||||||
@@ -233,7 +229,7 @@ operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, size_t _Size>
|
template <class _Tp, size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
bool
|
bool
|
||||||
operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||||
{
|
{
|
||||||
@@ -241,7 +237,7 @@ operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, size_t _Size>
|
template <class _Tp, size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
bool
|
bool
|
||||||
operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||||
{
|
{
|
||||||
@@ -249,7 +245,7 @@ operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, size_t _Size>
|
template <class _Tp, size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
bool
|
bool
|
||||||
operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||||
{
|
{
|
||||||
@@ -257,7 +253,7 @@ operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, size_t _Size>
|
template <class _Tp, size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
bool
|
bool
|
||||||
operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||||
{
|
{
|
||||||
@@ -265,7 +261,7 @@ operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, size_t _Size>
|
template <class _Tp, size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
bool
|
bool
|
||||||
operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||||
{
|
{
|
||||||
@@ -273,7 +269,7 @@ operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, size_t _Size>
|
template <class _Tp, size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
__is_swappable<_Tp>::value,
|
__is_swappable<_Tp>::value,
|
||||||
@@ -286,52 +282,51 @@ swap(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, size_t _Size>
|
template <class _Tp, size_t _Size>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY tuple_size<array<_Tp, _Size> >
|
class _LIBCPP_VISIBLE tuple_size<array<_Tp, _Size> >
|
||||||
|
: public integral_constant<size_t, _Size> {};
|
||||||
|
|
||||||
|
template <class _Tp, size_t _Size>
|
||||||
|
class _LIBCPP_VISIBLE tuple_size<const array<_Tp, _Size> >
|
||||||
: public integral_constant<size_t, _Size> {};
|
: public integral_constant<size_t, _Size> {};
|
||||||
|
|
||||||
template <size_t _Ip, class _Tp, size_t _Size>
|
template <size_t _Ip, class _Tp, size_t _Size>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, array<_Tp, _Size> >
|
class _LIBCPP_VISIBLE tuple_element<_Ip, array<_Tp, _Size> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef _Tp type;
|
typedef _Tp type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <size_t _Ip, class _Tp, size_t _Size>
|
template <size_t _Ip, class _Tp, size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
class _LIBCPP_VISIBLE tuple_element<_Ip, const array<_Tp, _Size> >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef const _Tp type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <size_t _Ip, class _Tp, size_t _Size>
|
||||||
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
_Tp&
|
_Tp&
|
||||||
get(array<_Tp, _Size>& __a) _NOEXCEPT
|
get(array<_Tp, _Size>& __a) _NOEXCEPT
|
||||||
{
|
{
|
||||||
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array)");
|
return __a[_Ip];
|
||||||
return __a.__elems_[_Ip];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Ip, class _Tp, size_t _Size>
|
template <size_t _Ip, class _Tp, size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
const _Tp&
|
const _Tp&
|
||||||
get(const array<_Tp, _Size>& __a) _NOEXCEPT
|
get(const array<_Tp, _Size>& __a) _NOEXCEPT
|
||||||
{
|
{
|
||||||
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array)");
|
return __a[_Ip];
|
||||||
return __a.__elems_[_Ip];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
template <size_t _Ip, class _Tp, size_t _Size>
|
template <size_t _Ip, class _Tp, size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
_Tp&&
|
_Tp&&
|
||||||
get(array<_Tp, _Size>&& __a) _NOEXCEPT
|
get(array<_Tp, _Size>&& __a) _NOEXCEPT
|
||||||
{
|
{
|
||||||
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array &&)");
|
return _VSTD::move(__a[_Ip]);
|
||||||
return _VSTD::move(__a.__elems_[_Ip]);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <size_t _Ip, class _Tp, size_t _Size>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
|
||||||
const _Tp&&
|
|
||||||
get(const array<_Tp, _Size>&& __a) _NOEXCEPT
|
|
||||||
{
|
|
||||||
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array &&)");
|
|
||||||
return _VSTD::move(__a.__elems_[_Ip]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|||||||
1046
include/atomic
1046
include/atomic
File diff suppressed because it is too large
Load Diff
225
include/bitset
225
include/bitset
@@ -113,9 +113,7 @@ template <size_t N> struct hash<std::bitset<N>>;
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <__config>
|
#include <__config>
|
||||||
#include <__bit_reference>
|
#include <__bit_reference>
|
||||||
@@ -129,8 +127,6 @@ template <size_t N> struct hash<std::bitset<N>>;
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <__undef_min_max>
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
template <size_t _N_words, size_t _Size>
|
template <size_t _N_words, size_t _Size>
|
||||||
@@ -148,9 +144,9 @@ class __bitset
|
|||||||
public:
|
public:
|
||||||
typedef ptrdiff_t difference_type;
|
typedef ptrdiff_t difference_type;
|
||||||
typedef size_t size_type;
|
typedef size_t size_type;
|
||||||
typedef size_type __storage_type;
|
|
||||||
protected:
|
protected:
|
||||||
typedef __bitset __self;
|
typedef __bitset __self;
|
||||||
|
typedef size_type __storage_type;
|
||||||
typedef __storage_type* __storage_pointer;
|
typedef __storage_type* __storage_pointer;
|
||||||
typedef const __storage_type* __const_storage_pointer;
|
typedef const __storage_type* __const_storage_pointer;
|
||||||
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
|
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
|
||||||
@@ -159,7 +155,7 @@ protected:
|
|||||||
friend class __bit_const_reference<__bitset>;
|
friend class __bit_const_reference<__bitset>;
|
||||||
friend class __bit_iterator<__bitset, false>;
|
friend class __bit_iterator<__bitset, false>;
|
||||||
friend class __bit_iterator<__bitset, true>;
|
friend class __bit_iterator<__bitset, true>;
|
||||||
friend struct __bit_array<__bitset>;
|
friend class __bit_array<__bitset>;
|
||||||
|
|
||||||
__storage_type __first_[_N_words];
|
__storage_type __first_[_N_words];
|
||||||
|
|
||||||
@@ -168,25 +164,20 @@ protected:
|
|||||||
typedef __bit_iterator<__bitset, false> iterator;
|
typedef __bit_iterator<__bitset, false> iterator;
|
||||||
typedef __bit_iterator<__bitset, true> const_iterator;
|
typedef __bit_iterator<__bitset, true> const_iterator;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
__bitset() _NOEXCEPT;
|
||||||
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
|
explicit __bitset(unsigned long long __v) _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
|
||||||
{return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
|
{return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const _NOEXCEPT
|
||||||
{return const_reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
|
{return const_reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
|
||||||
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
|
||||||
{return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
{return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
||||||
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
|
||||||
{return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
{return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
void operator&=(const __bitset& __v) _NOEXCEPT;
|
void operator&=(const __bitset& __v) _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
void operator|=(const __bitset& __v) _NOEXCEPT;
|
void operator|=(const __bitset& __v) _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
void operator^=(const __bitset& __v) _NOEXCEPT;
|
void operator^=(const __bitset& __v) _NOEXCEPT;
|
||||||
|
|
||||||
void flip() _NOEXCEPT;
|
void flip() _NOEXCEPT;
|
||||||
@@ -197,43 +188,28 @@ protected:
|
|||||||
|
|
||||||
bool all() const _NOEXCEPT;
|
bool all() const _NOEXCEPT;
|
||||||
bool any() const _NOEXCEPT;
|
bool any() const _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_t __hash_code() const _NOEXCEPT;
|
size_t __hash_code() const _NOEXCEPT;
|
||||||
private:
|
private:
|
||||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
|
||||||
void __init(unsigned long long __v, false_type) _NOEXCEPT;
|
void __init(unsigned long long __v, false_type) _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
void __init(unsigned long long __v, true_type) _NOEXCEPT;
|
void __init(unsigned long long __v, true_type) _NOEXCEPT;
|
||||||
#endif // _LIBCPP_HAS_NO_CONSTEXPR
|
|
||||||
unsigned long to_ulong(false_type) const;
|
unsigned long to_ulong(false_type) const;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
unsigned long to_ulong(true_type) const;
|
unsigned long to_ulong(true_type) const;
|
||||||
unsigned long long to_ullong(false_type) const;
|
unsigned long long to_ullong(false_type) const;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
unsigned long long to_ullong(true_type) const;
|
unsigned long long to_ullong(true_type) const;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
unsigned long long to_ullong(true_type, false_type) const;
|
unsigned long long to_ullong(true_type, false_type) const;
|
||||||
unsigned long long to_ullong(true_type, true_type) const;
|
unsigned long long to_ullong(true_type, true_type) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <size_t _N_words, size_t _Size>
|
template <size_t _N_words, size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
__bitset<_N_words, _Size>::__bitset() _NOEXCEPT
|
__bitset<_N_words, _Size>::__bitset() _NOEXCEPT
|
||||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
|
||||||
: __first_{0}
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
|
||||||
_VSTD::fill_n(__first_, _N_words, __storage_type(0));
|
_VSTD::fill_n(__first_, _N_words, __storage_type(0));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
|
||||||
|
|
||||||
template <size_t _N_words, size_t _Size>
|
template <size_t _N_words, size_t _Size>
|
||||||
void
|
void
|
||||||
__bitset<_N_words, _Size>::__init(unsigned long long __v, false_type) _NOEXCEPT
|
__bitset<_N_words, _Size>::__init(unsigned long long __v, false_type)
|
||||||
{
|
{
|
||||||
__storage_type __t[sizeof(unsigned long long) / sizeof(__storage_type)];
|
__storage_type __t[sizeof(unsigned long long) / sizeof(__storage_type)];
|
||||||
for (size_t __i = 0; __i < sizeof(__t)/sizeof(__t[0]); ++__i, __v >>= __bits_per_word)
|
for (size_t __i = 0; __i < sizeof(__t)/sizeof(__t[0]); ++__i, __v >>= __bits_per_word)
|
||||||
@@ -246,35 +222,21 @@ __bitset<_N_words, _Size>::__init(unsigned long long __v, false_type) _NOEXCEPT
|
|||||||
template <size_t _N_words, size_t _Size>
|
template <size_t _N_words, size_t _Size>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
__bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT
|
__bitset<_N_words, _Size>::__init(unsigned long long __v, true_type)
|
||||||
{
|
{
|
||||||
__first_[0] = __v;
|
__first_[0] = __v;
|
||||||
_VSTD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0));
|
_VSTD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_CONSTEXPR
|
|
||||||
|
|
||||||
template <size_t _N_words, size_t _Size>
|
template <size_t _N_words, size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
__bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
|
__bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
|
||||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
|
||||||
#if __SIZEOF_SIZE_T__ == 8
|
|
||||||
: __first_{__v}
|
|
||||||
#elif __SIZEOF_SIZE_T__ == 4
|
|
||||||
: __first_{__v, __v >> __bits_per_word}
|
|
||||||
#else
|
|
||||||
#error This constructor has not been ported to this platform
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
|
||||||
__init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>());
|
__init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _N_words, size_t _Size>
|
template <size_t _N_words, size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
__bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
|
__bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -283,7 +245,7 @@ __bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _N_words, size_t _Size>
|
template <size_t _N_words, size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
__bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
|
__bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -292,7 +254,7 @@ __bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _N_words, size_t _Size>
|
template <size_t _N_words, size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
__bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
|
__bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -335,7 +297,7 @@ __bitset<_N_words, _Size>::to_ulong(false_type) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _N_words, size_t _Size>
|
template <size_t _N_words, size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
unsigned long
|
unsigned long
|
||||||
__bitset<_N_words, _Size>::to_ulong(true_type) const
|
__bitset<_N_words, _Size>::to_ulong(true_type) const
|
||||||
{
|
{
|
||||||
@@ -358,7 +320,7 @@ __bitset<_N_words, _Size>::to_ullong(false_type) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _N_words, size_t _Size>
|
template <size_t _N_words, size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
unsigned long long
|
unsigned long long
|
||||||
__bitset<_N_words, _Size>::to_ullong(true_type) const
|
__bitset<_N_words, _Size>::to_ullong(true_type) const
|
||||||
{
|
{
|
||||||
@@ -366,7 +328,7 @@ __bitset<_N_words, _Size>::to_ullong(true_type) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _N_words, size_t _Size>
|
template <size_t _N_words, size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
unsigned long long
|
unsigned long long
|
||||||
__bitset<_N_words, _Size>::to_ullong(true_type, false_type) const
|
__bitset<_N_words, _Size>::to_ullong(true_type, false_type) const
|
||||||
{
|
{
|
||||||
@@ -424,7 +386,7 @@ __bitset<_N_words, _Size>::any() const _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _N_words, size_t _Size>
|
template <size_t _N_words, size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
size_t
|
size_t
|
||||||
__bitset<_N_words, _Size>::__hash_code() const _NOEXCEPT
|
__bitset<_N_words, _Size>::__hash_code() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -440,9 +402,9 @@ class __bitset<1, _Size>
|
|||||||
public:
|
public:
|
||||||
typedef ptrdiff_t difference_type;
|
typedef ptrdiff_t difference_type;
|
||||||
typedef size_t size_type;
|
typedef size_t size_type;
|
||||||
typedef size_type __storage_type;
|
|
||||||
protected:
|
protected:
|
||||||
typedef __bitset __self;
|
typedef __bitset __self;
|
||||||
|
typedef size_type __storage_type;
|
||||||
typedef __storage_type* __storage_pointer;
|
typedef __storage_type* __storage_pointer;
|
||||||
typedef const __storage_type* __const_storage_pointer;
|
typedef const __storage_type* __const_storage_pointer;
|
||||||
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
|
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
|
||||||
@@ -451,7 +413,7 @@ protected:
|
|||||||
friend class __bit_const_reference<__bitset>;
|
friend class __bit_const_reference<__bitset>;
|
||||||
friend class __bit_iterator<__bitset, false>;
|
friend class __bit_iterator<__bitset, false>;
|
||||||
friend class __bit_iterator<__bitset, true>;
|
friend class __bit_iterator<__bitset, true>;
|
||||||
friend struct __bit_array<__bitset>;
|
friend class __bit_array<__bitset>;
|
||||||
|
|
||||||
__storage_type __first_;
|
__storage_type __first_;
|
||||||
|
|
||||||
@@ -460,62 +422,49 @@ protected:
|
|||||||
typedef __bit_iterator<__bitset, false> iterator;
|
typedef __bit_iterator<__bitset, false> iterator;
|
||||||
typedef __bit_iterator<__bitset, true> const_iterator;
|
typedef __bit_iterator<__bitset, true> const_iterator;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
__bitset() _NOEXCEPT;
|
||||||
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
|
explicit __bitset(unsigned long long __v) _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
|
||||||
{return reference(&__first_, __storage_type(1) << __pos);}
|
{return reference(&__first_, __storage_type(1) << __pos);}
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const _NOEXCEPT
|
||||||
{return const_reference(&__first_, __storage_type(1) << __pos);}
|
{return const_reference(&__first_, __storage_type(1) << __pos);}
|
||||||
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
|
||||||
{return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
{return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
||||||
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
|
||||||
{return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
{return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
void operator&=(const __bitset& __v) _NOEXCEPT;
|
void operator&=(const __bitset& __v) _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
void operator|=(const __bitset& __v) _NOEXCEPT;
|
void operator|=(const __bitset& __v) _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
void operator^=(const __bitset& __v) _NOEXCEPT;
|
void operator^=(const __bitset& __v) _NOEXCEPT;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
void flip() _NOEXCEPT;
|
void flip() _NOEXCEPT;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
unsigned long to_ulong() const;
|
unsigned long to_ulong() const;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
unsigned long long to_ullong() const;
|
unsigned long long to_ullong() const;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool all() const _NOEXCEPT;
|
bool all() const _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool any() const _NOEXCEPT;
|
bool any() const _NOEXCEPT;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_t __hash_code() const _NOEXCEPT;
|
size_t __hash_code() const _NOEXCEPT;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
__bitset<1, _Size>::__bitset() _NOEXCEPT
|
__bitset<1, _Size>::__bitset() _NOEXCEPT
|
||||||
: __first_(0)
|
: __first_(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
__bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
|
__bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
|
||||||
: __first_(static_cast<__storage_type>(__v))
|
: __first_(static_cast<__storage_type>(__v))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
__bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
|
__bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -523,7 +472,7 @@ __bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
__bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
|
__bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -531,7 +480,7 @@ __bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
__bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
|
__bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -539,7 +488,7 @@ __bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
__bitset<1, _Size>::flip() _NOEXCEPT
|
__bitset<1, _Size>::flip() _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -549,7 +498,7 @@ __bitset<1, _Size>::flip() _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
unsigned long
|
unsigned long
|
||||||
__bitset<1, _Size>::to_ulong() const
|
__bitset<1, _Size>::to_ulong() const
|
||||||
{
|
{
|
||||||
@@ -557,7 +506,7 @@ __bitset<1, _Size>::to_ulong() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
unsigned long long
|
unsigned long long
|
||||||
__bitset<1, _Size>::to_ullong() const
|
__bitset<1, _Size>::to_ullong() const
|
||||||
{
|
{
|
||||||
@@ -565,7 +514,7 @@ __bitset<1, _Size>::to_ullong() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
__bitset<1, _Size>::all() const _NOEXCEPT
|
__bitset<1, _Size>::all() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -574,7 +523,7 @@ __bitset<1, _Size>::all() const _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
__bitset<1, _Size>::any() const _NOEXCEPT
|
__bitset<1, _Size>::any() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -583,7 +532,7 @@ __bitset<1, _Size>::any() const _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
size_t
|
size_t
|
||||||
__bitset<1, _Size>::__hash_code() const _NOEXCEPT
|
__bitset<1, _Size>::__hash_code() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -596,9 +545,9 @@ class __bitset<0, 0>
|
|||||||
public:
|
public:
|
||||||
typedef ptrdiff_t difference_type;
|
typedef ptrdiff_t difference_type;
|
||||||
typedef size_t size_type;
|
typedef size_t size_type;
|
||||||
typedef size_type __storage_type;
|
|
||||||
protected:
|
protected:
|
||||||
typedef __bitset __self;
|
typedef __bitset __self;
|
||||||
|
typedef size_type __storage_type;
|
||||||
typedef __storage_type* __storage_pointer;
|
typedef __storage_type* __storage_pointer;
|
||||||
typedef const __storage_type* __const_storage_pointer;
|
typedef const __storage_type* __const_storage_pointer;
|
||||||
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
|
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
|
||||||
@@ -607,25 +556,23 @@ protected:
|
|||||||
friend class __bit_const_reference<__bitset>;
|
friend class __bit_const_reference<__bitset>;
|
||||||
friend class __bit_iterator<__bitset, false>;
|
friend class __bit_iterator<__bitset, false>;
|
||||||
friend class __bit_iterator<__bitset, true>;
|
friend class __bit_iterator<__bitset, true>;
|
||||||
friend struct __bit_array<__bitset>;
|
friend class __bit_array<__bitset>;
|
||||||
|
|
||||||
typedef __bit_reference<__bitset> reference;
|
typedef __bit_reference<__bitset> reference;
|
||||||
typedef __bit_const_reference<__bitset> const_reference;
|
typedef __bit_const_reference<__bitset> const_reference;
|
||||||
typedef __bit_iterator<__bitset, false> iterator;
|
typedef __bit_iterator<__bitset, false> iterator;
|
||||||
typedef __bit_iterator<__bitset, true> const_iterator;
|
typedef __bit_iterator<__bitset, true> const_iterator;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
__bitset() _NOEXCEPT;
|
||||||
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
|
explicit __bitset(unsigned long long) _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT;
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT
|
||||||
{return reference(0, 1);}
|
{return reference(0, 1);}
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t) const _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t) const _NOEXCEPT
|
||||||
{return const_reference(0, 1);}
|
{return const_reference(0, 1);}
|
||||||
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t) _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
|
||||||
{return iterator(0, 0);}
|
{return iterator(0, 0);}
|
||||||
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t) const _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
|
||||||
{return const_iterator(0, 0);}
|
{return const_iterator(0, 0);}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {}
|
_LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {}
|
||||||
@@ -643,26 +590,23 @@ protected:
|
|||||||
_LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT {return 0;}
|
_LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT {return 0;}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
__bitset<0, 0>::__bitset() _NOEXCEPT
|
__bitset<0, 0>::__bitset() _NOEXCEPT
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
__bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT
|
__bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size> class _LIBCPP_TYPE_VIS_ONLY bitset;
|
template <size_t _Size> class bitset;
|
||||||
template <size_t _Size> struct _LIBCPP_TYPE_VIS_ONLY hash<bitset<_Size> >;
|
template <size_t _Size> struct hash<bitset<_Size> >;
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY bitset
|
class _LIBCPP_VISIBLE bitset
|
||||||
: private __bitset<_Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1, _Size>
|
: private __bitset<_Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1, _Size>
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
static const unsigned __n_words = _Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1;
|
static const unsigned __n_words = _Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1;
|
||||||
typedef __bitset<__n_words, _Size> base;
|
typedef __bitset<__n_words, _Size> base;
|
||||||
|
|
||||||
@@ -671,9 +615,8 @@ public:
|
|||||||
typedef typename base::const_reference const_reference;
|
typedef typename base::const_reference const_reference;
|
||||||
|
|
||||||
// 23.3.5.1 constructors:
|
// 23.3.5.1 constructors:
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bitset() _NOEXCEPT {}
|
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset() _NOEXCEPT {}
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
|
||||||
bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
|
|
||||||
template<class _CharT>
|
template<class _CharT>
|
||||||
explicit bitset(const _CharT* __str,
|
explicit bitset(const _CharT* __str,
|
||||||
typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,
|
typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,
|
||||||
@@ -686,64 +629,44 @@ public:
|
|||||||
_CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
|
_CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
|
||||||
|
|
||||||
// 23.3.5.2 bitset operations:
|
// 23.3.5.2 bitset operations:
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
bitset& operator&=(const bitset& __rhs) _NOEXCEPT;
|
bitset& operator&=(const bitset& __rhs) _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
bitset& operator|=(const bitset& __rhs) _NOEXCEPT;
|
bitset& operator|=(const bitset& __rhs) _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
bitset& operator^=(const bitset& __rhs) _NOEXCEPT;
|
bitset& operator^=(const bitset& __rhs) _NOEXCEPT;
|
||||||
bitset& operator<<=(size_t __pos) _NOEXCEPT;
|
bitset& operator<<=(size_t __pos) _NOEXCEPT;
|
||||||
bitset& operator>>=(size_t __pos) _NOEXCEPT;
|
bitset& operator>>=(size_t __pos) _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
bitset& set() _NOEXCEPT;
|
bitset& set() _NOEXCEPT;
|
||||||
bitset& set(size_t __pos, bool __val = true);
|
bitset& set(size_t __pos, bool __val = true);
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
bitset& reset() _NOEXCEPT;
|
bitset& reset() _NOEXCEPT;
|
||||||
bitset& reset(size_t __pos);
|
bitset& reset(size_t __pos);
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
bitset operator~() const _NOEXCEPT;
|
bitset operator~() const _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
bitset& flip() _NOEXCEPT;
|
bitset& flip() _NOEXCEPT;
|
||||||
bitset& flip(size_t __pos);
|
bitset& flip(size_t __pos);
|
||||||
|
|
||||||
// element access:
|
// element access:
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
_LIBCPP_INLINE_VISIBILITY const_reference operator[](size_t __p) const {return base::__make_ref(__p);}
|
||||||
const_reference operator[](size_t __p) const {return base::__make_ref(__p);}
|
|
||||||
_LIBCPP_INLINE_VISIBILITY reference operator[](size_t __p) {return base::__make_ref(__p);}
|
_LIBCPP_INLINE_VISIBILITY reference operator[](size_t __p) {return base::__make_ref(__p);}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
unsigned long to_ulong() const;
|
unsigned long to_ulong() const;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
unsigned long long to_ullong() const;
|
unsigned long long to_ullong() const;
|
||||||
template <class _CharT, class _Traits, class _Allocator>
|
template <class _CharT, class _Traits, class _Allocator>
|
||||||
basic_string<_CharT, _Traits, _Allocator> to_string(_CharT __zero = _CharT('0'),
|
basic_string<_CharT, _Traits, _Allocator> to_string(_CharT __zero = _CharT('0'),
|
||||||
_CharT __one = _CharT('1')) const;
|
_CharT __one = _CharT('1')) const;
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
basic_string<_CharT, _Traits, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
|
basic_string<_CharT, _Traits, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
|
||||||
_CharT __one = _CharT('1')) const;
|
_CharT __one = _CharT('1')) const;
|
||||||
template <class _CharT>
|
template <class _CharT>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
|
basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
|
||||||
_CharT __one = _CharT('1')) const;
|
_CharT __one = _CharT('1')) const;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0',
|
basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0',
|
||||||
char __one = '1') const;
|
char __one = '1') const;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_t count() const _NOEXCEPT;
|
size_t count() const _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR size_t size() const _NOEXCEPT {return _Size;}
|
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY size_t size() const _NOEXCEPT {return _Size;}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool operator==(const bitset& __rhs) const _NOEXCEPT;
|
bool operator==(const bitset& __rhs) const _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool operator!=(const bitset& __rhs) const _NOEXCEPT;
|
bool operator!=(const bitset& __rhs) const _NOEXCEPT;
|
||||||
bool test(size_t __pos) const;
|
bool test(size_t __pos) const;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool all() const _NOEXCEPT;
|
bool all() const _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool any() const _NOEXCEPT;
|
bool any() const _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY bool none() const _NOEXCEPT {return !any();}
|
_LIBCPP_INLINE_VISIBILITY bool none() const _NOEXCEPT {return !any();}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
bitset operator<<(size_t __pos) const _NOEXCEPT;
|
bitset operator<<(size_t __pos) const _NOEXCEPT;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
bitset operator>>(size_t __pos) const _NOEXCEPT;
|
bitset operator>>(size_t __pos) const _NOEXCEPT;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -768,11 +691,11 @@ bitset<_Size>::bitset(const _CharT* __str,
|
|||||||
#else
|
#else
|
||||||
assert(!"bitset string ctor has invalid argument");
|
assert(!"bitset string ctor has invalid argument");
|
||||||
#endif
|
#endif
|
||||||
size_t _Mp = _VSTD::min(__rlen, _Size);
|
size_t _M = _VSTD::min(__rlen, _Size);
|
||||||
size_t __i = 0;
|
size_t __i = 0;
|
||||||
for (; __i < _Mp; ++__i)
|
for (; __i < _M; ++__i)
|
||||||
{
|
{
|
||||||
_CharT __c = __str[_Mp - 1 - __i];
|
_CharT __c = __str[_M - 1 - __i];
|
||||||
if (__c == __zero)
|
if (__c == __zero)
|
||||||
(*this)[__i] = false;
|
(*this)[__i] = false;
|
||||||
else
|
else
|
||||||
@@ -802,11 +725,11 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
|
|||||||
#else
|
#else
|
||||||
assert(!"bitset string ctor has invalid argument");
|
assert(!"bitset string ctor has invalid argument");
|
||||||
#endif
|
#endif
|
||||||
size_t _Mp = _VSTD::min(__rlen, _Size);
|
size_t _M = _VSTD::min(__rlen, _Size);
|
||||||
size_t __i = 0;
|
size_t __i = 0;
|
||||||
for (; __i < _Mp; ++__i)
|
for (; __i < _M; ++__i)
|
||||||
{
|
{
|
||||||
_CharT __c = __str[__pos + _Mp - 1 - __i];
|
_CharT __c = __str[__pos + _M - 1 - __i];
|
||||||
if (_Traits::eq(__c, __zero))
|
if (_Traits::eq(__c, __zero))
|
||||||
(*this)[__i] = false;
|
(*this)[__i] = false;
|
||||||
else
|
else
|
||||||
@@ -816,7 +739,7 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bitset<_Size>&
|
bitset<_Size>&
|
||||||
bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT
|
bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -825,7 +748,7 @@ bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bitset<_Size>&
|
bitset<_Size>&
|
||||||
bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT
|
bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -834,7 +757,7 @@ bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bitset<_Size>&
|
bitset<_Size>&
|
||||||
bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT
|
bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -863,7 +786,7 @@ bitset<_Size>::operator>>=(size_t __pos) _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bitset<_Size>&
|
bitset<_Size>&
|
||||||
bitset<_Size>::set() _NOEXCEPT
|
bitset<_Size>::set() _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -886,7 +809,7 @@ bitset<_Size>::set(size_t __pos, bool __val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bitset<_Size>&
|
bitset<_Size>&
|
||||||
bitset<_Size>::reset() _NOEXCEPT
|
bitset<_Size>::reset() _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -909,7 +832,7 @@ bitset<_Size>::reset(size_t __pos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bitset<_Size>
|
bitset<_Size>
|
||||||
bitset<_Size>::operator~() const _NOEXCEPT
|
bitset<_Size>::operator~() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -919,7 +842,7 @@ bitset<_Size>::operator~() const _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bitset<_Size>&
|
bitset<_Size>&
|
||||||
bitset<_Size>::flip() _NOEXCEPT
|
bitset<_Size>::flip() _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -943,7 +866,7 @@ bitset<_Size>::flip(size_t __pos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
unsigned long
|
unsigned long
|
||||||
bitset<_Size>::to_ulong() const
|
bitset<_Size>::to_ulong() const
|
||||||
{
|
{
|
||||||
@@ -951,7 +874,7 @@ bitset<_Size>::to_ulong() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
unsigned long long
|
unsigned long long
|
||||||
bitset<_Size>::to_ullong() const
|
bitset<_Size>::to_ullong() const
|
||||||
{
|
{
|
||||||
@@ -974,7 +897,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
|
|||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
basic_string<_CharT, _Traits, allocator<_CharT> >
|
basic_string<_CharT, _Traits, allocator<_CharT> >
|
||||||
bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
|
bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
|
||||||
{
|
{
|
||||||
@@ -983,7 +906,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
|
|||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
template <class _CharT>
|
template <class _CharT>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
|
basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
|
||||||
bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
|
bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
|
||||||
{
|
{
|
||||||
@@ -991,7 +914,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
basic_string<char, char_traits<char>, allocator<char> >
|
basic_string<char, char_traits<char>, allocator<char> >
|
||||||
bitset<_Size>::to_string(char __zero, char __one) const
|
bitset<_Size>::to_string(char __zero, char __one) const
|
||||||
{
|
{
|
||||||
@@ -999,7 +922,7 @@ bitset<_Size>::to_string(char __zero, char __one) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
size_t
|
size_t
|
||||||
bitset<_Size>::count() const _NOEXCEPT
|
bitset<_Size>::count() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -1007,7 +930,7 @@ bitset<_Size>::count() const _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT
|
bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -1015,7 +938,7 @@ bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT
|
bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -1036,7 +959,7 @@ bitset<_Size>::test(size_t __pos) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
bitset<_Size>::all() const _NOEXCEPT
|
bitset<_Size>::all() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -1044,7 +967,7 @@ bitset<_Size>::all() const _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
bitset<_Size>::any() const _NOEXCEPT
|
bitset<_Size>::any() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -1052,7 +975,7 @@ bitset<_Size>::any() const _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bitset<_Size>
|
bitset<_Size>
|
||||||
bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT
|
bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -1062,7 +985,7 @@ bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bitset<_Size>
|
bitset<_Size>
|
||||||
bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT
|
bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -1102,7 +1025,7 @@ operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t _Size>
|
template <size_t _Size>
|
||||||
struct _LIBCPP_TYPE_VIS_ONLY hash<bitset<_Size> >
|
struct _LIBCPP_VISIBLE hash<bitset<_Size> >
|
||||||
: public unary_function<bitset<_Size>, size_t>
|
: public unary_function<bitset<_Size>, size_t>
|
||||||
{
|
{
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
|||||||
@@ -20,6 +20,4 @@ Macros:
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -20,9 +20,7 @@
|
|||||||
|
|
||||||
#include <complex>
|
#include <complex>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
// hh 080623 Created
|
// hh 080623 Created
|
||||||
|
|
||||||
|
|||||||
@@ -38,26 +38,121 @@ int toupper(int c);
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
|
#ifdef isalnum
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isalnum(int __c) {return isalnum(__c);}
|
||||||
|
#undef isalnum
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int isalnum(int __c) {return __libcpp_isalnum(__c);}
|
||||||
|
#else // isalnum
|
||||||
using ::isalnum;
|
using ::isalnum;
|
||||||
|
#endif // isalnum
|
||||||
|
|
||||||
|
#ifdef isalpha
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isalpha(int __c) {return isalpha(__c);}
|
||||||
|
#undef isalpha
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int isalpha(int __c) {return __libcpp_isalpha(__c);}
|
||||||
|
#else // isalpha
|
||||||
using ::isalpha;
|
using ::isalpha;
|
||||||
|
#endif // isalpha
|
||||||
|
|
||||||
|
#ifdef isblank
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isblank(int __c) {return isblank(__c);}
|
||||||
|
#undef isblank
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int isblank(int __c) {return __libcpp_isblank(__c);}
|
||||||
|
#else // isblank
|
||||||
using ::isblank;
|
using ::isblank;
|
||||||
|
#endif // isblank
|
||||||
|
|
||||||
|
#ifdef iscntrl
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iscntrl(int __c) {return iscntrl(__c);}
|
||||||
|
#undef iscntrl
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int iscntrl(int __c) {return __libcpp_iscntrl(__c);}
|
||||||
|
#else // iscntrl
|
||||||
using ::iscntrl;
|
using ::iscntrl;
|
||||||
|
#endif // iscntrl
|
||||||
|
|
||||||
|
#ifdef isdigit
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isdigit(int __c) {return isdigit(__c);}
|
||||||
|
#undef isdigit
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int isdigit(int __c) {return __libcpp_isdigit(__c);}
|
||||||
|
#else // isdigit
|
||||||
using ::isdigit;
|
using ::isdigit;
|
||||||
|
#endif // isdigit
|
||||||
|
|
||||||
|
#ifdef isgraph
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isgraph(int __c) {return isgraph(__c);}
|
||||||
|
#undef isgraph
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int isgraph(int __c) {return __libcpp_isgraph(__c);}
|
||||||
|
#else // isgraph
|
||||||
using ::isgraph;
|
using ::isgraph;
|
||||||
|
#endif // isgraph
|
||||||
|
|
||||||
|
#ifdef islower
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_islower(int __c) {return islower(__c);}
|
||||||
|
#undef islower
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int islower(int __c) {return __libcpp_islower(__c);}
|
||||||
|
#else // islower
|
||||||
using ::islower;
|
using ::islower;
|
||||||
|
#endif // islower
|
||||||
|
|
||||||
|
#ifdef isprint
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isprint(int __c) {return isprint(__c);}
|
||||||
|
#undef isprint
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int isprint(int __c) {return __libcpp_isprint(__c);}
|
||||||
|
#else // isprint
|
||||||
using ::isprint;
|
using ::isprint;
|
||||||
|
#endif // isprint
|
||||||
|
|
||||||
|
#ifdef ispunct
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_ispunct(int __c) {return ispunct(__c);}
|
||||||
|
#undef ispunct
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int ispunct(int __c) {return __libcpp_ispunct(__c);}
|
||||||
|
#else // ispunct
|
||||||
using ::ispunct;
|
using ::ispunct;
|
||||||
|
#endif // ispunct
|
||||||
|
|
||||||
|
#ifdef isspace
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isspace(int __c) {return isspace(__c);}
|
||||||
|
#undef isspace
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int isspace(int __c) {return __libcpp_isspace(__c);}
|
||||||
|
#else // isspace
|
||||||
using ::isspace;
|
using ::isspace;
|
||||||
|
#endif // isspace
|
||||||
|
|
||||||
|
#ifdef isupper
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isupper(int __c) {return isupper(__c);}
|
||||||
|
#undef isupper
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int isupper(int __c) {return __libcpp_isupper(__c);}
|
||||||
|
#else // isupper
|
||||||
using ::isupper;
|
using ::isupper;
|
||||||
|
#endif // isupper
|
||||||
|
|
||||||
|
#ifdef isxdigit
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isxdigit(int __c) {return isxdigit(__c);}
|
||||||
|
#undef isxdigit
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int isxdigit(int __c) {return __libcpp_isxdigit(__c);}
|
||||||
|
#else // isxdigit
|
||||||
using ::isxdigit;
|
using ::isxdigit;
|
||||||
|
#endif // isxdigit
|
||||||
|
|
||||||
|
#ifdef tolower
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_tolower(int __c) {return tolower(__c);}
|
||||||
|
#undef tolower
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int tolower(int __c) {return __libcpp_tolower(__c);}
|
||||||
|
#else // tolower
|
||||||
using ::tolower;
|
using ::tolower;
|
||||||
|
#endif // tolower
|
||||||
|
|
||||||
|
#ifdef toupper
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_toupper(int __c) {return toupper(__c);}
|
||||||
|
#undef toupper
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int toupper(int __c) {return __libcpp_toupper(__c);}
|
||||||
|
#else // toupper
|
||||||
using ::toupper;
|
using ::toupper;
|
||||||
|
#endif // toupper
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,50 @@ Macros:
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
|
||||||
|
#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
|
||||||
|
|
||||||
|
#ifdef ELAST
|
||||||
|
|
||||||
|
const int __elast1 = ELAST+1;
|
||||||
|
const int __elast2 = ELAST+2;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
const int __elast1 = 104;
|
||||||
|
const int __elast2 = 105;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENOTRECOVERABLE
|
||||||
|
|
||||||
|
#define EOWNERDEAD __elast1
|
||||||
|
|
||||||
|
#ifdef ELAST
|
||||||
|
#undef ELAST
|
||||||
|
#define ELAST EOWNERDEAD
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined(EOWNERDEAD)
|
||||||
|
|
||||||
|
#define ENOTRECOVERABLE __elast1
|
||||||
|
#ifdef ELAST
|
||||||
|
#undef ELAST
|
||||||
|
#define ELAST ENOTRECOVERABLE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else // defined(EOWNERDEAD)
|
||||||
|
|
||||||
|
#define EOWNERDEAD __elast1
|
||||||
|
#define ENOTRECOVERABLE __elast2
|
||||||
|
#ifdef ELAST
|
||||||
|
#undef ELAST
|
||||||
|
#define ELAST ENOTRECOVERABLE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // defined(EOWNERDEAD)
|
||||||
|
|
||||||
|
#endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
|
||||||
|
|
||||||
#endif // _LIBCPP_CERRNO
|
#endif // _LIBCPP_CERRNO
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
//===---------------------------- cfenv -----------------------------------===//
|
//===---------------------------- cctype ----------------------------------===//
|
||||||
//
|
//
|
||||||
// The LLVM Compiler Infrastructure
|
// The LLVM Compiler Infrastructure
|
||||||
//
|
//
|
||||||
@@ -56,9 +56,7 @@ int feupdateenv(const fenv_t* envp);
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <fenv.h>
|
#include <fenv.h>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
|
|||||||
@@ -63,8 +63,14 @@ Macros:
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
|
||||||
|
#ifndef FLT_EVAL_METHOD
|
||||||
|
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef DECIMAL_DIG
|
||||||
|
#define DECIMAL_DIG __DECIMAL_DIG__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _LIBCPP_CFLOAT
|
#endif // _LIBCPP_CFLOAT
|
||||||
|
|||||||
491
include/chrono
491
include/chrono
@@ -20,22 +20,18 @@ namespace chrono
|
|||||||
{
|
{
|
||||||
|
|
||||||
template <class ToDuration, class Rep, class Period>
|
template <class ToDuration, class Rep, class Period>
|
||||||
constexpr
|
|
||||||
ToDuration
|
ToDuration
|
||||||
duration_cast(const duration<Rep, Period>& fd);
|
duration_cast(const duration<Rep, Period>& fd);
|
||||||
|
|
||||||
template <class Rep> struct treat_as_floating_point : is_floating_point<Rep> {};
|
template <class Rep> struct treat_as_floating_point : is_floating_point<Rep> {};
|
||||||
|
|
||||||
template <class Rep> constexpr bool treat_as_floating_point_v
|
|
||||||
= treat_as_floating_point<Rep>::value; // C++17
|
|
||||||
|
|
||||||
template <class Rep>
|
template <class Rep>
|
||||||
struct duration_values
|
struct duration_values
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static constexpr Rep zero();
|
static Rep zero();
|
||||||
static constexpr Rep max();
|
static Rep max();
|
||||||
static constexpr Rep min();
|
static Rep min();
|
||||||
};
|
};
|
||||||
|
|
||||||
// duration
|
// duration
|
||||||
@@ -50,9 +46,9 @@ public:
|
|||||||
typedef Rep rep;
|
typedef Rep rep;
|
||||||
typedef Period period;
|
typedef Period period;
|
||||||
|
|
||||||
constexpr duration() = default;
|
duration() = default;
|
||||||
template <class Rep2>
|
template <class Rep2>
|
||||||
constexpr explicit duration(const Rep2& r,
|
explicit duration(const Rep2& r,
|
||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
is_convertible<Rep2, rep>::value &&
|
is_convertible<Rep2, rep>::value &&
|
||||||
@@ -62,7 +58,7 @@ public:
|
|||||||
|
|
||||||
// conversions
|
// conversions
|
||||||
template <class Rep2, class Period2>
|
template <class Rep2, class Period2>
|
||||||
constexpr duration(const duration<Rep2, Period2>& d,
|
duration(const duration<Rep2, Period2>& d,
|
||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
treat_as_floating_point<rep>::value ||
|
treat_as_floating_point<rep>::value ||
|
||||||
@@ -71,12 +67,12 @@ public:
|
|||||||
|
|
||||||
// observer
|
// observer
|
||||||
|
|
||||||
constexpr rep count() const;
|
rep count() const;
|
||||||
|
|
||||||
// arithmetic
|
// arithmetic
|
||||||
|
|
||||||
constexpr duration operator+() const;
|
duration operator+() const;
|
||||||
constexpr duration operator-() const;
|
duration operator-() const;
|
||||||
duration& operator++();
|
duration& operator++();
|
||||||
duration operator++(int);
|
duration operator++(int);
|
||||||
duration& operator--();
|
duration& operator--();
|
||||||
@@ -90,9 +86,9 @@ public:
|
|||||||
|
|
||||||
// special values
|
// special values
|
||||||
|
|
||||||
static constexpr duration zero();
|
static duration zero();
|
||||||
static constexpr duration min();
|
static duration min();
|
||||||
static constexpr duration max();
|
static duration max();
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef duration<long long, nano> nanoseconds;
|
typedef duration<long long, nano> nanoseconds;
|
||||||
@@ -114,16 +110,16 @@ private:
|
|||||||
duration d_; // exposition only
|
duration d_; // exposition only
|
||||||
|
|
||||||
public:
|
public:
|
||||||
time_point(); // has value "epoch" // constexpr in C++14
|
time_point(); // has value "epoch"
|
||||||
explicit time_point(const duration& d); // same as time_point() + d // constexpr in C++14
|
explicit time_point(const duration& d); // same as time_point() + d
|
||||||
|
|
||||||
// conversions
|
// conversions
|
||||||
template <class Duration2>
|
template <class Duration2>
|
||||||
time_point(const time_point<clock, Duration2>& t); // constexpr in C++14
|
time_point(const time_point<clock, Duration2>& t);
|
||||||
|
|
||||||
// observer
|
// observer
|
||||||
|
|
||||||
duration time_since_epoch() const; // constexpr in C++14
|
duration time_since_epoch() const;
|
||||||
|
|
||||||
// arithmetic
|
// arithmetic
|
||||||
|
|
||||||
@@ -149,62 +145,43 @@ namespace chrono {
|
|||||||
|
|
||||||
// duration arithmetic
|
// duration arithmetic
|
||||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||||
constexpr
|
|
||||||
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
|
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
|
||||||
operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||||
constexpr
|
|
||||||
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
|
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
|
||||||
operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||||
template <class Rep1, class Period, class Rep2>
|
template <class Rep1, class Period, class Rep2>
|
||||||
constexpr
|
|
||||||
duration<typename common_type<Rep1, Rep2>::type, Period>
|
duration<typename common_type<Rep1, Rep2>::type, Period>
|
||||||
operator*(const duration<Rep1, Period>& d, const Rep2& s);
|
operator*(const duration<Rep1, Period>& d, const Rep2& s);
|
||||||
template <class Rep1, class Period, class Rep2>
|
template <class Rep1, class Period, class Rep2>
|
||||||
constexpr
|
|
||||||
duration<typename common_type<Rep1, Rep2>::type, Period>
|
duration<typename common_type<Rep1, Rep2>::type, Period>
|
||||||
operator*(const Rep1& s, const duration<Rep2, Period>& d);
|
operator*(const Rep1& s, const duration<Rep2, Period>& d);
|
||||||
template <class Rep1, class Period, class Rep2>
|
template <class Rep1, class Period, class Rep2>
|
||||||
constexpr
|
|
||||||
duration<typename common_type<Rep1, Rep2>::type, Period>
|
duration<typename common_type<Rep1, Rep2>::type, Period>
|
||||||
operator/(const duration<Rep1, Period>& d, const Rep2& s);
|
operator/(const duration<Rep1, Period>& d, const Rep2& s);
|
||||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||||
constexpr
|
|
||||||
typename common_type<Rep1, Rep2>::type
|
typename common_type<Rep1, Rep2>::type
|
||||||
operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||||
|
|
||||||
// duration comparisons
|
// duration comparisons
|
||||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||||
constexpr
|
|
||||||
bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||||
constexpr
|
|
||||||
bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||||
constexpr
|
|
||||||
bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||||
constexpr
|
|
||||||
bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||||
constexpr
|
|
||||||
bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||||
constexpr
|
|
||||||
bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||||
|
|
||||||
// duration_cast
|
// duration_cast
|
||||||
template <class ToDuration, class Rep, class Period>
|
template <class ToDuration, class Rep, class Period>
|
||||||
ToDuration duration_cast(const duration<Rep, Period>& d);
|
ToDuration duration_cast(const duration<Rep, Period>& d);
|
||||||
|
|
||||||
template <class ToDuration, class Rep, class Period>
|
// time_point arithmetic
|
||||||
constexpr ToDuration floor(const duration<Rep, Period>& d); // C++17
|
|
||||||
template <class ToDuration, class Rep, class Period>
|
|
||||||
constexpr ToDuration ceil(const duration<Rep, Period>& d); // C++17
|
|
||||||
template <class ToDuration, class Rep, class Period>
|
|
||||||
constexpr ToDuration round(const duration<Rep, Period>& d); // C++17
|
|
||||||
|
|
||||||
// time_point arithmetic (all constexpr in C++14)
|
|
||||||
template <class Clock, class Duration1, class Rep2, class Period2>
|
template <class Clock, class Duration1, class Rep2, class Period2>
|
||||||
time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
|
time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
|
||||||
operator+(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
|
operator+(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||||
@@ -218,7 +195,7 @@ template <class Clock, class Duration1, class Duration2>
|
|||||||
typename common_type<Duration1, Duration2>::type
|
typename common_type<Duration1, Duration2>::type
|
||||||
operator-(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
operator-(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
||||||
|
|
||||||
// time_point comparisons (all constexpr in C++14)
|
// time_point comparisons
|
||||||
template <class Clock, class Duration1, class Duration2>
|
template <class Clock, class Duration1, class Duration2>
|
||||||
bool operator==(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
bool operator==(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
||||||
template <class Clock, class Duration1, class Duration2>
|
template <class Clock, class Duration1, class Duration2>
|
||||||
@@ -232,25 +209,11 @@ template <class Clock, class Duration1, class Duration2>
|
|||||||
template <class Clock, class Duration1, class Duration2>
|
template <class Clock, class Duration1, class Duration2>
|
||||||
bool operator>=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
bool operator>=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
|
||||||
|
|
||||||
// time_point_cast (constexpr in C++14)
|
// time_point_cast
|
||||||
|
|
||||||
template <class ToDuration, class Clock, class Duration>
|
template <class ToDuration, class Clock, class Duration>
|
||||||
time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t);
|
time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t);
|
||||||
|
|
||||||
template <class ToDuration, class Clock, class Duration>
|
|
||||||
constexpr time_point<Clock, ToDuration>
|
|
||||||
floor(const time_point<Clock, Duration>& tp); // C++17
|
|
||||||
|
|
||||||
template <class ToDuration, class Clock, class Duration>
|
|
||||||
constexpr time_point<Clock, ToDuration>
|
|
||||||
ceil(const time_point<Clock, Duration>& tp); // C++17
|
|
||||||
|
|
||||||
template <class ToDuration, class Clock, class Duration>
|
|
||||||
constexpr time_point<Clock, ToDuration>
|
|
||||||
round(const time_point<Clock, Duration>& tp); // C++17
|
|
||||||
|
|
||||||
template <class Rep, class Period>
|
|
||||||
constexpr duration<Rep, Period> abs(duration<Rep, Period> d); // C++17
|
|
||||||
// Clocks
|
// Clocks
|
||||||
|
|
||||||
class system_clock
|
class system_clock
|
||||||
@@ -260,7 +223,7 @@ public:
|
|||||||
typedef duration::rep rep;
|
typedef duration::rep rep;
|
||||||
typedef duration::period period;
|
typedef duration::period period;
|
||||||
typedef chrono::time_point<system_clock> time_point;
|
typedef chrono::time_point<system_clock> time_point;
|
||||||
static const bool is_steady = false; // constexpr in C++14
|
static const bool is_steady = false;
|
||||||
|
|
||||||
static time_point now() noexcept;
|
static time_point now() noexcept;
|
||||||
static time_t to_time_t (const time_point& __t) noexcept;
|
static time_t to_time_t (const time_point& __t) noexcept;
|
||||||
@@ -274,7 +237,7 @@ public:
|
|||||||
typedef duration::rep rep;
|
typedef duration::rep rep;
|
||||||
typedef duration::period period;
|
typedef duration::period period;
|
||||||
typedef chrono::time_point<steady_clock, duration> time_point;
|
typedef chrono::time_point<steady_clock, duration> time_point;
|
||||||
static const bool is_steady = true; // constexpr in C++14
|
static const bool is_steady = true;
|
||||||
|
|
||||||
static time_point now() noexcept;
|
static time_point now() noexcept;
|
||||||
};
|
};
|
||||||
@@ -283,19 +246,6 @@ typedef steady_clock high_resolution_clock;
|
|||||||
|
|
||||||
} // chrono
|
} // chrono
|
||||||
|
|
||||||
constexpr chrono::hours operator "" h(unsigned long long); // C++14
|
|
||||||
constexpr chrono::duration<unspecified , ratio<3600,1>> operator "" h(long double); // C++14
|
|
||||||
constexpr chrono::minutes operator "" min(unsigned long long); // C++14
|
|
||||||
constexpr chrono::duration<unspecified , ratio<60,1>> operator "" min(long double); // C++14
|
|
||||||
constexpr chrono::seconds operator "" s(unsigned long long); // C++14
|
|
||||||
constexpr chrono::duration<unspecified > operator "" s(long double); // C++14
|
|
||||||
constexpr chrono::milliseconds operator "" ms(unsigned long long); // C++14
|
|
||||||
constexpr chrono::duration<unspecified , milli> operator "" ms(long double); // C++14
|
|
||||||
constexpr chrono::microseconds operator "" us(unsigned long long); // C++14
|
|
||||||
constexpr chrono::duration<unspecified , micro> operator "" us(long double); // C++14
|
|
||||||
constexpr chrono::nanoseconds operator "" ns(unsigned long long); // C++14
|
|
||||||
constexpr chrono::duration<unspecified , nano> operator "" ns(long double); // C++14
|
|
||||||
|
|
||||||
} // std
|
} // std
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -305,18 +255,14 @@ constexpr chrono::duration<unspecified , nano> operator "" ns(long doub
|
|||||||
#include <ratio>
|
#include <ratio>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
#include <__undef_min_max>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
namespace chrono
|
namespace chrono
|
||||||
{
|
{
|
||||||
|
|
||||||
template <class _Rep, class _Period = ratio<1> > class _LIBCPP_TYPE_VIS_ONLY duration;
|
template <class _Rep, class _Period = ratio<1> > class _LIBCPP_VISIBLE duration;
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
struct __is_duration : false_type {};
|
struct __is_duration : false_type {};
|
||||||
@@ -336,8 +282,8 @@ struct __is_duration<const volatile duration<_Rep, _Period> > : true_type {};
|
|||||||
} // chrono
|
} // chrono
|
||||||
|
|
||||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||||
struct _LIBCPP_TYPE_VIS_ONLY common_type<chrono::duration<_Rep1, _Period1>,
|
struct _LIBCPP_VISIBLE common_type<chrono::duration<_Rep1, _Period1>,
|
||||||
chrono::duration<_Rep2, _Period2> >
|
chrono::duration<_Rep2, _Period2> >
|
||||||
{
|
{
|
||||||
typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type,
|
typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type,
|
||||||
typename __ratio_gcd<_Period1, _Period2>::type> type;
|
typename __ratio_gcd<_Period1, _Period2>::type> type;
|
||||||
@@ -356,7 +302,7 @@ struct __duration_cast;
|
|||||||
template <class _FromDuration, class _ToDuration, class _Period>
|
template <class _FromDuration, class _ToDuration, class _Period>
|
||||||
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
|
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
|
||||||
{
|
{
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
_ToDuration operator()(const _FromDuration& __fd) const
|
_ToDuration operator()(const _FromDuration& __fd) const
|
||||||
{
|
{
|
||||||
return _ToDuration(static_cast<typename _ToDuration::rep>(__fd.count()));
|
return _ToDuration(static_cast<typename _ToDuration::rep>(__fd.count()));
|
||||||
@@ -366,7 +312,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
|
|||||||
template <class _FromDuration, class _ToDuration, class _Period>
|
template <class _FromDuration, class _ToDuration, class _Period>
|
||||||
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
|
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
|
||||||
{
|
{
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
_ToDuration operator()(const _FromDuration& __fd) const
|
_ToDuration operator()(const _FromDuration& __fd) const
|
||||||
{
|
{
|
||||||
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
|
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
|
||||||
@@ -378,7 +324,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
|
|||||||
template <class _FromDuration, class _ToDuration, class _Period>
|
template <class _FromDuration, class _ToDuration, class _Period>
|
||||||
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
|
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
|
||||||
{
|
{
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
_ToDuration operator()(const _FromDuration& __fd) const
|
_ToDuration operator()(const _FromDuration& __fd) const
|
||||||
{
|
{
|
||||||
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
|
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
|
||||||
@@ -390,7 +336,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
|
|||||||
template <class _FromDuration, class _ToDuration, class _Period>
|
template <class _FromDuration, class _ToDuration, class _Period>
|
||||||
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
|
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
|
||||||
{
|
{
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
_ToDuration operator()(const _FromDuration& __fd) const
|
_ToDuration operator()(const _FromDuration& __fd) const
|
||||||
{
|
{
|
||||||
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
|
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
|
||||||
@@ -402,7 +348,6 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
|
|||||||
|
|
||||||
template <class _ToDuration, class _Rep, class _Period>
|
template <class _ToDuration, class _Rep, class _Period>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
__is_duration<_ToDuration>::value,
|
__is_duration<_ToDuration>::value,
|
||||||
@@ -414,113 +359,25 @@ duration_cast(const duration<_Rep, _Period>& __fd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Rep>
|
template <class _Rep>
|
||||||
struct _LIBCPP_TYPE_VIS_ONLY treat_as_floating_point : is_floating_point<_Rep> {};
|
struct _LIBCPP_VISIBLE treat_as_floating_point : is_floating_point<_Rep> {};
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
|
|
||||||
template <class _Rep> _LIBCPP_CONSTEXPR bool treat_as_floating_point_v
|
|
||||||
= treat_as_floating_point<_Rep>::value;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <class _Rep>
|
template <class _Rep>
|
||||||
struct _LIBCPP_TYPE_VIS_ONLY duration_values
|
struct _LIBCPP_VISIBLE duration_values
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep zero() {return _Rep(0);}
|
_LIBCPP_INLINE_VISIBILITY static _Rep zero() {return _Rep(0);}
|
||||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep max() {return numeric_limits<_Rep>::max();}
|
_LIBCPP_INLINE_VISIBILITY static _Rep max() {return numeric_limits<_Rep>::max();}
|
||||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep min() {return numeric_limits<_Rep>::lowest();}
|
_LIBCPP_INLINE_VISIBILITY static _Rep min() {return numeric_limits<_Rep>::lowest();}
|
||||||
};
|
};
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 14
|
|
||||||
template <class _ToDuration, class _Rep, class _Period>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
|
||||||
typename enable_if
|
|
||||||
<
|
|
||||||
__is_duration<_ToDuration>::value,
|
|
||||||
_ToDuration
|
|
||||||
>::type
|
|
||||||
floor(const duration<_Rep, _Period>& __d)
|
|
||||||
{
|
|
||||||
_ToDuration __t = duration_cast<_ToDuration>(__d);
|
|
||||||
if (__t > __d)
|
|
||||||
__t = __t - _ToDuration{1};
|
|
||||||
return __t;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _ToDuration, class _Rep, class _Period>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
|
||||||
typename enable_if
|
|
||||||
<
|
|
||||||
__is_duration<_ToDuration>::value,
|
|
||||||
_ToDuration
|
|
||||||
>::type
|
|
||||||
ceil(const duration<_Rep, _Period>& __d)
|
|
||||||
{
|
|
||||||
_ToDuration __t = duration_cast<_ToDuration>(__d);
|
|
||||||
if (__t < __d)
|
|
||||||
__t = __t + _ToDuration{1};
|
|
||||||
return __t;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _ToDuration, class _Rep, class _Period>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
|
||||||
typename enable_if
|
|
||||||
<
|
|
||||||
__is_duration<_ToDuration>::value,
|
|
||||||
_ToDuration
|
|
||||||
>::type
|
|
||||||
round(const duration<_Rep, _Period>& __d)
|
|
||||||
{
|
|
||||||
_ToDuration __lower = floor<_ToDuration>(__d);
|
|
||||||
_ToDuration __upper = __lower + _ToDuration{1};
|
|
||||||
auto __lowerDiff = __d - __lower;
|
|
||||||
auto __upperDiff = __upper - __d;
|
|
||||||
if (__lowerDiff < __upperDiff)
|
|
||||||
return __lower;
|
|
||||||
if (__lowerDiff > __upperDiff)
|
|
||||||
return __upper;
|
|
||||||
return __lower.count() & 1 ? __upper : __lower;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// duration
|
// duration
|
||||||
|
|
||||||
template <class _Rep, class _Period>
|
template <class _Rep, class _Period>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY duration
|
class _LIBCPP_VISIBLE duration
|
||||||
{
|
{
|
||||||
static_assert(!__is_duration<_Rep>::value, "A duration representation can not be a duration");
|
static_assert(!__is_duration<_Rep>::value, "A duration representation can not be a duration");
|
||||||
static_assert(__is_ratio<_Period>::value, "Second template parameter of duration must be a std::ratio");
|
static_assert(__is_ratio<_Period>::value, "Second template parameter of duration must be a std::ratio");
|
||||||
static_assert(_Period::num > 0, "duration period must be positive");
|
static_assert(_Period::num > 0, "duration period must be positive");
|
||||||
|
|
||||||
template <class _R1, class _R2>
|
|
||||||
struct __no_overflow
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
|
|
||||||
static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
|
|
||||||
static const intmax_t __n1 = _R1::num / __gcd_n1_n2;
|
|
||||||
static const intmax_t __d1 = _R1::den / __gcd_d1_d2;
|
|
||||||
static const intmax_t __n2 = _R2::num / __gcd_n1_n2;
|
|
||||||
static const intmax_t __d2 = _R2::den / __gcd_d1_d2;
|
|
||||||
static const intmax_t max = -((intmax_t(1) << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1);
|
|
||||||
|
|
||||||
template <intmax_t _Xp, intmax_t _Yp, bool __overflow>
|
|
||||||
struct __mul // __overflow == false
|
|
||||||
{
|
|
||||||
static const intmax_t value = _Xp * _Yp;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <intmax_t _Xp, intmax_t _Yp>
|
|
||||||
struct __mul<_Xp, _Yp, true>
|
|
||||||
{
|
|
||||||
static const intmax_t value = 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
|
||||||
static const bool value = (__n1 <= max / __d2) && (__n2 <= max / __d1);
|
|
||||||
typedef ratio<__mul<__n1, __d2, !value>::value,
|
|
||||||
__mul<__n2, __d1, !value>::value> type;
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef _Rep rep;
|
typedef _Rep rep;
|
||||||
typedef _Period period;
|
typedef _Period period;
|
||||||
@@ -528,15 +385,9 @@ private:
|
|||||||
rep __rep_;
|
rep __rep_;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
_LIBCPP_INLINE_VISIBILITY duration() {} // = default;
|
||||||
#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
|
||||||
duration() = default;
|
|
||||||
#else
|
|
||||||
duration() {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <class _Rep2>
|
template <class _Rep2>
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
explicit duration(const _Rep2& __r,
|
explicit duration(const _Rep2& __r,
|
||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
@@ -548,25 +399,24 @@ public:
|
|||||||
|
|
||||||
// conversions
|
// conversions
|
||||||
template <class _Rep2, class _Period2>
|
template <class _Rep2, class _Period2>
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
duration(const duration<_Rep2, _Period2>& __d,
|
duration(const duration<_Rep2, _Period2>& __d,
|
||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
__no_overflow<_Period2, period>::value && (
|
|
||||||
treat_as_floating_point<rep>::value ||
|
treat_as_floating_point<rep>::value ||
|
||||||
(__no_overflow<_Period2, period>::type::den == 1 &&
|
(ratio_divide<_Period2, period>::type::den == 1 &&
|
||||||
!treat_as_floating_point<_Rep2>::value))
|
!treat_as_floating_point<_Rep2>::value)
|
||||||
>::type* = 0)
|
>::type* = 0)
|
||||||
: __rep_(_VSTD::chrono::duration_cast<duration>(__d).count()) {}
|
: __rep_(_VSTD::chrono::duration_cast<duration>(__d).count()) {}
|
||||||
|
|
||||||
// observer
|
// observer
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR rep count() const {return __rep_;}
|
_LIBCPP_INLINE_VISIBILITY rep count() const {return __rep_;}
|
||||||
|
|
||||||
// arithmetic
|
// arithmetic
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator+() const {return *this;}
|
_LIBCPP_INLINE_VISIBILITY duration operator+() const {return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator-() const {return duration(-__rep_);}
|
_LIBCPP_INLINE_VISIBILITY duration operator-() const {return duration(-__rep_);}
|
||||||
_LIBCPP_INLINE_VISIBILITY duration& operator++() {++__rep_; return *this;}
|
_LIBCPP_INLINE_VISIBILITY duration& operator++() {++__rep_; return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY duration operator++(int) {return duration(__rep_++);}
|
_LIBCPP_INLINE_VISIBILITY duration operator++(int) {return duration(__rep_++);}
|
||||||
_LIBCPP_INLINE_VISIBILITY duration& operator--() {--__rep_; return *this;}
|
_LIBCPP_INLINE_VISIBILITY duration& operator--() {--__rep_; return *this;}
|
||||||
@@ -582,9 +432,9 @@ public:
|
|||||||
|
|
||||||
// special values
|
// special values
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration zero() {return duration(duration_values<rep>::zero());}
|
_LIBCPP_INLINE_VISIBILITY static duration zero() {return duration(duration_values<rep>::zero());}
|
||||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration min() {return duration(duration_values<rep>::min());}
|
_LIBCPP_INLINE_VISIBILITY static duration min() {return duration(duration_values<rep>::min());}
|
||||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration max() {return duration(duration_values<rep>::max());}
|
_LIBCPP_INLINE_VISIBILITY static duration max() {return duration(duration_values<rep>::max());}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef duration<long long, nano> nanoseconds;
|
typedef duration<long long, nano> nanoseconds;
|
||||||
@@ -599,8 +449,8 @@ typedef duration< long, ratio<3600> > hours;
|
|||||||
template <class _LhsDuration, class _RhsDuration>
|
template <class _LhsDuration, class _RhsDuration>
|
||||||
struct __duration_eq
|
struct __duration_eq
|
||||||
{
|
{
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const
|
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
|
||||||
{
|
{
|
||||||
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
|
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
|
||||||
return _Ct(__lhs).count() == _Ct(__rhs).count();
|
return _Ct(__lhs).count() == _Ct(__rhs).count();
|
||||||
@@ -610,14 +460,13 @@ struct __duration_eq
|
|||||||
template <class _LhsDuration>
|
template <class _LhsDuration>
|
||||||
struct __duration_eq<_LhsDuration, _LhsDuration>
|
struct __duration_eq<_LhsDuration, _LhsDuration>
|
||||||
{
|
{
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const
|
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
|
||||||
{return __lhs.count() == __rhs.count();}
|
{return __lhs.count() == __rhs.count();}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
bool
|
bool
|
||||||
operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||||
{
|
{
|
||||||
@@ -628,7 +477,6 @@ operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
|
|||||||
|
|
||||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
bool
|
bool
|
||||||
operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||||
{
|
{
|
||||||
@@ -640,8 +488,8 @@ operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
|
|||||||
template <class _LhsDuration, class _RhsDuration>
|
template <class _LhsDuration, class _RhsDuration>
|
||||||
struct __duration_lt
|
struct __duration_lt
|
||||||
{
|
{
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const
|
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
|
||||||
{
|
{
|
||||||
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
|
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
|
||||||
return _Ct(__lhs).count() < _Ct(__rhs).count();
|
return _Ct(__lhs).count() < _Ct(__rhs).count();
|
||||||
@@ -651,14 +499,13 @@ struct __duration_lt
|
|||||||
template <class _LhsDuration>
|
template <class _LhsDuration>
|
||||||
struct __duration_lt<_LhsDuration, _LhsDuration>
|
struct __duration_lt<_LhsDuration, _LhsDuration>
|
||||||
{
|
{
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const
|
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
|
||||||
{return __lhs.count() < __rhs.count();}
|
{return __lhs.count() < __rhs.count();}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
bool
|
bool
|
||||||
operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||||
{
|
{
|
||||||
@@ -669,7 +516,6 @@ operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
|
|||||||
|
|
||||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
bool
|
bool
|
||||||
operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||||
{
|
{
|
||||||
@@ -680,7 +526,6 @@ operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
|
|||||||
|
|
||||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
bool
|
bool
|
||||||
operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||||
{
|
{
|
||||||
@@ -691,7 +536,6 @@ operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
|
|||||||
|
|
||||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
bool
|
bool
|
||||||
operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||||
{
|
{
|
||||||
@@ -702,31 +546,30 @@ operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
|
|||||||
|
|
||||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
|
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
|
||||||
operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||||
{
|
{
|
||||||
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
|
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
|
||||||
return _Cd(_Cd(__lhs).count() + _Cd(__rhs).count());
|
__r += __rhs;
|
||||||
|
return __r;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Duration -
|
// Duration -
|
||||||
|
|
||||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
|
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
|
||||||
operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||||
{
|
{
|
||||||
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
|
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
|
||||||
return _Cd(_Cd(__lhs).count() - _Cd(__rhs).count());
|
__r -= __rhs;
|
||||||
|
return __r;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Duration *
|
// Duration *
|
||||||
|
|
||||||
template <class _Rep1, class _Period, class _Rep2>
|
template <class _Rep1, class _Period, class _Rep2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value,
|
is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value,
|
||||||
@@ -735,13 +578,13 @@ typename enable_if
|
|||||||
operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
|
operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
|
||||||
{
|
{
|
||||||
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
||||||
typedef duration<_Cr, _Period> _Cd;
|
duration<_Cr, _Period> __r = __d;
|
||||||
return _Cd(_Cd(__d).count() * static_cast<_Cr>(__s));
|
__r *= static_cast<_Cr>(__s);
|
||||||
|
return __r;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Rep1, class _Period, class _Rep2>
|
template <class _Rep1, class _Period, class _Rep2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
is_convertible<_Rep1, typename common_type<_Rep1, _Rep2>::type>::value,
|
is_convertible<_Rep1, typename common_type<_Rep1, _Rep2>::type>::value,
|
||||||
@@ -780,18 +623,17 @@ struct __duration_divide_result<duration<_Rep1, _Period>, _Rep2, false>
|
|||||||
|
|
||||||
template <class _Rep1, class _Period, class _Rep2>
|
template <class _Rep1, class _Period, class _Rep2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
|
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
|
||||||
operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
|
operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
|
||||||
{
|
{
|
||||||
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
||||||
typedef duration<_Cr, _Period> _Cd;
|
duration<_Cr, _Period> __r = __d;
|
||||||
return _Cd(_Cd(__d).count() / static_cast<_Cr>(__s));
|
__r /= static_cast<_Cr>(__s);
|
||||||
|
return __r;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
typename common_type<_Rep1, _Rep2>::type
|
typename common_type<_Rep1, _Rep2>::type
|
||||||
operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||||
{
|
{
|
||||||
@@ -803,24 +645,23 @@ operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2
|
|||||||
|
|
||||||
template <class _Rep1, class _Period, class _Rep2>
|
template <class _Rep1, class _Period, class _Rep2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
|
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
|
||||||
operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
|
operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
|
||||||
{
|
{
|
||||||
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
||||||
typedef duration<_Cr, _Period> _Cd;
|
duration<_Cr, _Period> __r = __d;
|
||||||
return _Cd(_Cd(__d).count() % static_cast<_Cr>(__s));
|
__r %= static_cast<_Cr>(__s);
|
||||||
|
return __r;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
|
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
|
||||||
operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||||
{
|
{
|
||||||
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
|
||||||
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
|
__r %= __rhs;
|
||||||
return _Cd(static_cast<_Cr>(_Cd(__lhs).count()) % static_cast<_Cr>(_Cd(__rhs).count()));
|
return __r;
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////
|
||||||
@@ -828,7 +669,7 @@ operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2
|
|||||||
//////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////
|
||||||
|
|
||||||
template <class _Clock, class _Duration = typename _Clock::duration>
|
template <class _Clock, class _Duration = typename _Clock::duration>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY time_point
|
class _LIBCPP_VISIBLE time_point
|
||||||
{
|
{
|
||||||
static_assert(__is_duration<_Duration>::value,
|
static_assert(__is_duration<_Duration>::value,
|
||||||
"Second template parameter of time_point must be a std::chrono::duration");
|
"Second template parameter of time_point must be a std::chrono::duration");
|
||||||
@@ -841,12 +682,12 @@ private:
|
|||||||
duration __d_;
|
duration __d_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 time_point() : __d_(duration::zero()) {}
|
_LIBCPP_INLINE_VISIBILITY time_point() : __d_(duration::zero()) {}
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit time_point(const duration& __d) : __d_(__d) {}
|
_LIBCPP_INLINE_VISIBILITY explicit time_point(const duration& __d) : __d_(__d) {}
|
||||||
|
|
||||||
// conversions
|
// conversions
|
||||||
template <class _Duration2>
|
template <class _Duration2>
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
time_point(const time_point<clock, _Duration2>& t,
|
time_point(const time_point<clock, _Duration2>& t,
|
||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
@@ -856,24 +697,24 @@ public:
|
|||||||
|
|
||||||
// observer
|
// observer
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 duration time_since_epoch() const {return __d_;}
|
_LIBCPP_INLINE_VISIBILITY duration time_since_epoch() const {return __d_;}
|
||||||
|
|
||||||
// arithmetic
|
// arithmetic
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d; return *this;}
|
_LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d;}
|
||||||
_LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d; return *this;}
|
_LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d;}
|
||||||
|
|
||||||
// special values
|
// special values
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point min() {return time_point(duration::min());}
|
_LIBCPP_INLINE_VISIBILITY static time_point min() {return time_point(duration::min());}
|
||||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point max() {return time_point(duration::max());}
|
_LIBCPP_INLINE_VISIBILITY static time_point max() {return time_point(duration::max());}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // chrono
|
} // chrono
|
||||||
|
|
||||||
template <class _Clock, class _Duration1, class _Duration2>
|
template <class _Clock, class _Duration1, class _Duration2>
|
||||||
struct _LIBCPP_TYPE_VIS_ONLY common_type<chrono::time_point<_Clock, _Duration1>,
|
struct _LIBCPP_VISIBLE common_type<chrono::time_point<_Clock, _Duration1>,
|
||||||
chrono::time_point<_Clock, _Duration2> >
|
chrono::time_point<_Clock, _Duration2> >
|
||||||
{
|
{
|
||||||
typedef chrono::time_point<_Clock, typename common_type<_Duration1, _Duration2>::type> type;
|
typedef chrono::time_point<_Clock, typename common_type<_Duration1, _Duration2>::type> type;
|
||||||
};
|
};
|
||||||
@@ -881,67 +722,17 @@ struct _LIBCPP_TYPE_VIS_ONLY common_type<chrono::time_point<_Clock, _Duration1>,
|
|||||||
namespace chrono {
|
namespace chrono {
|
||||||
|
|
||||||
template <class _ToDuration, class _Clock, class _Duration>
|
template <class _ToDuration, class _Clock, class _Duration>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
time_point<_Clock, _ToDuration>
|
time_point<_Clock, _ToDuration>
|
||||||
time_point_cast(const time_point<_Clock, _Duration>& __t)
|
time_point_cast(const time_point<_Clock, _Duration>& __t)
|
||||||
{
|
{
|
||||||
return time_point<_Clock, _ToDuration>(_VSTD::chrono::duration_cast<_ToDuration>(__t.time_since_epoch()));
|
return time_point<_Clock, _ToDuration>(_VSTD::chrono::duration_cast<_ToDuration>(__t.time_since_epoch()));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 14
|
|
||||||
template <class _ToDuration, class _Clock, class _Duration>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
|
||||||
typename enable_if
|
|
||||||
<
|
|
||||||
__is_duration<_ToDuration>::value,
|
|
||||||
time_point<_Clock, _ToDuration>
|
|
||||||
>::type
|
|
||||||
floor(const time_point<_Clock, _Duration>& __t)
|
|
||||||
{
|
|
||||||
return time_point<_Clock, _ToDuration>{floor<_ToDuration>(__t.time_since_epoch())};
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _ToDuration, class _Clock, class _Duration>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
|
||||||
typename enable_if
|
|
||||||
<
|
|
||||||
__is_duration<_ToDuration>::value,
|
|
||||||
time_point<_Clock, _ToDuration>
|
|
||||||
>::type
|
|
||||||
ceil(const time_point<_Clock, _Duration>& __t)
|
|
||||||
{
|
|
||||||
return time_point<_Clock, _ToDuration>{ceil<_ToDuration>(__t.time_since_epoch())};
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _ToDuration, class _Clock, class _Duration>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
|
||||||
typename enable_if
|
|
||||||
<
|
|
||||||
__is_duration<_ToDuration>::value,
|
|
||||||
time_point<_Clock, _ToDuration>
|
|
||||||
>::type
|
|
||||||
round(const time_point<_Clock, _Duration>& __t)
|
|
||||||
{
|
|
||||||
return time_point<_Clock, _ToDuration>{round<_ToDuration>(__t.time_since_epoch())};
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Rep, class _Period>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
|
||||||
typename enable_if
|
|
||||||
<
|
|
||||||
numeric_limits<_Rep>::is_signed,
|
|
||||||
duration<_Rep, _Period>
|
|
||||||
>::type
|
|
||||||
abs(duration<_Rep, _Period> __d)
|
|
||||||
{
|
|
||||||
return __d >= __d.zero() ? __d : -__d;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// time_point ==
|
// time_point ==
|
||||||
|
|
||||||
template <class _Clock, class _Duration1, class _Duration2>
|
template <class _Clock, class _Duration1, class _Duration2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||||
{
|
{
|
||||||
@@ -951,7 +742,7 @@ operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
|
|||||||
// time_point !=
|
// time_point !=
|
||||||
|
|
||||||
template <class _Clock, class _Duration1, class _Duration2>
|
template <class _Clock, class _Duration1, class _Duration2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||||
{
|
{
|
||||||
@@ -961,7 +752,7 @@ operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
|
|||||||
// time_point <
|
// time_point <
|
||||||
|
|
||||||
template <class _Clock, class _Duration1, class _Duration2>
|
template <class _Clock, class _Duration1, class _Duration2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator<(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
operator<(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||||
{
|
{
|
||||||
@@ -971,7 +762,7 @@ operator<(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
|
|||||||
// time_point >
|
// time_point >
|
||||||
|
|
||||||
template <class _Clock, class _Duration1, class _Duration2>
|
template <class _Clock, class _Duration1, class _Duration2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
operator>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||||
{
|
{
|
||||||
@@ -981,7 +772,7 @@ operator>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
|
|||||||
// time_point <=
|
// time_point <=
|
||||||
|
|
||||||
template <class _Clock, class _Duration1, class _Duration2>
|
template <class _Clock, class _Duration1, class _Duration2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator<=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
operator<=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||||
{
|
{
|
||||||
@@ -991,7 +782,7 @@ operator<=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
|
|||||||
// time_point >=
|
// time_point >=
|
||||||
|
|
||||||
template <class _Clock, class _Duration1, class _Duration2>
|
template <class _Clock, class _Duration1, class _Duration2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||||
{
|
{
|
||||||
@@ -1001,18 +792,20 @@ operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
|
|||||||
// time_point operator+(time_point x, duration y);
|
// time_point operator+(time_point x, duration y);
|
||||||
|
|
||||||
template <class _Clock, class _Duration1, class _Rep2, class _Period2>
|
template <class _Clock, class _Duration1, class _Rep2, class _Period2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
|
time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
|
||||||
operator+(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
operator+(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||||
{
|
{
|
||||||
typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Tr;
|
typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Tr;
|
||||||
return _Tr (__lhs.time_since_epoch() + __rhs);
|
_Tr __r(__lhs.time_since_epoch());
|
||||||
|
__r += __rhs;
|
||||||
|
return __r;
|
||||||
}
|
}
|
||||||
|
|
||||||
// time_point operator+(duration x, time_point y);
|
// time_point operator+(duration x, time_point y);
|
||||||
|
|
||||||
template <class _Rep1, class _Period1, class _Clock, class _Duration2>
|
template <class _Rep1, class _Period1, class _Clock, class _Duration2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
time_point<_Clock, typename common_type<duration<_Rep1, _Period1>, _Duration2>::type>
|
time_point<_Clock, typename common_type<duration<_Rep1, _Period1>, _Duration2>::type>
|
||||||
operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||||
{
|
{
|
||||||
@@ -1022,7 +815,7 @@ operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Dura
|
|||||||
// time_point operator-(time_point x, duration y);
|
// time_point operator-(time_point x, duration y);
|
||||||
|
|
||||||
template <class _Clock, class _Duration1, class _Rep2, class _Period2>
|
template <class _Clock, class _Duration1, class _Rep2, class _Period2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
|
time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
|
||||||
operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||||
{
|
{
|
||||||
@@ -1032,7 +825,7 @@ operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Pe
|
|||||||
// duration operator-(time_point x, time_point y);
|
// duration operator-(time_point x, time_point y);
|
||||||
|
|
||||||
template <class _Clock, class _Duration1, class _Duration2>
|
template <class _Clock, class _Duration1, class _Duration2>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
typename common_type<_Duration1, _Duration2>::type
|
typename common_type<_Duration1, _Duration2>::type
|
||||||
operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
|
||||||
{
|
{
|
||||||
@@ -1043,120 +836,36 @@ operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
|
|||||||
/////////////////////// clocks ///////////////////////////
|
/////////////////////// clocks ///////////////////////////
|
||||||
//////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class _LIBCPP_TYPE_VIS system_clock
|
class _LIBCPP_VISIBLE system_clock
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef microseconds duration;
|
typedef microseconds duration;
|
||||||
typedef duration::rep rep;
|
typedef duration::rep rep;
|
||||||
typedef duration::period period;
|
typedef duration::period period;
|
||||||
typedef chrono::time_point<system_clock> time_point;
|
typedef chrono::time_point<system_clock> time_point;
|
||||||
static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = false;
|
static const bool is_steady = false;
|
||||||
|
|
||||||
static time_point now() _NOEXCEPT;
|
static time_point now() _NOEXCEPT;
|
||||||
static time_t to_time_t (const time_point& __t) _NOEXCEPT;
|
static time_t to_time_t (const time_point& __t) _NOEXCEPT;
|
||||||
static time_point from_time_t(time_t __t) _NOEXCEPT;
|
static time_point from_time_t(time_t __t) _NOEXCEPT;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK
|
class _LIBCPP_VISIBLE steady_clock
|
||||||
class _LIBCPP_TYPE_VIS steady_clock
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef nanoseconds duration;
|
typedef nanoseconds duration;
|
||||||
typedef duration::rep rep;
|
typedef duration::rep rep;
|
||||||
typedef duration::period period;
|
typedef duration::period period;
|
||||||
typedef chrono::time_point<steady_clock, duration> time_point;
|
typedef chrono::time_point<steady_clock, duration> time_point;
|
||||||
static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = true;
|
static const bool is_steady = true;
|
||||||
|
|
||||||
static time_point now() _NOEXCEPT;
|
static time_point now() _NOEXCEPT;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef steady_clock high_resolution_clock;
|
typedef steady_clock high_resolution_clock;
|
||||||
#else
|
|
||||||
typedef system_clock high_resolution_clock;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // chrono
|
} // chrono
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
// Suffixes for duration literals [time.duration.literals]
|
|
||||||
inline namespace literals
|
|
||||||
{
|
|
||||||
inline namespace chrono_literals
|
|
||||||
{
|
|
||||||
|
|
||||||
constexpr chrono::hours operator"" h(unsigned long long __h)
|
|
||||||
{
|
|
||||||
return chrono::hours(static_cast<chrono::hours::rep>(__h));
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr chrono::duration<long double, ratio<3600,1>> operator"" h(long double __h)
|
|
||||||
{
|
|
||||||
return chrono::duration<long double, ratio<3600,1>>(__h);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
constexpr chrono::minutes operator"" min(unsigned long long __m)
|
|
||||||
{
|
|
||||||
return chrono::minutes(static_cast<chrono::minutes::rep>(__m));
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr chrono::duration<long double, ratio<60,1>> operator"" min(long double __m)
|
|
||||||
{
|
|
||||||
return chrono::duration<long double, ratio<60,1>> (__m);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
constexpr chrono::seconds operator"" s(unsigned long long __s)
|
|
||||||
{
|
|
||||||
return chrono::seconds(static_cast<chrono::seconds::rep>(__s));
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr chrono::duration<long double> operator"" s(long double __s)
|
|
||||||
{
|
|
||||||
return chrono::duration<long double> (__s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
constexpr chrono::milliseconds operator"" ms(unsigned long long __ms)
|
|
||||||
{
|
|
||||||
return chrono::milliseconds(static_cast<chrono::milliseconds::rep>(__ms));
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr chrono::duration<long double, milli> operator"" ms(long double __ms)
|
|
||||||
{
|
|
||||||
return chrono::duration<long double, milli>(__ms);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
constexpr chrono::microseconds operator"" us(unsigned long long __us)
|
|
||||||
{
|
|
||||||
return chrono::microseconds(static_cast<chrono::microseconds::rep>(__us));
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr chrono::duration<long double, micro> operator"" us(long double __us)
|
|
||||||
{
|
|
||||||
return chrono::duration<long double, micro> (__us);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
constexpr chrono::nanoseconds operator"" ns(unsigned long long __ns)
|
|
||||||
{
|
|
||||||
return chrono::nanoseconds(static_cast<chrono::nanoseconds::rep>(__ns));
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr chrono::duration<long double, nano> operator"" ns(long double __ns)
|
|
||||||
{
|
|
||||||
return chrono::duration<long double, nano> (__ns);
|
|
||||||
}
|
|
||||||
|
|
||||||
}}
|
|
||||||
|
|
||||||
namespace chrono { // hoist the literals into namespace std::chrono
|
|
||||||
using namespace literals::chrono_literals;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
#endif // _LIBCPP_CHRONO
|
#endif // _LIBCPP_CHRONO
|
||||||
|
|||||||
@@ -239,13 +239,12 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
using::imaxdiv_t;
|
using::imaxdiv_t;
|
||||||
|
|
||||||
using::imaxabs;
|
using::imaxabs;
|
||||||
using::imaxdiv;
|
using::imaxdiv;
|
||||||
using::strtoimax;
|
using::strtoimax;
|
||||||
|
|||||||
@@ -18,8 +18,6 @@
|
|||||||
|
|
||||||
#include <__config>
|
#include <__config>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // _LIBCPP_CISO646
|
#endif // _LIBCPP_CISO646
|
||||||
|
|||||||
@@ -41,8 +41,6 @@ Macros:
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // _LIBCPP_CLIMITS
|
#endif // _LIBCPP_CLIMITS
|
||||||
|
|||||||
@@ -38,16 +38,12 @@ lconv* localeconv();
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
using ::lconv;
|
using ::lconv;
|
||||||
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
|
|
||||||
using ::setlocale;
|
using ::setlocale;
|
||||||
#endif
|
|
||||||
using ::localeconv;
|
using ::localeconv;
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|||||||
1123
include/cmath
1123
include/cmath
File diff suppressed because it is too large
Load Diff
@@ -29,8 +29,7 @@ template <class Elem, unsigned long Maxcode = 0x10ffff,
|
|||||||
class codecvt_utf8
|
class codecvt_utf8
|
||||||
: public codecvt<Elem, char, mbstate_t>
|
: public codecvt<Elem, char, mbstate_t>
|
||||||
{
|
{
|
||||||
explicit codecvt_utf8(size_t refs = 0);
|
// unspecified
|
||||||
~codecvt_utf8();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Elem, unsigned long Maxcode = 0x10ffff,
|
template <class Elem, unsigned long Maxcode = 0x10ffff,
|
||||||
@@ -38,8 +37,7 @@ template <class Elem, unsigned long Maxcode = 0x10ffff,
|
|||||||
class codecvt_utf16
|
class codecvt_utf16
|
||||||
: public codecvt<Elem, char, mbstate_t>
|
: public codecvt<Elem, char, mbstate_t>
|
||||||
{
|
{
|
||||||
explicit codecvt_utf16(size_t refs = 0);
|
// unspecified
|
||||||
~codecvt_utf16();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Elem, unsigned long Maxcode = 0x10ffff,
|
template <class Elem, unsigned long Maxcode = 0x10ffff,
|
||||||
@@ -47,8 +45,7 @@ template <class Elem, unsigned long Maxcode = 0x10ffff,
|
|||||||
class codecvt_utf8_utf16
|
class codecvt_utf8_utf16
|
||||||
: public codecvt<Elem, char, mbstate_t>
|
: public codecvt<Elem, char, mbstate_t>
|
||||||
{
|
{
|
||||||
explicit codecvt_utf8_utf16(size_t refs = 0);
|
// unspecified
|
||||||
~codecvt_utf8_utf16();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // std
|
} // std
|
||||||
@@ -58,9 +55,7 @@ class codecvt_utf8_utf16
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <__locale>
|
#include <__locale>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
@@ -76,7 +71,7 @@ enum codecvt_mode
|
|||||||
template <class _Elem> class __codecvt_utf8;
|
template <class _Elem> class __codecvt_utf8;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS __codecvt_utf8<wchar_t>
|
class __codecvt_utf8<wchar_t>
|
||||||
: public codecvt<wchar_t, char, mbstate_t>
|
: public codecvt<wchar_t, char, mbstate_t>
|
||||||
{
|
{
|
||||||
unsigned long _Maxcode_;
|
unsigned long _Maxcode_;
|
||||||
@@ -111,7 +106,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS __codecvt_utf8<char16_t>
|
class __codecvt_utf8<char16_t>
|
||||||
: public codecvt<char16_t, char, mbstate_t>
|
: public codecvt<char16_t, char, mbstate_t>
|
||||||
{
|
{
|
||||||
unsigned long _Maxcode_;
|
unsigned long _Maxcode_;
|
||||||
@@ -146,7 +141,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS __codecvt_utf8<char32_t>
|
class __codecvt_utf8<char32_t>
|
||||||
: public codecvt<char32_t, char, mbstate_t>
|
: public codecvt<char32_t, char, mbstate_t>
|
||||||
{
|
{
|
||||||
unsigned long _Maxcode_;
|
unsigned long _Maxcode_;
|
||||||
@@ -182,7 +177,7 @@ protected:
|
|||||||
|
|
||||||
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
||||||
codecvt_mode _Mode = (codecvt_mode)0>
|
codecvt_mode _Mode = (codecvt_mode)0>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY codecvt_utf8
|
class _LIBCPP_VISIBLE codecvt_utf8
|
||||||
: public __codecvt_utf8<_Elem>
|
: public __codecvt_utf8<_Elem>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -199,7 +194,7 @@ public:
|
|||||||
template <class _Elem, bool _LittleEndian> class __codecvt_utf16;
|
template <class _Elem, bool _LittleEndian> class __codecvt_utf16;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, false>
|
class __codecvt_utf16<wchar_t, false>
|
||||||
: public codecvt<wchar_t, char, mbstate_t>
|
: public codecvt<wchar_t, char, mbstate_t>
|
||||||
{
|
{
|
||||||
unsigned long _Maxcode_;
|
unsigned long _Maxcode_;
|
||||||
@@ -234,7 +229,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, true>
|
class __codecvt_utf16<wchar_t, true>
|
||||||
: public codecvt<wchar_t, char, mbstate_t>
|
: public codecvt<wchar_t, char, mbstate_t>
|
||||||
{
|
{
|
||||||
unsigned long _Maxcode_;
|
unsigned long _Maxcode_;
|
||||||
@@ -269,7 +264,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, false>
|
class __codecvt_utf16<char16_t, false>
|
||||||
: public codecvt<char16_t, char, mbstate_t>
|
: public codecvt<char16_t, char, mbstate_t>
|
||||||
{
|
{
|
||||||
unsigned long _Maxcode_;
|
unsigned long _Maxcode_;
|
||||||
@@ -304,7 +299,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, true>
|
class __codecvt_utf16<char16_t, true>
|
||||||
: public codecvt<char16_t, char, mbstate_t>
|
: public codecvt<char16_t, char, mbstate_t>
|
||||||
{
|
{
|
||||||
unsigned long _Maxcode_;
|
unsigned long _Maxcode_;
|
||||||
@@ -339,7 +334,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, false>
|
class __codecvt_utf16<char32_t, false>
|
||||||
: public codecvt<char32_t, char, mbstate_t>
|
: public codecvt<char32_t, char, mbstate_t>
|
||||||
{
|
{
|
||||||
unsigned long _Maxcode_;
|
unsigned long _Maxcode_;
|
||||||
@@ -374,7 +369,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, true>
|
class __codecvt_utf16<char32_t, true>
|
||||||
: public codecvt<char32_t, char, mbstate_t>
|
: public codecvt<char32_t, char, mbstate_t>
|
||||||
{
|
{
|
||||||
unsigned long _Maxcode_;
|
unsigned long _Maxcode_;
|
||||||
@@ -410,7 +405,7 @@ protected:
|
|||||||
|
|
||||||
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
||||||
codecvt_mode _Mode = (codecvt_mode)0>
|
codecvt_mode _Mode = (codecvt_mode)0>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY codecvt_utf16
|
class _LIBCPP_VISIBLE codecvt_utf16
|
||||||
: public __codecvt_utf16<_Elem, _Mode & little_endian>
|
: public __codecvt_utf16<_Elem, _Mode & little_endian>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -427,7 +422,7 @@ public:
|
|||||||
template <class _Elem> class __codecvt_utf8_utf16;
|
template <class _Elem> class __codecvt_utf8_utf16;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<wchar_t>
|
class __codecvt_utf8_utf16<wchar_t>
|
||||||
: public codecvt<wchar_t, char, mbstate_t>
|
: public codecvt<wchar_t, char, mbstate_t>
|
||||||
{
|
{
|
||||||
unsigned long _Maxcode_;
|
unsigned long _Maxcode_;
|
||||||
@@ -462,7 +457,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char32_t>
|
class __codecvt_utf8_utf16<char32_t>
|
||||||
: public codecvt<char32_t, char, mbstate_t>
|
: public codecvt<char32_t, char, mbstate_t>
|
||||||
{
|
{
|
||||||
unsigned long _Maxcode_;
|
unsigned long _Maxcode_;
|
||||||
@@ -497,7 +492,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char16_t>
|
class __codecvt_utf8_utf16<char16_t>
|
||||||
: public codecvt<char16_t, char, mbstate_t>
|
: public codecvt<char16_t, char, mbstate_t>
|
||||||
{
|
{
|
||||||
unsigned long _Maxcode_;
|
unsigned long _Maxcode_;
|
||||||
@@ -533,7 +528,7 @@ protected:
|
|||||||
|
|
||||||
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
||||||
codecvt_mode _Mode = (codecvt_mode)0>
|
codecvt_mode _Mode = (codecvt_mode)0>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY codecvt_utf8_utf16
|
class _LIBCPP_VISIBLE codecvt_utf8_utf16
|
||||||
: public __codecvt_utf8_utf16<_Elem>
|
: public __codecvt_utf8_utf16<_Elem>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
217
include/complex
217
include/complex
@@ -23,12 +23,12 @@ class complex
|
|||||||
public:
|
public:
|
||||||
typedef T value_type;
|
typedef T value_type;
|
||||||
|
|
||||||
complex(const T& re = T(), const T& im = T()); // constexpr in C++14
|
complex(const T& re = T(), const T& im = T());
|
||||||
complex(const complex&); // constexpr in C++14
|
complex(const complex&);
|
||||||
template<class X> complex(const complex<X>&); // constexpr in C++14
|
template<class X> complex(const complex<X>&);
|
||||||
|
|
||||||
T real() const; // constexpr in C++14
|
T real() const;
|
||||||
T imag() const; // constexpr in C++14
|
T imag() const;
|
||||||
|
|
||||||
void real(T);
|
void real(T);
|
||||||
void imag(T);
|
void imag(T);
|
||||||
@@ -149,12 +149,12 @@ template<class T> complex<T> operator/(const complex<T>&, const T&);
|
|||||||
template<class T> complex<T> operator/(const T&, const complex<T>&);
|
template<class T> complex<T> operator/(const T&, const complex<T>&);
|
||||||
template<class T> complex<T> operator+(const complex<T>&);
|
template<class T> complex<T> operator+(const complex<T>&);
|
||||||
template<class T> complex<T> operator-(const complex<T>&);
|
template<class T> complex<T> operator-(const complex<T>&);
|
||||||
template<class T> bool operator==(const complex<T>&, const complex<T>&); // constexpr in C++14
|
template<class T> bool operator==(const complex<T>&, const complex<T>&);
|
||||||
template<class T> bool operator==(const complex<T>&, const T&); // constexpr in C++14
|
template<class T> bool operator==(const complex<T>&, const T&);
|
||||||
template<class T> bool operator==(const T&, const complex<T>&); // constexpr in C++14
|
template<class T> bool operator==(const T&, const complex<T>&);
|
||||||
template<class T> bool operator!=(const complex<T>&, const complex<T>&); // constexpr in C++14
|
template<class T> bool operator!=(const complex<T>&, const complex<T>&);
|
||||||
template<class T> bool operator!=(const complex<T>&, const T&); // constexpr in C++14
|
template<class T> bool operator!=(const complex<T>&, const T&);
|
||||||
template<class T> bool operator!=(const T&, const complex<T>&); // constexpr in C++14
|
template<class T> bool operator!=(const T&, const complex<T>&);
|
||||||
|
|
||||||
template<class T, class charT, class traits>
|
template<class T, class charT, class traits>
|
||||||
basic_istream<charT, traits>&
|
basic_istream<charT, traits>&
|
||||||
@@ -165,17 +165,17 @@ template<class T, class charT, class traits>
|
|||||||
|
|
||||||
// 26.3.7 values:
|
// 26.3.7 values:
|
||||||
|
|
||||||
template<class T> T real(const complex<T>&); // constexpr in C++14
|
template<class T> T real(const complex<T>&);
|
||||||
long double real(long double); // constexpr in C++14
|
long double real(long double);
|
||||||
double real(double); // constexpr in C++14
|
double real(double);
|
||||||
template<Integral T> double real(T); // constexpr in C++14
|
template<Integral T> double real(T);
|
||||||
float real(float); // constexpr in C++14
|
float real(float);
|
||||||
|
|
||||||
template<class T> T imag(const complex<T>&); // constexpr in C++14
|
template<class T> T imag(const complex<T>&);
|
||||||
long double imag(long double); // constexpr in C++14
|
long double imag(long double);
|
||||||
double imag(double); // constexpr in C++14
|
double imag(double);
|
||||||
template<Integral T> double imag(T); // constexpr in C++14
|
template<Integral T> double imag(T);
|
||||||
float imag(float); // constexpr in C++14
|
float imag(float);
|
||||||
|
|
||||||
template<class T> T abs(const complex<T>&);
|
template<class T> T abs(const complex<T>&);
|
||||||
|
|
||||||
@@ -249,19 +249,17 @@ template<class T, class charT, class traits>
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
template<class _Tp> class _LIBCPP_TYPE_VIS_ONLY complex;
|
template<class _Tp> class _LIBCPP_VISIBLE complex;
|
||||||
|
|
||||||
template<class _Tp> complex<_Tp> operator*(const complex<_Tp>& __z, const complex<_Tp>& __w);
|
template<class _Tp> complex<_Tp> operator*(const complex<_Tp>& __z, const complex<_Tp>& __w);
|
||||||
template<class _Tp> complex<_Tp> operator/(const complex<_Tp>& __x, const complex<_Tp>& __y);
|
template<class _Tp> complex<_Tp> operator/(const complex<_Tp>& __x, const complex<_Tp>& __y);
|
||||||
|
|
||||||
template<class _Tp>
|
template<class _Tp>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY complex
|
class _LIBCPP_VISIBLE complex
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef _Tp value_type;
|
typedef _Tp value_type;
|
||||||
@@ -269,21 +267,20 @@ private:
|
|||||||
value_type __re_;
|
value_type __re_;
|
||||||
value_type __im_;
|
value_type __im_;
|
||||||
public:
|
public:
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
complex(const value_type& __re = value_type(), const value_type& __im = value_type())
|
complex(const value_type& __re = value_type(), const value_type& __im = value_type())
|
||||||
: __re_(__re), __im_(__im) {}
|
: __re_(__re), __im_(__im) {}
|
||||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
template<class _Xp> _LIBCPP_INLINE_VISIBILITY
|
||||||
complex(const complex<_Xp>& __c)
|
complex(const complex<_Xp>& __c)
|
||||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 value_type real() const {return __re_;}
|
_LIBCPP_INLINE_VISIBILITY value_type real() const {return __re_;}
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 value_type imag() const {return __im_;}
|
_LIBCPP_INLINE_VISIBILITY value_type imag() const {return __im_;}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
|
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
|
||||||
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
|
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator= (const value_type& __re)
|
_LIBCPP_INLINE_VISIBILITY complex& operator= (const value_type& __re) {__re_ = __re; return *this;}
|
||||||
{__re_ = __re; __im_ = value_type(); return *this;}
|
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator+=(const value_type& __re) {__re_ += __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator+=(const value_type& __re) {__re_ += __re; return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator-=(const value_type& __re) {__re_ -= __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator-=(const value_type& __re) {__re_ -= __re; return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator*=(const value_type& __re) {__re_ *= __re; __im_ *= __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator*=(const value_type& __re) {__re_ *= __re; __im_ *= __re; return *this;}
|
||||||
@@ -309,40 +306,39 @@ public:
|
|||||||
}
|
}
|
||||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
|
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
|
||||||
{
|
{
|
||||||
*this = *this * complex(__c.real(), __c.imag());
|
*this = *this * __c;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
|
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
|
||||||
{
|
{
|
||||||
*this = *this / complex(__c.real(), __c.imag());
|
*this = *this / __c;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<> class _LIBCPP_TYPE_VIS_ONLY complex<double>;
|
template<> class _LIBCPP_VISIBLE complex<double>;
|
||||||
template<> class _LIBCPP_TYPE_VIS_ONLY complex<long double>;
|
template<> class _LIBCPP_VISIBLE complex<long double>;
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY complex<float>
|
class _LIBCPP_VISIBLE complex<float>
|
||||||
{
|
{
|
||||||
float __re_;
|
float __re_;
|
||||||
float __im_;
|
float __im_;
|
||||||
public:
|
public:
|
||||||
typedef float value_type;
|
typedef float value_type;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(float __re = 0.0f, float __im = 0.0f)
|
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(float __re = 0.0f, float __im = 0.0f)
|
||||||
: __re_(__re), __im_(__im) {}
|
: __re_(__re), __im_(__im) {}
|
||||||
explicit _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
|
explicit /*constexpr*/ complex(const complex<double>& __c);
|
||||||
explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
|
explicit /*constexpr*/ complex(const complex<long double>& __c);
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float real() const {return __re_;}
|
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY float real() const {return __re_;}
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float imag() const {return __im_;}
|
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY float imag() const {return __im_;}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
|
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
|
||||||
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
|
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator= (float __re)
|
_LIBCPP_INLINE_VISIBILITY complex& operator= (float __re) {__re_ = __re; return *this;}
|
||||||
{__re_ = __re; __im_ = value_type(); return *this;}
|
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator+=(float __re) {__re_ += __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator+=(float __re) {__re_ += __re; return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator-=(float __re) {__re_ -= __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator-=(float __re) {__re_ -= __re; return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator*=(float __re) {__re_ *= __re; __im_ *= __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator*=(float __re) {__re_ *= __re; __im_ *= __re; return *this;}
|
||||||
@@ -368,37 +364,36 @@ public:
|
|||||||
}
|
}
|
||||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
|
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
|
||||||
{
|
{
|
||||||
*this = *this * complex(__c.real(), __c.imag());
|
*this = *this * __c;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
|
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
|
||||||
{
|
{
|
||||||
*this = *this / complex(__c.real(), __c.imag());
|
*this = *this / __c;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY complex<double>
|
class _LIBCPP_VISIBLE complex<double>
|
||||||
{
|
{
|
||||||
double __re_;
|
double __re_;
|
||||||
double __im_;
|
double __im_;
|
||||||
public:
|
public:
|
||||||
typedef double value_type;
|
typedef double value_type;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(double __re = 0.0, double __im = 0.0)
|
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(double __re = 0.0, double __im = 0.0)
|
||||||
: __re_(__re), __im_(__im) {}
|
: __re_(__re), __im_(__im) {}
|
||||||
_LIBCPP_CONSTEXPR complex(const complex<float>& __c);
|
/*constexpr*/ complex(const complex<float>& __c);
|
||||||
explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
|
explicit /*constexpr*/ complex(const complex<long double>& __c);
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double real() const {return __re_;}
|
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY double real() const {return __re_;}
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double imag() const {return __im_;}
|
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY double imag() const {return __im_;}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
|
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
|
||||||
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
|
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator= (double __re)
|
_LIBCPP_INLINE_VISIBILITY complex& operator= (double __re) {__re_ = __re; return *this;}
|
||||||
{__re_ = __re; __im_ = value_type(); return *this;}
|
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator+=(double __re) {__re_ += __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator+=(double __re) {__re_ += __re; return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator-=(double __re) {__re_ -= __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator-=(double __re) {__re_ -= __re; return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator*=(double __re) {__re_ *= __re; __im_ *= __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator*=(double __re) {__re_ *= __re; __im_ *= __re; return *this;}
|
||||||
@@ -424,37 +419,36 @@ public:
|
|||||||
}
|
}
|
||||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
|
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
|
||||||
{
|
{
|
||||||
*this = *this * complex(__c.real(), __c.imag());
|
*this = *this * __c;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
|
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
|
||||||
{
|
{
|
||||||
*this = *this / complex(__c.real(), __c.imag());
|
*this = *this / __c;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY complex<long double>
|
class _LIBCPP_VISIBLE complex<long double>
|
||||||
{
|
{
|
||||||
long double __re_;
|
long double __re_;
|
||||||
long double __im_;
|
long double __im_;
|
||||||
public:
|
public:
|
||||||
typedef long double value_type;
|
typedef long double value_type;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(long double __re = 0.0L, long double __im = 0.0L)
|
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(long double __re = 0.0L, long double __im = 0.0L)
|
||||||
: __re_(__re), __im_(__im) {}
|
: __re_(__re), __im_(__im) {}
|
||||||
_LIBCPP_CONSTEXPR complex(const complex<float>& __c);
|
/*constexpr*/ complex(const complex<float>& __c);
|
||||||
_LIBCPP_CONSTEXPR complex(const complex<double>& __c);
|
/*constexpr*/ complex(const complex<double>& __c);
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double real() const {return __re_;}
|
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY long double real() const {return __re_;}
|
||||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double imag() const {return __im_;}
|
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY long double imag() const {return __im_;}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
|
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
|
||||||
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
|
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator= (long double __re)
|
_LIBCPP_INLINE_VISIBILITY complex& operator= (long double __re) {__re_ = __re; return *this;}
|
||||||
{__re_ = __re; __im_ = value_type(); return *this;}
|
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator+=(long double __re) {__re_ += __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator+=(long double __re) {__re_ += __re; return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator-=(long double __re) {__re_ -= __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator-=(long double __re) {__re_ -= __re; return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY complex& operator*=(long double __re) {__re_ *= __re; __im_ *= __re; return *this;}
|
_LIBCPP_INLINE_VISIBILITY complex& operator*=(long double __re) {__re_ *= __re; __im_ *= __re; return *this;}
|
||||||
@@ -480,43 +474,43 @@ public:
|
|||||||
}
|
}
|
||||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
|
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
|
||||||
{
|
{
|
||||||
*this = *this * complex(__c.real(), __c.imag());
|
*this = *this * __c;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
|
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
|
||||||
{
|
{
|
||||||
*this = *this / complex(__c.real(), __c.imag());
|
*this = *this / __c;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//constexpr
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
complex<float>::complex(const complex<double>& __c)
|
complex<float>::complex(const complex<double>& __c)
|
||||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||||
|
|
||||||
|
//constexpr
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
complex<float>::complex(const complex<long double>& __c)
|
complex<float>::complex(const complex<long double>& __c)
|
||||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||||
|
|
||||||
|
//constexpr
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
complex<double>::complex(const complex<float>& __c)
|
complex<double>::complex(const complex<float>& __c)
|
||||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||||
|
|
||||||
|
//constexpr
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
complex<double>::complex(const complex<long double>& __c)
|
complex<double>::complex(const complex<long double>& __c)
|
||||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||||
|
|
||||||
|
//constexpr
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
complex<long double>::complex(const complex<float>& __c)
|
complex<long double>::complex(const complex<float>& __c)
|
||||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||||
|
|
||||||
|
//constexpr
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
complex<long double>::complex(const complex<double>& __c)
|
complex<long double>::complex(const complex<double>& __c)
|
||||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||||
|
|
||||||
@@ -740,7 +734,7 @@ operator-(const complex<_Tp>& __x)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class _Tp>
|
template<class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
|
operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
|
||||||
{
|
{
|
||||||
@@ -748,7 +742,7 @@ operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class _Tp>
|
template<class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator==(const complex<_Tp>& __x, const _Tp& __y)
|
operator==(const complex<_Tp>& __x, const _Tp& __y)
|
||||||
{
|
{
|
||||||
@@ -756,7 +750,7 @@ operator==(const complex<_Tp>& __x, const _Tp& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class _Tp>
|
template<class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator==(const _Tp& __x, const complex<_Tp>& __y)
|
operator==(const _Tp& __x, const complex<_Tp>& __y)
|
||||||
{
|
{
|
||||||
@@ -764,7 +758,7 @@ operator==(const _Tp& __x, const complex<_Tp>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class _Tp>
|
template<class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
|
operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
|
||||||
{
|
{
|
||||||
@@ -772,7 +766,7 @@ operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class _Tp>
|
template<class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator!=(const complex<_Tp>& __x, const _Tp& __y)
|
operator!=(const complex<_Tp>& __x, const _Tp& __y)
|
||||||
{
|
{
|
||||||
@@ -780,7 +774,7 @@ operator!=(const complex<_Tp>& __x, const _Tp& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class _Tp>
|
template<class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
operator!=(const _Tp& __x, const complex<_Tp>& __y)
|
operator!=(const _Tp& __x, const complex<_Tp>& __y)
|
||||||
{
|
{
|
||||||
@@ -792,21 +786,21 @@ operator!=(const _Tp& __x, const complex<_Tp>& __y)
|
|||||||
// real
|
// real
|
||||||
|
|
||||||
template<class _Tp>
|
template<class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_Tp
|
_Tp
|
||||||
real(const complex<_Tp>& __c)
|
real(const complex<_Tp>& __c)
|
||||||
{
|
{
|
||||||
return __c.real();
|
return __c.real();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
long double
|
long double
|
||||||
real(long double __re)
|
real(long double __re)
|
||||||
{
|
{
|
||||||
return __re;
|
return __re;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
double
|
double
|
||||||
real(double __re)
|
real(double __re)
|
||||||
{
|
{
|
||||||
@@ -814,7 +808,7 @@ real(double __re)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class _Tp>
|
template<class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
is_integral<_Tp>::value,
|
is_integral<_Tp>::value,
|
||||||
@@ -825,7 +819,7 @@ real(_Tp __re)
|
|||||||
return __re;
|
return __re;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
float
|
float
|
||||||
real(float __re)
|
real(float __re)
|
||||||
{
|
{
|
||||||
@@ -835,21 +829,21 @@ real(float __re)
|
|||||||
// imag
|
// imag
|
||||||
|
|
||||||
template<class _Tp>
|
template<class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_Tp
|
_Tp
|
||||||
imag(const complex<_Tp>& __c)
|
imag(const complex<_Tp>& __c)
|
||||||
{
|
{
|
||||||
return __c.imag();
|
return __c.imag();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
long double
|
long double
|
||||||
imag(long double __re)
|
imag(long double __re)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
double
|
double
|
||||||
imag(double __re)
|
imag(double __re)
|
||||||
{
|
{
|
||||||
@@ -857,7 +851,7 @@ imag(double __re)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class _Tp>
|
template<class _Tp>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
typename enable_if
|
typename enable_if
|
||||||
<
|
<
|
||||||
is_integral<_Tp>::value,
|
is_integral<_Tp>::value,
|
||||||
@@ -868,7 +862,7 @@ imag(_Tp __re)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
float
|
float
|
||||||
imag(float __re)
|
imag(float __re)
|
||||||
{
|
{
|
||||||
@@ -1249,12 +1243,10 @@ acosh(const complex<_Tp>& __x)
|
|||||||
if (isnan(__x.imag()))
|
if (isnan(__x.imag()))
|
||||||
return complex<_Tp>(abs(__x.real()), __x.imag());
|
return complex<_Tp>(abs(__x.real()), __x.imag());
|
||||||
if (isinf(__x.imag()))
|
if (isinf(__x.imag()))
|
||||||
{
|
|
||||||
if (__x.real() > 0)
|
if (__x.real() > 0)
|
||||||
return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
|
return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
|
||||||
else
|
else
|
||||||
return complex<_Tp>(-__x.real(), copysign(__pi * _Tp(0.75), __x.imag()));
|
return complex<_Tp>(-__x.real(), copysign(__pi * _Tp(0.75), __x.imag()));
|
||||||
}
|
|
||||||
if (__x.real() < 0)
|
if (__x.real() < 0)
|
||||||
return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag()));
|
return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag()));
|
||||||
return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
|
return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
|
||||||
@@ -1353,11 +1345,7 @@ tanh(const complex<_Tp>& __x)
|
|||||||
_Tp __2r(_Tp(2) * __x.real());
|
_Tp __2r(_Tp(2) * __x.real());
|
||||||
_Tp __2i(_Tp(2) * __x.imag());
|
_Tp __2i(_Tp(2) * __x.imag());
|
||||||
_Tp __d(cosh(__2r) + cos(__2i));
|
_Tp __d(cosh(__2r) + cos(__2i));
|
||||||
_Tp __2rsh(sinh(__2r));
|
return complex<_Tp>(sinh(__2r)/__d, sin(__2i)/__d);
|
||||||
if (isinf(__2rsh) && isinf(__d))
|
|
||||||
return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1),
|
|
||||||
__2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
|
|
||||||
return complex<_Tp>(__2rsh/__d, sin(__2i)/__d);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// asin
|
// asin
|
||||||
@@ -1521,47 +1509,6 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
|
|||||||
return __os << __s.str();
|
return __os << __s.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
// Literal suffix for complex number literals [complex.literals]
|
|
||||||
inline namespace literals
|
|
||||||
{
|
|
||||||
inline namespace complex_literals
|
|
||||||
{
|
|
||||||
constexpr complex<long double> operator""il(long double __im)
|
|
||||||
{
|
|
||||||
return { 0.0l, __im };
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr complex<long double> operator""il(unsigned long long __im)
|
|
||||||
{
|
|
||||||
return { 0.0l, static_cast<long double>(__im) };
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
constexpr complex<double> operator""i(long double __im)
|
|
||||||
{
|
|
||||||
return { 0.0, static_cast<double>(__im) };
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr complex<double> operator""i(unsigned long long __im)
|
|
||||||
{
|
|
||||||
return { 0.0, static_cast<double>(__im) };
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
constexpr complex<float> operator""if(long double __im)
|
|
||||||
{
|
|
||||||
return { 0.0f, static_cast<float>(__im) };
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr complex<float> operator""if(unsigned long long __im)
|
|
||||||
{
|
|
||||||
return { 0.0f, static_cast<float>(__im) };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
#endif // _LIBCPP_COMPLEX
|
#endif // _LIBCPP_COMPLEX
|
||||||
|
|||||||
@@ -18,12 +18,6 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <__config>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#include <ccomplex>
|
#include <ccomplex>
|
||||||
@@ -34,4 +28,6 @@
|
|||||||
|
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#pragma GCC system_header
|
||||||
|
|
||||||
#endif // _LIBCPP_COMPLEX_H
|
#endif // _LIBCPP_COMPLEX_H
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ public:
|
|||||||
condition_variable(const condition_variable&) = delete;
|
condition_variable(const condition_variable&) = delete;
|
||||||
condition_variable& operator=(const condition_variable&) = delete;
|
condition_variable& operator=(const condition_variable&) = delete;
|
||||||
|
|
||||||
void notify_one() noexcept;
|
void notify_one();
|
||||||
void notify_all() noexcept;
|
void notify_all();
|
||||||
|
|
||||||
void wait(unique_lock<mutex>& lock);
|
void wait(unique_lock<mutex>& lock);
|
||||||
template <class Predicate>
|
template <class Predicate>
|
||||||
@@ -72,8 +72,8 @@ public:
|
|||||||
condition_variable_any(const condition_variable_any&) = delete;
|
condition_variable_any(const condition_variable_any&) = delete;
|
||||||
condition_variable_any& operator=(const condition_variable_any&) = delete;
|
condition_variable_any& operator=(const condition_variable_any&) = delete;
|
||||||
|
|
||||||
void notify_one() noexcept;
|
void notify_one();
|
||||||
void notify_all() noexcept;
|
void notify_all();
|
||||||
|
|
||||||
template <class Lock>
|
template <class Lock>
|
||||||
void wait(Lock& lock);
|
void wait(Lock& lock);
|
||||||
@@ -111,31 +111,23 @@ public:
|
|||||||
#include <__mutex_base>
|
#include <__mutex_base>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
class _LIBCPP_TYPE_VIS condition_variable_any
|
class _LIBCPP_VISIBLE condition_variable_any
|
||||||
{
|
{
|
||||||
condition_variable __cv_;
|
condition_variable __cv_;
|
||||||
shared_ptr<mutex> __mut_;
|
shared_ptr<mutex> __mut_;
|
||||||
public:
|
public:
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
condition_variable_any();
|
condition_variable_any();
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
void notify_one();
|
||||||
void notify_one() _NOEXCEPT;
|
void notify_all();
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
void notify_all() _NOEXCEPT;
|
|
||||||
|
|
||||||
template <class _Lock>
|
template <class _Lock>
|
||||||
void wait(_Lock& __lock);
|
void wait(_Lock& __lock);
|
||||||
template <class _Lock, class _Predicate>
|
template <class _Lock, class _Predicate>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
void wait(_Lock& __lock, _Predicate __pred);
|
void wait(_Lock& __lock, _Predicate __pred);
|
||||||
|
|
||||||
template <class _Lock, class _Clock, class _Duration>
|
template <class _Lock, class _Clock, class _Duration>
|
||||||
@@ -145,42 +137,39 @@ public:
|
|||||||
|
|
||||||
template <class _Lock, class _Clock, class _Duration, class _Predicate>
|
template <class _Lock, class _Clock, class _Duration, class _Predicate>
|
||||||
bool
|
bool
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
wait_until(_Lock& __lock,
|
wait_until(_Lock& __lock,
|
||||||
const chrono::time_point<_Clock, _Duration>& __t,
|
const chrono::time_point<_Clock, _Duration>& __t,
|
||||||
_Predicate __pred);
|
_Predicate __pred);
|
||||||
|
|
||||||
template <class _Lock, class _Rep, class _Period>
|
template <class _Lock, class _Rep, class _Period>
|
||||||
cv_status
|
cv_status
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
wait_for(_Lock& __lock,
|
wait_for(_Lock& __lock,
|
||||||
const chrono::duration<_Rep, _Period>& __d);
|
const chrono::duration<_Rep, _Period>& __d);
|
||||||
|
|
||||||
template <class _Lock, class _Rep, class _Period, class _Predicate>
|
template <class _Lock, class _Rep, class _Period, class _Predicate>
|
||||||
bool
|
bool
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
wait_for(_Lock& __lock,
|
wait_for(_Lock& __lock,
|
||||||
const chrono::duration<_Rep, _Period>& __d,
|
const chrono::duration<_Rep, _Period>& __d,
|
||||||
_Predicate __pred);
|
_Predicate __pred);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
condition_variable_any::condition_variable_any()
|
condition_variable_any::condition_variable_any()
|
||||||
: __mut_(make_shared<mutex>()) {}
|
: __mut_(make_shared<mutex>()) {}
|
||||||
|
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
condition_variable_any::notify_one() _NOEXCEPT
|
condition_variable_any::notify_one()
|
||||||
{
|
{
|
||||||
{lock_guard<mutex> __lx(*__mut_);}
|
{lock_guard<mutex> _(*__mut_);}
|
||||||
__cv_.notify_one();
|
__cv_.notify_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
condition_variable_any::notify_all() _NOEXCEPT
|
condition_variable_any::notify_all()
|
||||||
{
|
{
|
||||||
{lock_guard<mutex> __lx(*__mut_);}
|
{lock_guard<mutex> _(*__mut_);}
|
||||||
__cv_.notify_all();
|
__cv_.notify_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,13 +186,13 @@ condition_variable_any::wait(_Lock& __lock)
|
|||||||
shared_ptr<mutex> __mut = __mut_;
|
shared_ptr<mutex> __mut = __mut_;
|
||||||
unique_lock<mutex> __lk(*__mut);
|
unique_lock<mutex> __lk(*__mut);
|
||||||
__lock.unlock();
|
__lock.unlock();
|
||||||
unique_ptr<_Lock, __lock_external> __lxx(&__lock);
|
unique_ptr<_Lock, __lock_external> __(&__lock);
|
||||||
lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock);
|
lock_guard<unique_lock<mutex> > _(__lk, adopt_lock);
|
||||||
__cv_.wait(__lk);
|
__cv_.wait(__lk);
|
||||||
} // __mut_.unlock(), __lock.lock()
|
} // __mut_.unlock(), __lock.lock()
|
||||||
|
|
||||||
template <class _Lock, class _Predicate>
|
template <class _Lock, class _Predicate>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
condition_variable_any::wait(_Lock& __lock, _Predicate __pred)
|
condition_variable_any::wait(_Lock& __lock, _Predicate __pred)
|
||||||
{
|
{
|
||||||
@@ -219,13 +208,13 @@ condition_variable_any::wait_until(_Lock& __lock,
|
|||||||
shared_ptr<mutex> __mut = __mut_;
|
shared_ptr<mutex> __mut = __mut_;
|
||||||
unique_lock<mutex> __lk(*__mut);
|
unique_lock<mutex> __lk(*__mut);
|
||||||
__lock.unlock();
|
__lock.unlock();
|
||||||
unique_ptr<_Lock, __lock_external> __lxx(&__lock);
|
unique_ptr<_Lock, __lock_external> __(&__lock);
|
||||||
lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock);
|
lock_guard<unique_lock<mutex> > _(__lk, adopt_lock);
|
||||||
return __cv_.wait_until(__lk, __t);
|
return __cv_.wait_until(__lk, __t);
|
||||||
} // __mut_.unlock(), __lock.lock()
|
} // __mut_.unlock(), __lock.lock()
|
||||||
|
|
||||||
template <class _Lock, class _Clock, class _Duration, class _Predicate>
|
template <class _Lock, class _Clock, class _Duration, class _Predicate>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
condition_variable_any::wait_until(_Lock& __lock,
|
condition_variable_any::wait_until(_Lock& __lock,
|
||||||
const chrono::time_point<_Clock, _Duration>& __t,
|
const chrono::time_point<_Clock, _Duration>& __t,
|
||||||
@@ -238,7 +227,7 @@ condition_variable_any::wait_until(_Lock& __lock,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Lock, class _Rep, class _Period>
|
template <class _Lock, class _Rep, class _Period>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
cv_status
|
cv_status
|
||||||
condition_variable_any::wait_for(_Lock& __lock,
|
condition_variable_any::wait_for(_Lock& __lock,
|
||||||
const chrono::duration<_Rep, _Period>& __d)
|
const chrono::duration<_Rep, _Period>& __d)
|
||||||
@@ -247,7 +236,7 @@ condition_variable_any::wait_for(_Lock& __lock,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Lock, class _Rep, class _Period, class _Predicate>
|
template <class _Lock, class _Rep, class _Period, class _Predicate>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
bool
|
bool
|
||||||
condition_variable_any::wait_for(_Lock& __lock,
|
condition_variable_any::wait_for(_Lock& __lock,
|
||||||
const chrono::duration<_Rep, _Period>& __d,
|
const chrono::duration<_Rep, _Period>& __d,
|
||||||
@@ -257,11 +246,9 @@ condition_variable_any::wait_for(_Lock& __lock,
|
|||||||
_VSTD::move(__pred));
|
_VSTD::move(__pred));
|
||||||
}
|
}
|
||||||
|
|
||||||
_LIBCPP_FUNC_VIS
|
_LIBCPP_VISIBLE
|
||||||
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
|
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
|
||||||
|
|
||||||
#endif // _LIBCPP_CONDITION_VARIABLE
|
#endif // _LIBCPP_CONDITION_VARIABLE
|
||||||
|
|||||||
@@ -34,8 +34,10 @@ void longjmp(jmp_buf env, int val);
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
|
|
||||||
|
#ifndef setjmp
|
||||||
|
#define setjmp(env) setjmp(env)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|||||||
@@ -43,9 +43,7 @@ int raise(int sig);
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
|
|||||||
@@ -35,9 +35,7 @@ Types:
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
|
|||||||
@@ -22,9 +22,7 @@ Macros:
|
|||||||
|
|
||||||
#include <__config>
|
#include <__config>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef __bool_true_false_are_defined
|
#undef __bool_true_false_are_defined
|
||||||
#define __bool_true_false_are_defined 1
|
#define __bool_true_false_are_defined 1
|
||||||
|
|||||||
@@ -35,26 +35,66 @@ Types:
|
|||||||
|
|
||||||
#include <__config>
|
#include <__config>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
#ifdef __GLIBC__
|
||||||
#pragma GCC system_header
|
#define __need_NULL
|
||||||
#endif
|
#define __need_ptrdiff_t
|
||||||
|
#define __need_size_t
|
||||||
|
#endif // __GLIBC__
|
||||||
|
|
||||||
// Don't include our own <stddef.h>; we don't want to declare ::nullptr_t.
|
#include <stddef.h>
|
||||||
#include_next <stddef.h>
|
|
||||||
#include <__nullptr>
|
#pragma GCC system_header
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
using ::ptrdiff_t;
|
using ::ptrdiff_t;
|
||||||
using ::size_t;
|
using ::size_t;
|
||||||
|
|
||||||
#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T)
|
|
||||||
// Re-use the compiler's <stddef.h> max_align_t where possible.
|
|
||||||
using ::max_align_t;
|
|
||||||
#else
|
|
||||||
typedef long double max_align_t;
|
typedef long double max_align_t;
|
||||||
#endif
|
|
||||||
|
#ifdef _LIBCPP_HAS_NO_NULLPTR
|
||||||
|
|
||||||
|
struct _LIBCPP_VISIBLE nullptr_t
|
||||||
|
{
|
||||||
|
void* _;
|
||||||
|
|
||||||
|
struct __nat {int __for_bool_;};
|
||||||
|
|
||||||
|
_LIBCPP_ALWAYS_INLINE nullptr_t(int __nat::*) {}
|
||||||
|
|
||||||
|
_LIBCPP_ALWAYS_INLINE operator int __nat::*() const {return 0;}
|
||||||
|
|
||||||
|
template <class _Tp>
|
||||||
|
_LIBCPP_ALWAYS_INLINE
|
||||||
|
operator _Tp* () const {return 0;}
|
||||||
|
|
||||||
|
template <class _Tp, class _Up>
|
||||||
|
_LIBCPP_ALWAYS_INLINE
|
||||||
|
operator _Tp _Up::* () const {return 0;}
|
||||||
|
|
||||||
|
friend _LIBCPP_ALWAYS_INLINE bool operator==(nullptr_t, nullptr_t) {return true;}
|
||||||
|
friend _LIBCPP_ALWAYS_INLINE bool operator!=(nullptr_t, nullptr_t) {return false;}
|
||||||
|
friend _LIBCPP_ALWAYS_INLINE bool operator<(nullptr_t, nullptr_t) {return false;}
|
||||||
|
friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, nullptr_t) {return true;}
|
||||||
|
friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, nullptr_t) {return false;}
|
||||||
|
friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, nullptr_t) {return true;}
|
||||||
|
};
|
||||||
|
|
||||||
|
inline _LIBCPP_ALWAYS_INLINE nullptr_t __get_nullptr_t() {return nullptr_t(0);}
|
||||||
|
|
||||||
|
#define nullptr _VSTD::__get_nullptr_t()
|
||||||
|
|
||||||
|
#endif // _LIBCPP_HAS_NO_NULLPTR
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
|
#ifndef _LIBCPP_HAS_NO_NULLPTR
|
||||||
|
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
|
typedef decltype(nullptr) nullptr_t;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // _LIBCPP_HAS_NO_NULLPTR
|
||||||
|
|
||||||
#endif // _LIBCPP_CSTDDEF
|
#endif // _LIBCPP_CSTDDEF
|
||||||
|
|||||||
@@ -144,9 +144,7 @@ Types:
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ int fputc(int c, FILE* stream);
|
|||||||
int fputs(const char* restrict s, FILE* restrict stream);
|
int fputs(const char* restrict s, FILE* restrict stream);
|
||||||
int getc(FILE* stream);
|
int getc(FILE* stream);
|
||||||
int getchar(void);
|
int getchar(void);
|
||||||
char* gets(char* s); // removed in C++14
|
char* gets(char* s);
|
||||||
int putc(int c, FILE* stream);
|
int putc(int c, FILE* stream);
|
||||||
int putchar(int c);
|
int putchar(int c);
|
||||||
int puts(const char* s);
|
int puts(const char* s);
|
||||||
@@ -99,9 +99,7 @@ void perror(const char* s);
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
@@ -109,28 +107,40 @@ using ::FILE;
|
|||||||
using ::fpos_t;
|
using ::fpos_t;
|
||||||
using ::size_t;
|
using ::size_t;
|
||||||
|
|
||||||
|
using ::remove;
|
||||||
|
using ::rename;
|
||||||
|
using ::tmpfile;
|
||||||
|
using ::tmpnam;
|
||||||
using ::fclose;
|
using ::fclose;
|
||||||
using ::fflush;
|
using ::fflush;
|
||||||
|
using ::fopen;
|
||||||
|
using ::freopen;
|
||||||
using ::setbuf;
|
using ::setbuf;
|
||||||
using ::setvbuf;
|
using ::setvbuf;
|
||||||
using ::fprintf;
|
using ::fprintf;
|
||||||
using ::fscanf;
|
using ::fscanf;
|
||||||
|
using ::printf;
|
||||||
|
using ::scanf;
|
||||||
using ::snprintf;
|
using ::snprintf;
|
||||||
using ::sprintf;
|
using ::sprintf;
|
||||||
using ::sscanf;
|
using ::sscanf;
|
||||||
#ifndef _LIBCPP_MSVCRT
|
|
||||||
using ::vfprintf;
|
using ::vfprintf;
|
||||||
using ::vfscanf;
|
using ::vfscanf;
|
||||||
using ::vsscanf;
|
using ::vprintf;
|
||||||
#endif // _LIBCPP_MSVCRT
|
using ::vscanf;
|
||||||
using ::vsnprintf;
|
using ::vsnprintf;
|
||||||
using ::vsprintf;
|
using ::vsprintf;
|
||||||
|
using ::vsscanf;
|
||||||
using ::fgetc;
|
using ::fgetc;
|
||||||
using ::fgets;
|
using ::fgets;
|
||||||
using ::fputc;
|
using ::fputc;
|
||||||
using ::fputs;
|
using ::fputs;
|
||||||
using ::getc;
|
using ::getc;
|
||||||
|
using ::getchar;
|
||||||
|
using ::gets;
|
||||||
using ::putc;
|
using ::putc;
|
||||||
|
using ::putchar;
|
||||||
|
using ::puts;
|
||||||
using ::ungetc;
|
using ::ungetc;
|
||||||
using ::fread;
|
using ::fread;
|
||||||
using ::fwrite;
|
using ::fwrite;
|
||||||
@@ -144,31 +154,6 @@ using ::feof;
|
|||||||
using ::ferror;
|
using ::ferror;
|
||||||
using ::perror;
|
using ::perror;
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
|
||||||
using ::fopen;
|
|
||||||
using ::freopen;
|
|
||||||
using ::remove;
|
|
||||||
using ::rename;
|
|
||||||
using ::tmpfile;
|
|
||||||
using ::tmpnam;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_STDIN
|
|
||||||
using ::getchar;
|
|
||||||
#if _LIBCPP_STD_VER <= 11
|
|
||||||
using ::gets;
|
|
||||||
#endif
|
|
||||||
using ::scanf;
|
|
||||||
using ::vscanf;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_STDOUT
|
|
||||||
using ::printf;
|
|
||||||
using ::putchar;
|
|
||||||
using ::puts;
|
|
||||||
using ::vprintf;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
#endif // _LIBCPP_CSTDIO
|
#endif // _LIBCPP_CSTDIO
|
||||||
|
|||||||
@@ -74,9 +74,6 @@ int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n);
|
|||||||
int wctomb(char* s, wchar_t wchar);
|
int wctomb(char* s, wchar_t wchar);
|
||||||
size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n);
|
size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n);
|
||||||
size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n);
|
size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n);
|
||||||
int at_quick_exit(void (*func)(void)) // C++11
|
|
||||||
void quick_exit(int status); // C++11
|
|
||||||
void *aligned_alloc(size_t alignment, size_t size); // C11
|
|
||||||
|
|
||||||
} // std
|
} // std
|
||||||
|
|
||||||
@@ -85,35 +82,25 @@ void *aligned_alloc(size_t alignment, size_t size); // C11
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
using ::size_t;
|
using ::size_t;
|
||||||
using ::div_t;
|
using ::div_t;
|
||||||
using ::ldiv_t;
|
using ::ldiv_t;
|
||||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
|
||||||
using ::lldiv_t;
|
using ::lldiv_t;
|
||||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
|
||||||
using ::atof;
|
using ::atof;
|
||||||
using ::atoi;
|
using ::atoi;
|
||||||
using ::atol;
|
using ::atol;
|
||||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
|
||||||
using ::atoll;
|
using ::atoll;
|
||||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
|
||||||
using ::strtod;
|
using ::strtod;
|
||||||
using ::strtof;
|
using ::strtof;
|
||||||
using ::strtold;
|
using ::strtold;
|
||||||
using ::strtol;
|
using ::strtol;
|
||||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
|
||||||
using ::strtoll;
|
using ::strtoll;
|
||||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
|
||||||
using ::strtoul;
|
using ::strtoul;
|
||||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
|
||||||
using ::strtoull;
|
using ::strtoull;
|
||||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
|
||||||
using ::rand;
|
using ::rand;
|
||||||
using ::srand;
|
using ::srand;
|
||||||
using ::calloc;
|
using ::calloc;
|
||||||
@@ -130,28 +117,21 @@ using ::bsearch;
|
|||||||
using ::qsort;
|
using ::qsort;
|
||||||
using ::abs;
|
using ::abs;
|
||||||
using ::labs;
|
using ::labs;
|
||||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
|
||||||
using ::llabs;
|
using ::llabs;
|
||||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
|
||||||
using ::div;
|
using ::div;
|
||||||
using ::ldiv;
|
using ::ldiv;
|
||||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
|
||||||
using ::lldiv;
|
using ::lldiv;
|
||||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
|
||||||
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
|
|
||||||
using ::mblen;
|
using ::mblen;
|
||||||
using ::mbtowc;
|
using ::mbtowc;
|
||||||
using ::wctomb;
|
using ::wctomb;
|
||||||
#endif
|
|
||||||
using ::mbstowcs;
|
using ::mbstowcs;
|
||||||
using ::wcstombs;
|
using ::wcstombs;
|
||||||
#ifdef _LIBCPP_HAS_QUICK_EXIT
|
|
||||||
using ::at_quick_exit;
|
inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) {return labs(__x);}
|
||||||
using ::quick_exit;
|
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) {return llabs(__x);}
|
||||||
#endif
|
|
||||||
#ifdef _LIBCPP_HAS_C11_FEATURES
|
inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) {return ldiv(__x, __y);}
|
||||||
using ::aligned_alloc;
|
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) {return lldiv(__x, __y);}
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
|
|||||||
@@ -60,9 +60,7 @@ size_t strlen(const char* s);
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
@@ -93,8 +91,7 @@ using ::strspn;
|
|||||||
|
|
||||||
using ::strstr;
|
using ::strstr;
|
||||||
|
|
||||||
// MSVCRT, GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus
|
#ifndef __GLIBC__ // GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus
|
||||||
#if !defined(__GLIBC__) && !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_STRING_H_CPLUSPLUS_98_CONFORMANCE_)
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY char* strchr( char* __s, int __c) {return ::strchr(__s, __c);}
|
inline _LIBCPP_INLINE_VISIBILITY char* strchr( char* __s, int __c) {return ::strchr(__s, __c);}
|
||||||
inline _LIBCPP_INLINE_VISIBILITY char* strpbrk( char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}
|
inline _LIBCPP_INLINE_VISIBILITY char* strpbrk( char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}
|
||||||
inline _LIBCPP_INLINE_VISIBILITY char* strrchr( char* __s, int __c) {return ::strrchr(__s, __c);}
|
inline _LIBCPP_INLINE_VISIBILITY char* strrchr( char* __s, int __c) {return ::strrchr(__s, __c);}
|
||||||
@@ -102,9 +99,7 @@ inline _LIBCPP_INLINE_VISIBILITY void* memchr( void* __s, int __c, si
|
|||||||
inline _LIBCPP_INLINE_VISIBILITY char* strstr( char* __s1, const char* __s2) {return ::strstr(__s1, __s2);}
|
inline _LIBCPP_INLINE_VISIBILITY char* strstr( char* __s1, const char* __s2) {return ::strstr(__s1, __s2);}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
|
|
||||||
using ::strtok;
|
using ::strtok;
|
||||||
#endif
|
|
||||||
using ::memset;
|
using ::memset;
|
||||||
using ::strerror;
|
using ::strerror;
|
||||||
using ::strlen;
|
using ::strlen;
|
||||||
|
|||||||
@@ -22,8 +22,6 @@
|
|||||||
#include <ccomplex>
|
#include <ccomplex>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // _LIBCPP_CTGMATH
|
#endif // _LIBCPP_CTGMATH
|
||||||
|
|||||||
@@ -47,9 +47,7 @@ size_t strftime(char* restrict s, size_t maxsize, const char* restrict format,
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
@@ -61,12 +59,10 @@ using ::clock;
|
|||||||
using ::difftime;
|
using ::difftime;
|
||||||
using ::mktime;
|
using ::mktime;
|
||||||
using ::time;
|
using ::time;
|
||||||
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
|
|
||||||
using ::asctime;
|
using ::asctime;
|
||||||
using ::ctime;
|
using ::ctime;
|
||||||
using ::gmtime;
|
using ::gmtime;
|
||||||
using ::localtime;
|
using ::localtime;
|
||||||
#endif
|
|
||||||
using ::strftime;
|
using ::strftime;
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|||||||
@@ -1,69 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
//===---------------------------- ctype.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_CTYPE_H
|
|
||||||
#define _LIBCPP_CTYPE_H
|
|
||||||
|
|
||||||
/*
|
|
||||||
ctype.h synopsis
|
|
||||||
|
|
||||||
int isalnum(int c);
|
|
||||||
int isalpha(int c);
|
|
||||||
int isblank(int c); // C99
|
|
||||||
int iscntrl(int c);
|
|
||||||
int isdigit(int c);
|
|
||||||
int isgraph(int c);
|
|
||||||
int islower(int c);
|
|
||||||
int isprint(int c);
|
|
||||||
int ispunct(int c);
|
|
||||||
int isspace(int c);
|
|
||||||
int isupper(int c);
|
|
||||||
int isxdigit(int c);
|
|
||||||
int tolower(int c);
|
|
||||||
int toupper(int c);
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <__config>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include_next <ctype.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
|
|
||||||
#if defined(_LIBCPP_MSVCRT)
|
|
||||||
// We support including .h headers inside 'extern "C"' contexts, so switch
|
|
||||||
// back to C++ linkage before including these C++ headers.
|
|
||||||
extern "C++" {
|
|
||||||
#include "support/win32/support.h"
|
|
||||||
#include "support/win32/locale_win32.h"
|
|
||||||
}
|
|
||||||
#endif // _LIBCPP_MSVCRT
|
|
||||||
|
|
||||||
#undef isalnum
|
|
||||||
#undef isalpha
|
|
||||||
#undef isblank
|
|
||||||
#undef iscntrl
|
|
||||||
#undef isdigit
|
|
||||||
#undef isgraph
|
|
||||||
#undef islower
|
|
||||||
#undef isprint
|
|
||||||
#undef ispunct
|
|
||||||
#undef isspace
|
|
||||||
#undef isupper
|
|
||||||
#undef isxdigit
|
|
||||||
#undef tolower
|
|
||||||
#undef toupper
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // _LIBCPP_CTYPE_H
|
|
||||||
@@ -107,9 +107,7 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
|
|||||||
#include <cwctype>
|
#include <cwctype>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
@@ -121,34 +119,32 @@ using ::FILE;
|
|||||||
using ::fwprintf;
|
using ::fwprintf;
|
||||||
using ::fwscanf;
|
using ::fwscanf;
|
||||||
using ::swprintf;
|
using ::swprintf;
|
||||||
using ::vfwprintf;
|
|
||||||
using ::vswprintf;
|
|
||||||
#ifndef _LIBCPP_MSVCRT
|
|
||||||
using ::swscanf;
|
using ::swscanf;
|
||||||
|
using ::vfwprintf;
|
||||||
using ::vfwscanf;
|
using ::vfwscanf;
|
||||||
|
using ::vswprintf;
|
||||||
using ::vswscanf;
|
using ::vswscanf;
|
||||||
#endif // _LIBCPP_MSVCRT
|
using ::vwprintf;
|
||||||
|
using ::vwscanf;
|
||||||
|
using ::wprintf;
|
||||||
|
using ::wscanf;
|
||||||
using ::fgetwc;
|
using ::fgetwc;
|
||||||
using ::fgetws;
|
using ::fgetws;
|
||||||
using ::fputwc;
|
using ::fputwc;
|
||||||
using ::fputws;
|
using ::fputws;
|
||||||
using ::fwide;
|
using ::fwide;
|
||||||
using ::getwc;
|
using ::getwc;
|
||||||
|
using ::getwchar;
|
||||||
using ::putwc;
|
using ::putwc;
|
||||||
|
using ::putwchar;
|
||||||
using ::ungetwc;
|
using ::ungetwc;
|
||||||
using ::wcstod;
|
using ::wcstod;
|
||||||
#ifndef _LIBCPP_MSVCRT
|
|
||||||
using ::wcstof;
|
using ::wcstof;
|
||||||
using ::wcstold;
|
using ::wcstold;
|
||||||
#endif // _LIBCPP_MSVCRT
|
|
||||||
using ::wcstol;
|
using ::wcstol;
|
||||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
|
||||||
using ::wcstoll;
|
using ::wcstoll;
|
||||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
|
||||||
using ::wcstoul;
|
using ::wcstoul;
|
||||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
|
||||||
using ::wcstoull;
|
using ::wcstoull;
|
||||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
|
||||||
using ::wcscpy;
|
using ::wcscpy;
|
||||||
using ::wcsncpy;
|
using ::wcsncpy;
|
||||||
using ::wcscat;
|
using ::wcscat;
|
||||||
@@ -158,33 +154,28 @@ using ::wcscoll;
|
|||||||
using ::wcsncmp;
|
using ::wcsncmp;
|
||||||
using ::wcsxfrm;
|
using ::wcsxfrm;
|
||||||
|
|
||||||
#ifdef _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS
|
|
||||||
using ::wcschr;
|
|
||||||
using ::wcspbrk;
|
|
||||||
using ::wcsrchr;
|
|
||||||
using ::wcsstr;
|
|
||||||
using ::wmemchr;
|
|
||||||
#else
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
|
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
|
||||||
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcschr( wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
|
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcschr( wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
|
||||||
|
|
||||||
|
using ::wcscspn;
|
||||||
|
using ::wcslen;
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
|
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
|
||||||
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcspbrk( wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
|
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcspbrk( wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
|
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
|
||||||
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsrchr( wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
|
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsrchr( wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
|
||||||
|
|
||||||
|
using ::wcsspn;
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
|
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
|
||||||
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsstr( wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
|
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsstr( wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
|
||||||
|
|
||||||
|
using ::wcstok;
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
|
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
|
||||||
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wmemchr( wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
|
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wmemchr( wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
|
||||||
#endif
|
|
||||||
|
|
||||||
using ::wcscspn;
|
|
||||||
using ::wcslen;
|
|
||||||
using ::wcsspn;
|
|
||||||
using ::wcstok;
|
|
||||||
using ::wmemcmp;
|
using ::wmemcmp;
|
||||||
using ::wmemcpy;
|
using ::wmemcpy;
|
||||||
using ::wmemmove;
|
using ::wmemmove;
|
||||||
@@ -199,20 +190,6 @@ using ::wcrtomb;
|
|||||||
using ::mbsrtowcs;
|
using ::mbsrtowcs;
|
||||||
using ::wcsrtombs;
|
using ::wcsrtombs;
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_STDIN
|
|
||||||
using ::getwchar;
|
|
||||||
#ifndef _LIBCPP_MSVCRT
|
|
||||||
using ::vwscanf;
|
|
||||||
#endif // _LIBCPP_MSVCRT
|
|
||||||
using ::wscanf;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_STDOUT
|
|
||||||
using ::putwchar;
|
|
||||||
using ::vwprintf;
|
|
||||||
using ::wprintf;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
#endif // _LIBCPP_CWCHAR
|
#endif // _LIBCPP_CWCHAR
|
||||||
|
|||||||
128
include/cwctype
128
include/cwctype
@@ -54,33 +54,157 @@ wctrans_t wctrans(const char* property);
|
|||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <wctype.h>
|
#include <wctype.h>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
using ::wint_t;
|
using ::wint_t;
|
||||||
using ::wctrans_t;
|
using ::wctrans_t;
|
||||||
using ::wctype_t;
|
using ::wctype_t;
|
||||||
|
|
||||||
|
#ifdef iswalnum
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswalnum(wint_t __wc) {return iswalnum(__wc);}
|
||||||
|
#undef iswalnum
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int iswalnum(wint_t __wc) {return __libcpp_iswalnum(__wc);}
|
||||||
|
#else // iswalnum
|
||||||
using ::iswalnum;
|
using ::iswalnum;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef iswalpha
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswalpha(wint_t __wc) {return iswalpha(__wc);}
|
||||||
|
#undef iswalpha
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int iswalpha(wint_t __wc) {return __libcpp_iswalpha(__wc);}
|
||||||
|
#else // iswalpha
|
||||||
using ::iswalpha;
|
using ::iswalpha;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef iswblank
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswblank(wint_t __wc) {return iswblank(__wc);}
|
||||||
|
#undef iswblank
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int iswblank(wint_t __wc) {return __libcpp_iswblank(__wc);}
|
||||||
|
#else // iswblank
|
||||||
using ::iswblank;
|
using ::iswblank;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef iswcntrl
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswcntrl(wint_t __wc) {return iswcntrl(__wc);}
|
||||||
|
#undef iswcntrl
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int iswcntrl(wint_t __wc) {return __libcpp_iswcntrl(__wc);}
|
||||||
|
#else // iswcntrl
|
||||||
using ::iswcntrl;
|
using ::iswcntrl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef iswdigit
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswdigit(wint_t __wc) {return iswdigit(__wc);}
|
||||||
|
#undef iswdigit
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int iswdigit(wint_t __wc) {return __libcpp_iswdigit(__wc);}
|
||||||
|
#else // iswdigit
|
||||||
using ::iswdigit;
|
using ::iswdigit;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef iswgraph
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswgraph(wint_t __wc) {return iswgraph(__wc);}
|
||||||
|
#undef iswgraph
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int iswgraph(wint_t __wc) {return __libcpp_iswgraph(__wc);}
|
||||||
|
#else // iswgraph
|
||||||
using ::iswgraph;
|
using ::iswgraph;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef iswlower
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswlower(wint_t __wc) {return iswlower(__wc);}
|
||||||
|
#undef iswlower
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int iswlower(wint_t __wc) {return __libcpp_iswlower(__wc);}
|
||||||
|
#else // iswlower
|
||||||
using ::iswlower;
|
using ::iswlower;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef iswprint
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswprint(wint_t __wc) {return iswprint(__wc);}
|
||||||
|
#undef iswprint
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int iswprint(wint_t __wc) {return __libcpp_iswprint(__wc);}
|
||||||
|
#else // iswprint
|
||||||
using ::iswprint;
|
using ::iswprint;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef iswpunct
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswpunct(wint_t __wc) {return iswpunct(__wc);}
|
||||||
|
#undef iswpunct
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int iswpunct(wint_t __wc) {return __libcpp_iswpunct(__wc);}
|
||||||
|
#else // iswpunct
|
||||||
using ::iswpunct;
|
using ::iswpunct;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef iswspace
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswspace(wint_t __wc) {return iswspace(__wc);}
|
||||||
|
#undef iswspace
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int iswspace(wint_t __wc) {return __libcpp_iswspace(__wc);}
|
||||||
|
#else // iswspace
|
||||||
using ::iswspace;
|
using ::iswspace;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef iswupper
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswupper(wint_t __wc) {return iswupper(__wc);}
|
||||||
|
#undef iswupper
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int iswupper(wint_t __wc) {return __libcpp_iswupper(__wc);}
|
||||||
|
#else // iswupper
|
||||||
using ::iswupper;
|
using ::iswupper;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef iswxdigit
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswxdigit(wint_t __wc) {return iswxdigit(__wc);}
|
||||||
|
#undef iswxdigit
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int iswxdigit(wint_t __wc) {return __libcpp_iswxdigit(__wc);}
|
||||||
|
#else // iswxdigit
|
||||||
using ::iswxdigit;
|
using ::iswxdigit;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef iswctype
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswctype(wint_t __w, wctype_t __d) {return iswctype(__w, __d);}
|
||||||
|
#undef iswctype
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY int iswctype(wint_t __w, wctype_t __d) {return __libcpp_iswctype(__w, __d);}
|
||||||
|
#else // iswctype
|
||||||
using ::iswctype;
|
using ::iswctype;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef wctype
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY wctype_t __libcpp_wctype(const char* __p) {return wctype(__p);}
|
||||||
|
#undef wctype
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY wctype_t wctype(const char* __p) {return __libcpp_wctype(__p);}
|
||||||
|
#else // wctype
|
||||||
using ::wctype;
|
using ::wctype;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef towlower
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towlower(wint_t __wc) {return towlower(__wc);}
|
||||||
|
#undef towlower
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY wint_t towlower(wint_t __wc) {return __libcpp_towlower(__wc);}
|
||||||
|
#else // towlower
|
||||||
using ::towlower;
|
using ::towlower;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef towupper
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towupper(wint_t __wc) {return towupper(__wc);}
|
||||||
|
#undef towupper
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY wint_t towupper(wint_t __wc) {return __libcpp_towupper(__wc);}
|
||||||
|
#else // towupper
|
||||||
using ::towupper;
|
using ::towupper;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef towctrans
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towctrans(wint_t __wc, wctype_t __d) {return towctrans(__wc, __d);}
|
||||||
|
#undef towctrans
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY wint_t towctrans(wint_t __wc, wctype_t __d) {return __libcpp_towctrans(__wc, __d);}
|
||||||
|
#else // towctrans
|
||||||
using ::towctrans;
|
using ::towctrans;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef wctrans
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY wctrans_t __libcpp_wctrans(const char* __p) {return wctrans(__p);}
|
||||||
|
#undef wctrans
|
||||||
|
inline _LIBCPP_INLINE_VISIBILITY wctrans_t wctrans(const char* __p) {return __libcpp_wctrans(__p);}
|
||||||
|
#else // wctrans
|
||||||
using ::wctrans;
|
using ::wctrans;
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
_LIBCPP_END_NAMESPACE_STD
|
||||||
|
|
||||||
|
|||||||
369
include/deque
369
include/deque
@@ -41,7 +41,6 @@ public:
|
|||||||
deque() noexcept(is_nothrow_default_constructible<allocator_type>::value);
|
deque() noexcept(is_nothrow_default_constructible<allocator_type>::value);
|
||||||
explicit deque(const allocator_type& a);
|
explicit deque(const allocator_type& a);
|
||||||
explicit deque(size_type n);
|
explicit deque(size_type n);
|
||||||
explicit deque(size_type n, const allocator_type& a); // C++14
|
|
||||||
deque(size_type n, const value_type& v);
|
deque(size_type n, const value_type& v);
|
||||||
deque(size_type n, const value_type& v, const allocator_type& a);
|
deque(size_type n, const value_type& v, const allocator_type& a);
|
||||||
template <class InputIterator>
|
template <class InputIterator>
|
||||||
@@ -117,14 +116,15 @@ public:
|
|||||||
iterator insert(const_iterator p, value_type&& v);
|
iterator insert(const_iterator p, value_type&& v);
|
||||||
iterator insert(const_iterator p, size_type n, const value_type& v);
|
iterator insert(const_iterator p, size_type n, const value_type& v);
|
||||||
template <class InputIterator>
|
template <class InputIterator>
|
||||||
iterator insert(const_iterator p, InputIterator f, InputIterator l);
|
iterator insert (const_iterator p, InputIterator f, InputIterator l);
|
||||||
iterator insert(const_iterator p, initializer_list<value_type> il);
|
iterator insert(const_iterator p, initializer_list<value_type> il);
|
||||||
void pop_front();
|
void pop_front();
|
||||||
void pop_back();
|
void pop_back();
|
||||||
iterator erase(const_iterator p);
|
iterator erase(const_iterator p);
|
||||||
iterator erase(const_iterator f, const_iterator l);
|
iterator erase(const_iterator f, const_iterator l);
|
||||||
void swap(deque& c)
|
void swap(deque& c)
|
||||||
noexcept(allocator_traits<allocator_type>::is_always_equal::value); // C++17
|
noexcept(!allocator_type::propagate_on_container_swap::value ||
|
||||||
|
__is_nothrow_swappable<allocator_type>::value);
|
||||||
void clear() noexcept;
|
void clear() noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -150,9 +150,7 @@ template <class T, class Allocator>
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <__config>
|
#include <__config>
|
||||||
#include <__split_buffer>
|
#include <__split_buffer>
|
||||||
@@ -162,16 +160,13 @@ template <class T, class Allocator>
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
#include <__undef_min_max>
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
template <class _Tp, class _Allocator> class __deque_base;
|
template <class _Tp, class _Allocator> class __deque_base;
|
||||||
template <class _Tp, class _Allocator = allocator<_Tp> > class _LIBCPP_TYPE_VIS_ONLY deque;
|
|
||||||
|
|
||||||
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
|
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
|
||||||
class _DiffType, _DiffType _BlockSize>
|
class _DiffType, _DiffType _BlockSize>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY __deque_iterator;
|
class _LIBCPP_VISIBLE __deque_iterator;
|
||||||
|
|
||||||
template <class _RAIter,
|
template <class _RAIter,
|
||||||
class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
|
class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
|
||||||
@@ -261,22 +256,9 @@ move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
|
|||||||
__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
|
__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
|
||||||
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
|
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
|
||||||
|
|
||||||
template <class _ValueType, class _DiffType>
|
|
||||||
struct __deque_block_size {
|
|
||||||
static const _DiffType value = sizeof(_ValueType) < 256 ? 4096 / sizeof(_ValueType) : 16;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
|
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
|
||||||
class _DiffType, _DiffType _BS =
|
class _DiffType, _DiffType _BlockSize>
|
||||||
#ifdef _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
|
class _LIBCPP_VISIBLE __deque_iterator
|
||||||
// Keep template parameter to avoid changing all template declarations thoughout
|
|
||||||
// this file.
|
|
||||||
0
|
|
||||||
#else
|
|
||||||
__deque_block_size<_ValueType, _DiffType>::value
|
|
||||||
#endif
|
|
||||||
>
|
|
||||||
class _LIBCPP_TYPE_VIS_ONLY __deque_iterator
|
|
||||||
{
|
{
|
||||||
typedef _MapPointer __map_iterator;
|
typedef _MapPointer __map_iterator;
|
||||||
public:
|
public:
|
||||||
@@ -286,22 +268,18 @@ private:
|
|||||||
__map_iterator __m_iter_;
|
__map_iterator __m_iter_;
|
||||||
pointer __ptr_;
|
pointer __ptr_;
|
||||||
|
|
||||||
static const difference_type __block_size;
|
static const difference_type __block_size = _BlockSize;
|
||||||
public:
|
public:
|
||||||
typedef _ValueType value_type;
|
typedef _ValueType value_type;
|
||||||
typedef random_access_iterator_tag iterator_category;
|
typedef random_access_iterator_tag iterator_category;
|
||||||
typedef _Reference reference;
|
typedef _Reference reference;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY __deque_iterator() _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY __deque_iterator() _NOEXCEPT {}
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
: __m_iter_(nullptr), __ptr_(nullptr)
|
|
||||||
#endif
|
|
||||||
{}
|
|
||||||
|
|
||||||
template <class _Pp, class _Rp, class _MP>
|
template <class _P, class _R, class _MP>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__deque_iterator(const __deque_iterator<value_type, _Pp, _Rp, _MP, difference_type, _BS>& __it,
|
__deque_iterator(const __deque_iterator<value_type, _P, _R, _MP, difference_type, __block_size>& __it,
|
||||||
typename enable_if<is_convertible<_Pp, pointer>::value>::type* = 0) _NOEXCEPT
|
typename enable_if<is_convertible<_P, pointer>::value>::type* = 0) _NOEXCEPT
|
||||||
: __m_iter_(__it.__m_iter_), __ptr_(__it.__ptr_) {}
|
: __m_iter_(__it.__m_iter_), __ptr_(__it.__ptr_) {}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return *__ptr_;}
|
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return *__ptr_;}
|
||||||
@@ -427,10 +405,10 @@ private:
|
|||||||
_LIBCPP_INLINE_VISIBILITY __deque_iterator(__map_iterator __m, pointer __p) _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY __deque_iterator(__map_iterator __m, pointer __p) _NOEXCEPT
|
||||||
: __m_iter_(__m), __ptr_(__p) {}
|
: __m_iter_(__m), __ptr_(__p) {}
|
||||||
|
|
||||||
template <class _Tp, class _Ap> friend class __deque_base;
|
template <class _Tp, class _A> friend class __deque_base;
|
||||||
template <class _Tp, class _Ap> friend class _LIBCPP_TYPE_VIS_ONLY deque;
|
template <class _Tp, class _A> friend class _LIBCPP_VISIBLE deque;
|
||||||
template <class _Vp, class _Pp, class _Rp, class _MP, class _Dp, _Dp>
|
template <class _V, class _P, class _R, class _MP, class _D, _D>
|
||||||
friend class _LIBCPP_TYPE_VIS_ONLY __deque_iterator;
|
friend class _LIBCPP_VISIBLE __deque_iterator;
|
||||||
|
|
||||||
template <class _RAIter,
|
template <class _RAIter,
|
||||||
class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
|
class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
|
||||||
@@ -533,12 +511,6 @@ private:
|
|||||||
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
|
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
|
|
||||||
class _DiffType, _DiffType _BlockSize>
|
|
||||||
const _DiffType __deque_iterator<_ValueType, _Pointer, _Reference, _MapPointer,
|
|
||||||
_DiffType, _BlockSize>::__block_size =
|
|
||||||
__deque_block_size<_ValueType, _DiffType>::value;
|
|
||||||
|
|
||||||
// copy
|
// copy
|
||||||
|
|
||||||
template <class _RAIter,
|
template <class _RAIter,
|
||||||
@@ -551,11 +523,10 @@ copy(_RAIter __f,
|
|||||||
{
|
{
|
||||||
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
|
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
|
||||||
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
|
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
|
||||||
const difference_type __block_size = __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::__block_size;
|
|
||||||
while (__f != __l)
|
while (__f != __l)
|
||||||
{
|
{
|
||||||
pointer __rb = __r.__ptr_;
|
pointer __rb = __r.__ptr_;
|
||||||
pointer __re = *__r.__m_iter_ + __block_size;
|
pointer __re = *__r.__m_iter_ + _B2;
|
||||||
difference_type __bs = __re - __rb;
|
difference_type __bs = __re - __rb;
|
||||||
difference_type __n = __l - __f;
|
difference_type __n = __l - __f;
|
||||||
_RAIter __m = __l;
|
_RAIter __m = __l;
|
||||||
@@ -580,12 +551,11 @@ copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
|
|||||||
{
|
{
|
||||||
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
|
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
|
||||||
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
|
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
|
||||||
const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size;
|
|
||||||
difference_type __n = __l - __f;
|
difference_type __n = __l - __f;
|
||||||
while (__n > 0)
|
while (__n > 0)
|
||||||
{
|
{
|
||||||
pointer __fb = __f.__ptr_;
|
pointer __fb = __f.__ptr_;
|
||||||
pointer __fe = *__f.__m_iter_ + __block_size;
|
pointer __fe = *__f.__m_iter_ + _B1;
|
||||||
difference_type __bs = __fe - __fb;
|
difference_type __bs = __fe - __fb;
|
||||||
if (__bs > __n)
|
if (__bs > __n)
|
||||||
{
|
{
|
||||||
@@ -608,12 +578,11 @@ copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
|
|||||||
{
|
{
|
||||||
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
|
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
|
||||||
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
|
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
|
||||||
const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size;
|
|
||||||
difference_type __n = __l - __f;
|
difference_type __n = __l - __f;
|
||||||
while (__n > 0)
|
while (__n > 0)
|
||||||
{
|
{
|
||||||
pointer __fb = __f.__ptr_;
|
pointer __fb = __f.__ptr_;
|
||||||
pointer __fe = *__f.__m_iter_ + __block_size;
|
pointer __fe = *__f.__m_iter_ + _B1;
|
||||||
difference_type __bs = __fe - __fb;
|
difference_type __bs = __fe - __fb;
|
||||||
if (__bs > __n)
|
if (__bs > __n)
|
||||||
{
|
{
|
||||||
@@ -727,11 +696,10 @@ move(_RAIter __f,
|
|||||||
{
|
{
|
||||||
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
|
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
|
||||||
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
|
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
|
||||||
const difference_type __block_size = __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::__block_size;
|
|
||||||
while (__f != __l)
|
while (__f != __l)
|
||||||
{
|
{
|
||||||
pointer __rb = __r.__ptr_;
|
pointer __rb = __r.__ptr_;
|
||||||
pointer __re = *__r.__m_iter_ + __block_size;
|
pointer __re = *__r.__m_iter_ + _B2;
|
||||||
difference_type __bs = __re - __rb;
|
difference_type __bs = __re - __rb;
|
||||||
difference_type __n = __l - __f;
|
difference_type __n = __l - __f;
|
||||||
_RAIter __m = __l;
|
_RAIter __m = __l;
|
||||||
@@ -756,12 +724,11 @@ move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
|
|||||||
{
|
{
|
||||||
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
|
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
|
||||||
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
|
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
|
||||||
const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size;
|
|
||||||
difference_type __n = __l - __f;
|
difference_type __n = __l - __f;
|
||||||
while (__n > 0)
|
while (__n > 0)
|
||||||
{
|
{
|
||||||
pointer __fb = __f.__ptr_;
|
pointer __fb = __f.__ptr_;
|
||||||
pointer __fe = *__f.__m_iter_ + __block_size;
|
pointer __fe = *__f.__m_iter_ + _B1;
|
||||||
difference_type __bs = __fe - __fb;
|
difference_type __bs = __fe - __fb;
|
||||||
if (__bs > __n)
|
if (__bs > __n)
|
||||||
{
|
{
|
||||||
@@ -784,12 +751,11 @@ move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
|
|||||||
{
|
{
|
||||||
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
|
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
|
||||||
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
|
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
|
||||||
const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size;
|
|
||||||
difference_type __n = __l - __f;
|
difference_type __n = __l - __f;
|
||||||
while (__n > 0)
|
while (__n > 0)
|
||||||
{
|
{
|
||||||
pointer __fb = __f.__ptr_;
|
pointer __fb = __f.__ptr_;
|
||||||
pointer __fe = *__f.__m_iter_ + __block_size;
|
pointer __fe = *__f.__m_iter_ + _B1;
|
||||||
difference_type __bs = __fe - __fb;
|
difference_type __bs = __fe - __fb;
|
||||||
if (__bs > __n)
|
if (__bs > __n)
|
||||||
{
|
{
|
||||||
@@ -934,19 +900,24 @@ protected:
|
|||||||
typedef typename __alloc_traits::pointer pointer;
|
typedef typename __alloc_traits::pointer pointer;
|
||||||
typedef typename __alloc_traits::const_pointer const_pointer;
|
typedef typename __alloc_traits::const_pointer const_pointer;
|
||||||
|
|
||||||
static const difference_type __block_size;
|
static const difference_type __block_size = sizeof(value_type) < 256 ? 4096 / sizeof(value_type) : 16;
|
||||||
|
|
||||||
typedef typename __rebind_alloc_helper<__alloc_traits, pointer>::type __pointer_allocator;
|
typedef typename __alloc_traits::template
|
||||||
|
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
|
rebind_alloc<pointer>
|
||||||
|
#else
|
||||||
|
rebind_alloc<pointer>::other
|
||||||
|
#endif
|
||||||
|
__pointer_allocator;
|
||||||
typedef allocator_traits<__pointer_allocator> __map_traits;
|
typedef allocator_traits<__pointer_allocator> __map_traits;
|
||||||
typedef typename __map_traits::pointer __map_pointer;
|
typedef typename __map_traits::pointer __map_pointer;
|
||||||
typedef typename __rebind_alloc_helper<__alloc_traits, const_pointer>::type __const_pointer_allocator;
|
typedef typename __map_traits::const_pointer __map_const_pointer;
|
||||||
typedef typename allocator_traits<__const_pointer_allocator>::const_pointer __map_const_pointer;
|
|
||||||
typedef __split_buffer<pointer, __pointer_allocator> __map;
|
typedef __split_buffer<pointer, __pointer_allocator> __map;
|
||||||
|
|
||||||
typedef __deque_iterator<value_type, pointer, reference, __map_pointer,
|
typedef __deque_iterator<value_type, pointer, reference, __map_pointer,
|
||||||
difference_type> iterator;
|
difference_type, __block_size> iterator;
|
||||||
typedef __deque_iterator<value_type, const_pointer, const_reference, __map_const_pointer,
|
typedef __deque_iterator<value_type, const_pointer, const_reference, __map_const_pointer,
|
||||||
difference_type> const_iterator;
|
difference_type, __block_size> const_iterator;
|
||||||
|
|
||||||
__map __map_;
|
__map __map_;
|
||||||
size_type __start_;
|
size_type __start_;
|
||||||
@@ -964,10 +935,8 @@ protected:
|
|||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
const allocator_type& __alloc() const _NOEXCEPT {return __size_.second();}
|
const allocator_type& __alloc() const _NOEXCEPT {return __size_.second();}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
__deque_base()
|
__deque_base()
|
||||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
|
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
explicit __deque_base(const allocator_type& __a);
|
explicit __deque_base(const allocator_type& __a);
|
||||||
public:
|
public:
|
||||||
~__deque_base();
|
~__deque_base();
|
||||||
@@ -980,12 +949,8 @@ public:
|
|||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
void swap(__deque_base& __c)
|
void swap(__deque_base& __c)
|
||||||
#if _LIBCPP_STD_VER >= 14
|
|
||||||
_NOEXCEPT;
|
|
||||||
#else
|
|
||||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||||
__is_nothrow_swappable<allocator_type>::value);
|
__is_nothrow_swappable<allocator_type>::value);
|
||||||
#endif
|
|
||||||
protected:
|
protected:
|
||||||
void clear() _NOEXCEPT;
|
void clear() _NOEXCEPT;
|
||||||
|
|
||||||
@@ -1012,22 +977,37 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void __move_assign_alloc(__deque_base& __c, true_type)
|
void __move_assign_alloc(const __deque_base& __c, true_type)
|
||||||
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
|
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
|
||||||
{
|
{
|
||||||
__alloc() = _VSTD::move(__c.__alloc());
|
__alloc() = _VSTD::move(__c.__alloc());
|
||||||
}
|
}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void __move_assign_alloc(__deque_base&, false_type) _NOEXCEPT
|
void __move_assign_alloc(const __deque_base& __c, false_type) _NOEXCEPT
|
||||||
|
{}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void __swap_alloc(allocator_type& __x, allocator_type& __y)
|
||||||
|
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||||
|
__is_nothrow_swappable<allocator_type>::value)
|
||||||
|
{__swap_alloc(__x, __y, integral_constant<bool,
|
||||||
|
__alloc_traits::propagate_on_container_swap::value>());}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void __swap_alloc(allocator_type& __x, allocator_type& __y, true_type)
|
||||||
|
_NOEXCEPT_(__is_nothrow_swappable<allocator_type>::value)
|
||||||
|
{
|
||||||
|
using _VSTD::swap;
|
||||||
|
swap(__x, __y);
|
||||||
|
}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type)
|
||||||
|
_NOEXCEPT
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
|
||||||
const typename __deque_base<_Tp, _Allocator>::difference_type
|
|
||||||
__deque_base<_Tp, _Allocator>::__block_size =
|
|
||||||
__deque_block_size<value_type, difference_type>::value;
|
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
bool
|
bool
|
||||||
__deque_base<_Tp, _Allocator>::__invariants() const
|
__deque_base<_Tp, _Allocator>::__invariants() const
|
||||||
@@ -1069,7 +1049,7 @@ template <class _Tp, class _Allocator>
|
|||||||
typename __deque_base<_Tp, _Allocator>::const_iterator
|
typename __deque_base<_Tp, _Allocator>::const_iterator
|
||||||
__deque_base<_Tp, _Allocator>::begin() const _NOEXCEPT
|
__deque_base<_Tp, _Allocator>::begin() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
__map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __start_ / __block_size);
|
__map_const_pointer __mp = __map_.begin() + __start_ / __block_size;
|
||||||
return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size);
|
return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1087,18 +1067,18 @@ typename __deque_base<_Tp, _Allocator>::const_iterator
|
|||||||
__deque_base<_Tp, _Allocator>::end() const _NOEXCEPT
|
__deque_base<_Tp, _Allocator>::end() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
size_type __p = size() + __start_;
|
size_type __p = size() + __start_;
|
||||||
__map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __p / __block_size);
|
__map_const_pointer __mp = __map_.begin() + __p / __block_size;
|
||||||
return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size);
|
return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
__deque_base<_Tp, _Allocator>::__deque_base()
|
__deque_base<_Tp, _Allocator>::__deque_base()
|
||||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
||||||
: __start_(0), __size_(0) {}
|
: __start_(0), __size_(0) {}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
__deque_base<_Tp, _Allocator>::__deque_base(const allocator_type& __a)
|
__deque_base<_Tp, _Allocator>::__deque_base(const allocator_type& __a)
|
||||||
: __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {}
|
: __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {}
|
||||||
|
|
||||||
@@ -1149,17 +1129,13 @@ __deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c, const allocator_
|
|||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
void
|
void
|
||||||
__deque_base<_Tp, _Allocator>::swap(__deque_base& __c)
|
__deque_base<_Tp, _Allocator>::swap(__deque_base& __c)
|
||||||
#if _LIBCPP_STD_VER >= 14
|
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
|
||||||
_NOEXCEPT
|
__is_nothrow_swappable<allocator_type>::value)
|
||||||
#else
|
|
||||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
|
||||||
__is_nothrow_swappable<allocator_type>::value)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
__map_.swap(__c.__map_);
|
__map_.swap(__c.__map_);
|
||||||
_VSTD::swap(__start_, __c.__start_);
|
_VSTD::swap(__start_, __c.__start_);
|
||||||
_VSTD::swap(size(), __c.size());
|
_VSTD::swap(size(), __c.size());
|
||||||
__swap_allocator(__alloc(), __c.__alloc());
|
__swap_alloc(__alloc(), __c.__alloc());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
@@ -1186,8 +1162,8 @@ __deque_base<_Tp, _Allocator>::clear() _NOEXCEPT
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator /*= allocator<_Tp>*/>
|
template <class _Tp, class _Allocator = allocator<_Tp> >
|
||||||
class _LIBCPP_TYPE_VIS_ONLY deque
|
class _LIBCPP_VISIBLE deque
|
||||||
: private __deque_base<_Tp, _Allocator>
|
: private __deque_base<_Tp, _Allocator>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -1196,9 +1172,6 @@ public:
|
|||||||
typedef _Tp value_type;
|
typedef _Tp value_type;
|
||||||
typedef _Allocator allocator_type;
|
typedef _Allocator allocator_type;
|
||||||
|
|
||||||
static_assert((is_same<typename allocator_type::value_type, value_type>::value),
|
|
||||||
"Allocator::value_type must be same type as value_type");
|
|
||||||
|
|
||||||
typedef __deque_base<value_type, allocator_type> __base;
|
typedef __deque_base<value_type, allocator_type> __base;
|
||||||
|
|
||||||
typedef typename __base::__alloc_traits __alloc_traits;
|
typedef typename __base::__alloc_traits __alloc_traits;
|
||||||
@@ -1219,11 +1192,8 @@ public:
|
|||||||
deque()
|
deque()
|
||||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
||||||
{}
|
{}
|
||||||
_LIBCPP_INLINE_VISIBILITY explicit deque(const allocator_type& __a) : __base(__a) {}
|
_LIBCPP_INLINE_VISIBILITY deque(const allocator_type& __a) : __base(__a) {}
|
||||||
explicit deque(size_type __n);
|
explicit deque(size_type __n);
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
explicit deque(size_type __n, const _Allocator& __a);
|
|
||||||
#endif
|
|
||||||
deque(size_type __n, const value_type& __v);
|
deque(size_type __n, const value_type& __v);
|
||||||
deque(size_type __n, const value_type& __v, const allocator_type& __a);
|
deque(size_type __n, const value_type& __v, const allocator_type& __a);
|
||||||
template <class _InputIter>
|
template <class _InputIter>
|
||||||
@@ -1234,23 +1204,16 @@ public:
|
|||||||
typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0);
|
typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0);
|
||||||
deque(const deque& __c);
|
deque(const deque& __c);
|
||||||
deque(const deque& __c, const allocator_type& __a);
|
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);
|
||||||
deque(initializer_list<value_type> __il, const allocator_type& __a);
|
deque(initializer_list<value_type> __il, const allocator_type& __a);
|
||||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
|
|
||||||
deque& operator=(const deque& __c);
|
deque& operator=(const deque& __c);
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
deque& operator=(initializer_list<value_type> __il) {assign(__il); return *this;}
|
deque& operator=(initializer_list<value_type> __il) {assign(__il); return *this;}
|
||||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value);
|
deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value);
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
deque(deque&& __c, const allocator_type& __a);
|
deque(deque&& __c, const allocator_type& __a);
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
deque& operator=(deque&& __c)
|
deque& operator=(deque&& __c)
|
||||||
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
|
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
|
||||||
is_nothrow_move_assignable<allocator_type>::value);
|
is_nothrow_move_assignable<allocator_type>::value);
|
||||||
@@ -1264,12 +1227,9 @@ public:
|
|||||||
void assign(_RAIter __f, _RAIter __l,
|
void assign(_RAIter __f, _RAIter __l,
|
||||||
typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0);
|
typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0);
|
||||||
void assign(size_type __n, const value_type& __v);
|
void assign(size_type __n, const value_type& __v);
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());}
|
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;
|
allocator_type get_allocator() const _NOEXCEPT;
|
||||||
|
|
||||||
// iterators:
|
// iterators:
|
||||||
@@ -1322,21 +1282,13 @@ public:
|
|||||||
bool empty() const _NOEXCEPT {return __base::size() == 0;}
|
bool empty() const _NOEXCEPT {return __base::size() == 0;}
|
||||||
|
|
||||||
// element access:
|
// element access:
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
reference operator[](size_type __i);
|
reference operator[](size_type __i);
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
const_reference operator[](size_type __i) const;
|
const_reference operator[](size_type __i) const;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
reference at(size_type __i);
|
reference at(size_type __i);
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
const_reference at(size_type __i) const;
|
const_reference at(size_type __i) const;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
reference front();
|
reference front();
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
const_reference front() const;
|
const_reference front() const;
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
reference back();
|
reference back();
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
const_reference back() const;
|
const_reference back() const;
|
||||||
|
|
||||||
// 23.2.2.3 modifiers:
|
// 23.2.2.3 modifiers:
|
||||||
@@ -1355,42 +1307,28 @@ public:
|
|||||||
iterator insert(const_iterator __p, const value_type& __v);
|
iterator insert(const_iterator __p, const value_type& __v);
|
||||||
iterator insert(const_iterator __p, size_type __n, const value_type& __v);
|
iterator insert(const_iterator __p, size_type __n, const value_type& __v);
|
||||||
template <class _InputIter>
|
template <class _InputIter>
|
||||||
iterator insert(const_iterator __p, _InputIter __f, _InputIter __l,
|
iterator insert (const_iterator __p, _InputIter __f, _InputIter __l,
|
||||||
typename enable_if<__is_input_iterator<_InputIter>::value
|
typename enable_if<__is_input_iterator<_InputIter>::value
|
||||||
&&!__is_forward_iterator<_InputIter>::value>::type* = 0);
|
&&!__is_bidirectional_iterator<_InputIter>::value>::type* = 0);
|
||||||
template <class _ForwardIterator>
|
|
||||||
iterator insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l,
|
|
||||||
typename enable_if<__is_forward_iterator<_ForwardIterator>::value
|
|
||||||
&&!__is_bidirectional_iterator<_ForwardIterator>::value>::type* = 0);
|
|
||||||
template <class _BiIter>
|
template <class _BiIter>
|
||||||
iterator insert(const_iterator __p, _BiIter __f, _BiIter __l,
|
iterator insert (const_iterator __p, _BiIter __f, _BiIter __l,
|
||||||
typename enable_if<__is_bidirectional_iterator<_BiIter>::value>::type* = 0);
|
typename enable_if<__is_bidirectional_iterator<_BiIter>::value>::type* = 0);
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
iterator insert(const_iterator __p, initializer_list<value_type> __il)
|
iterator insert(const_iterator __p, initializer_list<value_type> __il)
|
||||||
{return insert(__p, __il.begin(), __il.end());}
|
{return insert(__p, __il.begin(), __il.end());}
|
||||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
void pop_front();
|
void pop_front();
|
||||||
void pop_back();
|
void pop_back();
|
||||||
iterator erase(const_iterator __p);
|
iterator erase(const_iterator __p);
|
||||||
iterator erase(const_iterator __f, const_iterator __l);
|
iterator erase(const_iterator __f, const_iterator __l);
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
void swap(deque& __c)
|
void swap(deque& __c)
|
||||||
#if _LIBCPP_STD_VER >= 14
|
|
||||||
_NOEXCEPT;
|
|
||||||
#else
|
|
||||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||||
__is_nothrow_swappable<allocator_type>::value);
|
__is_nothrow_swappable<allocator_type>::value);
|
||||||
#endif
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
void clear() _NOEXCEPT;
|
void clear() _NOEXCEPT;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
bool __invariants() const {return __base::__invariants();}
|
bool __invariants() const {return __base::__invariants();}
|
||||||
private:
|
private:
|
||||||
typedef typename __base::__map_const_pointer __map_const_pointer;
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
static size_type __recommend_blocks(size_type __n)
|
static size_type __recommend_blocks(size_type __n)
|
||||||
{
|
{
|
||||||
@@ -1453,7 +1391,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void __copy_assign_alloc(const deque&, false_type)
|
void __copy_assign_alloc(const deque& __c, false_type)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void __move_assign(deque& __c, true_type)
|
void __move_assign(deque& __c, true_type)
|
||||||
@@ -1468,16 +1406,6 @@ deque<_Tp, _Allocator>::deque(size_type __n)
|
|||||||
__append(__n);
|
__append(__n);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
template <class _Tp, class _Allocator>
|
|
||||||
deque<_Tp, _Allocator>::deque(size_type __n, const _Allocator& __a)
|
|
||||||
: __base(__a)
|
|
||||||
{
|
|
||||||
if (__n > 0)
|
|
||||||
__append(__n);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v)
|
deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v)
|
||||||
{
|
{
|
||||||
@@ -1524,8 +1452,6 @@ deque<_Tp, _Allocator>::deque(const deque& __c, const allocator_type& __a)
|
|||||||
__append(__c.begin(), __c.end());
|
__append(__c.begin(), __c.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il)
|
deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il)
|
||||||
{
|
{
|
||||||
@@ -1539,8 +1465,6 @@ deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il, const allocator
|
|||||||
__append(__il.begin(), __il.end());
|
__append(__il.begin(), __il.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
deque<_Tp, _Allocator>&
|
deque<_Tp, _Allocator>&
|
||||||
deque<_Tp, _Allocator>::operator=(const deque& __c)
|
deque<_Tp, _Allocator>::operator=(const deque& __c)
|
||||||
@@ -1556,7 +1480,7 @@ deque<_Tp, _Allocator>::operator=(const deque& __c)
|
|||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
deque<_Tp, _Allocator>::deque(deque&& __c)
|
deque<_Tp, _Allocator>::deque(deque&& __c)
|
||||||
_NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
|
_NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
|
||||||
: __base(_VSTD::move(__c))
|
: __base(_VSTD::move(__c))
|
||||||
@@ -1564,19 +1488,19 @@ deque<_Tp, _Allocator>::deque(deque&& __c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
deque<_Tp, _Allocator>::deque(deque&& __c, const allocator_type& __a)
|
deque<_Tp, _Allocator>::deque(deque&& __c, const allocator_type& __a)
|
||||||
: __base(_VSTD::move(__c), __a)
|
: __base(_VSTD::move(__c), __a)
|
||||||
{
|
{
|
||||||
if (__a != __c.__alloc())
|
if (__a != __c.__alloc())
|
||||||
{
|
{
|
||||||
typedef move_iterator<iterator> _Ip;
|
typedef move_iterator<iterator> _I;
|
||||||
assign(_Ip(__c.begin()), _Ip(__c.end()));
|
assign(_I(__c.begin()), _I(__c.end()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
deque<_Tp, _Allocator>&
|
deque<_Tp, _Allocator>&
|
||||||
deque<_Tp, _Allocator>::operator=(deque&& __c)
|
deque<_Tp, _Allocator>::operator=(deque&& __c)
|
||||||
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
|
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
|
||||||
@@ -1593,8 +1517,8 @@ deque<_Tp, _Allocator>::__move_assign(deque& __c, false_type)
|
|||||||
{
|
{
|
||||||
if (__base::__alloc() != __c.__alloc())
|
if (__base::__alloc() != __c.__alloc())
|
||||||
{
|
{
|
||||||
typedef move_iterator<iterator> _Ip;
|
typedef move_iterator<iterator> _I;
|
||||||
assign(_Ip(__c.begin()), _Ip(__c.end()));
|
assign(_I(__c.begin()), _I(__c.end()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
__move_assign(__c, true_type());
|
__move_assign(__c, true_type());
|
||||||
@@ -1621,7 +1545,7 @@ deque<_Tp, _Allocator>::assign(_InputIter __f, _InputIter __l,
|
|||||||
{
|
{
|
||||||
iterator __i = __base::begin();
|
iterator __i = __base::begin();
|
||||||
iterator __e = __base::end();
|
iterator __e = __base::end();
|
||||||
for (; __f != __l && __i != __e; ++__f, (void) ++__i)
|
for (; __f != __l && __i != __e; ++__f, ++__i)
|
||||||
*__i = *__f;
|
*__i = *__f;
|
||||||
if (__f != __l)
|
if (__f != __l)
|
||||||
__append(__f, __l);
|
__append(__f, __l);
|
||||||
@@ -1660,7 +1584,7 @@ deque<_Tp, _Allocator>::assign(size_type __n, const value_type& __v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
_Allocator
|
_Allocator
|
||||||
deque<_Tp, _Allocator>::get_allocator() const _NOEXCEPT
|
deque<_Tp, _Allocator>::get_allocator() const _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -1719,7 +1643,7 @@ deque<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
typename deque<_Tp, _Allocator>::reference
|
typename deque<_Tp, _Allocator>::reference
|
||||||
deque<_Tp, _Allocator>::operator[](size_type __i)
|
deque<_Tp, _Allocator>::operator[](size_type __i)
|
||||||
{
|
{
|
||||||
@@ -1728,7 +1652,7 @@ deque<_Tp, _Allocator>::operator[](size_type __i)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
typename deque<_Tp, _Allocator>::const_reference
|
typename deque<_Tp, _Allocator>::const_reference
|
||||||
deque<_Tp, _Allocator>::operator[](size_type __i) const
|
deque<_Tp, _Allocator>::operator[](size_type __i) const
|
||||||
{
|
{
|
||||||
@@ -1737,7 +1661,7 @@ deque<_Tp, _Allocator>::operator[](size_type __i) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
typename deque<_Tp, _Allocator>::reference
|
typename deque<_Tp, _Allocator>::reference
|
||||||
deque<_Tp, _Allocator>::at(size_type __i)
|
deque<_Tp, _Allocator>::at(size_type __i)
|
||||||
{
|
{
|
||||||
@@ -1748,7 +1672,7 @@ deque<_Tp, _Allocator>::at(size_type __i)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
typename deque<_Tp, _Allocator>::const_reference
|
typename deque<_Tp, _Allocator>::const_reference
|
||||||
deque<_Tp, _Allocator>::at(size_type __i) const
|
deque<_Tp, _Allocator>::at(size_type __i) const
|
||||||
{
|
{
|
||||||
@@ -1759,7 +1683,7 @@ deque<_Tp, _Allocator>::at(size_type __i) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
typename deque<_Tp, _Allocator>::reference
|
typename deque<_Tp, _Allocator>::reference
|
||||||
deque<_Tp, _Allocator>::front()
|
deque<_Tp, _Allocator>::front()
|
||||||
{
|
{
|
||||||
@@ -1768,7 +1692,7 @@ deque<_Tp, _Allocator>::front()
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
typename deque<_Tp, _Allocator>::const_reference
|
typename deque<_Tp, _Allocator>::const_reference
|
||||||
deque<_Tp, _Allocator>::front() const
|
deque<_Tp, _Allocator>::front() const
|
||||||
{
|
{
|
||||||
@@ -1777,7 +1701,7 @@ deque<_Tp, _Allocator>::front() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
typename deque<_Tp, _Allocator>::reference
|
typename deque<_Tp, _Allocator>::reference
|
||||||
deque<_Tp, _Allocator>::back()
|
deque<_Tp, _Allocator>::back()
|
||||||
{
|
{
|
||||||
@@ -1786,7 +1710,7 @@ deque<_Tp, _Allocator>::back()
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
typename deque<_Tp, _Allocator>::const_reference
|
typename deque<_Tp, _Allocator>::const_reference
|
||||||
deque<_Tp, _Allocator>::back() const
|
deque<_Tp, _Allocator>::back() const
|
||||||
{
|
{
|
||||||
@@ -2026,7 +1950,6 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
value_type __tmp(_VSTD::forward<_Args>(__args)...);
|
|
||||||
iterator __b = __base::begin();
|
iterator __b = __base::begin();
|
||||||
iterator __bm1 = _VSTD::prev(__b);
|
iterator __bm1 = _VSTD::prev(__b);
|
||||||
__alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b));
|
__alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b));
|
||||||
@@ -2034,7 +1957,7 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
|
|||||||
++__base::size();
|
++__base::size();
|
||||||
if (__pos > 1)
|
if (__pos > 1)
|
||||||
__b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b);
|
__b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b);
|
||||||
*__b = _VSTD::move(__tmp);
|
*__b = value_type(_VSTD::forward<_Args>(__args)...);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2050,14 +1973,13 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
value_type __tmp(_VSTD::forward<_Args>(__args)...);
|
|
||||||
iterator __e = __base::end();
|
iterator __e = __base::end();
|
||||||
iterator __em1 = _VSTD::prev(__e);
|
iterator __em1 = _VSTD::prev(__e);
|
||||||
__alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1));
|
__alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1));
|
||||||
++__base::size();
|
++__base::size();
|
||||||
if (__de > 1)
|
if (__de > 1)
|
||||||
__e = _VSTD::move_backward(__e - __de, __em1, __e);
|
__e = _VSTD::move_backward(__e - __de, __em1, __e);
|
||||||
*--__e = _VSTD::move(__tmp);
|
*--__e = value_type(_VSTD::forward<_Args>(__args)...);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return __base::begin() + __pos;
|
return __base::begin() + __pos;
|
||||||
@@ -2078,6 +2000,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_ty
|
|||||||
if (__n > __front_spare())
|
if (__n > __front_spare())
|
||||||
__add_front_capacity(__n - __front_spare());
|
__add_front_capacity(__n - __front_spare());
|
||||||
// __n <= __front_spare()
|
// __n <= __front_spare()
|
||||||
|
size_type __old_n = __n;
|
||||||
iterator __old_begin = __base::begin();
|
iterator __old_begin = __base::begin();
|
||||||
iterator __i = __old_begin;
|
iterator __i = __old_begin;
|
||||||
if (__n > __pos)
|
if (__n > __pos)
|
||||||
@@ -2102,6 +2025,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_ty
|
|||||||
if (__n > __back_capacity)
|
if (__n > __back_capacity)
|
||||||
__add_back_capacity(__n - __back_capacity);
|
__add_back_capacity(__n - __back_capacity);
|
||||||
// __n <= __back_capacity
|
// __n <= __back_capacity
|
||||||
|
size_type __old_n = __n;
|
||||||
iterator __old_end = __base::end();
|
iterator __old_end = __base::end();
|
||||||
iterator __i = __old_end;
|
iterator __i = __old_end;
|
||||||
size_type __de = __base::size() - __pos;
|
size_type __de = __base::size() - __pos;
|
||||||
@@ -2129,7 +2053,7 @@ template <class _InputIter>
|
|||||||
typename deque<_Tp, _Allocator>::iterator
|
typename deque<_Tp, _Allocator>::iterator
|
||||||
deque<_Tp, _Allocator>::insert(const_iterator __p, _InputIter __f, _InputIter __l,
|
deque<_Tp, _Allocator>::insert(const_iterator __p, _InputIter __f, _InputIter __l,
|
||||||
typename enable_if<__is_input_iterator<_InputIter>::value
|
typename enable_if<__is_input_iterator<_InputIter>::value
|
||||||
&&!__is_forward_iterator<_InputIter>::value>::type*)
|
&&!__is_bidirectional_iterator<_InputIter>::value>::type*)
|
||||||
{
|
{
|
||||||
__split_buffer<value_type, allocator_type&> __buf(__base::__alloc());
|
__split_buffer<value_type, allocator_type&> __buf(__base::__alloc());
|
||||||
__buf.__construct_at_end(__f, __l);
|
__buf.__construct_at_end(__f, __l);
|
||||||
@@ -2137,20 +2061,6 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _InputIter __f, _InputIter __
|
|||||||
return insert(__p, move_iterator<__bi>(__buf.begin()), move_iterator<__bi>(__buf.end()));
|
return insert(__p, move_iterator<__bi>(__buf.begin()), move_iterator<__bi>(__buf.end()));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
|
||||||
template <class _ForwardIterator>
|
|
||||||
typename deque<_Tp, _Allocator>::iterator
|
|
||||||
deque<_Tp, _Allocator>::insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l,
|
|
||||||
typename enable_if<__is_forward_iterator<_ForwardIterator>::value
|
|
||||||
&&!__is_bidirectional_iterator<_ForwardIterator>::value>::type*)
|
|
||||||
{
|
|
||||||
size_type __n = _VSTD::distance(__f, __l);
|
|
||||||
__split_buffer<value_type, allocator_type&> __buf(__n, 0, __base::__alloc());
|
|
||||||
__buf.__construct_at_end(__f, __l);
|
|
||||||
typedef typename __split_buffer<value_type, allocator_type&>::iterator __fwd;
|
|
||||||
return insert(__p, move_iterator<__fwd>(__buf.begin()), move_iterator<__fwd>(__buf.end()));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
template <class _BiIter>
|
template <class _BiIter>
|
||||||
typename deque<_Tp, _Allocator>::iterator
|
typename deque<_Tp, _Allocator>::iterator
|
||||||
@@ -2166,6 +2076,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
|
|||||||
if (__n > __front_spare())
|
if (__n > __front_spare())
|
||||||
__add_front_capacity(__n - __front_spare());
|
__add_front_capacity(__n - __front_spare());
|
||||||
// __n <= __front_spare()
|
// __n <= __front_spare()
|
||||||
|
size_type __old_n = __n;
|
||||||
iterator __old_begin = __base::begin();
|
iterator __old_begin = __base::begin();
|
||||||
iterator __i = __old_begin;
|
iterator __i = __old_begin;
|
||||||
_BiIter __m = __f;
|
_BiIter __m = __f;
|
||||||
@@ -2196,6 +2107,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
|
|||||||
if (__n > __back_capacity)
|
if (__n > __back_capacity)
|
||||||
__add_back_capacity(__n - __back_capacity);
|
__add_back_capacity(__n - __back_capacity);
|
||||||
// __n <= __back_capacity
|
// __n <= __back_capacity
|
||||||
|
size_type __old_n = __n;
|
||||||
iterator __old_end = __base::end();
|
iterator __old_end = __base::end();
|
||||||
iterator __i = __old_end;
|
iterator __i = __old_end;
|
||||||
_BiIter __m = __l;
|
_BiIter __m = __l;
|
||||||
@@ -2203,7 +2115,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
|
|||||||
if (__n > __de)
|
if (__n > __de)
|
||||||
{
|
{
|
||||||
__m = __de < __n / 2 ? _VSTD::next(__f, __de) : _VSTD::prev(__l, __n - __de);
|
__m = __de < __n / 2 ? _VSTD::next(__f, __de) : _VSTD::prev(__l, __n - __de);
|
||||||
for (_BiIter __j = __m; __j != __l; ++__i, (void) ++__j, ++__base::size())
|
for (_BiIter __j = __m; __j != __l; ++__i, ++__j, ++__base::size())
|
||||||
__alloc_traits::construct(__a, _VSTD::addressof(*__i), *__j);
|
__alloc_traits::construct(__a, _VSTD::addressof(*__i), *__j);
|
||||||
__n = __de;
|
__n = __de;
|
||||||
}
|
}
|
||||||
@@ -2243,7 +2155,7 @@ deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l,
|
|||||||
if (__n > __back_capacity)
|
if (__n > __back_capacity)
|
||||||
__add_back_capacity(__n - __back_capacity);
|
__add_back_capacity(__n - __back_capacity);
|
||||||
// __n <= __back_capacity
|
// __n <= __back_capacity
|
||||||
for (iterator __i = __base::end(); __f != __l; ++__i, (void) ++__f, ++__base::size())
|
for (iterator __i = __base::end(); __f != __l; ++__i, ++__f, ++__base::size())
|
||||||
__alloc_traits::construct(__a, _VSTD::addressof(*__i), *__f);
|
__alloc_traits::construct(__a, _VSTD::addressof(*__i), *__f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2312,14 +2224,19 @@ deque<_Tp, _Allocator>::__add_front_capacity()
|
|||||||
__split_buffer<pointer, typename __base::__pointer_allocator&>
|
__split_buffer<pointer, typename __base::__pointer_allocator&>
|
||||||
__buf(max<size_type>(2 * __base::__map_.capacity(), 1),
|
__buf(max<size_type>(2 * __base::__map_.capacity(), 1),
|
||||||
0, __base::__map_.__alloc());
|
0, __base::__map_.__alloc());
|
||||||
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
typedef __allocator_destructor<_Allocator> _Dp;
|
try
|
||||||
unique_ptr<pointer, _Dp> __hold(
|
{
|
||||||
__alloc_traits::allocate(__a, __base::__block_size),
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
_Dp(__a, __base::__block_size));
|
__buf.push_back(__alloc_traits::allocate(__a, __base::__block_size));
|
||||||
__buf.push_back(__hold.get());
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
__hold.release();
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
__alloc_traits::deallocate(__a, __buf.front(), __base::__block_size);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
for (typename __base::__map_pointer __i = __base::__map_.begin();
|
for (typename __base::__map_pointer __i = __base::__map_.begin();
|
||||||
__i != __base::__map_.end(); ++__i)
|
__i != __base::__map_.end(); ++__i)
|
||||||
__buf.push_back(*__i);
|
__buf.push_back(*__i);
|
||||||
@@ -2455,14 +2372,19 @@ deque<_Tp, _Allocator>::__add_back_capacity()
|
|||||||
__buf(max<size_type>(2* __base::__map_.capacity(), 1),
|
__buf(max<size_type>(2* __base::__map_.capacity(), 1),
|
||||||
__base::__map_.size(),
|
__base::__map_.size(),
|
||||||
__base::__map_.__alloc());
|
__base::__map_.__alloc());
|
||||||
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
typedef __allocator_destructor<_Allocator> _Dp;
|
try
|
||||||
unique_ptr<pointer, _Dp> __hold(
|
{
|
||||||
__alloc_traits::allocate(__a, __base::__block_size),
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
_Dp(__a, __base::__block_size));
|
__buf.push_back(__alloc_traits::allocate(__a, __base::__block_size));
|
||||||
__buf.push_back(__hold.get());
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
__hold.release();
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
__alloc_traits::deallocate(__a, __buf.back(), __base::__block_size);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
for (typename __base::__map_pointer __i = __base::__map_.end();
|
for (typename __base::__map_pointer __i = __base::__map_.end();
|
||||||
__i != __base::__map_.begin();)
|
__i != __base::__map_.begin();)
|
||||||
__buf.push_front(*--__i);
|
__buf.push_front(*--__i);
|
||||||
@@ -2565,9 +2487,9 @@ void
|
|||||||
deque<_Tp, _Allocator>::pop_front()
|
deque<_Tp, _Allocator>::pop_front()
|
||||||
{
|
{
|
||||||
allocator_type& __a = __base::__alloc();
|
allocator_type& __a = __base::__alloc();
|
||||||
__alloc_traits::destroy(__a, __to_raw_pointer(*(__base::__map_.begin() +
|
__alloc_traits::destroy(__a, *(__base::__map_.begin() +
|
||||||
__base::__start_ / __base::__block_size) +
|
__base::__start_ / __base::__block_size) +
|
||||||
__base::__start_ % __base::__block_size));
|
__base::__start_ % __base::__block_size);
|
||||||
--__base::size();
|
--__base::size();
|
||||||
if (++__base::__start_ >= 2 * __base::__block_size)
|
if (++__base::__start_ >= 2 * __base::__block_size)
|
||||||
{
|
{
|
||||||
@@ -2583,9 +2505,9 @@ deque<_Tp, _Allocator>::pop_back()
|
|||||||
{
|
{
|
||||||
allocator_type& __a = __base::__alloc();
|
allocator_type& __a = __base::__alloc();
|
||||||
size_type __p = __base::size() + __base::__start_ - 1;
|
size_type __p = __base::size() + __base::__start_ - 1;
|
||||||
__alloc_traits::destroy(__a, __to_raw_pointer(*(__base::__map_.begin() +
|
__alloc_traits::destroy(__a, *(__base::__map_.begin() +
|
||||||
__p / __base::__block_size) +
|
__p / __base::__block_size) +
|
||||||
__p % __base::__block_size));
|
__p % __base::__block_size);
|
||||||
--__base::size();
|
--__base::size();
|
||||||
if (__back_spare() >= 2 * __base::__block_size)
|
if (__back_spare() >= 2 * __base::__block_size)
|
||||||
{
|
{
|
||||||
@@ -2616,7 +2538,7 @@ deque<_Tp, _Allocator>::__move_and_check(iterator __f, iterator __l, iterator __
|
|||||||
__fe = __fb + __bs;
|
__fe = __fb + __bs;
|
||||||
}
|
}
|
||||||
if (__fb <= __vt && __vt < __fe)
|
if (__fb <= __vt && __vt < __fe)
|
||||||
__vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) -= __f - __r).__ptr_;
|
__vt = (const_iterator(__f.__m_iter_, __vt) -= __f - __r).__ptr_;
|
||||||
__r = _VSTD::move(__fb, __fe, __r);
|
__r = _VSTD::move(__fb, __fe, __r);
|
||||||
__n -= __bs;
|
__n -= __bs;
|
||||||
__f += __bs;
|
__f += __bs;
|
||||||
@@ -2647,7 +2569,7 @@ deque<_Tp, _Allocator>::__move_backward_and_check(iterator __f, iterator __l, it
|
|||||||
__lb = __le - __bs;
|
__lb = __le - __bs;
|
||||||
}
|
}
|
||||||
if (__lb <= __vt && __vt < __le)
|
if (__lb <= __vt && __vt < __le)
|
||||||
__vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) += __r - __l - 1).__ptr_;
|
__vt = (const_iterator(__l.__m_iter_, __vt) += __r - __l - 1).__ptr_;
|
||||||
__r = _VSTD::move_backward(__lb, __le, __r);
|
__r = _VSTD::move_backward(__lb, __le, __r);
|
||||||
__n -= __bs;
|
__n -= __bs;
|
||||||
__l -= __bs - 1;
|
__l -= __bs - 1;
|
||||||
@@ -2678,7 +2600,7 @@ deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator __l,
|
|||||||
__fe = __fb + __bs;
|
__fe = __fb + __bs;
|
||||||
}
|
}
|
||||||
if (__fb <= __vt && __vt < __fe)
|
if (__fb <= __vt && __vt < __fe)
|
||||||
__vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) += __r - __f).__ptr_;
|
__vt = (const_iterator(__f.__m_iter_, __vt) += __r - __f).__ptr_;
|
||||||
for (; __fb != __fe; ++__fb, ++__r, ++__base::size())
|
for (; __fb != __fe; ++__fb, ++__r, ++__base::size())
|
||||||
__alloc_traits::construct(__a, _VSTD::addressof(*__r), _VSTD::move(*__fb));
|
__alloc_traits::construct(__a, _VSTD::addressof(*__r), _VSTD::move(*__fb));
|
||||||
__n -= __bs;
|
__n -= __bs;
|
||||||
@@ -2714,7 +2636,7 @@ deque<_Tp, _Allocator>::__move_construct_backward_and_check(iterator __f, iterat
|
|||||||
__lb = __le - __bs;
|
__lb = __le - __bs;
|
||||||
}
|
}
|
||||||
if (__lb <= __vt && __vt < __le)
|
if (__lb <= __vt && __vt < __le)
|
||||||
__vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) -= __l - __r + 1).__ptr_;
|
__vt = (const_iterator(__l.__m_iter_, __vt) -= __l - __r + 1).__ptr_;
|
||||||
while (__le != __lb)
|
while (__le != __lb)
|
||||||
{
|
{
|
||||||
__alloc_traits::construct(__a, _VSTD::addressof(*--__r), _VSTD::move(*--__le));
|
__alloc_traits::construct(__a, _VSTD::addressof(*--__r), _VSTD::move(*--__le));
|
||||||
@@ -2730,11 +2652,12 @@ template <class _Tp, class _Allocator>
|
|||||||
typename deque<_Tp, _Allocator>::iterator
|
typename deque<_Tp, _Allocator>::iterator
|
||||||
deque<_Tp, _Allocator>::erase(const_iterator __f)
|
deque<_Tp, _Allocator>::erase(const_iterator __f)
|
||||||
{
|
{
|
||||||
|
difference_type __n = 1;
|
||||||
iterator __b = __base::begin();
|
iterator __b = __base::begin();
|
||||||
difference_type __pos = __f - __b;
|
difference_type __pos = __f - __b;
|
||||||
iterator __p = __b + __pos;
|
iterator __p = __b + __pos;
|
||||||
allocator_type& __a = __base::__alloc();
|
allocator_type& __a = __base::__alloc();
|
||||||
if (__pos <= (__base::size() - 1) / 2)
|
if (__pos < (__base::size() - 1) / 2)
|
||||||
{ // erase from front
|
{ // erase from front
|
||||||
_VSTD::move_backward(__b, __p, _VSTD::next(__p));
|
_VSTD::move_backward(__b, __p, _VSTD::next(__p));
|
||||||
__alloc_traits::destroy(__a, _VSTD::addressof(*__b));
|
__alloc_traits::destroy(__a, _VSTD::addressof(*__b));
|
||||||
@@ -2772,7 +2695,7 @@ deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l)
|
|||||||
if (__n > 0)
|
if (__n > 0)
|
||||||
{
|
{
|
||||||
allocator_type& __a = __base::__alloc();
|
allocator_type& __a = __base::__alloc();
|
||||||
if (__pos <= (__base::size() - __n) / 2)
|
if (__pos < (__base::size() - __n) / 2)
|
||||||
{ // erase from front
|
{ // erase from front
|
||||||
iterator __i = _VSTD::move_backward(__b, __p, __p + __n);
|
iterator __i = _VSTD::move_backward(__b, __p, __p + __n);
|
||||||
for (; __b != __i; ++__b)
|
for (; __b != __i; ++__b)
|
||||||
@@ -2825,21 +2748,17 @@ deque<_Tp, _Allocator>::__erase_to_end(const_iterator __f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
deque<_Tp, _Allocator>::swap(deque& __c)
|
deque<_Tp, _Allocator>::swap(deque& __c)
|
||||||
#if _LIBCPP_STD_VER >= 14
|
|
||||||
_NOEXCEPT
|
|
||||||
#else
|
|
||||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||||
__is_nothrow_swappable<allocator_type>::value)
|
__is_nothrow_swappable<allocator_type>::value)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
__base::swap(__c);
|
__base::swap(__c);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
deque<_Tp, _Allocator>::clear() _NOEXCEPT
|
deque<_Tp, _Allocator>::clear() _NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -2847,7 +2766,7 @@ deque<_Tp, _Allocator>::clear() _NOEXCEPT
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
bool
|
bool
|
||||||
operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
||||||
{
|
{
|
||||||
@@ -2856,7 +2775,7 @@ operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
bool
|
bool
|
||||||
operator!=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
operator!=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
||||||
{
|
{
|
||||||
@@ -2864,7 +2783,7 @@ operator!=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
bool
|
bool
|
||||||
operator< (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
operator< (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
||||||
{
|
{
|
||||||
@@ -2872,7 +2791,7 @@ operator< (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
bool
|
bool
|
||||||
operator> (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
operator> (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
||||||
{
|
{
|
||||||
@@ -2880,7 +2799,7 @@ operator> (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
bool
|
bool
|
||||||
operator>=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
operator>=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
||||||
{
|
{
|
||||||
@@ -2888,7 +2807,7 @@ operator>=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
bool
|
bool
|
||||||
operator<=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
operator<=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
||||||
{
|
{
|
||||||
@@ -2896,7 +2815,7 @@ operator<=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Allocator>
|
template <class _Tp, class _Allocator>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY inline
|
||||||
void
|
void
|
||||||
swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y)
|
swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y)
|
||||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||||
|
|||||||
398
include/errno.h
398
include/errno.h
@@ -1,398 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
//===-------------------------- errno.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_ERRNO_H
|
|
||||||
#define _LIBCPP_ERRNO_H
|
|
||||||
|
|
||||||
/*
|
|
||||||
errno.h synopsis
|
|
||||||
|
|
||||||
Macros:
|
|
||||||
|
|
||||||
EDOM
|
|
||||||
EILSEQ // C99
|
|
||||||
ERANGE
|
|
||||||
errno
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <__config>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include_next <errno.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
|
|
||||||
#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
|
|
||||||
|
|
||||||
#ifdef ELAST
|
|
||||||
|
|
||||||
static const int __elast1 = ELAST+1;
|
|
||||||
static const int __elast2 = ELAST+2;
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
static const int __elast1 = 104;
|
|
||||||
static const int __elast2 = 105;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENOTRECOVERABLE
|
|
||||||
|
|
||||||
#define EOWNERDEAD __elast1
|
|
||||||
|
|
||||||
#ifdef ELAST
|
|
||||||
#undef ELAST
|
|
||||||
#define ELAST EOWNERDEAD
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(EOWNERDEAD)
|
|
||||||
|
|
||||||
#define ENOTRECOVERABLE __elast1
|
|
||||||
#ifdef ELAST
|
|
||||||
#undef ELAST
|
|
||||||
#define ELAST ENOTRECOVERABLE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else // defined(EOWNERDEAD)
|
|
||||||
|
|
||||||
#define EOWNERDEAD __elast1
|
|
||||||
#define ENOTRECOVERABLE __elast2
|
|
||||||
#ifdef ELAST
|
|
||||||
#undef ELAST
|
|
||||||
#define ELAST ENOTRECOVERABLE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // defined(EOWNERDEAD)
|
|
||||||
|
|
||||||
#endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
|
|
||||||
|
|
||||||
// supply errno values likely to be missing, particularly on Windows
|
|
||||||
|
|
||||||
#ifndef EAFNOSUPPORT
|
|
||||||
#define EAFNOSUPPORT 9901
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EADDRINUSE
|
|
||||||
#define EADDRINUSE 9902
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EADDRNOTAVAIL
|
|
||||||
#define EADDRNOTAVAIL 9903
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EISCONN
|
|
||||||
#define EISCONN 9904
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EBADMSG
|
|
||||||
#define EBADMSG 9905
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ECONNABORTED
|
|
||||||
#define ECONNABORTED 9906
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EALREADY
|
|
||||||
#define EALREADY 9907
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ECONNREFUSED
|
|
||||||
#define ECONNREFUSED 9908
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ECONNRESET
|
|
||||||
#define ECONNRESET 9909
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EDESTADDRREQ
|
|
||||||
#define EDESTADDRREQ 9910
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EHOSTUNREACH
|
|
||||||
#define EHOSTUNREACH 9911
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EIDRM
|
|
||||||
#define EIDRM 9912
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EMSGSIZE
|
|
||||||
#define EMSGSIZE 9913
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENETDOWN
|
|
||||||
#define ENETDOWN 9914
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENETRESET
|
|
||||||
#define ENETRESET 9915
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENETUNREACH
|
|
||||||
#define ENETUNREACH 9916
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOBUFS
|
|
||||||
#define ENOBUFS 9917
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOLINK
|
|
||||||
#define ENOLINK 9918
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENODATA
|
|
||||||
#define ENODATA 9919
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOMSG
|
|
||||||
#define ENOMSG 9920
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOPROTOOPT
|
|
||||||
#define ENOPROTOOPT 9921
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOSR
|
|
||||||
#define ENOSR 9922
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOTSOCK
|
|
||||||
#define ENOTSOCK 9923
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOSTR
|
|
||||||
#define ENOSTR 9924
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOTCONN
|
|
||||||
#define ENOTCONN 9925
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOTSUP
|
|
||||||
#define ENOTSUP 9926
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ECANCELED
|
|
||||||
#define ECANCELED 9927
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EINPROGRESS
|
|
||||||
#define EINPROGRESS 9928
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EOPNOTSUPP
|
|
||||||
#define EOPNOTSUPP 9929
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EWOULDBLOCK
|
|
||||||
#define EWOULDBLOCK 9930
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EOWNERDEAD
|
|
||||||
#define EOWNERDEAD 9931
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EPROTO
|
|
||||||
#define EPROTO 9932
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EPROTONOSUPPORT
|
|
||||||
#define EPROTONOSUPPORT 9933
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOTRECOVERABLE
|
|
||||||
#define ENOTRECOVERABLE 9934
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ETIME
|
|
||||||
#define ETIME 9935
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ETXTBSY
|
|
||||||
#define ETXTBSY 9936
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ETIMEDOUT
|
|
||||||
#define ETIMEDOUT 9938
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ELOOP
|
|
||||||
#define ELOOP 9939
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EOVERFLOW
|
|
||||||
#define EOVERFLOW 9940
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EPROTOTYPE
|
|
||||||
#define EPROTOTYPE 9941
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOSYS
|
|
||||||
#define ENOSYS 9942
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EINVAL
|
|
||||||
#define EINVAL 9943
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ERANGE
|
|
||||||
#define ERANGE 9944
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EILSEQ
|
|
||||||
#define EILSEQ 9945
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Windows Mobile doesn't appear to define these:
|
|
||||||
|
|
||||||
#ifndef E2BIG
|
|
||||||
#define E2BIG 9946
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EDOM
|
|
||||||
#define EDOM 9947
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EFAULT
|
|
||||||
#define EFAULT 9948
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EBADF
|
|
||||||
#define EBADF 9949
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EPIPE
|
|
||||||
#define EPIPE 9950
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EXDEV
|
|
||||||
#define EXDEV 9951
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EBUSY
|
|
||||||
#define EBUSY 9952
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOTEMPTY
|
|
||||||
#define ENOTEMPTY 9953
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOEXEC
|
|
||||||
#define ENOEXEC 9954
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EEXIST
|
|
||||||
#define EEXIST 9955
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EFBIG
|
|
||||||
#define EFBIG 9956
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENAMETOOLONG
|
|
||||||
#define ENAMETOOLONG 9957
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOTTY
|
|
||||||
#define ENOTTY 9958
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EINTR
|
|
||||||
#define EINTR 9959
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ESPIPE
|
|
||||||
#define ESPIPE 9960
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EIO
|
|
||||||
#define EIO 9961
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EISDIR
|
|
||||||
#define EISDIR 9962
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ECHILD
|
|
||||||
#define ECHILD 9963
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOLCK
|
|
||||||
#define ENOLCK 9964
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOSPC
|
|
||||||
#define ENOSPC 9965
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENXIO
|
|
||||||
#define ENXIO 9966
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENODEV
|
|
||||||
#define ENODEV 9967
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOENT
|
|
||||||
#define ENOENT 9968
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ESRCH
|
|
||||||
#define ESRCH 9969
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOTDIR
|
|
||||||
#define ENOTDIR 9970
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENOMEM
|
|
||||||
#define ENOMEM 9971
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EPERM
|
|
||||||
#define EPERM 9972
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EACCES
|
|
||||||
#define EACCES 9973
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EROFS
|
|
||||||
#define EROFS 9974
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EDEADLK
|
|
||||||
#define EDEADLK 9975
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EAGAIN
|
|
||||||
#define EAGAIN 9976
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ENFILE
|
|
||||||
#define ENFILE 9977
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EMFILE
|
|
||||||
#define EMFILE 9978
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EMLINK
|
|
||||||
#define EMLINK 9979
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __cplusplus
|
|
||||||
|
|
||||||
#endif // _LIBCPP_ERRNO_H
|
|
||||||
@@ -48,8 +48,7 @@ terminate_handler set_terminate(terminate_handler f ) noexcept;
|
|||||||
terminate_handler get_terminate() noexcept;
|
terminate_handler get_terminate() noexcept;
|
||||||
[[noreturn]] void terminate() noexcept;
|
[[noreturn]] void terminate() noexcept;
|
||||||
|
|
||||||
bool uncaught_exception() noexcept;
|
bool uncaught_exception() noexcept;
|
||||||
int uncaught_exceptions() noexcept; // C++17
|
|
||||||
|
|
||||||
typedef unspecified exception_ptr;
|
typedef unspecified exception_ptr;
|
||||||
|
|
||||||
@@ -81,9 +80,7 @@ template <class E> void rethrow_if_nested(const E& e);
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace std // purposefully not using versioning namespace
|
namespace std // purposefully not using versioning namespace
|
||||||
{
|
{
|
||||||
@@ -106,24 +103,23 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef void (*unexpected_handler)();
|
typedef void (*unexpected_handler)();
|
||||||
_LIBCPP_FUNC_VIS unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
|
_LIBCPP_VISIBLE unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
|
||||||
_LIBCPP_FUNC_VIS unexpected_handler get_unexpected() _NOEXCEPT;
|
_LIBCPP_VISIBLE unexpected_handler get_unexpected() _NOEXCEPT;
|
||||||
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void unexpected();
|
_ATTRIBUTE(noreturn) _LIBCPP_VISIBLE void unexpected();
|
||||||
|
|
||||||
typedef void (*terminate_handler)();
|
typedef void (*terminate_handler)();
|
||||||
_LIBCPP_FUNC_VIS terminate_handler set_terminate(terminate_handler) _NOEXCEPT;
|
_LIBCPP_VISIBLE terminate_handler set_terminate(terminate_handler) _NOEXCEPT;
|
||||||
_LIBCPP_FUNC_VIS terminate_handler get_terminate() _NOEXCEPT;
|
_LIBCPP_VISIBLE terminate_handler get_terminate() _NOEXCEPT;
|
||||||
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void terminate() _NOEXCEPT;
|
_ATTRIBUTE(noreturn) _LIBCPP_VISIBLE void terminate() _NOEXCEPT;
|
||||||
|
|
||||||
_LIBCPP_FUNC_VIS bool uncaught_exception() _NOEXCEPT;
|
_LIBCPP_VISIBLE bool uncaught_exception() _NOEXCEPT;
|
||||||
_LIBCPP_FUNC_VIS int uncaught_exceptions() _NOEXCEPT;
|
|
||||||
|
|
||||||
class _LIBCPP_TYPE_VIS exception_ptr;
|
class exception_ptr;
|
||||||
|
|
||||||
_LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT;
|
exception_ptr current_exception() _NOEXCEPT;
|
||||||
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr);
|
_ATTRIBUTE(noreturn) void rethrow_exception(exception_ptr);
|
||||||
|
|
||||||
class _LIBCPP_TYPE_VIS exception_ptr
|
class _LIBCPP_VISIBLE exception_ptr
|
||||||
{
|
{
|
||||||
void* __ptr_;
|
void* __ptr_;
|
||||||
public:
|
public:
|
||||||
@@ -134,7 +130,7 @@ public:
|
|||||||
~exception_ptr() _NOEXCEPT;
|
~exception_ptr() _NOEXCEPT;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
_LIBCPP_EXPLICIT
|
// explicit
|
||||||
operator bool() const _NOEXCEPT {return __ptr_ != nullptr;}
|
operator bool() const _NOEXCEPT {return __ptr_ != nullptr;}
|
||||||
|
|
||||||
friend _LIBCPP_INLINE_VISIBILITY
|
friend _LIBCPP_INLINE_VISIBILITY
|
||||||
@@ -144,13 +140,13 @@ public:
|
|||||||
bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
|
bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
|
||||||
{return !(__x == __y);}
|
{return !(__x == __y);}
|
||||||
|
|
||||||
friend _LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT;
|
friend exception_ptr current_exception() _NOEXCEPT;
|
||||||
friend _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr);
|
_ATTRIBUTE(noreturn) friend void rethrow_exception(exception_ptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class _Ep>
|
template<class _E>
|
||||||
exception_ptr
|
exception_ptr
|
||||||
make_exception_ptr(_Ep __e) _NOEXCEPT
|
make_exception_ptr(_E __e) _NOEXCEPT
|
||||||
{
|
{
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||||
try
|
try
|
||||||
@@ -176,7 +172,7 @@ public:
|
|||||||
virtual ~nested_exception() _NOEXCEPT;
|
virtual ~nested_exception() _NOEXCEPT;
|
||||||
|
|
||||||
// access functions
|
// access functions
|
||||||
_LIBCPP_NORETURN void rethrow_nested() const;
|
_ATTRIBUTE(noreturn) void rethrow_nested() const;
|
||||||
_LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const _NOEXCEPT {return __ptr_;}
|
_LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const _NOEXCEPT {return __ptr_;}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -189,13 +185,12 @@ struct __nested
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
_LIBCPP_NORETURN
|
_ATTRIBUTE(noreturn)
|
||||||
void
|
void
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
throw_with_nested(_Tp&& __t, typename enable_if<
|
throw_with_nested(_Tp&& __t, typename enable_if<
|
||||||
is_class<typename remove_reference<_Tp>::type>::value &&
|
is_class<typename remove_reference<_Tp>::type>::value &&
|
||||||
!is_base_of<nested_exception, 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)
|
>::type* = 0)
|
||||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
throw_with_nested (_Tp& __t, typename enable_if<
|
throw_with_nested (_Tp& __t, typename enable_if<
|
||||||
@@ -209,13 +204,12 @@ throw_with_nested (_Tp& __t, typename enable_if<
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
_LIBCPP_NORETURN
|
_ATTRIBUTE(noreturn)
|
||||||
void
|
void
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
throw_with_nested(_Tp&& __t, typename enable_if<
|
throw_with_nested(_Tp&& __t, typename enable_if<
|
||||||
!is_class<typename remove_reference<_Tp>::type>::value ||
|
!is_class<typename remove_reference<_Tp>::type>::value ||
|
||||||
is_base_of<nested_exception, 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)
|
>::type* = 0)
|
||||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
throw_with_nested (_Tp& __t, typename enable_if<
|
throw_with_nested (_Tp& __t, typename enable_if<
|
||||||
@@ -228,23 +222,23 @@ throw_with_nested (_Tp& __t, typename enable_if<
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Ep>
|
template <class _E>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
rethrow_if_nested(const _Ep& __e, typename enable_if<
|
rethrow_if_nested(const _E& __e, typename enable_if<
|
||||||
is_polymorphic<_Ep>::value
|
is_polymorphic<_E>::value
|
||||||
>::type* = 0)
|
>::type* = 0)
|
||||||
{
|
{
|
||||||
const nested_exception* __nep = dynamic_cast<const nested_exception*>(_VSTD::addressof(__e));
|
const nested_exception* __nep = dynamic_cast<const nested_exception*>(&__e);
|
||||||
if (__nep)
|
if (__nep)
|
||||||
__nep->rethrow_nested();
|
__nep->rethrow_nested();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Ep>
|
template <class _E>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
rethrow_if_nested(const _Ep&, typename enable_if<
|
rethrow_if_nested(const _E& __e, typename enable_if<
|
||||||
!is_polymorphic<_Ep>::value
|
!is_polymorphic<_E>::value
|
||||||
>::type* = 0)
|
>::type* = 0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
//===--------------------------- __config ---------------------------------===//
|
|
||||||
//
|
|
||||||
// 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_EXPERIMENTAL_CONFIG
|
|
||||||
#define _LIBCPP_EXPERIMENTAL_CONFIG
|
|
||||||
|
|
||||||
#include <__config>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL namespace std { namespace experimental {
|
|
||||||
#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL } }
|
|
||||||
#define _VSTD_EXPERIMENTAL std::experimental
|
|
||||||
|
|
||||||
#define _LIBCPP_BEGIN_NAMESPACE_LFTS _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v1 {
|
|
||||||
#define _LIBCPP_END_NAMESPACE_LFTS } } }
|
|
||||||
#define _VSTD_LFTS _VSTD_EXPERIMENTAL::fundamentals_v1
|
|
||||||
|
|
||||||
#define _LIBCPP_BEGIN_NAMESPACE_CHRONO_LFTS _LIBCPP_BEGIN_NAMESPACE_STD \
|
|
||||||
namespace chrono { namespace experimental { inline namespace fundamentals_v1 {
|
|
||||||
#define _LIBCPP_END_NAMESPACE_CHRONO_LFTS _LIBCPP_END_NAMESPACE_STD } } }
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
//===-------------------------- algorithm ---------------------------------===//
|
|
||||||
//
|
|
||||||
// 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_EXPERIMENTAL_ALGORITHM
|
|
||||||
#define _LIBCPP_EXPERIMENTAL_ALGORITHM
|
|
||||||
|
|
||||||
/*
|
|
||||||
experimental/algorithm synopsis
|
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
namespace std {
|
|
||||||
namespace experimental {
|
|
||||||
inline namespace fundamentals_v1 {
|
|
||||||
|
|
||||||
template <class ForwardIterator, class Searcher>
|
|
||||||
ForwardIterator search(ForwardIterator first, ForwardIterator last,
|
|
||||||
const Searcher &searcher);
|
|
||||||
template <class PopulationIterator, class SampleIterator, class Distance,
|
|
||||||
class UniformRandomNumberGenerator>
|
|
||||||
SampleIterator sample(PopulationIterator first, PopulationIterator last,
|
|
||||||
SampleIterator out, Distance n,
|
|
||||||
UniformRandomNumberGenerator &&g);
|
|
||||||
|
|
||||||
} // namespace fundamentals_v1
|
|
||||||
} // namespace experimental
|
|
||||||
} // namespace std
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <experimental/__config>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <type_traits>
|
|
||||||
|
|
||||||
#include <__undef_min_max>
|
|
||||||
|
|
||||||
#include <__debug>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
|
||||||
|
|
||||||
|
|
||||||
template <class _ForwardIterator, class _Searcher>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
_ForwardIterator search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher &__s)
|
|
||||||
{ return __s(__f, __l); }
|
|
||||||
|
|
||||||
|
|
||||||
template <class _PopulationIterator, class _SampleIterator, class _Distance,
|
|
||||||
class _UniformRandomNumberGenerator>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
_SampleIterator __sample(_PopulationIterator __first,
|
|
||||||
_PopulationIterator __last, _SampleIterator __out,
|
|
||||||
_Distance __n,
|
|
||||||
_UniformRandomNumberGenerator &&__g,
|
|
||||||
input_iterator_tag) {
|
|
||||||
|
|
||||||
_Distance __k = 0;
|
|
||||||
for (; __first != __last && __k < __n; ++__first, (void)++__k)
|
|
||||||
__out[__k] = *__first;
|
|
||||||
_Distance __sz = __k;
|
|
||||||
for (; __first != __last; ++__first, (void)++__k) {
|
|
||||||
_Distance __r = _VSTD::uniform_int_distribution<_Distance>(0, __k)(__g);
|
|
||||||
if (__r < __sz)
|
|
||||||
__out[__r] = *__first;
|
|
||||||
}
|
|
||||||
return __out + _VSTD::min(__n, __k);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _PopulationIterator, class _SampleIterator, class _Distance,
|
|
||||||
class _UniformRandomNumberGenerator>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
_SampleIterator __sample(_PopulationIterator __first,
|
|
||||||
_PopulationIterator __last, _SampleIterator __out,
|
|
||||||
_Distance __n,
|
|
||||||
_UniformRandomNumberGenerator &&__g,
|
|
||||||
forward_iterator_tag) {
|
|
||||||
_Distance __unsampled_sz = _VSTD::distance(__first, __last);
|
|
||||||
for (__n = _VSTD::min(__n, __unsampled_sz); __n != 0; ++__first) {
|
|
||||||
_Distance __r =
|
|
||||||
_VSTD::uniform_int_distribution<_Distance>(0, --__unsampled_sz)(__g);
|
|
||||||
if (__r < __n) {
|
|
||||||
*__out++ = *__first;
|
|
||||||
--__n;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return __out;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _PopulationIterator, class _SampleIterator, class _Distance,
|
|
||||||
class _UniformRandomNumberGenerator>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
_SampleIterator sample(_PopulationIterator __first,
|
|
||||||
_PopulationIterator __last, _SampleIterator __out,
|
|
||||||
_Distance __n, _UniformRandomNumberGenerator &&__g) {
|
|
||||||
typedef typename iterator_traits<_PopulationIterator>::iterator_category
|
|
||||||
_PopCategory;
|
|
||||||
typedef typename iterator_traits<_PopulationIterator>::difference_type
|
|
||||||
_Difference;
|
|
||||||
typedef typename common_type<_Distance, _Difference>::type _CommonType;
|
|
||||||
_LIBCPP_ASSERT(__n >= 0, "N must be a positive number.");
|
|
||||||
return _VSTD_LFTS::__sample(
|
|
||||||
__first, __last, __out, _CommonType(__n),
|
|
||||||
_VSTD::forward<_UniformRandomNumberGenerator>(__g),
|
|
||||||
_PopCategory());
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_LFTS
|
|
||||||
|
|
||||||
#endif /* _LIBCPP_EXPERIMENTAL_ALGORITHM */
|
|
||||||
@@ -1,590 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
//===------------------------------ any -----------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is distributed under the University of Illinois Open Source
|
|
||||||
// License. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_EXPERIMENTAL_ANY
|
|
||||||
#define _LIBCPP_EXPERIMENTAL_ANY
|
|
||||||
|
|
||||||
/*
|
|
||||||
experimental/any synopsis
|
|
||||||
|
|
||||||
namespace std {
|
|
||||||
namespace experimental {
|
|
||||||
inline namespace fundamentals_v1 {
|
|
||||||
|
|
||||||
class bad_any_cast : public bad_cast
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual const char* what() const noexcept;
|
|
||||||
};
|
|
||||||
|
|
||||||
class any
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
// 6.3.1 any construct/destruct
|
|
||||||
any() noexcept;
|
|
||||||
|
|
||||||
any(const any& other);
|
|
||||||
any(any&& other) noexcept;
|
|
||||||
|
|
||||||
template <class ValueType>
|
|
||||||
any(ValueType&& value);
|
|
||||||
|
|
||||||
~any();
|
|
||||||
|
|
||||||
// 6.3.2 any assignments
|
|
||||||
any& operator=(const any& rhs);
|
|
||||||
any& operator=(any&& rhs) noexcept;
|
|
||||||
|
|
||||||
template <class ValueType>
|
|
||||||
any& operator=(ValueType&& rhs);
|
|
||||||
|
|
||||||
// 6.3.3 any modifiers
|
|
||||||
void clear() noexcept;
|
|
||||||
void swap(any& rhs) noexcept;
|
|
||||||
|
|
||||||
// 6.3.4 any observers
|
|
||||||
bool empty() const noexcept;
|
|
||||||
const type_info& type() const noexcept;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 6.4 Non-member functions
|
|
||||||
void swap(any& x, any& y) noexcept;
|
|
||||||
|
|
||||||
template<class ValueType>
|
|
||||||
ValueType any_cast(const any& operand);
|
|
||||||
template<class ValueType>
|
|
||||||
ValueType any_cast(any& operand);
|
|
||||||
template<class ValueType>
|
|
||||||
ValueType any_cast(any&& operand);
|
|
||||||
|
|
||||||
template<class ValueType>
|
|
||||||
const ValueType* any_cast(const any* operand) noexcept;
|
|
||||||
template<class ValueType>
|
|
||||||
ValueType* any_cast(any* operand) noexcept;
|
|
||||||
|
|
||||||
} // namespace fundamentals_v1
|
|
||||||
} // namespace experimental
|
|
||||||
} // namespace std
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <experimental/__config>
|
|
||||||
#include <memory>
|
|
||||||
#include <new>
|
|
||||||
#include <typeinfo>
|
|
||||||
#include <type_traits>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
|
||||||
|
|
||||||
class _LIBCPP_EXCEPTION_ABI bad_any_cast : public bad_cast
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual const char* what() const _NOEXCEPT;
|
|
||||||
};
|
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 11 // C++ > 11
|
|
||||||
|
|
||||||
_LIBCPP_NORETURN _LIBCPP_INLINE_VISIBILITY
|
|
||||||
inline void __throw_bad_any_cast()
|
|
||||||
{
|
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
|
||||||
throw bad_any_cast();
|
|
||||||
#else
|
|
||||||
assert(!"bad_any_cast");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// Forward declarations
|
|
||||||
class any;
|
|
||||||
|
|
||||||
template <class _ValueType>
|
|
||||||
typename add_pointer<typename add_const<_ValueType>::type>::type
|
|
||||||
any_cast(any const *) _NOEXCEPT;
|
|
||||||
|
|
||||||
template <class _ValueType>
|
|
||||||
typename add_pointer<_ValueType>::type
|
|
||||||
any_cast(any *) _NOEXCEPT;
|
|
||||||
|
|
||||||
namespace __any_imp
|
|
||||||
{
|
|
||||||
typedef typename aligned_storage<3*sizeof(void*), alignment_of<void*>::value>::type
|
|
||||||
_Buffer;
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
struct _IsSmallObject
|
|
||||||
: public integral_constant<bool
|
|
||||||
, sizeof(_Tp) <= sizeof(_Buffer)
|
|
||||||
&& alignment_of<_Buffer>::value
|
|
||||||
% alignment_of<_Tp>::value == 0
|
|
||||||
&& is_nothrow_move_constructible<_Tp>::value
|
|
||||||
>
|
|
||||||
{};
|
|
||||||
|
|
||||||
enum class _Action
|
|
||||||
{
|
|
||||||
_Destroy,
|
|
||||||
_Copy,
|
|
||||||
_Move,
|
|
||||||
_Get,
|
|
||||||
_TypeInfo
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
struct _SmallHandler;
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
struct _LargeHandler;
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
using _Handler = typename conditional<_IsSmallObject<_Tp>::value
|
|
||||||
, _SmallHandler<_Tp>
|
|
||||||
, _LargeHandler<_Tp>
|
|
||||||
>::type;
|
|
||||||
template <class _ValueType>
|
|
||||||
using _EnableIfNotAny = typename
|
|
||||||
enable_if<
|
|
||||||
!is_same<typename decay<_ValueType>::type, any>::value
|
|
||||||
>::type;
|
|
||||||
|
|
||||||
} // namespace __any_imp
|
|
||||||
|
|
||||||
class any
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// 6.3.1 any construct/destruct
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
any() _NOEXCEPT : __h(nullptr) {}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
any(any const & __other) : __h(nullptr)
|
|
||||||
{
|
|
||||||
if (__other.__h) __other.__call(_Action::_Copy, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
any(any && __other) _NOEXCEPT : __h(nullptr)
|
|
||||||
{
|
|
||||||
if (__other.__h) __other.__call(_Action::_Move, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <
|
|
||||||
class _ValueType
|
|
||||||
, class = __any_imp::_EnableIfNotAny<_ValueType>
|
|
||||||
>
|
|
||||||
any(_ValueType && __value);
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
~any()
|
|
||||||
{
|
|
||||||
this->clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 6.3.2 any assignments
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
any & operator=(any const & __rhs)
|
|
||||||
{
|
|
||||||
any(__rhs).swap(*this);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
any & operator=(any && __rhs) _NOEXCEPT
|
|
||||||
{
|
|
||||||
any(_VSTD::move(__rhs)).swap(*this);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <
|
|
||||||
class _ValueType
|
|
||||||
, class = __any_imp::_EnableIfNotAny<_ValueType>
|
|
||||||
>
|
|
||||||
any & operator=(_ValueType && __rhs);
|
|
||||||
|
|
||||||
// 6.3.3 any modifiers
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
void clear() _NOEXCEPT
|
|
||||||
{
|
|
||||||
if (__h) this->__call(_Action::_Destroy);
|
|
||||||
}
|
|
||||||
|
|
||||||
void swap(any & __rhs) _NOEXCEPT;
|
|
||||||
|
|
||||||
// 6.3.4 any observers
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool empty() const _NOEXCEPT
|
|
||||||
{
|
|
||||||
return __h == nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_NO_RTTI)
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
const type_info & type() const _NOEXCEPT
|
|
||||||
{
|
|
||||||
if (__h) {
|
|
||||||
return *static_cast<type_info const *>(this->__call(_Action::_TypeInfo));
|
|
||||||
} else {
|
|
||||||
return typeid(void);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
|
||||||
typedef __any_imp::_Action _Action;
|
|
||||||
|
|
||||||
typedef void* (*_HandleFuncPtr)(_Action, any const *, any *, const type_info *);
|
|
||||||
|
|
||||||
union _Storage
|
|
||||||
{
|
|
||||||
void * __ptr;
|
|
||||||
__any_imp::_Buffer __buf;
|
|
||||||
};
|
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
|
||||||
void * __call(_Action __a, any * __other = nullptr,
|
|
||||||
type_info const * __info = nullptr) const
|
|
||||||
{
|
|
||||||
return __h(__a, this, __other, __info);
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE
|
|
||||||
void * __call(_Action __a, any * __other = nullptr,
|
|
||||||
type_info const * __info = nullptr)
|
|
||||||
{
|
|
||||||
return __h(__a, this, __other, __info);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class>
|
|
||||||
friend struct __any_imp::_SmallHandler;
|
|
||||||
template <class>
|
|
||||||
friend struct __any_imp::_LargeHandler;
|
|
||||||
|
|
||||||
template <class _ValueType>
|
|
||||||
friend typename add_pointer<typename add_const<_ValueType>::type>::type
|
|
||||||
any_cast(any const *) _NOEXCEPT;
|
|
||||||
|
|
||||||
template <class _ValueType>
|
|
||||||
friend typename add_pointer<_ValueType>::type
|
|
||||||
any_cast(any *) _NOEXCEPT;
|
|
||||||
|
|
||||||
_HandleFuncPtr __h;
|
|
||||||
_Storage __s;
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace __any_imp
|
|
||||||
{
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
struct _LIBCPP_TYPE_VIS_ONLY _SmallHandler
|
|
||||||
{
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void* __handle(_Action __act, any const * __this, any * __other,
|
|
||||||
type_info const * __info)
|
|
||||||
{
|
|
||||||
switch (__act)
|
|
||||||
{
|
|
||||||
case _Action::_Destroy:
|
|
||||||
__destroy(const_cast<any &>(*__this));
|
|
||||||
return nullptr;
|
|
||||||
case _Action::_Copy:
|
|
||||||
__copy(*__this, *__other);
|
|
||||||
return nullptr;
|
|
||||||
case _Action::_Move:
|
|
||||||
__move(const_cast<any &>(*__this), *__other);
|
|
||||||
return nullptr;
|
|
||||||
case _Action::_Get:
|
|
||||||
return __get(const_cast<any &>(*__this), __info);
|
|
||||||
case _Action::_TypeInfo:
|
|
||||||
return __type_info();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Up>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void __create(any & __dest, _Up && __v)
|
|
||||||
{
|
|
||||||
::new (static_cast<void*>(&__dest.__s.__buf)) _Tp(_VSTD::forward<_Up>(__v));
|
|
||||||
__dest.__h = &_SmallHandler::__handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void __destroy(any & __this)
|
|
||||||
{
|
|
||||||
_Tp & __value = *static_cast<_Tp *>(static_cast<void*>(&__this.__s.__buf));
|
|
||||||
__value.~_Tp();
|
|
||||||
__this.__h = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void __copy(any const & __this, any & __dest)
|
|
||||||
{
|
|
||||||
_SmallHandler::__create(__dest, *static_cast<_Tp const *>(
|
|
||||||
static_cast<void const *>(&__this.__s.__buf)));
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void __move(any & __this, any & __dest)
|
|
||||||
{
|
|
||||||
_SmallHandler::__create(__dest, _VSTD::move(
|
|
||||||
*static_cast<_Tp*>(static_cast<void*>(&__this.__s.__buf))));
|
|
||||||
__destroy(__this);
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void* __get(any & __this, type_info const * __info)
|
|
||||||
{
|
|
||||||
#if !defined(_LIBCPP_NO_RTTI)
|
|
||||||
if (typeid(_Tp) == *__info) {
|
|
||||||
return static_cast<void*>(&__this.__s.__buf);
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
#else
|
|
||||||
return static_cast<void*>(&__this.__s.__buf);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void* __type_info()
|
|
||||||
{
|
|
||||||
#if !defined(_LIBCPP_NO_RTTI)
|
|
||||||
return const_cast<void*>(static_cast<void const *>(&typeid(_Tp)));
|
|
||||||
#else
|
|
||||||
return nullptr;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
struct _LIBCPP_TYPE_VIS_ONLY _LargeHandler
|
|
||||||
{
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void* __handle(_Action __act, any const * __this, any * __other,
|
|
||||||
type_info const * __info)
|
|
||||||
{
|
|
||||||
switch (__act)
|
|
||||||
{
|
|
||||||
case _Action::_Destroy:
|
|
||||||
__destroy(const_cast<any &>(*__this));
|
|
||||||
return nullptr;
|
|
||||||
case _Action::_Copy:
|
|
||||||
__copy(*__this, *__other);
|
|
||||||
return nullptr;
|
|
||||||
case _Action::_Move:
|
|
||||||
__move(const_cast<any &>(*__this), *__other);
|
|
||||||
return nullptr;
|
|
||||||
case _Action::_Get:
|
|
||||||
return __get(const_cast<any &>(*__this), __info);
|
|
||||||
case _Action::_TypeInfo:
|
|
||||||
return __type_info();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Up>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void __create(any & __dest, _Up && __v)
|
|
||||||
{
|
|
||||||
typedef allocator<_Tp> _Alloc;
|
|
||||||
typedef __allocator_destructor<_Alloc> _Dp;
|
|
||||||
_Alloc __a;
|
|
||||||
unique_ptr<_Tp, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
|
||||||
::new ((void*)__hold.get()) _Tp(_VSTD::forward<_Up>(__v));
|
|
||||||
__dest.__s.__ptr = __hold.release();
|
|
||||||
__dest.__h = &_LargeHandler::__handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void __destroy(any & __this)
|
|
||||||
{
|
|
||||||
delete static_cast<_Tp*>(__this.__s.__ptr);
|
|
||||||
__this.__h = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void __copy(any const & __this, any & __dest)
|
|
||||||
{
|
|
||||||
_LargeHandler::__create(__dest, *static_cast<_Tp const *>(__this.__s.__ptr));
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void __move(any & __this, any & __dest)
|
|
||||||
{
|
|
||||||
__dest.__s.__ptr = __this.__s.__ptr;
|
|
||||||
__dest.__h = &_LargeHandler::__handle;
|
|
||||||
__this.__h = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void* __get(any & __this, type_info const * __info)
|
|
||||||
{
|
|
||||||
#if !defined(_LIBCPP_NO_RTTI)
|
|
||||||
if (typeid(_Tp) == *__info) {
|
|
||||||
return static_cast<void*>(__this.__s.__ptr);
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
#else
|
|
||||||
return static_cast<void*>(__this.__s.__ptr);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
|
|
||||||
static void* __type_info()
|
|
||||||
{
|
|
||||||
#if !defined(_LIBCPP_NO_RTTI)
|
|
||||||
return const_cast<void*>(static_cast<void const *>(&typeid(_Tp)));
|
|
||||||
#else
|
|
||||||
return nullptr;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace __any_imp
|
|
||||||
|
|
||||||
|
|
||||||
template <class _ValueType, class>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
any::any(_ValueType && __v) : __h(nullptr)
|
|
||||||
{
|
|
||||||
typedef typename decay<_ValueType>::type _Tp;
|
|
||||||
static_assert(is_copy_constructible<_Tp>::value,
|
|
||||||
"_ValueType must be CopyConstructible.");
|
|
||||||
typedef __any_imp::_Handler<_Tp> _HandlerType;
|
|
||||||
_HandlerType::__create(*this, _VSTD::forward<_ValueType>(__v));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _ValueType, class>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
any & any::operator=(_ValueType && __v)
|
|
||||||
{
|
|
||||||
typedef typename decay<_ValueType>::type _Tp;
|
|
||||||
static_assert(is_copy_constructible<_Tp>::value,
|
|
||||||
"_ValueType must be CopyConstructible.");
|
|
||||||
any(_VSTD::forward<_ValueType>(__v)).swap(*this);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
void any::swap(any & __rhs) _NOEXCEPT
|
|
||||||
{
|
|
||||||
if (__h && __rhs.__h) {
|
|
||||||
any __tmp;
|
|
||||||
__rhs.__call(_Action::_Move, &__tmp);
|
|
||||||
this->__call(_Action::_Move, &__rhs);
|
|
||||||
__tmp.__call(_Action::_Move, this);
|
|
||||||
}
|
|
||||||
else if (__h) {
|
|
||||||
this->__call(_Action::_Move, &__rhs);
|
|
||||||
}
|
|
||||||
else if (__rhs.__h) {
|
|
||||||
__rhs.__call(_Action::_Move, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 6.4 Non-member functions
|
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
void swap(any & __lhs, any & __rhs) _NOEXCEPT
|
|
||||||
{
|
|
||||||
__lhs.swap(__rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _ValueType>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
_ValueType any_cast(any const & __v)
|
|
||||||
{
|
|
||||||
static_assert(
|
|
||||||
is_reference<_ValueType>::value
|
|
||||||
|| is_copy_constructible<_ValueType>::value,
|
|
||||||
"_ValueType is required to be a reference or a CopyConstructible type.");
|
|
||||||
typedef typename add_const<typename remove_reference<_ValueType>::type>::type
|
|
||||||
_Tp;
|
|
||||||
_Tp * __tmp = any_cast<_Tp>(&__v);
|
|
||||||
if (__tmp == nullptr)
|
|
||||||
__throw_bad_any_cast();
|
|
||||||
return *__tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _ValueType>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
_ValueType any_cast(any & __v)
|
|
||||||
{
|
|
||||||
static_assert(
|
|
||||||
is_reference<_ValueType>::value
|
|
||||||
|| is_copy_constructible<_ValueType>::value,
|
|
||||||
"_ValueType is required to be a reference or a CopyConstructible type.");
|
|
||||||
typedef typename remove_reference<_ValueType>::type _Tp;
|
|
||||||
_Tp * __tmp = any_cast<_Tp>(&__v);
|
|
||||||
if (__tmp == nullptr)
|
|
||||||
__throw_bad_any_cast();
|
|
||||||
return *__tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _ValueType>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
_ValueType any_cast(any && __v)
|
|
||||||
{
|
|
||||||
static_assert(
|
|
||||||
is_reference<_ValueType>::value
|
|
||||||
|| is_copy_constructible<_ValueType>::value,
|
|
||||||
"_ValueType is required to be a reference or a CopyConstructible type.");
|
|
||||||
typedef typename remove_reference<_ValueType>::type _Tp;
|
|
||||||
_Tp * __tmp = any_cast<_Tp>(&__v);
|
|
||||||
if (__tmp == nullptr)
|
|
||||||
__throw_bad_any_cast();
|
|
||||||
return *__tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _ValueType>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
typename add_pointer<typename add_const<_ValueType>::type>::type
|
|
||||||
any_cast(any const * __any) _NOEXCEPT
|
|
||||||
{
|
|
||||||
static_assert(!is_reference<_ValueType>::value,
|
|
||||||
"_ValueType may not be a reference.");
|
|
||||||
return any_cast<_ValueType>(const_cast<any *>(__any));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _ValueType>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
typename add_pointer<_ValueType>::type
|
|
||||||
any_cast(any * __any) _NOEXCEPT
|
|
||||||
{
|
|
||||||
using __any_imp::_Action;
|
|
||||||
static_assert(!is_reference<_ValueType>::value,
|
|
||||||
"_ValueType may not be a reference.");
|
|
||||||
typedef typename add_pointer<_ValueType>::type _ReturnType;
|
|
||||||
if (__any && __any->__h) {
|
|
||||||
|
|
||||||
return static_cast<_ReturnType>(
|
|
||||||
__any->__call(_Action::_Get, nullptr,
|
|
||||||
#if !defined(_LIBCPP_NO_RTTI)
|
|
||||||
&typeid(_ValueType)
|
|
||||||
#else
|
|
||||||
nullptr
|
|
||||||
#endif
|
|
||||||
));
|
|
||||||
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // _LIBCPP_STD_VER > 11
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_LFTS
|
|
||||||
|
|
||||||
#endif // _LIBCPP_EXPERIMENTAL_ANY
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
//===------------------------------ chrono ---------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is distributed under the University of Illinois Open Source
|
|
||||||
// License. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_EXPERIMENTAL_CHRONO
|
|
||||||
#define _LIBCPP_EXPERIMENTAL_CHRONO
|
|
||||||
|
|
||||||
/**
|
|
||||||
experimental/chrono synopsis
|
|
||||||
|
|
||||||
// C++1y
|
|
||||||
|
|
||||||
#include <chrono>
|
|
||||||
|
|
||||||
namespace std {
|
|
||||||
namespace chrono {
|
|
||||||
namespace experimental {
|
|
||||||
inline namespace fundamentals_v1 {
|
|
||||||
|
|
||||||
// See C++14 20.12.4, customization traits
|
|
||||||
template <class Rep> constexpr bool treat_as_floating_point_v
|
|
||||||
= treat_as_floating_point<Rep>::value;
|
|
||||||
|
|
||||||
} // namespace fundamentals_v1
|
|
||||||
} // namespace experimental
|
|
||||||
} // namespace chrono
|
|
||||||
} // namespace std
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <experimental/__config>
|
|
||||||
#include <chrono>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_CHRONO_LFTS
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
|
||||||
|
|
||||||
template <class _Rep> _LIBCPP_CONSTEXPR bool treat_as_floating_point_v
|
|
||||||
= treat_as_floating_point<_Rep>::value;
|
|
||||||
|
|
||||||
#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_CHRONO_LFTS
|
|
||||||
|
|
||||||
#endif /* _LIBCPP_STD_VER > 11 */
|
|
||||||
|
|
||||||
#endif /* _LIBCPP_EXPERIMENTAL_CHRONO */
|
|
||||||
@@ -1,316 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
//===-------------------------- dynarray ----------------------------------===//
|
|
||||||
//
|
|
||||||
// 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_DYNARRAY
|
|
||||||
#define _LIBCPP_DYNARRAY
|
|
||||||
|
|
||||||
#include <__config>
|
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
|
|
||||||
/*
|
|
||||||
dynarray synopsis
|
|
||||||
|
|
||||||
namespace std { namespace experimental {
|
|
||||||
|
|
||||||
template< typename T >
|
|
||||||
class dynarray
|
|
||||||
{
|
|
||||||
// types:
|
|
||||||
typedef T value_type;
|
|
||||||
typedef T& reference;
|
|
||||||
typedef const T& const_reference;
|
|
||||||
typedef T* pointer;
|
|
||||||
typedef const T* const_pointer;
|
|
||||||
typedef implementation-defined iterator;
|
|
||||||
typedef implementation-defined const_iterator;
|
|
||||||
typedef reverse_iterator<iterator> reverse_iterator;
|
|
||||||
typedef reverse_iterator<const_iterator> const_reverse_iterator;
|
|
||||||
typedef size_t size_type;
|
|
||||||
typedef ptrdiff_t difference_type;
|
|
||||||
|
|
||||||
public:
|
|
||||||
// construct/copy/destroy:
|
|
||||||
explicit dynarray(size_type c);
|
|
||||||
dynarray(size_type c, const T& v);
|
|
||||||
dynarray(const dynarray& d);
|
|
||||||
dynarray(initializer_list<T>);
|
|
||||||
|
|
||||||
template <class Alloc>
|
|
||||||
dynarray(allocator_arg_t, const Alloc& a, size_type c, const Alloc& alloc);
|
|
||||||
template <class Alloc>
|
|
||||||
dynarray(allocator_arg_t, const Alloc& a, size_type c, const T& v, const Alloc& alloc);
|
|
||||||
template <class Alloc>
|
|
||||||
dynarray(allocator_arg_t, const Alloc& a, const dynarray& d, const Alloc& alloc);
|
|
||||||
template <class Alloc>
|
|
||||||
dynarray(allocator_arg_t, const Alloc& a, initializer_list<T>, const Alloc& alloc);
|
|
||||||
dynarray& operator=(const dynarray&) = delete;
|
|
||||||
~dynarray();
|
|
||||||
|
|
||||||
// iterators:
|
|
||||||
iterator begin() noexcept;
|
|
||||||
const_iterator begin() const noexcept;
|
|
||||||
const_iterator cbegin() const noexcept;
|
|
||||||
iterator end() noexcept;
|
|
||||||
const_iterator end() const noexcept;
|
|
||||||
const_iterator cend() const noexcept;
|
|
||||||
|
|
||||||
reverse_iterator rbegin() noexcept;
|
|
||||||
const_reverse_iterator rbegin() const noexcept;
|
|
||||||
const_reverse_iterator crbegin() const noexcept;
|
|
||||||
reverse_iterator rend() noexcept;
|
|
||||||
const_reverse_iterator rend() const noexcept;
|
|
||||||
const_reverse_iterator crend() const noexcept;
|
|
||||||
|
|
||||||
// capacity:
|
|
||||||
size_type size() const noexcept;
|
|
||||||
size_type max_size() const noexcept;
|
|
||||||
bool empty() const noexcept;
|
|
||||||
|
|
||||||
// element access:
|
|
||||||
reference operator[](size_type n);
|
|
||||||
const_reference operator[](size_type n) const;
|
|
||||||
|
|
||||||
reference front();
|
|
||||||
const_reference front() const;
|
|
||||||
reference back();
|
|
||||||
const_reference back() const;
|
|
||||||
|
|
||||||
const_reference at(size_type n) const;
|
|
||||||
reference at(size_type n);
|
|
||||||
|
|
||||||
// data access:
|
|
||||||
T* data() noexcept;
|
|
||||||
const T* data() const noexcept;
|
|
||||||
|
|
||||||
// mutating member functions:
|
|
||||||
void fill(const T& v);
|
|
||||||
};
|
|
||||||
|
|
||||||
}} // std::experimental
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <__functional_base>
|
|
||||||
#include <iterator>
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <initializer_list>
|
|
||||||
#include <new>
|
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
#include <__undef___deallocate>
|
|
||||||
|
|
||||||
#if defined(_LIBCPP_NO_EXCEPTIONS)
|
|
||||||
#include <cassert>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace std { namespace experimental { inline namespace __array_extensions_v1 {
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
struct _LIBCPP_TYPE_VIS_ONLY dynarray
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// types:
|
|
||||||
typedef dynarray __self;
|
|
||||||
typedef _Tp value_type;
|
|
||||||
typedef value_type& reference;
|
|
||||||
typedef const value_type& const_reference;
|
|
||||||
typedef value_type* iterator;
|
|
||||||
typedef const value_type* const_iterator;
|
|
||||||
typedef value_type* pointer;
|
|
||||||
typedef const value_type* const_pointer;
|
|
||||||
typedef size_t size_type;
|
|
||||||
typedef ptrdiff_t difference_type;
|
|
||||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
|
||||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
|
||||||
|
|
||||||
private:
|
|
||||||
size_t __size_;
|
|
||||||
value_type * __base_;
|
|
||||||
_LIBCPP_ALWAYS_INLINE dynarray () noexcept : __size_(0), __base_(nullptr) {}
|
|
||||||
|
|
||||||
static inline _LIBCPP_INLINE_VISIBILITY value_type* __allocate ( size_t count )
|
|
||||||
{
|
|
||||||
if ( numeric_limits<size_t>::max() / sizeof (value_type) <= count )
|
|
||||||
{
|
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
|
||||||
throw bad_array_length();
|
|
||||||
#else
|
|
||||||
assert(!"dynarray::allocation");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return static_cast<value_type *> (_VSTD::__allocate (sizeof(value_type) * count));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline _LIBCPP_INLINE_VISIBILITY void __deallocate ( value_type* __ptr ) noexcept
|
|
||||||
{
|
|
||||||
_VSTD::__deallocate (static_cast<void *> (__ptr));
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
explicit dynarray(size_type __c);
|
|
||||||
dynarray(size_type __c, const value_type& __v);
|
|
||||||
dynarray(const dynarray& __d);
|
|
||||||
dynarray(initializer_list<value_type>);
|
|
||||||
|
|
||||||
// We're not implementing these right now.
|
|
||||||
// Updated with the resolution of LWG issue #2255
|
|
||||||
// template <typename _Alloc>
|
|
||||||
// dynarray(allocator_arg_t, const _Alloc& __alloc, size_type __c);
|
|
||||||
// template <typename _Alloc>
|
|
||||||
// dynarray(allocator_arg_t, const _Alloc& __alloc, size_type __c, const value_type& __v);
|
|
||||||
// template <typename _Alloc>
|
|
||||||
// dynarray(allocator_arg_t, const _Alloc& __alloc, const dynarray& __d);
|
|
||||||
// template <typename _Alloc>
|
|
||||||
// dynarray(allocator_arg_t, const _Alloc& __alloc, initializer_list<value_type>);
|
|
||||||
|
|
||||||
dynarray& operator=(const dynarray&) = delete;
|
|
||||||
~dynarray();
|
|
||||||
|
|
||||||
// iterators:
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY iterator begin() noexcept { return iterator(data()); }
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY const_iterator begin() const noexcept { return const_iterator(data()); }
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY const_iterator cbegin() const noexcept { return const_iterator(data()); }
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY iterator end() noexcept { return iterator(data() + __size_); }
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY const_iterator end() const noexcept { return const_iterator(data() + __size_); }
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY const_iterator cend() const noexcept { return const_iterator(data() + __size_); }
|
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY reverse_iterator rbegin() noexcept { return reverse_iterator(end()); }
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); }
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); }
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY reverse_iterator rend() noexcept { return reverse_iterator(begin()); }
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); }
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); }
|
|
||||||
|
|
||||||
// capacity:
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY size_type size() const noexcept { return __size_; }
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY size_type max_size() const noexcept { return __size_; }
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY bool empty() const noexcept { return __size_ == 0; }
|
|
||||||
|
|
||||||
// element access:
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) { return data()[__n]; }
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const { return data()[__n]; }
|
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY reference front() { return data()[0]; }
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY const_reference front() const { return data()[0]; }
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY reference back() { return data()[__size_-1]; }
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY const_reference back() const { return data()[__size_-1]; }
|
|
||||||
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY const_reference at(size_type __n) const;
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY reference at(size_type __n);
|
|
||||||
|
|
||||||
// data access:
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _Tp* data() noexcept { return __base_; }
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY const _Tp* data() const noexcept { return __base_; }
|
|
||||||
|
|
||||||
// mutating member functions:
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY void fill(const value_type& __v) { fill_n(begin(), __size_, __v); }
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
dynarray<_Tp>::dynarray(size_type __c) : dynarray ()
|
|
||||||
{
|
|
||||||
__base_ = __allocate (__c);
|
|
||||||
value_type *__data = data ();
|
|
||||||
for ( __size_ = 0; __size_ < __c; ++__size_, ++__data )
|
|
||||||
::new (__data) value_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
dynarray<_Tp>::dynarray(size_type __c, const value_type& __v) : dynarray ()
|
|
||||||
{
|
|
||||||
__base_ = __allocate (__c);
|
|
||||||
value_type *__data = data ();
|
|
||||||
for ( __size_ = 0; __size_ < __c; ++__size_, ++__data )
|
|
||||||
::new (__data) value_type (__v);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
dynarray<_Tp>::dynarray(initializer_list<value_type> __il) : dynarray ()
|
|
||||||
{
|
|
||||||
size_t sz = __il.size();
|
|
||||||
__base_ = __allocate (sz);
|
|
||||||
value_type *__data = data ();
|
|
||||||
auto src = __il.begin();
|
|
||||||
for ( __size_ = 0; __size_ < sz; ++__size_, ++__data, ++src )
|
|
||||||
::new (__data) value_type (*src);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
dynarray<_Tp>::dynarray(const dynarray& __d) : dynarray ()
|
|
||||||
{
|
|
||||||
size_t sz = __d.size();
|
|
||||||
__base_ = __allocate (sz);
|
|
||||||
value_type *__data = data ();
|
|
||||||
auto src = __d.begin();
|
|
||||||
for ( __size_ = 0; __size_ < sz; ++__size_, ++__data, ++src )
|
|
||||||
::new (__data) value_type (*src);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
dynarray<_Tp>::~dynarray()
|
|
||||||
{
|
|
||||||
value_type *__data = data () + __size_;
|
|
||||||
for ( size_t i = 0; i < __size_; ++i )
|
|
||||||
(--__data)->value_type::~value_type();
|
|
||||||
__deallocate ( __base_ );
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
typename dynarray<_Tp>::reference
|
|
||||||
dynarray<_Tp>::at(size_type __n)
|
|
||||||
{
|
|
||||||
if (__n >= __size_)
|
|
||||||
{
|
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
|
||||||
throw out_of_range("dynarray::at");
|
|
||||||
#else
|
|
||||||
assert(!"dynarray::at out_of_range");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return data()[__n];
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
typename dynarray<_Tp>::const_reference
|
|
||||||
dynarray<_Tp>::at(size_type __n) const
|
|
||||||
{
|
|
||||||
if (__n >= __size_)
|
|
||||||
{
|
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
|
||||||
throw out_of_range("dynarray::at");
|
|
||||||
#else
|
|
||||||
assert(!"dynarray::at out_of_range");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return data()[__n];
|
|
||||||
}
|
|
||||||
|
|
||||||
}}}
|
|
||||||
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
|
||||||
template <class _Tp, class _Alloc>
|
|
||||||
struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<std::experimental::dynarray<_Tp>, _Alloc> : true_type {};
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
|
||||||
|
|
||||||
#endif // if _LIBCPP_STD_VER > 11
|
|
||||||
#endif // _LIBCPP_DYNARRAY
|
|
||||||
@@ -1,454 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
//===-------------------------- functional --------------------------------===//
|
|
||||||
//
|
|
||||||
// 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_EXPERIMENTAL_FUNCTIONAL
|
|
||||||
#define _LIBCPP_EXPERIMENTAL_FUNCTIONAL
|
|
||||||
|
|
||||||
/*
|
|
||||||
experimental/functional synopsis
|
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
namespace std {
|
|
||||||
namespace experimental {
|
|
||||||
inline namespace fundamentals_v1 {
|
|
||||||
|
|
||||||
// See C++14 20.9.9, Function object binders
|
|
||||||
template <class T> constexpr bool is_bind_expression_v
|
|
||||||
= is_bind_expression<T>::value;
|
|
||||||
template <class T> constexpr int is_placeholder_v
|
|
||||||
= is_placeholder<T>::value;
|
|
||||||
|
|
||||||
// 4.2, Class template function
|
|
||||||
template<class> class function; // undefined
|
|
||||||
template<class R, class... ArgTypes> class function<R(ArgTypes...)>;
|
|
||||||
|
|
||||||
template<class R, class... ArgTypes>
|
|
||||||
void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&);
|
|
||||||
|
|
||||||
template<class R, class... ArgTypes>
|
|
||||||
bool operator==(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
|
|
||||||
template<class R, class... ArgTypes>
|
|
||||||
bool operator==(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
|
|
||||||
template<class R, class... ArgTypes>
|
|
||||||
bool operator!=(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
|
|
||||||
template<class R, class... ArgTypes>
|
|
||||||
bool operator!=(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
|
|
||||||
|
|
||||||
// 4.3, Searchers
|
|
||||||
template<class ForwardIterator, class BinaryPredicate = equal_to<>>
|
|
||||||
class default_searcher;
|
|
||||||
|
|
||||||
template<class RandomAccessIterator,
|
|
||||||
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
|
|
||||||
class BinaryPredicate = equal_to<>>
|
|
||||||
class boyer_moore_searcher;
|
|
||||||
|
|
||||||
template<class RandomAccessIterator,
|
|
||||||
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
|
|
||||||
class BinaryPredicate = equal_to<>>
|
|
||||||
class boyer_moore_horspool_searcher;
|
|
||||||
|
|
||||||
template<class ForwardIterator, class BinaryPredicate = equal_to<>>
|
|
||||||
default_searcher<ForwardIterator, BinaryPredicate>
|
|
||||||
make_default_searcher(ForwardIterator pat_first, ForwardIterator pat_last,
|
|
||||||
BinaryPredicate pred = BinaryPredicate());
|
|
||||||
|
|
||||||
template<class RandomAccessIterator,
|
|
||||||
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
|
|
||||||
class BinaryPredicate = equal_to<>>
|
|
||||||
boyer_moore_searcher<RandomAccessIterator, Hash, BinaryPredicate>
|
|
||||||
make_boyer_moore_searcher(
|
|
||||||
RandomAccessIterator pat_first, RandomAccessIterator pat_last,
|
|
||||||
Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
|
|
||||||
|
|
||||||
template<class RandomAccessIterator,
|
|
||||||
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
|
|
||||||
class BinaryPredicate = equal_to<>>
|
|
||||||
boyer_moore_horspool_searcher<RandomAccessIterator, Hash, BinaryPredicate>
|
|
||||||
make_boyer_moore_horspool_searcher(
|
|
||||||
RandomAccessIterator pat_first, RandomAccessIterator pat_last,
|
|
||||||
Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
|
|
||||||
|
|
||||||
} // namespace fundamentals_v1
|
|
||||||
} // namespace experimental
|
|
||||||
|
|
||||||
template<class R, class... ArgTypes, class Alloc>
|
|
||||||
struct uses_allocator<experimental::function<R(ArgTypes...)>, Alloc>;
|
|
||||||
|
|
||||||
} // namespace std
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <experimental/__config>
|
|
||||||
#include <functional>
|
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <type_traits>
|
|
||||||
#include <vector>
|
|
||||||
#include <array>
|
|
||||||
#include <unordered_map>
|
|
||||||
|
|
||||||
#include <__undef_min_max>
|
|
||||||
|
|
||||||
#include <__debug>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
// default searcher
|
|
||||||
template<class _ForwardIterator, class _BinaryPredicate = equal_to<>>
|
|
||||||
_LIBCPP_TYPE_VIS
|
|
||||||
class default_searcher {
|
|
||||||
public:
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
default_searcher(_ForwardIterator __f, _ForwardIterator __l,
|
|
||||||
_BinaryPredicate __p = _BinaryPredicate())
|
|
||||||
: __first_(__f), __last_(__l), __pred_(__p) {}
|
|
||||||
|
|
||||||
template <typename _ForwardIterator2>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
_ForwardIterator2 operator () (_ForwardIterator2 __f, _ForwardIterator2 __l) const
|
|
||||||
{
|
|
||||||
return _VSTD::search(__f, __l, __first_, __last_, __pred_);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
_ForwardIterator __first_;
|
|
||||||
_ForwardIterator __last_;
|
|
||||||
_BinaryPredicate __pred_;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class _ForwardIterator, class _BinaryPredicate = equal_to<>>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
default_searcher<_ForwardIterator, _BinaryPredicate>
|
|
||||||
make_default_searcher( _ForwardIterator __f, _ForwardIterator __l, _BinaryPredicate __p = _BinaryPredicate ())
|
|
||||||
{
|
|
||||||
return default_searcher<_ForwardIterator, _BinaryPredicate>(__f, __l, __p);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class _Key, class _Value, class _Hash, class _BinaryPredicate, bool /*useArray*/> class _BMSkipTable;
|
|
||||||
|
|
||||||
// General case for BM data searching; use a map
|
|
||||||
template<class _Key, typename _Value, class _Hash, class _BinaryPredicate>
|
|
||||||
class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, false> {
|
|
||||||
public: // TODO private:
|
|
||||||
typedef _Value value_type;
|
|
||||||
typedef _Key key_type;
|
|
||||||
|
|
||||||
const _Value __default_value_;
|
|
||||||
std::unordered_map<_Key, _Value, _Hash, _BinaryPredicate> __table;
|
|
||||||
|
|
||||||
public:
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
_BMSkipTable(std::size_t __sz, _Value __default, _Hash __hf, _BinaryPredicate __pred)
|
|
||||||
: __default_value_(__default), __table(__sz, __hf, __pred) {}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
void insert(const key_type &__key, value_type __val)
|
|
||||||
{
|
|
||||||
__table [__key] = __val; // Would skip_.insert (val) be better here?
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
value_type operator [](const key_type & __key) const
|
|
||||||
{
|
|
||||||
auto __it = __table.find (__key);
|
|
||||||
return __it == __table.end() ? __default_value_ : __it->second;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Special case small numeric values; use an array
|
|
||||||
template<class _Key, typename _Value, class _Hash, class _BinaryPredicate>
|
|
||||||
class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, true> {
|
|
||||||
private:
|
|
||||||
typedef _Value value_type;
|
|
||||||
typedef _Key key_type;
|
|
||||||
|
|
||||||
typedef typename std::make_unsigned<key_type>::type unsigned_key_type;
|
|
||||||
typedef std::array<value_type, _VSTD::numeric_limits<unsigned_key_type>::max()> skip_map;
|
|
||||||
skip_map __table;
|
|
||||||
|
|
||||||
public:
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
_BMSkipTable(std::size_t /*__sz*/, _Value __default, _Hash /*__hf*/, _BinaryPredicate /*__pred*/)
|
|
||||||
{
|
|
||||||
std::fill_n(__table.begin(), __table.size(), __default);
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
void insert(key_type __key, value_type __val)
|
|
||||||
{
|
|
||||||
__table[static_cast<unsigned_key_type>(__key)] = __val;
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
value_type operator [](key_type __key) const
|
|
||||||
{
|
|
||||||
return __table[static_cast<unsigned_key_type>(__key)];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
template <class _RandomAccessIterator1,
|
|
||||||
class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
|
|
||||||
class _BinaryPredicate = equal_to<>>
|
|
||||||
_LIBCPP_TYPE_VIS
|
|
||||||
class boyer_moore_searcher {
|
|
||||||
private:
|
|
||||||
typedef typename std::iterator_traits<_RandomAccessIterator1>::difference_type difference_type;
|
|
||||||
typedef typename std::iterator_traits<_RandomAccessIterator1>::value_type value_type;
|
|
||||||
typedef _BMSkipTable<value_type, difference_type, _Hash, _BinaryPredicate,
|
|
||||||
_VSTD::is_integral<value_type>::value && // what about enums?
|
|
||||||
sizeof(value_type) == 1 &&
|
|
||||||
is_same<_Hash, hash<value_type>>::value &&
|
|
||||||
is_same<_BinaryPredicate, equal_to<>>::value
|
|
||||||
> skip_table_type;
|
|
||||||
|
|
||||||
public:
|
|
||||||
boyer_moore_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l,
|
|
||||||
_Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate())
|
|
||||||
: __first_(__f), __last_(__l), __pred_(__pred),
|
|
||||||
__pattern_length_(_VSTD::distance(__first_, __last_)),
|
|
||||||
__skip_{make_shared<skip_table_type>(__pattern_length_, -1, __hf, __pred_)},
|
|
||||||
__suffix_{make_shared<vector<difference_type>>(__pattern_length_ + 1)}
|
|
||||||
{
|
|
||||||
// build the skip table
|
|
||||||
for ( difference_type __i = 0; __f != __l; ++__f, (void) ++__i )
|
|
||||||
__skip_->insert(*__f, __i);
|
|
||||||
|
|
||||||
this->__build_suffix_table ( __first_, __last_, __pred_ );
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename _RandomAccessIterator2>
|
|
||||||
_RandomAccessIterator2
|
|
||||||
operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const
|
|
||||||
{
|
|
||||||
static_assert ( std::is_same<
|
|
||||||
typename std::decay<typename std::iterator_traits<_RandomAccessIterator1>::value_type>::type,
|
|
||||||
typename std::decay<typename std::iterator_traits<_RandomAccessIterator2>::value_type>::type
|
|
||||||
>::value,
|
|
||||||
"Corpus and Pattern iterators must point to the same type" );
|
|
||||||
|
|
||||||
if (__f == __l ) return __l; // empty corpus
|
|
||||||
if (__first_ == __last_) return __f; // empty pattern
|
|
||||||
|
|
||||||
// If the pattern is larger than the corpus, we can't find it!
|
|
||||||
if ( __pattern_length_ > _VSTD::distance (__f, __l))
|
|
||||||
return __l;
|
|
||||||
|
|
||||||
// Do the search
|
|
||||||
return this->__search(__f, __l);
|
|
||||||
}
|
|
||||||
|
|
||||||
public: // TODO private:
|
|
||||||
_RandomAccessIterator1 __first_;
|
|
||||||
_RandomAccessIterator1 __last_;
|
|
||||||
_BinaryPredicate __pred_;
|
|
||||||
difference_type __pattern_length_;
|
|
||||||
shared_ptr<skip_table_type> __skip_;
|
|
||||||
shared_ptr<vector<difference_type>> __suffix_;
|
|
||||||
|
|
||||||
template <typename _RandomAccessIterator2>
|
|
||||||
_RandomAccessIterator2 __search(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const
|
|
||||||
{
|
|
||||||
_RandomAccessIterator2 __cur = __f;
|
|
||||||
const _RandomAccessIterator2 __last = __l - __pattern_length_;
|
|
||||||
const skip_table_type & __skip = *__skip_.get();
|
|
||||||
const vector<difference_type> & __suffix = *__suffix_.get();
|
|
||||||
|
|
||||||
while (__cur <= __last)
|
|
||||||
{
|
|
||||||
|
|
||||||
// Do we match right where we are?
|
|
||||||
difference_type __j = __pattern_length_;
|
|
||||||
while (__pred_(__first_ [__j-1], __cur [__j-1])) {
|
|
||||||
__j--;
|
|
||||||
// We matched - we're done!
|
|
||||||
if ( __j == 0 )
|
|
||||||
return __cur;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Since we didn't match, figure out how far to skip forward
|
|
||||||
difference_type __k = __skip[__cur [ __j - 1 ]];
|
|
||||||
difference_type __m = __j - __k - 1;
|
|
||||||
if (__k < __j && __m > __suffix[ __j ])
|
|
||||||
__cur += __m;
|
|
||||||
else
|
|
||||||
__cur += __suffix[ __j ];
|
|
||||||
}
|
|
||||||
|
|
||||||
return __l; // We didn't find anything
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<typename _Iterator, typename _Container>
|
|
||||||
void __compute_bm_prefix ( _Iterator __f, _Iterator __l, _BinaryPredicate __pred, _Container &__prefix )
|
|
||||||
{
|
|
||||||
const std::size_t __count = _VSTD::distance(__f, __l);
|
|
||||||
|
|
||||||
__prefix[0] = 0;
|
|
||||||
std::size_t __k = 0;
|
|
||||||
for ( std::size_t __i = 1; __i < __count; ++__i )
|
|
||||||
{
|
|
||||||
while ( __k > 0 && !__pred ( __f[__k], __f[__i] ))
|
|
||||||
__k = __prefix [ __k - 1 ];
|
|
||||||
|
|
||||||
if ( __pred ( __f[__k], __f[__i] ))
|
|
||||||
__k++;
|
|
||||||
__prefix [ __i ] = __k;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void __build_suffix_table(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l,
|
|
||||||
_BinaryPredicate __pred)
|
|
||||||
{
|
|
||||||
const std::size_t __count = _VSTD::distance(__f, __l);
|
|
||||||
vector<difference_type> & __suffix = *__suffix_.get();
|
|
||||||
if (__count > 0)
|
|
||||||
{
|
|
||||||
_VSTD::vector<value_type> __scratch(__count);
|
|
||||||
|
|
||||||
__compute_bm_prefix(__f, __l, __pred, __scratch);
|
|
||||||
for ( std::size_t __i = 0; __i <= __count; __i++ )
|
|
||||||
__suffix[__i] = __count - __scratch[__count-1];
|
|
||||||
|
|
||||||
typedef _VSTD::reverse_iterator<_RandomAccessIterator1> _RevIter;
|
|
||||||
__compute_bm_prefix(_RevIter(__l), _RevIter(__f), __pred, __scratch);
|
|
||||||
|
|
||||||
for ( std::size_t __i = 0; __i < __count; __i++ )
|
|
||||||
{
|
|
||||||
const std::size_t __j = __count - __scratch[__i];
|
|
||||||
const difference_type __k = __i - __scratch[__i] + 1;
|
|
||||||
|
|
||||||
if (__suffix[__j] > __k)
|
|
||||||
__suffix[__j] = __k;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class _RandomAccessIterator,
|
|
||||||
class _Hash = hash<typename iterator_traits<_RandomAccessIterator>::value_type>,
|
|
||||||
class _BinaryPredicate = equal_to<>>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
boyer_moore_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>
|
|
||||||
make_boyer_moore_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l,
|
|
||||||
_Hash __hf = _Hash(), _BinaryPredicate __p = _BinaryPredicate ())
|
|
||||||
{
|
|
||||||
return boyer_moore_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>(__f, __l, __hf, __p);
|
|
||||||
}
|
|
||||||
|
|
||||||
// boyer-moore-horspool
|
|
||||||
template <class _RandomAccessIterator1,
|
|
||||||
class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
|
|
||||||
class _BinaryPredicate = equal_to<>>
|
|
||||||
_LIBCPP_TYPE_VIS
|
|
||||||
class boyer_moore_horspool_searcher {
|
|
||||||
private:
|
|
||||||
typedef typename std::iterator_traits<_RandomAccessIterator1>::difference_type difference_type;
|
|
||||||
typedef typename std::iterator_traits<_RandomAccessIterator1>::value_type value_type;
|
|
||||||
typedef _BMSkipTable<value_type, difference_type, _Hash, _BinaryPredicate,
|
|
||||||
_VSTD::is_integral<value_type>::value && // what about enums?
|
|
||||||
sizeof(value_type) == 1 &&
|
|
||||||
is_same<_Hash, hash<value_type>>::value &&
|
|
||||||
is_same<_BinaryPredicate, equal_to<>>::value
|
|
||||||
> skip_table_type;
|
|
||||||
|
|
||||||
public:
|
|
||||||
boyer_moore_horspool_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l,
|
|
||||||
_Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate())
|
|
||||||
: __first_(__f), __last_(__l), __pred_(__pred),
|
|
||||||
__pattern_length_(_VSTD::distance(__first_, __last_)),
|
|
||||||
__skip_{_VSTD::make_shared<skip_table_type>(__pattern_length_, __pattern_length_, __hf, __pred_)}
|
|
||||||
{
|
|
||||||
// build the skip table
|
|
||||||
if ( __f != __l )
|
|
||||||
{
|
|
||||||
__l = __l - 1;
|
|
||||||
for ( difference_type __i = 0; __f != __l; ++__f, (void) ++__i )
|
|
||||||
__skip_->insert(*__f, __pattern_length_ - 1 - __i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename _RandomAccessIterator2>
|
|
||||||
_RandomAccessIterator2
|
|
||||||
operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const
|
|
||||||
{
|
|
||||||
static_assert ( std::is_same<
|
|
||||||
typename std::decay<typename std::iterator_traits<_RandomAccessIterator1>::value_type>::type,
|
|
||||||
typename std::decay<typename std::iterator_traits<_RandomAccessIterator2>::value_type>::type
|
|
||||||
>::value,
|
|
||||||
"Corpus and Pattern iterators must point to the same type" );
|
|
||||||
|
|
||||||
if (__f == __l ) return __l; // empty corpus
|
|
||||||
if (__first_ == __last_) return __f; // empty pattern
|
|
||||||
|
|
||||||
// If the pattern is larger than the corpus, we can't find it!
|
|
||||||
if ( __pattern_length_ > _VSTD::distance (__f, __l))
|
|
||||||
return __l;
|
|
||||||
|
|
||||||
// Do the search
|
|
||||||
return this->__search(__f, __l);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
_RandomAccessIterator1 __first_;
|
|
||||||
_RandomAccessIterator1 __last_;
|
|
||||||
_BinaryPredicate __pred_;
|
|
||||||
difference_type __pattern_length_;
|
|
||||||
shared_ptr<skip_table_type> __skip_;
|
|
||||||
|
|
||||||
template <typename _RandomAccessIterator2>
|
|
||||||
_RandomAccessIterator2 __search ( _RandomAccessIterator2 __f, _RandomAccessIterator2 __l ) const {
|
|
||||||
_RandomAccessIterator2 __cur = __f;
|
|
||||||
const _RandomAccessIterator2 __last = __l - __pattern_length_;
|
|
||||||
const skip_table_type & __skip = *__skip_.get();
|
|
||||||
|
|
||||||
while (__cur <= __last)
|
|
||||||
{
|
|
||||||
// Do we match right where we are?
|
|
||||||
difference_type __j = __pattern_length_;
|
|
||||||
while (__pred_(__first_[__j-1], __cur[__j-1]))
|
|
||||||
{
|
|
||||||
__j--;
|
|
||||||
// We matched - we're done!
|
|
||||||
if ( __j == 0 )
|
|
||||||
return __cur;
|
|
||||||
}
|
|
||||||
__cur += __skip[__cur[__pattern_length_-1]];
|
|
||||||
}
|
|
||||||
|
|
||||||
return __l;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class _RandomAccessIterator,
|
|
||||||
class _Hash = hash<typename iterator_traits<_RandomAccessIterator>::value_type>,
|
|
||||||
class _BinaryPredicate = equal_to<>>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
boyer_moore_horspool_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>
|
|
||||||
make_boyer_moore_horspool_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l,
|
|
||||||
_Hash __hf = _Hash(), _BinaryPredicate __p = _BinaryPredicate ())
|
|
||||||
{
|
|
||||||
return boyer_moore_horspool_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>(__f, __l, __hf, __p);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // _LIBCPP_STD_VER > 11
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_LFTS
|
|
||||||
|
|
||||||
#endif /* _LIBCPP_EXPERIMENTAL_FUNCTIONAL */
|
|
||||||
@@ -1,894 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
//===-------------------------- optional ----------------------------------===//
|
|
||||||
//
|
|
||||||
// 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_OPTIONAL
|
|
||||||
#define _LIBCPP_OPTIONAL
|
|
||||||
|
|
||||||
/*
|
|
||||||
optional synopsis
|
|
||||||
|
|
||||||
// C++1y
|
|
||||||
|
|
||||||
namespace std { namespace experimental { inline namespace fundamentals_v1 {
|
|
||||||
|
|
||||||
// 5.3, optional for object types
|
|
||||||
template <class T> class optional;
|
|
||||||
|
|
||||||
// 5.4, In-place construction
|
|
||||||
struct in_place_t{};
|
|
||||||
constexpr in_place_t in_place{};
|
|
||||||
|
|
||||||
// 5.5, No-value state indicator
|
|
||||||
struct nullopt_t{see below};
|
|
||||||
constexpr nullopt_t nullopt(unspecified);
|
|
||||||
|
|
||||||
// 5.6, Class bad_optional_access
|
|
||||||
class bad_optional_access;
|
|
||||||
|
|
||||||
// 5.7, Relational operators
|
|
||||||
template <class T>
|
|
||||||
constexpr bool operator==(const optional<T>&, const optional<T>&);
|
|
||||||
template <class T>
|
|
||||||
constexpr bool operator!=(const optional<T>&, const optional<T>&);
|
|
||||||
template <class T>
|
|
||||||
constexpr bool operator<(const optional<T>&, const optional<T>&);
|
|
||||||
template <class T>
|
|
||||||
constexpr bool operator>(const optional<T>&, const optional<T>&);
|
|
||||||
template <class T>
|
|
||||||
constexpr bool operator<=(const optional<T>&, const optional<T>&);
|
|
||||||
template <class T>
|
|
||||||
constexpr bool operator>=(const optional<T>&, const optional<T>&);
|
|
||||||
|
|
||||||
// 5.8, Comparison with nullopt
|
|
||||||
template <class T> constexpr bool operator==(const optional<T>&, nullopt_t) noexcept;
|
|
||||||
template <class T> constexpr bool operator==(nullopt_t, const optional<T>&) noexcept;
|
|
||||||
template <class T> constexpr bool operator!=(const optional<T>&, nullopt_t) noexcept;
|
|
||||||
template <class T> constexpr bool operator!=(nullopt_t, const optional<T>&) noexcept;
|
|
||||||
template <class T> constexpr bool operator<(const optional<T>&, nullopt_t) noexcept;
|
|
||||||
template <class T> constexpr bool operator<(nullopt_t, const optional<T>&) noexcept;
|
|
||||||
template <class T> constexpr bool operator<=(const optional<T>&, nullopt_t) noexcept;
|
|
||||||
template <class T> constexpr bool operator<=(nullopt_t, const optional<T>&) noexcept;
|
|
||||||
template <class T> constexpr bool operator>(const optional<T>&, nullopt_t) noexcept;
|
|
||||||
template <class T> constexpr bool operator>(nullopt_t, const optional<T>&) noexcept;
|
|
||||||
template <class T> constexpr bool operator>=(const optional<T>&, nullopt_t) noexcept;
|
|
||||||
template <class T> constexpr bool operator>=(nullopt_t, const optional<T>&) noexcept;
|
|
||||||
|
|
||||||
// 5.9, Comparison with T
|
|
||||||
template <class T> constexpr bool operator==(const optional<T>&, const T&);
|
|
||||||
template <class T> constexpr bool operator==(const T&, const optional<T>&);
|
|
||||||
template <class T> constexpr bool operator!=(const optional<T>&, const T&);
|
|
||||||
template <class T> constexpr bool operator!=(const T&, const optional<T>&);
|
|
||||||
template <class T> constexpr bool operator<(const optional<T>&, const T&);
|
|
||||||
template <class T> constexpr bool operator<(const T&, const optional<T>&);
|
|
||||||
template <class T> constexpr bool operator<=(const optional<T>&, const T&);
|
|
||||||
template <class T> constexpr bool operator<=(const T&, const optional<T>&);
|
|
||||||
template <class T> constexpr bool operator>(const optional<T>&, const T&);
|
|
||||||
template <class T> constexpr bool operator>(const T&, const optional<T>&);
|
|
||||||
template <class T> constexpr bool operator>=(const optional<T>&, const T&);
|
|
||||||
template <class T> constexpr bool operator>=(const T&, const optional<T>&);
|
|
||||||
|
|
||||||
// 5.10, Specialized algorithms
|
|
||||||
template <class T> void swap(optional<T>&, optional<T>&) noexcept(see below);
|
|
||||||
template <class T> constexpr optional<see below> make_optional(T&&);
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
class optional
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef T value_type;
|
|
||||||
|
|
||||||
// 5.3.1, Constructors
|
|
||||||
constexpr optional() noexcept;
|
|
||||||
constexpr optional(nullopt_t) noexcept;
|
|
||||||
optional(const optional&);
|
|
||||||
optional(optional&&) noexcept(see below);
|
|
||||||
constexpr optional(const T&);
|
|
||||||
constexpr optional(T&&);
|
|
||||||
template <class... Args> constexpr explicit optional(in_place_t, Args&&...);
|
|
||||||
template <class U, class... Args>
|
|
||||||
constexpr explicit optional(in_place_t, initializer_list<U>, Args&&...);
|
|
||||||
|
|
||||||
// 5.3.2, Destructor
|
|
||||||
~optional();
|
|
||||||
|
|
||||||
// 5.3.3, Assignment
|
|
||||||
optional& operator=(nullopt_t) noexcept;
|
|
||||||
optional& operator=(const optional&);
|
|
||||||
optional& operator=(optional&&) noexcept(see below);
|
|
||||||
template <class U> optional& operator=(U&&);
|
|
||||||
template <class... Args> void emplace(Args&&...);
|
|
||||||
template <class U, class... Args>
|
|
||||||
void emplace(initializer_list<U>, Args&&...);
|
|
||||||
|
|
||||||
// 5.3.4, Swap
|
|
||||||
void swap(optional&) noexcept(see below);
|
|
||||||
|
|
||||||
// 5.3.5, Observers
|
|
||||||
constexpr T const* operator ->() const;
|
|
||||||
constexpr T* operator ->();
|
|
||||||
constexpr T const& operator *() const &;
|
|
||||||
constexpr T& operator *() &;
|
|
||||||
constexpr T&& operator *() &&;
|
|
||||||
constexpr const T&& operator *() const &&;
|
|
||||||
constexpr explicit operator bool() const noexcept;
|
|
||||||
constexpr T const& value() const &;
|
|
||||||
constexpr T& value() &;
|
|
||||||
constexpr T&& value() &&;
|
|
||||||
constexpr const T&& value() const &&;
|
|
||||||
template <class U> constexpr T value_or(U&&) const &;
|
|
||||||
template <class U> constexpr T value_or(U&&) &&;
|
|
||||||
|
|
||||||
private:
|
|
||||||
T* val; // exposition only
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace fundamentals_v1
|
|
||||||
} // namespace experimental
|
|
||||||
|
|
||||||
// 5.11, Hash support
|
|
||||||
template <class T> struct hash;
|
|
||||||
template <class T> struct hash<experimental::optional<T>>;
|
|
||||||
|
|
||||||
} // namespace std
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <experimental/__config>
|
|
||||||
#include <functional>
|
|
||||||
#include <stdexcept>
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
|
|
||||||
class _LIBCPP_EXCEPTION_ABI bad_optional_access
|
|
||||||
: public std::logic_error
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
bad_optional_access() : std::logic_error("Bad optional Access") {}
|
|
||||||
|
|
||||||
// Get the key function ~bad_optional_access() into the dylib
|
|
||||||
virtual ~bad_optional_access() _NOEXCEPT;
|
|
||||||
};
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_EXPERIMENTAL
|
|
||||||
|
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
|
|
||||||
#include <initializer_list>
|
|
||||||
#include <type_traits>
|
|
||||||
#include <new>
|
|
||||||
#include <__functional_base>
|
|
||||||
#include <__undef_min_max>
|
|
||||||
#include <__debug>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
|
||||||
|
|
||||||
struct in_place_t {};
|
|
||||||
constexpr in_place_t in_place{};
|
|
||||||
|
|
||||||
struct nullopt_t
|
|
||||||
{
|
|
||||||
explicit constexpr nullopt_t(int) noexcept {}
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr nullopt_t nullopt{0};
|
|
||||||
|
|
||||||
template <class _Tp, bool = is_trivially_destructible<_Tp>::value>
|
|
||||||
class __optional_storage
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
typedef _Tp value_type;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
char __null_state_;
|
|
||||||
value_type __val_;
|
|
||||||
};
|
|
||||||
bool __engaged_ = false;
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
~__optional_storage()
|
|
||||||
{
|
|
||||||
if (__engaged_)
|
|
||||||
__val_.~value_type();
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr __optional_storage() noexcept
|
|
||||||
: __null_state_('\0') {}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
__optional_storage(const __optional_storage& __x)
|
|
||||||
: __engaged_(__x.__engaged_)
|
|
||||||
{
|
|
||||||
if (__engaged_)
|
|
||||||
::new(_VSTD::addressof(__val_)) value_type(__x.__val_);
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
__optional_storage(__optional_storage&& __x)
|
|
||||||
noexcept(is_nothrow_move_constructible<value_type>::value)
|
|
||||||
: __engaged_(__x.__engaged_)
|
|
||||||
{
|
|
||||||
if (__engaged_)
|
|
||||||
::new(_VSTD::addressof(__val_)) value_type(_VSTD::move(__x.__val_));
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr __optional_storage(const value_type& __v)
|
|
||||||
: __val_(__v),
|
|
||||||
__engaged_(true) {}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr __optional_storage(value_type&& __v)
|
|
||||||
: __val_(_VSTD::move(__v)),
|
|
||||||
__engaged_(true) {}
|
|
||||||
|
|
||||||
template <class... _Args>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
explicit __optional_storage(in_place_t, _Args&&... __args)
|
|
||||||
: __val_(_VSTD::forward<_Args>(__args)...),
|
|
||||||
__engaged_(true) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
class __optional_storage<_Tp, true>
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
typedef _Tp value_type;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
char __null_state_;
|
|
||||||
value_type __val_;
|
|
||||||
};
|
|
||||||
bool __engaged_ = false;
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr __optional_storage() noexcept
|
|
||||||
: __null_state_('\0') {}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
__optional_storage(const __optional_storage& __x)
|
|
||||||
: __engaged_(__x.__engaged_)
|
|
||||||
{
|
|
||||||
if (__engaged_)
|
|
||||||
::new(_VSTD::addressof(__val_)) value_type(__x.__val_);
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
__optional_storage(__optional_storage&& __x)
|
|
||||||
noexcept(is_nothrow_move_constructible<value_type>::value)
|
|
||||||
: __engaged_(__x.__engaged_)
|
|
||||||
{
|
|
||||||
if (__engaged_)
|
|
||||||
::new(_VSTD::addressof(__val_)) value_type(_VSTD::move(__x.__val_));
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr __optional_storage(const value_type& __v)
|
|
||||||
: __val_(__v),
|
|
||||||
__engaged_(true) {}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr __optional_storage(value_type&& __v)
|
|
||||||
: __val_(_VSTD::move(__v)),
|
|
||||||
__engaged_(true) {}
|
|
||||||
|
|
||||||
template <class... _Args>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
explicit __optional_storage(in_place_t, _Args&&... __args)
|
|
||||||
: __val_(_VSTD::forward<_Args>(__args)...),
|
|
||||||
__engaged_(true) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
class optional
|
|
||||||
: private __optional_storage<_Tp>
|
|
||||||
{
|
|
||||||
typedef __optional_storage<_Tp> __base;
|
|
||||||
public:
|
|
||||||
typedef _Tp value_type;
|
|
||||||
|
|
||||||
static_assert(!is_reference<value_type>::value,
|
|
||||||
"Instantiation of optional with a reference type is ill-formed.");
|
|
||||||
static_assert(!is_same<typename remove_cv<value_type>::type, in_place_t>::value,
|
|
||||||
"Instantiation of optional with a in_place_t type is ill-formed.");
|
|
||||||
static_assert(!is_same<typename remove_cv<value_type>::type, nullopt_t>::value,
|
|
||||||
"Instantiation of optional with a nullopt_t type is ill-formed.");
|
|
||||||
static_assert(is_object<value_type>::value,
|
|
||||||
"Instantiation of optional with a non-object type is undefined behavior.");
|
|
||||||
static_assert(is_nothrow_destructible<value_type>::value,
|
|
||||||
"Instantiation of optional with an object type that is not noexcept destructible is undefined behavior.");
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY constexpr optional() noexcept {}
|
|
||||||
_LIBCPP_INLINE_VISIBILITY optional(const optional&) = default;
|
|
||||||
_LIBCPP_INLINE_VISIBILITY optional(optional&&) = default;
|
|
||||||
_LIBCPP_INLINE_VISIBILITY ~optional() = default;
|
|
||||||
_LIBCPP_INLINE_VISIBILITY constexpr optional(nullopt_t) noexcept {}
|
|
||||||
_LIBCPP_INLINE_VISIBILITY constexpr optional(const value_type& __v)
|
|
||||||
: __base(__v) {}
|
|
||||||
_LIBCPP_INLINE_VISIBILITY constexpr optional(value_type&& __v)
|
|
||||||
: __base(_VSTD::move(__v)) {}
|
|
||||||
|
|
||||||
template <class... _Args,
|
|
||||||
class = typename enable_if
|
|
||||||
<
|
|
||||||
is_constructible<value_type, _Args...>::value
|
|
||||||
>::type
|
|
||||||
>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
explicit optional(in_place_t, _Args&&... __args)
|
|
||||||
: __base(in_place, _VSTD::forward<_Args>(__args)...) {}
|
|
||||||
|
|
||||||
template <class _Up, class... _Args,
|
|
||||||
class = typename enable_if
|
|
||||||
<
|
|
||||||
is_constructible<value_type, initializer_list<_Up>&, _Args...>::value
|
|
||||||
>::type
|
|
||||||
>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args)
|
|
||||||
: __base(in_place, __il, _VSTD::forward<_Args>(__args)...) {}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
optional& operator=(nullopt_t) noexcept
|
|
||||||
{
|
|
||||||
if (this->__engaged_)
|
|
||||||
{
|
|
||||||
this->__val_.~value_type();
|
|
||||||
this->__engaged_ = false;
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
optional&
|
|
||||||
operator=(const optional& __opt)
|
|
||||||
{
|
|
||||||
if (this->__engaged_ == __opt.__engaged_)
|
|
||||||
{
|
|
||||||
if (this->__engaged_)
|
|
||||||
this->__val_ = __opt.__val_;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (this->__engaged_)
|
|
||||||
this->__val_.~value_type();
|
|
||||||
else
|
|
||||||
::new(_VSTD::addressof(this->__val_)) value_type(__opt.__val_);
|
|
||||||
this->__engaged_ = __opt.__engaged_;
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
optional&
|
|
||||||
operator=(optional&& __opt)
|
|
||||||
noexcept(is_nothrow_move_assignable<value_type>::value &&
|
|
||||||
is_nothrow_move_constructible<value_type>::value)
|
|
||||||
{
|
|
||||||
if (this->__engaged_ == __opt.__engaged_)
|
|
||||||
{
|
|
||||||
if (this->__engaged_)
|
|
||||||
this->__val_ = _VSTD::move(__opt.__val_);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (this->__engaged_)
|
|
||||||
this->__val_.~value_type();
|
|
||||||
else
|
|
||||||
::new(_VSTD::addressof(this->__val_)) value_type(_VSTD::move(__opt.__val_));
|
|
||||||
this->__engaged_ = __opt.__engaged_;
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Up,
|
|
||||||
class = typename enable_if
|
|
||||||
<
|
|
||||||
is_same<typename remove_reference<_Up>::type, value_type>::value &&
|
|
||||||
is_constructible<value_type, _Up>::value &&
|
|
||||||
is_assignable<value_type&, _Up>::value
|
|
||||||
>::type
|
|
||||||
>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
optional&
|
|
||||||
operator=(_Up&& __v)
|
|
||||||
{
|
|
||||||
if (this->__engaged_)
|
|
||||||
this->__val_ = _VSTD::forward<_Up>(__v);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
::new(_VSTD::addressof(this->__val_)) value_type(_VSTD::forward<_Up>(__v));
|
|
||||||
this->__engaged_ = true;
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class... _Args,
|
|
||||||
class = typename enable_if
|
|
||||||
<
|
|
||||||
is_constructible<value_type, _Args...>::value
|
|
||||||
>::type
|
|
||||||
>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
void
|
|
||||||
emplace(_Args&&... __args)
|
|
||||||
{
|
|
||||||
*this = nullopt;
|
|
||||||
::new(_VSTD::addressof(this->__val_)) value_type(_VSTD::forward<_Args>(__args)...);
|
|
||||||
this->__engaged_ = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Up, class... _Args,
|
|
||||||
class = typename enable_if
|
|
||||||
<
|
|
||||||
is_constructible<value_type, initializer_list<_Up>&, _Args...>::value
|
|
||||||
>::type
|
|
||||||
>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
void
|
|
||||||
emplace(initializer_list<_Up> __il, _Args&&... __args)
|
|
||||||
{
|
|
||||||
*this = nullopt;
|
|
||||||
::new(_VSTD::addressof(this->__val_)) value_type(__il, _VSTD::forward<_Args>(__args)...);
|
|
||||||
this->__engaged_ = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
void
|
|
||||||
swap(optional& __opt)
|
|
||||||
noexcept(is_nothrow_move_constructible<value_type>::value &&
|
|
||||||
__is_nothrow_swappable<value_type>::value)
|
|
||||||
{
|
|
||||||
using _VSTD::swap;
|
|
||||||
if (this->__engaged_ == __opt.__engaged_)
|
|
||||||
{
|
|
||||||
if (this->__engaged_)
|
|
||||||
swap(this->__val_, __opt.__val_);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (this->__engaged_)
|
|
||||||
{
|
|
||||||
::new(_VSTD::addressof(__opt.__val_)) value_type(_VSTD::move(this->__val_));
|
|
||||||
this->__val_.~value_type();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
::new(_VSTD::addressof(this->__val_)) value_type(_VSTD::move(__opt.__val_));
|
|
||||||
__opt.__val_.~value_type();
|
|
||||||
}
|
|
||||||
swap(this->__engaged_, __opt.__engaged_);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
value_type const*
|
|
||||||
operator->() const
|
|
||||||
{
|
|
||||||
_LIBCPP_ASSERT(this->__engaged_, "optional operator-> called for disengaged value");
|
|
||||||
return __operator_arrow(__has_operator_addressof<value_type>{});
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
value_type*
|
|
||||||
operator->()
|
|
||||||
{
|
|
||||||
_LIBCPP_ASSERT(this->__engaged_, "optional operator-> called for disengaged value");
|
|
||||||
return _VSTD::addressof(this->__val_);
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
const value_type&
|
|
||||||
operator*() const
|
|
||||||
{
|
|
||||||
_LIBCPP_ASSERT(this->__engaged_, "optional operator* called for disengaged value");
|
|
||||||
return this->__val_;
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
value_type&
|
|
||||||
operator*()
|
|
||||||
{
|
|
||||||
_LIBCPP_ASSERT(this->__engaged_, "optional operator* called for disengaged value");
|
|
||||||
return this->__val_;
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr explicit operator bool() const noexcept {return this->__engaged_;}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr value_type const& value() const
|
|
||||||
{
|
|
||||||
if (!this->__engaged_)
|
|
||||||
throw bad_optional_access();
|
|
||||||
return this->__val_;
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
value_type& value()
|
|
||||||
{
|
|
||||||
if (!this->__engaged_)
|
|
||||||
throw bad_optional_access();
|
|
||||||
return this->__val_;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Up>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr value_type value_or(_Up&& __v) const&
|
|
||||||
{
|
|
||||||
static_assert(is_copy_constructible<value_type>::value,
|
|
||||||
"optional<T>::value_or: T must be copy constructible");
|
|
||||||
static_assert(is_convertible<_Up, value_type>::value,
|
|
||||||
"optional<T>::value_or: U must be convertible to T");
|
|
||||||
return this->__engaged_ ? this->__val_ :
|
|
||||||
static_cast<value_type>(_VSTD::forward<_Up>(__v));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Up>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
value_type value_or(_Up&& __v) &&
|
|
||||||
{
|
|
||||||
static_assert(is_move_constructible<value_type>::value,
|
|
||||||
"optional<T>::value_or: T must be move constructible");
|
|
||||||
static_assert(is_convertible<_Up, value_type>::value,
|
|
||||||
"optional<T>::value_or: U must be convertible to T");
|
|
||||||
return this->__engaged_ ? _VSTD::move(this->__val_) :
|
|
||||||
static_cast<value_type>(_VSTD::forward<_Up>(__v));
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
value_type const*
|
|
||||||
__operator_arrow(true_type) const
|
|
||||||
{
|
|
||||||
return _VSTD::addressof(this->__val_);
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
value_type const*
|
|
||||||
__operator_arrow(false_type) const
|
|
||||||
{
|
|
||||||
return &this->__val_;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Comparisons between optionals
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator==(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
|
||||||
{
|
|
||||||
if (static_cast<bool>(__x) != static_cast<bool>(__y))
|
|
||||||
return false;
|
|
||||||
if (!static_cast<bool>(__x))
|
|
||||||
return true;
|
|
||||||
return *__x == *__y;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator!=(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
|
||||||
{
|
|
||||||
return !(__x == __y);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator<(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
|
||||||
{
|
|
||||||
if (!static_cast<bool>(__y))
|
|
||||||
return false;
|
|
||||||
if (!static_cast<bool>(__x))
|
|
||||||
return true;
|
|
||||||
return *__x < *__y;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator>(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
|
||||||
{
|
|
||||||
return __y < __x;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator<=(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
|
||||||
{
|
|
||||||
return !(__y < __x);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator>=(const optional<_Tp>& __x, const optional<_Tp>& __y)
|
|
||||||
{
|
|
||||||
return !(__x < __y);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Comparisons with nullopt
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator==(const optional<_Tp>& __x, nullopt_t) noexcept
|
|
||||||
{
|
|
||||||
return !static_cast<bool>(__x);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator==(nullopt_t, const optional<_Tp>& __x) noexcept
|
|
||||||
{
|
|
||||||
return !static_cast<bool>(__x);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator!=(const optional<_Tp>& __x, nullopt_t) noexcept
|
|
||||||
{
|
|
||||||
return static_cast<bool>(__x);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator!=(nullopt_t, const optional<_Tp>& __x) noexcept
|
|
||||||
{
|
|
||||||
return static_cast<bool>(__x);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator<(const optional<_Tp>&, nullopt_t) noexcept
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator<(nullopt_t, const optional<_Tp>& __x) noexcept
|
|
||||||
{
|
|
||||||
return static_cast<bool>(__x);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator<=(const optional<_Tp>& __x, nullopt_t) noexcept
|
|
||||||
{
|
|
||||||
return !static_cast<bool>(__x);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator<=(nullopt_t, const optional<_Tp>& __x) noexcept
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator>(const optional<_Tp>& __x, nullopt_t) noexcept
|
|
||||||
{
|
|
||||||
return static_cast<bool>(__x);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator>(nullopt_t, const optional<_Tp>& __x) noexcept
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator>=(const optional<_Tp>&, nullopt_t) noexcept
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator>=(nullopt_t, const optional<_Tp>& __x) noexcept
|
|
||||||
{
|
|
||||||
return !static_cast<bool>(__x);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Comparisons with T
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator==(const optional<_Tp>& __x, const _Tp& __v)
|
|
||||||
{
|
|
||||||
return static_cast<bool>(__x) ? *__x == __v : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator==(const _Tp& __v, const optional<_Tp>& __x)
|
|
||||||
{
|
|
||||||
return static_cast<bool>(__x) ? *__x == __v : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator!=(const optional<_Tp>& __x, const _Tp& __v)
|
|
||||||
{
|
|
||||||
return static_cast<bool>(__x) ? !(*__x == __v) : true;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator!=(const _Tp& __v, const optional<_Tp>& __x)
|
|
||||||
{
|
|
||||||
return static_cast<bool>(__x) ? !(*__x == __v) : true;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator<(const optional<_Tp>& __x, const _Tp& __v)
|
|
||||||
{
|
|
||||||
return static_cast<bool>(__x) ? less<_Tp>{}(*__x, __v) : true;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator<(const _Tp& __v, const optional<_Tp>& __x)
|
|
||||||
{
|
|
||||||
return static_cast<bool>(__x) ? less<_Tp>{}(__v, *__x) : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator<=(const optional<_Tp>& __x, const _Tp& __v)
|
|
||||||
{
|
|
||||||
return !(__x > __v);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator<=(const _Tp& __v, const optional<_Tp>& __x)
|
|
||||||
{
|
|
||||||
return !(__v > __x);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator>(const optional<_Tp>& __x, const _Tp& __v)
|
|
||||||
{
|
|
||||||
return static_cast<bool>(__x) ? __v < __x : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator>(const _Tp& __v, const optional<_Tp>& __x)
|
|
||||||
{
|
|
||||||
return static_cast<bool>(__x) ? __x < __v : true;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator>=(const optional<_Tp>& __x, const _Tp& __v)
|
|
||||||
{
|
|
||||||
return !(__x < __v);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
bool
|
|
||||||
operator>=(const _Tp& __v, const optional<_Tp>& __x)
|
|
||||||
{
|
|
||||||
return !(__v < __x);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
void
|
|
||||||
swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y)))
|
|
||||||
{
|
|
||||||
__x.swap(__y);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
constexpr
|
|
||||||
optional<typename decay<_Tp>::type>
|
|
||||||
make_optional(_Tp&& __v)
|
|
||||||
{
|
|
||||||
return optional<typename decay<_Tp>::type>(_VSTD::forward<_Tp>(__v));
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_LFTS
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
struct _LIBCPP_TYPE_VIS_ONLY hash<std::experimental::optional<_Tp> >
|
|
||||||
{
|
|
||||||
typedef std::experimental::optional<_Tp> argument_type;
|
|
||||||
typedef size_t result_type;
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
result_type operator()(const argument_type& __opt) const _NOEXCEPT
|
|
||||||
{
|
|
||||||
return static_cast<bool>(__opt) ? hash<_Tp>()(*__opt) : 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
|
||||||
|
|
||||||
#endif // _LIBCPP_STD_VER > 11
|
|
||||||
|
|
||||||
#endif // _LIBCPP_OPTIONAL
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
//===------------------------------ ratio ---------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is distributed under the University of Illinois Open Source
|
|
||||||
// License. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_EXPERIMENTAL_RATIO
|
|
||||||
#define _LIBCPP_EXPERIMENTAL_RATIO
|
|
||||||
|
|
||||||
/**
|
|
||||||
experimental/ratio synopsis
|
|
||||||
C++1y
|
|
||||||
#include <ratio>
|
|
||||||
|
|
||||||
namespace std {
|
|
||||||
namespace experimental {
|
|
||||||
inline namespace fundamentals_v1 {
|
|
||||||
|
|
||||||
// See C++14 20.11.5, ratio comparison
|
|
||||||
template <class R1, class R2> constexpr bool ratio_equal_v
|
|
||||||
= ratio_equal<R1, R2>::value;
|
|
||||||
template <class R1, class R2> constexpr bool ratio_not_equal_v
|
|
||||||
= ratio_not_equal<R1, R2>::value;
|
|
||||||
template <class R1, class R2> constexpr bool ratio_less_v
|
|
||||||
= ratio_less<R1, R2>::value;
|
|
||||||
template <class R1, class R2> constexpr bool ratio_less_equal_v
|
|
||||||
= ratio_less_equal<R1, R2>::value;
|
|
||||||
template <class R1, class R2> constexpr bool ratio_greater_v
|
|
||||||
= ratio_greater<R1, R2>::value;
|
|
||||||
template <class R1, class R2> constexpr bool ratio_greater_equal_v
|
|
||||||
= ratio_greater_equal<R1, R2>::value;
|
|
||||||
|
|
||||||
} // namespace fundamentals_v1
|
|
||||||
} // namespace experimental
|
|
||||||
} // namespace std
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <experimental/__config>
|
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
|
|
||||||
#include <ratio>
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
|
||||||
|
|
||||||
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_equal_v
|
|
||||||
= ratio_equal<_R1, _R2>::value;
|
|
||||||
|
|
||||||
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_not_equal_v
|
|
||||||
= ratio_not_equal<_R1, _R2>::value;
|
|
||||||
|
|
||||||
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_less_v
|
|
||||||
= ratio_less<_R1, _R2>::value;
|
|
||||||
|
|
||||||
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_less_equal_v
|
|
||||||
= ratio_less_equal<_R1, _R2>::value;
|
|
||||||
|
|
||||||
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_greater_v
|
|
||||||
= ratio_greater<_R1, _R2>::value;
|
|
||||||
|
|
||||||
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_greater_equal_v
|
|
||||||
= ratio_greater_equal<_R1, _R2>::value;
|
|
||||||
|
|
||||||
#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_LFTS
|
|
||||||
|
|
||||||
#endif /* _LIBCPP_STD_VER > 11 */
|
|
||||||
|
|
||||||
#endif // _LIBCPP_EXPERIMENTAL_RATIO
|
|
||||||
@@ -1,812 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
//===------------------------ string_view ---------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is distributed under the University of Illinois Open Source
|
|
||||||
// License. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_LFTS_STRING_VIEW
|
|
||||||
#define _LIBCPP_LFTS_STRING_VIEW
|
|
||||||
|
|
||||||
/*
|
|
||||||
string_view synopsis
|
|
||||||
|
|
||||||
namespace std {
|
|
||||||
namespace experimental {
|
|
||||||
inline namespace library_fundamentals_v1 {
|
|
||||||
|
|
||||||
// 7.2, Class template basic_string_view
|
|
||||||
template<class charT, class traits = char_traits<charT>>
|
|
||||||
class basic_string_view;
|
|
||||||
|
|
||||||
// 7.9, basic_string_view non-member comparison functions
|
|
||||||
template<class charT, class traits>
|
|
||||||
constexpr bool operator==(basic_string_view<charT, traits> x,
|
|
||||||
basic_string_view<charT, traits> y) noexcept;
|
|
||||||
template<class charT, class traits>
|
|
||||||
constexpr bool operator!=(basic_string_view<charT, traits> x,
|
|
||||||
basic_string_view<charT, traits> y) noexcept;
|
|
||||||
template<class charT, class traits>
|
|
||||||
constexpr bool operator< (basic_string_view<charT, traits> x,
|
|
||||||
basic_string_view<charT, traits> y) noexcept;
|
|
||||||
template<class charT, class traits>
|
|
||||||
constexpr bool operator> (basic_string_view<charT, traits> x,
|
|
||||||
basic_string_view<charT, traits> y) noexcept;
|
|
||||||
template<class charT, class traits>
|
|
||||||
constexpr bool operator<=(basic_string_view<charT, traits> x,
|
|
||||||
basic_string_view<charT, traits> y) noexcept;
|
|
||||||
template<class charT, class traits>
|
|
||||||
constexpr bool operator>=(basic_string_view<charT, traits> x,
|
|
||||||
basic_string_view<charT, traits> y) noexcept;
|
|
||||||
// see below, sufficient additional overloads of comparison functions
|
|
||||||
|
|
||||||
// 7.10, Inserters and extractors
|
|
||||||
template<class charT, class traits>
|
|
||||||
basic_ostream<charT, traits>&
|
|
||||||
operator<<(basic_ostream<charT, traits>& os,
|
|
||||||
basic_string_view<charT, traits> str);
|
|
||||||
|
|
||||||
// basic_string_view typedef names
|
|
||||||
typedef basic_string_view<char> string_view;
|
|
||||||
typedef basic_string_view<char16_t> u16string_view;
|
|
||||||
typedef basic_string_view<char32_t> u32string_view;
|
|
||||||
typedef basic_string_view<wchar_t> wstring_view;
|
|
||||||
|
|
||||||
template<class charT, class traits = char_traits<charT>>
|
|
||||||
class basic_string_view {
|
|
||||||
public:
|
|
||||||
// types
|
|
||||||
typedef traits traits_type;
|
|
||||||
typedef charT value_type;
|
|
||||||
typedef charT* pointer;
|
|
||||||
typedef const charT* const_pointer;
|
|
||||||
typedef charT& reference;
|
|
||||||
typedef const charT& const_reference;
|
|
||||||
typedef implementation-defined const_iterator;
|
|
||||||
typedef const_iterator iterator;
|
|
||||||
typedef reverse_iterator<const_iterator> const_reverse_iterator;
|
|
||||||
typedef const_reverse_iterator reverse_iterator;
|
|
||||||
typedef size_t size_type;
|
|
||||||
typedef ptrdiff_t difference_type;
|
|
||||||
static constexpr size_type npos = size_type(-1);
|
|
||||||
|
|
||||||
// 7.3, basic_string_view constructors and assignment operators
|
|
||||||
constexpr basic_string_view() noexcept;
|
|
||||||
constexpr basic_string_view(const basic_string_view&) noexcept = default;
|
|
||||||
basic_string_view& operator=(const basic_string_view&) noexcept = default;
|
|
||||||
template<class Allocator>
|
|
||||||
basic_string_view(const basic_string<charT, traits, Allocator>& str) noexcept;
|
|
||||||
constexpr basic_string_view(const charT* str);
|
|
||||||
constexpr basic_string_view(const charT* str, size_type len);
|
|
||||||
|
|
||||||
// 7.4, basic_string_view iterator support
|
|
||||||
constexpr const_iterator begin() const noexcept;
|
|
||||||
constexpr const_iterator end() const noexcept;
|
|
||||||
constexpr const_iterator cbegin() const noexcept;
|
|
||||||
constexpr const_iterator cend() const noexcept;
|
|
||||||
const_reverse_iterator rbegin() const noexcept;
|
|
||||||
const_reverse_iterator rend() const noexcept;
|
|
||||||
const_reverse_iterator crbegin() const noexcept;
|
|
||||||
const_reverse_iterator crend() const noexcept;
|
|
||||||
|
|
||||||
// 7.5, basic_string_view capacity
|
|
||||||
constexpr size_type size() const noexcept;
|
|
||||||
constexpr size_type length() const noexcept;
|
|
||||||
constexpr size_type max_size() const noexcept;
|
|
||||||
constexpr bool empty() const noexcept;
|
|
||||||
|
|
||||||
// 7.6, basic_string_view element access
|
|
||||||
constexpr const_reference operator[](size_type pos) const;
|
|
||||||
constexpr const_reference at(size_type pos) const;
|
|
||||||
constexpr const_reference front() const;
|
|
||||||
constexpr const_reference back() const;
|
|
||||||
constexpr const_pointer data() const noexcept;
|
|
||||||
|
|
||||||
// 7.7, basic_string_view modifiers
|
|
||||||
constexpr void clear() noexcept;
|
|
||||||
constexpr void remove_prefix(size_type n);
|
|
||||||
constexpr void remove_suffix(size_type n);
|
|
||||||
constexpr void swap(basic_string_view& s) noexcept;
|
|
||||||
|
|
||||||
// 7.8, basic_string_view string operations
|
|
||||||
template<class Allocator>
|
|
||||||
explicit operator basic_string<charT, traits, Allocator>() const;
|
|
||||||
template<class Allocator = allocator<charT>>
|
|
||||||
basic_string<charT, traits, Allocator> to_string(
|
|
||||||
const Allocator& a = Allocator()) const;
|
|
||||||
|
|
||||||
size_type copy(charT* s, size_type n, size_type pos = 0) const;
|
|
||||||
|
|
||||||
constexpr basic_string_view substr(size_type pos = 0, size_type n = npos) const;
|
|
||||||
constexpr int compare(basic_string_view s) const noexcept;
|
|
||||||
constexpr int compare(size_type pos1, size_type n1, basic_string_view s) const;
|
|
||||||
constexpr int compare(size_type pos1, size_type n1,
|
|
||||||
basic_string_view s, size_type pos2, size_type n2) const;
|
|
||||||
constexpr int compare(const charT* s) const;
|
|
||||||
constexpr int compare(size_type pos1, size_type n1, const charT* s) const;
|
|
||||||
constexpr int compare(size_type pos1, size_type n1,
|
|
||||||
const charT* s, size_type n2) const;
|
|
||||||
constexpr size_type find(basic_string_view s, size_type pos = 0) const noexcept;
|
|
||||||
constexpr size_type find(charT c, size_type pos = 0) const noexcept;
|
|
||||||
constexpr size_type find(const charT* s, size_type pos, size_type n) const;
|
|
||||||
constexpr size_type find(const charT* s, size_type pos = 0) const;
|
|
||||||
constexpr size_type rfind(basic_string_view s, size_type pos = npos) const noexcept;
|
|
||||||
constexpr size_type rfind(charT c, size_type pos = npos) const noexcept;
|
|
||||||
constexpr size_type rfind(const charT* s, size_type pos, size_type n) const;
|
|
||||||
constexpr size_type rfind(const charT* s, size_type pos = npos) const;
|
|
||||||
constexpr size_type find_first_of(basic_string_view s, size_type pos = 0) const noexcept;
|
|
||||||
constexpr size_type find_first_of(charT c, size_type pos = 0) const noexcept;
|
|
||||||
constexpr size_type find_first_of(const charT* s, size_type pos, size_type n) const;
|
|
||||||
constexpr size_type find_first_of(const charT* s, size_type pos = 0) const;
|
|
||||||
constexpr size_type find_last_of(basic_string_view s, size_type pos = npos) const noexcept;
|
|
||||||
constexpr size_type find_last_of(charT c, size_type pos = npos) const noexcept;
|
|
||||||
constexpr size_type find_last_of(const charT* s, size_type pos, size_type n) const;
|
|
||||||
constexpr size_type find_last_of(const charT* s, size_type pos = npos) const;
|
|
||||||
constexpr size_type find_first_not_of(basic_string_view s, size_type pos = 0) const noexcept;
|
|
||||||
constexpr size_type find_first_not_of(charT c, size_type pos = 0) const noexcept;
|
|
||||||
constexpr size_type find_first_not_of(const charT* s, size_type pos, size_type n) const;
|
|
||||||
constexpr size_type find_first_not_of(const charT* s, size_type pos = 0) const;
|
|
||||||
constexpr size_type find_last_not_of(basic_string_view s, size_type pos = npos) const noexcept;
|
|
||||||
constexpr size_type find_last_not_of(charT c, size_type pos = npos) const noexcept;
|
|
||||||
constexpr size_type find_last_not_of(const charT* s, size_type pos, size_type n) const;
|
|
||||||
constexpr size_type find_last_not_of(const charT* s, size_type pos = npos) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
const_pointer data_; // exposition only
|
|
||||||
size_type size_; // exposition only
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace fundamentals_v1
|
|
||||||
} // namespace experimental
|
|
||||||
|
|
||||||
// 7.11, Hash support
|
|
||||||
template <class T> struct hash;
|
|
||||||
template <> struct hash<experimental::string_view>;
|
|
||||||
template <> struct hash<experimental::u16string_view>;
|
|
||||||
template <> struct hash<experimental::u32string_view>;
|
|
||||||
template <> struct hash<experimental::wstring_view>;
|
|
||||||
|
|
||||||
} // namespace std
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <experimental/__config>
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <iterator>
|
|
||||||
#include <ostream>
|
|
||||||
#include <iomanip>
|
|
||||||
|
|
||||||
#include <__debug>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
|
||||||
|
|
||||||
template<class _CharT, class _Traits = _VSTD::char_traits<_CharT> >
|
|
||||||
class _LIBCPP_TYPE_VIS_ONLY basic_string_view {
|
|
||||||
public:
|
|
||||||
// types
|
|
||||||
typedef _Traits traits_type;
|
|
||||||
typedef _CharT value_type;
|
|
||||||
typedef const _CharT* pointer;
|
|
||||||
typedef const _CharT* const_pointer;
|
|
||||||
typedef const _CharT& reference;
|
|
||||||
typedef const _CharT& const_reference;
|
|
||||||
typedef const_pointer const_iterator; // See [string.view.iterators]
|
|
||||||
typedef const_iterator iterator;
|
|
||||||
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
|
|
||||||
typedef const_reverse_iterator reverse_iterator;
|
|
||||||
typedef size_t size_type;
|
|
||||||
typedef ptrdiff_t difference_type;
|
|
||||||
static _LIBCPP_CONSTEXPR const size_type npos = -1; // size_type(-1);
|
|
||||||
|
|
||||||
// [string.view.cons], construct/copy
|
|
||||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
|
||||||
basic_string_view() _NOEXCEPT : __data (nullptr), __size(0) {}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
|
||||||
basic_string_view(const basic_string_view&) _NOEXCEPT = default;
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
basic_string_view& operator=(const basic_string_view&) _NOEXCEPT = default;
|
|
||||||
|
|
||||||
template<class _Allocator>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
basic_string_view(const basic_string<_CharT, _Traits, _Allocator>& __str) _NOEXCEPT
|
|
||||||
: __data (__str.data()), __size(__str.size()) {}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
|
||||||
basic_string_view(const _CharT* __s, size_type __len)
|
|
||||||
: __data(__s), __size(__len)
|
|
||||||
{
|
|
||||||
// _LIBCPP_ASSERT(__len == 0 || __s != nullptr, "string_view::string_view(_CharT *, size_t): recieved nullptr");
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
|
||||||
basic_string_view(const _CharT* __s)
|
|
||||||
: __data(__s), __size(_Traits::length(__s)) {}
|
|
||||||
|
|
||||||
// [string.view.iterators], iterators
|
|
||||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
|
||||||
const_iterator begin() const _NOEXCEPT { return cbegin(); }
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
|
||||||
const_iterator end() const _NOEXCEPT { return cend(); }
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
|
||||||
const_iterator cbegin() const _NOEXCEPT { return __data; }
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
|
||||||
const_iterator cend() const _NOEXCEPT { return __data + __size; }
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); }
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(cbegin()); }
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
const_reverse_iterator crbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); }
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
const_reverse_iterator crend() const _NOEXCEPT { return const_reverse_iterator(cbegin()); }
|
|
||||||
|
|
||||||
// [string.view.capacity], capacity
|
|
||||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type size() const _NOEXCEPT { return __size; }
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type length() const _NOEXCEPT { return __size; }
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type max_size() const _NOEXCEPT { return _VSTD::numeric_limits<size_type>::max(); }
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR bool _LIBCPP_INLINE_VISIBILITY
|
|
||||||
empty() const _NOEXCEPT { return __size == 0; }
|
|
||||||
|
|
||||||
// [string.view.access], element access
|
|
||||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
|
||||||
const_reference operator[](size_type __pos) const { return __data[__pos]; }
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
|
||||||
const_reference at(size_type __pos) const
|
|
||||||
{
|
|
||||||
return __pos >= size()
|
|
||||||
? (throw out_of_range("string_view::at"), __data[0])
|
|
||||||
: __data[__pos];
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
|
||||||
const_reference front() const
|
|
||||||
{
|
|
||||||
return _LIBCPP_ASSERT(!empty(), "string_view::front(): string is empty"), __data[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
|
||||||
const_reference back() const
|
|
||||||
{
|
|
||||||
return _LIBCPP_ASSERT(!empty(), "string_view::back(): string is empty"), __data[__size-1];
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
|
||||||
const_pointer data() const _NOEXCEPT { return __data; }
|
|
||||||
|
|
||||||
// [string.view.modifiers], modifiers:
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
void clear() _NOEXCEPT
|
|
||||||
{
|
|
||||||
__data = nullptr;
|
|
||||||
__size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
void remove_prefix(size_type __n) _NOEXCEPT
|
|
||||||
{
|
|
||||||
_LIBCPP_ASSERT(__n <= size(), "remove_prefix() can't remove more than size()");
|
|
||||||
__data += __n;
|
|
||||||
__size -= __n;
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
void remove_suffix(size_type __n) _NOEXCEPT
|
|
||||||
{
|
|
||||||
_LIBCPP_ASSERT(__n <= size(), "remove_suffix() can't remove more than size()");
|
|
||||||
__size -= __n;
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
void swap(basic_string_view& __other) _NOEXCEPT
|
|
||||||
{
|
|
||||||
const value_type *__p = __data;
|
|
||||||
__data = __other.__data;
|
|
||||||
__other.__data = __p;
|
|
||||||
|
|
||||||
size_type __sz = __size;
|
|
||||||
__size = __other.__size;
|
|
||||||
__other.__size = __sz;
|
|
||||||
// _VSTD::swap( __data, __other.__data );
|
|
||||||
// _VSTD::swap( __size, __other.__size );
|
|
||||||
}
|
|
||||||
|
|
||||||
// [string.view.ops], string operations:
|
|
||||||
template<class _Allocator>
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
_LIBCPP_EXPLICIT operator basic_string<_CharT, _Traits, _Allocator>() const
|
|
||||||
{ return basic_string<_CharT, _Traits, _Allocator>( begin(), end()); }
|
|
||||||
|
|
||||||
template<class _Allocator = allocator<_CharT> >
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
basic_string<_CharT, _Traits, _Allocator>
|
|
||||||
to_string( const _Allocator& __a = _Allocator()) const
|
|
||||||
{ return basic_string<_CharT, _Traits, _Allocator> ( begin(), end(), __a ); }
|
|
||||||
|
|
||||||
size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const
|
|
||||||
{
|
|
||||||
if ( __pos > size())
|
|
||||||
throw out_of_range("string_view::copy");
|
|
||||||
size_type __rlen = _VSTD::min( __n, size() - __pos );
|
|
||||||
_VSTD::copy_n(begin() + __pos, __rlen, __s );
|
|
||||||
return __rlen;
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR
|
|
||||||
basic_string_view substr(size_type __pos = 0, size_type __n = npos) const
|
|
||||||
{
|
|
||||||
// if (__pos > size())
|
|
||||||
// throw out_of_range("string_view::substr");
|
|
||||||
// size_type __rlen = _VSTD::min( __n, size() - __pos );
|
|
||||||
// return basic_string_view(data() + __pos, __rlen);
|
|
||||||
return __pos > size()
|
|
||||||
? throw out_of_range("string_view::substr")
|
|
||||||
: basic_string_view(data() + __pos, _VSTD::min(__n, size() - __pos));
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 int compare(basic_string_view __sv) const _NOEXCEPT
|
|
||||||
{
|
|
||||||
size_type __rlen = _VSTD::min( size(), __sv.size());
|
|
||||||
int __retval = _Traits::compare(data(), __sv.data(), __rlen);
|
|
||||||
if ( __retval == 0 ) // first __rlen chars matched
|
|
||||||
__retval = size() == __sv.size() ? 0 : ( size() < __sv.size() ? -1 : 1 );
|
|
||||||
return __retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
int compare(size_type __pos1, size_type __n1, basic_string_view __sv) const
|
|
||||||
{
|
|
||||||
return substr(__pos1, __n1).compare(__sv);
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
int compare( size_type __pos1, size_type __n1,
|
|
||||||
basic_string_view _sv, size_type __pos2, size_type __n2) const
|
|
||||||
{
|
|
||||||
return substr(__pos1, __n1).compare(_sv.substr(__pos2, __n2));
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
int compare(const _CharT* __s) const
|
|
||||||
{
|
|
||||||
return compare(basic_string_view(__s));
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
int compare(size_type __pos1, size_type __n1, const _CharT* __s) const
|
|
||||||
{
|
|
||||||
return substr(__pos1, __n1).compare(basic_string_view(__s));
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
int compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const
|
|
||||||
{
|
|
||||||
return substr(__pos1, __n1).compare(basic_string_view(__s, __n2));
|
|
||||||
}
|
|
||||||
|
|
||||||
// find
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type find(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT
|
|
||||||
{
|
|
||||||
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): recieved nullptr");
|
|
||||||
return _VSTD::__str_find<value_type, size_type, traits_type, npos>
|
|
||||||
(data(), size(), __s.data(), __pos, __s.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type find(_CharT __c, size_type __pos = 0) const _NOEXCEPT
|
|
||||||
{
|
|
||||||
return _VSTD::__str_find<value_type, size_type, traits_type, npos>
|
|
||||||
(data(), size(), __c, __pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type find(const _CharT* __s, size_type __pos, size_type __n) const
|
|
||||||
{
|
|
||||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find(): recieved nullptr");
|
|
||||||
return _VSTD::__str_find<value_type, size_type, traits_type, npos>
|
|
||||||
(data(), size(), __s, __pos, __n);
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type find(const _CharT* __s, size_type __pos = 0) const
|
|
||||||
{
|
|
||||||
_LIBCPP_ASSERT(__s != nullptr, "string_view::find(): recieved nullptr");
|
|
||||||
return _VSTD::__str_find<value_type, size_type, traits_type, npos>
|
|
||||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
|
||||||
}
|
|
||||||
|
|
||||||
// rfind
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type rfind(basic_string_view __s, size_type __pos = npos) const _NOEXCEPT
|
|
||||||
{
|
|
||||||
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): recieved nullptr");
|
|
||||||
return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
|
|
||||||
(data(), size(), __s.data(), __pos, __s.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type rfind(_CharT __c, size_type __pos = npos) const _NOEXCEPT
|
|
||||||
{
|
|
||||||
return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
|
|
||||||
(data(), size(), __c, __pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const
|
|
||||||
{
|
|
||||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::rfind(): recieved nullptr");
|
|
||||||
return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
|
|
||||||
(data(), size(), __s, __pos, __n);
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type rfind(const _CharT* __s, size_type __pos=npos) const
|
|
||||||
{
|
|
||||||
_LIBCPP_ASSERT(__s != nullptr, "string_view::rfind(): recieved nullptr");
|
|
||||||
return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
|
|
||||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
|
||||||
}
|
|
||||||
|
|
||||||
// find_first_of
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type find_first_of(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT
|
|
||||||
{
|
|
||||||
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_of(): recieved nullptr");
|
|
||||||
return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
|
|
||||||
(data(), size(), __s.data(), __pos, __s.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type find_first_of(_CharT __c, size_type __pos = 0) const _NOEXCEPT
|
|
||||||
{ return find(__c, __pos); }
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const
|
|
||||||
{
|
|
||||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_of(): recieved nullptr");
|
|
||||||
return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
|
|
||||||
(data(), size(), __s, __pos, __n);
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type find_first_of(const _CharT* __s, size_type __pos=0) const
|
|
||||||
{
|
|
||||||
_LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_of(): recieved nullptr");
|
|
||||||
return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
|
|
||||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
|
||||||
}
|
|
||||||
|
|
||||||
// find_last_of
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type find_last_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT
|
|
||||||
{
|
|
||||||
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_of(): recieved nullptr");
|
|
||||||
return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
|
|
||||||
(data(), size(), __s.data(), __pos, __s.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type find_last_of(_CharT __c, size_type __pos = npos) const _NOEXCEPT
|
|
||||||
{ return rfind(__c, __pos); }
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const
|
|
||||||
{
|
|
||||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_of(): recieved nullptr");
|
|
||||||
return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
|
|
||||||
(data(), size(), __s, __pos, __n);
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type find_last_of(const _CharT* __s, size_type __pos=npos) const
|
|
||||||
{
|
|
||||||
_LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_of(): recieved nullptr");
|
|
||||||
return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
|
|
||||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
|
||||||
}
|
|
||||||
|
|
||||||
// find_first_not_of
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type find_first_not_of(basic_string_view __s, size_type __pos=0) const _NOEXCEPT
|
|
||||||
{
|
|
||||||
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_not_of(): recieved nullptr");
|
|
||||||
return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
|
|
||||||
(data(), size(), __s.data(), __pos, __s.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type find_first_not_of(_CharT __c, size_type __pos=0) const _NOEXCEPT
|
|
||||||
{
|
|
||||||
return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
|
|
||||||
(data(), size(), __c, __pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const
|
|
||||||
{
|
|
||||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_not_of(): recieved nullptr");
|
|
||||||
return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
|
|
||||||
(data(), size(), __s, __pos, __n);
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type find_first_not_of(const _CharT* __s, size_type __pos=0) const
|
|
||||||
{
|
|
||||||
_LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_not_of(): recieved nullptr");
|
|
||||||
return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
|
|
||||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
|
||||||
}
|
|
||||||
|
|
||||||
// find_last_not_of
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type find_last_not_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT
|
|
||||||
{
|
|
||||||
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_not_of(): recieved nullptr");
|
|
||||||
return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
|
|
||||||
(data(), size(), __s.data(), __pos, __s.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type find_last_not_of(_CharT __c, size_type __pos=npos) const _NOEXCEPT
|
|
||||||
{
|
|
||||||
return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
|
|
||||||
(data(), size(), __c, __pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
|
|
||||||
{
|
|
||||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_not_of(): recieved nullptr");
|
|
||||||
return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
|
|
||||||
(data(), size(), __s, __pos, __n);
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_type find_last_not_of(const _CharT* __s, size_type __pos=npos) const
|
|
||||||
{
|
|
||||||
_LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_not_of(): recieved nullptr");
|
|
||||||
return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
|
|
||||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
const value_type* __data;
|
|
||||||
size_type __size;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// [string.view.comparison]
|
|
||||||
// operator ==
|
|
||||||
template<class _CharT, class _Traits>
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool operator==(basic_string_view<_CharT, _Traits> __lhs,
|
|
||||||
basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
|
||||||
{
|
|
||||||
if ( __lhs.size() != __rhs.size()) return false;
|
|
||||||
return __lhs.compare(__rhs) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class _CharT, class _Traits>
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool operator==(basic_string_view<_CharT, _Traits> __lhs,
|
|
||||||
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
|
|
||||||
{
|
|
||||||
if ( __lhs.size() != __rhs.size()) return false;
|
|
||||||
return __lhs.compare(__rhs) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class _CharT, class _Traits>
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool operator==(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
|
|
||||||
basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
|
||||||
{
|
|
||||||
if ( __lhs.size() != __rhs.size()) return false;
|
|
||||||
return __lhs.compare(__rhs) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// operator !=
|
|
||||||
template<class _CharT, class _Traits>
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool operator!=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
|
||||||
{
|
|
||||||
if ( __lhs.size() != __rhs.size())
|
|
||||||
return true;
|
|
||||||
return __lhs.compare(__rhs) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class _CharT, class _Traits>
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool operator!=(basic_string_view<_CharT, _Traits> __lhs,
|
|
||||||
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
|
|
||||||
{
|
|
||||||
if ( __lhs.size() != __rhs.size())
|
|
||||||
return true;
|
|
||||||
return __lhs.compare(__rhs) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class _CharT, class _Traits>
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool operator!=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
|
|
||||||
basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
|
||||||
{
|
|
||||||
if ( __lhs.size() != __rhs.size())
|
|
||||||
return true;
|
|
||||||
return __lhs.compare(__rhs) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// operator <
|
|
||||||
template<class _CharT, class _Traits>
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool operator<(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
|
||||||
{
|
|
||||||
return __lhs.compare(__rhs) < 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class _CharT, class _Traits>
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool operator<(basic_string_view<_CharT, _Traits> __lhs,
|
|
||||||
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
|
|
||||||
{
|
|
||||||
return __lhs.compare(__rhs) < 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class _CharT, class _Traits>
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool operator<(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
|
|
||||||
basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
|
||||||
{
|
|
||||||
return __lhs.compare(__rhs) < 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// operator >
|
|
||||||
template<class _CharT, class _Traits>
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool operator> (basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
|
||||||
{
|
|
||||||
return __lhs.compare(__rhs) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class _CharT, class _Traits>
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool operator>(basic_string_view<_CharT, _Traits> __lhs,
|
|
||||||
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
|
|
||||||
{
|
|
||||||
return __lhs.compare(__rhs) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class _CharT, class _Traits>
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool operator>(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
|
|
||||||
basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
|
||||||
{
|
|
||||||
return __lhs.compare(__rhs) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// operator <=
|
|
||||||
template<class _CharT, class _Traits>
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool operator<=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
|
||||||
{
|
|
||||||
return __lhs.compare(__rhs) <= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class _CharT, class _Traits>
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool operator<=(basic_string_view<_CharT, _Traits> __lhs,
|
|
||||||
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
|
|
||||||
{
|
|
||||||
return __lhs.compare(__rhs) <= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class _CharT, class _Traits>
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool operator<=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
|
|
||||||
basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
|
||||||
{
|
|
||||||
return __lhs.compare(__rhs) <= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// operator >=
|
|
||||||
template<class _CharT, class _Traits>
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool operator>=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
|
||||||
{
|
|
||||||
return __lhs.compare(__rhs) >= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class _CharT, class _Traits>
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool operator>=(basic_string_view<_CharT, _Traits> __lhs,
|
|
||||||
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
|
|
||||||
{
|
|
||||||
return __lhs.compare(__rhs) >= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class _CharT, class _Traits>
|
|
||||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|
||||||
bool operator>=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
|
|
||||||
basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
|
||||||
{
|
|
||||||
return __lhs.compare(__rhs) >= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// [string.view.io]
|
|
||||||
template<class _CharT, class _Traits>
|
|
||||||
basic_ostream<_CharT, _Traits>&
|
|
||||||
operator<<(basic_ostream<_CharT, _Traits>& __os, basic_string_view<_CharT, _Traits> __sv)
|
|
||||||
{
|
|
||||||
return _VSTD::__put_character_sequence(__os, __sv.data(), __sv.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef basic_string_view<char> string_view;
|
|
||||||
typedef basic_string_view<char16_t> u16string_view;
|
|
||||||
typedef basic_string_view<char32_t> u32string_view;
|
|
||||||
typedef basic_string_view<wchar_t> wstring_view;
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_LFTS
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
|
||||||
|
|
||||||
// [string.view.hash]
|
|
||||||
// Shamelessly stolen from <string>
|
|
||||||
template<class _CharT, class _Traits>
|
|
||||||
struct _LIBCPP_TYPE_VIS_ONLY hash<std::experimental::basic_string_view<_CharT, _Traits> >
|
|
||||||
: public unary_function<std::experimental::basic_string_view<_CharT, _Traits>, size_t>
|
|
||||||
{
|
|
||||||
size_t operator()(const std::experimental::basic_string_view<_CharT, _Traits>& __val) const _NOEXCEPT;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class _CharT, class _Traits>
|
|
||||||
size_t
|
|
||||||
hash<std::experimental::basic_string_view<_CharT, _Traits> >::operator()(
|
|
||||||
const std::experimental::basic_string_view<_CharT, _Traits>& __val) const _NOEXCEPT
|
|
||||||
{
|
|
||||||
return __do_string_hash(__val.data(), __val.data() + __val.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
template <class _CharT, class _Traits>
|
|
||||||
__quoted_output_proxy<_CharT, const _CharT *, _Traits>
|
|
||||||
quoted ( std::experimental::basic_string_view <_CharT, _Traits> __sv,
|
|
||||||
_CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\'))
|
|
||||||
{
|
|
||||||
return __quoted_output_proxy<_CharT, const _CharT *, _Traits>
|
|
||||||
( __sv.data(), __sv.data() + __sv.size(), __delim, __escape );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_STD
|
|
||||||
|
|
||||||
#endif // _LIBCPP_LFTS_STRING_VIEW
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
//===-------------------------- system_error ------------------------------===//
|
|
||||||
//
|
|
||||||
// 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_EXPERIMENTAL_SYSTEM_ERROR
|
|
||||||
#define _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR
|
|
||||||
|
|
||||||
/**
|
|
||||||
experimental/system_error synopsis
|
|
||||||
|
|
||||||
// C++1y
|
|
||||||
|
|
||||||
#include <system_error>
|
|
||||||
|
|
||||||
namespace std {
|
|
||||||
namespace experimental {
|
|
||||||
inline namespace fundamentals_v1 {
|
|
||||||
|
|
||||||
// See C++14 19.5, System error support
|
|
||||||
template <class T> constexpr bool is_error_code_enum_v
|
|
||||||
= is_error_code_enum<T>::value;
|
|
||||||
template <class T> constexpr bool is_error_condition_enum_v
|
|
||||||
= is_error_condition_enum<T>::value;
|
|
||||||
|
|
||||||
} // namespace fundamentals_v1
|
|
||||||
} // namespace experimental
|
|
||||||
} // namespace std
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <experimental/__config>
|
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
|
|
||||||
#include <system_error>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_error_code_enum_v
|
|
||||||
= is_error_code_enum<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_error_condition_enum_v
|
|
||||||
= is_error_condition_enum<_Tp>::value;
|
|
||||||
|
|
||||||
#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_LFTS
|
|
||||||
|
|
||||||
#endif /* _LIBCPP_STD_VER > 11 */
|
|
||||||
|
|
||||||
#endif /* _LIBCPP_EXPERIMENTAL_SYSTEM_ERROR */
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
//===----------------------------- tuple ----------------------------------===//
|
|
||||||
//
|
|
||||||
// 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_EXPERIMENTAL_TUPLE
|
|
||||||
#define _LIBCPP_EXPERIMENTAL_TUPLE
|
|
||||||
|
|
||||||
/*
|
|
||||||
experimental/tuple synopsis
|
|
||||||
|
|
||||||
// C++1y
|
|
||||||
|
|
||||||
#include <tuple>
|
|
||||||
|
|
||||||
namespace std {
|
|
||||||
namespace experimental {
|
|
||||||
inline namespace fundamentals_v1 {
|
|
||||||
|
|
||||||
// See C++14 20.4.2.5, tuple helper classes
|
|
||||||
template <class T> constexpr size_t tuple_size_v
|
|
||||||
= tuple_size<T>::value;
|
|
||||||
|
|
||||||
// 3.2.2, Calling a function with a tuple of arguments
|
|
||||||
template <class F, class Tuple>
|
|
||||||
constexpr decltype(auto) apply(F&& f, Tuple&& t);
|
|
||||||
|
|
||||||
} // namespace fundamentals_v1
|
|
||||||
} // namespace experimental
|
|
||||||
} // namespace std
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
# include <experimental/__config>
|
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
|
|
||||||
# include <tuple>
|
|
||||||
# include <utility>
|
|
||||||
# include <__functional_base>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
|
||||||
template <class _Tp>
|
|
||||||
_LIBCPP_CONSTEXPR size_t tuple_size_v = tuple_size<_Tp>::value;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <class _Fn, class _Tuple, size_t ..._Id>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
decltype(auto) __apply_tuple_impl(_Fn && __f, _Tuple && __t,
|
|
||||||
integer_sequence<size_t, _Id...>) {
|
|
||||||
return _VSTD::__invoke(
|
|
||||||
_VSTD::forward<_Fn>(__f),
|
|
||||||
_VSTD::get<_Id>(_VSTD::forward<_Tuple>(__t))...
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Fn, class _Tuple>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
|
||||||
decltype(auto) apply(_Fn && __f, _Tuple && __t) {
|
|
||||||
return _VSTD_LFTS::__apply_tuple_impl(
|
|
||||||
_VSTD::forward<_Fn>(__f), _VSTD::forward<_Tuple>(__t),
|
|
||||||
make_index_sequence<tuple_size<typename decay<_Tuple>::type>::value>()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_LFTS
|
|
||||||
|
|
||||||
#endif /* _LIBCPP_STD_VER > 11 */
|
|
||||||
|
|
||||||
#endif /* _LIBCPP_EXPERIMENTAL_TUPLE */
|
|
||||||
@@ -1,427 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
//===-------------------------- type_traits -------------------------------===//
|
|
||||||
//
|
|
||||||
// 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_EXPERIMENTAL_TYPE_TRAITS
|
|
||||||
#define _LIBCPP_EXPERIMENTAL_TYPE_TRAITS
|
|
||||||
|
|
||||||
/**
|
|
||||||
experimental/type_traits synopsis
|
|
||||||
|
|
||||||
// C++1y
|
|
||||||
#include <type_traits>
|
|
||||||
|
|
||||||
namespace std {
|
|
||||||
namespace experimental {
|
|
||||||
inline namespace fundamentals_v1 {
|
|
||||||
|
|
||||||
// See C++14 20.10.4.1, primary type categories
|
|
||||||
template <class T> constexpr bool is_void_v
|
|
||||||
= is_void<T>::value;
|
|
||||||
template <class T> constexpr bool is_null_pointer_v
|
|
||||||
= is_null_pointer<T>::value;
|
|
||||||
template <class T> constexpr bool is_integral_v
|
|
||||||
= is_integral<T>::value;
|
|
||||||
template <class T> constexpr bool is_floating_point_v
|
|
||||||
= is_floating_point<T>::value;
|
|
||||||
template <class T> constexpr bool is_array_v
|
|
||||||
= is_array<T>::value;
|
|
||||||
template <class T> constexpr bool is_pointer_v
|
|
||||||
= is_pointer<T>::value;
|
|
||||||
template <class T> constexpr bool is_lvalue_reference_v
|
|
||||||
= is_lvalue_reference<T>::value;
|
|
||||||
template <class T> constexpr bool is_rvalue_reference_v
|
|
||||||
= is_rvalue_reference<T>::value;
|
|
||||||
template <class T> constexpr bool is_member_object_pointer_v
|
|
||||||
= is_member_object_pointer<T>::value;
|
|
||||||
template <class T> constexpr bool is_member_function_pointer_v
|
|
||||||
= is_member_function_pointer<T>::value;
|
|
||||||
template <class T> constexpr bool is_enum_v
|
|
||||||
= is_enum<T>::value;
|
|
||||||
template <class T> constexpr bool is_union_v
|
|
||||||
= is_union<T>::value;
|
|
||||||
template <class T> constexpr bool is_class_v
|
|
||||||
= is_class<T>::value;
|
|
||||||
template <class T> constexpr bool is_function_v
|
|
||||||
= is_function<T>::value;
|
|
||||||
|
|
||||||
// See C++14 20.10.4.2, composite type categories
|
|
||||||
template <class T> constexpr bool is_reference_v
|
|
||||||
= is_reference<T>::value;
|
|
||||||
template <class T> constexpr bool is_arithmetic_v
|
|
||||||
= is_arithmetic<T>::value;
|
|
||||||
template <class T> constexpr bool is_fundamental_v
|
|
||||||
= is_fundamental<T>::value;
|
|
||||||
template <class T> constexpr bool is_object_v
|
|
||||||
= is_object<T>::value;
|
|
||||||
template <class T> constexpr bool is_scalar_v
|
|
||||||
= is_scalar<T>::value;
|
|
||||||
template <class T> constexpr bool is_compound_v
|
|
||||||
= is_compound<T>::value;
|
|
||||||
template <class T> constexpr bool is_member_pointer_v
|
|
||||||
= is_member_pointer<T>::value;
|
|
||||||
|
|
||||||
// See C++14 20.10.4.3, type properties
|
|
||||||
template <class T> constexpr bool is_const_v
|
|
||||||
= is_const<T>::value;
|
|
||||||
template <class T> constexpr bool is_volatile_v
|
|
||||||
= is_volatile<T>::value;
|
|
||||||
template <class T> constexpr bool is_trivial_v
|
|
||||||
= is_trivial<T>::value;
|
|
||||||
template <class T> constexpr bool is_trivially_copyable_v
|
|
||||||
= is_trivially_copyable<T>::value;
|
|
||||||
template <class T> constexpr bool is_standard_layout_v
|
|
||||||
= is_standard_layout<T>::value;
|
|
||||||
template <class T> constexpr bool is_pod_v
|
|
||||||
= is_pod<T>::value;
|
|
||||||
template <class T> constexpr bool is_literal_type_v
|
|
||||||
= is_literal_type<T>::value;
|
|
||||||
template <class T> constexpr bool is_empty_v
|
|
||||||
= is_empty<T>::value;
|
|
||||||
template <class T> constexpr bool is_polymorphic_v
|
|
||||||
= is_polymorphic<T>::value;
|
|
||||||
template <class T> constexpr bool is_abstract_v
|
|
||||||
= is_abstract<T>::value;
|
|
||||||
template <class T> constexpr bool is_final_v
|
|
||||||
= is_final<T>::value;
|
|
||||||
template <class T> constexpr bool is_signed_v
|
|
||||||
= is_signed<T>::value;
|
|
||||||
template <class T> constexpr bool is_unsigned_v
|
|
||||||
= is_unsigned<T>::value;
|
|
||||||
template <class T, class... Args> constexpr bool is_constructible_v
|
|
||||||
= is_constructible<T, Args...>::value;
|
|
||||||
template <class T> constexpr bool is_default_constructible_v
|
|
||||||
= is_default_constructible<T>::value;
|
|
||||||
template <class T> constexpr bool is_copy_constructible_v
|
|
||||||
= is_copy_constructible<T>::value;
|
|
||||||
template <class T> constexpr bool is_move_constructible_v
|
|
||||||
= is_move_constructible<T>::value;
|
|
||||||
template <class T, class U> constexpr bool is_assignable_v
|
|
||||||
= is_assignable<T, U>::value;
|
|
||||||
template <class T> constexpr bool is_copy_assignable_v
|
|
||||||
= is_copy_assignable<T>::value;
|
|
||||||
template <class T> constexpr bool is_move_assignable_v
|
|
||||||
= is_move_assignable<T>::value;
|
|
||||||
template <class T> constexpr bool is_destructible_v
|
|
||||||
= is_destructible<T>::value;
|
|
||||||
template <class T, class... Args> constexpr bool is_trivially_constructible_v
|
|
||||||
= is_trivially_constructible<T, Args...>::value;
|
|
||||||
template <class T> constexpr bool is_trivially_default_constructible_v
|
|
||||||
= is_trivially_default_constructible<T>::value;
|
|
||||||
template <class T> constexpr bool is_trivially_copy_constructible_v
|
|
||||||
= is_trivially_copy_constructible<T>::value;
|
|
||||||
template <class T> constexpr bool is_trivially_move_constructible_v
|
|
||||||
= is_trivially_move_constructible<T>::value;
|
|
||||||
template <class T, class U> constexpr bool is_trivially_assignable_v
|
|
||||||
= is_trivially_assignable<T, U>::value;
|
|
||||||
template <class T> constexpr bool is_trivially_copy_assignable_v
|
|
||||||
= is_trivially_copy_assignable<T>::value;
|
|
||||||
template <class T> constexpr bool is_trivially_move_assignable_v
|
|
||||||
= is_trivially_move_assignable<T>::value;
|
|
||||||
template <class T> constexpr bool is_trivially_destructible_v
|
|
||||||
= is_trivially_destructible<T>::value;
|
|
||||||
template <class T, class... Args> constexpr bool is_nothrow_constructible_v
|
|
||||||
= is_nothrow_constructible<T, Args...>::value;
|
|
||||||
template <class T> constexpr bool is_nothrow_default_constructible_v
|
|
||||||
= is_nothrow_default_constructible<T>::value;
|
|
||||||
template <class T> constexpr bool is_nothrow_copy_constructible_v
|
|
||||||
= is_nothrow_copy_constructible<T>::value;
|
|
||||||
template <class T> constexpr bool is_nothrow_move_constructible_v
|
|
||||||
= is_nothrow_move_constructible<T>::value;
|
|
||||||
template <class T, class U> constexpr bool is_nothrow_assignable_v
|
|
||||||
= is_nothrow_assignable<T, U>::value;
|
|
||||||
template <class T> constexpr bool is_nothrow_copy_assignable_v
|
|
||||||
= is_nothrow_copy_assignable<T>::value;
|
|
||||||
template <class T> constexpr bool is_nothrow_move_assignable_v
|
|
||||||
= is_nothrow_move_assignable<T>::value;
|
|
||||||
template <class T> constexpr bool is_nothrow_destructible_v
|
|
||||||
= is_nothrow_destructible<T>::value;
|
|
||||||
template <class T> constexpr bool has_virtual_destructor_v
|
|
||||||
= has_virtual_destructor<T>::value;
|
|
||||||
|
|
||||||
// See C++14 20.10.5, type property queries
|
|
||||||
template <class T> constexpr size_t alignment_of_v
|
|
||||||
= alignment_of<T>::value;
|
|
||||||
template <class T> constexpr size_t rank_v
|
|
||||||
= rank<T>::value;
|
|
||||||
template <class T, unsigned I = 0> constexpr size_t extent_v
|
|
||||||
= extent<T, I>::value;
|
|
||||||
|
|
||||||
// See C++14 20.10.6, type relations
|
|
||||||
template <class T, class U> constexpr bool is_same_v
|
|
||||||
= is_same<T, U>::value;
|
|
||||||
template <class Base, class Derived> constexpr bool is_base_of_v
|
|
||||||
= is_base_of<Base, Derived>::value;
|
|
||||||
template <class From, class To> constexpr bool is_convertible_v
|
|
||||||
= is_convertible<From, To>::value;
|
|
||||||
|
|
||||||
// 3.3.2, Other type transformations
|
|
||||||
template <class> class invocation_type; // not defined
|
|
||||||
template <class F, class... ArgTypes> class invocation_type<F(ArgTypes...)>;
|
|
||||||
template <class> class raw_invocation_type; // not defined
|
|
||||||
template <class F, class... ArgTypes> class raw_invocation_type<F(ArgTypes...)>;
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
using invocation_type_t = typename invocation_type<T>::type;
|
|
||||||
template <class T>
|
|
||||||
using raw_invocation_type_t = typename raw_invocation_type<T>::type;
|
|
||||||
|
|
||||||
} // namespace fundamentals_v1
|
|
||||||
} // namespace experimental
|
|
||||||
} // namespace std
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <experimental/__config>
|
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
|
|
||||||
#include <type_traits>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
|
||||||
|
|
||||||
// C++14 20.10.4.1, primary type categories
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_void_v
|
|
||||||
= is_void<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_null_pointer_v
|
|
||||||
= is_null_pointer<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_integral_v
|
|
||||||
= is_integral<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_floating_point_v
|
|
||||||
= is_floating_point<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_array_v
|
|
||||||
= is_array<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_pointer_v
|
|
||||||
= is_pointer<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_lvalue_reference_v
|
|
||||||
= is_lvalue_reference<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_rvalue_reference_v
|
|
||||||
= is_rvalue_reference<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_object_pointer_v
|
|
||||||
= is_member_object_pointer<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_function_pointer_v
|
|
||||||
= is_member_function_pointer<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_enum_v
|
|
||||||
= is_enum<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_union_v
|
|
||||||
= is_union<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_class_v
|
|
||||||
= is_class<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_function_v
|
|
||||||
= is_function<_Tp>::value;
|
|
||||||
|
|
||||||
// C++14 20.10.4.2, composite type categories
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_reference_v
|
|
||||||
= is_reference<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_arithmetic_v
|
|
||||||
= is_arithmetic<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_fundamental_v
|
|
||||||
= is_fundamental<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_object_v
|
|
||||||
= is_object<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_scalar_v
|
|
||||||
= is_scalar<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_compound_v
|
|
||||||
= is_compound<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_pointer_v
|
|
||||||
= is_member_pointer<_Tp>::value;
|
|
||||||
|
|
||||||
// C++14 20.10.4.3, type properties
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_const_v
|
|
||||||
= is_const<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_volatile_v
|
|
||||||
= is_volatile<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivial_v
|
|
||||||
= is_trivial<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copyable_v
|
|
||||||
= is_trivially_copyable<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_standard_layout_v
|
|
||||||
= is_standard_layout<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_pod_v
|
|
||||||
= is_pod<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_literal_type_v
|
|
||||||
= is_literal_type<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_empty_v
|
|
||||||
= is_empty<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_polymorphic_v
|
|
||||||
= is_polymorphic<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_abstract_v
|
|
||||||
= is_abstract<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_final_v
|
|
||||||
= is_final<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_signed_v
|
|
||||||
= is_signed<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_unsigned_v
|
|
||||||
= is_unsigned<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp, class ..._Ts> _LIBCPP_CONSTEXPR bool is_constructible_v
|
|
||||||
= is_constructible<_Tp, _Ts...>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_default_constructible_v
|
|
||||||
= is_default_constructible<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_copy_constructible_v
|
|
||||||
= is_copy_constructible<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_move_constructible_v
|
|
||||||
= is_move_constructible<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_assignable_v
|
|
||||||
= is_assignable<_Tp, _Up>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_copy_assignable_v
|
|
||||||
= is_copy_assignable<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_move_assignable_v
|
|
||||||
= is_move_assignable<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_destructible_v
|
|
||||||
= is_destructible<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp, class ..._Ts> _LIBCPP_CONSTEXPR bool is_trivially_constructible_v
|
|
||||||
= is_trivially_constructible<_Tp, _Ts...>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_default_constructible_v
|
|
||||||
= is_trivially_default_constructible<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copy_constructible_v
|
|
||||||
= is_trivially_copy_constructible<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_move_constructible_v
|
|
||||||
= is_trivially_move_constructible<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_trivially_assignable_v
|
|
||||||
= is_trivially_assignable<_Tp, _Up>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copy_assignable_v
|
|
||||||
= is_trivially_copy_assignable<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_move_assignable_v
|
|
||||||
= is_trivially_move_assignable<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_destructible_v
|
|
||||||
= is_trivially_destructible<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp, class ..._Ts> _LIBCPP_CONSTEXPR bool is_nothrow_constructible_v
|
|
||||||
= is_nothrow_constructible<_Tp, _Ts...>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_default_constructible_v
|
|
||||||
= is_nothrow_default_constructible<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_constructible_v
|
|
||||||
= is_nothrow_copy_constructible<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_move_constructible_v
|
|
||||||
= is_nothrow_move_constructible<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_nothrow_assignable_v
|
|
||||||
= is_nothrow_assignable<_Tp, _Up>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_assignable_v
|
|
||||||
= is_nothrow_copy_assignable<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_move_assignable_v
|
|
||||||
= is_nothrow_move_assignable<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_destructible_v
|
|
||||||
= is_nothrow_destructible<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR bool has_virtual_destructor_v
|
|
||||||
= has_virtual_destructor<_Tp>::value;
|
|
||||||
|
|
||||||
// C++14 20.10.5, type properties queries
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR size_t alignment_of_v
|
|
||||||
= alignment_of<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp> _LIBCPP_CONSTEXPR size_t rank_v
|
|
||||||
= rank<_Tp>::value;
|
|
||||||
|
|
||||||
template <class _Tp, unsigned _Id = 0> _LIBCPP_CONSTEXPR size_t extent_v
|
|
||||||
= extent<_Tp, _Id>::value;
|
|
||||||
|
|
||||||
// C++14 20.10.6, type relations
|
|
||||||
|
|
||||||
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_same_v
|
|
||||||
= is_same<_Tp, _Up>::value;
|
|
||||||
|
|
||||||
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_base_of_v
|
|
||||||
= is_base_of<_Tp, _Up>::value;
|
|
||||||
|
|
||||||
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_convertible_v
|
|
||||||
= is_convertible<_Tp, _Up>::value;
|
|
||||||
|
|
||||||
#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */
|
|
||||||
|
|
||||||
// 3.3.2, Other type transformations
|
|
||||||
/*
|
|
||||||
template <class>
|
|
||||||
class _LIBCPP_TYPE_VIS_ONLY raw_invocation_type;
|
|
||||||
|
|
||||||
template <class _Fn, class ..._Args>
|
|
||||||
class _LIBCPP_TYPE_VIS_ONLY raw_invocation_type<_Fn(_Args...)>;
|
|
||||||
|
|
||||||
template <class>
|
|
||||||
class _LIBCPP_TYPE_VIS_ONLY invokation_type;
|
|
||||||
|
|
||||||
template <class _Fn, class ..._Args>
|
|
||||||
class _LIBCPP_TYPE_VIS_ONLY invokation_type<_Fn(_Args...)>;
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
using invokation_type_t = typename invokation_type<_Tp>::type;
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
using raw_invocation_type_t = typename raw_invocation_type<_Tp>::type;
|
|
||||||
*/
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_LFTS
|
|
||||||
|
|
||||||
#endif /* _LIBCPP_STD_VER > 11 */
|
|
||||||
|
|
||||||
#endif /* _LIBCPP_EXPERIMENTAL_TYPE_TRAITS */
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
//===-------------------------- utility ----------------------------------===//
|
|
||||||
//
|
|
||||||
// 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_EXPERIMENTAL_UTILITY
|
|
||||||
#define _LIBCPP_EXPERIMENTAL_UTILITY
|
|
||||||
|
|
||||||
/*
|
|
||||||
experimental/utility synopsis
|
|
||||||
|
|
||||||
// C++1y
|
|
||||||
|
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
namespace std {
|
|
||||||
namespace experimental {
|
|
||||||
inline namespace fundamentals_v1 {
|
|
||||||
|
|
||||||
3.1.2, erased-type placeholder
|
|
||||||
struct erased_type { };
|
|
||||||
|
|
||||||
} // namespace fundamentals_v1
|
|
||||||
} // namespace experimental
|
|
||||||
} // namespace std
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <experimental/__config>
|
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
|
||||||
|
|
||||||
struct _LIBCPP_TYPE_VIS_ONLY erased_type { };
|
|
||||||
|
|
||||||
_LIBCPP_END_NAMESPACE_LFTS
|
|
||||||
|
|
||||||
#endif /* _LIBCPP_EXPERIMENTAL_UTILITY */
|
|
||||||
@@ -1,135 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
//===------------------------- hash_set ------------------------------------===//
|
|
||||||
//
|
|
||||||
// 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_EXT_HASH
|
|
||||||
#define _LIBCPP_EXT_HASH
|
|
||||||
|
|
||||||
#pragma GCC system_header
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
namespace __gnu_cxx {
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
template <typename _Tp> struct _LIBCPP_TYPE_VIS_ONLY hash { };
|
|
||||||
|
|
||||||
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<const char*>
|
|
||||||
: public unary_function<const char*, size_t>
|
|
||||||
{
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_t operator()(const char *__c) const _NOEXCEPT
|
|
||||||
{
|
|
||||||
return __do_string_hash(__c, __c + strlen(__c));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<char *>
|
|
||||||
: public unary_function<char*, size_t>
|
|
||||||
{
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_t operator()(char *__c) const _NOEXCEPT
|
|
||||||
{
|
|
||||||
return __do_string_hash<const char *>(__c, __c + strlen(__c));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<char>
|
|
||||||
: public unary_function<char, size_t>
|
|
||||||
{
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_t operator()(char __c) const _NOEXCEPT
|
|
||||||
{
|
|
||||||
return __c;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<signed char>
|
|
||||||
: public unary_function<signed char, size_t>
|
|
||||||
{
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_t operator()(signed char __c) const _NOEXCEPT
|
|
||||||
{
|
|
||||||
return __c;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned char>
|
|
||||||
: public unary_function<unsigned char, size_t>
|
|
||||||
{
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_t operator()(unsigned char __c) const _NOEXCEPT
|
|
||||||
{
|
|
||||||
return __c;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<short>
|
|
||||||
: public unary_function<short, size_t>
|
|
||||||
{
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_t operator()(short __c) const _NOEXCEPT
|
|
||||||
{
|
|
||||||
return __c;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned short>
|
|
||||||
: public unary_function<unsigned short, size_t>
|
|
||||||
{
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_t operator()(unsigned short __c) const _NOEXCEPT
|
|
||||||
{
|
|
||||||
return __c;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<int>
|
|
||||||
: public unary_function<int, size_t>
|
|
||||||
{
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_t operator()(int __c) const _NOEXCEPT
|
|
||||||
{
|
|
||||||
return __c;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned int>
|
|
||||||
: public unary_function<unsigned int, size_t>
|
|
||||||
{
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_t operator()(unsigned int __c) const _NOEXCEPT
|
|
||||||
{
|
|
||||||
return __c;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<long>
|
|
||||||
: public unary_function<long, size_t>
|
|
||||||
{
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_t operator()(long __c) const _NOEXCEPT
|
|
||||||
{
|
|
||||||
return __c;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<unsigned long>
|
|
||||||
: public unary_function<unsigned long, size_t>
|
|
||||||
{
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
size_t operator()(unsigned long __c) const _NOEXCEPT
|
|
||||||
{
|
|
||||||
return __c;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // _LIBCPP_EXT_HASH
|
|
||||||
@@ -203,28 +203,18 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
|
|||||||
#include <__hash_table>
|
#include <__hash_table>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <type_traits>
|
|
||||||
#include <ext/__hash>
|
|
||||||
|
|
||||||
#if __DEPRECATED
|
#if __DEPRECATED
|
||||||
#if defined(_MSC_VER) && ! defined(__clang__)
|
#warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
|
||||||
_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>
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace __gnu_cxx {
|
namespace __gnu_cxx {
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
template <class _Tp, class _Hash,
|
template <class _Tp, class _Hash, bool = is_empty<_Hash>::value>
|
||||||
bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value
|
|
||||||
>
|
|
||||||
class __hash_map_hasher
|
class __hash_map_hasher
|
||||||
: private _Hash
|
: private _Hash
|
||||||
{
|
{
|
||||||
@@ -256,9 +246,7 @@ public:
|
|||||||
{return __hash_(__x);}
|
{return __hash_(__x);}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp, class _Pred,
|
template <class _Tp, class _Pred, bool = is_empty<_Pred>::value>
|
||||||
bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value
|
|
||||||
>
|
|
||||||
class __hash_map_equal
|
class __hash_map_equal
|
||||||
: private _Pred
|
: private _Pred
|
||||||
{
|
{
|
||||||
@@ -364,7 +352,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class _HashIterator>
|
template <class _HashIterator>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY __hash_map_iterator
|
class _LIBCPP_VISIBLE __hash_map_iterator
|
||||||
{
|
{
|
||||||
_HashIterator __i_;
|
_HashIterator __i_;
|
||||||
|
|
||||||
@@ -407,15 +395,15 @@ public:
|
|||||||
bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
|
bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
|
||||||
{return __x.__i_ != __y.__i_;}
|
{return __x.__i_ != __y.__i_;}
|
||||||
|
|
||||||
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY hash_map;
|
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_map;
|
||||||
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY hash_multimap;
|
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_multimap;
|
||||||
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_iterator;
|
template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator;
|
||||||
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_local_iterator;
|
template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
|
||||||
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator;
|
template <class> friend class _LIBCPP_VISIBLE __hash_map_const_iterator;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _HashIterator>
|
template <class _HashIterator>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator
|
class _LIBCPP_VISIBLE __hash_map_const_iterator
|
||||||
{
|
{
|
||||||
_HashIterator __i_;
|
_HashIterator __i_;
|
||||||
|
|
||||||
@@ -429,9 +417,9 @@ public:
|
|||||||
typedef const value_type& reference;
|
typedef const value_type& reference;
|
||||||
typedef typename __pointer_traits::template
|
typedef typename __pointer_traits::template
|
||||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
rebind<const value_type>
|
rebind<value_type>
|
||||||
#else
|
#else
|
||||||
rebind<const value_type>::other
|
rebind<value_type>::other
|
||||||
#endif
|
#endif
|
||||||
pointer;
|
pointer;
|
||||||
|
|
||||||
@@ -466,21 +454,20 @@ public:
|
|||||||
bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
|
bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
|
||||||
{return __x.__i_ != __y.__i_;}
|
{return __x.__i_ != __y.__i_;}
|
||||||
|
|
||||||
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY hash_map;
|
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_map;
|
||||||
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY hash_multimap;
|
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_multimap;
|
||||||
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_iterator;
|
template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator;
|
||||||
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_local_iterator;
|
template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
|
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
|
||||||
class _Alloc = allocator<pair<const _Key, _Tp> > >
|
class _Alloc = allocator<pair<const _Key, _Tp> > >
|
||||||
class _LIBCPP_TYPE_VIS_ONLY hash_map
|
class _LIBCPP_VISIBLE hash_map
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// types
|
// types
|
||||||
typedef _Key key_type;
|
typedef _Key key_type;
|
||||||
typedef _Tp mapped_type;
|
typedef _Tp mapped_type;
|
||||||
typedef _Tp data_type;
|
|
||||||
typedef _Hash hasher;
|
typedef _Hash hasher;
|
||||||
typedef _Pred key_equal;
|
typedef _Pred key_equal;
|
||||||
typedef _Alloc allocator_type;
|
typedef _Alloc allocator_type;
|
||||||
@@ -492,7 +479,13 @@ private:
|
|||||||
typedef pair<key_type, mapped_type> __value_type;
|
typedef pair<key_type, mapped_type> __value_type;
|
||||||
typedef __hash_map_hasher<__value_type, hasher> __hasher;
|
typedef __hash_map_hasher<__value_type, hasher> __hasher;
|
||||||
typedef __hash_map_equal<__value_type, key_equal> __key_equal;
|
typedef __hash_map_equal<__value_type, key_equal> __key_equal;
|
||||||
typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __value_type>::type __allocator_type;
|
typedef typename allocator_traits<allocator_type>::template
|
||||||
|
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
|
rebind_alloc<__value_type>
|
||||||
|
#else
|
||||||
|
rebind_alloc<__value_type>::other
|
||||||
|
#endif
|
||||||
|
__allocator_type;
|
||||||
|
|
||||||
typedef __hash_table<__value_type, __hasher,
|
typedef __hash_table<__value_type, __hasher,
|
||||||
__key_equal, __allocator_type> __table;
|
__key_equal, __allocator_type> __table;
|
||||||
@@ -504,8 +497,8 @@ private:
|
|||||||
typedef typename __table::__node_traits __node_traits;
|
typedef typename __table::__node_traits __node_traits;
|
||||||
typedef typename __table::__node_allocator __node_allocator;
|
typedef typename __table::__node_allocator __node_allocator;
|
||||||
typedef typename __table::__node __node;
|
typedef typename __table::__node __node;
|
||||||
typedef __hash_map_node_destructor<__node_allocator> _Dp;
|
typedef __hash_map_node_destructor<__node_allocator> _D;
|
||||||
typedef unique_ptr<__node, _Dp> __node_holder;
|
typedef unique_ptr<__node, _D> __node_holder;
|
||||||
typedef allocator_traits<allocator_type> __alloc_traits;
|
typedef allocator_traits<allocator_type> __alloc_traits;
|
||||||
public:
|
public:
|
||||||
typedef typename __alloc_traits::pointer pointer;
|
typedef typename __alloc_traits::pointer pointer;
|
||||||
@@ -558,8 +551,6 @@ public:
|
|||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
pair<iterator, bool> insert(const value_type& __x)
|
pair<iterator, bool> insert(const value_type& __x)
|
||||||
{return __table_.__insert_unique(__x);}
|
{return __table_.__insert_unique(__x);}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
|
|
||||||
template <class _InputIterator>
|
template <class _InputIterator>
|
||||||
void insert(_InputIterator __first, _InputIterator __last);
|
void insert(_InputIterator __first, _InputIterator __last);
|
||||||
|
|
||||||
@@ -676,12 +667,12 @@ typename hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
|
|||||||
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k)
|
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k)
|
||||||
{
|
{
|
||||||
__node_allocator& __na = __table_.__node_alloc();
|
__node_allocator& __na = __table_.__node_alloc();
|
||||||
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k);
|
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k);
|
||||||
__h.get_deleter().__first_constructed = true;
|
__h.get_deleter().__first_constructed = true;
|
||||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
|
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
|
||||||
__h.get_deleter().__second_constructed = true;
|
__h.get_deleter().__second_constructed = true;
|
||||||
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
|
return _VSTD::move(__h);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||||
@@ -747,13 +738,12 @@ operator!=(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
|||||||
|
|
||||||
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
|
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
|
||||||
class _Alloc = allocator<pair<const _Key, _Tp> > >
|
class _Alloc = allocator<pair<const _Key, _Tp> > >
|
||||||
class _LIBCPP_TYPE_VIS_ONLY hash_multimap
|
class _LIBCPP_VISIBLE hash_multimap
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// types
|
// types
|
||||||
typedef _Key key_type;
|
typedef _Key key_type;
|
||||||
typedef _Tp mapped_type;
|
typedef _Tp mapped_type;
|
||||||
typedef _Tp data_type;
|
|
||||||
typedef _Hash hasher;
|
typedef _Hash hasher;
|
||||||
typedef _Pred key_equal;
|
typedef _Pred key_equal;
|
||||||
typedef _Alloc allocator_type;
|
typedef _Alloc allocator_type;
|
||||||
@@ -765,7 +755,13 @@ private:
|
|||||||
typedef pair<key_type, mapped_type> __value_type;
|
typedef pair<key_type, mapped_type> __value_type;
|
||||||
typedef __hash_map_hasher<__value_type, hasher> __hasher;
|
typedef __hash_map_hasher<__value_type, hasher> __hasher;
|
||||||
typedef __hash_map_equal<__value_type, key_equal> __key_equal;
|
typedef __hash_map_equal<__value_type, key_equal> __key_equal;
|
||||||
typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __value_type>::type __allocator_type;
|
typedef typename allocator_traits<allocator_type>::template
|
||||||
|
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
|
rebind_alloc<__value_type>
|
||||||
|
#else
|
||||||
|
rebind_alloc<__value_type>::other
|
||||||
|
#endif
|
||||||
|
__allocator_type;
|
||||||
|
|
||||||
typedef __hash_table<__value_type, __hasher,
|
typedef __hash_table<__value_type, __hasher,
|
||||||
__key_equal, __allocator_type> __table;
|
__key_equal, __allocator_type> __table;
|
||||||
@@ -775,8 +771,8 @@ private:
|
|||||||
typedef typename __table::__node_traits __node_traits;
|
typedef typename __table::__node_traits __node_traits;
|
||||||
typedef typename __table::__node_allocator __node_allocator;
|
typedef typename __table::__node_allocator __node_allocator;
|
||||||
typedef typename __table::__node __node;
|
typedef typename __table::__node __node;
|
||||||
typedef __hash_map_node_destructor<__node_allocator> _Dp;
|
typedef __hash_map_node_destructor<__node_allocator> _D;
|
||||||
typedef unique_ptr<__node, _Dp> __node_holder;
|
typedef unique_ptr<__node, _D> __node_holder;
|
||||||
typedef allocator_traits<allocator_type> __alloc_traits;
|
typedef allocator_traits<allocator_type> __alloc_traits;
|
||||||
public:
|
public:
|
||||||
typedef typename __alloc_traits::pointer pointer;
|
typedef typename __alloc_traits::pointer pointer;
|
||||||
@@ -829,8 +825,6 @@ public:
|
|||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
|
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
iterator insert(const_iterator, const value_type& __x) {return insert(__x);}
|
|
||||||
template <class _InputIterator>
|
template <class _InputIterator>
|
||||||
void insert(_InputIterator __first, _InputIterator __last);
|
void insert(_InputIterator __first, _InputIterator __last);
|
||||||
|
|
||||||
|
|||||||
@@ -196,23 +196,18 @@ template <class Value, class Hash, class Pred, class Alloc>
|
|||||||
#include <__config>
|
#include <__config>
|
||||||
#include <__hash_table>
|
#include <__hash_table>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <ext/__hash>
|
|
||||||
|
|
||||||
#if __DEPRECATED
|
#if __DEPRECATED
|
||||||
#if defined(_MSC_VER) && ! defined(__clang__)
|
#warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>
|
||||||
_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>
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace __gnu_cxx {
|
namespace __gnu_cxx {
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
|
template <class _Value, class _Hash = std::hash<_Value>, class _Pred = equal_to<_Value>,
|
||||||
class _Alloc = allocator<_Value> >
|
class _Alloc = allocator<_Value> >
|
||||||
class _LIBCPP_TYPE_VIS_ONLY hash_set
|
class _LIBCPP_VISIBLE hash_set
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// types
|
// types
|
||||||
@@ -279,8 +274,6 @@ public:
|
|||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
pair<iterator, bool> insert(const value_type& __x)
|
pair<iterator, bool> insert(const value_type& __x)
|
||||||
{return __table_.__insert_unique(__x);}
|
{return __table_.__insert_unique(__x);}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
|
|
||||||
template <class _InputIterator>
|
template <class _InputIterator>
|
||||||
void insert(_InputIterator __first, _InputIterator __last);
|
void insert(_InputIterator __first, _InputIterator __last);
|
||||||
|
|
||||||
@@ -433,7 +426,7 @@ operator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
|
|||||||
|
|
||||||
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
|
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
|
||||||
class _Alloc = allocator<_Value> >
|
class _Alloc = allocator<_Value> >
|
||||||
class _LIBCPP_TYPE_VIS_ONLY hash_multiset
|
class _LIBCPP_VISIBLE hash_multiset
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// types
|
// types
|
||||||
@@ -499,8 +492,6 @@ public:
|
|||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
|
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
|
||||||
iterator insert(const_iterator, const value_type& __x) {return insert(__x);}
|
|
||||||
template <class _InputIterator>
|
template <class _InputIterator>
|
||||||
void insert(_InputIterator __first, _InputIterator __last);
|
void insert(_InputIterator __first, _InputIterator __last);
|
||||||
|
|
||||||
|
|||||||
@@ -1,83 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
//===--------------------------- float.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_FLOAT_H
|
|
||||||
#define _LIBCPP_FLOAT_H
|
|
||||||
|
|
||||||
/*
|
|
||||||
float.h synopsis
|
|
||||||
|
|
||||||
Macros:
|
|
||||||
|
|
||||||
FLT_ROUNDS
|
|
||||||
FLT_EVAL_METHOD // C99
|
|
||||||
FLT_RADIX
|
|
||||||
|
|
||||||
FLT_MANT_DIG
|
|
||||||
DBL_MANT_DIG
|
|
||||||
LDBL_MANT_DIG
|
|
||||||
|
|
||||||
DECIMAL_DIG // C99
|
|
||||||
|
|
||||||
FLT_DIG
|
|
||||||
DBL_DIG
|
|
||||||
LDBL_DIG
|
|
||||||
|
|
||||||
FLT_MIN_EXP
|
|
||||||
DBL_MIN_EXP
|
|
||||||
LDBL_MIN_EXP
|
|
||||||
|
|
||||||
FLT_MIN_10_EXP
|
|
||||||
DBL_MIN_10_EXP
|
|
||||||
LDBL_MIN_10_EXP
|
|
||||||
|
|
||||||
FLT_MAX_EXP
|
|
||||||
DBL_MAX_EXP
|
|
||||||
LDBL_MAX_EXP
|
|
||||||
|
|
||||||
FLT_MAX_10_EXP
|
|
||||||
DBL_MAX_10_EXP
|
|
||||||
LDBL_MAX_10_EXP
|
|
||||||
|
|
||||||
FLT_MAX
|
|
||||||
DBL_MAX
|
|
||||||
LDBL_MAX
|
|
||||||
|
|
||||||
FLT_EPSILON
|
|
||||||
DBL_EPSILON
|
|
||||||
LDBL_EPSILON
|
|
||||||
|
|
||||||
FLT_MIN
|
|
||||||
DBL_MIN
|
|
||||||
LDBL_MIN
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <__config>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include_next <float.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
|
|
||||||
#ifndef FLT_EVAL_METHOD
|
|
||||||
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DECIMAL_DIG
|
|
||||||
#define DECIMAL_DIG __DECIMAL_DIG__
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __cplusplus
|
|
||||||
|
|
||||||
#endif // _LIBCPP_FLOAT_H
|
|
||||||
@@ -38,7 +38,6 @@ public:
|
|||||||
noexcept(is_nothrow_default_constructible<allocator_type>::value);
|
noexcept(is_nothrow_default_constructible<allocator_type>::value);
|
||||||
explicit forward_list(const allocator_type& a);
|
explicit forward_list(const allocator_type& a);
|
||||||
explicit forward_list(size_type n);
|
explicit forward_list(size_type n);
|
||||||
explicit forward_list(size_type n, const allocator_type& a); // C++14
|
|
||||||
forward_list(size_type n, const value_type& v);
|
forward_list(size_type n, const value_type& v);
|
||||||
forward_list(size_type n, const value_type& v, const allocator_type& a);
|
forward_list(size_type n, const value_type& v, const allocator_type& a);
|
||||||
template <class InputIterator>
|
template <class InputIterator>
|
||||||
@@ -107,7 +106,8 @@ public:
|
|||||||
iterator erase_after(const_iterator first, const_iterator last);
|
iterator erase_after(const_iterator first, const_iterator last);
|
||||||
|
|
||||||
void swap(forward_list& x)
|
void swap(forward_list& x)
|
||||||
noexcept(allocator_traits<allocator_type>::is_always_equal::value); // C++17
|
noexcept(!allocator_type::propagate_on_container_swap::value ||
|
||||||
|
__is_nothrow_swappable<allocator_type>::value);
|
||||||
|
|
||||||
void resize(size_type n);
|
void resize(size_type n);
|
||||||
void resize(size_type n, const value_type& v);
|
void resize(size_type n, const value_type& v);
|
||||||
@@ -174,11 +174,7 @@ template <class T, class Allocator>
|
|||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <__undef_min_max>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
@@ -187,6 +183,7 @@ template <class _Tp, class _VoidPtr> struct __forward_list_node;
|
|||||||
template <class _NodePtr>
|
template <class _NodePtr>
|
||||||
struct __forward_begin_node
|
struct __forward_begin_node
|
||||||
{
|
{
|
||||||
|
typedef __forward_begin_node __self;
|
||||||
typedef _NodePtr pointer;
|
typedef _NodePtr pointer;
|
||||||
|
|
||||||
pointer __next_;
|
pointer __next_;
|
||||||
@@ -194,34 +191,28 @@ struct __forward_begin_node
|
|||||||
_LIBCPP_INLINE_VISIBILITY __forward_begin_node() : __next_(nullptr) {}
|
_LIBCPP_INLINE_VISIBILITY __forward_begin_node() : __next_(nullptr) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp, class _VoidPtr>
|
|
||||||
struct _LIBCPP_HIDDEN __begin_node_of
|
|
||||||
{
|
|
||||||
typedef __forward_begin_node
|
|
||||||
<
|
|
||||||
typename pointer_traits<_VoidPtr>::template
|
|
||||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
|
||||||
rebind<__forward_list_node<_Tp, _VoidPtr> >
|
|
||||||
#else
|
|
||||||
rebind<__forward_list_node<_Tp, _VoidPtr> >::other
|
|
||||||
#endif
|
|
||||||
> type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class _Tp, class _VoidPtr>
|
template <class _Tp, class _VoidPtr>
|
||||||
struct __forward_list_node
|
struct __forward_list_node
|
||||||
: public __begin_node_of<_Tp, _VoidPtr>::type
|
: public __forward_begin_node
|
||||||
|
<
|
||||||
|
typename pointer_traits<_VoidPtr>::template
|
||||||
|
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
|
rebind<__forward_list_node<_Tp, _VoidPtr> >
|
||||||
|
#else
|
||||||
|
rebind<__forward_list_node<_Tp, _VoidPtr> >::other
|
||||||
|
#endif
|
||||||
|
>
|
||||||
{
|
{
|
||||||
typedef _Tp value_type;
|
typedef _Tp value_type;
|
||||||
|
|
||||||
value_type __value_;
|
value_type __value_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp, class _Alloc = allocator<_Tp> > class _LIBCPP_TYPE_VIS_ONLY forward_list;
|
template<class _Tp, class _Alloc> class forward_list;
|
||||||
template<class _NodeConstPtr> class _LIBCPP_TYPE_VIS_ONLY __forward_list_const_iterator;
|
template<class _NodeConstPtr> class __forward_list_const_iterator;
|
||||||
|
|
||||||
template <class _NodePtr>
|
template <class _NodePtr>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY __forward_list_iterator
|
class _LIBCPP_VISIBLE __forward_list_iterator
|
||||||
{
|
{
|
||||||
typedef _NodePtr __node_pointer;
|
typedef _NodePtr __node_pointer;
|
||||||
|
|
||||||
@@ -230,14 +221,14 @@ class _LIBCPP_TYPE_VIS_ONLY __forward_list_iterator
|
|||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
explicit __forward_list_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
|
explicit __forward_list_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
|
||||||
|
|
||||||
template<class, class> friend class _LIBCPP_TYPE_VIS_ONLY forward_list;
|
template<class, class> friend class forward_list;
|
||||||
template<class> friend class _LIBCPP_TYPE_VIS_ONLY __forward_list_const_iterator;
|
template<class> friend class __forward_list_const_iterator;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef forward_iterator_tag iterator_category;
|
typedef forward_iterator_tag iterator_category;
|
||||||
typedef typename pointer_traits<__node_pointer>::element_type::value_type
|
typedef typename pointer_traits<__node_pointer>::element_type::value_type
|
||||||
value_type;
|
value_type;
|
||||||
typedef value_type& reference;
|
typedef value_type& reference;
|
||||||
typedef typename pointer_traits<__node_pointer>::difference_type
|
typedef typename pointer_traits<__node_pointer>::difference_type
|
||||||
difference_type;
|
difference_type;
|
||||||
typedef typename pointer_traits<__node_pointer>::template
|
typedef typename pointer_traits<__node_pointer>::template
|
||||||
@@ -254,7 +245,7 @@ public:
|
|||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
reference operator*() const {return __ptr_->__value_;}
|
reference operator*() const {return __ptr_->__value_;}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
pointer operator->() const {return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
|
pointer operator->() const {return &__ptr_->__value_;}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__forward_list_iterator& operator++()
|
__forward_list_iterator& operator++()
|
||||||
@@ -281,7 +272,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class _NodeConstPtr>
|
template <class _NodeConstPtr>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY __forward_list_const_iterator
|
class _LIBCPP_VISIBLE __forward_list_const_iterator
|
||||||
{
|
{
|
||||||
typedef _NodeConstPtr __node_const_pointer;
|
typedef _NodeConstPtr __node_const_pointer;
|
||||||
|
|
||||||
@@ -308,7 +299,7 @@ class _LIBCPP_TYPE_VIS_ONLY __forward_list_const_iterator
|
|||||||
public:
|
public:
|
||||||
typedef forward_iterator_tag iterator_category;
|
typedef forward_iterator_tag iterator_category;
|
||||||
typedef typename __node::value_type value_type;
|
typedef typename __node::value_type value_type;
|
||||||
typedef const value_type& reference;
|
typedef const value_type& reference;
|
||||||
typedef typename pointer_traits<__node_const_pointer>::difference_type
|
typedef typename pointer_traits<__node_const_pointer>::difference_type
|
||||||
difference_type;
|
difference_type;
|
||||||
typedef typename pointer_traits<__node_const_pointer>::template
|
typedef typename pointer_traits<__node_const_pointer>::template
|
||||||
@@ -328,7 +319,7 @@ public:
|
|||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
reference operator*() const {return __ptr_->__value_;}
|
reference operator*() const {return __ptr_->__value_;}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
pointer operator->() const {return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
|
pointer operator->() const {return &__ptr_->__value_;}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__forward_list_const_iterator& operator++()
|
__forward_list_const_iterator& operator++()
|
||||||
@@ -361,27 +352,30 @@ protected:
|
|||||||
typedef _Tp value_type;
|
typedef _Tp value_type;
|
||||||
typedef _Alloc allocator_type;
|
typedef _Alloc allocator_type;
|
||||||
|
|
||||||
typedef typename allocator_traits<allocator_type>::void_pointer void_pointer;
|
typedef typename allocator_traits<allocator_type>::void_pointer void_pointer;
|
||||||
typedef __forward_list_node<value_type, void_pointer> __node;
|
typedef __forward_list_node<value_type, void_pointer> __node;
|
||||||
typedef typename __begin_node_of<value_type, void_pointer>::type __begin_node;
|
typedef typename __node::__self __begin_node;
|
||||||
typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __node>::type __node_allocator;
|
typedef typename allocator_traits<allocator_type>::template
|
||||||
|
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
|
rebind_alloc<__node>
|
||||||
|
#else
|
||||||
|
rebind_alloc<__node>::other
|
||||||
|
#endif
|
||||||
|
__node_allocator;
|
||||||
typedef allocator_traits<__node_allocator> __node_traits;
|
typedef allocator_traits<__node_allocator> __node_traits;
|
||||||
typedef typename __node_traits::pointer __node_pointer;
|
typedef typename __node_traits::pointer __node_pointer;
|
||||||
typedef typename __node_traits::pointer __node_const_pointer;
|
typedef typename __node_traits::const_pointer __node_const_pointer;
|
||||||
|
|
||||||
typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __begin_node>::type __begin_node_allocator;
|
|
||||||
typedef typename allocator_traits<__begin_node_allocator>::pointer __begin_node_pointer;
|
|
||||||
|
|
||||||
__compressed_pair<__begin_node, __node_allocator> __before_begin_;
|
__compressed_pair<__begin_node, __node_allocator> __before_begin_;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__node_pointer __before_begin() _NOEXCEPT
|
__node_pointer __before_begin() _NOEXCEPT
|
||||||
{return static_cast<__node_pointer>(pointer_traits<__begin_node_pointer>::
|
{return pointer_traits<__node_pointer>::pointer_to(
|
||||||
pointer_to(__before_begin_.first()));}
|
static_cast<__node&>(__before_begin_.first()));}
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__node_const_pointer __before_begin() const _NOEXCEPT
|
__node_const_pointer __before_begin() const _NOEXCEPT
|
||||||
{return static_cast<__node_const_pointer>(pointer_traits<__begin_node_pointer>::
|
{return pointer_traits<__node_const_pointer>::pointer_to(
|
||||||
pointer_to(const_cast<__begin_node&>(__before_begin_.first())));}
|
static_cast<const __node&>(__before_begin_.first()));}
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__node_allocator& __alloc() _NOEXCEPT
|
__node_allocator& __alloc() _NOEXCEPT
|
||||||
@@ -391,7 +385,7 @@ protected:
|
|||||||
{return __before_begin_.second();}
|
{return __before_begin_.second();}
|
||||||
|
|
||||||
typedef __forward_list_iterator<__node_pointer> iterator;
|
typedef __forward_list_iterator<__node_pointer> iterator;
|
||||||
typedef __forward_list_const_iterator<__node_pointer> const_iterator;
|
typedef __forward_list_const_iterator<__node_const_pointer> const_iterator;
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
__forward_list_base()
|
__forward_list_base()
|
||||||
@@ -430,12 +424,8 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
void swap(__forward_list_base& __x)
|
void swap(__forward_list_base& __x)
|
||||||
#if _LIBCPP_STD_VER >= 14
|
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
|
||||||
_NOEXCEPT;
|
__is_nothrow_swappable<__node_allocator>::value);
|
||||||
#else
|
|
||||||
_NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
|
|
||||||
__is_nothrow_swappable<__node_allocator>::value);
|
|
||||||
#endif
|
|
||||||
protected:
|
protected:
|
||||||
void clear() _NOEXCEPT;
|
void clear() _NOEXCEPT;
|
||||||
|
|
||||||
@@ -457,6 +447,26 @@ private:
|
|||||||
void __move_assign_alloc(__forward_list_base& __x, true_type)
|
void __move_assign_alloc(__forward_list_base& __x, true_type)
|
||||||
_NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
|
_NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
|
||||||
{__alloc() = _VSTD::move(__x.__alloc());}
|
{__alloc() = _VSTD::move(__x.__alloc());}
|
||||||
|
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y)
|
||||||
|
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
|
||||||
|
__is_nothrow_swappable<__node_allocator>::value)
|
||||||
|
{__swap_alloc(__x, __y, integral_constant<bool,
|
||||||
|
__node_traits::propagate_on_container_swap::value>());}
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y,
|
||||||
|
false_type)
|
||||||
|
_NOEXCEPT
|
||||||
|
{}
|
||||||
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y,
|
||||||
|
true_type)
|
||||||
|
_NOEXCEPT_(__is_nothrow_swappable<__node_allocator>::value)
|
||||||
|
{
|
||||||
|
using _VSTD::swap;
|
||||||
|
swap(__x, __y);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
@@ -495,15 +505,10 @@ template <class _Tp, class _Alloc>
|
|||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
__forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
|
__forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
|
||||||
#if _LIBCPP_STD_VER >= 14
|
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
|
||||||
_NOEXCEPT
|
__is_nothrow_swappable<__node_allocator>::value)
|
||||||
#else
|
|
||||||
_NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
|
|
||||||
__is_nothrow_swappable<__node_allocator>::value)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
__swap_allocator(__alloc(), __x.__alloc(),
|
__swap_alloc(__alloc(), __x.__alloc());
|
||||||
integral_constant<bool, __node_traits::propagate_on_container_swap::value>());
|
|
||||||
using _VSTD::swap;
|
using _VSTD::swap;
|
||||||
swap(__before_begin()->__next_, __x.__before_begin()->__next_);
|
swap(__before_begin()->__next_, __x.__before_begin()->__next_);
|
||||||
}
|
}
|
||||||
@@ -523,8 +528,8 @@ __forward_list_base<_Tp, _Alloc>::clear() _NOEXCEPT
|
|||||||
__before_begin()->__next_ = nullptr;
|
__before_begin()->__next_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Tp, class _Alloc /*= allocator<_Tp>*/>
|
template <class _Tp, class _Alloc = allocator<_Tp> >
|
||||||
class _LIBCPP_TYPE_VIS_ONLY forward_list
|
class _LIBCPP_VISIBLE forward_list
|
||||||
: private __forward_list_base<_Tp, _Alloc>
|
: private __forward_list_base<_Tp, _Alloc>
|
||||||
{
|
{
|
||||||
typedef __forward_list_base<_Tp, _Alloc> base;
|
typedef __forward_list_base<_Tp, _Alloc> base;
|
||||||
@@ -537,9 +542,6 @@ public:
|
|||||||
typedef _Tp value_type;
|
typedef _Tp value_type;
|
||||||
typedef _Alloc allocator_type;
|
typedef _Alloc allocator_type;
|
||||||
|
|
||||||
static_assert((is_same<typename allocator_type::value_type, value_type>::value),
|
|
||||||
"Allocator::value_type must be same type as value_type");
|
|
||||||
|
|
||||||
typedef value_type& reference;
|
typedef value_type& reference;
|
||||||
typedef const value_type& const_reference;
|
typedef const value_type& const_reference;
|
||||||
typedef typename allocator_traits<allocator_type>::pointer pointer;
|
typedef typename allocator_traits<allocator_type>::pointer pointer;
|
||||||
@@ -556,9 +558,6 @@ public:
|
|||||||
{} // = default;
|
{} // = default;
|
||||||
explicit forward_list(const allocator_type& __a);
|
explicit forward_list(const allocator_type& __a);
|
||||||
explicit forward_list(size_type __n);
|
explicit forward_list(size_type __n);
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
explicit forward_list(size_type __n, const allocator_type& __a);
|
|
||||||
#endif
|
|
||||||
forward_list(size_type __n, const value_type& __v);
|
forward_list(size_type __n, const value_type& __v);
|
||||||
forward_list(size_type __n, const value_type& __v, const allocator_type& __a);
|
forward_list(size_type __n, const value_type& __v, const allocator_type& __a);
|
||||||
template <class _InputIterator>
|
template <class _InputIterator>
|
||||||
@@ -581,10 +580,8 @@ public:
|
|||||||
: base(_VSTD::move(__x)) {}
|
: base(_VSTD::move(__x)) {}
|
||||||
forward_list(forward_list&& __x, const allocator_type& __a);
|
forward_list(forward_list&& __x, const allocator_type& __a);
|
||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#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);
|
||||||
forward_list(initializer_list<value_type> __il, const allocator_type& __a);
|
forward_list(initializer_list<value_type> __il, const allocator_type& __a);
|
||||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
|
|
||||||
// ~forward_list() = default;
|
// ~forward_list() = default;
|
||||||
|
|
||||||
@@ -595,9 +592,7 @@ public:
|
|||||||
__node_traits::propagate_on_container_move_assignment::value &&
|
__node_traits::propagate_on_container_move_assignment::value &&
|
||||||
is_nothrow_move_assignable<allocator_type>::value);
|
is_nothrow_move_assignable<allocator_type>::value);
|
||||||
#endif
|
#endif
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
forward_list& operator=(initializer_list<value_type> __il);
|
forward_list& operator=(initializer_list<value_type> __il);
|
||||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
|
|
||||||
template <class _InputIterator>
|
template <class _InputIterator>
|
||||||
typename enable_if
|
typename enable_if
|
||||||
@@ -607,9 +602,7 @@ public:
|
|||||||
>::type
|
>::type
|
||||||
assign(_InputIterator __f, _InputIterator __l);
|
assign(_InputIterator __f, _InputIterator __l);
|
||||||
void assign(size_type __n, const value_type& __v);
|
void assign(size_type __n, const value_type& __v);
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
void assign(initializer_list<value_type> __il);
|
void assign(initializer_list<value_type> __il);
|
||||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
allocator_type get_allocator() const _NOEXCEPT
|
allocator_type get_allocator() const _NOEXCEPT
|
||||||
@@ -684,22 +677,16 @@ public:
|
|||||||
iterator
|
iterator
|
||||||
>::type
|
>::type
|
||||||
insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l);
|
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)
|
iterator insert_after(const_iterator __p, initializer_list<value_type> __il)
|
||||||
{return insert_after(__p, __il.begin(), __il.end());}
|
{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 __p);
|
||||||
iterator erase_after(const_iterator __f, const_iterator __l);
|
iterator erase_after(const_iterator __f, const_iterator __l);
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
void swap(forward_list& __x)
|
void swap(forward_list& __x)
|
||||||
#if _LIBCPP_STD_VER >= 14
|
|
||||||
_NOEXCEPT
|
|
||||||
#else
|
|
||||||
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
|
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
|
||||||
__is_nothrow_swappable<__node_allocator>::value)
|
__is_nothrow_swappable<__node_allocator>::value)
|
||||||
#endif
|
|
||||||
{base::swap(__x);}
|
{base::swap(__x);}
|
||||||
|
|
||||||
void resize(size_type __n);
|
void resize(size_type __n);
|
||||||
@@ -773,8 +760,8 @@ forward_list<_Tp, _Alloc>::forward_list(size_type __n)
|
|||||||
if (__n > 0)
|
if (__n > 0)
|
||||||
{
|
{
|
||||||
__node_allocator& __a = base::__alloc();
|
__node_allocator& __a = base::__alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
typedef __allocator_destructor<__node_allocator> _D;
|
||||||
unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
|
unique_ptr<__node, _D> __h(nullptr, _D(__a, 1));
|
||||||
for (__node_pointer __p = base::__before_begin(); __n > 0; --__n,
|
for (__node_pointer __p = base::__before_begin(); __n > 0; --__n,
|
||||||
__p = __p->__next_)
|
__p = __p->__next_)
|
||||||
{
|
{
|
||||||
@@ -786,28 +773,6 @@ forward_list<_Tp, _Alloc>::forward_list(size_type __n)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER > 11
|
|
||||||
template <class _Tp, class _Alloc>
|
|
||||||
forward_list<_Tp, _Alloc>::forward_list(size_type __n, const allocator_type& __a)
|
|
||||||
: base ( __a )
|
|
||||||
{
|
|
||||||
if (__n > 0)
|
|
||||||
{
|
|
||||||
__node_allocator& __a = base::__alloc();
|
|
||||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
|
||||||
unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
|
|
||||||
for (__node_pointer __p = base::__before_begin(); __n > 0; --__n,
|
|
||||||
__p = __p->__next_)
|
|
||||||
{
|
|
||||||
__h.reset(__node_traits::allocate(__a, 1));
|
|
||||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_));
|
|
||||||
__h->__next_ = nullptr;
|
|
||||||
__p->__next_ = __h.release();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <class _Tp, class _Alloc>
|
template <class _Tp, class _Alloc>
|
||||||
forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v)
|
forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v)
|
||||||
{
|
{
|
||||||
@@ -871,15 +836,13 @@ forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x,
|
|||||||
{
|
{
|
||||||
if (base::__alloc() != __x.__alloc())
|
if (base::__alloc() != __x.__alloc())
|
||||||
{
|
{
|
||||||
typedef move_iterator<iterator> _Ip;
|
typedef move_iterator<iterator> _I;
|
||||||
insert_after(cbefore_begin(), _Ip(__x.begin()), _Ip(__x.end()));
|
insert_after(cbefore_begin(), _I(__x.begin()), _I(__x.end()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
|
|
||||||
template <class _Tp, class _Alloc>
|
template <class _Tp, class _Alloc>
|
||||||
forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il)
|
forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il)
|
||||||
{
|
{
|
||||||
@@ -894,8 +857,6 @@ forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il,
|
|||||||
insert_after(cbefore_begin(), __il.begin(), __il.end());
|
insert_after(cbefore_begin(), __il.begin(), __il.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
|
|
||||||
template <class _Tp, class _Alloc>
|
template <class _Tp, class _Alloc>
|
||||||
forward_list<_Tp, _Alloc>&
|
forward_list<_Tp, _Alloc>&
|
||||||
forward_list<_Tp, _Alloc>::operator=(const forward_list& __x)
|
forward_list<_Tp, _Alloc>::operator=(const forward_list& __x)
|
||||||
@@ -929,8 +890,8 @@ forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, false_type)
|
|||||||
__move_assign(__x, true_type());
|
__move_assign(__x, true_type());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
typedef move_iterator<iterator> _Ip;
|
typedef move_iterator<iterator> _I;
|
||||||
assign(_Ip(__x.begin()), _Ip(__x.end()));
|
assign(_I(__x.begin()), _I(__x.end()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -949,8 +910,6 @@ forward_list<_Tp, _Alloc>::operator=(forward_list&& __x)
|
|||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
|
|
||||||
template <class _Tp, class _Alloc>
|
template <class _Tp, class _Alloc>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
forward_list<_Tp, _Alloc>&
|
forward_list<_Tp, _Alloc>&
|
||||||
@@ -960,8 +919,6 @@ forward_list<_Tp, _Alloc>::operator=(initializer_list<value_type> __il)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
|
|
||||||
template <class _Tp, class _Alloc>
|
template <class _Tp, class _Alloc>
|
||||||
template <class _InputIterator>
|
template <class _InputIterator>
|
||||||
typename enable_if
|
typename enable_if
|
||||||
@@ -974,7 +931,7 @@ forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l)
|
|||||||
iterator __i = before_begin();
|
iterator __i = before_begin();
|
||||||
iterator __j = _VSTD::next(__i);
|
iterator __j = _VSTD::next(__i);
|
||||||
iterator __e = end();
|
iterator __e = end();
|
||||||
for (; __j != __e && __f != __l; ++__i, (void) ++__j, ++__f)
|
for (; __j != __e && __f != __l; ++__i, ++__j, ++__f)
|
||||||
*__j = *__f;
|
*__j = *__f;
|
||||||
if (__j == __e)
|
if (__j == __e)
|
||||||
insert_after(__i, __f, __l);
|
insert_after(__i, __f, __l);
|
||||||
@@ -997,8 +954,6 @@ forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v)
|
|||||||
erase_after(__i, __e);
|
erase_after(__i, __e);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
|
|
||||||
template <class _Tp, class _Alloc>
|
template <class _Tp, class _Alloc>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
void
|
void
|
||||||
@@ -1007,8 +962,6 @@ forward_list<_Tp, _Alloc>::assign(initializer_list<value_type> __il)
|
|||||||
assign(__il.begin(), __il.end());
|
assign(__il.begin(), __il.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||||
|
|
||||||
@@ -1018,8 +971,8 @@ void
|
|||||||
forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
|
forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
|
||||||
{
|
{
|
||||||
__node_allocator& __a = base::__alloc();
|
__node_allocator& __a = base::__alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
typedef __allocator_destructor<__node_allocator> _D;
|
||||||
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
|
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
||||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_),
|
__node_traits::construct(__a, _VSTD::addressof(__h->__value_),
|
||||||
_VSTD::forward<_Args>(__args)...);
|
_VSTD::forward<_Args>(__args)...);
|
||||||
__h->__next_ = base::__before_begin()->__next_;
|
__h->__next_ = base::__before_begin()->__next_;
|
||||||
@@ -1033,8 +986,8 @@ void
|
|||||||
forward_list<_Tp, _Alloc>::push_front(value_type&& __v)
|
forward_list<_Tp, _Alloc>::push_front(value_type&& __v)
|
||||||
{
|
{
|
||||||
__node_allocator& __a = base::__alloc();
|
__node_allocator& __a = base::__alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
typedef __allocator_destructor<__node_allocator> _D;
|
||||||
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
|
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
||||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
|
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
|
||||||
__h->__next_ = base::__before_begin()->__next_;
|
__h->__next_ = base::__before_begin()->__next_;
|
||||||
base::__before_begin()->__next_ = __h.release();
|
base::__before_begin()->__next_ = __h.release();
|
||||||
@@ -1047,8 +1000,8 @@ void
|
|||||||
forward_list<_Tp, _Alloc>::push_front(const value_type& __v)
|
forward_list<_Tp, _Alloc>::push_front(const value_type& __v)
|
||||||
{
|
{
|
||||||
__node_allocator& __a = base::__alloc();
|
__node_allocator& __a = base::__alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
typedef __allocator_destructor<__node_allocator> _D;
|
||||||
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
|
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
||||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
|
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
|
||||||
__h->__next_ = base::__before_begin()->__next_;
|
__h->__next_ = base::__before_begin()->__next_;
|
||||||
base::__before_begin()->__next_ = __h.release();
|
base::__before_begin()->__next_ = __h.release();
|
||||||
@@ -1073,10 +1026,10 @@ template <class... _Args>
|
|||||||
typename forward_list<_Tp, _Alloc>::iterator
|
typename forward_list<_Tp, _Alloc>::iterator
|
||||||
forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args)
|
forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args)
|
||||||
{
|
{
|
||||||
__node_pointer const __r = __p.__ptr_;
|
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
|
||||||
__node_allocator& __a = base::__alloc();
|
__node_allocator& __a = base::__alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
typedef __allocator_destructor<__node_allocator> _D;
|
||||||
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
|
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
||||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_),
|
__node_traits::construct(__a, _VSTD::addressof(__h->__value_),
|
||||||
_VSTD::forward<_Args>(__args)...);
|
_VSTD::forward<_Args>(__args)...);
|
||||||
__h->__next_ = __r->__next_;
|
__h->__next_ = __r->__next_;
|
||||||
@@ -1090,10 +1043,10 @@ template <class _Tp, class _Alloc>
|
|||||||
typename forward_list<_Tp, _Alloc>::iterator
|
typename forward_list<_Tp, _Alloc>::iterator
|
||||||
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
|
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
|
||||||
{
|
{
|
||||||
__node_pointer const __r = __p.__ptr_;
|
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
|
||||||
__node_allocator& __a = base::__alloc();
|
__node_allocator& __a = base::__alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
typedef __allocator_destructor<__node_allocator> _D;
|
||||||
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
|
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
||||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
|
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
|
||||||
__h->__next_ = __r->__next_;
|
__h->__next_ = __r->__next_;
|
||||||
__r->__next_ = __h.release();
|
__r->__next_ = __h.release();
|
||||||
@@ -1106,10 +1059,10 @@ template <class _Tp, class _Alloc>
|
|||||||
typename forward_list<_Tp, _Alloc>::iterator
|
typename forward_list<_Tp, _Alloc>::iterator
|
||||||
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __v)
|
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __v)
|
||||||
{
|
{
|
||||||
__node_pointer const __r = __p.__ptr_;
|
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
|
||||||
__node_allocator& __a = base::__alloc();
|
__node_allocator& __a = base::__alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
typedef __allocator_destructor<__node_allocator> _D;
|
||||||
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
|
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
||||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
|
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
|
||||||
__h->__next_ = __r->__next_;
|
__h->__next_ = __r->__next_;
|
||||||
__r->__next_ = __h.release();
|
__r->__next_ = __h.release();
|
||||||
@@ -1121,12 +1074,12 @@ typename forward_list<_Tp, _Alloc>::iterator
|
|||||||
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
|
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
|
||||||
const value_type& __v)
|
const value_type& __v)
|
||||||
{
|
{
|
||||||
__node_pointer __r = __p.__ptr_;
|
__node_pointer __r = const_cast<__node_pointer>(__p.__ptr_);
|
||||||
if (__n > 0)
|
if (__n > 0)
|
||||||
{
|
{
|
||||||
__node_allocator& __a = base::__alloc();
|
__node_allocator& __a = base::__alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
typedef __allocator_destructor<__node_allocator> _D;
|
||||||
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
|
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
||||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
|
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
|
||||||
__node_pointer __first = __h.release();
|
__node_pointer __first = __h.release();
|
||||||
__node_pointer __last = __first;
|
__node_pointer __last = __first;
|
||||||
@@ -1171,12 +1124,12 @@ typename enable_if
|
|||||||
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
|
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
|
||||||
_InputIterator __f, _InputIterator __l)
|
_InputIterator __f, _InputIterator __l)
|
||||||
{
|
{
|
||||||
__node_pointer __r = __p.__ptr_;
|
__node_pointer __r = const_cast<__node_pointer>(__p.__ptr_);
|
||||||
if (__f != __l)
|
if (__f != __l)
|
||||||
{
|
{
|
||||||
__node_allocator& __a = base::__alloc();
|
__node_allocator& __a = base::__alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
typedef __allocator_destructor<__node_allocator> _D;
|
||||||
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
|
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
||||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f);
|
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f);
|
||||||
__node_pointer __first = __h.release();
|
__node_pointer __first = __h.release();
|
||||||
__node_pointer __last = __first;
|
__node_pointer __last = __first;
|
||||||
@@ -1184,7 +1137,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||||
for (++__f; __f != __l; ++__f, ((void)(__last = __last->__next_)))
|
for (++__f; __f != __l; ++__f, __last = __last->__next_)
|
||||||
{
|
{
|
||||||
__h.reset(__node_traits::allocate(__a, 1));
|
__h.reset(__node_traits::allocate(__a, 1));
|
||||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f);
|
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f);
|
||||||
@@ -1215,7 +1168,7 @@ template <class _Tp, class _Alloc>
|
|||||||
typename forward_list<_Tp, _Alloc>::iterator
|
typename forward_list<_Tp, _Alloc>::iterator
|
||||||
forward_list<_Tp, _Alloc>::erase_after(const_iterator __f)
|
forward_list<_Tp, _Alloc>::erase_after(const_iterator __f)
|
||||||
{
|
{
|
||||||
__node_pointer __p = __f.__ptr_;
|
__node_pointer __p = const_cast<__node_pointer>(__f.__ptr_);
|
||||||
__node_pointer __n = __p->__next_;
|
__node_pointer __n = __p->__next_;
|
||||||
__p->__next_ = __n->__next_;
|
__p->__next_ = __n->__next_;
|
||||||
__node_allocator& __a = base::__alloc();
|
__node_allocator& __a = base::__alloc();
|
||||||
@@ -1228,10 +1181,10 @@ template <class _Tp, class _Alloc>
|
|||||||
typename forward_list<_Tp, _Alloc>::iterator
|
typename forward_list<_Tp, _Alloc>::iterator
|
||||||
forward_list<_Tp, _Alloc>::erase_after(const_iterator __f, const_iterator __l)
|
forward_list<_Tp, _Alloc>::erase_after(const_iterator __f, const_iterator __l)
|
||||||
{
|
{
|
||||||
__node_pointer __e = __l.__ptr_;
|
__node_pointer __e = const_cast<__node_pointer>(__l.__ptr_);
|
||||||
if (__f != __l)
|
if (__f != __l)
|
||||||
{
|
{
|
||||||
__node_pointer __p = __f.__ptr_;
|
__node_pointer __p = const_cast<__node_pointer>(__f.__ptr_);
|
||||||
__node_pointer __n = __p->__next_;
|
__node_pointer __n = __p->__next_;
|
||||||
if (__n != __e)
|
if (__n != __e)
|
||||||
{
|
{
|
||||||
@@ -1267,8 +1220,8 @@ forward_list<_Tp, _Alloc>::resize(size_type __n)
|
|||||||
if (__n > 0)
|
if (__n > 0)
|
||||||
{
|
{
|
||||||
__node_allocator& __a = base::__alloc();
|
__node_allocator& __a = base::__alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
typedef __allocator_destructor<__node_allocator> _D;
|
||||||
unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
|
unique_ptr<__node, _D> __h(nullptr, _D(__a, 1));
|
||||||
for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n,
|
for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n,
|
||||||
__ptr = __ptr->__next_)
|
__ptr = __ptr->__next_)
|
||||||
{
|
{
|
||||||
@@ -1299,8 +1252,8 @@ forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v)
|
|||||||
if (__n > 0)
|
if (__n > 0)
|
||||||
{
|
{
|
||||||
__node_allocator& __a = base::__alloc();
|
__node_allocator& __a = base::__alloc();
|
||||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
typedef __allocator_destructor<__node_allocator> _D;
|
||||||
unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
|
unique_ptr<__node, _D> __h(nullptr, _D(__a, 1));
|
||||||
for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n,
|
for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n,
|
||||||
__ptr = __ptr->__next_)
|
__ptr = __ptr->__next_)
|
||||||
{
|
{
|
||||||
@@ -1325,10 +1278,12 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
|
|||||||
const_iterator __lm1 = __x.before_begin();
|
const_iterator __lm1 = __x.before_begin();
|
||||||
while (__lm1.__ptr_->__next_ != nullptr)
|
while (__lm1.__ptr_->__next_ != nullptr)
|
||||||
++__lm1;
|
++__lm1;
|
||||||
__lm1.__ptr_->__next_ = __p.__ptr_->__next_;
|
const_cast<__node_pointer>(__lm1.__ptr_)->__next_ =
|
||||||
|
const_cast<__node_pointer>(__p.__ptr_)->__next_;
|
||||||
}
|
}
|
||||||
__p.__ptr_->__next_ = __x.__before_begin()->__next_;
|
const_cast<__node_pointer>(__p.__ptr_)->__next_ =
|
||||||
__x.__before_begin()->__next_ = nullptr;
|
const_cast<__node_pointer>(__x.__before_begin())->__next_;
|
||||||
|
const_cast<__node_pointer>(__x.__before_begin())->__next_ = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1341,9 +1296,12 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
|
|||||||
const_iterator __lm1 = _VSTD::next(__i);
|
const_iterator __lm1 = _VSTD::next(__i);
|
||||||
if (__p != __i && __p != __lm1)
|
if (__p != __i && __p != __lm1)
|
||||||
{
|
{
|
||||||
__i.__ptr_->__next_ = __lm1.__ptr_->__next_;
|
const_cast<__node_pointer>(__i.__ptr_)->__next_ =
|
||||||
__lm1.__ptr_->__next_ = __p.__ptr_->__next_;
|
const_cast<__node_pointer>(__lm1.__ptr_)->__next_;
|
||||||
__p.__ptr_->__next_ = __lm1.__ptr_;
|
const_cast<__node_pointer>(__lm1.__ptr_)->__next_ =
|
||||||
|
const_cast<__node_pointer>(__p.__ptr_)->__next_;
|
||||||
|
const_cast<__node_pointer>(__p.__ptr_)->__next_ =
|
||||||
|
const_cast<__node_pointer>(__lm1.__ptr_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1360,9 +1318,12 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
|
|||||||
++__lm1;
|
++__lm1;
|
||||||
if (__f != __lm1)
|
if (__f != __lm1)
|
||||||
{
|
{
|
||||||
__lm1.__ptr_->__next_ = __p.__ptr_->__next_;
|
const_cast<__node_pointer>(__lm1.__ptr_)->__next_ =
|
||||||
__p.__ptr_->__next_ = __f.__ptr_->__next_;
|
const_cast<__node_pointer>(__p.__ptr_)->__next_;
|
||||||
__f.__ptr_->__next_ = __l.__ptr_;
|
const_cast<__node_pointer>(__p.__ptr_)->__next_ =
|
||||||
|
const_cast<__node_pointer>(__f.__ptr_)->__next_;
|
||||||
|
const_cast<__node_pointer>(__f.__ptr_)->__next_ =
|
||||||
|
const_cast<__node_pointer>(__l.__ptr_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1404,7 +1365,6 @@ template <class _Tp, class _Alloc>
|
|||||||
void
|
void
|
||||||
forward_list<_Tp, _Alloc>::remove(const value_type& __v)
|
forward_list<_Tp, _Alloc>::remove(const value_type& __v)
|
||||||
{
|
{
|
||||||
forward_list<_Tp, _Alloc> __deleted_nodes; // collect the nodes we're removing
|
|
||||||
iterator __e = end();
|
iterator __e = end();
|
||||||
for (iterator __i = before_begin(); __i.__ptr_->__next_ != nullptr;)
|
for (iterator __i = before_begin(); __i.__ptr_->__next_ != nullptr;)
|
||||||
{
|
{
|
||||||
@@ -1413,7 +1373,7 @@ forward_list<_Tp, _Alloc>::remove(const value_type& __v)
|
|||||||
iterator __j = _VSTD::next(__i, 2);
|
iterator __j = _VSTD::next(__i, 2);
|
||||||
for (; __j != __e && *__j == __v; ++__j)
|
for (; __j != __e && *__j == __v; ++__j)
|
||||||
;
|
;
|
||||||
__deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
|
erase_after(__i, __j);
|
||||||
if (__j == __e)
|
if (__j == __e)
|
||||||
break;
|
break;
|
||||||
__i = __j;
|
__i = __j;
|
||||||
@@ -1585,12 +1545,12 @@ template <class _Tp, class _Alloc>
|
|||||||
bool operator==(const forward_list<_Tp, _Alloc>& __x,
|
bool operator==(const forward_list<_Tp, _Alloc>& __x,
|
||||||
const forward_list<_Tp, _Alloc>& __y)
|
const forward_list<_Tp, _Alloc>& __y)
|
||||||
{
|
{
|
||||||
typedef forward_list<_Tp, _Alloc> _Cp;
|
typedef forward_list<_Tp, _Alloc> _C;
|
||||||
typedef typename _Cp::const_iterator _Ip;
|
typedef typename _C::const_iterator _I;
|
||||||
_Ip __ix = __x.begin();
|
_I __ix = __x.begin();
|
||||||
_Ip __ex = __x.end();
|
_I __ex = __x.end();
|
||||||
_Ip __iy = __y.begin();
|
_I __iy = __y.begin();
|
||||||
_Ip __ey = __y.end();
|
_I __ey = __y.end();
|
||||||
for (; __ix != __ex && __iy != __ey; ++__ix, ++__iy)
|
for (; __ix != __ex && __iy != __ey; ++__ix, ++__iy)
|
||||||
if (!(*__ix == *__iy))
|
if (!(*__ix == *__iy))
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
125
include/fstream
125
include/fstream
@@ -171,16 +171,12 @@ typedef basic_fstream<wchar_t> wfstream;
|
|||||||
#include <__locale>
|
#include <__locale>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
#include <__undef_min_max>
|
|
||||||
|
|
||||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
|
||||||
|
|
||||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY basic_filebuf
|
class _LIBCPP_VISIBLE basic_filebuf
|
||||||
: public basic_streambuf<_CharT, _Traits>
|
: public basic_streambuf<_CharT, _Traits>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -206,10 +202,8 @@ public:
|
|||||||
|
|
||||||
// 27.9.1.4 Members:
|
// 27.9.1.4 Members:
|
||||||
bool is_open() const;
|
bool is_open() const;
|
||||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
|
||||||
basic_filebuf* open(const char* __s, ios_base::openmode __mode);
|
basic_filebuf* open(const char* __s, ios_base::openmode __mode);
|
||||||
basic_filebuf* open(const string& __s, ios_base::openmode __mode);
|
basic_filebuf* open(const string& __s, ios_base::openmode __mode);
|
||||||
#endif
|
|
||||||
basic_filebuf* close();
|
basic_filebuf* close();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -236,7 +230,6 @@ private:
|
|||||||
FILE* __file_;
|
FILE* __file_;
|
||||||
const codecvt<char_type, char, state_type>* __cv_;
|
const codecvt<char_type, char, state_type>* __cv_;
|
||||||
state_type __st_;
|
state_type __st_;
|
||||||
state_type __st_last_;
|
|
||||||
ios_base::openmode __om_;
|
ios_base::openmode __om_;
|
||||||
ios_base::openmode __cm_;
|
ios_base::openmode __cm_;
|
||||||
bool __owns_eb_;
|
bool __owns_eb_;
|
||||||
@@ -256,20 +249,14 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf()
|
|||||||
__intbuf_(0),
|
__intbuf_(0),
|
||||||
__ibs_(0),
|
__ibs_(0),
|
||||||
__file_(0),
|
__file_(0),
|
||||||
__cv_(nullptr),
|
__cv_(&use_facet<codecvt<char_type, char, state_type> >(this->getloc())),
|
||||||
__st_(),
|
__st_(),
|
||||||
__st_last_(),
|
|
||||||
__om_(0),
|
__om_(0),
|
||||||
__cm_(0),
|
__cm_(0),
|
||||||
__owns_eb_(false),
|
__owns_eb_(false),
|
||||||
__owns_ib_(false),
|
__owns_ib_(false),
|
||||||
__always_noconv_(false)
|
__always_noconv_(__cv_->always_noconv())
|
||||||
{
|
{
|
||||||
if (has_facet<codecvt<char_type, char, state_type> >(this->getloc()))
|
|
||||||
{
|
|
||||||
__cv_ = &use_facet<codecvt<char_type, char, state_type> >(this->getloc());
|
|
||||||
__always_noconv_ = __cv_->always_noconv();
|
|
||||||
}
|
|
||||||
setbuf(0, 4096);
|
setbuf(0, 4096);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,7 +284,6 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
|
|||||||
__file_ = __rhs.__file_;
|
__file_ = __rhs.__file_;
|
||||||
__cv_ = __rhs.__cv_;
|
__cv_ = __rhs.__cv_;
|
||||||
__st_ = __rhs.__st_;
|
__st_ = __rhs.__st_;
|
||||||
__st_last_ = __rhs.__st_last_;
|
|
||||||
__om_ = __rhs.__om_;
|
__om_ = __rhs.__om_;
|
||||||
__cm_ = __rhs.__cm_;
|
__cm_ = __rhs.__cm_;
|
||||||
__owns_eb_ = __rhs.__owns_eb_;
|
__owns_eb_ = __rhs.__owns_eb_;
|
||||||
@@ -330,7 +316,6 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
|
|||||||
__rhs.__ibs_ = 0;
|
__rhs.__ibs_ = 0;
|
||||||
__rhs.__file_ = 0;
|
__rhs.__file_ = 0;
|
||||||
__rhs.__st_ = state_type();
|
__rhs.__st_ = state_type();
|
||||||
__rhs.__st_last_ = state_type();
|
|
||||||
__rhs.__om_ = 0;
|
__rhs.__om_ = 0;
|
||||||
__rhs.__cm_ = 0;
|
__rhs.__cm_ = 0;
|
||||||
__rhs.__owns_eb_ = false;
|
__rhs.__owns_eb_ = false;
|
||||||
@@ -346,7 +331,6 @@ basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs)
|
|||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
swap(__rhs);
|
swap(__rhs);
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
@@ -409,7 +393,6 @@ basic_filebuf<_CharT, _Traits>::swap(basic_filebuf& __rhs)
|
|||||||
_VSTD::swap(__file_, __rhs.__file_);
|
_VSTD::swap(__file_, __rhs.__file_);
|
||||||
_VSTD::swap(__cv_, __rhs.__cv_);
|
_VSTD::swap(__cv_, __rhs.__cv_);
|
||||||
_VSTD::swap(__st_, __rhs.__st_);
|
_VSTD::swap(__st_, __rhs.__st_);
|
||||||
_VSTD::swap(__st_last_, __rhs.__st_last_);
|
|
||||||
_VSTD::swap(__om_, __rhs.__om_);
|
_VSTD::swap(__om_, __rhs.__om_);
|
||||||
_VSTD::swap(__cm_, __rhs.__cm_);
|
_VSTD::swap(__cm_, __rhs.__cm_);
|
||||||
_VSTD::swap(__owns_eb_, __rhs.__owns_eb_);
|
_VSTD::swap(__owns_eb_, __rhs.__owns_eb_);
|
||||||
@@ -465,7 +448,6 @@ basic_filebuf<_CharT, _Traits>::is_open() const
|
|||||||
return __file_ != 0;
|
return __file_ != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
basic_filebuf<_CharT, _Traits>*
|
basic_filebuf<_CharT, _Traits>*
|
||||||
basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
|
basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
|
||||||
@@ -553,7 +535,6 @@ basic_filebuf<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mod
|
|||||||
{
|
{
|
||||||
return open(__s.c_str(), __mode);
|
return open(__s.c_str(), __mode);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
basic_filebuf<_CharT, _Traits>*
|
basic_filebuf<_CharT, _Traits>*
|
||||||
@@ -564,7 +545,7 @@ basic_filebuf<_CharT, _Traits>::close()
|
|||||||
{
|
{
|
||||||
__rt = this;
|
__rt = this;
|
||||||
unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose);
|
unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose);
|
||||||
if (sync())
|
if ((__cm_ & ios_base::out) && sync())
|
||||||
__rt = 0;
|
__rt = 0;
|
||||||
if (fclose(__h.release()) == 0)
|
if (fclose(__h.release()) == 0)
|
||||||
__file_ = 0;
|
__file_ = 0;
|
||||||
@@ -606,22 +587,18 @@ basic_filebuf<_CharT, _Traits>::underflow()
|
|||||||
memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
|
memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
|
||||||
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
|
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
|
||||||
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
|
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
|
||||||
size_t __nmemb = _VSTD::min(static_cast<size_t>(__ibs_ - __unget_sz),
|
size_t __nmemb = _VSTD::min(static_cast<size_t>(this->egptr() - this->eback() - __unget_sz),
|
||||||
static_cast<size_t>(__extbufend_ - __extbufnext_));
|
static_cast<size_t>(__extbufend_ - __extbufnext_));
|
||||||
codecvt_base::result __r;
|
codecvt_base::result __r;
|
||||||
__st_last_ = __st_;
|
state_type __svs = __st_;
|
||||||
size_t __nr = fread((void*)__extbufnext_, 1, __nmemb, __file_);
|
size_t __nr = fread((void*)__extbufnext_, 1, __nmemb, __file_);
|
||||||
if (__nr != 0)
|
if (__nr != 0)
|
||||||
{
|
{
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
|
||||||
if (!__cv_)
|
|
||||||
throw bad_cast();
|
|
||||||
#endif
|
|
||||||
__extbufend_ = __extbufnext_ + __nr;
|
__extbufend_ = __extbufnext_ + __nr;
|
||||||
char_type* __inext;
|
char_type* __inext;
|
||||||
__r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_,
|
__r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_,
|
||||||
this->eback() + __unget_sz,
|
this->eback() + __unget_sz,
|
||||||
this->eback() + __ibs_, __inext);
|
this->egptr(), __inext);
|
||||||
if (__r == codecvt_base::noconv)
|
if (__r == codecvt_base::noconv)
|
||||||
{
|
{
|
||||||
this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_);
|
this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_);
|
||||||
@@ -695,10 +672,6 @@ basic_filebuf<_CharT, _Traits>::overflow(int_type __c)
|
|||||||
codecvt_base::result __r;
|
codecvt_base::result __r;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
|
||||||
if (!__cv_)
|
|
||||||
throw bad_cast();
|
|
||||||
#endif
|
|
||||||
const char_type* __e;
|
const char_type* __e;
|
||||||
__r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
|
__r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
|
||||||
__extbuf_, __extbuf_ + __ebs_, __extbe);
|
__extbuf_, __extbuf_ + __ebs_, __extbe);
|
||||||
@@ -788,10 +761,6 @@ typename basic_filebuf<_CharT, _Traits>::pos_type
|
|||||||
basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
|
basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
|
||||||
ios_base::openmode)
|
ios_base::openmode)
|
||||||
{
|
{
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
|
||||||
if (!__cv_)
|
|
||||||
throw bad_cast();
|
|
||||||
#endif
|
|
||||||
int __width = __cv_->encoding();
|
int __width = __cv_->encoding();
|
||||||
if (__file_ == 0 || (__width <= 0 && __off != 0) || sync())
|
if (__file_ == 0 || (__width <= 0 && __off != 0) || sync())
|
||||||
return pos_type(off_type(-1));
|
return pos_type(off_type(-1));
|
||||||
@@ -811,15 +780,9 @@ basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
|
|||||||
default:
|
default:
|
||||||
return pos_type(off_type(-1));
|
return pos_type(off_type(-1));
|
||||||
}
|
}
|
||||||
#if defined(_WIN32) || defined(_NEWLIB_VERSION)
|
|
||||||
if (fseek(__file_, __width > 0 ? __width * __off : 0, __whence))
|
|
||||||
return pos_type(off_type(-1));
|
|
||||||
pos_type __r = ftell(__file_);
|
|
||||||
#else
|
|
||||||
if (fseeko(__file_, __width > 0 ? __width * __off : 0, __whence))
|
if (fseeko(__file_, __width > 0 ? __width * __off : 0, __whence))
|
||||||
return pos_type(off_type(-1));
|
return pos_type(off_type(-1));
|
||||||
pos_type __r = ftello(__file_);
|
pos_type __r = ftello(__file_);
|
||||||
#endif
|
|
||||||
__r.state(__st_);
|
__r.state(__st_);
|
||||||
return __r;
|
return __r;
|
||||||
}
|
}
|
||||||
@@ -830,14 +793,8 @@ basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode)
|
|||||||
{
|
{
|
||||||
if (__file_ == 0 || sync())
|
if (__file_ == 0 || sync())
|
||||||
return pos_type(off_type(-1));
|
return pos_type(off_type(-1));
|
||||||
#if defined(_WIN32) || defined(_NEWLIB_VERSION)
|
|
||||||
if (fseek(__file_, __sp, SEEK_SET))
|
|
||||||
return pos_type(off_type(-1));
|
|
||||||
#else
|
|
||||||
if (fseeko(__file_, __sp, SEEK_SET))
|
if (fseeko(__file_, __sp, SEEK_SET))
|
||||||
return pos_type(off_type(-1));
|
return pos_type(off_type(-1));
|
||||||
#endif
|
|
||||||
__st_ = __sp.state();
|
|
||||||
return __sp;
|
return __sp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -847,10 +804,6 @@ basic_filebuf<_CharT, _Traits>::sync()
|
|||||||
{
|
{
|
||||||
if (__file_ == 0)
|
if (__file_ == 0)
|
||||||
return 0;
|
return 0;
|
||||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
|
||||||
if (!__cv_)
|
|
||||||
throw bad_cast();
|
|
||||||
#endif
|
|
||||||
if (__cm_ & ios_base::out)
|
if (__cm_ & ios_base::out)
|
||||||
{
|
{
|
||||||
if (this->pptr() != this->pbase())
|
if (this->pptr() != this->pbase())
|
||||||
@@ -873,8 +826,6 @@ basic_filebuf<_CharT, _Traits>::sync()
|
|||||||
else if (__cm_ & ios_base::in)
|
else if (__cm_ & ios_base::in)
|
||||||
{
|
{
|
||||||
off_type __c;
|
off_type __c;
|
||||||
state_type __state = __st_last_;
|
|
||||||
bool __update_st = false;
|
|
||||||
if (__always_noconv_)
|
if (__always_noconv_)
|
||||||
__c = this->egptr() - this->gptr();
|
__c = this->egptr() - this->gptr();
|
||||||
else
|
else
|
||||||
@@ -887,24 +838,32 @@ basic_filebuf<_CharT, _Traits>::sync()
|
|||||||
{
|
{
|
||||||
if (this->gptr() != this->egptr())
|
if (this->gptr() != this->egptr())
|
||||||
{
|
{
|
||||||
const int __off = __cv_->length(__state, __extbuf_,
|
reverse(this->gptr(), this->egptr());
|
||||||
__extbufnext_,
|
codecvt_base::result __r;
|
||||||
this->gptr() - this->eback());
|
const char_type* __e = this->gptr();
|
||||||
__c += __extbufnext_ - __extbuf_ - __off;
|
char* __extbe;
|
||||||
__update_st = true;
|
do
|
||||||
|
{
|
||||||
|
__r = __cv_->out(__st_, __e, this->egptr(), __e,
|
||||||
|
__extbuf_, __extbuf_ + __ebs_, __extbe);
|
||||||
|
switch (__r)
|
||||||
|
{
|
||||||
|
case codecvt_base::noconv:
|
||||||
|
__c += this->egptr() - this->gptr();
|
||||||
|
break;
|
||||||
|
case codecvt_base::ok:
|
||||||
|
case codecvt_base::partial:
|
||||||
|
__c += __extbe - __extbuf_;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
} while (__r == codecvt_base::partial);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if defined(_WIN32) || defined(_NEWLIB_VERSION)
|
|
||||||
if (fseek(__file_, -__c, SEEK_CUR))
|
|
||||||
return -1;
|
|
||||||
#else
|
|
||||||
if (fseeko(__file_, -__c, SEEK_CUR))
|
if (fseeko(__file_, -__c, SEEK_CUR))
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
|
||||||
if (__update_st)
|
|
||||||
__st_ = __state;
|
|
||||||
__extbufnext_ = __extbufend_ = __extbuf_;
|
|
||||||
this->setg(0, 0, 0);
|
this->setg(0, 0, 0);
|
||||||
__cm_ = 0;
|
__cm_ = 0;
|
||||||
}
|
}
|
||||||
@@ -998,7 +957,7 @@ basic_filebuf<_CharT, _Traits>::__write_mode()
|
|||||||
// basic_ifstream
|
// basic_ifstream
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY basic_ifstream
|
class _LIBCPP_VISIBLE basic_ifstream
|
||||||
: public basic_istream<_CharT, _Traits>
|
: public basic_istream<_CharT, _Traits>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -1009,10 +968,8 @@ public:
|
|||||||
typedef typename traits_type::off_type off_type;
|
typedef typename traits_type::off_type off_type;
|
||||||
|
|
||||||
basic_ifstream();
|
basic_ifstream();
|
||||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
|
||||||
explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in);
|
explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in);
|
||||||
explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in);
|
explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in);
|
||||||
#endif
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
basic_ifstream(basic_ifstream&& __rhs);
|
basic_ifstream(basic_ifstream&& __rhs);
|
||||||
#endif
|
#endif
|
||||||
@@ -1024,10 +981,8 @@ public:
|
|||||||
|
|
||||||
basic_filebuf<char_type, traits_type>* rdbuf() const;
|
basic_filebuf<char_type, traits_type>* rdbuf() const;
|
||||||
bool is_open() const;
|
bool is_open() const;
|
||||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
|
||||||
void open(const char* __s, ios_base::openmode __mode = ios_base::in);
|
void open(const char* __s, ios_base::openmode __mode = ios_base::in);
|
||||||
void open(const string& __s, ios_base::openmode __mode = ios_base::in);
|
void open(const string& __s, ios_base::openmode __mode = ios_base::in);
|
||||||
#endif
|
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -1041,7 +996,6 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
basic_ifstream<_CharT, _Traits>::basic_ifstream(const char* __s, ios_base::openmode __mode)
|
basic_ifstream<_CharT, _Traits>::basic_ifstream(const char* __s, ios_base::openmode __mode)
|
||||||
@@ -1059,7 +1013,6 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::ope
|
|||||||
if (__sb_.open(__s, __mode | ios_base::in) == 0)
|
if (__sb_.open(__s, __mode | ios_base::in) == 0)
|
||||||
this->setstate(ios_base::failbit);
|
this->setstate(ios_base::failbit);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
@@ -1117,7 +1070,6 @@ basic_ifstream<_CharT, _Traits>::is_open() const
|
|||||||
return __sb_.is_open();
|
return __sb_.is_open();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
void
|
void
|
||||||
basic_ifstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
|
basic_ifstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
|
||||||
@@ -1137,7 +1089,6 @@ basic_ifstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mo
|
|||||||
else
|
else
|
||||||
this->setstate(ios_base::failbit);
|
this->setstate(ios_base::failbit);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
@@ -1151,7 +1102,7 @@ basic_ifstream<_CharT, _Traits>::close()
|
|||||||
// basic_ofstream
|
// basic_ofstream
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY basic_ofstream
|
class _LIBCPP_VISIBLE basic_ofstream
|
||||||
: public basic_ostream<_CharT, _Traits>
|
: public basic_ostream<_CharT, _Traits>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -1175,10 +1126,8 @@ public:
|
|||||||
|
|
||||||
basic_filebuf<char_type, traits_type>* rdbuf() const;
|
basic_filebuf<char_type, traits_type>* rdbuf() const;
|
||||||
bool is_open() const;
|
bool is_open() const;
|
||||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
|
||||||
void open(const char* __s, ios_base::openmode __mode = ios_base::out);
|
void open(const char* __s, ios_base::openmode __mode = ios_base::out);
|
||||||
void open(const string& __s, ios_base::openmode __mode = ios_base::out);
|
void open(const string& __s, ios_base::openmode __mode = ios_base::out);
|
||||||
#endif
|
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -1192,7 +1141,6 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
basic_ofstream<_CharT, _Traits>::basic_ofstream(const char* __s, ios_base::openmode __mode)
|
basic_ofstream<_CharT, _Traits>::basic_ofstream(const char* __s, ios_base::openmode __mode)
|
||||||
@@ -1210,7 +1158,6 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::ope
|
|||||||
if (__sb_.open(__s, __mode | ios_base::out) == 0)
|
if (__sb_.open(__s, __mode | ios_base::out) == 0)
|
||||||
this->setstate(ios_base::failbit);
|
this->setstate(ios_base::failbit);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
@@ -1268,7 +1215,6 @@ basic_ofstream<_CharT, _Traits>::is_open() const
|
|||||||
return __sb_.is_open();
|
return __sb_.is_open();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
void
|
void
|
||||||
basic_ofstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
|
basic_ofstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
|
||||||
@@ -1288,7 +1234,6 @@ basic_ofstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mo
|
|||||||
else
|
else
|
||||||
this->setstate(ios_base::failbit);
|
this->setstate(ios_base::failbit);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
@@ -1302,7 +1247,7 @@ basic_ofstream<_CharT, _Traits>::close()
|
|||||||
// basic_fstream
|
// basic_fstream
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
class _LIBCPP_TYPE_VIS_ONLY basic_fstream
|
class _LIBCPP_VISIBLE basic_fstream
|
||||||
: public basic_iostream<_CharT, _Traits>
|
: public basic_iostream<_CharT, _Traits>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -1313,10 +1258,8 @@ public:
|
|||||||
typedef typename traits_type::off_type off_type;
|
typedef typename traits_type::off_type off_type;
|
||||||
|
|
||||||
basic_fstream();
|
basic_fstream();
|
||||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
|
||||||
explicit basic_fstream(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
explicit basic_fstream(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||||
explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||||
#endif
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
basic_fstream(basic_fstream&& __rhs);
|
basic_fstream(basic_fstream&& __rhs);
|
||||||
#endif
|
#endif
|
||||||
@@ -1328,10 +1271,8 @@ public:
|
|||||||
|
|
||||||
basic_filebuf<char_type, traits_type>* rdbuf() const;
|
basic_filebuf<char_type, traits_type>* rdbuf() const;
|
||||||
bool is_open() const;
|
bool is_open() const;
|
||||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
|
||||||
void open(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
void open(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||||
void open(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
void open(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||||
#endif
|
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -1345,7 +1286,6 @@ basic_fstream<_CharT, _Traits>::basic_fstream()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
basic_fstream<_CharT, _Traits>::basic_fstream(const char* __s, ios_base::openmode __mode)
|
basic_fstream<_CharT, _Traits>::basic_fstream(const char* __s, ios_base::openmode __mode)
|
||||||
@@ -1363,7 +1303,6 @@ basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openm
|
|||||||
if (__sb_.open(__s, __mode) == 0)
|
if (__sb_.open(__s, __mode) == 0)
|
||||||
this->setstate(ios_base::failbit);
|
this->setstate(ios_base::failbit);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
|
|
||||||
@@ -1421,7 +1360,6 @@ basic_fstream<_CharT, _Traits>::is_open() const
|
|||||||
return __sb_.is_open();
|
return __sb_.is_open();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
void
|
void
|
||||||
basic_fstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
|
basic_fstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
|
||||||
@@ -1441,7 +1379,6 @@ basic_fstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mod
|
|||||||
else
|
else
|
||||||
this->setstate(ios_base::failbit);
|
this->setstate(ios_base::failbit);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
template <class _CharT, class _Traits>
|
template <class _CharT, class _Traits>
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
inline _LIBCPP_INLINE_VISIBILITY
|
||||||
|
|||||||
1473
include/functional
1473
include/functional
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user