Compare commits
329 Commits
svn-tags/l
...
centos5
Author | SHA1 | Date | |
---|---|---|---|
![]() |
96f126b9e8 | ||
![]() |
7c97b3ce6f | ||
![]() |
5415e8841d | ||
![]() |
7d0f6af56a | ||
![]() |
d2a2b14562 | ||
![]() |
e75965016d | ||
![]() |
3ba994d21e | ||
![]() |
76fe67f7a6 | ||
![]() |
d0a9c59bb9 | ||
![]() |
1a20e57e37 | ||
![]() |
a4dcf54b23 | ||
![]() |
bad86a1622 | ||
![]() |
4a4eaa3bf1 | ||
![]() |
b3fdb18d3f | ||
![]() |
619c2c22d8 | ||
![]() |
2d7ecd8fda | ||
![]() |
e3582e5899 | ||
![]() |
6facac3fe9 | ||
![]() |
ddab15593b | ||
![]() |
f596e63a0c | ||
![]() |
5ecb06d475 | ||
![]() |
297be35c48 | ||
![]() |
b3e839d7bc | ||
![]() |
a25261ee9c | ||
![]() |
5bd8211ac9 | ||
![]() |
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 | ||
![]() |
55ddb21dd4 | ||
![]() |
a445151f4a | ||
![]() |
7de47902d0 | ||
![]() |
ac417faebc | ||
![]() |
d397d03651 | ||
![]() |
c706565c88 | ||
![]() |
6051e24e45 | ||
![]() |
adaa6266fe | ||
![]() |
8771430346 | ||
![]() |
46ab5def62 | ||
![]() |
fa5043d878 | ||
![]() |
83b6979fa2 | ||
![]() |
59a5ddbbd1 | ||
![]() |
afff5aacd6 | ||
![]() |
17c3a81048 | ||
![]() |
5711e4daf0 | ||
![]() |
6587dfe980 | ||
![]() |
73d2f94f6b | ||
![]() |
091f2ab44f | ||
![]() |
6689564040 | ||
![]() |
f8f852138f | ||
![]() |
f048fe3a09 | ||
![]() |
1468b668aa | ||
![]() |
01feecb789 | ||
![]() |
9835d76169 | ||
![]() |
995676a98e | ||
![]() |
9650b6cce3 | ||
![]() |
2f6a627394 | ||
![]() |
278bf2d289 | ||
![]() |
47761071be | ||
![]() |
34d6b19721 | ||
![]() |
7b2cb48cc1 | ||
![]() |
cd2254b454 | ||
![]() |
86ed8aefb2 | ||
![]() |
e32b5e2f23 | ||
![]() |
b64f8b07c1 | ||
![]() |
f38bc6efc5 | ||
![]() |
662497edd2 | ||
![]() |
28dbbe0596 | ||
![]() |
726a76fb47 | ||
![]() |
a8feecea67 | ||
![]() |
e87ad178cc | ||
![]() |
4e59948249 | ||
![]() |
bce9c3132d | ||
![]() |
f26262dde0 | ||
![]() |
5bbe97ddaa | ||
![]() |
e738501eb3 | ||
![]() |
21ef47f436 | ||
![]() |
be22ed405a | ||
![]() |
f6fe084fd4 | ||
![]() |
0d5dff1897 | ||
![]() |
b742dcdd52 | ||
![]() |
5306d68019 | ||
![]() |
8177207f3c | ||
![]() |
f9734c831f | ||
![]() |
373a9d18d3 | ||
![]() |
4d89249185 | ||
![]() |
3c143ad882 | ||
![]() |
08f2969220 | ||
![]() |
ffb9a4e235 | ||
![]() |
251aaa1064 | ||
![]() |
77868b9d9a | ||
![]() |
086b718734 | ||
![]() |
e78d1f548b | ||
![]() |
56f0d5be06 | ||
![]() |
6cac2c2c9c | ||
![]() |
b4ac745466 | ||
![]() |
002f1d341b | ||
![]() |
26994e383c | ||
![]() |
611fdaf229 | ||
![]() |
7c0c696afd | ||
![]() |
364f5965da | ||
![]() |
1348fba3e2 | ||
![]() |
79101aec3a | ||
![]() |
f701e25c49 | ||
![]() |
767ae2b483 | ||
![]() |
5b6af69387 | ||
![]() |
c260b06366 | ||
![]() |
ed760f40b7 | ||
![]() |
0ce02245a9 | ||
![]() |
d1176e29b0 | ||
![]() |
8f73c63658 | ||
![]() |
d05c6e646b | ||
![]() |
e049cc5f75 | ||
![]() |
ee6ccd0e32 | ||
![]() |
8d7a9557b7 | ||
![]() |
28c97e6ee1 | ||
![]() |
aef07cbffd | ||
![]() |
b9af2eae4a | ||
![]() |
828948148d | ||
![]() |
68a8e90b3d | ||
![]() |
8c6cbb24e8 | ||
![]() |
42a63a781f | ||
![]() |
422a53fd7a | ||
![]() |
333f50d30c | ||
![]() |
b0be42b2ce | ||
![]() |
99acc5008b | ||
![]() |
c0de2e48ff | ||
![]() |
3975ebd4f5 | ||
![]() |
049734ed85 | ||
![]() |
611581b853 | ||
![]() |
26a43c25d7 | ||
![]() |
7e0c57b203 | ||
![]() |
f5eadcd8d5 | ||
![]() |
45f5717812 | ||
![]() |
d2a9251977 | ||
![]() |
a0f1dc9f46 | ||
![]() |
fdc5a0f321 | ||
![]() |
c7e4d82bc0 | ||
![]() |
36cdf027d2 | ||
![]() |
cb2deb2652 | ||
![]() |
e764f0b648 | ||
![]() |
745d473ac1 | ||
![]() |
27031115bf | ||
![]() |
99ad765261 | ||
![]() |
954b366317 | ||
![]() |
aad0db393f | ||
![]() |
87eea6d801 | ||
![]() |
bb73d762b2 | ||
![]() |
6fd2e09b36 | ||
![]() |
2fd6d25bf1 | ||
![]() |
1387038988 | ||
![]() |
f6547cbf61 | ||
![]() |
3991b553df | ||
![]() |
a2ccccce89 | ||
![]() |
9c2683d77c | ||
![]() |
e3e488eb61 | ||
![]() |
b02310e487 | ||
![]() |
bfd5530c06 | ||
![]() |
73d21a4f07 | ||
![]() |
04acacadca | ||
![]() |
171a9a7cc3 | ||
![]() |
e6e4d01553 | ||
![]() |
99be8237db | ||
![]() |
ae153b9855 | ||
![]() |
54da338f59 | ||
![]() |
7158e5c38b | ||
![]() |
f39daa8e5a | ||
![]() |
47499b162a | ||
![]() |
98ccdeca3b | ||
![]() |
a652172d86 |
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)
|
22
CREDITS.TXT
Normal file
22
CREDITS.TXT
Normal file
@@ -0,0 +1,22 @@
|
||||
This file is a partial list of people who have contributed to the LLVM/libc++
|
||||
project. If you have contributed a patch or made some other contribution to
|
||||
LLVM/libc++, please submit a patch to this file to add yourself, and it will be
|
||||
done!
|
||||
|
||||
The list is sorted by surname and formatted to allow easy grepping and
|
||||
beautification by scripts. The fields are: name (N), email (E), web-address
|
||||
(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
|
||||
(S).
|
||||
|
||||
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
|
46
LICENSE.TXT
46
LICENSE.TXT
@@ -1,10 +1,21 @@
|
||||
==============================================================================
|
||||
LLVM Release License
|
||||
libc++ License
|
||||
==============================================================================
|
||||
|
||||
The libc++ library is dual licensed under both the University of Illinois
|
||||
"BSD-Like" license and the MIT license. As a user of this code you may choose
|
||||
to use it under either license. As a contributor, you agree to allow your code
|
||||
to be used under both.
|
||||
|
||||
Full text of the relevant licenses is included below.
|
||||
|
||||
==============================================================================
|
||||
|
||||
University of Illinois/NCSA
|
||||
Open Source License
|
||||
|
||||
Copyright (c) 2007-2010 University of Illinois at Urbana-Champaign.
|
||||
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Developed by:
|
||||
@@ -43,20 +54,23 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
|
||||
SOFTWARE.
|
||||
|
||||
==============================================================================
|
||||
The LLVM software contains code written by third parties. Such software will
|
||||
have its own individual LICENSE.TXT file in the directory in which it appears.
|
||||
This file will describe the copyrights, license, and restrictions which apply
|
||||
to that code.
|
||||
|
||||
The disclaimer of warranty in the University of Illinois Open Source License
|
||||
applies to all code in the LLVM Distribution, and nothing in any of the
|
||||
other licenses gives permission to use the names of the LLVM Team or the
|
||||
University of Illinois to endorse or promote products derived from this
|
||||
Software.
|
||||
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
|
||||
|
||||
The following pieces of software have additional or alternate copyrights,
|
||||
licenses, and/or restrictions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
Program Directory
|
||||
------- ---------
|
||||
<none yet>
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
28
Makefile
28
Makefile
@@ -9,10 +9,16 @@ OBJROOT=.
|
||||
SYMROOT=.
|
||||
export TRIPLE=-apple-
|
||||
|
||||
ifeq (,$(RC_INDIGO))
|
||||
INSTALL_PREFIX=""
|
||||
else
|
||||
INSTALL_PREFIX="$(SDKROOT)"
|
||||
endif
|
||||
|
||||
installsrc:: $(SRCROOT)
|
||||
|
||||
ditto $(SRCDIRS)/include $(SRCROOT)/include
|
||||
ditto $(SRCDIRS)/lib/buildit $(SRCROOT)/lib/buildit
|
||||
ditto $(SRCDIRS)/lib $(SRCROOT)/lib
|
||||
ditto $(SRCDIRS)/src $(SRCROOT)/src
|
||||
ditto $(SRCDIRS)/Makefile $(SRCROOT)/Makefile
|
||||
|
||||
@@ -20,19 +26,19 @@ 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/include/c++/v1/ext
|
||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/
|
||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/include
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/*
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/ext
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/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()
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -38,11 +38,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 +54,22 @@ 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 _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 +79,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 +89,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 +113,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);
|
||||
};
|
||||
@@ -1028,6 +1034,7 @@ __equal_aligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __la
|
||||
}
|
||||
|
||||
template <class _C, bool _IC1, bool _IC2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
equal(__bit_iterator<_C, _IC1> __first1, __bit_iterator<_C, _IC1> __last1, __bit_iterator<_C, _IC2> __first2)
|
||||
{
|
||||
@@ -1056,12 +1063,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++()
|
||||
{
|
||||
@@ -1161,7 +1170,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;
|
||||
|
126
include/__config
126
include/__config
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -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,10 +87,23 @@
|
||||
|
||||
#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
|
||||
|
||||
#define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__))
|
||||
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
|
||||
|
||||
#if defined(__clang__)
|
||||
|
||||
#if !__has_feature(cxx_alias_templates)
|
||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
#endif
|
||||
|
||||
#ifndef __GXX_EXPERIMENTAL_CXX0X__
|
||||
#ifdef __linux__
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#else
|
||||
typedef __char16_t char16_t;
|
||||
typedef __char32_t char32_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_exceptions))
|
||||
#define _LIBCPP_NO_EXCEPTIONS
|
||||
#endif
|
||||
@@ -94,56 +112,88 @@
|
||||
#define _LIBCPP_NO_RTTI
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
#define _LIBCPP_HAS_NO_STRONG_USING
|
||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
|
||||
#ifndef __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
#define _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#else // __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
#if __has_feature(cxx_rvalue_references)
|
||||
#define _LIBCPP_MOVE
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_decltype))
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_deleted_functions))
|
||||
#if __has_feature(cxx_attributes)
|
||||
# define _ATTRIBUTE(x) [[x]]
|
||||
#else
|
||||
# define _ATTRIBUTE(x) __attribute__ ((x))
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
|
||||
#if !(__has_feature(cxx_deleted_functions))
|
||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#endif // !(__has_feature(cxx_deleted_functions))
|
||||
|
||||
#if !(__has_feature(cxx_lambdas))
|
||||
#define _LIBCPP_HAS_NO_LAMBDAS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_nullptr))
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_rvalue_references))
|
||||
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_static_assert))
|
||||
#define _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_auto_type))
|
||||
#define _LIBCPP_HAS_NO_AUTO_TYPE
|
||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_variadic_templates))
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif
|
||||
|
||||
#endif // __GXX_EXPERIMENTAL_CXX0X__
|
||||
#if !(__has_feature(cxx_trailing_return))
|
||||
#define _LIBCPP_HAS_NO_TRAILING_RETURN
|
||||
#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
|
||||
|
||||
namespace std {
|
||||
inline namespace _LIBCPP_NAMESPACE {
|
||||
}
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
// end defined(__clang__)
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
#define _ATTRIBUTE(x) __attribute__((x))
|
||||
|
||||
#if !__EXCEPTIONS
|
||||
#define _LIBCPP_NO_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
#define _LIBCPP_HAS_NO_CONSTEXPR
|
||||
|
||||
#define _NOEXCEPT throw()
|
||||
#define _NOEXCEPT_(x)
|
||||
|
||||
#ifndef __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
@@ -155,11 +205,16 @@
|
||||
#define _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
#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__
|
||||
|
||||
#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 3
|
||||
#define _LIBCPP_MOVE
|
||||
#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
|
||||
#endif
|
||||
|
||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
|
||||
@@ -181,13 +236,6 @@
|
||||
|
||||
#endif // __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
#endif // defined(__GNUC__)
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_STRONG_USING
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
|
||||
#define _LIBCPP_END_NAMESPACE_STD }
|
||||
#define _STD std
|
||||
#else // _LIBCPP_HAS_NO_STRONG_USING
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
|
||||
#define _LIBCPP_END_NAMESPACE_STD } }
|
||||
#define _STD std::_LIBCPP_NAMESPACE
|
||||
@@ -198,7 +246,7 @@ namespace _LIBCPP_NAMESPACE {
|
||||
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_STRONG_USING
|
||||
#endif // defined(__GNUC__)
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
typedef unsigned short char16_t;
|
||||
@@ -220,4 +268,12 @@ template <unsigned> struct __static_assert_check {};
|
||||
#define decltype(x) __typeof__(x)
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#define constexpr const
|
||||
#endif
|
||||
|
||||
#ifndef __has_feature
|
||||
#define __has_feature(__x) 0
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CONFIG
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -196,12 +196,12 @@ mem_fn(_R (_T::* __pm)(_A0, _A1, _A2) const volatile)
|
||||
|
||||
// bad_function_call
|
||||
|
||||
class bad_function_call
|
||||
class _LIBCPP_EXCEPTION_ABI bad_function_call
|
||||
: public exception
|
||||
{
|
||||
};
|
||||
|
||||
template<class _Fp> class function; // undefined
|
||||
template<class _Fp> class _LIBCPP_VISIBLE function; // undefined
|
||||
|
||||
namespace __function
|
||||
{
|
||||
@@ -396,8 +396,9 @@ class __func<_F, _Alloc, _R(_A0)>
|
||||
{
|
||||
__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)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __func(_F __f) : __f_(_STD::move(__f)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __func(_F __f, _Alloc __a)
|
||||
: __f_(_STD::move(__f), _STD::move(__a)) {}
|
||||
virtual __base<_R(_A0)>* __clone() const;
|
||||
virtual void __clone(__base<_R(_A0)>*) const;
|
||||
virtual void destroy();
|
||||
@@ -478,8 +479,9 @@ class __func<_F, _Alloc, _R(_A0, _A1)>
|
||||
{
|
||||
__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)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __func(_F __f) : __f_(_STD::move(__f)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __func(_F __f, _Alloc __a)
|
||||
: __f_(_STD::move(__f), _STD::move(__a)) {}
|
||||
virtual __base<_R(_A0, _A1)>* __clone() const;
|
||||
virtual void __clone(__base<_R(_A0, _A1)>*) const;
|
||||
virtual void destroy();
|
||||
@@ -560,8 +562,9 @@ class __func<_F, _Alloc, _R(_A0, _A1, _A2)>
|
||||
{
|
||||
__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)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __func(_F __f) : __f_(_STD::move(__f)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __func(_F __f, _Alloc __a)
|
||||
: __f_(_STD::move(__f), _STD::move(__a)) {}
|
||||
virtual __base<_R(_A0, _A1, _A2)>* __clone() const;
|
||||
virtual void __clone(__base<_R(_A0, _A1, _A2)>*) const;
|
||||
virtual void destroy();
|
||||
@@ -639,7 +642,7 @@ __func<_F, _Alloc, _R(_A0, _A1, _A2)>::target_type() const
|
||||
} // __function
|
||||
|
||||
template<class _R>
|
||||
class function<_R()>
|
||||
class _LIBCPP_VISIBLE function<_R()>
|
||||
{
|
||||
typedef __function::__base<_R()> __base;
|
||||
aligned_storage<3*sizeof(void*)>::type __buf_;
|
||||
@@ -653,16 +656,18 @@ public:
|
||||
typedef _R result_type;
|
||||
|
||||
// 20.7.16.2.1, construct/copy/destroy:
|
||||
explicit function() : __f_(0) {}
|
||||
function(nullptr_t) : __f_(0) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {}
|
||||
_LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {}
|
||||
function(const function&);
|
||||
template<class _F>
|
||||
function(_F,
|
||||
typename enable_if<!is_integral<_F>::value>::type* = 0);
|
||||
|
||||
template<class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
function(allocator_arg_t, const _Alloc&) : __f_(0) {}
|
||||
template<class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {}
|
||||
template<class _Alloc>
|
||||
function(allocator_arg_t, const _Alloc&, const function&);
|
||||
@@ -685,18 +690,19 @@ public:
|
||||
// 20.7.16.2.2, function modifiers:
|
||||
void swap(function&);
|
||||
template<class _F, class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void assign(_F __f, const _Alloc& __a)
|
||||
{function(allocator_arg, __a, __f).swap(*this);}
|
||||
|
||||
// 20.7.16.2.3, function capacity:
|
||||
operator bool() const {return __f_;}
|
||||
_LIBCPP_INLINE_VISIBILITY operator bool() const {return __f_;}
|
||||
|
||||
private:
|
||||
// deleted overloads close possible hole in the type system
|
||||
template<class _R2>
|
||||
bool operator==(const function<_R2()>&);// = delete;
|
||||
bool operator==(const function<_R2()>&) const;// = delete;
|
||||
template<class _R2>
|
||||
bool operator!=(const function<_R2()>&);// = delete;
|
||||
bool operator!=(const function<_R2()>&) const;// = delete;
|
||||
public:
|
||||
// 20.7.16.2.4, function invocation:
|
||||
_R operator()() const;
|
||||
@@ -920,7 +926,7 @@ function<_R()>::target() const
|
||||
#endif // _LIBCPP_NO_RTTI
|
||||
|
||||
template<class _R, class _A0>
|
||||
class function<_R(_A0)>
|
||||
class _LIBCPP_VISIBLE function<_R(_A0)>
|
||||
: public unary_function<_A0, _R>
|
||||
{
|
||||
typedef __function::__base<_R(_A0)> __base;
|
||||
@@ -928,33 +934,42 @@ class function<_R(_A0)>
|
||||
__base* __f_;
|
||||
|
||||
template <class _F>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(const _F&) {return true;}
|
||||
template <class _R2, class _B0>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(_R2 (*__p)(_B0)) {return __p;}
|
||||
template <class _R2, class _C>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(_R2 (_C::*__p)()) {return __p;}
|
||||
template <class _R2, class _C>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(_R2 (_C::*__p)() const) {return __p;}
|
||||
template <class _R2, class _C>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(_R2 (_C::*__p)() volatile) {return __p;}
|
||||
template <class _R2, class _C>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(_R2 (_C::*__p)() const volatile) {return __p;}
|
||||
template <class _R2, class _B0>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(const function<_R(_B0)>& __p) {return __p;}
|
||||
public:
|
||||
typedef _R result_type;
|
||||
|
||||
// 20.7.16.2.1, construct/copy/destroy:
|
||||
explicit function() : __f_(0) {}
|
||||
function(nullptr_t) : __f_(0) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {}
|
||||
_LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {}
|
||||
function(const function&);
|
||||
template<class _F>
|
||||
function(_F,
|
||||
typename enable_if<!is_integral<_F>::value>::type* = 0);
|
||||
|
||||
template<class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
function(allocator_arg_t, const _Alloc&) : __f_(0) {}
|
||||
template<class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {}
|
||||
template<class _Alloc>
|
||||
function(allocator_arg_t, const _Alloc&, const function&);
|
||||
@@ -977,18 +992,19 @@ public:
|
||||
// 20.7.16.2.2, function modifiers:
|
||||
void swap(function&);
|
||||
template<class _F, class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void assign(_F __f, const _Alloc& __a)
|
||||
{function(allocator_arg, __a, __f).swap(*this);}
|
||||
|
||||
// 20.7.16.2.3, function capacity:
|
||||
operator bool() const {return __f_;}
|
||||
_LIBCPP_INLINE_VISIBILITY operator bool() const {return __f_;}
|
||||
|
||||
private:
|
||||
// deleted overloads close possible hole in the type system
|
||||
template<class _R2, class _B0>
|
||||
bool operator==(const function<_R2(_B0)>&);// = delete;
|
||||
bool operator==(const function<_R2(_B0)>&) const;// = delete;
|
||||
template<class _R2, class _B0>
|
||||
bool operator!=(const function<_R2(_B0)>&);// = delete;
|
||||
bool operator!=(const function<_R2(_B0)>&) const;// = delete;
|
||||
public:
|
||||
// 20.7.16.2.4, function invocation:
|
||||
_R operator()(_A0) const;
|
||||
@@ -1212,7 +1228,7 @@ function<_R(_A0)>::target() const
|
||||
#endif // _LIBCPP_NO_RTTI
|
||||
|
||||
template<class _R, class _A0, class _A1>
|
||||
class function<_R(_A0, _A1)>
|
||||
class _LIBCPP_VISIBLE function<_R(_A0, _A1)>
|
||||
: public binary_function<_A0, _A1, _R>
|
||||
{
|
||||
typedef __function::__base<_R(_A0, _A1)> __base;
|
||||
@@ -1220,33 +1236,42 @@ class function<_R(_A0, _A1)>
|
||||
__base* __f_;
|
||||
|
||||
template <class _F>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(const _F&) {return true;}
|
||||
template <class _R2, class _B0, class _B1>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(_R2 (*__p)(_B0, _B1)) {return __p;}
|
||||
template <class _R2, class _C, class _B1>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(_R2 (_C::*__p)(_B1)) {return __p;}
|
||||
template <class _R2, class _C, class _B1>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(_R2 (_C::*__p)(_B1) const) {return __p;}
|
||||
template <class _R2, class _C, class _B1>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(_R2 (_C::*__p)(_B1) volatile) {return __p;}
|
||||
template <class _R2, class _C, class _B1>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(_R2 (_C::*__p)(_B1) const volatile) {return __p;}
|
||||
template <class _R2, class _B0, class _B1>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(const function<_R(_B0, _B1)>& __p) {return __p;}
|
||||
public:
|
||||
typedef _R result_type;
|
||||
|
||||
// 20.7.16.2.1, construct/copy/destroy:
|
||||
explicit function() : __f_(0) {}
|
||||
function(nullptr_t) : __f_(0) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {}
|
||||
_LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {}
|
||||
function(const function&);
|
||||
template<class _F>
|
||||
function(_F,
|
||||
typename enable_if<!is_integral<_F>::value>::type* = 0);
|
||||
|
||||
template<class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
function(allocator_arg_t, const _Alloc&) : __f_(0) {}
|
||||
template<class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {}
|
||||
template<class _Alloc>
|
||||
function(allocator_arg_t, const _Alloc&, const function&);
|
||||
@@ -1269,6 +1294,7 @@ public:
|
||||
// 20.7.16.2.2, function modifiers:
|
||||
void swap(function&);
|
||||
template<class _F, class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void assign(_F __f, const _Alloc& __a)
|
||||
{function(allocator_arg, __a, __f).swap(*this);}
|
||||
|
||||
@@ -1278,9 +1304,9 @@ public:
|
||||
private:
|
||||
// deleted overloads close possible hole in the type system
|
||||
template<class _R2, class _B0, class _B1>
|
||||
bool operator==(const function<_R2(_B0, _B1)>&);// = delete;
|
||||
bool operator==(const function<_R2(_B0, _B1)>&) const;// = delete;
|
||||
template<class _R2, class _B0, class _B1>
|
||||
bool operator!=(const function<_R2(_B0, _B1)>&);// = delete;
|
||||
bool operator!=(const function<_R2(_B0, _B1)>&) const;// = delete;
|
||||
public:
|
||||
// 20.7.16.2.4, function invocation:
|
||||
_R operator()(_A0, _A1) const;
|
||||
@@ -1504,40 +1530,49 @@ function<_R(_A0, _A1)>::target() const
|
||||
#endif // _LIBCPP_NO_RTTI
|
||||
|
||||
template<class _R, class _A0, class _A1, class _A2>
|
||||
class function<_R(_A0, _A1, _A2)>
|
||||
class _LIBCPP_VISIBLE function<_R(_A0, _A1, _A2)>
|
||||
{
|
||||
typedef __function::__base<_R(_A0, _A1, _A2)> __base;
|
||||
aligned_storage<3*sizeof(void*)>::type __buf_;
|
||||
__base* __f_;
|
||||
|
||||
template <class _F>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(const _F&) {return true;}
|
||||
template <class _R2, class _B0, class _B1, class _B2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(_R2 (*__p)(_B0, _B1, _B2)) {return __p;}
|
||||
template <class _R2, class _C, class _B1, class _B2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(_R2 (_C::*__p)(_B1, _B2)) {return __p;}
|
||||
template <class _R2, class _C, class _B1, class _B2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(_R2 (_C::*__p)(_B1, _B2) const) {return __p;}
|
||||
template <class _R2, class _C, class _B1, class _B2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(_R2 (_C::*__p)(_B1, _B2) volatile) {return __p;}
|
||||
template <class _R2, class _C, class _B1, class _B2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(_R2 (_C::*__p)(_B1, _B2) const volatile) {return __p;}
|
||||
template <class _R2, class _B0, class _B1, class _B2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool __not_null(const function<_R(_B0, _B1, _B2)>& __p) {return __p;}
|
||||
public:
|
||||
typedef _R result_type;
|
||||
|
||||
// 20.7.16.2.1, construct/copy/destroy:
|
||||
explicit function() : __f_(0) {}
|
||||
function(nullptr_t) : __f_(0) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {}
|
||||
_LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {}
|
||||
function(const function&);
|
||||
template<class _F>
|
||||
function(_F,
|
||||
typename enable_if<!is_integral<_F>::value>::type* = 0);
|
||||
|
||||
template<class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
function(allocator_arg_t, const _Alloc&) : __f_(0) {}
|
||||
template<class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {}
|
||||
template<class _Alloc>
|
||||
function(allocator_arg_t, const _Alloc&, const function&);
|
||||
@@ -1560,18 +1595,19 @@ public:
|
||||
// 20.7.16.2.2, function modifiers:
|
||||
void swap(function&);
|
||||
template<class _F, class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void assign(_F __f, const _Alloc& __a)
|
||||
{function(allocator_arg, __a, __f).swap(*this);}
|
||||
|
||||
// 20.7.16.2.3, function capacity:
|
||||
operator bool() const {return __f_;}
|
||||
_LIBCPP_INLINE_VISIBILITY operator bool() const {return __f_;}
|
||||
|
||||
private:
|
||||
// deleted overloads close possible hole in the type system
|
||||
template<class _R2, class _B0, class _B1, class _B2>
|
||||
bool operator==(const function<_R2(_B0, _B1, _B2)>&);// = delete;
|
||||
bool operator==(const function<_R2(_B0, _B1, _B2)>&) const;// = delete;
|
||||
template<class _R2, class _B0, class _B1, class _B2>
|
||||
bool operator!=(const function<_R2(_B0, _B1, _B2)>&);// = delete;
|
||||
bool operator!=(const function<_R2(_B0, _B1, _B2)>&) const;// = delete;
|
||||
public:
|
||||
// 20.7.16.2.4, function invocation:
|
||||
_R operator()(_A0, _A1, _A2) const;
|
||||
@@ -1822,11 +1858,11 @@ swap(function<_F>& __x, function<_F>& __y)
|
||||
{return __x.swap(__y);}
|
||||
|
||||
template<class _Tp> struct __is_bind_expression : public false_type {};
|
||||
template<class _Tp> struct is_bind_expression
|
||||
template<class _Tp> struct _LIBCPP_VISIBLE is_bind_expression
|
||||
: public __is_bind_expression<typename remove_cv<_Tp>::type> {};
|
||||
|
||||
template<class _Tp> struct __is_placeholder : public integral_constant<int, 0> {};
|
||||
template<class _Tp> struct is_placeholder
|
||||
template<class _Tp> struct _LIBCPP_VISIBLE is_placeholder
|
||||
: public __is_placeholder<typename remove_cv<_Tp>::type> {};
|
||||
|
||||
namespace placeholders
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -21,21 +21,21 @@
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Arg, class _Result>
|
||||
struct unary_function
|
||||
struct _LIBCPP_VISIBLE unary_function
|
||||
{
|
||||
typedef _Arg argument_type;
|
||||
typedef _Result result_type;
|
||||
};
|
||||
|
||||
template <class _Arg1, class _Arg2, class _Result>
|
||||
struct binary_function
|
||||
struct _LIBCPP_VISIBLE binary_function
|
||||
{
|
||||
typedef _Arg1 first_argument_type;
|
||||
typedef _Arg2 second_argument_type;
|
||||
typedef _Result result_type;
|
||||
};
|
||||
|
||||
template <class _Tp> struct hash;
|
||||
template <class _Tp> struct _LIBCPP_VISIBLE hash;
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_result_type
|
||||
@@ -281,161 +281,55 @@ 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((_STD::forward<_A0>(__a0).*__f)(_STD::forward<_Args>(__args)...))
|
||||
{
|
||||
return (_STD::forward<_T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
|
||||
return (_STD::forward<_A0>(__a0).*__f)(_STD::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(((*_STD::forward<_A0>(__a0)).*__f)(_STD::forward<_Args>(__args)...))
|
||||
{
|
||||
return (_STD::forward<_T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
|
||||
return ((*_STD::forward<_A0>(__a0)).*__f)(_STD::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(_STD::forward<_A0>(__a0).*__f)
|
||||
{
|
||||
return (_STD::forward<_T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
|
||||
return _STD::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((*_STD::forward<_A0>(__a0)).*__f)
|
||||
{
|
||||
return (_STD::forward<_T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
|
||||
return (*_STD::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(_STD::forward<_F>(__f)(_STD::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 _STD::forward<_F>(__f)(_STD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class _Tp, class ..._Args>
|
||||
@@ -445,7 +339,7 @@ struct __invoke_return
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
class reference_wrapper
|
||||
class _LIBCPP_VISIBLE reference_wrapper
|
||||
: public __weak_result_type<_Tp>
|
||||
{
|
||||
public:
|
||||
@@ -456,18 +350,19 @@ private:
|
||||
|
||||
public:
|
||||
// construct/copy/destroy
|
||||
_LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) : __f_(&__f) {}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
_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>
|
||||
typename __invoke_return<type&, _ArgTypes...>::type
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_of<type&, _ArgTypes...>::type
|
||||
operator() (_ArgTypes&&... __args) const
|
||||
{
|
||||
return __invoke(get(), _STD::forward<_ArgTypes>(__args)...);
|
||||
@@ -482,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);
|
||||
}
|
||||
@@ -490,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());
|
||||
}
|
||||
@@ -498,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);
|
||||
}
|
||||
@@ -506,15 +401,25 @@ 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());
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
template <class _Tp> void ref(const _Tp&& __t);// = delete; // LWG 688
|
||||
template <class _Tp> void cref(const _Tp&& __t);// = delete; // LWG 688
|
||||
#endif // _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
|
||||
template <class _Tp> void ref(const _Tp&& __t) = delete;
|
||||
template <class _Tp> void cref(const _Tp&& __t) = delete;
|
||||
|
||||
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
|
||||
template <class _Tp> void ref(const _Tp&& __t);// = delete;
|
||||
template <class _Tp> void cref(const _Tp&& __t);// = delete;
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -873,7 +873,7 @@ __invoke(_R _T::* __f, _T1& __t1)
|
||||
|
||||
template <class _F>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename result_of<_F()>::type
|
||||
decltype(declval<_F>()())
|
||||
__invoke(_F __f)
|
||||
{
|
||||
return __f();
|
||||
@@ -881,7 +881,7 @@ __invoke(_F __f)
|
||||
|
||||
template <class _F, class _A0>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename result_of<_F(_A0)>::type
|
||||
decltype(declval<_F>()(declval<_A0&>()))
|
||||
__invoke(_F __f, _A0& __a0)
|
||||
{
|
||||
return __f(__a0);
|
||||
@@ -889,7 +889,7 @@ __invoke(_F __f, _A0& __a0)
|
||||
|
||||
template <class _F, class _A0, class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename result_of<_F(_A0, _A1)>::type
|
||||
decltype(declval<_F>()(declval<_A0&>(), declval<_A1&>()))
|
||||
__invoke(_F __f, _A0& __a0, _A1& __a1)
|
||||
{
|
||||
return __f(__a0, __a1);
|
||||
@@ -897,7 +897,7 @@ __invoke(_F __f, _A0& __a0, _A1& __a1)
|
||||
|
||||
template <class _F, class _A0, class _A1, class _A2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename result_of<_F(_A0, _A1, _A2)>::type
|
||||
decltype(declval<_F>()(declval<_A0&>(), declval<_A1&>(), declval<_A2&>()))
|
||||
__invoke(_F __f, _A0& __a0, _A1& __a1, _A2& __a2)
|
||||
{
|
||||
return __f(__a0, __a1, __a2);
|
||||
@@ -996,7 +996,7 @@ struct __invoke_return2
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
class reference_wrapper
|
||||
class _LIBCPP_VISIBLE reference_wrapper
|
||||
: public __weak_result_type<_Tp>
|
||||
{
|
||||
public:
|
||||
@@ -1015,6 +1015,7 @@ public:
|
||||
|
||||
// invoke
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return<type&>::type
|
||||
operator() () const
|
||||
{
|
||||
@@ -1022,6 +1023,7 @@ public:
|
||||
}
|
||||
|
||||
template <class _A0>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return0<type&, _A0>::type
|
||||
operator() (_A0& __a0) const
|
||||
{
|
||||
@@ -1029,6 +1031,7 @@ public:
|
||||
}
|
||||
|
||||
template <class _A0, class _A1>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return1<type&, _A0, _A1>::type
|
||||
operator() (_A0& __a0, _A1& __a1) const
|
||||
{
|
||||
@@ -1036,6 +1039,7 @@ public:
|
||||
}
|
||||
|
||||
template <class _A0, class _A1, class _A2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return2<type&, _A0, _A1, _A2>::type
|
||||
operator() (_A0& __a0, _A1& __a1, _A2& __a2) const
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
147
include/__locale
147
include/__locale
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -27,10 +27,10 @@ _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 locale
|
||||
class _LIBCPP_VISIBLE locale
|
||||
{
|
||||
public:
|
||||
// types:
|
||||
@@ -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,14 +86,15 @@ 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&);
|
||||
};
|
||||
|
||||
class locale::facet
|
||||
class _LIBCPP_VISIBLE locale::facet
|
||||
: public __shared_count
|
||||
{
|
||||
protected:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit facet(size_t __refs = 0)
|
||||
: __shared_count(static_cast<long>(__refs)-1) {}
|
||||
|
||||
@@ -101,17 +103,17 @@ 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 locale::id
|
||||
class _LIBCPP_VISIBLE locale::id
|
||||
{
|
||||
once_flag __flag_;
|
||||
int32_t __id_;
|
||||
|
||||
static int32_t __next_id;
|
||||
public:
|
||||
id() {}
|
||||
_LIBCPP_INLINE_VISIBILITY id() {}
|
||||
private:
|
||||
void __init();
|
||||
void operator=(const id&); // = delete;
|
||||
@@ -144,7 +146,7 @@ locale::combine(const locale& __other) const
|
||||
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);
|
||||
}
|
||||
@@ -160,27 +162,31 @@ use_facet(const locale& __l)
|
||||
// template <class _CharT> class collate;
|
||||
|
||||
template <class _CharT>
|
||||
class collate
|
||||
class _LIBCPP_VISIBLE collate
|
||||
: public locale::facet
|
||||
{
|
||||
public:
|
||||
typedef _CharT char_type;
|
||||
typedef basic_string<char_type> string_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit collate(size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int compare(const char_type* __lo1, const char_type* __hi1,
|
||||
const char_type* __lo2, const char_type* __hi2) const
|
||||
{
|
||||
return do_compare(__lo1, __hi1, __lo2, __hi2);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
string_type transform(const char_type* __lo, const char_type* __hi) const
|
||||
{
|
||||
return do_transform(__lo, __hi);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
long hash(const char_type* __lo, const char_type* __hi) const
|
||||
{
|
||||
return do_hash(__lo, __hi);
|
||||
@@ -235,15 +241,15 @@ collate<_CharT>::do_hash(const char_type* lo, const char_type* hi) const
|
||||
return static_cast<long>(h);
|
||||
}
|
||||
|
||||
extern template class collate<char>;
|
||||
extern template class collate<wchar_t>;
|
||||
extern template class _LIBCPP_VISIBLE collate<char>;
|
||||
extern template class _LIBCPP_VISIBLE collate<wchar_t>;
|
||||
|
||||
// template <class CharT> class collate_byname;
|
||||
|
||||
template <class _CharT> class collate_byname;
|
||||
template <class _CharT> class _LIBCPP_VISIBLE collate_byname;
|
||||
|
||||
template <>
|
||||
class collate_byname<char>
|
||||
class _LIBCPP_VISIBLE collate_byname<char>
|
||||
: public collate<char>
|
||||
{
|
||||
locale_t __l;
|
||||
@@ -262,7 +268,7 @@ protected:
|
||||
};
|
||||
|
||||
template <>
|
||||
class collate_byname<wchar_t>
|
||||
class _LIBCPP_VISIBLE collate_byname<wchar_t>
|
||||
: public collate<wchar_t>
|
||||
{
|
||||
locale_t __l;
|
||||
@@ -293,7 +299,8 @@ locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
|
||||
|
||||
// template <class charT> class ctype
|
||||
|
||||
class ctype_base {
|
||||
class _LIBCPP_VISIBLE ctype_base
|
||||
{
|
||||
public:
|
||||
typedef __uint32_t mask;
|
||||
|
||||
@@ -326,10 +333,10 @@ public:
|
||||
_LIBCPP_ALWAYS_INLINE ctype_base() {}
|
||||
};
|
||||
|
||||
template <class _CharT> class ctype;
|
||||
template <class _CharT> class _LIBCPP_VISIBLE ctype;
|
||||
|
||||
template <>
|
||||
class ctype<wchar_t>
|
||||
class _LIBCPP_VISIBLE ctype<wchar_t>
|
||||
: public locale::facet,
|
||||
public ctype_base
|
||||
{
|
||||
@@ -431,7 +438,7 @@ protected:
|
||||
};
|
||||
|
||||
template <>
|
||||
class ctype<char>
|
||||
class _LIBCPP_VISIBLE ctype<char>
|
||||
: public locale::facet, public ctype_base
|
||||
{
|
||||
const mask* __tab_;
|
||||
@@ -444,7 +451,7 @@ public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool is(mask __m, char_type __c) const
|
||||
{
|
||||
return isascii(__c) ? __tab_[__c] & __m : false;
|
||||
return isascii(__c) ? (__tab_ ? __tab_[__c] & __m : isctype(__c, __m)) : false;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
@@ -528,8 +535,8 @@ public:
|
||||
#else
|
||||
static const size_t table_size = 256; // FIXME: Don't hardcode this.
|
||||
#endif
|
||||
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;
|
||||
|
||||
protected:
|
||||
~ctype();
|
||||
@@ -545,10 +552,10 @@ protected:
|
||||
|
||||
// template <class CharT> class ctype_byname;
|
||||
|
||||
template <class _CharT> class ctype_byname;
|
||||
template <class _CharT> class _LIBCPP_VISIBLE ctype_byname;
|
||||
|
||||
template <>
|
||||
class ctype_byname<char>
|
||||
class _LIBCPP_VISIBLE ctype_byname<char>
|
||||
: public ctype<char>
|
||||
{
|
||||
locale_t __l;
|
||||
@@ -566,7 +573,7 @@ protected:
|
||||
};
|
||||
|
||||
template <>
|
||||
class ctype_byname<wchar_t>
|
||||
class _LIBCPP_VISIBLE ctype_byname<wchar_t>
|
||||
: public ctype<wchar_t>
|
||||
{
|
||||
locale_t __l;
|
||||
@@ -697,7 +704,7 @@ tolower(_CharT __c, const locale& __loc)
|
||||
|
||||
// codecvt_base
|
||||
|
||||
class codecvt_base
|
||||
class _LIBCPP_VISIBLE codecvt_base
|
||||
{
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE codecvt_base() {}
|
||||
@@ -706,12 +713,12 @@ public:
|
||||
|
||||
// template <class internT, class externT, class stateT> class codecvt;
|
||||
|
||||
template <class _InternT, class _ExternT, class _StateT> class codecvt;
|
||||
template <class _InternT, class _ExternT, class _StateT> class _LIBCPP_VISIBLE codecvt;
|
||||
|
||||
// template <> class codecvt<char, char, mbstate_t>
|
||||
|
||||
template <>
|
||||
class codecvt<char, char, mbstate_t>
|
||||
class _LIBCPP_VISIBLE codecvt<char, char, mbstate_t>
|
||||
: public locale::facet,
|
||||
public codecvt_base
|
||||
{
|
||||
@@ -748,13 +755,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();
|
||||
}
|
||||
@@ -766,7 +773,7 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
int max_length() const throw()
|
||||
int max_length() const _NOEXCEPT
|
||||
{
|
||||
return do_max_length();
|
||||
}
|
||||
@@ -788,16 +795,16 @@ 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>
|
||||
|
||||
template <>
|
||||
class codecvt<wchar_t, char, mbstate_t>
|
||||
class _LIBCPP_VISIBLE codecvt<wchar_t, char, mbstate_t>
|
||||
: public locale::facet,
|
||||
public codecvt_base
|
||||
{
|
||||
@@ -833,13 +840,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();
|
||||
}
|
||||
@@ -851,7 +858,7 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
int max_length() const throw()
|
||||
int max_length() const _NOEXCEPT
|
||||
{
|
||||
return do_max_length();
|
||||
}
|
||||
@@ -871,16 +878,16 @@ 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>
|
||||
|
||||
template <>
|
||||
class codecvt<char16_t, char, mbstate_t>
|
||||
class _LIBCPP_VISIBLE codecvt<char16_t, char, mbstate_t>
|
||||
: public locale::facet,
|
||||
public codecvt_base
|
||||
{
|
||||
@@ -917,13 +924,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();
|
||||
}
|
||||
@@ -935,7 +942,7 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
int max_length() const throw()
|
||||
int max_length() const _NOEXCEPT
|
||||
{
|
||||
return do_max_length();
|
||||
}
|
||||
@@ -957,16 +964,16 @@ 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>
|
||||
|
||||
template <>
|
||||
class codecvt<char32_t, char, mbstate_t>
|
||||
class _LIBCPP_VISIBLE codecvt<char32_t, char, mbstate_t>
|
||||
: public locale::facet,
|
||||
public codecvt_base
|
||||
{
|
||||
@@ -1003,13 +1010,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();
|
||||
}
|
||||
@@ -1021,7 +1028,7 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
int max_length() const throw()
|
||||
int max_length() const _NOEXCEPT
|
||||
{
|
||||
return do_max_length();
|
||||
}
|
||||
@@ -1043,21 +1050,23 @@ 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
|
||||
|
||||
template <class _InternT, class _ExternT, class _StateT>
|
||||
class codecvt_byname
|
||||
class _LIBCPP_VISIBLE codecvt_byname
|
||||
: public codecvt<_InternT, _ExternT, _StateT>
|
||||
{
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit codecvt_byname(const char* __nm, size_t __refs = 0)
|
||||
: codecvt<_InternT, _ExternT, _StateT>(__nm, __refs) {}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit codecvt_byname(const string& __nm, size_t __refs = 0)
|
||||
: codecvt<_InternT, _ExternT, _StateT>(__nm.c_str(), __refs) {}
|
||||
protected:
|
||||
@@ -1074,7 +1083,7 @@ extern template class codecvt_byname<wchar_t, char, mbstate_t>;
|
||||
extern template class codecvt_byname<char16_t, char, mbstate_t>;
|
||||
extern template class codecvt_byname<char32_t, char, mbstate_t>;
|
||||
|
||||
void __throw_runtime_error(const char*);
|
||||
_LIBCPP_VISIBLE void __throw_runtime_error(const char*);
|
||||
|
||||
template <size_t _N>
|
||||
struct __narrow_to_utf8
|
||||
@@ -1258,10 +1267,10 @@ struct __widen_from_utf8<32>
|
||||
|
||||
// template <class charT> class numpunct
|
||||
|
||||
template <class _CharT> class numpunct;
|
||||
template <class _CharT> class _LIBCPP_VISIBLE numpunct;
|
||||
|
||||
template <>
|
||||
class numpunct<char>
|
||||
class _LIBCPP_VISIBLE numpunct<char>
|
||||
: public locale::facet
|
||||
{
|
||||
public:
|
||||
@@ -1292,7 +1301,7 @@ protected:
|
||||
};
|
||||
|
||||
template <>
|
||||
class numpunct<wchar_t>
|
||||
class _LIBCPP_VISIBLE numpunct<wchar_t>
|
||||
: public locale::facet
|
||||
{
|
||||
public:
|
||||
@@ -1324,10 +1333,10 @@ protected:
|
||||
|
||||
// template <class charT> class numpunct_byname
|
||||
|
||||
template <class charT> class numpunct_byname;
|
||||
template <class charT> class _LIBCPP_VISIBLE numpunct_byname;
|
||||
|
||||
template <>
|
||||
class numpunct_byname<char>
|
||||
class _LIBCPP_VISIBLE numpunct_byname<char>
|
||||
: public numpunct<char>
|
||||
{
|
||||
public:
|
||||
@@ -1345,7 +1354,7 @@ private:
|
||||
};
|
||||
|
||||
template <>
|
||||
class numpunct_byname<wchar_t>
|
||||
class _LIBCPP_VISIBLE numpunct_byname<wchar_t>
|
||||
: public numpunct<wchar_t>
|
||||
{
|
||||
public:
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -18,13 +18,24 @@
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#ifdef _LIBCPP_SHARED_LOCK
|
||||
|
||||
namespace ting {
|
||||
template <class> class shared_lock;
|
||||
template <class> class upgrade_lock;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_SHARED_LOCK
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class mutex
|
||||
class _LIBCPP_VISIBLE mutex
|
||||
{
|
||||
pthread_mutex_t __m_;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
mutex() {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}
|
||||
~mutex();
|
||||
|
||||
@@ -38,12 +49,12 @@ public:
|
||||
void unlock();
|
||||
|
||||
typedef pthread_mutex_t* native_handle_type;
|
||||
native_handle_type native_handle() {return &__m_;}
|
||||
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;}
|
||||
};
|
||||
|
||||
struct defer_lock_t {};
|
||||
struct try_to_lock_t {};
|
||||
struct adopt_lock_t {};
|
||||
struct _LIBCPP_VISIBLE defer_lock_t {};
|
||||
struct _LIBCPP_VISIBLE try_to_lock_t {};
|
||||
struct _LIBCPP_VISIBLE adopt_lock_t {};
|
||||
|
||||
//constexpr
|
||||
extern const
|
||||
@@ -58,7 +69,7 @@ extern const
|
||||
adopt_lock_t adopt_lock;
|
||||
|
||||
template <class _Mutex>
|
||||
class lock_guard
|
||||
class _LIBCPP_VISIBLE lock_guard
|
||||
{
|
||||
public:
|
||||
typedef _Mutex mutex_type;
|
||||
@@ -67,10 +78,13 @@ private:
|
||||
mutex_type& __m_;
|
||||
public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit lock_guard(mutex_type& __m)
|
||||
: __m_(__m) {__m_.lock();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
lock_guard(mutex_type& __m, adopt_lock_t)
|
||||
: __m_(__m) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~lock_guard() {__m_.unlock();}
|
||||
|
||||
private:
|
||||
@@ -79,7 +93,7 @@ private:
|
||||
};
|
||||
|
||||
template <class _Mutex>
|
||||
class unique_lock
|
||||
class _LIBCPP_VISIBLE unique_lock
|
||||
{
|
||||
public:
|
||||
typedef _Mutex mutex_type;
|
||||
@@ -89,21 +103,29 @@ private:
|
||||
bool __owns_;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock() : __m_(nullptr), __owns_(false) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit unique_lock(mutex_type& __m)
|
||||
: __m_(&__m), __owns_(true) {__m_->lock();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, defer_lock_t)
|
||||
: __m_(&__m), __owns_(false) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, try_to_lock_t)
|
||||
: __m_(&__m), __owns_(__m.try_lock()) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, adopt_lock_t)
|
||||
: __m_(&__m), __owns_(true) {}
|
||||
template <class _Clock, class _Duration>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, const chrono::time_point<_Clock, _Duration>& __t)
|
||||
: __m_(&__m), __owns_(__m.try_lock_until(__t)) {}
|
||||
template <class _Rep, class _Period>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, const chrono::duration<_Rep, _Period>& __d)
|
||||
: __m_(&__m), __owns_(__m.try_lock_for(__d)) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~unique_lock()
|
||||
{
|
||||
if (__owns_)
|
||||
@@ -115,10 +137,12 @@ private:
|
||||
unique_lock& operator=(unique_lock const&); // = delete;
|
||||
|
||||
public:
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(unique_lock&& __u)
|
||||
: __m_(__u.__m_), __owns_(__u.__owns_)
|
||||
{__u.__m_ = nullptr; __u.__owns_ = false;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock& operator=(unique_lock&& __u)
|
||||
{
|
||||
if (__owns_)
|
||||
@@ -129,7 +153,29 @@ public:
|
||||
__u.__owns_ = false;
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_MOVE
|
||||
|
||||
#ifdef _LIBCPP_SHARED_LOCK
|
||||
|
||||
unique_lock(ting::shared_lock<mutex_type>&&, try_to_lock_t);
|
||||
template <class _Clock, class _Duration>
|
||||
unique_lock(ting::shared_lock<mutex_type>&&,
|
||||
const chrono::time_point<_Clock, _Duration>&);
|
||||
template <class _Rep, class _Period>
|
||||
unique_lock(ting::shared_lock<mutex_type>&&,
|
||||
const chrono::duration<_Rep, _Period>&);
|
||||
|
||||
explicit unique_lock(ting::upgrade_lock<mutex_type>&&);
|
||||
unique_lock(ting::upgrade_lock<mutex_type>&&, try_to_lock_t);
|
||||
template <class _Clock, class _Duration>
|
||||
unique_lock(ting::upgrade_lock<mutex_type>&&,
|
||||
const chrono::time_point<_Clock, _Duration>&);
|
||||
template <class _Rep, class _Period>
|
||||
unique_lock(ting::upgrade_lock<mutex_type>&&,
|
||||
const chrono::duration<_Rep, _Period>&);
|
||||
|
||||
#endif // _LIBCPP_SHARED_LOCK
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
void lock();
|
||||
bool try_lock();
|
||||
@@ -141,11 +187,13 @@ public:
|
||||
|
||||
void unlock();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(unique_lock& __u)
|
||||
{
|
||||
_STD::swap(__m_, __u.__m_);
|
||||
_STD::swap(__owns_, __u.__owns_);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
mutex_type* release()
|
||||
{
|
||||
mutex_type* __m = __m_;
|
||||
@@ -154,9 +202,12 @@ public:
|
||||
return __m;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool owns_lock() const {return __owns_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
// explicit
|
||||
operator bool () const {return __owns_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
mutex_type* mutex() const {return __m_;}
|
||||
};
|
||||
|
||||
@@ -221,11 +272,11 @@ unique_lock<_Mutex>::unlock()
|
||||
}
|
||||
|
||||
template <class _Mutex>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) {__x.swap(__y);}
|
||||
|
||||
struct cv_status
|
||||
struct _LIBCPP_VISIBLE cv_status
|
||||
{
|
||||
enum _ {
|
||||
no_timeout,
|
||||
@@ -234,15 +285,16 @@ struct cv_status
|
||||
|
||||
_ __v_;
|
||||
|
||||
cv_status(_ __v) : __v_(__v) {}
|
||||
operator int() const {return __v_;}
|
||||
_LIBCPP_INLINE_VISIBILITY cv_status(_ __v) : __v_(__v) {}
|
||||
_LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;}
|
||||
|
||||
};
|
||||
|
||||
class condition_variable
|
||||
class _LIBCPP_VISIBLE condition_variable
|
||||
{
|
||||
pthread_cond_t __cv_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
condition_variable() {__cv_ = (pthread_cond_t)PTHREAD_COND_INITIALIZER;}
|
||||
~condition_variable();
|
||||
|
||||
@@ -286,7 +338,7 @@ public:
|
||||
_Predicate __pred);
|
||||
|
||||
typedef pthread_cond_t* native_handle_type;
|
||||
native_handle_type native_handle() {return &__cv_;}
|
||||
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__cv_;}
|
||||
|
||||
private:
|
||||
void __do_timed_wait(unique_lock<mutex>& __lk,
|
||||
@@ -294,7 +346,7 @@ private:
|
||||
};
|
||||
|
||||
template <class _To, class _Rep, class _Period>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
chrono::__is_duration<_To>::value,
|
||||
@@ -362,21 +414,21 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
|
||||
const chrono::duration<_Rep, _Period>& __d)
|
||||
{
|
||||
using namespace chrono;
|
||||
system_clock::time_point __s_now = system_clock::now();
|
||||
monotonic_clock::time_point __c_now = monotonic_clock::now();
|
||||
system_clock::time_point __s_now = system_clock::now();
|
||||
steady_clock::time_point __c_now = steady_clock::now();
|
||||
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d));
|
||||
return monotonic_clock::now() - __c_now < __d ? cv_status::no_timeout :
|
||||
cv_status::timeout;
|
||||
return steady_clock::now() - __c_now < __d ? cv_status::no_timeout :
|
||||
cv_status::timeout;
|
||||
}
|
||||
|
||||
template <class _Rep, class _Period, class _Predicate>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
condition_variable::wait_for(unique_lock<mutex>& __lk,
|
||||
const chrono::duration<_Rep, _Period>& __d,
|
||||
_Predicate __pred)
|
||||
{
|
||||
return wait_until(__lk, chrono::monotonic_clock::now() + __d,
|
||||
return wait_until(__lk, chrono::steady_clock::now() + __d,
|
||||
_STD::move(__pred));
|
||||
}
|
||||
|
||||
|
@@ -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();
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
__split_buffer(__split_buffer&& __c);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__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);
|
||||
#endif // _LIBCPP_MOVE
|
||||
__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);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#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_MOVE
|
||||
#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
|
||||
<
|
||||
@@ -118,38 +123,51 @@ public:
|
||||
__construct_at_end(_ForwardIterator __first, _ForwardIterator __last);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin)
|
||||
{__destruct_at_begin(__new_begin, has_trivial_destructor<value_type>());}
|
||||
{__destruct_at_begin(__new_begin, is_trivially_destructible<value_type>());}
|
||||
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)
|
||||
{__destruct_at_end(__new_last, has_trivial_destructor<value_type>());}
|
||||
void __destruct_at_end(pointer __new_last, false_type);
|
||||
void __destruct_at_end(pointer __new_last, true_type);
|
||||
_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) _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());
|
||||
}
|
||||
|
||||
void __move_assign_alloc(const __split_buffer& __c, false_type)
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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;
|
||||
swap(__x, __y);
|
||||
}
|
||||
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, false_type)
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, false_type) _NOEXCEPT
|
||||
{}
|
||||
};
|
||||
|
||||
@@ -184,16 +202,8 @@ __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
|
||||
@@ -204,15 +214,6 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, false_type)
|
||||
} 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
|
||||
@@ -220,17 +221,8 @@ __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, has_trivial_copy_constructor<value_type>::value &&
|
||||
has_trivial_copy_assign<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
|
||||
@@ -241,15 +233,6 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_referen
|
||||
} 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
|
||||
@@ -315,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_);
|
||||
@@ -324,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;
|
||||
}
|
||||
@@ -341,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)
|
||||
{
|
||||
}
|
||||
@@ -367,10 +351,11 @@ __split_buffer<_Tp, _Allocator>::~__split_buffer()
|
||||
__alloc_traits::deallocate(__alloc(), __first_, capacity());
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
|
||||
: __first_(_STD::move(__c.__first_)),
|
||||
__begin_(_STD::move(__c.__begin_)),
|
||||
__end_(_STD::move(__c.__end_)),
|
||||
@@ -411,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();
|
||||
@@ -425,11 +413,13 @@ __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
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_);
|
||||
@@ -456,7 +446,7 @@ __split_buffer<_Tp, _Allocator>::reserve(size_type __n)
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::shrink_to_fit()
|
||||
__split_buffer<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
|
||||
{
|
||||
if (capacity() > size())
|
||||
{
|
||||
@@ -510,7 +500,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
|
||||
--__begin_;
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
@@ -542,7 +532,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
|
||||
--__begin_;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
@@ -574,7 +564,7 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
|
||||
++__end_;
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
@@ -606,6 +596,8 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
|
||||
++__end_;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class... _Args>
|
||||
void
|
||||
@@ -637,7 +629,19 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
|
||||
++__end_;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#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
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -64,7 +64,9 @@ public:
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(__sso_allocator& __a) const {return &buf_ == &__a.buf_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(__sso_allocator& __a) const {return &buf_ != &__a.buf_;}
|
||||
};
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -97,7 +97,7 @@ typename __stdinbuf<_CharT>::int_type
|
||||
__stdinbuf<_CharT>::__getchar(bool __consume)
|
||||
{
|
||||
char __extbuf[__limit];
|
||||
int __nread = max(1, __encoding_);
|
||||
int __nread = _STD::max(1, __encoding_);
|
||||
for (int __i = 0; __i < __nread; ++__i)
|
||||
{
|
||||
char __c = getc(__file_);
|
||||
@@ -288,12 +288,12 @@ __stdoutbuf<_CharT>::sync()
|
||||
__r = __cv_->unshift(__st_, __extbuf,
|
||||
__extbuf + sizeof(__extbuf),
|
||||
__extbe);
|
||||
if (__r == codecvt_base::error)
|
||||
return -1;
|
||||
size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);
|
||||
if (fwrite(__extbuf, 1, __nmemb, __file_) != __nmemb)
|
||||
return -1;
|
||||
} while (__r == codecvt_base::partial);
|
||||
if (__r == codecvt_base::error)
|
||||
return -1;
|
||||
if (fflush(__file_))
|
||||
return -1;
|
||||
return 0;
|
||||
|
400
include/__tree
400
include/__tree
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -22,12 +22,12 @@
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class, class, class> class __tree;
|
||||
template <class, class, class> class __tree_iterator;
|
||||
template <class, class, class> class __tree_const_iterator;
|
||||
template <class, class, class, class> class map;
|
||||
template <class, class, class, class> class multimap;
|
||||
template <class, class, class> class set;
|
||||
template <class, class, class> class multiset;
|
||||
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;
|
||||
|
||||
/*
|
||||
|
||||
@@ -53,9 +53,9 @@ __root, have a non-null __parent_ field.
|
||||
// Returns: true if __x is a left child of its parent, else false
|
||||
// Precondition: __x != nullptr.
|
||||
template <class _NodePtr>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
__tree_is_left_child(_NodePtr __x)
|
||||
__tree_is_left_child(_NodePtr __x) _NOEXCEPT
|
||||
{
|
||||
return __x == __x->__parent_->__left_;
|
||||
}
|
||||
@@ -119,9 +119,9 @@ __tree_invariant(_NodePtr __root)
|
||||
// Returns: pointer to the left-most node under __x.
|
||||
// Precondition: __x != nullptr.
|
||||
template <class _NodePtr>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_NodePtr
|
||||
__tree_min(_NodePtr __x)
|
||||
__tree_min(_NodePtr __x) _NOEXCEPT
|
||||
{
|
||||
while (__x->__left_ != nullptr)
|
||||
__x = __x->__left_;
|
||||
@@ -131,9 +131,9 @@ __tree_min(_NodePtr __x)
|
||||
// Returns: pointer to the right-most node under __x.
|
||||
// Precondition: __x != nullptr.
|
||||
template <class _NodePtr>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_NodePtr
|
||||
__tree_max(_NodePtr __x)
|
||||
__tree_max(_NodePtr __x) _NOEXCEPT
|
||||
{
|
||||
while (__x->__right_ != nullptr)
|
||||
__x = __x->__right_;
|
||||
@@ -144,7 +144,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 +157,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 +170,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 +194,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 +214,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 +239,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 +309,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).
|
||||
@@ -513,15 +513,17 @@ private:
|
||||
public:
|
||||
bool __value_constructed;
|
||||
|
||||
explicit __tree_node_destructor(allocator_type& __na)
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __tree_node_destructor(allocator_type& __na) _NOEXCEPT
|
||||
: __na_(__na),
|
||||
__value_constructed(false)
|
||||
{}
|
||||
|
||||
void operator()(pointer __p)
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void operator()(pointer __p) _NOEXCEPT
|
||||
{
|
||||
if (__value_constructed)
|
||||
__alloc_traits::destroy(__na_, addressof(__p->__value_));
|
||||
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_));
|
||||
if (__p)
|
||||
__alloc_traits::deallocate(__na_, __p, 1);
|
||||
}
|
||||
@@ -538,7 +540,8 @@ public:
|
||||
typedef _Pointer pointer;
|
||||
pointer __left_;
|
||||
|
||||
__tree_end_node() : __left_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tree_end_node() _NOEXCEPT : __left_() {}
|
||||
};
|
||||
|
||||
template <class _VoidPtr>
|
||||
@@ -576,7 +579,9 @@ public:
|
||||
pointer __parent_;
|
||||
bool __is_black_;
|
||||
|
||||
__tree_node_base() : __right_(), __parent_(), __is_black_(false) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tree_node_base() _NOEXCEPT
|
||||
: __right_(), __parent_(), __is_black_(false) {}
|
||||
};
|
||||
|
||||
template <class _Tp, class _VoidPtr>
|
||||
@@ -589,21 +594,23 @@ public:
|
||||
|
||||
value_type __value_;
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
template <class ..._Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __tree_node(_Args&& ...__args)
|
||||
: __value_(_STD::forward<_Args>(__args)...) {}
|
||||
#else // _LIBCPP_MOVE
|
||||
#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __tree_node(const value_type& __v)
|
||||
: __value_(__v) {}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#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 _Tp, class _NodePtr, class _DiffType>
|
||||
class __tree_iterator
|
||||
class _LIBCPP_VISIBLE __tree_iterator
|
||||
{
|
||||
typedef _NodePtr __node_pointer;
|
||||
typedef typename pointer_traits<__node_pointer>::element_type __node;
|
||||
@@ -626,41 +633,48 @@ public:
|
||||
#endif
|
||||
pointer;
|
||||
|
||||
__tree_iterator() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __tree_iterator() _NOEXCEPT {}
|
||||
|
||||
reference operator*() const {return __ptr_->__value_;}
|
||||
pointer operator->() const {return &__ptr_->__value_;}
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
|
||||
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tree_iterator& operator++()
|
||||
{__ptr_ = static_cast<__node_pointer>(__tree_next(static_cast<__node_base_pointer>(__ptr_)));
|
||||
return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tree_iterator operator++(int)
|
||||
{__tree_iterator __t(*this); ++(*this); return __t;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tree_iterator& operator--()
|
||||
{__ptr_ = static_cast<__node_pointer>(__tree_prev(static_cast<__node_base_pointer>(__ptr_)));
|
||||
return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tree_iterator operator--(int)
|
||||
{__tree_iterator __t(*this); --(*this); return __t;}
|
||||
|
||||
friend bool operator==(const __tree_iterator& __x, const __tree_iterator& __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(const __tree_iterator& __x, const __tree_iterator& __y)
|
||||
{return __x.__ptr_ == __y.__ptr_;}
|
||||
friend bool operator!=(const __tree_iterator& __x, const __tree_iterator& __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(const __tree_iterator& __x, const __tree_iterator& __y)
|
||||
{return !(__x == __y);}
|
||||
|
||||
private:
|
||||
explicit __tree_iterator(__node_pointer __p) : __ptr_(__p) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __tree_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
|
||||
template <class, class, class> friend class __tree;
|
||||
template <class, class, class> friend class __tree_const_iterator;
|
||||
template <class> friend class __map_iterator;
|
||||
template <class, class, class, class> friend class map;
|
||||
template <class, class, class, class> friend class multimap;
|
||||
template <class, class, class> friend class set;
|
||||
template <class, class, class> friend class multiset;
|
||||
template <class, class, class> friend class _LIBCPP_VISIBLE __tree_const_iterator;
|
||||
template <class> friend class _LIBCPP_VISIBLE __map_iterator;
|
||||
template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
|
||||
template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
|
||||
template <class, class, class> friend class _LIBCPP_VISIBLE set;
|
||||
template <class, class, class> friend class _LIBCPP_VISIBLE multiset;
|
||||
};
|
||||
|
||||
template <class _Tp, class _ConstNodePtr, class _DiffType>
|
||||
class __tree_const_iterator
|
||||
class _LIBCPP_VISIBLE __tree_const_iterator
|
||||
{
|
||||
typedef _ConstNodePtr __node_pointer;
|
||||
typedef typename pointer_traits<__node_pointer>::element_type __node;
|
||||
@@ -689,7 +703,7 @@ public:
|
||||
#endif
|
||||
pointer;
|
||||
|
||||
__tree_const_iterator() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __tree_const_iterator() {}
|
||||
private:
|
||||
typedef typename remove_const<__node>::type __non_const_node;
|
||||
typedef typename pointer_traits<__node_pointer>::template
|
||||
@@ -702,36 +716,46 @@ private:
|
||||
typedef __tree_iterator<value_type, __non_const_node_pointer, difference_type>
|
||||
__non_const_iterator;
|
||||
public:
|
||||
__tree_const_iterator(__non_const_iterator __p) : __ptr_(__p.__ptr_) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tree_const_iterator(__non_const_iterator __p) _NOEXCEPT
|
||||
: __ptr_(__p.__ptr_) {}
|
||||
|
||||
reference operator*() const {return __ptr_->__value_;}
|
||||
pointer operator->() const {return &__ptr_->__value_;}
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
|
||||
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tree_const_iterator& operator++()
|
||||
{__ptr_ = static_cast<__node_pointer>(__tree_next(static_cast<__node_base_pointer>(__ptr_)));
|
||||
return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tree_const_iterator operator++(int)
|
||||
{__tree_const_iterator __t(*this); ++(*this); return __t;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tree_const_iterator& operator--()
|
||||
{__ptr_ = static_cast<__node_pointer>(__tree_prev(static_cast<__node_base_pointer>(__ptr_)));
|
||||
return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tree_const_iterator operator--(int)
|
||||
{__tree_const_iterator __t(*this); --(*this); return __t;}
|
||||
|
||||
friend bool operator==(const __tree_const_iterator& __x, const __tree_const_iterator& __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(const __tree_const_iterator& __x, const __tree_const_iterator& __y)
|
||||
{return __x.__ptr_ == __y.__ptr_;}
|
||||
friend bool operator!=(const __tree_const_iterator& __x, const __tree_const_iterator& __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(const __tree_const_iterator& __x, const __tree_const_iterator& __y)
|
||||
{return !(__x == __y);}
|
||||
|
||||
private:
|
||||
explicit __tree_const_iterator(__node_pointer __p) : __ptr_(__p) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __tree_const_iterator(__node_pointer __p) _NOEXCEPT
|
||||
: __ptr_(__p) {}
|
||||
template <class, class, class> friend class __tree;
|
||||
template <class, class, class, class> friend class map;
|
||||
template <class, class, class, class> friend class multimap;
|
||||
template <class, class, class> friend class set;
|
||||
template <class, class, class> friend class multiset;
|
||||
template <class> friend class __map_const_iterator;
|
||||
template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
|
||||
template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
|
||||
template <class, class, class> friend class _LIBCPP_VISIBLE set;
|
||||
template <class, class, class> friend class _LIBCPP_VISIBLE multiset;
|
||||
template <class> friend class _LIBCPP_VISIBLE __map_const_iterator;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
@@ -748,6 +772,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>
|
||||
@@ -758,10 +783,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>
|
||||
@@ -782,43 +807,62 @@ private:
|
||||
__compressed_pair<size_type, value_compare> __pair3_;
|
||||
|
||||
public:
|
||||
__node_pointer __end_node()
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__node_pointer __end_node() _NOEXCEPT
|
||||
{
|
||||
return static_cast<__node_pointer>
|
||||
(
|
||||
pointer_traits<__end_node_ptr>::pointer_to(__pair1_.first())
|
||||
);
|
||||
}
|
||||
__node_const_pointer __end_node() const
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__node_const_pointer __end_node() const _NOEXCEPT
|
||||
{
|
||||
return static_cast<__node_const_pointer>
|
||||
(
|
||||
pointer_traits<__end_node_const_ptr>::pointer_to(__pair1_.first())
|
||||
);
|
||||
}
|
||||
__node_allocator& __node_alloc() {return __pair1_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__node_allocator& __node_alloc() _NOEXCEPT {return __pair1_.second();}
|
||||
private:
|
||||
const __node_allocator& __node_alloc() const {return __pair1_.second();}
|
||||
__node_pointer& __begin_node() {return __begin_node_;}
|
||||
const __node_pointer& __begin_node() const {return __begin_node_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const __node_allocator& __node_alloc() const _NOEXCEPT
|
||||
{return __pair1_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__node_pointer& __begin_node() _NOEXCEPT {return __begin_node_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const __node_pointer& __begin_node() const _NOEXCEPT {return __begin_node_;}
|
||||
public:
|
||||
allocator_type __alloc() const {return allocator_type(__node_alloc());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type __alloc() const _NOEXCEPT
|
||||
{return allocator_type(__node_alloc());}
|
||||
private:
|
||||
size_type& size() {return __pair3_.first();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type& size() _NOEXCEPT {return __pair3_.first();}
|
||||
public:
|
||||
const size_type& size() const {return __pair3_.first();}
|
||||
value_compare& value_comp() {return __pair3_.second();}
|
||||
const value_compare& value_comp() const {return __pair3_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const size_type& size() const _NOEXCEPT {return __pair3_.first();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_compare& value_comp() _NOEXCEPT {return __pair3_.second();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const value_compare& value_comp() const _NOEXCEPT
|
||||
{return __pair3_.second();}
|
||||
public:
|
||||
__node_pointer __root()
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__node_pointer __root() _NOEXCEPT
|
||||
{return static_cast<__node_pointer> (__end_node()->__left_);}
|
||||
__node_const_pointer __root() const
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__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);
|
||||
@@ -827,26 +871,44 @@ public:
|
||||
void __assign_unique(_InputIterator __first, _InputIterator __last);
|
||||
template <class _InputIterator>
|
||||
void __assign_multi(_InputIterator __first, _InputIterator __last);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
__tree(__tree&& __t);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__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);
|
||||
#endif // _LIBCPP_MOVE
|
||||
__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();
|
||||
|
||||
iterator begin() {return iterator(__begin_node());}
|
||||
const_iterator begin() const {return const_iterator(__begin_node());}
|
||||
iterator end() {return iterator(__end_node());}
|
||||
const_iterator end() const {return const_iterator(__end_node());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() _NOEXCEPT {return iterator(__begin_node());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const _NOEXCEPT {return const_iterator(__begin_node());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() _NOEXCEPT {return iterator(__end_node());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const _NOEXCEPT {return const_iterator(__end_node());}
|
||||
|
||||
size_type max_size() const {return __node_traits::max_size(__node_alloc());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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));
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class... _Args>
|
||||
pair<iterator, bool>
|
||||
__emplace_unique(_Args&&... __args);
|
||||
@@ -860,6 +922,7 @@ public:
|
||||
template <class... _Args>
|
||||
iterator
|
||||
__emplace_hint_multi(const_iterator __p, _Args&&... __args);
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _V>
|
||||
pair<iterator, bool> __insert_unique(_V&& __v);
|
||||
@@ -869,13 +932,12 @@ public:
|
||||
iterator __insert_multi(_V&& __v);
|
||||
template <class _V>
|
||||
iterator __insert_multi(const_iterator __p, _V&& __v);
|
||||
#else // _LIBCPP_MOVE
|
||||
#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_MOVE
|
||||
|
||||
pair<iterator, bool> __node_insert_unique(__node_pointer __nd);
|
||||
iterator __node_insert_unique(const_iterator __p,
|
||||
@@ -906,6 +968,7 @@ public:
|
||||
size_type __count_multi(const _Key& __k) const;
|
||||
|
||||
template <class _Key>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator lower_bound(const _Key& __v)
|
||||
{return __lower_bound(__v, __root(), __end_node());}
|
||||
template <class _Key>
|
||||
@@ -913,6 +976,7 @@ public:
|
||||
__node_pointer __root,
|
||||
__node_pointer __result);
|
||||
template <class _Key>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator lower_bound(const _Key& __v) const
|
||||
{return __lower_bound(__v, __root(), __end_node());}
|
||||
template <class _Key>
|
||||
@@ -920,6 +984,7 @@ public:
|
||||
__node_const_pointer __root,
|
||||
__node_const_pointer __result) const;
|
||||
template <class _Key>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator upper_bound(const _Key& __v)
|
||||
{return __upper_bound(__v, __root(), __end_node());}
|
||||
template <class _Key>
|
||||
@@ -927,6 +992,7 @@ public:
|
||||
__node_pointer __root,
|
||||
__node_pointer __result);
|
||||
template <class _Key>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator upper_bound(const _Key& __v) const
|
||||
{return __upper_bound(__v, __root(), __end_node());}
|
||||
template <class _Key>
|
||||
@@ -950,60 +1016,80 @@ 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);
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
template <class ..._Args>
|
||||
__node_holder __construct_node(_Args&& ...__args);
|
||||
#else // _LIBCPP_MOVE
|
||||
#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
__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)
|
||||
{__copy_assign_alloc(__t, integral_constant<bool,
|
||||
__node_traits::propagate_on_container_copy_assignment::value>());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __copy_assign_alloc(const __tree& __t, true_type)
|
||||
{__node_alloc() = __t.__node_alloc();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
|
||||
{__node_alloc() = _STD::move(__t.__node_alloc());}
|
||||
void __move_assign_alloc(__tree& __t, false_type) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__tree& __t, false_type) _NOEXCEPT {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y)
|
||||
_NOEXCEPT_(
|
||||
!__node_traits::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<__node_allocator>::value)
|
||||
{__swap_alloc(__x, __y, integral_constant<bool,
|
||||
__node_traits::propagate_on_container_swap::value>());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, true_type)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<__node_allocator>::value)
|
||||
{
|
||||
using _STD::swap;
|
||||
swap(__x, __y);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, false_type)
|
||||
_NOEXCEPT
|
||||
{}
|
||||
|
||||
__node_pointer __detach();
|
||||
@@ -1012,6 +1098,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();
|
||||
@@ -1182,10 +1271,13 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
|
||||
__begin_node() = __end_node();
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
|
||||
_NOEXCEPT_(
|
||||
is_nothrow_move_constructible<__node_allocator>::value &&
|
||||
is_nothrow_move_constructible<value_compare>::value)
|
||||
: __begin_node_(_STD::move(__t.__begin_node_)),
|
||||
__pair1_(_STD::move(__t.__pair1_)),
|
||||
__pair3_(_STD::move(__t.__pair3_))
|
||||
@@ -1230,6 +1322,8 @@ __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_;
|
||||
@@ -1296,13 +1390,18 @@ __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type)
|
||||
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>());
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
__tree<_Tp, _Compare, _Allocator>::~__tree()
|
||||
@@ -1312,14 +1411,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, _STD::addressof(__nd->__value_));
|
||||
__node_traits::deallocate(__na, __nd, 1);
|
||||
}
|
||||
}
|
||||
@@ -1327,6 +1426,10 @@ __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;
|
||||
swap(__begin_node_, __t.__begin_node_);
|
||||
@@ -1345,7 +1448,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;
|
||||
@@ -1357,8 +1460,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();
|
||||
@@ -1396,8 +1499,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();
|
||||
@@ -1438,9 +1541,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
|
||||
@@ -1474,8 +1577,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();
|
||||
@@ -1523,9 +1626,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
|
||||
@@ -1555,7 +1658,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
|
||||
const_iterator __next = _STD::next(__hint);
|
||||
if (__next == end() || value_comp()(__v, *__next))
|
||||
{
|
||||
// *__hint < __v < *next(__hint)
|
||||
// *__hint < __v < *_STD::next(__hint)
|
||||
if (__hint.__ptr_->__right_ == nullptr)
|
||||
{
|
||||
__parent = const_cast<__node_pointer&>(__hint.__ptr_);
|
||||
@@ -1591,7 +1694,8 @@ __tree<_Tp, _Compare, _Allocator>::__insert_node_at(__node_base_pointer __parent
|
||||
++size();
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
template <class ..._Args>
|
||||
@@ -1600,7 +1704,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, _STD::addressof(__h->__value_), _STD::forward<_Args>(__args)...);
|
||||
__h.get_deleter().__value_constructed = true;
|
||||
return __h;
|
||||
}
|
||||
@@ -1666,23 +1770,18 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p,
|
||||
return iterator(static_cast<__node_pointer>(__h.release()));
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
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(_STD::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>
|
||||
@@ -1690,16 +1789,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(_STD::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>
|
||||
@@ -1726,7 +1820,7 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, _V&& __v)
|
||||
return iterator(__h.release());
|
||||
}
|
||||
|
||||
#else // _LIBCPP_MOVE
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node_holder
|
||||
@@ -1734,11 +1828,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, _STD::addressof(__h->__value_), __v);
|
||||
__h.get_deleter().__value_constructed = true;
|
||||
return _STD::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)
|
||||
@@ -1795,8 +1891,6 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, const valu
|
||||
return iterator(__h.release());
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
|
||||
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)
|
||||
@@ -1862,7 +1956,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*>(_STD::addressof(*__p)));
|
||||
__tree_remove(__end_node()->__left_,
|
||||
static_cast<__node_base_pointer>(__np));
|
||||
__node_traits::deallocate(__na, __np, 1);
|
||||
@@ -2160,7 +2254,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)
|
||||
@@ -2176,6 +2270,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
|
||||
|
159
include/__tuple
159
include/__tuple
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -25,45 +25,92 @@
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp> class tuple_size;
|
||||
template <size_t _Ip, class _Tp> class tuple_element;
|
||||
template <class _Tp> class _LIBCPP_VISIBLE tuple_size;
|
||||
|
||||
template <class ..._Tp> class tuple;
|
||||
template <class _T1, class _T2> class pair;
|
||||
template <class _Tp, size_t _Size> struct array;
|
||||
template <class _Tp>
|
||||
class _LIBCPP_VISIBLE tuple_size<const _Tp>
|
||||
: public tuple_size<_Tp> {};
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_VISIBLE tuple_size<volatile _Tp>
|
||||
: public tuple_size<_Tp> {};
|
||||
|
||||
template <class _Tp>
|
||||
class _LIBCPP_VISIBLE tuple_size<const volatile _Tp>
|
||||
: public tuple_size<_Tp> {};
|
||||
|
||||
template <size_t _Ip, class _Tp> class _LIBCPP_VISIBLE tuple_element;
|
||||
|
||||
template <size_t _Ip, class _Tp>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, const _Tp>
|
||||
{
|
||||
public:
|
||||
typedef typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _Tp>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, volatile _Tp>
|
||||
{
|
||||
public:
|
||||
typedef typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _Tp>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, const volatile _Tp>
|
||||
{
|
||||
public:
|
||||
typedef typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
|
||||
};
|
||||
|
||||
template <class ..._Tp> class _LIBCPP_VISIBLE tuple;
|
||||
template <class _T1, class _T2> class _LIBCPP_VISIBLE pair;
|
||||
template <class _Tp, size_t _Size> struct _LIBCPP_VISIBLE array;
|
||||
|
||||
template <class _Tp> struct __tuple_like : false_type {};
|
||||
|
||||
template <class... _Tp> struct __tuple_like<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...>&&) _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>&&) _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>&&) _NOEXCEPT;
|
||||
|
||||
// __make_tuple_indices
|
||||
|
||||
@@ -96,7 +143,7 @@ struct __make_tuple_indices
|
||||
template <class ..._Tp> struct __tuple_types {};
|
||||
|
||||
template <size_t _Ip>
|
||||
class tuple_element<_Ip, __tuple_types<>>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, __tuple_types<> >
|
||||
{
|
||||
public:
|
||||
static_assert(_Ip == 0, "tuple_element index out of range");
|
||||
@@ -104,29 +151,34 @@ public:
|
||||
};
|
||||
|
||||
template <class _Hp, class ..._Tp>
|
||||
class 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 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 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
|
||||
|
||||
// __make_tuple_types<_Tuple<_Types...>, _Ep, _Sp>::type is a
|
||||
// __tuple_types<_Types...> using only those _Types in the range [_Sp, _Ep).
|
||||
// _Sp defaults to 0 and _Ep defaults to tuple_size<_Tuple>. If _Tuple is a
|
||||
// lvalue_reference type, then __tuple_types<_Types&...> is the result.
|
||||
|
||||
template <class _TupleTypes, class _Tp, size_t _Sp, size_t _Ep>
|
||||
struct __make_tuple_types_imp;
|
||||
|
||||
@@ -135,7 +187,7 @@ struct __make_tuple_types_imp<__tuple_types<_Types...>, _Tp, _Sp, _Ep>
|
||||
{
|
||||
typedef typename remove_reference<_Tp>::type _Tpr;
|
||||
typedef typename __make_tuple_types_imp<__tuple_types<_Types...,
|
||||
typename conditional<is_reference<_Tp>::value,
|
||||
typename conditional<is_lvalue_reference<_Tp>::value,
|
||||
typename tuple_element<_Sp, _Tpr>::type&,
|
||||
typename tuple_element<_Sp, _Tpr>::type>::type>,
|
||||
_Tp, _Sp+1, _Ep>::type type;
|
||||
@@ -154,45 +206,23 @@ struct __make_tuple_types
|
||||
typedef typename __make_tuple_types_imp<__tuple_types<>, _Tp, _Sp, _Ep>::type type;
|
||||
};
|
||||
|
||||
// __make_assignable_types
|
||||
|
||||
template <class _Tuple, class _Tp, size_t _Sp, size_t _Ep>
|
||||
struct __make_assignable_types_imp;
|
||||
|
||||
template <class ..._Types, class _Tp, size_t _Sp, size_t _Ep>
|
||||
struct __make_assignable_types_imp<__tuple_types<_Types...>, _Tp, _Sp, _Ep>
|
||||
{
|
||||
typedef typename __make_assignable_types_imp<__tuple_types<_Types...,
|
||||
typename remove_reference<typename tuple_element<_Sp, _Tp>::type>::type>,
|
||||
_Tp, _Sp+1, _Ep>::type type;
|
||||
};
|
||||
|
||||
template <class ..._Types, class _Tp, size_t _Ep>
|
||||
struct __make_assignable_types_imp<__tuple_types<_Types...>, _Tp, _Ep, _Ep>
|
||||
{
|
||||
typedef __tuple_types<_Types...> type;
|
||||
};
|
||||
|
||||
template <class _Tp, size_t _Ep = tuple_size<typename remove_reference<_Tp>::type>::value, size_t _Sp = 0>
|
||||
struct __make_assignable_types
|
||||
{
|
||||
static_assert(_Sp <= _Ep, "__make_assignable_types input error");
|
||||
typedef typename __make_assignable_types_imp<__tuple_types<>, typename remove_reference<_Tp>::type, _Sp, _Ep>::type type;
|
||||
};
|
||||
|
||||
// __tuple_convertible
|
||||
|
||||
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,
|
||||
#if 1 // waiting on cwg 1170
|
||||
is_convertible<_Tp0, _Up0>::value &&
|
||||
__tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...>>::value> {};
|
||||
#else
|
||||
is_constructible<_Up0, _Tp0>::value &&
|
||||
#endif
|
||||
__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,
|
||||
@@ -209,6 +239,19 @@ struct __tuple_convertible<_Tp, _Up, true, true>
|
||||
|
||||
// __tuple_assignable
|
||||
|
||||
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...> >
|
||||
: public integral_constant<bool,
|
||||
is_assignable<_Up0&, _Tp0>::value &&
|
||||
__tuple_assignable_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||
|
||||
template <>
|
||||
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,
|
||||
bool = __tuple_like<_Up>::value>
|
||||
struct __tuple_assignable
|
||||
@@ -216,9 +259,9 @@ struct __tuple_assignable
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __tuple_assignable<_Tp, _Up, true, true>
|
||||
: public __tuple_convertible_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
||||
tuple_size<_Up>::value,
|
||||
typename __make_tuple_types<_Tp>::type, typename __make_assignable_types<_Up>::type>
|
||||
: public __tuple_assignable_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
||||
tuple_size<_Up>::value,
|
||||
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
|
||||
{};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp> class tuple_size;
|
||||
template <size_t _Ip, class _Tp> class tuple_element;
|
||||
template <class _Tp> class _LIBCPP_VISIBLE tuple_size;
|
||||
template <size_t _Ip, class _Tp> class _LIBCPP_VISIBLE tuple_element;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -256,7 +256,7 @@ template <class RandomAccessIterator, class RandomNumberGenerator>
|
||||
|
||||
template<class RandomAccessIterator, class UniformRandomNumberGenerator>
|
||||
void shuffle(RandomAccessIterator first, RandomAccessIterator last,
|
||||
UniformRandomNumberGenerator& g);
|
||||
UniformRandomNumberGenerator&& g);
|
||||
|
||||
template <class InputIterator, class Predicate>
|
||||
bool
|
||||
@@ -1438,7 +1438,7 @@ template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
has_trivial_copy_assign<_Tp>::value,
|
||||
is_trivially_copy_assignable<_Tp>::value,
|
||||
_Tp*
|
||||
>::type
|
||||
__unwrap_iter(move_iterator<_Tp*> __i)
|
||||
@@ -1450,7 +1450,7 @@ template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
has_trivial_copy_assign<_Tp>::value,
|
||||
is_trivially_copy_assignable<_Tp>::value,
|
||||
_Tp*
|
||||
>::type
|
||||
__unwrap_iter(__wrap_iter<_Tp*> __i)
|
||||
@@ -1473,7 +1473,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_same<typename remove_const<_Tp>::type, _Up>::value &&
|
||||
has_trivial_copy_assign<_Up>::value,
|
||||
is_trivially_copy_assignable<_Up>::value,
|
||||
_Up*
|
||||
>::type
|
||||
__copy(_Tp* __first, _Tp* __last, _Up* __result)
|
||||
@@ -1508,7 +1508,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_same<typename remove_const<_Tp>::type, _Up>::value &&
|
||||
has_trivial_copy_assign<_Up>::value,
|
||||
is_trivially_copy_assignable<_Up>::value,
|
||||
_Up*
|
||||
>::type
|
||||
__copy_backward(_Tp* __first, _Tp* __last, _Up* __result)
|
||||
@@ -1559,8 +1559,17 @@ typename enable_if
|
||||
>::type
|
||||
copy_n(_InputIterator __first, _Size __n, _OutputIterator __result)
|
||||
{
|
||||
for (; __n > 0; --__n, ++__first, ++__result)
|
||||
if (__n > 0)
|
||||
{
|
||||
*__result = *__first;
|
||||
++__result;
|
||||
for (--__n; __n > 0; --__n)
|
||||
{
|
||||
++__first;
|
||||
*__result = *__first;
|
||||
++__result;
|
||||
}
|
||||
}
|
||||
return __result;
|
||||
}
|
||||
|
||||
@@ -1573,7 +1582,7 @@ typename enable_if
|
||||
>::type
|
||||
copy_n(_InputIterator __first, _Size __n, _OutputIterator __result)
|
||||
{
|
||||
return copy(__first, __first + __n, __result);
|
||||
return _STD::copy(__first, __first + __n, __result);
|
||||
}
|
||||
|
||||
// move
|
||||
@@ -1593,7 +1602,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_same<typename remove_const<_Tp>::type, _Up>::value &&
|
||||
has_trivial_copy_assign<_Up>::value,
|
||||
is_trivially_copy_assignable<_Up>::value,
|
||||
_Up*
|
||||
>::type
|
||||
__move(_Tp* __first, _Tp* __last, _Up* __result)
|
||||
@@ -1628,7 +1637,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_same<typename remove_const<_Tp>::type, _Up>::value &&
|
||||
has_trivial_copy_assign<_Up>::value,
|
||||
is_trivially_copy_assignable<_Up>::value,
|
||||
_Up*
|
||||
>::type
|
||||
__move_backward(_Tp* __first, _Tp* __last, _Up* __result)
|
||||
@@ -1650,13 +1659,7 @@ move_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last,
|
||||
|
||||
// iter_swap
|
||||
|
||||
template <class _ForwardIterator1, class _ForwardIterator2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
|
||||
{
|
||||
swap(*__a, *__b);
|
||||
}
|
||||
// moved to <type_traits> for better swap / noexcept support
|
||||
|
||||
// transform
|
||||
|
||||
@@ -1766,7 +1769,7 @@ fill_n(_OutputIterator __first, _Size __n, const _Tp& __value)
|
||||
{
|
||||
return _STD::__fill_n(__first, __n, __value, integral_constant<bool,
|
||||
is_pointer<_OutputIterator>::value &&
|
||||
has_trivial_copy_assign<_Tp>::value &&
|
||||
is_trivially_copy_assignable<_Tp>::value &&
|
||||
sizeof(_Tp) == 1>());
|
||||
}
|
||||
|
||||
@@ -2169,7 +2172,7 @@ rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __l
|
||||
typename iterator_traits<_ForwardIterator>::iterator_category,
|
||||
random_access_iterator_tag
|
||||
>::value &&
|
||||
has_trivial_copy_assign
|
||||
is_trivially_copy_assignable
|
||||
<
|
||||
typename iterator_traits<_ForwardIterator>::value_type
|
||||
>::value
|
||||
@@ -2686,14 +2689,18 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
|
||||
_D __uid;
|
||||
__rs_default __g = __rs_get();
|
||||
for (--__last, --__d; __first < __last; ++__first, --__d)
|
||||
swap(*__first, *(__first + __uid(__g, _P(0, __d))));
|
||||
{
|
||||
difference_type __i = __uid(__g, _P(0, __d));
|
||||
if (__i != difference_type(0))
|
||||
swap(*__first, *(__first + __i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class _RandomAccessIterator, class _RandomNumberGenerator>
|
||||
void
|
||||
random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_RandomNumberGenerator&& __rand)
|
||||
#else
|
||||
_RandomNumberGenerator& __rand)
|
||||
@@ -2704,13 +2711,20 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
|
||||
if (__d > 1)
|
||||
{
|
||||
for (--__last; __first < __last; ++__first, --__d)
|
||||
swap(*__first, *(__first + __rand(__d)));
|
||||
{
|
||||
difference_type __i = __rand(__d);
|
||||
swap(*__first, *(__first + __i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>
|
||||
void shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_UniformRandomNumberGenerator&& __g)
|
||||
#else
|
||||
_UniformRandomNumberGenerator& __g)
|
||||
#endif
|
||||
{
|
||||
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
|
||||
typedef uniform_int_distribution<ptrdiff_t> _D;
|
||||
@@ -2720,7 +2734,11 @@ template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>
|
||||
{
|
||||
_D __uid;
|
||||
for (--__last, --__d; __first < __last; ++__first, --__d)
|
||||
swap(*__first, *(__first + __uid(__g, _P(0, __d))));
|
||||
{
|
||||
difference_type __i = __uid(__g, _P(0, __d));
|
||||
if (__i != difference_type(0))
|
||||
swap(*__first, *(__first + __i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3419,8 +3437,8 @@ __sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __c
|
||||
// _Compare is known to be a reference type
|
||||
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
|
||||
typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
|
||||
const difference_type __limit = has_trivial_copy_constructor<value_type>::value &&
|
||||
has_trivial_copy_assign<value_type>::value ? 30 : 6;
|
||||
const difference_type __limit = is_trivially_copy_constructible<value_type>::value &&
|
||||
is_trivially_copy_assignable<value_type>::value ? 30 : 6;
|
||||
while (true)
|
||||
{
|
||||
__restart:
|
||||
@@ -4054,7 +4072,7 @@ __inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle,
|
||||
template <class _Tp>
|
||||
struct __inplace_merge_switch
|
||||
{
|
||||
static const unsigned value = has_trivial_copy_assign<_Tp>::value;
|
||||
static const unsigned value = is_trivially_copy_assignable<_Tp>::value;
|
||||
};
|
||||
|
||||
template <class _BidirectionalIterator, class _Compare>
|
||||
@@ -4222,7 +4240,7 @@ __stable_sort_move(_RandomAccessIterator __first1, _RandomAccessIterator __last1
|
||||
template <class _Tp>
|
||||
struct __stable_sort_switch
|
||||
{
|
||||
static const unsigned value = 128*has_trivial_copy_assign<_Tp>::value;
|
||||
static const unsigned value = 128*is_trivially_copy_assignable<_Tp>::value;
|
||||
};
|
||||
|
||||
template <class _Compare, class _RandomAccessIterator>
|
||||
|
140
include/array
140
include/array
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -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,14 +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>&) 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
|
||||
|
||||
@@ -115,7 +116,7 @@ template <int I, class T, size_t N> const T& get(const array<T, N>&);
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
struct array
|
||||
struct _LIBCPP_VISIBLE array
|
||||
{
|
||||
// types:
|
||||
typedef array __self;
|
||||
@@ -134,29 +135,47 @@ struct array
|
||||
value_type __elems_[_Size > 0 ? _Size : 1];
|
||||
|
||||
// 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_);}
|
||||
_LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u)
|
||||
{_STD::fill_n(__elems_, _Size, __u);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(array& __a) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
|
||||
{_STD::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];}
|
||||
@@ -169,8 +188,10 @@ struct 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>
|
||||
@@ -249,27 +270,34 @@ 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);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
class tuple_size<array<_Tp, _Size> > : public integral_constant<size_t, _Size> {};
|
||||
class _LIBCPP_VISIBLE tuple_size<array<_Tp, _Size> >
|
||||
: public integral_constant<size_t, _Size> {};
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
class tuple_size<const array<_Tp, _Size> > : public integral_constant<size_t, _Size> {};
|
||||
class _LIBCPP_VISIBLE tuple_size<const array<_Tp, _Size> >
|
||||
: public integral_constant<size_t, _Size> {};
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
class tuple_element<_Ip, array<_Tp, _Size> >
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, array<_Tp, _Size> >
|
||||
{
|
||||
public:
|
||||
typedef _Tp type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
class tuple_element<_Ip, const array<_Tp, _Size> >
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, const array<_Tp, _Size> >
|
||||
{
|
||||
public:
|
||||
typedef const _Tp type;
|
||||
@@ -278,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];
|
||||
}
|
||||
@@ -286,11 +314,23 @@ 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];
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
_Tp&&
|
||||
get(array<_Tp, _Size>&& __a) _NOEXCEPT
|
||||
{
|
||||
return _STD::move(__a[_Ip]);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_ARRAY
|
||||
|
1513
include/atomic
Normal file
1513
include/atomic
Normal file
File diff suppressed because it is too large
Load Diff
303
include/bitset
303
include/bitset
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -27,20 +27,23 @@ 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);
|
||||
explicit bitset( const char* str );
|
||||
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,
|
||||
charT zero = charT('0'), charT one = charT('1'));
|
||||
template<class charT, class traits, class Allocator>
|
||||
explicit bitset(const basic_string<charT,traits,Allocator>& str,
|
||||
typename basic_string<charT,traits,Allocator>::size_type pos = 0,
|
||||
@@ -49,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:
|
||||
@@ -74,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>&
|
||||
@@ -152,34 +155,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;
|
||||
@@ -190,7 +193,7 @@ 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));
|
||||
}
|
||||
@@ -218,7 +221,7 @@ __bitset<_N_words, _Size>::__init(unsigned long long __v, true_type)
|
||||
|
||||
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)>());
|
||||
}
|
||||
@@ -226,7 +229,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];
|
||||
@@ -235,7 +238,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];
|
||||
@@ -244,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];
|
||||
@@ -252,7 +255,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;
|
||||
@@ -335,7 +338,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;
|
||||
@@ -355,7 +358,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;
|
||||
@@ -376,7 +379,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)
|
||||
@@ -410,43 +413,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))
|
||||
{
|
||||
}
|
||||
@@ -454,7 +457,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_;
|
||||
}
|
||||
@@ -462,7 +465,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_;
|
||||
}
|
||||
@@ -470,7 +473,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_;
|
||||
}
|
||||
@@ -478,7 +481,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_;
|
||||
@@ -504,7 +507,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);
|
||||
@@ -513,7 +516,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;
|
||||
@@ -522,7 +525,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_;
|
||||
}
|
||||
@@ -551,40 +554,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
|
||||
{
|
||||
}
|
||||
|
||||
@@ -592,7 +595,7 @@ template <size_t _Size> class bitset;
|
||||
template <size_t _Size> struct hash<bitset<_Size> >;
|
||||
|
||||
template <size_t _Size>
|
||||
class bitset
|
||||
class _LIBCPP_VISIBLE bitset
|
||||
: private __bitset<_Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1, _Size>
|
||||
{
|
||||
static const unsigned __n_words = _Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1;
|
||||
@@ -603,9 +606,12 @@ 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) {}
|
||||
explicit bitset(const char* __str);
|
||||
/*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,
|
||||
_CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
explicit bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
|
||||
typename basic_string<_CharT,_Traits,_Allocator>::size_type __pos = 0,
|
||||
@@ -614,17 +620,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:
|
||||
@@ -643,30 +649,34 @@ 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:
|
||||
|
||||
size_t __hash_code() const {return base::__hash_code();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t __hash_code() const _NOEXCEPT {return base::__hash_code();}
|
||||
|
||||
friend struct hash<bitset>;
|
||||
};
|
||||
|
||||
template <size_t _Size>
|
||||
bitset<_Size>::bitset(const char* __str)
|
||||
template<class _CharT>
|
||||
bitset<_Size>::bitset(const _CharT* __str,
|
||||
typename basic_string<_CharT>::size_type __n,
|
||||
_CharT __zero, _CharT __one)
|
||||
{
|
||||
size_t __rlen = strlen(__str);
|
||||
size_t __rlen = _STD::min(__n, char_traits<_CharT>::length(__str));
|
||||
for (size_t __i = 0; __i < __rlen; ++__i)
|
||||
if (__str[__i] != '0' && __str[__i] != '1')
|
||||
if (__str[__i] != __zero && __str[__i] != __one)
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw invalid_argument("bitset string ctor has invalid argument");
|
||||
#else
|
||||
@@ -676,15 +686,11 @@ bitset<_Size>::bitset(const char* __str)
|
||||
size_t __i = 0;
|
||||
for (; __i < _M; ++__i)
|
||||
{
|
||||
switch (__str[_M - 1 - __i])
|
||||
{
|
||||
case '0':
|
||||
_CharT __c = __str[_M - 1 - __i];
|
||||
if (__c == __zero)
|
||||
(*this)[__i] = false;
|
||||
break;
|
||||
case '1':
|
||||
else
|
||||
(*this)[__i] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
_STD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
|
||||
}
|
||||
@@ -726,7 +732,7 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
|
||||
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;
|
||||
@@ -735,7 +741,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;
|
||||
@@ -744,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;
|
||||
@@ -752,7 +758,7 @@ 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));
|
||||
@@ -762,7 +768,7 @@ bitset<_Size>::operator<<=(size_t __pos)
|
||||
|
||||
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));
|
||||
@@ -773,7 +779,7 @@ bitset<_Size>::operator>>=(size_t __pos)
|
||||
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);
|
||||
return *this;
|
||||
@@ -796,7 +802,7 @@ 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);
|
||||
return *this;
|
||||
@@ -819,7 +825,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();
|
||||
@@ -829,7 +835,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;
|
||||
@@ -909,7 +915,7 @@ 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));
|
||||
}
|
||||
@@ -917,7 +923,7 @@ bitset<_Size>::count() const
|
||||
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));
|
||||
}
|
||||
@@ -925,7 +931,7 @@ bitset<_Size>::operator==(const bitset& __rhs) const
|
||||
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);
|
||||
}
|
||||
@@ -946,7 +952,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();
|
||||
}
|
||||
@@ -954,7 +960,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();
|
||||
}
|
||||
@@ -962,7 +968,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;
|
||||
@@ -972,7 +978,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;
|
||||
@@ -982,7 +988,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;
|
||||
@@ -992,7 +998,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;
|
||||
@@ -1002,7 +1008,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;
|
||||
@@ -1010,10 +1016,11 @@ operator^(const bitset<_Size>& __x, const bitset<_Size>& __y)
|
||||
}
|
||||
|
||||
template <size_t _Size>
|
||||
struct hash<bitset<_Size> >
|
||||
struct _LIBCPP_VISIBLE hash<bitset<_Size> >
|
||||
: public unary_function<bitset<_Size>, size_t>
|
||||
{
|
||||
size_t operator()(const bitset<_Size>& __bs) const
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const bitset<_Size>& __bs) const _NOEXCEPT
|
||||
{return __bs.__hash_code();}
|
||||
};
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -223,26 +223,26 @@ public:
|
||||
typedef duration::rep rep;
|
||||
typedef duration::period period;
|
||||
typedef chrono::time_point<system_clock> time_point;
|
||||
static const bool is_monotonic = false;
|
||||
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 monotonic_clock
|
||||
class steady_clock
|
||||
{
|
||||
public:
|
||||
typedef nanoseconds duration;
|
||||
typedef duration::rep rep;
|
||||
typedef duration::period period;
|
||||
typedef chrono::time_point<monotonic_clock, duration> time_point;
|
||||
static const bool is_monotonic = true;
|
||||
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 monotonic_clock high_resolution_clock;
|
||||
typedef steady_clock high_resolution_clock;
|
||||
|
||||
} // chrono
|
||||
|
||||
@@ -262,7 +262,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
namespace chrono
|
||||
{
|
||||
|
||||
template <class _Rep, class _Period = ratio<1> > class duration;
|
||||
template <class _Rep, class _Period = ratio<1> > class _LIBCPP_VISIBLE duration;
|
||||
|
||||
template <class _Tp>
|
||||
struct __is_duration : false_type {};
|
||||
@@ -282,7 +282,8 @@ struct __is_duration<const volatile duration<_Rep, _Period> > : true_type {};
|
||||
} // chrono
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
struct common_type<chrono::duration<_Rep1, _Period1>, chrono::duration<_Rep2, _Period2> >
|
||||
struct _LIBCPP_VISIBLE common_type<chrono::duration<_Rep1, _Period1>,
|
||||
chrono::duration<_Rep2, _Period2> >
|
||||
{
|
||||
typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type,
|
||||
typename __ratio_gcd<_Period1, _Period2>::type> type;
|
||||
@@ -357,10 +358,11 @@ duration_cast(const duration<_Rep, _Period>& __fd)
|
||||
return __duration_cast<duration<_Rep, _Period>, _ToDuration>()(__fd);
|
||||
}
|
||||
|
||||
template <class _Rep> struct treat_as_floating_point : is_floating_point<_Rep> {};
|
||||
template <class _Rep>
|
||||
struct _LIBCPP_VISIBLE treat_as_floating_point : is_floating_point<_Rep> {};
|
||||
|
||||
template <class _Rep>
|
||||
struct duration_values
|
||||
struct _LIBCPP_VISIBLE duration_values
|
||||
{
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY static _Rep zero() {return _Rep(0);}
|
||||
@@ -371,7 +373,7 @@ public:
|
||||
// duration
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
class duration
|
||||
class _LIBCPP_VISIBLE duration
|
||||
{
|
||||
static_assert(!__is_duration<_Rep>::value, "A duration representation can not be a duration");
|
||||
static_assert(__is_ratio<_Period>::value, "Second template parameter of duration must be a std::ratio");
|
||||
@@ -667,7 +669,7 @@ operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
template <class _Clock, class _Duration = typename _Clock::duration>
|
||||
class time_point
|
||||
class _LIBCPP_VISIBLE time_point
|
||||
{
|
||||
static_assert(__is_duration<_Duration>::value,
|
||||
"Second template parameter of time_point must be a std::chrono::duration");
|
||||
@@ -711,7 +713,8 @@ public:
|
||||
} // chrono
|
||||
|
||||
template <class _Clock, class _Duration1, class _Duration2>
|
||||
struct common_type<chrono::time_point<_Clock, _Duration1>, chrono::time_point<_Clock, _Duration2> >
|
||||
struct _LIBCPP_VISIBLE common_type<chrono::time_point<_Clock, _Duration1>,
|
||||
chrono::time_point<_Clock, _Duration2> >
|
||||
{
|
||||
typedef chrono::time_point<_Clock, typename common_type<_Duration1, _Duration2>::type> type;
|
||||
};
|
||||
@@ -833,33 +836,33 @@ operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
|
||||
/////////////////////// clocks ///////////////////////////
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
class system_clock
|
||||
class _LIBCPP_VISIBLE system_clock
|
||||
{
|
||||
public:
|
||||
typedef microseconds duration;
|
||||
typedef duration::rep rep;
|
||||
typedef duration::period period;
|
||||
typedef chrono::time_point<system_clock> time_point;
|
||||
static const bool is_monotonic = false;
|
||||
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 monotonic_clock
|
||||
class _LIBCPP_VISIBLE steady_clock
|
||||
{
|
||||
public:
|
||||
typedef nanoseconds duration;
|
||||
typedef duration::rep rep;
|
||||
typedef duration::period period;
|
||||
typedef chrono::time_point<monotonic_clock, duration> time_point;
|
||||
static const bool is_monotonic = true;
|
||||
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 monotonic_clock high_resolution_clock;
|
||||
typedef steady_clock high_resolution_clock;
|
||||
|
||||
} // chrono
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
861
include/cmath
861
include/cmath
File diff suppressed because it is too large
Load Diff
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -177,7 +177,7 @@ protected:
|
||||
|
||||
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
||||
codecvt_mode _Mode = (codecvt_mode)0>
|
||||
class codecvt_utf8
|
||||
class _LIBCPP_VISIBLE codecvt_utf8
|
||||
: public __codecvt_utf8<_Elem>
|
||||
{
|
||||
public:
|
||||
@@ -185,6 +185,7 @@ public:
|
||||
explicit codecvt_utf8(size_t __refs = 0)
|
||||
: __codecvt_utf8<_Elem>(__refs, _Maxcode, _Mode) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~codecvt_utf8() {}
|
||||
};
|
||||
|
||||
@@ -404,7 +405,7 @@ protected:
|
||||
|
||||
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
||||
codecvt_mode _Mode = (codecvt_mode)0>
|
||||
class codecvt_utf16
|
||||
class _LIBCPP_VISIBLE codecvt_utf16
|
||||
: public __codecvt_utf16<_Elem, _Mode & little_endian>
|
||||
{
|
||||
public:
|
||||
@@ -412,6 +413,7 @@ public:
|
||||
explicit codecvt_utf16(size_t __refs = 0)
|
||||
: __codecvt_utf16<_Elem, _Mode & little_endian>(__refs, _Maxcode, _Mode) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~codecvt_utf16() {}
|
||||
};
|
||||
|
||||
@@ -526,7 +528,7 @@ protected:
|
||||
|
||||
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
|
||||
codecvt_mode _Mode = (codecvt_mode)0>
|
||||
class codecvt_utf8_utf16
|
||||
class _LIBCPP_VISIBLE codecvt_utf8_utf16
|
||||
: public __codecvt_utf8_utf16<_Elem>
|
||||
{
|
||||
public:
|
||||
@@ -534,6 +536,7 @@ public:
|
||||
explicit codecvt_utf8_utf16(size_t __refs = 0)
|
||||
: __codecvt_utf8_utf16<_Elem>(__refs, _Maxcode, _Mode) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~codecvt_utf8_utf16() {}
|
||||
};
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -191,17 +191,17 @@ template<class T> T norm(const complex<T>&);
|
||||
template<Integral T> double norm(T);
|
||||
float norm(float);
|
||||
|
||||
template<class T> complex<T> conj(const complex<T>&);
|
||||
long double conj(long double);
|
||||
double conj(double);
|
||||
template<Integral T> double conj(T);
|
||||
float conj(float);
|
||||
template<class T> complex<T> conj(const complex<T>&);
|
||||
complex<long double> conj(long double);
|
||||
complex<double> conj(double);
|
||||
template<Integral T> complex<double> conj(T);
|
||||
complex<float> conj(float);
|
||||
|
||||
template<class T> complex<T> proj(const complex<T>&);
|
||||
long double proj(long double);
|
||||
double proj(double);
|
||||
template<Integral T> double proj(T);
|
||||
float proj(float);
|
||||
template<class T> complex<T> proj(const complex<T>&);
|
||||
complex<long double> proj(long double);
|
||||
complex<double> proj(double);
|
||||
template<Integral T> complex<double> proj(T);
|
||||
complex<float> proj(float);
|
||||
|
||||
template<class T> complex<T> polar(const T&, const T& = 0);
|
||||
|
||||
@@ -253,13 +253,13 @@ template<class T, class charT, class traits>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template<class _Tp> class complex;
|
||||
template<class _Tp> class _LIBCPP_VISIBLE complex;
|
||||
|
||||
template<class _Tp> complex<_Tp> operator*(const complex<_Tp>& __z, const complex<_Tp>& __w);
|
||||
template<class _Tp> complex<_Tp> operator/(const complex<_Tp>& __x, const complex<_Tp>& __y);
|
||||
|
||||
template<class _Tp>
|
||||
class complex
|
||||
class _LIBCPP_VISIBLE complex
|
||||
{
|
||||
public:
|
||||
typedef _Tp value_type;
|
||||
@@ -316,11 +316,11 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template<> class complex<double>;
|
||||
template<> class complex<long double>;
|
||||
template<> class _LIBCPP_VISIBLE complex<double>;
|
||||
template<> class _LIBCPP_VISIBLE complex<long double>;
|
||||
|
||||
template<>
|
||||
class complex<float>
|
||||
class _LIBCPP_VISIBLE complex<float>
|
||||
{
|
||||
float __re_;
|
||||
float __im_;
|
||||
@@ -375,7 +375,7 @@ public:
|
||||
};
|
||||
|
||||
template<>
|
||||
class complex<double>
|
||||
class _LIBCPP_VISIBLE complex<double>
|
||||
{
|
||||
double __re_;
|
||||
double __im_;
|
||||
@@ -430,7 +430,7 @@ public:
|
||||
};
|
||||
|
||||
template<>
|
||||
class complex<long double>
|
||||
class _LIBCPP_VISIBLE complex<long double>
|
||||
{
|
||||
long double __re_;
|
||||
long double __im_;
|
||||
@@ -781,20 +781,6 @@ operator!=(const _Tp& __x, const complex<_Tp>& __y)
|
||||
return !(__x == __y);
|
||||
}
|
||||
|
||||
/*
|
||||
Move to <istream>
|
||||
|
||||
template<class T, class charT, class traits>
|
||||
basic_istream<charT, traits>&
|
||||
operator>>(basic_istream<charT, traits>&, complex<T>&);
|
||||
|
||||
Move to <ostream>
|
||||
|
||||
template<class T, class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>&, const complex<T>&);
|
||||
*/
|
||||
|
||||
// 26.3.7 values:
|
||||
|
||||
// real
|
||||
@@ -994,17 +980,17 @@ conj(const complex<_Tp>& __c)
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
long double
|
||||
complex<long double>
|
||||
conj(long double __re)
|
||||
{
|
||||
return __re;
|
||||
return complex<long double>(__re);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
double
|
||||
complex<double>
|
||||
conj(double __re)
|
||||
{
|
||||
return __re;
|
||||
return complex<double>(__re);
|
||||
}
|
||||
|
||||
template<class _Tp>
|
||||
@@ -1012,18 +998,18 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_integral<_Tp>::value,
|
||||
double
|
||||
complex<double>
|
||||
>::type
|
||||
conj(_Tp __re)
|
||||
{
|
||||
return __re;
|
||||
return complex<double>(__re);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
float
|
||||
complex<float>
|
||||
conj(float __re)
|
||||
{
|
||||
return __re;
|
||||
return complex<float>(__re);
|
||||
}
|
||||
|
||||
// proj
|
||||
@@ -1040,21 +1026,21 @@ proj(const complex<_Tp>& __c)
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
long double
|
||||
complex<long double>
|
||||
proj(long double __re)
|
||||
{
|
||||
if (isinf(__re))
|
||||
__re = abs(__re);
|
||||
return __re;
|
||||
return complex<long double>(__re);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
double
|
||||
complex<double>
|
||||
proj(double __re)
|
||||
{
|
||||
if (isinf(__re))
|
||||
__re = abs(__re);
|
||||
return __re;
|
||||
return complex<double>(__re);
|
||||
}
|
||||
|
||||
template<class _Tp>
|
||||
@@ -1062,20 +1048,20 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_integral<_Tp>::value,
|
||||
double
|
||||
complex<double>
|
||||
>::type
|
||||
proj(_Tp __re)
|
||||
{
|
||||
return __re;
|
||||
return complex<double>(__re);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
float
|
||||
complex<float>
|
||||
proj(float __re)
|
||||
{
|
||||
if (isinf(__re))
|
||||
__re = abs(__re);
|
||||
return __re;
|
||||
return complex<float>(__re);
|
||||
}
|
||||
|
||||
// polar
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -61,6 +61,8 @@ public:
|
||||
native_handle_type native_handle();
|
||||
};
|
||||
|
||||
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
|
||||
|
||||
class condition_variable_any
|
||||
{
|
||||
public:
|
||||
@@ -113,7 +115,7 @@ public:
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class condition_variable_any
|
||||
class _LIBCPP_VISIBLE condition_variable_any
|
||||
{
|
||||
condition_variable __cv_;
|
||||
shared_ptr<mutex> __mut_;
|
||||
@@ -151,11 +153,11 @@ public:
|
||||
_Predicate __pred);
|
||||
};
|
||||
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
condition_variable_any::condition_variable_any()
|
||||
: __mut_(make_shared<mutex>()) {}
|
||||
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
condition_variable_any::notify_one()
|
||||
{
|
||||
@@ -163,7 +165,7 @@ condition_variable_any::notify_one()
|
||||
__cv_.notify_one();
|
||||
}
|
||||
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
condition_variable_any::notify_all()
|
||||
{
|
||||
@@ -190,7 +192,7 @@ condition_variable_any::wait(_Lock& __lock)
|
||||
} // __mut_.unlock(), __lock.lock()
|
||||
|
||||
template <class _Lock, class _Predicate>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
condition_variable_any::wait(_Lock& __lock, _Predicate __pred)
|
||||
{
|
||||
@@ -212,7 +214,7 @@ condition_variable_any::wait_until(_Lock& __lock,
|
||||
} // __mut_.unlock(), __lock.lock()
|
||||
|
||||
template <class _Lock, class _Clock, class _Duration, class _Predicate>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
condition_variable_any::wait_until(_Lock& __lock,
|
||||
const chrono::time_point<_Clock, _Duration>& __t,
|
||||
@@ -225,25 +227,28 @@ condition_variable_any::wait_until(_Lock& __lock,
|
||||
}
|
||||
|
||||
template <class _Lock, class _Rep, class _Period>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
cv_status
|
||||
condition_variable_any::wait_for(_Lock& __lock,
|
||||
const chrono::duration<_Rep, _Period>& __d)
|
||||
{
|
||||
return wait_until(__lock, chrono::monotonic_clock::now() + __d);
|
||||
return wait_until(__lock, chrono::steady_clock::now() + __d);
|
||||
}
|
||||
|
||||
template <class _Lock, class _Rep, class _Period, class _Predicate>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
condition_variable_any::wait_for(_Lock& __lock,
|
||||
const chrono::duration<_Rep, _Period>& __d,
|
||||
_Predicate __pred)
|
||||
{
|
||||
return wait_until(__lock, chrono::monotonic_clock::now() + __d,
|
||||
return wait_until(__lock, chrono::steady_clock::now() + __d,
|
||||
_STD::move(__pred));
|
||||
}
|
||||
|
||||
_LIBCPP_VISIBLE
|
||||
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_CONDITION_VARIABLE
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -54,7 +54,7 @@ typedef long double max_align_t;
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_NULLPTR
|
||||
|
||||
struct nullptr_t
|
||||
struct _LIBCPP_VISIBLE nullptr_t
|
||||
{
|
||||
void* _;
|
||||
|
||||
@@ -78,54 +78,23 @@ struct nullptr_t
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, nullptr_t) {return true;}
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, nullptr_t) {return false;}
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, nullptr_t) {return true;}
|
||||
|
||||
template <typename _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator==(nullptr_t, _Tp* __p) {return 0 == __p;}
|
||||
|
||||
template <typename _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator==(_Tp* __p, nullptr_t) {return __p == 0;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator!=(nullptr_t, _Tp* __p) {return 0 != __p;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator!=(_Tp* __p, nullptr_t) {return __p != 0;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator<(nullptr_t, _Tp* __p) {return 0 < __p;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator<(_Tp* __p, nullptr_t) {return __p < 0;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, _Tp* __p) {return 0 <= __p;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator<=(_Tp* __p, nullptr_t) {return __p <= 0;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, _Tp* __p) {return 0 > __p;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator>(_Tp* __p, nullptr_t) {return __p > 0;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, _Tp* __p) {return 0 >= __p;}
|
||||
|
||||
template <class _Tp>
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator>=(_Tp* __p, nullptr_t) {return __p >= 0;}
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
#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
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -78,23 +78,26 @@ using ::strcoll;
|
||||
using ::strxfrm;
|
||||
|
||||
using ::memchr;
|
||||
inline _LIBCPP_INLINE_VISIBILITY void* memchr( void* __s, int __c, size_t __n) {return ::memchr(__s, __c, __n);}
|
||||
|
||||
using ::strchr;
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strchr( char* __s, int __c) {return ::strchr(__s, __c);}
|
||||
|
||||
using ::strcspn;
|
||||
|
||||
using ::strpbrk;
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strpbrk( char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}
|
||||
|
||||
using ::strrchr;
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strrchr( char* __s, int __c) {return ::strrchr(__s, __c);}
|
||||
|
||||
using ::strspn;
|
||||
|
||||
using ::strstr;
|
||||
|
||||
#ifndef __GLIBC__ // GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strchr( char* __s, int __c) {return ::strchr(__s, __c);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strpbrk( char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strrchr( char* __s, int __c) {return ::strrchr(__s, __c);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY void* memchr( void* __s, int __c, size_t __n) {return ::memchr(__s, __c, __n);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY char* strstr( char* __s1, const char* __s2) {return ::strstr(__s1, __s2);}
|
||||
#endif
|
||||
|
||||
using ::strtok;
|
||||
using ::memset;
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
409
include/deque
409
include/deque
File diff suppressed because it is too large
Load Diff
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -20,54 +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();
|
||||
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();
|
||||
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
|
||||
@@ -86,60 +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 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 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 exception_ptr
|
||||
class _LIBCPP_VISIBLE exception_ptr
|
||||
{
|
||||
void* __ptr_;
|
||||
public:
|
||||
exception_ptr() : __ptr_() {}
|
||||
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 bool operator==(const exception_ptr& __x, const exception_ptr& __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
|
||||
{return __x.__ptr_ == __y.__ptr_;}
|
||||
friend bool operator!=(const exception_ptr& __x, const exception_ptr& __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
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
|
||||
@@ -159,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;
|
||||
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>
|
||||
@@ -174,21 +181,22 @@ struct __nested
|
||||
: public _Tp,
|
||||
public nested_exception
|
||||
{
|
||||
explicit __nested(const _Tp& __t) : _Tp(__t) {}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __nested(const _Tp& __t) : _Tp(__t) {}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
_ATTRIBUTE(noreturn)
|
||||
void
|
||||
#ifdef _LIBCPP_MOVE
|
||||
throw_with_nested /*[[noreturn]]*/ (_Tp&& __t, typename enable_if<
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested(_Tp&& __t, typename enable_if<
|
||||
is_class<typename remove_reference<_Tp>::type>::value &&
|
||||
!is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
|
||||
>::type* = 0)
|
||||
#else // _LIBCPP_MOVE
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested (_Tp& __t, typename enable_if<
|
||||
is_class<_Tp>::value && !is_base_of<nested_exception, _Tp>::value
|
||||
>::type* = 0)
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw __nested<typename remove_reference<_Tp>::type>(_STD::forward<_Tp>(__t));
|
||||
@@ -196,17 +204,18 @@ throw_with_nested (_Tp& __t, typename enable_if<
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
_ATTRIBUTE(noreturn)
|
||||
void
|
||||
#ifdef _LIBCPP_MOVE
|
||||
throw_with_nested /*[[noreturn]]*/ (_Tp&& __t, typename enable_if<
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested(_Tp&& __t, typename enable_if<
|
||||
!is_class<typename remove_reference<_Tp>::type>::value ||
|
||||
is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
|
||||
>::type* = 0)
|
||||
#else // _LIBCPP_MOVE
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested (_Tp& __t, typename enable_if<
|
||||
!is_class<_Tp>::value || is_base_of<nested_exception, _Tp>::value
|
||||
>::type* = 0)
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw _STD::forward<_Tp>(__t);
|
||||
@@ -214,7 +223,7 @@ throw_with_nested (_Tp& __t, typename enable_if<
|
||||
}
|
||||
|
||||
template <class _E>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
rethrow_if_nested(const _E& __e, typename enable_if<
|
||||
is_polymorphic<_E>::value
|
||||
@@ -226,7 +235,7 @@ rethrow_if_nested(const _E& __e, typename enable_if<
|
||||
}
|
||||
|
||||
template <class _E>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
rethrow_if_nested(const _E& __e, typename enable_if<
|
||||
!is_polymorphic<_E>::value
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -217,11 +217,13 @@ class __hash_map_hasher
|
||||
: private _Hash
|
||||
{
|
||||
public:
|
||||
__hash_map_hasher() : _Hash() {}
|
||||
__hash_map_hasher(const _Hash& __h) : _Hash(__h) {}
|
||||
const _Hash& hash_function() const {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_hasher() : _Hash() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_hasher(const _Hash& __h) : _Hash(__h) {}
|
||||
_LIBCPP_INLINE_VISIBILITY const _Hash& hash_function() const {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const _Tp& __x) const
|
||||
{return static_cast<const _Hash&>(*this)(__x.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const typename _Tp::first_type& __x) const
|
||||
{return static_cast<const _Hash&>(*this)(__x);}
|
||||
};
|
||||
@@ -231,11 +233,13 @@ class __hash_map_hasher<_Tp, _Hash, false>
|
||||
{
|
||||
_Hash __hash_;
|
||||
public:
|
||||
__hash_map_hasher() : __hash_() {}
|
||||
__hash_map_hasher(const _Hash& __h) : __hash_(__h) {}
|
||||
const _Hash& hash_function() const {return __hash_;}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_hasher() : __hash_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_hasher(const _Hash& __h) : __hash_(__h) {}
|
||||
_LIBCPP_INLINE_VISIBILITY const _Hash& hash_function() const {return __hash_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const _Tp& __x) const
|
||||
{return __hash_(__x.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const typename _Tp::first_type& __x) const
|
||||
{return __hash_(__x);}
|
||||
};
|
||||
@@ -245,15 +249,19 @@ class __hash_map_equal
|
||||
: private _Pred
|
||||
{
|
||||
public:
|
||||
__hash_map_equal() : _Pred() {}
|
||||
__hash_map_equal(const _Pred& __p) : _Pred(__p) {}
|
||||
const _Pred& key_eq() const {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_equal() : _Pred() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_equal(const _Pred& __p) : _Pred(__p) {}
|
||||
_LIBCPP_INLINE_VISIBILITY const _Pred& key_eq() const {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Tp& __x, const _Tp& __y) const
|
||||
{return static_cast<const _Pred&>(*this)(__x.first, __y.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
|
||||
{return static_cast<const _Pred&>(*this)(__x, __y.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
|
||||
{return static_cast<const _Pred&>(*this)(__x.first, __y);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const typename _Tp::first_type& __x,
|
||||
const typename _Tp::first_type& __y) const
|
||||
{return static_cast<const _Pred&>(*this)(__x, __y);}
|
||||
@@ -264,15 +272,19 @@ class __hash_map_equal<_Tp, _Pred, false>
|
||||
{
|
||||
_Pred __pred_;
|
||||
public:
|
||||
__hash_map_equal() : __pred_() {}
|
||||
__hash_map_equal(const _Pred& __p) : __pred_(__p) {}
|
||||
const _Pred& key_eq() const {return __pred_;}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_equal() : __pred_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_equal(const _Pred& __p) : __pred_(__p) {}
|
||||
_LIBCPP_INLINE_VISIBILITY const _Pred& key_eq() const {return __pred_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Tp& __x, const _Tp& __y) const
|
||||
{return __pred_(__x.first, __y.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
|
||||
{return __pred_(__x, __y.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
|
||||
{return __pred_(__x.first, __y);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const typename _Tp::first_type& __x,
|
||||
const typename _Tp::first_type& __y) const
|
||||
{return __pred_(__x, __y);}
|
||||
@@ -298,13 +310,15 @@ public:
|
||||
bool __first_constructed;
|
||||
bool __second_constructed;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __hash_map_node_destructor(allocator_type& __na)
|
||||
: __na_(__na),
|
||||
__first_constructed(false),
|
||||
__second_constructed(false)
|
||||
{}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x)
|
||||
: __na_(__x.__na_),
|
||||
__first_constructed(__x.__value_constructed),
|
||||
@@ -312,7 +326,8 @@ public:
|
||||
{
|
||||
__x.__value_constructed = false;
|
||||
}
|
||||
#else // _LIBCPP_MOVE
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x)
|
||||
: __na_(__x.__na_),
|
||||
__first_constructed(__x.__value_constructed),
|
||||
@@ -320,21 +335,22 @@ public:
|
||||
{
|
||||
const_cast<bool&>(__x.__value_constructed) = false;
|
||||
}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void operator()(pointer __p)
|
||||
{
|
||||
if (__second_constructed)
|
||||
__alloc_traits::destroy(__na_, addressof(__p->__value_.second));
|
||||
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_.second));
|
||||
if (__first_constructed)
|
||||
__alloc_traits::destroy(__na_, addressof(__p->__value_.first));
|
||||
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_.first));
|
||||
if (__p)
|
||||
__alloc_traits::deallocate(__na_, __p, 1);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _HashIterator>
|
||||
class __hash_map_iterator
|
||||
class _LIBCPP_VISIBLE __hash_map_iterator
|
||||
{
|
||||
_HashIterator __i_;
|
||||
|
||||
@@ -354,14 +370,15 @@ public:
|
||||
#endif
|
||||
pointer;
|
||||
|
||||
__hash_map_iterator() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_iterator() {}
|
||||
|
||||
__hash_map_iterator(_HashIterator __i) : __i_(__i) {}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_iterator(_HashIterator __i) : __i_(__i) {}
|
||||
|
||||
reference operator*() const {return *operator->();}
|
||||
pointer operator->() const {return (pointer)__i_.operator->();}
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return *operator->();}
|
||||
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return (pointer)__i_.operator->();}
|
||||
|
||||
__hash_map_iterator& operator++() {++__i_; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_iterator& operator++() {++__i_; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_iterator operator++(int)
|
||||
{
|
||||
__hash_map_iterator __t(*this);
|
||||
@@ -369,20 +386,22 @@ public:
|
||||
return __t;
|
||||
}
|
||||
|
||||
friend bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
|
||||
{return __x.__i_ == __y.__i_;}
|
||||
friend bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
|
||||
{return __x.__i_ != __y.__i_;}
|
||||
|
||||
template <class, class, class, class, class> friend class hash_map;
|
||||
template <class, class, class, class, class> friend class hash_multimap;
|
||||
template <class> friend class __hash_const_iterator;
|
||||
template <class> friend class __hash_const_local_iterator;
|
||||
template <class> friend class __hash_map_const_iterator;
|
||||
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_map;
|
||||
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_multimap;
|
||||
template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator;
|
||||
template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
|
||||
template <class> friend class _LIBCPP_VISIBLE __hash_map_const_iterator;
|
||||
};
|
||||
|
||||
template <class _HashIterator>
|
||||
class __hash_map_const_iterator
|
||||
class _LIBCPP_VISIBLE __hash_map_const_iterator
|
||||
{
|
||||
_HashIterator __i_;
|
||||
|
||||
@@ -402,17 +421,23 @@ public:
|
||||
#endif
|
||||
pointer;
|
||||
|
||||
__hash_map_const_iterator() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_map_const_iterator() {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_const_iterator(_HashIterator __i) : __i_(__i) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_const_iterator(
|
||||
__hash_map_iterator<typename _HashIterator::__non_const_iterator> __i)
|
||||
: __i_(__i.__i_) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {return *operator->();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer operator->() const {return (pointer)__i_.operator->();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_const_iterator& operator++() {++__i_; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_const_iterator operator++(int)
|
||||
{
|
||||
__hash_map_const_iterator __t(*this);
|
||||
@@ -420,20 +445,22 @@ public:
|
||||
return __t;
|
||||
}
|
||||
|
||||
friend bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
|
||||
{return __x.__i_ == __y.__i_;}
|
||||
friend bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
|
||||
{return __x.__i_ != __y.__i_;}
|
||||
|
||||
template <class, class, class, class, class> friend class hash_map;
|
||||
template <class, class, class, class, class> friend class hash_multimap;
|
||||
template <class> friend class __hash_const_iterator;
|
||||
template <class> friend class __hash_const_local_iterator;
|
||||
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_map;
|
||||
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_multimap;
|
||||
template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator;
|
||||
template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
|
||||
};
|
||||
|
||||
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
|
||||
class _Alloc = allocator<pair<const _Key, _Tp> > >
|
||||
class hash_map
|
||||
class _LIBCPP_VISIBLE hash_map
|
||||
{
|
||||
public:
|
||||
// types
|
||||
@@ -480,7 +507,7 @@ public:
|
||||
typedef __hash_map_iterator<typename __table::iterator> iterator;
|
||||
typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
|
||||
|
||||
hash_map() {__table_.rehash(193);}
|
||||
_LIBCPP_INLINE_VISIBILITY hash_map() {__table_.rehash(193);}
|
||||
explicit hash_map(size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
hash_map(size_type __n, const hasher& __hf,
|
||||
@@ -499,52 +526,77 @@ public:
|
||||
const allocator_type& __a);
|
||||
hash_map(const hash_map& __u);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const
|
||||
{return allocator_type(__table_.__node_alloc());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return __table_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return __table_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const {return __table_.max_size();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return __table_.end();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> insert(const value_type& __x)
|
||||
{return __table_.__insert_unique(__x);}
|
||||
template <class _InputIterator>
|
||||
void insert(_InputIterator __first, _InputIterator __last);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __p) {__table_.erase(__p.__i_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __first, const_iterator __last)
|
||||
{__table_.erase(__first.__i_, __last.__i_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() {__table_.clear();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(hash_map& __u) {__table_.swap(__u.__table_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hasher hash_funct() const
|
||||
{return __table_.hash_function().hash_function();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
key_equal key_eq() const
|
||||
{return __table_.key_eq().key_eq();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator find(const key_type& __k) {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, iterator> equal_range(const key_type& __k)
|
||||
{return __table_.__equal_range_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
|
||||
{return __table_.__equal_range_unique(__k);}
|
||||
|
||||
mapped_type& operator[](const key_type& __k);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_count() const {return __table_.bucket_count();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_bucket_count() const {return __table_.max_bucket_count();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type elems_in_bucket(size_type __n) const
|
||||
{return __table_.bucket_size(__n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void resize(size_type __n) {__table_.rehash(__n);}
|
||||
|
||||
private:
|
||||
@@ -614,16 +666,16 @@ 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, _STD::addressof(__h->__value_.first), __k);
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__node_traits::construct(__na, addressof(__h->__value_.second));
|
||||
__node_traits::construct(__na, _STD::addressof(__h->__value_.second));
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return _STD::move(__h);
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
|
||||
_InputIterator __last)
|
||||
@@ -646,7 +698,7 @@ hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k)
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
||||
@@ -674,7 +726,7 @@ operator==(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
||||
@@ -684,7 +736,7 @@ operator!=(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
|
||||
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
|
||||
class _Alloc = allocator<pair<const _Key, _Tp> > >
|
||||
class hash_multimap
|
||||
class _LIBCPP_VISIBLE hash_multimap
|
||||
{
|
||||
public:
|
||||
// types
|
||||
@@ -729,6 +781,7 @@ public:
|
||||
typedef __hash_map_iterator<typename __table::iterator> iterator;
|
||||
typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hash_multimap() {__table_.rehash(193);}
|
||||
explicit hash_multimap(size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
@@ -748,49 +801,74 @@ public:
|
||||
const allocator_type& __a);
|
||||
hash_multimap(const hash_multimap& __u);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const
|
||||
{return allocator_type(__table_.__node_alloc());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return __table_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return __table_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const {return __table_.max_size();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return __table_.end();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
|
||||
template <class _InputIterator>
|
||||
void insert(_InputIterator __first, _InputIterator __last);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __p) {__table_.erase(__p.__i_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __first, const_iterator __last)
|
||||
{__table_.erase(__first.__i_, __last.__i_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() {__table_.clear();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(hash_multimap& __u) {__table_.swap(__u.__table_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hasher hash_funct() const
|
||||
{return __table_.hash_function().hash_function();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
key_equal key_eq() const
|
||||
{return __table_.key_eq().key_eq();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator find(const key_type& __k) {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, iterator> equal_range(const key_type& __k)
|
||||
{return __table_.__equal_range_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
|
||||
{return __table_.__equal_range_multi(__k);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_count() const {return __table_.bucket_count();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_bucket_count() const {return __table_.max_bucket_count();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type elems_in_bucket(size_type __n) const
|
||||
{return __table_.bucket_size(__n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void resize(size_type __n) {__table_.rehash(__n);}
|
||||
};
|
||||
|
||||
@@ -853,7 +931,7 @@ hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
|
||||
_InputIterator __last)
|
||||
@@ -863,7 +941,7 @@ hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
||||
@@ -895,7 +973,7 @@ operator==(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
|
||||
const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -205,7 +205,7 @@ using namespace std;
|
||||
|
||||
template <class _Value, class _Hash = std::hash<_Value>, class _Pred = equal_to<_Value>,
|
||||
class _Alloc = allocator<_Value> >
|
||||
class hash_set
|
||||
class _LIBCPP_VISIBLE hash_set
|
||||
{
|
||||
public:
|
||||
// types
|
||||
@@ -231,6 +231,7 @@ public:
|
||||
typedef typename __table::const_iterator iterator;
|
||||
typedef typename __table::const_iterator const_iterator;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hash_set() {__table_.rehash(193);}
|
||||
explicit hash_set(size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
@@ -248,47 +249,72 @@ public:
|
||||
const allocator_type& __a);
|
||||
hash_set(const hash_set& __u);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const
|
||||
{return allocator_type(__table_.__node_alloc());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return __table_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return __table_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const {return __table_.max_size();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return __table_.end();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> insert(const value_type& __x)
|
||||
{return __table_.__insert_unique(__x);}
|
||||
template <class _InputIterator>
|
||||
void insert(_InputIterator __first, _InputIterator __last);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __p) {__table_.erase(__p);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __first, const_iterator __last)
|
||||
{__table_.erase(__first, __last);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() {__table_.clear();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(hash_set& __u) {__table_.swap(__u.__table_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hasher hash_funct() const {return __table_.hash_function();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
key_equal key_eq() const {return __table_.key_eq();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator find(const key_type& __k) {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, iterator> equal_range(const key_type& __k)
|
||||
{return __table_.__equal_range_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
|
||||
{return __table_.__equal_range_unique(__k);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_count() const {return __table_.bucket_count();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_bucket_count() const {return __table_.max_bucket_count();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type elems_in_bucket(size_type __n) const {return __table_.bucket_size(__n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void resize(size_type __n) {__table_.rehash(__n);}
|
||||
};
|
||||
|
||||
@@ -350,7 +376,7 @@ hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
hash_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
|
||||
_InputIterator __last)
|
||||
@@ -360,7 +386,7 @@ hash_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
@@ -388,7 +414,7 @@ operator==(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
const hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
@@ -398,7 +424,7 @@ operator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
|
||||
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
|
||||
class _Alloc = allocator<_Value> >
|
||||
class hash_multiset
|
||||
class _LIBCPP_VISIBLE hash_multiset
|
||||
{
|
||||
public:
|
||||
// types
|
||||
@@ -424,6 +450,7 @@ public:
|
||||
typedef typename __table::const_iterator iterator;
|
||||
typedef typename __table::const_iterator const_iterator;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hash_multiset() {__table_.rehash(193);}
|
||||
explicit hash_multiset(size_type __n, const hasher& __hf = hasher(),
|
||||
const key_equal& __eql = key_equal());
|
||||
@@ -441,46 +468,71 @@ public:
|
||||
const key_equal& __eql, const allocator_type& __a);
|
||||
hash_multiset(const hash_multiset& __u);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const
|
||||
{return allocator_type(__table_.__node_alloc());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return __table_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return __table_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const {return __table_.max_size();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return __table_.end();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
|
||||
template <class _InputIterator>
|
||||
void insert(_InputIterator __first, _InputIterator __last);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __p) {__table_.erase(__p);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void erase(const_iterator __first, const_iterator __last)
|
||||
{__table_.erase(__first, __last);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() {__table_.clear();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(hash_multiset& __u) {__table_.swap(__u.__table_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
hasher hash_funct() const {return __table_.hash_function();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
key_equal key_eq() const {return __table_.key_eq();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator find(const key_type& __k) {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, iterator> equal_range(const key_type& __k)
|
||||
{return __table_.__equal_range_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
|
||||
{return __table_.__equal_range_multi(__k);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_count() const {return __table_.bucket_count();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_bucket_count() const {return __table_.max_bucket_count();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type elems_in_bucket(size_type __n) const {return __table_.bucket_size(__n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void resize(size_type __n) {__table_.rehash(__n);}
|
||||
};
|
||||
|
||||
@@ -543,7 +595,7 @@ hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
hash_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
|
||||
_InputIterator __last)
|
||||
@@ -553,7 +605,7 @@ hash_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
@@ -585,7 +637,7 @@ operator==(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -176,7 +176,7 @@ typedef basic_fstream<wchar_t> wfstream;
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class basic_filebuf
|
||||
class _LIBCPP_VISIBLE basic_filebuf
|
||||
: public basic_streambuf<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
@@ -189,13 +189,13 @@ public:
|
||||
|
||||
// 27.9.1.2 Constructors/destructor:
|
||||
basic_filebuf();
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_filebuf(basic_filebuf&& __rhs);
|
||||
#endif
|
||||
virtual ~basic_filebuf();
|
||||
|
||||
// 27.9.1.3 Assign/swap:
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_filebuf& operator=(basic_filebuf&& __rhs);
|
||||
#endif
|
||||
void swap(basic_filebuf& __rhs);
|
||||
@@ -260,7 +260,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf()
|
||||
setbuf(0, 4096);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
|
||||
@@ -333,7 +333,7 @@ basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs)
|
||||
swap(__rhs);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_filebuf<_CharT, _Traits>::~basic_filebuf()
|
||||
@@ -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 = _STD::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;
|
||||
@@ -957,7 +957,7 @@ basic_filebuf<_CharT, _Traits>::__write_mode()
|
||||
// basic_ifstream
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class basic_ifstream
|
||||
class _LIBCPP_VISIBLE basic_ifstream
|
||||
: public basic_istream<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
@@ -970,11 +970,11 @@ public:
|
||||
basic_ifstream();
|
||||
explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in);
|
||||
explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_ifstream(basic_ifstream&& __rhs);
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_ifstream& operator=(basic_ifstream&& __rhs);
|
||||
#endif
|
||||
void swap(basic_ifstream& __rhs);
|
||||
@@ -1014,7 +1014,7 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::ope
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1035,7 +1035,7 @@ basic_ifstream<_CharT, _Traits>::operator=(basic_ifstream&& __rhs)
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1102,7 +1102,7 @@ basic_ifstream<_CharT, _Traits>::close()
|
||||
// basic_ofstream
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class basic_ofstream
|
||||
class _LIBCPP_VISIBLE basic_ofstream
|
||||
: public basic_ostream<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
@@ -1115,11 +1115,11 @@ public:
|
||||
basic_ofstream();
|
||||
explicit basic_ofstream(const char* __s, ios_base::openmode __mode = ios_base::out);
|
||||
explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_ofstream(basic_ofstream&& __rhs);
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_ofstream& operator=(basic_ofstream&& __rhs);
|
||||
#endif
|
||||
void swap(basic_ofstream& __rhs);
|
||||
@@ -1159,7 +1159,7 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::ope
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1180,7 +1180,7 @@ basic_ofstream<_CharT, _Traits>::operator=(basic_ofstream&& __rhs)
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1247,7 +1247,7 @@ basic_ofstream<_CharT, _Traits>::close()
|
||||
// basic_fstream
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class basic_fstream
|
||||
class _LIBCPP_VISIBLE basic_fstream
|
||||
: public basic_iostream<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
@@ -1260,11 +1260,11 @@ public:
|
||||
basic_fstream();
|
||||
explicit basic_fstream(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||
explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_fstream(basic_fstream&& __rhs);
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_fstream& operator=(basic_fstream&& __rhs);
|
||||
#endif
|
||||
void swap(basic_fstream& __rhs);
|
||||
@@ -1304,7 +1304,7 @@ basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openm
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1325,7 +1325,7 @@ basic_fstream<_CharT, _Traits>::operator=(basic_fstream&& __rhs)
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
|
File diff suppressed because it is too large
Load Diff
2185
include/future
2185
include/future
File diff suppressed because it is too large
Load Diff
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -52,13 +52,13 @@ namespace std // purposefully not versioned
|
||||
{
|
||||
|
||||
template<class _E>
|
||||
class initializer_list
|
||||
class _LIBCPP_VISIBLE initializer_list
|
||||
{
|
||||
const _E* __begin_;
|
||||
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();
|
||||
}
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -43,10 +43,12 @@ class __iom_t1
|
||||
{
|
||||
ios_base::fmtflags __mask_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __iom_t1(ios_base::fmtflags __m) : __mask_(__m) {}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t1& __x)
|
||||
{
|
||||
@@ -56,6 +58,7 @@ public:
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t1& __x)
|
||||
{
|
||||
@@ -77,10 +80,12 @@ class __iom_t2
|
||||
{
|
||||
ios_base::fmtflags __mask_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __iom_t2(ios_base::fmtflags __m) : __mask_(__m) {}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t2& __x)
|
||||
{
|
||||
@@ -90,6 +95,7 @@ public:
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t2& __x)
|
||||
{
|
||||
@@ -111,10 +117,12 @@ class __iom_t3
|
||||
{
|
||||
int __base_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __iom_t3(int __b) : __base_(__b) {}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t3& __x)
|
||||
{
|
||||
@@ -127,6 +135,7 @@ public:
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t3& __x)
|
||||
{
|
||||
@@ -152,10 +161,12 @@ class __iom_t4
|
||||
{
|
||||
_CharT __fill_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __iom_t4(_CharT __c) : __fill_(__c) {}
|
||||
|
||||
template <class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t4& __x)
|
||||
{
|
||||
@@ -178,10 +189,12 @@ class __iom_t5
|
||||
{
|
||||
int __n_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __iom_t5(int __n) : __n_(__n) {}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t5& __x)
|
||||
{
|
||||
@@ -191,6 +204,7 @@ public:
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t5& __x)
|
||||
{
|
||||
@@ -212,10 +226,12 @@ class __iom_t6
|
||||
{
|
||||
int __n_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __iom_t6(int __n) : __n_(__n) {}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t6& __x)
|
||||
{
|
||||
@@ -225,6 +241,7 @@ public:
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t6& __x)
|
||||
{
|
||||
@@ -254,6 +271,7 @@ class __iom_t7
|
||||
_MoneyT& __mon_;
|
||||
bool __intl_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t7(_MoneyT& __mon, bool __intl)
|
||||
: __mon_(__mon), __intl_(__intl) {}
|
||||
|
||||
@@ -313,6 +331,7 @@ class __iom_t8
|
||||
const _MoneyT& __mon_;
|
||||
bool __intl_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t8(const _MoneyT& __mon, bool __intl)
|
||||
: __mon_(__mon), __intl_(__intl) {}
|
||||
|
||||
@@ -371,6 +390,7 @@ class __iom_t9
|
||||
tm* __tm_;
|
||||
const _CharT* __fmt_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t9(tm* __tm, const _CharT* __fmt)
|
||||
: __tm_(__tm), __fmt_(__fmt) {}
|
||||
|
||||
@@ -431,6 +451,7 @@ class __iom_t10
|
||||
const tm* __tm_;
|
||||
const _CharT* __fmt_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__iom_t10(const tm* __tm, const _CharT* __fmt)
|
||||
: __tm_(__tm), __fmt_(__fmt) {}
|
||||
|
||||
|
74
include/ios
74
include/ios
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -222,7 +222,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
typedef ptrdiff_t streamsize;
|
||||
|
||||
class ios_base
|
||||
class _LIBCPP_VISIBLE ios_base
|
||||
{
|
||||
public:
|
||||
class failure;
|
||||
@@ -272,16 +272,16 @@ public:
|
||||
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,22 +307,23 @@ 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();
|
||||
|
||||
protected:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
ios_base() {// purposefully does no initialization
|
||||
}
|
||||
|
||||
@@ -370,7 +371,7 @@ private:
|
||||
};
|
||||
|
||||
//enum class io_errc
|
||||
struct io_errc
|
||||
struct _LIBCPP_VISIBLE io_errc
|
||||
{
|
||||
enum _ {
|
||||
stream = 1
|
||||
@@ -381,9 +382,12 @@ enum _ {
|
||||
_LIBCPP_ALWAYS_INLINE operator int() const {return __v_;}
|
||||
};
|
||||
|
||||
template <> struct is_error_code_enum<io_errc> : public true_type { };
|
||||
template <> struct is_error_code_enum<io_errc::_> : public true_type { };
|
||||
template <>
|
||||
struct _LIBCPP_VISIBLE is_error_code_enum<io_errc> : public true_type { };
|
||||
template <>
|
||||
struct _LIBCPP_VISIBLE is_error_code_enum<io_errc::_> : public true_type { };
|
||||
|
||||
_LIBCPP_VISIBLE
|
||||
const error_category& iostream_category();
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -400,7 +404,7 @@ make_error_condition(io_errc __e)
|
||||
return error_condition(static_cast<int>(__e), iostream_category());
|
||||
}
|
||||
|
||||
class ios_base::failure
|
||||
class _LIBCPP_EXCEPTION_ABI ios_base::failure
|
||||
: public system_error
|
||||
{
|
||||
public:
|
||||
@@ -409,7 +413,7 @@ public:
|
||||
virtual ~failure() throw();
|
||||
};
|
||||
|
||||
class ios_base::Init
|
||||
class _LIBCPP_VISIBLE ios_base::Init
|
||||
{
|
||||
public:
|
||||
Init();
|
||||
@@ -556,7 +560,7 @@ ios_base::exceptions(iostate __except)
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class basic_ios
|
||||
class _LIBCPP_VISIBLE basic_ios
|
||||
: public ios_base
|
||||
{
|
||||
public:
|
||||
@@ -583,36 +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);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#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_;
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -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,32 +93,49 @@ typedef fpos<char_traits<wchar_t>::state_type> wstreampos;
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template<class _CharT> struct char_traits;
|
||||
template<class _Tp> class allocator;
|
||||
class ios_base;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_ios;
|
||||
template<class _CharT> struct _LIBCPP_VISIBLE char_traits;
|
||||
template<class _Tp> class _LIBCPP_VISIBLE allocator;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_streambuf;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_istream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_ostream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_iostream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_ios;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> >
|
||||
class basic_stringbuf;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> >
|
||||
class basic_istringstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> >
|
||||
class basic_ostringstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> >
|
||||
class basic_stringstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_streambuf;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_istream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_ostream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_iostream;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_filebuf;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_ifstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_ofstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_fstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT>,
|
||||
class _Allocator = allocator<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_stringbuf;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT>,
|
||||
class _Allocator = allocator<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_istringstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT>,
|
||||
class _Allocator = allocator<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_ostringstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT>,
|
||||
class _Allocator = allocator<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_stringstream;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> > class istreambuf_iterator;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> > class ostreambuf_iterator;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_filebuf;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_ifstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_ofstream;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_fstream;
|
||||
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_VISIBLE istreambuf_iterator;
|
||||
template <class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_VISIBLE ostreambuf_iterator;
|
||||
|
||||
typedef basic_ios<char> ios;
|
||||
typedef basic_ios<wchar_t> wios;
|
||||
@@ -152,7 +170,7 @@ typedef basic_ifstream<wchar_t> wifstream;
|
||||
typedef basic_ofstream<wchar_t> wofstream;
|
||||
typedef basic_fstream<wchar_t> wfstream;
|
||||
|
||||
template <class _State> class fpos;
|
||||
template <class _State> class _LIBCPP_VISIBLE fpos;
|
||||
typedef fpos<mbstate_t> streampos;
|
||||
typedef fpos<mbstate_t> wstreampos;
|
||||
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
@@ -164,7 +182,8 @@ typedef long long streamoff; // for char_traits in <string>
|
||||
|
||||
template <class _CharT, // for <stdexcept>
|
||||
class _Traits = char_traits<_CharT>,
|
||||
class _Allocator = allocator<_CharT> > class basic_string;
|
||||
class _Allocator = allocator<_CharT> >
|
||||
class _LIBCPP_VISIBLE basic_string;
|
||||
typedef basic_string<char, char_traits<char>, allocator<char> > string;
|
||||
typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring;
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -160,7 +160,7 @@ template <class charT, class traits, class T>
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class basic_istream
|
||||
class _LIBCPP_VISIBLE basic_istream
|
||||
: virtual public basic_ios<_CharT, _Traits>
|
||||
{
|
||||
streamsize __gc_;
|
||||
@@ -176,12 +176,12 @@ public:
|
||||
explicit basic_istream(basic_streambuf<char_type, traits_type>* __sb);
|
||||
virtual ~basic_istream();
|
||||
protected:
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_istream(basic_istream&& __rhs);
|
||||
#endif
|
||||
|
||||
// 27.7.1.1.2 Assign/swap:
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_istream& operator=(basic_istream&& __rhs);
|
||||
#endif
|
||||
void swap(basic_istream& __rhs);
|
||||
@@ -211,6 +211,7 @@ public:
|
||||
basic_istream& operator>>(void*& __p);
|
||||
|
||||
// 27.7.1.3 Unformatted input:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
streamsize gcount() const {return __gc_;}
|
||||
int_type get();
|
||||
basic_istream& get(char_type& __c);
|
||||
@@ -237,7 +238,7 @@ public:
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class basic_istream<_CharT, _Traits>::sentry
|
||||
class _LIBCPP_VISIBLE basic_istream<_CharT, _Traits>::sentry
|
||||
{
|
||||
bool __ok_;
|
||||
|
||||
@@ -248,6 +249,7 @@ public:
|
||||
explicit sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false);
|
||||
// ~sentry() = default;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
// explicit
|
||||
operator bool() const {return __ok_;}
|
||||
};
|
||||
@@ -287,7 +289,7 @@ basic_istream<_CharT, _Traits>::basic_istream(basic_streambuf<char_type, traits_
|
||||
this->init(__sb);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -307,7 +309,7 @@ basic_istream<_CharT, _Traits>::operator=(basic_istream&& __rhs)
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_istream<_CharT, _Traits>::~basic_istream()
|
||||
@@ -799,6 +801,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;
|
||||
@@ -810,6 +819,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
|
||||
}
|
||||
else
|
||||
__is.setstate(ios_base::eofbit | ios_base::failbit);
|
||||
#endif
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
@@ -1263,7 +1273,7 @@ basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
__c = min(__c, __n);
|
||||
__c = _STD::min(__c, __n);
|
||||
for (streamsize __k = 0; __k < __c; ++__k, ++__s, ++__i)
|
||||
*__s = *__i;
|
||||
}
|
||||
@@ -1463,7 +1473,7 @@ ws(basic_istream<_CharT, _Traits>& __is)
|
||||
return __is;
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1474,10 +1484,10 @@ operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x)
|
||||
return __is;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class basic_iostream
|
||||
class _LIBCPP_VISIBLE basic_iostream
|
||||
: public basic_istream<_CharT, _Traits>,
|
||||
public basic_ostream<_CharT, _Traits>
|
||||
{
|
||||
@@ -1493,12 +1503,12 @@ public:
|
||||
explicit basic_iostream(basic_streambuf<char_type, traits_type>* __sb);
|
||||
virtual ~basic_iostream();
|
||||
protected:
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_iostream(basic_iostream&& __rhs);
|
||||
#endif
|
||||
|
||||
// assign/swap
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_iostream& operator=(basic_iostream&& __rhs);
|
||||
#endif
|
||||
void swap(basic_iostream& __rhs);
|
||||
@@ -1512,7 +1522,7 @@ basic_iostream<_CharT, _Traits>::basic_iostream(basic_streambuf<char_type, trait
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1530,7 +1540,7 @@ basic_iostream<_CharT, _Traits>::operator=(basic_iostream&& __rhs)
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_iostream<_CharT, _Traits>::~basic_iostream()
|
||||
@@ -1647,7 +1657,7 @@ getline(basic_istream<_CharT, _Traits>& __is,
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
getline(basic_istream<_CharT, _Traits>& __is,
|
||||
basic_string<_CharT, _Traits, _Allocator>& __str)
|
||||
@@ -1655,10 +1665,10 @@ getline(basic_istream<_CharT, _Traits>& __is,
|
||||
return getline(__is, __str, __is.widen('\n'));
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
getline(basic_istream<_CharT, _Traits>&& __is,
|
||||
basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm)
|
||||
@@ -1667,7 +1677,7 @@ getline(basic_istream<_CharT, _Traits>&& __is,
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
getline(basic_istream<_CharT, _Traits>&& __is,
|
||||
basic_string<_CharT, _Traits, _Allocator>& __str)
|
||||
@@ -1675,7 +1685,7 @@ getline(basic_istream<_CharT, _Traits>&& __is,
|
||||
return getline(__is, __str, __is.widen('\n'));
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits, size_t _Size>
|
||||
basic_istream<_CharT, _Traits>&
|
||||
|
196
include/iterator
196
include/iterator
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -151,7 +151,7 @@ public:
|
||||
typedef void pointer;
|
||||
|
||||
explicit back_insert_iterator(Container& x);
|
||||
back_insert_iterator& operator=(typename Container::const_reference value);
|
||||
back_insert_iterator& operator=(const typename Container::value_type& value);
|
||||
back_insert_iterator& operator*();
|
||||
back_insert_iterator& operator++();
|
||||
back_insert_iterator operator++(int);
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
typedef void pointer;
|
||||
|
||||
explicit front_insert_iterator(Container& x);
|
||||
front_insert_iterator& operator=(typename Container::const_reference value);
|
||||
front_insert_iterator& operator=(const typename Container::value_type& value);
|
||||
front_insert_iterator& operator*();
|
||||
front_insert_iterator& operator++();
|
||||
front_insert_iterator operator++(int);
|
||||
@@ -194,7 +194,7 @@ public:
|
||||
typedef void pointer;
|
||||
|
||||
insert_iterator(Container& x, typename Container::iterator i);
|
||||
insert_iterator& operator=(typename Container::const_reference value);
|
||||
insert_iterator& operator=(const typename Container::value_type& value);
|
||||
insert_iterator& operator*();
|
||||
insert_iterator& operator++();
|
||||
insert_iterator& operator++(int);
|
||||
@@ -325,11 +325,11 @@ template <class T, size_t N> T* end(T (&array)[N]);
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
struct input_iterator_tag {};
|
||||
struct output_iterator_tag {};
|
||||
struct forward_iterator_tag : public input_iterator_tag {};
|
||||
struct bidirectional_iterator_tag : public forward_iterator_tag {};
|
||||
struct random_access_iterator_tag : public bidirectional_iterator_tag {};
|
||||
struct _LIBCPP_VISIBLE input_iterator_tag {};
|
||||
struct _LIBCPP_VISIBLE output_iterator_tag {};
|
||||
struct _LIBCPP_VISIBLE forward_iterator_tag : public input_iterator_tag {};
|
||||
struct _LIBCPP_VISIBLE bidirectional_iterator_tag : public forward_iterator_tag {};
|
||||
struct _LIBCPP_VISIBLE random_access_iterator_tag : public bidirectional_iterator_tag {};
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_iterator_category
|
||||
@@ -372,11 +372,11 @@ struct __iterator_traits<_Iter, true>
|
||||
// the client expects instead of failing at compile time.
|
||||
|
||||
template <class _Iter>
|
||||
struct iterator_traits
|
||||
struct _LIBCPP_VISIBLE iterator_traits
|
||||
: __iterator_traits<_Iter, __has_iterator_category<_Iter>::value> {};
|
||||
|
||||
template<class _Tp>
|
||||
struct iterator_traits<_Tp*>
|
||||
struct _LIBCPP_VISIBLE iterator_traits<_Tp*>
|
||||
{
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef typename remove_const<_Tp>::type value_type;
|
||||
@@ -407,7 +407,7 @@ struct __is_random_access_iterator : public __has_iterator_category_convertible_
|
||||
|
||||
template<class _Category, class _Tp, class _Distance = ptrdiff_t,
|
||||
class _Pointer = _Tp*, class _Reference = _Tp&>
|
||||
struct iterator
|
||||
struct _LIBCPP_VISIBLE iterator
|
||||
{
|
||||
typedef _Tp value_type;
|
||||
typedef _Distance difference_type;
|
||||
@@ -482,29 +482,29 @@ distance(_InputIter __first, _InputIter __last)
|
||||
}
|
||||
|
||||
template <class _ForwardIter>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_ForwardIter
|
||||
next(_ForwardIter __x,
|
||||
typename iterator_traits<_ForwardIter>::difference_type __n = 1,
|
||||
typename enable_if<__is_forward_iterator<_ForwardIter>::value>::type* = 0)
|
||||
{
|
||||
advance(__x, __n);
|
||||
_STD::advance(__x, __n);
|
||||
return __x;
|
||||
}
|
||||
|
||||
template <class _BidiretionalIter>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_BidiretionalIter
|
||||
prev(_BidiretionalIter __x,
|
||||
typename iterator_traits<_BidiretionalIter>::difference_type __n = 1,
|
||||
typename enable_if<__is_bidirectional_iterator<_BidiretionalIter>::value>::type* = 0)
|
||||
{
|
||||
advance(__x, -__n);
|
||||
_STD::advance(__x, -__n);
|
||||
return __x;
|
||||
}
|
||||
|
||||
template <class _Iter>
|
||||
class reverse_iterator
|
||||
class _LIBCPP_VISIBLE reverse_iterator
|
||||
: public iterator<typename iterator_traits<_Iter>::iterator_category,
|
||||
typename iterator_traits<_Iter>::value_type,
|
||||
typename iterator_traits<_Iter>::difference_type,
|
||||
@@ -611,7 +611,7 @@ operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_i
|
||||
}
|
||||
|
||||
template <class _Container>
|
||||
class back_insert_iterator
|
||||
class _LIBCPP_VISIBLE back_insert_iterator
|
||||
: public iterator<output_iterator_tag,
|
||||
void,
|
||||
void,
|
||||
@@ -624,12 +624,12 @@ public:
|
||||
typedef _Container container_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container& __x) : container(&__x) {}
|
||||
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::const_reference __value)
|
||||
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value)
|
||||
{container->push_back(__value); return *this;}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#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;}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator*() {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator++() {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY back_insert_iterator operator++(int) {return *this;}
|
||||
@@ -644,7 +644,7 @@ back_inserter(_Container& __x)
|
||||
}
|
||||
|
||||
template <class _Container>
|
||||
class front_insert_iterator
|
||||
class _LIBCPP_VISIBLE front_insert_iterator
|
||||
: public iterator<output_iterator_tag,
|
||||
void,
|
||||
void,
|
||||
@@ -657,12 +657,12 @@ public:
|
||||
typedef _Container container_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container& __x) : container(&__x) {}
|
||||
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::const_reference __value)
|
||||
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value)
|
||||
{container->push_front(__value); return *this;}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#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;}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator*() {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator++() {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY front_insert_iterator operator++(int) {return *this;}
|
||||
@@ -677,7 +677,7 @@ front_inserter(_Container& __x)
|
||||
}
|
||||
|
||||
template <class _Container>
|
||||
class insert_iterator
|
||||
class _LIBCPP_VISIBLE insert_iterator
|
||||
: public iterator<output_iterator_tag,
|
||||
void,
|
||||
void,
|
||||
@@ -692,12 +692,12 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY insert_iterator(_Container& __x, typename _Container::iterator __i)
|
||||
: container(&__x), iter(__i) {}
|
||||
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::const_reference __value)
|
||||
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value)
|
||||
{iter = container->insert(iter, __value); ++iter; return *this;}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#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;}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator*() {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator++() {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator++(int) {return *this;}
|
||||
@@ -713,7 +713,7 @@ inserter(_Container& __x, typename _Container::iterator __i)
|
||||
|
||||
template <class _Tp, class _CharT = char,
|
||||
class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>
|
||||
class istream_iterator
|
||||
class _LIBCPP_VISIBLE istream_iterator
|
||||
: public iterator<input_iterator_tag, _Tp, _Distance, const _Tp*, const _Tp&>
|
||||
{
|
||||
public:
|
||||
@@ -752,7 +752,7 @@ public:
|
||||
};
|
||||
|
||||
template <class _Tp, class _CharT = char, class _Traits = char_traits<_CharT> >
|
||||
class ostream_iterator
|
||||
class _LIBCPP_VISIBLE ostream_iterator
|
||||
: public iterator<output_iterator_tag, void, void, void, void>
|
||||
{
|
||||
public:
|
||||
@@ -781,7 +781,7 @@ public:
|
||||
};
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
class istreambuf_iterator
|
||||
class _LIBCPP_VISIBLE istreambuf_iterator
|
||||
: public iterator<input_iterator_tag, _CharT,
|
||||
typename _Traits::off_type, _CharT*,
|
||||
_CharT>
|
||||
@@ -806,6 +806,7 @@ private:
|
||||
_LIBCPP_INLINE_VISIBILITY char_type operator*() const {return __keep_;}
|
||||
};
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __test_for_eof()
|
||||
{
|
||||
if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sgetc(), traits_type::eof()))
|
||||
@@ -820,7 +821,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) throw()
|
||||
: __sbuf_(__p.__sbuf_) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _CharT operator*() const {return __sbuf_->sgetc();}
|
||||
_LIBCPP_INLINE_VISIBILITY _CharT operator*() const {return __sbuf_->sgetc();}
|
||||
_LIBCPP_INLINE_VISIBILITY char_type* operator->() const {return nullptr;}
|
||||
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++()
|
||||
{
|
||||
@@ -852,7 +853,7 @@ bool operator!=(const istreambuf_iterator<_CharT,_Traits>& __a,
|
||||
{return !__a.equal(__b);}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class ostreambuf_iterator
|
||||
class _LIBCPP_VISIBLE ostreambuf_iterator
|
||||
: public iterator<output_iterator_tag, void, void, void, void>
|
||||
{
|
||||
public:
|
||||
@@ -880,7 +881,7 @@ public:
|
||||
};
|
||||
|
||||
template <class _Iter>
|
||||
class move_iterator
|
||||
class _LIBCPP_VISIBLE move_iterator
|
||||
{
|
||||
private:
|
||||
_Iter __i;
|
||||
@@ -890,7 +891,7 @@ public:
|
||||
typedef typename iterator_traits<iterator_type>::value_type value_type;
|
||||
typedef typename iterator_traits<iterator_type>::difference_type difference_type;
|
||||
typedef typename iterator_traits<iterator_type>::pointer pointer;
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
typedef value_type&& reference;
|
||||
#else
|
||||
typedef typename iterator_traits<iterator_type>::reference reference;
|
||||
@@ -901,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;}
|
||||
@@ -918,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>
|
||||
@@ -999,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);
|
||||
@@ -1037,7 +1045,7 @@ template <class _B1, class _B2> _B2 move_backward(_B1, _B1, _B2);
|
||||
template <class _Tp>
|
||||
typename enable_if
|
||||
<
|
||||
has_trivial_copy_assign<_Tp>::value,
|
||||
is_trivially_copy_assignable<_Tp>::value,
|
||||
_Tp*
|
||||
>::type
|
||||
__unwrap_iter(__wrap_iter<_Tp*>);
|
||||
@@ -1055,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;
|
||||
@@ -1090,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);
|
||||
@@ -1136,7 +1144,7 @@ private:
|
||||
friend
|
||||
typename enable_if
|
||||
<
|
||||
has_trivial_copy_assign<_Tp>::value,
|
||||
is_trivially_copy_assignable<_Tp>::value,
|
||||
_Tp*
|
||||
>::type
|
||||
__unwrap_iter(__wrap_iter<_Tp*>);
|
||||
@@ -1145,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();
|
||||
}
|
||||
@@ -1153,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();
|
||||
}
|
||||
@@ -1161,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();
|
||||
}
|
||||
@@ -1169,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();
|
||||
}
|
||||
@@ -1177,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();
|
||||
}
|
||||
@@ -1185,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();
|
||||
}
|
||||
@@ -1193,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();
|
||||
}
|
||||
@@ -1202,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);
|
||||
}
|
||||
@@ -1615,10 +1623,10 @@ operator+(typename __debug_iter<_Container, _Iter>::difference_type __n,
|
||||
|
||||
#endif // _LIBCPP_DEBUG
|
||||
|
||||
#if defined(_LIBCPP_MOVE) && !defined(_LIBCPP_HAS_NO_DECLTYPE)
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
|
||||
|
||||
template <class _C>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
begin(_C& __c) -> decltype(__c.begin())
|
||||
{
|
||||
@@ -1626,7 +1634,7 @@ begin(_C& __c) -> decltype(__c.begin())
|
||||
}
|
||||
|
||||
template <class _C>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
begin(const _C& __c) -> decltype(__c.begin())
|
||||
{
|
||||
@@ -1634,7 +1642,7 @@ begin(const _C& __c) -> decltype(__c.begin())
|
||||
}
|
||||
|
||||
template <class _C>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
end(_C& __c) -> decltype(__c.end())
|
||||
{
|
||||
@@ -1642,17 +1650,17 @@ end(_C& __c) -> decltype(__c.end())
|
||||
}
|
||||
|
||||
template <class _C>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
end(const _C& __c) -> decltype(__c.end())
|
||||
{
|
||||
return __c.end();
|
||||
}
|
||||
|
||||
#else // defined(_LIBCPP_MOVE) && !defined(_LIBCPP_HAS_NO_DECLTYPE)
|
||||
#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
|
||||
|
||||
template <class _C>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename _C::iterator
|
||||
begin(_C& __c)
|
||||
{
|
||||
@@ -1660,7 +1668,7 @@ begin(_C& __c)
|
||||
}
|
||||
|
||||
template <class _C>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename _C::const_iterator
|
||||
begin(const _C& __c)
|
||||
{
|
||||
@@ -1668,7 +1676,7 @@ begin(const _C& __c)
|
||||
}
|
||||
|
||||
template <class _C>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename _C::iterator
|
||||
end(_C& __c)
|
||||
{
|
||||
@@ -1676,17 +1684,17 @@ end(_C& __c)
|
||||
}
|
||||
|
||||
template <class _C>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename _C::const_iterator
|
||||
end(const _C& __c)
|
||||
{
|
||||
return __c.end();
|
||||
}
|
||||
|
||||
#endif // defined(_LIBCPP_MOVE) && !defined(_LIBCPP_HAS_NO_DECLTYPE)
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
|
||||
|
||||
template <class _T, size_t _N>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_T*
|
||||
begin(_T (&__array)[_N])
|
||||
{
|
||||
@@ -1694,7 +1702,7 @@ begin(_T (&__array)[_N])
|
||||
}
|
||||
|
||||
template <class _T, size_t _N>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_T*
|
||||
end(_T (&__array)[_N])
|
||||
{
|
||||
|
210
include/limits
210
include/limits
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -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;
|
||||
@@ -425,16 +425,16 @@ protected:
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
class numeric_limits
|
||||
class _LIBCPP_VISIBLE numeric_limits
|
||||
: private __libcpp_numeric_limits<typename remove_cv<_Tp>::type>
|
||||
{
|
||||
typedef __libcpp_numeric_limits<typename remove_cv<_Tp>::type> __base;
|
||||
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;
|
||||
@@ -471,16 +471,16 @@ public:
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
class numeric_limits<const _Tp>
|
||||
class _LIBCPP_VISIBLE numeric_limits<const _Tp>
|
||||
: private numeric_limits<_Tp>
|
||||
{
|
||||
typedef numeric_limits<_Tp> __base;
|
||||
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;
|
||||
@@ -517,16 +517,16 @@ public:
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
class numeric_limits<volatile _Tp>
|
||||
class _LIBCPP_VISIBLE numeric_limits<volatile _Tp>
|
||||
: private numeric_limits<_Tp>
|
||||
{
|
||||
typedef numeric_limits<_Tp> __base;
|
||||
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;
|
||||
@@ -563,16 +563,16 @@ public:
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
class numeric_limits<const volatile _Tp>
|
||||
class _LIBCPP_VISIBLE numeric_limits<const volatile _Tp>
|
||||
: private numeric_limits<_Tp>
|
||||
{
|
||||
typedef numeric_limits<_Tp> __base;
|
||||
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;
|
||||
|
447
include/list
447
include/list
File diff suppressed because it is too large
Load Diff
235
include/locale
235
include/locale
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -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);
|
||||
@@ -198,7 +198,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
#if __APPLE__
|
||||
|
||||
template <class _Tp>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_sprintf(char* __restrict __str,
|
||||
const char* __restrict __format, _Tp __v)
|
||||
@@ -207,7 +207,7 @@ __nolocale_sprintf(char* __restrict __str,
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_snprintf(char* __restrict __str, size_t __size,
|
||||
const char* __restrict __format, _Tp __v)
|
||||
@@ -216,7 +216,7 @@ __nolocale_snprintf(char* __restrict __str, size_t __size,
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_snprintf(char* __restrict __str, size_t __size,
|
||||
const char* __restrict __format, int __prec, _Tp __v)
|
||||
@@ -225,7 +225,7 @@ __nolocale_snprintf(char* __restrict __str, size_t __size,
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_asprintf(char** __ret, const char* __restrict __format, _Tp __v)
|
||||
{
|
||||
@@ -233,7 +233,7 @@ __nolocale_asprintf(char** __ret, const char* __restrict __format, _Tp __v)
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_asprintf(char** __ret, const char* __restrict __format, int __prec,
|
||||
_Tp __v)
|
||||
@@ -242,7 +242,7 @@ __nolocale_asprintf(char** __ret, const char* __restrict __format, int __prec,
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_sscanf(const char* __restrict __str,
|
||||
const char* __restrict __format, _Tp* __v)
|
||||
@@ -250,14 +250,14 @@ __nolocale_sscanf(const char* __restrict __str,
|
||||
return sscanf_l(__str, 0, __format, __v);
|
||||
}
|
||||
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_isxdigit(int __c)
|
||||
{
|
||||
return isxdigit_l(__c, 0);
|
||||
}
|
||||
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_isdigit(int __c)
|
||||
{
|
||||
@@ -265,7 +265,11 @@ __nolocale_isdigit(int __c)
|
||||
}
|
||||
|
||||
#else // __APPLE__
|
||||
inline int
|
||||
inline
|
||||
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#endif
|
||||
int
|
||||
__nolocale_sprintf(char* __restrict __str,
|
||||
const char* __restrict __format, ...)
|
||||
{
|
||||
@@ -275,7 +279,11 @@ __nolocale_sprintf(char* __restrict __str,
|
||||
va_end(__ap);
|
||||
return __result;
|
||||
}
|
||||
inline int
|
||||
inline
|
||||
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#endif
|
||||
int
|
||||
__nolocale_snprintf(char* __restrict __str, size_t __size,
|
||||
const char* __restrict __format, ...)
|
||||
{
|
||||
@@ -285,7 +293,11 @@ __nolocale_snprintf(char* __restrict __str, size_t __size,
|
||||
va_end(__ap);
|
||||
return __result;
|
||||
}
|
||||
inline int
|
||||
inline
|
||||
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#endif
|
||||
int
|
||||
__nolocale_asprintf(char** __ret,
|
||||
const char* __restrict __format, ...)
|
||||
{
|
||||
@@ -295,7 +307,11 @@ __nolocale_asprintf(char** __ret,
|
||||
va_end(__ap);
|
||||
return __result;
|
||||
}
|
||||
inline int
|
||||
inline
|
||||
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#endif
|
||||
int
|
||||
__nolocale_sscanf(const char* __restrict __str,
|
||||
const char* __restrict __format, ...)
|
||||
{
|
||||
@@ -305,12 +321,15 @@ __nolocale_sscanf(const char* __restrict __str,
|
||||
va_end(__ap);
|
||||
return __result;
|
||||
}
|
||||
inline int
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_isxdigit(int __c)
|
||||
{
|
||||
return isxdigit(__c);
|
||||
}
|
||||
inline int
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
__nolocale_isdigit(int __c)
|
||||
{
|
||||
return isdigit(__c);
|
||||
@@ -503,6 +522,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)
|
||||
@@ -513,22 +538,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;
|
||||
}
|
||||
@@ -584,7 +615,7 @@ extern template class __num_get<char>;
|
||||
extern template class __num_get<wchar_t>;
|
||||
|
||||
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
|
||||
class num_get
|
||||
class _LIBCPP_VISIBLE num_get
|
||||
: public locale::facet,
|
||||
private __num_get<_CharT>
|
||||
{
|
||||
@@ -676,6 +707,7 @@ public:
|
||||
static locale::id id;
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~num_get() {}
|
||||
|
||||
virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
|
||||
@@ -713,22 +745,27 @@ __num_get_signed_integral(const char* __a, const char* __a_end,
|
||||
{
|
||||
if (__a != __a_end)
|
||||
{
|
||||
int __save_errno = errno;
|
||||
errno = 0;
|
||||
char *__p2;
|
||||
long long __ll = strtoll_l(__a, &__p2, __base, 0);
|
||||
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);
|
||||
}
|
||||
@@ -743,14 +780,25 @@ __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;
|
||||
unsigned long long __ll = strtoull_l(__a, &__p2, __base, 0);
|
||||
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();
|
||||
@@ -1335,7 +1383,7 @@ extern template class __num_put<char>;
|
||||
extern template class __num_put<wchar_t>;
|
||||
|
||||
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
|
||||
class num_put
|
||||
class _LIBCPP_VISIBLE num_put
|
||||
: public locale::facet,
|
||||
private __num_put<_CharT>
|
||||
{
|
||||
@@ -1406,6 +1454,7 @@ public:
|
||||
static locale::id id;
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~num_put() {}
|
||||
|
||||
virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
|
||||
@@ -1740,14 +1789,14 @@ __get_up_to_n_digits(_InputIterator& __b, _InputIterator __e,
|
||||
return __r;
|
||||
}
|
||||
|
||||
class time_base
|
||||
class _LIBCPP_VISIBLE time_base
|
||||
{
|
||||
public:
|
||||
enum dateorder {no_order, dmy, mdy, ymd, ydm};
|
||||
};
|
||||
|
||||
template <class _CharT>
|
||||
class __time_get_c_storage
|
||||
class __time_get_c_storage // purposefully not decorated
|
||||
{
|
||||
protected:
|
||||
typedef basic_string<_CharT> string_type;
|
||||
@@ -1762,7 +1811,7 @@ protected:
|
||||
};
|
||||
|
||||
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
|
||||
class time_get
|
||||
class _LIBCPP_VISIBLE time_get
|
||||
: public locale::facet,
|
||||
public time_base,
|
||||
private __time_get_c_storage<_CharT>
|
||||
@@ -1833,6 +1882,7 @@ public:
|
||||
static locale::id id;
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~time_get() {}
|
||||
|
||||
virtual dateorder do_date_order() const;
|
||||
@@ -2296,6 +2346,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;
|
||||
@@ -2406,7 +2462,7 @@ private:
|
||||
};
|
||||
|
||||
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
|
||||
class time_get_byname
|
||||
class _LIBCPP_VISIBLE time_get_byname
|
||||
: public time_get<_CharT, _InputIterator>,
|
||||
private __time_get_storage<_CharT>
|
||||
{
|
||||
@@ -2416,24 +2472,35 @@ public:
|
||||
typedef _CharT char_type;
|
||||
typedef basic_string<char_type> string_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit time_get_byname(const char* __nm, size_t __refs = 0)
|
||||
: time_get<_CharT, _InputIterator>(__refs),
|
||||
__time_get_storage<_CharT>(__nm) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit time_get_byname(const string& __nm, size_t __refs = 0)
|
||||
: time_get<_CharT, _InputIterator>(__refs),
|
||||
__time_get_storage<_CharT>(__nm) {}
|
||||
|
||||
protected:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~time_get_byname() {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
virtual dateorder do_date_order() const {return this->__do_date_order();}
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
virtual const string_type* __weeks() const {return this->__weeks_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
virtual const string_type* __months() const {return this->__months_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
virtual const string_type* __am_pm() const {return this->__am_pm_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
virtual const string_type& __c() const {return this->__c_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
virtual const string_type& __r() const {return this->__r_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
virtual const string_type& __x() const {return this->__x_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
virtual const string_type& __X() const {return this->__X_;}
|
||||
};
|
||||
|
||||
@@ -2455,7 +2522,7 @@ protected:
|
||||
};
|
||||
|
||||
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
|
||||
class time_put
|
||||
class _LIBCPP_VISIBLE time_put
|
||||
: public locale::facet,
|
||||
private __time_put
|
||||
{
|
||||
@@ -2480,13 +2547,16 @@ public:
|
||||
static locale::id id;
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~time_put() {}
|
||||
virtual iter_type do_put(iter_type __s, ios_base&, char_type, const tm* __tm,
|
||||
char __fmt, char __mod) const;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit time_put(const char* __nm, size_t __refs)
|
||||
: locale::facet(__refs),
|
||||
__time_put(__nm) {}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit time_put(const string& __nm, size_t __refs)
|
||||
: locale::facet(__refs),
|
||||
__time_put(__nm) {}
|
||||
@@ -2544,14 +2614,14 @@ 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 _STD::copy(__nb, __ne, __s);
|
||||
}
|
||||
|
||||
extern template class time_put<char>;
|
||||
extern template class time_put<wchar_t>;
|
||||
|
||||
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
|
||||
class time_put_byname
|
||||
class _LIBCPP_VISIBLE time_put_byname
|
||||
: public time_put<_CharT, _OutputIterator>
|
||||
{
|
||||
public:
|
||||
@@ -2564,6 +2634,7 @@ public:
|
||||
: time_put<_CharT, _OutputIterator>(__nm, __refs) {}
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~time_put_byname() {}
|
||||
};
|
||||
|
||||
@@ -2572,7 +2643,7 @@ extern template class time_put_byname<wchar_t>;
|
||||
|
||||
// money_base
|
||||
|
||||
class money_base
|
||||
class _LIBCPP_VISIBLE money_base
|
||||
{
|
||||
public:
|
||||
enum part {none, space, symbol, sign, value};
|
||||
@@ -2584,7 +2655,7 @@ public:
|
||||
// moneypunct
|
||||
|
||||
template <class _CharT, bool _International = false>
|
||||
class moneypunct
|
||||
class _LIBCPP_VISIBLE moneypunct
|
||||
: public locale::facet,
|
||||
public money_base
|
||||
{
|
||||
@@ -2592,6 +2663,7 @@ public:
|
||||
typedef _CharT char_type;
|
||||
typedef basic_string<char_type> string_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
explicit moneypunct(size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
|
||||
@@ -2609,6 +2681,7 @@ public:
|
||||
static const bool intl = _International;
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~moneypunct() {}
|
||||
|
||||
virtual char_type do_decimal_point() const {return numeric_limits<char_type>::max();}
|
||||
@@ -2636,7 +2709,8 @@ extern template class moneypunct<wchar_t, true>;
|
||||
// moneypunct_byname
|
||||
|
||||
template <class _CharT, bool _International = false>
|
||||
class moneypunct_byname : public moneypunct<_CharT, _International>
|
||||
class _LIBCPP_VISIBLE moneypunct_byname
|
||||
: public moneypunct<_CharT, _International>
|
||||
{
|
||||
public:
|
||||
typedef money_base::pattern pattern;
|
||||
@@ -2652,6 +2726,7 @@ public:
|
||||
: moneypunct<_CharT, _International>(__refs) {init(__nm.c_str());}
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~moneypunct_byname() {}
|
||||
|
||||
virtual char_type do_decimal_point() const {return __decimal_point_;}
|
||||
@@ -2746,7 +2821,7 @@ extern template class __money_get<char>;
|
||||
extern template class __money_get<wchar_t>;
|
||||
|
||||
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
|
||||
class money_get
|
||||
class _LIBCPP_VISIBLE money_get
|
||||
: public locale::facet,
|
||||
private __money_get<_CharT>
|
||||
{
|
||||
@@ -2777,6 +2852,7 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~money_get() {}
|
||||
|
||||
virtual iter_type do_get(iter_type __b, iter_type __e, bool __intl,
|
||||
@@ -3206,7 +3282,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 = _STD::copy(__sym.begin(), __sym.end(), __me);
|
||||
break;
|
||||
case money_base::value:
|
||||
{
|
||||
@@ -3265,7 +3341,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 = _STD::copy(__sn.begin()+1, __sn.end(), __me);
|
||||
// set alignment
|
||||
if ((__flags & ios_base::adjustfield) == ios_base::left)
|
||||
__mi = __me;
|
||||
@@ -3277,7 +3353,7 @@ extern template class __money_put<char>;
|
||||
extern template class __money_put<wchar_t>;
|
||||
|
||||
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
|
||||
class money_put
|
||||
class _LIBCPP_VISIBLE money_put
|
||||
: public locale::facet,
|
||||
private __money_put<_CharT>
|
||||
{
|
||||
@@ -3307,6 +3383,7 @@ public:
|
||||
static locale::id id;
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~money_put() {}
|
||||
|
||||
virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __iob,
|
||||
@@ -3428,16 +3505,16 @@ extern template class money_put<wchar_t>;
|
||||
|
||||
// messages
|
||||
|
||||
class messages_base
|
||||
class _LIBCPP_VISIBLE messages_base
|
||||
{
|
||||
public:
|
||||
typedef nl_catd catalog;
|
||||
typedef ptrdiff_t catalog;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE messages_base() {}
|
||||
};
|
||||
|
||||
template <class _CharT>
|
||||
class messages
|
||||
class _LIBCPP_VISIBLE messages
|
||||
: public locale::facet,
|
||||
public messages_base
|
||||
{
|
||||
@@ -3471,6 +3548,7 @@ public:
|
||||
static locale::id id;
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~messages() {}
|
||||
|
||||
virtual catalog do_open(const basic_string<char>&, const locale&) const;
|
||||
@@ -3487,7 +3565,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>
|
||||
@@ -3499,7 +3580,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));
|
||||
@@ -3510,14 +3594,17 @@ 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>;
|
||||
extern template class messages<wchar_t>;
|
||||
|
||||
template <class _CharT>
|
||||
class messages_byname
|
||||
class _LIBCPP_VISIBLE messages_byname
|
||||
: public messages<_CharT>
|
||||
{
|
||||
public:
|
||||
@@ -3533,6 +3620,7 @@ public:
|
||||
: messages<_CharT>(__refs) {}
|
||||
|
||||
protected:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
~messages_byname() {}
|
||||
};
|
||||
|
||||
@@ -3542,7 +3630,7 @@ extern template class messages_byname<wchar_t>;
|
||||
template<class _Codecvt, class _Elem = wchar_t,
|
||||
class _Wide_alloc = allocator<_Elem>,
|
||||
class _Byte_alloc = allocator<char> >
|
||||
class wstring_convert
|
||||
class _LIBCPP_VISIBLE wstring_convert
|
||||
{
|
||||
public:
|
||||
typedef basic_string<char, char_traits<char>, _Byte_alloc> byte_string;
|
||||
@@ -3564,33 +3652,41 @@ public:
|
||||
wstring_convert(_Codecvt* __pcvt, state_type __state);
|
||||
wstring_convert(const byte_string& __byte_err,
|
||||
const wide_string& __wide_err = wide_string());
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
wstring_convert(wstring_convert&& __wc);
|
||||
#endif
|
||||
~wstring_convert();
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
wide_string from_bytes(char __byte)
|
||||
{return from_bytes(&__byte, &__byte+1);}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
wide_string from_bytes(const char* __ptr)
|
||||
{return from_bytes(__ptr, __ptr + char_traits<char>::length(__ptr));}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
wide_string from_bytes(const byte_string& __str)
|
||||
{return from_bytes(__str.data(), __str.data() + __str.size());}
|
||||
wide_string from_bytes(const char* __first, const char* __last);
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
byte_string to_bytes(_Elem __wchar)
|
||||
{return to_bytes(&__wchar, &__wchar+1);}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
byte_string to_bytes(const _Elem* __wptr)
|
||||
{return to_bytes(__wptr, __wptr + char_traits<_Elem>::length(__wptr));}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
byte_string to_bytes(const wide_string& __wstr)
|
||||
{return to_bytes(__wstr.data(), __wstr.data() + __wstr.size());}
|
||||
byte_string to_bytes(const _Elem* __first, const _Elem* __last);
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
size_t converted() const {return __cvtcount_;}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
state_type state() const {return __cvtstate_;}
|
||||
};
|
||||
|
||||
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
|
||||
inline
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
|
||||
wstring_convert(_Codecvt* __pcvt)
|
||||
: __cvtptr_(__pcvt), __cvtstate_(), __cvtcount_(0)
|
||||
@@ -3598,7 +3694,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
|
||||
}
|
||||
|
||||
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
|
||||
inline
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
|
||||
wstring_convert(_Codecvt* __pcvt, state_type __state)
|
||||
: __cvtptr_(__pcvt), __cvtstate_(__state), __cvtcount_(0)
|
||||
@@ -3614,10 +3710,10 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
|
||||
__cvtptr_ = new _Codecvt;
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
|
||||
inline
|
||||
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_)),
|
||||
@@ -3628,7 +3724,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
|
||||
__wc.__cvtptr_ = nullptr;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
|
||||
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::~wstring_convert()
|
||||
@@ -3785,7 +3881,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
|
||||
}
|
||||
|
||||
template <class _Codecvt, class _Elem = wchar_t, class _Tr = char_traits<_Elem> >
|
||||
class wbuffer_convert
|
||||
class _LIBCPP_VISIBLE wbuffer_convert
|
||||
: public basic_streambuf<_Elem, _Tr>
|
||||
{
|
||||
public:
|
||||
@@ -3820,7 +3916,9 @@ public:
|
||||
state_type __state = state_type());
|
||||
~wbuffer_convert();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
streambuf* rdbuf() const {return __bufptr_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
streambuf* rdbuf(streambuf* __bytebuf)
|
||||
{
|
||||
streambuf* __r = __bufptr_;
|
||||
@@ -3828,6 +3926,7 @@ public:
|
||||
return __r;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
state_type state() const {return __st_;}
|
||||
|
||||
protected:
|
||||
@@ -3911,7 +4010,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 = _STD::min(static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz),
|
||||
static_cast<streamsize>(__extbufend_ - __extbufnext_));
|
||||
codecvt_base::result __r;
|
||||
state_type __svs = __st_;
|
||||
|
629
include/map
629
include/map
File diff suppressed because it is too large
Load Diff
996
include/memory
996
include/memory
File diff suppressed because it is too large
Load Diff
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -175,12 +175,15 @@ template<class Callable, class ...Args>
|
||||
#include <__config>
|
||||
#include <__mutex_base>
|
||||
#include <functional>
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#include <tuple>
|
||||
#endif
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class recursive_mutex
|
||||
class _LIBCPP_VISIBLE recursive_mutex
|
||||
{
|
||||
pthread_mutex_t __m_;
|
||||
|
||||
@@ -198,10 +201,11 @@ public:
|
||||
void unlock();
|
||||
|
||||
typedef pthread_mutex_t* native_handle_type;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
native_handle_type native_handle() {return &__m_;}
|
||||
};
|
||||
|
||||
class timed_mutex
|
||||
class _LIBCPP_VISIBLE timed_mutex
|
||||
{
|
||||
mutex __m_;
|
||||
condition_variable __cv_;
|
||||
@@ -218,8 +222,9 @@ public:
|
||||
void lock();
|
||||
bool try_lock();
|
||||
template <class _Rep, class _Period>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
|
||||
{return try_lock_until(chrono::monotonic_clock::now() + __d);}
|
||||
{return try_lock_until(chrono::steady_clock::now() + __d);}
|
||||
template <class _Clock, class _Duration>
|
||||
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
|
||||
void unlock();
|
||||
@@ -242,7 +247,7 @@ timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
|
||||
return false;
|
||||
}
|
||||
|
||||
class recursive_timed_mutex
|
||||
class _LIBCPP_VISIBLE recursive_timed_mutex
|
||||
{
|
||||
mutex __m_;
|
||||
condition_variable __cv_;
|
||||
@@ -260,8 +265,9 @@ public:
|
||||
void lock();
|
||||
bool try_lock();
|
||||
template <class _Rep, class _Period>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
|
||||
{return try_lock_until(chrono::monotonic_clock::now() + __d);}
|
||||
{return try_lock_until(chrono::steady_clock::now() + __d);}
|
||||
template <class _Clock, class _Duration>
|
||||
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
|
||||
void unlock();
|
||||
@@ -361,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)
|
||||
{
|
||||
@@ -372,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();
|
||||
@@ -385,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>
|
||||
inline
|
||||
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
|
||||
@@ -429,8 +435,9 @@ template<class _Callable>
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
struct once_flag
|
||||
struct _LIBCPP_VISIBLE once_flag
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
// constexpr
|
||||
once_flag() {}
|
||||
|
||||
@@ -451,23 +458,61 @@ private:
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _F>
|
||||
class __call_once_param
|
||||
{
|
||||
_F __f_;
|
||||
public:
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(_F&& __f) : __f_(_STD::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(_STD::move(_STD::get<0>(__f_)), _STD::move(_STD::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_(_STD::move(__f)) {}
|
||||
#else
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(const _F& __f) : __f_(__f) {}
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void operator()()
|
||||
{
|
||||
__f_();
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
template <class _F>
|
||||
void
|
||||
__call_once_proxy(void* __vp)
|
||||
@@ -487,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(_STD::forward<_Callable>(__func)),
|
||||
__decay_copy(_STD::forward<_Args>(__args))...));
|
||||
__call_once(__flag.__state_, &__p, &__call_once_proxy<_G>);
|
||||
}
|
||||
}
|
||||
|
89
include/new
89
include/new
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -21,34 +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 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;
|
||||
|
||||
*/
|
||||
|
||||
@@ -65,42 +65,51 @@ 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
|
||||
|
||||
struct nothrow_t {};
|
||||
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 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)
|
||||
#if !__has_feature(cxx_noexcept)
|
||||
throw(std::bad_alloc)
|
||||
#endif
|
||||
;
|
||||
_LIBCPP_VISIBLE void* operator new(std::size_t, const std::nothrow_t&) _NOEXCEPT;
|
||||
_LIBCPP_VISIBLE void operator delete(void*) _NOEXCEPT;
|
||||
_LIBCPP_VISIBLE void operator delete(void*, 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)
|
||||
#if !__has_feature(cxx_noexcept)
|
||||
throw(std::bad_alloc)
|
||||
#endif
|
||||
;
|
||||
_LIBCPP_VISIBLE void* operator new[](std::size_t, const std::nothrow_t&) _NOEXCEPT;
|
||||
_LIBCPP_VISIBLE void operator delete[](void*) _NOEXCEPT;
|
||||
_LIBCPP_VISIBLE void operator delete[](void*, 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
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -138,7 +138,7 @@ template <class charT, class traits, class T>
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class basic_ostream
|
||||
class _LIBCPP_VISIBLE basic_ostream
|
||||
: virtual public basic_ios<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
@@ -153,12 +153,12 @@ public:
|
||||
explicit basic_ostream(basic_streambuf<char_type, traits_type>* __sb);
|
||||
virtual ~basic_ostream();
|
||||
protected:
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_ostream(basic_ostream&& __rhs);
|
||||
#endif
|
||||
|
||||
// 27.7.2.3 Assign/swap
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_ostream& operator=(basic_ostream&& __rhs);
|
||||
#endif
|
||||
void swap(basic_ostream& __rhs);
|
||||
@@ -203,7 +203,7 @@ protected:
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class basic_ostream<_CharT, _Traits>::sentry
|
||||
class _LIBCPP_VISIBLE basic_ostream<_CharT, _Traits>::sentry
|
||||
{
|
||||
bool __ok_;
|
||||
basic_ostream<_CharT, _Traits>& __os_;
|
||||
@@ -261,7 +261,7 @@ basic_ostream<_CharT, _Traits>::basic_ostream(basic_streambuf<char_type, traits_
|
||||
this->init(__sb);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -279,7 +279,7 @@ basic_ostream<_CharT, _Traits>::operator=(basic_ostream&& __rhs)
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_ostream<_CharT, _Traits>::~basic_ostream()
|
||||
@@ -1206,7 +1206,7 @@ flush(basic_ostream<_CharT, _Traits>& __os)
|
||||
return __os;
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Stream, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1222,7 +1222,7 @@ operator<<(_Stream&& __os, const _Tp& __x)
|
||||
return __os;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
@@ -1276,7 +1276,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'),
|
||||
|
267
include/queue
267
include/queue
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -167,7 +186,7 @@ bool
|
||||
operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
|
||||
|
||||
template <class _Tp, class _Container = deque<_Tp> >
|
||||
class queue
|
||||
class _LIBCPP_VISIBLE queue
|
||||
{
|
||||
public:
|
||||
typedef _Container container_type;
|
||||
@@ -180,64 +199,103 @@ protected:
|
||||
container_type c;
|
||||
|
||||
public:
|
||||
queue() : c() {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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(_STD::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 = _STD::move(__q.c); return *this;}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit queue(const container_type& __c) : c(__c) {}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit queue(container_type&& __c) : c(_STD::move(__c)) {}
|
||||
queue(queue&& __q) : c(_STD::move(__q.c)) {}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit queue(const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(__a) {}
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue(const queue& __q, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(__q.c, __a) {}
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue(const container_type& __c, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(__c, __a) {}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
queue(container_type&& __c, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(_STD::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) {}
|
||||
|
||||
queue& operator=(queue&& __q)
|
||||
{
|
||||
c = _STD::move(__q.c);
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return c.empty();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return c.size();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference front() {return c.front();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reference front() const {return c.front();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference back() {return c.back();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reference back() const {return c.back();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void push(const value_type& __v) {c.push_back(__v);}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void push(value_type&& __v) {c.push_back(_STD::move(__v));}
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void emplace(_Args&&... __args)
|
||||
{c.emplace_back(_STD::forward<_Args>(__args)...);}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void pop() {c.pop_front();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(queue& __q)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value)
|
||||
{
|
||||
using _STD::swap;
|
||||
swap(c, __q.c);
|
||||
@@ -245,17 +303,19 @@ public:
|
||||
|
||||
template <class _T1, class _C1>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y);
|
||||
|
||||
template <class _T1, class _C1>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator< (const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y);
|
||||
};
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
{
|
||||
@@ -263,7 +323,7 @@ operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
{
|
||||
@@ -271,7 +331,7 @@ operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
{
|
||||
@@ -279,7 +339,7 @@ operator!=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator> (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
{
|
||||
@@ -287,7 +347,7 @@ operator> (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
{
|
||||
@@ -295,7 +355,7 @@ operator>=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
{
|
||||
@@ -303,22 +363,23 @@ operator<=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Alloc>
|
||||
struct uses_allocator<queue<_Tp, _Container>, _Alloc>
|
||||
struct _LIBCPP_VISIBLE uses_allocator<queue<_Tp, _Container>, _Alloc>
|
||||
: public uses_allocator<_Container, _Alloc>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp, class _Container = vector<_Tp>,
|
||||
class _Compare = less<typename _Container::value_type> >
|
||||
class priority_queue
|
||||
class _LIBCPP_VISIBLE priority_queue
|
||||
{
|
||||
public:
|
||||
typedef _Container container_type;
|
||||
@@ -333,10 +394,40 @@ protected:
|
||||
value_compare comp;
|
||||
|
||||
public:
|
||||
explicit priority_queue(const value_compare& __comp = value_compare())
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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(_STD::move(__q.c)), comp(_STD::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 = _STD::move(__q.c); comp = _STD::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);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
explicit priority_queue(const value_compare& __comp, container_type&& __c);
|
||||
#endif
|
||||
template <class _InputIter>
|
||||
@@ -345,13 +436,11 @@ public:
|
||||
template <class _InputIter>
|
||||
priority_queue(_InputIter __f, _InputIter __l,
|
||||
const value_compare& __comp, const container_type& __c);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
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_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Alloc>
|
||||
explicit priority_queue(const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
@@ -369,7 +458,7 @@ public:
|
||||
priority_queue(const priority_queue& __q, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Alloc>
|
||||
priority_queue(const value_compare& __comp, container_type&& __c,
|
||||
const _Alloc& __a,
|
||||
@@ -379,24 +468,31 @@ public:
|
||||
priority_queue(priority_queue&& __q, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0);
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return c.empty();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return c.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reference top() const {return c.front();}
|
||||
|
||||
void push(const value_type& __v);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void push(value_type&& __v);
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class... _Args> void emplace(_Args&&... __args);
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif
|
||||
#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>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp,
|
||||
const container_type& __c)
|
||||
: c(__c),
|
||||
@@ -405,10 +501,10 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp
|
||||
_STD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
|
||||
container_type&& __c)
|
||||
: c(_STD::move(__c)),
|
||||
@@ -417,11 +513,11 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
|
||||
_STD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _InputIter>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
|
||||
const value_compare& __comp)
|
||||
: c(__f, __l),
|
||||
@@ -432,7 +528,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _InputIter>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
|
||||
const value_compare& __comp,
|
||||
const container_type& __c)
|
||||
@@ -443,11 +539,11 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input
|
||||
_STD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _InputIter>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
|
||||
const value_compare& __comp,
|
||||
container_type&& __c)
|
||||
@@ -458,28 +554,11 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input
|
||||
_STD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline
|
||||
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;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type*)
|
||||
@@ -489,7 +568,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a,
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
|
||||
const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
@@ -501,7 +580,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
|
||||
const container_type& __c,
|
||||
const _Alloc& __a,
|
||||
@@ -515,7 +594,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue& __q,
|
||||
const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
@@ -526,11 +605,11 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue&
|
||||
_STD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
|
||||
container_type&& __c,
|
||||
const _Alloc& __a,
|
||||
@@ -544,7 +623,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q,
|
||||
const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
@@ -555,10 +634,10 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q,
|
||||
_STD::make_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v)
|
||||
{
|
||||
@@ -566,10 +645,10 @@ priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v)
|
||||
_STD::push_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v)
|
||||
{
|
||||
@@ -577,9 +656,11 @@ priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v)
|
||||
_STD::push_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
template <class... _Args>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args)
|
||||
{
|
||||
@@ -587,10 +668,11 @@ priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args)
|
||||
_STD::push_heap(c.begin(), c.end(), comp);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
priority_queue<_Tp, _Container, _Compare>::pop()
|
||||
{
|
||||
@@ -599,9 +681,11 @@ priority_queue<_Tp, _Container, _Compare>::pop()
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline
|
||||
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;
|
||||
swap(c, __q.c);
|
||||
@@ -609,16 +693,17 @@ priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare>
|
||||
inline
|
||||
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);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Compare, class _Alloc>
|
||||
struct uses_allocator<priority_queue<_Tp, _Container, _Compare>, _Alloc>
|
||||
struct _LIBCPP_VISIBLE uses_allocator<priority_queue<_Tp, _Container, _Compare>, _Alloc>
|
||||
: public uses_allocator<_Container, _Alloc>
|
||||
{
|
||||
};
|
||||
|
999
include/random
999
include/random
File diff suppressed because it is too large
Load Diff
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -23,13 +23,14 @@ class ratio
|
||||
public:
|
||||
static const intmax_t num;
|
||||
static const intmax_t den;
|
||||
typedef ratio<num, den> type;
|
||||
};
|
||||
|
||||
// ratio arithmetic
|
||||
template <class R1, class R2> struct ratio_add;
|
||||
template <class R1, class R2> struct ratio_subtract;
|
||||
template <class R1, class R2> struct ratio_multiply;
|
||||
template <class R1, class R2> struct ratio_divide;
|
||||
template <class R1, class R2> using ratio_add = ...;
|
||||
template <class R1, class R2> using ratio_subtract = ...;
|
||||
template <class R1, class R2> using ratio_multiply = ...;
|
||||
template <class R1, class R2> using ratio_divide = ...;
|
||||
|
||||
// ratio comparison
|
||||
template <class R1, class R2> struct ratio_equal;
|
||||
@@ -220,7 +221,7 @@ public:
|
||||
};
|
||||
|
||||
template <intmax_t _Num, intmax_t _Den = 1>
|
||||
class ratio
|
||||
class _LIBCPP_VISIBLE ratio
|
||||
{
|
||||
static_assert(__static_abs<_Num>::value >= 0, "ratio numerator is out of range");
|
||||
static_assert(_Den != 0, "ratio divide by 0");
|
||||
@@ -260,7 +261,7 @@ typedef ratio< 1000000000000000LL, 1LL> peta;
|
||||
typedef ratio<1000000000000000000LL, 1LL> exa;
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct ratio_multiply
|
||||
struct __ratio_multiply
|
||||
{
|
||||
private:
|
||||
static const intmax_t __gcd_n1_d2 = __static_gcd<_R1::num, _R2::den>::value;
|
||||
@@ -273,8 +274,21 @@ 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 ratio_divide
|
||||
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
|
||||
{
|
||||
private:
|
||||
static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
|
||||
@@ -287,8 +301,21 @@ 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 ratio_add
|
||||
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
|
||||
{
|
||||
private:
|
||||
static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
|
||||
@@ -309,8 +336,21 @@ 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 ratio_subtract
|
||||
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
|
||||
{
|
||||
private:
|
||||
static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
|
||||
@@ -331,14 +371,27 @@ 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>
|
||||
struct ratio_equal
|
||||
struct _LIBCPP_VISIBLE ratio_equal
|
||||
: public integral_constant<bool, _R1::num == _R2::num && _R1::den == _R2::den> {};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct ratio_not_equal
|
||||
struct _LIBCPP_VISIBLE ratio_not_equal
|
||||
: public integral_constant<bool, !ratio_equal<_R1, _R2>::value> {};
|
||||
|
||||
// ratio_less
|
||||
@@ -397,19 +450,19 @@ struct __ratio_less<_R1, _R2, -1LL, -1LL>
|
||||
};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct ratio_less
|
||||
struct _LIBCPP_VISIBLE ratio_less
|
||||
: public integral_constant<bool, __ratio_less<_R1, _R2>::value> {};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct ratio_less_equal
|
||||
struct _LIBCPP_VISIBLE ratio_less_equal
|
||||
: public integral_constant<bool, !ratio_less<_R2, _R1>::value> {};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct ratio_greater
|
||||
struct _LIBCPP_VISIBLE ratio_greater
|
||||
: public integral_constant<bool, ratio_less<_R2, _R1>::value> {};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
struct ratio_greater_equal
|
||||
struct _LIBCPP_VISIBLE ratio_greater_equal
|
||||
: public integral_constant<bool, !ratio_less<_R1, _R2>::value> {};
|
||||
|
||||
template <class _R1, class _R2>
|
||||
|
465
include/regex
465
include/regex
File diff suppressed because it is too large
Load Diff
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -107,7 +110,7 @@ template <class OuterA1, class OuterA2, class... InnerAllocs>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if defined(_LIBCPP_MOVE) && !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE)
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE)
|
||||
|
||||
// scoped_allocator_adaptor
|
||||
|
||||
@@ -181,14 +184,16 @@ private:
|
||||
|
||||
protected:
|
||||
|
||||
__scoped_allocator_storage() {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__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,
|
||||
const _InnerAllocs& ...__innerAllocs)
|
||||
const _InnerAllocs& ...__innerAllocs) _NOEXCEPT
|
||||
: outer_allocator_type(_STD::forward<_OuterA2>(__outerAlloc)),
|
||||
__inner_(__innerAllocs...) {}
|
||||
|
||||
@@ -196,8 +201,9 @@ protected:
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, const _OuterA2&>::value
|
||||
>::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()) {}
|
||||
|
||||
@@ -205,8 +211,9 @@ protected:
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, _OuterA2>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage(
|
||||
__scoped_allocator_storage<_OuterA2, _InnerAllocs...>&& __other)
|
||||
__scoped_allocator_storage<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
|
||||
: outer_allocator_type(_STD::move(__other.outer_allocator())),
|
||||
__inner_(_STD::move(__other.inner_allocator())) {}
|
||||
|
||||
@@ -214,23 +221,29 @@ protected:
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, _OuterA2>::value
|
||||
>::type>
|
||||
__scoped_allocator_storage(_OuterA2&& __o,
|
||||
const inner_allocator_type& __i)
|
||||
: outer_allocator_type(_STD::forward<_OuterA2>(__o)),
|
||||
__inner_(__i)
|
||||
{
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage(_OuterA2&& __o,
|
||||
const inner_allocator_type& __i) _NOEXCEPT
|
||||
: outer_allocator_type(_STD::forward<_OuterA2>(__o)),
|
||||
__inner_(__i)
|
||||
{
|
||||
}
|
||||
|
||||
inner_allocator_type& inner_allocator() {return __inner_;}
|
||||
const inner_allocator_type& inner_allocator() const {return __inner_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inner_allocator_type& inner_allocator() _NOEXCEPT {return __inner_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const inner_allocator_type& inner_allocator() const _NOEXCEPT {return __inner_;}
|
||||
|
||||
outer_allocator_type& outer_allocator()
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
outer_allocator_type& outer_allocator() _NOEXCEPT
|
||||
{return static_cast<outer_allocator_type&>(*this);}
|
||||
const outer_allocator_type& outer_allocator() const
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const outer_allocator_type& outer_allocator() const _NOEXCEPT
|
||||
{return static_cast<const outer_allocator_type&>(*this);}
|
||||
|
||||
scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
|
||||
select_on_container_copy_construction() const
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
select_on_container_copy_construction() const _NOEXCEPT
|
||||
{
|
||||
return scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
|
||||
(
|
||||
@@ -252,50 +265,59 @@ class __scoped_allocator_storage<_OuterAlloc>
|
||||
protected:
|
||||
typedef scoped_allocator_adaptor<_OuterAlloc> inner_allocator_type;
|
||||
|
||||
__scoped_allocator_storage() {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage() _NOEXCEPT {}
|
||||
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, _OuterA2>::value
|
||||
>::type>
|
||||
__scoped_allocator_storage(_OuterA2&& __outerAlloc)
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage(_OuterA2&& __outerAlloc) _NOEXCEPT
|
||||
: outer_allocator_type(_STD::forward<_OuterA2>(__outerAlloc)) {}
|
||||
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, const _OuterA2&>::value
|
||||
>::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,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, _OuterA2>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__scoped_allocator_storage(
|
||||
__scoped_allocator_storage<_OuterA2>&& __other)
|
||||
__scoped_allocator_storage<_OuterA2>&& __other) _NOEXCEPT
|
||||
: outer_allocator_type(_STD::move(__other.outer_allocator())) {}
|
||||
|
||||
inner_allocator_type& inner_allocator()
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inner_allocator_type& inner_allocator() _NOEXCEPT
|
||||
{return static_cast<inner_allocator_type&>(*this);}
|
||||
const inner_allocator_type& inner_allocator() const
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const inner_allocator_type& inner_allocator() const _NOEXCEPT
|
||||
{return static_cast<const inner_allocator_type&>(*this);}
|
||||
|
||||
outer_allocator_type& outer_allocator()
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
outer_allocator_type& outer_allocator() _NOEXCEPT
|
||||
{return static_cast<outer_allocator_type&>(*this);}
|
||||
const outer_allocator_type& outer_allocator() const
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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;
|
||||
};
|
||||
@@ -323,7 +345,8 @@ template <class _Alloc, bool = __has_outer_allocator<_Alloc>::value>
|
||||
struct __outermost
|
||||
{
|
||||
typedef _Alloc type;
|
||||
type& operator()(type& __a) const {return __a;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
type& operator()(type& __a) const _NOEXCEPT {return __a;}
|
||||
};
|
||||
|
||||
template <class _Alloc>
|
||||
@@ -334,12 +357,13 @@ struct __outermost<_Alloc, true>
|
||||
decltype(_STD::declval<_Alloc>().outer_allocator())
|
||||
>::type _OuterAlloc;
|
||||
typedef typename __outermost<_OuterAlloc>::type type;
|
||||
type& operator()(_Alloc& __a) const
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
type& operator()(_Alloc& __a) const _NOEXCEPT
|
||||
{return __outermost<_OuterAlloc>()(__a.outer_allocator());}
|
||||
};
|
||||
|
||||
template <class _OuterAlloc, class... _InnerAllocs>
|
||||
class scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...>
|
||||
class _LIBCPP_VISIBLE scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...>
|
||||
: public __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...>
|
||||
{
|
||||
typedef __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> base;
|
||||
@@ -381,61 +405,75 @@ public:
|
||||
> other;
|
||||
};
|
||||
|
||||
scoped_allocator_adaptor() {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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)
|
||||
const _InnerAllocs& ...__innerAllocs) _NOEXCEPT
|
||||
: base(_STD::forward<_OuterA2>(__outerAlloc), __innerAllocs...) {}
|
||||
// scoped_allocator_adaptor(const scoped_allocator_adaptor& __other) = default;
|
||||
template <class _OuterA2,
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, const _OuterA2&>::value
|
||||
>::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<
|
||||
is_constructible<outer_allocator_type, _OuterA2>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
scoped_allocator_adaptor(
|
||||
scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other)
|
||||
scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
|
||||
: base(_STD::move(__other)) {}
|
||||
|
||||
// ~scoped_allocator_adaptor() = default;
|
||||
|
||||
inner_allocator_type& inner_allocator()
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inner_allocator_type& inner_allocator() _NOEXCEPT
|
||||
{return base::inner_allocator();}
|
||||
const inner_allocator_type& inner_allocator() const
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const inner_allocator_type& inner_allocator() const _NOEXCEPT
|
||||
{return base::inner_allocator();}
|
||||
|
||||
outer_allocator_type& outer_allocator()
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
outer_allocator_type& outer_allocator() _NOEXCEPT
|
||||
{return base::outer_allocator();}
|
||||
const outer_allocator_type& outer_allocator() const
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const outer_allocator_type& outer_allocator() const _NOEXCEPT
|
||||
{return base::outer_allocator();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer allocate(size_type __n)
|
||||
{return allocator_traits<outer_allocator_type>::
|
||||
allocate(outer_allocator(), __n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer allocate(size_type __n, const_void_pointer __hint)
|
||||
{return allocator_traits<outer_allocator_type>::
|
||||
allocate(outer_allocator(), __n, __hint);}
|
||||
|
||||
void deallocate(pointer __p, size_type __n)
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void deallocate(pointer __p, size_type __n) _NOEXCEPT
|
||||
{allocator_traits<outer_allocator_type>::
|
||||
deallocate(outer_allocator(), __p, __n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const
|
||||
{allocator_traits<outer_allocator_type>::max_size(outer_allocator());}
|
||||
{return allocator_traits<outer_allocator_type>::max_size(outer_allocator());}
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void construct(_Tp* __p, _Args&& ...__args)
|
||||
{__construct(__uses_alloc_ctor<_Tp, inner_allocator_type, _Args...>(),
|
||||
__p, _STD::forward<_Args>(__args)...);}
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void destroy(_Tp* __p)
|
||||
{
|
||||
typedef __outermost<outer_allocator_type> _OM;
|
||||
@@ -443,7 +481,8 @@ public:
|
||||
destroy(_OM()(outer_allocator()), __p);
|
||||
}
|
||||
|
||||
scoped_allocator_adaptor select_on_container_copy_construction() const
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
scoped_allocator_adaptor select_on_container_copy_construction() const _NOEXCEPT
|
||||
{return base::select_on_container_copy_construction();}
|
||||
|
||||
private:
|
||||
@@ -452,11 +491,13 @@ private:
|
||||
class = typename enable_if<
|
||||
is_constructible<outer_allocator_type, _OuterA2>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
scoped_allocator_adaptor(_OuterA2&& __o,
|
||||
const inner_allocator_type& __i)
|
||||
const inner_allocator_type& __i) _NOEXCEPT
|
||||
: base(_STD::forward<_OuterA2>(__o), __i) {}
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __construct(integral_constant<int, 0>, _Tp* __p, _Args&& ...__args)
|
||||
{
|
||||
typedef __outermost<outer_allocator_type> _OM;
|
||||
@@ -469,6 +510,7 @@ private:
|
||||
}
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __construct(integral_constant<int, 1>, _Tp* __p, _Args&& ...__args)
|
||||
{
|
||||
typedef __outermost<outer_allocator_type> _OM;
|
||||
@@ -483,6 +525,7 @@ private:
|
||||
}
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __construct(integral_constant<int, 2>, _Tp* __p, _Args&& ...__args)
|
||||
{
|
||||
typedef __outermost<outer_allocator_type> _OM;
|
||||
@@ -502,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();
|
||||
@@ -521,12 +564,12 @@ 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);
|
||||
}
|
||||
|
||||
#endif // defined(_LIBCPP_MOVE) && !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE)
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE)
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
411
include/set
411
include/set
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -310,7 +344,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Key, class _Compare = less<_Key>,
|
||||
class _Allocator = allocator<_Key> >
|
||||
class set
|
||||
class _LIBCPP_VISIBLE set
|
||||
{
|
||||
public:
|
||||
// types:
|
||||
@@ -339,11 +373,18 @@ public:
|
||||
typedef _STD::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef _STD::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)
|
||||
: __tree_(__comp, __a) {}
|
||||
template <class _InputIterator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
set(_InputIterator __f, _InputIterator __l,
|
||||
const value_compare& __comp = value_compare())
|
||||
: __tree_(__comp)
|
||||
@@ -352,6 +393,7 @@ public:
|
||||
}
|
||||
|
||||
template <class _InputIterator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
set(_InputIterator __f, _InputIterator __l, const value_compare& __comp,
|
||||
const allocator_type& __a)
|
||||
: __tree_(__comp, __a)
|
||||
@@ -359,36 +401,43 @@ public:
|
||||
insert(__f, __l);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
set(const set& __s)
|
||||
: __tree_(__s.__tree_)
|
||||
{
|
||||
insert(__s.begin(), __s.end());
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
set(set&& __s)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
|
||||
: __tree_(_STD::move(__s.__tree_)) {}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit set(const allocator_type& __a)
|
||||
: __tree_(__a) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
set(const set& __s, const allocator_type& __a)
|
||||
: __tree_(__s.__tree_.value_comp(), __a)
|
||||
{
|
||||
insert(__s.begin(), __s.end());
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
set(set&& __s, const allocator_type& __a);
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
set(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
|
||||
: __tree_(__comp)
|
||||
{
|
||||
insert(__il.begin(), __il.end());
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
set(initializer_list<value_type> __il, const value_compare& __comp,
|
||||
const allocator_type& __a)
|
||||
: __tree_(__comp, __a)
|
||||
@@ -396,103 +445,151 @@ public:
|
||||
insert(__il.begin(), __il.end());
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
set& operator=(initializer_list<value_type> __il)
|
||||
{
|
||||
__tree_.__assign_unique(__il.begin(), __il.end());
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#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_);
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
iterator begin() {return __tree_.begin();}
|
||||
const_iterator begin() const {return __tree_.begin();}
|
||||
iterator end() {return __tree_.end();}
|
||||
const_iterator end() const {return __tree_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() _NOEXCEPT {return __tree_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() _NOEXCEPT {return __tree_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const _NOEXCEPT {return __tree_.end();}
|
||||
|
||||
reverse_iterator rbegin() {return reverse_iterator(end());}
|
||||
const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
|
||||
reverse_iterator rend() {return reverse_iterator(begin());}
|
||||
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());}
|
||||
|
||||
const_iterator cbegin() const {return begin();}
|
||||
const_iterator cend() const {return end();}
|
||||
const_reverse_iterator crbegin() const {return rbegin();}
|
||||
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();}
|
||||
|
||||
bool empty() const {return __tree_.size() == 0;}
|
||||
size_type size() const {return __tree_.size();}
|
||||
size_type max_size() const {return __tree_.max_size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const _NOEXCEPT {return __tree_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
|
||||
|
||||
// modifiers:
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#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)...);}
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator emplace_hint(const_iterator __p, _Args&&... __args)
|
||||
{return __tree_.__emplace_hint_unique(__p, _STD::forward<_Args>(__args)...);}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator,bool> insert(const value_type& __v)
|
||||
{return __tree_.__insert_unique(__v);}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator,bool> insert(value_type&& __v)
|
||||
{return __tree_.__insert_unique(_STD::move(__v));}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __p, const value_type& __v)
|
||||
{return __tree_.__insert_unique(__p, __v);}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#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));}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _InputIterator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void insert(_InputIterator __f, _InputIterator __l)
|
||||
{
|
||||
for (const_iterator __e = cend(); __f != __l; ++__f)
|
||||
__tree_.__insert_unique(__e, *__f);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void insert(initializer_list<value_type> __il)
|
||||
{insert(__il.begin(), __il.end());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator erase(const_iterator __p) {return __tree_.erase(__p);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type erase(const key_type& __k)
|
||||
{return __tree_.__erase_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator erase(const_iterator __f, const_iterator __l)
|
||||
{return __tree_.erase(__f, __l);}
|
||||
void clear() {__tree_.clear();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() _NOEXCEPT {__tree_.clear();}
|
||||
|
||||
void swap(set& __s) {__tree_.swap(__s.__tree_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
|
||||
{__tree_.swap(__s.__tree_);}
|
||||
|
||||
allocator_type get_allocator() const {return __tree_.__alloc();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
key_compare key_comp() const {return __tree_.value_comp();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_compare value_comp() const {return __tree_.value_comp();}
|
||||
|
||||
// set operations:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator find(const key_type& __k) {return __tree_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type count(const key_type& __k) const
|
||||
{return __tree_.__count_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator lower_bound(const key_type& __k)
|
||||
{return __tree_.lower_bound(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator lower_bound(const key_type& __k) const
|
||||
{return __tree_.lower_bound(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator upper_bound(const key_type& __k)
|
||||
{return __tree_.upper_bound(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator upper_bound(const key_type& __k) const
|
||||
{return __tree_.upper_bound(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator,iterator> equal_range(const key_type& __k)
|
||||
{return __tree_.__equal_range_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
|
||||
{return __tree_.__equal_range_unique(__k);}
|
||||
};
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a)
|
||||
@@ -506,10 +603,10 @@ set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a)
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const set<_Key, _Compare, _Allocator>& __x,
|
||||
const set<_Key, _Compare, _Allocator>& __y)
|
||||
@@ -518,7 +615,7 @@ operator==(const set<_Key, _Compare, _Allocator>& __x,
|
||||
}
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator< (const set<_Key, _Compare, _Allocator>& __x,
|
||||
const set<_Key, _Compare, _Allocator>& __y)
|
||||
@@ -527,7 +624,7 @@ operator< (const set<_Key, _Compare, _Allocator>& __x,
|
||||
}
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const set<_Key, _Compare, _Allocator>& __x,
|
||||
const set<_Key, _Compare, _Allocator>& __y)
|
||||
@@ -536,7 +633,7 @@ operator!=(const set<_Key, _Compare, _Allocator>& __x,
|
||||
}
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator> (const set<_Key, _Compare, _Allocator>& __x,
|
||||
const set<_Key, _Compare, _Allocator>& __y)
|
||||
@@ -545,7 +642,7 @@ operator> (const set<_Key, _Compare, _Allocator>& __x,
|
||||
}
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>=(const set<_Key, _Compare, _Allocator>& __x,
|
||||
const set<_Key, _Compare, _Allocator>& __y)
|
||||
@@ -554,7 +651,7 @@ operator>=(const set<_Key, _Compare, _Allocator>& __x,
|
||||
}
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<=(const set<_Key, _Compare, _Allocator>& __x,
|
||||
const set<_Key, _Compare, _Allocator>& __y)
|
||||
@@ -564,17 +661,18 @@ operator<=(const set<_Key, _Compare, _Allocator>& __x,
|
||||
|
||||
// specialized algorithms:
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(set<_Key, _Compare, _Allocator>& __x,
|
||||
set<_Key, _Compare, _Allocator>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Key, class _Compare = less<_Key>,
|
||||
class _Allocator = allocator<_Key> >
|
||||
class multiset
|
||||
class _LIBCPP_VISIBLE multiset
|
||||
{
|
||||
public:
|
||||
// types:
|
||||
@@ -604,11 +702,18 @@ public:
|
||||
typedef _STD::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)
|
||||
: __tree_(__comp, __a) {}
|
||||
template <class _InputIterator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
multiset(_InputIterator __f, _InputIterator __l,
|
||||
const value_compare& __comp = value_compare())
|
||||
: __tree_(__comp)
|
||||
@@ -617,6 +722,7 @@ public:
|
||||
}
|
||||
|
||||
template <class _InputIterator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
multiset(_InputIterator __f, _InputIterator __l,
|
||||
const value_compare& __comp, const allocator_type& __a)
|
||||
: __tree_(__comp, __a)
|
||||
@@ -624,6 +730,7 @@ public:
|
||||
insert(__f, __l);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
multiset(const multiset& __s)
|
||||
: __tree_(__s.__tree_.value_comp(),
|
||||
__alloc_traits::select_on_container_copy_construction(__s.__tree_.__alloc()))
|
||||
@@ -631,27 +738,33 @@ public:
|
||||
insert(__s.begin(), __s.end());
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
multiset(multiset&& __s)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
|
||||
: __tree_(_STD::move(__s.__tree_)) {}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit multiset(const allocator_type& __a)
|
||||
: __tree_(__a) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
multiset(const multiset& __s, const allocator_type& __a)
|
||||
: __tree_(__s.__tree_.value_comp(), __a)
|
||||
{
|
||||
insert(__s.begin(), __s.end());
|
||||
}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
multiset(multiset&& __s, const allocator_type& __a);
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
|
||||
: __tree_(__comp)
|
||||
{
|
||||
insert(__il.begin(), __il.end());
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
multiset(initializer_list<value_type> __il, const value_compare& __comp,
|
||||
const allocator_type& __a)
|
||||
: __tree_(__comp, __a)
|
||||
@@ -659,102 +772,151 @@ public:
|
||||
insert(__il.begin(), __il.end());
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
multiset& operator=(initializer_list<value_type> __il)
|
||||
{
|
||||
__tree_.__assign_multi(__il.begin(), __il.end());
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#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_);
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
iterator begin() {return __tree_.begin();}
|
||||
const_iterator begin() const {return __tree_.begin();}
|
||||
iterator end() {return __tree_.end();}
|
||||
const_iterator end() const {return __tree_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() _NOEXCEPT {return __tree_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() _NOEXCEPT {return __tree_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const _NOEXCEPT {return __tree_.end();}
|
||||
|
||||
reverse_iterator rbegin() {return reverse_iterator(end());}
|
||||
const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
|
||||
reverse_iterator rend() {return reverse_iterator(begin());}
|
||||
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());}
|
||||
|
||||
const_iterator cbegin() const {return begin();}
|
||||
const_iterator cend() const {return end();}
|
||||
const_reverse_iterator crbegin() const {return rbegin();}
|
||||
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();}
|
||||
|
||||
bool empty() const {return __tree_.size() == 0;}
|
||||
size_type size() const {return __tree_.size();}
|
||||
size_type max_size() const {return __tree_.max_size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const _NOEXCEPT {return __tree_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
|
||||
|
||||
// modifiers:
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#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)...);}
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator emplace_hint(const_iterator __p, _Args&&... __args)
|
||||
{return __tree_.__emplace_hint_multi(__p, _STD::forward<_Args>(__args)...);}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const value_type& __v)
|
||||
{return __tree_.__insert_multi(__v);}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(value_type&& __v)
|
||||
{return __tree_.__insert_multi(_STD::move(__v));}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __p, const value_type& __v)
|
||||
{return __tree_.__insert_multi(__p, __v);}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __p, value_type&& __v)
|
||||
{return __tree_.__insert_multi(_STD::move(__v));}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _InputIterator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void insert(_InputIterator __f, _InputIterator __l)
|
||||
{
|
||||
for (const_iterator __e = cend(); __f != __l; ++__f)
|
||||
__tree_.__insert_multi(__e, *__f);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void insert(initializer_list<value_type> __il)
|
||||
{insert(__il.begin(), __il.end());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator erase(const_iterator __p) {return __tree_.erase(__p);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator erase(const_iterator __f, const_iterator __l)
|
||||
{return __tree_.erase(__f, __l);}
|
||||
void clear() {__tree_.clear();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() _NOEXCEPT {__tree_.clear();}
|
||||
|
||||
void swap(multiset& __s) {__tree_.swap(__s.__tree_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(multiset& __s)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<__base>::value)
|
||||
{__tree_.swap(__s.__tree_);}
|
||||
|
||||
allocator_type get_allocator() const {return __tree_.__alloc();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
key_compare key_comp() const {return __tree_.value_comp();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
value_compare value_comp() const {return __tree_.value_comp();}
|
||||
|
||||
// set operations:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator find(const key_type& __k) {return __tree_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type count(const key_type& __k) const
|
||||
{return __tree_.__count_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator lower_bound(const key_type& __k)
|
||||
{return __tree_.lower_bound(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator lower_bound(const key_type& __k) const
|
||||
{return __tree_.lower_bound(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator upper_bound(const key_type& __k)
|
||||
{return __tree_.upper_bound(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator upper_bound(const key_type& __k) const
|
||||
{return __tree_.upper_bound(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator,iterator> equal_range(const key_type& __k)
|
||||
{return __tree_.__equal_range_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
|
||||
{return __tree_.__equal_range_multi(__k);}
|
||||
};
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a)
|
||||
@@ -768,10 +930,10 @@ multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_t
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const multiset<_Key, _Compare, _Allocator>& __x,
|
||||
const multiset<_Key, _Compare, _Allocator>& __y)
|
||||
@@ -780,7 +942,7 @@ operator==(const multiset<_Key, _Compare, _Allocator>& __x,
|
||||
}
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator< (const multiset<_Key, _Compare, _Allocator>& __x,
|
||||
const multiset<_Key, _Compare, _Allocator>& __y)
|
||||
@@ -789,7 +951,7 @@ operator< (const multiset<_Key, _Compare, _Allocator>& __x,
|
||||
}
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const multiset<_Key, _Compare, _Allocator>& __x,
|
||||
const multiset<_Key, _Compare, _Allocator>& __y)
|
||||
@@ -798,7 +960,7 @@ operator!=(const multiset<_Key, _Compare, _Allocator>& __x,
|
||||
}
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator> (const multiset<_Key, _Compare, _Allocator>& __x,
|
||||
const multiset<_Key, _Compare, _Allocator>& __y)
|
||||
@@ -807,7 +969,7 @@ operator> (const multiset<_Key, _Compare, _Allocator>& __x,
|
||||
}
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>=(const multiset<_Key, _Compare, _Allocator>& __x,
|
||||
const multiset<_Key, _Compare, _Allocator>& __y)
|
||||
@@ -816,7 +978,7 @@ operator>=(const multiset<_Key, _Compare, _Allocator>& __x,
|
||||
}
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<=(const multiset<_Key, _Compare, _Allocator>& __x,
|
||||
const multiset<_Key, _Compare, _Allocator>& __y)
|
||||
@@ -825,10 +987,11 @@ operator<=(const multiset<_Key, _Compare, _Allocator>& __x,
|
||||
}
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(multiset<_Key, _Compare, _Allocator>& __x,
|
||||
multiset<_Key, _Compare, _Allocator>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -182,7 +182,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
// basic_stringbuf
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
class basic_stringbuf
|
||||
class _LIBCPP_VISIBLE basic_stringbuf
|
||||
: public basic_streambuf<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
@@ -206,12 +206,12 @@ public:
|
||||
explicit basic_stringbuf(ios_base::openmode __wch = ios_base::in | ios_base::out);
|
||||
explicit basic_stringbuf(const string_type& __s,
|
||||
ios_base::openmode __wch = ios_base::in | ios_base::out);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_stringbuf(basic_stringbuf&& __rhs);
|
||||
#endif
|
||||
|
||||
// 27.8.1.2 Assign and swap:
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_stringbuf& operator=(basic_stringbuf&& __rhs);
|
||||
#endif
|
||||
void swap(basic_stringbuf& __rhs);
|
||||
@@ -250,7 +250,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(const string_type&
|
||||
str(__s);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(basic_stringbuf&& __rhs)
|
||||
@@ -298,7 +298,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs)
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
void
|
||||
@@ -451,7 +451,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c)
|
||||
}
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
__hm_ = max(this->pptr() + 1, __hm_);
|
||||
__hm_ = _STD::max(this->pptr() + 1, __hm_);
|
||||
if (__mode_ & ios_base::in)
|
||||
{
|
||||
char_type* __p = const_cast<char_type*>(__str_.data());
|
||||
@@ -525,7 +525,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::seekpos(pos_type __sp,
|
||||
// basic_istringstream
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
class basic_istringstream
|
||||
class _LIBCPP_VISIBLE basic_istringstream
|
||||
: public basic_istream<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
@@ -546,12 +546,12 @@ public:
|
||||
explicit basic_istringstream(ios_base::openmode __wch = ios_base::in);
|
||||
explicit basic_istringstream(const string_type& __s,
|
||||
ios_base::openmode __wch = ios_base::in);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_istringstream(basic_istringstream&& __rhs);
|
||||
|
||||
// 27.8.2.2 Assign and swap:
|
||||
basic_istringstream& operator=(basic_istringstream&& __rhs);
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void swap(basic_istringstream& __rhs);
|
||||
|
||||
// 27.8.2.3 Members:
|
||||
@@ -577,7 +577,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(const stri
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -597,7 +597,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::operator=(basic_istringstream&
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -644,7 +644,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
|
||||
// basic_ostringstream
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
class basic_ostringstream
|
||||
class _LIBCPP_VISIBLE basic_ostringstream
|
||||
: public basic_ostream<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
@@ -665,12 +665,12 @@ public:
|
||||
explicit basic_ostringstream(ios_base::openmode __wch = ios_base::out);
|
||||
explicit basic_ostringstream(const string_type& __s,
|
||||
ios_base::openmode __wch = ios_base::out);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_ostringstream(basic_ostringstream&& __rhs);
|
||||
|
||||
// 27.8.2.2 Assign and swap:
|
||||
basic_ostringstream& operator=(basic_ostringstream&& __rhs);
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void swap(basic_ostringstream& __rhs);
|
||||
|
||||
// 27.8.2.3 Members:
|
||||
@@ -696,7 +696,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(const stri
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -716,7 +716,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::operator=(basic_ostringstream&
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -763,7 +763,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
|
||||
// basic_stringstream
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
class basic_stringstream
|
||||
class _LIBCPP_VISIBLE basic_stringstream
|
||||
: public basic_iostream<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
@@ -784,12 +784,12 @@ public:
|
||||
explicit basic_stringstream(ios_base::openmode __wch = ios_base::in | ios_base::out);
|
||||
explicit basic_stringstream(const string_type& __s,
|
||||
ios_base::openmode __wch = ios_base::in | ios_base::out);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
basic_stringstream(basic_stringstream&& __rhs);
|
||||
|
||||
// 27.8.2.2 Assign and swap:
|
||||
basic_stringstream& operator=(basic_stringstream&& __rhs);
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void swap(basic_stringstream& __rhs);
|
||||
|
||||
// 27.8.2.3 Members:
|
||||
@@ -815,7 +815,7 @@ basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(const string
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -835,7 +835,7 @@ basic_stringstream<_CharT, _Traits, _Allocator>::operator=(basic_stringstream&&
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
|
103
include/stack
103
include/stack
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -92,7 +100,7 @@ bool
|
||||
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
|
||||
|
||||
template <class _Tp, class _Container = deque<_Tp> >
|
||||
class stack
|
||||
class _LIBCPP_VISIBLE stack
|
||||
{
|
||||
public:
|
||||
typedef _Container container_type;
|
||||
@@ -105,55 +113,97 @@ protected:
|
||||
container_type c;
|
||||
|
||||
public:
|
||||
stack() : c() {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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(_STD::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 = _STD::move(__q.c); return *this;}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit stack(const container_type& __c) : c(__c) {}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit stack(container_type&& __c) : c(_STD::move(__c)) {}
|
||||
stack(stack&& __s) : c(_STD::move(__s.c)) {}
|
||||
stack& operator=(stack&& __s) {c = _STD::move(__s.c); return *this;}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit stack(const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(__a) {}
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack(const container_type& __c, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(__c, __a) {}
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack(const stack& __s, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(__s.c, __a) {}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
stack(container_type&& __c, const _Alloc& __a,
|
||||
typename enable_if<uses_allocator<container_type,
|
||||
_Alloc>::value>::type* = 0)
|
||||
: c(_STD::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) {}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const {return c.empty();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const {return c.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference top() {return c.back();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reference top() const {return c.back();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void push(const value_type& __v) {c.push_back(__v);}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void push(value_type&& __v) {c.push_back(_STD::move(__v));}
|
||||
template <class... _Args> void emplace(_Args&&... __args)
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void emplace(_Args&&... __args)
|
||||
{c.emplace_back(_STD::forward<_Args>(__args)...);}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void pop() {c.pop_back();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(stack& __s)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value)
|
||||
{
|
||||
using _STD::swap;
|
||||
swap(c, __s.c);
|
||||
@@ -171,7 +221,7 @@ public:
|
||||
};
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
{
|
||||
@@ -179,7 +229,7 @@ operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
{
|
||||
@@ -187,7 +237,7 @@ operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
{
|
||||
@@ -195,7 +245,7 @@ operator!=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator> (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
{
|
||||
@@ -203,7 +253,7 @@ operator> (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
{
|
||||
@@ -211,7 +261,7 @@ operator>=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
{
|
||||
@@ -219,15 +269,16 @@ operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Container, class _Alloc>
|
||||
struct uses_allocator<stack<_Tp, _Container>, _Alloc>
|
||||
struct _LIBCPP_VISIBLE uses_allocator<stack<_Tp, _Container>, _Alloc>
|
||||
: public uses_allocator<_Container, _Alloc>
|
||||
{
|
||||
};
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -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
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -117,7 +117,7 @@ protected:
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class basic_streambuf
|
||||
class _LIBCPP_VISIBLE basic_streambuf
|
||||
{
|
||||
public:
|
||||
// types:
|
||||
|
1078
include/string
1078
include/string
File diff suppressed because it is too large
Load Diff
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -135,7 +135,7 @@ private:
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class strstreambuf
|
||||
class _LIBCPP_VISIBLE strstreambuf
|
||||
: public streambuf
|
||||
{
|
||||
public:
|
||||
@@ -149,10 +149,10 @@ public:
|
||||
strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = 0);
|
||||
strstreambuf(const unsigned char* __gnext, streamsize __n);
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
strstreambuf(strstreambuf&& __rhs);
|
||||
strstreambuf& operator=(strstreambuf&& __rhs);
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
virtual ~strstreambuf();
|
||||
|
||||
@@ -187,20 +187,25 @@ private:
|
||||
void __init(char* __gnext, streamsize __n, char* __pbeg);
|
||||
};
|
||||
|
||||
class istrstream
|
||||
class _LIBCPP_VISIBLE istrstream
|
||||
: public istream
|
||||
{
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit istrstream(const char* __s)
|
||||
: istream(&__sb_), __sb_(__s, 0) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit istrstream(char* __s)
|
||||
: istream(&__sb_), __sb_(__s, 0) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
istrstream(const char* __s, streamsize __n)
|
||||
: istream(&__sb_), __sb_(__s, __n) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
istrstream(char* __s, streamsize __n)
|
||||
: istream(&__sb_), __sb_(__s, __n) {}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
istrstream(istrstream&& __rhs)
|
||||
: istream(_STD::move(__rhs)),
|
||||
__sb_(_STD::move(__rhs.__sb_))
|
||||
@@ -208,41 +213,48 @@ public:
|
||||
istream::set_rdbuf(&__sb_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
istrstream& operator=(istrstream&& __rhs)
|
||||
{
|
||||
istream::operator=(_STD::move(__rhs));
|
||||
__sb_ = _STD::move(__rhs.__sb_);
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
virtual ~istrstream();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(istrstream& __rhs)
|
||||
{
|
||||
istream::swap(__rhs);
|
||||
__sb_.swap(__rhs.__sb_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char *str() {return __sb_.str();}
|
||||
|
||||
private:
|
||||
strstreambuf __sb_;
|
||||
};
|
||||
|
||||
class ostrstream
|
||||
class _LIBCPP_VISIBLE ostrstream
|
||||
: public ostream
|
||||
{
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
ostrstream()
|
||||
: ostream(&__sb_) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
ostrstream(char* __s, int __n, ios_base::openmode __mode = ios_base::out)
|
||||
: ostream(&__sb_),
|
||||
__sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0))
|
||||
{}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
ostrstream(ostrstream&& __rhs)
|
||||
: ostream(_STD::move(__rhs)),
|
||||
__sb_(_STD::move(__rhs.__sb_))
|
||||
@@ -250,32 +262,38 @@ public:
|
||||
ostream::set_rdbuf(&__sb_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
ostrstream& operator=(ostrstream&& __rhs)
|
||||
{
|
||||
ostream::operator=(_STD::move(__rhs));
|
||||
__sb_ = _STD::move(__rhs.__sb_);
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
virtual ~ostrstream();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(ostrstream& __rhs)
|
||||
{
|
||||
ostream::swap(__rhs);
|
||||
__sb_.swap(__rhs.__sb_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void freeze(bool __freezefl = true) {__sb_.freeze(__freezefl);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char* str() {return __sb_.str();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int pcount() const {return __sb_.pcount();}
|
||||
|
||||
private:
|
||||
strstreambuf __sb_; // exposition only
|
||||
};
|
||||
|
||||
class strstream
|
||||
class _LIBCPP_VISIBLE strstream
|
||||
: public iostream
|
||||
{
|
||||
public:
|
||||
@@ -286,14 +304,17 @@ public:
|
||||
typedef char_traits<char>::off_type off_type;
|
||||
|
||||
// constructors/destructor
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstream()
|
||||
: iostream(&__sb_) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstream(char* __s, int __n, ios_base::openmode __mode = ios_base::in | ios_base::out)
|
||||
: iostream(&__sb_),
|
||||
__sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0))
|
||||
{}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstream(strstream&& __rhs)
|
||||
: iostream(_STD::move(__rhs)),
|
||||
__sb_(_STD::move(__rhs.__sb_))
|
||||
@@ -301,16 +322,18 @@ public:
|
||||
iostream::set_rdbuf(&__sb_);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstream& operator=(strstream&& __rhs)
|
||||
{
|
||||
iostream::operator=(_STD::move(__rhs));
|
||||
__sb_ = _STD::move(__rhs.__sb_);
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
virtual ~strstream();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(strstream& __rhs)
|
||||
{
|
||||
iostream::swap(__rhs);
|
||||
@@ -318,9 +341,13 @@ public:
|
||||
}
|
||||
|
||||
// Members:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void freeze(bool __freezefl = true) {__sb_.freeze(__freezefl);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int pcount() const {return __sb_.pcount();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
char* str() {return __sb_.str();}
|
||||
|
||||
private:
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -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>;
|
||||
|
||||
@@ -229,12 +229,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// is_error_code_enum
|
||||
|
||||
template <class _Tp> struct is_error_code_enum
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_VISIBLE is_error_code_enum
|
||||
: public false_type {};
|
||||
|
||||
// is_error_condition_enum
|
||||
|
||||
template <class _Tp> struct is_error_condition_enum
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_VISIBLE is_error_condition_enum
|
||||
: public false_type {};
|
||||
|
||||
// Some error codes are not present on all platforms, so we provide equivalents
|
||||
@@ -342,15 +344,19 @@ enum _ {
|
||||
|
||||
_ __v_;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
errc(_ __v) : __v_(__v) {}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
operator int() const {return __v_;}
|
||||
|
||||
};
|
||||
|
||||
template <> struct is_error_condition_enum<errc>
|
||||
template <>
|
||||
struct _LIBCPP_VISIBLE is_error_condition_enum<errc>
|
||||
: true_type { };
|
||||
|
||||
template <> struct is_error_condition_enum<errc::_>
|
||||
template <>
|
||||
struct _LIBCPP_VISIBLE is_error_condition_enum<errc::_>
|
||||
: true_type { };
|
||||
|
||||
class error_condition;
|
||||
@@ -360,31 +366,31 @@ class error_code;
|
||||
|
||||
class __do_message;
|
||||
|
||||
class error_category
|
||||
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;
|
||||
};
|
||||
@@ -396,28 +402,30 @@ 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 error_condition
|
||||
class _LIBCPP_VISIBLE error_condition
|
||||
{
|
||||
int __val_;
|
||||
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;
|
||||
@@ -430,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();
|
||||
@@ -469,25 +477,27 @@ operator<(const error_condition& __x, const error_condition& __y)
|
||||
|
||||
// error_code
|
||||
|
||||
class error_code
|
||||
class _LIBCPP_VISIBLE error_code
|
||||
{
|
||||
int __val_;
|
||||
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;
|
||||
@@ -500,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();
|
||||
@@ -544,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());
|
||||
@@ -559,39 +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 hash<error_code>
|
||||
struct _LIBCPP_VISIBLE hash<error_code>
|
||||
: public unary_function<error_code, size_t>
|
||||
{
|
||||
size_t operator()(const error_code& __ec) const
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const error_code& __ec) const _NOEXCEPT
|
||||
{
|
||||
return static_cast<size_t>(__ec.value());
|
||||
}
|
||||
@@ -599,7 +614,7 @@ struct hash<error_code>
|
||||
|
||||
// system_error
|
||||
|
||||
class system_error
|
||||
class _LIBCPP_VISIBLE system_error
|
||||
: public runtime_error
|
||||
{
|
||||
error_code __ec_;
|
||||
@@ -610,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);
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
187
include/thread
187
include/thread
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -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
|
||||
@@ -103,6 +106,71 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp>
|
||||
class __thread_specific_ptr
|
||||
{
|
||||
pthread_key_t __key_;
|
||||
|
||||
__thread_specific_ptr(const __thread_specific_ptr&);
|
||||
__thread_specific_ptr& operator=(const __thread_specific_ptr&);
|
||||
|
||||
static void __at_thread_exit(void*);
|
||||
public:
|
||||
typedef _Tp* pointer;
|
||||
|
||||
__thread_specific_ptr();
|
||||
~__thread_specific_ptr();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer get() const {return static_cast<_Tp*>(pthread_getspecific(__key_));}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer operator*() const {return *get();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer operator->() const {return get();}
|
||||
pointer release();
|
||||
void reset(pointer __p = nullptr);
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
void
|
||||
__thread_specific_ptr<_Tp>::__at_thread_exit(void* __p)
|
||||
{
|
||||
delete static_cast<pointer>(__p);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
__thread_specific_ptr<_Tp>::__thread_specific_ptr()
|
||||
{
|
||||
int __ec = pthread_key_create(&__key_, &__thread_specific_ptr::__at_thread_exit);
|
||||
if (__ec)
|
||||
throw system_error(error_code(__ec, system_category()),
|
||||
"__thread_specific_ptr construction failed");
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
__thread_specific_ptr<_Tp>::~__thread_specific_ptr()
|
||||
{
|
||||
pthread_key_delete(__key_);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
typename __thread_specific_ptr<_Tp>::pointer
|
||||
__thread_specific_ptr<_Tp>::release()
|
||||
{
|
||||
pointer __p = get();
|
||||
pthread_setspecific(__key_, 0);
|
||||
return __p;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
void
|
||||
__thread_specific_ptr<_Tp>::reset(pointer __p)
|
||||
{
|
||||
pointer __p_old = get();
|
||||
pthread_setspecific(__key_, __p);
|
||||
delete __p_old;
|
||||
}
|
||||
|
||||
class thread;
|
||||
class __thread_id;
|
||||
|
||||
@@ -113,7 +181,7 @@ __thread_id get_id();
|
||||
|
||||
} // this_thread
|
||||
|
||||
class __thread_id
|
||||
class _LIBCPP_VISIBLE __thread_id
|
||||
{
|
||||
// FIXME: pthread_t is a pointer on Darwin but a long on Linux.
|
||||
// NULL is the no-thread value on Darwin. Someone needs to check
|
||||
@@ -121,40 +189,50 @@ class __thread_id
|
||||
pthread_t __id_;
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__thread_id() : __id_(0) {}
|
||||
|
||||
friend bool operator==(__thread_id __x, __thread_id __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(__thread_id __x, __thread_id __y)
|
||||
{return __x.__id_ == __y.__id_;}
|
||||
friend bool operator!=(__thread_id __x, __thread_id __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(__thread_id __x, __thread_id __y)
|
||||
{return !(__x == __y);}
|
||||
friend bool operator< (__thread_id __x, __thread_id __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator< (__thread_id __x, __thread_id __y)
|
||||
{return __x.__id_ < __y.__id_;}
|
||||
friend bool operator<=(__thread_id __x, __thread_id __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator<=(__thread_id __x, __thread_id __y)
|
||||
{return !(__y < __x);}
|
||||
friend bool operator> (__thread_id __x, __thread_id __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator> (__thread_id __x, __thread_id __y)
|
||||
{return __y < __x ;}
|
||||
friend bool operator>=(__thread_id __x, __thread_id __y)
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator>=(__thread_id __x, __thread_id __y)
|
||||
{return !(__x < __y);}
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
friend
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id)
|
||||
{return __os << __id.__id_;}
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__thread_id(pthread_t __id) : __id_(__id) {}
|
||||
|
||||
friend __thread_id this_thread::get_id();
|
||||
friend class thread;
|
||||
friend class _LIBCPP_VISIBLE thread;
|
||||
};
|
||||
|
||||
template<class _Tp> struct hash;
|
||||
|
||||
template<>
|
||||
struct hash<__thread_id>
|
||||
struct _LIBCPP_VISIBLE hash<__thread_id>
|
||||
: public unary_function<__thread_id, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(__thread_id __v) const
|
||||
{
|
||||
const size_t* const __p = reinterpret_cast<const size_t*>(&__v);
|
||||
@@ -165,7 +243,7 @@ struct hash<__thread_id>
|
||||
namespace this_thread
|
||||
{
|
||||
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__thread_id
|
||||
get_id()
|
||||
{
|
||||
@@ -174,21 +252,17 @@ get_id()
|
||||
|
||||
} // this_thread
|
||||
|
||||
class thread
|
||||
class _LIBCPP_VISIBLE thread
|
||||
{
|
||||
pthread_t __t_;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
thread(const thread&) = delete;
|
||||
thread& operator=(const thread&) = delete;
|
||||
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
thread(const thread&);
|
||||
thread& operator=(const thread&);
|
||||
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
public:
|
||||
typedef __thread_id id;
|
||||
typedef pthread_t native_handle_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
thread() : __t_(0) {}
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class _F, class ..._Args,
|
||||
@@ -203,41 +277,76 @@ public:
|
||||
#endif
|
||||
~thread();
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
thread(thread&& __t) : __t_(__t.__t_) {__t.__t_ = 0;}
|
||||
thread& operator=(thread&& __t);
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(thread& __t) {_STD::swap(__t_, __t.__t_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool joinable() const {return __t_ != 0;}
|
||||
void join();
|
||||
void detach();
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
id get_id() const {return __t_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
native_handle_type native_handle() {return __t_;}
|
||||
|
||||
static unsigned hardware_concurrency();
|
||||
};
|
||||
|
||||
class __assoc_sub_state;
|
||||
|
||||
class _LIBCPP_HIDDEN __thread_struct_imp;
|
||||
|
||||
class __thread_struct
|
||||
{
|
||||
__thread_struct_imp* __p_;
|
||||
|
||||
__thread_struct(const __thread_struct&);
|
||||
__thread_struct& operator=(const __thread_struct&);
|
||||
public:
|
||||
__thread_struct();
|
||||
~__thread_struct();
|
||||
|
||||
void notify_all_at_thread_exit(condition_variable*, mutex*);
|
||||
void __make_ready_at_thread_exit(__assoc_sub_state*);
|
||||
};
|
||||
|
||||
__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(_STD::move(_STD::get<0>(__t)), _STD::move(_STD::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));
|
||||
(*__p)();
|
||||
typedef typename __make_tuple_indices<tuple_size<_F>::value, 1>::type _Index;
|
||||
__threaad_execute(*__p, _Index());
|
||||
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)...)));
|
||||
typedef tuple<typename decay<_F>::type, typename decay<_Args>::type...> _G;
|
||||
_STD::unique_ptr<_G> __p(new _G(__decay_copy(_STD::forward<_F>(__f)),
|
||||
__decay_copy(_STD::forward<_Args>(__args))...));
|
||||
int __ec = pthread_create(&__t_, 0, &__thread_proxy<_G>, __p.get());
|
||||
if (__ec == 0)
|
||||
__p.release();
|
||||
@@ -247,6 +356,16 @@ thread::thread(_F&& __f, _Args&&... __args)
|
||||
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _F>
|
||||
void*
|
||||
__thread_proxy(void* __vp)
|
||||
{
|
||||
__thread_local_data().reset(new __thread_struct);
|
||||
std::unique_ptr<_F> __p(static_cast<_F*>(__vp));
|
||||
(*__p)();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <class _F>
|
||||
thread::thread(_F __f)
|
||||
{
|
||||
@@ -260,9 +379,9 @@ thread::thread(_F __f)
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
thread&
|
||||
thread::operator=(thread&& __t)
|
||||
{
|
||||
@@ -273,9 +392,9 @@ thread::operator=(thread&& __t)
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void swap(thread& __x, thread& __y) {__x.swap(__y);}
|
||||
|
||||
namespace this_thread
|
||||
@@ -307,15 +426,15 @@ sleep_until(const chrono::time_point<_Clock, _Duration>& __t)
|
||||
}
|
||||
|
||||
template <class _Duration>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
sleep_until(const chrono::time_point<chrono::monotonic_clock, _Duration>& __t)
|
||||
sleep_until(const chrono::time_point<chrono::steady_clock, _Duration>& __t)
|
||||
{
|
||||
using namespace chrono;
|
||||
sleep_for(__t - monotonic_clock::now());
|
||||
sleep_for(__t - steady_clock::now());
|
||||
}
|
||||
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void yield() {sched_yield();}
|
||||
|
||||
} // this_thread
|
||||
|
369
include/tuple
369
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,8 +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...>&) 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...>&);
|
||||
@@ -101,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
|
||||
|
||||
@@ -122,13 +128,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
// tuple_size
|
||||
|
||||
template <class ..._Tp>
|
||||
class tuple_size<tuple<_Tp...>>
|
||||
: public integral_constant<size_t, sizeof...(_Tp)>
|
||||
{
|
||||
};
|
||||
|
||||
template <class ..._Tp>
|
||||
class tuple_size<const tuple<_Tp...>>
|
||||
class _LIBCPP_VISIBLE tuple_size<tuple<_Tp...> >
|
||||
: public integral_constant<size_t, sizeof...(_Tp)>
|
||||
{
|
||||
};
|
||||
@@ -136,17 +136,10 @@ class tuple_size<const tuple<_Tp...>>
|
||||
// tuple_element
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
class tuple_element<_Ip, tuple<_Tp...>>
|
||||
class _LIBCPP_VISIBLE tuple_element<_Ip, tuple<_Tp...> >
|
||||
{
|
||||
public:
|
||||
typedef typename tuple_element<_Ip, __tuple_types<_Tp...>>::type type;
|
||||
};
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
class tuple_element<_Ip, const tuple<_Tp...>>
|
||||
{
|
||||
public:
|
||||
typedef const typename tuple_element<_Ip, __tuple_types<_Tp...>>::type type;
|
||||
typedef typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type;
|
||||
};
|
||||
|
||||
// __tuple_leaf
|
||||
@@ -155,8 +148,9 @@ template <size_t _Ip, class _Hp, bool=is_empty<_Hp>::value>
|
||||
class __tuple_leaf;
|
||||
|
||||
template <size_t _Ip, class _Hp, bool _Ep>
|
||||
inline
|
||||
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());
|
||||
}
|
||||
@@ -193,18 +187,21 @@ public:
|
||||
{static_assert(!is_reference<_Hp>::value,
|
||||
"Attempted to default construct a reference element in a tuple");}
|
||||
|
||||
template <class _Tp>
|
||||
template <class _Tp,
|
||||
class = typename enable_if<is_constructible<_Hp, _Tp>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __tuple_leaf(_Tp&& __t)
|
||||
: value(_STD::forward<_Tp>(__t))
|
||||
{static_assert(!is_lvalue_reference<_Hp>::value ||
|
||||
{static_assert(!is_reference<_Hp>::value ||
|
||||
is_lvalue_reference<_Hp>::value &&
|
||||
(is_lvalue_reference<_Tp>::value ||
|
||||
is_same<typename remove_reference<_Tp>::type,
|
||||
reference_wrapper<
|
||||
typename remove_reference<_Hp>::type
|
||||
>
|
||||
>::value),
|
||||
>::value) ||
|
||||
(is_rvalue_reference<_Hp>::value &&
|
||||
!is_lvalue_reference<_Tp>::value),
|
||||
"Attempted to construct a reference element in a tuple with an rvalue");}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
@@ -249,6 +246,10 @@ public:
|
||||
>::value),
|
||||
"Attempted to construct a reference element in a tuple with an rvalue");}
|
||||
|
||||
__tuple_leaf(const __tuple_leaf& __t)
|
||||
: value(__t.get())
|
||||
{static_assert(!is_rvalue_reference<_Hp>::value, "Can not copy a tuple with rvalue reference member");}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __tuple_leaf(const __tuple_leaf<_Ip, _Tp>& __t)
|
||||
@@ -264,7 +265,7 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int swap(__tuple_leaf& __t)
|
||||
int swap(__tuple_leaf& __t) _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value)
|
||||
{
|
||||
_STD::swap(*this, __t);
|
||||
return 0;
|
||||
@@ -297,7 +298,8 @@ public:
|
||||
__tuple_leaf(integral_constant<int, 2>, const _Alloc& __a)
|
||||
: _Hp(__a) {}
|
||||
|
||||
template <class _Tp>
|
||||
template <class _Tp,
|
||||
class = typename enable_if<is_constructible<_Hp, _Tp>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __tuple_leaf(_Tp&& __t)
|
||||
: _Hp(_STD::forward<_Tp>(__t)) {}
|
||||
@@ -331,7 +333,9 @@ public:
|
||||
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);
|
||||
return 0;
|
||||
@@ -341,7 +345,23 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY const _Hp& get() const {return static_cast<const _Hp&>(*this);}
|
||||
};
|
||||
|
||||
template <class ..._Tp> void __swallow(_Tp&&...) {}
|
||||
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
|
||||
|
||||
@@ -353,6 +373,7 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
|
||||
{
|
||||
template <size_t ..._Uf, class ..._Tf,
|
||||
size_t ..._Ul, class ..._Tl, class ..._Up>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit
|
||||
__tuple_impl(__tuple_indices<_Uf...>, __tuple_types<_Tf...>,
|
||||
__tuple_indices<_Ul...>, __tuple_types<_Tl...>,
|
||||
@@ -363,6 +384,7 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
|
||||
|
||||
template <class _Alloc, size_t ..._Uf, class ..._Tf,
|
||||
size_t ..._Ul, class ..._Tl, class ..._Up>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit
|
||||
__tuple_impl(allocator_arg_t, const _Alloc& __a,
|
||||
__tuple_indices<_Uf...>, __tuple_types<_Tf...>,
|
||||
@@ -376,9 +398,10 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
|
||||
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)))...
|
||||
@@ -387,9 +410,10 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
|
||||
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,
|
||||
@@ -398,9 +422,10 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
|
||||
{}
|
||||
|
||||
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)
|
||||
@@ -410,25 +435,30 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
|
||||
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))...);
|
||||
}
|
||||
};
|
||||
|
||||
template <class ..._Tp>
|
||||
class tuple
|
||||
class _LIBCPP_VISIBLE tuple
|
||||
{
|
||||
typedef __tuple_impl<typename __make_tuple_indices<sizeof...(_Tp)>::type, _Tp...> base;
|
||||
|
||||
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...>&&);
|
||||
public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit tuple(const _Tp& ... __t)
|
||||
: base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(),
|
||||
typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
|
||||
@@ -438,6 +468,7 @@ public:
|
||||
) {}
|
||||
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t)
|
||||
: base_(allocator_arg_t(), __a,
|
||||
typename __make_tuple_indices<sizeof...(_Tp)>::type(),
|
||||
@@ -461,6 +492,7 @@ public:
|
||||
>::value
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit
|
||||
tuple(_Up&&... __u)
|
||||
: base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
|
||||
@@ -483,6 +515,7 @@ public:
|
||||
>::value
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u)
|
||||
: base_(allocator_arg_t(), __a,
|
||||
typename __make_tuple_indices<sizeof...(_Up)>::type(),
|
||||
@@ -497,6 +530,7 @@ public:
|
||||
__tuple_convertible<_Tuple, tuple>::value
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple(_Tuple&& __t)
|
||||
: base_(_STD::forward<_Tuple>(__t)) {}
|
||||
|
||||
@@ -506,6 +540,7 @@ public:
|
||||
__tuple_convertible<_Tuple, tuple>::value
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)
|
||||
: base_(allocator_arg_t(), __a, _STD::forward<_Tuple>(__t)) {}
|
||||
|
||||
@@ -515,6 +550,7 @@ public:
|
||||
__tuple_assignable<_Tuple, tuple>::value
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple&
|
||||
operator=(_Tuple&& __t)
|
||||
{
|
||||
@@ -522,54 +558,78 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
void swap(tuple& __t) {base_.swap(__t.base_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(tuple& __t) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value)
|
||||
{base_.swap(__t.base_);}
|
||||
};
|
||||
|
||||
template <>
|
||||
class tuple<>
|
||||
class _LIBCPP_VISIBLE tuple<>
|
||||
{
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple() {}
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple(allocator_arg_t, const _Alloc&) {}
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple(allocator_arg_t, const _Alloc&, const tuple&) {}
|
||||
template <class _U>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple(array<_U, 0>) {}
|
||||
template <class _Alloc, class _U>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple(allocator_arg_t, const _Alloc&, array<_U, 0>) {}
|
||||
void swap(tuple&) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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
|
||||
typename tuple_element<_Ip, tuple<_Tp...>>::type&
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
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
|
||||
const typename tuple_element<_Ip, tuple<_Tp...>>::type&
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
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&&
|
||||
get(tuple<_Tp...>&& __t)
|
||||
{
|
||||
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
|
||||
return static_cast<type&&>(
|
||||
static_cast<__tuple_leaf<_Ip, type>&&>(__t.base_).get());
|
||||
}
|
||||
|
||||
// tie
|
||||
|
||||
template <class ..._Tp>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
tuple<_Tp&...>
|
||||
tie(_Tp&... __t)
|
||||
{
|
||||
@@ -579,10 +639,13 @@ tie(_Tp&... __t)
|
||||
template <class _Up>
|
||||
struct __ignore_t
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__ignore_t() {}
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__ignore_t(_Tp&&) {}
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const __ignore_t& operator=(_Tp&&) const {return *this;}
|
||||
};
|
||||
|
||||
@@ -597,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;
|
||||
};
|
||||
@@ -609,7 +672,7 @@ struct __make_tuple_return
|
||||
};
|
||||
|
||||
template <class... _Tp>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
tuple<typename __make_tuple_return<_Tp>::type...>
|
||||
make_tuple(_Tp&&... __t)
|
||||
{
|
||||
@@ -617,7 +680,7 @@ make_tuple(_Tp&&... __t)
|
||||
}
|
||||
|
||||
template <class... _Tp>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
tuple<_Tp&&...>
|
||||
forward_as_tuple(_Tp&&... __t)
|
||||
{
|
||||
@@ -628,6 +691,7 @@ template <size_t _I>
|
||||
struct __tuple_equal
|
||||
{
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Tp& __x, const _Up& __y)
|
||||
{
|
||||
return __tuple_equal<_I - 1>()(__x, __y) && get<_I-1>(__x) == get<_I-1>(__y);
|
||||
@@ -638,6 +702,7 @@ template <>
|
||||
struct __tuple_equal<0>
|
||||
{
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Tp&, const _Up&)
|
||||
{
|
||||
return true;
|
||||
@@ -645,7 +710,7 @@ struct __tuple_equal<0>
|
||||
};
|
||||
|
||||
template <class ..._Tp, class ..._Up>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
|
||||
{
|
||||
@@ -653,7 +718,7 @@ operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
|
||||
}
|
||||
|
||||
template <class ..._Tp, class ..._Up>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
|
||||
{
|
||||
@@ -664,6 +729,7 @@ template <size_t _I>
|
||||
struct __tuple_less
|
||||
{
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Tp& __x, const _Up& __y)
|
||||
{
|
||||
return __tuple_less<_I-1>()(__x, __y) ||
|
||||
@@ -675,6 +741,7 @@ template <>
|
||||
struct __tuple_less<0>
|
||||
{
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Tp&, const _Up&)
|
||||
{
|
||||
return false;
|
||||
@@ -682,7 +749,7 @@ struct __tuple_less<0>
|
||||
};
|
||||
|
||||
template <class ..._Tp, class ..._Up>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
|
||||
{
|
||||
@@ -690,7 +757,7 @@ operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
|
||||
}
|
||||
|
||||
template <class ..._Tp, class ..._Up>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
|
||||
{
|
||||
@@ -698,7 +765,7 @@ operator>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
|
||||
}
|
||||
|
||||
template <class ..._Tp, class ..._Up>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
|
||||
{
|
||||
@@ -706,7 +773,7 @@ operator>=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
|
||||
}
|
||||
|
||||
template <class ..._Tp, class ..._Up>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
|
||||
{
|
||||
@@ -715,76 +782,144 @@ operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
|
||||
|
||||
// tuple_cat
|
||||
|
||||
template <class... _Tp, size_t ..._I1, class... _Up, size_t ..._I2>
|
||||
inline
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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 _STD::forward_as_tuple(_STD::forward<_Types>(get<_I0>(__t))...,
|
||||
get<_J0>(_STD::forward<_Tuple0>(__t0))...);
|
||||
}
|
||||
|
||||
template <class... _Tp, class... _Up>
|
||||
inline
|
||||
tuple<_Tp..., _Up...>
|
||||
tuple_cat(tuple<_Tp...>&& __x, tuple<_Up...>&& __y)
|
||||
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>()
|
||||
(_STD::forward_as_tuple(
|
||||
_STD::forward<_Types>(get<_I0>(__t))...,
|
||||
get<_J0>(_STD::forward<_Tuple0>(__t0))...
|
||||
),
|
||||
_STD::forward<_Tuple1>(__t1),
|
||||
_STD::forward<_Tuples>(__tpls)...);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Tuple0, class... _Tuples>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
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<>(), _STD::forward<_Tuple0>(__t0),
|
||||
_STD::forward<_Tuples>(__tpls)...);
|
||||
}
|
||||
|
||||
template <class ..._Tp, class _Alloc>
|
||||
struct uses_allocator<tuple<_Tp...>, _Alloc>
|
||||
struct _LIBCPP_VISIBLE uses_allocator<tuple<_Tp...>, _Alloc>
|
||||
: true_type {};
|
||||
|
||||
template <class _T1, class _T2>
|
||||
|
2132
include/type_traits
2132
include/type_traits
File diff suppressed because it is too large
Load Diff
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -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
|
||||
@@ -53,30 +53,47 @@ struct hash<type_index>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class type_index
|
||||
class _LIBCPP_VISIBLE type_index
|
||||
{
|
||||
const type_info* __t_;
|
||||
public:
|
||||
type_index(const type_info& __y) : __t_(&__y) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
type_index(const type_info& __y) _NOEXCEPT : __t_(&__y) {}
|
||||
|
||||
bool operator==(const type_index& __y) const {return *__t_ == *__y.__t_;}
|
||||
bool operator!=(const type_index& __y) const {return *__t_ != *__y.__t_;}
|
||||
bool operator< (const type_index& __y) const {return __t_->before(*__y.__t_);}
|
||||
bool operator<=(const type_index& __y) const {return !__y.__t_->before(*__t_);}
|
||||
bool operator> (const type_index& __y) const {return __y.__t_->before(*__t_);}
|
||||
bool operator>=(const type_index& __y) const {return !__t_->before(*__y.__t_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(const type_index& __y) const _NOEXCEPT
|
||||
{return *__t_ == *__y.__t_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(const type_index& __y) const _NOEXCEPT
|
||||
{return *__t_ != *__y.__t_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator< (const type_index& __y) const _NOEXCEPT
|
||||
{return __t_->before(*__y.__t_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator<=(const type_index& __y) const _NOEXCEPT
|
||||
{return !__y.__t_->before(*__t_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator> (const type_index& __y) const _NOEXCEPT
|
||||
{return __y.__t_->before(*__t_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator>=(const type_index& __y) const _NOEXCEPT
|
||||
{return !__t_->before(*__y.__t_);}
|
||||
|
||||
size_t hash_code() const {return __t_->hash_code();}
|
||||
const char* name() const {return __t_->name();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t hash_code() const _NOEXCEPT {return __t_->hash_code();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const char* name() const _NOEXCEPT {return __t_->name();}
|
||||
};
|
||||
|
||||
template <class _Tp> struct hash;
|
||||
template <class _Tp> struct _LIBCPP_VISIBLE hash;
|
||||
|
||||
template <>
|
||||
struct hash<type_index>
|
||||
struct _LIBCPP_VISIBLE hash<type_index>
|
||||
: public unary_function<type_index, size_t>
|
||||
{
|
||||
size_t operator()(type_index __index) const {return __index.hash_code();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(type_index __index) const _NOEXCEPT
|
||||
{return __index.hash_code();}
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -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
|
||||
@@ -73,22 +73,28 @@ class _LIBCPP_EXCEPTION_ABI type_info
|
||||
protected:
|
||||
const char* __type_name;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit type_info(const char* __n)
|
||||
: __type_name(__n) {}
|
||||
|
||||
public:
|
||||
virtual ~type_info();
|
||||
|
||||
const char* name() const {return __type_name;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const char* name() const _NOEXCEPT {return __type_name;}
|
||||
|
||||
bool before(const type_info& __arg) const
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool before(const type_info& __arg) const _NOEXCEPT
|
||||
{return __type_name < __arg.__type_name;}
|
||||
size_t hash_code() const throw()
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t hash_code() const _NOEXCEPT
|
||||
{return *reinterpret_cast<const size_t*>(&__type_name);}
|
||||
|
||||
bool operator==(const type_info& __arg) const
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(const type_info& __arg) const _NOEXCEPT
|
||||
{return __type_name == __arg.__type_name;}
|
||||
bool operator!=(const type_info& __arg) const
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(const type_info& __arg) const _NOEXCEPT
|
||||
{return !operator==(__arg);}
|
||||
|
||||
};
|
||||
@@ -97,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
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -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
|
||||
@@ -271,7 +311,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
|
||||
class _Alloc = allocator<_Value> >
|
||||
class unordered_set
|
||||
class _LIBCPP_VISIBLE unordered_set
|
||||
{
|
||||
public:
|
||||
// types
|
||||
@@ -299,7 +339,10 @@ public:
|
||||
typedef typename __table::const_local_iterator local_iterator;
|
||||
typedef typename __table::const_local_iterator const_local_iterator;
|
||||
|
||||
unordered_set() {} // = default;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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,
|
||||
@@ -317,10 +360,11 @@ public:
|
||||
explicit unordered_set(const allocator_type& __a);
|
||||
unordered_set(const unordered_set& __u);
|
||||
unordered_set(const unordered_set& __u, const allocator_type& __a);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
unordered_set(unordered_set&& __u);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
unordered_set(unordered_set&& __u)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
|
||||
unordered_set(unordered_set&& __u, const allocator_type& __a);
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
unordered_set(initializer_list<value_type> __il);
|
||||
unordered_set(initializer_list<value_type> __il, size_type __n,
|
||||
const hasher& __hf = hasher(),
|
||||
@@ -330,86 +374,133 @@ public:
|
||||
const allocator_type& __a);
|
||||
// ~unordered_set() = default;
|
||||
// unordered_set& operator=(const unordered_set& __u) = default;
|
||||
#ifdef _LIBCPP_MOVE
|
||||
unordered_set& operator=(unordered_set&& __u);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
unordered_set& operator=(unordered_set&& __u)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
|
||||
#endif
|
||||
unordered_set& operator=(initializer_list<value_type> __il);
|
||||
|
||||
allocator_type get_allocator() const
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const _NOEXCEPT
|
||||
{return allocator_type(__table_.__node_alloc());}
|
||||
|
||||
bool empty() const {return __table_.size() == 0;}
|
||||
size_type size() const {return __table_.size();}
|
||||
size_type max_size() const {return __table_.max_size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const _NOEXCEPT {return __table_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const _NOEXCEPT {return __table_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const _NOEXCEPT {return __table_.max_size();}
|
||||
|
||||
iterator begin() {return __table_.begin();}
|
||||
iterator end() {return __table_.end();}
|
||||
const_iterator begin() const {return __table_.begin();}
|
||||
const_iterator end() const {return __table_.end();}
|
||||
const_iterator cbegin() const {return __table_.begin();}
|
||||
const_iterator cend() const {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() _NOEXCEPT {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() _NOEXCEPT {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const _NOEXCEPT {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const _NOEXCEPT {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cend() const _NOEXCEPT {return __table_.end();}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#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)...);}
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator emplace_hint(const_iterator, _Args&&... __args)
|
||||
{return __table_.__emplace_unique(_STD::forward<_Args>(__args)...).first;}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> insert(const value_type& __x)
|
||||
{return __table_.__insert_unique(__x);}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> insert(value_type&& __x)
|
||||
{return __table_.__insert_unique(_STD::move(__x));}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator, const value_type& __x)
|
||||
{return insert(__x).first;}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator, value_type&& __x)
|
||||
{return insert(_STD::move(__x)).first;}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _InputIterator>
|
||||
void insert(_InputIterator __first, _InputIterator __last);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void insert(initializer_list<value_type> __il)
|
||||
{insert(__il.begin(), __il.end());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator erase(const_iterator __p) {return __table_.erase(__p);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator erase(const_iterator __first, const_iterator __last)
|
||||
{return __table_.erase(__first, __last);}
|
||||
void clear() {__table_.clear();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() _NOEXCEPT {__table_.clear();}
|
||||
|
||||
void swap(unordered_set& __u) {__table_.swap(__u.__table_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
key_equal key_eq() const {return __table_.key_eq();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator find(const key_type& __k) {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, iterator> equal_range(const key_type& __k)
|
||||
{return __table_.__equal_range_unique(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
|
||||
{return __table_.__equal_range_unique(__k);}
|
||||
|
||||
size_type bucket_count() const {return __table_.bucket_count();}
|
||||
size_type max_bucket_count() const {return __table_.max_bucket_count();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
local_iterator begin(size_type __n) {return __table_.begin(__n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
local_iterator end(size_type __n) {return __table_.end(__n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_local_iterator end(size_type __n) const {return __table_.cend(__n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
|
||||
|
||||
float load_factor() const {return __table_.load_factor();}
|
||||
float max_load_factor() const {return __table_.max_load_factor();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
float load_factor() const _NOEXCEPT {return __table_.load_factor();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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
|
||||
void rehash(size_type __n) {__table_.rehash(__n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void reserve(size_type __n) {__table_.reserve(__n);}
|
||||
};
|
||||
|
||||
@@ -460,7 +551,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
const allocator_type& __a)
|
||||
: __table_(__a)
|
||||
@@ -485,12 +576,13 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
insert(__u.begin(), __u.end());
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
unordered_set&& __u)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
|
||||
: __table_(_STD::move(__u.__table_))
|
||||
{
|
||||
}
|
||||
@@ -508,7 +600,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
@@ -537,21 +629,22 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
insert(__il.begin(), __il.end());
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
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_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
unordered_set<_Value, _Hash, _Pred, _Alloc>&
|
||||
unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(
|
||||
initializer_list<value_type> __il)
|
||||
@@ -562,7 +655,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
unordered_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
|
||||
_InputIterator __last)
|
||||
@@ -572,10 +665,11 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
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);
|
||||
}
|
||||
@@ -600,7 +694,7 @@ operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
@@ -610,7 +704,7 @@ operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
|
||||
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
|
||||
class _Alloc = allocator<_Value> >
|
||||
class unordered_multiset
|
||||
class _LIBCPP_VISIBLE unordered_multiset
|
||||
{
|
||||
public:
|
||||
// types
|
||||
@@ -638,7 +732,10 @@ public:
|
||||
typedef typename __table::const_local_iterator local_iterator;
|
||||
typedef typename __table::const_local_iterator const_local_iterator;
|
||||
|
||||
unordered_multiset() {} // = default
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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,
|
||||
@@ -656,10 +753,11 @@ public:
|
||||
explicit unordered_multiset(const allocator_type& __a);
|
||||
unordered_multiset(const unordered_multiset& __u);
|
||||
unordered_multiset(const unordered_multiset& __u, const allocator_type& __a);
|
||||
#ifdef _LIBCPP_MOVE
|
||||
unordered_multiset(unordered_multiset&& __u);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
unordered_multiset(unordered_multiset&& __u)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
|
||||
unordered_multiset(unordered_multiset&& __u, const allocator_type& __a);
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
unordered_multiset(initializer_list<value_type> __il);
|
||||
unordered_multiset(initializer_list<value_type> __il, size_type __n,
|
||||
const hasher& __hf = hasher(),
|
||||
@@ -669,84 +767,131 @@ public:
|
||||
const allocator_type& __a);
|
||||
// ~unordered_multiset() = default;
|
||||
// unordered_multiset& operator=(const unordered_multiset& __u) = default;
|
||||
#ifdef _LIBCPP_MOVE
|
||||
unordered_multiset& operator=(unordered_multiset&& __u);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
unordered_multiset& operator=(unordered_multiset&& __u)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
|
||||
#endif
|
||||
unordered_multiset& operator=(initializer_list<value_type> __il);
|
||||
|
||||
allocator_type get_allocator() const
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const _NOEXCEPT
|
||||
{return allocator_type(__table_.__node_alloc());}
|
||||
|
||||
bool empty() const {return __table_.size() == 0;}
|
||||
size_type size() const {return __table_.size();}
|
||||
size_type max_size() const {return __table_.max_size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const _NOEXCEPT {return __table_.size() == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type size() const _NOEXCEPT {return __table_.size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const _NOEXCEPT {return __table_.max_size();}
|
||||
|
||||
iterator begin() {return __table_.begin();}
|
||||
iterator end() {return __table_.end();}
|
||||
const_iterator begin() const {return __table_.begin();}
|
||||
const_iterator end() const {return __table_.end();}
|
||||
const_iterator cbegin() const {return __table_.begin();}
|
||||
const_iterator cend() const {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() _NOEXCEPT {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() _NOEXCEPT {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const _NOEXCEPT {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const _NOEXCEPT {return __table_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cbegin() const _NOEXCEPT {return __table_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cend() const _NOEXCEPT {return __table_.end();}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#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)...);}
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator emplace_hint(const_iterator __p, _Args&&... __args)
|
||||
{return __table_.__emplace_hint_multi(__p, _STD::forward<_Args>(__args)...);}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#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);}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(value_type&& __x) {return __table_.__insert_multi(_STD::move(__x));}
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __p, const value_type& __x)
|
||||
{return __table_.__insert_multi(__p, __x);}
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#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));}
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _InputIterator>
|
||||
void insert(_InputIterator __first, _InputIterator __last);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void insert(initializer_list<value_type> __il)
|
||||
{insert(__il.begin(), __il.end());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator erase(const_iterator __p) {return __table_.erase(__p);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator erase(const_iterator __first, const_iterator __last)
|
||||
{return __table_.erase(__first, __last);}
|
||||
void clear() {__table_.clear();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() _NOEXCEPT {__table_.clear();}
|
||||
|
||||
void swap(unordered_multiset& __u) {__table_.swap(__u.__table_);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
key_equal key_eq() const {return __table_.key_eq();}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator find(const key_type& __k) {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, iterator> equal_range(const key_type& __k)
|
||||
{return __table_.__equal_range_multi(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
|
||||
{return __table_.__equal_range_multi(__k);}
|
||||
|
||||
size_type bucket_count() const {return __table_.bucket_count();}
|
||||
size_type max_bucket_count() const {return __table_.max_bucket_count();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
local_iterator begin(size_type __n) {return __table_.begin(__n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
local_iterator end(size_type __n) {return __table_.end(__n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_local_iterator end(size_type __n) const {return __table_.cend(__n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
|
||||
|
||||
float load_factor() const {return __table_.load_factor();}
|
||||
float max_load_factor() const {return __table_.max_load_factor();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
float load_factor() const _NOEXCEPT {return __table_.load_factor();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
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
|
||||
void rehash(size_type __n) {__table_.rehash(__n);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void reserve(size_type __n) {__table_.reserve(__n);}
|
||||
};
|
||||
|
||||
@@ -798,7 +943,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
const allocator_type& __a)
|
||||
: __table_(__a)
|
||||
@@ -823,12 +968,13 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
insert(__u.begin(), __u.end());
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
unordered_multiset&& __u)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
|
||||
: __table_(_STD::move(__u.__table_))
|
||||
{
|
||||
}
|
||||
@@ -846,7 +992,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
@@ -875,19 +1021,20 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
insert(__il.begin(), __il.end());
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
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_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
@@ -901,7 +1048,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
|
||||
_InputIterator __last)
|
||||
@@ -911,10 +1058,11 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
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);
|
||||
}
|
||||
@@ -943,7 +1091,7 @@ operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
}
|
||||
|
||||
template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
|
||||
const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
|
||||
|
196
include/utility
196
include/utility
@@ -3,8 +3,8 @@
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -29,20 +29,28 @@ 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
|
||||
<
|
||||
!has_nothrow_move_constructor<T>::value && has_copy_constructor<T>::value,
|
||||
!is_nothrow_move_constructible<T>::value && is_copy_constructible<T>::value,
|
||||
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,11 +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>&&) noexcept;
|
||||
|
||||
} // std
|
||||
|
||||
@@ -164,37 +181,34 @@ 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);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
typename conditional
|
||||
<
|
||||
!has_nothrow_move_constructor<_Tp>::value && has_copy_constructor<_Tp>::value,
|
||||
!is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value,
|
||||
const _Tp&,
|
||||
_Tp&&
|
||||
>::type
|
||||
#else // _LIBCPP_MOVE
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
const _Tp&
|
||||
#endif
|
||||
move_if_noexcept(_Tp& __x)
|
||||
move_if_noexcept(_Tp& __x) _NOEXCEPT
|
||||
{
|
||||
return _STD::move(__x);
|
||||
}
|
||||
|
||||
struct piecewise_construct_t { };
|
||||
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 pair
|
||||
struct _LIBCPP_VISIBLE pair
|
||||
{
|
||||
typedef _T1 first_type;
|
||||
typedef _T2 second_type;
|
||||
@@ -202,12 +216,30 @@ struct 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) {}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
template<class _U1, class _U2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair(const pair<_U1, _U2>& __p,
|
||||
typename enable_if<is_convertible<_U1, _T1>::value &&
|
||||
is_convertible<_U2, _T2>::value>::type* = 0)
|
||||
: first(__p.first), second(__p.second) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair& operator=(const pair& __p)
|
||||
{
|
||||
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 &&
|
||||
@@ -218,6 +250,24 @@ struct pair
|
||||
second(_STD::forward<_U2>(__u2))
|
||||
{}
|
||||
|
||||
template<class _U1, class _U2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair(pair<_U1, _U2>&& __p,
|
||||
typename enable_if<is_convertible<_U1, _T1>::value &&
|
||||
is_convertible<_U2, _T2>::value>::type* = 0)
|
||||
: first(_STD::forward<_U1>(__p.first)),
|
||||
second(_STD::forward<_U2>(__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 = _STD::forward<first_type>(__p.first);
|
||||
second = _STD::forward<second_type>(__p.second);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template<class _Tuple,
|
||||
@@ -230,7 +280,10 @@ struct pair
|
||||
typename __make_tuple_types<_Tuple>::type>::type>(get<1>(__p)))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args,
|
||||
tuple<_Args2...> __second_args)
|
||||
: pair(__pc, __first_args, __second_args,
|
||||
@@ -240,6 +293,7 @@ struct pair
|
||||
|
||||
template <class _Tuple,
|
||||
class = typename enable_if<__tuple_assignable<_Tuple, pair>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair&
|
||||
operator=(_Tuple&& __p)
|
||||
{
|
||||
@@ -253,16 +307,20 @@ struct pair
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#else // _LIBCPP_MOVE
|
||||
template<class _U1, class _U2>
|
||||
_LIBCPP_INLINE_VISIBILITY pair(const pair<_U1, _U2>& __p)
|
||||
: first(__p.first), second(__p.second) {}
|
||||
#endif // _LIBCPP_MOVE
|
||||
void _LIBCPP_INLINE_VISIBILITY swap(pair& __p) {_STD::swap(*this, __p);}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(pair& __p) _NOEXCEPT_(__is_nothrow_swappable<first_type>::value &&
|
||||
__is_nothrow_swappable<second_type>::value)
|
||||
{
|
||||
_STD::iter_swap(&first, &__p.first);
|
||||
_STD::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...>);
|
||||
@@ -319,14 +377,20 @@ 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);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MOVE
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp> class reference_wrapper;
|
||||
|
||||
@@ -349,7 +413,7 @@ struct __make_pair_return
|
||||
};
|
||||
|
||||
template <class _T1, class _T2>
|
||||
inline
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
pair<typename __make_pair_return<_T1>::type, typename __make_pair_return<_T2>::type>
|
||||
make_pair(_T1&& __t1, _T2&& __t2)
|
||||
{
|
||||
@@ -357,7 +421,7 @@ make_pair(_T1&& __t1, _T2&& __t2)
|
||||
(_STD::forward<_T1>(__t1), _STD::forward<_T2>(__t2));
|
||||
}
|
||||
|
||||
#else // _LIBCPP_MOVE
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _T1, class _T2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -367,39 +431,41 @@ make_pair(_T1 __x, _T2 __y)
|
||||
return pair<_T1, _T2>(__x, __y);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_MOVE
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _T1, class _T2>
|
||||
class tuple_size<pair<_T1, _T2> > : public integral_constant<size_t, 2> {};
|
||||
class _LIBCPP_VISIBLE tuple_size<pair<_T1, _T2> >
|
||||
: public integral_constant<size_t, 2> {};
|
||||
|
||||
template <class _T1, class _T2>
|
||||
class tuple_size<const pair<_T1, _T2> > : public integral_constant<size_t, 2> {};
|
||||
class _LIBCPP_VISIBLE tuple_size<const pair<_T1, _T2> >
|
||||
: public integral_constant<size_t, 2> {};
|
||||
|
||||
template <class _T1, class _T2>
|
||||
class tuple_element<0, pair<_T1, _T2> >
|
||||
class _LIBCPP_VISIBLE tuple_element<0, pair<_T1, _T2> >
|
||||
{
|
||||
public:
|
||||
typedef _T1 type;
|
||||
};
|
||||
|
||||
template <class _T1, class _T2>
|
||||
class tuple_element<1, pair<_T1, _T2> >
|
||||
class _LIBCPP_VISIBLE tuple_element<1, pair<_T1, _T2> >
|
||||
{
|
||||
public:
|
||||
typedef _T2 type;
|
||||
};
|
||||
|
||||
template <class _T1, class _T2>
|
||||
class tuple_element<0, const pair<_T1, _T2> >
|
||||
class _LIBCPP_VISIBLE tuple_element<0, const pair<_T1, _T2> >
|
||||
{
|
||||
public:
|
||||
typedef const _T1 type;
|
||||
};
|
||||
|
||||
template <class _T1, class _T2>
|
||||
class tuple_element<1, const pair<_T1, _T2> >
|
||||
class _LIBCPP_VISIBLE tuple_element<1, const pair<_T1, _T2> >
|
||||
{
|
||||
public:
|
||||
typedef const _T2 type;
|
||||
@@ -414,13 +480,23 @@ 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
|
||||
|
||||
template <class _T1, class _T2>
|
||||
static
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_T1&&
|
||||
get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _STD::forward<_T1>(__p.first);}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
};
|
||||
|
||||
template <>
|
||||
@@ -430,19 +506,29 @@ 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
|
||||
|
||||
template <class _T1, class _T2>
|
||||
static
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_T2&&
|
||||
get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _STD::forward<_T2>(__p.second);}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -450,11 +536,23 @@ 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);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
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) _NOEXCEPT
|
||||
{
|
||||
return __get_pair<_Ip>::get(_STD::move(__p));
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
644
include/valarray
644
include/valarray
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user