Merge to upstream r222492.
Change-Id: I6a0a6e90d217a69531ec3bb5ca0a367f39f4a1da
This commit is contained in:
189
CMakeLists.txt
189
CMakeLists.txt
@@ -84,104 +84,20 @@ get_target_triple(LIBCXX_TARGET_TRIPLE
|
||||
)
|
||||
set(LIBCXX_TARGET_TRIPLE ${LIBCXX_TARGET_TRIPLE} CACHE STRING "Target triple.")
|
||||
|
||||
#===============================================================================
|
||||
# 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
|
||||
# abilibs : A list of libraries 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 abipathvar abidefines abilibs abifiles abidirs)
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS ${abidefines})
|
||||
set(${abipathvar} "${${abipathvar}}"
|
||||
CACHE PATH
|
||||
"Paths to C++ ABI header directories separated by ';'." FORCE
|
||||
)
|
||||
set(LIBCXX_CXX_ABI_LIBRARIES ${abilibs})
|
||||
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 ${${abipathvar}})
|
||||
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}"
|
||||
)
|
||||
list(APPEND abilib_headers "${CMAKE_BINARY_DIR}/include/${fpath}")
|
||||
endif()
|
||||
endforeach()
|
||||
if (NOT found)
|
||||
message(FATAL_ERROR "Failed to find ${fpath}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
add_custom_target(LIBCXX_CXX_ABI_DEPS DEPENDS ${abilib_headers})
|
||||
include_directories("${CMAKE_BINARY_DIR}/include")
|
||||
|
||||
install(FILES ${abilib_headers}
|
||||
DESTINATION include/c++/v1
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
)
|
||||
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("LIBCXX_LIBSUPCXX_INCLUDE_PATHS"
|
||||
"-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.
|
||||
set(CXXABI_LIBNAME cxxabi)
|
||||
else()
|
||||
# Assume c++abi is installed in the system, rely on -lc++abi link flag.
|
||||
set(CXXABI_LIBNAME "c++abi")
|
||||
endif()
|
||||
setup_abi_lib("LIBCXX_LIBCXXABI_INCLUDE_PATHS" ""
|
||||
${CXXABI_LIBNAME} "cxxabi.h" ""
|
||||
)
|
||||
elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxrt")
|
||||
setup_abi_lib("LIBCXX_LIBCXXRT_INCLUDE_PATHS" "-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 ()
|
||||
# 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)
|
||||
|
||||
#===============================================================================
|
||||
# Setup Compiler Flags
|
||||
@@ -195,8 +111,9 @@ if (MSVC)
|
||||
# headers.
|
||||
else()
|
||||
if (LIBCXX_HAS_NOSTDINCXX_FLAG)
|
||||
list(APPEND LIBCXX_CXX_REQUIRED_FLAGS -nostdinc++)
|
||||
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.
|
||||
@@ -214,7 +131,7 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
# LIBCXX_STD_VERSION should always be set at this point.
|
||||
list(APPEND LIBCXX_CXX_REQUIRED_FLAGS "-std=${LIBCXX_STD_VERSION}")
|
||||
list(APPEND LIBCXX_CXX_FLAGS "-std=${LIBCXX_STD_VERSION}")
|
||||
endif()
|
||||
|
||||
macro(append_if list condition var)
|
||||
@@ -225,23 +142,23 @@ endmacro()
|
||||
|
||||
# Get warning flags
|
||||
if (NOT MSVC)
|
||||
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
|
||||
list(APPEND LIBCXX_CXX_REQUIRED_FLAGS -Werror=return-type)
|
||||
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
|
||||
list(APPEND LIBCXX_COMPILE_FLAGS -Werror=return-type)
|
||||
endif()
|
||||
|
||||
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_W_FLAG -W)
|
||||
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG -Wno-unused-parameter)
|
||||
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings)
|
||||
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WNO_LONG_LONG_FLAG -Wno-long-long)
|
||||
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_CXX_WARNING_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror)
|
||||
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WX_FLAG -WX)
|
||||
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror)
|
||||
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_WX_FLAG -WX)
|
||||
else()
|
||||
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WNO_ERROR_FLAG -Wno-error)
|
||||
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_NO_WX_FLAG -WX-)
|
||||
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_CXX_WARNING_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
|
||||
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
|
||||
endif()
|
||||
|
||||
# Get feature flags.
|
||||
@@ -249,39 +166,39 @@ endif()
|
||||
if (LIBCXX_ENABLE_EXCEPTIONS)
|
||||
# Catches C++ exceptions only and tells the compiler to assume that extern C
|
||||
# functions never throw a C++ exception.
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_EHSC_FLAG -EHsc)
|
||||
append_if(LIBCXX_CXX_FLAGS LIBCXX_HAS_EHSC_FLAG -EHsc)
|
||||
else()
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_NO_EXCEPTIONS)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_EHS_FLAG -EHs-)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_EHA_FLAG -EHa-)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_EXCEPTIONS_FLAG -fno-exceptions)
|
||||
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_FEATURE_FLAGS -D_LIBCPP_NO_RTTI)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_GR_FLAG -GR-)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti)
|
||||
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_CXX_FEATURE_FLAGS -D_DEBUG)
|
||||
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_CXX_FEATURE_FLAGS -UNDEBUG)
|
||||
list(APPEND LIBCXX_COMPILE_FLAGS -UNDEBUG)
|
||||
endif()
|
||||
else()
|
||||
if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -DNDEBUG)
|
||||
list(APPEND LIBCXX_COMPILE_FLAGS -DNDEBUG)
|
||||
endif()
|
||||
endif()
|
||||
# Static library
|
||||
if (NOT LIBCXX_ENABLE_SHARED)
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_BUILD_STATIC)
|
||||
list(APPEND LIBCXX_COMPILE_FLAGS -D_LIBCPP_BUILD_STATIC)
|
||||
endif()
|
||||
|
||||
# This is the _ONLY_ place where add_definitions is called.
|
||||
@@ -295,15 +212,25 @@ 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_FEATURE_FLAGS LIBCXX_HAS_NO_OMIT_FRAME_POINTER_FLAG
|
||||
append_if(LIBCXX_CXX_FLAGS LIBCXX_HAS_FNO_OMIT_FRAME_POINTER_FLAG
|
||||
"-fno-omit-frame-pointer")
|
||||
if (LLVM_USE_SANITIZER STREQUAL "Address")
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS "-fsanitize=address")
|
||||
elseif (LLVM_USE_SANITIZER MATCHES "Memory(WithOrigins)?")
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS "-fsanitize=memory")
|
||||
if (LLVM_USE_SANITIZER STREQUAL "MemoryWithOrigins")
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS "-fsanitize-memory-track-origins")
|
||||
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()
|
||||
@@ -312,14 +239,8 @@ if (LIBCXX_BUILT_STANDALONE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
string(REPLACE ";" " " LIBCXX_CXX_REQUIRED_FLAGS "${LIBCXX_CXX_REQUIRED_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCXX_CXX_REQUIRED_FLAGS}")
|
||||
|
||||
string(REPLACE ";" " " LIBCXX_CXX_WARNING_FLAGS "${LIBCXX_CXX_WARNING_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCXX_CXX_WARNING_FLAGS}")
|
||||
|
||||
string(REPLACE ";" " " LIBCXX_CXX_FEATURE_FLAGS "${LIBCXX_CXX_FEATURE_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCXX_CXX_FEATURE_FLAGS}")
|
||||
string(REPLACE ";" " " LIBCXX_CXX_FLAGS "${LIBCXX_CXX_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCXX_CXX_FLAGS}")
|
||||
|
||||
#===============================================================================
|
||||
# Setup Source Code
|
||||
|
||||
98
cmake/Modules/HandleLibCXXABI.cmake
Normal file
98
cmake/Modules/HandleLibCXXABI.cmake
Normal file
@@ -0,0 +1,98 @@
|
||||
|
||||
#===============================================================================
|
||||
# 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 abipathvar abidefines abilib abifiles abidirs)
|
||||
list(APPEND LIBCXX_COMPILE_FLAGS ${abidefines})
|
||||
set(${abipathvar} "${${abipathvar}}"
|
||||
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 ${${abipathvar}})
|
||||
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(FATAL_ERROR "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("LIBCXX_LIBSUPCXX_INCLUDE_PATHS"
|
||||
"-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.
|
||||
set(CXXABI_LIBNAME cxxabi)
|
||||
else()
|
||||
# Assume c++abi is installed in the system, rely on -lc++abi link flag.
|
||||
set(CXXABI_LIBNAME "c++abi")
|
||||
endif()
|
||||
setup_abi_lib("LIBCXX_LIBCXXABI_INCLUDE_PATHS" ""
|
||||
${CXXABI_LIBNAME} "cxxabi.h" ""
|
||||
)
|
||||
elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxrt")
|
||||
setup_abi_lib("LIBCXX_LIBCXXRT_INCLUDE_PATHS" "-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 ()
|
||||
@@ -5,7 +5,7 @@ include(CheckCXXCompilerFlag)
|
||||
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_NO_OMIT_FRAME_POINTER_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)
|
||||
@@ -18,6 +18,7 @@ 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)
|
||||
|
||||
@@ -1,13 +1,22 @@
|
||||
if (NOT LIBCXX_INSTALL_SUPPORT_HEADERS)
|
||||
set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE)
|
||||
endif()
|
||||
|
||||
install(DIRECTORY .
|
||||
DESTINATION include/c++/v1
|
||||
FILES_MATCHING
|
||||
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}
|
||||
)
|
||||
|
||||
install(DIRECTORY .
|
||||
DESTINATION include/c++/v1
|
||||
FILES_MATCHING
|
||||
${LIBCXX_HEADER_PATTERN}
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
)
|
||||
|
||||
@@ -19,6 +19,11 @@
|
||||
#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
|
||||
#endif
|
||||
|
||||
#if !_WIN32
|
||||
#include <unistd.h>
|
||||
#include <errno.h> // for ELAST on FreeBSD
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_VERSION 1101
|
||||
|
||||
#define _LIBCPP_ABI_VERSION 1
|
||||
@@ -221,7 +226,8 @@
|
||||
#endif
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
typedef __char16_t char16_t;
|
||||
typedef __char32_t char32_t;
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_exceptions))
|
||||
@@ -603,7 +609,7 @@ template <unsigned> struct __static_assert_check {};
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_EXTERN_TEMPLATE
|
||||
#define _LIBCPP_EXTERN_TEMPLATE(...)
|
||||
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_EXTERN_TEMPLATE2
|
||||
@@ -630,6 +636,19 @@ 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
|
||||
#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
|
||||
|
||||
@@ -11,19 +11,23 @@
|
||||
#ifndef _LIBCPP_DEBUG_H
|
||||
#define _LIBCPP_DEBUG_H
|
||||
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 1
|
||||
|
||||
# include <cstdlib>
|
||||
# include <cstdio>
|
||||
# include <cstddef>
|
||||
# ifndef _LIBCPP_ASSERT
|
||||
# define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (_VSTD::printf("%s\n", m), _VSTD::abort()))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_ASSERT
|
||||
# define _LIBCPP_ASSERT(x, m) ((void)0)
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
|
||||
@@ -20,11 +20,7 @@
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
# include <__debug>
|
||||
#else
|
||||
# define _LIBCPP_ASSERT(x, m) ((void)0)
|
||||
#endif
|
||||
#include <__debug>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
|
||||
class _LIBCPP_TYPE_VIS mutex
|
||||
{
|
||||
pthread_mutex_t __m_;
|
||||
@@ -315,6 +317,7 @@ private:
|
||||
void __do_timed_wait(unique_lock<mutex>& __lk,
|
||||
chrono::time_point<chrono::system_clock, chrono::nanoseconds>) _NOEXCEPT;
|
||||
};
|
||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
template <class _To, class _Rep, class _Period>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -332,6 +335,7 @@ __ceil(chrono::duration<_Rep, _Period> __d)
|
||||
return __r;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
template <class _Predicate>
|
||||
void
|
||||
condition_variable::wait(unique_lock<mutex>& __lk, _Predicate __pred)
|
||||
@@ -396,6 +400,8 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
|
||||
_VSTD::move(__pred));
|
||||
}
|
||||
|
||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___MUTEX_BASE
|
||||
|
||||
@@ -245,19 +245,30 @@ struct __make_tuple_types
|
||||
|
||||
// __tuple_convertible
|
||||
|
||||
template <bool, class _Tp, class _Up>
|
||||
template <class, class>
|
||||
struct __tuple_convertible_imp : public false_type {};
|
||||
|
||||
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
|
||||
struct __tuple_convertible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
||||
struct __tuple_convertible_imp<__tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
||||
: public integral_constant<bool,
|
||||
is_convertible<_Tp0, _Up0>::value &&
|
||||
__tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||
__tuple_convertible_imp<__tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||
|
||||
template <>
|
||||
struct __tuple_convertible_imp<true, __tuple_types<>, __tuple_types<> >
|
||||
struct __tuple_convertible_imp<__tuple_types<>, __tuple_types<> >
|
||||
: public true_type {};
|
||||
|
||||
template <bool, class, class>
|
||||
struct __tuple_convertible_apply : public false_type {};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __tuple_convertible_apply<true, _Tp, _Up>
|
||||
: public __tuple_convertible_imp<
|
||||
typename __make_tuple_types<_Tp>::type
|
||||
, typename __make_tuple_types<_Up>::type
|
||||
>
|
||||
{};
|
||||
|
||||
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
|
||||
bool = __tuple_like<_Up>::value>
|
||||
struct __tuple_convertible
|
||||
@@ -265,26 +276,36 @@ struct __tuple_convertible
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __tuple_convertible<_Tp, _Up, true, true>
|
||||
: public __tuple_convertible_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
||||
tuple_size<_Up>::value,
|
||||
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
|
||||
: public __tuple_convertible_apply<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
||||
tuple_size<_Up>::value, _Tp, _Up>
|
||||
{};
|
||||
|
||||
// __tuple_constructible
|
||||
|
||||
template <bool, class _Tp, class _Up>
|
||||
template <class, class>
|
||||
struct __tuple_constructible_imp : public false_type {};
|
||||
|
||||
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
|
||||
struct __tuple_constructible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
||||
struct __tuple_constructible_imp<__tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
||||
: public integral_constant<bool,
|
||||
is_constructible<_Up0, _Tp0>::value &&
|
||||
__tuple_constructible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||
__tuple_constructible_imp<__tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||
|
||||
template <>
|
||||
struct __tuple_constructible_imp<true, __tuple_types<>, __tuple_types<> >
|
||||
struct __tuple_constructible_imp<__tuple_types<>, __tuple_types<> >
|
||||
: public true_type {};
|
||||
|
||||
template <bool _SameSize, class, class>
|
||||
struct __tuple_constructible_apply : public false_type {};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __tuple_constructible_apply<true, _Tp, _Up>
|
||||
: public __tuple_constructible_imp<
|
||||
typename __make_tuple_types<_Tp>::type
|
||||
, typename __make_tuple_types<_Up>::type
|
||||
>
|
||||
{};
|
||||
|
||||
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
|
||||
bool = __tuple_like<_Up>::value>
|
||||
struct __tuple_constructible
|
||||
@@ -292,26 +313,36 @@ struct __tuple_constructible
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __tuple_constructible<_Tp, _Up, true, true>
|
||||
: public __tuple_constructible_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
||||
tuple_size<_Up>::value,
|
||||
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
|
||||
: public __tuple_constructible_apply<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
||||
tuple_size<_Up>::value, _Tp, _Up>
|
||||
{};
|
||||
|
||||
// __tuple_assignable
|
||||
|
||||
template <bool, class _Tp, class _Up>
|
||||
template <class, class>
|
||||
struct __tuple_assignable_imp : public false_type {};
|
||||
|
||||
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
|
||||
struct __tuple_assignable_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
||||
struct __tuple_assignable_imp<__tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
||||
: public integral_constant<bool,
|
||||
is_assignable<_Up0&, _Tp0>::value &&
|
||||
__tuple_assignable_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||
__tuple_assignable_imp<__tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||
|
||||
template <>
|
||||
struct __tuple_assignable_imp<true, __tuple_types<>, __tuple_types<> >
|
||||
struct __tuple_assignable_imp<__tuple_types<>, __tuple_types<> >
|
||||
: public true_type {};
|
||||
|
||||
template <bool, class, class>
|
||||
struct __tuple_assignable_apply : public false_type {};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __tuple_assignable_apply<true, _Tp, _Up>
|
||||
: __tuple_assignable_imp<
|
||||
typename __make_tuple_types<_Tp>::type
|
||||
, typename __make_tuple_types<_Up>::type
|
||||
>
|
||||
{};
|
||||
|
||||
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
|
||||
bool = __tuple_like<_Up>::value>
|
||||
struct __tuple_assignable
|
||||
@@ -319,9 +350,8 @@ struct __tuple_assignable
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __tuple_assignable<_Tp, _Up, true, true>
|
||||
: public __tuple_assignable_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
||||
tuple_size<_Up>::value,
|
||||
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
|
||||
: public __tuple_assignable_apply<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
||||
tuple_size<_Up>::value, _Tp, _Up>
|
||||
{};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
@@ -638,6 +638,8 @@ template <class BidirectionalIterator, class Compare>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#include <__debug>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
@@ -975,7 +977,7 @@ __find_end(_BidirectionalIterator1 __first1, _BidirectionalIterator1 __last1,
|
||||
}
|
||||
|
||||
template <class _BinaryPredicate, class _RandomAccessIterator1, class _RandomAccessIterator2>
|
||||
_RandomAccessIterator1
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _RandomAccessIterator1
|
||||
__find_end(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,
|
||||
_RandomAccessIterator2 __first2, _RandomAccessIterator2 __last2, _BinaryPredicate __pred,
|
||||
random_access_iterator_tag, random_access_iterator_tag)
|
||||
@@ -1041,8 +1043,8 @@ find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
|
||||
// find_first_of
|
||||
|
||||
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
|
||||
_ForwardIterator1
|
||||
find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator1
|
||||
__find_first_of_ce(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
|
||||
_ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred)
|
||||
{
|
||||
for (; __first1 != __last1; ++__first1)
|
||||
@@ -1052,6 +1054,16 @@ find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
|
||||
return __last1;
|
||||
}
|
||||
|
||||
|
||||
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_ForwardIterator1
|
||||
find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
|
||||
_ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred)
|
||||
{
|
||||
return _VSTD::__find_first_of_ce(__first1, __last1, __first2, __last2, __pred);
|
||||
}
|
||||
|
||||
template <class _ForwardIterator1, class _ForwardIterator2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_ForwardIterator1
|
||||
@@ -1060,7 +1072,7 @@ find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
|
||||
{
|
||||
typedef typename iterator_traits<_ForwardIterator1>::value_type __v1;
|
||||
typedef typename iterator_traits<_ForwardIterator2>::value_type __v2;
|
||||
return _VSTD::find_first_of(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>());
|
||||
return _VSTD::__find_first_of_ce(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>());
|
||||
}
|
||||
|
||||
// adjacent_find
|
||||
@@ -1128,7 +1140,7 @@ pair<_InputIterator1, _InputIterator2>
|
||||
mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
|
||||
_InputIterator2 __first2, _BinaryPredicate __pred)
|
||||
{
|
||||
for (; __first1 != __last1; ++__first1, ++__first2)
|
||||
for (; __first1 != __last1; ++__first1, (void) ++__first2)
|
||||
if (!__pred(*__first1, *__first2))
|
||||
break;
|
||||
return pair<_InputIterator1, _InputIterator2>(__first1, __first2);
|
||||
@@ -1152,7 +1164,7 @@ mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
|
||||
_InputIterator2 __first2, _InputIterator2 __last2,
|
||||
_BinaryPredicate __pred)
|
||||
{
|
||||
for (; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
|
||||
for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void) ++__first2)
|
||||
if (!__pred(*__first1, *__first2))
|
||||
break;
|
||||
return pair<_InputIterator1, _InputIterator2>(__first1, __first2);
|
||||
@@ -1177,7 +1189,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred)
|
||||
{
|
||||
for (; __first1 != __last1; ++__first1, ++__first2)
|
||||
for (; __first1 != __last1; ++__first1, (void) ++__first2)
|
||||
if (!__pred(*__first1, *__first2))
|
||||
return false;
|
||||
return true;
|
||||
@@ -1201,7 +1213,7 @@ __equal(_InputIterator1 __first1, _InputIterator1 __last1,
|
||||
_InputIterator2 __first2, _InputIterator2 __last2, _BinaryPredicate __pred,
|
||||
input_iterator_tag, input_iterator_tag )
|
||||
{
|
||||
for (; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
|
||||
for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void) ++__first2)
|
||||
if (!__pred(*__first1, *__first2))
|
||||
return false;
|
||||
return __first1 == __last1 && __first2 == __last2;
|
||||
@@ -1255,7 +1267,7 @@ is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
|
||||
_ForwardIterator2 __first2, _BinaryPredicate __pred)
|
||||
{
|
||||
// shorten sequences as much as possible by lopping of any equal parts
|
||||
for (; __first1 != __last1; ++__first1, ++__first2)
|
||||
for (; __first1 != __last1; ++__first1, (void) ++__first2)
|
||||
if (!__pred(*__first1, *__first2))
|
||||
goto __not_done;
|
||||
return true;
|
||||
@@ -1315,7 +1327,7 @@ __is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
|
||||
forward_iterator_tag, forward_iterator_tag )
|
||||
{
|
||||
// shorten sequences as much as possible by lopping of any equal parts
|
||||
for (; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
|
||||
for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void) ++__first2)
|
||||
if (!__pred(*__first1, *__first2))
|
||||
goto __not_done;
|
||||
return __first1 == __last1 && __first2 == __last2;
|
||||
@@ -1440,7 +1452,7 @@ __search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
|
||||
}
|
||||
|
||||
template <class _BinaryPredicate, class _RandomAccessIterator1, class _RandomAccessIterator2>
|
||||
_RandomAccessIterator1
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _RandomAccessIterator1
|
||||
__search(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,
|
||||
_RandomAccessIterator2 __first2, _RandomAccessIterator2 __last2, _BinaryPredicate __pred,
|
||||
random_access_iterator_tag, random_access_iterator_tag)
|
||||
@@ -1733,7 +1745,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
_OutputIterator
|
||||
__copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
|
||||
{
|
||||
for (; __first != __last; ++__first, ++__result)
|
||||
for (; __first != __last; ++__first, (void) ++__result)
|
||||
*__result = *__first;
|
||||
return __result;
|
||||
}
|
||||
@@ -1862,7 +1874,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
_OutputIterator
|
||||
__move(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
|
||||
{
|
||||
for (; __first != __last; ++__first, ++__result)
|
||||
for (; __first != __last; ++__first, (void) ++__result)
|
||||
*__result = _VSTD::move(*__first);
|
||||
return __result;
|
||||
}
|
||||
@@ -1938,7 +1950,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
_OutputIterator
|
||||
transform(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _UnaryOperation __op)
|
||||
{
|
||||
for (; __first != __last; ++__first, ++__result)
|
||||
for (; __first != __last; ++__first, (void) ++__result)
|
||||
*__result = __op(*__first);
|
||||
return __result;
|
||||
}
|
||||
@@ -1949,7 +1961,7 @@ _OutputIterator
|
||||
transform(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2,
|
||||
_OutputIterator __result, _BinaryOperation __binary_op)
|
||||
{
|
||||
for (; __first1 != __last1; ++__first1, ++__first2, ++__result)
|
||||
for (; __first1 != __last1; ++__first1, (void) ++__first2, ++__result)
|
||||
*__result = __binary_op(*__first1, *__first2);
|
||||
return __result;
|
||||
}
|
||||
@@ -1986,7 +1998,7 @@ _OutputIterator
|
||||
replace_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result,
|
||||
const _Tp& __old_value, const _Tp& __new_value)
|
||||
{
|
||||
for (; __first != __last; ++__first, ++__result)
|
||||
for (; __first != __last; ++__first, (void) ++__result)
|
||||
if (*__first == __old_value)
|
||||
*__result = __new_value;
|
||||
else
|
||||
@@ -2002,7 +2014,7 @@ _OutputIterator
|
||||
replace_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result,
|
||||
_Predicate __pred, const _Tp& __new_value)
|
||||
{
|
||||
for (; __first != __last; ++__first, ++__result)
|
||||
for (; __first != __last; ++__first, (void) ++__result)
|
||||
if (__pred(*__first))
|
||||
*__result = __new_value;
|
||||
else
|
||||
@@ -2017,7 +2029,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
_OutputIterator
|
||||
__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_)
|
||||
{
|
||||
for (; __n > 0; ++__first, --__n)
|
||||
for (; __n > 0; ++__first, (void) --__n)
|
||||
*__first = __value_;
|
||||
return __first;
|
||||
}
|
||||
@@ -2091,7 +2103,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
_OutputIterator
|
||||
generate_n(_OutputIterator __first, _Size __n, _Generator __gen)
|
||||
{
|
||||
for (; __n > 0; ++__first, --__n)
|
||||
for (; __n > 0; ++__first, (void) --__n)
|
||||
*__first = __gen();
|
||||
return __first;
|
||||
}
|
||||
@@ -4360,7 +4372,7 @@ __buffered_inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator
|
||||
if (__len1 <= __len2)
|
||||
{
|
||||
value_type* __p = __buff;
|
||||
for (_BidirectionalIterator __i = __first; __i != __middle; __d.__incr((value_type*)0), ++__i, ++__p)
|
||||
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),
|
||||
@@ -4371,7 +4383,7 @@ __buffered_inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator
|
||||
else
|
||||
{
|
||||
value_type* __p = __buff;
|
||||
for (_BidirectionalIterator __i = __middle; __i != __last; __d.__incr((value_type*)0), ++__i, ++__p)
|
||||
for (_BidirectionalIterator __i = __middle; __i != __last; __d.__incr((value_type*)0), (void) ++__i, ++__p)
|
||||
::new(__p) value_type(_VSTD::move(*__i));
|
||||
typedef reverse_iterator<_BidirectionalIterator> _RBi;
|
||||
typedef reverse_iterator<value_type*> _Rv;
|
||||
@@ -4396,7 +4408,7 @@ __inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle,
|
||||
if (__len2 == 0)
|
||||
return;
|
||||
// shrink [__first, __middle) as much as possible (with no moves), returning if it shrinks to 0
|
||||
for (; true; ++__first, --__len1)
|
||||
for (; true; ++__first, (void) --__len1)
|
||||
{
|
||||
if (__len1 == 0)
|
||||
return;
|
||||
@@ -5055,7 +5067,7 @@ __partial_sort_copy(_InputIterator __first, _InputIterator __last,
|
||||
_RandomAccessIterator __r = __result_first;
|
||||
if (__r != __result_last)
|
||||
{
|
||||
for (; __first != __last && __r != __result_last; ++__first, ++__r)
|
||||
for (; __first != __last && __r != __result_last; (void) ++__first, ++__r)
|
||||
*__r = *__first;
|
||||
__make_heap<_Compare>(__result_first, __r, __comp);
|
||||
typename iterator_traits<_RandomAccessIterator>::difference_type __len = __r - __result_first;
|
||||
@@ -5577,7 +5589,7 @@ bool
|
||||
__lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
|
||||
_InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp)
|
||||
{
|
||||
for (; __first2 != __last2; ++__first1, ++__first2)
|
||||
for (; __first2 != __last2; ++__first1, (void) ++__first2)
|
||||
{
|
||||
if (__first1 == __last1 || __comp(*__first1, *__first2))
|
||||
return true;
|
||||
|
||||
@@ -533,6 +533,10 @@ void atomic_signal_fence(memory_order m) noexcept;
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_THREADS
|
||||
#error <atomic> is not supported on this single threaded system
|
||||
#else // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if !__has_feature(cxx_atomic) && _GNUC_VER < 407
|
||||
@@ -1779,4 +1783,6 @@ typedef atomic<uintmax_t> atomic_uintmax_t;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
#endif // _LIBCPP_ATOMIC
|
||||
|
||||
@@ -926,6 +926,7 @@ public:
|
||||
static time_point from_time_t(time_t __t) _NOEXCEPT;
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK
|
||||
class _LIBCPP_TYPE_VIS steady_clock
|
||||
{
|
||||
public:
|
||||
@@ -939,6 +940,9 @@ public:
|
||||
};
|
||||
|
||||
typedef steady_clock high_resolution_clock;
|
||||
#else
|
||||
typedef system_clock high_resolution_clock;
|
||||
#endif
|
||||
|
||||
} // chrono
|
||||
|
||||
|
||||
508
include/cmath
508
include/cmath
File diff suppressed because it is too large
Load Diff
@@ -115,6 +115,8 @@ public:
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class _LIBCPP_TYPE_VIS condition_variable_any
|
||||
@@ -253,4 +255,6 @@ void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
#endif // _LIBCPP_CONDITION_VARIABLE
|
||||
|
||||
@@ -1588,7 +1588,7 @@ deque<_Tp, _Allocator>::assign(_InputIter __f, _InputIter __l,
|
||||
{
|
||||
iterator __i = __base::begin();
|
||||
iterator __e = __base::end();
|
||||
for (; __f != __l && __i != __e; ++__f, ++__i)
|
||||
for (; __f != __l && __i != __e; ++__f, (void) ++__i)
|
||||
*__i = *__f;
|
||||
if (__f != __l)
|
||||
__append(__f, __l);
|
||||
@@ -2160,7 +2160,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
|
||||
if (__n > __de)
|
||||
{
|
||||
__m = __de < __n / 2 ? _VSTD::next(__f, __de) : _VSTD::prev(__l, __n - __de);
|
||||
for (_BiIter __j = __m; __j != __l; ++__i, ++__j, ++__base::size())
|
||||
for (_BiIter __j = __m; __j != __l; ++__i, (void) ++__j, ++__base::size())
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__i), *__j);
|
||||
__n = __de;
|
||||
}
|
||||
@@ -2200,7 +2200,7 @@ deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l,
|
||||
if (__n > __back_capacity)
|
||||
__add_back_capacity(__n - __back_capacity);
|
||||
// __n <= __back_capacity
|
||||
for (iterator __i = __base::end(); __f != __l; ++__i, ++__f, ++__base::size())
|
||||
for (iterator __i = __base::end(); __f != __l; ++__i, (void) ++__f, ++__base::size())
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__i), *__f);
|
||||
}
|
||||
|
||||
|
||||
24
include/experimental/__config
Normal file
24
include/experimental/__config
Normal file
@@ -0,0 +1,24 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------------- __config ---------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_EXPERIMENTAL_CONFIG
|
||||
#define _LIBCPP_EXPERIMENTAL_CONFIG
|
||||
|
||||
#include <__config>
|
||||
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL namespace std { namespace experimental {
|
||||
#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL } }
|
||||
#define _VSTD_EXPERIMENTAL std::experimental
|
||||
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_LFTS _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v1 {
|
||||
#define _LIBCPP_END_NAMESPACE_LFTS } } }
|
||||
#define _VSTD_LFTS _VSTD_EXPERIMENTAL::fundamentals_v1
|
||||
|
||||
#endif
|
||||
@@ -151,11 +151,7 @@ public:
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
# include <__debug>
|
||||
#else
|
||||
# define _LIBCPP_ASSERT(x, m) ((void)0)
|
||||
#endif
|
||||
#include <__debug>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
@@ -696,4 +692,4 @@ _LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 11
|
||||
|
||||
#endif // _LIBCPP_ARRAY
|
||||
#endif // _LIBCPP_OPTIONAL
|
||||
|
||||
815
include/experimental/string_view
Normal file
815
include/experimental/string_view
Normal file
@@ -0,0 +1,815 @@
|
||||
// -*- C++ -*-
|
||||
//===------------------------ string_view ---------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_LFTS_STRING_VIEW
|
||||
#define _LIBCPP_LFTS_STRING_VIEW
|
||||
|
||||
/*
|
||||
string_view synopsis
|
||||
|
||||
namespace std {
|
||||
namespace experimental {
|
||||
inline namespace library_fundamentals_v1 {
|
||||
|
||||
// 7.2, Class template basic_string_view
|
||||
template<class charT, class traits = char_traits<charT>>
|
||||
class basic_string_view;
|
||||
|
||||
// 7.9, basic_string_view non-member comparison functions
|
||||
template<class charT, class traits>
|
||||
constexpr bool operator==(basic_string_view<charT, traits> x,
|
||||
basic_string_view<charT, traits> y) noexcept;
|
||||
template<class charT, class traits>
|
||||
constexpr bool operator!=(basic_string_view<charT, traits> x,
|
||||
basic_string_view<charT, traits> y) noexcept;
|
||||
template<class charT, class traits>
|
||||
constexpr bool operator< (basic_string_view<charT, traits> x,
|
||||
basic_string_view<charT, traits> y) noexcept;
|
||||
template<class charT, class traits>
|
||||
constexpr bool operator> (basic_string_view<charT, traits> x,
|
||||
basic_string_view<charT, traits> y) noexcept;
|
||||
template<class charT, class traits>
|
||||
constexpr bool operator<=(basic_string_view<charT, traits> x,
|
||||
basic_string_view<charT, traits> y) noexcept;
|
||||
template<class charT, class traits>
|
||||
constexpr bool operator>=(basic_string_view<charT, traits> x,
|
||||
basic_string_view<charT, traits> y) noexcept;
|
||||
// see below, sufficient additional overloads of comparison functions
|
||||
|
||||
// 7.10, Inserters and extractors
|
||||
template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& os,
|
||||
basic_string_view<charT, traits> str);
|
||||
|
||||
// basic_string_view typedef names
|
||||
typedef basic_string_view<char> string_view;
|
||||
typedef basic_string_view<char16_t> u16string_view;
|
||||
typedef basic_string_view<char32_t> u32string_view;
|
||||
typedef basic_string_view<wchar_t> wstring_view;
|
||||
|
||||
template<class charT, class traits = char_traits<charT>>
|
||||
class basic_string_view {
|
||||
public:
|
||||
// types
|
||||
typedef traits traits_type;
|
||||
typedef charT value_type;
|
||||
typedef charT* pointer;
|
||||
typedef const charT* const_pointer;
|
||||
typedef charT& reference;
|
||||
typedef const charT& const_reference;
|
||||
typedef implementation-defined const_iterator;
|
||||
typedef const_iterator iterator;
|
||||
typedef reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef const_reverse_iterator reverse_iterator;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
static constexpr size_type npos = size_type(-1);
|
||||
|
||||
// 7.3, basic_string_view constructors and assignment operators
|
||||
constexpr basic_string_view() noexcept;
|
||||
constexpr basic_string_view(const basic_string_view&) noexcept = default;
|
||||
basic_string_view& operator=(const basic_string_view&) noexcept = default;
|
||||
template<class Allocator>
|
||||
basic_string_view(const basic_string<charT, traits, Allocator>& str) noexcept;
|
||||
constexpr basic_string_view(const charT* str);
|
||||
constexpr basic_string_view(const charT* str, size_type len);
|
||||
|
||||
// 7.4, basic_string_view iterator support
|
||||
constexpr const_iterator begin() const noexcept;
|
||||
constexpr const_iterator end() const noexcept;
|
||||
constexpr const_iterator cbegin() const noexcept;
|
||||
constexpr const_iterator cend() const noexcept;
|
||||
const_reverse_iterator rbegin() const noexcept;
|
||||
const_reverse_iterator rend() const noexcept;
|
||||
const_reverse_iterator crbegin() const noexcept;
|
||||
const_reverse_iterator crend() const noexcept;
|
||||
|
||||
// 7.5, basic_string_view capacity
|
||||
constexpr size_type size() const noexcept;
|
||||
constexpr size_type length() const noexcept;
|
||||
constexpr size_type max_size() const noexcept;
|
||||
constexpr bool empty() const noexcept;
|
||||
|
||||
// 7.6, basic_string_view element access
|
||||
constexpr const_reference operator[](size_type pos) const;
|
||||
constexpr const_reference at(size_type pos) const;
|
||||
constexpr const_reference front() const;
|
||||
constexpr const_reference back() const;
|
||||
constexpr const_pointer data() const noexcept;
|
||||
|
||||
// 7.7, basic_string_view modifiers
|
||||
constexpr void clear() noexcept;
|
||||
constexpr void remove_prefix(size_type n);
|
||||
constexpr void remove_suffix(size_type n);
|
||||
constexpr void swap(basic_string_view& s) noexcept;
|
||||
|
||||
// 7.8, basic_string_view string operations
|
||||
template<class Allocator>
|
||||
explicit operator basic_string<charT, traits, Allocator>() const;
|
||||
template<class Allocator = allocator<charT>>
|
||||
basic_string<charT, traits, Allocator> to_string(
|
||||
const Allocator& a = Allocator()) const;
|
||||
|
||||
size_type copy(charT* s, size_type n, size_type pos = 0) const;
|
||||
|
||||
constexpr basic_string_view substr(size_type pos = 0, size_type n = npos) const;
|
||||
constexpr int compare(basic_string_view s) const noexcept;
|
||||
constexpr int compare(size_type pos1, size_type n1, basic_string_view s) const;
|
||||
constexpr int compare(size_type pos1, size_type n1,
|
||||
basic_string_view s, size_type pos2, size_type n2) const;
|
||||
constexpr int compare(const charT* s) const;
|
||||
constexpr int compare(size_type pos1, size_type n1, const charT* s) const;
|
||||
constexpr int compare(size_type pos1, size_type n1,
|
||||
const charT* s, size_type n2) const;
|
||||
constexpr size_type find(basic_string_view s, size_type pos = 0) const noexcept;
|
||||
constexpr size_type find(charT c, size_type pos = 0) const noexcept;
|
||||
constexpr size_type find(const charT* s, size_type pos, size_type n) const;
|
||||
constexpr size_type find(const charT* s, size_type pos = 0) const;
|
||||
constexpr size_type rfind(basic_string_view s, size_type pos = npos) const noexcept;
|
||||
constexpr size_type rfind(charT c, size_type pos = npos) const noexcept;
|
||||
constexpr size_type rfind(const charT* s, size_type pos, size_type n) const;
|
||||
constexpr size_type rfind(const charT* s, size_type pos = npos) const;
|
||||
constexpr size_type find_first_of(basic_string_view s, size_type pos = 0) const noexcept;
|
||||
constexpr size_type find_first_of(charT c, size_type pos = 0) const noexcept;
|
||||
constexpr size_type find_first_of(const charT* s, size_type pos, size_type n) const;
|
||||
constexpr size_type find_first_of(const charT* s, size_type pos = 0) const;
|
||||
constexpr size_type find_last_of(basic_string_view s, size_type pos = npos) const noexcept;
|
||||
constexpr size_type find_last_of(charT c, size_type pos = npos) const noexcept;
|
||||
constexpr size_type find_last_of(const charT* s, size_type pos, size_type n) const;
|
||||
constexpr size_type find_last_of(const charT* s, size_type pos = npos) const;
|
||||
constexpr size_type find_first_not_of(basic_string_view s, size_type pos = 0) const noexcept;
|
||||
constexpr size_type find_first_not_of(charT c, size_type pos = 0) const noexcept;
|
||||
constexpr size_type find_first_not_of(const charT* s, size_type pos, size_type n) const;
|
||||
constexpr size_type find_first_not_of(const charT* s, size_type pos = 0) const;
|
||||
constexpr size_type find_last_not_of(basic_string_view s, size_type pos = npos) const noexcept;
|
||||
constexpr size_type find_last_not_of(charT c, size_type pos = npos) const noexcept;
|
||||
constexpr size_type find_last_not_of(const charT* s, size_type pos, size_type n) const;
|
||||
constexpr size_type find_last_not_of(const charT* s, size_type pos = npos) const;
|
||||
|
||||
private:
|
||||
const_pointer data_; // exposition only
|
||||
size_type size_; // exposition only
|
||||
};
|
||||
|
||||
} // namespace fundamentals_v1
|
||||
} // namespace experimental
|
||||
|
||||
// 7.11, Hash support
|
||||
template <class T> struct hash;
|
||||
template <> struct hash<experimental::string_view>;
|
||||
template <> struct hash<experimental::u16string_view>;
|
||||
template <> struct hash<experimental::u32string_view>;
|
||||
template <> struct hash<experimental::wstring_view>;
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include <experimental/__config>
|
||||
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <ostream>
|
||||
#include <iomanip>
|
||||
|
||||
#include <__debug>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||
|
||||
template<class _CharT, class _Traits = _VSTD::char_traits<_CharT> >
|
||||
class _LIBCPP_TYPE_VIS_ONLY basic_string_view {
|
||||
public:
|
||||
// types
|
||||
typedef _Traits traits_type;
|
||||
typedef _CharT value_type;
|
||||
typedef const _CharT* pointer;
|
||||
typedef const _CharT* const_pointer;
|
||||
typedef const _CharT& reference;
|
||||
typedef const _CharT& const_reference;
|
||||
typedef const_pointer const_iterator; // See [string.view.iterators]
|
||||
typedef const_iterator iterator;
|
||||
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef const_reverse_iterator reverse_iterator;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
static _LIBCPP_CONSTEXPR const size_type npos = -1; // size_type(-1);
|
||||
|
||||
// [string.view.cons], construct/copy
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string_view() _NOEXCEPT : __data (nullptr), __size(0) {}
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string_view(const basic_string_view&) _NOEXCEPT = default;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string_view& operator=(const basic_string_view&) _NOEXCEPT = default;
|
||||
|
||||
template<class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string_view(const basic_string<_CharT, _Traits, _Allocator>& __str) _NOEXCEPT
|
||||
: __data (__str.data()), __size(__str.size()) {}
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string_view(const _CharT* __s, size_type __len)
|
||||
: __data(__s), __size(__len)
|
||||
{
|
||||
// _LIBCPP_ASSERT(__len == 0 || __s != nullptr, "string_view::string_view(_CharT *, size_t): recieved nullptr");
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string_view(const _CharT* __s)
|
||||
: __data(__s), __size(_Traits::length(__s)) {}
|
||||
|
||||
// [string.view.iterators], iterators
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const _NOEXCEPT { return cbegin(); }
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const _NOEXCEPT { return cend(); }
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cbegin() const _NOEXCEPT { return __data; }
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cend() const _NOEXCEPT { return __data + __size; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(cbegin()); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crend() const _NOEXCEPT { return const_reverse_iterator(cbegin()); }
|
||||
|
||||
// [string.view.capacity], capacity
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const _NOEXCEPT { return __size; }
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
size_type length() const _NOEXCEPT { return __size; }
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const _NOEXCEPT { return _VSTD::numeric_limits<size_type>::max(); }
|
||||
|
||||
_LIBCPP_CONSTEXPR bool _LIBCPP_INLINE_VISIBILITY
|
||||
empty() const _NOEXCEPT { return __size == 0; }
|
||||
|
||||
// [string.view.access], element access
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
const_reference operator[](size_type __pos) const { return __data[__pos]; }
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
const_reference at(size_type __pos) const
|
||||
{
|
||||
return __pos >= size()
|
||||
? throw out_of_range("string_view::at")
|
||||
: __data[__pos];
|
||||
// if (__pos >= size())
|
||||
// throw out_of_range("string_view::at");
|
||||
// return __data[__pos];
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
const_reference front() const
|
||||
{
|
||||
return _LIBCPP_ASSERT(!empty(), "string_view::front(): string is empty"), __data[0];
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
const_reference back() const
|
||||
{
|
||||
return _LIBCPP_ASSERT(!empty(), "string_view::back(): string is empty"), __data[__size-1];
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
const_pointer data() const _NOEXCEPT { return __data; }
|
||||
|
||||
// [string.view.modifiers], modifiers:
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
void clear() _NOEXCEPT
|
||||
{
|
||||
__data = nullptr;
|
||||
__size = 0;
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
void remove_prefix(size_type __n) _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(n <= size(), "remove_prefix() can't remove more than size()");
|
||||
__data += __n;
|
||||
__size -= __n;
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
void remove_suffix(size_type __n) _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(n <= size(), "remove_suffix() can't remove more than size()");
|
||||
__size -= __n;
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
void swap(basic_string_view& __other) _NOEXCEPT
|
||||
{
|
||||
const value_type *__p = __data;
|
||||
__data = __other.__data;
|
||||
__other.__data = __p;
|
||||
|
||||
size_type __sz = __size;
|
||||
__size = __other.__size;
|
||||
__other.__size = __sz;
|
||||
// _VSTD::swap( __data, __other.__data );
|
||||
// _VSTD::swap( __size, __other.__size );
|
||||
}
|
||||
|
||||
// [string.view.ops], string operations:
|
||||
template<class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_EXPLICIT operator basic_string<_CharT, _Traits, _Allocator>() const
|
||||
{ return basic_string<_CharT, _Traits, _Allocator>( begin(), end()); }
|
||||
|
||||
template<class _Allocator = allocator<_CharT> >
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_string<_CharT, _Traits, _Allocator>
|
||||
to_string( const _Allocator& __a = _Allocator()) const
|
||||
{ return basic_string<_CharT, _Traits, _Allocator> ( begin(), end(), __a ); }
|
||||
|
||||
size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const
|
||||
{
|
||||
if ( __pos > size())
|
||||
throw out_of_range("string_view::copy");
|
||||
size_type __rlen = _VSTD::min( __n, size() - __pos );
|
||||
_VSTD::copy_n(begin() + __pos, __rlen, __s );
|
||||
return __rlen;
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR
|
||||
basic_string_view substr(size_type __pos = 0, size_type __n = npos) const
|
||||
{
|
||||
// if (__pos > size())
|
||||
// throw out_of_range("string_view::substr");
|
||||
// size_type __rlen = _VSTD::min( __n, size() - __pos );
|
||||
// return basic_string_view(data() + __pos, __rlen);
|
||||
return __pos > size()
|
||||
? throw out_of_range("string_view::substr")
|
||||
: basic_string_view(data() + __pos, _VSTD::min(__n, size() - __pos));
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 int compare(basic_string_view __sv) const _NOEXCEPT
|
||||
{
|
||||
size_type __rlen = _VSTD::min( size(), __sv.size());
|
||||
int __retval = _Traits::compare(data(), __sv.data(), __rlen);
|
||||
if ( __retval == 0 ) // first __rlen chars matched
|
||||
__retval = size() == __sv.size() ? 0 : ( size() < __sv.size() ? -1 : 1 );
|
||||
return __retval;
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
int compare(size_type __pos1, size_type __n1, basic_string_view __sv) const
|
||||
{
|
||||
return substr(__pos1, __n1).compare(__sv);
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
int compare( size_type __pos1, size_type __n1,
|
||||
basic_string_view _sv, size_type __pos2, size_type __n2) const
|
||||
{
|
||||
return substr(__pos1, __n1).compare(_sv.substr(__pos2, __n2));
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
int compare(const _CharT* __s) const
|
||||
{
|
||||
return compare(basic_string_view(__s));
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
int compare(size_type __pos1, size_type __n1, const _CharT* __s) const
|
||||
{
|
||||
return substr(__pos1, __n1).compare(basic_string_view(__s));
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
int compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const
|
||||
{
|
||||
return substr(__pos1, __n1).compare(basic_string_view(__s, __n2));
|
||||
}
|
||||
|
||||
// find
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): recieved nullptr");
|
||||
return _VSTD::__str_find<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s.data(), __pos, __s.size());
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find(_CharT __c, size_type __pos = 0) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__str_find<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __c, __pos);
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find(const _CharT* __s, size_type __pos, size_type __n) const
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find(): recieved nullptr");
|
||||
return _VSTD::__str_find<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, __n);
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find(const _CharT* __s, size_type __pos = 0) const
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "string_view::find(): recieved nullptr");
|
||||
return _VSTD::__str_find<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||
}
|
||||
|
||||
// rfind
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type rfind(basic_string_view __s, size_type __pos = npos) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): recieved nullptr");
|
||||
return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s.data(), __pos, __s.size());
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type rfind(_CharT __c, size_type __pos = npos) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __c, __pos);
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::rfind(): recieved nullptr");
|
||||
return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, __n);
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type rfind(const _CharT* __s, size_type __pos=npos) const
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "string_view::rfind(): recieved nullptr");
|
||||
return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||
}
|
||||
|
||||
// find_first_of
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_of(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_of(): recieved nullptr");
|
||||
return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s.data(), __pos, __s.size());
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_of(_CharT __c, size_type __pos = 0) const _NOEXCEPT
|
||||
{ return find(__c, __pos); }
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_of(): recieved nullptr");
|
||||
return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, __n);
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_of(const _CharT* __s, size_type __pos=0) const
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_of(): recieved nullptr");
|
||||
return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||
}
|
||||
|
||||
// find_last_of
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_of(): recieved nullptr");
|
||||
return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s.data(), __pos, __s.size());
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_of(_CharT __c, size_type __pos = npos) const _NOEXCEPT
|
||||
{ return rfind(__c, __pos); }
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_of(): recieved nullptr");
|
||||
return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, __n);
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_of(const _CharT* __s, size_type __pos=npos) const
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_of(): recieved nullptr");
|
||||
return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||
}
|
||||
|
||||
// find_first_not_of
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_not_of(basic_string_view __s, size_type __pos=0) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_not_of(): recieved nullptr");
|
||||
return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s.data(), __pos, __s.size());
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_not_of(_CharT __c, size_type __pos=0) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __c, __pos);
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_not_of(): recieved nullptr");
|
||||
return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, __n);
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_first_not_of(const _CharT* __s, size_type __pos=0) const
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_not_of(): recieved nullptr");
|
||||
return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||
}
|
||||
|
||||
// find_last_not_of
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_not_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_not_of(): recieved nullptr");
|
||||
return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s.data(), __pos, __s.size());
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_not_of(_CharT __c, size_type __pos=npos) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __c, __pos);
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_not_of(): recieved nullptr");
|
||||
return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, __n);
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
size_type find_last_not_of(const _CharT* __s, size_type __pos=npos) const
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_not_of(): recieved nullptr");
|
||||
return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||
}
|
||||
|
||||
private:
|
||||
const value_type* __data;
|
||||
size_type __size;
|
||||
};
|
||||
|
||||
|
||||
// [string.view.comparison]
|
||||
// operator ==
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(basic_string_view<_CharT, _Traits> __lhs,
|
||||
basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||
{
|
||||
if ( __lhs.size() != __rhs.size()) return false;
|
||||
return __lhs.compare(__rhs) == 0;
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(basic_string_view<_CharT, _Traits> __lhs,
|
||||
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
|
||||
{
|
||||
if ( __lhs.size() != __rhs.size()) return false;
|
||||
return __lhs.compare(__rhs) == 0;
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
|
||||
basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||
{
|
||||
if ( __lhs.size() != __rhs.size()) return false;
|
||||
return __lhs.compare(__rhs) == 0;
|
||||
}
|
||||
|
||||
|
||||
// operator !=
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||
{
|
||||
if ( __lhs.size() != __rhs.size())
|
||||
return true;
|
||||
return __lhs.compare(__rhs) != 0;
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(basic_string_view<_CharT, _Traits> __lhs,
|
||||
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
|
||||
{
|
||||
if ( __lhs.size() != __rhs.size())
|
||||
return true;
|
||||
return __lhs.compare(__rhs) != 0;
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
|
||||
basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||
{
|
||||
if ( __lhs.size() != __rhs.size())
|
||||
return true;
|
||||
return __lhs.compare(__rhs) != 0;
|
||||
}
|
||||
|
||||
|
||||
// operator <
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator<(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||
{
|
||||
return __lhs.compare(__rhs) < 0;
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator<(basic_string_view<_CharT, _Traits> __lhs,
|
||||
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
|
||||
{
|
||||
return __lhs.compare(__rhs) < 0;
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator<(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
|
||||
basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||
{
|
||||
return __lhs.compare(__rhs) < 0;
|
||||
}
|
||||
|
||||
|
||||
// operator >
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator> (basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||
{
|
||||
return __lhs.compare(__rhs) > 0;
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator>(basic_string_view<_CharT, _Traits> __lhs,
|
||||
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
|
||||
{
|
||||
return __lhs.compare(__rhs) > 0;
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator>(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
|
||||
basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||
{
|
||||
return __lhs.compare(__rhs) > 0;
|
||||
}
|
||||
|
||||
|
||||
// operator <=
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator<=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||
{
|
||||
return __lhs.compare(__rhs) <= 0;
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator<=(basic_string_view<_CharT, _Traits> __lhs,
|
||||
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
|
||||
{
|
||||
return __lhs.compare(__rhs) <= 0;
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator<=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
|
||||
basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||
{
|
||||
return __lhs.compare(__rhs) <= 0;
|
||||
}
|
||||
|
||||
|
||||
// operator >=
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator>=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||
{
|
||||
return __lhs.compare(__rhs) >= 0;
|
||||
}
|
||||
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator>=(basic_string_view<_CharT, _Traits> __lhs,
|
||||
typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __rhs) _NOEXCEPT
|
||||
{
|
||||
return __lhs.compare(__rhs) >= 0;
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator>=(typename _VSTD::common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
|
||||
basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
|
||||
{
|
||||
return __lhs.compare(__rhs) >= 0;
|
||||
}
|
||||
|
||||
|
||||
// [string.view.io]
|
||||
template<class _CharT, class _Traits>
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, basic_string_view<_CharT, _Traits> __sv)
|
||||
{
|
||||
return _VSTD::__put_character_sequence(__os, __sv.data(), __sv.size());
|
||||
}
|
||||
|
||||
typedef basic_string_view<char> string_view;
|
||||
typedef basic_string_view<char16_t> u16string_view;
|
||||
typedef basic_string_view<char32_t> u32string_view;
|
||||
typedef basic_string_view<wchar_t> wstring_view;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_LFTS
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// [string.view.hash]
|
||||
// Shamelessly stolen from <string>
|
||||
template<class _CharT, class _Traits>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY hash<std::experimental::basic_string_view<_CharT, _Traits> >
|
||||
: public unary_function<std::experimental::basic_string_view<_CharT, _Traits>, size_t>
|
||||
{
|
||||
size_t operator()(const std::experimental::basic_string_view<_CharT, _Traits>& __val) const _NOEXCEPT;
|
||||
};
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
size_t
|
||||
hash<std::experimental::basic_string_view<_CharT, _Traits> >::operator()(
|
||||
const std::experimental::basic_string_view<_CharT, _Traits>& __val) const _NOEXCEPT
|
||||
{
|
||||
return __do_string_hash(__val.data(), __val.data() + __val.size());
|
||||
}
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
template <class _CharT, class _Traits>
|
||||
__quoted_output_proxy<_CharT, const _CharT *, _Traits>
|
||||
quoted ( std::experimental::basic_string_view <_CharT, _Traits> __sv,
|
||||
_CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\'))
|
||||
{
|
||||
return __quoted_output_proxy<_CharT, const _CharT *, _Traits>
|
||||
( __sv.data(), __sv.data() + __sv.size(), __delim, __escape );
|
||||
}
|
||||
#endif
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_LFTS_STRING_VIEW
|
||||
44
include/experimental/utility
Normal file
44
include/experimental/utility
Normal file
@@ -0,0 +1,44 @@
|
||||
// -*- C++ -*-
|
||||
//===-------------------------- utility ----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_EXPERIMENTAL_UTILITY
|
||||
#define _LIBCPP_EXPERIMENTAL_UTILITY
|
||||
|
||||
/*
|
||||
experimental/utility synopsis
|
||||
|
||||
// C++1y
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace std {
|
||||
namespace experimental {
|
||||
inline namespace fundamentals_v1 {
|
||||
|
||||
3.1.2, erased-type placeholder
|
||||
struct erased_type { };
|
||||
|
||||
} // namespace fundamentals_v1
|
||||
} // namespace experimental
|
||||
} // namespace std
|
||||
|
||||
*/
|
||||
|
||||
# include <experimental/__config>
|
||||
|
||||
# include <utility>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||
|
||||
struct _LIBCPP_TYPE_VIS_ONLY erased_type { };
|
||||
|
||||
_LIBCPP_END_NAMESPACE_LFTS
|
||||
|
||||
#endif /* _LIBCPP_EXPERIMENTAL_UTILITY */
|
||||
@@ -991,7 +991,7 @@ forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l)
|
||||
iterator __i = before_begin();
|
||||
iterator __j = _VSTD::next(__i);
|
||||
iterator __e = end();
|
||||
for (; __j != __e && __f != __l; ++__i, ++__j, ++__f)
|
||||
for (; __j != __e && __f != __l; ++__i, (void) ++__j, ++__f)
|
||||
*__j = *__f;
|
||||
if (__j == __e)
|
||||
insert_after(__i, __f, __l);
|
||||
@@ -1201,7 +1201,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
for (++__f; __f != __l; ++__f, __last = __last->__next_)
|
||||
for (++__f; __f != __l; ++__f, ((void)(__last = __last->__next_)))
|
||||
{
|
||||
__h.reset(__node_traits::allocate(__a, 1));
|
||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f);
|
||||
|
||||
@@ -374,6 +374,10 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_THREADS
|
||||
#error <future> is not supported on this single threaded system
|
||||
#else // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
//enum class future_errc
|
||||
@@ -779,9 +783,12 @@ __assoc_state_alloc<_Rp, _Alloc>::__on_zero_shared() _NOEXCEPT
|
||||
{
|
||||
if (this->__state_ & base::__constructed)
|
||||
reinterpret_cast<_Rp*>(_VSTD::addressof(this->__value_))->~_Rp();
|
||||
typename _Alloc::template rebind<__assoc_state_alloc>::other __a(__alloc_);
|
||||
typedef typename __allocator_traits_rebind<_Alloc, __assoc_state_alloc>::type _A;
|
||||
typedef allocator_traits<_A> _ATraits;
|
||||
typedef pointer_traits<typename _ATraits::pointer> _PTraits;
|
||||
_A __a(__alloc_);
|
||||
this->~__assoc_state_alloc();
|
||||
__a.deallocate(this, 1);
|
||||
__a.deallocate(_PTraits::pointer_to(*this), 1);
|
||||
}
|
||||
|
||||
template <class _Rp, class _Alloc>
|
||||
@@ -802,9 +809,12 @@ template <class _Rp, class _Alloc>
|
||||
void
|
||||
__assoc_state_alloc<_Rp&, _Alloc>::__on_zero_shared() _NOEXCEPT
|
||||
{
|
||||
typename _Alloc::template rebind<__assoc_state_alloc>::other __a(__alloc_);
|
||||
typedef typename __allocator_traits_rebind<_Alloc, __assoc_state_alloc>::type _A;
|
||||
typedef allocator_traits<_A> _ATraits;
|
||||
typedef pointer_traits<typename _ATraits::pointer> _PTraits;
|
||||
_A __a(__alloc_);
|
||||
this->~__assoc_state_alloc();
|
||||
__a.deallocate(this, 1);
|
||||
__a.deallocate(_PTraits::pointer_to(*this), 1);
|
||||
}
|
||||
|
||||
template <class _Alloc>
|
||||
@@ -825,9 +835,12 @@ template <class _Alloc>
|
||||
void
|
||||
__assoc_sub_state_alloc<_Alloc>::__on_zero_shared() _NOEXCEPT
|
||||
{
|
||||
typename _Alloc::template rebind<__assoc_sub_state_alloc>::other __a(__alloc_);
|
||||
typedef typename __allocator_traits_rebind<_Alloc, __assoc_sub_state_alloc>::type _A;
|
||||
typedef allocator_traits<_A> _ATraits;
|
||||
typedef pointer_traits<typename _ATraits::pointer> _PTraits;
|
||||
_A __a(__alloc_);
|
||||
this->~__assoc_sub_state_alloc();
|
||||
__a.deallocate(this, 1);
|
||||
__a.deallocate(_PTraits::pointer_to(*this), 1);
|
||||
}
|
||||
|
||||
template <class _Rp, class _Fp>
|
||||
@@ -1410,12 +1423,13 @@ template <class _Rp>
|
||||
template <class _Alloc>
|
||||
promise<_Rp>::promise(allocator_arg_t, const _Alloc& __a0)
|
||||
{
|
||||
typedef typename _Alloc::template rebind<__assoc_state_alloc<_Rp, _Alloc> >::other _A2;
|
||||
typedef __assoc_state_alloc<_Rp, _Alloc> _State;
|
||||
typedef typename __allocator_traits_rebind<_Alloc, _State>::type _A2;
|
||||
typedef __allocator_destructor<_A2> _D2;
|
||||
_A2 __a(__a0);
|
||||
unique_ptr<__assoc_state_alloc<_Rp, _Alloc>, _D2> __hold(__a.allocate(1), _D2(__a, 1));
|
||||
::new(__hold.get()) __assoc_state_alloc<_Rp, _Alloc>(__a0);
|
||||
__state_ = __hold.release();
|
||||
unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1));
|
||||
::new(static_cast<void*>(_VSTD::addressof(*__hold.get()))) _State(__a0);
|
||||
__state_ = _VSTD::addressof(*__hold.release());
|
||||
}
|
||||
|
||||
template <class _Rp>
|
||||
@@ -1583,12 +1597,13 @@ template <class _Rp>
|
||||
template <class _Alloc>
|
||||
promise<_Rp&>::promise(allocator_arg_t, const _Alloc& __a0)
|
||||
{
|
||||
typedef typename _Alloc::template rebind<__assoc_state_alloc<_Rp&, _Alloc> >::other _A2;
|
||||
typedef __assoc_state_alloc<_Rp&, _Alloc> _State;
|
||||
typedef typename __allocator_traits_rebind<_Alloc, _State>::type _A2;
|
||||
typedef __allocator_destructor<_A2> _D2;
|
||||
_A2 __a(__a0);
|
||||
unique_ptr<__assoc_state_alloc<_Rp&, _Alloc>, _D2> __hold(__a.allocate(1), _D2(__a, 1));
|
||||
::new(__hold.get()) __assoc_state_alloc<_Rp&, _Alloc>(__a0);
|
||||
__state_ = __hold.release();
|
||||
unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1));
|
||||
::new(static_cast<void*>(_VSTD::addressof(*__hold.get()))) _State(__a0);
|
||||
__state_ = _VSTD::addressof(*__hold.release());
|
||||
}
|
||||
|
||||
template <class _Rp>
|
||||
@@ -1719,12 +1734,13 @@ public:
|
||||
template <class _Alloc>
|
||||
promise<void>::promise(allocator_arg_t, const _Alloc& __a0)
|
||||
{
|
||||
typedef typename _Alloc::template rebind<__assoc_sub_state_alloc<_Alloc> >::other _A2;
|
||||
typedef __assoc_sub_state_alloc<_Alloc> _State;
|
||||
typedef typename __allocator_traits_rebind<_Alloc, _State>::type _A2;
|
||||
typedef __allocator_destructor<_A2> _D2;
|
||||
_A2 __a(__a0);
|
||||
unique_ptr<__assoc_sub_state_alloc<_Alloc>, _D2> __hold(__a.allocate(1), _D2(__a, 1));
|
||||
::new(__hold.get()) __assoc_sub_state_alloc<_Alloc>(__a0);
|
||||
__state_ = __hold.release();
|
||||
unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1));
|
||||
::new(static_cast<void*>(_VSTD::addressof(*__hold.get()))) _State(__a0);
|
||||
__state_ = _VSTD::addressof(*__hold.release());
|
||||
}
|
||||
|
||||
template <class _Rp>
|
||||
@@ -1804,10 +1820,12 @@ template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
|
||||
void
|
||||
__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate()
|
||||
{
|
||||
typedef typename _Alloc::template rebind<__packaged_task_func>::other _Ap;
|
||||
typedef typename __allocator_traits_rebind<_Alloc, __packaged_task_func>::type _Ap;
|
||||
typedef allocator_traits<_Ap> _ATraits;
|
||||
typedef pointer_traits<typename _ATraits::pointer> _PTraits;
|
||||
_Ap __a(__f_.second());
|
||||
__f_.~__compressed_pair<_Fp, _Alloc>();
|
||||
__a.deallocate(this, 1);
|
||||
__a.deallocate(_PTraits::pointer_to(*this), 1);
|
||||
}
|
||||
|
||||
template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
|
||||
@@ -1896,7 +1914,6 @@ __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(
|
||||
allocator_arg_t, const _Alloc& __a0, _Fp&& __f)
|
||||
: __f_(nullptr)
|
||||
{
|
||||
typedef allocator_traits<_Alloc> __alloc_traits;
|
||||
typedef typename remove_reference<typename decay<_Fp>::type>::type _FR;
|
||||
typedef __packaged_task_func<_FR, _Alloc, _Rp(_ArgTypes...)> _FF;
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
@@ -1906,18 +1923,13 @@ __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(
|
||||
}
|
||||
else
|
||||
{
|
||||
typedef typename __alloc_traits::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind_alloc<_FF>
|
||||
#else
|
||||
rebind_alloc<_FF>::other
|
||||
#endif
|
||||
_Ap;
|
||||
typedef typename __allocator_traits_rebind<_Alloc, _FF>::type _Ap;
|
||||
_Ap __a(__a0);
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) _FF(_VSTD::forward<_Fp>(__f), _Alloc(__a));
|
||||
__f_ = __hold.release();
|
||||
::new (static_cast<void*>(_VSTD::addressof(*__hold.get())))
|
||||
_FF(_VSTD::forward<_Fp>(__f), _Alloc(__a));
|
||||
__f_ = _VSTD::addressof(*__hold.release());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2612,4 +2624,6 @@ future<void>::share()
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
#endif // _LIBCPP_FUTURE
|
||||
|
||||
@@ -216,7 +216,7 @@ storage-class-specifier const error_category& iostream_category() noexcept;
|
||||
#include <__locale>
|
||||
#include <system_error>
|
||||
|
||||
#if __has_feature(cxx_atomic)
|
||||
#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
|
||||
#include <atomic> // for __xindex_
|
||||
#endif
|
||||
|
||||
@@ -367,7 +367,7 @@ private:
|
||||
int* __index_;
|
||||
size_t __event_size_;
|
||||
size_t __event_cap_;
|
||||
#if __has_feature(cxx_atomic)
|
||||
#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
|
||||
static atomic<int> __xindex_;
|
||||
#else
|
||||
static int __xindex_;
|
||||
|
||||
@@ -82,6 +82,13 @@ public:
|
||||
pos_type tellg();
|
||||
basic_istream& seekg(pos_type);
|
||||
basic_istream& seekg(off_type, ios_base::seekdir);
|
||||
protected:
|
||||
basic_istream(const basic_istream& rhs) = delete;
|
||||
basic_istream(basic_istream&& rhs);
|
||||
// 27.7.2.1.2 Assign/swap:
|
||||
basic_istream& operator=(const basic_istream& rhs) = delete;
|
||||
basic_istream& operator=(basic_istream&& rhs);
|
||||
void swap(basic_istream& rhs);
|
||||
};
|
||||
|
||||
// 27.7.1.2.3 character extraction templates:
|
||||
@@ -184,13 +191,22 @@ protected:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream(basic_istream&& __rhs);
|
||||
#endif
|
||||
|
||||
// 27.7.1.1.2 Assign/swap:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream& operator=(basic_istream&& __rhs);
|
||||
#endif
|
||||
void swap(basic_istream& __rhs);
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
basic_istream (const basic_istream& __rhs) = delete;
|
||||
basic_istream& operator=(const basic_istream& __rhs) = delete;
|
||||
#else
|
||||
basic_istream (const basic_istream& __rhs); // not defined
|
||||
basic_istream& operator=(const basic_istream& __rhs); // not defined
|
||||
#endif
|
||||
#endif
|
||||
public:
|
||||
|
||||
// 27.7.1.1.3 Prefix/suffix:
|
||||
|
||||
@@ -324,6 +324,17 @@ template <class T, size_t N> reverse_iterator<T*> rend(T (&array)[N]); //
|
||||
template <class C> auto crbegin(const C& c) -> decltype(std::rbegin(c)); // C++14
|
||||
template <class C> auto crend(const C& c) -> decltype(std::rend(c)); // C++14
|
||||
|
||||
// 24.8, container access:
|
||||
template <class C> constexpr auto size(const C& c) -> decltype(c.size()); // C++17
|
||||
template <class T, size_t N> constexpr size_t size(const T (&array)[N]) noexcept; // C++17
|
||||
template <class C> constexpr auto empty(const C& c) -> decltype(c.empty()); // C++17
|
||||
template <class T, size_t N> constexpr bool empty(const T (&array)[N]) noexcept; // C++17
|
||||
template <class E> constexpr bool empty(initializer_list<E> il) noexcept; // C++17
|
||||
template <class C> constexpr auto data(C& c) -> decltype(c.data()); // C++17
|
||||
template <class C> constexpr auto data(const C& c) -> decltype(c.data()); // C++17
|
||||
template <class T, size_t N> constexpr T* data(T (&array)[N]) noexcept; // C++17
|
||||
template <class E> constexpr const E* data(initializer_list<E> il) noexcept; // C++17
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
@@ -338,11 +349,7 @@ template <class C> auto crend(const C& c) -> decltype(std::rend(c)); //
|
||||
#include <Availability.h>
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
# include <__debug>
|
||||
#else
|
||||
# define _LIBCPP_ASSERT(x, m) ((void)0)
|
||||
#endif
|
||||
#include <__debug>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
@@ -1572,6 +1579,36 @@ 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 _Tp, size_t _N>
|
||||
constexpr size_t size(const _Tp (&__array)[_N]) noexcept { return _N; }
|
||||
|
||||
template <class _C>
|
||||
constexpr auto empty(const _C& __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 _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 _C> constexpr
|
||||
auto data(const _C& __c) -> decltype(__c.data()) { return __c.data(); }
|
||||
|
||||
template <class _Tp, size_t _N>
|
||||
constexpr _Tp* data(_Tp (&__array)[_N]) noexcept { return __array; }
|
||||
|
||||
template <class _Ep>
|
||||
constexpr const _Ep* data(initializer_list<_Ep> __il) noexcept { return __il.begin(); }
|
||||
#endif
|
||||
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_ITERATOR
|
||||
|
||||
@@ -179,11 +179,7 @@ template <class T, class Alloc>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
# include <__debug>
|
||||
#else
|
||||
# define _LIBCPP_ASSERT(x, m) ((void)0)
|
||||
#endif
|
||||
#include <__debug>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
|
||||
@@ -193,6 +193,11 @@ template <class charT> class messages_byname;
|
||||
#include <ctime>
|
||||
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
|
||||
#include <support/win32/locale_win32.h>
|
||||
#elif defined(_NEWLIB_VERSION)
|
||||
// FIXME: replace all the uses of _NEWLIB_VERSION with __NEWLIB__ preceded by an
|
||||
// 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__)
|
||||
#include <nl_types.h>
|
||||
#endif
|
||||
@@ -229,7 +234,8 @@ typedef _VSTD::unique_ptr<__locale_struct, decltype(&uselocale)> __locale_raii;
|
||||
// OSX has nice foo_l() functions that let you turn off use of the global
|
||||
// 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)
|
||||
#if defined(__linux__) || defined(__EMSCRIPTEN__) || defined(_AIX) || \
|
||||
defined(_NEWLIB_VERSION)
|
||||
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
decltype(MB_CUR_MAX_L(_VSTD::declval<locale_t>()))
|
||||
@@ -450,7 +456,7 @@ __scan_keyword(_InputIterator& __b, _InputIterator __e,
|
||||
size_t __n_does_match = 0; // but none of them definitely do
|
||||
// Initialize all statuses to __might_match, except for "" keywords are __does_match
|
||||
unsigned char* __st = __status;
|
||||
for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, ++__st)
|
||||
for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void) ++__st)
|
||||
{
|
||||
if (!__ky->empty())
|
||||
*__st = __might_match;
|
||||
@@ -476,7 +482,7 @@ __scan_keyword(_InputIterator& __b, _InputIterator __e,
|
||||
// If the keyword doesn't match this character, then change the keyword
|
||||
// to doesn't match
|
||||
__st = __status;
|
||||
for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, ++__st)
|
||||
for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void) ++__st)
|
||||
{
|
||||
if (*__st == __might_match)
|
||||
{
|
||||
@@ -510,7 +516,7 @@ __scan_keyword(_InputIterator& __b, _InputIterator __e,
|
||||
if (__n_might_match + __n_does_match > 1)
|
||||
{
|
||||
__st = __status;
|
||||
for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, ++__st)
|
||||
for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void) ++__st)
|
||||
{
|
||||
if (*__st == __does_match && __ky->size() != __indx+1)
|
||||
{
|
||||
@@ -525,7 +531,7 @@ __scan_keyword(_InputIterator& __b, _InputIterator __e,
|
||||
if (__b == __e)
|
||||
__err |= ios_base::eofbit;
|
||||
// Return the first matching result
|
||||
for (__st = __status; __kb != __ke; ++__kb, ++__st)
|
||||
for (__st = __status; __kb != __ke; ++__kb, (void) ++__st)
|
||||
if (*__st == __does_match)
|
||||
break;
|
||||
if (__kb == __ke)
|
||||
@@ -1851,7 +1857,7 @@ __get_up_to_n_digits(_InputIterator& __b, _InputIterator __e,
|
||||
return 0;
|
||||
}
|
||||
int __r = __ct.narrow(__c, 0) - '0';
|
||||
for (++__b, --__n; __b != __e && __n > 0; ++__b, --__n)
|
||||
for (++__b, (void) --__n; __b != __e && __n > 0; ++__b, (void) --__n)
|
||||
{
|
||||
// get next digit
|
||||
__c = *__b;
|
||||
@@ -2964,6 +2970,8 @@ __double_or_nothing(unique_ptr<_Tp, void(*)(void*)>& __b, _Tp*& __n, _Tp*& __e)
|
||||
size_t __cur_cap = static_cast<size_t>(__e-__b.get()) * sizeof(_Tp);
|
||||
size_t __new_cap = __cur_cap < numeric_limits<size_t>::max() / 2 ?
|
||||
2 * __cur_cap : numeric_limits<size_t>::max();
|
||||
if (__new_cap == 0)
|
||||
__new_cap = sizeof(_Tp);
|
||||
size_t __n_off = static_cast<size_t>(__n - __b.get());
|
||||
_Tp* __t = (_Tp*)realloc(__owns ? __b.get() : 0, __new_cap);
|
||||
if (__t == 0)
|
||||
@@ -3673,7 +3681,7 @@ template <class _CharT>
|
||||
typename messages<_CharT>::catalog
|
||||
messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const
|
||||
{
|
||||
#if defined(_WIN32) || defined(__ANDROID__)
|
||||
#if defined(_WIN32) || defined(__ANDROID__) || defined(_NEWLIB_VERSION)
|
||||
return -1;
|
||||
#else // _WIN32 || __ANDROID__
|
||||
catalog __cat = (catalog)catopen(__nm.c_str(), NL_CAT_LOCALE);
|
||||
@@ -3688,7 +3696,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__)
|
||||
#if defined(_WIN32) || defined(__ANDROID__) || defined(_NEWLIB_VERSION)
|
||||
return __dflt;
|
||||
#else // _WIN32
|
||||
string __ndflt;
|
||||
@@ -3710,7 +3718,7 @@ template <class _CharT>
|
||||
void
|
||||
messages<_CharT>::do_close(catalog __c) const
|
||||
{
|
||||
#if !defined(_WIN32) && !defined(__ANDROID__)
|
||||
#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(_NEWLIB_VERSION)
|
||||
if (__c != -1)
|
||||
__c <<= 1;
|
||||
nl_catd __cat = (nl_catd)__c;
|
||||
|
||||
@@ -610,7 +610,7 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
|
||||
#include <cassert>
|
||||
#endif
|
||||
|
||||
#if __has_feature(cxx_atomic)
|
||||
#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
|
||||
# include <atomic>
|
||||
#endif
|
||||
|
||||
@@ -1450,7 +1450,7 @@ struct _LIBCPP_TYPE_VIS_ONLY allocator_traits
|
||||
template <class _Tp, class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void construct(allocator_type& __a, _Tp* __p, _Args&&... __args)
|
||||
{__construct(__has_construct<allocator_type, pointer, _Args...>(),
|
||||
{__construct(__has_construct<allocator_type, _Tp*, _Args...>(),
|
||||
__a, __p, _VSTD::forward<_Args>(__args)...);}
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class _Tp>
|
||||
@@ -3660,7 +3660,7 @@ template <class _Tp, class _Dp, class _Alloc>
|
||||
const void*
|
||||
__shared_ptr_pointer<_Tp, _Dp, _Alloc>::__get_deleter(const type_info& __t) const _NOEXCEPT
|
||||
{
|
||||
return __t == typeid(_Dp) ? &__data_.first().second() : 0;
|
||||
return __t == typeid(_Dp) ? _VSTD::addressof(__data_.first().second()) : 0;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_NO_RTTI
|
||||
@@ -3677,9 +3677,13 @@ template <class _Tp, class _Dp, class _Alloc>
|
||||
void
|
||||
__shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT
|
||||
{
|
||||
typename _Alloc::template rebind<__shared_ptr_pointer>::other __a(__data_.second());
|
||||
typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_pointer>::type _A;
|
||||
typedef allocator_traits<_A> _ATraits;
|
||||
typedef pointer_traits<typename _ATraits::pointer> _PTraits;
|
||||
|
||||
_A __a(__data_.second());
|
||||
__data_.second().~_Alloc();
|
||||
__a.deallocate(this, 1);
|
||||
__a.deallocate(_PTraits::pointer_to(*this), 1);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
@@ -3742,9 +3746,12 @@ template <class _Tp, class _Alloc>
|
||||
void
|
||||
__shared_ptr_emplace<_Tp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT
|
||||
{
|
||||
typename _Alloc::template rebind<__shared_ptr_emplace>::other __a(__data_.first());
|
||||
typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_emplace>::type _A;
|
||||
typedef allocator_traits<_A> _ATraits;
|
||||
typedef pointer_traits<typename _ATraits::pointer> _PTraits;
|
||||
_A __a(__data_.first());
|
||||
__data_.first().~_Alloc();
|
||||
__a.deallocate(this, 1);
|
||||
__a.deallocate(_PTraits::pointer_to(*this), 1);
|
||||
}
|
||||
|
||||
template<class _Tp> class _LIBCPP_TYPE_VIS_ONLY enable_shared_from_this;
|
||||
@@ -4090,12 +4097,13 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d, _Alloc __a,
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typedef __shared_ptr_pointer<_Yp*, _Dp, _Alloc> _CntrlBlk;
|
||||
typedef typename _Alloc::template rebind<_CntrlBlk>::other _A2;
|
||||
typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
|
||||
typedef __allocator_destructor<_A2> _D2;
|
||||
_A2 __a2(__a);
|
||||
unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
|
||||
::new(__hold2.get()) _CntrlBlk(__p, __d, __a);
|
||||
__cntrl_ = __hold2.release();
|
||||
::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
|
||||
_CntrlBlk(__p, __d, __a);
|
||||
__cntrl_ = _VSTD::addressof(*__hold2.release());
|
||||
__enable_weak_this(__p);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
@@ -4117,12 +4125,13 @@ shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a)
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typedef __shared_ptr_pointer<nullptr_t, _Dp, _Alloc> _CntrlBlk;
|
||||
typedef typename _Alloc::template rebind<_CntrlBlk>::other _A2;
|
||||
typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
|
||||
typedef __allocator_destructor<_A2> _D2;
|
||||
_A2 __a2(__a);
|
||||
unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
|
||||
::new(__hold2.get()) _CntrlBlk(__p, __d, __a);
|
||||
__cntrl_ = __hold2.release();
|
||||
::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
|
||||
_CntrlBlk(__p, __d, __a);
|
||||
__cntrl_ = _VSTD::addressof(*__hold2.release());
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
@@ -4282,14 +4291,15 @@ shared_ptr<_Tp>
|
||||
shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _Args&& ...__args)
|
||||
{
|
||||
typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
|
||||
typedef typename _Alloc::template rebind<_CntrlBlk>::other _A2;
|
||||
typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
|
||||
typedef __allocator_destructor<_A2> _D2;
|
||||
_A2 __a2(__a);
|
||||
unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
|
||||
::new(__hold2.get()) _CntrlBlk(__a, _VSTD::forward<_Args>(__args)...);
|
||||
::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
|
||||
_CntrlBlk(__a, _VSTD::forward<_Args>(__args)...);
|
||||
shared_ptr<_Tp> __r;
|
||||
__r.__ptr_ = __hold2.get()->get();
|
||||
__r.__cntrl_ = __hold2.release();
|
||||
__r.__cntrl_ = _VSTD::addressof(*__hold2.release());
|
||||
__r.__enable_weak_this(__r.__ptr_);
|
||||
return __r;
|
||||
}
|
||||
@@ -4373,14 +4383,15 @@ shared_ptr<_Tp>
|
||||
shared_ptr<_Tp>::allocate_shared(const _Alloc& __a)
|
||||
{
|
||||
typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
|
||||
typedef typename _Alloc::template rebind<_CntrlBlk>::other _Alloc2;
|
||||
typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;
|
||||
typedef __allocator_destructor<_Alloc2> _D2;
|
||||
_Alloc2 __alloc2(__a);
|
||||
unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
|
||||
::new(__hold2.get()) _CntrlBlk(__a);
|
||||
::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
|
||||
_CntrlBlk(__a);
|
||||
shared_ptr<_Tp> __r;
|
||||
__r.__ptr_ = __hold2.get()->get();
|
||||
__r.__cntrl_ = __hold2.release();
|
||||
__r.__cntrl_ = _VSTD::addressof(*__hold2.release());
|
||||
__r.__enable_weak_this(__r.__ptr_);
|
||||
return __r;
|
||||
}
|
||||
@@ -4391,14 +4402,15 @@ shared_ptr<_Tp>
|
||||
shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0)
|
||||
{
|
||||
typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
|
||||
typedef typename _Alloc::template rebind<_CntrlBlk>::other _Alloc2;
|
||||
typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;
|
||||
typedef __allocator_destructor<_Alloc2> _D2;
|
||||
_Alloc2 __alloc2(__a);
|
||||
unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
|
||||
::new(__hold2.get()) _CntrlBlk(__a, __a0);
|
||||
::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
|
||||
_CntrlBlk(__a, __a0);
|
||||
shared_ptr<_Tp> __r;
|
||||
__r.__ptr_ = __hold2.get()->get();
|
||||
__r.__cntrl_ = __hold2.release();
|
||||
__r.__cntrl_ = _VSTD::addressof(*__hold2.release());
|
||||
__r.__enable_weak_this(__r.__ptr_);
|
||||
return __r;
|
||||
}
|
||||
@@ -4409,14 +4421,15 @@ shared_ptr<_Tp>
|
||||
shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1)
|
||||
{
|
||||
typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
|
||||
typedef typename _Alloc::template rebind<_CntrlBlk>::other _Alloc2;
|
||||
typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;
|
||||
typedef __allocator_destructor<_Alloc2> _D2;
|
||||
_Alloc2 __alloc2(__a);
|
||||
unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
|
||||
::new(__hold2.get()) _CntrlBlk(__a, __a0, __a1);
|
||||
::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
|
||||
_CntrlBlk(__a, __a0, __a1);
|
||||
shared_ptr<_Tp> __r;
|
||||
__r.__ptr_ = __hold2.get()->get();
|
||||
__r.__cntrl_ = __hold2.release();
|
||||
__r.__cntrl_ = _VSTD::addressof(*__hold2.release());
|
||||
__r.__enable_weak_this(__r.__ptr_);
|
||||
return __r;
|
||||
}
|
||||
@@ -4427,14 +4440,15 @@ shared_ptr<_Tp>
|
||||
shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1, _A2& __a2)
|
||||
{
|
||||
typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
|
||||
typedef typename _Alloc::template rebind<_CntrlBlk>::other _Alloc2;
|
||||
typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;
|
||||
typedef __allocator_destructor<_Alloc2> _D2;
|
||||
_Alloc2 __alloc2(__a);
|
||||
unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
|
||||
::new(__hold2.get()) _CntrlBlk(__a, __a0, __a1, __a2);
|
||||
::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
|
||||
_CntrlBlk(__a, __a0, __a1, __a2);
|
||||
shared_ptr<_Tp> __r;
|
||||
__r.__ptr_ = __hold2.get()->get();
|
||||
__r.__cntrl_ = __hold2.release();
|
||||
__r.__cntrl_ = _VSTD::addressof(*__hold2.release());
|
||||
__r.__enable_weak_this(__r.__ptr_);
|
||||
return __r;
|
||||
}
|
||||
@@ -5262,7 +5276,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p);
|
||||
|
||||
#if __has_feature(cxx_atomic)
|
||||
#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
|
||||
|
||||
class _LIBCPP_TYPE_VIS __sp_mut
|
||||
{
|
||||
@@ -5388,7 +5402,7 @@ atomic_compare_exchange_weak_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v
|
||||
return atomic_compare_exchange_weak(__p, __v, __w);
|
||||
}
|
||||
|
||||
#endif // __has_feature(cxx_atomic)
|
||||
#endif // __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
|
||||
|
||||
//enum class
|
||||
struct _LIBCPP_TYPE_VIS pointer_safety
|
||||
|
||||
@@ -16,6 +16,7 @@ module std [system] {
|
||||
module atomic {
|
||||
header "atomic"
|
||||
export *
|
||||
requires cplusplus11
|
||||
}
|
||||
module bitset {
|
||||
header "bitset"
|
||||
|
||||
@@ -187,6 +187,8 @@ template<class Callable, class ...Args>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
|
||||
class _LIBCPP_TYPE_VIS recursive_mutex
|
||||
{
|
||||
pthread_mutex_t __m_;
|
||||
@@ -425,6 +427,8 @@ lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
struct _LIBCPP_TYPE_VIS_ONLY once_flag;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
@@ -91,7 +91,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
_Tp
|
||||
inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init)
|
||||
{
|
||||
for (; __first1 != __last1; ++__first1, ++__first2)
|
||||
for (; __first1 != __last1; ++__first1, (void) ++__first2)
|
||||
__init = __init + *__first1 * *__first2;
|
||||
return __init;
|
||||
}
|
||||
@@ -102,7 +102,7 @@ _Tp
|
||||
inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2,
|
||||
_Tp __init, _BinaryOperation1 __binary_op1, _BinaryOperation2 __binary_op2)
|
||||
{
|
||||
for (; __first1 != __last1; ++__first1, ++__first2)
|
||||
for (; __first1 != __last1; ++__first1, (void) ++__first2)
|
||||
__init = __binary_op1(__init, __binary_op2(*__first1, *__first2));
|
||||
return __init;
|
||||
}
|
||||
@@ -116,7 +116,7 @@ partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __res
|
||||
{
|
||||
typename iterator_traits<_InputIterator>::value_type __t(*__first);
|
||||
*__result = __t;
|
||||
for (++__first, ++__result; __first != __last; ++__first, ++__result)
|
||||
for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
|
||||
{
|
||||
__t = __t + *__first;
|
||||
*__result = __t;
|
||||
@@ -135,7 +135,7 @@ partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __res
|
||||
{
|
||||
typename iterator_traits<_InputIterator>::value_type __t(*__first);
|
||||
*__result = __t;
|
||||
for (++__first, ++__result; __first != __last; ++__first, ++__result)
|
||||
for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
|
||||
{
|
||||
__t = __binary_op(__t, *__first);
|
||||
*__result = __t;
|
||||
@@ -153,7 +153,7 @@ adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterat
|
||||
{
|
||||
typename iterator_traits<_InputIterator>::value_type __t1(*__first);
|
||||
*__result = __t1;
|
||||
for (++__first, ++__result; __first != __last; ++__first, ++__result)
|
||||
for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
|
||||
{
|
||||
typename iterator_traits<_InputIterator>::value_type __t2(*__first);
|
||||
*__result = __t2 - __t1;
|
||||
@@ -173,7 +173,7 @@ adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterat
|
||||
{
|
||||
typename iterator_traits<_InputIterator>::value_type __t1(*__first);
|
||||
*__result = __t1;
|
||||
for (++__first, ++__result; __first != __last; ++__first, ++__result)
|
||||
for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
|
||||
{
|
||||
typename iterator_traits<_InputIterator>::value_type __t2(*__first);
|
||||
*__result = __binary_op(__t2, __t1);
|
||||
@@ -188,7 +188,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value_)
|
||||
{
|
||||
for (; __first != __last; ++__first, ++__value_)
|
||||
for (; __first != __last; ++__first, (void) ++__value_)
|
||||
*__first = __value_;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,13 @@ public:
|
||||
pos_type tellp();
|
||||
basic_ostream& seekp(pos_type);
|
||||
basic_ostream& seekp(off_type, ios_base::seekdir);
|
||||
protected:
|
||||
basic_ostream(const basic_ostream& rhs) = delete;
|
||||
basic_ostream(basic_ostream&& rhs);
|
||||
// 27.7.3.3 Assign/swap
|
||||
basic_ostream& operator=(basic_ostream& rhs) = delete;
|
||||
basic_ostream& operator=(const basic_ostream&& rhs);
|
||||
void swap(basic_ostream& rhs);
|
||||
};
|
||||
|
||||
// 27.7.2.6.4 character inserters
|
||||
@@ -162,14 +169,19 @@ protected:
|
||||
#endif
|
||||
|
||||
// 27.7.2.3 Assign/swap
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
basic_ostream& operator=(const basic_ostream&) = delete;
|
||||
#endif
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream& operator=(basic_ostream&& __rhs);
|
||||
#endif
|
||||
void swap(basic_ostream& __rhs);
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
basic_ostream (const basic_ostream& __rhs) = delete;
|
||||
basic_ostream& operator=(const basic_ostream& __rhs) = delete;
|
||||
#else
|
||||
basic_ostream (const basic_ostream& __rhs); // not defined
|
||||
basic_ostream& operator=(const basic_ostream& __rhs); // not defined
|
||||
#endif
|
||||
public:
|
||||
|
||||
// 27.7.2.4 Prefix/suffix:
|
||||
|
||||
@@ -4009,6 +4009,8 @@ binomial_distribution<_IntType>::param_type::param_type(result_type __t, double
|
||||
}
|
||||
}
|
||||
|
||||
// Reference: Kemp, C.D. (1986). `A modal method for generating binomial
|
||||
// variables', Commun. Statist. - Theor. Meth. 15(3), 805-813.
|
||||
template<class _IntType>
|
||||
template<class _URNG>
|
||||
_IntType
|
||||
@@ -4035,6 +4037,7 @@ binomial_distribution<_IntType>::operator()(_URNG& __g, const param_type& __pr)
|
||||
if (__u < 0)
|
||||
return __rd - 1;
|
||||
}
|
||||
if ( __rd != 0 )
|
||||
--__rd;
|
||||
++__ru;
|
||||
if (__ru <= __pr.__t_)
|
||||
|
||||
@@ -112,6 +112,10 @@ template <class Mutex>
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_THREADS
|
||||
#error <shared_mutex> is not supported on this single threaded system
|
||||
#else // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class _LIBCPP_TYPE_VIS shared_timed_mutex
|
||||
@@ -414,6 +418,8 @@ swap(shared_lock<_Mutex>& __x, shared_lock<_Mutex>& __y) _NOEXCEPT
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 11
|
||||
|
||||
#endif // _LIBCPP_SHARED_MUTEX
|
||||
|
||||
@@ -325,11 +325,16 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs)
|
||||
__p = const_cast<char_type*>(__str_.data());
|
||||
if (__binp != -1)
|
||||
this->setg(__p + __binp, __p + __ninp, __p + __einp);
|
||||
else
|
||||
this->setg(nullptr, nullptr, nullptr);
|
||||
if (__bout != -1)
|
||||
{
|
||||
this->setp(__p + __bout, __p + __eout);
|
||||
this->pbump(__nout);
|
||||
}
|
||||
else
|
||||
this->setp(nullptr, nullptr);
|
||||
|
||||
__hm_ = __hm == -1 ? nullptr : __p + __hm;
|
||||
__mode_ = __rhs.__mode_;
|
||||
__p = const_cast<char_type*>(__rhs.__str_.data());
|
||||
|
||||
248
include/string
248
include/string
@@ -453,6 +453,8 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); // C++1
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#include <__debug>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
@@ -507,14 +509,11 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits
|
||||
typedef streampos pos_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
|
||||
static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
|
||||
{__c1 = __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 < __c2;}
|
||||
|
||||
static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
|
||||
@@ -524,20 +523,15 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits
|
||||
static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
|
||||
static char_type* assign(char_type* __s, size_t __n, char_type __a);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
{return char_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
{return int_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
|
||||
{return int_type(EOF);}
|
||||
};
|
||||
|
||||
@@ -634,51 +628,37 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<char>
|
||||
typedef streampos pos_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
|
||||
static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
|
||||
{__c1 = __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return (unsigned char)__c1 < (unsigned char)__c2;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static int compare(const char_type* __s1, const char_type* __s2, size_t __n)
|
||||
static inline int compare(const char_type* __s1, const char_type* __s2, size_t __n)
|
||||
{return memcmp(__s1, __s2, __n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static size_t length(const char_type* __s) {return strlen(__s);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static const char_type* find(const char_type* __s, size_t __n, const char_type& __a)
|
||||
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);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static char_type* move(char_type* __s1, const char_type* __s2, size_t __n)
|
||||
static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n)
|
||||
{return (char_type*)memmove(__s1, __s2, __n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static char_type* copy(char_type* __s1, const char_type* __s2, size_t __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);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static char_type* assign(char_type* __s, size_t __n, char_type __a)
|
||||
static inline char_type* assign(char_type* __s, size_t __n, char_type __a)
|
||||
{return (char_type*)memset(__s, to_int_type(__a), __n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
{return char_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
{return int_type((unsigned char)__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
|
||||
{return int_type(EOF);}
|
||||
};
|
||||
|
||||
@@ -693,52 +673,38 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<wchar_t>
|
||||
typedef streampos pos_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
|
||||
static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
|
||||
{__c1 = __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 < __c2;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static int compare(const char_type* __s1, const char_type* __s2, size_t __n)
|
||||
static inline int compare(const char_type* __s1, const char_type* __s2, size_t __n)
|
||||
{return wmemcmp(__s1, __s2, __n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static size_t length(const char_type* __s)
|
||||
static inline size_t length(const char_type* __s)
|
||||
{return wcslen(__s);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static const char_type* find(const char_type* __s, size_t __n, const char_type& __a)
|
||||
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);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static char_type* move(char_type* __s1, const char_type* __s2, size_t __n)
|
||||
static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n)
|
||||
{return (char_type*)wmemmove(__s1, __s2, __n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static char_type* copy(char_type* __s1, const char_type* __s2, size_t __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);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static char_type* assign(char_type* __s, size_t __n, char_type __a)
|
||||
static inline char_type* assign(char_type* __s, size_t __n, char_type __a)
|
||||
{return (char_type*)wmemset(__s, __a, __n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
{return char_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
{return int_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
|
||||
{return int_type(WEOF);}
|
||||
};
|
||||
|
||||
@@ -753,14 +719,11 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<char16_t>
|
||||
typedef u16streampos pos_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
|
||||
static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
|
||||
{__c1 = __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 < __c2;}
|
||||
|
||||
static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
|
||||
@@ -770,20 +733,15 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<char16_t>
|
||||
static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
|
||||
static char_type* assign(char_type* __s, size_t __n, char_type __a);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
{return char_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
{return int_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
|
||||
{return int_type(0xDFFF);}
|
||||
};
|
||||
|
||||
@@ -874,14 +832,11 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<char32_t>
|
||||
typedef u32streampos pos_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
|
||||
static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
|
||||
{__c1 = __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 < __c2;}
|
||||
|
||||
static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
|
||||
@@ -891,20 +846,15 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<char32_t>
|
||||
static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
|
||||
static char_type* assign(char_type* __s, size_t __n, char_type __a);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
{return char_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
{return int_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
|
||||
static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
|
||||
{return int_type(0xFFFFFFFF);}
|
||||
};
|
||||
|
||||
@@ -990,10 +940,10 @@ char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a)
|
||||
|
||||
// helper fns for basic_string
|
||||
|
||||
// __find
|
||||
// __str_find
|
||||
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
|
||||
_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
__find(const _CharT *__p, _SizeT __sz,
|
||||
__str_find(const _CharT *__p, _SizeT __sz,
|
||||
_CharT __c, _SizeT __pos) _NOEXCEPT
|
||||
{
|
||||
if (__pos >= __sz)
|
||||
@@ -1006,28 +956,28 @@ __find(const _CharT *__p, _SizeT __sz,
|
||||
|
||||
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
|
||||
_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
__find(const _CharT *__p, _SizeT __sz,
|
||||
__str_find(const _CharT *__p, _SizeT __sz,
|
||||
const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
|
||||
{
|
||||
if (__pos > __sz || __sz - __pos < __n)
|
||||
return __npos;
|
||||
if (__n == 0)
|
||||
return __pos;
|
||||
// if (__n == 1)
|
||||
// return _VSTD::__find<_CharT, _SizeT, _Traits, __npos>(__p, __sz, *__s, __pos);
|
||||
const _CharT* __r =
|
||||
_VSTD::search(__p + __pos, __p + __sz, __s, __s + __n, _Traits::eq);
|
||||
_VSTD::__search(__p + __pos, __p + __sz,
|
||||
__s, __s + __n, _Traits::eq,
|
||||
random_access_iterator_tag(), random_access_iterator_tag());
|
||||
if (__r == __p + __sz)
|
||||
return __npos;
|
||||
return static_cast<_SizeT>(__r - __p);
|
||||
}
|
||||
|
||||
|
||||
// __rfind
|
||||
// __str_rfind
|
||||
|
||||
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
|
||||
_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
__rfind(const _CharT *__p, _SizeT __sz,
|
||||
__str_rfind(const _CharT *__p, _SizeT __sz,
|
||||
_CharT __c, _SizeT __pos) _NOEXCEPT
|
||||
{
|
||||
if (__sz < 1)
|
||||
@@ -1046,7 +996,7 @@ __rfind(const _CharT *__p, _SizeT __sz,
|
||||
|
||||
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
|
||||
_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
__rfind(const _CharT *__p, _SizeT __sz,
|
||||
__str_rfind(const _CharT *__p, _SizeT __sz,
|
||||
const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
|
||||
{
|
||||
__pos = _VSTD::min(__pos, __sz);
|
||||
@@ -1054,21 +1004,23 @@ __rfind(const _CharT *__p, _SizeT __sz,
|
||||
__pos += __n;
|
||||
else
|
||||
__pos = __sz;
|
||||
const _CharT* __r = _VSTD::find_end(__p, __p + __pos, __s, __s + __n, _Traits::eq);
|
||||
const _CharT* __r = _VSTD::__find_end(
|
||||
__p, __p + __pos, __s, __s + __n, _Traits::eq,
|
||||
random_access_iterator_tag(), random_access_iterator_tag());
|
||||
if (__n > 0 && __r == __p + __pos)
|
||||
return __npos;
|
||||
return static_cast<_SizeT>(__r - __p);
|
||||
}
|
||||
|
||||
// __find_first_of
|
||||
// __str_find_first_of
|
||||
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
|
||||
_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
__find_first_of(const _CharT *__p, _SizeT __sz,
|
||||
__str_find_first_of(const _CharT *__p, _SizeT __sz,
|
||||
const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
|
||||
{
|
||||
if (__pos >= __sz || __n == 0)
|
||||
return __npos;
|
||||
const _CharT* __r = _VSTD::find_first_of
|
||||
const _CharT* __r = _VSTD::__find_first_of_ce
|
||||
(__p + __pos, __p + __sz, __s, __s + __n, _Traits::eq );
|
||||
if (__r == __p + __sz)
|
||||
return __npos;
|
||||
@@ -1076,10 +1028,10 @@ __find_first_of(const _CharT *__p, _SizeT __sz,
|
||||
}
|
||||
|
||||
|
||||
// __find_last_of
|
||||
// __str_find_last_of
|
||||
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
|
||||
_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
__find_last_of(const _CharT *__p, _SizeT __sz,
|
||||
__str_find_last_of(const _CharT *__p, _SizeT __sz,
|
||||
const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
|
||||
{
|
||||
if (__n != 0)
|
||||
@@ -1099,10 +1051,10 @@ __find_last_of(const _CharT *__p, _SizeT __sz,
|
||||
}
|
||||
|
||||
|
||||
// __find_first_not_of
|
||||
// __str_find_first_not_of
|
||||
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
|
||||
_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
__find_first_not_of(const _CharT *__p, _SizeT __sz,
|
||||
__str_find_first_not_of(const _CharT *__p, _SizeT __sz,
|
||||
const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
|
||||
{
|
||||
if (__pos < __sz)
|
||||
@@ -1118,7 +1070,7 @@ __find_first_not_of(const _CharT *__p, _SizeT __sz,
|
||||
|
||||
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
|
||||
_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
__find_first_not_of(const _CharT *__p, _SizeT __sz,
|
||||
__str_find_first_not_of(const _CharT *__p, _SizeT __sz,
|
||||
_CharT __c, _SizeT __pos) _NOEXCEPT
|
||||
{
|
||||
if (__pos < __sz)
|
||||
@@ -1132,10 +1084,10 @@ __find_first_not_of(const _CharT *__p, _SizeT __sz,
|
||||
}
|
||||
|
||||
|
||||
// __find_last_not_of
|
||||
// __str_find_last_not_of
|
||||
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
|
||||
_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
__find_last_not_of(const _CharT *__p, _SizeT __sz,
|
||||
__str_find_last_not_of(const _CharT *__p, _SizeT __sz,
|
||||
const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
|
||||
{
|
||||
if (__pos < __sz)
|
||||
@@ -1151,7 +1103,7 @@ __find_last_not_of(const _CharT *__p, _SizeT __sz,
|
||||
|
||||
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
|
||||
_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
__find_last_not_of(const _CharT *__p, _SizeT __sz,
|
||||
__str_find_last_not_of(const _CharT *__p, _SizeT __sz,
|
||||
_CharT __c, _SizeT __pos) _NOEXCEPT
|
||||
{
|
||||
if (__pos < __sz)
|
||||
@@ -2263,7 +2215,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _For
|
||||
__set_long_cap(__cap+1);
|
||||
__set_long_size(__sz);
|
||||
}
|
||||
for (; __first != __last; ++__first, ++__p)
|
||||
for (; __first != __last; ++__first, (void) ++__p)
|
||||
traits_type::assign(*__p, *__first);
|
||||
traits_type::assign(*__p, value_type());
|
||||
}
|
||||
@@ -3429,7 +3381,7 @@ basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,
|
||||
size_type __n) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find(): received nullptr");
|
||||
return _VSTD::__find<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, __n);
|
||||
}
|
||||
|
||||
@@ -3439,7 +3391,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find(const basic_string& __str,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__find<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __str.data(), __pos, __str.size());
|
||||
}
|
||||
|
||||
@@ -3450,7 +3402,7 @@ basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "string::find(): received nullptr");
|
||||
return _VSTD::__find<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||
}
|
||||
|
||||
@@ -3459,7 +3411,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find(value_type __c,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__find<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __c, __pos);
|
||||
}
|
||||
|
||||
@@ -3472,7 +3424,7 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,
|
||||
size_type __n) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::rfind(): received nullptr");
|
||||
return _VSTD::__rfind<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, __n);
|
||||
}
|
||||
|
||||
@@ -3482,7 +3434,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::rfind(const basic_string& __str,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__rfind<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __str.data(), __pos, __str.size());
|
||||
}
|
||||
|
||||
@@ -3493,7 +3445,7 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "string::rfind(): received nullptr");
|
||||
return _VSTD::__rfind<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||
}
|
||||
|
||||
@@ -3502,7 +3454,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::rfind(value_type __c,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__rfind<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __c, __pos);
|
||||
}
|
||||
|
||||
@@ -3515,7 +3467,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,
|
||||
size_type __n) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_of(): received nullptr");
|
||||
return _VSTD::__find_first_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, __n);
|
||||
}
|
||||
|
||||
@@ -3525,7 +3477,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_first_of(const basic_string& __str,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__find_first_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __str.data(), __pos, __str.size());
|
||||
}
|
||||
|
||||
@@ -3536,7 +3488,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "string::find_first_of(): received nullptr");
|
||||
return _VSTD::__find_first_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_first_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||
}
|
||||
|
||||
@@ -3558,7 +3510,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,
|
||||
size_type __n) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_of(): received nullptr");
|
||||
return _VSTD::__find_last_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, __n);
|
||||
}
|
||||
|
||||
@@ -3568,7 +3520,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_last_of(const basic_string& __str,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__find_last_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __str.data(), __pos, __str.size());
|
||||
}
|
||||
|
||||
@@ -3579,7 +3531,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "string::find_last_of(): received nullptr");
|
||||
return _VSTD::__find_last_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_last_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||
}
|
||||
|
||||
@@ -3601,7 +3553,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* _
|
||||
size_type __n) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_not_of(): received nullptr");
|
||||
return _VSTD::__find_first_not_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, __n);
|
||||
}
|
||||
|
||||
@@ -3611,7 +3563,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const basic_string& __str,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__find_first_not_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __str.data(), __pos, __str.size());
|
||||
}
|
||||
|
||||
@@ -3622,7 +3574,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* _
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "string::find_first_not_of(): received nullptr");
|
||||
return _VSTD::__find_first_not_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||
}
|
||||
|
||||
@@ -3632,7 +3584,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__find_first_not_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_first_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __c, __pos);
|
||||
}
|
||||
|
||||
@@ -3645,7 +3597,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __
|
||||
size_type __n) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_not_of(): received nullptr");
|
||||
return _VSTD::__find_last_not_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, __n);
|
||||
}
|
||||
|
||||
@@ -3655,7 +3607,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const basic_string& __str,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__find_last_not_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __str.data(), __pos, __str.size());
|
||||
}
|
||||
|
||||
@@ -3666,7 +3618,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "string::find_last_not_of(): received nullptr");
|
||||
return _VSTD::__find_last_not_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __s, __pos, traits_type::length(__s));
|
||||
}
|
||||
|
||||
@@ -3676,7 +3628,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
||||
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(value_type __c,
|
||||
size_type __pos) const _NOEXCEPT
|
||||
{
|
||||
return _VSTD::__find_last_not_of<value_type, size_type, traits_type, npos>
|
||||
return _VSTD::__str_find_last_not_of<value_type, size_type, traits_type, npos>
|
||||
(data(), size(), __c, __pos);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,173 +20,12 @@ extern "C" {
|
||||
#include <stdlib.h>
|
||||
#include <xlocale.h>
|
||||
|
||||
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, size_t base,
|
||||
locale_t) {
|
||||
return strtoll(nptr, endptr, base);
|
||||
}
|
||||
|
||||
static inline unsigned long long strtoull_l(const char *nptr, char **endptr,
|
||||
size_t base, locale_t) {
|
||||
return strtoull(nptr, endptr, base);
|
||||
}
|
||||
|
||||
static inline long long wcstoll_l(const wchar_t *nptr, wchar_t **endptr,
|
||||
size_t base, locale_t) {
|
||||
return wcstoll(nptr, endptr, base);
|
||||
}
|
||||
|
||||
static inline unsigned long long wcstoull_l(const wchar_t *nptr,
|
||||
wchar_t **endptr, size_t 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
|
||||
|
||||
// Share implementation with Newlib
|
||||
#include <support/xlocale/xlocale.h>
|
||||
|
||||
#endif // defined(__ANDROID__)
|
||||
#endif // _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_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
|
||||
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
|
||||
@@ -106,6 +106,10 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
|
||||
|
||||
#define __STDCPP_THREADS__ __cplusplus
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_THREADS
|
||||
#error <thread> is not supported on this single threaded system
|
||||
#else // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp>
|
||||
@@ -455,4 +459,6 @@ void yield() _NOEXCEPT {sched_yield();}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
#endif // _LIBCPP_THREAD
|
||||
|
||||
@@ -376,19 +376,18 @@ template <class ..._Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __swallow(_Tp&&...) _NOEXCEPT {}
|
||||
|
||||
template <bool ...> struct __all;
|
||||
template <bool ..._B>
|
||||
struct __all
|
||||
: is_same<__all<_B...>, __all<(_B, true)...>>
|
||||
{ };
|
||||
|
||||
template <>
|
||||
struct __all<>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
template <class _Tp>
|
||||
struct __all_default_constructible;
|
||||
|
||||
template <bool _B0, bool ... _Bp>
|
||||
struct __all<_B0, _Bp...>
|
||||
{
|
||||
static const bool value = _B0 && __all<_Bp...>::value;
|
||||
};
|
||||
template <class ..._Tp>
|
||||
struct __all_default_constructible<__tuple_types<_Tp...>>
|
||||
: __all<is_default_constructible<_Tp>::value...>
|
||||
{ };
|
||||
|
||||
// __tuple_impl
|
||||
|
||||
@@ -512,6 +511,9 @@ 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
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR tuple()
|
||||
_NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
|
||||
@@ -547,6 +549,12 @@ public:
|
||||
sizeof...(_Up) < sizeof...(_Tp) ?
|
||||
sizeof...(_Up) :
|
||||
sizeof...(_Tp)>::type
|
||||
>::value &&
|
||||
__all_default_constructible<
|
||||
typename __make_tuple_types<tuple, sizeof...(_Tp),
|
||||
sizeof...(_Up) < sizeof...(_Tp) ?
|
||||
sizeof...(_Up) :
|
||||
sizeof...(_Tp)>::type
|
||||
>::value,
|
||||
bool
|
||||
>::type = false
|
||||
@@ -554,7 +562,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
tuple(_Up&&... __u)
|
||||
_NOEXCEPT_((
|
||||
is_nothrow_constructible<
|
||||
is_nothrow_constructible<base,
|
||||
typename __make_tuple_indices<sizeof...(_Up)>::type,
|
||||
typename __make_tuple_types<tuple, sizeof...(_Up)>::type,
|
||||
typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type,
|
||||
@@ -587,6 +595,12 @@ public:
|
||||
sizeof...(_Up) < sizeof...(_Tp) ?
|
||||
sizeof...(_Up) :
|
||||
sizeof...(_Tp)>::type
|
||||
>::value &&
|
||||
__all_default_constructible<
|
||||
typename __make_tuple_types<tuple, sizeof...(_Tp),
|
||||
sizeof...(_Up) < sizeof...(_Tp) ?
|
||||
sizeof...(_Up) :
|
||||
sizeof...(_Tp)>::type
|
||||
>::value,
|
||||
bool
|
||||
>::type =false
|
||||
@@ -595,7 +609,7 @@ public:
|
||||
explicit
|
||||
tuple(_Up&&... __u)
|
||||
_NOEXCEPT_((
|
||||
is_nothrow_constructible<
|
||||
is_nothrow_constructible<base,
|
||||
typename __make_tuple_indices<sizeof...(_Up)>::type,
|
||||
typename __make_tuple_types<tuple, sizeof...(_Up)>::type,
|
||||
typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type,
|
||||
@@ -620,6 +634,12 @@ public:
|
||||
sizeof...(_Up) < sizeof...(_Tp) ?
|
||||
sizeof...(_Up) :
|
||||
sizeof...(_Tp)>::type
|
||||
>::value &&
|
||||
__all_default_constructible<
|
||||
typename __make_tuple_types<tuple, sizeof...(_Tp),
|
||||
sizeof...(_Up) < sizeof...(_Tp) ?
|
||||
sizeof...(_Up) :
|
||||
sizeof...(_Tp)>::type
|
||||
>::value
|
||||
>::type
|
||||
>
|
||||
|
||||
@@ -197,7 +197,9 @@ namespace std
|
||||
template <class F, class... ArgTypes>
|
||||
using result_of_t = typename result_of<F(ArgTypes...)>::type; // C++14
|
||||
|
||||
} // std
|
||||
template <class...>
|
||||
using void_t = void;
|
||||
} // C++17
|
||||
|
||||
*/
|
||||
#include <__config>
|
||||
@@ -209,6 +211,11 @@ namespace std
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class...>
|
||||
struct __void_t { typedef void type; };
|
||||
#endif
|
||||
|
||||
template <bool _Bp, class _If, class _Then>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY conditional {typedef _If type;};
|
||||
template <class _If, class _Then>
|
||||
@@ -218,6 +225,9 @@ template <class _If, class _Then>
|
||||
template <bool _Bp, class _If, class _Then> using conditional_t = typename conditional<_Bp, _If, _Then>::type;
|
||||
#endif
|
||||
|
||||
template <bool, class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __lazy_enable_if {};
|
||||
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __lazy_enable_if<true, _Tp> {typedef typename _Tp::type type;};
|
||||
|
||||
template <bool, class _Tp = void> struct _LIBCPP_TYPE_VIS_ONLY enable_if {};
|
||||
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY enable_if<true, _Tp> {typedef _Tp type;};
|
||||
|
||||
@@ -1208,43 +1218,46 @@ template <class _A1, class _A2 = void, class _A3 = void,
|
||||
bool = __numeric_type<_A1>::value &&
|
||||
__numeric_type<_A2>::value &&
|
||||
__numeric_type<_A3>::value>
|
||||
class __promote
|
||||
class __promote_imp
|
||||
{
|
||||
public:
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template <class _A1, class _A2, class _A3>
|
||||
class __promote<_A1, _A2, _A3, true>
|
||||
class __promote_imp<_A1, _A2, _A3, true>
|
||||
{
|
||||
private:
|
||||
typedef typename __promote<_A1>::type __type1;
|
||||
typedef typename __promote<_A2>::type __type2;
|
||||
typedef typename __promote<_A3>::type __type3;
|
||||
typedef typename __promote_imp<_A1>::type __type1;
|
||||
typedef typename __promote_imp<_A2>::type __type2;
|
||||
typedef typename __promote_imp<_A3>::type __type3;
|
||||
public:
|
||||
typedef decltype(__type1() + __type2() + __type3()) type;
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template <class _A1, class _A2>
|
||||
class __promote<_A1, _A2, void, true>
|
||||
class __promote_imp<_A1, _A2, void, true>
|
||||
{
|
||||
private:
|
||||
typedef typename __promote<_A1>::type __type1;
|
||||
typedef typename __promote<_A2>::type __type2;
|
||||
typedef typename __promote_imp<_A1>::type __type1;
|
||||
typedef typename __promote_imp<_A2>::type __type2;
|
||||
public:
|
||||
typedef decltype(__type1() + __type2()) type;
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template <class _A1>
|
||||
class __promote<_A1, void, void, true>
|
||||
class __promote_imp<_A1, void, void, true>
|
||||
{
|
||||
public:
|
||||
typedef typename __numeric_type<_A1>::type type;
|
||||
static const bool value = true;
|
||||
static const bool __does_not_throw = _NOEXCEPT_OR_FALSE(static_cast<type>(declval<_A1>()));
|
||||
};
|
||||
|
||||
template <class _A1, class _A2 = void, class _A3 = void>
|
||||
class __promote : public __promote_imp<_A1, _A2, _A3> {};
|
||||
|
||||
#ifdef _LIBCPP_STORE_AS_OPTIMIZATION
|
||||
|
||||
// __transform
|
||||
@@ -1523,7 +1536,7 @@ struct is_assignable
|
||||
|
||||
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_copy_assignable
|
||||
: public is_assignable<typename add_lvalue_reference<_Tp>::type,
|
||||
const typename add_lvalue_reference<_Tp>::type> {};
|
||||
typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
|
||||
|
||||
// is_move_assignable
|
||||
|
||||
@@ -2637,8 +2650,8 @@ struct _LIBCPP_TYPE_VIS_ONLY is_default_constructible
|
||||
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY is_copy_constructible
|
||||
: public is_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type>
|
||||
{};
|
||||
: public is_constructible<_Tp,
|
||||
typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
|
||||
|
||||
// is_move_constructible
|
||||
|
||||
@@ -2842,8 +2855,7 @@ struct is_trivially_assignable<_Tp&, _Tp&&>
|
||||
|
||||
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copy_assignable
|
||||
: public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type,
|
||||
const typename add_lvalue_reference<_Tp>::type>
|
||||
{};
|
||||
typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
|
||||
|
||||
// is_trivially_move_assignable
|
||||
|
||||
@@ -2861,7 +2873,7 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_assignable
|
||||
#if __has_feature(has_trivial_destructor) || (_GNUC_VER >= 403)
|
||||
|
||||
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible
|
||||
: public integral_constant<bool, __has_trivial_destructor(_Tp)> {};
|
||||
: public integral_constant<bool, is_destructible<_Tp>::value && __has_trivial_destructor(_Tp)> {};
|
||||
|
||||
#else
|
||||
|
||||
@@ -2889,29 +2901,38 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible
|
||||
|
||||
#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L)
|
||||
|
||||
template <bool, class _Tp, class... _Args> struct __libcpp_is_nothrow_constructible;
|
||||
template <bool, bool, class _Tp, class... _Args> struct __libcpp_is_nothrow_constructible;
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
struct __libcpp_is_nothrow_constructible<true, _Tp, _Args...>
|
||||
struct __libcpp_is_nothrow_constructible</*is constructible*/true, /*is reference*/false, _Tp, _Args...>
|
||||
: public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
struct __libcpp_is_nothrow_constructible<false, _Tp, _Args...>
|
||||
template <class _Tp>
|
||||
void __implicit_conversion_to(_Tp) noexcept { }
|
||||
|
||||
template <class _Tp, class _Arg>
|
||||
struct __libcpp_is_nothrow_constructible</*is constructible*/true, /*is reference*/true, _Tp, _Arg>
|
||||
: public integral_constant<bool, noexcept(__implicit_conversion_to<_Tp>(declval<_Arg>()))>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp, bool _IsReference, class... _Args>
|
||||
struct __libcpp_is_nothrow_constructible</*is constructible*/false, _IsReference, _Tp, _Args...>
|
||||
: public false_type
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible
|
||||
: __libcpp_is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, _Tp, _Args...>
|
||||
: __libcpp_is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, is_reference<_Tp>::value, _Tp, _Args...>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp, size_t _Ns>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp[_Ns]>
|
||||
: __libcpp_is_nothrow_constructible<is_constructible<_Tp>::value, _Tp>
|
||||
: __libcpp_is_nothrow_constructible<is_constructible<_Tp>::value, is_reference<_Tp>::value, _Tp>
|
||||
{
|
||||
};
|
||||
|
||||
@@ -3034,8 +3055,8 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_default_constructib
|
||||
// is_nothrow_copy_constructible
|
||||
|
||||
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_copy_constructible
|
||||
: public is_nothrow_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type>
|
||||
{};
|
||||
: public is_nothrow_constructible<_Tp,
|
||||
typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
|
||||
|
||||
// is_nothrow_move_constructible
|
||||
|
||||
@@ -3119,8 +3140,7 @@ struct is_nothrow_assignable<_Tp&, _Tp&&>
|
||||
|
||||
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_copy_assignable
|
||||
: public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type,
|
||||
const typename add_lvalue_reference<_Tp>::type>
|
||||
{};
|
||||
typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
|
||||
|
||||
// is_nothrow_move_assignable
|
||||
|
||||
@@ -3629,24 +3649,41 @@ struct underlying_type
|
||||
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_operator_addressof_imp
|
||||
struct __has_operator_addressof_member_imp
|
||||
{
|
||||
template <class>
|
||||
static auto __test(__any) -> false_type;
|
||||
template <class _Up>
|
||||
static auto __test(_Up* __u)
|
||||
-> typename __select_2nd<decltype(__u->operator&()), true_type>::type;
|
||||
static auto __test(int)
|
||||
-> typename __select_2nd<decltype(_VSTD::declval<_Up>().operator&()), true_type>::type;
|
||||
template <class>
|
||||
static auto __test(long) -> false_type;
|
||||
|
||||
static const bool value = decltype(__test<_Tp>(nullptr))::value;
|
||||
static const bool value = decltype(__test<_Tp>(0))::value;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_operator_addressof_free_imp
|
||||
{
|
||||
template <class _Up>
|
||||
static auto __test(int)
|
||||
-> typename __select_2nd<decltype(operator&(_VSTD::declval<_Up>())), true_type>::type;
|
||||
template <class>
|
||||
static auto __test(long) -> false_type;
|
||||
|
||||
static const bool value = decltype(__test<_Tp>(0))::value;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_operator_addressof
|
||||
: public integral_constant<bool, __has_operator_addressof_imp<_Tp>::value>
|
||||
: public integral_constant<bool, __has_operator_addressof_member_imp<_Tp>::value
|
||||
|| __has_operator_addressof_free_imp<_Tp>::value>
|
||||
{};
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
template <class...> using void_t = void;
|
||||
#endif
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_TYPE_TRAITS
|
||||
|
||||
@@ -351,6 +351,8 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
|
||||
#include <functional>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <__debug>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
@@ -325,6 +325,8 @@ template <class Value, class Hash, class Pred, class Alloc>
|
||||
#include <__hash_table>
|
||||
#include <functional>
|
||||
|
||||
#include <__debug>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
@@ -207,7 +207,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
_ForwardIterator2
|
||||
swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2)
|
||||
{
|
||||
for(; __first1 != __last1; ++__first1, ++__first2)
|
||||
for(; __first1 != __last1; ++__first1, (void) ++__first2)
|
||||
swap(*__first1, *__first2);
|
||||
return __first2;
|
||||
}
|
||||
|
||||
@@ -276,11 +276,7 @@ void swap(vector<T,Allocator>& x, vector<T,Allocator>& y)
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
# include <__debug>
|
||||
#else
|
||||
# define _LIBCPP_ASSERT(x, m) ((void)0)
|
||||
#endif
|
||||
#include <__debug>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
@@ -788,7 +784,6 @@ private:
|
||||
void
|
||||
>::type
|
||||
__construct_at_end(_ForwardIterator __first, _ForwardIterator __last);
|
||||
void __move_construct_at_end(pointer __first, pointer __last);
|
||||
void __append(size_type __n);
|
||||
void __append(size_type __n, const_reference __x);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -840,7 +835,7 @@ private:
|
||||
// may not meet the AddressSanitizer alignment constraints.
|
||||
// See the documentation for __sanitizer_annotate_contiguous_container for more details.
|
||||
void __annotate_contiguous_container
|
||||
(const void *__beg, const void *__end, const void *__old_mid, const void *__new_mid)
|
||||
(const void *__beg, const void *__end, const void *__old_mid, const void *__new_mid) const
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_ASAN
|
||||
if (__beg && is_same<allocator_type, __default_allocator_type>::value)
|
||||
@@ -848,26 +843,50 @@ private:
|
||||
#endif
|
||||
}
|
||||
|
||||
void __annotate_new(size_type __current_size)
|
||||
void __annotate_new(size_type __current_size) const
|
||||
{
|
||||
__annotate_contiguous_container(data(), data() + capacity(),
|
||||
data() + capacity(), data() + __current_size);
|
||||
}
|
||||
void __annotate_delete()
|
||||
void __annotate_delete() const
|
||||
{
|
||||
__annotate_contiguous_container(data(), data() + capacity(),
|
||||
data() + size(), data() + capacity());
|
||||
}
|
||||
void __annotate_increase(size_type __n)
|
||||
void __annotate_increase(size_type __n) const
|
||||
{
|
||||
__annotate_contiguous_container(data(), data() + capacity(),
|
||||
data() + size(), data() + size() + __n);
|
||||
}
|
||||
void __annotate_shrink(size_type __old_size)
|
||||
void __annotate_shrink(size_type __old_size) const
|
||||
{
|
||||
__annotate_contiguous_container(data(), data() + capacity(),
|
||||
data() + __old_size, data() + size());
|
||||
}
|
||||
#ifndef _LIBCPP_HAS_NO_ASAN
|
||||
// The annotation for size increase should happen before the actual increase,
|
||||
// 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) {
|
||||
__v.__annotate_increase(__n);
|
||||
}
|
||||
void __done() { __commit = true; }
|
||||
~__RAII_IncreaseAnnotator() {
|
||||
if (__commit) return;
|
||||
__v.__annotate_shrink(__v.size() + __n);
|
||||
}
|
||||
bool __commit;
|
||||
size_type __n;
|
||||
const vector &__v;
|
||||
};
|
||||
#else
|
||||
struct __RAII_IncreaseAnnotator {
|
||||
inline __RAII_IncreaseAnnotator(const vector &, size_type __n = 1) {}
|
||||
inline void __done() {}
|
||||
};
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
@@ -963,12 +982,13 @@ void
|
||||
vector<_Tp, _Allocator>::__construct_at_end(size_type __n)
|
||||
{
|
||||
allocator_type& __a = this->__alloc();
|
||||
__annotate_increase(__n);
|
||||
do
|
||||
{
|
||||
__RAII_IncreaseAnnotator __annotator(*this);
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_));
|
||||
++this->__end_;
|
||||
--__n;
|
||||
__annotator.__done();
|
||||
} while (__n > 0);
|
||||
}
|
||||
|
||||
@@ -984,12 +1004,13 @@ void
|
||||
vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
|
||||
{
|
||||
allocator_type& __a = this->__alloc();
|
||||
__annotate_increase(__n);
|
||||
do
|
||||
{
|
||||
__RAII_IncreaseAnnotator __annotator(*this);
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x);
|
||||
++this->__end_;
|
||||
--__n;
|
||||
__annotator.__done();
|
||||
} while (__n > 0);
|
||||
}
|
||||
|
||||
@@ -1005,22 +1026,9 @@ vector<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIt
|
||||
allocator_type& __a = this->__alloc();
|
||||
for (; __first != __last; ++__first)
|
||||
{
|
||||
__annotate_increase(1);
|
||||
__RAII_IncreaseAnnotator __annotator(*this);
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
|
||||
++this->__end_;
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
vector<_Tp, _Allocator>::__move_construct_at_end(pointer __first, pointer __last)
|
||||
{
|
||||
allocator_type& __a = this->__alloc();
|
||||
for (; __first != __last; ++__first)
|
||||
{
|
||||
__annotate_increase(1);
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_),
|
||||
_VSTD::move(*__first));
|
||||
__annotator.__done();
|
||||
++this->__end_;
|
||||
}
|
||||
}
|
||||
@@ -1582,9 +1590,10 @@ vector<_Tp, _Allocator>::push_back(const_reference __x)
|
||||
{
|
||||
if (this->__end_ != this->__end_cap())
|
||||
{
|
||||
__annotate_increase(1);
|
||||
__RAII_IncreaseAnnotator __annotator(*this);
|
||||
__alloc_traits::construct(this->__alloc(),
|
||||
_VSTD::__to_raw_pointer(this->__end_), __x);
|
||||
__annotator.__done();
|
||||
++this->__end_;
|
||||
}
|
||||
else
|
||||
@@ -1600,10 +1609,11 @@ vector<_Tp, _Allocator>::push_back(value_type&& __x)
|
||||
{
|
||||
if (this->__end_ < this->__end_cap())
|
||||
{
|
||||
__annotate_increase(1);
|
||||
__RAII_IncreaseAnnotator __annotator(*this);
|
||||
__alloc_traits::construct(this->__alloc(),
|
||||
_VSTD::__to_raw_pointer(this->__end_),
|
||||
_VSTD::move(__x));
|
||||
__annotator.__done();
|
||||
++this->__end_;
|
||||
}
|
||||
else
|
||||
@@ -1633,10 +1643,11 @@ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args)
|
||||
{
|
||||
if (this->__end_ < this->__end_cap())
|
||||
{
|
||||
__annotate_increase(1);
|
||||
__RAII_IncreaseAnnotator __annotator(*this);
|
||||
__alloc_traits::construct(this->__alloc(),
|
||||
_VSTD::__to_raw_pointer(this->__end_),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
__annotator.__done();
|
||||
++this->__end_;
|
||||
}
|
||||
else
|
||||
@@ -1716,7 +1727,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x)
|
||||
pointer __p = this->__begin_ + (__position - begin());
|
||||
if (this->__end_ < this->__end_cap())
|
||||
{
|
||||
__annotate_increase(1);
|
||||
__RAII_IncreaseAnnotator __annotator(*this);
|
||||
if (__p == this->__end_)
|
||||
{
|
||||
__alloc_traits::construct(this->__alloc(),
|
||||
@@ -1731,6 +1742,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x)
|
||||
++__xr;
|
||||
*__p = *__xr;
|
||||
}
|
||||
__annotator.__done();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1756,7 +1768,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x)
|
||||
pointer __p = this->__begin_ + (__position - begin());
|
||||
if (this->__end_ < this->__end_cap())
|
||||
{
|
||||
__annotate_increase(1);
|
||||
__RAII_IncreaseAnnotator __annotator(*this);
|
||||
if (__p == this->__end_)
|
||||
{
|
||||
__alloc_traits::construct(this->__alloc(),
|
||||
@@ -1769,6 +1781,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x)
|
||||
__move_range(__p, this->__end_, __p + 1);
|
||||
*__p = _VSTD::move(__x);
|
||||
}
|
||||
__annotator.__done();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1795,7 +1808,7 @@ vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args)
|
||||
pointer __p = this->__begin_ + (__position - begin());
|
||||
if (this->__end_ < this->__end_cap())
|
||||
{
|
||||
__annotate_increase(1);
|
||||
__RAII_IncreaseAnnotator __annotator(*this);
|
||||
if (__p == this->__end_)
|
||||
{
|
||||
__alloc_traits::construct(this->__alloc(),
|
||||
@@ -1809,6 +1822,7 @@ vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args)
|
||||
__move_range(__p, this->__end_, __p + 1);
|
||||
*__p = _VSTD::move(__tmp);
|
||||
}
|
||||
__annotator.__done();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1847,8 +1861,9 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_
|
||||
}
|
||||
if (__n > 0)
|
||||
{
|
||||
__annotate_increase(__n);
|
||||
__RAII_IncreaseAnnotator __annotator(*this, __n);
|
||||
__move_range(__p, __old_last, __p + __old_n);
|
||||
__annotator.__done();
|
||||
const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x);
|
||||
if (__p <= __xr && __xr < this->__end_)
|
||||
__xr += __old_n;
|
||||
@@ -1958,8 +1973,9 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __fi
|
||||
}
|
||||
if (__n > 0)
|
||||
{
|
||||
__annotate_increase(__n);
|
||||
__RAII_IncreaseAnnotator __annotator(*this, __n);
|
||||
__move_range(__p, __old_last, __p + __old_n);
|
||||
__annotator.__done();
|
||||
_VSTD::copy(__first, __m, __p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,23 +36,27 @@ if (DEFINED LIBCXX_CXX_ABI_DEPS)
|
||||
endif()
|
||||
|
||||
# Generate library list.
|
||||
set(libraries ${LIBCXX_CXX_ABI_LIBRARIES})
|
||||
set(libraries ${LIBCXX_CXX_ABI_LIBRARY})
|
||||
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_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()
|
||||
target_link_libraries(cxx ${libraries})
|
||||
|
||||
# Setup flags.
|
||||
append_if(compile_flags LIBCXX_HAS_FPIC_FLAG -fPIC)
|
||||
append_if(link_flags LIBCXX_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)
|
||||
append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_FPIC_FLAG -fPIC)
|
||||
append_if(LIBCXX_LINK_FLAGS LIBCXX_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)
|
||||
|
||||
if ( APPLE )
|
||||
if ( CMAKE_OSX_DEPLOYMENT_TARGET STREQUAL "10.6" )
|
||||
list(APPEND compile_flags "-U__STRICT_ANSI__")
|
||||
list(APPEND link_flags
|
||||
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"
|
||||
@@ -74,7 +78,7 @@ if ( APPLE )
|
||||
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 link_flags
|
||||
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"
|
||||
@@ -84,13 +88,13 @@ if ( APPLE )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
string(REPLACE ";" " " compile_flags "${compile_flags}")
|
||||
string(REPLACE ";" " " link_flags "${link_flags}")
|
||||
string(REPLACE ";" " " LIBCXX_COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}")
|
||||
string(REPLACE ";" " " LIBCXX_LINK_FLAGS "${LIBCXX_LINK_FLAGS}")
|
||||
|
||||
set_target_properties(cxx
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "${compile_flags}"
|
||||
LINK_FLAGS "${link_flags}"
|
||||
COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}"
|
||||
LINK_FLAGS "${LIBCXX_LINK_FLAGS}"
|
||||
OUTPUT_NAME "c++"
|
||||
VERSION "1.0"
|
||||
SOVERSION "1"
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
|
||||
#include "algorithm"
|
||||
#include "random"
|
||||
#include "mutex"
|
||||
@@ -48,12 +47,16 @@ template bool __insertion_sort_incomplete<__less<long double>&, long double*>(lo
|
||||
|
||||
template unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&);
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
static pthread_mutex_t __rs_mut = PTHREAD_MUTEX_INITIALIZER;
|
||||
#endif
|
||||
unsigned __rs_default::__c_ = 0;
|
||||
|
||||
__rs_default::__rs_default()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
pthread_mutex_lock(&__rs_mut);
|
||||
#endif
|
||||
__c_ = 1;
|
||||
}
|
||||
|
||||
@@ -64,8 +67,12 @@ __rs_default::__rs_default(const __rs_default&)
|
||||
|
||||
__rs_default::~__rs_default()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
if (--__c_ == 0)
|
||||
pthread_mutex_unlock(&__rs_mut);
|
||||
#else
|
||||
--__c_;
|
||||
#endif
|
||||
}
|
||||
|
||||
__rs_default::result_type
|
||||
|
||||
@@ -46,6 +46,7 @@ system_clock::from_time_t(time_t t) _NOEXCEPT
|
||||
return system_clock::time_point(seconds(t));
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK
|
||||
// steady_clock
|
||||
|
||||
const bool steady_clock::is_steady;
|
||||
@@ -108,10 +109,8 @@ steady_clock::now() _NOEXCEPT
|
||||
}
|
||||
|
||||
#else // __APPLE__
|
||||
// FIXME: We assume that clock_gettime(CLOCK_MONOTONIC) works on
|
||||
// non-apple systems. Instead, we should check _POSIX_TIMERS and
|
||||
// _POSIX_MONOTONIC_CLOCK and fall back to something else if those
|
||||
// don't exist.
|
||||
// FIXME: if _LIBCPP_HAS_NO_MONOTONIC_CLOCK, then clock_gettime isn't going to
|
||||
// work. It may be possible to fall back on something else, depending on the system.
|
||||
|
||||
// Warning: If this is not truly steady, then it is non-conforming. It is
|
||||
// better for it to not exist and have the rest of libc++ use system_clock
|
||||
@@ -127,6 +126,8 @@ steady_clock::now() _NOEXCEPT
|
||||
}
|
||||
#endif // __APPLE__
|
||||
|
||||
#endif // !_LIBCPP_HAS_NO_MONOTONIC_CLOCK
|
||||
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "__config"
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
|
||||
#include "condition_variable"
|
||||
#include "thread"
|
||||
#include "system_error"
|
||||
@@ -79,3 +83,5 @@ notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk)
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
@@ -35,6 +35,7 @@ __get_const_db()
|
||||
namespace
|
||||
{
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
typedef mutex mutex_type;
|
||||
typedef lock_guard<mutex_type> WLock;
|
||||
typedef lock_guard<mutex_type> RLock;
|
||||
@@ -45,6 +46,7 @@ mut()
|
||||
static mutex_type m;
|
||||
return m;
|
||||
}
|
||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
} // unnamed namespace
|
||||
|
||||
@@ -108,7 +110,9 @@ __libcpp_db::~__libcpp_db()
|
||||
void*
|
||||
__libcpp_db::__find_c_from_i(void* __i) const
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
RLock _(mut());
|
||||
#endif
|
||||
__i_node* i = __find_iterator(__i);
|
||||
_LIBCPP_ASSERT(i != nullptr, "iterator not found in debug database.");
|
||||
return i->__c_ != nullptr ? i->__c_->__c_ : nullptr;
|
||||
@@ -117,7 +121,9 @@ __libcpp_db::__find_c_from_i(void* __i) const
|
||||
void
|
||||
__libcpp_db::__insert_ic(void* __i, const void* __c)
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
WLock _(mut());
|
||||
#endif
|
||||
if (__cbeg_ == __cend_)
|
||||
return;
|
||||
size_t hc = hash<const void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
|
||||
@@ -138,7 +144,9 @@ __libcpp_db::__insert_ic(void* __i, const void* __c)
|
||||
__c_node*
|
||||
__libcpp_db::__insert_c(void* __c)
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
WLock _(mut());
|
||||
#endif
|
||||
if (__csz_ + 1 > static_cast<size_t>(__cend_ - __cbeg_))
|
||||
{
|
||||
size_t nc = __next_prime(2*static_cast<size_t>(__cend_ - __cbeg_) + 1);
|
||||
@@ -184,7 +192,9 @@ __libcpp_db::__insert_c(void* __c)
|
||||
void
|
||||
__libcpp_db::__erase_i(void* __i)
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
WLock _(mut());
|
||||
#endif
|
||||
if (__ibeg_ != __iend_)
|
||||
{
|
||||
size_t hi = hash<void*>()(__i) % static_cast<size_t>(__iend_ - __ibeg_);
|
||||
@@ -215,7 +225,9 @@ __libcpp_db::__erase_i(void* __i)
|
||||
void
|
||||
__libcpp_db::__invalidate_all(void* __c)
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
WLock _(mut());
|
||||
#endif
|
||||
if (__cend_ != __cbeg_)
|
||||
{
|
||||
size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
|
||||
@@ -239,17 +251,23 @@ __libcpp_db::__invalidate_all(void* __c)
|
||||
__c_node*
|
||||
__libcpp_db::__find_c_and_lock(void* __c) const
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
mut().lock();
|
||||
#endif
|
||||
if (__cend_ == __cbeg_)
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
mut().unlock();
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
|
||||
__c_node* p = __cbeg_[hc];
|
||||
if (p == nullptr)
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
mut().unlock();
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
while (p->__c_ != __c)
|
||||
@@ -257,7 +275,9 @@ __libcpp_db::__find_c_and_lock(void* __c) const
|
||||
p = p->__next_;
|
||||
if (p == nullptr)
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
mut().unlock();
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@@ -281,13 +301,17 @@ __libcpp_db::__find_c(void* __c) const
|
||||
void
|
||||
__libcpp_db::unlock() const
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
mut().unlock();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
__libcpp_db::__erase_c(void* __c)
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
WLock _(mut());
|
||||
#endif
|
||||
if (__cend_ != __cbeg_)
|
||||
{
|
||||
size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
|
||||
@@ -322,7 +346,9 @@ __libcpp_db::__erase_c(void* __c)
|
||||
void
|
||||
__libcpp_db::__iterator_copy(void* __i, const void* __i0)
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
WLock _(mut());
|
||||
#endif
|
||||
__i_node* i = __find_iterator(__i);
|
||||
__i_node* i0 = __find_iterator(__i0);
|
||||
__c_node* c0 = i0 != nullptr ? i0->__c_ : nullptr;
|
||||
@@ -348,7 +374,9 @@ __libcpp_db::__iterator_copy(void* __i, const void* __i0)
|
||||
bool
|
||||
__libcpp_db::__dereferenceable(const void* __i) const
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
RLock _(mut());
|
||||
#endif
|
||||
__i_node* i = __find_iterator(__i);
|
||||
return i != nullptr && i->__c_ != nullptr && i->__c_->__dereferenceable(__i);
|
||||
}
|
||||
@@ -356,7 +384,9 @@ __libcpp_db::__dereferenceable(const void* __i) const
|
||||
bool
|
||||
__libcpp_db::__decrementable(const void* __i) const
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
RLock _(mut());
|
||||
#endif
|
||||
__i_node* i = __find_iterator(__i);
|
||||
return i != nullptr && i->__c_ != nullptr && i->__c_->__decrementable(__i);
|
||||
}
|
||||
@@ -364,7 +394,9 @@ __libcpp_db::__decrementable(const void* __i) const
|
||||
bool
|
||||
__libcpp_db::__addable(const void* __i, ptrdiff_t __n) const
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
RLock _(mut());
|
||||
#endif
|
||||
__i_node* i = __find_iterator(__i);
|
||||
return i != nullptr && i->__c_ != nullptr && i->__c_->__addable(__i, __n);
|
||||
}
|
||||
@@ -372,7 +404,9 @@ __libcpp_db::__addable(const void* __i, ptrdiff_t __n) const
|
||||
bool
|
||||
__libcpp_db::__subscriptable(const void* __i, ptrdiff_t __n) const
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
RLock _(mut());
|
||||
#endif
|
||||
__i_node* i = __find_iterator(__i);
|
||||
return i != nullptr && i->__c_ != nullptr && i->__c_->__subscriptable(__i, __n);
|
||||
}
|
||||
@@ -380,7 +414,9 @@ __libcpp_db::__subscriptable(const void* __i, ptrdiff_t __n) const
|
||||
bool
|
||||
__libcpp_db::__less_than_comparable(const void* __i, const void* __j) const
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
RLock _(mut());
|
||||
#endif
|
||||
__i_node* i = __find_iterator(__i);
|
||||
__i_node* j = __find_iterator(__j);
|
||||
__c_node* ci = i != nullptr ? i->__c_ : nullptr;
|
||||
@@ -391,7 +427,9 @@ __libcpp_db::__less_than_comparable(const void* __i, const void* __j) const
|
||||
void
|
||||
__libcpp_db::swap(void* c1, void* c2)
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
WLock _(mut());
|
||||
#endif
|
||||
size_t hc = hash<void*>()(c1) % static_cast<size_t>(__cend_ - __cbeg_);
|
||||
__c_node* p1 = __cbeg_[hc];
|
||||
_LIBCPP_ASSERT(p1 != nullptr, "debug mode internal logic error swap A");
|
||||
@@ -420,7 +458,9 @@ __libcpp_db::swap(void* c1, void* c2)
|
||||
void
|
||||
__libcpp_db::__insert_i(void* __i)
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
WLock _(mut());
|
||||
#endif
|
||||
__insert_iterator(__i);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#define __has_include(inc) 0
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#if defined(__APPLE__) && !defined(LIBCXXRT)
|
||||
#include <cxxabi.h>
|
||||
|
||||
using namespace __cxxabiv1;
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "__config"
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
|
||||
#include "future"
|
||||
#include "string"
|
||||
|
||||
@@ -298,3 +302,5 @@ shared_future<void>::operator=(const shared_future& __rhs)
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
63
src/ios.cpp
63
src/ios.cpp
@@ -7,8 +7,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
|
||||
|
||||
#include "__config"
|
||||
#include "ios"
|
||||
#include "streambuf"
|
||||
#include "istream"
|
||||
@@ -54,11 +53,9 @@ string
|
||||
__iostream_category::message(int ev) const
|
||||
{
|
||||
if (ev != static_cast<int>(io_errc::stream)
|
||||
#ifdef ELAST
|
||||
&& ev <= ELAST
|
||||
#elif defined(__linux__)
|
||||
&& ev <= 4095
|
||||
#endif // ELAST
|
||||
#ifdef _LIBCPP_ELAST
|
||||
&& ev <= _LIBCPP_ELAST
|
||||
#endif // _LIBCPP_ELAST
|
||||
)
|
||||
return __do_message::message(ev);
|
||||
return string("unspecified iostream_category error");
|
||||
@@ -151,12 +148,22 @@ ios_base::getloc() const
|
||||
}
|
||||
|
||||
// xalloc
|
||||
#if __has_feature(cxx_atomic)
|
||||
#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
|
||||
atomic<int> ios_base::__xindex_ = ATOMIC_VAR_INIT(0);
|
||||
#else
|
||||
int ios_base::__xindex_ = 0;
|
||||
#endif
|
||||
|
||||
template <typename _Tp>
|
||||
static size_t __ios_new_cap(size_t __req_size, size_t __current_cap)
|
||||
{ // Precondition: __req_size > __current_cap
|
||||
const size_t mx = std::numeric_limits<size_t>::max() / sizeof(_Tp);
|
||||
if (__req_size < mx/2)
|
||||
return _VSTD::max(2 * __current_cap, __req_size);
|
||||
else
|
||||
return mx;
|
||||
}
|
||||
|
||||
int
|
||||
ios_base::xalloc()
|
||||
{
|
||||
@@ -169,14 +176,8 @@ ios_base::iword(int index)
|
||||
size_t req_size = static_cast<size_t>(index)+1;
|
||||
if (req_size > __iarray_cap_)
|
||||
{
|
||||
size_t newcap;
|
||||
const size_t mx = std::numeric_limits<size_t>::max();
|
||||
if (req_size < mx/2)
|
||||
newcap = _VSTD::max(2 * __iarray_cap_, req_size);
|
||||
else
|
||||
newcap = mx;
|
||||
size_t newsize = newcap * sizeof(long);
|
||||
long* iarray = static_cast<long*>(realloc(__iarray_, newsize));
|
||||
size_t newcap = __ios_new_cap<long>(req_size, __iarray_cap_);
|
||||
long* iarray = static_cast<long*>(realloc(__iarray_, newcap * sizeof(long)));
|
||||
if (iarray == 0)
|
||||
{
|
||||
setstate(badbit);
|
||||
@@ -185,8 +186,9 @@ ios_base::iword(int index)
|
||||
return error;
|
||||
}
|
||||
__iarray_ = iarray;
|
||||
for (long* p = __iarray_ + __iarray_size_; __iarray_cap_ < newcap; ++__iarray_cap_, ++p)
|
||||
for (long* p = __iarray_ + __iarray_size_; p < __iarray_ + newcap; ++p)
|
||||
*p = 0;
|
||||
__iarray_cap_ = newcap;
|
||||
}
|
||||
__iarray_size_ = max<size_t>(__iarray_size_, req_size);
|
||||
return __iarray_[index];
|
||||
@@ -198,14 +200,8 @@ ios_base::pword(int index)
|
||||
size_t req_size = static_cast<size_t>(index)+1;
|
||||
if (req_size > __parray_cap_)
|
||||
{
|
||||
size_t newcap;
|
||||
const size_t mx = std::numeric_limits<size_t>::max();
|
||||
if (req_size < mx/2)
|
||||
newcap = _VSTD::max(2 * __parray_cap_, req_size);
|
||||
else
|
||||
newcap = mx;
|
||||
size_t newsize = newcap * sizeof(void*);
|
||||
void** parray = static_cast<void**>(realloc(__parray_, newsize));
|
||||
size_t newcap = __ios_new_cap<void *>(req_size, __iarray_cap_);
|
||||
void** parray = static_cast<void**>(realloc(__parray_, newcap * sizeof(void *)));
|
||||
if (parray == 0)
|
||||
{
|
||||
setstate(badbit);
|
||||
@@ -214,8 +210,9 @@ ios_base::pword(int index)
|
||||
return error;
|
||||
}
|
||||
__parray_ = parray;
|
||||
for (void** p = __parray_ + __parray_size_; __parray_cap_ < newcap; ++__parray_cap_, ++p)
|
||||
for (void** p = __parray_ + __parray_size_; p < __parray_ + newcap; ++p)
|
||||
*p = 0;
|
||||
__parray_cap_ = newcap;
|
||||
}
|
||||
__parray_size_ = max<size_t>(__parray_size_, req_size);
|
||||
return __parray_[index];
|
||||
@@ -229,22 +226,16 @@ ios_base::register_callback(event_callback fn, int index)
|
||||
size_t req_size = __event_size_ + 1;
|
||||
if (req_size > __event_cap_)
|
||||
{
|
||||
size_t newcap;
|
||||
const size_t mx = std::numeric_limits<size_t>::max();
|
||||
if (req_size < mx/2)
|
||||
newcap = _VSTD::max(2 * __event_cap_, req_size);
|
||||
else
|
||||
newcap = mx;
|
||||
size_t newesize = newcap * sizeof(event_callback);
|
||||
event_callback* fns = static_cast<event_callback*>(realloc(__fn_, newesize));
|
||||
size_t newcap = __ios_new_cap<event_callback>(req_size, __event_cap_);
|
||||
event_callback* fns = static_cast<event_callback*>(realloc(__fn_, newcap * sizeof(event_callback)));
|
||||
if (fns == 0)
|
||||
setstate(badbit);
|
||||
__fn_ = fns;
|
||||
size_t newisize = newcap * sizeof(int);
|
||||
int* indxs = static_cast<int *>(realloc(__index_, newisize));
|
||||
int* indxs = static_cast<int *>(realloc(__index_, newcap * sizeof(int)));
|
||||
if (indxs == 0)
|
||||
setstate(badbit);
|
||||
__index_ = indxs;
|
||||
__event_cap_ = newcap;
|
||||
}
|
||||
__fn_[__event_size_] = fn;
|
||||
__index_[__event_size_] = index;
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
|
||||
|
||||
// On Solaris, we need to define something to make the C99 parts of localeconv
|
||||
// visible.
|
||||
#ifdef __sun__
|
||||
|
||||
@@ -9,8 +9,10 @@
|
||||
|
||||
#define _LIBCPP_BUILDING_MEMORY
|
||||
#include "memory"
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
#include "mutex"
|
||||
#include "thread"
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -109,7 +111,7 @@ __shared_weak_count::lock() _NOEXCEPT
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(_LIBCPP_NO_RTTI) || !defined(_LIBCPP_BUILD_STATIC)
|
||||
#ifndef _LIBCPP_NO_RTTI
|
||||
|
||||
const void*
|
||||
__shared_weak_count::__get_deleter(const type_info&) const _NOEXCEPT
|
||||
@@ -117,9 +119,9 @@ __shared_weak_count::__get_deleter(const type_info&) const _NOEXCEPT
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // !defined(_LIBCPP_NO_RTTI) || !defined(_LIBCPP_BUILD_STATIC)
|
||||
#endif // _LIBCPP_NO_RTTI
|
||||
|
||||
#if __has_feature(cxx_atomic)
|
||||
#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
|
||||
|
||||
static const std::size_t __sp_mut_count = 16;
|
||||
static pthread_mutex_t mut_back_imp[__sp_mut_count] =
|
||||
@@ -172,7 +174,7 @@ __get_sp_mut(const void* p)
|
||||
return muts[hash<const void*>()(p) & (__sp_mut_count-1)];
|
||||
}
|
||||
|
||||
#endif // __has_feature(cxx_atomic)
|
||||
#endif // __has_feature(cxx_atomic) && !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
void
|
||||
declare_reachable(void*)
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "cassert"
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
|
||||
const defer_lock_t defer_lock = {};
|
||||
const try_to_lock_t try_to_lock = {};
|
||||
@@ -206,18 +207,42 @@ recursive_timed_mutex::unlock() _NOEXCEPT
|
||||
}
|
||||
}
|
||||
|
||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
// If dispatch_once_f ever handles C++ exceptions, and if one can get to it
|
||||
// without illegal macros (unexpected macros not beginning with _UpperCase or
|
||||
// __lowercase), and if it stops spinning waiting threads, then call_once should
|
||||
// call into dispatch_once_f instead of here. Relevant radar this code needs to
|
||||
// keep in sync with: 7741191.
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
|
||||
static pthread_cond_t cv = PTHREAD_COND_INITIALIZER;
|
||||
#endif
|
||||
|
||||
void
|
||||
__call_once(volatile unsigned long& flag, void* arg, void(*func)(void*))
|
||||
{
|
||||
#if defined(_LIBCPP_HAS_NO_THREADS)
|
||||
if (flag == 0)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
flag = 1;
|
||||
func(arg);
|
||||
flag = ~0ul;
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
flag = 0ul;
|
||||
throw;
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
#else // !_LIBCPP_HAS_NO_THREADS
|
||||
pthread_mutex_lock(&mut);
|
||||
while (flag == 1)
|
||||
pthread_cond_wait(&cv, &mut);
|
||||
@@ -248,6 +273,8 @@ __call_once(volatile unsigned long& flag, void* arg, void(*func)(void*))
|
||||
}
|
||||
else
|
||||
pthread_mutex_unlock(&mut);
|
||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
18
src/new.cpp
18
src/new.cpp
@@ -17,7 +17,7 @@
|
||||
#define __has_include(inc) 0
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#if defined(__APPLE__) && !defined(LIBCXXRT)
|
||||
#include <cxxabi.h>
|
||||
|
||||
#ifndef _LIBCPPABI_VERSION
|
||||
@@ -192,8 +192,6 @@ bad_alloc::what() const _NOEXCEPT
|
||||
|
||||
#endif // !__GLIBCXX__
|
||||
|
||||
#endif //LIBCXXRT
|
||||
|
||||
bad_array_new_length::bad_array_new_length() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
@@ -202,6 +200,14 @@ bad_array_new_length::~bad_array_new_length() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
const char*
|
||||
bad_array_new_length::what() const _NOEXCEPT
|
||||
{
|
||||
return "bad_array_new_length";
|
||||
}
|
||||
|
||||
#endif //LIBCXXRT
|
||||
|
||||
const char*
|
||||
bad_array_length::what() const _NOEXCEPT
|
||||
{
|
||||
@@ -216,12 +222,6 @@ bad_array_length::~bad_array_length() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
const char*
|
||||
bad_array_new_length::what() const _NOEXCEPT
|
||||
{
|
||||
return "bad_array_new_length";
|
||||
}
|
||||
|
||||
#endif // _LIBCPPABI_VERSION
|
||||
|
||||
#ifndef LIBSTDCXX
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "__config"
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
|
||||
#define _LIBCPP_BUILDING_SHARED_MUTEX
|
||||
#include "shared_mutex"
|
||||
|
||||
@@ -99,3 +102,5 @@ shared_timed_mutex::unlock_shared()
|
||||
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
|
||||
|
||||
#include "string"
|
||||
#include "cstdlib"
|
||||
#include "cwchar"
|
||||
@@ -65,7 +63,7 @@ inline
|
||||
V
|
||||
as_integer_helper(const string& func, const S& str, size_t* idx, int base, F f)
|
||||
{
|
||||
typename S::value_type* ptr;
|
||||
typename S::value_type* ptr = nullptr;
|
||||
const typename S::value_type* const p = str.c_str();
|
||||
typename remove_reference<decltype(errno)>::type errno_save = errno;
|
||||
errno = 0;
|
||||
@@ -182,7 +180,7 @@ inline
|
||||
V
|
||||
as_float_helper(const string& func, const S& str, size_t* idx, F f )
|
||||
{
|
||||
typename S::value_type* ptr;
|
||||
typename S::value_type* ptr = nullptr;
|
||||
const typename S::value_type* const p = str.c_str();
|
||||
typename remove_reference<decltype(errno)>::type errno_save = errno;
|
||||
errno = 0;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define _LIBCPP_BUILDING_SYSTEM_ERROR
|
||||
#include "__config"
|
||||
#include "system_error"
|
||||
#include "string"
|
||||
#include "cstring"
|
||||
@@ -65,13 +66,10 @@ __generic_error_category::name() const _NOEXCEPT
|
||||
string
|
||||
__generic_error_category::message(int ev) const
|
||||
{
|
||||
#ifdef ELAST
|
||||
if (ev > ELAST)
|
||||
#ifdef _LIBCPP_ELAST
|
||||
if (ev > _LIBCPP_ELAST)
|
||||
return string("unspecified generic_category error");
|
||||
#elif defined(__linux__)
|
||||
if (ev > 4095)
|
||||
return string("unspecified generic_category error");
|
||||
#endif // ELAST
|
||||
#endif // _LIBCPP_ELAST
|
||||
return __do_message::message(ev);
|
||||
}
|
||||
|
||||
@@ -100,26 +98,20 @@ __system_error_category::name() const _NOEXCEPT
|
||||
string
|
||||
__system_error_category::message(int ev) const
|
||||
{
|
||||
#ifdef ELAST
|
||||
if (ev > ELAST)
|
||||
#ifdef _LIBCPP_ELAST
|
||||
if (ev > _LIBCPP_ELAST)
|
||||
return string("unspecified system_category error");
|
||||
#elif defined(__linux__)
|
||||
if (ev > 4095)
|
||||
return string("unspecified system_category error");
|
||||
#endif // ELAST
|
||||
#endif // _LIBCPP_ELAST
|
||||
return __do_message::message(ev);
|
||||
}
|
||||
|
||||
error_condition
|
||||
__system_error_category::default_error_condition(int ev) const _NOEXCEPT
|
||||
{
|
||||
#ifdef ELAST
|
||||
if (ev > ELAST)
|
||||
#ifdef _LIBCPP_ELAST
|
||||
if (ev > _LIBCPP_ELAST)
|
||||
return error_condition(ev, system_category());
|
||||
#elif defined(__linux__)
|
||||
if (ev > 4095)
|
||||
return error_condition(ev, system_category());
|
||||
#endif // ELAST
|
||||
#endif // _LIBCPP_ELAST
|
||||
return error_condition(ev, generic_category());
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "__config"
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
|
||||
#include "thread"
|
||||
#include "exception"
|
||||
#include "vector"
|
||||
@@ -225,3 +228,5 @@ __thread_struct::__make_ready_at_thread_exit(__assoc_sub_state* __s)
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
|
||||
|
||||
#include "valarray"
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -28,31 +28,26 @@ int main()
|
||||
int ia[] = {0, 1, 2, 2, 0, 1, 2, 3};
|
||||
const unsigned sa = sizeof(ia)/sizeof(ia[0]);
|
||||
int ib[] = {0, 1, 2, 3, 0, 1, 2, 3};
|
||||
assert(std::mismatch(input_iterator<const int*>(ia),
|
||||
input_iterator<const int*>(ia + sa),
|
||||
input_iterator<const int*>(ib)) ==
|
||||
(std::pair<input_iterator<const int*>,
|
||||
input_iterator<const int*> >(
|
||||
input_iterator<const int*>(ia+3),
|
||||
input_iterator<const int*>(ib+3))));
|
||||
const unsigned sb = sizeof(ib)/sizeof(ib[0]);
|
||||
|
||||
typedef input_iterator<const int*> II;
|
||||
typedef random_access_iterator<const int*> RAI;
|
||||
|
||||
assert(std::mismatch(II(ia), II(ia + sa), II(ib))
|
||||
== (std::pair<II, II>(II(ia+3), II(ib+3))));
|
||||
|
||||
assert(std::mismatch(RAI(ia), RAI(ia + sa), RAI(ib))
|
||||
== (std::pair<RAI, RAI>(RAI(ia+3), RAI(ib+3))));
|
||||
|
||||
#ifdef HAS_FOUR_ITERATOR_VERSION
|
||||
assert(std::mismatch(input_iterator<const int*>(ia),
|
||||
input_iterator<const int*>(ia + sa),
|
||||
input_iterator<const int*>(ib),
|
||||
input_iterator<const int*>(ib + sa)) ==
|
||||
(std::pair<input_iterator<const int*>,
|
||||
input_iterator<const int*> >(
|
||||
input_iterator<const int*>(ia+3),
|
||||
input_iterator<const int*>(ib+3))));
|
||||
assert(std::mismatch(II(ia), II(ia + sa), II(ib), II(ib+sb))
|
||||
== (std::pair<II, II>(II(ia+3), II(ib+3))));
|
||||
|
||||
assert(std::mismatch(input_iterator<const int*>(ia),
|
||||
input_iterator<const int*>(ia + sa),
|
||||
input_iterator<const int*>(ib),
|
||||
input_iterator<const int*>(ib + 2)) ==
|
||||
(std::pair<input_iterator<const int*>,
|
||||
input_iterator<const int*> >(
|
||||
input_iterator<const int*>(ia+2),
|
||||
input_iterator<const int*>(ib+2))));
|
||||
assert(std::mismatch(RAI(ia), RAI(ia + sa), RAI(ib), RAI(ib+sb))
|
||||
== (std::pair<RAI, RAI>(RAI(ia+3), RAI(ib+3))));
|
||||
|
||||
|
||||
assert(std::mismatch(II(ia), II(ia + sa), II(ib), II(ib+2))
|
||||
== (std::pair<II, II>(II(ia+2), II(ib+2))));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -20,43 +20,52 @@
|
||||
#include <cassert>
|
||||
|
||||
#include "test_iterators.h"
|
||||
#include "counting_predicates.hpp"
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
#define HAS_FOUR_ITERATOR_VERSION
|
||||
#endif
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
int ia[] = {0, 1, 2, 2, 0, 1, 2, 3};
|
||||
const unsigned sa = sizeof(ia)/sizeof(ia[0]);
|
||||
int ib[] = {0, 1, 2, 3, 0, 1, 2, 3};
|
||||
assert(std::mismatch(input_iterator<const int*>(ia),
|
||||
input_iterator<const int*>(ia + sa),
|
||||
input_iterator<const int*>(ib),
|
||||
std::equal_to<int>()) ==
|
||||
(std::pair<input_iterator<const int*>,
|
||||
input_iterator<const int*> >(
|
||||
input_iterator<const int*>(ia+3),
|
||||
input_iterator<const int*>(ib+3))));
|
||||
const unsigned sb = sizeof(ib)/sizeof(ib[0]);
|
||||
|
||||
typedef input_iterator<const int*> II;
|
||||
typedef random_access_iterator<const int*> RAI;
|
||||
typedef std::equal_to<int> EQ;
|
||||
|
||||
assert(std::mismatch(II(ia), II(ia + sa), II(ib), EQ())
|
||||
== (std::pair<II, II>(II(ia+3), II(ib+3))));
|
||||
assert(std::mismatch(RAI(ia), RAI(ia + sa), RAI(ib), EQ())
|
||||
== (std::pair<RAI, RAI>(RAI(ia+3), RAI(ib+3))));
|
||||
|
||||
binary_counting_predicate<EQ, int> bcp((EQ()));
|
||||
assert(std::mismatch(RAI(ia), RAI(ia + sa), RAI(ib), std::ref(bcp))
|
||||
== (std::pair<RAI, RAI>(RAI(ia+3), RAI(ib+3))));
|
||||
assert(bcp.count() > 0 && bcp.count() < sa);
|
||||
bcp.reset();
|
||||
|
||||
#ifdef HAS_FOUR_ITERATOR_VERSION
|
||||
assert(std::mismatch(input_iterator<const int*>(ia),
|
||||
input_iterator<const int*>(ia + sa),
|
||||
input_iterator<const int*>(ib),
|
||||
input_iterator<const int*>(ib + sa),
|
||||
std::equal_to<int>()) ==
|
||||
(std::pair<input_iterator<const int*>,
|
||||
input_iterator<const int*> >(
|
||||
input_iterator<const int*>(ia+3),
|
||||
input_iterator<const int*>(ib+3))));
|
||||
assert(std::mismatch(II(ia), II(ia + sa), II(ib), II(ib + sb), EQ())
|
||||
== (std::pair<II, II>(II(ia+3), II(ib+3))));
|
||||
assert(std::mismatch(RAI(ia), RAI(ia + sa), RAI(ib), RAI(ib + sb), EQ())
|
||||
== (std::pair<RAI, RAI>(RAI(ia+3), RAI(ib+3))));
|
||||
|
||||
assert(std::mismatch(II(ia), II(ia + sa), II(ib), II(ib + sb), std::ref(bcp))
|
||||
== (std::pair<II, II>(II(ia+3), II(ib+3))));
|
||||
assert(bcp.count() > 0 && bcp.count() < std::min(sa, sb));
|
||||
#endif
|
||||
|
||||
assert(std::mismatch(ia, ia + sa, ib, std::equal_to<int>()) ==
|
||||
assert(std::mismatch(ia, ia + sa, ib, EQ()) ==
|
||||
(std::pair<int*,int*>(ia+3,ib+3)));
|
||||
|
||||
#ifdef HAS_FOUR_ITERATOR_VERSION
|
||||
assert(std::mismatch(ia, ia + sa, ib, ib + sa, std::equal_to<int>()) ==
|
||||
assert(std::mismatch(ia, ia + sa, ib, ib + sb, EQ()) ==
|
||||
(std::pair<int*,int*>(ia+3,ib+3)));
|
||||
assert(std::mismatch(ia, ia + sa, ib, ib + 2, std::equal_to<int>()) ==
|
||||
assert(std::mismatch(ia, ia + sa, ib, ib + 2, EQ()) ==
|
||||
(std::pair<int*,int*>(ia+2,ib+2)));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <atomic>
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <atomic>
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <atomic>
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <atomic>
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <atomic>
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <atomic>
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <atomic>
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <atomic>
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <atomic>
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <atomic>
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <atomic>
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <atomic>
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <atomic>
|
||||
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// ... test case crashes clang.
|
||||
|
||||
// <atomic>
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <atomic>
|
||||
|
||||
@@ -66,6 +68,7 @@ int main()
|
||||
std::atomic_init(&obj, true);
|
||||
assert(obj == true);
|
||||
bool b0 = obj.is_lock_free();
|
||||
(void)b0; // to placate scan-build
|
||||
obj.store(false);
|
||||
assert(obj == false);
|
||||
obj.store(true, std::memory_order_release);
|
||||
@@ -121,6 +124,7 @@ int main()
|
||||
std::atomic_init(&obj, true);
|
||||
assert(obj == true);
|
||||
bool b0 = obj.is_lock_free();
|
||||
(void)b0; // to placate scan-build
|
||||
obj.store(false);
|
||||
assert(obj == false);
|
||||
obj.store(true, std::memory_order_release);
|
||||
@@ -176,6 +180,7 @@ int main()
|
||||
std::atomic_init(&obj, true);
|
||||
assert(obj == true);
|
||||
bool b0 = obj.is_lock_free();
|
||||
(void)b0; // to placate scan-build
|
||||
obj.store(false);
|
||||
assert(obj == false);
|
||||
obj.store(true, std::memory_order_release);
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <atomic>
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <atomic>
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <atomic>
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <atomic>
|
||||
|
||||
@@ -47,9 +49,6 @@
|
||||
// T operator=(T) noexcept;
|
||||
// };
|
||||
|
||||
// Android's clang isn't new enough to have the fix for this test.
|
||||
// XFAIL: android
|
||||
|
||||
#include <atomic>
|
||||
#include <new>
|
||||
#include <cassert>
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// ... assertion fails line 34
|
||||
|
||||
// <atomic>
|
||||
|
||||
@@ -55,7 +58,7 @@ struct A
|
||||
{
|
||||
int i;
|
||||
|
||||
explicit A(int d = 0) : i(d) {}
|
||||
explicit A(int d = 0) noexcept {i=d;}
|
||||
|
||||
friend bool operator==(const A& x, const A& y)
|
||||
{return x.i == y.i;}
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// ... assertion fails line 38
|
||||
|
||||
// <atomic>
|
||||
|
||||
@@ -62,7 +65,7 @@ struct A
|
||||
{
|
||||
int i;
|
||||
|
||||
explicit A(int d = 0) : i(d) {}
|
||||
explicit A(int d = 0) noexcept {i=d;}
|
||||
|
||||
friend bool operator==(const A& x, const A& y)
|
||||
{return x.i == y.i;}
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// ... assertion fails line 34
|
||||
|
||||
// <atomic>
|
||||
|
||||
@@ -57,7 +60,7 @@ struct A
|
||||
{
|
||||
int i;
|
||||
|
||||
explicit A(int d = 0) : i(d) {}
|
||||
explicit A(int d = 0) noexcept {i=d;}
|
||||
|
||||
friend bool operator==(const A& x, const A& y)
|
||||
{return x.i == y.i;}
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// ... assertion fails line 38
|
||||
|
||||
// <atomic>
|
||||
|
||||
@@ -64,7 +67,7 @@ struct A
|
||||
{
|
||||
int i;
|
||||
|
||||
explicit A(int d = 0) : i(d) {}
|
||||
explicit A(int d = 0) noexcept {i=d;}
|
||||
|
||||
friend bool operator==(const A& x, const A& y)
|
||||
{return x.i == y.i;}
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// ... fails assertion line 31
|
||||
|
||||
// <atomic>
|
||||
|
||||
@@ -40,7 +43,7 @@ struct A
|
||||
{
|
||||
int i;
|
||||
|
||||
explicit A(int d = 0) : i(d) {}
|
||||
explicit A(int d = 0) noexcept {i=d;}
|
||||
|
||||
friend bool operator==(const A& x, const A& y)
|
||||
{return x.i == y.i;}
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// ... assertion fails line 32
|
||||
|
||||
// <atomic>
|
||||
|
||||
@@ -42,7 +45,7 @@ struct A
|
||||
{
|
||||
int i;
|
||||
|
||||
explicit A(int d = 0) : i(d) {}
|
||||
explicit A(int d = 0) noexcept {i=d;}
|
||||
|
||||
friend bool operator==(const A& x, const A& y)
|
||||
{return x.i == y.i;}
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// ... test crashes clang
|
||||
|
||||
// <atomic>
|
||||
|
||||
@@ -75,7 +78,7 @@ struct A
|
||||
{
|
||||
int i;
|
||||
|
||||
explicit A(int d = 0) : i(d) {}
|
||||
explicit A(int d = 0) noexcept {i=d;}
|
||||
A(const A& a) : i(a.i) {}
|
||||
A(const volatile A& a) : i(a.i) {}
|
||||
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// ... test crashes clang
|
||||
|
||||
// <atomic>
|
||||
|
||||
@@ -79,7 +82,7 @@ struct A
|
||||
{
|
||||
int i;
|
||||
|
||||
explicit A(int d = 0) : i(d) {}
|
||||
explicit A(int d = 0) noexcept {i=d;}
|
||||
A(const A& a) : i(a.i) {}
|
||||
A(const volatile A& a) : i(a.i) {}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <atomic>
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <atomic>
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <atomic>
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <atomic>
|
||||
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// ... test crashes clang
|
||||
|
||||
// <atomic>
|
||||
|
||||
@@ -75,7 +78,7 @@ struct A
|
||||
{
|
||||
int i;
|
||||
|
||||
explicit A(int d = 0) : i(d) {}
|
||||
explicit A(int d = 0) noexcept {i=d;}
|
||||
A(const A& a) : i(a.i) {}
|
||||
A(const volatile A& a) : i(a.i) {}
|
||||
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// ... test crashes clang
|
||||
|
||||
// <atomic>
|
||||
|
||||
@@ -80,7 +83,7 @@ struct A
|
||||
{
|
||||
int i;
|
||||
|
||||
explicit A(int d = 0) : i(d) {}
|
||||
explicit A(int d = 0) noexcept {i=d;}
|
||||
A(const A& a) : i(a.i) {}
|
||||
A(const volatile A& a) : i(a.i) {}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <atomic>
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <atomic>
|
||||
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// ... assertion fails line 34
|
||||
|
||||
// <atomic>
|
||||
|
||||
@@ -38,7 +41,7 @@ struct A
|
||||
{
|
||||
int i;
|
||||
|
||||
explicit A(int d = 0) : i(d) {}
|
||||
explicit A(int d = 0) noexcept {i=d;}
|
||||
|
||||
friend bool operator==(const A& x, const A& y)
|
||||
{return x.i == y.i;}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user