Import libc++ 3.7.0 release (r246257).
This commit is contained in:
parent
f857581820
commit
61b9a7258a
4
.arcconfig
Normal file
4
.arcconfig
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"project_id" : "libcxx",
|
||||
"conduit_uri" : "http://reviews.llvm.org/"
|
||||
}
|
54
.gitignore
vendored
Normal file
54
.gitignore
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
# 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/
|
345
CMakeLists.txt
Normal file
345
CMakeLists.txt
Normal file
@ -0,0 +1,345 @@
|
||||
# See www/CMake.html for instructions on how to build libcxx with CMake.
|
||||
|
||||
#===============================================================================
|
||||
# Setup Project
|
||||
#===============================================================================
|
||||
|
||||
project(libcxx CXX C)
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
if(POLICY CMP0042)
|
||||
cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default
|
||||
endif()
|
||||
|
||||
set(PACKAGE_NAME libcxx)
|
||||
set(PACKAGE_VERSION trunk-svn)
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
set(PACKAGE_BUGREPORT "llvm-bugs@lists.llvm.org")
|
||||
|
||||
# Add path for custom modules
|
||||
set(CMAKE_MODULE_PATH
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
|
||||
${CMAKE_MODULE_PATH}
|
||||
)
|
||||
|
||||
# Require out of source build.
|
||||
include(MacroEnsureOutOfSourceBuild)
|
||||
MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
|
||||
"${PROJECT_NAME} requires an out of source build. Please create a separate
|
||||
build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there."
|
||||
)
|
||||
|
||||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
set(LIBCXX_LIBDIR_SUFFIX "" CACHE STRING
|
||||
"Define suffix of library directory name (32/64)")
|
||||
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
|
||||
|
||||
set(LIBCXX_BUILT_STANDALONE 1)
|
||||
else()
|
||||
set(LIBCXX_LIBDIR_SUFFIX ${LLVM_LIBDIR_SUFFIX})
|
||||
endif()
|
||||
|
||||
#===============================================================================
|
||||
# Setup CMake Options
|
||||
#===============================================================================
|
||||
|
||||
# Define options.
|
||||
option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON)
|
||||
option(LIBCXX_ENABLE_RTTI "Use run time type information." ON)
|
||||
option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
|
||||
option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
|
||||
option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
|
||||
option(LIBCXX_ENABLE_CXX1Y "Enable -std=c++1y and use of c++1y language features if the compiler supports it." OFF)
|
||||
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
|
||||
option(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE "Build libc++ with support for the global filesystem namespace." ON)
|
||||
option(LIBCXX_ENABLE_STDIN "Build libc++ with support for stdin/std::cin." 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_BUILD_32_BITS "Build 32 bit libc++" OFF)
|
||||
option(LIBCXX_ENABLE_MONOTONIC_CLOCK
|
||||
"Build libc++ with support for a monotonic clock.
|
||||
This option may only be used when LIBCXX_ENABLE_THREADS=OFF." ON)
|
||||
option(LIBCXX_INSTALL_HEADERS "Install the libc++ headers." ON)
|
||||
option(LIBCXX_INSTALL_SUPPORT_HEADERS "Install libc++ support headers." ON)
|
||||
option(LIBCXX_GENERATE_COVERAGE "Enable generating code coverage." OFF)
|
||||
set(LIBCXX_COVERAGE_LIBRARY "" CACHE STRING
|
||||
"The Profile-rt library used to build with code coverage")
|
||||
option(LIBCXX_ENABLE_STATIC_ABI_LIBRARY "Statically link the ABI library" OFF)
|
||||
set(LIBCXX_SYSROOT "" CACHE STRING "Use alternate sysroot.")
|
||||
set(LIBCXX_GCC_TOOLCHAIN "" CACHE STRING "Use alternate GCC toolchain.")
|
||||
if (LIBCXX_BUILT_STANDALONE)
|
||||
set(LLVM_USE_SANITIZER "" CACHE STRING
|
||||
"Define the sanitizer used to build the library and tests")
|
||||
endif()
|
||||
|
||||
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()
|
||||
|
||||
set(CXXABIS none libcxxabi libcxxrt libstdc++ libsupc++)
|
||||
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 ()
|
||||
set(LIBCXX_CXX_ABI "${LIBCXX_CXX_ABI}" CACHE STRING
|
||||
"Specify C++ ABI library to use." FORCE)
|
||||
set_property(CACHE LIBCXX_CXX_ABI PROPERTY STRINGS ;${CXXABIS})
|
||||
|
||||
# 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)
|
||||
|
||||
#===============================================================================
|
||||
# Configure System
|
||||
#===============================================================================
|
||||
|
||||
set(LIBCXX_COMPILER ${CMAKE_CXX_COMPILER})
|
||||
set(LIBCXX_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(LIBCXX_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
|
||||
|
||||
# Declare libc++ configuration variables.
|
||||
# They are intended for use as follows:
|
||||
# LIBCXX_CXX_FLAGS: General flags for both the compiler and linker.
|
||||
# LIBCXX_COMPILE_FLAGS: Compile only flags.
|
||||
# LIBCXX_LINK_FLAGS: Linker only flags.
|
||||
set(LIBCXX_CXX_FLAGS "")
|
||||
set(LIBCXX_COMPILE_FLAGS "")
|
||||
set(LIBCXX_LINK_FLAGS "")
|
||||
|
||||
# Configure compiler.
|
||||
include(config-ix)
|
||||
# Configure ABI library
|
||||
include(HandleLibCXXABI)
|
||||
# Configure coverage options.
|
||||
if (LIBCXX_GENERATE_COVERAGE)
|
||||
include(CodeCoverage)
|
||||
set(CMAKE_BUILD_TYPE "COVERAGE" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
#===============================================================================
|
||||
# Setup Compiler Flags
|
||||
#===============================================================================
|
||||
|
||||
# Get required flags.
|
||||
# On all systems the system c++ standard library headers need to be excluded.
|
||||
if (MSVC)
|
||||
# MSVC only has -X, which disables all default includes; including the crt.
|
||||
# Thus, we do nothing and hope we don't accidentally include any of the C++
|
||||
# headers.
|
||||
else()
|
||||
if (LIBCXX_HAS_NOSTDINCXX_FLAG)
|
||||
list(APPEND LIBCXX_COMPILE_FLAGS -nostdinc++)
|
||||
string(REPLACE "-stdlib=libc++" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string(REPLACE "-stdlib=libstdc++" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
# If c++1y has been enabled then attempt to use it. Fail if it is no supported
|
||||
# by the compiler. Otherwise choose c++11 and ensure the compiler supports it.
|
||||
if (LIBCXX_ENABLE_CXX1Y)
|
||||
if (LIBCXX_HAS_STDCXX1Y_FLAG)
|
||||
set(LIBCXX_STD_VERSION c++1y)
|
||||
else()
|
||||
message(FATAL_ERROR "c++1y was enabled but the compiler does not support it.")
|
||||
endif()
|
||||
else()
|
||||
if (LIBCXX_HAS_STDCXX11_FLAG)
|
||||
set(LIBCXX_STD_VERSION c++11)
|
||||
else()
|
||||
message(FATAL_ERROR "c++11 is required by libc++ but is not supported by the compiler")
|
||||
endif()
|
||||
endif()
|
||||
# LIBCXX_STD_VERSION should always be set at this point.
|
||||
list(APPEND LIBCXX_CXX_FLAGS "-std=${LIBCXX_STD_VERSION}")
|
||||
endif()
|
||||
|
||||
macro(append_if list condition var)
|
||||
if (${condition})
|
||||
list(APPEND ${list} ${var})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Get warning flags
|
||||
if (NOT MSVC)
|
||||
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
|
||||
list(APPEND LIBCXX_COMPILE_FLAGS -Werror=return-type)
|
||||
endif()
|
||||
|
||||
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_W_FLAG -W)
|
||||
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG -Wno-unused-parameter)
|
||||
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings)
|
||||
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_WNO_LONG_LONG_FLAG -Wno-long-long)
|
||||
if (LIBCXX_ENABLE_WERROR)
|
||||
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror)
|
||||
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_WX_FLAG -WX)
|
||||
else()
|
||||
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_WNO_ERROR_FLAG -Wno-error)
|
||||
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_NO_WX_FLAG -WX-)
|
||||
endif()
|
||||
if (LIBCXX_ENABLE_PEDANTIC)
|
||||
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
|
||||
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_FLAGS LIBCXX_HAS_EHSC_FLAG -EHsc)
|
||||
else()
|
||||
list(APPEND LIBCXX_CXX_FLAGS -D_LIBCPP_NO_EXCEPTIONS)
|
||||
append_if(LIBCXX_CXX_FLAGS LIBCXX_HAS_NO_EHS_FLAG -EHs-)
|
||||
append_if(LIBCXX_CXX_FLAGS LIBCXX_HAS_NO_EHA_FLAG -EHa-)
|
||||
append_if(LIBCXX_CXX_FLAGS LIBCXX_HAS_FNO_EXCEPTIONS_FLAG -fno-exceptions)
|
||||
endif()
|
||||
# RTTI
|
||||
if (NOT LIBCXX_ENABLE_RTTI)
|
||||
list(APPEND LIBCXX_CXX_FLAGS -D_LIBCPP_NO_RTTI)
|
||||
append_if(LIBCXX_CXX_FLAGS LIBCXX_HAS_NO_GR_FLAG -GR-)
|
||||
append_if(LIBCXX_CXX_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti)
|
||||
endif()
|
||||
# Assert
|
||||
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
|
||||
if (LIBCXX_ENABLE_ASSERTIONS)
|
||||
# MSVC doesn't like _DEBUG on release builds. See PR 4379.
|
||||
if (NOT MSVC)
|
||||
list(APPEND LIBCXX_COMPILE_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_COMPILE_FLAGS -UNDEBUG)
|
||||
endif()
|
||||
else()
|
||||
if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
|
||||
list(APPEND LIBCXX_COMPILE_FLAGS -DNDEBUG)
|
||||
endif()
|
||||
endif()
|
||||
# Static library
|
||||
if (NOT LIBCXX_ENABLE_SHARED)
|
||||
list(APPEND LIBCXX_COMPILE_FLAGS -D_LIBCPP_BUILD_STATIC)
|
||||
endif()
|
||||
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32)
|
||||
if (LIBCXX_BUILD_32_BITS)
|
||||
message(STATUS "Building 32 bits executables and libraries.")
|
||||
list(APPEND LIBCXX_CXX_FLAGS "-m32")
|
||||
endif()
|
||||
elseif(LIBCXX_BUILD_32_BITS)
|
||||
message(FATAL_ERROR "LIBCXX_BUILD_32_BITS=ON is not supported on this platform.")
|
||||
endif()
|
||||
# This is the _ONLY_ place where add_definitions is called.
|
||||
if (MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
# LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE configuration
|
||||
if (NOT LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE)
|
||||
add_definitions(-D_LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE)
|
||||
endif()
|
||||
|
||||
# LIBCXX_ENABLE_STDIN configuration
|
||||
if (NOT LIBCXX_ENABLE_STDIN)
|
||||
add_definitions(-D_LIBCPP_HAS_NO_STDIN)
|
||||
endif()
|
||||
|
||||
# LIBCXX_ENABLE_STDOUT configuration
|
||||
if (NOT LIBCXX_ENABLE_STDOUT)
|
||||
add_definitions(-D_LIBCPP_HAS_NO_STDOUT)
|
||||
endif()
|
||||
|
||||
# LIBCXX_ENABLE_THREADS configuration
|
||||
if (NOT LIBCXX_ENABLE_THREADS)
|
||||
add_definitions(-D_LIBCPP_HAS_NO_THREADS)
|
||||
if (NOT LIBCXX_ENABLE_MONOTONIC_CLOCK)
|
||||
add_definitions(-D_LIBCPP_HAS_NO_MONOTONIC_CLOCK)
|
||||
endif()
|
||||
# Ensure LIBCXX_ENABLE_MONOTONIC_CLOCK is set to ON.
|
||||
elseif(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()
|
||||
|
||||
# LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS configuration
|
||||
if (NOT LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS)
|
||||
add_definitions(-D_LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS)
|
||||
endif()
|
||||
|
||||
# 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)
|
||||
# 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)
|
||||
append_if(LIBCXX_CXX_FLAGS LIBCXX_HAS_FNO_OMIT_FRAME_POINTER_FLAG
|
||||
"-fno-omit-frame-pointer")
|
||||
if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" AND
|
||||
NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
|
||||
append_if(LIBCXX_CXX_FLAGS LIBCXX_HAS_GLINE_TABLES_ONLY_FLAG
|
||||
"-gline-tables-only")
|
||||
endif()
|
||||
if (LLVM_USE_SANITIZER STREQUAL "Address")
|
||||
list(APPEND LIBCXX_CXX_FLAGS "-fsanitize=address")
|
||||
elseif (LLVM_USE_SANITIZER MATCHES "Memory(WithOrigins)?")
|
||||
list(APPEND LIBCXX_CXX_FLAGS "-fsanitize=memory")
|
||||
if (LLVM_USE_SANITIZER STREQUAL "MemoryWithOrigins")
|
||||
list(APPEND LIBCXX_CXX_FLAGS "-fsanitize-memory-track-origins")
|
||||
endif()
|
||||
elseif (LLVM_USE_SANITIZER STREQUAL "Undefined")
|
||||
list(APPEND LIBCXX_CXX_FLAGS
|
||||
"-fsanitize=undefined -fno-sanitize=vptr,function -fno-sanitize-recover")
|
||||
elseif (LLVM_USE_SANITIZER STREQUAL "Thread")
|
||||
list(APPEND LIBCXX_CXX_FLAGS "-fsanitize=thread")
|
||||
else()
|
||||
message(WARNING "Unsupported value of LLVM_USE_SANITIZER: ${LLVM_USE_SANITIZER}")
|
||||
endif()
|
||||
elseif(MSVC)
|
||||
message(WARNING "LLVM_USE_SANITIZER is not supported with MSVC")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
append_if(LIBCXX_CXX_FLAGS LIBCXX_TARGET_TRIPLE
|
||||
"-target ${LIBCXX_TARGET_TRIPLE}")
|
||||
|
||||
append_if(LIBCXX_CXX_FLAGS LIBCXX_SYSROOT "--sysroot ${LIBCXX_SYSROOT}")
|
||||
append_if(LIBCXX_CXX_FLAGS LIBCXX_GCC_TOOLCHAIN
|
||||
"-gcc-toolchain ${LIBCXX_GCC_TOOLCHAIN}")
|
||||
|
||||
if (LLVM_USE_SANITIZER AND LIBCXX_GENERATE_COVERAGE)
|
||||
message(FATAL_ERROR "LLVM_USE_SANITIZER cannot be used with LIBCXX_GENERATE_COVERAGE")
|
||||
endif()
|
||||
|
||||
string(REPLACE ";" " " LIBCXX_CXX_FLAGS "${LIBCXX_CXX_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCXX_CXX_FLAGS}")
|
||||
|
||||
#===============================================================================
|
||||
# Setup Source Code
|
||||
#===============================================================================
|
||||
|
||||
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)
|
||||
|
||||
#===============================================================================
|
||||
# Setup Tests
|
||||
#===============================================================================
|
||||
|
||||
add_subdirectory(test)
|
11
CREDITS.TXT
11
CREDITS.TXT
@ -12,6 +12,10 @@ 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.
|
||||
@ -84,6 +88,10 @@ 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
|
||||
|
||||
@ -105,6 +113,9 @@ 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.
|
||||
|
@ -14,7 +14,7 @@ Full text of the relevant licenses is included below.
|
||||
University of Illinois/NCSA
|
||||
Open Source License
|
||||
|
||||
Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT
|
||||
Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
56
Makefile
Normal file
56
Makefile
Normal file
@ -0,0 +1,56 @@
|
||||
##
|
||||
# libc++ Makefile
|
||||
##
|
||||
|
||||
SRCDIRS = .
|
||||
DESTDIR = $(DSTROOT)
|
||||
|
||||
OBJROOT=.
|
||||
SYMROOT=.
|
||||
export TRIPLE=-apple-
|
||||
|
||||
ifeq (,$(RC_INDIGO))
|
||||
INSTALL_PREFIX=""
|
||||
else
|
||||
INSTALL_PREFIX="$(SDKROOT)"
|
||||
endif
|
||||
INSTALL_DIR=$(DSTROOT)/$(INSTALL_PREFIX)
|
||||
|
||||
.PHONY: help installsrc clean installheaders install
|
||||
|
||||
help::
|
||||
@echo "Use make install DSTROOT=<destination>"
|
||||
|
||||
installsrc:: $(SRCROOT)
|
||||
|
||||
ditto $(SRCDIRS)/include $(SRCROOT)/include
|
||||
ditto $(SRCDIRS)/lib $(SRCROOT)/lib
|
||||
ditto $(SRCDIRS)/src $(SRCROOT)/src
|
||||
ditto $(SRCDIRS)/Makefile $(SRCROOT)/Makefile
|
||||
|
||||
clean::
|
||||
|
||||
# The installheaders target is used by clang's runtime/libcxx makefile.
|
||||
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::
|
||||
|
||||
cd lib && ./buildit
|
||||
ditto lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
|
||||
cd lib && dsymutil -o $(SYMROOT)/libc++.1.dylib.dSYM \
|
||||
$(SYMROOT)/usr/lib/libc++.1.dylib
|
||||
mkdir -p $(INSTALL_DIR)/usr/lib
|
||||
strip -S -o $(INSTALL_DIR)/usr/lib/libc++.1.dylib \
|
||||
$(SYMROOT)/usr/lib/libc++.1.dylib
|
||||
cd $(INSTALL_DIR)/usr/lib && ln -s libc++.1.dylib libc++.dylib
|
49
TODO.TXT
Normal file
49
TODO.TXT
Normal file
@ -0,0 +1,49 @@
|
||||
This is meant to be a general place to list things that should be done "someday"
|
||||
|
||||
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
|
||||
====================
|
||||
* Support <atomic> in C++03 (needed for internal use).
|
||||
* Audit use of libatomic builtins in <atomic> with GCC.
|
||||
* future should use <atomic> for synchronization.
|
||||
* call_once should use <atomic> for synchronization.
|
||||
* Audit shared_ptr use of <atomic>
|
||||
|
||||
Test Suite Tasks
|
||||
================
|
||||
* Get test suite passing in C++03.
|
||||
* 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.
|
||||
|
||||
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)
|
||||
* Investigate the effect of using __decltype instead of __typeof__ to provide
|
||||
decltype in C++03. What code could be broken by this change?
|
||||
* Convert failure tests to use Clang Verify.
|
||||
* Document support (or lack of) for C++11 libraries in C++03.
|
||||
* Document supported compilers.
|
36
cmake/Modules/CodeCoverage.cmake
Normal file
36
cmake/Modules/CodeCoverage.cmake
Normal file
@ -0,0 +1,36 @@
|
||||
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()
|
103
cmake/Modules/HandleLibCXXABI.cmake
Normal file
103
cmake/Modules/HandleLibCXXABI.cmake
Normal file
@ -0,0 +1,103 @@
|
||||
|
||||
#===============================================================================
|
||||
# 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}"
|
||||
)
|
||||
install(FILES "${CMAKE_BINARY_DIR}/include/${fpath}"
|
||||
DESTINATION include/c++/v1/${dstdir}
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
)
|
||||
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()
|
||||
|
||||
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 ()
|
18
cmake/Modules/MacroEnsureOutOfSourceBuild.cmake
Normal file
18
cmake/Modules/MacroEnsureOutOfSourceBuild.cmake
Normal file
@ -0,0 +1,18 @@
|
||||
# MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)
|
||||
|
||||
macro( MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage )
|
||||
|
||||
string( COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" _insource )
|
||||
if( _insource )
|
||||
message( SEND_ERROR "${_errorMessage}" )
|
||||
message( FATAL_ERROR
|
||||
"In-source builds are not allowed.
|
||||
CMake would overwrite the makefiles distributed with Compiler-RT.
|
||||
Please create a directory and run cmake from there, passing the path
|
||||
to this source directory as the last argument.
|
||||
This process created the file `CMakeCache.txt' and the directory `CMakeFiles'.
|
||||
Please delete them."
|
||||
)
|
||||
endif( _insource )
|
||||
|
||||
endmacro( MACRO_ENSURE_OUT_OF_SOURCE_BUILD )
|
35
cmake/config-ix.cmake
Normal file
35
cmake/config-ix.cmake
Normal file
@ -0,0 +1,35 @@
|
||||
include(CheckLibraryExists)
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
# Check compiler flags
|
||||
check_cxx_compiler_flag(-std=c++11 LIBCXX_HAS_STDCXX11_FLAG)
|
||||
check_cxx_compiler_flag(-std=c++1y LIBCXX_HAS_STDCXX1Y_FLAG)
|
||||
check_cxx_compiler_flag(-fPIC LIBCXX_HAS_FPIC_FLAG)
|
||||
check_cxx_compiler_flag(-fno-omit-frame-pointer LIBCXX_HAS_FNO_OMIT_FRAME_POINTER_FLAG)
|
||||
check_cxx_compiler_flag(-nodefaultlibs LIBCXX_HAS_NODEFAULTLIBS_FLAG)
|
||||
check_cxx_compiler_flag(-nostdinc++ LIBCXX_HAS_NOSTDINCXX_FLAG)
|
||||
check_cxx_compiler_flag(-Wall LIBCXX_HAS_WALL_FLAG)
|
||||
check_cxx_compiler_flag(-W LIBCXX_HAS_W_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(-Wno-error LIBCXX_HAS_WNO_ERROR_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(-gline-tables-only LIBCXX_HAS_GLINE_TABLES_ONLY_FLAG)
|
||||
check_cxx_compiler_flag(/WX LIBCXX_HAS_WX_FLAG)
|
||||
check_cxx_compiler_flag(/WX- LIBCXX_HAS_NO_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_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
|
||||
check_library_exists(c printf "" LIBCXX_HAS_C_LIB)
|
||||
check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
|
||||
check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
|
||||
check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
|
||||
|
24
include/CMakeLists.txt
Normal file
24
include/CMakeLists.txt
Normal file
@ -0,0 +1,24 @@
|
||||
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
|
||||
${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
|
||||
FILES_MATCHING
|
||||
${LIBCXX_HEADER_PATTERN}
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
)
|
||||
endif()
|
@ -906,7 +906,6 @@ rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle,
|
||||
{
|
||||
typedef __bit_iterator<_Cp, false> _I1;
|
||||
typedef typename _I1::difference_type difference_type;
|
||||
typedef typename _I1::__storage_type __storage_type;
|
||||
difference_type __d1 = __middle - __first;
|
||||
difference_type __d2 = __last - __middle;
|
||||
_I1 __r = __first + __d2;
|
||||
|
143
include/__config
143
include/__config
@ -17,14 +17,11 @@
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
|
||||
#else
|
||||
#define _GNUC_VER 0
|
||||
#endif
|
||||
|
||||
#if !_WIN32
|
||||
#include <unistd.h>
|
||||
#include <errno.h> // for ELAST on FreeBSD
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_VERSION 1101
|
||||
#define _LIBCPP_VERSION 3700
|
||||
|
||||
#define _LIBCPP_ABI_VERSION 1
|
||||
|
||||
@ -33,6 +30,23 @@
|
||||
|
||||
#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_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__
|
||||
#if __LITTLE_ENDIAN__
|
||||
#define _LIBCPP_LITTLE_ENDIAN 1
|
||||
@ -76,10 +90,8 @@
|
||||
#ifdef _WIN32
|
||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN 0
|
||||
// Compiler intrinsics (GCC or MSVC)
|
||||
# if defined(__clang__) \
|
||||
|| (defined(_MSC_VER) && _MSC_VER >= 1400) \
|
||||
|| (defined(__GNUC__) && _GNUC_VER > 403)
|
||||
// Compiler intrinsics (MSVC)
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
# define _LIBCPP_HAS_IS_BASE_OF
|
||||
# endif
|
||||
# if defined(_MSC_VER) && !defined(__clang__)
|
||||
@ -94,12 +106,6 @@
|
||||
# endif
|
||||
#endif // _WIN32
|
||||
|
||||
#ifdef __linux__
|
||||
# if defined(__GNUC__) && _GNUC_VER >= 403
|
||||
# define _LIBCPP_HAS_IS_BASE_OF
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __sun__
|
||||
# include <sys/isa_defs.h>
|
||||
# ifdef _LITTLE_ENDIAN
|
||||
@ -111,12 +117,22 @@
|
||||
# endif
|
||||
#endif // __sun__
|
||||
|
||||
#if defined(__native_client__)
|
||||
#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
|
||||
#endif // defined(__native_client__)
|
||||
#elif defined(_WIN32)
|
||||
# define _LIBCPP_USING_WIN32_RANDOM
|
||||
#else
|
||||
# define _LIBCPP_USING_DEV_RANDOM
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
|
||||
# include <endian.h>
|
||||
@ -173,10 +189,6 @@
|
||||
|
||||
#endif // _WIN32
|
||||
|
||||
#ifndef __has_attribute
|
||||
#define __has_attribute(__x) 0
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HIDDEN
|
||||
#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
|
||||
#endif
|
||||
@ -259,6 +271,8 @@ typedef __char32_t char32_t;
|
||||
# define _LIBCPP_NORETURN __attribute__ ((noreturn))
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_UNUSED __attribute__((__unused__))
|
||||
|
||||
#if !(__has_feature(cxx_defaulted_functions))
|
||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
#endif // !(__has_feature(cxx_defaulted_functions))
|
||||
@ -307,6 +321,10 @@ typedef __char32_t char32_t;
|
||||
# define _LIBCPP_HAS_IS_BASE_OF
|
||||
#endif
|
||||
|
||||
#if __has_feature(is_final)
|
||||
# define _LIBCPP_HAS_IS_FINAL
|
||||
#endif
|
||||
|
||||
// Objective-C++ features (opt-in)
|
||||
#if __has_feature(objc_arc)
|
||||
#define _LIBCPP_HAS_OBJC_ARC
|
||||
@ -325,6 +343,10 @@ typedef __char32_t char32_t;
|
||||
#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
|
||||
@ -381,9 +403,16 @@ namespace std {
|
||||
|
||||
#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
|
||||
@ -402,6 +431,8 @@ namespace std {
|
||||
|
||||
// No version of GCC supports relaxed constexpr rules
|
||||
#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
|
||||
// GCC 5 will support variable templates
|
||||
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
||||
|
||||
#define _NOEXCEPT throw()
|
||||
#define _NOEXCEPT_(x)
|
||||
@ -473,11 +504,13 @@ using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
|
||||
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
|
||||
#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 __alignof__ __alignof
|
||||
#define _LIBCPP_NORETURN __declspec(noreturn)
|
||||
#define _LIBCPP_UNUSED
|
||||
#define _ALIGNAS(x) __declspec(align(x))
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
@ -501,6 +534,7 @@ namespace std {
|
||||
#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
|
||||
#define _ATTRIBUTE(x) __attribute__((x))
|
||||
#define _LIBCPP_NORETURN __attribute__((noreturn))
|
||||
#define _LIBCPP_UNUSED
|
||||
|
||||
#define _NOEXCEPT throw()
|
||||
#define _NOEXCEPT_(x)
|
||||
@ -513,6 +547,8 @@ namespace std {
|
||||
#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
|
||||
@ -552,7 +588,12 @@ template <unsigned> struct __static_assert_check {};
|
||||
#endif // _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_DECLTYPE
|
||||
#define decltype(x) __typeof__(x)
|
||||
// GCC 4.6 provides __decltype in all standard modes.
|
||||
#if !__is_identifier(__decltype) || _GNUC_VER >= 406
|
||||
# define decltype(__x) __decltype(__x)
|
||||
#else
|
||||
# define decltype(__x) __typeof__(__x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
@ -573,14 +614,6 @@ template <unsigned> struct __static_assert_check {};
|
||||
#define _NOALIAS
|
||||
#endif
|
||||
|
||||
#ifndef __has_feature
|
||||
#define __has_feature(__x) 0
|
||||
#endif
|
||||
|
||||
#ifndef __has_builtin
|
||||
#define __has_builtin(__x) 0
|
||||
#endif
|
||||
|
||||
#if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__)
|
||||
# define _LIBCPP_EXPLICIT explicit
|
||||
#else
|
||||
@ -627,10 +660,16 @@ template <unsigned> struct __static_assert_check {};
|
||||
#define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || defined(__sun__) || defined(__NetBSD__)
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || \
|
||||
defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__)
|
||||
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(_NEWLIB_VERSION) && \
|
||||
!defined(__CloudABI__)
|
||||
#define _LIBCPP_HAS_CATOPEN 1
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#define _DECLARE_C99_LDBL_MATH 1
|
||||
#endif
|
||||
@ -643,21 +682,6 @@ template <unsigned> struct __static_assert_check {};
|
||||
#define _LIBCPP_WCTYPE_IS_MASK
|
||||
#endif
|
||||
|
||||
#if defined(ELAST)
|
||||
#define _LIBCPP_ELAST ELAST
|
||||
#elif defined(__linux__)
|
||||
#define _LIBCPP_ELAST 4095
|
||||
#elif defined(_NEWLIB_VERSION)
|
||||
#define _LIBCPP_ELAST __ELASTERROR
|
||||
#elif defined(__APPLE__)
|
||||
// Not _LIBCPP_ELAST needed on Apple
|
||||
#elif defined(__sun__)
|
||||
#define _LIBCPP_ELAST ESTALE
|
||||
#else
|
||||
// Warn here so that the person doing the libcxx port has an easier time:
|
||||
#warning This platform's ELAST hasn't been ported yet
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
|
||||
# define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 1
|
||||
#endif
|
||||
@ -718,4 +742,29 @@ extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
_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__)
|
||||
#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
|
||||
|
||||
#endif // _LIBCPP_CONFIG
|
||||
|
@ -22,7 +22,7 @@
|
||||
# include <cstdio>
|
||||
# include <cstddef>
|
||||
# ifndef _LIBCPP_ASSERT
|
||||
# define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (_VSTD::printf("%s\n", m), _VSTD::abort()))
|
||||
# define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (_VSTD::fprintf(stderr, "%s\n", m), _VSTD::abort()))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
@ -333,7 +333,8 @@ template<class _Fp, class _Alloc, class _Rp>
|
||||
__base<_Rp()>*
|
||||
__func<_Fp, _Alloc, _Rp()>::__clone() const
|
||||
{
|
||||
typedef typename _Alloc::template rebind<__func>::other _Ap;
|
||||
typedef allocator_traits<_Alloc> __alloc_traits;
|
||||
typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;
|
||||
_Ap __a(__f_.second());
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
@ -359,7 +360,8 @@ template<class _Fp, class _Alloc, class _Rp>
|
||||
void
|
||||
__func<_Fp, _Alloc, _Rp()>::destroy_deallocate()
|
||||
{
|
||||
typedef typename _Alloc::template rebind<__func>::other _Ap;
|
||||
typedef allocator_traits<_Alloc> __alloc_traits;
|
||||
typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;
|
||||
_Ap __a(__f_.second());
|
||||
__f_.~__compressed_pair<_Fp, _Alloc>();
|
||||
__a.deallocate(this, 1);
|
||||
@ -369,7 +371,8 @@ template<class _Fp, class _Alloc, class _Rp>
|
||||
_Rp
|
||||
__func<_Fp, _Alloc, _Rp()>::operator()()
|
||||
{
|
||||
return __invoke(__f_.first());
|
||||
typedef __invoke_void_return_wrapper<_Rp> _Invoker;
|
||||
return _Invoker::__call(__f_.first());
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_NO_RTTI
|
||||
@ -416,7 +419,8 @@ template<class _Fp, class _Alloc, class _Rp, class _A0>
|
||||
__base<_Rp(_A0)>*
|
||||
__func<_Fp, _Alloc, _Rp(_A0)>::__clone() const
|
||||
{
|
||||
typedef typename _Alloc::template rebind<__func>::other _Ap;
|
||||
typedef allocator_traits<_Alloc> __alloc_traits;
|
||||
typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;
|
||||
_Ap __a(__f_.second());
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
@ -442,7 +446,8 @@ template<class _Fp, class _Alloc, class _Rp, class _A0>
|
||||
void
|
||||
__func<_Fp, _Alloc, _Rp(_A0)>::destroy_deallocate()
|
||||
{
|
||||
typedef typename _Alloc::template rebind<__func>::other _Ap;
|
||||
typedef allocator_traits<_Alloc> __alloc_traits;
|
||||
typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;
|
||||
_Ap __a(__f_.second());
|
||||
__f_.~__compressed_pair<_Fp, _Alloc>();
|
||||
__a.deallocate(this, 1);
|
||||
@ -452,7 +457,8 @@ template<class _Fp, class _Alloc, class _Rp, class _A0>
|
||||
_Rp
|
||||
__func<_Fp, _Alloc, _Rp(_A0)>::operator()(_A0 __a0)
|
||||
{
|
||||
return __invoke(__f_.first(), __a0);
|
||||
typedef __invoke_void_return_wrapper<_Rp> _Invoker;
|
||||
return _Invoker::__call(__f_.first(), __a0);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_NO_RTTI
|
||||
@ -499,7 +505,8 @@ template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
|
||||
__base<_Rp(_A0, _A1)>*
|
||||
__func<_Fp, _Alloc, _Rp(_A0, _A1)>::__clone() const
|
||||
{
|
||||
typedef typename _Alloc::template rebind<__func>::other _Ap;
|
||||
typedef allocator_traits<_Alloc> __alloc_traits;
|
||||
typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;
|
||||
_Ap __a(__f_.second());
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
@ -525,7 +532,8 @@ template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
|
||||
void
|
||||
__func<_Fp, _Alloc, _Rp(_A0, _A1)>::destroy_deallocate()
|
||||
{
|
||||
typedef typename _Alloc::template rebind<__func>::other _Ap;
|
||||
typedef allocator_traits<_Alloc> __alloc_traits;
|
||||
typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;
|
||||
_Ap __a(__f_.second());
|
||||
__f_.~__compressed_pair<_Fp, _Alloc>();
|
||||
__a.deallocate(this, 1);
|
||||
@ -535,7 +543,8 @@ template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
|
||||
_Rp
|
||||
__func<_Fp, _Alloc, _Rp(_A0, _A1)>::operator()(_A0 __a0, _A1 __a1)
|
||||
{
|
||||
return __invoke(__f_.first(), __a0, __a1);
|
||||
typedef __invoke_void_return_wrapper<_Rp> _Invoker;
|
||||
return _Invoker::__call(__f_.first(), __a0, __a1);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_NO_RTTI
|
||||
@ -582,7 +591,8 @@ template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
|
||||
__base<_Rp(_A0, _A1, _A2)>*
|
||||
__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::__clone() const
|
||||
{
|
||||
typedef typename _Alloc::template rebind<__func>::other _Ap;
|
||||
typedef allocator_traits<_Alloc> __alloc_traits;
|
||||
typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;
|
||||
_Ap __a(__f_.second());
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
@ -608,7 +618,8 @@ template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
|
||||
void
|
||||
__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::destroy_deallocate()
|
||||
{
|
||||
typedef typename _Alloc::template rebind<__func>::other _Ap;
|
||||
typedef allocator_traits<_Alloc> __alloc_traits;
|
||||
typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;
|
||||
_Ap __a(__f_.second());
|
||||
__f_.~__compressed_pair<_Fp, _Alloc>();
|
||||
__a.deallocate(this, 1);
|
||||
@ -618,7 +629,8 @@ template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
|
||||
_Rp
|
||||
__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::operator()(_A0 __a0, _A1 __a1, _A2 __a2)
|
||||
{
|
||||
return __invoke(__f_.first(), __a0, __a1, __a2);
|
||||
typedef __invoke_void_return_wrapper<_Rp> _Invoker;
|
||||
return _Invoker::__call(__f_.first(), __a0, __a1, __a2);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_NO_RTTI
|
||||
@ -790,17 +802,11 @@ function<_Rp()>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(__f);
|
||||
::new (__f_) _FF(__f, __a0);
|
||||
}
|
||||
else
|
||||
{
|
||||
typedef typename __alloc_traits::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind_alloc<_FF>
|
||||
#else
|
||||
rebind_alloc<_FF>::other
|
||||
#endif
|
||||
_Ap;
|
||||
typedef typename __rebind_alloc_helper<__alloc_traits, _FF>::type _Ap;
|
||||
_Ap __a(__a0);
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
@ -827,6 +833,7 @@ function<_Rp()>::operator=(nullptr_t)
|
||||
else if (__f_)
|
||||
__f_->destroy_deallocate();
|
||||
__f_ = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<class _Rp>
|
||||
@ -1092,17 +1099,11 @@ function<_Rp(_A0)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(__f);
|
||||
::new (__f_) _FF(__f, __a0);
|
||||
}
|
||||
else
|
||||
{
|
||||
typedef typename __alloc_traits::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind_alloc<_FF>
|
||||
#else
|
||||
rebind_alloc<_FF>::other
|
||||
#endif
|
||||
_Ap;
|
||||
typedef typename __rebind_alloc_helper<__alloc_traits, _FF>::type _Ap;
|
||||
_Ap __a(__a0);
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
@ -1129,6 +1130,7 @@ function<_Rp(_A0)>::operator=(nullptr_t)
|
||||
else if (__f_)
|
||||
__f_->destroy_deallocate();
|
||||
__f_ = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<class _Rp, class _A0>
|
||||
@ -1394,17 +1396,11 @@ function<_Rp(_A0, _A1)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(__f);
|
||||
::new (__f_) _FF(__f, __a0);
|
||||
}
|
||||
else
|
||||
{
|
||||
typedef typename __alloc_traits::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind_alloc<_FF>
|
||||
#else
|
||||
rebind_alloc<_FF>::other
|
||||
#endif
|
||||
_Ap;
|
||||
typedef typename __rebind_alloc_helper<__alloc_traits, _FF>::type _Ap;
|
||||
_Ap __a(__a0);
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
@ -1431,6 +1427,7 @@ function<_Rp(_A0, _A1)>::operator=(nullptr_t)
|
||||
else if (__f_)
|
||||
__f_->destroy_deallocate();
|
||||
__f_ = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<class _Rp, class _A0, class _A1>
|
||||
@ -1696,17 +1693,11 @@ function<_Rp(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc& __a0, _Fp
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(__f);
|
||||
::new (__f_) _FF(__f, __a0);
|
||||
}
|
||||
else
|
||||
{
|
||||
typedef typename __alloc_traits::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind_alloc<_FF>
|
||||
#else
|
||||
rebind_alloc<_FF>::other
|
||||
#endif
|
||||
_Ap;
|
||||
typedef typename __rebind_alloc_helper<__alloc_traits, _FF>::type _Ap;
|
||||
_Ap __a(__a0);
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
@ -1733,6 +1724,7 @@ function<_Rp(_A0, _A1, _A2)>::operator=(nullptr_t)
|
||||
else if (__f_)
|
||||
__f_->destroy_deallocate();
|
||||
__f_ = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<class _Rp, class _A0, class _A1, class _A2>
|
||||
@ -2099,14 +2091,16 @@ public:
|
||||
result_type
|
||||
operator()(_Args&& ...__args)
|
||||
{
|
||||
return base::operator()(_VSTD::forward<_Args>(__args)...);
|
||||
typedef __invoke_void_return_wrapper<_Rp> _Invoker;
|
||||
return _Invoker::__call(static_cast<base&>(*this), _VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class ..._Args>
|
||||
result_type
|
||||
operator()(_Args&& ...__args) const
|
||||
{
|
||||
return base::operator()(_VSTD::forward<_Args>(__args)...);
|
||||
typedef __invoke_void_return_wrapper<_Rp> _Invoker;
|
||||
return _Invoker::__call(static_cast<base const&>(*this), _VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -70,7 +70,9 @@ struct _LIBCPP_TYPE_VIS_ONLY less<void>
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
auto operator()(_T1&& __t, _T2&& __u) const
|
||||
{ return _VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u); }
|
||||
_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
|
||||
@ -419,6 +421,26 @@ struct __invoke_return
|
||||
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type;
|
||||
};
|
||||
|
||||
template <class _Ret>
|
||||
struct __invoke_void_return_wrapper
|
||||
{
|
||||
template <class ..._Args>
|
||||
static _Ret __call(_Args&&... __args)
|
||||
{
|
||||
return __invoke(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct __invoke_void_return_wrapper<void>
|
||||
{
|
||||
template <class ..._Args>
|
||||
static void __call(_Args&&... __args)
|
||||
{
|
||||
__invoke(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_TYPE_VIS_ONLY reference_wrapper
|
||||
: public __weak_result_type<_Tp>
|
||||
|
@ -995,6 +995,63 @@ struct __invoke_return2
|
||||
_VSTD::declval<_A2>())) type;
|
||||
};
|
||||
|
||||
template <class _Ret>
|
||||
struct __invoke_void_return_wrapper
|
||||
{
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <>
|
||||
struct __invoke_void_return_wrapper<void>
|
||||
{
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_TYPE_VIS_ONLY reference_wrapper
|
||||
: public __weak_result_type<_Tp>
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <cmath>
|
||||
|
||||
#include <__undef_min_max>
|
||||
#include <__undef___deallocate>
|
||||
|
||||
#include <__debug>
|
||||
|
||||
@ -61,7 +62,7 @@ struct __hash_node
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
__is_power2(size_t __bc)
|
||||
__is_hash_power2(size_t __bc)
|
||||
{
|
||||
return __bc > 2 && !(__bc & (__bc - 1));
|
||||
}
|
||||
@ -75,7 +76,7 @@ __constrain_hash(size_t __h, size_t __bc)
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
size_t
|
||||
__next_pow2(size_t __n)
|
||||
__next_hash_pow2(size_t __n)
|
||||
{
|
||||
return size_t(1) << (std::numeric_limits<size_t>::digits - __clz(__n-1));
|
||||
}
|
||||
@ -84,8 +85,6 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc> class __hash_table
|
||||
template <class _ConstNodePtr> class _LIBCPP_TYPE_VIS_ONLY __hash_const_iterator;
|
||||
template <class _HashIterator> class _LIBCPP_TYPE_VIS_ONLY __hash_map_iterator;
|
||||
template <class _HashIterator> class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator;
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
class _LIBCPP_TYPE_VIS_ONLY unordered_map;
|
||||
|
||||
template <class _NodePtr>
|
||||
class _LIBCPP_TYPE_VIS_ONLY __hash_iterator
|
||||
@ -776,13 +775,7 @@ public:
|
||||
public:
|
||||
// Create __node
|
||||
typedef __hash_node<value_type, typename __alloc_traits::void_pointer> __node;
|
||||
typedef typename __alloc_traits::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind_alloc<__node>
|
||||
#else
|
||||
rebind_alloc<__node>::other
|
||||
#endif
|
||||
__node_allocator;
|
||||
typedef typename __rebind_alloc_helper<__alloc_traits, __node>::type __node_allocator;
|
||||
typedef allocator_traits<__node_allocator> __node_traits;
|
||||
typedef typename __node_traits::pointer __node_pointer;
|
||||
typedef typename __node_traits::pointer __node_const_pointer;
|
||||
@ -797,13 +790,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
typedef typename __node_traits::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind_alloc<__node_pointer>
|
||||
#else
|
||||
rebind_alloc<__node_pointer>::other
|
||||
#endif
|
||||
__pointer_allocator;
|
||||
typedef typename __rebind_alloc_helper<__node_traits, __node_pointer>::type __pointer_allocator;
|
||||
typedef __bucket_list_deallocator<__pointer_allocator> __bucket_list_deleter;
|
||||
typedef unique_ptr<__node_pointer[], __bucket_list_deleter> __bucket_list;
|
||||
typedef allocator_traits<__pointer_allocator> __pointer_alloc_traits;
|
||||
@ -909,11 +896,21 @@ public:
|
||||
iterator __emplace_hint_multi(const_iterator __p, _Args&&... __args);
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _ValueTp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> __insert_unique_value(_ValueTp&& __x);
|
||||
#else
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> __insert_unique_value(const value_type& __x);
|
||||
#endif
|
||||
|
||||
pair<iterator, bool> __insert_unique(const value_type& __x);
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
pair<iterator, bool> __insert_unique(value_type&& __x);
|
||||
template <class _Pp>
|
||||
pair<iterator, bool> __insert_unique(_Pp&& __x);
|
||||
pair<iterator, bool> __insert_unique(_Pp&& __x);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@ -988,12 +985,14 @@ public:
|
||||
|
||||
void swap(__hash_table& __u)
|
||||
_NOEXCEPT_(
|
||||
(!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__pointer_allocator>::value) &&
|
||||
(!__node_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value) &&
|
||||
__is_nothrow_swappable<hasher>::value &&
|
||||
__is_nothrow_swappable<key_equal>::value);
|
||||
__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value
|
||||
#if _LIBCPP_STD_VER <= 11
|
||||
&& (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value
|
||||
|| __is_nothrow_swappable<__pointer_allocator>::value)
|
||||
&& (!__node_traits::propagate_on_container_swap::value
|
||||
|| __is_nothrow_swappable<__node_allocator>::value)
|
||||
#endif
|
||||
);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_bucket_count() const _NOEXCEPT
|
||||
@ -1121,38 +1120,6 @@ private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__hash_table&, false_type) _NOEXCEPT {}
|
||||
|
||||
template <class _Ap>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static
|
||||
void
|
||||
__swap_alloc(_Ap& __x, _Ap& __y)
|
||||
_NOEXCEPT_(
|
||||
!allocator_traits<_Ap>::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<_Ap>::value)
|
||||
{
|
||||
__swap_alloc(__x, __y,
|
||||
integral_constant<bool,
|
||||
allocator_traits<_Ap>::propagate_on_container_swap::value
|
||||
>());
|
||||
}
|
||||
|
||||
template <class _Ap>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static
|
||||
void
|
||||
__swap_alloc(_Ap& __x, _Ap& __y, true_type)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_Ap>::value)
|
||||
{
|
||||
using _VSTD::swap;
|
||||
swap(__x, __y);
|
||||
}
|
||||
|
||||
template <class _Ap>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static
|
||||
void
|
||||
__swap_alloc(_Ap&, _Ap&, false_type) _NOEXCEPT {}
|
||||
|
||||
void __deallocate(__node_pointer __np) _NOEXCEPT;
|
||||
__node_pointer __detach() _NOEXCEPT;
|
||||
|
||||
@ -1615,7 +1582,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
|
||||
{
|
||||
if (size()+1 > __bc * max_load_factor() || __bc == 0)
|
||||
{
|
||||
rehash(_VSTD::max<size_type>(2 * __bc + !__is_power2(__bc),
|
||||
rehash(_VSTD::max<size_type>(2 * __bc + !__is_hash_power2(__bc),
|
||||
size_type(ceil(float(size() + 1) / max_load_factor()))));
|
||||
__bc = bucket_count();
|
||||
__chash = __constrain_hash(__nd->__hash_, __bc);
|
||||
@ -1658,7 +1625,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c
|
||||
size_type __bc = bucket_count();
|
||||
if (size()+1 > __bc * max_load_factor() || __bc == 0)
|
||||
{
|
||||
rehash(_VSTD::max<size_type>(2 * __bc + !__is_power2(__bc),
|
||||
rehash(_VSTD::max<size_type>(2 * __bc + !__is_hash_power2(__bc),
|
||||
size_type(ceil(float(size() + 1) / max_load_factor()))));
|
||||
__bc = bucket_count();
|
||||
}
|
||||
@ -1728,7 +1695,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(
|
||||
size_type __bc = bucket_count();
|
||||
if (size()+1 > __bc * max_load_factor() || __bc == 0)
|
||||
{
|
||||
rehash(_VSTD::max<size_type>(2 * __bc + !__is_power2(__bc),
|
||||
rehash(_VSTD::max<size_type>(2 * __bc + !__is_hash_power2(__bc),
|
||||
size_type(ceil(float(size() + 1) / max_load_factor()))));
|
||||
__bc = bucket_count();
|
||||
}
|
||||
@ -1752,6 +1719,26 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(const value_type& __x)
|
||||
{
|
||||
return __insert_unique_value(__x);
|
||||
}
|
||||
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
template <class _ValueTp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique_value(_ValueTp&& __x)
|
||||
#else
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique_value(const value_type& __x)
|
||||
#endif
|
||||
{
|
||||
#if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||
typedef const value_type& _ValueTp;
|
||||
#endif
|
||||
size_t __hash = hash_function()(__x);
|
||||
size_type __bc = bucket_count();
|
||||
bool __inserted = false;
|
||||
@ -1773,10 +1760,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(const value_type& __x)
|
||||
}
|
||||
}
|
||||
{
|
||||
__node_holder __h = __construct_node(__x, __hash);
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_ValueTp>(__x), __hash);
|
||||
if (size()+1 > __bc * max_load_factor() || __bc == 0)
|
||||
{
|
||||
rehash(_VSTD::max<size_type>(2 * __bc + !__is_power2(__bc),
|
||||
rehash(_VSTD::max<size_type>(2 * __bc + !__is_hash_power2(__bc),
|
||||
size_type(ceil(float(size() + 1) / max_load_factor()))));
|
||||
__bc = bucket_count();
|
||||
__chash = __constrain_hash(__hash, __bc);
|
||||
@ -1856,6 +1843,13 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi(
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(value_type&& __x)
|
||||
{
|
||||
return __insert_unique_value(_VSTD::move(__x));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
template <class _Pp>
|
||||
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
|
||||
@ -1946,8 +1940,8 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::rehash(size_type __n)
|
||||
__n = _VSTD::max<size_type>
|
||||
(
|
||||
__n,
|
||||
__is_power2(__bc) ? __next_pow2(size_t(ceil(float(size()) / max_load_factor()))) :
|
||||
__next_prime(size_t(ceil(float(size()) / max_load_factor())))
|
||||
__is_hash_power2(__bc) ? __next_hash_pow2(size_t(ceil(float(size()) / max_load_factor()))) :
|
||||
__next_prime(size_t(ceil(float(size()) / max_load_factor())))
|
||||
);
|
||||
if (__n < __bc)
|
||||
__rehash(__n);
|
||||
@ -2358,12 +2352,14 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
void
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
|
||||
_NOEXCEPT_(
|
||||
(!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__pointer_allocator>::value) &&
|
||||
(!__node_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value) &&
|
||||
__is_nothrow_swappable<hasher>::value &&
|
||||
__is_nothrow_swappable<key_equal>::value)
|
||||
__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value
|
||||
#if _LIBCPP_STD_VER <= 11
|
||||
&& (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value
|
||||
|| __is_nothrow_swappable<__pointer_allocator>::value)
|
||||
&& (!__node_traits::propagate_on_container_swap::value
|
||||
|| __is_nothrow_swappable<__node_allocator>::value)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
{
|
||||
__node_pointer_pointer __npp = __bucket_list_.release();
|
||||
@ -2371,9 +2367,9 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
|
||||
__u.__bucket_list_.reset(__npp);
|
||||
}
|
||||
_VSTD::swap(__bucket_list_.get_deleter().size(), __u.__bucket_list_.get_deleter().size());
|
||||
__swap_alloc(__bucket_list_.get_deleter().__alloc(),
|
||||
__swap_allocator(__bucket_list_.get_deleter().__alloc(),
|
||||
__u.__bucket_list_.get_deleter().__alloc());
|
||||
__swap_alloc(__node_alloc(), __u.__node_alloc());
|
||||
__swap_allocator(__node_alloc(), __u.__node_alloc());
|
||||
_VSTD::swap(__p1_.first().__next_, __u.__p1_.first().__next_);
|
||||
__p2_.swap(__u.__p2_);
|
||||
__p3_.swap(__u.__p3_);
|
||||
|
@ -30,6 +30,7 @@
|
||||
# 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>
|
||||
@ -352,16 +353,15 @@ public:
|
||||
static const mask punct = _PUNCT;
|
||||
static const mask xdigit = _HEX;
|
||||
static const mask blank = _BLANK;
|
||||
#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__) || defined(__ANDROID__)
|
||||
#ifdef __APPLE__
|
||||
# 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__)
|
||||
# elif defined(__FreeBSD__)
|
||||
typedef unsigned long mask;
|
||||
#elif defined(__EMSCRIPTEN__) || defined(__NetBSD__)
|
||||
# elif defined(__EMSCRIPTEN__) || defined(__NetBSD__)
|
||||
typedef unsigned short mask;
|
||||
#elif defined(__ANDROID__)
|
||||
typedef unsigned char mask;
|
||||
#endif
|
||||
# endif
|
||||
static const mask space = _CTYPE_S;
|
||||
static const mask print = _CTYPE_R;
|
||||
static const mask cntrl = _CTYPE_C;
|
||||
@ -370,11 +370,7 @@ public:
|
||||
static const mask alpha = _CTYPE_A;
|
||||
static const mask digit = _CTYPE_D;
|
||||
static const mask punct = _CTYPE_P;
|
||||
# if defined(__ANDROID__)
|
||||
static const mask xdigit = _CTYPE_X | _CTYPE_D;
|
||||
# else
|
||||
static const mask xdigit = _CTYPE_X;
|
||||
# endif
|
||||
|
||||
# if defined(__NetBSD__)
|
||||
static const mask blank = _CTYPE_BL;
|
||||
@ -393,7 +389,23 @@ public:
|
||||
static const mask punct = _ISPUNCT;
|
||||
static const mask xdigit = _ISXDIGIT;
|
||||
static const mask blank = _ISBLANK;
|
||||
#else // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__ || __EMSCRIPTEN__ || __sun__
|
||||
#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;
|
||||
@ -405,7 +417,7 @@ public:
|
||||
static const mask punct = 1<<7;
|
||||
static const mask xdigit = 1<<8;
|
||||
static const mask blank = 1<<9;
|
||||
#endif // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__
|
||||
#endif
|
||||
static const mask alnum = alpha | digit;
|
||||
static const mask graph = alnum | punct;
|
||||
|
||||
@ -1420,7 +1432,7 @@ protected:
|
||||
|
||||
// template <class charT> class numpunct_byname
|
||||
|
||||
template <class charT> class _LIBCPP_TYPE_VIS_ONLY numpunct_byname;
|
||||
template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY numpunct_byname;
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS numpunct_byname<char>
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <__config>
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
#if __APPLE__
|
||||
#ifdef __APPLE__
|
||||
#include <dlfcn.h>
|
||||
#include <mach-o/dyld.h>
|
||||
#endif
|
||||
@ -49,7 +49,7 @@ private:
|
||||
return data + sizeof(*rep);
|
||||
}
|
||||
|
||||
#if __APPLE__
|
||||
#ifdef __APPLE__
|
||||
static
|
||||
const char*
|
||||
compute_gcc_empty_string_storage() _NOEXCEPT
|
||||
|
@ -156,25 +156,6 @@ private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__split_buffer&, 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&, __alloc_rr&, false_type) _NOEXCEPT
|
||||
{}
|
||||
};
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
@ -431,7 +412,7 @@ __split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
|
||||
_VSTD::swap(__begin_, __x.__begin_);
|
||||
_VSTD::swap(__end_, __x.__end_);
|
||||
_VSTD::swap(__end_cap(), __x.__end_cap());
|
||||
__swap_alloc(__alloc(), __x.__alloc());
|
||||
__swap_allocator(__alloc(), __x.__alloc());
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
|
@ -15,6 +15,8 @@
|
||||
#include <type_traits>
|
||||
#include <new>
|
||||
|
||||
#include <__undef___deallocate>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
124
include/__tree
124
include/__tree
@ -28,14 +28,6 @@ template <class _Tp, class _NodePtr, class _DiffType>
|
||||
class _LIBCPP_TYPE_VIS_ONLY __tree_iterator;
|
||||
template <class _Tp, class _ConstNodePtr, class _DiffType>
|
||||
class _LIBCPP_TYPE_VIS_ONLY __tree_const_iterator;
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
class _LIBCPP_TYPE_VIS_ONLY map;
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
class _LIBCPP_TYPE_VIS_ONLY multimap;
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
class _LIBCPP_TYPE_VIS_ONLY set;
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
class _LIBCPP_TYPE_VIS_ONLY multiset;
|
||||
|
||||
/*
|
||||
|
||||
@ -522,9 +514,9 @@ public:
|
||||
bool __value_constructed;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __tree_node_destructor(allocator_type& __na) _NOEXCEPT
|
||||
explicit __tree_node_destructor(allocator_type& __na, bool __val = false) _NOEXCEPT
|
||||
: __na_(__na),
|
||||
__value_constructed(false)
|
||||
__value_constructed(__val)
|
||||
{}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -622,8 +614,6 @@ class _LIBCPP_TYPE_VIS_ONLY __tree_iterator
|
||||
{
|
||||
typedef _NodePtr __node_pointer;
|
||||
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_;
|
||||
|
||||
@ -652,17 +642,21 @@ public:
|
||||
{return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tree_iterator& operator++()
|
||||
{__ptr_ = static_cast<__node_pointer>(__tree_next(static_cast<__node_base_pointer>(__ptr_)));
|
||||
return *this;}
|
||||
__tree_iterator& operator++() {
|
||||
__ptr_ = static_cast<__node_pointer>(
|
||||
__tree_next(static_cast<typename __node::base::pointer>(__ptr_)));
|
||||
return *this;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tree_iterator operator++(int)
|
||||
{__tree_iterator __t(*this); ++(*this); return __t;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tree_iterator& operator--()
|
||||
{__ptr_ = static_cast<__node_pointer>(__tree_prev(static_cast<__node_base_pointer>(__ptr_)));
|
||||
return *this;}
|
||||
__tree_iterator& operator--() {
|
||||
__ptr_ = static_cast<__node_pointer>(
|
||||
__tree_prev(static_cast<typename __node::base::pointer>(__ptr_)));
|
||||
return *this;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tree_iterator operator--(int)
|
||||
{__tree_iterator __t(*this); --(*this); return __t;}
|
||||
@ -691,14 +685,6 @@ class _LIBCPP_TYPE_VIS_ONLY __tree_const_iterator
|
||||
{
|
||||
typedef _ConstNodePtr __node_pointer;
|
||||
typedef typename pointer_traits<__node_pointer>::element_type __node;
|
||||
typedef 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_;
|
||||
|
||||
@ -743,17 +729,39 @@ public:
|
||||
{return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tree_const_iterator& operator++()
|
||||
{__ptr_ = static_cast<__node_pointer>(__tree_next(static_cast<__node_base_pointer>(__ptr_)));
|
||||
return *this;}
|
||||
__tree_const_iterator& operator++() {
|
||||
typedef typename pointer_traits<__node_pointer>::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
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
|
||||
__tree_const_iterator operator++(int)
|
||||
{__tree_const_iterator __t(*this); ++(*this); return __t;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tree_const_iterator& operator--()
|
||||
{__ptr_ = static_cast<__node_pointer>(__tree_prev(static_cast<__node_base_pointer>(__ptr_)));
|
||||
return *this;}
|
||||
__tree_const_iterator& operator--() {
|
||||
typedef typename pointer_traits<__node_pointer>::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
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
|
||||
__tree_const_iterator operator--(int)
|
||||
{__tree_const_iterator __t(*this); --(*this); return __t;}
|
||||
@ -794,13 +802,7 @@ public:
|
||||
|
||||
typedef __tree_node<value_type, __void_pointer> __node;
|
||||
typedef __tree_node_base<__void_pointer> __node_base;
|
||||
typedef typename __alloc_traits::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind_alloc<__node>
|
||||
#else
|
||||
rebind_alloc<__node>::other
|
||||
#endif
|
||||
__node_allocator;
|
||||
typedef typename __rebind_alloc_helper<__alloc_traits, __node>::type __node_allocator;
|
||||
typedef allocator_traits<__node_allocator> __node_traits;
|
||||
typedef typename __node_traits::pointer __node_pointer;
|
||||
typedef typename __node_traits::pointer __node_const_pointer;
|
||||
@ -924,9 +926,12 @@ public:
|
||||
|
||||
void swap(__tree& __t)
|
||||
_NOEXCEPT_(
|
||||
__is_nothrow_swappable<value_compare>::value &&
|
||||
(!__node_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value));
|
||||
__is_nothrow_swappable<value_compare>::value
|
||||
#if _LIBCPP_STD_VER <= 11
|
||||
&& (!__node_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value)
|
||||
#endif
|
||||
);
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
@ -1094,25 +1099,6 @@ private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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();
|
||||
static __node_pointer __detach(__node_pointer);
|
||||
|
||||
@ -1450,15 +1436,18 @@ __tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd) _NOEXCEPT
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
void
|
||||
__tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
|
||||
_NOEXCEPT_(
|
||||
__is_nothrow_swappable<value_compare>::value &&
|
||||
(!__node_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value))
|
||||
_NOEXCEPT_(
|
||||
__is_nothrow_swappable<value_compare>::value
|
||||
#if _LIBCPP_STD_VER <= 11
|
||||
&& (!__node_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
using _VSTD::swap;
|
||||
swap(__begin_node_, __t.__begin_node_);
|
||||
swap(__pair1_.first(), __t.__pair1_.first());
|
||||
__swap_alloc(__node_alloc(), __t.__node_alloc());
|
||||
__swap_allocator(__node_alloc(), __t.__node_alloc());
|
||||
__pair3_.swap(__t.__pair3_);
|
||||
if (size() == 0)
|
||||
__begin_node() = __end_node();
|
||||
@ -2069,7 +2058,6 @@ template <class _Key>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::size_type
|
||||
__tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const
|
||||
{
|
||||
typedef pair<const_iterator, const_iterator> _Pp;
|
||||
__node_const_pointer __result = __end_node();
|
||||
__node_const_pointer __rt = __root();
|
||||
while (__rt != nullptr)
|
||||
@ -2291,7 +2279,7 @@ __tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT
|
||||
--size();
|
||||
__tree_remove(__end_node()->__left_,
|
||||
static_cast<__node_base_pointer>(__np));
|
||||
return __node_holder(__np, _Dp(__node_alloc()));
|
||||
return __node_holder(__np, _Dp(__node_alloc(), true));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
|
@ -19,40 +19,9 @@
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#include <__tuple_03>
|
||||
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// __lazy_and
|
||||
|
||||
template <bool _Last, class ..._Preds>
|
||||
struct __lazy_and_impl;
|
||||
|
||||
template <class ..._Preds>
|
||||
struct __lazy_and_impl<false, _Preds...> : false_type {};
|
||||
|
||||
template <>
|
||||
struct __lazy_and_impl<true> : true_type {};
|
||||
|
||||
template <class _Pred>
|
||||
struct __lazy_and_impl<true, _Pred> : integral_constant<bool, _Pred::type::value> {};
|
||||
|
||||
template <class _Hp, class ..._Tp>
|
||||
struct __lazy_and_impl<true, _Hp, _Tp...> : __lazy_and_impl<_Hp::type::value, _Tp...> {};
|
||||
|
||||
template <class _P1, class ..._Pr>
|
||||
struct __lazy_and : __lazy_and_impl<_P1::type::value, _Pr...> {};
|
||||
|
||||
// __lazy_not
|
||||
|
||||
template <class _Pred>
|
||||
struct __lazy_not : integral_constant<bool, !_Pred::type::value> {};
|
||||
|
||||
|
||||
template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY tuple_size;
|
||||
|
||||
template <class _Tp>
|
||||
@ -90,19 +59,18 @@ public:
|
||||
typedef typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
|
||||
};
|
||||
|
||||
template <class ..._Tp> class _LIBCPP_TYPE_VIS_ONLY tuple;
|
||||
template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY pair;
|
||||
template <class _Tp, size_t _Size> struct _LIBCPP_TYPE_VIS_ONLY array;
|
||||
|
||||
template <class _Tp> struct __tuple_like : false_type {};
|
||||
|
||||
template <class _Tp> struct __tuple_like<const _Tp> : public __tuple_like<_Tp> {};
|
||||
template <class _Tp> struct __tuple_like<volatile _Tp> : public __tuple_like<_Tp> {};
|
||||
template <class _Tp> struct __tuple_like<const volatile _Tp> : public __tuple_like<_Tp> {};
|
||||
|
||||
// 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 _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>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
@ -118,6 +86,13 @@ template <size_t _Ip, class ..._Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
|
||||
get(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>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
@ -129,10 +104,18 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
||||
get(const pair<_T1, _T2>&) _NOEXCEPT;
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
|
||||
get(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>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
@ -144,10 +127,39 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
const _Tp&
|
||||
get(const array<_Tp, _Size>&) _NOEXCEPT;
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_Tp&&
|
||||
get(array<_Tp, _Size>&&) _NOEXCEPT;
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
|
||||
// __lazy_and
|
||||
|
||||
template <bool _Last, class ..._Preds>
|
||||
struct __lazy_and_impl;
|
||||
|
||||
template <class ..._Preds>
|
||||
struct __lazy_and_impl<false, _Preds...> : false_type {};
|
||||
|
||||
template <>
|
||||
struct __lazy_and_impl<true> : true_type {};
|
||||
|
||||
template <class _Pred>
|
||||
struct __lazy_and_impl<true, _Pred> : integral_constant<bool, _Pred::type::value> {};
|
||||
|
||||
template <class _Hp, class ..._Tp>
|
||||
struct __lazy_and_impl<true, _Hp, _Tp...> : __lazy_and_impl<_Hp::type::value, _Tp...> {};
|
||||
|
||||
template <class _P1, class ..._Pr>
|
||||
struct __lazy_and : __lazy_and_impl<_P1::type::value, _Pr...> {};
|
||||
|
||||
// __lazy_not
|
||||
|
||||
template <class _Pred>
|
||||
struct __lazy_not : integral_constant<bool, !_Pred::type::value> {};
|
||||
|
||||
// __make_tuple_indices
|
||||
|
||||
@ -354,8 +366,8 @@ struct __tuple_assignable<_Tp, _Up, true, true>
|
||||
tuple_size<_Up>::value, _Tp, _Up>
|
||||
{};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___TUPLE
|
||||
|
18
include/__undef___deallocate
Normal file
18
include/__undef___deallocate
Normal file
@ -0,0 +1,18 @@
|
||||
// -*- 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
|
@ -521,11 +521,11 @@ template <class RandomAccessIterator, class Compare>
|
||||
|
||||
template <class ForwardIterator>
|
||||
ForwardIterator
|
||||
min_element(ForwardIterator first, ForwardIterator last);
|
||||
min_element(ForwardIterator first, ForwardIterator last); // constexpr in C++14
|
||||
|
||||
template <class ForwardIterator, class Compare>
|
||||
ForwardIterator
|
||||
min_element(ForwardIterator first, ForwardIterator last, Compare comp);
|
||||
min_element(ForwardIterator first, ForwardIterator last, Compare comp); // constexpr in C++14
|
||||
|
||||
template <class T>
|
||||
const T&
|
||||
@ -545,11 +545,11 @@ template<class T, class Compare>
|
||||
|
||||
template <class ForwardIterator>
|
||||
ForwardIterator
|
||||
max_element(ForwardIterator first, ForwardIterator last);
|
||||
max_element(ForwardIterator first, ForwardIterator last); // constexpr in C++14
|
||||
|
||||
template <class ForwardIterator, class Compare>
|
||||
ForwardIterator
|
||||
max_element(ForwardIterator first, ForwardIterator last, Compare comp);
|
||||
max_element(ForwardIterator first, ForwardIterator last, Compare comp); // constexpr in C++14
|
||||
|
||||
template <class T>
|
||||
const T&
|
||||
@ -569,11 +569,11 @@ template<class T, class Compare>
|
||||
|
||||
template<class ForwardIterator>
|
||||
pair<ForwardIterator, ForwardIterator>
|
||||
minmax_element(ForwardIterator first, ForwardIterator last);
|
||||
minmax_element(ForwardIterator first, ForwardIterator last); // constexpr in C++14
|
||||
|
||||
template<class ForwardIterator, class Compare>
|
||||
pair<ForwardIterator, ForwardIterator>
|
||||
minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
|
||||
minmax_element(ForwardIterator first, ForwardIterator last, Compare comp); // constexpr in C++14
|
||||
|
||||
template<class T>
|
||||
pair<const T&, const T&>
|
||||
@ -1672,7 +1672,8 @@ search_n(_ForwardIterator __first, _ForwardIterator __last,
|
||||
_Size __count, const _Tp& __value_, _BinaryPredicate __pred)
|
||||
{
|
||||
return _VSTD::__search_n<typename add_lvalue_reference<_BinaryPredicate>::type>
|
||||
(__first, __last, __count, __value_, __pred, typename iterator_traits<_ForwardIterator>::iterator_category());
|
||||
(__first, __last, __convert_to_integral(__count), __value_, __pred,
|
||||
typename iterator_traits<_ForwardIterator>::iterator_category());
|
||||
}
|
||||
|
||||
template <class _ForwardIterator, class _Size, class _Tp>
|
||||
@ -1681,7 +1682,8 @@ _ForwardIterator
|
||||
search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value_)
|
||||
{
|
||||
typedef typename iterator_traits<_ForwardIterator>::value_type __v;
|
||||
return _VSTD::search_n(__first, __last, __count, __value_, __equal_to<__v, _Tp>());
|
||||
return _VSTD::search_n(__first, __last, __convert_to_integral(__count),
|
||||
__value_, __equal_to<__v, _Tp>());
|
||||
}
|
||||
|
||||
// copy
|
||||
@ -1761,7 +1763,8 @@ typename enable_if
|
||||
__copy(_Tp* __first, _Tp* __last, _Up* __result)
|
||||
{
|
||||
const size_t __n = static_cast<size_t>(__last - __first);
|
||||
_VSTD::memmove(__result, __first, __n * sizeof(_Up));
|
||||
if (__n > 0)
|
||||
_VSTD::memmove(__result, __first, __n * sizeof(_Up));
|
||||
return __result + __n;
|
||||
}
|
||||
|
||||
@ -1796,8 +1799,11 @@ typename enable_if
|
||||
__copy_backward(_Tp* __first, _Tp* __last, _Up* __result)
|
||||
{
|
||||
const size_t __n = static_cast<size_t>(__last - __first);
|
||||
__result -= __n;
|
||||
_VSTD::memmove(__result, __first, __n * sizeof(_Up));
|
||||
if (__n > 0)
|
||||
{
|
||||
__result -= __n;
|
||||
_VSTD::memmove(__result, __first, __n * sizeof(_Up));
|
||||
}
|
||||
return __result;
|
||||
}
|
||||
|
||||
@ -1839,8 +1845,10 @@ typename enable_if
|
||||
!__is_random_access_iterator<_InputIterator>::value,
|
||||
_OutputIterator
|
||||
>::type
|
||||
copy_n(_InputIterator __first, _Size __n, _OutputIterator __result)
|
||||
copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
|
||||
{
|
||||
typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize;
|
||||
_IntegralSize __n = __orig_n;
|
||||
if (__n > 0)
|
||||
{
|
||||
*__result = *__first;
|
||||
@ -1862,8 +1870,10 @@ typename enable_if
|
||||
__is_random_access_iterator<_InputIterator>::value,
|
||||
_OutputIterator
|
||||
>::type
|
||||
copy_n(_InputIterator __first, _Size __n, _OutputIterator __result)
|
||||
copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
|
||||
{
|
||||
typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize;
|
||||
_IntegralSize __n = __orig_n;
|
||||
return _VSTD::copy(__first, __first + __n, __result);
|
||||
}
|
||||
|
||||
@ -1890,7 +1900,8 @@ typename enable_if
|
||||
__move(_Tp* __first, _Tp* __last, _Up* __result)
|
||||
{
|
||||
const size_t __n = static_cast<size_t>(__last - __first);
|
||||
_VSTD::memmove(__result, __first, __n * sizeof(_Up));
|
||||
if (__n > 0)
|
||||
_VSTD::memmove(__result, __first, __n * sizeof(_Up));
|
||||
return __result + __n;
|
||||
}
|
||||
|
||||
@ -1925,8 +1936,11 @@ typename enable_if
|
||||
__move_backward(_Tp* __first, _Tp* __last, _Up* __result)
|
||||
{
|
||||
const size_t __n = static_cast<size_t>(__last - __first);
|
||||
__result -= __n;
|
||||
_VSTD::memmove(__result, __first, __n * sizeof(_Up));
|
||||
if (__n > 0)
|
||||
{
|
||||
__result -= __n;
|
||||
_VSTD::memmove(__result, __first, __n * sizeof(_Up));
|
||||
}
|
||||
return __result;
|
||||
}
|
||||
|
||||
@ -2055,7 +2069,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
_OutputIterator
|
||||
fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_)
|
||||
{
|
||||
return _VSTD::__fill_n(__first, __n, __value_);
|
||||
return _VSTD::__fill_n(__first, __convert_to_integral(__n), __value_);
|
||||
}
|
||||
|
||||
// fill
|
||||
@ -2101,8 +2115,10 @@ generate(_ForwardIterator __first, _ForwardIterator __last, _Generator __gen)
|
||||
template <class _OutputIterator, class _Size, class _Generator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_OutputIterator
|
||||
generate_n(_OutputIterator __first, _Size __n, _Generator __gen)
|
||||
generate_n(_OutputIterator __first, _Size __orig_n, _Generator __gen)
|
||||
{
|
||||
typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize;
|
||||
_IntegralSize __n = __orig_n;
|
||||
for (; __n > 0; ++__first, (void) --__n)
|
||||
*__first = __gen();
|
||||
return __first;
|
||||
@ -2536,7 +2552,7 @@ rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterato
|
||||
template <class _ForwardIterator, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_ForwardIterator
|
||||
__min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
|
||||
min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
|
||||
{
|
||||
if (__first != __last)
|
||||
{
|
||||
@ -2548,20 +2564,12 @@ __min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp
|
||||
return __first;
|
||||
}
|
||||
|
||||
template <class _ForwardIterator, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_ForwardIterator
|
||||
min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
|
||||
{
|
||||
return __min_element(__first, __last, __comp);
|
||||
}
|
||||
|
||||
template <class _ForwardIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_ForwardIterator
|
||||
min_element(_ForwardIterator __first, _ForwardIterator __last)
|
||||
{
|
||||
return __min_element(__first, __last,
|
||||
return _VSTD::min_element(__first, __last,
|
||||
__less<typename iterator_traits<_ForwardIterator>::value_type>());
|
||||
}
|
||||
|
||||
@ -2590,7 +2598,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_Tp
|
||||
min(initializer_list<_Tp> __t, _Compare __comp)
|
||||
{
|
||||
return *__min_element(__t.begin(), __t.end(), __comp);
|
||||
return *_VSTD::min_element(__t.begin(), __t.end(), __comp);
|
||||
}
|
||||
|
||||
template<class _Tp>
|
||||
@ -2598,7 +2606,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_Tp
|
||||
min(initializer_list<_Tp> __t)
|
||||
{
|
||||
return *__min_element(__t.begin(), __t.end(), __less<_Tp>());
|
||||
return *_VSTD::min_element(__t.begin(), __t.end(), __less<_Tp>());
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
@ -2608,7 +2616,7 @@ min(initializer_list<_Tp> __t)
|
||||
template <class _ForwardIterator, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_ForwardIterator
|
||||
__max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
|
||||
max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
|
||||
{
|
||||
if (__first != __last)
|
||||
{
|
||||
@ -2621,20 +2629,12 @@ __max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp
|
||||
}
|
||||
|
||||
|
||||
template <class _ForwardIterator, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_ForwardIterator
|
||||
max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
|
||||
{
|
||||
return __max_element(__first, __last, __comp);
|
||||
}
|
||||
|
||||
template <class _ForwardIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_ForwardIterator
|
||||
max_element(_ForwardIterator __first, _ForwardIterator __last)
|
||||
{
|
||||
return __max_element(__first, __last,
|
||||
return _VSTD::max_element(__first, __last,
|
||||
__less<typename iterator_traits<_ForwardIterator>::value_type>());
|
||||
}
|
||||
|
||||
@ -2663,7 +2663,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_Tp
|
||||
max(initializer_list<_Tp> __t, _Compare __comp)
|
||||
{
|
||||
return *__max_element(__t.begin(), __t.end(), __comp);
|
||||
return *_VSTD::max_element(__t.begin(), __t.end(), __comp);
|
||||
}
|
||||
|
||||
template<class _Tp>
|
||||
@ -2671,7 +2671,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_Tp
|
||||
max(initializer_list<_Tp> __t)
|
||||
{
|
||||
return *__max_element(__t.begin(), __t.end(), __less<_Tp>());
|
||||
return *_VSTD::max_element(__t.begin(), __t.end(), __less<_Tp>());
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
@ -2679,6 +2679,7 @@ max(initializer_list<_Tp> __t)
|
||||
// minmax_element
|
||||
|
||||
template <class _ForwardIterator, class _Compare>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
std::pair<_ForwardIterator, _ForwardIterator>
|
||||
minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
|
||||
{
|
||||
@ -2726,7 +2727,7 @@ minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __com
|
||||
}
|
||||
|
||||
template <class _ForwardIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
std::pair<_ForwardIterator, _ForwardIterator>
|
||||
minmax_element(_ForwardIterator __first, _ForwardIterator __last)
|
||||
{
|
||||
@ -2763,7 +2764,7 @@ minmax(initializer_list<_Tp> __t, _Compare __comp)
|
||||
typedef typename initializer_list<_Tp>::const_iterator _Iter;
|
||||
_Iter __first = __t.begin();
|
||||
_Iter __last = __t.end();
|
||||
std::pair<_Tp, _Tp> __result ( *__first, *__first );
|
||||
std::pair<_Tp, _Tp> __result(*__first, *__first);
|
||||
|
||||
++__first;
|
||||
if (__t.size() % 2 == 0)
|
||||
@ -2778,13 +2779,13 @@ minmax(initializer_list<_Tp> __t, _Compare __comp)
|
||||
while (__first != __last)
|
||||
{
|
||||
_Tp __prev = *__first++;
|
||||
if (__comp(__prev, *__first)) {
|
||||
if (__comp(__prev, __result.first)) __result.first = __prev;
|
||||
if (__comp(__result.second, *__first)) __result.second = *__first;
|
||||
if (__comp(*__first, __prev)) {
|
||||
if ( __comp(*__first, __result.first)) __result.first = *__first;
|
||||
if (!__comp(__prev, __result.second)) __result.second = __prev;
|
||||
}
|
||||
else {
|
||||
if (__comp(*__first, __result.first)) __result.first = *__first;
|
||||
if (__comp(__result.second, __prev)) __result.second = __prev;
|
||||
if ( __comp(__prev, __result.first)) __result.first = __prev;
|
||||
if (!__comp(*__first, __result.second)) __result.second = *__first;
|
||||
}
|
||||
|
||||
__first++;
|
||||
@ -3148,6 +3149,9 @@ is_partitioned(_InputIterator __first, _InputIterator __last, _Predicate __pred)
|
||||
for (; __first != __last; ++__first)
|
||||
if (!__pred(*__first))
|
||||
break;
|
||||
if ( __first == __last )
|
||||
return true;
|
||||
++__first;
|
||||
for (; __first != __last; ++__first)
|
||||
if (__pred(*__first))
|
||||
return false;
|
||||
@ -4357,6 +4361,34 @@ merge(_InputIterator1 __first1, _InputIterator1 __last1,
|
||||
|
||||
// inplace_merge
|
||||
|
||||
template <class _Compare, class _InputIterator1, class _InputIterator2,
|
||||
class _OutputIterator>
|
||||
void __half_inplace_merge(_InputIterator1 __first1, _InputIterator1 __last1,
|
||||
_InputIterator2 __first2, _InputIterator2 __last2,
|
||||
_OutputIterator __result, _Compare __comp)
|
||||
{
|
||||
for (; __first1 != __last1; ++__result)
|
||||
{
|
||||
if (__first2 == __last2)
|
||||
{
|
||||
_VSTD::move(__first1, __last1, __result);
|
||||
return;
|
||||
}
|
||||
|
||||
if (__comp(*__first2, *__first1))
|
||||
{
|
||||
*__result = _VSTD::move(*__first2);
|
||||
++__first2;
|
||||
}
|
||||
else
|
||||
{
|
||||
*__result = _VSTD::move(*__first1);
|
||||
++__first1;
|
||||
}
|
||||
}
|
||||
// __first2 through __last2 are already in the right spot.
|
||||
}
|
||||
|
||||
template <class _Compare, class _BidirectionalIterator>
|
||||
void
|
||||
__buffered_inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last,
|
||||
@ -4365,8 +4397,6 @@ __buffered_inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator
|
||||
typename iterator_traits<_BidirectionalIterator>::value_type* __buff)
|
||||
{
|
||||
typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
|
||||
typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
|
||||
typedef typename iterator_traits<_BidirectionalIterator>::pointer pointer;
|
||||
__destruct_n __d(0);
|
||||
unique_ptr<value_type, __destruct_n&> __h2(__buff, __d);
|
||||
if (__len1 <= __len2)
|
||||
@ -4374,11 +4404,7 @@ __buffered_inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator
|
||||
value_type* __p = __buff;
|
||||
for (_BidirectionalIterator __i = __first; __i != __middle; __d.__incr((value_type*)0), (void) ++__i, ++__p)
|
||||
::new(__p) value_type(_VSTD::move(*__i));
|
||||
__merge<_Compare>(move_iterator<value_type*>(__buff),
|
||||
move_iterator<value_type*>(__p),
|
||||
move_iterator<_BidirectionalIterator>(__middle),
|
||||
move_iterator<_BidirectionalIterator>(__last),
|
||||
__first, __comp);
|
||||
__half_inplace_merge(__buff, __p, __middle, __last, __first, __comp);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4387,9 +4413,9 @@ __buffered_inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator
|
||||
::new(__p) value_type(_VSTD::move(*__i));
|
||||
typedef reverse_iterator<_BidirectionalIterator> _RBi;
|
||||
typedef reverse_iterator<value_type*> _Rv;
|
||||
__merge(move_iterator<_RBi>(_RBi(__middle)), move_iterator<_RBi>(_RBi(__first)),
|
||||
move_iterator<_Rv>(_Rv(__p)), move_iterator<_Rv>(_Rv(__buff)),
|
||||
_RBi(__last), __negate<_Compare>(__comp));
|
||||
__half_inplace_merge(_Rv(__p), _Rv(__buff),
|
||||
_RBi(__middle), _RBi(__first),
|
||||
_RBi(__last), __negate<_Compare>(__comp));
|
||||
}
|
||||
}
|
||||
|
||||
@ -4400,13 +4426,15 @@ __inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle,
|
||||
typename iterator_traits<_BidirectionalIterator>::difference_type __len2,
|
||||
typename iterator_traits<_BidirectionalIterator>::value_type* __buff, ptrdiff_t __buff_size)
|
||||
{
|
||||
typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
|
||||
typedef typename iterator_traits<_BidirectionalIterator>::difference_type difference_type;
|
||||
while (true)
|
||||
{
|
||||
// if __middle == __last, we're done
|
||||
if (__len2 == 0)
|
||||
return;
|
||||
if (__len1 <= __buff_size || __len2 <= __buff_size)
|
||||
return __buffered_inplace_merge<_Compare>
|
||||
(__first, __middle, __last, __comp, __len1, __len2, __buff);
|
||||
// shrink [__first, __middle) as much as possible (with no moves), returning if it shrinks to 0
|
||||
for (; true; ++__first, (void) --__len1)
|
||||
{
|
||||
@ -4415,11 +4443,6 @@ __inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle,
|
||||
if (__comp(*__middle, *__first))
|
||||
break;
|
||||
}
|
||||
if (__len1 <= __buff_size || __len2 <= __buff_size)
|
||||
{
|
||||
__buffered_inplace_merge<_Compare>(__first, __middle, __last, __comp, __len1, __len2, __buff);
|
||||
return;
|
||||
}
|
||||
// __first < __middle < __last
|
||||
// *__first > *__middle
|
||||
// partition [__first, __m1) [__m1, __middle) [__middle, __m2) [__m2, __last) such that
|
||||
@ -4484,12 +4507,6 @@ __inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle,
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
struct __inplace_merge_switch
|
||||
{
|
||||
static const unsigned value = is_trivially_copy_assignable<_Tp>::value;
|
||||
};
|
||||
|
||||
template <class _BidirectionalIterator, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
@ -4501,13 +4518,9 @@ inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _
|
||||
difference_type __len1 = _VSTD::distance(__first, __middle);
|
||||
difference_type __len2 = _VSTD::distance(__middle, __last);
|
||||
difference_type __buf_size = _VSTD::min(__len1, __len2);
|
||||
pair<value_type*, ptrdiff_t> __buf(0, 0);
|
||||
unique_ptr<value_type, __return_temporary_buffer> __h;
|
||||
if (__inplace_merge_switch<value_type>::value && __buf_size > 8)
|
||||
{
|
||||
__buf = _VSTD::get_temporary_buffer<value_type>(__buf_size);
|
||||
__h.reset(__buf.first);
|
||||
}
|
||||
pair<value_type*, ptrdiff_t> __buf = _VSTD::get_temporary_buffer<value_type>(__buf_size);
|
||||
unique_ptr<value_type, __return_temporary_buffer> __h(__buf.first);
|
||||
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
@ -4799,7 +4812,6 @@ void
|
||||
__sift_up(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp,
|
||||
typename iterator_traits<_RandomAccessIterator>::difference_type __len)
|
||||
{
|
||||
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
|
||||
typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
|
||||
if (__len > 1)
|
||||
{
|
||||
|
@ -288,10 +288,6 @@ template <class _Tp, size_t _Size>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_size<array<_Tp, _Size> >
|
||||
: public integral_constant<size_t, _Size> {};
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_size<const array<_Tp, _Size> >
|
||||
: public integral_constant<size_t, _Size> {};
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, array<_Tp, _Size> >
|
||||
{
|
||||
@ -299,13 +295,6 @@ public:
|
||||
typedef _Tp type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, const array<_Tp, _Size> >
|
||||
{
|
||||
public:
|
||||
typedef const _Tp type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_Tp&
|
||||
|
@ -551,26 +551,27 @@ typedef enum memory_order
|
||||
|
||||
#if _GNUC_VER >= 407
|
||||
namespace __gcc_atomic {
|
||||
template <typename T>
|
||||
template <typename _Tp>
|
||||
struct __gcc_atomic_t {
|
||||
__gcc_atomic_t() _NOEXCEPT {}
|
||||
explicit __gcc_atomic_t(T value) _NOEXCEPT : __a_value(value) {}
|
||||
T __a_value;
|
||||
_LIBCPP_CONSTEXPR explicit __gcc_atomic_t(_Tp value) _NOEXCEPT
|
||||
: __a_value(value) {}
|
||||
_Tp __a_value;
|
||||
};
|
||||
#define _Atomic(x) __gcc_atomic::__gcc_atomic_t<x>
|
||||
|
||||
template <typename T> T __create();
|
||||
template <typename _Tp> _Tp __create();
|
||||
|
||||
template <typename __Tp, typename __Td>
|
||||
typename enable_if<sizeof(__Tp()->__a_value = __create<__Td>()), char>::type
|
||||
template <typename _Tp, typename _Td>
|
||||
typename enable_if<sizeof(_Tp()->__a_value = __create<_Td>()), char>::type
|
||||
__test_atomic_assignable(int);
|
||||
template <typename T, typename U>
|
||||
template <typename _Tp, typename _Up>
|
||||
__two __test_atomic_assignable(...);
|
||||
|
||||
template <typename __Tp, typename __Td>
|
||||
template <typename _Tp, typename _Td>
|
||||
struct __can_assign {
|
||||
static const bool value =
|
||||
sizeof(__test_atomic_assignable<__Tp, __Td>(1)) == sizeof(char);
|
||||
sizeof(__test_atomic_assignable<_Tp, _Td>(1)) == sizeof(char);
|
||||
};
|
||||
|
||||
static inline constexpr int __to_gcc_order(memory_order __order) {
|
||||
@ -583,6 +584,16 @@ static inline constexpr int __to_gcc_order(memory_order __order) {
|
||||
__ATOMIC_CONSUME))));
|
||||
}
|
||||
|
||||
static inline constexpr int __to_gcc_failure_order(memory_order __order) {
|
||||
// Avoid switch statement to make this a constexpr.
|
||||
return __order == memory_order_relaxed ? __ATOMIC_RELAXED:
|
||||
(__order == memory_order_acquire ? __ATOMIC_ACQUIRE:
|
||||
(__order == memory_order_release ? __ATOMIC_RELAXED:
|
||||
(__order == memory_order_seq_cst ? __ATOMIC_SEQ_CST:
|
||||
(__order == memory_order_acq_rel ? __ATOMIC_ACQUIRE:
|
||||
__ATOMIC_CONSUME))));
|
||||
}
|
||||
|
||||
} // namespace __gcc_atomic
|
||||
|
||||
template <typename _Tp>
|
||||
@ -623,10 +634,6 @@ static inline void __c11_atomic_signal_fence(memory_order __order) {
|
||||
__atomic_signal_fence(__gcc_atomic::__to_gcc_order(__order));
|
||||
}
|
||||
|
||||
static inline bool __c11_atomic_is_lock_free(size_t __size) {
|
||||
return __atomic_is_lock_free(__size, 0);
|
||||
}
|
||||
|
||||
template <typename _Tp>
|
||||
static inline void __c11_atomic_store(volatile _Atomic(_Tp)* __a, _Tp __val,
|
||||
memory_order __order) {
|
||||
@ -637,8 +644,8 @@ static inline void __c11_atomic_store(volatile _Atomic(_Tp)* __a, _Tp __val,
|
||||
template <typename _Tp>
|
||||
static inline void __c11_atomic_store(_Atomic(_Tp)* __a, _Tp __val,
|
||||
memory_order __order) {
|
||||
return __atomic_store(&__a->__a_value, &__val,
|
||||
__gcc_atomic::__to_gcc_order(__order));
|
||||
__atomic_store(&__a->__a_value, &__val,
|
||||
__gcc_atomic::__to_gcc_order(__order));
|
||||
}
|
||||
|
||||
template <typename _Tp>
|
||||
@ -683,7 +690,7 @@ static inline bool __c11_atomic_compare_exchange_strong(
|
||||
return __atomic_compare_exchange(&__a->__a_value, __expected, &__value,
|
||||
false,
|
||||
__gcc_atomic::__to_gcc_order(__success),
|
||||
__gcc_atomic::__to_gcc_order(__failure));
|
||||
__gcc_atomic::__to_gcc_failure_order(__failure));
|
||||
}
|
||||
|
||||
template <typename _Tp>
|
||||
@ -693,7 +700,7 @@ static inline bool __c11_atomic_compare_exchange_strong(
|
||||
return __atomic_compare_exchange(&__a->__a_value, __expected, &__value,
|
||||
false,
|
||||
__gcc_atomic::__to_gcc_order(__success),
|
||||
__gcc_atomic::__to_gcc_order(__failure));
|
||||
__gcc_atomic::__to_gcc_failure_order(__failure));
|
||||
}
|
||||
|
||||
template <typename _Tp>
|
||||
@ -703,7 +710,7 @@ static inline bool __c11_atomic_compare_exchange_weak(
|
||||
return __atomic_compare_exchange(&__a->__a_value, __expected, &__value,
|
||||
true,
|
||||
__gcc_atomic::__to_gcc_order(__success),
|
||||
__gcc_atomic::__to_gcc_order(__failure));
|
||||
__gcc_atomic::__to_gcc_failure_order(__failure));
|
||||
}
|
||||
|
||||
template <typename _Tp>
|
||||
@ -713,7 +720,7 @@ static inline bool __c11_atomic_compare_exchange_weak(
|
||||
return __atomic_compare_exchange(&__a->__a_value, __expected, &__value,
|
||||
true,
|
||||
__gcc_atomic::__to_gcc_order(__success),
|
||||
__gcc_atomic::__to_gcc_order(__failure));
|
||||
__gcc_atomic::__to_gcc_failure_order(__failure));
|
||||
}
|
||||
|
||||
template <typename _Tp>
|
||||
@ -817,10 +824,16 @@ struct __atomic_base // false
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_lock_free() const volatile _NOEXCEPT
|
||||
{return __c11_atomic_is_lock_free(sizeof(_Tp));}
|
||||
{
|
||||
#if __has_feature(cxx_atomic)
|
||||
return __c11_atomic_is_lock_free(sizeof(_Tp));
|
||||
#else
|
||||
return __atomic_is_lock_free(sizeof(_Tp), 0);
|
||||
#endif
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_lock_free() const _NOEXCEPT
|
||||
{return __c11_atomic_is_lock_free(sizeof(_Tp));}
|
||||
{return static_cast<__atomic_base const volatile*>(this)->is_lock_free();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
|
||||
{__c11_atomic_store(&__a_, __d, __m);}
|
||||
|
@ -39,6 +39,7 @@ int toupper(int c);
|
||||
#include <ctype.h>
|
||||
#if defined(_LIBCPP_MSVCRT)
|
||||
#include "support/win32/support.h"
|
||||
#include "support/win32/locale_win32.h"
|
||||
#endif // _LIBCPP_MSVCRT
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
|
@ -247,7 +247,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using::imaxdiv_t;
|
||||
|
||||
#undef imaxabs
|
||||
using::imaxabs;
|
||||
#undef imaxdiv
|
||||
using::imaxdiv;
|
||||
using::strtoimax;
|
||||
using::strtoumax;
|
||||
|
@ -45,7 +45,9 @@ lconv* localeconv();
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::lconv;
|
||||
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
|
||||
using ::setlocale;
|
||||
#endif
|
||||
using ::localeconv;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
@ -654,7 +654,11 @@ using ::double_t;
|
||||
|
||||
// abs
|
||||
|
||||
#if !defined(_AIX)
|
||||
#if defined(__sun__)
|
||||
using ::abs;
|
||||
#endif
|
||||
|
||||
#if !defined(_AIX) && !defined(__sun__)
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
float
|
||||
abs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);}
|
||||
@ -1109,8 +1113,16 @@ cbrt(_A1 __lcpp_x) _NOEXCEPT {return cbrt((double)__lcpp_x);}
|
||||
using ::copysign;
|
||||
using ::copysignf;
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return copysignf(__lcpp_x, __lcpp_y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return copysignl(__lcpp_x, __lcpp_y);}
|
||||
#if !defined(_VC_CRT_MAJOR_VERSION) || (_VC_CRT_MAJOR_VERSION < 12)
|
||||
inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x,
|
||||
float __lcpp_y) _NOEXCEPT {
|
||||
return copysignf(__lcpp_x, __lcpp_y);
|
||||
}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long double
|
||||
copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {
|
||||
return copysignl(__lcpp_x, __lcpp_y);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class _A1, class _A2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
|
@ -120,36 +120,44 @@ inline _LIBCPP_INLINE_VISIBILITY int __libcpp_putc(int __c, FILE* __stream) {ret
|
||||
inline _LIBCPP_INLINE_VISIBILITY int putc(int __c, FILE* __stream) {return __libcpp_putc(__c, __stream);}
|
||||
#endif // putc
|
||||
|
||||
#ifdef clearerr
|
||||
inline _LIBCPP_INLINE_VISIBILITY void __libcpp_clearerr(FILE* __stream) { return clearerr(__stream); }
|
||||
#undef clearerr
|
||||
inline _LIBCPP_INLINE_VISIBILITY void clearerr(FILE* __stream) { return __libcpp_clearerr(__stream); }
|
||||
#endif // clearerr
|
||||
|
||||
#ifdef feof
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_feof(FILE* __stream) { return feof(__stream); }
|
||||
#undef feof
|
||||
inline _LIBCPP_INLINE_VISIBILITY int feof(FILE* __stream) { return __libcpp_feof(__stream); }
|
||||
#endif // feof
|
||||
|
||||
#ifdef ferror
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_ferror(FILE* __stream) { return ferror(__stream); }
|
||||
#undef ferror
|
||||
inline _LIBCPP_INLINE_VISIBILITY int ferror(FILE* __stream) { return __libcpp_ferror(__stream); }
|
||||
#endif // ferror
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::FILE;
|
||||
using ::fpos_t;
|
||||
using ::size_t;
|
||||
|
||||
using ::remove;
|
||||
using ::rename;
|
||||
using ::tmpfile;
|
||||
using ::tmpnam;
|
||||
using ::fclose;
|
||||
using ::fflush;
|
||||
using ::fopen;
|
||||
using ::freopen;
|
||||
using ::setbuf;
|
||||
using ::setvbuf;
|
||||
using ::fprintf;
|
||||
using ::fscanf;
|
||||
using ::printf;
|
||||
using ::scanf;
|
||||
using ::snprintf;
|
||||
using ::sprintf;
|
||||
using ::sscanf;
|
||||
#ifndef _LIBCPP_MSVCRT
|
||||
using ::vfprintf;
|
||||
using ::vfscanf;
|
||||
using ::vscanf;
|
||||
using ::vsscanf;
|
||||
#endif // _LIBCPP_MSVCRT
|
||||
using ::vprintf;
|
||||
using ::vsnprintf;
|
||||
using ::vsprintf;
|
||||
using ::fgetc;
|
||||
@ -157,13 +165,7 @@ using ::fgets;
|
||||
using ::fputc;
|
||||
using ::fputs;
|
||||
using ::getc;
|
||||
using ::getchar;
|
||||
#if _LIBCPP_STD_VER <= 11
|
||||
using ::gets;
|
||||
#endif
|
||||
using ::putc;
|
||||
using ::putchar;
|
||||
using ::puts;
|
||||
using ::ungetc;
|
||||
using ::fread;
|
||||
using ::fwrite;
|
||||
@ -177,6 +179,31 @@ using ::feof;
|
||||
using ::ferror;
|
||||
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
|
||||
|
||||
#endif // _LIBCPP_CSTDIO
|
||||
|
@ -131,19 +131,27 @@ using ::getenv;
|
||||
using ::system;
|
||||
using ::bsearch;
|
||||
using ::qsort;
|
||||
#undef abs
|
||||
using ::abs;
|
||||
#undef labs
|
||||
using ::labs;
|
||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||
#undef llabs
|
||||
using ::llabs;
|
||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||
#undef div
|
||||
using ::div;
|
||||
#undef ldiv
|
||||
using ::ldiv;
|
||||
#ifndef _LIBCPP_HAS_NO_LONG_LONG
|
||||
#undef lldiv
|
||||
using ::lldiv;
|
||||
#endif // _LIBCPP_HAS_NO_LONG_LONG
|
||||
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
|
||||
using ::mblen;
|
||||
using ::mbtowc;
|
||||
using ::wctomb;
|
||||
#endif
|
||||
using ::mbstowcs;
|
||||
using ::wcstombs;
|
||||
#ifdef _LIBCPP_HAS_QUICK_EXIT
|
||||
|
@ -102,7 +102,9 @@ 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);}
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
|
||||
using ::strtok;
|
||||
#endif
|
||||
using ::memset;
|
||||
using ::strerror;
|
||||
using ::strlen;
|
||||
|
@ -61,10 +61,12 @@ using ::clock;
|
||||
using ::difftime;
|
||||
using ::mktime;
|
||||
using ::time;
|
||||
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
|
||||
using ::asctime;
|
||||
using ::ctime;
|
||||
using ::gmtime;
|
||||
using ::localtime;
|
||||
#endif
|
||||
using ::strftime;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
@ -126,24 +126,18 @@ using ::fwscanf;
|
||||
using ::swprintf;
|
||||
using ::vfwprintf;
|
||||
using ::vswprintf;
|
||||
using ::vwprintf;
|
||||
#ifndef _LIBCPP_MSVCRT
|
||||
using ::swscanf;
|
||||
using ::vfwscanf;
|
||||
using ::vswscanf;
|
||||
using ::vwscanf;
|
||||
#endif // _LIBCPP_MSVCRT
|
||||
using ::wprintf;
|
||||
using ::wscanf;
|
||||
using ::fgetwc;
|
||||
using ::fgetws;
|
||||
using ::fputwc;
|
||||
using ::fputws;
|
||||
using ::fwide;
|
||||
using ::getwc;
|
||||
using ::getwchar;
|
||||
using ::putwc;
|
||||
using ::putwchar;
|
||||
using ::ungetwc;
|
||||
using ::wcstod;
|
||||
#ifndef _LIBCPP_MSVCRT
|
||||
@ -212,6 +206,20 @@ using ::wcrtomb;
|
||||
using ::mbsrtowcs;
|
||||
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
|
||||
|
||||
#endif // _LIBCPP_CWCHAR
|
||||
|
146
include/deque
146
include/deque
@ -117,15 +117,14 @@ public:
|
||||
iterator insert(const_iterator p, value_type&& v);
|
||||
iterator insert(const_iterator p, size_type n, const value_type& v);
|
||||
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);
|
||||
void pop_front();
|
||||
void pop_back();
|
||||
iterator erase(const_iterator p);
|
||||
iterator erase(const_iterator f, const_iterator l);
|
||||
void swap(deque& c)
|
||||
noexcept(!allocator_type::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value);
|
||||
noexcept(allocator_traits<allocator_type>::is_always_equal::value); // C++17
|
||||
void clear() noexcept;
|
||||
};
|
||||
|
||||
@ -168,6 +167,7 @@ template <class T, class Allocator>
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
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,
|
||||
class _DiffType, _DiffType _BlockSize>
|
||||
@ -911,22 +911,10 @@ protected:
|
||||
|
||||
static const difference_type __block_size = sizeof(value_type) < 256 ? 4096 / sizeof(value_type) : 16;
|
||||
|
||||
typedef typename __alloc_traits::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind_alloc<pointer>
|
||||
#else
|
||||
rebind_alloc<pointer>::other
|
||||
#endif
|
||||
__pointer_allocator;
|
||||
typedef typename __rebind_alloc_helper<__alloc_traits, pointer>::type __pointer_allocator;
|
||||
typedef allocator_traits<__pointer_allocator> __map_traits;
|
||||
typedef typename __map_traits::pointer __map_pointer;
|
||||
typedef typename __alloc_traits::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind_alloc<const_pointer>
|
||||
#else
|
||||
rebind_alloc<const_pointer>::other
|
||||
#endif
|
||||
__const_pointer_allocator;
|
||||
typedef typename __rebind_alloc_helper<__alloc_traits, const_pointer>::type __const_pointer_allocator;
|
||||
typedef typename allocator_traits<__const_pointer_allocator>::const_pointer __map_const_pointer;
|
||||
typedef __split_buffer<pointer, __pointer_allocator> __map;
|
||||
|
||||
@ -965,8 +953,12 @@ public:
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void swap(__deque_base& __c)
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value);
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
_NOEXCEPT;
|
||||
#else
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value);
|
||||
#endif
|
||||
protected:
|
||||
void clear() _NOEXCEPT;
|
||||
|
||||
@ -1002,26 +994,6 @@ private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__deque_base&, 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&, allocator_type&, false_type)
|
||||
_NOEXCEPT
|
||||
{}
|
||||
};
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
@ -1145,13 +1117,17 @@ __deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c, const allocator_
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__deque_base<_Tp, _Allocator>::swap(__deque_base& __c)
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
|
||||
__is_nothrow_swappable<allocator_type>::value)
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
_NOEXCEPT
|
||||
#else
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value)
|
||||
#endif
|
||||
{
|
||||
__map_.swap(__c.__map_);
|
||||
_VSTD::swap(__start_, __c.__start_);
|
||||
_VSTD::swap(size(), __c.size());
|
||||
__swap_alloc(__alloc(), __c.__alloc());
|
||||
__swap_allocator(__alloc(), __c.__alloc());
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
@ -1178,7 +1154,7 @@ __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
|
||||
: private __deque_base<_Tp, _Allocator>
|
||||
{
|
||||
@ -1332,11 +1308,15 @@ public:
|
||||
iterator insert(const_iterator __p, const value_type& __v);
|
||||
iterator insert(const_iterator __p, size_type __n, const value_type& __v);
|
||||
template <class _InputIter>
|
||||
iterator insert (const_iterator __p, _InputIter __f, _InputIter __l,
|
||||
iterator insert(const_iterator __p, _InputIter __f, _InputIter __l,
|
||||
typename enable_if<__is_input_iterator<_InputIter>::value
|
||||
&&!__is_bidirectional_iterator<_InputIter>::value>::type* = 0);
|
||||
&&!__is_forward_iterator<_InputIter>::value>::type* = 0);
|
||||
template <class _ForwardIterator>
|
||||
iterator insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l,
|
||||
typename enable_if<__is_forward_iterator<_ForwardIterator>::value
|
||||
&&!__is_bidirectional_iterator<_ForwardIterator>::value>::type* = 0);
|
||||
template <class _BiIter>
|
||||
iterator insert (const_iterator __p, _BiIter __f, _BiIter __l,
|
||||
iterator insert(const_iterator __p, _BiIter __f, _BiIter __l,
|
||||
typename enable_if<__is_bidirectional_iterator<_BiIter>::value>::type* = 0);
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -1349,8 +1329,12 @@ public:
|
||||
iterator erase(const_iterator __f, const_iterator __l);
|
||||
|
||||
void swap(deque& __c)
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
_NOEXCEPT;
|
||||
#else
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value);
|
||||
#endif
|
||||
void clear() _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -2098,7 +2082,7 @@ template <class _InputIter>
|
||||
typename deque<_Tp, _Allocator>::iterator
|
||||
deque<_Tp, _Allocator>::insert(const_iterator __p, _InputIter __f, _InputIter __l,
|
||||
typename enable_if<__is_input_iterator<_InputIter>::value
|
||||
&&!__is_bidirectional_iterator<_InputIter>::value>::type*)
|
||||
&&!__is_forward_iterator<_InputIter>::value>::type*)
|
||||
{
|
||||
__split_buffer<value_type, allocator_type&> __buf(__base::__alloc());
|
||||
__buf.__construct_at_end(__f, __l);
|
||||
@ -2106,6 +2090,20 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _InputIter __f, _InputIter __
|
||||
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 _BiIter>
|
||||
typename deque<_Tp, _Allocator>::iterator
|
||||
@ -2269,19 +2267,14 @@ deque<_Tp, _Allocator>::__add_front_capacity()
|
||||
__split_buffer<pointer, typename __base::__pointer_allocator&>
|
||||
__buf(max<size_type>(2 * __base::__map_.capacity(), 1),
|
||||
0, __base::__map_.__alloc());
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__buf.push_back(__alloc_traits::allocate(__a, __base::__block_size));
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
__alloc_traits::deallocate(__a, __buf.front(), __base::__block_size);
|
||||
throw;
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
|
||||
typedef __allocator_destructor<_Allocator> _Dp;
|
||||
unique_ptr<pointer, _Dp> __hold(
|
||||
__alloc_traits::allocate(__a, __base::__block_size),
|
||||
_Dp(__a, __base::__block_size));
|
||||
__buf.push_back(__hold.get());
|
||||
__hold.release();
|
||||
|
||||
for (typename __base::__map_pointer __i = __base::__map_.begin();
|
||||
__i != __base::__map_.end(); ++__i)
|
||||
__buf.push_back(*__i);
|
||||
@ -2417,19 +2410,14 @@ deque<_Tp, _Allocator>::__add_back_capacity()
|
||||
__buf(max<size_type>(2* __base::__map_.capacity(), 1),
|
||||
__base::__map_.size(),
|
||||
__base::__map_.__alloc());
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__buf.push_back(__alloc_traits::allocate(__a, __base::__block_size));
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
__alloc_traits::deallocate(__a, __buf.back(), __base::__block_size);
|
||||
throw;
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
|
||||
typedef __allocator_destructor<_Allocator> _Dp;
|
||||
unique_ptr<pointer, _Dp> __hold(
|
||||
__alloc_traits::allocate(__a, __base::__block_size),
|
||||
_Dp(__a, __base::__block_size));
|
||||
__buf.push_back(__hold.get());
|
||||
__hold.release();
|
||||
|
||||
for (typename __base::__map_pointer __i = __base::__map_.end();
|
||||
__i != __base::__map_.begin();)
|
||||
__buf.push_front(*--__i);
|
||||
@ -2702,7 +2690,7 @@ deque<_Tp, _Allocator>::erase(const_iterator __f)
|
||||
difference_type __pos = __f - __b;
|
||||
iterator __p = __b + __pos;
|
||||
allocator_type& __a = __base::__alloc();
|
||||
if (__pos < (__base::size() - 1) / 2)
|
||||
if (__pos <= (__base::size() - 1) / 2)
|
||||
{ // erase from front
|
||||
_VSTD::move_backward(__b, __p, _VSTD::next(__p));
|
||||
__alloc_traits::destroy(__a, _VSTD::addressof(*__b));
|
||||
@ -2740,7 +2728,7 @@ deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l)
|
||||
if (__n > 0)
|
||||
{
|
||||
allocator_type& __a = __base::__alloc();
|
||||
if (__pos < (__base::size() - __n) / 2)
|
||||
if (__pos <= (__base::size() - __n) / 2)
|
||||
{ // erase from front
|
||||
iterator __i = _VSTD::move_backward(__b, __p, __p + __n);
|
||||
for (; __b != __i; ++__b)
|
||||
@ -2796,8 +2784,12 @@ template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
deque<_Tp, _Allocator>::swap(deque& __c)
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value)
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
_NOEXCEPT
|
||||
#else
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value)
|
||||
#endif
|
||||
{
|
||||
__base::swap(__c);
|
||||
}
|
||||
|
@ -48,7 +48,8 @@ terminate_handler set_terminate(terminate_handler f ) noexcept;
|
||||
terminate_handler get_terminate() noexcept;
|
||||
[[noreturn]] void terminate() noexcept;
|
||||
|
||||
bool uncaught_exception() noexcept;
|
||||
bool uncaught_exception() noexcept;
|
||||
int uncaught_exceptions() noexcept; // C++17
|
||||
|
||||
typedef unspecified exception_ptr;
|
||||
|
||||
@ -115,6 +116,7 @@ _LIBCPP_FUNC_VIS terminate_handler get_terminate() _NOEXCEPT;
|
||||
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void terminate() _NOEXCEPT;
|
||||
|
||||
_LIBCPP_FUNC_VIS bool uncaught_exception() _NOEXCEPT;
|
||||
_LIBCPP_FUNC_VIS int uncaught_exceptions() _NOEXCEPT;
|
||||
|
||||
class _LIBCPP_TYPE_VIS exception_ptr;
|
||||
|
||||
@ -193,6 +195,7 @@ void
|
||||
throw_with_nested(_Tp&& __t, typename enable_if<
|
||||
is_class<typename remove_reference<_Tp>::type>::value &&
|
||||
!is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
|
||||
&& !__libcpp_is_final<typename remove_reference<_Tp>::type>::value
|
||||
>::type* = 0)
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested (_Tp& __t, typename enable_if<
|
||||
@ -212,6 +215,7 @@ void
|
||||
throw_with_nested(_Tp&& __t, typename enable_if<
|
||||
!is_class<typename remove_reference<_Tp>::type>::value ||
|
||||
is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
|
||||
|| __libcpp_is_final<typename remove_reference<_Tp>::type>::value
|
||||
>::type* = 0)
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested (_Tp& __t, typename enable_if<
|
||||
|
@ -13,6 +13,10 @@
|
||||
|
||||
#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
|
||||
@ -21,4 +25,8 @@
|
||||
#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
|
||||
|
114
include/experimental/algorithm
Normal file
114
include/experimental/algorithm
Normal file
@ -0,0 +1,114 @@
|
||||
// -*- 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 _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 */
|
59
include/experimental/chrono
Normal file
59
include/experimental/chrono
Normal file
@ -0,0 +1,59 @@
|
||||
// -*- 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 */
|
@ -104,6 +104,8 @@ public:
|
||||
#include <new>
|
||||
#include <algorithm>
|
||||
|
||||
#include <__undef___deallocate>
|
||||
|
||||
#if defined(_LIBCPP_NO_EXCEPTIONS)
|
||||
#include <cassert>
|
||||
#endif
|
||||
|
77
include/experimental/ratio
Normal file
77
include/experimental/ratio
Normal file
@ -0,0 +1,77 @@
|
||||
// -*- 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
|
@ -280,11 +280,8 @@ _LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||
const_reference at(size_type __pos) const
|
||||
{
|
||||
return __pos >= size()
|
||||
? throw out_of_range("string_view::at")
|
||||
? (throw out_of_range("string_view::at"), __data[0])
|
||||
: __data[__pos];
|
||||
// if (__pos >= size())
|
||||
// throw out_of_range("string_view::at");
|
||||
// return __data[__pos];
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
@ -313,7 +310,7 @@ _LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||
_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()");
|
||||
_LIBCPP_ASSERT(__n <= size(), "remove_prefix() can't remove more than size()");
|
||||
__data += __n;
|
||||
__size -= __n;
|
||||
}
|
||||
@ -321,7 +318,7 @@ _LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||
_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()");
|
||||
_LIBCPP_ASSERT(__n <= size(), "remove_suffix() can't remove more than size()");
|
||||
__size -= __n;
|
||||
}
|
||||
|
||||
|
63
include/experimental/system_error
Normal file
63
include/experimental/system_error
Normal file
@ -0,0 +1,63 @@
|
||||
// -*- 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 */
|
81
include/experimental/tuple
Normal file
81
include/experimental/tuple
Normal file
@ -0,0 +1,81 @@
|
||||
// -*- 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 */
|
@ -184,9 +184,13 @@ inline namespace fundamentals_v1 {
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||
|
||||
#if __has_feature(cxx_variable_templates)
|
||||
#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
||||
|
||||
// C++14 20.10.4.1, primary type categories
|
||||
|
||||
@ -393,7 +397,7 @@ template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_base_of_v
|
||||
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_convertible_v
|
||||
= is_convertible<_Tp, _Up>::value;
|
||||
|
||||
#endif /* __has_feature(cxx_variable_templates) */
|
||||
#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */
|
||||
|
||||
// 3.3.2, Other type transformations
|
||||
/*
|
||||
|
@ -31,9 +31,12 @@ inline namespace fundamentals_v1 {
|
||||
|
||||
*/
|
||||
|
||||
# include <experimental/__config>
|
||||
#include <experimental/__config>
|
||||
#include <utility>
|
||||
|
||||
# include <utility>
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||
|
||||
|
@ -203,6 +203,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
|
||||
#include <__hash_table>
|
||||
#include <functional>
|
||||
#include <stdexcept>
|
||||
#include <type_traits>
|
||||
#include <ext/__hash>
|
||||
|
||||
#if __DEPRECATED
|
||||
@ -213,16 +214,16 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
namespace __gnu_cxx {
|
||||
|
||||
using namespace std;
|
||||
|
||||
template <class _Tp, class _Hash, bool = is_empty<_Hash>::value
|
||||
#if __has_feature(is_final)
|
||||
&& !__is_final(_Hash)
|
||||
#endif
|
||||
template <class _Tp, class _Hash,
|
||||
bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value
|
||||
>
|
||||
class __hash_map_hasher
|
||||
: private _Hash
|
||||
@ -255,10 +256,8 @@ public:
|
||||
{return __hash_(__x);}
|
||||
};
|
||||
|
||||
template <class _Tp, class _Pred, bool = is_empty<_Pred>::value
|
||||
#if __has_feature(is_final)
|
||||
&& !__is_final(_Pred)
|
||||
#endif
|
||||
template <class _Tp, class _Pred,
|
||||
bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value
|
||||
>
|
||||
class __hash_map_equal
|
||||
: private _Pred
|
||||
@ -493,13 +492,7 @@ private:
|
||||
typedef pair<key_type, mapped_type> __value_type;
|
||||
typedef __hash_map_hasher<__value_type, hasher> __hasher;
|
||||
typedef __hash_map_equal<__value_type, key_equal> __key_equal;
|
||||
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 typename __rebind_alloc_helper<allocator_traits<allocator_type>, __value_type>::type __allocator_type;
|
||||
|
||||
typedef __hash_table<__value_type, __hasher,
|
||||
__key_equal, __allocator_type> __table;
|
||||
@ -772,13 +765,7 @@ private:
|
||||
typedef pair<key_type, mapped_type> __value_type;
|
||||
typedef __hash_map_hasher<__value_type, hasher> __hasher;
|
||||
typedef __hash_map_equal<__value_type, key_equal> __key_equal;
|
||||
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 typename __rebind_alloc_helper<allocator_traits<allocator_type>, __value_type>::type __allocator_type;
|
||||
|
||||
typedef __hash_table<__value_type, __hasher,
|
||||
__key_equal, __allocator_type> __table;
|
||||
|
@ -107,8 +107,7 @@ public:
|
||||
iterator erase_after(const_iterator first, const_iterator last);
|
||||
|
||||
void swap(forward_list& x)
|
||||
noexcept(!allocator_type::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value);
|
||||
noexcept(allocator_traits<allocator_type>::is_always_equal::value); // C++17
|
||||
|
||||
void resize(size_type n);
|
||||
void resize(size_type n, const value_type& v);
|
||||
@ -218,7 +217,7 @@ struct __forward_list_node
|
||||
value_type __value_;
|
||||
};
|
||||
|
||||
template<class _Tp, class _Alloc> class _LIBCPP_TYPE_VIS_ONLY forward_list;
|
||||
template <class _Tp, class _Alloc = allocator<_Tp> > class _LIBCPP_TYPE_VIS_ONLY forward_list;
|
||||
template<class _NodeConstPtr> class _LIBCPP_TYPE_VIS_ONLY __forward_list_const_iterator;
|
||||
|
||||
template <class _NodePtr>
|
||||
@ -365,24 +364,12 @@ protected:
|
||||
typedef typename allocator_traits<allocator_type>::void_pointer void_pointer;
|
||||
typedef __forward_list_node<value_type, void_pointer> __node;
|
||||
typedef typename __begin_node_of<value_type, void_pointer>::type __begin_node;
|
||||
typedef typename allocator_traits<allocator_type>::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind_alloc<__node>
|
||||
#else
|
||||
rebind_alloc<__node>::other
|
||||
#endif
|
||||
__node_allocator;
|
||||
typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>, __node>::type __node_allocator;
|
||||
typedef allocator_traits<__node_allocator> __node_traits;
|
||||
typedef typename __node_traits::pointer __node_pointer;
|
||||
typedef typename __node_traits::pointer __node_const_pointer;
|
||||
|
||||
typedef typename allocator_traits<allocator_type>::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind_alloc<__begin_node>
|
||||
#else
|
||||
rebind_alloc<__begin_node>::other
|
||||
#endif
|
||||
__begin_node_allocator;
|
||||
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_;
|
||||
@ -443,8 +430,12 @@ protected:
|
||||
|
||||
public:
|
||||
void swap(__forward_list_base& __x)
|
||||
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value);
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
_NOEXCEPT;
|
||||
#else
|
||||
_NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value);
|
||||
#endif
|
||||
protected:
|
||||
void clear() _NOEXCEPT;
|
||||
|
||||
@ -466,26 +457,6 @@ private:
|
||||
void __move_assign_alloc(__forward_list_base& __x, true_type)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
|
||||
{__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
|
||||
@ -524,10 +495,15 @@ template <class _Tp, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
|
||||
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value)
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
_NOEXCEPT
|
||||
#else
|
||||
_NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value)
|
||||
#endif
|
||||
{
|
||||
__swap_alloc(__alloc(), __x.__alloc());
|
||||
__swap_allocator(__alloc(), __x.__alloc(),
|
||||
integral_constant<bool, __node_traits::propagate_on_container_swap::value>());
|
||||
using _VSTD::swap;
|
||||
swap(__before_begin()->__next_, __x.__before_begin()->__next_);
|
||||
}
|
||||
@ -547,7 +523,7 @@ __forward_list_base<_Tp, _Alloc>::clear() _NOEXCEPT
|
||||
__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
|
||||
: private __forward_list_base<_Tp, _Alloc>
|
||||
{
|
||||
@ -715,8 +691,12 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(forward_list& __x)
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
_NOEXCEPT
|
||||
#else
|
||||
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value)
|
||||
#endif
|
||||
{base::swap(__x);}
|
||||
|
||||
void resize(size_type __n);
|
||||
|
@ -206,8 +206,10 @@ public:
|
||||
|
||||
// 27.9.1.4 Members:
|
||||
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 string& __s, ios_base::openmode __mode);
|
||||
#endif
|
||||
basic_filebuf* close();
|
||||
|
||||
protected:
|
||||
@ -463,6 +465,7 @@ basic_filebuf<_CharT, _Traits>::is_open() const
|
||||
return __file_ != 0;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||
template <class _CharT, class _Traits>
|
||||
basic_filebuf<_CharT, _Traits>*
|
||||
basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
|
||||
@ -550,6 +553,7 @@ basic_filebuf<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mod
|
||||
{
|
||||
return open(__s.c_str(), __mode);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_filebuf<_CharT, _Traits>*
|
||||
@ -807,7 +811,7 @@ basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
|
||||
default:
|
||||
return pos_type(off_type(-1));
|
||||
}
|
||||
#if _WIN32
|
||||
#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_);
|
||||
@ -826,7 +830,7 @@ basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode)
|
||||
{
|
||||
if (__file_ == 0 || sync())
|
||||
return pos_type(off_type(-1));
|
||||
#if _WIN32
|
||||
#if defined(_WIN32) || defined(_NEWLIB_VERSION)
|
||||
if (fseek(__file_, __sp, SEEK_SET))
|
||||
return pos_type(off_type(-1));
|
||||
#else
|
||||
@ -891,7 +895,7 @@ basic_filebuf<_CharT, _Traits>::sync()
|
||||
}
|
||||
}
|
||||
}
|
||||
#if _WIN32
|
||||
#if defined(_WIN32) || defined(_NEWLIB_VERSION)
|
||||
if (fseek(__file_, -__c, SEEK_CUR))
|
||||
return -1;
|
||||
#else
|
||||
@ -1005,8 +1009,10 @@ public:
|
||||
typedef typename traits_type::off_type off_type;
|
||||
|
||||
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 string& __s, ios_base::openmode __mode = ios_base::in);
|
||||
#endif
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_ifstream(basic_ifstream&& __rhs);
|
||||
#endif
|
||||
@ -1018,8 +1024,10 @@ public:
|
||||
|
||||
basic_filebuf<char_type, traits_type>* rdbuf() 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 string& __s, ios_base::openmode __mode = ios_base::in);
|
||||
#endif
|
||||
void close();
|
||||
|
||||
private:
|
||||
@ -1033,6 +1041,7 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream()
|
||||
{
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_ifstream<_CharT, _Traits>::basic_ifstream(const char* __s, ios_base::openmode __mode)
|
||||
@ -1050,6 +1059,7 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::ope
|
||||
if (__sb_.open(__s, __mode | ios_base::in) == 0)
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
@ -1107,6 +1117,7 @@ basic_ifstream<_CharT, _Traits>::is_open() const
|
||||
return __sb_.is_open();
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||
template <class _CharT, class _Traits>
|
||||
void
|
||||
basic_ifstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
|
||||
@ -1126,6 +1137,7 @@ basic_ifstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mo
|
||||
else
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@ -1163,8 +1175,10 @@ public:
|
||||
|
||||
basic_filebuf<char_type, traits_type>* rdbuf() 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 string& __s, ios_base::openmode __mode = ios_base::out);
|
||||
#endif
|
||||
void close();
|
||||
|
||||
private:
|
||||
@ -1178,6 +1192,7 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream()
|
||||
{
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_ofstream<_CharT, _Traits>::basic_ofstream(const char* __s, ios_base::openmode __mode)
|
||||
@ -1195,6 +1210,7 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::ope
|
||||
if (__sb_.open(__s, __mode | ios_base::out) == 0)
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
@ -1252,6 +1268,7 @@ basic_ofstream<_CharT, _Traits>::is_open() const
|
||||
return __sb_.is_open();
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||
template <class _CharT, class _Traits>
|
||||
void
|
||||
basic_ofstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
|
||||
@ -1271,6 +1288,7 @@ basic_ofstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mo
|
||||
else
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@ -1295,8 +1313,10 @@ public:
|
||||
typedef typename traits_type::off_type off_type;
|
||||
|
||||
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 string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||
#endif
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_fstream(basic_fstream&& __rhs);
|
||||
#endif
|
||||
@ -1308,8 +1328,10 @@ public:
|
||||
|
||||
basic_filebuf<char_type, traits_type>* rdbuf() 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 string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||
#endif
|
||||
void close();
|
||||
|
||||
private:
|
||||
@ -1323,6 +1345,7 @@ basic_fstream<_CharT, _Traits>::basic_fstream()
|
||||
{
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_fstream<_CharT, _Traits>::basic_fstream(const char* __s, ios_base::openmode __mode)
|
||||
@ -1340,6 +1363,7 @@ basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openm
|
||||
if (__sb_.open(__s, __mode) == 0)
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
@ -1397,6 +1421,7 @@ basic_fstream<_CharT, _Traits>::is_open() const
|
||||
return __sb_.is_open();
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||
template <class _CharT, class _Traits>
|
||||
void
|
||||
basic_fstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
|
||||
@ -1416,6 +1441,7 @@ basic_fstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mod
|
||||
else
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
|
@ -504,7 +504,9 @@ struct _LIBCPP_TYPE_VIS_ONLY plus<void>
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
auto operator()(_T1&& __t, _T2&& __u) const
|
||||
{ return _VSTD::forward<_T1>(__t) + _VSTD::forward<_T2>(__u); }
|
||||
_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
|
||||
@ -529,7 +531,9 @@ struct _LIBCPP_TYPE_VIS_ONLY minus<void>
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
auto operator()(_T1&& __t, _T2&& __u) const
|
||||
{ return _VSTD::forward<_T1>(__t) - _VSTD::forward<_T2>(__u); }
|
||||
_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
|
||||
@ -554,7 +558,9 @@ struct _LIBCPP_TYPE_VIS_ONLY multiplies<void>
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
auto operator()(_T1&& __t, _T2&& __u) const
|
||||
{ return _VSTD::forward<_T1>(__t) * _VSTD::forward<_T2>(__u); }
|
||||
_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
|
||||
@ -579,7 +585,9 @@ struct _LIBCPP_TYPE_VIS_ONLY divides<void>
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
auto operator()(_T1&& __t, _T2&& __u) const
|
||||
{ return _VSTD::forward<_T1>(__t) / _VSTD::forward<_T2>(__u); }
|
||||
_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
|
||||
@ -604,7 +612,9 @@ struct _LIBCPP_TYPE_VIS_ONLY modulus<void>
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
auto operator()(_T1&& __t, _T2&& __u) const
|
||||
{ return _VSTD::forward<_T1>(__t) % _VSTD::forward<_T2>(__u); }
|
||||
_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
|
||||
@ -629,7 +639,9 @@ struct _LIBCPP_TYPE_VIS_ONLY negate<void>
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
auto operator()(_Tp&& __x) const
|
||||
{ return -_VSTD::forward<_Tp>(__x); }
|
||||
_NOEXCEPT_(noexcept(- _VSTD::forward<_Tp>(__x)))
|
||||
-> decltype (- _VSTD::forward<_Tp>(__x))
|
||||
{ return - _VSTD::forward<_Tp>(__x); }
|
||||
typedef void is_transparent;
|
||||
};
|
||||
#endif
|
||||
@ -654,7 +666,9 @@ struct _LIBCPP_TYPE_VIS_ONLY equal_to<void>
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
auto operator()(_T1&& __t, _T2&& __u) const
|
||||
{ return _VSTD::forward<_T1>(__t) == _VSTD::forward<_T2>(__u); }
|
||||
_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
|
||||
@ -679,7 +693,9 @@ struct _LIBCPP_TYPE_VIS_ONLY not_equal_to<void>
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
auto operator()(_T1&& __t, _T2&& __u) const
|
||||
{ return _VSTD::forward<_T1>(__t) != _VSTD::forward<_T2>(__u); }
|
||||
_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
|
||||
@ -704,7 +720,9 @@ struct _LIBCPP_TYPE_VIS_ONLY greater<void>
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
auto operator()(_T1&& __t, _T2&& __u) const
|
||||
{ return _VSTD::forward<_T1>(__t) > _VSTD::forward<_T2>(__u); }
|
||||
_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
|
||||
@ -731,7 +749,9 @@ struct _LIBCPP_TYPE_VIS_ONLY greater_equal<void>
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
auto operator()(_T1&& __t, _T2&& __u) const
|
||||
{ return _VSTD::forward<_T1>(__t) >= _VSTD::forward<_T2>(__u); }
|
||||
_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
|
||||
@ -756,7 +776,9 @@ struct _LIBCPP_TYPE_VIS_ONLY less_equal<void>
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
auto operator()(_T1&& __t, _T2&& __u) const
|
||||
{ return _VSTD::forward<_T1>(__t) <= _VSTD::forward<_T2>(__u); }
|
||||
_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
|
||||
@ -781,7 +803,9 @@ struct _LIBCPP_TYPE_VIS_ONLY logical_and<void>
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
auto operator()(_T1&& __t, _T2&& __u) const
|
||||
{ return _VSTD::forward<_T1>(__t) && _VSTD::forward<_T2>(__u); }
|
||||
_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
|
||||
@ -806,7 +830,9 @@ struct _LIBCPP_TYPE_VIS_ONLY logical_or<void>
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
auto operator()(_T1&& __t, _T2&& __u) const
|
||||
{ return _VSTD::forward<_T1>(__t) || _VSTD::forward<_T2>(__u); }
|
||||
_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
|
||||
@ -831,7 +857,9 @@ struct _LIBCPP_TYPE_VIS_ONLY logical_not<void>
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
auto operator()(_Tp&& __x) const
|
||||
{ return !_VSTD::forward<_Tp>(__x); }
|
||||
_NOEXCEPT_(noexcept(!_VSTD::forward<_Tp>(__x)))
|
||||
-> decltype (!_VSTD::forward<_Tp>(__x))
|
||||
{ return !_VSTD::forward<_Tp>(__x); }
|
||||
typedef void is_transparent;
|
||||
};
|
||||
#endif
|
||||
@ -856,7 +884,9 @@ struct _LIBCPP_TYPE_VIS_ONLY bit_and<void>
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
auto operator()(_T1&& __t, _T2&& __u) const
|
||||
{ return _VSTD::forward<_T1>(__t) & _VSTD::forward<_T2>(__u); }
|
||||
_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
|
||||
@ -881,7 +911,9 @@ struct _LIBCPP_TYPE_VIS_ONLY bit_or<void>
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
auto operator()(_T1&& __t, _T2&& __u) const
|
||||
{ return _VSTD::forward<_T1>(__t) | _VSTD::forward<_T2>(__u); }
|
||||
_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
|
||||
@ -906,7 +938,9 @@ struct _LIBCPP_TYPE_VIS_ONLY bit_xor<void>
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
auto operator()(_T1&& __t, _T2&& __u) const
|
||||
{ return _VSTD::forward<_T1>(__t) ^ _VSTD::forward<_T2>(__u); }
|
||||
_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
|
||||
@ -927,7 +961,9 @@ struct _LIBCPP_TYPE_VIS_ONLY bit_not<void>
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
auto operator()(_Tp&& __x) const
|
||||
{ return ~_VSTD::forward<_Tp>(__x); }
|
||||
_NOEXCEPT_(noexcept(~_VSTD::forward<_Tp>(__x)))
|
||||
-> decltype (~_VSTD::forward<_Tp>(__x))
|
||||
{ return ~_VSTD::forward<_Tp>(__x); }
|
||||
typedef void is_transparent;
|
||||
};
|
||||
#endif
|
||||
@ -1331,7 +1367,8 @@ template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
|
||||
__base<_Rp(_ArgTypes...)>*
|
||||
__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone() const
|
||||
{
|
||||
typedef typename _Alloc::template rebind<__func>::other _Ap;
|
||||
typedef allocator_traits<_Alloc> __alloc_traits;
|
||||
typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;
|
||||
_Ap __a(__f_.second());
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
@ -1357,7 +1394,8 @@ template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
|
||||
void
|
||||
__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate() _NOEXCEPT
|
||||
{
|
||||
typedef typename _Alloc::template rebind<__func>::other _Ap;
|
||||
typedef allocator_traits<_Alloc> __alloc_traits;
|
||||
typedef typename __rebind_alloc_helper<__alloc_traits, __func>::type _Ap;
|
||||
_Ap __a(__f_.second());
|
||||
__f_.~__compressed_pair<_Fp, _Alloc>();
|
||||
__a.deallocate(this, 1);
|
||||
@ -1367,7 +1405,8 @@ template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
|
||||
_Rp
|
||||
__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&& ... __arg)
|
||||
{
|
||||
return __invoke(__f_.first(), _VSTD::forward<_ArgTypes>(__arg)...);
|
||||
typedef __invoke_void_return_wrapper<_Rp> _Invoker;
|
||||
return _Invoker::__call(__f_.first(), _VSTD::forward<_ArgTypes>(__arg)...);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_NO_RTTI
|
||||
@ -1429,7 +1468,7 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_ArgTypes...)>
|
||||
template <class _Fp>
|
||||
struct __callable<_Fp, true>
|
||||
{
|
||||
static const bool value =
|
||||
static const bool value = is_same<void, _Rp>::value ||
|
||||
is_convertible<typename __invoke_of<_Fp&, _ArgTypes...>::type,
|
||||
_Rp>::value;
|
||||
};
|
||||
@ -1617,13 +1656,7 @@ function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a0, _Fp _
|
||||
if (__not_null(__f))
|
||||
{
|
||||
typedef __function::__func<_Fp, _Alloc, _Rp(_ArgTypes...)> _FF;
|
||||
typedef typename __alloc_traits::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind_alloc<_FF>
|
||||
#else
|
||||
rebind_alloc<_FF>::other
|
||||
#endif
|
||||
_Ap;
|
||||
typedef typename __rebind_alloc_helper<__alloc_traits, _FF>::type _Ap;
|
||||
_Ap __a(__a0);
|
||||
if (sizeof(_FF) <= sizeof(__buf_) &&
|
||||
is_nothrow_copy_constructible<_Fp>::value && is_nothrow_copy_constructible<_Ap>::value)
|
||||
@ -1963,27 +1996,27 @@ struct __mu_return
|
||||
};
|
||||
|
||||
template <class _Fp, class _BoundArgs, class _TupleUj>
|
||||
struct _is_valid_bind_return
|
||||
struct __is_valid_bind_return
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template <class _Fp, class ..._BoundArgs, class _TupleUj>
|
||||
struct _is_valid_bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj>
|
||||
struct __is_valid_bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj>
|
||||
{
|
||||
static const bool value = __invokable<_Fp,
|
||||
typename __mu_return<_BoundArgs, _TupleUj>::type...>::value;
|
||||
};
|
||||
|
||||
template <class _Fp, class ..._BoundArgs, class _TupleUj>
|
||||
struct _is_valid_bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj>
|
||||
struct __is_valid_bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj>
|
||||
{
|
||||
static const bool value = __invokable<_Fp,
|
||||
typename __mu_return<const _BoundArgs, _TupleUj>::type...>::value;
|
||||
};
|
||||
|
||||
template <class _Fp, class _BoundArgs, class _TupleUj,
|
||||
bool = _is_valid_bind_return<_Fp, _BoundArgs, _TupleUj>::value>
|
||||
bool = __is_valid_bind_return<_Fp, _BoundArgs, _TupleUj>::value>
|
||||
struct __bind_return;
|
||||
|
||||
template <class _Fp, class ..._BoundArgs, class _TupleUj>
|
||||
@ -2153,12 +2186,13 @@ public:
|
||||
typename enable_if
|
||||
<
|
||||
is_convertible<typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type,
|
||||
result_type>::value,
|
||||
result_type>::value || is_void<_Rp>::value,
|
||||
result_type
|
||||
>::type
|
||||
operator()(_Args&& ...__args)
|
||||
{
|
||||
return base::operator()(_VSTD::forward<_Args>(__args)...);
|
||||
typedef __invoke_void_return_wrapper<_Rp> _Invoker;
|
||||
return _Invoker::__call(static_cast<base&>(*this), _VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class ..._Args>
|
||||
@ -2166,12 +2200,13 @@ public:
|
||||
typename enable_if
|
||||
<
|
||||
is_convertible<typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type,
|
||||
result_type>::value,
|
||||
result_type>::value || is_void<_Rp>::value,
|
||||
result_type
|
||||
>::type
|
||||
operator()(_Args&& ...__args) const
|
||||
{
|
||||
return base::operator()(_VSTD::forward<_Args>(__args)...);
|
||||
typedef __invoke_void_return_wrapper<_Rp> _Invoker;
|
||||
return _Invoker::__call(static_cast<base const&>(*this), _VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
};
|
||||
|
||||
@ -2412,6 +2447,15 @@ struct _LIBCPP_TYPE_VIS_ONLY hash
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
template <class _Fn, class ..._Args>
|
||||
result_of_t<_Fn&&(_Args&&...)>
|
||||
invoke(_Fn&& __f, _Args&&... __args) {
|
||||
return __invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
#endif
|
||||
|
||||
// struct hash<T*> in <memory>
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
@ -329,7 +329,7 @@ public:
|
||||
template <class F>
|
||||
explicit packaged_task(F&& f);
|
||||
template <class F, class Allocator>
|
||||
explicit packaged_task(allocator_arg_t, const Allocator& a, F&& f);
|
||||
packaged_task(allocator_arg_t, const Allocator& a, F&& f);
|
||||
~packaged_task();
|
||||
|
||||
// no copy
|
||||
@ -651,7 +651,6 @@ __assoc_state<_Rp>::set_value(_Arg& __arg)
|
||||
#endif
|
||||
::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg));
|
||||
this->__state_ |= base::__constructed | base::ready;
|
||||
__lk.unlock();
|
||||
__cv_.notify_all();
|
||||
}
|
||||
|
||||
@ -672,7 +671,6 @@ __assoc_state<_Rp>::set_value_at_thread_exit(_Arg& __arg)
|
||||
::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg));
|
||||
this->__state_ |= base::__constructed;
|
||||
__thread_local_data()->__make_ready_at_thread_exit(this);
|
||||
__lk.unlock();
|
||||
}
|
||||
|
||||
template <class _Rp>
|
||||
@ -733,7 +731,6 @@ __assoc_state<_Rp&>::set_value(_Rp& __arg)
|
||||
#endif
|
||||
__value_ = _VSTD::addressof(__arg);
|
||||
this->__state_ |= base::__constructed | base::ready;
|
||||
__lk.unlock();
|
||||
__cv_.notify_all();
|
||||
}
|
||||
|
||||
@ -749,7 +746,6 @@ __assoc_state<_Rp&>::set_value_at_thread_exit(_Rp& __arg)
|
||||
__value_ = _VSTD::addressof(__arg);
|
||||
this->__state_ |= base::__constructed;
|
||||
__thread_local_data()->__make_ready_at_thread_exit(this);
|
||||
__lk.unlock();
|
||||
}
|
||||
|
||||
template <class _Rp>
|
||||
@ -783,10 +779,10 @@ __assoc_state_alloc<_Rp, _Alloc>::__on_zero_shared() _NOEXCEPT
|
||||
{
|
||||
if (this->__state_ & base::__constructed)
|
||||
reinterpret_cast<_Rp*>(_VSTD::addressof(this->__value_))->~_Rp();
|
||||
typedef typename __allocator_traits_rebind<_Alloc, __assoc_state_alloc>::type _A;
|
||||
typedef allocator_traits<_A> _ATraits;
|
||||
typedef typename __allocator_traits_rebind<_Alloc, __assoc_state_alloc>::type _Al;
|
||||
typedef allocator_traits<_Al> _ATraits;
|
||||
typedef pointer_traits<typename _ATraits::pointer> _PTraits;
|
||||
_A __a(__alloc_);
|
||||
_Al __a(__alloc_);
|
||||
this->~__assoc_state_alloc();
|
||||
__a.deallocate(_PTraits::pointer_to(*this), 1);
|
||||
}
|
||||
@ -809,10 +805,10 @@ template <class _Rp, class _Alloc>
|
||||
void
|
||||
__assoc_state_alloc<_Rp&, _Alloc>::__on_zero_shared() _NOEXCEPT
|
||||
{
|
||||
typedef typename __allocator_traits_rebind<_Alloc, __assoc_state_alloc>::type _A;
|
||||
typedef allocator_traits<_A> _ATraits;
|
||||
typedef typename __allocator_traits_rebind<_Alloc, __assoc_state_alloc>::type _Al;
|
||||
typedef allocator_traits<_Al> _ATraits;
|
||||
typedef pointer_traits<typename _ATraits::pointer> _PTraits;
|
||||
_A __a(__alloc_);
|
||||
_Al __a(__alloc_);
|
||||
this->~__assoc_state_alloc();
|
||||
__a.deallocate(_PTraits::pointer_to(*this), 1);
|
||||
}
|
||||
@ -835,10 +831,10 @@ template <class _Alloc>
|
||||
void
|
||||
__assoc_sub_state_alloc<_Alloc>::__on_zero_shared() _NOEXCEPT
|
||||
{
|
||||
typedef typename __allocator_traits_rebind<_Alloc, __assoc_sub_state_alloc>::type _A;
|
||||
typedef allocator_traits<_A> _ATraits;
|
||||
typedef typename __allocator_traits_rebind<_Alloc, __assoc_sub_state_alloc>::type _Al;
|
||||
typedef allocator_traits<_Al> _ATraits;
|
||||
typedef pointer_traits<typename _ATraits::pointer> _PTraits;
|
||||
_A __a(__alloc_);
|
||||
_Al __a(__alloc_);
|
||||
this->~__assoc_sub_state_alloc();
|
||||
__a.deallocate(_PTraits::pointer_to(*this), 1);
|
||||
}
|
||||
@ -2046,7 +2042,7 @@ public:
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
|
||||
packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
|
||||
: __f_(allocator_arg, __a, _VSTD::forward<_Fp>(__f)),
|
||||
__p_(allocator_arg, __a) {}
|
||||
// ~packaged_task() = default;
|
||||
@ -2177,7 +2173,7 @@ public:
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
|
||||
packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
|
||||
: __f_(allocator_arg, __a, _VSTD::forward<_Fp>(__f)),
|
||||
__p_(allocator_arg, __a) {}
|
||||
// ~packaged_task() = default;
|
||||
|
@ -180,7 +180,12 @@ typedef fpos<mbstate_t> u16streampos;
|
||||
typedef fpos<mbstate_t> u32streampos;
|
||||
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
|
||||
#if defined(_NEWLIB_VERSION)
|
||||
// On newlib, off_t is 'long int'
|
||||
typedef long int streamoff; // for char_traits in <string>
|
||||
#else
|
||||
typedef long long streamoff; // for char_traits in <string>
|
||||
#endif
|
||||
|
||||
template <class _CharT, // for <stdexcept>
|
||||
class _Traits = char_traits<_CharT>,
|
||||
|
@ -46,13 +46,17 @@ extern wostream wclog;
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_STDIN
|
||||
extern _LIBCPP_FUNC_VIS istream cin;
|
||||
extern _LIBCPP_FUNC_VIS ostream cout;
|
||||
extern _LIBCPP_FUNC_VIS ostream cerr;
|
||||
extern _LIBCPP_FUNC_VIS ostream clog;
|
||||
extern _LIBCPP_FUNC_VIS wistream wcin;
|
||||
#endif
|
||||
#ifndef _LIBCPP_HAS_NO_STDOUT
|
||||
extern _LIBCPP_FUNC_VIS ostream cout;
|
||||
extern _LIBCPP_FUNC_VIS wostream wcout;
|
||||
#endif
|
||||
extern _LIBCPP_FUNC_VIS ostream cerr;
|
||||
extern _LIBCPP_FUNC_VIS wostream wcerr;
|
||||
extern _LIBCPP_FUNC_VIS ostream clog;
|
||||
extern _LIBCPP_FUNC_VIS wostream wclog;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
@ -214,7 +214,7 @@ public:
|
||||
typedef traits traits_type;
|
||||
typedef basic_istream<charT,traits> istream_type;
|
||||
|
||||
istream_iterator();
|
||||
constexpr istream_iterator();
|
||||
istream_iterator(istream_type& s);
|
||||
istream_iterator(const istream_iterator& x);
|
||||
~istream_iterator();
|
||||
@ -575,7 +575,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY reverse_iterator& operator-=(difference_type __n)
|
||||
{current += __n; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const
|
||||
{return current[-__n-1];}
|
||||
{return *(*this + __n);}
|
||||
};
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
@ -765,7 +765,7 @@ private:
|
||||
istream_type* __in_stream_;
|
||||
_Tp __value_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY istream_iterator() : __in_stream_(0) {}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istream_iterator() : __in_stream_(0), __value_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY istream_iterator(istream_type& __s) : __in_stream_(&__s)
|
||||
{
|
||||
if (!(*__in_stream_ >> __value_))
|
||||
@ -1241,7 +1241,7 @@ private:
|
||||
|
||||
template <class _Up> friend class __wrap_iter;
|
||||
template <class _CharT, class _Traits, class _Alloc> friend class basic_string;
|
||||
template <class _Tp, class _Alloc> friend class vector;
|
||||
template <class _Tp, class _Alloc> friend class _LIBCPP_TYPE_VIS_ONLY vector;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
friend
|
||||
@ -1580,29 +1580,29 @@ end(const _Cp& __c)
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
template <class _C>
|
||||
constexpr auto size(const _C& __c) -> decltype(__c.size()) { return __c.size(); }
|
||||
template <class _Cont>
|
||||
constexpr auto size(const _Cont& __c) -> decltype(__c.size()) { return __c.size(); }
|
||||
|
||||
template <class _Tp, size_t _N>
|
||||
constexpr size_t size(const _Tp (&__array)[_N]) noexcept { return _N; }
|
||||
template <class _Tp, size_t _Sz>
|
||||
constexpr size_t size(const _Tp (&__array)[_Sz]) noexcept { return _Sz; }
|
||||
|
||||
template <class _C>
|
||||
constexpr auto empty(const _C& __c) -> decltype(__c.empty()) { return __c.empty(); }
|
||||
template <class _Cont>
|
||||
constexpr auto empty(const _Cont& __c) -> decltype(__c.empty()) { return __c.empty(); }
|
||||
|
||||
template <class _Tp, size_t _N>
|
||||
constexpr bool empty(const _Tp (&__array)[_N]) noexcept { return false; }
|
||||
template <class _Tp, size_t _Sz>
|
||||
constexpr bool empty(const _Tp (&__array)[_Sz]) noexcept { return false; }
|
||||
|
||||
template <class _Ep>
|
||||
constexpr bool empty(initializer_list<_Ep> __il) noexcept { return __il.size() == 0; }
|
||||
|
||||
template <class _C> constexpr
|
||||
auto data(_C& __c) -> decltype(__c.data()) { return __c.data(); }
|
||||
template <class _Cont> constexpr
|
||||
auto data(_Cont& __c) -> decltype(__c.data()) { return __c.data(); }
|
||||
|
||||
template <class _C> constexpr
|
||||
auto data(const _C& __c) -> decltype(__c.data()) { return __c.data(); }
|
||||
template <class _Cont> constexpr
|
||||
auto data(const _Cont& __c) -> decltype(__c.data()) { return __c.data(); }
|
||||
|
||||
template <class _Tp, size_t _N>
|
||||
constexpr _Tp* data(_Tp (&__array)[_N]) noexcept { return __array; }
|
||||
template <class _Tp, size_t _Sz>
|
||||
constexpr _Tp* data(_Tp (&__array)[_Sz]) noexcept { return __array; }
|
||||
|
||||
template <class _Ep>
|
||||
constexpr const _Ep* data(initializer_list<_Ep> __il) noexcept { return __il.begin(); }
|
||||
|
65
include/list
65
include/list
@ -118,8 +118,7 @@ public:
|
||||
void resize(size_type sz, const value_type& c);
|
||||
|
||||
void swap(list&)
|
||||
noexcept(!allocator_type::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value);
|
||||
noexcept(allocator_traits<allocator_type>::is_always_equal::value); // C++17
|
||||
void clear() noexcept;
|
||||
|
||||
void splice(const_iterator position, list& x);
|
||||
@ -226,7 +225,7 @@ struct __list_node
|
||||
_Tp __value_;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Alloc> class _LIBCPP_TYPE_VIS_ONLY list;
|
||||
template <class _Tp, class _Alloc = allocator<_Tp> > class _LIBCPP_TYPE_VIS_ONLY list;
|
||||
template <class _Tp, class _Alloc> class __list_imp;
|
||||
template <class _Tp, class _VoidPtr> class _LIBCPP_TYPE_VIS_ONLY __list_const_iterator;
|
||||
|
||||
@ -515,13 +514,7 @@ protected:
|
||||
typedef __list_const_iterator<value_type, __void_pointer> const_iterator;
|
||||
typedef __list_node_base<value_type, __void_pointer> __node_base;
|
||||
typedef __list_node<value_type, __void_pointer> __node;
|
||||
typedef typename __alloc_traits::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind_alloc<__node>
|
||||
#else
|
||||
rebind_alloc<__node>::other
|
||||
#endif
|
||||
__node_allocator;
|
||||
typedef typename __rebind_alloc_helper<__alloc_traits, __node>::type __node_allocator;
|
||||
typedef allocator_traits<__node_allocator> __node_alloc_traits;
|
||||
typedef typename __node_alloc_traits::pointer __node_pointer;
|
||||
typedef typename __node_alloc_traits::pointer __node_const_pointer;
|
||||
@ -529,13 +522,7 @@ protected:
|
||||
typedef typename __alloc_traits::const_pointer const_pointer;
|
||||
typedef typename __alloc_traits::difference_type difference_type;
|
||||
|
||||
typedef typename __alloc_traits::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind_alloc<__node_base>
|
||||
#else
|
||||
rebind_alloc<__node_base>::other
|
||||
#endif
|
||||
__node_base_allocator;
|
||||
typedef typename __rebind_alloc_helper<__alloc_traits, __node_base>::type __node_base_allocator;
|
||||
typedef typename allocator_traits<__node_base_allocator>::pointer __node_base_pointer;
|
||||
|
||||
__node_base __end_;
|
||||
@ -605,8 +592,12 @@ protected:
|
||||
}
|
||||
|
||||
void swap(__list_imp& __c)
|
||||
_NOEXCEPT_(!__node_alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value);
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
_NOEXCEPT;
|
||||
#else
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value);
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __copy_assign_alloc(const __list_imp& __c)
|
||||
@ -622,24 +613,6 @@ protected:
|
||||
__node_alloc_traits::propagate_on_container_move_assignment::value>());}
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y)
|
||||
_NOEXCEPT_(!__node_alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value)
|
||||
{__swap_alloc(__x, __y, integral_constant<bool,
|
||||
__node_alloc_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
|
||||
{}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __copy_assign_alloc(const __list_imp& __c, true_type)
|
||||
{
|
||||
@ -740,15 +713,19 @@ __list_imp<_Tp, _Alloc>::clear() _NOEXCEPT
|
||||
template <class _Tp, class _Alloc>
|
||||
void
|
||||
__list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
|
||||
_NOEXCEPT_(!__node_alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value)
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
_NOEXCEPT
|
||||
#else
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value)
|
||||
#endif
|
||||
{
|
||||
_LIBCPP_ASSERT(__alloc_traits::propagate_on_container_swap::value ||
|
||||
this->__node_alloc() == __c.__node_alloc(),
|
||||
"list::swap: Either propagate_on_container_swap must be true"
|
||||
" or the allocators must compare equal");
|
||||
using _VSTD::swap;
|
||||
__swap_alloc(__node_alloc(), __c.__node_alloc());
|
||||
__swap_allocator(__node_alloc(), __c.__node_alloc());
|
||||
swap(__sz(), __c.__sz());
|
||||
swap(__end_, __c.__end_);
|
||||
if (__sz() == 0)
|
||||
@ -799,7 +776,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc = allocator<_Tp> >
|
||||
template <class _Tp, class _Alloc /*= allocator<_Tp>*/>
|
||||
class _LIBCPP_TYPE_VIS_ONLY list
|
||||
: private __list_imp<_Tp, _Alloc>
|
||||
{
|
||||
@ -984,8 +961,12 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(list& __c)
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
_NOEXCEPT
|
||||
#else
|
||||
_NOEXCEPT_(!__node_alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value)
|
||||
#endif
|
||||
{base::swap(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() _NOEXCEPT {base::clear();}
|
||||
@ -1480,7 +1461,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
for (++__f; __f != __l; ++__f, ++__e, ++__ds)
|
||||
for (++__f; __f != __l; ++__f, (void) ++__e, (void) ++__ds)
|
||||
{
|
||||
__hold.reset(__node_alloc_traits::allocate(__na, 1));
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f);
|
||||
|
@ -198,7 +198,8 @@ template <class charT> class messages_byname;
|
||||
// include of <sys/cdefs.h> once https://sourceware.org/ml/newlib-cvs/2014-q3/msg00038.html
|
||||
// has had a chance to bake for a bit
|
||||
#include <support/newlib/xlocale.h>
|
||||
#elif !defined(__ANDROID__)
|
||||
#endif
|
||||
#ifdef _LIBCPP_HAS_CATOPEN
|
||||
#include <nl_types.h>
|
||||
#endif
|
||||
|
||||
@ -216,7 +217,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||
# define _LIBCPP_GET_C_LOCALE 0
|
||||
#elif defined(__NetBSD__)
|
||||
#elif defined(__CloudABI__) || defined(__NetBSD__)
|
||||
# define _LIBCPP_GET_C_LOCALE LC_C_LOCALE
|
||||
#else
|
||||
# define _LIBCPP_GET_C_LOCALE __cloc()
|
||||
@ -235,7 +236,7 @@ typedef _VSTD::unique_ptr<__locale_struct, decltype(&uselocale)> __locale_raii;
|
||||
// locale. Linux, not so much. The following functions avoid the locale when
|
||||
// that's possible and otherwise do the wrong thing. FIXME.
|
||||
#if defined(__linux__) || defined(__EMSCRIPTEN__) || defined(_AIX) || \
|
||||
defined(_NEWLIB_VERSION)
|
||||
defined(_NEWLIB_VERSION) || defined(__GLIBC__)
|
||||
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
decltype(MB_CUR_MAX_L(_VSTD::declval<locale_t>()))
|
||||
@ -1190,7 +1191,7 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
if (sscanf_l(__buf.c_str(), _LIBCPP_GET_C_LOCALE, "%p", &__v) != 1)
|
||||
#else
|
||||
if (__sscanf_l(__buf.c_str(), __cloc(), "%p", &__v) != 1)
|
||||
if (__sscanf_l(__buf.c_str(), _LIBCPP_GET_C_LOCALE, "%p", &__v) != 1)
|
||||
#endif
|
||||
__err = ios_base::failbit;
|
||||
// EOF checked
|
||||
@ -1560,7 +1561,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
int __nc = snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
|
||||
#else
|
||||
int __nc = __snprintf_l(__nar, sizeof(__nar), __cloc(), __fmt, __v);
|
||||
int __nc = __snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
|
||||
#endif
|
||||
char* __ne = __nar + __nc;
|
||||
char* __np = this->__identify_padding(__nar, __ne, __iob);
|
||||
@ -1585,12 +1586,12 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
this->__format_int(__fmt+1, __len, true, __iob.flags());
|
||||
const unsigned __nbuf = (numeric_limits<long long>::digits / 3)
|
||||
+ ((numeric_limits<long long>::digits % 3) != 0)
|
||||
+ 1;
|
||||
+ 2;
|
||||
char __nar[__nbuf];
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
int __nc = snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
|
||||
#else
|
||||
int __nc = __snprintf_l(__nar, sizeof(__nar), __cloc(), __fmt, __v);
|
||||
int __nc = __snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
|
||||
#endif
|
||||
char* __ne = __nar + __nc;
|
||||
char* __np = this->__identify_padding(__nar, __ne, __iob);
|
||||
@ -1620,7 +1621,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
int __nc = snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
|
||||
#else
|
||||
int __nc = __snprintf_l(__nar, sizeof(__nar), __cloc(), __fmt, __v);
|
||||
int __nc = __snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
|
||||
#endif
|
||||
char* __ne = __nar + __nc;
|
||||
char* __np = this->__identify_padding(__nar, __ne, __iob);
|
||||
@ -1650,7 +1651,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
int __nc = snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
|
||||
#else
|
||||
int __nc = __snprintf_l(__nar, sizeof(__nar), __cloc(), __fmt, __v);
|
||||
int __nc = __snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
|
||||
#endif
|
||||
char* __ne = __nar + __nc;
|
||||
char* __np = this->__identify_padding(__nar, __ne, __iob);
|
||||
@ -1682,14 +1683,14 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
__nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt,
|
||||
(int)__iob.precision(), __v);
|
||||
#else
|
||||
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt,
|
||||
(int)__iob.precision(), __v);
|
||||
__nc = __snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt,
|
||||
(int)__iob.precision(), __v);
|
||||
#endif
|
||||
else
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
__nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
|
||||
#else
|
||||
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt, __v);
|
||||
__nc = __snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
|
||||
#endif
|
||||
unique_ptr<char, void(*)(void*)> __nbh(0, free);
|
||||
if (__nc > static_cast<int>(__nbuf-1))
|
||||
@ -1698,14 +1699,13 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
__nc = asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
|
||||
#else
|
||||
__nc = __asprintf_l(&__nb, __cloc(), __fmt,
|
||||
(int)__iob.precision(), __v);
|
||||
__nc = __asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
|
||||
#endif
|
||||
else
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
__nc = asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
|
||||
#else
|
||||
__nc = __asprintf_l(&__nb, __cloc(), __fmt, (int)__iob.precision(), __v);
|
||||
__nc = __asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
|
||||
#endif
|
||||
if (__nb == 0)
|
||||
__throw_bad_alloc();
|
||||
@ -1751,14 +1751,14 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
__nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt,
|
||||
(int)__iob.precision(), __v);
|
||||
#else
|
||||
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt,
|
||||
(int)__iob.precision(), __v);
|
||||
__nc = __snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt,
|
||||
(int)__iob.precision(), __v);
|
||||
#endif
|
||||
else
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
__nc = snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
|
||||
#else
|
||||
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt, __v);
|
||||
__nc = __snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
|
||||
#endif
|
||||
unique_ptr<char, void(*)(void*)> __nbh(0, free);
|
||||
if (__nc > static_cast<int>(__nbuf-1))
|
||||
@ -1767,14 +1767,13 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
__nc = asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
|
||||
#else
|
||||
__nc = __asprintf_l(&__nb, __cloc(), __fmt,
|
||||
(int)__iob.precision(), __v);
|
||||
__nc = __asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
|
||||
#endif
|
||||
else
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
__nc = asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
|
||||
#else
|
||||
__nc = __asprintf_l(&__nb, __cloc(), __fmt, __v);
|
||||
__nc = __asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
|
||||
#endif
|
||||
if (__nb == 0)
|
||||
__throw_bad_alloc();
|
||||
@ -1814,7 +1813,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
int __nc = snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
|
||||
#else
|
||||
int __nc = __snprintf_l(__nar, sizeof(__nar), __cloc(), __fmt, __v);
|
||||
int __nc = __snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);
|
||||
#endif
|
||||
char* __ne = __nar + __nc;
|
||||
char* __np = this->__identify_padding(__nar, __ne, __iob);
|
||||
@ -3527,7 +3526,7 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
__n = static_cast<size_t>(asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units));
|
||||
#else
|
||||
__n = __asprintf_l(&__bb, __cloc(), "%.0Lf", __units);
|
||||
__n = __asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units);
|
||||
#endif
|
||||
if (__bb == 0)
|
||||
__throw_bad_alloc();
|
||||
@ -3681,14 +3680,14 @@ template <class _CharT>
|
||||
typename messages<_CharT>::catalog
|
||||
messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const
|
||||
{
|
||||
#if defined(_WIN32) || defined(__ANDROID__) || defined(_NEWLIB_VERSION)
|
||||
return -1;
|
||||
#else // _WIN32 || __ANDROID__
|
||||
#ifdef _LIBCPP_HAS_CATOPEN
|
||||
catalog __cat = (catalog)catopen(__nm.c_str(), NL_CAT_LOCALE);
|
||||
if (__cat != -1)
|
||||
__cat = static_cast<catalog>((static_cast<size_t>(__cat) >> 1));
|
||||
return __cat;
|
||||
#endif // _WIN32 || __ANDROID__
|
||||
#else // !_LIBCPP_HAS_CATOPEN
|
||||
return -1;
|
||||
#endif // _LIBCPP_HAS_CATOPEN
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
@ -3696,9 +3695,7 @@ typename messages<_CharT>::string_type
|
||||
messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
|
||||
const string_type& __dflt) const
|
||||
{
|
||||
#if defined(_WIN32) || defined(__ANDROID__) || defined(_NEWLIB_VERSION)
|
||||
return __dflt;
|
||||
#else // _WIN32
|
||||
#ifdef _LIBCPP_HAS_CATOPEN
|
||||
string __ndflt;
|
||||
__narrow_to_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__ndflt),
|
||||
__dflt.c_str(),
|
||||
@ -3711,19 +3708,21 @@ messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
|
||||
__widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__w),
|
||||
__n, __n + strlen(__n));
|
||||
return __w;
|
||||
#endif // _WIN32
|
||||
#else // !_LIBCPP_HAS_CATOPEN
|
||||
return __dflt;
|
||||
#endif // _LIBCPP_HAS_CATOPEN
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
void
|
||||
messages<_CharT>::do_close(catalog __c) const
|
||||
{
|
||||
#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(_NEWLIB_VERSION)
|
||||
#ifdef _LIBCPP_HAS_CATOPEN
|
||||
if (__c != -1)
|
||||
__c <<= 1;
|
||||
nl_catd __cat = (nl_catd)__c;
|
||||
catclose(__cat);
|
||||
#endif // !_WIN32
|
||||
#endif // _LIBCPP_HAS_CATOPEN
|
||||
}
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS messages<char>)
|
||||
|
231
include/map
231
include/map
@ -135,16 +135,32 @@ public:
|
||||
void insert(InputIterator first, InputIterator last);
|
||||
void insert(initializer_list<value_type> il);
|
||||
|
||||
template <class... Args>
|
||||
pair<iterator, bool> try_emplace(const key_type& k, Args&&... args); // C++17
|
||||
template <class... Args>
|
||||
pair<iterator, bool> try_emplace(key_type&& k, Args&&... args); // C++17
|
||||
template <class... Args>
|
||||
iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args); // C++17
|
||||
template <class... Args>
|
||||
iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args); // C++17
|
||||
template <class M>
|
||||
pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj); // C++17
|
||||
template <class M>
|
||||
pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj); // C++17
|
||||
template <class M>
|
||||
iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj); // C++17
|
||||
template <class M>
|
||||
iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj); // C++17
|
||||
|
||||
iterator erase(const_iterator position);
|
||||
iterator erase(iterator position); // C++14
|
||||
size_type erase(const key_type& k);
|
||||
iterator erase(const_iterator first, const_iterator last);
|
||||
void clear() noexcept;
|
||||
|
||||
void swap(map& m)
|
||||
noexcept(
|
||||
__is_nothrow_swappable<key_compare>::value &&
|
||||
(!allocator_type::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value));
|
||||
noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
|
||||
__is_nothrow_swappable<key_compare>::value); // C++17
|
||||
|
||||
// observers:
|
||||
allocator_type get_allocator() const noexcept;
|
||||
@ -330,15 +346,14 @@ public:
|
||||
void insert(initializer_list<value_type> il);
|
||||
|
||||
iterator erase(const_iterator position);
|
||||
iterator erase(iterator position); // C++14
|
||||
size_type erase(const key_type& k);
|
||||
iterator erase(const_iterator first, const_iterator last);
|
||||
void clear() noexcept;
|
||||
|
||||
void swap(multimap& m)
|
||||
noexcept(
|
||||
__is_nothrow_swappable<key_compare>::value &&
|
||||
(!allocator_type::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value));
|
||||
noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
|
||||
__is_nothrow_swappable<key_compare>::value); // C++17
|
||||
|
||||
// observers:
|
||||
allocator_type get_allocator() const noexcept;
|
||||
@ -426,6 +441,7 @@ swap(multimap<Key, T, Compare, Allocator>& x,
|
||||
#include <utility>
|
||||
#include <functional>
|
||||
#include <initializer_list>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
@ -433,10 +449,8 @@ swap(multimap<Key, T, Compare, Allocator>& x,
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Key, class _CP, class _Compare, bool = is_empty<_Compare>::value
|
||||
#if __has_feature(is_final)
|
||||
&& !__is_final(_Compare)
|
||||
#endif
|
||||
template <class _Key, class _CP, class _Compare,
|
||||
bool = is_empty<_Compare>::value && !__libcpp_is_final<_Compare>::value
|
||||
>
|
||||
class __map_value_compare
|
||||
: private _Compare
|
||||
@ -461,6 +475,12 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Key& __x, const _CP& __y) const
|
||||
{return static_cast<const _Compare&>(*this)(__x, __y.__cc.first);}
|
||||
void swap(__map_value_compare&__y)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_Compare>::value)
|
||||
{
|
||||
using _VSTD::swap;
|
||||
swap(static_cast<const _Compare&>(*this), static_cast<const _Compare&>(__y));
|
||||
}
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
template <typename _K2>
|
||||
@ -503,7 +523,13 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Key& __x, const _CP& __y) const
|
||||
{return comp(__x, __y.__cc.first);}
|
||||
|
||||
void swap(__map_value_compare&__y)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_Compare>::value)
|
||||
{
|
||||
using _VSTD::swap;
|
||||
swap(comp, __y.comp);
|
||||
}
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -519,6 +545,16 @@ public:
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Key, class _CP, class _Compare, bool __b>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(__map_value_compare<_Key, _CP, _Compare, __b>& __x,
|
||||
__map_value_compare<_Key, _CP, _Compare, __b>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Allocator>
|
||||
class __map_node_destructor
|
||||
{
|
||||
@ -644,14 +680,25 @@ struct __value_type
|
||||
|
||||
#endif
|
||||
|
||||
template <class _Tp>
|
||||
struct __extract_key_value_types;
|
||||
|
||||
template <class _Key, class _Tp>
|
||||
struct __extract_key_value_types<__value_type<_Key, _Tp> >
|
||||
{
|
||||
typedef _Key const __key_type;
|
||||
typedef _Tp __mapped_type;
|
||||
};
|
||||
|
||||
template <class _TreeIterator>
|
||||
class _LIBCPP_TYPE_VIS_ONLY __map_iterator
|
||||
{
|
||||
_TreeIterator __i_;
|
||||
|
||||
typedef typename _TreeIterator::__pointer_traits __pointer_traits;
|
||||
typedef const typename _TreeIterator::value_type::value_type::first_type __key_type;
|
||||
typedef typename _TreeIterator::value_type::value_type::second_type __mapped_type;
|
||||
typedef typename _TreeIterator::value_type __value_type;
|
||||
typedef typename __extract_key_value_types<__value_type>::__key_type __key_type;
|
||||
typedef typename __extract_key_value_types<__value_type>::__mapped_type __mapped_type;
|
||||
public:
|
||||
typedef bidirectional_iterator_tag iterator_category;
|
||||
typedef pair<__key_type, __mapped_type> value_type;
|
||||
@ -715,8 +762,9 @@ class _LIBCPP_TYPE_VIS_ONLY __map_const_iterator
|
||||
_TreeIterator __i_;
|
||||
|
||||
typedef typename _TreeIterator::__pointer_traits __pointer_traits;
|
||||
typedef const typename _TreeIterator::value_type::value_type::first_type __key_type;
|
||||
typedef typename _TreeIterator::value_type::value_type::second_type __mapped_type;
|
||||
typedef typename _TreeIterator::value_type __value_type;
|
||||
typedef typename __extract_key_value_types<__value_type>::__key_type __key_type;
|
||||
typedef typename __extract_key_value_types<__value_type>::__mapped_type __mapped_type;
|
||||
public:
|
||||
typedef bidirectional_iterator_tag iterator_category;
|
||||
typedef pair<__key_type, __mapped_type> value_type;
|
||||
@ -736,10 +784,9 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__map_const_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__map_const_iterator(
|
||||
__map_iterator<typename _TreeIterator::__non_const_iterator> __i)
|
||||
_NOEXCEPT
|
||||
: __i_(__i.__i_) {}
|
||||
__map_const_iterator(__map_iterator<
|
||||
typename _TreeIterator::__non_const_iterator> __i) _NOEXCEPT
|
||||
: __i_(__i.__i_) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {return __i_->__cc;}
|
||||
@ -811,13 +858,8 @@ private:
|
||||
|
||||
typedef _VSTD::__value_type<key_type, mapped_type> __value_type;
|
||||
typedef __map_value_compare<key_type, __value_type, key_compare> __vc;
|
||||
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 typename __rebind_alloc_helper<allocator_traits<allocator_type>,
|
||||
__value_type>::type __allocator_type;
|
||||
typedef __tree<__value_type, __vc, __allocator_type> __base;
|
||||
typedef typename __base::__node_traits __node_traits;
|
||||
typedef allocator_traits<allocator_type> __alloc_traits;
|
||||
@ -829,7 +871,7 @@ public:
|
||||
typedef typename __alloc_traits::const_pointer const_pointer;
|
||||
typedef typename __alloc_traits::size_type size_type;
|
||||
typedef typename __alloc_traits::difference_type difference_type;
|
||||
typedef __map_iterator<typename __base::iterator> iterator;
|
||||
typedef __map_iterator<typename __base::iterator> iterator;
|
||||
typedef __map_const_iterator<typename __base::const_iterator> const_iterator;
|
||||
typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
@ -1070,9 +1112,125 @@ public:
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> try_emplace(const key_type& __k, _Args&&... __args)
|
||||
{
|
||||
iterator __p = lower_bound(__k);
|
||||
if ( __p != end() && !key_comp()(__k, __p->first))
|
||||
return _VSTD::make_pair(__p, false);
|
||||
else
|
||||
return _VSTD::make_pair(
|
||||
emplace_hint(__p,
|
||||
_VSTD::piecewise_construct, _VSTD::forward_as_tuple(__k),
|
||||
_VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)),
|
||||
true);
|
||||
}
|
||||
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> try_emplace(key_type&& __k, _Args&&... __args)
|
||||
{
|
||||
iterator __p = lower_bound(__k);
|
||||
if ( __p != end() && !key_comp()(__k, __p->first))
|
||||
return _VSTD::make_pair(__p, false);
|
||||
else
|
||||
return _VSTD::make_pair(
|
||||
emplace_hint(__p,
|
||||
_VSTD::piecewise_construct, _VSTD::forward_as_tuple(_VSTD::move(__k)),
|
||||
_VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)),
|
||||
true);
|
||||
}
|
||||
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator try_emplace(const_iterator __h, const key_type& __k, _Args&&... __args)
|
||||
{
|
||||
iterator __p = lower_bound(__k);
|
||||
if ( __p != end() && !key_comp()(__k, __p->first))
|
||||
return __p;
|
||||
else
|
||||
return emplace_hint(__p,
|
||||
_VSTD::piecewise_construct, _VSTD::forward_as_tuple(__k),
|
||||
_VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...));
|
||||
}
|
||||
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator try_emplace(const_iterator __h, key_type&& __k, _Args&&... __args)
|
||||
{
|
||||
iterator __p = lower_bound(__k);
|
||||
if ( __p != end() && !key_comp()(__k, __p->first))
|
||||
return __p;
|
||||
else
|
||||
return emplace_hint(__p,
|
||||
_VSTD::piecewise_construct, _VSTD::forward_as_tuple(_VSTD::move(__k)),
|
||||
_VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...));
|
||||
}
|
||||
|
||||
template <class _Vp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> insert_or_assign(const key_type& __k, _Vp&& __v)
|
||||
{
|
||||
iterator __p = lower_bound(__k);
|
||||
if ( __p != end() && !key_comp()(__k, __p->first))
|
||||
{
|
||||
__p->second = _VSTD::forward<_Vp>(__v);
|
||||
return _VSTD::make_pair(__p, false);
|
||||
}
|
||||
return _VSTD::make_pair(emplace_hint(__p, __k, _VSTD::forward<_Vp>(__v)), true);
|
||||
}
|
||||
|
||||
template <class _Vp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> insert_or_assign(key_type&& __k, _Vp&& __v)
|
||||
{
|
||||
iterator __p = lower_bound(__k);
|
||||
if ( __p != end() && !key_comp()(__k, __p->first))
|
||||
{
|
||||
__p->second = _VSTD::forward<_Vp>(__v);
|
||||
return _VSTD::make_pair(__p, false);
|
||||
}
|
||||
return _VSTD::make_pair(emplace_hint(__p, _VSTD::move(__k), _VSTD::forward<_Vp>(__v)), true);
|
||||
}
|
||||
|
||||
template <class _Vp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert_or_assign(const_iterator __h, const key_type& __k, _Vp&& __v)
|
||||
{
|
||||
iterator __p = lower_bound(__k);
|
||||
if ( __p != end() && !key_comp()(__k, __p->first))
|
||||
{
|
||||
__p->second = _VSTD::forward<_Vp>(__v);
|
||||
return __p;
|
||||
}
|
||||
return emplace_hint(__h, __k, _VSTD::forward<_Vp>(__v));
|
||||
}
|
||||
|
||||
template <class _Vp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert_or_assign(const_iterator __h, key_type&& __k, _Vp&& __v)
|
||||
{
|
||||
iterator __p = lower_bound(__k);
|
||||
if ( __p != end() && !key_comp()(__k, __p->first))
|
||||
{
|
||||
__p->second = _VSTD::forward<_Vp>(__v);
|
||||
return __p;
|
||||
}
|
||||
return emplace_hint(__h, _VSTD::move(__k), _VSTD::forward<_Vp>(__v));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator erase(iterator __p) {return __tree_.erase(__p.__i_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type erase(const key_type& __k)
|
||||
{return __tree_.__erase_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -1108,7 +1266,7 @@ public:
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
|
||||
count(const _K2& __k) {return __tree_.__count_unique(__k);}
|
||||
count(const _K2& __k) const {return __tree_.__count_unique(__k);}
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator lower_bound(const key_type& __k)
|
||||
@ -1557,13 +1715,8 @@ private:
|
||||
|
||||
typedef _VSTD::__value_type<key_type, mapped_type> __value_type;
|
||||
typedef __map_value_compare<key_type, __value_type, key_compare> __vc;
|
||||
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 typename __rebind_alloc_helper<allocator_traits<allocator_type>,
|
||||
__value_type>::type __allocator_type;
|
||||
typedef __tree<__value_type, __vc, __allocator_type> __base;
|
||||
typedef typename __base::__node_traits __node_traits;
|
||||
typedef allocator_traits<allocator_type> __alloc_traits;
|
||||
@ -1810,6 +1963,8 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator erase(iterator __p) {return __tree_.erase(__p.__i_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator erase(const_iterator __f, const_iterator __l)
|
||||
@ -1844,7 +1999,7 @@ public:
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
|
||||
count(const _K2& __k) {return __tree_.__count_multi(__k);}
|
||||
count(const _K2& __k) const {return __tree_.__count_multi(__k);}
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator lower_bound(const key_type& __k)
|
||||
|
227
include/memory
227
include/memory
@ -75,6 +75,8 @@ struct allocator_traits
|
||||
| false_type propagate_on_container_move_assignment;
|
||||
typedef Alloc::propagate_on_container_swap
|
||||
| false_type propagate_on_container_swap;
|
||||
typedef Alloc::is_always_equal
|
||||
| is_empty is_always_equal;
|
||||
|
||||
template <class T> using rebind_alloc = Alloc::rebind<U>::other | Alloc<T, Args...>;
|
||||
template <class T> using rebind_traits = allocator_traits<rebind_alloc<T>>;
|
||||
@ -615,6 +617,7 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
|
||||
#endif
|
||||
|
||||
#include <__undef_min_max>
|
||||
#include <__undef___deallocate>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
@ -622,6 +625,18 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _ValueType>
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
_ValueType __libcpp_relaxed_load(_ValueType const* __value) {
|
||||
#if !defined(_LIBCPP_HAS_NO_THREADS) && \
|
||||
defined(__ATOMIC_RELAXED) && \
|
||||
(__has_builtin(__atomic_load_n) || _GNUC_VER >= 407)
|
||||
return __atomic_load_n(__value, __ATOMIC_RELAXED);
|
||||
#else
|
||||
return *__value;
|
||||
#endif
|
||||
}
|
||||
|
||||
// addressof moved to <__functional_base>
|
||||
|
||||
template <class _Tp> class allocator;
|
||||
@ -1143,6 +1158,29 @@ struct __propagate_on_container_swap<_Alloc, true>
|
||||
typedef typename _Alloc::propagate_on_container_swap type;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_is_always_equal
|
||||
{
|
||||
private:
|
||||
struct __two {char __lx; char __lxx;};
|
||||
template <class _Up> static __two __test(...);
|
||||
template <class _Up> static char __test(typename _Up::is_always_equal* = 0);
|
||||
public:
|
||||
static const bool value = sizeof(__test<_Tp>(0)) == 1;
|
||||
};
|
||||
|
||||
template <class _Alloc, bool = __has_is_always_equal<_Alloc>::value>
|
||||
struct __is_always_equal
|
||||
{
|
||||
typedef typename _VSTD::is_empty<_Alloc>::type type;
|
||||
};
|
||||
|
||||
template <class _Alloc>
|
||||
struct __is_always_equal<_Alloc, true>
|
||||
{
|
||||
typedef typename _Alloc::is_always_equal type;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
|
||||
struct __has_rebind_other
|
||||
{
|
||||
@ -1422,6 +1460,8 @@ struct _LIBCPP_TYPE_VIS_ONLY allocator_traits
|
||||
propagate_on_container_move_assignment;
|
||||
typedef typename __propagate_on_container_swap<allocator_type>::type
|
||||
propagate_on_container_swap;
|
||||
typedef typename __is_always_equal<allocator_type>::type
|
||||
is_always_equal;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
template <class _Tp> using rebind_alloc =
|
||||
@ -1520,8 +1560,42 @@ struct _LIBCPP_TYPE_VIS_ONLY allocator_traits
|
||||
__construct_forward(allocator_type& __a, _Tp* __begin1, _Tp* __end1, _Tp*& __begin2)
|
||||
{
|
||||
ptrdiff_t _Np = __end1 - __begin1;
|
||||
_VSTD::memcpy(__begin2, __begin1, _Np * sizeof(_Tp));
|
||||
__begin2 += _Np;
|
||||
if (_Np > 0)
|
||||
{
|
||||
_VSTD::memcpy(__begin2, __begin1, _Np * sizeof(_Tp));
|
||||
__begin2 += _Np;
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Iter, class _Ptr>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static
|
||||
void
|
||||
__construct_range_forward(allocator_type& __a, _Iter __begin1, _Iter __end1, _Ptr& __begin2)
|
||||
{
|
||||
for (; __begin1 != __end1; ++__begin1, (void) ++__begin2)
|
||||
construct(__a, _VSTD::__to_raw_pointer(__begin2), *__begin1);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static
|
||||
typename enable_if
|
||||
<
|
||||
(is_same<allocator_type, allocator<_Tp> >::value
|
||||
|| !__has_construct<allocator_type, _Tp*, _Tp>::value) &&
|
||||
is_trivially_move_constructible<_Tp>::value,
|
||||
void
|
||||
>::type
|
||||
__construct_range_forward(allocator_type& __a, _Tp* __begin1, _Tp* __end1, _Tp*& __begin2)
|
||||
{
|
||||
typedef typename remove_const<_Tp>::type _Vp;
|
||||
ptrdiff_t _Np = __end1 - __begin1;
|
||||
if (_Np > 0)
|
||||
{
|
||||
_VSTD::memcpy(const_cast<_Vp*>(__begin2), __begin1, _Np * sizeof(_Tp));
|
||||
__begin2 += _Np;
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Ptr>
|
||||
@ -1551,7 +1625,8 @@ struct _LIBCPP_TYPE_VIS_ONLY allocator_traits
|
||||
{
|
||||
ptrdiff_t _Np = __end1 - __begin1;
|
||||
__end2 -= _Np;
|
||||
_VSTD::memcpy(__end2, __begin1, _Np * sizeof(_Tp));
|
||||
if (_Np > 0)
|
||||
_VSTD::memcpy(__end2, __begin1, _Np * sizeof(_Tp));
|
||||
}
|
||||
|
||||
private:
|
||||
@ -1606,6 +1681,16 @@ private:
|
||||
{return __a;}
|
||||
};
|
||||
|
||||
template <class _Traits, class _Tp>
|
||||
struct __rebind_alloc_helper
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
typedef typename _Traits::template rebind_alloc<_Tp> type;
|
||||
#else
|
||||
typedef typename _Traits::template rebind_alloc<_Tp>::other type;
|
||||
#endif
|
||||
};
|
||||
|
||||
// allocator
|
||||
|
||||
template <class _Tp>
|
||||
@ -1621,6 +1706,7 @@ public:
|
||||
typedef _Tp value_type;
|
||||
|
||||
typedef true_type propagate_on_container_move_assignment;
|
||||
typedef true_type is_always_equal;
|
||||
|
||||
template <class _Up> struct rebind {typedef allocator<_Up> other;};
|
||||
|
||||
@ -1713,6 +1799,7 @@ public:
|
||||
typedef const _Tp value_type;
|
||||
|
||||
typedef true_type propagate_on_container_move_assignment;
|
||||
typedef true_type is_always_equal;
|
||||
|
||||
template <class _Up> struct rebind {typedef allocator<_Up> other;};
|
||||
|
||||
@ -1816,6 +1903,9 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator++() {++__x_; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY raw_storage_iterator operator++(int)
|
||||
{raw_storage_iterator __t(*this); ++__x_; return __t;}
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
_LIBCPP_INLINE_VISIBILITY _OutputIterator base() const { return __x_; }
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
@ -1905,14 +1995,9 @@ public:
|
||||
template <class _T1, class _T2, bool = is_same<typename remove_cv<_T1>::type,
|
||||
typename remove_cv<_T2>::type>::value,
|
||||
bool = is_empty<_T1>::value
|
||||
#if __has_feature(is_final)
|
||||
&& !__is_final(_T1)
|
||||
#endif
|
||||
,
|
||||
&& !__libcpp_is_final<_T1>::value,
|
||||
bool = is_empty<_T2>::value
|
||||
#if __has_feature(is_final)
|
||||
&& !__is_final(_T2)
|
||||
#endif
|
||||
&& !__libcpp_is_final<_T2>::value
|
||||
>
|
||||
struct __libcpp_compressed_pair_switch;
|
||||
|
||||
@ -1950,11 +2035,11 @@ public:
|
||||
typedef const typename remove_reference<_T1>::type& _T1_const_reference;
|
||||
typedef const typename remove_reference<_T2>::type& _T2_const_reference;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __first_(), __second_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1)
|
||||
: __first_(_VSTD::forward<_T1_param>(__t1)) {}
|
||||
: __first_(_VSTD::forward<_T1_param>(__t1)), __second_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2)
|
||||
: __second_(_VSTD::forward<_T2_param>(__t2)) {}
|
||||
: __first_(), __second_(_VSTD::forward<_T2_param>(__t2)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
|
||||
: __first_(_VSTD::forward<_T1_param>(__t1)), __second_(_VSTD::forward<_T2_param>(__t2)) {}
|
||||
|
||||
@ -2043,9 +2128,9 @@ public:
|
||||
typedef const _T1& _T1_const_reference;
|
||||
typedef const typename remove_reference<_T2>::type& _T2_const_reference;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __second_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1)
|
||||
: _T1(_VSTD::forward<_T1_param>(__t1)) {}
|
||||
: _T1(_VSTD::forward<_T1_param>(__t1)), __second_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2)
|
||||
: __second_(_VSTD::forward<_T2_param>(__t2)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
|
||||
@ -2133,11 +2218,11 @@ public:
|
||||
typedef const typename remove_reference<_T1>::type& _T1_const_reference;
|
||||
typedef const _T2& _T2_const_reference;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __first_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1)
|
||||
: __first_(_VSTD::forward<_T1_param>(__t1)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2)
|
||||
: _T2(_VSTD::forward<_T2_param>(__t2)) {}
|
||||
: _T2(_VSTD::forward<_T2_param>(__t2)), __first_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<_T1>::value &&
|
||||
is_nothrow_move_constructible<_T2>::value)
|
||||
@ -2890,8 +2975,8 @@ operator< (const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y)
|
||||
{
|
||||
typedef typename unique_ptr<_T1, _D1>::pointer _P1;
|
||||
typedef typename unique_ptr<_T2, _D2>::pointer _P2;
|
||||
typedef typename common_type<_P1, _P2>::type _V;
|
||||
return less<_V>()(__x.get(), __y.get());
|
||||
typedef typename common_type<_P1, _P2>::type _Vp;
|
||||
return less<_Vp>()(__x.get(), __y.get());
|
||||
}
|
||||
|
||||
template <class _T1, class _D1, class _T2, class _D2>
|
||||
@ -3485,8 +3570,8 @@ uninitialized_copy(_InputIterator __f, _InputIterator __l, _ForwardIterator __r)
|
||||
try
|
||||
{
|
||||
#endif
|
||||
for (; __f != __l; ++__f, ++__r)
|
||||
::new(&*__r) value_type(*__f);
|
||||
for (; __f != __l; ++__f, (void) ++__r)
|
||||
::new (static_cast<void*>(_VSTD::addressof(*__r))) value_type(*__f);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
@ -3509,8 +3594,8 @@ uninitialized_copy_n(_InputIterator __f, _Size __n, _ForwardIterator __r)
|
||||
try
|
||||
{
|
||||
#endif
|
||||
for (; __n > 0; ++__f, ++__r, --__n)
|
||||
::new(&*__r) value_type(*__f);
|
||||
for (; __n > 0; ++__f, (void) ++__r, (void) --__n)
|
||||
::new (static_cast<void*>(_VSTD::addressof(*__r))) value_type(*__f);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
@ -3534,7 +3619,7 @@ uninitialized_fill(_ForwardIterator __f, _ForwardIterator __l, const _Tp& __x)
|
||||
{
|
||||
#endif
|
||||
for (; __f != __l; ++__f)
|
||||
::new(&*__f) value_type(__x);
|
||||
::new (static_cast<void*>(_VSTD::addressof(*__f))) value_type(__x);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
@ -3556,8 +3641,8 @@ uninitialized_fill_n(_ForwardIterator __f, _Size __n, const _Tp& __x)
|
||||
try
|
||||
{
|
||||
#endif
|
||||
for (; __n > 0; ++__f, --__n)
|
||||
::new(&*__f) value_type(__x);
|
||||
for (; __n > 0; ++__f, (void) --__n)
|
||||
::new (static_cast<void*>(_VSTD::addressof(*__f))) value_type(__x);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
@ -3599,7 +3684,9 @@ public:
|
||||
void __add_shared() _NOEXCEPT;
|
||||
bool __release_shared() _NOEXCEPT;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
long use_count() const _NOEXCEPT {return __shared_owners_ + 1;}
|
||||
long use_count() const _NOEXCEPT {
|
||||
return __libcpp_relaxed_load(&__shared_owners_) + 1;
|
||||
}
|
||||
};
|
||||
|
||||
class _LIBCPP_TYPE_VIS __shared_weak_count
|
||||
@ -3677,11 +3764,11 @@ template <class _Tp, class _Dp, class _Alloc>
|
||||
void
|
||||
__shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT
|
||||
{
|
||||
typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_pointer>::type _A;
|
||||
typedef allocator_traits<_A> _ATraits;
|
||||
typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_pointer>::type _Al;
|
||||
typedef allocator_traits<_Al> _ATraits;
|
||||
typedef pointer_traits<typename _ATraits::pointer> _PTraits;
|
||||
|
||||
_A __a(__data_.second());
|
||||
_Al __a(__data_.second());
|
||||
__data_.second().~_Alloc();
|
||||
__a.deallocate(_PTraits::pointer_to(*this), 1);
|
||||
}
|
||||
@ -3746,10 +3833,10 @@ template <class _Tp, class _Alloc>
|
||||
void
|
||||
__shared_ptr_emplace<_Tp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT
|
||||
{
|
||||
typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_emplace>::type _A;
|
||||
typedef allocator_traits<_A> _ATraits;
|
||||
typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_emplace>::type _Al;
|
||||
typedef allocator_traits<_Al> _ATraits;
|
||||
typedef pointer_traits<typename _ATraits::pointer> _PTraits;
|
||||
_A __a(__data_.first());
|
||||
_Al __a(__data_.first());
|
||||
__data_.first().~_Alloc();
|
||||
__a.deallocate(_PTraits::pointer_to(*this), 1);
|
||||
}
|
||||
@ -4001,11 +4088,15 @@ private:
|
||||
__enable_weak_this(const enable_shared_from_this<_Yp>* __e) _NOEXCEPT
|
||||
{
|
||||
if (__e)
|
||||
__e->__weak_this_ = *this;
|
||||
{
|
||||
__e->__weak_this_.__ptr_ = const_cast<_Yp*>(static_cast<const _Yp*>(__e));
|
||||
__e->__weak_this_.__cntrl_ = __cntrl_;
|
||||
__cntrl_->__add_weak();
|
||||
}
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __enable_weak_this(const void*) _NOEXCEPT {}
|
||||
void __enable_weak_this(const volatile void*) _NOEXCEPT {}
|
||||
|
||||
template <class _Up> friend class _LIBCPP_TYPE_VIS_ONLY shared_ptr;
|
||||
template <class _Up> friend class _LIBCPP_TYPE_VIS_ONLY weak_ptr;
|
||||
@ -4235,9 +4326,16 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp> __r,
|
||||
>::type)
|
||||
: __ptr_(__r.get())
|
||||
{
|
||||
typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk;
|
||||
__cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), allocator<_Yp>());
|
||||
__enable_weak_this(__r.get());
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
if (__ptr_ == nullptr)
|
||||
__cntrl_ = nullptr;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk;
|
||||
__cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), allocator<_Yp>());
|
||||
__enable_weak_this(__r.get());
|
||||
}
|
||||
__r.release();
|
||||
}
|
||||
|
||||
@ -4257,11 +4355,18 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp> __r,
|
||||
>::type)
|
||||
: __ptr_(__r.get())
|
||||
{
|
||||
typedef __shared_ptr_pointer<_Yp*,
|
||||
reference_wrapper<typename remove_reference<_Dp>::type>,
|
||||
allocator<_Yp> > _CntrlBlk;
|
||||
__cntrl_ = new _CntrlBlk(__r.get(), ref(__r.get_deleter()), allocator<_Yp>());
|
||||
__enable_weak_this(__r.get());
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
if (__ptr_ == nullptr)
|
||||
__cntrl_ = nullptr;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
typedef __shared_ptr_pointer<_Yp*,
|
||||
reference_wrapper<typename remove_reference<_Dp>::type>,
|
||||
allocator<_Yp> > _CntrlBlk;
|
||||
__cntrl_ = new _CntrlBlk(__r.get(), ref(__r.get_deleter()), allocator<_Yp>());
|
||||
__enable_weak_this(__r.get());
|
||||
}
|
||||
__r.release();
|
||||
}
|
||||
|
||||
@ -4745,8 +4850,8 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
|
||||
{
|
||||
typedef typename common_type<_Tp*, _Up*>::type _V;
|
||||
return less<_V>()(__x.get(), __y.get());
|
||||
typedef typename common_type<_Tp*, _Up*>::type _Vp;
|
||||
return less<_Vp>()(__x.get(), __y.get());
|
||||
}
|
||||
|
||||
template<class _Tp, class _Up>
|
||||
@ -5438,6 +5543,38 @@ undeclare_reachable(_Tp* __p)
|
||||
|
||||
_LIBCPP_FUNC_VIS void* align(size_t __align, size_t __sz, void*& __ptr, size_t& __space);
|
||||
|
||||
// --- Helper for container swap --
|
||||
template <typename _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __swap_allocator(_Alloc & __a1, _Alloc & __a2)
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
_NOEXCEPT
|
||||
#else
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_Alloc>::value)
|
||||
#endif
|
||||
{
|
||||
__swap_allocator(__a1, __a2,
|
||||
integral_constant<bool, _VSTD::allocator_traits<_Alloc>::propagate_on_container_swap::value>());
|
||||
}
|
||||
|
||||
template <typename _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __swap_allocator(_Alloc & __a1, _Alloc & __a2, true_type)
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
_NOEXCEPT
|
||||
#else
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_Alloc>::value)
|
||||
#endif
|
||||
{
|
||||
using _VSTD::swap;
|
||||
swap(__a1, __a2);
|
||||
}
|
||||
|
||||
template <typename _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __swap_allocator(_Alloc &, _Alloc &, false_type) _NOEXCEPT {}
|
||||
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_MEMORY
|
||||
|
@ -469,4 +469,5 @@ module std [system] {
|
||||
module __tree { header "__tree" export * }
|
||||
module __tuple { header "__tuple" export * }
|
||||
module __undef_min_max { header "__undef_min_max" export * }
|
||||
module __undef___deallocate { header "__undef___deallocate" export * }
|
||||
}
|
||||
|
@ -175,6 +175,7 @@ template<class Callable, class ...Args>
|
||||
#include <__config>
|
||||
#include <__mutex_base>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#include <tuple>
|
||||
#endif
|
||||
@ -442,7 +443,11 @@ void call_once(once_flag&, _Callable&&, _Args&&...);
|
||||
|
||||
template<class _Callable>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void call_once(once_flag&, _Callable);
|
||||
void call_once(once_flag&, _Callable&);
|
||||
|
||||
template<class _Callable>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void call_once(once_flag&, const _Callable&);
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
@ -465,7 +470,11 @@ private:
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
template<class _Callable>
|
||||
friend
|
||||
void call_once(once_flag&, _Callable);
|
||||
void call_once(once_flag&, _Callable&);
|
||||
|
||||
template<class _Callable>
|
||||
friend
|
||||
void call_once(once_flag&, const _Callable&);
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
};
|
||||
|
||||
@ -474,15 +483,10 @@ private:
|
||||
template <class _Fp>
|
||||
class __call_once_param
|
||||
{
|
||||
_Fp __f_;
|
||||
_Fp& __f_;
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(_Fp&& __f) : __f_(_VSTD::move(__f)) {}
|
||||
#else
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(const _Fp& __f) : __f_(__f) {}
|
||||
#endif
|
||||
explicit __call_once_param(_Fp& __f) : __f_(__f) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void operator()()
|
||||
@ -496,7 +500,7 @@ private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __execute(__tuple_indices<_Indices...>)
|
||||
{
|
||||
__invoke(_VSTD::move(_VSTD::get<0>(__f_)), _VSTD::move(_VSTD::get<_Indices>(__f_))...);
|
||||
__invoke(_VSTD::get<0>(_VSTD::move(__f_)), _VSTD::get<_Indices>(_VSTD::move(__f_))...);
|
||||
}
|
||||
};
|
||||
|
||||
@ -505,15 +509,10 @@ private:
|
||||
template <class _Fp>
|
||||
class __call_once_param
|
||||
{
|
||||
_Fp __f_;
|
||||
_Fp& __f_;
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(_Fp&& __f) : __f_(_VSTD::move(__f)) {}
|
||||
#else
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(const _Fp& __f) : __f_(__f) {}
|
||||
#endif
|
||||
explicit __call_once_param(_Fp& __f) : __f_(__f) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void operator()()
|
||||
@ -541,11 +540,11 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)
|
||||
{
|
||||
if (__flag.__state_ != ~0ul)
|
||||
if (__libcpp_relaxed_load(&__flag.__state_) != ~0ul)
|
||||
{
|
||||
typedef tuple<typename decay<_Callable>::type, typename decay<_Args>::type...> _Gp;
|
||||
__call_once_param<_Gp> __p(_Gp(__decay_copy(_VSTD::forward<_Callable>(__func)),
|
||||
__decay_copy(_VSTD::forward<_Args>(__args))...));
|
||||
typedef tuple<_Callable&&, _Args&&...> _Gp;
|
||||
_Gp __f(_VSTD::forward<_Callable>(__func), _VSTD::forward<_Args>(__args)...);
|
||||
__call_once_param<_Gp> __p(__f);
|
||||
__call_once(__flag.__state_, &__p, &__call_once_proxy<_Gp>);
|
||||
}
|
||||
}
|
||||
@ -555,15 +554,27 @@ call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)
|
||||
template<class _Callable>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
call_once(once_flag& __flag, _Callable __func)
|
||||
call_once(once_flag& __flag, _Callable& __func)
|
||||
{
|
||||
if (__flag.__state_ != ~0ul)
|
||||
if (__libcpp_relaxed_load(&__flag.__state_) != ~0ul)
|
||||
{
|
||||
__call_once_param<_Callable> __p(__func);
|
||||
__call_once(__flag.__state_, &__p, &__call_once_proxy<_Callable>);
|
||||
}
|
||||
}
|
||||
|
||||
template<class _Callable>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
call_once(once_flag& __flag, const _Callable& __func)
|
||||
{
|
||||
if (__flag.__state_ != ~0ul)
|
||||
{
|
||||
__call_once_param<const _Callable> __p(__func);
|
||||
__call_once(__flag.__state_, &__p, &__call_once_proxy<const _Callable>);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
12
include/new
12
include/new
@ -50,11 +50,13 @@ new_handler get_new_handler() noexcept;
|
||||
void* operator new(std::size_t size); // replaceable
|
||||
void* operator new(std::size_t size, const std::nothrow_t&) noexcept; // replaceable
|
||||
void operator delete(void* ptr) noexcept; // replaceable
|
||||
void operator delete(void* ptr, std::size_t size) noexcept; // replaceable, C++14
|
||||
void operator delete(void* ptr, const std::nothrow_t&) noexcept; // replaceable
|
||||
|
||||
void* operator new[](std::size_t size); // replaceable
|
||||
void* operator new[](std::size_t size, const std::nothrow_t&) noexcept; // replaceable
|
||||
void operator delete[](void* ptr) noexcept; // replaceable
|
||||
void operator delete[](void* ptr, std::size_t size) noexcept; // replaceable, C++14
|
||||
void operator delete[](void* ptr, const std::nothrow_t&) noexcept; // replaceable
|
||||
|
||||
void* operator new (std::size_t size, void* ptr) noexcept;
|
||||
@ -68,6 +70,8 @@ void operator delete[](void* ptr, void*) noexcept;
|
||||
#include <exception>
|
||||
#include <cstddef>
|
||||
|
||||
#include <__undef___deallocate>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
@ -132,6 +136,10 @@ _LIBCPP_NEW_DELETE_VIS void* operator new(std::size_t __sz)
|
||||
_LIBCPP_NEW_DELETE_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
|
||||
_LIBCPP_NEW_DELETE_VIS void operator delete(void* __p) _NOEXCEPT;
|
||||
_LIBCPP_NEW_DELETE_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
|
||||
#if defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER >= 14 || \
|
||||
(defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309)
|
||||
_LIBCPP_NEW_DELETE_VIS void operator delete(void* __p, std::size_t __sz) _NOEXCEPT;
|
||||
#endif
|
||||
|
||||
_LIBCPP_NEW_DELETE_VIS void* operator new[](std::size_t __sz)
|
||||
#if !__has_feature(cxx_noexcept)
|
||||
@ -141,6 +149,10 @@ _LIBCPP_NEW_DELETE_VIS void* operator new[](std::size_t __sz)
|
||||
_LIBCPP_NEW_DELETE_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
|
||||
_LIBCPP_NEW_DELETE_VIS void operator delete[](void* __p) _NOEXCEPT;
|
||||
_LIBCPP_NEW_DELETE_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
|
||||
#if defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER >= 14 || \
|
||||
(defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309)
|
||||
_LIBCPP_NEW_DELETE_VIS void operator delete[](void* __p, std::size_t __sz) _NOEXCEPT;
|
||||
#endif
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;}
|
||||
inline _LIBCPP_INLINE_VISIBILITY void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;}
|
||||
|
@ -1004,7 +1004,7 @@ basic_ostream<_CharT, _Traits>&
|
||||
basic_ostream<_CharT, _Traits>::seekp(pos_type __pos)
|
||||
{
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
if (!this->fail())
|
||||
{
|
||||
if (this->rdbuf()->pubseekpos(__pos, ios_base::out) == pos_type(-1))
|
||||
this->setstate(ios_base::failbit);
|
||||
@ -1018,7 +1018,7 @@ basic_ostream<_CharT, _Traits>&
|
||||
basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir)
|
||||
{
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
if (!this->fail())
|
||||
{
|
||||
if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::out) == pos_type(-1))
|
||||
this->setstate(ios_base::failbit);
|
||||
|
@ -177,7 +177,7 @@ template <class T, class Container, class Compare>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp, class _Container> class _LIBCPP_TYPE_VIS_ONLY queue;
|
||||
template <class _Tp, class _Container = deque<_Tp> > class _LIBCPP_TYPE_VIS_ONLY queue;
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -189,7 +189,7 @@ _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
|
||||
|
||||
template <class _Tp, class _Container = deque<_Tp> >
|
||||
template <class _Tp, class _Container /*= deque<_Tp>*/>
|
||||
class _LIBCPP_TYPE_VIS_ONLY queue
|
||||
{
|
||||
public:
|
||||
|
@ -1634,9 +1634,10 @@ class piecewise_linear_distribution
|
||||
|
||||
#include <__config>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cmath>
|
||||
#include <type_traits>
|
||||
#include <initializer_list>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
@ -1644,7 +1645,6 @@ class piecewise_linear_distribution
|
||||
#include <string>
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
#include <cmath>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
@ -3475,9 +3475,9 @@ typedef shuffle_order_engine<minstd_rand0, 256> knuth_b;
|
||||
|
||||
class _LIBCPP_TYPE_VIS random_device
|
||||
{
|
||||
#if !(defined(_WIN32) || defined(_LIBCPP_USING_NACL_RANDOM))
|
||||
#ifdef _LIBCPP_USING_DEV_RANDOM
|
||||
int __f_;
|
||||
#endif // !(defined(_WIN32) || defined(_LIBCPP_USING_NACL_RANDOM))
|
||||
#endif // defined(_LIBCPP_USING_DEV_RANDOM)
|
||||
public:
|
||||
// types
|
||||
typedef unsigned result_type;
|
||||
|
@ -21,8 +21,8 @@ template <intmax_t N, intmax_t D = 1>
|
||||
class ratio
|
||||
{
|
||||
public:
|
||||
static const intmax_t num;
|
||||
static const intmax_t den;
|
||||
static constexpr intmax_t num;
|
||||
static constexpr intmax_t den;
|
||||
typedef ratio<num, den> type;
|
||||
};
|
||||
|
||||
@ -236,19 +236,22 @@ class _LIBCPP_TYPE_VIS_ONLY ratio
|
||||
static_assert(__static_abs<_Num>::value >= 0, "ratio numerator is out of range");
|
||||
static_assert(_Den != 0, "ratio divide by 0");
|
||||
static_assert(__static_abs<_Den>::value > 0, "ratio denominator is out of range");
|
||||
static const intmax_t __na = __static_abs<_Num>::value;
|
||||
static const intmax_t __da = __static_abs<_Den>::value;
|
||||
static const intmax_t __s = __static_sign<_Num>::value * __static_sign<_Den>::value;
|
||||
static const intmax_t __gcd = __static_gcd<__na, __da>::value;
|
||||
static _LIBCPP_CONSTEXPR const intmax_t __na = __static_abs<_Num>::value;
|
||||
static _LIBCPP_CONSTEXPR const intmax_t __da = __static_abs<_Den>::value;
|
||||
static _LIBCPP_CONSTEXPR const intmax_t __s = __static_sign<_Num>::value * __static_sign<_Den>::value;
|
||||
static _LIBCPP_CONSTEXPR const intmax_t __gcd = __static_gcd<__na, __da>::value;
|
||||
public:
|
||||
static const intmax_t num = __s * __na / __gcd;
|
||||
static const intmax_t den = __da / __gcd;
|
||||
static _LIBCPP_CONSTEXPR const intmax_t num = __s * __na / __gcd;
|
||||
static _LIBCPP_CONSTEXPR const intmax_t den = __da / __gcd;
|
||||
|
||||
typedef ratio<num, den> type;
|
||||
};
|
||||
|
||||
template <intmax_t _Num, intmax_t _Den> const intmax_t ratio<_Num, _Den>::num;
|
||||
template <intmax_t _Num, intmax_t _Den> const intmax_t ratio<_Num, _Den>::den;
|
||||
template <intmax_t _Num, intmax_t _Den>
|
||||
_LIBCPP_CONSTEXPR const intmax_t ratio<_Num, _Den>::num;
|
||||
|
||||
template <intmax_t _Num, intmax_t _Den>
|
||||
_LIBCPP_CONSTEXPR const intmax_t ratio<_Num, _Den>::den;
|
||||
|
||||
template <class _Tp> struct __is_ratio : false_type {};
|
||||
template <intmax_t _Num, intmax_t _Den> struct __is_ratio<ratio<_Num, _Den> > : true_type {};
|
||||
@ -398,11 +401,11 @@ struct _LIBCPP_TYPE_VIS_ONLY ratio_subtract
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_equal
|
||||
: public integral_constant<bool, _R1::num == _R2::num && _R1::den == _R2::den> {};
|
||||
: public _LIBCPP_BOOL_CONSTANT((_R1::num == _R2::num && _R1::den == _R2::den)) {};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_not_equal
|
||||
: public integral_constant<bool, !ratio_equal<_R1, _R2>::value> {};
|
||||
: public _LIBCPP_BOOL_CONSTANT((!ratio_equal<_R1, _R2>::value)) {};
|
||||
|
||||
// ratio_less
|
||||
|
||||
@ -461,19 +464,19 @@ struct __ratio_less<_R1, _R2, -1LL, -1LL>
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_less
|
||||
: public integral_constant<bool, __ratio_less<_R1, _R2>::value> {};
|
||||
: public _LIBCPP_BOOL_CONSTANT((__ratio_less<_R1, _R2>::value)) {};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_less_equal
|
||||
: public integral_constant<bool, !ratio_less<_R2, _R1>::value> {};
|
||||
: public _LIBCPP_BOOL_CONSTANT((!ratio_less<_R2, _R1>::value)) {};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_greater
|
||||
: public integral_constant<bool, ratio_less<_R2, _R1>::value> {};
|
||||
: public _LIBCPP_BOOL_CONSTANT((ratio_less<_R2, _R1>::value)) {};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY ratio_greater_equal
|
||||
: public integral_constant<bool, !ratio_less<_R1, _R2>::value> {};
|
||||
: public _LIBCPP_BOOL_CONSTANT((!ratio_less<_R1, _R2>::value)) {};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct __ratio_gcd
|
||||
|
@ -1947,7 +1947,8 @@ template <class _CharT>
|
||||
void
|
||||
__l_anchor<_CharT>::__exec(__state& __s) const
|
||||
{
|
||||
if (__s.__at_first_ && __s.__current_ == __s.__first_)
|
||||
if (__s.__at_first_ && __s.__current_ == __s.__first_ &&
|
||||
!(__s.__flags_ & regex_constants::match_not_bol))
|
||||
{
|
||||
__s.__do_ = __state::__accept_but_not_consume;
|
||||
__s.__node_ = this->first();
|
||||
@ -1981,7 +1982,8 @@ template <class _CharT>
|
||||
void
|
||||
__r_anchor<_CharT>::__exec(__state& __s) const
|
||||
{
|
||||
if (__s.__current_ == __s.__last_)
|
||||
if (__s.__current_ == __s.__last_ &&
|
||||
!(__s.__flags_ & regex_constants::match_not_eol))
|
||||
{
|
||||
__s.__do_ = __state::__accept_but_not_consume;
|
||||
__s.__node_ = this->first();
|
||||
@ -2599,9 +2601,7 @@ public:
|
||||
assign(_ForwardIterator __first, _ForwardIterator __last,
|
||||
flag_type __f = regex_constants::ECMAScript)
|
||||
{
|
||||
__member_init(__f);
|
||||
__parse(__first, __last);
|
||||
return *this;
|
||||
return assign(basic_regex(__first, __last, __f));
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
@ -5603,12 +5603,17 @@ basic_regex<_CharT, _Traits>::__match_at_start_ecma(
|
||||
__node* __st = __start_.get();
|
||||
if (__st)
|
||||
{
|
||||
sub_match<const _CharT*> __unmatched;
|
||||
__unmatched.first = __last;
|
||||
__unmatched.second = __last;
|
||||
__unmatched.matched = false;
|
||||
|
||||
__states.push_back(__state());
|
||||
__states.back().__do_ = 0;
|
||||
__states.back().__first_ = __first;
|
||||
__states.back().__current_ = __first;
|
||||
__states.back().__last_ = __last;
|
||||
__states.back().__sub_matches_.resize(mark_count());
|
||||
__states.back().__sub_matches_.resize(mark_count(), __unmatched);
|
||||
__states.back().__loop_data_.resize(__loop_count());
|
||||
__states.back().__node_ = __st;
|
||||
__states.back().__flags_ = __flags;
|
||||
@ -5748,12 +5753,17 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
|
||||
__node* __st = __start_.get();
|
||||
if (__st)
|
||||
{
|
||||
sub_match<const _CharT*> __unmatched;
|
||||
__unmatched.first = __last;
|
||||
__unmatched.second = __last;
|
||||
__unmatched.matched = false;
|
||||
|
||||
__states.push_back(__state());
|
||||
__states.back().__do_ = 0;
|
||||
__states.back().__first_ = __first;
|
||||
__states.back().__current_ = __first;
|
||||
__states.back().__last_ = __last;
|
||||
__states.back().__sub_matches_.resize(mark_count());
|
||||
__states.back().__sub_matches_.resize(mark_count(), __unmatched);
|
||||
__states.back().__loop_data_.resize(__loop_count());
|
||||
__states.back().__node_ = __st;
|
||||
__states.back().__flags_ = __flags;
|
||||
|
@ -38,6 +38,7 @@ public:
|
||||
typedef see below propagate_on_container_copy_assignment;
|
||||
typedef see below propagate_on_container_move_assignment;
|
||||
typedef see below propagate_on_container_swap;
|
||||
typedef see below is_always_equal;
|
||||
|
||||
template <class Tp>
|
||||
struct rebind
|
||||
@ -170,6 +171,22 @@ struct __get_poc_swap<_A0, _Allocs...>
|
||||
__get_poc_swap<_Allocs...>::value;
|
||||
};
|
||||
|
||||
template <class ..._Allocs> struct __get_is_always_equal;
|
||||
|
||||
template <class _A0>
|
||||
struct __get_is_always_equal<_A0>
|
||||
{
|
||||
static const bool value = allocator_traits<_A0>::is_always_equal::value;
|
||||
};
|
||||
|
||||
template <class _A0, class ..._Allocs>
|
||||
struct __get_is_always_equal<_A0, _Allocs...>
|
||||
{
|
||||
static const bool value =
|
||||
allocator_traits<_A0>::is_always_equal::value &&
|
||||
__get_is_always_equal<_Allocs...>::value;
|
||||
};
|
||||
|
||||
template <class ..._Allocs>
|
||||
class __scoped_allocator_storage;
|
||||
|
||||
@ -397,6 +414,11 @@ public:
|
||||
bool,
|
||||
__get_poc_swap<outer_allocator_type, _InnerAllocs...>::value
|
||||
> propagate_on_container_swap;
|
||||
typedef integral_constant
|
||||
<
|
||||
bool,
|
||||
__get_is_always_equal<outer_allocator_type, _InnerAllocs...>::value
|
||||
> is_always_equal;
|
||||
|
||||
template <class _Tp>
|
||||
struct rebind
|
||||
|
@ -116,6 +116,7 @@ public:
|
||||
void insert(initializer_list<value_type> il);
|
||||
|
||||
iterator erase(const_iterator position);
|
||||
iterator erase(iterator position); // C++14
|
||||
size_type erase(const key_type& k);
|
||||
iterator erase(const_iterator first, const_iterator last);
|
||||
void clear() noexcept;
|
||||
@ -297,6 +298,7 @@ public:
|
||||
void insert(initializer_list<value_type> il);
|
||||
|
||||
iterator erase(const_iterator position);
|
||||
iterator erase(iterator position); // C++14
|
||||
size_type erase(const key_type& k);
|
||||
iterator erase(const_iterator first, const_iterator last);
|
||||
void clear() noexcept;
|
||||
|
@ -19,6 +19,29 @@
|
||||
namespace std
|
||||
{
|
||||
|
||||
class shared_mutex // C++17
|
||||
{
|
||||
public:
|
||||
shared_mutex();
|
||||
~shared_mutex();
|
||||
|
||||
shared_mutex(const shared_mutex&) = delete;
|
||||
shared_mutex& operator=(const shared_mutex&) = delete;
|
||||
|
||||
// Exclusive ownership
|
||||
void lock(); // blocking
|
||||
bool try_lock();
|
||||
void unlock();
|
||||
|
||||
// Shared ownership
|
||||
void lock_shared(); // blocking
|
||||
bool try_lock_shared();
|
||||
void unlock_shared();
|
||||
|
||||
typedef implementation-defined native_handle_type; // See 30.2.3
|
||||
native_handle_type native_handle(); // See 30.2.3
|
||||
};
|
||||
|
||||
class shared_timed_mutex
|
||||
{
|
||||
public:
|
||||
@ -118,7 +141,7 @@ template <class Mutex>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class _LIBCPP_TYPE_VIS shared_timed_mutex
|
||||
struct _LIBCPP_TYPE_VIS __shared_mutex_base
|
||||
{
|
||||
mutex __mut_;
|
||||
condition_variable __gate1_;
|
||||
@ -127,6 +150,58 @@ class _LIBCPP_TYPE_VIS shared_timed_mutex
|
||||
|
||||
static const unsigned __write_entered_ = 1U << (sizeof(unsigned)*__CHAR_BIT__ - 1);
|
||||
static const unsigned __n_readers_ = ~__write_entered_;
|
||||
|
||||
__shared_mutex_base();
|
||||
_LIBCPP_INLINE_VISIBILITY ~__shared_mutex_base() = default;
|
||||
|
||||
__shared_mutex_base(const __shared_mutex_base&) = delete;
|
||||
__shared_mutex_base& operator=(const __shared_mutex_base&) = delete;
|
||||
|
||||
// Exclusive ownership
|
||||
void lock(); // blocking
|
||||
bool try_lock();
|
||||
void unlock();
|
||||
|
||||
// Shared ownership
|
||||
void lock_shared(); // blocking
|
||||
bool try_lock_shared();
|
||||
void unlock_shared();
|
||||
|
||||
// typedef implementation-defined native_handle_type; // See 30.2.3
|
||||
// native_handle_type native_handle(); // See 30.2.3
|
||||
};
|
||||
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
class _LIBCPP_TYPE_VIS shared_mutex
|
||||
{
|
||||
__shared_mutex_base __base;
|
||||
public:
|
||||
shared_mutex() : __base() {}
|
||||
_LIBCPP_INLINE_VISIBILITY ~shared_mutex() = default;
|
||||
|
||||
shared_mutex(const shared_mutex&) = delete;
|
||||
shared_mutex& operator=(const shared_mutex&) = delete;
|
||||
|
||||
// Exclusive ownership
|
||||
_LIBCPP_INLINE_VISIBILITY void lock() { return __base.lock(); }
|
||||
_LIBCPP_INLINE_VISIBILITY bool try_lock() { return __base.try_lock(); }
|
||||
_LIBCPP_INLINE_VISIBILITY void unlock() { return __base.unlock(); }
|
||||
|
||||
// Shared ownership
|
||||
_LIBCPP_INLINE_VISIBILITY void lock_shared() { return __base.lock_shared(); }
|
||||
_LIBCPP_INLINE_VISIBILITY bool try_lock_shared() { return __base.try_lock_shared(); }
|
||||
_LIBCPP_INLINE_VISIBILITY void unlock_shared() { return __base.unlock_shared(); }
|
||||
|
||||
// typedef __shared_mutex_base::native_handle_type native_handle_type;
|
||||
// _LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() { return __base::unlock_shared(); }
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
class _LIBCPP_TYPE_VIS shared_timed_mutex
|
||||
{
|
||||
__shared_mutex_base __base;
|
||||
public:
|
||||
shared_timed_mutex();
|
||||
_LIBCPP_INLINE_VISIBILITY ~shared_timed_mutex() = default;
|
||||
@ -170,29 +245,30 @@ bool
|
||||
shared_timed_mutex::try_lock_until(
|
||||
const chrono::time_point<_Clock, _Duration>& __abs_time)
|
||||
{
|
||||
unique_lock<mutex> __lk(__mut_);
|
||||
if (__state_ & __write_entered_)
|
||||
unique_lock<mutex> __lk(__base.__mut_);
|
||||
if (__base.__state_ & __base.__write_entered_)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
cv_status __status = __gate1_.wait_until(__lk, __abs_time);
|
||||
if ((__state_ & __write_entered_) == 0)
|
||||
cv_status __status = __base.__gate1_.wait_until(__lk, __abs_time);
|
||||
if ((__base.__state_ & __base.__write_entered_) == 0)
|
||||
break;
|
||||
if (__status == cv_status::timeout)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
__state_ |= __write_entered_;
|
||||
if (__state_ & __n_readers_)
|
||||
__base.__state_ |= __base.__write_entered_;
|
||||
if (__base.__state_ & __base.__n_readers_)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
cv_status __status = __gate2_.wait_until(__lk, __abs_time);
|
||||
if ((__state_ & __n_readers_) == 0)
|
||||
cv_status __status = __base.__gate2_.wait_until(__lk, __abs_time);
|
||||
if ((__base.__state_ & __base.__n_readers_) == 0)
|
||||
break;
|
||||
if (__status == cv_status::timeout)
|
||||
{
|
||||
__state_ &= ~__write_entered_;
|
||||
__base.__state_ &= ~__base.__write_entered_;
|
||||
__base.__gate1_.notify_all();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -205,22 +281,22 @@ bool
|
||||
shared_timed_mutex::try_lock_shared_until(
|
||||
const chrono::time_point<_Clock, _Duration>& __abs_time)
|
||||
{
|
||||
unique_lock<mutex> __lk(__mut_);
|
||||
if ((__state_ & __write_entered_) || (__state_ & __n_readers_) == __n_readers_)
|
||||
unique_lock<mutex> __lk(__base.__mut_);
|
||||
if ((__base.__state_ & __base.__write_entered_) || (__base.__state_ & __base.__n_readers_) == __base.__n_readers_)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
cv_status status = __gate1_.wait_until(__lk, __abs_time);
|
||||
if ((__state_ & __write_entered_) == 0 &&
|
||||
(__state_ & __n_readers_) < __n_readers_)
|
||||
cv_status status = __base.__gate1_.wait_until(__lk, __abs_time);
|
||||
if ((__base.__state_ & __base.__write_entered_) == 0 &&
|
||||
(__base.__state_ & __base.__n_readers_) < __base.__n_readers_)
|
||||
break;
|
||||
if (status == cv_status::timeout)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
unsigned __num_readers = (__state_ & __n_readers_) + 1;
|
||||
__state_ &= ~__n_readers_;
|
||||
__state_ |= __num_readers;
|
||||
unsigned __num_readers = (__base.__state_ & __base.__n_readers_) + 1;
|
||||
__base.__state_ &= ~__base.__n_readers_;
|
||||
__base.__state_ |= __num_readers;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ template <class T, class Container>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp, class _Container> class _LIBCPP_TYPE_VIS_ONLY stack;
|
||||
template <class _Tp, class _Container = deque<_Tp> > class _LIBCPP_TYPE_VIS_ONLY stack;
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -103,7 +103,7 @@ _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
|
||||
|
||||
template <class _Tp, class _Container = deque<_Tp> >
|
||||
template <class _Tp, class _Container /*= deque<_Tp>*/>
|
||||
class _LIBCPP_TYPE_VIS_ONLY stack
|
||||
{
|
||||
public:
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
#ifndef _LIBCPP___REFSTRING
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
class _LIBCPP_HIDDEN __libcpp_refstring {
|
||||
const char *__imp_;
|
||||
const char *__imp_ _LIBCPP_UNUSED;
|
||||
};
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
#endif
|
||||
|
@ -536,12 +536,23 @@ basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n)
|
||||
{
|
||||
streamsize __i = 0;
|
||||
int_type __eof = traits_type::eof();
|
||||
for (; __i < __n; ++__s, ++__i)
|
||||
while( __i < __n)
|
||||
{
|
||||
if (__nout_ < __eout_)
|
||||
*__nout_++ = *__s;
|
||||
else if (overflow(traits_type::to_int_type(*__s)) == __eof)
|
||||
break;
|
||||
if (__nout_ >= __eout_)
|
||||
{
|
||||
if (overflow(traits_type::to_int_type(*__s)) == __eof)
|
||||
break;
|
||||
++__s;
|
||||
++__i;
|
||||
}
|
||||
else
|
||||
{
|
||||
streamsize __chunk_size = _VSTD::min(__eout_ - __nout_, __n - __i);
|
||||
traits_type::copy(__nout_, __s, __chunk_size);
|
||||
__nout_ += __chunk_size;
|
||||
__s += __chunk_size;
|
||||
__i += __chunk_size;
|
||||
}
|
||||
}
|
||||
return __i;
|
||||
}
|
||||
|
@ -220,8 +220,8 @@ public:
|
||||
basic_string substr(size_type pos = 0, size_type n = npos) const;
|
||||
|
||||
void swap(basic_string& str)
|
||||
noexcept(!allocator_type::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value)
|
||||
noexcept(allocator_traits<allocator_type>::propagate_on_container_swap::value ||
|
||||
allocator_traits<allocator_type>::is_always_equal::value); // C++17
|
||||
|
||||
const value_type* c_str() const noexcept;
|
||||
const value_type* data() const noexcept;
|
||||
@ -636,19 +636,19 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<char>
|
||||
{return (unsigned char)__c1 < (unsigned char)__c2;}
|
||||
|
||||
static inline int compare(const char_type* __s1, const char_type* __s2, size_t __n)
|
||||
{return memcmp(__s1, __s2, __n);}
|
||||
{return __n == 0 ? 0 : memcmp(__s1, __s2, __n);}
|
||||
static inline size_t length(const char_type* __s) {return strlen(__s);}
|
||||
static inline const char_type* find(const char_type* __s, size_t __n, const char_type& __a)
|
||||
{return (const char_type*)memchr(__s, to_int_type(__a), __n);}
|
||||
{return __n == 0 ? NULL : (const char_type*) memchr(__s, to_int_type(__a), __n);}
|
||||
static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n)
|
||||
{return (char_type*)memmove(__s1, __s2, __n);}
|
||||
{return __n == 0 ? __s1 : (char_type*) memmove(__s1, __s2, __n);}
|
||||
static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n)
|
||||
{
|
||||
_LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
|
||||
return (char_type*)memcpy(__s1, __s2, __n);
|
||||
return __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n);
|
||||
}
|
||||
static inline char_type* assign(char_type* __s, size_t __n, char_type __a)
|
||||
{return (char_type*)memset(__s, to_int_type(__a), __n);}
|
||||
{return __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n);}
|
||||
|
||||
static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
|
||||
@ -681,20 +681,20 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<wchar_t>
|
||||
{return __c1 < __c2;}
|
||||
|
||||
static inline int compare(const char_type* __s1, const char_type* __s2, size_t __n)
|
||||
{return wmemcmp(__s1, __s2, __n);}
|
||||
{return __n == 0 ? 0 : wmemcmp(__s1, __s2, __n);}
|
||||
static inline size_t length(const char_type* __s)
|
||||
{return wcslen(__s);}
|
||||
static inline const char_type* find(const char_type* __s, size_t __n, const char_type& __a)
|
||||
{return (const char_type*)wmemchr(__s, __a, __n);}
|
||||
{return __n == 0 ? NULL : (const char_type*)wmemchr(__s, __a, __n);}
|
||||
static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n)
|
||||
{return (char_type*)wmemmove(__s1, __s2, __n);}
|
||||
{return __n == 0 ? __s1 : (char_type*)wmemmove(__s1, __s2, __n);}
|
||||
static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n)
|
||||
{
|
||||
_LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
|
||||
return (char_type*)wmemcpy(__s1, __s2, __n);
|
||||
return __n == 0 ? __s1 : (char_type*)wmemcpy(__s1, __s2, __n);
|
||||
}
|
||||
static inline char_type* assign(char_type* __s, size_t __n, char_type __a)
|
||||
{return (char_type*)wmemset(__s, __a, __n);}
|
||||
{return __n == 0 ? __s : (char_type*)wmemset(__s, __a, __n);}
|
||||
|
||||
static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
|
||||
@ -1322,13 +1322,26 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY basic_string()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
|
||||
_LIBCPP_INLINE_VISIBILITY explicit basic_string(const allocator_type& __a);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY explicit basic_string(const allocator_type& __a)
|
||||
#if _LIBCPP_STD_VER <= 14
|
||||
_NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value);
|
||||
#else
|
||||
_NOEXCEPT;
|
||||
#endif
|
||||
|
||||
basic_string(const basic_string& __str);
|
||||
basic_string(const basic_string& __str, const allocator_type& __a);
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(basic_string&& __str)
|
||||
#if _LIBCPP_STD_VER <= 14
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
|
||||
#else
|
||||
_NOEXCEPT;
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string(basic_string&& __str, const allocator_type& __a);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@ -1591,8 +1604,12 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(basic_string& __str)
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value);
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
_NOEXCEPT;
|
||||
#else
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value);
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const value_type* c_str() const _NOEXCEPT {return data();}
|
||||
@ -1855,24 +1872,6 @@ private:
|
||||
_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&, allocator_type&, false_type) _NOEXCEPT
|
||||
{}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
|
||||
_LIBCPP_INLINE_VISIBILITY void __invalidate_iterators_past(size_type);
|
||||
|
||||
@ -2070,7 +2069,11 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str)
|
||||
#if _LIBCPP_STD_VER <= 14
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
|
||||
#else
|
||||
_NOEXCEPT
|
||||
#endif
|
||||
: __r_(_VSTD::move(__str.__r_))
|
||||
{
|
||||
__str.__zero();
|
||||
@ -3349,8 +3352,12 @@ template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value)
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
_NOEXCEPT
|
||||
#else
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value)
|
||||
#endif
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
if (!__is_long())
|
||||
@ -3360,7 +3367,7 @@ basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
|
||||
__get_db()->swap(this, &__str);
|
||||
#endif
|
||||
_VSTD::swap(__r_.first(), __str.__r_.first());
|
||||
__swap_alloc(__alloc(), __str.__alloc());
|
||||
__swap_allocator(__alloc(), __str.__alloc());
|
||||
}
|
||||
|
||||
// find
|
||||
|
31
include/support/android/locale_bionic.h
Normal file
31
include/support/android/locale_bionic.h
Normal file
@ -0,0 +1,31 @@
|
||||
// -*- C++ -*-
|
||||
//===------------------- support/android/locale_bionic.h ------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_H
|
||||
#define _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_H
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <xlocale.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
// Share implementation with Newlib
|
||||
#include <support/xlocale/xlocale.h>
|
||||
|
||||
#endif // defined(__ANDROID__)
|
||||
#endif // _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_H
|
99
include/support/ibm/limits.h
Normal file
99
include/support/ibm/limits.h
Normal file
@ -0,0 +1,99 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------- support/ibm/limits.h ---------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_SUPPORT_IBM_LIMITS_H
|
||||
#define _LIBCPP_SUPPORT_IBM_LIMITS_H
|
||||
|
||||
#if !defined(_AIX) // Linux
|
||||
#include <math.h> // for HUGE_VAL, HUGE_VALF, HUGE_VALL, and NAN
|
||||
|
||||
static const unsigned int _QNAN_F = 0x7fc00000;
|
||||
#define NANF (*((float *)(&_QNAN_F)))
|
||||
static const unsigned int _QNAN_LDBL128[4] = {0x7ff80000, 0x0, 0x0, 0x0};
|
||||
#define NANL (*((long double *)(&_QNAN_LDBL128)))
|
||||
static const unsigned int _SNAN_F= 0x7f855555;
|
||||
#define NANSF (*((float *)(&_SNAN_F)))
|
||||
static const unsigned int _SNAN_D[2] = {0x7ff55555, 0x55555555};
|
||||
#define NANS (*((double *)(&_SNAN_D)))
|
||||
static const unsigned int _SNAN_LDBL128[4] = {0x7ff55555, 0x55555555, 0x0, 0x0};
|
||||
#define NANSL (*((long double *)(&_SNAN_LDBL128)))
|
||||
|
||||
#define __builtin_huge_val() HUGE_VAL
|
||||
#define __builtin_huge_valf() HUGE_VALF
|
||||
#define __builtin_huge_vall() HUGE_VALL
|
||||
#define __builtin_nan(__dummy) NAN
|
||||
#define __builtin_nanf(__dummy) NANF
|
||||
#define __builtin_nanl(__dummy) NANL
|
||||
#define __builtin_nans(__dummy) NANS
|
||||
#define __builtin_nansf(__dummy) NANSF
|
||||
#define __builtin_nansl(__dummy) NANSL
|
||||
|
||||
#else
|
||||
|
||||
#include <math.h>
|
||||
#include <float.h> // limit constants
|
||||
|
||||
#define __builtin_huge_val() HUGE_VAL //0x7ff0000000000000
|
||||
#define __builtin_huge_valf() HUGE_VALF //0x7f800000
|
||||
#define __builtin_huge_vall() HUGE_VALL //0x7ff0000000000000
|
||||
#define __builtin_nan(__dummy) nan(__dummy) //0x7ff8000000000000
|
||||
#define __builtin_nanf(__dummy) nanf(__dummy) // 0x7ff80000
|
||||
#define __builtin_nanl(__dummy) nanl(__dummy) //0x7ff8000000000000
|
||||
#define __builtin_nans(__dummy) DBL_SNAN //0x7ff5555555555555
|
||||
#define __builtin_nansf(__dummy) FLT_SNAN //0x7f855555
|
||||
#define __builtin_nansl(__dummy) DBL_SNAN //0x7ff5555555555555
|
||||
|
||||
#define __FLT_MANT_DIG__ FLT_MANT_DIG
|
||||
#define __FLT_DIG__ FLT_DIG
|
||||
#define __FLT_RADIX__ FLT_RADIX
|
||||
#define __FLT_MIN_EXP__ FLT_MIN_EXP
|
||||
#define __FLT_MIN_10_EXP__ FLT_MIN_10_EXP
|
||||
#define __FLT_MAX_EXP__ FLT_MAX_EXP
|
||||
#define __FLT_MAX_10_EXP__ FLT_MAX_10_EXP
|
||||
#define __FLT_MIN__ FLT_MIN
|
||||
#define __FLT_MAX__ FLT_MAX
|
||||
#define __FLT_EPSILON__ FLT_EPSILON
|
||||
// predefined by XLC on LoP
|
||||
#define __FLT_DENORM_MIN__ 1.40129846e-45F
|
||||
|
||||
#define __DBL_MANT_DIG__ DBL_MANT_DIG
|
||||
#define __DBL_DIG__ DBL_DIG
|
||||
#define __DBL_MIN_EXP__ DBL_MIN_EXP
|
||||
#define __DBL_MIN_10_EXP__ DBL_MIN_10_EXP
|
||||
#define __DBL_MAX_EXP__ DBL_MAX_EXP
|
||||
#define __DBL_MAX_10_EXP__ DBL_MAX_10_EXP
|
||||
#define __DBL_MIN__ DBL_MIN
|
||||
#define __DBL_MAX__ DBL_MAX
|
||||
#define __DBL_EPSILON__ DBL_EPSILON
|
||||
// predefined by XLC on LoP
|
||||
#define __DBL_DENORM_MIN__ 4.9406564584124654e-324
|
||||
|
||||
#define __LDBL_MANT_DIG__ LDBL_MANT_DIG
|
||||
#define __LDBL_DIG__ LDBL_DIG
|
||||
#define __LDBL_MIN_EXP__ LDBL_MIN_EXP
|
||||
#define __LDBL_MIN_10_EXP__ LDBL_MIN_10_EXP
|
||||
#define __LDBL_MAX_EXP__ LDBL_MAX_EXP
|
||||
#define __LDBL_MAX_10_EXP__ LDBL_MAX_10_EXP
|
||||
#define __LDBL_MIN__ LDBL_MIN
|
||||
#define __LDBL_MAX__ LDBL_MAX
|
||||
#define __LDBL_EPSILON__ LDBL_EPSILON
|
||||
// predefined by XLC on LoP
|
||||
#if __LONGDOUBLE128
|
||||
#define __LDBL_DENORM_MIN__ 4.94065645841246544176568792868221e-324L
|
||||
#else
|
||||
#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L
|
||||
#endif
|
||||
|
||||
// predefined by XLC on LoP
|
||||
#define __CHAR_BIT__ 8
|
||||
|
||||
#endif // _AIX
|
||||
|
||||
#endif // _LIBCPP_SUPPORT_IBM_LIMITS_H
|
54
include/support/ibm/support.h
Normal file
54
include/support/ibm/support.h
Normal file
@ -0,0 +1,54 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------- support/ibm/support.h ----------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_SUPPORT_IBM_SUPPORT_H
|
||||
#define _LIBCPP_SUPPORT_IBM_SUPPORT_H
|
||||
|
||||
extern "builtin" int __popcnt4(unsigned int);
|
||||
extern "builtin" int __popcnt8(unsigned long long);
|
||||
extern "builtin" unsigned int __cnttz4(unsigned int);
|
||||
extern "builtin" unsigned int __cnttz8(unsigned long long);
|
||||
extern "builtin" unsigned int __cntlz4(unsigned int);
|
||||
extern "builtin" unsigned int __cntlz8(unsigned long long);
|
||||
|
||||
// Builtin functions for counting population
|
||||
#define __builtin_popcount(x) __popcnt4(x)
|
||||
#define __builtin_popcountll(x) __popcnt8(x)
|
||||
#if defined(__64BIT__)
|
||||
#define __builtin_popcountl(x) __builtin_popcountll(x)
|
||||
#else
|
||||
#define __builtin_popcountl(x) __builtin_popcount(x)
|
||||
#endif
|
||||
|
||||
// Builtin functions for counting trailing zeros
|
||||
#define __builtin_ctz(x) __cnttz4(x)
|
||||
#define __builtin_ctzll(x) __cnttz8(x)
|
||||
#if defined(__64BIT__)
|
||||
#define __builtin_ctzl(x) __builtin_ctzll(x)
|
||||
#else
|
||||
#define __builtin_ctzl(x) __builtin_ctz(x)
|
||||
#endif
|
||||
|
||||
// Builtin functions for counting leading zeros
|
||||
#define __builtin_clz(x) __cntlz4(x)
|
||||
#define __builtin_clzll(x) __cntlz8(x)
|
||||
#if defined(__64BIT__)
|
||||
#define __builtin_clzl(x) __builtin_clzll(x)
|
||||
#else
|
||||
#define __builtin_clzl(x) __builtin_clz(x)
|
||||
#endif
|
||||
|
||||
#if defined(__64BIT__)
|
||||
#define __SIZE_WIDTH__ 64
|
||||
#else
|
||||
#define __SIZE_WIDTH__ 32
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_SUPPORT_IBM_SUPPORT_H
|
326
include/support/ibm/xlocale.h
Normal file
326
include/support/ibm/xlocale.h
Normal file
@ -0,0 +1,326 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------- support/ibm/xlocale.h -------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_SUPPORT_IBM_XLOCALE_H
|
||||
#define _LIBCPP_SUPPORT_IBM_XLOCALE_H
|
||||
|
||||
#if defined(_AIX)
|
||||
#include "cstdlib"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined(_AIX71)
|
||||
// AIX 7.1 and higher has these definitions. Definitions and stubs
|
||||
// are provied here as a temporary workaround on AIX 6.1.
|
||||
|
||||
#define LC_COLLATE_MASK 1
|
||||
#define LC_CTYPE_MASK 2
|
||||
#define LC_MESSAGES_MASK 4
|
||||
#define LC_MONETARY_MASK 8
|
||||
#define LC_NUMERIC_MASK 16
|
||||
#define LC_TIME_MASK 32
|
||||
#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | \
|
||||
LC_MESSAGES_MASK | LC_MONETARY_MASK |\
|
||||
LC_NUMERIC_MASK | LC_TIME_MASK)
|
||||
|
||||
typedef void* locale_t;
|
||||
|
||||
// The following are stubs. They are not supported on AIX 6.1.
|
||||
static inline
|
||||
locale_t newlocale(int category_mask, const char *locale, locale_t base)
|
||||
{
|
||||
_LC_locale_t *newloc, *loc;
|
||||
if ((loc = (_LC_locale_t *)__xopen_locale(locale)) == NULL)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return (locale_t)0;
|
||||
}
|
||||
if ((newloc = (_LC_locale_t *)calloc(1, sizeof(_LC_locale_t))) == NULL)
|
||||
{
|
||||
errno = ENOMEM;
|
||||
return (locale_t)0;
|
||||
}
|
||||
if (!base)
|
||||
base = (_LC_locale_t *)__xopen_locale("C");
|
||||
memcpy(newloc, base, sizeof (_LC_locale_t));
|
||||
if (category_mask & LC_COLLATE_MASK)
|
||||
newloc->lc_collate = loc->lc_collate;
|
||||
if (category_mask & LC_CTYPE_MASK)
|
||||
newloc->lc_ctype = loc->lc_ctype;
|
||||
//if (category_mask & LC_MESSAGES_MASK)
|
||||
// newloc->lc_messages = loc->lc_messages;
|
||||
if (category_mask & LC_MONETARY_MASK)
|
||||
newloc->lc_monetary = loc->lc_monetary;
|
||||
if (category_mask & LC_TIME_MASK)
|
||||
newloc->lc_time = loc->lc_time;
|
||||
if (category_mask & LC_NUMERIC_MASK)
|
||||
newloc->lc_numeric = loc->lc_numeric;
|
||||
return (locale_t)newloc;
|
||||
}
|
||||
static inline
|
||||
void freelocale(locale_t locobj)
|
||||
{
|
||||
free(locobj);
|
||||
}
|
||||
static inline
|
||||
locale_t uselocale(locale_t newloc)
|
||||
{
|
||||
return (locale_t)0;
|
||||
}
|
||||
|
||||
static inline
|
||||
int isalnum_l(int c, locale_t locale)
|
||||
{
|
||||
return __xisalnum(locale, c);
|
||||
}
|
||||
static inline
|
||||
int isalpha_l(int c, locale_t locale)
|
||||
{
|
||||
return __xisalpha(locale, c);
|
||||
}
|
||||
static inline
|
||||
int isblank_l(int c, locale_t locale)
|
||||
{
|
||||
return __xisblank(locale, c);
|
||||
}
|
||||
static inline
|
||||
int iscntrl_l(int c, locale_t locale)
|
||||
{
|
||||
return __xiscntrl(locale, c);
|
||||
}
|
||||
static inline
|
||||
int isdigit_l(int c, locale_t locale)
|
||||
{
|
||||
return __xisdigit(locale, c);
|
||||
}
|
||||
static inline
|
||||
int isgraph_l(int c, locale_t locale)
|
||||
{
|
||||
return __xisgraph(locale, c);
|
||||
}
|
||||
static inline
|
||||
int islower_l(int c, locale_t locale)
|
||||
{
|
||||
return __xislower(locale, c);
|
||||
}
|
||||
static inline
|
||||
int isprint_l(int c, locale_t locale)
|
||||
{
|
||||
return __xisprint(locale, c);
|
||||
}
|
||||
|
||||
static inline
|
||||
int ispunct_l(int c, locale_t locale)
|
||||
{
|
||||
return __xispunct(locale, c);
|
||||
}
|
||||
static inline
|
||||
int isspace_l(int c, locale_t locale)
|
||||
{
|
||||
return __xisspace(locale, c);
|
||||
}
|
||||
static inline
|
||||
int isupper_l(int c, locale_t locale)
|
||||
{
|
||||
return __xisupper(locale, c);
|
||||
}
|
||||
|
||||
static inline
|
||||
int isxdigit_l(int c, locale_t locale)
|
||||
{
|
||||
return __xisxdigit(locale, c);
|
||||
}
|
||||
|
||||
static inline
|
||||
int iswalnum_l(wchar_t wc, locale_t locale)
|
||||
{
|
||||
return __xiswalnum(locale, wc);
|
||||
}
|
||||
|
||||
static inline
|
||||
int iswalpha_l(wchar_t wc, locale_t locale)
|
||||
{
|
||||
return __xiswalpha(locale, wc);
|
||||
}
|
||||
|
||||
static inline
|
||||
int iswblank_l(wchar_t wc, locale_t locale)
|
||||
{
|
||||
return __xiswblank(locale, wc);
|
||||
}
|
||||
|
||||
static inline
|
||||
int iswcntrl_l(wchar_t wc, locale_t locale)
|
||||
{
|
||||
return __xiswcntrl(locale, wc);
|
||||
}
|
||||
|
||||
static inline
|
||||
int iswdigit_l(wchar_t wc, locale_t locale)
|
||||
{
|
||||
return __xiswdigit(locale, wc);
|
||||
}
|
||||
|
||||
static inline
|
||||
int iswgraph_l(wchar_t wc, locale_t locale)
|
||||
{
|
||||
return __xiswgraph(locale, wc);
|
||||
}
|
||||
|
||||
static inline
|
||||
int iswlower_l(wchar_t wc, locale_t locale)
|
||||
{
|
||||
return __xiswlower(locale, wc);
|
||||
}
|
||||
|
||||
static inline
|
||||
int iswprint_l(wchar_t wc, locale_t locale)
|
||||
{
|
||||
return __xiswprint(locale, wc);
|
||||
}
|
||||
|
||||
static inline
|
||||
int iswpunct_l(wchar_t wc, locale_t locale)
|
||||
{
|
||||
return __xiswpunct(locale, wc);
|
||||
}
|
||||
|
||||
static inline
|
||||
int iswspace_l(wchar_t wc, locale_t locale)
|
||||
{
|
||||
return __xiswspace(locale, wc);
|
||||
}
|
||||
|
||||
static inline
|
||||
int iswupper_l(wchar_t wc, locale_t locale)
|
||||
{
|
||||
return __xiswupper(locale, wc);
|
||||
}
|
||||
|
||||
static inline
|
||||
int iswxdigit_l(wchar_t wc, locale_t locale)
|
||||
{
|
||||
return __xiswxdigit(locale, wc);
|
||||
}
|
||||
|
||||
static inline
|
||||
int iswctype_l(wint_t wc, wctype_t desc, locale_t locale)
|
||||
{
|
||||
return __xiswctype(locale, wc, desc);
|
||||
}
|
||||
|
||||
static inline
|
||||
int toupper_l(int c, locale_t locale)
|
||||
{
|
||||
return __xtoupper(locale, c);
|
||||
}
|
||||
static inline
|
||||
int tolower_l(int c, locale_t locale)
|
||||
{
|
||||
return __xtolower(locale, c);
|
||||
}
|
||||
static inline
|
||||
wint_t towupper_l(wint_t wc, locale_t locale)
|
||||
{
|
||||
return __xtowupper(locale, wc);
|
||||
}
|
||||
static inline
|
||||
wint_t towlower_l(wint_t wc, locale_t locale)
|
||||
{
|
||||
return __xtowlower(locale, wc);
|
||||
}
|
||||
|
||||
static inline
|
||||
int strcoll_l(const char *__s1, const char *__s2, locale_t locale)
|
||||
{
|
||||
return __xstrcoll(locale, __s1, __s2);
|
||||
}
|
||||
static inline
|
||||
int wcscoll_l(const wchar_t *__s1, const wchar_t *__s2, locale_t locale)
|
||||
{
|
||||
return __xwcscoll(locale, __s1, __s2);
|
||||
}
|
||||
static inline
|
||||
size_t strxfrm_l(char *__s1, const char *__s2, size_t __n, locale_t locale)
|
||||
{
|
||||
return __xstrxfrm(locale, __s1, __s2, __n);
|
||||
}
|
||||
|
||||
static inline
|
||||
size_t wcsxfrm_l(wchar_t *__ws1, const wchar_t *__ws2, size_t __n,
|
||||
locale_t locale)
|
||||
{
|
||||
return __xwcsxfrm(locale, __ws1, __ws2, __n);
|
||||
}
|
||||
#endif // !defined(_AIX71)
|
||||
|
||||
// strftime_l() is defined by POSIX. However, AIX 7.1 does not have it
|
||||
// implemented yet.
|
||||
static inline
|
||||
size_t strftime_l(char *__s, size_t __size, const char *__fmt,
|
||||
const struct tm *__tm, locale_t locale) {
|
||||
return __xstrftime(locale, __s, __size, __fmt, __tm);
|
||||
}
|
||||
|
||||
// The following are not POSIX routines. These are quick-and-dirty hacks
|
||||
// to make things pretend to work
|
||||
static inline
|
||||
long long strtoll_l(const char *__nptr, char **__endptr,
|
||||
int __base, locale_t locale) {
|
||||
return strtoll(__nptr, __endptr, __base);
|
||||
}
|
||||
static inline
|
||||
long strtol_l(const char *__nptr, char **__endptr,
|
||||
int __base, locale_t locale) {
|
||||
return strtol(__nptr, __endptr, __base);
|
||||
}
|
||||
static inline
|
||||
long double strtold_l(const char *__nptr, char **__endptr,
|
||||
locale_t locale) {
|
||||
return strtold(__nptr, __endptr);
|
||||
}
|
||||
static inline
|
||||
unsigned long long strtoull_l(const char *__nptr, char **__endptr,
|
||||
int __base, locale_t locale) {
|
||||
return strtoull(__nptr, __endptr, __base);
|
||||
}
|
||||
static inline
|
||||
unsigned long strtoul_l(const char *__nptr, char **__endptr,
|
||||
int __base, locale_t locale) {
|
||||
return strtoul(__nptr, __endptr, __base);
|
||||
}
|
||||
|
||||
static inline
|
||||
int vasprintf(char **strp, const char *fmt, va_list ap)
|
||||
{
|
||||
const size_t buff_size = 256;
|
||||
int str_size;
|
||||
if ((*strp = (char *)malloc(buff_size)) == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if ((str_size = vsnprintf(*strp, buff_size, fmt, ap)) >= buff_size)
|
||||
{
|
||||
if ((*strp = (char *)realloc(*strp, str_size + 1)) == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
str_size = vsnprintf(*strp, str_size + 1, fmt, ap);
|
||||
}
|
||||
return str_size;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // defined(_AIX)
|
||||
#endif // _LIBCPP_SUPPORT_IBM_XLOCALE_H
|
63
include/support/newlib/xlocale.h
Normal file
63
include/support/newlib/xlocale.h
Normal file
@ -0,0 +1,63 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_SUPPORT_NEWLIB_XLOCALE_H
|
||||
#define _LIBCPP_SUPPORT_NEWLIB_XLOCALE_H
|
||||
|
||||
#if defined(_NEWLIB_VERSION)
|
||||
|
||||
#include <cstdlib>
|
||||
#include <clocale>
|
||||
#include <cwctype>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Patch over newlib's lack of extended locale support
|
||||
typedef void *locale_t;
|
||||
static inline locale_t duplocale(locale_t) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void freelocale(locale_t) {
|
||||
}
|
||||
|
||||
static inline locale_t newlocale(int, const char *, locale_t) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline locale_t uselocale(locale_t) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#define LC_COLLATE_MASK (1 << LC_COLLATE)
|
||||
#define LC_CTYPE_MASK (1 << LC_CTYPE)
|
||||
#define LC_MESSAGES_MASK (1 << LC_MESSAGES)
|
||||
#define LC_MONETARY_MASK (1 << LC_MONETARY)
|
||||
#define LC_NUMERIC_MASK (1 << LC_NUMERIC)
|
||||
#define LC_TIME_MASK (1 << LC_TIME)
|
||||
#define LC_ALL_MASK (LC_COLLATE_MASK|\
|
||||
LC_CTYPE_MASK|\
|
||||
LC_MONETARY_MASK|\
|
||||
LC_NUMERIC_MASK|\
|
||||
LC_TIME_MASK|\
|
||||
LC_MESSAGES_MASK)
|
||||
|
||||
// Share implementation with Android's Bionic
|
||||
#include <support/xlocale/xlocale.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // _NEWLIB_VERSION
|
||||
|
||||
#endif
|
14
include/support/solaris/floatingpoint.h
Normal file
14
include/support/solaris/floatingpoint.h
Normal file
@ -0,0 +1,14 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define atof sun_atof
|
||||
#define strtod sun_strtod
|
||||
#include_next "floatingpoint.h"
|
||||
#undef atof
|
||||
#undef strtod
|
47
include/support/solaris/wchar.h
Normal file
47
include/support/solaris/wchar.h
Normal file
@ -0,0 +1,47 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define iswalpha sun_iswalpha
|
||||
#define iswupper sun_iswupper
|
||||
#define iswlower sun_iswlower
|
||||
#define iswdigit sun_iswdigit
|
||||
#define iswxdigit sun_iswxdigit
|
||||
#define iswalnum sun_iswalnum
|
||||
#define iswspace sun_iswspace
|
||||
#define iswpunct sun_iswpunct
|
||||
#define iswprint sun_iswprint
|
||||
#define iswgraph sun_iswgraph
|
||||
#define iswcntrl sun_iswcntrl
|
||||
#define iswctype sun_iswctype
|
||||
#define towlower sun_towlower
|
||||
#define towupper sun_towupper
|
||||
#define wcswcs sun_wcswcs
|
||||
#define wcswidth sun_wcswidth
|
||||
#define wcwidth sun_wcwidth
|
||||
#define wctype sun_wctype
|
||||
#define _WCHAR_T 1
|
||||
#include_next "wchar.h"
|
||||
#undef iswalpha
|
||||
#undef iswupper
|
||||
#undef iswlower
|
||||
#undef iswdigit
|
||||
#undef iswxdigit
|
||||
#undef iswalnum
|
||||
#undef iswspace
|
||||
#undef iswpunct
|
||||
#undef iswprint
|
||||
#undef iswgraph
|
||||
#undef iswcntrl
|
||||
#undef iswctype
|
||||
#undef towlower
|
||||
#undef towupper
|
||||
#undef wcswcs
|
||||
#undef wcswidth
|
||||
#undef wcwidth
|
||||
#undef wctype
|
67
include/support/solaris/xlocale.h
Normal file
67
include/support/solaris/xlocale.h
Normal file
@ -0,0 +1,67 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Minimal xlocale implementation for Solaris. This implements the subset of
|
||||
// the xlocale APIs that libc++ depends on.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef __XLOCALE_H_INCLUDED
|
||||
#define __XLOCALE_H_INCLUDED
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
int snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...);
|
||||
int asprintf_l(char **__s, locale_t __l, const char *__format, ...);
|
||||
|
||||
int sscanf_l(const char *__s, locale_t __l, const char *__format, ...);
|
||||
|
||||
int toupper_l(int __c, locale_t __l);
|
||||
int tolower_l(int __c, locale_t __l);
|
||||
|
||||
struct lconv *localeconv(void);
|
||||
struct lconv *localeconv_l(locale_t __l);
|
||||
|
||||
// FIXME: These are quick-and-dirty hacks to make things pretend to work
|
||||
static inline
|
||||
long long strtoll_l(const char *__nptr, char **__endptr,
|
||||
int __base, locale_t __loc) {
|
||||
return strtoll(__nptr, __endptr, __base);
|
||||
}
|
||||
static inline
|
||||
long strtol_l(const char *__nptr, char **__endptr,
|
||||
int __base, locale_t __loc) {
|
||||
return strtol(__nptr, __endptr, __base);
|
||||
}
|
||||
static inline
|
||||
long double strtold_l(const char *__nptr, char **__endptr,
|
||||
locale_t __loc) {
|
||||
return strtold(__nptr, __endptr);
|
||||
}
|
||||
static inline
|
||||
unsigned long long strtoull_l(const char *__nptr, char **__endptr,
|
||||
int __base, locale_t __loc) {
|
||||
return strtoull(__nptr, __endptr, __base);
|
||||
}
|
||||
static inline
|
||||
unsigned long strtoul_l(const char *__nptr, char **__endptr,
|
||||
int __base, locale_t __loc) {
|
||||
return strtoul(__nptr, __endptr, __base);
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
79
include/support/win32/limits_win32.h
Normal file
79
include/support/win32/limits_win32.h
Normal file
@ -0,0 +1,79 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------- support/win32/limits_win32.h -------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H
|
||||
#define _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H
|
||||
|
||||
#if !defined(_LIBCPP_MSVCRT)
|
||||
#error "This header complements the Microsoft C Runtime library, and should not be included otherwise."
|
||||
#else
|
||||
|
||||
#include <limits.h> // CHAR_BIT
|
||||
#include <float.h> // limit constants
|
||||
|
||||
#if ! defined(__clang__)
|
||||
#define __CHAR_BIT__ CHAR_BIT
|
||||
|
||||
#define __FLT_MANT_DIG__ FLT_MANT_DIG
|
||||
#define __FLT_DIG__ FLT_DIG
|
||||
#define __FLT_RADIX__ FLT_RADIX
|
||||
#define __FLT_MIN_EXP__ FLT_MIN_EXP
|
||||
#define __FLT_MIN_10_EXP__ FLT_MIN_10_EXP
|
||||
#define __FLT_MAX_EXP__ FLT_MAX_EXP
|
||||
#define __FLT_MAX_10_EXP__ FLT_MAX_10_EXP
|
||||
#define __FLT_MIN__ FLT_MIN
|
||||
#define __FLT_MAX__ FLT_MAX
|
||||
#define __FLT_EPSILON__ FLT_EPSILON
|
||||
// predefined by MinGW GCC
|
||||
#define __FLT_DENORM_MIN__ 1.40129846432481707092e-45F
|
||||
|
||||
#define __DBL_MANT_DIG__ DBL_MANT_DIG
|
||||
#define __DBL_DIG__ DBL_DIG
|
||||
#define __DBL_RADIX__ DBL_RADIX
|
||||
#define __DBL_MIN_EXP__ DBL_MIN_EXP
|
||||
#define __DBL_MIN_10_EXP__ DBL_MIN_10_EXP
|
||||
#define __DBL_MAX_EXP__ DBL_MAX_EXP
|
||||
#define __DBL_MAX_10_EXP__ DBL_MAX_10_EXP
|
||||
#define __DBL_MIN__ DBL_MIN
|
||||
#define __DBL_MAX__ DBL_MAX
|
||||
#define __DBL_EPSILON__ DBL_EPSILON
|
||||
// predefined by MinGW GCC
|
||||
#define __DBL_DENORM_MIN__ double(4.94065645841246544177e-324L)
|
||||
|
||||
#define __LDBL_MANT_DIG__ LDBL_MANT_DIG
|
||||
#define __LDBL_DIG__ LDBL_DIG
|
||||
#define __LDBL_RADIX__ LDBL_RADIX
|
||||
#define __LDBL_MIN_EXP__ LDBL_MIN_EXP
|
||||
#define __LDBL_MIN_10_EXP__ LDBL_MIN_10_EXP
|
||||
#define __LDBL_MAX_EXP__ LDBL_MAX_EXP
|
||||
#define __LDBL_MAX_10_EXP__ LDBL_MAX_10_EXP
|
||||
#define __LDBL_MIN__ LDBL_MIN
|
||||
#define __LDBL_MAX__ LDBL_MAX
|
||||
#define __LDBL_EPSILON__ LDBL_EPSILON
|
||||
// predefined by MinGW GCC
|
||||
#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L
|
||||
|
||||
// __builtin replacements/workarounds
|
||||
#include <math.h> // HUGE_VAL
|
||||
#include <ymath.h> // internal MSVC header providing the needed functionality
|
||||
#define __builtin_huge_val() HUGE_VAL
|
||||
#define __builtin_huge_valf() _FInf._Float
|
||||
#define __builtin_huge_vall() _LInf._Long_double
|
||||
#define __builtin_nan(__dummy) _Nan._Double
|
||||
#define __builtin_nanf(__dummy) _FNan._Float
|
||||
#define __builtin_nanl(__dummmy) _LNan._Long_double
|
||||
#define __builtin_nans(__dummy) _Snan._Double
|
||||
#define __builtin_nansf(__dummy) _FSnan._Float
|
||||
#define __builtin_nansl(__dummy) _LSnan._Long_double
|
||||
#endif // ! defined(__clang__)
|
||||
|
||||
#endif // _LIBCPP_MSVCRT
|
||||
|
||||
#endif // _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H
|
129
include/support/win32/locale_win32.h
Normal file
129
include/support/win32/locale_win32.h
Normal file
@ -0,0 +1,129 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------- support/win32/locale_win32.h -------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
|
||||
#define _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
|
||||
|
||||
// ctype mask table defined in msvcrt.dll
|
||||
extern "C" unsigned short __declspec(dllimport) _ctype[];
|
||||
|
||||
#include "support/win32/support.h"
|
||||
#include <stdio.h>
|
||||
#include <memory>
|
||||
#include <xlocinfo.h> // _locale_t
|
||||
#define locale_t _locale_t
|
||||
#define LC_COLLATE_MASK _M_COLLATE
|
||||
#define LC_CTYPE_MASK _M_CTYPE
|
||||
#define LC_MONETARY_MASK _M_MONETARY
|
||||
#define LC_NUMERIC_MASK _M_NUMERIC
|
||||
#define LC_TIME_MASK _M_TIME
|
||||
#define LC_MESSAGES_MASK _M_MESSAGES
|
||||
#define LC_ALL_MASK ( LC_COLLATE_MASK \
|
||||
| LC_CTYPE_MASK \
|
||||
| LC_MESSAGES_MASK \
|
||||
| LC_MONETARY_MASK \
|
||||
| LC_NUMERIC_MASK \
|
||||
| LC_TIME_MASK )
|
||||
#define freelocale _free_locale
|
||||
// FIXME: base currently unused. Needs manual work to construct the new locale
|
||||
locale_t newlocale( int mask, const char * locale, locale_t base );
|
||||
locale_t uselocale( locale_t newloc );
|
||||
lconv *localeconv_l( locale_t loc );
|
||||
size_t mbrlen_l( const char *__restrict s, size_t n,
|
||||
mbstate_t *__restrict ps, locale_t loc);
|
||||
size_t mbsrtowcs_l( wchar_t *__restrict dst, const char **__restrict src,
|
||||
size_t len, mbstate_t *__restrict ps, locale_t loc );
|
||||
size_t wcrtomb_l( char *__restrict s, wchar_t wc, mbstate_t *__restrict ps,
|
||||
locale_t loc);
|
||||
size_t mbrtowc_l( wchar_t *__restrict pwc, const char *__restrict s,
|
||||
size_t n, mbstate_t *__restrict ps, locale_t loc);
|
||||
size_t mbsnrtowcs_l( wchar_t *__restrict dst, const char **__restrict src,
|
||||
size_t nms, size_t len, mbstate_t *__restrict ps, locale_t loc);
|
||||
size_t wcsnrtombs_l( char *__restrict dst, const wchar_t **__restrict src,
|
||||
size_t nwc, size_t len, mbstate_t *__restrict ps, locale_t loc);
|
||||
wint_t btowc_l( int c, locale_t loc );
|
||||
int wctob_l( wint_t c, locale_t loc );
|
||||
typedef _VSTD::remove_pointer<locale_t>::type __locale_struct;
|
||||
typedef _VSTD::unique_ptr<__locale_struct, decltype(&uselocale)> __locale_raii;
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l )
|
||||
{
|
||||
__locale_raii __current( uselocale(__l), uselocale );
|
||||
return MB_CUR_MAX;
|
||||
}
|
||||
|
||||
// the *_l functions are prefixed on Windows, only available for msvcr80+, VS2005+
|
||||
#define mbtowc_l _mbtowc_l
|
||||
#define strtoll_l _strtoi64_l
|
||||
#define strtoull_l _strtoui64_l
|
||||
// FIXME: current msvcrt does not know about long double
|
||||
#define strtold_l _strtod_l
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
islower_l(int c, _locale_t loc)
|
||||
{
|
||||
return _islower_l((int)c, loc);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
isupper_l(int c, _locale_t loc)
|
||||
{
|
||||
return _isupper_l((int)c, loc);
|
||||
}
|
||||
|
||||
#define isdigit_l _isdigit_l
|
||||
#define isxdigit_l _isxdigit_l
|
||||
#define strcoll_l _strcoll_l
|
||||
#define strxfrm_l _strxfrm_l
|
||||
#define wcscoll_l _wcscoll_l
|
||||
#define wcsxfrm_l _wcsxfrm_l
|
||||
#define toupper_l _toupper_l
|
||||
#define tolower_l _tolower_l
|
||||
#define iswspace_l _iswspace_l
|
||||
#define iswprint_l _iswprint_l
|
||||
#define iswcntrl_l _iswcntrl_l
|
||||
#define iswupper_l _iswupper_l
|
||||
#define iswlower_l _iswlower_l
|
||||
#define iswalpha_l _iswalpha_l
|
||||
#define iswdigit_l _iswdigit_l
|
||||
#define iswpunct_l _iswpunct_l
|
||||
#define iswxdigit_l _iswxdigit_l
|
||||
#define towupper_l _towupper_l
|
||||
#define towlower_l _towlower_l
|
||||
#define strftime_l _strftime_l
|
||||
#define sscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
|
||||
#define vsscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
|
||||
#define sprintf_l( __s, __l, __f, ... ) _sprintf_l( __s, __f, __l, __VA_ARGS__ )
|
||||
#define vsprintf_l( __s, __l, __f, ... ) _vsprintf_l( __s, __f, __l, __VA_ARGS__ )
|
||||
#define vsnprintf_l( __s, __n, __l, __f, ... ) _vsnprintf_l( __s, __n, __f, __l, __VA_ARGS__ )
|
||||
int snprintf_l(char *ret, size_t n, locale_t loc, const char *format, ...);
|
||||
int asprintf_l( char **ret, locale_t loc, const char *format, ... );
|
||||
int vasprintf_l( char **ret, locale_t loc, const char *format, va_list ap );
|
||||
|
||||
|
||||
// not-so-pressing FIXME: use locale to determine blank characters
|
||||
inline int isblank_l( int c, locale_t /*loc*/ )
|
||||
{
|
||||
return ( c == ' ' || c == '\t' );
|
||||
}
|
||||
inline int iswblank_l( wint_t c, locale_t /*loc*/ )
|
||||
{
|
||||
return ( c == L' ' || c == L'\t' );
|
||||
}
|
||||
|
||||
#if defined(_LIBCPP_MSVCRT)
|
||||
inline int isblank( int c, locale_t /*loc*/ )
|
||||
{ return ( c == ' ' || c == '\t' ); }
|
||||
inline int iswblank( wint_t c, locale_t /*loc*/ )
|
||||
{ return ( c == L' ' || c == L'\t' ); }
|
||||
#endif // _LIBCPP_MSVCRT
|
||||
#endif // _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
|
117
include/support/win32/math_win32.h
Normal file
117
include/support/win32/math_win32.h
Normal file
@ -0,0 +1,117 @@
|
||||
// -*- C++ -*-
|
||||
//===---------------------- support/win32/math_win32.h --------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H
|
||||
#define _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H
|
||||
|
||||
#if !defined(_LIBCPP_MSVCRT)
|
||||
#error "This header complements Microsoft's C Runtime library, and should not be included otherwise."
|
||||
#else
|
||||
|
||||
#include <math.h>
|
||||
#include <float.h> // _FPCLASS_PN etc.
|
||||
#include <crtversion.h>
|
||||
|
||||
#if ((_VC_CRT_MAJOR_VERSION-0) < 12)
|
||||
// Necessary?
|
||||
typedef float float_t;
|
||||
typedef double double_t;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE bool isfinite( double num )
|
||||
{
|
||||
return _finite(num) != 0;
|
||||
}
|
||||
_LIBCPP_ALWAYS_INLINE bool isinf( double num )
|
||||
{
|
||||
return !isfinite(num) && !_isnan(num);
|
||||
}
|
||||
_LIBCPP_ALWAYS_INLINE bool isnan( double num )
|
||||
{
|
||||
return _isnan(num) != 0;
|
||||
}
|
||||
_LIBCPP_ALWAYS_INLINE bool isnormal( double num )
|
||||
{
|
||||
int class_ = _fpclass(num);
|
||||
return class_ == _FPCLASS_NN || class_ == _FPCLASS_PN;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE bool isgreater( double x, double y )
|
||||
{
|
||||
if(_fpclass(x) == _FPCLASS_SNAN || _fpclass(y) == _FPCLASS_SNAN) return false;
|
||||
else return x > y;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE bool isgreaterequal( double x, double y )
|
||||
{
|
||||
if(_fpclass(x) == _FPCLASS_SNAN || _fpclass(y) == _FPCLASS_SNAN) return false;
|
||||
else return x >= y;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE bool isless( double x, double y )
|
||||
{
|
||||
if(_fpclass(x) == _FPCLASS_SNAN || _fpclass(y) == _FPCLASS_SNAN) return false;
|
||||
else return x < y;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE bool islessequal( double x, double y )
|
||||
{
|
||||
if(::_fpclass(x) == _FPCLASS_SNAN || ::_fpclass(y) == _FPCLASS_SNAN) return false;
|
||||
else return x <= y;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE bool islessgreater( double x, double y )
|
||||
{
|
||||
if(::_fpclass(x) == _FPCLASS_SNAN || ::_fpclass(y) == _FPCLASS_SNAN) return false;
|
||||
else return x < y || x > y;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE bool isunordered( double x, double y )
|
||||
{
|
||||
return isnan(x) || isnan(y);
|
||||
}
|
||||
_LIBCPP_ALWAYS_INLINE bool signbit( double num )
|
||||
{
|
||||
switch(_fpclass(num))
|
||||
{
|
||||
case _FPCLASS_SNAN:
|
||||
case _FPCLASS_QNAN:
|
||||
case _FPCLASS_NINF:
|
||||
case _FPCLASS_NN:
|
||||
case _FPCLASS_ND:
|
||||
case _FPCLASS_NZ:
|
||||
return true;
|
||||
case _FPCLASS_PZ:
|
||||
case _FPCLASS_PD:
|
||||
case _FPCLASS_PN:
|
||||
case _FPCLASS_PINF:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
_LIBCPP_ALWAYS_INLINE float copysignf( float x, float y )
|
||||
{
|
||||
return (signbit (x) != signbit (y) ? - x : x);
|
||||
}
|
||||
_LIBCPP_ALWAYS_INLINE double copysign( double x, double y )
|
||||
{
|
||||
return ::_copysign(x,y);
|
||||
}
|
||||
_LIBCPP_ALWAYS_INLINE double copysignl( long double x, long double y )
|
||||
{
|
||||
return ::_copysignl(x,y);
|
||||
}
|
||||
_LIBCPP_ALWAYS_INLINE int fpclassify( double num )
|
||||
{
|
||||
return _fpclass(num);
|
||||
}
|
||||
#endif
|
||||
#endif // _LIBCPP_MSVCRT
|
||||
|
||||
#endif // _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H
|
206
include/support/win32/support.h
Normal file
206
include/support/win32/support.h
Normal file
@ -0,0 +1,206 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------- support/win32/support.h ----------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_SUPPORT_WIN32_SUPPORT_H
|
||||
#define _LIBCPP_SUPPORT_WIN32_SUPPORT_H
|
||||
|
||||
// Functions and constants used in libc++ that
|
||||
// are missing from the Windows C library.
|
||||
|
||||
#include <wchar.h> // mbstate_t
|
||||
#include <cstdarg> // va_ macros
|
||||
// "builtins" not implemented here for Clang or GCC as they provide
|
||||
// implementations. Assuming required for elsewhere else, certainly MSVC.
|
||||
#if defined(_LIBCPP_MSVC)
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
#if defined(_LIBCPP_MSVCRT)
|
||||
#include <xlocinfo.h>
|
||||
#endif
|
||||
#define swprintf _snwprintf
|
||||
#define vswprintf _vsnwprintf
|
||||
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
|
||||
// The mingw headers already define these as static.
|
||||
#ifndef __MINGW32__
|
||||
extern "C" {
|
||||
|
||||
int vasprintf(char **sptr, const char *__restrict fmt, va_list ap);
|
||||
int asprintf(char **sptr, const char *__restrict fmt, ...);
|
||||
size_t mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src,
|
||||
size_t nmc, size_t len, mbstate_t *__restrict ps);
|
||||
size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src,
|
||||
size_t nwc, size_t len, mbstate_t *__restrict ps);
|
||||
}
|
||||
#endif // __MINGW32__
|
||||
|
||||
#if defined(_LIBCPP_MSVCRT)
|
||||
#define snprintf _snprintf
|
||||
#define atoll _atoi64
|
||||
#define strtoll _strtoi64
|
||||
#define strtoull _strtoui64
|
||||
#define wcstoll _wcstoi64
|
||||
#define wcstoull _wcstoui64
|
||||
_LIBCPP_ALWAYS_INLINE float strtof(const char *nptr, char **endptr)
|
||||
{
|
||||
return _Stof(nptr, endptr, 0);
|
||||
}
|
||||
_LIBCPP_ALWAYS_INLINE double strtod(const char *nptr, char **endptr)
|
||||
{
|
||||
return _Stod(nptr, endptr, 0);
|
||||
}
|
||||
_LIBCPP_ALWAYS_INLINE long double strtold(const char *nptr, char **endptr)
|
||||
{
|
||||
return _Stold(nptr, endptr, 0);
|
||||
}
|
||||
|
||||
#define _Exit _exit
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_MSVC)
|
||||
|
||||
// Bit builtin's make these assumptions when calling _BitScanForward/Reverse
|
||||
// etc. These assumptions are expected to be true for Win32/Win64 which this
|
||||
// file supports.
|
||||
static_assert(sizeof(unsigned long long) == 8, "");
|
||||
static_assert(sizeof(unsigned long) == 4, "");
|
||||
static_assert(sizeof(unsigned int) == 4, "");
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE int __builtin_popcount(unsigned int x)
|
||||
{
|
||||
// Binary: 0101...
|
||||
static const unsigned int m1 = 0x55555555;
|
||||
// Binary: 00110011..
|
||||
static const unsigned int m2 = 0x33333333;
|
||||
// Binary: 4 zeros, 4 ones ...
|
||||
static const unsigned int m4 = 0x0f0f0f0f;
|
||||
// The sum of 256 to the power of 0,1,2,3...
|
||||
static const unsigned int h01 = 0x01010101;
|
||||
// Put count of each 2 bits into those 2 bits.
|
||||
x -= (x >> 1) & m1;
|
||||
// Put count of each 4 bits into those 4 bits.
|
||||
x = (x & m2) + ((x >> 2) & m2);
|
||||
// Put count of each 8 bits into those 8 bits.
|
||||
x = (x + (x >> 4)) & m4;
|
||||
// Returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24).
|
||||
return (x * h01) >> 24;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE int __builtin_popcountl(unsigned long x)
|
||||
{
|
||||
return __builtin_popcount(static_cast<int>(x));
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE int __builtin_popcountll(unsigned long long x)
|
||||
{
|
||||
// Binary: 0101...
|
||||
static const unsigned long long m1 = 0x5555555555555555;
|
||||
// Binary: 00110011..
|
||||
static const unsigned long long m2 = 0x3333333333333333;
|
||||
// Binary: 4 zeros, 4 ones ...
|
||||
static const unsigned long long m4 = 0x0f0f0f0f0f0f0f0f;
|
||||
// The sum of 256 to the power of 0,1,2,3...
|
||||
static const unsigned long long h01 = 0x0101010101010101;
|
||||
// Put count of each 2 bits into those 2 bits.
|
||||
x -= (x >> 1) & m1;
|
||||
// Put count of each 4 bits into those 4 bits.
|
||||
x = (x & m2) + ((x >> 2) & m2);
|
||||
// Put count of each 8 bits into those 8 bits.
|
||||
x = (x + (x >> 4)) & m4;
|
||||
// Returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24) + ...
|
||||
return static_cast<int>((x * h01) >> 56);
|
||||
}
|
||||
|
||||
// Returns the number of trailing 0-bits in x, starting at the least significant
|
||||
// bit position. If x is 0, the result is undefined.
|
||||
_LIBCPP_ALWAYS_INLINE int __builtin_ctzll(unsigned long long mask)
|
||||
{
|
||||
unsigned long where;
|
||||
// Search from LSB to MSB for first set bit.
|
||||
// Returns zero if no set bit is found.
|
||||
#if defined(_WIN64)
|
||||
if (_BitScanForward64(&where, mask))
|
||||
return static_cast<int>(where);
|
||||
#elif defined(_WIN32)
|
||||
// Win32 doesn't have _BitScanForward64 so emulate it with two 32 bit calls.
|
||||
// Scan the Low Word.
|
||||
if (_BitScanForward(&where, static_cast<unsigned long>(mask)))
|
||||
return static_cast<int>(where);
|
||||
// Scan the High Word.
|
||||
if (_BitScanForward(&where, static_cast<unsigned long>(mask >> 32)))
|
||||
return static_cast<int>(where + 32); // Create a bit offset from the LSB.
|
||||
#else
|
||||
#error "Implementation of __builtin_ctzll required"
|
||||
#endif
|
||||
return 64;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE int __builtin_ctzl(unsigned long mask)
|
||||
{
|
||||
unsigned long where;
|
||||
// Search from LSB to MSB for first set bit.
|
||||
// Returns zero if no set bit is found.
|
||||
if (_BitScanForward(&where, mask))
|
||||
return static_cast<int>(where);
|
||||
return 32;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE int __builtin_ctz(unsigned int mask)
|
||||
{
|
||||
// Win32 and Win64 expectations.
|
||||
static_assert(sizeof(mask) == 4, "");
|
||||
static_assert(sizeof(unsigned long) == 4, "");
|
||||
return __builtin_ctzl(static_cast<unsigned long>(mask));
|
||||
}
|
||||
|
||||
// Returns the number of leading 0-bits in x, starting at the most significant
|
||||
// bit position. If x is 0, the result is undefined.
|
||||
_LIBCPP_ALWAYS_INLINE int __builtin_clzll(unsigned long long mask)
|
||||
{
|
||||
unsigned long where;
|
||||
// BitScanReverse scans from MSB to LSB for first set bit.
|
||||
// Returns 0 if no set bit is found.
|
||||
#if defined(_WIN64)
|
||||
if (_BitScanReverse64(&where, mask))
|
||||
return static_cast<int>(63 - where);
|
||||
#elif defined(_WIN32)
|
||||
// Scan the high 32 bits.
|
||||
if (_BitScanReverse(&where, static_cast<unsigned long>(mask >> 32)))
|
||||
return static_cast<int>(63 -
|
||||
(where + 32)); // Create a bit offset from the MSB.
|
||||
// Scan the low 32 bits.
|
||||
if (_BitScanReverse(&where, static_cast<unsigned long>(mask)))
|
||||
return static_cast<int>(63 - where);
|
||||
#else
|
||||
#error "Implementation of __builtin_clzll required"
|
||||
#endif
|
||||
return 64; // Undefined Behavior.
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE int __builtin_clzl(unsigned long mask)
|
||||
{
|
||||
unsigned long where;
|
||||
// Search from LSB to MSB for first set bit.
|
||||
// Returns zero if no set bit is found.
|
||||
if (_BitScanReverse(&where, mask))
|
||||
return static_cast<int>(31 - where);
|
||||
return 32; // Undefined Behavior.
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE int __builtin_clz(unsigned int x)
|
||||
{
|
||||
return __builtin_clzl(x);
|
||||
}
|
||||
#endif // _LIBCPP_MSVC
|
||||
|
||||
#endif // _LIBCPP_SUPPORT_WIN32_SUPPORT_H
|
194
include/support/xlocale/xlocale.h
Normal file
194
include/support/xlocale/xlocale.h
Normal file
@ -0,0 +1,194 @@
|
||||
// -*- C++ -*-
|
||||
//===------------------- support/xlocale/xlocale.h ------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
// This is a shared implementation of a shim to provide extended locale support
|
||||
// on top of libc's that don't support it (like Android's bionic, and Newlib).
|
||||
//
|
||||
// The 'illusion' only works when the specified locale is "C" or "POSIX", but
|
||||
// that's about as good as we can do without implementing full xlocale support
|
||||
// in the underlying libc.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_SUPPORT_XLOCALE_XLOCALE_H
|
||||
#define _LIBCPP_SUPPORT_XLOCALE_XLOCALE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static inline int isalnum_l(int c, locale_t) {
|
||||
return isalnum(c);
|
||||
}
|
||||
|
||||
static inline int isalpha_l(int c, locale_t) {
|
||||
return isalpha(c);
|
||||
}
|
||||
|
||||
static inline int isblank_l(int c, locale_t) {
|
||||
return isblank(c);
|
||||
}
|
||||
|
||||
static inline int iscntrl_l(int c, locale_t) {
|
||||
return iscntrl(c);
|
||||
}
|
||||
|
||||
static inline int isdigit_l(int c, locale_t) {
|
||||
return isdigit(c);
|
||||
}
|
||||
|
||||
static inline int isgraph_l(int c, locale_t) {
|
||||
return isgraph(c);
|
||||
}
|
||||
|
||||
static inline int islower_l(int c, locale_t) {
|
||||
return islower(c);
|
||||
}
|
||||
|
||||
static inline int isprint_l(int c, locale_t) {
|
||||
return isprint(c);
|
||||
}
|
||||
|
||||
static inline int ispunct_l(int c, locale_t) {
|
||||
return ispunct(c);
|
||||
}
|
||||
|
||||
static inline int isspace_l(int c, locale_t) {
|
||||
return isspace(c);
|
||||
}
|
||||
|
||||
static inline int isupper_l(int c, locale_t) {
|
||||
return isupper(c);
|
||||
}
|
||||
|
||||
static inline int isxdigit_l(int c, locale_t) {
|
||||
return isxdigit(c);
|
||||
}
|
||||
|
||||
static inline int iswalnum_l(wint_t c, locale_t) {
|
||||
return iswalnum(c);
|
||||
}
|
||||
|
||||
static inline int iswalpha_l(wint_t c, locale_t) {
|
||||
return iswalpha(c);
|
||||
}
|
||||
|
||||
static inline int iswblank_l(wint_t c, locale_t) {
|
||||
return iswblank(c);
|
||||
}
|
||||
|
||||
static inline int iswcntrl_l(wint_t c, locale_t) {
|
||||
return iswcntrl(c);
|
||||
}
|
||||
|
||||
static inline int iswdigit_l(wint_t c, locale_t) {
|
||||
return iswdigit(c);
|
||||
}
|
||||
|
||||
static inline int iswgraph_l(wint_t c, locale_t) {
|
||||
return iswgraph(c);
|
||||
}
|
||||
|
||||
static inline int iswlower_l(wint_t c, locale_t) {
|
||||
return iswlower(c);
|
||||
}
|
||||
|
||||
static inline int iswprint_l(wint_t c, locale_t) {
|
||||
return iswprint(c);
|
||||
}
|
||||
|
||||
static inline int iswpunct_l(wint_t c, locale_t) {
|
||||
return iswpunct(c);
|
||||
}
|
||||
|
||||
static inline int iswspace_l(wint_t c, locale_t) {
|
||||
return iswspace(c);
|
||||
}
|
||||
|
||||
static inline int iswupper_l(wint_t c, locale_t) {
|
||||
return iswupper(c);
|
||||
}
|
||||
|
||||
static inline int iswxdigit_l(wint_t c, locale_t) {
|
||||
return iswxdigit(c);
|
||||
}
|
||||
|
||||
static inline int toupper_l(int c, locale_t) {
|
||||
return toupper(c);
|
||||
}
|
||||
|
||||
static inline int tolower_l(int c, locale_t) {
|
||||
return tolower(c);
|
||||
}
|
||||
|
||||
static inline int towupper_l(int c, locale_t) {
|
||||
return towupper(c);
|
||||
}
|
||||
|
||||
static inline int towlower_l(int c, locale_t) {
|
||||
return towlower(c);
|
||||
}
|
||||
|
||||
static inline int strcoll_l(const char *s1, const char *s2, locale_t) {
|
||||
return strcoll(s1, s2);
|
||||
}
|
||||
|
||||
static inline size_t strxfrm_l(char *dest, const char *src, size_t n,
|
||||
locale_t) {
|
||||
return strxfrm(dest, src, n);
|
||||
}
|
||||
|
||||
static inline size_t strftime_l(char *s, size_t max, const char *format,
|
||||
const struct tm *tm, locale_t) {
|
||||
return strftime(s, max, format, tm);
|
||||
}
|
||||
|
||||
static inline int wcscoll_l(const wchar_t *ws1, const wchar_t *ws2, locale_t) {
|
||||
return wcscoll(ws1, ws2);
|
||||
}
|
||||
|
||||
static inline size_t wcsxfrm_l(wchar_t *dest, const wchar_t *src, size_t n,
|
||||
locale_t) {
|
||||
return wcsxfrm(dest, src, n);
|
||||
}
|
||||
|
||||
static inline long double strtold_l(const char *nptr, char **endptr, locale_t) {
|
||||
return strtold(nptr, endptr);
|
||||
}
|
||||
|
||||
static inline long long strtoll_l(const char *nptr, char **endptr, int base,
|
||||
locale_t) {
|
||||
return strtoll(nptr, endptr, base);
|
||||
}
|
||||
|
||||
static inline unsigned long long strtoull_l(const char *nptr, char **endptr,
|
||||
int base, locale_t) {
|
||||
return strtoull(nptr, endptr, base);
|
||||
}
|
||||
|
||||
static inline long long wcstoll_l(const wchar_t *nptr, wchar_t **endptr,
|
||||
int base, locale_t) {
|
||||
return wcstoll(nptr, endptr, base);
|
||||
}
|
||||
|
||||
static inline unsigned long long wcstoull_l(const wchar_t *nptr,
|
||||
wchar_t **endptr, int base,
|
||||
locale_t) {
|
||||
return wcstoull(nptr, endptr, base);
|
||||
}
|
||||
|
||||
static inline long double wcstold_l(const wchar_t *nptr, wchar_t **endptr,
|
||||
locale_t) {
|
||||
return wcstold(nptr, endptr);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_SUPPORT_XLOCALE_XLOCALE_H
|
@ -161,10 +161,8 @@ using tuple_element_t = typename tuple_element <_Ip, _Tp...>::type;
|
||||
|
||||
// __tuple_leaf
|
||||
|
||||
template <size_t _Ip, class _Hp, bool=is_empty<_Hp>::value
|
||||
#if __has_feature(is_final)
|
||||
&& !__is_final(_Hp)
|
||||
#endif
|
||||
template <size_t _Ip, class _Hp,
|
||||
bool=is_empty<_Hp>::value && !__libcpp_is_final<_Hp>::value
|
||||
>
|
||||
class __tuple_leaf;
|
||||
|
||||
@ -511,8 +509,8 @@ class _LIBCPP_TYPE_VIS_ONLY tuple
|
||||
typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&) _NOEXCEPT;
|
||||
public:
|
||||
|
||||
template <bool _Dummy = true, class _Up = typename enable_if<
|
||||
__all<(_Dummy && is_default_constructible<_Tp>::value)...>::value
|
||||
template <bool _Dummy = true, class = typename enable_if<
|
||||
__all<__dependent_type<is_default_constructible<_Tp>, _Dummy>::value...>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR tuple()
|
||||
@ -846,8 +844,6 @@ struct __ignore_t
|
||||
|
||||
namespace { const __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>(); }
|
||||
|
||||
template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY reference_wrapper;
|
||||
|
||||
template <class _Tp>
|
||||
struct __make_tuple_return_impl
|
||||
{
|
||||
@ -927,8 +923,12 @@ struct __tuple_less
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
bool operator()(const _Tp& __x, const _Up& __y)
|
||||
{
|
||||
return __tuple_less<_Ip-1>()(__x, __y) ||
|
||||
(!__tuple_less<_Ip-1>()(__y, __x) && _VSTD::get<_Ip-1>(__x) < _VSTD::get<_Ip-1>(__y));
|
||||
const size_t __idx = tuple_size<_Tp>::value - _Ip;
|
||||
if (_VSTD::get<__idx>(__x) < _VSTD::get<__idx>(__y))
|
||||
return true;
|
||||
if (_VSTD::get<__idx>(__y) < _VSTD::get<__idx>(__x))
|
||||
return false;
|
||||
return __tuple_less<_Ip-1>()(__x, __y);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -19,8 +19,13 @@ namespace std
|
||||
|
||||
// helper class:
|
||||
template <class T, T v> struct integral_constant;
|
||||
typedef integral_constant<bool, true> true_type;
|
||||
typedef integral_constant<bool, false> false_type;
|
||||
typedef integral_constant<bool, true> true_type; // C++11
|
||||
typedef integral_constant<bool, false> false_type; // C++11
|
||||
|
||||
template <bool B> // C++14
|
||||
using bool_constant = integral_constant<bool, B>; // C++14
|
||||
typedef bool_constant<true> true_type; // C++14
|
||||
typedef bool_constant<false> false_type; // C++14
|
||||
|
||||
// helper traits
|
||||
template <bool, class T = void> struct enable_if;
|
||||
@ -211,10 +216,14 @@ namespace std
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class...>
|
||||
template <class>
|
||||
struct __void_t { typedef void type; };
|
||||
#endif
|
||||
|
||||
template <class _Tp>
|
||||
struct __identity { typedef _Tp type; };
|
||||
|
||||
template <class _Tp, bool>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY __dependent_type : public _Tp {};
|
||||
|
||||
template <bool _Bp, class _If, class _Then>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY conditional {typedef _If type;};
|
||||
@ -257,8 +266,16 @@ struct _LIBCPP_TYPE_VIS_ONLY integral_constant
|
||||
template <class _Tp, _Tp __v>
|
||||
_LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value;
|
||||
|
||||
typedef integral_constant<bool, true> true_type;
|
||||
typedef integral_constant<bool, false> false_type;
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
template <bool __b>
|
||||
using bool_constant = integral_constant<bool, __b>;
|
||||
#define _LIBCPP_BOOL_CONSTANT(__b) bool_constant<(__b)>
|
||||
#else
|
||||
#define _LIBCPP_BOOL_CONSTANT(__b) integral_constant<bool,(__b)>
|
||||
#endif
|
||||
|
||||
typedef _LIBCPP_BOOL_CONSTANT(true) true_type;
|
||||
typedef _LIBCPP_BOOL_CONSTANT(false) false_type;
|
||||
|
||||
// is_const
|
||||
|
||||
@ -430,9 +447,12 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_same<_Tp, _Tp> :
|
||||
|
||||
namespace __libcpp_is_function_imp
|
||||
{
|
||||
struct __dummy_type {};
|
||||
template <class _Tp> char __test(_Tp*);
|
||||
template <class _Tp> char __test(__dummy_type);
|
||||
template <class _Tp> __two __test(...);
|
||||
template <class _Tp> _Tp& __source();
|
||||
template <class _Tp> _Tp& __source(int);
|
||||
template <class _Tp> __dummy_type __source(...);
|
||||
}
|
||||
|
||||
template <class _Tp, bool = is_class<_Tp>::value ||
|
||||
@ -441,7 +461,7 @@ template <class _Tp, bool = is_class<_Tp>::value ||
|
||||
is_reference<_Tp>::value ||
|
||||
__is_nullptr_t<_Tp>::value >
|
||||
struct __libcpp_is_function
|
||||
: public integral_constant<bool, sizeof(__libcpp_is_function_imp::__test<_Tp>(__libcpp_is_function_imp::__source<_Tp>())) == 1>
|
||||
: public integral_constant<bool, sizeof(__libcpp_is_function_imp::__test<_Tp>(__libcpp_is_function_imp::__source<_Tp>(0))) == 1>
|
||||
{};
|
||||
template <class _Tp> struct __libcpp_is_function<_Tp, true> : public false_type {};
|
||||
|
||||
@ -460,19 +480,15 @@ struct __member_pointer_traits_imp
|
||||
};
|
||||
|
||||
|
||||
namespace __libcpp_is_member_function_pointer_imp {
|
||||
template <typename _Tp>
|
||||
char __test(typename std::__member_pointer_traits_imp<_Tp, true, false>::_FnType *);
|
||||
|
||||
template <typename>
|
||||
std::__two __test(...);
|
||||
};
|
||||
|
||||
template <class _Tp> struct __libcpp_is_member_function_pointer
|
||||
: public integral_constant<bool, sizeof(__libcpp_is_member_function_pointer_imp::__test<_Tp>(nullptr)) == 1> {};
|
||||
: public false_type {};
|
||||
|
||||
template <class _Ret, class _Class>
|
||||
struct __libcpp_is_member_function_pointer<_Ret _Class::*>
|
||||
: public is_function<_Ret> {};
|
||||
|
||||
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_function_pointer
|
||||
: public __libcpp_is_member_function_pointer<typename remove_cv<_Tp>::type> {};
|
||||
: public __libcpp_is_member_function_pointer<typename remove_cv<_Tp>::type>::type {};
|
||||
|
||||
// is_member_pointer
|
||||
|
||||
@ -673,7 +689,7 @@ template <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type;
|
||||
// is_signed
|
||||
|
||||
template <class _Tp, bool = is_integral<_Tp>::value>
|
||||
struct __libcpp_is_signed_impl : public integral_constant<bool, _Tp(-1) < _Tp(0)> {};
|
||||
struct __libcpp_is_signed_impl : public _LIBCPP_BOOL_CONSTANT(_Tp(-1) < _Tp(0)) {};
|
||||
|
||||
template <class _Tp>
|
||||
struct __libcpp_is_signed_impl<_Tp, false> : public true_type {}; // floating point
|
||||
@ -688,7 +704,7 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_signed : public __libcpp_is
|
||||
// is_unsigned
|
||||
|
||||
template <class _Tp, bool = is_integral<_Tp>::value>
|
||||
struct __libcpp_is_unsigned_impl : public integral_constant<bool, _Tp(0) < _Tp(-1)> {};
|
||||
struct __libcpp_is_unsigned_impl : public _LIBCPP_BOOL_CONSTANT(_Tp(0) < _Tp(-1)) {};
|
||||
|
||||
template <class _Tp>
|
||||
struct __libcpp_is_unsigned_impl<_Tp, false> : public false_type {}; // floating point
|
||||
@ -790,8 +806,16 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_abstract : public __libcpp_
|
||||
|
||||
// is_final
|
||||
|
||||
#if _LIBCPP_STD_VER > 11 && __has_feature(is_final)
|
||||
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY
|
||||
#if defined(_LIBCPP_HAS_IS_FINAL)
|
||||
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY
|
||||
__libcpp_is_final : public integral_constant<bool, __is_final(_Tp)> {};
|
||||
#else
|
||||
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY
|
||||
__libcpp_is_final : public false_type {};
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_HAS_IS_FINAL) && _LIBCPP_STD_VER > 11
|
||||
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY
|
||||
is_final : public integral_constant<bool, __is_final(_Tp)> {};
|
||||
#endif
|
||||
|
||||
@ -832,7 +856,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_base_of
|
||||
|
||||
// is_convertible
|
||||
|
||||
#if __has_feature(is_convertible_to)
|
||||
#if __has_feature(is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
|
||||
|
||||
template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY is_convertible
|
||||
: public integral_constant<bool, __is_convertible_to(_T1, _T2) &&
|
||||
@ -842,7 +866,16 @@ template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY is_convertible
|
||||
|
||||
namespace __is_convertible_imp
|
||||
{
|
||||
template <class _Tp> char __test(_Tp);
|
||||
template <class _Tp> void __test_convert(_Tp);
|
||||
|
||||
template <class _From, class _To, class = void>
|
||||
struct __is_convertible_test : public false_type {};
|
||||
|
||||
template <class _From, class _To>
|
||||
struct __is_convertible_test<_From, _To,
|
||||
decltype(__test_convert<_To>(_VSTD::declval<_From>()))> : public true_type
|
||||
{};
|
||||
|
||||
template <class _Tp> __two __test(...);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Tp> _Tp&& __source();
|
||||
@ -877,10 +910,8 @@ template <class _T1, class _T2,
|
||||
unsigned _T2_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T2>::value>
|
||||
struct __is_convertible
|
||||
: public integral_constant<bool,
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
sizeof(__is_convertible_imp::__test<_T2>(__is_convertible_imp::__source<_T1>())) == 1
|
||||
#else
|
||||
sizeof(__is_convertible_imp::__test<_T2>(__is_convertible_imp::__source<_T1>())) == 1
|
||||
__is_convertible_imp::__is_convertible_test<_T1, _T2>::value
|
||||
#if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||
&& !(!is_function<_T1>::value && !is_reference<_T1>::value && is_reference<_T2>::value
|
||||
&& (!is_const<typename remove_reference<_T2>::type>::value
|
||||
|| is_volatile<typename remove_reference<_T2>::type>::value)
|
||||
@ -894,6 +925,7 @@ struct __is_convertible
|
||||
template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 0> : false_type {};
|
||||
|
||||
template <class _T1> struct __is_convertible<_T1, const _T1&, 1, 0> : true_type {};
|
||||
template <class _T1> struct __is_convertible<const _T1, const _T1&, 1, 0> : true_type {};
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _T1> struct __is_convertible<_T1, _T1&&, 1, 0> : true_type {};
|
||||
template <class _T1> struct __is_convertible<_T1, const _T1&&, 1, 0> : true_type {};
|
||||
@ -1433,11 +1465,11 @@ template <class _Tp> using make_unsigned_t = typename make_unsigned<_Tp>::type;
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Up = void, class V = void>
|
||||
template <class _Tp, class _Up = void, class _Vp = void>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY common_type
|
||||
{
|
||||
public:
|
||||
typedef typename common_type<typename common_type<_Tp, _Up>::type, V>::type type;
|
||||
typedef typename common_type<typename common_type<_Tp, _Up>::type, _Vp>::type type;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
@ -1519,7 +1551,7 @@ template <class _Tp, class _Arg, bool = is_void<_Tp>::value || is_void<_Arg>::va
|
||||
struct __is_assignable_imp
|
||||
: public common_type
|
||||
<
|
||||
decltype(__is_assignable_test(declval<_Tp>(), declval<_Arg>()))
|
||||
decltype(_VSTD::__is_assignable_test(declval<_Tp>(), declval<_Arg>()))
|
||||
>::type {};
|
||||
|
||||
template <class _Tp, class _Arg>
|
||||
@ -1766,7 +1798,8 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatil
|
||||
typedef _Rp (_FnType) (_Param..., ...);
|
||||
};
|
||||
|
||||
#if __has_feature(cxx_reference_qualified_functions)
|
||||
#if __has_feature(cxx_reference_qualified_functions) || \
|
||||
(defined(_GNUC_VER) && _GNUC_VER >= 409)
|
||||
|
||||
template <class _Rp, class _Class, class ..._Param>
|
||||
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false>
|
||||
@ -1896,7 +1929,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatil
|
||||
typedef _Rp (_FnType) (_Param..., ...);
|
||||
};
|
||||
|
||||
#endif // __has_feature(cxx_reference_qualified_functions)
|
||||
#endif // __has_feature(cxx_reference_qualified_functions) || _GNUC_VER >= 409
|
||||
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
@ -2222,7 +2255,7 @@ struct __result_of_mp;
|
||||
|
||||
template <class _MP, class _Tp>
|
||||
struct __result_of_mp<_MP, _Tp, true>
|
||||
: public common_type<typename __member_pointer_traits<_MP>::_ReturnType>
|
||||
: public __identity<typename __member_pointer_traits<_MP>::_ReturnType>
|
||||
{
|
||||
};
|
||||
|
||||
@ -2290,7 +2323,7 @@ template <class _Fn>
|
||||
class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn()>
|
||||
: public __result_of<_Fn(),
|
||||
is_class<typename remove_reference<_Fn>::type>::value ||
|
||||
is_function<typename remove_reference<_Fn>::type>::value,
|
||||
is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value,
|
||||
is_member_pointer<typename remove_reference<_Fn>::type>::value
|
||||
>
|
||||
{
|
||||
@ -2300,7 +2333,7 @@ template <class _Fn, class _A0>
|
||||
class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0)>
|
||||
: public __result_of<_Fn(_A0),
|
||||
is_class<typename remove_reference<_Fn>::type>::value ||
|
||||
is_function<typename remove_reference<_Fn>::type>::value,
|
||||
is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value,
|
||||
is_member_pointer<typename remove_reference<_Fn>::type>::value
|
||||
>
|
||||
{
|
||||
@ -2310,7 +2343,7 @@ template <class _Fn, class _A0, class _A1>
|
||||
class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0, _A1)>
|
||||
: public __result_of<_Fn(_A0, _A1),
|
||||
is_class<typename remove_reference<_Fn>::type>::value ||
|
||||
is_function<typename remove_reference<_Fn>::type>::value,
|
||||
is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value,
|
||||
is_member_pointer<typename remove_reference<_Fn>::type>::value
|
||||
>
|
||||
{
|
||||
@ -2320,7 +2353,7 @@ template <class _Fn, class _A0, class _A1, class _A2>
|
||||
class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0, _A1, _A2)>
|
||||
: public __result_of<_Fn(_A0, _A1, _A2),
|
||||
is_class<typename remove_reference<_Fn>::type>::value ||
|
||||
is_function<typename remove_reference<_Fn>::type>::value,
|
||||
is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value,
|
||||
is_member_pointer<typename remove_reference<_Fn>::type>::value
|
||||
>
|
||||
{
|
||||
@ -2668,7 +2701,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_move_constructible
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#if __has_feature(is_trivially_constructible)
|
||||
#if __has_feature(is_trivially_constructible) || _GNUC_VER >= 501
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible
|
||||
@ -2727,7 +2760,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible
|
||||
{
|
||||
};
|
||||
|
||||
#if __has_feature(is_trivially_constructible)
|
||||
#if __has_feature(is_trivially_constructible) || _GNUC_VER >= 501
|
||||
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, __is_construct::__nat,
|
||||
@ -2815,7 +2848,7 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_constructibl
|
||||
|
||||
// is_trivially_assignable
|
||||
|
||||
#if __has_feature(is_trivially_assignable)
|
||||
#if __has_feature(is_trivially_assignable) || _GNUC_VER >= 501
|
||||
|
||||
template <class _Tp, class _Arg>
|
||||
struct is_trivially_assignable
|
||||
@ -3253,6 +3286,8 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_standard_layout
|
||||
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copyable
|
||||
#if __has_feature(is_trivially_copyable)
|
||||
: public integral_constant<bool, __is_trivially_copyable(_Tp)>
|
||||
#elif _GNUC_VER >= 501
|
||||
: public integral_constant<bool, !is_volatile<_Tp>::value && __is_trivially_copyable(_Tp)>
|
||||
#else
|
||||
: integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value>
|
||||
#endif
|
||||
@ -3261,7 +3296,7 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copyable
|
||||
// is_trivial;
|
||||
|
||||
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivial
|
||||
#if __has_feature(is_trivial) || (_GNUC_VER >= 407)
|
||||
#if __has_feature(is_trivial) || _GNUC_VER >= 407
|
||||
: public integral_constant<bool, __is_trivial(_Tp)>
|
||||
#else
|
||||
: integral_constant<bool, is_trivially_copyable<_Tp>::value &&
|
||||
@ -3646,6 +3681,48 @@ struct underlying_type
|
||||
|
||||
#endif // _LIBCPP_UNDERLYING_TYPE
|
||||
|
||||
|
||||
template <class _Tp, bool = std::is_enum<_Tp>::value>
|
||||
struct __sfinae_underlying_type
|
||||
{
|
||||
typedef typename underlying_type<_Tp>::type type;
|
||||
typedef decltype(((type)1) + 0) __promoted_type;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __sfinae_underlying_type<_Tp, false> {};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
|
||||
int __convert_to_integral(int __val) { return __val; }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
|
||||
unsigned __convert_to_integral(unsigned __val) { return __val; }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
|
||||
long __convert_to_integral(long __val) { return __val; }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
|
||||
unsigned long __convert_to_integral(unsigned long __val) { return __val; }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
|
||||
long long __convert_to_integral(long long __val) { return __val; }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
|
||||
unsigned long long __convert_to_integral(unsigned long long __val) {return __val; }
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_INT128
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
|
||||
__int128_t __convert_to_integral(__int128_t __val) { return __val; }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
|
||||
__uint128_t __convert_to_integral(__uint128_t __val) { return __val; }
|
||||
#endif
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
|
||||
typename __sfinae_underlying_type<_Tp>::__promoted_type
|
||||
__convert_to_integral(_Tp __val) { return __val; }
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
|
||||
template <class _Tp>
|
||||
|
@ -122,7 +122,25 @@ public:
|
||||
void insert(InputIterator first, InputIterator last);
|
||||
void insert(initializer_list<value_type>);
|
||||
|
||||
template <class... Args>
|
||||
pair<iterator, bool> try_emplace(const key_type& k, Args&&... args); // C++17
|
||||
template <class... Args>
|
||||
pair<iterator, bool> try_emplace(key_type&& k, Args&&... args); // C++17
|
||||
template <class... Args>
|
||||
iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args); // C++17
|
||||
template <class... Args>
|
||||
iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args); // C++17
|
||||
template <class M>
|
||||
pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj); // C++17
|
||||
template <class M>
|
||||
pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj); // C++17
|
||||
template <class M>
|
||||
iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj); // C++17
|
||||
template <class M>
|
||||
iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj); // C++17
|
||||
|
||||
iterator erase(const_iterator position);
|
||||
iterator erase(iterator position); // C++14
|
||||
size_type erase(const key_type& k);
|
||||
iterator erase(const_iterator first, const_iterator last);
|
||||
void clear() noexcept;
|
||||
@ -287,6 +305,7 @@ public:
|
||||
void insert(initializer_list<value_type>);
|
||||
|
||||
iterator erase(const_iterator position);
|
||||
iterator erase(iterator position); // C++14
|
||||
size_type erase(const key_type& k);
|
||||
iterator erase(const_iterator first, const_iterator last);
|
||||
void clear() noexcept;
|
||||
@ -359,10 +378,8 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Key, class _Cp, class _Hash, bool = is_empty<_Hash>::value
|
||||
#if __has_feature(is_final)
|
||||
&& !__is_final(_Hash)
|
||||
#endif
|
||||
template <class _Key, class _Cp, class _Hash,
|
||||
bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value
|
||||
>
|
||||
class __unordered_map_hasher
|
||||
: private _Hash
|
||||
@ -384,6 +401,12 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const _Key& __x) const
|
||||
{return static_cast<const _Hash&>(*this)(__x);}
|
||||
void swap(__unordered_map_hasher&__y)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_Hash>::value)
|
||||
{
|
||||
using _VSTD::swap;
|
||||
swap(static_cast<const _Hash&>(*this), static_cast<const _Hash&>(__y));
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Key, class _Cp, class _Hash>
|
||||
@ -408,12 +431,26 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const _Key& __x) const
|
||||
{return __hash_(__x);}
|
||||
void swap(__unordered_map_hasher&__y)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_Hash>::value)
|
||||
{
|
||||
using _VSTD::swap;
|
||||
swap(__hash_, __y.__hash_);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Key, class _Cp, class _Pred, bool = is_empty<_Pred>::value
|
||||
#if __has_feature(is_final)
|
||||
&& !__is_final(_Pred)
|
||||
#endif
|
||||
template <class _Key, class _Cp, class _Hash, bool __b>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(__unordered_map_hasher<_Key, _Cp, _Hash, __b>& __x,
|
||||
__unordered_map_hasher<_Key, _Cp, _Hash, __b>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Key, class _Cp, class _Pred,
|
||||
bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value
|
||||
>
|
||||
class __unordered_map_equal
|
||||
: private _Pred
|
||||
@ -438,6 +475,12 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Key& __x, const _Cp& __y) const
|
||||
{return static_cast<const _Pred&>(*this)(__x, __y.__cc.first);}
|
||||
void swap(__unordered_map_equal&__y)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_Pred>::value)
|
||||
{
|
||||
using _VSTD::swap;
|
||||
swap(static_cast<const _Pred&>(*this), static_cast<const _Pred&>(__y));
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Key, class _Cp, class _Pred>
|
||||
@ -465,8 +508,24 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Key& __x, const _Cp& __y) const
|
||||
{return __pred_(__x, __y.__cc.first);}
|
||||
void swap(__unordered_map_equal&__y)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_Pred>::value)
|
||||
{
|
||||
using _VSTD::swap;
|
||||
swap(__pred_, __y.__pred_);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Key, class _Cp, class _Pred, bool __b>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(__unordered_map_equal<_Key, _Cp, _Pred, __b>& __x,
|
||||
__unordered_map_equal<_Key, _Cp, _Pred, __b>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Alloc>
|
||||
class __hash_map_node_destructor
|
||||
{
|
||||
@ -551,7 +610,7 @@ union __hash_value_type
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_value_type(__hash_value_type&& __v)
|
||||
: __nc(std::move(__v.__nc)) {}
|
||||
: __nc(_VSTD::move(__v.__nc)) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_value_type& operator=(const __hash_value_type& __v)
|
||||
@ -559,7 +618,7 @@ union __hash_value_type
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_value_type& operator=(__hash_value_type&& __v)
|
||||
{__nc = std::move(__v.__nc); return *this;}
|
||||
{__nc = _VSTD::move(__v.__nc); return *this;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~__hash_value_type() {__cc.~value_type();}
|
||||
@ -730,13 +789,8 @@ private:
|
||||
typedef __hash_value_type<key_type, mapped_type> __value_type;
|
||||
typedef __unordered_map_hasher<key_type, __value_type, hasher> __hasher;
|
||||
typedef __unordered_map_equal<key_type, __value_type, key_equal> __key_equal;
|
||||
typedef typename 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 typename __rebind_alloc_helper<allocator_traits<allocator_type>,
|
||||
__value_type>::type __allocator_type;
|
||||
|
||||
typedef __hash_table<__value_type, __hasher,
|
||||
__key_equal, __allocator_type> __table;
|
||||
@ -946,9 +1000,125 @@ public:
|
||||
{insert(__il.begin(), __il.end());}
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> try_emplace(const key_type& __k, _Args&&... __args)
|
||||
{
|
||||
iterator __p = __table_.find(__k);
|
||||
if ( __p != end())
|
||||
return _VSTD::make_pair(__p, false);
|
||||
else
|
||||
return _VSTD::make_pair(
|
||||
emplace_hint(__p,
|
||||
_VSTD::piecewise_construct, _VSTD::forward_as_tuple(__k),
|
||||
_VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)),
|
||||
true);
|
||||
}
|
||||
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> try_emplace(key_type&& __k, _Args&&... __args)
|
||||
{
|
||||
iterator __p = __table_.find(__k);
|
||||
if ( __p != end())
|
||||
return _VSTD::make_pair(__p, false);
|
||||
else
|
||||
return _VSTD::make_pair(
|
||||
emplace_hint(__p,
|
||||
_VSTD::piecewise_construct, _VSTD::forward_as_tuple(_VSTD::move(__k)),
|
||||
_VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)),
|
||||
true);
|
||||
}
|
||||
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator try_emplace(const_iterator __h, const key_type& __k, _Args&&... __args)
|
||||
{
|
||||
iterator __p = __table_.find(__k);
|
||||
if ( __p != end())
|
||||
return __p;
|
||||
else
|
||||
return emplace_hint(__h,
|
||||
_VSTD::piecewise_construct, _VSTD::forward_as_tuple(__k),
|
||||
_VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...));
|
||||
}
|
||||
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator try_emplace(const_iterator __h, key_type&& __k, _Args&&... __args)
|
||||
{
|
||||
iterator __p = __table_.find(__k);
|
||||
if ( __p != end())
|
||||
return __p;
|
||||
else
|
||||
return emplace_hint(__h,
|
||||
_VSTD::piecewise_construct, _VSTD::forward_as_tuple(_VSTD::move(__k)),
|
||||
_VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...));
|
||||
}
|
||||
|
||||
template <class _Vp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> insert_or_assign(const key_type& __k, _Vp&& __v)
|
||||
{
|
||||
iterator __p = __table_.find(__k);
|
||||
if ( __p != end())
|
||||
{
|
||||
__p->second = _VSTD::move(__v);
|
||||
return _VSTD::make_pair(__p, false);
|
||||
}
|
||||
return _VSTD::make_pair(emplace_hint(__p, __k, _VSTD::forward<_Vp>(__v)), true);
|
||||
}
|
||||
|
||||
template <class _Vp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> insert_or_assign(key_type&& __k, _Vp&& __v)
|
||||
{
|
||||
iterator __p = __table_.find(__k);
|
||||
if ( __p != end())
|
||||
{
|
||||
__p->second = _VSTD::move(__v);
|
||||
return _VSTD::make_pair(__p, false);
|
||||
}
|
||||
return _VSTD::make_pair(emplace_hint(__p, _VSTD::forward<key_type>(__k), _VSTD::forward<_Vp>(__v)), true);
|
||||
}
|
||||
|
||||
template <class _Vp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert_or_assign(const_iterator __h, const key_type& __k, _Vp&& __v)
|
||||
{
|
||||
iterator __p = __table_.find(__k);
|
||||
if ( __p != end())
|
||||
{
|
||||
__p->second = _VSTD::move(__v);
|
||||
return __p;
|
||||
}
|
||||
return emplace_hint(__h, __k, _VSTD::forward<_Vp>(__v));
|
||||
}
|
||||
|
||||
template <class _Vp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert_or_assign(const_iterator __h, key_type&& __k, _Vp&& __v)
|
||||
{
|
||||
iterator __p = __table_.find(__k);
|
||||
if ( __p != end())
|
||||
{
|
||||
__p->second = _VSTD::move(__v);
|
||||
return __p;
|
||||
}
|
||||
return emplace_hint(__h, _VSTD::forward<key_type>(__k), _VSTD::forward<_Vp>(__v));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator erase(iterator __p) {return __table_.erase(__p.__i_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator erase(const_iterator __first, const_iterator __last)
|
||||
@ -1469,13 +1639,8 @@ private:
|
||||
typedef __hash_value_type<key_type, mapped_type> __value_type;
|
||||
typedef __unordered_map_hasher<key_type, __value_type, hasher> __hasher;
|
||||
typedef __unordered_map_equal<key_type, __value_type, key_equal> __key_equal;
|
||||
typedef typename 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 typename __rebind_alloc_helper<allocator_traits<allocator_type>,
|
||||
__value_type>::type __allocator_type;
|
||||
|
||||
typedef __hash_table<__value_type, __hasher,
|
||||
__key_equal, __allocator_type> __table;
|
||||
@ -1654,6 +1819,8 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator erase(iterator __p) {return __table_.erase(__p.__i_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator erase(const_iterator __first, const_iterator __last)
|
||||
|
@ -114,16 +114,15 @@ public:
|
||||
void insert(initializer_list<value_type>);
|
||||
|
||||
iterator erase(const_iterator position);
|
||||
iterator erase(iterator position); // C++14
|
||||
size_type erase(const key_type& k);
|
||||
iterator erase(const_iterator first, const_iterator last);
|
||||
void clear() noexcept;
|
||||
|
||||
void swap(unordered_set&)
|
||||
noexcept(
|
||||
(!allocator_type::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value) &&
|
||||
__is_nothrow_swappable<hasher>::value &&
|
||||
__is_nothrow_swappable<key_equal>::value);
|
||||
noexcept(allocator_traits<Allocator>::is_always_equal::value &&
|
||||
noexcept(swap(declval<hasher&>(), declval<hasher&>())) &&
|
||||
noexcept(swap(declval<key_equal&>(), declval<key_equal&>()))); // C++17
|
||||
|
||||
hasher hash_function() const;
|
||||
key_equal key_eq() const;
|
||||
@ -263,16 +262,15 @@ public:
|
||||
void insert(initializer_list<value_type>);
|
||||
|
||||
iterator erase(const_iterator position);
|
||||
iterator erase(iterator position); // C++14
|
||||
size_type erase(const key_type& k);
|
||||
iterator erase(const_iterator first, const_iterator last);
|
||||
void clear() noexcept;
|
||||
|
||||
void swap(unordered_multiset&)
|
||||
noexcept(
|
||||
(!allocator_type::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value) &&
|
||||
__is_nothrow_swappable<hasher>::value &&
|
||||
__is_nothrow_swappable<key_equal>::value);
|
||||
noexcept(allocator_traits<Allocator>::is_always_equal::value &&
|
||||
noexcept(swap(declval<hasher&>(), declval<hasher&>())) &&
|
||||
noexcept(swap(declval<key_equal&>(), declval<key_equal&>()))); // C++17
|
||||
|
||||
hasher hash_function() const;
|
||||
key_equal key_eq() const;
|
||||
|
@ -202,6 +202,11 @@ operator>=(const _Tp& __x, const _Tp& __y)
|
||||
|
||||
// swap_ranges
|
||||
|
||||
// forward
|
||||
template<class _Tp, size_t _Np>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value);
|
||||
|
||||
template <class _ForwardIterator1, class _ForwardIterator2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_ForwardIterator2
|
||||
@ -507,10 +512,6 @@ template <class _T1, class _T2>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_size<pair<_T1, _T2> >
|
||||
: public integral_constant<size_t, 2> {};
|
||||
|
||||
template <class _T1, class _T2>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_size<const pair<_T1, _T2> >
|
||||
: public integral_constant<size_t, 2> {};
|
||||
|
||||
template <class _T1, class _T2>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_element<0, pair<_T1, _T2> >
|
||||
{
|
||||
@ -525,20 +526,6 @@ public:
|
||||
typedef _T2 type;
|
||||
};
|
||||
|
||||
template <class _T1, class _T2>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_element<0, const pair<_T1, _T2> >
|
||||
{
|
||||
public:
|
||||
typedef const _T1 type;
|
||||
};
|
||||
|
||||
template <class _T1, class _T2>
|
||||
class _LIBCPP_TYPE_VIS_ONLY tuple_element<1, const pair<_T1, _T2> >
|
||||
{
|
||||
public:
|
||||
typedef const _T2 type;
|
||||
};
|
||||
|
||||
template <size_t _Ip> struct __get_pair;
|
||||
|
||||
template <>
|
||||
|
@ -348,6 +348,7 @@ template <class T> unspecified2 end(const valarray<T>& v);
|
||||
#include <new>
|
||||
|
||||
#include <__undef_min_max>
|
||||
#include <__undef___deallocate>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
|
185
include/vector
185
include/vector
@ -119,8 +119,8 @@ public:
|
||||
void resize(size_type sz, const value_type& c);
|
||||
|
||||
void swap(vector&)
|
||||
noexcept(!allocator_type::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value);
|
||||
noexcept(allocator_traits<allocator_type>::propagate_on_container_swap::value ||
|
||||
allocator_traits<allocator_type>::is_always_equal::value); // C++17
|
||||
|
||||
bool __invariants() const;
|
||||
};
|
||||
@ -237,8 +237,8 @@ public:
|
||||
void resize(size_type sz, value_type x);
|
||||
|
||||
void swap(vector&)
|
||||
noexcept(!allocator_type::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value);
|
||||
noexcept(allocator_traits<allocator_type>::propagate_on_container_swap::value ||
|
||||
allocator_traits<allocator_type>::is_always_equal::value); // C++17
|
||||
void flip() noexcept;
|
||||
|
||||
bool __invariants() const;
|
||||
@ -385,14 +385,6 @@ protected:
|
||||
is_nothrow_move_assignable<allocator_type>::value)
|
||||
{__move_assign_alloc(__c, integral_constant<bool,
|
||||
__alloc_traits::propagate_on_container_move_assignment::value>());}
|
||||
|
||||
_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>());}
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __copy_assign_alloc(const __vector_base& __c, true_type)
|
||||
@ -421,18 +413,6 @@ private:
|
||||
void __move_assign_alloc(__vector_base&, false_type)
|
||||
_NOEXCEPT
|
||||
{}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(allocator_type& __x, allocator_type& __y, true_type)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
|
||||
{
|
||||
using _VSTD::swap;
|
||||
swap(__x, __y);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(allocator_type&, allocator_type&, false_type)
|
||||
_NOEXCEPT
|
||||
{}
|
||||
};
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
@ -500,14 +480,18 @@ public:
|
||||
"Allocator::value_type must be same type as value_type");
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
||||
vector() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit vector(const allocator_type& __a)
|
||||
#if _LIBCPP_STD_VER <= 14
|
||||
_NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
|
||||
#else
|
||||
_NOEXCEPT
|
||||
#endif
|
||||
: __base(__a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
@ -569,7 +553,11 @@ public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector(vector&& __x)
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
_NOEXCEPT;
|
||||
#else
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector(vector&& __x, const allocator_type& __a);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -756,8 +744,12 @@ public:
|
||||
void resize(size_type __sz, const_reference __x);
|
||||
|
||||
void swap(vector&)
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value);
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
_NOEXCEPT;
|
||||
#else
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value);
|
||||
#endif
|
||||
|
||||
bool __invariants() const;
|
||||
|
||||
@ -783,7 +775,7 @@ private:
|
||||
__is_forward_iterator<_ForwardIterator>::value,
|
||||
void
|
||||
>::type
|
||||
__construct_at_end(_ForwardIterator __first, _ForwardIterator __last);
|
||||
__construct_at_end(_ForwardIterator __first, _ForwardIterator __last, size_type __n);
|
||||
void __append(size_type __n);
|
||||
void __append(size_type __n, const_reference __x);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -868,17 +860,17 @@ private:
|
||||
// but if an exception is thrown after that the annotation has to be undone.
|
||||
struct __RAII_IncreaseAnnotator {
|
||||
__RAII_IncreaseAnnotator(const vector &__v, size_type __n = 1)
|
||||
: __commit(false), __v(__v), __n(__n) {
|
||||
: __commit(false), __v(__v), __old_size(__v.size() + __n) {
|
||||
__v.__annotate_increase(__n);
|
||||
}
|
||||
void __done() { __commit = true; }
|
||||
~__RAII_IncreaseAnnotator() {
|
||||
if (__commit) return;
|
||||
__v.__annotate_shrink(__v.size() + __n);
|
||||
__v.__annotate_shrink(__old_size);
|
||||
}
|
||||
bool __commit;
|
||||
size_type __n;
|
||||
const vector &__v;
|
||||
size_type __old_size;
|
||||
};
|
||||
#else
|
||||
struct __RAII_IncreaseAnnotator {
|
||||
@ -1021,16 +1013,12 @@ typename enable_if
|
||||
__is_forward_iterator<_ForwardIterator>::value,
|
||||
void
|
||||
>::type
|
||||
vector<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last)
|
||||
vector<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last, size_type __n)
|
||||
{
|
||||
allocator_type& __a = this->__alloc();
|
||||
for (; __first != __last; ++__first)
|
||||
{
|
||||
__RAII_IncreaseAnnotator __annotator(*this);
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
|
||||
__annotator.__done();
|
||||
++this->__end_;
|
||||
}
|
||||
__RAII_IncreaseAnnotator __annotator(*this, __n);
|
||||
__alloc_traits::__construct_range_forward(__a, __first, __last, this->__end_);
|
||||
__annotator.__done();
|
||||
}
|
||||
|
||||
// Default constructs __n objects starting at __end_
|
||||
@ -1177,7 +1165,7 @@ vector<_Tp, _Allocator>::vector(_ForwardIterator __first,
|
||||
if (__n > 0)
|
||||
{
|
||||
allocate(__n);
|
||||
__construct_at_end(__first, __last);
|
||||
__construct_at_end(__first, __last, __n);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1197,7 +1185,7 @@ vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __las
|
||||
if (__n > 0)
|
||||
{
|
||||
allocate(__n);
|
||||
__construct_at_end(__first, __last);
|
||||
__construct_at_end(__first, __last, __n);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1212,7 +1200,7 @@ vector<_Tp, _Allocator>::vector(const vector& __x)
|
||||
if (__n > 0)
|
||||
{
|
||||
allocate(__n);
|
||||
__construct_at_end(__x.__begin_, __x.__end_);
|
||||
__construct_at_end(__x.__begin_, __x.__end_, __n);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1227,7 +1215,7 @@ vector<_Tp, _Allocator>::vector(const vector& __x, const allocator_type& __a)
|
||||
if (__n > 0)
|
||||
{
|
||||
allocate(__n);
|
||||
__construct_at_end(__x.__begin_, __x.__end_);
|
||||
__construct_at_end(__x.__begin_, __x.__end_, __n);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1236,7 +1224,11 @@ vector<_Tp, _Allocator>::vector(const vector& __x, const allocator_type& __a)
|
||||
template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
vector<_Tp, _Allocator>::vector(vector&& __x)
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
_NOEXCEPT
|
||||
#else
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
|
||||
#endif
|
||||
: __base(_VSTD::move(__x.__alloc()))
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
@ -1286,7 +1278,7 @@ vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il)
|
||||
if (__il.size() > 0)
|
||||
{
|
||||
allocate(__il.size());
|
||||
__construct_at_end(__il.begin(), __il.end());
|
||||
__construct_at_end(__il.begin(), __il.end(), __il.size());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1301,7 +1293,7 @@ vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il, const allocat
|
||||
if (__il.size() > 0)
|
||||
{
|
||||
allocate(__il.size());
|
||||
__construct_at_end(__il.begin(), __il.end());
|
||||
__construct_at_end(__il.begin(), __il.end(), __il.size());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1394,12 +1386,12 @@ typename enable_if
|
||||
>::type
|
||||
vector<_Tp, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last)
|
||||
{
|
||||
typename iterator_traits<_ForwardIterator>::difference_type __new_size = _VSTD::distance(__first, __last);
|
||||
if (static_cast<size_type>(__new_size) <= capacity())
|
||||
size_type __new_size = static_cast<size_type>(_VSTD::distance(__first, __last));
|
||||
if (__new_size <= capacity())
|
||||
{
|
||||
_ForwardIterator __mid = __last;
|
||||
bool __growing = false;
|
||||
if (static_cast<size_type>(__new_size) > size())
|
||||
if (__new_size > size())
|
||||
{
|
||||
__growing = true;
|
||||
__mid = __first;
|
||||
@ -1407,15 +1399,15 @@ vector<_Tp, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __las
|
||||
}
|
||||
pointer __m = _VSTD::copy(__first, __mid, this->__begin_);
|
||||
if (__growing)
|
||||
__construct_at_end(__mid, __last);
|
||||
__construct_at_end(__mid, __last, __new_size - size());
|
||||
else
|
||||
this->__destruct_at_end(__m);
|
||||
}
|
||||
else
|
||||
{
|
||||
deallocate();
|
||||
allocate(__recommend(static_cast<size_type>(__new_size)));
|
||||
__construct_at_end(__first, __last);
|
||||
allocate(__recommend(__new_size));
|
||||
__construct_at_end(__first, __last, __new_size);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1967,8 +1959,9 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __fi
|
||||
if (__n > __dx)
|
||||
{
|
||||
__m = __first;
|
||||
_VSTD::advance(__m, this->__end_ - __p);
|
||||
__construct_at_end(__m, __last);
|
||||
difference_type __diff = this->__end_ - __p;
|
||||
_VSTD::advance(__m, __diff);
|
||||
__construct_at_end(__m, __last, __n - __diff);
|
||||
__n = __dx;
|
||||
}
|
||||
if (__n > 0)
|
||||
@ -2015,8 +2008,12 @@ vector<_Tp, _Allocator>::resize(size_type __sz, const_reference __x)
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
vector<_Tp, _Allocator>::swap(vector& __x)
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value)
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
_NOEXCEPT
|
||||
#else
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value)
|
||||
#endif
|
||||
{
|
||||
_LIBCPP_ASSERT(__alloc_traits::propagate_on_container_swap::value ||
|
||||
this->__alloc() == __x.__alloc(),
|
||||
@ -2025,7 +2022,8 @@ vector<_Tp, _Allocator>::swap(vector& __x)
|
||||
_VSTD::swap(this->__begin_, __x.__begin_);
|
||||
_VSTD::swap(this->__end_, __x.__end_);
|
||||
_VSTD::swap(this->__end_cap(), __x.__end_cap());
|
||||
__base::__swap_alloc(this->__alloc(), __x.__alloc());
|
||||
__swap_allocator(this->__alloc(), __x.__alloc(),
|
||||
integral_constant<bool,__alloc_traits::propagate_on_container_swap::value>());
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
__get_db()->swap(this, &__x);
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
@ -2128,13 +2126,7 @@ public:
|
||||
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
private:
|
||||
typedef typename __alloc_traits::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind_alloc<__storage_type>
|
||||
#else
|
||||
rebind_alloc<__storage_type>::other
|
||||
#endif
|
||||
__storage_allocator;
|
||||
typedef typename __rebind_alloc_helper<__alloc_traits, __storage_type>::type __storage_allocator;
|
||||
typedef allocator_traits<__storage_allocator> __storage_traits;
|
||||
typedef typename __storage_traits::pointer __storage_pointer;
|
||||
typedef typename __storage_traits::const_pointer __const_storage_pointer;
|
||||
@ -2170,9 +2162,14 @@ private:
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
|
||||
_LIBCPP_INLINE_VISIBILITY explicit vector(const allocator_type& __a);
|
||||
vector() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY explicit vector(const allocator_type& __a)
|
||||
#if _LIBCPP_STD_VER <= 14
|
||||
_NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value);
|
||||
#else
|
||||
_NOEXCEPT;
|
||||
#endif
|
||||
~vector();
|
||||
explicit vector(size_type __n);
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
@ -2206,7 +2203,11 @@ public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector(vector&& __v)
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
_NOEXCEPT;
|
||||
#else
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
|
||||
#endif
|
||||
vector(vector&& __v, const allocator_type& __a);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector& operator=(vector&& __v)
|
||||
@ -2354,8 +2355,12 @@ public:
|
||||
void clear() _NOEXCEPT {__size_ = 0;}
|
||||
|
||||
void swap(vector&)
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value);
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
_NOEXCEPT;
|
||||
#else
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value);
|
||||
#endif
|
||||
|
||||
void resize(size_type __sz, value_type __x = false);
|
||||
void flip() _NOEXCEPT;
|
||||
@ -2433,26 +2438,6 @@ private:
|
||||
_NOEXCEPT
|
||||
{}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__storage_allocator& __x, __storage_allocator& __y)
|
||||
_NOEXCEPT_(
|
||||
!__storage_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value)
|
||||
{__swap_alloc(__x, __y, integral_constant<bool,
|
||||
__storage_traits::propagate_on_container_swap::value>());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__storage_allocator& __x, __storage_allocator& __y, true_type)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<allocator_type>::value)
|
||||
{
|
||||
using _VSTD::swap;
|
||||
swap(__x, __y);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__storage_allocator&, __storage_allocator&, false_type)
|
||||
_NOEXCEPT
|
||||
{}
|
||||
|
||||
size_t __hash_code() const _NOEXCEPT;
|
||||
|
||||
friend class __bit_reference<vector>;
|
||||
@ -2559,7 +2544,7 @@ vector<bool, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardI
|
||||
template <class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
vector<bool, _Allocator>::vector()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
||||
: __begin_(nullptr),
|
||||
__size_(0),
|
||||
__cap_alloc_(0)
|
||||
@ -2569,6 +2554,11 @@ vector<bool, _Allocator>::vector()
|
||||
template <class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
vector<bool, _Allocator>::vector(const allocator_type& __a)
|
||||
#if _LIBCPP_STD_VER <= 14
|
||||
_NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
|
||||
#else
|
||||
_NOEXCEPT
|
||||
#endif
|
||||
: __begin_(nullptr),
|
||||
__size_(0),
|
||||
__cap_alloc_(0, static_cast<__storage_allocator>(__a))
|
||||
@ -2807,7 +2797,11 @@ vector<bool, _Allocator>::operator=(const vector& __v)
|
||||
template <class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
vector<bool, _Allocator>::vector(vector&& __v)
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
_NOEXCEPT
|
||||
#else
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
|
||||
#endif
|
||||
: __begin_(__v.__begin_),
|
||||
__size_(__v.__size_),
|
||||
__cap_alloc_(__v.__cap_alloc_)
|
||||
@ -3150,13 +3144,18 @@ vector<bool, _Allocator>::erase(const_iterator __first, const_iterator __last)
|
||||
template <class _Allocator>
|
||||
void
|
||||
vector<bool, _Allocator>::swap(vector& __x)
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value)
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
_NOEXCEPT
|
||||
#else
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value)
|
||||
#endif
|
||||
{
|
||||
_VSTD::swap(this->__begin_, __x.__begin_);
|
||||
_VSTD::swap(this->__size_, __x.__size_);
|
||||
_VSTD::swap(this->__cap(), __x.__cap());
|
||||
__swap_alloc(this->__alloc(), __x.__alloc());
|
||||
__swap_allocator(this->__alloc(), __x.__alloc(),
|
||||
integral_constant<bool, __alloc_traits::propagate_on_container_swap::value>());
|
||||
}
|
||||
|
||||
template <class _Allocator>
|
||||
|
131
lib/CMakeLists.txt
Normal file
131
lib/CMakeLists.txt
Normal file
@ -0,0 +1,131 @@
|
||||
set(LIBCXX_LIB_CMAKEFILES_DIR "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}" PARENT_SCOPE)
|
||||
|
||||
# Get sources
|
||||
file(GLOB LIBCXX_SOURCES ../src/*.cpp)
|
||||
if(WIN32)
|
||||
file(GLOB LIBCXX_WIN32_SOURCES ../src/support/win32/*.cpp)
|
||||
list(APPEND LIBCXX_SOURCES ${LIBCXX_WIN32_SOURCES})
|
||||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")
|
||||
file(GLOB LIBCXX_SOLARIS_SOURCES ../src/support/solaris/*.c)
|
||||
list(APPEND LIBCXX_SOURCES ${LIBCXX_SOLARIS_SOURCES})
|
||||
endif()
|
||||
|
||||
# Add all the headers to the project for IDEs.
|
||||
if (MSVC_IDE OR XCODE)
|
||||
file(GLOB_RECURSE LIBCXX_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../include/*)
|
||||
if(WIN32)
|
||||
file( GLOB LIBCXX_WIN32_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../include/support/win32/*.h)
|
||||
list(APPEND LIBCXX_HEADERS ${LIBCXX_WIN32_HEADERS})
|
||||
endif()
|
||||
# Force them all into the headers dir on MSVC, otherwise they end up at
|
||||
# project scope because they don't have extensions.
|
||||
if (MSVC_IDE)
|
||||
source_group("Header Files" FILES ${LIBCXX_HEADERS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (LIBCXX_ENABLE_SHARED)
|
||||
add_library(cxx SHARED
|
||||
${LIBCXX_SOURCES}
|
||||
${LIBCXX_HEADERS}
|
||||
)
|
||||
else()
|
||||
add_library(cxx STATIC
|
||||
${LIBCXX_SOURCES}
|
||||
${LIBCXX_HEADERS}
|
||||
)
|
||||
endif()
|
||||
|
||||
#if LIBCXX_CXX_ABI_LIBRARY_PATH is defined we want to add it to the search path.
|
||||
if (DEFINED LIBCXX_CXX_ABI_LIBRARY_PATH)
|
||||
target_link_libraries(cxx "-L${LIBCXX_CXX_ABI_LIBRARY_PATH}")
|
||||
endif()
|
||||
|
||||
if (DEFINED LIBCXX_CXX_ABI_DEPS)
|
||||
add_dependencies(cxx LIBCXX_CXX_ABI_DEPS)
|
||||
endif()
|
||||
|
||||
set(libraries "")
|
||||
if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY)
|
||||
# TODO(ericwf): Remove these GNU specific linker flags and let CMake do the
|
||||
# configuration. This will be more portable.
|
||||
list(APPEND libraries "-Wl,--whole-archive" "-Wl,-Bstatic")
|
||||
list(APPEND libraries "${LIBCXX_CXX_ABI_LIBRARY}")
|
||||
list(APPEND libraries "-Wl,-Bdynamic" "-Wl,--no-whole-archive")
|
||||
else()
|
||||
list(APPEND libraries "${LIBCXX_CXX_ABI_LIBRARY}")
|
||||
endif()
|
||||
|
||||
# Generate library list.
|
||||
append_if(libraries LIBCXX_HAS_PTHREAD_LIB pthread)
|
||||
append_if(libraries LIBCXX_HAS_C_LIB c)
|
||||
append_if(libraries LIBCXX_HAS_M_LIB m)
|
||||
append_if(libraries LIBCXX_HAS_RT_LIB rt)
|
||||
append_if(libraries LIBCXX_HAS_GCC_S_LIB gcc_s)
|
||||
|
||||
if (LIBCXX_COVERAGE_LIBRARY)
|
||||
target_link_libraries(cxx ${LIBCXX_COVERAGE_LIBRARY})
|
||||
endif()
|
||||
target_link_libraries(cxx ${libraries})
|
||||
|
||||
|
||||
# Setup flags.
|
||||
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_FPIC_FLAG -fPIC)
|
||||
append_if(LIBCXX_LINK_FLAGS LIBCXX_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)
|
||||
|
||||
if ( APPLE AND (LIBCXX_CXX_ABI_LIBNAME STREQUAL "libcxxabi" OR
|
||||
LIBCXX_CXX_ABI_LIBNAME STREQUAL "none"))
|
||||
if (NOT DEFINED LIBCXX_LIBCPPABI_VERSION)
|
||||
set(LIBCXX_LIBCPPABI_VERSION "2")
|
||||
endif()
|
||||
|
||||
if ( CMAKE_OSX_DEPLOYMENT_TARGET STREQUAL "10.6" )
|
||||
list(APPEND LIBCXX_COMPILE_FLAGS "-U__STRICT_ANSI__")
|
||||
list(APPEND LIBCXX_LINK_FLAGS
|
||||
"-compatibility_version 1"
|
||||
"-current_version 1"
|
||||
"-install_name /usr/lib/libc++.1.dylib"
|
||||
"-Wl,-reexport_library,/usr/lib/libc++abi.dylib"
|
||||
"-Wl,-unexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++unexp.exp"
|
||||
"/usr/lib/libSystem.B.dylib")
|
||||
else()
|
||||
if ( ${CMAKE_OSX_SYSROOT} )
|
||||
list(FIND ${CMAKE_OSX_ARCHITECTURES} "armv7" OSX_HAS_ARMV7)
|
||||
if (OSX_HAS_ARMV7)
|
||||
set(OSX_RE_EXPORT_LINE
|
||||
"${CMAKE_OSX_SYSROOT}/usr/lib/libc++abi.dylib"
|
||||
"-Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++sjlj-abi.exp")
|
||||
else()
|
||||
set(OSX_RE_EXPORT_LINE
|
||||
"-Wl,-reexport_library,${CMAKE_OSX_SYSROOT}/usr/lib/libc++abi.dylib")
|
||||
endif()
|
||||
else()
|
||||
set (OSX_RE_EXPORT_LINE "/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++abi${LIBCXX_LIBCPPABI_VERSION}.exp")
|
||||
endif()
|
||||
|
||||
list(APPEND LIBCXX_LINK_FLAGS
|
||||
"-compatibility_version 1"
|
||||
"-install_name /usr/lib/libc++.1.dylib"
|
||||
"-Wl,-unexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++unexp.exp"
|
||||
"${OSX_RE_EXPORT_LINE}"
|
||||
"-Wl,-force_symbols_not_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/notweak.exp"
|
||||
"-Wl,-force_symbols_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/weak.exp")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
string(REPLACE ";" " " LIBCXX_COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}")
|
||||
string(REPLACE ";" " " LIBCXX_LINK_FLAGS "${LIBCXX_LINK_FLAGS}")
|
||||
|
||||
set_target_properties(cxx
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}"
|
||||
LINK_FLAGS "${LIBCXX_LINK_FLAGS}"
|
||||
OUTPUT_NAME "c++"
|
||||
VERSION "1.0"
|
||||
SOVERSION "1"
|
||||
)
|
||||
|
||||
install(TARGETS cxx
|
||||
LIBRARY DESTINATION lib${LIBCXX_LIBDIR_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LIBCXX_LIBDIR_SUFFIX}
|
||||
)
|
179
lib/buildit
Executable file
179
lib/buildit
Executable file
@ -0,0 +1,179 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Set the $TRIPLE environment variable to your system's triple before
|
||||
# running this script. If you set $CXX, that will be used to compile
|
||||
# the library. Otherwise we'll use clang++.
|
||||
|
||||
set -e
|
||||
|
||||
if [ `basename $(pwd)` != "lib" ]
|
||||
then
|
||||
echo "current directory must be lib"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$CXX" ]
|
||||
then
|
||||
CXX=clang++
|
||||
fi
|
||||
|
||||
if [ -z "$CXX_LANG" ]
|
||||
then
|
||||
CXX_LANG=c++11
|
||||
fi
|
||||
|
||||
if [ -z "$CC" ]
|
||||
then
|
||||
CC=clang
|
||||
fi
|
||||
|
||||
if [ -z "$MACOSX_DEPLOYMENT_TARGET" ]
|
||||
then
|
||||
if [ -z "$IPHONEOS_DEPLOYMENT_TARGET" ]
|
||||
then
|
||||
MACOSX_DEPLOYMENT_TARGET=10.7
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$RC_ProjectSourceVersion" ]
|
||||
then
|
||||
RC_ProjectSourceVersion=1
|
||||
fi
|
||||
|
||||
EXTRA_FLAGS="-nostdinc++ -std=${CXX_LANG} -fstrict-aliasing -Wall -Wextra -Wshadow -Wconversion \
|
||||
-Wpadded -Wstrict-aliasing=2 -Wstrict-overflow=4 "
|
||||
|
||||
case $TRIPLE in
|
||||
*-apple-*)
|
||||
if [ -z $RC_XBS ]
|
||||
then
|
||||
RC_CFLAGS="-arch i386 -arch x86_64"
|
||||
fi
|
||||
SOEXT=dylib
|
||||
if [ "$MACOSX_DEPLOYMENT_TARGET" = "10.6" ]
|
||||
then
|
||||
EXTRA_FLAGS="-nostdinc++ -std=c++11 -U__STRICT_ANSI__"
|
||||
LDSHARED_FLAGS="-o libc++.1.dylib \
|
||||
-dynamiclib -nodefaultlibs -current_version 1 \
|
||||
-compatibility_version 1 \
|
||||
-install_name /usr/lib/libc++.1.dylib \
|
||||
-Wl,-reexport_library,/usr/lib/libc++abi.dylib \
|
||||
-Wl,-unexported_symbols_list,libc++unexp.exp \
|
||||
/usr/lib/libSystem.B.dylib"
|
||||
else
|
||||
if [ -n "$SDKROOT" ]
|
||||
then
|
||||
EXTRA_FLAGS+="-isysroot ${SDKROOT} "
|
||||
if echo "${RC_ARCHS}" | grep -q "armv7"
|
||||
then
|
||||
RE_EXPORT_LINE="${SDKROOT}/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,libc++sjlj-abi.exp"
|
||||
else
|
||||
RE_EXPORT_LINE="-Wl,-reexport_library,${SDKROOT}/usr/lib/libc++abi.dylib"
|
||||
fi
|
||||
CXX=`xcrun -sdk "${SDKROOT}" -find clang++`
|
||||
CC=`xcrun -sdk "${SDKROOT}" -find clang`
|
||||
else
|
||||
# Check if we have _LIBCPPABI_VERSION, to determine the reexport list to use.
|
||||
if (echo "#include <cxxabi.h>" | $CXX -E -dM -x c++ - | \
|
||||
grep _LIBCPPABI_VERSION > /dev/null)
|
||||
then
|
||||
RE_EXPORT_LINE="/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,libc++abi2.exp"
|
||||
else
|
||||
RE_EXPORT_LINE="/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,libc++abi.exp"
|
||||
fi
|
||||
fi
|
||||
LDSHARED_FLAGS="-o libc++.1.dylib \
|
||||
-dynamiclib -nodefaultlibs \
|
||||
-current_version ${RC_ProjectSourceVersion} \
|
||||
-compatibility_version 1 \
|
||||
-install_name /usr/lib/libc++.1.dylib \
|
||||
-lSystem \
|
||||
-Wl,-unexported_symbols_list,libc++unexp.exp \
|
||||
${RE_EXPORT_LINE} \
|
||||
-Wl,-force_symbols_not_weak_list,notweak.exp \
|
||||
-Wl,-force_symbols_weak_list,weak.exp"
|
||||
fi
|
||||
;;
|
||||
*-*-mingw*)
|
||||
# FIXME: removing libgcc and libsupc++ dependencies means porting libcxxrt and LLVM/compiler-rt
|
||||
SOEXT=dll
|
||||
LDSHARED_FLAGS="-o libc++.dll \
|
||||
-shared -nodefaultlibs -Wl,--export-all-symbols -Wl,--allow-multiple-definition -Wl,--out-implib,libc++.dll.a \
|
||||
-lsupc++ -lpthread -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcr100 -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt"
|
||||
;;
|
||||
*-ibm-*)
|
||||
hostOS=`uname`
|
||||
hostOS=`echo $hostOS | sed -e "s/\s+$//"`
|
||||
hostOS=`echo $hostOS | tr '[A-Z]' '[a-z]'`
|
||||
|
||||
if [ $hostOS = "linux" ]
|
||||
then
|
||||
LDSHARED_FLAGS="-o libc++.so.1 \
|
||||
-qmkshrobj -Wl,-soname,libc++.so.1 \
|
||||
-lpthread -lrt -lc -lstdc++"
|
||||
EXTRA_FLAGS="-qlanglvl=extended0x -D__GLIBCXX__=1"
|
||||
else
|
||||
LDSHARED_FLAGS="-o shr.o -qmkshrobj -lpthread -bnoquiet"
|
||||
EXTRA_FLAGS="-qlanglvl=extended0x"
|
||||
fi
|
||||
RC_CFLAGS="-qpic=large"
|
||||
;;
|
||||
*)
|
||||
RC_CFLAGS="-fPIC"
|
||||
SOEXT=so
|
||||
LDSHARED_FLAGS="-o libc++.so.1.0 \
|
||||
-shared -nodefaultlibs -Wl,-soname,libc++.so.1 \
|
||||
-lpthread -lrt -lc -lstdc++"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$RC_XBS" ]
|
||||
then
|
||||
rm -f libc++.1.$SOEXT*
|
||||
fi
|
||||
|
||||
set -x
|
||||
|
||||
for FILE in ../src/*.cpp; do
|
||||
$CXX -c -g -Os $RC_CFLAGS $EXTRA_FLAGS -I../include $FILE
|
||||
done
|
||||
case $TRIPLE in
|
||||
*-*-mingw*)
|
||||
for FILE in ../src/support/win32/*.cpp; do
|
||||
$CXX -c -g -Os $RC_CFLAGS $EXTRA_FLAGS -I../include $FILE
|
||||
done
|
||||
;;
|
||||
esac
|
||||
$CC *.o $RC_CFLAGS $LDSHARED_FLAGS $EXTRA_FLAGS
|
||||
|
||||
#libtool -static -o libc++.a *.o
|
||||
|
||||
# Create the link for the final library name, so that we can use this directory
|
||||
# as a link target for the tests.
|
||||
case $TRIPLE in
|
||||
*-apple-*)
|
||||
rm -f libc++.dylib
|
||||
ln -s libc++.1.dylib libc++.dylib
|
||||
;;
|
||||
*-*-mingw*)
|
||||
;;
|
||||
*-ibm-*)
|
||||
if [ $hostOS = "linux" ]
|
||||
then
|
||||
rm -f libc++.so
|
||||
ln -s libc++.so.1 libc++.so
|
||||
else #AIX
|
||||
rm -f libc++.a
|
||||
ar r libc++.a shr.o
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
rm -f libc++.so
|
||||
ln -s libc++.so.1 libc++.so
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$RC_XBS" ]
|
||||
then
|
||||
rm *.o
|
||||
fi
|
159
lib/libc++abi.exp
Normal file
159
lib/libc++abi.exp
Normal file
@ -0,0 +1,159 @@
|
||||
___cxa_allocate_exception
|
||||
___cxa_end_catch
|
||||
___cxa_demangle
|
||||
___cxa_current_exception_type
|
||||
___cxa_call_unexpected
|
||||
___cxa_free_exception
|
||||
___cxa_get_exception_ptr
|
||||
___cxa_get_globals
|
||||
___cxa_get_globals_fast
|
||||
___cxa_guard_abort
|
||||
___cxa_guard_acquire
|
||||
___cxa_guard_release
|
||||
___cxa_rethrow
|
||||
___cxa_pure_virtual
|
||||
___cxa_begin_catch
|
||||
___cxa_throw
|
||||
___cxa_vec_cctor
|
||||
___cxa_vec_cleanup
|
||||
___cxa_vec_ctor
|
||||
___cxa_vec_delete
|
||||
___cxa_vec_delete2
|
||||
___cxa_vec_delete3
|
||||
___cxa_vec_dtor
|
||||
___cxa_vec_new
|
||||
___cxa_vec_new2
|
||||
___cxa_vec_new3
|
||||
___dynamic_cast
|
||||
___gxx_personality_v0
|
||||
__ZTIDi
|
||||
__ZTIDn
|
||||
__ZTIDs
|
||||
__ZTIPDi
|
||||
__ZTIPDn
|
||||
__ZTIPDs
|
||||
__ZTIPKDi
|
||||
__ZTIPKDn
|
||||
__ZTIPKDs
|
||||
__ZTSPm
|
||||
__ZTSPl
|
||||
__ZTSPj
|
||||
__ZTSPi
|
||||
__ZTSPh
|
||||
__ZTSPf
|
||||
__ZTSPe
|
||||
__ZTSPd
|
||||
__ZTSPc
|
||||
__ZTSPb
|
||||
__ZTSPa
|
||||
__ZTSPKc
|
||||
__ZTSPKy
|
||||
__ZTSPKx
|
||||
__ZTSPKw
|
||||
__ZTSPKv
|
||||
__ZTSPKt
|
||||
__ZTSPKs
|
||||
__ZTSPKm
|
||||
__ZTSPKl
|
||||
__ZTSPKi
|
||||
__ZTSPKh
|
||||
__ZTSPs
|
||||
__ZTSPt
|
||||
__ZTSPv
|
||||
__ZTSPw
|
||||
__ZTSPKa
|
||||
__ZTSPx
|
||||
__ZTSPy
|
||||
__ZTSPKd
|
||||
__ZTSPKe
|
||||
__ZTSPKj
|
||||
__ZTSPKb
|
||||
__ZTSPKf
|
||||
__ZTSv
|
||||
__ZTSt
|
||||
__ZTSs
|
||||
__ZTSm
|
||||
__ZTSl
|
||||
__ZTSj
|
||||
__ZTSi
|
||||
__ZTSh
|
||||
__ZTSf
|
||||
__ZTSe
|
||||
__ZTSd
|
||||
__ZTSc
|
||||
__ZTSw
|
||||
__ZTSx
|
||||
__ZTSy
|
||||
__ZTSb
|
||||
__ZTSa
|
||||
__ZTIPKh
|
||||
__ZTIPKf
|
||||
__ZTIPKe
|
||||
__ZTIPKd
|
||||
__ZTIPKc
|
||||
__ZTIPKb
|
||||
__ZTIPKa
|
||||
__ZTIPy
|
||||
__ZTIPx
|
||||
__ZTIPw
|
||||
__ZTIPv
|
||||
__ZTIPt
|
||||
__ZTIPs
|
||||
__ZTIPm
|
||||
__ZTIPl
|
||||
__ZTIPj
|
||||
__ZTIPi
|
||||
__ZTIPKi
|
||||
__ZTIPKj
|
||||
__ZTIPKl
|
||||
__ZTIPKm
|
||||
__ZTIPKs
|
||||
__ZTIPKt
|
||||
__ZTIPKv
|
||||
__ZTIPKw
|
||||
__ZTIPKx
|
||||
__ZTIPKy
|
||||
__ZTIPa
|
||||
__ZTIPb
|
||||
__ZTIPc
|
||||
__ZTIPd
|
||||
__ZTIPe
|
||||
__ZTIPf
|
||||
__ZTIPh
|
||||
__ZTVN10__cxxabiv129__pointer_to_member_type_infoE
|
||||
__ZTVN10__cxxabiv116__enum_type_infoE
|
||||
__ZTVN10__cxxabiv117__array_type_infoE
|
||||
__ZTVN10__cxxabiv117__class_type_infoE
|
||||
__ZTVN10__cxxabiv117__pbase_type_infoE
|
||||
__ZTVN10__cxxabiv119__pointer_type_infoE
|
||||
__ZTVN10__cxxabiv120__function_type_infoE
|
||||
__ZTVN10__cxxabiv120__si_class_type_infoE
|
||||
__ZTVN10__cxxabiv121__vmi_class_type_infoE
|
||||
__ZTVN10__cxxabiv123__fundamental_type_infoE
|
||||
__ZTIa
|
||||
__ZTIb
|
||||
__ZTIc
|
||||
__ZTId
|
||||
__ZTIe
|
||||
__ZTIf
|
||||
__ZTIh
|
||||
__ZTIi
|
||||
__ZTIj
|
||||
__ZTIl
|
||||
__ZTIm
|
||||
__ZTIs
|
||||
__ZTIt
|
||||
__ZTSN10__cxxabiv129__pointer_to_member_type_infoE
|
||||
__ZTSN10__cxxabiv123__fundamental_type_infoE
|
||||
__ZTSN10__cxxabiv121__vmi_class_type_infoE
|
||||
__ZTSN10__cxxabiv120__si_class_type_infoE
|
||||
__ZTSN10__cxxabiv120__function_type_infoE
|
||||
__ZTSN10__cxxabiv119__pointer_type_infoE
|
||||
__ZTSN10__cxxabiv117__pbase_type_infoE
|
||||
__ZTSN10__cxxabiv117__class_type_infoE
|
||||
__ZTSN10__cxxabiv117__array_type_infoE
|
||||
__ZTSN10__cxxabiv116__enum_type_infoE
|
||||
__ZTIy
|
||||
__ZTIx
|
||||
__ZTIw
|
||||
__ZTIv
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user