Compare commits
216 Commits
svn-tags/l
...
svn-tags/l
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
341499c4bd | ||
|
|
3006f595eb | ||
|
|
84fd172cd6 | ||
|
|
9b3829cb5b | ||
|
|
da9c0f1fba | ||
|
|
a9ad2ca8bd | ||
|
|
8ffa5d58e0 | ||
|
|
791e11cf33 | ||
|
|
4d933b2b44 | ||
|
|
4f598034d2 | ||
|
|
fa06d75e8d | ||
|
|
2644a7b3da | ||
|
|
099084d52f | ||
|
|
b3296ae5bc | ||
|
|
bf6666f7a0 | ||
|
|
541cb301a1 | ||
|
|
13aaf422e4 | ||
|
|
e6440c6fa2 | ||
|
|
737a351850 | ||
|
|
2d81f3d1f3 | ||
|
|
464aa5cad3 | ||
|
|
bcbbd4d14f | ||
|
|
9a2078137f | ||
|
|
a78264f872 | ||
|
|
f3907e6cc0 | ||
|
|
912012e949 | ||
|
|
22ba71b8ef | ||
|
|
8d75632ad0 | ||
|
|
c97da3a590 | ||
|
|
0389c53f44 | ||
|
|
66f2641ac9 | ||
|
|
2bf1c08510 | ||
|
|
6f0342cf2e | ||
|
|
e59f724f79 | ||
|
|
62a6ac33a2 | ||
|
|
043fe1d931 | ||
|
|
cb05a0801a | ||
|
|
ac6de546bd | ||
|
|
12c3d374a5 | ||
|
|
9f66bffdbe | ||
|
|
3c8894b078 | ||
|
|
f03c3b4612 | ||
|
|
90d7785eba | ||
|
|
74248888ab | ||
|
|
61aa6013c3 | ||
|
|
0949eedbd6 | ||
|
|
d318d49e5c | ||
|
|
a2a08b43ee | ||
|
|
35d2fcfc8e | ||
|
|
f5d76a7afc | ||
|
|
7604fea08c | ||
|
|
d4b957820c | ||
|
|
2b1b2d40d7 | ||
|
|
8f5f2563aa | ||
|
|
c7c3891199 | ||
|
|
c28dbeee52 | ||
|
|
58cd8231d8 | ||
|
|
6a09441022 | ||
|
|
04dae1df22 | ||
|
|
5f2f14c5d2 | ||
|
|
8b53768dac | ||
|
|
b2e2a8f6f3 | ||
|
|
7686add61e | ||
|
|
d1d27a4afa | ||
|
|
53f7d4cc62 | ||
|
|
c560727d5e | ||
|
|
b965fed10b | ||
|
|
009b2c4583 | ||
|
|
93f2764b16 | ||
|
|
18884f4e9f | ||
|
|
0a612b0891 | ||
|
|
8790cabd86 | ||
|
|
a12beb35e5 | ||
|
|
aabf28721b | ||
|
|
d737382dfd | ||
|
|
083ba5f5ca | ||
|
|
f0562af9dd | ||
|
|
20eda8b563 | ||
|
|
c983454d30 | ||
|
|
c26fd8061e | ||
|
|
a6119a86c5 | ||
|
|
d5fed03778 | ||
|
|
ad1a5cc5f0 | ||
|
|
0687adca37 | ||
|
|
0667433587 | ||
|
|
756a1763d1 | ||
|
|
603d2c0989 | ||
|
|
1694d23e23 | ||
|
|
10f25d2739 | ||
|
|
a5e0121b8d | ||
|
|
e9b2c2d669 | ||
|
|
1e15fd1856 | ||
|
|
19ce6a4792 | ||
|
|
ed56921d6e | ||
|
|
4b7a43da34 | ||
|
|
8feadca3fa | ||
|
|
1122fec973 | ||
|
|
20542c0b94 | ||
|
|
ef54251a84 | ||
|
|
e003ce4899 | ||
|
|
bd89e4b0dd | ||
|
|
0148a838d0 | ||
|
|
57cff290a4 | ||
|
|
3dd965bdf9 | ||
|
|
932209b344 | ||
|
|
fead2e2de9 | ||
|
|
6b9826b2dc | ||
|
|
6cbf9f9b25 | ||
|
|
97ecd64913 | ||
|
|
ad935d583d | ||
|
|
656bdc3667 | ||
|
|
ed22f562e5 | ||
|
|
941138f8c9 | ||
|
|
496934a803 | ||
|
|
37c53b6221 | ||
|
|
5ec7f5a518 | ||
|
|
e06b9965ad | ||
|
|
f6cc833ae7 | ||
|
|
783b810cae | ||
|
|
a5a0ba86c8 | ||
|
|
e80c36e27b | ||
|
|
d515df2a50 | ||
|
|
f1151efcb1 | ||
|
|
2d01bf0665 | ||
|
|
0a111118a6 | ||
|
|
11a58a68e1 | ||
|
|
6063ec176d | ||
|
|
0cfa1f7cbd | ||
|
|
9e604b442c | ||
|
|
d5c2f255c5 | ||
|
|
7bbce3c0e7 | ||
|
|
6b41c6047b | ||
|
|
5d37fb32d2 | ||
|
|
3666695f0d | ||
|
|
d982028b92 | ||
|
|
ffadfd4c1e | ||
|
|
c6e08d6c44 | ||
|
|
469d419a17 | ||
|
|
7ac6af7027 | ||
|
|
e14ea5835e | ||
|
|
75f7695c62 | ||
|
|
ef3b2e2e34 | ||
|
|
9dbeff919b | ||
|
|
8c1aa2c24d | ||
|
|
506b36487c | ||
|
|
a02851e8a2 | ||
|
|
3e93e96dff | ||
|
|
b8a03c763a | ||
|
|
d615e47bea | ||
|
|
154002bb5d | ||
|
|
41fb6e1432 | ||
|
|
86e78d694c | ||
|
|
770a3c5116 | ||
|
|
d0a2fbfe60 | ||
|
|
f9b8998795 | ||
|
|
6e5e7e78ee | ||
|
|
5885da34ce | ||
|
|
80586729e4 | ||
|
|
8dcad976e0 | ||
|
|
542b0f0cf5 | ||
|
|
fddf722f4e | ||
|
|
171869e27c | ||
|
|
df85e57f4a | ||
|
|
e7c8da6f2d | ||
|
|
b2080c70d4 | ||
|
|
5a245dbf52 | ||
|
|
08774c5a22 | ||
|
|
6cf5d8c3aa | ||
|
|
c4cbb5b6b7 | ||
|
|
621ee222d9 | ||
|
|
31b8e617b6 | ||
|
|
47a7cce01e | ||
|
|
2529d02b5d | ||
|
|
211f0ee1be | ||
|
|
80f9180729 | ||
|
|
9ca45e21b8 | ||
|
|
65451f1549 | ||
|
|
30bbc93088 | ||
|
|
9a21a01946 | ||
|
|
99b2f7660d | ||
|
|
091c5ace78 | ||
|
|
497ac97247 | ||
|
|
aab015a929 | ||
|
|
9f193f202f | ||
|
|
5ea2e37c08 | ||
|
|
4ff9d3599c | ||
|
|
56a85ca8bf | ||
|
|
6c669943b3 | ||
|
|
f9e1c7e367 | ||
|
|
f83417b823 | ||
|
|
e76496ce46 | ||
|
|
5f5859c45b | ||
|
|
6fd4b669ca | ||
|
|
ac38bae75b | ||
|
|
52c4eb23e0 | ||
|
|
04240d90ef | ||
|
|
93c382bf45 | ||
|
|
2d72b1e393 | ||
|
|
e48e36623b | ||
|
|
0e1493ec5e | ||
|
|
eee7698bac | ||
|
|
626916fc25 | ||
|
|
b8f787b188 | ||
|
|
f190e97885 | ||
|
|
31aaf55f4c | ||
|
|
1b18a48e28 | ||
|
|
770d1c4ea7 | ||
|
|
c9f5d9fca6 | ||
|
|
d2f6afbfab | ||
|
|
57e5e87323 | ||
|
|
f02417b600 | ||
|
|
91e2f26fec | ||
|
|
4777bf2799 | ||
|
|
7a0248d2d7 | ||
|
|
d42c4beeff | ||
|
|
1f970ad73a |
159
CMakeLists.txt
Normal file
159
CMakeLists.txt
Normal file
@@ -0,0 +1,159 @@
|
||||
# See www/CMake.html for instructions on how to build libcxx with CMake.
|
||||
|
||||
#===============================================================================
|
||||
# Setup Project
|
||||
#===============================================================================
|
||||
|
||||
project(libcxx CXX C)
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
set(PACKAGE_NAME libcxx)
|
||||
set(PACKAGE_VERSION trunk-svn)
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")
|
||||
|
||||
# Add path for custom modules
|
||||
set(CMAKE_MODULE_PATH
|
||||
${CMAKE_MODULE_PATH}
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
|
||||
)
|
||||
|
||||
# Require out of source build.
|
||||
include(MacroEnsureOutOfSourceBuild)
|
||||
MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
|
||||
"${PROJECT_NAME} requires an out of source build. Please create a separate
|
||||
build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there."
|
||||
)
|
||||
|
||||
#===============================================================================
|
||||
# Setup CMake Options
|
||||
#===============================================================================
|
||||
|
||||
# Define options.
|
||||
option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON)
|
||||
option(LIBCXX_ENABLE_RTTI "Use run time type information." ON)
|
||||
option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
|
||||
option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
|
||||
option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
|
||||
option(LIBCXX_ENABLE_CXX0X "Enable -std=c++0x and use of c++0x language features if the compiler supports it." ON)
|
||||
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
|
||||
|
||||
#===============================================================================
|
||||
# Configure System
|
||||
#===============================================================================
|
||||
|
||||
# Get triples.
|
||||
include(GetTriple)
|
||||
get_host_triple(LIBCXX_HOST_TRIPLE
|
||||
LIBCXX_HOST_ARCH
|
||||
LIBCXX_HOST_VENDOR
|
||||
LIBCXX_HOST_OS
|
||||
)
|
||||
set(LIBCXX_HOST_TRIPLE ${LIBCXX_HOST_TRIPLE} CACHE STRING "Host triple.")
|
||||
get_target_triple(LIBCXX_TARGET_TRIPLE
|
||||
LIBCXX_TARGET_ARCH
|
||||
LIBCXX_TARGET_VENDOR
|
||||
LIBCXX_TARGET_OS
|
||||
)
|
||||
set(LIBCXX_TARGET_TRIPLE ${LIBCXX_TARGET_TRIPLE} CACHE STRING "Target triple.")
|
||||
|
||||
# Configure compiler.
|
||||
include(config-ix)
|
||||
|
||||
#===============================================================================
|
||||
# Setup Compiler Flags
|
||||
#===============================================================================
|
||||
|
||||
# Get required flags.
|
||||
# On all systems the system c++ standard library headers need to be excluded.
|
||||
if (MSVC)
|
||||
# MSVC only has -X, which disables all default includes; including the crt.
|
||||
# Thus, we do nothing and hope we don't accidentally include any of the C++
|
||||
# headers.
|
||||
else()
|
||||
if (LIBCXX_HAS_NOSTDINCXX_FLAG)
|
||||
set(LIBCXX_CXX_REQUIRED_FLAGS -nostdinc++)
|
||||
endif()
|
||||
if (LIBCXX_ENABLE_CXX0X AND LIBCXX_HAS_STDCXX0X_FLAG)
|
||||
list(APPEND LIBCXX_CXX_REQUIRED_FLAGS -std=c++0x)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
macro(append_if list condition var)
|
||||
if (${condition})
|
||||
list(APPEND ${list} ${var})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Get warning flags
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_W_FLAG -W)
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG -Wno-unused-parameter)
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings)
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WNO_LONG_LONG_FLAG -Wno-long-long)
|
||||
if (LIBCXX_ENABLE_WERROR)
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror)
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WX_FLAG -WX)
|
||||
endif()
|
||||
if (LIBCXX_ENABLE_PEDANTIC)
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
|
||||
endif()
|
||||
|
||||
# Get feature flags.
|
||||
# Exceptions
|
||||
if (LIBCXX_ENABLE_EXCEPTIONS)
|
||||
# Catches C++ exceptions only and tells the compiler to assume that extern C
|
||||
# functions never throw a C++ exception.
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_EHSC_FLAG -EHsc)
|
||||
else()
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_NO_EXCEPTIONS)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_EHS_FLAG -EHs-)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_EHA_FLAG -EHa-)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_EXCEPTIONS_FLAG -fno-exceptions)
|
||||
endif()
|
||||
# RTTI
|
||||
if (NOT LIBCXX_ENABLE_RTTI)
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_NO_RTTI)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_GR_FLAG -GR-)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti)
|
||||
endif()
|
||||
# Assert
|
||||
if (LLVM_ENABLE_ASSERTIONS)
|
||||
# MSVC doesn't like _DEBUG on release builds. See PR 4379.
|
||||
if (NOT MSVC)
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_DEBUG)
|
||||
endif()
|
||||
# On Release builds cmake automatically defines NDEBUG, so we
|
||||
# explicitly undefine it:
|
||||
if (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -UNDEBUG)
|
||||
endif()
|
||||
else()
|
||||
if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -DNDEBUG)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# This is the _ONLY_ place where add_definitions is called.
|
||||
add_definitions(
|
||||
${LIBCXX_CXX_REQUIRED_FLAGS}
|
||||
${LIBCXX_CXX_WARNING_FLAGS}
|
||||
${LIBCXX_CXX_FEATURE_FLAGS}
|
||||
)
|
||||
|
||||
#===============================================================================
|
||||
# Setup Source Code
|
||||
#===============================================================================
|
||||
|
||||
include_directories(include)
|
||||
|
||||
# Add source code. This also contains all of the logic for deciding linker flags
|
||||
# soname, etc...
|
||||
add_subdirectory(lib)
|
||||
|
||||
#===============================================================================
|
||||
# Setup Tests
|
||||
#===============================================================================
|
||||
|
||||
add_subdirectory(test)
|
||||
@@ -12,4 +12,12 @@ N: Howard Hinnant
|
||||
E: hhinnant@apple.com
|
||||
D: Architect and primary author of libc++
|
||||
|
||||
N: Marshall Clow
|
||||
E: marshall@idio.com
|
||||
E: mclow@qualcomm.com
|
||||
D: Minor patches and bug fixes.
|
||||
|
||||
N: Bjorn Reese
|
||||
E: breese@users.sourceforge.net
|
||||
D: Initial regex prototype
|
||||
|
||||
|
||||
50
Makefile
50
Makefile
@@ -9,6 +9,15 @@ OBJROOT=.
|
||||
SYMROOT=.
|
||||
export TRIPLE=-apple-
|
||||
|
||||
ifeq (,$(RC_INDIGO))
|
||||
INSTALL_PREFIX=""
|
||||
else
|
||||
INSTALL_PREFIX="$(SDKROOT)"
|
||||
endif
|
||||
|
||||
help::
|
||||
echo Use make install DSTROOT=<destination>
|
||||
|
||||
installsrc:: $(SRCROOT)
|
||||
|
||||
ditto $(SRCDIRS)/include $(SRCROOT)/include
|
||||
@@ -20,19 +29,40 @@ clean::
|
||||
|
||||
installhdrs::
|
||||
|
||||
mkdir -p $(DSTROOT)/usr/include/c++/v1/ext
|
||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/usr/include/c++/v1/
|
||||
chown -R root:wheel $(DSTROOT)/usr/include
|
||||
chmod 755 $(DSTROOT)/usr/include/c++/v1
|
||||
chmod 644 $(DSTROOT)/usr/include/c++/v1/*
|
||||
chmod 755 $(DSTROOT)/usr/include/c++/v1/ext
|
||||
chmod 644 $(DSTROOT)/usr/include/c++/v1/ext/*
|
||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext
|
||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext
|
||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext
|
||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext
|
||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/
|
||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/
|
||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/
|
||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/
|
||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++
|
||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++
|
||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++
|
||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/*
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext/*
|
||||
|
||||
install:: installhdrs $(DESTDIR)
|
||||
|
||||
cd lib && ./buildit
|
||||
ditto lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
|
||||
cd lib && dsymutil -o $(SYMROOT)/libc++.1.dylib.dSYM $(SYMROOT)/usr/lib/libc++.1.dylib
|
||||
mkdir -p $(DSTROOT)/usr/lib
|
||||
strip -S -o $(DSTROOT)/usr/lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
|
||||
cd $(DSTROOT)/usr/lib && ln -s libc++.1.dylib libc++.dylib
|
||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib
|
||||
strip -S -o $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
|
||||
cd $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib && ln -s libc++.1.dylib libc++.dylib
|
||||
|
||||
53
cmake/Modules/GetTriple.cmake
Normal file
53
cmake/Modules/GetTriple.cmake
Normal file
@@ -0,0 +1,53 @@
|
||||
# Define functions to get the host and target triple.
|
||||
|
||||
function(get_host_triple out out_arch out_vendor out_os)
|
||||
# Get the architecture.
|
||||
set(arch ${CMAKE_HOST_SYSTEM_PROCESSOR})
|
||||
if (arch STREQUAL "x86")
|
||||
set(arch "i686")
|
||||
endif()
|
||||
# Get the vendor.
|
||||
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
|
||||
set(vendor "apple")
|
||||
else()
|
||||
set(vendor "pc")
|
||||
endif()
|
||||
# Get os.
|
||||
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
|
||||
set(os "win32")
|
||||
else()
|
||||
string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} os)
|
||||
endif()
|
||||
set(triple "${arch}-${vendor}-${os}")
|
||||
set(${out} ${triple} PARENT_SCOPE)
|
||||
set(${out_arch} ${arch} PARENT_SCOPE)
|
||||
set(${out_vendor} ${vendor} PARENT_SCOPE)
|
||||
set(${out_os} ${os} PARENT_SCOPE)
|
||||
message(STATUS "Host triple: ${triple}")
|
||||
endfunction()
|
||||
|
||||
function(get_target_triple out out_arch out_vendor out_os)
|
||||
# Get the architecture.
|
||||
set(arch ${CMAKE_SYSTEM_PROCESSOR})
|
||||
if (arch STREQUAL "x86")
|
||||
set(arch "i686")
|
||||
endif()
|
||||
# Get the vendor.
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||
set(vendor "apple")
|
||||
else()
|
||||
set(vendor "pc")
|
||||
endif()
|
||||
# Get os.
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
set(os "win32")
|
||||
else()
|
||||
string(TOLOWER ${CMAKE_SYSTEM_NAME} os)
|
||||
endif()
|
||||
set(triple "${arch}-${vendor}-${os}")
|
||||
set(${out} ${triple} PARENT_SCOPE)
|
||||
set(${out_arch} ${arch} PARENT_SCOPE)
|
||||
set(${out_vendor} ${vendor} PARENT_SCOPE)
|
||||
set(${out_os} ${os} PARENT_SCOPE)
|
||||
message(STATUS "Target triple: ${triple}")
|
||||
endfunction()
|
||||
18
cmake/Modules/MacroEnsureOutOfSourceBuild.cmake
Normal file
18
cmake/Modules/MacroEnsureOutOfSourceBuild.cmake
Normal file
@@ -0,0 +1,18 @@
|
||||
# MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)
|
||||
|
||||
macro( MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage )
|
||||
|
||||
string( COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" _insource )
|
||||
if( _insource )
|
||||
message( SEND_ERROR "${_errorMessage}" )
|
||||
message( FATAL_ERROR
|
||||
"In-source builds are not allowed.
|
||||
CMake would overwrite the makefiles distributed with Compiler-RT.
|
||||
Please create a directory and run cmake from there, passing the path
|
||||
to this source directory as the last argument.
|
||||
This process created the file `CMakeCache.txt' and the directory `CMakeFiles'.
|
||||
Please delete them."
|
||||
)
|
||||
endif( _insource )
|
||||
|
||||
endmacro( MACRO_ENSURE_OUT_OF_SOURCE_BUILD )
|
||||
38
cmake/config-ix.cmake
Normal file
38
cmake/config-ix.cmake
Normal file
@@ -0,0 +1,38 @@
|
||||
include(CheckLibraryExists)
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
# Check compiler flags
|
||||
check_cxx_compiler_flag(-std=c++0x LIBCXX_HAS_STDCXX0X_FLAG)
|
||||
check_cxx_compiler_flag(-fPIC LIBCXX_HAS_FPIC_FLAG)
|
||||
check_cxx_compiler_flag(-nodefaultlibs LIBCXX_HAS_NODEFAULTLIBS_FLAG)
|
||||
check_cxx_compiler_flag(-nostdinc++ LIBCXX_HAS_NOSTDINCXX_FLAG)
|
||||
check_cxx_compiler_flag(-Wall LIBCXX_HAS_WALL_FLAG)
|
||||
check_cxx_compiler_flag(-W LIBCXX_HAS_W_FLAG)
|
||||
check_cxx_compiler_flag(-Wno-unused-parameter LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG)
|
||||
check_cxx_compiler_flag(-Wwrite-strings LIBCXX_HAS_WWRITE_STRINGS_FLAG)
|
||||
check_cxx_compiler_flag(-Wno-long-long LIBCXX_HAS_WNO_LONG_LONG_FLAG)
|
||||
check_cxx_compiler_flag(-pedantic LIBCXX_HAS_PEDANTIC_FLAG)
|
||||
check_cxx_compiler_flag(-Werror LIBCXX_HAS_WERROR_FLAG)
|
||||
check_cxx_compiler_flag(-fno-exceptions LIBCXX_HAS_FNO_EXCEPTIONS_FLAG)
|
||||
check_cxx_compiler_flag(-fno-rtti LIBCXX_HAS_FNO_RTTI_FLAG)
|
||||
check_cxx_compiler_flag(/WX LIBCXX_HAS_WX_FLAG)
|
||||
check_cxx_compiler_flag(/EHsc LIBCXX_HAS_EHSC_FLAG)
|
||||
check_cxx_compiler_flag(/EHs- LIBCXX_HAS_NO_EHS_FLAG)
|
||||
check_cxx_compiler_flag(/EHa- LIBCXX_HAS_NO_EHA_FLAG)
|
||||
check_cxx_compiler_flag(/GR- LIBCXX_HAS_NO_GR_FLAG)
|
||||
|
||||
# Check libraries
|
||||
check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
|
||||
check_library_exists(c printf "" LIBCXX_HAS_C_LIB)
|
||||
check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
|
||||
check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
|
||||
check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
|
||||
|
||||
# Check C++0x features
|
||||
if (LIBCXX_ENABLE_CXX0X)
|
||||
if (LIBCXX_HAS_STDCXX0X_FLAG)
|
||||
set(CMAKE_REQUIRED_DEFINITIONS -std=c++0x)
|
||||
endif()
|
||||
else()
|
||||
set(LIBCXX_HAS_STDCXX0X_FLAG FALSE)
|
||||
endif()
|
||||
@@ -21,7 +21,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
template <class _C, bool _IsConst> class __bit_iterator;
|
||||
template <class _C> class __bit_const_reference;
|
||||
|
||||
template <class _C>
|
||||
template <class _Tp>
|
||||
struct __has_storage_type
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template <class _C, bool = __has_storage_type<_C>::value>
|
||||
class __bit_reference
|
||||
{
|
||||
typedef typename _C::__storage_type __storage_type;
|
||||
@@ -38,11 +44,13 @@ class __bit_reference
|
||||
friend class __bit_const_reference<_C>;
|
||||
friend class __bit_iterator<_C, false>;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY operator bool() const {return static_cast<bool>(*__seg_ & __mask_);}
|
||||
_LIBCPP_INLINE_VISIBILITY bool operator ~() const {return !static_cast<bool>(*this);}
|
||||
_LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
|
||||
{return static_cast<bool>(*__seg_ & __mask_);}
|
||||
_LIBCPP_INLINE_VISIBILITY bool operator ~() const _NOEXCEPT
|
||||
{return !static_cast<bool>(*this);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bit_reference& operator=(bool __x)
|
||||
__bit_reference& operator=(bool __x) _NOEXCEPT
|
||||
{
|
||||
if (__x)
|
||||
*__seg_ |= __mask_;
|
||||
@@ -52,20 +60,27 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bit_reference& operator=(const __bit_reference& __x) {return operator=(static_cast<bool>(__x));}
|
||||
__bit_reference& operator=(const __bit_reference& __x) _NOEXCEPT
|
||||
{return operator=(static_cast<bool>(__x));}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void flip() {*__seg_ ^= __mask_;}
|
||||
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, false> operator&() const
|
||||
_LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {*__seg_ ^= __mask_;}
|
||||
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, false> operator&() const _NOEXCEPT
|
||||
{return __bit_iterator<_C, false>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bit_reference(__storage_pointer __s, __storage_type __m) : __seg_(__s), __mask_(__m) {}
|
||||
__bit_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
|
||||
: __seg_(__s), __mask_(__m) {}
|
||||
};
|
||||
|
||||
template <class _C>
|
||||
class __bit_reference<_C, false>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _C, class _D>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
swap(__bit_reference<_C> __x, __bit_reference<_D> __y)
|
||||
swap(__bit_reference<_C> __x, __bit_reference<_D> __y) _NOEXCEPT
|
||||
{
|
||||
bool __t = __x;
|
||||
__x = __y;
|
||||
@@ -75,7 +90,7 @@ swap(__bit_reference<_C> __x, __bit_reference<_D> __y)
|
||||
template <class _C>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
swap(__bit_reference<_C> __x, bool& __y)
|
||||
swap(__bit_reference<_C> __x, bool& __y) _NOEXCEPT
|
||||
{
|
||||
bool __t = __x;
|
||||
__x = __y;
|
||||
@@ -85,7 +100,7 @@ swap(__bit_reference<_C> __x, bool& __y)
|
||||
template <class _C>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
swap(bool& __x, __bit_reference<_C> __y)
|
||||
swap(bool& __x, __bit_reference<_C> __y) _NOEXCEPT
|
||||
{
|
||||
bool __t = __x;
|
||||
__x = __y;
|
||||
@@ -109,16 +124,18 @@ class __bit_const_reference
|
||||
friend class __bit_iterator<_C, true>;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bit_const_reference(const __bit_reference<_C>& __x)
|
||||
__bit_const_reference(const __bit_reference<_C>& __x) _NOEXCEPT
|
||||
: __seg_(__x.__seg_), __mask_(__x.__mask_) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY operator bool() const {return static_cast<bool>(*__seg_ & __mask_);}
|
||||
_LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
|
||||
{return static_cast<bool>(*__seg_ & __mask_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, true> operator&() const
|
||||
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, true> operator&() const _NOEXCEPT
|
||||
{return __bit_iterator<_C, true>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bit_const_reference(__storage_pointer __s, __storage_type __m) : __seg_(__s), __mask_(__m) {}
|
||||
__bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
|
||||
: __seg_(__s), __mask_(__m) {}
|
||||
|
||||
__bit_const_reference& operator=(const __bit_const_reference& __x);
|
||||
};
|
||||
@@ -136,25 +153,25 @@ __find_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||
if (__first.__ctz_ != 0)
|
||||
{
|
||||
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
|
||||
__storage_type __dn = _STD::min(__clz_f, __n);
|
||||
__storage_type __dn = _VSTD::min(__clz_f, __n);
|
||||
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
|
||||
__storage_type __b = *__first.__seg_ & __m;
|
||||
if (__b)
|
||||
return _It(__first.__seg_, static_cast<unsigned>(_STD::__ctz(__b)));
|
||||
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
|
||||
__n -= __dn;
|
||||
++__first.__seg_;
|
||||
}
|
||||
// do middle whole words
|
||||
for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
|
||||
if (*__first.__seg_)
|
||||
return _It(__first.__seg_, static_cast<unsigned>(_STD::__ctz(*__first.__seg_)));
|
||||
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(*__first.__seg_)));
|
||||
// do last partial word
|
||||
if (__n > 0)
|
||||
{
|
||||
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
|
||||
__storage_type __b = *__first.__seg_ & __m;
|
||||
if (__b)
|
||||
return _It(__first.__seg_, static_cast<unsigned>(_STD::__ctz(__b)));
|
||||
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
|
||||
}
|
||||
return _It(__first.__seg_, static_cast<unsigned>(__n));
|
||||
}
|
||||
@@ -170,11 +187,11 @@ __find_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||
if (__first.__ctz_ != 0)
|
||||
{
|
||||
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
|
||||
__storage_type __dn = _STD::min(__clz_f, __n);
|
||||
__storage_type __dn = _VSTD::min(__clz_f, __n);
|
||||
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
|
||||
__storage_type __b = ~(*__first.__seg_ & __m);
|
||||
if (__b)
|
||||
return _It(__first.__seg_, static_cast<unsigned>(_STD::__ctz(__b)));
|
||||
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
|
||||
__n -= __dn;
|
||||
++__first.__seg_;
|
||||
}
|
||||
@@ -183,7 +200,7 @@ __find_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||
{
|
||||
__storage_type __b = ~*__first.__seg_;
|
||||
if (__b)
|
||||
return _It(__first.__seg_, static_cast<unsigned>(_STD::__ctz(__b)));
|
||||
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
|
||||
}
|
||||
// do last partial word
|
||||
if (__n > 0)
|
||||
@@ -191,7 +208,7 @@ __find_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
|
||||
__storage_type __b = ~(*__first.__seg_ & __m);
|
||||
if (__b)
|
||||
return _It(__first.__seg_, static_cast<unsigned>(_STD::__ctz(__b)));
|
||||
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
|
||||
}
|
||||
return _It(__first.__seg_, static_cast<unsigned>(__n));
|
||||
}
|
||||
@@ -221,20 +238,20 @@ __count_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||
if (__first.__ctz_ != 0)
|
||||
{
|
||||
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
|
||||
__storage_type __dn = _STD::min(__clz_f, __n);
|
||||
__storage_type __dn = _VSTD::min(__clz_f, __n);
|
||||
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
|
||||
__r = _STD::__pop_count(*__first.__seg_ & __m);
|
||||
__r = _VSTD::__pop_count(*__first.__seg_ & __m);
|
||||
__n -= __dn;
|
||||
++__first.__seg_;
|
||||
}
|
||||
// do middle whole words
|
||||
for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
|
||||
__r += _STD::__pop_count(*__first.__seg_);
|
||||
__r += _VSTD::__pop_count(*__first.__seg_);
|
||||
// do last partial word
|
||||
if (__n > 0)
|
||||
{
|
||||
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
|
||||
__r += _STD::__pop_count(*__first.__seg_ & __m);
|
||||
__r += _VSTD::__pop_count(*__first.__seg_ & __m);
|
||||
}
|
||||
return __r;
|
||||
}
|
||||
@@ -252,20 +269,20 @@ __count_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n
|
||||
if (__first.__ctz_ != 0)
|
||||
{
|
||||
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
|
||||
__storage_type __dn = _STD::min(__clz_f, __n);
|
||||
__storage_type __dn = _VSTD::min(__clz_f, __n);
|
||||
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
|
||||
__r = _STD::__pop_count(~(*__first.__seg_ & __m));
|
||||
__r = _VSTD::__pop_count(~(*__first.__seg_ & __m));
|
||||
__n -= __dn;
|
||||
++__first.__seg_;
|
||||
}
|
||||
// do middle whole words
|
||||
for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
|
||||
__r += _STD::__pop_count(~*__first.__seg_);
|
||||
__r += _VSTD::__pop_count(~*__first.__seg_);
|
||||
// do last partial word
|
||||
if (__n > 0)
|
||||
{
|
||||
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
|
||||
__r += _STD::__pop_count(~(*__first.__seg_ & __m));
|
||||
__r += _VSTD::__pop_count(~(*__first.__seg_ & __m));
|
||||
}
|
||||
return __r;
|
||||
}
|
||||
@@ -293,7 +310,7 @@ __fill_n_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||
if (__first.__ctz_ != 0)
|
||||
{
|
||||
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
|
||||
__storage_type __dn = _STD::min(__clz_f, __n);
|
||||
__storage_type __dn = _VSTD::min(__clz_f, __n);
|
||||
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
|
||||
*__first.__seg_ &= ~__m;
|
||||
__n -= __dn;
|
||||
@@ -301,7 +318,7 @@ __fill_n_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||
}
|
||||
// do middle whole words
|
||||
__storage_type __nw = __n / __bits_per_word;
|
||||
_STD::memset(__first.__seg_, 0, __nw * sizeof(__storage_type));
|
||||
_VSTD::memset(__first.__seg_, 0, __nw * sizeof(__storage_type));
|
||||
__n -= __nw * __bits_per_word;
|
||||
// do last partial word
|
||||
if (__n > 0)
|
||||
@@ -323,7 +340,7 @@ __fill_n_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||
if (__first.__ctz_ != 0)
|
||||
{
|
||||
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
|
||||
__storage_type __dn = _STD::min(__clz_f, __n);
|
||||
__storage_type __dn = _VSTD::min(__clz_f, __n);
|
||||
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
|
||||
*__first.__seg_ |= __m;
|
||||
__n -= __dn;
|
||||
@@ -331,7 +348,7 @@ __fill_n_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||
}
|
||||
// do middle whole words
|
||||
__storage_type __nw = __n / __bits_per_word;
|
||||
_STD::memset(__first.__seg_, -1, __nw * sizeof(__storage_type));
|
||||
_VSTD::memset(__first.__seg_, -1, __nw * sizeof(__storage_type));
|
||||
__n -= __nw * __bits_per_word;
|
||||
// do last partial word
|
||||
if (__n > 0)
|
||||
@@ -363,7 +380,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
fill(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, bool __value)
|
||||
{
|
||||
_STD::fill_n(__first, static_cast<typename _C::size_type>(__last - __first), __value);
|
||||
_VSTD::fill_n(__first, static_cast<typename _C::size_type>(__last - __first), __value);
|
||||
}
|
||||
|
||||
// copy
|
||||
@@ -384,7 +401,7 @@ __copy_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst
|
||||
if (__first.__ctz_ != 0)
|
||||
{
|
||||
unsigned __clz = __bits_per_word - __first.__ctz_;
|
||||
difference_type __dn = _STD::min(static_cast<difference_type>(__clz), __n);
|
||||
difference_type __dn = _VSTD::min(static_cast<difference_type>(__clz), __n);
|
||||
__n -= __dn;
|
||||
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz - __dn));
|
||||
__storage_type __b = *__first.__seg_ & __m;
|
||||
@@ -398,7 +415,7 @@ __copy_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst
|
||||
// __first.__ctz_ == 0;
|
||||
// do middle words
|
||||
__storage_type __nw = __n / __bits_per_word;
|
||||
_STD::memmove(__result.__seg_, __first.__seg_, __nw * sizeof(__storage_type));
|
||||
_VSTD::memmove(__result.__seg_, __first.__seg_, __nw * sizeof(__storage_type));
|
||||
__n -= __nw * __bits_per_word;
|
||||
__result.__seg_ += __nw;
|
||||
// do last word
|
||||
@@ -431,12 +448,12 @@ __copy_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsCon
|
||||
if (__first.__ctz_ != 0)
|
||||
{
|
||||
unsigned __clz_f = __bits_per_word - __first.__ctz_;
|
||||
difference_type __dn = _STD::min(static_cast<difference_type>(__clz_f), __n);
|
||||
difference_type __dn = _VSTD::min(static_cast<difference_type>(__clz_f), __n);
|
||||
__n -= __dn;
|
||||
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
|
||||
__storage_type __b = *__first.__seg_ & __m;
|
||||
unsigned __clz_r = __bits_per_word - __result.__ctz_;
|
||||
__storage_type __ddn = _STD::min<__storage_type>(__dn, __clz_r);
|
||||
__storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r);
|
||||
__m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn));
|
||||
*__result.__seg_ &= ~__m;
|
||||
if (__result.__ctz_ > __first.__ctz_)
|
||||
@@ -474,7 +491,7 @@ __copy_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsCon
|
||||
{
|
||||
__m = ~__storage_type(0) >> (__bits_per_word - __n);
|
||||
__storage_type __b = *__first.__seg_ & __m;
|
||||
__storage_type __dn = _STD::min(__n, static_cast<difference_type>(__clz_r));
|
||||
__storage_type __dn = _VSTD::min(__n, static_cast<difference_type>(__clz_r));
|
||||
__m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn));
|
||||
*__result.__seg_ &= ~__m;
|
||||
*__result.__seg_ |= __b << __result.__ctz_;
|
||||
@@ -520,7 +537,7 @@ __copy_backward_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C,
|
||||
// do first word
|
||||
if (__last.__ctz_ != 0)
|
||||
{
|
||||
difference_type __dn = _STD::min(static_cast<difference_type>(__last.__ctz_), __n);
|
||||
difference_type __dn = _VSTD::min(static_cast<difference_type>(__last.__ctz_), __n);
|
||||
__n -= __dn;
|
||||
unsigned __clz = __bits_per_word - __last.__ctz_;
|
||||
__storage_type __m = (~__storage_type(0) << (__last.__ctz_ - __dn)) & (~__storage_type(0) >> __clz);
|
||||
@@ -537,7 +554,7 @@ __copy_backward_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C,
|
||||
__storage_type __nw = __n / __bits_per_word;
|
||||
__result.__seg_ -= __nw;
|
||||
__last.__seg_ -= __nw;
|
||||
_STD::memmove(__result.__seg_, __last.__seg_, __nw * sizeof(__storage_type));
|
||||
_VSTD::memmove(__result.__seg_, __last.__seg_, __nw * sizeof(__storage_type));
|
||||
__n -= __nw * __bits_per_word;
|
||||
// do last word
|
||||
if (__n > 0)
|
||||
@@ -567,13 +584,13 @@ __copy_backward_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_
|
||||
// do first word
|
||||
if (__last.__ctz_ != 0)
|
||||
{
|
||||
difference_type __dn = _STD::min(static_cast<difference_type>(__last.__ctz_), __n);
|
||||
difference_type __dn = _VSTD::min(static_cast<difference_type>(__last.__ctz_), __n);
|
||||
__n -= __dn;
|
||||
unsigned __clz_l = __bits_per_word - __last.__ctz_;
|
||||
__storage_type __m = (~__storage_type(0) << (__last.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_l);
|
||||
__storage_type __b = *__last.__seg_ & __m;
|
||||
unsigned __clz_r = __bits_per_word - __result.__ctz_;
|
||||
__storage_type __ddn = _STD::min(__dn, static_cast<difference_type>(__result.__ctz_));
|
||||
__storage_type __ddn = _VSTD::min(__dn, static_cast<difference_type>(__result.__ctz_));
|
||||
if (__ddn > 0)
|
||||
{
|
||||
__m = (~__storage_type(0) << (__result.__ctz_ - __ddn)) & (~__storage_type(0) >> __clz_r);
|
||||
@@ -617,7 +634,7 @@ __copy_backward_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_
|
||||
__m = ~__storage_type(0) << (__bits_per_word - __n);
|
||||
__storage_type __b = *--__last.__seg_ & __m;
|
||||
unsigned __clz_r = __bits_per_word - __result.__ctz_;
|
||||
__storage_type __dn = _STD::min(__n, static_cast<difference_type>(__result.__ctz_));
|
||||
__storage_type __dn = _VSTD::min(__n, static_cast<difference_type>(__result.__ctz_));
|
||||
__m = (~__storage_type(0) << (__result.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_r);
|
||||
*__result.__seg_ &= ~__m;
|
||||
*__result.__seg_ |= __b >> (__bits_per_word - __result.__ctz_);
|
||||
@@ -655,7 +672,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
__bit_iterator<_C, false>
|
||||
move(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
|
||||
{
|
||||
return _STD::copy(__first, __last, __result);
|
||||
return _VSTD::copy(__first, __last, __result);
|
||||
}
|
||||
|
||||
// move_backward
|
||||
@@ -665,7 +682,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
__bit_iterator<_C, false>
|
||||
move_backward(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
|
||||
{
|
||||
return _STD::copy(__first, __last, __result);
|
||||
return _VSTD::copy(__first, __last, __result);
|
||||
}
|
||||
|
||||
// swap_ranges
|
||||
@@ -686,7 +703,7 @@ __swap_ranges_aligned(__bit_iterator<_C1, false> __first, __bit_iterator<_C1, fa
|
||||
if (__first.__ctz_ != 0)
|
||||
{
|
||||
unsigned __clz = __bits_per_word - __first.__ctz_;
|
||||
difference_type __dn = _STD::min(static_cast<difference_type>(__clz), __n);
|
||||
difference_type __dn = _VSTD::min(static_cast<difference_type>(__clz), __n);
|
||||
__n -= __dn;
|
||||
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz - __dn));
|
||||
__storage_type __b1 = *__first.__seg_ & __m;
|
||||
@@ -736,13 +753,13 @@ __swap_ranges_unaligned(__bit_iterator<_C1, false> __first, __bit_iterator<_C1,
|
||||
if (__first.__ctz_ != 0)
|
||||
{
|
||||
unsigned __clz_f = __bits_per_word - __first.__ctz_;
|
||||
difference_type __dn = _STD::min(static_cast<difference_type>(__clz_f), __n);
|
||||
difference_type __dn = _VSTD::min(static_cast<difference_type>(__clz_f), __n);
|
||||
__n -= __dn;
|
||||
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
|
||||
__storage_type __b1 = *__first.__seg_ & __m;
|
||||
*__first.__seg_ &= ~__m;
|
||||
unsigned __clz_r = __bits_per_word - __result.__ctz_;
|
||||
__storage_type __ddn = _STD::min<__storage_type>(__dn, __clz_r);
|
||||
__storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r);
|
||||
__m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn));
|
||||
__storage_type __b2 = *__result.__seg_ & __m;
|
||||
*__result.__seg_ &= ~__m;
|
||||
@@ -797,7 +814,7 @@ __swap_ranges_unaligned(__bit_iterator<_C1, false> __first, __bit_iterator<_C1,
|
||||
__m = ~__storage_type(0) >> (__bits_per_word - __n);
|
||||
__storage_type __b1 = *__first.__seg_ & __m;
|
||||
*__first.__seg_ &= ~__m;
|
||||
__storage_type __dn = _STD::min<__storage_type>(__n, __clz_r);
|
||||
__storage_type __dn = _VSTD::min<__storage_type>(__n, __clz_r);
|
||||
__m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn));
|
||||
__storage_type __b2 = *__result.__seg_ & __m;
|
||||
*__result.__seg_ &= ~__m;
|
||||
@@ -871,13 +888,13 @@ rotate(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __middle, __
|
||||
if (__d1 <= __bit_array<_C>::capacity())
|
||||
{
|
||||
__bit_array<_C> __b(__d1);
|
||||
_STD::copy(__first, __middle, __b.begin());
|
||||
_STD::copy(__b.begin(), __b.end(), _STD::copy(__middle, __last, __first));
|
||||
_VSTD::copy(__first, __middle, __b.begin());
|
||||
_VSTD::copy(__b.begin(), __b.end(), _VSTD::copy(__middle, __last, __first));
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
__bit_iterator<_C, false> __mp = _STD::swap_ranges(__first, __middle, __middle);
|
||||
__bit_iterator<_C, false> __mp = _VSTD::swap_ranges(__first, __middle, __middle);
|
||||
__first = __middle;
|
||||
__middle = __mp;
|
||||
__d2 -= __d1;
|
||||
@@ -888,14 +905,14 @@ rotate(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __middle, __
|
||||
if (__d2 <= __bit_array<_C>::capacity())
|
||||
{
|
||||
__bit_array<_C> __b(__d2);
|
||||
_STD::copy(__middle, __last, __b.begin());
|
||||
_STD::copy_backward(__b.begin(), __b.end(), _STD::copy_backward(__first, __middle, __last));
|
||||
_VSTD::copy(__middle, __last, __b.begin());
|
||||
_VSTD::copy_backward(__b.begin(), __b.end(), _VSTD::copy_backward(__first, __middle, __last));
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
__bit_iterator<_C, false> __mp = __first + __d2;
|
||||
_STD::swap_ranges(__first, __mp, __middle);
|
||||
_VSTD::swap_ranges(__first, __mp, __middle);
|
||||
__first = __mp;
|
||||
__d1 -= __d2;
|
||||
}
|
||||
@@ -922,12 +939,12 @@ __equal_unaligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __
|
||||
if (__first1.__ctz_ != 0)
|
||||
{
|
||||
unsigned __clz_f = __bits_per_word - __first1.__ctz_;
|
||||
difference_type __dn = _STD::min(static_cast<difference_type>(__clz_f), __n);
|
||||
difference_type __dn = _VSTD::min(static_cast<difference_type>(__clz_f), __n);
|
||||
__n -= __dn;
|
||||
__storage_type __m = (~__storage_type(0) << __first1.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
|
||||
__storage_type __b = *__first1.__seg_ & __m;
|
||||
unsigned __clz_r = __bits_per_word - __first2.__ctz_;
|
||||
__storage_type __ddn = _STD::min<__storage_type>(__dn, __clz_r);
|
||||
__storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r);
|
||||
__m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn));
|
||||
if (__first2.__ctz_ > __first1.__ctz_)
|
||||
if ((*__first2.__seg_ & __m) != (__b << (__first2.__ctz_ - __first1.__ctz_)))
|
||||
@@ -966,7 +983,7 @@ __equal_unaligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __
|
||||
{
|
||||
__m = ~__storage_type(0) >> (__bits_per_word - __n);
|
||||
__storage_type __b = *__first1.__seg_ & __m;
|
||||
__storage_type __dn = _STD::min(__n, static_cast<difference_type>(__clz_r));
|
||||
__storage_type __dn = _VSTD::min(__n, static_cast<difference_type>(__clz_r));
|
||||
__m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn));
|
||||
if ((*__first2.__seg_ & __m) != (__b << __first2.__ctz_))
|
||||
return false;
|
||||
@@ -1000,7 +1017,7 @@ __equal_aligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __la
|
||||
if (__first1.__ctz_ != 0)
|
||||
{
|
||||
unsigned __clz = __bits_per_word - __first1.__ctz_;
|
||||
difference_type __dn = _STD::min(static_cast<difference_type>(__clz), __n);
|
||||
difference_type __dn = _VSTD::min(static_cast<difference_type>(__clz), __n);
|
||||
__n -= __dn;
|
||||
__storage_type __m = (~__storage_type(0) << __first1.__ctz_) & (~__storage_type(0) >> (__clz - __dn));
|
||||
if ((*__first2.__seg_ & __m) != (*__first1.__seg_ & __m))
|
||||
@@ -1057,12 +1074,14 @@ private:
|
||||
unsigned __ctz_;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY __bit_iterator() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __bit_iterator() _NOEXCEPT {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __bit_iterator(const __bit_iterator<_C, false>& __it)
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bit_iterator(const __bit_iterator<_C, false>& __it) _NOEXCEPT
|
||||
: __seg_(__it.__seg_), __ctz_(__it.__ctz_) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return reference(__seg_, __storage_type(1) << __ctz_);}
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT
|
||||
{return reference(__seg_, __storage_type(1) << __ctz_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __bit_iterator& operator++()
|
||||
{
|
||||
@@ -1162,7 +1181,8 @@ public:
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bit_iterator(__storage_pointer __s, unsigned __ctz) : __seg_(__s), __ctz_(__ctz) {}
|
||||
__bit_iterator(__storage_pointer __s, unsigned __ctz) _NOEXCEPT
|
||||
: __seg_(__s), __ctz_(__ctz) {}
|
||||
|
||||
#if defined(__clang__)
|
||||
friend typename _C::__self;
|
||||
|
||||
@@ -47,6 +47,11 @@
|
||||
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
#endif // __FreeBSD__
|
||||
|
||||
#ifdef _WIN32
|
||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN 0
|
||||
#endif // _WIN32
|
||||
|
||||
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
|
||||
# include <endian.h>
|
||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
@@ -82,12 +87,13 @@
|
||||
|
||||
#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
|
||||
|
||||
#define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__))
|
||||
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
|
||||
|
||||
#if defined(__clang__)
|
||||
|
||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
#if !__has_feature(cxx_alias_templates)
|
||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
#endif
|
||||
|
||||
#ifndef __GXX_EXPERIMENTAL_CXX0X__
|
||||
#ifdef __linux__
|
||||
@@ -110,8 +116,10 @@ typedef __char32_t char32_t;
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_attributes))
|
||||
#define _LIBCPP_HAS_NO_ATTRIBUTES
|
||||
#if __has_feature(cxx_attributes)
|
||||
# define _ATTRIBUTE(x) [[x]]
|
||||
#else
|
||||
# define _ATTRIBUTE(x) __attribute__ ((x))
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
@@ -140,6 +148,10 @@ typedef __char32_t char32_t;
|
||||
#define _LIBCPP_HAS_NO_AUTO_TYPE
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return)
|
||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_variadic_templates))
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif
|
||||
@@ -148,31 +160,47 @@ typedef __char32_t char32_t;
|
||||
#define _LIBCPP_HAS_NO_TRAILING_RETURN
|
||||
#endif
|
||||
|
||||
#if __has_feature(cxx_inline_namespaces)
|
||||
// Objective-C++ features (opt-in)
|
||||
#if __has_feature(objc_arc)
|
||||
#define _LIBCPP_HAS_OBJC_ARC
|
||||
#endif
|
||||
|
||||
#if __has_feature(objc_arc_weak)
|
||||
#define _LIBCPP_HAS_OBJC_ARC_WEAK
|
||||
#endif
|
||||
|
||||
// Inline namespaces are available in Clang regardless of C++ dialect.
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
|
||||
#define _LIBCPP_END_NAMESPACE_STD } }
|
||||
#define _STD std::_LIBCPP_NAMESPACE
|
||||
#define _VSTD std::_LIBCPP_NAMESPACE
|
||||
|
||||
namespace std {
|
||||
inline namespace _LIBCPP_NAMESPACE {
|
||||
inline namespace _LIBCPP_NAMESPACE {
|
||||
}
|
||||
}
|
||||
using namespace _LIBCPP_NAMESPACE;
|
||||
}
|
||||
|
||||
#else // __has_feature(cxx_inline_namespaces)
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
|
||||
#define _LIBCPP_END_NAMESPACE_STD }
|
||||
#define _STD std
|
||||
#endif // __has_feature(cxx_inline_namespaces)
|
||||
|
||||
#if !(__has_feature(cxx_constexpr))
|
||||
#define _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#endif
|
||||
|
||||
#if (__has_feature(cxx_noexcept))
|
||||
# define _NOEXCEPT noexcept
|
||||
# define _NOEXCEPT_(x) noexcept(x)
|
||||
#else
|
||||
# define _NOEXCEPT throw()
|
||||
# define _NOEXCEPT_(x)
|
||||
#endif
|
||||
|
||||
#if __has_feature(underlying_type)
|
||||
# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T)
|
||||
#endif
|
||||
|
||||
// end defined(__clang__)
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
#define _ATTRIBUTE(x) __attribute__((x))
|
||||
|
||||
#if !__EXCEPTIONS
|
||||
#define _LIBCPP_NO_EXCEPTIONS
|
||||
#endif
|
||||
@@ -180,6 +208,9 @@ using namespace _LIBCPP_NAMESPACE;
|
||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
#define _LIBCPP_HAS_NO_CONSTEXPR
|
||||
|
||||
#define _NOEXCEPT throw()
|
||||
#define _NOEXCEPT_(x)
|
||||
|
||||
#ifndef __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
@@ -191,10 +222,12 @@ using namespace _LIBCPP_NAMESPACE;
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
|
||||
#else // __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
#define _LIBCPP_HAS_NO_TRAILING_RETURN
|
||||
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
|
||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
|
||||
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -221,7 +254,7 @@ using namespace _LIBCPP_NAMESPACE;
|
||||
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
|
||||
#define _LIBCPP_END_NAMESPACE_STD } }
|
||||
#define _STD std::_LIBCPP_NAMESPACE
|
||||
#define _VSTD std::_LIBCPP_NAMESPACE
|
||||
|
||||
namespace std {
|
||||
namespace _LIBCPP_NAMESPACE {
|
||||
@@ -259,4 +292,16 @@ template <unsigned> struct __static_assert_check {};
|
||||
#define __has_feature(__x) 0
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define _LIBCPP_STABLE_APPLE_ABI
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define _LIBCPP_WCTYPE_IS_MASK
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CONFIG
|
||||
|
||||
@@ -314,8 +314,8 @@ class __func<_F, _Alloc, _R()>
|
||||
{
|
||||
__compressed_pair<_F, _Alloc> __f_;
|
||||
public:
|
||||
explicit __func(_F __f) : __f_(_STD::move(__f)) {}
|
||||
explicit __func(_F __f, _Alloc __a) : __f_(_STD::move(__f), _STD::move(__a)) {}
|
||||
explicit __func(_F __f) : __f_(_VSTD::move(__f)) {}
|
||||
explicit __func(_F __f, _Alloc __a) : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
|
||||
virtual __base<_R()>* __clone() const;
|
||||
virtual void __clone(__base<_R()>*) const;
|
||||
virtual void destroy();
|
||||
@@ -396,9 +396,9 @@ class __func<_F, _Alloc, _R(_A0)>
|
||||
{
|
||||
__compressed_pair<_F, _Alloc> __f_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __func(_F __f) : __f_(_STD::move(__f)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __func(_F __f) : __f_(_VSTD::move(__f)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __func(_F __f, _Alloc __a)
|
||||
: __f_(_STD::move(__f), _STD::move(__a)) {}
|
||||
: __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
|
||||
virtual __base<_R(_A0)>* __clone() const;
|
||||
virtual void __clone(__base<_R(_A0)>*) const;
|
||||
virtual void destroy();
|
||||
@@ -479,9 +479,9 @@ class __func<_F, _Alloc, _R(_A0, _A1)>
|
||||
{
|
||||
__compressed_pair<_F, _Alloc> __f_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __func(_F __f) : __f_(_STD::move(__f)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __func(_F __f) : __f_(_VSTD::move(__f)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __func(_F __f, _Alloc __a)
|
||||
: __f_(_STD::move(__f), _STD::move(__a)) {}
|
||||
: __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
|
||||
virtual __base<_R(_A0, _A1)>* __clone() const;
|
||||
virtual void __clone(__base<_R(_A0, _A1)>*) const;
|
||||
virtual void destroy();
|
||||
@@ -562,9 +562,9 @@ class __func<_F, _Alloc, _R(_A0, _A1, _A2)>
|
||||
{
|
||||
__compressed_pair<_F, _Alloc> __f_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __func(_F __f) : __f_(_STD::move(__f)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __func(_F __f) : __f_(_VSTD::move(__f)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __func(_F __f, _Alloc __a)
|
||||
: __f_(_STD::move(__f), _STD::move(__a)) {}
|
||||
: __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
|
||||
virtual __base<_R(_A0, _A1, _A2)>* __clone() const;
|
||||
virtual void __clone(__base<_R(_A0, _A1, _A2)>*) const;
|
||||
virtual void destroy();
|
||||
@@ -831,7 +831,7 @@ typename enable_if
|
||||
>::type
|
||||
function<_R()>::operator=(_F __f)
|
||||
{
|
||||
function(_STD::move(__f)).swap(*this);
|
||||
function(_VSTD::move(__f)).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -878,7 +878,7 @@ function<_R()>::swap(function& __f)
|
||||
__f_ = (__base*)&__buf_;
|
||||
}
|
||||
else
|
||||
_STD::swap(__f_, __f.__f_);
|
||||
_VSTD::swap(__f_, __f.__f_);
|
||||
}
|
||||
|
||||
template<class _R>
|
||||
@@ -1133,7 +1133,7 @@ typename enable_if
|
||||
>::type
|
||||
function<_R(_A0)>::operator=(_F __f)
|
||||
{
|
||||
function(_STD::move(__f)).swap(*this);
|
||||
function(_VSTD::move(__f)).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -1180,7 +1180,7 @@ function<_R(_A0)>::swap(function& __f)
|
||||
__f_ = (__base*)&__buf_;
|
||||
}
|
||||
else
|
||||
_STD::swap(__f_, __f.__f_);
|
||||
_VSTD::swap(__f_, __f.__f_);
|
||||
}
|
||||
|
||||
template<class _R, class _A0>
|
||||
@@ -1435,7 +1435,7 @@ typename enable_if
|
||||
>::type
|
||||
function<_R(_A0, _A1)>::operator=(_F __f)
|
||||
{
|
||||
function(_STD::move(__f)).swap(*this);
|
||||
function(_VSTD::move(__f)).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -1482,7 +1482,7 @@ function<_R(_A0, _A1)>::swap(function& __f)
|
||||
__f_ = (__base*)&__buf_;
|
||||
}
|
||||
else
|
||||
_STD::swap(__f_, __f.__f_);
|
||||
_VSTD::swap(__f_, __f.__f_);
|
||||
}
|
||||
|
||||
template<class _R, class _A0, class _A1>
|
||||
@@ -1737,7 +1737,7 @@ typename enable_if
|
||||
>::type
|
||||
function<_R(_A0, _A1, _A2)>::operator=(_F __f)
|
||||
{
|
||||
function(_STD::move(__f)).swap(*this);
|
||||
function(_VSTD::move(__f)).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -1784,7 +1784,7 @@ function<_R(_A0, _A1, _A2)>::swap(function& __f)
|
||||
__f_ = (__base*)&__buf_;
|
||||
}
|
||||
else
|
||||
_STD::swap(__f_, __f.__f_);
|
||||
_VSTD::swap(__f_, __f.__f_);
|
||||
}
|
||||
|
||||
template<class _R, class _A0, class _A1, class _A2>
|
||||
@@ -1909,7 +1909,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename __mu_return1<true, _Ti, _Uj...>::type
|
||||
__mu_expand(_Ti& __ti, tuple<_Uj...>&& __uj, __tuple_indices<_Indx...>)
|
||||
{
|
||||
__ti(_STD::forward<typename tuple_element<_Indx, _Uj>::type>(get<_Indx>(__uj))...);
|
||||
__ti(_VSTD::forward<typename tuple_element<_Indx, _Uj>::type>(get<_Indx>(__uj))...);
|
||||
}
|
||||
|
||||
template <class _Ti, class ..._Uj>
|
||||
@@ -1947,7 +1947,7 @@ __mu(_Ti&, _Uj& __uj)
|
||||
// compiler bug workaround
|
||||
typename tuple_element<_Indx, _Uj>::type __t = get<_Indx>(__uj);
|
||||
return __t;
|
||||
// return _STD::forward<typename tuple_element<_Indx, _Uj>::type>(get<_Indx>(__uj));
|
||||
// return _VSTD::forward<typename tuple_element<_Indx, _Uj>::type>(get<_Indx>(__uj));
|
||||
}
|
||||
|
||||
template <class _Ti, class _Uj>
|
||||
@@ -2051,8 +2051,8 @@ class __bind
|
||||
public:
|
||||
template <class _G, class ..._BA>
|
||||
explicit __bind(_G&& __f, _BA&& ...__bound_args)
|
||||
: __f_(_STD::forward<_G>(__f)),
|
||||
__bound_args_(_STD::forward<_BA>(__bound_args)...) {}
|
||||
: __f_(_VSTD::forward<_G>(__f)),
|
||||
__bound_args_(_VSTD::forward<_BA>(__bound_args)...) {}
|
||||
|
||||
template <class ..._Args>
|
||||
typename __bind_return<_F, tuple<_BoundArgs...>, tuple<_Args&&...> >::type
|
||||
@@ -2085,21 +2085,21 @@ public:
|
||||
|
||||
template <class _G, class ..._BA>
|
||||
explicit __bind_r(_G&& __f, _BA&& ...__bound_args)
|
||||
: base(_STD::forward<_G>(__f),
|
||||
_STD::forward<_BA>(__bound_args)...) {}
|
||||
: base(_VSTD::forward<_G>(__f),
|
||||
_VSTD::forward<_BA>(__bound_args)...) {}
|
||||
|
||||
template <class ..._Args>
|
||||
result_type
|
||||
operator()(_Args&& ...__args)
|
||||
{
|
||||
return base::operator()(_STD::forward<_Args>(__args)...);
|
||||
return base::operator()(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class ..._Args>
|
||||
result_type
|
||||
operator()(_Args&& ...__args) const
|
||||
{
|
||||
return base::operator()(_STD::forward<_Args>(__args)...);
|
||||
return base::operator()(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2112,7 +2112,7 @@ __bind<typename decay<_F>::type, typename decay<_BoundArgs>::type...>
|
||||
bind(_F&& __f, _BoundArgs&&... __bound_args)
|
||||
{
|
||||
typedef __bind<typename decay<_F>::type, typename decay<_BoundArgs>::type...> type;
|
||||
return type(_STD::forward<_F>(__f), _STD::forward<_BoundArgs>(__bound_args)...);
|
||||
return type(_VSTD::forward<_F>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...);
|
||||
}
|
||||
|
||||
template<class _R, class _F, class ..._BoundArgs>
|
||||
@@ -2121,7 +2121,7 @@ __bind_r<_R, typename decay<_F>::type, typename decay<_BoundArgs>::type...>
|
||||
bind(_F&& __f, _BoundArgs&&... __bound_args)
|
||||
{
|
||||
typedef __bind_r<_R, typename decay<_F>::type, typename decay<_BoundArgs>::type...> type;
|
||||
return type(_STD::forward<_F>(__f), _STD::forward<_BoundArgs>(__bound_args)...);
|
||||
return type(_VSTD::forward<_F>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
@@ -281,167 +281,61 @@ struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const volatile>
|
||||
|
||||
// __invoke
|
||||
|
||||
// first bullet
|
||||
// bullets 1 and 2
|
||||
|
||||
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
|
||||
template <class _F, class _A0, class ..._Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
sizeof...(_Param) == sizeof...(_Arg) &&
|
||||
is_base_of<_T, typename remove_reference<_T1>::type>::value,
|
||||
_R
|
||||
>::type
|
||||
__invoke(_R (_T::*__f)(_Param...), _T1&& __t1, _Arg&& ...__arg)
|
||||
auto
|
||||
__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
|
||||
-> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...))
|
||||
{
|
||||
return (_STD::forward<_T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
|
||||
return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
|
||||
template <class _F, class _A0, class ..._Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
sizeof...(_Param) == sizeof...(_Arg) &&
|
||||
is_base_of<_T, typename remove_reference<_T1>::type>::value,
|
||||
_R
|
||||
>::type
|
||||
__invoke(_R (_T::*__f)(_Param...) const, _T1&& __t1, _Arg&& ...__arg)
|
||||
auto
|
||||
__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
|
||||
-> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...))
|
||||
{
|
||||
return (_STD::forward<const _T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
|
||||
return ((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
|
||||
// bullets 3 and 4
|
||||
|
||||
template <class _F, class _A0>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
sizeof...(_Param) == sizeof...(_Arg) &&
|
||||
is_base_of<_T, typename remove_reference<_T1>::type>::value,
|
||||
_R
|
||||
>::type
|
||||
__invoke(_R (_T::*__f)(_Param...) volatile, _T1&& __t1, _Arg&& ...__arg)
|
||||
auto
|
||||
__invoke(_F&& __f, _A0&& __a0)
|
||||
-> decltype(_VSTD::forward<_A0>(__a0).*__f)
|
||||
{
|
||||
return (_STD::forward<volatile _T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
|
||||
return _VSTD::forward<_A0>(__a0).*__f;
|
||||
}
|
||||
|
||||
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
|
||||
template <class _F, class _A0>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
sizeof...(_Param) == sizeof...(_Arg) &&
|
||||
is_base_of<_T, typename remove_reference<_T1>::type>::value,
|
||||
_R
|
||||
>::type
|
||||
__invoke(_R (_T::*__f)(_Param...) const volatile, _T1&& __t1, _Arg&& ...__arg)
|
||||
auto
|
||||
__invoke(_F&& __f, _A0&& __a0)
|
||||
-> decltype((*_VSTD::forward<_A0>(__a0)).*__f)
|
||||
{
|
||||
return (_STD::forward<const volatile _T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
|
||||
return (*_VSTD::forward<_A0>(__a0)).*__f;
|
||||
}
|
||||
|
||||
// second bullet
|
||||
// bullet 5
|
||||
|
||||
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
|
||||
template <class _F, class ..._Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
sizeof...(_Param) == sizeof...(_Arg) &&
|
||||
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
|
||||
_R
|
||||
>::type
|
||||
__invoke(_R (_T::*__f)(_Param...), _T1&& __t1, _Arg&& ...__arg)
|
||||
auto
|
||||
__invoke(_F&& __f, _Args&& ...__args)
|
||||
-> decltype(_VSTD::forward<_F>(__f)(_VSTD::forward<_Args>(__args)...))
|
||||
{
|
||||
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
|
||||
}
|
||||
|
||||
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
sizeof...(_Param) == sizeof...(_Arg) &&
|
||||
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
|
||||
_R
|
||||
>::type
|
||||
__invoke(_R (_T::*__f)(_Param...) const, _T1&& __t1, _Arg&& ...__arg)
|
||||
{
|
||||
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
|
||||
}
|
||||
|
||||
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
sizeof...(_Param) == sizeof...(_Arg) &&
|
||||
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
|
||||
_R
|
||||
>::type
|
||||
__invoke(_R (_T::*__f)(_Param...) volatile, _T1&& __t1, _Arg&& ...__arg)
|
||||
{
|
||||
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
|
||||
}
|
||||
|
||||
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
sizeof...(_Param) == sizeof...(_Arg) &&
|
||||
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
|
||||
_R
|
||||
>::type
|
||||
__invoke(_R (_T::*__f)(_Param...) const volatile, _T1&& __t1, _Arg&& ...__arg)
|
||||
{
|
||||
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
|
||||
}
|
||||
|
||||
// third bullet
|
||||
|
||||
template <class _R, class _T, class _T1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_base_of<_T, typename remove_reference<_T1>::type>::value,
|
||||
typename __apply_cv<_T1, _R>::type&&
|
||||
>::type
|
||||
__invoke(_R _T::* __f, _T1&& __t1)
|
||||
{
|
||||
return _STD::forward<_T1>(__t1).*__f;
|
||||
}
|
||||
|
||||
// forth bullet
|
||||
|
||||
template <class _T1, class _R, bool>
|
||||
struct __4th_helper
|
||||
{
|
||||
};
|
||||
|
||||
template <class _T1, class _R>
|
||||
struct __4th_helper<_T1, _R, true>
|
||||
{
|
||||
typedef typename __apply_cv<decltype(*_STD::declval<_T1>()), _R>::type type;
|
||||
};
|
||||
|
||||
template <class _R, class _T, class _T1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename __4th_helper<_T1, _R,
|
||||
!is_base_of<_T,
|
||||
typename remove_reference<_T1>::type
|
||||
>::value
|
||||
>::type&&
|
||||
__invoke(_R _T::* __f, _T1&& __t1)
|
||||
{
|
||||
return (*_STD::forward<_T1>(__t1)).*__f;
|
||||
}
|
||||
|
||||
// fifth bullet
|
||||
|
||||
template <class _F, class ..._T>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename result_of<_F(_T...)>::type
|
||||
__invoke(_F&& __f, _T&& ...__t)
|
||||
{
|
||||
return _STD::forward<_F>(__f)(_STD::forward<_T>(__t)...);
|
||||
return _VSTD::forward<_F>(__f)(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class _Tp, class ..._Args>
|
||||
struct __invoke_return
|
||||
{
|
||||
typedef decltype(__invoke(_STD::declval<_Tp>(), _STD::declval<_Args>()...)) type;
|
||||
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
@@ -456,22 +350,22 @@ private:
|
||||
|
||||
public:
|
||||
// construct/copy/destroy
|
||||
_LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) : __f_(&__f) {}
|
||||
_LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT : __f_(&__f) {}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
private: reference_wrapper(type&&); public: // = delete; // do not bind to temps
|
||||
#endif
|
||||
|
||||
// access
|
||||
_LIBCPP_INLINE_VISIBILITY operator type& () const {return *__f_;}
|
||||
_LIBCPP_INLINE_VISIBILITY type& get() const {return *__f_;}
|
||||
_LIBCPP_INLINE_VISIBILITY operator type& () const _NOEXCEPT {return *__f_;}
|
||||
_LIBCPP_INLINE_VISIBILITY type& get() const _NOEXCEPT {return *__f_;}
|
||||
|
||||
// invoke
|
||||
template <class... _ArgTypes>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return<type&, _ArgTypes...>::type
|
||||
typename __invoke_of<type&, _ArgTypes...>::type
|
||||
operator() (_ArgTypes&&... __args) const
|
||||
{
|
||||
return __invoke(get(), _STD::forward<_ArgTypes>(__args)...);
|
||||
return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -483,7 +377,7 @@ template <class _Tp> struct __is_reference_wrapper
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
reference_wrapper<_Tp>
|
||||
ref(_Tp& __t)
|
||||
ref(_Tp& __t) _NOEXCEPT
|
||||
{
|
||||
return reference_wrapper<_Tp>(__t);
|
||||
}
|
||||
@@ -491,7 +385,7 @@ ref(_Tp& __t)
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
reference_wrapper<_Tp>
|
||||
ref(reference_wrapper<_Tp> __t)
|
||||
ref(reference_wrapper<_Tp> __t) _NOEXCEPT
|
||||
{
|
||||
return ref(__t.get());
|
||||
}
|
||||
@@ -499,7 +393,7 @@ ref(reference_wrapper<_Tp> __t)
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
reference_wrapper<const _Tp>
|
||||
cref(const _Tp& __t)
|
||||
cref(const _Tp& __t) _NOEXCEPT
|
||||
{
|
||||
return reference_wrapper<const _Tp>(__t);
|
||||
}
|
||||
@@ -507,7 +401,7 @@ cref(const _Tp& __t)
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
reference_wrapper<const _Tp>
|
||||
cref(reference_wrapper<_Tp> __t)
|
||||
cref(reference_wrapper<_Tp> __t) _NOEXCEPT
|
||||
{
|
||||
return cref(__t.get());
|
||||
}
|
||||
|
||||
@@ -842,7 +842,7 @@ struct __4th_helper
|
||||
template <class _T1, class _R>
|
||||
struct __4th_helper<_T1, _R, true>
|
||||
{
|
||||
typedef typename __apply_cv<decltype(*_STD::declval<_T1>()), _R>::type type;
|
||||
typedef typename __apply_cv<decltype(*_VSTD::declval<_T1>()), _R>::type type;
|
||||
};
|
||||
|
||||
template <class _R, class _T, class _T1>
|
||||
@@ -959,13 +959,13 @@ struct __invoke_return
|
||||
template <class _F>
|
||||
struct __invoke_return<_F, false>
|
||||
{
|
||||
typedef decltype(__invoke(_STD::declval<_F>())) type;
|
||||
typedef decltype(__invoke(_VSTD::declval<_F>())) type;
|
||||
};
|
||||
|
||||
template <class _Tp, class _A0>
|
||||
struct __invoke_return0
|
||||
{
|
||||
typedef decltype(__invoke(_STD::declval<_Tp>(), _STD::declval<_A0>())) type;
|
||||
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_A0>())) type;
|
||||
};
|
||||
|
||||
template <class _R, class _T, class _A0>
|
||||
@@ -983,16 +983,16 @@ struct __invoke_return0<_R _T::*, _A0*>
|
||||
template <class _Tp, class _A0, class _A1>
|
||||
struct __invoke_return1
|
||||
{
|
||||
typedef decltype(__invoke(_STD::declval<_Tp>(), _STD::declval<_A0>(),
|
||||
_STD::declval<_A1>())) type;
|
||||
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_A0>(),
|
||||
_VSTD::declval<_A1>())) type;
|
||||
};
|
||||
|
||||
template <class _Tp, class _A0, class _A1, class _A2>
|
||||
struct __invoke_return2
|
||||
{
|
||||
typedef decltype(__invoke(_STD::declval<_Tp>(), _STD::declval<_A0>(),
|
||||
_STD::declval<_A1>(),
|
||||
_STD::declval<_A2>())) type;
|
||||
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_A0>(),
|
||||
_VSTD::declval<_A1>(),
|
||||
_VSTD::declval<_A2>())) type;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
|
||||
@@ -23,17 +23,17 @@
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_VISIBLE
|
||||
size_t __next_prime(size_t);
|
||||
size_t __next_prime(size_t __n);
|
||||
|
||||
template <class _NodePtr>
|
||||
struct __hash_node_base
|
||||
{
|
||||
typedef __hash_node_base __first_node;
|
||||
typedef _NodePtr pointer;
|
||||
// typedef _NodePtr pointer;
|
||||
|
||||
pointer __next_;
|
||||
_NodePtr __next_;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_node_base() : __next_(nullptr) {}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_node_base() _NOEXCEPT : __next_(nullptr) {}
|
||||
};
|
||||
|
||||
template <class _Tp, class _VoidPtr>
|
||||
@@ -54,11 +54,12 @@ struct __hash_node
|
||||
value_type __value_;
|
||||
};
|
||||
|
||||
template <class, class, class, class> class __hash_table;
|
||||
template <class> class __hash_const_iterator;
|
||||
template <class> class __hash_map_iterator;
|
||||
template <class> class __hash_map_const_iterator;
|
||||
template <class, class, class, class, class> class _LIBCPP_VISIBLE unordered_map;
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc> class __hash_table;
|
||||
template <class _ConstNodePtr> class __hash_const_iterator;
|
||||
template <class _HashIterator> class __hash_map_iterator;
|
||||
template <class _HashIterator> class __hash_map_const_iterator;
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
class _LIBCPP_VISIBLE unordered_map;
|
||||
|
||||
template <class _NodePtr>
|
||||
class _LIBCPP_VISIBLE __hash_iterator
|
||||
@@ -80,12 +81,12 @@ public:
|
||||
#endif
|
||||
pointer;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_iterator() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_iterator() _NOEXCEPT {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {return __node_->__value_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer operator->() const {return addressof(__node_->__value_);}
|
||||
pointer operator->() const {return _VSTD::addressof(__node_->__value_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_iterator& operator++()
|
||||
@@ -111,7 +112,7 @@ public:
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_iterator(__node_pointer __node)
|
||||
__hash_iterator(__node_pointer __node) _NOEXCEPT
|
||||
: __node_(__node)
|
||||
{}
|
||||
|
||||
@@ -154,16 +155,16 @@ public:
|
||||
__non_const_node_pointer;
|
||||
typedef __hash_iterator<__non_const_node_pointer> __non_const_iterator;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_const_iterator() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_const_iterator() _NOEXCEPT {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_const_iterator(const __non_const_iterator& __x)
|
||||
__hash_const_iterator(const __non_const_iterator& __x) _NOEXCEPT
|
||||
: __node_(__x.__node_)
|
||||
{}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {return __node_->__value_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer operator->() const {return addressof(__node_->__value_);}
|
||||
pointer operator->() const {return _VSTD::addressof(__node_->__value_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_const_iterator& operator++()
|
||||
@@ -189,7 +190,7 @@ public:
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_const_iterator(__node_pointer __node)
|
||||
__hash_const_iterator(__node_pointer __node) _NOEXCEPT
|
||||
: __node_(__node)
|
||||
{}
|
||||
|
||||
@@ -199,7 +200,7 @@ private:
|
||||
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE unordered_multimap;
|
||||
};
|
||||
|
||||
template <class> class _LIBCPP_VISIBLE __hash_const_local_iterator;
|
||||
template <class _ConstNodePtr> class _LIBCPP_VISIBLE __hash_const_local_iterator;
|
||||
|
||||
template <class _NodePtr>
|
||||
class _LIBCPP_VISIBLE __hash_local_iterator
|
||||
@@ -224,7 +225,7 @@ public:
|
||||
#endif
|
||||
pointer;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_local_iterator() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_local_iterator() _NOEXCEPT {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {return __node_->__value_;}
|
||||
@@ -258,7 +259,7 @@ public:
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_local_iterator(__node_pointer __node, size_t __bucket,
|
||||
size_t __bucket_count)
|
||||
size_t __bucket_count) _NOEXCEPT
|
||||
: __node_(__node),
|
||||
__bucket_(__bucket),
|
||||
__bucket_count_(__bucket_count)
|
||||
@@ -308,9 +309,9 @@ public:
|
||||
#endif
|
||||
pointer;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_const_local_iterator() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_const_local_iterator() _NOEXCEPT {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_const_local_iterator(const __non_const_iterator& __x)
|
||||
__hash_const_local_iterator(const __non_const_iterator& __x) _NOEXCEPT
|
||||
: __node_(__x.__node_),
|
||||
__bucket_(__x.__bucket_),
|
||||
__bucket_count_(__x.__bucket_count_)
|
||||
@@ -348,7 +349,7 @@ public:
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_const_local_iterator(__node_pointer __node, size_t __bucket,
|
||||
size_t __bucket_count)
|
||||
size_t __bucket_count) _NOEXCEPT
|
||||
: __node_(__node),
|
||||
__bucket_(__bucket),
|
||||
__bucket_count_(__bucket_count)
|
||||
@@ -374,37 +375,44 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bucket_list_deallocator()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
||||
: __data_(0) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bucket_list_deallocator(const allocator_type& __a, size_type __size)
|
||||
_NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
|
||||
: __data_(__size, __a) {}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bucket_list_deallocator(__bucket_list_deallocator&& __x)
|
||||
: __data_(_STD::move(__x.__data_))
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
|
||||
: __data_(_VSTD::move(__x.__data_))
|
||||
{
|
||||
__x.size() = 0;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY size_type& size() {return __data_.first();}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type size() const {return __data_.first();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY allocator_type& __alloc() {return __data_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY const allocator_type& __alloc() const {return __data_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type& size() _NOEXCEPT {return __data_.first();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const _NOEXCEPT {return __data_.first();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void operator()(pointer __p)
|
||||
allocator_type& __alloc() _NOEXCEPT {return __data_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const allocator_type& __alloc() const _NOEXCEPT {return __data_.second();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void operator()(pointer __p) _NOEXCEPT
|
||||
{
|
||||
__alloc_traits::deallocate(__alloc(), __p, size());
|
||||
}
|
||||
};
|
||||
|
||||
template <class> class __hash_map_node_destructor;
|
||||
template <class _Alloc> class __hash_map_node_destructor;
|
||||
|
||||
template <class _Alloc>
|
||||
class __hash_node_destructor
|
||||
@@ -424,16 +432,17 @@ public:
|
||||
bool __value_constructed;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __hash_node_destructor(allocator_type& __na)
|
||||
explicit __hash_node_destructor(allocator_type& __na,
|
||||
bool __constructed = false) _NOEXCEPT
|
||||
: __na_(__na),
|
||||
__value_constructed(false)
|
||||
__value_constructed(__constructed)
|
||||
{}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void operator()(pointer __p)
|
||||
void operator()(pointer __p) _NOEXCEPT
|
||||
{
|
||||
if (__value_constructed)
|
||||
__alloc_traits::destroy(__na_, addressof(__p->__value_));
|
||||
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_));
|
||||
if (__p)
|
||||
__alloc_traits::deallocate(__na_, __p, 1);
|
||||
}
|
||||
@@ -495,21 +504,32 @@ private:
|
||||
__compressed_pair<float, key_equal> __p3_;
|
||||
// --- Member data end ---
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY size_type& size() {return __p2_.first();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type& size() _NOEXCEPT {return __p2_.first();}
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY size_type size() const {return __p2_.first();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const _NOEXCEPT {return __p2_.first();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY hasher& hash_function() {return __p2_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY const hasher& hash_function() const {return __p2_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hasher& hash_function() _NOEXCEPT {return __p2_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const hasher& hash_function() const _NOEXCEPT {return __p2_.second();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY float& max_load_factor() {return __p3_.first();}
|
||||
_LIBCPP_INLINE_VISIBILITY float max_load_factor() const {return __p3_.first();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
float& max_load_factor() _NOEXCEPT {return __p3_.first();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
float max_load_factor() const _NOEXCEPT {return __p3_.first();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY key_equal& key_eq() {return __p3_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY const key_equal& key_eq() const {return __p3_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
key_equal& key_eq() _NOEXCEPT {return __p3_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const key_equal& key_eq() const _NOEXCEPT {return __p3_.second();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __node_allocator& __node_alloc() {return __p1_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY const __node_allocator& __node_alloc() const {return __p1_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__node_allocator& __node_alloc() _NOEXCEPT {return __p1_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const __node_allocator& __node_alloc() const _NOEXCEPT
|
||||
{return __p1_.second();}
|
||||
|
||||
public:
|
||||
typedef __hash_iterator<__node_pointer> iterator;
|
||||
@@ -517,7 +537,13 @@ public:
|
||||
typedef __hash_local_iterator<__node_pointer> local_iterator;
|
||||
typedef __hash_const_local_iterator<__node_const_pointer> const_local_iterator;
|
||||
|
||||
__hash_table();
|
||||
__hash_table()
|
||||
_NOEXCEPT_(
|
||||
is_nothrow_default_constructible<__bucket_list>::value &&
|
||||
is_nothrow_default_constructible<__first_node>::value &&
|
||||
is_nothrow_default_constructible<__node_allocator>::value &&
|
||||
is_nothrow_default_constructible<hasher>::value &&
|
||||
is_nothrow_default_constructible<key_equal>::value);
|
||||
__hash_table(const hasher& __hf, const key_equal& __eql);
|
||||
__hash_table(const hasher& __hf, const key_equal& __eql,
|
||||
const allocator_type& __a);
|
||||
@@ -525,14 +551,25 @@ public:
|
||||
__hash_table(const __hash_table& __u);
|
||||
__hash_table(const __hash_table& __u, const allocator_type& __a);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__hash_table(__hash_table&& __u);
|
||||
__hash_table(__hash_table&& __u)
|
||||
_NOEXCEPT_(
|
||||
is_nothrow_move_constructible<__bucket_list>::value &&
|
||||
is_nothrow_move_constructible<__first_node>::value &&
|
||||
is_nothrow_move_constructible<__node_allocator>::value &&
|
||||
is_nothrow_move_constructible<hasher>::value &&
|
||||
is_nothrow_move_constructible<key_equal>::value);
|
||||
__hash_table(__hash_table&& __u, const allocator_type& __a);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
~__hash_table();
|
||||
|
||||
__hash_table& operator=(const __hash_table& __u);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__hash_table& operator=(__hash_table&& __u);
|
||||
__hash_table& operator=(__hash_table&& __u)
|
||||
_NOEXCEPT_(
|
||||
__node_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<__node_allocator>::value &&
|
||||
is_nothrow_move_assignable<hasher>::value &&
|
||||
is_nothrow_move_assignable<key_equal>::value);
|
||||
#endif
|
||||
template <class _InputIterator>
|
||||
void __assign_unique(_InputIterator __first, _InputIterator __last);
|
||||
@@ -540,7 +577,7 @@ public:
|
||||
void __assign_multi(_InputIterator __first, _InputIterator __last);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const
|
||||
size_type max_size() const _NOEXCEPT
|
||||
{
|
||||
return allocator_traits<__pointer_allocator>::max_size(
|
||||
__bucket_list_.get_deleter().__alloc());
|
||||
@@ -577,21 +614,21 @@ public:
|
||||
iterator __insert_multi(const_iterator __p, const value_type& __x);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
void clear();
|
||||
void clear() _NOEXCEPT;
|
||||
void rehash(size_type __n);
|
||||
_LIBCPP_INLINE_VISIBILITY void reserve(size_type __n)
|
||||
{rehash(static_cast<size_type>(ceil(__n / max_load_factor())));}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_count() const
|
||||
size_type bucket_count() const _NOEXCEPT
|
||||
{
|
||||
return __bucket_list_.get_deleter().size();
|
||||
}
|
||||
|
||||
iterator begin();
|
||||
iterator end();
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
iterator begin() _NOEXCEPT;
|
||||
iterator end() _NOEXCEPT;
|
||||
const_iterator begin() const _NOEXCEPT;
|
||||
const_iterator end() const _NOEXCEPT;
|
||||
|
||||
template <class _Key>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -612,7 +649,7 @@ public:
|
||||
size_type __erase_unique(const _Key& __k);
|
||||
template <class _Key>
|
||||
size_type __erase_multi(const _Key& __k);
|
||||
__node_holder remove(const_iterator __p);
|
||||
__node_holder remove(const_iterator __p) _NOEXCEPT;
|
||||
|
||||
template <class _Key>
|
||||
size_type __count_unique(const _Key& __k) const;
|
||||
@@ -633,19 +670,26 @@ public:
|
||||
pair<const_iterator, const_iterator>
|
||||
__equal_range_multi(const _Key& __k) const;
|
||||
|
||||
void swap(__hash_table& __u);
|
||||
void swap(__hash_table& __u)
|
||||
_NOEXCEPT_(
|
||||
(!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__pointer_allocator>::value) &&
|
||||
(!__node_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value) &&
|
||||
__is_nothrow_swappable<hasher>::value &&
|
||||
__is_nothrow_swappable<key_equal>::value);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_bucket_count() const
|
||||
size_type max_bucket_count() const _NOEXCEPT
|
||||
{return __bucket_list_.get_deleter().__alloc().max_size();}
|
||||
size_type bucket_size(size_type __n) const;
|
||||
_LIBCPP_INLINE_VISIBILITY float load_factor() const
|
||||
_LIBCPP_INLINE_VISIBILITY float load_factor() const _NOEXCEPT
|
||||
{
|
||||
size_type __bc = bucket_count();
|
||||
return __bc != 0 ? (float)size() / __bc : 0.f;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY void max_load_factor(float __mlf)
|
||||
{max_load_factor() = _STD::max(__mlf, load_factor());}
|
||||
_LIBCPP_INLINE_VISIBILITY void max_load_factor(float __mlf) _NOEXCEPT
|
||||
{max_load_factor() = _VSTD::max(__mlf, load_factor());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY local_iterator begin(size_type __n)
|
||||
{return local_iterator(__bucket_list_[__n], __n, bucket_count());}
|
||||
@@ -678,25 +722,40 @@ private:
|
||||
void __copy_assign_alloc(const __hash_table& __u, false_type) {}
|
||||
|
||||
void __move_assign(__hash_table& __u, false_type);
|
||||
void __move_assign(__hash_table& __u, true_type);
|
||||
_LIBCPP_INLINE_VISIBILITY void __move_assign_alloc(__hash_table& __u)
|
||||
void __move_assign(__hash_table& __u, true_type)
|
||||
_NOEXCEPT_(
|
||||
is_nothrow_move_assignable<__node_allocator>::value &&
|
||||
is_nothrow_move_assignable<hasher>::value &&
|
||||
is_nothrow_move_assignable<key_equal>::value);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__hash_table& __u)
|
||||
_NOEXCEPT_(
|
||||
!__node_traits::propagate_on_container_move_assignment::value ||
|
||||
(is_nothrow_move_assignable<__pointer_allocator>::value &&
|
||||
is_nothrow_move_assignable<__node_allocator>::value))
|
||||
{__move_assign_alloc(__u, integral_constant<bool,
|
||||
__node_traits::propagate_on_container_move_assignment::value>());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__hash_table& __u, true_type)
|
||||
_NOEXCEPT_(
|
||||
is_nothrow_move_assignable<__pointer_allocator>::value &&
|
||||
is_nothrow_move_assignable<__node_allocator>::value)
|
||||
{
|
||||
__bucket_list_.get_deleter().__alloc() =
|
||||
_STD::move(__u.__bucket_list_.get_deleter().__alloc());
|
||||
__node_alloc() = _STD::move(__u.__node_alloc());
|
||||
_VSTD::move(__u.__bucket_list_.get_deleter().__alloc());
|
||||
__node_alloc() = _VSTD::move(__u.__node_alloc());
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__hash_table&, false_type) {}
|
||||
void __move_assign_alloc(__hash_table&, false_type) _NOEXCEPT {}
|
||||
|
||||
template <class _A>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static
|
||||
void
|
||||
__swap_alloc(_A& __x, _A& __y)
|
||||
_NOEXCEPT_(
|
||||
!allocator_traits<_A>::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<_A>::value)
|
||||
{
|
||||
__swap_alloc(__x, __y,
|
||||
integral_constant<bool,
|
||||
@@ -709,8 +768,9 @@ private:
|
||||
static
|
||||
void
|
||||
__swap_alloc(_A& __x, _A& __y, true_type)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_A>::value)
|
||||
{
|
||||
using _STD::swap;
|
||||
using _VSTD::swap;
|
||||
swap(__x, __y);
|
||||
}
|
||||
|
||||
@@ -718,15 +778,20 @@ private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static
|
||||
void
|
||||
__swap_alloc(_A& __x, _A& __y, false_type) {}
|
||||
__swap_alloc(_A& __x, _A& __y, false_type) _NOEXCEPT {}
|
||||
|
||||
void __deallocate(__node_pointer __np);
|
||||
__node_pointer __detach();
|
||||
void __deallocate(__node_pointer __np) _NOEXCEPT;
|
||||
__node_pointer __detach() _NOEXCEPT;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table()
|
||||
_NOEXCEPT_(
|
||||
is_nothrow_default_constructible<__bucket_list>::value &&
|
||||
is_nothrow_default_constructible<__first_node>::value &&
|
||||
is_nothrow_default_constructible<hasher>::value &&
|
||||
is_nothrow_default_constructible<key_equal>::value)
|
||||
: __p2_(0),
|
||||
__p3_(1.0f)
|
||||
{
|
||||
@@ -790,15 +855,20 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u,
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u)
|
||||
: __bucket_list_(_STD::move(__u.__bucket_list_)),
|
||||
__p1_(_STD::move(__u.__p1_)),
|
||||
__p2_(_STD::move(__u.__p2_)),
|
||||
__p3_(_STD::move(__u.__p3_))
|
||||
_NOEXCEPT_(
|
||||
is_nothrow_move_constructible<__bucket_list>::value &&
|
||||
is_nothrow_move_constructible<__first_node>::value &&
|
||||
is_nothrow_move_constructible<hasher>::value &&
|
||||
is_nothrow_move_constructible<key_equal>::value)
|
||||
: __bucket_list_(_VSTD::move(__u.__bucket_list_)),
|
||||
__p1_(_VSTD::move(__u.__p1_)),
|
||||
__p2_(_VSTD::move(__u.__p2_)),
|
||||
__p3_(_VSTD::move(__u.__p3_))
|
||||
{
|
||||
if (size() > 0)
|
||||
{
|
||||
__bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
|
||||
static_cast<__node_pointer>(addressof(__p1_.first()));
|
||||
static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
|
||||
__u.__p1_.first().__next_ = nullptr;
|
||||
__u.size() = 0;
|
||||
}
|
||||
@@ -809,8 +879,8 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
|
||||
const allocator_type& __a)
|
||||
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
|
||||
__p1_(__node_allocator(__a)),
|
||||
__p2_(0, _STD::move(__u.hash_function())),
|
||||
__p3_(_STD::move(__u.__p3_))
|
||||
__p2_(0, _VSTD::move(__u.hash_function())),
|
||||
__p3_(_VSTD::move(__u.__p3_))
|
||||
{
|
||||
if (__a == allocator_type(__u.__node_alloc()))
|
||||
{
|
||||
@@ -822,7 +892,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
|
||||
__p1_.first().__next_ = __u.__p1_.first().__next_;
|
||||
__u.__p1_.first().__next_ = nullptr;
|
||||
__bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
|
||||
static_cast<__node_pointer>(addressof(__p1_.first()));
|
||||
static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
|
||||
size() = __u.size();
|
||||
__u.size() = 0;
|
||||
}
|
||||
@@ -870,12 +940,13 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(const __hash_table& __u)
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
void
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate(__node_pointer __np)
|
||||
_NOEXCEPT
|
||||
{
|
||||
__node_allocator& __na = __node_alloc();
|
||||
while (__np != nullptr)
|
||||
{
|
||||
__node_pointer __next = __np->__next_;
|
||||
__node_traits::destroy(__na, addressof(__np->__value_));
|
||||
__node_traits::destroy(__na, _VSTD::addressof(__np->__value_));
|
||||
__node_traits::deallocate(__na, __np, 1);
|
||||
__np = __next;
|
||||
}
|
||||
@@ -883,7 +954,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate(__node_pointer __np)
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_pointer
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__detach()
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__detach() _NOEXCEPT
|
||||
{
|
||||
size_type __bc = bucket_count();
|
||||
for (size_type __i = 0; __i < __bc; ++__i)
|
||||
@@ -900,6 +971,10 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
void
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
|
||||
__hash_table& __u, true_type)
|
||||
_NOEXCEPT_(
|
||||
is_nothrow_move_assignable<__node_allocator>::value &&
|
||||
is_nothrow_move_assignable<hasher>::value &&
|
||||
is_nothrow_move_assignable<key_equal>::value)
|
||||
{
|
||||
clear();
|
||||
__bucket_list_.reset(__u.__bucket_list_.release());
|
||||
@@ -907,14 +982,14 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
|
||||
__u.__bucket_list_.get_deleter().size() = 0;
|
||||
__move_assign_alloc(__u);
|
||||
size() = __u.size();
|
||||
hash_function() = _STD::move(__u.hash_function());
|
||||
hash_function() = _VSTD::move(__u.hash_function());
|
||||
max_load_factor() = __u.max_load_factor();
|
||||
key_eq() = _STD::move(__u.key_eq());
|
||||
key_eq() = _VSTD::move(__u.key_eq());
|
||||
__p1_.first().__next_ = __u.__p1_.first().__next_;
|
||||
if (size() > 0)
|
||||
{
|
||||
__bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
|
||||
static_cast<__node_pointer>(addressof(__p1_.first()));
|
||||
static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
|
||||
__u.__p1_.first().__next_ = nullptr;
|
||||
__u.size() = 0;
|
||||
}
|
||||
@@ -929,8 +1004,8 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
|
||||
__move_assign(__u, true_type());
|
||||
else
|
||||
{
|
||||
hash_function() = _STD::move(__u.hash_function());
|
||||
key_eq() = _STD::move(__u.key_eq());
|
||||
hash_function() = _VSTD::move(__u.hash_function());
|
||||
key_eq() = _VSTD::move(__u.key_eq());
|
||||
max_load_factor() = __u.max_load_factor();
|
||||
if (bucket_count() != 0)
|
||||
{
|
||||
@@ -942,7 +1017,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
|
||||
const_iterator __i = __u.begin();
|
||||
while (__cache != nullptr && __u.size() != 0)
|
||||
{
|
||||
__cache->__value_ = _STD::move(__u.remove(__i++)->__value_);
|
||||
__cache->__value_ = _VSTD::move(__u.remove(__i++)->__value_);
|
||||
__node_pointer __next = __cache->__next_;
|
||||
__node_insert_multi(__cache);
|
||||
__cache = __next;
|
||||
@@ -961,7 +1036,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
|
||||
while (__u.size() != 0)
|
||||
{
|
||||
__node_holder __h =
|
||||
__construct_node(_STD::move(__u.remove(__i++)->__value_));
|
||||
__construct_node(_VSTD::move(__u.remove(__i++)->__value_));
|
||||
__node_insert_multi(__h.get());
|
||||
__h.release();
|
||||
}
|
||||
@@ -972,6 +1047,11 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>&
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(__hash_table&& __u)
|
||||
_NOEXCEPT_(
|
||||
__node_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<__node_allocator>::value &&
|
||||
is_nothrow_move_assignable<hasher>::value &&
|
||||
is_nothrow_move_assignable<key_equal>::value)
|
||||
{
|
||||
__move_assign(__u, integral_constant<bool,
|
||||
__node_traits::propagate_on_container_move_assignment::value>());
|
||||
@@ -1051,7 +1131,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_multi(_InputIterator __first,
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin()
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() _NOEXCEPT
|
||||
{
|
||||
return iterator(__p1_.first().__next_);
|
||||
}
|
||||
@@ -1059,7 +1139,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin()
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::end()
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() _NOEXCEPT
|
||||
{
|
||||
return iterator(nullptr);
|
||||
}
|
||||
@@ -1067,7 +1147,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::end()
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const _NOEXCEPT
|
||||
{
|
||||
return const_iterator(__p1_.first().__next_);
|
||||
}
|
||||
@@ -1075,21 +1155,21 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const _NOEXCEPT
|
||||
{
|
||||
return const_iterator(nullptr);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
void
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::clear()
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::clear() _NOEXCEPT
|
||||
{
|
||||
if (size() > 0)
|
||||
{
|
||||
__deallocate(__p1_.first().__next_);
|
||||
__p1_.first().__next_ = nullptr;
|
||||
size_type __bc = bucket_count();
|
||||
for (size_type __i; __i < __bc; ++__i)
|
||||
for (size_type __i = 0; __i < __bc; ++__i)
|
||||
__bucket_list_[__i] = nullptr;
|
||||
size() = 0;
|
||||
}
|
||||
@@ -1122,7 +1202,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
|
||||
{
|
||||
if (size()+1 > __bc * max_load_factor() || __bc == 0)
|
||||
{
|
||||
rehash(_STD::max<size_type>(2 * __bc + 1,
|
||||
rehash(_VSTD::max<size_type>(2 * __bc + 1,
|
||||
size_type(ceil(float(size() + 1) / max_load_factor()))));
|
||||
__bc = bucket_count();
|
||||
__chash = __nd->__hash_ % __bc;
|
||||
@@ -1131,7 +1211,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
|
||||
__node_pointer __pn = __bucket_list_[__chash];
|
||||
if (__pn == nullptr)
|
||||
{
|
||||
__pn = static_cast<__node_pointer>(addressof(__p1_.first()));
|
||||
__pn = static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
|
||||
__nd->__next_ = __pn->__next_;
|
||||
__pn->__next_ = __nd;
|
||||
// fix up __bucket_list_
|
||||
@@ -1161,7 +1241,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c
|
||||
size_type __bc = bucket_count();
|
||||
if (size()+1 > __bc * max_load_factor() || __bc == 0)
|
||||
{
|
||||
rehash(_STD::max<size_type>(2 * __bc + 1,
|
||||
rehash(_VSTD::max<size_type>(2 * __bc + 1,
|
||||
size_type(ceil(float(size() + 1) / max_load_factor()))));
|
||||
__bc = bucket_count();
|
||||
}
|
||||
@@ -1169,7 +1249,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c
|
||||
__node_pointer __pn = __bucket_list_[__chash];
|
||||
if (__pn == nullptr)
|
||||
{
|
||||
__pn = static_cast<__node_pointer>(addressof(__p1_.first()));
|
||||
__pn = static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
|
||||
__cp->__next_ = __pn->__next_;
|
||||
__pn->__next_ = __cp;
|
||||
// fix up __bucket_list_
|
||||
@@ -1222,7 +1302,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(
|
||||
size_type __bc = bucket_count();
|
||||
if (size()+1 > __bc * max_load_factor() || __bc == 0)
|
||||
{
|
||||
rehash(_STD::max<size_type>(2 * __bc + 1,
|
||||
rehash(_VSTD::max<size_type>(2 * __bc + 1,
|
||||
size_type(ceil(float(size() + 1) / max_load_factor()))));
|
||||
__bc = bucket_count();
|
||||
}
|
||||
@@ -1266,7 +1346,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(const value_type& __x)
|
||||
__node_holder __h = __construct_node(__x, __hash);
|
||||
if (size()+1 > __bc * max_load_factor() || __bc == 0)
|
||||
{
|
||||
rehash(_STD::max<size_type>(2 * __bc + 1,
|
||||
rehash(_VSTD::max<size_type>(2 * __bc + 1,
|
||||
size_type(ceil(float(size() + 1) / max_load_factor()))));
|
||||
__bc = bucket_count();
|
||||
__chash = __hash % __bc;
|
||||
@@ -1275,7 +1355,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(const value_type& __x)
|
||||
__node_pointer __pn = __bucket_list_[__chash];
|
||||
if (__pn == nullptr)
|
||||
{
|
||||
__pn = static_cast<__node_pointer>(addressof(__p1_.first()));
|
||||
__pn = static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
|
||||
__h->__next_ = __pn->__next_;
|
||||
__pn->__next_ = __h.get();
|
||||
// fix up __bucket_list_
|
||||
@@ -1305,7 +1385,7 @@ template <class... _Args>
|
||||
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique(_Args&&... __args)
|
||||
{
|
||||
__node_holder __h = __construct_node(_STD::forward<_Args>(__args)...);
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
|
||||
pair<iterator, bool> __r = __node_insert_unique(__h.get());
|
||||
if (__r.second)
|
||||
__h.release();
|
||||
@@ -1317,7 +1397,7 @@ template <class... _Args>
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_multi(_Args&&... __args)
|
||||
{
|
||||
__node_holder __h = __construct_node(_STD::forward<_Args>(__args)...);
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
|
||||
iterator __r = __node_insert_multi(__h.get());
|
||||
__h.release();
|
||||
return __r;
|
||||
@@ -1329,7 +1409,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi(
|
||||
const_iterator __p, _Args&&... __args)
|
||||
{
|
||||
__node_holder __h = __construct_node(_STD::forward<_Args>(__args)...);
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
|
||||
iterator __r = __node_insert_multi(__p, __h.get());
|
||||
__h.release();
|
||||
return __r;
|
||||
@@ -1342,7 +1422,7 @@ template <class _P>
|
||||
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(_P&& __x)
|
||||
{
|
||||
__node_holder __h = __construct_node(_STD::forward<_P>(__x));
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_P>(__x));
|
||||
pair<iterator, bool> __r = __node_insert_unique(__h.get());
|
||||
if (__r.second)
|
||||
__h.release();
|
||||
@@ -1358,7 +1438,7 @@ template <class _P>
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(_P&& __x)
|
||||
{
|
||||
__node_holder __h = __construct_node(_STD::forward<_P>(__x));
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_P>(__x));
|
||||
iterator __r = __node_insert_multi(__h.get());
|
||||
__h.release();
|
||||
return __r;
|
||||
@@ -1370,7 +1450,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(const_iterator __p,
|
||||
_P&& __x)
|
||||
{
|
||||
__node_holder __h = __construct_node(_STD::forward<_P>(__x));
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_P>(__x));
|
||||
iterator __r = __node_insert_multi(__p, __h.get());
|
||||
__h.release();
|
||||
return __r;
|
||||
@@ -1405,13 +1485,13 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
void
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::rehash(size_type __n)
|
||||
{
|
||||
__n = __next_prime(_STD::max<size_type>(__n, size() > 0));
|
||||
__n = __next_prime(_VSTD::max<size_type>(__n, size() > 0));
|
||||
size_type __bc = bucket_count();
|
||||
if (__n > __bc)
|
||||
__rehash(__n);
|
||||
else
|
||||
{
|
||||
__n = _STD::max<size_type>
|
||||
__n = _VSTD::max<size_type>
|
||||
(
|
||||
__n,
|
||||
__next_prime(size_t(ceil(float(size()) / max_load_factor())))
|
||||
@@ -1433,7 +1513,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __nbc)
|
||||
{
|
||||
for (size_type __i = 0; __i < __nbc; ++__i)
|
||||
__bucket_list_[__i] = nullptr;
|
||||
__node_pointer __pp(static_cast<__node_pointer>(addressof(__p1_.first())));
|
||||
__node_pointer __pp(static_cast<__node_pointer>(_VSTD::addressof(__p1_.first())));
|
||||
__node_pointer __cp = __pp->__next_;
|
||||
if (__cp != nullptr)
|
||||
{
|
||||
@@ -1533,7 +1613,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(_Args&& ...__args)
|
||||
{
|
||||
__node_allocator& __na = __node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_traits::construct(__na, addressof(__h->__value_), _STD::forward<_Args>(__args)...);
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...);
|
||||
__h.get_deleter().__value_constructed = true;
|
||||
__h->__hash_ = hash_function()(__h->__value_);
|
||||
__h->__next_ = nullptr;
|
||||
@@ -1549,11 +1629,11 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(value_type&& __v,
|
||||
{
|
||||
__node_allocator& __na = __node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_traits::construct(__na, addressof(__h->__value_), _STD::move(__v));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
|
||||
__h.get_deleter().__value_constructed = true;
|
||||
__h->__hash_ = __hash;
|
||||
__h->__next_ = nullptr;
|
||||
return _STD::move(__h);
|
||||
return _VSTD::move(__h);
|
||||
}
|
||||
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -1564,11 +1644,11 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v
|
||||
{
|
||||
__node_allocator& __na = __node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_traits::construct(__na, addressof(__h->__value_), __v);
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
|
||||
__h.get_deleter().__value_constructed = true;
|
||||
__h->__hash_ = hash_function()(__h->__value_);
|
||||
__h->__next_ = nullptr;
|
||||
return _STD::move(__h);
|
||||
return _VSTD::move(__h);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -1580,11 +1660,11 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v
|
||||
{
|
||||
__node_allocator& __na = __node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_traits::construct(__na, addressof(__h->__value_), __v);
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
|
||||
__h.get_deleter().__value_constructed = true;
|
||||
__h->__hash_ = __hash;
|
||||
__h->__next_ = nullptr;
|
||||
return _STD::move(__h);
|
||||
return _VSTD::move(__h);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
@@ -1645,7 +1725,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__erase_multi(const _Key& __k)
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p)
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
|
||||
{
|
||||
// current node
|
||||
__node_pointer __cn = const_cast<__node_pointer>(__p.__node_);
|
||||
@@ -1658,7 +1738,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p)
|
||||
// Fix up __bucket_list_
|
||||
// if __pn is not in same bucket (before begin is not in same bucket) &&
|
||||
// if __cn->__next_ is not in same bucket (nullptr is not in same bucket)
|
||||
if (__pn == addressof(__p1_.first()) || __pn->__hash_ % __bc != __chash)
|
||||
if (__pn == _VSTD::addressof(__p1_.first()) || __pn->__hash_ % __bc != __chash)
|
||||
{
|
||||
if (__cn->__next_ == nullptr || __cn->__next_->__hash_ % __bc != __chash)
|
||||
__bucket_list_[__chash] = nullptr;
|
||||
@@ -1674,7 +1754,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p)
|
||||
__pn->__next_ = __cn->__next_;
|
||||
__cn->__next_ = nullptr;
|
||||
--size();
|
||||
return __node_holder(__cn, _D(__node_alloc()));
|
||||
return __node_holder(__cn, _D(__node_alloc(), true));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
@@ -1776,25 +1856,32 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_multi(
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
void
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
|
||||
_NOEXCEPT_(
|
||||
(!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__pointer_allocator>::value) &&
|
||||
(!__node_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value) &&
|
||||
__is_nothrow_swappable<hasher>::value &&
|
||||
__is_nothrow_swappable<key_equal>::value)
|
||||
{
|
||||
{
|
||||
__node_pointer_pointer __npp = __bucket_list_.release();
|
||||
__bucket_list_.reset(__u.__bucket_list_.release());
|
||||
__u.__bucket_list_.reset(__npp);
|
||||
}
|
||||
_STD::swap(__bucket_list_.get_deleter().size(), __u.__bucket_list_.get_deleter().size());
|
||||
_VSTD::swap(__bucket_list_.get_deleter().size(), __u.__bucket_list_.get_deleter().size());
|
||||
__swap_alloc(__bucket_list_.get_deleter().__alloc(),
|
||||
__u.__bucket_list_.get_deleter().__alloc());
|
||||
__swap_alloc(__node_alloc(), __u.__node_alloc());
|
||||
_STD::swap(__p1_.first().__next_, __u.__p1_.first().__next_);
|
||||
_VSTD::swap(__p1_.first().__next_, __u.__p1_.first().__next_);
|
||||
__p2_.swap(__u.__p2_);
|
||||
__p3_.swap(__u.__p3_);
|
||||
if (size() > 0)
|
||||
__bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
|
||||
static_cast<__node_pointer>(addressof(__p1_.first()));
|
||||
static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
|
||||
if (__u.size() > 0)
|
||||
__u.__bucket_list_[__u.__p1_.first().__next_->__hash_ % __u.bucket_count()] =
|
||||
static_cast<__node_pointer>(addressof(__u.__p1_.first()));
|
||||
static_cast<__node_pointer>(_VSTD::addressof(__u.__p1_.first()));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
@@ -1814,6 +1901,16 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::bucket_size(size_type __n) const
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(__hash_table<_Tp, _Hash, _Equal, _Alloc>& __x,
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP__HASH_TABLE
|
||||
|
||||
@@ -27,7 +27,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class locale;
|
||||
|
||||
template <class _Facet> bool has_facet(const locale&) throw();
|
||||
template <class _Facet> bool has_facet(const locale&) _NOEXCEPT;
|
||||
template <class _Facet> const _Facet& use_facet(const locale&);
|
||||
|
||||
class _LIBCPP_VISIBLE locale
|
||||
@@ -49,18 +49,19 @@ public:
|
||||
all = collate | ctype | monetary | numeric | time | messages;
|
||||
|
||||
// construct/copy/destroy:
|
||||
locale() throw();
|
||||
locale(const locale&) throw();
|
||||
locale() _NOEXCEPT;
|
||||
locale(const locale&) _NOEXCEPT;
|
||||
explicit locale(const char*);
|
||||
explicit locale(const string&);
|
||||
locale(const locale&, const char*, category);
|
||||
locale(const locale&, const string&, category);
|
||||
template <class _Facet> locale(const locale&, _Facet*);
|
||||
template <class _Facet>
|
||||
_LIBCPP_INLINE_VISIBILITY locale(const locale&, _Facet*);
|
||||
locale(const locale&, const locale&, category);
|
||||
|
||||
~locale() throw();
|
||||
~locale();
|
||||
|
||||
const locale& operator=(const locale&) throw();
|
||||
const locale& operator=(const locale&) _NOEXCEPT;
|
||||
|
||||
template <class _Facet> locale combine(const locale&) const;
|
||||
|
||||
@@ -85,7 +86,7 @@ private:
|
||||
bool has_facet(id&) const;
|
||||
const facet* use_facet(id&) const;
|
||||
|
||||
template <class _Facet> friend bool has_facet(const locale&) throw();
|
||||
template <class _Facet> friend bool has_facet(const locale&) _NOEXCEPT;
|
||||
template <class _Facet> friend const _Facet& use_facet(const locale&);
|
||||
};
|
||||
|
||||
@@ -102,7 +103,7 @@ protected:
|
||||
// facet(const facet&) = delete; // effectively done in __shared_count
|
||||
// void operator=(const facet&) = delete;
|
||||
private:
|
||||
virtual void __on_zero_shared();
|
||||
virtual void __on_zero_shared() _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_VISIBLE locale::id
|
||||
@@ -136,16 +137,16 @@ locale
|
||||
locale::combine(const locale& __other) const
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (!_STD::has_facet<_Facet>(__other))
|
||||
if (!_VSTD::has_facet<_Facet>(__other))
|
||||
throw runtime_error("locale::combine: locale missing facet");
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return locale(*this, &const_cast<_Facet&>(_STD::use_facet<_Facet>(__other)));
|
||||
return locale(*this, &const_cast<_Facet&>(_VSTD::use_facet<_Facet>(__other)));
|
||||
}
|
||||
|
||||
template <class _Facet>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
has_facet(const locale& __l) throw()
|
||||
has_facet(const locale& __l) _NOEXCEPT
|
||||
{
|
||||
return __l.has_facet(_Facet::id);
|
||||
}
|
||||
@@ -291,7 +292,7 @@ bool
|
||||
locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
|
||||
const basic_string<_CharT, _Traits, _Allocator>& __y) const
|
||||
{
|
||||
return _STD::use_facet<_STD::collate<_CharT> >(*this).compare(
|
||||
return _VSTD::use_facet<_VSTD::collate<_CharT> >(*this).compare(
|
||||
__x.data(), __x.data() + __x.size(),
|
||||
__y.data(), __y.data() + __y.size()) < 0;
|
||||
}
|
||||
@@ -301,7 +302,11 @@ locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
|
||||
class _LIBCPP_VISIBLE ctype_base
|
||||
{
|
||||
public:
|
||||
#ifdef __GLIBC__
|
||||
typedef unsigned short mask;
|
||||
#else
|
||||
typedef __uint32_t mask;
|
||||
#endif
|
||||
|
||||
#if __APPLE__
|
||||
static const mask space = _CTYPE_S;
|
||||
@@ -534,8 +539,12 @@ public:
|
||||
#else
|
||||
static const size_t table_size = 256; // FIXME: Don't hardcode this.
|
||||
#endif
|
||||
_LIBCPP_ALWAYS_INLINE const mask* table() const throw() {return __tab_;}
|
||||
static const mask* classic_table() throw();
|
||||
_LIBCPP_ALWAYS_INLINE const mask* table() const _NOEXCEPT {return __tab_;}
|
||||
static const mask* classic_table() _NOEXCEPT;
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
static const int* __classic_upper_table() _NOEXCEPT;
|
||||
static const int* __classic_lower_table() _NOEXCEPT;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
~ctype();
|
||||
@@ -754,13 +763,13 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
int encoding() const throw()
|
||||
int encoding() const _NOEXCEPT
|
||||
{
|
||||
return do_encoding();
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool always_noconv() const throw()
|
||||
bool always_noconv() const _NOEXCEPT
|
||||
{
|
||||
return do_always_noconv();
|
||||
}
|
||||
@@ -772,7 +781,7 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
int max_length() const throw()
|
||||
int max_length() const _NOEXCEPT
|
||||
{
|
||||
return do_max_length();
|
||||
}
|
||||
@@ -794,10 +803,10 @@ protected:
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_encoding() const _NOEXCEPT;
|
||||
virtual bool do_always_noconv() const _NOEXCEPT;
|
||||
virtual int do_length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
// template <> class codecvt<wchar_t, char, mbstate_t>
|
||||
@@ -839,13 +848,13 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
int encoding() const throw()
|
||||
int encoding() const _NOEXCEPT
|
||||
{
|
||||
return do_encoding();
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool always_noconv() const throw()
|
||||
bool always_noconv() const _NOEXCEPT
|
||||
{
|
||||
return do_always_noconv();
|
||||
}
|
||||
@@ -857,7 +866,7 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
int max_length() const throw()
|
||||
int max_length() const _NOEXCEPT
|
||||
{
|
||||
return do_max_length();
|
||||
}
|
||||
@@ -877,10 +886,10 @@ protected:
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_encoding() const _NOEXCEPT;
|
||||
virtual bool do_always_noconv() const _NOEXCEPT;
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
// template <> class codecvt<char16_t, char, mbstate_t>
|
||||
@@ -923,13 +932,13 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
int encoding() const throw()
|
||||
int encoding() const _NOEXCEPT
|
||||
{
|
||||
return do_encoding();
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool always_noconv() const throw()
|
||||
bool always_noconv() const _NOEXCEPT
|
||||
{
|
||||
return do_always_noconv();
|
||||
}
|
||||
@@ -941,7 +950,7 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
int max_length() const throw()
|
||||
int max_length() const _NOEXCEPT
|
||||
{
|
||||
return do_max_length();
|
||||
}
|
||||
@@ -963,10 +972,10 @@ protected:
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_encoding() const _NOEXCEPT;
|
||||
virtual bool do_always_noconv() const _NOEXCEPT;
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
// template <> class codecvt<char32_t, char, mbstate_t>
|
||||
@@ -1009,13 +1018,13 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
int encoding() const throw()
|
||||
int encoding() const _NOEXCEPT
|
||||
{
|
||||
return do_encoding();
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool always_noconv() const throw()
|
||||
bool always_noconv() const _NOEXCEPT
|
||||
{
|
||||
return do_always_noconv();
|
||||
}
|
||||
@@ -1027,7 +1036,7 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
int max_length() const throw()
|
||||
int max_length() const _NOEXCEPT
|
||||
{
|
||||
return do_max_length();
|
||||
}
|
||||
@@ -1049,10 +1058,10 @@ protected:
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const throw();
|
||||
virtual bool do_always_noconv() const throw();
|
||||
virtual int do_encoding() const _NOEXCEPT;
|
||||
virtual bool do_always_noconv() const _NOEXCEPT;
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
|
||||
virtual int do_max_length() const throw();
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#ifdef _LIBCPP_SHARED_LOCK
|
||||
|
||||
namespace ting {
|
||||
template <class> class shared_lock;
|
||||
template <class> class upgrade_lock;
|
||||
template <class _Mutex> class shared_lock;
|
||||
template <class _Mutex> class upgrade_lock;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_SHARED_LOCK
|
||||
@@ -190,8 +190,8 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(unique_lock& __u)
|
||||
{
|
||||
_STD::swap(__m_, __u.__m_);
|
||||
_STD::swap(__owns_, __u.__owns_);
|
||||
_VSTD::swap(__m_, __u.__m_);
|
||||
_VSTD::swap(__owns_, __u.__owns_);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
mutex_type* release()
|
||||
@@ -429,7 +429,7 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
|
||||
_Predicate __pred)
|
||||
{
|
||||
return wait_until(__lk, chrono::steady_clock::now() + __d,
|
||||
_STD::move(__pred));
|
||||
_VSTD::move(__pred));
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
@@ -47,29 +47,36 @@ public:
|
||||
typedef typename add_lvalue_reference<allocator_type>::type __alloc_ref;
|
||||
typedef typename add_lvalue_reference<allocator_type>::type __alloc_const_ref;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __alloc_rr& __alloc() {return __end_cap_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY const __alloc_rr& __alloc() const {return __end_cap_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY pointer& __end_cap() {return __end_cap_.first();}
|
||||
_LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const {return __end_cap_.first();}
|
||||
_LIBCPP_INLINE_VISIBILITY __alloc_rr& __alloc() _NOEXCEPT {return __end_cap_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY const __alloc_rr& __alloc() const _NOEXCEPT {return __end_cap_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY pointer& __end_cap() _NOEXCEPT {return __end_cap_.first();}
|
||||
_LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const _NOEXCEPT {return __end_cap_.first();}
|
||||
|
||||
__split_buffer();
|
||||
__split_buffer()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
|
||||
explicit __split_buffer(__alloc_rr& __a);
|
||||
explicit __split_buffer(const __alloc_rr& __a);
|
||||
__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);
|
||||
~__split_buffer();
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__split_buffer(__split_buffer&& __c);
|
||||
__split_buffer(__split_buffer&& __c)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
|
||||
__split_buffer(__split_buffer&& __c, const __alloc_rr& __a);
|
||||
__split_buffer& operator=(__split_buffer&& __c);
|
||||
__split_buffer& operator=(__split_buffer&& __c)
|
||||
_NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value) ||
|
||||
!__alloc_traits::propagate_on_container_move_assignment::value);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY iterator begin() {return __begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const {return __begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY iterator end() {return __end_;}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator end() const {return __end_;}
|
||||
_LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT {return __begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY iterator end() _NOEXCEPT {return __end_;}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT {return __end_;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void clear() {__destruct_at_end(__begin_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() _NOEXCEPT
|
||||
{__destruct_at_end(__begin_);}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type size() const {return static_cast<size_type>(__end_ - __begin_);}
|
||||
_LIBCPP_INLINE_VISIBILITY bool empty() const {return __end_ == __begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type capacity() const {return static_cast<size_type>(__end_cap() - __first_);}
|
||||
@@ -82,25 +89,23 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference back() const {return *(__end_ - 1);}
|
||||
|
||||
void reserve(size_type __n);
|
||||
void shrink_to_fit();
|
||||
void shrink_to_fit() _NOEXCEPT;
|
||||
void push_front(const_reference __x);
|
||||
void push_back(const_reference __x);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||
void push_front(value_type&& __x);
|
||||
void push_back(value_type&& __x);
|
||||
#if !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
template <class... _Args>
|
||||
void emplace_back(_Args&&... __args);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);}
|
||||
_LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);}
|
||||
|
||||
void __construct_at_end(size_type __n);
|
||||
void __construct_at_end(size_type __n, false_type);
|
||||
void __construct_at_end(size_type __n, true_type);
|
||||
void __construct_at_end(size_type __n, const_reference __x);
|
||||
void __construct_at_end(size_type __n, const_reference __x, false_type);
|
||||
void __construct_at_end(size_type __n, const_reference __x, true_type);
|
||||
template <class _InputIter>
|
||||
typename enable_if
|
||||
<
|
||||
@@ -122,40 +127,47 @@ public:
|
||||
void __destruct_at_begin(pointer __new_begin, false_type);
|
||||
void __destruct_at_begin(pointer __new_begin, true_type);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void __destruct_at_end(pointer __new_last)
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __destruct_at_end(pointer __new_last) _NOEXCEPT
|
||||
{__destruct_at_end(__new_last, is_trivially_destructible<value_type>());}
|
||||
void __destruct_at_end(pointer __new_last, false_type);
|
||||
void __destruct_at_end(pointer __new_last, true_type);
|
||||
void __destruct_at_end(pointer __new_last, false_type) _NOEXCEPT;
|
||||
void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT;
|
||||
|
||||
void swap(__split_buffer& __x);
|
||||
void swap(__split_buffer& __x)
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
|
||||
__is_nothrow_swappable<__alloc_rr>::value);
|
||||
|
||||
bool __invariants() const;
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(const __split_buffer& __c, true_type)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
|
||||
{
|
||||
__alloc() = _STD::move(__c.__alloc());
|
||||
__alloc() = _VSTD::move(__c.__alloc());
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(const __split_buffer& __c, false_type)
|
||||
void __move_assign_alloc(const __split_buffer& __c, false_type) _NOEXCEPT
|
||||
{}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y)
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
|
||||
__is_nothrow_swappable<__alloc_rr>::value)
|
||||
{__swap_alloc(__x, __y, integral_constant<bool,
|
||||
__alloc_traits::propagate_on_container_swap::value>());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, true_type)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<__alloc_rr>::value)
|
||||
{
|
||||
using _STD::swap;
|
||||
using _VSTD::swap;
|
||||
swap(__x, __y);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, false_type)
|
||||
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, false_type) _NOEXCEPT
|
||||
{}
|
||||
};
|
||||
|
||||
@@ -190,35 +202,18 @@ __split_buffer<_Tp, _Allocator>::__invariants() const
|
||||
// Precondition: size() + __n <= capacity()
|
||||
// Postcondition: size() == size() + __n
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
|
||||
{
|
||||
__construct_at_end(__n, __is_zero_default_constructible<value_type>());
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, false_type)
|
||||
{
|
||||
__alloc_rr& __a = this->__alloc();
|
||||
do
|
||||
{
|
||||
__alloc_traits::construct(__a, _STD::__to_raw_pointer(this->__end_), value_type());
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), value_type());
|
||||
++this->__end_;
|
||||
--__n;
|
||||
} while (__n > 0);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, true_type)
|
||||
{
|
||||
_STD::memset(this->__end_, 0, __n*sizeof(value_type));
|
||||
this->__end_ += __n;
|
||||
}
|
||||
|
||||
// Copy constructs __n objects starting at __end_ from __x
|
||||
// throws if construction throws
|
||||
// Precondition: __n > 0
|
||||
@@ -226,36 +221,18 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, true_type)
|
||||
// Postcondition: size() == old size() + __n
|
||||
// Postcondition: [i] == __x for all i in [size() - __n, __n)
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
|
||||
{
|
||||
__construct_at_end(__n, __x, integral_constant<bool, is_trivially_copy_constructible<value_type>::value &&
|
||||
is_trivially_copy_assignable<value_type>::value>());
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x, false_type)
|
||||
{
|
||||
__alloc_rr& __a = this->__alloc();
|
||||
do
|
||||
{
|
||||
__alloc_traits::construct(__a, _STD::__to_raw_pointer(this->__end_), __x);
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x);
|
||||
++this->__end_;
|
||||
--__n;
|
||||
} while (__n > 0);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x, true_type)
|
||||
{
|
||||
_STD::fill_n(this->__end_, __n, __x);
|
||||
this->__end_ += __n;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class _InputIter>
|
||||
typename enable_if
|
||||
@@ -272,14 +249,14 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIt
|
||||
if (__end_ == __end_cap())
|
||||
{
|
||||
size_type __old_cap = __end_cap() - __first_;
|
||||
size_type __new_cap = _STD::max<size_type>(2 * __old_cap, 8);
|
||||
size_type __new_cap = _VSTD::max<size_type>(2 * __old_cap, 8);
|
||||
__split_buffer __buf(__new_cap, 0, __a);
|
||||
for (pointer __p = __begin_; __p != __end_; ++__p, ++__buf.__end_)
|
||||
__alloc_traits::construct(__buf.__alloc(),
|
||||
_STD::__to_raw_pointer(__buf.__end_), _STD::move(*__p));
|
||||
_VSTD::__to_raw_pointer(__buf.__end_), _VSTD::move(*__p));
|
||||
swap(__buf);
|
||||
}
|
||||
__alloc_traits::construct(__a, _STD::__to_raw_pointer(this->__end_), *__first);
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
|
||||
++this->__end_;
|
||||
}
|
||||
}
|
||||
@@ -296,7 +273,7 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _F
|
||||
__alloc_rr& __a = this->__alloc();
|
||||
for (; __first != __last; ++__first)
|
||||
{
|
||||
__alloc_traits::construct(__a, _STD::__to_raw_pointer(this->__end_), *__first);
|
||||
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
|
||||
++this->__end_;
|
||||
}
|
||||
}
|
||||
@@ -321,7 +298,7 @@ __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_t
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type)
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
|
||||
{
|
||||
while (__new_last < __end_)
|
||||
__alloc_traits::destroy(__alloc(), --__end_);
|
||||
@@ -330,7 +307,7 @@ __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_typ
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type)
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) _NOEXCEPT
|
||||
{
|
||||
__end_ = __new_last;
|
||||
}
|
||||
@@ -347,6 +324,7 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __sta
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
||||
: __first_(0), __begin_(0), __end_(0), __end_cap_(0)
|
||||
{
|
||||
}
|
||||
@@ -377,10 +355,11 @@ __split_buffer<_Tp, _Allocator>::~__split_buffer()
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
|
||||
: __first_(_STD::move(__c.__first_)),
|
||||
__begin_(_STD::move(__c.__begin_)),
|
||||
__end_(_STD::move(__c.__end_)),
|
||||
__end_cap_(_STD::move(__c.__end_cap_))
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
|
||||
: __first_(_VSTD::move(__c.__first_)),
|
||||
__begin_(_VSTD::move(__c.__begin_)),
|
||||
__end_(_VSTD::move(__c.__end_)),
|
||||
__end_cap_(_VSTD::move(__c.__end_cap_))
|
||||
{
|
||||
__c.__first_ = nullptr;
|
||||
__c.__begin_ = nullptr;
|
||||
@@ -417,6 +396,9 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __al
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>&
|
||||
__split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
|
||||
_NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value) ||
|
||||
!__alloc_traits::propagate_on_container_move_assignment::value)
|
||||
{
|
||||
clear();
|
||||
shrink_to_fit();
|
||||
@@ -436,11 +418,13 @@ __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
|
||||
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
|
||||
__is_nothrow_swappable<__alloc_rr>::value)
|
||||
{
|
||||
_STD::swap(__first_, __x.__first_);
|
||||
_STD::swap(__begin_, __x.__begin_);
|
||||
_STD::swap(__end_, __x.__end_);
|
||||
_STD::swap(__end_cap(), __x.__end_cap());
|
||||
_VSTD::swap(__first_, __x.__first_);
|
||||
_VSTD::swap(__begin_, __x.__begin_);
|
||||
_VSTD::swap(__end_, __x.__end_);
|
||||
_VSTD::swap(__end_cap(), __x.__end_cap());
|
||||
__swap_alloc(__alloc(), __x.__alloc());
|
||||
}
|
||||
|
||||
@@ -453,16 +437,16 @@ __split_buffer<_Tp, _Allocator>::reserve(size_type __n)
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__n, 0, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_STD::swap(__first_, __t.__first_);
|
||||
_STD::swap(__begin_, __t.__begin_);
|
||||
_STD::swap(__end_, __t.__end_);
|
||||
_STD::swap(__end_cap(), __t.__end_cap());
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::shrink_to_fit()
|
||||
__split_buffer<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
|
||||
{
|
||||
if (capacity() > size())
|
||||
{
|
||||
@@ -474,10 +458,10 @@ __split_buffer<_Tp, _Allocator>::shrink_to_fit()
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
__t.__end_ = __t.__begin_ + (__end_ - __begin_);
|
||||
_STD::swap(__first_, __t.__first_);
|
||||
_STD::swap(__begin_, __t.__begin_);
|
||||
_STD::swap(__end_, __t.__end_);
|
||||
_STD::swap(__end_cap(), __t.__end_cap());
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
@@ -497,7 +481,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
|
||||
{
|
||||
difference_type __d = __end_cap() - __end_;
|
||||
__d = (__d + 1) / 2;
|
||||
__begin_ = _STD::move_backward(__begin_, __end_, __end_ + __d);
|
||||
__begin_ = _VSTD::move_backward(__begin_, __end_, __end_ + __d);
|
||||
__end_ += __d;
|
||||
}
|
||||
else
|
||||
@@ -506,13 +490,13 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_STD::swap(__first_, __t.__first_);
|
||||
_STD::swap(__begin_, __t.__begin_);
|
||||
_STD::swap(__end_, __t.__end_);
|
||||
_STD::swap(__end_cap(), __t.__end_cap());
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
__alloc_traits::construct(__alloc(), _STD::__to_raw_pointer(__begin_-1), __x);
|
||||
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1), __x);
|
||||
--__begin_;
|
||||
}
|
||||
|
||||
@@ -528,7 +512,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
|
||||
{
|
||||
difference_type __d = __end_cap() - __end_;
|
||||
__d = (__d + 1) / 2;
|
||||
__begin_ = _STD::move_backward(__begin_, __end_, __end_ + __d);
|
||||
__begin_ = _VSTD::move_backward(__begin_, __end_, __end_ + __d);
|
||||
__end_ += __d;
|
||||
}
|
||||
else
|
||||
@@ -537,14 +521,14 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_STD::swap(__first_, __t.__first_);
|
||||
_STD::swap(__begin_, __t.__begin_);
|
||||
_STD::swap(__end_, __t.__end_);
|
||||
_STD::swap(__end_cap(), __t.__end_cap());
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
__alloc_traits::construct(__alloc(), _STD::__to_raw_pointer(__begin_-1),
|
||||
_STD::move(__x));
|
||||
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1),
|
||||
_VSTD::move(__x));
|
||||
--__begin_;
|
||||
}
|
||||
|
||||
@@ -561,7 +545,7 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
|
||||
{
|
||||
difference_type __d = __begin_ - __first_;
|
||||
__d = (__d + 1) / 2;
|
||||
__end_ = _STD::move(__begin_, __end_, __begin_ - __d);
|
||||
__end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
|
||||
__begin_ -= __d;
|
||||
}
|
||||
else
|
||||
@@ -570,13 +554,13 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_STD::swap(__first_, __t.__first_);
|
||||
_STD::swap(__begin_, __t.__begin_);
|
||||
_STD::swap(__end_, __t.__end_);
|
||||
_STD::swap(__end_cap(), __t.__end_cap());
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
__alloc_traits::construct(__alloc(), _STD::__to_raw_pointer(__end_), __x);
|
||||
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_), __x);
|
||||
++__end_;
|
||||
}
|
||||
|
||||
@@ -592,7 +576,7 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
|
||||
{
|
||||
difference_type __d = __begin_ - __first_;
|
||||
__d = (__d + 1) / 2;
|
||||
__end_ = _STD::move(__begin_, __end_, __begin_ - __d);
|
||||
__end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
|
||||
__begin_ -= __d;
|
||||
}
|
||||
else
|
||||
@@ -601,14 +585,14 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_STD::swap(__first_, __t.__first_);
|
||||
_STD::swap(__begin_, __t.__begin_);
|
||||
_STD::swap(__end_, __t.__end_);
|
||||
_STD::swap(__end_cap(), __t.__end_cap());
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
__alloc_traits::construct(__alloc(), _STD::__to_raw_pointer(__end_),
|
||||
_STD::move(__x));
|
||||
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_),
|
||||
_VSTD::move(__x));
|
||||
++__end_;
|
||||
}
|
||||
|
||||
@@ -625,7 +609,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
|
||||
{
|
||||
difference_type __d = __begin_ - __first_;
|
||||
__d = (__d + 1) / 2;
|
||||
__end_ = _STD::move(__begin_, __end_, __begin_ - __d);
|
||||
__end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
|
||||
__begin_ -= __d;
|
||||
}
|
||||
else
|
||||
@@ -634,14 +618,14 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
_STD::swap(__first_, __t.__first_);
|
||||
_STD::swap(__begin_, __t.__begin_);
|
||||
_STD::swap(__end_, __t.__end_);
|
||||
_STD::swap(__end_cap(), __t.__end_cap());
|
||||
_VSTD::swap(__first_, __t.__first_);
|
||||
_VSTD::swap(__begin_, __t.__begin_);
|
||||
_VSTD::swap(__end_, __t.__end_);
|
||||
_VSTD::swap(__end_cap(), __t.__end_cap());
|
||||
}
|
||||
}
|
||||
__alloc_traits::construct(__alloc(), _STD::__to_raw_pointer(__end_),
|
||||
_STD::forward<_Args>(__args)...);
|
||||
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
++__end_;
|
||||
}
|
||||
|
||||
@@ -649,6 +633,16 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_SPLIT_BUFFER
|
||||
|
||||
@@ -97,7 +97,7 @@ typename __stdinbuf<_CharT>::int_type
|
||||
__stdinbuf<_CharT>::__getchar(bool __consume)
|
||||
{
|
||||
char __extbuf[__limit];
|
||||
int __nread = max(1, __encoding_);
|
||||
int __nread = _VSTD::max(1, __encoding_);
|
||||
for (int __i = 0; __i < __nread; ++__i)
|
||||
{
|
||||
char __c = getc(__file_);
|
||||
@@ -120,7 +120,7 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
|
||||
&__1buf, &__1buf + 1, __inxt);
|
||||
switch (__r)
|
||||
{
|
||||
case _STD::codecvt_base::ok:
|
||||
case _VSTD::codecvt_base::ok:
|
||||
break;
|
||||
case codecvt_base::partial:
|
||||
__st_ = __sv_st;
|
||||
@@ -136,11 +136,11 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
|
||||
break;
|
||||
case codecvt_base::error:
|
||||
return traits_type::eof();
|
||||
case _STD::codecvt_base::noconv:
|
||||
case _VSTD::codecvt_base::noconv:
|
||||
__1buf = static_cast<char_type>(__extbuf[0]);
|
||||
break;
|
||||
}
|
||||
} while (__r == _STD::codecvt_base::partial);
|
||||
} while (__r == _VSTD::codecvt_base::partial);
|
||||
}
|
||||
if (!__consume)
|
||||
{
|
||||
@@ -166,9 +166,9 @@ __stdinbuf<_CharT>::pbackfail(int_type __c)
|
||||
switch (__cv_->out(__st_, &__ci, &__ci + 1, __inxt,
|
||||
__extbuf, __extbuf + sizeof(__extbuf), __enxt))
|
||||
{
|
||||
case _STD::codecvt_base::ok:
|
||||
case _VSTD::codecvt_base::ok:
|
||||
break;
|
||||
case _STD::codecvt_base::noconv:
|
||||
case _VSTD::codecvt_base::noconv:
|
||||
__extbuf[0] = static_cast<char>(__c);
|
||||
__enxt = __extbuf + 1;
|
||||
break;
|
||||
|
||||
321
include/__tree
321
include/__tree
@@ -21,13 +21,19 @@
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class, class, class> class __tree;
|
||||
template <class, class, class> class _LIBCPP_VISIBLE __tree_iterator;
|
||||
template <class, class, class> class _LIBCPP_VISIBLE __tree_const_iterator;
|
||||
template <class, class, class, class> class _LIBCPP_VISIBLE map;
|
||||
template <class, class, class, class> class _LIBCPP_VISIBLE multimap;
|
||||
template <class, class, class> class _LIBCPP_VISIBLE set;
|
||||
template <class, class, class> class _LIBCPP_VISIBLE multiset;
|
||||
template <class _Tp, class _Compare, class _Allocator> class __tree;
|
||||
template <class _Tp, class _NodePtr, class _DiffType>
|
||||
class _LIBCPP_VISIBLE __tree_iterator;
|
||||
template <class _Tp, class _ConstNodePtr, class _DiffType>
|
||||
class _LIBCPP_VISIBLE __tree_const_iterator;
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
class _LIBCPP_VISIBLE map;
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
class _LIBCPP_VISIBLE multimap;
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
class _LIBCPP_VISIBLE set;
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
class _LIBCPP_VISIBLE multiset;
|
||||
|
||||
/*
|
||||
|
||||
@@ -55,7 +61,7 @@ __root, have a non-null __parent_ field.
|
||||
template <class _NodePtr>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
__tree_is_left_child(_NodePtr __x)
|
||||
__tree_is_left_child(_NodePtr __x) _NOEXCEPT
|
||||
{
|
||||
return __x == __x->__parent_->__left_;
|
||||
}
|
||||
@@ -121,7 +127,7 @@ __tree_invariant(_NodePtr __root)
|
||||
template <class _NodePtr>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_NodePtr
|
||||
__tree_min(_NodePtr __x)
|
||||
__tree_min(_NodePtr __x) _NOEXCEPT
|
||||
{
|
||||
while (__x->__left_ != nullptr)
|
||||
__x = __x->__left_;
|
||||
@@ -133,7 +139,7 @@ __tree_min(_NodePtr __x)
|
||||
template <class _NodePtr>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_NodePtr
|
||||
__tree_max(_NodePtr __x)
|
||||
__tree_max(_NodePtr __x) _NOEXCEPT
|
||||
{
|
||||
while (__x->__right_ != nullptr)
|
||||
__x = __x->__right_;
|
||||
@@ -144,7 +150,7 @@ __tree_max(_NodePtr __x)
|
||||
// Precondition: __x != nullptr.
|
||||
template <class _NodePtr>
|
||||
_NodePtr
|
||||
__tree_next(_NodePtr __x)
|
||||
__tree_next(_NodePtr __x) _NOEXCEPT
|
||||
{
|
||||
if (__x->__right_ != nullptr)
|
||||
return __tree_min(__x->__right_);
|
||||
@@ -157,7 +163,7 @@ __tree_next(_NodePtr __x)
|
||||
// Precondition: __x != nullptr.
|
||||
template <class _NodePtr>
|
||||
_NodePtr
|
||||
__tree_prev(_NodePtr __x)
|
||||
__tree_prev(_NodePtr __x) _NOEXCEPT
|
||||
{
|
||||
if (__x->__left_ != nullptr)
|
||||
return __tree_max(__x->__left_);
|
||||
@@ -170,7 +176,7 @@ __tree_prev(_NodePtr __x)
|
||||
// Precondition: __x != nullptr.
|
||||
template <class _NodePtr>
|
||||
_NodePtr
|
||||
__tree_leaf(_NodePtr __x)
|
||||
__tree_leaf(_NodePtr __x) _NOEXCEPT
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
@@ -194,7 +200,7 @@ __tree_leaf(_NodePtr __x)
|
||||
// Precondition: __x->__right_ != nullptr
|
||||
template <class _NodePtr>
|
||||
void
|
||||
__tree_left_rotate(_NodePtr __x)
|
||||
__tree_left_rotate(_NodePtr __x) _NOEXCEPT
|
||||
{
|
||||
_NodePtr __y = __x->__right_;
|
||||
__x->__right_ = __y->__left_;
|
||||
@@ -214,7 +220,7 @@ __tree_left_rotate(_NodePtr __x)
|
||||
// Precondition: __x->__left_ != nullptr
|
||||
template <class _NodePtr>
|
||||
void
|
||||
__tree_right_rotate(_NodePtr __x)
|
||||
__tree_right_rotate(_NodePtr __x) _NOEXCEPT
|
||||
{
|
||||
_NodePtr __y = __x->__left_;
|
||||
__x->__left_ = __y->__right_;
|
||||
@@ -239,7 +245,7 @@ __tree_right_rotate(_NodePtr __x)
|
||||
// may be different than the value passed in as __root.
|
||||
template <class _NodePtr>
|
||||
void
|
||||
__tree_balance_after_insert(_NodePtr __root, _NodePtr __x)
|
||||
__tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT
|
||||
{
|
||||
__x->__is_black_ = __x == __root;
|
||||
while (__x != __root && !__x->__parent_->__is_black_)
|
||||
@@ -309,7 +315,7 @@ __tree_balance_after_insert(_NodePtr __root, _NodePtr __x)
|
||||
// may be different than the value passed in as __root.
|
||||
template <class _NodePtr>
|
||||
void
|
||||
__tree_remove(_NodePtr __root, _NodePtr __z)
|
||||
__tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT
|
||||
{
|
||||
// __z will be removed from the tree. Client still needs to destruct/deallocate it
|
||||
// __y is either __z, or if __z has two children, __tree_next(__z).
|
||||
@@ -494,7 +500,7 @@ __tree_remove(_NodePtr __root, _NodePtr __z)
|
||||
}
|
||||
}
|
||||
|
||||
template <class> class __map_node_destructor;
|
||||
template <class _Allocator> class __map_node_destructor;
|
||||
|
||||
template <class _Allocator>
|
||||
class __tree_node_destructor
|
||||
@@ -514,16 +520,16 @@ public:
|
||||
bool __value_constructed;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __tree_node_destructor(allocator_type& __na)
|
||||
explicit __tree_node_destructor(allocator_type& __na) _NOEXCEPT
|
||||
: __na_(__na),
|
||||
__value_constructed(false)
|
||||
{}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void operator()(pointer __p)
|
||||
void operator()(pointer __p) _NOEXCEPT
|
||||
{
|
||||
if (__value_constructed)
|
||||
__alloc_traits::destroy(__na_, addressof(__p->__value_));
|
||||
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_));
|
||||
if (__p)
|
||||
__alloc_traits::deallocate(__na_, __p, 1);
|
||||
}
|
||||
@@ -541,7 +547,7 @@ public:
|
||||
pointer __left_;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tree_end_node() : __left_() {}
|
||||
__tree_end_node() _NOEXCEPT : __left_() {}
|
||||
};
|
||||
|
||||
template <class _VoidPtr>
|
||||
@@ -580,7 +586,8 @@ public:
|
||||
bool __is_black_;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tree_node_base() : __right_(), __parent_(), __is_black_(false) {}
|
||||
__tree_node_base() _NOEXCEPT
|
||||
: __right_(), __parent_(), __is_black_(false) {}
|
||||
};
|
||||
|
||||
template <class _Tp, class _VoidPtr>
|
||||
@@ -597,7 +604,7 @@ public:
|
||||
template <class ..._Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __tree_node(_Args&& ...__args)
|
||||
: __value_(_STD::forward<_Args>(__args)...) {}
|
||||
: __value_(_VSTD::forward<_Args>(__args)...) {}
|
||||
#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __tree_node(const value_type& __v)
|
||||
@@ -605,8 +612,8 @@ public:
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
};
|
||||
|
||||
template <class> class __map_iterator;
|
||||
template <class> class __map_const_iterator;
|
||||
template <class _TreeIterator> class __map_iterator;
|
||||
template <class _TreeIterator> class __map_const_iterator;
|
||||
|
||||
template <class _Tp, class _NodePtr, class _DiffType>
|
||||
class _LIBCPP_VISIBLE __tree_iterator
|
||||
@@ -632,7 +639,7 @@ public:
|
||||
#endif
|
||||
pointer;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __tree_iterator() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __tree_iterator() _NOEXCEPT {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
|
||||
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;}
|
||||
@@ -662,7 +669,7 @@ public:
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __tree_iterator(__node_pointer __p) : __ptr_(__p) {}
|
||||
explicit __tree_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
|
||||
template <class, class, class> friend class __tree;
|
||||
template <class, class, class> friend class _LIBCPP_VISIBLE __tree_const_iterator;
|
||||
template <class> friend class _LIBCPP_VISIBLE __map_iterator;
|
||||
@@ -716,7 +723,8 @@ private:
|
||||
__non_const_iterator;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tree_const_iterator(__non_const_iterator __p) : __ptr_(__p.__ptr_) {}
|
||||
__tree_const_iterator(__non_const_iterator __p) _NOEXCEPT
|
||||
: __ptr_(__p.__ptr_) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
|
||||
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;}
|
||||
@@ -746,7 +754,8 @@ public:
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __tree_const_iterator(__node_pointer __p) : __ptr_(__p) {}
|
||||
explicit __tree_const_iterator(__node_pointer __p) _NOEXCEPT
|
||||
: __ptr_(__p) {}
|
||||
template <class, class, class> friend class __tree;
|
||||
template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
|
||||
template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
|
||||
@@ -769,6 +778,7 @@ public:
|
||||
typedef typename __alloc_traits::difference_type difference_type;
|
||||
|
||||
typedef __tree_node<value_type, typename __alloc_traits::void_pointer> __node;
|
||||
typedef __tree_node_base<typename __alloc_traits::void_pointer> __node_base;
|
||||
typedef typename __alloc_traits::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind_alloc<__node>
|
||||
@@ -779,10 +789,10 @@ public:
|
||||
typedef allocator_traits<__node_allocator> __node_traits;
|
||||
typedef typename __node_traits::pointer __node_pointer;
|
||||
typedef typename __node_traits::const_pointer __node_const_pointer;
|
||||
typedef typename __node::base::pointer __node_base_pointer;
|
||||
typedef typename __node::base::const_pointer __node_base_const_pointer;
|
||||
typedef typename __node_base::pointer __node_base_pointer;
|
||||
typedef typename __node_base::const_pointer __node_base_const_pointer;
|
||||
private:
|
||||
typedef typename __node::base::base __end_node_t;
|
||||
typedef typename __node_base::base __end_node_t;
|
||||
typedef typename pointer_traits<__node_pointer>::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind<__end_node_t>
|
||||
@@ -804,7 +814,7 @@ private:
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__node_pointer __end_node()
|
||||
__node_pointer __end_node() _NOEXCEPT
|
||||
{
|
||||
return static_cast<__node_pointer>
|
||||
(
|
||||
@@ -812,7 +822,7 @@ public:
|
||||
);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__node_const_pointer __end_node() const
|
||||
__node_const_pointer __end_node() const _NOEXCEPT
|
||||
{
|
||||
return static_cast<__node_const_pointer>
|
||||
(
|
||||
@@ -820,39 +830,45 @@ public:
|
||||
);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__node_allocator& __node_alloc() {return __pair1_.second();}
|
||||
__node_allocator& __node_alloc() _NOEXCEPT {return __pair1_.second();}
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const __node_allocator& __node_alloc() const {return __pair1_.second();}
|
||||
const __node_allocator& __node_alloc() const _NOEXCEPT
|
||||
{return __pair1_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__node_pointer& __begin_node() {return __begin_node_;}
|
||||
__node_pointer& __begin_node() _NOEXCEPT {return __begin_node_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const __node_pointer& __begin_node() const {return __begin_node_;}
|
||||
const __node_pointer& __begin_node() const _NOEXCEPT {return __begin_node_;}
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type __alloc() const {return allocator_type(__node_alloc());}
|
||||
allocator_type __alloc() const _NOEXCEPT
|
||||
{return allocator_type(__node_alloc());}
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type& size() {return __pair3_.first();}
|
||||
size_type& size() _NOEXCEPT {return __pair3_.first();}
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const size_type& size() const {return __pair3_.first();}
|
||||
const size_type& size() const _NOEXCEPT {return __pair3_.first();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_compare& value_comp() {return __pair3_.second();}
|
||||
value_compare& value_comp() _NOEXCEPT {return __pair3_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const value_compare& value_comp() const {return __pair3_.second();}
|
||||
const value_compare& value_comp() const _NOEXCEPT
|
||||
{return __pair3_.second();}
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__node_pointer __root()
|
||||
__node_pointer __root() _NOEXCEPT
|
||||
{return static_cast<__node_pointer> (__end_node()->__left_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__node_const_pointer __root() const
|
||||
__node_const_pointer __root() const _NOEXCEPT
|
||||
{return static_cast<__node_const_pointer>(__end_node()->__left_);}
|
||||
|
||||
typedef __tree_iterator<value_type, __node_pointer, difference_type> iterator;
|
||||
typedef __tree_const_iterator<value_type, __node_const_pointer, difference_type> const_iterator;
|
||||
|
||||
explicit __tree(const value_compare& __comp);
|
||||
explicit __tree(const value_compare& __comp)
|
||||
_NOEXCEPT_(
|
||||
is_nothrow_default_constructible<__node_allocator>::value &&
|
||||
is_nothrow_copy_constructible<value_compare>::value);
|
||||
explicit __tree(const allocator_type& __a);
|
||||
__tree(const value_compare& __comp, const allocator_type& __a);
|
||||
__tree(const __tree& __t);
|
||||
@@ -862,28 +878,40 @@ public:
|
||||
template <class _InputIterator>
|
||||
void __assign_multi(_InputIterator __first, _InputIterator __last);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__tree(__tree&& __t);
|
||||
__tree(__tree&& __t)
|
||||
_NOEXCEPT_(
|
||||
is_nothrow_move_constructible<__node_allocator>::value &&
|
||||
is_nothrow_move_constructible<value_compare>::value);
|
||||
__tree(__tree&& __t, const allocator_type& __a);
|
||||
__tree& operator=(__tree&& __t);
|
||||
__tree& operator=(__tree&& __t)
|
||||
_NOEXCEPT_(
|
||||
__node_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<value_compare>::value &&
|
||||
is_nothrow_move_assignable<__node_allocator>::value);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
~__tree();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return iterator(__begin_node());}
|
||||
iterator begin() _NOEXCEPT {return iterator(__begin_node());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return const_iterator(__begin_node());}
|
||||
const_iterator begin() const _NOEXCEPT {return const_iterator(__begin_node());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return iterator(__end_node());}
|
||||
iterator end() _NOEXCEPT {return iterator(__end_node());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return const_iterator(__end_node());}
|
||||
const_iterator end() const _NOEXCEPT {return const_iterator(__end_node());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const {return __node_traits::max_size(__node_alloc());}
|
||||
size_type max_size() const _NOEXCEPT
|
||||
{return __node_traits::max_size(__node_alloc());}
|
||||
|
||||
void clear();
|
||||
void clear() _NOEXCEPT;
|
||||
|
||||
void swap(__tree& __t);
|
||||
void swap(__tree& __t)
|
||||
_NOEXCEPT_(
|
||||
__is_nothrow_swappable<value_compare>::value &&
|
||||
(!__node_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value));
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
@@ -910,13 +938,12 @@ public:
|
||||
iterator __insert_multi(_V&& __v);
|
||||
template <class _V>
|
||||
iterator __insert_multi(const_iterator __p, _V&& __v);
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
pair<iterator, bool> __insert_unique(const value_type& __v);
|
||||
iterator __insert_unique(const_iterator __p, const value_type& __v);
|
||||
iterator __insert_multi(const value_type& __v);
|
||||
iterator __insert_multi(const_iterator __p, const value_type& __v);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
pair<iterator, bool> __node_insert_unique(__node_pointer __nd);
|
||||
iterator __node_insert_unique(const_iterator __p,
|
||||
@@ -995,21 +1022,21 @@ public:
|
||||
typedef __tree_node_destructor<__node_allocator> _D;
|
||||
typedef unique_ptr<__node, _D> __node_holder;
|
||||
|
||||
__node_holder remove(const_iterator __p);
|
||||
__node_holder remove(const_iterator __p) _NOEXCEPT;
|
||||
private:
|
||||
typename __node::base::pointer&
|
||||
__find_leaf_low(typename __node::base::pointer& __parent, const value_type& __v);
|
||||
typename __node::base::pointer&
|
||||
__find_leaf_high(typename __node::base::pointer& __parent, const value_type& __v);
|
||||
typename __node::base::pointer&
|
||||
typename __node_base::pointer&
|
||||
__find_leaf_low(typename __node_base::pointer& __parent, const value_type& __v);
|
||||
typename __node_base::pointer&
|
||||
__find_leaf_high(typename __node_base::pointer& __parent, const value_type& __v);
|
||||
typename __node_base::pointer&
|
||||
__find_leaf(const_iterator __hint,
|
||||
typename __node::base::pointer& __parent, const value_type& __v);
|
||||
typename __node_base::pointer& __parent, const value_type& __v);
|
||||
template <class _Key>
|
||||
typename __node::base::pointer&
|
||||
__find_equal(typename __node::base::pointer& __parent, const _Key& __v);
|
||||
typename __node_base::pointer&
|
||||
__find_equal(typename __node_base::pointer& __parent, const _Key& __v);
|
||||
template <class _Key>
|
||||
typename __node::base::pointer&
|
||||
__find_equal(const_iterator __hint, typename __node::base::pointer& __parent,
|
||||
typename __node_base::pointer&
|
||||
__find_equal(const_iterator __hint, typename __node_base::pointer& __parent,
|
||||
const _Key& __v);
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
@@ -1019,7 +1046,7 @@ private:
|
||||
__node_holder __construct_node(const value_type& __v);
|
||||
#endif
|
||||
|
||||
void destroy(__node_pointer __nd);
|
||||
void destroy(__node_pointer __nd) _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __copy_assign_alloc(const __tree& __t)
|
||||
@@ -1033,31 +1060,42 @@ private:
|
||||
void __copy_assign_alloc(const __tree& __t, false_type) {}
|
||||
|
||||
void __move_assign(__tree& __t, false_type);
|
||||
void __move_assign(__tree& __t, true_type);
|
||||
void __move_assign(__tree& __t, true_type)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<value_compare>::value &&
|
||||
is_nothrow_move_assignable<__node_allocator>::value);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__tree& __t)
|
||||
_NOEXCEPT_(
|
||||
!__node_traits::propagate_on_container_move_assignment::value ||
|
||||
is_nothrow_move_assignable<__node_allocator>::value)
|
||||
{__move_assign_alloc(__t, integral_constant<bool,
|
||||
__node_traits::propagate_on_container_move_assignment::value>());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__tree& __t, true_type)
|
||||
{__node_alloc() = _STD::move(__t.__node_alloc());}
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
|
||||
{__node_alloc() = _VSTD::move(__t.__node_alloc());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__tree& __t, false_type) {}
|
||||
void __move_assign_alloc(__tree& __t, false_type) _NOEXCEPT {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y)
|
||||
_NOEXCEPT_(
|
||||
!__node_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value)
|
||||
{__swap_alloc(__x, __y, integral_constant<bool,
|
||||
__node_traits::propagate_on_container_swap::value>());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, true_type)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<__node_allocator>::value)
|
||||
{
|
||||
using _STD::swap;
|
||||
using _VSTD::swap;
|
||||
swap(__x, __y);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, false_type)
|
||||
_NOEXCEPT
|
||||
{}
|
||||
|
||||
__node_pointer __detach();
|
||||
@@ -1066,6 +1104,9 @@ private:
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp)
|
||||
_NOEXCEPT_(
|
||||
is_nothrow_default_constructible<__node_allocator>::value &&
|
||||
is_nothrow_copy_constructible<value_compare>::value)
|
||||
: __pair3_(0, __comp)
|
||||
{
|
||||
__begin_node() = __end_node();
|
||||
@@ -1240,9 +1281,12 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
|
||||
: __begin_node_(_STD::move(__t.__begin_node_)),
|
||||
__pair1_(_STD::move(__t.__pair1_)),
|
||||
__pair3_(_STD::move(__t.__pair3_))
|
||||
_NOEXCEPT_(
|
||||
is_nothrow_move_constructible<__node_allocator>::value &&
|
||||
is_nothrow_move_constructible<value_compare>::value)
|
||||
: __begin_node_(_VSTD::move(__t.__begin_node_)),
|
||||
__pair1_(_VSTD::move(__t.__pair1_)),
|
||||
__pair3_(_VSTD::move(__t.__pair3_))
|
||||
{
|
||||
if (size() == 0)
|
||||
__begin_node() = __end_node();
|
||||
@@ -1258,7 +1302,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a)
|
||||
: __pair1_(__node_allocator(__a)),
|
||||
__pair3_(0, _STD::move(__t.value_comp()))
|
||||
__pair3_(0, _VSTD::move(__t.value_comp()))
|
||||
{
|
||||
if (__a == __t.__alloc())
|
||||
{
|
||||
@@ -1284,12 +1328,14 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
void
|
||||
__tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<value_compare>::value &&
|
||||
is_nothrow_move_assignable<__node_allocator>::value)
|
||||
{
|
||||
destroy(static_cast<__node_pointer>(__end_node()->__left_));
|
||||
__begin_node_ = __t.__begin_node_;
|
||||
__pair1_.first() = __t.__pair1_.first();
|
||||
__move_assign_alloc(__t);
|
||||
__pair3_ = _STD::move(__t.__pair3_);
|
||||
__pair3_ = _VSTD::move(__t.__pair3_);
|
||||
if (size() == 0)
|
||||
__begin_node() = __end_node();
|
||||
else
|
||||
@@ -1309,7 +1355,7 @@ __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type)
|
||||
__move_assign(__t, true_type());
|
||||
else
|
||||
{
|
||||
value_comp() = _STD::move(__t.value_comp());
|
||||
value_comp() = _VSTD::move(__t.value_comp());
|
||||
const_iterator __e = end();
|
||||
if (size() != 0)
|
||||
{
|
||||
@@ -1320,7 +1366,7 @@ __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type)
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
while (__cache != nullptr && __t.size() != 0)
|
||||
{
|
||||
__cache->__value_ = _STD::move(__t.remove(__t.begin())->__value_);
|
||||
__cache->__value_ = _VSTD::move(__t.remove(__t.begin())->__value_);
|
||||
__node_pointer __next = __detach(__cache);
|
||||
__node_insert_multi(__cache);
|
||||
__cache = __next;
|
||||
@@ -1343,13 +1389,18 @@ __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type)
|
||||
}
|
||||
}
|
||||
while (__t.size() != 0)
|
||||
__insert_multi(__e, _STD::move(__t.remove(__t.begin())->__value_));
|
||||
__insert_multi(__e, _VSTD::move(__t.remove(__t.begin())->__value_));
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
__tree<_Tp, _Compare, _Allocator>&
|
||||
__tree<_Tp, _Compare, _Allocator>::operator=(__tree&& __t)
|
||||
_NOEXCEPT_(
|
||||
__node_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<value_compare>::value &&
|
||||
is_nothrow_move_assignable<__node_allocator>::value)
|
||||
|
||||
{
|
||||
__move_assign(__t, integral_constant<bool,
|
||||
__node_traits::propagate_on_container_move_assignment::value>());
|
||||
@@ -1366,14 +1417,14 @@ __tree<_Tp, _Compare, _Allocator>::~__tree()
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
void
|
||||
__tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd)
|
||||
__tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd) _NOEXCEPT
|
||||
{
|
||||
if (__nd != nullptr)
|
||||
{
|
||||
destroy(static_cast<__node_pointer>(__nd->__left_));
|
||||
destroy(static_cast<__node_pointer>(__nd->__right_));
|
||||
__node_allocator& __na = __node_alloc();
|
||||
__node_traits::destroy(__na, addressof(__nd->__value_));
|
||||
__node_traits::destroy(__na, _VSTD::addressof(__nd->__value_));
|
||||
__node_traits::deallocate(__na, __nd, 1);
|
||||
}
|
||||
}
|
||||
@@ -1381,8 +1432,12 @@ __tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd)
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
void
|
||||
__tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
|
||||
_NOEXCEPT_(
|
||||
__is_nothrow_swappable<value_compare>::value &&
|
||||
(!__node_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value))
|
||||
{
|
||||
using _STD::swap;
|
||||
using _VSTD::swap;
|
||||
swap(__begin_node_, __t.__begin_node_);
|
||||
swap(__pair1_.first(), __t.__pair1_.first());
|
||||
__swap_alloc(__node_alloc(), __t.__node_alloc());
|
||||
@@ -1399,7 +1454,7 @@ __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
void
|
||||
__tree<_Tp, _Compare, _Allocator>::clear()
|
||||
__tree<_Tp, _Compare, _Allocator>::clear() _NOEXCEPT
|
||||
{
|
||||
destroy(__root());
|
||||
size() = 0;
|
||||
@@ -1411,8 +1466,8 @@ __tree<_Tp, _Compare, _Allocator>::clear()
|
||||
// Set __parent to parent of null leaf
|
||||
// Return reference to null leaf
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
|
||||
__tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node::base::pointer& __parent,
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
|
||||
__tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node_base::pointer& __parent,
|
||||
const value_type& __v)
|
||||
{
|
||||
__node_pointer __nd = __root();
|
||||
@@ -1450,8 +1505,8 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node::base::pointe
|
||||
// Set __parent to parent of null leaf
|
||||
// Return reference to null leaf
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
|
||||
__tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node::base::pointer& __parent,
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
|
||||
__tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node_base::pointer& __parent,
|
||||
const value_type& __v)
|
||||
{
|
||||
__node_pointer __nd = __root();
|
||||
@@ -1492,9 +1547,9 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node::base::point
|
||||
// Set __parent to parent of null leaf
|
||||
// Return reference to null leaf
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
|
||||
__tree<_Tp, _Compare, _Allocator>::__find_leaf(const_iterator __hint,
|
||||
typename __node::base::pointer& __parent,
|
||||
typename __node_base::pointer& __parent,
|
||||
const value_type& __v)
|
||||
{
|
||||
if (__hint == end() || !value_comp()(*__hint, __v)) // check before
|
||||
@@ -1528,8 +1583,8 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf(const_iterator __hint,
|
||||
// If __v exists, set parent to node of __v and return reference to node of __v
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
template <class _Key>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
|
||||
__tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node::base::pointer& __parent,
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
|
||||
__tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node_base::pointer& __parent,
|
||||
const _Key& __v)
|
||||
{
|
||||
__node_pointer __nd = __root();
|
||||
@@ -1577,9 +1632,9 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node::base::pointer&
|
||||
// If __v exists, set parent to node of __v and return reference to node of __v
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
template <class _Key>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
|
||||
__tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
|
||||
typename __node::base::pointer& __parent,
|
||||
typename __node_base::pointer& __parent,
|
||||
const _Key& __v)
|
||||
{
|
||||
if (__hint == end() || value_comp()(__v, *__hint)) // check before
|
||||
@@ -1606,10 +1661,10 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
|
||||
else if (value_comp()(*__hint, __v)) // check after
|
||||
{
|
||||
// *__hint < __v
|
||||
const_iterator __next = _STD::next(__hint);
|
||||
const_iterator __next = _VSTD::next(__hint);
|
||||
if (__next == end() || value_comp()(__v, *__next))
|
||||
{
|
||||
// *__hint < __v < *next(__hint)
|
||||
// *__hint < __v < *_VSTD::next(__hint)
|
||||
if (__hint.__ptr_->__right_ == nullptr)
|
||||
{
|
||||
__parent = const_cast<__node_pointer&>(__hint.__ptr_);
|
||||
@@ -1655,7 +1710,7 @@ __tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&& ...__args)
|
||||
{
|
||||
__node_allocator& __na = __node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_traits::construct(__na, addressof(__h->__value_), _STD::forward<_Args>(__args)...);
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...);
|
||||
__h.get_deleter().__value_constructed = true;
|
||||
return __h;
|
||||
}
|
||||
@@ -1665,7 +1720,7 @@ template <class... _Args>
|
||||
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
|
||||
__tree<_Tp, _Compare, _Allocator>::__emplace_unique(_Args&&... __args)
|
||||
{
|
||||
__node_holder __h = __construct_node(_STD::forward<_Args>(__args)...);
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
|
||||
__node_base_pointer __parent;
|
||||
__node_base_pointer& __child = __find_equal(__parent, __h->__value_);
|
||||
__node_pointer __r = static_cast<__node_pointer>(__child);
|
||||
@@ -1684,7 +1739,7 @@ template <class... _Args>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||
__tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique(const_iterator __p, _Args&&... __args)
|
||||
{
|
||||
__node_holder __h = __construct_node(_STD::forward<_Args>(__args)...);
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
|
||||
__node_base_pointer __parent;
|
||||
__node_base_pointer& __child = __find_equal(__p, __parent, __h->__value_);
|
||||
__node_pointer __r = static_cast<__node_pointer>(__child);
|
||||
@@ -1701,7 +1756,7 @@ template <class... _Args>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||
__tree<_Tp, _Compare, _Allocator>::__emplace_multi(_Args&&... __args)
|
||||
{
|
||||
__node_holder __h = __construct_node(_STD::forward<_Args>(__args)...);
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
|
||||
__node_base_pointer __parent;
|
||||
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
|
||||
__insert_node_at(__parent, __child, __h.get());
|
||||
@@ -1714,7 +1769,7 @@ typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||
__tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p,
|
||||
_Args&&... __args)
|
||||
{
|
||||
__node_holder __h = __construct_node(_STD::forward<_Args>(__args)...);
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
|
||||
__node_base_pointer __parent;
|
||||
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
|
||||
__insert_node_at(__parent, __child, __h.get());
|
||||
@@ -1728,18 +1783,11 @@ template <class _V>
|
||||
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
|
||||
__tree<_Tp, _Compare, _Allocator>::__insert_unique(_V&& __v)
|
||||
{
|
||||
__node_base_pointer __parent;
|
||||
__node_base_pointer& __child = __find_equal(__parent, __v);
|
||||
__node_pointer __r = static_cast<__node_pointer>(__child);
|
||||
bool __inserted = false;
|
||||
if (__child == nullptr)
|
||||
{
|
||||
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
|
||||
__insert_node_at(__parent, __child, __h.get());
|
||||
__r = __h.release();
|
||||
__inserted = true;
|
||||
}
|
||||
return pair<iterator, bool>(iterator(__r), __inserted);
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
|
||||
pair<iterator, bool> __r = __node_insert_unique(__h.get());
|
||||
if (__r.second)
|
||||
__h.release();
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
@@ -1747,16 +1795,11 @@ template <class _V>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _V&& __v)
|
||||
{
|
||||
__node_base_pointer __parent;
|
||||
__node_base_pointer& __child = __find_equal(__p, __parent, __v);
|
||||
__node_pointer __r = static_cast<__node_pointer>(__child);
|
||||
if (__child == nullptr)
|
||||
{
|
||||
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
|
||||
__insert_node_at(__parent, __child, __h.get());
|
||||
__r = __h.release();
|
||||
}
|
||||
return iterator(__r);
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
|
||||
iterator __r = __node_insert_unique(__p, __h.get());
|
||||
if (__r.__ptr_ == __h.get())
|
||||
__h.release();
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
@@ -1764,7 +1807,7 @@ template <class _V>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||
__tree<_Tp, _Compare, _Allocator>::__insert_multi(_V&& __v)
|
||||
{
|
||||
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
|
||||
__node_base_pointer __parent;
|
||||
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
|
||||
__insert_node_at(__parent, __child, __h.get());
|
||||
@@ -1776,7 +1819,7 @@ template <class _V>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||
__tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, _V&& __v)
|
||||
{
|
||||
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
|
||||
__node_base_pointer __parent;
|
||||
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
|
||||
__insert_node_at(__parent, __child, __h.get());
|
||||
@@ -1791,11 +1834,13 @@ __tree<_Tp, _Compare, _Allocator>::__construct_node(const value_type& __v)
|
||||
{
|
||||
__node_allocator& __na = __node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_traits::construct(__na, addressof(__h->__value_), __v);
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
|
||||
__h.get_deleter().__value_constructed = true;
|
||||
return _STD::move(__h);
|
||||
return _VSTD::move(__h);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
|
||||
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const value_type& __v)
|
||||
@@ -1852,8 +1897,6 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, const valu
|
||||
return iterator(__h.release());
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
|
||||
__tree<_Tp, _Compare, _Allocator>::__node_insert_unique(__node_pointer __nd)
|
||||
@@ -1919,7 +1962,7 @@ __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p)
|
||||
__begin_node() = __r.__ptr_;
|
||||
--size();
|
||||
__node_allocator& __na = __node_alloc();
|
||||
__node_traits::destroy(__na, const_cast<value_type*>(addressof(*__p)));
|
||||
__node_traits::destroy(__na, const_cast<value_type*>(_VSTD::addressof(*__p)));
|
||||
__tree_remove(__end_node()->__left_,
|
||||
static_cast<__node_base_pointer>(__np));
|
||||
__node_traits::deallocate(__na, __np, 1);
|
||||
@@ -2021,7 +2064,7 @@ __tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const
|
||||
else if (value_comp()(__rt->__value_, __k))
|
||||
__rt = static_cast<__node_const_pointer>(__rt->__right_);
|
||||
else
|
||||
return _STD::distance(
|
||||
return _VSTD::distance(
|
||||
__lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt),
|
||||
__upper_bound(__k, static_cast<__node_const_pointer>(__rt->__right_), __result)
|
||||
);
|
||||
@@ -2217,7 +2260,7 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node_holder
|
||||
__tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p)
|
||||
__tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT
|
||||
{
|
||||
__node_pointer __np = const_cast<__node_pointer>(__p.__ptr_);
|
||||
if (__begin_node() == __np)
|
||||
@@ -2233,6 +2276,16 @@ __tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p)
|
||||
return __node_holder(__np, _D(__node_alloc()));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(__tree<_Tp, _Compare, _Allocator>& __x,
|
||||
__tree<_Tp, _Compare, _Allocator>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___TREE
|
||||
|
||||
@@ -68,48 +68,49 @@ template <class _Tp, size_t _Size> struct _LIBCPP_VISIBLE array;
|
||||
|
||||
template <class _Tp> struct __tuple_like : false_type {};
|
||||
|
||||
template <class... _Tp> struct __tuple_like<tuple<_Tp...>> : true_type {};
|
||||
template <class... _Tp> struct __tuple_like<const tuple<_Tp...>> : true_type {};
|
||||
template <class _Tp> struct __tuple_like<const _Tp> : public __tuple_like<_Tp> {};
|
||||
template <class _Tp> struct __tuple_like<volatile _Tp> : public __tuple_like<_Tp> {};
|
||||
template <class _Tp> struct __tuple_like<const volatile _Tp> : public __tuple_like<_Tp> {};
|
||||
|
||||
template <class... _Tp> struct __tuple_like<tuple<_Tp...> > : true_type {};
|
||||
template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type {};
|
||||
template <class _T1, class _T2> struct __tuple_like<const pair<_T1, _T2> > : true_type {};
|
||||
template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {};
|
||||
template <class _Tp, size_t _Size> struct __tuple_like<const array<_Tp, _Size> > : true_type {};
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
typename tuple_element<_Ip, tuple<_Tp...>>::type&
|
||||
get(tuple<_Tp...>&);
|
||||
typename tuple_element<_Ip, tuple<_Tp...> >::type&
|
||||
get(tuple<_Tp...>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
const typename tuple_element<_Ip, tuple<_Tp...>>::type&
|
||||
get(const tuple<_Tp...>&);
|
||||
const typename tuple_element<_Ip, tuple<_Tp...> >::type&
|
||||
get(const tuple<_Tp...>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
typename tuple_element<_Ip, tuple<_Tp...>>::type&&
|
||||
get(tuple<_Tp...>&&);
|
||||
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
|
||||
get(tuple<_Tp...>&&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
||||
get(pair<_T1, _T2>&);
|
||||
get(pair<_T1, _T2>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
||||
get(const pair<_T1, _T2>&);
|
||||
get(const pair<_T1, _T2>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
|
||||
get(pair<_T1, _T2>&&);
|
||||
get(pair<_T1, _T2>&&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_Tp&
|
||||
get(array<_Tp, _Size>&);
|
||||
get(array<_Tp, _Size>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
const _Tp&
|
||||
get(const array<_Tp, _Size>&);
|
||||
get(const array<_Tp, _Size>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_Tp&&
|
||||
get(array<_Tp, _Size>&&);
|
||||
get(array<_Tp, _Size>&&) _NOEXCEPT;
|
||||
|
||||
// __make_tuple_indices
|
||||
|
||||
@@ -142,7 +143,7 @@ struct __make_tuple_indices
|
||||
template <class ..._Tp> struct __tuple_types {};
|
||||
|
||||
template <size_t _Ip>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, __tuple_types<>>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, __tuple_types<> >
|
||||
{
|
||||
public:
|
||||
static_assert(_Ip == 0, "tuple_element index out of range");
|
||||
@@ -150,26 +151,26 @@ public:
|
||||
};
|
||||
|
||||
template <class _Hp, class ..._Tp>
|
||||
class _LIBCPP_VISIBLE tuple_element<0, __tuple_types<_Hp, _Tp...>>
|
||||
class _LIBCPP_VISIBLE tuple_element<0, __tuple_types<_Hp, _Tp...> >
|
||||
{
|
||||
public:
|
||||
typedef _Hp type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _Hp, class ..._Tp>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, __tuple_types<_Hp, _Tp...>>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, __tuple_types<_Hp, _Tp...> >
|
||||
{
|
||||
public:
|
||||
typedef typename tuple_element<_Ip-1, __tuple_types<_Tp...>>::type type;
|
||||
typedef typename tuple_element<_Ip-1, __tuple_types<_Tp...> >::type type;
|
||||
};
|
||||
|
||||
template <class ..._Tp>
|
||||
class _LIBCPP_VISIBLE tuple_size<__tuple_types<_Tp...>>
|
||||
class _LIBCPP_VISIBLE tuple_size<__tuple_types<_Tp...> >
|
||||
: public integral_constant<size_t, sizeof...(_Tp)>
|
||||
{
|
||||
};
|
||||
|
||||
template <class... _Tp> struct __tuple_like<__tuple_types<_Tp...>> : true_type {};
|
||||
template <class... _Tp> struct __tuple_like<__tuple_types<_Tp...> > : true_type {};
|
||||
|
||||
// __make_tuple_types
|
||||
|
||||
@@ -211,13 +212,13 @@ template <bool, class _Tp, class _Up>
|
||||
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<true, __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> {};
|
||||
is_constructible<_Up0, _Tp0>::value &&
|
||||
__tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||
|
||||
template <>
|
||||
struct __tuple_convertible_imp<true, __tuple_types<>, __tuple_types<>>
|
||||
struct __tuple_convertible_imp<true, __tuple_types<>, __tuple_types<> >
|
||||
: public true_type {};
|
||||
|
||||
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
|
||||
@@ -238,13 +239,13 @@ template <bool, class _Tp, class _Up>
|
||||
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<true, __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<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||
|
||||
template <>
|
||||
struct __tuple_assignable_imp<true, __tuple_types<>, __tuple_types<>>
|
||||
struct __tuple_assignable_imp<true, __tuple_types<>, __tuple_types<> >
|
||||
: public true_type {};
|
||||
|
||||
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
121
include/array
121
include/array
@@ -34,28 +34,28 @@ struct array
|
||||
|
||||
// No explicit construct/copy/destroy for aggregate type
|
||||
void fill(const T& u);
|
||||
void swap(array& a);
|
||||
void swap(array& a) noexcept(noexcept(swap(declval<T&>(), declval<T&>())));
|
||||
|
||||
// iterators:
|
||||
iterator begin();
|
||||
const_iterator begin() const;
|
||||
iterator end();
|
||||
const_iterator end() const;
|
||||
iterator begin() noexcept;
|
||||
const_iterator begin() const noexcept;
|
||||
iterator end() noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
|
||||
reverse_iterator rbegin();
|
||||
const_reverse_iterator rbegin() const;
|
||||
reverse_iterator rend();
|
||||
const_reverse_iterator rend() const;
|
||||
reverse_iterator rbegin() noexcept;
|
||||
const_reverse_iterator rbegin() const noexcept;
|
||||
reverse_iterator rend() noexcept;
|
||||
const_reverse_iterator rend() const noexcept;
|
||||
|
||||
const_iterator cbegin() const;
|
||||
const_iterator cend() const;
|
||||
const_reverse_iterator crbegin() const;
|
||||
const_reverse_iterator crend() const;
|
||||
const_iterator cbegin() const noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
const_reverse_iterator crbegin() const noexcept;
|
||||
const_reverse_iterator crend() const noexcept;
|
||||
|
||||
// capacity:
|
||||
constexpr size_type size() const;
|
||||
constexpr size_type max_size() const;
|
||||
bool empty() const;
|
||||
constexpr size_type size() const noexcept;
|
||||
constexpr size_type max_size() const noexcept;
|
||||
bool empty() const noexcept;
|
||||
|
||||
// element access:
|
||||
reference operator[](size_type n);
|
||||
@@ -68,8 +68,8 @@ struct array
|
||||
reference back();
|
||||
const_reference back() const;
|
||||
|
||||
T* data();
|
||||
const T* data() const;
|
||||
T* data() noexcept;
|
||||
const T* data() const noexcept;
|
||||
};
|
||||
|
||||
template <class T, size_t N>
|
||||
@@ -86,15 +86,15 @@ template <class T, size_t N>
|
||||
bool operator>=(const array<T,N>& x, const array<T,N>& y);
|
||||
|
||||
template <class T, size_t N >
|
||||
void swap(array<T,N>& x, array<T,N>& y);
|
||||
void swap(array<T,N>& x, array<T,N>& y) noexcept(noexcept(x.swap(y)));
|
||||
|
||||
template <class T> class tuple_size;
|
||||
template <int I, class T> class tuple_element;
|
||||
template <class T, size_t N> struct tuple_size<array<T, N>>;
|
||||
template <int I, class T, size_t N> struct tuple_element<I, array<T, N>>;
|
||||
template <int I, class T, size_t N> T& get(array<T, N>&);
|
||||
template <int I, class T, size_t N> const T& get(const array<T, N>&);
|
||||
template <int I, class T, size_t N> T&& get(array<T, N>&&);
|
||||
template <int I, class T, size_t N> T& get(array<T, N>&) noexcept;
|
||||
template <int I, class T, size_t N> const T& get(const array<T, N>&) noexcept;
|
||||
template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept;
|
||||
|
||||
} // std
|
||||
|
||||
@@ -136,30 +136,46 @@ struct _LIBCPP_VISIBLE array
|
||||
|
||||
// No explicit construct/copy/destroy for aggregate type
|
||||
_LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u)
|
||||
{_STD::fill_n(__elems_, _Size, __u);}
|
||||
_LIBCPP_INLINE_VISIBILITY void swap(array& __a)
|
||||
{_STD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);}
|
||||
{_VSTD::fill_n(__elems_, _Size, __u);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(array& __a) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
|
||||
{_VSTD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);}
|
||||
|
||||
// iterators:
|
||||
_LIBCPP_INLINE_VISIBILITY iterator begin() {return iterator(__elems_);}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const {return const_iterator(__elems_);}
|
||||
_LIBCPP_INLINE_VISIBILITY iterator end() {return iterator(__elems_ + _Size);}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator end() const {return const_iterator(__elems_ + _Size);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() _NOEXCEPT {return iterator(__elems_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const _NOEXCEPT {return const_iterator(__elems_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() _NOEXCEPT {return iterator(__elems_ + _Size);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const _NOEXCEPT {return const_iterator(__elems_ + _Size);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reverse_iterator rbegin() {return reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY reverse_iterator rend() {return reverse_iterator(begin());}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rbegin() const _NOEXCEPT {return const_reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rend() const _NOEXCEPT {return const_reverse_iterator(begin());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator cbegin() const {return begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator cend() const {return end();}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reverse_iterator crbegin() const {return rbegin();}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const {return rend();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cbegin() const _NOEXCEPT {return begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cend() const _NOEXCEPT {return end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crend() const _NOEXCEPT {return rend();}
|
||||
|
||||
// capacity:
|
||||
_LIBCPP_INLINE_VISIBILITY /*constexpr*/ size_type size() const {return _Size;}
|
||||
_LIBCPP_INLINE_VISIBILITY /*constexpr*/ size_type max_size() const {return _Size;}
|
||||
_LIBCPP_INLINE_VISIBILITY bool empty() const {return _Size == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
/*constexpr*/ size_type size() const _NOEXCEPT {return _Size;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
/*constexpr*/ size_type max_size() const _NOEXCEPT {return _Size;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const _NOEXCEPT {return _Size == 0;}
|
||||
|
||||
// element access:
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];}
|
||||
@@ -172,8 +188,10 @@ struct _LIBCPP_VISIBLE array
|
||||
_LIBCPP_INLINE_VISIBILITY reference back() {return __elems_[_Size > 0 ? _Size-1 : 0];}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY value_type* data() {return __elems_;}
|
||||
_LIBCPP_INLINE_VISIBILITY const value_type* data() const {return __elems_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_type* data() _NOEXCEPT {return __elems_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const value_type* data() const _NOEXCEPT {return __elems_;}
|
||||
};
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
@@ -207,7 +225,7 @@ _LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return _STD::equal(__x.__elems_, __x.__elems_ + _Size, __y.__elems_);
|
||||
return _VSTD::equal(__x.__elems_, __x.__elems_ + _Size, __y.__elems_);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
@@ -223,7 +241,7 @@ _LIBCPP_INLINE_VISIBILITY inline
|
||||
bool
|
||||
operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
{
|
||||
return _STD::lexicographical_compare(__x.__elems_, __x.__elems_ + _Size, __y.__elems_, __y.__elems_ + _Size);
|
||||
return _VSTD::lexicographical_compare(__x.__elems_, __x.__elems_ + _Size, __y.__elems_, __y.__elems_ + _Size);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
@@ -252,8 +270,13 @@ operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
typename enable_if
|
||||
<
|
||||
__is_swappable<_Tp>::value,
|
||||
void
|
||||
>::type
|
||||
swap(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
@@ -283,7 +306,7 @@ public:
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
_Tp&
|
||||
get(array<_Tp, _Size>& __a)
|
||||
get(array<_Tp, _Size>& __a) _NOEXCEPT
|
||||
{
|
||||
return __a[_Ip];
|
||||
}
|
||||
@@ -291,7 +314,7 @@ get(array<_Tp, _Size>& __a)
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
const _Tp&
|
||||
get(const array<_Tp, _Size>& __a)
|
||||
get(const array<_Tp, _Size>& __a) _NOEXCEPT
|
||||
{
|
||||
return __a[_Ip];
|
||||
}
|
||||
@@ -301,9 +324,9 @@ get(const array<_Tp, _Size>& __a)
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
_Tp&&
|
||||
get(array<_Tp, _Size>&& __a)
|
||||
get(array<_Tp, _Size>&& __a) _NOEXCEPT
|
||||
{
|
||||
return _STD::move(__a[_Ip]);
|
||||
return _VSTD::move(__a[_Ip]);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
12968
include/atomic
12968
include/atomic
File diff suppressed because it is too large
Load Diff
325
include/bitset
325
include/bitset
@@ -27,19 +27,19 @@ public:
|
||||
class reference
|
||||
{
|
||||
friend class bitset;
|
||||
reference();
|
||||
reference() noexcept;
|
||||
public:
|
||||
~reference();
|
||||
reference& operator=(bool x); // for b[i] = x;
|
||||
reference& operator=(const reference&); // for b[i] = b[j];
|
||||
bool operator~() const; // flips the bit
|
||||
operator bool() const; // for x = b[i];
|
||||
reference& flip(); // for b[i].flip();
|
||||
~reference() noexcept;
|
||||
reference& operator=(bool x) noexcept; // for b[i] = x;
|
||||
reference& operator=(const reference&) noexcept; // for b[i] = b[j];
|
||||
bool operator~() const noexcept; // flips the bit
|
||||
operator bool() const noexcept; // for x = b[i];
|
||||
reference& flip() noexcept; // for b[i].flip();
|
||||
};
|
||||
|
||||
// 23.3.5.1 constructors:
|
||||
constexpr bitset();
|
||||
constexpr bitset(unsigned long long val);
|
||||
constexpr bitset() noexcept;
|
||||
constexpr bitset(unsigned long long val) noexcept;
|
||||
template <class charT>
|
||||
explicit bitset(const charT* str,
|
||||
typename basic_string<charT>::size_type n = basic_string<charT>::npos,
|
||||
@@ -52,17 +52,17 @@ public:
|
||||
charT zero = charT('0'), charT one = charT('1'));
|
||||
|
||||
// 23.3.5.2 bitset operations:
|
||||
bitset& operator&=(const bitset& rhs);
|
||||
bitset& operator|=(const bitset& rhs);
|
||||
bitset& operator^=(const bitset& rhs);
|
||||
bitset& operator<<=(size_t pos);
|
||||
bitset& operator>>=(size_t pos);
|
||||
bitset& set();
|
||||
bitset& operator&=(const bitset& rhs) noexcept;
|
||||
bitset& operator|=(const bitset& rhs) noexcept;
|
||||
bitset& operator^=(const bitset& rhs) noexcept;
|
||||
bitset& operator<<=(size_t pos) noexcept;
|
||||
bitset& operator>>=(size_t pos) noexcept;
|
||||
bitset& set() noexcept;
|
||||
bitset& set(size_t pos, bool val = true);
|
||||
bitset& reset();
|
||||
bitset& reset() noexcept;
|
||||
bitset& reset(size_t pos);
|
||||
bitset operator~() const;
|
||||
bitset& flip();
|
||||
bitset operator~() const noexcept;
|
||||
bitset& flip() noexcept;
|
||||
bitset& flip(size_t pos);
|
||||
|
||||
// element access:
|
||||
@@ -77,27 +77,27 @@ public:
|
||||
template <class charT>
|
||||
basic_string<charT, char_traits<charT>, allocator<charT> > to_string(charT zero = charT('0'), charT one = charT('1')) const;
|
||||
basic_string<char, char_traits<char>, allocator<char> > to_string(char zero = '0', char one = '1') const;
|
||||
size_t count() const;
|
||||
constexpr size_t size() const;
|
||||
bool operator==(const bitset& rhs) const;
|
||||
bool operator!=(const bitset& rhs) const;
|
||||
size_t count() const noexcept;
|
||||
constexpr size_t size() const noexcept;
|
||||
bool operator==(const bitset& rhs) const noexcept;
|
||||
bool operator!=(const bitset& rhs) const noexcept;
|
||||
bool test(size_t pos) const;
|
||||
bool all() const;
|
||||
bool any() const;
|
||||
bool none() const;
|
||||
bitset operator<<(size_t pos) const;
|
||||
bitset operator>>(size_t pos) const;
|
||||
bool all() const noexcept;
|
||||
bool any() const noexcept;
|
||||
bool none() const noexcept;
|
||||
bitset operator<<(size_t pos) const noexcept;
|
||||
bitset operator>>(size_t pos) const noexcept;
|
||||
};
|
||||
|
||||
// 23.3.5.3 bitset operators:
|
||||
template <size_t N>
|
||||
bitset<N> operator&(const bitset<N>&, const bitset<N>&);
|
||||
bitset<N> operator&(const bitset<N>&, const bitset<N>&) noexcept;
|
||||
|
||||
template <size_t N>
|
||||
bitset<N> operator|(const bitset<N>&, const bitset<N>&);
|
||||
bitset<N> operator|(const bitset<N>&, const bitset<N>&) noexcept;
|
||||
|
||||
template <size_t N>
|
||||
bitset<N> operator^(const bitset<N>&, const bitset<N>&);
|
||||
bitset<N> operator^(const bitset<N>&, const bitset<N>&) noexcept;
|
||||
|
||||
template <class charT, class traits, size_t N>
|
||||
basic_istream<charT, traits>&
|
||||
@@ -129,6 +129,15 @@ template <size_t N> struct hash<std::bitset<N>>;
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
class __bitset;
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
struct __has_storage_type<__bitset<_N_words, _Size> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
class __bitset
|
||||
{
|
||||
@@ -155,34 +164,34 @@ protected:
|
||||
typedef __bit_iterator<__bitset, false> iterator;
|
||||
typedef __bit_iterator<__bitset, true> const_iterator;
|
||||
|
||||
__bitset();
|
||||
explicit __bitset(unsigned long long __v);
|
||||
__bitset() _NOEXCEPT;
|
||||
explicit __bitset(unsigned long long __v) _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos)
|
||||
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
|
||||
{return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const _NOEXCEPT
|
||||
{return const_reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
|
||||
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos)
|
||||
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
|
||||
{return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
|
||||
{return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
||||
|
||||
void operator&=(const __bitset& __v);
|
||||
void operator|=(const __bitset& __v);
|
||||
void operator^=(const __bitset& __v);
|
||||
void operator&=(const __bitset& __v) _NOEXCEPT;
|
||||
void operator|=(const __bitset& __v) _NOEXCEPT;
|
||||
void operator^=(const __bitset& __v) _NOEXCEPT;
|
||||
|
||||
void flip();
|
||||
void flip() _NOEXCEPT;
|
||||
_LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const
|
||||
{return to_ulong(integral_constant<bool, _Size < sizeof(unsigned long) * CHAR_BIT>());}
|
||||
_LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const
|
||||
{return to_ullong(integral_constant<bool, _Size < sizeof(unsigned long long) * CHAR_BIT>());}
|
||||
|
||||
bool all() const;
|
||||
bool any() const;
|
||||
size_t __hash_code() const;
|
||||
bool all() const _NOEXCEPT;
|
||||
bool any() const _NOEXCEPT;
|
||||
size_t __hash_code() const _NOEXCEPT;
|
||||
private:
|
||||
void __init(unsigned long long __v, false_type);
|
||||
void __init(unsigned long long __v, true_type);
|
||||
void __init(unsigned long long __v, false_type) _NOEXCEPT;
|
||||
void __init(unsigned long long __v, true_type) _NOEXCEPT;
|
||||
unsigned long to_ulong(false_type) const;
|
||||
unsigned long to_ulong(true_type) const;
|
||||
unsigned long long to_ullong(false_type) const;
|
||||
@@ -193,9 +202,9 @@ private:
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__bitset<_N_words, _Size>::__bitset()
|
||||
__bitset<_N_words, _Size>::__bitset() _NOEXCEPT
|
||||
{
|
||||
_STD::fill_n(__first_, _N_words, __storage_type(0));
|
||||
_VSTD::fill_n(__first_, _N_words, __storage_type(0));
|
||||
}
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
@@ -205,8 +214,8 @@ __bitset<_N_words, _Size>::__init(unsigned long long __v, false_type)
|
||||
__storage_type __t[sizeof(unsigned long long) / sizeof(__storage_type)];
|
||||
for (size_t __i = 0; __i < sizeof(__t)/sizeof(__t[0]); ++__i, __v >>= __bits_per_word)
|
||||
__t[__i] = static_cast<__storage_type>(__v);
|
||||
_STD::copy(__t, __t + sizeof(__t)/sizeof(__t[0]), __first_);
|
||||
_STD::fill(__first_ + sizeof(__t)/sizeof(__t[0]), __first_ + sizeof(__first_)/sizeof(__first_[0]),
|
||||
_VSTD::copy(__t, __t + sizeof(__t)/sizeof(__t[0]), __first_);
|
||||
_VSTD::fill(__first_ + sizeof(__t)/sizeof(__t[0]), __first_ + sizeof(__first_)/sizeof(__first_[0]),
|
||||
__storage_type(0));
|
||||
}
|
||||
|
||||
@@ -216,12 +225,12 @@ void
|
||||
__bitset<_N_words, _Size>::__init(unsigned long long __v, true_type)
|
||||
{
|
||||
__first_[0] = __v;
|
||||
_STD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0));
|
||||
_VSTD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0));
|
||||
}
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__bitset<_N_words, _Size>::__bitset(unsigned long long __v)
|
||||
__bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
|
||||
{
|
||||
__init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>());
|
||||
}
|
||||
@@ -229,7 +238,7 @@ __bitset<_N_words, _Size>::__bitset(unsigned long long __v)
|
||||
template <size_t _N_words, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__bitset<_N_words, _Size>::operator&=(const __bitset& __v)
|
||||
__bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
|
||||
{
|
||||
for (size_type __i = 0; __i < _N_words; ++__i)
|
||||
__first_[__i] &= __v.__first_[__i];
|
||||
@@ -238,7 +247,7 @@ __bitset<_N_words, _Size>::operator&=(const __bitset& __v)
|
||||
template <size_t _N_words, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__bitset<_N_words, _Size>::operator|=(const __bitset& __v)
|
||||
__bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
|
||||
{
|
||||
for (size_type __i = 0; __i < _N_words; ++__i)
|
||||
__first_[__i] |= __v.__first_[__i];
|
||||
@@ -247,7 +256,7 @@ __bitset<_N_words, _Size>::operator|=(const __bitset& __v)
|
||||
template <size_t _N_words, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__bitset<_N_words, _Size>::operator^=(const __bitset& __v)
|
||||
__bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
|
||||
{
|
||||
for (size_type __i = 0; __i < _N_words; ++__i)
|
||||
__first_[__i] ^= __v.__first_[__i];
|
||||
@@ -255,7 +264,7 @@ __bitset<_N_words, _Size>::operator^=(const __bitset& __v)
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
void
|
||||
__bitset<_N_words, _Size>::flip()
|
||||
__bitset<_N_words, _Size>::flip() _NOEXCEPT
|
||||
{
|
||||
// do middle whole words
|
||||
size_type __n = _Size;
|
||||
@@ -277,7 +286,7 @@ unsigned long
|
||||
__bitset<_N_words, _Size>::to_ulong(false_type) const
|
||||
{
|
||||
const_iterator __e = __make_iter(_Size);
|
||||
const_iterator __i = _STD::find(__make_iter(sizeof(unsigned long) * CHAR_BIT), __e, true);
|
||||
const_iterator __i = _VSTD::find(__make_iter(sizeof(unsigned long) * CHAR_BIT), __e, true);
|
||||
if (__i != __e)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw overflow_error("bitset to_ulong overflow error");
|
||||
@@ -300,7 +309,7 @@ unsigned long long
|
||||
__bitset<_N_words, _Size>::to_ullong(false_type) const
|
||||
{
|
||||
const_iterator __e = __make_iter(_Size);
|
||||
const_iterator __i = _STD::find(__make_iter(sizeof(unsigned long long) * CHAR_BIT), __e, true);
|
||||
const_iterator __i = _VSTD::find(__make_iter(sizeof(unsigned long long) * CHAR_BIT), __e, true);
|
||||
if (__i != __e)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw overflow_error("bitset to_ullong overflow error");
|
||||
@@ -338,7 +347,7 @@ __bitset<_N_words, _Size>::to_ullong(true_type, true_type) const
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
bool
|
||||
__bitset<_N_words, _Size>::all() const
|
||||
__bitset<_N_words, _Size>::all() const _NOEXCEPT
|
||||
{
|
||||
// do middle whole words
|
||||
size_type __n = _Size;
|
||||
@@ -358,7 +367,7 @@ __bitset<_N_words, _Size>::all() const
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
bool
|
||||
__bitset<_N_words, _Size>::any() const
|
||||
__bitset<_N_words, _Size>::any() const _NOEXCEPT
|
||||
{
|
||||
// do middle whole words
|
||||
size_type __n = _Size;
|
||||
@@ -379,7 +388,7 @@ __bitset<_N_words, _Size>::any() const
|
||||
template <size_t _N_words, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
size_t
|
||||
__bitset<_N_words, _Size>::__hash_code() const
|
||||
__bitset<_N_words, _Size>::__hash_code() const _NOEXCEPT
|
||||
{
|
||||
size_t __h = 0;
|
||||
for (size_type __i = 0; __i < _N_words; ++__i)
|
||||
@@ -413,43 +422,43 @@ protected:
|
||||
typedef __bit_iterator<__bitset, false> iterator;
|
||||
typedef __bit_iterator<__bitset, true> const_iterator;
|
||||
|
||||
__bitset();
|
||||
explicit __bitset(unsigned long long __v);
|
||||
__bitset() _NOEXCEPT;
|
||||
explicit __bitset(unsigned long long __v) _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos)
|
||||
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
|
||||
{return reference(&__first_, __storage_type(1) << __pos);}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const _NOEXCEPT
|
||||
{return const_reference(&__first_, __storage_type(1) << __pos);}
|
||||
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos)
|
||||
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
|
||||
{return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
|
||||
{return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
||||
|
||||
void operator&=(const __bitset& __v);
|
||||
void operator|=(const __bitset& __v);
|
||||
void operator^=(const __bitset& __v);
|
||||
void operator&=(const __bitset& __v) _NOEXCEPT;
|
||||
void operator|=(const __bitset& __v) _NOEXCEPT;
|
||||
void operator^=(const __bitset& __v) _NOEXCEPT;
|
||||
|
||||
void flip();
|
||||
void flip() _NOEXCEPT;
|
||||
|
||||
unsigned long to_ulong() const;
|
||||
unsigned long long to_ullong() const;
|
||||
|
||||
bool all() const;
|
||||
bool any() const;
|
||||
bool all() const _NOEXCEPT;
|
||||
bool any() const _NOEXCEPT;
|
||||
|
||||
size_t __hash_code() const;
|
||||
size_t __hash_code() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__bitset<1, _Size>::__bitset()
|
||||
__bitset<1, _Size>::__bitset() _NOEXCEPT
|
||||
: __first_(0)
|
||||
{
|
||||
}
|
||||
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__bitset<1, _Size>::__bitset(unsigned long long __v)
|
||||
__bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
|
||||
: __first_(static_cast<__storage_type>(__v))
|
||||
{
|
||||
}
|
||||
@@ -457,7 +466,7 @@ __bitset<1, _Size>::__bitset(unsigned long long __v)
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__bitset<1, _Size>::operator&=(const __bitset& __v)
|
||||
__bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
|
||||
{
|
||||
__first_ &= __v.__first_;
|
||||
}
|
||||
@@ -465,7 +474,7 @@ __bitset<1, _Size>::operator&=(const __bitset& __v)
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__bitset<1, _Size>::operator|=(const __bitset& __v)
|
||||
__bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
|
||||
{
|
||||
__first_ |= __v.__first_;
|
||||
}
|
||||
@@ -473,7 +482,7 @@ __bitset<1, _Size>::operator|=(const __bitset& __v)
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__bitset<1, _Size>::operator^=(const __bitset& __v)
|
||||
__bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
|
||||
{
|
||||
__first_ ^= __v.__first_;
|
||||
}
|
||||
@@ -481,7 +490,7 @@ __bitset<1, _Size>::operator^=(const __bitset& __v)
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__bitset<1, _Size>::flip()
|
||||
__bitset<1, _Size>::flip() _NOEXCEPT
|
||||
{
|
||||
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
|
||||
__first_ = ~__first_;
|
||||
@@ -507,7 +516,7 @@ __bitset<1, _Size>::to_ullong() const
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
__bitset<1, _Size>::all() const
|
||||
__bitset<1, _Size>::all() const _NOEXCEPT
|
||||
{
|
||||
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
|
||||
return !(~__first_ & __m);
|
||||
@@ -516,7 +525,7 @@ __bitset<1, _Size>::all() const
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
__bitset<1, _Size>::any() const
|
||||
__bitset<1, _Size>::any() const _NOEXCEPT
|
||||
{
|
||||
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
|
||||
return __first_ & __m;
|
||||
@@ -525,7 +534,7 @@ __bitset<1, _Size>::any() const
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
size_t
|
||||
__bitset<1, _Size>::__hash_code() const
|
||||
__bitset<1, _Size>::__hash_code() const _NOEXCEPT
|
||||
{
|
||||
return __first_;
|
||||
}
|
||||
@@ -554,40 +563,40 @@ protected:
|
||||
typedef __bit_iterator<__bitset, false> iterator;
|
||||
typedef __bit_iterator<__bitset, true> const_iterator;
|
||||
|
||||
__bitset();
|
||||
explicit __bitset(unsigned long long);
|
||||
__bitset() _NOEXCEPT;
|
||||
explicit __bitset(unsigned long long) _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t)
|
||||
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT
|
||||
{return reference(0, 1);}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t) const
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t) const _NOEXCEPT
|
||||
{return const_reference(0, 1);}
|
||||
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos)
|
||||
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
|
||||
{return iterator(0, 0);}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
|
||||
{return const_iterator(0, 0);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) {}
|
||||
_LIBCPP_INLINE_VISIBILITY void operator|=(const __bitset&) {}
|
||||
_LIBCPP_INLINE_VISIBILITY void operator^=(const __bitset&) {}
|
||||
_LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {}
|
||||
_LIBCPP_INLINE_VISIBILITY void operator|=(const __bitset&) _NOEXCEPT {}
|
||||
_LIBCPP_INLINE_VISIBILITY void operator^=(const __bitset&) _NOEXCEPT {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void flip() {}
|
||||
_LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const {return 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const {return 0;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY bool all() const {return true;}
|
||||
_LIBCPP_INLINE_VISIBILITY bool any() const {return false;}
|
||||
_LIBCPP_INLINE_VISIBILITY bool all() const _NOEXCEPT {return true;}
|
||||
_LIBCPP_INLINE_VISIBILITY bool any() const _NOEXCEPT {return false;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY size_t __hash_code() const {return 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT {return 0;}
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__bitset<0, 0>::__bitset()
|
||||
__bitset<0, 0>::__bitset() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__bitset<0, 0>::__bitset(unsigned long long)
|
||||
__bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
@@ -606,8 +615,8 @@ public:
|
||||
typedef typename base::const_reference const_reference;
|
||||
|
||||
// 23.3.5.1 constructors:
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset() {}
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset(unsigned long long __v) : base(__v) {}
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset() _NOEXCEPT {}
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
|
||||
template<class _CharT>
|
||||
explicit bitset(const _CharT* __str,
|
||||
typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,
|
||||
@@ -620,17 +629,17 @@ public:
|
||||
_CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
|
||||
|
||||
// 23.3.5.2 bitset operations:
|
||||
bitset& operator&=(const bitset& __rhs);
|
||||
bitset& operator|=(const bitset& __rhs);
|
||||
bitset& operator^=(const bitset& __rhs);
|
||||
bitset& operator<<=(size_t __pos);
|
||||
bitset& operator>>=(size_t __pos);
|
||||
bitset& set();
|
||||
bitset& operator&=(const bitset& __rhs) _NOEXCEPT;
|
||||
bitset& operator|=(const bitset& __rhs) _NOEXCEPT;
|
||||
bitset& operator^=(const bitset& __rhs) _NOEXCEPT;
|
||||
bitset& operator<<=(size_t __pos) _NOEXCEPT;
|
||||
bitset& operator>>=(size_t __pos) _NOEXCEPT;
|
||||
bitset& set() _NOEXCEPT;
|
||||
bitset& set(size_t __pos, bool __val = true);
|
||||
bitset& reset();
|
||||
bitset& reset() _NOEXCEPT;
|
||||
bitset& reset(size_t __pos);
|
||||
bitset operator~() const;
|
||||
bitset& flip();
|
||||
bitset operator~() const _NOEXCEPT;
|
||||
bitset& flip() _NOEXCEPT;
|
||||
bitset& flip(size_t __pos);
|
||||
|
||||
// element access:
|
||||
@@ -649,21 +658,21 @@ public:
|
||||
_CharT __one = _CharT('1')) const;
|
||||
basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0',
|
||||
char __one = '1') const;
|
||||
size_t count() const;
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY size_t size() const {return _Size;}
|
||||
bool operator==(const bitset& __rhs) const;
|
||||
bool operator!=(const bitset& __rhs) const;
|
||||
size_t count() const _NOEXCEPT;
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY size_t size() const _NOEXCEPT {return _Size;}
|
||||
bool operator==(const bitset& __rhs) const _NOEXCEPT;
|
||||
bool operator!=(const bitset& __rhs) const _NOEXCEPT;
|
||||
bool test(size_t __pos) const;
|
||||
bool all() const;
|
||||
bool any() const;
|
||||
_LIBCPP_INLINE_VISIBILITY bool none() const {return !any();}
|
||||
bitset operator<<(size_t __pos) const;
|
||||
bitset operator>>(size_t __pos) const;
|
||||
bool all() const _NOEXCEPT;
|
||||
bool any() const _NOEXCEPT;
|
||||
_LIBCPP_INLINE_VISIBILITY bool none() const _NOEXCEPT {return !any();}
|
||||
bitset operator<<(size_t __pos) const _NOEXCEPT;
|
||||
bitset operator>>(size_t __pos) const _NOEXCEPT;
|
||||
|
||||
private:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t __hash_code() const {return base::__hash_code();}
|
||||
size_t __hash_code() const _NOEXCEPT {return base::__hash_code();}
|
||||
|
||||
friend struct hash<bitset>;
|
||||
};
|
||||
@@ -674,7 +683,7 @@ bitset<_Size>::bitset(const _CharT* __str,
|
||||
typename basic_string<_CharT>::size_type __n,
|
||||
_CharT __zero, _CharT __one)
|
||||
{
|
||||
size_t __rlen = _STD::min(__n, char_traits<_CharT>::length(__str));
|
||||
size_t __rlen = _VSTD::min(__n, char_traits<_CharT>::length(__str));
|
||||
for (size_t __i = 0; __i < __rlen; ++__i)
|
||||
if (__str[__i] != __zero && __str[__i] != __one)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -682,7 +691,7 @@ bitset<_Size>::bitset(const _CharT* __str,
|
||||
#else
|
||||
assert(!"bitset string ctor has invalid argument");
|
||||
#endif
|
||||
size_t _M = _STD::min(__rlen, _Size);
|
||||
size_t _M = _VSTD::min(__rlen, _Size);
|
||||
size_t __i = 0;
|
||||
for (; __i < _M; ++__i)
|
||||
{
|
||||
@@ -692,7 +701,7 @@ bitset<_Size>::bitset(const _CharT* __str,
|
||||
else
|
||||
(*this)[__i] = true;
|
||||
}
|
||||
_STD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
|
||||
_VSTD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
|
||||
}
|
||||
|
||||
template <size_t _Size>
|
||||
@@ -708,7 +717,7 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
|
||||
#else
|
||||
assert(!"bitset string pos out of range");
|
||||
#endif
|
||||
size_t __rlen = _STD::min(__n, __str.size() - __pos);
|
||||
size_t __rlen = _VSTD::min(__n, __str.size() - __pos);
|
||||
for (size_t __i = __pos; __i < __pos + __rlen; ++__i)
|
||||
if (!_Traits::eq(__str[__i], __zero) && !_Traits::eq(__str[__i], __one))
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -716,7 +725,7 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
|
||||
#else
|
||||
assert(!"bitset string ctor has invalid argument");
|
||||
#endif
|
||||
size_t _M = _STD::min(__rlen, _Size);
|
||||
size_t _M = _VSTD::min(__rlen, _Size);
|
||||
size_t __i = 0;
|
||||
for (; __i < _M; ++__i)
|
||||
{
|
||||
@@ -726,13 +735,13 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
|
||||
else
|
||||
(*this)[__i] = true;
|
||||
}
|
||||
_STD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
|
||||
_VSTD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
|
||||
}
|
||||
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bitset<_Size>&
|
||||
bitset<_Size>::operator&=(const bitset& __rhs)
|
||||
bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT
|
||||
{
|
||||
base::operator&=(__rhs);
|
||||
return *this;
|
||||
@@ -741,7 +750,7 @@ bitset<_Size>::operator&=(const bitset& __rhs)
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bitset<_Size>&
|
||||
bitset<_Size>::operator|=(const bitset& __rhs)
|
||||
bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT
|
||||
{
|
||||
base::operator|=(__rhs);
|
||||
return *this;
|
||||
@@ -750,7 +759,7 @@ bitset<_Size>::operator|=(const bitset& __rhs)
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bitset<_Size>&
|
||||
bitset<_Size>::operator^=(const bitset& __rhs)
|
||||
bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT
|
||||
{
|
||||
base::operator^=(__rhs);
|
||||
return *this;
|
||||
@@ -758,30 +767,30 @@ bitset<_Size>::operator^=(const bitset& __rhs)
|
||||
|
||||
template <size_t _Size>
|
||||
bitset<_Size>&
|
||||
bitset<_Size>::operator<<=(size_t __pos)
|
||||
bitset<_Size>::operator<<=(size_t __pos) _NOEXCEPT
|
||||
{
|
||||
__pos = _STD::min(__pos, _Size);
|
||||
_STD::copy_backward(base::__make_iter(0), base::__make_iter(_Size - __pos), base::__make_iter(_Size));
|
||||
_STD::fill_n(base::__make_iter(0), __pos, false);
|
||||
__pos = _VSTD::min(__pos, _Size);
|
||||
_VSTD::copy_backward(base::__make_iter(0), base::__make_iter(_Size - __pos), base::__make_iter(_Size));
|
||||
_VSTD::fill_n(base::__make_iter(0), __pos, false);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <size_t _Size>
|
||||
bitset<_Size>&
|
||||
bitset<_Size>::operator>>=(size_t __pos)
|
||||
bitset<_Size>::operator>>=(size_t __pos) _NOEXCEPT
|
||||
{
|
||||
__pos = _STD::min(__pos, _Size);
|
||||
_STD::copy(base::__make_iter(__pos), base::__make_iter(_Size), base::__make_iter(0));
|
||||
_STD::fill_n(base::__make_iter(_Size - __pos), __pos, false);
|
||||
__pos = _VSTD::min(__pos, _Size);
|
||||
_VSTD::copy(base::__make_iter(__pos), base::__make_iter(_Size), base::__make_iter(0));
|
||||
_VSTD::fill_n(base::__make_iter(_Size - __pos), __pos, false);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bitset<_Size>&
|
||||
bitset<_Size>::set()
|
||||
bitset<_Size>::set() _NOEXCEPT
|
||||
{
|
||||
_STD::fill_n(base::__make_iter(0), _Size, true);
|
||||
_VSTD::fill_n(base::__make_iter(0), _Size, true);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -802,9 +811,9 @@ bitset<_Size>::set(size_t __pos, bool __val)
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bitset<_Size>&
|
||||
bitset<_Size>::reset()
|
||||
bitset<_Size>::reset() _NOEXCEPT
|
||||
{
|
||||
_STD::fill_n(base::__make_iter(0), _Size, false);
|
||||
_VSTD::fill_n(base::__make_iter(0), _Size, false);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -825,7 +834,7 @@ bitset<_Size>::reset(size_t __pos)
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bitset<_Size>
|
||||
bitset<_Size>::operator~() const
|
||||
bitset<_Size>::operator~() const _NOEXCEPT
|
||||
{
|
||||
bitset __x(*this);
|
||||
__x.flip();
|
||||
@@ -835,7 +844,7 @@ bitset<_Size>::operator~() const
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bitset<_Size>&
|
||||
bitset<_Size>::flip()
|
||||
bitset<_Size>::flip() _NOEXCEPT
|
||||
{
|
||||
base::flip();
|
||||
return *this;
|
||||
@@ -915,23 +924,23 @@ bitset<_Size>::to_string(char __zero, char __one) const
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
size_t
|
||||
bitset<_Size>::count() const
|
||||
bitset<_Size>::count() const _NOEXCEPT
|
||||
{
|
||||
return static_cast<size_t>(_STD::count(base::__make_iter(0), base::__make_iter(_Size), true));
|
||||
return static_cast<size_t>(_VSTD::count(base::__make_iter(0), base::__make_iter(_Size), true));
|
||||
}
|
||||
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
bitset<_Size>::operator==(const bitset& __rhs) const
|
||||
bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT
|
||||
{
|
||||
return _STD::equal(base::__make_iter(0), base::__make_iter(_Size), __rhs.__make_iter(0));
|
||||
return _VSTD::equal(base::__make_iter(0), base::__make_iter(_Size), __rhs.__make_iter(0));
|
||||
}
|
||||
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
bitset<_Size>::operator!=(const bitset& __rhs) const
|
||||
bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT
|
||||
{
|
||||
return !(*this == __rhs);
|
||||
}
|
||||
@@ -952,7 +961,7 @@ bitset<_Size>::test(size_t __pos) const
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
bitset<_Size>::all() const
|
||||
bitset<_Size>::all() const _NOEXCEPT
|
||||
{
|
||||
return base::all();
|
||||
}
|
||||
@@ -960,7 +969,7 @@ bitset<_Size>::all() const
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
bitset<_Size>::any() const
|
||||
bitset<_Size>::any() const _NOEXCEPT
|
||||
{
|
||||
return base::any();
|
||||
}
|
||||
@@ -968,7 +977,7 @@ bitset<_Size>::any() const
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bitset<_Size>
|
||||
bitset<_Size>::operator<<(size_t __pos) const
|
||||
bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT
|
||||
{
|
||||
bitset __r = *this;
|
||||
__r <<= __pos;
|
||||
@@ -978,7 +987,7 @@ bitset<_Size>::operator<<(size_t __pos) const
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bitset<_Size>
|
||||
bitset<_Size>::operator>>(size_t __pos) const
|
||||
bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT
|
||||
{
|
||||
bitset __r = *this;
|
||||
__r >>= __pos;
|
||||
@@ -988,7 +997,7 @@ bitset<_Size>::operator>>(size_t __pos) const
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bitset<_Size>
|
||||
operator&(const bitset<_Size>& __x, const bitset<_Size>& __y)
|
||||
operator&(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
|
||||
{
|
||||
bitset<_Size> __r = __x;
|
||||
__r &= __y;
|
||||
@@ -998,7 +1007,7 @@ operator&(const bitset<_Size>& __x, const bitset<_Size>& __y)
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bitset<_Size>
|
||||
operator|(const bitset<_Size>& __x, const bitset<_Size>& __y)
|
||||
operator|(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
|
||||
{
|
||||
bitset<_Size> __r = __x;
|
||||
__r |= __y;
|
||||
@@ -1008,7 +1017,7 @@ operator|(const bitset<_Size>& __x, const bitset<_Size>& __y)
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bitset<_Size>
|
||||
operator^(const bitset<_Size>& __x, const bitset<_Size>& __y)
|
||||
operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
|
||||
{
|
||||
bitset<_Size> __r = __x;
|
||||
__r ^= __y;
|
||||
@@ -1020,10 +1029,18 @@ struct _LIBCPP_VISIBLE hash<bitset<_Size> >
|
||||
: public unary_function<bitset<_Size>, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const bitset<_Size>& __bs) const
|
||||
size_t operator()(const bitset<_Size>& __bs) const _NOEXCEPT
|
||||
{return __bs.__hash_code();}
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits, size_t _Size>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x);
|
||||
|
||||
template <class _CharT, class _Traits, size_t _Size>
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x);
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_BITSET
|
||||
|
||||
@@ -30,25 +30,43 @@ Macros:
|
||||
|
||||
#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
|
||||
|
||||
#ifdef ELAST
|
||||
|
||||
const int __elast1 = ELAST+1;
|
||||
const int __elast2 = ELAST+2;
|
||||
#undef ELAST
|
||||
|
||||
#else
|
||||
|
||||
const int __elast1 = 104;
|
||||
const int __elast2 = 105;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ENOTRECOVERABLE
|
||||
|
||||
#define EOWNERDEAD __elast1
|
||||
|
||||
#ifdef ELAST
|
||||
#undef ELAST
|
||||
#define ELAST EOWNERDEAD
|
||||
#endif
|
||||
|
||||
#elif defined(EOWNERDEAD)
|
||||
|
||||
#define ENOTRECOVERABLE __elast1
|
||||
#ifdef ELAST
|
||||
#undef ELAST
|
||||
#define ELAST ENOTRECOVERABLE
|
||||
#endif
|
||||
|
||||
#else // defined(EOWNERDEAD)
|
||||
|
||||
#define EOWNERDEAD __elast1
|
||||
#define ENOTRECOVERABLE __elast2
|
||||
#ifdef ELAST
|
||||
#undef ELAST
|
||||
#define ELAST ENOTRECOVERABLE
|
||||
#endif
|
||||
|
||||
#endif // defined(EOWNERDEAD)
|
||||
|
||||
|
||||
@@ -225,9 +225,9 @@ public:
|
||||
typedef chrono::time_point<system_clock> time_point;
|
||||
static const bool is_steady = false;
|
||||
|
||||
static time_point now();
|
||||
static time_t to_time_t (const time_point& __t);
|
||||
static time_point from_time_t(time_t __t);
|
||||
static time_point now() noexcept;
|
||||
static time_t to_time_t (const time_point& __t) noexcept;
|
||||
static time_point from_time_t(time_t __t) noexcept;
|
||||
};
|
||||
|
||||
class steady_clock
|
||||
@@ -239,7 +239,7 @@ public:
|
||||
typedef chrono::time_point<steady_clock, duration> time_point;
|
||||
static const bool is_steady = true;
|
||||
|
||||
static time_point now();
|
||||
static time_point now() noexcept;
|
||||
};
|
||||
|
||||
typedef steady_clock high_resolution_clock;
|
||||
@@ -407,7 +407,7 @@ public:
|
||||
(ratio_divide<_Period2, period>::type::den == 1 &&
|
||||
!treat_as_floating_point<_Rep2>::value)
|
||||
>::type* = 0)
|
||||
: __rep_(_STD::chrono::duration_cast<duration>(__d).count()) {}
|
||||
: __rep_(_VSTD::chrono::duration_cast<duration>(__d).count()) {}
|
||||
|
||||
// observer
|
||||
|
||||
@@ -726,7 +726,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
time_point<_Clock, _ToDuration>
|
||||
time_point_cast(const time_point<_Clock, _Duration>& __t)
|
||||
{
|
||||
return time_point<_Clock, _ToDuration>(_STD::chrono::duration_cast<_ToDuration>(__t.time_since_epoch()));
|
||||
return time_point<_Clock, _ToDuration>(_VSTD::chrono::duration_cast<_ToDuration>(__t.time_since_epoch()));
|
||||
}
|
||||
|
||||
// time_point ==
|
||||
@@ -845,9 +845,9 @@ public:
|
||||
typedef chrono::time_point<system_clock> time_point;
|
||||
static const bool is_steady = false;
|
||||
|
||||
static time_point now();
|
||||
static time_t to_time_t (const time_point& __t);
|
||||
static time_point from_time_t(time_t __t);
|
||||
static time_point now() _NOEXCEPT;
|
||||
static time_t to_time_t (const time_point& __t) _NOEXCEPT;
|
||||
static time_point from_time_t(time_t __t) _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_VISIBLE steady_clock
|
||||
@@ -859,7 +859,7 @@ public:
|
||||
typedef chrono::time_point<steady_clock, duration> time_point;
|
||||
static const bool is_steady = true;
|
||||
|
||||
static time_point now();
|
||||
static time_point now() _NOEXCEPT;
|
||||
};
|
||||
|
||||
typedef steady_clock high_resolution_clock;
|
||||
|
||||
674
include/cmath
674
include/cmath
@@ -303,8 +303,340 @@ long double truncl(long double x);
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
// signbit
|
||||
|
||||
#ifdef signbit
|
||||
|
||||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool
|
||||
__libcpp_signbit(_A1 __x)
|
||||
{
|
||||
return signbit(__x);
|
||||
}
|
||||
|
||||
#undef signbit
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
|
||||
signbit(_A1 __x)
|
||||
{
|
||||
return __libcpp_signbit(__x);
|
||||
}
|
||||
|
||||
#endif // signbit
|
||||
|
||||
// fpclassify
|
||||
|
||||
#ifdef fpclassify
|
||||
|
||||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
int
|
||||
__libcpp_fpclassify(_A1 __x)
|
||||
{
|
||||
return fpclassify(__x);
|
||||
}
|
||||
|
||||
#undef fpclassify
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_floating_point<_A1>::value, int>::type
|
||||
fpclassify(_A1 __x)
|
||||
{
|
||||
return __libcpp_fpclassify(__x);
|
||||
}
|
||||
|
||||
#endif // fpclassify
|
||||
|
||||
// isfinite
|
||||
|
||||
#ifdef isfinite
|
||||
|
||||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool
|
||||
__libcpp_isfinite(_A1 __x)
|
||||
{
|
||||
return isfinite(__x);
|
||||
}
|
||||
|
||||
#undef isfinite
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
|
||||
isfinite(_A1 __x)
|
||||
{
|
||||
return __libcpp_isfinite(__x);
|
||||
}
|
||||
|
||||
#endif // isfinite
|
||||
|
||||
// isinf
|
||||
|
||||
#ifdef isinf
|
||||
|
||||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool
|
||||
__libcpp_isinf(_A1 __x)
|
||||
{
|
||||
return isinf(__x);
|
||||
}
|
||||
|
||||
#undef isinf
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
|
||||
isinf(_A1 __x)
|
||||
{
|
||||
return __libcpp_isinf(__x);
|
||||
}
|
||||
|
||||
#endif // isinf
|
||||
|
||||
// isnan
|
||||
|
||||
#ifdef isnan
|
||||
|
||||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool
|
||||
__libcpp_isnan(_A1 __x)
|
||||
{
|
||||
return isnan(__x);
|
||||
}
|
||||
|
||||
#undef isnan
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
|
||||
isnan(_A1 __x)
|
||||
{
|
||||
return __libcpp_isnan(__x);
|
||||
}
|
||||
|
||||
#endif // isnan
|
||||
|
||||
// isnormal
|
||||
|
||||
#ifdef isnormal
|
||||
|
||||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool
|
||||
__libcpp_isnormal(_A1 __x)
|
||||
{
|
||||
return isnormal(__x);
|
||||
}
|
||||
|
||||
#undef isnormal
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
|
||||
isnormal(_A1 __x)
|
||||
{
|
||||
return __libcpp_isnormal(__x);
|
||||
}
|
||||
|
||||
#endif // isnormal
|
||||
|
||||
// isgreater
|
||||
|
||||
#ifdef isgreater
|
||||
|
||||
template <class _A1, class _A2>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool
|
||||
__libcpp_isgreater(_A1 __x, _A2 __y)
|
||||
{
|
||||
return isgreater(__x, __y);
|
||||
}
|
||||
|
||||
#undef isgreater
|
||||
|
||||
template <class _A1, class _A2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if
|
||||
<
|
||||
std::is_floating_point<_A1>::value &&
|
||||
std::is_floating_point<_A2>::value,
|
||||
bool
|
||||
>::type
|
||||
isgreater(_A1 __x, _A2 __y)
|
||||
{
|
||||
return __libcpp_isgreater(__x, __y);
|
||||
}
|
||||
|
||||
#endif // isgreater
|
||||
|
||||
// isgreaterequal
|
||||
|
||||
#ifdef isgreaterequal
|
||||
|
||||
template <class _A1, class _A2>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool
|
||||
__libcpp_isgreaterequal(_A1 __x, _A2 __y)
|
||||
{
|
||||
return isgreaterequal(__x, __y);
|
||||
}
|
||||
|
||||
#undef isgreaterequal
|
||||
|
||||
template <class _A1, class _A2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if
|
||||
<
|
||||
std::is_floating_point<_A1>::value &&
|
||||
std::is_floating_point<_A2>::value,
|
||||
bool
|
||||
>::type
|
||||
isgreaterequal(_A1 __x, _A2 __y)
|
||||
{
|
||||
return __libcpp_isgreaterequal(__x, __y);
|
||||
}
|
||||
|
||||
#endif // isgreaterequal
|
||||
|
||||
// isless
|
||||
|
||||
#ifdef isless
|
||||
|
||||
template <class _A1, class _A2>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool
|
||||
__libcpp_isless(_A1 __x, _A2 __y)
|
||||
{
|
||||
return isless(__x, __y);
|
||||
}
|
||||
|
||||
#undef isless
|
||||
|
||||
template <class _A1, class _A2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if
|
||||
<
|
||||
std::is_floating_point<_A1>::value &&
|
||||
std::is_floating_point<_A2>::value,
|
||||
bool
|
||||
>::type
|
||||
isless(_A1 __x, _A2 __y)
|
||||
{
|
||||
return __libcpp_isless(__x, __y);
|
||||
}
|
||||
|
||||
#endif // isless
|
||||
|
||||
// islessequal
|
||||
|
||||
#ifdef islessequal
|
||||
|
||||
template <class _A1, class _A2>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool
|
||||
__libcpp_islessequal(_A1 __x, _A2 __y)
|
||||
{
|
||||
return islessequal(__x, __y);
|
||||
}
|
||||
|
||||
#undef islessequal
|
||||
|
||||
template <class _A1, class _A2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if
|
||||
<
|
||||
std::is_floating_point<_A1>::value &&
|
||||
std::is_floating_point<_A2>::value,
|
||||
bool
|
||||
>::type
|
||||
islessequal(_A1 __x, _A2 __y)
|
||||
{
|
||||
return __libcpp_islessequal(__x, __y);
|
||||
}
|
||||
|
||||
#endif // islessequal
|
||||
|
||||
// islessgreater
|
||||
|
||||
#ifdef islessgreater
|
||||
|
||||
template <class _A1, class _A2>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool
|
||||
__libcpp_islessgreater(_A1 __x, _A2 __y)
|
||||
{
|
||||
return islessgreater(__x, __y);
|
||||
}
|
||||
|
||||
#undef islessgreater
|
||||
|
||||
template <class _A1, class _A2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if
|
||||
<
|
||||
std::is_floating_point<_A1>::value &&
|
||||
std::is_floating_point<_A2>::value,
|
||||
bool
|
||||
>::type
|
||||
islessgreater(_A1 __x, _A2 __y)
|
||||
{
|
||||
return __libcpp_islessgreater(__x, __y);
|
||||
}
|
||||
|
||||
#endif // islessgreater
|
||||
|
||||
// isunordered
|
||||
|
||||
#ifdef isunordered
|
||||
|
||||
template <class _A1, class _A2>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool
|
||||
__libcpp_isunordered(_A1 __x, _A2 __y)
|
||||
{
|
||||
return isunordered(__x, __y);
|
||||
}
|
||||
|
||||
#undef isunordered
|
||||
|
||||
template <class _A1, class _A2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if
|
||||
<
|
||||
std::is_floating_point<_A1>::value &&
|
||||
std::is_floating_point<_A2>::value,
|
||||
bool
|
||||
>::type
|
||||
isunordered(_A1 __x, _A2 __y)
|
||||
{
|
||||
return __libcpp_isunordered(__x, __y);
|
||||
}
|
||||
|
||||
#endif // isunordered
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::signbit;
|
||||
using ::fpclassify;
|
||||
using ::isfinite;
|
||||
using ::isinf;
|
||||
using ::isnan;
|
||||
using ::isnormal;
|
||||
using ::isgreater;
|
||||
using ::isgreaterequal;
|
||||
using ::isless;
|
||||
using ::islessequal;
|
||||
using ::islessgreater;
|
||||
using ::isunordered;
|
||||
using ::isunordered;
|
||||
|
||||
using ::float_t;
|
||||
using ::double_t;
|
||||
|
||||
@@ -629,348 +961,6 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if<is_integral<_A1>::value, double>::type
|
||||
tanh(_A1 __x) {return tanh((double)__x);}
|
||||
|
||||
// signbit
|
||||
|
||||
#ifndef signbit
|
||||
#error Implementation error: signbit not defined
|
||||
#else
|
||||
|
||||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool
|
||||
__libcpp_signbit(_A1 __x)
|
||||
{
|
||||
return signbit(__x);
|
||||
}
|
||||
|
||||
#undef signbit
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if<is_floating_point<_A1>::value, bool>::type
|
||||
signbit(_A1 __x)
|
||||
{
|
||||
return __libcpp_signbit(__x);
|
||||
}
|
||||
|
||||
#endif // signbit
|
||||
|
||||
// fpclassify
|
||||
|
||||
#ifndef fpclassify
|
||||
#error Implementation error: fpclassify not defined
|
||||
#else
|
||||
|
||||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
int
|
||||
__libcpp_fpclassify(_A1 __x)
|
||||
{
|
||||
return fpclassify(__x);
|
||||
}
|
||||
|
||||
#undef fpclassify
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if<is_floating_point<_A1>::value, int>::type
|
||||
fpclassify(_A1 __x)
|
||||
{
|
||||
return __libcpp_fpclassify(__x);
|
||||
}
|
||||
|
||||
#endif // fpclassify
|
||||
|
||||
// isfinite
|
||||
|
||||
#ifndef isfinite
|
||||
#error Implementation error: isfinite not defined
|
||||
#else
|
||||
|
||||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool
|
||||
__libcpp_isfinite(_A1 __x)
|
||||
{
|
||||
return isfinite(__x);
|
||||
}
|
||||
|
||||
#undef isfinite
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if<is_floating_point<_A1>::value, bool>::type
|
||||
isfinite(_A1 __x)
|
||||
{
|
||||
return __libcpp_isfinite(__x);
|
||||
}
|
||||
|
||||
#endif // isfinite
|
||||
|
||||
// isinf
|
||||
|
||||
#ifndef isinf
|
||||
#error Implementation error: isinf not defined
|
||||
#else
|
||||
|
||||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool
|
||||
__libcpp_isinf(_A1 __x)
|
||||
{
|
||||
return isinf(__x);
|
||||
}
|
||||
|
||||
#undef isinf
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if<is_floating_point<_A1>::value, bool>::type
|
||||
isinf(_A1 __x)
|
||||
{
|
||||
return __libcpp_isinf(__x);
|
||||
}
|
||||
|
||||
#endif // isinf
|
||||
|
||||
// isnan
|
||||
|
||||
#ifndef isnan
|
||||
#error Implementation error: isnan not defined
|
||||
#else
|
||||
|
||||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool
|
||||
__libcpp_isnan(_A1 __x)
|
||||
{
|
||||
return isnan(__x);
|
||||
}
|
||||
|
||||
#undef isnan
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if<is_floating_point<_A1>::value, bool>::type
|
||||
isnan(_A1 __x)
|
||||
{
|
||||
return __libcpp_isnan(__x);
|
||||
}
|
||||
|
||||
#endif // isnan
|
||||
|
||||
// isnormal
|
||||
|
||||
#ifndef isnormal
|
||||
#error Implementation error: isnormal not defined
|
||||
#else
|
||||
|
||||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool
|
||||
__libcpp_isnormal(_A1 __x)
|
||||
{
|
||||
return isnormal(__x);
|
||||
}
|
||||
|
||||
#undef isnormal
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if<is_floating_point<_A1>::value, bool>::type
|
||||
isnormal(_A1 __x)
|
||||
{
|
||||
return __libcpp_isnormal(__x);
|
||||
}
|
||||
|
||||
#endif // isnormal
|
||||
|
||||
// isgreater
|
||||
|
||||
#ifndef isgreater
|
||||
#error Implementation error: isgreater not defined
|
||||
#else
|
||||
|
||||
template <class _A1, class _A2>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool
|
||||
__libcpp_isgreater(_A1 __x, _A2 __y)
|
||||
{
|
||||
return isgreater(__x, __y);
|
||||
}
|
||||
|
||||
#undef isgreater
|
||||
|
||||
template <class _A1, class _A2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_floating_point<_A1>::value &&
|
||||
is_floating_point<_A2>::value,
|
||||
bool
|
||||
>::type
|
||||
isgreater(_A1 __x, _A2 __y)
|
||||
{
|
||||
return __libcpp_isgreater(__x, __y);
|
||||
}
|
||||
|
||||
#endif // isgreater
|
||||
|
||||
// isgreaterequal
|
||||
|
||||
#ifndef isgreaterequal
|
||||
#error Implementation error: isgreaterequal not defined
|
||||
#else
|
||||
|
||||
template <class _A1, class _A2>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool
|
||||
__libcpp_isgreaterequal(_A1 __x, _A2 __y)
|
||||
{
|
||||
return isgreaterequal(__x, __y);
|
||||
}
|
||||
|
||||
#undef isgreaterequal
|
||||
|
||||
template <class _A1, class _A2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_floating_point<_A1>::value &&
|
||||
is_floating_point<_A2>::value,
|
||||
bool
|
||||
>::type
|
||||
isgreaterequal(_A1 __x, _A2 __y)
|
||||
{
|
||||
return __libcpp_isgreaterequal(__x, __y);
|
||||
}
|
||||
|
||||
#endif // isgreaterequal
|
||||
|
||||
// isless
|
||||
|
||||
#ifndef isless
|
||||
#error Implementation error: isless not defined
|
||||
#else
|
||||
|
||||
template <class _A1, class _A2>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool
|
||||
__libcpp_isless(_A1 __x, _A2 __y)
|
||||
{
|
||||
return isless(__x, __y);
|
||||
}
|
||||
|
||||
#undef isless
|
||||
|
||||
template <class _A1, class _A2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_floating_point<_A1>::value &&
|
||||
is_floating_point<_A2>::value,
|
||||
bool
|
||||
>::type
|
||||
isless(_A1 __x, _A2 __y)
|
||||
{
|
||||
return __libcpp_isless(__x, __y);
|
||||
}
|
||||
|
||||
#endif // isless
|
||||
|
||||
// islessequal
|
||||
|
||||
#ifndef islessequal
|
||||
#error Implementation error: islessequal not defined
|
||||
#else
|
||||
|
||||
template <class _A1, class _A2>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool
|
||||
__libcpp_islessequal(_A1 __x, _A2 __y)
|
||||
{
|
||||
return islessequal(__x, __y);
|
||||
}
|
||||
|
||||
#undef islessequal
|
||||
|
||||
template <class _A1, class _A2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_floating_point<_A1>::value &&
|
||||
is_floating_point<_A2>::value,
|
||||
bool
|
||||
>::type
|
||||
islessequal(_A1 __x, _A2 __y)
|
||||
{
|
||||
return __libcpp_islessequal(__x, __y);
|
||||
}
|
||||
|
||||
#endif // islessequal
|
||||
|
||||
// islessgreater
|
||||
|
||||
#ifndef islessgreater
|
||||
#error Implementation error: islessgreater not defined
|
||||
#else
|
||||
|
||||
template <class _A1, class _A2>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool
|
||||
__libcpp_islessgreater(_A1 __x, _A2 __y)
|
||||
{
|
||||
return islessgreater(__x, __y);
|
||||
}
|
||||
|
||||
#undef islessgreater
|
||||
|
||||
template <class _A1, class _A2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_floating_point<_A1>::value &&
|
||||
is_floating_point<_A2>::value,
|
||||
bool
|
||||
>::type
|
||||
islessgreater(_A1 __x, _A2 __y)
|
||||
{
|
||||
return __libcpp_islessgreater(__x, __y);
|
||||
}
|
||||
|
||||
#endif // islessgreater
|
||||
|
||||
// isunordered
|
||||
|
||||
#ifndef isunordered
|
||||
#error Implementation error: isunordered not defined
|
||||
#else
|
||||
|
||||
template <class _A1, class _A2>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool
|
||||
__libcpp_isunordered(_A1 __x, _A2 __y)
|
||||
{
|
||||
return isunordered(__x, __y);
|
||||
}
|
||||
|
||||
#undef isunordered
|
||||
|
||||
template <class _A1, class _A2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_floating_point<_A1>::value &&
|
||||
is_floating_point<_A2>::value,
|
||||
bool
|
||||
>::type
|
||||
isunordered(_A1 __x, _A2 __y)
|
||||
{
|
||||
return __libcpp_isunordered(__x, __y);
|
||||
}
|
||||
|
||||
#endif // isunordered
|
||||
|
||||
// acosh
|
||||
|
||||
using ::acosh;
|
||||
|
||||
@@ -1173,7 +1173,7 @@ complex<typename __promote<_Tp, _Up>::type>
|
||||
pow(const complex<_Tp>& __x, const complex<_Up>& __y)
|
||||
{
|
||||
typedef complex<typename __promote<_Tp, _Up>::type> result_type;
|
||||
return _STD::pow(result_type(__x), result_type(__y));
|
||||
return _VSTD::pow(result_type(__x), result_type(__y));
|
||||
}
|
||||
|
||||
template<class _Tp, class _Up>
|
||||
@@ -1186,7 +1186,7 @@ typename enable_if
|
||||
pow(const complex<_Tp>& __x, const _Up& __y)
|
||||
{
|
||||
typedef complex<typename __promote<_Tp, _Up>::type> result_type;
|
||||
return _STD::pow(result_type(__x), result_type(__y));
|
||||
return _VSTD::pow(result_type(__x), result_type(__y));
|
||||
}
|
||||
|
||||
template<class _Tp, class _Up>
|
||||
@@ -1199,7 +1199,7 @@ typename enable_if
|
||||
pow(const _Tp& __x, const complex<_Up>& __y)
|
||||
{
|
||||
typedef complex<typename __promote<_Tp, _Up>::type> result_type;
|
||||
return _STD::pow(result_type(__x), result_type(__y));
|
||||
return _VSTD::pow(result_type(__x), result_type(__y));
|
||||
}
|
||||
|
||||
// asinh
|
||||
|
||||
@@ -243,7 +243,7 @@ condition_variable_any::wait_for(_Lock& __lock,
|
||||
_Predicate __pred)
|
||||
{
|
||||
return wait_until(__lock, chrono::steady_clock::now() + __d,
|
||||
_STD::move(__pred));
|
||||
_VSTD::move(__pred));
|
||||
}
|
||||
|
||||
_LIBCPP_VISIBLE
|
||||
|
||||
@@ -82,14 +82,19 @@ struct _LIBCPP_VISIBLE nullptr_t
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE nullptr_t __get_nullptr_t() {return nullptr_t(0);}
|
||||
|
||||
#define nullptr _STD::__get_nullptr_t()
|
||||
|
||||
#else // _LIBCPP_HAS_NO_NULLPTR
|
||||
|
||||
typedef decltype(nullptr) nullptr_t;
|
||||
#define nullptr _VSTD::__get_nullptr_t()
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_NULLPTR
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_NULLPTR
|
||||
|
||||
namespace std
|
||||
{
|
||||
typedef decltype(nullptr) nullptr_t;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_NULLPTR
|
||||
|
||||
#endif // _LIBCPP_CSTDDEF
|
||||
|
||||
434
include/deque
434
include/deque
File diff suppressed because it is too large
Load Diff
@@ -20,56 +20,56 @@ namespace std
|
||||
class exception
|
||||
{
|
||||
public:
|
||||
exception() throw();
|
||||
exception(const exception&) throw();
|
||||
exception& operator=(const exception&) throw();
|
||||
virtual ~exception() throw();
|
||||
virtual const char* what() const throw();
|
||||
exception() noexcept;
|
||||
exception(const exception&) noexcept;
|
||||
exception& operator=(const exception&) noexcept;
|
||||
virtual ~exception() noexcept;
|
||||
virtual const char* what() const noexcept;
|
||||
};
|
||||
|
||||
class bad_exception
|
||||
: public exception
|
||||
{
|
||||
public:
|
||||
bad_exception() throw();
|
||||
bad_exception(const bad_exception&) throw();
|
||||
bad_exception& operator=(const bad_exception&) throw();
|
||||
virtual ~bad_exception() throw();
|
||||
virtual const char* what() const throw();
|
||||
bad_exception() noexcept;
|
||||
bad_exception(const bad_exception&) noexcept;
|
||||
bad_exception& operator=(const bad_exception&) noexcept;
|
||||
virtual ~bad_exception() noexcept;
|
||||
virtual const char* what() const noexcept;
|
||||
};
|
||||
|
||||
typedef void (*unexpected_handler)();
|
||||
unexpected_handler set_unexpected(unexpected_handler f ) throw();
|
||||
unexpected_handler get_unexpected() throw();
|
||||
void unexpected [[noreturn]] ();
|
||||
unexpected_handler set_unexpected(unexpected_handler f ) noexcept;
|
||||
unexpected_handler get_unexpected() noexcept;
|
||||
[[noreturn]] void unexpected();
|
||||
|
||||
typedef void (*terminate_handler)();
|
||||
terminate_handler set_terminate(terminate_handler f ) throw();
|
||||
terminate_handler get_terminate() throw();
|
||||
void terminate [[noreturn]] ();
|
||||
terminate_handler set_terminate(terminate_handler f ) noexcept;
|
||||
terminate_handler get_terminate() noexcept;
|
||||
[[noreturn]] void terminate() noexcept;
|
||||
|
||||
bool uncaught_exception() throw();
|
||||
bool uncaught_exception() noexcept;
|
||||
|
||||
typedef unspecified exception_ptr;
|
||||
|
||||
exception_ptr current_exception();
|
||||
exception_ptr current_exception() noexcept;
|
||||
void rethrow_exception [[noreturn]] (exception_ptr p);
|
||||
template<class E> exception_ptr make_exception_ptr(E e);
|
||||
template<class E> exception_ptr make_exception_ptr(E e) noexcept;
|
||||
|
||||
class nested_exception
|
||||
{
|
||||
public:
|
||||
nested_exception() throw();
|
||||
nested_exception(const nested_exception&) throw() = default;
|
||||
nested_exception& operator=(const nested_exception&) throw() = default;
|
||||
nested_exception() noexcept;
|
||||
nested_exception(const nested_exception&) noexcept = default;
|
||||
nested_exception& operator=(const nested_exception&) noexcept = default;
|
||||
virtual ~nested_exception() = default;
|
||||
|
||||
// access functions
|
||||
void rethrow_nested [[noreturn]] () const;
|
||||
exception_ptr nested_ptr() const;
|
||||
[[noreturn]] void rethrow_nested() const;
|
||||
exception_ptr nested_ptr() const noexcept;
|
||||
};
|
||||
|
||||
template <class T> void throw_with_nested [[noreturn]] (T&& t);
|
||||
template <class T> [[noreturn]] void throw_with_nested(T&& t);
|
||||
template <class E> void rethrow_if_nested(const E& e);
|
||||
|
||||
} // std
|
||||
@@ -88,65 +88,65 @@ namespace std // purposefully not using versioning namespace
|
||||
class _LIBCPP_EXCEPTION_ABI exception
|
||||
{
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY exception() throw() {}
|
||||
virtual ~exception() throw();
|
||||
virtual const char* what() const throw();
|
||||
_LIBCPP_INLINE_VISIBILITY exception() _NOEXCEPT {}
|
||||
virtual ~exception() _NOEXCEPT;
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI bad_exception
|
||||
: public exception
|
||||
{
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY bad_exception() throw() {}
|
||||
virtual ~bad_exception() throw();
|
||||
virtual const char* what() const throw();
|
||||
_LIBCPP_INLINE_VISIBILITY bad_exception() _NOEXCEPT {}
|
||||
virtual ~bad_exception() _NOEXCEPT;
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
typedef void (*unexpected_handler)();
|
||||
_LIBCPP_VISIBLE unexpected_handler set_unexpected(unexpected_handler) throw();
|
||||
_LIBCPP_VISIBLE unexpected_handler get_unexpected() throw();
|
||||
_LIBCPP_VISIBLE void unexpected();
|
||||
_LIBCPP_VISIBLE unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
|
||||
_LIBCPP_VISIBLE unexpected_handler get_unexpected() _NOEXCEPT;
|
||||
_ATTRIBUTE(noreturn) _LIBCPP_VISIBLE void unexpected();
|
||||
|
||||
typedef void (*terminate_handler)();
|
||||
_LIBCPP_VISIBLE terminate_handler set_terminate(terminate_handler) throw();
|
||||
_LIBCPP_VISIBLE terminate_handler get_terminate() throw();
|
||||
_LIBCPP_VISIBLE void terminate() __attribute__((__noreturn__));
|
||||
_LIBCPP_VISIBLE terminate_handler set_terminate(terminate_handler) _NOEXCEPT;
|
||||
_LIBCPP_VISIBLE terminate_handler get_terminate() _NOEXCEPT;
|
||||
_ATTRIBUTE(noreturn) _LIBCPP_VISIBLE void terminate() _NOEXCEPT;
|
||||
|
||||
_LIBCPP_VISIBLE bool uncaught_exception() throw();
|
||||
_LIBCPP_VISIBLE bool uncaught_exception() _NOEXCEPT;
|
||||
|
||||
class exception_ptr;
|
||||
|
||||
exception_ptr current_exception();
|
||||
void rethrow_exception(exception_ptr); // noreturn
|
||||
exception_ptr current_exception() _NOEXCEPT;
|
||||
_ATTRIBUTE(noreturn) void rethrow_exception(exception_ptr);
|
||||
|
||||
class _LIBCPP_VISIBLE exception_ptr
|
||||
{
|
||||
void* __ptr_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY exception_ptr() : __ptr_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) : __ptr_() {}
|
||||
exception_ptr(const exception_ptr&);
|
||||
exception_ptr& operator=(const exception_ptr&);
|
||||
~exception_ptr();
|
||||
_LIBCPP_INLINE_VISIBILITY exception_ptr() _NOEXCEPT : __ptr_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {}
|
||||
exception_ptr(const exception_ptr&) _NOEXCEPT;
|
||||
exception_ptr& operator=(const exception_ptr&) _NOEXCEPT;
|
||||
~exception_ptr() _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
// explicit
|
||||
operator bool() const {return __ptr_ != nullptr;}
|
||||
operator bool() const _NOEXCEPT {return __ptr_ != nullptr;}
|
||||
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(const exception_ptr& __x, const exception_ptr& __y)
|
||||
bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
|
||||
{return __x.__ptr_ == __y.__ptr_;}
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(const exception_ptr& __x, const exception_ptr& __y)
|
||||
bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
|
||||
{return !(__x == __y);}
|
||||
|
||||
friend exception_ptr current_exception();
|
||||
friend void rethrow_exception(exception_ptr); // noreturn
|
||||
friend exception_ptr current_exception() _NOEXCEPT;
|
||||
_ATTRIBUTE(noreturn) friend void rethrow_exception(exception_ptr);
|
||||
};
|
||||
|
||||
template<class _E>
|
||||
exception_ptr
|
||||
make_exception_ptr(_E __e)
|
||||
make_exception_ptr(_E __e) _NOEXCEPT
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
@@ -166,14 +166,14 @@ class _LIBCPP_EXCEPTION_ABI nested_exception
|
||||
{
|
||||
exception_ptr __ptr_;
|
||||
public:
|
||||
nested_exception();
|
||||
// nested_exception(const nested_exception&) throw() = default;
|
||||
// nested_exception& operator=(const nested_exception&) throw() = default;
|
||||
virtual ~nested_exception();
|
||||
nested_exception() _NOEXCEPT;
|
||||
// nested_exception(const nested_exception&) noexcept = default;
|
||||
// nested_exception& operator=(const nested_exception&) noexcept = default;
|
||||
virtual ~nested_exception() _NOEXCEPT;
|
||||
|
||||
// access functions
|
||||
void rethrow_nested /*[[noreturn]]*/ () const;
|
||||
_LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const {return __ptr_;}
|
||||
_ATTRIBUTE(noreturn) void rethrow_nested() const;
|
||||
_LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const _NOEXCEPT {return __ptr_;}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
@@ -185,9 +185,10 @@ struct __nested
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
_ATTRIBUTE(noreturn)
|
||||
void
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested /*[[noreturn]]*/ (_Tp&& __t, typename enable_if<
|
||||
throw_with_nested(_Tp&& __t, typename enable_if<
|
||||
is_class<typename remove_reference<_Tp>::type>::value &&
|
||||
!is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
|
||||
>::type* = 0)
|
||||
@@ -198,14 +199,15 @@ throw_with_nested (_Tp& __t, typename enable_if<
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw __nested<typename remove_reference<_Tp>::type>(_STD::forward<_Tp>(__t));
|
||||
throw __nested<typename remove_reference<_Tp>::type>(_VSTD::forward<_Tp>(__t));
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
_ATTRIBUTE(noreturn)
|
||||
void
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested /*[[noreturn]]*/ (_Tp&& __t, typename enable_if<
|
||||
throw_with_nested(_Tp&& __t, typename enable_if<
|
||||
!is_class<typename remove_reference<_Tp>::type>::value ||
|
||||
is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
|
||||
>::type* = 0)
|
||||
@@ -216,7 +218,7 @@ throw_with_nested (_Tp& __t, typename enable_if<
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw _STD::forward<_Tp>(__t);
|
||||
throw _VSTD::forward<_Tp>(__t);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -204,7 +204,9 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
|
||||
#include <functional>
|
||||
#include <stdexcept>
|
||||
|
||||
#if __DEPRECATED
|
||||
#warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
|
||||
#endif
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
@@ -341,9 +343,9 @@ public:
|
||||
void operator()(pointer __p)
|
||||
{
|
||||
if (__second_constructed)
|
||||
__alloc_traits::destroy(__na_, addressof(__p->__value_.second));
|
||||
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.second));
|
||||
if (__first_constructed)
|
||||
__alloc_traits::destroy(__na_, addressof(__p->__value_.first));
|
||||
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.first));
|
||||
if (__p)
|
||||
__alloc_traits::deallocate(__na_, __p, 1);
|
||||
}
|
||||
@@ -666,11 +668,11 @@ hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k)
|
||||
{
|
||||
__node_allocator& __na = __table_.__node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_traits::construct(__na, addressof(__h->__value_.first), __k);
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k);
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__node_traits::construct(__na, addressof(__h->__value_.second));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return _STD::move(__h);
|
||||
return _VSTD::move(__h);
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
@@ -963,9 +965,9 @@ operator==(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
{
|
||||
_EqRng __xeq = __x.equal_range(__i->first);
|
||||
_EqRng __yeq = __y.equal_range(__i->first);
|
||||
if (_STD::distance(__xeq.first, __xeq.second) !=
|
||||
_STD::distance(__yeq.first, __yeq.second) ||
|
||||
!_STD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
|
||||
if (_VSTD::distance(__xeq.first, __xeq.second) !=
|
||||
_VSTD::distance(__yeq.first, __yeq.second) ||
|
||||
!_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
|
||||
return false;
|
||||
__i = __xeq.second;
|
||||
}
|
||||
|
||||
@@ -197,7 +197,9 @@ template <class Value, class Hash, class Pred, class Alloc>
|
||||
#include <__hash_table>
|
||||
#include <functional>
|
||||
|
||||
#if __DEPRECATED
|
||||
#warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>
|
||||
#endif
|
||||
|
||||
namespace __gnu_cxx {
|
||||
|
||||
@@ -627,9 +629,9 @@ operator==(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
{
|
||||
_EqRng __xeq = __x.equal_range(*__i);
|
||||
_EqRng __yeq = __y.equal_range(*__i);
|
||||
if (_STD::distance(__xeq.first, __xeq.second) !=
|
||||
_STD::distance(__yeq.first, __yeq.second) ||
|
||||
!_STD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
|
||||
if (_VSTD::distance(__xeq.first, __xeq.second) !=
|
||||
_VSTD::distance(__yeq.first, __yeq.second) ||
|
||||
!_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
|
||||
return false;
|
||||
__i = __xeq.second;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,8 @@ public:
|
||||
typedef <details> iterator;
|
||||
typedef <details> const_iterator;
|
||||
|
||||
forward_list();
|
||||
forward_list()
|
||||
noexcept(is_nothrow_default_constructible<allocator_type>::value);
|
||||
explicit forward_list(const allocator_type& a);
|
||||
explicit forward_list(size_type n);
|
||||
forward_list(size_type n, const value_type& v);
|
||||
@@ -45,7 +46,8 @@ public:
|
||||
forward_list(InputIterator first, InputIterator last, const allocator_type& a);
|
||||
forward_list(const forward_list& x);
|
||||
forward_list(const forward_list& x, const allocator_type& a);
|
||||
forward_list(forward_list&& x);
|
||||
forward_list(forward_list&& x)
|
||||
noexcept(is_nothrow_move_constructible<allocator_type>::value);
|
||||
forward_list(forward_list&& x, const allocator_type& a);
|
||||
forward_list(initializer_list<value_type> il);
|
||||
forward_list(initializer_list<value_type> il, const allocator_type& a);
|
||||
@@ -53,7 +55,10 @@ public:
|
||||
~forward_list();
|
||||
|
||||
forward_list& operator=(const forward_list& x);
|
||||
forward_list& operator=(forward_list&& x);
|
||||
forward_list& operator=(forward_list&& x)
|
||||
noexcept(
|
||||
allocator_type::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value);
|
||||
forward_list& operator=(initializer_list<value_type> il);
|
||||
|
||||
template <class InputIterator>
|
||||
@@ -61,22 +66,22 @@ public:
|
||||
void assign(size_type n, const value_type& v);
|
||||
void assign(initializer_list<value_type> il);
|
||||
|
||||
allocator_type get_allocator() const;
|
||||
allocator_type get_allocator() const noexcept;
|
||||
|
||||
iterator begin();
|
||||
const_iterator begin() const;
|
||||
iterator end();
|
||||
const_iterator end() const;
|
||||
iterator begin() noexcept;
|
||||
const_iterator begin() const noexcept;
|
||||
iterator end() noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
|
||||
const_iterator cbegin() const;
|
||||
const_iterator cend() const;
|
||||
const_iterator cbegin() const noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
|
||||
iterator before_begin();
|
||||
const_iterator before_begin() const;
|
||||
const_iterator cbefore_begin() const;
|
||||
iterator before_begin() noexcept;
|
||||
const_iterator before_begin() const noexcept;
|
||||
const_iterator cbefore_begin() const noexcept;
|
||||
|
||||
bool empty() const;
|
||||
size_type max_size() const;
|
||||
bool empty() const noexcept;
|
||||
size_type max_size() const noexcept;
|
||||
|
||||
reference front();
|
||||
const_reference front() const;
|
||||
@@ -100,25 +105,33 @@ public:
|
||||
iterator erase_after(const_iterator p);
|
||||
iterator erase_after(const_iterator first, const_iterator last);
|
||||
|
||||
void swap(forward_list& x);
|
||||
void swap(forward_list& x)
|
||||
noexcept(!allocator_type::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value);
|
||||
|
||||
void resize(size_type n);
|
||||
void resize(size_type n, const value_type& v);
|
||||
void clear();
|
||||
void clear() noexcept;
|
||||
|
||||
void splice_after(const_iterator p, forward_list& x);
|
||||
void splice_after(const_iterator p, forward_list&& x);
|
||||
void splice_after(const_iterator p, forward_list& x, const_iterator i);
|
||||
void splice_after(const_iterator p, forward_list&& x, const_iterator i);
|
||||
void splice_after(const_iterator p, forward_list& x,
|
||||
const_iterator first, const_iterator last);
|
||||
void splice_after(const_iterator p, forward_list&& x,
|
||||
const_iterator first, const_iterator last);
|
||||
void remove(const value_type& v);
|
||||
template <class Predicate> void remove_if(Predicate pred);
|
||||
void unique();
|
||||
template <class BinaryPredicate> void unique(BinaryPredicate binary_pred);
|
||||
void merge(forward_list& x);
|
||||
void merge(forward_list&& x);
|
||||
template <class Compare> void merge(forward_list& x, Compare comp);
|
||||
template <class Compare> void merge(forward_list&& x, Compare comp);
|
||||
void sort();
|
||||
template <class Compare> void sort(Compare comp);
|
||||
void reverse();
|
||||
void reverse() noexcept;
|
||||
};
|
||||
|
||||
template <class T, class Allocator>
|
||||
@@ -146,7 +159,8 @@ template <class T, class Allocator>
|
||||
const forward_list<T, Allocator>& y);
|
||||
|
||||
template <class T, class Allocator>
|
||||
void swap(forward_list<T, Allocator>& x, forward_list<T, Allocator>& y);
|
||||
void swap(forward_list<T, Allocator>& x, forward_list<T, Allocator>& y)
|
||||
noexcept(noexcept(x.swap(y)));
|
||||
|
||||
} // std
|
||||
|
||||
@@ -164,7 +178,7 @@ template <class T, class Allocator>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class, class> struct __forward_list_node;
|
||||
template <class _Tp, class _VoidPtr> struct __forward_list_node;
|
||||
|
||||
template <class _NodePtr>
|
||||
struct __forward_begin_node
|
||||
@@ -194,8 +208,8 @@ struct __forward_list_node
|
||||
value_type __value_;
|
||||
};
|
||||
|
||||
template<class, class> class forward_list;
|
||||
template<class> class __forward_list_const_iterator;
|
||||
template<class _Tp, class _Alloc> class forward_list;
|
||||
template<class _NodeConstPtr> class __forward_list_const_iterator;
|
||||
|
||||
template <class _NodePtr>
|
||||
class _LIBCPP_VISIBLE __forward_list_iterator
|
||||
@@ -205,7 +219,7 @@ class _LIBCPP_VISIBLE __forward_list_iterator
|
||||
__node_pointer __ptr_;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __forward_list_iterator(__node_pointer __p) : __ptr_(__p) {}
|
||||
explicit __forward_list_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
|
||||
|
||||
template<class, class> friend class forward_list;
|
||||
template<class> friend class __forward_list_const_iterator;
|
||||
@@ -226,7 +240,7 @@ public:
|
||||
pointer;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__forward_list_iterator() : __ptr_(nullptr) {}
|
||||
__forward_list_iterator() _NOEXCEPT : __ptr_(nullptr) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {return __ptr_->__value_;}
|
||||
@@ -265,7 +279,7 @@ class _LIBCPP_VISIBLE __forward_list_const_iterator
|
||||
__node_const_pointer __ptr_;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __forward_list_const_iterator(__node_const_pointer __p)
|
||||
explicit __forward_list_const_iterator(__node_const_pointer __p) _NOEXCEPT
|
||||
: __ptr_(__p) {}
|
||||
|
||||
typedef typename remove_const
|
||||
@@ -297,9 +311,9 @@ public:
|
||||
pointer;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__forward_list_const_iterator() : __ptr_(nullptr) {}
|
||||
__forward_list_const_iterator() _NOEXCEPT : __ptr_(nullptr) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__forward_list_const_iterator(__forward_list_iterator<__node_pointer> __p)
|
||||
__forward_list_const_iterator(__forward_list_iterator<__node_pointer> __p) _NOEXCEPT
|
||||
: __ptr_(__p.__ptr_) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -355,41 +369,47 @@ protected:
|
||||
__compressed_pair<__begin_node, __node_allocator> __before_begin_;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__node_pointer __before_begin()
|
||||
__node_pointer __before_begin() _NOEXCEPT
|
||||
{return pointer_traits<__node_pointer>::pointer_to(
|
||||
static_cast<__node&>(__before_begin_.first()));}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__node_const_pointer __before_begin() const
|
||||
__node_const_pointer __before_begin() const _NOEXCEPT
|
||||
{return pointer_traits<__node_const_pointer>::pointer_to(
|
||||
static_cast<const __node&>(__before_begin_.first()));}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__node_allocator& __alloc() {return __before_begin_.second();}
|
||||
__node_allocator& __alloc() _NOEXCEPT
|
||||
{return __before_begin_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const __node_allocator& __alloc() const {return __before_begin_.second();}
|
||||
const __node_allocator& __alloc() const _NOEXCEPT
|
||||
{return __before_begin_.second();}
|
||||
|
||||
typedef __forward_list_iterator<__node_pointer> iterator;
|
||||
typedef __forward_list_const_iterator<__node_const_pointer> const_iterator;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__forward_list_base()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
|
||||
: __before_begin_(__begin_node()) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__forward_list_base(const allocator_type& __a)
|
||||
: __before_begin_(__begin_node(), __node_allocator(__a)) {}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__forward_list_base(__forward_list_base&& __x);
|
||||
public:
|
||||
__forward_list_base(__forward_list_base&& __x)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
|
||||
__forward_list_base(__forward_list_base&& __x, const allocator_type& __a);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
private:
|
||||
__forward_list_base(const __forward_list_base&);
|
||||
__forward_list_base& operator=(const __forward_list_base&);
|
||||
protected:
|
||||
|
||||
public:
|
||||
~__forward_list_base();
|
||||
|
||||
protected:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __copy_assign_alloc(const __forward_list_base& __x)
|
||||
{__copy_assign_alloc(__x, integral_constant<bool,
|
||||
@@ -397,11 +417,17 @@ protected:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__forward_list_base& __x)
|
||||
_NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
|
||||
is_nothrow_move_assignable<__node_allocator>::value)
|
||||
{__move_assign_alloc(__x, integral_constant<bool,
|
||||
__node_traits::propagate_on_container_move_assignment::value>());}
|
||||
|
||||
void swap(__forward_list_base& __x);
|
||||
void clear();
|
||||
public:
|
||||
void swap(__forward_list_base& __x)
|
||||
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value);
|
||||
protected:
|
||||
void clear() _NOEXCEPT;
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -415,24 +441,30 @@ private:
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__forward_list_base& __x, false_type) {}
|
||||
void __move_assign_alloc(__forward_list_base& __x, false_type) _NOEXCEPT
|
||||
{}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__forward_list_base& __x, true_type)
|
||||
{__alloc() = _STD::move(__x.__alloc());}
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
|
||||
{__alloc() = _VSTD::move(__x.__alloc());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y)
|
||||
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value)
|
||||
{__swap_alloc(__x, __y, integral_constant<bool,
|
||||
__node_traits::propagate_on_container_swap::value>());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y,
|
||||
false_type)
|
||||
_NOEXCEPT
|
||||
{}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y,
|
||||
true_type)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<__node_allocator>::value)
|
||||
{
|
||||
using _STD::swap;
|
||||
using _VSTD::swap;
|
||||
swap(__x, __y);
|
||||
}
|
||||
};
|
||||
@@ -442,7 +474,8 @@ private:
|
||||
template <class _Tp, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x)
|
||||
: __before_begin_(_STD::move(__x.__before_begin_))
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value)
|
||||
: __before_begin_(_VSTD::move(__x.__before_begin_))
|
||||
{
|
||||
__x.__before_begin()->__next_ = nullptr;
|
||||
}
|
||||
@@ -472,21 +505,23 @@ template <class _Tp, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
|
||||
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value)
|
||||
{
|
||||
__swap_alloc(__alloc(), __x.__alloc());
|
||||
using _STD::swap;
|
||||
using _VSTD::swap;
|
||||
swap(__before_begin()->__next_, __x.__before_begin()->__next_);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
void
|
||||
__forward_list_base<_Tp, _Alloc>::clear()
|
||||
__forward_list_base<_Tp, _Alloc>::clear() _NOEXCEPT
|
||||
{
|
||||
__node_allocator& __a = __alloc();
|
||||
for (__node_pointer __p = __before_begin()->__next_; __p != nullptr;)
|
||||
{
|
||||
__node_pointer __next = __p->__next_;
|
||||
__node_traits::destroy(__a, addressof(__p->__value_));
|
||||
__node_traits::destroy(__a, _VSTD::addressof(__p->__value_));
|
||||
__node_traits::deallocate(__a, __p, 1);
|
||||
__p = __next;
|
||||
}
|
||||
@@ -498,6 +533,11 @@ class _LIBCPP_VISIBLE forward_list
|
||||
: private __forward_list_base<_Tp, _Alloc>
|
||||
{
|
||||
typedef __forward_list_base<_Tp, _Alloc> base;
|
||||
typedef typename base::__node_allocator __node_allocator;
|
||||
typedef typename base::__node __node;
|
||||
typedef typename base::__node_traits __node_traits;
|
||||
typedef typename base::__node_pointer __node_pointer;
|
||||
|
||||
public:
|
||||
typedef _Tp value_type;
|
||||
typedef _Alloc allocator_type;
|
||||
@@ -512,7 +552,10 @@ public:
|
||||
typedef typename base::iterator iterator;
|
||||
typedef typename base::const_iterator const_iterator;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY forward_list() {} // = default;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
forward_list()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
|
||||
{} // = default;
|
||||
explicit forward_list(const allocator_type& __a);
|
||||
explicit forward_list(size_type __n);
|
||||
forward_list(size_type __n, const value_type& __v);
|
||||
@@ -532,7 +575,9 @@ public:
|
||||
forward_list(const forward_list& __x, const allocator_type& __a);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
forward_list(forward_list&& __x) : base(_STD::move(__x)) {}
|
||||
forward_list(forward_list&& __x)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<base>::value)
|
||||
: base(_VSTD::move(__x)) {}
|
||||
forward_list(forward_list&& __x, const allocator_type& __a);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
forward_list(initializer_list<value_type> __il);
|
||||
@@ -542,7 +587,10 @@ public:
|
||||
|
||||
forward_list& operator=(const forward_list& __x);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
forward_list& operator=(forward_list&& __x);
|
||||
forward_list& operator=(forward_list&& __x)
|
||||
_NOEXCEPT_(
|
||||
__node_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value);
|
||||
#endif
|
||||
forward_list& operator=(initializer_list<value_type> __il);
|
||||
|
||||
@@ -557,33 +605,45 @@ public:
|
||||
void assign(initializer_list<value_type> __il);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const {return allocator_type(base::__alloc());}
|
||||
allocator_type get_allocator() const _NOEXCEPT
|
||||
{return allocator_type(base::__alloc());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return iterator(base::__before_begin()->__next_);}
|
||||
iterator begin() _NOEXCEPT
|
||||
{return iterator(base::__before_begin()->__next_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return const_iterator(base::__before_begin()->__next_);}
|
||||
const_iterator begin() const _NOEXCEPT
|
||||
{return const_iterator(base::__before_begin()->__next_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return iterator(nullptr);}
|
||||
iterator end() _NOEXCEPT
|
||||
{return iterator(nullptr);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return const_iterator(nullptr);}
|
||||
const_iterator end() const _NOEXCEPT
|
||||
{return const_iterator(nullptr);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cbegin() const {return const_iterator(base::__before_begin()->__next_);}
|
||||
const_iterator cbegin() const _NOEXCEPT
|
||||
{return const_iterator(base::__before_begin()->__next_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cend() const {return const_iterator(nullptr);}
|
||||
const_iterator cend() const _NOEXCEPT
|
||||
{return const_iterator(nullptr);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator before_begin() {return iterator(base::__before_begin());}
|
||||
iterator before_begin() _NOEXCEPT
|
||||
{return iterator(base::__before_begin());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator before_begin() const {return const_iterator(base::__before_begin());}
|
||||
const_iterator before_begin() const _NOEXCEPT
|
||||
{return const_iterator(base::__before_begin());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cbefore_begin() const {return const_iterator(base::__before_begin());}
|
||||
const_iterator cbefore_begin() const _NOEXCEPT
|
||||
{return const_iterator(base::__before_begin());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return base::__before_begin()->__next_ == nullptr;}
|
||||
bool empty() const _NOEXCEPT
|
||||
{return base::__before_begin()->__next_ == nullptr;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const {return numeric_limits<size_type>::max();}
|
||||
size_type max_size() const _NOEXCEPT
|
||||
{return numeric_limits<size_type>::max();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference front() {return base::__before_begin()->__next_->__value_;}
|
||||
@@ -624,24 +684,29 @@ public:
|
||||
iterator erase_after(const_iterator __f, const_iterator __l);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(forward_list& __x) {base::swap(__x);}
|
||||
void swap(forward_list& __x)
|
||||
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value)
|
||||
{base::swap(__x);}
|
||||
|
||||
void resize(size_type __n);
|
||||
void resize(size_type __n, const value_type& __v);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() {base::clear();}
|
||||
void clear() _NOEXCEPT {base::clear();}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void splice_after(const_iterator __p, forward_list&& __x);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void splice_after(const_iterator __p, forward_list&& __x, const_iterator __i);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void splice_after(const_iterator __p, forward_list&& __x,
|
||||
const_iterator __f, const_iterator __l);
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void splice_after(const_iterator __p, forward_list& __x);
|
||||
void splice_after(const_iterator __p, forward_list& __x, const_iterator __i);
|
||||
void splice_after(const_iterator __p, forward_list& __x,
|
||||
const_iterator __f, const_iterator __l);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void remove(const value_type& __v);
|
||||
template <class _Predicate> void remove_if(_Predicate __pred);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -649,26 +714,25 @@ public:
|
||||
template <class _BinaryPredicate> void unique(_BinaryPredicate __binary_pred);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void merge(forward_list&& __x) {merge(_STD::move(__x), __less<value_type>());}
|
||||
template <class _Compare> void merge(forward_list&& __x, _Compare __comp);
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void merge(forward_list&& __x) {merge(__x, __less<value_type>());}
|
||||
template <class _Compare>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void merge(forward_list&& __x, _Compare __comp)
|
||||
{merge(__x, _VSTD::move(__comp));}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void merge(forward_list& __x) {merge(__x, __less<value_type>());}
|
||||
template <class _Compare> void merge(forward_list& __x, _Compare __comp);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void sort() {sort(__less<value_type>());}
|
||||
template <class _Compare> void sort(_Compare __comp);
|
||||
void reverse();
|
||||
void reverse() _NOEXCEPT;
|
||||
|
||||
private:
|
||||
typedef typename base::__node_allocator __node_allocator;
|
||||
typedef typename base::__node __node;
|
||||
typedef typename base::__node_traits __node_traits;
|
||||
typedef typename base::__node_pointer __node_pointer;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void __move_assign(forward_list& __x, true_type);
|
||||
void __move_assign(forward_list& __x, true_type)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
|
||||
void __move_assign(forward_list& __x, false_type);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
@@ -702,7 +766,7 @@ forward_list<_Tp, _Alloc>::forward_list(size_type __n)
|
||||
__p = __p->__next_)
|
||||
{
|
||||
__h.reset(__node_traits::allocate(__a, 1));
|
||||
__node_traits::construct(__a, addressof(__h->__value_));
|
||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_));
|
||||
__h->__next_ = nullptr;
|
||||
__p->__next_ = __h.release();
|
||||
}
|
||||
@@ -768,7 +832,7 @@ forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x,
|
||||
template <class _Tp, class _Alloc>
|
||||
forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x,
|
||||
const allocator_type& __a)
|
||||
: base(_STD::move(__x), __a)
|
||||
: base(_VSTD::move(__x), __a)
|
||||
{
|
||||
if (base::__alloc() != __x.__alloc())
|
||||
{
|
||||
@@ -810,6 +874,7 @@ forward_list<_Tp, _Alloc>::operator=(const forward_list& __x)
|
||||
template <class _Tp, class _Alloc>
|
||||
void
|
||||
forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, true_type)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
|
||||
{
|
||||
clear();
|
||||
base::__move_assign_alloc(__x);
|
||||
@@ -834,6 +899,9 @@ template <class _Tp, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
forward_list<_Tp, _Alloc>&
|
||||
forward_list<_Tp, _Alloc>::operator=(forward_list&& __x)
|
||||
_NOEXCEPT_(
|
||||
__node_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value)
|
||||
{
|
||||
__move_assign(__x, integral_constant<bool,
|
||||
__node_traits::propagate_on_container_move_assignment::value>());
|
||||
@@ -861,7 +929,7 @@ typename enable_if
|
||||
forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l)
|
||||
{
|
||||
iterator __i = before_begin();
|
||||
iterator __j = next(__i);
|
||||
iterator __j = _VSTD::next(__i);
|
||||
iterator __e = end();
|
||||
for (; __j != __e && __f != __l; ++__i, ++__j, ++__f)
|
||||
*__j = *__f;
|
||||
@@ -876,7 +944,7 @@ void
|
||||
forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v)
|
||||
{
|
||||
iterator __i = before_begin();
|
||||
iterator __j = next(__i);
|
||||
iterator __j = _VSTD::next(__i);
|
||||
iterator __e = end();
|
||||
for (; __j != __e && __n > 0; --__n, ++__i, ++__j)
|
||||
*__j = __v;
|
||||
@@ -905,8 +973,8 @@ forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
|
||||
__node_allocator& __a = base::__alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
||||
__node_traits::construct(__a, addressof(__h->__value_),
|
||||
_STD::forward<_Args>(__args)...);
|
||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
__h->__next_ = base::__before_begin()->__next_;
|
||||
base::__before_begin()->__next_ = __h.release();
|
||||
}
|
||||
@@ -920,7 +988,7 @@ forward_list<_Tp, _Alloc>::push_front(value_type&& __v)
|
||||
__node_allocator& __a = base::__alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
||||
__node_traits::construct(__a, addressof(__h->__value_), _STD::move(__v));
|
||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
|
||||
__h->__next_ = base::__before_begin()->__next_;
|
||||
base::__before_begin()->__next_ = __h.release();
|
||||
}
|
||||
@@ -934,7 +1002,7 @@ forward_list<_Tp, _Alloc>::push_front(const value_type& __v)
|
||||
__node_allocator& __a = base::__alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
||||
__node_traits::construct(__a, addressof(__h->__value_), __v);
|
||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
|
||||
__h->__next_ = base::__before_begin()->__next_;
|
||||
base::__before_begin()->__next_ = __h.release();
|
||||
}
|
||||
@@ -946,7 +1014,7 @@ forward_list<_Tp, _Alloc>::pop_front()
|
||||
__node_allocator& __a = base::__alloc();
|
||||
__node_pointer __p = base::__before_begin()->__next_;
|
||||
base::__before_begin()->__next_ = __p->__next_;
|
||||
__node_traits::destroy(__a, addressof(__p->__value_));
|
||||
__node_traits::destroy(__a, _VSTD::addressof(__p->__value_));
|
||||
__node_traits::deallocate(__a, __p, 1);
|
||||
}
|
||||
|
||||
@@ -962,8 +1030,8 @@ forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args)
|
||||
__node_allocator& __a = base::__alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
||||
__node_traits::construct(__a, addressof(__h->__value_),
|
||||
_STD::forward<_Args>(__args)...);
|
||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
__h->__next_ = __r->__next_;
|
||||
__r->__next_ = __h.release();
|
||||
return iterator(__r->__next_);
|
||||
@@ -979,7 +1047,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
|
||||
__node_allocator& __a = base::__alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
||||
__node_traits::construct(__a, addressof(__h->__value_), _STD::move(__v));
|
||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
|
||||
__h->__next_ = __r->__next_;
|
||||
__r->__next_ = __h.release();
|
||||
return iterator(__r->__next_);
|
||||
@@ -995,7 +1063,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __
|
||||
__node_allocator& __a = base::__alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
||||
__node_traits::construct(__a, addressof(__h->__value_), __v);
|
||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
|
||||
__h->__next_ = __r->__next_;
|
||||
__r->__next_ = __h.release();
|
||||
return iterator(__r->__next_);
|
||||
@@ -1012,7 +1080,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
|
||||
__node_allocator& __a = base::__alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
||||
__node_traits::construct(__a, addressof(__h->__value_), __v);
|
||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
|
||||
__node_pointer __first = __h.release();
|
||||
__node_pointer __last = __first;
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -1022,7 +1090,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
|
||||
for (--__n; __n != 0; --__n, __last = __last->__next_)
|
||||
{
|
||||
__h.reset(__node_traits::allocate(__a, 1));
|
||||
__node_traits::construct(__a, addressof(__h->__value_), __v);
|
||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
|
||||
__last->__next_ = __h.release();
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -1032,7 +1100,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
|
||||
while (__first != nullptr)
|
||||
{
|
||||
__node_pointer __next = __first->__next_;
|
||||
__node_traits::destroy(__a, addressof(__first->__value_));
|
||||
__node_traits::destroy(__a, _VSTD::addressof(__first->__value_));
|
||||
__node_traits::deallocate(__a, __first, 1);
|
||||
__first = __next;
|
||||
}
|
||||
@@ -1062,7 +1130,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
|
||||
__node_allocator& __a = base::__alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
||||
__node_traits::construct(__a, addressof(__h->__value_), *__f);
|
||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f);
|
||||
__node_pointer __first = __h.release();
|
||||
__node_pointer __last = __first;
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -1072,7 +1140,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
|
||||
for (++__f; __f != __l; ++__f, __last = __last->__next_)
|
||||
{
|
||||
__h.reset(__node_traits::allocate(__a, 1));
|
||||
__node_traits::construct(__a, addressof(__h->__value_), *__f);
|
||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f);
|
||||
__last->__next_ = __h.release();
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -1082,7 +1150,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
|
||||
while (__first != nullptr)
|
||||
{
|
||||
__node_pointer __next = __first->__next_;
|
||||
__node_traits::destroy(__a, addressof(__first->__value_));
|
||||
__node_traits::destroy(__a, _VSTD::addressof(__first->__value_));
|
||||
__node_traits::deallocate(__a, __first, 1);
|
||||
__first = __next;
|
||||
}
|
||||
@@ -1104,7 +1172,7 @@ forward_list<_Tp, _Alloc>::erase_after(const_iterator __f)
|
||||
__node_pointer __n = __p->__next_;
|
||||
__p->__next_ = __n->__next_;
|
||||
__node_allocator& __a = base::__alloc();
|
||||
__node_traits::destroy(__a, addressof(__n->__value_));
|
||||
__node_traits::destroy(__a, _VSTD::addressof(__n->__value_));
|
||||
__node_traits::deallocate(__a, __n, 1);
|
||||
return iterator(__p->__next_);
|
||||
}
|
||||
@@ -1125,7 +1193,7 @@ forward_list<_Tp, _Alloc>::erase_after(const_iterator __f, const_iterator __l)
|
||||
do
|
||||
{
|
||||
__p = __n->__next_;
|
||||
__node_traits::destroy(__a, addressof(__n->__value_));
|
||||
__node_traits::destroy(__a, _VSTD::addressof(__n->__value_));
|
||||
__node_traits::deallocate(__a, __n, 1);
|
||||
__n = __p;
|
||||
} while (__n != __e);
|
||||
@@ -1158,7 +1226,7 @@ forward_list<_Tp, _Alloc>::resize(size_type __n)
|
||||
__ptr = __ptr->__next_)
|
||||
{
|
||||
__h.reset(__node_traits::allocate(__a, 1));
|
||||
__node_traits::construct(__a, addressof(__h->__value_));
|
||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_));
|
||||
__h->__next_ = nullptr;
|
||||
__ptr->__next_ = __h.release();
|
||||
}
|
||||
@@ -1190,7 +1258,7 @@ forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v)
|
||||
__ptr = __ptr->__next_)
|
||||
{
|
||||
__h.reset(__node_traits::allocate(__a, 1));
|
||||
__node_traits::construct(__a, addressof(__h->__value_), __v);
|
||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
|
||||
__h->__next_ = nullptr;
|
||||
__ptr->__next_ = __h.release();
|
||||
}
|
||||
@@ -1201,11 +1269,7 @@ forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v)
|
||||
template <class _Tp, class _Alloc>
|
||||
void
|
||||
forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
forward_list&& __x)
|
||||
#else
|
||||
forward_list& __x)
|
||||
#endif
|
||||
{
|
||||
if (!__x.empty())
|
||||
{
|
||||
@@ -1226,14 +1290,10 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
|
||||
template <class _Tp, class _Alloc>
|
||||
void
|
||||
forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
forward_list&& __x,
|
||||
#else
|
||||
forward_list& __x,
|
||||
#endif
|
||||
const_iterator __i)
|
||||
{
|
||||
const_iterator __lm1 = next(__i);
|
||||
const_iterator __lm1 = _VSTD::next(__i);
|
||||
if (__p != __i && __p != __lm1)
|
||||
{
|
||||
const_cast<__node_pointer>(__i.__ptr_)->__next_ =
|
||||
@@ -1248,11 +1308,7 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
|
||||
template <class _Tp, class _Alloc>
|
||||
void
|
||||
forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
forward_list&& __x,
|
||||
#else
|
||||
forward_list& __x,
|
||||
#endif
|
||||
const_iterator __f, const_iterator __l)
|
||||
{
|
||||
if (__f != __l && __p != __f)
|
||||
@@ -1272,6 +1328,39 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
|
||||
forward_list&& __x)
|
||||
{
|
||||
splice_after(__p, __x);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
|
||||
forward_list&& __x,
|
||||
const_iterator __i)
|
||||
{
|
||||
splice_after(__p, __x, __i);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
|
||||
forward_list&& __x,
|
||||
const_iterator __f, const_iterator __l)
|
||||
{
|
||||
splice_after(__p, __x, __f, __l);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
void
|
||||
forward_list<_Tp, _Alloc>::remove(const value_type& __v)
|
||||
@@ -1281,7 +1370,7 @@ forward_list<_Tp, _Alloc>::remove(const value_type& __v)
|
||||
{
|
||||
if (__i.__ptr_->__next_->__value_ == __v)
|
||||
{
|
||||
iterator __j = next(__i, 2);
|
||||
iterator __j = _VSTD::next(__i, 2);
|
||||
for (; __j != __e && *__j == __v; ++__j)
|
||||
;
|
||||
erase_after(__i, __j);
|
||||
@@ -1304,7 +1393,7 @@ forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred)
|
||||
{
|
||||
if (__pred(__i.__ptr_->__next_->__value_))
|
||||
{
|
||||
iterator __j = next(__i, 2);
|
||||
iterator __j = _VSTD::next(__i, 2);
|
||||
for (; __j != __e && __pred(*__j); ++__j)
|
||||
;
|
||||
erase_after(__i, __j);
|
||||
@@ -1324,7 +1413,7 @@ forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)
|
||||
{
|
||||
for (iterator __i = begin(), __e = end(); __i != __e;)
|
||||
{
|
||||
iterator __j = next(__i);
|
||||
iterator __j = _VSTD::next(__i);
|
||||
for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
|
||||
;
|
||||
if (__i.__ptr_->__next_ != __j.__ptr_)
|
||||
@@ -1336,11 +1425,7 @@ forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)
|
||||
template <class _Tp, class _Alloc>
|
||||
template <class _Compare>
|
||||
void
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
forward_list<_Tp, _Alloc>::merge(forward_list&& __x, _Compare __comp)
|
||||
#else
|
||||
forward_list<_Tp, _Alloc>::merge(forward_list& __x, _Compare __comp)
|
||||
#endif
|
||||
{
|
||||
if (this != &__x)
|
||||
{
|
||||
@@ -1403,7 +1488,7 @@ void
|
||||
forward_list<_Tp, _Alloc>::sort(_Compare __comp)
|
||||
{
|
||||
base::__before_begin()->__next_ = __sort(base::__before_begin()->__next_,
|
||||
_STD::distance(begin(), end()), __comp);
|
||||
_VSTD::distance(begin(), end()), __comp);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
@@ -1429,7 +1514,7 @@ forward_list<_Tp, _Alloc>::__sort(__node_pointer __f1, difference_type __sz,
|
||||
}
|
||||
difference_type __sz1 = __sz / 2;
|
||||
difference_type __sz2 = __sz - __sz1;
|
||||
__node_pointer __t = next(iterator(__f1), __sz1 - 1).__ptr_;
|
||||
__node_pointer __t = _VSTD::next(iterator(__f1), __sz1 - 1).__ptr_;
|
||||
__node_pointer __f2 = __t->__next_;
|
||||
__t->__next_ = nullptr;
|
||||
return __merge(__sort(__f1, __sz1, __comp),
|
||||
@@ -1438,7 +1523,7 @@ forward_list<_Tp, _Alloc>::__sort(__node_pointer __f1, difference_type __sz,
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
void
|
||||
forward_list<_Tp, _Alloc>::reverse()
|
||||
forward_list<_Tp, _Alloc>::reverse() _NOEXCEPT
|
||||
{
|
||||
__node_pointer __p = base::__before_begin()->__next_;
|
||||
if (__p != nullptr)
|
||||
@@ -1485,7 +1570,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator< (const forward_list<_Tp, _Alloc>& __x,
|
||||
const forward_list<_Tp, _Alloc>& __y)
|
||||
{
|
||||
return _STD::lexicographical_compare(__x.begin(), __x.end(),
|
||||
return _VSTD::lexicographical_compare(__x.begin(), __x.end(),
|
||||
__y.begin(), __y.end());
|
||||
}
|
||||
|
||||
@@ -1517,6 +1602,7 @@ template <class _Tp, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(forward_list<_Tp, _Alloc>& __x, forward_list<_Tp, _Alloc>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
@@ -362,9 +362,9 @@ basic_filebuf<_CharT, _Traits>::swap(basic_filebuf& __rhs)
|
||||
basic_streambuf<char_type, traits_type>::swap(__rhs);
|
||||
if (__extbuf_ != __extbuf_min_ && __rhs.__extbuf_ != __rhs.__extbuf_min_)
|
||||
{
|
||||
_STD::swap(__extbuf_, __rhs.__extbuf_);
|
||||
_STD::swap(__extbufnext_, __rhs.__extbufnext_);
|
||||
_STD::swap(__extbufend_, __rhs.__extbufend_);
|
||||
_VSTD::swap(__extbuf_, __rhs.__extbuf_);
|
||||
_VSTD::swap(__extbufnext_, __rhs.__extbufnext_);
|
||||
_VSTD::swap(__extbufend_, __rhs.__extbufend_);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -387,17 +387,17 @@ basic_filebuf<_CharT, _Traits>::swap(basic_filebuf& __rhs)
|
||||
__rhs.__extbufnext_ = __rhs.__extbuf_ + __ln;
|
||||
__rhs.__extbufend_ = __rhs.__extbuf_ + __le;
|
||||
}
|
||||
_STD::swap(__ebs_, __rhs.__ebs_);
|
||||
_STD::swap(__intbuf_, __rhs.__intbuf_);
|
||||
_STD::swap(__ibs_, __rhs.__ibs_);
|
||||
_STD::swap(__file_, __rhs.__file_);
|
||||
_STD::swap(__cv_, __rhs.__cv_);
|
||||
_STD::swap(__st_, __rhs.__st_);
|
||||
_STD::swap(__om_, __rhs.__om_);
|
||||
_STD::swap(__cm_, __rhs.__cm_);
|
||||
_STD::swap(__owns_eb_, __rhs.__owns_eb_);
|
||||
_STD::swap(__owns_ib_, __rhs.__owns_ib_);
|
||||
_STD::swap(__always_noconv_, __rhs.__always_noconv_);
|
||||
_VSTD::swap(__ebs_, __rhs.__ebs_);
|
||||
_VSTD::swap(__intbuf_, __rhs.__intbuf_);
|
||||
_VSTD::swap(__ibs_, __rhs.__ibs_);
|
||||
_VSTD::swap(__file_, __rhs.__file_);
|
||||
_VSTD::swap(__cv_, __rhs.__cv_);
|
||||
_VSTD::swap(__st_, __rhs.__st_);
|
||||
_VSTD::swap(__om_, __rhs.__om_);
|
||||
_VSTD::swap(__cm_, __rhs.__cm_);
|
||||
_VSTD::swap(__owns_eb_, __rhs.__owns_eb_);
|
||||
_VSTD::swap(__owns_ib_, __rhs.__owns_ib_);
|
||||
_VSTD::swap(__always_noconv_, __rhs.__always_noconv_);
|
||||
if (this->eback() == (char_type*)__rhs.__extbuf_min_)
|
||||
{
|
||||
ptrdiff_t __n = this->gptr() - this->eback();
|
||||
@@ -579,7 +579,7 @@ basic_filebuf<_CharT, _Traits>::underflow()
|
||||
this->setg(this->eback(),
|
||||
this->eback() + __unget_sz,
|
||||
this->eback() + __unget_sz + __nmemb);
|
||||
__c = *this->gptr();
|
||||
__c = traits_type::to_int_type(*this->gptr());
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -587,7 +587,7 @@ basic_filebuf<_CharT, _Traits>::underflow()
|
||||
memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
|
||||
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
|
||||
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
|
||||
size_t __nmemb = min(static_cast<size_t>(this->egptr() - this->eback() - __unget_sz),
|
||||
size_t __nmemb = _VSTD::min(static_cast<size_t>(this->egptr() - this->eback() - __unget_sz),
|
||||
static_cast<size_t>(__extbufend_ - __extbufnext_));
|
||||
codecvt_base::result __r;
|
||||
state_type __svs = __st_;
|
||||
@@ -602,18 +602,18 @@ basic_filebuf<_CharT, _Traits>::underflow()
|
||||
if (__r == codecvt_base::noconv)
|
||||
{
|
||||
this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_);
|
||||
__c = *this->gptr();
|
||||
__c = traits_type::to_int_type(*this->gptr());
|
||||
}
|
||||
else if (__inext != this->eback() + __unget_sz)
|
||||
{
|
||||
this->setg(this->eback(), this->eback() + __unget_sz, __inext);
|
||||
__c = *this->gptr();
|
||||
__c = traits_type::to_int_type(*this->gptr());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
__c = *this->gptr();
|
||||
__c = traits_type::to_int_type(*this->gptr());
|
||||
if (this->eback() == &__1buf)
|
||||
this->setg(0, 0, 0);
|
||||
return __c;
|
||||
@@ -1019,8 +1019,8 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::ope
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_ifstream<_CharT, _Traits>::basic_ifstream(basic_ifstream&& __rhs)
|
||||
: basic_istream<char_type, traits_type>(_STD::move(__rhs)),
|
||||
__sb_(_STD::move(__rhs.__sb_))
|
||||
: basic_istream<char_type, traits_type>(_VSTD::move(__rhs)),
|
||||
__sb_(_VSTD::move(__rhs.__sb_))
|
||||
{
|
||||
this->set_rdbuf(&__sb_);
|
||||
}
|
||||
@@ -1030,8 +1030,8 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_ifstream<_CharT, _Traits>&
|
||||
basic_ifstream<_CharT, _Traits>::operator=(basic_ifstream&& __rhs)
|
||||
{
|
||||
basic_istream<char_type, traits_type>::operator=(_STD::move(__rhs));
|
||||
__sb_ = _STD::move(__rhs.__sb_);
|
||||
basic_istream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
|
||||
__sb_ = _VSTD::move(__rhs.__sb_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -1164,8 +1164,8 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::ope
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_ofstream<_CharT, _Traits>::basic_ofstream(basic_ofstream&& __rhs)
|
||||
: basic_ostream<char_type, traits_type>(_STD::move(__rhs)),
|
||||
__sb_(_STD::move(__rhs.__sb_))
|
||||
: basic_ostream<char_type, traits_type>(_VSTD::move(__rhs)),
|
||||
__sb_(_VSTD::move(__rhs.__sb_))
|
||||
{
|
||||
this->set_rdbuf(&__sb_);
|
||||
}
|
||||
@@ -1175,8 +1175,8 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_ofstream<_CharT, _Traits>&
|
||||
basic_ofstream<_CharT, _Traits>::operator=(basic_ofstream&& __rhs)
|
||||
{
|
||||
basic_ostream<char_type, traits_type>::operator=(_STD::move(__rhs));
|
||||
__sb_ = _STD::move(__rhs.__sb_);
|
||||
basic_ostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
|
||||
__sb_ = _VSTD::move(__rhs.__sb_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -1309,8 +1309,8 @@ basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openm
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_fstream<_CharT, _Traits>::basic_fstream(basic_fstream&& __rhs)
|
||||
: basic_iostream<char_type, traits_type>(_STD::move(__rhs)),
|
||||
__sb_(_STD::move(__rhs.__sb_))
|
||||
: basic_iostream<char_type, traits_type>(_VSTD::move(__rhs)),
|
||||
__sb_(_VSTD::move(__rhs.__sb_))
|
||||
{
|
||||
this->set_rdbuf(&__sb_);
|
||||
}
|
||||
@@ -1320,8 +1320,8 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_fstream<_CharT, _Traits>&
|
||||
basic_fstream<_CharT, _Traits>::operator=(basic_fstream&& __rhs)
|
||||
{
|
||||
basic_iostream<char_type, traits_type>::operator=(_STD::move(__rhs));
|
||||
__sb_ = _STD::move(__rhs.__sb_);
|
||||
basic_iostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
|
||||
__sb_ = _VSTD::move(__rhs.__sb_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,16 +43,16 @@ public:
|
||||
typedef see below result_type; // Not always defined
|
||||
|
||||
// construct/copy/destroy
|
||||
reference_wrapper(T&);
|
||||
reference_wrapper(T&) noexcept;
|
||||
reference_wrapper(T&&) = delete; // do not bind to temps
|
||||
reference_wrapper(const reference_wrapper<T>& x);
|
||||
reference_wrapper(const reference_wrapper<T>& x) noexcept;
|
||||
|
||||
// assignment
|
||||
reference_wrapper& operator=(const reference_wrapper<T>& x);
|
||||
reference_wrapper& operator=(const reference_wrapper<T>& x) noexcept;
|
||||
|
||||
// access
|
||||
operator T& () const;
|
||||
T& get() const;
|
||||
operator T& () const noexcept;
|
||||
T& get() const noexcept;
|
||||
|
||||
// invoke
|
||||
template <class... ArgTypes>
|
||||
@@ -60,13 +60,13 @@ public:
|
||||
operator() (ArgTypes&&...) const;
|
||||
};
|
||||
|
||||
template <class T> reference_wrapper<T> ref(T& t);
|
||||
template <class T> reference_wrapper<T> ref(T& t) noexcept;
|
||||
template <class T> void ref(const T&& t) = delete;
|
||||
template <class T> reference_wrapper<T> ref(reference_wrapper<T>t);
|
||||
template <class T> reference_wrapper<T> ref(reference_wrapper<T>t) noexcept;
|
||||
|
||||
template <class T> reference_wrapper<const T> cref(const T& t);
|
||||
template <class T> reference_wrapper<const T> cref(const T& t) noexcept;
|
||||
template <class T> void cref(const T&& t) = delete;
|
||||
template <class T> reference_wrapper<const T> cref(reference_wrapper<T> t);
|
||||
template <class T> reference_wrapper<const T> cref(reference_wrapper<T> t) noexcept;
|
||||
|
||||
template <class T>
|
||||
struct plus : binary_function<T, T, T>
|
||||
@@ -365,16 +365,16 @@ public:
|
||||
typedef R result_type;
|
||||
|
||||
// construct/copy/destroy:
|
||||
function();
|
||||
function(nullptr_t);
|
||||
function() noexcept;
|
||||
function(nullptr_t) noexcept;
|
||||
function(const function&);
|
||||
function(function&&);
|
||||
function(function&&) noexcept;
|
||||
template<class F>
|
||||
function(F);
|
||||
template<Allocator Alloc>
|
||||
function(allocator_arg_t, const Alloc&);
|
||||
function(allocator_arg_t, const Alloc&) noexcept;
|
||||
template<Allocator Alloc>
|
||||
function(allocator_arg_t, const Alloc&, nullptr_t);
|
||||
function(allocator_arg_t, const Alloc&, nullptr_t) noexcept;
|
||||
template<Allocator Alloc>
|
||||
function(allocator_arg_t, const Alloc&, const function&);
|
||||
template<Allocator Alloc>
|
||||
@@ -383,54 +383,48 @@ public:
|
||||
function(allocator_arg_t, const Alloc&, F);
|
||||
|
||||
function& operator=(const function&);
|
||||
function& operator=(function&&);
|
||||
function& operator=(nullptr_t);
|
||||
function& operator=(function&&) noexcept;
|
||||
function& operator=(nullptr_t) noexcept;
|
||||
template<class F>
|
||||
function& operator=(F&&);
|
||||
template<class F>
|
||||
function& operator=(reference_wrapper<F>);
|
||||
function& operator=(reference_wrapper<F>) noexcept;
|
||||
|
||||
~function();
|
||||
|
||||
// function modifiers:
|
||||
void swap(function&);
|
||||
void swap(function&) noexcept;
|
||||
template<class F, class Alloc>
|
||||
void assign(F&&, const Alloc&);
|
||||
|
||||
// function capacity:
|
||||
explicit operator bool() const;
|
||||
|
||||
// deleted overloads close possible hole in the type system
|
||||
template<class R2, class... ArgTypes2>
|
||||
bool operator==(const function<R2(ArgTypes2...)>&) = delete;
|
||||
template<class R2, class... ArgTypes2>
|
||||
bool operator!=(const function<R2(ArgTypes2...)>&) = delete;
|
||||
explicit operator bool() const noexcept;
|
||||
|
||||
// function invocation:
|
||||
R operator()(ArgTypes...) const;
|
||||
|
||||
// function target access:
|
||||
const std::type_info& target_type() const;
|
||||
template <typename T> T* target();
|
||||
template <typename T> const T* target() const;
|
||||
const std::type_info& target_type() const noexcept;
|
||||
template <typename T> T* target() noexcept;
|
||||
template <typename T> const T* target() const noexcept;
|
||||
};
|
||||
|
||||
// Null pointer comparisons:
|
||||
template <class R, class ... ArgTypes>
|
||||
bool operator==(const function<R(ArgTypes...)>&, nullptr_t);
|
||||
bool operator==(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
|
||||
|
||||
template <class R, class ... ArgTypes>
|
||||
bool operator==(nullptr_t, const function<R(ArgTypes...)>&);
|
||||
bool operator==(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
|
||||
|
||||
template <class R, class ... ArgTypes>
|
||||
bool operator!=(const function<R(ArgTypes...)>&, nullptr_t);
|
||||
bool operator!=(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
|
||||
|
||||
template <class R, class ... ArgTypes>
|
||||
bool operator!=(nullptr_t, const function<R(ArgTypes...)>&);
|
||||
bool operator!=(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
|
||||
|
||||
// specialized algorithms:
|
||||
template <class R, class ... ArgTypes>
|
||||
void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&);
|
||||
void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&) noexcept;
|
||||
|
||||
template <class T> struct hash;
|
||||
|
||||
@@ -890,7 +884,7 @@ public:
|
||||
typename __invoke_return<type, _ArgTypes...>::type
|
||||
operator() (_ArgTypes&&... __args)
|
||||
{
|
||||
return __invoke(__f_, _STD::forward<_ArgTypes>(__args)...);
|
||||
return __invoke(__f_, _VSTD::forward<_ArgTypes>(__args)...);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -980,12 +974,12 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY virtual ~__base() {}
|
||||
virtual __base* __clone() const = 0;
|
||||
virtual void __clone(__base*) const = 0;
|
||||
virtual void destroy() = 0;
|
||||
virtual void destroy_deallocate() = 0;
|
||||
virtual void destroy() _NOEXCEPT = 0;
|
||||
virtual void destroy_deallocate() _NOEXCEPT = 0;
|
||||
virtual _R operator()(_ArgTypes&& ...) = 0;
|
||||
#ifndef _LIBCPP_NO_RTTI
|
||||
virtual const void* target(const type_info&) const = 0;
|
||||
virtual const std::type_info& target_type() const = 0;
|
||||
virtual const void* target(const type_info&) const _NOEXCEPT = 0;
|
||||
virtual const std::type_info& target_type() const _NOEXCEPT = 0;
|
||||
#endif // _LIBCPP_NO_RTTI
|
||||
};
|
||||
|
||||
@@ -998,17 +992,17 @@ class __func<_F, _Alloc, _R(_ArgTypes...)>
|
||||
__compressed_pair<_F, _Alloc> __f_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __func(_F __f) : __f_(_STD::move(__f)) {}
|
||||
explicit __func(_F __f) : __f_(_VSTD::move(__f)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __func(_F __f, _Alloc __a) : __f_(_STD::move(__f), _STD::move(__a)) {}
|
||||
explicit __func(_F __f, _Alloc __a) : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
|
||||
virtual __base<_R(_ArgTypes...)>* __clone() const;
|
||||
virtual void __clone(__base<_R(_ArgTypes...)>*) const;
|
||||
virtual void destroy();
|
||||
virtual void destroy_deallocate();
|
||||
virtual void destroy() _NOEXCEPT;
|
||||
virtual void destroy_deallocate() _NOEXCEPT;
|
||||
virtual _R operator()(_ArgTypes&& ... __arg);
|
||||
#ifndef _LIBCPP_NO_RTTI
|
||||
virtual const void* target(const type_info&) const;
|
||||
virtual const std::type_info& target_type() const;
|
||||
virtual const void* target(const type_info&) const _NOEXCEPT;
|
||||
virtual const std::type_info& target_type() const _NOEXCEPT;
|
||||
#endif // _LIBCPP_NO_RTTI
|
||||
};
|
||||
|
||||
@@ -1033,14 +1027,14 @@ __func<_F, _Alloc, _R(_ArgTypes...)>::__clone(__base<_R(_ArgTypes...)>* __p) con
|
||||
|
||||
template<class _F, class _Alloc, class _R, class ..._ArgTypes>
|
||||
void
|
||||
__func<_F, _Alloc, _R(_ArgTypes...)>::destroy()
|
||||
__func<_F, _Alloc, _R(_ArgTypes...)>::destroy() _NOEXCEPT
|
||||
{
|
||||
__f_.~__compressed_pair<_F, _Alloc>();
|
||||
}
|
||||
|
||||
template<class _F, class _Alloc, class _R, class ..._ArgTypes>
|
||||
void
|
||||
__func<_F, _Alloc, _R(_ArgTypes...)>::destroy_deallocate()
|
||||
__func<_F, _Alloc, _R(_ArgTypes...)>::destroy_deallocate() _NOEXCEPT
|
||||
{
|
||||
typedef typename _Alloc::template rebind<__func>::other _A;
|
||||
_A __a(__f_.second());
|
||||
@@ -1052,14 +1046,14 @@ template<class _F, class _Alloc, class _R, class ..._ArgTypes>
|
||||
_R
|
||||
__func<_F, _Alloc, _R(_ArgTypes...)>::operator()(_ArgTypes&& ... __arg)
|
||||
{
|
||||
return __invoke(__f_.first(), _STD::forward<_ArgTypes>(__arg)...);
|
||||
return __invoke(__f_.first(), _VSTD::forward<_ArgTypes>(__arg)...);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_NO_RTTI
|
||||
|
||||
template<class _F, class _Alloc, class _R, class ..._ArgTypes>
|
||||
const void*
|
||||
__func<_F, _Alloc, _R(_ArgTypes...)>::target(const type_info& __ti) const
|
||||
__func<_F, _Alloc, _R(_ArgTypes...)>::target(const type_info& __ti) const _NOEXCEPT
|
||||
{
|
||||
if (__ti == typeid(_F))
|
||||
return &__f_.first();
|
||||
@@ -1068,7 +1062,7 @@ __func<_F, _Alloc, _R(_ArgTypes...)>::target(const type_info& __ti) const
|
||||
|
||||
template<class _F, class _Alloc, class _R, class ..._ArgTypes>
|
||||
const std::type_info&
|
||||
__func<_F, _Alloc, _R(_ArgTypes...)>::target_type() const
|
||||
__func<_F, _Alloc, _R(_ArgTypes...)>::target_type() const _NOEXCEPT
|
||||
{
|
||||
return typeid(_F);
|
||||
}
|
||||
@@ -1107,41 +1101,56 @@ class _LIBCPP_VISIBLE function<_R(_ArgTypes...)>
|
||||
template <class _R2, class ..._A>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(const function<_R(_A...)>& __p) {return __p;}
|
||||
|
||||
template <class _F, bool = __invokable<_F&, _ArgTypes...>::value>
|
||||
struct __callable;
|
||||
template <class _F>
|
||||
struct __callable<_F, true>
|
||||
{
|
||||
static const bool value =
|
||||
is_convertible<typename __invoke_of<_F&, _ArgTypes...>::type,
|
||||
_R>::value;
|
||||
};
|
||||
template <class _F>
|
||||
struct __callable<_F, false>
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
public:
|
||||
typedef _R result_type;
|
||||
|
||||
// construct/copy/destroy:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
function() : __f_(0) {}
|
||||
function() _NOEXCEPT : __f_(0) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
function(nullptr_t) : __f_(0) {}
|
||||
function(nullptr_t) _NOEXCEPT : __f_(0) {}
|
||||
function(const function&);
|
||||
function(function&&);
|
||||
function(function&&) _NOEXCEPT;
|
||||
template<class _F>
|
||||
function(_F,
|
||||
typename enable_if<!is_integral<_F>::value>::type* = 0);
|
||||
typename enable_if<__callable<_F>::value>::type* = 0);
|
||||
|
||||
template<class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
function(allocator_arg_t, const _Alloc&) : __f_(0) {}
|
||||
function(allocator_arg_t, const _Alloc&) _NOEXCEPT : __f_(0) {}
|
||||
template<class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {}
|
||||
function(allocator_arg_t, const _Alloc&, nullptr_t) _NOEXCEPT : __f_(0) {}
|
||||
template<class _Alloc>
|
||||
function(allocator_arg_t, const _Alloc&, const function&);
|
||||
template<class _Alloc>
|
||||
function(allocator_arg_t, const _Alloc&, function&&);
|
||||
template<class _F, class _Alloc>
|
||||
function(allocator_arg_t, const _Alloc& __a, _F __f,
|
||||
typename enable_if<!is_integral<_F>::value>::type* = 0);
|
||||
typename enable_if<__callable<_F>::value>::type* = 0);
|
||||
|
||||
function& operator=(const function&);
|
||||
function& operator=(function&&);
|
||||
function& operator=(nullptr_t);
|
||||
function& operator=(function&&) _NOEXCEPT;
|
||||
function& operator=(nullptr_t) _NOEXCEPT;
|
||||
template<class _F>
|
||||
typename enable_if
|
||||
<
|
||||
!is_integral<typename decay<_F>::type>::value,
|
||||
__callable<typename decay<_F>::type>::value,
|
||||
function&
|
||||
>::type
|
||||
operator=(_F&&);
|
||||
@@ -1149,15 +1158,15 @@ public:
|
||||
~function();
|
||||
|
||||
// function modifiers:
|
||||
void swap(function&);
|
||||
void swap(function&) _NOEXCEPT;
|
||||
template<class _F, class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void assign(_F&& __f, const _Alloc& __a)
|
||||
{function(allocator_arg, __a, _STD::forward<_F>(__f)).swap(*this);}
|
||||
{function(allocator_arg, __a, _VSTD::forward<_F>(__f)).swap(*this);}
|
||||
|
||||
// function capacity:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
/*explicit*/ operator bool() const {return __f_;}
|
||||
/*explicit*/ operator bool() const _NOEXCEPT {return __f_;}
|
||||
|
||||
// deleted overloads close possible hole in the type system
|
||||
template<class _R2, class... _ArgTypes2>
|
||||
@@ -1170,9 +1179,9 @@ public:
|
||||
|
||||
#ifndef _LIBCPP_NO_RTTI
|
||||
// function target access:
|
||||
const std::type_info& target_type() const;
|
||||
template <typename _T> _T* target();
|
||||
template <typename _T> const _T* target() const;
|
||||
const std::type_info& target_type() const _NOEXCEPT;
|
||||
template <typename _T> _T* target() _NOEXCEPT;
|
||||
template <typename _T> const _T* target() const _NOEXCEPT;
|
||||
#endif // _LIBCPP_NO_RTTI
|
||||
};
|
||||
|
||||
@@ -1207,7 +1216,7 @@ function<_R(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&,
|
||||
}
|
||||
|
||||
template<class _R, class ..._ArgTypes>
|
||||
function<_R(_ArgTypes...)>::function(function&& __f)
|
||||
function<_R(_ArgTypes...)>::function(function&& __f) _NOEXCEPT
|
||||
{
|
||||
if (__f.__f_ == 0)
|
||||
__f_ = 0;
|
||||
@@ -1245,16 +1254,16 @@ function<_R(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&,
|
||||
template<class _R, class ..._ArgTypes>
|
||||
template <class _F>
|
||||
function<_R(_ArgTypes...)>::function(_F __f,
|
||||
typename enable_if<!is_integral<_F>::value>::type*)
|
||||
typename enable_if<__callable<_F>::value>::type*)
|
||||
: __f_(0)
|
||||
{
|
||||
if (__not_null(__f))
|
||||
{
|
||||
typedef __function::__func<_F, allocator<_F>, _R(_ArgTypes...)> _FF;
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
if (sizeof(_FF) <= sizeof(__buf_) && is_nothrow_copy_constructible<_F>::value)
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(_STD::move(__f));
|
||||
::new (__f_) _FF(_VSTD::move(__f));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1262,7 +1271,7 @@ function<_R(_ArgTypes...)>::function(_F __f,
|
||||
_A __a;
|
||||
typedef __allocator_destructor<_A> _D;
|
||||
unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1));
|
||||
::new (__hold.get()) _FF(_STD::move(__f), allocator<_F>(__a));
|
||||
::new (__hold.get()) _FF(_VSTD::move(__f), allocator<_F>(__a));
|
||||
__f_ = __hold.release();
|
||||
}
|
||||
}
|
||||
@@ -1271,17 +1280,17 @@ function<_R(_ArgTypes...)>::function(_F __f,
|
||||
template<class _R, class ..._ArgTypes>
|
||||
template <class _F, class _Alloc>
|
||||
function<_R(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a0, _F __f,
|
||||
typename enable_if<!is_integral<_F>::value>::type*)
|
||||
typename enable_if<__callable<_F>::value>::type*)
|
||||
: __f_(0)
|
||||
{
|
||||
typedef allocator_traits<_Alloc> __alloc_traits;
|
||||
if (__not_null(__f))
|
||||
{
|
||||
typedef __function::__func<_F, _Alloc, _R(_ArgTypes...)> _FF;
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
if (sizeof(_FF) <= sizeof(__buf_) && is_nothrow_copy_constructible<_F>::value)
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(_STD::move(__f));
|
||||
::new (__f_) _FF(_VSTD::move(__f));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1295,7 +1304,7 @@ function<_R(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a0, _F __f
|
||||
_A __a(__a0);
|
||||
typedef __allocator_destructor<_A> _D;
|
||||
unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1));
|
||||
::new (__hold.get()) _FF(_STD::move(__f), _Alloc(__a));
|
||||
::new (__hold.get()) _FF(_VSTD::move(__f), _Alloc(__a));
|
||||
__f_ = __hold.release();
|
||||
}
|
||||
}
|
||||
@@ -1311,7 +1320,7 @@ function<_R(_ArgTypes...)>::operator=(const function& __f)
|
||||
|
||||
template<class _R, class ..._ArgTypes>
|
||||
function<_R(_ArgTypes...)>&
|
||||
function<_R(_ArgTypes...)>::operator=(function&& __f)
|
||||
function<_R(_ArgTypes...)>::operator=(function&& __f) _NOEXCEPT
|
||||
{
|
||||
if (__f_ == (__base*)&__buf_)
|
||||
__f_->destroy();
|
||||
@@ -1334,7 +1343,7 @@ function<_R(_ArgTypes...)>::operator=(function&& __f)
|
||||
|
||||
template<class _R, class ..._ArgTypes>
|
||||
function<_R(_ArgTypes...)>&
|
||||
function<_R(_ArgTypes...)>::operator=(nullptr_t)
|
||||
function<_R(_ArgTypes...)>::operator=(nullptr_t) _NOEXCEPT
|
||||
{
|
||||
if (__f_ == (__base*)&__buf_)
|
||||
__f_->destroy();
|
||||
@@ -1347,12 +1356,12 @@ template<class _R, class ..._ArgTypes>
|
||||
template <class _F>
|
||||
typename enable_if
|
||||
<
|
||||
!is_integral<typename decay<_F>::type>::value,
|
||||
function<_R(_ArgTypes...)>::template __callable<typename decay<_F>::type>::value,
|
||||
function<_R(_ArgTypes...)>&
|
||||
>::type
|
||||
function<_R(_ArgTypes...)>::operator=(_F&& __f)
|
||||
{
|
||||
function(_STD::forward<_F>(__f)).swap(*this);
|
||||
function(_VSTD::forward<_F>(__f)).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -1367,7 +1376,7 @@ function<_R(_ArgTypes...)>::~function()
|
||||
|
||||
template<class _R, class ..._ArgTypes>
|
||||
void
|
||||
function<_R(_ArgTypes...)>::swap(function& __f)
|
||||
function<_R(_ArgTypes...)>::swap(function& __f) _NOEXCEPT
|
||||
{
|
||||
if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
|
||||
{
|
||||
@@ -1399,7 +1408,7 @@ function<_R(_ArgTypes...)>::swap(function& __f)
|
||||
__f_ = (__base*)&__buf_;
|
||||
}
|
||||
else
|
||||
_STD::swap(__f_, __f.__f_);
|
||||
_VSTD::swap(__f_, __f.__f_);
|
||||
}
|
||||
|
||||
template<class _R, class ..._ArgTypes>
|
||||
@@ -1410,14 +1419,14 @@ function<_R(_ArgTypes...)>::operator()(_ArgTypes... __arg) const
|
||||
if (__f_ == 0)
|
||||
throw bad_function_call();
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
return (*__f_)(_STD::forward<_ArgTypes>(__arg)...);
|
||||
return (*__f_)(_VSTD::forward<_ArgTypes>(__arg)...);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_NO_RTTI
|
||||
|
||||
template<class _R, class ..._ArgTypes>
|
||||
const std::type_info&
|
||||
function<_R(_ArgTypes...)>::target_type() const
|
||||
function<_R(_ArgTypes...)>::target_type() const _NOEXCEPT
|
||||
{
|
||||
if (__f_ == 0)
|
||||
return typeid(void);
|
||||
@@ -1427,7 +1436,7 @@ function<_R(_ArgTypes...)>::target_type() const
|
||||
template<class _R, class ..._ArgTypes>
|
||||
template <typename _T>
|
||||
_T*
|
||||
function<_R(_ArgTypes...)>::target()
|
||||
function<_R(_ArgTypes...)>::target() _NOEXCEPT
|
||||
{
|
||||
if (__f_ == 0)
|
||||
return (_T*)0;
|
||||
@@ -1437,7 +1446,7 @@ function<_R(_ArgTypes...)>::target()
|
||||
template<class _R, class ..._ArgTypes>
|
||||
template <typename _T>
|
||||
const _T*
|
||||
function<_R(_ArgTypes...)>::target() const
|
||||
function<_R(_ArgTypes...)>::target() const _NOEXCEPT
|
||||
{
|
||||
if (__f_ == 0)
|
||||
return (const _T*)0;
|
||||
@@ -1449,27 +1458,27 @@ function<_R(_ArgTypes...)>::target() const
|
||||
template <class _R, class... _ArgTypes>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const function<_R(_ArgTypes...)>& __f, nullptr_t) {return !__f;}
|
||||
operator==(const function<_R(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {return !__f;}
|
||||
|
||||
template <class _R, class... _ArgTypes>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(nullptr_t, const function<_R(_ArgTypes...)>& __f) {return !__f;}
|
||||
operator==(nullptr_t, const function<_R(_ArgTypes...)>& __f) _NOEXCEPT {return !__f;}
|
||||
|
||||
template <class _R, class... _ArgTypes>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const function<_R(_ArgTypes...)>& __f, nullptr_t) {return (bool)__f;}
|
||||
operator!=(const function<_R(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {return (bool)__f;}
|
||||
|
||||
template <class _R, class... _ArgTypes>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(nullptr_t, const function<_R(_ArgTypes...)>& __f) {return (bool)__f;}
|
||||
operator!=(nullptr_t, const function<_R(_ArgTypes...)>& __f) _NOEXCEPT {return (bool)__f;}
|
||||
|
||||
template <class _R, class... _ArgTypes>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(function<_R(_ArgTypes...)>& __x, function<_R(_ArgTypes...)>& __y)
|
||||
swap(function<_R(_ArgTypes...)>& __x, function<_R(_ArgTypes...)>& __y) _NOEXCEPT
|
||||
{return __x.swap(__y);}
|
||||
|
||||
template<class _Tp> struct __is_bind_expression : public false_type {};
|
||||
@@ -1510,21 +1519,12 @@ __mu(reference_wrapper<_Tp> __t, _Uj&)
|
||||
return __t.get();
|
||||
}
|
||||
|
||||
template <bool _IsBindExpr, class _Ti, class ..._Uj>
|
||||
struct __mu_return1 {};
|
||||
|
||||
template <class _Ti, class ..._Uj>
|
||||
struct __mu_return1<true, _Ti, _Uj...>
|
||||
{
|
||||
typedef typename result_of<_Ti(_Uj...)>::type type;
|
||||
};
|
||||
|
||||
template <class _Ti, class ..._Uj, size_t ..._Indx>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename __mu_return1<true, _Ti, _Uj...>::type
|
||||
__mu_expand(_Ti& __ti, tuple<_Uj...>&& __uj, __tuple_indices<_Indx...>)
|
||||
typename __invoke_of<_Ti&, _Uj...>::type
|
||||
__mu_expand(_Ti& __ti, tuple<_Uj...>& __uj, __tuple_indices<_Indx...>)
|
||||
{
|
||||
return __ti(_STD::forward<typename tuple_element<_Indx, _Uj>::type>(get<_Indx>(__uj))...);
|
||||
return __ti(_VSTD::forward<_Uj>(get<_Indx>(__uj))...);
|
||||
}
|
||||
|
||||
template <class _Ti, class ..._Uj>
|
||||
@@ -1532,7 +1532,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_bind_expression<_Ti>::value,
|
||||
typename __mu_return1<is_bind_expression<_Ti>::value, _Ti, _Uj...>::type
|
||||
typename __invoke_of<_Ti&, _Uj...>::type
|
||||
>::type
|
||||
__mu(_Ti& __ti, tuple<_Uj...>& __uj)
|
||||
{
|
||||
@@ -1559,10 +1559,7 @@ typename enable_if
|
||||
__mu(_Ti&, _Uj& __uj)
|
||||
{
|
||||
const size_t _Indx = is_placeholder<_Ti>::value - 1;
|
||||
// compiler bug workaround
|
||||
typename tuple_element<_Indx, _Uj>::type __t = get<_Indx>(__uj);
|
||||
return __t;
|
||||
// return _STD::forward<typename tuple_element<_Indx, _Uj>::type>(get<_Indx>(__uj));
|
||||
return _VSTD::forward<typename tuple_element<_Indx, _Uj>::type>(get<_Indx>(__uj));
|
||||
}
|
||||
|
||||
template <class _Ti, class _Uj>
|
||||
@@ -1579,24 +1576,31 @@ __mu(_Ti& __ti, _Uj& __uj)
|
||||
return __ti;
|
||||
}
|
||||
|
||||
template <class _Ti, bool IsBindEx, bool IsPh, class _TupleUj>
|
||||
template <class _Ti, bool IsReferenceWrapper, bool IsBindEx, bool IsPh,
|
||||
class _TupleUj>
|
||||
struct ____mu_return;
|
||||
|
||||
template <class _Ti, class ..._Uj>
|
||||
struct ____mu_return<_Ti, true, false, tuple<_Uj...> >
|
||||
struct ____mu_return<_Ti, false, true, false, tuple<_Uj...> >
|
||||
{
|
||||
typedef typename result_of<_Ti(_Uj...)>::type type;
|
||||
typedef typename __invoke_of<_Ti&, _Uj...>::type type;
|
||||
};
|
||||
|
||||
template <class _Ti, class _TupleUj>
|
||||
struct ____mu_return<_Ti, false, true, _TupleUj>
|
||||
struct ____mu_return<_Ti, false, false, true, _TupleUj>
|
||||
{
|
||||
typedef typename tuple_element<is_placeholder<_Ti>::value - 1,
|
||||
_TupleUj>::type&& type;
|
||||
};
|
||||
|
||||
template <class _Ti, class _TupleUj>
|
||||
struct ____mu_return<_Ti, false, false, _TupleUj>
|
||||
struct ____mu_return<_Ti, true, false, false, _TupleUj>
|
||||
{
|
||||
typedef typename _Ti::type& type;
|
||||
};
|
||||
|
||||
template <class _Ti, class _TupleUj>
|
||||
struct ____mu_return<_Ti, false, false, false, _TupleUj>
|
||||
{
|
||||
typedef _Ti& type;
|
||||
};
|
||||
@@ -1604,25 +1608,20 @@ struct ____mu_return<_Ti, false, false, _TupleUj>
|
||||
template <class _Ti, class _TupleUj>
|
||||
struct __mu_return
|
||||
: public ____mu_return<_Ti,
|
||||
__is_reference_wrapper<_Ti>::value,
|
||||
is_bind_expression<_Ti>::value,
|
||||
0 < is_placeholder<_Ti>::value,
|
||||
_TupleUj>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Ti, class _TupleUj>
|
||||
struct __mu_return<reference_wrapper<_Ti>, _TupleUj>
|
||||
{
|
||||
typedef _Ti& type;
|
||||
};
|
||||
|
||||
template <class _F, class _BoundArgs, class _TupleUj>
|
||||
struct __bind_return;
|
||||
|
||||
template <class _F, class ..._BoundArgs, class _TupleUj>
|
||||
struct __bind_return<_F, tuple<_BoundArgs...>, _TupleUj>
|
||||
{
|
||||
typedef typename __invoke_return
|
||||
typedef typename __invoke_of
|
||||
<
|
||||
_F&,
|
||||
typename __mu_return
|
||||
@@ -1636,7 +1635,7 @@ struct __bind_return<_F, tuple<_BoundArgs...>, _TupleUj>
|
||||
template <class _F, class ..._BoundArgs, class _TupleUj>
|
||||
struct __bind_return<_F, const tuple<_BoundArgs...>, _TupleUj>
|
||||
{
|
||||
typedef typename __invoke_return
|
||||
typedef typename __invoke_of
|
||||
<
|
||||
_F&,
|
||||
typename __mu_return
|
||||
@@ -1658,41 +1657,67 @@ __apply_functor(_F& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>,
|
||||
|
||||
template<class _F, class ..._BoundArgs>
|
||||
class __bind
|
||||
: public __weak_result_type<_F>
|
||||
: public __weak_result_type<typename decay<_F>::type>
|
||||
{
|
||||
_F __f_;
|
||||
tuple<_BoundArgs...> __bound_args_;
|
||||
typedef typename decay<_F>::type _Fd;
|
||||
typedef tuple<typename decay<_BoundArgs>::type...> _Td;
|
||||
_Fd __f_;
|
||||
_Td __bound_args_;
|
||||
|
||||
typedef typename __make_tuple_indices<sizeof...(_BoundArgs)>::type __indices;
|
||||
public:
|
||||
#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bind(const __bind& __b)
|
||||
: __f_(__b.__f_),
|
||||
__bound_args_(__b.__bound_args_) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bind& operator=(const __bind& __b)
|
||||
{
|
||||
__f_ = __b.__f_;
|
||||
__bound_args_ = __b.__bound_args_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bind(__bind&& __b)
|
||||
: __f_(_STD::move(__b.__f_)),
|
||||
__bound_args_(_STD::move(__b.__bound_args_)) {}
|
||||
: __f_(_VSTD::move(__b.__f_)),
|
||||
__bound_args_(_VSTD::move(__b.__bound_args_)) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bind& operator=(__bind&& __b)
|
||||
{
|
||||
__f_ = _VSTD::move(__b.__f_);
|
||||
__bound_args_ = _VSTD::move(__b.__bound_args_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
|
||||
template <class _G, class ..._BA>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __bind(_G&& __f, _BA&& ...__bound_args)
|
||||
: __f_(_STD::forward<_G>(__f)),
|
||||
__bound_args_(_STD::forward<_BA>(__bound_args)...) {}
|
||||
: __f_(_VSTD::forward<_G>(__f)),
|
||||
__bound_args_(_VSTD::forward<_BA>(__bound_args)...) {}
|
||||
|
||||
template <class ..._Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __bind_return<_F, tuple<_BoundArgs...>, tuple<_Args&&...> >::type
|
||||
typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type
|
||||
operator()(_Args&& ...__args)
|
||||
{
|
||||
// compiler bug workaround
|
||||
return __apply_functor(__f_, __bound_args_, __indices(),
|
||||
tuple<_Args&&...>(_STD::forward<_Args>(__args)...));
|
||||
tuple<_Args&&...>(_VSTD::forward<_Args>(__args)...));
|
||||
}
|
||||
|
||||
template <class ..._Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __bind_return<_F, tuple<_BoundArgs...>, tuple<_Args&&...> >::type
|
||||
typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type
|
||||
operator()(_Args&& ...__args) const
|
||||
{
|
||||
return __apply_functor(__f_, __bound_args_, __indices(),
|
||||
tuple<_Args&&...>(_STD::forward<_Args>(__args)...));
|
||||
tuple<_Args&&...>(_VSTD::forward<_Args>(__args)...));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1707,18 +1732,44 @@ class __bind_r
|
||||
public:
|
||||
typedef _R result_type;
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bind_r(const __bind_r& __b)
|
||||
: base(_VSTD::forward<const base&>(__b)) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bind_r& operator=(const __bind_r& __b)
|
||||
{
|
||||
base::operator=(_VSTD::forward<const base&>(__b));
|
||||
return *this;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bind_r(__bind_r&& __b)
|
||||
: base(_VSTD::forward<base>(__b)) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bind_r& operator=(__bind_r&& __b)
|
||||
{
|
||||
base::operator=(_VSTD::forward<base>(__b));
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
|
||||
template <class _G, class ..._BA>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __bind_r(_G&& __f, _BA&& ...__bound_args)
|
||||
: base(_STD::forward<_G>(__f),
|
||||
_STD::forward<_BA>(__bound_args)...) {}
|
||||
: base(_VSTD::forward<_G>(__f),
|
||||
_VSTD::forward<_BA>(__bound_args)...) {}
|
||||
|
||||
template <class ..._Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
result_type
|
||||
operator()(_Args&& ...__args)
|
||||
{
|
||||
return base::operator()(_STD::forward<_Args>(__args)...);
|
||||
return base::operator()(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class ..._Args>
|
||||
@@ -1726,7 +1777,7 @@ public:
|
||||
result_type
|
||||
operator()(_Args&& ...__args) const
|
||||
{
|
||||
return base::operator()(_STD::forward<_Args>(__args)...);
|
||||
return base::operator()(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1735,20 +1786,20 @@ struct __is_bind_expression<__bind_r<_R, _F, _BoundArgs...> > : public true_type
|
||||
|
||||
template<class _F, class ..._BoundArgs>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__bind<typename decay<_F>::type, typename decay<_BoundArgs>::type...>
|
||||
__bind<_F, _BoundArgs...>
|
||||
bind(_F&& __f, _BoundArgs&&... __bound_args)
|
||||
{
|
||||
typedef __bind<typename decay<_F>::type, typename decay<_BoundArgs>::type...> type;
|
||||
return type(_STD::forward<_F>(__f), _STD::forward<_BoundArgs>(__bound_args)...);
|
||||
typedef __bind<_F, _BoundArgs...> type;
|
||||
return type(_VSTD::forward<_F>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...);
|
||||
}
|
||||
|
||||
template<class _R, class _F, class ..._BoundArgs>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__bind_r<_R, typename decay<_F>::type, typename decay<_BoundArgs>::type...>
|
||||
__bind_r<_R, _F, _BoundArgs...>
|
||||
bind(_F&& __f, _BoundArgs&&... __bound_args)
|
||||
{
|
||||
typedef __bind_r<_R, typename decay<_F>::type, typename decay<_BoundArgs>::type...> type;
|
||||
return type(_STD::forward<_F>(__f), _STD::forward<_BoundArgs>(__bound_args)...);
|
||||
typedef __bind_r<_R, _F, _BoundArgs...> type;
|
||||
return type(_VSTD::forward<_F>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
@@ -1758,7 +1809,7 @@ struct _LIBCPP_VISIBLE hash<bool>
|
||||
: public unary_function<bool, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(bool __v) const {return static_cast<size_t>(__v);}
|
||||
size_t operator()(bool __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
@@ -1766,7 +1817,7 @@ struct _LIBCPP_VISIBLE hash<char>
|
||||
: public unary_function<char, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(char __v) const {return static_cast<size_t>(__v);}
|
||||
size_t operator()(char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
@@ -1774,7 +1825,7 @@ struct _LIBCPP_VISIBLE hash<signed char>
|
||||
: public unary_function<signed char, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(signed char __v) const {return static_cast<size_t>(__v);}
|
||||
size_t operator()(signed char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
@@ -1782,7 +1833,7 @@ struct _LIBCPP_VISIBLE hash<unsigned char>
|
||||
: public unary_function<unsigned char, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(unsigned char __v) const {return static_cast<size_t>(__v);}
|
||||
size_t operator()(unsigned char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
@@ -1792,7 +1843,7 @@ struct _LIBCPP_VISIBLE hash<char16_t>
|
||||
: public unary_function<char16_t, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(char16_t __v) const {return static_cast<size_t>(__v);}
|
||||
size_t operator()(char16_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
@@ -1800,7 +1851,7 @@ struct _LIBCPP_VISIBLE hash<char32_t>
|
||||
: public unary_function<char32_t, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(char32_t __v) const {return static_cast<size_t>(__v);}
|
||||
size_t operator()(char32_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
@@ -1810,7 +1861,7 @@ struct _LIBCPP_VISIBLE hash<wchar_t>
|
||||
: public unary_function<wchar_t, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(wchar_t __v) const {return static_cast<size_t>(__v);}
|
||||
size_t operator()(wchar_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
@@ -1818,7 +1869,7 @@ struct _LIBCPP_VISIBLE hash<short>
|
||||
: public unary_function<short, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(short __v) const {return static_cast<size_t>(__v);}
|
||||
size_t operator()(short __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
@@ -1826,7 +1877,7 @@ struct _LIBCPP_VISIBLE hash<unsigned short>
|
||||
: public unary_function<unsigned short, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(unsigned short __v) const {return static_cast<size_t>(__v);}
|
||||
size_t operator()(unsigned short __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
@@ -1834,7 +1885,7 @@ struct _LIBCPP_VISIBLE hash<int>
|
||||
: public unary_function<int, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(int __v) const {return static_cast<size_t>(__v);}
|
||||
size_t operator()(int __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
@@ -1842,7 +1893,7 @@ struct _LIBCPP_VISIBLE hash<unsigned int>
|
||||
: public unary_function<unsigned int, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(unsigned int __v) const {return static_cast<size_t>(__v);}
|
||||
size_t operator()(unsigned int __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
@@ -1850,7 +1901,7 @@ struct _LIBCPP_VISIBLE hash<long>
|
||||
: public unary_function<long, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(long __v) const {return static_cast<size_t>(__v);}
|
||||
size_t operator()(long __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
@@ -1858,7 +1909,7 @@ struct _LIBCPP_VISIBLE hash<unsigned long>
|
||||
: public unary_function<unsigned long, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(unsigned long __v) const {return static_cast<size_t>(__v);}
|
||||
size_t operator()(unsigned long __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
@@ -1866,7 +1917,7 @@ struct _LIBCPP_VISIBLE hash<long long>
|
||||
: public unary_function<long long, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(long long __v) const
|
||||
size_t operator()(long long __v) const _NOEXCEPT
|
||||
{
|
||||
size_t __r = 0;
|
||||
const size_t* const __p = reinterpret_cast<const size_t*>(&__v);
|
||||
@@ -1881,7 +1932,7 @@ struct _LIBCPP_VISIBLE hash<unsigned long long>
|
||||
: public unary_function<unsigned long long, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(unsigned long long __v) const
|
||||
size_t operator()(unsigned long long __v) const _NOEXCEPT
|
||||
{
|
||||
size_t __r = 0;
|
||||
const size_t* const __p = reinterpret_cast<const size_t*>(&__v);
|
||||
@@ -1896,7 +1947,7 @@ struct _LIBCPP_VISIBLE hash<float>
|
||||
: public unary_function<float, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(float __v) const
|
||||
size_t operator()(float __v) const _NOEXCEPT
|
||||
{
|
||||
if (__v == 0)
|
||||
return 0;
|
||||
@@ -1910,7 +1961,7 @@ struct _LIBCPP_VISIBLE hash<double>
|
||||
: public unary_function<double, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(double __v) const
|
||||
size_t operator()(double __v) const _NOEXCEPT
|
||||
{
|
||||
if (__v == 0)
|
||||
return 0;
|
||||
@@ -1927,7 +1978,7 @@ struct _LIBCPP_VISIBLE hash<long double>
|
||||
: public unary_function<long double, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(long double __v) const
|
||||
size_t operator()(long double __v) const _NOEXCEPT
|
||||
{
|
||||
if (__v == 0)
|
||||
return 0;
|
||||
|
||||
368
include/future
368
include/future
@@ -452,6 +452,8 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const error_code& code() const throw() {return __ec_;}
|
||||
|
||||
virtual ~future_error() _NOEXCEPT;
|
||||
};
|
||||
|
||||
class __assoc_sub_state
|
||||
@@ -463,7 +465,7 @@ protected:
|
||||
mutable condition_variable __cv_;
|
||||
unsigned __state_;
|
||||
|
||||
virtual void __on_zero_shared();
|
||||
virtual void __on_zero_shared() _NOEXCEPT;
|
||||
void __sub_wait(unique_lock<mutex>& __lk);
|
||||
public:
|
||||
enum
|
||||
@@ -543,7 +545,7 @@ class __assoc_state
|
||||
protected:
|
||||
_U __value_;
|
||||
|
||||
virtual void __on_zero_shared();
|
||||
virtual void __on_zero_shared() _NOEXCEPT;
|
||||
public:
|
||||
|
||||
template <class _Arg>
|
||||
@@ -566,7 +568,7 @@ public:
|
||||
|
||||
template <class _R>
|
||||
void
|
||||
__assoc_state<_R>::__on_zero_shared()
|
||||
__assoc_state<_R>::__on_zero_shared() _NOEXCEPT
|
||||
{
|
||||
if (this->__state_ & base::__constructed)
|
||||
reinterpret_cast<_R*>(&__value_)->~_R();
|
||||
@@ -583,9 +585,11 @@ __assoc_state<_R>::set_value(_Arg& __arg)
|
||||
#endif
|
||||
{
|
||||
unique_lock<mutex> __lk(this->__mut_);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (this->__has_value())
|
||||
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
||||
::new(&__value_) _R(_STD::forward<_Arg>(__arg));
|
||||
#endif
|
||||
::new(&__value_) _R(_VSTD::forward<_Arg>(__arg));
|
||||
this->__state_ |= base::__constructed | base::ready;
|
||||
__lk.unlock();
|
||||
__cv_.notify_all();
|
||||
@@ -601,9 +605,11 @@ __assoc_state<_R>::set_value_at_thread_exit(_Arg& __arg)
|
||||
#endif
|
||||
{
|
||||
unique_lock<mutex> __lk(this->__mut_);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (this->__has_value())
|
||||
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
||||
::new(&__value_) _R(_STD::forward<_Arg>(__arg));
|
||||
#endif
|
||||
::new(&__value_) _R(_VSTD::forward<_Arg>(__arg));
|
||||
this->__state_ |= base::__constructed;
|
||||
__thread_local_data()->__make_ready_at_thread_exit(this);
|
||||
__lk.unlock();
|
||||
@@ -617,7 +623,7 @@ __assoc_state<_R>::move()
|
||||
this->__sub_wait(__lk);
|
||||
if (this->__exception_ != nullptr)
|
||||
rethrow_exception(this->__exception_);
|
||||
return _STD::move(*reinterpret_cast<_R*>(&__value_));
|
||||
return _VSTD::move(*reinterpret_cast<_R*>(&__value_));
|
||||
}
|
||||
|
||||
template <class _R>
|
||||
@@ -640,7 +646,7 @@ class __assoc_state<_R&>
|
||||
protected:
|
||||
_U __value_;
|
||||
|
||||
virtual void __on_zero_shared();
|
||||
virtual void __on_zero_shared() _NOEXCEPT;
|
||||
public:
|
||||
|
||||
void set_value(_R& __arg);
|
||||
@@ -651,7 +657,7 @@ public:
|
||||
|
||||
template <class _R>
|
||||
void
|
||||
__assoc_state<_R&>::__on_zero_shared()
|
||||
__assoc_state<_R&>::__on_zero_shared() _NOEXCEPT
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
@@ -661,8 +667,10 @@ void
|
||||
__assoc_state<_R&>::set_value(_R& __arg)
|
||||
{
|
||||
unique_lock<mutex> __lk(this->__mut_);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (this->__has_value())
|
||||
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
||||
#endif
|
||||
__value_ = &__arg;
|
||||
this->__state_ |= base::__constructed | base::ready;
|
||||
__lk.unlock();
|
||||
@@ -674,8 +682,10 @@ void
|
||||
__assoc_state<_R&>::set_value_at_thread_exit(_R& __arg)
|
||||
{
|
||||
unique_lock<mutex> __lk(this->__mut_);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (this->__has_value())
|
||||
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
||||
#endif
|
||||
__value_ = &__arg;
|
||||
this->__state_ |= base::__constructed;
|
||||
__thread_local_data()->__make_ready_at_thread_exit(this);
|
||||
@@ -700,7 +710,7 @@ class __assoc_state_alloc
|
||||
typedef __assoc_state<_R> base;
|
||||
_Alloc __alloc_;
|
||||
|
||||
virtual void __on_zero_shared();
|
||||
virtual void __on_zero_shared() _NOEXCEPT;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __assoc_state_alloc(const _Alloc& __a)
|
||||
@@ -709,7 +719,7 @@ public:
|
||||
|
||||
template <class _R, class _Alloc>
|
||||
void
|
||||
__assoc_state_alloc<_R, _Alloc>::__on_zero_shared()
|
||||
__assoc_state_alloc<_R, _Alloc>::__on_zero_shared() _NOEXCEPT
|
||||
{
|
||||
if (this->__state_ & base::__constructed)
|
||||
reinterpret_cast<_R*>(&this->__value_)->~_R();
|
||||
@@ -725,7 +735,7 @@ class __assoc_state_alloc<_R&, _Alloc>
|
||||
typedef __assoc_state<_R&> base;
|
||||
_Alloc __alloc_;
|
||||
|
||||
virtual void __on_zero_shared();
|
||||
virtual void __on_zero_shared() _NOEXCEPT;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __assoc_state_alloc(const _Alloc& __a)
|
||||
@@ -734,7 +744,7 @@ public:
|
||||
|
||||
template <class _R, class _Alloc>
|
||||
void
|
||||
__assoc_state_alloc<_R&, _Alloc>::__on_zero_shared()
|
||||
__assoc_state_alloc<_R&, _Alloc>::__on_zero_shared() _NOEXCEPT
|
||||
{
|
||||
typename _Alloc::template rebind<__assoc_state_alloc>::other __a(__alloc_);
|
||||
this->~__assoc_state_alloc();
|
||||
@@ -748,7 +758,7 @@ class __assoc_sub_state_alloc
|
||||
typedef __assoc_sub_state base;
|
||||
_Alloc __alloc_;
|
||||
|
||||
virtual void __on_zero_shared();
|
||||
virtual void __on_zero_shared() _NOEXCEPT;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __assoc_sub_state_alloc(const _Alloc& __a)
|
||||
@@ -757,7 +767,7 @@ public:
|
||||
|
||||
template <class _Alloc>
|
||||
void
|
||||
__assoc_sub_state_alloc<_Alloc>::__on_zero_shared()
|
||||
__assoc_sub_state_alloc<_Alloc>::__on_zero_shared() _NOEXCEPT
|
||||
{
|
||||
this->~base();
|
||||
typename _Alloc::template rebind<__assoc_sub_state_alloc>::other __a(__alloc_);
|
||||
@@ -786,7 +796,7 @@ public:
|
||||
template <class _R, class _F>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__deferred_assoc_state<_R, _F>::__deferred_assoc_state(_F&& __f)
|
||||
: __func_(_STD::forward<_F>(__f))
|
||||
: __func_(_VSTD::forward<_F>(__f))
|
||||
{
|
||||
this->__set_deferred();
|
||||
}
|
||||
@@ -832,7 +842,7 @@ public:
|
||||
template <class _F>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__deferred_assoc_state<void, _F>::__deferred_assoc_state(_F&& __f)
|
||||
: __func_(_STD::forward<_F>(__f))
|
||||
: __func_(_VSTD::forward<_F>(__f))
|
||||
{
|
||||
this->__set_deferred();
|
||||
}
|
||||
@@ -858,9 +868,117 @@ __deferred_assoc_state<void, _F>::__execute()
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
|
||||
template <class> class promise;
|
||||
template <class> class shared_future;
|
||||
template <class> class atomic_future;
|
||||
template <class _R, class _F>
|
||||
class __async_assoc_state
|
||||
: public __assoc_state<_R>
|
||||
{
|
||||
typedef __assoc_state<_R> base;
|
||||
|
||||
_F __func_;
|
||||
|
||||
virtual void __on_zero_shared() _NOEXCEPT;
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
explicit __async_assoc_state(_F&& __f);
|
||||
#endif
|
||||
|
||||
virtual void __execute();
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _R, class _F>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__async_assoc_state<_R, _F>::__async_assoc_state(_F&& __f)
|
||||
: __func_(_VSTD::forward<_F>(__f))
|
||||
{
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _R, class _F>
|
||||
void
|
||||
__async_assoc_state<_R, _F>::__execute()
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
this->set_value(__func_());
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
this->set_exception(current_exception());
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
|
||||
template <class _R, class _F>
|
||||
void
|
||||
__async_assoc_state<_R, _F>::__on_zero_shared() _NOEXCEPT
|
||||
{
|
||||
this->wait();
|
||||
base::__on_zero_shared();
|
||||
}
|
||||
|
||||
template <class _F>
|
||||
class __async_assoc_state<void, _F>
|
||||
: public __assoc_sub_state
|
||||
{
|
||||
typedef __assoc_sub_state base;
|
||||
|
||||
_F __func_;
|
||||
|
||||
virtual void __on_zero_shared() _NOEXCEPT;
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
explicit __async_assoc_state(_F&& __f);
|
||||
#endif
|
||||
|
||||
virtual void __execute();
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _F>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__async_assoc_state<void, _F>::__async_assoc_state(_F&& __f)
|
||||
: __func_(_VSTD::forward<_F>(__f))
|
||||
{
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _F>
|
||||
void
|
||||
__async_assoc_state<void, _F>::__execute()
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__func_();
|
||||
this->set_value();
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
this->set_exception(current_exception());
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
|
||||
template <class _F>
|
||||
void
|
||||
__async_assoc_state<void, _F>::__on_zero_shared() _NOEXCEPT
|
||||
{
|
||||
this->wait();
|
||||
base::__on_zero_shared();
|
||||
}
|
||||
|
||||
template <class _R> class promise;
|
||||
template <class _R> class shared_future;
|
||||
|
||||
// future
|
||||
|
||||
@@ -874,6 +992,14 @@ __make_deferred_assoc_state(_F&& __f);
|
||||
__make_deferred_assoc_state(_F __f);
|
||||
#endif
|
||||
|
||||
template <class _R, class _F>
|
||||
future<_R>
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__make_async_assoc_state(_F&& __f);
|
||||
#else
|
||||
__make_async_assoc_state(_F __f);
|
||||
#endif
|
||||
|
||||
template <class _R>
|
||||
class _LIBCPP_VISIBLE future
|
||||
{
|
||||
@@ -883,13 +1009,17 @@ class _LIBCPP_VISIBLE future
|
||||
|
||||
template <class> friend class promise;
|
||||
template <class> friend class shared_future;
|
||||
template <class> friend class atomic_future;
|
||||
|
||||
template <class _R1, class _F>
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _R1, class _F>
|
||||
friend future<_R1> __make_deferred_assoc_state(_F&& __f);
|
||||
template <class _R1, class _F>
|
||||
friend future<_R1> __make_async_assoc_state(_F&& __f);
|
||||
#else
|
||||
template <class _R1, class _F>
|
||||
friend future<_R1> __make_deferred_assoc_state(_F __f);
|
||||
template <class _R1, class _F>
|
||||
friend future<_R1> __make_async_assoc_state(_F __f);
|
||||
#endif
|
||||
|
||||
public:
|
||||
@@ -920,7 +1050,7 @@ public:
|
||||
_R get();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(future& __rhs) {_STD::swap(__state_, __rhs.__state_);}
|
||||
void swap(future& __rhs) {_VSTD::swap(__state_, __rhs.__state_);}
|
||||
|
||||
// functions to check state
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -944,8 +1074,10 @@ template <class _R>
|
||||
future<_R>::future(__assoc_state<_R>* __state)
|
||||
: __state_(__state)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_->__has_future_attached())
|
||||
throw future_error(make_error_code(future_errc::future_already_retrieved));
|
||||
#endif
|
||||
__state_->__add_shared();
|
||||
__state_->__set_future_attached();
|
||||
}
|
||||
@@ -981,13 +1113,17 @@ class _LIBCPP_VISIBLE future<_R&>
|
||||
|
||||
template <class> friend class promise;
|
||||
template <class> friend class shared_future;
|
||||
template <class> friend class atomic_future;
|
||||
|
||||
template <class _R1, class _F>
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _R1, class _F>
|
||||
friend future<_R1> __make_deferred_assoc_state(_F&& __f);
|
||||
template <class _R1, class _F>
|
||||
friend future<_R1> __make_async_assoc_state(_F&& __f);
|
||||
#else
|
||||
template <class _R1, class _F>
|
||||
friend future<_R1> __make_deferred_assoc_state(_F __f);
|
||||
template <class _R1, class _F>
|
||||
friend future<_R1> __make_async_assoc_state(_F __f);
|
||||
#endif
|
||||
|
||||
public:
|
||||
@@ -1018,7 +1154,7 @@ public:
|
||||
_R& get();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(future& __rhs) {_STD::swap(__state_, __rhs.__state_);}
|
||||
void swap(future& __rhs) {_VSTD::swap(__state_, __rhs.__state_);}
|
||||
|
||||
// functions to check state
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1042,8 +1178,10 @@ template <class _R>
|
||||
future<_R&>::future(__assoc_state<_R&>* __state)
|
||||
: __state_(__state)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_->__has_future_attached())
|
||||
throw future_error(make_error_code(future_errc::future_already_retrieved));
|
||||
#endif
|
||||
__state_->__add_shared();
|
||||
__state_->__set_future_attached();
|
||||
}
|
||||
@@ -1074,13 +1212,17 @@ class _LIBCPP_VISIBLE future<void>
|
||||
|
||||
template <class> friend class promise;
|
||||
template <class> friend class shared_future;
|
||||
template <class> friend class atomic_future;
|
||||
|
||||
template <class _R1, class _F>
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _R1, class _F>
|
||||
friend future<_R1> __make_deferred_assoc_state(_F&& __f);
|
||||
template <class _R1, class _F>
|
||||
friend future<_R1> __make_async_assoc_state(_F&& __f);
|
||||
#else
|
||||
template <class _R1, class _F>
|
||||
friend future<_R1> __make_deferred_assoc_state(_F __f);
|
||||
template <class _R1, class _F>
|
||||
friend future<_R1> __make_async_assoc_state(_F __f);
|
||||
#endif
|
||||
|
||||
public:
|
||||
@@ -1111,7 +1253,7 @@ public:
|
||||
void get();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(future& __rhs) {_STD::swap(__state_, __rhs.__state_);}
|
||||
void swap(future& __rhs) {_VSTD::swap(__state_, __rhs.__state_);}
|
||||
|
||||
// functions to check state
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1141,7 +1283,7 @@ swap(future<_R>& __x, future<_R>& __y)
|
||||
|
||||
// promise<R>
|
||||
|
||||
template <class> class packaged_task;
|
||||
template <class _Callable> class packaged_task;
|
||||
|
||||
template <class _R>
|
||||
class _LIBCPP_VISIBLE promise
|
||||
@@ -1183,7 +1325,7 @@ private:
|
||||
public:
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(promise& __rhs) {_STD::swap(__state_, __rhs.__state_);}
|
||||
void swap(promise& __rhs) {_VSTD::swap(__state_, __rhs.__state_);}
|
||||
|
||||
// retrieving the result
|
||||
future<_R> get_future();
|
||||
@@ -1238,8 +1380,10 @@ template <class _R>
|
||||
future<_R>
|
||||
promise<_R>::get_future()
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
return future<_R>(__state_);
|
||||
}
|
||||
|
||||
@@ -1247,8 +1391,10 @@ template <class _R>
|
||||
void
|
||||
promise<_R>::set_value(const _R& __r)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_value(__r);
|
||||
}
|
||||
|
||||
@@ -1258,9 +1404,11 @@ template <class _R>
|
||||
void
|
||||
promise<_R>::set_value(_R&& __r)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
__state_->set_value(_STD::move(__r));
|
||||
#endif
|
||||
__state_->set_value(_VSTD::move(__r));
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -1269,8 +1417,10 @@ template <class _R>
|
||||
void
|
||||
promise<_R>::set_exception(exception_ptr __p)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_exception(__p);
|
||||
}
|
||||
|
||||
@@ -1278,8 +1428,10 @@ template <class _R>
|
||||
void
|
||||
promise<_R>::set_value_at_thread_exit(const _R& __r)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_value_at_thread_exit(__r);
|
||||
}
|
||||
|
||||
@@ -1289,9 +1441,11 @@ template <class _R>
|
||||
void
|
||||
promise<_R>::set_value_at_thread_exit(_R&& __r)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
__state_->set_value_at_thread_exit(_STD::move(__r));
|
||||
#endif
|
||||
__state_->set_value_at_thread_exit(_VSTD::move(__r));
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -1300,8 +1454,10 @@ template <class _R>
|
||||
void
|
||||
promise<_R>::set_exception_at_thread_exit(exception_ptr __p)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_exception_at_thread_exit(__p);
|
||||
}
|
||||
|
||||
@@ -1348,7 +1504,7 @@ private:
|
||||
public:
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(promise& __rhs) {_STD::swap(__state_, __rhs.__state_);}
|
||||
void swap(promise& __rhs) {_VSTD::swap(__state_, __rhs.__state_);}
|
||||
|
||||
// retrieving the result
|
||||
future<_R&> get_future();
|
||||
@@ -1397,8 +1553,10 @@ template <class _R>
|
||||
future<_R&>
|
||||
promise<_R&>::get_future()
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
return future<_R&>(__state_);
|
||||
}
|
||||
|
||||
@@ -1406,8 +1564,10 @@ template <class _R>
|
||||
void
|
||||
promise<_R&>::set_value(_R& __r)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_value(__r);
|
||||
}
|
||||
|
||||
@@ -1415,8 +1575,10 @@ template <class _R>
|
||||
void
|
||||
promise<_R&>::set_exception(exception_ptr __p)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_exception(__p);
|
||||
}
|
||||
|
||||
@@ -1424,8 +1586,10 @@ template <class _R>
|
||||
void
|
||||
promise<_R&>::set_value_at_thread_exit(_R& __r)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_value_at_thread_exit(__r);
|
||||
}
|
||||
|
||||
@@ -1433,8 +1597,10 @@ template <class _R>
|
||||
void
|
||||
promise<_R&>::set_exception_at_thread_exit(exception_ptr __p)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_exception_at_thread_exit(__p);
|
||||
}
|
||||
|
||||
@@ -1481,7 +1647,7 @@ private:
|
||||
public:
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(promise& __rhs) {_STD::swap(__state_, __rhs.__state_);}
|
||||
void swap(promise& __rhs) {_VSTD::swap(__state_, __rhs.__state_);}
|
||||
|
||||
// retrieving the result
|
||||
future<void> get_future();
|
||||
@@ -1551,13 +1717,13 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __packaged_task_func(const _F& __f) : __f_(__f) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __packaged_task_func(_F&& __f) : __f_(_STD::move(__f)) {}
|
||||
explicit __packaged_task_func(_F&& __f) : __f_(_VSTD::move(__f)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__packaged_task_func(const _F& __f, const _Alloc& __a)
|
||||
: __f_(__f, __a) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__packaged_task_func(_F&& __f, const _Alloc& __a)
|
||||
: __f_(_STD::move(__f), __a) {}
|
||||
: __f_(_VSTD::move(__f), __a) {}
|
||||
virtual void __move_to(__packaged_task_base<_R(_ArgTypes...)>*);
|
||||
virtual void destroy();
|
||||
virtual void destroy_deallocate();
|
||||
@@ -1569,7 +1735,7 @@ void
|
||||
__packaged_task_func<_F, _Alloc, _R(_ArgTypes...)>::__move_to(
|
||||
__packaged_task_base<_R(_ArgTypes...)>* __p)
|
||||
{
|
||||
::new (__p) __packaged_task_func(_STD::move(__f_.first()), _STD::move(__f_.second()));
|
||||
::new (__p) __packaged_task_func(_VSTD::move(__f_.first()), _VSTD::move(__f_.second()));
|
||||
}
|
||||
|
||||
template<class _F, class _Alloc, class _R, class ..._ArgTypes>
|
||||
@@ -1593,10 +1759,10 @@ template<class _F, class _Alloc, class _R, class ..._ArgTypes>
|
||||
_R
|
||||
__packaged_task_func<_F, _Alloc, _R(_ArgTypes...)>::operator()(_ArgTypes&& ... __arg)
|
||||
{
|
||||
return __invoke(__f_.first(), _STD::forward<_ArgTypes>(__arg)...);
|
||||
return __invoke(__f_.first(), _VSTD::forward<_ArgTypes>(__arg)...);
|
||||
}
|
||||
|
||||
template <class> class __packaged_task_function;
|
||||
template <class _Callable> class __packaged_task_function;
|
||||
|
||||
template<class _R, class ..._ArgTypes>
|
||||
class __packaged_task_function<_R(_ArgTypes...)>
|
||||
@@ -1656,7 +1822,7 @@ __packaged_task_function<_R(_ArgTypes...)>::__packaged_task_function(_F&& __f)
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(_STD::forward<_F>(__f));
|
||||
::new (__f_) _FF(_VSTD::forward<_F>(__f));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1664,7 +1830,7 @@ __packaged_task_function<_R(_ArgTypes...)>::__packaged_task_function(_F&& __f)
|
||||
_A __a;
|
||||
typedef __allocator_destructor<_A> _D;
|
||||
unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1));
|
||||
::new (__hold.get()) _FF(_STD::forward<_F>(__f), allocator<_FR>(__a));
|
||||
::new (__hold.get()) _FF(_VSTD::forward<_F>(__f), allocator<_FR>(__a));
|
||||
__f_ = __hold.release();
|
||||
}
|
||||
}
|
||||
@@ -1681,7 +1847,7 @@ __packaged_task_function<_R(_ArgTypes...)>::__packaged_task_function(
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(_STD::forward<_F>(__f));
|
||||
::new (__f_) _FF(_VSTD::forward<_F>(__f));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1695,7 +1861,7 @@ __packaged_task_function<_R(_ArgTypes...)>::__packaged_task_function(
|
||||
_A __a(__a0);
|
||||
typedef __allocator_destructor<_A> _D;
|
||||
unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1));
|
||||
::new (__hold.get()) _FF(_STD::forward<_F>(__f), _Alloc(__a));
|
||||
::new (__hold.get()) _FF(_VSTD::forward<_F>(__f), _Alloc(__a));
|
||||
__f_ = __hold.release();
|
||||
}
|
||||
}
|
||||
@@ -1766,7 +1932,7 @@ __packaged_task_function<_R(_ArgTypes...)>::swap(__packaged_task_function& __f)
|
||||
__f_ = (__base*)&__buf_;
|
||||
}
|
||||
else
|
||||
_STD::swap(__f_, __f.__f_);
|
||||
_VSTD::swap(__f_, __f.__f_);
|
||||
}
|
||||
|
||||
template<class _R, class ..._ArgTypes>
|
||||
@@ -1774,7 +1940,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
_R
|
||||
__packaged_task_function<_R(_ArgTypes...)>::operator()(_ArgTypes... __arg) const
|
||||
{
|
||||
return (*__f_)(_STD::forward<_ArgTypes>(__arg)...);
|
||||
return (*__f_)(_VSTD::forward<_ArgTypes>(__arg)...);
|
||||
}
|
||||
|
||||
template<class _R, class ..._ArgTypes>
|
||||
@@ -1793,11 +1959,11 @@ public:
|
||||
packaged_task() : __p_(nullptr) {}
|
||||
template <class _F>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit packaged_task(_F&& __f) : __f_(_STD::forward<_F>(__f)) {}
|
||||
explicit packaged_task(_F&& __f) : __f_(_VSTD::forward<_F>(__f)) {}
|
||||
template <class _F, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit packaged_task(allocator_arg_t, const _Allocator& __a, _F&& __f)
|
||||
: __f_(allocator_arg, __a, _STD::forward<_F>(__f)),
|
||||
: __f_(allocator_arg, __a, _VSTD::forward<_F>(__f)),
|
||||
__p_(allocator_arg, __a) {}
|
||||
// ~packaged_task() = default;
|
||||
|
||||
@@ -1808,12 +1974,12 @@ public:
|
||||
// move support
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
packaged_task(packaged_task&& __other)
|
||||
: __f_(_STD::move(__other.__f_)), __p_(_STD::move(__other.__p_)) {}
|
||||
: __f_(_VSTD::move(__other.__f_)), __p_(_VSTD::move(__other.__p_)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
packaged_task& operator=(packaged_task&& __other)
|
||||
{
|
||||
__f_ = _STD::move(__other.__f_);
|
||||
__p_ = _STD::move(__other.__p_);
|
||||
__f_ = _VSTD::move(__other.__f_);
|
||||
__p_ = _VSTD::move(__other.__p_);
|
||||
return *this;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1849,7 +2015,7 @@ packaged_task<_R(_ArgTypes...)>::operator()(_ArgTypes... __args)
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__p_.set_value(__f_(_STD::forward<_ArgTypes>(__args)...));
|
||||
__p_.set_value(__f_(_VSTD::forward<_ArgTypes>(__args)...));
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
@@ -1871,7 +2037,7 @@ packaged_task<_R(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args)
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__p_.set_value_at_thread_exit(__f_(_STD::forward<_ArgTypes>(__args)...));
|
||||
__p_.set_value_at_thread_exit(__f_(_VSTD::forward<_ArgTypes>(__args)...));
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
@@ -1908,11 +2074,11 @@ public:
|
||||
packaged_task() : __p_(nullptr) {}
|
||||
template <class _F>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit packaged_task(_F&& __f) : __f_(_STD::forward<_F>(__f)) {}
|
||||
explicit packaged_task(_F&& __f) : __f_(_VSTD::forward<_F>(__f)) {}
|
||||
template <class _F, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit packaged_task(allocator_arg_t, const _Allocator& __a, _F&& __f)
|
||||
: __f_(allocator_arg, __a, _STD::forward<_F>(__f)),
|
||||
: __f_(allocator_arg, __a, _VSTD::forward<_F>(__f)),
|
||||
__p_(allocator_arg, __a) {}
|
||||
// ~packaged_task() = default;
|
||||
|
||||
@@ -1923,12 +2089,12 @@ public:
|
||||
// move support
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
packaged_task(packaged_task&& __other)
|
||||
: __f_(_STD::move(__other.__f_)), __p_(_STD::move(__other.__p_)) {}
|
||||
: __f_(_VSTD::move(__other.__f_)), __p_(_VSTD::move(__other.__p_)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
packaged_task& operator=(packaged_task&& __other)
|
||||
{
|
||||
__f_ = _STD::move(__other.__f_);
|
||||
__p_ = _STD::move(__other.__p_);
|
||||
__f_ = _VSTD::move(__other.__f_);
|
||||
__p_ = _VSTD::move(__other.__p_);
|
||||
return *this;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1964,7 +2130,7 @@ packaged_task<void(_ArgTypes...)>::operator()(_ArgTypes... __args)
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__f_(_STD::forward<_ArgTypes>(__args)...);
|
||||
__f_(_VSTD::forward<_ArgTypes>(__args)...);
|
||||
__p_.set_value();
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
@@ -1987,7 +2153,7 @@ packaged_task<void(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__f_(_STD::forward<_ArgTypes>(__args)...);
|
||||
__f_(_VSTD::forward<_ArgTypes>(__args)...);
|
||||
__p_.set_value_at_thread_exit();
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
@@ -2030,40 +2196,76 @@ __make_deferred_assoc_state(_F __f)
|
||||
#endif
|
||||
{
|
||||
unique_ptr<__deferred_assoc_state<_R, _F>, __release_shared_count>
|
||||
__h(new __deferred_assoc_state<_R, _F>(_STD::forward<_F>(__f)));
|
||||
__h(new __deferred_assoc_state<_R, _F>(_VSTD::forward<_F>(__f)));
|
||||
return future<_R>(__h.get());
|
||||
}
|
||||
|
||||
template <class _R, class _F>
|
||||
future<_R>
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__make_async_assoc_state(_F&& __f)
|
||||
#else
|
||||
__make_async_assoc_state(_F __f)
|
||||
#endif
|
||||
{
|
||||
unique_ptr<__async_assoc_state<_R, _F>, __release_shared_count>
|
||||
__h(new __async_assoc_state<_R, _F>(_VSTD::forward<_F>(__f)));
|
||||
_VSTD::thread(&__async_assoc_state<_R, _F>::__execute, __h.get()).detach();
|
||||
return future<_R>(__h.get());
|
||||
}
|
||||
|
||||
template <class _F, class... _Args>
|
||||
future<typename result_of<_F(_Args...)>::type>
|
||||
class __async_func
|
||||
{
|
||||
tuple<_F, _Args...> __f_;
|
||||
|
||||
public:
|
||||
typedef typename __invoke_of<_F, _Args...>::type _R;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __async_func(_F&& __f, _Args&&... __args)
|
||||
: __f_(_VSTD::move(__f), _VSTD::move(__args)...) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__async_func(__async_func&& __f) : __f_(_VSTD::move(__f.__f_)) {}
|
||||
|
||||
_R operator()()
|
||||
{
|
||||
typedef typename __make_tuple_indices<1+sizeof...(_Args), 1>::type _Index;
|
||||
return __execute(_Index());
|
||||
}
|
||||
private:
|
||||
template <size_t ..._Indices>
|
||||
_R
|
||||
__execute(__tuple_indices<_Indices...>)
|
||||
{
|
||||
return __invoke(_VSTD::move(_VSTD::get<0>(__f_)), _VSTD::move(_VSTD::get<_Indices>(__f_))...);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _F, class... _Args>
|
||||
future<typename __invoke_of<typename decay<_F>::type, typename decay<_Args>::type...>::type>
|
||||
async(launch __policy, _F&& __f, _Args&&... __args)
|
||||
{
|
||||
typedef typename result_of<_F(_Args...)>::type _R;
|
||||
typedef __async_func<typename decay<_F>::type, typename decay<_Args>::type...> _BF;
|
||||
typedef typename _BF::_R _R;
|
||||
future<_R> __r;
|
||||
if (__policy & launch::async)
|
||||
{
|
||||
packaged_task<_R()> __pk(bind(_STD::forward<_F>(__f),
|
||||
_STD::forward<_Args>(__args)...));
|
||||
__r = __pk.get_future();
|
||||
thread(_STD::move(__pk)).detach();
|
||||
}
|
||||
__r = _VSTD::__make_async_assoc_state<_R>(_BF(__decay_copy(_VSTD::forward<_F>(__f)),
|
||||
__decay_copy(_VSTD::forward<_Args>(__args))...));
|
||||
else if (__policy & launch::deferred)
|
||||
__r = _STD::__make_deferred_assoc_state<_R>(bind(_STD::forward<_F>(__f),
|
||||
_STD::forward<_Args>(__args)...));
|
||||
__r = _VSTD::__make_deferred_assoc_state<_R>(_BF(__decay_copy(_VSTD::forward<_F>(__f)),
|
||||
__decay_copy(_VSTD::forward<_Args>(__args))...));
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _F, class... _Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
!is_same<typename decay<_F>::type, launch>::value,
|
||||
future<typename result_of<_F(_Args...)>::type>
|
||||
>::type
|
||||
future<typename __invoke_of<typename decay<_F>::type, typename decay<_Args>::type...>::type>
|
||||
async(_F&& __f, _Args&&... __args)
|
||||
{
|
||||
return async(launch::any, _STD::forward<_F>(__f),
|
||||
_STD::forward<_Args>(__args)...);
|
||||
return _VSTD::async(launch::any, _VSTD::forward<_F>(__f),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
@@ -2105,7 +2307,7 @@ public:
|
||||
const _R& get() const {return __state_->copy();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(shared_future& __rhs) {_STD::swap(__state_, __rhs.__state_);}
|
||||
void swap(shared_future& __rhs) {_VSTD::swap(__state_, __rhs.__state_);}
|
||||
|
||||
// functions to check state
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -2179,7 +2381,7 @@ public:
|
||||
_R& get() const {return __state_->copy();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(shared_future& __rhs) {_STD::swap(__state_, __rhs.__state_);}
|
||||
void swap(shared_future& __rhs) {_VSTD::swap(__state_, __rhs.__state_);}
|
||||
|
||||
// functions to check state
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -2253,7 +2455,7 @@ public:
|
||||
void get() const {__state_->copy();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(shared_future& __rhs) {_STD::swap(__state_, __rhs.__state_);}
|
||||
void swap(shared_future& __rhs) {_VSTD::swap(__state_, __rhs.__state_);}
|
||||
|
||||
// functions to check state
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -2286,7 +2488,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
shared_future<_R>
|
||||
future<_R>::share()
|
||||
{
|
||||
return shared_future<_R>(_STD::move(*this));
|
||||
return shared_future<_R>(_VSTD::move(*this));
|
||||
}
|
||||
|
||||
template <class _R>
|
||||
@@ -2294,7 +2496,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
shared_future<_R&>
|
||||
future<_R&>::share()
|
||||
{
|
||||
return shared_future<_R&>(_STD::move(*this));
|
||||
return shared_future<_R&>(_VSTD::move(*this));
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -2303,7 +2505,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
shared_future<void>
|
||||
future<void>::share()
|
||||
{
|
||||
return shared_future<void>(_STD::move(*this));
|
||||
return shared_future<void>(_VSTD::move(*this));
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
@@ -29,15 +29,15 @@ public:
|
||||
typedef const E* iterator;
|
||||
typedef const E* const_iterator;
|
||||
|
||||
initializer_list();
|
||||
initializer_list() noexcept;
|
||||
|
||||
size_t size() const;
|
||||
const E* begin() const;
|
||||
const E* end() const;
|
||||
size_t size() const noexcept;
|
||||
const E* begin() const noexcept;
|
||||
const E* end() const noexcept;
|
||||
};
|
||||
|
||||
template<class E> const E* begin(initializer_list<E> il);
|
||||
template<class E> const E* end(initializer_list<E> il);
|
||||
template<class E> const E* begin(initializer_list<E> il) noexcept;
|
||||
template<class E> const E* end(initializer_list<E> il) noexcept;
|
||||
|
||||
} // std
|
||||
|
||||
@@ -58,7 +58,7 @@ class _LIBCPP_VISIBLE initializer_list
|
||||
size_t __size_;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
initializer_list(const _E* __b, size_t __s)
|
||||
initializer_list(const _E* __b, size_t __s) _NOEXCEPT
|
||||
: __begin_(__b),
|
||||
__size_(__s)
|
||||
{}
|
||||
@@ -71,17 +71,17 @@ public:
|
||||
typedef const _E* iterator;
|
||||
typedef const _E* const_iterator;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE initializer_list() : __begin_(nullptr), __size_(0) {}
|
||||
_LIBCPP_ALWAYS_INLINE initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE size_t size() const {return __size_;}
|
||||
_LIBCPP_ALWAYS_INLINE const _E* begin() const {return __begin_;}
|
||||
_LIBCPP_ALWAYS_INLINE const _E* end() const {return __begin_ + __size_;}
|
||||
_LIBCPP_ALWAYS_INLINE size_t size() const _NOEXCEPT {return __size_;}
|
||||
_LIBCPP_ALWAYS_INLINE const _E* begin() const _NOEXCEPT {return __begin_;}
|
||||
_LIBCPP_ALWAYS_INLINE const _E* end() const _NOEXCEPT {return __begin_ + __size_;}
|
||||
};
|
||||
|
||||
template<class _E>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
const _E*
|
||||
begin(initializer_list<_E> __il)
|
||||
begin(initializer_list<_E> __il) _NOEXCEPT
|
||||
{
|
||||
return __il.begin();
|
||||
}
|
||||
@@ -89,7 +89,7 @@ begin(initializer_list<_E> __il)
|
||||
template<class _E>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
const _E*
|
||||
end(initializer_list<_E> __il)
|
||||
end(initializer_list<_E> __il) _NOEXCEPT
|
||||
{
|
||||
return __il.end();
|
||||
}
|
||||
|
||||
56
include/ios
56
include/ios
@@ -266,22 +266,22 @@ public:
|
||||
enum seekdir {beg, cur, end};
|
||||
typedef seekdir seek_dir;
|
||||
|
||||
typedef _STD::streamoff streamoff;
|
||||
typedef _STD::streampos streampos;
|
||||
typedef _VSTD::streamoff streamoff;
|
||||
typedef _VSTD::streampos streampos;
|
||||
|
||||
class Init;
|
||||
|
||||
// 27.5.2.2 fmtflags state:
|
||||
fmtflags flags() const;
|
||||
fmtflags flags(fmtflags __fmtfl);
|
||||
fmtflags setf(fmtflags __fmtfl);
|
||||
fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
|
||||
void unsetf(fmtflags __mask);
|
||||
_LIBCPP_INLINE_VISIBILITY fmtflags flags() const;
|
||||
_LIBCPP_INLINE_VISIBILITY fmtflags flags(fmtflags __fmtfl);
|
||||
_LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl);
|
||||
_LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
|
||||
_LIBCPP_INLINE_VISIBILITY void unsetf(fmtflags __mask);
|
||||
|
||||
streamsize precision() const;
|
||||
streamsize precision(streamsize __prec);
|
||||
streamsize width() const;
|
||||
streamsize width(streamsize __wide);
|
||||
_LIBCPP_INLINE_VISIBILITY streamsize precision() const;
|
||||
_LIBCPP_INLINE_VISIBILITY streamsize precision(streamsize __prec);
|
||||
_LIBCPP_INLINE_VISIBILITY streamsize width() const;
|
||||
_LIBCPP_INLINE_VISIBILITY streamsize width(streamsize __wide);
|
||||
|
||||
// 27.5.2.3 locales:
|
||||
locale imbue(const locale& __loc);
|
||||
@@ -307,17 +307,17 @@ private:
|
||||
public:
|
||||
static bool sync_with_stdio(bool __sync = true);
|
||||
|
||||
iostate rdstate() const;
|
||||
_LIBCPP_INLINE_VISIBILITY iostate rdstate() const;
|
||||
void clear(iostate __state = goodbit);
|
||||
void setstate(iostate __state);
|
||||
_LIBCPP_INLINE_VISIBILITY void setstate(iostate __state);
|
||||
|
||||
bool good() const;
|
||||
bool eof() const;
|
||||
bool fail() const;
|
||||
bool bad() const;
|
||||
_LIBCPP_INLINE_VISIBILITY bool good() const;
|
||||
_LIBCPP_INLINE_VISIBILITY bool eof() const;
|
||||
_LIBCPP_INLINE_VISIBILITY bool fail() const;
|
||||
_LIBCPP_INLINE_VISIBILITY bool bad() const;
|
||||
|
||||
iostate exceptions() const;
|
||||
void exceptions(iostate __except);
|
||||
_LIBCPP_INLINE_VISIBILITY iostate exceptions() const;
|
||||
_LIBCPP_INLINE_VISIBILITY void exceptions(iostate __except);
|
||||
|
||||
void __set_badbit_and_consider_rethrow();
|
||||
void __set_failbit_and_consider_rethrow();
|
||||
@@ -587,38 +587,52 @@ public:
|
||||
_LIBCPP_ALWAYS_INLINE void exceptions(iostate __except) {ios_base::exceptions(__except);}
|
||||
|
||||
// 27.5.4.1 Constructor/destructor:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_ios(basic_streambuf<char_type,traits_type>* __sb);
|
||||
virtual ~basic_ios();
|
||||
|
||||
// 27.5.4.2 Members:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<char_type, traits_type>* tie() const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_streambuf<char_type, traits_type>* rdbuf() const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb);
|
||||
|
||||
basic_ios& copyfmt(const basic_ios& __rhs);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char_type fill() const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char_type fill(char_type __ch);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
locale imbue(const locale& __loc);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char narrow(char_type __c, char __dfault) const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char_type widen(char __c) const;
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
basic_ios() {// purposefully does no initialization
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void init(basic_streambuf<char_type, traits_type>* __sb);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void move(basic_ios& __rhs);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
void move(basic_ios&& __rhs) {move(__rhs);}
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(basic_ios& __rhs);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
|
||||
private:
|
||||
basic_ostream<char_type, traits_type>* __tie_;
|
||||
@@ -762,8 +776,8 @@ void
|
||||
basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs)
|
||||
{
|
||||
ios_base::swap(__rhs);
|
||||
_STD::swap(__tie_, __rhs.__tie_);
|
||||
_STD::swap(__fill_, __rhs.__fill_);
|
||||
_VSTD::swap(__tie_, __rhs.__tie_);
|
||||
_VSTD::swap(__fill_, __rhs.__fill_);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace std
|
||||
template<class charT> struct char_traits;
|
||||
template<class T> class allocator;
|
||||
|
||||
class ios_base;
|
||||
template <class charT, class traits = char_traits<charT> > class basic_ios;
|
||||
|
||||
template <class charT, class traits = char_traits<charT> > class basic_streambuf;
|
||||
@@ -92,6 +93,8 @@ typedef fpos<char_traits<wchar_t>::state_type> wstreampos;
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class ios_base;
|
||||
|
||||
template<class _CharT> struct _LIBCPP_VISIBLE char_traits;
|
||||
template<class _Tp> class _LIBCPP_VISIBLE allocator;
|
||||
|
||||
|
||||
@@ -177,11 +177,13 @@ public:
|
||||
virtual ~basic_istream();
|
||||
protected:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_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);
|
||||
@@ -321,7 +323,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
basic_istream<_CharT, _Traits>::swap(basic_istream& __rhs)
|
||||
{
|
||||
_STD::swap(__gc_, __rhs.__gc_);
|
||||
_VSTD::swap(__gc_, __rhs.__gc_);
|
||||
basic_ios<char_type, traits_type>::swap(__rhs);
|
||||
}
|
||||
|
||||
@@ -801,6 +803,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
|
||||
typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
|
||||
if (__sen)
|
||||
{
|
||||
#if 1
|
||||
typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
|
||||
if (_Traits::eq_int_type(__i, _Traits::eof()))
|
||||
__is.setstate(ios_base::eofbit | ios_base::failbit);
|
||||
else
|
||||
__c = _Traits::to_char_type(__i);
|
||||
#else
|
||||
typedef istreambuf_iterator<_CharT, _Traits> _I;
|
||||
_I __i(__is);
|
||||
_I __eof;
|
||||
@@ -812,6 +821,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
|
||||
}
|
||||
else
|
||||
__is.setstate(ios_base::eofbit | ios_base::failbit);
|
||||
#endif
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
@@ -1265,7 +1275,7 @@ basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
__c = min(__c, __n);
|
||||
__c = _VSTD::min(__c, __n);
|
||||
for (streamsize __k = 0; __k < __c; ++__k, ++__s, ++__i)
|
||||
*__s = *__i;
|
||||
}
|
||||
@@ -1496,11 +1506,13 @@ public:
|
||||
virtual ~basic_iostream();
|
||||
protected:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_iostream(basic_iostream&& __rhs);
|
||||
#endif
|
||||
|
||||
// assign/swap
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_iostream& operator=(basic_iostream&& __rhs);
|
||||
#endif
|
||||
void swap(basic_iostream& __rhs);
|
||||
@@ -1519,7 +1531,7 @@ basic_iostream<_CharT, _Traits>::basic_iostream(basic_streambuf<char_type, trait
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_iostream<_CharT, _Traits>::basic_iostream(basic_iostream&& __rhs)
|
||||
: basic_istream<_CharT, _Traits>(_STD::move(__rhs))
|
||||
: basic_istream<_CharT, _Traits>(_VSTD::move(__rhs))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
101
include/iterator
101
include/iterator
@@ -488,7 +488,7 @@ next(_ForwardIter __x,
|
||||
typename iterator_traits<_ForwardIter>::difference_type __n = 1,
|
||||
typename enable_if<__is_forward_iterator<_ForwardIter>::value>::type* = 0)
|
||||
{
|
||||
advance(__x, __n);
|
||||
_VSTD::advance(__x, __n);
|
||||
return __x;
|
||||
}
|
||||
|
||||
@@ -499,7 +499,7 @@ prev(_BidiretionalIter __x,
|
||||
typename iterator_traits<_BidiretionalIter>::difference_type __n = 1,
|
||||
typename enable_if<__is_bidirectional_iterator<_BidiretionalIter>::value>::type* = 0)
|
||||
{
|
||||
advance(__x, -__n);
|
||||
_VSTD::advance(__x, -__n);
|
||||
return __x;
|
||||
}
|
||||
|
||||
@@ -628,7 +628,7 @@ public:
|
||||
{container->push_back(__value); return *this;}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value)
|
||||
{container->push_back(_STD::move(__value)); return *this;}
|
||||
{container->push_back(_VSTD::move(__value)); return *this;}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator*() {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator++() {return *this;}
|
||||
@@ -661,7 +661,7 @@ public:
|
||||
{container->push_front(__value); return *this;}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value)
|
||||
{container->push_front(_STD::move(__value)); return *this;}
|
||||
{container->push_front(_VSTD::move(__value)); return *this;}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator*() {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator++() {return *this;}
|
||||
@@ -696,7 +696,7 @@ public:
|
||||
{iter = container->insert(iter, __value); ++iter; return *this;}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value)
|
||||
{iter = container->insert(iter, _STD::move(__value)); ++iter; return *this;}
|
||||
{iter = container->insert(iter, _VSTD::move(__value)); ++iter; return *this;}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator*() {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator++() {return *this;}
|
||||
@@ -902,8 +902,13 @@ public:
|
||||
template <class _Up> _LIBCPP_INLINE_VISIBILITY move_iterator(const move_iterator<_Up>& __u)
|
||||
: __i(__u.base()) {}
|
||||
_LIBCPP_INLINE_VISIBILITY _Iter base() const {return __i;}
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return *__i;}
|
||||
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &(operator*());}
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const {
|
||||
return static_cast<reference>(*__i);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {
|
||||
typename iterator_traits<iterator_type>::reference __ref = *__i;
|
||||
return &__ref;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY move_iterator& operator++() {++__i; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY move_iterator operator++(int)
|
||||
{move_iterator __tmp(*this); ++__i; return __tmp;}
|
||||
@@ -919,7 +924,9 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY move_iterator& operator-=(difference_type __n)
|
||||
{__i -= __n; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const
|
||||
{return __i[__n];}
|
||||
{
|
||||
return static_cast<reference>(__i[__n]);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
@@ -1000,35 +1007,35 @@ template <class _Iter> class __wrap_iter;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
bool
|
||||
operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
|
||||
operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
bool
|
||||
operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
|
||||
operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
bool
|
||||
operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
|
||||
operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
bool
|
||||
operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
|
||||
operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
bool
|
||||
operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
|
||||
operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
bool
|
||||
operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
|
||||
operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
typename __wrap_iter<_Iter1>::difference_type
|
||||
operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
|
||||
operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
|
||||
|
||||
template <class _Iter>
|
||||
__wrap_iter<_Iter>
|
||||
operator+(typename __wrap_iter<_Iter>::difference_type, const __wrap_iter<_Iter>&);
|
||||
operator+(typename __wrap_iter<_Iter>::difference_type, const __wrap_iter<_Iter>&) _NOEXCEPT;
|
||||
|
||||
template <class _I, class _O> _O copy(_I, _I, _O);
|
||||
template <class _B1, class _B2> _B2 copy_backward(_B1, _B1, _B2);
|
||||
@@ -1056,33 +1063,33 @@ public:
|
||||
private:
|
||||
iterator_type __i;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter() _NOEXCEPT {}
|
||||
template <class _Up> _LIBCPP_INLINE_VISIBILITY __wrap_iter(const __wrap_iter<_Up>& __u,
|
||||
typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0)
|
||||
typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0) _NOEXCEPT
|
||||
: __i(__u.base()) {}
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return *__i;}
|
||||
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &(operator*());}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator++() {++__i; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator++(int)
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT {return *__i;}
|
||||
_LIBCPP_INLINE_VISIBILITY pointer operator->() const _NOEXCEPT {return &(operator*());}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator++() _NOEXCEPT {++__i; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator++(int) _NOEXCEPT
|
||||
{__wrap_iter __tmp(*this); ++__i; return __tmp;}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator--() {--__i; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator--(int)
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator--() _NOEXCEPT {--__i; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator--(int) _NOEXCEPT
|
||||
{__wrap_iter __tmp(*this); --__i; return __tmp;}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator+ (difference_type __n) const
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator+ (difference_type __n) const _NOEXCEPT
|
||||
{return __wrap_iter(__i + __n);}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator+=(difference_type __n)
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator+=(difference_type __n) _NOEXCEPT
|
||||
{__i += __n; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator- (difference_type __n) const
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator- (difference_type __n) const _NOEXCEPT
|
||||
{return __wrap_iter(__i - __n);}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator-=(difference_type __n)
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator-=(difference_type __n) _NOEXCEPT
|
||||
{__i -= __n; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const _NOEXCEPT
|
||||
{return __i[__n];}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY iterator_type base() const {return __i;}
|
||||
_LIBCPP_INLINE_VISIBILITY iterator_type base() const _NOEXCEPT {return __i;}
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) : __i(__x) {}
|
||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {}
|
||||
|
||||
template <class _Up> friend class __wrap_iter;
|
||||
template <class _CharT, class _Traits, class _Alloc> friend class basic_string;
|
||||
@@ -1091,42 +1098,42 @@ private:
|
||||
template <class _Iter1, class _Iter2>
|
||||
friend
|
||||
bool
|
||||
operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
|
||||
operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
friend
|
||||
bool
|
||||
operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
|
||||
operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
friend
|
||||
bool
|
||||
operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
|
||||
operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
friend
|
||||
bool
|
||||
operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
|
||||
operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
friend
|
||||
bool
|
||||
operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
|
||||
operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
friend
|
||||
bool
|
||||
operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
|
||||
operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
friend
|
||||
typename __wrap_iter<_Iter1>::difference_type
|
||||
operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
|
||||
operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
|
||||
|
||||
template <class _Iter1>
|
||||
friend
|
||||
__wrap_iter<_Iter1>
|
||||
operator+(typename __wrap_iter<_Iter1>::difference_type, const __wrap_iter<_Iter1>&);
|
||||
operator+(typename __wrap_iter<_Iter1>::difference_type, const __wrap_iter<_Iter1>&) _NOEXCEPT;
|
||||
|
||||
template <class _I, class _O> friend _O copy(_I, _I, _O);
|
||||
template <class _B1, class _B2> friend _B2 copy_backward(_B1, _B1, _B2);
|
||||
@@ -1146,7 +1153,7 @@ private:
|
||||
template <class _Iter1, class _Iter2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
|
||||
operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
|
||||
{
|
||||
return __x.base() == __y.base();
|
||||
}
|
||||
@@ -1154,7 +1161,7 @@ operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
|
||||
template <class _Iter1, class _Iter2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
|
||||
operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
|
||||
{
|
||||
return __x.base() < __y.base();
|
||||
}
|
||||
@@ -1162,7 +1169,7 @@ operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
|
||||
template <class _Iter1, class _Iter2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
|
||||
operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
|
||||
{
|
||||
return __x.base() != __y.base();
|
||||
}
|
||||
@@ -1170,7 +1177,7 @@ operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
|
||||
template <class _Iter1, class _Iter2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
|
||||
operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
|
||||
{
|
||||
return __x.base() > __y.base();
|
||||
}
|
||||
@@ -1178,7 +1185,7 @@ operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
|
||||
template <class _Iter1, class _Iter2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
|
||||
operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
|
||||
{
|
||||
return __x.base() >= __y.base();
|
||||
}
|
||||
@@ -1186,7 +1193,7 @@ operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
|
||||
template <class _Iter1, class _Iter2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
|
||||
operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
|
||||
{
|
||||
return __x.base() <= __y.base();
|
||||
}
|
||||
@@ -1194,7 +1201,7 @@ operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
|
||||
template <class _Iter1, class _Iter2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename __wrap_iter<_Iter1>::difference_type
|
||||
operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
|
||||
operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
|
||||
{
|
||||
return __x.base() - __y.base();
|
||||
}
|
||||
@@ -1203,7 +1210,7 @@ template <class _Iter>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__wrap_iter<_Iter>
|
||||
operator+(typename __wrap_iter<_Iter>::difference_type __n,
|
||||
const __wrap_iter<_Iter>& __x)
|
||||
const __wrap_iter<_Iter>& __x) _NOEXCEPT
|
||||
{
|
||||
return __wrap_iter<_Iter>(__x.base() + __n);
|
||||
}
|
||||
|
||||
198
include/limits
198
include/limits
@@ -22,9 +22,9 @@ class numeric_limits
|
||||
{
|
||||
public:
|
||||
static const bool is_specialized = false;
|
||||
static T min() throw();
|
||||
static T max() throw();
|
||||
static T lowest() throw();
|
||||
static T min() noexcept;
|
||||
static T max() noexcept;
|
||||
static T lowest() noexcept;
|
||||
|
||||
static const int digits = 0;
|
||||
static const int digits10 = 0;
|
||||
@@ -33,8 +33,8 @@ public:
|
||||
static const bool is_integer = false;
|
||||
static const bool is_exact = false;
|
||||
static const int radix = 0;
|
||||
static T epsilon() throw();
|
||||
static T round_error() throw();
|
||||
static T epsilon() noexcept;
|
||||
static T round_error() noexcept;
|
||||
|
||||
static const int min_exponent = 0;
|
||||
static const int min_exponent10 = 0;
|
||||
@@ -46,10 +46,10 @@ public:
|
||||
static const bool has_signaling_NaN = false;
|
||||
static const float_denorm_style has_denorm = denorm_absent;
|
||||
static const bool has_denorm_loss = false;
|
||||
static T infinity() throw();
|
||||
static T quiet_NaN() throw();
|
||||
static T signaling_NaN() throw();
|
||||
static T denorm_min() throw();
|
||||
static T infinity() noexcept;
|
||||
static T quiet_NaN() noexcept;
|
||||
static T signaling_NaN() noexcept;
|
||||
static T denorm_min() noexcept;
|
||||
|
||||
static const bool is_iec559 = false;
|
||||
static const bool is_bounded = false;
|
||||
@@ -132,9 +132,9 @@ protected:
|
||||
typedef _Tp type;
|
||||
|
||||
static const bool is_specialized = false;
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() throw() {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() throw() {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return type();}
|
||||
|
||||
static const int digits = 0;
|
||||
static const int digits10 = 0;
|
||||
@@ -143,8 +143,8 @@ protected:
|
||||
static const bool is_integer = false;
|
||||
static const bool is_exact = false;
|
||||
static const int radix = 0;
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return type();}
|
||||
|
||||
static const int min_exponent = 0;
|
||||
static const int min_exponent10 = 0;
|
||||
@@ -156,10 +156,10 @@ protected:
|
||||
static const bool has_signaling_NaN = false;
|
||||
static const float_denorm_style has_denorm = denorm_absent;
|
||||
static const bool has_denorm_loss = false;
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return type();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return type();}
|
||||
|
||||
static const bool is_iec559 = false;
|
||||
static const bool is_bounded = false;
|
||||
@@ -196,15 +196,15 @@ protected:
|
||||
static const int max_digits10 = 0;
|
||||
static const type __min = __libcpp_compute_min<type, digits, is_signed>::value;
|
||||
static const type __max = is_signed ? type(type(~0) ^ __min) : type(~0);
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() throw() {return __min;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() throw() {return __max;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return min();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __min;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __max;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return min();}
|
||||
|
||||
static const bool is_integer = true;
|
||||
static const bool is_exact = true;
|
||||
static const int radix = 2;
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return type(0);}
|
||||
|
||||
static const int min_exponent = 0;
|
||||
static const int min_exponent10 = 0;
|
||||
@@ -216,10 +216,10 @@ protected:
|
||||
static const bool has_signaling_NaN = false;
|
||||
static const float_denorm_style has_denorm = denorm_absent;
|
||||
static const bool has_denorm_loss = false;
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return type(0);}
|
||||
|
||||
static const bool is_iec559 = false;
|
||||
static const bool is_bounded = true;
|
||||
@@ -248,15 +248,15 @@ protected:
|
||||
static const int max_digits10 = 0;
|
||||
static const type __min = false;
|
||||
static const type __max = true;
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() throw() {return __min;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() throw() {return __max;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return min();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __min;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __max;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return min();}
|
||||
|
||||
static const bool is_integer = true;
|
||||
static const bool is_exact = true;
|
||||
static const int radix = 2;
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return type(0);}
|
||||
|
||||
static const int min_exponent = 0;
|
||||
static const int min_exponent10 = 0;
|
||||
@@ -268,10 +268,10 @@ protected:
|
||||
static const bool has_signaling_NaN = false;
|
||||
static const float_denorm_style has_denorm = denorm_absent;
|
||||
static const bool has_denorm_loss = false;
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return type(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return type(0);}
|
||||
|
||||
static const bool is_iec559 = false;
|
||||
static const bool is_bounded = true;
|
||||
@@ -294,15 +294,15 @@ protected:
|
||||
static const int digits = __FLT_MANT_DIG__;
|
||||
static const int digits10 = __FLT_DIG__;
|
||||
static const int max_digits10 = 2+(digits * 30103)/100000;
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() throw() {return __FLT_MIN__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() throw() {return __FLT_MAX__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return -max();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __FLT_MIN__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __FLT_MAX__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return -max();}
|
||||
|
||||
static const bool is_integer = false;
|
||||
static const bool is_exact = false;
|
||||
static const int radix = __FLT_RADIX__;
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __FLT_EPSILON__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return 0.5F;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __FLT_EPSILON__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return 0.5F;}
|
||||
|
||||
static const int min_exponent = __FLT_MIN_EXP__;
|
||||
static const int min_exponent10 = __FLT_MIN_10_EXP__;
|
||||
@@ -314,10 +314,10 @@ protected:
|
||||
static const bool has_signaling_NaN = true;
|
||||
static const float_denorm_style has_denorm = denorm_present;
|
||||
static const bool has_denorm_loss = false;
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __builtin_huge_valf();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __builtin_nanf("");}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __builtin_nansf("");}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __FLT_DENORM_MIN__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __builtin_huge_valf();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __builtin_nanf("");}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __builtin_nansf("");}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __FLT_DENORM_MIN__;}
|
||||
|
||||
static const bool is_iec559 = true;
|
||||
static const bool is_bounded = true;
|
||||
@@ -340,15 +340,15 @@ protected:
|
||||
static const int digits = __DBL_MANT_DIG__;
|
||||
static const int digits10 = __DBL_DIG__;
|
||||
static const int max_digits10 = 2+(digits * 30103)/100000;
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() throw() {return __DBL_MIN__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() throw() {return __DBL_MAX__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return -max();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __DBL_MIN__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __DBL_MAX__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return -max();}
|
||||
|
||||
static const bool is_integer = false;
|
||||
static const bool is_exact = false;
|
||||
static const int radix = __FLT_RADIX__;
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __DBL_EPSILON__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return 0.5;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __DBL_EPSILON__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return 0.5;}
|
||||
|
||||
static const int min_exponent = __DBL_MIN_EXP__;
|
||||
static const int min_exponent10 = __DBL_MIN_10_EXP__;
|
||||
@@ -360,10 +360,10 @@ protected:
|
||||
static const bool has_signaling_NaN = true;
|
||||
static const float_denorm_style has_denorm = denorm_present;
|
||||
static const bool has_denorm_loss = false;
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __builtin_huge_val();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __builtin_nan("");}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __builtin_nans("");}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __DBL_DENORM_MIN__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __builtin_huge_val();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __builtin_nan("");}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __builtin_nans("");}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __DBL_DENORM_MIN__;}
|
||||
|
||||
static const bool is_iec559 = true;
|
||||
static const bool is_bounded = true;
|
||||
@@ -386,15 +386,15 @@ protected:
|
||||
static const int digits = __LDBL_MANT_DIG__;
|
||||
static const int digits10 = __LDBL_DIG__;
|
||||
static const int max_digits10 = 2+(digits * 30103)/100000;
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() throw() {return __LDBL_MIN__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() throw() {return __LDBL_MAX__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return -max();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __LDBL_MIN__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __LDBL_MAX__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return -max();}
|
||||
|
||||
static const bool is_integer = false;
|
||||
static const bool is_exact = false;
|
||||
static const int radix = __FLT_RADIX__;
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __LDBL_EPSILON__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return 0.5;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __LDBL_EPSILON__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return 0.5;}
|
||||
|
||||
static const int min_exponent = __LDBL_MIN_EXP__;
|
||||
static const int min_exponent10 = __LDBL_MIN_10_EXP__;
|
||||
@@ -406,10 +406,10 @@ protected:
|
||||
static const bool has_signaling_NaN = true;
|
||||
static const float_denorm_style has_denorm = denorm_present;
|
||||
static const bool has_denorm_loss = false;
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __builtin_huge_vall();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __builtin_nanl("");}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __builtin_nansl("");}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __LDBL_DENORM_MIN__;}
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __builtin_huge_vall();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __builtin_nanl("");}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
|
||||
|
||||
#if (defined(__ppc__) || defined(__ppc64__))
|
||||
static const bool is_iec559 = false;
|
||||
@@ -432,9 +432,9 @@ class _LIBCPP_VISIBLE numeric_limits
|
||||
typedef typename __base::type type;
|
||||
public:
|
||||
static const bool is_specialized = __base::is_specialized;
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() throw() {return __base::min();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() throw() {return __base::max();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return __base::lowest();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __base::min();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __base::max();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return __base::lowest();}
|
||||
|
||||
static const int digits = __base::digits;
|
||||
static const int digits10 = __base::digits10;
|
||||
@@ -443,8 +443,8 @@ public:
|
||||
static const bool is_integer = __base::is_integer;
|
||||
static const bool is_exact = __base::is_exact;
|
||||
static const int radix = __base::radix;
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __base::epsilon();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return __base::round_error();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __base::epsilon();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return __base::round_error();}
|
||||
|
||||
static const int min_exponent = __base::min_exponent;
|
||||
static const int min_exponent10 = __base::min_exponent10;
|
||||
@@ -456,10 +456,10 @@ public:
|
||||
static const bool has_signaling_NaN = __base::has_signaling_NaN;
|
||||
static const float_denorm_style has_denorm = __base::has_denorm;
|
||||
static const bool has_denorm_loss = __base::has_denorm_loss;
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __base::infinity();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __base::quiet_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __base::signaling_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __base::denorm_min();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __base::infinity();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __base::denorm_min();}
|
||||
|
||||
static const bool is_iec559 = __base::is_iec559;
|
||||
static const bool is_bounded = __base::is_bounded;
|
||||
@@ -478,9 +478,9 @@ class _LIBCPP_VISIBLE numeric_limits<const _Tp>
|
||||
typedef _Tp type;
|
||||
public:
|
||||
static const bool is_specialized = __base::is_specialized;
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() throw() {return __base::min();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() throw() {return __base::max();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return __base::lowest();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __base::min();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __base::max();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return __base::lowest();}
|
||||
|
||||
static const int digits = __base::digits;
|
||||
static const int digits10 = __base::digits10;
|
||||
@@ -489,8 +489,8 @@ public:
|
||||
static const bool is_integer = __base::is_integer;
|
||||
static const bool is_exact = __base::is_exact;
|
||||
static const int radix = __base::radix;
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __base::epsilon();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return __base::round_error();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __base::epsilon();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return __base::round_error();}
|
||||
|
||||
static const int min_exponent = __base::min_exponent;
|
||||
static const int min_exponent10 = __base::min_exponent10;
|
||||
@@ -502,10 +502,10 @@ public:
|
||||
static const bool has_signaling_NaN = __base::has_signaling_NaN;
|
||||
static const float_denorm_style has_denorm = __base::has_denorm;
|
||||
static const bool has_denorm_loss = __base::has_denorm_loss;
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __base::infinity();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __base::quiet_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __base::signaling_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __base::denorm_min();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __base::infinity();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __base::denorm_min();}
|
||||
|
||||
static const bool is_iec559 = __base::is_iec559;
|
||||
static const bool is_bounded = __base::is_bounded;
|
||||
@@ -524,9 +524,9 @@ class _LIBCPP_VISIBLE numeric_limits<volatile _Tp>
|
||||
typedef _Tp type;
|
||||
public:
|
||||
static const bool is_specialized = __base::is_specialized;
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() throw() {return __base::min();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() throw() {return __base::max();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return __base::lowest();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __base::min();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __base::max();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return __base::lowest();}
|
||||
|
||||
static const int digits = __base::digits;
|
||||
static const int digits10 = __base::digits10;
|
||||
@@ -535,8 +535,8 @@ public:
|
||||
static const bool is_integer = __base::is_integer;
|
||||
static const bool is_exact = __base::is_exact;
|
||||
static const int radix = __base::radix;
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __base::epsilon();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return __base::round_error();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __base::epsilon();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return __base::round_error();}
|
||||
|
||||
static const int min_exponent = __base::min_exponent;
|
||||
static const int min_exponent10 = __base::min_exponent10;
|
||||
@@ -548,10 +548,10 @@ public:
|
||||
static const bool has_signaling_NaN = __base::has_signaling_NaN;
|
||||
static const float_denorm_style has_denorm = __base::has_denorm;
|
||||
static const bool has_denorm_loss = __base::has_denorm_loss;
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __base::infinity();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __base::quiet_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __base::signaling_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __base::denorm_min();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __base::infinity();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __base::denorm_min();}
|
||||
|
||||
static const bool is_iec559 = __base::is_iec559;
|
||||
static const bool is_bounded = __base::is_bounded;
|
||||
@@ -570,9 +570,9 @@ class _LIBCPP_VISIBLE numeric_limits<const volatile _Tp>
|
||||
typedef _Tp type;
|
||||
public:
|
||||
static const bool is_specialized = __base::is_specialized;
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() throw() {return __base::min();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() throw() {return __base::max();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return __base::lowest();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __base::min();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __base::max();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return __base::lowest();}
|
||||
|
||||
static const int digits = __base::digits;
|
||||
static const int digits10 = __base::digits10;
|
||||
@@ -581,8 +581,8 @@ public:
|
||||
static const bool is_integer = __base::is_integer;
|
||||
static const bool is_exact = __base::is_exact;
|
||||
static const int radix = __base::radix;
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __base::epsilon();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return __base::round_error();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __base::epsilon();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return __base::round_error();}
|
||||
|
||||
static const int min_exponent = __base::min_exponent;
|
||||
static const int min_exponent10 = __base::min_exponent10;
|
||||
@@ -594,10 +594,10 @@ public:
|
||||
static const bool has_signaling_NaN = __base::has_signaling_NaN;
|
||||
static const float_denorm_style has_denorm = __base::has_denorm;
|
||||
static const bool has_denorm_loss = __base::has_denorm_loss;
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __base::infinity();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __base::quiet_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __base::signaling_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __base::denorm_min();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __base::infinity();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
|
||||
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __base::denorm_min();}
|
||||
|
||||
static const bool is_iec559 = __base::is_iec559;
|
||||
static const bool is_bounded = __base::is_bounded;
|
||||
|
||||
307
include/list
307
include/list
@@ -36,7 +36,8 @@ public:
|
||||
typedef reverse_iterator<iterator> reverse_iterator;
|
||||
typedef reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
list();
|
||||
list()
|
||||
noexcept(is_nothrow_default_constructible<allocator_type>::value);
|
||||
explicit list(const allocator_type& a);
|
||||
explicit list(size_type n);
|
||||
list(size_type n, const value_type& value);
|
||||
@@ -47,7 +48,8 @@ public:
|
||||
list(Iter first, Iter last, const allocator_type& a);
|
||||
list(const list& x);
|
||||
list(const list&, const allocator_type& a);
|
||||
list(list&& x);
|
||||
list(list&& x)
|
||||
noexcept(is_nothrow_move_constructible<allocator_type>::value);
|
||||
list(list&&, const allocator_type& a);
|
||||
list(initializer_list<value_type>);
|
||||
list(initializer_list<value_type>, const allocator_type& a);
|
||||
@@ -55,36 +57,39 @@ public:
|
||||
~list();
|
||||
|
||||
list& operator=(const list& x);
|
||||
list& operator=(list&& x);
|
||||
list& operator=(list&& x)
|
||||
noexcept(
|
||||
allocator_type::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value);
|
||||
list& operator=(initializer_list<value_type>);
|
||||
template <class Iter>
|
||||
void assign(Iter first, Iter last);
|
||||
void assign(size_type n, const value_type& t);
|
||||
void assign(initializer_list<value_type>);
|
||||
|
||||
allocator_type get_allocator() const;
|
||||
allocator_type get_allocator() const noexcept;
|
||||
|
||||
iterator begin();
|
||||
const_iterator begin() const;
|
||||
iterator end();
|
||||
const_iterator end() const;
|
||||
reverse_iterator rbegin();
|
||||
const_reverse_iterator rbegin() const;
|
||||
reverse_iterator rend();
|
||||
const_reverse_iterator rend() const;
|
||||
const_iterator cbegin() const;
|
||||
const_iterator cend() const;
|
||||
const_reverse_iterator crbegin() const;
|
||||
const_reverse_iterator crend() const;
|
||||
iterator begin() noexcept;
|
||||
const_iterator begin() const noexcept;
|
||||
iterator end() noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
reverse_iterator rbegin() noexcept;
|
||||
const_reverse_iterator rbegin() const noexcept;
|
||||
reverse_iterator rend() noexcept;
|
||||
const_reverse_iterator rend() const noexcept;
|
||||
const_iterator cbegin() const noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
const_reverse_iterator crbegin() const noexcept;
|
||||
const_reverse_iterator crend() const noexcept;
|
||||
|
||||
reference front();
|
||||
const_reference front() const;
|
||||
reference back();
|
||||
const_reference back() const;
|
||||
|
||||
bool empty() const;
|
||||
size_type size() const;
|
||||
size_type max_size() const;
|
||||
bool empty() const noexcept;
|
||||
size_type size() const noexcept;
|
||||
size_type max_size() const noexcept;
|
||||
|
||||
template <class... Args>
|
||||
void emplace_front(Args&&... args);
|
||||
@@ -111,8 +116,10 @@ public:
|
||||
void resize(size_type sz);
|
||||
void resize(size_type sz, const value_type& c);
|
||||
|
||||
void swap(list<value_type,allocator_type>&);
|
||||
void clear();
|
||||
void swap(list&)
|
||||
noexcept(!allocator_type::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value);
|
||||
void clear() noexcept;
|
||||
|
||||
void splice(const_iterator position, list& x);
|
||||
void splice(const_iterator position, list&& x);
|
||||
@@ -137,7 +144,7 @@ public:
|
||||
void sort();
|
||||
template <class Compare>
|
||||
void sort(Compare comp);
|
||||
void reverse();
|
||||
void reverse() noexcept;
|
||||
};
|
||||
|
||||
template <class T, class Alloc>
|
||||
@@ -154,7 +161,8 @@ template <class T, class Alloc>
|
||||
bool operator<=(const list<T,Alloc>& x, const list<T,Alloc>& y);
|
||||
|
||||
template <class T, class Alloc>
|
||||
void swap(list<T,Alloc>& x, list<T,Alloc>& y);
|
||||
void swap(list<T,Alloc>& x, list<T,Alloc>& y)
|
||||
noexcept(noexcept(x.swap(y)));
|
||||
|
||||
} // std
|
||||
|
||||
@@ -172,7 +180,7 @@ template <class T, class Alloc>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class, class> struct __list_node;
|
||||
template <class _Tp, class _VoidPtr> struct __list_node;
|
||||
|
||||
template <class _Tp, class _VoidPtr>
|
||||
struct __list_node_base
|
||||
@@ -201,9 +209,9 @@ struct __list_node
|
||||
_Tp __value_;
|
||||
};
|
||||
|
||||
template <class, class> class list;
|
||||
template <class, class> class __list_imp;
|
||||
template <class, class> class __list_const_iterator;
|
||||
template <class _Tp, class _Alloc> class list;
|
||||
template <class _Tp, class _Alloc> class __list_imp;
|
||||
template <class _Tp, class _VoidPtr> class __list_const_iterator;
|
||||
|
||||
template <class _Tp, class _VoidPtr>
|
||||
class _LIBCPP_VISIBLE __list_iterator
|
||||
@@ -218,7 +226,7 @@ class _LIBCPP_VISIBLE __list_iterator
|
||||
__node_pointer __ptr_;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __list_iterator(__node_pointer __p) : __ptr_(__p) {}
|
||||
explicit __list_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
|
||||
|
||||
template<class, class> friend class list;
|
||||
template<class, class> friend class __list_imp;
|
||||
@@ -236,6 +244,8 @@ public:
|
||||
pointer;
|
||||
typedef typename pointer_traits<pointer>::difference_type difference_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__list_iterator() _NOEXCEPT {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {return __ptr_->__value_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -272,7 +282,7 @@ class _LIBCPP_VISIBLE __list_const_iterator
|
||||
__node_pointer __ptr_;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __list_const_iterator(__node_pointer __p) : __ptr_(__p) {}
|
||||
explicit __list_const_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
|
||||
|
||||
template<class, class> friend class list;
|
||||
template<class, class> friend class __list_imp;
|
||||
@@ -290,7 +300,10 @@ public:
|
||||
typedef typename pointer_traits<pointer>::difference_type difference_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__list_const_iterator(__list_iterator<_Tp, _VoidPtr> __p) : __ptr_(__p.__ptr_) {}
|
||||
__list_const_iterator() _NOEXCEPT {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__list_const_iterator(__list_iterator<_Tp, _VoidPtr> __p) _NOEXCEPT
|
||||
: __ptr_(__p.__ptr_) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {return __ptr_->__value_;}
|
||||
@@ -348,33 +361,43 @@ protected:
|
||||
__compressed_pair<size_type, __node_allocator> __size_alloc_;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type& __sz() {return __size_alloc_.first();}
|
||||
size_type& __sz() _NOEXCEPT {return __size_alloc_.first();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const size_type& __sz() const {return __size_alloc_.first();}
|
||||
const size_type& __sz() const _NOEXCEPT
|
||||
{return __size_alloc_.first();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__node_allocator& __node_alloc() {return __size_alloc_.second();}
|
||||
__node_allocator& __node_alloc() _NOEXCEPT
|
||||
{return __size_alloc_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const __node_allocator& __node_alloc() const {return __size_alloc_.second();}
|
||||
const __node_allocator& __node_alloc() const _NOEXCEPT
|
||||
{return __size_alloc_.second();}
|
||||
|
||||
static void __unlink_nodes(__node_base& __f, __node_base& __l);
|
||||
static void __unlink_nodes(__node_base& __f, __node_base& __l) _NOEXCEPT;
|
||||
|
||||
__list_imp();
|
||||
__list_imp()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value);
|
||||
__list_imp(const allocator_type& __a);
|
||||
~__list_imp();
|
||||
void clear();
|
||||
void clear() _NOEXCEPT;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return __sz() == 0;}
|
||||
bool empty() const _NOEXCEPT {return __sz() == 0;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return iterator(__end_.__next_);}
|
||||
iterator begin() _NOEXCEPT
|
||||
{return iterator(__end_.__next_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return const_iterator(__end_.__next_);}
|
||||
const_iterator begin() const _NOEXCEPT
|
||||
{return const_iterator(__end_.__next_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return iterator(static_cast<__node_pointer> (&__end_));}
|
||||
iterator end() _NOEXCEPT
|
||||
{return iterator(static_cast<__node_pointer> (&__end_));}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return const_iterator(static_cast<__node_const_pointer>(&__end_));}
|
||||
const_iterator end() const _NOEXCEPT
|
||||
{return const_iterator(static_cast<__node_const_pointer>(&__end_));}
|
||||
|
||||
void swap(__list_imp& __c);
|
||||
void swap(__list_imp& __c)
|
||||
_NOEXCEPT_(!__node_alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __copy_assign_alloc(const __list_imp& __c)
|
||||
@@ -383,22 +406,29 @@ protected:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__list_imp& __c)
|
||||
_NOEXCEPT_(
|
||||
!__node_alloc_traits::propagate_on_container_move_assignment::value ||
|
||||
is_nothrow_move_assignable<__node_allocator>::value)
|
||||
{__move_assign_alloc(__c, integral_constant<bool,
|
||||
__node_alloc_traits::propagate_on_container_move_assignment::value>());}
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y)
|
||||
_NOEXCEPT_(!__node_alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value)
|
||||
{__swap_alloc(__x, __y, integral_constant<bool,
|
||||
__node_alloc_traits::propagate_on_container_swap::value>());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, true_type)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<__node_allocator>::value)
|
||||
{
|
||||
using _STD::swap;
|
||||
using _VSTD::swap;
|
||||
swap(__x, __y);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, false_type)
|
||||
_NOEXCEPT
|
||||
{}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -415,12 +445,14 @@ private:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(const __list_imp& __c, true_type)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
|
||||
{
|
||||
__node_alloc() = _STD::move(__c.__node_alloc());
|
||||
__node_alloc() = _VSTD::move(__c.__node_alloc());
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(const __list_imp& __c, false_type)
|
||||
_NOEXCEPT
|
||||
{}
|
||||
};
|
||||
|
||||
@@ -429,6 +461,7 @@ template <class _Tp, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__list_imp<_Tp, _Alloc>::__unlink_nodes(__node_base& __f, __node_base& __l)
|
||||
_NOEXCEPT
|
||||
{
|
||||
__f.__prev_->__next_ = __l.__next_;
|
||||
__l.__next_->__prev_ = __f.__prev_;
|
||||
@@ -437,6 +470,7 @@ __list_imp<_Tp, _Alloc>::__unlink_nodes(__node_base& __f, __node_base& __l)
|
||||
template <class _Tp, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__list_imp<_Tp, _Alloc>::__list_imp()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
|
||||
: __size_alloc_(0)
|
||||
{
|
||||
}
|
||||
@@ -456,7 +490,7 @@ __list_imp<_Tp, _Alloc>::~__list_imp()
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
void
|
||||
__list_imp<_Tp, _Alloc>::clear()
|
||||
__list_imp<_Tp, _Alloc>::clear() _NOEXCEPT
|
||||
{
|
||||
if (!empty())
|
||||
{
|
||||
@@ -469,8 +503,8 @@ __list_imp<_Tp, _Alloc>::clear()
|
||||
{
|
||||
__node& __n = *__f.__ptr_;
|
||||
++__f;
|
||||
__node_alloc_traits::destroy(__na, addressof(__n.__value_));
|
||||
__node_alloc_traits::deallocate(__na, addressof(__n), 1);
|
||||
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n.__value_));
|
||||
__node_alloc_traits::deallocate(__na, _VSTD::addressof(__n), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -478,8 +512,10 @@ __list_imp<_Tp, _Alloc>::clear()
|
||||
template <class _Tp, class _Alloc>
|
||||
void
|
||||
__list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
|
||||
_NOEXCEPT_(!__node_alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value)
|
||||
{
|
||||
using _STD::swap;
|
||||
using _VSTD::swap;
|
||||
__swap_alloc(__node_alloc(), __c.__node_alloc());
|
||||
swap(__sz(), __c.__sz());
|
||||
swap(__end_, __c.__end_);
|
||||
@@ -519,11 +555,13 @@ public:
|
||||
typedef typename base::difference_type difference_type;
|
||||
typedef typename base::iterator iterator;
|
||||
typedef typename base::const_iterator const_iterator;
|
||||
typedef _STD::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
list() {}
|
||||
list()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
|
||||
{}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
list(const allocator_type& __a) : base(__a) {}
|
||||
list(size_type __n);
|
||||
@@ -542,9 +580,13 @@ public:
|
||||
list(initializer_list<value_type> __il);
|
||||
list(initializer_list<value_type> __il, const allocator_type& __a);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
list(list&& __c);
|
||||
list(list&& __c)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
|
||||
list(list&& __c, const allocator_type& __a);
|
||||
list& operator=(list&& __c);
|
||||
list& operator=(list&& __c)
|
||||
_NOEXCEPT_(
|
||||
__node_alloc_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<__node_allocator>::value);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
list& operator=(initializer_list<value_type> __il)
|
||||
@@ -558,40 +600,47 @@ public:
|
||||
void assign(initializer_list<value_type> __il)
|
||||
{assign(__il.begin(), __il.end());}
|
||||
|
||||
allocator_type get_allocator() const;
|
||||
allocator_type get_allocator() const _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return base::__sz();}
|
||||
size_type size() const _NOEXCEPT {return base::__sz();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return base::empty();}
|
||||
bool empty() const _NOEXCEPT {return base::empty();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const {return numeric_limits<difference_type>::max();}
|
||||
size_type max_size() const _NOEXCEPT
|
||||
{return numeric_limits<difference_type>::max();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return base::begin();}
|
||||
iterator begin() _NOEXCEPT {return base::begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return base::begin();}
|
||||
const_iterator begin() const _NOEXCEPT {return base::begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return base::end();}
|
||||
iterator end() _NOEXCEPT {return base::end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return base::end();}
|
||||
const_iterator end() const _NOEXCEPT {return base::end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cbegin() const {return base::begin();}
|
||||
const_iterator cbegin() const _NOEXCEPT {return base::begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cend() const {return base::end();}
|
||||
const_iterator cend() const _NOEXCEPT {return base::end();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reverse_iterator rbegin() {return reverse_iterator(end());}
|
||||
reverse_iterator rbegin() _NOEXCEPT
|
||||
{return reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
|
||||
const_reverse_iterator rbegin() const _NOEXCEPT
|
||||
{return const_reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reverse_iterator rend() {return reverse_iterator(begin());}
|
||||
reverse_iterator rend() _NOEXCEPT
|
||||
{return reverse_iterator(begin());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
|
||||
const_reverse_iterator rend() const _NOEXCEPT
|
||||
{return const_reverse_iterator(begin());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crbegin() const {return const_reverse_iterator(end());}
|
||||
const_reverse_iterator crbegin() const _NOEXCEPT
|
||||
{return const_reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crend() const {return const_reverse_iterator(begin());}
|
||||
const_reverse_iterator crend() const _NOEXCEPT
|
||||
{return const_reverse_iterator(begin());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference front() {return base::__end_.__next_->__value_;}
|
||||
@@ -629,9 +678,12 @@ public:
|
||||
{return insert(__p, __il.begin(), __il.end());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(list& __c) {base::swap(__c);}
|
||||
void swap(list& __c)
|
||||
_NOEXCEPT_(!__node_alloc_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value)
|
||||
{base::swap(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() {base::clear();}
|
||||
void clear() _NOEXCEPT {base::clear();}
|
||||
|
||||
void pop_front();
|
||||
void pop_back();
|
||||
@@ -681,7 +733,7 @@ public:
|
||||
template <class _Comp>
|
||||
void sort(_Comp __comp);
|
||||
|
||||
void reverse();
|
||||
void reverse() _NOEXCEPT;
|
||||
|
||||
private:
|
||||
static void __link_nodes(__node& __p, __node& __f, __node& __l);
|
||||
@@ -689,7 +741,8 @@ private:
|
||||
template <class _Comp>
|
||||
static iterator __sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp);
|
||||
|
||||
void __move_assign(list& __c, true_type);
|
||||
void __move_assign(list& __c, true_type)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value);
|
||||
void __move_assign(list& __c, false_type);
|
||||
};
|
||||
|
||||
@@ -710,8 +763,8 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename list<_Tp, _Alloc>::iterator
|
||||
list<_Tp, _Alloc>::__iterator(size_type __n)
|
||||
{
|
||||
return __n <= base::__sz() / 2 ? next(begin(), __n)
|
||||
: prev(end(), base::__sz() - __n);
|
||||
return __n <= base::__sz() / 2 ? _VSTD::next(begin(), __n)
|
||||
: _VSTD::prev(end(), base::__sz() - __n);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
@@ -812,7 +865,8 @@ list<_Tp, _Alloc>::operator=(const list& __c)
|
||||
template <class _Tp, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
list<_Tp, _Alloc>::list(list&& __c)
|
||||
: base(allocator_type(_STD::move(__c.__node_alloc())))
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value)
|
||||
: base(allocator_type(_VSTD::move(__c.__node_alloc())))
|
||||
{
|
||||
splice(end(), __c);
|
||||
}
|
||||
@@ -835,6 +889,9 @@ template <class _Tp, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
list<_Tp, _Alloc>&
|
||||
list<_Tp, _Alloc>::operator=(list&& __c)
|
||||
_NOEXCEPT_(
|
||||
__node_alloc_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<__node_allocator>::value)
|
||||
{
|
||||
__move_assign(__c, integral_constant<bool,
|
||||
__node_alloc_traits::propagate_on_container_move_assignment::value>());
|
||||
@@ -857,6 +914,7 @@ list<_Tp, _Alloc>::__move_assign(list& __c, false_type)
|
||||
template <class _Tp, class _Alloc>
|
||||
void
|
||||
list<_Tp, _Alloc>::__move_assign(list& __c, true_type)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
|
||||
{
|
||||
clear();
|
||||
base::__move_assign_alloc(__c);
|
||||
@@ -898,7 +956,7 @@ list<_Tp, _Alloc>::assign(size_type __n, const value_type& __x)
|
||||
template <class _Tp, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_Alloc
|
||||
list<_Tp, _Alloc>::get_allocator() const
|
||||
list<_Tp, _Alloc>::get_allocator() const _NOEXCEPT
|
||||
{
|
||||
return allocator_type(base::__node_alloc());
|
||||
}
|
||||
@@ -911,7 +969,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x)
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
__hold->__prev_ = 0;
|
||||
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
||||
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
|
||||
++base::__sz();
|
||||
return iterator(__hold.release());
|
||||
@@ -929,7 +987,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
__hold->__prev_ = 0;
|
||||
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
||||
++__ds;
|
||||
__r = iterator(__hold.get());
|
||||
__hold.release();
|
||||
@@ -941,7 +999,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
|
||||
for (--__n; __n != 0; --__n, ++__e, ++__ds)
|
||||
{
|
||||
__hold.reset(__node_alloc_traits::allocate(__na, 1));
|
||||
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
||||
__e.__ptr_->__next_ = __hold.get();
|
||||
__hold->__prev_ = __e.__ptr_;
|
||||
__hold.release();
|
||||
@@ -952,7 +1010,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
__node_alloc_traits::destroy(__na, addressof(*__e));
|
||||
__node_alloc_traits::destroy(__na, _VSTD::addressof(*__e));
|
||||
__node_pointer __prev = __e.__ptr_->__prev_;
|
||||
__node_alloc_traits::deallocate(__na, __e.__ptr_, 1);
|
||||
if (__prev == 0)
|
||||
@@ -982,7 +1040,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
__hold->__prev_ = 0;
|
||||
__node_alloc_traits::construct(__na, addressof(__hold->__value_), *__f);
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f);
|
||||
++__ds;
|
||||
__r = iterator(__hold.get());
|
||||
__hold.release();
|
||||
@@ -994,7 +1052,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
|
||||
for (++__f; __f != __l; ++__f, ++__e, ++__ds)
|
||||
{
|
||||
__hold.reset(__node_alloc_traits::allocate(__na, 1));
|
||||
__node_alloc_traits::construct(__na, addressof(__hold->__value_), *__f);
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f);
|
||||
__e.__ptr_->__next_ = __hold.get();
|
||||
__hold->__prev_ = __e.__ptr_;
|
||||
__hold.release();
|
||||
@@ -1005,7 +1063,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
__node_alloc_traits::destroy(__na, addressof(*__e));
|
||||
__node_alloc_traits::destroy(__na, _VSTD::addressof(*__e));
|
||||
__node_pointer __prev = __e.__ptr_->__prev_;
|
||||
__node_alloc_traits::deallocate(__na, __e.__ptr_, 1);
|
||||
if (__prev == 0)
|
||||
@@ -1028,7 +1086,7 @@ list<_Tp, _Alloc>::push_front(const value_type& __x)
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
||||
__link_nodes(*base::__end_.__next_, *__hold, *__hold);
|
||||
++base::__sz();
|
||||
__hold.release();
|
||||
@@ -1041,7 +1099,7 @@ list<_Tp, _Alloc>::push_back(const value_type& __x)
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
||||
__link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold);
|
||||
++base::__sz();
|
||||
__hold.release();
|
||||
@@ -1056,7 +1114,7 @@ list<_Tp, _Alloc>::push_front(value_type&& __x)
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
__node_alloc_traits::construct(__na, addressof(__hold->__value_), _STD::move(__x));
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
|
||||
__link_nodes(*base::__end_.__next_, *__hold, *__hold);
|
||||
++base::__sz();
|
||||
__hold.release();
|
||||
@@ -1069,7 +1127,7 @@ list<_Tp, _Alloc>::push_back(value_type&& __x)
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
__node_alloc_traits::construct(__na, addressof(__hold->__value_), _STD::move(__x));
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
|
||||
__link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold);
|
||||
++base::__sz();
|
||||
__hold.release();
|
||||
@@ -1085,7 +1143,7 @@ list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
__node_alloc_traits::construct(__na, addressof(__hold->__value_), _STD::forward<_Args>(__args)...);
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
|
||||
__link_nodes(*base::__end_.__next_, *__hold, *__hold);
|
||||
++base::__sz();
|
||||
__hold.release();
|
||||
@@ -1099,7 +1157,7 @@ list<_Tp, _Alloc>::emplace_back(_Args&&... __args)
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
__node_alloc_traits::construct(__na, addressof(__hold->__value_), _STD::forward<_Args>(__args)...);
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
|
||||
__link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold);
|
||||
++base::__sz();
|
||||
__hold.release();
|
||||
@@ -1114,7 +1172,7 @@ list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args)
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
__hold->__prev_ = 0;
|
||||
__node_alloc_traits::construct(__na, addressof(__hold->__value_), _STD::forward<_Args>(__args)...);
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
|
||||
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
|
||||
++base::__sz();
|
||||
return iterator(__hold.release());
|
||||
@@ -1130,7 +1188,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x)
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
__hold->__prev_ = 0;
|
||||
__node_alloc_traits::construct(__na, addressof(__hold->__value_), _STD::move(__x));
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
|
||||
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
|
||||
++base::__sz();
|
||||
return iterator(__hold.release());
|
||||
@@ -1146,8 +1204,8 @@ list<_Tp, _Alloc>::pop_front()
|
||||
__node& __n = *base::__end_.__next_;
|
||||
base::__unlink_nodes(__n, __n);
|
||||
--base::__sz();
|
||||
__node_alloc_traits::destroy(__na, addressof(__n.__value_));
|
||||
__node_alloc_traits::deallocate(__na, addressof(__n), 1);
|
||||
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n.__value_));
|
||||
__node_alloc_traits::deallocate(__na, _VSTD::addressof(__n), 1);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
@@ -1158,8 +1216,8 @@ list<_Tp, _Alloc>::pop_back()
|
||||
__node& __n = *base::__end_.__prev_;
|
||||
base::__unlink_nodes(__n, __n);
|
||||
--base::__sz();
|
||||
__node_alloc_traits::destroy(__na, addressof(__n.__value_));
|
||||
__node_alloc_traits::deallocate(__na, addressof(__n), 1);
|
||||
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n.__value_));
|
||||
__node_alloc_traits::deallocate(__na, _VSTD::addressof(__n), 1);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
@@ -1171,8 +1229,8 @@ list<_Tp, _Alloc>::erase(const_iterator __p)
|
||||
__node_pointer __r = __n.__next_;
|
||||
base::__unlink_nodes(__n, __n);
|
||||
--base::__sz();
|
||||
__node_alloc_traits::destroy(__na, addressof(__n.__value_));
|
||||
__node_alloc_traits::deallocate(__na, addressof(__n), 1);
|
||||
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n.__value_));
|
||||
__node_alloc_traits::deallocate(__na, _VSTD::addressof(__n), 1);
|
||||
return iterator(__r);
|
||||
}
|
||||
|
||||
@@ -1189,8 +1247,8 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
|
||||
__node& __n = const_cast<__node&>(*__f.__ptr_);
|
||||
++__f;
|
||||
--base::__sz();
|
||||
__node_alloc_traits::destroy(__na, addressof(__n.__value_));
|
||||
__node_alloc_traits::deallocate(__na, addressof(__n), 1);
|
||||
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n.__value_));
|
||||
__node_alloc_traits::deallocate(__na, _VSTD::addressof(__n), 1);
|
||||
}
|
||||
}
|
||||
return iterator(const_cast<__node_pointer>(__l.__ptr_));
|
||||
@@ -1210,7 +1268,7 @@ list<_Tp, _Alloc>::resize(size_type __n)
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
__hold->__prev_ = 0;
|
||||
__node_alloc_traits::construct(__na, addressof(__hold->__value_));
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_));
|
||||
++__ds;
|
||||
iterator __r = iterator(__hold.release());
|
||||
iterator __e = __r;
|
||||
@@ -1221,7 +1279,7 @@ list<_Tp, _Alloc>::resize(size_type __n)
|
||||
for (--__n; __n != 0; --__n, ++__e, ++__ds)
|
||||
{
|
||||
__hold.reset(__node_alloc_traits::allocate(__na, 1));
|
||||
__node_alloc_traits::construct(__na, addressof(__hold->__value_));
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_));
|
||||
__e.__ptr_->__next_ = __hold.get();
|
||||
__hold->__prev_ = __e.__ptr_;
|
||||
__hold.release();
|
||||
@@ -1232,7 +1290,7 @@ list<_Tp, _Alloc>::resize(size_type __n)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
__node_alloc_traits::destroy(__na, addressof(*__e));
|
||||
__node_alloc_traits::destroy(__na, _VSTD::addressof(*__e));
|
||||
__node_pointer __prev = __e.__ptr_->__prev_;
|
||||
__node_alloc_traits::deallocate(__na, __e.__ptr_, 1);
|
||||
if (__prev == 0)
|
||||
@@ -1261,7 +1319,7 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
__hold->__prev_ = 0;
|
||||
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
||||
++__ds;
|
||||
iterator __r = iterator(__hold.release());
|
||||
iterator __e = __r;
|
||||
@@ -1272,7 +1330,7 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
|
||||
for (--__n; __n != 0; --__n, ++__e, ++__ds)
|
||||
{
|
||||
__hold.reset(__node_alloc_traits::allocate(__na, 1));
|
||||
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
||||
__e.__ptr_->__next_ = __hold.get();
|
||||
__hold->__prev_ = __e.__ptr_;
|
||||
__hold.release();
|
||||
@@ -1283,7 +1341,7 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
__node_alloc_traits::destroy(__na, addressof(*__e));
|
||||
__node_alloc_traits::destroy(__na, _VSTD::addressof(*__e));
|
||||
__node_pointer __prev = __e.__ptr_->__prev_;
|
||||
__node_alloc_traits::deallocate(__na, __e.__ptr_, 1);
|
||||
if (__prev == 0)
|
||||
@@ -1317,7 +1375,7 @@ template <class _Tp, class _Alloc>
|
||||
void
|
||||
list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
|
||||
{
|
||||
if (__p != __i && __p != next(__i))
|
||||
if (__p != __i && __p != _VSTD::next(__i))
|
||||
{
|
||||
__node& __f = const_cast<__node&>(*__i.__ptr_);
|
||||
base::__unlink_nodes(__f, __f);
|
||||
@@ -1335,7 +1393,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, con
|
||||
{
|
||||
if (this != &__c)
|
||||
{
|
||||
size_type __s = _STD::distance(__f, __l);
|
||||
size_type __s = _VSTD::distance(__f, __l);
|
||||
__c.__sz() -= __s;
|
||||
base::__sz() += __s;
|
||||
}
|
||||
@@ -1355,7 +1413,7 @@ list<_Tp, _Alloc>::remove(const value_type& __x)
|
||||
{
|
||||
if (*__i == __x)
|
||||
{
|
||||
iterator __j = next(__i);
|
||||
iterator __j = _VSTD::next(__i);
|
||||
for (; __j != __e && *__j == __x; ++__j)
|
||||
;
|
||||
__i = erase(__i, __j);
|
||||
@@ -1374,7 +1432,7 @@ list<_Tp, _Alloc>::remove_if(_Pred __pred)
|
||||
{
|
||||
if (__pred(*__i))
|
||||
{
|
||||
iterator __j = next(__i);
|
||||
iterator __j = _VSTD::next(__i);
|
||||
for (; __j != __e && __pred(*__j); ++__j)
|
||||
;
|
||||
__i = erase(__i, __j);
|
||||
@@ -1399,7 +1457,7 @@ list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred)
|
||||
{
|
||||
for (iterator __i = begin(), __e = end(); __i != __e;)
|
||||
{
|
||||
iterator __j = next(__i);
|
||||
iterator __j = _VSTD::next(__i);
|
||||
for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
|
||||
;
|
||||
if (++__i != __j)
|
||||
@@ -1431,7 +1489,7 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
|
||||
if (__comp(*__f2, *__f1))
|
||||
{
|
||||
size_type __ds = 1;
|
||||
iterator __m2 = next(__f2);
|
||||
iterator __m2 = _VSTD::next(__f2);
|
||||
for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2, ++__ds)
|
||||
;
|
||||
base::__sz() += __ds;
|
||||
@@ -1440,7 +1498,7 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
|
||||
__node& __l = *__m2.__ptr_->__prev_;
|
||||
__f2 = __m2;
|
||||
base::__unlink_nodes(__f, __l);
|
||||
__m2 = next(__f1);
|
||||
__m2 = _VSTD::next(__f1);
|
||||
__link_nodes(*__f1.__ptr_, __f, __l);
|
||||
__f1 = __m2;
|
||||
}
|
||||
@@ -1489,12 +1547,12 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
|
||||
return __f1;
|
||||
}
|
||||
size_type __n2 = __n / 2;
|
||||
iterator __e1 = next(__f1, __n2);
|
||||
iterator __e1 = _VSTD::next(__f1, __n2);
|
||||
iterator __r = __f1 = __sort(__f1, __e1, __n2, __comp);
|
||||
iterator __f2 = __e1 = __sort(__e1, __e2, __n - __n2, __comp);
|
||||
if (__comp(*__f2, *__f1))
|
||||
{
|
||||
iterator __m2 = next(__f2);
|
||||
iterator __m2 = _VSTD::next(__f2);
|
||||
for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
|
||||
;
|
||||
__node& __f = *__f2.__ptr_;
|
||||
@@ -1502,7 +1560,7 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
|
||||
__r = __f2;
|
||||
__e1 = __f2 = __m2;
|
||||
base::__unlink_nodes(__f, __l);
|
||||
__m2 = next(__f1);
|
||||
__m2 = _VSTD::next(__f1);
|
||||
__link_nodes(*__f1.__ptr_, __f, __l);
|
||||
__f1 = __m2;
|
||||
}
|
||||
@@ -1512,7 +1570,7 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
|
||||
{
|
||||
if (__comp(*__f2, *__f1))
|
||||
{
|
||||
iterator __m2 = next(__f2);
|
||||
iterator __m2 = _VSTD::next(__f2);
|
||||
for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
|
||||
;
|
||||
__node& __f = *__f2.__ptr_;
|
||||
@@ -1521,7 +1579,7 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
|
||||
__e1 = __m2;
|
||||
__f2 = __m2;
|
||||
base::__unlink_nodes(__f, __l);
|
||||
__m2 = next(__f1);
|
||||
__m2 = _VSTD::next(__f1);
|
||||
__link_nodes(*__f1.__ptr_, __f, __l);
|
||||
__f1 = __m2;
|
||||
}
|
||||
@@ -1533,14 +1591,14 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
void
|
||||
list<_Tp, _Alloc>::reverse()
|
||||
list<_Tp, _Alloc>::reverse() _NOEXCEPT
|
||||
{
|
||||
if (base::__sz() > 1)
|
||||
{
|
||||
iterator __e = end();
|
||||
for (iterator __i = begin(); __i != __e; --__i)
|
||||
_STD::swap(__i.__ptr_->__prev_, __i.__ptr_->__next_);
|
||||
_STD::swap(__e.__ptr_->__prev_, __e.__ptr_->__next_);
|
||||
_VSTD::swap(__i.__ptr_->__prev_, __i.__ptr_->__next_);
|
||||
_VSTD::swap(__e.__ptr_->__prev_, __e.__ptr_->__next_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1549,7 +1607,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
|
||||
{
|
||||
return __x.size() == __y.size() && _STD::equal(__x.begin(), __x.end(), __y.begin());
|
||||
return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
@@ -1557,7 +1615,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator< (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
|
||||
{
|
||||
return _STD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
|
||||
return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
@@ -1596,6 +1654,7 @@ template <class _Tp, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
513
include/locale
513
include/locale
@@ -36,8 +36,8 @@ public:
|
||||
all = collate | ctype | monetary | numeric | time | messages;
|
||||
|
||||
// construct/copy/destroy:
|
||||
locale() throw();
|
||||
locale(const locale& other) throw();
|
||||
locale() noexcept;
|
||||
locale(const locale& other) noexcept;
|
||||
explicit locale(const char* std_name);
|
||||
explicit locale(const string& std_name);
|
||||
locale(const locale& other, const char* std_name, category);
|
||||
@@ -45,9 +45,9 @@ public:
|
||||
template <class Facet> locale(const locale& other, Facet* f);
|
||||
locale(const locale& other, const locale& one, category);
|
||||
|
||||
~locale() throw(); // not virtual
|
||||
~locale(); // not virtual
|
||||
|
||||
const locale& operator=(const locale& other) throw();
|
||||
const locale& operator=(const locale& other) noexcept;
|
||||
|
||||
template <class Facet> locale combine(const locale& other) const;
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
};
|
||||
|
||||
template <class Facet> const Facet& use_facet(const locale&);
|
||||
template <class Facet> bool has_facet(const locale&) throw();
|
||||
template <class Facet> bool has_facet(const locale&) noexcept;
|
||||
|
||||
// 22.3.3, convenience interfaces:
|
||||
template <class charT> bool isspace (charT c, const locale& loc);
|
||||
@@ -192,137 +192,207 @@ template <class charT> class messages_byname;
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
// Get the C locale object
|
||||
locale_t __cloc();
|
||||
#endif
|
||||
|
||||
typedef _VSTD::remove_pointer<locale_t>::type __locale_struct;
|
||||
typedef _VSTD::unique_ptr<__locale_struct, decltype(&freelocale)> __locale_unique_ptr;
|
||||
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 __APPLE__
|
||||
#ifndef _LIBCPP_STABLE_APPLE_ABI
|
||||
|
||||
template <class _Tp>
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
decltype(MB_CUR_MAX_L(_VSTD::declval<locale_t>()))
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_sprintf(char* __restrict __str,
|
||||
const char* __restrict __format, _Tp __v)
|
||||
__mb_cur_max_l(locale_t __l)
|
||||
{
|
||||
return sprintf_l(__str, 0, __format, __v);
|
||||
return MB_CUR_MAX_L(__l);
|
||||
}
|
||||
#else // _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
decltype(MB_CUR_MAX) __mb_cur_max_l(locale_t __l)
|
||||
{
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return MB_CUR_MAX;
|
||||
}
|
||||
#endif // _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
wint_t __btowc_l(int __c, locale_t __l)
|
||||
{
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
return btowc_l(__c, __l);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return btowc(__c);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_snprintf(char* __restrict __str, size_t __size,
|
||||
const char* __restrict __format, _Tp __v)
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
int __wctob_l(wint_t __c, locale_t __l)
|
||||
{
|
||||
return snprintf_l(__str, __size, 0, __format, __v);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
return wctob_l(__c, __l);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return wctob(__c);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_snprintf(char* __restrict __str, size_t __size,
|
||||
const char* __restrict __format, int __prec, _Tp __v)
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
size_t __wcsnrtombs_l(char *__dest, const wchar_t **__src, size_t __nwc,
|
||||
size_t __len, mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
return snprintf_l(__str, __size, 0, __format, __prec, __v);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
return wcsnrtombs_l(__dest, __src, __nwc, __len, __ps, __l);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return wcsnrtombs(__dest, __src, __nwc, __len, __ps);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_asprintf(char** __ret, const char* __restrict __format, _Tp __v)
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
size_t __wcrtomb_l(char *__s, wchar_t __wc, mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
return asprintf_l(__ret, 0, __format, __v);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
return wcrtomb_l(__s, __wc, __ps, __l);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return wcrtomb(__s, __wc, __ps);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_asprintf(char** __ret, const char* __restrict __format, int __prec,
|
||||
_Tp __v)
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
size_t __mbsnrtowcs_l(wchar_t * __dest, const char **__src, size_t __nms,
|
||||
size_t __len, mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
return asprintf_l(__ret, 0, __format, __prec, __v);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
return mbsnrtowcs_l(__dest, __src, __nms__len, __ps, __l);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return mbsnrtowcs(__dest, __src, __nms, __len, __ps);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_sscanf(const char* __restrict __str,
|
||||
const char* __restrict __format, _Tp* __v)
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
size_t __mbrtowc_l(wchar_t *__pwc, const char *__s, size_t __n,
|
||||
mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
return sscanf_l(__str, 0, __format, __v);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
return mbrtowc_l(__pwc, __s, __n, __ps, __l);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return mbrtowc(__pwc, __s, __n, __ps);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_isxdigit(int __c)
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
int __mbtowc_l(wchar_t *__pwc, const char *__pmb, size_t __max, locale_t __l)
|
||||
{
|
||||
return isxdigit_l(__c, 0);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
return mbtowc(__pwc, __pmb, __max, __l);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return mbtowc(__pwc, __pmb, __max);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_isdigit(int __c)
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
size_t __mbrlen_l(const char *__s, size_t __n, mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
return isdigit_l(__c, 0);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
return mbrlen_l(__s, __n, __ps, __l);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return mbrlen(__s, __n, __ps);
|
||||
#endif
|
||||
}
|
||||
|
||||
#else // __APPLE__
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_sprintf(char* __restrict __str,
|
||||
const char* __restrict __format, ...)
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
lconv *__localeconv_l(locale_t __l)
|
||||
{
|
||||
va_list __ap;
|
||||
va_start(__ap, __format);
|
||||
int __result = vsprintf(__str, __format, __ap);
|
||||
va_end(__ap);
|
||||
return __result;
|
||||
}
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_snprintf(char* __restrict __str, size_t __size,
|
||||
const char* __restrict __format, ...)
|
||||
{
|
||||
va_list __ap;
|
||||
va_start(__ap, __format);
|
||||
int __result = vsnprintf(__str, __size, __format, __ap);
|
||||
va_end(__ap);
|
||||
return __result;
|
||||
}
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_asprintf(char** __ret,
|
||||
const char* __restrict __format, ...)
|
||||
{
|
||||
va_list __ap;
|
||||
va_start(__ap, __format);
|
||||
int __result = vasprintf(__ret, __format, __ap);
|
||||
va_end(__ap);
|
||||
return __result;
|
||||
}
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_sscanf(const char* __restrict __str,
|
||||
const char* __restrict __format, ...)
|
||||
{
|
||||
va_list __ap;
|
||||
va_start(__ap, __format);
|
||||
int __result = vsscanf(__str, __format, __ap);
|
||||
va_end(__ap);
|
||||
return __result;
|
||||
}
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_isxdigit(int __c)
|
||||
{
|
||||
return isxdigit(__c);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
return localeconv_l(__l);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return localeconv();
|
||||
#endif
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_isdigit(int __c)
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
size_t __mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len,
|
||||
mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
return isdigit(__c);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
return mbsrtowcs_l(__dest, __src, __len, __ps, __l);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
return mbsrtowcs(__dest, __src, __len, __ps);
|
||||
#endif
|
||||
}
|
||||
#endif // __APPLE__
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
int __sprintf_l(char *__s, locale_t __l, const char *__format, ...) {
|
||||
va_list __va;
|
||||
va_start(__va, __format);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
int __res = vsprintf_l(__s, __l, __format, __va);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
int __res = vsprintf(__s, __format, __va);
|
||||
#endif
|
||||
va_end(__va);
|
||||
return __res;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
int __snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) {
|
||||
va_list __va;
|
||||
va_start(__va, __format);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
int __res = vsnprintf_l(__s, __n, __l, __format, __va);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
int __res = vsnprintf(__s, __n, __format, __va);
|
||||
#endif
|
||||
va_end(__va);
|
||||
return __res;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
int __asprintf_l(char **__s, locale_t __l, const char *__format, ...) {
|
||||
va_list __va;
|
||||
va_start(__va, __format);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
int __res = vasprintf_l(__s, __l, __format, __va);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
int __res = vasprintf(__s, __format, __va);
|
||||
#endif
|
||||
va_end(__va);
|
||||
return __res;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE inline
|
||||
int __sscanf_l(const char *__s, locale_t __l, const char *__format, ...) {
|
||||
va_list __va;
|
||||
va_start(__va, __format);
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
int __res = vsscanf_l(__s, __l, __format, __va);
|
||||
#else
|
||||
__locale_raii __current(uselocale(__l), uselocale);
|
||||
int __res = vsscanf(__s, __format, __va);
|
||||
#endif
|
||||
va_end(__va);
|
||||
return __res;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_STABLE_APPLE_ABI
|
||||
|
||||
// __scan_keyword
|
||||
// Scans [__b, __e) until a match is found in the basic_strings range
|
||||
@@ -351,7 +421,7 @@ __scan_keyword(_InputIterator& __b, _InputIterator __e,
|
||||
bool __case_sensitive = true)
|
||||
{
|
||||
typedef typename iterator_traits<_InputIterator>::value_type _CharT;
|
||||
size_t __nkw = _STD::distance(__kb, __ke);
|
||||
size_t __nkw = _VSTD::distance(__kb, __ke);
|
||||
const unsigned char __doesnt_match = '\0';
|
||||
const unsigned char __might_match = '\1';
|
||||
const unsigned char __does_match = '\2';
|
||||
@@ -510,6 +580,12 @@ __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*&
|
||||
unsigned& __dc, _CharT __thousands_sep, const string& __grouping,
|
||||
unsigned* __g, unsigned*& __g_end, _CharT* __atoms)
|
||||
{
|
||||
if (__a_end == __a && (__ct == __atoms[24] || __ct == __atoms[25]))
|
||||
{
|
||||
*__a_end++ = __ct == __atoms[24] ? '+' : '-';
|
||||
__dc = 0;
|
||||
return 0;
|
||||
}
|
||||
if (__ct == __thousands_sep && __grouping.size() != 0)
|
||||
{
|
||||
if (__g_end-__g < __num_get_buf_sz)
|
||||
@@ -520,22 +596,28 @@ __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*&
|
||||
return 0;
|
||||
}
|
||||
ptrdiff_t __f = find(__atoms, __atoms + 26, __ct) - __atoms;
|
||||
if (__f >= 26)
|
||||
if (__f >= 24)
|
||||
return -1;
|
||||
if (__a_end-__a < __num_get_buf_sz - 1)
|
||||
*__a_end++ = __src[__f];
|
||||
switch (__base)
|
||||
{
|
||||
case 8:
|
||||
case 10:
|
||||
if (__f >= __base)
|
||||
return 0;
|
||||
return -1;
|
||||
break;
|
||||
default:
|
||||
if (__f >= 22)
|
||||
case 16:
|
||||
if (__f < 22)
|
||||
break;
|
||||
if (__a_end != __a && __a_end - __a <= 2 && __a_end[-1] == '0')
|
||||
{
|
||||
__dc = 0;
|
||||
*__a_end++ = __src[__f];
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
if (__a_end-__a < __num_get_buf_sz - 1)
|
||||
*__a_end++ = __src[__f];
|
||||
++__dc;
|
||||
return 0;
|
||||
}
|
||||
@@ -721,22 +803,31 @@ __num_get_signed_integral(const char* __a, const char* __a_end,
|
||||
{
|
||||
if (__a != __a_end)
|
||||
{
|
||||
int __save_errno = errno;
|
||||
errno = 0;
|
||||
char *__p2;
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
long long __ll = strtoll_l(__a, &__p2, __base, 0);
|
||||
#else
|
||||
long long __ll = strtoll_l(__a, &__p2, __base, __cloc());
|
||||
#endif
|
||||
int __current_errno = errno;
|
||||
if (__current_errno == 0)
|
||||
errno = __save_errno;
|
||||
if (__p2 != __a_end)
|
||||
{
|
||||
__err = ios_base::failbit;
|
||||
return 0;
|
||||
}
|
||||
else if (__ll > numeric_limits<_Tp>::max())
|
||||
else if (__current_errno == ERANGE ||
|
||||
__ll < numeric_limits<_Tp>::min() ||
|
||||
numeric_limits<_Tp>::max() < __ll)
|
||||
{
|
||||
__err = ios_base::failbit;
|
||||
return numeric_limits<_Tp>::max();
|
||||
}
|
||||
else if (__ll < numeric_limits<_Tp>::min())
|
||||
{
|
||||
__err = ios_base::failbit;
|
||||
return numeric_limits<_Tp>::min();
|
||||
if (__ll > 0)
|
||||
return numeric_limits<_Tp>::max();
|
||||
else
|
||||
return numeric_limits<_Tp>::min();
|
||||
}
|
||||
return static_cast<_Tp>(__ll);
|
||||
}
|
||||
@@ -751,14 +842,29 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
|
||||
{
|
||||
if (__a != __a_end)
|
||||
{
|
||||
if (*__a == '-')
|
||||
{
|
||||
__err = ios_base::failbit;
|
||||
return 0;
|
||||
}
|
||||
int __save_errno = errno;
|
||||
errno = 0;
|
||||
char *__p2;
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
unsigned long long __ll = strtoull_l(__a, &__p2, __base, 0);
|
||||
#else
|
||||
unsigned long long __ll = strtoull_l(__a, &__p2, __base, __cloc());
|
||||
#endif
|
||||
int __current_errno = errno;
|
||||
if (__current_errno == 0)
|
||||
errno = __save_errno;
|
||||
if (__p2 != __a_end)
|
||||
{
|
||||
__err = ios_base::failbit;
|
||||
return 0;
|
||||
}
|
||||
else if (__ll > numeric_limits<_Tp>::max())
|
||||
else if (__current_errno == ERANGE ||
|
||||
numeric_limits<_Tp>::max() < __ll)
|
||||
{
|
||||
__err = ios_base::failbit;
|
||||
return numeric_limits<_Tp>::max();
|
||||
@@ -776,7 +882,11 @@ __num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err)
|
||||
if (__a != __a_end)
|
||||
{
|
||||
char *__p2;
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
long double __ld = strtold_l(__a, &__p2, 0);
|
||||
#else
|
||||
long double __ld = strtold_l(__a, &__p2, __cloc());
|
||||
#endif
|
||||
if (__p2 != __a_end)
|
||||
{
|
||||
__err = ios_base::failbit;
|
||||
@@ -1181,7 +1291,11 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
|
||||
break;
|
||||
// Stage 3
|
||||
__a[sizeof(__a)-1] = 0;
|
||||
if (__nolocale_sscanf(__a, "%p", &__v) != 1)
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
if (sscanf_l(__a, 0, "%p", &__v) != 1)
|
||||
#else
|
||||
if (__sscanf_l(__a, __cloc(), "%p", &__v) != 1)
|
||||
#endif
|
||||
__err = ios_base::failbit;
|
||||
// EOF checked
|
||||
if (__b == __e)
|
||||
@@ -1286,13 +1400,21 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne,
|
||||
*__oe++ = __ct.widen(*__nf++);
|
||||
*__oe++ = __ct.widen(*__nf++);
|
||||
for (__ns = __nf; __ns < __ne; ++__ns)
|
||||
if (!__nolocale_isxdigit(*__ns))
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
if (!isxdigit_l(*__ns, 0))
|
||||
#else
|
||||
if (!isxdigit_l(*__ns, __cloc()))
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (__ns = __nf; __ns < __ne; ++__ns)
|
||||
if (!__nolocale_isdigit(*__ns))
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
if (!isdigit_l(*__ns, 0))
|
||||
#else
|
||||
if (!isdigit_l(*__ns, __cloc()))
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
if (__grouping.empty())
|
||||
@@ -1490,7 +1612,11 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
+ ((numeric_limits<long>::digits % 3) != 0)
|
||||
+ 1;
|
||||
char __nar[__nbuf];
|
||||
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
int __nc = sprintf_l(__nar, 0, __fmt, __v);
|
||||
#else
|
||||
int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
|
||||
#endif
|
||||
char* __ne = __nar + __nc;
|
||||
char* __np = this->__identify_padding(__nar, __ne, __iob);
|
||||
// Stage 2 - Widen __nar while adding thousands separators
|
||||
@@ -1516,7 +1642,11 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
+ ((numeric_limits<long long>::digits % 3) != 0)
|
||||
+ 1;
|
||||
char __nar[__nbuf];
|
||||
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
int __nc = sprintf_l(__nar, 0, __fmt, __v);
|
||||
#else
|
||||
int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
|
||||
#endif
|
||||
char* __ne = __nar + __nc;
|
||||
char* __np = this->__identify_padding(__nar, __ne, __iob);
|
||||
// Stage 2 - Widen __nar while adding thousands separators
|
||||
@@ -1542,7 +1672,11 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
+ ((numeric_limits<unsigned long>::digits % 3) != 0)
|
||||
+ 1;
|
||||
char __nar[__nbuf];
|
||||
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
int __nc = sprintf_l(__nar, 0, __fmt, __v);
|
||||
#else
|
||||
int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
|
||||
#endif
|
||||
char* __ne = __nar + __nc;
|
||||
char* __np = this->__identify_padding(__nar, __ne, __iob);
|
||||
// Stage 2 - Widen __nar while adding thousands separators
|
||||
@@ -1568,7 +1702,11 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
+ ((numeric_limits<unsigned long long>::digits % 3) != 0)
|
||||
+ 1;
|
||||
char __nar[__nbuf];
|
||||
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
int __nc = sprintf_l(__nar, 0, __fmt, __v);
|
||||
#else
|
||||
int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
|
||||
#endif
|
||||
char* __ne = __nar + __nc;
|
||||
char* __np = this->__identify_padding(__nar, __ne, __iob);
|
||||
// Stage 2 - Widen __nar while adding thousands separators
|
||||
@@ -1595,18 +1733,35 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
char* __nb = __nar;
|
||||
int __nc;
|
||||
if (__specify_precision)
|
||||
__nc = __nolocale_snprintf(__nb, __nbuf, __fmt,
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
__nc = snprintf_l(__nb, __nbuf, 0, __fmt,
|
||||
(int)__iob.precision(), __v);
|
||||
#else
|
||||
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt,
|
||||
(int)__iob.precision(), __v);
|
||||
#endif
|
||||
else
|
||||
__nc = __nolocale_snprintf(__nb, __nbuf, __fmt, __v);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
__nc = snprintf_l(__nb, __nbuf, 0, __fmt, __v);
|
||||
#else
|
||||
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt, __v);
|
||||
#endif
|
||||
unique_ptr<char, void(*)(void*)> __nbh(0, free);
|
||||
if (__nc > static_cast<int>(__nbuf-1))
|
||||
{
|
||||
if (__specify_precision)
|
||||
__nc = __nolocale_asprintf(&__nb, __fmt, (int)__iob.precision(),
|
||||
__v);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
__nc = asprintf_l(&__nb, 0, __fmt, (int)__iob.precision(), __v);
|
||||
#else
|
||||
__nc = __asprintf_l(&__nb, __cloc(), __fmt,
|
||||
(int)__iob.precision());
|
||||
#endif
|
||||
else
|
||||
__nc = __nolocale_asprintf(&__nb, __fmt, __v);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
__nc = asprintf_l(&__nb, 0, __fmt, __v);
|
||||
#else
|
||||
__nc = __asprintf_l(&__nb, __cloc(), __fmt, (int)__iob.precision());
|
||||
#endif
|
||||
if (__nb == 0)
|
||||
__throw_bad_alloc();
|
||||
__nbh.reset(__nb);
|
||||
@@ -1647,18 +1802,35 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
char* __nb = __nar;
|
||||
int __nc;
|
||||
if (__specify_precision)
|
||||
__nc = __nolocale_snprintf(__nb, __nbuf, __fmt,
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
__nc = snprintf_l(__nb, __nbuf, 0, __fmt,
|
||||
(int)__iob.precision(), __v);
|
||||
#else
|
||||
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt,
|
||||
(int)__iob.precision(), __v);
|
||||
#endif
|
||||
else
|
||||
__nc = __nolocale_snprintf(__nb, __nbuf, __fmt, __v);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
__nc = snprintf_l(__nb, __nbuf, 0, __fmt, __v);
|
||||
#else
|
||||
__nc = __snprintf_l(__nb, __nbuf, __cloc(), __fmt, __v);
|
||||
#endif
|
||||
unique_ptr<char, void(*)(void*)> __nbh(0, free);
|
||||
if (__nc > static_cast<int>(__nbuf-1))
|
||||
{
|
||||
if (__specify_precision)
|
||||
__nc = __nolocale_asprintf(&__nb, __fmt, (int)__iob.precision(),
|
||||
__v);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
__nc = asprintf_l(&__nb, 0, __fmt, (int)__iob.precision(), __v);
|
||||
#else
|
||||
__nc = __asprintf_l(&__nb, __cloc(), __fmt,
|
||||
(int)__iob.precision());
|
||||
#endif
|
||||
else
|
||||
__nc = __nolocale_asprintf(&__nb, __fmt, __v);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
__nc = asprintf_l(&__nb, 0, __fmt, __v);
|
||||
#else
|
||||
__nc = __asprintf_l(&__nb, __cloc(), __fmt, (int)__iob.precision());
|
||||
#endif
|
||||
if (__nb == 0)
|
||||
__throw_bad_alloc();
|
||||
__nbh.reset(__nb);
|
||||
@@ -1694,7 +1866,11 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
char __fmt[6] = "%p";
|
||||
const unsigned __nbuf = 20;
|
||||
char __nar[__nbuf];
|
||||
int __nc = __nolocale_sprintf(__nar, __fmt, __v);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
int __nc = sprintf_l(__nar, 0, __fmt, __v);
|
||||
#else
|
||||
int __nc = __sprintf_l(__nar, __cloc(), __fmt, __v);
|
||||
#endif
|
||||
char* __ne = __nar + __nc;
|
||||
char* __np = this->__identify_padding(__nar, __ne, __iob);
|
||||
// Stage 2 - Widen __nar
|
||||
@@ -1756,7 +1932,7 @@ public:
|
||||
};
|
||||
|
||||
template <class _CharT>
|
||||
class __time_get_c_storage
|
||||
class __time_get_c_storage // purposefully not decorated
|
||||
{
|
||||
protected:
|
||||
typedef basic_string<_CharT> string_type;
|
||||
@@ -2306,6 +2482,12 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
|
||||
__b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0]));
|
||||
}
|
||||
break;
|
||||
case 'F':
|
||||
{
|
||||
const char_type __fmt[] = {'%', 'Y', '-', '%', 'm', '-', '%', 'd'};
|
||||
__b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0]));
|
||||
}
|
||||
break;
|
||||
case 'H':
|
||||
__get_hour(__tm->tm_hour, __b, __e, __err, __ct);
|
||||
break;
|
||||
@@ -2465,7 +2647,11 @@ class __time_put
|
||||
{
|
||||
locale_t __loc_;
|
||||
protected:
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
_LIBCPP_ALWAYS_INLINE __time_put() : __loc_(0) {}
|
||||
#else // _LIBCPP_STABLE_APPLE_ABI
|
||||
_LIBCPP_ALWAYS_INLINE __time_put() : __loc_(__cloc()) {}
|
||||
#endif // _LIBCPP_STABLE_APPLE_ABI
|
||||
__time_put(const char* __nm);
|
||||
__time_put(const string& __nm);
|
||||
~__time_put();
|
||||
@@ -2568,7 +2754,7 @@ time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
char_type* __nb = __nar;
|
||||
char_type* __ne = __nb + 100;
|
||||
__do_put(__nb, __ne, __tm, __fmt, __mod);
|
||||
return copy(__nb, __ne, __s);
|
||||
return _VSTD::copy(__nb, __ne, __s);
|
||||
}
|
||||
|
||||
extern template class time_put<char>;
|
||||
@@ -2638,24 +2824,15 @@ protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~moneypunct() {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual char_type do_decimal_point() const {return numeric_limits<char_type>::max();}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual char_type do_thousands_sep() const {return numeric_limits<char_type>::max();}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual string do_grouping() const {return string();}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual string_type do_curr_symbol() const {return string_type();}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual string_type do_positive_sign() const {return string_type();}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual string_type do_negative_sign() const {return string_type(1, '-');}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual int do_frac_digits() const {return 0;}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual pattern do_pos_format() const
|
||||
{pattern __p = {symbol, sign, none, value}; return __p;}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual pattern do_neg_format() const
|
||||
{pattern __p = {symbol, sign, none, value}; return __p;}
|
||||
};
|
||||
@@ -2692,23 +2869,14 @@ protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~moneypunct_byname() {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual char_type do_decimal_point() const {return __decimal_point_;}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual char_type do_thousands_sep() const {return __thousands_sep_;}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual string do_grouping() const {return __grouping_;}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual string_type do_curr_symbol() const {return __curr_symbol_;}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual string_type do_positive_sign() const {return __positive_sign_;}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual string_type do_negative_sign() const {return __negative_sign_;}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual int do_frac_digits() const {return __frac_digits_;}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual pattern do_pos_format() const {return __pos_format_;}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
virtual pattern do_neg_format() const {return __neg_format_;}
|
||||
|
||||
private:
|
||||
@@ -3254,7 +3422,7 @@ __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __m
|
||||
break;
|
||||
case money_base::symbol:
|
||||
if (!__sym.empty() && (__flags & ios_base::showbase))
|
||||
__me = copy(__sym.begin(), __sym.end(), __me);
|
||||
__me = _VSTD::copy(__sym.begin(), __sym.end(), __me);
|
||||
break;
|
||||
case money_base::value:
|
||||
{
|
||||
@@ -3313,7 +3481,7 @@ __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __m
|
||||
}
|
||||
// print rest of sign, if any
|
||||
if (__sn.size() > 1)
|
||||
__me = copy(__sn.begin()+1, __sn.end(), __me);
|
||||
__me = _VSTD::copy(__sn.begin()+1, __sn.end(), __me);
|
||||
// set alignment
|
||||
if ((__flags & ios_base::adjustfield) == ios_base::left)
|
||||
__mi = __me;
|
||||
@@ -3386,7 +3554,11 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
|
||||
// secure memory for digit storage
|
||||
if (__n > __bs-1)
|
||||
{
|
||||
__n = __nolocale_asprintf(&__bb, "%.0Lf", __units);
|
||||
#ifdef _LIBCPP_STABLE_APPLE_ABI
|
||||
__n = asprintf_l(&__bb, 0, "%.0Lf", __units);
|
||||
#else
|
||||
__n = __asprintf_l(&__bb, __cloc(), "%.0Lf", __units);
|
||||
#endif
|
||||
if (__bb == 0)
|
||||
__throw_bad_alloc();
|
||||
__hn.reset(__bb);
|
||||
@@ -3480,7 +3652,7 @@ extern template class money_put<wchar_t>;
|
||||
class _LIBCPP_VISIBLE messages_base
|
||||
{
|
||||
public:
|
||||
typedef nl_catd catalog;
|
||||
typedef ptrdiff_t catalog;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE messages_base() {}
|
||||
};
|
||||
@@ -3537,7 +3709,10 @@ template <class _CharT>
|
||||
typename messages<_CharT>::catalog
|
||||
messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const
|
||||
{
|
||||
return catopen(__nm.c_str(), NL_CAT_LOCALE);
|
||||
catalog __cat = reinterpret_cast<catalog>(catopen(__nm.c_str(), NL_CAT_LOCALE));
|
||||
if (__cat != -1)
|
||||
__cat = static_cast<catalog>((static_cast<size_t>(__cat) >> 1));
|
||||
return __cat;
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
@@ -3549,7 +3724,10 @@ messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
|
||||
__narrow_to_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__ndflt),
|
||||
__dflt.c_str(),
|
||||
__dflt.c_str() + __dflt.size());
|
||||
char* __n = catgets(__c, __set, __msgid, __ndflt.c_str());
|
||||
if (__c != -1)
|
||||
__c <<= 1;
|
||||
nl_catd __cat = reinterpret_cast<nl_catd>(__c);
|
||||
char* __n = catgets(__cat, __set, __msgid, __ndflt.c_str());
|
||||
string_type __w;
|
||||
__widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__w),
|
||||
__n, __n + strlen(__n));
|
||||
@@ -3560,7 +3738,10 @@ template <class _CharT>
|
||||
void
|
||||
messages<_CharT>::do_close(catalog __c) const
|
||||
{
|
||||
catclose(__c);
|
||||
if (__c != -1)
|
||||
__c <<= 1;
|
||||
nl_catd __cat = reinterpret_cast<nl_catd>(__c);
|
||||
catclose(__cat);
|
||||
}
|
||||
|
||||
extern template class messages<char>;
|
||||
@@ -3679,8 +3860,8 @@ template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
|
||||
wstring_convert(wstring_convert&& __wc)
|
||||
: __byte_err_string_(_STD::move(__wc.__byte_err_string_)),
|
||||
__wide_err_string_(_STD::move(__wc.__wide_err_string_)),
|
||||
: __byte_err_string_(_VSTD::move(__wc.__byte_err_string_)),
|
||||
__wide_err_string_(_VSTD::move(__wc.__wide_err_string_)),
|
||||
__cvtptr_(__wc.__cvtptr_),
|
||||
__cvtstate_(__wc.__cvtstate_), __cvtcount_(__wc.__cvtstate_)
|
||||
{
|
||||
@@ -3973,7 +4154,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow()
|
||||
memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
|
||||
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
|
||||
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
|
||||
streamsize __nmemb = min(static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz),
|
||||
streamsize __nmemb = _VSTD::min(static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz),
|
||||
static_cast<streamsize>(__extbufend_ - __extbufnext_));
|
||||
codecvt_base::result __r;
|
||||
state_type __svs = __st_;
|
||||
|
||||
438
include/map
438
include/map
@@ -54,7 +54,11 @@ public:
|
||||
};
|
||||
|
||||
// construct/copy/destroy:
|
||||
map();
|
||||
map()
|
||||
noexcept(
|
||||
is_nothrow_default_constructible<allocator_type>::value &&
|
||||
is_nothrow_default_constructible<key_compare>::value &&
|
||||
is_nothrow_copy_constructible<key_compare>::value);
|
||||
explicit map(const key_compare& comp);
|
||||
map(const key_compare& comp, const allocator_type& a);
|
||||
template <class InputIterator>
|
||||
@@ -64,7 +68,10 @@ public:
|
||||
map(InputIterator first, InputIterator last,
|
||||
const key_compare& comp, const allocator_type& a);
|
||||
map(const map& m);
|
||||
map(map&& m);
|
||||
map(map&& m)
|
||||
noexcept(
|
||||
is_nothrow_move_constructible<allocator_type>::value &&
|
||||
is_nothrow_move_constructible<key_compare>::value);
|
||||
explicit map(const allocator_type& a);
|
||||
map(const map& m, const allocator_type& a);
|
||||
map(map&& m, const allocator_type& a);
|
||||
@@ -73,29 +80,33 @@ public:
|
||||
~map();
|
||||
|
||||
map& operator=(const map& m);
|
||||
map& operator=(map&& m);
|
||||
map& operator=(map&& m)
|
||||
noexcept(
|
||||
allocator_type::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value &&
|
||||
is_nothrow_move_assignable<key_compare>::value);
|
||||
map& operator=(initializer_list<value_type> il);
|
||||
|
||||
// iterators:
|
||||
iterator begin();
|
||||
const_iterator begin() const;
|
||||
iterator end();
|
||||
const_iterator end() const;
|
||||
iterator begin() noexcept;
|
||||
const_iterator begin() const noexcept;
|
||||
iterator end() noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
|
||||
reverse_iterator rbegin();
|
||||
const_reverse_iterator rbegin() const;
|
||||
reverse_iterator rend();
|
||||
const_reverse_iterator rend() const;
|
||||
reverse_iterator rbegin() noexcept;
|
||||
const_reverse_iterator rbegin() const noexcept;
|
||||
reverse_iterator rend() noexcept;
|
||||
const_reverse_iterator rend() const noexcept;
|
||||
|
||||
const_iterator cbegin() const;
|
||||
const_iterator cend() const;
|
||||
const_reverse_iterator crbegin() const;
|
||||
const_reverse_iterator crend() const;
|
||||
const_iterator cbegin() const noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
const_reverse_iterator crbegin() const noexcept;
|
||||
const_reverse_iterator crend() const noexcept;
|
||||
|
||||
// capacity:
|
||||
bool empty() const;
|
||||
size_type size() const;
|
||||
size_type max_size() const;
|
||||
bool empty() const noexcept;
|
||||
size_type size() const noexcept;
|
||||
size_type max_size() const noexcept;
|
||||
|
||||
// element access:
|
||||
mapped_type& operator[](const key_type& k);
|
||||
@@ -122,12 +133,16 @@ public:
|
||||
iterator erase(const_iterator position);
|
||||
size_type erase(const key_type& k);
|
||||
iterator erase(const_iterator first, const_iterator last);
|
||||
void clear();
|
||||
void clear() noexcept;
|
||||
|
||||
void swap(map& m);
|
||||
void swap(map& m)
|
||||
noexcept(
|
||||
__is_nothrow_swappable<key_compare>::value &&
|
||||
(!allocator_type::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value));
|
||||
|
||||
// observers:
|
||||
allocator_type get_allocator() const;
|
||||
allocator_type get_allocator() const noexcept;
|
||||
key_compare key_comp() const;
|
||||
value_compare value_comp() const;
|
||||
|
||||
@@ -176,7 +191,8 @@ operator<=(const map<Key, T, Compare, Allocator>& x,
|
||||
// specialized algorithms:
|
||||
template <class Key, class T, class Compare, class Allocator>
|
||||
void
|
||||
swap(map<Key, T, Compare, Allocator>& x, map<Key, T, Compare, Allocator>& y);
|
||||
swap(map<Key, T, Compare, Allocator>& x, map<Key, T, Compare, Allocator>& y)
|
||||
noexcept(noexcept(x.swap(y)));
|
||||
|
||||
template <class Key, class T, class Compare = less<Key>,
|
||||
class Allocator = allocator<pair<const Key, T>>>
|
||||
@@ -213,7 +229,12 @@ public:
|
||||
};
|
||||
|
||||
// construct/copy/destroy:
|
||||
explicit multimap(const key_compare& comp = key_compare());
|
||||
multimap()
|
||||
noexcept(
|
||||
is_nothrow_default_constructible<allocator_type>::value &&
|
||||
is_nothrow_default_constructible<key_compare>::value &&
|
||||
is_nothrow_copy_constructible<key_compare>::value);
|
||||
explicit multimap(const key_compare& comp);
|
||||
multimap(const key_compare& comp, const allocator_type& a);
|
||||
template <class InputIterator>
|
||||
multimap(InputIterator first, InputIterator last, const key_compare& comp);
|
||||
@@ -221,7 +242,10 @@ public:
|
||||
multimap(InputIterator first, InputIterator last, const key_compare& comp,
|
||||
const allocator_type& a);
|
||||
multimap(const multimap& m);
|
||||
multimap(multimap&& m);
|
||||
multimap(multimap&& m)
|
||||
noexcept(
|
||||
is_nothrow_move_constructible<allocator_type>::value &&
|
||||
is_nothrow_move_constructible<key_compare>::value);
|
||||
explicit multimap(const allocator_type& a);
|
||||
multimap(const multimap& m, const allocator_type& a);
|
||||
multimap(multimap&& m, const allocator_type& a);
|
||||
@@ -231,29 +255,33 @@ public:
|
||||
~multimap();
|
||||
|
||||
multimap& operator=(const multimap& m);
|
||||
multimap& operator=(multimap&& m);
|
||||
multimap& operator=(multimap&& m)
|
||||
noexcept(
|
||||
allocator_type::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value &&
|
||||
is_nothrow_move_assignable<key_compare>::value);
|
||||
multimap& operator=(initializer_list<value_type> il);
|
||||
|
||||
// iterators:
|
||||
iterator begin();
|
||||
const_iterator begin() const;
|
||||
iterator end();
|
||||
const_iterator end() const;
|
||||
iterator begin() noexcept;
|
||||
const_iterator begin() const noexcept;
|
||||
iterator end() noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
|
||||
reverse_iterator rbegin();
|
||||
const_reverse_iterator rbegin() const;
|
||||
reverse_iterator rend();
|
||||
const_reverse_iterator rend() const;
|
||||
reverse_iterator rbegin() noexcept;
|
||||
const_reverse_iterator rbegin() const noexcept;
|
||||
reverse_iterator rend() noexcept;
|
||||
const_reverse_iterator rend() const noexcept;
|
||||
|
||||
const_iterator cbegin() const;
|
||||
const_iterator cend() const;
|
||||
const_reverse_iterator crbegin() const;
|
||||
const_reverse_iterator crend() const;
|
||||
const_iterator cbegin() const noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
const_reverse_iterator crbegin() const noexcept;
|
||||
const_reverse_iterator crend() const noexcept;
|
||||
|
||||
// capacity:
|
||||
bool empty() const;
|
||||
size_type size() const;
|
||||
size_type max_size() const;
|
||||
bool empty() const noexcept;
|
||||
size_type size() const noexcept;
|
||||
size_type max_size() const noexcept;
|
||||
|
||||
// modifiers:
|
||||
template <class... Args>
|
||||
@@ -273,12 +301,16 @@ public:
|
||||
iterator erase(const_iterator position);
|
||||
size_type erase(const key_type& k);
|
||||
iterator erase(const_iterator first, const_iterator last);
|
||||
void clear();
|
||||
void clear() noexcept;
|
||||
|
||||
void swap(multimap& m);
|
||||
void swap(multimap& m)
|
||||
noexcept(
|
||||
__is_nothrow_swappable<key_compare>::value &&
|
||||
(!allocator_type::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value));
|
||||
|
||||
// observers:
|
||||
allocator_type get_allocator() const;
|
||||
allocator_type get_allocator() const noexcept;
|
||||
key_compare key_comp() const;
|
||||
value_compare value_comp() const;
|
||||
|
||||
@@ -328,7 +360,8 @@ operator<=(const multimap<Key, T, Compare, Allocator>& x,
|
||||
template <class Key, class T, class Compare, class Allocator>
|
||||
void
|
||||
swap(multimap<Key, T, Compare, Allocator>& x,
|
||||
multimap<Key, T, Compare, Allocator>& y);
|
||||
multimap<Key, T, Compare, Allocator>& y)
|
||||
noexcept(noexcept(x.swap(y)));
|
||||
|
||||
} // std
|
||||
|
||||
@@ -350,15 +383,19 @@ template <class _Key, class _Tp, class _Compare, bool = is_empty<_Compare>::valu
|
||||
class __map_value_compare
|
||||
: private _Compare
|
||||
{
|
||||
typedef pair<_Key, _Tp> _P;
|
||||
typedef pair<typename std::remove_const<_Key>::type, _Tp> _P;
|
||||
typedef pair<const _Key, _Tp> _CP;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__map_value_compare() : _Compare() {}
|
||||
__map_value_compare()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value)
|
||||
: _Compare() {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__map_value_compare(_Compare c) : _Compare(c) {}
|
||||
__map_value_compare(_Compare c)
|
||||
_NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value)
|
||||
: _Compare(c) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const _Compare& key_comp() const {return *this;}
|
||||
const _Compare& key_comp() const _NOEXCEPT {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _CP& __x, const _CP& __y) const
|
||||
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
|
||||
@@ -393,16 +430,20 @@ class __map_value_compare<_Key, _Tp, _Compare, false>
|
||||
{
|
||||
_Compare comp;
|
||||
|
||||
typedef pair<_Key, _Tp> _P;
|
||||
typedef pair<typename std::remove_const<_Key>::type, _Tp> _P;
|
||||
typedef pair<const _Key, _Tp> _CP;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__map_value_compare() : comp() {}
|
||||
__map_value_compare()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<_Compare>::value)
|
||||
: comp() {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__map_value_compare(_Compare c) : comp(c) {}
|
||||
__map_value_compare(_Compare c)
|
||||
_NOEXCEPT_(is_nothrow_copy_constructible<_Compare>::value)
|
||||
: comp(c) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const _Compare& key_comp() const {return comp;}
|
||||
const _Compare& key_comp() const _NOEXCEPT {return comp;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _CP& __x, const _CP& __y) const
|
||||
@@ -454,7 +495,7 @@ public:
|
||||
bool __second_constructed;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __map_node_destructor(allocator_type& __na)
|
||||
explicit __map_node_destructor(allocator_type& __na) _NOEXCEPT
|
||||
: __na_(__na),
|
||||
__first_constructed(false),
|
||||
__second_constructed(false)
|
||||
@@ -462,7 +503,7 @@ public:
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__map_node_destructor(__tree_node_destructor<allocator_type>&& __x)
|
||||
__map_node_destructor(__tree_node_destructor<allocator_type>&& __x) _NOEXCEPT
|
||||
: __na_(__x.__na_),
|
||||
__first_constructed(__x.__value_constructed),
|
||||
__second_constructed(__x.__value_constructed)
|
||||
@@ -472,20 +513,22 @@ public:
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void operator()(pointer __p)
|
||||
void operator()(pointer __p) _NOEXCEPT
|
||||
{
|
||||
if (__second_constructed)
|
||||
__alloc_traits::destroy(__na_, addressof(__p->__value_.second));
|
||||
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.second));
|
||||
if (__first_constructed)
|
||||
__alloc_traits::destroy(__na_, addressof(__p->__value_.first));
|
||||
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.first));
|
||||
if (__p)
|
||||
__alloc_traits::deallocate(__na_, __p, 1);
|
||||
}
|
||||
};
|
||||
|
||||
template <class, class, class, class> class map;
|
||||
template <class, class, class, class> class multimap;
|
||||
template <class> class __map_const_iterator;
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
class map;
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
class multimap;
|
||||
template <class _TreeIterator> class __map_const_iterator;
|
||||
|
||||
template <class _TreeIterator>
|
||||
class _LIBCPP_VISIBLE __map_iterator
|
||||
@@ -493,11 +536,11 @@ class _LIBCPP_VISIBLE __map_iterator
|
||||
_TreeIterator __i_;
|
||||
|
||||
typedef typename _TreeIterator::__pointer_traits __pointer_traits;
|
||||
typedef const typename _TreeIterator::value_type::first_type key_type;
|
||||
typedef typename _TreeIterator::value_type::second_type mapped_type;
|
||||
typedef const typename _TreeIterator::value_type::first_type __key_type;
|
||||
typedef typename _TreeIterator::value_type::second_type __mapped_type;
|
||||
public:
|
||||
typedef bidirectional_iterator_tag iterator_category;
|
||||
typedef pair<key_type, mapped_type> value_type;
|
||||
typedef pair<__key_type, __mapped_type> value_type;
|
||||
typedef typename _TreeIterator::difference_type difference_type;
|
||||
typedef value_type& reference;
|
||||
typedef typename __pointer_traits::template
|
||||
@@ -509,10 +552,10 @@ public:
|
||||
pointer;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__map_iterator() {}
|
||||
__map_iterator() _NOEXCEPT {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__map_iterator(_TreeIterator __i) : __i_(__i) {}
|
||||
__map_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {return *operator->();}
|
||||
@@ -558,29 +601,30 @@ class _LIBCPP_VISIBLE __map_const_iterator
|
||||
_TreeIterator __i_;
|
||||
|
||||
typedef typename _TreeIterator::__pointer_traits __pointer_traits;
|
||||
typedef const typename _TreeIterator::value_type::first_type key_type;
|
||||
typedef typename _TreeIterator::value_type::second_type mapped_type;
|
||||
typedef const typename _TreeIterator::value_type::first_type __key_type;
|
||||
typedef typename _TreeIterator::value_type::second_type __mapped_type;
|
||||
public:
|
||||
typedef bidirectional_iterator_tag iterator_category;
|
||||
typedef pair<key_type, mapped_type> value_type;
|
||||
typedef pair<__key_type, __mapped_type> value_type;
|
||||
typedef typename _TreeIterator::difference_type difference_type;
|
||||
typedef const value_type& reference;
|
||||
typedef typename __pointer_traits::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind<value_type>
|
||||
rebind<const value_type>
|
||||
#else
|
||||
rebind<value_type>::other
|
||||
rebind<const value_type>::other
|
||||
#endif
|
||||
pointer;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__map_const_iterator() {}
|
||||
__map_const_iterator() _NOEXCEPT {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__map_const_iterator(_TreeIterator __i) : __i_(__i) {}
|
||||
__map_const_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__map_const_iterator(
|
||||
__map_iterator<typename _TreeIterator::__non_const_iterator> __i)
|
||||
_NOEXCEPT
|
||||
: __i_(__i.__i_) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -671,11 +715,15 @@ public:
|
||||
typedef typename __alloc_traits::difference_type difference_type;
|
||||
typedef __map_iterator<typename __base::iterator> iterator;
|
||||
typedef __map_const_iterator<typename __base::const_iterator> const_iterator;
|
||||
typedef _STD::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit map(const key_compare& __comp = key_compare())
|
||||
_NOEXCEPT_(
|
||||
is_nothrow_default_constructible<allocator_type>::value &&
|
||||
is_nothrow_default_constructible<key_compare>::value &&
|
||||
is_nothrow_copy_constructible<key_compare>::value)
|
||||
: __tree_(__vc(__comp)) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -707,11 +755,19 @@ public:
|
||||
insert(__m.begin(), __m.end());
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
map& operator=(const map& __m)
|
||||
{
|
||||
__tree_ = __m.__tree_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
map(map&& __m)
|
||||
: __tree_(_STD::move(__m.__tree_))
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
|
||||
: __tree_(_VSTD::move(__m.__tree_))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -733,8 +789,9 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
map& operator=(map&& __m)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
|
||||
{
|
||||
__tree_ = _STD::move(__m.__tree_);
|
||||
__tree_ = _VSTD::move(__m.__tree_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -761,38 +818,41 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return __tree_.begin();}
|
||||
iterator begin() _NOEXCEPT {return __tree_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return __tree_.begin();}
|
||||
const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return __tree_.end();}
|
||||
iterator end() _NOEXCEPT {return __tree_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return __tree_.end();}
|
||||
const_iterator end() const _NOEXCEPT {return __tree_.end();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reverse_iterator rbegin() {return reverse_iterator(end());}
|
||||
reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
|
||||
const_reverse_iterator rbegin() const _NOEXCEPT
|
||||
{return const_reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reverse_iterator rend() {return reverse_iterator(begin());}
|
||||
reverse_iterator rend() _NOEXCEPT
|
||||
{return reverse_iterator(begin());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
|
||||
const_reverse_iterator rend() const _NOEXCEPT
|
||||
{return const_reverse_iterator(begin());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cbegin() const {return begin();}
|
||||
const_iterator cbegin() const _NOEXCEPT {return begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cend() const {return end();}
|
||||
const_iterator cend() const _NOEXCEPT {return end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crbegin() const {return rbegin();}
|
||||
const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crend() const {return rend();}
|
||||
const_reverse_iterator crend() const _NOEXCEPT {return rend();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return __tree_.size() == 0;}
|
||||
bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return __tree_.size();}
|
||||
size_type size() const _NOEXCEPT {return __tree_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const {return __tree_.max_size();}
|
||||
size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
|
||||
|
||||
mapped_type& operator[](const key_type& __k);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -803,7 +863,7 @@ public:
|
||||
const mapped_type& at(const key_type& __k) const;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const {return __tree_.__alloc();}
|
||||
allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
key_compare key_comp() const {return __tree_.value_comp().key_comp();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -816,16 +876,16 @@ public:
|
||||
emplace() {return __tree_.__emplace_unique();}
|
||||
|
||||
template <class _A0,
|
||||
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool>
|
||||
emplace(_A0&& __a0)
|
||||
{return __tree_.__emplace_unique(_STD::forward<_A0>(__a0));}
|
||||
{return __tree_.__emplace_unique(_VSTD::forward<_A0>(__a0));}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _A0, class ..._Args,
|
||||
class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
|
||||
pair<iterator, bool>
|
||||
emplace(_A0&& __a0, _Args&& ...__args);
|
||||
|
||||
@@ -837,32 +897,32 @@ public:
|
||||
{return __tree_.__emplace_hint_unique(__p.__i_);}
|
||||
|
||||
template <class _A0,
|
||||
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator
|
||||
emplace_hint(const_iterator __p, _A0&& __a0)
|
||||
{return __tree_.__emplace_hint_unique(__p.__i_, _STD::forward<_A0>(__a0));}
|
||||
{return __tree_.__emplace_hint_unique(__p.__i_, _VSTD::forward<_A0>(__a0));}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _A0, class ..._Args,
|
||||
class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
|
||||
iterator
|
||||
emplace_hint(const_iterator __p, _A0&& __a0, _Args&& ...__args);
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _P,
|
||||
class = typename enable_if<is_convertible<_P, value_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<value_type, _P>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> insert(_P&& __p)
|
||||
{return __tree_.__insert_unique(_STD::forward<_P>(__p));}
|
||||
{return __tree_.__insert_unique(_VSTD::forward<_P>(__p));}
|
||||
|
||||
template <class _P,
|
||||
class = typename enable_if<is_convertible<_P, value_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<value_type, _P>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __pos, _P&& __p)
|
||||
{return __tree_.__insert_unique(__pos.__i_, _STD::forward<_P>(__p));}
|
||||
{return __tree_.__insert_unique(__pos.__i_, _VSTD::forward<_P>(__p));}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
@@ -896,10 +956,12 @@ public:
|
||||
iterator erase(const_iterator __f, const_iterator __l)
|
||||
{return __tree_.erase(__f.__i_, __l.__i_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() {__tree_.clear();}
|
||||
void clear() _NOEXCEPT {__tree_.clear();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(map& __m) {__tree_.swap(__m.__tree_);}
|
||||
void swap(map& __m)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<__base>::value)
|
||||
{__tree_.swap(__m.__tree_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator find(const key_type& __k) {return __tree_.find(__k);}
|
||||
@@ -940,11 +1002,11 @@ private:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__node_holder __construct_node();
|
||||
template <class _A0,
|
||||
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
|
||||
__node_holder __construct_node(_A0&& __a0);
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class _A0, class ..._Args,
|
||||
class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
|
||||
__node_holder __construct_node(_A0&& __a0, _Args&& ...__args);
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -1042,7 +1104,7 @@ map<_Key, _Tp, _Compare, _Allocator>::__find_equal_key(const_iterator __hint,
|
||||
else if (__tree_.value_comp().key_comp()(__hint->first, __k)) // check after
|
||||
{
|
||||
// *__hint < __k
|
||||
const_iterator __next = next(__hint);
|
||||
const_iterator __next = _VSTD::next(__hint);
|
||||
if (__next == end() || __tree_.value_comp().key_comp()(__k, __next->first))
|
||||
{
|
||||
// *__hint < __k < *next(__hint)
|
||||
@@ -1114,14 +1176,14 @@ map<_Key, _Tp, _Compare, _Allocator>::__find_equal_key(__node_base_const_pointer
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
map<_Key, _Tp, _Compare, _Allocator>::map(map&& __m, const allocator_type& __a)
|
||||
: __tree_(_STD::move(__m.__tree_), __a)
|
||||
: __tree_(_VSTD::move(__m.__tree_), __a)
|
||||
{
|
||||
if (__a != __m.get_allocator())
|
||||
{
|
||||
const_iterator __e = cend();
|
||||
while (!__m.empty())
|
||||
__tree_.__insert_unique(__e.__i_,
|
||||
_STD::move(__m.__tree_.remove(__m.begin().__i_)->__value_));
|
||||
_VSTD::move(__m.__tree_.remove(__m.begin().__i_)->__value_));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1131,9 +1193,9 @@ map<_Key, _Tp, _Compare, _Allocator>::__construct_node()
|
||||
{
|
||||
__node_allocator& __na = __tree_.__node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_traits::construct(__na, addressof(__h->__value_.first));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first));
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__node_traits::construct(__na, addressof(__h->__value_.second));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return __h;
|
||||
}
|
||||
@@ -1146,7 +1208,7 @@ map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
|
||||
{
|
||||
__node_allocator& __na = __tree_.__node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_traits::construct(__na, addressof(__h->__value_), _STD::forward<_A0>(__a0));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_A0>(__a0));
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return __h;
|
||||
@@ -1162,9 +1224,9 @@ map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&& ...__
|
||||
{
|
||||
__node_allocator& __na = __tree_.__node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_traits::construct(__na, addressof(__h->__value_.first), _STD::forward<_A0>(__a0));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0));
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__node_traits::construct(__na, addressof(__h->__value_.second), _STD::forward<_Args>(__args)...);
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second), _VSTD::forward<_Args>(__args)...);
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return __h;
|
||||
}
|
||||
@@ -1179,11 +1241,11 @@ map<_Key, _Tp, _Compare, _Allocator>::__construct_node(const key_type& __k)
|
||||
{
|
||||
__node_allocator& __na = __tree_.__node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_traits::construct(__na, addressof(__h->__value_.first), __k);
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k);
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__node_traits::construct(__na, addressof(__h->__value_.second));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return _STD::move(__h);
|
||||
return _VSTD::move(__h);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -1215,7 +1277,7 @@ map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k)
|
||||
__node_pointer __r = static_cast<__node_pointer>(__child);
|
||||
if (__child == nullptr)
|
||||
{
|
||||
__node_holder __h = __construct_node(_STD::move(__k));
|
||||
__node_holder __h = __construct_node(_VSTD::move(__k));
|
||||
__tree_.__insert_node_at(__parent, __child, __h.get());
|
||||
__r = __h.release();
|
||||
}
|
||||
@@ -1254,13 +1316,13 @@ map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
template <class _A0, class ..._Args,
|
||||
class //= typename enable_if<is_convertible<_A0, _Key>::value>::type
|
||||
class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
|
||||
>
|
||||
pair<typename map<_Key, _Tp, _Compare, _Allocator>::iterator, bool>
|
||||
map<_Key, _Tp, _Compare, _Allocator>::emplace(_A0&& __a0, _Args&& ...__args)
|
||||
{
|
||||
__node_holder __h = __construct_node(_STD::forward<_A0>(__a0),
|
||||
_STD::forward<_Args>(__args)...);
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
pair<iterator, bool> __r = __tree_.__node_insert_unique(__h.get());
|
||||
if (__r.second)
|
||||
__h.release();
|
||||
@@ -1269,14 +1331,14 @@ map<_Key, _Tp, _Compare, _Allocator>::emplace(_A0&& __a0, _Args&& ...__args)
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
template <class _A0, class ..._Args,
|
||||
class //= typename enable_if<is_convertible<_A0, _Key>::value>::type
|
||||
class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
|
||||
>
|
||||
typename map<_Key, _Tp, _Compare, _Allocator>::iterator
|
||||
map<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p,
|
||||
_A0&& __a0, _Args&& ...__args)
|
||||
{
|
||||
__node_holder __h = __construct_node(_STD::forward<_A0>(__a0),
|
||||
_STD::forward<_Args>(__args)...);
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
iterator __r = __tree_.__node_insert_unique(__p.__i_, __h.get());
|
||||
if (__r.__i_.__ptr_ == __h.get())
|
||||
__h.release();
|
||||
@@ -1291,7 +1353,7 @@ bool
|
||||
operator==(const map<_Key, _Tp, _Compare, _Allocator>& __x,
|
||||
const map<_Key, _Tp, _Compare, _Allocator>& __y)
|
||||
{
|
||||
return __x.size() == __y.size() && _STD::equal(__x.begin(), __x.end(), __y.begin());
|
||||
return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
@@ -1300,7 +1362,7 @@ bool
|
||||
operator< (const map<_Key, _Tp, _Compare, _Allocator>& __x,
|
||||
const map<_Key, _Tp, _Compare, _Allocator>& __y)
|
||||
{
|
||||
return _STD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
|
||||
return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
@@ -1344,6 +1406,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(map<_Key, _Tp, _Compare, _Allocator>& __x,
|
||||
map<_Key, _Tp, _Compare, _Allocator>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
@@ -1400,11 +1463,15 @@ public:
|
||||
typedef typename __alloc_traits::difference_type difference_type;
|
||||
typedef __map_iterator<typename __base::iterator> iterator;
|
||||
typedef __map_const_iterator<typename __base::const_iterator> const_iterator;
|
||||
typedef _STD::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit multimap(const key_compare& __comp = key_compare())
|
||||
_NOEXCEPT_(
|
||||
is_nothrow_default_constructible<allocator_type>::value &&
|
||||
is_nothrow_default_constructible<key_compare>::value &&
|
||||
is_nothrow_copy_constructible<key_compare>::value)
|
||||
: __tree_(__vc(__comp)) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1437,11 +1504,19 @@ public:
|
||||
insert(__m.begin(), __m.end());
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
multimap& operator=(const multimap& __m)
|
||||
{
|
||||
__tree_ = __m.__tree_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
multimap(multimap&& __m)
|
||||
: __tree_(_STD::move(__m.__tree_))
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
|
||||
: __tree_(_VSTD::move(__m.__tree_))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1463,8 +1538,9 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
multimap& operator=(multimap&& __m)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
|
||||
{
|
||||
__tree_ = _STD::move(__m.__tree_);
|
||||
__tree_ = _VSTD::move(__m.__tree_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -1490,45 +1566,48 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return __tree_.begin();}
|
||||
iterator begin() _NOEXCEPT {return __tree_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return __tree_.begin();}
|
||||
const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return __tree_.end();}
|
||||
iterator end() _NOEXCEPT {return __tree_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return __tree_.end();}
|
||||
const_iterator end() const _NOEXCEPT {return __tree_.end();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reverse_iterator rbegin() {return reverse_iterator(end());}
|
||||
reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
|
||||
const_reverse_iterator rbegin() const _NOEXCEPT
|
||||
{return const_reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reverse_iterator rend() {return reverse_iterator(begin());}
|
||||
reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
|
||||
const_reverse_iterator rend() const _NOEXCEPT
|
||||
{return const_reverse_iterator(begin());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cbegin() const {return begin();}
|
||||
const_iterator cbegin() const _NOEXCEPT {return begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cend() const {return end();}
|
||||
const_iterator cend() const _NOEXCEPT {return end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crbegin() const {return rbegin();}
|
||||
const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crend() const {return rend();}
|
||||
const_reverse_iterator crend() const _NOEXCEPT {return rend();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return __tree_.size() == 0;}
|
||||
bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return __tree_.size();}
|
||||
size_type size() const _NOEXCEPT {return __tree_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const {return __tree_.max_size();}
|
||||
size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const {return __tree_.__alloc();}
|
||||
allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
key_compare key_comp() const {return __tree_.value_comp().key_comp();}
|
||||
key_compare key_comp() const {return __tree_.value_comp().key_comp();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_compare value_comp() const {return value_compare(__tree_.value_comp().key_comp());}
|
||||
value_compare value_comp() const
|
||||
{return value_compare(__tree_.value_comp().key_comp());}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
@@ -1536,16 +1615,16 @@ public:
|
||||
iterator emplace() {return __tree_.__emplace_multi();}
|
||||
|
||||
template <class _A0,
|
||||
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator
|
||||
emplace(_A0&& __a0)
|
||||
{return __tree_.__emplace_multi(_STD::forward<_A0>(__a0));}
|
||||
{return __tree_.__emplace_multi(_VSTD::forward<_A0>(__a0));}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _A0, class ..._Args,
|
||||
class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
|
||||
iterator
|
||||
emplace(_A0&& __a0, _Args&& ...__args);
|
||||
|
||||
@@ -1556,32 +1635,32 @@ public:
|
||||
{return __tree_.__emplace_hint_multi(__p.__i_);}
|
||||
|
||||
template <class _A0,
|
||||
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator
|
||||
emplace_hint(const_iterator __p, _A0&& __a0)
|
||||
{return __tree_.__emplace_hint_multi(__p.__i_, _STD::forward<_A0>(__a0));}
|
||||
{return __tree_.__emplace_hint_multi(__p.__i_, _VSTD::forward<_A0>(__a0));}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _A0, class ..._Args,
|
||||
class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
|
||||
iterator
|
||||
emplace_hint(const_iterator __p, _A0&& __a0, _Args&& ...__args);
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _P,
|
||||
class = typename enable_if<is_convertible<_P, value_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<value_type, _P>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(_P&& __p)
|
||||
{return __tree_.__insert_multi(_STD::forward<_P>(__p));}
|
||||
{return __tree_.__insert_multi(_VSTD::forward<_P>(__p));}
|
||||
|
||||
template <class _P,
|
||||
class = typename enable_if<is_convertible<_P, value_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<value_type, _P>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __pos, _P&& __p)
|
||||
{return __tree_.__insert_multi(__pos.__i_, _STD::forward<_P>(__p));}
|
||||
{return __tree_.__insert_multi(__pos.__i_, _VSTD::forward<_P>(__p));}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
@@ -1615,7 +1694,9 @@ public:
|
||||
void clear() {__tree_.clear();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(multimap& __m) {__tree_.swap(__m.__tree_);}
|
||||
void swap(multimap& __m)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<__base>::value)
|
||||
{__tree_.swap(__m.__tree_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator find(const key_type& __k) {return __tree_.find(__k);}
|
||||
@@ -1654,11 +1735,11 @@ private:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__node_holder __construct_node();
|
||||
template <class _A0,
|
||||
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
|
||||
__node_holder __construct_node(_A0&& __a0);
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class _A0, class ..._Args,
|
||||
class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
|
||||
__node_holder __construct_node(_A0&& __a0, _Args&& ...__args);
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -1668,14 +1749,14 @@ private:
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
multimap<_Key, _Tp, _Compare, _Allocator>::multimap(multimap&& __m, const allocator_type& __a)
|
||||
: __tree_(_STD::move(__m.__tree_), __a)
|
||||
: __tree_(_VSTD::move(__m.__tree_), __a)
|
||||
{
|
||||
if (__a != __m.get_allocator())
|
||||
{
|
||||
const_iterator __e = cend();
|
||||
while (!__m.empty())
|
||||
__tree_.__insert_multi(__e.__i_,
|
||||
_STD::move(__m.__tree_.remove(__m.begin().__i_)->__value_));
|
||||
_VSTD::move(__m.__tree_.remove(__m.begin().__i_)->__value_));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1685,23 +1766,23 @@ multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node()
|
||||
{
|
||||
__node_allocator& __na = __tree_.__node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_traits::construct(__na, addressof(__h->__value_.first));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first));
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__node_traits::construct(__na, addressof(__h->__value_.second));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return __h;
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
template <class _A0,
|
||||
class // = typename enable_if<is_convertible<_A0, value_type>::value>::type
|
||||
class // = typename enable_if<is_constructible<value_type, _A0>::value>::type
|
||||
>
|
||||
typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
|
||||
multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
|
||||
{
|
||||
__node_allocator& __na = __tree_.__node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_traits::construct(__na, addressof(__h->__value_), _STD::forward<_A0>(__a0));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_A0>(__a0));
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return __h;
|
||||
@@ -1711,16 +1792,16 @@ multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
template <class _A0, class ..._Args,
|
||||
class // = typename enable_if<is_convertible<_A0, key_type>::value>::type
|
||||
class // = typename enable_if<is_constructible<key_type, _A0>::value>::type
|
||||
>
|
||||
typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
|
||||
multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&& ...__args)
|
||||
{
|
||||
__node_allocator& __na = __tree_.__node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_traits::construct(__na, addressof(__h->__value_.first), _STD::forward<_A0>(__a0));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0));
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__node_traits::construct(__na, addressof(__h->__value_.second), _STD::forward<_Args>(__args)...);
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second), _VSTD::forward<_Args>(__args)...);
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return __h;
|
||||
}
|
||||
@@ -1732,13 +1813,13 @@ multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&&
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
template <class _A0, class ..._Args,
|
||||
class //= typename enable_if<is_convertible<_A0, _Key>::value>::type
|
||||
class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
|
||||
>
|
||||
typename multimap<_Key, _Tp, _Compare, _Allocator>::iterator
|
||||
multimap<_Key, _Tp, _Compare, _Allocator>::emplace(_A0&& __a0, _Args&& ...__args)
|
||||
{
|
||||
__node_holder __h = __construct_node(_STD::forward<_A0>(__a0),
|
||||
_STD::forward<_Args>(__args)...);
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
iterator __r = __tree_.__node_insert_multi(__h.get());
|
||||
__h.release();
|
||||
return __r;
|
||||
@@ -1746,15 +1827,15 @@ multimap<_Key, _Tp, _Compare, _Allocator>::emplace(_A0&& __a0, _Args&& ...__args
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
template <class _A0, class ..._Args,
|
||||
class //= typename enable_if<is_convertible<_A0, _Key>::value>::type
|
||||
class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
|
||||
>
|
||||
typename multimap<_Key, _Tp, _Compare, _Allocator>::iterator
|
||||
multimap<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p,
|
||||
_A0&& __a0,
|
||||
_Args&& ...__args)
|
||||
{
|
||||
__node_holder __h = __construct_node(_STD::forward<_A0>(__a0),
|
||||
_STD::forward<_Args>(__args)...);
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
iterator __r = __tree_.__node_insert_multi(__p.__i_, __h.get());
|
||||
__h.release();
|
||||
return __r;
|
||||
@@ -1768,7 +1849,7 @@ bool
|
||||
operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
|
||||
const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
|
||||
{
|
||||
return __x.size() == __y.size() && _STD::equal(__x.begin(), __x.end(), __y.begin());
|
||||
return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
@@ -1777,7 +1858,7 @@ bool
|
||||
operator< (const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
|
||||
const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
|
||||
{
|
||||
return _STD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
|
||||
return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
@@ -1821,6 +1902,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(multimap<_Key, _Tp, _Compare, _Allocator>& __x,
|
||||
multimap<_Key, _Tp, _Compare, _Allocator>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
1069
include/memory
1069
include/memory
File diff suppressed because it is too large
Load Diff
@@ -175,6 +175,9 @@ template<class Callable, class ...Args>
|
||||
#include <__config>
|
||||
#include <__mutex_base>
|
||||
#include <functional>
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#include <tuple>
|
||||
#endif
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
@@ -364,9 +367,9 @@ lock(_L0& __l0, _L1& __l1)
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _L0, class _L1, class ..._L2>
|
||||
template <class _L0, class _L1, class _L2, class ..._L3>
|
||||
void
|
||||
__lock_first(int __i, _L0& __l0, _L1& __l1, _L2& ...__l2)
|
||||
__lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
@@ -375,7 +378,7 @@ __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& ...__l2)
|
||||
case 0:
|
||||
{
|
||||
unique_lock<_L0> __u0(__l0);
|
||||
__i = try_lock(__l1, __l2...);
|
||||
__i = try_lock(__l1, __l2, __l3...);
|
||||
if (__i == -1)
|
||||
{
|
||||
__u0.release();
|
||||
@@ -388,32 +391,32 @@ __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& ...__l2)
|
||||
case 1:
|
||||
{
|
||||
unique_lock<_L1> __u1(__l1);
|
||||
__i = try_lock(__l2..., __l0);
|
||||
__i = try_lock(__l2, __l3..., __l0);
|
||||
if (__i == -1)
|
||||
{
|
||||
__u1.release();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (__i == sizeof...(_L2))
|
||||
if (__i == sizeof...(_L3) + 1)
|
||||
__i = 0;
|
||||
else
|
||||
__i += 2;
|
||||
sched_yield();
|
||||
break;
|
||||
default:
|
||||
__lock_first(__i - 2, __l2..., __l0, __l1);
|
||||
__lock_first(__i - 2, __l2, __l3..., __l0, __l1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class _L0, class _L1, class ..._L2>
|
||||
template <class _L0, class _L1, class _L2, class ..._L3>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
lock(_L0& __l0, _L1& __l1, _L2& ...__l2)
|
||||
lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
|
||||
{
|
||||
__lock_first(0, __l0, __l1, __l2...);
|
||||
__lock_first(0, __l0, __l1, __l2, __l3...);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
@@ -455,6 +458,8 @@ private:
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _F>
|
||||
class __call_once_param
|
||||
{
|
||||
@@ -462,7 +467,38 @@ class __call_once_param
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(_F&& __f) : __f_(_STD::move(__f)) {}
|
||||
explicit __call_once_param(_F&& __f) : __f_(_VSTD::move(__f)) {}
|
||||
#else
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(const _F& __f) : __f_(__f) {}
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void operator()()
|
||||
{
|
||||
typedef typename __make_tuple_indices<tuple_size<_F>::value, 1>::type _Index;
|
||||
__execute(_Index());
|
||||
}
|
||||
|
||||
private:
|
||||
template <size_t ..._Indices>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __execute(__tuple_indices<_Indices...>)
|
||||
{
|
||||
__invoke(_VSTD::move(_VSTD::get<0>(__f_)), _VSTD::move(_VSTD::get<_Indices>(__f_))...);
|
||||
}
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template <class _F>
|
||||
class __call_once_param
|
||||
{
|
||||
_F __f_;
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(_F&& __f) : __f_(_VSTD::move(__f)) {}
|
||||
#else
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(const _F& __f) : __f_(__f) {}
|
||||
@@ -475,6 +511,8 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
template <class _F>
|
||||
void
|
||||
__call_once_proxy(void* __vp)
|
||||
@@ -494,10 +532,9 @@ call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)
|
||||
{
|
||||
if (__builtin_expect(__flag.__state_ , ~0ul) != ~0ul)
|
||||
{
|
||||
typedef decltype(std::bind(std::forward<_Callable>(__func),
|
||||
std::forward<_Args>(__args)...)) _G;
|
||||
__call_once_param<_G> __p(std::bind(std::forward<_Callable>(__func),
|
||||
std::forward<_Args>(__args)...));
|
||||
typedef tuple<typename decay<_Callable>::type, typename decay<_Args>::type...> _G;
|
||||
__call_once_param<_G> __p(_G(__decay_copy(_VSTD::forward<_Callable>(__func)),
|
||||
__decay_copy(_VSTD::forward<_Args>(__args))...));
|
||||
__call_once(__flag.__state_, &__p, &__call_once_proxy<_G>);
|
||||
}
|
||||
}
|
||||
|
||||
85
include/new
85
include/new
@@ -21,35 +21,34 @@ class bad_alloc
|
||||
: public exception
|
||||
{
|
||||
public:
|
||||
bad_alloc() throw();
|
||||
bad_alloc(const bad_alloc&) throw();
|
||||
bad_alloc& operator=(const bad_alloc&) throw();
|
||||
virtual ~bad_alloc() throw();
|
||||
virtual const char* what() const throw();
|
||||
bad_alloc() noexcept;
|
||||
bad_alloc(const bad_alloc&) noexcept;
|
||||
bad_alloc& operator=(const bad_alloc&) noexcept;
|
||||
virtual const char* what() const noexcept;
|
||||
};
|
||||
|
||||
struct nothrow_t {};
|
||||
extern const nothrow_t nothrow;
|
||||
typedef void (*new_handler)();
|
||||
new_handler set_new_handler(new_handler new_p) throw();
|
||||
new_handler get_new_handler() throw();
|
||||
new_handler set_new_handler(new_handler new_p) noexcept;
|
||||
new_handler get_new_handler() noexcept;
|
||||
|
||||
} // std
|
||||
|
||||
void* operator new(std::size_t size) throw(std::bad_alloc); // replaceable
|
||||
void* operator new(std::size_t size, const std::nothrow_t&) throw(); // replaceable
|
||||
void operator delete(void* ptr) throw(); // replaceable
|
||||
void operator delete(void* ptr, const std::nothrow_t&) throw(); // replaceable
|
||||
void* operator new(std::size_t size); // replaceable
|
||||
void* operator new(std::size_t size, const std::nothrow_t&) noexcept; // replaceable
|
||||
void operator delete(void* ptr) noexcept; // replaceable
|
||||
void operator delete(void* ptr, const std::nothrow_t&) noexcept; // replaceable
|
||||
|
||||
void* operator new[](std::size_t size) throw(std::bad_alloc); // replaceable
|
||||
void* operator new[](std::size_t size, const std::nothrow_t&) throw(); // replaceable
|
||||
void operator delete[](void* ptr) throw(); // replaceable
|
||||
void operator delete[](void* ptr, const std::nothrow_t&) throw(); // replaceable
|
||||
void* operator new[](std::size_t size); // replaceable
|
||||
void* operator new[](std::size_t size, const std::nothrow_t&) noexcept; // replaceable
|
||||
void operator delete[](void* ptr) noexcept; // replaceable
|
||||
void operator delete[](void* ptr, const std::nothrow_t&) noexcept; // replaceable
|
||||
|
||||
void* operator new (std::size_t size, void* ptr) throw();
|
||||
void* operator new[](std::size_t size, void* ptr) throw();
|
||||
void operator delete (void* ptr, void*) throw();
|
||||
void operator delete[](void* ptr, void*) throw();
|
||||
void* operator new (std::size_t size, void* ptr) noexcept;
|
||||
void* operator new[](std::size_t size, void* ptr) noexcept;
|
||||
void operator delete (void* ptr, void*) noexcept;
|
||||
void operator delete[](void* ptr, void*) noexcept;
|
||||
|
||||
*/
|
||||
|
||||
@@ -66,18 +65,18 @@ class _LIBCPP_EXCEPTION_ABI bad_alloc
|
||||
: public exception
|
||||
{
|
||||
public:
|
||||
bad_alloc() throw();
|
||||
virtual ~bad_alloc() throw();
|
||||
virtual const char* what() const throw();
|
||||
bad_alloc() _NOEXCEPT;
|
||||
virtual ~bad_alloc() _NOEXCEPT;
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI bad_array_new_length
|
||||
: public bad_alloc
|
||||
{
|
||||
public:
|
||||
bad_array_new_length() throw();
|
||||
virtual ~bad_array_new_length() throw();
|
||||
virtual const char* what() const throw();
|
||||
bad_array_new_length() _NOEXCEPT;
|
||||
virtual ~bad_array_new_length() _NOEXCEPT;
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
void __throw_bad_alloc(); // not in C++ spec
|
||||
@@ -85,24 +84,32 @@ void __throw_bad_alloc(); // not in C++ spec
|
||||
struct _LIBCPP_VISIBLE nothrow_t {};
|
||||
extern _LIBCPP_VISIBLE const nothrow_t nothrow;
|
||||
typedef void (*new_handler)();
|
||||
_LIBCPP_VISIBLE new_handler set_new_handler(new_handler) throw();
|
||||
_LIBCPP_VISIBLE new_handler get_new_handler() throw();
|
||||
_LIBCPP_VISIBLE new_handler set_new_handler(new_handler) _NOEXCEPT;
|
||||
_LIBCPP_VISIBLE new_handler get_new_handler() _NOEXCEPT;
|
||||
|
||||
} // std
|
||||
|
||||
_LIBCPP_VISIBLE void* operator new(std::size_t) throw(std::bad_alloc);
|
||||
_LIBCPP_VISIBLE void* operator new(std::size_t, const std::nothrow_t&) throw();
|
||||
_LIBCPP_VISIBLE void operator delete(void*) throw();
|
||||
_LIBCPP_VISIBLE void operator delete(void*, const std::nothrow_t&) throw();
|
||||
_LIBCPP_VISIBLE void* operator new(std::size_t __sz)
|
||||
#if !__has_feature(cxx_noexcept)
|
||||
throw(std::bad_alloc)
|
||||
#endif
|
||||
;
|
||||
_LIBCPP_VISIBLE void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT;
|
||||
_LIBCPP_VISIBLE void operator delete(void* __p) _NOEXCEPT;
|
||||
_LIBCPP_VISIBLE void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
|
||||
|
||||
_LIBCPP_VISIBLE void* operator new[](std::size_t) throw(std::bad_alloc);
|
||||
_LIBCPP_VISIBLE void* operator new[](std::size_t, const std::nothrow_t&) throw();
|
||||
_LIBCPP_VISIBLE void operator delete[](void*) throw();
|
||||
_LIBCPP_VISIBLE void operator delete[](void*, const std::nothrow_t&) throw();
|
||||
_LIBCPP_VISIBLE void* operator new[](std::size_t __sz)
|
||||
#if !__has_feature(cxx_noexcept)
|
||||
throw(std::bad_alloc)
|
||||
#endif
|
||||
;
|
||||
_LIBCPP_VISIBLE void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT;
|
||||
_LIBCPP_VISIBLE void operator delete[](void* __p) _NOEXCEPT;
|
||||
_LIBCPP_VISIBLE void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY inline void* operator new (std::size_t, void* __p) throw() {return __p;}
|
||||
_LIBCPP_INLINE_VISIBILITY inline void* operator new[](std::size_t, void* __p) throw() {return __p;}
|
||||
_LIBCPP_INLINE_VISIBILITY inline void operator delete (void*, void*) throw() {}
|
||||
_LIBCPP_INLINE_VISIBILITY inline void operator delete[](void*, void*) throw() {}
|
||||
_LIBCPP_INLINE_VISIBILITY inline void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;}
|
||||
_LIBCPP_INLINE_VISIBILITY inline void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;}
|
||||
_LIBCPP_INLINE_VISIBILITY inline void operator delete (void*, void*) _NOEXCEPT {}
|
||||
_LIBCPP_INLINE_VISIBILITY inline void operator delete[](void*, void*) _NOEXCEPT {}
|
||||
|
||||
#endif // _LIBCPP_NEW
|
||||
|
||||
@@ -154,11 +154,13 @@ public:
|
||||
virtual ~basic_ostream();
|
||||
protected:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream(basic_ostream&& __rhs);
|
||||
#endif
|
||||
|
||||
// 27.7.2.3 Assign/swap
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream& operator=(basic_ostream&& __rhs);
|
||||
#endif
|
||||
void swap(basic_ostream& __rhs);
|
||||
@@ -1276,7 +1278,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Y> const& __p)
|
||||
|
||||
template <class _CharT, class _Traits, size_t _Size>
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, bitset<_Size>& __x)
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
|
||||
{
|
||||
return __os << __x.template to_string<_CharT, _Traits>
|
||||
(use_facet<ctype<_CharT> >(__os.getloc()).widen('0'),
|
||||
|
||||
189
include/queue
189
include/queue
@@ -31,21 +31,28 @@ protected:
|
||||
container_type c;
|
||||
|
||||
public:
|
||||
queue();
|
||||
queue() = default;
|
||||
~queue() = default;
|
||||
|
||||
queue(const queue& q) = default;
|
||||
queue(queue&& q) = default;
|
||||
|
||||
queue& operator=(const queue& q) = default;
|
||||
queue& operator=(queue&& q) = default;
|
||||
|
||||
explicit queue(const container_type& c);
|
||||
explicit queue(container_type&& c);
|
||||
queue(queue&& q);
|
||||
explicit queue(container_type&& c)
|
||||
template <class Alloc>
|
||||
explicit queue(const Alloc& a);
|
||||
template <class Alloc>
|
||||
queue(const container_type& c, const Alloc& a);
|
||||
template <class Alloc>
|
||||
queue(container_type&& c, const Alloc& a);
|
||||
template <class Alloc>
|
||||
queue(const queue& q, const Alloc& a);
|
||||
template <class Alloc>
|
||||
queue(queue&& q, const Alloc& a);
|
||||
|
||||
queue& operator=(queue&& q);
|
||||
|
||||
bool empty() const;
|
||||
size_type size() const;
|
||||
|
||||
@@ -59,7 +66,7 @@ public:
|
||||
template <class... Args> void emplace(Args&&... args);
|
||||
void pop();
|
||||
|
||||
void swap(queue& q);
|
||||
void swap(queue& q) noexcept(noexcept(swap(c, q.c)));
|
||||
};
|
||||
|
||||
template <class T, class Container>
|
||||
@@ -81,7 +88,8 @@ template <class T, class Container>
|
||||
bool operator<=(const queue<T, Container>& x,const queue<T, Container>& y);
|
||||
|
||||
template <class T, class Container>
|
||||
void swap(queue<T, Container>& x, queue<T, Container>& y);
|
||||
void swap(queue<T, Container>& x, queue<T, Container>& y)
|
||||
noexcept(noexcept(x.swap(y)));
|
||||
|
||||
template <class T, class Container = vector<T>,
|
||||
class Compare = less<typename Container::value_type>>
|
||||
@@ -99,7 +107,16 @@ protected:
|
||||
Compare comp;
|
||||
|
||||
public:
|
||||
explicit priority_queue(const Compare& comp = Compare());
|
||||
priority_queue() = default;
|
||||
~priority_queue() = default;
|
||||
|
||||
priority_queue(const priority_queue& q) = default;
|
||||
priority_queue(priority_queue&& q) = default;
|
||||
|
||||
priority_queue& operator=(const priority_queue& q) = default;
|
||||
priority_queue& operator=(priority_queue&& q) = default;
|
||||
|
||||
explicit priority_queue(const Compare& comp);
|
||||
priority_queue(const Compare& comp, const container_type& c);
|
||||
explicit priority_queue(const Compare& comp, container_type&& c);
|
||||
template <class InputIterator>
|
||||
@@ -111,8 +128,6 @@ public:
|
||||
template <class InputIterator>
|
||||
priority_queue(InputIterator first, InputIterator last,
|
||||
const Compare& comp, container_type&& c);
|
||||
priority_queue(priority_queue&& q);
|
||||
priority_queue& operator=(priority_queue&& q);
|
||||
template <class Alloc>
|
||||
explicit priority_queue(const Alloc& a);
|
||||
template <class Alloc>
|
||||
@@ -123,6 +138,8 @@ public:
|
||||
template <class Alloc>
|
||||
priority_queue(const Compare& comp, container_type&& c,
|
||||
const Alloc& a);
|
||||
template <class Alloc>
|
||||
priority_queue(const priority_queue& q, const Alloc& a);
|
||||
template <class Alloc>
|
||||
priority_queue(priority_queue&& q, const Alloc& a);
|
||||
|
||||
@@ -135,12 +152,14 @@ public:
|
||||
template <class... Args> void emplace(Args&&... args);
|
||||
void pop();
|
||||
|
||||
void swap(priority_queue& q);
|
||||
void swap(priority_queue& q)
|
||||
noexcept(noexcept(swap(c, q.c)) && noexcept(swap(comp.q.comp)));
|
||||
};
|
||||
|
||||
template <class T, class Container, class Compare>
|
||||
void swap(priority_queue<T, Container, Compare>& x,
|
||||
priority_queue<T, Container, Compare>& y);
|
||||
priority_queue<T, Container, Compare>& y)
|
||||
noexcept(noexcept(x.swap(y)));
|
||||
|
||||
} // std
|
||||
|
||||
@@ -181,14 +200,35 @@ protected:
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue() : c() {}
|
||||
queue()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<container_type>::value)
|
||||
: c() {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue(const queue& __q) : c(__q.c) {}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue(queue&& __q)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
|
||||
: c(_VSTD::move(__q.c)) {}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue& operator=(const queue& __q) {c = __q.c; return *this;}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue& operator=(queue&& __q)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
|
||||
{c = _VSTD::move(__q.c); return *this;}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit queue(const container_type& __c) : c(__c) {}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit queue(container_type&& __c) : c(_STD::move(__c)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue(queue&& __q) : c(_STD::move(__q.c)) {}
|
||||
explicit queue(container_type&& __c) : c(_VSTD::move(__c)) {}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -214,20 +254,14 @@ public:
|
||||
queue(container_type&& __c, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(_STD::move(__c), __a) {}
|
||||
: c(_VSTD::move(__c), __a) {}
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue(queue&& __q, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(_STD::move(__q.c), __a) {}
|
||||
: c(_VSTD::move(__q.c), __a) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue& operator=(queue&& __q)
|
||||
{
|
||||
c = _STD::move(__q.c);
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -248,12 +282,12 @@ public:
|
||||
void push(const value_type& __v) {c.push_back(__v);}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void push(value_type&& __v) {c.push_back(_STD::move(__v));}
|
||||
void push(value_type&& __v) {c.push_back(_VSTD::move(__v));}
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void emplace(_Args&&... __args)
|
||||
{c.emplace_back(_STD::forward<_Args>(__args)...);}
|
||||
{c.emplace_back(_VSTD::forward<_Args>(__args)...);}
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -261,8 +295,9 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(queue& __q)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value)
|
||||
{
|
||||
using _STD::swap;
|
||||
using _VSTD::swap;
|
||||
swap(c, __q.c);
|
||||
}
|
||||
|
||||
@@ -331,6 +366,7 @@ template <class _Tp, class _Container>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
@@ -359,7 +395,36 @@ protected:
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit priority_queue(const value_compare& __comp = value_compare())
|
||||
priority_queue()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<container_type>::value &&
|
||||
is_nothrow_default_constructible<value_compare>::value)
|
||||
: c(), comp() {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue(const priority_queue& __q) : c(__q.c), comp(__q.comp) {}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue(priority_queue&& __q)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<container_type>::value &&
|
||||
is_nothrow_move_constructible<value_compare>::value)
|
||||
: c(_VSTD::move(__q.c)), comp(_VSTD::move(__q.comp)) {}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue& operator=(const priority_queue& __q)
|
||||
{c = __q.c; comp = __q.comp; return *this;}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue& operator=(priority_queue&& __q)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<container_type>::value &&
|
||||
is_nothrow_move_assignable<value_compare>::value)
|
||||
{c = _VSTD::move(__q.c); comp = _VSTD::move(__q.comp); return *this;}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit priority_queue(const value_compare& __comp)
|
||||
: c(), comp(__comp) {}
|
||||
priority_queue(const value_compare& __comp, const container_type& __c);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -375,8 +440,6 @@ public:
|
||||
template <class _InputIter>
|
||||
priority_queue(_InputIter __f, _InputIter __l,
|
||||
const value_compare& __comp, container_type&& __c);
|
||||
priority_queue(priority_queue&& __q);
|
||||
priority_queue& operator=(priority_queue&& __q);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Alloc>
|
||||
explicit priority_queue(const _Alloc& __a,
|
||||
@@ -423,7 +486,9 @@ public:
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void pop();
|
||||
|
||||
void swap(priority_queue& __q);
|
||||
void swap(priority_queue& __q)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value &&
|
||||
__is_nothrow_swappable<value_compare>::value);
|
||||
};
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
@@ -433,7 +498,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp
|
||||
: c(__c),
|
||||
comp(__comp)
|
||||
{
|
||||
_STD::make_heap(c.begin(), c.end(), comp);
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -442,10 +507,10 @@ template <class _Tp, class _Container, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
|
||||
container_type&& __c)
|
||||
: c(_STD::move(__c)),
|
||||
: c(_VSTD::move(__c)),
|
||||
comp(__comp)
|
||||
{
|
||||
_STD::make_heap(c.begin(), c.end(), comp);
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -458,7 +523,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input
|
||||
: c(__f, __l),
|
||||
comp(__comp)
|
||||
{
|
||||
_STD::make_heap(c.begin(), c.end(), comp);
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
@@ -471,7 +536,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input
|
||||
comp(__comp)
|
||||
{
|
||||
c.insert(c.end(), __f, __l);
|
||||
_STD::make_heap(c.begin(), c.end(), comp);
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -482,28 +547,11 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
|
||||
const value_compare& __comp,
|
||||
container_type&& __c)
|
||||
: c(_STD::move(__c)),
|
||||
: c(_VSTD::move(__c)),
|
||||
comp(__comp)
|
||||
{
|
||||
c.insert(c.end(), __f, __l);
|
||||
_STD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q)
|
||||
: c(_STD::move(__q.c)),
|
||||
comp(_STD::move(__q.comp))
|
||||
{
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
priority_queue<_Tp, _Container, _Compare>&
|
||||
priority_queue<_Tp, _Container, _Compare>::operator=(priority_queue&& __q)
|
||||
{
|
||||
c = _STD::move(__q.c);
|
||||
comp = _STD::move(__q.comp);
|
||||
return *this;
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -541,7 +589,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
|
||||
: c(__c, __a),
|
||||
comp(__comp)
|
||||
{
|
||||
_STD::make_heap(c.begin(), c.end(), comp);
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
@@ -554,7 +602,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue&
|
||||
: c(__q.c, __a),
|
||||
comp(__q.comp)
|
||||
{
|
||||
_STD::make_heap(c.begin(), c.end(), comp);
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -567,10 +615,10 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
|
||||
const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type*)
|
||||
: c(_STD::move(__c), __a),
|
||||
: c(_VSTD::move(__c), __a),
|
||||
comp(__comp)
|
||||
{
|
||||
_STD::make_heap(c.begin(), c.end(), comp);
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
@@ -580,10 +628,10 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q,
|
||||
const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type*)
|
||||
: c(_STD::move(__q.c), __a),
|
||||
comp(_STD::move(__q.comp))
|
||||
: c(_VSTD::move(__q.c), __a),
|
||||
comp(_VSTD::move(__q.comp))
|
||||
{
|
||||
_STD::make_heap(c.begin(), c.end(), comp);
|
||||
_VSTD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -594,7 +642,7 @@ void
|
||||
priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v)
|
||||
{
|
||||
c.push_back(__v);
|
||||
_STD::push_heap(c.begin(), c.end(), comp);
|
||||
_VSTD::push_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -604,8 +652,8 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v)
|
||||
{
|
||||
c.push_back(_STD::move(__v));
|
||||
_STD::push_heap(c.begin(), c.end(), comp);
|
||||
c.push_back(_VSTD::move(__v));
|
||||
_VSTD::push_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
@@ -616,8 +664,8 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args)
|
||||
{
|
||||
c.emplace_back(_STD::forward<_Args>(__args)...);
|
||||
_STD::push_heap(c.begin(), c.end(), comp);
|
||||
c.emplace_back(_VSTD::forward<_Args>(__args)...);
|
||||
_VSTD::push_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
@@ -628,7 +676,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
priority_queue<_Tp, _Container, _Compare>::pop()
|
||||
{
|
||||
_STD::pop_heap(c.begin(), c.end(), comp);
|
||||
_VSTD::pop_heap(c.begin(), c.end(), comp);
|
||||
c.pop_back();
|
||||
}
|
||||
|
||||
@@ -636,8 +684,10 @@ template <class _Tp, class _Container, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value &&
|
||||
__is_nothrow_swappable<value_compare>::value)
|
||||
{
|
||||
using _STD::swap;
|
||||
using _VSTD::swap;
|
||||
swap(c, __q.c);
|
||||
swap(comp, __q.comp);
|
||||
}
|
||||
@@ -647,6 +697,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(priority_queue<_Tp, _Container, _Compare>& __x,
|
||||
priority_queue<_Tp, _Container, _Compare>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
168
include/random
168
include/random
@@ -1650,6 +1650,16 @@ class piecewise_linear_distribution
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// __is_seed_sequence
|
||||
|
||||
template <class _Sseq, class _Engine>
|
||||
struct __is_seed_sequence
|
||||
{
|
||||
static const bool value =
|
||||
!is_convertible<_Sseq, typename _Engine::result_type>::value &&
|
||||
!is_same<typename remove_cv<_Sseq>::type, _Engine>::value;
|
||||
};
|
||||
|
||||
// linear_congruential_engine
|
||||
|
||||
template <unsigned long long __a, unsigned long long __c,
|
||||
@@ -1848,7 +1858,7 @@ public:
|
||||
{seed(__s);}
|
||||
template<class _Sseq> explicit linear_congruential_engine(_Sseq& __q,
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if<!is_convertible<_Sseq, result_type>::value>::type* = 0)
|
||||
typename enable_if<__is_seed_sequence<_Sseq, linear_congruential_engine>::value>::type* = 0)
|
||||
{seed(__q);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void seed(result_type __s = default_seed)
|
||||
@@ -1858,7 +1868,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
!is_convertible<_Sseq, result_type>::value,
|
||||
__is_seed_sequence<_Sseq, linear_congruential_engine>::value,
|
||||
void
|
||||
>::type
|
||||
seed(_Sseq& __q)
|
||||
@@ -2104,14 +2114,14 @@ public:
|
||||
{seed(__sd);}
|
||||
template<class _Sseq> explicit mersenne_twister_engine(_Sseq& __q,
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if<!is_convertible<_Sseq, result_type>::value>::type* = 0)
|
||||
typename enable_if<__is_seed_sequence<_Sseq, mersenne_twister_engine>::value>::type* = 0)
|
||||
{seed(__q);}
|
||||
void seed(result_type __sd = default_seed);
|
||||
template<class _Sseq>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
!is_convertible<_Sseq, result_type>::value,
|
||||
__is_seed_sequence<_Sseq, mersenne_twister_engine>::value,
|
||||
void
|
||||
>::type
|
||||
seed(_Sseq& __q)
|
||||
@@ -2303,37 +2313,37 @@ operator==(const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S,
|
||||
_B, _T, _C, _L, _F>& __y)
|
||||
{
|
||||
if (__x.__i_ == __y.__i_)
|
||||
return _STD::equal(__x.__x_, __x.__x_ + _N, __y.__x_);
|
||||
return _VSTD::equal(__x.__x_, __x.__x_ + _N, __y.__x_);
|
||||
if (__x.__i_ == 0 || __y.__i_ == 0)
|
||||
{
|
||||
size_t __j = _STD::min(_N - __x.__i_, _N - __y.__i_);
|
||||
if (!_STD::equal(__x.__x_ + __x.__i_, __x.__x_ + __x.__i_ + __j,
|
||||
size_t __j = _VSTD::min(_N - __x.__i_, _N - __y.__i_);
|
||||
if (!_VSTD::equal(__x.__x_ + __x.__i_, __x.__x_ + __x.__i_ + __j,
|
||||
__y.__x_ + __y.__i_))
|
||||
return false;
|
||||
if (__x.__i_ == 0)
|
||||
return _STD::equal(__x.__x_ + __j, __x.__x_ + _N, __y.__x_);
|
||||
return _STD::equal(__x.__x_, __x.__x_ + (_N - __j), __y.__x_ + __j);
|
||||
return _VSTD::equal(__x.__x_ + __j, __x.__x_ + _N, __y.__x_);
|
||||
return _VSTD::equal(__x.__x_, __x.__x_ + (_N - __j), __y.__x_ + __j);
|
||||
}
|
||||
if (__x.__i_ < __y.__i_)
|
||||
{
|
||||
size_t __j = _N - __y.__i_;
|
||||
if (!_STD::equal(__x.__x_ + __x.__i_, __x.__x_ + (__x.__i_ + __j),
|
||||
if (!_VSTD::equal(__x.__x_ + __x.__i_, __x.__x_ + (__x.__i_ + __j),
|
||||
__y.__x_ + __y.__i_))
|
||||
return false;
|
||||
if (!_STD::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _N,
|
||||
if (!_VSTD::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _N,
|
||||
__y.__x_))
|
||||
return false;
|
||||
return _STD::equal(__x.__x_, __x.__x_ + __x.__i_,
|
||||
return _VSTD::equal(__x.__x_, __x.__x_ + __x.__i_,
|
||||
__y.__x_ + (_N - (__x.__i_ + __j)));
|
||||
}
|
||||
size_t __j = _N - __x.__i_;
|
||||
if (!_STD::equal(__y.__x_ + __y.__i_, __y.__x_ + (__y.__i_ + __j),
|
||||
if (!_VSTD::equal(__y.__x_ + __y.__i_, __y.__x_ + (__y.__i_ + __j),
|
||||
__x.__x_ + __x.__i_))
|
||||
return false;
|
||||
if (!_STD::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _N,
|
||||
if (!_VSTD::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _N,
|
||||
__x.__x_))
|
||||
return false;
|
||||
return _STD::equal(__y.__x_, __y.__x_ + __y.__i_,
|
||||
return _VSTD::equal(__y.__x_, __y.__x_ + __y.__i_,
|
||||
__x.__x_ + (_N - (__y.__i_ + __j)));
|
||||
}
|
||||
|
||||
@@ -2473,7 +2483,7 @@ public:
|
||||
{seed(__sd);}
|
||||
template<class _Sseq> explicit subtract_with_carry_engine(_Sseq& __q,
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if<!is_convertible<_Sseq, result_type>::value>::type* = 0)
|
||||
typename enable_if<__is_seed_sequence<_Sseq, subtract_with_carry_engine>::value>::type* = 0)
|
||||
{seed(__q);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void seed(result_type __sd = default_seed)
|
||||
@@ -2482,7 +2492,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
!is_convertible<_Sseq, result_type>::value,
|
||||
__is_seed_sequence<_Sseq, subtract_with_carry_engine>::value,
|
||||
void
|
||||
>::type
|
||||
seed(_Sseq& __q)
|
||||
@@ -2611,37 +2621,37 @@ operator==(
|
||||
if (__x.__c_ != __y.__c_)
|
||||
return false;
|
||||
if (__x.__i_ == __y.__i_)
|
||||
return _STD::equal(__x.__x_, __x.__x_ + _R, __y.__x_);
|
||||
return _VSTD::equal(__x.__x_, __x.__x_ + _R, __y.__x_);
|
||||
if (__x.__i_ == 0 || __y.__i_ == 0)
|
||||
{
|
||||
size_t __j = _STD::min(_R - __x.__i_, _R - __y.__i_);
|
||||
if (!_STD::equal(__x.__x_ + __x.__i_, __x.__x_ + __x.__i_ + __j,
|
||||
size_t __j = _VSTD::min(_R - __x.__i_, _R - __y.__i_);
|
||||
if (!_VSTD::equal(__x.__x_ + __x.__i_, __x.__x_ + __x.__i_ + __j,
|
||||
__y.__x_ + __y.__i_))
|
||||
return false;
|
||||
if (__x.__i_ == 0)
|
||||
return _STD::equal(__x.__x_ + __j, __x.__x_ + _R, __y.__x_);
|
||||
return _STD::equal(__x.__x_, __x.__x_ + (_R - __j), __y.__x_ + __j);
|
||||
return _VSTD::equal(__x.__x_ + __j, __x.__x_ + _R, __y.__x_);
|
||||
return _VSTD::equal(__x.__x_, __x.__x_ + (_R - __j), __y.__x_ + __j);
|
||||
}
|
||||
if (__x.__i_ < __y.__i_)
|
||||
{
|
||||
size_t __j = _R - __y.__i_;
|
||||
if (!_STD::equal(__x.__x_ + __x.__i_, __x.__x_ + (__x.__i_ + __j),
|
||||
if (!_VSTD::equal(__x.__x_ + __x.__i_, __x.__x_ + (__x.__i_ + __j),
|
||||
__y.__x_ + __y.__i_))
|
||||
return false;
|
||||
if (!_STD::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _R,
|
||||
if (!_VSTD::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _R,
|
||||
__y.__x_))
|
||||
return false;
|
||||
return _STD::equal(__x.__x_, __x.__x_ + __x.__i_,
|
||||
return _VSTD::equal(__x.__x_, __x.__x_ + __x.__i_,
|
||||
__y.__x_ + (_R - (__x.__i_ + __j)));
|
||||
}
|
||||
size_t __j = _R - __x.__i_;
|
||||
if (!_STD::equal(__y.__x_ + __y.__i_, __y.__x_ + (__y.__i_ + __j),
|
||||
if (!_VSTD::equal(__y.__x_ + __y.__i_, __y.__x_ + (__y.__i_ + __j),
|
||||
__x.__x_ + __x.__i_))
|
||||
return false;
|
||||
if (!_STD::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _R,
|
||||
if (!_VSTD::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _R,
|
||||
__x.__x_))
|
||||
return false;
|
||||
return _STD::equal(__y.__x_, __y.__x_ + __y.__i_,
|
||||
return _VSTD::equal(__y.__x_, __y.__x_ + __y.__i_,
|
||||
__x.__x_ + (_R - (__y.__i_ + __j)));
|
||||
}
|
||||
|
||||
@@ -2734,14 +2744,14 @@ public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit discard_block_engine(_Engine&& __e)
|
||||
: __e_(_STD::move(__e)), __n_(0) {}
|
||||
: __e_(_VSTD::move(__e)), __n_(0) {}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit discard_block_engine(result_type __sd) : __e_(__sd), __n_(0) {}
|
||||
template<class _Sseq>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit discard_block_engine(_Sseq& __q,
|
||||
typename enable_if<!is_convertible<_Sseq, result_type>::value &&
|
||||
typename enable_if<__is_seed_sequence<_Sseq, discard_block_engine>::value &&
|
||||
!is_convertible<_Sseq, _Engine>::value>::type* = 0)
|
||||
: __e_(__q), __n_(0) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -2752,7 +2762,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
!is_convertible<_Sseq, result_type>::value,
|
||||
__is_seed_sequence<_Sseq, discard_block_engine>::value,
|
||||
void
|
||||
>::type
|
||||
seed(_Sseq& __q) {__e_.seed(__q); __n_ = 0;}
|
||||
@@ -2934,13 +2944,13 @@ public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit independent_bits_engine(_Engine&& __e)
|
||||
: __e_(_STD::move(__e)) {}
|
||||
: __e_(_VSTD::move(__e)) {}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit independent_bits_engine(result_type __sd) : __e_(__sd) {}
|
||||
template<class _Sseq> explicit independent_bits_engine(_Sseq& __q,
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if<!is_convertible<_Sseq, result_type>::value &&
|
||||
typename enable_if<__is_seed_sequence<_Sseq, independent_bits_engine>::value &&
|
||||
!is_convertible<_Sseq, _Engine>::value>::type* = 0)
|
||||
: __e_(__q) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -2951,7 +2961,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
!is_convertible<_Sseq, result_type>::value,
|
||||
__is_seed_sequence<_Sseq, independent_bits_engine>::value,
|
||||
void
|
||||
>::type
|
||||
seed(_Sseq& __q) {__e_.seed(__q);}
|
||||
@@ -3157,13 +3167,13 @@ public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit shuffle_order_engine(_Engine&& __e)
|
||||
: __e_(_STD::move(__e)) {__init();}
|
||||
: __e_(_VSTD::move(__e)) {__init();}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit shuffle_order_engine(result_type __sd) : __e_(__sd) {__init();}
|
||||
template<class _Sseq> explicit shuffle_order_engine(_Sseq& __q,
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if<!is_convertible<_Sseq, result_type>::value &&
|
||||
typename enable_if<__is_seed_sequence<_Sseq, shuffle_order_engine>::value &&
|
||||
!is_convertible<_Sseq, _Engine>::value>::type* = 0)
|
||||
: __e_(__q) {__init();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -3174,7 +3184,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
!is_convertible<_Sseq, result_type>::value,
|
||||
__is_seed_sequence<_Sseq, shuffle_order_engine>::value,
|
||||
void
|
||||
>::type
|
||||
seed(_Sseq& __q) {__e_.seed(__q); __init();}
|
||||
@@ -3282,7 +3292,7 @@ operator==(
|
||||
const shuffle_order_engine<_Eng, _K>& __x,
|
||||
const shuffle_order_engine<_Eng, _K>& __y)
|
||||
{
|
||||
return __x._Y_ == __y._Y_ && _STD::equal(__x._V_, __x._V_ + _K, __y._V_) &&
|
||||
return __x._Y_ == __y._Y_ && _VSTD::equal(__x._V_, __x._V_ + _K, __y._V_) &&
|
||||
__x.__e_ == __y.__e_;
|
||||
}
|
||||
|
||||
@@ -3408,7 +3418,7 @@ public:
|
||||
template<class _OutputIterator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void param(_OutputIterator __dest) const
|
||||
{_STD::copy(__v_.begin(), __v_.end(), __dest);}
|
||||
{_VSTD::copy(__v_.begin(), __v_.end(), __dest);}
|
||||
|
||||
private:
|
||||
// no copy functions
|
||||
@@ -3433,7 +3443,7 @@ seed_seq::generate(_RandomAccessIterator __first, _RandomAccessIterator __last)
|
||||
{
|
||||
if (__first != __last)
|
||||
{
|
||||
_STD::fill(__first, __last, 0x8b8b8b8b);
|
||||
_VSTD::fill(__first, __last, 0x8b8b8b8b);
|
||||
const size_t __n = static_cast<size_t>(__last - __first);
|
||||
const size_t __s = __v_.size();
|
||||
const size_t __t = (__n >= 623) ? 11
|
||||
@@ -3443,7 +3453,7 @@ seed_seq::generate(_RandomAccessIterator __first, _RandomAccessIterator __last)
|
||||
: (__n - 1) / 2;
|
||||
const size_t __p = (__n - __t) / 2;
|
||||
const size_t __q = __p + __t;
|
||||
const size_t __m = _STD::max(__s + 1, __n);
|
||||
const size_t __m = _VSTD::max(__s + 1, __n);
|
||||
// __k = 0;
|
||||
{
|
||||
result_type __r = 1664525 * _T(__first[0] ^ __first[__p]
|
||||
@@ -3629,7 +3639,7 @@ typename uniform_real_distribution<_RealType>::result_type
|
||||
uniform_real_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
|
||||
{
|
||||
return (__p.b() - __p.a())
|
||||
* _STD::generate_canonical<_RealType, numeric_limits<_RealType>::digits>(__g)
|
||||
* _VSTD::generate_canonical<_RealType, numeric_limits<_RealType>::digits>(__g)
|
||||
+ __p.a();
|
||||
}
|
||||
|
||||
@@ -3861,9 +3871,9 @@ binomial_distribution<_IntType>::param_type::param_type(result_type __t, double
|
||||
if (0 < __p_ && __p_ < 1)
|
||||
{
|
||||
__r0_ = static_cast<result_type>((__t_ + 1) * __p_);
|
||||
__pr_ = _STD::exp(_STD::lgamma(__t_ + 1.) - _STD::lgamma(__r0_ + 1.) -
|
||||
_STD::lgamma(__t_ - __r0_ + 1.) + __r0_ * _STD::log(__p_) +
|
||||
(__t_ - __r0_) * _STD::log(1 - __p_));
|
||||
__pr_ = _VSTD::exp(_VSTD::lgamma(__t_ + 1.) - _VSTD::lgamma(__r0_ + 1.) -
|
||||
_VSTD::lgamma(__t_ - __r0_ + 1.) + __r0_ * _VSTD::log(__p_) +
|
||||
(__t_ - __r0_) * _VSTD::log(1 - __p_));
|
||||
__odds_ratio_ = __p_ / (1 - __p_);
|
||||
}
|
||||
}
|
||||
@@ -4015,10 +4025,10 @@ template<class _URNG>
|
||||
_RealType
|
||||
exponential_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
|
||||
{
|
||||
return -_STD::log
|
||||
return -_VSTD::log
|
||||
(
|
||||
result_type(1) -
|
||||
_STD::generate_canonical<result_type,
|
||||
_VSTD::generate_canonical<result_type,
|
||||
numeric_limits<result_type>::digits>(__g)
|
||||
)
|
||||
/ __p.lambda();
|
||||
@@ -4170,7 +4180,7 @@ normal_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
|
||||
__v = _Uni(__g);
|
||||
__s = __u * __u + __v * __v;
|
||||
} while (__s > 1 || __s == 0);
|
||||
result_type _F = _STD::sqrt(-2 * _STD::log(__s) / __s);
|
||||
result_type _F = _VSTD::sqrt(-2 * _VSTD::log(__s) / __s);
|
||||
_V_ = __v * _F;
|
||||
_V_hot_ = true;
|
||||
_U = __u * _F;
|
||||
@@ -4287,7 +4297,7 @@ public:
|
||||
template<class _URNG>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
result_type operator()(_URNG& __g, const param_type& __p)
|
||||
{return _STD::exp(const_cast<normal_distribution<result_type>&>(__p.__nd_)(__g));}
|
||||
{return _VSTD::exp(const_cast<normal_distribution<result_type>&>(__p.__nd_)(__g));}
|
||||
|
||||
// property functions
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -4436,7 +4446,7 @@ poisson_distribution<_IntType>::param_type::param_type(double __mean)
|
||||
{
|
||||
__s_ = 0;
|
||||
__d_ = 0;
|
||||
__l_ = _STD::exp(-__mean_);
|
||||
__l_ = _VSTD::exp(-__mean_);
|
||||
__omega_ = 0;
|
||||
__c3_ = 0;
|
||||
__c2_ = 0;
|
||||
@@ -4446,7 +4456,7 @@ poisson_distribution<_IntType>::param_type::param_type(double __mean)
|
||||
}
|
||||
else
|
||||
{
|
||||
__s_ = _STD::sqrt(__mean_);
|
||||
__s_ = _VSTD::sqrt(__mean_);
|
||||
__d_ = 6 * __mean_ * __mean_;
|
||||
__l_ = static_cast<result_type>(__mean_ - 1.1484);
|
||||
__omega_ = .3989423 / __s_;
|
||||
@@ -4467,7 +4477,7 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr
|
||||
{
|
||||
result_type __x;
|
||||
uniform_real_distribution<double> __urd;
|
||||
if (__pr.__mean_ <= 10)
|
||||
if (__pr.__mean_ < 10)
|
||||
{
|
||||
__x = 0;
|
||||
for (double __p = __urd(__urng); __p > __pr.__l_; ++__x)
|
||||
@@ -4513,20 +4523,20 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr
|
||||
const result_type __fac[] = {1, 1, 2, 6, 24, 120, 720, 5040,
|
||||
40320, 362880};
|
||||
__px = -__pr.__mean_;
|
||||
__py = _STD::pow(__pr.__mean_, (double)__x) / __fac[__x];
|
||||
__py = _VSTD::pow(__pr.__mean_, (double)__x) / __fac[__x];
|
||||
}
|
||||
else
|
||||
{
|
||||
double __del = .8333333E-1 / __x;
|
||||
__del -= 4.8 * __del * __del * __del;
|
||||
double __v = __difmuk / __x;
|
||||
if (_STD::abs(__v) > 0.25)
|
||||
__px = __x * _STD::log(1 + __v) - __difmuk - __del;
|
||||
if (_VSTD::abs(__v) > 0.25)
|
||||
__px = __x * _VSTD::log(1 + __v) - __difmuk - __del;
|
||||
else
|
||||
__px = __x * __v * __v * (((((((.1250060 * __v + -.1384794) *
|
||||
__v + .1421878) * __v + -.1661269) * __v + .2000118) *
|
||||
__v + -.2500068) * __v + .3333333) * __v + -.5) - __del;
|
||||
__py = .3989423 / _STD::sqrt(__x);
|
||||
__py = .3989423 / _VSTD::sqrt(__x);
|
||||
}
|
||||
double __r = (0.5 - __difmuk) / __pr.__s_;
|
||||
double __r2 = __r * __r;
|
||||
@@ -4535,13 +4545,13 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr
|
||||
__r2 + __pr.__c1_) * __r2 + __pr.__c0_);
|
||||
if (__using_exp_dist)
|
||||
{
|
||||
if (__pr.__c_ * _STD::abs(__u) <= __py * _STD::exp(__px + __e) -
|
||||
__fy * _STD::exp(__fx + __e))
|
||||
if (__pr.__c_ * _VSTD::abs(__u) <= __py * _VSTD::exp(__px + __e) -
|
||||
__fy * _VSTD::exp(__fx + __e))
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__fy - __u * __fy <= __py * _STD::exp(__px - __fx))
|
||||
if (__fy - __u * __fy <= __py * _VSTD::exp(__px - __fx))
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -4632,7 +4642,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
result_type operator()(_URNG& __g, const param_type& __p)
|
||||
{return __p.b() *
|
||||
_STD::pow(exponential_distribution<result_type>()(__g), 1/__p.a());}
|
||||
_VSTD::pow(exponential_distribution<result_type>()(__g), 1/__p.a());}
|
||||
|
||||
// property functions
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -4776,7 +4786,7 @@ _RealType
|
||||
extreme_value_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
|
||||
{
|
||||
return __p.a() - __p.b() *
|
||||
_STD::log(-_STD::log(1-uniform_real_distribution<result_type>()(__g)));
|
||||
_VSTD::log(-_VSTD::log(1-uniform_real_distribution<result_type>()(__g)));
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _RT>
|
||||
@@ -4913,7 +4923,7 @@ gamma_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
|
||||
const result_type __w = __u * (1 - __u);
|
||||
if (__w != 0)
|
||||
{
|
||||
const result_type __y = _STD::sqrt(__c / __w) *
|
||||
const result_type __y = _VSTD::sqrt(__c / __w) *
|
||||
(__u - result_type(0.5));
|
||||
__x = __b + __y;
|
||||
if (__x >= 0)
|
||||
@@ -4921,7 +4931,7 @@ gamma_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
|
||||
const result_type __z = 64 * __w * __w * __w * __v * __v;
|
||||
if (__z <= 1 - 2 * __y * __y / __x)
|
||||
break;
|
||||
if (_STD::log(__z) <= 2 * (__b * _STD::log(__x / __b) - __y))
|
||||
if (_VSTD::log(__z) <= 2 * (__b * _VSTD::log(__x / __b) - __y))
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -4935,14 +4945,14 @@ gamma_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
|
||||
const result_type __es = __egen(__g);
|
||||
if (__u <= 1 - __a)
|
||||
{
|
||||
__x = _STD::pow(__u, 1 / __a);
|
||||
__x = _VSTD::pow(__u, 1 / __a);
|
||||
if (__x <= __es)
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
const result_type __e = -_STD::log((1-__u)/__a);
|
||||
__x = _STD::pow(1 - __a + __a * __e, 1 / __a);
|
||||
const result_type __e = -_VSTD::log((1-__u)/__a);
|
||||
__x = _VSTD::pow(1 - __a + __a * __e, 1 / __a);
|
||||
if (__x <= __e + __es)
|
||||
break;
|
||||
}
|
||||
@@ -5414,7 +5424,7 @@ cauchy_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
|
||||
{
|
||||
uniform_real_distribution<result_type> __gen;
|
||||
// purposefully let tan arg get as close to pi/2 as it wants, tan will return a finite
|
||||
return __p.a() + __p.b() * _STD::tan(3.1415926535897932384626433832795 * __gen(__g));
|
||||
return __p.a() + __p.b() * _VSTD::tan(3.1415926535897932384626433832795 * __gen(__g));
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _RT>
|
||||
@@ -5652,7 +5662,7 @@ _RealType
|
||||
student_t_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
|
||||
{
|
||||
gamma_distribution<result_type> __gd(__p.n() * .5, 2);
|
||||
return __nd_(__g) * _STD::sqrt(__p.n()/__gd(__g));
|
||||
return __nd_(__g) * _VSTD::sqrt(__p.n()/__gd(__g));
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _RT>
|
||||
@@ -5833,12 +5843,12 @@ discrete_distribution<_IntType>::param_type::__init()
|
||||
{
|
||||
if (__p_.size() > 1)
|
||||
{
|
||||
double __s = _STD::accumulate(__p_.begin(), __p_.end(), 0.0);
|
||||
for (_STD::vector<double>::iterator __i = __p_.begin(), __e = __p_.end();
|
||||
double __s = _VSTD::accumulate(__p_.begin(), __p_.end(), 0.0);
|
||||
for (_VSTD::vector<double>::iterator __i = __p_.begin(), __e = __p_.end();
|
||||
__i < __e; ++__i)
|
||||
*__i /= __s;
|
||||
vector<double> __t(__p_.size() - 1);
|
||||
_STD::partial_sum(__p_.begin(), __p_.end() - 1, __t.begin());
|
||||
_VSTD::partial_sum(__p_.begin(), __p_.end() - 1, __t.begin());
|
||||
swap(__p_, __t);
|
||||
}
|
||||
else
|
||||
@@ -5854,8 +5864,8 @@ vector<double>
|
||||
discrete_distribution<_IntType>::param_type::probabilities() const
|
||||
{
|
||||
size_t __n = __p_.size();
|
||||
_STD::vector<double> __p(__n+1);
|
||||
_STD::adjacent_difference(__p_.begin(), __p_.end(), __p.begin());
|
||||
_VSTD::vector<double> __p(__n+1);
|
||||
_VSTD::adjacent_difference(__p_.begin(), __p_.end(), __p.begin());
|
||||
if (__n > 0)
|
||||
__p[__n] = 1 - __p_[__n-1];
|
||||
else
|
||||
@@ -5870,7 +5880,7 @@ discrete_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p)
|
||||
{
|
||||
uniform_real_distribution<double> __gen;
|
||||
return static_cast<_IntType>(
|
||||
_STD::upper_bound(__p.__p_.begin(), __p.__p_.end(), __gen(__g)) -
|
||||
_VSTD::upper_bound(__p.__p_.begin(), __p.__p_.end(), __gen(__g)) -
|
||||
__p.__p_.begin());
|
||||
}
|
||||
|
||||
@@ -6069,14 +6079,14 @@ void
|
||||
piecewise_constant_distribution<_RealType>::param_type::__init()
|
||||
{
|
||||
// __densities_ contains non-normalized areas
|
||||
result_type __total_area = _STD::accumulate(__densities_.begin(),
|
||||
result_type __total_area = _VSTD::accumulate(__densities_.begin(),
|
||||
__densities_.end(),
|
||||
result_type());
|
||||
for (size_t __i = 0; __i < __densities_.size(); ++__i)
|
||||
__densities_[__i] /= __total_area;
|
||||
// __densities_ contains normalized areas
|
||||
__areas_.assign(__densities_.size(), result_type());
|
||||
_STD::partial_sum(__densities_.begin(), __densities_.end() - 1,
|
||||
_VSTD::partial_sum(__densities_.begin(), __densities_.end() - 1,
|
||||
__areas_.begin() + 1);
|
||||
// __areas_ contains partial sums of normalized areas: [0, __densities_ - 1]
|
||||
__densities_.back() = 1 - __areas_.back(); // correct round off error
|
||||
@@ -6165,7 +6175,7 @@ piecewise_constant_distribution<_RealType>::operator()(_URNG& __g, const param_t
|
||||
{
|
||||
typedef uniform_real_distribution<result_type> _Gen;
|
||||
result_type __u = _Gen()(__g);
|
||||
ptrdiff_t __k = _STD::upper_bound(__p.__areas_.begin(), __p.__areas_.end(),
|
||||
ptrdiff_t __k = _VSTD::upper_bound(__p.__areas_.begin(), __p.__areas_.end(),
|
||||
__u) - __p.__areas_.begin() - 1;
|
||||
return (__u - __p.__areas_[__k]) / __p.__densities_[__k] + __p.__b_[__k];
|
||||
}
|
||||
@@ -6486,7 +6496,7 @@ piecewise_linear_distribution<_RealType>::operator()(_URNG& __g, const param_typ
|
||||
{
|
||||
typedef uniform_real_distribution<result_type> _Gen;
|
||||
result_type __u = _Gen()(__g);
|
||||
ptrdiff_t __k = _STD::upper_bound(__p.__areas_.begin(), __p.__areas_.end(),
|
||||
ptrdiff_t __k = _VSTD::upper_bound(__p.__areas_.begin(), __p.__areas_.end(),
|
||||
__u) - __p.__areas_.begin() - 1;
|
||||
__u -= __p.__areas_[__k];
|
||||
const result_type __dk = __p.__densities_[__k];
|
||||
@@ -6498,7 +6508,7 @@ piecewise_linear_distribution<_RealType>::operator()(_URNG& __g, const param_typ
|
||||
const result_type __bk1 = __p.__b_[__k+1];
|
||||
const result_type __deltab = __bk1 - __bk;
|
||||
return (__bk * __dk1 - __bk1 * __dk +
|
||||
_STD::sqrt(__deltab * (__deltab * __dk * __dk + 2 * __deltad * __u))) /
|
||||
_VSTD::sqrt(__deltab * (__deltab * __dk * __dk + 2 * __deltad * __u))) /
|
||||
__deltad;
|
||||
}
|
||||
|
||||
|
||||
@@ -274,10 +274,19 @@ public:
|
||||
>::type type;
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2> using ratio_multiply
|
||||
= typename __ratio_multiply<_R1, _R2>::type;
|
||||
|
||||
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_VISIBLE ratio_multiply
|
||||
: public __ratio_multiply<_R1, _R2>::type {};
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct __ratio_divide
|
||||
{
|
||||
@@ -292,10 +301,19 @@ public:
|
||||
>::type type;
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2> using ratio_divide
|
||||
= typename __ratio_divide<_R1, _R2>::type;
|
||||
|
||||
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_VISIBLE ratio_divide
|
||||
: public __ratio_divide<_R1, _R2>::type {};
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct __ratio_add
|
||||
{
|
||||
@@ -318,10 +336,19 @@ public:
|
||||
>::type type;
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2> using ratio_add
|
||||
= typename __ratio_add<_R1, _R2>::type;
|
||||
|
||||
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_VISIBLE ratio_add
|
||||
: public __ratio_add<_R1, _R2>::type {};
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct __ratio_subtract
|
||||
{
|
||||
@@ -344,10 +371,19 @@ public:
|
||||
>::type type;
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2> using ratio_subtract
|
||||
= typename __ratio_subtract<_R1, _R2>::type;
|
||||
|
||||
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct _LIBCPP_VISIBLE ratio_subtract
|
||||
: public __ratio_subtract<_R1, _R2>::type {};
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
// ratio_equal
|
||||
|
||||
template <class _R1, class _R2>
|
||||
|
||||
323
include/regex
323
include/regex
File diff suppressed because it is too large
Load Diff
@@ -49,24 +49,25 @@ public:
|
||||
scoped_allocator_adaptor();
|
||||
template <class OuterA2>
|
||||
scoped_allocator_adaptor(OuterA2&& outerAlloc,
|
||||
const InnerAllocs&... innerAllocs);
|
||||
scoped_allocator_adaptor(const scoped_allocator_adaptor& other);
|
||||
const InnerAllocs&... innerAllocs) noexcept;
|
||||
scoped_allocator_adaptor(const scoped_allocator_adaptor& other) noexcept;
|
||||
scoped_allocator_adaptor(scoped_allocator_adaptor&& other) noexcept;
|
||||
template <class OuterA2>
|
||||
scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& other);
|
||||
scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& other) noexcept;
|
||||
template <class OuterA2>
|
||||
scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>&& other);
|
||||
scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>&& other) noexcept;
|
||||
|
||||
~scoped_allocator_adaptor();
|
||||
|
||||
inner_allocator_type& inner_allocator();
|
||||
const inner_allocator_type& inner_allocator() const;
|
||||
inner_allocator_type& inner_allocator() noexcept;
|
||||
const inner_allocator_type& inner_allocator() const noexcept;
|
||||
|
||||
outer_allocator_type& outer_allocator();
|
||||
const outer_allocator_type& outer_allocator() const;
|
||||
outer_allocator_type& outer_allocator() noexcept;
|
||||
const outer_allocator_type& outer_allocator() const noexcept;
|
||||
|
||||
pointer allocate(size_type n);
|
||||
pointer allocate(size_type n, const_void_pointer hint);
|
||||
void deallocate(pointer p, size_type n);
|
||||
void deallocate(pointer p, size_type n) noexcept;
|
||||
|
||||
size_type max_size() const;
|
||||
template <class T, class... Args> void construct(T* p, Args&& args);
|
||||
@@ -83,18 +84,20 @@ public:
|
||||
void construct(pair<T1, T2>* p, pair<U, V>&& x);
|
||||
template <class T> void destroy(T* p);
|
||||
|
||||
scoped_allocator_adaptor select_on_container_copy_construction() const;
|
||||
template <class T> void destroy(T* p) noexcept;
|
||||
|
||||
scoped_allocator_adaptor select_on_container_copy_construction() const noexcept;
|
||||
};
|
||||
|
||||
template <class OuterA1, class OuterA2, class... InnerAllocs>
|
||||
bool
|
||||
operator==(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
|
||||
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b);
|
||||
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept;
|
||||
|
||||
template <class OuterA1, class OuterA2, class... InnerAllocs>
|
||||
bool
|
||||
operator!=(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
|
||||
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b);
|
||||
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept;
|
||||
|
||||
} // std
|
||||
|
||||
@@ -182,7 +185,7 @@ private:
|
||||
protected:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage() {}
|
||||
__scoped_allocator_storage() _NOEXCEPT {}
|
||||
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
@@ -190,8 +193,8 @@ protected:
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage(_OuterA2&& __outerAlloc,
|
||||
const _InnerAllocs& ...__innerAllocs)
|
||||
: outer_allocator_type(_STD::forward<_OuterA2>(__outerAlloc)),
|
||||
const _InnerAllocs& ...__innerAllocs) _NOEXCEPT
|
||||
: outer_allocator_type(_VSTD::forward<_OuterA2>(__outerAlloc)),
|
||||
__inner_(__innerAllocs...) {}
|
||||
|
||||
template <class _OuterA2,
|
||||
@@ -200,7 +203,7 @@ protected:
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage(
|
||||
const __scoped_allocator_storage<_OuterA2, _InnerAllocs...>& __other)
|
||||
const __scoped_allocator_storage<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
|
||||
: outer_allocator_type(__other.outer_allocator()),
|
||||
__inner_(__other.inner_allocator()) {}
|
||||
|
||||
@@ -210,9 +213,9 @@ protected:
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage(
|
||||
__scoped_allocator_storage<_OuterA2, _InnerAllocs...>&& __other)
|
||||
: outer_allocator_type(_STD::move(__other.outer_allocator())),
|
||||
__inner_(_STD::move(__other.inner_allocator())) {}
|
||||
__scoped_allocator_storage<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
|
||||
: outer_allocator_type(_VSTD::move(__other.outer_allocator())),
|
||||
__inner_(_VSTD::move(__other.inner_allocator())) {}
|
||||
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
@@ -220,27 +223,27 @@ protected:
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage(_OuterA2&& __o,
|
||||
const inner_allocator_type& __i)
|
||||
: outer_allocator_type(_STD::forward<_OuterA2>(__o)),
|
||||
const inner_allocator_type& __i) _NOEXCEPT
|
||||
: outer_allocator_type(_VSTD::forward<_OuterA2>(__o)),
|
||||
__inner_(__i)
|
||||
{
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inner_allocator_type& inner_allocator() {return __inner_;}
|
||||
inner_allocator_type& inner_allocator() _NOEXCEPT {return __inner_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const inner_allocator_type& inner_allocator() const {return __inner_;}
|
||||
const inner_allocator_type& inner_allocator() const _NOEXCEPT {return __inner_;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
outer_allocator_type& outer_allocator()
|
||||
outer_allocator_type& outer_allocator() _NOEXCEPT
|
||||
{return static_cast<outer_allocator_type&>(*this);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const outer_allocator_type& outer_allocator() const
|
||||
const outer_allocator_type& outer_allocator() const _NOEXCEPT
|
||||
{return static_cast<const outer_allocator_type&>(*this);}
|
||||
|
||||
scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
select_on_container_copy_construction() const
|
||||
select_on_container_copy_construction() const _NOEXCEPT
|
||||
{
|
||||
return scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
|
||||
(
|
||||
@@ -263,15 +266,15 @@ protected:
|
||||
typedef scoped_allocator_adaptor<_OuterAlloc> inner_allocator_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage() {}
|
||||
__scoped_allocator_storage() _NOEXCEPT {}
|
||||
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, _OuterA2>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage(_OuterA2&& __outerAlloc)
|
||||
: outer_allocator_type(_STD::forward<_OuterA2>(__outerAlloc)) {}
|
||||
__scoped_allocator_storage(_OuterA2&& __outerAlloc) _NOEXCEPT
|
||||
: outer_allocator_type(_VSTD::forward<_OuterA2>(__outerAlloc)) {}
|
||||
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
@@ -279,7 +282,7 @@ protected:
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage(
|
||||
const __scoped_allocator_storage<_OuterA2>& __other)
|
||||
const __scoped_allocator_storage<_OuterA2>& __other) _NOEXCEPT
|
||||
: outer_allocator_type(__other.outer_allocator()) {}
|
||||
|
||||
template <class _OuterA2,
|
||||
@@ -288,33 +291,33 @@ protected:
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage(
|
||||
__scoped_allocator_storage<_OuterA2>&& __other)
|
||||
: outer_allocator_type(_STD::move(__other.outer_allocator())) {}
|
||||
__scoped_allocator_storage<_OuterA2>&& __other) _NOEXCEPT
|
||||
: outer_allocator_type(_VSTD::move(__other.outer_allocator())) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inner_allocator_type& inner_allocator()
|
||||
inner_allocator_type& inner_allocator() _NOEXCEPT
|
||||
{return static_cast<inner_allocator_type&>(*this);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const inner_allocator_type& inner_allocator() const
|
||||
const inner_allocator_type& inner_allocator() const _NOEXCEPT
|
||||
{return static_cast<const inner_allocator_type&>(*this);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
outer_allocator_type& outer_allocator()
|
||||
outer_allocator_type& outer_allocator() _NOEXCEPT
|
||||
{return static_cast<outer_allocator_type&>(*this);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const outer_allocator_type& outer_allocator() const
|
||||
const outer_allocator_type& outer_allocator() const _NOEXCEPT
|
||||
{return static_cast<const outer_allocator_type&>(*this);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
scoped_allocator_adaptor<outer_allocator_type>
|
||||
select_on_container_copy_construction() const
|
||||
select_on_container_copy_construction() const _NOEXCEPT
|
||||
{return scoped_allocator_adaptor<outer_allocator_type>(
|
||||
allocator_traits<outer_allocator_type>::
|
||||
select_on_container_copy_construction(outer_allocator())
|
||||
);}
|
||||
|
||||
__scoped_allocator_storage(const outer_allocator_type& __o,
|
||||
const inner_allocator_type& __i);
|
||||
const inner_allocator_type& __i) _NOEXCEPT;
|
||||
|
||||
template <class...> friend class __scoped_allocator_storage;
|
||||
};
|
||||
@@ -343,7 +346,7 @@ struct __outermost
|
||||
{
|
||||
typedef _Alloc type;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
type& operator()(type& __a) const {return __a;}
|
||||
type& operator()(type& __a) const _NOEXCEPT {return __a;}
|
||||
};
|
||||
|
||||
template <class _Alloc>
|
||||
@@ -351,11 +354,11 @@ struct __outermost<_Alloc, true>
|
||||
{
|
||||
typedef typename remove_reference
|
||||
<
|
||||
decltype(_STD::declval<_Alloc>().outer_allocator())
|
||||
decltype(_VSTD::declval<_Alloc>().outer_allocator())
|
||||
>::type _OuterAlloc;
|
||||
typedef typename __outermost<_OuterAlloc>::type type;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
type& operator()(_Alloc& __a) const
|
||||
type& operator()(_Alloc& __a) const _NOEXCEPT
|
||||
{return __outermost<_OuterAlloc>()(__a.outer_allocator());}
|
||||
};
|
||||
|
||||
@@ -403,15 +406,15 @@ public:
|
||||
};
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
scoped_allocator_adaptor() {}
|
||||
scoped_allocator_adaptor() _NOEXCEPT {}
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, _OuterA2>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
scoped_allocator_adaptor(_OuterA2&& __outerAlloc,
|
||||
const _InnerAllocs& ...__innerAllocs)
|
||||
: base(_STD::forward<_OuterA2>(__outerAlloc), __innerAllocs...) {}
|
||||
const _InnerAllocs& ...__innerAllocs) _NOEXCEPT
|
||||
: base(_VSTD::forward<_OuterA2>(__outerAlloc), __innerAllocs...) {}
|
||||
// scoped_allocator_adaptor(const scoped_allocator_adaptor& __other) = default;
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
@@ -419,7 +422,7 @@ public:
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
scoped_allocator_adaptor(
|
||||
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __other)
|
||||
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
|
||||
: base(__other) {}
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
@@ -427,23 +430,23 @@ public:
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
scoped_allocator_adaptor(
|
||||
scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other)
|
||||
: base(_STD::move(__other)) {}
|
||||
scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
|
||||
: base(_VSTD::move(__other)) {}
|
||||
|
||||
// ~scoped_allocator_adaptor() = default;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inner_allocator_type& inner_allocator()
|
||||
inner_allocator_type& inner_allocator() _NOEXCEPT
|
||||
{return base::inner_allocator();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const inner_allocator_type& inner_allocator() const
|
||||
const inner_allocator_type& inner_allocator() const _NOEXCEPT
|
||||
{return base::inner_allocator();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
outer_allocator_type& outer_allocator()
|
||||
outer_allocator_type& outer_allocator() _NOEXCEPT
|
||||
{return base::outer_allocator();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const outer_allocator_type& outer_allocator() const
|
||||
const outer_allocator_type& outer_allocator() const _NOEXCEPT
|
||||
{return base::outer_allocator();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -456,7 +459,7 @@ public:
|
||||
allocate(outer_allocator(), __n, __hint);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void deallocate(pointer __p, size_type __n)
|
||||
void deallocate(pointer __p, size_type __n) _NOEXCEPT
|
||||
{allocator_traits<outer_allocator_type>::
|
||||
deallocate(outer_allocator(), __p, __n);}
|
||||
|
||||
@@ -468,7 +471,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void construct(_Tp* __p, _Args&& ...__args)
|
||||
{__construct(__uses_alloc_ctor<_Tp, inner_allocator_type, _Args...>(),
|
||||
__p, _STD::forward<_Args>(__args)...);}
|
||||
__p, _VSTD::forward<_Args>(__args)...);}
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void destroy(_Tp* __p)
|
||||
@@ -479,7 +482,7 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
scoped_allocator_adaptor select_on_container_copy_construction() const
|
||||
scoped_allocator_adaptor select_on_container_copy_construction() const _NOEXCEPT
|
||||
{return base::select_on_container_copy_construction();}
|
||||
|
||||
private:
|
||||
@@ -490,8 +493,8 @@ private:
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
scoped_allocator_adaptor(_OuterA2&& __o,
|
||||
const inner_allocator_type& __i)
|
||||
: base(_STD::forward<_OuterA2>(__o), __i) {}
|
||||
const inner_allocator_type& __i) _NOEXCEPT
|
||||
: base(_VSTD::forward<_OuterA2>(__o), __i) {}
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -502,7 +505,7 @@ private:
|
||||
(
|
||||
_OM()(outer_allocator()),
|
||||
__p,
|
||||
_STD::forward<_Args>(__args)...
|
||||
_VSTD::forward<_Args>(__args)...
|
||||
);
|
||||
}
|
||||
|
||||
@@ -517,7 +520,7 @@ private:
|
||||
__p,
|
||||
allocator_arg,
|
||||
inner_allocator(),
|
||||
_STD::forward<_Args>(__args)...
|
||||
_VSTD::forward<_Args>(__args)...
|
||||
);
|
||||
}
|
||||
|
||||
@@ -530,7 +533,7 @@ private:
|
||||
(
|
||||
_OM()(outer_allocator()),
|
||||
__p,
|
||||
_STD::forward<_Args>(__args)...,
|
||||
_VSTD::forward<_Args>(__args)...,
|
||||
inner_allocator()
|
||||
);
|
||||
}
|
||||
@@ -542,16 +545,16 @@ template <class _OuterA1, class _OuterA2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const scoped_allocator_adaptor<_OuterA1>& __a,
|
||||
const scoped_allocator_adaptor<_OuterA2>& __b)
|
||||
const scoped_allocator_adaptor<_OuterA2>& __b) _NOEXCEPT
|
||||
{
|
||||
return __a.outer_allocator() == __b.outer_allocator();
|
||||
}
|
||||
|
||||
template <class _OuterA1, class _OuterA2, class... _InnerAllocs>
|
||||
template <class _OuterA1, class _OuterA2, class _InnerA0, class... _InnerAllocs>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const scoped_allocator_adaptor<_OuterA1, _InnerAllocs...>& __a,
|
||||
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __b)
|
||||
operator==(const scoped_allocator_adaptor<_OuterA1, _InnerA0, _InnerAllocs...>& __a,
|
||||
const scoped_allocator_adaptor<_OuterA2, _InnerA0, _InnerAllocs...>& __b) _NOEXCEPT
|
||||
{
|
||||
return __a.outer_allocator() == __b.outer_allocator() &&
|
||||
__a.inner_allocator() == __b.inner_allocator();
|
||||
@@ -561,7 +564,7 @@ template <class _OuterA1, class _OuterA2, class... _InnerAllocs>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const scoped_allocator_adaptor<_OuterA1, _InnerAllocs...>& __a,
|
||||
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __b)
|
||||
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __b) _NOEXCEPT
|
||||
{
|
||||
return !(__a == __b);
|
||||
}
|
||||
|
||||
281
include/set
281
include/set
@@ -42,7 +42,12 @@ public:
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
// construct/copy/destroy:
|
||||
explicit set(const value_compare& comp = value_compare());
|
||||
set()
|
||||
noexcept(
|
||||
is_nothrow_default_constructible<allocator_type>::value &&
|
||||
is_nothrow_default_constructible<key_compare>::value &&
|
||||
is_nothrow_copy_constructible<key_compare>::value);
|
||||
explicit set(const value_compare& comp);
|
||||
set(const value_compare& comp, const allocator_type& a);
|
||||
template <class InputIterator>
|
||||
set(InputIterator first, InputIterator last,
|
||||
@@ -51,7 +56,10 @@ public:
|
||||
set(InputIterator first, InputIterator last, const value_compare& comp,
|
||||
const allocator_type& a);
|
||||
set(const set& s);
|
||||
set(set&& s);
|
||||
set(set&& s)
|
||||
noexcept(
|
||||
is_nothrow_move_constructible<allocator_type>::value &&
|
||||
is_nothrow_move_constructible<key_compare>::value);
|
||||
explicit set(const allocator_type& a);
|
||||
set(const set& s, const allocator_type& a);
|
||||
set(set&& s, const allocator_type& a);
|
||||
@@ -61,29 +69,33 @@ public:
|
||||
~set();
|
||||
|
||||
set& operator=(const set& s);
|
||||
set& operator=(set&& s);
|
||||
set& operator=(set&& s)
|
||||
noexcept(
|
||||
allocator_type::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value &&
|
||||
is_nothrow_move_assignable<key_compare>::value);
|
||||
set& operator=(initializer_list<value_type> il);
|
||||
|
||||
// iterators:
|
||||
iterator begin();
|
||||
const_iterator begin() const;
|
||||
iterator end();
|
||||
const_iterator end() const;
|
||||
iterator begin() noexcept;
|
||||
const_iterator begin() const noexcept;
|
||||
iterator end() noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
|
||||
reverse_iterator rbegin();
|
||||
const_reverse_iterator rbegin() const;
|
||||
reverse_iterator rend();
|
||||
const_reverse_iterator rend() const;
|
||||
reverse_iterator rbegin() noexcept;
|
||||
const_reverse_iterator rbegin() const noexcept;
|
||||
reverse_iterator rend() noexcept;
|
||||
const_reverse_iterator rend() const noexcept;
|
||||
|
||||
const_iterator cbegin() const;
|
||||
const_iterator cend() const;
|
||||
const_reverse_iterator crbegin() const;
|
||||
const_reverse_iterator crend() const;
|
||||
const_iterator cbegin() const noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
const_reverse_iterator crbegin() const noexcept;
|
||||
const_reverse_iterator crend() const noexcept;
|
||||
|
||||
// capacity:
|
||||
bool empty() const;
|
||||
size_type size() const;
|
||||
size_type max_size() const;
|
||||
bool empty() const noexcept;
|
||||
size_type size() const noexcept;
|
||||
size_type max_size() const noexcept;
|
||||
|
||||
// modifiers:
|
||||
template <class... Args>
|
||||
@@ -101,12 +113,16 @@ public:
|
||||
iterator erase(const_iterator position);
|
||||
size_type erase(const key_type& k);
|
||||
iterator erase(const_iterator first, const_iterator last);
|
||||
void clear();
|
||||
void clear() noexcept;
|
||||
|
||||
void swap(set& s);
|
||||
void swap(set& s)
|
||||
noexcept(
|
||||
__is_nothrow_swappable<key_compare>::value &&
|
||||
(!allocator_type::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value));
|
||||
|
||||
// observers:
|
||||
allocator_type get_allocator() const;
|
||||
allocator_type get_allocator() const noexcept;
|
||||
key_compare key_comp() const;
|
||||
value_compare value_comp() const;
|
||||
|
||||
@@ -155,7 +171,8 @@ operator<=(const set<Key, Compare, Allocator>& x,
|
||||
// specialized algorithms:
|
||||
template <class Key, class Compare, class Allocator>
|
||||
void
|
||||
swap(set<Key, Compare, Allocator>& x, set<Key, Compare, Allocator>& y);
|
||||
swap(set<Key, Compare, Allocator>& x, set<Key, Compare, Allocator>& y)
|
||||
noexcept(noexcept(x.swap(y)));
|
||||
|
||||
template <class Key, class Compare = less<Key>,
|
||||
class Allocator = allocator<Key>>
|
||||
@@ -181,7 +198,12 @@ public:
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
// construct/copy/destroy:
|
||||
explicit multiset(const value_compare& comp = value_compare());
|
||||
multiset()
|
||||
noexcept(
|
||||
is_nothrow_default_constructible<allocator_type>::value &&
|
||||
is_nothrow_default_constructible<key_compare>::value &&
|
||||
is_nothrow_copy_constructible<key_compare>::value);
|
||||
explicit multiset(const value_compare& comp);
|
||||
multiset(const value_compare& comp, const allocator_type& a);
|
||||
template <class InputIterator>
|
||||
multiset(InputIterator first, InputIterator last,
|
||||
@@ -190,7 +212,10 @@ public:
|
||||
multiset(InputIterator first, InputIterator last,
|
||||
const value_compare& comp, const allocator_type& a);
|
||||
multiset(const multiset& s);
|
||||
multiset(multiset&& s);
|
||||
multiset(multiset&& s)
|
||||
noexcept(
|
||||
is_nothrow_move_constructible<allocator_type>::value &&
|
||||
is_nothrow_move_constructible<key_compare>::value);
|
||||
explicit multiset(const allocator_type& a);
|
||||
multiset(const multiset& s, const allocator_type& a);
|
||||
multiset(multiset&& s, const allocator_type& a);
|
||||
@@ -200,29 +225,33 @@ public:
|
||||
~multiset();
|
||||
|
||||
multiset& operator=(const multiset& s);
|
||||
multiset& operator=(multiset&& s);
|
||||
multiset& operator=(multiset&& s)
|
||||
noexcept(
|
||||
allocator_type::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value &&
|
||||
is_nothrow_move_assignable<key_compare>::value);
|
||||
multiset& operator=(initializer_list<value_type> il);
|
||||
|
||||
// iterators:
|
||||
iterator begin();
|
||||
const_iterator begin() const;
|
||||
iterator end();
|
||||
const_iterator end() const;
|
||||
iterator begin() noexcept;
|
||||
const_iterator begin() const noexcept;
|
||||
iterator end() noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
|
||||
reverse_iterator rbegin();
|
||||
const_reverse_iterator rbegin() const;
|
||||
reverse_iterator rend();
|
||||
const_reverse_iterator rend() const;
|
||||
reverse_iterator rbegin() noexcept;
|
||||
const_reverse_iterator rbegin() const noexcept;
|
||||
reverse_iterator rend() noexcept;
|
||||
const_reverse_iterator rend() const noexcept;
|
||||
|
||||
const_iterator cbegin() const;
|
||||
const_iterator cend() const;
|
||||
const_reverse_iterator crbegin() const;
|
||||
const_reverse_iterator crend() const;
|
||||
const_iterator cbegin() const noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
const_reverse_iterator crbegin() const noexcept;
|
||||
const_reverse_iterator crend() const noexcept;
|
||||
|
||||
// capacity:
|
||||
bool empty() const;
|
||||
size_type size() const;
|
||||
size_type max_size() const;
|
||||
bool empty() const noexcept;
|
||||
size_type size() const noexcept;
|
||||
size_type max_size() const noexcept;
|
||||
|
||||
// modifiers:
|
||||
template <class... Args>
|
||||
@@ -240,12 +269,16 @@ public:
|
||||
iterator erase(const_iterator position);
|
||||
size_type erase(const key_type& k);
|
||||
iterator erase(const_iterator first, const_iterator last);
|
||||
void clear();
|
||||
void clear() noexcept;
|
||||
|
||||
void swap(multiset& s);
|
||||
void swap(multiset& s)
|
||||
noexcept(
|
||||
__is_nothrow_swappable<key_compare>::value &&
|
||||
(!allocator_type::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value));
|
||||
|
||||
// observers:
|
||||
allocator_type get_allocator() const;
|
||||
allocator_type get_allocator() const noexcept;
|
||||
key_compare key_comp() const;
|
||||
value_compare value_comp() const;
|
||||
|
||||
@@ -294,7 +327,8 @@ operator<=(const multiset<Key, Compare, Allocator>& x,
|
||||
// specialized algorithms:
|
||||
template <class Key, class Compare, class Allocator>
|
||||
void
|
||||
swap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y);
|
||||
swap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y)
|
||||
noexcept(noexcept(x.swap(y)));
|
||||
|
||||
} // std
|
||||
|
||||
@@ -336,11 +370,15 @@ public:
|
||||
typedef typename __base::difference_type difference_type;
|
||||
typedef typename __base::const_iterator iterator;
|
||||
typedef typename __base::const_iterator const_iterator;
|
||||
typedef _STD::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit set(const value_compare& __comp = value_compare())
|
||||
_NOEXCEPT_(
|
||||
is_nothrow_default_constructible<allocator_type>::value &&
|
||||
is_nothrow_default_constructible<key_compare>::value &&
|
||||
is_nothrow_copy_constructible<key_compare>::value)
|
||||
: __tree_(__comp) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
set(const value_compare& __comp, const allocator_type& __a)
|
||||
@@ -370,10 +408,18 @@ public:
|
||||
insert(__s.begin(), __s.end());
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
set& operator=(const set& __s)
|
||||
{
|
||||
__tree_ = __s.__tree_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
set(set&& __s)
|
||||
: __tree_(_STD::move(__s.__tree_)) {}
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
|
||||
: __tree_(_VSTD::move(__s.__tree_)) {}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -416,56 +462,61 @@ public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
set& operator=(set&& __s)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
|
||||
{
|
||||
__tree_ = _STD::move(__s.__tree_);
|
||||
__tree_ = _VSTD::move(__s.__tree_);
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return __tree_.begin();}
|
||||
iterator begin() _NOEXCEPT {return __tree_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return __tree_.begin();}
|
||||
const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return __tree_.end();}
|
||||
iterator end() _NOEXCEPT {return __tree_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return __tree_.end();}
|
||||
const_iterator end() const _NOEXCEPT {return __tree_.end();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reverse_iterator rbegin() {return reverse_iterator(end());}
|
||||
reverse_iterator rbegin() _NOEXCEPT
|
||||
{return reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
|
||||
const_reverse_iterator rbegin() const _NOEXCEPT
|
||||
{return const_reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reverse_iterator rend() {return reverse_iterator(begin());}
|
||||
reverse_iterator rend() _NOEXCEPT
|
||||
{return reverse_iterator(begin());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
|
||||
const_reverse_iterator rend() const _NOEXCEPT
|
||||
{return const_reverse_iterator(begin());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cbegin() const {return begin();}
|
||||
const_iterator cbegin() const _NOEXCEPT {return begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cend() const {return end();}
|
||||
const_iterator cend() const _NOEXCEPT {return end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crbegin() const {return rbegin();}
|
||||
const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crend() const {return rend();}
|
||||
const_reverse_iterator crend() const _NOEXCEPT {return rend();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return __tree_.size() == 0;}
|
||||
bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return __tree_.size();}
|
||||
size_type size() const _NOEXCEPT {return __tree_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const {return __tree_.max_size();}
|
||||
size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
|
||||
|
||||
// modifiers:
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> emplace(_Args&&... __args)
|
||||
{return __tree_.__emplace_unique(_STD::forward<_Args>(__args)...);}
|
||||
{return __tree_.__emplace_unique(_VSTD::forward<_Args>(__args)...);}
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator emplace_hint(const_iterator __p, _Args&&... __args)
|
||||
{return __tree_.__emplace_hint_unique(__p, _STD::forward<_Args>(__args)...);}
|
||||
{return __tree_.__emplace_hint_unique(__p, _VSTD::forward<_Args>(__args)...);}
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator,bool> insert(const value_type& __v)
|
||||
@@ -473,7 +524,7 @@ public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator,bool> insert(value_type&& __v)
|
||||
{return __tree_.__insert_unique(_STD::move(__v));}
|
||||
{return __tree_.__insert_unique(_VSTD::move(__v));}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __p, const value_type& __v)
|
||||
@@ -481,7 +532,7 @@ public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __p, value_type&& __v)
|
||||
{return __tree_.__insert_unique(__p, _STD::move(__v));}
|
||||
{return __tree_.__insert_unique(__p, _VSTD::move(__v));}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _InputIterator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -504,13 +555,14 @@ public:
|
||||
iterator erase(const_iterator __f, const_iterator __l)
|
||||
{return __tree_.erase(__f, __l);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() {__tree_.clear();}
|
||||
void clear() _NOEXCEPT {__tree_.clear();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(set& __s) {__tree_.swap(__s.__tree_);}
|
||||
void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
|
||||
{__tree_.swap(__s.__tree_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const {return __tree_.__alloc();}
|
||||
allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
key_compare key_comp() const {return __tree_.value_comp();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -548,13 +600,13 @@ public:
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a)
|
||||
: __tree_(_STD::move(__s.__tree_), __a)
|
||||
: __tree_(_VSTD::move(__s.__tree_), __a)
|
||||
{
|
||||
if (__a != __s.get_allocator())
|
||||
{
|
||||
const_iterator __e = cend();
|
||||
while (!__s.empty())
|
||||
insert(__e, _STD::move(__s.__tree_.remove(__s.begin())->__value_));
|
||||
insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -566,7 +618,7 @@ bool
|
||||
operator==(const set<_Key, _Compare, _Allocator>& __x,
|
||||
const set<_Key, _Compare, _Allocator>& __y)
|
||||
{
|
||||
return __x.size() == __y.size() && _STD::equal(__x.begin(), __x.end(), __y.begin());
|
||||
return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
|
||||
}
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
@@ -575,7 +627,7 @@ bool
|
||||
operator< (const set<_Key, _Compare, _Allocator>& __x,
|
||||
const set<_Key, _Compare, _Allocator>& __y)
|
||||
{
|
||||
return _STD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
|
||||
return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
|
||||
}
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
@@ -620,6 +672,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(set<_Key, _Compare, _Allocator>& __x,
|
||||
set<_Key, _Compare, _Allocator>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
@@ -652,12 +705,16 @@ public:
|
||||
typedef typename __base::difference_type difference_type;
|
||||
typedef typename __base::const_iterator iterator;
|
||||
typedef typename __base::const_iterator const_iterator;
|
||||
typedef _STD::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
// construct/copy/destroy:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit multiset(const value_compare& __comp = value_compare())
|
||||
_NOEXCEPT_(
|
||||
is_nothrow_default_constructible<allocator_type>::value &&
|
||||
is_nothrow_default_constructible<key_compare>::value &&
|
||||
is_nothrow_copy_constructible<key_compare>::value)
|
||||
: __tree_(__comp) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
multiset(const value_compare& __comp, const allocator_type& __a)
|
||||
@@ -688,10 +745,18 @@ public:
|
||||
insert(__s.begin(), __s.end());
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
multiset& operator=(const multiset& __s)
|
||||
{
|
||||
__tree_ = __s.__tree_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
multiset(multiset&& __s)
|
||||
: __tree_(_STD::move(__s.__tree_)) {}
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
|
||||
: __tree_(_VSTD::move(__s.__tree_)) {}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit multiset(const allocator_type& __a)
|
||||
@@ -731,56 +796,61 @@ public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
multiset& operator=(multiset&& __s)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
|
||||
{
|
||||
__tree_ = _STD::move(__s.__tree_);
|
||||
__tree_ = _VSTD::move(__s.__tree_);
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return __tree_.begin();}
|
||||
iterator begin() _NOEXCEPT {return __tree_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return __tree_.begin();}
|
||||
const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return __tree_.end();}
|
||||
iterator end() _NOEXCEPT {return __tree_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return __tree_.end();}
|
||||
const_iterator end() const _NOEXCEPT {return __tree_.end();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reverse_iterator rbegin() {return reverse_iterator(end());}
|
||||
reverse_iterator rbegin() _NOEXCEPT
|
||||
{return reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
|
||||
const_reverse_iterator rbegin() const _NOEXCEPT
|
||||
{return const_reverse_iterator(end());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reverse_iterator rend() {return reverse_iterator(begin());}
|
||||
reverse_iterator rend() _NOEXCEPT
|
||||
{return reverse_iterator(begin());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
|
||||
const_reverse_iterator rend() const _NOEXCEPT
|
||||
{return const_reverse_iterator(begin());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cbegin() const {return begin();}
|
||||
const_iterator cbegin() const _NOEXCEPT {return begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cend() const {return end();}
|
||||
const_iterator cend() const _NOEXCEPT {return end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crbegin() const {return rbegin();}
|
||||
const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reverse_iterator crend() const {return rend();}
|
||||
const_reverse_iterator crend() const _NOEXCEPT {return rend();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return __tree_.size() == 0;}
|
||||
bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return __tree_.size();}
|
||||
size_type size() const _NOEXCEPT {return __tree_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const {return __tree_.max_size();}
|
||||
size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
|
||||
|
||||
// modifiers:
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator emplace(_Args&&... __args)
|
||||
{return __tree_.__emplace_multi(_STD::forward<_Args>(__args)...);}
|
||||
{return __tree_.__emplace_multi(_VSTD::forward<_Args>(__args)...);}
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator emplace_hint(const_iterator __p, _Args&&... __args)
|
||||
{return __tree_.__emplace_hint_multi(__p, _STD::forward<_Args>(__args)...);}
|
||||
{return __tree_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);}
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const value_type& __v)
|
||||
@@ -788,7 +858,7 @@ public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(value_type&& __v)
|
||||
{return __tree_.__insert_multi(_STD::move(__v));}
|
||||
{return __tree_.__insert_multi(_VSTD::move(__v));}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __p, const value_type& __v)
|
||||
@@ -796,7 +866,7 @@ public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __p, value_type&& __v)
|
||||
{return __tree_.__insert_multi(_STD::move(__v));}
|
||||
{return __tree_.__insert_multi(_VSTD::move(__v));}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _InputIterator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -818,13 +888,15 @@ public:
|
||||
iterator erase(const_iterator __f, const_iterator __l)
|
||||
{return __tree_.erase(__f, __l);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() {__tree_.clear();}
|
||||
void clear() _NOEXCEPT {__tree_.clear();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(multiset& __s) {__tree_.swap(__s.__tree_);}
|
||||
void swap(multiset& __s)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<__base>::value)
|
||||
{__tree_.swap(__s.__tree_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const {return __tree_.__alloc();}
|
||||
allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
key_compare key_comp() const {return __tree_.value_comp();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -862,13 +934,13 @@ public:
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a)
|
||||
: __tree_(_STD::move(__s.__tree_), __a)
|
||||
: __tree_(_VSTD::move(__s.__tree_), __a)
|
||||
{
|
||||
if (__a != __s.get_allocator())
|
||||
{
|
||||
const_iterator __e = cend();
|
||||
while (!__s.empty())
|
||||
insert(__e, _STD::move(__s.__tree_.remove(__s.begin())->__value_));
|
||||
insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -880,7 +952,7 @@ bool
|
||||
operator==(const multiset<_Key, _Compare, _Allocator>& __x,
|
||||
const multiset<_Key, _Compare, _Allocator>& __y)
|
||||
{
|
||||
return __x.size() == __y.size() && _STD::equal(__x.begin(), __x.end(), __y.begin());
|
||||
return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
|
||||
}
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
@@ -889,7 +961,7 @@ bool
|
||||
operator< (const multiset<_Key, _Compare, _Allocator>& __x,
|
||||
const multiset<_Key, _Compare, _Allocator>& __y)
|
||||
{
|
||||
return _STD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
|
||||
return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
|
||||
}
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
@@ -933,6 +1005,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(multiset<_Key, _Compare, _Allocator>& __x,
|
||||
multiset<_Key, _Compare, _Allocator>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(basic_stringbuf&&
|
||||
ptrdiff_t __nout = __rhs.pptr() - __rhs.pbase();
|
||||
ptrdiff_t __eout = __rhs.epptr() - __rhs.pbase();
|
||||
ptrdiff_t __hm = __rhs.__hm_ - __rhs.pbase();
|
||||
__str_ = _STD::move(__rhs.__str_);
|
||||
__str_ = _VSTD::move(__rhs.__str_);
|
||||
char_type* __p = const_cast<char_type*>(__str_.data());
|
||||
this->setg(__p, __p + __ninp, __p + __einp);
|
||||
this->setp(__p, __p + __eout);
|
||||
@@ -284,7 +284,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs)
|
||||
ptrdiff_t __eout = __rhs.epptr() - __rhs.pbase();
|
||||
ptrdiff_t __hm = __rhs.__hm_ - __rhs.pbase();
|
||||
__mode_ = __rhs.__mode_;
|
||||
__str_ = _STD::move(__rhs.__str_);
|
||||
__str_ = _VSTD::move(__rhs.__str_);
|
||||
char_type* __p = const_cast<char_type*>(__str_.data());
|
||||
this->setg(__p, __p + __ninp, __p + __einp);
|
||||
this->setp(__p, __p + __eout);
|
||||
@@ -314,7 +314,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::swap(basic_stringbuf& __rhs)
|
||||
ptrdiff_t __lnout = this->pptr() - this->pbase();
|
||||
ptrdiff_t __leout = this->epptr() - this->pbase();
|
||||
ptrdiff_t __lhm = this->__hm_ - this->pbase();
|
||||
_STD::swap(__mode_, __rhs.__mode_);
|
||||
_VSTD::swap(__mode_, __rhs.__mode_);
|
||||
__str_.swap(__rhs.__str_);
|
||||
char_type* __p = const_cast<char_type*>(__str_.data());
|
||||
this->setg(__p, __p + __rninp, __p + __reinp);
|
||||
@@ -451,7 +451,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c)
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
__hm_ = max(this->pptr() + 1, __hm_);
|
||||
__hm_ = _VSTD::max(this->pptr() + 1, __hm_);
|
||||
if (__mode_ & ios_base::in)
|
||||
{
|
||||
char_type* __p = const_cast<char_type*>(__str_.data());
|
||||
@@ -582,8 +582,8 @@ basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(const stri
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(basic_istringstream&& __rhs)
|
||||
: basic_istream<_CharT, _Traits>(_STD::move(__rhs)),
|
||||
__sb_(_STD::move(__rhs.__sb_))
|
||||
: basic_istream<_CharT, _Traits>(_VSTD::move(__rhs)),
|
||||
__sb_(_VSTD::move(__rhs.__sb_))
|
||||
{
|
||||
basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
|
||||
}
|
||||
@@ -592,8 +592,8 @@ template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_istringstream<_CharT, _Traits, _Allocator>&
|
||||
basic_istringstream<_CharT, _Traits, _Allocator>::operator=(basic_istringstream&& __rhs)
|
||||
{
|
||||
basic_istream<char_type, traits_type>::operator=(_STD::move(__rhs));
|
||||
__sb_ = _STD::move(__rhs.__sb_);
|
||||
basic_istream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
|
||||
__sb_ = _VSTD::move(__rhs.__sb_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -701,8 +701,8 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(const stri
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(basic_ostringstream&& __rhs)
|
||||
: basic_ostream<_CharT, _Traits>(_STD::move(__rhs)),
|
||||
__sb_(_STD::move(__rhs.__sb_))
|
||||
: basic_ostream<_CharT, _Traits>(_VSTD::move(__rhs)),
|
||||
__sb_(_VSTD::move(__rhs.__sb_))
|
||||
{
|
||||
basic_ostream<_CharT, _Traits>::set_rdbuf(&__sb_);
|
||||
}
|
||||
@@ -711,8 +711,8 @@ template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_ostringstream<_CharT, _Traits, _Allocator>&
|
||||
basic_ostringstream<_CharT, _Traits, _Allocator>::operator=(basic_ostringstream&& __rhs)
|
||||
{
|
||||
basic_ostream<char_type, traits_type>::operator=(_STD::move(__rhs));
|
||||
__sb_ = _STD::move(__rhs.__sb_);
|
||||
basic_ostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
|
||||
__sb_ = _VSTD::move(__rhs.__sb_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -820,8 +820,8 @@ basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(const string
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(basic_stringstream&& __rhs)
|
||||
: basic_iostream<_CharT, _Traits>(_STD::move(__rhs)),
|
||||
__sb_(_STD::move(__rhs.__sb_))
|
||||
: basic_iostream<_CharT, _Traits>(_VSTD::move(__rhs)),
|
||||
__sb_(_VSTD::move(__rhs.__sb_))
|
||||
{
|
||||
basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
|
||||
}
|
||||
@@ -830,8 +830,8 @@ template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_stringstream<_CharT, _Traits, _Allocator>&
|
||||
basic_stringstream<_CharT, _Traits, _Allocator>::operator=(basic_stringstream&& __rhs)
|
||||
{
|
||||
basic_iostream<char_type, traits_type>::operator=(_STD::move(__rhs));
|
||||
__sb_ = _STD::move(__rhs.__sb_);
|
||||
basic_iostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
|
||||
__sb_ = _VSTD::move(__rhs.__sb_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,14 +31,21 @@ protected:
|
||||
container_type c;
|
||||
|
||||
public:
|
||||
explicit stack();
|
||||
stack() = default;
|
||||
~stack() = default;
|
||||
|
||||
stack(const stack& q) = default;
|
||||
stack(stack&& q) = default;
|
||||
|
||||
stack& operator=(const stack& q) = default;
|
||||
stack& operator=(stack&& q) = default;
|
||||
|
||||
explicit stack(const container_type& c);
|
||||
explicit stack(container_type&& c);
|
||||
stack(stack&& s);
|
||||
stack& operator=(stack&& s);
|
||||
template <class Alloc> explicit stack(const Alloc& a);
|
||||
template <class Alloc> stack(const container_type& c, const Alloc& a);
|
||||
template <class Alloc> stack(container_type&& c, const Alloc& a);
|
||||
template <class Alloc> stack(const stack& c, const Alloc& a);
|
||||
template <class Alloc> stack(stack&& c, const Alloc& a);
|
||||
|
||||
bool empty() const;
|
||||
@@ -51,7 +58,7 @@ public:
|
||||
template <class... Args> void emplace(Args&&... args);
|
||||
void pop();
|
||||
|
||||
void swap(stack& c);
|
||||
void swap(stack& c) noexcept(noexcept(swap(c, q.c)));
|
||||
};
|
||||
|
||||
template <class T, class Container>
|
||||
@@ -68,7 +75,8 @@ template <class T, class Container>
|
||||
bool operator<=(const stack<T, Container>& x, const stack<T, Container>& y);
|
||||
|
||||
template <class T, class Container>
|
||||
void swap(stack<T, Container>& x, stack<T, Container>& y);
|
||||
void swap(stack<T, Container>& x, stack<T, Container>& y)
|
||||
noexcept(noexcept(x.swap(y)));
|
||||
|
||||
} // std
|
||||
|
||||
@@ -106,16 +114,35 @@ protected:
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack() : c() {}
|
||||
stack()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<container_type>::value)
|
||||
: c() {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack(const stack& __q) : c(__q.c) {}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack(stack&& __q)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
|
||||
: c(_VSTD::move(__q.c)) {}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack& operator=(const stack& __q) {c = __q.c; return *this;}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack& operator=(stack&& __q)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
|
||||
{c = _VSTD::move(__q.c); return *this;}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit stack(const container_type& __c) : c(__c) {}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit stack(container_type&& __c) : c(_STD::move(__c)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack(stack&& __s) : c(_STD::move(__s.c)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack& operator=(stack&& __s) {c = _STD::move(__s.c); return *this;}
|
||||
explicit stack(container_type&& __c) : c(_VSTD::move(__c)) {}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -141,13 +168,13 @@ public:
|
||||
stack(container_type&& __c, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(_STD::move(__c), __a) {}
|
||||
: c(_VSTD::move(__c), __a) {}
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack(stack&& __s, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(_STD::move(__s.c), __a) {}
|
||||
: c(_VSTD::move(__s.c), __a) {}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -163,12 +190,12 @@ public:
|
||||
void push(const value_type& __v) {c.push_back(__v);}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void push(value_type&& __v) {c.push_back(_STD::move(__v));}
|
||||
void push(value_type&& __v) {c.push_back(_VSTD::move(__v));}
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void emplace(_Args&&... __args)
|
||||
{c.emplace_back(_STD::forward<_Args>(__args)...);}
|
||||
{c.emplace_back(_VSTD::forward<_Args>(__args)...);}
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -176,8 +203,9 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(stack& __s)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value)
|
||||
{
|
||||
using _STD::swap;
|
||||
using _VSTD::swap;
|
||||
swap(c, __s.c);
|
||||
}
|
||||
|
||||
@@ -244,6 +272,7 @@ template <class _Tp, class _Container>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
@@ -33,9 +33,9 @@ class xxx_error : public exception // at least indirectly
|
||||
{
|
||||
public:
|
||||
explicit xxx_error(const string& what_arg);
|
||||
explicit xxx_error(const char* what_arg); // extension
|
||||
explicit xxx_error(const char* what_arg);
|
||||
|
||||
virtual const char* what() const // returns what_arg
|
||||
virtual const char* what() const noexcept // returns what_arg
|
||||
};
|
||||
|
||||
} // std
|
||||
@@ -60,12 +60,12 @@ public:
|
||||
explicit logic_error(const string&);
|
||||
explicit logic_error(const char*);
|
||||
|
||||
logic_error(const logic_error&) throw();
|
||||
logic_error& operator=(const logic_error&) throw();
|
||||
logic_error(const logic_error&) _NOEXCEPT;
|
||||
logic_error& operator=(const logic_error&) _NOEXCEPT;
|
||||
|
||||
virtual ~logic_error() throw();
|
||||
virtual ~logic_error() _NOEXCEPT;
|
||||
|
||||
virtual const char* what() const throw();
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI runtime_error
|
||||
@@ -77,12 +77,12 @@ public:
|
||||
explicit runtime_error(const string&);
|
||||
explicit runtime_error(const char*);
|
||||
|
||||
runtime_error(const runtime_error&) throw();
|
||||
runtime_error& operator=(const runtime_error&) throw();
|
||||
runtime_error(const runtime_error&) _NOEXCEPT;
|
||||
runtime_error& operator=(const runtime_error&) _NOEXCEPT;
|
||||
|
||||
virtual ~runtime_error() throw();
|
||||
virtual ~runtime_error() _NOEXCEPT;
|
||||
|
||||
virtual const char* what() const throw();
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI domain_error
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit domain_error(const string& __s) : logic_error(__s) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit domain_error(const char* __s) : logic_error(__s) {}
|
||||
|
||||
virtual ~domain_error() throw();
|
||||
virtual ~domain_error() _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI invalid_argument
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const string& __s) : logic_error(__s) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const char* __s) : logic_error(__s) {}
|
||||
|
||||
virtual ~invalid_argument() throw();
|
||||
virtual ~invalid_argument() _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI length_error
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit length_error(const string& __s) : logic_error(__s) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit length_error(const char* __s) : logic_error(__s) {}
|
||||
|
||||
virtual ~length_error() throw();
|
||||
virtual ~length_error() _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI out_of_range
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit out_of_range(const string& __s) : logic_error(__s) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit out_of_range(const char* __s) : logic_error(__s) {}
|
||||
|
||||
virtual ~out_of_range() throw();
|
||||
virtual ~out_of_range() _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI range_error
|
||||
@@ -132,7 +132,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit range_error(const string& __s) : runtime_error(__s) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit range_error(const char* __s) : runtime_error(__s) {}
|
||||
|
||||
virtual ~range_error() throw();
|
||||
virtual ~range_error() _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI overflow_error
|
||||
@@ -142,7 +142,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit overflow_error(const string& __s) : runtime_error(__s) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit overflow_error(const char* __s) : runtime_error(__s) {}
|
||||
|
||||
virtual ~overflow_error() throw();
|
||||
virtual ~overflow_error() _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI underflow_error
|
||||
@@ -152,7 +152,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY explicit underflow_error(const string& __s) : runtime_error(__s) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit underflow_error(const char* __s) : runtime_error(__s) {}
|
||||
|
||||
virtual ~underflow_error() throw();
|
||||
virtual ~underflow_error() _NOEXCEPT;
|
||||
};
|
||||
|
||||
} // std
|
||||
|
||||
@@ -399,13 +399,13 @@ template <class _CharT, class _Traits>
|
||||
void
|
||||
basic_streambuf<_CharT, _Traits>::swap(basic_streambuf& __sb)
|
||||
{
|
||||
_STD::swap(__loc_, __sb.__loc_);
|
||||
_STD::swap(__binp_, __sb.__binp_);
|
||||
_STD::swap(__ninp_, __sb.__ninp_);
|
||||
_STD::swap(__einp_, __sb.__einp_);
|
||||
_STD::swap(__bout_, __sb.__bout_);
|
||||
_STD::swap(__nout_, __sb.__nout_);
|
||||
_STD::swap(__eout_, __sb.__eout_);
|
||||
_VSTD::swap(__loc_, __sb.__loc_);
|
||||
_VSTD::swap(__binp_, __sb.__binp_);
|
||||
_VSTD::swap(__ninp_, __sb.__ninp_);
|
||||
_VSTD::swap(__einp_, __sb.__einp_);
|
||||
_VSTD::swap(__bout_, __sb.__bout_);
|
||||
_VSTD::swap(__nout_, __sb.__nout_);
|
||||
_VSTD::swap(__eout_, __sb.__eout_);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
|
||||
1124
include/string
1124
include/string
File diff suppressed because it is too large
Load Diff
@@ -150,7 +150,9 @@ public:
|
||||
strstreambuf(const unsigned char* __gnext, streamsize __n);
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstreambuf(strstreambuf&& __rhs);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstreambuf& operator=(strstreambuf&& __rhs);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
@@ -187,6 +189,43 @@ private:
|
||||
void __init(char* __gnext, streamsize __n, char* __pbeg);
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
strstreambuf::strstreambuf(strstreambuf&& __rhs)
|
||||
: streambuf(__rhs),
|
||||
__strmode_(__rhs.__strmode_),
|
||||
__alsize_(__rhs.__alsize_),
|
||||
__palloc_(__rhs.__palloc_),
|
||||
__pfree_(__rhs.__pfree_)
|
||||
{
|
||||
__rhs.setg(nullptr, nullptr, nullptr);
|
||||
__rhs.setp(nullptr, nullptr);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
strstreambuf&
|
||||
strstreambuf::operator=(strstreambuf&& __rhs)
|
||||
{
|
||||
if (eback() && (__strmode_ & __allocated) != 0 && (__strmode_ & __frozen) == 0)
|
||||
{
|
||||
if (__pfree_)
|
||||
__pfree_(eback());
|
||||
else
|
||||
delete [] eback();
|
||||
}
|
||||
streambuf::operator=(__rhs);
|
||||
__strmode_ = __rhs.__strmode_;
|
||||
__alsize_ = __rhs.__alsize_;
|
||||
__palloc_ = __rhs.__palloc_;
|
||||
__pfree_ = __rhs.__pfree_;
|
||||
__rhs.setg(nullptr, nullptr, nullptr);
|
||||
__rhs.setp(nullptr, nullptr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
class _LIBCPP_VISIBLE istrstream
|
||||
: public istream
|
||||
{
|
||||
@@ -207,8 +246,8 @@ public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
istrstream(istrstream&& __rhs)
|
||||
: istream(_STD::move(__rhs)),
|
||||
__sb_(_STD::move(__rhs.__sb_))
|
||||
: istream(_VSTD::move(__rhs)),
|
||||
__sb_(_VSTD::move(__rhs.__sb_))
|
||||
{
|
||||
istream::set_rdbuf(&__sb_);
|
||||
}
|
||||
@@ -216,8 +255,8 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
istrstream& operator=(istrstream&& __rhs)
|
||||
{
|
||||
istream::operator=(_STD::move(__rhs));
|
||||
__sb_ = _STD::move(__rhs.__sb_);
|
||||
istream::operator=(_VSTD::move(__rhs));
|
||||
__sb_ = _VSTD::move(__rhs.__sb_);
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -256,8 +295,8 @@ public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
ostrstream(ostrstream&& __rhs)
|
||||
: ostream(_STD::move(__rhs)),
|
||||
__sb_(_STD::move(__rhs.__sb_))
|
||||
: ostream(_VSTD::move(__rhs)),
|
||||
__sb_(_VSTD::move(__rhs.__sb_))
|
||||
{
|
||||
ostream::set_rdbuf(&__sb_);
|
||||
}
|
||||
@@ -265,8 +304,8 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
ostrstream& operator=(ostrstream&& __rhs)
|
||||
{
|
||||
ostream::operator=(_STD::move(__rhs));
|
||||
__sb_ = _STD::move(__rhs.__sb_);
|
||||
ostream::operator=(_VSTD::move(__rhs));
|
||||
__sb_ = _VSTD::move(__rhs.__sb_);
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -316,8 +355,8 @@ public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstream(strstream&& __rhs)
|
||||
: iostream(_STD::move(__rhs)),
|
||||
__sb_(_STD::move(__rhs.__sb_))
|
||||
: iostream(_VSTD::move(__rhs)),
|
||||
__sb_(_VSTD::move(__rhs.__sb_))
|
||||
{
|
||||
iostream::set_rdbuf(&__sb_);
|
||||
}
|
||||
@@ -325,8 +364,8 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstream& operator=(strstream&& __rhs)
|
||||
{
|
||||
iostream::operator=(_STD::move(__rhs));
|
||||
__sb_ = _STD::move(__rhs.__sb_);
|
||||
iostream::operator=(_VSTD::move(__rhs));
|
||||
__sb_ = _VSTD::move(__rhs.__sb_);
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
@@ -20,24 +20,24 @@ namespace std
|
||||
class error_category
|
||||
{
|
||||
public:
|
||||
virtual ~error_category();
|
||||
virtual ~error_category() noexcept;
|
||||
|
||||
error_category(const error_category&) = delete;
|
||||
error_category& operator=(const error_category&) = delete;
|
||||
|
||||
virtual const char* name() const = 0;
|
||||
virtual error_condition default_error_condition(int ev) const;
|
||||
virtual bool equivalent(int code, const error_condition& condition) const;
|
||||
virtual bool equivalent(const error_code& code, int condition) const;
|
||||
virtual const char* name() const noexcept = 0;
|
||||
virtual error_condition default_error_condition(int ev) const noexcept;
|
||||
virtual bool equivalent(int code, const error_condition& condition) const noexcept;
|
||||
virtual bool equivalent(const error_code& code, int condition) const noexcept;
|
||||
virtual string message(int ev) const = 0;
|
||||
|
||||
bool operator==(const error_category& rhs) const;
|
||||
bool operator!=(const error_category& rhs) const;
|
||||
bool operator<(const error_category& rhs) const;
|
||||
bool operator==(const error_category& rhs) const noexcept;
|
||||
bool operator!=(const error_category& rhs) const noexcept;
|
||||
bool operator<(const error_category& rhs) const noexcept;
|
||||
};
|
||||
|
||||
const error_category& generic_category();
|
||||
const error_category& system_category();
|
||||
const error_category& generic_category() noexcept;
|
||||
const error_category& system_category() noexcept;
|
||||
|
||||
template <class T> struct is_error_code_enum
|
||||
: public false_type {};
|
||||
@@ -49,27 +49,27 @@ class error_code
|
||||
{
|
||||
public:
|
||||
// constructors:
|
||||
error_code();
|
||||
error_code(int val, const error_category& cat);
|
||||
error_code() noexcept;
|
||||
error_code(int val, const error_category& cat) noexcept;
|
||||
template <class ErrorCodeEnum>
|
||||
error_code(ErrorCodeEnum e);
|
||||
error_code(ErrorCodeEnum e) noexcept;
|
||||
|
||||
// modifiers:
|
||||
void assign(int val, const error_category& cat);
|
||||
void assign(int val, const error_category& cat) noexcept;
|
||||
template <class ErrorCodeEnum>
|
||||
error_code& operator=(ErrorCodeEnum e);
|
||||
void clear();
|
||||
error_code& operator=(ErrorCodeEnum e) noexcept;
|
||||
void clear() noexcept;
|
||||
|
||||
// observers:
|
||||
int value() const;
|
||||
const error_category& category() const;
|
||||
error_condition default_error_condition() const;
|
||||
int value() const noexcept;
|
||||
const error_category& category() const noexcept;
|
||||
error_condition default_error_condition() const noexcept;
|
||||
string message() const;
|
||||
explicit operator bool() const;
|
||||
explicit operator bool() const noexcept;
|
||||
};
|
||||
|
||||
// non-member functions:
|
||||
bool operator<(const error_code& lhs, const error_code& rhs);
|
||||
bool operator<(const error_code& lhs, const error_code& rhs) noexcept;
|
||||
template <class charT, class traits>
|
||||
basic_ostream<charT,traits>&
|
||||
operator<<(basic_ostream<charT,traits>& os, const error_code& ec);
|
||||
@@ -78,25 +78,25 @@ class error_condition
|
||||
{
|
||||
public:
|
||||
// constructors:
|
||||
error_condition();
|
||||
error_condition(int val, const error_category& cat);
|
||||
error_condition() noexcept;
|
||||
error_condition(int val, const error_category& cat) noexcept;
|
||||
template <class ErrorConditionEnum>
|
||||
error_condition(ErrorConditionEnum e);
|
||||
error_condition(ErrorConditionEnum e) noexcept;
|
||||
|
||||
// modifiers:
|
||||
void assign(int val, const error_category& cat);
|
||||
void assign(int val, const error_category& cat) noexcept;
|
||||
template <class ErrorConditionEnum>
|
||||
error_condition& operator=(ErrorConditionEnum e);
|
||||
void clear();
|
||||
error_condition& operator=(ErrorConditionEnum e) noexcept;
|
||||
void clear() noexcept;
|
||||
|
||||
// observers:
|
||||
int value() const;
|
||||
const error_category& category() const;
|
||||
string message() const;
|
||||
explicit operator bool() const;
|
||||
int value() const noexcept;
|
||||
const error_category& category() const noexcept;
|
||||
string message() const noexcept;
|
||||
explicit operator bool() const noexcept;
|
||||
};
|
||||
|
||||
bool operator<(const error_condition& lhs, const error_condition& rhs);
|
||||
bool operator<(const error_condition& lhs, const error_condition& rhs) noexcept;
|
||||
|
||||
class system_error
|
||||
: public runtime_error
|
||||
@@ -109,8 +109,8 @@ public:
|
||||
system_error(int ev, const error_category& ecat, const char* what_arg);
|
||||
system_error(int ev, const error_category& ecat);
|
||||
|
||||
const error_code& code() const throw();
|
||||
const char* what() const throw();
|
||||
const error_code& code() const noexcept;
|
||||
const char* what() const noexcept;
|
||||
};
|
||||
|
||||
enum class errc
|
||||
@@ -198,18 +198,18 @@ enum class errc
|
||||
template <> struct is_error_condition_enum<errc>
|
||||
: true_type { }
|
||||
|
||||
error_code make_error_code(errc e);
|
||||
error_condition make_error_condition(errc e);
|
||||
error_code make_error_code(errc e) noexcept;
|
||||
error_condition make_error_condition(errc e) noexcept;
|
||||
|
||||
// Comparison operators:
|
||||
bool operator==(const error_code& lhs, const error_code& rhs);
|
||||
bool operator==(const error_code& lhs, const error_condition& rhs);
|
||||
bool operator==(const error_condition& lhs, const error_code& rhs);
|
||||
bool operator==(const error_condition& lhs, const error_condition& rhs);
|
||||
bool operator!=(const error_code& lhs, const error_code& rhs);
|
||||
bool operator!=(const error_code& lhs, const error_condition& rhs);
|
||||
bool operator!=(const error_condition& lhs, const error_code& rhs);
|
||||
bool operator!=(const error_condition& lhs, const error_condition& rhs);
|
||||
bool operator==(const error_code& lhs, const error_code& rhs) noexcept;
|
||||
bool operator==(const error_code& lhs, const error_condition& rhs) noexcept;
|
||||
bool operator==(const error_condition& lhs, const error_code& rhs) noexcept;
|
||||
bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept;
|
||||
bool operator!=(const error_code& lhs, const error_code& rhs) noexcept;
|
||||
bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept;
|
||||
bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept;
|
||||
bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept;
|
||||
|
||||
template <> struct hash<std::error_code>;
|
||||
|
||||
@@ -369,28 +369,28 @@ class __do_message;
|
||||
class _LIBCPP_VISIBLE error_category
|
||||
{
|
||||
public:
|
||||
virtual ~error_category();
|
||||
virtual ~error_category() _NOEXCEPT;
|
||||
|
||||
private:
|
||||
error_category();
|
||||
error_category() _NOEXCEPT;
|
||||
error_category(const error_category&);// = delete;
|
||||
error_category& operator=(const error_category&);// = delete;
|
||||
|
||||
public:
|
||||
virtual const char* name() const = 0;
|
||||
virtual error_condition default_error_condition(int __ev) const;
|
||||
virtual bool equivalent(int __code, const error_condition& __condition) const;
|
||||
virtual bool equivalent(const error_code& __code, int __condition) const;
|
||||
virtual const char* name() const _NOEXCEPT = 0;
|
||||
virtual error_condition default_error_condition(int __ev) const _NOEXCEPT;
|
||||
virtual bool equivalent(int __code, const error_condition& __condition) const _NOEXCEPT;
|
||||
virtual bool equivalent(const error_code& __code, int __condition) const _NOEXCEPT;
|
||||
virtual string message(int __ev) const = 0;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool operator==(const error_category& __rhs) const {return this == &__rhs;}
|
||||
bool operator==(const error_category& __rhs) const _NOEXCEPT {return this == &__rhs;}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool operator!=(const error_category& __rhs) const {return !(*this == __rhs);}
|
||||
bool operator!=(const error_category& __rhs) const _NOEXCEPT {return !(*this == __rhs);}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool operator< (const error_category& __rhs) const {return this < &__rhs;}
|
||||
bool operator< (const error_category& __rhs) const _NOEXCEPT {return this < &__rhs;}
|
||||
|
||||
friend class __do_message;
|
||||
};
|
||||
@@ -402,8 +402,8 @@ public:
|
||||
virtual string message(int ev) const;
|
||||
};
|
||||
|
||||
const error_category& generic_category();
|
||||
const error_category& system_category();
|
||||
const error_category& generic_category() _NOEXCEPT;
|
||||
const error_category& system_category() _NOEXCEPT;
|
||||
|
||||
class _LIBCPP_VISIBLE error_condition
|
||||
{
|
||||
@@ -411,19 +411,21 @@ class _LIBCPP_VISIBLE error_condition
|
||||
const error_category* __cat_;
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
error_condition() : __val_(0), __cat_(&generic_category()) {}
|
||||
error_condition() _NOEXCEPT : __val_(0), __cat_(&generic_category()) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
error_condition(int __val, const error_category& __cat)
|
||||
error_condition(int __val, const error_category& __cat) _NOEXCEPT
|
||||
: __val_(__val), __cat_(&__cat) {}
|
||||
|
||||
template <class _E>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
error_condition(_E __e, typename enable_if<is_error_condition_enum<_E>::value>::type* = 0)
|
||||
error_condition(_E __e,
|
||||
typename enable_if<is_error_condition_enum<_E>::value>::type* = 0
|
||||
) _NOEXCEPT
|
||||
{*this = make_error_condition(__e);}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
void assign(int __val, const error_category& __cat)
|
||||
void assign(int __val, const error_category& __cat) _NOEXCEPT
|
||||
{
|
||||
__val_ = __val;
|
||||
__cat_ = &__cat;
|
||||
@@ -436,38 +438,38 @@ public:
|
||||
is_error_condition_enum<_E>::value,
|
||||
error_condition&
|
||||
>::type
|
||||
operator=(_E __e)
|
||||
operator=(_E __e) _NOEXCEPT
|
||||
{*this = make_error_condition(__e); return *this;}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
void clear()
|
||||
void clear() _NOEXCEPT
|
||||
{
|
||||
__val_ = 0;
|
||||
__cat_ = &generic_category();
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
int value() const {return __val_;}
|
||||
int value() const _NOEXCEPT {return __val_;}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
const error_category& category() const {return *__cat_;}
|
||||
const error_category& category() const _NOEXCEPT {return *__cat_;}
|
||||
string message() const;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
//explicit
|
||||
operator bool() const {return __val_ != 0;}
|
||||
operator bool() const _NOEXCEPT {return __val_ != 0;}
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
error_condition
|
||||
make_error_condition(errc __e)
|
||||
make_error_condition(errc __e) _NOEXCEPT
|
||||
{
|
||||
return error_condition(static_cast<int>(__e), generic_category());
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<(const error_condition& __x, const error_condition& __y)
|
||||
operator<(const error_condition& __x, const error_condition& __y) _NOEXCEPT
|
||||
{
|
||||
return __x.category() < __y.category()
|
||||
|| __x.category() == __y.category() && __x.value() < __y.value();
|
||||
@@ -481,19 +483,21 @@ class _LIBCPP_VISIBLE error_code
|
||||
const error_category* __cat_;
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
error_code() : __val_(0), __cat_(&system_category()) {}
|
||||
error_code() _NOEXCEPT : __val_(0), __cat_(&system_category()) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
error_code(int __val, const error_category& __cat)
|
||||
error_code(int __val, const error_category& __cat) _NOEXCEPT
|
||||
: __val_(__val), __cat_(&__cat) {}
|
||||
|
||||
template <class _E>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
error_code(_E __e, typename enable_if<is_error_code_enum<_E>::value>::type* = 0)
|
||||
error_code(_E __e,
|
||||
typename enable_if<is_error_code_enum<_E>::value>::type* = 0
|
||||
) _NOEXCEPT
|
||||
{*this = make_error_code(__e);}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
void assign(int __val, const error_category& __cat)
|
||||
void assign(int __val, const error_category& __cat) _NOEXCEPT
|
||||
{
|
||||
__val_ = __val;
|
||||
__cat_ = &__cat;
|
||||
@@ -506,43 +510,43 @@ public:
|
||||
is_error_code_enum<_E>::value,
|
||||
error_code&
|
||||
>::type
|
||||
operator=(_E __e)
|
||||
operator=(_E __e) _NOEXCEPT
|
||||
{*this = make_error_code(__e); return *this;}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
void clear()
|
||||
void clear() _NOEXCEPT
|
||||
{
|
||||
__val_ = 0;
|
||||
__cat_ = &system_category();
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
int value() const {return __val_;}
|
||||
int value() const _NOEXCEPT {return __val_;}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
const error_category& category() const {return *__cat_;}
|
||||
const error_category& category() const _NOEXCEPT {return *__cat_;}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
error_condition default_error_condition() const
|
||||
error_condition default_error_condition() const _NOEXCEPT
|
||||
{return __cat_->default_error_condition(__val_);}
|
||||
|
||||
string message() const;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
//explicit
|
||||
operator bool() const {return __val_ != 0;}
|
||||
operator bool() const _NOEXCEPT {return __val_ != 0;}
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
error_code
|
||||
make_error_code(errc __e)
|
||||
make_error_code(errc __e) _NOEXCEPT
|
||||
{
|
||||
return error_code(static_cast<int>(__e), generic_category());
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<(const error_code& __x, const error_code& __y)
|
||||
operator<(const error_code& __x, const error_code& __y) _NOEXCEPT
|
||||
{
|
||||
return __x.category() < __y.category()
|
||||
|| __x.category() == __y.category() && __x.value() < __y.value();
|
||||
@@ -550,14 +554,14 @@ operator<(const error_code& __x, const error_code& __y)
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const error_code& __x, const error_code& __y)
|
||||
operator==(const error_code& __x, const error_code& __y) _NOEXCEPT
|
||||
{
|
||||
return __x.category() == __y.category() && __x.value() == __y.value();
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const error_code& __x, const error_condition& __y)
|
||||
operator==(const error_code& __x, const error_condition& __y) _NOEXCEPT
|
||||
{
|
||||
return __x.category().equivalent(__x.value(), __y)
|
||||
|| __y.category().equivalent(__x, __y.value());
|
||||
@@ -565,40 +569,44 @@ operator==(const error_code& __x, const error_condition& __y)
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const error_condition& __x, const error_code& __y)
|
||||
operator==(const error_condition& __x, const error_code& __y) _NOEXCEPT
|
||||
{
|
||||
return __y == __x;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const error_condition& __x, const error_condition& __y)
|
||||
operator==(const error_condition& __x, const error_condition& __y) _NOEXCEPT
|
||||
{
|
||||
return __x.category() == __y.category() && __x.value() == __y.value();
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const error_code& __x, const error_code& __y) {return !(__x == __y);}
|
||||
operator!=(const error_code& __x, const error_code& __y) _NOEXCEPT
|
||||
{return !(__x == __y);}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const error_code& __x, const error_condition& __y) {return !(__x == __y);}
|
||||
operator!=(const error_code& __x, const error_condition& __y) _NOEXCEPT
|
||||
{return !(__x == __y);}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const error_condition& __x, const error_code& __y) {return !(__x == __y);}
|
||||
operator!=(const error_condition& __x, const error_code& __y) _NOEXCEPT
|
||||
{return !(__x == __y);}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const error_condition& __x, const error_condition& __y) {return !(__x == __y);}
|
||||
operator!=(const error_condition& __x, const error_condition& __y) _NOEXCEPT
|
||||
{return !(__x == __y);}
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_VISIBLE hash<error_code>
|
||||
: public unary_function<error_code, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const error_code& __ec) const
|
||||
size_t operator()(const error_code& __ec) const _NOEXCEPT
|
||||
{
|
||||
return static_cast<size_t>(__ec.value());
|
||||
}
|
||||
@@ -617,10 +625,10 @@ public:
|
||||
system_error(int __ev, const error_category& __ecat, const string& __what_arg);
|
||||
system_error(int __ev, const error_category& __ecat, const char* __what_arg);
|
||||
system_error(int __ev, const error_category& __ecat);
|
||||
~system_error() throw();
|
||||
~system_error() _NOEXCEPT;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
const error_code& code() const throw() {return __ec_;}
|
||||
const error_code& code() const _NOEXCEPT {return __ec_;}
|
||||
|
||||
private:
|
||||
static string __init(const error_code&, string);
|
||||
|
||||
@@ -95,6 +95,9 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
|
||||
#include <system_error>
|
||||
#include <chrono>
|
||||
#include <__mutex_base>
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#include <tuple>
|
||||
#endif
|
||||
#include <pthread.h>
|
||||
|
||||
#pragma GCC system_header
|
||||
@@ -281,7 +284,7 @@ public:
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(thread& __t) {_STD::swap(__t_, __t.__t_);}
|
||||
void swap(thread& __t) {_VSTD::swap(__t_, __t.__t_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool joinable() const {return __t_ != 0;}
|
||||
@@ -297,7 +300,7 @@ public:
|
||||
|
||||
class __assoc_sub_state;
|
||||
|
||||
class __thread_struct_imp;
|
||||
class _LIBCPP_HIDDEN __thread_struct_imp;
|
||||
|
||||
class __thread_struct
|
||||
{
|
||||
@@ -315,6 +318,44 @@ public:
|
||||
|
||||
__thread_specific_ptr<__thread_struct>& __thread_local_data();
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _F, class ..._Args, size_t ..._Indices>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__threaad_execute(tuple<_F, _Args...>& __t, __tuple_indices<_Indices...>)
|
||||
{
|
||||
__invoke(_VSTD::move(_VSTD::get<0>(__t)), _VSTD::move(_VSTD::get<_Indices>(__t))...);
|
||||
}
|
||||
|
||||
template <class _F>
|
||||
void*
|
||||
__thread_proxy(void* __vp)
|
||||
{
|
||||
__thread_local_data().reset(new __thread_struct);
|
||||
std::unique_ptr<_F> __p(static_cast<_F*>(__vp));
|
||||
typedef typename __make_tuple_indices<tuple_size<_F>::value, 1>::type _Index;
|
||||
__threaad_execute(*__p, _Index());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <class _F, class ..._Args,
|
||||
class
|
||||
>
|
||||
thread::thread(_F&& __f, _Args&&... __args)
|
||||
{
|
||||
typedef tuple<typename decay<_F>::type, typename decay<_Args>::type...> _G;
|
||||
_VSTD::unique_ptr<_G> __p(new _G(__decay_copy(_VSTD::forward<_F>(__f)),
|
||||
__decay_copy(_VSTD::forward<_Args>(__args))...));
|
||||
int __ec = pthread_create(&__t_, 0, &__thread_proxy<_G>, __p.get());
|
||||
if (__ec == 0)
|
||||
__p.release();
|
||||
else
|
||||
__throw_system_error(__ec, "thread constructor failed");
|
||||
}
|
||||
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _F>
|
||||
void*
|
||||
__thread_proxy(void* __vp)
|
||||
@@ -325,25 +366,6 @@ __thread_proxy(void* __vp)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _F, class ..._Args,
|
||||
class
|
||||
>
|
||||
thread::thread(_F&& __f, _Args&&... __args)
|
||||
{
|
||||
typedef decltype(bind(std::forward<_F>(__f), std::forward<_Args>(__args)...)) _G;
|
||||
std::unique_ptr<_G> __p(new _G(bind(std::forward<_F>(__f),
|
||||
std::forward<_Args>(__args)...)));
|
||||
int __ec = pthread_create(&__t_, 0, &__thread_proxy<_G>, __p.get());
|
||||
if (__ec == 0)
|
||||
__p.release();
|
||||
else
|
||||
__throw_system_error(__ec, "thread constructor failed");
|
||||
}
|
||||
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _F>
|
||||
thread::thread(_F __f)
|
||||
{
|
||||
|
||||
333
include/tuple
333
include/tuple
@@ -25,7 +25,7 @@ public:
|
||||
template <class... U>
|
||||
explicit tuple(U&&...);
|
||||
tuple(const tuple&) = default;
|
||||
tuple(tuple&&);
|
||||
tuple(tuple&&) = default;
|
||||
template <class... U>
|
||||
tuple(const tuple<U...>&);
|
||||
template <class... U>
|
||||
@@ -56,7 +56,8 @@ public:
|
||||
tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&&);
|
||||
|
||||
tuple& operator=(const tuple&);
|
||||
tuple& operator=(tuple&&);
|
||||
tuple&
|
||||
operator=(tuple&&) noexcept(AND(is_nothrow_move_assignable<T>::value ...));
|
||||
template <class... U>
|
||||
tuple& operator=(const tuple<U...>&);
|
||||
template <class... U>
|
||||
@@ -66,19 +67,16 @@ public:
|
||||
template <class U1, class U2>
|
||||
tuple& operator=(pair<U1, U2>&&); //iffsizeof...(T) == 2
|
||||
|
||||
void swap(tuple&);
|
||||
void swap(tuple&) noexcept(AND(swap(declval<T&>(), declval<T&>())...));
|
||||
};
|
||||
|
||||
const unspecified ignore;
|
||||
|
||||
template <class... T> tuple<V...> make_tuple(T&&...);
|
||||
template <class... T> tuple<ATypes...> forward_as_tuple(T&&...);
|
||||
template <class... T> tuple<T&...> tie(T&...);
|
||||
template <class... T, class... U> tuple<T..., U...> tuple_cat(const tuple<T...>&, const tuple<U...>&);
|
||||
template <class... T, class... U> tuple<T..., U...> tuple_cat(tuple<T...>&&, const tuple<U...>&);
|
||||
template <class... T, class... U> tuple<T..., U...> tuple_cat(const tuple<T...>&, tuple<U...>&&);
|
||||
template <class... T, class... U> tuple<T..., U...> tuple_cat(tuple<T...>&&, tuple<U...>&&);
|
||||
|
||||
template <class... T> tuple<ATypes...> forward_as_tuple(T&&...) noexcept;
|
||||
template <class... T> tuple<T&...> tie(T&...) noexcept;
|
||||
template <class... Tuples> tuple<CTypes...> tuple_cat(Tuples&&... tpls);
|
||||
|
||||
// 20.4.1.4, tuple helper classes:
|
||||
template <class T> class tuple_size; // undefined
|
||||
template <class... T> class tuple_size<tuple<T...>>;
|
||||
@@ -86,9 +84,15 @@ template <intsize_t I, class T> class tuple_element; // undefined
|
||||
template <intsize_t I, class... T> class tuple_element<I, tuple<T...>>;
|
||||
|
||||
// 20.4.1.5, element access:
|
||||
template <intsize_t I, class... T> typename tuple_element<I, tuple<T...>>::type& get(tuple<T...>&);
|
||||
template <intsize_t I, class... T> typename tuple_element<I, tuple<T...>>::type const& get(const tuple<T...>&);
|
||||
template <intsize_t I, class... T> typename tuple_element<I, tuple<T...>>::type&& get(tuple<T...>&&);
|
||||
template <intsize_t I, class... T>
|
||||
typename tuple_element<I, tuple<T...>>::type&
|
||||
get(tuple<T...>&) noexcept;
|
||||
template <intsize_t I, class... T>
|
||||
typename tuple_element<I, tuple<T...>>::type const&
|
||||
get(const tuple<T...>&) noexcept;
|
||||
template <intsize_t I, class... T>
|
||||
typename tuple_element<I, tuple<T...>>::type&&
|
||||
get(tuple<T...>&&) noexcept;
|
||||
|
||||
// 20.4.1.6, relational operators:
|
||||
template<class... T, class... U> bool operator==(const tuple<T...>&, const tuple<U...>&);
|
||||
@@ -102,7 +106,8 @@ template <class... Types, class Alloc>
|
||||
struct uses_allocator<tuple<Types...>, Alloc>;
|
||||
|
||||
template <class... Types>
|
||||
void swap(tuple<Types...>& x, tuple<Types...>& y);
|
||||
void
|
||||
swap(tuple<Types...>& x, tuple<Types...>& y) noexcept(noexcept(x.swap(y)));
|
||||
|
||||
} // std
|
||||
|
||||
@@ -123,7 +128,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
// tuple_size
|
||||
|
||||
template <class ..._Tp>
|
||||
class _LIBCPP_VISIBLE tuple_size<tuple<_Tp...>>
|
||||
class _LIBCPP_VISIBLE tuple_size<tuple<_Tp...> >
|
||||
: public integral_constant<size_t, sizeof...(_Tp)>
|
||||
{
|
||||
};
|
||||
@@ -131,10 +136,10 @@ class _LIBCPP_VISIBLE tuple_size<tuple<_Tp...>>
|
||||
// tuple_element
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, tuple<_Tp...>>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, tuple<_Tp...> >
|
||||
{
|
||||
public:
|
||||
typedef typename tuple_element<_Ip, __tuple_types<_Tp...>>::type type;
|
||||
typedef typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type;
|
||||
};
|
||||
|
||||
// __tuple_leaf
|
||||
@@ -145,6 +150,7 @@ class __tuple_leaf;
|
||||
template <size_t _Ip, class _Hp, bool _Ep>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_Hp>::value)
|
||||
{
|
||||
swap(__x.get(), __y.get());
|
||||
}
|
||||
@@ -185,7 +191,7 @@ public:
|
||||
class = typename enable_if<is_constructible<_Hp, _Tp>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __tuple_leaf(_Tp&& __t)
|
||||
: value(_STD::forward<_Tp>(__t))
|
||||
: value(_VSTD::forward<_Tp>(__t))
|
||||
{static_assert(!is_reference<_Hp>::value ||
|
||||
is_lvalue_reference<_Hp>::value &&
|
||||
(is_lvalue_reference<_Tp>::value ||
|
||||
@@ -201,7 +207,7 @@ public:
|
||||
template <class _Tp, class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t)
|
||||
: value(_STD::forward<_Tp>(__t))
|
||||
: value(_VSTD::forward<_Tp>(__t))
|
||||
{static_assert(!is_lvalue_reference<_Hp>::value ||
|
||||
is_lvalue_reference<_Hp>::value &&
|
||||
(is_lvalue_reference<_Tp>::value ||
|
||||
@@ -215,7 +221,7 @@ public:
|
||||
template <class _Tp, class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t)
|
||||
: value(allocator_arg_t(), __a, _STD::forward<_Tp>(__t))
|
||||
: value(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t))
|
||||
{static_assert(!is_lvalue_reference<_Hp>::value ||
|
||||
is_lvalue_reference<_Hp>::value &&
|
||||
(is_lvalue_reference<_Tp>::value ||
|
||||
@@ -229,7 +235,7 @@ public:
|
||||
template <class _Tp, class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
|
||||
: value(_STD::forward<_Tp>(__t), __a)
|
||||
: value(_VSTD::forward<_Tp>(__t), __a)
|
||||
{static_assert(!is_lvalue_reference<_Hp>::value ||
|
||||
is_lvalue_reference<_Hp>::value &&
|
||||
(is_lvalue_reference<_Tp>::value ||
|
||||
@@ -254,14 +260,14 @@ public:
|
||||
__tuple_leaf&
|
||||
operator=(_Tp&& __t)
|
||||
{
|
||||
value = _STD::forward<_Tp>(__t);
|
||||
value = _VSTD::forward<_Tp>(__t);
|
||||
return *this;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int swap(__tuple_leaf& __t)
|
||||
int swap(__tuple_leaf& __t) _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value)
|
||||
{
|
||||
_STD::swap(*this, __t);
|
||||
_VSTD::swap(*this, __t);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -296,22 +302,22 @@ public:
|
||||
class = typename enable_if<is_constructible<_Hp, _Tp>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __tuple_leaf(_Tp&& __t)
|
||||
: _Hp(_STD::forward<_Tp>(__t)) {}
|
||||
: _Hp(_VSTD::forward<_Tp>(__t)) {}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t)
|
||||
: _Hp(_STD::forward<_Tp>(__t)) {}
|
||||
: _Hp(_VSTD::forward<_Tp>(__t)) {}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t)
|
||||
: _Hp(allocator_arg_t(), __a, _STD::forward<_Tp>(__t)) {}
|
||||
: _Hp(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t)) {}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
|
||||
: _Hp(_STD::forward<_Tp>(__t), __a) {}
|
||||
: _Hp(_VSTD::forward<_Tp>(__t), __a) {}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -323,13 +329,15 @@ public:
|
||||
__tuple_leaf&
|
||||
operator=(_Tp&& __t)
|
||||
{
|
||||
_Hp::operator=(_STD::forward<_Tp>(__t));
|
||||
_Hp::operator=(_VSTD::forward<_Tp>(__t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY int swap(__tuple_leaf& __t)
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
swap(__tuple_leaf& __t) _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value)
|
||||
{
|
||||
_STD::swap(*this, __t);
|
||||
_VSTD::swap(*this, __t);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -341,6 +349,20 @@ template <class ..._Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __swallow(_Tp&&...) {}
|
||||
|
||||
template <bool ...> struct __all;
|
||||
|
||||
template <>
|
||||
struct __all<>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template <bool _B0, bool ... _B>
|
||||
struct __all<_B0, _B...>
|
||||
{
|
||||
static const bool value = _B0 && __all<_B...>::value;
|
||||
};
|
||||
|
||||
// __tuple_impl
|
||||
|
||||
template<class _Indx, class ..._Tp> struct __tuple_impl;
|
||||
@@ -356,7 +378,7 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
|
||||
__tuple_impl(__tuple_indices<_Uf...>, __tuple_types<_Tf...>,
|
||||
__tuple_indices<_Ul...>, __tuple_types<_Tl...>,
|
||||
_Up&&... __u) :
|
||||
__tuple_leaf<_Uf, _Tf>(_STD::forward<_Up>(__u))...,
|
||||
__tuple_leaf<_Uf, _Tf>(_VSTD::forward<_Up>(__u))...,
|
||||
__tuple_leaf<_Ul, _Tl>()...
|
||||
{}
|
||||
|
||||
@@ -369,52 +391,53 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
|
||||
__tuple_indices<_Ul...>, __tuple_types<_Tl...>,
|
||||
_Up&&... __u) :
|
||||
__tuple_leaf<_Uf, _Tf>(__uses_alloc_ctor<_Tf, _Alloc, _Up>(), __a,
|
||||
_STD::forward<_Up>(__u))...,
|
||||
_VSTD::forward<_Up>(__u))...,
|
||||
__tuple_leaf<_Ul, _Tl>(__uses_alloc_ctor<_Tl, _Alloc>(), __a)...
|
||||
{}
|
||||
|
||||
template <class _Tuple,
|
||||
class = typename enable_if
|
||||
<
|
||||
__tuple_convertible<_Tuple, tuple<_Tp...>>::value
|
||||
__tuple_convertible<_Tuple, tuple<_Tp...> >::value
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tuple_impl(_Tuple&& __t)
|
||||
: __tuple_leaf<_Indx, _Tp>(_STD::forward<typename tuple_element<_Indx,
|
||||
typename __make_tuple_types<_Tuple>::type>::type>(_STD::get<_Indx>(__t)))...
|
||||
: __tuple_leaf<_Indx, _Tp>(_VSTD::forward<typename tuple_element<_Indx,
|
||||
typename __make_tuple_types<_Tuple>::type>::type>(_VSTD::get<_Indx>(__t)))...
|
||||
{}
|
||||
|
||||
template <class _Alloc, class _Tuple,
|
||||
class = typename enable_if
|
||||
<
|
||||
__tuple_convertible<_Tuple, tuple<_Tp...>>::value
|
||||
__tuple_convertible<_Tuple, tuple<_Tp...> >::value
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tuple_impl(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)
|
||||
: __tuple_leaf<_Indx, _Tp>(__uses_alloc_ctor<_Tp, _Alloc, typename tuple_element<_Indx,
|
||||
typename __make_tuple_types<_Tuple>::type>::type>(), __a,
|
||||
_STD::forward<typename tuple_element<_Indx,
|
||||
typename __make_tuple_types<_Tuple>::type>::type>(_STD::get<_Indx>(__t)))...
|
||||
_VSTD::forward<typename tuple_element<_Indx,
|
||||
typename __make_tuple_types<_Tuple>::type>::type>(_VSTD::get<_Indx>(__t)))...
|
||||
{}
|
||||
|
||||
template <class _Tuple>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
__tuple_assignable<_Tuple, tuple<_Tp...>>::value,
|
||||
__tuple_assignable<_Tuple, tuple<_Tp...> >::value,
|
||||
__tuple_impl&
|
||||
>::type
|
||||
operator=(_Tuple&& __t)
|
||||
{
|
||||
__swallow(__tuple_leaf<_Indx, _Tp>::operator=(_STD::forward<typename tuple_element<_Indx,
|
||||
typename __make_tuple_types<_Tuple>::type>::type>(_STD::get<_Indx>(__t)))...);
|
||||
__swallow(__tuple_leaf<_Indx, _Tp>::operator=(_VSTD::forward<typename tuple_element<_Indx,
|
||||
typename __make_tuple_types<_Tuple>::type>::type>(_VSTD::get<_Indx>(__t)))...);
|
||||
return *this;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(__tuple_impl& __t)
|
||||
_NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value)
|
||||
{
|
||||
__swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t))...);
|
||||
}
|
||||
@@ -428,11 +451,11 @@ class _LIBCPP_VISIBLE tuple
|
||||
base base_;
|
||||
|
||||
template <size_t _Jp, class ..._Up> friend
|
||||
typename tuple_element<_Jp, tuple<_Up...>>::type& get(tuple<_Up...>&);
|
||||
typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&);
|
||||
template <size_t _Jp, class ..._Up> friend
|
||||
const typename tuple_element<_Jp, tuple<_Up...>>::type& get(const tuple<_Up...>&);
|
||||
const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&);
|
||||
template <size_t _Jp, class ..._Up> friend
|
||||
typename tuple_element<_Jp, tuple<_Up...>>::type&& get(tuple<_Up...>&&);
|
||||
typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&);
|
||||
public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -476,7 +499,7 @@ public:
|
||||
typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
|
||||
typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
|
||||
typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
|
||||
_STD::forward<_Up>(__u)...) {}
|
||||
_VSTD::forward<_Up>(__u)...) {}
|
||||
|
||||
template <class _Alloc, class ..._Up,
|
||||
class = typename enable_if
|
||||
@@ -499,7 +522,7 @@ public:
|
||||
typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
|
||||
typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
|
||||
typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
|
||||
_STD::forward<_Up>(__u)...) {}
|
||||
_VSTD::forward<_Up>(__u)...) {}
|
||||
|
||||
template <class _Tuple,
|
||||
class = typename enable_if
|
||||
@@ -509,7 +532,7 @@ public:
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple(_Tuple&& __t)
|
||||
: base_(_STD::forward<_Tuple>(__t)) {}
|
||||
: base_(_VSTD::forward<_Tuple>(__t)) {}
|
||||
|
||||
template <class _Alloc, class _Tuple,
|
||||
class = typename enable_if
|
||||
@@ -519,7 +542,7 @@ public:
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)
|
||||
: base_(allocator_arg_t(), __a, _STD::forward<_Tuple>(__t)) {}
|
||||
: base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {}
|
||||
|
||||
template <class _Tuple,
|
||||
class = typename enable_if
|
||||
@@ -531,12 +554,13 @@ public:
|
||||
tuple&
|
||||
operator=(_Tuple&& __t)
|
||||
{
|
||||
base_.operator=(_STD::forward<_Tuple>(__t));
|
||||
base_.operator=(_VSTD::forward<_Tuple>(__t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(tuple& __t) {base_.swap(__t.base_);}
|
||||
void swap(tuple& __t) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value)
|
||||
{base_.swap(__t.base_);}
|
||||
};
|
||||
|
||||
template <>
|
||||
@@ -558,41 +582,48 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple(allocator_arg_t, const _Alloc&, array<_U, 0>) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(tuple&) {}
|
||||
void swap(tuple&) _NOEXCEPT {}
|
||||
};
|
||||
|
||||
template <class ..._Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u) {__t.swap(__u);}
|
||||
typename enable_if
|
||||
<
|
||||
__all<__is_swappable<_Tp>::value...>::value,
|
||||
void
|
||||
>::type
|
||||
swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u)
|
||||
_NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value)
|
||||
{__t.swap(__u);}
|
||||
|
||||
// get
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename tuple_element<_Ip, tuple<_Tp...>>::type&
|
||||
typename tuple_element<_Ip, tuple<_Tp...> >::type&
|
||||
get(tuple<_Tp...>& __t)
|
||||
{
|
||||
typedef typename tuple_element<_Ip, tuple<_Tp...>>::type type;
|
||||
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
|
||||
return static_cast<__tuple_leaf<_Ip, type>&>(__t.base_).get();
|
||||
}
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
const typename tuple_element<_Ip, tuple<_Tp...>>::type&
|
||||
const typename tuple_element<_Ip, tuple<_Tp...> >::type&
|
||||
get(const tuple<_Tp...>& __t)
|
||||
{
|
||||
typedef typename tuple_element<_Ip, tuple<_Tp...>>::type type;
|
||||
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
|
||||
return static_cast<const __tuple_leaf<_Ip, type>&>(__t.base_).get();
|
||||
}
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename tuple_element<_Ip, tuple<_Tp...>>::type&&
|
||||
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
|
||||
get(tuple<_Tp...>&& __t)
|
||||
{
|
||||
typedef typename tuple_element<_Ip, tuple<_Tp...>>::type type;
|
||||
return static_cast<__tuple_leaf<_Ip, type>&&>(__t.base_).get();
|
||||
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
|
||||
return static_cast<type&&>(
|
||||
static_cast<__tuple_leaf<_Ip, type>&&>(__t.base_).get());
|
||||
}
|
||||
|
||||
// tie
|
||||
@@ -629,7 +660,7 @@ struct ___make_tuple_return
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct ___make_tuple_return<reference_wrapper<_Tp>>
|
||||
struct ___make_tuple_return<reference_wrapper<_Tp> >
|
||||
{
|
||||
typedef _Tp& type;
|
||||
};
|
||||
@@ -645,7 +676,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
tuple<typename __make_tuple_return<_Tp>::type...>
|
||||
make_tuple(_Tp&&... __t)
|
||||
{
|
||||
return tuple<typename __make_tuple_return<_Tp>::type...>(_STD::forward<_Tp>(__t)...);
|
||||
return tuple<typename __make_tuple_return<_Tp>::type...>(_VSTD::forward<_Tp>(__t)...);
|
||||
}
|
||||
|
||||
template <class... _Tp>
|
||||
@@ -653,7 +684,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
tuple<_Tp&&...>
|
||||
forward_as_tuple(_Tp&&... __t)
|
||||
{
|
||||
return tuple<_Tp&&...>(_STD::forward<_Tp>(__t)...);
|
||||
return tuple<_Tp&&...>(_VSTD::forward<_Tp>(__t)...);
|
||||
}
|
||||
|
||||
template <size_t _I>
|
||||
@@ -751,72 +782,140 @@ operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
|
||||
|
||||
// tuple_cat
|
||||
|
||||
template <class... _Tp, size_t ..._I1, class... _Up, size_t ..._I2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
tuple<_Tp..., _Up...>
|
||||
__tuple_cat(const tuple<_Tp...>& __x, __tuple_indices<_I1...>, const tuple<_Up...>& __y, __tuple_indices<_I2...>)
|
||||
template <class _Tp, class _Up> struct __tuple_cat_type;
|
||||
|
||||
template <class ..._Ttypes, class ..._Utypes>
|
||||
struct __tuple_cat_type<tuple<_Ttypes...>, __tuple_types<_Utypes...> >
|
||||
{
|
||||
return tuple<_Tp..., _Up...>(get<_I1>(__x)..., get<_I2>(__y)...);
|
||||
typedef tuple<_Ttypes..., _Utypes...> type;
|
||||
};
|
||||
|
||||
template <class _ResultTuple, bool _Is_Tuple0TupleLike, class ..._Tuples>
|
||||
struct __tuple_cat_return_1
|
||||
{
|
||||
};
|
||||
|
||||
template <class ..._Types, class _Tuple0>
|
||||
struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0>
|
||||
{
|
||||
typedef typename __tuple_cat_type<tuple<_Types...>,
|
||||
typename __make_tuple_types<typename remove_reference<_Tuple0>::type>::type>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <class ..._Types, class _Tuple0, class _Tuple1, class ..._Tuples>
|
||||
struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0, _Tuple1, _Tuples...>
|
||||
: public __tuple_cat_return_1<
|
||||
typename __tuple_cat_type<
|
||||
tuple<_Types...>,
|
||||
typename __make_tuple_types<typename remove_reference<_Tuple0>::type>::type
|
||||
>::type,
|
||||
__tuple_like<typename remove_reference<_Tuple1>::type>::value,
|
||||
_Tuple1, _Tuples...>
|
||||
{
|
||||
};
|
||||
|
||||
template <class ..._Tuples> struct __tuple_cat_return;
|
||||
|
||||
template <class _Tuple0, class ..._Tuples>
|
||||
struct __tuple_cat_return<_Tuple0, _Tuples...>
|
||||
: public __tuple_cat_return_1<tuple<>,
|
||||
__tuple_like<typename remove_reference<_Tuple0>::type>::value, _Tuple0,
|
||||
_Tuples...>
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct __tuple_cat_return<>
|
||||
{
|
||||
typedef tuple<> type;
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
tuple<>
|
||||
tuple_cat()
|
||||
{
|
||||
return tuple<>();
|
||||
}
|
||||
|
||||
template <class... _Tp, class... _Up>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
tuple<_Tp..., _Up...>
|
||||
tuple_cat(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
|
||||
{
|
||||
return __tuple_cat(__x, typename __make_tuple_indices<sizeof...(_Tp)>::type(),
|
||||
__y, typename __make_tuple_indices<sizeof...(_Up)>::type());
|
||||
}
|
||||
template <class _R, class _Indices, class _Tuple0, class ..._Tuples>
|
||||
struct __tuple_cat_return_ref_imp;
|
||||
|
||||
template <class... _Tp, size_t ..._I1, class... _Up, size_t ..._I2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
tuple<_Tp..., _Up...>
|
||||
__tuple_cat(tuple<_Tp...>&& __x, __tuple_indices<_I1...>, const tuple<_Up...>& __y, __tuple_indices<_I2...>)
|
||||
template <class ..._Types, size_t ..._I0, class _Tuple0>
|
||||
struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0>
|
||||
{
|
||||
return tuple<_Tp..., _Up...>(_STD::forward<_Tp>(get<_I1>(__x))..., get<_I2>(__y)...);
|
||||
}
|
||||
typedef typename remove_reference<_Tuple0>::type _T0;
|
||||
typedef tuple<_Types..., typename __apply_cv<_Tuple0,
|
||||
typename tuple_element<_I0, _T0>::type>::type&&...> type;
|
||||
};
|
||||
|
||||
template <class... _Tp, class... _Up>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
tuple<_Tp..., _Up...>
|
||||
tuple_cat(tuple<_Tp...>&& __x, const tuple<_Up...>& __y)
|
||||
template <class ..._Types, size_t ..._I0, class _Tuple0, class _Tuple1, class ..._Tuples>
|
||||
struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>,
|
||||
_Tuple0, _Tuple1, _Tuples...>
|
||||
: public __tuple_cat_return_ref_imp<
|
||||
tuple<_Types..., typename __apply_cv<_Tuple0,
|
||||
typename tuple_element<_I0,
|
||||
typename remove_reference<_Tuple0>::type>::type>::type&&...>,
|
||||
typename __make_tuple_indices<tuple_size<typename
|
||||
remove_reference<_Tuple1>::type>::value>::type,
|
||||
_Tuple1, _Tuples...>
|
||||
{
|
||||
return __tuple_cat(_STD::move(__x), typename __make_tuple_indices<sizeof...(_Tp)>::type(),
|
||||
__y, typename __make_tuple_indices<sizeof...(_Up)>::type());
|
||||
}
|
||||
};
|
||||
|
||||
template <class... _Tp, size_t ..._I1, class... _Up, size_t ..._I2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
tuple<_Tp..., _Up...>
|
||||
__tuple_cat(const tuple<_Tp...>& __x, __tuple_indices<_I1...>, tuple<_Up...>&& __y, __tuple_indices<_I2...>)
|
||||
template <class _Tuple0, class ..._Tuples>
|
||||
struct __tuple_cat_return_ref
|
||||
: public __tuple_cat_return_ref_imp<tuple<>,
|
||||
typename __make_tuple_indices<
|
||||
tuple_size<typename remove_reference<_Tuple0>::type>::value
|
||||
>::type, _Tuple0, _Tuples...>
|
||||
{
|
||||
return tuple<_Tp..., _Up...>(get<_I1>(__x)..., _STD::forward<_Up>(get<_I2>(__y))...);
|
||||
}
|
||||
};
|
||||
|
||||
template <class... _Tp, class... _Up>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
tuple<_Tp..., _Up...>
|
||||
tuple_cat(const tuple<_Tp...>& __x, tuple<_Up...>&& __y)
|
||||
{
|
||||
return __tuple_cat(__x, typename __make_tuple_indices<sizeof...(_Tp)>::type(),
|
||||
_STD::move(__y), typename __make_tuple_indices<sizeof...(_Up)>::type());
|
||||
}
|
||||
template <class _Types, class _I0, class _J0>
|
||||
struct __tuple_cat;
|
||||
|
||||
template <class... _Tp, size_t ..._I1, class... _Up, size_t ..._I2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
tuple<_Tp..., _Up...>
|
||||
__tuple_cat(tuple<_Tp...>&& __x, __tuple_indices<_I1...>, tuple<_Up...>&& __y, __tuple_indices<_I2...>)
|
||||
template <class ..._Types, size_t ..._I0, size_t ..._J0>
|
||||
struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J0...> >
|
||||
{
|
||||
return tuple<_Tp..., _Up...>(_STD::forward<_Tp>(get<_I1>(__x))..., _STD::forward<_Up>(get<_I2>(__y))...);
|
||||
}
|
||||
template <class _Tuple0>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&>::type
|
||||
operator()(tuple<_Types...> __t, _Tuple0&& __t0)
|
||||
{
|
||||
return _VSTD::forward_as_tuple(_VSTD::forward<_Types>(get<_I0>(__t))...,
|
||||
get<_J0>(_VSTD::forward<_Tuple0>(__t0))...);
|
||||
}
|
||||
|
||||
template <class... _Tp, class... _Up>
|
||||
template <class _Tuple0, class _Tuple1, class ..._Tuples>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type
|
||||
operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&& ...__tpls)
|
||||
{
|
||||
typedef typename remove_reference<_Tuple0>::type _T0;
|
||||
typedef typename remove_reference<_Tuple1>::type _T1;
|
||||
return __tuple_cat<
|
||||
tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_J0, _T0>::type>::type&&...>,
|
||||
typename __make_tuple_indices<sizeof ...(_Types) + tuple_size<_T0>::value>::type,
|
||||
typename __make_tuple_indices<tuple_size<_T1>::value>::type>()
|
||||
(_VSTD::forward_as_tuple(
|
||||
_VSTD::forward<_Types>(get<_I0>(__t))...,
|
||||
get<_J0>(_VSTD::forward<_Tuple0>(__t0))...
|
||||
),
|
||||
_VSTD::forward<_Tuple1>(__t1),
|
||||
_VSTD::forward<_Tuples>(__tpls)...);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Tuple0, class... _Tuples>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
tuple<_Tp..., _Up...>
|
||||
tuple_cat(tuple<_Tp...>&& __x, tuple<_Up...>&& __y)
|
||||
typename __tuple_cat_return<_Tuple0, _Tuples...>::type
|
||||
tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls)
|
||||
{
|
||||
return __tuple_cat(_STD::move(__x), typename __make_tuple_indices<sizeof...(_Tp)>::type(),
|
||||
_STD::move(__y), typename __make_tuple_indices<sizeof...(_Up)>::type());
|
||||
typedef typename remove_reference<_Tuple0>::type _T0;
|
||||
return __tuple_cat<tuple<>, __tuple_indices<>,
|
||||
typename __make_tuple_indices<tuple_size<_T0>::value>::type>()
|
||||
(tuple<>(), _VSTD::forward<_Tuple0>(__t0),
|
||||
_VSTD::forward<_Tuples>(__tpls)...);
|
||||
}
|
||||
|
||||
template <class ..._Tp, class _Alloc>
|
||||
@@ -829,8 +928,8 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
pair<_T1, _T2>::pair(piecewise_construct_t,
|
||||
tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args,
|
||||
__tuple_indices<_I1...>, __tuple_indices<_I2...>)
|
||||
: first(_STD::forward<_Args1>(get<_I1>( __first_args))...),
|
||||
second(_STD::forward<_Args2>(get<_I2>(__second_args))...)
|
||||
: first(_VSTD::forward<_Args1>(get<_I1>( __first_args))...),
|
||||
second(_VSTD::forward<_Args2>(get<_I2>(__second_args))...)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
1052
include/type_traits
1052
include/type_traits
File diff suppressed because it is too large
Load Diff
@@ -21,24 +21,24 @@ namespace std
|
||||
class type_index
|
||||
{
|
||||
public:
|
||||
type_index(const type_info& rhs);
|
||||
type_index(const type_info& rhs) noexcept;
|
||||
|
||||
bool operator==(const type_index& rhs) const;
|
||||
bool operator!=(const type_index& rhs) const;
|
||||
bool operator< (const type_index& rhs) const;
|
||||
bool operator<=(const type_index& rhs) const;
|
||||
bool operator> (const type_index& rhs) const;
|
||||
bool operator>=(const type_index& rhs) const;
|
||||
bool operator==(const type_index& rhs) const noexcept;
|
||||
bool operator!=(const type_index& rhs) const noexcept;
|
||||
bool operator< (const type_index& rhs) const noexcept;
|
||||
bool operator<=(const type_index& rhs) const noexcept;
|
||||
bool operator> (const type_index& rhs) const noexcept;
|
||||
bool operator>=(const type_index& rhs) const noexcept;
|
||||
|
||||
size_t hash_code() const;
|
||||
const char* name() const;
|
||||
size_t hash_code() const noexcept;
|
||||
const char* name() const noexcept;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct hash<type_index>
|
||||
: public unary_function<type_index, size_t>
|
||||
{
|
||||
size_t operator()(type_index index) const;
|
||||
size_t operator()(type_index index) const noexcept;
|
||||
};
|
||||
|
||||
} // std
|
||||
@@ -58,25 +58,31 @@ class _LIBCPP_VISIBLE type_index
|
||||
const type_info* __t_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
type_index(const type_info& __y) : __t_(&__y) {}
|
||||
type_index(const type_info& __y) _NOEXCEPT : __t_(&__y) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(const type_index& __y) const {return *__t_ == *__y.__t_;}
|
||||
bool operator==(const type_index& __y) const _NOEXCEPT
|
||||
{return *__t_ == *__y.__t_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(const type_index& __y) const {return *__t_ != *__y.__t_;}
|
||||
bool operator!=(const type_index& __y) const _NOEXCEPT
|
||||
{return *__t_ != *__y.__t_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator< (const type_index& __y) const {return __t_->before(*__y.__t_);}
|
||||
bool operator< (const type_index& __y) const _NOEXCEPT
|
||||
{return __t_->before(*__y.__t_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator<=(const type_index& __y) const {return !__y.__t_->before(*__t_);}
|
||||
bool operator<=(const type_index& __y) const _NOEXCEPT
|
||||
{return !__y.__t_->before(*__t_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator> (const type_index& __y) const {return __y.__t_->before(*__t_);}
|
||||
bool operator> (const type_index& __y) const _NOEXCEPT
|
||||
{return __y.__t_->before(*__t_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator>=(const type_index& __y) const {return !__t_->before(*__y.__t_);}
|
||||
bool operator>=(const type_index& __y) const _NOEXCEPT
|
||||
{return !__t_->before(*__y.__t_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t hash_code() const {return __t_->hash_code();}
|
||||
size_t hash_code() const _NOEXCEPT {return __t_->hash_code();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const char* name() const {return __t_->name();}
|
||||
const char* name() const _NOEXCEPT {return __t_->name();}
|
||||
};
|
||||
|
||||
template <class _Tp> struct _LIBCPP_VISIBLE hash;
|
||||
@@ -86,7 +92,8 @@ struct _LIBCPP_VISIBLE hash<type_index>
|
||||
: public unary_function<type_index, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(type_index __index) const {return __index.hash_code();}
|
||||
size_t operator()(type_index __index) const _NOEXCEPT
|
||||
{return __index.hash_code();}
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
@@ -22,12 +22,12 @@ class type_info
|
||||
public:
|
||||
virtual ~type_info();
|
||||
|
||||
bool operator==(const type_info& rhs) const;
|
||||
bool operator!=(const type_info& rhs) const;
|
||||
bool operator==(const type_info& rhs) const noexcept;
|
||||
bool operator!=(const type_info& rhs) const noexcept;
|
||||
|
||||
bool before(const type_info& rhs) const;
|
||||
size_t hash_code() const throw();
|
||||
const char* name() const;
|
||||
bool before(const type_info& rhs) const noexcept;
|
||||
size_t hash_code() const noexcept;
|
||||
const char* name() const noexcept;
|
||||
|
||||
type_info(const type_info& rhs) = delete;
|
||||
type_info& operator=(const type_info& rhs) = delete;
|
||||
@@ -37,20 +37,20 @@ class bad_cast
|
||||
: public exception
|
||||
{
|
||||
public:
|
||||
bad_cast() throw();
|
||||
bad_cast(const bad_cast&) throw();
|
||||
bad_cast& operator=(const bad_cast&) throw();
|
||||
virtual const char* what() const throw();
|
||||
bad_cast() noexcept;
|
||||
bad_cast(const bad_cast&) noexcept;
|
||||
bad_cast& operator=(const bad_cast&) noexcept;
|
||||
virtual const char* what() const noexcept;
|
||||
};
|
||||
|
||||
class bad_typeid
|
||||
: public exception
|
||||
{
|
||||
public:
|
||||
bad_typeid() throw();
|
||||
bad_typeid(const bad_typeid&) throw();
|
||||
bad_typeid& operator=(const bad_typeid&) throw();
|
||||
virtual const char* what() const throw();
|
||||
bad_typeid() noexcept;
|
||||
bad_typeid(const bad_typeid&) noexcept;
|
||||
bad_typeid& operator=(const bad_typeid&) noexcept;
|
||||
virtual const char* what() const noexcept;
|
||||
};
|
||||
|
||||
} // std
|
||||
@@ -81,20 +81,20 @@ public:
|
||||
virtual ~type_info();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const char* name() const {return __type_name;}
|
||||
const char* name() const _NOEXCEPT {return __type_name;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool before(const type_info& __arg) const
|
||||
bool before(const type_info& __arg) const _NOEXCEPT
|
||||
{return __type_name < __arg.__type_name;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t hash_code() const throw()
|
||||
size_t hash_code() const _NOEXCEPT
|
||||
{return *reinterpret_cast<const size_t*>(&__type_name);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(const type_info& __arg) const
|
||||
bool operator==(const type_info& __arg) const _NOEXCEPT
|
||||
{return __type_name == __arg.__type_name;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(const type_info& __arg) const
|
||||
bool operator!=(const type_info& __arg) const _NOEXCEPT
|
||||
{return !operator==(__arg);}
|
||||
|
||||
};
|
||||
@@ -103,18 +103,18 @@ class _LIBCPP_EXCEPTION_ABI bad_cast
|
||||
: public exception
|
||||
{
|
||||
public:
|
||||
bad_cast() throw();
|
||||
virtual ~bad_cast() throw();
|
||||
virtual const char* what() const throw();
|
||||
bad_cast() _NOEXCEPT;
|
||||
virtual ~bad_cast() _NOEXCEPT;
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI bad_typeid
|
||||
: public exception
|
||||
{
|
||||
public:
|
||||
bad_typeid() throw();
|
||||
virtual ~bad_typeid() throw();
|
||||
virtual const char* what() const throw();
|
||||
bad_typeid() _NOEXCEPT;
|
||||
virtual ~bad_typeid() _NOEXCEPT;
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
} // std
|
||||
|
||||
@@ -44,7 +44,12 @@ public:
|
||||
typedef /unspecified/ local_iterator;
|
||||
typedef /unspecified/ const_local_iterator;
|
||||
|
||||
explicit unordered_map(size_type n = 0, const hasher& hf = hasher(),
|
||||
unordered_map()
|
||||
noexcept(
|
||||
is_nothrow_default_constructible<hasher>::value &&
|
||||
is_nothrow_default_constructible<key_equal>::value &&
|
||||
is_nothrow_default_constructible<allocator_type>::value);
|
||||
explicit unordered_map(size_type n, const hasher& hf = hasher(),
|
||||
const key_equal& eql = key_equal(),
|
||||
const allocator_type& a = allocator_type());
|
||||
template <class InputIterator>
|
||||
@@ -55,28 +60,37 @@ public:
|
||||
explicit unordered_map(const allocator_type&);
|
||||
unordered_map(const unordered_map&);
|
||||
unordered_map(const unordered_map&, const Allocator&);
|
||||
unordered_map(unordered_map&&);
|
||||
unordered_map(unordered_map&&)
|
||||
noexcept(
|
||||
is_nothrow_move_constructible<hasher>::value &&
|
||||
is_nothrow_move_constructible<key_equal>::value &&
|
||||
is_nothrow_move_constructible<allocator_type>::value);
|
||||
unordered_map(unordered_map&&, const Allocator&);
|
||||
unordered_map(initializer_list<value_type>, size_type n = 0,
|
||||
const hasher& hf = hasher(), const key_equal& eql = key_equal(),
|
||||
const allocator_type& a = allocator_type());
|
||||
~unordered_map();
|
||||
unordered_map& operator=(const unordered_map&);
|
||||
unordered_map& operator=(unordered_map&&);
|
||||
unordered_map& operator=(unordered_map&&)
|
||||
noexcept(
|
||||
allocator_type::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value &&
|
||||
is_nothrow_move_assignable<hasher>::value &&
|
||||
is_nothrow_move_assignable<key_equal>::value);
|
||||
unordered_map& operator=(initializer_list<value_type>);
|
||||
|
||||
allocator_type get_allocator() const;
|
||||
allocator_type get_allocator() const noexcept;
|
||||
|
||||
bool empty() const;
|
||||
size_type size() const;
|
||||
size_type max_size() const;
|
||||
bool empty() const noexcept;
|
||||
size_type size() const noexcept;
|
||||
size_type max_size() const noexcept;
|
||||
|
||||
iterator begin();
|
||||
iterator end();
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
const_iterator cbegin() const;
|
||||
const_iterator cend() const;
|
||||
iterator begin() noexcept;
|
||||
iterator end() noexcept;
|
||||
const_iterator begin() const noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
const_iterator cbegin() const noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
|
||||
template <class... Args>
|
||||
pair<iterator, bool> emplace(Args&&... args);
|
||||
@@ -95,9 +109,14 @@ public:
|
||||
iterator erase(const_iterator position);
|
||||
size_type erase(const key_type& k);
|
||||
iterator erase(const_iterator first, const_iterator last);
|
||||
void clear();
|
||||
void clear() noexcept;
|
||||
|
||||
void swap(unordered_map&);
|
||||
void swap(unordered_map&)
|
||||
noexcept(
|
||||
(!allocator_type::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value) &&
|
||||
__is_nothrow_swappable<hasher>::value &&
|
||||
__is_nothrow_swappable<key_equal>::value);
|
||||
|
||||
hasher hash_function() const;
|
||||
key_equal key_eq() const;
|
||||
@@ -114,8 +133,8 @@ public:
|
||||
mapped_type& at(const key_type& k);
|
||||
const mapped_type& at(const key_type& k) const;
|
||||
|
||||
size_type bucket_count() const;
|
||||
size_type max_bucket_count() const;
|
||||
size_type bucket_count() const noexcept;
|
||||
size_type max_bucket_count() const noexcept;
|
||||
|
||||
size_type bucket_size(size_type n) const;
|
||||
size_type bucket(const key_type& k) const;
|
||||
@@ -127,8 +146,8 @@ public:
|
||||
const_local_iterator cbegin(size_type n) const;
|
||||
const_local_iterator cend(size_type n) const;
|
||||
|
||||
float load_factor() const;
|
||||
float max_load_factor() const;
|
||||
float load_factor() const noexcept;
|
||||
float max_load_factor() const noexcept;
|
||||
void max_load_factor(float z);
|
||||
void rehash(size_type n);
|
||||
void reserve(size_type n);
|
||||
@@ -136,7 +155,8 @@ public:
|
||||
|
||||
template <class Key, class T, class Hash, class Pred, class Alloc>
|
||||
void swap(unordered_map<Key, T, Hash, Pred, Alloc>& x,
|
||||
unordered_map<Key, T, Hash, Pred, Alloc>& y);
|
||||
unordered_map<Key, T, Hash, Pred, Alloc>& y)
|
||||
noexcept(noexcept(x.swap(y)));
|
||||
|
||||
template <class Key, class T, class Hash, class Pred, class Alloc>
|
||||
bool
|
||||
@@ -172,7 +192,12 @@ public:
|
||||
typedef /unspecified/ local_iterator;
|
||||
typedef /unspecified/ const_local_iterator;
|
||||
|
||||
explicit unordered_multimap(size_type n = 0, const hasher& hf = hasher(),
|
||||
unordered_multimap()
|
||||
noexcept(
|
||||
is_nothrow_default_constructible<hasher>::value &&
|
||||
is_nothrow_default_constructible<key_equal>::value &&
|
||||
is_nothrow_default_constructible<allocator_type>::value);
|
||||
explicit unordered_multimap(size_type n, const hasher& hf = hasher(),
|
||||
const key_equal& eql = key_equal(),
|
||||
const allocator_type& a = allocator_type());
|
||||
template <class InputIterator>
|
||||
@@ -183,28 +208,37 @@ public:
|
||||
explicit unordered_multimap(const allocator_type&);
|
||||
unordered_multimap(const unordered_multimap&);
|
||||
unordered_multimap(const unordered_multimap&, const Allocator&);
|
||||
unordered_multimap(unordered_multimap&&);
|
||||
unordered_multimap(unordered_multimap&&)
|
||||
noexcept(
|
||||
is_nothrow_move_constructible<hasher>::value &&
|
||||
is_nothrow_move_constructible<key_equal>::value &&
|
||||
is_nothrow_move_constructible<allocator_type>::value);
|
||||
unordered_multimap(unordered_multimap&&, const Allocator&);
|
||||
unordered_multimap(initializer_list<value_type>, size_type n = 0,
|
||||
const hasher& hf = hasher(), const key_equal& eql = key_equal(),
|
||||
const allocator_type& a = allocator_type());
|
||||
~unordered_multimap();
|
||||
unordered_multimap& operator=(const unordered_multimap&);
|
||||
unordered_multimap& operator=(unordered_multimap&&);
|
||||
unordered_multimap& operator=(unordered_multimap&&)
|
||||
noexcept(
|
||||
allocator_type::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value &&
|
||||
is_nothrow_move_assignable<hasher>::value &&
|
||||
is_nothrow_move_assignable<key_equal>::value);
|
||||
unordered_multimap& operator=(initializer_list<value_type>);
|
||||
|
||||
allocator_type get_allocator() const;
|
||||
allocator_type get_allocator() const noexcept;
|
||||
|
||||
bool empty() const;
|
||||
size_type size() const;
|
||||
size_type max_size() const;
|
||||
bool empty() const noexcept;
|
||||
size_type size() const noexcept;
|
||||
size_type max_size() const noexcept;
|
||||
|
||||
iterator begin();
|
||||
iterator end();
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
const_iterator cbegin() const;
|
||||
const_iterator cend() const;
|
||||
iterator begin() noexcept;
|
||||
iterator end() noexcept;
|
||||
const_iterator begin() const noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
const_iterator cbegin() const noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
|
||||
template <class... Args>
|
||||
iterator emplace(Args&&... args);
|
||||
@@ -223,9 +257,14 @@ public:
|
||||
iterator erase(const_iterator position);
|
||||
size_type erase(const key_type& k);
|
||||
iterator erase(const_iterator first, const_iterator last);
|
||||
void clear();
|
||||
void clear() noexcept;
|
||||
|
||||
void swap(unordered_multimap&);
|
||||
void swap(unordered_multimap&)
|
||||
noexcept(
|
||||
(!allocator_type::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value) &&
|
||||
__is_nothrow_swappable<hasher>::value &&
|
||||
__is_nothrow_swappable<key_equal>::value);
|
||||
|
||||
hasher hash_function() const;
|
||||
key_equal key_eq() const;
|
||||
@@ -236,8 +275,8 @@ public:
|
||||
pair<iterator, iterator> equal_range(const key_type& k);
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
|
||||
|
||||
size_type bucket_count() const;
|
||||
size_type max_bucket_count() const;
|
||||
size_type bucket_count() const noexcept;
|
||||
size_type max_bucket_count() const noexcept;
|
||||
|
||||
size_type bucket_size(size_type n) const;
|
||||
size_type bucket(const key_type& k) const;
|
||||
@@ -249,8 +288,8 @@ public:
|
||||
const_local_iterator cbegin(size_type n) const;
|
||||
const_local_iterator cend(size_type n) const;
|
||||
|
||||
float load_factor() const;
|
||||
float max_load_factor() const;
|
||||
float load_factor() const noexcept;
|
||||
float max_load_factor() const noexcept;
|
||||
void max_load_factor(float z);
|
||||
void rehash(size_type n);
|
||||
void reserve(size_type n);
|
||||
@@ -258,7 +297,8 @@ public:
|
||||
|
||||
template <class Key, class T, class Hash, class Pred, class Alloc>
|
||||
void swap(unordered_multimap<Key, T, Hash, Pred, Alloc>& x,
|
||||
unordered_multimap<Key, T, Hash, Pred, Alloc>& y);
|
||||
unordered_multimap<Key, T, Hash, Pred, Alloc>& y)
|
||||
noexcept(noexcept(x.swap(y)));
|
||||
|
||||
template <class Key, class T, class Hash, class Pred, class Alloc>
|
||||
bool
|
||||
@@ -289,11 +329,15 @@ class __unordered_map_hasher
|
||||
{
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__unordered_map_hasher() : _Hash() {}
|
||||
__unordered_map_hasher()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<_Hash>::value)
|
||||
: _Hash() {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__unordered_map_hasher(const _Hash& __h) : _Hash(__h) {}
|
||||
__unordered_map_hasher(const _Hash& __h)
|
||||
_NOEXCEPT_(is_nothrow_copy_constructible<_Hash>::value)
|
||||
: _Hash(__h) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const _Hash& hash_function() const {return *this;}
|
||||
const _Hash& hash_function() const _NOEXCEPT {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const _Tp& __x) const
|
||||
{return static_cast<const _Hash&>(*this)(__x.first);}
|
||||
@@ -308,11 +352,15 @@ class __unordered_map_hasher<_Tp, _Hash, false>
|
||||
_Hash __hash_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__unordered_map_hasher() : __hash_() {}
|
||||
__unordered_map_hasher()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<_Hash>::value)
|
||||
: __hash_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__unordered_map_hasher(const _Hash& __h) : __hash_(__h) {}
|
||||
__unordered_map_hasher(const _Hash& __h)
|
||||
_NOEXCEPT_(is_nothrow_copy_constructible<_Hash>::value)
|
||||
: __hash_(__h) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const _Hash& hash_function() const {return __hash_;}
|
||||
const _Hash& hash_function() const _NOEXCEPT {return __hash_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const _Tp& __x) const
|
||||
{return __hash_(__x.first);}
|
||||
@@ -327,11 +375,15 @@ class __unordered_map_equal
|
||||
{
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__unordered_map_equal() : _Pred() {}
|
||||
__unordered_map_equal()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<_Pred>::value)
|
||||
: _Pred() {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__unordered_map_equal(const _Pred& __p) : _Pred(__p) {}
|
||||
__unordered_map_equal(const _Pred& __p)
|
||||
_NOEXCEPT_(is_nothrow_copy_constructible<_Pred>::value)
|
||||
: _Pred(__p) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const _Pred& key_eq() const {return *this;}
|
||||
const _Pred& key_eq() const _NOEXCEPT {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Tp& __x, const _Tp& __y) const
|
||||
{return static_cast<const _Pred&>(*this)(__x.first, __y.first);}
|
||||
@@ -353,11 +405,15 @@ class __unordered_map_equal<_Tp, _Pred, false>
|
||||
_Pred __pred_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__unordered_map_equal() : __pred_() {}
|
||||
__unordered_map_equal()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<_Pred>::value)
|
||||
: __pred_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__unordered_map_equal(const _Pred& __p) : __pred_(__p) {}
|
||||
__unordered_map_equal(const _Pred& __p)
|
||||
_NOEXCEPT_(is_nothrow_copy_constructible<_Pred>::value)
|
||||
: __pred_(__p) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const _Pred& key_eq() const {return __pred_;}
|
||||
const _Pred& key_eq() const _NOEXCEPT {return __pred_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Tp& __x, const _Tp& __y) const
|
||||
{return __pred_(__x.first, __y.first);}
|
||||
@@ -394,7 +450,7 @@ public:
|
||||
bool __second_constructed;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __hash_map_node_destructor(allocator_type& __na)
|
||||
explicit __hash_map_node_destructor(allocator_type& __na) _NOEXCEPT
|
||||
: __na_(__na),
|
||||
__first_constructed(false),
|
||||
__second_constructed(false)
|
||||
@@ -403,6 +459,7 @@ public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x)
|
||||
_NOEXCEPT
|
||||
: __na_(__x.__na_),
|
||||
__first_constructed(__x.__value_constructed),
|
||||
__second_constructed(__x.__value_constructed)
|
||||
@@ -421,12 +478,12 @@ public:
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void operator()(pointer __p)
|
||||
void operator()(pointer __p) _NOEXCEPT
|
||||
{
|
||||
if (__second_constructed)
|
||||
__alloc_traits::destroy(__na_, addressof(__p->__value_.second));
|
||||
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.second));
|
||||
if (__first_constructed)
|
||||
__alloc_traits::destroy(__na_, addressof(__p->__value_.first));
|
||||
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.first));
|
||||
if (__p)
|
||||
__alloc_traits::deallocate(__na_, __p, 1);
|
||||
}
|
||||
@@ -454,10 +511,10 @@ public:
|
||||
pointer;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_iterator() {}
|
||||
__hash_map_iterator() _NOEXCEPT {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_iterator(_HashIterator __i) : __i_(__i) {}
|
||||
__hash_map_iterator(_HashIterator __i) _NOEXCEPT : __i_(__i) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {return *operator->();}
|
||||
@@ -503,20 +560,21 @@ public:
|
||||
typedef const value_type& reference;
|
||||
typedef typename __pointer_traits::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind<value_type>
|
||||
rebind<const value_type>
|
||||
#else
|
||||
rebind<value_type>::other
|
||||
rebind<const value_type>::other
|
||||
#endif
|
||||
pointer;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_const_iterator() {}
|
||||
__hash_map_const_iterator() _NOEXCEPT {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_const_iterator(_HashIterator __i) : __i_(__i) {}
|
||||
__hash_map_const_iterator(_HashIterator __i) _NOEXCEPT : __i_(__i) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_const_iterator(
|
||||
__hash_map_iterator<typename _HashIterator::__non_const_iterator> __i)
|
||||
_NOEXCEPT
|
||||
: __i_(__i.__i_) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -599,7 +657,9 @@ public:
|
||||
typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unordered_map() {} // = default;
|
||||
unordered_map()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
|
||||
{} // = default;
|
||||
explicit unordered_map(size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
unordered_map(size_type __n, const hasher& __hf,
|
||||
@@ -620,7 +680,8 @@ public:
|
||||
unordered_map(const unordered_map& __u);
|
||||
unordered_map(const unordered_map& __u, const allocator_type& __a);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
unordered_map(unordered_map&& __u);
|
||||
unordered_map(unordered_map&& __u)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
|
||||
unordered_map(unordered_map&& __u, const allocator_type& __a);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
unordered_map(initializer_list<value_type> __il);
|
||||
@@ -630,35 +691,41 @@ public:
|
||||
const hasher& __hf, const key_equal& __eql,
|
||||
const allocator_type& __a);
|
||||
// ~unordered_map() = default;
|
||||
// unordered_map& operator=(const unordered_map& __u) = default;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unordered_map& operator=(const unordered_map& __u)
|
||||
{
|
||||
__table_ = __u.__table_;
|
||||
return *this;
|
||||
}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
unordered_map& operator=(unordered_map&& __u);
|
||||
unordered_map& operator=(unordered_map&& __u)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
|
||||
#endif
|
||||
unordered_map& operator=(initializer_list<value_type> __il);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const
|
||||
allocator_type get_allocator() const _NOEXCEPT
|
||||
{return allocator_type(__table_.__node_alloc());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return __table_.size() == 0;}
|
||||
bool empty() const _NOEXCEPT {return __table_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return __table_.size();}
|
||||
size_type size() const _NOEXCEPT {return __table_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const {return __table_.max_size();}
|
||||
size_type max_size() const _NOEXCEPT {return __table_.max_size();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return __table_.begin();}
|
||||
iterator begin() _NOEXCEPT {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return __table_.end();}
|
||||
iterator end() _NOEXCEPT {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return __table_.begin();}
|
||||
const_iterator begin() const _NOEXCEPT {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return __table_.end();}
|
||||
const_iterator end() const _NOEXCEPT {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cbegin() const {return __table_.begin();}
|
||||
const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cend() const {return __table_.end();}
|
||||
const_iterator cend() const _NOEXCEPT {return __table_.end();}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -666,15 +733,15 @@ public:
|
||||
{return __table_.__emplace_unique();}
|
||||
|
||||
template <class _A0,
|
||||
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> emplace(_A0&& __a0)
|
||||
{return __table_.__emplace_unique(_STD::forward<_A0>(__a0));}
|
||||
{return __table_.__emplace_unique(_VSTD::forward<_A0>(__a0));}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _A0, class... _Args,
|
||||
class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
|
||||
pair<iterator, bool> emplace(_A0&& __a0, _Args&&... __args);
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
@@ -684,19 +751,19 @@ public:
|
||||
{return __table_.__emplace_unique().first;}
|
||||
|
||||
template <class _A0,
|
||||
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator emplace_hint(const_iterator, _A0&& __a0)
|
||||
{return __table_.__emplace_unique(_STD::forward<_A0>(__a0)).first;}
|
||||
{return __table_.__emplace_unique(_VSTD::forward<_A0>(__a0)).first;}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _A0, class... _Args,
|
||||
class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator emplace_hint(const_iterator, _A0&& __a0, _Args&&... __args)
|
||||
{return emplace(_STD::forward<_A0>(__a0),
|
||||
_STD::forward<_Args>(__args)...).first;}
|
||||
{return emplace(_VSTD::forward<_A0>(__a0),
|
||||
_VSTD::forward<_Args>(__args)...).first;}
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -704,20 +771,20 @@ public:
|
||||
{return __table_.__insert_unique(__x);}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _P,
|
||||
class = typename enable_if<is_convertible<_P, value_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<value_type, _P>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> insert(_P&& __x)
|
||||
{return __table_.__insert_unique(_STD::forward<_P>(__x));}
|
||||
{return __table_.__insert_unique(_VSTD::forward<_P>(__x));}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator, const value_type& __x)
|
||||
{return insert(__x).first;}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _P,
|
||||
class = typename enable_if<is_convertible<_P, value_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<value_type, _P>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator, _P&& __x)
|
||||
{return insert(_STD::forward<_P>(__x)).first;}
|
||||
{return insert(_VSTD::forward<_P>(__x)).first;}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _InputIterator>
|
||||
void insert(_InputIterator __first, _InputIterator __last);
|
||||
@@ -733,10 +800,12 @@ public:
|
||||
iterator erase(const_iterator __first, const_iterator __last)
|
||||
{return __table_.erase(__first.__i_, __last.__i_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() {__table_.clear();}
|
||||
void clear() _NOEXCEPT {__table_.clear();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(unordered_map& __u) {__table_.swap(__u.__table_);}
|
||||
void swap(unordered_map& __u)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<__table>::value)
|
||||
{__table_.swap(__u.__table_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hasher hash_function() const
|
||||
@@ -767,9 +836,9 @@ public:
|
||||
const mapped_type& at(const key_type& __k) const;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_count() const {return __table_.bucket_count();}
|
||||
size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_bucket_count() const {return __table_.max_bucket_count();}
|
||||
size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_size(size_type __n) const
|
||||
@@ -791,9 +860,9 @@ public:
|
||||
const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
float load_factor() const {return __table_.load_factor();}
|
||||
float load_factor() const _NOEXCEPT {return __table_.load_factor();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
float max_load_factor() const {return __table_.max_load_factor();}
|
||||
float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -805,11 +874,11 @@ private:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class _A0, class... _Args,
|
||||
class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
|
||||
__node_holder __construct_node(_A0&& __a0, _Args&&... __args);
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class _A0,
|
||||
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
|
||||
__node_holder __construct_node(_A0&& __a0);
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__node_holder __construct_node(const key_type& __k);
|
||||
@@ -895,21 +964,22 @@ template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
unordered_map&& __u)
|
||||
: __table_(_STD::move(__u.__table_))
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
|
||||
: __table_(_VSTD::move(__u.__table_))
|
||||
{
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
unordered_map&& __u, const allocator_type& __a)
|
||||
: __table_(_STD::move(__u.__table_), __a)
|
||||
: __table_(_VSTD::move(__u.__table_), __a)
|
||||
{
|
||||
if (__a != __u.get_allocator())
|
||||
{
|
||||
iterator __i = __u.begin();
|
||||
while (__u.size() != 0)
|
||||
__table_.__insert_unique(
|
||||
_STD::move(__u.__table_.remove((__i++).__i_)->__value_)
|
||||
_VSTD::move(__u.__table_.remove((__i++).__i_)->__value_)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -949,8 +1019,9 @@ template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&
|
||||
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_map&& __u)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<__table>::value)
|
||||
{
|
||||
__table_ = _STD::move(__u.__table_);
|
||||
__table_ = _VSTD::move(__u.__table_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -971,7 +1042,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _A0, class... _Args,
|
||||
class // = typename enable_if<is_convertible<_A0, key_type>::value>::type
|
||||
class // = typename enable_if<is_constructible<key_type, _A0>::value>::type
|
||||
>
|
||||
typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
|
||||
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0,
|
||||
@@ -979,11 +1050,11 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0,
|
||||
{
|
||||
__node_allocator& __na = __table_.__node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_traits::construct(__na, addressof(__h->__value_.first),
|
||||
_STD::forward<_A0>(__a0));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first),
|
||||
_VSTD::forward<_A0>(__a0));
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__node_traits::construct(__na, addressof(__h->__value_.second),
|
||||
_STD::forward<_Args>(__args)...);
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return __h;
|
||||
}
|
||||
@@ -992,15 +1063,15 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0,
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _A0,
|
||||
class // = typename enable_if<is_convertible<_A0, value_type>::value>::type
|
||||
class // = typename enable_if<is_constructible<value_type, _A0>::value>::type
|
||||
>
|
||||
typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
|
||||
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0)
|
||||
{
|
||||
__node_allocator& __na = __table_.__node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_traits::construct(__na, addressof(__h->__value_),
|
||||
_STD::forward<_A0>(__a0));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_),
|
||||
_VSTD::forward<_A0>(__a0));
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return __h;
|
||||
@@ -1010,13 +1081,13 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0)
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _A0, class... _Args,
|
||||
class // = typename enable_if<is_convertible<_A0, key_type>::value>::type
|
||||
class // = typename enable_if<is_constructible<key_type, _A0>::value>::type
|
||||
>
|
||||
pair<typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::iterator, bool>
|
||||
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace(_A0&& __a0, _Args&&... __args)
|
||||
{
|
||||
__node_holder __h = __construct_node(_STD::forward<_A0>(__a0),
|
||||
_STD::forward<_Args>(__args)...);
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());
|
||||
if (__r.second)
|
||||
__h.release();
|
||||
@@ -1032,11 +1103,11 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type&
|
||||
{
|
||||
__node_allocator& __na = __table_.__node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_traits::construct(__na, addressof(__h->__value_.first), __k);
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k);
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__node_traits::construct(__na, addressof(__h->__value_.second));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return _STD::move(__h);
|
||||
return _VSTD::move(__h);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -1074,7 +1145,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](key_type&& __k)
|
||||
iterator __i = find(__k);
|
||||
if (__i != end())
|
||||
return __i->second;
|
||||
__node_holder __h = __construct_node(_STD::move(__k));
|
||||
__node_holder __h = __construct_node(_VSTD::move(__k));
|
||||
pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());
|
||||
__h.release();
|
||||
return __r.first->second;
|
||||
@@ -1111,6 +1182,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
@@ -1193,7 +1265,9 @@ public:
|
||||
typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unordered_multimap() {} // = default
|
||||
unordered_multimap()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
|
||||
{} // = default;
|
||||
explicit unordered_multimap(size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
unordered_multimap(size_type __n, const hasher& __hf,
|
||||
@@ -1214,7 +1288,8 @@ public:
|
||||
unordered_multimap(const unordered_multimap& __u);
|
||||
unordered_multimap(const unordered_multimap& __u, const allocator_type& __a);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
unordered_multimap(unordered_multimap&& __u);
|
||||
unordered_multimap(unordered_multimap&& __u)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
|
||||
unordered_multimap(unordered_multimap&& __u, const allocator_type& __a);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
unordered_multimap(initializer_list<value_type> __il);
|
||||
@@ -1225,35 +1300,41 @@ public:
|
||||
const hasher& __hf, const key_equal& __eql,
|
||||
const allocator_type& __a);
|
||||
// ~unordered_multimap() = default;
|
||||
// unordered_multimap& operator=(const unordered_multimap& __u) = default;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unordered_multimap& operator=(const unordered_multimap& __u)
|
||||
{
|
||||
__table_ = __u.__table_;
|
||||
return *this;
|
||||
}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
unordered_multimap& operator=(unordered_multimap&& __u);
|
||||
unordered_multimap& operator=(unordered_multimap&& __u)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
|
||||
#endif
|
||||
unordered_multimap& operator=(initializer_list<value_type> __il);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const
|
||||
allocator_type get_allocator() const _NOEXCEPT
|
||||
{return allocator_type(__table_.__node_alloc());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return __table_.size() == 0;}
|
||||
bool empty() const _NOEXCEPT {return __table_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return __table_.size();}
|
||||
size_type size() const _NOEXCEPT {return __table_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const {return __table_.max_size();}
|
||||
size_type max_size() const _NOEXCEPT {return __table_.max_size();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return __table_.begin();}
|
||||
iterator begin() _NOEXCEPT {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return __table_.end();}
|
||||
iterator end() _NOEXCEPT {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return __table_.begin();}
|
||||
const_iterator begin() const _NOEXCEPT {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return __table_.end();}
|
||||
const_iterator end() const _NOEXCEPT {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cbegin() const {return __table_.begin();}
|
||||
const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cend() const {return __table_.end();}
|
||||
const_iterator cend() const _NOEXCEPT {return __table_.end();}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1261,15 +1342,15 @@ public:
|
||||
{return __table_.__emplace_multi();}
|
||||
|
||||
template <class _A0,
|
||||
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator emplace(_A0&& __a0)
|
||||
{return __table_.__emplace_multi(_STD::forward<_A0>(__a0));}
|
||||
{return __table_.__emplace_multi(_VSTD::forward<_A0>(__a0));}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _A0, class... _Args,
|
||||
class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
|
||||
iterator emplace(_A0&& __a0, _Args&&... __args);
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
@@ -1279,15 +1360,15 @@ public:
|
||||
{return __table_.__emplace_hint_multi(__p.__i_);}
|
||||
|
||||
template <class _A0,
|
||||
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator emplace_hint(const_iterator __p, _A0&& __a0)
|
||||
{return __table_.__emplace_hint_multi(__p.__i_, _STD::forward<_A0>(__a0));}
|
||||
{return __table_.__emplace_hint_multi(__p.__i_, _VSTD::forward<_A0>(__a0));}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _A0, class... _Args,
|
||||
class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
|
||||
iterator emplace_hint(const_iterator __p, _A0&& __a0, _Args&&... __args);
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -1295,20 +1376,20 @@ public:
|
||||
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _P,
|
||||
class = typename enable_if<is_convertible<_P, value_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<value_type, _P>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(_P&& __x)
|
||||
{return __table_.__insert_multi(_STD::forward<_P>(__x));}
|
||||
{return __table_.__insert_multi(_VSTD::forward<_P>(__x));}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __p, const value_type& __x)
|
||||
{return __table_.__insert_multi(__p.__i_, __x);}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _P,
|
||||
class = typename enable_if<is_convertible<_P, value_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<value_type, _P>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __p, _P&& __x)
|
||||
{return __table_.__insert_multi(__p.__i_, _STD::forward<_P>(__x));}
|
||||
{return __table_.__insert_multi(__p.__i_, _VSTD::forward<_P>(__x));}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _InputIterator>
|
||||
void insert(_InputIterator __first, _InputIterator __last);
|
||||
@@ -1324,10 +1405,12 @@ public:
|
||||
iterator erase(const_iterator __first, const_iterator __last)
|
||||
{return __table_.erase(__first.__i_, __last.__i_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() {__table_.clear();}
|
||||
void clear() _NOEXCEPT {__table_.clear();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(unordered_multimap& __u) {__table_.swap(__u.__table_);}
|
||||
void swap(unordered_multimap& __u)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<__table>::value)
|
||||
{__table_.swap(__u.__table_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hasher hash_function() const
|
||||
@@ -1350,9 +1433,10 @@ public:
|
||||
{return __table_.__equal_range_multi(__k);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_count() const {return __table_.bucket_count();}
|
||||
size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_bucket_count() const {return __table_.max_bucket_count();}
|
||||
size_type max_bucket_count() const _NOEXCEPT
|
||||
{return __table_.max_bucket_count();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_size(size_type __n) const
|
||||
@@ -1374,9 +1458,9 @@ public:
|
||||
const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
float load_factor() const {return __table_.load_factor();}
|
||||
float load_factor() const _NOEXCEPT {return __table_.load_factor();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
float max_load_factor() const {return __table_.max_load_factor();}
|
||||
float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1387,10 +1471,10 @@ public:
|
||||
private:
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
template <class _A0, class... _Args,
|
||||
class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
|
||||
__node_holder __construct_node(_A0&& __a0, _Args&&... __args);
|
||||
template <class _A0,
|
||||
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
|
||||
__node_holder __construct_node(_A0&& __a0);
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
};
|
||||
@@ -1474,14 +1558,15 @@ template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
unordered_multimap&& __u)
|
||||
: __table_(_STD::move(__u.__table_))
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
|
||||
: __table_(_VSTD::move(__u.__table_))
|
||||
{
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
unordered_multimap&& __u, const allocator_type& __a)
|
||||
: __table_(_STD::move(__u.__table_), __a)
|
||||
: __table_(_VSTD::move(__u.__table_), __a)
|
||||
{
|
||||
if (__a != __u.get_allocator())
|
||||
{
|
||||
@@ -1489,7 +1574,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
while (__u.size() != 0)
|
||||
{
|
||||
__table_.__insert_multi(
|
||||
_STD::move(__u.__table_.remove((__i++).__i_)->__value_)
|
||||
_VSTD::move(__u.__table_.remove((__i++).__i_)->__value_)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1530,8 +1615,9 @@ template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&
|
||||
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_multimap&& __u)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<__table>::value)
|
||||
{
|
||||
__table_ = _STD::move(__u.__table_);
|
||||
__table_ = _VSTD::move(__u.__table_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -1552,7 +1638,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _A0, class... _Args,
|
||||
class // = typename enable_if<is_convertible<_A0, key_type>::value>::type
|
||||
class // = typename enable_if<is_constructible<key_type, _A0>::value>::type
|
||||
>
|
||||
typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
|
||||
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(
|
||||
@@ -1560,11 +1646,11 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(
|
||||
{
|
||||
__node_allocator& __na = __table_.__node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_traits::construct(__na, addressof(__h->__value_.first),
|
||||
_STD::forward<_A0>(__a0));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first),
|
||||
_VSTD::forward<_A0>(__a0));
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__node_traits::construct(__na, addressof(__h->__value_.second),
|
||||
_STD::forward<_Args>(__args)...);
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return __h;
|
||||
}
|
||||
@@ -1573,15 +1659,15 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _A0,
|
||||
class // = typename enable_if<is_convertible<_A0, value_type>::value>::type
|
||||
class // = typename enable_if<is_constructible<value_type, _A0>::value>::type
|
||||
>
|
||||
typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
|
||||
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0)
|
||||
{
|
||||
__node_allocator& __na = __table_.__node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_traits::construct(__na, addressof(__h->__value_),
|
||||
_STD::forward<_A0>(__a0));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_),
|
||||
_VSTD::forward<_A0>(__a0));
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return __h;
|
||||
@@ -1591,13 +1677,13 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _A0, class... _Args,
|
||||
class // = typename enable_if<is_convertible<_A0, key_type>::value>::type
|
||||
class // = typename enable_if<is_constructible<key_type, _A0>::value>::type
|
||||
>
|
||||
typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::iterator
|
||||
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace(_A0&& __a0, _Args&&... __args)
|
||||
{
|
||||
__node_holder __h = __construct_node(_STD::forward<_A0>(__a0),
|
||||
_STD::forward<_Args>(__args)...);
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
iterator __r = __table_.__node_insert_multi(__h.get());
|
||||
__h.release();
|
||||
return __r;
|
||||
@@ -1605,14 +1691,14 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace(_A0&& __a0, _Args&&
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _A0, class... _Args,
|
||||
class // = typename enable_if<is_convertible<_A0, key_type>::value>::type
|
||||
class // = typename enable_if<is_constructible<key_type, _A0>::value>::type
|
||||
>
|
||||
typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::iterator
|
||||
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace_hint(
|
||||
const_iterator __p, _A0&& __a0, _Args&&... __args)
|
||||
{
|
||||
__node_holder __h = __construct_node(_STD::forward<_A0>(__a0),
|
||||
_STD::forward<_Args>(__args)...);
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
iterator __r = __table_.__node_insert_multi(__p.__i_, __h.get());
|
||||
__h.release();
|
||||
return __r;
|
||||
@@ -1637,6 +1723,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
@@ -1655,9 +1742,9 @@ operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
{
|
||||
_EqRng __xeq = __x.equal_range(__i->first);
|
||||
_EqRng __yeq = __y.equal_range(__i->first);
|
||||
if (_STD::distance(__xeq.first, __xeq.second) !=
|
||||
_STD::distance(__yeq.first, __yeq.second) ||
|
||||
!_STD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
|
||||
if (_VSTD::distance(__xeq.first, __xeq.second) !=
|
||||
_VSTD::distance(__yeq.first, __yeq.second) ||
|
||||
!_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
|
||||
return false;
|
||||
__i = __xeq.second;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,12 @@ public:
|
||||
typedef /unspecified/ local_iterator;
|
||||
typedef /unspecified/ const_local_iterator;
|
||||
|
||||
explicit unordered_set(size_type n = 0, const hasher& hf = hasher(),
|
||||
unordered_set()
|
||||
noexcept(
|
||||
is_nothrow_default_constructible<hasher>::value &&
|
||||
is_nothrow_default_constructible<key_equal>::value &&
|
||||
is_nothrow_default_constructible<allocator_type>::value);
|
||||
explicit unordered_set(size_type n, const hasher& hf = hasher(),
|
||||
const key_equal& eql = key_equal(),
|
||||
const allocator_type& a = allocator_type());
|
||||
template <class InputIterator>
|
||||
@@ -54,28 +59,37 @@ public:
|
||||
explicit unordered_set(const allocator_type&);
|
||||
unordered_set(const unordered_set&);
|
||||
unordered_set(const unordered_set&, const Allocator&);
|
||||
unordered_set(unordered_set&&);
|
||||
unordered_set(unordered_set&&)
|
||||
noexcept(
|
||||
is_nothrow_move_constructible<hasher>::value &&
|
||||
is_nothrow_move_constructible<key_equal>::value &&
|
||||
is_nothrow_move_constructible<allocator_type>::value);
|
||||
unordered_set(unordered_set&&, const Allocator&);
|
||||
unordered_set(initializer_list<value_type>, size_type n = 0,
|
||||
const hasher& hf = hasher(), const key_equal& eql = key_equal(),
|
||||
const allocator_type& a = allocator_type());
|
||||
~unordered_set();
|
||||
unordered_set& operator=(const unordered_set&);
|
||||
unordered_set& operator=(unordered_set&&);
|
||||
unordered_set& operator=(unordered_set&&)
|
||||
noexcept(
|
||||
allocator_type::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value &&
|
||||
is_nothrow_move_assignable<hasher>::value &&
|
||||
is_nothrow_move_assignable<key_equal>::value);
|
||||
unordered_set& operator=(initializer_list<value_type>);
|
||||
|
||||
allocator_type get_allocator() const;
|
||||
allocator_type get_allocator() const noexcept;
|
||||
|
||||
bool empty() const;
|
||||
size_type size() const;
|
||||
size_type max_size() const;
|
||||
bool empty() const noexcept;
|
||||
size_type size() const noexcept;
|
||||
size_type max_size() const noexcept;
|
||||
|
||||
iterator begin();
|
||||
iterator end();
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
const_iterator cbegin() const;
|
||||
const_iterator cend() const;
|
||||
iterator begin() noexcept;
|
||||
iterator end() noexcept;
|
||||
const_iterator begin() const noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
const_iterator cbegin() const noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
|
||||
template <class... Args>
|
||||
pair<iterator, bool> emplace(Args&&... args);
|
||||
@@ -92,9 +106,14 @@ public:
|
||||
iterator erase(const_iterator position);
|
||||
size_type erase(const key_type& k);
|
||||
iterator erase(const_iterator first, const_iterator last);
|
||||
void clear();
|
||||
void clear() noexcept;
|
||||
|
||||
void swap(unordered_set&);
|
||||
void swap(unordered_set&)
|
||||
noexcept(
|
||||
(!allocator_type::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value) &&
|
||||
__is_nothrow_swappable<hasher>::value &&
|
||||
__is_nothrow_swappable<key_equal>::value);
|
||||
|
||||
hasher hash_function() const;
|
||||
key_equal key_eq() const;
|
||||
@@ -105,8 +124,8 @@ public:
|
||||
pair<iterator, iterator> equal_range(const key_type& k);
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
|
||||
|
||||
size_type bucket_count() const;
|
||||
size_type max_bucket_count() const;
|
||||
size_type bucket_count() const noexcept;
|
||||
size_type max_bucket_count() const noexcept;
|
||||
|
||||
size_type bucket_size(size_type n) const;
|
||||
size_type bucket(const key_type& k) const;
|
||||
@@ -118,8 +137,8 @@ public:
|
||||
const_local_iterator cbegin(size_type n) const;
|
||||
const_local_iterator cend(size_type n) const;
|
||||
|
||||
float load_factor() const;
|
||||
float max_load_factor() const;
|
||||
float load_factor() const noexcept;
|
||||
float max_load_factor() const noexcept;
|
||||
void max_load_factor(float z);
|
||||
void rehash(size_type n);
|
||||
void reserve(size_type n);
|
||||
@@ -127,7 +146,8 @@ public:
|
||||
|
||||
template <class Value, class Hash, class Pred, class Alloc>
|
||||
void swap(unordered_set<Value, Hash, Pred, Alloc>& x,
|
||||
unordered_set<Value, Hash, Pred, Alloc>& y);
|
||||
unordered_set<Value, Hash, Pred, Alloc>& y)
|
||||
noexcept(noexcept(x.swap(y)));
|
||||
|
||||
template <class Value, class Hash, class Pred, class Alloc>
|
||||
bool
|
||||
@@ -162,7 +182,12 @@ public:
|
||||
typedef /unspecified/ local_iterator;
|
||||
typedef /unspecified/ const_local_iterator;
|
||||
|
||||
explicit unordered_multiset(size_type n = 0, const hasher& hf = hasher(),
|
||||
unordered_multiset()
|
||||
noexcept(
|
||||
is_nothrow_default_constructible<hasher>::value &&
|
||||
is_nothrow_default_constructible<key_equal>::value &&
|
||||
is_nothrow_default_constructible<allocator_type>::value);
|
||||
explicit unordered_multiset(size_type n, const hasher& hf = hasher(),
|
||||
const key_equal& eql = key_equal(),
|
||||
const allocator_type& a = allocator_type());
|
||||
template <class InputIterator>
|
||||
@@ -173,28 +198,37 @@ public:
|
||||
explicit unordered_multiset(const allocator_type&);
|
||||
unordered_multiset(const unordered_multiset&);
|
||||
unordered_multiset(const unordered_multiset&, const Allocator&);
|
||||
unordered_multiset(unordered_multiset&&);
|
||||
unordered_multiset(unordered_multiset&&)
|
||||
noexcept(
|
||||
is_nothrow_move_constructible<hasher>::value &&
|
||||
is_nothrow_move_constructible<key_equal>::value &&
|
||||
is_nothrow_move_constructible<allocator_type>::value);
|
||||
unordered_multiset(unordered_multiset&&, const Allocator&);
|
||||
unordered_multiset(initializer_list<value_type>, size_type n = /see below/,
|
||||
const hasher& hf = hasher(), const key_equal& eql = key_equal(),
|
||||
const allocator_type& a = allocator_type());
|
||||
~unordered_multiset();
|
||||
unordered_multiset& operator=(const unordered_multiset&);
|
||||
unordered_multiset& operator=(unordered_multiset&&);
|
||||
unordered_multiset& operator=(unordered_multiset&&)
|
||||
noexcept(
|
||||
allocator_type::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value &&
|
||||
is_nothrow_move_assignable<hasher>::value &&
|
||||
is_nothrow_move_assignable<key_equal>::value);
|
||||
unordered_multiset& operator=(initializer_list<value_type>);
|
||||
|
||||
allocator_type get_allocator() const;
|
||||
allocator_type get_allocator() const noexcept;
|
||||
|
||||
bool empty() const;
|
||||
size_type size() const;
|
||||
size_type max_size() const;
|
||||
bool empty() const noexcept;
|
||||
size_type size() const noexcept;
|
||||
size_type max_size() const noexcept;
|
||||
|
||||
iterator begin();
|
||||
iterator end();
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
const_iterator cbegin() const;
|
||||
const_iterator cend() const;
|
||||
iterator begin() noexcept;
|
||||
iterator end() noexcept;
|
||||
const_iterator begin() const noexcept;
|
||||
const_iterator end() const noexcept;
|
||||
const_iterator cbegin() const noexcept;
|
||||
const_iterator cend() const noexcept;
|
||||
|
||||
template <class... Args>
|
||||
iterator emplace(Args&&... args);
|
||||
@@ -211,9 +245,14 @@ public:
|
||||
iterator erase(const_iterator position);
|
||||
size_type erase(const key_type& k);
|
||||
iterator erase(const_iterator first, const_iterator last);
|
||||
void clear();
|
||||
void clear() noexcept;
|
||||
|
||||
void swap(unordered_multiset&);
|
||||
void swap(unordered_multiset&)
|
||||
noexcept(
|
||||
(!allocator_type::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<allocator_type>::value) &&
|
||||
__is_nothrow_swappable<hasher>::value &&
|
||||
__is_nothrow_swappable<key_equal>::value);
|
||||
|
||||
hasher hash_function() const;
|
||||
key_equal key_eq() const;
|
||||
@@ -224,8 +263,8 @@ public:
|
||||
pair<iterator, iterator> equal_range(const key_type& k);
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
|
||||
|
||||
size_type bucket_count() const;
|
||||
size_type max_bucket_count() const;
|
||||
size_type bucket_count() const noexcept;
|
||||
size_type max_bucket_count() const noexcept;
|
||||
|
||||
size_type bucket_size(size_type n) const;
|
||||
size_type bucket(const key_type& k) const;
|
||||
@@ -237,8 +276,8 @@ public:
|
||||
const_local_iterator cbegin(size_type n) const;
|
||||
const_local_iterator cend(size_type n) const;
|
||||
|
||||
float load_factor() const;
|
||||
float max_load_factor() const;
|
||||
float load_factor() const noexcept;
|
||||
float max_load_factor() const noexcept;
|
||||
void max_load_factor(float z);
|
||||
void rehash(size_type n);
|
||||
void reserve(size_type n);
|
||||
@@ -246,7 +285,8 @@ public:
|
||||
|
||||
template <class Value, class Hash, class Pred, class Alloc>
|
||||
void swap(unordered_multiset<Value, Hash, Pred, Alloc>& x,
|
||||
unordered_multiset<Value, Hash, Pred, Alloc>& y);
|
||||
unordered_multiset<Value, Hash, Pred, Alloc>& y)
|
||||
noexcept(noexcept(x.swap(y)));
|
||||
|
||||
template <class Value, class Hash, class Pred, class Alloc>
|
||||
bool
|
||||
@@ -300,7 +340,9 @@ public:
|
||||
typedef typename __table::const_local_iterator const_local_iterator;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unordered_set() {} // = default;
|
||||
unordered_set()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
|
||||
{} // = default;
|
||||
explicit unordered_set(size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql,
|
||||
@@ -319,7 +361,8 @@ public:
|
||||
unordered_set(const unordered_set& __u);
|
||||
unordered_set(const unordered_set& __u, const allocator_type& __a);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
unordered_set(unordered_set&& __u);
|
||||
unordered_set(unordered_set&& __u)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
|
||||
unordered_set(unordered_set&& __u, const allocator_type& __a);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
unordered_set(initializer_list<value_type> __il);
|
||||
@@ -330,45 +373,51 @@ public:
|
||||
const hasher& __hf, const key_equal& __eql,
|
||||
const allocator_type& __a);
|
||||
// ~unordered_set() = default;
|
||||
// unordered_set& operator=(const unordered_set& __u) = default;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unordered_set& operator=(const unordered_set& __u)
|
||||
{
|
||||
__table_ = __u.__table_;
|
||||
return *this;
|
||||
}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
unordered_set& operator=(unordered_set&& __u);
|
||||
unordered_set& operator=(unordered_set&& __u)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
|
||||
#endif
|
||||
unordered_set& operator=(initializer_list<value_type> __il);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const
|
||||
allocator_type get_allocator() const _NOEXCEPT
|
||||
{return allocator_type(__table_.__node_alloc());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return __table_.size() == 0;}
|
||||
bool empty() const _NOEXCEPT {return __table_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return __table_.size();}
|
||||
size_type size() const _NOEXCEPT {return __table_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const {return __table_.max_size();}
|
||||
size_type max_size() const _NOEXCEPT {return __table_.max_size();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return __table_.begin();}
|
||||
iterator begin() _NOEXCEPT {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return __table_.end();}
|
||||
iterator end() _NOEXCEPT {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return __table_.begin();}
|
||||
const_iterator begin() const _NOEXCEPT {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return __table_.end();}
|
||||
const_iterator end() const _NOEXCEPT {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cbegin() const {return __table_.begin();}
|
||||
const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cend() const {return __table_.end();}
|
||||
const_iterator cend() const _NOEXCEPT {return __table_.end();}
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> emplace(_Args&&... __args)
|
||||
{return __table_.__emplace_unique(_STD::forward<_Args>(__args)...);}
|
||||
{return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...);}
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator emplace_hint(const_iterator, _Args&&... __args)
|
||||
{return __table_.__emplace_unique(_STD::forward<_Args>(__args)...).first;}
|
||||
{return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first;}
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> insert(const value_type& __x)
|
||||
@@ -376,7 +425,7 @@ public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> insert(value_type&& __x)
|
||||
{return __table_.__insert_unique(_STD::move(__x));}
|
||||
{return __table_.__insert_unique(_VSTD::move(__x));}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator, const value_type& __x)
|
||||
@@ -384,7 +433,7 @@ public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator, value_type&& __x)
|
||||
{return insert(_STD::move(__x)).first;}
|
||||
{return insert(_VSTD::move(__x)).first;}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _InputIterator>
|
||||
void insert(_InputIterator __first, _InputIterator __last);
|
||||
@@ -400,10 +449,12 @@ public:
|
||||
iterator erase(const_iterator __first, const_iterator __last)
|
||||
{return __table_.erase(__first, __last);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() {__table_.clear();}
|
||||
void clear() _NOEXCEPT {__table_.clear();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(unordered_set& __u) {__table_.swap(__u.__table_);}
|
||||
void swap(unordered_set& __u)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<__table>::value)
|
||||
{__table_.swap(__u.__table_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hasher hash_function() const {return __table_.hash_function();}
|
||||
@@ -424,9 +475,9 @@ public:
|
||||
{return __table_.__equal_range_unique(__k);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_count() const {return __table_.bucket_count();}
|
||||
size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_bucket_count() const {return __table_.max_bucket_count();}
|
||||
size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);}
|
||||
@@ -447,9 +498,9 @@ public:
|
||||
const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
float load_factor() const {return __table_.load_factor();}
|
||||
float load_factor() const _NOEXCEPT {return __table_.load_factor();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
float max_load_factor() const {return __table_.max_load_factor();}
|
||||
float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -536,20 +587,21 @@ template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
unordered_set&& __u)
|
||||
: __table_(_STD::move(__u.__table_))
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
|
||||
: __table_(_VSTD::move(__u.__table_))
|
||||
{
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
unordered_set&& __u, const allocator_type& __a)
|
||||
: __table_(_STD::move(__u.__table_), __a)
|
||||
: __table_(_VSTD::move(__u.__table_), __a)
|
||||
{
|
||||
if (__a != __u.get_allocator())
|
||||
{
|
||||
iterator __i = __u.begin();
|
||||
while (__u.size() != 0)
|
||||
__table_.__insert_unique(_STD::move(__u.__table_.remove(__i++)->__value_));
|
||||
__table_.__insert_unique(_VSTD::move(__u.__table_.remove(__i++)->__value_));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -588,8 +640,9 @@ template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
unordered_set<_Value, _Hash, _Pred, _Alloc>&
|
||||
unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_set&& __u)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<__table>::value)
|
||||
{
|
||||
__table_ = _STD::move(__u.__table_);
|
||||
__table_ = _VSTD::move(__u.__table_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -621,6 +674,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
@@ -684,7 +738,9 @@ public:
|
||||
typedef typename __table::const_local_iterator const_local_iterator;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unordered_multiset() {} // = default
|
||||
unordered_multiset()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
|
||||
{} // = default
|
||||
explicit unordered_multiset(size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
unordered_multiset(size_type __n, const hasher& __hf,
|
||||
@@ -703,7 +759,8 @@ public:
|
||||
unordered_multiset(const unordered_multiset& __u);
|
||||
unordered_multiset(const unordered_multiset& __u, const allocator_type& __a);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
unordered_multiset(unordered_multiset&& __u);
|
||||
unordered_multiset(unordered_multiset&& __u)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
|
||||
unordered_multiset(unordered_multiset&& __u, const allocator_type& __a);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
unordered_multiset(initializer_list<value_type> __il);
|
||||
@@ -714,51 +771,57 @@ public:
|
||||
const hasher& __hf, const key_equal& __eql,
|
||||
const allocator_type& __a);
|
||||
// ~unordered_multiset() = default;
|
||||
// unordered_multiset& operator=(const unordered_multiset& __u) = default;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unordered_multiset& operator=(const unordered_multiset& __u)
|
||||
{
|
||||
__table_ = __u.__table_;
|
||||
return *this;
|
||||
}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
unordered_multiset& operator=(unordered_multiset&& __u);
|
||||
unordered_multiset& operator=(unordered_multiset&& __u)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
|
||||
#endif
|
||||
unordered_multiset& operator=(initializer_list<value_type> __il);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const
|
||||
allocator_type get_allocator() const _NOEXCEPT
|
||||
{return allocator_type(__table_.__node_alloc());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return __table_.size() == 0;}
|
||||
bool empty() const _NOEXCEPT {return __table_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return __table_.size();}
|
||||
size_type size() const _NOEXCEPT {return __table_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const {return __table_.max_size();}
|
||||
size_type max_size() const _NOEXCEPT {return __table_.max_size();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return __table_.begin();}
|
||||
iterator begin() _NOEXCEPT {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return __table_.end();}
|
||||
iterator end() _NOEXCEPT {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return __table_.begin();}
|
||||
const_iterator begin() const _NOEXCEPT {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return __table_.end();}
|
||||
const_iterator end() const _NOEXCEPT {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cbegin() const {return __table_.begin();}
|
||||
const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cend() const {return __table_.end();}
|
||||
const_iterator cend() const _NOEXCEPT {return __table_.end();}
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator emplace(_Args&&... __args)
|
||||
{return __table_.__emplace_multi(_STD::forward<_Args>(__args)...);}
|
||||
{return __table_.__emplace_multi(_VSTD::forward<_Args>(__args)...);}
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator emplace_hint(const_iterator __p, _Args&&... __args)
|
||||
{return __table_.__emplace_hint_multi(__p, _STD::forward<_Args>(__args)...);}
|
||||
{return __table_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);}
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(value_type&& __x) {return __table_.__insert_multi(_STD::move(__x));}
|
||||
iterator insert(value_type&& __x) {return __table_.__insert_multi(_VSTD::move(__x));}
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __p, const value_type& __x)
|
||||
@@ -766,7 +829,7 @@ public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __p, value_type&& __x)
|
||||
{return __table_.__insert_multi(__p, _STD::move(__x));}
|
||||
{return __table_.__insert_multi(__p, _VSTD::move(__x));}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _InputIterator>
|
||||
void insert(_InputIterator __first, _InputIterator __last);
|
||||
@@ -782,10 +845,12 @@ public:
|
||||
iterator erase(const_iterator __first, const_iterator __last)
|
||||
{return __table_.erase(__first, __last);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() {__table_.clear();}
|
||||
void clear() _NOEXCEPT {__table_.clear();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(unordered_multiset& __u) {__table_.swap(__u.__table_);}
|
||||
void swap(unordered_multiset& __u)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<__table>::value)
|
||||
{__table_.swap(__u.__table_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hasher hash_function() const {return __table_.hash_function();}
|
||||
@@ -806,9 +871,9 @@ public:
|
||||
{return __table_.__equal_range_multi(__k);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_count() const {return __table_.bucket_count();}
|
||||
size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_bucket_count() const {return __table_.max_bucket_count();}
|
||||
size_type max_bucket_count() const _NOEXCEPT {return __table_.max_bucket_count();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);}
|
||||
@@ -829,9 +894,9 @@ public:
|
||||
const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
float load_factor() const {return __table_.load_factor();}
|
||||
float load_factor() const _NOEXCEPT {return __table_.load_factor();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
float max_load_factor() const {return __table_.max_load_factor();}
|
||||
float max_load_factor() const _NOEXCEPT {return __table_.max_load_factor();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -919,20 +984,21 @@ template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
unordered_multiset&& __u)
|
||||
: __table_(_STD::move(__u.__table_))
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
|
||||
: __table_(_VSTD::move(__u.__table_))
|
||||
{
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
unordered_multiset&& __u, const allocator_type& __a)
|
||||
: __table_(_STD::move(__u.__table_), __a)
|
||||
: __table_(_VSTD::move(__u.__table_), __a)
|
||||
{
|
||||
if (__a != __u.get_allocator())
|
||||
{
|
||||
iterator __i = __u.begin();
|
||||
while (__u.size() != 0)
|
||||
__table_.__insert_multi(_STD::move(__u.__table_.remove(__i++)->__value_));
|
||||
__table_.__insert_multi(_VSTD::move(__u.__table_.remove(__i++)->__value_));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -972,8 +1038,9 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
unordered_multiset<_Value, _Hash, _Pred, _Alloc>&
|
||||
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(
|
||||
unordered_multiset&& __u)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<__table>::value)
|
||||
{
|
||||
__table_ = _STD::move(__u.__table_);
|
||||
__table_ = _VSTD::move(__u.__table_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -1005,6 +1072,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
@@ -1023,9 +1091,9 @@ operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
{
|
||||
_EqRng __xeq = __x.equal_range(*__i);
|
||||
_EqRng __yeq = __y.equal_range(*__i);
|
||||
if (_STD::distance(__xeq.first, __xeq.second) !=
|
||||
_STD::distance(__yeq.first, __yeq.second) ||
|
||||
!_STD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
|
||||
if (_VSTD::distance(__xeq.first, __xeq.second) !=
|
||||
_VSTD::distance(__yeq.first, __yeq.second) ||
|
||||
!_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
|
||||
return false;
|
||||
__i = __xeq.second;
|
||||
}
|
||||
|
||||
176
include/utility
176
include/utility
@@ -29,11 +29,19 @@ namespace rel_ops
|
||||
template<class T> bool operator>=(const T&, const T&);
|
||||
}
|
||||
|
||||
template<class T> void swap(T& a, T& b);
|
||||
template <class T, size_t N> void swap(T (&a)[N], T (&b)[N]);
|
||||
template<class T>
|
||||
void
|
||||
swap(T& a, T& b) noexcept(is_nothrow_move_constructible<T>::value &&
|
||||
is_nothrow_move_assignable<T>::value);
|
||||
|
||||
template <class T, class U> T&& forward(U&&);
|
||||
template <class T> typename remove_reference<T>::type&& move(T&&);
|
||||
template <class T, size_t N>
|
||||
void
|
||||
swap(T (&a)[N], T (&b)[N]) noexcept(noexcept(swap(*a, *b)));
|
||||
|
||||
template <class T> T&& forward(typename remove_reference<T>::type& t) noexcept;
|
||||
template <class T> T&& forward(typename remove_reference<T>::type&& t) noexcept;
|
||||
|
||||
template <class T> typename remove_reference<T>::type&& move(T&&) noexcept;
|
||||
|
||||
template <class T>
|
||||
typename conditional
|
||||
@@ -42,7 +50,7 @@ template <class T>
|
||||
const T&,
|
||||
T&&
|
||||
>::type
|
||||
move_if_noexcept(T& x);
|
||||
move_if_noexcept(T& x) noexcept;
|
||||
|
||||
template <class T> typename add_rvalue_reference<T>::type declval() noexcept;
|
||||
|
||||
@@ -56,6 +64,7 @@ struct pair
|
||||
T2 second;
|
||||
|
||||
pair(const pair&) = default;
|
||||
pair(pair&&) = default;
|
||||
constexpr pair();
|
||||
pair(const T1& x, const T2& y);
|
||||
template <class U, class V> pair(U&& x, V&& y);
|
||||
@@ -66,10 +75,12 @@ struct pair
|
||||
tuple<Args2...> second_args);
|
||||
|
||||
template <class U, class V> pair& operator=(const pair<U, V>& p);
|
||||
pair& operator=(pair&& p);
|
||||
pair& operator=(pair&& p) noexcept(is_nothrow_move_assignable<T1>::value &&
|
||||
is_nothrow_move_assignable<T2>::value);
|
||||
template <class U, class V> pair& operator=(pair<U, V>&& p);
|
||||
|
||||
void swap(pair& p);
|
||||
void swap(pair& p) noexcept(noexcept(swap(first, p.first)) &&
|
||||
noexcept(swap(second, p.second)));
|
||||
};
|
||||
|
||||
template <class T1, class T2> bool operator==(const pair<T1,T2>&, const pair<T1,T2>&);
|
||||
@@ -80,7 +91,9 @@ template <class T1, class T2> bool operator>=(const pair<T1,T2>&, const pair<T1,
|
||||
template <class T1, class T2> bool operator<=(const pair<T1,T2>&, const pair<T1,T2>&);
|
||||
|
||||
template <class T1, class T2> pair<V1, V2> make_pair(T1&&, T2&&);
|
||||
template <class T1, class T2> void swap(pair<T1, T2>& x, pair<T1, T2>& y);
|
||||
template <class T1, class T2>
|
||||
void
|
||||
swap(pair<T1, T2>& x, pair<T1, T2>& y) noexcept(noexcept(x.swap(y)));
|
||||
|
||||
struct piecewise_construct_t { };
|
||||
constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
|
||||
@@ -94,15 +107,15 @@ template <class T1, class T2> struct tuple_element<1, std::pair<T1, T2> >;
|
||||
|
||||
template<size_t I, class T1, class T2>
|
||||
typename tuple_element<I, std::pair<T1, T2> >::type&
|
||||
get(std::pair<T1, T2>&);
|
||||
get(std::pair<T1, T2>&) noexcept;
|
||||
|
||||
template<size_t I, class T1, class T2>
|
||||
const typename const tuple_element<I, std::pair<T1, T2> >::type&
|
||||
get(const std::pair<T1, T2>&);
|
||||
get(const std::pair<T1, T2>&) noexcept;
|
||||
|
||||
template<size_t I, class T1, class T2>
|
||||
typename tuple_element<I, std::pair<T1, T2> >::type&&
|
||||
get(std::pair<T1, T2>&&);
|
||||
get(std::pair<T1, T2>&&) noexcept;
|
||||
|
||||
} // std
|
||||
|
||||
@@ -168,9 +181,9 @@ swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardItera
|
||||
template<class _Tp, size_t _N>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(_Tp (&__a)[_N], _Tp (&__b)[_N])
|
||||
swap(_Tp (&__a)[_N], _Tp (&__b)[_N]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
|
||||
{
|
||||
_STD::swap_ranges(__a, __a + _N, __b);
|
||||
_VSTD::swap_ranges(__a, __a + _N, __b);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
@@ -185,18 +198,15 @@ typename conditional
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
const _Tp&
|
||||
#endif
|
||||
move_if_noexcept(_Tp& __x)
|
||||
move_if_noexcept(_Tp& __x) _NOEXCEPT
|
||||
{
|
||||
return _STD::move(__x);
|
||||
return _VSTD::move(__x);
|
||||
}
|
||||
|
||||
struct _LIBCPP_VISIBLE piecewise_construct_t { };
|
||||
//constexpr
|
||||
extern const piecewise_construct_t piecewise_construct;// = piecewise_construct_t();
|
||||
|
||||
template <class _T1, class _T2> struct pair;
|
||||
template <class _T1, class _T2> void swap(pair<_T1, _T2>&, pair<_T1, _T2>&);
|
||||
|
||||
template <class _T1, class _T2>
|
||||
struct _LIBCPP_VISIBLE pair
|
||||
{
|
||||
@@ -206,33 +216,93 @@ struct _LIBCPP_VISIBLE pair
|
||||
_T1 first;
|
||||
_T2 second;
|
||||
|
||||
// pair(const pair&) = default;
|
||||
// pair(pair&&) = default;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY pair() : first(), second() {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY pair(const _T1& __x, const _T2& __y)
|
||||
: first(__x), second(__y) {}
|
||||
|
||||
template<class _U1, class _U2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair(const pair<_U1, _U2>& __p
|
||||
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
,typename enable_if<is_constructible<_T1, _U1>::value &&
|
||||
is_constructible<_T2, _U2>::value>::type* = 0
|
||||
#endif
|
||||
)
|
||||
: first(__p.first), second(__p.second) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair(const pair& __p)
|
||||
_NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value &&
|
||||
is_nothrow_copy_constructible<second_type>::value)
|
||||
: first(__p.first),
|
||||
second(__p.second)
|
||||
{
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair& operator=(const pair& __p)
|
||||
_NOEXCEPT_(is_nothrow_copy_assignable<first_type>::value &&
|
||||
is_nothrow_copy_assignable<second_type>::value)
|
||||
{
|
||||
first = __p.first;
|
||||
second = __p.second;
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _U1, class _U2,
|
||||
class = typename enable_if<is_convertible<_U1, first_type >::value &&
|
||||
is_convertible<_U2, second_type>::value>::type>
|
||||
class = typename enable_if<is_constructible<first_type, _U1 >::value &&
|
||||
is_constructible<second_type, _U2>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair(_U1&& __u1, _U2&& __u2)
|
||||
: first(_STD::forward<_U1>(__u1)),
|
||||
second(_STD::forward<_U2>(__u2))
|
||||
: first(_VSTD::forward<_U1>(__u1)),
|
||||
second(_VSTD::forward<_U2>(__u2))
|
||||
{}
|
||||
|
||||
template<class _U1, class _U2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair(pair<_U1, _U2>&& __p,
|
||||
typename enable_if<is_constructible<_T1, _U1>::value &&
|
||||
is_constructible<_T2, _U2>::value>::type* = 0)
|
||||
: first(_VSTD::forward<_U1>(__p.first)),
|
||||
second(_VSTD::forward<_U2>(__p.second)) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair(pair&& __p) _NOEXCEPT_(is_nothrow_move_constructible<first_type>::value &&
|
||||
is_nothrow_move_constructible<second_type>::value)
|
||||
: first(_VSTD::forward<first_type>(__p.first)),
|
||||
second(_VSTD::forward<second_type>(__p.second))
|
||||
{
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair&
|
||||
operator=(pair&& __p) _NOEXCEPT_(is_nothrow_move_assignable<first_type>::value &&
|
||||
is_nothrow_move_assignable<second_type>::value)
|
||||
{
|
||||
first = _VSTD::forward<first_type>(__p.first);
|
||||
second = _VSTD::forward<second_type>(__p.second);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template<class _Tuple,
|
||||
class = typename enable_if<__tuple_convertible<_Tuple, pair>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair(_Tuple&& __p)
|
||||
: first(_STD::forward<typename tuple_element<0,
|
||||
: first(_VSTD::forward<typename tuple_element<0,
|
||||
typename __make_tuple_types<_Tuple>::type>::type>(get<0>(__p))),
|
||||
second(_STD::forward<typename tuple_element<1,
|
||||
second(_VSTD::forward<typename tuple_element<1,
|
||||
typename __make_tuple_types<_Tuple>::type>::type>(get<1>(__p)))
|
||||
{}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
|
||||
template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -243,8 +313,6 @@ struct _LIBCPP_VISIBLE pair
|
||||
typename __make_tuple_indices<sizeof...(_Args2) >::type())
|
||||
{}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tuple,
|
||||
class = typename enable_if<__tuple_assignable<_Tuple, pair>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -254,21 +322,27 @@ struct _LIBCPP_VISIBLE pair
|
||||
typedef typename __make_tuple_types<_Tuple>::type _TupleRef;
|
||||
typedef typename tuple_element<0, _TupleRef>::type _U0;
|
||||
typedef typename tuple_element<1, _TupleRef>::type _U1;
|
||||
first = _STD::forward<_U0>(_STD::get<0>(__p));
|
||||
second = _STD::forward<_U1>(_STD::get<1>(__p));
|
||||
first = _VSTD::forward<_U0>(_VSTD::get<0>(__p));
|
||||
second = _VSTD::forward<_U1>(_VSTD::get<1>(__p));
|
||||
return *this;
|
||||
}
|
||||
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template<class _U1, class _U2>
|
||||
_LIBCPP_INLINE_VISIBILITY pair(const pair<_U1, _U2>& __p)
|
||||
: first(__p.first), second(__p.second) {}
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void _LIBCPP_INLINE_VISIBILITY swap(pair& __p) {_STD::swap(*this, __p);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(pair& __p) _NOEXCEPT_(__is_nothrow_swappable<first_type>::value &&
|
||||
__is_nothrow_swappable<second_type>::value)
|
||||
{
|
||||
_VSTD::iter_swap(&first, &__p.first);
|
||||
_VSTD::iter_swap(&second, &__p.second);
|
||||
}
|
||||
private:
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair(piecewise_construct_t,
|
||||
tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args,
|
||||
__tuple_indices<_I1...>, __tuple_indices<_I2...>);
|
||||
@@ -325,11 +399,17 @@ operator<=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
|
||||
|
||||
template <class _T1, class _T2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
typename enable_if
|
||||
<
|
||||
__is_swappable<_T1>::value &&
|
||||
__is_swappable<_T2>::value,
|
||||
void
|
||||
>::type
|
||||
swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
|
||||
_NOEXCEPT_((__is_nothrow_swappable<_T1>::value &&
|
||||
__is_nothrow_swappable<_T2>::value))
|
||||
{
|
||||
swap(__x.first, __y.first);
|
||||
swap(__x.second, __y.second);
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -360,7 +440,7 @@ pair<typename __make_pair_return<_T1>::type, typename __make_pair_return<_T2>::t
|
||||
make_pair(_T1&& __t1, _T2&& __t2)
|
||||
{
|
||||
return pair<typename __make_pair_return<_T1>::type, typename __make_pair_return<_T2>::type>
|
||||
(_STD::forward<_T1>(__t1), _STD::forward<_T2>(__t2));
|
||||
(_VSTD::forward<_T1>(__t1), _VSTD::forward<_T2>(__t2));
|
||||
}
|
||||
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -422,13 +502,13 @@ struct __get_pair<0>
|
||||
static
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_T1&
|
||||
get(pair<_T1, _T2>& __p) {return __p.first;}
|
||||
get(pair<_T1, _T2>& __p) _NOEXCEPT {return __p.first;}
|
||||
|
||||
template <class _T1, class _T2>
|
||||
static
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const _T1&
|
||||
get(const pair<_T1, _T2>& __p) {return __p.first;}
|
||||
get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.first;}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
@@ -436,7 +516,7 @@ struct __get_pair<0>
|
||||
static
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_T1&&
|
||||
get(pair<_T1, _T2>&& __p) {return _STD::forward<_T1>(__p.first);}
|
||||
get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<_T1>(__p.first);}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
};
|
||||
@@ -448,13 +528,13 @@ struct __get_pair<1>
|
||||
static
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_T2&
|
||||
get(pair<_T1, _T2>& __p) {return __p.second;}
|
||||
get(pair<_T1, _T2>& __p) _NOEXCEPT {return __p.second;}
|
||||
|
||||
template <class _T1, class _T2>
|
||||
static
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const _T2&
|
||||
get(const pair<_T1, _T2>& __p) {return __p.second;}
|
||||
get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.second;}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
@@ -462,7 +542,7 @@ struct __get_pair<1>
|
||||
static
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_T2&&
|
||||
get(pair<_T1, _T2>&& __p) {return _STD::forward<_T2>(__p.second);}
|
||||
get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<_T2>(__p.second);}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
};
|
||||
@@ -470,7 +550,7 @@ struct __get_pair<1>
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
||||
get(pair<_T1, _T2>& __p)
|
||||
get(pair<_T1, _T2>& __p) _NOEXCEPT
|
||||
{
|
||||
return __get_pair<_Ip>::get(__p);
|
||||
}
|
||||
@@ -478,7 +558,7 @@ get(pair<_T1, _T2>& __p)
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
||||
get(const pair<_T1, _T2>& __p)
|
||||
get(const pair<_T1, _T2>& __p) _NOEXCEPT
|
||||
{
|
||||
return __get_pair<_Ip>::get(__p);
|
||||
}
|
||||
@@ -488,9 +568,9 @@ get(const pair<_T1, _T2>& __p)
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
|
||||
get(pair<_T1, _T2>&& __p)
|
||||
get(pair<_T1, _T2>&& __p) _NOEXCEPT
|
||||
{
|
||||
return __get_pair<_Ip>::get(_STD::move(__p));
|
||||
return __get_pair<_Ip>::get(_VSTD::move(__p));
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
@@ -817,6 +817,8 @@ public:
|
||||
valarray& operator=(const gslice_array<value_type>& __ga);
|
||||
valarray& operator=(const mask_array<value_type>& __ma);
|
||||
valarray& operator=(const indirect_array<value_type>& __ia);
|
||||
template <class _ValExpr>
|
||||
valarray& operator=(const __val_expr<_ValExpr>& __v);
|
||||
|
||||
// element access:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -2862,7 +2864,7 @@ valarray<_Tp>::operator=(const valarray& __v)
|
||||
{
|
||||
if (size() != __v.size())
|
||||
resize(__v.size());
|
||||
_STD::copy(__v.__begin_, __v.__end_, __begin_);
|
||||
_VSTD::copy(__v.__begin_, __v.__end_, __begin_);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -2889,7 +2891,7 @@ valarray<_Tp>::operator=(initializer_list<value_type> __il)
|
||||
{
|
||||
if (size() != __il.size())
|
||||
resize(__il.size());
|
||||
_STD::copy(__il.begin(), __il.end(), __begin_);
|
||||
_VSTD::copy(__il.begin(), __il.end(), __begin_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -2900,7 +2902,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
valarray<_Tp>&
|
||||
valarray<_Tp>::operator=(const value_type& __x)
|
||||
{
|
||||
_STD::fill(__begin_, __end_, __x);
|
||||
_VSTD::fill(__begin_, __end_, __x);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -2958,6 +2960,21 @@ valarray<_Tp>::operator=(const indirect_array<value_type>& __ia)
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
template <class _ValExpr>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
valarray<_Tp>&
|
||||
valarray<_Tp>::operator=(const __val_expr<_ValExpr>& __v)
|
||||
{
|
||||
size_t __n = __v.size();
|
||||
if (size() != __n)
|
||||
resize(__n);
|
||||
value_type* __t = __begin_;
|
||||
for (size_t __i = 0; __i != __n; ++__t, ++__i)
|
||||
*__t = result_type(__v[__i]);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__val_expr<__slice_expr<const valarray<_Tp>&> >
|
||||
@@ -3415,8 +3432,8 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
valarray<_Tp>::swap(valarray& __v)
|
||||
{
|
||||
_STD::swap(__begin_, __v.__begin_);
|
||||
_STD::swap(__end_, __v.__end_);
|
||||
_VSTD::swap(__begin_, __v.__begin_);
|
||||
_VSTD::swap(__end_, __v.__end_);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
@@ -3440,7 +3457,7 @@ valarray<_Tp>::min() const
|
||||
{
|
||||
if (__begin_ == __end_)
|
||||
return value_type();
|
||||
return *_STD::min_element(__begin_, __end_);
|
||||
return *_VSTD::min_element(__begin_, __end_);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
@@ -3450,7 +3467,7 @@ valarray<_Tp>::max() const
|
||||
{
|
||||
if (__begin_ == __end_)
|
||||
return value_type();
|
||||
return *_STD::max_element(__begin_, __end_);
|
||||
return *_VSTD::max_element(__begin_, __end_);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
@@ -3469,14 +3486,14 @@ valarray<_Tp>::shift(int __i) const
|
||||
value_type* __te;
|
||||
if (__i >= 0)
|
||||
{
|
||||
__i = _STD::min(__i, static_cast<int>(__n));
|
||||
__i = _VSTD::min(__i, static_cast<int>(__n));
|
||||
__sb = __begin_ + __i;
|
||||
__tb = __r.__begin_;
|
||||
__te = __r.__begin_ + (__n - __i);
|
||||
}
|
||||
else
|
||||
{
|
||||
__i = _STD::min(-__i, static_cast<int>(__n));
|
||||
__i = _VSTD::min(-__i, static_cast<int>(__n));
|
||||
__sb = __begin_;
|
||||
__tb = __r.__begin_ + __i;
|
||||
__te = __r.__begin_ + __n;
|
||||
|
||||
759
include/vector
759
include/vector
File diff suppressed because it is too large
Load Diff
58
lib/CMakeLists.txt
Normal file
58
lib/CMakeLists.txt
Normal file
@@ -0,0 +1,58 @@
|
||||
# Get sources
|
||||
file(GLOB_RECURSE sources ../src/*.cpp)
|
||||
|
||||
# Add all the headers to the project for IDEs.
|
||||
if (MSVC_IDE OR XCODE)
|
||||
file(GLOB_RECURSE headers ../include/*)
|
||||
# Force them all into the headers dir on MSVC, otherwise they end up at
|
||||
# project scope because they don't have extensions.
|
||||
if (MSVC_IDE)
|
||||
source_group("Header Files" FILES ${headers})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (LIBCXX_ENABLE_SHARED)
|
||||
add_library(cxx SHARED
|
||||
${sources}
|
||||
${headers}
|
||||
)
|
||||
else()
|
||||
add_library(cxx STATIC
|
||||
${sources}
|
||||
${headers}
|
||||
)
|
||||
endif()
|
||||
|
||||
# Generate library list.
|
||||
append_if(libraries LIBCXX_HAS_PTHREAD_LIB pthread)
|
||||
append_if(libraries LIBCXX_HAS_C_LIB c)
|
||||
append_if(libraries LIBCXX_HAS_M_LIB m)
|
||||
append_if(libraries LIBCXX_HAS_RT_LIB rt)
|
||||
append_if(libraries LIBCXX_HAS_GCC_S_LIB gcc_s)
|
||||
|
||||
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)
|
||||
|
||||
set_target_properties(cxx
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "${compile_flags}"
|
||||
LINK_FLAGS "${link_flags}"
|
||||
OUTPUT_NAME "c++"
|
||||
VERSION "1.0"
|
||||
SOVERSION "1"
|
||||
)
|
||||
|
||||
install(TARGETS cxx
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
)
|
||||
|
||||
install(DIRECTORY ../include/
|
||||
DESTINATION include/c++/v1
|
||||
FILES_MATCHING
|
||||
PATTERN "*"
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
53
lib/buildit
53
lib/buildit
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# Set the $TRIPLE environment variable to your system's triple before
|
||||
# running this script. If you set $CXX, that will be used to compile
|
||||
# the library. Otherwise we'll use g++.
|
||||
# the library. Otherwise we'll use clang++.
|
||||
|
||||
set -e
|
||||
|
||||
@@ -17,9 +17,17 @@ then
|
||||
CXX=clang++
|
||||
fi
|
||||
|
||||
if [ -z "$CC" ]
|
||||
then
|
||||
CC=clang
|
||||
fi
|
||||
|
||||
if [ -z $MACOSX_DEPLOYMENT_TARGET ]
|
||||
then
|
||||
MACOSX_DEPLOYMENT_TARGET=10.6
|
||||
if [ -z $IPHONEOS_DEPLOYMENT_TARGET ]
|
||||
then
|
||||
MACOSX_DEPLOYMENT_TARGET=10.6
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z $RC_ProjectSourceVersion ]
|
||||
@@ -27,30 +35,47 @@ then
|
||||
RC_ProjectSourceVersion=1
|
||||
fi
|
||||
|
||||
EXTRA_FLAGS="-std=c++0x "
|
||||
|
||||
case $TRIPLE in
|
||||
*-apple-*)
|
||||
if [ -z $RC_BUILDIT ]
|
||||
if [ -z $RC_XBS ]
|
||||
then
|
||||
RC_CFLAGS="-arch i386 -arch x86_64"
|
||||
fi
|
||||
SOEXT=dylib
|
||||
if [ "$MACOSX_DEPLOYMENT_TARGET" == "10.6" ]
|
||||
then
|
||||
EXTRA_FLAGS="-std=c++0x -U__STRICT_ANSI__"
|
||||
LDSHARED_FLAGS="-o libc++.1.dylib \
|
||||
-dynamiclib -nodefaultlibs -current_version 1 \
|
||||
-compatibility_version 1 \
|
||||
-install_name /usr/lib/libc++.dylib \
|
||||
-install_name /usr/lib/libc++.1.dylib \
|
||||
-Wl,-reexport_library,/usr/lib/libc++abi.dylib \
|
||||
-Wl,-unexported_symbols_list,libc++unexp.exp \
|
||||
/usr/lib/libSystem.B.dylib"
|
||||
else
|
||||
LDSHARED_FLAGS="-o libc++.1.dylib \
|
||||
RE_EXPORT_LINE="/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,libc++abi.exp"
|
||||
if [ -n "$SDKROOT" ]
|
||||
then
|
||||
EXTRA_FLAGS+="-isysroot ${SDKROOT}"
|
||||
if echo "${RC_ARCHS}" | grep -q "armv7"
|
||||
then
|
||||
RE_EXPORT_LINE="${SDKROOT}/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,libc++sjlj-abi.exp"
|
||||
else
|
||||
RE_EXPORT_LINE="-Wl,-reexport_library,${SDKROOT}/usr/lib/libc++abi.dylib"
|
||||
fi
|
||||
CXX=`xcrun -sdk "${SDKROOT}" -find clang++`
|
||||
CC=`xcrun -sdk "${SDKROOT}" -find clang`
|
||||
fi
|
||||
LDSHARED_FLAGS="-o libc++.1.dylib \
|
||||
-dynamiclib -nodefaultlibs \
|
||||
-current_version ${RC_ProjectSourceVersion} -compatibility_version 1 \
|
||||
-install_name /usr/lib/libc++.dylib \
|
||||
${SDKROOT}/usr/lib/libc++abi.dylib \
|
||||
-install_name /usr/lib/libc++.1.dylib \
|
||||
-lSystem \
|
||||
-Wl,-reexported_symbols_list,libc++abi.exp \
|
||||
-Wl,-force_symbols_not_weak_list,notweak.exp"
|
||||
-Wl,-unexported_symbols_list,libc++unexp.exp \
|
||||
${RE_EXPORT_LINE} \
|
||||
-Wl,-force_symbols_not_weak_list,notweak.exp "
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
@@ -58,11 +83,11 @@ case $TRIPLE in
|
||||
SOEXT=so
|
||||
LDSHARED_FLAGS="-o libc++.so.1.0 \
|
||||
-shared -nodefaultlibs -Wl,-soname,libc++.so.1 \
|
||||
-lpthread -lrt -lc"
|
||||
-lpthread -lrt -lc -lstdc++"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z $RC_BUILDIT ]
|
||||
if [ -z $RC_XBS ]
|
||||
then
|
||||
rm -f libc++.1.$SOEXT*
|
||||
fi
|
||||
@@ -70,15 +95,15 @@ fi
|
||||
set -x
|
||||
|
||||
for FILE in ../src/*.cpp; do
|
||||
$CXX -c -g -Os $RC_CFLAGS -nostdinc++ -I../include $FILE
|
||||
$CXX -c -g -Os $RC_CFLAGS $EXTRA_FLAGS -nostdinc++ -I../include $FILE
|
||||
done
|
||||
|
||||
|
||||
cc *.o $RC_CFLAGS $LDSHARED_FLAGS
|
||||
$CC *.o $RC_CFLAGS $LDSHARED_FLAGS $EXTRA_FLAGS
|
||||
|
||||
#libtool -static -o libc++.a *.o
|
||||
|
||||
if [ -z $RC_BUILDIT ]
|
||||
if [ -z $RC_XBS ]
|
||||
then
|
||||
rm *.o
|
||||
fi
|
||||
|
||||
159
lib/libc++sjlj-abi.exp
Normal file
159
lib/libc++sjlj-abi.exp
Normal file
@@ -0,0 +1,159 @@
|
||||
___cxa_allocate_exception
|
||||
___cxa_end_catch
|
||||
___cxa_demangle
|
||||
___cxa_current_exception_type
|
||||
___cxa_call_unexpected
|
||||
___cxa_free_exception
|
||||
___cxa_get_exception_ptr
|
||||
___cxa_get_globals
|
||||
___cxa_get_globals_fast
|
||||
___cxa_guard_abort
|
||||
___cxa_guard_acquire
|
||||
___cxa_guard_release
|
||||
___cxa_rethrow
|
||||
___cxa_pure_virtual
|
||||
___cxa_begin_catch
|
||||
___cxa_throw
|
||||
___cxa_vec_cctor
|
||||
___cxa_vec_cleanup
|
||||
___cxa_vec_ctor
|
||||
___cxa_vec_delete
|
||||
___cxa_vec_delete2
|
||||
___cxa_vec_delete3
|
||||
___cxa_vec_dtor
|
||||
___cxa_vec_new
|
||||
___cxa_vec_new2
|
||||
___cxa_vec_new3
|
||||
___dynamic_cast
|
||||
___gxx_personality_sj0
|
||||
__ZTIDi
|
||||
__ZTIDn
|
||||
__ZTIDs
|
||||
__ZTIPDi
|
||||
__ZTIPDn
|
||||
__ZTIPDs
|
||||
__ZTIPKDi
|
||||
__ZTIPKDn
|
||||
__ZTIPKDs
|
||||
__ZTSPm
|
||||
__ZTSPl
|
||||
__ZTSPj
|
||||
__ZTSPi
|
||||
__ZTSPh
|
||||
__ZTSPf
|
||||
__ZTSPe
|
||||
__ZTSPd
|
||||
__ZTSPc
|
||||
__ZTSPb
|
||||
__ZTSPa
|
||||
__ZTSPKc
|
||||
__ZTSPKy
|
||||
__ZTSPKx
|
||||
__ZTSPKw
|
||||
__ZTSPKv
|
||||
__ZTSPKt
|
||||
__ZTSPKs
|
||||
__ZTSPKm
|
||||
__ZTSPKl
|
||||
__ZTSPKi
|
||||
__ZTSPKh
|
||||
__ZTSPs
|
||||
__ZTSPt
|
||||
__ZTSPv
|
||||
__ZTSPw
|
||||
__ZTSPKa
|
||||
__ZTSPx
|
||||
__ZTSPy
|
||||
__ZTSPKd
|
||||
__ZTSPKe
|
||||
__ZTSPKj
|
||||
__ZTSPKb
|
||||
__ZTSPKf
|
||||
__ZTSv
|
||||
__ZTSt
|
||||
__ZTSs
|
||||
__ZTSm
|
||||
__ZTSl
|
||||
__ZTSj
|
||||
__ZTSi
|
||||
__ZTSh
|
||||
__ZTSf
|
||||
__ZTSe
|
||||
__ZTSd
|
||||
__ZTSc
|
||||
__ZTSw
|
||||
__ZTSx
|
||||
__ZTSy
|
||||
__ZTSb
|
||||
__ZTSa
|
||||
__ZTIPKh
|
||||
__ZTIPKf
|
||||
__ZTIPKe
|
||||
__ZTIPKd
|
||||
__ZTIPKc
|
||||
__ZTIPKb
|
||||
__ZTIPKa
|
||||
__ZTIPy
|
||||
__ZTIPx
|
||||
__ZTIPw
|
||||
__ZTIPv
|
||||
__ZTIPt
|
||||
__ZTIPs
|
||||
__ZTIPm
|
||||
__ZTIPl
|
||||
__ZTIPj
|
||||
__ZTIPi
|
||||
__ZTIPKi
|
||||
__ZTIPKj
|
||||
__ZTIPKl
|
||||
__ZTIPKm
|
||||
__ZTIPKs
|
||||
__ZTIPKt
|
||||
__ZTIPKv
|
||||
__ZTIPKw
|
||||
__ZTIPKx
|
||||
__ZTIPKy
|
||||
__ZTIPa
|
||||
__ZTIPb
|
||||
__ZTIPc
|
||||
__ZTIPd
|
||||
__ZTIPe
|
||||
__ZTIPf
|
||||
__ZTIPh
|
||||
__ZTVN10__cxxabiv129__pointer_to_member_type_infoE
|
||||
__ZTVN10__cxxabiv116__enum_type_infoE
|
||||
__ZTVN10__cxxabiv117__array_type_infoE
|
||||
__ZTVN10__cxxabiv117__class_type_infoE
|
||||
__ZTVN10__cxxabiv117__pbase_type_infoE
|
||||
__ZTVN10__cxxabiv119__pointer_type_infoE
|
||||
__ZTVN10__cxxabiv120__function_type_infoE
|
||||
__ZTVN10__cxxabiv120__si_class_type_infoE
|
||||
__ZTVN10__cxxabiv121__vmi_class_type_infoE
|
||||
__ZTVN10__cxxabiv123__fundamental_type_infoE
|
||||
__ZTIa
|
||||
__ZTIb
|
||||
__ZTIc
|
||||
__ZTId
|
||||
__ZTIe
|
||||
__ZTIf
|
||||
__ZTIh
|
||||
__ZTIi
|
||||
__ZTIj
|
||||
__ZTIl
|
||||
__ZTIm
|
||||
__ZTIs
|
||||
__ZTIt
|
||||
__ZTSN10__cxxabiv129__pointer_to_member_type_infoE
|
||||
__ZTSN10__cxxabiv123__fundamental_type_infoE
|
||||
__ZTSN10__cxxabiv121__vmi_class_type_infoE
|
||||
__ZTSN10__cxxabiv120__si_class_type_infoE
|
||||
__ZTSN10__cxxabiv120__function_type_infoE
|
||||
__ZTSN10__cxxabiv119__pointer_type_infoE
|
||||
__ZTSN10__cxxabiv117__pbase_type_infoE
|
||||
__ZTSN10__cxxabiv117__class_type_infoE
|
||||
__ZTSN10__cxxabiv117__array_type_infoE
|
||||
__ZTSN10__cxxabiv116__enum_type_infoE
|
||||
__ZTIy
|
||||
__ZTIx
|
||||
__ZTIw
|
||||
__ZTIv
|
||||
19
lib/libc++unexp.exp
Normal file
19
lib/libc++unexp.exp
Normal file
@@ -0,0 +1,19 @@
|
||||
# all guard variables
|
||||
__ZGVNSt3__*
|
||||
# all vtables
|
||||
# __ZTV*
|
||||
# all VTT
|
||||
# __ZTT*
|
||||
# all non-virtual thunks
|
||||
# __ZTh*
|
||||
# all virtual thunks
|
||||
# __ZTv*
|
||||
# typeinfo for std::__1::__types
|
||||
# There are no std::__types
|
||||
# __ZTINSt3__1[0-9][0-9]*__*
|
||||
# typeinfo name for std::__1::__types
|
||||
__ZTSNSt3__1[0-9][0-9]*__*
|
||||
# anything using __hidden_allocator
|
||||
*__hidden_allocator*
|
||||
# anything using __sso_allocator
|
||||
*__sso_allocator*
|
||||
@@ -25,7 +25,7 @@ namespace chrono
|
||||
// system_clock
|
||||
|
||||
system_clock::time_point
|
||||
system_clock::now()
|
||||
system_clock::now() _NOEXCEPT
|
||||
{
|
||||
timeval tv;
|
||||
gettimeofday(&tv, 0);
|
||||
@@ -33,13 +33,13 @@ system_clock::now()
|
||||
}
|
||||
|
||||
time_t
|
||||
system_clock::to_time_t(const time_point& t)
|
||||
system_clock::to_time_t(const time_point& t) _NOEXCEPT
|
||||
{
|
||||
return time_t(duration_cast<seconds>(t.time_since_epoch()).count());
|
||||
}
|
||||
|
||||
system_clock::time_point
|
||||
system_clock::from_time_t(time_t t)
|
||||
system_clock::from_time_t(time_t t) _NOEXCEPT
|
||||
{
|
||||
return system_clock::time_point(seconds(t));
|
||||
}
|
||||
@@ -97,7 +97,7 @@ init_steady_clock()
|
||||
#pragma GCC visibility pop
|
||||
|
||||
steady_clock::time_point
|
||||
steady_clock::now()
|
||||
steady_clock::now() _NOEXCEPT
|
||||
{
|
||||
static FP fp = init_steady_clock();
|
||||
return time_point(duration(fp()));
|
||||
@@ -114,7 +114,7 @@ steady_clock::now()
|
||||
// instead.
|
||||
|
||||
steady_clock::time_point
|
||||
steady_clock::now()
|
||||
steady_clock::now() _NOEXCEPT
|
||||
{
|
||||
struct timespec tp;
|
||||
if (0 != clock_gettime(CLOCK_MONOTONIC, &tp))
|
||||
|
||||
@@ -24,45 +24,47 @@
|
||||
#endif // __APPLE__
|
||||
|
||||
std::unexpected_handler
|
||||
std::set_unexpected(std::unexpected_handler func) throw()
|
||||
std::set_unexpected(std::unexpected_handler func) _NOEXCEPT
|
||||
{
|
||||
return __sync_lock_test_and_set(&__unexpected_handler, func);
|
||||
}
|
||||
|
||||
std::unexpected_handler
|
||||
std::get_unexpected() throw()
|
||||
std::get_unexpected() _NOEXCEPT
|
||||
{
|
||||
return __sync_fetch_and_add(&__unexpected_handler, (std::unexpected_handler)0);
|
||||
}
|
||||
|
||||
_ATTRIBUTE(noreturn)
|
||||
void
|
||||
std::unexpected()
|
||||
{
|
||||
(*__unexpected_handler)();
|
||||
(*std::get_unexpected())();
|
||||
// unexpected handler should not return
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
std::terminate_handler
|
||||
std::set_terminate(std::terminate_handler func) throw()
|
||||
std::set_terminate(std::terminate_handler func) _NOEXCEPT
|
||||
{
|
||||
return __sync_lock_test_and_set(&__terminate_handler, func);
|
||||
}
|
||||
|
||||
std::terminate_handler
|
||||
std::get_terminate() throw()
|
||||
std::get_terminate() _NOEXCEPT
|
||||
{
|
||||
return __sync_fetch_and_add(&__terminate_handler, (std::terminate_handler)0);
|
||||
}
|
||||
|
||||
_ATTRIBUTE(noreturn)
|
||||
void
|
||||
std::terminate()
|
||||
std::terminate() _NOEXCEPT
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
(*__terminate_handler)();
|
||||
(*std::get_terminate())();
|
||||
// handler should not return
|
||||
::abort ();
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -75,7 +77,7 @@ std::terminate()
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
|
||||
bool std::uncaught_exception() throw()
|
||||
bool std::uncaught_exception() _NOEXCEPT
|
||||
{
|
||||
#if __APPLE__
|
||||
// on Darwin, there is a helper function so __cxa_get_globals is private
|
||||
@@ -92,25 +94,25 @@ bool std::uncaught_exception() throw()
|
||||
namespace std
|
||||
{
|
||||
|
||||
exception::~exception() throw()
|
||||
exception::~exception() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
bad_exception::~bad_exception() throw()
|
||||
bad_exception::~bad_exception() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
const char* exception::what() const throw()
|
||||
const char* exception::what() const _NOEXCEPT
|
||||
{
|
||||
return "std::exception";
|
||||
}
|
||||
|
||||
const char* bad_exception::what() const throw()
|
||||
const char* bad_exception::what() const _NOEXCEPT
|
||||
{
|
||||
return "std::bad_exception";
|
||||
}
|
||||
|
||||
exception_ptr::~exception_ptr()
|
||||
exception_ptr::~exception_ptr() _NOEXCEPT
|
||||
{
|
||||
#if __APPLE__
|
||||
__cxxabiapple::__cxa_decrement_exception_refcount(__ptr_);
|
||||
@@ -120,7 +122,7 @@ exception_ptr::~exception_ptr()
|
||||
#endif // __APPLE__
|
||||
}
|
||||
|
||||
exception_ptr::exception_ptr(const exception_ptr& other)
|
||||
exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT
|
||||
: __ptr_(other.__ptr_)
|
||||
{
|
||||
#if __APPLE__
|
||||
@@ -131,7 +133,7 @@ exception_ptr::exception_ptr(const exception_ptr& other)
|
||||
#endif // __APPLE__
|
||||
}
|
||||
|
||||
exception_ptr& exception_ptr::operator=(const exception_ptr& other)
|
||||
exception_ptr& exception_ptr::operator=(const exception_ptr& other) _NOEXCEPT
|
||||
{
|
||||
#if __APPLE__
|
||||
if (__ptr_ != other.__ptr_)
|
||||
@@ -147,17 +149,18 @@ exception_ptr& exception_ptr::operator=(const exception_ptr& other)
|
||||
#endif // __APPLE__
|
||||
}
|
||||
|
||||
nested_exception::nested_exception()
|
||||
nested_exception::nested_exception() _NOEXCEPT
|
||||
: __ptr_(current_exception())
|
||||
{
|
||||
}
|
||||
|
||||
nested_exception::~nested_exception()
|
||||
nested_exception::~nested_exception() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
_ATTRIBUTE(noreturn)
|
||||
void
|
||||
nested_exception::rethrow_nested /*[[noreturn]]*/ () const
|
||||
nested_exception::rethrow_nested() const
|
||||
{
|
||||
if (__ptr_ == nullptr)
|
||||
terminate();
|
||||
@@ -166,7 +169,7 @@ nested_exception::rethrow_nested /*[[noreturn]]*/ () const
|
||||
|
||||
} // std
|
||||
|
||||
std::exception_ptr std::current_exception()
|
||||
std::exception_ptr std::current_exception() _NOEXCEPT
|
||||
{
|
||||
#if __APPLE__
|
||||
// be nicer if there was a constructor that took a ptr, then
|
||||
|
||||
@@ -16,12 +16,12 @@ class _LIBCPP_HIDDEN __future_error_category
|
||||
: public __do_message
|
||||
{
|
||||
public:
|
||||
virtual const char* name() const;
|
||||
virtual const char* name() const _NOEXCEPT;
|
||||
virtual string message(int ev) const;
|
||||
};
|
||||
|
||||
const char*
|
||||
__future_error_category::name() const
|
||||
__future_error_category::name() const _NOEXCEPT
|
||||
{
|
||||
return "future";
|
||||
}
|
||||
@@ -59,8 +59,12 @@ future_error::future_error(error_code __ec)
|
||||
{
|
||||
}
|
||||
|
||||
future_error::~future_error() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
__assoc_sub_state::__on_zero_shared()
|
||||
__assoc_sub_state::__on_zero_shared() _NOEXCEPT
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
@@ -69,8 +73,10 @@ void
|
||||
__assoc_sub_state::set_value()
|
||||
{
|
||||
unique_lock<mutex> __lk(__mut_);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__has_value())
|
||||
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
||||
#endif
|
||||
__state_ |= __constructed | ready;
|
||||
__lk.unlock();
|
||||
__cv_.notify_all();
|
||||
@@ -80,8 +86,10 @@ void
|
||||
__assoc_sub_state::set_value_at_thread_exit()
|
||||
{
|
||||
unique_lock<mutex> __lk(__mut_);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__has_value())
|
||||
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
||||
#endif
|
||||
__state_ |= __constructed;
|
||||
__thread_local_data()->__make_ready_at_thread_exit(this);
|
||||
__lk.unlock();
|
||||
@@ -91,8 +99,10 @@ void
|
||||
__assoc_sub_state::set_exception(exception_ptr __p)
|
||||
{
|
||||
unique_lock<mutex> __lk(__mut_);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__has_value())
|
||||
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
||||
#endif
|
||||
__exception_ = __p;
|
||||
__state_ |= ready;
|
||||
__lk.unlock();
|
||||
@@ -103,8 +113,10 @@ void
|
||||
__assoc_sub_state::set_exception_at_thread_exit(exception_ptr __p)
|
||||
{
|
||||
unique_lock<mutex> __lk(__mut_);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__has_value())
|
||||
throw future_error(make_error_code(future_errc::promise_already_satisfied));
|
||||
#endif
|
||||
__exception_ = __p;
|
||||
__thread_local_data()->__make_ready_at_thread_exit(this);
|
||||
__lk.unlock();
|
||||
@@ -155,14 +167,18 @@ __assoc_sub_state::__sub_wait(unique_lock<mutex>& __lk)
|
||||
void
|
||||
__assoc_sub_state::__execute()
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
}
|
||||
|
||||
future<void>::future(__assoc_sub_state* __state)
|
||||
: __state_(__state)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_->__has_future_attached())
|
||||
throw future_error(make_error_code(future_errc::future_already_retrieved));
|
||||
#endif
|
||||
__state_->__add_shared();
|
||||
__state_->__set_future_attached();
|
||||
}
|
||||
@@ -202,40 +218,50 @@ promise<void>::~promise()
|
||||
future<void>
|
||||
promise<void>::get_future()
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
return future<void>(__state_);
|
||||
}
|
||||
|
||||
void
|
||||
promise<void>::set_value()
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_value();
|
||||
}
|
||||
|
||||
void
|
||||
promise<void>::set_exception(exception_ptr __p)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_exception(__p);
|
||||
}
|
||||
|
||||
void
|
||||
promise<void>::set_value_at_thread_exit()
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_value_at_thread_exit();
|
||||
}
|
||||
|
||||
void
|
||||
promise<void>::set_exception_at_thread_exit(exception_ptr __p)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__state_ == nullptr)
|
||||
throw future_error(make_error_code(future_errc::no_state));
|
||||
#endif
|
||||
__state_->set_exception_at_thread_exit(__p);
|
||||
}
|
||||
|
||||
|
||||
42
src/ios.cpp
42
src/ios.cpp
@@ -38,12 +38,12 @@ class _LIBCPP_HIDDEN __iostream_category
|
||||
: public __do_message
|
||||
{
|
||||
public:
|
||||
virtual const char* name() const;
|
||||
virtual const char* name() const _NOEXCEPT;
|
||||
virtual string message(int ev) const;
|
||||
};
|
||||
|
||||
const char*
|
||||
__iostream_category::name() const
|
||||
__iostream_category::name() const _NOEXCEPT
|
||||
{
|
||||
return "iostream";
|
||||
}
|
||||
@@ -165,7 +165,7 @@ ios_base::iword(int index)
|
||||
size_t newcap;
|
||||
const size_t mx = std::numeric_limits<size_t>::max();
|
||||
if (req_size < mx/2)
|
||||
newcap = max(2 * __iarray_cap_, req_size);
|
||||
newcap = _VSTD::max(2 * __iarray_cap_, req_size);
|
||||
else
|
||||
newcap = mx;
|
||||
long* iarray = (long*)realloc(__iarray_, newcap * sizeof(long));
|
||||
@@ -193,7 +193,7 @@ ios_base::pword(int index)
|
||||
size_t newcap;
|
||||
const size_t mx = std::numeric_limits<size_t>::max();
|
||||
if (req_size < mx/2)
|
||||
newcap = max(2 * __parray_cap_, req_size);
|
||||
newcap = _VSTD::max(2 * __parray_cap_, req_size);
|
||||
else
|
||||
newcap = mx;
|
||||
void** parray = (void**)realloc(__parray_, newcap * sizeof(void*));
|
||||
@@ -223,7 +223,7 @@ ios_base::register_callback(event_callback fn, int index)
|
||||
size_t newcap;
|
||||
const size_t mx = std::numeric_limits<size_t>::max();
|
||||
if (req_size < mx/2)
|
||||
newcap = max(2 * __event_cap_, req_size);
|
||||
newcap = _VSTD::max(2 * __event_cap_, req_size);
|
||||
else
|
||||
newcap = mx;
|
||||
event_callback* fns = (event_callback*)realloc(__fn_, newcap * sizeof(event_callback));
|
||||
@@ -403,24 +403,24 @@ ios_base::move(ios_base& rhs)
|
||||
void
|
||||
ios_base::swap(ios_base& rhs)
|
||||
{
|
||||
_STD::swap(__fmtflags_, rhs.__fmtflags_);
|
||||
_STD::swap(__precision_, rhs.__precision_);
|
||||
_STD::swap(__width_, rhs.__width_);
|
||||
_STD::swap(__rdstate_, rhs.__rdstate_);
|
||||
_STD::swap(__exceptions_, rhs.__exceptions_);
|
||||
_VSTD::swap(__fmtflags_, rhs.__fmtflags_);
|
||||
_VSTD::swap(__precision_, rhs.__precision_);
|
||||
_VSTD::swap(__width_, rhs.__width_);
|
||||
_VSTD::swap(__rdstate_, rhs.__rdstate_);
|
||||
_VSTD::swap(__exceptions_, rhs.__exceptions_);
|
||||
locale& lhs_loc = *(locale*)&__loc_;
|
||||
locale& rhs_loc = *(locale*)&rhs.__loc_;
|
||||
_STD::swap(lhs_loc, rhs_loc);
|
||||
_STD::swap(__fn_, rhs.__fn_);
|
||||
_STD::swap(__index_, rhs.__index_);
|
||||
_STD::swap(__event_size_, rhs.__event_size_);
|
||||
_STD::swap(__event_cap_, rhs.__event_cap_);
|
||||
_STD::swap(__iarray_, rhs.__iarray_);
|
||||
_STD::swap(__iarray_size_, rhs.__iarray_size_);
|
||||
_STD::swap(__iarray_cap_, rhs.__iarray_cap_);
|
||||
_STD::swap(__parray_, rhs.__parray_);
|
||||
_STD::swap(__parray_size_, rhs.__parray_size_);
|
||||
_STD::swap(__parray_cap_, rhs.__parray_cap_);
|
||||
_VSTD::swap(lhs_loc, rhs_loc);
|
||||
_VSTD::swap(__fn_, rhs.__fn_);
|
||||
_VSTD::swap(__index_, rhs.__index_);
|
||||
_VSTD::swap(__event_size_, rhs.__event_size_);
|
||||
_VSTD::swap(__event_cap_, rhs.__event_cap_);
|
||||
_VSTD::swap(__iarray_, rhs.__iarray_);
|
||||
_VSTD::swap(__iarray_size_, rhs.__iarray_size_);
|
||||
_VSTD::swap(__iarray_cap_, rhs.__iarray_cap_);
|
||||
_VSTD::swap(__parray_, rhs.__parray_);
|
||||
_VSTD::swap(__parray_size_, rhs.__parray_size_);
|
||||
_VSTD::swap(__parray_cap_, rhs.__parray_cap_);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -33,11 +33,11 @@ ios_base::Init __start_std_streams;
|
||||
ios_base::Init::Init()
|
||||
{
|
||||
cin.tie(&cout);
|
||||
_STD::unitbuf(cerr);
|
||||
_VSTD::unitbuf(cerr);
|
||||
cerr.tie(&cout);
|
||||
|
||||
wcin.tie(&wcout);
|
||||
_STD::unitbuf(wcerr);
|
||||
_VSTD::unitbuf(wcerr);
|
||||
wcerr.tie(&wcout);
|
||||
}
|
||||
|
||||
|
||||
455
src/locale.cpp
455
src/locale.cpp
File diff suppressed because it is too large
Load Diff
@@ -16,14 +16,14 @@ namespace
|
||||
|
||||
template <class T>
|
||||
inline T
|
||||
increment(T& t)
|
||||
increment(T& t) _NOEXCEPT
|
||||
{
|
||||
return __sync_add_and_fetch(&t, 1);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T
|
||||
decrement(T& t)
|
||||
decrement(T& t) _NOEXCEPT
|
||||
{
|
||||
return __sync_add_and_fetch(&t, -1);
|
||||
}
|
||||
@@ -32,10 +32,10 @@ decrement(T& t)
|
||||
|
||||
const allocator_arg_t allocator_arg = allocator_arg_t();
|
||||
|
||||
bad_weak_ptr::~bad_weak_ptr() throw() {}
|
||||
bad_weak_ptr::~bad_weak_ptr() _NOEXCEPT {}
|
||||
|
||||
const char*
|
||||
bad_weak_ptr::what() const throw()
|
||||
bad_weak_ptr::what() const _NOEXCEPT
|
||||
{
|
||||
return "bad_weak_ptr";
|
||||
}
|
||||
@@ -45,13 +45,13 @@ __shared_count::~__shared_count()
|
||||
}
|
||||
|
||||
void
|
||||
__shared_count::__add_shared()
|
||||
__shared_count::__add_shared() _NOEXCEPT
|
||||
{
|
||||
increment(__shared_owners_);
|
||||
}
|
||||
|
||||
bool
|
||||
__shared_count::__release_shared()
|
||||
__shared_count::__release_shared() _NOEXCEPT
|
||||
{
|
||||
if (decrement(__shared_owners_) == -1)
|
||||
{
|
||||
@@ -66,33 +66,33 @@ __shared_weak_count::~__shared_weak_count()
|
||||
}
|
||||
|
||||
void
|
||||
__shared_weak_count::__add_shared()
|
||||
__shared_weak_count::__add_shared() _NOEXCEPT
|
||||
{
|
||||
__shared_count::__add_shared();
|
||||
}
|
||||
|
||||
void
|
||||
__shared_weak_count::__add_weak()
|
||||
__shared_weak_count::__add_weak() _NOEXCEPT
|
||||
{
|
||||
increment(__shared_weak_owners_);
|
||||
}
|
||||
|
||||
void
|
||||
__shared_weak_count::__release_shared()
|
||||
__shared_weak_count::__release_shared() _NOEXCEPT
|
||||
{
|
||||
if (__shared_count::__release_shared())
|
||||
__release_weak();
|
||||
}
|
||||
|
||||
void
|
||||
__shared_weak_count::__release_weak()
|
||||
__shared_weak_count::__release_weak() _NOEXCEPT
|
||||
{
|
||||
if (decrement(__shared_weak_owners_) == -1)
|
||||
__on_zero_shared_weak();
|
||||
}
|
||||
|
||||
__shared_weak_count*
|
||||
__shared_weak_count::lock()
|
||||
__shared_weak_count::lock() _NOEXCEPT
|
||||
{
|
||||
long object_owners = __shared_owners_;
|
||||
while (object_owners != -1)
|
||||
@@ -112,7 +112,7 @@ __shared_weak_count::lock()
|
||||
#ifndef _LIBCPP_NO_RTTI
|
||||
|
||||
const void*
|
||||
__shared_weak_count::__get_deleter(const type_info&) const
|
||||
__shared_weak_count::__get_deleter(const type_info&) const _NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ undeclare_no_pointers(char*, size_t)
|
||||
}
|
||||
|
||||
pointer_safety
|
||||
get_pointer_safety()
|
||||
get_pointer_safety() _NOEXCEPT
|
||||
{
|
||||
return pointer_safety::relaxed;
|
||||
}
|
||||
|
||||
43
src/new.cpp
43
src/new.cpp
@@ -27,7 +27,10 @@
|
||||
|
||||
__attribute__((__weak__, __visibility__("default")))
|
||||
void *
|
||||
operator new(std::size_t size) throw (std::bad_alloc)
|
||||
operator new(std::size_t size)
|
||||
#if !__has_feature(cxx_noexcept)
|
||||
throw(std::bad_alloc)
|
||||
#endif
|
||||
{
|
||||
if (size == 0)
|
||||
size = 1;
|
||||
@@ -36,8 +39,9 @@ operator new(std::size_t size) throw (std::bad_alloc)
|
||||
{
|
||||
// If malloc fails and there is a new_handler,
|
||||
// call it to try free up memory.
|
||||
if (__new_handler)
|
||||
__new_handler();
|
||||
std::new_handler nh = std::get_new_handler();
|
||||
if (nh)
|
||||
nh();
|
||||
else
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw std::bad_alloc();
|
||||
@@ -50,7 +54,7 @@ operator new(std::size_t size) throw (std::bad_alloc)
|
||||
|
||||
__attribute__((__weak__, __visibility__("default")))
|
||||
void*
|
||||
operator new(size_t size, const std::nothrow_t&) throw()
|
||||
operator new(size_t size, const std::nothrow_t&) _NOEXCEPT
|
||||
{
|
||||
void* p = 0;
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -69,14 +73,17 @@ operator new(size_t size, const std::nothrow_t&) throw()
|
||||
|
||||
__attribute__((__weak__, __visibility__("default")))
|
||||
void*
|
||||
operator new[](size_t size) throw (std::bad_alloc)
|
||||
operator new[](size_t size)
|
||||
#if !__has_feature(cxx_noexcept)
|
||||
throw(std::bad_alloc)
|
||||
#endif
|
||||
{
|
||||
return ::operator new(size);
|
||||
}
|
||||
|
||||
__attribute__((__weak__, __visibility__("default")))
|
||||
void*
|
||||
operator new[](size_t size, const std::nothrow_t& nothrow) throw()
|
||||
operator new[](size_t size, const std::nothrow_t& nothrow) _NOEXCEPT
|
||||
{
|
||||
void* p = 0;
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -95,7 +102,7 @@ operator new[](size_t size, const std::nothrow_t& nothrow) throw()
|
||||
|
||||
__attribute__((__weak__, __visibility__("default")))
|
||||
void
|
||||
operator delete(void* ptr) throw ()
|
||||
operator delete(void* ptr) _NOEXCEPT
|
||||
{
|
||||
if (ptr)
|
||||
::free(ptr);
|
||||
@@ -103,21 +110,21 @@ operator delete(void* ptr) throw ()
|
||||
|
||||
__attribute__((__weak__, __visibility__("default")))
|
||||
void
|
||||
operator delete(void* ptr, const std::nothrow_t&) throw ()
|
||||
operator delete(void* ptr, const std::nothrow_t&) _NOEXCEPT
|
||||
{
|
||||
::operator delete(ptr);
|
||||
}
|
||||
|
||||
__attribute__((__weak__, __visibility__("default")))
|
||||
void
|
||||
operator delete[] (void* ptr) throw ()
|
||||
operator delete[] (void* ptr) _NOEXCEPT
|
||||
{
|
||||
::operator delete (ptr);
|
||||
}
|
||||
|
||||
__attribute__((__weak__, __visibility__("default")))
|
||||
void
|
||||
operator delete[] (void* ptr, const std::nothrow_t&) throw ()
|
||||
operator delete[] (void* ptr, const std::nothrow_t&) _NOEXCEPT
|
||||
{
|
||||
::operator delete[](ptr);
|
||||
}
|
||||
@@ -128,41 +135,41 @@ namespace std
|
||||
const nothrow_t nothrow = {};
|
||||
|
||||
new_handler
|
||||
set_new_handler(new_handler handler) throw()
|
||||
set_new_handler(new_handler handler) _NOEXCEPT
|
||||
{
|
||||
return __sync_lock_test_and_set(&__new_handler, handler);
|
||||
}
|
||||
|
||||
new_handler
|
||||
get_new_handler() throw()
|
||||
get_new_handler() _NOEXCEPT
|
||||
{
|
||||
return __sync_fetch_and_add(&__new_handler, (new_handler)0);
|
||||
}
|
||||
|
||||
bad_alloc::bad_alloc() throw()
|
||||
bad_alloc::bad_alloc() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
bad_alloc::~bad_alloc() throw()
|
||||
bad_alloc::~bad_alloc() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
const char*
|
||||
bad_alloc::what() const throw()
|
||||
bad_alloc::what() const _NOEXCEPT
|
||||
{
|
||||
return "std::bad_alloc";
|
||||
}
|
||||
|
||||
bad_array_new_length::bad_array_new_length() throw()
|
||||
bad_array_new_length::bad_array_new_length() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
bad_array_new_length::~bad_array_new_length() throw()
|
||||
bad_array_new_length::~bad_array_new_length() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
const char*
|
||||
bad_array_new_length::what() const throw()
|
||||
bad_array_new_length::what() const _NOEXCEPT
|
||||
{
|
||||
return "bad_array_new_length";
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ string
|
||||
__get_collation_name(const char* s)
|
||||
{
|
||||
const collationnames* i =
|
||||
lower_bound(begin(collatenames), end(collatenames), s, use_strcmp());
|
||||
_VSTD::lower_bound(begin(collatenames), end(collatenames), s, use_strcmp());
|
||||
string r;
|
||||
if (i != end(collatenames) && strcmp(s, i->elem_) == 0)
|
||||
r = char(i->char_);
|
||||
@@ -240,7 +240,7 @@ ctype_base::mask
|
||||
__get_classname(const char* s, bool __icase)
|
||||
{
|
||||
const classnames* i =
|
||||
lower_bound(begin(ClassNames), end(ClassNames), s, use_strcmp());
|
||||
_VSTD::lower_bound(begin(ClassNames), end(ClassNames), s, use_strcmp());
|
||||
ctype_base::mask r = 0;
|
||||
if (i != end(ClassNames) && strcmp(s, i->elem_) == 0)
|
||||
{
|
||||
|
||||
@@ -34,13 +34,13 @@ private:
|
||||
static const std::ptrdiff_t offset = static_cast<std::ptrdiff_t>(2*sizeof(unused_t) +
|
||||
sizeof(count_t));
|
||||
|
||||
count_t& count() const throw() {return (count_t&)(*(str_ - sizeof(count_t)));}
|
||||
count_t& count() const _NOEXCEPT {return (count_t&)(*(str_ - sizeof(count_t)));}
|
||||
public:
|
||||
explicit __libcpp_nmstr(const char* msg);
|
||||
__libcpp_nmstr(const __libcpp_nmstr& s) _LIBCPP_CANTTHROW;
|
||||
__libcpp_nmstr& operator=(const __libcpp_nmstr& s) _LIBCPP_CANTTHROW;
|
||||
~__libcpp_nmstr() _LIBCPP_CANTTHROW;
|
||||
const char* c_str() const throw() {return str_;}
|
||||
const char* c_str() const _NOEXCEPT {return str_;}
|
||||
};
|
||||
|
||||
__libcpp_nmstr::__libcpp_nmstr(const char* msg)
|
||||
@@ -98,14 +98,14 @@ logic_error::logic_error(const char* msg)
|
||||
::new(&s) __libcpp_nmstr(msg);
|
||||
}
|
||||
|
||||
logic_error::logic_error(const logic_error& le) throw()
|
||||
logic_error::logic_error(const logic_error& le) _NOEXCEPT
|
||||
{
|
||||
__libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
|
||||
::new(&s) __libcpp_nmstr((const __libcpp_nmstr&)le.__imp_);
|
||||
}
|
||||
|
||||
logic_error&
|
||||
logic_error::operator=(const logic_error& le) throw()
|
||||
logic_error::operator=(const logic_error& le) _NOEXCEPT
|
||||
{
|
||||
__libcpp_nmstr& s1 = (__libcpp_nmstr&)__imp_;
|
||||
const __libcpp_nmstr& s2 = (const __libcpp_nmstr&)le.__imp_;
|
||||
@@ -113,14 +113,14 @@ logic_error::operator=(const logic_error& le) throw()
|
||||
return *this;
|
||||
}
|
||||
|
||||
logic_error::~logic_error() throw()
|
||||
logic_error::~logic_error() _NOEXCEPT
|
||||
{
|
||||
__libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
|
||||
s.~__libcpp_nmstr();
|
||||
}
|
||||
|
||||
const char*
|
||||
logic_error::what() const throw()
|
||||
logic_error::what() const _NOEXCEPT
|
||||
{
|
||||
__libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
|
||||
return s.c_str();
|
||||
@@ -138,14 +138,14 @@ runtime_error::runtime_error(const char* msg)
|
||||
::new(&s) __libcpp_nmstr(msg);
|
||||
}
|
||||
|
||||
runtime_error::runtime_error(const runtime_error& le) throw()
|
||||
runtime_error::runtime_error(const runtime_error& le) _NOEXCEPT
|
||||
{
|
||||
__libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
|
||||
::new(&s) __libcpp_nmstr((const __libcpp_nmstr&)le.__imp_);
|
||||
}
|
||||
|
||||
runtime_error&
|
||||
runtime_error::operator=(const runtime_error& le) throw()
|
||||
runtime_error::operator=(const runtime_error& le) _NOEXCEPT
|
||||
{
|
||||
__libcpp_nmstr& s1 = (__libcpp_nmstr&)__imp_;
|
||||
const __libcpp_nmstr& s2 = (const __libcpp_nmstr&)le.__imp_;
|
||||
@@ -153,26 +153,26 @@ runtime_error::operator=(const runtime_error& le) throw()
|
||||
return *this;
|
||||
}
|
||||
|
||||
runtime_error::~runtime_error() throw()
|
||||
runtime_error::~runtime_error() _NOEXCEPT
|
||||
{
|
||||
__libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
|
||||
s.~__libcpp_nmstr();
|
||||
}
|
||||
|
||||
const char*
|
||||
runtime_error::what() const throw()
|
||||
runtime_error::what() const _NOEXCEPT
|
||||
{
|
||||
__libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
|
||||
return s.c_str();
|
||||
}
|
||||
|
||||
domain_error::~domain_error() throw() {}
|
||||
invalid_argument::~invalid_argument() throw() {}
|
||||
length_error::~length_error() throw() {}
|
||||
out_of_range::~out_of_range() throw() {}
|
||||
domain_error::~domain_error() _NOEXCEPT {}
|
||||
invalid_argument::~invalid_argument() _NOEXCEPT {}
|
||||
length_error::~length_error() _NOEXCEPT {}
|
||||
out_of_range::~out_of_range() _NOEXCEPT {}
|
||||
|
||||
range_error::~range_error() throw() {}
|
||||
overflow_error::~overflow_error() throw() {}
|
||||
underflow_error::~underflow_error() throw() {}
|
||||
range_error::~range_error() _NOEXCEPT {}
|
||||
overflow_error::~overflow_error() _NOEXCEPT {}
|
||||
underflow_error::~underflow_error() _NOEXCEPT {}
|
||||
|
||||
} // std
|
||||
|
||||
@@ -19,52 +19,6 @@ template class __basic_string_common<true>;
|
||||
template class basic_string<char>;
|
||||
template class basic_string<wchar_t>;
|
||||
|
||||
template enable_if<__is_forward_iterator<char const*>::value, void>::type
|
||||
basic_string<char, char_traits<char>, allocator<char> >
|
||||
::__init<char const*>(char const*, char const*);
|
||||
|
||||
template enable_if<__is_forward_iterator<wchar_t const*>::value, void>::type
|
||||
basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >
|
||||
::__init<wchar_t const*>(wchar_t const*, wchar_t const*);
|
||||
|
||||
template
|
||||
enable_if<__is_forward_iterator<char*>::value,
|
||||
basic_string<char, char_traits<char>, allocator<char> >&>::type
|
||||
basic_string<char, char_traits<char>, allocator<char> >::
|
||||
append<char*>(char*, char*);
|
||||
|
||||
template
|
||||
enable_if<__is_forward_iterator<wchar_t*>::value,
|
||||
basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&>::type
|
||||
basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >::
|
||||
append<wchar_t*>(wchar_t*, wchar_t*);
|
||||
|
||||
template
|
||||
enable_if<__is_forward_iterator<char const*>::value,
|
||||
string::iterator>::type
|
||||
string::
|
||||
insert<char const*>(string::const_iterator, char const*, char const*);
|
||||
|
||||
template
|
||||
enable_if<__is_forward_iterator<wchar_t const*>::value,
|
||||
wstring::iterator>::type
|
||||
wstring::
|
||||
insert<wchar_t const*>(wstring::const_iterator, wchar_t const*, wchar_t const*);
|
||||
|
||||
template
|
||||
enable_if<__is_input_iterator<char const*>::value, string&>::type
|
||||
string::
|
||||
replace<char const*>(string::const_iterator, string::const_iterator, char const*, char const*);
|
||||
|
||||
template
|
||||
enable_if<__is_input_iterator<wchar_t const*>::value, wstring&>::type
|
||||
wstring::
|
||||
replace<wchar_t const*>(wstring::const_iterator, wstring::const_iterator, wchar_t const*, wchar_t const*);
|
||||
|
||||
template
|
||||
enable_if<__is_forward_iterator<wchar_t*>::value, wstring&>::type
|
||||
wstring::assign<wchar_t*>(wchar_t*, wchar_t*);
|
||||
|
||||
template
|
||||
string
|
||||
operator+<char, char_traits<char>, allocator<char> >(char const*, string const&);
|
||||
|
||||
@@ -100,40 +100,6 @@ strstreambuf::strstreambuf(const unsigned char* __gnext, streamsize __n)
|
||||
__init((char*)__gnext, __n, nullptr);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
strstreambuf::strstreambuf(strstreambuf&& __rhs)
|
||||
: streambuf(__rhs),
|
||||
__strmode_(__rhs.__strmode_),
|
||||
__alsize_(__rhs.__alsize_),
|
||||
__palloc_(__rhs.__palloc_),
|
||||
__pfree_(__rhs.__pfree_)
|
||||
{
|
||||
__rhs.setg(nullptr, nullptr, nullptr);
|
||||
__rhs.setp(nullptr, nullptr);
|
||||
}
|
||||
|
||||
strstreambuf&
|
||||
strstreambuf::operator=(strstreambuf&& __rhs)
|
||||
{
|
||||
if (eback() && (__strmode_ & __allocated) != 0 && (__strmode_ & __frozen) == 0)
|
||||
{
|
||||
if (__pfree_)
|
||||
__pfree_(eback());
|
||||
else
|
||||
delete [] eback();
|
||||
}
|
||||
streambuf::operator=(__rhs);
|
||||
__strmode_ = __rhs.__strmode_;
|
||||
__alsize_ = __rhs.__alsize_;
|
||||
__palloc_ = __rhs.__palloc_;
|
||||
__pfree_ = __rhs.__pfree_;
|
||||
__rhs.setg(nullptr, nullptr, nullptr);
|
||||
__rhs.setp(nullptr, nullptr);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
strstreambuf::~strstreambuf()
|
||||
{
|
||||
if (eback() && (__strmode_ & __allocated) != 0 && (__strmode_ & __frozen) == 0)
|
||||
@@ -149,10 +115,10 @@ void
|
||||
strstreambuf::swap(strstreambuf& __rhs)
|
||||
{
|
||||
streambuf::swap(__rhs);
|
||||
_STD::swap(__strmode_, __rhs.__strmode_);
|
||||
_STD::swap(__alsize_, __rhs.__alsize_);
|
||||
_STD::swap(__palloc_, __rhs.__palloc_);
|
||||
_STD::swap(__pfree_, __rhs.__pfree_);
|
||||
_VSTD::swap(__strmode_, __rhs.__strmode_);
|
||||
_VSTD::swap(__alsize_, __rhs.__alsize_);
|
||||
_VSTD::swap(__palloc_, __rhs.__palloc_);
|
||||
_VSTD::swap(__pfree_, __rhs.__pfree_);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -301,7 +267,7 @@ strstreambuf::seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmod
|
||||
{
|
||||
char* newpos = eback() + newoff;
|
||||
if (pos_in)
|
||||
setg(eback(), newpos, max(newpos, egptr()));
|
||||
setg(eback(), newpos, _VSTD::max(newpos, egptr()));
|
||||
if (pos_out)
|
||||
{
|
||||
// min(pbase, newpos), newpos, epptr()
|
||||
@@ -331,7 +297,7 @@ strstreambuf::seekpos(pos_type __sp, ios_base::openmode __which)
|
||||
{
|
||||
char* newpos = eback() + newoff;
|
||||
if (pos_in)
|
||||
setg(eback(), newpos, max(newpos, egptr()));
|
||||
setg(eback(), newpos, _VSTD::max(newpos, egptr()));
|
||||
if (pos_out)
|
||||
{
|
||||
// min(pbase, newpos), newpos, epptr()
|
||||
|
||||
@@ -15,28 +15,28 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// class error_category
|
||||
|
||||
error_category::error_category()
|
||||
error_category::error_category() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
error_category::~error_category()
|
||||
error_category::~error_category() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
error_condition
|
||||
error_category::default_error_condition(int ev) const
|
||||
error_category::default_error_condition(int ev) const _NOEXCEPT
|
||||
{
|
||||
return error_condition(ev, *this);
|
||||
}
|
||||
|
||||
bool
|
||||
error_category::equivalent(int code, const error_condition& condition) const
|
||||
error_category::equivalent(int code, const error_condition& condition) const _NOEXCEPT
|
||||
{
|
||||
return default_error_condition(code) == condition;
|
||||
}
|
||||
|
||||
bool
|
||||
error_category::equivalent(const error_code& code, int condition) const
|
||||
error_category::equivalent(const error_code& code, int condition) const _NOEXCEPT
|
||||
{
|
||||
return *this == code.category() && code.value() == condition;
|
||||
}
|
||||
@@ -51,12 +51,12 @@ class _LIBCPP_HIDDEN __generic_error_category
|
||||
: public __do_message
|
||||
{
|
||||
public:
|
||||
virtual const char* name() const;
|
||||
virtual const char* name() const _NOEXCEPT;
|
||||
virtual string message(int ev) const;
|
||||
};
|
||||
|
||||
const char*
|
||||
__generic_error_category::name() const
|
||||
__generic_error_category::name() const _NOEXCEPT
|
||||
{
|
||||
return "generic";
|
||||
}
|
||||
@@ -72,7 +72,7 @@ __generic_error_category::message(int ev) const
|
||||
}
|
||||
|
||||
const error_category&
|
||||
generic_category()
|
||||
generic_category() _NOEXCEPT
|
||||
{
|
||||
static __generic_error_category s;
|
||||
return s;
|
||||
@@ -82,13 +82,13 @@ class _LIBCPP_HIDDEN __system_error_category
|
||||
: public __do_message
|
||||
{
|
||||
public:
|
||||
virtual const char* name() const;
|
||||
virtual const char* name() const _NOEXCEPT;
|
||||
virtual string message(int ev) const;
|
||||
virtual error_condition default_error_condition(int ev) const;
|
||||
virtual error_condition default_error_condition(int ev) const _NOEXCEPT;
|
||||
};
|
||||
|
||||
const char*
|
||||
__system_error_category::name() const
|
||||
__system_error_category::name() const _NOEXCEPT
|
||||
{
|
||||
return "system";
|
||||
}
|
||||
@@ -104,7 +104,7 @@ __system_error_category::message(int ev) const
|
||||
}
|
||||
|
||||
error_condition
|
||||
__system_error_category::default_error_condition(int ev) const
|
||||
__system_error_category::default_error_condition(int ev) const _NOEXCEPT
|
||||
{
|
||||
#ifdef ELAST
|
||||
if (ev > ELAST)
|
||||
@@ -114,7 +114,7 @@ __system_error_category::default_error_condition(int ev) const
|
||||
}
|
||||
|
||||
const error_category&
|
||||
system_category()
|
||||
system_category() _NOEXCEPT
|
||||
{
|
||||
static __system_error_category s;
|
||||
return s;
|
||||
@@ -147,7 +147,7 @@ system_error::__init(const error_code& ec, string what_arg)
|
||||
what_arg += ": ";
|
||||
what_arg += ec.message();
|
||||
}
|
||||
return _STD::move(what_arg);
|
||||
return _VSTD::move(what_arg);
|
||||
}
|
||||
|
||||
system_error::system_error(error_code ec, const string& what_arg)
|
||||
@@ -186,7 +186,7 @@ system_error::system_error(int ev, const error_category& ecat)
|
||||
{
|
||||
}
|
||||
|
||||
system_error::~system_error() throw()
|
||||
system_error::~system_error() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -92,10 +92,25 @@ __thread_local_data()
|
||||
|
||||
// __thread_struct_imp
|
||||
|
||||
class __thread_struct_imp
|
||||
template <class T>
|
||||
class _LIBCPP_HIDDEN __hidden_allocator
|
||||
{
|
||||
typedef vector<__assoc_sub_state*> _AsyncStates;
|
||||
typedef vector<pair<condition_variable*, mutex*> > _Notify;
|
||||
public:
|
||||
typedef T value_type;
|
||||
|
||||
T* allocate(size_t __n)
|
||||
{return static_cast<T*>(::operator new(__n * sizeof(T)));}
|
||||
void deallocate(T* __p, size_t) {::operator delete((void*)__p);}
|
||||
|
||||
size_t max_size() const {return size_t(~0) / sizeof(T);}
|
||||
};
|
||||
|
||||
class _LIBCPP_HIDDEN __thread_struct_imp
|
||||
{
|
||||
typedef vector<__assoc_sub_state*,
|
||||
__hidden_allocator<__assoc_sub_state*> > _AsyncStates;
|
||||
typedef vector<pair<condition_variable*, mutex*>,
|
||||
__hidden_allocator<pair<condition_variable*, mutex*> > > _Notify;
|
||||
|
||||
_AsyncStates async_states_;
|
||||
_Notify notify_;
|
||||
|
||||
@@ -13,30 +13,30 @@
|
||||
|
||||
#include "typeinfo"
|
||||
|
||||
std::bad_cast::bad_cast() throw()
|
||||
std::bad_cast::bad_cast() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
std::bad_cast::~bad_cast() throw()
|
||||
std::bad_cast::~bad_cast() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
const char*
|
||||
std::bad_cast::what() const throw()
|
||||
std::bad_cast::what() const _NOEXCEPT
|
||||
{
|
||||
return "std::bad_cast";
|
||||
}
|
||||
|
||||
std::bad_typeid::bad_typeid() throw()
|
||||
std::bad_typeid::bad_typeid() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
std::bad_typeid::~bad_typeid() throw()
|
||||
std::bad_typeid::~bad_typeid() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
const char*
|
||||
std::bad_typeid::what() const throw()
|
||||
std::bad_typeid::what() const _NOEXCEPT
|
||||
{
|
||||
return "std::bad_typeid";
|
||||
}
|
||||
|
||||
44
test/CMakeLists.txt
Normal file
44
test/CMakeLists.txt
Normal file
@@ -0,0 +1,44 @@
|
||||
macro(pythonize_bool var)
|
||||
if (${var})
|
||||
set(${var} True)
|
||||
else()
|
||||
set(${var} False)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
include(FindPythonInterp)
|
||||
if(PYTHONINTERP_FOUND)
|
||||
set(LIT_EXECUTABLE "" CACHE FILEPATH "Path to LLVM's lit.py.")
|
||||
set(LIT_ARGS_DEFAULT "-sv")
|
||||
if (MSVC OR XCODE)
|
||||
set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
|
||||
endif()
|
||||
set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}"
|
||||
CACHE STRING "Default options for lit")
|
||||
set(LIT_ARGS "${LLVM_LIT_ARGS}")
|
||||
separate_arguments(LIT_ARGS)
|
||||
|
||||
set(LIBCXX_COMPILER ${CMAKE_CXX_COMPILER})
|
||||
set(LIBCXX_SOURCE_DIR ${CMAKE_SOURCE_DIR})
|
||||
set(LIBCXX_BINARY_DIR ${CMAKE_BINARY_DIR})
|
||||
set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||
pythonize_bool(LIBCXX_ENABLE_SHARED)
|
||||
pythonize_bool(LIBCXX_HAS_STDCXX0X_FLAG)
|
||||
|
||||
set(AUTO_GEN_COMMENT "## Autogenerated by libcxx configuration.\n# Do not edit!")
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
||||
@ONLY)
|
||||
|
||||
add_custom_target(check
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
${LIT_EXECUTABLE}
|
||||
${LIT_ARGS}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
DEPENDS
|
||||
COMMENT "Running libcxx tests")
|
||||
else()
|
||||
message(WARNING "Could not find Python, no check target will be available!")
|
||||
endif()
|
||||
19
test/atomics/atomics.fences/atomic_signal_fence.pass.cpp
Normal file
19
test/atomics/atomics.fences/atomic_signal_fence.pass.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <atomic>
|
||||
|
||||
// void atomic_signal_fence(memory_order m);
|
||||
|
||||
#include <atomic>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::atomic_signal_fence(std::memory_order_seq_cst);
|
||||
}
|
||||
19
test/atomics/atomics.fences/atomic_thread_fence.pass.cpp
Normal file
19
test/atomics/atomics.fences/atomic_thread_fence.pass.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <atomic>
|
||||
|
||||
// void atomic_thread_fence(memory_order m);
|
||||
|
||||
#include <atomic>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::atomic_thread_fence(std::memory_order_seq_cst);
|
||||
}
|
||||
50
test/atomics/atomics.lockfree/lockfree.pass.cpp
Normal file
50
test/atomics/atomics.lockfree/lockfree.pass.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <atomic>
|
||||
|
||||
// #define ATOMIC_CHAR_LOCK_FREE unspecified
|
||||
// #define ATOMIC_CHAR16_T_LOCK_FREE unspecified
|
||||
// #define ATOMIC_CHAR32_T_LOCK_FREE unspecified
|
||||
// #define ATOMIC_WCHAR_T_LOCK_FREE unspecified
|
||||
// #define ATOMIC_SHORT_LOCK_FREE unspecified
|
||||
// #define ATOMIC_INT_LOCK_FREE unspecified
|
||||
// #define ATOMIC_LONG_LOCK_FREE unspecified
|
||||
// #define ATOMIC_LLONG_LOCK_FREE unspecified
|
||||
|
||||
#include <atomic>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
assert(ATOMIC_CHAR_LOCK_FREE == 0 ||
|
||||
ATOMIC_CHAR_LOCK_FREE == 1 ||
|
||||
ATOMIC_CHAR_LOCK_FREE == 2);
|
||||
assert(ATOMIC_CHAR16_T_LOCK_FREE == 0 ||
|
||||
ATOMIC_CHAR16_T_LOCK_FREE == 1 ||
|
||||
ATOMIC_CHAR16_T_LOCK_FREE == 2);
|
||||
assert(ATOMIC_CHAR32_T_LOCK_FREE == 0 ||
|
||||
ATOMIC_CHAR32_T_LOCK_FREE == 1 ||
|
||||
ATOMIC_CHAR32_T_LOCK_FREE == 2);
|
||||
assert(ATOMIC_WCHAR_T_LOCK_FREE == 0 ||
|
||||
ATOMIC_WCHAR_T_LOCK_FREE == 1 ||
|
||||
ATOMIC_WCHAR_T_LOCK_FREE == 2);
|
||||
assert(ATOMIC_SHORT_LOCK_FREE == 0 ||
|
||||
ATOMIC_SHORT_LOCK_FREE == 1 ||
|
||||
ATOMIC_SHORT_LOCK_FREE == 2);
|
||||
assert(ATOMIC_INT_LOCK_FREE == 0 ||
|
||||
ATOMIC_INT_LOCK_FREE == 1 ||
|
||||
ATOMIC_INT_LOCK_FREE == 2);
|
||||
assert(ATOMIC_LONG_LOCK_FREE == 0 ||
|
||||
ATOMIC_LONG_LOCK_FREE == 1 ||
|
||||
ATOMIC_LONG_LOCK_FREE == 2);
|
||||
assert(ATOMIC_LLONG_LOCK_FREE == 0 ||
|
||||
ATOMIC_LLONG_LOCK_FREE == 1 ||
|
||||
ATOMIC_LLONG_LOCK_FREE == 2);
|
||||
}
|
||||
126
test/atomics/atomics.types.generic/address.pass.cpp
Normal file
126
test/atomics/atomics.types.generic/address.pass.cpp
Normal file
@@ -0,0 +1,126 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <atomic>
|
||||
|
||||
// template <class T>
|
||||
// struct atomic<T*>
|
||||
// {
|
||||
// bool is_lock_free() const volatile;
|
||||
// bool is_lock_free() const;
|
||||
// void store(T* desr, memory_order m = memory_order_seq_cst) volatile;
|
||||
// void store(T* desr, memory_order m = memory_order_seq_cst);
|
||||
// T* load(memory_order m = memory_order_seq_cst) const volatile;
|
||||
// T* load(memory_order m = memory_order_seq_cst) const;
|
||||
// operator T*() const volatile;
|
||||
// operator T*() const;
|
||||
// T* exchange(T* desr, memory_order m = memory_order_seq_cst) volatile;
|
||||
// T* exchange(T* desr, memory_order m = memory_order_seq_cst);
|
||||
// bool compare_exchange_weak(T*& expc, T* desr,
|
||||
// memory_order s, memory_order f) volatile;
|
||||
// bool compare_exchange_weak(T*& expc, T* desr,
|
||||
// memory_order s, memory_order f);
|
||||
// bool compare_exchange_strong(T*& expc, T* desr,
|
||||
// memory_order s, memory_order f) volatile;
|
||||
// bool compare_exchange_strong(T*& expc, T* desr,
|
||||
// memory_order s, memory_order f);
|
||||
// bool compare_exchange_weak(T*& expc, T* desr,
|
||||
// memory_order m = memory_order_seq_cst) volatile;
|
||||
// bool compare_exchange_weak(T*& expc, T* desr,
|
||||
// memory_order m = memory_order_seq_cst);
|
||||
// bool compare_exchange_strong(T*& expc, T* desr,
|
||||
// memory_order m = memory_order_seq_cst) volatile;
|
||||
// bool compare_exchange_strong(T*& expc, T* desr,
|
||||
// memory_order m = memory_order_seq_cst);
|
||||
// T* fetch_add(ptrdiff_t op, memory_order m = memory_order_seq_cst) volatile;
|
||||
// T* fetch_add(ptrdiff_t op, memory_order m = memory_order_seq_cst);
|
||||
// T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst) volatile;
|
||||
// T* fetch_sub(ptrdiff_t op, memory_order m = memory_order_seq_cst);
|
||||
//
|
||||
// atomic() = default;
|
||||
// constexpr atomic(T* desr);
|
||||
// atomic(const atomic&) = delete;
|
||||
// atomic& operator=(const atomic&) = delete;
|
||||
// atomic& operator=(const atomic&) volatile = delete;
|
||||
//
|
||||
// T* operator=(T*) volatile;
|
||||
// T* operator=(T*);
|
||||
// T* operator++(int) volatile;
|
||||
// T* operator++(int);
|
||||
// T* operator--(int) volatile;
|
||||
// T* operator--(int);
|
||||
// T* operator++() volatile;
|
||||
// T* operator++();
|
||||
// T* operator--() volatile;
|
||||
// T* operator--();
|
||||
// T* operator+=(ptrdiff_t op) volatile;
|
||||
// T* operator+=(ptrdiff_t op);
|
||||
// T* operator-=(ptrdiff_t op) volatile;
|
||||
// T* operator-=(ptrdiff_t op);
|
||||
// };
|
||||
|
||||
#include <atomic>
|
||||
#include <cassert>
|
||||
|
||||
template <class A, class T>
|
||||
void
|
||||
do_test()
|
||||
{
|
||||
typedef typename std::remove_pointer<T>::type X;
|
||||
A obj(T(0));
|
||||
assert(obj == T(0));
|
||||
std::atomic_init(&obj, T(1));
|
||||
assert(obj == T(1));
|
||||
std::atomic_init(&obj, T(2));
|
||||
assert(obj == T(2));
|
||||
bool b0 = obj.is_lock_free();
|
||||
obj.store(T(0));
|
||||
assert(obj == T(0));
|
||||
obj.store(T(1), std::memory_order_release);
|
||||
assert(obj == T(1));
|
||||
assert(obj.load() == T(1));
|
||||
assert(obj.load(std::memory_order_acquire) == T(1));
|
||||
assert(obj.exchange(T(2)) == T(1));
|
||||
assert(obj == T(2));
|
||||
assert(obj.exchange(T(3), std::memory_order_relaxed) == T(2));
|
||||
assert(obj == T(3));
|
||||
T x = obj;
|
||||
assert(obj.compare_exchange_weak(x, T(2)) == true);
|
||||
assert(obj == T(2));
|
||||
assert(x == T(3));
|
||||
assert(obj.compare_exchange_weak(x, T(1)) == false);
|
||||
assert(obj == T(2));
|
||||
assert(x == T(1));
|
||||
x = T(2);
|
||||
assert(obj.compare_exchange_strong(x, T(1)) == true);
|
||||
assert(obj == T(1));
|
||||
assert(x == T(2));
|
||||
assert(obj.compare_exchange_strong(x, T(0)) == false);
|
||||
assert(obj == T(1));
|
||||
assert(x == T(0));
|
||||
assert((obj = T(0)) == T(0));
|
||||
assert(obj == T(0));
|
||||
obj = T(2*sizeof(X));
|
||||
assert((obj += std::ptrdiff_t(3)) == T(5*sizeof(X)));
|
||||
assert(obj == T(5*sizeof(X)));
|
||||
assert((obj -= std::ptrdiff_t(3)) == T(2*sizeof(X)));
|
||||
assert(obj == T(2*sizeof(X)));
|
||||
}
|
||||
|
||||
template <class A, class T>
|
||||
void test()
|
||||
{
|
||||
do_test<A, T>();
|
||||
do_test<volatile A, T>();
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test<std::atomic<int*>, int*>();
|
||||
}
|
||||
@@ -1,220 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <atomic>
|
||||
|
||||
// typedef struct atomic_address
|
||||
// {
|
||||
// bool is_lock_free() const volatile;
|
||||
// bool is_lock_free() const;
|
||||
// void store(void*, memory_order = memory_order_seq_cst) volatile;
|
||||
// void store(void*, memory_order = memory_order_seq_cst);
|
||||
// void* load(memory_order = memory_order_seq_cst) const volatile;
|
||||
// void* load(memory_order = memory_order_seq_cst) const;
|
||||
// operator void*() const volatile;
|
||||
// operator void*() const;
|
||||
// void* exchange(void*, memory_order = memory_order_seq_cst) volatile;
|
||||
// void* exchange(void*, memory_order = memory_order_seq_cst);
|
||||
// bool compare_exchange_weak(void*&, void*, memory_order,
|
||||
// memory_order) volatile;
|
||||
// bool compare_exchange_weak(void*&, void*, memory_order, memory_order);
|
||||
// bool compare_exchange_strong(void*&, void*, memory_order,
|
||||
// memory_order) volatile;
|
||||
// bool compare_exchange_strong(void*&, void*, memory_order, memory_order);
|
||||
// bool compare_exchange_weak(void*&, void*,
|
||||
// memory_order = memory_order_seq_cst) volatile;
|
||||
// bool compare_exchange_weak(void*&, void*,
|
||||
// memory_order = memory_order_seq_cst);
|
||||
// bool compare_exchange_strong(void*&, void*,
|
||||
// memory_order = memory_order_seq_cst) volatile;
|
||||
// bool compare_exchange_strong(void*&, void*,
|
||||
// memory_order = memory_order_seq_cst);
|
||||
// bool compare_exchange_weak(const void*&, const void*,
|
||||
// memory_order, memory_order) volatile;
|
||||
// bool compare_exchange_weak(const void*&, const void*, memory_order,
|
||||
// memory_order);
|
||||
// bool compare_exchange_strong(const void*&, const void*, memory_order,
|
||||
// memory_order) volatile;
|
||||
// bool compare_exchange_strong(const void*&, const void*, memory_order,
|
||||
// memory_order);
|
||||
// bool compare_exchange_weak(const void*&, const void*,
|
||||
// memory_order = memory_order_seq_cst) volatile;
|
||||
// bool compare_exchange_weak(const void*&, const void*,
|
||||
// memory_order = memory_order_seq_cst);
|
||||
// bool compare_exchange_strong(const void*&, const void*,
|
||||
// memory_order = memory_order_seq_cst) volatile;
|
||||
// bool compare_exchange_strong(const void*&, const void*,
|
||||
// memory_order = memory_order_seq_cst);
|
||||
// void* fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst) volatile;
|
||||
// void* fetch_add(ptrdiff_t, memory_order = memory_order_seq_cst);
|
||||
// void* fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst) volatile;
|
||||
// void* fetch_sub(ptrdiff_t, memory_order = memory_order_seq_cst);
|
||||
// atomic_address() = default;
|
||||
// constexpr atomic_address(void*);
|
||||
// atomic_address(const atomic_address&) = delete;
|
||||
// atomic_address& operator=(const atomic_address&) = delete;
|
||||
// atomic_address& operator=(const atomic_address&) volatile = delete;
|
||||
// void* operator=(const void*) volatile;
|
||||
// void* operator=(const void*);
|
||||
// void* operator+=(ptrdiff_t) volatile;
|
||||
// void* operator+=(ptrdiff_t);
|
||||
// void* operator-=(ptrdiff_t) volatile;
|
||||
// void* operator-=(ptrdiff_t);
|
||||
// } atomic_address;
|
||||
//
|
||||
// bool atomic_is_lock_free(const volatile atomic_address*);
|
||||
// bool atomic_is_lock_free(const atomic_address*);
|
||||
// void atomic_init(volatile atomic_address*, void*);
|
||||
// void atomic_init(atomic_address*, void*);
|
||||
// void atomic_store(volatile atomic_address*, void*);
|
||||
// void atomic_store(atomic_address*, void*);
|
||||
// void atomic_store_explicit(volatile atomic_address*, void*, memory_order);
|
||||
// void atomic_store_explicit(atomic_address*, void*, memory_order);
|
||||
// void* atomic_load(const volatile atomic_address*);
|
||||
// void* atomic_load(const atomic_address*);
|
||||
// void* atomic_load_explicit(const volatile atomic_address*, memory_order);
|
||||
// void* atomic_load_explicit(const atomic_address*, memory_order);
|
||||
// void* atomic_exchange(volatile atomic_address*, void*);
|
||||
// void* atomic_exchange(atomic_address*, void*);
|
||||
// void* atomic_exchange_explicit(volatile atomic_address*, void*, memory_order);
|
||||
// void* atomic_exchange_explicit(atomic_address*, void*, memory_order);
|
||||
// bool atomic_compare_exchange_weak(volatile atomic_address*, void**, void*);
|
||||
// bool atomic_compare_exchange_weak(atomic_address*, void**, void*);
|
||||
// bool atomic_compare_exchange_strong(volatile atomic_address*, void**, void*);
|
||||
// bool atomic_compare_exchange_strong(atomic_address*, void**, void*);
|
||||
// bool atomic_compare_exchange_weak_explicit(volatile atomic_address*, void**,
|
||||
// void*, memory_order, memory_order);
|
||||
// bool atomic_compare_exchange_weak_explicit(atomic_address*, void**, void*,
|
||||
// memory_order, memory_order);
|
||||
// bool atomic_compare_exchange_strong_explicit(volatile atomic_address*, void**,
|
||||
// void*, memory_order, memory_order);
|
||||
// bool atomic_compare_exchange_strong_explicit(atomic_address*, void**, void*,
|
||||
// memory_order, memory_order);
|
||||
// void* atomic_fetch_add(volatile atomic_address*, ptrdiff_t);
|
||||
// void* atomic_fetch_add(atomic_address*, ptrdiff_t);
|
||||
// void* atomic_fetch_add_explicit(volatile atomic_address*, ptrdiff_t,
|
||||
// memory_order);
|
||||
// void* atomic_fetch_add_explicit(atomic_address*, ptrdiff_t, memory_order);
|
||||
// void* atomic_fetch_sub(volatile atomic_address*, ptrdiff_t);
|
||||
// void* atomic_fetch_sub(atomic_address*, ptrdiff_t);
|
||||
// void* atomic_fetch_sub_explicit(volatile atomic_address*, ptrdiff_t,
|
||||
// memory_order);
|
||||
// void* atomic_fetch_sub_explicit(atomic_address*, ptrdiff_t, memory_order);
|
||||
|
||||
#include <atomic>
|
||||
#include <cassert>
|
||||
|
||||
template <class A, class T>
|
||||
void
|
||||
do_test()
|
||||
{
|
||||
A obj(T(0));
|
||||
assert(obj == T(0));
|
||||
std::atomic_init(&obj, T(1));
|
||||
assert(obj == T(1));
|
||||
std::atomic_init(&obj, T(2));
|
||||
assert(obj == T(2));
|
||||
bool b0 = obj.is_lock_free();
|
||||
obj.store(T(0));
|
||||
assert(obj == T(0));
|
||||
obj.store(T(1), std::memory_order_release);
|
||||
assert(obj == T(1));
|
||||
assert(obj.load() == T(1));
|
||||
assert(obj.load(std::memory_order_acquire) == T(1));
|
||||
assert(obj.exchange(T(2)) == T(1));
|
||||
assert(obj == T(2));
|
||||
assert(obj.exchange(T(3), std::memory_order_relaxed) == T(2));
|
||||
assert(obj == T(3));
|
||||
T x = obj;
|
||||
assert(obj.compare_exchange_weak(x, T(2)) == true);
|
||||
assert(obj == T(2));
|
||||
assert(x == T(3));
|
||||
assert(obj.compare_exchange_weak(x, T(1)) == false);
|
||||
assert(obj == T(2));
|
||||
assert(x == T(2));
|
||||
assert(obj.compare_exchange_strong(x, T(1)) == true);
|
||||
assert(obj == T(1));
|
||||
assert(x == T(2));
|
||||
assert(obj.compare_exchange_strong(x, T(0)) == false);
|
||||
assert(obj == T(1));
|
||||
assert(x == T(1));
|
||||
assert((obj = T(0)) == T(0));
|
||||
assert(obj == T(0));
|
||||
obj = T(2);
|
||||
assert((obj += std::ptrdiff_t(3)) == T(5));
|
||||
assert(obj == T(5));
|
||||
assert((obj -= std::ptrdiff_t(3)) == T(2));
|
||||
assert(obj == T(2));
|
||||
|
||||
std::atomic_init(&obj, T(1));
|
||||
assert(obj == T(1));
|
||||
bool b1 = std::atomic_is_lock_free(&obj);
|
||||
std::atomic_store(&obj, T(0));
|
||||
assert(obj == T(0));
|
||||
std::atomic_store_explicit(&obj, T(1), std::memory_order_release);
|
||||
assert(obj == T(1));
|
||||
assert(std::atomic_load(&obj) == T(1));
|
||||
assert(std::atomic_load_explicit(&obj, std::memory_order_acquire) == T(1));
|
||||
assert(std::atomic_exchange(&obj, T(2)) == T(1));
|
||||
assert(obj == T(2));
|
||||
assert(std::atomic_exchange_explicit(&obj, T(3), std::memory_order_relaxed) == T(2));
|
||||
assert(obj == T(3));
|
||||
x = obj;
|
||||
assert(std::atomic_compare_exchange_weak(&obj, &x, T(2)) == true);
|
||||
assert(obj == T(2));
|
||||
assert(x == T(3));
|
||||
assert(std::atomic_compare_exchange_weak(&obj, &x, T(1)) == false);
|
||||
assert(obj == T(2));
|
||||
assert(x == T(2));
|
||||
assert(std::atomic_compare_exchange_strong(&obj, &x, T(1)) == true);
|
||||
assert(obj == T(1));
|
||||
assert(x == T(2));
|
||||
assert(std::atomic_compare_exchange_strong(&obj, &x, T(0)) == false);
|
||||
assert(obj == T(1));
|
||||
assert(x == T(1));
|
||||
assert(std::atomic_compare_exchange_weak_explicit(&obj, &x, T(2),
|
||||
std::memory_order_relaxed, std::memory_order_relaxed) == true);
|
||||
assert(obj == T(2));
|
||||
assert(x == T(1));
|
||||
assert(std::atomic_compare_exchange_weak_explicit(&obj, &x, T(3),
|
||||
std::memory_order_relaxed, std::memory_order_relaxed) == false);
|
||||
assert(obj == T(2));
|
||||
assert(x == T(2));
|
||||
assert(std::atomic_compare_exchange_strong_explicit(&obj, &x, T(3),
|
||||
std::memory_order_relaxed, std::memory_order_relaxed) == true);
|
||||
assert(obj == T(3));
|
||||
assert(x == T(2));
|
||||
assert(std::atomic_compare_exchange_strong_explicit(&obj, &x, T(0),
|
||||
std::memory_order_relaxed, std::memory_order_relaxed) == false);
|
||||
assert(obj == T(3));
|
||||
assert(x == T(3));
|
||||
assert((obj = T(1)) == T(1));
|
||||
assert(obj == T(1));
|
||||
obj = T(2);
|
||||
assert(std::atomic_fetch_add(&obj, std::ptrdiff_t(3)) == T(2));
|
||||
assert(obj == T(5));
|
||||
assert(std::atomic_fetch_add_explicit(&obj, std::ptrdiff_t(3), std::memory_order_seq_cst) == T(5));
|
||||
assert(obj == T(8));
|
||||
assert(std::atomic_fetch_sub(&obj, std::ptrdiff_t(3)) == T(8));
|
||||
assert(obj == T(5));
|
||||
assert(std::atomic_fetch_sub_explicit(&obj, std::ptrdiff_t(3), std::memory_order_seq_cst) == T(5));
|
||||
assert(obj == T(2));
|
||||
}
|
||||
|
||||
template <class A, class T>
|
||||
void test()
|
||||
{
|
||||
do_test<A, T>();
|
||||
do_test<volatile A, T>();
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test<std::atomic_address, void*>();
|
||||
}
|
||||
@@ -1,239 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <atomic>
|
||||
|
||||
// typedef struct atomic_bool
|
||||
// {
|
||||
// bool is_lock_free() const volatile;
|
||||
// bool is_lock_free() const;
|
||||
// void store(bool, memory_order = memory_order_seq_cst) volatile;
|
||||
// void store(bool, memory_order = memory_order_seq_cst);
|
||||
// bool load(memory_order = memory_order_seq_cst) const volatile;
|
||||
// bool load(memory_order = memory_order_seq_cst) const;
|
||||
// operator bool() const volatile;
|
||||
// operator bool() const;
|
||||
// bool exchange(bool, memory_order = memory_order_seq_cst) volatile;
|
||||
// bool exchange(bool, memory_order = memory_order_seq_cst);
|
||||
// bool compare_exchange_weak(bool&, bool, memory_order,
|
||||
// memory_order) volatile;
|
||||
// bool compare_exchange_weak(bool&, bool, memory_order, memory_order);
|
||||
// bool compare_exchange_strong(bool&, bool, memory_order,
|
||||
// memory_order) volatile;
|
||||
// bool compare_exchange_strong(bool&, bool, memory_order, memory_order);
|
||||
// bool compare_exchange_weak(bool&, bool,
|
||||
// memory_order = memory_order_seq_cst) volatile;
|
||||
// bool compare_exchange_weak(bool&, bool,
|
||||
// memory_order = memory_order_seq_cst);
|
||||
// bool compare_exchange_strong(bool&, bool,
|
||||
// memory_order = memory_order_seq_cst) volatile;
|
||||
// bool compare_exchange_strong(bool&, bool,
|
||||
// memory_order = memory_order_seq_cst);
|
||||
// atomic_bool() = default;
|
||||
// constexpr atomic_bool(bool);
|
||||
// atomic_bool(const atomic_bool&) = delete;
|
||||
// atomic_bool& operator=(const atomic_bool&) = delete;
|
||||
// atomic_bool& operator=(const atomic_bool&) volatile = delete;
|
||||
// bool operator=(bool) volatile;
|
||||
// bool operator=(bool);
|
||||
// } atomic_bool;
|
||||
//
|
||||
// bool atomic_is_lock_free(const volatile atomic_bool*);
|
||||
// bool atomic_is_lock_free(const atomic_bool*);
|
||||
// void atomic_init(volatile atomic_bool*, bool);
|
||||
// void atomic_init(atomic_bool*, bool);
|
||||
// void atomic_store(volatile atomic_bool*, bool);
|
||||
// void atomic_store(atomic_bool*, bool);
|
||||
// void atomic_store_explicit(volatile atomic_bool*, bool, memory_order);
|
||||
// void atomic_store_explicit(atomic_bool*, bool, memory_order);
|
||||
// bool atomic_load(const volatile atomic_bool*);
|
||||
// bool atomic_load(const atomic_bool*);
|
||||
// bool atomic_load_explicit(const volatile atomic_bool*, memory_order);
|
||||
// bool atomic_load_explicit(const atomic_bool*, memory_order);
|
||||
// bool atomic_exchange(volatile atomic_bool*, bool);
|
||||
// bool atomic_exchange(atomic_bool*, bool);
|
||||
// bool atomic_exchange_explicit(volatile atomic_bool*, bool, memory_order);
|
||||
// bool atomic_exchange_explicit(atomic_bool*, bool, memory_order);
|
||||
// bool atomic_compare_exchange_weak(volatile atomic_bool*, bool*, bool);
|
||||
// bool atomic_compare_exchange_weak(atomic_bool*, bool*, bool);
|
||||
// bool atomic_compare_exchange_strong(volatile atomic_bool*, bool*, bool);
|
||||
// bool atomic_compare_exchange_strong(atomic_bool*, bool*, bool);
|
||||
// bool atomic_compare_exchange_weak_explicit(volatile atomic_bool*, bool*, bool,
|
||||
// memory_order, memory_order);
|
||||
// bool atomic_compare_exchange_weak_explicit(atomic_bool*, bool*, bool,
|
||||
// memory_order, memory_order);
|
||||
// bool atomic_compare_exchange_strong_explicit(volatile atomic_bool*, bool*, bool,
|
||||
// memory_order, memory_order);
|
||||
// bool atomic_compare_exchange_strong_explicit(atomic_bool*, bool*, bool,
|
||||
// memory_order, memory_order);
|
||||
|
||||
#include <atomic>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
volatile std::atomic_bool obj(true);
|
||||
assert(obj == true);
|
||||
std::atomic_init(&obj, false);
|
||||
assert(obj == false);
|
||||
std::atomic_init(&obj, true);
|
||||
assert(obj == true);
|
||||
bool b0 = obj.is_lock_free();
|
||||
obj.store(false);
|
||||
assert(obj == false);
|
||||
obj.store(true, std::memory_order_release);
|
||||
assert(obj == true);
|
||||
assert(obj.load() == true);
|
||||
assert(obj.load(std::memory_order_acquire) == true);
|
||||
assert(obj.exchange(false) == true);
|
||||
assert(obj == false);
|
||||
assert(obj.exchange(true, std::memory_order_relaxed) == false);
|
||||
assert(obj == true);
|
||||
bool x = obj;
|
||||
assert(obj.compare_exchange_weak(x, false) == true);
|
||||
assert(obj == false);
|
||||
assert(x == true);
|
||||
assert(obj.compare_exchange_weak(x, true) == false);
|
||||
assert(obj == false);
|
||||
assert(x == false);
|
||||
assert(obj.compare_exchange_strong(x, true) == true);
|
||||
assert(obj == true);
|
||||
assert(x == false);
|
||||
assert(obj.compare_exchange_strong(x, false) == false);
|
||||
assert(obj == true);
|
||||
assert(x == true);
|
||||
assert((obj = false) == false);
|
||||
assert(obj == false);
|
||||
|
||||
std::atomic_init(&obj, true);
|
||||
assert(obj == true);
|
||||
bool b1 = std::atomic_is_lock_free(&obj);
|
||||
std::atomic_store(&obj, false);
|
||||
assert(obj == false);
|
||||
std::atomic_store_explicit(&obj, true, std::memory_order_release);
|
||||
assert(obj == true);
|
||||
assert(std::atomic_load(&obj) == true);
|
||||
assert(std::atomic_load_explicit(&obj, std::memory_order_acquire) == true);
|
||||
assert(std::atomic_exchange(&obj, false) == true);
|
||||
assert(obj == false);
|
||||
assert(std::atomic_exchange_explicit(&obj, true, std::memory_order_relaxed) == false);
|
||||
assert(obj == true);
|
||||
x = obj;
|
||||
assert(std::atomic_compare_exchange_weak(&obj, &x, false) == true);
|
||||
assert(obj == false);
|
||||
assert(x == true);
|
||||
assert(std::atomic_compare_exchange_weak(&obj, &x, true) == false);
|
||||
assert(obj == false);
|
||||
assert(x == false);
|
||||
assert(std::atomic_compare_exchange_strong(&obj, &x, true) == true);
|
||||
assert(obj == true);
|
||||
assert(x == false);
|
||||
assert(std::atomic_compare_exchange_strong(&obj, &x, false) == false);
|
||||
assert(obj == true);
|
||||
assert(x == true);
|
||||
assert(std::atomic_compare_exchange_weak_explicit(&obj, &x, false,
|
||||
std::memory_order_relaxed, std::memory_order_relaxed) == true);
|
||||
assert(obj == false);
|
||||
assert(x == true);
|
||||
assert(std::atomic_compare_exchange_weak_explicit(&obj, &x, true,
|
||||
std::memory_order_relaxed, std::memory_order_relaxed) == false);
|
||||
assert(obj == false);
|
||||
assert(x == false);
|
||||
assert(std::atomic_compare_exchange_strong_explicit(&obj, &x, true,
|
||||
std::memory_order_relaxed, std::memory_order_relaxed) == true);
|
||||
assert(obj == true);
|
||||
assert(x == false);
|
||||
assert(std::atomic_compare_exchange_strong_explicit(&obj, &x, false,
|
||||
std::memory_order_relaxed, std::memory_order_relaxed) == false);
|
||||
assert(obj == true);
|
||||
assert(x == true);
|
||||
assert((obj = false) == false);
|
||||
assert(obj == false);
|
||||
}
|
||||
{
|
||||
std::atomic_bool obj(true);
|
||||
assert(obj == true);
|
||||
std::atomic_init(&obj, false);
|
||||
assert(obj == false);
|
||||
std::atomic_init(&obj, true);
|
||||
assert(obj == true);
|
||||
bool b0 = obj.is_lock_free();
|
||||
obj.store(false);
|
||||
assert(obj == false);
|
||||
obj.store(true, std::memory_order_release);
|
||||
assert(obj == true);
|
||||
assert(obj.load() == true);
|
||||
assert(obj.load(std::memory_order_acquire) == true);
|
||||
assert(obj.exchange(false) == true);
|
||||
assert(obj == false);
|
||||
assert(obj.exchange(true, std::memory_order_relaxed) == false);
|
||||
assert(obj == true);
|
||||
bool x = obj;
|
||||
assert(obj.compare_exchange_weak(x, false) == true);
|
||||
assert(obj == false);
|
||||
assert(x == true);
|
||||
assert(obj.compare_exchange_weak(x, true) == false);
|
||||
assert(obj == false);
|
||||
assert(x == false);
|
||||
assert(obj.compare_exchange_strong(x, true) == true);
|
||||
assert(obj == true);
|
||||
assert(x == false);
|
||||
assert(obj.compare_exchange_strong(x, false) == false);
|
||||
assert(obj == true);
|
||||
assert(x == true);
|
||||
assert((obj = false) == false);
|
||||
assert(obj == false);
|
||||
|
||||
std::atomic_init(&obj, true);
|
||||
assert(obj == true);
|
||||
bool b1 = std::atomic_is_lock_free(&obj);
|
||||
std::atomic_store(&obj, false);
|
||||
assert(obj == false);
|
||||
std::atomic_store_explicit(&obj, true, std::memory_order_release);
|
||||
assert(obj == true);
|
||||
assert(std::atomic_load(&obj) == true);
|
||||
assert(std::atomic_load_explicit(&obj, std::memory_order_acquire) == true);
|
||||
assert(std::atomic_exchange(&obj, false) == true);
|
||||
assert(obj == false);
|
||||
assert(std::atomic_exchange_explicit(&obj, true, std::memory_order_relaxed) == false);
|
||||
assert(obj == true);
|
||||
x = obj;
|
||||
assert(std::atomic_compare_exchange_weak(&obj, &x, false) == true);
|
||||
assert(obj == false);
|
||||
assert(x == true);
|
||||
assert(std::atomic_compare_exchange_weak(&obj, &x, true) == false);
|
||||
assert(obj == false);
|
||||
assert(x == false);
|
||||
assert(std::atomic_compare_exchange_strong(&obj, &x, true) == true);
|
||||
assert(obj == true);
|
||||
assert(x == false);
|
||||
assert(std::atomic_compare_exchange_strong(&obj, &x, false) == false);
|
||||
assert(obj == true);
|
||||
assert(x == true);
|
||||
assert(std::atomic_compare_exchange_weak_explicit(&obj, &x, false,
|
||||
std::memory_order_relaxed, std::memory_order_relaxed) == true);
|
||||
assert(obj == false);
|
||||
assert(x == true);
|
||||
assert(std::atomic_compare_exchange_weak_explicit(&obj, &x, true,
|
||||
std::memory_order_relaxed, std::memory_order_relaxed) == false);
|
||||
assert(obj == false);
|
||||
assert(x == false);
|
||||
assert(std::atomic_compare_exchange_strong_explicit(&obj, &x, true,
|
||||
std::memory_order_relaxed, std::memory_order_relaxed) == true);
|
||||
assert(obj == true);
|
||||
assert(x == false);
|
||||
assert(std::atomic_compare_exchange_strong_explicit(&obj, &x, false,
|
||||
std::memory_order_relaxed, std::memory_order_relaxed) == false);
|
||||
assert(obj == true);
|
||||
assert(x == true);
|
||||
assert((obj = false) == false);
|
||||
assert(obj == false);
|
||||
}
|
||||
}
|
||||
@@ -1,276 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <atomic>
|
||||
|
||||
// typedef struct atomic_itype
|
||||
// {
|
||||
// bool is_lock_free() const volatile;
|
||||
// bool is_lock_free() const;
|
||||
// void store(itype, memory_order = memory_order_seq_cst) volatile;
|
||||
// void store(itype, memory_order = memory_order_seq_cst);
|
||||
// itype load(memory_order = memory_order_seq_cst) const volatile;
|
||||
// itype load(memory_order = memory_order_seq_cst) const;
|
||||
// operator itype() const volatile;
|
||||
// operator itype() const;
|
||||
// itype exchange(itype, memory_order = memory_order_seq_cst) volatile;
|
||||
// itype exchange(itype, memory_order = memory_order_seq_cst);
|
||||
// bool compare_exchange_weak(itype&, itype, memory_order,
|
||||
// memory_order) volatile;
|
||||
// bool compare_exchange_weak(itype&, itype, memory_order, memory_order);
|
||||
// bool compare_exchange_strong(itype&, itype, memory_order,
|
||||
// memory_order) volatile;
|
||||
// bool compare_exchange_strong(itype&, itype, memory_order, memory_order);
|
||||
// bool compare_exchange_weak(itype&, itype,
|
||||
// memory_order = memory_order_seq_cst) volatile;
|
||||
// bool compare_exchange_weak(itype&, itype,
|
||||
// memory_order = memory_order_seq_cst);
|
||||
// bool compare_exchange_strong(itype&, itype,
|
||||
// memory_order = memory_order_seq_cst) volatile;
|
||||
// bool compare_exchange_strong(itype&, itype,
|
||||
// memory_order = memory_order_seq_cst);
|
||||
// itype fetch_add(itype, memory_order = memory_order_seq_cst) volatile;
|
||||
// itype fetch_add(itype, memory_order = memory_order_seq_cst);
|
||||
// itype fetch_sub(itype, memory_order = memory_order_seq_cst) volatile;
|
||||
// itype fetch_sub(itype, memory_order = memory_order_seq_cst);
|
||||
// itype fetch_and(itype, memory_order = memory_order_seq_cst) volatile;
|
||||
// itype fetch_and(itype, memory_order = memory_order_seq_cst);
|
||||
// itype fetch_or(itype, memory_order = memory_order_seq_cst) volatile;
|
||||
// itype fetch_or(itype, memory_order = memory_order_seq_cst);
|
||||
// itype fetch_xor(itype, memory_order = memory_order_seq_cst) volatile;
|
||||
// itype fetch_xor(itype, memory_order = memory_order_seq_cst);
|
||||
// atomic_itype() = default;
|
||||
// constexpr atomic_itype(itype);
|
||||
// atomic_itype(const atomic_itype&) = delete;
|
||||
// atomic_itype& operator=(const atomic_itype&) = delete;
|
||||
// atomic_itype& operator=(const atomic_itype&) volatile = delete;
|
||||
// itype operator=(itype) volatile;
|
||||
// itype operator=(itype);
|
||||
// itype operator++(int) volatile;
|
||||
// itype operator++(int);
|
||||
// itype operator--(int) volatile;
|
||||
// itype operator--(int);
|
||||
// itype operator++() volatile;
|
||||
// itype operator++();
|
||||
// itype operator--() volatile;
|
||||
// itype operator--();
|
||||
// itype operator+=(itype) volatile;
|
||||
// itype operator+=(itype);
|
||||
// itype operator-=(itype) volatile;
|
||||
// itype operator-=(itype);
|
||||
// itype operator&=(itype) volatile;
|
||||
// itype operator&=(itype);
|
||||
// itype operator|=(itype) volatile;
|
||||
// itype operator|=(itype);
|
||||
// itype operator^=(itype) volatile;
|
||||
// itype operator^=(itype);
|
||||
// } atomic_itype;
|
||||
//
|
||||
// bool atomic_is_lock_free(const volatile atomic_itype*);
|
||||
// bool atomic_is_lock_free(const atomic_itype*);
|
||||
// void atomic_init(volatile atomic_itype*, itype);
|
||||
// void atomic_init(atomic_itype*, itype);
|
||||
// void atomic_store(volatile atomic_itype*, itype);
|
||||
// void atomic_store(atomic_itype*, itype);
|
||||
// void atomic_store_explicit(volatile atomic_itype*, itype, memory_order);
|
||||
// void atomic_store_explicit(atomic_itype*, itype, memory_order);
|
||||
// itype atomic_load(const volatile atomic_itype*);
|
||||
// itype atomic_load(const atomic_itype*);
|
||||
// itype atomic_load_explicit(const volatile atomic_itype*, memory_order);
|
||||
// itype atomic_load_explicit(const atomic_itype*, memory_order);
|
||||
// itype atomic_exchange(volatile atomic_itype*, itype);
|
||||
// itype atomic_exchange(atomic_itype*, itype);
|
||||
// itype atomic_exchange_explicit(volatile atomic_itype*, itype, memory_order);
|
||||
// itype atomic_exchange_explicit(atomic_itype*, itype, memory_order);
|
||||
// bool atomic_compare_exchange_weak(volatile atomic_itype*, itype*, itype);
|
||||
// bool atomic_compare_exchange_weak(atomic_itype*, itype*, itype);
|
||||
// bool atomic_compare_exchange_strong(volatile atomic_itype*, itype*, itype);
|
||||
// bool atomic_compare_exchange_strong(atomic_itype*, itype*, itype);
|
||||
// bool atomic_compare_exchange_weak_explicit(volatile atomic_itype*, itype*, itype,
|
||||
// memory_order, memory_order);
|
||||
// bool atomic_compare_exchange_weak_explicit(atomic_itype*, itype*, itype,
|
||||
// memory_order, memory_order);
|
||||
// bool atomic_compare_exchange_strong_explicit(volatile atomic_itype*, itype*, itype,
|
||||
// memory_order, memory_order);
|
||||
// bool atomic_compare_exchange_strong_explicit(atomic_itype*, itype*, itype,
|
||||
// memory_order, memory_order);
|
||||
// itype atomic_fetch_add(volatile atomic_itype*, itype);
|
||||
// itype atomic_fetch_add(atomic_itype*, itype);
|
||||
// itype atomic_fetch_add_explicit(volatile atomic_itype*, itype, memory_order);
|
||||
// itype atomic_fetch_add_explicit(atomic_itype*, itype, memory_order);
|
||||
// itype atomic_fetch_sub(volatile atomic_itype*, itype);
|
||||
// itype atomic_fetch_sub(atomic_itype*, itype);
|
||||
// itype atomic_fetch_sub_explicit(volatile atomic_itype*, itype, memory_order);
|
||||
// itype atomic_fetch_sub_explicit(atomic_itype*, itype, memory_order);
|
||||
// itype atomic_fetch_and(volatile atomic_itype*, itype);
|
||||
// itype atomic_fetch_and(atomic_itype*, itype);
|
||||
// itype atomic_fetch_and_explicit(volatile atomic_itype*, itype, memory_order);
|
||||
// itype atomic_fetch_and_explicit(atomic_itype*, itype, memory_order);
|
||||
// itype atomic_fetch_or(volatile atomic_itype*, itype);
|
||||
// itype atomic_fetch_or(atomic_itype*, itype);
|
||||
// itype atomic_fetch_or_explicit(volatile atomic_itype*, itype, memory_order);
|
||||
// itype atomic_fetch_or_explicit(atomic_itype*, itype, memory_order);
|
||||
// itype atomic_fetch_xor(volatile atomic_itype*, itype);
|
||||
// itype atomic_fetch_xor(atomic_itype*, itype);
|
||||
// itype atomic_fetch_xor_explicit(volatile atomic_itype*, itype, memory_order);
|
||||
// itype atomic_fetch_xor_explicit(atomic_itype*, itype, memory_order);
|
||||
|
||||
#include <atomic>
|
||||
#include <cassert>
|
||||
|
||||
template <class A, class T>
|
||||
void
|
||||
do_test()
|
||||
{
|
||||
A obj(T(0));
|
||||
assert(obj == T(0));
|
||||
std::atomic_init(&obj, T(1));
|
||||
assert(obj == T(1));
|
||||
std::atomic_init(&obj, T(2));
|
||||
assert(obj == T(2));
|
||||
bool b0 = obj.is_lock_free();
|
||||
obj.store(T(0));
|
||||
assert(obj == T(0));
|
||||
obj.store(T(1), std::memory_order_release);
|
||||
assert(obj == T(1));
|
||||
assert(obj.load() == T(1));
|
||||
assert(obj.load(std::memory_order_acquire) == T(1));
|
||||
assert(obj.exchange(T(2)) == T(1));
|
||||
assert(obj == T(2));
|
||||
assert(obj.exchange(T(3), std::memory_order_relaxed) == T(2));
|
||||
assert(obj == T(3));
|
||||
T x = obj;
|
||||
assert(obj.compare_exchange_weak(x, T(2)) == true);
|
||||
assert(obj == T(2));
|
||||
assert(x == T(3));
|
||||
assert(obj.compare_exchange_weak(x, T(1)) == false);
|
||||
assert(obj == T(2));
|
||||
assert(x == T(2));
|
||||
assert(obj.compare_exchange_strong(x, T(1)) == true);
|
||||
assert(obj == T(1));
|
||||
assert(x == T(2));
|
||||
assert(obj.compare_exchange_strong(x, T(0)) == false);
|
||||
assert(obj == T(1));
|
||||
assert(x == T(1));
|
||||
assert((obj = T(0)) == T(0));
|
||||
assert(obj == T(0));
|
||||
assert(obj++ == T(0));
|
||||
assert(obj == T(1));
|
||||
assert(++obj == T(2));
|
||||
assert(obj == T(2));
|
||||
assert(--obj == T(1));
|
||||
assert(obj == T(1));
|
||||
assert(obj-- == T(1));
|
||||
assert(obj == T(0));
|
||||
obj = T(2);
|
||||
assert((obj += T(3)) == T(5));
|
||||
assert(obj == T(5));
|
||||
assert((obj -= T(3)) == T(2));
|
||||
assert(obj == T(2));
|
||||
assert((obj |= T(5)) == T(7));
|
||||
assert(obj == T(7));
|
||||
assert((obj &= T(0xF)) == T(7));
|
||||
assert(obj == T(7));
|
||||
assert((obj ^= T(0xF)) == T(8));
|
||||
assert(obj == T(8));
|
||||
|
||||
std::atomic_init(&obj, T(1));
|
||||
assert(obj == T(1));
|
||||
bool b1 = std::atomic_is_lock_free(&obj);
|
||||
std::atomic_store(&obj, T(0));
|
||||
assert(obj == T(0));
|
||||
std::atomic_store_explicit(&obj, T(1), std::memory_order_release);
|
||||
assert(obj == T(1));
|
||||
assert(std::atomic_load(&obj) == T(1));
|
||||
assert(std::atomic_load_explicit(&obj, std::memory_order_acquire) == T(1));
|
||||
assert(std::atomic_exchange(&obj, T(2)) == T(1));
|
||||
assert(obj == T(2));
|
||||
assert(std::atomic_exchange_explicit(&obj, T(3), std::memory_order_relaxed) == T(2));
|
||||
assert(obj == T(3));
|
||||
x = obj;
|
||||
assert(std::atomic_compare_exchange_weak(&obj, &x, T(2)) == true);
|
||||
assert(obj == T(2));
|
||||
assert(x == T(3));
|
||||
assert(std::atomic_compare_exchange_weak(&obj, &x, T(1)) == false);
|
||||
assert(obj == T(2));
|
||||
assert(x == T(2));
|
||||
assert(std::atomic_compare_exchange_strong(&obj, &x, T(1)) == true);
|
||||
assert(obj == T(1));
|
||||
assert(x == T(2));
|
||||
assert(std::atomic_compare_exchange_strong(&obj, &x, T(0)) == false);
|
||||
assert(obj == T(1));
|
||||
assert(x == T(1));
|
||||
assert(std::atomic_compare_exchange_weak_explicit(&obj, &x, T(2),
|
||||
std::memory_order_relaxed, std::memory_order_relaxed) == true);
|
||||
assert(obj == T(2));
|
||||
assert(x == T(1));
|
||||
assert(std::atomic_compare_exchange_weak_explicit(&obj, &x, T(3),
|
||||
std::memory_order_relaxed, std::memory_order_relaxed) == false);
|
||||
assert(obj == T(2));
|
||||
assert(x == T(2));
|
||||
assert(std::atomic_compare_exchange_strong_explicit(&obj, &x, T(3),
|
||||
std::memory_order_relaxed, std::memory_order_relaxed) == true);
|
||||
assert(obj == T(3));
|
||||
assert(x == T(2));
|
||||
assert(std::atomic_compare_exchange_strong_explicit(&obj, &x, T(0),
|
||||
std::memory_order_relaxed, std::memory_order_relaxed) == false);
|
||||
assert(obj == T(3));
|
||||
assert(x == T(3));
|
||||
assert((obj = T(1)) == T(1));
|
||||
assert(obj == T(1));
|
||||
obj = T(2);
|
||||
assert(std::atomic_fetch_add(&obj, T(3)) == T(2));
|
||||
assert(obj == T(5));
|
||||
assert(std::atomic_fetch_add_explicit(&obj, T(3), std::memory_order_seq_cst) == T(5));
|
||||
assert(obj == T(8));
|
||||
assert(std::atomic_fetch_sub(&obj, T(3)) == T(8));
|
||||
assert(obj == T(5));
|
||||
assert(std::atomic_fetch_sub_explicit(&obj, T(3), std::memory_order_seq_cst) == T(5));
|
||||
assert(obj == T(2));
|
||||
assert(std::atomic_fetch_or(&obj, T(5)) == T(2));
|
||||
assert(obj == T(7));
|
||||
assert(std::atomic_fetch_or_explicit(&obj, T(8), std::memory_order_seq_cst) == T(7));
|
||||
assert(obj == T(0xF));
|
||||
assert(std::atomic_fetch_and(&obj, T(7)) == T(0xF));
|
||||
assert(obj == T(7));
|
||||
assert(std::atomic_fetch_and_explicit(&obj, T(3), std::memory_order_seq_cst) == T(7));
|
||||
assert(obj == T(3));
|
||||
assert(std::atomic_fetch_xor(&obj, T(7)) == T(3));
|
||||
assert(obj == T(4));
|
||||
assert(std::atomic_fetch_xor_explicit(&obj, T(7), std::memory_order_seq_cst) == T(4));
|
||||
assert(obj == T(3));
|
||||
}
|
||||
|
||||
template <class A, class T>
|
||||
void test()
|
||||
{
|
||||
do_test<A, T>();
|
||||
do_test<volatile A, T>();
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
test<std::atomic_char, char>();
|
||||
test<std::atomic_schar, signed char>();
|
||||
test<std::atomic_uchar, unsigned char>();
|
||||
test<std::atomic_short, short>();
|
||||
test<std::atomic_ushort, unsigned short>();
|
||||
test<std::atomic_int, int>();
|
||||
test<std::atomic_uint, unsigned int>();
|
||||
test<std::atomic_long, long>();
|
||||
test<std::atomic_ulong, unsigned long>();
|
||||
test<std::atomic_llong, long long>();
|
||||
test<std::atomic_ullong, unsigned long long>();
|
||||
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
test<std::atomic_char16_t, char16_t>();
|
||||
test<std::atomic_char32_t, char32_t>();
|
||||
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
test<std::atomic_wchar_t, wchar_t>();
|
||||
}
|
||||
163
test/atomics/atomics.types.generic/bool.pass.cpp
Normal file
163
test/atomics/atomics.types.generic/bool.pass.cpp
Normal file
@@ -0,0 +1,163 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <atomic>
|
||||
|
||||
// template <class T>
|
||||
// struct atomic
|
||||
// {
|
||||
// bool is_lock_free() const volatile;
|
||||
// bool is_lock_free() const;
|
||||
// void store(T desr, memory_order m = memory_order_seq_cst) volatile;
|
||||
// void store(T desr, memory_order m = memory_order_seq_cst);
|
||||
// T load(memory_order m = memory_order_seq_cst) const volatile;
|
||||
// T load(memory_order m = memory_order_seq_cst) const;
|
||||
// operator T() const volatile;
|
||||
// operator T() const;
|
||||
// T exchange(T desr, memory_order m = memory_order_seq_cst) volatile;
|
||||
// T exchange(T desr, memory_order m = memory_order_seq_cst);
|
||||
// bool compare_exchange_weak(T& expc, T desr,
|
||||
// memory_order s, memory_order f) volatile;
|
||||
// bool compare_exchange_weak(T& expc, T desr, memory_order s, memory_order f);
|
||||
// bool compare_exchange_strong(T& expc, T desr,
|
||||
// memory_order s, memory_order f) volatile;
|
||||
// bool compare_exchange_strong(T& expc, T desr,
|
||||
// memory_order s, memory_order f);
|
||||
// bool compare_exchange_weak(T& expc, T desr,
|
||||
// memory_order m = memory_order_seq_cst) volatile;
|
||||
// bool compare_exchange_weak(T& expc, T desr,
|
||||
// memory_order m = memory_order_seq_cst);
|
||||
// bool compare_exchange_strong(T& expc, T desr,
|
||||
// memory_order m = memory_order_seq_cst) volatile;
|
||||
// bool compare_exchange_strong(T& expc, T desr,
|
||||
// memory_order m = memory_order_seq_cst);
|
||||
//
|
||||
// atomic() = default;
|
||||
// constexpr atomic(T desr);
|
||||
// atomic(const atomic&) = delete;
|
||||
// atomic& operator=(const atomic&) = delete;
|
||||
// atomic& operator=(const atomic&) volatile = delete;
|
||||
// T operator=(T) volatile;
|
||||
// T operator=(T);
|
||||
// };
|
||||
|
||||
#include <atomic>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
volatile std::atomic<bool> _;
|
||||
volatile std::atomic<bool> obj(true);
|
||||
assert(obj == true);
|
||||
std::atomic_init(&obj, false);
|
||||
assert(obj == false);
|
||||
std::atomic_init(&obj, true);
|
||||
assert(obj == true);
|
||||
bool b0 = obj.is_lock_free();
|
||||
obj.store(false);
|
||||
assert(obj == false);
|
||||
obj.store(true, std::memory_order_release);
|
||||
assert(obj == true);
|
||||
assert(obj.load() == true);
|
||||
assert(obj.load(std::memory_order_acquire) == true);
|
||||
assert(obj.exchange(false) == true);
|
||||
assert(obj == false);
|
||||
assert(obj.exchange(true, std::memory_order_relaxed) == false);
|
||||
assert(obj == true);
|
||||
bool x = obj;
|
||||
assert(obj.compare_exchange_weak(x, false) == true);
|
||||
assert(obj == false);
|
||||
assert(x == true);
|
||||
assert(obj.compare_exchange_weak(x, true,
|
||||
std::memory_order_seq_cst) == false);
|
||||
assert(obj == false);
|
||||
assert(x == true);
|
||||
obj.store(true);
|
||||
assert(obj.compare_exchange_weak(x, false,
|
||||
std::memory_order_seq_cst,
|
||||
std::memory_order_seq_cst) == true);
|
||||
assert(obj == false);
|
||||
assert(x == true);
|
||||
x = true;
|
||||
obj.store(true);
|
||||
assert(obj.compare_exchange_strong(x, false) == true);
|
||||
assert(obj == false);
|
||||
assert(x == true);
|
||||
assert(obj.compare_exchange_strong(x, true,
|
||||
std::memory_order_seq_cst) == false);
|
||||
assert(obj == false);
|
||||
assert(x == true);
|
||||
x = true;
|
||||
obj.store(true);
|
||||
assert(obj.compare_exchange_strong(x, false,
|
||||
std::memory_order_seq_cst,
|
||||
std::memory_order_seq_cst) == true);
|
||||
assert(obj == false);
|
||||
assert(x == true);
|
||||
assert((obj = false) == false);
|
||||
assert(obj == false);
|
||||
assert((obj = true) == true);
|
||||
assert(obj == true);
|
||||
}
|
||||
{
|
||||
std::atomic<bool> _;
|
||||
std::atomic<bool> obj(true);
|
||||
assert(obj == true);
|
||||
std::atomic_init(&obj, false);
|
||||
assert(obj == false);
|
||||
std::atomic_init(&obj, true);
|
||||
assert(obj == true);
|
||||
bool b0 = obj.is_lock_free();
|
||||
obj.store(false);
|
||||
assert(obj == false);
|
||||
obj.store(true, std::memory_order_release);
|
||||
assert(obj == true);
|
||||
assert(obj.load() == true);
|
||||
assert(obj.load(std::memory_order_acquire) == true);
|
||||
assert(obj.exchange(false) == true);
|
||||
assert(obj == false);
|
||||
assert(obj.exchange(true, std::memory_order_relaxed) == false);
|
||||
assert(obj == true);
|
||||
bool x = obj;
|
||||
assert(obj.compare_exchange_weak(x, false) == true);
|
||||
assert(obj == false);
|
||||
assert(x == true);
|
||||
assert(obj.compare_exchange_weak(x, true,
|
||||
std::memory_order_seq_cst) == false);
|
||||
assert(obj == false);
|
||||
assert(x == true);
|
||||
obj.store(true);
|
||||
assert(obj.compare_exchange_weak(x, false,
|
||||
std::memory_order_seq_cst,
|
||||
std::memory_order_seq_cst) == true);
|
||||
assert(obj == false);
|
||||
assert(x == true);
|
||||
x = true;
|
||||
obj.store(true);
|
||||
assert(obj.compare_exchange_strong(x, false) == true);
|
||||
assert(obj == false);
|
||||
assert(x == true);
|
||||
assert(obj.compare_exchange_strong(x, true,
|
||||
std::memory_order_seq_cst) == false);
|
||||
assert(obj == false);
|
||||
assert(x == true);
|
||||
x = true;
|
||||
obj.store(true);
|
||||
assert(obj.compare_exchange_strong(x, false,
|
||||
std::memory_order_seq_cst,
|
||||
std::memory_order_seq_cst) == true);
|
||||
assert(obj == false);
|
||||
assert(x == true);
|
||||
assert((obj = false) == false);
|
||||
assert(obj == false);
|
||||
assert((obj = true) == true);
|
||||
assert(obj == true);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user